@accurix/centrinfo-widget 5.0.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -30
- package/dist/cdn/centrinfo-widget-charts.js +15826 -0
- package/dist/cdn/centrinfo-widget-dev.js +122 -0
- package/dist/cdn/centrinfo-widget.js +272 -629
- package/dist/cdn/manifest.json +20 -6
- package/dist/dev-transports-DqSPyIEz.mjs +1 -0
- package/dist/dev-transports-KlSdSZpj.cjs +1 -0
- package/dist/echarts-runtime-BfpVL8xu.cjs +24 -0
- package/dist/echarts-runtime-Bu1uy4oO.mjs +18 -0
- package/dist/index.cjs +1 -1
- 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 +1 -1
- package/dist/runtime.cjs +2 -2
- package/dist/runtime.d.cts +152 -41
- package/dist/runtime.d.mts +25 -123
- package/dist/runtime.mjs +2 -2
- package/dist/styles-CvzR5bT8.cjs +3516 -0
- package/dist/styles-mW_qo6Ed.mjs +3516 -0
- package/dist/{types-BGKFxmKB.d.cts → types-D0VIOagk.d.cts} +514 -2
- package/dist/{types-DhmmWqaj.d.mts → types-k3nQBQjf.d.mts} +724 -4
- package/package.json +2 -5
- package/dist/styles-BgWsSZsR.cjs +0 -7714
- package/dist/styles-CIJFMOKa.mjs +0 -3869
|
@@ -1,39 +1,175 @@
|
|
|
1
|
-
var Centrinfo=(function(Vr){"use strict";var YO=Object.defineProperty;var XO=(Vr,ur,Be)=>ur in Vr?YO(Vr,ur,{enumerable:!0,configurable:!0,writable:!0,value:Be}):Vr[ur]=Be;var se=(Vr,ur,Be)=>XO(Vr,typeof ur!="symbol"?ur+"":ur,Be);var ur,Be,zp,Ln,Fp,Hp,Vp,hu,Ps,Ji,Up,pu,vu,gu,Gp,Rs={},Es=[],J1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Os=Array.isArray;function fn(t,e){for(var r in e)t[r]=e[r];return t}function mu(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Q1(t,e,r){var n,a,i,o={};for(i in e)i=="key"?n=e[i]:i=="ref"?a=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?ur.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)o[i]===void 0&&(o[i]=t.defaultProps[i]);return Ns(t,o,n,a,null)}function Ns(t,e,r,n,a){var i={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++zp,__i:-1,__u:0};return a==null&&Be.vnode!=null&&Be.vnode(i),i}function Me(t){return t.children}function Bs(t,e){this.props=t,this.context=e}function ti(t,e){if(e==null)return t.__?ti(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?ti(t):null}function ew(t){if(t.__P&&t.__d){var e=t.__v,r=e.__e,n=[],a=[],i=fn({},e);i.__v=e.__v+1,Be.vnode&&Be.vnode(i),_u(t.__P,i,e,t.__n,t.__P.namespaceURI,32&e.__u?[r]:null,n,r??ti(e),!!(32&e.__u),a),i.__v=e.__v,i.__.__k[i.__i]=i,Zp(n,i,a),e.__e=e.__=null,i.__e!=r&&$p(i)}}function $p(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),$p(t)}function yu(t){(!t.__d&&(t.__d=!0)&&Ln.push(t)&&!zs.__r++||Fp!=Be.debounceRendering)&&((Fp=Be.debounceRendering)||Hp)(zs)}function zs(){try{for(var t,e=1;Ln.length;)Ln.length>e&&Ln.sort(Vp),t=Ln.shift(),e=Ln.length,ew(t)}finally{Ln.length=zs.__r=0}}function Wp(t,e,r,n,a,i,o,s,l,c,u){var f,h,d,p,m,g,v,y=n&&n.__k||Es,b=e.length;for(l=tw(r,e,y,l,b),f=0;f<b;f++)(d=r.__k[f])!=null&&(h=d.__i!=-1&&y[d.__i]||Rs,d.__i=f,g=_u(t,d,h,a,i,o,s,l,c,u),p=d.__e,d.ref&&h.ref!=d.ref&&(h.ref&&xu(h.ref,null,d),u.push(d.ref,d.__c||p,d)),m==null&&p!=null&&(m=p),(v=!!(4&d.__u))||h.__k===d.__k?(l=qp(d,l,t,v),v&&h.__e&&(h.__e=null)):typeof d.type=="function"&&g!==void 0?l=g:p&&(l=p.nextSibling),d.__u&=-7);return r.__e=m,l}function tw(t,e,r,n,a){var i,o,s,l,c,u=r.length,f=u,h=0;for(t.__k=new Array(a),i=0;i<a;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=t.__k[i]=Ns(null,o,null,null,null):Os(o)?o=t.__k[i]=Ns(Me,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=t.__k[i]=Ns(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[i]=o,l=i+h,o.__=t,o.__b=t.__b+1,s=null,(c=o.__i=rw(o,r,l,f))!=-1&&(f--,(s=r[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(a>u?h--:a<u&&h++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):t.__k[i]=null;if(f)for(i=0;i<u;i++)(s=r[i])!=null&&(2&s.__u)==0&&(s.__e==n&&(n=ti(s)),jp(s,s));return n}function qp(t,e,r,n){var a,i;if(typeof t.type=="function"){for(a=t.__k,i=0;a&&i<a.length;i++)a[i]&&(a[i].__=t,e=qp(a[i],e,r,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=ti(t)),r.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function rw(t,e,r,n){var a,i,o,s=t.key,l=t.type,c=e[r],u=c!=null&&(2&c.__u)==0;if(c===null&&s==null||u&&s==c.key&&l==c.type)return r;if(n>(u?1:0)){for(a=r-1,i=r+1;a>=0||i<e.length;)if((c=e[o=a>=0?a--:i++])!=null&&(2&c.__u)==0&&s==c.key&&l==c.type)return o}return-1}function Yp(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||J1.test(e)?r:r+"px"}function Fs(t,e,r,n,a){var i,o;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Yp(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Yp(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Up,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=r,r?n?r[Ji]=n[Ji]:(r[Ji]=pu,t.addEventListener(e,i?gu:vu,i)):t.removeEventListener(e,i?gu:vu,i);else{if(a=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Xp(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e[Ps]==null)e[Ps]=pu++;else if(e[Ps]<r[Ji])return;return r(Be.event?Be.event(e):e)}}}function _u(t,e,r,n,a,i,o,s,l,c){var u,f,h,d,p,m,g,v,y,b,x,w,S,k,C,A=e.type;if(e.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[s=e.__e=r.__e]),(u=Be.__b)&&u(e);e:if(typeof A=="function")try{if(v=e.props,y=A.prototype&&A.prototype.render,b=(u=A.contextType)&&n[u.__c],x=u?b?b.props.value:u.__:n,r.__c?g=(f=e.__c=r.__c).__=f.__E:(y?e.__c=f=new A(v,x):(e.__c=f=new Bs(v,x),f.constructor=A,f.render=aw),b&&b.sub(f),f.state||(f.state={}),f.__n=n,h=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=fn({},f.__s)),fn(f.__s,A.getDerivedStateFromProps(v,f.__s))),d=f.props,p=f.state,f.__v=e,h)y&&A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&A.getDerivedStateFromProps==null&&v!==d&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),e.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(v,f.__s,x)===!1){e.__v!=r.__v&&(f.props=v,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(M){M&&(M.__=e)}),Es.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(d,p,m)})}if(f.context=x,f.props=v,f.__P=t,f.__e=!1,w=Be.__r,S=0,y)f.state=f.__s,f.__d=!1,w&&w(e),u=f.render(f.props,f.state,f.context),Es.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(e),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++S<25);f.state=f.__s,f.getChildContext!=null&&(n=fn(fn({},n),f.getChildContext())),y&&!h&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(d,p)),k=u!=null&&u.type===Me&&u.key==null?Kp(u.props.children):u,s=Wp(t,Os(k)?k:[k],e,r,n,a,i,o,s,l,c),f.base=e.__e,e.__u&=-161,f.__h.length&&o.push(f),g&&(f.__E=f.__=null)}catch(M){if(e.__v=null,l||i!=null)if(M.then){for(e.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,e.__e=s}else{for(C=i.length;C--;)mu(i[C]);bu(e)}else e.__e=r.__e,e.__k=r.__k,M.then||bu(e);Be.__e(M,e,r)}else i==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):s=e.__e=nw(r.__e,e,r,n,a,i,o,l,c);return(u=Be.diffed)&&u(e),128&e.__u?void 0:s}function bu(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(bu))}function Zp(t,e,r){for(var n=0;n<r.length;n++)xu(r[n],r[++n],r[++n]);Be.__c&&Be.__c(e,t),t.some(function(a){try{t=a.__h,a.__h=[],t.some(function(i){i.call(a)})}catch(i){Be.__e(i,a.__v)}})}function Kp(t){return typeof t!="object"||t==null||t.__b>0?t:Os(t)?t.map(Kp):t.constructor!==void 0?null:fn({},t)}function nw(t,e,r,n,a,i,o,s,l){var c,u,f,h,d,p,m,g=r.props||Rs,v=e.props,y=e.type;if(y=="svg"?a="http://www.w3.org/2000/svg":y=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((d=i[c])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){t=d,i[c]=null;break}}if(t==null){if(y==null)return document.createTextNode(v);t=document.createElementNS(a,y,v.is&&v),s&&(Be.__m&&Be.__m(e,i),s=!1),i=null}if(y==null)g===v||s&&t.data==v||(t.data=v);else{if(i=y=="textarea"&&v.defaultValue!=null?null:i&&ur.call(t.childNodes),!s&&i!=null)for(g={},c=0;c<t.attributes.length;c++)g[(d=t.attributes[c]).name]=d.value;for(c in g)d=g[c],c=="dangerouslySetInnerHTML"?f=d:c=="children"||c in v||c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v||Fs(t,c,null,d,a);for(c in v)d=v[c],c=="children"?h=d:c=="dangerouslySetInnerHTML"?u=d:c=="value"?p=d:c=="checked"?m=d:s&&typeof d!="function"||g[c]===d||Fs(t,c,d,g[c],a);if(u)s||f&&(u.__html==f.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),e.__k=[];else if(f&&(t.innerHTML=""),Wp(e.type=="template"?t.content:t,Os(h)?h:[h],e,r,n,y=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,o,i?i[0]:r.__k&&ti(r,0),s,l),i!=null)for(c=i.length;c--;)mu(i[c]);s&&y!="textarea"||(c="value",y=="progress"&&p==null?t.removeAttribute("value"):p!=null&&(p!==t[c]||y=="progress"&&!p||y=="option"&&p!=g[c])&&Fs(t,c,p,g[c],a),c="checked",m!=null&&m!=t[c]&&Fs(t,c,m,g[c],a))}return t}function xu(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(a){Be.__e(a,r)}}function jp(t,e,r){var n,a;if(Be.unmount&&Be.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||xu(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){Be.__e(i,e)}n.base=n.__P=null}if(n=t.__k)for(a=0;a<n.length;a++)n[a]&&jp(n[a],e,r||typeof t.type!="function");r||mu(t.__e),t.__c=t.__=t.__e=void 0}function aw(t,e,r){return this.constructor(t,r)}function Jp(t,e,r){var n,a,i,o;e==document&&(e=document.documentElement),Be.__&&Be.__(t,e),a=(n=!1)?null:e.__k,i=[],o=[],_u(e,t=e.__k=Q1(Me,null,[t]),a||Rs,Rs,e.namespaceURI,a?null:e.firstChild?ur.call(e.childNodes):null,i,a?a.__e:e.firstChild,n,o),Zp(i,t,o)}function iw(t){function e(r){var n,a;return this.getChildContext||(n=new Set,(a={})[e.__c]=this,this.getChildContext=function(){return a},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&n.forEach(function(o){o.__e=!0,yu(o)})},this.sub=function(i){n.add(i);var o=i.componentWillUnmount;i.componentWillUnmount=function(){n&&n.delete(i),o&&o.call(i)}}),r.children}return e.__c="__cC"+Gp++,e.__=t,e.Provider=e.__l=(e.Consumer=function(r,n){return r.children(n)}).contextType=e,e}ur=Es.slice,Be={__e:function(t,e,r,n){for(var a,i,o;e=e.__;)if((a=e.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(t)),o=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(t,n||{}),o=a.__d),o)return a.__E=a}catch(s){t=s}throw t}},zp=0,Bs.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=fn({},this.state),typeof t=="function"&&(t=t(fn({},r),this.props)),t&&fn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),yu(this))},Bs.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),yu(this))},Bs.prototype.render=Me,Ln=[],Hp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vp=function(t,e){return t.__v.__b-e.__v.__b},zs.__r=0,hu=Math.random().toString(8),Ps="__d"+hu,Ji="__a"+hu,Up=/(PointerCapture)$|Capture$/i,pu=0,vu=Xp(!1),gu=Xp(!0),Gp=0;var ow=0;function _(t,e,r,n,a,i){e||(e={});var o,s,l=e;if("ref"in l)for(s in l={},e)s=="ref"?o=e[s]:l[s]=e[s];var c={type:t,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ow,__i:-1,__u:0,__source:a,__self:i};if(typeof t=="function"&&(o=t.defaultProps))for(s in o)l[s]===void 0&&(l[s]=o[s]);return Be.vnode&&Be.vnode(c),c}class Qi extends Error{constructor(r,n){super(n);se(this,"status");this.status=r,this.name="ApiError"}}const wu=()=>({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:[]}),sw="Sara is an AI assistant; answers may be imperfect.",lw="Accurix is an AI assistant; answers may be imperfect.",Qp=t=>{typeof console>"u"||console.warn(`[centrinfo-widget] Could not load saved widget configuration from the API (${t}). Showing default widget chrome. Check data-token, data-api-base, CORS, and backend availability.`)},Su=(t,e={})=>{const n=t.disclaimerText?.trim()?.toLowerCase(),a=e.agentName?.trim()||t.agentName?.trim()||"Accurix",i=e.agentAvatarUrl?.trim()||t.agentAvatarUrl?.trim();return{...t,allowVoiceInput:!!(t.allowVoiceInput&&t.talkbackMode&&t.talkbackMode!=="text"),voiceOutputEnabled:!!(t.voiceOutputEnabled&&t.talkbackMode&&t.talkbackMode!=="text"),agentName:a,agentAvatarUrl:i||void 0,disclaimerText:n===sw.toLowerCase()||n?.includes("sara is an ai assistant")?lw:t.disclaimerText}};class ev{constructor(e,r,n,a,i={},o,s,l="floating"){se(this,"baseUrl");se(this,"token");se(this,"gifApiKey");se(this,"analyticsContextToken");se(this,"bootstrapOverrides");se(this,"identityToken");se(this,"identityTokenProvider");se(this,"chatSurface");this.baseUrl=e,this.token=r,this.gifApiKey=n,this.analyticsContextToken=a,this.bootstrapOverrides=i,this.identityToken=o,this.identityTokenProvider=s,this.chatSurface=l}async currentIdentityToken(){if(this.identityTokenProvider){const e=await this.identityTokenProvider();this.identityToken=e?.trim()||void 0}return this.identityToken}headers(e=!0){const r={Authorization:`Bearer ${this.token}`};return e&&(r["Content-Type"]="application/json"),r}async json(e){let r;try{r=await e.json()}catch{r=void 0}if(!e.ok){const n=uw(r)??`request failed (${e.status})`;throw new Qi(e.status,n)}return r?.data??r}async bootstrap(){try{const e=await fetch(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!e.ok)return Qp(`bootstrap request failed with ${e.status}`),Su(wu(),this.bootstrapOverrides);const r=await this.json(e);return Su({...wu(),...r},this.bootstrapOverrides)}catch(e){return Qp(e instanceof Error?e.message:"bootstrap request failed"),Su(wu(),this.bootstrapOverrides)}}async history(){const e=await this.currentIdentityToken();if(!e)return{conversations:[]};const r=await fetch(`${this.baseUrl}/public-chat/history`,{method:"POST",headers:this.headers(),body:JSON.stringify({identityToken:e,surface:this.chatSurface})}),n=await this.json(r);return{activeSessionId:n.activeSessionId,conversations:Array.isArray(n.conversations)?n.conversations:[]}}async stream(e,r,n){const a=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat/stream`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:e,sessionId:r,clientMessageId:n.clientMessageId,attachmentId:n.attachmentId,attachmentIds:n.attachmentIds,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:a,surface:this.chatSurface}),signal:n.signal});return!i.ok||!i.body?this.send(e,r,n):fw(i.body,n)}async liveEvents(e,r){const n=`sessionId=${encodeURIComponent(e)}&after=${encodeURIComponent(r)}`,a=await fetch(`${this.baseUrl}/public-chat/live-events?${n}`,{headers:this.headers(!1)}),i=await this.json(a);return{mode:i.mode??"ai",assignedAgentName:i.assignedAgentName,agentTyping:!!i.agentTyping,agentTypingName:i.agentTypingName,conversationEnded:!!i.conversationEnded,events:i.events??[]}}async typing(e,r){try{const n=await fetch(`${this.baseUrl}/public-chat/typing`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:e,isTyping:r})});if(!n.ok)try{await n.text()}catch{}}catch{}}async presence(e){try{await fetch(`${this.baseUrl}/public-chat/presence`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:e})})}catch{}}async send(e,r,n){const a=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:e,sessionId:r,clientMessageId:n.clientMessageId,attachmentId:n.attachmentId,attachmentIds:n.attachmentIds,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:a,surface:this.chatSurface}),signal:n.signal}),o=await this.json(i);return n.onChunk(o.answer??""),{answer:o.answer??"",sources:o.sources??[],suggestedReplies:o.suggestedReplies??[],availableActions:o.availableActions??[],actions:o.actions??[],selectedAction:o.selectedAction,handoffOffered:o.handoffOffered??!1,requestedContactFields:tv(o.requestedContactFields),conversationEnded:o.conversationEnded??!1,liveMode:o.liveMode,assignedAgentName:o.assignedAgentName,audioBase64:o.audioBase64,mimeType:o.mimeType,visualization:o.visualization,artifacts:o.artifacts}}async action(e,r,n){const a=n?.trim()||(e==="contact-support"?"inquiry":e),i=await fetch(`${this.baseUrl}/public-chat/${a}`,{method:"POST",headers:this.headers(),body:JSON.stringify(r)}),o=await this.json(i);return{ok:!0,note:o?.note,booking:o?.booking,caseReference:o?.caseReference||void 0,inquiryId:o?.inquiryId||o?.inquiry?.id||void 0}}async confirmHostedBooking(e){const r=await fetch(`${this.baseUrl}/public-chat/book-demo/confirm`,{method:"POST",headers:this.headers(),body:JSON.stringify(e)}),n=await this.json(r);if(!n?.booking)throw new Error("Calendar booking confirmation was unavailable.");return n.booking}async speak(e){const r=await fetch(`${this.baseUrl}/public-chat/speak`,{method:"POST",headers:this.headers(),body:JSON.stringify({text:e})}),n=await this.json(r);return{providerReady:!!n.providerReady,message:n.message,audioBase64:n.audioBase64,mimeType:n.mimeType}}async identify(e,r){if(!(!e||!r))try{const n=await fetch(`${this.baseUrl}/public-chat/identify`,{method:"POST",headers:this.headers(),body:JSON.stringify(cw(e,r))});if(!n.ok)try{await n.text()}catch{}}catch{}}async transcribe(e,r,n,a){const i=await fetch(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(),body:JSON.stringify({audioBase64:e,mimeType:r,languageHint:n,durationSeconds:a})});return(await this.json(i)).text??""}async transcribeAudio(e,r,n,a){const i=new FormData;i.append("audio",e,"voice-recording"),i.append("mimeType",r||e.type||"audio/webm"),n&&i.append("languageHint",n),a!==void 0&&Number.isFinite(a)&&i.append("durationSeconds",String(a));const o=await fetch(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(!1),body:i});return(await this.json(o)).text??""}async endConversation(e){try{const r=await fetch(`${this.baseUrl}/public-chat/end`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:e})});if(!r.ok)try{await r.text()}catch{}}catch{}}async sendFeedback(e){try{const r=await fetch(`${this.baseUrl}/public-chat/feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify(e)});if(!r.ok)try{await r.text()}catch{}}catch{}}async uploadAttachment(e,r,n,a,i){const o=await fetch(`${this.baseUrl}/public-chat/attachments`,{method:"POST",headers:this.headers(),body:JSON.stringify({fileBase64:e,mimeType:r,filename:n,sessionId:a,analyze:i})});return this.json(o)}async fetchAttachment(e,r){const n=await fetch(`${this.baseUrl}/public-chat/attachments/${encodeURIComponent(e)}?sessionId=${encodeURIComponent(r)}`,{headers:this.headers(!1)});if(!n.ok)throw new Qi(n.status,"This file is no longer available.");return n.blob()}async demoSlots(e,r){const n=`from=${encodeURIComponent(e)}&to=${encodeURIComponent(r)}`,a=await fetch(`${this.baseUrl}/public-chat/demo-slots?${n}`,{headers:this.headers(!1)});if(!a.ok){const o=new Error("Calendar availability is temporarily unavailable.");throw o.status=a.status,o}const i=await this.json(a);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[];const n=`https://tenor.googleapis.com/v2/search?q=${encodeURIComponent(e.trim()||"trending")}&key=${this.gifApiKey}&limit=24&media_filter=tinygif,gif&contentfilter=high`;try{const a=await fetch(n);return a.ok?((await a.json()).results??[]).map(o=>({id:o.id,url:o.media_formats?.gif?.url??o.media_formats?.tinygif?.url??"",preview:o.media_formats?.tinygif?.url??o.media_formats?.gif?.url??"",alt:o.content_description||"GIF"})).filter(o=>o.url):[]}catch{return[]}}}const cw=(t,e)=>{const r={...e.customAttributes??{},...e.metadata??{}};e.createdAt!==void 0&&(r.createdAt=e.createdAt),e.avatarUrl&&(r.avatarUrl=e.avatarUrl),e.company&&(r.company=e.company);const n={sessionId:t},a=e.externalId??e.userId;return a&&(n.externalId=a),e.email&&(n.email=e.email),e.firstName&&(n.firstName=e.firstName),e.lastName&&(n.lastName=e.lastName),e.name&&(n.name=e.name),e.phone&&(n.phone=e.phone),Object.keys(r).length>0&&(n.metadata=r),n},uw=t=>{const e=t?.message;if(Array.isArray(e))return e.join(", ");if(typeof e=="string")return e},fw=async(t,e)=>{const r=t.getReader(),n=new TextDecoder,a={answer:"",sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1};let i="";for(;;){const{done:o,value:s}=await r.read();if(o)break;i+=n.decode(s,{stream:!0});let l;for(;(l=i.indexOf(`
|
|
1
|
+
var Centrinfo=(function(St){"use strict";var Pp=Object.defineProperty;var Op=(St,$t,Jt)=>$t in St?Pp(St,$t,{enumerable:!0,configurable:!0,writable:!0,value:Jt}):St[$t]=Jt;var q=(St,$t,Jt)=>Op(St,typeof $t!="symbol"?$t+"":$t,Jt);const $t={notComparable:"Not comparable yet"},Jt=e=>!e||e==="observed"||e==="confirmed_zero",Ir=(e,t)=>{let n=typeof e.value=="number"&&Number.isFinite(e.value)?e.value:null,a=typeof t.value=="number"&&Number.isFinite(t.value)?t.value:null;return e.status==="missing"||t.status==="missing"||n===null||a===null?{kind:"not_comparable",reason:"missing",label:$t.notComparable}:Jt(e.status)?Jt(t.status)?a===0?{kind:"not_comparable",reason:"previous_zero",label:n===0?"No change (0)":n>0?"Up from 0":"Down from 0"}:{kind:"change",percent:(n-a)/Math.abs(a)*100}:{kind:"not_comparable",reason:"previous_no_records",label:$t.notComparable}:{kind:"not_comparable",reason:"current_no_records",label:`${e.label?.trim()||"Current period"}: no records yet`}},yn=e=>e&&["day","week","month","quarter","year"].includes(e)?e:"period",Er=e=>e==="day"?"vs yesterday at this time":`vs same point last ${yn(e)}`,os=(e,t)=>{if(!e.cutoffAt)return;let n=new Date(e.cutoffAt);if(Number.isNaN(n.getTime()))return;let a=e.timezone||void 0,i="";try{i=new Intl.DateTimeFormat(t,{...e.grain==="day"?{}:{weekday:"short",day:"numeric",month:"short"},hour:"2-digit",minute:"2-digit",timeZone:a}).format(n)}catch{i=n.toISOString()}let o=e.grain==="day"?"on both days":`in both ${yn(e.grain)}s`,s=e.cutoffSource==="data_as_of"?", the time of the latest record":"";return`Compared up to ${i} ${o}${s}${a?` (${a})`:""}`},zr=(e,t,n,a={format:String})=>{if(!e||!e.comparisonBasis||e.comparisonBasis==="complete")return;let i=e.comparisonBasis,o=Ir(t,n);if(o.kind==="not_comparable"&&o.reason!=="previous_zero")return{basis:i,kind:"neutral",tone:"neutral",label:o.label,copy:"",reason:o.reason};let s=a.format,c=e.currentPeriod?.label||t.label||"Current period",d=e.previousPeriod?.label||n.label||"Previous period",l=typeof t.value=="number"?t.value:e.currentValue,u=typeof e.previousFullValue=="number"?e.previousFullValue:typeof n.value=="number"?n.value:void 0,p=e.grain==="day"?"full day":`full ${yn(e.grain)}`,m=u===void 0?void 0:`${d} ${p}: ${s(u)}`,f=u===void 0?void 0:`${p.charAt(0).toUpperCase()}${p.slice(1)}: ${s(u)}`;if(i==="like_for_like"&&typeof e.previousToDateValue=="number"&&typeof l=="number"){let h=Ir({value:l,status:t.status},{value:e.previousToDateValue,status:"observed"}),I=os(e,a.locale);if(h.kind==="change"){let x=h.percent;return{basis:i,kind:"change",percent:x,tone:x===0?"neutral":x>0?"positive":"negative",label:`${x>0?"↑":x<0?"↓":"→"} ${Math.abs(x).toFixed(1)}%`,copy:Er(e.grain),secondary:m,compactSecondary:f,title:I}}return{basis:i,kind:"neutral",tone:"neutral",label:h.label,copy:Er(e.grain),secondary:m,compactSecondary:f,title:I,reason:h.reason}}if(i==="not_comparable")return{basis:i,kind:"neutral",tone:"neutral",label:"Not comparable",copy:e.reason||"",reason:e.reason};let _=[typeof l=="number"?`${c} so far: ${s(l)}`:`${c}: in progress`];return u!==void 0&&_.push(`${d}: ${s(u)} (${p})`),{basis:"current_in_progress_no_time",kind:"neutral",tone:"neutral",label:_.join(" · "),copy:"",title:e.reason,reason:e.reason}},Nr=e=>e?.grain==="day"?"Yesterday at this time":`Same point last ${yn(e?.grain)}`,Ra=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?"":e.toISOString().slice(0,10);let t=typeof e=="string"?e.trim():"";return/^\d{4}-\d{2}-\d{2}/.test(t)?t.slice(0,10):""},Rr=(e,t)=>{let n=Ra(t);if(!(!n||!e)){if(e.previousPeriod?.start&&Ra(e.previousPeriod.start)===n)return"previous";if(e.currentPeriod?.start&&Ra(e.currentPeriod.start)===n)return"current"}},Lr=(e,t,n,a={format:String})=>{if(!e||!e.series?.length||!e.comparisonBasis||e.comparisonBasis==="complete")return;let i=Rr(e,t);if(!i)return;let o=String(n??""),s=e.series.find(d=>d.key===o);if(!s)return;let c=e.comparisonBasis;if(i==="previous"){let d=c==="like_for_like"&&typeof s.previousToDateValue=="number";return{side:i,basis:c,toDate:d,plotValue:d?s.previousToDateValue:void 0,fullValue:s.previousFullValue}}return{side:i,basis:c,toDate:!1,display:zr({...e,currentValue:s.currentValue,previousToDateValue:s.previousToDateValue,previousFullValue:s.previousFullValue},{value:s.currentValue,status:s.currentValue===void 0?"missing":"observed"},{value:s.previousFullValue,status:s.previousFullValue===void 0?"missing":"observed"},a)}},La=e=>!!(e&&e.seriesField&&e.series?.length&&e.comparisonBasis&&e.comparisonBasis!=="complete"&&e.comparisonBasis!=="not_comparable"),ss=e=>{if(!La(e))return;let t=e.currentPeriod?.label||"Current period";return e.comparisonBasis==="like_for_like"?`${t} so far, compared with ${Nr(e).toLowerCase()}`:`${t} so far; the previous period is shown in full, so the bars are not like for like`},cs=(e,t,n)=>{if(!t)return[];if(t.side==="previous")return typeof t.fullValue=="number"&&t.toDate?[`Full ${e?.grain==="day"?"day":yn(e?.grain)}: ${n(t.fullValue)}`]:[];let a=t.display;return a?a.kind==="change"&&a.percent!==void 0?[`${a.label} ${a.copy}`.trim()]:a.kind==="neutral"&&a.label&&t.basis==="like_for_like"?[a.label]:[]:[]},na="__previous_to_date",ls="Previous to date",Dr=(e,t)=>{let n=e.trim().toLowerCase(),a=t.trim().toLowerCase();return n===a||n.endsWith(`.${a}`)||a.endsWith(`.${n}`)},ds=e=>{let t=e.periodComparison,n=e.rows;if(!n?.length||!La(t)||t.comparisonBasis!=="like_for_like"||!t.series?.some(p=>typeof p.previousToDateValue=="number"))return e;let a=e.columnMetadata??[],i=e.columns?.filter(Boolean)??(a.length?a.map(p=>String(p.key??p.name??"")).filter(Boolean):Object.keys(n[0]??{}));if(i.includes(na))return e;let o=i.find(p=>Dr(t.seriesField,p));if(!o)return e;let s=p=>a.find(m=>(m.key??m.name)===p),c=i.find(p=>{let m=s(p);return m?.semanticRole==="date"||m?.role==="date"||m?.dataType==="date"||m?.dataType==="datetime"}),d=(t.measureField?i.find(p=>Dr(t.measureField,p)):void 0)??i.find(p=>s(p)?.semanticRole==="measure"),l=n.map(p=>{let m=c?Rr(t,p[c]):"current",f=t.series?.find(h=>h.key===String(p[o]??"")),_=m&&typeof f?.previousToDateValue=="number"?f.previousToDateValue:null;return{...p,[na]:_}}),u={...(d?s(d):void 0)??{dataType:"number",semanticRole:"measure"},key:na,name:void 0,label:ls,aggregation:"none",sourceField:void 0,priority:"secondary",groupable:!1,filterable:!1};return{...e,rows:l,columns:e.columns?[...e.columns,na]:e.columns,columnMetadata:a.length?[...a,u]:e.columnMetadata}},us=e=>!!(e?.lastPeriodInProgress||e?.caveats?.some(t=>t.code==="incomplete_final_period")||e?.periodComparison?.currentPeriod?.inProgress),ps="In progress";var aa,Re,Pr,Vt,Or,Fr,Ur,Da,ra,_n,Br,Pa,Oa,Fa,qr,ia={},oa=[],fs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,sa=Array.isArray;function Rt(e,t){for(var n in t)e[n]=t[n];return e}function Ua(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hs(e,t,n){var a,i,o,s={};for(o in t)o=="key"?a=t[o]:o=="ref"?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?aa.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return ca(e,s,a,i,null)}function ca(e,t,n,a,i){var o={type:e,props:t,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Pr,__i:-1,__u:0};return i==null&&Re.vnode!=null&&Re.vnode(o),o}function se(e){return e.children}function la(e,t){this.props=e,this.context=t}function cn(e,t){if(t==null)return e.__?cn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?cn(e):null}function ms(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,a=[],i=[],o=Rt({},t);o.__v=t.__v+1,Re.vnode&&Re.vnode(o),qa(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,a,n??cn(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,Kr(a,o,i),t.__e=t.__=null,o.__e!=n&&Vr(o)}}function Vr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Vr(e)}function Ba(e){(!e.__d&&(e.__d=!0)&&Vt.push(e)&&!da.__r++||Or!=Re.debounceRendering)&&((Or=Re.debounceRendering)||Fr)(da)}function da(){try{for(var e,t=1;Vt.length;)Vt.length>t&&Vt.sort(Ur),e=Vt.shift(),t=Vt.length,ms(e)}finally{Vt.length=da.__r=0}}function jr(e,t,n,a,i,o,s,c,d,l,u){var p,m,f,_,h,I,x,g=a&&a.__k||oa,T=t.length;for(d=gs(n,t,g,d,T),p=0;p<T;p++)(f=n.__k[p])!=null&&(m=f.__i!=-1&&g[f.__i]||ia,f.__i=p,I=qa(e,f,m,i,o,s,c,d,l,u),_=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&ja(m.ref,null,f),u.push(f.ref,f.__c||_,f)),h==null&&_!=null&&(h=_),(x=!!(4&f.__u))||m.__k===f.__k?(d=Hr(f,d,e,x),x&&m.__e&&(m.__e=null)):typeof f.type=="function"&&I!==void 0?d=I:_&&(d=_.nextSibling),f.__u&=-7);return n.__e=h,d}function gs(e,t,n,a,i){var o,s,c,d,l,u=n.length,p=u,m=0;for(e.__k=new Array(i),o=0;o<i;o++)(s=t[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[o]=ca(null,s,null,null,null):sa(s)?s=e.__k[o]=ca(se,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[o]=ca(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[o]=s,d=o+m,s.__=e,s.__b=e.__b+1,c=null,(l=s.__i=bs(s,n,d,p))!=-1&&(p--,(c=n[l])&&(c.__u|=2)),c==null||c.__v==null?(l==-1&&(i>u?m--:i<u&&m++),typeof s.type!="function"&&(s.__u|=4)):l!=d&&(l==d-1?m--:l==d+1?m++:(l>d?m--:m++,s.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(c=n[o])!=null&&(2&c.__u)==0&&(c.__e==a&&(a=cn(c)),Zr(c,c));return a}function Hr(e,t,n,a){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=Hr(i[o],t,n,a));return t}e.__e!=t&&(a&&(t&&e.type&&!t.parentNode&&(t=cn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function bs(e,t,n,a){var i,o,s,c=e.key,d=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&c==null||u&&c==l.key&&d==l.type)return n;if(a>(u?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((l=t[s=i>=0?i--:o++])!=null&&(2&l.__u)==0&&c==l.key&&d==l.type)return s}return-1}function Wr(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||fs.test(t)?n:n+"px"}function ua(e,t,n,a,i){var o,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof a=="string"&&(e.style.cssText=a=""),a)for(t in a)n&&t in n||Wr(e.style,t,"");if(n)for(t in n)a&&n[t]==a[t]||Wr(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Br,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?a?n[_n]=a[_n]:(n[_n]=Pa,e.addEventListener(t,o?Fa:Oa,o)):e.removeEventListener(t,o?Fa:Oa,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Gr(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ra]==null)t[ra]=Pa++;else if(t[ra]<n[_n])return;return n(Re.event?Re.event(t):t)}}}function qa(e,t,n,a,i,o,s,c,d,l){var u,p,m,f,_,h,I,x,g,T,V,P,ee,Z,Y,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),o=[c=t.__e=n.__e]),(u=Re.__b)&&u(t);e:if(typeof z=="function")try{if(x=t.props,g=z.prototype&&z.prototype.render,T=(u=z.contextType)&&a[u.__c],V=u?T?T.props.value:u.__:a,n.__c?I=(p=t.__c=n.__c).__=p.__E:(g?t.__c=p=new z(x,V):(t.__c=p=new la(x,V),p.constructor=z,p.render=xs),T&&T.sub(p),p.state||(p.state={}),p.__n=a,m=p.__d=!0,p.__h=[],p._sb=[]),g&&p.__s==null&&(p.__s=p.state),g&&z.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Rt({},p.__s)),Rt(p.__s,z.getDerivedStateFromProps(x,p.__s))),f=p.props,_=p.state,p.__v=t,m)g&&z.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),g&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(g&&z.getDerivedStateFromProps==null&&x!==f&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(x,V),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(x,p.__s,V)===!1){t.__v!=n.__v&&(p.props=x,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(te){te&&(te.__=t)}),oa.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(x,p.__s,V),g&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(f,_,h)})}if(p.context=V,p.props=x,p.__P=e,p.__e=!1,P=Re.__r,ee=0,g)p.state=p.__s,p.__d=!1,P&&P(t),u=p.render(p.props,p.state,p.context),oa.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,P&&P(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++ee<25);p.state=p.__s,p.getChildContext!=null&&(a=Rt(Rt({},a),p.getChildContext())),g&&!m&&p.getSnapshotBeforeUpdate!=null&&(h=p.getSnapshotBeforeUpdate(f,_)),Z=u!=null&&u.type===se&&u.key==null?Yr(u.props.children):u,c=jr(e,sa(Z)?Z:[Z],t,n,a,i,o,s,c,d,l),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),I&&(p.__E=p.__=null)}catch(te){if(t.__v=null,d||o!=null)if(te.then){for(t.__u|=d?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(Y=o.length;Y--;)Ua(o[Y]);Va(t)}else t.__e=n.__e,t.__k=n.__k,te.then||Va(t);Re.__e(te,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=vs(n.__e,t,n,a,i,o,s,d,l);return(u=Re.diffed)&&u(t),128&t.__u?void 0:c}function Va(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Va))}function Kr(e,t,n){for(var a=0;a<n.length;a++)ja(n[a],n[++a],n[++a]);Re.__c&&Re.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){Re.__e(o,i.__v)}})}function Yr(e){return typeof e!="object"||e==null||e.__b>0?e:sa(e)?e.map(Yr):e.constructor!==void 0?null:Rt({},e)}function vs(e,t,n,a,i,o,s,c,d){var l,u,p,m,f,_,h,I=n.props||ia,x=t.props,g=t.type;if(g=="svg"?i="http://www.w3.org/2000/svg":g=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((f=o[l])&&"setAttribute"in f==!!g&&(g?f.localName==g:f.nodeType==3)){e=f,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(x);e=document.createElementNS(i,g,x.is&&x),c&&(Re.__m&&Re.__m(t,o),c=!1),o=null}if(g==null)I===x||c&&e.data==x||(e.data=x);else{if(o=g=="textarea"&&x.defaultValue!=null?null:o&&aa.call(e.childNodes),!c&&o!=null)for(I={},l=0;l<e.attributes.length;l++)I[(f=e.attributes[l]).name]=f.value;for(l in I)f=I[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in x||l=="value"&&"defaultValue"in x||l=="checked"&&"defaultChecked"in x||ua(e,l,null,f,i);for(l in x)f=x[l],l=="children"?m=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?_=f:l=="checked"?h=f:c&&typeof f!="function"||I[l]===f||ua(e,l,f,I[l],i);if(u)c||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),jr(t.type=="template"?e.content:e,sa(m)?m:[m],t,n,a,g=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:n.__k&&cn(n,0),c,d),o!=null)for(l=o.length;l--;)Ua(o[l]);c&&g!="textarea"||(l="value",g=="progress"&&_==null?e.removeAttribute("value"):_!=null&&(_!==e[l]||g=="progress"&&!_||g=="option"&&_!=I[l])&&ua(e,l,_,I[l],i),l="checked",h!=null&&h!=e[l]&&ua(e,l,h,I[l],i))}return e}function ja(e,t,n){try{if(typeof e=="function"){var a=typeof e.__u=="function";a&&e.__u(),a&&t==null||(e.__u=e(t))}else e.current=t}catch(i){Re.__e(i,n)}}function Zr(e,t,n){var a,i;if(Re.unmount&&Re.unmount(e),(a=e.ref)&&(a.current&&a.current!=e.__e||ja(a,null,t)),(a=e.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(o){Re.__e(o,t)}a.base=a.__P=null}if(a=e.__k)for(i=0;i<a.length;i++)a[i]&&Zr(a[i],t,n||typeof e.type!="function");n||Ua(e.__e),e.__c=e.__=e.__e=void 0}function xs(e,t,n){return this.constructor(e,n)}function Jr(e,t,n){var a,i,o,s;t==document&&(t=document.documentElement),Re.__&&Re.__(e,t),i=(a=!1)?null:t.__k,o=[],s=[],qa(t,e=t.__k=hs(se,null,[e]),i||ia,ia,t.namespaceURI,i?null:t.firstChild?aa.call(t.childNodes):null,o,i?i.__e:t.firstChild,a,s),Kr(o,e,s)}function Ha(e){function t(n){var a,i;return this.getChildContext||(a=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){a=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&a.forEach(function(s){s.__e=!0,Ba(s)})},this.sub=function(o){a.add(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){a&&a.delete(o),s&&s.call(o)}}),n.children}return t.__c="__cC"+qr++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,a){return n.children(a)}).contextType=t,t}aa=oa.slice,Re={__e:function(e,t,n,a){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,a||{}),s=i.__d),s)return i.__E=i}catch(c){e=c}throw e}},Pr=0,la.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Rt({},this.state),typeof e=="function"&&(e=e(Rt({},n),this.props)),e&&Rt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ba(this))},la.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ba(this))},la.prototype.render=se,Vt=[],Fr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ur=function(e,t){return e.__v.__b-t.__v.__b},da.__r=0,Da=Math.random().toString(8),ra="__d"+Da,_n="__a"+Da,Br=/(PointerCapture)$|Capture$/i,Pa=0,Oa=Gr(!1),Fa=Gr(!0),qr=0;var Xt,Pe,Wa,Xr,wn=0,Qr=[],je=Re,ei=je.__b,ti=je.__r,ni=je.diffed,ai=je.__c,ri=je.unmount,ii=je.__;function kn(e,t){je.__h&&je.__h(Pe,e,wn||t),wn=0;var n=Pe.__H||(Pe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return wn=1,ys(si,e)}function ys(e,t,n){var a=kn(Xt++,2);if(a.t=e,!a.__c&&(a.__=[si(void 0,t),function(c){var d=a.__N?a.__N[0]:a.__[0],l=a.t(d,c);d!==l&&(a.__N=[l,a.__[1]],a.__c.setState({}))}],a.__c=Pe,!Pe.__f)){var i=function(c,d,l){if(!a.__c.__H)return!0;var u=a.__c.__H.__.filter(function(m){return m.__c});if(u.every(function(m){return!m.__N}))return!o||o.call(this,c,d,l);var p=a.__c.props!==c;return u.some(function(m){if(m.__N){var f=m.__[0];m.__=m.__N,m.__N=void 0,f!==m.__[0]&&(p=!0)}}),o&&o.call(this,c,d,l)||p};Pe.__f=!0;var o=Pe.shouldComponentUpdate,s=Pe.componentWillUpdate;Pe.componentWillUpdate=function(c,d,l){if(this.__e){var u=o;o=void 0,i(c,d,l),o=u}s&&s.call(this,c,d,l)},Pe.shouldComponentUpdate=i}return a.__N||a.__}function X(e,t){var n=kn(Xt++,3);!je.__s&&Ya(n.__H,t)&&(n.__=e,n.u=t,Pe.__H.__h.push(n))}function Sn(e,t){var n=kn(Xt++,4);!je.__s&&Ya(n.__H,t)&&(n.__=e,n.u=t,Pe.__h.push(n))}function R(e){return wn=5,Be(function(){return{current:e}},[])}function Be(e,t){var n=kn(Xt++,7);return Ya(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function F(e,t){return wn=8,Be(function(){return e},t)}function Ga(e){var t=Pe.context[e.__c],n=kn(Xt++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Pe)),t.props.value):e.__}function _s(){for(var e;e=Qr.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(pa),t.__h.some(Ka),t.__h=[]}catch(n){t.__h=[],je.__e(n,e.__v)}}}je.__b=function(e){Pe=null,ei&&ei(e)},je.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ii&&ii(e,t)},je.__r=function(e){ti&&ti(e),Xt=0;var t=(Pe=e.__c).__H;t&&(Wa===Pe?(t.__h=[],Pe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(pa),t.__h.some(Ka),t.__h=[],Xt=0)),Wa=Pe},je.diffed=function(e){ni&&ni(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Qr.push(t)!==1&&Xr===je.requestAnimationFrame||((Xr=je.requestAnimationFrame)||ws)(_s)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Wa=Pe=null},je.__c=function(e,t){t.some(function(n){try{n.__h.some(pa),n.__h=n.__h.filter(function(a){return!a.__||Ka(a)})}catch(a){t.some(function(i){i.__h&&(i.__h=[])}),t=[],je.__e(a,n.__v)}}),ai&&ai(e,t)},je.unmount=function(e){ri&&ri(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(a){try{pa(a)}catch(i){t=i}}),n.__H=void 0,t&&je.__e(t,n.__v))};var oi=typeof requestAnimationFrame=="function";function ws(e){var t,n=function(){clearTimeout(a),oi&&cancelAnimationFrame(t),setTimeout(e)},a=setTimeout(n,35);oi&&(t=requestAnimationFrame(n))}function pa(e){var t=Pe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Pe=t}function Ka(e){var t=Pe;e.__c=e.__(),Pe=t}function Ya(e,t){return!e||e.length!==t.length||t.some(function(n,a){return n!==e[a]})}function si(e,t){return typeof t=="function"?t(e):t}var ks=0;function r(e,t,n,a,i,o){t||(t={});var s,c,d=t;if("ref"in d)for(c in d={},t)c=="ref"?s=t[c]:d[c]=t[c];var l={type:e,props:d,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ks,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)d[c]===void 0&&(d[c]=s[c]);return Re.vnode&&Re.vnode(l),l}const fa=(e,t=11)=>{let n=0;for(let a of e)n+=(a.codePointAt(0)??0)>11904?1:.58;return Math.ceil(n*t)},Ss=(e,t=12,n=20)=>Math.max(n,Math.ceil(e)+t),$s=(e,t=12,n=8)=>Math.ceil(t+e+n),Ts=(e,t,n=11)=>e.length===0||Math.max(...e.map(a=>fa(a,n)))<=t-4?{kind:"native"}:e.length>12?{kind:"auto"}:Math.floor((t-4)/(.58*n))>=6?{kind:"truncate",width:Math.max(16,Math.floor(t-4))}:{kind:"rotate",rotate:40,width:72},Za=e=>Array.isArray(e)?e:e?[e]:[],Cs=(e,t)=>{let n=[];for(let a of e)if(Array.isArray(a.data))for(let i of a.data){let o=i;i&&typeof i=="object"&&!Array.isArray(i)&&(o=i.value),Array.isArray(o)&&(o=o[1]),typeof o=="number"&&Number.isFinite(o)&&n.push(o)}return n},As=(e,t,n)=>{let a=e.axisLabel?.formatter,i=Cs(t),o=typeof e.min=="number"?e.min:Math.min(0,...i),s=typeof e.max=="number"?e.max:Math.max(0,...i)*1.1,c=i.length||e.min!==void 0?[o,s]:[];return c.length?Math.max(...c.map(d=>{let l=String(d);try{typeof a=="function"&&(l=String(a(d)))}catch{}return fa(l)})):fa("00000")},Ms=(e,t)=>{if(!(t>0)||Array.isArray(e.grid))return e;let n=Za(e.xAxis),a=Za(e.yAxis),i=a[0]?.type==="category",o=i?a[0]:n[0],s=i?n[0]:a[0];if(!o||o.type!=="category"||!s||s.type!=="value")return e;let c=t<420,d=Za(e.series),l={...e.grid??{}},u=(o.data??[]).map(h=>String(h&&typeof h=="object"?h.value??"":h)),p={...e,grid:l},m={...o},f={...s},_=0;if(i)c&&(_=Math.min(t*.35,90),m={...m,axisLabel:{...o.axisLabel,width:Math.floor(_),overflow:"truncate",ellipsis:"…"}},l.left=8);else{let h=As(s,d);if(_=h+8,c&&!s.name)l.left=8;else if(s.name){let I=Ss(h);f={...f,nameGap:Math.min(s.nameGap??I,I)},_+=18}}if(!i){let h=typeof l.left=="number"?l.left:0,I=typeof l.right=="number"?l.right:0,x=Ts(u,Math.max(40,t-h-I-_)/Math.max(1,u.length)),g=o.axisLabel?.fontSize??11,T=g+2;if(x.kind==="truncate"||x.kind==="rotate"){let V=x.kind==="rotate"?x.rotate:0;if(m.axisLabel={...o.axisLabel,interval:0,hideOverlap:!1,rotate:V,width:x.width,overflow:"truncate",ellipsis:"…"},V){let P=Math.max(0,...u.map(Z=>fa(Z,g))),ee=Math.min(x.width,P);T=Math.ceil(ee*Math.sin(V*Math.PI/180))+g}}o.name&&c?m.nameGap=Math.min(o.nameGap??99,$s(T,6,4)):c&&l.containLabel===!0&&typeof l.bottom=="number"&&(l.bottom=Math.min(l.bottom,8))}return i?(p.yAxis=Array.isArray(e.yAxis)?[m,...a.slice(1)]:m,p.xAxis=Array.isArray(e.xAxis)?[f,...n.slice(1)]:f):(p.xAxis=Array.isArray(e.xAxis)?[m,...n.slice(1)]:m,p.yAxis=Array.isArray(e.yAxis)?[f,...a.slice(1)]:f),p},Is=/^(\d{4})-(\d{2})-(\d{2})$/,Es=/^(\d{4})-(\d{2})$/,zs=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/,Ns=/(?:Z|[+-]\d{2}:?\d{2})$/i,ci=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:{date:e,calendar:!1,hasTime:!0};if(typeof e=="number"&&Number.isFinite(e))return{date:new Date(e),calendar:!1,hasTime:!0};if(typeof e!="string")return null;let t=e.trim(),n=Is.exec(t);if(n)return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]))),calendar:!0,hasTime:!1};if(n=Es.exec(t),n)return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,1)),calendar:!0,hasTime:!1};if(n=zs.exec(t),n&&!Ns.test(t))return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]),Number(n[4]),Number(n[5]),Number(n[6]??0))),calendar:!0,hasTime:!0};if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return null;let a=new Date(t);return Number.isNaN(a.getTime())?null:{date:a,calendar:!1,hasTime:!0}},Rs=e=>{if(e){if(/h/i.test(e)&&/:/.test(e))return"hour";if(/d{2}/i.test(e))return"day";if(/q/i.test(e))return"quarter";if(/M{2,}/.test(e))return"month";if(/y{2,}/i.test(e))return"year"}},li=e=>{let t=e.map(ci).filter(a=>a!==null);if(t.length===0)return;let n=a=>a.date.getUTCHours()+a.date.getUTCMinutes();return t.some(a=>a.hasTime&&n(a)!==0)?t.every(a=>a.date.getUTCMinutes()===0)?"hour":void 0:t.length>1&&t.every(a=>a.date.getUTCDate()===1)?"month":"day"},Qt=(e,t)=>{try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(e,{...t,timeZone:"UTC"})}},di=(e,t,n={})=>{let a=ci(e);if(!a)return;let i=t?.grain??Rs(t?.formatPattern)??n.grain,o=a.calendar?"UTC":n.timezone||void 0,{date:s}=a;switch(i){case"year":return Qt(n.locale,{year:"numeric",timeZone:o}).format(s);case"quarter":{let c=Number(Qt("en-US",{month:"numeric",timeZone:o}).format(s)),d=Qt(n.locale,{year:"numeric",timeZone:o}).format(s);return`Q${Math.floor((c-1)/3)+1} ${d}`}case"month":return Qt(n.locale,{month:"short",year:"numeric",timeZone:o}).format(s);case"week":case"day":return Qt(n.locale,{day:"numeric",month:"short",year:"numeric",timeZone:o}).format(s);case"hour":return Qt(n.locale,{day:"numeric",month:"short",hour:"numeric",minute:"2-digit",timeZone:o}).format(s);default:return Qt(n.locale,{dateStyle:"medium",...a.hasTime?{timeStyle:"short"}:{},timeZone:o}).format(s)}},ui=e=>{let t=e?/\.([0#]+)/.exec(e):null;if(!t)return;let n=t[1];return{min:(n.match(/0/g)??[]).length,max:n.length}},Ja=(e,t)=>{let n=ui(e);return n?{minimumFractionDigits:n.min,maximumFractionDigits:n.max}:{maximumFractionDigits:t}},$n=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},pi=(e,t)=>t&&Math.abs(e)>=1e4?"compact":"standard",fi=(e,t={})=>new Intl.NumberFormat(t.locale,{notation:pi(e,t.compact),...Ja(t.pattern,t.maxFractionDigits??2)}).format(e),Ls=(e,t,n={})=>{let a=t?.trim().toUpperCase();if(a&&/^[A-Z]{3}$/.test(a))try{return new Intl.NumberFormat(n.locale,{style:"currency",currency:a,notation:pi(e,n.compact),...ui(n.pattern)?Ja(n.pattern,2):{}}).format(e)}catch{}return fi(e,{...n,maxFractionDigits:2})},Ds=(e,t={})=>{let n=!!(t.pattern&&/(?<!\\)%/.test(t.pattern)),a=Ja(t.pattern,2);return new Intl.NumberFormat(t.locale,{style:"percent",...a}).format(n?e:e/100)},Xa=(e,t,n={})=>{let{locale:a,compact:i}=n;return t?.dataType==="currency"?Ls(e,t.currencyCode||n.currencyCode,{locale:a,compact:i,pattern:t.formatPattern}):t?.dataType==="percent"?Ds(e,{locale:a,pattern:t.formatPattern}):fi(e,{locale:a,compact:i,pattern:t?.formatPattern,maxFractionDigits:n.maxFractionDigits})},Ps=(e,t,n={})=>{if(e==null||e==="")return"—";if(t?.dataType==="date"||t?.dataType==="datetime"){let a=di(e,t,n);if(a)return a}if(t?.dataType==="currency"||t?.dataType==="percent"){let a=$n(e);if(a!==null)return Xa(a,t,n)}return typeof e=="number"&&Number.isFinite(e)?Xa(e,t,{...n,maxFractionDigits:4}):typeof e=="boolean"?e?n.yes??"Yes":n.no??"No":String(e)},ha={resultDetails:"Result details",liveMetric:"Live metric",currentValue:"Current value",noMatchTitle:"No matching data",noMatchBody:"No approved records matched this question.",chartType:"Chart type",chooseChartType:"Choose chart type",aggregate:"Aggregate",aggregateTitle:"Ask for a new governed calculation",aggregateCharge:"New governed answer. Query charges may apply.",chartFallback:"Chart",chartLine:"Line",chartBar:"Bar",chartStackedBar:"Stacked bar",chartLineHint:"Best for change over time.",chartBarHint:"Compare categories or ranked values.",chartStackedBarHint:"Compare totals and their parts.",aggregationSum:"Total",aggregationAvg:"Average",aggregationMin:"Minimum",aggregationMax:"Maximum",aggregationCount:"Total count",aggregationCountDistinct:"Unique count",download:"Download",downloadData:"Download this data",expandTable:"Expand table",expandChart:"Expand chart",restoreView:"Restore assistant view",aboutResult:"About this result",aboutPeriod:"Period",aboutResults:"Results",aboutChecked:"Checked",aboutTimezone:"Timezone",aboutSourceData:"Source data",aboutFilters:"Filters",rowOne:"{count} row",rowMany:"{count} rows",filtersOne:"{count} applied filter",filtersMany:"{count} applied filters",filtersApplied:"{count} applied",notSet:"Not set",noValue:"No value",yes:"Yes",no:"No",chartValues:"Values",chartTitle:"{measure} by {dimension}",seriesLimited:"Showing {shown} of {total} series.",summaryLatest:"Latest ({category}): {values}.",summaryNoTrend:"No numeric trend values are available.",summaryHighest:"Highest: {category}, {series} {value}.",summaryNoComparison:"No numeric comparison values are available.",zoomControls:"Chart zoom controls",zoomIn:"Zoom in chart",zoomOut:"Zoom out chart",zoomReset:"Reset chart zoom",zoomResetShort:"Reset",zoomNone:"No chart points",zoomAllOne:"All {count} point",zoomAllMany:"All {count} points",zoomRange:"{start} – {end} · {visible} of {count} points",inProgress:"in progress",newContent:"New content",updatedAt:"Updated {time}",liveData:"Live data",viewData:"View data",hideData:"Hide data",inProgressLegend:"In progress",governedResult:"Governed result"},vt=(e,t)=>e.replace(/\{(\w+)\}/g,(n,a)=>String(t[a]??"")),Os=e=>Object.fromEntries(Object.entries(e??{}).filter(([,t])=>t!=null)),Qa=e=>({...ha,...Os(e),explanation:{...e?.explanation}});let hi=()=>Promise.resolve().then(()=>Fo),Tn=null,mi=!1;const Fs=e=>{hi=e,Tn=null,mi=!0},Us=()=>(Tn||(Tn=hi().catch(e=>{throw Tn=null,e})),Tn),en={background:"#ffffff",border:"#dce4e9",muted:"#5b7186",surface:"#ffffff",text:"#0f1e2a",colors:["#2f7f55","#2563eb","#b45309","#7c3aed"]},gi="cf-widget-category-zoom",bi=.68,ln=e=>({startIndex:0,endIndex:Math.max(0,e-1)}),Cn=(e,t)=>{if(t<=0)return ln(0);let n=t-1,a=Math.max(0,Math.min(n,Math.floor(Math.min(e.startIndex,e.endIndex))));return{startIndex:a,endIndex:Math.max(a,Math.min(n,Math.floor(Math.max(e.startIndex,e.endIndex))))}},vi=(e,t,n)=>{let a=Cn(e,n);if(n<=2)return ln(n);let i=a.endIndex-a.startIndex+1,o=t==="in"?Math.max(2,Math.floor(i*bi)):Math.min(n,Math.ceil(i/bi));if(o===i)return a;let s=(a.startIndex+a.endIndex)/2,c=n-o,d=Math.max(0,Math.min(c,Math.round(s-(o-1)/2)));return{startIndex:d,endIndex:d+o-1}},Bs=(e,t,n=ha)=>{let a=e.length;if(a===0)return n.zoomNone;let i=Cn(t,a);return i.startIndex===0&&i.endIndex===a-1?vt(a===1?n.zoomAllOne:n.zoomAllMany,{count:a}):vt(n.zoomRange,{start:e[i.startIndex]??"",end:e[i.endIndex]??"",visible:i.endIndex-i.startIndex+1,count:a})},qs=e=>{let t=e.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:"Value"},Vs=e=>{let t=new Set,n=[];return e.forEach(a=>{let i=a?.trim();!i||t.has(i)||(t.add(i),n.push(i))}),n},er=$n,An=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)}`},Mn=(e,t)=>t?e.columnMetadata?.find(n=>n.key===t):void 0,tr=(e,t)=>{let n=Mn(e,t);if(!n||n.currencyCode||n.dataType!=="currency")return n;let a=e.currency;return a?.code&&!a.isMixed?{...n,currencyCode:a.code}:n},In=(e,t)=>Mn(e,t)?.label?.trim()||qs(t),js=(e,t,n,a)=>({locale:t,timezone:e.timezone||e.periodComparison?.timezone,grain:a,yes:n.yes,no:n.no}),xi=e=>e?.dataType==="date"||e?.dataType==="datetime"||e?.semanticRole==="date",yi=(e,t,n)=>{let a=Mn(e,t);if(xi(a))return a?.grain??e.periodComparison?.grain??li(n.map(i=>i[t]))},_i=(e,t,n,a,i,o)=>{if(n==null||n==="")return a.notSet;let s=Mn(e,t);if(s?.dataType==="boolean"){let c=String(n).trim().toLowerCase();return n===!1||n===0||["0","false","no"].includes(c)?a.no:a.yes}if(xi(s)){let c=di(n,s,js(e,i,a,o));if(c)return c}return String(n)},tn=(e,t,n,a=!1,i)=>Xa(e,t,{locale:i,compact:a,currencyCode:n?.currency?.code&&!n.currency.isMixed?n.currency.code:void 0}),Hs=(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},wi=e=>e.chartRecommendation?.categoryField?.trim()||e.label?.trim()||e.columnMetadata?.find(t=>["date","dimension","geography","boolean"].includes(t.semanticRole))?.key||e.columns?.[0],ki=e=>e.chartRecommendation?.seriesField?.trim()||e.seriesField?.trim()||e.series?.trim()||void 0,Si=(e,t,n)=>{let a=Vs([...e.chartRecommendation?.valueFields??[],...e.valueFields??[],e.value,...e.columnMetadata?.filter(o=>o.semanticRole==="measure").map(o=>o.key)??[]]),i=new Set([...e.columns??[],...e.columnMetadata?.map(o=>o.key)??[],...Object.keys(e.rows?.[0]??{})]);return a.filter(o=>o!==t&&o!==n&&i.has(o)).filter(o=>e.rows?.some(s=>er(s[o])!==null))},Ws=(e,t,n,a,i,o,s)=>{let c=i?` ${vt(o.seriesLimited,{shown:a.length,total:a.length+i})}`:"",d=(u,p)=>tn(u,p,e,!1,s);if(t==="line"){let u=n.length-1,p=a.map(m=>{let f=m.values[u];return f==null?null:`${m.name}: ${d(f,m.valueColumn)}`}).filter(m=>!!m);return p.length?`${vt(o.summaryLatest,{category:n[u]??"",values:p.join("; ")})}${c}`:`${o.summaryNoTrend}${c}`}let l;return a.forEach(u=>{u.values.forEach((p,m)=>{p===null||l&&p<=l.value||(l={category:n[m]??o.notSet,series:u,value:p})})}),l?`${vt(o.summaryHighest,{category:l.category,series:l.series.name,value:d(l.value,l.series.valueColumn)})}${c}`:`${o.summaryNoComparison}${c}`},nr=(e,t,n={})=>{let a=Qa(n.labels),i=n.locale,o=Hs(e,t),s=wi(e),c=e.rows??[];if(!o||!s||c.length===0)return null;let d=ki(e),l=Si(e,s,d);if(l.length===0)return null;let u=l.length===1?d:void 0,p=yi(e,s,c),m=l[0],f=u&&La(e.periodComparison)&&(!e.periodComparison.measureField||!m||m===e.periodComparison.measureField||m.endsWith(`.${e.periodComparison.measureField}`)||e.periodComparison.measureField.endsWith(`.${m}`))?e.periodComparison:void 0,_=(()=>{if(!f?.seriesField||!u)return;let U=(B,A)=>B===A||B.endsWith(`.${A}`)||A.endsWith(`.${B}`);if(U(f.seriesField,s))return{group:s,time:u,timeIsSeries:!0};if(U(f.seriesField,u))return{group:u,time:s,timeIsSeries:!1}})(),h=U=>tn(U,tr(e,m??""),e,!1,i),I=U=>f&&_?Lr(f,U[_.time],U[_.group],{format:h,locale:i}):void 0,x=(U,B)=>f?.comparisonBasis==="like_for_like"&&Lr(f,U,f.series?.[0]?.key)?.side==="previous"?Nr(f):B,g=[],T=new Set;c.forEach(U=>{let B=An(U[s]);if(T.has(B))return;T.add(B);let A=_i(e,s,U[s],a,i,p);g.push({key:B,label:_&&!_.timeIsSeries?x(U[s],A):A})});let V=g.map(U=>U.label),P=0,ee;if(u){let U=[],B=new Set;c.forEach(y=>{let D=An(y[u]);if(B.has(D))return;B.add(D);let S=_i(e,u,y[u],a,i,yi(e,u,c));U.push({key:D,label:_?.timeIsSeries?x(y[u],S):S})});let A=U.slice(0,4);P=Math.max(0,U.length-A.length);let N=l[0];ee=A.map(y=>{let D=new Map,S=new Map;return c.forEach(O=>{if(An(O[u])!==y.key)return;let ue=An(O[s]);if(!D.has(ue)){let oe=I(O);S.set(ue,oe),D.set(ue,oe?.side==="previous"&&oe.plotValue!==void 0?oe.plotValue:er(O[N]))}}),{field:N,name:y.label,values:g.map(O=>D.get(O.key)??null),valueColumn:tr(e,N),..._?{points:g.map(O=>S.get(O.key))}:{}}})}else P=Math.max(0,l.length-4),ee=l.slice(0,4).map(U=>({field:U,name:In(e,U),values:c.map(B=>er(B[U])),valueColumn:tr(e,U)}));if(ee.length===0)return null;let Z=In(e,s),Y=a.chartValues;u?Y=In(e,l[0]):ee.length===1&&(Y=ee[0].name);let z=e.title?.trim()||vt(a.chartTitle,{measure:Y,dimension:Z}),te;if(Mn(e,s)?.semanticRole==="date"&&g.length>1&&us(e)){let U="";c.forEach(A=>{let N=String(A[s]??"");N>U&&(U=N)});let B=g.findIndex(A=>A.key===An(U));B>=0&&(te=B)}return{type:o,title:z,xAxisTitle:Z,yAxisTitle:Y,categories:V,series:ee,omittedSeriesCount:P,inProgressIndex:te,..._&&f?{comparison:f,comparisonNote:ss(f)}:{},locale:i,labels:a,summary:Ws(e,o,V,ee,P,a,i)}},ar=[{value:"sum",label:"Total"},{value:"avg",label:"Average"},{value:"min",label:"Minimum"},{value:"max",label:"Maximum"},{value:"count",label:"Total count"},{value:"count_distinct",label:"Unique count"}],Gs={sum:"aggregationSum",avg:"aggregationAvg",min:"aggregationMin",max:"aggregationMax",count:"aggregationCount",count_distinct:"aggregationCountDistinct"},Ks=(e,t=ha)=>String(t[Gs[e]]),$i=(e,t)=>{let n=e.columnMetadata?.find(a=>a.key===t)?.allowedAggregations;return n?.length?ar.filter(a=>n.includes(a.value)):[...ar]},Ys=(e,t,n)=>{let a=wi(e);if(!a||!Si(e,a,ki(e)).includes(t)||!$i(e,t).some(o=>o.value===n))return;let i=ar.find(o=>o.value===n)?.label;if(i)return`Using the same approved data, filters, and period as "${e.title?.trim()||e.label?.trim()||"the previous chart"}", calculate ${i.toLowerCase()} of ${In(e,t)} for each ${In(e,a)}. Return a chart and show a table if this app permits it.`},Zs=(e,t=ha)=>{if(e.presentation==="table"||e.presentation==="kpi")return[];let n=nr(e);if(!n)return[];let a=[{type:"line",label:t.chartLine,hint:t.chartLineHint},{type:"bar",label:t.chartBar,hint:t.chartBarHint}];return n.series.length>1&&a.push({type:"stacked_bar",label:t.chartStackedBar,hint:t.chartStackedBarHint}),a},Js=e=>t=>{let n=e.inProgressIndex??-1,a=(Array.isArray(t)?t:[t]).filter(s=>{if(!s||typeof s!="object")return!1;let c=String(s.seriesId??"").startsWith("in-progress:"),d=s.dataIndex,l=s.value;return c?d===n:!(d===n&&l==null)}),i=String(a[0]?.axisValueLabel??a[0]?.name??""),o=s=>s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">");return[i?`<strong>${o(i)}</strong>`:"",...a.map(s=>{let c=e.series[Math.floor(Number(s.seriesIndex)/2)]??e.series[0];return`${String(s.marker??"")}${o(String(s.seriesName??""))}: ${o(tn(s.value,c?.valueColumn,void 0,!1,e.locale))}`})].filter(Boolean).join("<br/>")},Xs=e=>t=>{let n=(Array.isArray(t)?t:[t]).filter(s=>!!s&&typeof s=="object"),a=s=>s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">"),i=String(n[0]?.axisValueLabel??n[0]?.name??""),o=n.flatMap(s=>{let c=e.series[Number(s.seriesIndex)]??e.series[0],d=c?.points?.[Number(s.dataIndex)],l=u=>tn(u,c?.valueColumn,void 0,!1,e.locale);return[`${String(s.marker??"")}${a(String(s.seriesName??""))}: ${a(l(s.value))}`,...cs(e.comparison,d,l).map(u=>`<span style="opacity:.75">${a(u)}</span>`)]});return[i?`<strong>${a(i)}</strong>`:"",...o].filter(Boolean).join("<br/>")},Qs=(e,{expanded:t=!1,reducedMotion:n=!1,theme:a=en,zoomWindow:i=ln(e.categories.length)}={})=>{let o=e.series.length>1||e.type==="line"&&(e.inProgressIndex??0)>0,s=e.type==="stacked_bar",c=e.categories.length>2,d=Cn(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:a.colors,textStyle:{color:a.text,fontFamily:"inherit"},grid:{top:o?t?48:42:14,right:12,bottom:t?18:10,left:10,containLabel:!0},legend:{show:o,type:"scroll",top:0,left:"center",itemWidth:12,itemHeight:8,textStyle:{color:a.muted,fontSize:t?11:10}},tooltip:{trigger:"axis",...e.type==="line"&&(e.inProgressIndex??0)>0?{formatter:Js(e)}:e.comparison?{formatter:Xs(e)}:{},triggerOn:"mousemove|click",confine:!0,backgroundColor:a.surface,borderColor:a.border,borderWidth:1,textStyle:{color:a.text,fontSize:12},axisPointer:{type:"line",lineStyle:{color:a.muted,opacity:.5}}},dataZoom:c?[{id:gi,type:"inside",xAxisIndex:0,startValue:d.startIndex,endValue:d.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:a.muted,fontSize:t?11:10},axisLine:{lineStyle:{color:a.border}},axisTick:{show:!1},axisLabel:{color:a.muted,fontSize:t?11:9,hideOverlap:!0,interval:"auto",rotate:!t&&e.categories.length>5?28:0,formatter:l=>l.length>(t?18:11)?`${l.slice(0,t?16:9)}…`:l}},yAxis:{type:"value",name:e.yAxisTitle,nameLocation:"middle",nameGap:t?52:44,nameTextStyle:{color:a.muted,fontSize:t?11:10},axisLabel:{color:a.muted,fontSize:t?11:9,formatter:l=>tn(l,e.series[0]?.valueColumn,void 0,!0,e.locale)},axisLine:{show:!1},axisTick:{show:!1},splitNumber:4,splitLine:{lineStyle:{color:a.border,opacity:.75}}},series:e.series.flatMap((l,u)=>{let p=e.inProgressIndex??-1,m={type:e.type==="line"?"line":"bar",name:l.name,data:l.values,stack:s?"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:a.background,borderWidth:2}:{borderRadius:s?0:[4,4,0,0]},emphasis:{focus:"series"},tooltip:{valueFormatter:_=>tn(_,l.valueColumn,void 0,!1,e.locale)}};if(p<0)return[m];let f=a.colors[u%a.colors.length];return e.type==="line"?p===0?[m]:[{...m,lineStyle:{...m.lineStyle,color:f},itemStyle:{...m.itemStyle,color:f},data:l.values.map((_,h)=>h===p?null:_)},{...m,id:`in-progress:${u}`,name:e.labels.inProgressLegend||ps,showSymbol:!0,symbol:"emptyCircle",lineStyle:{width:t?3:2.5,type:"dashed",color:f,opacity:.6},itemStyle:{color:f,opacity:.6},data:l.values.map((_,h)=>h===p||h===p-1?_:null)}]:[{...m,data:l.values.map((_,h)=>h===p?{value:_,itemStyle:{opacity:.45,borderType:"dashed",borderWidth:1.5,borderColor:f}}:_)}]})}},ec=e=>{let t=getComputedStyle(e),n=(c,d)=>{for(let l of c){let u=t.getPropertyValue(l).trim();if(u)return u}return d},[a,i,o,s]=en.colors;return{background:n(["--rv-bg","--cf-bg"],en.background),border:n(["--rv-border","--cf-border"],en.border),muted:n(["--rv-muted","--cf-muted"],en.muted),surface:n(["--rv-surface","--cf-surface"],en.surface),text:n(["--rv-text","--cf-text"],en.text),colors:[n(["--rv-chart-1","--rv-accent","--cf-accent"],a),n(["--rv-chart-2"],i),n(["--rv-chart-3"],o),n(["--rv-chart-4"],s)]}},tc=["data-theme","data-color-scheme","class","style"],nc=(e,t)=>{let n=[];if(typeof matchMedia<"u"){let a=matchMedia("(prefers-color-scheme: dark)");a.addEventListener?.("change",t),n.push(()=>a.removeEventListener?.("change",t))}if(typeof MutationObserver<"u"){let a=new MutationObserver(t),i=e;for(;i;){i instanceof Element&&a.observe(i,{attributes:!0,attributeFilter:tc});let o=i.parentNode;i=o instanceof ShadowRoot?o.host:o}n.push(()=>a.disconnect())}return()=>n.forEach(a=>a())},ac=({model:e,expanded:t=!1,classPrefix:n="cf"})=>{let a=R(null),i=R(null),[o,s]=$(()=>({model:e,window:ln(e.categories.length)})),[c,d]=$(!1),l=o.model===e?Cn(o.window,e.categories.length):ln(e.categories.length),u=R(l);u.current=l;let p=Y=>{let z=Cn(Y,e.categories.length);u.current=z,s({model:e,window:z}),i.current?.dispatchAction({type:"dataZoom",dataZoomId:gi,startValue:z.startIndex,endValue:z.endIndex})},[m,f]=$(!1),[_,h]=$(0),[I,x]=$(0);X(()=>{let Y=a.current;if(Y)return nc(Y,()=>x(z=>z+1))},[]),X(()=>{let Y=a.current;if(!Y)return;let z=!1,te=null;return Us().then(({init:U})=>{if(z||!Y.isConnected||!mi&&typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes("jsdom"))return;let B=U(Y,null,{renderer:"canvas",devicePixelRatio:Math.min(window.devicePixelRatio||1,2)});i.current=B;let A=()=>{B.resize(),h(Math.round(Y.clientWidth/40))},N=typeof ResizeObserver>"u"?null:new ResizeObserver(A);N?.observe(Y),N||window.addEventListener("resize",A,{passive:!0}),te=()=>{N?.disconnect(),N||window.removeEventListener("resize",A),B.dispose(),i.current=null},f(!0)}).catch(()=>{z||d(!0)}),()=>{z=!0,te?.()}},[]),X(()=>{let Y=a.current,z=i.current;if(!Y||!z)return;let te=typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches;z.setOption(Ms(Qs(e,{expanded:t,reducedMotion:te,theme:ec(Y),zoomWindow:u.current}),Y.clientWidth),{lazyUpdate:!0,notMerge:!0}),z.resize()},[t,e,m,I,_]);let g=e.labels,T=!c&&e.categories.length>2,V=l.endIndex-l.startIndex+1,P=l.startIndex===0&&l.endIndex===e.categories.length-1,ee=T&&V>2,Z=T&&!P;return r(se,{children:[r("div",{ref:a,class:`${n}-analytics-echart${t?" is-expanded":""}`,role:"img","aria-label":`${e.title}. ${e.summary}`,"data-chart-status":c?"fallback":"ready",children:c?r("span",{class:`${n}-analytics-echart__fallback`,children:e.summary}):null}),e.comparisonNote?r("p",{class:`${n}-analytics-comparison-note`,"data-comparison-note":!0,style:"margin:4px 2px 0;font-size:11px;color:var(--rv-muted,#5b7186)",children:e.comparisonNote}):null,T?r("div",{class:`${n}-analytics-zoom`,children:[r("span",{class:`${n}-analytics-zoom__range`,"aria-live":"polite","aria-atomic":"true",children:Bs(e.categories,l,g)}),r("div",{class:`${n}-analytics-zoom__controls`,role:"group","aria-label":g.zoomControls,children:[r("button",{type:"button","aria-label":g.zoomOut,title:g.zoomOut,disabled:!Z,onClick:()=>p(vi(u.current,"out",e.categories.length)),children:"−"}),r("button",{type:"button",class:`${n}-analytics-zoom__reset`,"aria-label":g.zoomReset,title:g.zoomReset,disabled:P,onClick:()=>p(ln(e.categories.length)),children:g.zoomResetShort}),r("button",{type:"button","aria-label":g.zoomIn,title:g.zoomIn,disabled:!ee,onClick:()=>p(vi(u.current,"in",e.categories.length)),children:"+"})]})]}):null]})},En=e=>{let t=e.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:"Value"},Ti=(e,t)=>(t?.length?t:Object.keys(e[0]??{})).map(n=>typeof n=="string"?{key:n,label:En(n)}:{...n,label:n.label?.trim()||En(n.key)}),rr=(e,t,n,a={})=>Ps(e,n,{...a,locale:t??a.locale}),Ci=e=>{let t=String(e??"");return/[",\r\n]/.test(t)?`"${t.replaceAll('"','""')}"`:t},rc=(e,t)=>{let n=Ti(e,t);return[n.map(a=>Ci(a.label)).join(","),...e.map(a=>n.map(i=>Ci(a[i.key])).join(","))].join(`\r
|
|
2
|
+
`)},Ai=({label:e,options:t,value:n,onChange:a,classPrefix:i})=>{let o=R(null),s=R(null),[c,d]=$(n),[l,u]=$(!1);X(()=>d(n),[n]);let p=f=>`${i}-${f}`,m=f=>{d(f),o.current&&(o.current.dataset.value=f,o.current.open=!1,o.current.querySelector("summary")?.focus()),a?.(f)};return r("details",{ref:o,"data-result-popover":!0,"data-result-select":!0,"data-value":c,class:p("sdk-select"),onToggle:f=>{let _=f.currentTarget.open;u(_);let h=s.current;if(h){if(h.setAttribute("popover","manual"),!_){typeof h.hidePopover=="function"&&h.matches(":popover-open")&&h.hidePopover();return}typeof h.showPopover=="function"&&!h.matches(":popover-open")&&h.showPopover(),requestAnimationFrame(()=>{if(!o.current?.open||!h.isConnected)return;let I=o.current.querySelector("summary").getBoundingClientRect(),x=Math.max(I.width,Math.min(220,innerWidth-24)),g=Math.min(h.scrollHeight,240);h.style.width=`${x}px`,h.style.left=`${Math.max(12,Math.min(I.left,innerWidth-x-12))}px`,h.style.top=`${I.bottom+g+6<=innerHeight-12?I.bottom+6:Math.max(12,I.top-g-6)}px`})}},children:[r("summary",{class:p("sdk-select-trigger"),role:"combobox","aria-label":e,"aria-haspopup":"listbox","aria-expanded":l,children:[r("span",{children:t.find(([f])=>f===c)?.[1]??c}),r("span",{"aria-hidden":"true",children:"⌄"})]}),r("div",{ref:s,class:p("sdk-select-list"),role:"listbox","aria-label":e,popover:"manual",children:t.map(([f,_])=>r("button",{type:"button",role:"option","aria-selected":f===c,onClick:()=>m(f),children:_},f))})]})},ic=(e,t,n)=>{let a=n.value.trim();if(!a)return!0;let i=String(e??""),o=typeof e=="number"?e:NaN,s=Number(a),c=!Number.isNaN(o)&&!Number.isNaN(s)?o-s:i.localeCompare(a,void 0,{numeric:!0,sensitivity:"base"});switch(n.operator){case"equals":return c===0;case"not_equals":return c!==0;case"gt":return c>0;case"gte":return c>=0;case"lt":return c<0;case"lte":return c<=0;default:return i.toLocaleLowerCase().includes(a.toLocaleLowerCase())||t.toLocaleLowerCase().includes(a.toLocaleLowerCase())}},oc=({rows:e,columns:t,maxRows:n=100,locale:a,format:i,expanded:o=!1,classPrefix:s="cr",pageSize:c=10})=>{let d=Be(()=>Ti(e,t),[t,e]),l=d.map(k=>k.key).join("\0"),[u,p]=$(()=>d.map(k=>k.key)),[m,f]=$(""),[_,h]=$(),[I,x]=$("asc"),[g,T]=$({}),[V,P]=$(),[ee,Z]=$([]),[Y,z]=$({}),[te,U]=$(()=>d.map(k=>k.key)),[B,A]=$(!1),[N,y]=$([]),[D,S]=$("table"),[O,ue]=$(1),[oe,Fe]=$(c),_e=R(null);X(()=>{let k=j=>{let G=j.composedPath();_e.current?.querySelectorAll("details[data-result-popover][open]").forEach(ne=>{G.includes(ne)||(ne.open=!1)})},K=j=>{let G=[..._e.current?.querySelectorAll("details[data-result-popover][open]")??[]].at(-1);j.key!=="Escape"||!G||(G.open=!1,G.querySelector("summary")?.focus(),j.preventDefault())};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",K),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",K)}},[]),X(()=>{p(d.map(k=>k.key)),h(void 0),T({}),P(void 0),Z([]),z({}),U(d.map(k=>k.key)),y([]),ue(1)},[l]);let Te=te.map(k=>d.find(K=>K.key===k)).filter(k=>!!(k&&u.includes(k.key))),Le=Be(()=>{let k=m.toLocaleLowerCase(a),K=e.map((j,G)=>({row:j,index:G})).filter(({row:j})=>Te.some(G=>rr(j[G.key],a,G,i).toLocaleLowerCase(a).includes(k))&&Object.entries(g).every(([G,ne])=>{let ye=d.find(Se=>Se.key===G);return ic(j[G],rr(j[G],a,ye,i),ne)}));return _?K.sort((j,G)=>{let ne=j.row[_],ye=G.row[_],Se=typeof ne=="number"?ne:NaN,et=typeof ye=="number"?ye:NaN,Ye=!Number.isNaN(Se)&&!Number.isNaN(et)?Se-et:String(ne??"").localeCompare(String(ye??""),a,{numeric:!0,sensitivity:"base"});return I==="asc"?Ye:-Ye}):K},[Te,g,i,a,m,d,e,I,_]),Ie=Le.slice(0,Math.max(1,n)),Ce=Math.max(1,Math.ceil(Ie.length/oe)),ve=Math.min(O,Ce),Xe=o?Ie:Ie.slice((ve-1)*oe,ve*oe),ge=Xe.length>0&&Xe.every(({index:k})=>N.includes(k)),ie=k=>`${s}-${k}`,He=()=>{p(d.map(k=>k.key)),U(d.map(k=>k.key)),z({}),h(void 0),x("asc"),T({}),P(void 0),Z([]),A(!1),f(""),y([]),S("table"),ue(1)};if(e.length===0||d.length===0)return r("div",{class:ie("table-note"),children:"No rows returned."});let We=k=>{let K=new Set(Xe.map(({index:j})=>j));y(j=>k?[...new Set([...j,...K])]:j.filter(G=>!K.has(G)))};return r("section",{ref:_e,class:ie("data-table"),children:[r("div",{class:ie("table-fields"),children:[r("strong",{children:"Fields"}),r("div",{class:ie("field-list"),children:d.map(k=>r("span",{class:ie("field-chip"),children:k.label},k.key))}),r("span",{class:ie("table-field-count"),children:[e.length.toLocaleString(a)," rows"]})]}),r("div",{class:ie("table-controls"),children:[r("label",{class:ie("table-search"),children:[r("span",{"aria-hidden":"true",children:"⌕"}),r("input",{type:"search",value:m,placeholder:"Search this result...","aria-label":"Search this result",onInput:k=>{f(k.currentTarget.value.trim()),ue(1)}})]}),r("div",{class:ie("table-modes"),role:"group","aria-label":"Table display mode",children:["table","matrix"].map(k=>r("button",{type:"button",class:`${ie("segment")}${D===k?" is-active":""}`,"aria-pressed":D===k,onClick:()=>S(k),children:k==="table"?"Table":"Matrix"},k))})]}),r("div",{class:ie("table-column-bar"),children:[r("details",{"data-result-popover":!0,class:ie("column-picker"),children:[r("summary",{children:"Columns"}),r("div",{class:ie("column-menu"),children:te.map((k,K)=>{let j=d.find(G=>G.key===k);return j?r("div",{class:ie("column-picker-row"),children:[r("label",{children:[r("input",{type:"checkbox",checked:u.includes(j.key),onChange:G=>{let ne=G.currentTarget.checked;p(ye=>ne?[...new Set([...ye,j.key])]:ye.length>1?ye.filter(Se=>Se!==j.key):ye)}}),r("span",{children:Y[j.key]||j.label})]}),r("button",{type:"button","aria-label":`Move ${j.label} left`,disabled:K===0,onClick:()=>U(G=>{let ne=[...G];return[ne[K-1],ne[K]]=[ne[K],ne[K-1]],ne}),children:"↑"}),r("button",{type:"button","aria-label":`Move ${j.label} right`,disabled:K===te.length-1,onClick:()=>U(G=>{let ne=[...G];return[ne[K+1],ne[K]]=[ne[K],ne[K+1]],ne}),children:"↓"})]},j.key):null})})]}),r("button",{type:"button",class:ie("table-view-button"),"aria-pressed":B,onClick:()=>A(k=>!k),children:B?"Comfortable rows":"Compact rows"}),r("button",{type:"button",class:ie("table-view-button"),onClick:He,children:"Reset view"})]}),Object.keys(g).length?r("div",{class:ie("table-filter-bar"),children:Object.entries(g).map(([k,K])=>{let j=d.find(G=>G.key===k);return r("button",{type:"button",class:ie("table-filter-chip"),"aria-label":`Clear ${j?.label??k} filter`,onClick:()=>T(G=>{let ne={...G};return delete ne[k],ne}),children:[Y[k]||j?.label||k," ",K.operator.replaceAll("_"," ")," ",K.value," ×"]},k)})}):null,r("div",{class:ie("table-wrap"),role:"region","aria-label":"Scrollable result table",tabIndex:0,children:r("table",{class:`${ie("table")}${D==="matrix"?" is-matrix":""}${B?" is-compact":""}`,children:[r("caption",{class:ie("visually-hidden"),children:["Result table with ",Le.length," ",Le.length===1?"row":"rows"]}),r("thead",{children:r("tr",{children:[r("th",{class:ie("select-cell"),children:r("input",{type:"checkbox","aria-label":"Select all visible rows",checked:ge,onChange:k=>We(k.currentTarget.checked)})}),Te.map(k=>r("th",{scope:"col",class:V===k.key?"is-pinned":void 0,style:V===k.key?{left:"34px"}:void 0,"aria-sort":_===k.key?I==="asc"?"ascending":"descending":"none",children:[r("button",{type:"button",class:ie("table-sort"),"aria-label":`Sort by ${k.label}`,onClick:()=>{_===k.key?x(K=>K==="asc"?"desc":"asc"):(h(k.key),x("asc")),ue(1)},children:[r("span",{children:Y[k.key]||k.label}),r("span",{class:ie("sort-direction"),"aria-hidden":"true",children:_===k.key?I==="asc"?"↑":"↓":"↕"})]}),r("details",{"data-result-popover":!0,class:ie("table-column-menu"),onToggle:K=>{let j=K.currentTarget,G=j.querySelector(`.${ie("table-column-panel")}`);if(G?.setAttribute("popover","manual"),!j.open){G&&typeof G.hidePopover=="function"&&G.matches(":popover-open")&&G.hidePopover(),j.querySelectorAll("details[data-result-select][open]").forEach(ne=>{ne.open=!1});return}_e.current?.querySelectorAll("details[data-result-popover][open]").forEach(ne=>{ne!==j&&!j.contains(ne)&&(ne.open=!1)}),G&&typeof G.showPopover=="function"&&!G.matches(":popover-open")&&G.showPopover(),requestAnimationFrame(()=>{if(!j.open||!j.isConnected)return;let ne=j.querySelector("summary")?.getBoundingClientRect();if(!ne||!G)return;let{width:ye,height:Se}=G.getBoundingClientRect(),et=ne.bottom+Se+5<=innerHeight-12?ne.bottom+5:ne.top-Se-5;G.style.left=`${Math.max(12,Math.min(ne.right-ye,innerWidth-ye-12))}px`,G.style.top=`${Math.max(12,Math.min(et,innerHeight-Se-12))}px`})},children:[r("summary",{"aria-label":`Actions for ${k.label}`,children:"⋯"}),r("div",{class:ie("table-column-panel"),popover:"manual",children:[r("strong",{children:Y[k.key]||k.label}),r("button",{type:"button",onClick:()=>{h(k.key),x("asc"),ue(1)},children:"Sort ascending"}),r("button",{type:"button",onClick:()=>{h(k.key),x("desc"),ue(1)},children:"Sort descending"}),r("span",{children:"Filter values"}),r(Ai,{classPrefix:s,label:`Filter operator for ${k.label}`,value:g[k.key]?.operator??"contains",options:[["contains","Contains"],["equals","Equals"],["not_equals","Does not equal"],["gt","Greater than"],["gte","At least"],["lt","Less than"],["lte","At most"]]}),r("input",{type:"text","aria-label":`Filter value for ${k.label}`,defaultValue:g[k.key]?.value??"",placeholder:"Enter a value"}),r("button",{type:"button",onClick:K=>{let j=K.currentTarget.parentElement,G=j.querySelector('input[aria-label^="Filter value"]').value.trim(),ne=j.querySelector("[data-result-select]").dataset.value;T(ye=>{let Se={...ye};return G?Se[k.key]={operator:ne,value:G}:delete Se[k.key],Se}),ue(1),K.currentTarget.closest("details").open=!1},children:"Apply filter"}),r("button",{type:"button",onClick:K=>{P(j=>j===k.key?void 0:k.key),U(j=>[k.key,...j.filter(G=>G!==k.key)]),K.currentTarget.closest("details").open=!1},children:V===k.key?"Unpin column":"Pin column"}),r("button",{type:"button",onClick:K=>{Z(j=>j.includes(k.key)?j.filter(G=>G!==k.key):[...j,k.key]),K.currentTarget.closest("details").open=!1},children:ee.includes(k.key)?"Do not wrap text":"Wrap text"}),r("input",{type:"text","aria-label":`Display name for ${k.label}`,defaultValue:Y[k.key]||k.label,maxLength:80}),r("button",{type:"button",onClick:K=>{let j=K.currentTarget.parentElement.querySelector('input[aria-label^="Display name"]').value.trim();z(G=>({...G,[k.key]:j||k.label||k.key})),K.currentTarget.closest("details").open=!1},children:"Apply display name"})]})]})]},k.key))]})}),r("tbody",{children:Xe.map(({row:k,index:K})=>r("tr",{class:N.includes(K)?"is-selected":void 0,children:[r("td",{class:ie("select-cell"),children:r("input",{type:"checkbox","aria-label":`Select row ${K+1}`,checked:N.includes(K),onChange:j=>y(G=>j.currentTarget.checked?[...new Set([...G,K])]:G.filter(ne=>ne!==K))})}),Te.map(j=>r("td",{class:`${ee.includes(j.key)?"is-wrapped":""} ${V===j.key?"is-pinned":""}`.trim(),style:V===j.key?{left:"34px"}:void 0,children:rr(k[j.key],a,j,i)},j.key))]},K))})]})}),r("div",{class:ie("table-summary"),children:[r("span",{children:Ie.length?`${((ve-1)*oe+1).toLocaleString(a)}-${Math.min(ve*oe,Ie.length).toLocaleString(a)} of ${Le.length.toLocaleString(a)}`:`0 of ${Le.length.toLocaleString(a)}`}),o?r("span",{children:e.length>n?`First ${n.toLocaleString(a)} rows available`:"All returned rows loaded"}):r("div",{class:ie("table-pagination"),"aria-label":"Table pagination",children:[r("label",{children:[r("span",{children:"Rows"}),r(Ai,{classPrefix:s,label:"Rows per page",value:String(oe),options:[["10","10"],["25","25"],["50","50"]],onChange:k=>{Fe(Number(k)),ue(1)}})]}),r("button",{type:"button","aria-label":"Previous page",disabled:ve<=1,onClick:()=>ue(k=>Math.max(1,k-1)),children:"‹"}),r("span",{children:[ve," / ",Ce]}),r("button",{type:"button","aria-label":"Next page",disabled:ve>=Ce,onClick:()=>ue(k=>Math.min(Ce,k+1)),children:"›"})]})]})]})},sc=(e,t,n)=>{let a=Qa(t),i=[],o=e.reportingPeriod?.label?.trim();o&&i.push({label:a.aboutPeriod,value:o});let s=e.rowCount??e.rows?.length;typeof s=="number"&&i.push({label:a.aboutResults,value:vt(s===1?a.rowOne:a.rowMany,{count:s})});let c=e.explanation?.checkedAt??e.freshness?.answeredAt,d=e.explanation?.timezone??e.timezone??e.reportingPeriod?.timezone;if(c){let u=new Date(c),p=c;if(!Number.isNaN(u.getTime()))try{p=new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"short",...d?{timeZone:d}:{}}).format(u)}catch{p=u.toLocaleString(n)}i.push({label:a.aboutChecked,value:p})}d&&i.push({label:a.aboutTimezone,value:d});let l=e.explanation?.dataFreshness?.status??e.freshness?.status;return l&&l!=="unknown"&&i.push({label:a.aboutSourceData,value:l.replaceAll("_"," ")}),e.appliedFilters?.length&&i.push({label:a.aboutFilters,value:vt(a.filtersApplied,{count:e.appliedFilters.length})}),i},Mi=e=>e.columns?.length?e.columns:Object.keys(e.rows?.[0]??{}),cc=e=>{let t=e.rows??[],n=e.currency?.code&&!e.currency.isMixed?e.currency.code:void 0;return Mi(e).map(a=>{let i=e.columnMetadata?.find(s=>s.key===a);if(!i)return{key:a,label:En(a)};let o=i.dataType==="date"||i.dataType==="datetime"||i.semanticRole==="date";return{key:a,label:i.label,dataType:i.dataType,currencyCode:i.currencyCode||(i.dataType==="currency"?n:void 0),formatPattern:i.formatPattern,grain:o?i.grain??e.periodComparison?.grain??li(t.map(s=>s[a])):void 0}})},lc=(e,t)=>{let n=e.rows?.[0]??{};return e.chartRecommendation?.valueFields?.[0]??e.valueFields?.[0]??e.value??e.columnMetadata?.find(a=>a.semanticRole==="measure"&&a.key in n)?.key??t.find(a=>$n(n[a])!==null)??t[1]??t[0]},dc=(e,t,n="analytics-result.csv")=>{if(typeof document>"u"||e.length===0)return;let a=rc(t,e),i=URL.createObjectURL(new Blob([a],{type:"text/csv;charset=utf-8"})),o=document.createElement("a");o.href=i,o.download=n,o.click(),URL.revokeObjectURL(i)},dn=new Set,Ii=e=>{let t=e.composedPath();dn.forEach(n=>{n.isOpen()&&!n.contains(t)&&n.close(!1)})},Ei=e=>{if(e.key==="Escape"){for(let t of dn)if(t.isOpen()){t.close(!0),e.preventDefault();return}}},uc=e=>(dn.size===0&&typeof document<"u"&&(document.addEventListener("pointerdown",Ii),document.addEventListener("keydown",Ei)),dn.add(e),()=>{dn.delete(e),dn.size===0&&typeof document<"u"&&(document.removeEventListener("pointerdown",Ii),document.removeEventListener("keydown",Ei))}),ma=({children:e,size:t=15})=>r("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",children:e}),pc=()=>r(ma,{children:r("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})}),fc=()=>r(ma,{children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),zi=()=>r(ma,{size:13,children:r("path",{d:"m6 9 6 6 6-6"})}),hc=()=>r(ma,{size:13,children:r("path",{d:"m5 12 5 5L20 7"})}),Ni=({type:e,className:t})=>r("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:t,fill:"none",children:[r("path",{d:"M6 26h21M6 7v19",stroke:"var(--rv-muted)","stroke-width":"1.4","stroke-linecap":"round"}),e==="line"?r("path",{d:"M8 21c4-7 7 2 11-6 2.5-5 4.5-2 7-7",stroke:"var(--rv-chart-2)","stroke-width":"2.1","stroke-linecap":"round","stroke-linejoin":"round"}):e==="stacked_bar"?r(se,{children:[9,15,21].map((n,a)=>r("g",{children:[r("rect",{x:n,y:18-a*2,width:"4",height:8+a*2,fill:"var(--rv-chart-2)",rx:"0.6"}),r("rect",{x:n,y:13-a,width:"4",height:"5",fill:"var(--rv-chart-3)",rx:"0.6"}),r("rect",{x:n,y:9-a,width:"4",height:"4",fill:"var(--rv-chart-1)",rx:"0.6"})]},n))}):r(se,{children:[r("rect",{x:"9",y:"18",width:"4",height:"8",fill:"var(--rv-chart-2)",rx:"0.7"}),r("rect",{x:"15",y:"13",width:"4",height:"13",fill:"var(--rv-chart-2)",rx:"0.7"}),r("rect",{x:"21",y:"8",width:"4",height:"18",fill:"var(--rv-chart-2)",rx:"0.7"})]})]}),Ri=e=>{let[t,n]=$(!1),a=R(null),i=R(null),o=R(t);return o.current=t,X(()=>uc({isOpen:()=>o.current,contains:s=>!!(a.current&&s.includes(a.current)||i.current&&s.includes(i.current)),close:s=>{n(!1),s&&a.current?.focus()}}),[]),Sn(()=>{if(!t)return;let s=()=>{let c=a.current,d=i.current;if(!c||!d)return;d.style.left="0px",d.style.top="0px";let l=d.getBoundingClientRect(),u=c.getBoundingClientRect(),p=document.documentElement.clientWidth||window.innerWidth,m=document.documentElement.clientHeight||window.innerHeight,f=getComputedStyle(c).direction==="rtl",_=e==="end"===f?u.left:u.right-l.width;_=Math.max(8,Math.min(_,p-l.width-8));let h=u.bottom+7;h+l.height>m-8&&u.top-7-l.height>8&&(h=u.top-7-l.height),d.style.left=`${_-l.left}px`,d.style.top=`${h-l.top}px`};return s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),i.current?.querySelector('[aria-selected="true"], button')?.focus({preventScroll:!0}),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[t,e]),{open:t,setOpen:n,triggerRef:a,layerRef:i}},mc=({visualization:e,field:t,prefix:n,labels:a,locale:i,headerTitle:o})=>{let s=e.rows??[],c=e.columnMetadata?.find(x=>x.key===t),d=t?s[0]?.[t]:void 0,l=$n(d),u=x=>tn(x,c,e,!1,i),p=l===null?String(d??a.noValue):u(l),m=e.periodComparison,f=!m?.measureField||m.measureField===t,_=t?$n(s[1]?.[t]):null,h=l!==null&&m&&f?zr(m,{value:l,status:"observed",label:m.currentPeriod?.label},{value:_??m.previousFullValue??m.previousToDateValue,status:"observed",label:m.previousPeriod?.label},{format:u,locale:i}):void 0,I=c?.label??(t?En(t):a.currentValue);return r("section",{class:`${n}-analytics-kpi`,"aria-label":o??I,"data-testid":"analytics-kpi",children:[r("div",{class:`${n}-analytics-kpi__label`,children:I}),r("div",{class:`${n}-analytics-kpi__value`,children:p}),h?r(se,{children:[r("div",{class:`${n}-analytics-kpi__change is-${h.tone}`,"data-comparison-basis":h.basis,title:h.title,children:[r("span",{children:h.label}),h.copy?r("span",{class:`${n}-analytics-kpi__copy`,children:h.copy}):null]}),h.secondary?r("div",{class:`${n}-analytics-kpi__secondary`,children:h.secondary}):null]}):null]})},gc=({visualization:e,classPrefix:t,labels:n,locale:a,expanded:i=!1,onExpand:o,onClose:s,expandControlId:c,onFollowUp:d,onDownload:l,headerActions:u,children:p,dataToggle:m,cardRef:f,maxTableRows:_=100})=>{let h=Be(()=>Qa(n),[n]),I=Be(()=>nr(e,void 0,{labels:h,locale:a}),[e,h,a]),[x,g]=$(I?.type);X(()=>g(I?.type),[I]);let[T,V]=$(!1),P=Be(()=>Zs(e,h),[e,h]),ee=Be(()=>nr(e,x,{labels:h,locale:a}),[e,x,h,a]),Z=x??ee?.type??I?.type,Y=P.find(ge=>ge.type===Z),z=[...new Set(ee?.series.map(ge=>ge.field)??[])],te=Ri("end"),U=Ri("start"),B=e.rows??[],A=Mi(e),N=Be(()=>ds(e),[e]),y=Be(()=>cc(N),[N]),D=Be(()=>({locale:a,timezone:e.timezone||e.periodComparison?.timezone,yes:h.yes,no:h.no}),[a,e.timezone,e.periodComparison?.timezone,h]),S=sc(e,h,a),O=l===!1||!e.downloadAvailable?null:()=>(l??dc)(A,B),ue=S.length?r("details",{class:`${t}-analytics-inspect`,children:[r("summary",{children:h.aboutResult}),r("dl",{children:S.map(ge=>r("div",{children:[r("dt",{children:ge.label}),r("dd",{children:ge.value})]},ge.label))})]}):null,oe=(()=>{let ge=e.freshness?.answeredAt,ie=ge?new Date(ge):null;return!ie||Number.isNaN(ie.getTime())?h.liveData:vt(h.updatedAt,{time:new Intl.DateTimeFormat(a,{hour:"numeric",minute:"2-digit"}).format(ie)})})(),Fe=e.rowCount??B.length,_e=e.appliedFilters?.length??0,Te=r("div",{class:`${t}-analytics-meta`,"data-testid":"analytics-result-meta",role:"group","aria-label":h.resultDetails,children:[r("span",{children:[r("span",{"aria-hidden":"true",class:`${t}-analytics-meta__dot`}),oe]}),e.reportingPeriod?.label?r("span",{children:e.reportingPeriod.label}):null,r("span",{children:vt(Fe===1?h.rowOne:h.rowMany,{count:Fe})}),_e>0?r("span",{children:vt(_e===1?h.filtersOne:h.filtersMany,{count:_e})}):null]}),Le=(ge,ie,He,We=h.expandChart)=>r("div",{class:`${t}-analytics-result`,children:[r("section",{ref:f,class:`${t}-analytics-visualization${i?" is-expanded":""}`,"aria-label":ge,children:[r("div",{class:`${t}-analytics-visualization__header`,children:[r("div",{children:[r("div",{class:`${t}-analytics-visualization__title`,children:ge}),Te]}),r("div",{class:`${t}-analytics-visualization__actions`,children:[He,u,i&&s?r("button",{type:"button",class:`${t}-analytics-visualization__close`,"aria-label":h.restoreView,title:h.restoreView,onClick:s,children:r(fc,{})}):o&&e.expandable!==!1?r("button",{type:"button",class:`${t}-analytics-visualization__expand`,"aria-label":We,title:We,"data-visualization-message":c,onClick:o,children:r(pc,{})}):null]})]}),ie,ue,p]}),r("div",{class:`${t}-analytics-layer`,children:[d?r("div",{ref:U.layerRef,class:`${t}-analytics-chart-picker__menu`,style:{position:"fixed"},role:"menu","aria-label":h.aggregate,hidden:!U.open,children:z.flatMap(k=>$i(e,k).map(K=>{let j=e.columnMetadata?.find(G=>G.key===k)?.label??En(k);return r("button",{type:"button",role:"menuitem",onClick:()=>{let G=Ys(e,k,K.value);G&&d(G),U.setOpen(!1)},children:r("span",{class:`${t}-analytics-chart-picker__copy`,children:[r("strong",{children:[Ks(K.value,h)," · ",j]}),r("small",{children:h.aggregateCharge})]})},`${k}:${K.value}`)}))}):null,r("div",{ref:te.layerRef,class:`${t}-analytics-chart-picker__menu`,style:{position:"fixed"},role:"listbox","aria-label":h.chartType,hidden:!te.open,children:P.map(k=>{let K=k.type===Z;return r("button",{type:"button",role:"option","aria-selected":K,class:K?"is-selected":"",onClick:()=>{g(k.type),te.setOpen(!1),te.triggerRef.current?.focus()},children:[r("span",{class:`${t}-analytics-chart-picker__icon`,children:r(Ni,{type:k.type,className:`${t}-chart-type-icon`})}),r("span",{class:`${t}-analytics-chart-picker__copy`,children:[r("strong",{children:k.label}),r("small",{children:k.hint})]}),K?r(hc,{}):null]},k.type)})})]})]}),Ie=r(oc,{rows:N.rows??B,columns:y,maxRows:_,expanded:i,classPrefix:t,locale:a,format:D}),Ce=()=>e.tableAvailable===!1||A.length===0?null:Le(e.title?.trim()||h.resultDetails,r(se,{children:Ie}),O?r("button",{type:"button",class:`${t}-analytics-visualization__download`,onClick:O,children:h.download}):null,h.expandTable);if(B.length===0)return r(se,{children:[r("section",{class:`${t}-analytics-empty`,role:"status","data-testid":"analytics-empty-state",children:[r("p",{children:h.noMatchTitle}),r("p",{children:h.noMatchBody})]}),ue,p]});if(e.presentation==="table"||!e.presentation&&e.type==="table")return Ce()??r(se,{children:p});let ve=m&&e.tableAvailable!==!1?r("button",{type:"button",class:`${t}-analytics-visualization__download`,"aria-expanded":T,onClick:()=>V(ge=>{let ie=!ge;return m.onToggle?.(ie),ie}),children:T?h.hideData:h.viewData}):null,Xe=T?r("div",{class:`${t}-analytics-data`,children:Ie}):null;return e.presentation==="kpi"||!e.presentation&&e.type==="kpi"?Le(h.liveMetric,r(se,{children:[r(mc,{visualization:e,field:lc(e,A),prefix:t,labels:h,locale:a}),ve,Xe]})):ee?Le(ee.title,r(se,{children:[r(ac,{model:ee,expanded:i,classPrefix:t}),O?r("button",{type:"button",class:`${t}-analytics-visualization__download`,onClick:O,children:h.downloadData}):null,ve,Xe]}),r(se,{children:[d?r("div",{class:`${t}-analytics-chart-picker ${t}-analytics-chart-picker--aggregation`,children:r("button",{type:"button",ref:U.triggerRef,"aria-haspopup":"menu","aria-expanded":U.open,"aria-label":h.aggregate,title:h.aggregateTitle,onClick:()=>{te.setOpen(!1),U.setOpen(!U.open)},children:[r("span",{class:`${t}-analytics-chart-picker__current`,children:r("span",{children:h.aggregate})}),r(zi,{})]})}):null,P.length>1?r("div",{class:`${t}-analytics-chart-picker`,children:r("button",{type:"button",ref:te.triggerRef,"aria-haspopup":"listbox","aria-expanded":te.open,"aria-label":h.chooseChartType,title:h.chooseChartType,onClick:()=>{U.setOpen(!1),te.setOpen(!te.open)},children:[r("span",{class:`${t}-analytics-chart-picker__current`,children:[r(Ni,{type:Z??ee.type,className:`${t}-chart-type-icon`}),r("span",{children:Y?.label??h.chartFallback})]}),r(zi,{})]})}):null]})):Ce()??r(se,{children:p})},bc=["#2563eb","#b45309","#7c3aed"],vc=["#60a5fa","#fbbf24","#a78bfa"],xc=(e,t)=>{let n=`.${e}-analytics-visualization`,a=`.${e}-analytics-result`,i=`.${e}-analytics-chart-picker`,o=`.${e}-analytics-kpi`;return`
|
|
3
|
+
${a}{
|
|
4
|
+
display:contents;
|
|
5
|
+
--rv-bg:${t.bg};--rv-surface:${t.surface};--rv-surface-2:${t.surface2};--rv-text:${t.text};
|
|
6
|
+
--rv-muted:${t.muted};--rv-border:${t.border};--rv-accent:${t.accent};--rv-on-accent:${t.onAccent};
|
|
7
|
+
--rv-chart-1:${t.accent};--rv-chart-2:${t.chart[0]};--rv-chart-3:${t.chart[1]};--rv-chart-4:${t.chart[2]};
|
|
8
|
+
}
|
|
9
|
+
${t.darkSelector} ${a}{--rv-chart-2:${t.chartDark[0]};--rv-chart-3:${t.chartDark[1]};--rv-chart-4:${t.chartDark[2]}}
|
|
10
|
+
${n}{box-sizing:border-box;width:100%;max-width:100%;margin-block-start:8px;min-width:0;overflow:hidden;border:1px solid var(--rv-border);border-radius:13px;background:var(--rv-surface);padding:12px;color:var(--rv-muted);font-size:11px}
|
|
11
|
+
${n}.is-expanded{display:flex;min-height:100%;flex-direction:column;margin:0;border:0;border-radius:0;background:transparent;padding:0}
|
|
12
|
+
${n}__header{display:flex;width:100%;min-width:0;min-height:32px;align-items:center;justify-content:space-between;gap:10px}
|
|
13
|
+
${n}__header>div:first-child{min-width:0}
|
|
14
|
+
${n}__actions{display:flex;flex:0 0 auto;align-items:center;gap:6px}
|
|
15
|
+
${n}__title{overflow:hidden;color:var(--rv-muted);font-size:10px;font-weight:750;letter-spacing:.08em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap}
|
|
16
|
+
.${e}-analytics-meta{display:flex;flex-wrap:wrap;align-items:center;gap:3px 7px;margin-block-start:4px;color:var(--rv-muted);font-size:9px;line-height:1.35}
|
|
17
|
+
.${e}-analytics-meta__dot{display:inline-block;width:5px;height:5px;margin-inline-end:4px;border-radius:999px;background:var(--rv-accent)}
|
|
18
|
+
${n}__download{width:fit-content;min-height:32px;margin-block-start:6px;border:1px solid var(--rv-border);border-radius:8px;background:var(--rv-surface);padding:6px 9px;color:var(--rv-text);font:inherit;font-size:10px;font-weight:700;cursor:pointer}
|
|
19
|
+
${n}__header ${n}__download{margin:0}
|
|
20
|
+
${n}__download:hover{border-color:var(--rv-accent);color:var(--rv-accent)}
|
|
21
|
+
${n}__expand,${n}__close{display:grid;width:30px;height:30px;flex:0 0 auto;place-items:center;border:1px solid var(--rv-border);border-radius:9px;background:var(--rv-bg);color:var(--rv-text);cursor:pointer}
|
|
22
|
+
${n}__expand:hover,${n}__close:hover{background:var(--rv-surface-2)}
|
|
23
|
+
${n} button:focus-visible,${n} summary:focus-visible,${a} ${i}__menu button:focus-visible{outline:2px solid var(--rv-accent);outline-offset:2px}
|
|
24
|
+
.${e}-analytics-inspect{margin-block-start:10px;padding-block-start:9px;border-block-start:1px solid var(--rv-border);color:var(--rv-muted);font-size:11px}
|
|
25
|
+
.${e}-analytics-inspect summary{width:max-content;max-width:100%;cursor:pointer;color:var(--rv-text);font-weight:650}
|
|
26
|
+
.${e}-analytics-inspect dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;margin:10px 0 0}
|
|
27
|
+
.${e}-analytics-inspect dt{margin:0;color:var(--rv-muted)}
|
|
28
|
+
.${e}-analytics-inspect dd{margin:2px 0 0;color:var(--rv-text);overflow-wrap:anywhere}
|
|
29
|
+
.${e}-analytics-data{margin-block-start:8px}
|
|
30
|
+
${i}{position:relative;display:inline-flex;min-width:0;color:var(--rv-muted);font-size:9px;font-weight:700}
|
|
31
|
+
${i}>button{display:inline-flex;min-width:92px;max-width:138px;height:30px;align-items:center;gap:6px;border:1px solid var(--rv-border);border-radius:8px;background:var(--rv-bg);padding:0 8px;color:var(--rv-text);font:inherit;cursor:pointer;transition:border-color .16s ease,background .16s ease}
|
|
32
|
+
${i}>button:hover,${i}>button[aria-expanded="true"]{border-color:var(--rv-accent);background:color-mix(in oklab,var(--rv-accent) 9%,var(--rv-bg))}
|
|
33
|
+
${i}>button>svg:last-child{flex:0 0 13px;margin-inline-start:auto;color:var(--rv-muted);transition:transform .16s ease}
|
|
34
|
+
${i}>button[aria-expanded="true"]>svg:last-child{transform:rotate(180deg)}
|
|
35
|
+
${i}__current{display:inline-flex;min-width:0;align-items:center;gap:6px}
|
|
36
|
+
${i}__current>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
37
|
+
.${e}-chart-type-icon{width:17px;height:17px;flex:0 0 17px}
|
|
38
|
+
${i}__menu{z-index:2147483000;display:grid;min-width:196px;max-width:calc(100vw - 16px);max-height:min(400px,calc(100dvh - 32px));overflow-y:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--rv-border);border-radius:12px;background:var(--rv-bg);color:var(--rv-text);font-size:9px;box-shadow:0 18px 45px rgb(0 0 0/.22)}
|
|
39
|
+
${i}__menu[hidden]{display:none}
|
|
40
|
+
${i}__menu button{display:flex;width:100%;min-height:46px;align-items:flex-start;gap:8px;border:0;border-radius:9px;background:transparent;padding:7px;color:var(--rv-text);font:inherit;text-align:start;cursor:pointer}
|
|
41
|
+
${i}__menu button:hover,${i}__menu button.is-selected{background:color-mix(in oklab,var(--rv-accent) 10%,var(--rv-bg))}
|
|
42
|
+
${i}__menu button>svg:last-child{flex:0 0 13px;margin-block-start:4px}
|
|
43
|
+
${i}__icon{display:inline-flex;width:30px;height:30px;flex:0 0 30px;align-items:center;justify-content:center;border-radius:9px;background:var(--rv-surface-2);box-shadow:inset 0 0 0 1px var(--rv-border)}
|
|
44
|
+
${i}__icon .${e}-chart-type-icon{width:25px;height:25px;flex-basis:25px}
|
|
45
|
+
${i}__copy{display:grid;min-width:0;flex:1;gap:2px}
|
|
46
|
+
${i}__copy strong{font-size:10px;line-height:1.25}
|
|
47
|
+
${i}__copy small{color:var(--rv-muted);font-size:9px;font-weight:560;line-height:1.3}
|
|
48
|
+
${o}{padding:9px 0 5px}
|
|
49
|
+
${o}__label{color:var(--rv-muted);font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
|
|
50
|
+
${o}__value{margin-block-start:5px;color:var(--rv-text);font-size:30px;font-weight:750;letter-spacing:-.035em;line-height:1}
|
|
51
|
+
${o}__change{display:inline-flex;flex-wrap:wrap;gap:2px 6px;margin-block-start:8px;font-size:11px;font-weight:700;color:var(--rv-muted)}
|
|
52
|
+
${o}__change.is-positive{color:var(--rv-success,#15803d)}
|
|
53
|
+
${o}__change.is-negative{color:var(--rv-danger,#b42318)}
|
|
54
|
+
${o}__copy{font-weight:560;color:var(--rv-muted)}
|
|
55
|
+
${o}__secondary{margin-block-start:3px;color:var(--rv-muted);font-size:10px}
|
|
56
|
+
.${e}-analytics-empty{margin-block-start:8px;border:1px dashed var(--rv-border);border-radius:11px;padding:18px 14px;color:var(--rv-text);text-align:center}
|
|
57
|
+
.${e}-analytics-empty p{margin:0}
|
|
58
|
+
.${e}-analytics-empty p+p{margin-block-start:4px;color:var(--rv-muted);font-size:10px}
|
|
59
|
+
.${e}-analytics-echart{position:relative;width:100%;height:196px;min-width:0}
|
|
60
|
+
${n}.is-expanded .${e}-analytics-echart{height:auto;min-height:310px;flex:1}
|
|
61
|
+
.${e}-analytics-echart canvas:focus-visible{outline:2px solid var(--rv-accent);outline-offset:-2px}
|
|
62
|
+
.${e}-analytics-echart__fallback{display:grid;height:100%;place-items:center;border:1px dashed var(--rv-border);border-radius:9px;padding:16px;color:var(--rv-muted);text-align:center;line-height:1.5}
|
|
63
|
+
.${e}-analytics-zoom{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:8px;margin-block-start:4px;border-block-start:1px solid var(--rv-border);padding-block-start:8px}
|
|
64
|
+
.${e}-analytics-zoom__range{min-width:0;overflow:hidden;color:var(--rv-muted);font-size:10px;font-weight:650;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}
|
|
65
|
+
.${e}-analytics-zoom__controls{display:inline-flex;flex:0 0 auto;align-items:center;overflow:hidden;border:1px solid var(--rv-border);border-radius:9px;background:var(--rv-bg)}
|
|
66
|
+
.${e}-analytics-zoom__controls button{display:grid;min-width:40px;height:40px;place-items:center;border:0;border-radius:0;background:transparent;color:var(--rv-text);font:inherit;font-size:16px;font-weight:700;line-height:1;cursor:pointer}
|
|
67
|
+
.${e}-analytics-zoom__controls button+button{border-inline-start:1px solid var(--rv-border)}
|
|
68
|
+
.${e}-analytics-zoom__controls button:hover:not(:disabled){background:var(--rv-surface-2)}
|
|
69
|
+
.${e}-analytics-zoom__controls button:focus-visible{position:relative;z-index:1;outline:2px solid var(--rv-accent);outline-offset:-2px}
|
|
70
|
+
.${e}-analytics-zoom__controls button:disabled{cursor:not-allowed;opacity:.38}
|
|
71
|
+
.${e}-analytics-zoom__controls .${e}-analytics-zoom__reset{min-width:56px;padding:0 10px;font-size:10px;font-weight:700}
|
|
72
|
+
`},yc=(e,t)=>{if(typeof MutationObserver>"u")return()=>{};let n=e.scrollHeight,a=0,i=()=>{a=0;let s=e.scrollHeight,c=s>n,d=t.isAtBottom();n=s,c&&(d?(e.scrollTop=e.scrollHeight,t.onFollow?.()):t.onUnseen?.())},o=new MutationObserver(()=>{a||(a=typeof requestAnimationFrame=="function"?requestAnimationFrame(i):setTimeout(i,0))});return o.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{o.disconnect(),a&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a)}};class un extends Error{constructor(n,a,i){super(a);q(this,"status");q(this,"retryAfterSeconds");this.status=n,this.retryAfterSeconds=i,this.name="ApiError"}}const ir=()=>({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:[]}),_c="Sara is an AI assistant; answers may be imperfect.",wc="Accurix is an AI assistant; answers may be imperfect.",Li=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.`)},or=(e,t={})=>{const a=e.disclaimerText?.trim()?.toLowerCase(),i=t.agentName?.trim()||e.agentName?.trim()||"Accurix",o=t.agentAvatarUrl?.trim()||e.agentAvatarUrl?.trim();return{...e,allowVoiceInput:!!(e.allowVoiceInput&&e.talkbackMode&&e.talkbackMode!=="text"),voiceOutputEnabled:!!(e.voiceOutputEnabled&&e.talkbackMode&&e.talkbackMode!=="text"),agentName:i,agentAvatarUrl:o||void 0,disclaimerText:a===_c.toLowerCase()||a?.includes("sara is an ai assistant")?wc:e.disclaimerText}},kc=15e3,Sc=6e4,$c=12e4,Tc=["/transcribe","/speak","/attachments","/stream"],Cc=["/book-demo","/schedule-callback"],Ac=e=>{const t=e.split("?")[0]??e;return Cc.some(n=>t.includes(`/public-chat${n}`))?$c:Tc.some(n=>t.includes(`/public-chat${n}`))||t.endsWith("/public-chat")?Sc:kc},Mc=e=>{const t=e.headers?.get?.("Retry-After"),n=t?Number(t):NaN;return Number.isFinite(n)&&n>=0?n:void 0},Ic=e=>{try{const t=e.split(".")[1];if(!t)return null;const n=atob(t.replace(/-/g,"+").replace(/_/g,"/")),a=JSON.parse(n).exp;return typeof a=="number"&&Number.isFinite(a)?a*1e3:null}catch{return null}};class Ec{constructor(t,n,a,i,o={},s,c,d="floating"){q(this,"baseUrl");q(this,"token");q(this,"gifApiKey");q(this,"analyticsContextToken");q(this,"bootstrapOverrides");q(this,"identityToken");q(this,"identityTokenProvider");q(this,"chatSurface");q(this,"cachedIdentity",null);q(this,"identityFlight",null);this.baseUrl=t,this.token=n,this.gifApiKey=a,this.analyticsContextToken=i,this.bootstrapOverrides=o,this.identityToken=s,this.identityTokenProvider=c,this.chatSurface=d}async currentIdentityToken(){if(!this.identityTokenProvider)return this.identityToken;const t=this.cachedIdentity;return t&&Date.now()<t.refreshAt?t.token:(this.identityFlight??(this.identityFlight=(async()=>{try{const n=(await this.identityTokenProvider()??"").trim();this.identityToken=n||void 0;const a=n?Ic(n):null;return this.cachedIdentity=n&&a!==null?{token:n,refreshAt:a-6e4}:null,this.identityToken}finally{this.identityFlight=null}})()),this.identityFlight)}async fetchT(t,n={}){const a=new AbortController;let i=!1;const o=setTimeout(()=>{i=!0,a.abort()},Ac(t)),s=n.signal,c=()=>a.abort();s?.aborted?a.abort():s?.addEventListener("abort",c,{once:!0});try{return await fetch(t,{...n,signal:a.signal})}catch(d){throw i&&!s?.aborted?new un(408,"The request took too long. Please try again."):d}finally{clearTimeout(o),s?.removeEventListener("abort",c)}}headers(t=!0){const n={Authorization:`Bearer ${this.token}`};return t&&(n["Content-Type"]="application/json"),n}async json(t){let n;try{n=await t.json()}catch{n=void 0}if(!t.ok){const a=Nc(n)??`request failed (${t.status})`;throw new un(t.status,a,Mc(t))}return n?.data??n}async bootstrap(){try{const t=await this.fetchT(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!t.ok)return Li(`bootstrap request failed with ${t.status}`),or(ir(),this.bootstrapOverrides);const n=await this.json(t);return or({...ir(),...n},this.bootstrapOverrides)}catch(t){return Li(t instanceof Error?t.message:"bootstrap request failed"),or(ir(),this.bootstrapOverrides)}}async history(){const t=await this.currentIdentityToken();if(!t)return{conversations:[]};const n=await this.fetchT(`${this.baseUrl}/public-chat/history`,{method:"POST",headers:this.headers(),body:JSON.stringify({identityToken:t,surface:this.chatSurface})}),a=await this.json(n);return{activeSessionId:a.activeSessionId,conversations:Array.isArray(a.conversations)?a.conversations:[]}}async stream(t,n,a){const i=await this.currentIdentityToken(),o=await this.fetchT(`${this.baseUrl}/public-chat/stream`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:t,sessionId:n,clientMessageId:a.clientMessageId,attachmentId:a.attachmentId,attachmentIds:a.attachmentIds,voicePlaybackRequested:!!a.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:i,surface:this.chatSurface}),signal:a.signal});return!o.ok||!o.body?((o.status===429||o.status===401)&&await this.json(o),this.send(t,n,a)):Rc(o.body,a)}async liveEvents(t,n){const a=`sessionId=${encodeURIComponent(t)}&after=${encodeURIComponent(n)}`,i=await this.fetchT(`${this.baseUrl}/public-chat/live-events?${a}`,{headers:this.headers(!1)}),o=await this.json(i);return{mode:o.mode??"ai",assignedAgentName:o.assignedAgentName,agentTyping:!!o.agentTyping,agentTypingName:o.agentTypingName,conversationEnded:!!o.conversationEnded,events:o.events??[]}}async typing(t,n){try{const a=await this.fetchT(`${this.baseUrl}/public-chat/typing`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:t,isTyping:n})});if(!a.ok)try{await a.text()}catch{}}catch{}}async presence(t){try{await this.fetchT(`${this.baseUrl}/public-chat/presence`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:t})})}catch{}}async send(t,n,a){const i=await this.currentIdentityToken(),o=await this.fetchT(`${this.baseUrl}/public-chat`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:t,sessionId:n,clientMessageId:a.clientMessageId,attachmentId:a.attachmentId,attachmentIds:a.attachmentIds,voicePlaybackRequested:!!a.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:i,surface:this.chatSurface}),signal:a.signal}),s=await this.json(o);return a.onChunk(s.answer??""),{answer:s.answer??"",sources:s.sources??[],suggestedReplies:s.suggestedReplies??[],availableActions:s.availableActions??[],actions:s.actions??[],selectedAction:s.selectedAction,handoffOffered:s.handoffOffered??!1,requestedContactFields:Di(s.requestedContactFields),conversationEnded:s.conversationEnded??!1,liveMode:s.liveMode,assignedAgentName:s.assignedAgentName,audioBase64:s.audioBase64,mimeType:s.mimeType,visualization:s.visualization,artifacts:s.artifacts}}async action(t,n,a){const i=a?.trim()||(t==="contact-support"?"inquiry":t),o=await this.fetchT(`${this.baseUrl}/public-chat/${i}`,{method:"POST",headers:this.headers(),body:JSON.stringify(n)}),s=await this.json(o);return{ok:!0,note:s?.note,receipt:s?.receipt,booking:s?.booking,caseReference:s?.caseReference||void 0,inquiryId:s?.inquiryId||s?.inquiry?.id||void 0}}async confirmHostedBooking(t){const n=await this.fetchT(`${this.baseUrl}/public-chat/book-demo/confirm`,{method:"POST",headers:this.headers(),body:JSON.stringify(t)}),a=await this.json(n);if(!a?.booking)throw new Error("Calendar booking confirmation was unavailable.");return{...a.booking,receipt:a.receipt}}async speak(t){const n=await this.fetchT(`${this.baseUrl}/public-chat/speak`,{method:"POST",headers:this.headers(),body:JSON.stringify({text:t})}),a=await this.json(n);return{providerReady:!!a.providerReady,message:a.message,audioBase64:a.audioBase64,mimeType:a.mimeType}}async identify(t,n){if(!(!t||!n))try{const a=await this.fetchT(`${this.baseUrl}/public-chat/identify`,{method:"POST",headers:this.headers(),body:JSON.stringify(zc(t,n))});if(!a.ok)try{await a.text()}catch{}}catch{}}async transcribe(t,n,a,i){const o=await this.fetchT(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(),body:JSON.stringify({audioBase64:t,mimeType:n,languageHint:a,durationSeconds:i})});return(await this.json(o)).text??""}async transcribeAudio(t,n,a,i){const o=new FormData;o.append("audio",t,"voice-recording"),o.append("mimeType",n||t.type||"audio/webm"),a&&o.append("languageHint",a),i!==void 0&&Number.isFinite(i)&&o.append("durationSeconds",String(i));const s=await this.fetchT(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(!1),body:o});return(await this.json(s)).text??""}async endConversation(t){try{const n=await this.fetchT(`${this.baseUrl}/public-chat/end`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:t})});if(!n.ok)try{await n.text()}catch{}}catch{}}async sendFeedback(t){try{const n=await this.fetchT(`${this.baseUrl}/public-chat/feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify(t)});if(!n.ok)try{await n.text()}catch{}}catch{}}async sendExplanationFeedback(t){const n=await this.fetchT(`${this.baseUrl}/public-chat/explanation-feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify(t)});await this.json(n)}async fetchExplanation(t,n,a="widget",i){const o=await this.fetchT(`${this.baseUrl}/public-chat/analytics-explanations/${encodeURIComponent(t)}?sessionId=${encodeURIComponent(n)}&surface=${a}`,{method:"GET",headers:this.headers(!1),signal:i});return this.explanationJob(o,t)}async retryExplanation(t,n,a="widget"){const i=await this.fetchT(`${this.baseUrl}/public-chat/analytics-explanations/${encodeURIComponent(t)}/retry`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:n,surface:a})});return this.explanationJob(i,t)}async explanationJob(t,n){return t.status===404||t.status===410?{status:"failed",explanationId:n,retryAvailable:!1}:this.json(t)}async uploadAttachment(t,n,a,i,o){const s=await this.fetchT(`${this.baseUrl}/public-chat/attachments`,{method:"POST",headers:this.headers(),body:JSON.stringify({fileBase64:t,mimeType:n,filename:a,sessionId:i,analyze:o})});return this.json(s)}async fetchAttachment(t,n){const a=await this.fetchT(`${this.baseUrl}/public-chat/attachments/${encodeURIComponent(t)}?sessionId=${encodeURIComponent(n)}`,{headers:this.headers(!1)});if(!a.ok)throw new un(a.status,"This file is no longer available.");return a.blob()}async demoSlots(t,n){const a=`from=${encodeURIComponent(t)}&to=${encodeURIComponent(n)}`,i=await this.fetchT(`${this.baseUrl}/public-chat/demo-slots?${a}`,{headers:this.headers(!1)});if(!i.ok){const s=new Error("Calendar availability is temporarily unavailable.");throw s.status=i.status,s}const o=await this.json(i);return{status:o?.status,reason:o?.reason,timezone:o?.timezone,slotDurationMinutes:o?.slotDurationMinutes,available:o?.available,taken:o?.taken??[],busy:o?.busy??[]}}async searchGifs(t){if(!this.gifApiKey)return[];const a=`https://tenor.googleapis.com/v2/search?q=${encodeURIComponent(t.trim()||"trending")}&key=${this.gifApiKey}&limit=24&media_filter=tinygif,gif&contentfilter=high`;try{const i=await this.fetchT(a,{});return i.ok?((await i.json()).results??[]).map(s=>({id:s.id,url:s.media_formats?.gif?.url??s.media_formats?.tinygif?.url??"",preview:s.media_formats?.tinygif?.url??s.media_formats?.gif?.url??"",alt:s.content_description||"GIF"})).filter(s=>s.url):[]}catch{return[]}}}const zc=(e,t)=>{const 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);const a={sessionId:e},i=t.externalId??t.userId;return i&&(a.externalId=i),t.email&&(a.email=t.email),t.firstName&&(a.firstName=t.firstName),t.lastName&&(a.lastName=t.lastName),t.name&&(a.name=t.name),t.phone&&(a.phone=t.phone),Object.keys(n).length>0&&(a.metadata=n),a},Nc=e=>{const t=e?.message;if(Array.isArray(t))return t.join(", ");if(typeof t=="string")return t},Rc=async(e,t)=>{const n=e.getReader(),a=new TextDecoder,i={answer:"",sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1};let o="";for(;;){const{done:s,value:c}=await n.read();if(s)break;o+=a.decode(c,{stream:!0});let d;for(;(d=o.indexOf(`
|
|
2
73
|
|
|
3
|
-
`))!==-1;){const
|
|
4
|
-
`))
|
|
5
|
-
`))}}catch{return{event:e}}},tv=t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):[],fr=t=>new Promise(e=>setTimeout(e,t)),rv={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"}]},hw=[{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}}],pw={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},vw=t=>hw.find(e=>e.match.test(t))?.result??pw;class gw{async history(){return{conversations:[]}}async bootstrap(){return await fr(180),rv}async stream(e,r,n){await fr(550);const a=vw(e),i=a.answer.split(/(\s+)/);for(const o of i){if(n.signal?.aborted)break;n.onChunk(o),await fr(18+Math.min(40,o.length*6))}return{...a,availableActions:rv.availableActions}}async liveEvents(){return{mode:"ai",conversationEnded:!1,events:[]}}async presence(e){}async typing(){await fr(20)}async action(e,r){return await fr(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 request sent. The team can follow up from this chat. ✅",inquiry:"Thanks! We'll get back to you shortly. ✉️","request-callback":"We'll call you back soon. 📞","schedule-callback":"Your callback has been scheduled.","subscribe-newsletter":"You're subscribed. 🎉"}[e]}}async speak(){return await fr(120),{providerReady:!1,message:"Demo voice provider is not connected."}}async transcribe(e,r,n,a){return await fr(700),"How do I track a shipment?"}async uploadAttachment(e,r,n){return{id:`demo-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async identify(e,r){await fr(50)}async endConversation(e){await fr(50)}async sendFeedback(){await fr(50)}async demoSlots(e,r){return await fr(150),{taken:[[11,0],[15,0]].map(([a,i])=>{const o=new Date;return o.setHours(a,i,0,0),o.toISOString()}),busy:[]}}async searchGifs(e){await fr(280);const r=e.trim().toLowerCase(),n=r?ku.filter(i=>i.alt.includes(r)||i.tags.some(o=>o.includes(r)||r.includes(o))):ku;return(n.length>0?n:ku).map(i=>({id:i.id,url:nv(i.emoji,i.anim),preview:nv(i.emoji,i.anim),alt:i.alt}))}}const Hs="<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>",Vs="<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>",nv=(t,e)=>{const r=`<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'>${t}${e}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(r)}`},ku=[{id:"g1",emoji:"👍",alt:"thumbs up",tags:["thumbs","yes","ok","great","good"],anim:Hs},{id:"g2",emoji:"🎉",alt:"celebrate",tags:["party","yay","congrats","celebrate"],anim:Vs},{id:"g3",emoji:"👋",alt:"wave hello",tags:["hi","hello","hey","wave","bye"],anim:Vs},{id:"g4",emoji:"❤️",alt:"heart",tags:["love","thanks","heart"],anim:Hs},{id:"g5",emoji:"🤔",alt:"thinking",tags:["hmm","think","thinking"],anim:Vs},{id:"g6",emoji:"😂",alt:"laughing",tags:["lol","funny","haha","laugh"],anim:Hs},{id:"g7",emoji:"🔥",alt:"fire",tags:["fire","hot","lit","awesome"],anim:Hs},{id:"g8",emoji:"🚀",alt:"rocket",tags:["rocket","launch","fast","go"],anim:Vs}],Tu=t=>new Promise(e=>setTimeout(e,t));class mw{constructor(e,r){se(this,"real");se(this,"strings");this.real=e,this.strings=r}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,r,n){await Tu(300);for(const a of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(a),await Tu(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:"ai",conversationEnded:!1,events:[]}}async presence(e){}async typing(){}async action(){return await Tu(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,r,n,a){return""}async uploadAttachment(e,r,n){return{id:`preview-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}}var oa,nt,Cu,av,eo=0,iv=[],ft=Be,ov=ft.__b,sv=ft.__r,lv=ft.diffed,cv=ft.__c,uv=ft.unmount,fv=ft.__;function to(t,e){ft.__h&&ft.__h(nt,t,eo||e),eo=0;var r=nt.__H||(nt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function U(t){return eo=1,yw(hv,t)}function yw(t,e,r){var n=to(oa++,2);if(n.t=t,!n.__c&&(n.__=[hv(void 0,e),function(s){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,s);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=nt,!nt.__f)){var a=function(s,l,c){if(!n.__c.__H)return!0;var u=n.__c.__H.__.filter(function(h){return h.__c});if(u.every(function(h){return!h.__N}))return!i||i.call(this,s,l,c);var f=n.__c.props!==s;return u.some(function(h){if(h.__N){var d=h.__[0];h.__=h.__N,h.__N=void 0,d!==h.__[0]&&(f=!0)}}),i&&i.call(this,s,l,c)||f};nt.__f=!0;var i=nt.shouldComponentUpdate,o=nt.componentWillUpdate;nt.componentWillUpdate=function(s,l,c){if(this.__e){var u=i;i=void 0,a(s,l,c),i=u}o&&o.call(this,s,l,c)},nt.shouldComponentUpdate=a}return n.__N||n.__}function le(t,e){var r=to(oa++,3);!ft.__s&&Du(r.__H,e)&&(r.__=t,r.u=e,nt.__H.__h.push(r))}function Mu(t,e){var r=to(oa++,4);!ft.__s&&Du(r.__H,e)&&(r.__=t,r.u=e,nt.__h.push(r))}function X(t){return eo=5,Ht(function(){return{current:t}},[])}function Ht(t,e){var r=to(oa++,7);return Du(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function Y(t,e){return eo=8,Ht(function(){return t},e)}function _w(t){var e=nt.context[t.__c],r=to(oa++,9);return r.c=t,e?(r.__==null&&(r.__=!0,e.sub(nt)),e.props.value):t.__}function bw(){for(var t;t=iv.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(Us),e.__h.some(Au),e.__h=[]}catch(r){e.__h=[],ft.__e(r,t.__v)}}}ft.__b=function(t){nt=null,ov&&ov(t)},ft.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),fv&&fv(t,e)},ft.__r=function(t){sv&&sv(t),oa=0;var e=(nt=t.__c).__H;e&&(Cu===nt?(e.__h=[],nt.__h=[],e.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.some(Us),e.__h.some(Au),e.__h=[],oa=0)),Cu=nt},ft.diffed=function(t){lv&&lv(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(iv.push(e)!==1&&av===ft.requestAnimationFrame||((av=ft.requestAnimationFrame)||xw)(bw)),e.__H.__.some(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Cu=nt=null},ft.__c=function(t,e){e.some(function(r){try{r.__h.some(Us),r.__h=r.__h.filter(function(n){return!n.__||Au(n)})}catch(n){e.some(function(a){a.__h&&(a.__h=[])}),e=[],ft.__e(n,r.__v)}}),cv&&cv(t,e)},ft.unmount=function(t){uv&&uv(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.some(function(n){try{Us(n)}catch(a){e=a}}),r.__H=void 0,e&&ft.__e(e,r.__v))};var dv=typeof requestAnimationFrame=="function";function xw(t){var e,r=function(){clearTimeout(n),dv&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);dv&&(e=requestAnimationFrame(r))}function Us(t){var e=nt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),nt=e}function Au(t){var e=nt;t.__c=t.__(),nt=e}function Du(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function hv(t,e){return typeof e=="function"?e(t):e}var Iu=function(t,e){return Iu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},Iu(t,e)};function K(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Iu(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Lu=12,ww="sans-serif",sa=Lu+"px "+ww,Sw=20,kw=100,Tw="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function Cw(t){var e={};if(typeof JSON>"u")return e;for(var r=0;r<t.length;r++){var n=String.fromCharCode(r+32),a=(t.charCodeAt(r)-Sw)/kw;e[n]=a}return e}var Mw=Cw(Tw),ri={createCanvas:function(){return typeof document<"u"&&document.createElement("canvas")},measureText:(function(){var t,e;return function(r,n){if(!t){var a=ri.createCanvas();t=a&&a.getContext("2d")}if(t)return e!==n&&(e=t.font=n||sa),t.measureText(r);r=r||"",n=n||sa;var i=/((?:\d+)?\.?\d*)px/.exec(n),o=i&&+i[1]||Lu,s=0;if(n.indexOf("mono")>=0)s=o*r.length;else for(var l=0;l<r.length;l++){var c=Mw[r[l]];s+=c==null?o:c*o}return{width:s}}})(),loadImage:function(t,e,r){var n=new Image;return n.onload=e,n.onerror=r,n.src=t,n}},pv=ni(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],function(t,e){return t["[object "+e+"]"]=!0,t},{}),vv=ni(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],function(t,e){return t["[object "+e+"Array]"]=!0,t},{}),ro=Object.prototype.toString,Gs=Array.prototype,Aw=Gs.forEach,Dw=Gs.filter,Pu=Gs.slice,Iw=Gs.map,gv=function(){}.constructor,$s=gv?gv.prototype:null,Ru="__proto__",Lw=2311;function mv(){return Lw++}function Eu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];typeof console<"u"&&console.error.apply(console,t)}function Ie(t){if(t==null||typeof t!="object")return t;var e=t,r=ro.call(t);if(r==="[object Array]"){if(!io(t)){e=[];for(var n=0,a=t.length;n<a;n++)e[n]=Ie(t[n])}}else if(vv[r]){if(!io(t)){var i=t.constructor;if(i.from)e=i.from(t);else{e=new i(t.length);for(var n=0,a=t.length;n<a;n++)e[n]=t[n]}}}else if(!pv[r]&&!io(t)&&!no(t)){e={};for(var o in t)t.hasOwnProperty(o)&&o!==Ru&&(e[o]=Ie(t[o]))}return e}function Oe(t,e,r){if(!de(e)||!de(t))return r?Ie(e):t;for(var n in e)if(e.hasOwnProperty(n)&&n!==Ru){var a=t[n],i=e[n];de(i)&&de(a)&&!ee(i)&&!ee(a)&&!no(i)&&!no(a)&&!yv(i)&&!yv(a)&&!io(i)&&!io(a)?Oe(a,i,r):(r||!(n in t))&&(t[n]=Ie(e[n]))}return t}function q(t,e){if(Object.assign)Object.assign(t,e);else for(var r in e)e.hasOwnProperty(r)&&r!==Ru&&(t[r]=e[r]);return t}function He(t,e,r){for(var n=at(e),a=0,i=n.length;a<i;a++){var o=n[a];t[o]==null&&(t[o]=e[o])}return t}function Ue(t,e){if(t){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r}return-1}function Pw(t,e){var r=t.prototype;function n(){}n.prototype=e.prototype,t.prototype=new n;for(var a in r)r.hasOwnProperty(a)&&(t.prototype[a]=r[a]);t.prototype.constructor=t,t.superClass=e}function Ur(t,e,r){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var n=Object.getOwnPropertyNames(e),a=0;a<n.length;a++){var i=n[a];i!=="constructor"&&t[i]==null&&(t[i]=e[i])}else He(t,e)}function Vt(t){return!t||typeof t=="string"?!1:typeof t.length=="number"}function I(t,e,r){if(t&&e)if(t.forEach&&t.forEach===Aw)t.forEach(e,r);else if(t.length===+t.length)for(var n=0,a=t.length;n<a;n++)e.call(r,t[n],n,t);else for(var i in t)t.hasOwnProperty(i)&&e.call(r,t[i],i,t)}function he(t,e,r){if(!t)return[];if(!e)return Nu(t);if(t.map&&t.map===Iw)return t.map(e,r);for(var n=[],a=0,i=t.length;a<i;a++)n.push(e.call(r,t[a],a,t));return n}function ni(t,e,r,n){if(t&&e){for(var a=0,i=t.length;a<i;a++)r=e.call(n,r,t[a],a,t);return r}}function bt(t,e,r){if(!t)return[];if(!e)return Nu(t);if(t.filter&&t.filter===Dw)return t.filter(e,r);for(var n=[],a=0,i=t.length;a<i;a++)e.call(r,t[a],a,t)&&n.push(t[a]);return n}function at(t){if(!t)return[];if(Object.keys)return Object.keys(t);var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(r);return e}function Rw(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return function(){return t.apply(e,r.concat(Pu.call(arguments)))}}var Ne=$s&&ke($s.bind)?$s.call.bind($s.bind):Rw;function dt(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function(){return t.apply(this,e.concat(Pu.call(arguments)))}}function ee(t){return Array.isArray?Array.isArray(t):ro.call(t)==="[object Array]"}function ke(t){return typeof t=="function"}function ae(t){return typeof t=="string"}function Ou(t){return ro.call(t)==="[object String]"}function et(t){return typeof t=="number"}function de(t){var e=typeof t;return e==="function"||!!t&&e==="object"}function yv(t){return!!pv[ro.call(t)]}function Ut(t){return!!vv[ro.call(t)]}function no(t){return typeof t=="object"&&typeof t.nodeType=="number"&&typeof t.ownerDocument=="object"}function Ws(t){return t.colorStops!=null}function Ew(t){return t.image!=null}function qs(t){return t!==t}function ao(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=0,n=t.length;r<n;r++)if(t[r]!=null)return t[r]}function Pe(t,e){return t??e}function Ys(t,e,r){return t??e??r}function Nu(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Pu.apply(t,e)}function _v(t){if(typeof t=="number")return[t,t,t,t];var e=t.length;return e===2?[t[0],t[1],t[0],t[1]]:e===3?[t[0],t[1],t[2],t[1]]:t}function dn(t,e){if(!t)throw new Error(e)}function Gr(t){return t==null?null:typeof t.trim=="function"?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}var bv="__ec_primitive__";function Bu(t){t[bv]=!0}function io(t){return t[bv]}var Ow=(function(){function t(){this.data={}}return t.prototype.delete=function(e){var r=this.has(e);return r&&delete this.data[e],r},t.prototype.has=function(e){return this.data.hasOwnProperty(e)},t.prototype.get=function(e){return this.data[e]},t.prototype.set=function(e,r){return this.data[e]=r,this},t.prototype.keys=function(){return at(this.data)},t.prototype.forEach=function(e){var r=this.data;for(var n in r)r.hasOwnProperty(n)&&e(r[n],n)},t})(),xv=typeof Map=="function";function Nw(){return xv?new Map:new Ow}var Bw=(function(){function t(e){var r=ee(e);this.data=Nw();var n=this;e instanceof t?e.each(a):e&&I(e,a);function a(i,o){r?n.set(i,o):n.set(o,i)}}return t.prototype.hasKey=function(e){return this.data.has(e)},t.prototype.get=function(e){return this.data.get(e)},t.prototype.set=function(e,r){return this.data.set(e,r),r},t.prototype.each=function(e,r){this.data.forEach(function(n,a){e.call(r,n,a)})},t.prototype.keys=function(){var e=this.data.keys();return xv?Array.from(e):e},t.prototype.removeKey=function(e){this.data.delete(e)},t})();function me(t){return new Bw(t)}function zw(t,e){for(var r=new t.constructor(t.length+e.length),n=0;n<t.length;n++)r[n]=t[n];for(var a=t.length,n=0;n<e.length;n++)r[n+a]=e[n];return r}function Xs(t,e){var r;if(Object.create)r=Object.create(t);else{var n=function(){};n.prototype=t,r=new n}return e&&q(r,e),r}function wv(t){var e=t.style;e.webkitUserSelect="none",e.userSelect="none",e.webkitTapHighlightColor="rgba(0,0,0,0)",e["-webkit-touch-callout"]="none"}function la(t,e){return t.hasOwnProperty(e)}function Et(){}var Fw=180/Math.PI,Hw=(function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t})(),Vw=(function(){function t(){this.browser=new Hw,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 t})(),_e=new Vw;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(_e.wxa=!0,_e.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?_e.worker=!0:!_e.hasGlobalWindow||"Deno"in window?(_e.node=!0,_e.svgSupported=!0):Uw(navigator.userAgent,_e);function Uw(t,e){var r=e.browser,n=t.match(/Firefox\/([\d.]+)/),a=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),i=t.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(t);n&&(r.firefox=!0,r.version=n[1]),a&&(r.ie=!0,r.version=a[1]),i&&(r.edge=!0,r.version=i[1],r.newEdge=+i[1].split(".")[0]>18),o&&(r.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!r.ie&&!r.edge,e.pointerEventsSupported="onpointerdown"in window&&(r.edge||r.ie&&+r.version>=11),e.domSupported=typeof document<"u";var s=document.documentElement.style;e.transform3dSupported=(r.ie&&"transition"in s||r.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||r.ie&&+r.version>=9}var Gw=".",ca="___EC__COMPONENT__CONTAINER___",Sv="___EC__EXTENDED_CLASS___";function $r(t){var e={main:"",sub:""};if(t){var r=t.split(Gw);e.main=r[0]||"",e.sub=r[1]||""}return e}function $w(t){dn(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(t),'componentType "'+t+'" illegal')}function Ww(t){return!!(t&&t[Sv])}function zu(t,e){t.$constructor=t,t.extend=function(r){var n=this,a;return qw(n)?a=(function(i){K(o,i);function o(){return i.apply(this,arguments)||this}return o})(n):(a=function(){(r.$constructor||n).apply(this,arguments)},Pw(a,this)),q(a.prototype,r),a[Sv]=!0,a.extend=this.extend,a.superCall=Zw,a.superApply=Kw,a.superClass=n,a}}function qw(t){return ke(t)&&/^class\s/.test(Function.prototype.toString.call(t))}function kv(t,e){t.extend=e.extend}var Yw=Math.round(Math.random()*10);function Xw(t){var e=["__\0is_clz",Yw++].join("_");t.prototype[e]=!0,t.isInstance=function(r){return!!(r&&r[e])}}function Zw(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return this.superClass.prototype[e].apply(t,r)}function Kw(t,e,r){return this.superClass.prototype[e].apply(t,r)}function Zs(t){var e={};t.registerClass=function(n){var a=n.type||n.prototype.type;if(a){$w(a),n.prototype.type=a;var i=$r(a);if(!i.sub)e[i.main]=n;else if(i.sub!==ca){var o=r(i);o[i.sub]=n}}return n},t.getClass=function(n,a,i){var o=e[n];if(o&&o[ca]&&(o=a?o[a]:null),i&&!o)throw new Error(a?"Component "+n+"."+(a||"")+" is used but not imported.":n+".type should be specified.");return o},t.getClassesByMainType=function(n){var a=$r(n),i=[],o=e[a.main];return o&&o[ca]?I(o,function(s,l){l!==ca&&i.push(s)}):i.push(o),i},t.hasClass=function(n){var a=$r(n);return!!e[a.main]},t.getAllClassMainTypes=function(){var n=[];return I(e,function(a,i){n.push(i)}),n},t.hasSubTypes=function(n){var a=$r(n),i=e[a.main];return i&&i[ca]};function r(n){var a=e[n.main];return(!a||!a[ca])&&(a=e[n.main]={},a[ca]=!0),a}}function oo(t,e){for(var r=0;r<t.length;r++)t[r][1]||(t[r][1]=t[r][0]);return e=e||!1,function(n,a,i){for(var o={},s=0;s<t.length;s++){var l=t[s][1];if(!(a&&Ue(a,l)>=0||i&&Ue(i,l)<0)){var c=n.getShallow(l,e);c!=null&&(o[t[s][0]]=c)}}return o}}var jw=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],Jw=oo(jw),Qw=(function(){function t(){}return t.prototype.getAreaStyle=function(e,r){return Jw(this,e,r)},t})(),Tv=(function(){function t(e){this.value=e}return t})(),eS=(function(){function t(){this._len=0}return t.prototype.insert=function(e){var r=new Tv(e);return this.insertEntry(r),r},t.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++},t.prototype.remove=function(e){var r=e.prev,n=e.next;r?r.next=n:this.head=n,n?n.prev=r:this.tail=r,e.next=e.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t})(),so=(function(){function t(e){this._list=new eS,this._maxSize=10,this._map={},this._maxSize=e}return t.prototype.put=function(e,r){var n=this._list,a=this._map,i=null;if(a[e]==null){var o=n.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=n.head;n.remove(l),delete a[l.key],i=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new Tv(r),s.key=e,n.insertEntry(s),a[e]=s}return i},t.prototype.get=function(e){var r=this._map[e],n=this._list;if(r!=null)return r!==n.tail&&(n.remove(r),n.insertEntry(r)),r.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t})(),Fu=new so(50);function tS(t){if(typeof t=="string"){var e=Fu.get(t);return e&&e.image}else return t}function Cv(t,e,r,n,a){if(t)if(typeof t=="string"){if(e&&e.__zrImageSrc===t||!r)return e;var i=Fu.get(t),o={hostEl:r,cb:n,cbPayload:a};return i?(e=i.image,!Ks(e)&&i.pending.push(o)):(e=ri.loadImage(t,Mv,Mv),e.__zrImageSrc=t,Fu.put(t,e.__cachedImgObj={image:e,pending:[o]})),e}else return t;else return e}function Mv(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e<t.pending.length;e++){var r=t.pending[e],n=r.cb;n&&n(this,r.cbPayload),r.hostEl.dirty()}t.pending.length=0}function Ks(t){return t&&t.width&&t.height}function ai(){return[1,0,0,1,0,0]}function Hu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function rS(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function ii(t,e,r){var n=e[0]*r[0]+e[2]*r[1],a=e[1]*r[0]+e[3]*r[1],i=e[0]*r[2]+e[2]*r[3],o=e[1]*r[2]+e[3]*r[3],s=e[0]*r[4]+e[2]*r[5]+e[4],l=e[1]*r[4]+e[3]*r[5]+e[5];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=s,t[5]=l,t}function Vu(t,e,r){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+r[0],t[5]=e[5]+r[1],t}function Uu(t,e,r,n){n===void 0&&(n=[0,0]);var a=e[0],i=e[2],o=e[4],s=e[1],l=e[3],c=e[5],u=Math.sin(r),f=Math.cos(r);return t[0]=a*f+s*u,t[1]=-a*u+s*f,t[2]=i*f+l*u,t[3]=-i*u+f*l,t[4]=f*(o-n[0])+u*(c-n[1])+n[0],t[5]=f*(c-n[1])-u*(o-n[0])+n[1],t}function nS(t,e,r){var n=r[0],a=r[1];return t[0]=e[0]*n,t[1]=e[1]*a,t[2]=e[2]*n,t[3]=e[3]*a,t[4]=e[4]*n,t[5]=e[5]*a,t}function Gu(t,e){var r=e[0],n=e[2],a=e[4],i=e[1],o=e[3],s=e[5],l=r*o-i*n;return l?(l=1/l,t[0]=o*l,t[1]=-i*l,t[2]=-n*l,t[3]=r*l,t[4]=(n*s-o*a)*l,t[5]=(i*a-r*s)*l,t):null}var Je=(function(){function t(e,r){this.x=e||0,this.y=r||0}return t.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(e,r){return this.x=e,this.y=r,this},t.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},t.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},t.prototype.scale=function(e){this.x*=e,this.y*=e},t.prototype.scaleAndAdd=function(e,r){this.x+=e.x*r,this.y+=e.y*r},t.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},t.prototype.dot=function(e){return this.x*e.x+this.y*e.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},t.prototype.distance=function(e){var r=this.x-e.x,n=this.y-e.y;return Math.sqrt(r*r+n*n)},t.prototype.distanceSquare=function(e){var r=this.x-e.x,n=this.y-e.y;return r*r+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(e){if(e){var r=this.x,n=this.y;return this.x=e[0]*r+e[2]*n+e[4],this.y=e[1]*r+e[3]*n+e[5],this}},t.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},t.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},t.set=function(e,r,n){e.x=r,e.y=n},t.copy=function(e,r){e.x=r.x,e.y=r.y},t.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},t.lenSquare=function(e){return e.x*e.x+e.y*e.y},t.dot=function(e,r){return e.x*r.x+e.y*r.y},t.add=function(e,r,n){e.x=r.x+n.x,e.y=r.y+n.y},t.sub=function(e,r,n){e.x=r.x-n.x,e.y=r.y-n.y},t.scale=function(e,r,n){e.x=r.x*n,e.y=r.y*n},t.scaleAndAdd=function(e,r,n,a){e.x=r.x+n.x*a,e.y=r.y+n.y*a},t.lerp=function(e,r,n,a){var i=1-a;e.x=i*r.x+a*n.x,e.y=i*r.y+a*n.y},t})(),js=Math.min,Js=Math.max,ua=new Je,fa=new Je,da=new Je,ha=new Je,lo=new Je,co=new Je,Ge=(function(){function t(e,r,n,a){n<0&&(e=e+n,n=-n),a<0&&(r=r+a,a=-a),this.x=e,this.y=r,this.width=n,this.height=a}return t.prototype.union=function(e){var r=js(e.x,this.x),n=js(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Js(e.x+e.width,this.x+this.width)-r:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Js(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=r,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(e){var r=this,n=e.width/r.width,a=e.height/r.height,i=ai();return Vu(i,i,[-r.x,-r.y]),nS(i,i,[n,a]),Vu(i,i,[e.x,e.y]),i},t.prototype.intersect=function(e,r){if(!e)return!1;e instanceof t||(e=t.create(e));var n=this,a=n.x,i=n.x+n.width,o=n.y,s=n.y+n.height,l=e.x,c=e.x+e.width,u=e.y,f=e.y+e.height,h=!(i<l||c<a||s<u||f<o);if(r){var d=1/0,p=0,m=Math.abs(i-l),g=Math.abs(c-a),v=Math.abs(s-u),y=Math.abs(f-o),b=Math.min(m,g),x=Math.min(v,y);i<l||c<a?b>p&&(p=b,m<g?Je.set(co,-m,0):Je.set(co,g,0)):b<d&&(d=b,m<g?Je.set(lo,m,0):Je.set(lo,-g,0)),s<u||f<o?x>p&&(p=x,v<y?Je.set(co,0,-v):Je.set(co,0,y)):b<d&&(d=b,v<y?Je.set(lo,0,v):Je.set(lo,0,-y))}return r&&Je.copy(r,h?lo:co),h},t.prototype.contain=function(e,r){var n=this;return e>=n.x&&e<=n.x+n.width&&r>=n.y&&r<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return this.width===0||this.height===0},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(e,r){e.x=r.x,e.y=r.y,e.width=r.width,e.height=r.height},t.applyTransform=function(e,r,n){if(!n){e!==r&&t.copy(e,r);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var a=n[0],i=n[3],o=n[4],s=n[5];e.x=r.x*a+o,e.y=r.y*i+s,e.width=r.width*a,e.height=r.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}ua.x=da.x=r.x,ua.y=ha.y=r.y,fa.x=ha.x=r.x+r.width,fa.y=da.y=r.y+r.height,ua.transform(n),ha.transform(n),fa.transform(n),da.transform(n),e.x=js(ua.x,fa.x,da.x,ha.x),e.y=js(ua.y,fa.y,da.y,ha.y);var l=Js(ua.x,fa.x,da.x,ha.x),c=Js(ua.y,fa.y,da.y,ha.y);e.width=l-e.x,e.height=c-e.y},t})(),Av={};function ar(t,e){e=e||sa;var r=Av[e];r||(r=Av[e]=new so(500));var n=r.get(t);return n==null&&(n=ri.measureText(t,e).width,r.put(t,n)),n}function Dv(t,e,r,n){var a=ar(t,e),i=Wu(e),o=uo(0,a,r),s=oi(0,i,n),l=new Ge(o,s,a,i);return l}function $u(t,e,r,n){var a=((t||"")+"").split(`
|
|
6
|
-
`),
|
|
7
|
-
`)
|
|
8
|
-
`),t.isTruncated=s}function Iv(t,e,r,n){n=n||{};var a=q({},n);a.font=e,r=Pe(r,"..."),a.maxIterations=Pe(n.maxIterations,2);var i=a.minChar=Pe(n.minChar,0);a.cnCharWidth=ar("国",e);var o=a.ascCharWidth=ar("a",e);a.placeholder=Pe(n.placeholder,"");for(var s=t=Math.max(0,t-1),l=0;l<i&&s>=o;l++)s-=o;var c=ar(r,e);return c>s&&(r="",c=0),s=t-c,a.ellipsis=r,a.ellipsisWidth=c,a.contentWidth=s,a.containerWidth=t,a}function Lv(t,e,r){var n=r.containerWidth,a=r.font,i=r.contentWidth;if(!n){t.textLine="",t.isTruncated=!1;return}var o=ar(e,a);if(o<=n){t.textLine=e,t.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=r.maxIterations){e+=r.ellipsis;break}var l=s===0?iS(e,i,r.ascCharWidth,r.cnCharWidth):o>0?Math.floor(e.length*i/o):0;e=e.substr(0,l),o=ar(e,a)}e===""&&(e=r.placeholder),t.textLine=e,t.isTruncated=!0}function iS(t,e,r,n){for(var a=0,i=0,o=t.length;i<o&&a<e;i++){var s=t.charCodeAt(i);a+=0<=s&&s<=127?r:n}return i}function oS(t,e){t!=null&&(t+="");var r=e.overflow,n=e.padding,a=e.font,i=r==="truncate",o=Wu(a),s=Pe(e.lineHeight,o),l=!!e.backgroundColor,c=e.lineOverflow==="truncate",u=!1,f=e.width,h;f!=null&&(r==="break"||r==="breakAll")?h=t?Rv(t,e.font,f,r==="breakAll",0).lines:[]:h=t?t.split(`
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
`){l&&(s+=l,u+=c),i.push(s),o.push(u),s="",l="",c=0,u=0;continue}var d=ar(h,e),p=n?!1:!dS(h);if(i.length?u+d>r:a+u+d>r){u?(s||l)&&(p?(s||(s=l,l="",c=0,u=c),i.push(s),o.push(u-c),l+=h,c+=d,s="",u=c):(l&&(s+=l,l="",c=0),i.push(s),o.push(u),s=h,u=d)):p?(i.push(l),o.push(c),l=h,c=d):(i.push(h),o.push(d));continue}u+=d,p?(l+=h,c+=d):(l&&(s+=l,l="",c=0),s+=h)}return!i.length&&!s&&(s=t,l="",c=0),l&&(s+=l),s&&(i.push(s),o.push(u)),i.length===1&&(u+=a),{accumWidth:u,lines:i,linesWidths:o}}function si(t,e){return t==null&&(t=0),e==null&&(e=0),[t,e]}function hS(t){return[t[0],t[1]]}function Ev(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function pS(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function vS(t){return Math.sqrt(gS(t))}function gS(t){return t[0]*t[0]+t[1]*t[1]}function Xu(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function mS(t,e){var r=vS(e);return r===0?(t[0]=0,t[1]=0):(t[0]=e[0]/r,t[1]=e[1]/r),t}function Zu(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var yS=Zu;function _S(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}var li=_S;function dr(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[2]*a+r[4],t[1]=r[1]*n+r[3]*a+r[5],t}function ci(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function ui(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}var Ov=Hu,Nv=5e-5;function pa(t){return t>Nv||t<-Nv}var va=[],fi=[],Ku=ai(),ju=Math.abs,Ju=(function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},t.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},t.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},t.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},t.prototype.needLocalTransform=function(){return pa(this.rotation)||pa(this.x)||pa(this.y)||pa(this.scaleX-1)||pa(this.scaleY-1)||pa(this.skewX)||pa(this.skewY)},t.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,r=this.needLocalTransform(),n=this.transform;if(!(r||e)){n&&(Ov(n),this.invTransform=null);return}n=n||ai(),r?this.getLocalTransform(n):Ov(n),e&&(r?ii(n,e,n):rS(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n)},t.prototype._resolveGlobalScaleRatio=function(e){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(va);var n=va[0]<0?-1:1,a=va[1]<0?-1:1,i=((va[0]-n)*r+n)/va[0]||0,o=((va[1]-a)*r+a)/va[1]||0;e[0]*=i,e[1]*=i,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||ai(),Gu(this.invTransform,e)},t.prototype.getComputedTransform=function(){for(var e=this,r=[];e;)r.push(e),e=e.parent;for(;e=r.pop();)e.updateTransform();return this.transform},t.prototype.setLocalTransform=function(e){if(e){var r=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],a=Math.atan2(e[1],e[0]),i=Math.PI/2+a-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(i),r=Math.sqrt(r),this.skewX=i,this.skewY=0,this.rotation=-a,this.x=+e[4],this.y=+e[5],this.scaleX=r,this.scaleY=n,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,r=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||ai(),ii(fi,e.invTransform,r),r=fi);var n=this.originX,a=this.originY;(n||a)&&(Ku[4]=n,Ku[5]=a,ii(fi,r,Ku),fi[4]-=n,fi[5]-=a,r=fi),this.setLocalTransform(r)}},t.prototype.getGlobalScale=function(e){var r=this.transform;return e=e||[],r?(e[0]=Math.sqrt(r[0]*r[0]+r[1]*r[1]),e[1]=Math.sqrt(r[2]*r[2]+r[3]*r[3]),r[0]<0&&(e[0]=-e[0]),r[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},t.prototype.transformCoordToLocal=function(e,r){var n=[e,r],a=this.invTransform;return a&&dr(n,n,a),n},t.prototype.transformCoordToGlobal=function(e,r){var n=[e,r],a=this.transform;return a&&dr(n,n,a),n},t.prototype.getLineScale=function(){var e=this.transform;return e&&ju(e[0]-1)>1e-10&&ju(e[3]-1)>1e-10?Math.sqrt(ju(e[0]*e[3]-e[2]*e[1])):1},t.prototype.copyTransform=function(e){bS(this,e)},t.getLocalTransform=function(e,r){r=r||[];var n=e.originX||0,a=e.originY||0,i=e.scaleX,o=e.scaleY,s=e.anchorX,l=e.anchorY,c=e.rotation||0,u=e.x,f=e.y,h=e.skewX?Math.tan(e.skewX):0,d=e.skewY?Math.tan(-e.skewY):0;if(n||a||s||l){var p=n+s,m=a+l;r[4]=-p*i-h*m*o,r[5]=-m*o-d*p*i}else r[4]=r[5]=0;return r[0]=i,r[3]=o,r[1]=d*i,r[2]=h*o,c&&Uu(r,r,c),r[4]+=n+u,r[5]+=a+f,r},t.initDefaultProps=(function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0})(),t})(),fo=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function bS(t,e){for(var r=0;r<fo.length;r++){var n=fo[r];t[n]=e[n]}}var ho={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return .5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return t===0?0:Math.pow(1024,t-1)},exponentialOut:function(t){return t===1?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,r=.1,n=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=n/4):e=n*Math.asin(1/r)/(2*Math.PI),-(r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)))},elasticOut:function(t){var e,r=.1,n=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=n/4):e=n*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},elasticInOut:function(t){var e,r=.1,n=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=n/4):e=n*Math.asin(1/r)/(2*Math.PI),(t*=2)<1?-.5*(r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)):r*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-ho.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?ho.bounceIn(t*2)*.5:ho.bounceOut(t*2-1)*.5+.5}},el=Math.pow,Rn=Math.sqrt,tl=1e-8,Bv=1e-4,zv=Rn(3),rl=1/3,Wr=si(),hr=si(),di=si();function En(t){return t>-tl&&t<tl}function Fv(t){return t>tl||t<-tl}function wt(t,e,r,n,a){var i=1-a;return i*i*(i*t+3*a*e)+a*a*(a*n+3*i*r)}function Hv(t,e,r,n,a){var i=1-a;return 3*(((e-t)*i+2*(r-e)*a)*i+(n-r)*a*a)}function nl(t,e,r,n,a,i){var o=n+3*(e-r)-t,s=3*(r-e*2+t),l=3*(e-t),c=t-a,u=s*s-3*o*l,f=s*l-9*o*c,h=l*l-3*s*c,d=0;if(En(u)&&En(f))if(En(s))i[0]=0;else{var p=-l/s;p>=0&&p<=1&&(i[d++]=p)}else{var m=f*f-4*u*h;if(En(m)){var g=f/u,p=-s/o+g,v=-g/2;p>=0&&p<=1&&(i[d++]=p),v>=0&&v<=1&&(i[d++]=v)}else if(m>0){var y=Rn(m),b=u*s+1.5*o*(-f+y),x=u*s+1.5*o*(-f-y);b<0?b=-el(-b,rl):b=el(b,rl),x<0?x=-el(-x,rl):x=el(x,rl);var p=(-s-(b+x))/(3*o);p>=0&&p<=1&&(i[d++]=p)}else{var w=(2*u*s-3*o*f)/(2*Rn(u*u*u)),S=Math.acos(w)/3,k=Rn(u),C=Math.cos(S),p=(-s-2*k*C)/(3*o),v=(-s+k*(C+zv*Math.sin(S)))/(3*o),A=(-s+k*(C-zv*Math.sin(S)))/(3*o);p>=0&&p<=1&&(i[d++]=p),v>=0&&v<=1&&(i[d++]=v),A>=0&&A<=1&&(i[d++]=A)}}return d}function Vv(t,e,r,n,a){var i=6*r-12*e+6*t,o=9*e+3*n-3*t-9*r,s=3*e-3*t,l=0;if(En(o)){if(Fv(i)){var c=-s/i;c>=0&&c<=1&&(a[l++]=c)}}else{var u=i*i-4*o*s;if(En(u))a[0]=-i/(2*o);else if(u>0){var f=Rn(u),c=(-i+f)/(2*o),h=(-i-f)/(2*o);c>=0&&c<=1&&(a[l++]=c),h>=0&&h<=1&&(a[l++]=h)}}return l}function al(t,e,r,n,a,i){var o=(e-t)*a+t,s=(r-e)*a+e,l=(n-r)*a+r,c=(s-o)*a+o,u=(l-s)*a+s,f=(u-c)*a+c;i[0]=t,i[1]=o,i[2]=c,i[3]=f,i[4]=f,i[5]=u,i[6]=l,i[7]=n}function xS(t,e,r,n,a,i,o,s,l,c,u){var f,h=.005,d=1/0,p,m,g,v;Wr[0]=l,Wr[1]=c;for(var y=0;y<1;y+=.05)hr[0]=wt(t,r,a,o,y),hr[1]=wt(e,n,i,s,y),g=li(Wr,hr),g<d&&(f=y,d=g);d=1/0;for(var b=0;b<32&&!(h<Bv);b++)p=f-h,m=f+h,hr[0]=wt(t,r,a,o,p),hr[1]=wt(e,n,i,s,p),g=li(hr,Wr),p>=0&&g<d?(f=p,d=g):(di[0]=wt(t,r,a,o,m),di[1]=wt(e,n,i,s,m),v=li(di,Wr),m<=1&&v<d?(f=m,d=v):h*=.5);return Rn(d)}function wS(t,e,r,n,a,i,o,s,l){for(var c=t,u=e,f=0,h=1/l,d=1;d<=l;d++){var p=d*h,m=wt(t,r,a,o,p),g=wt(e,n,i,s,p),v=m-c,y=g-u;f+=Math.sqrt(v*v+y*y),c=m,u=g}return f}function Gt(t,e,r,n){var a=1-n;return a*(a*t+2*n*e)+n*n*r}function Uv(t,e,r,n){return 2*((1-n)*(e-t)+n*(r-e))}function SS(t,e,r,n,a){var i=t-2*e+r,o=2*(e-t),s=t-n,l=0;if(En(i)){if(Fv(o)){var c=-s/o;c>=0&&c<=1&&(a[l++]=c)}}else{var u=o*o-4*i*s;if(En(u)){var c=-o/(2*i);c>=0&&c<=1&&(a[l++]=c)}else if(u>0){var f=Rn(u),c=(-o+f)/(2*i),h=(-o-f)/(2*i);c>=0&&c<=1&&(a[l++]=c),h>=0&&h<=1&&(a[l++]=h)}}return l}function Gv(t,e,r){var n=t+r-2*e;return n===0?.5:(t-e)/n}function il(t,e,r,n,a){var i=(e-t)*n+t,o=(r-e)*n+e,s=(o-i)*n+i;a[0]=t,a[1]=i,a[2]=s,a[3]=s,a[4]=o,a[5]=r}function kS(t,e,r,n,a,i,o,s,l){var c,u=.005,f=1/0;Wr[0]=o,Wr[1]=s;for(var h=0;h<1;h+=.05){hr[0]=Gt(t,r,a,h),hr[1]=Gt(e,n,i,h);var d=li(Wr,hr);d<f&&(c=h,f=d)}f=1/0;for(var p=0;p<32&&!(u<Bv);p++){var m=c-u,g=c+u;hr[0]=Gt(t,r,a,m),hr[1]=Gt(e,n,i,m);var d=li(hr,Wr);if(m>=0&&d<f)c=m,f=d;else{di[0]=Gt(t,r,a,g),di[1]=Gt(e,n,i,g);var v=li(di,Wr);g<=1&&v<f?(c=g,f=v):u*=.5}}return Rn(f)}function TS(t,e,r,n,a,i,o){for(var s=t,l=e,c=0,u=1/o,f=1;f<=o;f++){var h=f*u,d=Gt(t,r,a,h),p=Gt(e,n,i,h),m=d-s,g=p-l;c+=Math.sqrt(m*m+g*g),s=d,l=p}return c}var CS=/cubic-bezier\(([0-9,\.e ]+)\)/;function $v(t){var e=t&&CS.exec(t);if(e){var r=e[1].split(","),n=+Gr(r[0]),a=+Gr(r[1]),i=+Gr(r[2]),o=+Gr(r[3]);if(isNaN(n+a+i+o))return;var s=[];return function(l){return l<=0?0:l>=1?1:nl(0,n,i,1,l,s)&&wt(0,a,o,1,s[0])}}}var MS=(function(){function t(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Et,this.ondestroy=e.ondestroy||Et,this.onrestart=e.onrestart||Et,e.easing&&this.setEasing(e.easing)}return t.prototype.step=function(e,r){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=r;return}var n=this._life,a=e-this._startTime-this._pausedTime,i=a/n;i<0&&(i=0),i=Math.min(i,1);var o=this.easingFunc,s=o?o(i):i;if(this.onframe(s),i===1)if(this.loop){var l=a%n;this._startTime=e-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(e){this.easing=e,this.easingFunc=ke(e)?e:ho[e]||$v(e)},t})(),Wv={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function On(t){return t=Math.round(t),t<0?0:t>255?255:t}function Qu(t){return t<0?0:t>1?1:t}function ef(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?On(parseFloat(e)/100*255):On(parseInt(e,10))}function po(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?Qu(parseFloat(e)/100):Qu(parseFloat(e))}function tf(t,e,r){return r<0?r+=1:r>1&&(r-=1),r*6<1?t+(e-t)*r*6:r*2<1?e:r*3<2?t+(e-t)*(.6666666666666666-r)*6:t}function ol(t,e,r){return t+(e-t)*r}function pr(t,e,r,n,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t}function rf(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var qv=new so(20),sl=null;function hi(t,e){sl&&rf(sl,e),sl=qv.put(t,sl||e.slice())}function hn(t,e){if(t){e=e||[];var r=qv.get(t);if(r)return rf(e,r);t=t+"";var n=t.replace(/ /g,"").toLowerCase();if(n in Wv)return rf(e,Wv[n]),hi(t,e),e;var a=n.length;if(n.charAt(0)==="#"){if(a===4||a===5){var i=parseInt(n.slice(1,4),16);if(!(i>=0&&i<=4095)){pr(e,0,0,0,1);return}return pr(e,(i&3840)>>4|(i&3840)>>8,i&240|(i&240)>>4,i&15|(i&15)<<4,a===5?parseInt(n.slice(4),16)/15:1),hi(t,e),e}else if(a===7||a===9){var i=parseInt(n.slice(1,7),16);if(!(i>=0&&i<=16777215)){pr(e,0,0,0,1);return}return pr(e,(i&16711680)>>16,(i&65280)>>8,i&255,a===9?parseInt(n.slice(7),16)/255:1),hi(t,e),e}return}var o=n.indexOf("("),s=n.indexOf(")");if(o!==-1&&s+1===a){var l=n.substr(0,o),c=n.substr(o+1,s-(o+1)).split(","),u=1;switch(l){case"rgba":if(c.length!==4)return c.length===3?pr(e,+c[0],+c[1],+c[2],1):pr(e,0,0,0,1);u=po(c.pop());case"rgb":if(c.length>=3)return pr(e,ef(c[0]),ef(c[1]),ef(c[2]),c.length===3?u:po(c[3])),hi(t,e),e;pr(e,0,0,0,1);return;case"hsla":if(c.length!==4){pr(e,0,0,0,1);return}return c[3]=po(c[3]),Yv(c,e),hi(t,e),e;case"hsl":if(c.length!==3){pr(e,0,0,0,1);return}return Yv(c,e),hi(t,e),e;default:return}}pr(e,0,0,0,1)}}function Yv(t,e){var r=(parseFloat(t[0])%360+360)%360/360,n=po(t[1]),a=po(t[2]),i=a<=.5?a*(n+1):a+n-a*n,o=a*2-i;return e=e||[],pr(e,On(tf(o,i,r+.3333333333333333)*255),On(tf(o,i,r)*255),On(tf(o,i,r-.3333333333333333)*255),1),t.length===4&&(e[3]=t[3]),e}function Xv(t,e){var r=hn(t);if(r){for(var n=0;n<3;n++)r[n]=r[n]*(1-e)|0,r[n]>255?r[n]=255:r[n]<0&&(r[n]=0);return ll(r,r.length===4?"rgba":"rgb")}}function AS(t,e,r){if(!(!(e&&e.length)||!(t>=0&&t<=1))){var n=t*(e.length-1),a=Math.floor(n),i=Math.ceil(n),o=hn(e[a]),s=hn(e[i]),l=n-a,c=ll([On(ol(o[0],s[0],l)),On(ol(o[1],s[1],l)),On(ol(o[2],s[2],l)),Qu(ol(o[3],s[3],l))],"rgba");return r?{color:c,leftIndex:a,rightIndex:i,value:n}:c}}function ll(t,e){if(!(!t||!t.length)){var r=t[0]+","+t[1]+","+t[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(r+=","+t[3]),e+"("+r+")"}}function cl(t,e){var r=hn(t);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*e:0}var Zv=new so(100);function Kv(t){if(ae(t)){var e=Zv.get(t);return e||(e=Xv(t,-.1),Zv.put(t,e)),e}else if(Ws(t)){var r=q({},t);return r.colorStops=he(t.colorStops,function(n){return{offset:n.offset,color:Xv(n.color,-.1)}}),r}return t}function DS(t){return t.type==="linear"}function IS(t){return t.type==="radial"}(function(){return _e.hasGlobalWindow&&ke(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:typeof Buffer<"u"?function(t){return Buffer.from(t).toString("base64")}:function(t){return null}})();var nf=Array.prototype.slice;function pn(t,e,r){return(e-t)*r+t}function af(t,e,r,n){for(var a=e.length,i=0;i<a;i++)t[i]=pn(e[i],r[i],n);return t}function LS(t,e,r,n){for(var a=e.length,i=a&&e[0].length,o=0;o<a;o++){t[o]||(t[o]=[]);for(var s=0;s<i;s++)t[o][s]=pn(e[o][s],r[o][s],n)}return t}function ul(t,e,r,n){for(var a=e.length,i=0;i<a;i++)t[i]=e[i]+r[i]*n;return t}function jv(t,e,r,n){for(var a=e.length,i=a&&e[0].length,o=0;o<a;o++){t[o]||(t[o]=[]);for(var s=0;s<i;s++)t[o][s]=e[o][s]+r[o][s]*n}return t}function PS(t,e){for(var r=t.length,n=e.length,a=r>n?e:t,i=Math.min(r,n),o=a[i-1]||{color:[0,0,0,0],offset:0},s=i;s<Math.max(r,n);s++)a.push({offset:o.offset,color:o.color.slice()})}function RS(t,e,r){var n=t,a=e;if(!(!n.push||!a.push)){var i=n.length,o=a.length;if(i!==o){var s=i>o;if(s)n.length=o;else for(var l=i;l<o;l++)n.push(r===1?a[l]:nf.call(a[l]))}for(var c=n[0]&&n[0].length,l=0;l<n.length;l++)if(r===1)isNaN(n[l])&&(n[l]=a[l]);else for(var u=0;u<c;u++)isNaN(n[l][u])&&(n[l][u]=a[l][u])}}function fl(t){if(Vt(t)){var e=t.length;if(Vt(t[0])){for(var r=[],n=0;n<e;n++)r.push(nf.call(t[n]));return r}return nf.call(t)}return t}function dl(t){return t[0]=Math.floor(t[0])||0,t[1]=Math.floor(t[1])||0,t[2]=Math.floor(t[2])||0,t[3]=t[3]==null?1:t[3],"rgba("+t.join(",")+")"}function ES(t){return Vt(t&&t[0])?2:1}var hl=0,pl=1,Jv=2,vo=3,of=4,sf=5,Qv=6;function eg(t){return t===of||t===sf}function vl(t){return t===pl||t===Jv}var go=[0,0,0,0],OS=(function(){function t(e){this.keyframes=[],this.discrete=!1,this._invalid=!1,this._needsSort=!1,this._lastFr=0,this._lastFrP=0,this.propName=e}return t.prototype.isFinished=function(){return this._finished},t.prototype.setFinished=function(){this._finished=!0,this._additiveTrack&&this._additiveTrack.setFinished()},t.prototype.needsAnimate=function(){return this.keyframes.length>=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(e,r,n){this._needsSort=!0;var a=this.keyframes,i=a.length,o=!1,s=Qv,l=r;if(Vt(r)){var c=ES(r);s=c,(c===1&&!et(r[0])||c===2&&!et(r[0][0]))&&(o=!0)}else if(et(r)&&!qs(r))s=hl;else if(ae(r))if(!isNaN(+r))s=hl;else{var u=hn(r);u&&(l=u,s=vo)}else if(Ws(r)){var f=q({},l);f.colorStops=he(r.colorStops,function(d){return{offset:d.offset,color:hn(d.color)}}),DS(r)?s=of:IS(r)&&(s=sf),l=f}i===0?this.valType=s:(s!==this.valType||s===Qv)&&(o=!0),this.discrete=this.discrete||o;var h={time:e,value:l,rawValue:r,percent:0};return n&&(h.easing=n,h.easingFunc=ke(n)?n:ho[n]||$v(n)),a.push(h),h},t.prototype.prepare=function(e,r){var n=this.keyframes;this._needsSort&&n.sort(function(m,g){return m.time-g.time});for(var a=this.valType,i=n.length,o=n[i-1],s=this.discrete,l=vl(a),c=eg(a),u=0;u<i;u++){var f=n[u],h=f.value,d=o.value;f.percent=f.time/e,s||(l&&u!==i-1?RS(h,d,a):c&&PS(h.colorStops,d.colorStops))}if(!s&&a!==sf&&r&&this.needsAnimate()&&r.needsAnimate()&&a===r.valType&&!r._finished){this._additiveTrack=r;for(var p=n[0].value,u=0;u<i;u++)a===hl?n[u].additiveValue=n[u].value-p:a===vo?n[u].additiveValue=ul([],n[u].value,p,-1):vl(a)&&(n[u].additiveValue=a===pl?ul([],n[u].value,p,-1):jv([],n[u].value,p,-1))}},t.prototype.step=function(e,r){if(!this._finished){this._additiveTrack&&this._additiveTrack._finished&&(this._additiveTrack=null);var n=this._additiveTrack!=null,a=n?"additiveValue":"value",i=this.valType,o=this.keyframes,s=o.length,l=this.propName,c=i===vo,u,f=this._lastFr,h=Math.min,d,p;if(s===1)d=p=o[0];else{if(r<0)u=0;else if(r<this._lastFrP){var m=h(f+1,s-1);for(u=m;u>=0&&!(o[u].percent<=r);u--);u=h(u,s-2)}else{for(u=f;u<s&&!(o[u].percent>r);u++);u=h(u-1,s-2)}p=o[u+1],d=o[u]}if(d&&p){this._lastFr=u,this._lastFrP=r;var g=p.percent-d.percent,v=g===0?1:h((r-d.percent)/g,1);p.easingFunc&&(v=p.easingFunc(v));var y=n?this._additiveValue:c?go:e[l];if((vl(i)||c)&&!y&&(y=this._additiveValue=[]),this.discrete)e[l]=v<1?d.rawValue:p.rawValue;else if(vl(i))i===pl?af(y,d[a],p[a],v):LS(y,d[a],p[a],v);else if(eg(i)){var b=d[a],x=p[a],w=i===of;e[l]={type:w?"linear":"radial",x:pn(b.x,x.x,v),y:pn(b.y,x.y,v),colorStops:he(b.colorStops,function(k,C){var A=x.colorStops[C];return{offset:pn(k.offset,A.offset,v),color:dl(af([],k.color,A.color,v))}}),global:x.global},w?(e[l].x2=pn(b.x2,x.x2,v),e[l].y2=pn(b.y2,x.y2,v)):e[l].r=pn(b.r,x.r,v)}else if(c)af(y,d[a],p[a],v),n||(e[l]=dl(y));else{var S=pn(d[a],p[a],v);n?this._additiveValue=S:e[l]=S}n&&this._addToTarget(e)}}},t.prototype._addToTarget=function(e){var r=this.valType,n=this.propName,a=this._additiveValue;r===hl?e[n]=e[n]+a:r===vo?(hn(e[n],go),ul(go,go,a,1),e[n]=dl(go)):r===pl?ul(e[n],e[n],a,1):r===Jv&&jv(e[n],e[n],a,1)},t})(),lf=(function(){function t(e,r,n,a){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=r,r&&a){Eu("Can' use additive animation on looped animation.");return}this._additiveAnimators=a,this._allowDiscrete=n}return t.prototype.getMaxTime=function(){return this._maxTime},t.prototype.getDelay=function(){return this._delay},t.prototype.getLoop=function(){return this._loop},t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(e){this._target=e},t.prototype.when=function(e,r,n){return this.whenWithKeys(e,r,at(r),n)},t.prototype.whenWithKeys=function(e,r,n,a){for(var i=this._tracks,o=0;o<n.length;o++){var s=n[o],l=i[s];if(!l){l=i[s]=new OS(s);var c=void 0,u=this._getAdditiveTrack(s);if(u){var f=u.keyframes,h=f[f.length-1];c=h&&h.value,u.valType===vo&&c&&(c=dl(c))}else c=this._target[s];if(c==null)continue;e>0&&l.addKeyframe(0,fl(c),a),this._trackKeys.push(s)}l.addKeyframe(e,fl(r[s]),a)}return this._maxTime=Math.max(this._maxTime,e),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var r=e.length,n=0;n<r;n++)e[n].call(this)},t.prototype._abortedCallback=function(){this._setTracksFinished();var e=this.animation,r=this._abortedCbs;if(e&&e.removeClip(this._clip),this._clip=null,r)for(var n=0;n<r.length;n++)r[n].call(this)},t.prototype._setTracksFinished=function(){for(var e=this._tracks,r=this._trackKeys,n=0;n<r.length;n++)e[r[n]].setFinished()},t.prototype._getAdditiveTrack=function(e){var r,n=this._additiveAnimators;if(n)for(var a=0;a<n.length;a++){var i=n[a].getTrack(e);i&&(r=i)}return r},t.prototype.start=function(e){if(!(this._started>0)){this._started=1;for(var r=this,n=[],a=this._maxTime||0,i=0;i<this._trackKeys.length;i++){var o=this._trackKeys[i],s=this._tracks[o],l=this._getAdditiveTrack(o),c=s.keyframes,u=c.length;if(s.prepare(a,l),s.needsAnimate())if(!this._allowDiscrete&&s.discrete){var f=c[u-1];f&&(r._target[s.propName]=f.rawValue),s.setFinished()}else n.push(s)}if(n.length||this._force){var h=new MS({life:a,loop:this._loop,delay:this._delay||0,onframe:function(d){r._started=2;var p=r._additiveAnimators;if(p){for(var m=!1,g=0;g<p.length;g++)if(p[g]._clip){m=!0;break}m||(r._additiveAnimators=null)}for(var g=0;g<n.length;g++)n[g].step(r._target,d);var v=r._onframeCbs;if(v)for(var g=0;g<v.length;g++)v[g](r._target,d)},ondestroy:function(){r._doneCallback()}});this._clip=h,this.animation&&this.animation.addClip(h),e&&h.setEasing(e)}else this._doneCallback();return this}},t.prototype.stop=function(e){if(this._clip){var r=this._clip;e&&r.onframe(1),this._abortedCallback()}},t.prototype.delay=function(e){return this._delay=e,this},t.prototype.during=function(e){return e&&(this._onframeCbs||(this._onframeCbs=[]),this._onframeCbs.push(e)),this},t.prototype.done=function(e){return e&&(this._doneCbs||(this._doneCbs=[]),this._doneCbs.push(e)),this},t.prototype.aborted=function(e){return e&&(this._abortedCbs||(this._abortedCbs=[]),this._abortedCbs.push(e)),this},t.prototype.getClip=function(){return this._clip},t.prototype.getTrack=function(e){return this._tracks[e]},t.prototype.getTracks=function(){var e=this;return he(this._trackKeys,function(r){return e._tracks[r]})},t.prototype.stopTracks=function(e,r){if(!e.length||!this._clip)return!0;for(var n=this._tracks,a=this._trackKeys,i=0;i<e.length;i++){var o=n[e[i]];o&&!o.isFinished()&&(r?o.step(this._target,1):this._started===1&&o.step(this._target,0),o.setFinished())}for(var s=!0,i=0;i<a.length;i++)if(!n[a[i]].isFinished()){s=!1;break}return s&&this._abortedCallback(),s},t.prototype.saveTo=function(e,r,n){if(e){r=r||this._trackKeys;for(var a=0;a<r.length;a++){var i=r[a],o=this._tracks[i];if(!(!o||o.isFinished())){var s=o.keyframes,l=s[n?0:s.length-1];l&&(e[i]=fl(l.rawValue))}}}},t.prototype.__changeFinalValue=function(e,r){r=r||at(e);for(var n=0;n<r.length;n++){var a=r[n],i=this._tracks[a];if(i){var o=i.keyframes;if(o.length>1){var s=o.pop();i.addKeyframe(s.time,e[a]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},t})(),Ir=(function(){function t(e){e&&(this._$eventProcessor=e)}return t.prototype.on=function(e,r,n,a){this._$handlers||(this._$handlers={});var i=this._$handlers;if(typeof r=="function"&&(a=n,n=r,r=null),!n||!e)return this;var o=this._$eventProcessor;r!=null&&o&&o.normalizeQuery&&(r=o.normalizeQuery(r)),i[e]||(i[e]=[]);for(var s=0;s<i[e].length;s++)if(i[e][s].h===n)return this;var l={h:n,query:r,ctx:a||this,callAtLast:n.zrEventfulCallAtLast},c=i[e].length-1,u=i[e][c];return u&&u.callAtLast?i[e].splice(c,0,l):i[e].push(l),this},t.prototype.isSilent=function(e){var r=this._$handlers;return!r||!r[e]||!r[e].length},t.prototype.off=function(e,r){var n=this._$handlers;if(!n)return this;if(!e)return this._$handlers={},this;if(r){if(n[e]){for(var a=[],i=0,o=n[e].length;i<o;i++)n[e][i].h!==r&&a.push(n[e][i]);n[e]=a}n[e]&&n[e].length===0&&delete n[e]}else delete n[e];return this},t.prototype.trigger=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this._$handlers)return this;var a=this._$handlers[e],i=this._$eventProcessor;if(a)for(var o=r.length,s=a.length,l=0;l<s;l++){var c=a[l];if(!(i&&i.filter&&c.query!=null&&!i.filter(e,c.query)))switch(o){case 0:c.h.call(c.ctx);break;case 1:c.h.call(c.ctx,r[0]);break;case 2:c.h.call(c.ctx,r[0],r[1]);break;default:c.h.apply(c.ctx,r);break}}return i&&i.afterTrigger&&i.afterTrigger(e),this},t.prototype.triggerWithContext=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this._$handlers)return this;var a=this._$handlers[e],i=this._$eventProcessor;if(a)for(var o=r.length,s=r[o-1],l=a.length,c=0;c<l;c++){var u=a[c];if(!(i&&i.filter&&u.query!=null&&!i.filter(e,u.query)))switch(o){case 0:u.h.call(s);break;case 1:u.h.call(s,r[0]);break;case 2:u.h.call(s,r[0],r[1]);break;default:u.h.apply(s,r.slice(1,o-1));break}}return i&&i.afterTrigger&&i.afterTrigger(e),this},t})(),tg=1;_e.hasGlobalWindow&&(tg=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var gl=tg,cf=.4,uf="#333",ff="#ccc",NS="#eee",ir=1,mo=2,pi=4,df="__zr_normal__",hf=fo.concat(["ignore"]),BS=ni(fo,function(t,e){return t[e]=!0,t},{ignore:!1}),vi={},zS=new Ge(0,0,0,0),ml=(function(){function t(e){this.id=mv(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return t.prototype._init=function(e){this.attr(e)},t.prototype.drift=function(e,r,n){switch(this.draggable){case"horizontal":r=0;break;case"vertical":e=0;break}var a=this.transform;a||(a=this.transform=[1,0,0,1,0,0]),a[4]+=e,a[5]+=r,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(e){var r=this._textContent;if(r&&(!r.ignore||e)){this.textConfig||(this.textConfig={});var n=this.textConfig,a=n.local,i=r.innerTransformable,o=void 0,s=void 0,l=!1;i.parent=a?this:null;var c=!1;if(i.copyTransform(r),n.position!=null){var u=zS;n.layoutRect?u.copy(n.layoutRect):u.copy(this.getBoundingRect()),a||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(vi,n,u):Qs(vi,n,u),i.x=vi.x,i.y=vi.y,o=vi.align,s=vi.verticalAlign;var f=n.origin;if(f&&n.rotation!=null){var h=void 0,d=void 0;f==="center"?(h=u.width*.5,d=u.height*.5):(h=Pn(f[0],u.width),d=Pn(f[1],u.height)),c=!0,i.originX=-i.x+h+(a?0:u.x),i.originY=-i.y+d+(a?0:u.y)}}n.rotation!=null&&(i.rotation=n.rotation);var p=n.offset;p&&(i.x+=p[0],i.y+=p[1],c||(i.originX=-p[0],i.originY=-p[1]));var m=n.inside==null?typeof n.position=="string"&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),v=void 0,y=void 0,b=void 0;m&&this.canBeInsideText()?(v=n.insideFill,y=n.insideStroke,(v==null||v==="auto")&&(v=this.getInsideTextFill()),(y==null||y==="auto")&&(y=this.getInsideTextStroke(v),b=!0)):(v=n.outsideFill,y=n.outsideStroke,(v==null||v==="auto")&&(v=this.getOutsideFill()),(y==null||y==="auto")&&(y=this.getOutsideStroke(v),b=!0)),v=v||"#000",(v!==g.fill||y!==g.stroke||b!==g.autoStroke||o!==g.align||s!==g.verticalAlign)&&(l=!0,g.fill=v,g.stroke=y,g.autoStroke=b,g.align=o,g.verticalAlign=s,r.setDefaultTextStyle(g)),r.__dirty|=ir,l&&r.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(e){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?ff:uf},t.prototype.getOutsideStroke=function(e){var r=this.__zr&&this.__zr.getBackgroundColor(),n=typeof r=="string"&&hn(r);n||(n=[255,255,255,1]);for(var a=n[3],i=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*a+(i?0:255)*(1-a);return n[3]=1,ll(n,"rgba")},t.prototype.traverse=function(e,r){},t.prototype.attrKV=function(e,r){e==="textConfig"?this.setTextConfig(r):e==="textContent"?this.setTextContent(r):e==="clipPath"?this.setClipPath(r):e==="extra"?(this.extra=this.extra||{},q(this.extra,r)):this[e]=r},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(e,r){if(typeof e=="string")this.attrKV(e,r);else if(de(e))for(var n=e,a=at(n),i=0;i<a.length;i++){var o=a[i];this.attrKV(o,e[o])}return this.markRedraw(),this},t.prototype.saveCurrentToNormalState=function(e){this._innerSaveToNormal(e);for(var r=this._normalState,n=0;n<this.animators.length;n++){var a=this.animators[n],i=a.__fromStateTransition;if(!(a.getLoop()||i&&i!==df)){var o=a.targetName,s=o?r[o]:r;a.saveTo(s)}}},t.prototype._innerSaveToNormal=function(e){var r=this._normalState;r||(r=this._normalState={}),e.textConfig&&!r.textConfig&&(r.textConfig=this.textConfig),this._savePrimaryToNormal(e,r,hf)},t.prototype._savePrimaryToNormal=function(e,r,n){for(var a=0;a<n.length;a++){var i=n[a];e[i]!=null&&!(i in r)&&(r[i]=this[i])}},t.prototype.hasState=function(){return this.currentStates.length>0},t.prototype.getState=function(e){return this.states[e]},t.prototype.ensureState=function(e){var r=this.states;return r[e]||(r[e]={}),r[e]},t.prototype.clearStates=function(e){this.useState(df,!1,e)},t.prototype.useState=function(e,r,n,a){var i=e===df,o=this.hasState();if(!(!o&&i)){var s=this.currentStates,l=this.stateTransition;if(!(Ue(s,e)>=0&&(r||s.length===1))){var c;if(this.stateProxy&&!i&&(c=this.stateProxy(e)),c||(c=this.states&&this.states[e]),!c&&!i){Eu("State "+e+" not exists.");return}i||this.saveCurrentToNormalState(c);var u=!!(c&&c.hoverLayer||a);u&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,c,this._normalState,r,!n&&!this.__inHover&&l&&l.duration>0,l);var f=this._textContent,h=this._textGuide;return f&&f.useState(e,r,n,u),h&&h.useState(e,r,n,u),i?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!u&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~ir),c}}},t.prototype.useStates=function(e,r,n){if(!e.length)this.clearStates();else{var a=[],i=this.currentStates,o=e.length,s=o===i.length;if(s){for(var l=0;l<o;l++)if(e[l]!==i[l]){s=!1;break}}if(s)return;for(var l=0;l<o;l++){var c=e[l],u=void 0;this.stateProxy&&(u=this.stateProxy(c,e)),u||(u=this.states[c]),u&&a.push(u)}var f=a[o-1],h=!!(f&&f.hoverLayer||n);h&&this._toggleHoverLayerFlag(!0);var d=this._mergeStates(a),p=this.stateTransition;this.saveCurrentToNormalState(d),this._applyStateObj(e.join(","),d,this._normalState,!1,!r&&!this.__inHover&&p&&p.duration>0,p);var m=this._textContent,g=this._textGuide;m&&m.useStates(e,r,h),g&&g.useStates(e,r,h),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!h&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~ir)}},t.prototype.isSilent=function(){for(var e=this.silent,r=this.parent;!e&&r;){if(r.silent){e=!0;break}r=r.parent}return e},t.prototype._updateAnimationTargets=function(){for(var e=0;e<this.animators.length;e++){var r=this.animators[e];r.targetName&&r.changeTarget(this[r.targetName])}},t.prototype.removeState=function(e){var r=Ue(this.currentStates,e);if(r>=0){var n=this.currentStates.slice();n.splice(r,1),this.useStates(n)}},t.prototype.replaceState=function(e,r,n){var a=this.currentStates.slice(),i=Ue(a,e),o=Ue(a,r)>=0;i>=0?o?a.splice(i,1):a[i]=r:n&&!o&&a.push(r),this.useStates(a)},t.prototype.toggleState=function(e,r){r?this.useState(e,!0):this.removeState(e)},t.prototype._mergeStates=function(e){for(var r={},n,a=0;a<e.length;a++){var i=e[a];q(r,i),i.textConfig&&(n=n||{},q(n,i.textConfig))}return n&&(r.textConfig=n),r},t.prototype._applyStateObj=function(e,r,n,a,i,o){var s=!(r&&a);r&&r.textConfig?(this.textConfig=q({},a?this.textConfig:n.textConfig),q(this.textConfig,r.textConfig)):s&&n.textConfig&&(this.textConfig=n.textConfig);for(var l={},c=!1,u=0;u<hf.length;u++){var f=hf[u],h=i&&BS[f];r&&r[f]!=null?h?(c=!0,l[f]=r[f]):this[f]=r[f]:s&&n[f]!=null&&(h?(c=!0,l[f]=n[f]):this[f]=n[f])}if(!i)for(var u=0;u<this.animators.length;u++){var d=this.animators[u],p=d.targetName;d.getLoop()||d.__changeFinalValue(p?(r||n)[p]:r||n)}c&&this._transitionState(e,l,o)},t.prototype._attachComponent=function(e){if(!(e.__zr&&!e.__hostTarget)&&e!==this){var r=this.__zr;r&&e.addSelfToZr(r),e.__zr=r,e.__hostTarget=this}},t.prototype._detachComponent=function(e){e.__zr&&e.removeSelfFromZr(e.__zr),e.__zr=null,e.__hostTarget=null},t.prototype.getClipPath=function(){return this._clipPath},t.prototype.setClipPath=function(e){this._clipPath&&this._clipPath!==e&&this.removeClipPath(),this._attachComponent(e),this._clipPath=e,this.markRedraw()},t.prototype.removeClipPath=function(){var e=this._clipPath;e&&(this._detachComponent(e),this._clipPath=null,this.markRedraw())},t.prototype.getTextContent=function(){return this._textContent},t.prototype.setTextContent=function(e){var r=this._textContent;r!==e&&(r&&r!==e&&this.removeTextContent(),e.innerTransformable=new Ju,this._attachComponent(e),this._textContent=e,this.markRedraw())},t.prototype.setTextConfig=function(e){this.textConfig||(this.textConfig={}),q(this.textConfig,e),this.markRedraw()},t.prototype.removeTextConfig=function(){this.textConfig=null,this.markRedraw()},t.prototype.removeTextContent=function(){var e=this._textContent;e&&(e.innerTransformable=null,this._detachComponent(e),this._textContent=null,this._innerTextDefaultStyle=null,this.markRedraw())},t.prototype.getTextGuideLine=function(){return this._textGuide},t.prototype.setTextGuideLine=function(e){this._textGuide&&this._textGuide!==e&&this.removeTextGuideLine(),this._attachComponent(e),this._textGuide=e,this.markRedraw()},t.prototype.removeTextGuideLine=function(){var e=this._textGuide;e&&(this._detachComponent(e),this._textGuide=null,this.markRedraw())},t.prototype.markRedraw=function(){this.__dirty|=ir;var e=this.__zr;e&&(this.__inHover?e.refreshHover():e.refresh()),this.__hostTarget&&this.__hostTarget.markRedraw()},t.prototype.dirty=function(){this.markRedraw()},t.prototype._toggleHoverLayerFlag=function(e){this.__inHover=e;var r=this._textContent,n=this._textGuide;r&&(r.__inHover=e),n&&(n.__inHover=e)},t.prototype.addSelfToZr=function(e){if(this.__zr!==e){this.__zr=e;var r=this.animators;if(r)for(var n=0;n<r.length;n++)e.animation.addAnimator(r[n]);this._clipPath&&this._clipPath.addSelfToZr(e),this._textContent&&this._textContent.addSelfToZr(e),this._textGuide&&this._textGuide.addSelfToZr(e)}},t.prototype.removeSelfFromZr=function(e){if(this.__zr){this.__zr=null;var r=this.animators;if(r)for(var n=0;n<r.length;n++)e.animation.removeAnimator(r[n]);this._clipPath&&this._clipPath.removeSelfFromZr(e),this._textContent&&this._textContent.removeSelfFromZr(e),this._textGuide&&this._textGuide.removeSelfFromZr(e)}},t.prototype.animate=function(e,r,n){var a=e?this[e]:this,i=new lf(a,r,n);return e&&(i.targetName=e),this.addAnimator(i,e),i},t.prototype.addAnimator=function(e,r){var n=this.__zr,a=this;e.during(function(){a.updateDuringAnimation(r)}).done(function(){var i=a.animators,o=Ue(i,e);o>=0&&i.splice(o,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(e){this.markRedraw()},t.prototype.stopAnimation=function(e,r){for(var n=this.animators,a=n.length,i=[],o=0;o<a;o++){var s=n[o];!e||e===s.scope?s.stop(r):i.push(s)}return this.animators=i,this},t.prototype.animateTo=function(e,r,n){pf(this,e,r,n)},t.prototype.animateFrom=function(e,r,n){pf(this,e,r,n,!0)},t.prototype._transitionState=function(e,r,n,a){for(var i=pf(this,r,n,a),o=0;o<i.length;o++)i[o].__fromStateTransition=e},t.prototype.getBoundingRect=function(){return null},t.prototype.getPaintRect=function(){return null},t.initDefaultProps=(function(){var e=t.prototype;e.type="element",e.name="",e.ignore=e.silent=e.isGroup=e.draggable=e.dragging=e.ignoreClip=e.__inHover=!1,e.__dirty=ir;function r(n,a,i,o){Object.defineProperty(e,n,{get:function(){if(!this[a]){var l=this[a]=[];s(this,l)}return this[a]},set:function(l){this[i]=l[0],this[o]=l[1],this[a]=l,s(this,l)}});function s(l,c){Object.defineProperty(c,0,{get:function(){return l[i]},set:function(u){l[i]=u}}),Object.defineProperty(c,1,{get:function(){return l[o]},set:function(u){l[o]=u}})}}Object.defineProperty&&(r("position","_legacyPos","x","y"),r("scale","_legacyScale","scaleX","scaleY"),r("origin","_legacyOrigin","originX","originY"))})(),t})();Ur(ml,Ir),Ur(ml,Ju);function pf(t,e,r,n,a){r=r||{};var i=[];rg(t,"",t,e,r,n,i,a);var o=i.length,s=!1,l=r.done,c=r.aborted,u=function(){s=!0,o--,o<=0&&(s?l&&l():c&&c())},f=function(){o--,o<=0&&(s?l&&l():c&&c())};o||l&&l(),i.length>0&&r.during&&i[0].during(function(p,m){r.during(m)});for(var h=0;h<i.length;h++){var d=i[h];u&&d.done(u),f&&d.aborted(f),r.force&&d.duration(r.duration),d.start(r.easing)}return i}function vf(t,e,r){for(var n=0;n<r;n++)t[n]=e[n]}function FS(t){return Vt(t[0])}function HS(t,e,r){if(Vt(e[r]))if(Vt(t[r])||(t[r]=[]),Ut(e[r])){var n=e[r].length;t[r].length!==n&&(t[r]=new e[r].constructor(n),vf(t[r],e[r],n))}else{var a=e[r],i=t[r],o=a.length;if(FS(a))for(var s=a[0].length,l=0;l<o;l++)i[l]?vf(i[l],a[l],s):i[l]=Array.prototype.slice.call(a[l]);else vf(i,a,o);i.length=a.length}else t[r]=e[r]}function VS(t,e){return t===e||Vt(t)&&Vt(e)&&US(t,e)}function US(t,e){var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function rg(t,e,r,n,a,i,o,s){for(var l=at(n),c=a.duration,u=a.delay,f=a.additive,h=a.setToFinal,d=!de(i),p=t.animators,m=[],g=0;g<l.length;g++){var v=l[g],y=n[v];if(y!=null&&r[v]!=null&&(d||i[v]))if(de(y)&&!Vt(y)&&!Ws(y)){if(e){s||(r[v]=y,t.updateDuringAnimation(e));continue}rg(t,v,r[v],y,a,i&&i[v],o,s)}else m.push(v);else s||(r[v]=y,t.updateDuringAnimation(e),m.push(v))}var b=m.length;if(!f&&b)for(var x=0;x<p.length;x++){var w=p[x];if(w.targetName===e){var S=w.stopTracks(m);if(S){var k=Ue(p,w);p.splice(k,1)}}}if(a.force||(m=bt(m,function(T){return!VS(n[T],r[T])}),b=m.length),b>0||a.force&&!o.length){var C=void 0,A=void 0,M=void 0;if(s){A={},h&&(C={});for(var x=0;x<b;x++){var v=m[x];A[v]=r[v],h?C[v]=n[v]:r[v]=n[v]}}else if(h){M={};for(var x=0;x<b;x++){var v=m[x];M[v]=fl(r[v]),HS(r,n,v)}}var w=new lf(r,!1,!1,f?bt(p,function(D){return D.targetName===e}):null);w.targetName=e,a.scope&&(w.scope=a.scope),h&&C&&w.whenWithKeys(0,C,m),M&&w.whenWithKeys(0,M,m),w.whenWithKeys(c??500,s?A:n,m).delay(u||0),t.addAnimator(w,e),o.push(w)}}var gf="__zr_style_"+Math.round(Math.random()*10),ga={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},yl={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};ga[gf]=!0;var ng=["z","z2","invisible"],GS=["invisible"],yo=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype._init=function(r){for(var n=at(r),a=0;a<n.length;a++){var i=n[a];i==="style"?this.useStyle(r[i]):t.prototype.attrKV.call(this,i,r[i])}this.style||this.useStyle({})},e.prototype.beforeBrush=function(){},e.prototype.afterBrush=function(){},e.prototype.innerBeforeBrush=function(){},e.prototype.innerAfterBrush=function(){},e.prototype.shouldBePainted=function(r,n,a,i){var o=this.transform;if(this.ignore||this.invisible||this.style.opacity===0||this.culling&&$S(this,r,n)||o&&!o[0]&&!o[3])return!1;if(a&&this.__clipPaths){for(var s=0;s<this.__clipPaths.length;++s)if(this.__clipPaths[s].isZeroArea())return!1}if(i&&this.parent)for(var l=this.parent;l;){if(l.ignore)return!1;l=l.parent}return!0},e.prototype.contain=function(r,n){return this.rectContain(r,n)},e.prototype.traverse=function(r,n){r.call(n,this)},e.prototype.rectContain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();return i.contain(a[0],a[1])},e.prototype.getPaintRect=function(){var r=this._paintRect;if(!this._paintRect||this.__dirty){var n=this.transform,a=this.getBoundingRect(),i=this.style,o=i.shadowBlur||0,s=i.shadowOffsetX||0,l=i.shadowOffsetY||0;r=this._paintRect||(this._paintRect=new Ge(0,0,0,0)),n?Ge.applyTransform(r,a,n):r.copy(a),(o||s||l)&&(r.width+=o*2+Math.abs(s),r.height+=o*2+Math.abs(l),r.x=Math.min(r.x,r.x+s-o),r.y=Math.min(r.y,r.y+l-o));var c=this.dirtyRectTolerance;r.isZero()||(r.x=Math.floor(r.x-c),r.y=Math.floor(r.y-c),r.width=Math.ceil(r.width+1+c*2),r.height=Math.ceil(r.height+1+c*2))}return r},e.prototype.setPrevPaintRect=function(r){r?(this._prevPaintRect=this._prevPaintRect||new Ge(0,0,0,0),this._prevPaintRect.copy(r)):this._prevPaintRect=null},e.prototype.getPrevPaintRect=function(){return this._prevPaintRect},e.prototype.animateStyle=function(r){return this.animate("style",r)},e.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():this.markRedraw()},e.prototype.attrKV=function(r,n){r!=="style"?t.prototype.attrKV.call(this,r,n):this.style?this.setStyle(n):this.useStyle(n)},e.prototype.setStyle=function(r,n){return typeof r=="string"?this.style[r]=n:q(this.style,r),this.dirtyStyle(),this},e.prototype.dirtyStyle=function(r){r||this.markRedraw(),this.__dirty|=mo,this._rect&&(this._rect=null)},e.prototype.dirty=function(){this.dirtyStyle()},e.prototype.styleChanged=function(){return!!(this.__dirty&mo)},e.prototype.styleUpdated=function(){this.__dirty&=~mo},e.prototype.createStyle=function(r){return Xs(ga,r)},e.prototype.useStyle=function(r){r[gf]||(r=this.createStyle(r)),this.__inHover?this.__hoverStyle=r:this.style=r,this.dirtyStyle()},e.prototype.isStyleObject=function(r){return r[gf]},e.prototype._innerSaveToNormal=function(r){t.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.style&&!n.style&&(n.style=this._mergeStyle(this.createStyle(),this.style)),this._savePrimaryToNormal(r,n,ng)},e.prototype._applyStateObj=function(r,n,a,i,o,s){t.prototype._applyStateObj.call(this,r,n,a,i,o,s);var l=!(n&&i),c;if(n&&n.style?o?i?c=n.style:(c=this._mergeStyle(this.createStyle(),a.style),this._mergeStyle(c,n.style)):(c=this._mergeStyle(this.createStyle(),i?this.style:a.style),this._mergeStyle(c,n.style)):l&&(c=a.style),c)if(o){var u=this.style;if(this.style=this.createStyle(l?{}:u),l)for(var f=at(u),h=0;h<f.length;h++){var d=f[h];d in c&&(c[d]=c[d],this.style[d]=u[d])}for(var p=at(c),h=0;h<p.length;h++){var d=p[h];this.style[d]=this.style[d]}this._transitionState(r,{style:c},s,this.getAnimationStyleProps())}else this.useStyle(c);for(var m=this.__inHover?GS:ng,h=0;h<m.length;h++){var d=m[h];n&&n[d]!=null?this[d]=n[d]:l&&a[d]!=null&&(this[d]=a[d])}},e.prototype._mergeStates=function(r){for(var n=t.prototype._mergeStates.call(this,r),a,i=0;i<r.length;i++){var o=r[i];o.style&&(a=a||{},this._mergeStyle(a,o.style))}return a&&(n.style=a),n},e.prototype._mergeStyle=function(r,n){return q(r,n),r},e.prototype.getAnimationStyleProps=function(){return yl},e.initDefaultProps=(function(){var r=e.prototype;r.type="displayable",r.invisible=!1,r.z=0,r.z2=0,r.zlevel=0,r.culling=!1,r.cursor="pointer",r.rectHover=!1,r.incremental=!1,r._rect=null,r.dirtyRectTolerance=0,r.__dirty=ir|mo})(),e})(ml),mf=new Ge(0,0,0,0),yf=new Ge(0,0,0,0);function $S(t,e,r){return mf.copy(t.getBoundingRect()),t.transform&&mf.applyTransform(t.transform),yf.width=e,yf.height=r,!mf.intersect(yf)}var vr=Math.min,gr=Math.max,_f=Math.sin,bf=Math.cos,ma=Math.PI*2,_l=si(),bl=si(),xl=si();function ag(t,e,r,n,a,i){a[0]=vr(t,r),a[1]=vr(e,n),i[0]=gr(t,r),i[1]=gr(e,n)}var ig=[],og=[];function WS(t,e,r,n,a,i,o,s,l,c){var u=Vv,f=wt,h=u(t,r,a,o,ig);l[0]=1/0,l[1]=1/0,c[0]=-1/0,c[1]=-1/0;for(var d=0;d<h;d++){var p=f(t,r,a,o,ig[d]);l[0]=vr(p,l[0]),c[0]=gr(p,c[0])}h=u(e,n,i,s,og);for(var d=0;d<h;d++){var m=f(e,n,i,s,og[d]);l[1]=vr(m,l[1]),c[1]=gr(m,c[1])}l[0]=vr(t,l[0]),c[0]=gr(t,c[0]),l[0]=vr(o,l[0]),c[0]=gr(o,c[0]),l[1]=vr(e,l[1]),c[1]=gr(e,c[1]),l[1]=vr(s,l[1]),c[1]=gr(s,c[1])}function qS(t,e,r,n,a,i,o,s){var l=Gv,c=Gt,u=gr(vr(l(t,r,a),1),0),f=gr(vr(l(e,n,i),1),0),h=c(t,r,a,u),d=c(e,n,i,f);o[0]=vr(t,a,h),o[1]=vr(e,i,d),s[0]=gr(t,a,h),s[1]=gr(e,i,d)}function YS(t,e,r,n,a,i,o,s,l){var c=ci,u=ui,f=Math.abs(a-i);if(f%ma<1e-4&&f>1e-4){s[0]=t-r,s[1]=e-n,l[0]=t+r,l[1]=e+n;return}if(_l[0]=bf(a)*r+t,_l[1]=_f(a)*n+e,bl[0]=bf(i)*r+t,bl[1]=_f(i)*n+e,c(s,_l,bl),u(l,_l,bl),a=a%ma,a<0&&(a=a+ma),i=i%ma,i<0&&(i=i+ma),a>i&&!o?i+=ma:a<i&&o&&(a+=ma),o){var h=i;i=a,a=h}for(var d=0;d<i;d+=Math.PI/2)d>a&&(xl[0]=bf(d)*r+t,xl[1]=_f(d)*n+e,c(s,xl,s),u(l,xl,l))}var $e={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},ya=[],_a=[],qr=[],Nn=[],Yr=[],Xr=[],xf=Math.min,wf=Math.max,ba=Math.cos,xa=Math.sin,vn=Math.abs,Sf=Math.PI,Bn=Sf*2,kf=typeof Float32Array<"u",_o=[];function Tf(t){var e=Math.round(t/Sf*1e8)/1e8;return e%2*Sf}function XS(t,e){var r=Tf(t[0]);r<0&&(r+=Bn);var n=r-t[0],a=t[1];a+=n,!e&&a-r>=Bn?a=r+Bn:e&&r-a>=Bn?a=r-Bn:!e&&r>a?a=r+(Bn-Tf(r-a)):e&&r<a&&(a=r-(Bn-Tf(a-r))),t[0]=r,t[1]=a}var wa=(function(){function t(e){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,e&&(this._saveData=!1),this._saveData&&(this.data=[])}return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(e,r,n){n=n||0,n>0&&(this._ux=vn(n/gl/e)||0,this._uy=vn(n/gl/r)||0)},t.prototype.setDPR=function(e){this.dpr=e},t.prototype.setContext=function(e){this._ctx=e},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(e,r){return this._drawPendingPt(),this.addData($e.M,e,r),this._ctx&&this._ctx.moveTo(e,r),this._x0=e,this._y0=r,this._xi=e,this._yi=r,this},t.prototype.lineTo=function(e,r){var n=vn(e-this._xi),a=vn(r-this._yi),i=n>this._ux||a>this._uy;if(this.addData($e.L,e,r),this._ctx&&i&&this._ctx.lineTo(e,r),i)this._xi=e,this._yi=r,this._pendingPtDist=0;else{var o=n*n+a*a;o>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=r,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(e,r,n,a,i,o){return this._drawPendingPt(),this.addData($e.C,e,r,n,a,i,o),this._ctx&&this._ctx.bezierCurveTo(e,r,n,a,i,o),this._xi=i,this._yi=o,this},t.prototype.quadraticCurveTo=function(e,r,n,a){return this._drawPendingPt(),this.addData($e.Q,e,r,n,a),this._ctx&&this._ctx.quadraticCurveTo(e,r,n,a),this._xi=n,this._yi=a,this},t.prototype.arc=function(e,r,n,a,i,o){this._drawPendingPt(),_o[0]=a,_o[1]=i,XS(_o,o),a=_o[0],i=_o[1];var s=i-a;return this.addData($e.A,e,r,n,n,a,s,0,o?0:1),this._ctx&&this._ctx.arc(e,r,n,a,i,o),this._xi=ba(i)*n+e,this._yi=xa(i)*n+r,this},t.prototype.arcTo=function(e,r,n,a,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,r,n,a,i),this},t.prototype.rect=function(e,r,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,r,n,a),this.addData($e.R,e,r,n,a),this},t.prototype.closePath=function(){this._drawPendingPt(),this.addData($e.Z);var e=this._ctx,r=this._x0,n=this._y0;return e&&e.closePath(),this._xi=r,this._yi=n,this},t.prototype.fill=function(e){e&&e.fill(),this.toStatic()},t.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},t.prototype.len=function(){return this._len},t.prototype.setData=function(e){var r=e.length;!(this.data&&this.data.length===r)&&kf&&(this.data=new Float32Array(r));for(var n=0;n<r;n++)this.data[n]=e[n];this._len=r},t.prototype.appendPath=function(e){e instanceof Array||(e=[e]);for(var r=e.length,n=0,a=this._len,i=0;i<r;i++)n+=e[i].len();kf&&this.data instanceof Float32Array&&(this.data=new Float32Array(a+n));for(var i=0;i<r;i++)for(var o=e[i].data,s=0;s<o.length;s++)this.data[a++]=o[s];this._len=a},t.prototype.addData=function(e,r,n,a,i,o,s,l,c){if(this._saveData){var u=this.data;this._len+arguments.length>u.length&&(this._expandData(),u=this.data);for(var f=0;f<arguments.length;f++)u[this._len++]=arguments[f]}},t.prototype._drawPendingPt=function(){this._pendingPtDist>0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],r=0;r<this._len;r++)e[r]=this.data[r];this.data=e}},t.prototype.toStatic=function(){if(this._saveData){this._drawPendingPt();var e=this.data;e instanceof Array&&(e.length=this._len,kf&&this._len>11&&(this.data=new Float32Array(e)))}},t.prototype.getBoundingRect=function(){qr[0]=qr[1]=Yr[0]=Yr[1]=Number.MAX_VALUE,Nn[0]=Nn[1]=Xr[0]=Xr[1]=-Number.MAX_VALUE;var e=this.data,r=0,n=0,a=0,i=0,o;for(o=0;o<this._len;){var s=e[o++],l=o===1;switch(l&&(r=e[o],n=e[o+1],a=r,i=n),s){case $e.M:r=a=e[o++],n=i=e[o++],Yr[0]=a,Yr[1]=i,Xr[0]=a,Xr[1]=i;break;case $e.L:ag(r,n,e[o],e[o+1],Yr,Xr),r=e[o++],n=e[o++];break;case $e.C:WS(r,n,e[o++],e[o++],e[o++],e[o++],e[o],e[o+1],Yr,Xr),r=e[o++],n=e[o++];break;case $e.Q:qS(r,n,e[o++],e[o++],e[o],e[o+1],Yr,Xr),r=e[o++],n=e[o++];break;case $e.A:var c=e[o++],u=e[o++],f=e[o++],h=e[o++],d=e[o++],p=e[o++]+d;o+=1;var m=!e[o++];l&&(a=ba(d)*f+c,i=xa(d)*h+u),YS(c,u,f,h,d,p,m,Yr,Xr),r=ba(p)*f+c,n=xa(p)*h+u;break;case $e.R:a=r=e[o++],i=n=e[o++];var g=e[o++],v=e[o++];ag(a,i,a+g,i+v,Yr,Xr);break;case $e.Z:r=a,n=i;break}ci(qr,qr,Yr),ui(Nn,Nn,Xr)}return o===0&&(qr[0]=qr[1]=Nn[0]=Nn[1]=0),new Ge(qr[0],qr[1],Nn[0]-qr[0],Nn[1]-qr[1])},t.prototype._calculateLength=function(){var e=this.data,r=this._len,n=this._ux,a=this._uy,i=0,o=0,s=0,l=0;this._pathSegLen||(this._pathSegLen=[]);for(var c=this._pathSegLen,u=0,f=0,h=0;h<r;){var d=e[h++],p=h===1;p&&(i=e[h],o=e[h+1],s=i,l=o);var m=-1;switch(d){case $e.M:i=s=e[h++],o=l=e[h++];break;case $e.L:{var g=e[h++],v=e[h++],y=g-i,b=v-o;(vn(y)>n||vn(b)>a||h===r-1)&&(m=Math.sqrt(y*y+b*b),i=g,o=v);break}case $e.C:{var x=e[h++],w=e[h++],g=e[h++],v=e[h++],S=e[h++],k=e[h++];m=wS(i,o,x,w,g,v,S,k,10),i=S,o=k;break}case $e.Q:{var x=e[h++],w=e[h++],g=e[h++],v=e[h++];m=TS(i,o,x,w,g,v,10),i=g,o=v;break}case $e.A:var C=e[h++],A=e[h++],M=e[h++],T=e[h++],D=e[h++],L=e[h++],R=L+D;h+=1,p&&(s=ba(D)*M+C,l=xa(D)*T+A),m=wf(M,T)*xf(Bn,Math.abs(L)),i=ba(R)*M+C,o=xa(R)*T+A;break;case $e.R:{s=i=e[h++],l=o=e[h++];var O=e[h++],B=e[h++];m=O*2+B*2;break}case $e.Z:{var y=s-i,b=l-o;m=Math.sqrt(y*y+b*b),i=s,o=l;break}}m>=0&&(c[f++]=m,u+=m)}return this._pathLen=u,u},t.prototype.rebuildPath=function(e,r){var n=this.data,a=this._ux,i=this._uy,o=this._len,s,l,c,u,f,h,d=r<1,p,m,g=0,v=0,y,b=0,x,w;if(!(d&&(this._pathSegLen||this._calculateLength(),p=this._pathSegLen,m=this._pathLen,y=r*m,!y)))e:for(var S=0;S<o;){var k=n[S++],C=S===1;switch(C&&(c=n[S],u=n[S+1],s=c,l=u),k!==$e.L&&b>0&&(e.lineTo(x,w),b=0),k){case $e.M:s=c=n[S++],l=u=n[S++],e.moveTo(c,u);break;case $e.L:{f=n[S++],h=n[S++];var A=vn(f-c),M=vn(h-u);if(A>a||M>i){if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;e.lineTo(c*(1-D)+f*D,u*(1-D)+h*D);break e}g+=T}e.lineTo(f,h),c=f,u=h,b=0}else{var L=A*A+M*M;L>b&&(x=f,w=h,b=L)}break}case $e.C:{var R=n[S++],O=n[S++],B=n[S++],j=n[S++],P=n[S++],V=n[S++];if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;al(c,R,B,P,D,ya),al(u,O,j,V,D,_a),e.bezierCurveTo(ya[1],_a[1],ya[2],_a[2],ya[3],_a[3]);break e}g+=T}e.bezierCurveTo(R,O,B,j,P,V),c=P,u=V;break}case $e.Q:{var R=n[S++],O=n[S++],B=n[S++],j=n[S++];if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;il(c,R,B,D,ya),il(u,O,j,D,_a),e.quadraticCurveTo(ya[1],_a[1],ya[2],_a[2]);break e}g+=T}e.quadraticCurveTo(R,O,B,j),c=B,u=j;break}case $e.A:var H=n[S++],Z=n[S++],re=n[S++],Te=n[S++],ge=n[S++],xe=n[S++],Ce=n[S++],be=!n[S++],it=re>Te?re:Te,Qe=vn(re-Te)>.001,ze=ge+xe,oe=!1;if(d){var T=p[v++];g+T>y&&(ze=ge+xe*(y-g)/T,oe=!0),g+=T}if(Qe&&e.ellipse?e.ellipse(H,Z,re,Te,Ce,ge,ze,be):e.arc(H,Z,it,ge,ze,be),oe)break e;C&&(s=ba(ge)*re+H,l=xa(ge)*Te+Z),c=ba(ze)*re+H,u=xa(ze)*Te+Z;break;case $e.R:s=c=n[S],l=u=n[S+1],f=n[S++],h=n[S++];var pe=n[S++],ot=n[S++];if(d){var T=p[v++];if(g+T>y){var Xe=y-g;e.moveTo(f,h),e.lineTo(f+xf(Xe,pe),h),Xe-=pe,Xe>0&&e.lineTo(f+pe,h+xf(Xe,ot)),Xe-=ot,Xe>0&&e.lineTo(f+wf(pe-Xe,0),h+ot),Xe-=pe,Xe>0&&e.lineTo(f,h+wf(ot-Xe,0));break e}g+=T}e.rect(f,h,pe,ot);break;case $e.Z:if(d){var T=p[v++];if(g+T>y){var D=(y-g)/T;e.lineTo(c*(1-D)+s*D,u*(1-D)+l*D);break e}g+=T}e.closePath(),c=s,u=l}}},t.prototype.clone=function(){var e=new t,r=this.data;return e.data=r.slice?r.slice():Array.prototype.slice.call(r),e._len=this._len,e},t.CMD=$e,t.initDefaultProps=(function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0})(),t})();function gi(t,e,r,n,a,i,o){if(a===0)return!1;var s=a,l=0,c=t;if(o>e+s&&o>n+s||o<e-s&&o<n-s||i>t+s&&i>r+s||i<t-s&&i<r-s)return!1;if(t!==r)l=(e-n)/(t-r),c=(t*n-r*e)/(t-r);else return Math.abs(i-t)<=s/2;var u=l*i-o+c,f=u*u/(l*l+1);return f<=s/2*s/2}function ZS(t,e,r,n,a,i,o,s,l,c,u){if(l===0)return!1;var f=l;if(u>e+f&&u>n+f&&u>i+f&&u>s+f||u<e-f&&u<n-f&&u<i-f&&u<s-f||c>t+f&&c>r+f&&c>a+f&&c>o+f||c<t-f&&c<r-f&&c<a-f&&c<o-f)return!1;var h=xS(t,e,r,n,a,i,o,s,c,u);return h<=f/2}function KS(t,e,r,n,a,i,o,s,l){if(o===0)return!1;var c=o;if(l>e+c&&l>n+c&&l>i+c||l<e-c&&l<n-c&&l<i-c||s>t+c&&s>r+c&&s>a+c||s<t-c&&s<r-c&&s<a-c)return!1;var u=kS(t,e,r,n,a,i,s,l);return u<=c/2}var sg=Math.PI*2;function wl(t){return t%=sg,t<0&&(t+=sg),t}var bo=Math.PI*2;function jS(t,e,r,n,a,i,o,s,l){if(o===0)return!1;var c=o;s-=t,l-=e;var u=Math.sqrt(s*s+l*l);if(u-c>r||u+c<r)return!1;if(Math.abs(n-a)%bo<1e-4)return!0;if(i){var f=n;n=wl(a),a=wl(f)}else n=wl(n),a=wl(a);n>a&&(a+=bo);var h=Math.atan2(l,s);return h<0&&(h+=bo),h>=n&&h<=a||h+bo>=n&&h+bo<=a}function Sa(t,e,r,n,a,i){if(i>e&&i>n||i<e&&i<n||n===e)return 0;var o=(i-e)/(n-e),s=n<e?1:-1;(o===1||o===0)&&(s=n<e?.5:-.5);var l=o*(r-t)+t;return l===a?1/0:l>a?s:0}var zn=wa.CMD,ka=Math.PI*2,JS=1e-4;function QS(t,e){return Math.abs(t-e)<JS}var Ot=[-1,-1,-1],mr=[-1,-1];function ek(){var t=mr[0];mr[0]=mr[1],mr[1]=t}function tk(t,e,r,n,a,i,o,s,l,c){if(c>e&&c>n&&c>i&&c>s||c<e&&c<n&&c<i&&c<s)return 0;var u=nl(e,n,i,s,c,Ot);if(u===0)return 0;for(var f=0,h=-1,d=void 0,p=void 0,m=0;m<u;m++){var g=Ot[m],v=g===0||g===1?.5:1,y=wt(t,r,a,o,g);y<l||(h<0&&(h=Vv(e,n,i,s,mr),mr[1]<mr[0]&&h>1&&ek(),d=wt(e,n,i,s,mr[0]),h>1&&(p=wt(e,n,i,s,mr[1]))),h===2?g<mr[0]?f+=d<e?v:-v:g<mr[1]?f+=p<d?v:-v:f+=s<p?v:-v:g<mr[0]?f+=d<e?v:-v:f+=s<d?v:-v)}return f}function rk(t,e,r,n,a,i,o,s){if(s>e&&s>n&&s>i||s<e&&s<n&&s<i)return 0;var l=SS(e,n,i,s,Ot);if(l===0)return 0;var c=Gv(e,n,i);if(c>=0&&c<=1){for(var u=0,f=Gt(e,n,i,c),h=0;h<l;h++){var d=Ot[h]===0||Ot[h]===1?.5:1,p=Gt(t,r,a,Ot[h]);p<o||(Ot[h]<c?u+=f<e?d:-d:u+=i<f?d:-d)}return u}else{var d=Ot[0]===0||Ot[0]===1?.5:1,p=Gt(t,r,a,Ot[0]);return p<o?0:i<e?d:-d}}function nk(t,e,r,n,a,i,o,s){if(s-=e,s>r||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Ot[0]=-l,Ot[1]=l;var c=Math.abs(n-a);if(c<1e-4)return 0;if(c>=ka-1e-4){n=0,a=ka;var u=i?1:-1;return o>=Ot[0]+t&&o<=Ot[1]+t?u:0}if(n>a){var f=n;n=a,a=f}n<0&&(n+=ka,a+=ka);for(var h=0,d=0;d<2;d++){var p=Ot[d];if(p+t>o){var m=Math.atan2(s,p),u=i?1:-1;m<0&&(m=ka+m),(m>=n&&m<=a||m+ka>=n&&m+ka<=a)&&(m>Math.PI/2&&m<Math.PI*1.5&&(u=-u),h+=u)}}return h}function lg(t,e,r,n,a){for(var i=t.data,o=t.len(),s=0,l=0,c=0,u=0,f=0,h,d,p=0;p<o;){var m=i[p++],g=p===1;switch(m===zn.M&&p>1&&(r||(s+=Sa(l,c,u,f,n,a))),g&&(l=i[p],c=i[p+1],u=l,f=c),m){case zn.M:u=i[p++],f=i[p++],l=u,c=f;break;case zn.L:if(r){if(gi(l,c,i[p],i[p+1],e,n,a))return!0}else s+=Sa(l,c,i[p],i[p+1],n,a)||0;l=i[p++],c=i[p++];break;case zn.C:if(r){if(ZS(l,c,i[p++],i[p++],i[p++],i[p++],i[p],i[p+1],e,n,a))return!0}else s+=tk(l,c,i[p++],i[p++],i[p++],i[p++],i[p],i[p+1],n,a)||0;l=i[p++],c=i[p++];break;case zn.Q:if(r){if(KS(l,c,i[p++],i[p++],i[p],i[p+1],e,n,a))return!0}else s+=rk(l,c,i[p++],i[p++],i[p],i[p+1],n,a)||0;l=i[p++],c=i[p++];break;case zn.A:var v=i[p++],y=i[p++],b=i[p++],x=i[p++],w=i[p++],S=i[p++];p+=1;var k=!!(1-i[p++]);h=Math.cos(w)*b+v,d=Math.sin(w)*x+y,g?(u=h,f=d):s+=Sa(l,c,h,d,n,a);var C=(n-v)*x/b+v;if(r){if(jS(v,y,x,w,w+S,k,e,C,a))return!0}else s+=nk(v,y,x,w,w+S,k,C,a);l=Math.cos(w+S)*b+v,c=Math.sin(w+S)*x+y;break;case zn.R:u=l=i[p++],f=c=i[p++];var A=i[p++],M=i[p++];if(h=u+A,d=f+M,r){if(gi(u,f,h,f,e,n,a)||gi(h,f,h,d,e,n,a)||gi(h,d,u,d,e,n,a)||gi(u,d,u,f,e,n,a))return!0}else s+=Sa(h,f,h,d,n,a),s+=Sa(u,d,u,f,n,a);break;case zn.Z:if(r){if(gi(l,c,u,f,e,n,a))return!0}else s+=Sa(l,c,u,f,n,a);l=u,c=f;break}}return!r&&!QS(c,f)&&(s+=Sa(l,c,u,f,n,a)||0),s!==0}function ak(t,e,r){return lg(t,0,!1,e,r)}function ik(t,e,r,n){return lg(t,e,!0,r,n)}var cg=He({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},ga),ok={style:He({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},yl.style)},Cf=fo.concat(["invisible","culling","z","z2","zlevel","parent"]),qe=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.update=function(){var r=this;t.prototype.update.call(this);var n=this.style;if(n.decal){var a=this._decalEl=this._decalEl||new e;a.buildPath===e.prototype.buildPath&&(a.buildPath=function(l){r.buildPath(l,r.shape)}),a.silent=!0;var i=a.style;for(var o in n)i[o]!==n[o]&&(i[o]=n[o]);i.fill=n.fill?n.decal:null,i.decal=null,i.shadowColor=null,n.strokeFirst&&(i.stroke=null);for(var s=0;s<Cf.length;++s)a[Cf[s]]=this[Cf[s]];a.__dirty|=ir}else this._decalEl&&(this._decalEl=null)},e.prototype.getDecalElement=function(){return this._decalEl},e.prototype._init=function(r){var n=at(r);this.shape=this.getDefaultShape();var a=this.getDefaultStyle();a&&this.useStyle(a);for(var i=0;i<n.length;i++){var o=n[i],s=r[o];o==="style"?this.style?q(this.style,s):this.useStyle(s):o==="shape"?q(this.shape,s):t.prototype.attrKV.call(this,o,s)}this.style||this.useStyle({})},e.prototype.getDefaultStyle=function(){return null},e.prototype.getDefaultShape=function(){return{}},e.prototype.canBeInsideText=function(){return this.hasFill()},e.prototype.getInsideTextFill=function(){var r=this.style.fill;if(r!=="none"){if(ae(r)){var n=cl(r,0);return n>.5?uf:n>.2?NS:ff}else if(r)return ff}return uf},e.prototype.getInsideTextStroke=function(r){var n=this.style.fill;if(ae(n)){var a=this.__zr,i=!!(a&&a.isDarkMode()),o=cl(r,0)<cf;if(i===o)return n}},e.prototype.buildPath=function(r,n,a){},e.prototype.pathUpdated=function(){this.__dirty&=~pi},e.prototype.getUpdatedPathProxy=function(r){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,r),this.path},e.prototype.createPathProxy=function(){this.path=new wa(!1)},e.prototype.hasStroke=function(){var r=this.style,n=r.stroke;return!(n==null||n==="none"||!(r.lineWidth>0))},e.prototype.hasFill=function(){var r=this.style,n=r.fill;return n!=null&&n!=="none"},e.prototype.getBoundingRect=function(){var r=this._rect,n=this.style,a=!r;if(a){var i=!1;this.path||(i=!0,this.createPathProxy());var o=this.path;(i||this.__dirty&pi)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),r=o.getBoundingRect()}if(this._rect=r,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=r.clone());if(this.__dirty||a){s.copy(r);var l=n.strokeNoScale?this.getLineScale():1,c=n.lineWidth;if(!this.hasFill()){var u=this.strokeContainThreshold;c=Math.max(c,u??4)}l>1e-10&&(s.width+=c/l,s.height+=c/l,s.x-=c/l/2,s.y-=c/l/2)}return s}return r},e.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect(),o=this.style;if(r=a[0],n=a[1],i.contain(r,n)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,c=o.strokeNoScale?this.getLineScale():1;if(c>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),ik(s,l/c,r,n)))return!0}if(this.hasFill())return ak(s,r,n)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=pi,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(r){return this.animate("shape",r)},e.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():r==="shape"?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(r,n){r==="shape"?this.setShape(n):t.prototype.attrKV.call(this,r,n)},e.prototype.setShape=function(r,n){var a=this.shape;return a||(a=this.shape={}),typeof r=="string"?a[r]=n:q(a,r),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&pi)},e.prototype.createStyle=function(r){return Xs(cg,r)},e.prototype._innerSaveToNormal=function(r){t.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.shape&&!n.shape&&(n.shape=q({},this.shape))},e.prototype._applyStateObj=function(r,n,a,i,o,s){t.prototype._applyStateObj.call(this,r,n,a,i,o,s);var l=!(n&&i),c;if(n&&n.shape?o?i?c=n.shape:(c=q({},a.shape),q(c,n.shape)):(c=q({},i?this.shape:a.shape),q(c,n.shape)):l&&(c=a.shape),c)if(o){this.shape=q({},this.shape);for(var u={},f=at(c),h=0;h<f.length;h++){var d=f[h];typeof c[d]=="object"?this.shape[d]=c[d]:u[d]=c[d]}this._transitionState(r,{shape:u},s)}else this.shape=c,this.dirtyShape()},e.prototype._mergeStates=function(r){for(var n=t.prototype._mergeStates.call(this,r),a,i=0;i<r.length;i++){var o=r[i];o.shape&&(a=a||{},this._mergeStyle(a,o.shape))}return a&&(n.shape=a),n},e.prototype.getAnimationStyleProps=function(){return ok},e.prototype.isZeroArea=function(){return!1},e.extend=function(r){var n=(function(i){K(o,i);function o(s){var l=i.call(this,s)||this;return r.init&&r.init.call(l,s),l}return o.prototype.getDefaultStyle=function(){return Ie(r.style)},o.prototype.getDefaultShape=function(){return Ie(r.shape)},o})(e);for(var a in r)typeof r[a]=="function"&&(n.prototype[a]=r[a]);return n},e.initDefaultProps=(function(){var r=e.prototype;r.type="path",r.strokeContainThreshold=5,r.segmentIgnoreThreshold=0,r.subPixelOptimize=!1,r.autoBatch=!1,r.__dirty=ir|mo|pi})(),e})(yo),sk=He({strokeFirst:!0,font:sa,x:0,y:0,textAlign:"left",textBaseline:"top",miterLimit:2},cg),Sl=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.hasStroke=function(){var r=this.style,n=r.stroke;return n!=null&&n!=="none"&&r.lineWidth>0},e.prototype.hasFill=function(){var r=this.style,n=r.fill;return n!=null&&n!=="none"},e.prototype.createStyle=function(r){return Xs(sk,r)},e.prototype.setBoundingRect=function(r){this._rect=r},e.prototype.getBoundingRect=function(){var r=this.style;if(!this._rect){var n=r.text;n!=null?n+="":n="";var a=$u(n,r.font,r.textAlign,r.textBaseline);if(a.x+=r.x||0,a.y+=r.y||0,this.hasStroke()){var i=r.lineWidth;a.x-=i/2,a.y-=i/2,a.width+=i,a.height+=i}this._rect=a}return this._rect},e.initDefaultProps=(function(){var r=e.prototype;r.dirtyRectTolerance=10})(),e})(yo);Sl.prototype.type="tspan";var lk=He({x:0,y:0},ga),ck={style:He({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},yl.style)};function uk(t){return!!(t&&typeof t!="string"&&t.width&&t.height)}var Fn=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.createStyle=function(r){return Xs(lk,r)},e.prototype._getSize=function(r){var n=this.style,a=n[r];if(a!=null)return a;var i=uk(n.image)?n.image:this.__image;if(!i)return 0;var o=r==="width"?"height":"width",s=n[o];return s==null?i[r]:i[r]/i[o]*s},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return ck},e.prototype.getBoundingRect=function(){var r=this.style;return this._rect||(this._rect=new Ge(r.x||0,r.y||0,this.getWidth(),this.getHeight())),this._rect},e})(yo);Fn.prototype.type="image";function fk(t,e){var r=e.x,n=e.y,a=e.width,i=e.height,o=e.r,s,l,c,u;a<0&&(r=r+a,a=-a),i<0&&(n=n+i,i=-i),typeof o=="number"?s=l=c=u=o:o instanceof Array?o.length===1?s=l=c=u=o[0]:o.length===2?(s=c=o[0],l=u=o[1]):o.length===3?(s=o[0],l=u=o[1],c=o[2]):(s=o[0],l=o[1],c=o[2],u=o[3]):s=l=c=u=0;var f;s+l>a&&(f=s+l,s*=a/f,l*=a/f),c+u>a&&(f=c+u,c*=a/f,u*=a/f),l+c>i&&(f=l+c,l*=i/f,c*=i/f),s+u>i&&(f=s+u,s*=i/f,u*=i/f),t.moveTo(r+s,n),t.lineTo(r+a-l,n),l!==0&&t.arc(r+a-l,n+l,l,-Math.PI/2,0),t.lineTo(r+a,n+i-c),c!==0&&t.arc(r+a-c,n+i-c,c,0,Math.PI/2),t.lineTo(r+u,n+i),u!==0&&t.arc(r+u,n+i-u,u,Math.PI/2,Math.PI),t.lineTo(r,n+s),s!==0&&t.arc(r+s,n+s,s,Math.PI,Math.PI*1.5)}var mi=Math.round;function ug(t,e,r){if(e){var n=e.x1,a=e.x2,i=e.y1,o=e.y2;t.x1=n,t.x2=a,t.y1=i,t.y2=o;var s=r&&r.lineWidth;return s&&(mi(n*2)===mi(a*2)&&(t.x1=t.x2=Ta(n,s,!0)),mi(i*2)===mi(o*2)&&(t.y1=t.y2=Ta(i,s,!0))),t}}function fg(t,e,r){if(e){var n=e.x,a=e.y,i=e.width,o=e.height;t.x=n,t.y=a,t.width=i,t.height=o;var s=r&&r.lineWidth;return s&&(t.x=Ta(n,s,!0),t.y=Ta(a,s,!0),t.width=Math.max(Ta(n+i,s,!1)-t.x,i===0?0:1),t.height=Math.max(Ta(a+o,s,!1)-t.y,o===0?0:1)),t}}function Ta(t,e,r){if(!e)return t;var n=mi(t*2);return(n+mi(e))%2===0?n/2:(n+(r?1:-1))/2}var dk=(function(){function t(){this.x=0,this.y=0,this.width=0,this.height=0}return t})(),hk={},_t=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new dk},e.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=fg(hk,n,this.style);a=l.x,i=l.y,o=l.width,s=l.height,l.r=n.r,n=l}else a=n.x,i=n.y,o=n.width,s=n.height;n.r?fk(r,n):r.rect(a,i,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e})(qe);_t.prototype.type="rect";var dg={fill:"#000"},hg=2,pk={style:He({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},yl.style)},$t=(function(t){K(e,t);function e(r){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=dg,n.attr(r),n}return e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var r=0;r<this._children.length;r++){var n=this._children[r];n.zlevel=this.zlevel,n.z=this.z,n.z2=this.z2,n.culling=this.culling,n.cursor=this.cursor,n.invisible=this.invisible}},e.prototype.updateTransform=function(){var r=this.innerTransformable;r?(r.updateTransform(),r.transform&&(this.transform=r.transform)):t.prototype.updateTransform.call(this)},e.prototype.getLocalTransform=function(r){var n=this.innerTransformable;return n?n.getLocalTransform(r):t.prototype.getLocalTransform.call(this,r)},e.prototype.getComputedTransform=function(){return this.__hostTarget&&(this.__hostTarget.getComputedTransform(),this.__hostTarget.updateInnerText(!0)),t.prototype.getComputedTransform.call(this)},e.prototype._updateSubTexts=function(){this._childCursor=0,_k(this.style),this.style.rich?this._updateRichTexts():this._updatePlainTexts(),this._children.length=this._childCursor,this.styleUpdated()},e.prototype.addSelfToZr=function(r){t.prototype.addSelfToZr.call(this,r);for(var n=0;n<this._children.length;n++)this._children[n].__zr=r},e.prototype.removeSelfFromZr=function(r){t.prototype.removeSelfFromZr.call(this,r);for(var n=0;n<this._children.length;n++)this._children[n].__zr=null},e.prototype.getBoundingRect=function(){if(this.styleChanged()&&this._updateSubTexts(),!this._rect){for(var r=new Ge(0,0,0,0),n=this._children,a=[],i=null,o=0;o<n.length;o++){var s=n[o],l=s.getBoundingRect(),c=s.getLocalTransform(a);c?(r.copy(l),r.applyTransform(c),i=i||r.clone(),i.union(r)):(i=i||l.clone(),i.union(l))}this._rect=i||r}return this._rect},e.prototype.setDefaultTextStyle=function(r){this._defaultStyle=r||dg},e.prototype.setTextContent=function(r){},e.prototype._mergeStyle=function(r,n){if(!n)return r;var a=n.rich,i=r.rich||a&&{};return q(r,n),a&&i?(this._mergeRich(i,a),r.rich=i):i&&(r.rich=i),r},e.prototype._mergeRich=function(r,n){for(var a=at(n),i=0;i<a.length;i++){var o=a[i];r[o]=r[o]||{},q(r[o],n[o])}},e.prototype.getAnimationStyleProps=function(){return pk},e.prototype._getOrCreateChild=function(r){var n=this._children[this._childCursor];return(!n||!(n instanceof r))&&(n=new r),this._children[this._childCursor++]=n,n.__zr=this.__zr,n.parent=this,n},e.prototype._updatePlainTexts=function(){var r=this.style,n=r.font||sa,a=r.padding,i=bg(r),o=oS(i,r),s=Mf(r),l=!!r.backgroundColor,c=o.outerHeight,u=o.outerWidth,f=o.contentWidth,h=o.lines,d=o.lineHeight,p=this._defaultStyle;this.isTruncated=!!o.isTruncated;var m=r.x||0,g=r.y||0,v=r.align||p.align||"left",y=r.verticalAlign||p.verticalAlign||"top",b=m,x=oi(g,o.contentHeight,y);if(s||a){var w=uo(m,u,v),S=oi(g,c,y);s&&this._renderBackground(r,r,w,S,u,c)}x+=d/2,a&&(b=_g(m,v,a),y==="top"?x+=a[0]:y==="bottom"&&(x-=a[2]));for(var k=0,C=!1,A=yg("fill"in r?r.fill:(C=!0,p.fill)),M=mg("stroke"in r?r.stroke:!l&&(!p.autoStroke||C)?(k=hg,p.stroke):null),T=r.textShadowBlur>0,D=r.width!=null&&(r.overflow==="truncate"||r.overflow==="break"||r.overflow==="breakAll"),L=o.calculatedLineHeight,R=0;R<h.length;R++){var O=this._getOrCreateChild(Sl),B=O.createStyle();O.useStyle(B),B.text=h[R],B.x=b,B.y=x,B.textAlign=v,B.textBaseline="middle",B.opacity=r.opacity,B.strokeFirst=!0,T&&(B.shadowBlur=r.textShadowBlur||0,B.shadowColor=r.textShadowColor||"transparent",B.shadowOffsetX=r.textShadowOffsetX||0,B.shadowOffsetY=r.textShadowOffsetY||0),B.stroke=M,B.fill=A,M&&(B.lineWidth=r.lineWidth||k,B.lineDash=r.lineDash,B.lineDashOffset=r.lineDashOffset||0),B.font=n,vg(B,r),x+=d,D&&O.setBoundingRect(new Ge(uo(B.x,f,B.textAlign),oi(B.y,L,B.textBaseline),f,L))}},e.prototype._updateRichTexts=function(){var r=this.style,n=bg(r),a=cS(n,r),i=a.width,o=a.outerWidth,s=a.outerHeight,l=r.padding,c=r.x||0,u=r.y||0,f=this._defaultStyle,h=r.align||f.align,d=r.verticalAlign||f.verticalAlign;this.isTruncated=!!a.isTruncated;var p=uo(c,o,h),m=oi(u,s,d),g=p,v=m;l&&(g+=l[3],v+=l[0]);var y=g+i;Mf(r)&&this._renderBackground(r,r,p,m,o,s);for(var b=!!r.backgroundColor,x=0;x<a.lines.length;x++){for(var w=a.lines[x],S=w.tokens,k=S.length,C=w.lineHeight,A=w.width,M=0,T=g,D=y,L=k-1,R=void 0;M<k&&(R=S[M],!R.align||R.align==="left");)this._placeToken(R,r,C,v,T,"left",b),A-=R.width,T+=R.width,M++;for(;L>=0&&(R=S[L],R.align==="right");)this._placeToken(R,r,C,v,D,"right",b),A-=R.width,D-=R.width,L--;for(T+=(i-(T-g)-(y-D)-A)/2;M<=L;)R=S[M],this._placeToken(R,r,C,v,T+R.width/2,"center",b),T+=R.width,M++;v+=C}},e.prototype._placeToken=function(r,n,a,i,o,s,l){var c=n.rich[r.styleName]||{};c.text=r.text;var u=r.verticalAlign,f=i+a/2;u==="top"?f=i+r.height/2:u==="bottom"&&(f=i+a-r.height/2);var h=!r.isLineHolder&&Mf(c);h&&this._renderBackground(c,n,s==="right"?o-r.width:s==="center"?o-r.width/2:o,f-r.height/2,r.width,r.height);var d=!!c.backgroundColor,p=r.textPadding;p&&(o=_g(o,s,p),f-=r.height/2-p[0]-r.innerHeight/2);var m=this._getOrCreateChild(Sl),g=m.createStyle();m.useStyle(g);var v=this._defaultStyle,y=!1,b=0,x=yg("fill"in c?c.fill:"fill"in n?n.fill:(y=!0,v.fill)),w=mg("stroke"in c?c.stroke:"stroke"in n?n.stroke:!d&&!l&&(!v.autoStroke||y)?(b=hg,v.stroke):null),S=c.textShadowBlur>0||n.textShadowBlur>0;g.text=r.text,g.x=o,g.y=f,S&&(g.shadowBlur=c.textShadowBlur||n.textShadowBlur||0,g.shadowColor=c.textShadowColor||n.textShadowColor||"transparent",g.shadowOffsetX=c.textShadowOffsetX||n.textShadowOffsetX||0,g.shadowOffsetY=c.textShadowOffsetY||n.textShadowOffsetY||0),g.textAlign=s,g.textBaseline="middle",g.font=r.font||sa,g.opacity=Ys(c.opacity,n.opacity,1),vg(g,c),w&&(g.lineWidth=Ys(c.lineWidth,n.lineWidth,b),g.lineDash=Pe(c.lineDash,n.lineDash),g.lineDashOffset=n.lineDashOffset||0,g.stroke=w),x&&(g.fill=x);var k=r.contentWidth,C=r.contentHeight;m.setBoundingRect(new Ge(uo(g.x,k,g.textAlign),oi(g.y,C,g.textBaseline),k,C))},e.prototype._renderBackground=function(r,n,a,i,o,s){var l=r.backgroundColor,c=r.borderWidth,u=r.borderColor,f=l&&l.image,h=l&&!f,d=r.borderRadius,p=this,m,g;if(h||r.lineHeight||c&&u){m=this._getOrCreateChild(_t),m.useStyle(m.createStyle()),m.style.fill=null;var v=m.shape;v.x=a,v.y=i,v.width=o,v.height=s,v.r=d,m.dirtyShape()}if(h){var y=m.style;y.fill=l||null,y.fillOpacity=Pe(r.fillOpacity,1)}else if(f){g=this._getOrCreateChild(Fn),g.onload=function(){p.dirtyStyle()};var b=g.style;b.image=l.image,b.x=a,b.y=i,b.width=o,b.height=s}if(c&&u){var y=m.style;y.lineWidth=c,y.stroke=u,y.strokeOpacity=Pe(r.strokeOpacity,1),y.lineDash=r.borderDash,y.lineDashOffset=r.borderDashOffset||0,m.strokeContainThreshold=0,m.hasFill()&&m.hasStroke()&&(y.strokeFirst=!0,y.lineWidth*=2)}var x=(m||g).style;x.shadowBlur=r.shadowBlur||0,x.shadowColor=r.shadowColor||"transparent",x.shadowOffsetX=r.shadowOffsetX||0,x.shadowOffsetY=r.shadowOffsetY||0,x.opacity=Ys(r.opacity,n.opacity,1)},e.makeFont=function(r){var n="";return yk(r)&&(n=[r.fontStyle,r.fontWeight,mk(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),n&&Gr(n)||r.textFont||r.font},e})(yo),vk={left:!0,right:1,center:1},gk={top:1,bottom:1,middle:1},pg=["fontStyle","fontWeight","fontSize","fontFamily"];function mk(t){return typeof t=="string"&&(t.indexOf("px")!==-1||t.indexOf("rem")!==-1||t.indexOf("em")!==-1)?t:isNaN(+t)?Lu+"px":t+"px"}function vg(t,e){for(var r=0;r<pg.length;r++){var n=pg[r],a=e[n];a!=null&&(t[n]=a)}}function yk(t){return t.fontSize!=null||t.fontFamily||t.fontWeight}function _k(t){return gg(t),I(t.rich,gg),t}function gg(t){if(t){t.font=$t.makeFont(t);var e=t.align;e==="middle"&&(e="center"),t.align=e==null||vk[e]?e:"left";var r=t.verticalAlign;r==="center"&&(r="middle"),t.verticalAlign=r==null||gk[r]?r:"top";var n=t.padding;n&&(t.padding=_v(t.padding))}}function mg(t,e){return t==null||e<=0||t==="transparent"||t==="none"?null:t.image||t.colorStops?"#000":t}function yg(t){return t==null||t==="none"?null:t.image||t.colorStops?"#000":t}function _g(t,e,r){return e==="right"?t-r[1]:e==="center"?t+r[3]/2-r[1]/2:t+r[3]}function bg(t){var e=t.text;return e!=null&&(e+=""),e}function Mf(t){return!!(t.backgroundColor||t.lineHeight||t.borderWidth&&t.borderColor)}var xg=1e-4,wg=20;function bk(t){return t.replace(/^\s+|\s+$/g,"")}function Ca(t,e,r,n){var a=e[0],i=e[1],o=r[0],s=r[1],l=i-a,c=s-o;if(l===0)return c===0?o:(o+s)/2;if(n)if(l>0){if(t<=a)return o;if(t>=i)return s}else{if(t>=a)return o;if(t<=i)return s}else{if(t===a)return o;if(t===i)return s}return(t-a)/l*c+o}function Nt(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%";break}return ae(t)?bk(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):t==null?NaN:+t}function mt(t,e,r){return e==null&&(e=10),e=Math.min(Math.max(0,e),wg),t=(+t).toFixed(e),r?t:+t}function xk(t){return t.sort(function(e,r){return e-r}),t}function gn(t){if(t=+t,isNaN(t))return 0;if(t>1e-14){for(var e=1,r=0;r<15;r++,e*=10)if(Math.round(t*e)/e===t)return r}return wk(t)}function wk(t){var e=t.toString().toLowerCase(),r=e.indexOf("e"),n=r>0?+e.slice(r+1):0,a=r>0?r:e.length,i=e.indexOf("."),o=i<0?0:a-1-i;return Math.max(0,o-n)}function Sg(t,e){var r=Math.log,n=Math.LN10,a=Math.floor(r(t[1]-t[0])/n),i=Math.round(r(Math.abs(e[1]-e[0]))/n),o=Math.min(Math.max(-a+i,0),20);return isFinite(o)?o:20}function Sk(t,e){var r=Math.max(gn(t),gn(e)),n=t+e;return r>wg?n:mt(n,r)}function kg(t){var e=Math.PI*2;return(t%e+e)%e}function kl(t){return t>-xg&&t<xg}var kk=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function mn(t){if(t instanceof Date)return t;if(ae(t)){var e=kk.exec(t);if(!e)return new Date(NaN);if(e[8]){var r=+e[4]||0;return e[8].toUpperCase()!=="Z"&&(r-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,r,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}else return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0)}else if(t==null)return new Date(NaN);return new Date(Math.round(t))}function Tk(t){return Math.pow(10,Af(t))}function Af(t){if(t===0)return 0;var e=Math.floor(Math.log(t)/Math.LN10);return t/Math.pow(10,e)>=10&&e++,e}function Tg(t,e){var r=Af(t),n=Math.pow(10,r),a=t/n,i;return a<1.5?i=1:a<2.5?i=2:a<4?i=3:a<7?i=5:i=10,t=i*n,r>=-20?+t.toFixed(r<0?-r:0):t}function Tl(t){var e=parseFloat(t);return e==t&&(e!==0||!ae(t)||t.indexOf("x")<=0)?e:NaN}function Ck(t){return!isNaN(Tl(t))}function Cg(){return Math.round(Math.random()*9)}function Mg(t,e){return e===0?t:Mg(e,t%e)}function Ag(t,e){return t==null?e:e==null?t:t*e/Mg(t,e)}function Wt(t){throw new Error(t)}function Dg(t,e,r){return(e-t)*r+t}var Ig="series\0",Mk="\0_ec_\0";function Mt(t){return t instanceof Array?t:t==null?[]:[t]}function Lg(t,e,r){if(t){t[e]=t[e]||{},t.emphasis=t.emphasis||{},t.emphasis[e]=t.emphasis[e]||{};for(var n=0,a=r.length;n<a;n++){var i=r[n];!t.emphasis[e].hasOwnProperty(i)&&t[e].hasOwnProperty(i)&&(t.emphasis[e][i]=t[e][i])}}}var Pg=["fontStyle","fontWeight","fontSize","fontFamily","rich","tag","color","textBorderColor","textBorderWidth","width","height","lineHeight","align","verticalAlign","baseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function xo(t){return de(t)&&!ee(t)&&!(t instanceof Date)?t.value:t}function Ak(t){return de(t)&&!(t instanceof Array)}function Dk(t,e,r){var n=r==="normalMerge",a=r==="replaceMerge",i=r==="replaceAll";t=t||[],e=(e||[]).slice();var o=me();I(e,function(l,c){if(!de(l)){e[c]=null;return}});var s=Ik(t,o,r);return(n||a)&&Lk(s,t,o,e),n&&Pk(s,e),n||a?Rk(s,e,a):i&&Ek(s,e),Ok(s),s}function Ik(t,e,r){var n=[];if(r==="replaceAll")return n;for(var a=0;a<t.length;a++){var i=t[a];i&&i.id!=null&&e.set(i.id,a),n.push({existing:r==="replaceMerge"||So(i)?null:i,newOption:null,keyInfo:null,brandNew:null})}return n}function Lk(t,e,r,n){I(n,function(a,i){if(!(!a||a.id==null)){var o=wo(a.id),s=r.get(o);if(s!=null){var l=t[s];dn(!l.newOption,'Duplicated option on id "'+o+'".'),l.newOption=a,l.existing=e[s],n[i]=null}}})}function Pk(t,e){I(e,function(r,n){if(!(!r||r.name==null))for(var a=0;a<t.length;a++){var i=t[a].existing;if(!t[a].newOption&&i&&(i.id==null||r.id==null)&&!So(r)&&!So(i)&&Rg("name",i,r)){t[a].newOption=r,e[n]=null;return}}})}function Rk(t,e,r){I(e,function(n){if(n){for(var a,i=0;(a=t[i])&&(a.newOption||So(a.existing)||a.existing&&n.id!=null&&!Rg("id",n,a.existing));)i++;a?(a.newOption=n,a.brandNew=r):t.push({newOption:n,brandNew:r,existing:null,keyInfo:null}),i++}})}function Ek(t,e){I(e,function(r){t.push({newOption:r,brandNew:!0,existing:null,keyInfo:null})})}function Ok(t){var e=me();I(t,function(r){var n=r.existing;n&&e.set(n.id,r)}),I(t,function(r){var n=r.newOption;dn(!n||n.id==null||!e.get(n.id)||e.get(n.id)===r,"id duplicates: "+(n&&n.id)),n&&n.id!=null&&e.set(n.id,r),!r.keyInfo&&(r.keyInfo={})}),I(t,function(r,n){var a=r.existing,i=r.newOption,o=r.keyInfo;if(de(i)){if(o.name=i.name!=null?wo(i.name):a?a.name:Ig+n,a)o.id=wo(a.id);else if(i.id!=null)o.id=wo(i.id);else{var s=0;do o.id="\0"+o.name+"\0"+s++;while(e.get(o.id))}e.set(o.id,r)}})}function Rg(t,e,r){var n=Zr(e[t],null),a=Zr(r[t],null);return n!=null&&a!=null&&n===a}function wo(t){return Zr(t,"")}function Zr(t,e){return t==null?e:ae(t)?t:et(t)||Ou(t)?t+"":e}function Df(t){var e=t.name;return!!(e&&e.indexOf(Ig))}function So(t){return t&&t.id!=null&&wo(t.id).indexOf(Mk)===0}function Nk(t,e,r){I(t,function(n){var a=n.newOption;de(a)&&(n.keyInfo.mainType=e,n.keyInfo.subType=Bk(e,a,n.existing,r))})}function Bk(t,e,r,n){var a=e.type?e.type:r?r.subType:n.determineSubType(t,e);return a}function Ma(t,e){if(e.dataIndexInside!=null)return e.dataIndexInside;if(e.dataIndex!=null)return ee(e.dataIndex)?he(e.dataIndex,function(r){return t.indexOfRawIndex(r)}):t.indexOfRawIndex(e.dataIndex);if(e.name!=null)return ee(e.name)?he(e.name,function(r){return t.indexOfName(r)}):t.indexOfName(e.name)}function ht(){var t="__ec_inner_"+zk++;return function(e){return e[t]||(e[t]={})}}var zk=Cg();function If(t,e,r){var n=Lf(e,r),a=n.mainTypeSpecified,i=n.queryOptionMap,o=n.others,s=o,l=r?r.defaultMainType:null;return!a&&l&&i.set(l,{}),i.each(function(c,u){var f=ko(t,u,c,{useDefault:l===u,enableAll:r&&r.enableAll!=null?r.enableAll:!0,enableNone:r&&r.enableNone!=null?r.enableNone:!0});s[u+"Models"]=f.models,s[u+"Model"]=f.models[0]}),s}function Lf(t,e){var r;if(ae(t)){var n={};n[t+"Index"]=0,r=n}else r=t;var a=me(),i={},o=!1;return I(r,function(s,l){if(l==="dataIndex"||l==="dataIndexInside"){i[l]=s;return}var c=l.match(/^(\w+)(Index|Id|Name)$/)||[],u=c[1],f=(c[2]||"").toLowerCase();if(!(!u||!f||e&&e.includeMainTypes&&Ue(e.includeMainTypes,u)<0)){o=o||!!u;var h=a.get(u)||a.set(u,{});h[f]=s}}),{mainTypeSpecified:o,queryOptionMap:a,others:i}}var qt={useDefault:!0,enableAll:!1,enableNone:!1},Fk={useDefault:!1,enableAll:!0,enableNone:!0};function ko(t,e,r,n){n=n||qt;var a=r.index,i=r.id,o=r.name,s={models:null,specified:a!=null||i!=null||o!=null};if(!s.specified){var l=void 0;return s.models=n.useDefault&&(l=t.getComponent(e))?[l]:[],s}return a==="none"||a===!1?(dn(n.enableNone,'`"none"` or `false` is not a valid value on index option.'),s.models=[],s):(a==="all"&&(dn(n.enableAll,'`"all"` is not a valid value on index option.'),a=i=o=null),s.models=t.queryComponents({mainType:e,index:a,id:i,name:o}),s)}function Eg(t,e,r){t.setAttribute?t.setAttribute(e,r):t[e]=r}function Hk(t,e){return t.getAttribute?t.getAttribute(e):t[e]}function Vk(t){return t==="auto"?_e.domSupported?"html":"richText":t||"html"}function Uk(t,e,r,n,a){var i=e==null||e==="auto";if(n==null)return n;if(et(n)){var o=Dg(r||0,n,a);return mt(o,i?Math.max(gn(r||0),gn(n)):e)}else{if(ae(n))return a<1?r:n;for(var s=[],l=r,c=n,u=Math.max(l?l.length:0,c.length),f=0;f<u;++f){var h=t.getDimensionInfo(f);if(h&&h.type==="ordinal")s[f]=(a<1&&l?l:c)[f];else{var d=l&&l[f]?l[f]:0,p=c[f],o=Dg(d,p,a);s[f]=mt(o,i?Math.max(gn(d),gn(p)):e)}}return s}}var We=ht(),Gk=function(t,e,r,n){if(n){var a=We(n);a.dataIndex=r,a.dataType=e,a.seriesIndex=t,a.ssrType="chart",n.type==="group"&&n.traverse(function(i){var o=We(i);o.seriesIndex=t,o.dataIndex=r,o.dataType=e,o.ssrType="chart"})}},Og=1,Ng={},Bg=ht(),Pf=ht(),Rf=0,Cl=1,Ml=2,Kr=["emphasis","blur","select"],zg=["normal","emphasis","blur","select"],$k=10,Wk=9,Aa="highlight",Al="downplay",To="select",Dl="unselect",Co="toggleSelect";function yi(t){return t!=null&&t!=="none"}function Il(t,e,r){t.onHoverStateChange&&(t.hoverState||0)!==r&&t.onHoverStateChange(e),t.hoverState=r}function Fg(t){Il(t,"emphasis",Ml)}function Hg(t){t.hoverState===Ml&&Il(t,"normal",Rf)}function Ef(t){Il(t,"blur",Cl)}function Vg(t){t.hoverState===Cl&&Il(t,"normal",Rf)}function qk(t){t.selected=!0}function Yk(t){t.selected=!1}function Ug(t,e,r){e(t,r)}function yn(t,e,r){Ug(t,e,r),t.isGroup&&t.traverse(function(n){Ug(n,e,r)})}function Gg(t,e){switch(e){case"emphasis":t.hoverState=Ml;break;case"normal":t.hoverState=Rf;break;case"blur":t.hoverState=Cl;break;case"select":t.selected=!0}}function Xk(t,e,r,n){for(var a=t.style,i={},o=0;o<e.length;o++){var s=e[o],l=a[s];i[s]=l??(n&&n[s])}for(var o=0;o<t.animators.length;o++){var c=t.animators[o];c.__fromStateTransition&&c.__fromStateTransition.indexOf(r)<0&&c.targetName==="style"&&c.saveTo(i,e)}return i}function Zk(t,e,r,n){var a=r&&Ue(r,"select")>=0,i=!1;if(t instanceof qe){var o=Bg(t),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(yi(s)||yi(l)){n=n||{};var c=n.style||{};c.fill==="inherit"?(i=!0,n=q({},n),c=q({},c),c.fill=s):!yi(c.fill)&&yi(s)?(i=!0,n=q({},n),c=q({},c),c.fill=Kv(s)):!yi(c.stroke)&&yi(l)&&(i||(n=q({},n),c=q({},c)),c.stroke=Kv(l)),n.style=c}}if(n&&n.z2==null){i||(n=q({},n));var u=t.z2EmphasisLift;n.z2=t.z2+(u??$k)}return n}function Kk(t,e,r){if(r&&r.z2==null){r=q({},r);var n=t.z2SelectLift;r.z2=t.z2+(n??Wk)}return r}function jk(t,e,r){var n=Ue(t.currentStates,e)>=0,a=t.style.opacity,i=n?null:Xk(t,["opacity"],e,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=q({},r),o=q({opacity:n?a:i.opacity*.1},o),r.style=o),r}function Of(t,e){var r=this.states[t];if(this.style){if(t==="emphasis")return Zk(this,t,e,r);if(t==="blur")return jk(this,t,r);if(t==="select")return Kk(this,t,r)}return r}function Jk(t){t.stateProxy=Of;var e=t.getTextContent(),r=t.getTextGuideLine();e&&(e.stateProxy=Of),r&&(r.stateProxy=Of)}function $g(t,e){!Zg(t,e)&&!t.__highByOuter&&yn(t,Fg)}function Wg(t,e){!Zg(t,e)&&!t.__highByOuter&&yn(t,Hg)}function Ll(t,e){t.__highByOuter|=1<<(e||0),yn(t,Fg)}function Pl(t,e){!(t.__highByOuter&=~(1<<(e||0)))&&yn(t,Hg)}function Qk(t){yn(t,Ef)}function qg(t){yn(t,Vg)}function Yg(t){yn(t,qk)}function Xg(t){yn(t,Yk)}function Zg(t,e){return t.__highDownSilentOnTouch&&e.zrByTouch}function Kg(t){var e=t.getModel(),r=[],n=[];e.eachComponent(function(a,i){var o=Pf(i),s=a==="series",l=s?t.getViewOfSeriesModel(i):t.getViewOfComponentModel(i);!s&&n.push(l),o.isBlured&&(l.group.traverse(function(c){Vg(c)}),s&&r.push(i)),o.isBlured=!1}),I(n,function(a){a&&a.toggleBlurSeries&&a.toggleBlurSeries(r,!1,e)})}function Nf(t,e,r,n){var a=n.getModel();r=r||"coordinateSystem";function i(c,u){for(var f=0;f<u.length;f++){var h=c.getItemGraphicEl(u[f]);h&&qg(h)}}if(t!=null&&!(!e||e==="none")){var o=a.getSeriesByIndex(t),s=o.coordinateSystem;s&&s.master&&(s=s.master);var l=[];a.eachSeries(function(c){var u=o===c,f=c.coordinateSystem;f&&f.master&&(f=f.master);var h=f&&s?f===s:u;if(!(r==="series"&&!u||r==="coordinateSystem"&&!h||e==="series"&&u)){var d=n.getViewOfSeriesModel(c);if(d.group.traverse(function(g){g.__highByOuter&&u&&e==="self"||Ef(g)}),Vt(e))i(c.getData(),e);else if(de(e))for(var p=at(e),m=0;m<p.length;m++)i(c.getData(p[m]),e[p[m]]);l.push(c),Pf(c).isBlured=!0}}),a.eachComponent(function(c,u){if(c!=="series"){var f=n.getViewOfComponentModel(u);f&&f.toggleBlurSeries&&f.toggleBlurSeries(l,!0,a)}})}}function Bf(t,e,r){if(!(t==null||e==null)){var n=r.getModel().getComponent(t,e);if(n){Pf(n).isBlured=!0;var a=r.getViewOfComponentModel(n);!a||!a.focusBlurEnabled||a.group.traverse(function(i){Ef(i)})}}}function e2(t,e,r){var n=t.seriesIndex,a=t.getData(e.dataType);if(a){var i=Ma(a,e);i=(ee(i)?i[0]:i)||0;var o=a.getItemGraphicEl(i);if(!o)for(var s=a.count(),l=0;!o&&l<s;)o=a.getItemGraphicEl(l++);if(o){var c=We(o);Nf(n,c.focus,c.blurScope,r)}else{var u=t.get(["emphasis","focus"]),f=t.get(["emphasis","blurScope"]);u!=null&&Nf(n,u,f,r)}}}function zf(t,e,r,n){var a={focusSelf:!1,dispatchers:null};if(t==null||t==="series"||e==null||r==null)return a;var i=n.getModel().getComponent(t,e);if(!i)return a;var o=n.getViewOfComponentModel(i);if(!o||!o.findHighDownDispatchers)return a;for(var s=o.findHighDownDispatchers(r),l,c=0;c<s.length;c++)if(We(s[c]).focus==="self"){l=!0;break}return{focusSelf:l,dispatchers:s}}function t2(t,e,r){var n=We(t),a=zf(n.componentMainType,n.componentIndex,n.componentHighDownName,r),i=a.dispatchers,o=a.focusSelf;i?(o&&Bf(n.componentMainType,n.componentIndex,r),I(i,function(s){return $g(s,e)})):(Nf(n.seriesIndex,n.focus,n.blurScope,r),n.focus==="self"&&Bf(n.componentMainType,n.componentIndex,r),$g(t,e))}function r2(t,e,r){Kg(r);var n=We(t),a=zf(n.componentMainType,n.componentIndex,n.componentHighDownName,r).dispatchers;a?I(a,function(i){return Wg(i,e)}):Wg(t,e)}function n2(t,e,r){if(Uf(e)){var n=e.dataType,a=t.getData(n),i=Ma(a,e);ee(i)||(i=[i]),t[e.type===Co?"toggleSelect":e.type===To?"select":"unselect"](i,n)}}function jg(t){var e=t.getAllData();I(e,function(r){var n=r.data,a=r.type;n.eachItemGraphicEl(function(i,o){t.isSelected(o,a)?Yg(i):Xg(i)})})}function a2(t){var e=[];return t.eachSeries(function(r){var n=r.getAllData();I(n,function(a){a.data;var i=a.type,o=r.getSelectedDataIndices();if(o.length>0){var s={dataIndex:o,seriesIndex:r.seriesIndex};i!=null&&(s.dataType=i),e.push(s)}})}),e}function Ff(t,e,r){Qg(t,!0),yn(t,Jk),o2(t,e,r)}function i2(t){Qg(t,!1)}function Rl(t,e,r,n){n?i2(t):Ff(t,e,r)}function o2(t,e,r){var n=We(t);e!=null?(n.focus=e,n.blurScope=r):n.focus&&(n.focus=null)}var Jg=["emphasis","blur","select"],s2={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Hf(t,e,r,n){r=r||"itemStyle";for(var a=0;a<Jg.length;a++){var i=Jg[a],o=e.getModel([i,r]),s=t.ensureState(i);s.style=o[s2[r]]()}}function Qg(t,e){var r=e===!1,n=t;t.highDownSilentOnTouch&&(n.__highDownSilentOnTouch=t.highDownSilentOnTouch),(!r||n.__highDownDispatcher)&&(n.__highByOuter=n.__highByOuter||0,n.__highDownDispatcher=!r)}function Vf(t){return!!(t&&t.__highDownDispatcher)}function l2(t){var e=Ng[t];return e==null&&Og<=32&&(e=Ng[t]=Og++),e}function Uf(t){var e=t.type;return e===To||e===Dl||e===Co}function em(t){var e=t.type;return e===Aa||e===Al}function c2(t){var e=Bg(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var r=t.states.select||{};e.selectFill=r.style&&r.style.fill||null,e.selectStroke=r.style&&r.style.stroke||null}var _i=wa.CMD,u2=[[],[],[]],tm=Math.sqrt,f2=Math.atan2;function d2(t,e){if(e){var r=t.data,n=t.len(),a,i,o,s,l,c,u=_i.M,f=_i.C,h=_i.L,d=_i.R,p=_i.A,m=_i.Q;for(o=0,s=0;o<n;){switch(a=r[o++],s=o,i=0,a){case u:i=1;break;case h:i=1;break;case f:i=3;break;case m:i=2;break;case p:var g=e[4],v=e[5],y=tm(e[0]*e[0]+e[1]*e[1]),b=tm(e[2]*e[2]+e[3]*e[3]),x=f2(-e[1]/b,e[0]/y);r[o]*=y,r[o++]+=g,r[o]*=b,r[o++]+=v,r[o++]*=y,r[o++]*=b,r[o++]+=x,r[o++]+=x,o+=2,s=o;break;case d:c[0]=r[o++],c[1]=r[o++],dr(c,c,e),r[s++]=c[0],r[s++]=c[1],c[0]+=r[o++],c[1]+=r[o++],dr(c,c,e),r[s++]=c[0],r[s++]=c[1]}for(l=0;l<i;l++){var w=u2[l];w[0]=r[o++],w[1]=r[o++],dr(w,w,e),r[s++]=w[0],r[s++]=w[1]}}t.increaseVersion()}}var Gf=Math.sqrt,El=Math.sin,Ol=Math.cos,Mo=Math.PI;function rm(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function $f(t,e){return(t[0]*e[0]+t[1]*e[1])/(rm(t)*rm(e))}function nm(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos($f(t,e))}function am(t,e,r,n,a,i,o,s,l,c,u){var f=l*(Mo/180),h=Ol(f)*(t-r)/2+El(f)*(e-n)/2,d=-1*El(f)*(t-r)/2+Ol(f)*(e-n)/2,p=h*h/(o*o)+d*d/(s*s);p>1&&(o*=Gf(p),s*=Gf(p));var m=(a===i?-1:1)*Gf((o*o*(s*s)-o*o*(d*d)-s*s*(h*h))/(o*o*(d*d)+s*s*(h*h)))||0,g=m*o*d/s,v=m*-s*h/o,y=(t+r)/2+Ol(f)*g-El(f)*v,b=(e+n)/2+El(f)*g+Ol(f)*v,x=nm([1,0],[(h-g)/o,(d-v)/s]),w=[(h-g)/o,(d-v)/s],S=[(-1*h-g)/o,(-1*d-v)/s],k=nm(w,S);if($f(w,S)<=-1&&(k=Mo),$f(w,S)>=1&&(k=0),k<0){var C=Math.round(k/Mo*1e6)/1e6;k=Mo*2+C%2*Mo}u.addData(c,y,b,o,s,x,k,f,i)}var h2=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,p2=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function v2(t){var e=new wa;if(!t)return e;var r=0,n=0,a=r,i=n,o,s=wa.CMD,l=t.match(h2);if(!l)return e;for(var c=0;c<l.length;c++){for(var u=l[c],f=u.charAt(0),h=void 0,d=u.match(p2)||[],p=d.length,m=0;m<p;m++)d[m]=parseFloat(d[m]);for(var g=0;g<p;){var v=void 0,y=void 0,b=void 0,x=void 0,w=void 0,S=void 0,k=void 0,C=r,A=n,M=void 0,T=void 0;switch(f){case"l":r+=d[g++],n+=d[g++],h=s.L,e.addData(h,r,n);break;case"L":r=d[g++],n=d[g++],h=s.L,e.addData(h,r,n);break;case"m":r+=d[g++],n+=d[g++],h=s.M,e.addData(h,r,n),a=r,i=n,f="l";break;case"M":r=d[g++],n=d[g++],h=s.M,e.addData(h,r,n),a=r,i=n,f="L";break;case"h":r+=d[g++],h=s.L,e.addData(h,r,n);break;case"H":r=d[g++],h=s.L,e.addData(h,r,n);break;case"v":n+=d[g++],h=s.L,e.addData(h,r,n);break;case"V":n=d[g++],h=s.L,e.addData(h,r,n);break;case"C":h=s.C,e.addData(h,d[g++],d[g++],d[g++],d[g++],d[g++],d[g++]),r=d[g-2],n=d[g-1];break;case"c":h=s.C,e.addData(h,d[g++]+r,d[g++]+n,d[g++]+r,d[g++]+n,d[g++]+r,d[g++]+n),r+=d[g-2],n+=d[g-1];break;case"S":v=r,y=n,M=e.len(),T=e.data,o===s.C&&(v+=r-T[M-4],y+=n-T[M-3]),h=s.C,C=d[g++],A=d[g++],r=d[g++],n=d[g++],e.addData(h,v,y,C,A,r,n);break;case"s":v=r,y=n,M=e.len(),T=e.data,o===s.C&&(v+=r-T[M-4],y+=n-T[M-3]),h=s.C,C=r+d[g++],A=n+d[g++],r+=d[g++],n+=d[g++],e.addData(h,v,y,C,A,r,n);break;case"Q":C=d[g++],A=d[g++],r=d[g++],n=d[g++],h=s.Q,e.addData(h,C,A,r,n);break;case"q":C=d[g++]+r,A=d[g++]+n,r+=d[g++],n+=d[g++],h=s.Q,e.addData(h,C,A,r,n);break;case"T":v=r,y=n,M=e.len(),T=e.data,o===s.Q&&(v+=r-T[M-4],y+=n-T[M-3]),r=d[g++],n=d[g++],h=s.Q,e.addData(h,v,y,r,n);break;case"t":v=r,y=n,M=e.len(),T=e.data,o===s.Q&&(v+=r-T[M-4],y+=n-T[M-3]),r+=d[g++],n+=d[g++],h=s.Q,e.addData(h,v,y,r,n);break;case"A":b=d[g++],x=d[g++],w=d[g++],S=d[g++],k=d[g++],C=r,A=n,r=d[g++],n=d[g++],h=s.A,am(C,A,r,n,S,k,b,x,w,h,e);break;case"a":b=d[g++],x=d[g++],w=d[g++],S=d[g++],k=d[g++],C=r,A=n,r+=d[g++],n+=d[g++],h=s.A,am(C,A,r,n,S,k,b,x,w,h,e);break}}(f==="z"||f==="Z")&&(h=s.Z,e.addData(h),r=a,n=i),o=h}return e.toStatic(),e}var im=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.applyTransform=function(r){},e})(qe);function om(t){return t.setData!=null}function sm(t,e){var r=v2(t),n=q({},e);return n.buildPath=function(a){if(om(a)){a.setData(r.data);var i=a.getContext();i&&a.rebuildPath(i,1)}else{var i=a;r.rebuildPath(i,1)}},n.applyTransform=function(a){d2(r,a),this.dirtyShape()},n}function g2(t,e){return new im(sm(t,e))}function m2(t,e){var r=sm(t,e),n=(function(a){K(i,a);function i(o){var s=a.call(this,o)||this;return s.applyTransform=r.applyTransform,s.buildPath=r.buildPath,s}return i})(im);return n}function y2(t,e){for(var r=[],n=t.length,a=0;a<n;a++){var i=t[a];r.push(i.getUpdatedPathProxy(!0))}var o=new qe(e);return o.createPathProxy(),o.buildPath=function(s){if(om(s)){s.appendPath(r);var l=s.getContext();l&&s.rebuildPath(l,1)}},o}var St=(function(t){K(e,t);function e(r){var n=t.call(this)||this;return n.isGroup=!0,n._children=[],n.attr(r),n}return e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(r){return this._children[r]},e.prototype.childOfName=function(r){for(var n=this._children,a=0;a<n.length;a++)if(n[a].name===r)return n[a]},e.prototype.childCount=function(){return this._children.length},e.prototype.add=function(r){return r&&r!==this&&r.parent!==this&&(this._children.push(r),this._doAdd(r)),this},e.prototype.addBefore=function(r,n){if(r&&r!==this&&r.parent!==this&&n&&n.parent===this){var a=this._children,i=a.indexOf(n);i>=0&&(a.splice(i,0,r),this._doAdd(r))}return this},e.prototype.replace=function(r,n){var a=Ue(this._children,r);return a>=0&&this.replaceAt(n,a),this},e.prototype.replaceAt=function(r,n){var a=this._children,i=a[n];if(r&&r!==this&&r.parent!==this&&r!==i){a[n]=r,i.parent=null;var o=this.__zr;o&&i.removeSelfFromZr(o),this._doAdd(r)}return this},e.prototype._doAdd=function(r){r.parent&&r.parent.remove(r),r.parent=this;var n=this.__zr;n&&n!==r.__zr&&r.addSelfToZr(n),n&&n.refresh()},e.prototype.remove=function(r){var n=this.__zr,a=this._children,i=Ue(a,r);return i<0?this:(a.splice(i,1),r.parent=null,n&&r.removeSelfFromZr(n),n&&n.refresh(),this)},e.prototype.removeAll=function(){for(var r=this._children,n=this.__zr,a=0;a<r.length;a++){var i=r[a];n&&i.removeSelfFromZr(n),i.parent=null}return r.length=0,this},e.prototype.eachChild=function(r,n){for(var a=this._children,i=0;i<a.length;i++){var o=a[i];r.call(n,o,i)}return this},e.prototype.traverse=function(r,n){for(var a=0;a<this._children.length;a++){var i=this._children[a],o=r.call(n,i);i.isGroup&&!o&&i.traverse(r,n)}return this},e.prototype.addSelfToZr=function(r){t.prototype.addSelfToZr.call(this,r);for(var n=0;n<this._children.length;n++){var a=this._children[n];a.addSelfToZr(r)}},e.prototype.removeSelfFromZr=function(r){t.prototype.removeSelfFromZr.call(this,r);for(var n=0;n<this._children.length;n++){var a=this._children[n];a.removeSelfFromZr(r)}},e.prototype.getBoundingRect=function(r){for(var n=new Ge(0,0,0,0),a=r||this._children,i=[],o=null,s=0;s<a.length;s++){var l=a[s];if(!(l.ignore||l.invisible)){var c=l.getBoundingRect(),u=l.getLocalTransform(i);u?(Ge.applyTransform(n,c,u),o=o||n.clone(),o.union(n)):(o=o||c.clone(),o.union(c))}}return o||n},e})(ml);St.prototype.type="group";var _2=(function(){function t(){this.cx=0,this.cy=0,this.r=0}return t})(),Nl=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new _2},e.prototype.buildPath=function(r,n){r.moveTo(n.cx+n.r,n.cy),r.arc(n.cx,n.cy,n.r,0,Math.PI*2)},e})(qe);Nl.prototype.type="circle";var b2=(function(){function t(){this.cx=0,this.cy=0,this.rx=0,this.ry=0}return t})(),Wf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new b2},e.prototype.buildPath=function(r,n){var a=.5522848,i=n.cx,o=n.cy,s=n.rx,l=n.ry,c=s*a,u=l*a;r.moveTo(i-s,o),r.bezierCurveTo(i-s,o-u,i-c,o-l,i,o-l),r.bezierCurveTo(i+c,o-l,i+s,o-u,i+s,o),r.bezierCurveTo(i+s,o+u,i+c,o+l,i,o+l),r.bezierCurveTo(i-c,o+l,i-s,o+u,i-s,o),r.closePath()},e})(qe);Wf.prototype.type="ellipse";var lm=Math.PI,qf=lm*2,Da=Math.sin,bi=Math.cos,x2=Math.acos,At=Math.atan2,cm=Math.abs,Ao=Math.sqrt,Do=Math.max,jr=Math.min,Lr=1e-4;function w2(t,e,r,n,a,i,o,s){var l=r-t,c=n-e,u=o-a,f=s-i,h=f*l-u*c;if(!(h*h<Lr))return h=(u*(e-i)-f*(t-a))/h,[t+h*l,e+h*c]}function Bl(t,e,r,n,a,i,o){var s=t-r,l=e-n,c=(o?i:-i)/Ao(s*s+l*l),u=c*l,f=-c*s,h=t+u,d=e+f,p=r+u,m=n+f,g=(h+p)/2,v=(d+m)/2,y=p-h,b=m-d,x=y*y+b*b,w=a-i,S=h*m-p*d,k=(b<0?-1:1)*Ao(Do(0,w*w*x-S*S)),C=(S*b-y*k)/x,A=(-S*y-b*k)/x,M=(S*b+y*k)/x,T=(-S*y+b*k)/x,D=C-g,L=A-v,R=M-g,O=T-v;return D*D+L*L>R*R+O*O&&(C=M,A=T),{cx:C,cy:A,x0:-u,y0:-f,x1:C*(a/w-1),y1:A*(a/w-1)}}function S2(t){var e;if(ee(t)){var r=t.length;if(!r)return t;r===1?e=[t[0],t[0],0,0]:r===2?e=[t[0],t[0],t[1],t[1]]:r===3?e=t.concat(t[2]):e=t}else e=[t,t,t,t];return e}function k2(t,e){var r,n=Do(e.r,0),a=Do(e.r0||0,0),i=n>0,o=a>0;if(!(!i&&!o)){if(i||(n=a,a=0),a>n){var s=n;n=a,a=s}var l=e.startAngle,c=e.endAngle;if(!(isNaN(l)||isNaN(c))){var u=e.cx,f=e.cy,h=!!e.clockwise,d=cm(c-l),p=d>qf&&d%qf;if(p>Lr&&(d=p),!(n>Lr))t.moveTo(u,f);else if(d>qf-Lr)t.moveTo(u+n*bi(l),f+n*Da(l)),t.arc(u,f,n,l,c,!h),a>Lr&&(t.moveTo(u+a*bi(c),f+a*Da(c)),t.arc(u,f,a,c,l,h));else{var m=void 0,g=void 0,v=void 0,y=void 0,b=void 0,x=void 0,w=void 0,S=void 0,k=void 0,C=void 0,A=void 0,M=void 0,T=void 0,D=void 0,L=void 0,R=void 0,O=n*bi(l),B=n*Da(l),j=a*bi(c),P=a*Da(c),V=d>Lr;if(V){var H=e.cornerRadius;H&&(r=S2(H),m=r[0],g=r[1],v=r[2],y=r[3]);var Z=cm(n-a)/2;if(b=jr(Z,v),x=jr(Z,y),w=jr(Z,m),S=jr(Z,g),A=k=Do(b,x),M=C=Do(w,S),(k>Lr||C>Lr)&&(T=n*bi(c),D=n*Da(c),L=a*bi(l),R=a*Da(l),d<lm)){var re=w2(O,B,L,R,T,D,j,P);if(re){var Te=O-re[0],ge=B-re[1],xe=T-re[0],Ce=D-re[1],be=1/Da(x2((Te*xe+ge*Ce)/(Ao(Te*Te+ge*ge)*Ao(xe*xe+Ce*Ce)))/2),it=Ao(re[0]*re[0]+re[1]*re[1]);A=jr(k,(n-it)/(be+1)),M=jr(C,(a-it)/(be-1))}}}if(!V)t.moveTo(u+O,f+B);else if(A>Lr){var Qe=jr(v,A),ze=jr(y,A),oe=Bl(L,R,O,B,n,Qe,h),pe=Bl(T,D,j,P,n,ze,h);t.moveTo(u+oe.cx+oe.x0,f+oe.cy+oe.y0),A<k&&Qe===ze?t.arc(u+oe.cx,f+oe.cy,A,At(oe.y0,oe.x0),At(pe.y0,pe.x0),!h):(Qe>0&&t.arc(u+oe.cx,f+oe.cy,Qe,At(oe.y0,oe.x0),At(oe.y1,oe.x1),!h),t.arc(u,f,n,At(oe.cy+oe.y1,oe.cx+oe.x1),At(pe.cy+pe.y1,pe.cx+pe.x1),!h),ze>0&&t.arc(u+pe.cx,f+pe.cy,ze,At(pe.y1,pe.x1),At(pe.y0,pe.x0),!h))}else t.moveTo(u+O,f+B),t.arc(u,f,n,l,c,!h);if(!(a>Lr)||!V)t.lineTo(u+j,f+P);else if(M>Lr){var Qe=jr(m,M),ze=jr(g,M),oe=Bl(j,P,T,D,a,-ze,h),pe=Bl(O,B,L,R,a,-Qe,h);t.lineTo(u+oe.cx+oe.x0,f+oe.cy+oe.y0),M<C&&Qe===ze?t.arc(u+oe.cx,f+oe.cy,M,At(oe.y0,oe.x0),At(pe.y0,pe.x0),!h):(ze>0&&t.arc(u+oe.cx,f+oe.cy,ze,At(oe.y0,oe.x0),At(oe.y1,oe.x1),!h),t.arc(u,f,a,At(oe.cy+oe.y1,oe.cx+oe.x1),At(pe.cy+pe.y1,pe.cx+pe.x1),h),Qe>0&&t.arc(u+pe.cx,f+pe.cy,Qe,At(pe.y1,pe.x1),At(pe.y0,pe.x0),!h))}else t.lineTo(u+j,f+P),t.arc(u,f,a,c,l,h)}t.closePath()}}}var T2=(function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return t})(),xi=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new T2},e.prototype.buildPath=function(r,n){k2(r,n)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e})(qe);xi.prototype.type="sector";var C2=(function(){function t(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return t})(),Yf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new C2},e.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.PI*2;r.moveTo(a+n.r,i),r.arc(a,i,n.r,0,o,!1),r.moveTo(a+n.r0,i),r.arc(a,i,n.r0,0,o,!0)},e})(qe);Yf.prototype.type="ring";function M2(t,e,r,n){var a=[],i=[],o=[],s=[],l,c,u,f;if(n){u=[1/0,1/0],f=[-1/0,-1/0];for(var h=0,d=t.length;h<d;h++)ci(u,u,t[h]),ui(f,f,t[h]);ci(u,u,n[0]),ui(f,f,n[1])}for(var h=0,d=t.length;h<d;h++){var p=t[h];if(r)l=t[h?h-1:d-1],c=t[(h+1)%d];else if(h===0||h===d-1){a.push(hS(t[h]));continue}else l=t[h-1],c=t[h+1];pS(i,c,l),Xu(i,i,e);var m=Zu(p,l),g=Zu(p,c),v=m+g;v!==0&&(m/=v,g/=v),Xu(o,i,-m),Xu(s,i,g);var y=Ev([],p,o),b=Ev([],p,s);n&&(ui(y,y,u),ci(y,y,f),ui(b,b,u),ci(b,b,f)),a.push(y),a.push(b)}return r&&a.push(a.shift()),a}function um(t,e,r){var n=e.smooth,a=e.points;if(a&&a.length>=2){if(n){var i=M2(a,n,r,e.smoothConstraint);t.moveTo(a[0][0],a[0][1]);for(var o=a.length,s=0;s<(r?o:o-1);s++){var l=i[s*2],c=i[s*2+1],u=a[(s+1)%o];t.bezierCurveTo(l[0],l[1],c[0],c[1],u[0],u[1])}}else{t.moveTo(a[0][0],a[0][1]);for(var s=1,f=a.length;s<f;s++)t.lineTo(a[s][0],a[s][1])}r&&t.closePath()}}var A2=(function(){function t(){this.points=null,this.smooth=0,this.smoothConstraint=null}return t})(),Xf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new A2},e.prototype.buildPath=function(r,n){um(r,n,!0)},e})(qe);Xf.prototype.type="polygon";var D2=(function(){function t(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null}return t})(),Zf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new D2},e.prototype.buildPath=function(r,n){um(r,n,!1)},e})(qe);Zf.prototype.type="polyline";var I2={},L2=(function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1}return t})(),Hn=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new L2},e.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=ug(I2,n,this.style);a=l.x1,i=l.y1,o=l.x2,s=l.y2}else a=n.x1,i=n.y1,o=n.x2,s=n.y2;var c=n.percent;c!==0&&(r.moveTo(a,i),c<1&&(o=a*(1-c)+o*c,s=i*(1-c)+s*c),r.lineTo(o,s))},e.prototype.pointAt=function(r){var n=this.shape;return[n.x1*(1-r)+n.x2*r,n.y1*(1-r)+n.y2*r]},e})(qe);Hn.prototype.type="line";var Yt=[],P2=(function(){function t(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1}return t})();function fm(t,e,r){var n=t.cpx2,a=t.cpy2;return n!=null||a!=null?[(r?Hv:wt)(t.x1,t.cpx1,t.cpx2,t.x2,e),(r?Hv:wt)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(r?Uv:Gt)(t.x1,t.cpx1,t.x2,e),(r?Uv:Gt)(t.y1,t.cpy1,t.y2,e)]}var Kf=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new P2},e.prototype.buildPath=function(r,n){var a=n.x1,i=n.y1,o=n.x2,s=n.y2,l=n.cpx1,c=n.cpy1,u=n.cpx2,f=n.cpy2,h=n.percent;h!==0&&(r.moveTo(a,i),u==null||f==null?(h<1&&(il(a,l,o,h,Yt),l=Yt[1],o=Yt[2],il(i,c,s,h,Yt),c=Yt[1],s=Yt[2]),r.quadraticCurveTo(l,c,o,s)):(h<1&&(al(a,l,u,o,h,Yt),l=Yt[1],u=Yt[2],o=Yt[3],al(i,c,f,s,h,Yt),c=Yt[1],f=Yt[2],s=Yt[3]),r.bezierCurveTo(l,c,u,f,o,s)))},e.prototype.pointAt=function(r){return fm(this.shape,r,!1)},e.prototype.tangentAt=function(r){var n=fm(this.shape,r,!0);return mS(n,n)},e})(qe);Kf.prototype.type="bezier-curve";var R2=(function(){function t(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return t})(),zl=(function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new R2},e.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.max(n.r,0),s=n.startAngle,l=n.endAngle,c=n.clockwise,u=Math.cos(s),f=Math.sin(s);r.moveTo(u*o+a,f*o+i),r.arc(a,i,o,s,l,!c)},e})(qe);zl.prototype.type="arc";var E2=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="compound",r}return e.prototype._updatePathDirty=function(){for(var r=this.shape.paths,n=this.shapeChanged(),a=0;a<r.length;a++)n=n||r[a].shapeChanged();n&&this.dirtyShape()},e.prototype.beforeBrush=function(){this._updatePathDirty();for(var r=this.shape.paths||[],n=this.getGlobalScale(),a=0;a<r.length;a++)r[a].path||r[a].createPathProxy(),r[a].path.setScale(n[0],n[1],r[a].segmentIgnoreThreshold)},e.prototype.buildPath=function(r,n){for(var a=n.paths||[],i=0;i<a.length;i++)a[i].buildPath(r,a[i].shape,!0)},e.prototype.afterBrush=function(){for(var r=this.shape.paths||[],n=0;n<r.length;n++)r[n].pathUpdated()},e.prototype.getBoundingRect=function(){return this._updatePathDirty.call(this),qe.prototype.getBoundingRect.call(this)},e})(qe),dm=(function(){function t(e){this.colorStops=e||[]}return t.prototype.addColorStop=function(e,r){this.colorStops.push({offset:e,color:r})},t})(),hm=(function(t){K(e,t);function e(r,n,a,i,o,s){var l=t.call(this,o)||this;return l.x=r??0,l.y=n??0,l.x2=a??1,l.y2=i??0,l.type="linear",l.global=s||!1,l}return e})(dm),O2=(function(t){K(e,t);function e(r,n,a,i,o){var s=t.call(this,i)||this;return s.x=r??.5,s.y=n??.5,s.r=a??.5,s.type="radial",s.global=o||!1,s}return e})(dm),Ia=[0,0],La=[0,0],Fl=new Je,Hl=new Je,Vl=(function(){function t(e,r){this._corners=[],this._axes=[],this._origin=[0,0];for(var n=0;n<4;n++)this._corners[n]=new Je;for(var n=0;n<2;n++)this._axes[n]=new Je;e&&this.fromBoundingRect(e,r)}return t.prototype.fromBoundingRect=function(e,r){var n=this._corners,a=this._axes,i=e.x,o=e.y,s=i+e.width,l=o+e.height;if(n[0].set(i,o),n[1].set(s,o),n[2].set(s,l),n[3].set(i,l),r)for(var c=0;c<4;c++)n[c].transform(r);Je.sub(a[0],n[1],n[0]),Je.sub(a[1],n[3],n[0]),a[0].normalize(),a[1].normalize();for(var c=0;c<2;c++)this._origin[c]=a[c].dot(n[0])},t.prototype.intersect=function(e,r){var n=!0,a=!r;return Fl.set(1/0,1/0),Hl.set(0,0),!this._intersectCheckOneSide(this,e,Fl,Hl,a,1)&&(n=!1,a)||!this._intersectCheckOneSide(e,this,Fl,Hl,a,-1)&&(n=!1,a)||a||Je.copy(r,n?Fl:Hl),n},t.prototype._intersectCheckOneSide=function(e,r,n,a,i,o){for(var s=!0,l=0;l<2;l++){var c=this._axes[l];if(this._getProjMinMaxOnAxis(l,e._corners,Ia),this._getProjMinMaxOnAxis(l,r._corners,La),Ia[1]<La[0]||Ia[0]>La[1]){if(s=!1,i)return s;var u=Math.abs(La[0]-Ia[1]),f=Math.abs(Ia[0]-La[1]);Math.min(u,f)>a.len()&&(u<f?Je.scale(a,c,-u*o):Je.scale(a,c,f*o))}else if(n){var u=Math.abs(La[0]-Ia[1]),f=Math.abs(Ia[0]-La[1]);Math.min(u,f)<n.len()&&(u<f?Je.scale(n,c,u*o):Je.scale(n,c,-f*o))}}return s},t.prototype._getProjMinMaxOnAxis=function(e,r,n){for(var a=this._axes[e],i=this._origin,o=r[0].dot(a)+i[e],s=o,l=o,c=1;c<r.length;c++){var u=r[c].dot(a)+i[e];s=Math.min(u,s),l=Math.max(u,l)}n[0]=s,n[1]=l},t})(),N2=[],B2=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.notClear=!0,r.incremental=!0,r._displayables=[],r._temporaryDisplayables=[],r._cursor=0,r}return e.prototype.traverse=function(r,n){r.call(n,this)},e.prototype.useStyle=function(){this.style={}},e.prototype.getCursor=function(){return this._cursor},e.prototype.innerAfterBrush=function(){this._cursor=this._displayables.length},e.prototype.clearDisplaybles=function(){this._displayables=[],this._temporaryDisplayables=[],this._cursor=0,this.markRedraw(),this.notClear=!1},e.prototype.clearTemporalDisplayables=function(){this._temporaryDisplayables=[]},e.prototype.addDisplayable=function(r,n){n?this._temporaryDisplayables.push(r):this._displayables.push(r),this.markRedraw()},e.prototype.addDisplayables=function(r,n){n=n||!1;for(var a=0;a<r.length;a++)this.addDisplayable(r[a],n)},e.prototype.getDisplayables=function(){return this._displayables},e.prototype.getTemporalDisplayables=function(){return this._temporaryDisplayables},e.prototype.eachPendingDisplayable=function(r){for(var n=this._cursor;n<this._displayables.length;n++)r&&r(this._displayables[n]);for(var n=0;n<this._temporaryDisplayables.length;n++)r&&r(this._temporaryDisplayables[n])},e.prototype.update=function(){this.updateTransform();for(var r=this._cursor;r<this._displayables.length;r++){var n=this._displayables[r];n.parent=this,n.update(),n.parent=null}for(var r=0;r<this._temporaryDisplayables.length;r++){var n=this._temporaryDisplayables[r];n.parent=this,n.update(),n.parent=null}},e.prototype.getBoundingRect=function(){if(!this._rect){for(var r=new Ge(1/0,1/0,-1/0,-1/0),n=0;n<this._displayables.length;n++){var a=this._displayables[n],i=a.getBoundingRect().clone();a.needLocalTransform()&&i.applyTransform(a.getLocalTransform(N2)),r.union(i)}this._rect=r}return this._rect},e.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(i.contain(a[0],a[1]))for(var o=0;o<this._displayables.length;o++){var s=this._displayables[o];if(s.contain(r,n))return!0}return!1},e})(yo),z2=ht();function F2(t,e,r,n,a){var i;if(e&&e.ecModel){var o=e.ecModel.getUpdatePayload();i=o&&o.animation}var s=e&&e.isAnimationEnabled(),l=t==="update";if(s){var c=void 0,u=void 0,f=void 0;n?(c=Pe(n.duration,200),u=Pe(n.easing,"cubicOut"),f=0):(c=e.getShallow(l?"animationDurationUpdate":"animationDuration"),u=e.getShallow(l?"animationEasingUpdate":"animationEasing"),f=e.getShallow(l?"animationDelayUpdate":"animationDelay")),i&&(i.duration!=null&&(c=i.duration),i.easing!=null&&(u=i.easing),i.delay!=null&&(f=i.delay)),ke(f)&&(f=f(r,a)),ke(c)&&(c=c(r));var h={duration:c||0,delay:f,easing:u};return h}else return null}function jf(t,e,r,n,a,i,o){var s=!1,l;ke(a)?(o=i,i=a,a=null):de(a)&&(i=a.cb,o=a.during,s=a.isFrom,l=a.removeOpt,a=a.dataIndex);var c=t==="leave";c||e.stopAnimation("leave");var u=F2(t,n,a,c?l||{}:null,n&&n.getAnimationDelayParams?n.getAnimationDelayParams(e,a):null);if(u&&u.duration>0){var f=u.duration,h=u.delay,d=u.easing,p={duration:f,delay:h||0,easing:d,done:i,force:!!i||!!o,setToFinal:!c,scope:t,during:o};s?e.animateFrom(r,p):e.animateTo(r,p)}else e.stopAnimation(),!s&&e.attr(r),o&&o(1),i&&i()}function or(t,e,r,n,a,i){jf("update",t,e,r,n,a,i)}function _n(t,e,r,n,a,i){jf("enter",t,e,r,n,a,i)}function Io(t){if(!t.__zr)return!0;for(var e=0;e<t.animators.length;e++){var r=t.animators[e];if(r.scope==="leave")return!0}return!1}function Ul(t,e,r,n,a,i){Io(t)||jf("leave",t,e,r,n,a,i)}function pm(t,e,r,n){t.removeTextContent(),t.removeTextGuideLine(),Ul(t,{style:{opacity:0}},e,r,n)}function Jf(t,e,r){function n(){t.parent&&t.parent.remove(t)}t.isGroup?t.traverse(function(a){a.isGroup||pm(a,e,r,n)}):pm(t,e,r,n)}function vm(t){z2(t).oldStyle=t.style}var Gl=Math.max,$l=Math.min,Qf={};function H2(t){return qe.extend(t)}var V2=m2;function U2(t,e){return V2(t,e)}function Pr(t,e){Qf[t]=e}function G2(t){if(Qf.hasOwnProperty(t))return Qf[t]}function ed(t,e,r,n){var a=g2(t,e);return r&&(n==="center"&&(r=mm(r,a.getBoundingRect())),ym(a,r)),a}function gm(t,e,r){var n=new Fn({style:{image:t,x:e.x,y:e.y,width:e.width,height:e.height},onload:function(a){if(r==="center"){var i={width:a.width,height:a.height};n.setStyle(mm(e,i))}}});return n}function mm(t,e){var r=e.width/e.height,n=t.height*r,a;n<=t.width?a=t.height:(n=t.width,a=n/r);var i=t.x+t.width/2,o=t.y+t.height/2;return{x:i-n/2,y:o-a/2,width:n,height:a}}var $2=y2;function ym(t,e){if(t.applyTransform){var r=t.getBoundingRect(),n=r.calculateTransform(e);t.applyTransform(n)}}function Lo(t,e){return ug(t,t,{lineWidth:e}),t}function W2(t){return fg(t.shape,t.shape,t.style),t}var q2=Ta;function Y2(t,e){for(var r=Hu([]);t&&t!==e;)ii(r,t.getLocalTransform(),r),t=t.parent;return r}function td(t,e,r){return e&&!Vt(e)&&(e=Ju.getLocalTransform(e)),r&&(e=Gu([],e)),dr([],t,e)}function X2(t,e,r){var n=e[4]===0||e[5]===0||e[0]===0?1:Math.abs(2*e[4]/e[0]),a=e[4]===0||e[5]===0||e[2]===0?1:Math.abs(2*e[4]/e[2]),i=[t==="left"?-n:t==="right"?n:0,t==="top"?-a:t==="bottom"?a:0];return i=td(i,e,r),Math.abs(i[0])>Math.abs(i[1])?i[0]>0?"right":"left":i[1]>0?"bottom":"top"}function _m(t){return!t.isGroup}function Z2(t){return t.shape!=null}function bm(t,e,r){if(!t||!e)return;function n(o){var s={};return o.traverse(function(l){_m(l)&&l.anid&&(s[l.anid]=l)}),s}function a(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Z2(o)&&(s.shape=q({},o.shape)),s}var i=n(t);e.traverse(function(o){if(_m(o)&&o.anid){var s=i[o.anid];if(s){var l=a(o);o.attr(a(s)),or(o,l,r,We(o).dataIndex)}}})}function K2(t,e){return he(t,function(r){var n=r[0];n=Gl(n,e.x),n=$l(n,e.x+e.width);var a=r[1];return a=Gl(a,e.y),a=$l(a,e.y+e.height),[n,a]})}function j2(t,e){var r=Gl(t.x,e.x),n=$l(t.x+t.width,e.x+e.width),a=Gl(t.y,e.y),i=$l(t.y+t.height,e.y+e.height);if(n>=r&&i>=a)return{x:r,y:a,width:n-r,height:i-a}}function rd(t,e,r){var n=q({rectHover:!0},e),a=n.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},t)return t.indexOf("image://")===0?(a.image=t.slice(8),He(a,r),new Fn(n)):ed(t.replace("path://",""),n,r,"center")}function J2(t,e,r,n,a){for(var i=0,o=a[a.length-1];i<a.length;i++){var s=a[i];if(xm(t,e,r,n,s[0],s[1],o[0],o[1]))return!0;o=s}}function xm(t,e,r,n,a,i,o,s){var l=r-t,c=n-e,u=o-a,f=s-i,h=nd(u,f,l,c);if(Q2(h))return!1;var d=t-a,p=e-i,m=nd(d,p,l,c)/h;if(m<0||m>1)return!1;var g=nd(d,p,u,f)/h;return!(g<0||g>1)}function nd(t,e,r,n){return t*n-r*e}function Q2(t){return t<=1e-6&&t>=-1e-6}function Wl(t){var e=t.itemTooltipOption,r=t.componentModel,n=t.itemName,a=ae(e)?{formatter:e}:e,i=r.mainType,o=r.componentIndex,s={componentType:i,name:n,$vars:["name"]};s[i+"Index"]=o;var l=t.formatterParamsExtra;l&&I(at(l),function(u){la(s,u)||(s[u]=l[u],s.$vars.push(u))});var c=We(t.el);c.componentMainType=i,c.componentIndex=o,c.tooltipConfig={name:n,option:He({content:n,encodeHTMLContent:!0,formatterParams:s},a)}}function wm(t,e){var r;t.isGroup&&(r=e(t)),r||t.traverse(e)}function ql(t,e){if(t)if(ee(t))for(var r=0;r<t.length;r++)wm(t[r],e);else wm(t,e)}Pr("circle",Nl),Pr("ellipse",Wf),Pr("sector",xi),Pr("ring",Yf),Pr("polygon",Xf),Pr("polyline",Zf),Pr("rect",_t),Pr("line",Hn),Pr("bezierCurve",Kf),Pr("arc",zl);const eT=Object.freeze(Object.defineProperty({__proto__:null,Arc:zl,BezierCurve:Kf,BoundingRect:Ge,Circle:Nl,CompoundPath:E2,Ellipse:Wf,Group:St,Image:Fn,IncrementalDisplayable:B2,Line:Hn,LinearGradient:hm,OrientedBoundingRect:Vl,Path:qe,Point:Je,Polygon:Xf,Polyline:Zf,RadialGradient:O2,Rect:_t,Ring:Yf,Sector:xi,Text:$t,applyTransform:td,clipPointsByRect:K2,clipRectByRect:j2,createIcon:rd,extendPath:U2,extendShape:H2,getShapeClass:G2,getTransform:Y2,groupTransition:bm,initProps:_n,isElementRemoved:Io,lineLineIntersect:xm,linePolygonIntersect:J2,makeImage:gm,makePath:ed,mergePath:$2,registerShape:Pr,removeElement:Ul,removeElementWithFadeOut:Jf,resizePath:ym,setTooltipConfig:Wl,subPixelOptimize:q2,subPixelOptimizeLine:Lo,subPixelOptimizeRect:W2,transformDirection:X2,traverseElements:ql,updateProps:or},Symbol.toStringTag,{value:"Module"}));var Yl={};function tT(t,e){for(var r=0;r<Kr.length;r++){var n=Kr[r],a=e[n],i=t.ensureState(n);i.style=i.style||{},i.style.text=a}var o=t.currentStates.slice();t.clearStates(!0),t.setStyle({text:e.normal}),t.useStates(o,!0)}function Sm(t,e,r){var n=t.labelFetcher,a=t.labelDataIndex,i=t.labelDimIndex,o=e.normal,s;n&&(s=n.getFormattedLabel(a,"normal",null,i,o&&o.get("formatter"),r!=null?{interpolatedValue:r}:null)),s==null&&(s=ke(t.defaultText)?t.defaultText(a,t,r):t.defaultText);for(var l={normal:s},c=0;c<Kr.length;c++){var u=Kr[c],f=e[u];l[u]=Pe(n?n.getFormattedLabel(a,u,null,i,f&&f.get("formatter")):null,s)}return l}function Xl(t,e,r,n){r=r||Yl;for(var a=t instanceof $t,i=!1,o=0;o<zg.length;o++){var s=e[zg[o]];if(s&&s.getShallow("show")){i=!0;break}}var l=a?t:t.getTextContent();if(i){a||(l||(l=new $t,t.setTextContent(l)),t.stateProxy&&(l.stateProxy=t.stateProxy));var c=Sm(r,e),u=e.normal,f=!!u.getShallow("show"),h=wi(u,n&&n.normal,r,!1,!a);h.text=c.normal,a||t.setTextConfig(km(u,r,!1));for(var o=0;o<Kr.length;o++){var d=Kr[o],s=e[d];if(s){var p=l.ensureState(d),m=!!Pe(s.getShallow("show"),f);if(m!==f&&(p.ignore=!m),p.style=wi(s,n&&n[d],r,!0,!a),p.style.text=c[d],!a){var g=t.ensureState(d);g.textConfig=km(s,r,!0)}}}l.silent=!!u.getShallow("silent"),l.style.x!=null&&(h.x=l.style.x),l.style.y!=null&&(h.y=l.style.y),l.ignore=!f,l.useStyle(h),l.dirty(),r.enableTextSetter&&(Kl(l).setLabelText=function(v){var y=Sm(r,e,v);tT(l,y)})}else l&&(l.ignore=!0);t.dirty()}function Zl(t,e){e=e||"label";for(var r={normal:t.getModel(e)},n=0;n<Kr.length;n++){var a=Kr[n];r[a]=t.getModel([a,e])}return r}function wi(t,e,r,n,a){var i={};return rT(i,t,r,n,a),e&&q(i,e),i}function km(t,e,r){e=e||{};var n={},a,i=t.getShallow("rotate"),o=Pe(t.getShallow("distance"),r?null:5),s=t.getShallow("offset");return a=t.getShallow("position")||(r?null:"inside"),a==="outside"&&(a=e.defaultOutsidePosition||"top"),a!=null&&(n.position=a),s!=null&&(n.offset=s),i!=null&&(i*=Math.PI/180,n.rotation=i),o!=null&&(n.distance=o),n.outsideFill=t.get("color")==="inherit"?e.inheritColor||null:"auto",n}function rT(t,e,r,n,a){r=r||Yl;var i=e.ecModel,o=i&&i.option.textStyle,s=nT(e),l;if(s){l={};for(var c in s)if(s.hasOwnProperty(c)){var u=e.getModel(["rich",c]);Am(l[c]={},u,o,r,n,a,!1,!0)}}l&&(t.rich=l);var f=e.get("overflow");f&&(t.overflow=f);var h=e.get("minMargin");h!=null&&(t.margin=h),Am(t,e,o,r,n,a,!0,!1)}function nT(t){for(var e;t&&t!==t.ecModel;){var r=(t.option||Yl).rich;if(r){e=e||{};for(var n=at(r),a=0;a<n.length;a++){var i=n[a];e[i]=1}}t=t.parentModel}return e}var Tm=["fontStyle","fontWeight","fontSize","fontFamily","textShadowColor","textShadowBlur","textShadowOffsetX","textShadowOffsetY"],Cm=["align","lineHeight","width","height","tag","verticalAlign","ellipsis"],Mm=["padding","borderWidth","borderRadius","borderDashOffset","backgroundColor","borderColor","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];function Am(t,e,r,n,a,i,o,s){r=!a&&r||Yl;var l=n&&n.inheritColor,c=e.getShallow("color"),u=e.getShallow("textBorderColor"),f=Pe(e.getShallow("opacity"),r.opacity);(c==="inherit"||c==="auto")&&(l?c=l:c=null),(u==="inherit"||u==="auto")&&(l?u=l:u=null),i||(c=c||r.color,u=u||r.textBorderColor),c!=null&&(t.fill=c),u!=null&&(t.stroke=u);var h=Pe(e.getShallow("textBorderWidth"),r.textBorderWidth);h!=null&&(t.lineWidth=h);var d=Pe(e.getShallow("textBorderType"),r.textBorderType);d!=null&&(t.lineDash=d);var p=Pe(e.getShallow("textBorderDashOffset"),r.textBorderDashOffset);p!=null&&(t.lineDashOffset=p),!a&&f==null&&!s&&(f=n&&n.defaultOpacity),f!=null&&(t.opacity=f),!a&&!i&&t.fill==null&&n.inheritColor&&(t.fill=n.inheritColor);for(var m=0;m<Tm.length;m++){var g=Tm[m],v=Pe(e.getShallow(g),r[g]);v!=null&&(t[g]=v)}for(var m=0;m<Cm.length;m++){var g=Cm[m],v=e.getShallow(g);v!=null&&(t[g]=v)}if(t.verticalAlign==null){var y=e.getShallow("baseline");y!=null&&(t.verticalAlign=y)}if(!o||!n.disableBox){for(var m=0;m<Mm.length;m++){var g=Mm[m],v=e.getShallow(g);v!=null&&(t[g]=v)}var b=e.getShallow("borderType");b!=null&&(t.borderDash=b),(t.backgroundColor==="auto"||t.backgroundColor==="inherit")&&l&&(t.backgroundColor=l),(t.borderColor==="auto"||t.borderColor==="inherit")&&l&&(t.borderColor=l)}}function aT(t,e){var r=e&&e.getModel("textStyle");return Gr([t.fontStyle||r&&r.getShallow("fontStyle")||"",t.fontWeight||r&&r.getShallow("fontWeight")||"",(t.fontSize||r&&r.getShallow("fontSize")||12)+"px",t.fontFamily||r&&r.getShallow("fontFamily")||"sans-serif"].join(" "))}var Kl=ht();function iT(t,e,r,n){if(t){var a=Kl(t);a.prevValue=a.value,a.value=r;var i=e.normal;a.valueAnimation=i.get("valueAnimation"),a.valueAnimation&&(a.precision=i.get("precision"),a.defaultInterpolatedText=n,a.statesModels=e)}}var oT=["textStyle","color"],ad=["fontStyle","fontWeight","fontSize","fontFamily","padding","lineHeight","rich","width","height","overflow"],id=new $t,sT=(function(){function t(){}return t.prototype.getTextColor=function(e){var r=this.ecModel;return this.getShallow("color")||(!e&&r?r.get(oT):null)},t.prototype.getFont=function(){return aT({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},t.prototype.getTextRect=function(e){for(var r={text:e,verticalAlign:this.getShallow("verticalAlign")||this.getShallow("baseline")},n=0;n<ad.length;n++)r[ad[n]]=this.getShallow(ad[n]);return id.useStyle(r),id.update(),id.getBoundingRect()},t})(),Dm=[["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","type"],["lineDashOffset","dashOffset"],["lineCap","cap"],["lineJoin","join"],["miterLimit"]],lT=oo(Dm),cT=(function(){function t(){}return t.prototype.getLineStyle=function(e){return lT(this,e)},t})(),Im=[["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","borderType"],["lineDashOffset","borderDashOffset"],["lineCap","borderCap"],["lineJoin","borderJoin"],["miterLimit","borderMiterLimit"]],uT=oo(Im),fT=(function(){function t(){}return t.prototype.getItemStyle=function(e,r){return uT(this,e,r)},t})(),lt=(function(){function t(e,r,n){this.parentModel=r,this.ecModel=n,this.option=e}return t.prototype.init=function(e,r,n){},t.prototype.mergeOption=function(e,r){Oe(this.option,e,!0)},t.prototype.get=function(e,r){return e==null?this.option:this._doGet(this.parsePath(e),!r&&this.parentModel)},t.prototype.getShallow=function(e,r){var n=this.option,a=n==null?n:n[e];if(a==null&&!r){var i=this.parentModel;i&&(a=i.getShallow(e))}return a},t.prototype.getModel=function(e,r){var n=e!=null,a=n?this.parsePath(e):null,i=n?this._doGet(a):this.option;return r=r||this.parentModel&&this.parentModel.getModel(this.resolveParentPath(a)),new t(i,r,this.ecModel)},t.prototype.isEmpty=function(){return this.option==null},t.prototype.restoreData=function(){},t.prototype.clone=function(){var e=this.constructor;return new e(Ie(this.option))},t.prototype.parsePath=function(e){return typeof e=="string"?e.split("."):e},t.prototype.resolveParentPath=function(e){return e},t.prototype.isAnimationEnabled=function(){if(!_e.node&&this.option){if(this.option.animation!=null)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}},t.prototype._doGet=function(e,r){var n=this.option;if(!e)return n;for(var a=0;a<e.length&&!(e[a]&&(n=n&&typeof n=="object"?n[e[a]]:null,n==null));a++);return n==null&&r&&(n=r._doGet(this.resolveParentPath(e),r.parentModel)),n},t})();zu(lt),Xw(lt),Ur(lt,cT),Ur(lt,fT),Ur(lt,Qw),Ur(lt,sT);function Po(t){return t==null?0:t.length||1}function Lm(t){return t}var dT=(function(){function t(e,r,n,a,i,o){this._old=e,this._new=r,this._oldKeyGetter=n||Lm,this._newKeyGetter=a||Lm,this.context=i,this._diffModeMultiple=o==="multiple"}return t.prototype.add=function(e){return this._add=e,this},t.prototype.update=function(e){return this._update=e,this},t.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},t.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},t.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},t.prototype.remove=function(e){return this._remove=e,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var e=this._old,r=this._new,n={},a=new Array(e.length),i=new Array(r.length);this._initIndexMap(e,null,a,"_oldKeyGetter"),this._initIndexMap(r,n,i,"_newKeyGetter");for(var o=0;o<e.length;o++){var s=a[o],l=n[s],c=Po(l);if(c>1){var u=l.shift();l.length===1&&(n[s]=l[0]),this._update&&this._update(u,o)}else c===1?(n[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(i,n)},t.prototype._executeMultiple=function(){var e=this._old,r=this._new,n={},a={},i=[],o=[];this._initIndexMap(e,n,i,"_oldKeyGetter"),this._initIndexMap(r,a,o,"_newKeyGetter");for(var s=0;s<i.length;s++){var l=i[s],c=n[l],u=a[l],f=Po(c),h=Po(u);if(f>1&&h===1)this._updateManyToOne&&this._updateManyToOne(u,c),a[l]=null;else if(f===1&&h>1)this._updateOneToMany&&this._updateOneToMany(u,c),a[l]=null;else if(f===1&&h===1)this._update&&this._update(u,c),a[l]=null;else if(f>1&&h>1)this._updateManyToMany&&this._updateManyToMany(u,c),a[l]=null;else if(f>1)for(var d=0;d<f;d++)this._remove&&this._remove(c[d]);else this._remove&&this._remove(c)}this._performRestAdd(o,a)},t.prototype._performRestAdd=function(e,r){for(var n=0;n<e.length;n++){var a=e[n],i=r[a],o=Po(i);if(o>1)for(var s=0;s<o;s++)this._add&&this._add(i[s]);else o===1&&this._add&&this._add(i);r[a]=null}},t.prototype._initIndexMap=function(e,r,n,a){for(var i=this._diffModeMultiple,o=0;o<e.length;o++){var s="_ec_"+this[a](e[o],o);if(i||(n[o]=s),!!r){var l=r[s],c=Po(l);c===0?(r[s]=o,i&&n.push(s)):c===1?r[s]=[l,o]:l.push(o)}}},t})(),Pm=me(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),yr="original",Xt="arrayRows",Jr="objectRows",bn="keyedColumns",Vn="typedArray",Rm="unknown",xn="column",Si="row",sr={Must:1,Might:2,Not:3},Em=ht();function hT(t){Em(t).datasetMap=me()}function pT(t,e,r){var n={},a=Om(e);if(!a||!t)return n;var i=[],o=[],s=e.ecModel,l=Em(s).datasetMap,c=a.uid+"_"+r.seriesLayoutBy,u,f;t=t.slice(),I(t,function(m,g){var v=de(m)?m:t[g]={name:m};v.type==="ordinal"&&u==null&&(u=g,f=p(v)),n[v.name]=[]});var h=l.get(c)||l.set(c,{categoryWayDim:f,valueWayDim:0});I(t,function(m,g){var v=m.name,y=p(m);if(u==null){var b=h.valueWayDim;d(n[v],b,y),d(o,b,y),h.valueWayDim+=y}else if(u===g)d(n[v],0,y),d(i,0,y);else{var b=h.categoryWayDim;d(n[v],b,y),d(o,b,y),h.categoryWayDim+=y}});function d(m,g,v){for(var y=0;y<v;y++)m.push(g+y)}function p(m){var g=m.dimsDef;return g?g.length:1}return i.length&&(n.itemName=i),o.length&&(n.seriesName=o),n}function Om(t){var e=t.get("data",!0);if(!e)return ko(t.ecModel,"dataset",{index:t.get("datasetIndex",!0),id:t.get("datasetId",!0)},qt).models[0]}function vT(t){return!t.get("transform",!0)&&!t.get("fromTransformResult",!0)?[]:ko(t.ecModel,"dataset",{index:t.get("fromDatasetIndex",!0),id:t.get("fromDatasetId",!0)},qt).models}function Nm(t,e){return gT(t.data,t.sourceFormat,t.seriesLayoutBy,t.dimensionsDefine,t.startIndex,e)}function gT(t,e,r,n,a,i){var o,s=5;if(Ut(t))return sr.Not;var l,c;if(n){var u=n[i];de(u)?(l=u.name,c=u.type):ae(u)&&(l=u)}if(c!=null)return c==="ordinal"?sr.Must:sr.Not;if(e===Xt){var f=t;if(r===Si){for(var h=f[i],d=0;d<(h||[]).length&&d<s;d++)if((o=x(h[a+d]))!=null)return o}else for(var d=0;d<f.length&&d<s;d++){var p=f[a+d];if(p&&(o=x(p[i]))!=null)return o}}else if(e===Jr){var m=t;if(!l)return sr.Not;for(var d=0;d<m.length&&d<s;d++){var g=m[d];if(g&&(o=x(g[l]))!=null)return o}}else if(e===bn){var v=t;if(!l)return sr.Not;var h=v[l];if(!h||Ut(h))return sr.Not;for(var d=0;d<h.length&&d<s;d++)if((o=x(h[d]))!=null)return o}else if(e===yr)for(var y=t,d=0;d<y.length&&d<s;d++){var g=y[d],b=xo(g);if(!ee(b))return sr.Not;if((o=x(b[i]))!=null)return o}function x(w){var S=ae(w);if(w!=null&&Number.isFinite(Number(w))&&w!=="")return S?sr.Might:sr.Not;if(S&&w!=="-")return sr.Must}return sr.Not}var jl=(function(){function t(e){this.data=e.data||(e.sourceFormat===bn?{}:[]),this.sourceFormat=e.sourceFormat||Rm,this.seriesLayoutBy=e.seriesLayoutBy||xn,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var r=this.dimensionsDefine=e.dimensionsDefine;if(r)for(var n=0;n<r.length;n++){var a=r[n];a.type==null&&Nm(this,n)===sr.Must&&(a.type="ordinal")}}return t})();function od(t){return t instanceof jl}function sd(t,e,r){r=r||zm(t);var n=e.seriesLayoutBy,a=yT(t,r,n,e.sourceHeader,e.dimensions),i=new jl({data:t,sourceFormat:r,seriesLayoutBy:n,dimensionsDefine:a.dimensionsDefine,startIndex:a.startIndex,dimensionsDetectedCount:a.dimensionsDetectedCount,metaRawOption:Ie(e)});return i}function Bm(t){return new jl({data:t,sourceFormat:Ut(t)?Vn:yr})}function mT(t){return new jl({data:t.data,sourceFormat:t.sourceFormat,seriesLayoutBy:t.seriesLayoutBy,dimensionsDefine:Ie(t.dimensionsDefine),startIndex:t.startIndex,dimensionsDetectedCount:t.dimensionsDetectedCount})}function zm(t){var e=Rm;if(Ut(t))e=Vn;else if(ee(t)){t.length===0&&(e=Xt);for(var r=0,n=t.length;r<n;r++){var a=t[r];if(a!=null){if(ee(a)||Ut(a)){e=Xt;break}else if(de(a)){e=Jr;break}}}}else if(de(t)){for(var i in t)if(la(t,i)&&Vt(t[i])){e=bn;break}}return e}function yT(t,e,r,n,a){var i,o;if(!t)return{dimensionsDefine:Fm(a),startIndex:o,dimensionsDetectedCount:i};if(e===Xt){var s=t;n==="auto"||n==null?Hm(function(c){c!=null&&c!=="-"&&(ae(c)?o==null&&(o=1):o=0)},r,s,10):o=et(n)?n:n?1:0,!a&&o===1&&(a=[],Hm(function(c,u){a[u]=c!=null?c+"":""},r,s,1/0)),i=a?a.length:r===Si?s.length:s[0]?s[0].length:null}else if(e===Jr)a||(a=_T(t));else if(e===bn)a||(a=[],I(t,function(c,u){a.push(u)}));else if(e===yr){var l=xo(t[0]);i=ee(l)&&l.length||1}return{startIndex:o,dimensionsDefine:Fm(a),dimensionsDetectedCount:i}}function _T(t){for(var e=0,r;e<t.length&&!(r=t[e++]););if(r)return at(r)}function Fm(t){if(t){var e=me();return he(t,function(r,n){r=de(r)?r:{name:r};var a={name:r.name,displayName:r.displayName,type:r.type};if(a.name==null)return a;a.name+="",a.displayName==null&&(a.displayName=a.name);var i=e.get(a.name);return i?a.name+="-"+i.count++:e.set(a.name,{count:1}),a})}}function Hm(t,e,r,n){if(e===Si)for(var a=0;a<r.length&&a<n;a++)t(r[a]?r[a][0]:null,a);else for(var i=r[0]||[],a=0;a<i.length&&a<n;a++)t(i[a],a)}function Vm(t){var e=t.sourceFormat;return e===Jr||e===bn}var Pa,Ra,Ea,Um,Gm,$m=(function(){function t(e,r){var n=od(e)?e:Bm(e);this._source=n;var a=this._data=n.data;n.sourceFormat===Vn&&(this._offset=0,this._dimSize=r,this._data=a),Gm(this,a,n)}return t.prototype.getSource=function(){return this._source},t.prototype.count=function(){return 0},t.prototype.getItem=function(e,r){},t.prototype.appendData=function(e){},t.prototype.clean=function(){},t.protoInitialize=(function(){var e=t.prototype;e.pure=!1,e.persistent=!0})(),t.internalField=(function(){var e;Gm=function(o,s,l){var c=l.sourceFormat,u=l.seriesLayoutBy,f=l.startIndex,h=l.dimensionsDefine,d=Um[cd(c,u)];if(q(o,d),c===Vn)o.getItem=r,o.count=a,o.fillStorage=n;else{var p=qm(c,u);o.getItem=Ne(p,null,s,f,h);var m=Xm(c,u);o.count=Ne(m,null,s,f,h)}};var r=function(o,s){o=o-this._offset,s=s||[];for(var l=this._data,c=this._dimSize,u=c*o,f=0;f<c;f++)s[f]=l[u+f];return s},n=function(o,s,l,c){for(var u=this._data,f=this._dimSize,h=0;h<f;h++){for(var d=c[h],p=d[0]==null?1/0:d[0],m=d[1]==null?-1/0:d[1],g=s-o,v=l[h],y=0;y<g;y++){var b=u[y*f+h];v[o+y]=b,b<p&&(p=b),b>m&&(m=b)}d[0]=p,d[1]=m}},a=function(){return this._data?this._data.length/this._dimSize:0};Um=(e={},e[Xt+"_"+xn]={pure:!0,appendData:i},e[Xt+"_"+Si]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[Jr]={pure:!0,appendData:i},e[bn]={pure:!0,appendData:function(o){var s=this._data;I(o,function(l,c){for(var u=s[c]||(s[c]=[]),f=0;f<(l||[]).length;f++)u.push(l[f])})}},e[yr]={appendData:i},e[Vn]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},e);function i(o){for(var s=0;s<o.length;s++)this._data.push(o[s])}})(),t})(),Wm=function(t,e,r,n){return t[n]},bT=(Pa={},Pa[Xt+"_"+xn]=function(t,e,r,n){return t[n+e]},Pa[Xt+"_"+Si]=function(t,e,r,n,a){n+=e;for(var i=a||[],o=t,s=0;s<o.length;s++){var l=o[s];i[s]=l?l[n]:null}return i},Pa[Jr]=Wm,Pa[bn]=function(t,e,r,n,a){for(var i=a||[],o=0;o<r.length;o++){var s=r[o].name,l=t[s];i[o]=l?l[n]:null}return i},Pa[yr]=Wm,Pa);function qm(t,e){var r=bT[cd(t,e)];return r}var Ym=function(t,e,r){return t.length},xT=(Ra={},Ra[Xt+"_"+xn]=function(t,e,r){return Math.max(0,t.length-e)},Ra[Xt+"_"+Si]=function(t,e,r){var n=t[0];return n?Math.max(0,n.length-e):0},Ra[Jr]=Ym,Ra[bn]=function(t,e,r){var n=r[0].name,a=t[n];return a?a.length:0},Ra[yr]=Ym,Ra);function Xm(t,e){var r=xT[cd(t,e)];return r}var ld=function(t,e,r){return t[e]},wT=(Ea={},Ea[Xt]=ld,Ea[Jr]=function(t,e,r){return t[r]},Ea[bn]=ld,Ea[yr]=function(t,e,r){var n=xo(t);return n instanceof Array?n[e]:n},Ea[Vn]=ld,Ea);function Zm(t){var e=wT[t];return e}function cd(t,e){return t===Xt?t+"_"+e:t}function ki(t,e,r){if(t){var n=t.getRawDataItem(e);if(n!=null){var a=t.getStore(),i=a.getSource().sourceFormat;if(r!=null){var o=t.getDimensionIndex(r),s=a.getDimensionProperty(o);return Zm(i)(n,o,s)}else{var l=n;return i===yr&&(l=xo(n)),l}}}}var ST=(function(){function t(e,r){this._encode=e,this._schema=r}return t.prototype.get=function(){return{fullDimensions:this._getFullDimensionNames(),encode:this._encode}},t.prototype._getFullDimensionNames=function(){return this._cachedDimNames||(this._cachedDimNames=this._schema?this._schema.makeOutputDimensionNames():[]),this._cachedDimNames},t})();function kT(t,e){var r={},n=r.encode={},a=me(),i=[],o=[],s={};I(t.dimensions,function(h){var d=t.getDimensionInfo(h),p=d.coordDim;if(p){var m=d.coordDimIndex;ud(n,p)[m]=h,d.isExtraCoord||(a.set(p,1),CT(d.type)&&(i[0]=h),ud(s,p)[m]=t.getDimensionIndex(d.name)),d.defaultTooltip&&o.push(h)}Pm.each(function(g,v){var y=ud(n,v),b=d.otherDims[v];b!=null&&b!==!1&&(y[b]=d.name)})});var l=[],c={};a.each(function(h,d){var p=n[d];c[d]=p[0],l=l.concat(p)}),r.dataDimsOnCoord=l,r.dataDimIndicesOnCoord=he(l,function(h){return t.getDimensionInfo(h).storeDimIndex}),r.encodeFirstDimNotExtra=c;var u=n.label;u&&u.length&&(i=u.slice());var f=n.tooltip;return f&&f.length?o=f.slice():o.length||(o=i.slice()),n.defaultedLabel=i,n.defaultedTooltip=o,r.userOutput=new ST(s,e),r}function ud(t,e){return t.hasOwnProperty(e)||(t[e]=[]),t[e]}function TT(t){return t==="category"?"ordinal":t==="time"?"time":"float"}function CT(t){return!(t==="ordinal"||t==="time")}var Jl=(function(){function t(e){this.otherDims={},e!=null&&q(this,e)}return t})();function Ql(t,e){var r=e&&e.type;return r==="ordinal"?t:(r==="time"&&!et(t)&&t!=null&&t!=="-"&&(t=+mn(t)),t==null||t===""?NaN:Number(t))}me({number:function(t){return parseFloat(t)},time:function(t){return+mn(t)},trim:function(t){return ae(t)?Gr(t):t}});var MT=(function(){function t(e,r){var n=e==="desc";this._resultLT=n?1:-1,r==null&&(r=n?"min":"max"),this._incomparable=r==="min"?-1/0:1/0}return t.prototype.evaluate=function(e,r){var n=et(e)?e:Tl(e),a=et(r)?r:Tl(r),i=isNaN(n),o=isNaN(a);if(i&&(n=this._incomparable),o&&(a=this._incomparable),i&&o){var s=ae(e),l=ae(r);s&&(n=l?e:0),l&&(a=s?r:0)}return n<a?this._resultLT:n>a?-this._resultLT:0},t})(),ec="undefined",AT=typeof Uint32Array===ec?Array:Uint32Array,DT=typeof Uint16Array===ec?Array:Uint16Array,Km=typeof Int32Array===ec?Array:Int32Array,jm=typeof Float64Array===ec?Array:Float64Array,Jm={float:jm,int:Km,ordinal:Array,number:Array,time:jm},fd;function Ti(t){return t>65535?AT:DT}function Ci(){return[1/0,-1/0]}function IT(t){var e=t.constructor;return e===Array?t.slice():new e(t)}function Qm(t,e,r,n,a){var i=Jm[r||"float"];if(a){var o=t[e],s=o&&o.length;if(s!==n){for(var l=new i(n),c=0;c<s;c++)l[c]=o[c];t[e]=l}}else t[e]=new i(n)}var dd=(function(){function t(){this._chunks=[],this._rawExtent=[],this._extent=[],this._count=0,this._rawCount=0,this._calcDimNameToIdx=me()}return t.prototype.initData=function(e,r,n){this._provider=e,this._chunks=[],this._indices=null,this.getRawIndex=this._getRawIdxIdentity;var a=e.getSource(),i=this.defaultDimValueGetter=fd[a.sourceFormat];this._dimValueGetter=n||i,this._rawExtent=[],Vm(a),this._dimensions=he(r,function(o){return{type:o.type,property:o.property}}),this._initDataFromProvider(0,e.count())},t.prototype.getProvider=function(){return this._provider},t.prototype.getSource=function(){return this._provider.getSource()},t.prototype.ensureCalculationDimension=function(e,r){var n=this._calcDimNameToIdx,a=this._dimensions,i=n.get(e);if(i!=null){if(a[i].type===r)return i}else i=a.length;return a[i]={type:r},n.set(e,i),this._chunks[i]=new Jm[r||"float"](this._rawCount),this._rawExtent[i]=Ci(),i},t.prototype.collectOrdinalMeta=function(e,r){var n=this._chunks[e],a=this._dimensions[e],i=this._rawExtent,o=a.ordinalOffset||0,s=n.length;o===0&&(i[e]=Ci());for(var l=i[e],c=o;c<s;c++){var u=n[c]=r.parseAndCollect(n[c]);isNaN(u)||(l[0]=Math.min(u,l[0]),l[1]=Math.max(u,l[1]))}a.ordinalMeta=r,a.ordinalOffset=s,a.type="ordinal"},t.prototype.getOrdinalMeta=function(e){var r=this._dimensions[e],n=r.ordinalMeta;return n},t.prototype.getDimensionProperty=function(e){var r=this._dimensions[e];return r&&r.property},t.prototype.appendData=function(e){var r=this._provider,n=this.count();r.appendData(e);var a=r.count();return r.persistent||(a+=n),n<a&&this._initDataFromProvider(n,a,!0),[n,a]},t.prototype.appendValues=function(e,r){for(var n=this._chunks,a=this._dimensions,i=a.length,o=this._rawExtent,s=this.count(),l=s+Math.max(e.length,r||0),c=0;c<i;c++){var u=a[c];Qm(n,c,u.type,l,!0)}for(var f=[],h=s;h<l;h++)for(var d=h-s,p=0;p<i;p++){var u=a[p],m=fd.arrayRows.call(this,e[d]||f,u.property,d,p);n[p][h]=m;var g=o[p];m<g[0]&&(g[0]=m),m>g[1]&&(g[1]=m)}return this._rawCount=this._count=l,{start:s,end:l}},t.prototype._initDataFromProvider=function(e,r,n){for(var a=this._provider,i=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,c=he(o,function(y){return y.property}),u=0;u<s;u++){var f=o[u];l[u]||(l[u]=Ci()),Qm(i,u,f.type,r,n)}if(a.fillStorage)a.fillStorage(e,r,i,l);else for(var h=[],d=e;d<r;d++){h=a.getItem(d,h);for(var p=0;p<s;p++){var m=i[p],g=this._dimValueGetter(h,c[p],d,p);m[d]=g;var v=l[p];g<v[0]&&(v[0]=g),g>v[1]&&(v[1]=g)}}!a.persistent&&a.clean&&a.clean(),this._rawCount=this._count=r,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(e,r){if(!(r>=0&&r<this._count))return NaN;var n=this._chunks[e];return n?n[this.getRawIndex(r)]:NaN},t.prototype.getValues=function(e,r){var n=[],a=[];if(r==null){r=e,e=[];for(var i=0;i<this._dimensions.length;i++)a.push(i)}else a=e;for(var i=0,o=a.length;i<o;i++)n.push(this.get(a[i],r));return n},t.prototype.getByRawIndex=function(e,r){if(!(r>=0&&r<this._rawCount))return NaN;var n=this._chunks[e];return n?n[r]:NaN},t.prototype.getSum=function(e){var r=this._chunks[e],n=0;if(r)for(var a=0,i=this.count();a<i;a++){var o=this.get(e,a);isNaN(o)||(n+=o)}return n},t.prototype.getMedian=function(e){var r=[];this.each([e],function(i){isNaN(i)||r.push(i)});var n=r.sort(function(i,o){return i-o}),a=this.count();return a===0?0:a%2===1?n[(a-1)/2]:(n[a/2]+n[a/2-1])/2},t.prototype.indexOfRawIndex=function(e){if(e>=this._rawCount||e<0)return-1;if(!this._indices)return e;var r=this._indices,n=r[e];if(n!=null&&n<this._count&&n===e)return e;for(var a=0,i=this._count-1;a<=i;){var o=(a+i)/2|0;if(r[o]<e)a=o+1;else if(r[o]>e)i=o-1;else return o}return-1},t.prototype.indicesOfNearest=function(e,r,n){var a=this._chunks,i=a[e],o=[];if(!i)return o;n==null&&(n=1/0);for(var s=1/0,l=-1,c=0,u=0,f=this.count();u<f;u++){var h=this.getRawIndex(u),d=r-i[h],p=Math.abs(d);p<=n&&((p<s||p===s&&d>=0&&l<0)&&(s=p,l=d,c=0),d===l&&(o[c++]=u))}return o.length=c,o},t.prototype.getIndices=function(){var e,r=this._indices;if(r){var n=r.constructor,a=this._count;if(n===Array){e=new n(a);for(var i=0;i<a;i++)e[i]=r[i]}else e=new n(r.buffer,0,a)}else{var n=Ti(this._rawCount);e=new n(this.count());for(var i=0;i<e.length;i++)e[i]=i}return e},t.prototype.filter=function(e,r){if(!this._count)return this;for(var n=this.clone(),a=n.count(),i=Ti(n._rawCount),o=new i(a),s=[],l=e.length,c=0,u=e[0],f=n._chunks,h=0;h<a;h++){var d=void 0,p=n.getRawIndex(h);if(l===0)d=r(h);else if(l===1){var m=f[u][p];d=r(m,h)}else{for(var g=0;g<l;g++)s[g]=f[e[g]][p];s[g]=h,d=r.apply(null,s)}d&&(o[c++]=p)}return c<a&&(n._indices=o),n._count=c,n._extent=[],n._updateGetRawIdx(),n},t.prototype.selectRange=function(e){var r=this.clone(),n=r._count;if(!n)return this;var a=at(e),i=a.length;if(!i)return this;var o=r.count(),s=Ti(r._rawCount),l=new s(o),c=0,u=a[0],f=e[u][0],h=e[u][1],d=r._chunks,p=!1;if(!r._indices){var m=0;if(i===1){for(var g=d[a[0]],v=0;v<n;v++){var y=g[v];(y>=f&&y<=h||isNaN(y))&&(l[c++]=m),m++}p=!0}else if(i===2){for(var g=d[a[0]],b=d[a[1]],x=e[a[1]][0],w=e[a[1]][1],v=0;v<n;v++){var y=g[v],S=b[v];(y>=f&&y<=h||isNaN(y))&&(S>=x&&S<=w||isNaN(S))&&(l[c++]=m),m++}p=!0}}if(!p)if(i===1)for(var v=0;v<o;v++){var k=r.getRawIndex(v),y=d[a[0]][k];(y>=f&&y<=h||isNaN(y))&&(l[c++]=k)}else for(var v=0;v<o;v++){for(var C=!0,k=r.getRawIndex(v),A=0;A<i;A++){var M=a[A],y=d[M][k];(y<e[M][0]||y>e[M][1])&&(C=!1)}C&&(l[c++]=r.getRawIndex(v))}return c<o&&(r._indices=l),r._count=c,r._extent=[],r._updateGetRawIdx(),r},t.prototype.map=function(e,r){var n=this.clone(e);return this._updateDims(n,e,r),n},t.prototype.modify=function(e,r){this._updateDims(this,e,r)},t.prototype._updateDims=function(e,r,n){for(var a=e._chunks,i=[],o=r.length,s=e.count(),l=[],c=e._rawExtent,u=0;u<r.length;u++)c[r[u]]=Ci();for(var f=0;f<s;f++){for(var h=e.getRawIndex(f),d=0;d<o;d++)l[d]=a[r[d]][h];l[o]=f;var p=n&&n.apply(null,l);if(p!=null){typeof p!="object"&&(i[0]=p,p=i);for(var u=0;u<p.length;u++){var m=r[u],g=p[u],v=c[m],y=a[m];y&&(y[h]=g),g<v[0]&&(v[0]=g),g>v[1]&&(v[1]=g)}}}},t.prototype.lttbDownSample=function(e,r){var n=this.clone([e],!0),a=n._chunks,i=a[e],o=this.count(),s=0,l=Math.floor(1/r),c=this.getRawIndex(0),u,f,h,d=new(Ti(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));d[s++]=c;for(var p=1;p<o-1;p+=l){for(var m=Math.min(p+l,o-1),g=Math.min(p+l*2,o),v=(g+m)/2,y=0,b=m;b<g;b++){var x=this.getRawIndex(b),w=i[x];isNaN(w)||(y+=w)}y/=g-m;var S=p,k=Math.min(p+l,o),C=p-1,A=i[c];u=-1,h=S;for(var M=-1,T=0,b=S;b<k;b++){var x=this.getRawIndex(b),w=i[x];if(isNaN(w)){T++,M<0&&(M=x);continue}f=Math.abs((C-v)*(w-A)-(C-b)*(y-A)),f>u&&(u=f,h=x)}T>0&&T<k-S&&(d[s++]=Math.min(M,h),h=Math.max(M,h)),d[s++]=h,c=h}return d[s++]=this.getRawIndex(o-1),n._count=s,n._indices=d,n.getRawIndex=this._getRawIdx,n},t.prototype.minmaxDownSample=function(e,r){for(var n=this.clone([e],!0),a=n._chunks,i=Math.floor(1/r),o=a[e],s=this.count(),l=new(Ti(this._rawCount))(Math.ceil(s/i)*2),c=0,u=0;u<s;u+=i){var f=u,h=o[this.getRawIndex(f)],d=u,p=o[this.getRawIndex(d)],m=i;u+i>s&&(m=s-u);for(var g=0;g<m;g++){var v=this.getRawIndex(u+g),y=o[v];y<h&&(h=y,f=u+g),y>p&&(p=y,d=u+g)}var b=this.getRawIndex(f),x=this.getRawIndex(d);f<d?(l[c++]=b,l[c++]=x):(l[c++]=x,l[c++]=b)}return n._count=c,n._indices=l,n._updateGetRawIdx(),n},t.prototype.downSample=function(e,r,n,a){for(var i=this.clone([e],!0),o=i._chunks,s=[],l=Math.floor(1/r),c=o[e],u=this.count(),f=i._rawExtent[e]=Ci(),h=new(Ti(this._rawCount))(Math.ceil(u/l)),d=0,p=0;p<u;p+=l){l>u-p&&(l=u-p,s.length=l);for(var m=0;m<l;m++){var g=this.getRawIndex(p+m);s[m]=c[g]}var v=n(s),y=this.getRawIndex(Math.min(p+a(s,v)||0,u-1));c[y]=v,v<f[0]&&(f[0]=v),v>f[1]&&(f[1]=v),h[d++]=y}return i._count=d,i._indices=h,i._updateGetRawIdx(),i},t.prototype.each=function(e,r){if(this._count)for(var n=e.length,a=this._chunks,i=0,o=this.count();i<o;i++){var s=this.getRawIndex(i);switch(n){case 0:r(i);break;case 1:r(a[e[0]][s],i);break;case 2:r(a[e[0]][s],a[e[1]][s],i);break;default:for(var l=0,c=[];l<n;l++)c[l]=a[e[l]][s];c[l]=i,r.apply(null,c)}}},t.prototype.getDataExtent=function(e){var r=this._chunks[e],n=Ci();if(!r)return n;var a=this.count(),i=!this._indices,o;if(i)return this._rawExtent[e].slice();if(o=this._extent[e],o)return o.slice();o=n;for(var s=o[0],l=o[1],c=0;c<a;c++){var u=this.getRawIndex(c),f=r[u];f<s&&(s=f),f>l&&(l=f)}return o=[s,l],this._extent[e]=o,o},t.prototype.getRawDataItem=function(e){var r=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(r);for(var n=[],a=this._chunks,i=0;i<a.length;i++)n.push(a[i][r]);return n},t.prototype.clone=function(e,r){var n=new t,a=this._chunks,i=e&&ni(e,function(s,l){return s[l]=!0,s},{});if(i)for(var o=0;o<a.length;o++)n._chunks[o]=i[o]?IT(a[o]):a[o];else n._chunks=a;return this._copyCommonProps(n),r||(n._indices=this._cloneIndices()),n._updateGetRawIdx(),n},t.prototype._copyCommonProps=function(e){e._count=this._count,e._rawCount=this._rawCount,e._provider=this._provider,e._dimensions=this._dimensions,e._extent=Ie(this._extent),e._rawExtent=Ie(this._rawExtent)},t.prototype._cloneIndices=function(){if(this._indices){var e=this._indices.constructor,r=void 0;if(e===Array){var n=this._indices.length;r=new e(n);for(var a=0;a<n;a++)r[a]=this._indices[a]}else r=new e(this._indices);return r}return null},t.prototype._getRawIdxIdentity=function(e){return e},t.prototype._getRawIdx=function(e){return e<this._count&&e>=0?this._indices[e]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=(function(){function e(r,n,a,i){return Ql(r[i],this._dimensions[i])}fd={arrayRows:e,objectRows:function(r,n,a,i){return Ql(r[n],this._dimensions[i])},keyedColumns:e,original:function(r,n,a,i){var o=r&&(r.value==null?r:r.value);return Ql(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(r,n,a,i){return r[i]}}})(),t})(),LT=ht(),PT={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},ey=(function(){function t(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return t.prototype.isDimensionOmitted=function(){return this._dimOmitted},t.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||(this._dimNameMap=ny(this.source)))},t.prototype.getSourceDimensionIndex=function(e){return Pe(this._dimNameMap.get(e),-1)},t.prototype.getSourceDimension=function(e){var r=this.source.dimensionsDefine;if(r)return r[e]},t.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,r=Vm(this.source),n=!ay(e),a="",i=[],o=0,s=0;o<e;o++){var l=void 0,c=void 0,u=void 0,f=this.dimensions[s];if(f&&f.storeDimIndex===o)l=r?f.name:null,c=f.type,u=f.ordinalMeta,s++;else{var h=this.getSourceDimension(o);h&&(l=r?h.name:null,c=h.type)}i.push({property:l,type:c,ordinalMeta:u}),r&&l!=null&&(!f||!f.isCalculationCoord)&&(a+=n?l.replace(/\`/g,"`1").replace(/\$/g,"`2"):l),a+="$",a+=PT[c]||"f",u&&(a+=u.uid),a+="$"}var d=this.source,p=[d.seriesLayoutBy,d.startIndex,a].join("$$");return{dimensions:i,hash:p}},t.prototype.makeOutputDimensionNames=function(){for(var e=[],r=0,n=0;r<this._fullDimCount;r++){var a=void 0,i=this.dimensions[n];if(i&&i.storeDimIndex===r)i.isCalculationCoord||(a=i.name),n++;else{var o=this.getSourceDimension(r);o&&(a=o.name)}e.push(a)}return e},t.prototype.appendCalculationDimension=function(e){this.dimensions.push(e),e.isCalculationCoord=!0,this._fullDimCount++,this._updateDimOmitted(!0)},t})();function ty(t){return t instanceof ey}function ry(t){for(var e=me(),r=0;r<(t||[]).length;r++){var n=t[r],a=de(n)?n.name:n;a!=null&&e.get(a)==null&&e.set(a,r)}return e}function ny(t){var e=LT(t);return e.dimNameMap||(e.dimNameMap=ry(t.dimensionsDefine))}function ay(t){return t>30}var Ro=de,Un=he,RT=typeof Int32Array>"u"?Array:Int32Array,ET="e\0\0",iy=-1,OT=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],NT=["_approximateExtent"],oy,tc,Eo,Oo,hd,No,pd,BT=(function(){function t(e,r){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var n,a=!1;ty(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(a=!0,n=e),n=n||["x","y"];for(var i={},o=[],s={},l=!1,c={},u=0;u<n.length;u++){var f=n[u],h=ae(f)?new Jl({name:f}):f instanceof Jl?f:new Jl(f),d=h.name;h.type=h.type||"float",h.coordDim||(h.coordDim=d,h.coordDimIndex=0);var p=h.otherDims=h.otherDims||{};o.push(d),i[d]=h,c[d]!=null&&(l=!0),h.createInvertedIndices&&(s[d]=[]),p.itemName===0&&(this._nameDimIdx=u),p.itemId===0&&(this._idDimIdx=u),a&&(h.storeDimIndex=u)}if(this.dimensions=o,this._dimInfos=i,this._initGetDimensionInfo(l),this.hostModel=r,this._invertedIndicesMap=s,this._dimOmitted){var m=this._dimIdxToName=me();I(o,function(g){m.set(i[g].storeDimIndex,g)})}}return t.prototype.getDimension=function(e){var r=this._recognizeDimIndex(e);if(r==null)return e;if(r=e,!this._dimOmitted)return this.dimensions[r];var n=this._dimIdxToName.get(r);if(n!=null)return n;var a=this._schema.getSourceDimension(r);if(a)return a.name},t.prototype.getDimensionIndex=function(e){var r=this._recognizeDimIndex(e);if(r!=null)return r;if(e==null)return-1;var n=this._getDimInfo(e);return n?n.storeDimIndex:this._dimOmitted?this._schema.getSourceDimensionIndex(e):-1},t.prototype._recognizeDimIndex=function(e){if(et(e)||e!=null&&!isNaN(e)&&!this._getDimInfo(e)&&(!this._dimOmitted||this._schema.getSourceDimensionIndex(e)<0))return+e},t.prototype._getStoreDimIndex=function(e){var r=this.getDimensionIndex(e);return r},t.prototype.getDimensionInfo=function(e){return this._getDimInfo(this.getDimension(e))},t.prototype._initGetDimensionInfo=function(e){var r=this._dimInfos;this._getDimInfo=e?function(n){return r.hasOwnProperty(n)?r[n]:void 0}:function(n){return r[n]}},t.prototype.getDimensionsOnCoord=function(){return this._dimSummary.dataDimsOnCoord.slice()},t.prototype.mapDimension=function(e,r){var n=this._dimSummary;if(r==null)return n.encodeFirstDimNotExtra[e];var a=n.encode[e];return a?a[r]:null},t.prototype.mapDimensionsAll=function(e){var r=this._dimSummary,n=r.encode[e];return(n||[]).slice()},t.prototype.getStore=function(){return this._store},t.prototype.initData=function(e,r,n){var a=this,i;if(e instanceof dd&&(i=e),!i){var o=this.dimensions,s=od(e)||Vt(e)?new $m(e,o.length):e;i=new dd;var l=Un(o,function(c){return{type:a._dimInfos[c].type,property:c}});i.initData(s,l,n)}this._store=i,this._nameList=(r||[]).slice(),this._idList=[],this._nameRepeatCount={},this._doInit(0,i.count()),this._dimSummary=kT(this,this._schema),this.userOutput=this._dimSummary.userOutput},t.prototype.appendData=function(e){var r=this._store.appendData(e);this._doInit(r[0],r[1])},t.prototype.appendValues=function(e,r){var n=this._store.appendValues(e,r&&r.length),a=n.start,i=n.end,o=this._shouldMakeIdFromName();if(this._updateOrdinalMeta(),r)for(var s=a;s<i;s++){var l=s-a;this._nameList[s]=r[l],o&&pd(this,s)}},t.prototype._updateOrdinalMeta=function(){for(var e=this._store,r=this.dimensions,n=0;n<r.length;n++){var a=this._dimInfos[r[n]];a.ordinalMeta&&e.collectOrdinalMeta(a.storeDimIndex,a.ordinalMeta)}},t.prototype._shouldMakeIdFromName=function(){var e=this._store.getProvider();return this._idDimIdx==null&&e.getSource().sourceFormat!==Vn&&!e.fillStorage},t.prototype._doInit=function(e,r){if(!(e>=r)){var n=this._store,a=n.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList,s=a.getSource().sourceFormat,l=s===yr;if(l&&!a.pure)for(var c=[],u=e;u<r;u++){var f=a.getItem(u,c);if(!this.hasItemOption&&Ak(f)&&(this.hasItemOption=!0),f){var h=f.name;i[u]==null&&h!=null&&(i[u]=Zr(h,null));var d=f.id;o[u]==null&&d!=null&&(o[u]=Zr(d,null))}}if(this._shouldMakeIdFromName())for(var u=e;u<r;u++)pd(this,u);oy(this)}},t.prototype.getApproximateExtent=function(e){return this._approximateExtent[e]||this._store.getDataExtent(this._getStoreDimIndex(e))},t.prototype.setApproximateExtent=function(e,r){r=this.getDimension(r),this._approximateExtent[r]=e.slice()},t.prototype.getCalculationInfo=function(e){return this._calculationInfo[e]},t.prototype.setCalculationInfo=function(e,r){Ro(e)?q(this._calculationInfo,e):this._calculationInfo[e]=r},t.prototype.getName=function(e){var r=this.getRawIndex(e),n=this._nameList[r];return n==null&&this._nameDimIdx!=null&&(n=Eo(this,this._nameDimIdx,r)),n==null&&(n=""),n},t.prototype._getCategory=function(e,r){var n=this._store.get(e,r),a=this._store.getOrdinalMeta(e);return a?a.categories[n]:n},t.prototype.getId=function(e){return tc(this,this.getRawIndex(e))},t.prototype.count=function(){return this._store.count()},t.prototype.get=function(e,r){var n=this._store,a=this._dimInfos[e];if(a)return n.get(a.storeDimIndex,r)},t.prototype.getByRawIndex=function(e,r){var n=this._store,a=this._dimInfos[e];if(a)return n.getByRawIndex(a.storeDimIndex,r)},t.prototype.getIndices=function(){return this._store.getIndices()},t.prototype.getDataExtent=function(e){return this._store.getDataExtent(this._getStoreDimIndex(e))},t.prototype.getSum=function(e){return this._store.getSum(this._getStoreDimIndex(e))},t.prototype.getMedian=function(e){return this._store.getMedian(this._getStoreDimIndex(e))},t.prototype.getValues=function(e,r){var n=this,a=this._store;return ee(e)?a.getValues(Un(e,function(i){return n._getStoreDimIndex(i)}),r):a.getValues(e)},t.prototype.hasValue=function(e){for(var r=this._dimSummary.dataDimIndicesOnCoord,n=0,a=r.length;n<a;n++)if(isNaN(this._store.get(r[n],e)))return!1;return!0},t.prototype.indexOfName=function(e){for(var r=0,n=this._store.count();r<n;r++)if(this.getName(r)===e)return r;return-1},t.prototype.getRawIndex=function(e){return this._store.getRawIndex(e)},t.prototype.indexOfRawIndex=function(e){return this._store.indexOfRawIndex(e)},t.prototype.rawIndexOf=function(e,r){var n=e&&this._invertedIndicesMap[e],a=n&&n[r];return a==null||isNaN(a)?iy:a},t.prototype.indicesOfNearest=function(e,r,n){return this._store.indicesOfNearest(this._getStoreDimIndex(e),r,n)},t.prototype.each=function(e,r,n){ke(e)&&(n=r,r=e,e=[]);var a=n||this,i=Un(Oo(e),this._getStoreDimIndex,this);this._store.each(i,a?Ne(r,a):r)},t.prototype.filterSelf=function(e,r,n){ke(e)&&(n=r,r=e,e=[]);var a=n||this,i=Un(Oo(e),this._getStoreDimIndex,this);return this._store=this._store.filter(i,a?Ne(r,a):r),this},t.prototype.selectRange=function(e){var r=this,n={},a=at(e);return I(a,function(i){var o=r._getStoreDimIndex(i);n[o]=e[i]}),this._store=this._store.selectRange(n),this},t.prototype.mapArray=function(e,r,n){ke(e)&&(n=r,r=e,e=[]),n=n||this;var a=[];return this.each(e,function(){a.push(r&&r.apply(this,arguments))},n),a},t.prototype.map=function(e,r,n,a){var i=n||a||this,o=Un(Oo(e),this._getStoreDimIndex,this),s=No(this);return s._store=this._store.map(o,i?Ne(r,i):r),s},t.prototype.modify=function(e,r,n,a){var i=n||a||this,o=Un(Oo(e),this._getStoreDimIndex,this);this._store.modify(o,i?Ne(r,i):r)},t.prototype.downSample=function(e,r,n,a){var i=No(this);return i._store=this._store.downSample(this._getStoreDimIndex(e),r,n,a),i},t.prototype.minmaxDownSample=function(e,r){var n=No(this);return n._store=this._store.minmaxDownSample(this._getStoreDimIndex(e),r),n},t.prototype.lttbDownSample=function(e,r){var n=No(this);return n._store=this._store.lttbDownSample(this._getStoreDimIndex(e),r),n},t.prototype.getRawDataItem=function(e){return this._store.getRawDataItem(e)},t.prototype.getItemModel=function(e){var r=this.hostModel,n=this.getRawDataItem(e);return new lt(n,r,r&&r.ecModel)},t.prototype.diff=function(e){var r=this;return new dT(e?e.getStore().getIndices():[],this.getStore().getIndices(),function(n){return tc(e,n)},function(n){return tc(r,n)})},t.prototype.getVisual=function(e){var r=this._visual;return r&&r[e]},t.prototype.setVisual=function(e,r){this._visual=this._visual||{},Ro(e)?q(this._visual,e):this._visual[e]=r},t.prototype.getItemVisual=function(e,r){var n=this._itemVisuals[e],a=n&&n[r];return a??this.getVisual(r)},t.prototype.hasItemVisual=function(){return this._itemVisuals.length>0},t.prototype.ensureUniqueItemVisual=function(e,r){var n=this._itemVisuals,a=n[e];a||(a=n[e]={});var i=a[r];return i==null&&(i=this.getVisual(r),ee(i)?i=i.slice():Ro(i)&&(i=q({},i)),a[r]=i),i},t.prototype.setItemVisual=function(e,r,n){var a=this._itemVisuals[e]||{};this._itemVisuals[e]=a,Ro(r)?q(a,r):a[r]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(e,r){Ro(e)?q(this._layout,e):this._layout[e]=r},t.prototype.getLayout=function(e){return this._layout[e]},t.prototype.getItemLayout=function(e){return this._itemLayouts[e]},t.prototype.setItemLayout=function(e,r,n){this._itemLayouts[e]=n?q(this._itemLayouts[e]||{},r):r},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(e,r){var n=this.hostModel&&this.hostModel.seriesIndex;Gk(n,this.dataType,e,r),this._graphicEls[e]=r},t.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},t.prototype.eachItemGraphicEl=function(e,r){I(this._graphicEls,function(n,a){n&&e&&e.call(r,n,a)})},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:Un(this.dimensions,this._getDimInfo,this),this.hostModel)),hd(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(e,r){var n=this[e];ke(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var a=n.apply(this,arguments);return r.apply(this,[a].concat(Nu(arguments)))})},t.internalField=(function(){oy=function(e){var r=e._invertedIndicesMap;I(r,function(n,a){var i=e._dimInfos[a],o=i.ordinalMeta,s=e._store;if(o){n=r[a]=new RT(o.categories.length);for(var l=0;l<n.length;l++)n[l]=iy;for(var l=0;l<s.count();l++)n[s.get(i.storeDimIndex,l)]=l}})},Eo=function(e,r,n){return Zr(e._getCategory(r,n),null)},tc=function(e,r){var n=e._idList[r];return n==null&&e._idDimIdx!=null&&(n=Eo(e,e._idDimIdx,r)),n==null&&(n=ET+r),n},Oo=function(e){return ee(e)||(e=e!=null?[e]:[]),e},No=function(e){var r=new t(e._schema?e._schema:Un(e.dimensions,e._getDimInfo,e),e.hostModel);return hd(r,e),r},hd=function(e,r){I(OT.concat(r.__wrappedMethods||[]),function(n){r.hasOwnProperty(n)&&(e[n]=r[n])}),e.__wrappedMethods=r.__wrappedMethods,I(NT,function(n){e[n]=Ie(r[n])}),e._calculationInfo=q({},r._calculationInfo)},pd=function(e,r){var n=e._nameList,a=e._idList,i=e._nameDimIdx,o=e._idDimIdx,s=n[r],l=a[r];if(s==null&&i!=null&&(n[r]=s=Eo(e,i,r)),l==null&&o!=null&&(a[r]=l=Eo(e,o,r)),l==null&&s!=null){var c=e._nameRepeatCount,u=c[s]=(c[s]||0)+1;l=s,u>1&&(l+="__ec__"+u),a[r]=l}}})(),t})();function zT(t,e){od(t)||(t=Bm(t)),e=e||{};var r=e.coordDimensions||[],n=e.dimensionsDefine||t.dimensionsDefine||[],a=me(),i=[],o=HT(t,r,n,e.dimensionsCount),s=e.canOmitUnusedDimensions&&ay(o),l=n===t.dimensionsDefine,c=l?ny(t):ry(n),u=e.encodeDefine;!u&&e.encodeDefaulter&&(u=e.encodeDefaulter(t,o));for(var f=me(u),h=new Km(o),d=0;d<h.length;d++)h[d]=-1;function p(A){var M=h[A];if(M<0){var T=n[A],D=de(T)?T:{name:T},L=new Jl,R=D.name;R!=null&&c.get(R)!=null&&(L.name=L.displayName=R),D.type!=null&&(L.type=D.type),D.displayName!=null&&(L.displayName=D.displayName);var O=i.length;return h[A]=O,L.storeDimIndex=A,i.push(L),L}return i[M]}if(!s)for(var d=0;d<o;d++)p(d);f.each(function(A,M){var T=Mt(A).slice();if(T.length===1&&!ae(T[0])&&T[0]<0){f.set(M,!1);return}var D=f.set(M,[]);I(T,function(L,R){var O=ae(L)?c.get(L):L;O!=null&&O<o&&(D[R]=O,g(p(O),M,R))})});var m=0;I(r,function(A){var M,T,D,L;if(ae(A))M=A,L={};else{L=A,M=L.name;var R=L.ordinalMeta;L.ordinalMeta=null,L=q({},L),L.ordinalMeta=R,T=L.dimsDef,D=L.otherDims,L.name=L.coordDim=L.coordDimIndex=L.dimsDef=L.otherDims=null}var O=f.get(M);if(O!==!1){if(O=Mt(O),!O.length)for(var B=0;B<(T&&T.length||1);B++){for(;m<o&&p(m).coordDim!=null;)m++;m<o&&O.push(m++)}I(O,function(j,P){var V=p(j);if(l&&L.type!=null&&(V.type=L.type),g(He(V,L),M,P),V.name==null&&T){var H=T[P];!de(H)&&(H={name:H}),V.name=V.displayName=H.name,V.defaultTooltip=H.defaultTooltip}D&&He(V.otherDims,D)})}});function g(A,M,T){Pm.get(M)!=null?A.otherDims[M]=T:(A.coordDim=M,A.coordDimIndex=T,a.set(M,!0))}var v=e.generateCoord,y=e.generateCoordCount,b=y!=null;y=v?y||1:0;var x=v||"value";function w(A){A.name==null&&(A.name=A.coordDim)}if(s)I(i,function(A){w(A)}),i.sort(function(A,M){return A.storeDimIndex-M.storeDimIndex});else for(var S=0;S<o;S++){var k=p(S),C=k.coordDim;C==null&&(k.coordDim=VT(x,a,b),k.coordDimIndex=0,(!v||y<=0)&&(k.isExtraCoord=!0),y--),w(k),k.type==null&&(Nm(t,S)===sr.Must||k.isExtraCoord&&(k.otherDims.itemName!=null||k.otherDims.seriesName!=null))&&(k.type="ordinal")}return FT(i),new ey({source:t,dimensions:i,fullDimensionCount:o,dimensionOmitted:s})}function FT(t){for(var e=me(),r=0;r<t.length;r++){var n=t[r],a=n.name,i=e.get(a)||0;i>0&&(n.name=a+(i-1)),i++,e.set(a,i)}}function HT(t,e,r,n){var a=Math.max(t.dimensionsDetectedCount||1,e.length,r.length,n||0);return I(e,function(i){var o;de(i)&&(o=i.dimsDef)&&(a=Math.max(a,o.length))}),a}function VT(t,e,r){if(r||e.hasKey(t)){for(var n=0;e.hasKey(t+n);)n++;t+=n}return e.set(t,!0),t}var vd={},gd=(function(){function t(){this._coordinateSystems=[]}return t.prototype.create=function(e,r){var n=[];I(vd,function(a,i){var o=a.create(e,r);n=n.concat(o||[])}),this._coordinateSystems=n},t.prototype.update=function(e,r){I(this._coordinateSystems,function(n){n.update&&n.update(e,r)})},t.prototype.getCoordinateSystems=function(){return this._coordinateSystems.slice()},t.register=function(e,r){vd[e]=r},t.get=function(e){return vd[e]},t})(),UT=(function(){function t(e){this.coordSysDims=[],this.axisMap=me(),this.categoryAxisMap=me(),this.coordSysName=e}return t})();function GT(t){var e=t.get("coordinateSystem"),r=new UT(e),n=$T[e];if(n)return n(t,r,r.axisMap,r.categoryAxisMap),r}var $T={cartesian2d:function(t,e,r,n){var a=t.getReferringComponents("xAxis",qt).models[0],i=t.getReferringComponents("yAxis",qt).models[0];e.coordSysDims=["x","y"],r.set("x",a),r.set("y",i),Mi(a)&&(n.set("x",a),e.firstCategoryDimIndex=0),Mi(i)&&(n.set("y",i),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,r,n){var a=t.getReferringComponents("singleAxis",qt).models[0];e.coordSysDims=["single"],r.set("single",a),Mi(a)&&(n.set("single",a),e.firstCategoryDimIndex=0)},polar:function(t,e,r,n){var a=t.getReferringComponents("polar",qt).models[0],i=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],r.set("radius",i),r.set("angle",o),Mi(i)&&(n.set("radius",i),e.firstCategoryDimIndex=0),Mi(o)&&(n.set("angle",o),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},geo:function(t,e,r,n){e.coordSysDims=["lng","lat"]},parallel:function(t,e,r,n){var a=t.ecModel,i=a.getComponent("parallel",t.get("parallelIndex")),o=e.coordSysDims=i.dimensions.slice();I(i.parallelAxisIndex,function(s,l){var c=a.getComponent("parallelAxis",s),u=o[l];r.set(u,c),Mi(c)&&(n.set(u,c),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function Mi(t){return t.get("type")==="category"}function WT(t,e,r){r=r||{};var n=r.byIndex,a=r.stackedCoordDimension,i,o,s;qT(e)?i=e:(o=e.schema,i=o.dimensions,s=e.store);var l=!!(t&&t.get("stack")),c,u,f,h;if(I(i,function(y,b){ae(y)&&(i[b]=y={name:y}),l&&!y.isExtraCoord&&(!n&&!c&&y.ordinalMeta&&(c=y),!u&&y.type!=="ordinal"&&y.type!=="time"&&(!a||a===y.coordDim)&&(u=y))}),u&&!n&&!c&&(n=!0),u){f="__\0ecstackresult_"+t.id,h="__\0ecstackedover_"+t.id,c&&(c.createInvertedIndices=!0);var d=u.coordDim,p=u.type,m=0;I(i,function(y){y.coordDim===d&&m++});var g={name:f,coordDim:d,coordDimIndex:m,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},v={name:h,coordDim:h,coordDimIndex:m+1,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};o?(s&&(g.storeDimIndex=s.ensureCalculationDimension(h,p),v.storeDimIndex=s.ensureCalculationDimension(f,p)),o.appendCalculationDimension(g),o.appendCalculationDimension(v)):(i.push(g),i.push(v))}return{stackedDimension:u&&u.name,stackedByDimension:c&&c.name,isStackedByIndex:n,stackedOverDimension:h,stackResultDimension:f}}function qT(t){return!ty(t.schema)}function Ai(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function YT(t,e){return Ai(t,e)?t.getCalculationInfo("stackResultDimension"):e}function XT(t,e){var r=t.get("coordinateSystem"),n=gd.get(r),a;return e&&e.coordSysDims&&(a=he(e.coordSysDims,function(i){var o={name:i},s=e.axisMap.get(i);if(s){var l=s.get("type");o.type=TT(l)}return o})),a||(a=n&&(n.getDimensionsInfo?n.getDimensionsInfo():n.dimensions.slice())||["x","y"]),a}function ZT(t,e,r){var n,a;return r&&I(t,function(i,o){var s=i.coordDim,l=r.categoryAxisMap.get(s);l&&(n==null&&(n=o),i.ordinalMeta=l.getOrdinalMeta(),e&&(i.createInvertedIndices=!0)),i.otherDims.itemName!=null&&(a=!0)}),!a&&n!=null&&(t[n].otherDims.itemName=0),n}function md(t,e,r){r=r||{};var n=e.getSourceManager(),a,i=!1;a=n.getSource(),i=a.sourceFormat===yr;var o=GT(e),s=XT(e,o),l=r.useEncodeDefaulter,c=ke(l)?l:l?dt(pT,s,e):null,u={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:c,canOmitUnusedDimensions:!i},f=zT(a,u),h=ZT(f.dimensions,r.createInvertedIndices,o),d=i?null:n.getSharedDataStore(f),p=WT(e,{schema:f,store:d}),m=new BT(f,e);m.setCalculationInfo(p);var g=h!=null&&KT(a)?function(v,y,b,x){return x===h?b:this.defaultDimValueGetter(v,y,b,x)}:null;return m.hasItemOption=!1,m.initData(i?a:d,null,g),m}function KT(t){if(t.sourceFormat===yr){var e=jT(t.data||[]);return!ee(xo(e))}}function jT(t){for(var e=0;e<t.length&&t[e]==null;)e++;return t[e]}var JT=Math.round(Math.random()*10);function rc(t){return[t||"",JT++].join("_")}function QT(t){var e={};t.registerSubTypeDefaulter=function(r,n){var a=$r(r);e[a.main]=n},t.determineSubType=function(r,n){var a=n.type;if(!a){var i=$r(r).main;t.hasSubTypes(r)&&e[i]&&(a=e[i](n))}return a}}function eC(t,e){t.topologicalTravel=function(i,o,s,l){if(!i.length)return;var c=r(o),u=c.graph,f=c.noEntryList,h={};for(I(i,function(y){h[y]=!0});f.length;){var d=f.pop(),p=u[d],m=!!h[d];m&&(s.call(l,d,p.originalDeps.slice()),delete h[d]),I(p.successor,m?v:g)}I(h,function(){var y="";throw new Error(y)});function g(y){u[y].entryCount--,u[y].entryCount===0&&f.push(y)}function v(y){h[y]=!0,g(y)}};function r(i){var o={},s=[];return I(i,function(l){var c=n(o,l),u=c.originalDeps=e(l),f=a(u,i);c.entryCount=f.length,c.entryCount===0&&s.push(l),I(f,function(h){Ue(c.predecessor,h)<0&&c.predecessor.push(h);var d=n(o,h);Ue(d.successor,h)<0&&d.successor.push(l)})}),{graph:o,noEntryList:s}}function n(i,o){return i[o]||(i[o]={predecessor:[],successor:[]}),i[o]}function a(i,o){var s=[];return I(i,function(l){Ue(o,l)>=0&&s.push(l)}),s}}function yd(t,e){return Oe(Oe({},t,!0),e,!0)}var tC=Math.log(2);function _d(t,e,r,n,a,i){var o=n+"-"+a,s=t.length;if(i.hasOwnProperty(o))return i[o];if(e===1){var l=Math.round(Math.log((1<<s)-1&~a)/tC);return t[r][l]}for(var c=n|1<<r,u=r+1;n&1<<u;)u++;for(var f=0,h=0,d=0;h<s;h++){var p=1<<h;p&a||(f+=(d%2?-1:1)*t[r][h]*_d(t,e-1,u,c,a|p,i),d++)}return i[o]=f,f}function sy(t,e){var r=[[t[0],t[1],1,0,0,0,-e[0]*t[0],-e[0]*t[1]],[0,0,0,t[0],t[1],1,-e[1]*t[0],-e[1]*t[1]],[t[2],t[3],1,0,0,0,-e[2]*t[2],-e[2]*t[3]],[0,0,0,t[2],t[3],1,-e[3]*t[2],-e[3]*t[3]],[t[4],t[5],1,0,0,0,-e[4]*t[4],-e[4]*t[5]],[0,0,0,t[4],t[5],1,-e[5]*t[4],-e[5]*t[5]],[t[6],t[7],1,0,0,0,-e[6]*t[6],-e[6]*t[7]],[0,0,0,t[6],t[7],1,-e[7]*t[6],-e[7]*t[7]]],n={},a=_d(r,8,0,0,0,n);if(a!==0){for(var i=[],o=0;o<8;o++)for(var s=0;s<8;s++)i[s]==null&&(i[s]=0),i[s]+=((o+s)%2?-1:1)*_d(r,7,o===0?1:0,1<<o,1<<s,n)/a*e[o];return function(l,c,u){var f=c*i[6]+u*i[7]+1;l[0]=(c*i[0]+u*i[1]+i[2])/f,l[1]=(c*i[3]+u*i[4]+i[5])/f}}}var ly="___zrEVENTSAVED",bd=[];function rC(t,e,r,n,a){return xd(bd,e,n,a,!0)&&xd(t,r,bd[0],bd[1])}function xd(t,e,r,n,a){if(e.getBoundingClientRect&&_e.domSupported&&!cy(e)){var i=e[ly]||(e[ly]={}),o=nC(e,i),s=aC(o,i,a);if(s)return s(t,r,n),!0}return!1}function nC(t,e){var r=e.markers;if(r)return r;r=e.markers=[];for(var n=["left","right"],a=["top","bottom"],i=0;i<4;i++){var o=document.createElement("div"),s=o.style,l=i%2,c=(i>>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[l]+":0",a[c]+":0",n[1-l]+":auto",a[1-c]+":auto",""].join("!important;"),t.appendChild(o),r.push(o)}return r}function aC(t,e,r){for(var n=r?"invTrans":"trans",a=e[n],i=e.srcCoords,o=[],s=[],l=!0,c=0;c<4;c++){var u=t[c].getBoundingClientRect(),f=2*c,h=u.left,d=u.top;o.push(h,d),l=l&&i&&h===i[f]&&d===i[f+1],s.push(t[c].offsetLeft,t[c].offsetTop)}return l&&a?a:(e.srcCoords=o,e[n]=r?sy(s,o):sy(o,s))}function cy(t){return t.nodeName.toUpperCase()==="CANVAS"}var iC=/([&<>"'])/g,oC={"&":"&","<":"<",">":">",'"':""","'":"'"};function Zt(t){return t==null?"":(t+"").replace(iC,function(e,r){return oC[r]})}const sC={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}},lC={time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}};var nc="ZH",wd="EN",Di=wd,ac={},Sd={},uy=_e.domSupported?(function(){var t=(document.documentElement.lang||navigator.language||navigator.browserLanguage||Di).toUpperCase();return t.indexOf(nc)>-1?nc:Di})():Di;function fy(t,e){t=t.toUpperCase(),Sd[t]=new lt(e),ac[t]=e}function cC(t){if(ae(t)){var e=ac[t.toUpperCase()]||{};return t===nc||t===wd?Ie(e):Oe(Ie(e),Ie(ac[Di]),!1)}else return Oe(Ie(t),Ie(ac[Di]),!1)}function uC(t){return Sd[t]}function fC(){return Sd[Di]}fy(wd,sC),fy(nc,lC);var kd=1e3,Td=kd*60,Bo=Td*60,_r=Bo*24,dy=_r*365,zo={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},ic="{yyyy}-{MM}-{dd}",hy={year:"{yyyy}",month:"{yyyy}-{MM}",day:ic,hour:ic+" "+zo.hour,minute:ic+" "+zo.minute,second:ic+" "+zo.second,millisecond:zo.none},Cd=["year","month","day","hour","minute","second","millisecond"],py=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Gn(t,e){return t+="","0000".substr(0,e-t.length)+t}function Ii(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function dC(t){return t===Ii(t)}function hC(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function oc(t,e,r,n){var a=mn(t),i=a[Md(r)](),o=a[Li(r)]()+1,s=Math.floor((o-1)/3)+1,l=a[sc(r)](),c=a["get"+(r?"UTC":"")+"Day"](),u=a[Fo(r)](),f=(u-1)%12+1,h=a[lc(r)](),d=a[cc(r)](),p=a[uc(r)](),m=u>=12?"pm":"am",g=m.toUpperCase(),v=n instanceof lt?n:uC(n||uy)||fC(),y=v.getModel("time"),b=y.get("month"),x=y.get("monthAbbr"),w=y.get("dayOfWeek"),S=y.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,m+"").replace(/{A}/g,g+"").replace(/{yyyy}/g,i+"").replace(/{yy}/g,Gn(i%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,b[o-1]).replace(/{MMM}/g,x[o-1]).replace(/{MM}/g,Gn(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Gn(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,w[c]).replace(/{ee}/g,S[c]).replace(/{e}/g,c+"").replace(/{HH}/g,Gn(u,2)).replace(/{H}/g,u+"").replace(/{hh}/g,Gn(f+"",2)).replace(/{h}/g,f+"").replace(/{mm}/g,Gn(h,2)).replace(/{m}/g,h+"").replace(/{ss}/g,Gn(d,2)).replace(/{s}/g,d+"").replace(/{SSS}/g,Gn(p,3)).replace(/{S}/g,p+"")}function pC(t,e,r,n,a){var i=null;if(ae(r))i=r;else if(ke(r))i=r(t.value,e,{level:t.level});else{var o=q({},zo);if(t.level>0)for(var s=0;s<Cd.length;++s)o[Cd[s]]="{primary|"+o[Cd[s]]+"}";var l=r?r.inherit===!1?r:He(r,o):o,c=vy(t.value,a);if(l[c])i=l[c];else if(l.inherit){for(var u=py.indexOf(c),s=u-1;s>=0;--s)if(l[c]){i=l[c];break}i=i||o.none}if(ee(i)){var f=t.level==null?0:t.level>=0?t.level:i.length+t.level;f=Math.min(f,i.length-1),i=i[f]}}return oc(new Date(t.value),i,a,n)}function vy(t,e){var r=mn(t),n=r[Li(e)]()+1,a=r[sc(e)](),i=r[Fo(e)](),o=r[lc(e)](),s=r[cc(e)](),l=r[uc(e)](),c=l===0,u=c&&s===0,f=u&&o===0,h=f&&i===0,d=h&&a===1,p=d&&n===1;return p?"year":d?"month":h?"day":f?"hour":u?"minute":c?"second":"millisecond"}function gy(t,e,r){var n=et(t)?mn(t):t;switch(e=e||vy(t,r),e){case"year":return n[Md(r)]();case"half-year":return n[Li(r)]()>=6?1:0;case"quarter":return Math.floor((n[Li(r)]()+1)/4);case"month":return n[Li(r)]();case"day":return n[sc(r)]();case"half-day":return n[Fo(r)]()/24;case"hour":return n[Fo(r)]();case"minute":return n[lc(r)]();case"second":return n[cc(r)]();case"millisecond":return n[uc(r)]()}}function Md(t){return t?"getUTCFullYear":"getFullYear"}function Li(t){return t?"getUTCMonth":"getMonth"}function sc(t){return t?"getUTCDate":"getDate"}function Fo(t){return t?"getUTCHours":"getHours"}function lc(t){return t?"getUTCMinutes":"getMinutes"}function cc(t){return t?"getUTCSeconds":"getSeconds"}function uc(t){return t?"getUTCMilliseconds":"getMilliseconds"}function vC(t){return t?"setUTCFullYear":"setFullYear"}function my(t){return t?"setUTCMonth":"setMonth"}function yy(t){return t?"setUTCDate":"setDate"}function _y(t){return t?"setUTCHours":"setHours"}function by(t){return t?"setUTCMinutes":"setMinutes"}function xy(t){return t?"setUTCSeconds":"setSeconds"}function wy(t){return t?"setUTCMilliseconds":"setMilliseconds"}function Sy(t){if(!Ck(t))return ae(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function ky(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(r,n){return n.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var fc=_v;function Ad(t,e,r){var n="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function a(u){return u&&Gr(u)?u:"-"}function i(u){return!!(u!=null&&!isNaN(u)&&isFinite(u))}var o=e==="time",s=t instanceof Date;if(o||s){var l=o?mn(t):t;if(isNaN(+l)){if(s)return"-"}else return oc(l,n,r)}if(e==="ordinal")return Ou(t)?a(t):et(t)&&i(t)?t+"":"-";var c=Tl(t);return i(c)?Sy(c):Ou(t)?a(t):typeof t=="boolean"?t+"":"-"}var Ty=["a","b","c","d","e","f","g"],Dd=function(t,e){return"{"+t+(e??"")+"}"};function Cy(t,e,r){ee(e)||(e=[e]);var n=e.length;if(!n)return"";for(var a=e[0].$vars||[],i=0;i<a.length;i++){var o=Ty[i];t=t.replace(Dd(o),Dd(o,0))}for(var s=0;s<n;s++)for(var l=0;l<a.length;l++){var c=e[s][a[l]];t=t.replace(Dd(Ty[l],s),r?Zt(c):c)}return t}function gC(t,e){var r=ae(t)?{color:t,extraCssText:e}:t||{},n=r.color,a=r.type;e=r.extraCssText;var i=r.renderMode||"html";if(!n)return"";if(i==="html")return a==="subItem"?'<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;border-radius:4px;width:4px;height:4px;background-color:'+Zt(n)+";"+(e||"")+'"></span>':'<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:'+Zt(n)+";"+(e||"")+'"></span>';var o=r.markerId||"markerX";return{renderMode:i,content:"{"+o+"|} ",style:a==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:n}:{width:10,height:10,borderRadius:5,backgroundColor:n}}}function Oa(t,e){return e=e||"transparent",ae(t)?t:de(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}var dc=I,mC=["left","right","top","bottom","width","height"],hc=[["width","left","right"],["height","top","bottom"]];function Id(t,e,r,n,a){var i=0,o=0;n==null&&(n=1/0),a==null&&(a=1/0);var s=0;e.eachChild(function(l,c){var u=l.getBoundingRect(),f=e.childAt(c+1),h=f&&f.getBoundingRect(),d,p;if(t==="horizontal"){var m=u.width+(h?-h.x+u.x:0);d=i+m,d>n||l.newline?(i=0,d=m,o+=s+r,s=u.height):s=Math.max(s,u.height)}else{var g=u.height+(h?-h.y+u.y:0);p=o+g,p>a||l.newline?(i+=s+r,o=0,p=g,s=u.width):s=Math.max(s,u.width)}l.newline||(l.x=i,l.y=o,l.markRedraw(),t==="horizontal"?i=d+r:o=p+r)})}var Ho=Id;dt(Id,"vertical"),dt(Id,"horizontal");function pc(t,e,r){r=fc(r||0);var n=e.width,a=e.height,i=Nt(t.left,n),o=Nt(t.top,a),s=Nt(t.right,n),l=Nt(t.bottom,a),c=Nt(t.width,n),u=Nt(t.height,a),f=r[2]+r[0],h=r[1]+r[3],d=t.aspect;switch(isNaN(c)&&(c=n-s-h-i),isNaN(u)&&(u=a-l-f-o),d!=null&&(isNaN(c)&&isNaN(u)&&(d>n/a?c=n*.8:u=a*.8),isNaN(c)&&(c=d*u),isNaN(u)&&(u=c/d)),isNaN(i)&&(i=n-s-c-h),isNaN(o)&&(o=a-l-u-f),t.left||t.right){case"center":i=n/2-c/2-r[3];break;case"right":i=n-c-h;break}switch(t.top||t.bottom){case"middle":case"center":o=a/2-u/2-r[0];break;case"bottom":o=a-u-f;break}i=i||0,o=o||0,isNaN(c)&&(c=n-h-i-(s||0)),isNaN(u)&&(u=a-f-o-(l||0));var p=new Ge(i+r[3],o+r[0],c,u);return p.margin=r,p}function Vo(t){var e=t.layoutMode||t.constructor.layoutMode;return de(e)?e:e?{type:e}:null}function Pi(t,e,r){var n=r&&r.ignoreSize;!ee(n)&&(n=[n,n]);var a=o(hc[0],0),i=o(hc[1],1);c(hc[0],t,a),c(hc[1],t,i);function o(u,f){var h={},d=0,p={},m=0,g=2;if(dc(u,function(b){p[b]=t[b]}),dc(u,function(b){s(e,b)&&(h[b]=p[b]=e[b]),l(h,b)&&d++,l(p,b)&&m++}),n[f])return l(e,u[1])?p[u[2]]=null:l(e,u[2])&&(p[u[1]]=null),p;if(m===g||!d)return p;if(d>=g)return h;for(var v=0;v<u.length;v++){var y=u[v];if(!s(h,y)&&s(t,y)){h[y]=t[y];break}}return h}function s(u,f){return u.hasOwnProperty(f)}function l(u,f){return u[f]!=null&&u[f]!=="auto"}function c(u,f,h){dc(u,function(d){f[d]=h[d]})}}function vc(t){return yC({},t)}function yC(t,e){return e&&t&&dc(mC,function(r){e.hasOwnProperty(r)&&(t[r]=e[r])}),t}var _C=ht(),Ye=(function(t){K(e,t);function e(r,n,a){var i=t.call(this,r,n,a)||this;return i.uid=rc("ec_cpt_model"),i}return e.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a)},e.prototype.mergeDefaultAndTheme=function(r,n){var a=Vo(this),i=a?vc(r):{},o=n.getTheme();Oe(r,o.get(this.mainType)),Oe(r,this.getDefaultOption()),a&&Pi(r,i,a)},e.prototype.mergeOption=function(r,n){Oe(this.option,r,!0);var a=Vo(this);a&&Pi(this.option,r,a)},e.prototype.optionUpdated=function(r,n){},e.prototype.getDefaultOption=function(){var r=this.constructor;if(!Ww(r))return r.defaultOption;var n=_C(this);if(!n.defaultOption){for(var a=[],i=r;i;){var o=i.prototype.defaultOption;o&&a.push(o),i=i.superClass}for(var s={},l=a.length-1;l>=0;l--)s=Oe(s,a[l],!0);n.defaultOption=s}return n.defaultOption},e.prototype.getReferringComponents=function(r,n){var a=r+"Index",i=r+"Id";return ko(this.ecModel,r,{index:this.get(a,!0),id:this.get(i,!0)},n)},e.prototype.getBoxLayoutParams=function(){var r=this;return{left:r.get("left"),top:r.get("top"),right:r.get("right"),bottom:r.get("bottom"),width:r.get("width"),height:r.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(r){this.option.zlevel=r},e.protoInitialize=(function(){var r=e.prototype;r.type="component",r.id="",r.name="",r.mainType="",r.subType="",r.componentIndex=0})(),e})(lt);kv(Ye,lt),Zs(Ye),QT(Ye),eC(Ye,bC);function bC(t){var e=[];return I(Ye.getClassesByMainType(t),function(r){e=e.concat(r.dependencies||r.prototype.dependencies||[])}),e=he(e,function(r){return $r(r).main}),t!=="dataset"&&Ue(e,"dataset")<=0&&e.unshift("dataset"),e}var My=ht(),xC=ht(),Ld=(function(){function t(){}return t.prototype.getColorFromPalette=function(e,r,n){var a=Mt(this.get("color",!0)),i=this.get("colorLayer",!0);return Dy(this,My,a,i,e,r,n)},t.prototype.clearColorPalette=function(){SC(this,My)},t})();function Ay(t,e,r,n){var a=Mt(t.get(["aria","decal","decals"]));return Dy(t,xC,a,null,e,r,n)}function wC(t,e){for(var r=t.length,n=0;n<r;n++)if(t[n].length>e)return t[n];return t[r-1]}function Dy(t,e,r,n,a,i,o){i=i||t;var s=e(i),l=s.paletteIdx||0,c=s.paletteNameMap=s.paletteNameMap||{};if(c.hasOwnProperty(a))return c[a];var u=o==null||!n?r:wC(n,o);if(u=u||r,!(!u||!u.length)){var f=u[l];return a&&(c[a]=f),s.paletteIdx=(l+1)%u.length,f}}function SC(t,e){e(t).paletteIdx=0,e(t).paletteNameMap={}}var kC=/\{@(.+?)\}/g,TC=(function(){function t(){}return t.prototype.getDataParams=function(e,r){var n=this.getData(r),a=this.getRawValue(e,r),i=n.getRawIndex(e),o=n.getName(e),s=n.getRawDataItem(e),l=n.getItemVisual(e,"style"),c=l&&l[n.getItemVisual(e,"drawType")||"fill"],u=l&&l.stroke,f=this.mainType,h=f==="series",d=n.userOutput&&n.userOutput.get();return{componentType:f,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:h?this.subType:null,seriesIndex:this.seriesIndex,seriesId:h?this.id:null,seriesName:h?this.name:null,name:o,dataIndex:i,data:s,dataType:r,value:a,color:c,borderColor:u,dimensionNames:d?d.fullDimensions:null,encode:d?d.encode:null,$vars:["seriesName","name","value"]}},t.prototype.getFormattedLabel=function(e,r,n,a,i,o){r=r||"normal";var s=this.getData(n),l=this.getDataParams(e,n);if(o&&(l.value=o.interpolatedValue),a!=null&&ee(l.value)&&(l.value=l.value[a]),!i){var c=s.getItemModel(e);i=c.get(r==="normal"?["label","formatter"]:[r,"label","formatter"])}if(ke(i))return l.status=r,l.dimensionIndex=a,i(l);if(ae(i)){var u=Cy(i,l);return u.replace(kC,function(f,h){var d=h.length,p=h;p.charAt(0)==="["&&p.charAt(d-1)==="]"&&(p=+p.slice(1,d-1));var m=ki(s,e,p);if(o&&ee(o.interpolatedValue)){var g=s.getDimensionIndex(p);g>=0&&(m=o.interpolatedValue[g])}return m!=null?m+"":""})}},t.prototype.getRawValue=function(e,r){return ki(this.getData(r),e)},t.prototype.formatTooltip=function(e,r,n){},t})();function Iy(t){var e,r;return de(t)?t.type&&(r=t):e=t,{text:e,frag:r}}function Uo(t){return new CC(t)}var CC=(function(){function t(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return t.prototype.perform=function(e){var r=this._upstream,n=e&&e.skip;if(this._dirty&&r){var a=this.context;a.data=a.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var o=u(this._modBy),s=this._modDataCount||0,l=u(e&&e.modBy),c=e&&e.modDataCount||0;(o!==l||s!==c)&&(i="reset");function u(y){return!(y>=1)&&(y=1),y}var f;(this._dirty||i==="reset")&&(this._dirty=!1,f=this._doReset(n)),this._modBy=l,this._modDataCount=c;var h=e&&e.step;if(r?this._dueEnd=r._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,p=Math.min(h!=null?this._dueIndex+h:1/0,this._dueEnd);if(!n&&(f||d<p)){var m=this._progress;if(ee(m))for(var g=0;g<m.length;g++)this._doProgress(m[g],d,p,l,c);else this._doProgress(m,d,p,l,c)}this._dueIndex=p;var v=this._settedOutputEnd!=null?this._settedOutputEnd:p;this._outputDueEnd=v}else this._dueIndex=this._outputDueEnd=this._settedOutputEnd!=null?this._settedOutputEnd:this._dueEnd;return this.unfinished()},t.prototype.dirty=function(){this._dirty=!0,this._onDirty&&this._onDirty(this.context)},t.prototype._doProgress=function(e,r,n,a,i){Ly.reset(r,n,a,i),this._callingProgress=e,this._callingProgress({start:r,end:n,count:n-r,next:Ly.next},this.context)},t.prototype._doReset=function(e){this._dueIndex=this._outputDueEnd=this._dueEnd=0,this._settedOutputEnd=null;var r,n;!e&&this._reset&&(r=this._reset(this.context),r&&r.progress&&(n=r.forceFirstProgress,r=r.progress),ee(r)&&!r.length&&(r=null)),this._progress=r,this._modBy=this._modDataCount=null;var a=this._downstream;return a&&a.dirty(),n},t.prototype.unfinished=function(){return this._progress&&this._dueIndex<this._dueEnd},t.prototype.pipe=function(e){(this._downstream!==e||this._dirty)&&(this._downstream=e,e._upstream=this,e.dirty())},t.prototype.dispose=function(){this._disposed||(this._upstream&&(this._upstream._downstream=null),this._downstream&&(this._downstream._upstream=null),this._dirty=!1,this._disposed=!0)},t.prototype.getUpstream=function(){return this._upstream},t.prototype.getDownstream=function(){return this._downstream},t.prototype.setOutputEnd=function(e){this._outputDueEnd=this._settedOutputEnd=e},t})(),Ly=(function(){var t,e,r,n,a,i={reset:function(l,c,u,f){e=l,t=c,r=u,n=f,a=Math.ceil(n/r),i.next=r>1&&n>0?s:o}};return i;function o(){return e<t?e++:null}function s(){var l=e%a*r+Math.ceil(e/a),c=e>=t?null:l<n?l:e;return e++,c}})(),MC=(function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(e){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(e){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(e,r){},t.prototype.retrieveValueFromItem=function(e,r){},t.prototype.convertValue=function(e,r){return Ql(e,r)},t})();function AC(t,e){var r=new MC,n=t.data,a=r.sourceFormat=t.sourceFormat,i=t.startIndex,o="";t.seriesLayoutBy!==xn&&Wt(o);var s=[],l={},c=t.dimensionsDefine;if(c)I(c,function(m,g){var v=m.name,y={index:g,name:v,displayName:m.displayName};if(s.push(y),v!=null){var b="";la(l,v)&&Wt(b),l[v]=y}});else for(var u=0;u<t.dimensionsDetectedCount;u++)s.push({index:u});var f=qm(a,xn);e.__isBuiltIn&&(r.getRawDataItem=function(m){return f(n,i,s,m)},r.getRawData=Ne(DC,null,t)),r.cloneRawData=Ne(IC,null,t);var h=Xm(a,xn);r.count=Ne(h,null,n,i,s);var d=Zm(a);r.retrieveValue=function(m,g){var v=f(n,i,s,m);return p(v,g)};var p=r.retrieveValueFromItem=function(m,g){if(m!=null){var v=s[g];if(v)return d(m,g,v.name)}};return r.getDimensionInfo=Ne(LC,null,s,l),r.cloneAllDimensionInfo=Ne(PC,null,s),r}function DC(t){var e=t.sourceFormat;if(!Pd(e)){var r="";Wt(r)}return t.data}function IC(t){var e=t.sourceFormat,r=t.data;if(!Pd(e)){var n="";Wt(n)}if(e===Xt){for(var a=[],i=0,o=r.length;i<o;i++)a.push(r[i].slice());return a}else if(e===Jr){for(var a=[],i=0,o=r.length;i<o;i++)a.push(q({},r[i]));return a}}function LC(t,e,r){if(r!=null){if(et(r)||!isNaN(r)&&!la(e,r))return t[r];if(la(e,r))return e[r]}}function PC(t){return Ie(t)}var Py=me();function RC(t){t=Ie(t);var e=t.type,r="";e||Wt(r);var n=e.split(":");n.length!==2&&Wt(r);var a=!1;n[0]==="echarts"&&(e=n[1],a=!0),t.__isBuiltIn=a,Py.set(e,t)}function EC(t,e,r){var n=Mt(t),a=n.length,i="";a||Wt(i);for(var o=0,s=a;o<s;o++){var l=n[o];e=OC(l,e),o!==s-1&&(e.length=Math.max(e.length,1))}return e}function OC(t,e,r,n){var a="";e.length||Wt(a),de(t)||Wt(a);var i=t.type,o=Py.get(i);o||Wt(a);var s=he(e,function(c){return AC(c,o)}),l=Mt(o.transform({upstream:s[0],upstreamList:s,config:Ie(t.config)}));return he(l,function(c,u){var f="";de(c)||Wt(f),c.data||Wt(f);var h=zm(c.data);Pd(h)||Wt(f);var d,p=e[0];if(p&&u===0&&!c.dimensions){var m=p.startIndex;m&&(c.data=p.data.slice(0,m).concat(c.data)),d={seriesLayoutBy:xn,sourceHeader:m,dimensions:p.metaRawOption.dimensions}}else d={seriesLayoutBy:xn,sourceHeader:0,dimensions:c.dimensions};return sd(c.data,d,null)})}function Pd(t){return t===Xt||t===Jr}var NC=(function(){function t(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(e,r){this._sourceList=e,this._upstreamSignList=r,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,r=this._getUpstreamSourceManagers(),n=!!r.length,a,i;if(gc(e)){var o=e,s=void 0,l=void 0,c=void 0;if(n){var u=r[0];u.prepareSource(),c=u.getSource(),s=c.data,l=c.sourceFormat,i=[u._getVersionSign()]}else s=o.get("data",!0),l=Ut(s)?Vn:yr,i=[];var f=this._getSourceMetaRawOption()||{},h=c&&c.metaRawOption||{},d=Pe(f.seriesLayoutBy,h.seriesLayoutBy)||null,p=Pe(f.sourceHeader,h.sourceHeader),m=Pe(f.dimensions,h.dimensions),g=d!==h.seriesLayoutBy||!!p!=!!h.sourceHeader||m;a=g?[sd(s,{seriesLayoutBy:d,sourceHeader:p,dimensions:m},l)]:[]}else{var v=e;if(n){var y=this._applyTransform(r);a=y.sourceList,i=y.upstreamSignList}else{var b=v.get("source",!0);a=[sd(b,this._getSourceMetaRawOption(),null)],i=[]}}this._setLocalSource(a,i)},t.prototype._applyTransform=function(e){var r=this._sourceHost,n=r.get("transform",!0),a=r.get("fromTransformResult",!0);if(a!=null){var i="";e.length!==1&&Ry(i)}var o,s=[],l=[];return I(e,function(c){c.prepareSource();var u=c.getSource(a||0),f="";a!=null&&!u&&Ry(f),s.push(u),l.push(c._getVersionSign())}),n?o=EC(n,s,{datasetIndex:r.componentIndex}):a!=null&&(o=[mT(s[0])]),{sourceList:o,upstreamSignList:l}},t.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),r=0;r<e.length;r++){var n=e[r];if(n._isDirty()||this._upstreamSignList[r]!==n._getVersionSign())return!0}},t.prototype.getSource=function(e){e=e||0;var r=this._sourceList[e];if(!r){var n=this._getUpstreamSourceManagers();return n[0]&&n[0].getSource(e)}return r},t.prototype.getSharedDataStore=function(e){var r=e.makeStoreSchema();return this._innerGetDataStore(r.dimensions,e.source,r.hash)},t.prototype._innerGetDataStore=function(e,r,n){var a=0,i=this._storeList,o=i[a];o||(o=i[a]={});var s=o[n];if(!s){var l=this._getUpstreamSourceManagers()[0];gc(this._sourceHost)&&l?s=l._innerGetDataStore(e,r,n):(s=new dd,s.initData(new $m(r,e.length),e)),o[n]=s}return s},t.prototype._getUpstreamSourceManagers=function(){var e=this._sourceHost;if(gc(e)){var r=Om(e);return r?[r.getSourceManager()]:[]}else return he(vT(e),function(n){return n.getSourceManager()})},t.prototype._getSourceMetaRawOption=function(){var e=this._sourceHost,r,n,a;if(gc(e))r=e.get("seriesLayoutBy",!0),n=e.get("sourceHeader",!0),a=e.get("dimensions",!0);else if(!this._getUpstreamSourceManagers().length){var i=e;r=i.get("seriesLayoutBy",!0),n=i.get("sourceHeader",!0),a=i.get("dimensions",!0)}return{seriesLayoutBy:r,sourceHeader:n,dimensions:a}},t})();function gc(t){return t.mainType==="series"}function Ry(t){throw new Error(t)}var BC="line-height:1";function Ey(t){var e=t.lineHeight;return e==null?BC:"line-height:"+Zt(e+"")+"px"}function Oy(t,e){var r=t.color||"#6e7079",n=t.fontSize||12,a=t.fontWeight||"400",i=t.color||"#464646",o=t.fontSize||14,s=t.fontWeight||"900";return e==="html"?{nameStyle:"font-size:"+Zt(n+"")+"px;color:"+Zt(r)+";font-weight:"+Zt(a+""),valueStyle:"font-size:"+Zt(o+"")+"px;color:"+Zt(i)+";font-weight:"+Zt(s+"")}:{nameStyle:{fontSize:n,fill:r,fontWeight:a},valueStyle:{fontSize:o,fill:i,fontWeight:s}}}var zC=[0,10,20,30],FC=["",`
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
`];function Go(t,e){return e.type=t,e}function Rd(t){return t.type==="section"}function Ny(t){return Rd(t)?HC:VC}function By(t){if(Rd(t)){var e=0,r=t.blocks.length,n=r>1||r>0&&!t.noHeader;return I(t.blocks,function(a){var i=By(a);i>=e&&(e=i+ +(n&&(!i||Rd(a)&&!a.noHeader)))}),e}return 0}function HC(t,e,r,n){var a=e.noHeader,i=UC(By(e)),o=[],s=e.blocks||[];dn(!s||ee(s)),s=s||[];var l=t.orderMode;if(e.sortBlocks&&l){s=s.slice();var c={valueAsc:"asc",valueDesc:"desc"};if(la(c,l)){var u=new MT(c[l],null);s.sort(function(m,g){return u.evaluate(m.sortParam,g.sortParam)})}else l==="seriesDesc"&&s.reverse()}I(s,function(m,g){var v=e.valueFormatter,y=Ny(m)(v?q(q({},t),{valueFormatter:v}):t,m,g>0?i.html:0,n);y!=null&&o.push(y)});var f=t.renderMode==="richText"?o.join(i.richText):Ed(n,o.join(""),a?r:i.html);if(a)return f;var h=Ad(e.header,"ordinal",t.useUTC),d=Oy(n,t.renderMode).nameStyle,p=Ey(n);return t.renderMode==="richText"?Fy(t,h,d)+i.richText+f:Ed(n,'<div style="'+d+";"+p+';">'+Zt(h)+"</div>"+f,r)}function VC(t,e,r,n){var a=t.renderMode,i=e.noName,o=e.noValue,s=!e.markerType,l=e.name,c=t.useUTC,u=e.valueFormatter||t.valueFormatter||function(x){return x=ee(x)?x:[x],he(x,function(w,S){return Ad(w,ee(d)?d[S]:d,c)})};if(!(i&&o)){var f=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",a),h=i?"":Ad(l,"ordinal",c),d=e.valueType,p=o?[]:u(e.value,e.dataIndex),m=!s||!i,g=!s&&i,v=Oy(n,a),y=v.nameStyle,b=v.valueStyle;return a==="richText"?(s?"":f)+(i?"":Fy(t,h,y))+(o?"":WC(t,p,m,g,b)):Ed(n,(s?"":f)+(i?"":GC(h,!s,y))+(o?"":$C(p,m,g,b)),r)}}function zy(t,e,r,n,a,i){if(t){var o=Ny(t),s={useUTC:a,renderMode:r,orderMode:n,markupStyleCreator:e,valueFormatter:t.valueFormatter};return o(s,t,0,i)}}function UC(t){return{html:zC[t],richText:FC[t]}}function Ed(t,e,r){var n='<div style="clear:both"></div>',a="margin: "+r+"px 0 0",i=Ey(t);return'<div style="'+a+";"+i+';">'+e+n+"</div>"}function GC(t,e,r){var n=e?"margin-left:2px":"";return'<span style="'+r+";"+n+'">'+Zt(t)+"</span>"}function $C(t,e,r,n){var a=r?"10px":"20px",i=e?"float:right;margin-left:"+a:"";return t=ee(t)?t:[t],'<span style="'+i+";"+n+'">'+he(t,function(o){return Zt(o)}).join(" ")+"</span>"}function Fy(t,e,r){return t.markupStyleCreator.wrapRichTextStyle(e,r)}function WC(t,e,r,n,a){var i=[a],o=n?10:20;return r&&i.push({padding:[0,0,0,o],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(ee(e)?e.join(" "):e,i)}function qC(t,e){var r=t.getData().getItemVisual(e,"style"),n=r[t.visualDrawType];return Oa(n)}function Hy(t,e){var r=t.get("padding");return r??(e==="richText"?[8,10]:10)}var Od=(function(){function t(){this.richTextStyles={},this._nextStyleNameId=Cg()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(e,r,n){var a=n==="richText"?this._generateStyleName():null,i=gC({color:r,type:e,renderMode:n,markerId:a});return ae(i)?i:(this.richTextStyles[a]=i.style,i.content)},t.prototype.wrapRichTextStyle=function(e,r){var n={};ee(r)?I(r,function(i){return q(n,i)}):q(n,r);var a=this._generateStyleName();return this.richTextStyles[a]=n,"{"+a+"|"+e+"}"},t})();function YC(t){var e=t.series,r=t.dataIndex,n=t.multipleSeries,a=e.getData(),i=a.mapDimensionsAll("defaultedTooltip"),o=i.length,s=e.getRawValue(r),l=ee(s),c=qC(e,r),u,f,h,d;if(o>1||l&&!o){var p=XC(s,e,r,i,c);u=p.inlineValues,f=p.inlineValueTypes,h=p.blocks,d=p.inlineValues[0]}else if(o){var m=a.getDimensionInfo(i[0]);d=u=ki(a,r,i[0]),f=m.type}else d=u=l?s[0]:s;var g=Df(e),v=g&&e.name||"",y=a.getName(r),b=n?v:y;return Go("section",{header:v,noHeader:n||!g,sortParam:d,blocks:[Go("nameValue",{markerType:"item",markerColor:c,name:b,noName:!Gr(b),value:u,valueType:f,dataIndex:r})].concat(h||[])})}function XC(t,e,r,n,a){var i=e.getData(),o=ni(t,function(f,h,d){var p=i.getDimensionInfo(d);return f=f||p&&p.tooltip!==!1&&p.displayName!=null},!1),s=[],l=[],c=[];n.length?I(n,function(f){u(ki(i,r,f),f)}):I(t,u);function u(f,h){var d=i.getDimensionInfo(h);!d||d.otherDims.tooltip===!1||(o?c.push(Go("nameValue",{markerType:"subItem",markerColor:a,name:d.displayName,value:f,valueType:d.type})):(s.push(f),l.push(d.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:c}}var $n=ht();function mc(t,e){return t.getName(e)||t.getId(e)}var ZC="__universalTransitionEnabled",Qr=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._selectedDataIndicesMap={},r}return e.prototype.init=function(r,n,a){this.seriesIndex=this.componentIndex,this.dataTask=Uo({count:jC,reset:JC}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,a);var i=$n(this).sourceManager=new NC(this);i.prepareSource();var o=this.getInitialData(r,a);Uy(o,this),this.dataTask.context.data=o,$n(this).dataBeforeProcessed=o,Vy(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(r,n){var a=Vo(this),i=a?vc(r):{},o=this.subType;Ye.hasClass(o)&&(o+="Series"),Oe(r,n.getTheme().get(this.subType)),Oe(r,this.getDefaultOption()),Lg(r,"label",["show"]),this.fillDataTextStyle(r.data),a&&Pi(r,i,a)},e.prototype.mergeOption=function(r,n){r=Oe(this.option,r,!0),this.fillDataTextStyle(r.data);var a=Vo(this);a&&Pi(this.option,r,a);var i=$n(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(r,n);Uy(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,$n(this).dataBeforeProcessed=o,Vy(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(r){if(r&&!Ut(r))for(var n=["show"],a=0;a<r.length;a++)r[a]&&r[a].label&&Lg(r[a],"label",n)},e.prototype.getInitialData=function(r,n){},e.prototype.appendData=function(r){var n=this.getRawData();n.appendData(r.data)},e.prototype.getData=function(r){var n=Nd(this);if(n){var a=n.context.data;return r==null||!a.getLinkedData?a:a.getLinkedData(r)}else return $n(this).data},e.prototype.getAllData=function(){var r=this.getData();return r&&r.getLinkedDataAll?r.getLinkedDataAll():[{data:r}]},e.prototype.setData=function(r){var n=Nd(this);if(n){var a=n.context;a.outputData=r,n!==this.dataTask&&(a.data=r)}$n(this).data=r},e.prototype.getEncode=function(){var r=this.get("encode",!0);if(r)return me(r)},e.prototype.getSourceManager=function(){return $n(this).sourceManager},e.prototype.getSource=function(){return this.getSourceManager().getSource()},e.prototype.getRawData=function(){return $n(this).dataBeforeProcessed},e.prototype.getColorBy=function(){var r=this.get("colorBy");return r||"series"},e.prototype.isColorBySeries=function(){return this.getColorBy()==="series"},e.prototype.getBaseAxis=function(){var r=this.coordinateSystem;return r&&r.getBaseAxis&&r.getBaseAxis()},e.prototype.formatTooltip=function(r,n,a){return YC({series:this,dataIndex:r,multipleSeries:n})},e.prototype.isAnimationEnabled=function(){var r=this.ecModel;if(_e.node&&!(r&&r.ssr))return!1;var n=this.getShallow("animation");return n&&this.getData().count()>this.getShallow("animationThreshold")&&(n=!1),!!n},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(r,n,a){var i=this.ecModel,o=Ld.prototype.getColorFromPalette.call(this,r,n,a);return o||(o=i.getColorFromPalette(r,n,a)),o},e.prototype.coordDimToDataDim=function(r){return this.getRawData().mapDimensionsAll(r)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(r,n){this._innerSelect(this.getData(n),r)},e.prototype.unselect=function(r,n){var a=this.option.selectedMap;if(a){var i=this.option.selectedMode,o=this.getData(n);if(i==="series"||a==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s<r.length;s++){var l=r[s],c=mc(o,l);a[c]=!1,this._selectedDataIndicesMap[c]=-1}}},e.prototype.toggleSelect=function(r,n){for(var a=[],i=0;i<r.length;i++)a[0]=r[i],this.isSelected(r[i],n)?this.unselect(a,n):this.select(a,n)},e.prototype.getSelectedDataIndices=function(){if(this.option.selectedMap==="all")return[].slice.call(this.getData().getIndices());for(var r=this._selectedDataIndicesMap,n=at(r),a=[],i=0;i<n.length;i++){var o=r[n[i]];o>=0&&a.push(o)}return a},e.prototype.isSelected=function(r,n){var a=this.option.selectedMap;if(!a)return!1;var i=this.getData(n);return(a==="all"||a[mc(i,r)])&&!i.getItemModel(r).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[ZC])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},e.prototype._innerSelect=function(r,n){var a,i,o=this.option,s=o.selectedMode,l=n.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){de(o.selectedMap)||(o.selectedMap={});for(var c=o.selectedMap,u=0;u<l;u++){var f=n[u],h=mc(r,f);c[h]=!0,this._selectedDataIndicesMap[h]=r.getRawIndex(f)}}else if(s==="single"||s===!0){var d=n[l-1],h=mc(r,d);o.selectedMap=(a={},a[h]=!0,a),this._selectedDataIndicesMap=(i={},i[h]=r.getRawIndex(d),i)}}},e.prototype._initSelectedMapFromData=function(r){if(!this.option.selectedMap){var n=[];r.hasItemOption&&r.each(function(a){var i=r.getRawDataItem(a);i&&i.selected&&n.push(a)}),n.length>0&&this._innerSelect(r,n)}},e.registerClass=function(r){return Ye.registerClass(r)},e.protoInitialize=(function(){var r=e.prototype;r.type="series.__base__",r.seriesIndex=0,r.ignoreStyleOnData=!1,r.hasSymbolVisual=!1,r.defaultSymbol="circle",r.visualStyleAccessPath="itemStyle",r.visualDrawType="fill"})(),e})(Ye);Ur(Qr,TC),Ur(Qr,Ld),kv(Qr,Ye);function Vy(t){var e=t.name;Df(t)||(t.name=KC(t)||e)}function KC(t){var e=t.getRawData(),r=e.mapDimensionsAll("seriesName"),n=[];return I(r,function(a){var i=e.getDimensionInfo(a);i.displayName&&n.push(i.displayName)}),n.join(" ")}function jC(t){return t.model.getRawData().count()}function JC(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),QC}function QC(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Uy(t,e){I(zw(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),function(r){t.wrapMethod(r,dt(eM,e))})}function eM(t,e){var r=Nd(t);return r&&r.setOutputEnd((e||this).count()),e}function Nd(t){var e=(t.ecModel||{}).scheduler,r=e&&e.getPipeline(t.uid);if(r){var n=r.currentTask;if(n){var a=n.agentStubMap;a&&(n=a.get(t.uid))}return n}}var tM=qe.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var r=e.cx,n=e.cy,a=e.width/2,i=e.height/2;t.moveTo(r,n-i),t.lineTo(r+a,n+i),t.lineTo(r-a,n+i),t.closePath()}}),rM=qe.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var r=e.cx,n=e.cy,a=e.width/2,i=e.height/2;t.moveTo(r,n-i),t.lineTo(r+a,n),t.lineTo(r,n+i),t.lineTo(r-a,n),t.closePath()}}),nM=qe.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var r=e.x,n=e.y,a=e.width/5*3,i=Math.max(a,e.height),o=a/2,s=o*o/(i-o),l=n-i+o+s,c=Math.asin(s/o),u=Math.cos(c)*o,f=Math.sin(c),h=Math.cos(c),d=o*.6,p=o*.7;t.moveTo(r-u,l+s),t.arc(r,l,o,Math.PI-c,Math.PI*2+c),t.bezierCurveTo(r+u-f*d,l+s+h*d,r,n-p,r,n),t.bezierCurveTo(r,n-p,r-u+f*d,l+s+h*d,r-u,l+s),t.closePath()}}),aM=qe.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var r=e.height,n=e.width,a=e.x,i=e.y,o=n/3*2;t.moveTo(a,i),t.lineTo(a+o,i+r),t.lineTo(a,i+r/4*3),t.lineTo(a-o,i+r),t.lineTo(a,i),t.closePath()}}),iM={line:Hn,rect:_t,roundRect:_t,square:_t,circle:Nl,diamond:rM,pin:nM,arrow:aM,triangle:tM},oM={line:function(t,e,r,n,a){a.x1=t,a.y1=e+n/2,a.x2=t+r,a.y2=e+n/2},rect:function(t,e,r,n,a){a.x=t,a.y=e,a.width=r,a.height=n},roundRect:function(t,e,r,n,a){a.x=t,a.y=e,a.width=r,a.height=n,a.r=Math.min(r,n)/4},square:function(t,e,r,n,a){var i=Math.min(r,n);a.x=t,a.y=e,a.width=i,a.height=i},circle:function(t,e,r,n,a){a.cx=t+r/2,a.cy=e+n/2,a.r=Math.min(r,n)/2},diamond:function(t,e,r,n,a){a.cx=t+r/2,a.cy=e+n/2,a.width=r,a.height=n},pin:function(t,e,r,n,a){a.x=t+r/2,a.y=e+n/2,a.width=r,a.height=n},arrow:function(t,e,r,n,a){a.x=t+r/2,a.y=e+n/2,a.width=r,a.height=n},triangle:function(t,e,r,n,a){a.cx=t+r/2,a.cy=e+n/2,a.width=r,a.height=n}},Bd={};I(iM,function(t,e){Bd[e]=new t});var sM=qe.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(t,e,r){var n=Qs(t,e,r),a=this.shape;return a&&a.symbolType==="pin"&&e.position==="inside"&&(n.y=r.y+r.height*.4),n},buildPath:function(t,e,r){var n=e.symbolType;if(n!=="none"){var a=Bd[n];a||(n="rect",a=Bd[n]),oM[n](e.x,e.y,e.width,e.height,a.shape),a.buildPath(t,a.shape,r)}}});function lM(t,e){if(this.type!=="image"){var r=this.style;this.__isEmptyBrush?(r.stroke=t,r.fill=e||"#fff",r.lineWidth=2):this.shape.symbolType==="line"?r.stroke=t:r.fill=t,this.markRedraw()}}function Ri(t,e,r,n,a,i,o){var s=t.indexOf("empty")===0;s&&(t=t.substr(5,1).toLowerCase()+t.substr(6));var l;return t.indexOf("image://")===0?l=gm(t.slice(8),new Ge(e,r,n,a),o?"center":"cover"):t.indexOf("path://")===0?l=ed(t.slice(7),{},new Ge(e,r,n,a),o?"center":"cover"):l=new sM({shape:{symbolType:t,x:e,y:r,width:n,height:a}}),l.__isEmptyBrush=s,l.setColor=lM,i&&l.setColor(i),l}function cM(t){return ee(t)||(t=[+t,+t]),[t[0]||0,t[1]||0]}function Gy(t,e){if(t!=null)return ee(t)||(t=[t,t]),[Nt(t[0],e[0])||0,Nt(Pe(t[1],t[0]),e[1])||0]}var uM=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.hasSymbolVisual=!0,r}return e.prototype.getInitialData=function(r){return md(null,this,{useEncodeDefaulter:!0})},e.prototype.getLegendIcon=function(r){var n=new St,a=Ri("line",0,r.itemHeight/2,r.itemWidth,0,r.lineStyle.stroke,!1);n.add(a),a.setStyle(r.lineStyle);var i=this.getData().getVisual("symbol"),o=this.getData().getVisual("symbolRotate"),s=i==="none"?"circle":i,l=r.itemHeight*.8,c=Ri(s,(r.itemWidth-l)/2,(r.itemHeight-l)/2,l,l,r.itemStyle.fill);n.add(c),c.setStyle(r.itemStyle);var u=r.iconRotate==="inherit"?o:r.iconRotate||0;return c.rotation=u*Math.PI/180,c.setOrigin([r.itemWidth/2,r.itemHeight/2]),s.indexOf("empty")>-1&&(c.style.stroke=c.style.fill,c.style.fill="#fff",c.style.lineWidth=2),n},e.type="series.line",e.dependencies=["grid","polar"],e.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},e})(Qr);function zd(t,e){var r=t.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var a=ki(t,e,r[0]);return a!=null?a+"":null}else if(n){for(var i=[],o=0;o<r.length;o++)i.push(ki(t,e,r[o]));return i.join(" ")}}function $y(t,e){var r=t.mapDimensionsAll("defaultedLabel");if(!ee(e))return e+"";for(var n=[],a=0;a<r.length;a++){var i=t.getDimensionIndex(r[a]);i>=0&&n.push(e[i])}return n.join(" ")}var Fd=(function(t){K(e,t);function e(r,n,a,i){var o=t.call(this)||this;return o.updateData(r,n,a,i),o}return e.prototype._createSymbol=function(r,n,a,i,o){this.removeAll();var s=Ri(r,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),s.drift=fM,this._symbolType=r,this.add(s)},e.prototype.stopSymbolAnimation=function(r){this.childAt(0).stopAnimation(null,r)},e.prototype.getSymbolType=function(){return this._symbolType},e.prototype.getSymbolPath=function(){return this.childAt(0)},e.prototype.highlight=function(){Ll(this.childAt(0))},e.prototype.downplay=function(){Pl(this.childAt(0))},e.prototype.setZ=function(r,n){var a=this.childAt(0);a.zlevel=r,a.z=n},e.prototype.setDraggable=function(r,n){var a=this.childAt(0);a.draggable=r,a.cursor=!n&&r?"move":a.cursor},e.prototype.updateData=function(r,n,a,i){this.silent=!1;var o=r.getItemVisual(n,"symbol")||"circle",s=r.hostModel,l=e.getSymbolSize(r,n),c=o!==this._symbolType,u=i&&i.disableAnimation;if(c){var f=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,f)}else{var h=this.childAt(0);h.silent=!1;var d={scaleX:l[0]/2,scaleY:l[1]/2};u?h.attr(d):or(h,d,s,n),vm(h)}if(this._updateCommon(r,n,l,a,i),c){var h=this.childAt(0);if(!u){var d={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:h.style.opacity}};h.scaleX=h.scaleY=0,h.style.opacity=0,_n(h,d,s,n)}}u&&this.childAt(0).stopAnimation("leave")},e.prototype._updateCommon=function(r,n,a,i,o){var s=this.childAt(0),l=r.hostModel,c,u,f,h,d,p,m,g,v;if(i&&(c=i.emphasisItemStyle,u=i.blurItemStyle,f=i.selectItemStyle,h=i.focus,d=i.blurScope,m=i.labelStatesModels,g=i.hoverScale,v=i.cursorStyle,p=i.emphasisDisabled),!i||r.hasItemOption){var y=i&&i.itemModel?i.itemModel:r.getItemModel(n),b=y.getModel("emphasis");c=b.getModel("itemStyle").getItemStyle(),f=y.getModel(["select","itemStyle"]).getItemStyle(),u=y.getModel(["blur","itemStyle"]).getItemStyle(),h=b.get("focus"),d=b.get("blurScope"),p=b.get("disabled"),m=Zl(y),g=b.getShallow("scale"),v=y.getShallow("cursor")}var x=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(x||0)*Math.PI/180||0);var w=Gy(r.getItemVisual(n,"symbolOffset"),a);w&&(s.x=w[0],s.y=w[1]),v&&s.attr("cursor",v);var S=r.getItemVisual(n,"style"),k=S.fill;if(s instanceof Fn){var C=s.style;s.useStyle(q({image:C.image,x:C.x,y:C.y,width:C.width,height:C.height},S))}else s.__isEmptyBrush?s.useStyle(q({},S)):s.useStyle(S),s.style.decal=null,s.setColor(k,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var A=r.getItemVisual(n,"liftZ"),M=this._z2;A!=null?M==null&&(this._z2=s.z2,s.z2+=A):M!=null&&(s.z2=M,this._z2=null);var T=o&&o.useNameLabel;Xl(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:D,inheritColor:k,defaultOpacity:S.opacity});function D(O){return T?r.getName(O):zd(r,O)}this._sizeX=a[0]/2,this._sizeY=a[1]/2;var L=s.ensureState("emphasis");L.style=c,s.ensureState("select").style=f,s.ensureState("blur").style=u;var R=g==null||g===!0?Math.max(1.1,3/this._sizeY):isFinite(g)&&g>0?+g:1;L.scaleX=this._sizeX*R,L.scaleY=this._sizeY*R,this.setSymbolScale(1),Rl(this,h,d,p)},e.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},e.prototype.fadeOut=function(r,n,a){var i=this.childAt(0),o=We(this).dataIndex,s=a&&a.animation;if(this.silent=i.silent=!0,a&&a.fadeLabel){var l=i.getTextContent();l&&Ul(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();Ul(i,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},e.getSymbolSize=function(r,n){return cM(r.getItemVisual(n,"symbolSize"))},e})(St);function fM(t,e){this.parent.drift(t,e)}function Hd(t,e,r,n){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(n.isIgnore&&n.isIgnore(r))&&!(n.clipShape&&!n.clipShape.contain(e[0],e[1]))&&t.getItemVisual(r,"symbol")!=="none"}function Wy(t){return t!=null&&!de(t)&&(t={isIgnore:t}),t||{}}function qy(t){var e=t.hostModel,r=e.getModel("emphasis");return{emphasisItemStyle:r.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:r.get("focus"),blurScope:r.get("blurScope"),emphasisDisabled:r.get("disabled"),hoverScale:r.get("scale"),labelStatesModels:Zl(e),cursorStyle:e.get("cursor")}}var dM=(function(){function t(e){this.group=new St,this._SymbolCtor=e||Fd}return t.prototype.updateData=function(e,r){this._progressiveEls=null,r=Wy(r);var n=this.group,a=e.hostModel,i=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=qy(e),c={disableAnimation:s},u=r.getSymbolPoint||function(f){return e.getItemLayout(f)};i||n.removeAll(),e.diff(i).add(function(f){var h=u(f);if(Hd(e,h,f,r)){var d=new o(e,f,l,c);d.setPosition(h),e.setItemGraphicEl(f,d),n.add(d)}}).update(function(f,h){var d=i.getItemGraphicEl(h),p=u(f);if(!Hd(e,p,f,r)){n.remove(d);return}var m=e.getItemVisual(f,"symbol")||"circle",g=d&&d.getSymbolType&&d.getSymbolType();if(!d||g&&g!==m)n.remove(d),d=new o(e,f,l,c),d.setPosition(p);else{d.updateData(e,f,l,c);var v={x:p[0],y:p[1]};s?d.attr(v):or(d,v,a)}n.add(d),e.setItemGraphicEl(f,d)}).remove(function(f){var h=i.getItemGraphicEl(f);h&&h.fadeOut(function(){n.remove(h)},a)}).execute(),this._getSymbolPoint=u,this._data=e},t.prototype.updateLayout=function(){var e=this,r=this._data;r&&r.eachItemGraphicEl(function(n,a){var i=e._getSymbolPoint(a);n.setPosition(i),n.markRedraw()})},t.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=qy(e),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(e,r,n){this._progressiveEls=[],n=Wy(n);function a(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var i=e.start;i<e.end;i++){var o=r.getItemLayout(i);if(Hd(r,o,i,n)){var s=new this._SymbolCtor(r,i,this._seriesScope);s.traverse(a),s.setPosition(o),this.group.add(s),r.setItemGraphicEl(i,s),this._progressiveEls.push(s)}}},t.prototype.eachRendered=function(e){ql(this._progressiveEls||this.group,e)},t.prototype.remove=function(e){var r=this.group,n=this._data;n&&e?n.eachItemGraphicEl(function(a){a.fadeOut(function(){r.remove(a)},n.hostModel)}):r.removeAll()},t})();function Yy(t,e,r){var n=t.getBaseAxis(),a=t.getOtherAxis(n),i=hM(a,r),o=n.dim,s=a.dim,l=e.mapDimension(s),c=e.mapDimension(o),u=s==="x"||s==="radius"?1:0,f=he(t.dimensions,function(p){return e.mapDimension(p)}),h=!1,d=e.getCalculationInfo("stackResultDimension");return Ai(e,f[0])&&(h=!0,f[0]=d),Ai(e,f[1])&&(h=!0,f[1]=d),{dataDimsForPoint:f,valueStart:i,valueAxisDim:s,baseAxisDim:o,stacked:!!h,valueDim:l,baseDim:c,baseDataOffset:u,stackedOverDimension:e.getCalculationInfo("stackedOverDimension")}}function hM(t,e){var r=0,n=t.scale.getExtent();return e==="start"?r=n[0]:e==="end"?r=n[1]:et(e)&&!isNaN(e)?r=e:n[0]>0?r=n[0]:n[1]<0&&(r=n[1]),r}function Xy(t,e,r,n){var a=NaN;t.stacked&&(a=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(a)&&(a=t.valueStart);var i=t.baseDataOffset,o=[];return o[i]=r.get(t.baseDim,n),o[1-i]=a,e.dataToPoint(o)}var Zy=typeof Float32Array<"u",pM=Zy?Float32Array:Array;function wn(t){return ee(t)?Zy?new Float32Array(t):t:new pM(t)}function vM(t,e){var r=[];return e.diff(t).add(function(n){r.push({cmd:"+",idx:n})}).update(function(n,a){r.push({cmd:"=",idx:a,idx1:n})}).remove(function(n){r.push({cmd:"-",idx:n})}).execute(),r}function gM(t,e,r,n,a,i,o,s){for(var l=vM(t,e),c=[],u=[],f=[],h=[],d=[],p=[],m=[],g=Yy(a,e,o),v=t.getLayout("points")||[],y=e.getLayout("points")||[],b=0;b<l.length;b++){var x=l[b],w=!0,S=void 0,k=void 0;switch(x.cmd){case"=":S=x.idx*2,k=x.idx1*2;var C=v[S],A=v[S+1],M=y[k],T=y[k+1];(isNaN(C)||isNaN(A))&&(C=M,A=T),c.push(C,A),u.push(M,T),f.push(r[S],r[S+1]),h.push(n[k],n[k+1]),m.push(e.getRawIndex(x.idx1));break;case"+":var D=x.idx,L=g.dataDimsForPoint,R=a.dataToPoint([e.get(L[0],D),e.get(L[1],D)]);k=D*2,c.push(R[0],R[1]),u.push(y[k],y[k+1]);var O=Xy(g,a,e,D);f.push(O[0],O[1]),h.push(n[k],n[k+1]),m.push(e.getRawIndex(D));break;case"-":w=!1}w&&(d.push(x),p.push(p.length))}p.sort(function(xe,Ce){return m[xe]-m[Ce]});for(var B=c.length,j=wn(B),P=wn(B),V=wn(B),H=wn(B),Z=[],b=0;b<p.length;b++){var re=p[b],Te=b*2,ge=re*2;j[Te]=c[ge],j[Te+1]=c[ge+1],P[Te]=u[ge],P[Te+1]=u[ge+1],V[Te]=f[ge],V[Te+1]=f[ge+1],H[Te]=h[ge],H[Te+1]=h[ge+1],Z[b]=d[re]}return{current:j,next:P,stackedOnCurrent:V,stackedOnNext:H,status:Z}}var Wn=Math.min,qn=Math.max;function Na(t,e){return isNaN(t)||isNaN(e)}function Vd(t,e,r,n,a,i,o,s,l){for(var c,u,f,h,d,p,m=r,g=0;g<n;g++){var v=e[m*2],y=e[m*2+1];if(m>=a||m<0)break;if(Na(v,y)){if(l){m+=i;continue}break}if(m===r)t[i>0?"moveTo":"lineTo"](v,y),f=v,h=y;else{var b=v-c,x=y-u;if(b*b+x*x<.5){m+=i;continue}if(o>0){for(var w=m+i,S=e[w*2],k=e[w*2+1];S===v&&k===y&&g<n;)g++,w+=i,m+=i,S=e[w*2],k=e[w*2+1],v=e[m*2],y=e[m*2+1],b=v-c,x=y-u;var C=g+1;if(l)for(;Na(S,k)&&C<n;)C++,w+=i,S=e[w*2],k=e[w*2+1];var A=.5,M=0,T=0,D=void 0,L=void 0;if(C>=n||Na(S,k))d=v,p=y;else{M=S-c,T=k-u;var R=v-c,O=S-v,B=y-u,j=k-y,P=void 0,V=void 0;if(s==="x"){P=Math.abs(R),V=Math.abs(O);var H=M>0?1:-1;d=v-H*P*o,p=y,D=v+H*V*o,L=y}else if(s==="y"){P=Math.abs(B),V=Math.abs(j);var Z=T>0?1:-1;d=v,p=y-Z*P*o,D=v,L=y+Z*V*o}else P=Math.sqrt(R*R+B*B),V=Math.sqrt(O*O+j*j),A=V/(V+P),d=v-M*o*(1-A),p=y-T*o*(1-A),D=v+M*o*A,L=y+T*o*A,D=Wn(D,qn(S,v)),L=Wn(L,qn(k,y)),D=qn(D,Wn(S,v)),L=qn(L,Wn(k,y)),M=D-v,T=L-y,d=v-M*P/V,p=y-T*P/V,d=Wn(d,qn(c,v)),p=Wn(p,qn(u,y)),d=qn(d,Wn(c,v)),p=qn(p,Wn(u,y)),M=v-d,T=y-p,D=v+M*V/P,L=y+T*V/P}t.bezierCurveTo(f,h,d,p,v,y),f=D,h=L}else t.lineTo(v,y)}c=v,u=y,m+=i}return g}var Ky=(function(){function t(){this.smooth=0,this.smoothConstraint=!0}return t})(),mM=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="ec-polyline",n}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new Ky},e.prototype.buildPath=function(r,n){var a=n.points,i=0,o=a.length/2;if(n.connectNulls){for(;o>0&&Na(a[o*2-2],a[o*2-1]);o--);for(;i<o&&Na(a[i*2],a[i*2+1]);i++);}for(;i<o;)i+=Vd(r,a,i,o,o,1,n.smooth,n.smoothMonotone,n.connectNulls)+1},e.prototype.getPointOn=function(r,n){this.path||(this.createPathProxy(),this.buildPath(this.path,this.shape));for(var a=this.path,i=a.data,o=wa.CMD,s,l,c=n==="x",u=[],f=0;f<i.length;){var h=i[f++],d=void 0,p=void 0,m=void 0,g=void 0,v=void 0,y=void 0,b=void 0;switch(h){case o.M:s=i[f++],l=i[f++];break;case o.L:if(d=i[f++],p=i[f++],b=c?(r-s)/(d-s):(r-l)/(p-l),b<=1&&b>=0){var x=c?(p-l)*b+l:(d-s)*b+s;return c?[r,x]:[x,r]}s=d,l=p;break;case o.C:d=i[f++],p=i[f++],m=i[f++],g=i[f++],v=i[f++],y=i[f++];var w=c?nl(s,d,m,v,r,u):nl(l,p,g,y,r,u);if(w>0)for(var S=0;S<w;S++){var k=u[S];if(k<=1&&k>=0){var x=c?wt(l,p,g,y,k):wt(s,d,m,v,k);return c?[r,x]:[x,r]}}s=v,l=y;break}}},e})(qe),yM=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Ky),_M=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="ec-polygon",n}return e.prototype.getDefaultShape=function(){return new yM},e.prototype.buildPath=function(r,n){var a=n.points,i=n.stackedOnPoints,o=0,s=a.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&Na(a[s*2-2],a[s*2-1]);s--);for(;o<s&&Na(a[o*2],a[o*2+1]);o++);}for(;o<s;){var c=Vd(r,a,o,s,s,1,n.smooth,l,n.connectNulls);Vd(r,i,o+c-1,c,s,-1,n.stackedOnSmooth,l,n.connectNulls),o+=c+1,r.closePath()}},e})(qe);function Ud(){var t=ht();return function(e){var r=t(e),n=e.pipelineContext,a=!!r.large,i=!!r.progressiveRender,o=r.large=!!(n&&n.large),s=r.progressiveRender=!!(n&&n.progressiveRender);return(a!==o||i!==s)&&"reset"}}var jy=ht(),bM=Ud(),Rr=(function(){function t(){this.group=new St,this.uid=rc("viewChart"),this.renderTask=Uo({plan:xM,reset:wM}),this.renderTask.context={view:this}}return t.prototype.init=function(e,r){},t.prototype.render=function(e,r,n,a){},t.prototype.highlight=function(e,r,n,a){var i=e.getData(a&&a.dataType);i&&Qy(i,a,"emphasis")},t.prototype.downplay=function(e,r,n,a){var i=e.getData(a&&a.dataType);i&&Qy(i,a,"normal")},t.prototype.remove=function(e,r){this.group.removeAll()},t.prototype.dispose=function(e,r){},t.prototype.updateView=function(e,r,n,a){this.render(e,r,n,a)},t.prototype.updateLayout=function(e,r,n,a){this.render(e,r,n,a)},t.prototype.updateVisual=function(e,r,n,a){this.render(e,r,n,a)},t.prototype.eachRendered=function(e){ql(this.group,e)},t.markUpdateMethod=function(e,r){jy(e).updateMethod=r},t.protoInitialize=(function(){var e=t.prototype;e.type="chart"})(),t})();function Jy(t,e,r){t&&Vf(t)&&(e==="emphasis"?Ll:Pl)(t,r)}function Qy(t,e,r){var n=Ma(t,e),a=e&&e.highlightKey!=null?l2(e.highlightKey):null;n!=null?I(Mt(n),function(i){Jy(t.getItemGraphicEl(i),r,a)}):t.eachItemGraphicEl(function(i){Jy(i,r,a)})}zu(Rr),Zs(Rr);function xM(t){return bM(t.model)}function wM(t){var e=t.model,r=t.ecModel,n=t.api,a=t.payload,i=e.pipelineContext.progressiveRender,o=t.view,s=a&&jy(a).updateMethod,l=i?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,r,n,a),SM[l]}var SM={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}};function e0(t,e,r,n,a){var i=t.getArea(),o=i.x,s=i.y,l=i.width,c=i.height,u=r.get(["lineStyle","width"])||0;o-=u/2,s-=u/2,l+=u,c+=u,l=Math.ceil(l),o!==Math.floor(o)&&(o=Math.floor(o),l++);var f=new _t({shape:{x:o,y:s,width:l,height:c}});if(e){var h=t.getBaseAxis(),d=h.isHorizontal(),p=h.inverse;d?(p&&(f.shape.x+=l),f.shape.width=0):(p||(f.shape.y+=c),f.shape.height=0);var m=ke(a)?function(g){a(g,f)}:null;_n(f,{shape:{width:l,height:c,x:o,y:s}},r,null,n,m)}return f}function t0(t,e,r){var n=t.getArea(),a=mt(n.r0,1),i=mt(n.r,1),o=new xi({shape:{cx:mt(t.cx,1),cy:mt(t.cy,1),r0:a,r:i,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}});if(e){var s=t.getBaseAxis().dim==="angle";s?o.shape.endAngle=n.startAngle:o.shape.r=a,_n(o,{shape:{endAngle:n.endAngle,r:i}},r)}return o}function kM(t,e,r,n,a){if(t){if(t.type==="polar")return t0(t,e,r);if(t.type==="cartesian2d")return e0(t,e,r,n,a)}else return null;return null}function Gd(t,e){return t.type===e}function r0(t,e){if(t.length===e.length){for(var r=0;r<t.length;r++)if(t[r]!==e[r])return;return!0}}function n0(t){for(var e=1/0,r=1/0,n=-1/0,a=-1/0,i=0;i<t.length;){var o=t[i++],s=t[i++];isNaN(o)||(e=Math.min(o,e),n=Math.max(o,n)),isNaN(s)||(r=Math.min(s,r),a=Math.max(s,a))}return[[e,r],[n,a]]}function a0(t,e){var r=n0(t),n=r[0],a=r[1],i=n0(e),o=i[0],s=i[1];return Math.max(Math.abs(n[0]-o[0]),Math.abs(n[1]-o[1]),Math.abs(a[0]-s[0]),Math.abs(a[1]-s[1]))}function i0(t){return et(t)?t:t?.5:0}function TM(t,e,r){if(!r.valueDim)return[];for(var n=e.count(),a=wn(n*2),i=0;i<n;i++){var o=Xy(r,t,e,i);a[i*2]=o[0],a[i*2+1]=o[1]}return a}function Yn(t,e,r,n,a){var i=r.getBaseAxis(),o=i.dim==="x"||i.dim==="radius"?0:1,s=[],l=0,c=[],u=[],f=[],h=[];if(a){for(l=0;l<t.length;l+=2){var d=e||t;!isNaN(d[l])&&!isNaN(d[l+1])&&h.push(t[l],t[l+1])}t=h}for(l=0;l<t.length-2;l+=2)switch(f[0]=t[l+2],f[1]=t[l+3],u[0]=t[l],u[1]=t[l+1],s.push(u[0],u[1]),n){case"end":c[o]=f[o],c[1-o]=u[1-o],s.push(c[0],c[1]);break;case"middle":var p=(u[o]+f[o])/2,m=[];c[o]=m[o]=p,c[1-o]=u[1-o],m[1-o]=f[1-o],s.push(c[0],c[1]),s.push(m[0],m[1]);break;default:c[o]=u[o],c[1-o]=f[1-o],s.push(c[0],c[1])}return s.push(t[l++],t[l++]),s}function CM(t,e){var r=[],n=t.length,a,i;function o(u,f,h){var d=u.coord,p=(h-d)/(f.coord-d),m=AS(p,[u.color,f.color]);return{coord:h,color:m}}for(var s=0;s<n;s++){var l=t[s],c=l.coord;if(c<0)a=l;else if(c>e){i?r.push(o(i,l,e)):a&&r.push(o(a,l,0),o(a,l,e));break}else a&&(r.push(o(a,l,0)),a=null),r.push(l),i=l}return r}function MM(t,e,r){var n=t.getVisual("visualMeta");if(!(!n||!n.length||!t.count())&&e.type==="cartesian2d"){for(var a,i,o=n.length-1;o>=0;o--){var s=t.getDimensionInfo(n[o].dimension);if(a=s&&s.coordDim,a==="x"||a==="y"){i=n[o];break}}if(i){var l=e.getAxis(a),c=he(i.stops,function(b){return{coord:l.toGlobalCoord(l.dataToCoord(b.value)),color:b.color}}),u=c.length,f=i.outerColors.slice();u&&c[0].coord>c[u-1].coord&&(c.reverse(),f.reverse());var h=CM(c,a==="x"?r.getWidth():r.getHeight()),d=h.length;if(!d&&u)return c[0].coord<0?f[1]?f[1]:c[u-1].color:f[0]?f[0]:c[0].color;var p=10,m=h[0].coord-p,g=h[d-1].coord+p,v=g-m;if(v<.001)return"transparent";I(h,function(b){b.offset=(b.coord-m)/v}),h.push({offset:d?h[d-1].offset:.5,color:f[1]||"transparent"}),h.unshift({offset:d?h[0].offset:.5,color:f[0]||"transparent"});var y=new hm(0,0,0,0,h,!0);return y[a]=m,y[a+"2"]=g,y}}}function AM(t,e,r){var n=t.get("showAllSymbol"),a=n==="auto";if(!(n&&!a)){var i=r.getAxesByScale("ordinal")[0];if(i&&!(a&&DM(i,e))){var o=e.mapDimension(i.dim),s={};return I(i.getViewLabels(),function(l){var c=i.scale.getRawOrdinalNumber(l.tickValue);s[c]=1}),function(l){return!s.hasOwnProperty(e.get(o,l))}}}}function DM(t,e){var r=t.getExtent(),n=Math.abs(r[1]-r[0])/t.scale.count();isNaN(n)&&(n=0);for(var a=e.count(),i=Math.max(1,Math.round(a/5)),o=0;o<a;o+=i)if(Fd.getSymbolSize(e,o)[t.isHorizontal()?1:0]*1.5>n)return!1;return!0}function IM(t,e){return isNaN(t)||isNaN(e)}function LM(t){for(var e=t.length/2;e>0&&IM(t[e*2-2],t[e*2-1]);e--);return e-1}function o0(t,e){return[t[e*2],t[e*2+1]]}function PM(t,e,r){for(var n=t.length/2,a=r==="x"?0:1,i,o,s=0,l=-1,c=0;c<n;c++)if(o=t[c*2+a],!(isNaN(o)||isNaN(t[c*2+1-a]))){if(c===0){i=o;continue}if(i<=e&&o>=e||i>=e&&o<=e){l=c;break}s=c,i=o}return{range:[s,l],t:(e-i)/(o-i)}}function s0(t){if(t.get(["endLabel","show"]))return!0;for(var e=0;e<Kr.length;e++)if(t.get([Kr[e],"endLabel","show"]))return!0;return!1}function $d(t,e,r,n){if(Gd(e,"cartesian2d")){var a=n.getModel("endLabel"),i=a.get("valueAnimation"),o=n.getData(),s={lastFrameIndex:0},l=s0(n)?function(d,p){t._endLabelOnDuring(d,p,o,s,i,a,e)}:null,c=e.getBaseAxis().isHorizontal(),u=e0(e,r,n,function(){var d=t._endLabel;d&&r&&s.originalX!=null&&d.attr({x:s.originalX,y:s.originalY})},l);if(!n.get("clip",!0)){var f=u.shape,h=Math.max(f.width,f.height);c?(f.y-=h,f.height+=h*2):(f.x-=h,f.width+=h*2)}return l&&l(1,u),u}else return t0(e,r,n)}function RM(t,e){var r=e.getBaseAxis(),n=r.isHorizontal(),a=r.inverse,i=n?a?"right":"left":"center",o=n?"middle":a?"top":"bottom";return{normal:{align:t.get("align")||i,verticalAlign:t.get("verticalAlign")||o}}}var EM=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(){var r=new St,n=new dM;this.group.add(n.group),this._symbolDraw=n,this._lineGroup=r,this._changePolyState=Ne(this._changePolyState,this)},e.prototype.render=function(r,n,a){var i=r.coordinateSystem,o=this.group,s=r.getData(),l=r.getModel("lineStyle"),c=r.getModel("areaStyle"),u=s.getLayout("points")||[],f=i.type==="polar",h=this._coordSys,d=this._symbolDraw,p=this._polyline,m=this._polygon,g=this._lineGroup,v=!n.ssr&&r.get("animation"),y=!c.isEmpty(),b=c.get("origin"),x=Yy(i,s,b),w=y&&TM(i,s,x),S=r.get("showSymbol"),k=r.get("connectNulls"),C=S&&!f&&AM(r,s,i),A=this._data;A&&A.eachItemGraphicEl(function(xe,Ce){xe.__temp&&(o.remove(xe),A.setItemGraphicEl(Ce,null))}),S||d.remove(),o.add(g);var M=f?!1:r.get("step"),T;i&&i.getArea&&r.get("clip",!0)&&(T=i.getArea(),T.width!=null?(T.x-=.1,T.y-=.1,T.width+=.2,T.height+=.2):T.r0&&(T.r0-=.5,T.r+=.5)),this._clipShapeForSymbol=T;var D=MM(s,i,a)||s.getVisual("style")[s.getVisual("drawType")];if(!(p&&h.type===i.type&&M===this._step))S&&d.updateData(s,{isIgnore:C,clipShape:T,disableAnimation:!0,getSymbolPoint:function(xe){return[u[xe*2],u[xe*2+1]]}}),v&&this._initSymbolLabelAnimation(s,i,T),M&&(w&&(w=Yn(w,u,i,M,k)),u=Yn(u,null,i,M,k)),p=this._newPolyline(u),y?m=this._newPolygon(u,w):m&&(g.remove(m),m=this._polygon=null),f||this._initOrUpdateEndLabel(r,i,Oa(D)),g.setClipPath($d(this,i,!0,r));else{y&&!m?m=this._newPolygon(u,w):m&&!y&&(g.remove(m),m=this._polygon=null),f||this._initOrUpdateEndLabel(r,i,Oa(D));var L=g.getClipPath();if(L){var R=$d(this,i,!1,r);_n(L,{shape:R.shape},r)}else g.setClipPath($d(this,i,!0,r));S&&d.updateData(s,{isIgnore:C,clipShape:T,disableAnimation:!0,getSymbolPoint:function(xe){return[u[xe*2],u[xe*2+1]]}}),(!r0(this._stackedOnPoints,w)||!r0(this._points,u))&&(v?this._doUpdateAnimation(s,w,i,a,M,b,k):(M&&(w&&(w=Yn(w,u,i,M,k)),u=Yn(u,null,i,M,k)),p.setShape({points:u}),m&&m.setShape({points:u,stackedOnPoints:w})))}var O=r.getModel("emphasis"),B=O.get("focus"),j=O.get("blurScope"),P=O.get("disabled");if(p.useStyle(He(l.getLineStyle(),{fill:"none",stroke:D,lineJoin:"bevel"})),Hf(p,r,"lineStyle"),p.style.lineWidth>0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var V=p.getState("emphasis").style;V.lineWidth=+p.style.lineWidth+1}We(p).seriesIndex=r.seriesIndex,Rl(p,B,j,P);var H=i0(r.get("smooth")),Z=r.get("smoothMonotone");if(p.setShape({smooth:H,smoothMonotone:Z,connectNulls:k}),m){var re=s.getCalculationInfo("stackedOnSeries"),Te=0;m.useStyle(He(c.getAreaStyle(),{fill:D,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),re&&(Te=i0(re.get("smooth"))),m.setShape({smooth:H,stackedOnSmooth:Te,smoothMonotone:Z,connectNulls:k}),Hf(m,r,"areaStyle"),We(m).seriesIndex=r.seriesIndex,Rl(m,B,j,P)}var ge=this._changePolyState;s.eachItemGraphicEl(function(xe){xe&&(xe.onHoverStateChange=ge)}),this._polyline.onHoverStateChange=ge,this._data=s,this._coordSys=i,this._stackedOnPoints=w,this._points=u,this._step=M,this._valueOrigin=b,r.get("triggerLineEvent")&&(this.packEventData(r,p),m&&this.packEventData(r,m))},e.prototype.packEventData=function(r,n){We(n).eventData={componentType:"series",componentSubType:"line",componentIndex:r.componentIndex,seriesIndex:r.seriesIndex,seriesName:r.name,seriesType:"line"}},e.prototype.highlight=function(r,n,a,i){var o=r.getData(),s=Ma(o,i);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),c=o.getItemGraphicEl(s);if(!c){var u=l[s*2],f=l[s*2+1];if(isNaN(u)||isNaN(f)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(u,f))return;var h=r.get("zlevel")||0,d=r.get("z")||0;c=new Fd(o,s),c.x=u,c.y=f,c.setZ(h,d);var p=c.getSymbolPath().getTextContent();p&&(p.zlevel=h,p.z=d,p.z2=this._polyline.z2+1),c.__temp=!0,o.setItemGraphicEl(s,c),c.stopSymbolAnimation(!0),this.group.add(c)}c.highlight()}else Rr.prototype.highlight.call(this,r,n,a,i)},e.prototype.downplay=function(r,n,a,i){var o=r.getData(),s=Ma(o,i);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else Rr.prototype.downplay.call(this,r,n,a,i)},e.prototype._changePolyState=function(r){var n=this._polygon;Gg(this._polyline,r),n&&Gg(n,r)},e.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new mM({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},e.prototype._newPolygon=function(r,n){var a=this._polygon;return a&&this._lineGroup.remove(a),a=new _M({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(a),this._polygon=a,a},e.prototype._initSymbolLabelAnimation=function(r,n,a){var i,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(i=s.isHorizontal(),o=!1):n.type==="polar"&&(i=s.dim==="angle",o=!0);var c=r.hostModel,u=c.get("animationDuration");ke(u)&&(u=u(null));var f=c.get("animationDelay")||0,h=ke(f)?f(null):f;r.eachItemGraphicEl(function(d,p){var m=d;if(m){var g=[d.x,d.y],v=void 0,y=void 0,b=void 0;if(a)if(o){var x=a,w=n.pointToCoord(g);i?(v=x.startAngle,y=x.endAngle,b=-w[1]/180*Math.PI):(v=x.r0,y=x.r,b=w[0])}else{var S=a;i?(v=S.x,y=S.x+S.width,b=d.x):(v=S.y+S.height,y=S.y,b=d.y)}var k=y===v?0:(b-v)/(y-v);l&&(k=1-k);var C=ke(f)?f(p):u*k+h,A=m.getSymbolPath(),M=A.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:C}),M&&M.animateFrom({style:{opacity:0}},{duration:300,delay:C}),A.disableLabelAnimation=!0}})},e.prototype._initOrUpdateEndLabel=function(r,n,a){var i=r.getModel("endLabel");if(s0(r)){var o=r.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var c=this._endLabel;c||(c=this._endLabel=new $t({z2:200}),c.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var u=LM(l);u>=0&&(Xl(s,Zl(r,"endLabel"),{inheritColor:a,labelFetcher:r,labelDataIndex:u,defaultText:function(f,h,d){return d!=null?$y(o,d):zd(o,f)},enableTextSetter:!0},RM(i,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},e.prototype._endLabelOnDuring=function(r,n,a,i,o,s,l){var c=this._endLabel,u=this._polyline;if(c){r<1&&i.originalX==null&&(i.originalX=c.x,i.originalY=c.y);var f=a.getLayout("points"),h=a.hostModel,d=h.get("connectNulls"),p=s.get("precision"),m=s.get("distance")||0,g=l.getBaseAxis(),v=g.isHorizontal(),y=g.inverse,b=n.shape,x=y?v?b.x:b.y+b.height:v?b.x+b.width:b.y,w=(v?m:0)*(y?-1:1),S=(v?0:-m)*(y?-1:1),k=v?"x":"y",C=PM(f,x,k),A=C.range,M=A[1]-A[0],T=void 0;if(M>=1){if(M>1&&!d){var D=o0(f,A[0]);c.attr({x:D[0]+w,y:D[1]+S}),o&&(T=h.getRawValue(A[0]))}else{var D=u.getPointOn(x,k);D&&c.attr({x:D[0]+w,y:D[1]+S});var L=h.getRawValue(A[0]),R=h.getRawValue(A[1]);o&&(T=Uk(a,p,L,R,C.t))}i.lastFrameIndex=A[0]}else{var O=r===1||i.lastFrameIndex>0?A[0]:0,D=o0(f,O);o&&(T=h.getRawValue(O)),c.attr({x:D[0]+w,y:D[1]+S})}if(o){var B=Kl(c);typeof B.setLabelText=="function"&&B.setLabelText(T)}}},e.prototype._doUpdateAnimation=function(r,n,a,i,o,s,l){var c=this._polyline,u=this._polygon,f=r.hostModel,h=gM(this._data,r,this._stackedOnPoints,n,this._coordSys,a,this._valueOrigin),d=h.current,p=h.stackedOnCurrent,m=h.next,g=h.stackedOnNext;if(o&&(p=Yn(h.stackedOnCurrent,h.current,a,o,l),d=Yn(h.current,null,a,o,l),g=Yn(h.stackedOnNext,h.next,a,o,l),m=Yn(h.next,null,a,o,l)),a0(d,m)>3e3||u&&a0(p,g)>3e3){c.stopAnimation(),c.setShape({points:m}),u&&(u.stopAnimation(),u.setShape({points:m,stackedOnPoints:g}));return}c.shape.__points=h.current,c.shape.points=d;var v={shape:{points:m}};h.current!==d&&(v.shape.__points=h.next),c.stopAnimation(),or(c,v,f),u&&(u.setShape({points:d,stackedOnPoints:p}),u.stopAnimation(),or(u,{shape:{stackedOnPoints:g}},f),c.shape.points!==u.shape.points&&(u.shape.points=c.shape.points));for(var y=[],b=h.status,x=0;x<b.length;x++){var w=b[x].cmd;if(w==="="){var S=r.getItemGraphicEl(b[x].idx1);S&&y.push({el:S,ptIdx:x})}}c.animators&&c.animators.length&&c.animators[0].during(function(){u&&u.dirtyShape();for(var k=c.shape.__points,C=0;C<y.length;C++){var A=y[C].el,M=y[C].ptIdx*2;A.x=k[M],A.y=k[M+1],A.markRedraw()}})},e.prototype.remove=function(r){var n=this.group,a=this._data;this._lineGroup.removeAll(),this._symbolDraw.remove(!0),a&&a.eachItemGraphicEl(function(i,o){i.__temp&&(n.remove(i),a.setItemGraphicEl(o,null))}),this._polyline=this._polygon=this._coordSys=this._points=this._stackedOnPoints=this._endLabel=this._data=null},e.type="line",e})(Rr);function OM(t,e){return{seriesType:t,plan:Ud(),reset:function(r){var n=r.getData(),a=r.coordinateSystem;if(r.pipelineContext,!!a){var i=he(a.dimensions,function(f){return n.mapDimension(f)}).slice(0,2),o=i.length,s=n.getCalculationInfo("stackResultDimension");Ai(n,i[0])&&(i[0]=s),Ai(n,i[1])&&(i[1]=s);var l=n.getStore(),c=n.getDimensionIndex(i[0]),u=n.getDimensionIndex(i[1]);return o&&{progress:function(f,h){for(var d=f.end-f.start,p=wn(d*o),m=[],g=[],v=f.start,y=0;v<f.end;v++){var b=void 0;if(o===1){var x=l.get(c,v);b=a.dataToPoint(x,null,g)}else m[0]=l.get(c,v),m[1]=l.get(u,v),b=a.dataToPoint(m,null,g);p[y++]=b[0],p[y++]=b[1]}h.setLayout("points",p)}}}}}}var NM={average:function(t){for(var e=0,r=0,n=0;n<t.length;n++)isNaN(t[n])||(e+=t[n],r++);return r===0?NaN:e/r},sum:function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r]||0;return e},max:function(t){for(var e=-1/0,r=0;r<t.length;r++)t[r]>e&&(e=t[r]);return isFinite(e)?e:NaN},min:function(t){for(var e=1/0,r=0;r<t.length;r++)t[r]<e&&(e=t[r]);return isFinite(e)?e:NaN},nearest:function(t){return t[0]}},BM=function(t){return Math.round(t.length/2)};function l0(t){return{seriesType:t,reset:function(e,r,n){var a=e.getData(),i=e.get("sampling"),o=e.coordinateSystem,s=a.count();if(s>10&&o.type==="cartesian2d"&&i){var l=o.getBaseAxis(),c=o.getOtherAxis(l),u=l.getExtent(),f=n.getDevicePixelRatio(),h=Math.abs(u[1]-u[0])*(f||1),d=Math.round(s/h);if(isFinite(d)&&d>1){i==="lttb"?e.setData(a.lttbDownSample(a.mapDimension(c.dim),1/d)):i==="minmax"&&e.setData(a.minmaxDownSample(a.mapDimension(c.dim),1/d));var p=void 0;ae(i)?p=NM[i]:ke(i)&&(p=i),p&&e.setData(a.downSample(a.mapDimension(c.dim),1/d,p,BM))}}}}}function zM(t){t.registerChartView(EM),t.registerSeriesModel(uM),t.registerLayout(OM("line")),t.registerVisual({seriesType:"line",reset:function(e){var r=e.getData(),n=e.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=r.getVisual("style").fill),r.setVisual("legendLineStyle",n)}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,l0("line"))}var FM="__ec_stack_";function c0(t){return t.get("stack")||FM+t.seriesIndex}function Wd(t){return t.dim+t.index}function u0(t,e){var r=[];return e.eachSeriesByType(t,function(n){d0(n)&&r.push(n)}),r}function HM(t){var e={};I(t,function(l){var c=l.coordinateSystem,u=c.getBaseAxis();if(!(u.type!=="time"&&u.type!=="value"))for(var f=l.getData(),h=u.dim+"_"+u.index,d=f.getDimensionIndex(f.mapDimension(u.dim)),p=f.getStore(),m=0,g=p.count();m<g;++m){var v=p.get(d,m);e[h]?e[h].push(v):e[h]=[v]}});var r={};for(var n in e)if(e.hasOwnProperty(n)){var a=e[n];if(a){a.sort(function(l,c){return l-c});for(var i=null,o=1;o<a.length;++o){var s=a[o]-a[o-1];s>0&&(i=i===null?s:Math.min(i,s))}r[n]=i}}return r}function f0(t){var e=HM(t),r=[];return I(t,function(n){var a=n.coordinateSystem,i=a.getBaseAxis(),o=i.getExtent(),s;if(i.type==="category")s=i.getBandWidth();else if(i.type==="value"||i.type==="time"){var l=i.dim+"_"+i.index,c=e[l],u=Math.abs(o[1]-o[0]),f=i.scale.getExtent(),h=Math.abs(f[1]-f[0]);s=c?u/h*c:u}else{var d=n.getData();s=Math.abs(o[1]-o[0])/d.count()}var p=Nt(n.get("barWidth"),s),m=Nt(n.get("barMaxWidth"),s),g=Nt(n.get("barMinWidth")||(h0(n)?.5:1),s),v=n.get("barGap"),y=n.get("barCategoryGap");r.push({bandWidth:s,barWidth:p,barMaxWidth:m,barMinWidth:g,barGap:v,barCategoryGap:y,axisKey:Wd(i),stackId:c0(n)})}),VM(r)}function VM(t){var e={};I(t,function(n,a){var i=n.axisKey,o=n.bandWidth,s=e[i]||{bandWidth:o,remainedWidth:o,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},l=s.stacks;e[i]=s;var c=n.stackId;l[c]||s.autoWidthCount++,l[c]=l[c]||{width:0,maxWidth:0};var u=n.barWidth;u&&!l[c].width&&(l[c].width=u,u=Math.min(s.remainedWidth,u),s.remainedWidth-=u);var f=n.barMaxWidth;f&&(l[c].maxWidth=f);var h=n.barMinWidth;h&&(l[c].minWidth=h);var d=n.barGap;d!=null&&(s.gap=d);var p=n.barCategoryGap;p!=null&&(s.categoryGap=p)});var r={};return I(e,function(n,a){r[a]={};var i=n.stacks,o=n.bandWidth,s=n.categoryGap;if(s==null){var l=at(i).length;s=Math.max(35-l*4,15)+"%"}var c=Nt(s,o),u=Nt(n.gap,1),f=n.remainedWidth,h=n.autoWidthCount,d=(f-c)/(h+(h-1)*u);d=Math.max(d,0),I(i,function(v){var y=v.maxWidth,b=v.minWidth;if(v.width){var x=v.width;y&&(x=Math.min(x,y)),b&&(x=Math.max(x,b)),v.width=x,f-=x+u*x,h--}else{var x=d;y&&y<x&&(x=Math.min(y,f)),b&&b>x&&(x=b),x!==d&&(v.width=x,f-=x+u*x,h--)}}),d=(f-c)/(h+(h-1)*u),d=Math.max(d,0);var p=0,m;I(i,function(v,y){v.width||(v.width=d),m=v,p+=v.width*(1+u)}),m&&(p-=m.width*u);var g=-p/2;I(i,function(v,y){r[a][y]=r[a][y]||{bandWidth:o,offset:g,width:v.width},g+=v.width*(1+u)})}),r}function UM(t,e,r){if(t&&e){var n=t[Wd(e)];return n}}function GM(t,e){var r=u0(t,e),n=f0(r);I(r,function(a){var i=a.getData(),o=a.coordinateSystem,s=o.getBaseAxis(),l=c0(a),c=n[Wd(s)][l],u=c.offset,f=c.width;i.setLayout({bandWidth:c.bandWidth,offset:u,size:f})})}function $M(t){return{seriesType:t,plan:Ud(),reset:function(e){if(d0(e)){var r=e.getData(),n=e.coordinateSystem,a=n.getBaseAxis(),i=n.getOtherAxis(a),o=r.getDimensionIndex(r.mapDimension(i.dim)),s=r.getDimensionIndex(r.mapDimension(a.dim)),l=e.get("showBackground",!0),c=r.mapDimension(i.dim),u=r.getCalculationInfo("stackResultDimension"),f=Ai(r,c)&&!!r.getCalculationInfo("stackedOnSeries"),h=i.isHorizontal(),d=WM(a,i),p=h0(e),m=e.get("barMinHeight")||0,g=u&&r.getDimensionIndex(u),v=r.getLayout("size"),y=r.getLayout("offset");return{progress:function(b,x){for(var w=b.count,S=p&&wn(w*3),k=p&&l&&wn(w*3),C=p&&wn(w),A=n.master.getRect(),M=h?A.width:A.height,T,D=x.getStore(),L=0;(T=b.next())!=null;){var R=D.get(f?g:o,T),O=D.get(s,T),B=d,j=void 0;f&&(j=+R-D.get(o,T));var P=void 0,V=void 0,H=void 0,Z=void 0;if(h){var re=n.dataToPoint([R,O]);if(f){var Te=n.dataToPoint([j,O]);B=Te[0]}P=B,V=re[1]+y,H=re[0]-B,Z=v,Math.abs(H)<m&&(H=(H<0?-1:1)*m)}else{var re=n.dataToPoint([O,R]);if(f){var Te=n.dataToPoint([O,j]);B=Te[1]}P=re[0]+y,V=B,H=v,Z=re[1]-B,Math.abs(Z)<m&&(Z=(Z<=0?-1:1)*m)}p?(S[L]=P,S[L+1]=V,S[L+2]=h?H:Z,k&&(k[L]=h?A.x:P,k[L+1]=h?V:A.y,k[L+2]=M),C[T]=T):x.setItemLayout(T,{x:P,y:V,width:H,height:Z}),L+=3}p&&x.setLayout({largePoints:S,largeDataIndices:C,largeBackgroundPoints:k,valueAxisHorizontal:h})}}}}}}function d0(t){return t.coordinateSystem&&t.coordinateSystem.type==="cartesian2d"}function h0(t){return t.pipelineContext&&t.pipelineContext.large}function WM(t,e){var r=e.model.get("startValue");return r||(r=0),e.toGlobalCoord(e.dataToCoord(e.type==="log"?r>0?r:1:r))}var qd=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.getInitialData=function(r,n){return md(null,this,{useEncodeDefaulter:!0})},e.prototype.getMarkerPosition=function(r,n,a){var i=this.coordinateSystem;if(i&&i.clampData){var o=i.clampData(r),s=i.dataToPoint(o);if(a)I(i.getAxes(),function(h,d){if(h.type==="category"&&n!=null){var p=h.getTicksCoords(),m=h.getTickModel().get("alignWithLabel"),g=o[d],v=n[d]==="x1"||n[d]==="y1";if(v&&!m&&(g+=1),p.length<2)return;if(p.length===2){s[d]=h.toGlobalCoord(h.getExtent()[v?1:0]);return}for(var y=void 0,b=void 0,x=1,w=0;w<p.length;w++){var S=p[w].coord,k=w===p.length-1?p[w-1].tickValue+x:p[w].tickValue;if(k===g){b=S;break}else if(k<g)y=S;else if(y!=null&&k>g){b=(S+y)/2;break}w===1&&(x=k-p[0].tickValue)}b==null&&(y?y&&(b=p[p.length-1].coord):b=p[0].coord),s[d]=h.toGlobalCoord(b)}});else{var l=this.getData(),c=l.getLayout("offset"),u=l.getLayout("size"),f=i.getBaseAxis().isHorizontal()?0:1;s[f]+=c+u/2}return s}return[NaN,NaN]},e.type="series.__base_bar__",e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},e})(Qr);Qr.registerClass(qd);var qM=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.getInitialData=function(){return md(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},e.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},e.prototype.getProgressiveThreshold=function(){var r=this.get("progressiveThreshold"),n=this.get("largeThreshold");return n>r&&(r=n),r},e.prototype.brushSelector=function(r,n,a){return a.rect(n.getItemLayout(r))},e.type="series.bar",e.dependencies=["grid","polar"],e.defaultOption=yd(qd.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),e})(qd),yc="\0__throttleOriginMethod",p0="\0__throttleRate",v0="\0__throttleType";function Yd(t,e,r){var n,a=0,i=0,o=null,s,l,c,u;e=e||0;function f(){i=new Date().getTime(),o=null,t.apply(l,c||[])}var h=function(){for(var d=[],p=0;p<arguments.length;p++)d[p]=arguments[p];n=new Date().getTime(),l=this,c=d;var m=u||e,g=u||r;u=null,s=n-(g?a:i)-m,clearTimeout(o),g?o=setTimeout(f,m):s>=0?f():o=setTimeout(f,-s),a=n};return h.clear=function(){o&&(clearTimeout(o),o=null)},h.debounceNextCall=function(d){u=d},h}function Xd(t,e,r,n){var a=t[e];if(a){var i=a[yc]||a,o=a[v0],s=a[p0];if(s!==r||o!==n){if(r==null||!n)return t[e]=i;a=t[e]=Yd(i,r,n==="debounce"),a[yc]=i,a[v0]=n,a[p0]=r}return a}}function Zd(t,e){var r=t[e];r&&r[yc]&&(r.clear&&r.clear(),t[e]=r[yc])}var YM=(function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return t})(),g0=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="sausage",n}return e.prototype.getDefaultShape=function(){return new YM},e.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.max(n.r0||0,0),s=Math.max(n.r,0),l=(s-o)*.5,c=o+l,u=n.startAngle,f=n.endAngle,h=n.clockwise,d=Math.PI*2,p=h?f-u<d:u-f<d;p||(u=f-(h?d:-d));var m=Math.cos(u),g=Math.sin(u),v=Math.cos(f),y=Math.sin(f);p?(r.moveTo(m*o+a,g*o+i),r.arc(m*c+a,g*c+i,l,-Math.PI+u,u,!h)):r.moveTo(m*s+a,g*s+i),r.arc(a,i,s,u,f,!h),r.arc(v*c+a,y*c+i,l,f-Math.PI*2,f-Math.PI,!h),o!==0&&r.arc(a,i,o,f,u,h)},e})(qe);function XM(t,e){e=e||{};var r=e.isRoundCap;return function(n,a,i){var o=a.position;if(!o||o instanceof Array)return Qs(n,a,i);var s=t(o),l=a.distance!=null?a.distance:5,c=this.shape,u=c.cx,f=c.cy,h=c.r,d=c.r0,p=(h+d)/2,m=c.startAngle,g=c.endAngle,v=(m+g)/2,y=r?Math.abs(h-d)/2:0,b=Math.cos,x=Math.sin,w=u+h*b(m),S=f+h*x(m),k="left",C="top";switch(s){case"startArc":w=u+(d-l)*b(v),S=f+(d-l)*x(v),k="center",C="top";break;case"insideStartArc":w=u+(d+l)*b(v),S=f+(d+l)*x(v),k="center",C="bottom";break;case"startAngle":w=u+p*b(m)+_c(m,l+y,!1),S=f+p*x(m)+bc(m,l+y,!1),k="right",C="middle";break;case"insideStartAngle":w=u+p*b(m)+_c(m,-l+y,!1),S=f+p*x(m)+bc(m,-l+y,!1),k="left",C="middle";break;case"middle":w=u+p*b(v),S=f+p*x(v),k="center",C="middle";break;case"endArc":w=u+(h+l)*b(v),S=f+(h+l)*x(v),k="center",C="bottom";break;case"insideEndArc":w=u+(h-l)*b(v),S=f+(h-l)*x(v),k="center",C="top";break;case"endAngle":w=u+p*b(g)+_c(g,l+y,!0),S=f+p*x(g)+bc(g,l+y,!0),k="left",C="middle";break;case"insideEndAngle":w=u+p*b(g)+_c(g,-l+y,!0),S=f+p*x(g)+bc(g,-l+y,!0),k="right",C="middle";break;default:return Qs(n,a,i)}return n=n||{},n.x=w,n.y=S,n.align=k,n.verticalAlign=C,n}}function ZM(t,e,r,n){if(et(n)){t.setTextConfig({rotation:n});return}else if(ee(e)){t.setTextConfig({rotation:0});return}var a=t.shape,i=a.clockwise?a.startAngle:a.endAngle,o=a.clockwise?a.endAngle:a.startAngle,s=(i+o)/2,l,c=r(e);switch(c){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":l=s;break;case"startAngle":case"insideStartAngle":l=i;break;case"endAngle":case"insideEndAngle":l=o;break;default:t.setTextConfig({rotation:0});return}var u=Math.PI*1.5-l;c==="middle"&&u>Math.PI/2&&u<Math.PI*1.5&&(u-=Math.PI),t.setTextConfig({rotation:u})}function _c(t,e,r){return e*Math.sin(t)*(r?-1:1)}function bc(t,e,r){return e*Math.cos(t)*(r?1:-1)}function KM(t,e,r){var n=t.get("borderRadius");if(n==null)return{cornerRadius:0};ee(n)||(n=[n,n,n,n]);var a=Math.abs(e.r||0-e.r0||0);return{cornerRadius:he(n,function(i){return Pn(i,a)})}}var Kd=Math.max,jd=Math.min;function jM(t,e){var r=t.getArea&&t.getArea();if(Gd(t,"cartesian2d")){var n=t.getBaseAxis();if(n.type!=="category"||!n.onBand){var a=e.getLayout("bandWidth");n.isHorizontal()?(r.x-=a,r.width+=a*2):(r.y-=a,r.height+=a*2)}}return r}var JM=(function(t){K(e,t);function e(){var r=t.call(this)||this;return r.type=e.type,r._isFirstFrame=!0,r}return e.prototype.render=function(r,n,a,i){this._model=r,this._removeOnRenderedListener(a),this._updateDrawMode(r);var o=r.get("coordinateSystem");(o==="cartesian2d"||o==="polar")&&(this._progressiveEls=null,this._isLargeDraw?this._renderLarge(r,n,a):this._renderNormal(r,n,a,i))},e.prototype.incrementalPrepareRender=function(r){this._clear(),this._updateDrawMode(r),this._updateLargeClip(r)},e.prototype.incrementalRender=function(r,n){this._progressiveEls=[],this._incrementalRenderLarge(r,n)},e.prototype.eachRendered=function(r){ql(this._progressiveEls||this.group,r)},e.prototype._updateDrawMode=function(r){var n=r.pipelineContext.large;(this._isLargeDraw==null||n!==this._isLargeDraw)&&(this._isLargeDraw=n,this._clear())},e.prototype._renderNormal=function(r,n,a,i){var o=this.group,s=r.getData(),l=this._data,c=r.coordinateSystem,u=c.getBaseAxis(),f;c.type==="cartesian2d"?f=u.isHorizontal():c.type==="polar"&&(f=u.dim==="angle");var h=r.isAnimationEnabled()?r:null,d=QM(r,c);d&&this._enableRealtimeSort(d,s,a);var p=r.get("clip",!0)||d,m=jM(c,s);o.removeClipPath();var g=r.get("roundCap",!0),v=r.get("showBackground",!0),y=r.getModel("backgroundStyle"),b=y.get("borderRadius")||0,x=[],w=this._backgroundEls,S=i&&i.isInitSort,k=i&&i.type==="changeAxisOrder";function C(T){var D=xc[c.type](s,T),L=oA(c,f,D);return L.useStyle(y.getItemStyle()),c.type==="cartesian2d"?L.setShape("r",b):L.setShape("cornerRadius",b),x[T]=L,L}s.diff(l).add(function(T){var D=s.getItemModel(T),L=xc[c.type](s,T,D);if(v&&C(T),!(!s.hasValue(T)||!x0[c.type](L))){var R=!1;p&&(R=m0[c.type](m,L));var O=y0[c.type](r,s,T,L,f,h,u.model,!1,g);d&&(O.forceLabelAnimation=!0),S0(O,s,T,D,L,r,f,c.type==="polar"),S?O.attr({shape:L}):d?_0(d,h,O,L,T,f,!1,!1):_n(O,{shape:L},r,T),s.setItemGraphicEl(T,O),o.add(O),O.ignore=R}}).update(function(T,D){var L=s.getItemModel(T),R=xc[c.type](s,T,L);if(v){var O=void 0;w.length===0?O=C(D):(O=w[D],O.useStyle(y.getItemStyle()),c.type==="cartesian2d"?O.setShape("r",b):O.setShape("cornerRadius",b),x[T]=O);var B=xc[c.type](s,T),j=M0(f,B,c);or(O,{shape:j},h,T)}var P=l.getItemGraphicEl(D);if(!s.hasValue(T)||!x0[c.type](R)){o.remove(P);return}var V=!1;if(p&&(V=m0[c.type](m,R),V&&o.remove(P)),P?vm(P):P=y0[c.type](r,s,T,R,f,h,u.model,!!P,g),d&&(P.forceLabelAnimation=!0),k){var H=P.getTextContent();if(H){var Z=Kl(H);Z.prevValue!=null&&(Z.prevValue=Z.value)}}else S0(P,s,T,L,R,r,f,c.type==="polar");S?P.attr({shape:R}):d?_0(d,h,P,R,T,f,!0,k):or(P,{shape:R},r,T,null),s.setItemGraphicEl(T,P),P.ignore=V,o.add(P)}).remove(function(T){var D=l.getItemGraphicEl(T);D&&Jf(D,r,T)}).execute();var A=this._backgroundGroup||(this._backgroundGroup=new St);A.removeAll();for(var M=0;M<x.length;++M)A.add(x[M]);o.add(A),this._backgroundEls=x,this._data=s},e.prototype._renderLarge=function(r,n,a){this._clear(),T0(r,this.group),this._updateLargeClip(r)},e.prototype._incrementalRenderLarge=function(r,n){this._removeBackground(),T0(n,this.group,this._progressiveEls,!0)},e.prototype._updateLargeClip=function(r){var n=r.get("clip",!0)&&kM(r.coordinateSystem,!1,r),a=this.group;n?a.setClipPath(n):a.removeClipPath()},e.prototype._enableRealtimeSort=function(r,n,a){var i=this;if(n.count()){var o=r.baseAxis;if(this._isFirstFrame)this._dispatchInitSort(n,r,a),this._isFirstFrame=!1;else{var s=function(l){var c=n.getItemGraphicEl(l),u=c&&c.shape;return u&&Math.abs(o.isHorizontal()?u.height:u.width)||0};this._onRendered=function(){i._updateSortWithinSameData(n,s,o,a)},a.getZr().on("rendered",this._onRendered)}}},e.prototype._dataSort=function(r,n,a){var i=[];return r.each(r.mapDimension(n.dim),function(o,s){var l=a(s);l=l??NaN,i.push({dataIndex:s,mappedValue:l,ordinalNumber:o})}),i.sort(function(o,s){return s.mappedValue-o.mappedValue}),{ordinalNumbers:he(i,function(o){return o.ordinalNumber})}},e.prototype._isOrderChangedWithinSameData=function(r,n,a){for(var i=a.scale,o=r.mapDimension(a.dim),s=Number.MAX_VALUE,l=0,c=i.getOrdinalMeta().categories.length;l<c;++l){var u=r.rawIndexOf(o,i.getRawOrdinalNumber(l)),f=u<0?Number.MIN_VALUE:n(r.indexOfRawIndex(u));if(f>s)return!0;s=f}return!1},e.prototype._isOrderDifferentInView=function(r,n){for(var a=n.scale,i=a.getExtent(),o=Math.max(0,i[0]),s=Math.min(i[1],a.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==a.getRawOrdinalNumber(o))return!0},e.prototype._updateSortWithinSameData=function(r,n,a,i){if(this._isOrderChangedWithinSameData(r,n,a)){var o=this._dataSort(r,a,n);this._isOrderDifferentInView(o,a)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",axisId:a.index,sortInfo:o}))}},e.prototype._dispatchInitSort=function(r,n,a){var i=n.baseAxis,o=this._dataSort(r,i,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:o})},e.prototype.remove=function(r,n){this._clear(this._model),this._removeOnRenderedListener(n)},e.prototype.dispose=function(r,n){this._removeOnRenderedListener(n)},e.prototype._removeOnRenderedListener=function(r){this._onRendered&&(r.getZr().off("rendered",this._onRendered),this._onRendered=null)},e.prototype._clear=function(r){var n=this.group,a=this._data;r&&r.isAnimationEnabled()&&a&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],a.eachItemGraphicEl(function(i){Jf(i,r,We(i).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},e.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},e.type="bar",e})(Rr),m0={cartesian2d:function(t,e){var r=e.width<0?-1:1,n=e.height<0?-1:1;r<0&&(e.x+=e.width,e.width=-e.width),n<0&&(e.y+=e.height,e.height=-e.height);var a=t.x+t.width,i=t.y+t.height,o=Kd(e.x,t.x),s=jd(e.x+e.width,a),l=Kd(e.y,t.y),c=jd(e.y+e.height,i),u=s<o,f=c<l;return e.x=u&&o>a?s:o,e.y=f&&l>i?c:l,e.width=u?0:s-o,e.height=f?0:c-l,r<0&&(e.x+=e.width,e.width=-e.width),n<0&&(e.y+=e.height,e.height=-e.height),u||f},polar:function(t,e){var r=e.r0<=e.r?1:-1;if(r<0){var n=e.r;e.r=e.r0,e.r0=n}var a=jd(e.r,t.r),i=Kd(e.r0,t.r0);e.r=a,e.r0=i;var o=a-i<0;if(r<0){var n=e.r;e.r=e.r0,e.r0=n}return o}},y0={cartesian2d:function(t,e,r,n,a,i,o,s,l){var c=new _t({shape:q({},n),z2:1});if(c.__dataIndex=r,c.name="item",i){var u=c.shape,f=a?"height":"width";u[f]=0}return c},polar:function(t,e,r,n,a,i,o,s,l){var c=!a&&l?g0:xi,u=new c({shape:n,z2:1});u.name="item";var f=w0(a);if(u.calculateTextPosition=XM(f,{isRoundCap:c===g0}),i){var h=u.shape,d=a?"r":"endAngle",p={};h[d]=a?n.r0:n.startAngle,p[d]=n[d],(s?or:_n)(u,{shape:p},i)}return u}};function QM(t,e){var r=t.get("realtimeSort",!0),n=e.getBaseAxis();if(r&&n.type==="category"&&e.type==="cartesian2d")return{baseAxis:n,otherAxis:e.getOtherAxis(n)}}function _0(t,e,r,n,a,i,o,s){var l,c;i?(c={x:n.x,width:n.width},l={y:n.y,height:n.height}):(c={y:n.y,height:n.height},l={x:n.x,width:n.width}),s||(o?or:_n)(r,{shape:l},e,a,null);var u=e?t.baseAxis.model:null;(o?or:_n)(r,{shape:c},u,a)}function b0(t,e){for(var r=0;r<e.length;r++)if(!isFinite(t[e[r]]))return!0;return!1}var eA=["x","y","width","height"],tA=["cx","cy","r","startAngle","endAngle"],x0={cartesian2d:function(t){return!b0(t,eA)},polar:function(t){return!b0(t,tA)}},xc={cartesian2d:function(t,e,r){var n=t.getItemLayout(e),a=r?nA(r,n):0,i=n.width>0?1:-1,o=n.height>0?1:-1;return{x:n.x+i*a/2,y:n.y+o*a/2,width:n.width-i*a,height:n.height-o*a}},polar:function(t,e,r){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}};function rA(t){return t.startAngle!=null&&t.endAngle!=null&&t.startAngle===t.endAngle}function w0(t){return(function(e){var r=e?"Arc":"Angle";return function(n){switch(n){case"start":case"insideStart":case"end":case"insideEnd":return n+r;default:return n}}})(t)}function S0(t,e,r,n,a,i,o,s){var l=e.getItemVisual(r,"style");if(s){if(!i.get("roundCap")){var u=t.shape,f=KM(n.getModel("itemStyle"),u);q(u,f),t.setShape(u)}}else{var c=n.get(["itemStyle","borderRadius"])||0;t.setShape("r",c)}t.useStyle(l);var h=n.getShallow("cursor");h&&t.attr("cursor",h);var d=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?a.height>=0?"bottom":"top":a.width>=0?"right":"left",p=Zl(n);Xl(t,p,{labelFetcher:i,labelDataIndex:r,defaultText:zd(i.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:d});var m=t.getTextContent();if(s&&m){var g=n.get(["label","position"]);t.textConfig.inside=g==="middle"?!0:null,ZM(t,g==="outside"?d:g,w0(o),n.get(["label","rotate"]))}iT(m,p,i.getRawValue(r),function(y){return $y(e,y)});var v=n.getModel(["emphasis"]);Rl(t,v.get("focus"),v.get("blurScope"),v.get("disabled")),Hf(t,n),rA(a)&&(t.style.fill="none",t.style.stroke="none",I(t.states,function(y){y.style&&(y.style.fill=y.style.stroke="none")}))}function nA(t,e){var r=t.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=t.get(["itemStyle","borderWidth"])||0,a=isNaN(e.width)?Number.MAX_VALUE:Math.abs(e.width),i=isNaN(e.height)?Number.MAX_VALUE:Math.abs(e.height);return Math.min(n,a,i)}var aA=(function(){function t(){}return t})(),k0=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="largeBar",n}return e.prototype.getDefaultShape=function(){return new aA},e.prototype.buildPath=function(r,n){for(var a=n.points,i=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],c=this.barWidth,u=0;u<a.length;u+=3)l[i]=c,l[o]=a[u+2],s[i]=a[u+i],s[o]=a[u+o],r.rect(s[0],s[1],l[0],l[1])},e})(qe);function T0(t,e,r,n){var a=t.getData(),i=a.getLayout("valueAxisHorizontal")?1:0,o=a.getLayout("largeDataIndices"),s=a.getLayout("size"),l=t.getModel("backgroundStyle"),c=a.getLayout("largeBackgroundPoints");if(c){var u=new k0({shape:{points:c},incremental:!!n,silent:!0,z2:0});u.baseDimIdx=i,u.largeDataIndices=o,u.barWidth=s,u.useStyle(l.getItemStyle()),e.add(u),r&&r.push(u)}var f=new k0({shape:{points:a.getLayout("largePoints")},incremental:!!n,ignoreCoarsePointer:!0,z2:1});f.baseDimIdx=i,f.largeDataIndices=o,f.barWidth=s,e.add(f),f.useStyle(a.getVisual("style")),f.style.stroke=null,We(f).seriesIndex=t.seriesIndex,t.get("silent")||(f.on("mousedown",C0),f.on("mousemove",C0)),r&&r.push(f)}var C0=Yd(function(t){var e=this,r=iA(e,t.offsetX,t.offsetY);We(e).dataIndex=r>=0?r:null},30,!1);function iA(t,e,r){for(var n=t.baseDimIdx,a=1-n,i=t.shape.points,o=t.largeDataIndices,s=[],l=[],c=t.barWidth,u=0,f=i.length/3;u<f;u++){var h=u*3;if(l[n]=c,l[a]=i[h+2],s[n]=i[h+n],s[a]=i[h+a],l[a]<0&&(s[a]+=l[a],l[a]=-l[a]),e>=s[0]&&e<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[u]}return-1}function M0(t,e,r){if(Gd(r,"cartesian2d")){var n=e,a=r.getArea();return{x:t?n.x:a.x,y:t?a.y:n.y,width:t?n.width:a.width,height:t?a.height:n.height}}else{var a=r.getArea(),i=e;return{cx:a.cx,cy:a.cy,r0:t?a.r0:i.r0,r:t?a.r:i.r,startAngle:t?i.startAngle:0,endAngle:t?i.endAngle:Math.PI*2}}}function oA(t,e,r){var n=t.type==="polar"?xi:_t;return new n({shape:M0(e,r,t),silent:!0,z2:0})}function sA(t){t.registerChartView(JM),t.registerSeriesModel(qM),t.registerLayout(t.PRIORITY.VISUAL.LAYOUT,dt(GM,"bar")),t.registerLayout(t.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,$M("bar")),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,l0("bar")),t.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(e,r){var n=e.componentType||"series";r.eachComponent({mainType:n,query:e},function(a){e.sortInfo&&a.axis.setCategorySortInfo(e.sortInfo)})})}function Ei(t,e,r,n,a){var i=t+e;r.isSilent(i)||n.eachComponent({mainType:"series",subType:"pie"},function(o){for(var s=o.seriesIndex,l=o.option.selectedMap,c=a.selected,u=0;u<c.length;u++)if(c[u].seriesIndex===s){var f=o.getData(),h=Ma(f,a.fromActionPayload);r.trigger(i,{type:i,seriesId:o.id,name:ee(h)?f.getName(h[0]):f.getName(h),selected:ae(l)?l:q({},l)})}})}function lA(t,e,r){t.on("selectchanged",function(n){var a=r.getModel();n.isFromClick?(Ei("map","selectchanged",e,a,n),Ei("pie","selectchanged",e,a,n)):n.fromAction==="select"?(Ei("map","selected",e,a,n),Ei("pie","selected",e,a,n)):n.fromAction==="unselect"&&(Ei("map","unselected",e,a,n),Ei("pie","unselected",e,a,n))})}function cA(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];if(!n.defaultAttr.ignore){var a=n.label,i=a.getComputedTransform(),o=a.getBoundingRect(),s=!i||i[1]<1e-5&&i[2]<1e-5,l=a.style.margin||0,c=o.clone();c.applyTransform(i),c.x-=l/2,c.y-=l/2,c.width+=l,c.height+=l;var u=s?new Vl(o,i):null;e.push({label:a,labelLine:n.labelLine,rect:c,localRect:o,obb:u,priority:n.priority,defaultAttr:n.defaultAttr,layoutOption:n.computedLayoutOption,axisAligned:s,transform:i})}}return e}function uA(t){var e=[];t.sort(function(m,g){return g.priority-m.priority});var r=new Ge(0,0,0,0);function n(m){if(!m.ignore){var g=m.ensureState("emphasis");g.ignore==null&&(g.ignore=!1)}m.ignore=!0}for(var a=0;a<t.length;a++){var i=t[a],o=i.axisAligned,s=i.localRect,l=i.transform,c=i.label,u=i.labelLine;r.copy(i.rect),r.width-=.1,r.height-=.1,r.x+=.05,r.y+=.05;for(var f=i.obb,h=!1,d=0;d<e.length;d++){var p=e[d];if(r.intersect(p.rect)){if(o&&p.axisAligned){h=!0;break}if(p.obb||(p.obb=new Vl(p.localRect,p.transform)),f||(f=new Vl(s,l)),f.intersect(p.obb)){h=!0;break}}}h?(n(c),u&&n(u)):(c.attr("ignore",i.defaultAttr.ignore),u&&u.attr("ignore",i.defaultAttr.labelGuideIgnore),e.push(i))}}var Oi=(function(){function t(e,r){this.target=e,this.topTarget=r&&r.topTarget}return t})(),fA=(function(){function t(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(e){for(var r=e.target;r&&!r.draggable;)r=r.parent||r.__hostTarget;r&&(this._draggingTarget=r,r.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new Oi(r,e),"dragstart",e.event))},t.prototype._drag=function(e){var r=this._draggingTarget;if(r){var n=e.offsetX,a=e.offsetY,i=n-this._x,o=a-this._y;this._x=n,this._y=a,r.drift(i,o,e),this.handler.dispatchToElement(new Oi(r,e),"drag",e.event);var s=this.handler.findHover(n,a,r).target,l=this._dropTarget;this._dropTarget=s,r!==s&&(l&&s!==l&&this.handler.dispatchToElement(new Oi(l,e),"dragleave",e.event),s&&s!==l&&this.handler.dispatchToElement(new Oi(s,e),"dragenter",e.event))}},t.prototype._dragEnd=function(e){var r=this._draggingTarget;r&&(r.dragging=!1),this.handler.dispatchToElement(new Oi(r,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new Oi(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},t})(),dA=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Jd=[],hA=_e.browser.firefox&&+_e.browser.version.split(".")[0]<39;function Qd(t,e,r,n){return r=r||{},n?A0(t,e,r):hA&&e.layerX!=null&&e.layerX!==e.offsetX?(r.zrX=e.layerX,r.zrY=e.layerY):e.offsetX!=null?(r.zrX=e.offsetX,r.zrY=e.offsetY):A0(t,e,r),r}function A0(t,e,r){if(_e.domSupported&&t.getBoundingClientRect){var n=e.clientX,a=e.clientY;if(cy(t)){var i=t.getBoundingClientRect();r.zrX=n-i.left,r.zrY=a-i.top;return}else if(xd(Jd,t,n,a)){r.zrX=Jd[0],r.zrY=Jd[1];return}}r.zrX=r.zrY=0}function eh(t){return t||window.event}function br(t,e,r){if(e=eh(e),e.zrX!=null)return e;var n=e.type,a=n&&n.indexOf("touch")>=0;if(a){var o=n!=="touchend"?e.targetTouches[0]:e.changedTouches[0];o&&Qd(t,o,e,r)}else{Qd(t,e,e,r);var i=pA(e);e.zrDelta=i?i/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&dA.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function pA(t){var e=t.wheelDelta;if(e)return e;var r=t.deltaX,n=t.deltaY;if(r==null||n==null)return e;var a=Math.abs(n!==0?n:r),i=n>0?-1:n<0?1:r>0?-1:1;return 3*a*i}function vA(t,e,r,n){t.addEventListener(e,r,n)}function gA(t,e,r,n){t.removeEventListener(e,r,n)}var wc=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function D0(t){return t.which===2||t.which===3}var mA=(function(){function t(){this._track=[]}return t.prototype.recognize=function(e,r,n){return this._doTrack(e,r,n),this._recognize(e)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(e,r,n){var a=e.touches;if(a){for(var i={points:[],touches:[],target:r,event:e},o=0,s=a.length;o<s;o++){var l=a[o],c=Qd(n,l,{});i.points.push([c.zrX,c.zrY]),i.touches.push(l)}this._track.push(i)}},t.prototype._recognize=function(e){for(var r in th)if(th.hasOwnProperty(r)){var n=th[r](this._track,e);if(n)return n}},t})();function I0(t){var e=t[1][0]-t[0][0],r=t[1][1]-t[0][1];return Math.sqrt(e*e+r*r)}function yA(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}var th={pinch:function(t,e){var r=t.length;if(r){var n=(t[r-1]||{}).points,a=(t[r-2]||{}).points||n;if(a&&a.length>1&&n&&n.length>1){var i=I0(n)/I0(a);!isFinite(i)&&(i=1),e.pinchScale=i;var o=yA(n);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:t[0].target,event:e}}}}},L0="silent";function _A(t,e,r){return{type:t,event:r,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:r.zrX,offsetY:r.zrY,gestureEvent:r.gestureEvent,pinchX:r.pinchX,pinchY:r.pinchY,pinchScale:r.pinchScale,wheelDelta:r.zrDelta,zrByTouch:r.zrByTouch,which:r.which,stop:bA}}function bA(){wc(this.event)}var xA=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.handler=null,r}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e})(Ir),$o=(function(){function t(e,r){this.x=e,this.y=r}return t})(),wA=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],rh=new Ge(0,0,0,0),P0=(function(t){K(e,t);function e(r,n,a,i,o){var s=t.call(this)||this;return s._hovered=new $o(0,0),s.storage=r,s.painter=n,s.painterRoot=i,s._pointerSize=o,a=a||new xA,s.proxy=null,s.setHandlerProxy(a),s._draggingMgr=new fA(s),s}return e.prototype.setHandlerProxy=function(r){this.proxy&&this.proxy.dispose(),r&&(I(wA,function(n){r.on&&r.on(n,this[n],this)},this),r.handler=this),this.proxy=r},e.prototype.mousemove=function(r){var n=r.zrX,a=r.zrY,i=E0(this,n,a),o=this._hovered,s=o.target;s&&!s.__zr&&(o=this.findHover(o.x,o.y),s=o.target);var l=this._hovered=i?new $o(n,a):this.findHover(n,a),c=l.target,u=this.proxy;u.setCursor&&u.setCursor(c?c.cursor:"default"),s&&c!==s&&this.dispatchToElement(o,"mouseout",r),this.dispatchToElement(l,"mousemove",r),c&&c!==s&&this.dispatchToElement(l,"mouseover",r)},e.prototype.mouseout=function(r){var n=r.zrEventControl;n!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",r),n!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:r})},e.prototype.resize=function(){this._hovered=new $o(0,0)},e.prototype.dispatch=function(r,n){var a=this[r];a&&a.call(this,n)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(r){var n=this.proxy;n.setCursor&&n.setCursor(r)},e.prototype.dispatchToElement=function(r,n,a){r=r||{};var i=r.target;if(!(i&&i.silent)){for(var o="on"+n,s=_A(n,r,a);i&&(i[o]&&(s.cancelBubble=!!i[o].call(i,s)),i.trigger(n,s),i=i.__hostTarget?i.__hostTarget:i.parent,!s.cancelBubble););s.cancelBubble||(this.trigger(n,s),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(l){typeof l[o]=="function"&&l[o].call(l,s),l.trigger&&l.trigger(n,s)}))}},e.prototype.findHover=function(r,n,a){var i=this.storage.getDisplayList(),o=new $o(r,n);if(R0(i,o,r,n,a),this._pointerSize&&!o.target){for(var s=[],l=this._pointerSize,c=l/2,u=new Ge(r-c,n-c,l,l),f=i.length-1;f>=0;f--){var h=i[f];h!==a&&!h.ignore&&!h.ignoreCoarsePointer&&(!h.parent||!h.parent.ignoreCoarsePointer)&&(rh.copy(h.getBoundingRect()),h.transform&&rh.applyTransform(h.transform),rh.intersect(u)&&s.push(h))}if(s.length)for(var d=4,p=Math.PI/12,m=Math.PI*2,g=0;g<c;g+=d)for(var v=0;v<m;v+=p){var y=r+g*Math.cos(v),b=n+g*Math.sin(v);if(R0(s,o,y,b,a),o.target)return o}}return o},e.prototype.processGesture=function(r,n){this._gestureMgr||(this._gestureMgr=new mA);var a=this._gestureMgr;n==="start"&&a.clear();var i=a.recognize(r,this.findHover(r.zrX,r.zrY,null).target,this.proxy.dom);if(n==="end"&&a.clear(),i){var o=i.type;r.gestureEvent=o;var s=new $o;s.target=i.target,this.dispatchToElement(s,o,i.event)}},e})(Ir);I(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){P0.prototype[t]=function(e){var r=e.zrX,n=e.zrY,a=E0(this,r,n),i,o;if((t!=="mouseup"||!a)&&(i=this.findHover(r,n),o=i.target),t==="mousedown")this._downEl=o,this._downPoint=[e.zrX,e.zrY],this._upEl=o;else if(t==="mouseup")this._upEl=o;else if(t==="click"){if(this._downEl!==this._upEl||!this._downPoint||yS(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}});function SA(t,e,r){if(t[t.rectHover?"rectContain":"contain"](e,r)){for(var n=t,a=void 0,i=!1;n;){if(n.ignoreClip&&(i=!0),!i){var o=n.getClipPath();if(o&&!o.contain(e,r))return!1}n.silent&&(a=!0);var s=n.__hostTarget;n=s||n.parent}return a?L0:!0}return!1}function R0(t,e,r,n,a){for(var i=t.length-1;i>=0;i--){var o=t[i],s=void 0;if(o!==a&&!o.ignore&&(s=SA(o,r,n))&&(!e.topTarget&&(e.topTarget=o),s!==L0)){e.target=o;break}}}function E0(t,e,r){var n=t.painter;return e<0||e>n.getWidth()||r<0||r>n.getHeight()}var O0=32,Wo=7;function kA(t){for(var e=0;t>=O0;)e|=t&1,t>>=1;return t+e}function N0(t,e,r,n){var a=e+1;if(a===r)return 1;if(n(t[a++],t[e])<0){for(;a<r&&n(t[a],t[a-1])<0;)a++;TA(t,e,a)}else for(;a<r&&n(t[a],t[a-1])>=0;)a++;return a-e}function TA(t,e,r){for(r--;e<r;){var n=t[e];t[e++]=t[r],t[r--]=n}}function B0(t,e,r,n,a){for(n===e&&n++;n<r;n++){for(var i=t[n],o=e,s=n,l;o<s;)l=o+s>>>1,a(i,t[l])<0?s=l:o=l+1;var c=n-o;switch(c){case 3:t[o+3]=t[o+2];case 2:t[o+2]=t[o+1];case 1:t[o+1]=t[o];break;default:for(;c>0;)t[o+c]=t[o+c-1],c--}t[o]=i}}function nh(t,e,r,n,a,i){var o=0,s=0,l=1;if(i(t,e[r+a])>0){for(s=n-a;l<s&&i(t,e[r+a+l])>0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;l<s&&i(t,e[r+a-l])<=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var c=o;o=a-l,l=a-c}for(o++;o<l;){var u=o+(l-o>>>1);i(t,e[r+u])>0?o=u+1:l=u}return l}function ah(t,e,r,n,a,i){var o=0,s=0,l=1;if(i(t,e[r+a])<0){for(s=a+1;l<s&&i(t,e[r+a-l])<0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s);var c=o;o=a-l,l=a-c}else{for(s=n-a;l<s&&i(t,e[r+a+l])>=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o<l;){var u=o+(l-o>>>1);i(t,e[r+u])<0?l=u:o=u+1}return l}function CA(t,e){var r=Wo,n,a,i=0,o=[];n=[],a=[];function s(d,p){n[i]=d,a[i]=p,i+=1}function l(){for(;i>1;){var d=i-2;if(d>=1&&a[d-1]<=a[d]+a[d+1]||d>=2&&a[d-2]<=a[d]+a[d-1])a[d-1]<a[d+1]&&d--;else if(a[d]>a[d+1])break;u(d)}}function c(){for(;i>1;){var d=i-2;d>0&&a[d-1]<a[d+1]&&d--,u(d)}}function u(d){var p=n[d],m=a[d],g=n[d+1],v=a[d+1];a[d]=m+v,d===i-3&&(n[d+1]=n[d+2],a[d+1]=a[d+2]),i--;var y=ah(t[g],t,p,m,0,e);p+=y,m-=y,m!==0&&(v=nh(t[p+m-1],t,g,v,v-1,e),v!==0&&(m<=v?f(p,m,g,v):h(p,m,g,v)))}function f(d,p,m,g){var v=0;for(v=0;v<p;v++)o[v]=t[d+v];var y=0,b=m,x=d;if(t[x++]=t[b++],--g===0){for(v=0;v<p;v++)t[x+v]=o[y+v];return}if(p===1){for(v=0;v<g;v++)t[x+v]=t[b+v];t[x+g]=o[y];return}for(var w=r,S,k,C;;){S=0,k=0,C=!1;do if(e(t[b],o[y])<0){if(t[x++]=t[b++],k++,S=0,--g===0){C=!0;break}}else if(t[x++]=o[y++],S++,k=0,--p===1){C=!0;break}while((S|k)<w);if(C)break;do{if(S=ah(t[b],o,y,p,0,e),S!==0){for(v=0;v<S;v++)t[x+v]=o[y+v];if(x+=S,y+=S,p-=S,p<=1){C=!0;break}}if(t[x++]=t[b++],--g===0){C=!0;break}if(k=nh(o[y],t,b,g,0,e),k!==0){for(v=0;v<k;v++)t[x+v]=t[b+v];if(x+=k,b+=k,g-=k,g===0){C=!0;break}}if(t[x++]=o[y++],--p===1){C=!0;break}w--}while(S>=Wo||k>=Wo);if(C)break;w<0&&(w=0),w+=2}if(r=w,r<1&&(r=1),p===1){for(v=0;v<g;v++)t[x+v]=t[b+v];t[x+g]=o[y]}else{if(p===0)throw new Error;for(v=0;v<p;v++)t[x+v]=o[y+v]}}function h(d,p,m,g){var v=0;for(v=0;v<g;v++)o[v]=t[m+v];var y=d+p-1,b=g-1,x=m+g-1,w=0,S=0;if(t[x--]=t[y--],--p===0){for(w=x-(g-1),v=0;v<g;v++)t[w+v]=o[v];return}if(g===1){for(x-=p,y-=p,S=x+1,w=y+1,v=p-1;v>=0;v--)t[S+v]=t[w+v];t[x]=o[b];return}for(var k=r;;){var C=0,A=0,M=!1;do if(e(o[b],t[y])<0){if(t[x--]=t[y--],C++,A=0,--p===0){M=!0;break}}else if(t[x--]=o[b--],A++,C=0,--g===1){M=!0;break}while((C|A)<k);if(M)break;do{if(C=p-ah(o[b],t,d,p,p-1,e),C!==0){for(x-=C,y-=C,p-=C,S=x+1,w=y+1,v=C-1;v>=0;v--)t[S+v]=t[w+v];if(p===0){M=!0;break}}if(t[x--]=o[b--],--g===1){M=!0;break}if(A=g-nh(t[y],o,0,g,g-1,e),A!==0){for(x-=A,b-=A,g-=A,S=x+1,w=b+1,v=0;v<A;v++)t[S+v]=o[w+v];if(g<=1){M=!0;break}}if(t[x--]=t[y--],--p===0){M=!0;break}k--}while(C>=Wo||A>=Wo);if(M)break;k<0&&(k=0),k+=2}if(r=k,r<1&&(r=1),g===1){for(x-=p,y-=p,S=x+1,w=y+1,v=p-1;v>=0;v--)t[S+v]=t[w+v];t[x]=o[b]}else{if(g===0)throw new Error;for(w=x-(g-1),v=0;v<g;v++)t[w+v]=o[v]}}return{mergeRuns:l,forceMergeRuns:c,pushRun:s}}function Sc(t,e,r,n){r||(r=0),n||(n=t.length);var a=n-r;if(!(a<2)){var i=0;if(a<O0){i=N0(t,r,n,e),B0(t,r,n,r+i,e);return}var o=CA(t,e),s=kA(a);do{if(i=N0(t,r,n,e),i<s){var l=a;l>s&&(l=s),B0(t,r,r+l,r+i,e),i=l}o.pushRun(r,i),o.mergeRuns(),a-=i,r+=i}while(a!==0);o.forceMergeRuns()}}var z0=!1;function ih(){z0||(z0=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function F0(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var MA=(function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=F0}return t.prototype.traverse=function(e,r){for(var n=0;n<this._roots.length;n++)this._roots[n].traverse(e,r)},t.prototype.getDisplayList=function(e,r){r=r||!1;var n=this._displayList;return(e||!n.length)&&this.updateDisplayList(r),n},t.prototype.updateDisplayList=function(e){this._displayListLen=0;for(var r=this._roots,n=this._displayList,a=0,i=r.length;a<i;a++)this._updateAndAddDisplayable(r[a],null,e);n.length=this._displayListLen,Sc(n,F0)},t.prototype._updateAndAddDisplayable=function(e,r,n){if(!(e.ignore&&!n)){e.beforeUpdate(),e.update(),e.afterUpdate();var a=e.getClipPath();if(e.ignoreClip)r=null;else if(a){r?r=r.slice():r=[];for(var i=a,o=e;i;)i.parent=o,i.updateTransform(),r.push(i),o=i,i=i.getClipPath()}if(e.childrenRef){for(var s=e.childrenRef(),l=0;l<s.length;l++){var c=s[l];e.__dirty&&(c.__dirty|=ir),this._updateAndAddDisplayable(c,r,n)}e.__dirty=0}else{var u=e;r&&r.length?u.__clipPaths=r:u.__clipPaths&&u.__clipPaths.length>0&&(u.__clipPaths=[]),isNaN(u.z)&&(ih(),u.z=0),isNaN(u.z2)&&(ih(),u.z2=0),isNaN(u.zlevel)&&(ih(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var f=e.getDecalElement&&e.getDecalElement();f&&this._updateAndAddDisplayable(f,r,n);var h=e.getTextGuideLine();h&&this._updateAndAddDisplayable(h,r,n);var d=e.getTextContent();d&&this._updateAndAddDisplayable(d,r,n)}},t.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},t.prototype.delRoot=function(e){if(e instanceof Array){for(var r=0,n=e.length;r<n;r++)this.delRoot(e[r]);return}var a=Ue(this._roots,e);a>=0&&this._roots.splice(a,1)},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t})(),kc;kc=_e.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};function Ni(){return new Date().getTime()}var AA=(function(t){K(e,t);function e(r){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,r=r||{},n.stage=r.stage||{},n}return e.prototype.addClip=function(r){r.animation&&this.removeClip(r),this._head?(this._tail.next=r,r.prev=this._tail,r.next=null,this._tail=r):this._head=this._tail=r,r.animation=this},e.prototype.addAnimator=function(r){r.animation=this;var n=r.getClip();n&&this.addClip(n)},e.prototype.removeClip=function(r){if(r.animation){var n=r.prev,a=r.next;n?n.next=a:this._head=a,a?a.prev=n:this._tail=n,r.next=r.prev=r.animation=null}},e.prototype.removeAnimator=function(r){var n=r.getClip();n&&this.removeClip(n),r.animation=null},e.prototype.update=function(r){for(var n=Ni()-this._pausedTime,a=n-this._time,i=this._head;i;){var o=i.next,s=i.step(n,a);s&&(i.ondestroy(),this.removeClip(i)),i=o}this._time=n,r||(this.trigger("frame",a),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var r=this;this._running=!0;function n(){r._running&&(kc(n),!r._paused&&r.update())}kc(n)},e.prototype.start=function(){this._running||(this._time=Ni(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=Ni(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=Ni()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var r=this._head;r;){var n=r.next;r.prev=r.next=r.animation=null,r=n}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(r,n){n=n||{},this.start();var a=new lf(r,n.loop);return this.addAnimator(a),a},e})(Ir),DA=300,oh=_e.domSupported,sh=(function(){var t=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],r={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},n=he(t,function(a){var i=a.replace("mouse","pointer");return r.hasOwnProperty(i)?i:a});return{mouse:t,touch:e,pointer:n}})(),H0={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},V0=!1;function lh(t){var e=t.pointerType;return e==="pen"||e==="touch"}function IA(t){t.touching=!0,t.touchTimer!=null&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function ch(t){t&&(t.zrByTouch=!0)}function LA(t,e){return br(t.dom,new PA(t,e),!0)}function U0(t,e){for(var r=e,n=!1;r&&r.nodeType!==9&&!(n=r.domBelongToZr||r!==e&&r===t.painterRoot);)r=r.parentNode;return n}var PA=(function(){function t(e,r){this.stopPropagation=Et,this.stopImmediatePropagation=Et,this.preventDefault=Et,this.type=r.type,this.target=this.currentTarget=e.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return t})(),Er={mousedown:function(t){t=br(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=br(this.dom,t);var e=this.__mayPointerCapture;e&&(t.zrX!==e[0]||t.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=br(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){t=br(this.dom,t);var e=t.toElement||t.relatedTarget;U0(this,e)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){V0=!0,t=br(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){V0||(t=br(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){t=br(this.dom,t),ch(t),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Er.mousemove.call(this,t),Er.mousedown.call(this,t)},touchmove:function(t){t=br(this.dom,t),ch(t),this.handler.processGesture(t,"change"),Er.mousemove.call(this,t)},touchend:function(t){t=br(this.dom,t),ch(t),this.handler.processGesture(t,"end"),Er.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<DA&&Er.click.call(this,t)},pointerdown:function(t){Er.mousedown.call(this,t)},pointermove:function(t){lh(t)||Er.mousemove.call(this,t)},pointerup:function(t){Er.mouseup.call(this,t)},pointerout:function(t){lh(t)||Er.mouseout.call(this,t)}};I(["click","dblclick","contextmenu"],function(t){Er[t]=function(e){e=br(this.dom,e),this.trigger(t,e)}});var uh={pointermove:function(t){lh(t)||uh.mousemove.call(this,t)},pointerup:function(t){uh.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function RA(t,e){var r=e.domHandlers;_e.pointerEventsSupported?I(sh.pointer,function(n){Tc(e,n,function(a){r[n].call(t,a)})}):(_e.touchEventsSupported&&I(sh.touch,function(n){Tc(e,n,function(a){r[n].call(t,a),IA(e)})}),I(sh.mouse,function(n){Tc(e,n,function(a){a=eh(a),e.touching||r[n].call(t,a)})}))}function EA(t,e){_e.pointerEventsSupported?I(H0.pointer,r):_e.touchEventsSupported||I(H0.mouse,r);function r(n){function a(i){i=eh(i),U0(t,i.target)||(i=LA(t,i),e.domHandlers[n].call(t,i))}Tc(e,n,a,{capture:!0})}}function Tc(t,e,r,n){t.mounted[e]=r,t.listenerOpts[e]=n,vA(t.domTarget,e,r,n)}function fh(t){var e=t.mounted;for(var r in e)e.hasOwnProperty(r)&&gA(t.domTarget,r,e[r],t.listenerOpts[r]);t.mounted={}}var G0=(function(){function t(e,r){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=r}return t})(),OA=(function(t){K(e,t);function e(r,n){var a=t.call(this)||this;return a.__pointerCapturing=!1,a.dom=r,a.painterRoot=n,a._localHandlerScope=new G0(r,Er),oh&&(a._globalHandlerScope=new G0(document,uh)),RA(a,a._localHandlerScope),a}return e.prototype.dispose=function(){fh(this._localHandlerScope),oh&&fh(this._globalHandlerScope)},e.prototype.setCursor=function(r){this.dom.style&&(this.dom.style.cursor=r||"default")},e.prototype.__togglePointerCapture=function(r){if(this.__mayPointerCapture=null,oh&&+this.__pointerCapturing^+r){this.__pointerCapturing=r;var n=this._globalHandlerScope;r?EA(this,n):fh(n)}},e})(Ir);var Cc={},$0={};function NA(t){delete $0[t]}function BA(t){if(!t)return!1;if(typeof t=="string")return cl(t,1)<cf;if(t.colorStops){for(var e=t.colorStops,r=0,n=e.length,a=0;a<n;a++)r+=cl(e[a].color,1);return r/=n,r<cf}return!1}var zA=(function(){function t(e,r,n){var a=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=r,this.id=e;var i=new MA,o=n.renderer||"canvas";Cc[o]||(o=at(Cc)[0]),n.useDirtyRect=n.useDirtyRect==null?!1:n.useDirtyRect;var s=new Cc[o](r,i,n,e),l=n.ssr||s.ssrOnly;this.storage=i,this.painter=s;var c=!_e.node&&!_e.worker&&!l?new OA(s.getViewportRoot(),s.root):null,u=n.useCoarsePointer,f=u==null||u==="auto"?_e.touchEventsSupported:!!u,h=44,d;f&&(d=Pe(n.pointerSize,h)),this.handler=new P0(i,s,c,s.root,d),this.animation=new AA({stage:{update:l?null:function(){return a._flush(!0)}}}),l||this.animation.start()}return t.prototype.add=function(e){this._disposed||!e||(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},t.prototype.remove=function(e){this._disposed||!e||(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},t.prototype.configLayer=function(e,r){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,r),this.refresh())},t.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=BA(e))},t.prototype.getBackgroundColor=function(){return this._backgroundColor},t.prototype.setDarkMode=function(e){this._darkMode=e},t.prototype.isDarkMode=function(){return this._darkMode},t.prototype.refreshImmediately=function(e){this._disposed||(e||this.animation.update(!0),this._needsRefresh=!1,this.painter.refresh(),this._needsRefresh=!1)},t.prototype.refresh=function(){this._disposed||(this._needsRefresh=!0,this.animation.start())},t.prototype.flush=function(){this._disposed||this._flush(!1)},t.prototype._flush=function(e){var r,n=Ni();this._needsRefresh&&(r=!0,this.refreshImmediately(e)),this._needsRefreshHover&&(r=!0,this.refreshHoverImmediately());var a=Ni();r?(this._stillFrameAccum=0,this.trigger("rendered",{elapsedTime:a-n})):this._sleepAfterStill>0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&this.painter.getType()==="canvas"&&this.painter.refreshHover())},t.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},t.prototype.findHover=function(e,r){if(!this._disposed)return this.handler.findHover(e,r)},t.prototype.on=function(e,r,n){return this._disposed||this.handler.on(e,r,n),this},t.prototype.off=function(e,r){this._disposed||this.handler.off(e,r)},t.prototype.trigger=function(e,r){this._disposed||this.handler.trigger(e,r)},t.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),r=0;r<e.length;r++)e[r]instanceof St&&e[r].removeSelfFromZr(this);this.storage.delAllRoots(),this.painter.clear()}},t.prototype.dispose=function(){this._disposed||(this.animation.stop(),this.clear(),this.storage.dispose(),this.painter.dispose(),this.handler.dispose(),this.animation=this.storage=this.painter=this.handler=null,this._disposed=!0,NA(this.id))},t})();function W0(t,e){var r=new zA(mv(),t,e);return $0[r.id]=r,r}function FA(t,e){Cc[t]=e}var q0="";typeof navigator<"u"&&(q0=navigator.platform||"");var Bi="rgba(0, 0, 0, 0.2)";const HA={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Bi,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Bi,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Bi,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Bi,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Bi,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Bi,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:q0.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var VA=me();function UA(t,e,r){var n=VA.get(e);if(!n)return r;var a=n(t);return a?r.concat(a):r}var Mc,qo,Y0,X0="\0_ec_inner",GA=1,dh=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(r,n,a,i,o,s){i=i||{},this.option=null,this._theme=new lt(i),this._locale=new lt(o),this._optionManager=s},e.prototype.setOption=function(r,n,a){var i=j0(n);this._optionManager.setOption(r,a,i),this._resetOption(null,i)},e.prototype.resetOption=function(r,n){return this._resetOption(r,j0(n))},e.prototype._resetOption=function(r,n){var a=!1,i=this._optionManager;if(!r||r==="recreate"){var o=i.mountOption(r==="recreate");!this.option||r==="recreate"?Y0(this,o):(this.restoreData(),this._mergeOption(o,n)),a=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=i.getTimelineOption(this);s&&(a=!0,this._mergeOption(s,n))}if(!r||r==="recreate"||r==="media"){var l=i.getMediaOption(this);l.length&&I(l,function(c){a=!0,this._mergeOption(c,n)},this)}return a},e.prototype.mergeOption=function(r){this._mergeOption(r,null)},e.prototype._mergeOption=function(r,n){var a=this.option,i=this._componentsMap,o=this._componentsCount,s=[],l=me(),c=n&&n.replaceMergeMainTypeMap;hT(this),I(r,function(f,h){f!=null&&(Ye.hasClass(h)?h&&(s.push(h),l.set(h,!0)):a[h]=a[h]==null?Ie(f):Oe(a[h],f,!0))}),c&&c.each(function(f,h){Ye.hasClass(h)&&!l.get(h)&&(s.push(h),l.set(h,!0))}),Ye.topologicalTravel(s,Ye.getAllClassMainTypes(),u,this);function u(f){var h=UA(this,f,Mt(r[f])),d=i.get(f),p=d?c&&c.get(f)?"replaceMerge":"normalMerge":"replaceAll",m=Dk(d,h,p);Nk(m,f,Ye),a[f]=null,i.set(f,null),o.set(f,0);var g=[],v=[],y=0,b;I(m,function(x,w){var S=x.existing,k=x.newOption;if(!k)S&&(S.mergeOption({},this),S.optionUpdated({},!1));else{var C=f==="series",A=Ye.getClass(f,x.keyInfo.subType,!C);if(!A)return;if(f==="tooltip"){if(b)return;b=!0}if(S&&S.constructor===A)S.name=x.keyInfo.name,S.mergeOption(k,this),S.optionUpdated(k,!1);else{var M=q({componentIndex:w},x.keyInfo);S=new A(k,this,this,M),q(S,M),x.brandNew&&(S.__requireNewView=!0),S.init(k,this,this),S.optionUpdated(null,!0)}}S?(g.push(S.option),v.push(S),y++):(g.push(void 0),v.push(void 0))},this),a[f]=g,i.set(f,v),o.set(f,y),f==="series"&&Mc(this)}this._seriesIndices||Mc(this)},e.prototype.getOption=function(){var r=Ie(this.option);return I(r,function(n,a){if(Ye.hasClass(a)){for(var i=Mt(n),o=i.length,s=!1,l=o-1;l>=0;l--)i[l]&&!So(i[l])?s=!0:(i[l]=null,!s&&o--);i.length=o,r[a]=i}}),delete r[X0],r},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(r){this._payload=r},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(r,n){var a=this._componentsMap.get(r);if(a){var i=a[n||0];if(i)return i;if(n==null){for(var o=0;o<a.length;o++)if(a[o])return a[o]}}},e.prototype.queryComponents=function(r){var n=r.mainType;if(!n)return[];var a=r.index,i=r.id,o=r.name,s=this._componentsMap.get(n);if(!s||!s.length)return[];var l;return a!=null?(l=[],I(Mt(a),function(c){s[c]&&l.push(s[c])})):i!=null?l=Z0("id",i,s):o!=null?l=Z0("name",o,s):l=bt(s,function(c){return!!c}),K0(l,r)},e.prototype.findComponents=function(r){var n=r.query,a=r.mainType,i=s(n),o=i?this.queryComponents(i):bt(this._componentsMap.get(a),function(c){return!!c});return l(K0(o,r));function s(c){var u=a+"Index",f=a+"Id",h=a+"Name";return c&&(c[u]!=null||c[f]!=null||c[h]!=null)?{mainType:a,index:c[u],id:c[f],name:c[h]}:null}function l(c){return r.filter?bt(c,r.filter):c}},e.prototype.eachComponent=function(r,n,a){var i=this._componentsMap;if(ke(r)){var o=n,s=r;i.each(function(f,h){for(var d=0;f&&d<f.length;d++){var p=f[d];p&&s.call(o,h,p,p.componentIndex)}})}else for(var l=ae(r)?i.get(r):de(r)?this.findComponents(r):null,c=0;l&&c<l.length;c++){var u=l[c];u&&n.call(a,u,u.componentIndex)}},e.prototype.getSeriesByName=function(r){var n=Zr(r,null);return bt(this._componentsMap.get("series"),function(a){return!!a&&n!=null&&a.name===n})},e.prototype.getSeriesByIndex=function(r){return this._componentsMap.get("series")[r]},e.prototype.getSeriesByType=function(r){return bt(this._componentsMap.get("series"),function(n){return!!n&&n.subType===r})},e.prototype.getSeries=function(){return bt(this._componentsMap.get("series"),function(r){return!!r})},e.prototype.getSeriesCount=function(){return this._componentsCount.get("series")},e.prototype.eachSeries=function(r,n){qo(this),I(this._seriesIndices,function(a){var i=this._componentsMap.get("series")[a];r.call(n,i,a)},this)},e.prototype.eachRawSeries=function(r,n){I(this._componentsMap.get("series"),function(a){a&&r.call(n,a,a.componentIndex)})},e.prototype.eachSeriesByType=function(r,n,a){qo(this),I(this._seriesIndices,function(i){var o=this._componentsMap.get("series")[i];o.subType===r&&n.call(a,o,i)},this)},e.prototype.eachRawSeriesByType=function(r,n,a){return I(this.getSeriesByType(r),n,a)},e.prototype.isSeriesFiltered=function(r){return qo(this),this._seriesIndicesMap.get(r.componentIndex)==null},e.prototype.getCurrentSeriesIndices=function(){return(this._seriesIndices||[]).slice()},e.prototype.filterSeries=function(r,n){qo(this);var a=[];I(this._seriesIndices,function(i){var o=this._componentsMap.get("series")[i];r.call(n,o,i)&&a.push(i)},this),this._seriesIndices=a,this._seriesIndicesMap=me(a)},e.prototype.restoreData=function(r){Mc(this);var n=this._componentsMap,a=[];n.each(function(i,o){Ye.hasClass(o)&&a.push(o)}),Ye.topologicalTravel(a,Ye.getAllClassMainTypes(),function(i){I(n.get(i),function(o){o&&(i!=="series"||!$A(o,r))&&o.restoreData()})})},e.internalField=(function(){Mc=function(r){var n=r._seriesIndices=[];I(r._componentsMap.get("series"),function(a){a&&n.push(a.componentIndex)}),r._seriesIndicesMap=me(n)},qo=function(r){},Y0=function(r,n){r.option={},r.option[X0]=GA,r._componentsMap=me({series:[]}),r._componentsCount=me();var a=n.aria;de(a)&&a.enabled==null&&(a.enabled=!0),WA(n,r._theme.option),Oe(n,HA,!1),r._mergeOption(n,null)}})(),e})(lt);function $A(t,e){if(e){var r=e.seriesIndex,n=e.seriesId,a=e.seriesName;return r!=null&&t.componentIndex!==r||n!=null&&t.id!==n||a!=null&&t.name!==a}}function WA(t,e){var r=t.color&&!t.colorLayer;I(e,function(n,a){a==="colorLayer"&&r||Ye.hasClass(a)||(typeof n=="object"?t[a]=t[a]?Oe(t[a],n,!1):Ie(n):t[a]==null&&(t[a]=n))})}function Z0(t,e,r){if(ee(e)){var n=me();return I(e,function(i){if(i!=null){var o=Zr(i,null);o!=null&&n.set(i,!0)}}),bt(r,function(i){return i&&n.get(i[t])})}else{var a=Zr(e,null);return bt(r,function(i){return i&&a!=null&&i[t]===a})}}function K0(t,e){return e.hasOwnProperty("subType")?bt(t,function(r){return r&&r.subType===e.subType}):t}function j0(t){var e=me();return t&&I(Mt(t.replaceMerge),function(r){e.set(r,!0)}),{replaceMergeMainTypeMap:e}}Ur(dh,Ld);var qA=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isSSR","isDisposed","on","off","getDataURL","getConnectedDataURL","getOption","getId","updateLabelLayout"],J0=(function(){function t(e){I(qA,function(r){this[r]=Ne(e[r],e)},this)}return t})(),YA=/^(min|max)?(.+)$/,XA=(function(){function t(e){this._timelineOptions=[],this._mediaList=[],this._currentMediaIndices=[],this._api=e}return t.prototype.setOption=function(e,r,n){e&&(I(Mt(e.series),function(o){o&&o.data&&Ut(o.data)&&Bu(o.data)}),I(Mt(e.dataset),function(o){o&&o.source&&Ut(o.source)&&Bu(o.source)})),e=Ie(e);var a=this._optionBackup,i=ZA(e,r,!a);this._newBaseOption=i.baseOption,a?(i.timelineOptions.length&&(a.timelineOptions=i.timelineOptions),i.mediaList.length&&(a.mediaList=i.mediaList),i.mediaDefault&&(a.mediaDefault=i.mediaDefault)):this._optionBackup=i},t.prototype.mountOption=function(e){var r=this._optionBackup;return this._timelineOptions=r.timelineOptions,this._mediaList=r.mediaList,this._mediaDefault=r.mediaDefault,this._currentMediaIndices=[],Ie(e?r.baseOption:this._newBaseOption)},t.prototype.getTimelineOption=function(e){var r,n=this._timelineOptions;if(n.length){var a=e.getComponent("timeline");a&&(r=Ie(n[a.getCurrentIndex()]))}return r},t.prototype.getMediaOption=function(e){var r=this._api.getWidth(),n=this._api.getHeight(),a=this._mediaList,i=this._mediaDefault,o=[],s=[];if(!a.length&&!i)return s;for(var l=0,c=a.length;l<c;l++)KA(a[l].query,r,n)&&o.push(l);return!o.length&&i&&(o=[-1]),o.length&&!JA(o,this._currentMediaIndices)&&(s=he(o,function(u){return Ie(u===-1?i.option:a[u].option)})),this._currentMediaIndices=o,s},t})();function ZA(t,e,r){var n=[],a,i,o=t.baseOption,s=t.timeline,l=t.options,c=t.media,u=!!t.media,f=!!(l||s||o&&o.timeline);o?(i=o,i.timeline||(i.timeline=s)):((f||u)&&(t.options=t.media=null),i=t),u&&ee(c)&&I(c,function(d){d&&d.option&&(d.query?n.push(d):a||(a=d))}),h(i),I(l,function(d){return h(d)}),I(n,function(d){return h(d.option)});function h(d){I(e,function(p){p(d,r)})}return{baseOption:i,timelineOptions:l||[],mediaDefault:a,mediaList:n}}function KA(t,e,r){var n={width:e,height:r,aspectratio:e/r},a=!0;return I(t,function(i,o){var s=o.match(YA);if(!(!s||!s[1]||!s[2])){var l=s[1],c=s[2].toLowerCase();jA(n[c],i,l)||(a=!1)}}),a}function jA(t,e,r){return r==="min"?t>=e:r==="max"?t<=e:t===e}function JA(t,e){return t.join(",")===e.join(",")}var Or=I,Yo=de,Q0=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function hh(t){var e=t&&t.itemStyle;if(e)for(var r=0,n=Q0.length;r<n;r++){var a=Q0[r],i=e.normal,o=e.emphasis;i&&i[a]&&(t[a]=t[a]||{},t[a].normal?Oe(t[a].normal,i[a]):t[a].normal=i[a],i[a]=null),o&&o[a]&&(t[a]=t[a]||{},t[a].emphasis?Oe(t[a].emphasis,o[a]):t[a].emphasis=o[a],o[a]=null)}}function Dt(t,e,r){if(t&&t[e]&&(t[e].normal||t[e].emphasis)){var n=t[e].normal,a=t[e].emphasis;n&&(r?(t[e].normal=t[e].emphasis=null,He(t[e],n)):t[e]=n),a&&(t.emphasis=t.emphasis||{},t.emphasis[e]=a,a.focus&&(t.emphasis.focus=a.focus),a.blurScope&&(t.emphasis.blurScope=a.blurScope))}}function Xo(t){Dt(t,"itemStyle"),Dt(t,"lineStyle"),Dt(t,"areaStyle"),Dt(t,"label"),Dt(t,"labelLine"),Dt(t,"upperLabel"),Dt(t,"edgeLabel")}function pt(t,e){var r=Yo(t)&&t[e],n=Yo(r)&&r.textStyle;if(n)for(var a=0,i=Pg.length;a<i;a++){var o=Pg[a];n.hasOwnProperty(o)&&(r[o]=n[o])}}function xr(t){t&&(Xo(t),pt(t,"label"),t.emphasis&&pt(t.emphasis,"label"))}function QA(t){if(Yo(t)){hh(t),Xo(t),pt(t,"label"),pt(t,"upperLabel"),pt(t,"edgeLabel"),t.emphasis&&(pt(t.emphasis,"label"),pt(t.emphasis,"upperLabel"),pt(t.emphasis,"edgeLabel"));var e=t.markPoint;e&&(hh(e),xr(e));var r=t.markLine;r&&(hh(r),xr(r));var n=t.markArea;n&&xr(n);var a=t.data;if(t.type==="graph"){a=a||t.nodes;var i=t.links||t.edges;if(i&&!Ut(i))for(var o=0;o<i.length;o++)xr(i[o]);I(t.categories,function(c){Xo(c)})}if(a&&!Ut(a))for(var o=0;o<a.length;o++)xr(a[o]);if(e=t.markPoint,e&&e.data)for(var s=e.data,o=0;o<s.length;o++)xr(s[o]);if(r=t.markLine,r&&r.data)for(var l=r.data,o=0;o<l.length;o++)ee(l[o])?(xr(l[o][0]),xr(l[o][1])):xr(l[o]);t.type==="gauge"?(pt(t,"axisLabel"),pt(t,"title"),pt(t,"detail")):t.type==="treemap"?(Dt(t.breadcrumb,"itemStyle"),I(t.levels,function(c){Xo(c)})):t.type==="tree"&&Xo(t.leaves)}}function Sn(t){return ee(t)?t:t?[t]:[]}function e_(t){return(ee(t)?t[0]:t)||{}}function eD(t,e){Or(Sn(t.series),function(n){Yo(n)&&QA(n)});var r=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","parallelAxis","radar"];e&&r.push("valueAxis","categoryAxis","logAxis","timeAxis"),Or(r,function(n){Or(Sn(t[n]),function(a){a&&(pt(a,"axisLabel"),pt(a.axisPointer,"label"))})}),Or(Sn(t.parallel),function(n){var a=n&&n.parallelAxisDefault;pt(a,"axisLabel"),pt(a&&a.axisPointer,"label")}),Or(Sn(t.calendar),function(n){Dt(n,"itemStyle"),pt(n,"dayLabel"),pt(n,"monthLabel"),pt(n,"yearLabel")}),Or(Sn(t.radar),function(n){pt(n,"name"),n.name&&n.axisName==null&&(n.axisName=n.name,delete n.name),n.nameGap!=null&&n.axisNameGap==null&&(n.axisNameGap=n.nameGap,delete n.nameGap)}),Or(Sn(t.geo),function(n){Yo(n)&&(xr(n),Or(Sn(n.regions),function(a){xr(a)}))}),Or(Sn(t.timeline),function(n){xr(n),Dt(n,"label"),Dt(n,"itemStyle"),Dt(n,"controlStyle",!0);var a=n.data;ee(a)&&I(a,function(i){de(i)&&(Dt(i,"label"),Dt(i,"itemStyle"))})}),Or(Sn(t.toolbox),function(n){Dt(n,"iconStyle"),Or(n.feature,function(a){Dt(a,"iconStyle")})}),pt(e_(t.axisPointer),"label"),pt(e_(t.tooltip).axisPointer,"label")}function tD(t,e){for(var r=e.split(","),n=t,a=0;a<r.length&&(n=n&&n[r[a]],n!=null);a++);return n}function rD(t,e,r,n){for(var a=e.split(","),i=t,o,s=0;s<a.length-1;s++)o=a[s],i[o]==null&&(i[o]={}),i=i[o];i[a[s]]==null&&(i[a[s]]=r)}function t_(t){t&&I(nD,function(e){e[0]in t&&!(e[1]in t)&&(t[e[1]]=t[e[0]])})}var nD=[["x","left"],["y","top"],["x2","right"],["y2","bottom"]],aD=["grid","geo","parallel","legend","toolbox","title","visualMap","dataZoom","timeline"],ph=[["borderRadius","barBorderRadius"],["borderColor","barBorderColor"],["borderWidth","barBorderWidth"]];function Zo(t){var e=t&&t.itemStyle;if(e)for(var r=0;r<ph.length;r++){var n=ph[r][1],a=ph[r][0];e[n]!=null&&(e[a]=e[n])}}function r_(t){t&&t.alignTo==="edge"&&t.margin!=null&&t.edgeDistance==null&&(t.edgeDistance=t.margin)}function n_(t){t&&t.downplay&&!t.blur&&(t.blur=t.downplay)}function iD(t){t&&t.focusNodeAdjacency!=null&&(t.emphasis=t.emphasis||{},t.emphasis.focus==null&&(t.emphasis.focus="adjacency"))}function a_(t,e){if(t)for(var r=0;r<t.length;r++)e(t[r]),t[r]&&a_(t[r].children,e)}function i_(t,e){eD(t,e),t.series=Mt(t.series),I(t.series,function(r){if(de(r)){var n=r.type;if(n==="line")r.clipOverflow!=null&&(r.clip=r.clipOverflow);else if(n==="pie"||n==="gauge"){r.clockWise!=null&&(r.clockwise=r.clockWise),r_(r.label);var a=r.data;if(a&&!Ut(a))for(var i=0;i<a.length;i++)r_(a[i]);r.hoverOffset!=null&&(r.emphasis=r.emphasis||{},(r.emphasis.scaleSize=null)&&(r.emphasis.scaleSize=r.hoverOffset))}else if(n==="gauge"){var o=tD(r,"pointer.color");o!=null&&rD(r,"itemStyle.color",o)}else if(n==="bar"){Zo(r),Zo(r.backgroundStyle),Zo(r.emphasis);var a=r.data;if(a&&!Ut(a))for(var i=0;i<a.length;i++)typeof a[i]=="object"&&(Zo(a[i]),Zo(a[i]&&a[i].emphasis))}else if(n==="sunburst"){var s=r.highlightPolicy;s&&(r.emphasis=r.emphasis||{},r.emphasis.focus||(r.emphasis.focus=s)),n_(r),a_(r.data,n_)}else n==="graph"||n==="sankey"?iD(r):n==="map"&&(r.mapType&&!r.map&&(r.map=r.mapType),r.mapLocation&&He(r,r.mapLocation));r.hoverAnimation!=null&&(r.emphasis=r.emphasis||{},r.emphasis&&r.emphasis.scale==null&&(r.emphasis.scale=r.hoverAnimation)),t_(r)}}),t.dataRange&&(t.visualMap=t.dataRange),I(aD,function(r){var n=t[r];n&&(ee(n)||(n=[n]),I(n,function(a){t_(a)}))})}function oD(t){var e=me();t.eachSeries(function(r){var n=r.get("stack");if(n){var a=e.get(n)||e.set(n,[]),i=r.getData(),o={stackResultDimension:i.getCalculationInfo("stackResultDimension"),stackedOverDimension:i.getCalculationInfo("stackedOverDimension"),stackedDimension:i.getCalculationInfo("stackedDimension"),stackedByDimension:i.getCalculationInfo("stackedByDimension"),isStackedByIndex:i.getCalculationInfo("isStackedByIndex"),data:i,seriesModel:r};if(!o.stackedDimension||!(o.isStackedByIndex||o.stackedByDimension))return;a.length&&i.setCalculationInfo("stackedOnSeries",a[a.length-1].seriesModel),a.push(o)}}),e.each(sD)}function sD(t){I(t,function(e,r){var n=[],a=[NaN,NaN],i=[e.stackResultDimension,e.stackedOverDimension],o=e.data,s=e.isStackedByIndex,l=e.seriesModel.get("stackStrategy")||"samesign";o.modify(i,function(c,u,f){var h=o.get(e.stackedDimension,f);if(isNaN(h))return a;var d,p;s?p=o.getRawIndex(f):d=o.get(e.stackedByDimension,f);for(var m=NaN,g=r-1;g>=0;g--){var v=t[g];if(s||(p=v.data.rawIndexOf(v.stackedByDimension,d)),p>=0){var y=v.data.getByRawIndex(v.stackResultDimension,p);if(l==="all"||l==="positive"&&y>0||l==="negative"&&y<0||l==="samesign"&&h>=0&&y>0||l==="samesign"&&h<=0&&y<0){h=Sk(h,y),m=y;break}}}return n[0]=h,n[1]=m,n})})}var Nr=(function(){function t(){this.group=new St,this.uid=rc("viewComponent")}return t.prototype.init=function(e,r){},t.prototype.render=function(e,r,n,a){},t.prototype.dispose=function(e,r){},t.prototype.updateView=function(e,r,n,a){},t.prototype.updateLayout=function(e,r,n,a){},t.prototype.updateVisual=function(e,r,n,a){},t.prototype.toggleBlurSeries=function(e,r,n){},t.prototype.eachRendered=function(e){var r=this.group;r&&r.traverse(e)},t})();zu(Nr),Zs(Nr);var o_=ht(),s_={itemStyle:oo(Im,!0),lineStyle:oo(Dm,!0)},lD={lineStyle:"stroke",itemStyle:"fill"};function l_(t,e){var r=t.visualStyleMapper||s_[e];return r||(console.warn("Unknown style type '"+e+"'."),s_.itemStyle)}function c_(t,e){var r=t.visualDrawType||lD[e];return r||(console.warn("Unknown style type '"+e+"'."),"fill")}var cD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var r=t.getData(),n=t.visualStyleAccessPath||"itemStyle",a=t.getModel(n),i=l_(t,n),o=i(a),s=a.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=c_(t,n),c=o[l],u=ke(c)?c:null,f=o.fill==="auto"||o.stroke==="auto";if(!o[l]||u||f){var h=t.getColorFromPalette(t.name,null,e.getSeriesCount());o[l]||(o[l]=h,r.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||ke(o.fill)?h:o.fill,o.stroke=o.stroke==="auto"||ke(o.stroke)?h:o.stroke}if(r.setVisual("style",o),r.setVisual("drawType",l),!e.isSeriesFiltered(t)&&u)return r.setVisual("colorFromPalette",!1),{dataEach:function(d,p){var m=t.getDataParams(p),g=q({},o);g[l]=u(m),d.setItemVisual(p,"style",g)}}}},Ko=new lt,uD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!(t.ignoreStyleOnData||e.isSeriesFiltered(t))){var r=t.getData(),n=t.visualStyleAccessPath||"itemStyle",a=l_(t,n),i=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[n]){Ko.option=l[n];var c=a(Ko),u=o.ensureUniqueItemVisual(s,"style");q(u,c),Ko.option.decal&&(o.setItemVisual(s,"decal",Ko.option.decal),Ko.option.decal.dirty=!0),i in c&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},fD={performRawSeries:!0,overallReset:function(t){var e=me();t.eachSeries(function(r){var n=r.getColorBy();if(!r.isColorBySeries()){var a=r.type+"-"+n,i=e.get(a);i||(i={},e.set(a,i)),o_(r).scope=i}}),t.eachSeries(function(r){if(!(r.isColorBySeries()||t.isSeriesFiltered(r))){var n=r.getRawData(),a={},i=r.getData(),o=o_(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=c_(r,s);i.each(function(c){var u=i.getRawIndex(c);a[u]=c}),n.each(function(c){var u=a[c],f=i.getItemVisual(u,"colorFromPalette");if(f){var h=i.ensureUniqueItemVisual(u,"style"),d=n.getName(c)||c+"",p=n.count();h[l]=r.getColorFromPalette(d,o,p)}})}})}},Ac=Math.PI;function dD(t,e){e=e||{},He(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var r=new St,n=new _t({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});r.add(n);var a=new $t({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),i=new _t({style:{fill:"none"},textContent:a,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});r.add(i);var o;return e.showSpinner&&(o=new zl({shape:{startAngle:-Ac/2,endAngle:-Ac/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:Ac*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:Ac*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=a.getBoundingRect().width,l=e.showSpinner?e.spinnerRadius:0,c=(t.getWidth()-l*2-(e.showSpinner&&s?10:0)-s)/2-(e.showSpinner&&s?0:5+s/2)+(e.showSpinner?0:s/2)+(s?0:l),u=t.getHeight()/2;e.showSpinner&&o.setShape({cx:c,cy:u}),i.setShape({x:c-l,y:u-l,width:l*2,height:l*2}),n.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},r.resize(),r}var u_=(function(){function t(e,r,n,a){this._stageTaskMap=me(),this.ecInstance=e,this.api=r,n=this._dataProcessorHandlers=n.slice(),a=this._visualHandlers=a.slice(),this._allHandlers=n.concat(a)}return t.prototype.restoreData=function(e,r){e.restoreData(r),this._stageTaskMap.each(function(n){var a=n.overallTask;a&&a.dirty()})},t.prototype.getPerformArgs=function(e,r){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),a=n.context,i=!r&&n.progressiveEnabled&&(!a||a.progressiveRender)&&e.__idxInPipeline>n.blockIndex,o=i?n.step:null,s=a&&a.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},t.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},t.prototype.updateStreamModes=function(e,r){var n=this._pipelineMap.get(e.uid),a=e.getData(),i=a.count(),o=n.progressiveEnabled&&r.incrementalPrepareRender&&i>=n.threshold,s=e.get("large")&&i>=e.get("largeThreshold"),l=e.get("progressiveChunkMode")==="mod"?i:null;e.pipelineContext=n.context={progressiveRender:o,modDataCount:l,large:s}},t.prototype.restorePipelines=function(e){var r=this,n=r._pipelineMap=me();e.eachSeries(function(a){var i=a.getProgressive(),o=a.uid;n.set(o,{id:o,head:null,tail:null,threshold:a.getProgressiveThreshold(),progressiveEnabled:i&&!(a.preventIncremental&&a.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),r._pipe(a,a.dataTask)})},t.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,r=this.api.getModel(),n=this.api;I(this._allHandlers,function(a){var i=e.get(a.uid)||e.set(a.uid,{}),o="";dn(!(a.reset&&a.overallReset),o),a.reset&&this._createSeriesStageTask(a,i,r,n),a.overallReset&&this._createOverallStageTask(a,i,r,n)},this)},t.prototype.prepareView=function(e,r,n,a){var i=e.renderTask,o=i.context;o.model=r,o.ecModel=n,o.api=a,i.__block=!e.incrementalPrepareRender,this._pipe(r,i)},t.prototype.performDataProcessorTasks=function(e,r){this._performStageTasks(this._dataProcessorHandlers,e,r,{block:!0})},t.prototype.performVisualTasks=function(e,r,n){this._performStageTasks(this._visualHandlers,e,r,n)},t.prototype._performStageTasks=function(e,r,n,a){a=a||{};var i=!1,o=this;I(e,function(l,c){if(!(a.visualType&&a.visualType!==l.visualType)){var u=o._stageTaskMap.get(l.uid),f=u.seriesTaskMap,h=u.overallTask;if(h){var d,p=h.agentStubMap;p.each(function(g){s(a,g)&&(g.dirty(),d=!0)}),d&&h.dirty(),o.updatePayload(h,n);var m=o.getPerformArgs(h,a.block);p.each(function(g){g.perform(m)}),h.perform(m)&&(i=!0)}else f&&f.each(function(g,v){s(a,g)&&g.dirty();var y=o.getPerformArgs(g,a.block);y.skip=!l.performRawSeries&&r.isSeriesFiltered(g.context.model),o.updatePayload(g,n),g.perform(y)&&(i=!0)})}});function s(l,c){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(c.__pipeline.id))}this.unfinished=i||this.unfinished},t.prototype.performSeriesTasks=function(e){var r;e.eachSeries(function(n){r=n.dataTask.perform()||r}),this.unfinished=r||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each(function(e){var r=e.tail;do{if(r.__block){e.blockIndex=r.__idxInPipeline;break}r=r.getUpstream()}while(r)})},t.prototype.updatePayload=function(e,r){r!=="remain"&&(e.context.payload=r)},t.prototype._createSeriesStageTask=function(e,r,n,a){var i=this,o=r.seriesTaskMap,s=r.seriesTaskMap=me(),l=e.seriesType,c=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(u):l?n.eachRawSeriesByType(l,u):c&&c(n,a).each(u);function u(f){var h=f.uid,d=s.set(h,o&&o.get(h)||Uo({plan:mD,reset:yD,count:bD}));d.context={model:f,ecModel:n,api:a,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:i},i._pipe(f,d)}},t.prototype._createOverallStageTask=function(e,r,n,a){var i=this,o=r.overallTask=r.overallTask||Uo({reset:hD});o.context={ecModel:n,api:a,overallReset:e.overallReset,scheduler:i};var s=o.agentStubMap,l=o.agentStubMap=me(),c=e.seriesType,u=e.getTargetSeries,f=!0,h=!1,d="";dn(!e.createOnAllSeries,d),c?n.eachRawSeriesByType(c,p):u?u(n,a).each(p):(f=!1,I(n.getSeries(),p));function p(m){var g=m.uid,v=l.set(g,s&&s.get(g)||(h=!0,Uo({reset:pD,onDirty:gD})));v.context={model:m,overallProgress:f},v.agent=o,v.__block=f,i._pipe(m,v)}h&&o.dirty()},t.prototype._pipe=function(e,r){var n=e.uid,a=this._pipelineMap.get(n);!a.head&&(a.head=r),a.tail&&a.tail.pipe(r),a.tail=r,r.__idxInPipeline=a.count++,r.__pipeline=a},t.wrapStageHandler=function(e,r){return ke(e)&&(e={overallReset:e,seriesType:xD(e)}),e.uid=rc("stageHandler"),r&&(e.visualType=r),e},t})();function hD(t){t.overallReset(t.ecModel,t.api,t.payload)}function pD(t){return t.overallProgress&&vD}function vD(){this.agent.dirty(),this.getDownstream().dirty()}function gD(){this.agent&&this.agent.dirty()}function mD(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function yD(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=Mt(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?he(e,function(r,n){return f_(n)}):_D}var _D=f_(0);function f_(t){return function(e,r){var n=r.data,a=r.resetDefines[t];if(a&&a.dataEach)for(var i=e.start;i<e.end;i++)a.dataEach(n,i);else a&&a.progress&&a.progress(e,n)}}function bD(t){return t.data.count()}function xD(t){Dc=null;try{t(jo,d_)}catch{}return Dc}var jo={},d_={},Dc;h_(jo,dh),h_(d_,J0),jo.eachSeriesByType=jo.eachRawSeriesByType=function(t){Dc=t},jo.eachComponent=function(t){t.mainType==="series"&&t.subType&&(Dc=t.subType)};function h_(t,e){for(var r in e.prototype)t[r]=Et}var p_=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"];const wD={color:p_,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],p_]};var It="#B9B8CE",v_="#100C2A",Ic=function(){return{axisLine:{lineStyle:{color:It}},splitLine:{lineStyle:{color:"#484753"}},splitArea:{areaStyle:{color:["rgba(255,255,255,0.02)","rgba(255,255,255,0.05)"]}},minorSplitLine:{lineStyle:{color:"#20203B"}}}},g_=["#4992ff","#7cffb2","#fddd60","#ff6e76","#58d9f9","#05c091","#ff8a45","#8d48e3","#dd79ff"],m_={darkMode:!0,color:g_,backgroundColor:v_,axisPointer:{lineStyle:{color:"#817f91"},crossStyle:{color:"#817f91"},label:{color:"#fff"}},legend:{textStyle:{color:It},pageTextStyle:{color:It}},textStyle:{color:It},title:{textStyle:{color:"#EEF1FA"},subtextStyle:{color:"#B9B8CE"}},toolbox:{iconStyle:{borderColor:It}},dataZoom:{borderColor:"#71708A",textStyle:{color:It},brushStyle:{color:"rgba(135,163,206,0.3)"},handleStyle:{color:"#353450",borderColor:"#C5CBE3"},moveHandleStyle:{color:"#B0B6C3",opacity:.3},fillerColor:"rgba(135,163,206,0.2)",emphasis:{handleStyle:{borderColor:"#91B7F2",color:"#4D587D"},moveHandleStyle:{color:"#636D9A",opacity:.7}},dataBackground:{lineStyle:{color:"#71708A",width:1},areaStyle:{color:"#71708A"}},selectedDataBackground:{lineStyle:{color:"#87A3CE"},areaStyle:{color:"#87A3CE"}}},visualMap:{textStyle:{color:It}},timeline:{lineStyle:{color:It},label:{color:It},controlStyle:{color:It,borderColor:It}},calendar:{itemStyle:{color:v_},dayLabel:{color:It},monthLabel:{color:It},yearLabel:{color:It}},timeAxis:Ic(),logAxis:Ic(),valueAxis:Ic(),categoryAxis:Ic(),line:{symbol:"circle"},graph:{color:g_},gauge:{title:{color:It},axisLine:{lineStyle:{color:[[1,"rgba(207,212,219,0.2)"]]}},axisLabel:{color:It},detail:{color:"#EEF1FA"}},candlestick:{itemStyle:{color:"#f64e56",color0:"#54ea92",borderColor:"#f64e56",borderColor0:"#54ea92"}}};m_.categoryAxis.splitLine.show=!1;var SD=(function(){function t(){}return t.prototype.normalizeQuery=function(e){var r={},n={},a={};if(ae(e)){var i=$r(e);r.mainType=i.main||null,r.subType=i.sub||null}else{var o=["Index","Name","Id"],s={name:1,dataIndex:1,dataType:1};I(e,function(l,c){for(var u=!1,f=0;f<o.length;f++){var h=o[f],d=c.lastIndexOf(h);if(d>0&&d===c.length-h.length){var p=c.slice(0,d);p!=="data"&&(r.mainType=p,r[h.toLowerCase()]=l,u=!0)}}s.hasOwnProperty(c)&&(n[c]=l,u=!0),u||(a[c]=l)})}return{cptQuery:r,dataQuery:n,otherQuery:a}},t.prototype.filter=function(e,r){var n=this.eventInfo;if(!n)return!0;var a=n.targetEl,i=n.packedEvent,o=n.model,s=n.view;if(!o||!s)return!0;var l=r.cptQuery,c=r.dataQuery;return u(l,o,"mainType")&&u(l,o,"subType")&&u(l,o,"index","componentIndex")&&u(l,o,"name")&&u(l,o,"id")&&u(c,i,"name")&&u(c,i,"dataIndex")&&u(c,i,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(e,r.otherQuery,a,i));function u(f,h,d,p){return f[d]==null||h[p||d]===f[d]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t})(),vh=["symbol","symbolSize","symbolRotate","symbolOffset"],y_=vh.concat(["symbolKeepAspect"]),kD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var r=t.getData();if(t.legendIcon&&r.setVisual("legendIcon",t.legendIcon),!t.hasSymbolVisual)return;for(var n={},a={},i=!1,o=0;o<vh.length;o++){var s=vh[o],l=t.get(s);ke(l)?(i=!0,a[s]=l):n[s]=l}if(n.symbol=n.symbol||t.defaultSymbol,r.setVisual(q({legendIcon:t.legendIcon||n.symbol,symbolKeepAspect:t.get("symbolKeepAspect")},n)),e.isSeriesFiltered(t))return;var c=at(a);function u(f,h){for(var d=t.getRawValue(h),p=t.getDataParams(h),m=0;m<c.length;m++){var g=c[m];f.setItemVisual(h,g,a[g](d,p))}}return{dataEach:i?u:null}}},TD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.hasSymbolVisual||e.isSeriesFiltered(t))return;var r=t.getData();function n(a,i){for(var o=a.getItemModel(i),s=0;s<y_.length;s++){var l=y_[s],c=o.getShallow(l,!0);c!=null&&a.setItemVisual(i,l,c)}}return{dataEach:r.hasItemOption?n:null}}};function CD(t,e,r){switch(r){case"color":var n=t.getItemVisual(e,"style");return n[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,r)}}function MD(t,e){switch(e){case"color":var r=t.getVisual("style");return r[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}function Jo(t,e,r){for(var n;t&&!(e(t)&&(n=t,r));)t=t.__hostTarget||t.parent;return n}var AD=Math.round(Math.random()*9),DD=typeof Object.defineProperty=="function",ID=(function(){function t(){this._id="__ec_inner_"+AD++}return t.prototype.get=function(e){return this._guard(e)[this._id]},t.prototype.set=function(e,r){var n=this._guard(e);return DD?Object.defineProperty(n,this._id,{value:r,enumerable:!1,configurable:!0}):n[this._id]=r,this},t.prototype.delete=function(e){return this.has(e)?(delete this._guard(e)[this._id],!0):!1},t.prototype.has=function(e){return!!this._guard(e)[this._id]},t.prototype._guard=function(e){if(e!==Object(e))throw TypeError("Value of WeakMap is not a non-null object.");return e},t})();function Ba(t){return isFinite(t)}function LD(t,e,r){var n=e.x==null?0:e.x,a=e.x2==null?1:e.x2,i=e.y==null?0:e.y,o=e.y2==null?0:e.y2;e.global||(n=n*r.width+r.x,a=a*r.width+r.x,i=i*r.height+r.y,o=o*r.height+r.y),n=Ba(n)?n:0,a=Ba(a)?a:1,i=Ba(i)?i:0,o=Ba(o)?o:0;var s=t.createLinearGradient(n,i,a,o);return s}function PD(t,e,r){var n=r.width,a=r.height,i=Math.min(n,a),o=e.x==null?.5:e.x,s=e.y==null?.5:e.y,l=e.r==null?.5:e.r;e.global||(o=o*n+r.x,s=s*a+r.y,l=l*i),o=Ba(o)?o:.5,s=Ba(s)?s:.5,l=l>=0&&Ba(l)?l:.5;var c=t.createRadialGradient(o,s,0,o,s,l);return c}function gh(t,e,r){for(var n=e.type==="radial"?PD(t,e,r):LD(t,e,r),a=e.colorStops,i=0;i<a.length;i++)n.addColorStop(a[i].offset,a[i].color);return n}function RD(t,e){if(t===e||!t&&!e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!0;return!1}function Lc(t){return parseInt(t,10)}function Pc(t,e,r){var n=["width","height"][e],a=["clientWidth","clientHeight"][e],i=["paddingLeft","paddingTop"][e],o=["paddingRight","paddingBottom"][e];if(r[n]!=null&&r[n]!=="auto")return parseFloat(r[n]);var s=document.defaultView.getComputedStyle(t);return(t[a]||Lc(s[n])||Lc(t.style[n]))-(Lc(s[i])||0)-(Lc(s[o])||0)|0}function ED(t,e){return!t||t==="solid"||!(e>0)?null:t==="dashed"?[4*e,2*e]:t==="dotted"?[e]:et(t)?[t]:ee(t)?t:null}function __(t){var e=t.style,r=e.lineDash&&e.lineWidth>0&&ED(e.lineDash,e.lineWidth),n=e.lineDashOffset;if(r){var a=e.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&a!==1&&(r=he(r,function(i){return i/a}),n/=a)}return[r,n]}var OD=new wa(!0);function Rc(t){var e=t.stroke;return!(e==null||e==="none"||!(t.lineWidth>0))}function b_(t){return typeof t=="string"&&t!=="none"}function Ec(t){var e=t.fill;return e!=null&&e!=="none"}function x_(t,e){if(e.fillOpacity!=null&&e.fillOpacity!==1){var r=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=r}else t.fill()}function w_(t,e){if(e.strokeOpacity!=null&&e.strokeOpacity!==1){var r=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=r}else t.stroke()}function mh(t,e,r){var n=Cv(e.image,e.__image,r);if(Ks(n)){var a=t.createPattern(n,e.repeat||"repeat");if(typeof DOMMatrix=="function"&&a&&a.setTransform){var i=new DOMMatrix;i.translateSelf(e.x||0,e.y||0),i.rotateSelf(0,0,(e.rotation||0)*Fw),i.scaleSelf(e.scaleX||1,e.scaleY||1),a.setTransform(i)}return a}}function ND(t,e,r,n){var a,i=Rc(r),o=Ec(r),s=r.strokePercent,l=s<1,c=!e.path;(!e.silent||l)&&c&&e.createPathProxy();var u=e.path||OD,f=e.__dirty;if(!n){var h=r.fill,d=r.stroke,p=o&&!!h.colorStops,m=i&&!!d.colorStops,g=o&&!!h.image,v=i&&!!d.image,y=void 0,b=void 0,x=void 0,w=void 0,S=void 0;(p||m)&&(S=e.getBoundingRect()),p&&(y=f?gh(t,h,S):e.__canvasFillGradient,e.__canvasFillGradient=y),m&&(b=f?gh(t,d,S):e.__canvasStrokeGradient,e.__canvasStrokeGradient=b),g&&(x=f||!e.__canvasFillPattern?mh(t,h,e):e.__canvasFillPattern,e.__canvasFillPattern=x),v&&(w=f||!e.__canvasStrokePattern?mh(t,d,e):e.__canvasStrokePattern,e.__canvasStrokePattern=x),p?t.fillStyle=y:g&&(x?t.fillStyle=x:o=!1),m?t.strokeStyle=b:v&&(w?t.strokeStyle=w:i=!1)}var k=e.getGlobalScale();u.setScale(k[0],k[1],e.segmentIgnoreThreshold);var C,A;t.setLineDash&&r.lineDash&&(a=__(e),C=a[0],A=a[1]);var M=!0;(c||f&pi)&&(u.setDPR(t.dpr),l?u.setContext(null):(u.setContext(t),M=!1),u.reset(),e.buildPath(u,e.shape,n),u.toStatic(),e.pathUpdated()),M&&u.rebuildPath(t,l?s:1),C&&(t.setLineDash(C),t.lineDashOffset=A),n||(r.strokeFirst?(i&&w_(t,r),o&&x_(t,r)):(o&&x_(t,r),i&&w_(t,r))),C&&t.setLineDash([])}function BD(t,e,r){var n=e.__image=Cv(r.image,e.__image,e,e.onload);if(!(!n||!Ks(n))){var a=r.x||0,i=r.y||0,o=e.getWidth(),s=e.getHeight(),l=n.width/n.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=n.width,s=n.height),r.sWidth&&r.sHeight){var c=r.sx||0,u=r.sy||0;t.drawImage(n,c,u,r.sWidth,r.sHeight,a,i,o,s)}else if(r.sx&&r.sy){var c=r.sx,u=r.sy,f=o-c,h=s-u;t.drawImage(n,c,u,f,h,a,i,o,s)}else t.drawImage(n,a,i,o,s)}}function zD(t,e,r){var n,a=r.text;if(a!=null&&(a+=""),a){t.font=r.font||sa,t.textAlign=r.textAlign,t.textBaseline=r.textBaseline;var i=void 0,o=void 0;t.setLineDash&&r.lineDash&&(n=__(e),i=n[0],o=n[1]),i&&(t.setLineDash(i),t.lineDashOffset=o),r.strokeFirst?(Rc(r)&&t.strokeText(a,r.x,r.y),Ec(r)&&t.fillText(a,r.x,r.y)):(Ec(r)&&t.fillText(a,r.x,r.y),Rc(r)&&t.strokeText(a,r.x,r.y)),i&&t.setLineDash([])}}var S_=["shadowBlur","shadowOffsetX","shadowOffsetY"],k_=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function T_(t,e,r,n,a){var i=!1;if(!n&&(r=r||{},e===r))return!1;if(n||e.opacity!==r.opacity){Kt(t,a),i=!0;var o=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(o)?ga.opacity:o}(n||e.blend!==r.blend)&&(i||(Kt(t,a),i=!0),t.globalCompositeOperation=e.blend||ga.blend);for(var s=0;s<S_.length;s++){var l=S_[s];(n||e[l]!==r[l])&&(i||(Kt(t,a),i=!0),t[l]=t.dpr*(e[l]||0))}return(n||e.shadowColor!==r.shadowColor)&&(i||(Kt(t,a),i=!0),t.shadowColor=e.shadowColor||ga.shadowColor),i}function C_(t,e,r,n,a){var i=Qo(e,a.inHover),o=n?null:r&&Qo(r,a.inHover)||{};if(i===o)return!1;var s=T_(t,i,o,n,a);if((n||i.fill!==o.fill)&&(s||(Kt(t,a),s=!0),b_(i.fill)&&(t.fillStyle=i.fill)),(n||i.stroke!==o.stroke)&&(s||(Kt(t,a),s=!0),b_(i.stroke)&&(t.strokeStyle=i.stroke)),(n||i.opacity!==o.opacity)&&(s||(Kt(t,a),s=!0),t.globalAlpha=i.opacity==null?1:i.opacity),e.hasStroke()){var l=i.lineWidth,c=l/(i.strokeNoScale&&e.getLineScale?e.getLineScale():1);t.lineWidth!==c&&(s||(Kt(t,a),s=!0),t.lineWidth=c)}for(var u=0;u<k_.length;u++){var f=k_[u],h=f[0];(n||i[h]!==o[h])&&(s||(Kt(t,a),s=!0),t[h]=i[h]||f[1])}return s}function FD(t,e,r,n,a){return T_(t,Qo(e,a.inHover),r&&Qo(r,a.inHover),n,a)}function M_(t,e){var r=e.transform,n=t.dpr||1;r?t.setTransform(n*r[0],n*r[1],n*r[2],n*r[3],n*r[4],n*r[5]):t.setTransform(n,0,0,n,0,0)}function HD(t,e,r){for(var n=!1,a=0;a<t.length;a++){var i=t[a];n=n||i.isZeroArea(),M_(e,i),e.beginPath(),i.buildPath(e,i.shape),e.clip()}r.allClipped=n}function VD(t,e){return t&&e?t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||t[4]!==e[4]||t[5]!==e[5]:!(!t&&!e)}var A_=1,D_=2,I_=3,L_=4;function UD(t){var e=Ec(t),r=Rc(t);return!(t.lineDash||!(+e^+r)||e&&typeof t.fill!="string"||r&&typeof t.stroke!="string"||t.strokePercent<1||t.strokeOpacity<1||t.fillOpacity<1)}function Kt(t,e){e.batchFill&&t.fill(),e.batchStroke&&t.stroke(),e.batchFill="",e.batchStroke=""}function Qo(t,e){return e&&t.__hoverStyle||t.style}function P_(t,e){za(t,e,{inHover:!1,viewWidth:0,viewHeight:0},!0)}function za(t,e,r,n){var a=e.transform;if(!e.shouldBePainted(r.viewWidth,r.viewHeight,!1,!1)){e.__dirty&=~ir,e.__isRendered=!1;return}var i=e.__clipPaths,o=r.prevElClipPaths,s=!1,l=!1;if((!o||RD(i,o))&&(o&&o.length&&(Kt(t,r),t.restore(),l=s=!0,r.prevElClipPaths=null,r.allClipped=!1,r.prevEl=null),i&&i.length&&(Kt(t,r),t.save(),HD(i,t,r),s=!0),r.prevElClipPaths=i),r.allClipped){e.__isRendered=!1;return}e.beforeBrush&&e.beforeBrush(),e.innerBeforeBrush();var c=r.prevEl;c||(l=s=!0);var u=e instanceof qe&&e.autoBatch&&UD(e.style);s||VD(a,c.transform)?(Kt(t,r),M_(t,e)):u||Kt(t,r);var f=Qo(e,r.inHover);e instanceof qe?(r.lastDrawType!==A_&&(l=!0,r.lastDrawType=A_),C_(t,e,c,l,r),(!u||!r.batchFill&&!r.batchStroke)&&t.beginPath(),ND(t,e,f,u),u&&(r.batchFill=f.fill||"",r.batchStroke=f.stroke||"")):e instanceof Sl?(r.lastDrawType!==I_&&(l=!0,r.lastDrawType=I_),C_(t,e,c,l,r),zD(t,e,f)):e instanceof Fn?(r.lastDrawType!==D_&&(l=!0,r.lastDrawType=D_),FD(t,e,c,l,r),BD(t,e,f)):e.getTemporalDisplayables&&(r.lastDrawType!==L_&&(l=!0,r.lastDrawType=L_),GD(t,e,r)),u&&n&&Kt(t,r),e.innerAfterBrush(),e.afterBrush&&e.afterBrush(),r.prevEl=e,e.__dirty=0,e.__isRendered=!0}function GD(t,e,r){var n=e.getDisplayables(),a=e.getTemporalDisplayables();t.save();var i={prevElClipPaths:null,prevEl:null,allClipped:!1,viewWidth:r.viewWidth,viewHeight:r.viewHeight,inHover:r.inHover},o,s;for(o=e.getCursor(),s=n.length;o<s;o++){var l=n[o];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),za(t,l,i,o===s-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),i.prevEl=l}for(var c=0,u=a.length;c<u;c++){var l=a[c];l.beforeBrush&&l.beforeBrush(),l.innerBeforeBrush(),za(t,l,i,c===u-1),l.innerAfterBrush(),l.afterBrush&&l.afterBrush(),i.prevEl=l}e.clearTemporalDisplayables(),e.notClear=!0,t.restore()}var yh=new ID,R_=new so(100),E_=["symbol","symbolSize","symbolKeepAspect","color","backgroundColor","dashArrayX","dashArrayY","maxTileWidth","maxTileHeight"];function _h(t,e){if(t==="none")return null;var r=e.getDevicePixelRatio(),n=e.getZr(),a=n.painter.type==="svg";t.dirty&&yh.delete(t);var i=yh.get(t);if(i)return i;var o=He(t,{symbol:"rect",symbolSize:1,symbolKeepAspect:!0,color:"rgba(0, 0, 0, 0.2)",backgroundColor:null,dashArrayX:5,dashArrayY:5,rotation:0,maxTileWidth:512,maxTileHeight:512});o.backgroundColor==="none"&&(o.backgroundColor=null);var s={repeat:"repeat"};return l(s),s.rotation=o.rotation,s.scaleX=s.scaleY=a?1:1/r,yh.set(t,s),t.dirty=!1,s;function l(c){for(var u=[r],f=!0,h=0;h<E_.length;++h){var d=o[E_[h]];if(d!=null&&!ee(d)&&!ae(d)&&!et(d)&&typeof d!="boolean"){f=!1;break}u.push(d)}var p;if(f){p=u.join(",")+(a?"-svg":"");var m=R_.get(p);m&&(a?c.svgElement=m:c.image=m)}var g=N_(o.dashArrayX),v=$D(o.dashArrayY),y=O_(o.symbol),b=WD(g),x=B_(v),w=!a&&ri.createCanvas(),S=a&&{tag:"g",attrs:{},key:"dcl",children:[]},k=A(),C;w&&(w.width=k.width*r,w.height=k.height*r,C=w.getContext("2d")),M(),f&&R_.put(p,w||S),c.image=w,c.svgElement=S,c.svgWidth=k.width,c.svgHeight=k.height;function A(){for(var T=1,D=0,L=b.length;D<L;++D)T=Ag(T,b[D]);for(var R=1,D=0,L=y.length;D<L;++D)R=Ag(R,y[D].length);T*=R;var O=x*b.length*y.length;return{width:Math.max(1,Math.min(T,o.maxTileWidth)),height:Math.max(1,Math.min(O,o.maxTileHeight))}}function M(){C&&(C.clearRect(0,0,w.width,w.height),o.backgroundColor&&(C.fillStyle=o.backgroundColor,C.fillRect(0,0,w.width,w.height)));for(var T=0,D=0;D<v.length;++D)T+=v[D];if(T<=0)return;for(var L=-x,R=0,O=0,B=0;L<k.height;){if(R%2===0){for(var j=O/2%y.length,P=0,V=0,H=0;P<k.width*2;){for(var Z=0,D=0;D<g[B].length;++D)Z+=g[B][D];if(Z<=0)break;if(V%2===0){var re=(1-o.symbolSize)*.5,Te=P+g[B][V]*re,ge=L+v[R]*re,xe=g[B][V]*o.symbolSize,Ce=v[R]*o.symbolSize,be=H/2%y[j].length;it(Te,ge,xe,Ce,y[j][be])}P+=g[B][V],++H,++V,V===g[B].length&&(V=0)}++B,B===g.length&&(B=0)}L+=v[R],++O,++R,R===v.length&&(R=0)}function it(Qe,ze,oe,pe,ot){var Xe=a?1:r,kt=Ri(ot,Qe*Xe,ze*Xe,oe*Xe,pe*Xe,o.color,o.symbolKeepAspect);if(a){var tt=n.painter.renderOneToVNode(kt);tt&&S.children.push(tt)}else P_(C,kt)}}}}function O_(t){if(!t||t.length===0)return[["rect"]];if(ae(t))return[[t]];for(var e=!0,r=0;r<t.length;++r)if(!ae(t[r])){e=!1;break}if(e)return O_([t]);for(var n=[],r=0;r<t.length;++r)ae(t[r])?n.push([t[r]]):n.push(t[r]);return n}function N_(t){if(!t||t.length===0)return[[0,0]];if(et(t)){var e=Math.ceil(t);return[[e,e]]}for(var r=!0,n=0;n<t.length;++n)if(!et(t[n])){r=!1;break}if(r)return N_([t]);for(var a=[],n=0;n<t.length;++n)if(et(t[n])){var e=Math.ceil(t[n]);a.push([e,e])}else{var e=he(t[n],function(s){return Math.ceil(s)});e.length%2===1?a.push(e.concat(e)):a.push(e)}return a}function $D(t){if(!t||typeof t=="object"&&t.length===0)return[0,0];if(et(t)){var e=Math.ceil(t);return[e,e]}var r=he(t,function(n){return Math.ceil(n)});return t.length%2?r.concat(r):r}function WD(t){return he(t,function(e){return B_(e)})}function B_(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return t.length%2===1?e*2:e}function qD(t,e){t.eachRawSeries(function(r){if(!t.isSeriesFiltered(r)){var n=r.getData();n.hasItemVisual()&&n.each(function(o){var s=n.getItemVisual(o,"decal");if(s){var l=n.ensureUniqueItemVisual(o,"style");l.decal=_h(s,e)}});var a=n.getVisual("decal");if(a){var i=n.getVisual("style");i.decal=_h(a,e)}}})}var Br=new Ir,z_={};function YD(t,e){z_[t]=e}function XD(t){return z_[t]}var ZD=1,KD=800,jD=900,JD=1e3,QD=2e3,eI=5e3,F_=1e3,tI=1100,bh=2e3,H_=3e3,rI=4e3,Oc=4500,nI=4600,aI=5e3,iI=6e3,V_=7e3,oI={PROCESSOR:{FILTER:JD,SERIES_FILTER:KD,STATISTIC:eI},VISUAL:{LAYOUT:F_,PROGRESSIVE_LAYOUT:tI,GLOBAL:bh,CHART:H_,POST_CHART_LAYOUT:nI,COMPONENT:rI,BRUSH:aI,CHART_ITEM:Oc,ARIA:iI,DECAL:V_}},Lt="__flagInMainProcess",jt="__pendingUpdate",xh="__needsUpdateStatus",U_=/^[a-zA-Z0-9_]+$/,wh="__connectUpdateStatus",G_=0,sI=1,lI=2;function $_(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this.isDisposed()){this.id;return}return q_(this,t,e)}}function W_(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return q_(this,t,e)}}function q_(t,e,r){return r[0]=r[0]&&r[0].toLowerCase(),Ir.prototype[e].apply(t,r)}var Y_=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Ir),X_=Y_.prototype;X_.on=W_("on"),X_.off=W_("off");var zi,Sh,Nc,Xn,kh,Th,Ch,es,ts,Z_,K_,Mh,j_,Bc,J_,Q_,wr,eb,tb=(function(t){K(e,t);function e(r,n,a){var i=t.call(this,new SD)||this;i._chartsViews=[],i._chartsMap={},i._componentsViews=[],i._componentsMap={},i._pendingActions=[],a=a||{},ae(n)&&(n=rb[n]),i._dom=r;var o="canvas",s="auto",l=!1;a.ssr;var c=i._zr=W0(r,{renderer:a.renderer||o,devicePixelRatio:a.devicePixelRatio,width:a.width,height:a.height,ssr:a.ssr,useDirtyRect:Pe(a.useDirtyRect,l),useCoarsePointer:Pe(a.useCoarsePointer,s),pointerSize:a.pointerSize});i._ssr=a.ssr,i._throttledZrFlush=Yd(Ne(c.flush,c),17),n=Ie(n),n&&i_(n,!0),i._theme=n,i._locale=cC(a.locale||uy),i._coordSysMgr=new gd;var u=i._api=J_(i);function f(h,d){return h.__prio-d.__prio}return Sc(Fc,f),Sc(Dh,f),i._scheduler=new u_(i,u,Dh,Fc),i._messageCenter=new Y_,i._initEvents(),i.resize=Ne(i.resize,i),c.animation.on("frame",i._onframe,i),Z_(c,i),K_(c,i),Bu(i),i}return e.prototype._onframe=function(){if(!this._disposed){eb(this);var r=this._scheduler;if(this[jt]){var n=this[jt].silent;this[Lt]=!0;try{zi(this),Xn.update.call(this,null,this[jt].updateParams)}catch(l){throw this[Lt]=!1,this[jt]=null,l}this._zr.flush(),this[Lt]=!1,this[jt]=null,es.call(this,n),ts.call(this,n)}else if(r.unfinished){var a=ZD,i=this._model,o=this._api;r.unfinished=!1;do{var s=+new Date;r.performSeriesTasks(i),r.performDataProcessorTasks(i),Th(this,i),r.performVisualTasks(i),Bc(this,this._model,o,"remain",{}),a-=+new Date-s}while(a>0&&r.unfinished);r.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(r,n,a){if(!this[Lt]){if(this._disposed){this.id;return}var i,o,s;if(de(n)&&(a=n.lazyUpdate,i=n.silent,o=n.replaceMerge,s=n.transition,n=n.notMerge),this[Lt]=!0,!this._model||n){var l=new XA(this._api),c=this._theme,u=this._model=new dh;u.scheduler=this._scheduler,u.ssr=this._ssr,u.init(null,null,null,c,this._locale,l)}this._model.setOption(r,{replaceMerge:o},Ih);var f={seriesTransition:s,optionChanged:!0};if(a)this[jt]={silent:i,updateParams:f},this[Lt]=!1,this.getZr().wakeUp();else{try{zi(this),Xn.update.call(this,null,f)}catch(h){throw this[jt]=null,this[Lt]=!1,h}this._ssr||this._zr.flush(),this[jt]=null,this[Lt]=!1,es.call(this,i),ts.call(this,i)}}},e.prototype.setTheme=function(){},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||_e.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(r){return this.renderToCanvas(r)},e.prototype.renderToCanvas=function(r){r=r||{};var n=this._zr.painter;return n.getRenderedCanvas({backgroundColor:r.backgroundColor||this._model.get("backgroundColor"),pixelRatio:r.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(r){r=r||{};var n=this._zr.painter;return n.renderToString({useViewBox:r.useViewBox})},e.prototype.getSvgDataURL=function(){if(_e.svgSupported){var r=this._zr,n=r.storage.getDisplayList();return I(n,function(a){a.stopAnimation(null,!0)}),r.painter.toDataURL()}},e.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var n=r.excludeComponents,a=this._model,i=[],o=this;I(n,function(l){a.eachComponent({mainType:l},function(c){var u=o._componentsMap[c.__viewId];u.group.ignore||(i.push(u),u.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(r).toDataURL("image/"+(r&&r.type||"png"));return I(i,function(l){l.group.ignore=!1}),s},e.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var n=r.type==="svg",a=this.group,i=Math.min,o=Math.max,s=1/0;if(nb[a]){var l=s,c=s,u=-s,f=-s,h=[],d=r&&r.pixelRatio||this.getDevicePixelRatio();I(ns,function(b,x){if(b.group===a){var w=n?b.getZr().painter.getSvgDom().innerHTML:b.renderToCanvas(Ie(r)),S=b.getDom().getBoundingClientRect();l=i(S.left,l),c=i(S.top,c),u=o(S.right,u),f=o(S.bottom,f),h.push({dom:w,left:S.left,top:S.top})}}),l*=d,c*=d,u*=d,f*=d;var p=u-l,m=f-c,g=ri.createCanvas(),v=W0(g,{renderer:n?"svg":"canvas"});if(v.resize({width:p,height:m}),n){var y="";return I(h,function(b){var x=b.left-l,w=b.top-c;y+='<g transform="translate('+x+","+w+')">'+b.dom+"</g>"}),v.painter.getSvgRoot().innerHTML=y,r.connectedBackgroundColor&&v.painter.setBackgroundColor(r.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}else return r.connectedBackgroundColor&&v.add(new _t({shape:{x:0,y:0,width:p,height:m},style:{fill:r.connectedBackgroundColor}})),I(h,function(b){var x=new Fn({style:{x:b.left*d-l,y:b.top*d-c,image:b.dom}});v.add(x)}),v.refreshImmediately(),g.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},e.prototype.convertToPixel=function(r,n){return kh(this,"convertToPixel",r,n)},e.prototype.convertFromPixel=function(r,n){return kh(this,"convertFromPixel",r,n)},e.prototype.containPixel=function(r,n){if(this._disposed){this.id;return}var a=this._model,i,o=If(a,r);return I(o,function(s,l){l.indexOf("Models")>=0&&I(s,function(c){var u=c.coordinateSystem;if(u&&u.containPoint)i=i||!!u.containPoint(n);else if(l==="seriesModels"){var f=this._chartsMap[c.__viewId];f&&f.containPoint&&(i=i||f.containPoint(n,c))}},this)},this),!!i},e.prototype.getVisual=function(r,n){var a=this._model,i=If(a,r,{defaultMainType:"series"}),o=i.seriesModel,s=o.getData(),l=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?s.indexOfRawIndex(i.dataIndex):null;return l!=null?CD(s,l,n):MD(s,n)},e.prototype.getViewOfComponentModel=function(r){return this._componentsMap[r.__viewId]},e.prototype.getViewOfSeriesModel=function(r){return this._chartsMap[r.__viewId]},e.prototype._initEvents=function(){var r=this;I(cI,function(n){var a=function(i){var o=r.getModel(),s=i.target,l,c=n==="globalout";if(c?l={}:s&&Jo(s,function(p){var m=We(p);if(m&&m.dataIndex!=null){var g=m.dataModel||o.getSeriesByIndex(m.seriesIndex);return l=g&&g.getDataParams(m.dataIndex,m.dataType,s)||{},!0}else if(m.eventData)return l=q({},m.eventData),!0},!0),l){var u=l.componentType,f=l.componentIndex;(u==="markLine"||u==="markPoint"||u==="markArea")&&(u="series",f=l.seriesIndex);var h=u&&f!=null&&o.getComponent(u,f),d=h&&r[h.mainType==="series"?"_chartsMap":"_componentsMap"][h.__viewId];l.event=i,l.type=n,r._$eventProcessor.eventInfo={targetEl:s,packedEvent:l,model:h,view:d},r.trigger(n,l)}};a.zrEventfulCallAtLast=!0,r._zr.on(n,a,r)}),I(rs,function(n,a){r._messageCenter.on(a,function(i){this.trigger(a,i)},r)}),I(["selectchanged"],function(n){r._messageCenter.on(n,function(a){this.trigger(n,a)},r)}),lA(this._messageCenter,this,this._api)},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var r=this.getDom();r&&Eg(this.getDom(),Ph,"");var n=this,a=n._api,i=n._model;I(n._componentsViews,function(o){o.dispose(i,a)}),I(n._chartsViews,function(o){o.dispose(i,a)}),n._zr.dispose(),n._dom=n._model=n._chartsMap=n._componentsMap=n._chartsViews=n._componentsViews=n._scheduler=n._api=n._zr=n._throttledZrFlush=n._theme=n._coordSysMgr=n._messageCenter=null,delete ns[n.id]},e.prototype.resize=function(r){if(!this[Lt]){if(this._disposed){this.id;return}this._zr.resize(r);var n=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!n){var a=n.resetOption("media"),i=r&&r.silent;this[jt]&&(i==null&&(i=this[jt].silent),a=!0,this[jt]=null),this[Lt]=!0;try{a&&zi(this),Xn.update.call(this,{type:"resize",animation:q({duration:0},r&&r.animation)})}catch(o){throw this[Lt]=!1,o}this[Lt]=!1,es.call(this,i),ts.call(this,i)}}},e.prototype.showLoading=function(r,n){if(this._disposed){this.id;return}if(de(r)&&(n=r,r=""),r=r||"default",this.hideLoading(),!!Lh[r]){var a=Lh[r](this._api,n),i=this._zr;this._loadingFX=a,i.add(a)}},e.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},e.prototype.makeActionFromEvent=function(r){var n=q({},r);return n.type=rs[r.type],n},e.prototype.dispatchAction=function(r,n){if(this._disposed){this.id;return}if(de(n)||(n={silent:!!n}),!!zc[r.type]&&this._model){if(this[Lt]){this._pendingActions.push(r);return}var a=n.silent;Ch.call(this,r,a);var i=n.flush;i?this._zr.flush():i!==!1&&_e.browser.weChat&&this._throttledZrFlush(),es.call(this,a),ts.call(this,a)}},e.prototype.updateLabelLayout=function(){Br.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(r){if(this._disposed){this.id;return}var n=r.seriesIndex,a=this.getModel(),i=a.getSeriesByIndex(n);i.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},e.internalField=(function(){zi=function(f){var h=f._scheduler;h.restorePipelines(f._model),h.prepareStageTasks(),Sh(f,!0),Sh(f,!1),h.plan()},Sh=function(f,h){for(var d=f._model,p=f._scheduler,m=h?f._componentsViews:f._chartsViews,g=h?f._componentsMap:f._chartsMap,v=f._zr,y=f._api,b=0;b<m.length;b++)m[b].__alive=!1;h?d.eachComponent(function(S,k){S!=="series"&&x(k)}):d.eachSeries(x);function x(S){var k=S.__requireNewView;S.__requireNewView=!1;var C="_ec_"+S.id+"_"+S.type,A=!k&&g[C];if(!A){var M=$r(S.type),T=h?Nr.getClass(M.main,M.sub):Rr.getClass(M.sub);A=new T,A.init(d,y),g[C]=A,m.push(A),v.add(A.group)}S.__viewId=A.__id=C,A.__alive=!0,A.__model=S,A.group.__ecComponentInfo={mainType:S.mainType,index:S.componentIndex},!h&&p.prepareView(A,S,d,y)}for(var b=0;b<m.length;){var w=m[b];w.__alive?b++:(!h&&w.renderTask.dispose(),v.remove(w.group),w.dispose(d,y),m.splice(b,1),g[w.__id]===w&&delete g[w.__id],w.__id=w.group.__ecComponentInfo=null)}},Nc=function(f,h,d,p,m){var g=f._model;if(g.setUpdatePayload(d),!p){I([].concat(f._componentsViews).concat(f._chartsViews),w);return}var v={};v[p+"Id"]=d[p+"Id"],v[p+"Index"]=d[p+"Index"],v[p+"Name"]=d[p+"Name"];var y={mainType:p,query:v};m&&(y.subType=m);var b=d.excludeSeriesId,x;b!=null&&(x=me(),I(Mt(b),function(S){var k=Zr(S,null);k!=null&&x.set(k,!0)})),g&&g.eachComponent(y,function(S){var k=x&&x.get(S.id)!=null;if(!k)if(em(d))if(S instanceof Qr)d.type===Aa&&!d.notBlur&&!S.get(["emphasis","disabled"])&&e2(S,d,f._api);else{var C=zf(S.mainType,S.componentIndex,d.name,f._api),A=C.focusSelf,M=C.dispatchers;d.type===Aa&&A&&!d.notBlur&&Bf(S.mainType,S.componentIndex,f._api),M&&I(M,function(T){d.type===Aa?Ll(T):Pl(T)})}else Uf(d)&&S instanceof Qr&&(n2(S,d,f._api),jg(S),wr(f))},f),g&&g.eachComponent(y,function(S){var k=x&&x.get(S.id)!=null;k||w(f[p==="series"?"_chartsMap":"_componentsMap"][S.__viewId])},f);function w(S){S&&S.__alive&&S[h]&&S[h](S.__model,g,f._api,d)}},Xn={prepareAndUpdate:function(f){zi(this),Xn.update.call(this,f,{optionChanged:f.newOption!=null})},update:function(f,h){var d=this._model,p=this._api,m=this._zr,g=this._coordSysMgr,v=this._scheduler;if(d){d.setUpdatePayload(f),v.restoreData(d,f),v.performSeriesTasks(d),g.create(d,p),v.performDataProcessorTasks(d,f),Th(this,d),g.update(d,p),r(d),v.performVisualTasks(d,f),Mh(this,d,p,f,h);var y=d.get("backgroundColor")||"transparent",b=d.get("darkMode");m.setBackgroundColor(y),b!=null&&b!=="auto"&&m.setDarkMode(b),Br.trigger("afterupdate",d,p)}},updateTransform:function(f){var h=this,d=this._model,p=this._api;if(d){d.setUpdatePayload(f);var m=[];d.eachComponent(function(v,y){if(v!=="series"){var b=h.getViewOfComponentModel(y);if(b&&b.__alive)if(b.updateTransform){var x=b.updateTransform(y,d,p,f);x&&x.update&&m.push(b)}else m.push(b)}});var g=me();d.eachSeries(function(v){var y=h._chartsMap[v.__viewId];if(y.updateTransform){var b=y.updateTransform(v,d,p,f);b&&b.update&&g.set(v.uid,1)}else g.set(v.uid,1)}),r(d),this._scheduler.performVisualTasks(d,f,{setDirty:!0,dirtyMap:g}),Bc(this,d,p,f,{},g),Br.trigger("afterupdate",d,p)}},updateView:function(f){var h=this._model;h&&(h.setUpdatePayload(f),Rr.markUpdateMethod(f,"updateView"),r(h),this._scheduler.performVisualTasks(h,f,{setDirty:!0}),Mh(this,h,this._api,f,{}),Br.trigger("afterupdate",h,this._api))},updateVisual:function(f){var h=this,d=this._model;d&&(d.setUpdatePayload(f),d.eachSeries(function(p){p.getData().clearAllVisual()}),Rr.markUpdateMethod(f,"updateVisual"),r(d),this._scheduler.performVisualTasks(d,f,{visualType:"visual",setDirty:!0}),d.eachComponent(function(p,m){if(p!=="series"){var g=h.getViewOfComponentModel(m);g&&g.__alive&&g.updateVisual(m,d,h._api,f)}}),d.eachSeries(function(p){var m=h._chartsMap[p.__viewId];m.updateVisual(p,d,h._api,f)}),Br.trigger("afterupdate",d,this._api))},updateLayout:function(f){Xn.update.call(this,f)}},kh=function(f,h,d,p){if(f._disposed){f.id;return}for(var m=f._model,g=f._coordSysMgr.getCoordinateSystems(),v,y=If(m,d),b=0;b<g.length;b++){var x=g[b];if(x[h]&&(v=x[h](m,y,p))!=null)return v}},Th=function(f,h){var d=f._chartsMap,p=f._scheduler;h.eachSeries(function(m){p.updateStreamModes(m,d[m.__viewId])})},Ch=function(f,h){var d=this,p=this.getModel(),m=f.type,g=f.escapeConnect,v=zc[m],y=v.actionInfo,b=(y.update||"update").split(":"),x=b.pop(),w=b[0]!=null&&$r(b[0]);this[Lt]=!0;var S=[f],k=!1;f.batch&&(k=!0,S=he(f.batch,function(R){return R=He(q({},R),f),R.batch=null,R}));var C=[],A,M=Uf(f),T=em(f);if(T&&Kg(this._api),I(S,function(R){if(A=v.action(R,d._model,d._api),A=A||q({},R),A.type=y.event||A.type,C.push(A),T){var O=Lf(f),B=O.queryOptionMap,j=O.mainTypeSpecified,P=j?B.keys()[0]:"series";Nc(d,x,R,P),wr(d)}else M?(Nc(d,x,R,"series"),wr(d)):w&&Nc(d,x,R,w.main,w.sub)}),x!=="none"&&!T&&!M&&!w)try{this[jt]?(zi(this),Xn.update.call(this,f),this[jt]=null):Xn[x].call(this,f)}catch(R){throw this[Lt]=!1,R}if(k?A={type:y.event||m,escapeConnect:g,batch:C}:A=C[0],this[Lt]=!1,!h){var D=this._messageCenter;if(D.trigger(A.type,A),M){var L={type:"selectchanged",escapeConnect:g,selected:a2(p),isFromClick:f.isFromClick||!1,fromAction:f.type,fromActionPayload:f};D.trigger(L.type,L)}}},es=function(f){for(var h=this._pendingActions;h.length;){var d=h.shift();Ch.call(this,d,f)}},ts=function(f){!f&&this.trigger("updated")},Z_=function(f,h){f.on("rendered",function(d){h.trigger("rendered",d),f.animation.isFinished()&&!h[jt]&&!h._scheduler.unfinished&&!h._pendingActions.length&&h.trigger("finished")})},K_=function(f,h){f.on("mouseover",function(d){var p=d.target,m=Jo(p,Vf);m&&(t2(m,d,h._api),wr(h))}).on("mouseout",function(d){var p=d.target,m=Jo(p,Vf);m&&(r2(m,d,h._api),wr(h))}).on("click",function(d){var p=d.target,m=Jo(p,function(y){return We(y).dataIndex!=null},!0);if(m){var g=m.selected?"unselect":"select",v=We(m);h._api.dispatchAction({type:g,dataType:v.dataType,dataIndexInside:v.dataIndex,seriesIndex:v.seriesIndex,isFromClick:!0})}})};function r(f){f.clearColorPalette(),f.eachSeries(function(h){h.clearColorPalette()})}function n(f){var h=[],d=[],p=!1;if(f.eachComponent(function(y,b){var x=b.get("zlevel")||0,w=b.get("z")||0,S=b.getZLevelKey();p=p||!!S,(y==="series"?d:h).push({zlevel:x,z:w,idx:b.componentIndex,type:y,key:S})}),p){var m=h.concat(d),g,v;Sc(m,function(y,b){return y.zlevel===b.zlevel?y.z-b.z:y.zlevel-b.zlevel}),I(m,function(y){var b=f.getComponent(y.type,y.idx),x=y.zlevel,w=y.key;g!=null&&(x=Math.max(g,x)),w?(x===g&&w!==v&&x++,v=w):v&&(x===g&&x++,v=""),g=x,b.setZLevel(x)})}}Mh=function(f,h,d,p,m){n(h),j_(f,h,d,p,m),I(f._chartsViews,function(g){g.__alive=!1}),Bc(f,h,d,p,m),I(f._chartsViews,function(g){g.__alive||g.remove(h,d)})},j_=function(f,h,d,p,m,g){I(g||f._componentsViews,function(v){var y=v.__model;c(y,v),v.render(y,h,d,p),s(y,v),u(y,v)})},Bc=function(f,h,d,p,m,g){var v=f._scheduler;m=q(m||{},{updatedSeries:h.getSeries()}),Br.trigger("series:beforeupdate",h,d,m);var y=!1;h.eachSeries(function(b){var x=f._chartsMap[b.__viewId];x.__alive=!0;var w=x.renderTask;v.updatePayload(w,p),c(b,x),g&&g.get(b.uid)&&w.dirty(),w.perform(v.getPerformArgs(w))&&(y=!0),x.group.silent=!!b.get("silent"),o(b,x),jg(b)}),v.unfinished=y||v.unfinished,Br.trigger("series:layoutlabels",h,d,m),Br.trigger("series:transition",h,d,m),h.eachSeries(function(b){var x=f._chartsMap[b.__viewId];s(b,x),u(b,x)}),i(f,h),Br.trigger("series:afterupdate",h,d,m)},wr=function(f){f[xh]=!0,f.getZr().wakeUp()},eb=function(f){f[xh]&&(f.getZr().storage.traverse(function(h){Io(h)||a(h)}),f[xh]=!1)};function a(f){for(var h=[],d=f.currentStates,p=0;p<d.length;p++){var m=d[p];m==="emphasis"||m==="blur"||m==="select"||h.push(m)}f.selected&&f.states.select&&h.push("select"),f.hoverState===Ml&&f.states.emphasis?h.push("emphasis"):f.hoverState===Cl&&f.states.blur&&h.push("blur"),f.useStates(h)}function i(f,h){var d=f._zr,p=d.storage,m=0;p.traverse(function(g){g.isGroup||m++}),m>h.get("hoverLayerThreshold")&&!_e.node&&!_e.worker&&h.eachSeries(function(g){if(!g.preventUsingHoverLayer){var v=f._chartsMap[g.__viewId];v.__alive&&v.eachRendered(function(y){y.states.emphasis&&(y.states.emphasis.hoverLayer=!0)})}})}function o(f,h){var d=f.get("blendMode")||null;h.eachRendered(function(p){p.isGroup||(p.style.blend=d)})}function s(f,h){if(!f.preventAutoZ){var d=f.get("z")||0,p=f.get("zlevel")||0;h.eachRendered(function(m){return l(m,d,p,-1/0),!0})}}function l(f,h,d,p){var m=f.getTextContent(),g=f.getTextGuideLine(),v=f.isGroup;if(v)for(var y=f.childrenRef(),b=0;b<y.length;b++)p=Math.max(l(y[b],h,d,p),p);else f.z=h,f.zlevel=d,p=Math.max(f.z2,p);if(m&&(m.z=h,m.zlevel=d,isFinite(p)&&(m.z2=p+2)),g){var x=f.textGuideLineConfig;g.z=h,g.zlevel=d,isFinite(p)&&(g.z2=p+(x&&x.showAbove?1:-1))}return p}function c(f,h){h.eachRendered(function(d){if(!Io(d)){var p=d.getTextContent(),m=d.getTextGuideLine();d.stateTransition&&(d.stateTransition=null),p&&p.stateTransition&&(p.stateTransition=null),m&&m.stateTransition&&(m.stateTransition=null),d.hasState()?(d.prevStates=d.currentStates,d.clearStates()):d.prevStates&&(d.prevStates=null)}})}function u(f,h){var d=f.getModel("stateAnimation"),p=f.isAnimationEnabled(),m=d.get("duration"),g=m>0?{duration:m,delay:d.get("delay"),easing:d.get("easing")}:null;h.eachRendered(function(v){if(v.states&&v.states.emphasis){if(Io(v))return;if(v instanceof qe&&c2(v),v.__dirty){var y=v.prevStates;y&&v.useStates(y)}if(p){v.stateTransition=g;var b=v.getTextContent(),x=v.getTextGuideLine();b&&(b.stateTransition=g),x&&(x.stateTransition=g)}v.__dirty&&a(v)}})}J_=function(f){return new((function(h){K(d,h);function d(){return h!==null&&h.apply(this,arguments)||this}return d.prototype.getCoordinateSystems=function(){return f._coordSysMgr.getCoordinateSystems()},d.prototype.getComponentByElement=function(p){for(;p;){var m=p.__ecComponentInfo;if(m!=null)return f._model.getComponent(m.mainType,m.index);p=p.parent}},d.prototype.enterEmphasis=function(p,m){Ll(p,m),wr(f)},d.prototype.leaveEmphasis=function(p,m){Pl(p,m),wr(f)},d.prototype.enterBlur=function(p){Qk(p),wr(f)},d.prototype.leaveBlur=function(p){qg(p),wr(f)},d.prototype.enterSelect=function(p){Yg(p),wr(f)},d.prototype.leaveSelect=function(p){Xg(p),wr(f)},d.prototype.getModel=function(){return f.getModel()},d.prototype.getViewOfComponentModel=function(p){return f.getViewOfComponentModel(p)},d.prototype.getViewOfSeriesModel=function(p){return f.getViewOfSeriesModel(p)},d})(J0))(f)},Q_=function(f){function h(d,p){for(var m=0;m<d.length;m++){var g=d[m];g[wh]=p}}I(rs,function(d,p){f._messageCenter.on(p,function(m){if(nb[f.group]&&f[wh]!==G_){if(m&&m.escapeConnect)return;var g=f.makeActionFromEvent(m),v=[];I(ns,function(y){y!==f&&y.group===f.group&&v.push(y)}),h(v,G_),I(v,function(y){y[wh]!==sI&&y.dispatchAction(g)}),h(v,lI)}})})}})(),e})(Ir),Ah=tb.prototype;Ah.on=$_("on"),Ah.off=$_("off"),Ah.one=function(t,e,r){var n=this;function a(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];e&&e.apply&&e.apply(this,i),n.off(t,a)}this.on.call(this,t,a,r)};var cI=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];function ZO(t){}var zc={},rs={},Dh=[],Ih=[],Fc=[],rb={},Lh={},ns={},nb={},uI=+new Date-0,Ph="_echarts_instance_";function fI(t,e,r){var n=!(r&&r.ssr);if(n){var a=dI(t);if(a)return a}var i=new tb(t,e,r);return i.id="ec_"+uI++,ns[i.id]=i,n&&Eg(t,Ph,i.id),Q_(i),Br.trigger("afterinit",i),i}function dI(t){return ns[Hk(t,Ph)]}function ab(t,e){rb[t]=e}function ib(t){Ue(Ih,t)<0&&Ih.push(t)}function ob(t,e){Eh(Dh,t,e,QD)}function hI(t){Rh("afterinit",t)}function pI(t){Rh("afterupdate",t)}function Rh(t,e){Br.on(t,e)}function Fa(t,e,r){ke(e)&&(r=e,e="");var n=de(t)?t.type:[t,t={event:e}][0];t.event=(t.event||n).toLowerCase(),e=t.event,!rs[e]&&(dn(U_.test(n)&&U_.test(e)),zc[n]||(zc[n]={action:r,actionInfo:t}),rs[e]=n)}function vI(t,e){gd.register(t,e)}function gI(t,e){Eh(Fc,t,e,F_,"layout")}function Ha(t,e){Eh(Fc,t,e,H_,"visual")}var sb=[];function Eh(t,e,r,n,a){if((ke(e)||de(e))&&(r=e,e=n),!(Ue(sb,r)>=0)){sb.push(r);var i=u_.wrapStageHandler(r,a);i.__prio=e,i.__raw=r,t.push(i)}}function lb(t,e){Lh[t]=e}function mI(t,e,r){var n=XD("registerMap");n&&n(t,e,r)}var yI=RC;Ha(bh,cD),Ha(Oc,uD),Ha(Oc,fD),Ha(bh,kD),Ha(Oc,TD),Ha(V_,qD),ib(i_),ob(jD,oD),lb("default",dD),Fa({type:Aa,event:Aa,update:Aa},Et),Fa({type:Al,event:Al,update:Al},Et),Fa({type:To,event:To,update:To},Et),Fa({type:Dl,event:Dl,update:Dl},Et),Fa({type:Co,event:Co,update:Co},Et),ab("light",wD),ab("dark",m_);var cb=[],_I={registerPreprocessor:ib,registerProcessor:ob,registerPostInit:hI,registerPostUpdate:pI,registerUpdateLifecycle:Rh,registerAction:Fa,registerCoordinateSystem:vI,registerLayout:gI,registerVisual:Ha,registerTransform:yI,registerLoading:lb,registerMap:mI,registerImpl:YD,PRIORITY:oI,ComponentModel:Ye,ComponentView:Nr,SeriesModel:Qr,ChartView:Rr,registerComponentModel:function(t){Ye.registerClass(t)},registerComponentView:function(t){Nr.registerClass(t)},registerSeriesModel:function(t){Qr.registerClass(t)},registerChartView:function(t){Rr.registerClass(t)},registerSubTypeDefaulter:function(t,e){Ye.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){FA(t,e)}};function Zn(t){if(ee(t)){I(t,function(e){Zn(e)});return}Ue(cb,t)>=0||(cb.push(t),ke(t)&&(t={install:t}),t.install(_I))}var bI=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e})(Ye),xI=(function(){function t(){}return t.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},t.prototype.getCoordSysModel=function(){},t})(),Oh=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",qt).models[0]},e.type="cartesian2dAxis",e})(Ye);Ur(Oh,xI);var ub={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},wI=Oe({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},ub),Nh=Oe({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},ub),SI=Oe({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},Nh),kI=He({logBase:10},Nh);const TI={category:wI,value:Nh,time:SI,log:kI};var CI=0,Bh=(function(){function t(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++CI}return t.createByAxisModel=function(e){var r=e.option,n=r.data,a=n&&he(n,MI);return new t({categories:a,needCollect:!a,deduplication:r.dedplication!==!1})},t.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},t.prototype.parseAndCollect=function(e){var r,n=this._needCollect;if(!ae(e)&&!n)return e;if(n&&!this._deduplication)return r=this.categories.length,this.categories[r]=e,r;var a=this._getOrCreateMap();return r=a.get(e),r==null&&(n?(r=this.categories.length,this.categories[r]=e,a.set(e,r)):r=NaN),r},t.prototype._getOrCreateMap=function(){return this._map||(this._map=me(this.categories))},t})();function MI(t){return de(t)&&t.value!=null?t.value:t+""}var AI={value:1,category:1,time:1,log:1};function fb(t,e,r,n){I(AI,function(a,i){var o=Oe(Oe({},TI[i],!0),n,!0),s=(function(l){K(c,l);function c(){var u=l!==null&&l.apply(this,arguments)||this;return u.type=e+"Axis."+i,u}return c.prototype.mergeDefaultAndTheme=function(u,f){var h=Vo(this),d=h?vc(u):{},p=f.getTheme();Oe(u,p.get(i+"Axis")),Oe(u,this.getDefaultOption()),u.type=db(u),h&&Pi(u,d,h)},c.prototype.optionUpdated=function(){var u=this.option;u.type==="category"&&(this.__ordinalMeta=Bh.createByAxisModel(this))},c.prototype.getCategories=function(u){var f=this.option;if(f.type==="category")return u?f.data:this.__ordinalMeta.categories},c.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},c.type=e+"Axis."+i,c.defaultOption=o,c})(r);t.registerComponentModel(s)}),t.registerSubTypeDefaulter(e+"Axis",db)}function db(t){return t.type||(t.data?"category":"value")}var en=(function(){function t(e){this._setting=e||{},this._extent=[1/0,-1/0]}return t.prototype.getSetting=function(e){return this._setting[e]},t.prototype.unionExtent=function(e){var r=this._extent;e[0]<r[0]&&(r[0]=e[0]),e[1]>r[1]&&(r[1]=e[1])},t.prototype.unionExtentFromData=function(e,r){this.unionExtent(e.getApproximateExtent(r))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(e,r){var n=this._extent;isNaN(e)||(n[0]=e),isNaN(r)||(n[1]=r)},t.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(e){this._isBlank=e},t})();Zs(en);function zh(t){return t.type==="interval"||t.type==="log"}function DI(t,e,r,n){var a={},i=t[1]-t[0],o=a.interval=Tg(i/e);r!=null&&o<r&&(o=a.interval=r),n!=null&&o>n&&(o=a.interval=n);var s=a.intervalPrecision=hb(o),l=a.niceTickExtent=[mt(Math.ceil(t[0]/o)*o,s),mt(Math.floor(t[1]/o)*o,s)];return II(l,t),a}function Fh(t){var e=Math.pow(10,Af(t)),r=t/e;return r?r===2?r=3:r===3?r=5:r*=2:r=1,mt(r*e)}function hb(t){return gn(t)+2}function pb(t,e,r){t[e]=Math.max(Math.min(t[e],r[1]),r[0])}function II(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),pb(t,0,e),pb(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function Hc(t,e){return t>=e[0]&&t<=e[1]}function Vc(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function Uc(t,e){return t*(e[1]-e[0])+e[0]}var Hh=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;n.type="ordinal";var a=n.getSetting("ordinalMeta");return a||(a=new Bh({})),ee(a)&&(a=new Bh({categories:he(a,function(i){return de(i)?i.value:i})})),n._ordinalMeta=a,n._extent=n.getSetting("extent")||[0,a.categories.length-1],n}return e.prototype.parse=function(r){return r==null?NaN:ae(r)?this._ordinalMeta.getOrdinal(r):Math.round(r)},e.prototype.contain=function(r){return r=this.parse(r),Hc(r,this._extent)&&this._ordinalMeta.categories[r]!=null},e.prototype.normalize=function(r){return r=this._getTickNumber(this.parse(r)),Vc(r,this._extent)},e.prototype.scale=function(r){return r=Math.round(Uc(r,this._extent)),this.getRawOrdinalNumber(r)},e.prototype.getTicks=function(){for(var r=[],n=this._extent,a=n[0];a<=n[1];)r.push({value:a}),a++;return r},e.prototype.getMinorTicks=function(r){},e.prototype.setSortInfo=function(r){if(r==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var n=r.ordinalNumbers,a=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Math.min(s,n.length);o<l;++o){var c=n[o];a[o]=c,i[c]=o}for(var u=0;o<s;++o){for(;i[u]!=null;)u++;a.push(u),i[u]=o}},e.prototype._getTickNumber=function(r){var n=this._ticksByOrdinalNumber;return n&&r>=0&&r<n.length?n[r]:r},e.prototype.getRawOrdinalNumber=function(r){var n=this._ordinalNumbersByTick;return n&&r>=0&&r<n.length?n[r]:r},e.prototype.getLabel=function(r){if(!this.isBlank()){var n=this.getRawOrdinalNumber(r.value),a=this._ordinalMeta.categories[n];return a==null?"":a+""}},e.prototype.count=function(){return this._extent[1]-this._extent[0]+1},e.prototype.unionExtentFromData=function(r,n){this.unionExtent(r.getApproximateExtent(n))},e.prototype.isInExtentRange=function(r){return r=this._getTickNumber(r),this._extent[0]<=r&&this._extent[1]>=r},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e})(en);en.registerClass(Hh);var Va=mt,Fi=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="interval",r._interval=0,r._intervalPrecision=2,r}return e.prototype.parse=function(r){return r},e.prototype.contain=function(r){return Hc(r,this._extent)},e.prototype.normalize=function(r){return Vc(r,this._extent)},e.prototype.scale=function(r){return Uc(r,this._extent)},e.prototype.setExtent=function(r,n){var a=this._extent;isNaN(r)||(a[0]=parseFloat(r)),isNaN(n)||(a[1]=parseFloat(n))},e.prototype.unionExtent=function(r){var n=this._extent;r[0]<n[0]&&(n[0]=r[0]),r[1]>n[1]&&(n[1]=r[1]),this.setExtent(n[0],n[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(r){this._interval=r,this._niceExtent=this._extent.slice(),this._intervalPrecision=hb(r)},e.prototype.getTicks=function(r){var n=this._interval,a=this._extent,i=this._niceExtent,o=this._intervalPrecision,s=[];if(!n)return s;var l=1e4;a[0]<i[0]&&(r?s.push({value:Va(i[0]-n,o)}):s.push({value:a[0]}));for(var c=i[0];c<=i[1]&&(s.push({value:c}),c=Va(c+n,o),c!==s[s.length-1].value);)if(s.length>l)return[];var u=s.length?s[s.length-1].value:i[1];return a[1]>u&&(r?s.push({value:Va(u+n,o)}):s.push({value:a[1]})),s},e.prototype.getMinorTicks=function(r){for(var n=this.getTicks(!0),a=[],i=this.getExtent(),o=1;o<n.length;o++){for(var s=n[o],l=n[o-1],c=0,u=[],f=s.value-l.value,h=f/r;c<r-1;){var d=Va(l.value+(c+1)*h);d>i[0]&&d<i[1]&&u.push(d),c++}a.push(u)}return a},e.prototype.getLabel=function(r,n){if(r==null)return"";var a=n&&n.precision;a==null?a=gn(r.value)||0:a==="auto"&&(a=this._intervalPrecision);var i=Va(r.value,a,!0);return Sy(i)},e.prototype.calcNiceTicks=function(r,n,a){r=r||5;var i=this._extent,o=i[1]-i[0];if(isFinite(o)){o<0&&(o=-o,i.reverse());var s=DI(i,r,n,a);this._intervalPrecision=s.intervalPrecision,this._interval=s.interval,this._niceExtent=s.niceTickExtent}},e.prototype.calcNiceExtent=function(r){var n=this._extent;if(n[0]===n[1])if(n[0]!==0){var a=Math.abs(n[0]);r.fixMax||(n[1]+=a/2),n[0]-=a/2}else n[1]=1;var i=n[1]-n[0];isFinite(i)||(n[0]=0,n[1]=1),this.calcNiceTicks(r.splitNumber,r.minInterval,r.maxInterval);var o=this._interval;r.fixMin||(n[0]=Va(Math.floor(n[0]/o)*o)),r.fixMax||(n[1]=Va(Math.ceil(n[1]/o)*o))},e.prototype.setNiceExtent=function(r,n){this._niceExtent=[r,n]},e.type="interval",e})(en);en.registerClass(Fi);var LI=function(t,e,r,n){for(;r<n;){var a=r+n>>>1;t[a][1]<e?r=a+1:n=a}return r},vb=(function(t){K(e,t);function e(r){var n=t.call(this,r)||this;return n.type="time",n}return e.prototype.getLabel=function(r){var n=this.getSetting("useUTC");return oc(r.value,hy[hC(Ii(this._minLevelUnit))]||hy.second,n,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(r,n,a){var i=this.getSetting("useUTC"),o=this.getSetting("locale");return pC(r,n,a,o,i)},e.prototype.getTicks=function(){var r=this._interval,n=this._extent,a=[];if(!r)return a;a.push({value:n[0],level:0});var i=this.getSetting("useUTC"),o=zI(this._minLevelUnit,this._approxInterval,i,n);return a=a.concat(o),a.push({value:n[1],level:0}),a},e.prototype.calcNiceExtent=function(r){var n=this._extent;if(n[0]===n[1]&&(n[0]-=_r,n[1]+=_r),n[1]===-1/0&&n[0]===1/0){var a=new Date;n[1]=+new Date(a.getFullYear(),a.getMonth(),a.getDate()),n[0]=n[1]-_r}this.calcNiceTicks(r.splitNumber,r.minInterval,r.maxInterval)},e.prototype.calcNiceTicks=function(r,n,a){r=r||10;var i=this._extent,o=i[1]-i[0];this._approxInterval=o/r,n!=null&&this._approxInterval<n&&(this._approxInterval=n),a!=null&&this._approxInterval>a&&(this._approxInterval=a);var s=Gc.length,l=Math.min(LI(Gc,this._approxInterval,0,s),s-1);this._interval=Gc[l][1],this._minLevelUnit=Gc[Math.max(l-1,0)][0]},e.prototype.parse=function(r){return et(r)?r:+mn(r)},e.prototype.contain=function(r){return Hc(this.parse(r),this._extent)},e.prototype.normalize=function(r){return Vc(this.parse(r),this._extent)},e.prototype.scale=function(r){return Uc(r,this._extent)},e.type="time",e})(Fi),Gc=[["second",kd],["minute",Td],["hour",Bo],["quarter-day",Bo*6],["half-day",Bo*12],["day",_r*1.2],["half-week",_r*3.5],["week",_r*7],["month",_r*31],["quarter",_r*95],["half-year",dy/2],["year",dy]];function PI(t,e,r,n){var a=mn(e),i=mn(r),o=function(p){return gy(a,p,n)===gy(i,p,n)},s=function(){return o("year")},l=function(){return s()&&o("month")},c=function(){return l()&&o("day")},u=function(){return c()&&o("hour")},f=function(){return u()&&o("minute")},h=function(){return f()&&o("second")},d=function(){return h()&&o("millisecond")};switch(t){case"year":return s();case"month":return l();case"day":return c();case"hour":return u();case"minute":return f();case"second":return h();case"millisecond":return d()}}function RI(t,e){return t/=_r,t>16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function EI(t){var e=30*_r;return t/=e,t>6?6:t>3?3:t>2?2:1}function OI(t){return t/=Bo,t>12?12:t>6?6:t>3.5?4:t>2?2:1}function gb(t,e){return t/=e?Td:kd,t>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function NI(t){return Tg(t)}function BI(t,e,r){var n=new Date(t);switch(Ii(e)){case"year":case"month":n[my(r)](0);case"day":n[yy(r)](1);case"hour":n[_y(r)](0);case"minute":n[by(r)](0);case"second":n[xy(r)](0),n[wy(r)](0)}return n.getTime()}function zI(t,e,r,n){var a=1e4,i=py,o=0;function s(M,T,D,L,R,O,B){for(var j=new Date(T),P=T,V=j[L]();P<D&&P<=n[1];)B.push({value:P}),V+=M,j[R](V),P=j.getTime();B.push({value:P,notAdd:!0})}function l(M,T,D){var L=[],R=!T.length;if(!PI(Ii(M),n[0],n[1],r)){R&&(T=[{value:BI(new Date(n[0]),M,r)},{value:n[1]}]);for(var O=0;O<T.length-1;O++){var B=T[O].value,j=T[O+1].value;if(B!==j){var P=void 0,V=void 0,H=void 0,Z=!1;switch(M){case"year":P=Math.max(1,Math.round(e/_r/365)),V=Md(r),H=vC(r);break;case"half-year":case"quarter":case"month":P=EI(e),V=Li(r),H=my(r);break;case"week":case"half-week":case"day":P=RI(e),V=sc(r),H=yy(r),Z=!0;break;case"half-day":case"quarter-day":case"hour":P=OI(e),V=Fo(r),H=_y(r);break;case"minute":P=gb(e,!0),V=lc(r),H=by(r);break;case"second":P=gb(e,!1),V=cc(r),H=xy(r);break;case"millisecond":P=NI(e),V=uc(r),H=wy(r);break}s(P,B,j,V,H,Z,L),M==="year"&&D.length>1&&O===0&&D.unshift({value:D[0].value-P})}}for(var O=0;O<L.length;O++)D.push(L[O]);return L}}for(var c=[],u=[],f=0,h=0,d=0;d<i.length&&o++<a;++d){var p=Ii(i[d]);if(dC(i[d])){l(i[d],c[c.length-1]||[],u);var m=i[d+1]?Ii(i[d+1]):null;if(p!==m){if(u.length){h=f,u.sort(function(M,T){return M.value-T.value});for(var g=[],v=0;v<u.length;++v){var y=u[v].value;(v===0||u[v-1].value!==y)&&(g.push(u[v]),y>=n[0]&&y<=n[1]&&f++)}var b=(n[1]-n[0])/e;if(f>b*1.5&&h>b/1.5||(c.push(g),f>b||t===i[d]))break}u=[]}}}for(var x=bt(he(c,function(M){return bt(M,function(T){return T.value>=n[0]&&T.value<=n[1]&&!T.notAdd})}),function(M){return M.length>0}),w=[],S=x.length-1,d=0;d<x.length;++d)for(var k=x[d],C=0;C<k.length;++C)w.push({value:k[C].value,level:S-d});w.sort(function(M,T){return M.value-T.value});for(var A=[],d=0;d<w.length;++d)(d===0||w[d].value!==w[d-1].value)&&A.push(w[d]);return A}en.registerClass(vb);var mb=en.prototype,as=Fi.prototype,FI=mt,HI=Math.floor,VI=Math.ceil,$c=Math.pow,zr=Math.log,Vh=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="log",r.base=10,r._originalScale=new Fi,r._interval=0,r}return e.prototype.getTicks=function(r){var n=this._originalScale,a=this._extent,i=n.getExtent(),o=as.getTicks.call(this,r);return he(o,function(s){var l=s.value,c=mt($c(this.base,l));return c=l===a[0]&&this._fixMin?Wc(c,i[0]):c,c=l===a[1]&&this._fixMax?Wc(c,i[1]):c,{value:c}},this)},e.prototype.setExtent=function(r,n){var a=zr(this.base);r=zr(Math.max(0,r))/a,n=zr(Math.max(0,n))/a,as.setExtent.call(this,r,n)},e.prototype.getExtent=function(){var r=this.base,n=mb.getExtent.call(this);n[0]=$c(r,n[0]),n[1]=$c(r,n[1]);var a=this._originalScale,i=a.getExtent();return this._fixMin&&(n[0]=Wc(n[0],i[0])),this._fixMax&&(n[1]=Wc(n[1],i[1])),n},e.prototype.unionExtent=function(r){this._originalScale.unionExtent(r);var n=this.base;r[0]=zr(r[0])/zr(n),r[1]=zr(r[1])/zr(n),mb.unionExtent.call(this,r)},e.prototype.unionExtentFromData=function(r,n){this.unionExtent(r.getApproximateExtent(n))},e.prototype.calcNiceTicks=function(r){r=r||10;var n=this._extent,a=n[1]-n[0];if(!(a===1/0||a<=0)){var i=Tk(a),o=r/a*i;for(o<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var s=[mt(VI(n[0]/i)*i),mt(HI(n[1]/i)*i)];this._interval=i,this._niceExtent=s}},e.prototype.calcNiceExtent=function(r){as.calcNiceExtent.call(this,r),this._fixMin=r.fixMin,this._fixMax=r.fixMax},e.prototype.parse=function(r){return r},e.prototype.contain=function(r){return r=zr(r)/zr(this.base),Hc(r,this._extent)},e.prototype.normalize=function(r){return r=zr(r)/zr(this.base),Vc(r,this._extent)},e.prototype.scale=function(r){return r=Uc(r,this._extent),$c(this.base,r)},e.type="log",e})(en),yb=Vh.prototype;yb.getMinorTicks=as.getMinorTicks,yb.getLabel=as.getLabel;function Wc(t,e){return FI(t,gn(e))}en.registerClass(Vh);var UI=(function(){function t(e,r,n){this._prepareParams(e,r,n)}return t.prototype._prepareParams=function(e,r,n){n[1]<n[0]&&(n=[NaN,NaN]),this._dataMin=n[0],this._dataMax=n[1];var a=this._isOrdinal=e.type==="ordinal";this._needCrossZero=e.type==="interval"&&r.getNeedCrossZero&&r.getNeedCrossZero();var i=r.get("min",!0);i==null&&(i=r.get("startValue",!0));var o=this._modelMinRaw=i;ke(o)?this._modelMinNum=qc(e,o({min:n[0],max:n[1]})):o!=="dataMin"&&(this._modelMinNum=qc(e,o));var s=this._modelMaxRaw=r.get("max",!0);if(ke(s)?this._modelMaxNum=qc(e,s({min:n[0],max:n[1]})):s!=="dataMax"&&(this._modelMaxNum=qc(e,s)),a)this._axisDataLen=r.getCategories().length;else{var l=r.get("boundaryGap"),c=ee(l)?l:[l||0,l||0];typeof c[0]=="boolean"||typeof c[1]=="boolean"?this._boundaryGapInner=[0,0]:this._boundaryGapInner=[Pn(c[0],1),Pn(c[1],1)]}},t.prototype.calculate=function(){var e=this._isOrdinal,r=this._dataMin,n=this._dataMax,a=this._axisDataLen,i=this._boundaryGapInner,o=e?null:n-r||Math.abs(r),s=this._modelMinRaw==="dataMin"?r:this._modelMinNum,l=this._modelMaxRaw==="dataMax"?n:this._modelMaxNum,c=s!=null,u=l!=null;s==null&&(s=e?a?0:NaN:r-i[0]*o),l==null&&(l=e?a?a-1:NaN:n+i[1]*o),(s==null||!isFinite(s))&&(s=NaN),(l==null||!isFinite(l))&&(l=NaN);var f=qs(s)||qs(l)||e&&!a;this._needCrossZero&&(s>0&&l>0&&!c&&(s=0),s<0&&l<0&&!u&&(l=0));var h=this._determinedMin,d=this._determinedMax;return h!=null&&(s=h,c=!0),d!=null&&(l=d,u=!0),{min:s,max:l,minFixed:c,maxFixed:u,isBlank:f}},t.prototype.modifyDataMinMax=function(e,r){this[$I[e]]=r},t.prototype.setDeterminedMinMax=function(e,r){var n=GI[e];this[n]=r},t.prototype.freeze=function(){this.frozen=!0},t})(),GI={min:"_determinedMin",max:"_determinedMax"},$I={min:"_dataMin",max:"_dataMax"};function _b(t,e,r){var n=t.rawExtentInfo;return n||(n=new UI(t,e,r),t.rawExtentInfo=n,n)}function qc(t,e){return e==null?null:qs(e)?NaN:t.parse(e)}function bb(t,e){var r=t.type,n=_b(t,e,t.getExtent()).calculate();t.setBlank(n.isBlank);var a=n.min,i=n.max,o=e.ecModel;if(o&&r==="time"){var s=u0("bar",o),l=!1;if(I(s,function(f){l=l||f.getBaseAxis()===e.axis}),l){var c=f0(s),u=WI(a,i,e,c);a=u.min,i=u.max}}return{extent:[a,i],fixMin:n.minFixed,fixMax:n.maxFixed}}function WI(t,e,r,n){var a=r.axis.getExtent(),i=Math.abs(a[1]-a[0]),o=UM(n,r.axis);if(o===void 0)return{min:t,max:e};var s=1/0;I(o,function(d){s=Math.min(d.offset,s)});var l=-1/0;I(o,function(d){l=Math.max(d.offset+d.width,l)}),s=Math.abs(s),l=Math.abs(l);var c=s+l,u=e-t,f=1-(s+l)/i,h=u/f-u;return e+=h*(l/c),t-=h*(s/c),{min:t,max:e}}function xb(t,e){var r=e,n=bb(t,r),a=n.extent,i=r.get("splitNumber");t instanceof Vh&&(t.base=r.get("logBase"));var o=t.type,s=r.get("interval"),l=o==="interval"||o==="time";t.setExtent(a[0],a[1]),t.calcNiceExtent({splitNumber:i,fixMin:n.fixMin,fixMax:n.fixMax,minInterval:l?r.get("minInterval"):null,maxInterval:l?r.get("maxInterval"):null}),s!=null&&t.setInterval&&t.setInterval(s)}function qI(t,e){if(e=e||t.get("type"),e)switch(e){case"category":return new Hh({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new vb({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(en.getClass(e)||Fi)}}function YI(t){var e=t.scale.getExtent(),r=e[0],n=e[1];return!(r>0&&n>0||r<0&&n<0)}function Hi(t){var e=t.getLabelModel().get("formatter"),r=t.type==="category"?t.scale.getExtent()[0]:null;return t.scale.type==="time"?(function(n){return function(a,i){return t.scale.getFormattedLabel(a,i,n)}})(e):ae(e)?(function(n){return function(a){var i=t.scale.getLabel(a),o=n.replace("{value}",i??"");return o}})(e):ke(e)?(function(n){return function(a,i){return r!=null&&(i=a.value-r),n(Uh(t,a),i,a.level!=null?{level:a.level}:null)}})(e):function(n){return t.scale.getLabel(n)}}function Uh(t,e){return t.type==="category"?t.scale.getLabel(e):e.value}function XI(t){var e=t.model,r=t.scale;if(!(!e.get(["axisLabel","show"])||r.isBlank())){var n,a,i=r.getExtent();r instanceof Hh?a=r.count():(n=r.getTicks(),a=n.length);var o=t.getLabelModel(),s=Hi(t),l,c=1;a>40&&(c=Math.ceil(a/40));for(var u=0;u<a;u+=c){var f=n?n[u]:{value:i[0]+u},h=s(f,u),d=o.getTextRect(h),p=ZI(d,o.get("rotate")||0);l?l.union(p):l=p}return l}}function ZI(t,e){var r=e*Math.PI/180,n=t.width,a=t.height,i=n*Math.abs(Math.cos(r))+Math.abs(a*Math.sin(r)),o=n*Math.abs(Math.sin(r))+Math.abs(a*Math.cos(r)),s=new Ge(t.x,t.y,i,o);return s}function Gh(t){var e=t.get("interval");return e??"auto"}function wb(t){return t.type==="category"&&Gh(t.getLabelModel())===0}function Sb(t,e){var r={};return I(t.mapDimensionsAll(e),function(n){r[YT(t,n)]=!0}),at(r)}function KI(t,e,r){e&&I(Sb(e,r),function(n){var a=e.getApproximateExtent(n);a[0]<t[0]&&(t[0]=a[0]),a[1]>t[1]&&(t[1]=a[1])})}var jI=(function(){function t(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return t.prototype.getAxis=function(e){return this._axes[e]},t.prototype.getAxes=function(){return he(this._dimList,function(e){return this._axes[e]},this)},t.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),bt(this.getAxes(),function(r){return r.scale.type===e})},t.prototype.addAxis=function(e){var r=e.dim;this._axes[r]=e,this._dimList.push(r)},t})(),$h=["x","y"];function kb(t){return t.type==="interval"||t.type==="time"}var JI=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="cartesian2d",r.dimensions=$h,r}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!kb(r)||!kb(n))){var a=r.getExtent(),i=n.getExtent(),o=this.dataToPoint([a[0],i[0]]),s=this.dataToPoint([a[1],i[1]]),l=a[1]-a[0],c=i[1]-i[0];if(!(!l||!c)){var u=(s[0]-o[0])/l,f=(s[1]-o[1])/c,h=o[0]-a[0]*u,d=o[1]-i[0]*f,p=this._transform=[u,0,0,f,h,d];this._invTransform=Gu([],p)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(r){var n=this.getAxis("x"),a=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&a.contain(a.toLocalCoord(r[1]))},e.prototype.containData=function(r){return this.getAxis("x").containData(r[0])&&this.getAxis("y").containData(r[1])},e.prototype.containZone=function(r,n){var a=this.dataToPoint(r),i=this.dataToPoint(n),o=this.getArea(),s=new Ge(a[0],a[1],i[0]-a[0],i[1]-a[1]);return o.intersect(s)},e.prototype.dataToPoint=function(r,n,a){a=a||[];var i=r[0],o=r[1];if(this._transform&&i!=null&&isFinite(i)&&o!=null&&isFinite(o))return dr(a,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return a[0]=s.toGlobalCoord(s.dataToCoord(i,n)),a[1]=l.toGlobalCoord(l.dataToCoord(o,n)),a},e.prototype.clampData=function(r,n){var a=this.getAxis("x").scale,i=this.getAxis("y").scale,o=a.getExtent(),s=i.getExtent(),l=a.parse(r[0]),c=i.parse(r[1]);return n=n||[],n[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),n[1]=Math.min(Math.max(Math.min(s[0],s[1]),c),Math.max(s[0],s[1])),n},e.prototype.pointToData=function(r,n){var a=[];if(this._invTransform)return dr(a,r,this._invTransform);var i=this.getAxis("x"),o=this.getAxis("y");return a[0]=i.coordToData(i.toLocalCoord(r[0]),n),a[1]=o.coordToData(o.toLocalCoord(r[1]),n),a},e.prototype.getOtherAxis=function(r){return this.getAxis(r.dim==="x"?"y":"x")},e.prototype.getArea=function(r){r=r||0;var n=this.getAxis("x").getGlobalExtent(),a=this.getAxis("y").getGlobalExtent(),i=Math.min(n[0],n[1])-r,o=Math.min(a[0],a[1])-r,s=Math.max(n[0],n[1])-i+r,l=Math.max(a[0],a[1])-o+r;return new Ge(i,o,s,l)},e})(jI),is=ht();function Tb(t,e){var r=he(e,function(n){return t.scale.parse(n)});return t.type==="time"&&r.length>0&&(r.sort(),r.unshift(r[0]),r.push(r[r.length-1])),r}function QI(t){var e=t.getLabelModel().get("customValues");if(e){var r=Hi(t),n=t.scale.getExtent(),a=Tb(t,e),i=bt(a,function(o){return o>=n[0]&&o<=n[1]});return{labels:he(i,function(o){var s={value:o};return{formattedLabel:r(s),rawLabel:t.scale.getLabel(s),tickValue:o}})}}return t.type==="category"?tL(t):nL(t)}function eL(t,e){var r=t.getTickModel().get("customValues");if(r){var n=t.scale.getExtent(),a=Tb(t,r);return{ticks:bt(a,function(i){return i>=n[0]&&i<=n[1]})}}return t.type==="category"?rL(t,e):{ticks:he(t.scale.getTicks(),function(i){return i.value})}}function tL(t){var e=t.getLabelModel(),r=Cb(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:r.labelCategoryInterval}:r}function Cb(t,e){var r=Mb(t,"labels"),n=Gh(e),a=Ab(r,n);if(a)return a;var i,o;return ke(n)?i=Lb(t,n):(o=n==="auto"?aL(t):n,i=Ib(t,o)),Db(r,n,{labels:i,labelCategoryInterval:o})}function rL(t,e){var r=Mb(t,"ticks"),n=Gh(e),a=Ab(r,n);if(a)return a;var i,o;if((!e.get("show")||t.scale.isBlank())&&(i=[]),ke(n))i=Lb(t,n,!0);else if(n==="auto"){var s=Cb(t,t.getLabelModel());o=s.labelCategoryInterval,i=he(s.labels,function(l){return l.tickValue})}else o=n,i=Ib(t,o,!0);return Db(r,n,{ticks:i,tickCategoryInterval:o})}function nL(t){var e=t.scale.getTicks(),r=Hi(t);return{labels:he(e,function(n,a){return{level:n.level,formattedLabel:r(n,a),rawLabel:t.scale.getLabel(n),tickValue:n.value}})}}function Mb(t,e){return is(t)[e]||(is(t)[e]=[])}function Ab(t,e){for(var r=0;r<t.length;r++)if(t[r].key===e)return t[r].value}function Db(t,e,r){return t.push({key:e,value:r}),r}function aL(t){var e=is(t).autoInterval;return e??(is(t).autoInterval=t.calculateCategoryInterval())}function iL(t){var e=oL(t),r=Hi(t),n=(e.axisRotate-e.labelRotate)/180*Math.PI,a=t.scale,i=a.getExtent(),o=a.count();if(i[1]-i[0]<1)return 0;var s=1;o>40&&(s=Math.max(1,Math.floor(o/40)));for(var l=i[0],c=t.dataToCoord(l+1)-t.dataToCoord(l),u=Math.abs(c*Math.cos(n)),f=Math.abs(c*Math.sin(n)),h=0,d=0;l<=i[1];l+=s){var p=0,m=0,g=$u(r({value:l}),e.font,"center","top");p=g.width*1.3,m=g.height*1.3,h=Math.max(h,p,7),d=Math.max(d,m,7)}var v=h/u,y=d/f;isNaN(v)&&(v=1/0),isNaN(y)&&(y=1/0);var b=Math.max(0,Math.floor(Math.min(v,y))),x=is(t.model),w=t.getExtent(),S=x.lastAutoInterval,k=x.lastTickCount;return S!=null&&k!=null&&Math.abs(S-b)<=1&&Math.abs(k-o)<=1&&S>b&&x.axisExtent0===w[0]&&x.axisExtent1===w[1]?b=S:(x.lastTickCount=o,x.lastAutoInterval=b,x.axisExtent0=w[0],x.axisExtent1=w[1]),b}function oL(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function Ib(t,e,r){var n=Hi(t),a=t.scale,i=a.getExtent(),o=t.getLabelModel(),s=[],l=Math.max((e||0)+1,1),c=i[0],u=a.count();c!==0&&l>1&&u/l>2&&(c=Math.round(Math.ceil(c/l)*l));var f=wb(t),h=o.get("showMinLabel")||f,d=o.get("showMaxLabel")||f;h&&c!==i[0]&&m(i[0]);for(var p=c;p<=i[1];p+=l)m(p);d&&p-l!==i[1]&&m(i[1]);function m(g){var v={value:g};s.push(r?g:{formattedLabel:n(v),rawLabel:a.getLabel(v),tickValue:g})}return s}function Lb(t,e,r){var n=t.scale,a=Hi(t),i=[];return I(n.getTicks(),function(o){var s=n.getLabel(o),l=o.value;e(o.value,s)&&i.push(r?l:{formattedLabel:a(o),rawLabel:s,tickValue:l})}),i}var Pb=[0,1],sL=(function(){function t(e,r,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=r,this._extent=n||[0,0]}return t.prototype.contain=function(e){var r=this._extent,n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return e>=n&&e<=a},t.prototype.containData=function(e){return this.scale.contain(e)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(e){return Sg(e||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(e,r){var n=this._extent;n[0]=e,n[1]=r},t.prototype.dataToCoord=function(e,r){var n=this._extent,a=this.scale;return e=a.normalize(e),this.onBand&&a.type==="ordinal"&&(n=n.slice(),Rb(n,a.count())),Ca(e,Pb,n,r)},t.prototype.coordToData=function(e,r){var n=this._extent,a=this.scale;this.onBand&&a.type==="ordinal"&&(n=n.slice(),Rb(n,a.count()));var i=Ca(e,n,Pb,r);return this.scale.scale(i)},t.prototype.pointToData=function(e,r){},t.prototype.getTicksCoords=function(e){e=e||{};var r=e.tickModel||this.getTickModel(),n=eL(this,r),a=n.ticks,i=he(a,function(s){return{coord:this.dataToCoord(this.scale.type==="ordinal"?this.scale.getRawOrdinalNumber(s):s),tickValue:s}},this),o=r.get("alignWithLabel");return lL(this,i,o,e.clamp),i},t.prototype.getMinorTicksCoords=function(){if(this.scale.type==="ordinal")return[];var e=this.model.getModel("minorTick"),r=e.get("splitNumber");r>0&&r<100||(r=5);var n=this.scale.getMinorTicks(r),a=he(n,function(i){return he(i,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return a},t.prototype.getViewLabels=function(){return QI(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var e=this._extent,r=this.scale.getExtent(),n=r[1]-r[0]+(this.onBand?1:0);n===0&&(n=1);var a=Math.abs(e[1]-e[0]);return Math.abs(a)/n},t.prototype.calculateCategoryInterval=function(){return iL(this)},t})();function Rb(t,e){var r=t[1]-t[0],n=e,a=r/n/2;t[0]+=a,t[1]-=a}function lL(t,e,r,n){var a=e.length;if(!t.onBand||r||!a)return;var i=t.getExtent(),o,s;if(a===1)e[0].coord=i[0],o=e[1]={coord:i[1],tickValue:e[0].tickValue};else{var l=e[a-1].tickValue-e[0].tickValue,c=(e[a-1].coord-e[0].coord)/l;I(e,function(d){d.coord-=c/2});var u=t.scale.getExtent();s=1+u[1]-e[a-1].tickValue,o={coord:e[a-1].coord+c*s,tickValue:u[1]+1},e.push(o)}var f=i[0]>i[1];h(e[0].coord,i[0])&&(n?e[0].coord=i[0]:e.shift()),n&&h(i[0],e[0].coord)&&e.unshift({coord:i[0]}),h(i[1],o.coord)&&(n?o.coord=i[1]:e.pop()),n&&h(o.coord,i[1])&&e.push({coord:i[1]});function h(d,p){return d=mt(d),p=mt(p),f?d>p:d<p}}var cL=(function(t){K(e,t);function e(r,n,a,i,o){var s=t.call(this,r,n,a)||this;return s.index=0,s.type=i||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var r=this.position;return r==="top"||r==="bottom"},e.prototype.getGlobalExtent=function(r){var n=this.getExtent();return n[0]=this.toGlobalCoord(n[0]),n[1]=this.toGlobalCoord(n[1]),r&&n[0]>n[1]&&n.reverse(),n},e.prototype.pointToData=function(r,n){return this.coordToData(this.toLocalCoord(r[this.dim==="x"?0:1]),n)},e.prototype.setCategorySortInfo=function(r){if(this.type!=="category")return!1;this.model.option.categorySortInfo=r,this.scale.setSortInfo(r)},e})(sL);function Wh(t,e,r){r=r||{};var n=t.coordinateSystem,a=e.axis,i={},o=a.getAxesOnZeroOf()[0],s=a.position,l=o?"onZero":s,c=a.dim,u=n.getRect(),f=[u.x,u.x+u.width,u.y,u.y+u.height],h={left:0,right:1,top:0,bottom:1,onZero:2},d=e.get("offset")||0,p=c==="x"?[f[2]-d,f[3]+d]:[f[0]-d,f[1]+d];if(o){var m=o.toGlobalCoord(o.dataToCoord(0));p[h.onZero]=Math.max(Math.min(m,p[1]),p[0])}i.position=[c==="y"?p[h[l]]:f[0],c==="x"?p[h[l]]:f[3]],i.rotation=Math.PI/2*(c==="x"?0:1);var g={top:-1,bottom:1,left:-1,right:1};i.labelDirection=i.tickDirection=i.nameDirection=g[s],i.labelOffset=o?p[h[s]]-p[h.onZero]:0,e.get(["axisTick","inside"])&&(i.tickDirection=-i.tickDirection),ao(r.labelInside,e.get(["axisLabel","inside"]))&&(i.labelDirection=-i.labelDirection);var v=e.get(["axisLabel","rotate"]);return i.labelRotate=l==="top"?-v:v,i.z2=1,i}function Eb(t){return t.get("coordinateSystem")==="cartesian2d"}function Ob(t){var e={xAxisModel:null,yAxisModel:null};return I(e,function(r,n){var a=n.replace(/Model$/,""),i=t.getReferringComponents(a,qt).models[0];e[n]=i}),e}var qh=Math.log;function uL(t,e,r){var n=Fi.prototype,a=n.getTicks.call(r),i=n.getTicks.call(r,!0),o=a.length-1,s=n.getInterval.call(r),l=bb(t,e),c=l.extent,u=l.fixMin,f=l.fixMax;if(t.type==="log"){var h=qh(t.base);c=[qh(c[0])/h,qh(c[1])/h]}t.setExtent(c[0],c[1]),t.calcNiceExtent({splitNumber:o,fixMin:u,fixMax:f});var d=n.getExtent.call(t);u&&(c[0]=d[0]),f&&(c[1]=d[1]);var p=n.getInterval.call(t),m=c[0],g=c[1];if(u&&f)p=(g-m)/o;else if(u)for(g=c[0]+p*o;g<c[1]&&isFinite(g)&&isFinite(c[1]);)p=Fh(p),g=c[0]+p*o;else if(f)for(m=c[1]-p*o;m>c[0]&&isFinite(m)&&isFinite(c[0]);)p=Fh(p),m=c[1]-p*o;else{var v=t.getTicks().length-1;v>o&&(p=Fh(p));var y=p*o;g=Math.ceil(c[1]/p)*p,m=mt(g-y),m<0&&c[0]>=0?(m=0,g=mt(y)):g>0&&c[1]<=0&&(g=0,m=-mt(y))}var b=(a[0].value-i[0].value)/s,x=(a[o].value-i[o].value)/s;n.setExtent.call(t,m+p*b,g+p*x),n.setInterval.call(t,p),(b||x)&&n.setNiceExtent.call(t,m+p,g-p)}var fL=(function(){function t(e,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=$h,this._initCartesian(e,r,n),this.model=e}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(e,r){var n=this._axesMap;this._updateScale(e,this.model);function a(o){var s,l=at(o),c=l.length;if(c){for(var u=[],f=c-1;f>=0;f--){var h=+l[f],d=o[h],p=d.model,m=d.scale;zh(m)&&p.get("alignTicks")&&p.get("interval")==null?u.push(d):(xb(m,p),zh(m)&&(s=d))}u.length&&(s||(s=u.pop(),xb(s.scale,s.model)),I(u,function(g){uL(g.scale,g.model,s.scale)}))}}a(n.x),a(n.y);var i={};I(n.x,function(o){Nb(n,"y",o,i)}),I(n.y,function(o){Nb(n,"x",o,i)}),this.resize(this.model,r)},t.prototype.resize=function(e,r,n){var a=e.getBoxLayoutParams(),i=!n&&e.get("containLabel"),o=pc(a,{width:r.getWidth(),height:r.getHeight()});this._rect=o;var s=this._axesList;l(),i&&(I(s,function(c){if(!c.model.get(["axisLabel","inside"])){var u=XI(c);if(u){var f=c.isHorizontal()?"height":"width",h=c.model.get(["axisLabel","margin"]);o[f]-=u[f]+h,c.position==="top"?o.y+=u.height+h:c.position==="left"&&(o.x+=u.width+h)}}}),l()),I(this._coordsList,function(c){c.calcAffineTransform()});function l(){I(s,function(c){var u=c.isHorizontal(),f=u?[0,o.width]:[0,o.height],h=c.inverse?1:0;c.setExtent(f[h],f[1-h]),dL(c,u?o.x:o.y)})}},t.prototype.getAxis=function(e,r){var n=this._axesMap[e];if(n!=null)return n[r||0]},t.prototype.getAxes=function(){return this._axesList.slice()},t.prototype.getCartesian=function(e,r){if(e!=null&&r!=null){var n="x"+e+"y"+r;return this._coordsMap[n]}de(e)&&(r=e.yAxisIndex,e=e.xAxisIndex);for(var a=0,i=this._coordsList;a<i.length;a++)if(i[a].getAxis("x").index===e||i[a].getAxis("y").index===r)return i[a]},t.prototype.getCartesians=function(){return this._coordsList.slice()},t.prototype.convertToPixel=function(e,r,n){var a=this._findConvertTarget(r);return a.cartesian?a.cartesian.dataToPoint(n):a.axis?a.axis.toGlobalCoord(a.axis.dataToCoord(n)):null},t.prototype.convertFromPixel=function(e,r,n){var a=this._findConvertTarget(r);return a.cartesian?a.cartesian.pointToData(n):a.axis?a.axis.coordToData(a.axis.toLocalCoord(n)):null},t.prototype._findConvertTarget=function(e){var r=e.seriesModel,n=e.xAxisModel||r&&r.getReferringComponents("xAxis",qt).models[0],a=e.yAxisModel||r&&r.getReferringComponents("yAxis",qt).models[0],i=e.gridModel,o=this._coordsList,s,l;if(r)s=r.coordinateSystem,Ue(o,s)<0&&(s=null);else if(n&&a)s=this.getCartesian(n.componentIndex,a.componentIndex);else if(n)l=this.getAxis("x",n.componentIndex);else if(a)l=this.getAxis("y",a.componentIndex);else if(i){var c=i.coordinateSystem;c===this&&(s=this._coordsList[0])}return{cartesian:s,axis:l}},t.prototype.containPoint=function(e){var r=this._coordsList[0];if(r)return r.containPoint(e)},t.prototype._initCartesian=function(e,r,n){var a=this,i=this,o={left:!1,right:!1,top:!1,bottom:!1},s={x:{},y:{}},l={x:0,y:0};if(r.eachComponent("xAxis",c("x"),this),r.eachComponent("yAxis",c("y"),this),!l.x||!l.y){this._axesMap={},this._axesList=[];return}this._axesMap=s,I(s.x,function(u,f){I(s.y,function(h,d){var p="x"+f+"y"+d,m=new JI(p);m.master=a,m.model=e,a._coordsMap[p]=m,a._coordsList.push(m),m.addAxis(u),m.addAxis(h)})});function c(u){return function(f,h){if(Yh(f,e)){var d=f.get("position");u==="x"?d!=="top"&&d!=="bottom"&&(d=o.bottom?"top":"bottom"):d!=="left"&&d!=="right"&&(d=o.left?"right":"left"),o[d]=!0;var p=new cL(u,qI(f),[0,0],f.get("type"),d),m=p.type==="category";p.onBand=m&&f.get("boundaryGap"),p.inverse=f.get("inverse"),f.axis=p,p.model=f,p.grid=i,p.index=h,i._axesList.push(p),s[u][h]=p,l[u]++}}}},t.prototype._updateScale=function(e,r){I(this._axesList,function(a){if(a.scale.setExtent(1/0,-1/0),a.type==="category"){var i=a.model.get("categorySortInfo");a.scale.setSortInfo(i)}}),e.eachSeries(function(a){if(Eb(a)){var i=Ob(a),o=i.xAxisModel,s=i.yAxisModel;if(!Yh(o,r)||!Yh(s,r))return;var l=this.getCartesian(o.componentIndex,s.componentIndex),c=a.getData(),u=l.getAxis("x"),f=l.getAxis("y");n(c,u),n(c,f)}},this);function n(a,i){I(Sb(a,i.dim),function(o){i.scale.unionExtentFromData(a,o)})}},t.prototype.getTooltipAxes=function(e){var r=[],n=[];return I(this.getCartesians(),function(a){var i=e!=null&&e!=="auto"?a.getAxis(e):a.getBaseAxis(),o=a.getOtherAxis(i);Ue(r,i)<0&&r.push(i),Ue(n,o)<0&&n.push(o)}),{baseAxes:r,otherAxes:n}},t.create=function(e,r){var n=[];return e.eachComponent("grid",function(a,i){var o=new t(a,e,r);o.name="grid_"+i,o.resize(a,r,!0),a.coordinateSystem=o,n.push(o)}),e.eachSeries(function(a){if(Eb(a)){var i=Ob(a),o=i.xAxisModel,s=i.yAxisModel,l=o.getCoordSysModel(),c=l.coordinateSystem;a.coordinateSystem=c.getCartesian(o.componentIndex,s.componentIndex)}}),n},t.dimensions=$h,t})();function Yh(t,e){return t.getCoordSysModel()===e}function Nb(t,e,r,n){r.getAxesOnZeroOf=function(){return i?[i]:[]};var a=t[e],i,o=r.model,s=o.get(["axisLine","onZero"]),l=o.get(["axisLine","onZeroAxisIndex"]);if(!s)return;if(l!=null)Bb(a[l])&&(i=a[l]);else for(var c in a)if(a.hasOwnProperty(c)&&Bb(a[c])&&!n[u(a[c])]){i=a[c];break}i&&(n[u(i)]=!0);function u(f){return f.dim+"_"+f.index}}function Bb(t){return t&&t.type!=="category"&&t.type!=="time"&&YI(t)}function dL(t,e){var r=t.getExtent(),n=r[0]+r[1];t.toGlobalCoord=t.dim==="x"?function(a){return a+e}:function(a){return n-a+e},t.toLocalCoord=t.dim==="x"?function(a){return a-e}:function(a){return n-a+e}}var Kn=Math.PI,jn=(function(){function t(e,r){this.group=new St,this.opt=r,this.axisModel=e,He(r,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new St({x:r.position[0],y:r.position[1],rotation:r.rotation});n.updateTransform(),this._transformGroup=n}return t.prototype.hasBuilder=function(e){return!!zb[e]},t.prototype.add=function(e){zb[e](this.opt,this.axisModel,this.group,this._transformGroup)},t.prototype.getGroup=function(){return this.group},t.innerTextLayout=function(e,r,n){var a=kg(r-e),i,o;return kl(a)?(o=n>0?"top":"bottom",i="center"):kl(a-Kn)?(o=n>0?"bottom":"top",i="center"):(o="middle",a>0&&a<Kn?i=n>0?"right":"left":i=n>0?"left":"right"),{rotation:a,textAlign:i,textVerticalAlign:o}},t.makeAxisEventDataBase=function(e){var r={componentType:e.mainType,componentIndex:e.componentIndex};return r[e.mainType+"Index"]=e.componentIndex,r},t.isLabelSilent=function(e){var r=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||r&&r.show)},t})(),zb={axisLine:function(t,e,r,n){var a=e.get(["axisLine","show"]);if(a==="auto"&&t.handleAutoShown&&(a=t.handleAutoShown("axisLine")),!!a){var i=e.axis.getExtent(),o=n.transform,s=[i[0],0],l=[i[1],0],c=s[0]>l[0];o&&(dr(s,s,o),dr(l,l,o));var u=q({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),f=new Hn({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:u,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});Lo(f.shape,f.style.lineWidth),f.anid="line",r.add(f);var h=e.get(["axisLine","symbol"]);if(h!=null){var d=e.get(["axisLine","symbolSize"]);ae(h)&&(h=[h,h]),(ae(d)||et(d))&&(d=[d,d]);var p=Gy(e.get(["axisLine","symbolOffset"])||0,d),m=d[0],g=d[1];I([{rotate:t.rotation+Math.PI/2,offset:p[0],r:0},{rotate:t.rotation-Math.PI/2,offset:p[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(v,y){if(h[y]!=="none"&&h[y]!=null){var b=Ri(h[y],-m/2,-g/2,m,g,u.stroke,!0),x=v.r+v.offset,w=c?l:s;b.attr({rotation:v.rotate,x:w[0]+x*Math.cos(t.rotation),y:w[1]-x*Math.sin(t.rotation),silent:!0,z2:11}),r.add(b)}})}}},axisTickLabel:function(t,e,r,n){var a=vL(r,n,e,t),i=mL(r,n,e,t);if(pL(e,i,a),gL(r,n,e,t.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=cA(he(i,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));uA(o)}},axisName:function(t,e,r,n){var a=ao(t.axisName,e.get("name"));if(a){var i=e.get("nameLocation"),o=t.nameDirection,s=e.getModel("nameTextStyle"),l=e.get("nameGap")||0,c=e.axis.getExtent(),u=c[0]>c[1]?-1:1,f=[i==="start"?c[0]-u*l:i==="end"?c[1]+u*l:(c[0]+c[1])/2,Hb(i)?t.labelOffset+o*l:0],h,d=e.get("nameRotate");d!=null&&(d=d*Kn/180);var p;Hb(i)?h=jn.innerTextLayout(t.rotation,d??t.rotation,o):(h=hL(t.rotation,i,d||0,c),p=t.axisNameAvailableWidth,p!=null&&(p=Math.abs(p/Math.sin(h.rotation)),!isFinite(p)&&(p=null)));var m=s.getFont(),g=e.get("nameTruncate",!0)||{},v=g.ellipsis,y=ao(t.nameTruncateMaxWidth,g.maxWidth,p),b=new $t({x:f[0],y:f[1],rotation:h.rotation,silent:jn.isLabelSilent(e),style:wi(s,{text:a,font:m,overflow:"truncate",width:y,ellipsis:v,fill:s.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:s.get("align")||h.textAlign,verticalAlign:s.get("verticalAlign")||h.textVerticalAlign}),z2:1});if(Wl({el:b,componentModel:e,itemName:a}),b.__fullText=a,b.anid="name",e.get("triggerEvent")){var x=jn.makeAxisEventDataBase(e);x.targetType="axisName",x.name=a,We(b).eventData=x}n.add(b),b.updateTransform(),r.add(b),b.decomposeTransform()}}};function hL(t,e,r,n){var a=kg(r-t),i,o,s=n[0]>n[1],l=e==="start"&&!s||e!=="start"&&s;return kl(a-Kn/2)?(o=l?"bottom":"top",i="center"):kl(a-Kn*1.5)?(o=l?"top":"bottom",i="center"):(o="middle",a<Kn*1.5&&a>Kn/2?i=l?"left":"right":i=l?"right":"left"),{rotation:a,textAlign:i,textVerticalAlign:o}}function pL(t,e,r){if(!wb(t.axis)){var n=t.get(["axisLabel","showMinLabel"]),a=t.get(["axisLabel","showMaxLabel"]);e=e||[],r=r||[];var i=e[0],o=e[1],s=e[e.length-1],l=e[e.length-2],c=r[0],u=r[1],f=r[r.length-1],h=r[r.length-2];n===!1?(Sr(i),Sr(c)):Fb(i,o)&&(n?(Sr(o),Sr(u)):(Sr(i),Sr(c))),a===!1?(Sr(s),Sr(f)):Fb(l,s)&&(a?(Sr(l),Sr(h)):(Sr(s),Sr(f)))}}function Sr(t){t&&(t.ignore=!0)}function Fb(t,e){var r=t&&t.getBoundingRect().clone(),n=e&&e.getBoundingRect().clone();if(!(!r||!n)){var a=Hu([]);return Uu(a,a,-t.rotation),r.applyTransform(ii([],a,t.getLocalTransform())),n.applyTransform(ii([],a,e.getLocalTransform())),r.intersect(n)}}function Hb(t){return t==="middle"||t==="center"}function Vb(t,e,r,n,a){for(var i=[],o=[],s=[],l=0;l<t.length;l++){var c=t[l].coord;o[0]=c,o[1]=0,s[0]=c,s[1]=r,e&&(dr(o,o,e),dr(s,s,e));var u=new Hn({shape:{x1:o[0],y1:o[1],x2:s[0],y2:s[1]},style:n,z2:2,autoBatch:!0,silent:!0});Lo(u.shape,u.style.lineWidth),u.anid=a+"_"+t[l].tickValue,i.push(u)}return i}function vL(t,e,r,n){var a=r.axis,i=r.getModel("axisTick"),o=i.get("show");if(o==="auto"&&n.handleAutoShown&&(o=n.handleAutoShown("axisTick")),!(!o||a.scale.isBlank())){for(var s=i.getModel("lineStyle"),l=n.tickDirection*i.get("length"),c=a.getTicksCoords(),u=Vb(c,e.transform,l,He(s.getLineStyle(),{stroke:r.get(["axisLine","lineStyle","color"])}),"ticks"),f=0;f<u.length;f++)t.add(u[f]);return u}}function gL(t,e,r,n){var a=r.axis,i=r.getModel("minorTick");if(!(!i.get("show")||a.scale.isBlank())){var o=a.getMinorTicksCoords();if(o.length)for(var s=i.getModel("lineStyle"),l=n*i.get("length"),c=He(s.getLineStyle(),He(r.getModel("axisTick").getLineStyle(),{stroke:r.get(["axisLine","lineStyle","color"])})),u=0;u<o.length;u++)for(var f=Vb(o[u],e.transform,l,c,"minorticks_"+u),h=0;h<f.length;h++)t.add(f[h])}}function mL(t,e,r,n){var a=r.axis,i=ao(n.axisLabelShow,r.get(["axisLabel","show"]));if(!(!i||a.scale.isBlank())){var o=r.getModel("axisLabel"),s=o.get("margin"),l=a.getViewLabels(),c=(ao(n.labelRotate,o.get("rotate"))||0)*Kn/180,u=jn.innerTextLayout(n.rotation,c,n.labelDirection),f=r.getCategories&&r.getCategories(!0),h=[],d=jn.isLabelSilent(r),p=r.get("triggerEvent");return I(l,function(m,g){var v=a.scale.type==="ordinal"?a.scale.getRawOrdinalNumber(m.tickValue):m.tickValue,y=m.formattedLabel,b=m.rawLabel,x=o;if(f&&f[v]){var w=f[v];de(w)&&w.textStyle&&(x=new lt(w.textStyle,o,r.ecModel))}var S=x.getTextColor()||r.get(["axisLine","lineStyle","color"]),k=a.dataToCoord(v),C=x.getShallow("align",!0)||u.textAlign,A=Pe(x.getShallow("alignMinLabel",!0),C),M=Pe(x.getShallow("alignMaxLabel",!0),C),T=x.getShallow("verticalAlign",!0)||x.getShallow("baseline",!0)||u.textVerticalAlign,D=Pe(x.getShallow("verticalAlignMinLabel",!0),T),L=Pe(x.getShallow("verticalAlignMaxLabel",!0),T),R=new $t({x:k,y:n.labelOffset+n.labelDirection*s,rotation:u.rotation,silent:d,z2:10+(m.level||0),style:wi(x,{text:y,align:g===0?A:g===l.length-1?M:C,verticalAlign:g===0?D:g===l.length-1?L:T,fill:ke(S)?S(a.type==="category"?b:a.type==="value"?v+"":v,g):S})});if(R.anid="label_"+v,Wl({el:R,componentModel:r,itemName:y,formatterParamsExtra:{isTruncated:function(){return R.isTruncated},value:b,tickIndex:g}}),p){var O=jn.makeAxisEventDataBase(r);O.targetType="axisLabel",O.value=b,O.tickIndex=g,a.type==="category"&&(O.dataIndex=v),We(R).eventData=O}e.add(R),R.updateTransform(),h.push(R),t.add(R),R.decomposeTransform()}),h}}function yL(t,e){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return _L(r,t,e),r.seriesInvolved&&xL(r,t),r}function _L(t,e,r){var n=e.getComponent("tooltip"),a=e.getComponent("axisPointer"),i=a.get("link",!0)||[],o=[];I(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=os(s.model),c=t.coordSysAxesInfo[l]={};t.coordSysMap[l]=s;var u=s.model,f=u.getModel("tooltip",n);if(I(s.getAxes(),dt(m,!1,null)),s.getTooltipAxes&&n&&f.get("show")){var h=f.get("trigger")==="axis",d=f.get(["axisPointer","type"])==="cross",p=s.getTooltipAxes(f.get(["axisPointer","axis"]));(h||d)&&I(p.baseAxes,dt(m,d?"cross":!0,h)),d&&I(p.otherAxes,dt(m,"cross",!1))}function m(g,v,y){var b=y.model.getModel("axisPointer",a),x=b.get("show");if(!(!x||x==="auto"&&!g&&!Kh(b))){v==null&&(v=b.get("triggerTooltip")),b=g?bL(y,f,a,e,g,v):b;var w=b.get("snap"),S=b.get("triggerEmphasis"),k=os(y.model),C=v||w||y.type==="category",A=t.axesInfo[k]={key:k,axis:y,coordSys:s,axisPointerModel:b,triggerTooltip:v,triggerEmphasis:S,involveSeries:C,snap:w,useHandle:Kh(b),seriesModels:[],linkGroup:null};c[k]=A,t.seriesInvolved=t.seriesInvolved||C;var M=wL(i,y);if(M!=null){var T=o[M]||(o[M]={axesInfo:{}});T.axesInfo[k]=A,T.mapper=i[M].mapper,A.linkGroup=T}}}})}function bL(t,e,r,n,a,i){var o=e.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};I(s,function(h){l[h]=Ie(o.get(h))}),l.snap=t.type!=="category"&&!!i,o.get("type")==="cross"&&(l.type="line");var c=l.label||(l.label={});if(c.show==null&&(c.show=!1),a==="cross"){var u=o.get(["label","show"]);if(c.show=u??!0,!i){var f=l.lineStyle=o.get("crossStyle");f&&He(c,f.textStyle)}}return t.model.getModel("axisPointer",new lt(l,r,n))}function xL(t,e){e.eachSeries(function(r){var n=r.coordinateSystem,a=r.get(["tooltip","trigger"],!0),i=r.get(["tooltip","show"],!0);!n||a==="none"||a===!1||a==="item"||i===!1||r.get(["axisPointer","show"],!0)===!1||I(t.coordSysAxesInfo[os(n.model)],function(o){var s=o.axis;n.getAxis(s.dim)===s&&(o.seriesModels.push(r),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=r.getData().count())})})}function wL(t,e){for(var r=e.model,n=e.dim,a=0;a<t.length;a++){var i=t[a]||{};if(Xh(i[n+"AxisId"],r.id)||Xh(i[n+"AxisIndex"],r.componentIndex)||Xh(i[n+"AxisName"],r.name))return a}}function Xh(t,e){return t==="all"||ee(t)&&Ue(t,e)>=0||t===e}function SL(t){var e=Zh(t);if(e){var r=e.axisPointerModel,n=e.axis.scale,a=r.option,i=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=Kh(r);i==null&&(a.status=s?"show":"hide");var l=n.getExtent().slice();l[0]>l[1]&&l.reverse(),(o==null||o>l[1])&&(o=l[1]),o<l[0]&&(o=l[0]),a.value=o,s&&(a.status=e.axis.scale.isBlank()?"hide":"show")}}function Zh(t){var e=(t.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[os(t)]}function kL(t){var e=Zh(t);return e&&e.axisPointerModel}function Kh(t){return!!t.get(["handle","show"])}function os(t){return t.type+"||"+t.id}var Ub={},Gb=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.render=function(r,n,a,i){this.axisPointerClass&&SL(r),t.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(r,a,!0)},e.prototype.updateAxisPointer=function(r,n,a,i){this._doUpdateAxisPointerClass(r,a,!1)},e.prototype.remove=function(r,n){var a=this._axisPointer;a&&a.remove(n)},e.prototype.dispose=function(r,n){this._disposeAxisPointer(n),t.prototype.dispose.apply(this,arguments)},e.prototype._doUpdateAxisPointerClass=function(r,n,a){var i=e.getAxisPointerClass(this.axisPointerClass);if(i){var o=kL(r);o?(this._axisPointer||(this._axisPointer=new i)).render(r,o,n,a):this._disposeAxisPointer(n)}},e.prototype._disposeAxisPointer=function(r){this._axisPointer&&this._axisPointer.dispose(r),this._axisPointer=null},e.registerAxisPointerClass=function(r,n){Ub[r]=n},e.getAxisPointerClass=function(r){return r&&Ub[r]},e.type="axis",e})(Nr),jh=ht();function TL(t,e,r,n){var a=r.axis;if(!a.scale.isBlank()){var i=r.getModel("splitArea"),o=i.getModel("areaStyle"),s=o.get("color"),l=n.coordinateSystem.getRect(),c=a.getTicksCoords({tickModel:i,clamp:!0});if(c.length){var u=s.length,f=jh(t).splitAreaColors,h=me(),d=0;if(f)for(var p=0;p<c.length;p++){var m=f.get(c[p].tickValue);if(m!=null){d=(m+(u-1)*p)%u;break}}var g=a.toGlobalCoord(c[0].coord),v=o.getAreaStyle();s=ee(s)?s:[s];for(var p=1;p<c.length;p++){var y=a.toGlobalCoord(c[p].coord),b=void 0,x=void 0,w=void 0,S=void 0;a.isHorizontal()?(b=g,x=l.y,w=y-b,S=l.height,g=b+w):(b=l.x,x=g,w=l.width,S=y-x,g=x+S);var k=c[p-1].tickValue;k!=null&&h.set(k,d),e.add(new _t({anid:k!=null?"area_"+k:null,shape:{x:b,y:x,width:w,height:S},style:He({fill:s[d]},v),autoBatch:!0,silent:!0})),d=(d+1)%u}jh(t).splitAreaColors=h}}}function CL(t){jh(t).splitAreaColors=null}var ML=["axisLine","axisTickLabel","axisName"],AL=["splitArea","splitLine","minorSplitLine"],$b=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.axisPointerClass="CartesianAxisPointer",r}return e.prototype.render=function(r,n,a,i){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new St,this.group.add(this._axisGroup),!!r.get("show")){var s=r.getCoordSysModel(),l=Wh(s,r),c=new jn(r,q({handleAutoShown:function(f){for(var h=s.coordinateSystem.getCartesians(),d=0;d<h.length;d++)if(zh(h[d].getOtherAxis(r.axis).scale))return!0;return!1}},l));I(ML,c.add,c),this._axisGroup.add(c.getGroup()),I(AL,function(f){r.get([f,"show"])&&DL[f](this,this._axisGroup,r,s)},this);var u=i&&i.type==="changeAxisOrder"&&i.isInitSort;u||bm(o,this._axisGroup,r),t.prototype.render.call(this,r,n,a,i)}},e.prototype.remove=function(){CL(this)},e.type="cartesianAxis",e})(Gb),DL={splitLine:function(t,e,r,n){var a=r.axis;if(!a.scale.isBlank()){var i=r.getModel("splitLine"),o=i.getModel("lineStyle"),s=o.get("color"),l=i.get("showMinLine")!==!1,c=i.get("showMaxLine")!==!1;s=ee(s)?s:[s];for(var u=n.coordinateSystem.getRect(),f=a.isHorizontal(),h=0,d=a.getTicksCoords({tickModel:i}),p=[],m=[],g=o.getLineStyle(),v=0;v<d.length;v++){var y=a.toGlobalCoord(d[v].coord);if(!(v===0&&!l||v===d.length-1&&!c)){var b=d[v].tickValue;f?(p[0]=y,p[1]=u.y,m[0]=y,m[1]=u.y+u.height):(p[0]=u.x,p[1]=y,m[0]=u.x+u.width,m[1]=y);var x=h++%s.length,w=new Hn({anid:b!=null?"line_"+b:null,autoBatch:!0,shape:{x1:p[0],y1:p[1],x2:m[0],y2:m[1]},style:He({stroke:s[x]},g),silent:!0});Lo(w.shape,g.lineWidth),e.add(w)}}}},minorSplitLine:function(t,e,r,n){var a=r.axis,i=r.getModel("minorSplitLine"),o=i.getModel("lineStyle"),s=n.coordinateSystem.getRect(),l=a.isHorizontal(),c=a.getMinorTicksCoords();if(c.length)for(var u=[],f=[],h=o.getLineStyle(),d=0;d<c.length;d++)for(var p=0;p<c[d].length;p++){var m=a.toGlobalCoord(c[d][p].coord);l?(u[0]=m,u[1]=s.y,f[0]=m,f[1]=s.y+s.height):(u[0]=s.x,u[1]=m,f[0]=s.x+s.width,f[1]=m);var g=new Hn({anid:"minor_line_"+c[d][p].tickValue,autoBatch:!0,shape:{x1:u[0],y1:u[1],x2:f[0],y2:f[1]},style:h,silent:!0});Lo(g.shape,h.lineWidth),e.add(g)}},splitArea:function(t,e,r,n){TL(t,e,r,n)}},Wb=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="xAxis",e})($b),IL=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Wb.type,r}return e.type="yAxis",e})($b),LL=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="grid",r}return e.prototype.render=function(r,n){this.group.removeAll(),r.get("show")&&this.group.add(new _t({shape:r.coordinateSystem.getRect(),style:He({fill:r.get("backgroundColor")},r.getItemStyle()),silent:!0,z2:-1}))},e.type="grid",e})(Nr),qb={offset:0};function PL(t){t.registerComponentView(LL),t.registerComponentModel(bI),t.registerCoordinateSystem("cartesian2d",fL),fb(t,"x",Oh,qb),fb(t,"y",Oh,qb),t.registerComponentView(Wb),t.registerComponentView(IL),t.registerPreprocessor(function(e){e.xAxis&&e.yAxis&&!e.grid&&(e.grid={})})}var Yb="\0_ec_interaction_mutex";function Xb(t,e){return!!RL(t)[e]}function RL(t){return t[Yb]||(t[Yb]={})}Fa({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},Et);var EL=(function(t){K(e,t);function e(r){var n=t.call(this)||this;n._zr=r;var a=Ne(n._mousedownHandler,n),i=Ne(n._mousemoveHandler,n),o=Ne(n._mouseupHandler,n),s=Ne(n._mousewheelHandler,n),l=Ne(n._pinchHandler,n);return n.enable=function(c,u){this.disable(),this._opt=He(Ie(u)||{},{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),c==null&&(c=!0),(c===!0||c==="move"||c==="pan")&&(r.on("mousedown",a),r.on("mousemove",i),r.on("mouseup",o)),(c===!0||c==="scale"||c==="zoom")&&(r.on("mousewheel",s),r.on("pinch",l))},n.disable=function(){r.off("mousedown",a),r.off("mousemove",i),r.off("mouseup",o),r.off("mousewheel",s),r.off("pinch",l)},n}return e.prototype.isDragging=function(){return this._dragging},e.prototype.isPinching=function(){return this._pinching},e.prototype.setPointerChecker=function(r){this.pointerChecker=r},e.prototype.dispose=function(){this.disable()},e.prototype._mousedownHandler=function(r){if(!D0(r)){for(var n=r.target;n;){if(n.draggable)return;n=n.__hostTarget||n.parent}var a=r.offsetX,i=r.offsetY;this.pointerChecker&&this.pointerChecker(r,a,i)&&(this._x=a,this._y=i,this._dragging=!0)}},e.prototype._mousemoveHandler=function(r){if(!(!this._dragging||!Yc("moveOnMouseMove",r,this._opt)||r.gestureEvent==="pinch"||Xb(this._zr,"globalPan"))){var n=r.offsetX,a=r.offsetY,i=this._x,o=this._y,s=n-i,l=a-o;this._x=n,this._y=a,this._opt.preventDefaultMouseMove&&wc(r.event),Zb(this,"pan","moveOnMouseMove",r,{dx:s,dy:l,oldX:i,oldY:o,newX:n,newY:a,isAvailableBehavior:null})}},e.prototype._mouseupHandler=function(r){D0(r)||(this._dragging=!1)},e.prototype._mousewheelHandler=function(r){var n=Yc("zoomOnMouseWheel",r,this._opt),a=Yc("moveOnMouseWheel",r,this._opt),i=r.wheelDelta,o=Math.abs(i),s=r.offsetX,l=r.offsetY;if(!(i===0||!n&&!a)){if(n){var c=o>3?1.4:o>1?1.2:1.1,u=i>0?c:1/c;Jh(this,"zoom","zoomOnMouseWheel",r,{scale:u,originX:s,originY:l,isAvailableBehavior:null})}if(a){var f=Math.abs(i),h=(i>0?1:-1)*(f>3?.4:f>1?.15:.05);Jh(this,"scrollMove","moveOnMouseWheel",r,{scrollDelta:h,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(r){if(!Xb(this._zr,"globalPan")){var n=r.pinchScale>1?1.1:1/1.1;Jh(this,"zoom",null,r,{scale:n,originX:r.pinchX,originY:r.pinchY,isAvailableBehavior:null})}},e})(Ir);function Jh(t,e,r,n,a){t.pointerChecker&&t.pointerChecker(n,a.originX,a.originY)&&(wc(n.event),Zb(t,e,r,n,a))}function Zb(t,e,r,n,a){a.isAvailableBehavior=Ne(Yc,null,r,n),t.trigger(e,a)}function Yc(t,e,r){var n=r[t];return!t||n&&(!ae(n)||e.event[n+"Key"])}function Qh(t,e,r,n,a,i){t=t||0;var o=r[1]-r[0];if(a!=null&&(a=Vi(a,[0,o])),i!=null&&(i=Math.max(i,a??0)),n==="all"){var s=Math.abs(e[1]-e[0]);s=Vi(s,[0,o]),a=i=Vi(s,[a,i]),n=0}e[0]=Vi(e[0],r),e[1]=Vi(e[1],r);var l=ep(e,n);e[n]+=t;var c=a||0,u=r.slice();l.sign<0?u[0]+=c:u[1]-=c,e[n]=Vi(e[n],u);var f;return f=ep(e,n),a!=null&&(f.sign!==l.sign||f.span<a)&&(e[1-n]=e[n]+l.sign*a),f=ep(e,n),i!=null&&f.span>i&&(e[1-n]=e[n]+f.sign*i),e}function ep(t,e){var r=t[e]-t[1-e];return{span:Math.abs(r),sign:r>0?-1:r<0?1:e?-1:1}}function Vi(t,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,t))}var Ua=ht(),Kb=Ie,tp=Ne,OL=(function(){function t(){this._dragging=!1,this.animationThreshold=15}return t.prototype.render=function(e,r,n,a){var i=r.get("value"),o=r.get("status");if(this._axisModel=e,this._axisPointerModel=r,this._api=n,!(!a&&this._lastValue===i&&this._lastStatus===o)){this._lastValue=i,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var c={};this.makeElOption(c,i,e,r,n);var u=c.graphicKey;u!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=u;var f=this._moveAnimation=this.determineAnimation(e,r);if(!s)s=this._group=new St,this.createPointerEl(s,c,e,r),this.createLabelEl(s,c,e,r),n.getZr().add(s);else{var h=dt(jb,r,f);this.updatePointerEl(s,c,h),this.updateLabelEl(s,c,h,r)}ex(s,r,!0),this._renderHandle(i)}},t.prototype.remove=function(e){this.clear(e)},t.prototype.dispose=function(e){this.clear(e)},t.prototype.determineAnimation=function(e,r){var n=r.get("animation"),a=e.axis,i=a.type==="category",o=r.get("snap");if(!o&&!i)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(i&&a.getBandWidth()>s)return!0;if(o){var l=Zh(e).seriesDataCount,c=a.getExtent();return Math.abs(c[0]-c[1])/l>s}return!1}return n===!0},t.prototype.makeElOption=function(e,r,n,a,i){},t.prototype.createPointerEl=function(e,r,n,a){var i=r.pointer;if(i){var o=Ua(e).pointerEl=new eT[i.type](Kb(r.pointer));e.add(o)}},t.prototype.createLabelEl=function(e,r,n,a){if(r.label){var i=Ua(e).labelEl=new $t(Kb(r.label));e.add(i),Qb(i,a)}},t.prototype.updatePointerEl=function(e,r,n){var a=Ua(e).pointerEl;a&&r.pointer&&(a.setStyle(r.pointer.style),n(a,{shape:r.pointer.shape}))},t.prototype.updateLabelEl=function(e,r,n,a){var i=Ua(e).labelEl;i&&(i.setStyle(r.label.style),n(i,{x:r.label.x,y:r.label.y}),Qb(i,a))},t.prototype._renderHandle=function(e){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),a=this._handle,i=r.getModel("handle"),o=r.get("status");if(!i.get("show")||!o||o==="hide"){a&&n.remove(a),this._handle=null;return}var s;this._handle||(s=!0,a=this._handle=rd(i.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(c){wc(c.event)},onmousedown:tp(this._onHandleDragMove,this,0,0),drift:tp(this._onHandleDragMove,this),ondragend:tp(this._onHandleDragEnd,this)}),n.add(a)),ex(a,r,!1),a.setStyle(i.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=i.get("size");ee(l)||(l=[l,l]),a.scaleX=l[0]/2,a.scaleY=l[1]/2,Xd(this,"_doDispatchAxisPointer",i.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},t.prototype._moveHandleToValue=function(e,r){jb(this._axisPointerModel,!r&&this._moveAnimation,this._handle,rp(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(e,r){var n=this._handle;if(n){this._dragging=!0;var a=this.updateHandleTransform(rp(n),[e,r],this._axisModel,this._axisPointerModel);this._payloadInfo=a,n.stopAnimation(),n.attr(rp(a)),Ua(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){var e=this._handle;if(e){var r=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){this._dragging=!1;var e=this._handle;if(e){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var r=e.getZr(),n=this._group,a=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),a&&r.remove(a),this._group=null,this._handle=null,this._payloadInfo=null),Zd(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(e,r,n){return n=n||0,{x:e[n],y:e[1-n],width:r[n],height:r[1-n]}},t})();function jb(t,e,r,n){Jb(Ua(r).lastProp,n)||(Ua(r).lastProp=n,e?or(r,n,t):(r.stopAnimation(),r.attr(n)))}function Jb(t,e){if(de(t)&&de(e)){var r=!0;return I(e,function(n,a){r=r&&Jb(t[a],n)}),!!r}else return t===e}function Qb(t,e){t[e.get(["label","show"])?"show":"hide"]()}function rp(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function ex(t,e,r){var n=e.get("z"),a=e.get("zlevel");t&&t.traverse(function(i){i.type!=="group"&&(n!=null&&(i.z=n),a!=null&&(i.zlevel=a),i.silent=r)})}function NL(t){var e=t.get("type"),r=t.getModel(e+"Style"),n;return e==="line"?(n=r.getLineStyle(),n.fill=null):e==="shadow"&&(n=r.getAreaStyle(),n.stroke=null),n}function BL(t,e,r,n,a){var i=r.get("value"),o=tx(i,e.axis,e.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=fc(s.get("padding")||0),c=s.getFont(),u=$u(o,c),f=a.position,h=u.width+l[1]+l[3],d=u.height+l[0]+l[2],p=a.align;p==="right"&&(f[0]-=h),p==="center"&&(f[0]-=h/2);var m=a.verticalAlign;m==="bottom"&&(f[1]-=d),m==="middle"&&(f[1]-=d/2),zL(f,h,d,n);var g=s.get("backgroundColor");(!g||g==="auto")&&(g=e.get(["axisLine","lineStyle","color"])),t.label={x:f[0],y:f[1],style:wi(s,{text:o,font:c,fill:s.getTextColor(),padding:l,backgroundColor:g}),z2:10}}function zL(t,e,r,n){var a=n.getWidth(),i=n.getHeight();t[0]=Math.min(t[0]+e,a)-e,t[1]=Math.min(t[1]+r,i)-r,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}function tx(t,e,r,n,a){t=e.scale.parse(t);var i=e.scale.getLabel({value:t},{precision:a.precision}),o=a.formatter;if(o){var s={value:Uh(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};I(n,function(l){var c=r.getSeriesByIndex(l.seriesIndex),u=l.dataIndexInside,f=c&&c.getDataParams(u);f&&s.seriesData.push(f)}),ae(o)?i=o.replace("{value}",i):ke(o)&&(i=o(s))}return i}function rx(t,e,r){var n=ai();return Uu(n,n,r.rotation),Vu(n,n,r.position),td([t.dataToCoord(e),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function FL(t,e,r,n,a,i){var o=jn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=a.get(["label","margin"]),BL(e,n,a,i,{position:rx(n.axis,t,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function HL(t,e,r){return r=r||0,{x1:t[r],y1:t[1-r],x2:e[r],y2:e[1-r]}}function VL(t,e,r){return r=r||0,{x:t[r],y:t[1-r],width:e[r],height:e[1-r]}}var UL=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.grid,c=i.get("type"),u=nx(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(n,!0));if(c&&c!=="none"){var h=NL(i),d=GL[c](s,f,u);d.style=h,r.graphicKey=d.type,r.pointer=d}var p=Wh(l.model,a);FL(n,r,p,a,i,o)},e.prototype.getHandleTransform=function(r,n,a){var i=Wh(n.axis.grid.model,n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=rx(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.grid,l=o.getGlobalExtent(!0),c=nx(s,o).getOtherAxis(o).getGlobalExtent(),u=o.dim==="x"?0:1,f=[r.x,r.y];f[u]+=n[u],f[u]=Math.min(l[1],f[u]),f[u]=Math.max(l[0],f[u]);var h=(c[1]+c[0])/2,d=[h,h];d[u]=f[u];var p=[{verticalAlign:"middle"},{align:"center"}];return{x:f[0],y:f[1],rotation:r.rotation,cursorPoint:d,tooltipOption:p[u]}},e})(OL);function nx(t,e){var r={};return r[e.dim+"AxisIndex"]=e.index,t.getCartesian(r)}var GL={line:function(t,e,r){var n=HL([e,r[0]],[e,r[1]],ax(t));return{type:"Line",subPixelOptimize:!0,shape:n}},shadow:function(t,e,r){var n=Math.max(1,t.getBandWidth()),a=r[1]-r[0];return{type:"Rect",shape:VL([e-n/2,r[0]],[n,a],ax(t))}}};function ax(t){return t.dim==="x"?0:1}var $L=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e})(Ye),kn=ht(),WL=I;function ix(t,e,r){if(!_e.node){var n=e.getZr();kn(n).records||(kn(n).records={}),qL(n,e);var a=kn(n).records[t]||(kn(n).records[t]={});a.handler=r}}function qL(t,e){if(kn(t).initialized)return;kn(t).initialized=!0,r("click",dt(ox,"click")),r("mousemove",dt(ox,"mousemove")),r("globalout",XL);function r(n,a){t.on(n,function(i){var o=ZL(e);WL(kn(t).records,function(s){s&&a(s,i,o.dispatchAction)}),YL(o.pendings,e)})}}function YL(t,e){var r=t.showTip.length,n=t.hideTip.length,a;r?a=t.showTip[r-1]:n&&(a=t.hideTip[n-1]),a&&(a.dispatchAction=null,e.dispatchAction(a))}function XL(t,e,r){t.handler("leave",null,r)}function ox(t,e,r,n){e.handler(t,r,n)}function ZL(t){var e={showTip:[],hideTip:[]},r=function(n){var a=e[n.type];a?a.push(n):(n.dispatchAction=r,t.dispatchAction(n))};return{dispatchAction:r,pendings:e}}function np(t,e){if(!_e.node){var r=e.getZr(),n=(kn(r).records||{})[t];n&&(kn(r).records[t]=null)}}var KL=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.render=function(r,n,a){var i=n.getComponent("tooltip"),o=r.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";ix("axisPointer",a,function(s,l,c){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&c({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},e.prototype.remove=function(r,n){np("axisPointer",n)},e.prototype.dispose=function(r,n){np("axisPointer",n)},e.type="axisPointer",e})(Nr);function sx(t,e){var r=[],n=t.seriesIndex,a;if(n==null||!(a=e.getSeriesByIndex(n)))return{point:[]};var i=a.getData(),o=Ma(i,t);if(o==null||o<0||ee(o))return{point:[]};var s=i.getItemGraphicEl(o),l=a.coordinateSystem;if(a.getTooltipPosition)r=a.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(t.isStacked){var c=l.getBaseAxis(),u=l.getOtherAxis(c),f=u.dim,h=c.dim,d=f==="x"||f==="radius"?1:0,p=i.mapDimension(h),m=[];m[d]=i.get(p,o),m[1-d]=i.get(i.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(i.getValues(he(l.dimensions,function(v){return i.mapDimension(v)}),o))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),r=[g.x+g.width/2,g.y+g.height/2]}return{point:r,el:s}}var lx=ht();function jL(t,e,r){var n=t.currTrigger,a=[t.x,t.y],i=t,o=t.dispatchAction||Ne(r.dispatchAction,r),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){Xc(a)&&(a=sx({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},e).point);var l=Xc(a),c=i.axesInfo,u=s.axesInfo,f=n==="leave"||Xc(a),h={},d={},p={list:[],map:{}},m={showPointer:dt(QL,d),showTooltip:dt(eP,p)};I(s.coordSysMap,function(v,y){var b=l||v.containPoint(a);I(s.coordSysAxesInfo[y],function(x,w){var S=x.axis,k=aP(c,x);if(!f&&b&&(!c||k)){var C=k&&k.value;C==null&&!l&&(C=S.pointToData(a)),C!=null&&cx(x,C,m,!1,h)}})});var g={};return I(u,function(v,y){var b=v.linkGroup;b&&!d[y]&&I(b.axesInfo,function(x,w){var S=d[w];if(x!==v&&S){var k=S.value;b.mapper&&(k=v.axis.scale.parse(b.mapper(k,ux(x),ux(v)))),g[v.key]=k}})}),I(g,function(v,y){cx(u[y],v,m,!0,h)}),tP(d,u,h),rP(p,a,t,o),nP(u,o,r),h}}function cx(t,e,r,n,a){var i=t.axis;if(!(i.scale.isBlank()||!i.containData(e))){if(!t.involveSeries){r.showPointer(t,e);return}var o=JL(e,t),s=o.payloadBatch,l=o.snapToValue;s[0]&&a.seriesIndex==null&&q(a,s[0]),!n&&t.snap&&i.containData(l)&&l!=null&&(e=l),r.showPointer(t,e,s),r.showTooltip(t,o,l)}}function JL(t,e){var r=e.axis,n=r.dim,a=t,i=[],o=Number.MAX_VALUE,s=-1;return I(e.seriesModels,function(l,c){var u=l.getData().mapDimensionsAll(n),f,h;if(l.getAxisTooltipData){var d=l.getAxisTooltipData(u,t,r);h=d.dataIndices,f=d.nestestValue}else{if(h=l.getData().indicesOfNearest(u[0],t,r.type==="category"?.5:null),!h.length)return;f=l.getData().get(u[0],h[0])}if(!(f==null||!isFinite(f))){var p=t-f,m=Math.abs(p);m<=o&&((m<o||p>=0&&s<0)&&(o=m,s=p,a=f,i.length=0),I(h,function(g){i.push({seriesIndex:l.seriesIndex,dataIndexInside:g,dataIndex:l.getData().getRawIndex(g)})}))}}),{payloadBatch:i,snapToValue:a}}function QL(t,e,r,n){t[e.key]={value:r,payloadBatch:n}}function eP(t,e,r,n){var a=r.payloadBatch,i=e.axis,o=i.model,s=e.axisPointerModel;if(!(!e.triggerTooltip||!a.length)){var l=e.coordSys.model,c=os(l),u=t.map[c];u||(u=t.map[c]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(u)),u.dataByAxis.push({axisDim:i.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function tP(t,e,r){var n=r.axesInfo=[];I(e,function(a,i){var o=a.axisPointerModel.option,s=t[i];s?(!a.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!a.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:a.axis.dim,axisIndex:a.axis.model.componentIndex,value:o.value})})}function rP(t,e,r,n){if(Xc(e)||!t.list.length){n({type:"hideTip"});return}var a=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:t.list})}function nP(t,e,r){var n=r.getZr(),a="axisPointerLastHighlights",i=lx(n)[a]||{},o=lx(n)[a]={};I(t,function(c,u){var f=c.axisPointerModel.option;f.status==="show"&&c.triggerEmphasis&&I(f.seriesDataIndices,function(h){var d=h.seriesIndex+" | "+h.dataIndex;o[d]=h})});var s=[],l=[];I(i,function(c,u){!o[u]&&l.push(c)}),I(o,function(c,u){!i[u]&&s.push(c)}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function aP(t,e){for(var r=0;r<(t||[]).length;r++){var n=t[r];if(e.axis.dim===n.axisDim&&e.axis.model.componentIndex===n.axisIndex)return n}}function ux(t){var e=t.axis.model,r={},n=r.axisDim=t.axis.dim;return r.axisIndex=r[n+"AxisIndex"]=e.componentIndex,r.axisName=r[n+"AxisName"]=e.name,r.axisId=r[n+"AxisId"]=e.id,r}function Xc(t){return!t||t[0]==null||isNaN(t[0])||t[1]==null||isNaN(t[1])}function fx(t){Gb.registerAxisPointerClass("CartesianAxisPointer",UL),t.registerComponentModel($L),t.registerComponentView(KL),t.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var r=e.axisPointer.link;r&&!ee(r)&&(e.axisPointer.link=[r])}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,function(e,r){e.getComponent("axisPointer").coordSysAxesInfo=yL(e,r)}),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},jL)}function iP(t){Zn(PL),Zn(fx)}var dx=["x","y","radius","angle","single"],oP=["cartesian2d","polar","singleAxis"];function sP(t){var e=t.get("coordinateSystem");return Ue(oP,e)>=0}function Ga(t){return t+"Axis"}function lP(t,e){var r=me(),n=[],a=me();t.eachComponent({mainType:"dataZoom",query:e},function(u){a.get(u.uid)||s(u)});var i;do i=!1,t.eachComponent("dataZoom",o);while(i);function o(u){!a.get(u.uid)&&l(u)&&(s(u),i=!0)}function s(u){a.set(u.uid,!0),n.push(u),c(u)}function l(u){var f=!1;return u.eachTargetAxis(function(h,d){var p=r.get(h);p&&p[d]&&(f=!0)}),f}function c(u){u.eachTargetAxis(function(f,h){(r.get(f)||r.set(f,[]))[h]=!0})}return n}function cP(t){var e=t.ecModel,r={infoList:[],infoMap:me()};return t.eachTargetAxis(function(n,a){var i=e.getComponent(Ga(n),a);if(i){var o=i.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(i)}}}),r}var ap=(function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},t})(),hx=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return e.prototype.init=function(r,n,a){var i=px(r);this.settledOption=i,this.mergeDefaultAndTheme(r,a),this._doInit(i)},e.prototype.mergeOption=function(r){var n=px(r);Oe(this.option,r,!0),Oe(this.settledOption,n,!0),this._doInit(n)},e.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var a=this.settledOption;I([["start","startValue"],["end","endValue"]],function(i,o){this._rangePropMode[o]==="value"&&(n[i[0]]=a[i[0]]=null)},this),this._resetTarget()},e.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=me(),a=this._fillSpecifiedTargetAxis(n);a?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(i){i.indexList.length&&(this._noTarget=!1)},this)},e.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return I(dx,function(a){var i=this.getReferringComponents(Ga(a),Fk);if(i.specified){n=!0;var o=new ap;I(i.models,function(s){o.add(s.componentIndex)}),r.set(a,o)}},this),n},e.prototype._fillAutoTargetAxisByOrient=function(r,n){var a=this.ecModel,i=!0;if(i){var o=n==="vertical"?"y":"x",s=a.findComponents({mainType:o+"Axis"});l(s,o)}if(i){var s=a.findComponents({mainType:"singleAxis",filter:function(u){return u.get("orient",!0)===n}});l(s,"single")}function l(c,u){var f=c[0];if(f){var h=new ap;if(h.add(f.componentIndex),r.set(u,h),i=!1,u==="x"||u==="y"){var d=f.getReferringComponents("grid",qt).models[0];d&&I(c,function(p){f.componentIndex!==p.componentIndex&&d===p.getReferringComponents("grid",qt).models[0]&&h.add(p.componentIndex)})}}}i&&I(dx,function(c){if(i){var u=a.findComponents({mainType:Ga(c),filter:function(h){return h.get("type",!0)==="category"}});if(u[0]){var f=new ap;f.add(u[0].componentIndex),r.set(c,f),i=!1}}},this)},e.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(n){!r&&(r=n)},this),r==="y"?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var n=this.ecModel.option;this.option.throttle=n.animation&&n.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(r){var n=this._rangePropMode,a=this.get("rangeMode");I([["start","startValue"],["end","endValue"]],function(i,o){var s=r[i[0]]!=null,l=r[i[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":a?n[o]=a[o]:s&&(n[o]="percent")})},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,a){r==null&&(r=this.ecModel.getComponent(Ga(n),a))},this),r},e.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(a,i){I(a.indexList,function(o){r.call(n,i,o)})})},e.prototype.getAxisProxy=function(r,n){var a=this.getAxisModel(r,n);if(a)return a.__dzAxisProxy},e.prototype.getAxisModel=function(r,n){var a=this._targetAxisInfoMap.get(r);if(a&&a.indexMap[n])return this.ecModel.getComponent(Ga(r),n)},e.prototype.setRawRange=function(r){var n=this.option,a=this.settledOption;I([["start","startValue"],["end","endValue"]],function(i){(r[i[0]]!=null||r[i[1]]!=null)&&(n[i[0]]=a[i[0]]=r[i[0]],n[i[1]]=a[i[1]]=r[i[1]])},this),this._updateRangeUse(r)},e.prototype.setCalculatedRange=function(r){var n=this.option;I(["start","startValue","end","endValue"],function(a){n[a]=r[a]})},e.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getDataPercentWindow()},e.prototype.getValueRange=function(r,n){if(r==null&&n==null){var a=this.findRepresentativeAxisProxy();if(a)return a.getDataValueWindow()}else return this.getAxisProxy(r,n).getDataValueWindow()},e.prototype.findRepresentativeAxisProxy=function(r){if(r)return r.__dzAxisProxy;for(var n,a=this._targetAxisInfoMap.keys(),i=0;i<a.length;i++)for(var o=a[i],s=this._targetAxisInfoMap.get(o),l=0;l<s.indexList.length;l++){var c=this.getAxisProxy(o,s.indexList[l]);if(c.hostedBy(this))return c;n||(n=c)}return n},e.prototype.getRangePropMode=function(){return this._rangePropMode.slice()},e.prototype.getOrient=function(){return this._orient},e.type="dataZoom",e.dependencies=["xAxis","yAxis","radiusAxis","angleAxis","singleAxis","series","toolbox"],e.defaultOption={z:4,filterMode:"filter",start:0,end:100},e})(Ye);function px(t){var e={};return I(["start","end","startValue","endValue","throttle"],function(r){t.hasOwnProperty(r)&&(e[r]=t[r])}),e}var uP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.render=function(r,n,a,i){this.dataZoomModel=r,this.ecModel=n,this.api=a},e.type="dataZoom",e})(Nr),Ui=I,vx=xk,fP=(function(){function t(e,r,n,a){this._dimName=e,this._axisIndex=r,this.ecModel=a,this._dataZoomModel=n}return t.prototype.hostedBy=function(e){return this._dataZoomModel===e},t.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},t.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},t.prototype.getTargetSeriesModels=function(){var e=[];return this.ecModel.eachSeries(function(r){if(sP(r)){var n=Ga(this._dimName),a=r.getReferringComponents(n,qt).models[0];a&&this._axisIndex===a.componentIndex&&e.push(r)}},this),e},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return Ie(this._minMaxSpan)},t.prototype.calculateDataWindow=function(e){var r=this._dataExtent,n=this.getAxisModel(),a=n.axis.scale,i=this._dataZoomModel.getRangePropMode(),o=[0,100],s=[],l=[],c;Ui(["start","end"],function(h,d){var p=e[h],m=e[h+"Value"];i[d]==="percent"?(p==null&&(p=o[d]),m=a.parse(Ca(p,o,r))):(c=!0,m=m==null?r[d]:a.parse(m),p=Ca(m,r,o)),l[d]=m==null||isNaN(m)?r[d]:m,s[d]=p==null||isNaN(p)?o[d]:p}),vx(l),vx(s);var u=this._minMaxSpan;c?f(l,s,r,o,!1):f(s,l,o,r,!0);function f(h,d,p,m,g){var v=g?"Span":"ValueSpan";Qh(0,h,p,"all",u["min"+v],u["max"+v]);for(var y=0;y<2;y++)d[y]=Ca(h[y],p,m,!0),g&&(d[y]=a.parse(d[y]))}return{valueWindow:l,percentWindow:s}},t.prototype.reset=function(e){if(e===this._dataZoomModel){var r=this.getTargetSeriesModels();this._dataExtent=dP(this,this._dimName,r),this._updateMinMaxSpan();var n=this.calculateDataWindow(e.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(e,r){if(e!==this._dataZoomModel)return;var n=this._dimName,a=this.getTargetSeriesModels(),i=e.get("filterMode"),o=this._valueWindow;if(i==="none")return;Ui(a,function(l){var c=l.getData(),u=c.mapDimensionsAll(n);if(u.length){if(i==="weakFilter"){var f=c.getStore(),h=he(u,function(d){return c.getDimensionIndex(d)},c);c.filterSelf(function(d){for(var p,m,g,v=0;v<u.length;v++){var y=f.get(h[v],d),b=!isNaN(y),x=y<o[0],w=y>o[1];if(b&&!x&&!w)return!0;b&&(g=!0),x&&(p=!0),w&&(m=!0)}return g&&p&&m})}else Ui(u,function(d){if(i==="empty")l.setData(c=c.map(d,function(m){return s(m)?m:NaN}));else{var p={};p[d]=o,c.selectRange(p)}});Ui(u,function(d){c.setApproximateExtent(o,d)})}});function s(l){return l>=o[0]&&l<=o[1]}},t.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},r=this._dataZoomModel,n=this._dataExtent;Ui(["min","max"],function(a){var i=r.get(a+"Span"),o=r.get(a+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?i=Ca(n[0]+o,n,[0,100],!0):i!=null&&(o=Ca(i,[0,100],n,!0)-n[0]),e[a+"Span"]=i,e[a+"ValueSpan"]=o},this)},t.prototype._setAxisModel=function(){var e=this.getAxisModel(),r=this._percentWindow,n=this._valueWindow;if(r){var a=Sg(n,[0,500]);a=Math.min(a,20);var i=e.axis.scale.rawExtentInfo;r[0]!==0&&i.setDeterminedMinMax("min",+n[0].toFixed(a)),r[1]!==100&&i.setDeterminedMinMax("max",+n[1].toFixed(a)),i.freeze()}},t})();function dP(t,e,r){var n=[1/0,-1/0];Ui(r,function(o){KI(n,o.getData(),e)});var a=t.getAxisModel(),i=_b(a.axis.scale,a,n).calculate();return[i.min,i.max]}var hP={getTargetSeries:function(t){function e(a){t.eachComponent("dataZoom",function(i){i.eachTargetAxis(function(o,s){var l=t.getComponent(Ga(o),s);a(o,s,l,i)})})}e(function(a,i,o,s){o.__dzAxisProxy=null});var r=[];e(function(a,i,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new fP(a,i,s,t),r.push(o.__dzAxisProxy))});var n=me();return I(r,function(a){I(a.getTargetSeriesModels(),function(i){n.set(i.uid,i)})}),n},overallReset:function(t,e){t.eachComponent("dataZoom",function(r){r.eachTargetAxis(function(n,a){r.getAxisProxy(n,a).reset(r)}),r.eachTargetAxis(function(n,a){r.getAxisProxy(n,a).filterData(r,e)})}),t.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var a=n.getDataPercentWindow(),i=n.getDataValueWindow();r.setCalculatedRange({start:a[0],end:a[1],startValue:i[0],endValue:i[1]})}})}};function pP(t){t.registerAction("dataZoom",function(e,r){var n=lP(r,e);I(n,function(a){a.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var gx=!1;function vP(t){gx||(gx=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,hP),pP(t),t.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function gP(t,e){var r=fc(e.get("padding")),n=e.getItemStyle(["color","opacity"]);return n.fill=e.get("backgroundColor"),t=new _t({shape:{x:t.x-r[3],y:t.y-r[0],width:t.width+r[1]+r[3],height:t.height+r[0]+r[2],r:e.get("borderRadius")},style:n,silent:!0,z2:-1}),t}var mP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e})(Ye);function mx(t){var e=t.get("confine");return e!=null?!!e:t.get("renderMode")==="richText"}function yx(t){if(_e.domSupported){for(var e=document.documentElement.style,r=0,n=t.length;r<n;r++)if(t[r]in e)return t[r]}}var _x=yx(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),yP=yx(["webkitTransition","transition","OTransition","MozTransition","msTransition"]);function bx(t,e){if(!t)return e;e=ky(e,!0);var r=t.indexOf(e);return t=r===-1?e:"-"+t.slice(0,r)+"-"+e,t.toLowerCase()}function _P(t,e){var r=t.currentStyle||document.defaultView&&document.defaultView.getComputedStyle(t);return r?r[e]:null}var bP=bx(yP,"transition"),ip=bx(_x,"transform"),xP="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(_e.transform3dSupported?"will-change:transform;":"");function wP(t){return t=t==="left"?"right":t==="right"?"left":t==="top"?"bottom":"top",t}function SP(t,e,r){if(!ae(r)||r==="inside")return"";var n=t.get("backgroundColor"),a=t.get("borderWidth");e=Oa(e);var i=wP(r),o=Math.max(Math.round(a)*1.5,6),s="",l=ip+":",c;Ue(["left","right"],i)>-1?(s+="top:50%",l+="translateY(-50%) rotate("+(c=i==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(c=i==="top"?225:45)+"deg)");var u=c*Math.PI/180,f=o+a,h=f*Math.abs(Math.cos(u))+f*Math.abs(Math.sin(u)),d=Math.round(((h-Math.SQRT2*a)/2+Math.SQRT2*a-(h-f)/2)*100)/100;s+=";"+i+":-"+d+"px";var p=e+" solid "+a+"px;",m=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+p,"border-right:"+p,"background-color:"+n+";"];return'<div style="'+m.join("")+'"></div>'}function kP(t,e){var r="cubic-bezier(0.23,1,0.32,1)",n=" "+t/2+"s "+r,a="opacity"+n+",visibility"+n;return e||(n=" "+t+"s "+r,a+=_e.transformSupported?","+ip+n:",left"+n+",top"+n),bP+":"+a}function xx(t,e,r){var n=t.toFixed(0)+"px",a=e.toFixed(0)+"px";if(!_e.transformSupported)return r?"top:"+a+";left:"+n+";":[["top",a],["left",n]];var i=_e.transform3dSupported,o="translate"+(i?"3d":"")+"("+n+","+a+(i?",0":"")+")";return r?"top:0;left:0;"+ip+":"+o+";":[["top",0],["left",0],[_x,o]]}function TP(t){var e=[],r=t.get("fontSize"),n=t.getTextColor();n&&e.push("color:"+n),e.push("font:"+t.getFont());var a=Pe(t.get("lineHeight"),Math.round(r*3/2));r&&e.push("line-height:"+a+"px");var i=t.get("textShadowColor"),o=t.get("textShadowBlur")||0,s=t.get("textShadowOffsetX")||0,l=t.get("textShadowOffsetY")||0;return i&&o&&e.push("text-shadow:"+s+"px "+l+"px "+o+"px "+i),I(["decoration","align"],function(c){var u=t.get(c);u&&e.push("text-"+c+":"+u)}),e.join(";")}function CP(t,e,r){var n=[],a=t.get("transitionDuration"),i=t.get("backgroundColor"),o=t.get("shadowBlur"),s=t.get("shadowColor"),l=t.get("shadowOffsetX"),c=t.get("shadowOffsetY"),u=t.getModel("textStyle"),f=Hy(t,"html"),h=l+"px "+c+"px "+o+"px "+s;return n.push("box-shadow:"+h),e&&a&&n.push(kP(a,r)),i&&n.push("background-color:"+i),I(["width","color","radius"],function(d){var p="border-"+d,m=ky(p),g=t.get(m);g!=null&&n.push(p+":"+g+(d==="color"?"":"px"))}),n.push(TP(u)),f!=null&&n.push("padding:"+fc(f).join("px ")+"px"),n.join(";")+";"}function Sx(t,e,r,n,a){var i=e&&e.painter;if(r){var o=i&&i.getViewportRoot();o&&rC(t,o,r,n,a)}else{t[0]=n,t[1]=a;var s=i&&i.getViewportRootOffset();s&&(t[0]+=s.offsetLeft,t[1]+=s.offsetTop)}t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}var MP=(function(){function t(e,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,_e.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var a=this._zr=e.getZr(),i=r.appendTo,o=i&&(ae(i)?document.querySelector(i):no(i)?i:ke(i)&&i(e.getDom()));Sx(this._styleCoord,a,o,e.getWidth()/2,e.getHeight()/2),(o||e.getDom()).appendChild(n),this._api=e,this._container=o;var s=this;n.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},n.onmousemove=function(l){if(l=l||window.event,!s._enterable){var c=a.handler,u=a.painter.getViewportRoot();br(u,l,!0),c.dispatch("mousemove",l)}},n.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return t.prototype.update=function(e){if(!this._container){var r=this._api.getDom(),n=_P(r,"position"),a=r.style;a.position!=="absolute"&&n!=="absolute"&&(a.position="relative")}var i=e.get("alwaysShowContent");i&&this._moveIfResized(),this._alwaysShowContent=i,this.el.className=e.get("className")||""},t.prototype.show=function(e,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,a=n.style,i=this._styleCoord;n.innerHTML?a.cssText=xP+CP(e,!this._firstShow,this._longHide)+xx(i[0],i[1],!0)+("border-color:"+Oa(r)+";")+(e.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):a.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},t.prototype.setContent=function(e,r,n,a,i){var o=this.el;if(e==null){o.innerHTML="";return}var s="";if(ae(i)&&n.get("trigger")==="item"&&!mx(n)&&(s=SP(n,a,i)),ae(e))o.innerHTML=e+s;else if(e){o.innerHTML="",ee(e)||(e=[e]);for(var l=0;l<e.length;l++)no(e[l])&&e[l].parentNode!==o&&o.appendChild(e[l]);if(s&&o.childNodes.length){var c=document.createElement("div");c.innerHTML=s,o.appendChild(c)}}},t.prototype.setEnterable=function(e){this._enterable=e},t.prototype.getSize=function(){var e=this.el;return e?[e.offsetWidth,e.offsetHeight]:[0,0]},t.prototype.moveTo=function(e,r){if(this.el){var n=this._styleCoord;if(Sx(n,this._zr,this._container,e,r),n[0]!=null&&n[1]!=null){var a=this.el.style,i=xx(n[0],n[1]);I(i,function(o){a[o[0]]=o[1]})}}},t.prototype._moveIfResized=function(){var e=this._styleCoord[2],r=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),r*this._zr.getHeight())},t.prototype.hide=function(){var e=this,r=this.el.style;r.visibility="hidden",r.opacity="0",_e.transform3dSupported&&(r.willChange=""),this._show=!1,this._longHideTimeout=setTimeout(function(){return e._longHide=!0},500)},t.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Ne(this.hide,this),e)):this.hide())},t.prototype.isShow=function(){return this._show},t.prototype.dispose=function(){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var e=this.el.parentNode;e&&e.removeChild(this.el),this.el=this._container=null},t})(),AP=(function(){function t(e){this._show=!1,this._styleCoord=[0,0,0,0],this._alwaysShowContent=!1,this._enterable=!0,this._zr=e.getZr(),Tx(this._styleCoord,this._zr,e.getWidth()/2,e.getHeight()/2)}return t.prototype.update=function(e){var r=e.get("alwaysShowContent");r&&this._moveIfResized(),this._alwaysShowContent=r},t.prototype.show=function(){this._hideTimeout&&clearTimeout(this._hideTimeout),this.el.show(),this._show=!0},t.prototype.setContent=function(e,r,n,a,i){var o=this;de(e)&&Wt(""),this.el&&this._zr.remove(this.el);var s=n.getModel("textStyle");this.el=new $t({style:{rich:r.richTextStyles,text:e,lineHeight:22,borderWidth:1,borderColor:a,textShadowColor:s.get("textShadowColor"),fill:n.get(["textStyle","color"]),padding:Hy(n,"richText"),verticalAlign:"top",align:"left"},z:n.get("z")}),I(["backgroundColor","borderRadius","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"],function(c){o.el.style[c]=n.get(c)}),I(["textShadowBlur","textShadowOffsetX","textShadowOffsetY"],function(c){o.el.style[c]=s.get(c)||0}),this._zr.add(this.el);var l=this;this.el.on("mouseover",function(){l._enterable&&(clearTimeout(l._hideTimeout),l._show=!0),l._inContent=!0}),this.el.on("mouseout",function(){l._enterable&&l._show&&l.hideLater(l._hideDelay),l._inContent=!1})},t.prototype.setEnterable=function(e){this._enterable=e},t.prototype.getSize=function(){var e=this.el,r=this.el.getBoundingRect(),n=kx(e.style);return[r.width+n.left+n.right,r.height+n.top+n.bottom]},t.prototype.moveTo=function(e,r){var n=this.el;if(n){var a=this._styleCoord;Tx(a,this._zr,e,r),e=a[0],r=a[1];var i=n.style,o=Jn(i.borderWidth||0),s=kx(i);n.x=e+o+s.left,n.y=r+o+s.top,n.markRedraw()}},t.prototype._moveIfResized=function(){var e=this._styleCoord[2],r=this._styleCoord[3];this.moveTo(e*this._zr.getWidth(),r*this._zr.getHeight())},t.prototype.hide=function(){this.el&&this.el.hide(),this._show=!1},t.prototype.hideLater=function(e){this._show&&!(this._inContent&&this._enterable)&&!this._alwaysShowContent&&(e?(this._hideDelay=e,this._show=!1,this._hideTimeout=setTimeout(Ne(this.hide,this),e)):this.hide())},t.prototype.isShow=function(){return this._show},t.prototype.dispose=function(){this._zr.remove(this.el)},t})();function Jn(t){return Math.max(0,t)}function kx(t){var e=Jn(t.shadowBlur||0),r=Jn(t.shadowOffsetX||0),n=Jn(t.shadowOffsetY||0);return{left:Jn(e-r),right:Jn(e+r),top:Jn(e-n),bottom:Jn(e+n)}}function Tx(t,e,r,n){t[0]=r,t[1]=n,t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}var DP=new _t({shape:{x:-1,y:-1,width:2,height:2}}),IP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.init=function(r,n){if(!(_e.node||!n.getDom())){var a=r.getComponent("tooltip"),i=this._renderMode=Vk(a.get("renderMode"));this._tooltipContent=i==="richText"?new AP(n):new MP(n,{appendTo:a.get("appendToBody",!0)?"body":a.get("appendTo",!0)})}},e.prototype.render=function(r,n,a){if(!(_e.node||!a.getDom())){this.group.removeAll(),this._tooltipModel=r,this._ecModel=n,this._api=a;var i=this._tooltipContent;i.update(r),i.setEnterable(r.get("enterable")),this._initGlobalListener(),this._keepShow(),this._renderMode!=="richText"&&r.get("transitionDuration")?Xd(this,"_updatePosition",50,"fixRate"):Zd(this,"_updatePosition")}},e.prototype._initGlobalListener=function(){var r=this._tooltipModel,n=r.get("triggerOn");ix("itemTooltip",this._api,Ne(function(a,i,o){n!=="none"&&(n.indexOf(a)>=0?this._tryShow(i,o):a==="leave"&&this._hide(o))},this))},e.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,a=this._api,i=r.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&i!=="none"&&i!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!a.isDisposed()&&o.manuallyShowTip(r,n,a,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},e.prototype.manuallyShowTip=function(r,n,a,i){if(!(i.from===this.uid||_e.node||!a.getDom())){var o=Cx(i,a);this._ticket="";var s=i.dataByCoordSys,l=EP(i,n,a);if(l){var c=l.el.getBoundingRect().clone();c.applyTransform(l.el.transform),this._tryShow({offsetX:c.x+c.width/2,offsetY:c.y+c.height/2,target:l.el,position:i.position,positionDefault:"bottom"},o)}else if(i.tooltip&&i.x!=null&&i.y!=null){var u=DP;u.x=i.x,u.y=i.y,u.update(),We(u).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:u},o)}else if(s)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:s,tooltipOption:i.tooltipOption},o);else if(i.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,a,i))return;var f=sx(i,n),h=f.point[0],d=f.point[1];h!=null&&d!=null&&this._tryShow({offsetX:h,offsetY:d,target:f.el,position:i.position,positionDefault:"bottom"},o)}else i.x!=null&&i.y!=null&&(a.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:a.getZr().findHover(i.x,i.y).target},o))}},e.prototype.manuallyHideTip=function(r,n,a,i){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(Cx(i,a))},e.prototype._manuallyAxisShowTip=function(r,n,a,i){var o=i.seriesIndex,s=i.dataIndex,l=n.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var c=n.getSeriesByIndex(o);if(c){var u=c.getData(),f=ss([u.getItemModel(s),c,(c.coordinateSystem||{}).model],this._tooltipModel);if(f.get("trigger")==="axis")return a.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:i.position}),!0}}},e.prototype._tryShow=function(r,n){var a=r.target,i=this._tooltipModel;if(i){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(a){var s=We(a);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,c;Jo(a,function(u){if(We(u).dataIndex!=null)return l=u,!0;if(We(u).tooltipConfig!=null)return c=u,!0},!0),l?this._showSeriesItemTooltip(r,l,n):c?this._showComponentItemTooltip(r,c,n):this._hide(n)}else this._lastDataByCoordSys=null,this._hide(n)}},e.prototype._showOrMove=function(r,n){var a=r.get("showDelay");n=Ne(n,this),clearTimeout(this._showTimout),a>0?this._showTimout=setTimeout(n,a):n()},e.prototype._showAxisTooltip=function(r,n){var a=this._ecModel,i=this._tooltipModel,o=[n.offsetX,n.offsetY],s=ss([n.tooltipOption],i),l=this._renderMode,c=[],u=Go("section",{blocks:[],noHeader:!0}),f=[],h=new Od;I(r,function(y){I(y.dataByAxis,function(b){var x=a.getComponent(b.axisDim+"Axis",b.axisIndex),w=b.value;if(!(!x||w==null)){var S=tx(w,x.axis,a,b.seriesDataIndices,b.valueLabelOpt),k=Go("section",{header:S,noHeader:!Gr(S),sortBlocks:!0,blocks:[]});u.blocks.push(k),I(b.seriesDataIndices,function(C){var A=a.getSeriesByIndex(C.seriesIndex),M=C.dataIndexInside,T=A.getDataParams(M);if(!(T.dataIndex<0)){T.axisDim=b.axisDim,T.axisIndex=b.axisIndex,T.axisType=b.axisType,T.axisId=b.axisId,T.axisValue=Uh(x.axis,{value:w}),T.axisValueLabel=S,T.marker=h.makeTooltipMarker("item",Oa(T.color),l);var D=Iy(A.formatTooltip(M,!0,null)),L=D.frag;if(L){var R=ss([A],i).get("valueFormatter");k.blocks.push(R?q({valueFormatter:R},L):L)}D.text&&f.push(D.text),c.push(T)}})}})}),u.blocks.reverse(),f.reverse();var d=n.position,p=s.get("order"),m=zy(u,h,l,p,a.get("useUTC"),s.get("textStyle"));m&&f.unshift(m);var g=l==="richText"?`
|
|
19
|
-
|
|
20
|
-
`:"<br/>",v=f.join(g);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,c)?this._updatePosition(s,d,o[0],o[1],this._tooltipContent,c):this._showTooltipContent(s,v,c,Math.random()+"",o[0],o[1],d,null,h)})},e.prototype._showSeriesItemTooltip=function(r,n,a){var i=this._ecModel,o=We(n),s=o.seriesIndex,l=i.getSeriesByIndex(s),c=o.dataModel||l,u=o.dataIndex,f=o.dataType,h=c.getData(f),d=this._renderMode,p=r.positionDefault,m=ss([h.getItemModel(u),c,l&&(l.coordinateSystem||{}).model],this._tooltipModel,p?{position:p}:null),g=m.get("trigger");if(!(g!=null&&g!=="item")){var v=c.getDataParams(u,f),y=new Od;v.marker=y.makeTooltipMarker("item",Oa(v.color),d);var b=Iy(c.formatTooltip(u,!1,f)),x=m.get("order"),w=m.get("valueFormatter"),S=b.frag,k=S?zy(w?q({valueFormatter:w},S):S,y,d,x,i.get("useUTC"),m.get("textStyle")):b.text,C="item_"+c.name+"_"+u;this._showOrMove(m,function(){this._showTooltipContent(m,k,v,C,r.offsetX,r.offsetY,r.position,r.target,y)}),a({type:"showTip",dataIndexInside:u,dataIndex:h.getRawIndex(u),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(r,n,a){var i=this._renderMode==="html",o=We(n),s=o.tooltipConfig,l=s.option||{},c=l.encodeHTMLContent;if(ae(l)){var u=l;l={content:u,formatter:u},c=!0}c&&i&&l.content&&(l=Ie(l),l.content=Zt(l.content));var f=[l],h=this._ecModel.getComponent(o.componentMainType,o.componentIndex);h&&f.push(h),f.push({formatter:l.content});var d=r.positionDefault,p=ss(f,this._tooltipModel,d?{position:d}:null),m=p.get("content"),g=Math.random()+"",v=new Od;this._showOrMove(p,function(){var y=Ie(p.get("formatterParams")||{});this._showTooltipContent(p,m,y,g,r.offsetX,r.offsetY,r.position,n,v)}),a({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(r,n,a,i,o,s,l,c,u){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var f=this._tooltipContent;f.setEnterable(r.get("enterable"));var h=r.get("formatter");l=l||r.get("position");var d=n,p=this._getNearestPoint([o,s],a,r.get("trigger"),r.get("borderColor")),m=p.color;if(h)if(ae(h)){var g=r.ecModel.get("useUTC"),v=ee(a)?a[0]:a,y=v&&v.axisType&&v.axisType.indexOf("time")>=0;d=h,y&&(d=oc(v.axisValue,d,g)),d=Cy(d,a,!0)}else if(ke(h)){var b=Ne(function(x,w){x===this._ticket&&(f.setContent(w,u,r,m,l),this._updatePosition(r,l,o,s,f,a,c))},this);this._ticket=i,d=h(a,i,b)}else d=h;f.setContent(d,u,r,m,l),f.show(r,m),this._updatePosition(r,l,o,s,f,a,c)}},e.prototype._getNearestPoint=function(r,n,a,i){if(a==="axis"||ee(n))return{color:i||(this._renderMode==="html"?"#fff":"none")};if(!ee(n))return{color:i||n.color||n.borderColor}},e.prototype._updatePosition=function(r,n,a,i,o,s,l){var c=this._api.getWidth(),u=this._api.getHeight();n=n||r.get("position");var f=o.getSize(),h=r.get("align"),d=r.get("verticalAlign"),p=l&&l.getBoundingRect().clone();if(l&&p.applyTransform(l.transform),ke(n)&&(n=n([a,i],s,o.el,p,{viewSize:[c,u],contentSize:f.slice()})),ee(n))a=Nt(n[0],c),i=Nt(n[1],u);else if(de(n)){var m=n;m.width=f[0],m.height=f[1];var g=pc(m,{width:c,height:u});a=g.x,i=g.y,h=null,d=null}else if(ae(n)&&l){var v=RP(n,p,f,r.get("borderWidth"));a=v[0],i=v[1]}else{var v=LP(a,i,o,c,u,h?null:20,d?null:20);a=v[0],i=v[1]}if(h&&(a-=Mx(h)?f[0]/2:h==="right"?f[0]:0),d&&(i-=Mx(d)?f[1]/2:d==="bottom"?f[1]:0),mx(r)){var v=PP(a,i,o,c,u);a=v[0],i=v[1]}o.moveTo(a,i)},e.prototype._updateContentNotChangedOnAxis=function(r,n){var a=this._lastDataByCoordSys,i=this._cbParamsList,o=!!a&&a.length===r.length;return o&&I(a,function(s,l){var c=s.dataByAxis||[],u=r[l]||{},f=u.dataByAxis||[];o=o&&c.length===f.length,o&&I(c,function(h,d){var p=f[d]||{},m=h.seriesDataIndices||[],g=p.seriesDataIndices||[];o=o&&h.value===p.value&&h.axisType===p.axisType&&h.axisId===p.axisId&&m.length===g.length,o&&I(m,function(v,y){var b=g[y];o=o&&v.seriesIndex===b.seriesIndex&&v.dataIndex===b.dataIndex}),i&&I(h.seriesDataIndices,function(v){var y=v.seriesIndex,b=n[y],x=i[y];b&&x&&x.data!==b.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=n,!!o},e.prototype._hide=function(r){this._lastDataByCoordSys=null,r({type:"hideTip",from:this.uid})},e.prototype.dispose=function(r,n){_e.node||!n.getDom()||(Zd(this,"_updatePosition"),this._tooltipContent.dispose(),np("itemTooltip",n))},e.type="tooltip",e})(Nr);function ss(t,e,r){var n=e.ecModel,a;r?(a=new lt(r,n,n),a=new lt(e.option,a,n)):a=e;for(var i=t.length-1;i>=0;i--){var o=t[i];o&&(o instanceof lt&&(o=o.get("tooltip",!0)),ae(o)&&(o={formatter:o}),o&&(a=new lt(o,a,n)))}return a}function Cx(t,e){return t.dispatchAction||Ne(e.dispatchAction,e)}function LP(t,e,r,n,a,i,o){var s=r.getSize(),l=s[0],c=s[1];return i!=null&&(t+l+i+2>n?t-=l+i:t+=i),o!=null&&(e+c+o>a?e-=c+o:e+=o),[t,e]}function PP(t,e,r,n,a){var i=r.getSize(),o=i[0],s=i[1];return t=Math.min(t+o,n)-o,e=Math.min(e+s,a)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function RP(t,e,r,n){var a=r[0],i=r[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,c=e.width,u=e.height;switch(t){case"inside":s=e.x+c/2-a/2,l=e.y+u/2-i/2;break;case"top":s=e.x+c/2-a/2,l=e.y-i-o;break;case"bottom":s=e.x+c/2-a/2,l=e.y+u+o;break;case"left":s=e.x-a-o,l=e.y+u/2-i/2;break;case"right":s=e.x+c+o,l=e.y+u/2-i/2}return[s,l]}function Mx(t){return t==="center"||t==="middle"}function EP(t,e,r){var n=Lf(t).queryOptionMap,a=n.keys()[0];if(!(!a||a==="series")){var i=ko(e,a,n.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(c){var u=We(c).tooltipConfig;if(u&&u.name===t.name)return l=c,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}function OP(t){Zn(fx),t.registerComponentModel(mP),t.registerComponentView(IP),t.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Et),t.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Et)}var NP=function(t,e){if(e==="all")return{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])};if(e==="inverse")return{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}},op=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.layoutMode={type:"box",ignoreSize:!0},r}return e.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a),r.selected=r.selected||{},this._updateSelector(r)},e.prototype.mergeOption=function(r,n){t.prototype.mergeOption.call(this,r,n),this._updateSelector(r)},e.prototype._updateSelector=function(r){var n=r.selector,a=this.ecModel;n===!0&&(n=r.selector=["all","inverse"]),ee(n)&&I(n,function(i,o){ae(i)&&(i={type:i}),n[o]=Oe(i,NP(a,i.type))})},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var r=this._data;if(r[0]&&this.get("selectedMode")==="single"){for(var n=!1,a=0;a<r.length;a++){var i=r[a].get("name");if(this.isSelected(i)){this.select(i),n=!0;break}}!n&&this.select(r[0].get("name"))}},e.prototype._updateData=function(r){var n=[],a=[];r.eachRawSeries(function(l){var c=l.name;a.push(c);var u;if(l.legendVisualProvider){var f=l.legendVisualProvider,h=f.getAllNames();r.isSeriesFiltered(l)||(a=a.concat(h)),h.length?n=n.concat(h):u=!0}else u=!0;u&&Df(l)&&n.push(l.name)}),this._availableNames=a;var i=this.get("data")||n,o=me(),s=he(i,function(l){return(ae(l)||et(l))&&(l={name:l}),o.get(l.name)?null:(o.set(l.name,!0),new lt(l,this,this.ecModel))},this);this._data=bt(s,function(l){return!!l})},e.prototype.getData=function(){return this._data},e.prototype.select=function(r){var n=this.option.selected,a=this.get("selectedMode");if(a==="single"){var i=this._data;I(i,function(o){n[o.get("name")]=!1})}n[r]=!0},e.prototype.unSelect=function(r){this.get("selectedMode")!=="single"&&(this.option.selected[r]=!1)},e.prototype.toggleSelected=function(r){var n=this.option.selected;n.hasOwnProperty(r)||(n[r]=!0),this[n[r]?"unSelect":"select"](r)},e.prototype.allSelect=function(){var r=this._data,n=this.option.selected;I(r,function(a){n[a.get("name",!0)]=!0})},e.prototype.inverseSelect=function(){var r=this._data,n=this.option.selected;I(r,function(a){var i=a.get("name",!0);n.hasOwnProperty(i)||(n[i]=!0),n[i]=!n[i]})},e.prototype.isSelected=function(r){var n=this.option.selected;return!(n.hasOwnProperty(r)&&!n[r])&&Ue(this._availableNames,r)>=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.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}},e})(Ye),Gi=dt,sp=I,Zc=St,Ax=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.newlineDisabled=!1,r}return e.prototype.init=function(){this.group.add(this._contentGroup=new Zc),this.group.add(this._selectorGroup=new Zc),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(r,n,a){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),c=r.get("selectorPosition",!0);l&&(!c||c==="auto")&&(c=s==="horizontal"?"end":"start"),this.renderInner(o,r,n,a,l,s,c);var u=r.getBoxLayoutParams(),f={width:a.getWidth(),height:a.getHeight()},h=r.get("padding"),d=pc(u,f,h),p=this.layoutInner(r,o,d,i,l,c),m=pc(He({width:p.width,height:p.height},u),f,h);this.group.x=m.x-p.x,this.group.y=m.y-p.y,this.group.markRedraw(),this.group.add(this._backgroundEl=gP(p,r))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(r,n,a,i,o,s,l){var c=this.getContentGroup(),u=me(),f=n.get("selectedMode"),h=[];a.eachRawSeries(function(d){!d.get("legendHoverLink")&&h.push(d.id)}),sp(n.getData(),function(d,p){var m=d.get("name");if(!this.newlineDisabled&&(m===""||m===`
|
|
21
|
-
|
|
22
|
-
`||a==="")){var i=t.isSelected(a);la(r,a)?r[a]=r[a]&&i:r[a]=i}}),r}function HP(t){t.registerAction("legendToggleSelect","legendselectchanged",dt(ls,"toggleSelected")),t.registerAction("legendAllSelect","legendselectall",dt(ls,"allSelect")),t.registerAction("legendInverseSelect","legendinverseselect",dt(ls,"inverseSelect")),t.registerAction("legendSelect","legendselected",dt(ls,"select")),t.registerAction("legendUnSelect","legendunselected",dt(ls,"unSelect"))}function Px(t){t.registerComponentModel(op),t.registerComponentView(Ax),t.registerProcessor(t.PRIORITY.PROCESSOR.SERIES_FILTER,FP),t.registerSubTypeDefaulter("legend",function(){return"plain"}),HP(t)}var VP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.setScrollDataIndex=function(r){this.option.scrollDataIndex=r},e.prototype.init=function(r,n,a){var i=vc(r);t.prototype.init.call(this,r,n,a),Rx(this,r,i)},e.prototype.mergeOption=function(r,n){t.prototype.mergeOption.call(this,r,n),Rx(this,this.option,r)},e.type="legend.scroll",e.defaultOption=yd(op.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}),e})(op);function Rx(t,e,r){var n=t.getOrient(),a=[1,1];a[n.index]=0,Pi(e,r,{type:"box",ignoreSize:!!a})}var Ex=St,up=["width","height"],fp=["x","y"],UP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.newlineDisabled=!0,r._currentIndex=0,r}return e.prototype.init=function(){t.prototype.init.call(this),this.group.add(this._containerGroup=new Ex),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Ex)},e.prototype.resetInner=function(){t.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},e.prototype.renderInner=function(r,n,a,i,o,s,l){var c=this;t.prototype.renderInner.call(this,r,n,a,i,o,s,l);var u=this._controllerGroup,f=n.get("pageIconSize",!0),h=ee(f)?f:[f,f];p("pagePrev",0);var d=n.getModel("pageTextStyle");u.add(new $t({name:"pageText",style:{text:"xx/xx",fill:d.getTextColor(),font:d.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),p("pageNext",1);function p(m,g){var v=m+"DataIndex",y=rd(n.get("pageIcons",!0)[n.getOrient().name][g],{onclick:Ne(c._pageGo,c,v,n,i)},{x:-h[0]/2,y:-h[1]/2,width:h[0],height:h[1]});y.name=m,u.add(y)}},e.prototype.layoutInner=function(r,n,a,i,o,s){var l=this.getSelectorGroup(),c=r.getOrient().index,u=up[c],f=fp[c],h=up[1-c],d=fp[1-c];o&&Ho("horizontal",l,r.get("selectorItemGap",!0));var p=r.get("selectorButtonGap",!0),m=l.getBoundingRect(),g=[-m.x,-m.y],v=Ie(a);o&&(v[u]=a[u]-m[u]-p);var y=this._layoutContentAndController(r,i,v,c,u,h,d,f);if(o){if(s==="end")g[c]+=y[u]+p;else{var b=m[u]+p;g[c]-=b,y[f]-=b}y[u]+=m[u]+p,g[1-c]+=y[d]+y[h]/2-m[h]/2,y[h]=Math.max(y[h],m[h]),y[d]=Math.min(y[d],m[d]+g[1-c]),l.x=g[0],l.y=g[1],l.markRedraw()}return y},e.prototype._layoutContentAndController=function(r,n,a,i,o,s,l,c){var u=this.getContentGroup(),f=this._containerGroup,h=this._controllerGroup;Ho(r.get("orient"),u,r.get("itemGap"),i?a.width:null,i?null:a.height),Ho("horizontal",h,r.get("pageButtonItemGap",!0));var d=u.getBoundingRect(),p=h.getBoundingRect(),m=this._showController=d[o]>a[o],g=[-d.x,-d.y];n||(g[i]=u[c]);var v=[0,0],y=[-p.x,-p.y],b=Pe(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var x=r.get("pageButtonPosition",!0);x==="end"?y[i]+=a[o]-p[o]:v[i]+=p[o]+b}y[1-i]+=d[s]/2-p[s]/2,u.setPosition(g),f.setPosition(v),h.setPosition(y);var w={x:0,y:0};if(w[o]=m?a[o]:d[o],w[s]=Math.max(d[s],p[s]),w[l]=Math.min(0,p[l]+y[1-i]),f.__rectSize=a[o],m){var S={x:0,y:0};S[o]=Math.max(a[o]-p[o]-b,0),S[s]=w[s],f.setClipPath(new _t({shape:S})),f.__rectSize=S[o]}else h.eachChild(function(C){C.attr({invisible:!0,silent:!0})});var k=this._getPageInfo(r);return k.pageIndex!=null&&or(u,{x:k.contentPosition[0],y:k.contentPosition[1]},m?r:null),this._updatePageInfoView(r,k),w},e.prototype._pageGo=function(r,n,a){var i=this._getPageInfo(n)[r];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},e.prototype._updatePageInfoView=function(r,n){var a=this._controllerGroup;I(["pagePrev","pageNext"],function(u){var f=u+"DataIndex",h=n[f]!=null,d=a.childOfName(u);d&&(d.setStyle("fill",h?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),d.cursor=h?"pointer":"default")});var i=a.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,c=n.pageCount;i&&o&&i.setStyle("text",ae(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",c==null?"":c+""):o({current:l,total:c}))},e.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=r.getOrient().index,s=up[o],l=fp[o],c=this._findTargetItemIndex(n),u=a.children(),f=u[c],h=u.length,d=h?1:0,p={contentPosition:[a.x,a.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!f)return p;var m=x(f);p.contentPosition[o]=-m.s;for(var g=c+1,v=m,y=m,b=null;g<=h;++g)b=x(u[g]),(!b&&y.e>v.s+i||b&&!w(b,v.s))&&(y.i>v.i?v=y:v=b,v&&(p.pageNextDataIndex==null&&(p.pageNextDataIndex=v.i),++p.pageCount)),y=b;for(var g=c-1,v=m,y=m,b=null;g>=-1;--g)b=x(u[g]),(!b||!w(y,b.s))&&v.i<y.i&&(y=v,p.pagePrevDataIndex==null&&(p.pagePrevDataIndex=v.i),++p.pageCount,++p.pageIndex),v=b;return p;function x(S){if(S){var k=S.getBoundingRect(),C=k[l]+S[l];return{s:C,e:C+k[s],i:S.__legendDataIndex}}}function w(S,k){return S.e>=k&&S.s<=k+i}},e.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===r&&(n=s)}),n??i},e.type="legend.scroll",e})(Ax);function GP(t){t.registerAction("legendScroll","legendscroll",function(e,r){var n=e.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:e},function(a){a.setScrollDataIndex(n)})})}function $P(t){Zn(Px),t.registerComponentModel(VP),t.registerComponentView(UP),GP(t)}function WP(t){Zn(Px),Zn($P)}var qP=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="dataZoom.inside",e.defaultOption=yd(hx.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e})(hx),dp=ht();function YP(t,e,r){dp(t).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(e.uid);a&&(a.getRange=r)})}function XP(t,e){for(var r=dp(t).coordSysRecordMap,n=r.keys(),a=0;a<n.length;a++){var i=n[a],o=r.get(i),s=o.dataZoomInfoMap;if(s){var l=e.uid,c=s.get(l);c&&(s.removeKey(l),s.keys().length||Ox(r,o))}}}function Ox(t,e){if(e){t.removeKey(e.model.uid);var r=e.controller;r&&r.dispose()}}function ZP(t,e){var r={model:e,containsPoint:dt(jP,e),dispatchAction:dt(KP,t),dataZoomInfoMap:null,controller:null},n=r.controller=new EL(t.getZr());return I(["pan","zoom","scrollMove"],function(a){n.on(a,function(i){var o=[];r.dataZoomInfoMap.each(function(s){if(i.isAvailableBehavior(s.model.option)){var l=(s.getRange||{})[a],c=l&&l(s.dzReferCoordSysInfo,r.model.mainType,r.controller,i);!s.model.get("disabled",!0)&&c&&o.push({dataZoomId:s.model.id,start:c[0],end:c[1]})}}),o.length&&r.dispatchAction(o)})}),r}function KP(t,e){t.isDisposed()||t.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:e})}function jP(t,e,r,n){return t.coordinateSystem.containPoint([r,n])}function JP(t){var e,r="type_",n={type_true:2,type_move:1,type_false:0,type_undefined:-1},a=!0;return t.each(function(i){var o=i.model,s=o.get("disabled",!0)?!1:o.get("zoomLock",!0)?"move":!0;n[r+s]>n[r+e]&&(e=s),a=a&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!a}}}function QP(t){t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,function(e,r){var n=dp(r),a=n.coordSysRecordMap||(n.coordSysRecordMap=me());a.each(function(i){i.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=cP(i);I(o.infoList,function(s){var l=s.model.uid,c=a.get(l)||a.set(l,ZP(r,s.model)),u=c.dataZoomInfoMap||(c.dataZoomInfoMap=me());u.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var c=l.keys()[0];c!=null&&(s=l.get(c))}if(!s){Ox(a,i);return}var u=JP(l);o.enable(u.controlType,u.opt),o.setPointerChecker(i.containsPoint),Xd(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var eR=(function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return e.prototype.render=function(r,n,a){if(t.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),YP(a,r,{pan:Ne(hp.pan,this),zoom:Ne(hp.zoom,this),scrollMove:Ne(hp.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),t.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){XP(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e})(uP),hp={zoom:function(t,e,r,n){var a=this.range,i=a.slice(),o=t.axisModels[0];if(o){var s=pp[e](null,[n.originX,n.originY],o,r,t),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(i[1]-i[0])+i[0],c=Math.max(1/n.scale,0);i[0]=(i[0]-l)*c+l,i[1]=(i[1]-l)*c+l;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Qh(0,i,[0,100],0,u.minSpan,u.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:Nx(function(t,e,r,n,a,i){var o=pp[n]([i.oldX,i.oldY],[i.newX,i.newY],e,a,r);return o.signal*(t[1]-t[0])*o.pixel/o.pixelLength}),scrollMove:Nx(function(t,e,r,n,a,i){var o=pp[n]([0,0],[i.scrollDelta,i.scrollDelta],e,a,r);return o.signal*(t[1]-t[0])*i.scrollDelta})};function Nx(t){return function(e,r,n,a){var i=this.range,o=i.slice(),s=e.axisModels[0];if(s){var l=t(o,s,e,r,n,a);if(Qh(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var pp={grid:function(t,e,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem.getRect();return t=t||[0,0],i.dim==="x"?(o.pixel=e[0]-t[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=e[1]-t[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(t,e,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),c=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),r.mainType==="radiusAxis"?(o.pixel=e[0]-t[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=i.inverse?1:-1):(o.pixel=e[1]-t[1],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=i.inverse?-1:1),o},singleAxis:function(t,e,r,n,a){var i=r.axis,o=a.model.coordinateSystem.getRect(),s={};return t=t||[0,0],i.orient==="horizontal"?(s.pixel=e[0]-t[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function tR(t){vP(t),t.registerComponentModel(qP),t.registerComponentView(eR),QP(t)}var rR={label:{enabled:!0},decal:{show:!1}},Bx=ht(),nR={};function aR(t,e){var r=t.getModel("aria");if(!r.get("enabled"))return;var n=Ie(rR);Oe(n.label,t.getLocaleModel().get("aria"),!1),Oe(r.option,n,!1),a(),i();function a(){var c=r.getModel("decal"),u=c.get("show");if(u){var f=me();t.eachSeries(function(h){if(!h.isColorBySeries()){var d=f.get(h.type);d||(d={},f.set(h.type,d)),Bx(h).scope=d}}),t.eachRawSeries(function(h){if(t.isSeriesFiltered(h))return;if(ke(h.enableAriaDecal)){h.enableAriaDecal();return}var d=h.getData();if(h.isColorBySeries()){var y=Ay(h.ecModel,h.name,nR,t.getSeriesCount()),b=d.getVisual("decal");d.setVisual("decal",x(b,y))}else{var p=h.getRawData(),m={},g=Bx(h).scope;d.each(function(w){var S=d.getRawIndex(w);m[S]=w});var v=p.count();p.each(function(w){var S=m[w],k=p.getName(w)||w+"",C=Ay(h.ecModel,k,g,v),A=d.getItemVisual(S,"decal");d.setItemVisual(S,"decal",x(A,C))})}function x(w,S){var k=w?q(q({},S),w):S;return k.dirty=!0,k}})}}function i(){var c=e.getZr().dom;if(c){var u=t.getLocaleModel().get("aria"),f=r.getModel("label");if(f.option=He(f.option,u),!!f.get("enabled")){if(c.setAttribute("role","img"),f.get("description")){c.setAttribute("aria-label",f.get("description"));return}var h=t.getSeriesCount(),d=f.get(["data","maxCount"])||10,p=f.get(["series","maxCount"])||10,m=Math.min(h,p),g;if(!(h<1)){var v=s();if(v){var y=f.get(["general","withTitle"]);g=o(y,{title:v})}else g=f.get(["general","withoutTitle"]);var b=[],x=h>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);g+=o(x,{seriesCount:h}),t.eachSeries(function(C,A){if(A<m){var M=void 0,T=C.get("name"),D=T?"withName":"withoutName";M=h>1?f.get(["series","multiple",D]):f.get(["series","single",D]),M=o(M,{seriesId:C.seriesIndex,seriesName:C.get("name"),seriesType:l(C.subType)});var L=C.getData();if(L.count()>d){var R=f.get(["data","partialData"]);M+=o(R,{displayCnt:d})}else M+=f.get(["data","allData"]);for(var O=f.get(["data","separator","middle"]),B=f.get(["data","separator","end"]),j=f.get(["data","excludeDimensionId"]),P=[],V=0;V<L.count();V++)if(V<d){var H=L.getName(V),Z=j?bt(L.getValues(V),function(Te,ge){return Ue(j,ge)===-1}):L.getValues(V),re=f.get(["data",H?"withName":"withoutName"]);P.push(o(re,{name:H,value:Z.join(O)}))}M+=P.join(O)+B,b.push(M)}});var w=f.getModel(["series","multiple","separator"]),S=w.get("middle"),k=w.get("end");g+=b.join(S)+k,c.setAttribute("aria-label",g)}}}}function o(c,u){if(!ae(c))return c;var f=c;return I(u,function(h,d){f=f.replace(new RegExp("\\{\\s*"+d+"\\s*\\}","g"),h)}),f}function s(){var c=t.get("title");return c&&c.length&&(c=c[0]),c&&c.text}function l(c){var u=t.getLocaleModel().get(["series","typeNames"]);return u[c]||u.chart}}function iR(t){if(!(!t||!t.aria)){var e=t.aria;e.show!=null&&(e.enabled=e.show),e.label=e.label||{},I(["description","general","series","data"],function(r){e[r]!=null&&(e.label[r]=e[r])})}}function oR(t){t.registerPreprocessor(iR),t.registerVisual(t.PRIORITY.VISUAL.ARIA,aR)}function zx(t,e,r){var n=ri.createCanvas(),a=e.getWidth(),i=e.getHeight(),o=n.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=a+"px",o.height=i+"px",n.setAttribute("data-zr-dom-id",t)),n.width=a*r,n.height=i*r,n}var vp=(function(t){K(e,t);function e(r,n,a){var i=t.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 o;a=a||gl,typeof r=="string"?o=zx(r,n,a):de(r)&&(o=r,r=o.id),i.id=r,i.dom=o;var s=o.style;return s&&(wv(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),i.painter=n,i.dpr=a,i}return e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var r=this.dpr;this.domBack=zx("back-"+this.id,this.painter,r),this.ctxBack=this.domBack.getContext("2d"),r!==1&&this.ctxBack.scale(r,r)},e.prototype.createRepaintRects=function(r,n,a,i){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,c=new Ge(0,0,0,0);function u(y){if(!(!y.isFinite()||y.isZero()))if(o.length===0){var b=new Ge(0,0,0,0);b.copy(y),o.push(b)}else{for(var x=!1,w=1/0,S=0,k=0;k<o.length;++k){var C=o[k];if(C.intersect(y)){var A=new Ge(0,0,0,0);A.copy(C),A.union(y),o[k]=A,x=!0;break}else if(l){c.copy(y),c.union(C);var M=y.width*y.height,T=C.width*C.height,D=c.width*c.height,L=D-M-T;L<w&&(w=L,S=k)}}if(l&&(o[S].union(y),x=!0),!x){var b=new Ge(0,0,0,0);b.copy(y),o.push(b)}l||(l=o.length>=s)}}for(var f=this.__startIndex;f<this.__endIndex;++f){var h=r[f];if(h){var d=h.shouldBePainted(a,i,!0,!0),p=h.__isRendered&&(h.__dirty&ir||!d)?h.getPrevPaintRect():null;p&&u(p);var m=d&&(h.__dirty&ir||!h.__isRendered)?h.getPaintRect():null;m&&u(m)}}for(var f=this.__prevStartIndex;f<this.__prevEndIndex;++f){var h=n[f],d=h&&h.shouldBePainted(a,i,!0,!0);if(h&&(!d||!h.__zr)&&h.__isRendered){var p=h.getPrevPaintRect();p&&u(p)}}var g;do{g=!1;for(var f=0;f<o.length;){if(o[f].isZero()){o.splice(f,1);continue}for(var v=f+1;v<o.length;)o[f].intersect(o[v])?(g=!0,o[f].union(o[v]),o.splice(v,1)):v++;f++}}while(g);return this._paintRects=o,o},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(r,n){var a=this.dpr,i=this.dom,o=i.style,s=this.domBack;o&&(o.width=r+"px",o.height=n+"px"),i.width=r*a,i.height=n*a,s&&(s.width=r*a,s.height=n*a,a!==1&&this.ctxBack.scale(a,a))},e.prototype.clear=function(r,n,a){var i=this.dom,o=this.ctx,s=i.width,l=i.height;n=n||this.clearColor;var c=this.motionBlur&&!r,u=this.lastFrameAlpha,f=this.dpr,h=this;c&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(i,0,0,s/f,l/f));var d=this.domBack;function p(m,g,v,y){if(o.clearRect(m,g,v,y),n&&n!=="transparent"){var b=void 0;if(Ws(n)){var x=n.global||n.__width===v&&n.__height===y;b=x&&n.__canvasGradient||gh(o,n,{x:0,y:0,width:v,height:y}),n.__canvasGradient=b,n.__width=v,n.__height=y}else Ew(n)&&(n.scaleX=n.scaleX||f,n.scaleY=n.scaleY||f,b=mh(o,n,{dirty:function(){h.setUnpainted(),h.painter.refresh()}}));o.save(),o.fillStyle=b||n,o.fillRect(m,g,v,y),o.restore()}c&&(o.save(),o.globalAlpha=u,o.drawImage(d,m,g,v,y),o.restore())}!a||c?p(0,0,s,l):a.length&&I(a,function(m){p(m.x*f,m.y*f,m.width*f,m.height*f)})},e})(Ir),Fx=1e5,$a=314159,Kc=.01,sR=.001;function lR(t){return t?t.__builtin__?!0:!(typeof t.resize!="function"||typeof t.refresh!="function"):!1}function cR(t,e){var r=document.createElement("div");return r.style.cssText=["position:relative","width:"+t+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",r}var uR=(function(){function t(e,r,n,a){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=q({},n||{}),this.dpr=n.devicePixelRatio||gl,this._singleCanvas=i,this.root=e;var o=e.style;o&&(wv(e),e.innerHTML=""),this.storage=r;var s=this._zlevelList;this._prevDisplayList=[];var l=this._layers;if(i){var u=e,f=u.width,h=u.height;n.width!=null&&(f=n.width),n.height!=null&&(h=n.height),this.dpr=n.devicePixelRatio||1,u.width=f*this.dpr,u.height=h*this.dpr,this._width=f,this._height=h;var d=new vp(u,this,this.dpr);d.__builtin__=!0,d.initContext(),l[$a]=d,d.zlevel=$a,s.push($a),this._domRoot=e}else{this._width=Pc(e,0,n),this._height=Pc(e,1,n);var c=this._domRoot=cR(this._width,this._height);e.appendChild(c)}}return t.prototype.getType=function(){return"canvas"},t.prototype.isSingleCanvas=function(){return this._singleCanvas},t.prototype.getViewportRoot=function(){return this._domRoot},t.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},t.prototype.refresh=function(e){var r=this.storage.getDisplayList(!0),n=this._prevDisplayList,a=this._zlevelList;this._redrawId=Math.random(),this._paintList(r,n,e,this._redrawId);for(var i=0;i<a.length;i++){var o=a[i],s=this._layers[o];if(!s.__builtin__&&s.refresh){var l=i===0?this._backgroundColor:null;s.refresh(l)}}return this._opts.useDirtyRect&&(this._prevDisplayList=r.slice()),this},t.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},t.prototype._paintHoverList=function(e){var r=e.length,n=this._hoverlayer;if(n&&n.clear(),!!r){for(var a={inHover:!0,viewWidth:this._width,viewHeight:this._height},i,o=0;o<r;o++){var s=e[o];s.__inHover&&(n||(n=this._hoverlayer=this.getLayer(Fx)),i||(i=n.ctx,i.save()),za(i,s,a,o===r-1))}i&&i.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(Fx)},t.prototype.paintOne=function(e,r){P_(e,r)},t.prototype._paintList=function(e,r,n,a){if(this._redrawId===a){n=n||!1,this._updateLayerStatus(e);var i=this._doPaintList(e,r,n),o=i.finished,s=i.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),s&&this._paintHoverList(e),o)this.eachLayer(function(c){c.afterBrush&&c.afterBrush()});else{var l=this;kc(function(){l._paintList(e,r,n,a)})}}},t.prototype._compositeManually=function(){var e=this.getLayer($a).ctx,r=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,r,n),this.eachBuiltinLayer(function(a){a.virtual&&e.drawImage(a.dom,0,0,r,n)})},t.prototype._doPaintList=function(e,r,n){for(var a=this,i=[],o=this._opts.useDirtyRect,s=0;s<this._zlevelList.length;s++){var l=this._zlevelList[s],c=this._layers[l];c.__builtin__&&c!==this._hoverlayer&&(c.__dirty||n)&&i.push(c)}for(var u=!0,f=!1,h=function(m){var g=i[m],v=g.ctx,y=o&&g.createRepaintRects(e,r,d._width,d._height),b=n?g.__startIndex:g.__drawIndex,x=!n&&g.incremental&&Date.now,w=x&&Date.now(),S=g.zlevel===d._zlevelList[0]?d._backgroundColor:null;if(g.__startIndex===g.__endIndex)g.clear(!1,S,y);else if(b===g.__startIndex){var k=e[b];(!k.incremental||!k.notClear||n)&&g.clear(!1,S,y)}b===-1&&(console.error("For some unknown reason. drawIndex is -1"),b=g.__startIndex);var C,A=function(L){var R={inHover:!1,allClipped:!1,prevEl:null,viewWidth:a._width,viewHeight:a._height};for(C=b;C<g.__endIndex;C++){var O=e[C];if(O.__inHover&&(f=!0),a._doPaintEl(O,g,o,L,R,C===g.__endIndex-1),x){var B=Date.now()-w;if(B>15)break}}R.prevElClipPaths&&v.restore()};if(y)if(y.length===0)C=g.__endIndex;else for(var M=d.dpr,T=0;T<y.length;++T){var D=y[T];v.save(),v.beginPath(),v.rect(D.x*M,D.y*M,D.width*M,D.height*M),v.clip(),A(D),v.restore()}else v.save(),A(),v.restore();g.__drawIndex=C,g.__drawIndex<g.__endIndex&&(u=!1)},d=this,p=0;p<i.length;p++)h(p);return _e.wxa&&I(this._layers,function(m){m&&m.ctx&&m.ctx.draw&&m.ctx.draw()}),{finished:u,needsRefreshHover:f}},t.prototype._doPaintEl=function(e,r,n,a,i,o){var s=r.ctx;if(n){var l=e.getPaintRect();(!a||l&&l.intersect(a))&&(za(s,e,i,o),e.setPrevPaintRect(l))}else za(s,e,i,o)},t.prototype.getLayer=function(e,r){this._singleCanvas&&!this._needsManuallyCompositing&&(e=$a);var n=this._layers[e];return n||(n=new vp("zr_"+e,this,this.dpr),n.zlevel=e,n.__builtin__=!0,this._layerConfig[e]?Oe(n,this._layerConfig[e],!0):this._layerConfig[e-Kc]&&Oe(n,this._layerConfig[e-Kc],!0),r&&(n.virtual=r),this.insertLayer(e,n),n.initContext()),n},t.prototype.insertLayer=function(e,r){var n=this._layers,a=this._zlevelList,i=a.length,o=this._domRoot,s=null,l=-1;if(!n[e]&&lR(r)){if(i>0&&e>a[0]){for(l=0;l<i-1&&!(a[l]<e&&a[l+1]>e);l++);s=n[a[l]]}if(a.splice(l+1,0,e),n[e]=r,!r.virtual)if(s){var c=s.dom;c.nextSibling?o.insertBefore(r.dom,c.nextSibling):o.appendChild(r.dom)}else o.firstChild?o.insertBefore(r.dom,o.firstChild):o.appendChild(r.dom);r.painter||(r.painter=this)}},t.prototype.eachLayer=function(e,r){for(var n=this._zlevelList,a=0;a<n.length;a++){var i=n[a];e.call(r,this._layers[i],i)}},t.prototype.eachBuiltinLayer=function(e,r){for(var n=this._zlevelList,a=0;a<n.length;a++){var i=n[a],o=this._layers[i];o.__builtin__&&e.call(r,o,i)}},t.prototype.eachOtherLayer=function(e,r){for(var n=this._zlevelList,a=0;a<n.length;a++){var i=n[a],o=this._layers[i];o.__builtin__||e.call(r,o,i)}},t.prototype.getLayers=function(){return this._layers},t.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(f,h){f.__dirty=f.__used=!1});function r(f){i&&(i.__endIndex!==f&&(i.__dirty=!0),i.__endIndex=f)}if(this._singleCanvas)for(var n=1;n<e.length;n++){var a=e[n];if(a.zlevel!==e[n-1].zlevel||a.incremental){this._needsManuallyCompositing=!0;break}}var i=null,o=0,s,l;for(l=0;l<e.length;l++){var a=e[l],c=a.zlevel,u=void 0;s!==c&&(s=c,o=0),a.incremental?(u=this.getLayer(c+sR,this._needsManuallyCompositing),u.incremental=!0,o=1):u=this.getLayer(c+(o>0?Kc:0),this._needsManuallyCompositing),u.__builtin__||Eu("ZLevel "+c+" has been used by unkown layer "+u.id),u!==i&&(u.__used=!0,u.__startIndex!==l&&(u.__dirty=!0),u.__startIndex=l,u.incremental?u.__drawIndex=-1:u.__drawIndex=l,r(l),i=u),a.__dirty&ir&&!a.__inHover&&(u.__dirty=!0,u.incremental&&u.__drawIndex<0&&(u.__drawIndex=l))}r(l),this.eachBuiltinLayer(function(f,h){!f.__used&&f.getElementCount()>0&&(f.__dirty=!0,f.__startIndex=f.__endIndex=f.__drawIndex=0),f.__dirty&&f.__drawIndex<0&&(f.__drawIndex=f.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(e){e.clear()},t.prototype.setBackgroundColor=function(e){this._backgroundColor=e,I(this._layers,function(r){r.setUnpainted()})},t.prototype.configLayer=function(e,r){if(r){var n=this._layerConfig;n[e]?Oe(n[e],r,!0):n[e]=r;for(var a=0;a<this._zlevelList.length;a++){var i=this._zlevelList[a];if(i===e||i===e+Kc){var o=this._layers[i];Oe(o,n[e],!0)}}}},t.prototype.delLayer=function(e){var r=this._layers,n=this._zlevelList,a=r[e];a&&(a.dom.parentNode.removeChild(a.dom),delete r[e],n.splice(Ue(n,e),1))},t.prototype.resize=function(e,r){if(this._domRoot.style){var n=this._domRoot;n.style.display="none";var a=this._opts,i=this.root;if(e!=null&&(a.width=e),r!=null&&(a.height=r),e=Pc(i,0,a),r=Pc(i,1,a),n.style.display="",this._width!==e||r!==this._height){n.style.width=e+"px",n.style.height=r+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(e,r);this.refresh(!0)}this._width=e,this._height=r}else{if(e==null||r==null)return;this._width=e,this._height=r,this.getLayer($a).resize(e,r)}return this},t.prototype.clearLayer=function(e){var r=this._layers[e];r&&r.clear()},t.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},t.prototype.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas&&!this._compositeManually)return this._layers[$a].dom;var r=new vp("image",this,e.pixelRatio||this.dpr);r.initContext(),r.clear(!1,e.backgroundColor||this._backgroundColor);var n=r.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var a=r.dom.width,i=r.dom.height;this.eachLayer(function(f){f.__builtin__?n.drawImage(f.dom,0,0,a,i):f.renderToCanvas&&(n.save(),f.renderToCanvas(n),n.restore())})}else for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height},s=this.storage.getDisplayList(!0),l=0,c=s.length;l<c;l++){var u=s[l];za(n,u,o,l===c-1)}return r.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t})();function fR(t){t.registerPainter("canvas",uR)}Zn([oR,sA,fR,tR,iP,WP,zM,OP]);const Wa={background:"#ffffff",border:"#dce4e9",muted:"#5b7186",surface:"#ffffff",text:"#0f1e2a",colors:["#2f7f55","#2563eb","#d97706","#7c3aed"]},Hx="cf-widget-category-zoom",Vx=.68,$i=t=>({startIndex:0,endIndex:Math.max(0,t-1)}),cs=(t,e)=>{if(e<=0)return $i(0);let r=e-1,n=Math.max(0,Math.min(r,Math.floor(Math.min(t.startIndex,t.endIndex))));return{startIndex:n,endIndex:Math.max(n,Math.min(r,Math.floor(Math.max(t.startIndex,t.endIndex))))}},Ux=(t,e,r)=>{let n=cs(t,r);if(r<=2)return $i(r);let a=n.endIndex-n.startIndex+1,i=e==="in"?Math.max(2,Math.floor(a*Vx)):Math.min(r,Math.ceil(a/Vx));if(i===a)return n;let o=(n.startIndex+n.endIndex)/2,s=r-i,l=Math.max(0,Math.min(s,Math.round(o-(i-1)/2)));return{startIndex:l,endIndex:l+i-1}},dR=(t,e)=>{let r=t.length;if(r===0)return"No chart points";let n=cs(e,r);if(n.startIndex===0&&n.endIndex===r-1)return`All ${r} ${r===1?"point":"points"}`;let a=n.endIndex-n.startIndex+1;return`${t[n.startIndex]} – ${t[n.endIndex]} · ${a} of ${r} points`},hR=t=>{let e=t.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:"Value"},pR=t=>{let e=new Set,r=[];return t.forEach(n=>{let a=n?.trim();!a||e.has(a)||(e.add(a),r.push(a))}),r},gp=t=>{if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&t.trim()){let e=Number(t);if(Number.isFinite(e))return e}return null},jc=t=>{if(t===null)return"null:";if(t===void 0)return"undefined:";if(typeof t=="object")try{return`object:${JSON.stringify(t)}`}catch{return"object:"}return`${typeof t}:${String(t)}`},Jc=(t,e)=>e?t.columnMetadata?.find(r=>r.key===e):void 0,mp=(t,e)=>Jc(t,e)?.label?.trim()||hR(e),Gx=(t,e,r)=>{if(r==null||r==="")return"Not set";let n=Jc(t,e);if(n?.dataType==="boolean"){let a=String(r).trim().toLowerCase();return r===!1||r===0||["0","false","no"].includes(a)?"No":"Yes"}if(n?.dataType==="date"||n?.dataType==="datetime"){let a=new Date(r);if(!Number.isNaN(a.getTime()))try{return new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric",timeZone:t.timezone||"UTC"}).format(a)}catch{return new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric",timeZone:"UTC"}).format(a)}}return String(r)},us=(t,e,r,n=!1)=>{if(e?.dataType==="currency"){let a=e.currencyCode||r?.currency?.code;if(a)return new Intl.NumberFormat(void 0,{style:"currency",currency:a,notation:n&&Math.abs(t)>=1e4?"compact":"standard",maximumFractionDigits:2}).format(t)}return e?.dataType==="percent"?new Intl.NumberFormat(void 0,{style:"percent",maximumFractionDigits:2}).format(Math.abs(t)>1?t/100:t):new Intl.NumberFormat(void 0,{notation:n&&Math.abs(t)>=1e4?"compact":"standard",maximumFractionDigits:2}).format(t)},vR=(t,e)=>{if(t.presentation==="table"||t.presentation==="kpi")return null;if(e)return e;let r=t.chartRecommendation?.type;return r==="line"||r==="bar"||r==="stacked_bar"?r:t.type==="line"||t.type==="bar"||t.type==="stacked_bar"?t.type:null},gR=t=>t.chartRecommendation?.categoryField?.trim()||t.label?.trim()||t.columnMetadata?.find(e=>["date","dimension","geography","boolean"].includes(e.semanticRole))?.key||t.columns?.[0],mR=t=>t.chartRecommendation?.seriesField?.trim()||t.seriesField?.trim()||t.series?.trim()||void 0,yR=(t,e,r)=>{let n=pR([...t.chartRecommendation?.valueFields??[],...t.valueFields??[],t.value,...t.columnMetadata?.filter(i=>i.semanticRole==="measure").map(i=>i.key)??[]]),a=new Set([...t.columns??[],...t.columnMetadata?.map(i=>i.key)??[],...Object.keys(t.rows?.[0]??{})]);return n.filter(i=>i!==e&&i!==r&&a.has(i)).filter(i=>t.rows?.some(o=>gp(o[i])!==null))},_R=(t,e,r,n,a)=>{let i=a?` Showing 4 of ${n.length+a} series.`:"";if(e==="line"){let s=r.length-1,l=n.map(c=>{let u=c.values[s];return u==null?null:`${c.name}: ${us(u,c.valueColumn,t)}`}).filter(c=>!!c);return l.length?`Latest (${r[s]}): ${l.join("; ")}.${i}`:`No numeric trend values are available.${i}`}let o;return n.forEach(s=>{s.values.forEach((l,c)=>{l===null||o&&l<=o.value||(o={category:r[c]??"Not set",series:s,value:l})})}),o?`Highest: ${o.category}, ${o.series.name} ${us(o.value,o.series.valueColumn,t)}.${i}`:`No numeric comparison values are available.${i}`},yp=(t,e)=>{let r=vR(t,e),n=gR(t),a=t.rows??[];if(!r||!n||a.length===0)return null;let i=mR(t),o=yR(t,n,i);if(o.length===0)return null;let s=o.length===1?i:void 0,l=[],c=new Set;a.forEach(m=>{let g=jc(m[n]);c.has(g)||(c.add(g),l.push({key:g,label:Gx(t,n,m[n])}))});let u=l.map(m=>m.label),f=0,h;if(s){let m=[],g=new Set;a.forEach(b=>{let x=jc(b[s]);g.has(x)||(g.add(x),m.push({key:x,label:Gx(t,s,b[s])}))});let v=m.slice(0,4);f=Math.max(0,m.length-v.length);let y=o[0];h=v.map(b=>{let x=new Map;return a.forEach(w=>{if(jc(w[s])!==b.key)return;let S=jc(w[n]);x.has(S)||x.set(S,gp(w[y]))}),{field:y,name:b.label,values:l.map(w=>x.get(w.key)??null),valueColumn:Jc(t,y)}})}else f=Math.max(0,o.length-4),h=o.slice(0,4).map(m=>({field:m,name:mp(t,m),values:a.map(g=>gp(g[m])),valueColumn:Jc(t,m)}));if(h.length===0)return null;let d=mp(t,n),p="Values";return s?p=mp(t,o[0]):h.length===1&&(p=h[0].name),{type:r,title:t.title?.trim()||`${p} by ${d}`,xAxisTitle:d,yAxisTitle:p,categories:u,series:h,omittedSeriesCount:f,summary:_R(t,r,u,h,f)}},bR=t=>{if(t.presentation==="table"||t.presentation==="kpi")return[];let e=yp(t);if(!e)return[];let r=[{type:"line",label:"Line"},{type:"bar",label:"Bar"}];return e.series.length>1&&r.push({type:"stacked_bar",label:"Stacked bar"}),r},xR=(t,{expanded:e=!1,reducedMotion:r=!1,theme:n=Wa,zoomWindow:a=$i(t.categories.length)}={})=>{let i=t.series.length>1,o=t.type==="stacked_bar",s=t.categories.length>2,l=cs(a,t.categories.length);return{animation:!r,animationDuration:r?0:260,aria:{enabled:!0,decal:{show:!0},label:{description:`${t.title}. ${t.summary}`}},backgroundColor:"transparent",color:n.colors,textStyle:{color:n.text,fontFamily:"inherit"},grid:{top:i?e?48:42:14,right:12,bottom:e?18:10,left:10,containLabel:!0},legend:{show:i,type:"scroll",top:0,left:"center",itemWidth:12,itemHeight:8,textStyle:{color:n.muted,fontSize:e?11:10}},tooltip:{trigger:"axis",triggerOn:"mousemove|click",confine:!0,backgroundColor:n.surface,borderColor:n.border,borderWidth:1,textStyle:{color:n.text,fontSize:12},axisPointer:{type:"line",lineStyle:{color:n.muted,opacity:.5}}},dataZoom:s?[{id:Hx,type:"inside",xAxisIndex:0,startValue:l.startIndex,endValue:l.endIndex,minValueSpan:1,filterMode:"filter",disabled:!0}]:void 0,xAxis:{type:"category",data:t.categories,name:t.xAxisTitle,nameLocation:"middle",nameGap:e?38:32,nameTextStyle:{color:n.muted,fontSize:e?11:10},axisLine:{lineStyle:{color:n.border}},axisTick:{show:!1},axisLabel:{color:n.muted,fontSize:e?11:9,hideOverlap:!0,interval:"auto",rotate:!e&&t.categories.length>5?28:0,formatter:c=>c.length>(e?18:11)?`${c.slice(0,e?16:9)}…`:c}},yAxis:{type:"value",name:t.yAxisTitle,nameLocation:"middle",nameGap:e?52:44,nameTextStyle:{color:n.muted,fontSize:e?11:10},axisLabel:{color:n.muted,fontSize:e?11:9,formatter:c=>us(c,t.series[0]?.valueColumn,void 0,!0)},axisLine:{show:!1},axisTick:{show:!1},splitNumber:4,splitLine:{lineStyle:{color:n.border,opacity:.75}}},series:t.series.map(c=>({type:t.type==="line"?"line":"bar",name:c.name,data:c.values,stack:o?"total":void 0,connectNulls:!1,showSymbol:t.type==="line"&&t.categories.length<=18,symbol:"circle",symbolSize:e?7:6,smooth:!1,maxBarWidth:e?38:28,lineStyle:t.type==="line"?{width:e?3:2.5}:void 0,itemStyle:t.type==="line"?{borderColor:n.background,borderWidth:2}:{borderRadius:o?0:[4,4,0,0]},emphasis:{focus:"series"},tooltip:{valueFormatter:u=>us(u,c.valueColumn)}}))}},wR=t=>{let e=getComputedStyle(t),r=(a,i)=>e.getPropertyValue(a).trim()||i,n=r("--cf-accent",Wa.colors[0]);return{background:r("--cf-bg",Wa.background),border:r("--cf-border",Wa.border),muted:r("--cf-muted",Wa.muted),surface:r("--cf-surface",Wa.surface),text:r("--cf-text",Wa.text),colors:[n,"#2563eb","#d97706","#7c3aed"]}},SR=({model:t,expanded:e=!1})=>{let r=X(null),n=X(null),[a,i]=U(()=>({model:t,window:$i(t.categories.length)})),[o,s]=U(!1),l=a.model===t?cs(a.window,t.categories.length):$i(t.categories.length),c=X(l);c.current=l;let u=g=>{let v=cs(g,t.categories.length);c.current=v,i({model:t,window:v}),n.current?.dispatchAction({type:"dataZoom",dataZoomId:Hx,startValue:v.startIndex,endValue:v.endIndex})};le(()=>{let g=r.current;if(!(!g||typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes("jsdom")))try{let v=fI(g,null,{renderer:"canvas",devicePixelRatio:Math.min(window.devicePixelRatio||1,2)});n.current=v;let y=()=>v.resize(),b=typeof ResizeObserver>"u"?null:new ResizeObserver(y);return b?.observe(g),b||window.addEventListener("resize",y,{passive:!0}),()=>{b?.disconnect(),b||window.removeEventListener("resize",y),v.dispose(),n.current=null}}catch{s(!0);return}},[]),le(()=>{let g=r.current,v=n.current;if(!g||!v)return;let y=typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)").matches;v.setOption(xR(t,{expanded:e,reducedMotion:y,theme:wR(g),zoomWindow:c.current}),{lazyUpdate:!0,notMerge:!0}),v.resize()},[e,t]);let f=!o&&t.categories.length>2,h=l.endIndex-l.startIndex+1,d=l.startIndex===0&&l.endIndex===t.categories.length-1,p=f&&h>2,m=f&&!d;return _(Me,{children:[_("div",{ref:r,class:`cf-analytics-echart${e?" is-expanded":""}`,role:"img","aria-label":`${t.title}. ${t.summary}`,"data-chart-status":o?"fallback":"ready",children:o?_("span",{class:"cf-analytics-echart__fallback",children:t.summary}):null}),f?_("div",{class:"cf-analytics-zoom",children:[_("span",{class:"cf-analytics-zoom__range","aria-live":"polite","aria-atomic":"true",children:dR(t.categories,l)}),_("div",{class:"cf-analytics-zoom__controls",role:"group","aria-label":"Chart zoom controls",children:[_("button",{type:"button","aria-label":"Zoom out chart",title:"Zoom out",disabled:!m,onClick:()=>u(Ux(c.current,"out",t.categories.length)),children:"−"}),_("button",{type:"button",class:"cf-analytics-zoom__reset","aria-label":"Reset chart zoom",title:"Reset zoom",disabled:d,onClick:()=>u($i(t.categories.length)),children:"Reset"}),_("button",{type:"button","aria-label":"Zoom in chart",title:"Zoom in",disabled:!p,onClick:()=>u(Ux(c.current,"in",t.categories.length)),children:"+"})]})]}):null]})},$x=t=>{let e=t.replaceAll("_"," ").replace(/([a-z])([A-Z])/g,"$1 $2").trim();return e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:"Value"},Wx=(t,e)=>(e?.length?e:Object.keys(t[0]??{})).map(r=>typeof r=="string"?{key:r,label:$x(r)}:{...r,label:r.label?.trim()||$x(r.key)}),qx=(t,e,r)=>{if(t==null||t==="")return"—";if((r?.dataType==="date"||r?.dataType==="datetime")&&typeof t=="string"){let n=new Date(t);if(!Number.isNaN(n.getTime()))return new Intl.DateTimeFormat(e,{dateStyle:"medium",...r.dataType==="datetime"?{timeStyle:"short"}:{}}).format(n)}return r?.dataType==="currency"&&typeof t=="number"?new Intl.NumberFormat(e,{style:"currency",currency:r.currencyCode||"USD",maximumFractionDigits:2}).format(t):typeof t=="number"&&Number.isFinite(t)?new Intl.NumberFormat(e,{maximumFractionDigits:4}).format(t):typeof t=="boolean"?t?"Yes":"No":String(t)},Yx=t=>{let e=String(t??"");return/[",\r\n]/.test(e)?`"${e.replaceAll('"','""')}"`:e},kR=(t,e)=>{let r=Wx(t,e);return[r.map(n=>Yx(n.label)).join(","),...t.map(n=>r.map(a=>Yx(n[a.key])).join(","))].join(`\r
|
|
23
|
-
`)},TR=({rows:t,columns:e,maxRows:r=100,locale:n,expanded:a=!1,classPrefix:i="cr",pageSize:o=10})=>{let s=Ht(()=>Wx(t,e),[e,t]),l=s.map(P=>P.key).join("\0"),[c,u]=U(()=>s.map(P=>P.key)),[f,h]=U(""),[d,p]=U(),[m,g]=U("asc"),[v,y]=U([]),[b,x]=U("table"),[w,S]=U(1),[k,C]=U(o);le(()=>{u(s.map(P=>P.key)),p(void 0),y([]),S(1)},[l]);let A=s.filter(P=>c.includes(P.key)),M=Ht(()=>{let P=f.toLocaleLowerCase(n),V=t.map((H,Z)=>({row:H,index:Z})).filter(({row:H})=>A.some(Z=>qx(H[Z.key],n,Z).toLocaleLowerCase(n).includes(P)));return d?V.sort((H,Z)=>{let re=H.row[d],Te=Z.row[d],ge=typeof re=="number"?re:NaN,xe=typeof Te=="number"?Te:NaN,Ce=!Number.isNaN(ge)&&!Number.isNaN(xe)?ge-xe:String(re??"").localeCompare(String(Te??""),n,{numeric:!0,sensitivity:"base"});return m==="asc"?Ce:-Ce}):V},[A,n,f,t,m,d]),T=M.slice(0,Math.max(1,r)),D=Math.max(1,Math.ceil(T.length/k)),L=Math.min(w,D),R=a?T:T.slice((L-1)*k,L*k),O=R.length>0&&R.every(({index:P})=>v.includes(P)),B=P=>`${i}-${P}`;if(t.length===0||s.length===0)return _("div",{class:B("table-note"),children:"No rows returned."});let j=P=>{let V=new Set(R.map(({index:H})=>H));y(H=>P?[...new Set([...H,...V])]:H.filter(Z=>!V.has(Z)))};return _("section",{class:B("data-table"),children:[_("div",{class:B("table-fields"),children:[_("strong",{children:"Fields"}),_("div",{class:B("field-list"),children:s.map(P=>_("span",{class:B("field-chip"),children:P.label},P.key))}),_("span",{class:B("table-field-count"),children:[t.length.toLocaleString(n)," rows"]})]}),_("div",{class:B("table-controls"),children:[_("label",{class:B("table-search"),children:[_("span",{"aria-hidden":"true",children:"⌕"}),_("input",{type:"search",value:f,placeholder:"Search this result...","aria-label":"Search this result",onInput:P=>{h(P.currentTarget.value.trim()),S(1)}})]}),_("div",{class:B("table-modes"),role:"group","aria-label":"Table display mode",children:["table","matrix"].map(P=>_("button",{type:"button",class:`${B("segment")}${b===P?" is-active":""}`,"aria-pressed":b===P,onClick:()=>x(P),children:P==="table"?"Table":"Matrix"},P))})]}),_("div",{class:B("table-column-bar"),children:_("details",{class:B("column-picker"),children:[_("summary",{children:"Columns"}),_("div",{class:B("column-menu"),children:s.map(P=>_("label",{children:[_("input",{type:"checkbox",checked:c.includes(P.key),onChange:V=>{let H=V.currentTarget.checked;u(Z=>H?[...new Set([...Z,P.key])]:Z.length>1?Z.filter(re=>re!==P.key):Z)}}),_("span",{children:P.label})]},P.key))})]})}),_("div",{class:B("table-wrap"),role:"region","aria-label":"Scrollable result table",tabIndex:0,children:_("table",{class:`${B("table")}${b==="matrix"?" is-matrix":""}`,children:[_("caption",{class:B("visually-hidden"),children:["Result table with ",M.length," ",M.length===1?"row":"rows"]}),_("thead",{children:_("tr",{children:[_("th",{class:B("select-cell"),children:_("input",{type:"checkbox","aria-label":"Select all visible rows",checked:O,onChange:P=>j(P.currentTarget.checked)})}),A.map(P=>_("th",{scope:"col",children:_("button",{type:"button",class:B("table-sort"),"aria-label":`Sort by ${P.label}`,onClick:()=>{d===P.key?g(V=>V==="asc"?"desc":"asc"):(p(P.key),g("asc")),S(1)},children:[_("span",{children:P.label}),_("span",{class:B("sort-direction"),"aria-hidden":"true",children:d===P.key?m==="asc"?"↑":"↓":"↕"})]})},P.key))]})}),_("tbody",{children:R.map(({row:P,index:V})=>_("tr",{class:v.includes(V)?"is-selected":void 0,children:[_("td",{class:B("select-cell"),children:_("input",{type:"checkbox","aria-label":`Select row ${V+1}`,checked:v.includes(V),onChange:H=>y(Z=>H.currentTarget.checked?[...new Set([...Z,V])]:Z.filter(re=>re!==V))})}),A.map(H=>_("td",{children:qx(P[H.key],n,H)},H.key))]},V))})]})}),_("div",{class:B("table-summary"),children:[_("span",{children:T.length?`${((L-1)*k+1).toLocaleString(n)}-${Math.min(L*k,T.length).toLocaleString(n)} of ${M.length.toLocaleString(n)}`:`0 of ${M.length.toLocaleString(n)}`}),a?_("span",{children:t.length>r?`First ${r.toLocaleString(n)} rows available`:"All returned rows loaded"}):_("div",{class:B("table-pagination"),"aria-label":"Table pagination",children:[_("label",{children:[_("span",{children:"Rows"}),_("select",{"aria-label":"Rows per page",value:k,onChange:P=>{C(Number(P.currentTarget.value)),S(1)},children:[10,25,50].map(P=>_("option",{value:P,children:P},P))})]}),_("button",{type:"button","aria-label":"Previous page",disabled:L<=1,onClick:()=>S(P=>Math.max(1,P-1)),children:"‹"}),_("span",{children:[L," / ",D]}),_("button",{type:"button","aria-label":"Next page",disabled:L>=D,onClick:()=>S(P=>Math.min(D,P+1)),children:"›"})]})]})]})},_p=16e3;class CR{constructor(e){se(this,"ratio");se(this,"position",0);se(this,"carry",[]);this.ratio=e/_p}process(e){if(this.ratio===1)return e.slice();const r=this.carry.length?Float32Array.from([...this.carry,...e]):e,n=[];let a=this.position;for(;a+this.ratio<=r.length;){const o=Math.floor(a),s=Math.min(r.length,Math.floor(a+this.ratio));let l=0;for(let c=o;c<s;c+=1)l+=r[c]??0;n.push(s>o?l/(s-o):0),a+=this.ratio}const i=Math.floor(a);return this.carry=Array.from(r.subarray(i)),this.position=a-i,Float32Array.from(n)}}const MR=(t,e=_p)=>{const r=t.reduce((s,l)=>s+l.length,0),n=new ArrayBuffer(44+r*2),a=new DataView(n),i=(s,l)=>{for(let c=0;c<l.length;c+=1)a.setUint8(s+c,l.charCodeAt(c))};i(0,"RIFF"),a.setUint32(4,36+r*2,!0),i(8,"WAVE"),i(12,"fmt "),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,e,!0),a.setUint32(28,e*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),i(36,"data"),a.setUint32(40,r*2,!0);let o=44;for(const s of t)for(let l=0;l<s.length;l+=1){const c=Math.max(-1,Math.min(1,s[l]??0));a.setInt16(o,c<0?c*32768:c*32767,!0),o+=2}return new Blob([n],{type:"audio/wav"})},Xx=t=>t.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").split(/\s+/).filter(e=>e.length>1),AR=(t,e)=>{const r=Xx(t);if(r.length===0||!e.trim())return!1;const n=new Set(Xx(e));return r.filter(a=>n.has(a)).length/r.length>=.7},Zx=300,DR=()=>{const t=globalThis;if(t.__voiceDebug)return!0;try{return t.localStorage?.getItem("accurix.voiceDebug")==="1"}catch{return!1}};class IR{constructor(e=()=>Date.now()){se(this,"now");se(this,"entries",[]);se(this,"startedAt");this.now=e,this.startedAt=e(),globalThis.__accurixVoiceLog=()=>this.list()}add(e,r){const n={at:Math.round(this.now()-this.startedAt),event:e,detail:r};this.entries.push(n),this.entries.length>Zx&&this.entries.splice(0,this.entries.length-Zx),DR()&&console.debug(`VOICEDBG ${e} ${r?JSON.stringify(r):""}`)}list(){return this.entries.slice()}}const bp=_p/50,Jt=20,LR=500,PR=120,RR=300,ER=280,OR=600,NR=300,BR=12e3,zR=25e3,FR=300,HR=2e4,VR=60,UR=400,GR=250,xp=8e-4,$R=.1,WR=2.8,qR=1.8,YR=.006,XR=.004,ZR=1.8,KR=1.4,jR=2e3,JR=2e3;class QR{constructor(e){se(this,"options");se(this,"endSilenceMs");se(this,"pending",new Float32Array(0));se(this,"levels",[]);se(this,"framesSinceFloor",0);se(this,"floor",xp*4);se(this,"recentSpeech",[]);se(this,"preroll",[]);se(this,"silentMs",0);se(this,"inputSilent",!1);se(this,"outputActive",!1);se(this,"turns",[]);se(this,"nextTurnId",1);this.options=e,this.endSilenceMs=e.endSilenceMs??JR}get hearing(){return this.current()?.capturing??!1}get processing(){return this.turns.some(e=>!e.capturing&&!e.cancelled)}feed(e){let r=e;this.pending.length&&(r=new Float32Array(this.pending.length+e.length),r.set(this.pending),r.set(e,this.pending.length));let n=0;for(;n+bp<=r.length;)this.frame(r.slice(n,n+bp)),n+=bp;this.pending=r.slice(n)}setOutputActive(e){this.outputActive!==e&&(this.outputActive=e,this.options.log.add("output",{active:e}))}finishTurn(){const e=this.current();e&&(e.capturing?this.endTurn(e,"done"):e.closed||(e.closed=!0,e.endedBy="done",this.options.log.add("turn-done",{turn:e.id})))}reset(e){for(const r of this.turns)r.cancelled=!0;this.turns.length&&this.options.log.add("turns-dropped",{reason:e,count:this.turns.length}),this.turns=[],this.preroll=[],this.recentSpeech=[],this.pending=new Float32Array(0),this.options.onChange()}current(){return this.turns[this.turns.length-1]}frame(e){let r=0,n=0;for(let f=0;f<e.length;f+=1){const h=e[f]??0;r+=h*h,n=Math.max(n,Math.abs(h))}const a=Math.sqrt(r/e.length);this.trackInputSilence(n);const i=this.current();!i?.capturing&&!this.outputActive&&this.trackFloor(a);const o=this.outputActive,s=Math.max(YR,this.floor*WR)*(o?ZR:1),l=Math.max(XR,this.floor*qR)*(o?KR:1),c=a>=s,u=a>=l;if(!i?.capturing){for(this.preroll.push(e);this.preroll.length*Jt>LR;)this.preroll.shift();this.recentSpeech.push(c);const f=(o?OR:RR)/Jt;for(;this.recentSpeech.length>f;)this.recentSpeech.shift();const h=this.recentSpeech.filter(Boolean).length*Jt;h>=(o?ER:PR)&&this.beginCapture(h);return}i.chunk.push(e),i.chunkMs+=Jt,i.durationMs+=Jt,c&&(i.voicedMs+=Jt,i.chunkVoicedMs+=Jt),i.quietMs=u?0:i.quietMs+Jt,o&&(i.overlappedOutput=!0),i.quietMs>=this.endSilenceMs?this.endTurn(i,"silence"):(i.chunkMs>=zR||i.chunkMs>=BR&&i.quietMs>=FR||i.chunkMs>=HR&&i.quietMs>=VR)&&this.cutChunk(i)}trackFloor(e){if(this.levels.push(e),this.levels.length>GR&&this.levels.shift(),this.framesSinceFloor+=1,this.framesSinceFloor<10&&this.levels.length>10)return;this.framesSinceFloor=0;const r=this.levels.slice().sort((n,a)=>n-a);this.floor=Math.max(xp,r[Math.floor(r.length*$R)]??xp)}trackInputSilence(e){this.silentMs=e===0?this.silentMs+Jt:0;const r=this.silentMs>=jR;r!==this.inputSilent&&(this.inputSilent=r,this.options.log.add("input-silent",{silent:r}),this.options.onInputSilent?.(r))}beginCapture(e){const r=this.current();let n;r&&!r.capturing&&!r.closed?(n=r,n.capturing=!0,this.options.log.add("turn-resumed",{turn:n.id})):(n={id:this.nextTurnId++,capturing:!0,closed:!1,endedBy:"silence",chunk:[],chunkMs:0,chunkVoicedMs:0,quietMs:0,voicedMs:0,durationMs:0,overlappedOutput:this.outputActive,results:[],chunkCount:0,cancelled:!1},this.turns.push(n),this.options.log.add("turn-start",{turn:n.id,overOutput:this.outputActive}),this.options.listener.speechStart?.({turnId:n.id,overlappedOutput:this.outputActive})),n.chunk.push(...this.preroll),n.chunkMs+=this.preroll.length*Jt,n.durationMs+=this.preroll.length*Jt,n.voicedMs+=e,n.chunkVoicedMs+=e,n.quietMs=0,this.preroll=[],this.recentSpeech=[],this.options.onChange()}endTurn(e,r){const n=Math.max(0,Math.floor((e.quietMs-UR)/Jt));if(n>0&&(e.chunk.splice(e.chunk.length-Math.min(n,e.chunk.length)),e.chunkMs=e.chunk.length*Jt),e.capturing=!1,e.endedBy=r,r==="done"&&(e.closed=!0),this.options.log.add("turn-end",{turn:e.id,by:r,ms:e.durationMs,voicedMs:e.voicedMs}),e.chunkCount===0&&e.voicedMs<NR){this.turns=this.turns.filter(a=>a!==e),this.options.log.add("turn-noise",{turn:e.id,reason:"too-short"}),this.options.listener.noise?.({id:e.id,reason:"too-short",overlappedOutput:e.overlappedOutput}),this.options.onChange();return}this.cutChunk(e),this.options.onChange(),this.settle()}cutChunk(e){if(e.chunk.length===0)return;const r=e.chunk,n=e.chunkCount;e.chunkCount+=1,e.results[n]=void 0,e.chunk=[];const a=r.length*Jt,i=e.chunkVoicedMs;if(e.chunkMs=0,e.chunkVoicedMs=0,i===0&&n>0){e.results[n]="";return}this.options.log.add("chunk",{turn:e.id,index:n,ms:a}),this.options.transcribe({audio:MR(r),mimeType:"audio/wav",durationSeconds:a/1e3,turnId:e.id,chunkIndex:n}).then(o=>(o??"").trim(),()=>null).then(o=>{if(e.cancelled)return;e.results[n]=o,this.options.log.add("chunk-text",{turn:e.id,index:n,chars:o===null?-1:o.length});const s=[];for(const l of e.results){if(l===void 0)break;l&&s.push(l)}s.length&&this.options.listener.partial?.({turnId:e.id,text:s.join(" ")}),this.settle()})}settle(){for(;this.turns.length;){const e=this.turns[0];if(!e||e.capturing||e.results.some(i=>i===void 0))return;this.turns.shift();const r=e.results.filter(i=>typeof i=="string"&&i!==""),n=e.results.every(i=>i===null),a=r.join(" ").replace(/\s+/g," ").trim();if(a)this.options.log.add("turn",{turn:e.id,chars:a.length,by:e.endedBy}),this.options.listener.turn?.({id:e.id,text:a,durationMs:e.durationMs,endedBy:e.endedBy,overlappedOutput:e.overlappedOutput});else{const i=n?"transcribe-failed":"empty-transcript";this.options.log.add("turn-noise",{turn:e.id,reason:i}),this.options.listener.noise?.({id:e.id,reason:i,overlappedOutput:e.overlappedOutput})}this.options.onChange()}}}const e5=2048,t5=[300,1e3,2500],r5=()=>typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof globalThis.AudioContext=="function",n5=t=>{const e=t?.name;return e==="NotAllowedError"||e==="SecurityError"?"permission-denied":e==="NotFoundError"||e==="OverconstrainedError"?"no-device":"error"};class Kx{constructor(e){se(this,"options");se(this,"log",new IR);se(this,"turns");se(this,"mic","off");se(this,"reason");se(this,"muted",!1);se(this,"inputSilent",!1);se(this,"stream",null);se(this,"context",null);se(this,"source",null);se(this,"processor",null);se(this,"sink",null);se(this,"downsampler",null);se(this,"deviceId");se(this,"generation",0);se(this,"recoveryAttempt",0);se(this,"recoveryTimer",null);se(this,"lastSnapshot","");se(this,"groupId");se(this,"onTrackEnded",()=>{this.log.add("track-ended"),this.recover("track-ended")});se(this,"onTrackMuteChange",()=>{const e=this.stream?.getAudioTracks()[0];this.log.add("track-mute-change",{muted:!!e?.muted}),this.refreshMic()});se(this,"onContextState",()=>{const e=this.context?.state;this.log.add("audio-state",{state:e}),(e==="suspended"||e==="interrupted")&&this.context?.resume().catch(()=>{}),this.refreshMic()});se(this,"onDeviceChange",()=>{this.checkDevices()});this.options=e,this.deviceId=e.deviceId,this.turns=new QR({transcribe:e.transcribe,listener:e.listener,log:this.log,endSilenceMs:e.endSilenceMs,onChange:()=>this.publish(),onInputSilent:r=>{this.inputSilent=r,this.publish()}})}get snapshot(){let e=this.mic,r=this.reason;return e==="listening"&&this.inputSilent&&(e="unavailable",r="input-silent"),e==="listening"&&this.turns.hearing&&(e="hearing"),{mic:e,processing:this.turns.processing,reason:e==="unavailable"?r:void 0}}get active(){return this.mic!=="off"}async start(){this.mic==="off"&&(this.log.add("start"),this.mediaDevices()?.addEventListener("devicechange",this.onDeviceChange),await this.open("start"))}stop(e="stopped"){this.mic!=="off"&&(this.log.add("stop",{reason:e}),this.generation+=1,this.clearRecovery(),this.mediaDevices()?.removeEventListener("devicechange",this.onDeviceChange),this.turns.reset(e),this.close(),this.context?.close().catch(()=>{}),this.context=null,this.setMic("off"))}setMuted(e){if(!(this.muted===e||this.mic==="off")){this.muted=e,this.log.add(e?"mute":"unmute");for(const r of this.stream?.getAudioTracks()??[])r.enabled=!e;e?(this.turns.reset("muted"),this.setMic("muted")):this.refreshMic()}}finishTurn(){this.log.add("done-pressed"),this.turns.finishTurn()}setOutputActive(e){this.turns.setOutputActive(e)}async selectDevice(e){e!==this.deviceId&&(this.deviceId=e,this.mic!=="off"&&(this.log.add("device-selected"),this.turns.reset("device-selected"),this.close(),await this.open("device-selected")))}mediaDevices(){return this.options.media?.mediaDevices??(typeof navigator<"u"?navigator.mediaDevices:void 0)}async open(e){const r=++this.generation;this.setMic("starting");const n=this.options.media?.getUserMedia??(r5()?i=>navigator.mediaDevices.getUserMedia(i):null);if(!n){this.unavailable("unsupported");return}let a;try{a=await n({audio:{...this.deviceId?{deviceId:{exact:this.deviceId}}:{},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(i){if(r!==this.generation)return;const o=n5(i);if(this.log.add("mic-open-failed",{why:e,reason:o}),o==="no-device"&&this.deviceId){this.deviceId=void 0,await this.open("default-device");return}this.unavailable(o);return}if(r!==this.generation){a.getTracks().forEach(i=>i.stop());return}try{this.connect(a)}catch(i){this.log.add("audio-setup-failed",{message:String(i?.name??"error")}),a.getTracks().forEach(o=>o.stop()),this.unavailable("error");return}this.recoveryAttempt=0,this.groupId=a.getAudioTracks()[0]?.getSettings?.().groupId,this.log.add("mic-open",{why:e}),this.refreshMic()}connect(e){this.stream=e;for(const n of e.getAudioTracks())n.enabled=!this.muted,n.addEventListener("ended",this.onTrackEnded),n.addEventListener("mute",this.onTrackMuteChange),n.addEventListener("unmute",this.onTrackMuteChange);const r=this.context??this.options.media?.createAudioContext?.()??new globalThis.AudioContext;this.context||(this.context=r,r.addEventListener("statechange",this.onContextState)),r.state==="suspended"&&r.resume().catch(()=>{}),this.downsampler=new CR(r.sampleRate),this.source=r.createMediaStreamSource(e),this.processor=r.createScriptProcessor(e5,1,1),this.sink=r.createGain(),this.sink.gain.value=0,this.processor.onaudioprocess=n=>{if(this.muted||!this.downsampler)return;const a=this.downsampler.process(n.inputBuffer.getChannelData(0));if(this.turns.feed(a),this.options.listener.level&&a.length){let i=0;for(const o of a)i+=o*o;this.options.listener.level(Math.sqrt(i/a.length))}},this.source.connect(this.processor),this.processor.connect(this.sink),this.sink.connect(r.destination)}close(){this.processor&&(this.processor.onaudioprocess=null),this.source?.disconnect(),this.processor?.disconnect(),this.sink?.disconnect(),this.source=null,this.processor=null,this.sink=null;for(const e of this.stream?.getTracks()??[])e.removeEventListener("ended",this.onTrackEnded),e.removeEventListener("mute",this.onTrackMuteChange),e.removeEventListener("unmute",this.onTrackMuteChange),e.stop();this.stream=null,this.inputSilent=!1}refreshMic(){if(this.mic==="off")return;if(this.muted)return this.setMic("muted");const e=this.stream?.getAudioTracks()[0];if(!e||e.readyState!=="live")return this.unavailable("device-lost");if(e.muted)return this.unavailable("track-muted");if(this.context&&this.context.state!=="running")return this.unavailable("audio-suspended");this.reason=void 0,this.setMic("listening")}unavailable(e){this.reason=e,this.setMic("unavailable")}setMic(e){this.mic!==e&&this.log.add("mic",{state:e,reason:e==="unavailable"?this.reason:void 0}),this.mic=e,this.publish()}publish(){const e=this.snapshot,r=JSON.stringify(e);r!==this.lastSnapshot&&(this.lastSnapshot=r,this.options.listener.state?.(e))}recover(e){if(this.mic==="off"||this.recoveryTimer)return;const r=t5[this.recoveryAttempt];if(this.turns.reset(e),this.close(),r===void 0){this.log.add("mic-recovery-gave-up",{why:e}),this.unavailable("device-lost");return}this.recoveryAttempt+=1,this.unavailable("device-lost"),this.log.add("mic-recovering",{why:e,attempt:this.recoveryAttempt}),this.recoveryTimer=setTimeout(()=>{this.recoveryTimer=null,this.mic!=="off"&&this.open(e)},r)}clearRecovery(){this.recoveryTimer&&clearTimeout(this.recoveryTimer),this.recoveryTimer=null,this.recoveryAttempt=0}async checkDevices(){const e=this.stream?.getAudioTracks()[0];if(!e||e.readyState!=="live"){this.log.add("device-change",{live:!1}),this.recover("device-change");return}let r=[];try{r=(await this.mediaDevices()?.enumerateDevices()??[]).filter(o=>o.kind==="audioinput")}catch{return}const n=r.some(o=>!this.groupId||o.groupId===this.groupId),a=r.find(o=>o.deviceId==="default"),i=!this.deviceId&&a!==void 0&&this.groupId!==void 0&&a.groupId!==this.groupId;this.log.add("device-change",{live:!0,ours:n,defaultMoved:i}),(!n||i)&&this.recover("device-change")}}const a5=[{name:"Smileys",emojis:["😀","😃","😄","😁","😅","😂","🤣","😊","😇","🙂","🙃","😉","😌","😍","🥰","😘","😋","😛","😜","🤪","🤗","🤭","🤔","🤐","😐","😶","😏","🙄","😴","🥳","😎","🤓","🥺","😢","😭","😤","😠","🤯","😬","😱","🤩","🥱"]},{name:"Gestures",emojis:["👍","👎","👌","🤌","✌️","🤞","🤟","🤘","🤙","👈","👉","👆","👇","✋","🖐️","👋","🤝","🙏","💪","👏","🙌","👐","🤲","🫶"]},{name:"Hearts & symbols",emojis:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","💔","❣️","💕","💖","💘","💝","✨","⭐","🌟","💫","🔥","🎉","🎊","✅","❌","⚡","💯","🚀"]},{name:"Animals & nature",emojis:["🐶","🐱","🦊","🐻","🐼","🐨","🦁","🐮","🐸","🐵","🐧","🦄","🐝","🦋","🐢","🐬","🌷","🌸","🌹","🌻","🌳","🍀"]},{name:"Food & drink",emojis:["🍎","🍌","🍉","🍓","🍒","🥑","🍔","🍟","🍕","🌮","🍿","🍩","🍪","🎂","☕","🍵","🍺","🥂","🍷"]},{name:"Objects & travel",emojis:["🚀","✈️","🚗","🏠","📦","📱","💻","⌚","📷","💡","🔑","🎁","📌","✏️","📝","📞","📧","💰","📈","⏰","🔔","🎯","🏆","🎮","🎵","💬","👀"]}],Qc={"contact-support":{title:"Contact support",submit:"Request support",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"subject",label:"Subject",kind:"text",required:!0},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"Describe what you need help with."}]},inquiry:{title:"Leave a message",submit:"Send message",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"How can we help?"}]},contact:{title:"Share your details",submit:"Save",fields:[{key:"name",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"email",label:"Email",kind:"email",required:!0,identity:"email"},{key:"phone",label:"Phone",kind:"tel",required:!0,identity:"phone"}]},"book-demo":{title:"Book a demo",submit:"Request demo",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"preferredAt",label:"Preferred time",kind:"text",placeholder:"e.g. Thursday 3pm"},{key:"notes",label:"Notes",kind:"textarea",placeholder:"Anything we should know?"}]},"request-callback":{title:"Request a callback",submit:"Request callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"schedule-callback":{title:"Schedule a callback",submit:"Schedule callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"subscribe-newsletter":{title:"Subscribe",submit:"Subscribe",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"}]}},wp={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",reconnectSupport:"Reconnect to support",reconnectPrompt:"I can bring a teammate back into this chat.",waitingForTeam:"AI helping · team notified",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…",voiceHearing:"Hearing you…",voiceUnavailable:"Can’t hear you — check your microphone.",voiceProcessing:"Transcribing…",voiceSpeaking:"Speaking…",voiceNoise:"No clear speech heard. Move closer to the mic and try again.",voiceMisunderstood:"Could not transcribe that. Please try again or type your message.",voiceDenied:"Microphone unavailable. Allow access or type your message.",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 5 MB).",attachFailed:"Could not attach that file. Check its type and try again.",attachPreviewTitle:"Preview of {name}",attachOpen:"Preview {name}",attachDownload:"Download",attachPreviewClose:"Close preview",attachPreviewLoading:"Loading file…",attachPreviewFailed:"This file can’t be shown right now. It may have expired.",attachPreviewUnsupported:"This file can’t be previewed here. Download it to open it.",attachAnalysisFailed:"Saved for the team; AI could not read it.",removeAttachment:"Remove attachment",attachLimit:"You can attach up to {count} files to one message.",attachedFiles:"Attached files",removeAttachmentNamed:"Remove {name}",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.",caseReference:"Reference: {reference}",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",bookingCallbackDuration:"{count}-minute callback",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.",bookingVerificationPending:"We received your request for {when}, but could not verify the calendar booking. Check your email; the team will follow up. Please do not book this time again.",bookingCallbackRequested:"Callback requested for {when}.",bookingCallbackConfirmed:"Your callback is scheduled for {when}.",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. 📅",bookingScheduled:"Your demo is booked. A calendar invitation has been sent to your email.",bookingBackToChat:"Back to chat",bookingOpenNewTab:"Open in new tab",bookingCloseScheduler:"Close scheduler",bookingLoadingScheduler:"Loading scheduler…",bookingMeetingLink:"Meeting link",bookingManageLink:"Manage booking",bookingCheckingDetails:"Getting your meeting link…",bookingDetailsUnavailable:"Your booking is in Calendly, but we could not load the meeting link. Check your calendar invitation or try again.",bookingRetryDetails:"Retry",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"},ct=(t,e)=>t.replace(/\{(\w+)\}/g,(r,n)=>e[n]??""),fs=(t,e,r)=>!e||t.includes(e)?t:`${t} ${ct(r.caseReference,{reference:e})}`,i5=t=>t?{...wp,...t}:wp,jx=iw(wp),o5=jx.Provider,kr=()=>_w(jx),qa=[["AF","Afghanistan","93"],["AL","Albania","355"],["DZ","Algeria","213"],["AS","American Samoa","1684"],["AD","Andorra","376"],["AO","Angola","244"],["AI","Anguilla","1264"],["AG","Antigua and Barbuda","1268"],["AR","Argentina","54"],["AM","Armenia","374"],["AW","Aruba","297"],["AU","Australia","61"],["AT","Austria","43"],["AZ","Azerbaijan","994"],["BS","Bahamas","1242"],["BH","Bahrain","973"],["BD","Bangladesh","880"],["BB","Barbados","1246"],["BY","Belarus","375"],["BE","Belgium","32"],["BZ","Belize","501"],["BJ","Benin","229"],["BM","Bermuda","1441"],["BT","Bhutan","975"],["BO","Bolivia","591"],["BA","Bosnia and Herzegovina","387"],["BW","Botswana","267"],["BR","Brazil","55"],["BN","Brunei","673"],["BG","Bulgaria","359"],["BF","Burkina Faso","226"],["BI","Burundi","257"],["CV","Cabo Verde","238"],["KH","Cambodia","855"],["CM","Cameroon","237"],["CA","Canada","1"],["KY","Cayman Islands","1345"],["CF","Central African Republic","236"],["TD","Chad","235"],["CL","Chile","56"],["CN","China","86"],["CO","Colombia","57"],["KM","Comoros","269"],["CG","Congo","242"],["CD","Congo, Democratic Republic","243"],["CK","Cook Islands","682"],["CR","Costa Rica","506"],["CI","Cote d'Ivoire","225"],["HR","Croatia","385"],["CU","Cuba","53"],["CW","Curacao","599"],["CY","Cyprus","357"],["CZ","Czechia","420"],["DK","Denmark","45"],["DJ","Djibouti","253"],["DM","Dominica","1767"],["DO","Dominican Republic","1809"],["EC","Ecuador","593"],["EG","Egypt","20"],["SV","El Salvador","503"],["GQ","Equatorial Guinea","240"],["ER","Eritrea","291"],["EE","Estonia","372"],["SZ","Eswatini","268"],["ET","Ethiopia","251"],["FO","Faroe Islands","298"],["FJ","Fiji","679"],["FI","Finland","358"],["FR","France","33"],["GF","French Guiana","594"],["PF","French Polynesia","689"],["GA","Gabon","241"],["GM","Gambia","220"],["GE","Georgia","995"],["DE","Germany","49"],["GH","Ghana","233"],["GI","Gibraltar","350"],["GR","Greece","30"],["GL","Greenland","299"],["GD","Grenada","1473"],["GP","Guadeloupe","590"],["GU","Guam","1671"],["GT","Guatemala","502"],["GG","Guernsey","44"],["GN","Guinea","224"],["GW","Guinea-Bissau","245"],["GY","Guyana","592"],["HT","Haiti","509"],["HN","Honduras","504"],["HK","Hong Kong","852"],["HU","Hungary","36"],["IS","Iceland","354"],["IN","India","91"],["ID","Indonesia","62"],["IR","Iran","98"],["IQ","Iraq","964"],["IE","Ireland","353"],["IM","Isle of Man","44"],["IL","Israel","972"],["IT","Italy","39"],["JM","Jamaica","1876"],["JP","Japan","81"],["JE","Jersey","44"],["JO","Jordan","962"],["KZ","Kazakhstan","7"],["KE","Kenya","254"],["KI","Kiribati","686"],["XK","Kosovo","383"],["KW","Kuwait","965"],["KG","Kyrgyzstan","996"],["LA","Laos","856"],["LV","Latvia","371"],["LB","Lebanon","961"],["LS","Lesotho","266"],["LR","Liberia","231"],["LY","Libya","218"],["LI","Liechtenstein","423"],["LT","Lithuania","370"],["LU","Luxembourg","352"],["MO","Macao","853"],["MG","Madagascar","261"],["MW","Malawi","265"],["MY","Malaysia","60"],["MV","Maldives","960"],["ML","Mali","223"],["MT","Malta","356"],["MH","Marshall Islands","692"],["MQ","Martinique","596"],["MR","Mauritania","222"],["MU","Mauritius","230"],["MX","Mexico","52"],["FM","Micronesia","691"],["MD","Moldova","373"],["MC","Monaco","377"],["MN","Mongolia","976"],["ME","Montenegro","382"],["MS","Montserrat","1664"],["MA","Morocco","212"],["MZ","Mozambique","258"],["MM","Myanmar","95"],["NA","Namibia","264"],["NR","Nauru","674"],["NP","Nepal","977"],["NL","Netherlands","31"],["NC","New Caledonia","687"],["NZ","New Zealand","64"],["NI","Nicaragua","505"],["NE","Niger","227"],["NG","Nigeria","234"],["NU","Niue","683"],["KP","North Korea","850"],["MK","North Macedonia","389"],["MP","Northern Mariana Islands","1670"],["NO","Norway","47"],["OM","Oman","968"],["PK","Pakistan","92"],["PW","Palau","680"],["PS","Palestine","970"],["PA","Panama","507"],["PG","Papua New Guinea","675"],["PY","Paraguay","595"],["PE","Peru","51"],["PH","Philippines","63"],["PL","Poland","48"],["PT","Portugal","351"],["PR","Puerto Rico","1787"],["QA","Qatar","974"],["RE","Reunion","262"],["RO","Romania","40"],["RU","Russia","7"],["RW","Rwanda","250"],["KN","Saint Kitts and Nevis","1869"],["LC","Saint Lucia","1758"],["VC","Saint Vincent and the Grenadines","1784"],["WS","Samoa","685"],["SM","San Marino","378"],["ST","Sao Tome and Principe","239"],["SA","Saudi Arabia","966"],["SN","Senegal","221"],["RS","Serbia","381"],["SC","Seychelles","248"],["SL","Sierra Leone","232"],["SG","Singapore","65"],["SK","Slovakia","421"],["SI","Slovenia","386"],["SB","Solomon Islands","677"],["SO","Somalia","252"],["ZA","South Africa","27"],["KR","South Korea","82"],["SS","South Sudan","211"],["ES","Spain","34"],["LK","Sri Lanka","94"],["SD","Sudan","249"],["SR","Suriname","597"],["SE","Sweden","46"],["CH","Switzerland","41"],["SY","Syria","963"],["TW","Taiwan","886"],["TJ","Tajikistan","992"],["TZ","Tanzania","255"],["TH","Thailand","66"],["TL","Timor-Leste","670"],["TG","Togo","228"],["TO","Tonga","676"],["TT","Trinidad and Tobago","1868"],["TN","Tunisia","216"],["TR","Turkey","90"],["TM","Turkmenistan","993"],["TC","Turks and Caicos Islands","1649"],["TV","Tuvalu","688"],["UG","Uganda","256"],["UA","Ukraine","380"],["AE","United Arab Emirates","971"],["GB","United Kingdom","44"],["US","United States","1"],["UY","Uruguay","598"],["UZ","Uzbekistan","998"],["VU","Vanuatu","678"],["VA","Vatican City","39"],["VE","Venezuela","58"],["VN","Vietnam","84"],["VG","Virgin Islands, British","1284"],["VI","Virgin Islands, U.S.","1340"],["YE","Yemen","967"],["ZM","Zambia","260"],["ZW","Zimbabwe","263"]].map(([t,e,r])=>({iso:t,name:e,dial:r})),Jx=t=>[...t.toUpperCase()].map(e=>String.fromCodePoint(127397+e.charCodeAt(0))).join(""),s5=()=>{let t="";try{if(Intl.DateTimeFormat().resolvedOptions().timeZone==="Africa/Lagos"&&(t="NG"),!t){const e=navigator.languages?.[0]||navigator.language;t=new Intl.Locale(e).region||""}}catch{t=""}return qa.find(e=>e.iso===t)??qa.find(e=>e.iso==="US")},l5=t=>{const e=s5(),r=t?.trim()??"";if(!r.startsWith("+"))return{country:e,national:r.replace(/\D/g,"")};const n=r.replace(/\D/g,""),a=[...qa].sort((i,o)=>o.dial.length-i.dial.length).find(i=>n.startsWith(i.dial))??e;return{country:a,national:n.slice(a.dial.length)}},Qx=(t,e)=>{const r=e.replace(/\D/g,"").replace(/^0+/,"");return r?`+${t.dial}${r}`:""},c5=t=>{const e=t.replace(/\D/g,"");return t.startsWith("+")&&e.length>=8&&e.length<=15},Ve=(t,e)=>_("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",...e,children:t}),u5=t=>_("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...t,children:_("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5 3.25h14A3.75 3.75 0 0 1 22.75 7v6A3.75 3.75 0 0 1 19 16.75h-7.19l-4.26 3.84A.75.75 0 0 1 6.25 20v-3.32A3.75 3.75 0 0 1 2.25 13V7A3.75 3.75 0 0 1 6 3.25Zm3 7.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z"})}),Ya=t=>Ve(_("path",{d:"m6 9 6 6 6-6"}),t),f5=t=>Ve(_(Me,{children:[_("path",{d:"m22 2-7 20-4-9-9-4Z"}),_("path",{d:"M22 2 11 13"})]}),t),ds=t=>Ve(_(Me,{children:[_("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),_("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),_("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),t),d5=t=>Ve(_(Me,{children:[_("path",{d:"M9 9v1a3 3 0 0 0 4.24 2.73"}),_("path",{d:"M15 5.5V5a3 3 0 0 0-5.94-.6"}),_("path",{d:"M19 10v2a7 7 0 0 1-9.9 6.36"}),_("path",{d:"M5 10v2a6.98 6.98 0 0 0 1.11 3.79"}),_("line",{x1:"12",y1:"19",x2:"12",y2:"22"}),_("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}),t),hs=t=>Ve(_(Me,{children:[_("path",{d:"M15 3h6v6"}),_("path",{d:"M10 14 21 3"}),_("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),t),h5=t=>Ve(_(Me,{children:[_("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),_("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),_("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),_("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),t),Sp=t=>Ve(_(Me,{children:[_("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),_("path",{d:"m22 7-10 5L2 7"})]}),t),p5=t=>Ve(_("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z"}),t),e1=t=>Ve(_(Me,{children:[_("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),_("path",{d:"M18 19h-2"}),_("rect",{x:"3",y:"13",width:"4",height:"6",rx:"2"}),_("rect",{x:"17",y:"13",width:"4",height:"6",rx:"2"})]}),t),v5=t=>Ve(_(Me,{children:[_("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z"}),_("path",{d:"M8 9h8M8 13h5"})]}),t),g5=t=>Ve(_(Me,{children:[_("path",{d:"M3 4h18M4 4v12h16V4M12 16v5M8 21h8"}),_("path",{d:"m8 12 2.5-2.5 2 2L16 8"})]}),t),m5=t=>Ve(_(Me,{children:[_("path",{d:"M15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}),_("path",{d:"M3 9h12M7 2v4M12 2v4"}),_("circle",{cx:"17",cy:"17",r:"4"}),_("path",{d:"M17 15v2l1.5 1"})]}),t),y5=t=>Ve(_(Me,{children:[_("path",{d:"M4 4h16v16H5a3 3 0 0 1-3-3V6"}),_("path",{d:"M8 8h8M8 12h8M8 16h5"})]}),t),_5=t=>Ve(_(Me,{children:[_("circle",{cx:"12",cy:"12",r:"9"}),_("path",{d:"M8.5 14.5a4 4 0 0 0 7 0"}),_("line",{x1:"9",y1:"9.5",x2:"9.01",y2:"9.5"}),_("line",{x1:"15",y1:"9.5",x2:"15.01",y2:"9.5"})]}),t),Qn=t=>Ve(_(Me,{children:[_("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),t),b5=t=>Ve(_(Me,{children:[_("path",{d:"M11 5 6 9H2v6h4l5 4z"}),_("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),_("path",{d:"M19 5a9 9 0 0 1 0 14"})]}),t),x5=t=>Ve(_(Me,{children:[_("path",{d:"M11 5 6 9H2v6h4l5 4z"}),_("line",{x1:"22",y1:"9",x2:"16",y2:"15"}),_("line",{x1:"16",y1:"9",x2:"22",y2:"15"})]}),t),Xa=t=>Ve(_("path",{d:"M20 6 9 17l-5-5"}),t),w5=t=>Ve(_(Me,{children:[_("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),_("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),t),S5=t=>Ve(_(Me,{children:[_("path",{d:"M1 4v6h6"}),_("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),t),k5=t=>Ve(_("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),t),eu=t=>Ve(_("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"}),t),kp=t=>Ve(_(Me,{children:[_("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),_("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}),t),T5=t=>Ve(_(Me,{children:[_("circle",{cx:"12",cy:"12",r:"9"}),_("path",{d:"M12 7v5l3 2"})]}),t),t1=t=>Ve(_(Me,{children:[_("path",{d:"M7 10v12"}),_("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),t),r1=t=>Ve(_(Me,{children:[_("path",{d:"M17 14V2"}),_("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]}),t),Tp=t=>Ve(_(Me,{children:[_("path",{d:"M15 3h6v6"}),_("path",{d:"M9 21H3v-6"}),_("path",{d:"M21 3l-7 7"}),_("path",{d:"M3 21l7-7"})]}),t),C5=t=>Ve(_(Me,{children:[_("path",{d:"M9 3v6H3"}),_("path",{d:"M15 21v-6h6"}),_("path",{d:"M9 9 2 2"}),_("path",{d:"M15 15l7 7"})]}),t),M5=t=>Ve(_(Me,{children:[_("rect",{x:"3",y:"4",width:"18",height:"14",rx:"2"}),_("rect",{x:"11",y:"11",width:"8",height:"6",rx:"1",fill:"currentColor",stroke:"none"})]}),t),A5=t=>Ve(_(Me,{children:[_("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),_("path",{d:"M12 15V9"}),_("path",{d:"m8.5 12.5 3.5-3.5 3.5 3.5"})]}),t),D5=t=>Ve(_(Me,{children:[_("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),_("path",{d:"m19 12-7 7-7-7"})]}),t),n1=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(\[[^\]]+\]\([^\s)]+\))|(https?:\/\/[^\s)]+)/g,I5=t=>t.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
|
|
24
|
-
$
|
|
74
|
+
`))!==-1;){const l=o.slice(0,d);o=o.slice(d+2);const u=Lc(l);if(u){if(u.event==="error")throw new un(502,u.data?.message??"stream error");if(u.event==="chunk"&&typeof u.data?.text=="string")i.answer+=u.data.text,t.onChunk(u.data.text);else if(u.event==="reset")i.answer="",t.onReset?.();else if(u.event==="final"&&u.data)typeof u.data.answer=="string"&&(i.answer=u.data.answer),i.sources=u.data.sources??[],i.suggestedReplies=u.data.suggestedReplies??[],i.availableActions=u.data.availableActions??[],i.actions=u.data.actions??[],i.selectedAction=u.data.selectedAction,i.handoffOffered=!!u.data.handoffOffered,i.requestedContactFields=Di(u.data.requestedContactFields),i.conversationEnded=!!u.data.conversationEnded,i.liveMode=u.data.liveMode,i.assignedAgentName=u.data.assignedAgentName,i.visualization=u.data.visualization,i.artifacts=u.data.artifacts,i.audioBase64=u.data.audioBase64,i.mimeType=u.data.mimeType,t.onTextReady?.();else if(u.event==="audio"&&u.data)typeof u.data.seq=="number"?(i.liveAudio=!0,t.onAudioSegment?.({seq:u.data.seq,audioBase64:u.data.audioBase64??"",mimeType:u.data.mimeType,text:typeof u.data.text=="string"?u.data.text:void 0})):(i.audioBase64=u.data.audioBase64,i.mimeType=u.data.mimeType);else if(u.event==="done")return i}}}return i},Lc=e=>{let t="message";const n=[];for(const a of e.split(`
|
|
75
|
+
`))a.startsWith("event:")?t=a.slice(6).trim():a.startsWith("data:")&&n.push(a.slice(5).trim());if(n.length===0)return{event:t};try{return{event:t,data:JSON.parse(n.join(`
|
|
76
|
+
`))}}catch{return{event:t}}},Di=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];let sr=()=>Promise.resolve().then(()=>Fo);const Dc=e=>{sr=e},Pi=e=>new Ec(e.apiBaseUrl,e.token,e.gifApiKey,e.analyticsContextToken,{agentName:e.agentName,agentAvatarUrl:e.agentAvatarUrl},e.identityToken,e.getIdentityToken,e.chatSurface),Oi=e=>{const t=n=>(...a)=>e().then(i=>i[n].apply(i,a));return{bootstrap:t("bootstrap"),history:t("history"),stream:t("stream"),liveEvents:t("liveEvents"),presence:t("presence"),typing:t("typing"),action:t("action"),speak:t("speak"),transcribe:t("transcribe"),searchGifs:t("searchGifs"),demoSlots:t("demoSlots"),identify:t("identify"),endConversation:t("endConversation"),sendFeedback:t("sendFeedback"),sendExplanationFeedback:t("sendExplanationFeedback"),uploadAttachment:t("uploadAttachment")}},Pc=e=>e.demo?Oi(async()=>new(await sr()).MockTransport):e.preview?Oi(async()=>{const{PreviewTransport:t}=await sr();return new t(Pi(e),e.strings)}):Pi(e),cr=16e3;class Oc{constructor(t){q(this,"ratio");q(this,"position",0);q(this,"carry",[]);this.ratio=t/cr}process(t){if(this.ratio===1)return t.slice();const n=this.carry.length?Float32Array.from([...this.carry,...t]):t,a=[];let i=this.position;for(;i+this.ratio<=n.length;){const s=Math.floor(i),c=Math.min(n.length,Math.floor(i+this.ratio));let d=0;for(let l=s;l<c;l+=1)d+=n[l]??0;a.push(c>s?d/(c-s):0),i+=this.ratio}const o=Math.floor(i);return this.carry=Array.from(n.subarray(o)),this.position=i-o,Float32Array.from(a)}}const Fc=(e,t=cr)=>{const n=e.reduce((c,d)=>c+d.length,0),a=new ArrayBuffer(44+n*2),i=new DataView(a),o=(c,d)=>{for(let l=0;l<d.length;l+=1)i.setUint8(c+l,d.charCodeAt(l))};o(0,"RIFF"),i.setUint32(4,36+n*2,!0),o(8,"WAVE"),o(12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(36,"data"),i.setUint32(40,n*2,!0);let s=44;for(const c of e)for(let d=0;d<c.length;d+=1){const l=Math.max(-1,Math.min(1,c[d]??0));i.setInt16(s,l<0?l*32768:l*32767,!0),s+=2}return new Blob([a],{type:"audio/wav"})},Fi=e=>e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").split(/\s+/).filter(t=>t.length>1),Uc=(e,t)=>{const n=Fi(e);if(n.length===0||!t.trim())return!1;const a=new Set(Fi(t));return n.filter(i=>a.has(i)).length/n.length>=.7},Ui=e=>{const t=e.replace(/```[\s\S]*?```/g,"").split(`
|
|
77
|
+
`),n=new Set;for(let a=1;a<t.length;a+=1){const i=t[a]?.trim().replace(/^\|/,"").replace(/\|$/,"");if(!(!t[a-1]?.includes("|")||!i||!i.split("|").every(o=>/^\s*:?-{3,}:?\s*$/.test(o)))){n.add(a-1),n.add(a);for(let o=a+1;o<t.length&&t[o]?.includes("|");o+=1)n.add(o)}}return t.filter((a,i)=>!n.has(i)).join(`
|
|
78
|
+
`).trim()},Bc=(e,t)=>{const n=t?.explanation,a=[n?.summary?.trim()||n?.headline?.trim(),n?.businessMeaning?.trim(),...n?.limitations??[]].filter(o=>!!o?.trim()),i=a.length?[...new Set(a)].join(`
|
|
79
|
+
`):e;return Ui(i)||(i.trim()?"The detailed results are available in the chat.":"")},Bi=300,qc=()=>{const e=globalThis;if(e.__voiceDebug)return!0;try{return e.localStorage?.getItem("accurix.voiceDebug")==="1"}catch{return!1}};class Vc{constructor(t=()=>Date.now()){q(this,"now");q(this,"entries",[]);q(this,"startedAt");this.now=t,this.startedAt=t(),globalThis.__accurixVoiceLog=()=>this.list()}add(t,n){const a={at:Math.round(this.now()-this.startedAt),event:t,detail:n};this.entries.push(a),this.entries.length>Bi&&this.entries.splice(0,this.entries.length-Bi),qc()&&console.debug(`VOICEDBG ${t} ${n?JSON.stringify(n):""}`)}list(){return this.entries.slice()}}const lr=cr/50,st=20,jc=500,Hc=120,Wc=300,Gc=280,Kc=600,Yc=300,Zc=12e3,Jc=25e3,Xc=300,Qc=2e4,el=60,tl=400,nl=250,dr=8e-4,al=.1,rl=2.8,il=1.8,ol=.006,sl=.004,cl=1.8,ll=1.4,dl=2e3,ul=2e3;class pl{constructor(t){q(this,"options");q(this,"endSilenceMs");q(this,"pending",new Float32Array(0));q(this,"levels",[]);q(this,"framesSinceFloor",0);q(this,"floor",dr*4);q(this,"recentSpeech",[]);q(this,"preroll",[]);q(this,"silentMs",0);q(this,"inputSilent",!1);q(this,"outputActive",!1);q(this,"turns",[]);q(this,"nextTurnId",1);this.options=t,this.endSilenceMs=t.endSilenceMs??ul}get hearing(){return this.current()?.capturing??!1}get processing(){return this.turns.some(t=>!t.capturing&&!t.cancelled)}feed(t){let n=t;this.pending.length&&(n=new Float32Array(this.pending.length+t.length),n.set(this.pending),n.set(t,this.pending.length));let a=0;for(;a+lr<=n.length;)this.frame(n.slice(a,a+lr)),a+=lr;this.pending=n.slice(a)}setOutputActive(t){this.outputActive!==t&&(this.outputActive=t,this.options.log.add("output",{active:t}))}finishTurn(){const t=this.current();t&&(t.capturing?this.endTurn(t,"done"):t.closed||(t.closed=!0,t.endedBy="done",this.options.log.add("turn-done",{turn:t.id})))}reset(t){for(const n of this.turns)n.cancelled=!0;this.turns.length&&this.options.log.add("turns-dropped",{reason:t,count:this.turns.length}),this.turns=[],this.preroll=[],this.recentSpeech=[],this.pending=new Float32Array(0),this.options.onChange()}current(){return this.turns[this.turns.length-1]}frame(t){let n=0,a=0;for(let p=0;p<t.length;p+=1){const m=t[p]??0;n+=m*m,a=Math.max(a,Math.abs(m))}const i=Math.sqrt(n/t.length);this.trackInputSilence(a);const o=this.current();!o?.capturing&&!this.outputActive&&this.trackFloor(i);const s=this.outputActive,c=Math.max(ol,this.floor*rl)*(s?cl:1),d=Math.max(sl,this.floor*il)*(s?ll:1),l=i>=c,u=i>=d;if(!o?.capturing){for(this.preroll.push(t);this.preroll.length*st>jc;)this.preroll.shift();this.recentSpeech.push(l);const p=(s?Kc:Wc)/st;for(;this.recentSpeech.length>p;)this.recentSpeech.shift();const m=this.recentSpeech.filter(Boolean).length*st;m>=(s?Gc:Hc)&&this.beginCapture(m);return}o.chunk.push(t),o.chunkMs+=st,o.durationMs+=st,l&&(o.voicedMs+=st,o.chunkVoicedMs+=st),o.quietMs=u?0:o.quietMs+st,s&&(o.overlappedOutput=!0),o.quietMs>=this.endSilenceMs?this.endTurn(o,"silence"):(o.chunkMs>=Jc||o.chunkMs>=Zc&&o.quietMs>=Xc||o.chunkMs>=Qc&&o.quietMs>=el)&&this.cutChunk(o)}trackFloor(t){if(this.levels.push(t),this.levels.length>nl&&this.levels.shift(),this.framesSinceFloor+=1,this.framesSinceFloor<10&&this.levels.length>10)return;this.framesSinceFloor=0;const n=this.levels.slice().sort((a,i)=>a-i);this.floor=Math.max(dr,n[Math.floor(n.length*al)]??dr)}trackInputSilence(t){this.silentMs=t===0?this.silentMs+st:0;const n=this.silentMs>=dl;n!==this.inputSilent&&(this.inputSilent=n,this.options.log.add("input-silent",{silent:n}),this.options.onInputSilent?.(n))}beginCapture(t){const n=this.current();let a;n&&!n.capturing&&!n.closed?(a=n,a.capturing=!0,this.options.log.add("turn-resumed",{turn:a.id})):(a={id:this.nextTurnId++,capturing:!0,closed:!1,endedBy:"silence",chunk:[],chunkMs:0,chunkVoicedMs:0,quietMs:0,voicedMs:0,durationMs:0,overlappedOutput:this.outputActive,results:[],chunkCount:0,cancelled:!1},this.turns.push(a),this.options.log.add("turn-start",{turn:a.id,overOutput:this.outputActive}),this.options.listener.speechStart?.({turnId:a.id,overlappedOutput:this.outputActive})),a.chunk.push(...this.preroll),a.chunkMs+=this.preroll.length*st,a.durationMs+=this.preroll.length*st,a.voicedMs+=t,a.chunkVoicedMs+=t,a.quietMs=0,this.preroll=[],this.recentSpeech=[],this.options.onChange()}endTurn(t,n){const a=Math.max(0,Math.floor((t.quietMs-tl)/st));if(a>0&&(t.chunk.splice(t.chunk.length-Math.min(a,t.chunk.length)),t.chunkMs=t.chunk.length*st),t.capturing=!1,t.endedBy=n,n==="done"&&(t.closed=!0),this.options.log.add("turn-end",{turn:t.id,by:n,ms:t.durationMs,voicedMs:t.voicedMs}),t.chunkCount===0&&t.voicedMs<Yc){this.turns=this.turns.filter(i=>i!==t),this.options.log.add("turn-noise",{turn:t.id,reason:"too-short"}),this.options.listener.noise?.({id:t.id,reason:"too-short",overlappedOutput:t.overlappedOutput}),this.options.onChange();return}this.cutChunk(t),this.options.onChange(),this.settle()}cutChunk(t){if(t.chunk.length===0)return;const n=t.chunk,a=t.chunkCount;t.chunkCount+=1,t.results[a]=void 0,t.chunk=[];const i=n.length*st,o=t.chunkVoicedMs;if(t.chunkMs=0,t.chunkVoicedMs=0,o===0&&a>0){t.results[a]="";return}this.options.log.add("chunk",{turn:t.id,index:a,ms:i}),this.options.transcribe({audio:Fc(n),mimeType:"audio/wav",durationSeconds:i/1e3,turnId:t.id,chunkIndex:a}).then(s=>(s??"").trim(),()=>null).then(s=>{if(t.cancelled)return;t.results[a]=s,this.options.log.add("chunk-text",{turn:t.id,index:a,chars:s===null?-1:s.length});const c=[];for(const d of t.results){if(d===void 0)break;d&&c.push(d)}c.length&&this.options.listener.partial?.({turnId:t.id,text:c.join(" ")}),this.settle()})}settle(){for(;this.turns.length;){const t=this.turns[0];if(!t||t.capturing||t.results.some(o=>o===void 0))return;this.turns.shift();const n=t.results.filter(o=>typeof o=="string"&&o!==""),a=t.results.every(o=>o===null),i=n.join(" ").replace(/\s+/g," ").trim();if(i)this.options.log.add("turn",{turn:t.id,chars:i.length,by:t.endedBy}),this.options.listener.turn?.({id:t.id,text:i,durationMs:t.durationMs,endedBy:t.endedBy,overlappedOutput:t.overlappedOutput});else{const o=a?"transcribe-failed":"empty-transcript";this.options.log.add("turn-noise",{turn:t.id,reason:o}),this.options.listener.noise?.({id:t.id,reason:o,overlappedOutput:t.overlappedOutput})}this.options.onChange()}}}const fl=2048,hl=[300,1e3,2500],ml=()=>typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof globalThis.AudioContext=="function",gl=e=>{const t=e?.name;return t==="NotAllowedError"||t==="SecurityError"?"permission-denied":t==="NotFoundError"||t==="OverconstrainedError"?"no-device":"error"};class qi{constructor(t){q(this,"options");q(this,"log",new Vc);q(this,"turns");q(this,"mic","off");q(this,"reason");q(this,"muted",!1);q(this,"inputSilent",!1);q(this,"stream",null);q(this,"context",null);q(this,"source",null);q(this,"processor",null);q(this,"sink",null);q(this,"downsampler",null);q(this,"deviceId");q(this,"generation",0);q(this,"recoveryAttempt",0);q(this,"recoveryTimer",null);q(this,"lastSnapshot","");q(this,"groupId");q(this,"onTrackEnded",()=>{this.log.add("track-ended"),this.recover("track-ended")});q(this,"onTrackMuteChange",()=>{const t=this.stream?.getAudioTracks()[0];this.log.add("track-mute-change",{muted:!!t?.muted}),this.refreshMic()});q(this,"onContextState",()=>{const t=this.context?.state;this.log.add("audio-state",{state:t}),(t==="suspended"||t==="interrupted")&&this.context?.resume().catch(()=>{}),this.refreshMic()});q(this,"onDeviceChange",()=>{this.checkDevices()});this.options=t,this.deviceId=t.deviceId,this.turns=new pl({transcribe:t.transcribe,listener:t.listener,log:this.log,endSilenceMs:t.endSilenceMs,onChange:()=>this.publish(),onInputSilent:n=>{this.inputSilent=n,this.publish()}})}get snapshot(){let t=this.mic,n=this.reason;return t==="listening"&&this.inputSilent&&(t="unavailable",n="input-silent"),t==="listening"&&this.turns.hearing&&(t="hearing"),{mic:t,processing:this.turns.processing,reason:t==="unavailable"?n:void 0}}get active(){return this.mic!=="off"}async start(){this.mic==="off"&&(this.log.add("start"),this.mediaDevices()?.addEventListener("devicechange",this.onDeviceChange),await this.open("start"))}stop(t="stopped"){this.mic!=="off"&&(this.log.add("stop",{reason:t}),this.generation+=1,this.clearRecovery(),this.mediaDevices()?.removeEventListener("devicechange",this.onDeviceChange),this.turns.reset(t),this.close(),this.context?.close().catch(()=>{}),this.context=null,this.setMic("off"))}setMuted(t){if(!(this.muted===t||this.mic==="off")){this.muted=t,this.log.add(t?"mute":"unmute");for(const n of this.stream?.getAudioTracks()??[])n.enabled=!t;t?(this.turns.reset("muted"),this.setMic("muted")):this.refreshMic()}}finishTurn(){this.log.add("done-pressed"),this.turns.finishTurn()}setOutputActive(t){this.turns.setOutputActive(t)}async selectDevice(t){t!==this.deviceId&&(this.deviceId=t,this.mic!=="off"&&(this.log.add("device-selected"),this.turns.reset("device-selected"),this.close(),await this.open("device-selected")))}mediaDevices(){return this.options.media?.mediaDevices??(typeof navigator<"u"?navigator.mediaDevices:void 0)}async open(t){const n=++this.generation;this.setMic("starting");const a=this.options.media?.getUserMedia??(ml()?o=>navigator.mediaDevices.getUserMedia(o):null);if(!a){this.unavailable("unsupported");return}let i;try{i=await a({audio:{...this.deviceId?{deviceId:{exact:this.deviceId}}:{},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(o){if(n!==this.generation)return;const s=gl(o);if(this.log.add("mic-open-failed",{why:t,reason:s}),s==="no-device"&&this.deviceId){this.deviceId=void 0,await this.open("default-device");return}this.unavailable(s);return}if(n!==this.generation){i.getTracks().forEach(o=>o.stop());return}try{this.connect(i)}catch(o){this.log.add("audio-setup-failed",{message:String(o?.name??"error")}),i.getTracks().forEach(s=>s.stop()),this.unavailable("error");return}this.recoveryAttempt=0,this.groupId=i.getAudioTracks()[0]?.getSettings?.().groupId,this.log.add("mic-open",{why:t}),this.refreshMic()}connect(t){this.stream=t;for(const a of t.getAudioTracks())a.enabled=!this.muted,a.addEventListener("ended",this.onTrackEnded),a.addEventListener("mute",this.onTrackMuteChange),a.addEventListener("unmute",this.onTrackMuteChange);const n=this.context??this.options.media?.createAudioContext?.()??new globalThis.AudioContext;this.context||(this.context=n,n.addEventListener("statechange",this.onContextState)),n.state==="suspended"&&n.resume().catch(()=>{}),this.downsampler=new Oc(n.sampleRate),this.source=n.createMediaStreamSource(t),this.processor=n.createScriptProcessor(fl,1,1),this.sink=n.createGain(),this.sink.gain.value=0,this.processor.onaudioprocess=a=>{if(this.muted||!this.downsampler)return;const i=this.downsampler.process(a.inputBuffer.getChannelData(0));if(this.turns.feed(i),this.options.listener.level&&i.length){let o=0;for(const s of i)o+=s*s;this.options.listener.level(Math.sqrt(o/i.length))}},this.source.connect(this.processor),this.processor.connect(this.sink),this.sink.connect(n.destination)}close(){this.processor&&(this.processor.onaudioprocess=null),this.source?.disconnect(),this.processor?.disconnect(),this.sink?.disconnect(),this.source=null,this.processor=null,this.sink=null;for(const t of this.stream?.getTracks()??[])t.removeEventListener("ended",this.onTrackEnded),t.removeEventListener("mute",this.onTrackMuteChange),t.removeEventListener("unmute",this.onTrackMuteChange),t.stop();this.stream=null,this.inputSilent=!1}refreshMic(){if(this.mic==="off")return;if(this.muted)return this.setMic("muted");const t=this.stream?.getAudioTracks()[0];if(!t||t.readyState!=="live")return this.unavailable("device-lost");if(t.muted)return this.unavailable("track-muted");if(this.context&&this.context.state!=="running")return this.unavailable("audio-suspended");this.reason=void 0,this.setMic("listening")}unavailable(t){this.reason=t,this.setMic("unavailable")}setMic(t){this.mic!==t&&this.log.add("mic",{state:t,reason:t==="unavailable"?this.reason:void 0}),this.mic=t,this.publish()}publish(){const t=this.snapshot,n=JSON.stringify(t);n!==this.lastSnapshot&&(this.lastSnapshot=n,this.options.listener.state?.(t))}recover(t){if(this.mic==="off"||this.recoveryTimer)return;const n=hl[this.recoveryAttempt];if(this.turns.reset(t),this.close(),n===void 0){this.log.add("mic-recovery-gave-up",{why:t}),this.unavailable("device-lost");return}this.recoveryAttempt+=1,this.unavailable("device-lost"),this.log.add("mic-recovering",{why:t,attempt:this.recoveryAttempt}),this.recoveryTimer=setTimeout(()=>{this.recoveryTimer=null,this.mic!=="off"&&this.open(t)},n)}clearRecovery(){this.recoveryTimer&&clearTimeout(this.recoveryTimer),this.recoveryTimer=null,this.recoveryAttempt=0}async checkDevices(){const t=this.stream?.getAudioTracks()[0];if(!t||t.readyState!=="live"){this.log.add("device-change",{live:!1}),this.recover("device-change");return}let n=[];try{n=(await this.mediaDevices()?.enumerateDevices()??[]).filter(s=>s.kind==="audioinput")}catch{return}const a=n.some(s=>!this.groupId||s.groupId===this.groupId),i=n.find(s=>s.deviceId==="default"),o=!this.deviceId&&i!==void 0&&this.groupId!==void 0&&i.groupId!==this.groupId;this.log.add("device-change",{live:!0,ours:a,defaultMoved:o}),(!a||o)&&this.recover("device-change")}}const ur=e=>!!(e?.headline?.trim()||e?.summary?.trim()),bl=(e,t={})=>{const n=e?.explanation??void 0,a=e?.businessAnalysis?.explanation??void 0,i=[t.requested??void 0,n?.source==="ai_grounded"?n:void 0,a,n];for(const o of i)if(o&&ur(o))return o;return t.fallback?.()},xt={eyebrow:"Answer from your data",provenanceAI:"AI-assisted · evidence checked",provenanceGoverned:"Based on current values",comparison:"Comparison",conclusions:"What we can conclude",whyItMatters:"Why it matters",limits:"Important limits",investigate:"Investigate further",evidenceList:"Evidence checked",causes:"Possible causes",causesHint:"Not proven causes",howToCheck:"How to check:",recommendations:"Recommended next steps",watch:"Watch:",outlook:"Outlook",followUps:"Ask a follow-up",sourceNoteAI:"AI-assisted wording, checked against the live values shown here.",sourceNoteGoverned:"Based only on the live values shown here.",evidence:"Evidence",evidenceMetric:"Metric",evidencePeriod:"Period",evidenceTimezone:"Timezone",evidenceFilters:"Filters",evidenceValue:"Value",evidenceStatus:"Status",evidenceSource:"Source",evidenceChecked:"Checked",openSource:"Open source",closeEvidence:"Close evidence details",citationLabel:"Show evidence",sourceCard:"This card",sourceSupportingQuery:"Supporting query",feedbackPrompt:"Was this explanation helpful?",feedbackHelpful:"Helpful explanation",feedbackNotHelpful:"Unhelpful explanation",feedbackReasonsPrompt:"What went wrong? (optional)",feedbackCommentPlaceholder:"Anything else? (optional)",feedbackSubmit:"Send feedback",feedbackThanks:"Thanks for the feedback.",feedbackUndo:"Undo",feedbackError:"Feedback could not be saved. Try again.",notComparable:"Not comparable yet",basicExplanation:"Basic explanation",preparingDetailed:"Preparing a detailed explanation…",detailedReady:"Detailed explanation ready.",detailedUnavailable:"A detailed explanation is not available right now.",detailedRetry:"Try again",region:"Explanation",inProgress:"in progress",expand:"Expand explanation",collapse:"Collapse explanation",reasonWrongNumbers:"Wrong numbers",reasonMissingComparison:"Missing comparison",reasonUnclear:"Unclear",reasonTooLong:"Too long"},Vi=[{id:"wrong_numbers",label:"Wrong numbers"},{id:"missing_comparison",label:"Missing comparison"},{id:"unclear",label:"Unclear"},{id:"too_long",label:"Too long"}],pr=500,vl=e=>e==="ai_grounded"||e==="rag_deterministic_analysis",ji=e=>{switch(e){case"confirmed_zero":return"confirmed 0";case"empty_bucket":case"unconfirmed_zero":return"no records yet";case"missing":return"missing";default:return""}},Hi=e=>{switch(e){case"confirmed_zero":return"confirmed";case"empty_bucket":case"unconfirmed_zero":return"caution";case"missing":return"missing";default:return"neutral"}},xl=e=>{const t=(e??"").trim().toLowerCase().replaceAll("-","_");return t==="low"||t==="low_quality"?"Low-confidence forecast":t==="medium"||t==="directional"?"Directional forecast":t==="high"||t==="validated"||t==="trusted"?"Validated forecast":"Forecast estimate"},Wi=/^\d{4}-\d{2}-\d{2}$/,ga=(e,t,n,a)=>{try{return new Intl.DateTimeFormat(t,a?{...n,timeZone:a}:n).format(e)}catch{return new Intl.DateTimeFormat(t,n).format(e)}},Gi=(e,t)=>ga(e,"en-CA",{year:"numeric",month:"2-digit",day:"2-digit"},t),Ki=(e,t={})=>{const n=e?.trim();if(!n)return"";const a=new Date(n);if(Number.isNaN(a.getTime()))return"";const i={hour:"2-digit",minute:"2-digit",hour12:!1},o=Gi(a,t.timezone)===Gi(t.now??new Date,t.timezone);return ga(a,t.locale,o?i:{...i,month:"short",day:"numeric"},t.timezone)},yl=(e,t={})=>{const n=e.timezone?.trim(),a=Ki(e.checkedAt,{...t,timezone:n});return[n?`Times in ${n}`:"",a?`Checked ${a}`:""].filter(Boolean).join(" · ")},Yi=(e,t,n)=>{const a=e?.trim();if(!a)return"";if(Wi.test(a)){const o=new Date(`${a}T00:00:00Z`);return Number.isNaN(o.getTime())?a:ga(o,t,{day:"numeric",month:"short",year:"numeric"},"UTC")}const i=new Date(a);return Number.isNaN(i.getTime())?a:ga(i,t,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1},n)},_l=(e,t={})=>{if(!e)return"";const n=e.timezone?.trim()||t.timezone?.trim(),a=Yi(e.start,t.locale,n),i=Yi(e.end,t.locale,n);return a&&i?`${a} – ${i} (end not included)`:a?`From ${a}`:i?`Before ${i}`:""},wl=(e,t,n)=>{if(!e)return{label:"Updated",description:"Source freshness is unavailable.",tone:"neutral"};if(e.status==="current")return{label:"Fresh",description:"Source data is current.",tone:"success"};if(e.status==="no_data")return{label:"No source data",description:"No source data is available for this period or an earlier period.",tone:"neutral"};if(e.status!=="delayed")return{label:"Updated",description:"Source freshness is unavailable.",tone:"neutral"};const a=s=>{if(!s)return"";const c=Wi.test(s)?new Date(`${s}T00:00:00`):new Date(s);return Number.isNaN(c.getTime())?"":new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(c)},i=a(e.dataAsOf),o=a(t);return{label:`${o?`Checked ${o} · `:""}Latest record${i?` ${i}`:""}`,description:`Latest matching record${i?`: ${i}`:" date is unavailable"}. An older record alone does not prove a source delay.`,tone:"neutral"}},Je=(e,t)=>t(String(e??"").replace(/\s+/g," ").trim()).trim(),Zi=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e.toLocaleString(t):"",kl=e=>{const t=[];return e?.liveboardTileId?.trim()&&t.push({kind:"liveboard_tile",id:e.liveboardTileId.trim()}),e?.insightId?.trim()&&t.push({kind:"insight",id:e.insightId.trim()}),e?.queryRunId?.trim()&&t.push({kind:"query_run",id:e.queryRunId.trim()}),t},Sl=(e,t={})=>{const{locale:n}=t,a={...xt,...t.copy},i=t.cleanText??(y=>y),o=e.timezone?.trim()||void 0,s=new Map;for(const y of e.evidenceItems??[])y?.id?.trim()&&!s.has(y.id.trim())&&s.set(y.id.trim(),y);const c=[],d={},l=y=>{const D=y?.trim();if(!D)return;const S=d[D];if(S)return{id:D,index:S.index};const O=s.get(D);if(!O)return;const ue=O.valueStatus,oe=ji(ue)||(ue==="observed"?"observed":""),Fe=O.source?.kind,_e={id:D,index:c.length+1,text:Je(O.text,i),...O.metric?.trim()?{metric:O.metric.trim()}:{},...O.period?.label?.trim()?{periodLabel:O.period.label.trim()}:{},...(()=>{const Te=_l(O.period,{locale:n,timezone:o});return Te?{periodRange:Te}:{}})(),...O.period?.timezone?.trim()||o?{timezone:O.period?.timezone?.trim()||o}:{},...O.filters?.length?{filters:O.filters.map(Te=>Te.trim()).filter(Boolean)}:{},...(()=>{const Te=Zi(O.value,n);return Te?{valueText:Te}:{}})(),...oe?{statusLabel:oe}:{},statusTone:Hi(ue),...O.statusReason?.trim()?{statusReason:Je(O.statusReason,i)}:{},...Fe==="card"?{sourceLabel:xt.sourceCard}:Fe==="supporting_query"?{sourceLabel:xt.sourceSupportingQuery}:{},sourceTargets:kl(O.source),...(()=>{const Te=Ki(O.checkedAt??e.checkedAt,{locale:n,timezone:o,now:t.now});return Te?{checkedText:Te}:{}})()};return _e.filters&&_e.filters.length===0&&delete _e.filters,c.push(_e),d[D]=_e,{id:D,index:_e.index}},u=y=>{const D=new Set,S=[];for(const O of y??[]){const ue=l(O);ue&&!D.has(ue.id)&&(D.add(ue.id),S.push(ue))}return S},p=vl(e.source)||e.level==="detailed",m=Je(e.headline,i)||Je(e.summary,i),f={text:m,citations:u(e.headlineEvidenceIds)},_=Je(e.summary,i),h=_&&_!==m?{text:_,citations:u(e.summaryEvidenceIds)}:void 0;if(!h&&_&&e.summaryEvidenceIds?.length)for(const y of u(e.summaryEvidenceIds))f.citations.some(D=>D.id===y.id)||f.citations.push(y);const I=(e.periods??[]).filter(y=>y?.label?.trim()).map(y=>{const D=y.valueStatus,S=ji(D),O=y.valueText?.trim()||Zi(y.value,n)||(D==="missing"?"—":""),ue=S?y.statusReason?.trim()||s.get(y.evidenceId?.trim()??"")?.statusReason?.trim():"",oe=l(y.evidenceId);return{key:y.evidenceId||`${y.label}-${y.start??""}-${y.end??""}`,label:y.label.trim(),valueText:O,...D?{status:D}:{},statusLabel:S,statusTone:Hi(D),inProgress:!!y.inProgress,current:!!y.current,...ue?{reason:Je(ue,i)}:{},...oe?{citation:oe}:{}}}),x=t.maxConclusions??4,g=(e.evidenceStatements??[]).map(y=>({text:Je(y.text,i),citations:u(y.evidenceIds)})).filter(y=>y.text),T=(g.length>0?g:(e.evidence??[]).map(y=>Je(y,i)).filter(Boolean).map(y=>({text:y,citations:[]}))).filter((y,D,S)=>S.findIndex(O=>O.text===y.text)===D).filter(y=>y.text!==f.text&&y.text!==h?.text).slice(0,x),V=Je(e.businessMeaning,i),P=V?{text:V,citations:u(e.businessMeaningEvidenceIds)}:void 0,ee=[],Z=y=>{y.text&&!ee.some(D=>D.text===y.text)&&ee.push(y)},Y=(e.limitations??[]).map(y=>y.toLowerCase());for(const y of I){const D=Y.some(S=>S.includes(y.label.toLowerCase())&&S.includes("in progress"));y.inProgress&&!D&&Z({kind:"in_progress",text:`${y.label} is still in progress, so its total can still change.`,...y.citation?{citation:y.citation}:{}}),(y.status==="empty_bucket"||y.status==="unconfirmed_zero")&&Z({kind:"no_records",text:`${y.label} has no records yet. This is not a confirmed 0${y.reason?`: ${y.reason.replace(/\.$/,"")}`:""}.`,...y.citation?{citation:y.citation}:{}}),y.status==="missing"&&Z({kind:"missing",text:`${y.label} is missing${y.reason?`: ${y.reason.replace(/\.$/,"")}`:""}.`,...y.citation?{citation:y.citation}:{}})}e.currentPeriodInProgress&&!I.some(y=>y.inProgress)&&Z({kind:"in_progress",text:"The current period is still in progress, so its total can still change."});for(const y of e.missing??[]){if(!y?.label?.trim()||!y.reason?.trim())continue;const D=l(y.evidenceId);Z({kind:"missing",text:$l(y),...D?{citation:D}:{}})}(e.dataFreshness?.status==="delayed"||e.dataFreshness?.status==="no_data")&&Z({kind:"freshness",text:wl(e.dataFreshness,e.checkedAt,n).description});for(const y of e.limitations??[]){const D=Je(y,i);D&&Z({kind:"limitation",text:D})}const z=(e.possibleDrivers??[]).map(y=>({title:Je(y.hypothesis,i),howToCheck:Je(y.howToCheck,i),citations:u(y.evidenceIds)})).filter(y=>y.title).slice(0,t.maxCauses??3),te=(e.recommendations??[]).map(y=>({title:Je(y.action,i),why:Je(y.why,i),...y.successMetric?.trim()?{watch:Je(y.successMetric,i)}:{},citations:u(y.evidenceIds)})).filter(y=>y.title).slice(0,t.maxRecommendations??3),U=Je(e.forecast?.text,i),B=U?{badge:xl(e.forecast?.qualityStatus),text:U,...e.forecast?.limitations?.trim()?{note:Je(e.forecast.limitations,i)}:{}}:void 0,A=(e.followUps??[]).map(y=>Je(y,i)).filter(Boolean).filter((y,D,S)=>S.indexOf(y)===D).slice(0,t.maxFollowUps??4);for(const y of s.keys())l(y);const N=Je(e.conversationalPreface,i);return{...e.explanationId?.trim()?{explanationId:e.explanationId.trim()}:{},ai:p,lead:{eyebrow:a.eyebrow,provenance:p?a.provenanceAI:e.level==="basic"?a.basicExplanation:a.provenanceGoverned,...N?{preface:N}:{},headline:f,...h?{summary:h}:{}},comparison:I,conclusions:T,...P?{businessMeaning:P}:{},limits:ee,checkedLine:yl(e,{locale:n,now:t.now}),investigate:{causes:z,recommendations:te,...B?{outlook:B}:{},followUps:A},hasInvestigate:z.length>0||te.length>0||!!B||A.length>0||c.length>0,evidence:c,evidenceById:d,sourceNote:p?a.sourceNoteAI:a.sourceNoteGoverned}},$l=e=>`${e.label.trim()} could not be established: ${e.reason.trim()}`,Tl=e=>`[${e.index}]`,Cl=(e,t)=>{const n={...xt,...t},a=[];e.metric&&a.push({key:"metric",label:n.evidenceMetric,value:e.metric});const i=[e.periodLabel,e.periodRange].filter(Boolean).join(" · ");i&&a.push({key:"period",label:n.evidencePeriod,value:i}),e.timezone&&a.push({key:"timezone",label:n.evidenceTimezone,value:e.timezone}),e.filters?.length&&a.push({key:"filters",label:n.evidenceFilters,value:e.filters.join("; ")});const o=[e.valueText,e.statusLabel].filter(Boolean).join(" · ");return o&&a.push({key:"value",label:n.evidenceValue,value:o}),e.statusReason&&a.push({key:"reason",label:n.evidenceStatus,value:e.statusReason}),e.sourceLabel&&a.push({key:"source",label:n.evidenceSource,value:e.sourceLabel}),e.checkedText&&a.push({key:"checked",label:n.evidenceChecked,value:e.checkedText}),a},Al=e=>{const t=new Set(Vi.map(i=>i.id)),n=Array.from(e.comment??"").map(i=>{const o=i.charCodeAt(0);return o<32||o>=127&&o<=159?" ":i}).join("").replace(/\s+/g," ").trim(),a=e.rating==="down"?[...new Set(e.reasons??[])].filter(i=>t.has(i)).slice(0,4):[];return{explanationId:e.explanationId,rating:e.rating,...a.length?{reasons:a}:{},...e.rating!=="clear"&&n?{comment:Array.from(n).slice(0,pr).join("")}:{},...e.modelId?{modelId:e.modelId}:{},...typeof e.modelVersion=="number"&&e.modelVersion>0?{modelVersion:e.modelVersion}:{}}},Ml=(e,t)=>{const n=`.${e}-xp`;return`
|
|
80
|
+
${n}{display:grid;gap:12px;color:${t.text};font-size:13px;line-height:1.55;min-width:0}
|
|
81
|
+
${n} h3,${n} h4,${n} p,${n} ul,${n} ol,${n} dl,${n} dd{margin:0}
|
|
82
|
+
${n} ul,${n} ol{padding:0;list-style:none}
|
|
83
|
+
${n}__lead{display:grid;gap:6px}
|
|
84
|
+
${n}__meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px}
|
|
85
|
+
${n}__eyebrow{color:${t.accent};font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}
|
|
86
|
+
${n}__provenance{display:inline-flex;align-items:center;gap:6px;color:${t.muted};font-size:11px;font-weight:600}
|
|
87
|
+
${n}__provenance::before{content:"";width:6px;height:6px;border-radius:999px;background:${t.accent}}
|
|
88
|
+
${n}__preface{color:${t.muted}}
|
|
89
|
+
${n}__headline{color:${t.text};font-size:16px;font-weight:700;line-height:1.4;letter-spacing:-.01em}
|
|
90
|
+
${n}__summary{color:${t.muted}}
|
|
91
|
+
${n}{position:relative}
|
|
92
|
+
${n}__expand{position:absolute;inset-block-start:0;inset-inline-end:0;display:grid;width:28px;height:28px;place-items:center;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:14px;line-height:1;cursor:pointer}
|
|
93
|
+
${n}.is-expanded{max-width:none;font-size:14px}
|
|
94
|
+
${n}.has-expand ${n}__lead{padding-inline-end:36px}
|
|
95
|
+
${n}__ai{min-height:18px;color:${t.muted};font-size:12px}
|
|
96
|
+
${n}__ai-note{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:0}
|
|
97
|
+
${n}__ai[data-ai-status="pending"] ${n}__ai-note::before{content:"";width:6px;height:6px;border-radius:999px;background:${t.accent};animation:${n.replace(/[^a-z0-9]/gi,"")}-ai-pulse 1.2s ease-in-out infinite}
|
|
98
|
+
${n}__ai-retry{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-weight:600;padding:2px 10px;cursor:pointer}
|
|
99
|
+
${n}__ai-retry:disabled{opacity:.6;cursor:default}
|
|
100
|
+
${n}__sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
101
|
+
@keyframes ${n.replace(/[^a-z0-9]/gi,"")}-ai-pulse{0%,100%{opacity:.35}50%{opacity:1}}
|
|
102
|
+
@media (prefers-reduced-motion:reduce){${n}__ai-note::before{animation:none}}
|
|
103
|
+
${n}__step{display:grid;gap:8px;border-top:1px solid ${t.border};padding-top:12px}
|
|
104
|
+
${n}__title{color:${t.text};font-size:12px;font-weight:700}
|
|
105
|
+
${n}__periods{display:grid;gap:6px}
|
|
106
|
+
${n}__period{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;border:1px solid ${t.border};border-radius:10px;background:${t.subtle};padding:8px 10px}
|
|
107
|
+
${n}__period-label{min-width:0;flex:1 1 auto;color:${t.muted};font-weight:600}
|
|
108
|
+
${n}__period-value{color:${t.text};font-size:15px;font-weight:700;font-variant-numeric:tabular-nums}
|
|
109
|
+
${n}__period-reason{flex-basis:100%;color:${t.muted};font-size:11px}
|
|
110
|
+
${n}__chip{display:inline-flex;align-items:center;border-radius:999px;padding:2px 8px;font-size:11px;font-weight:650;white-space:nowrap;border:1px solid transparent}
|
|
111
|
+
${n}__chip.is-confirmed{background:color-mix(in srgb,${t.success} 12%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.success} 35%,transparent)}
|
|
112
|
+
${n}__chip.is-caution{background:color-mix(in srgb,${t.warning} 14%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.warning} 40%,transparent)}
|
|
113
|
+
${n}__chip.is-missing{background:color-mix(in srgb,${t.danger} 10%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.danger} 35%,transparent)}
|
|
114
|
+
${n}__chip.is-progress{background:transparent;color:${t.muted};border-color:${t.border}}
|
|
115
|
+
${n}__list{display:grid;gap:6px}
|
|
116
|
+
${n}__list>li{position:relative;padding-inline-start:14px;color:${t.text}}
|
|
117
|
+
${n}__list>li::before{content:"";position:absolute;inset-inline-start:2px;top:.62em;width:5px;height:5px;border-radius:999px;background:${t.accent}}
|
|
118
|
+
${n}__limits>li::before{background:${t.warning}}
|
|
119
|
+
${n}__meaning{border-inline-start:2px solid ${t.accent};border-start-end-radius:8px;border-end-end-radius:8px;background:color-mix(in srgb,${t.accent} 7%,transparent);padding:8px 10px;color:${t.text}}
|
|
120
|
+
${n}__meaning strong{font-weight:700}
|
|
121
|
+
${n}__checked{color:${t.muted};font-size:11px}
|
|
122
|
+
${n}__cite{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;margin-inline-start:3px;vertical-align:middle;border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.accent};font:inherit;font-size:11px;font-weight:700;line-height:1;padding:0 5px;cursor:pointer}
|
|
123
|
+
${n}__cite:hover,${n}__cite[aria-expanded="true"]{border-color:${t.accent};background:color-mix(in srgb,${t.accent} 10%,${t.surface})}
|
|
124
|
+
${n} button:focus-visible,${n} summary:focus-visible,${n} textarea:focus-visible{outline:2px solid ${t.accent};outline-offset:2px}
|
|
125
|
+
${n}__evidence-panel{display:grid;gap:8px;border:1px solid color-mix(in srgb,${t.accent} 35%,${t.border});border-radius:10px;background:${t.surface};padding:10px 12px;box-shadow:0 6px 18px color-mix(in srgb,${t.text} 12%,transparent)}
|
|
126
|
+
${n}__evidence-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
|
|
127
|
+
${n}__evidence-text{color:${t.text};font-weight:650}
|
|
128
|
+
${n}__evidence-rows{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:4px 12px;font-size:12px}
|
|
129
|
+
${n}__evidence-rows dt{color:${t.muted}}
|
|
130
|
+
${n}__evidence-rows dd{color:${t.text};overflow-wrap:anywhere}
|
|
131
|
+
${n}__evidence-actions{display:flex;flex-wrap:wrap;gap:8px}
|
|
132
|
+
${n}__button{display:inline-flex;align-items:center;gap:6px;min-height:32px;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;font-weight:600;padding:5px 10px;cursor:pointer}
|
|
133
|
+
${n}__button:hover{border-color:${t.accent}}
|
|
134
|
+
${n}__button.is-primary{border-color:${t.accent};background:${t.accent};color:${t.onAccent??"#fff"}}
|
|
135
|
+
${n}__close{border:0;background:transparent;color:${t.muted};font:inherit;font-size:16px;line-height:1;padding:2px 6px;cursor:pointer;border-radius:6px}
|
|
136
|
+
${n}__investigate{border-top:1px solid ${t.border};padding-top:10px}
|
|
137
|
+
${n}__investigate>summary{cursor:pointer;color:${t.text};font-weight:700;list-style:revert}
|
|
138
|
+
${n}__investigate-body{display:grid;gap:12px;margin-top:10px}
|
|
139
|
+
${n}__group{display:grid;gap:6px}
|
|
140
|
+
${n}__group-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 8px}
|
|
141
|
+
${n}__hint{color:${t.muted};font-size:11px;font-weight:600}
|
|
142
|
+
${n}__card{border-radius:8px;background:${t.subtle};padding:8px 10px}
|
|
143
|
+
${n}__card-title{color:${t.text};font-weight:700}
|
|
144
|
+
${n}__card-body{margin-top:2px;color:${t.muted};font-size:12px}
|
|
145
|
+
${n}__questions{display:flex;flex-wrap:wrap;gap:6px}
|
|
146
|
+
${n}__question{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:6px 10px;text-align:start;cursor:pointer}
|
|
147
|
+
${n}__question:hover{border-color:${t.accent}}
|
|
148
|
+
${n}__source{color:${t.muted};font-size:11px}
|
|
149
|
+
${n}__feedback{display:grid;gap:8px;border-top:1px solid ${t.border};padding-top:10px}
|
|
150
|
+
${n}__feedback-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
|
|
151
|
+
${n}__feedback-label{color:${t.muted};font-size:12px;font-weight:600}
|
|
152
|
+
${n}__vote{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:${t.muted};font:inherit;cursor:pointer}
|
|
153
|
+
${n}__vote:hover{background:color-mix(in srgb,${t.accent} 10%,transparent);color:${t.accent}}
|
|
154
|
+
${n}__vote svg{width:15px;height:15px}
|
|
155
|
+
${n}__vote[aria-pressed="true"]{color:${t.accent};background:color-mix(in srgb,${t.accent} 12%,transparent)}
|
|
156
|
+
${n}__reasons{display:flex;flex-wrap:wrap;gap:6px;border:0;margin:0;padding:0}
|
|
157
|
+
${n}__reasons legend{margin-bottom:6px;color:${t.muted};font-size:12px;padding:0}
|
|
158
|
+
${n}__reason{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:4px 10px;cursor:pointer}
|
|
159
|
+
${n}__reason[aria-pressed="true"]{border-color:${t.accent};background:color-mix(in srgb,${t.accent} 12%,${t.surface})}
|
|
160
|
+
${n}__comment{width:100%;box-sizing:border-box;min-height:56px;resize:vertical;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:8px}
|
|
161
|
+
${n}__feedback-note{color:${t.muted};font-size:12px}
|
|
162
|
+
${n}__feedback-error{color:${t.danger};font-size:12px}
|
|
163
|
+
`};class Il{constructor(t,n,a,i={}){q(this,"explanationId");q(this,"submit");q(this,"onChange");q(this,"context");q(this,"state",{phase:"idle",reasons:[],comment:""});this.explanationId=t,this.submit=n,this.onChange=a,this.context=i}set(t){this.state={...this.state,...t},this.onChange(this.state)}async save(t,n){const a=this.state;this.set({phase:"saving",error:void 0});try{await this.submit(Al({explanationId:this.explanationId,...this.context,...t})),this.set({...n,error:void 0})}catch{this.set({phase:a.phase==="details"?"details":"error",rating:a.rating,error:xt.feedbackError})}}vote(t){return this.state.phase==="saving"?Promise.resolve():this.save({rating:t},t==="up"?{phase:"done",rating:t,reasons:[],comment:""}:{phase:"details",rating:t})}toggleReason(t){const n=this.state.reasons.includes(t)?this.state.reasons.filter(a=>a!==t):[...this.state.reasons,t];this.set({reasons:n})}setComment(t){this.set({comment:Array.from(t).slice(0,pr).join("")})}send(){return this.state.phase==="saving"?Promise.resolve():this.save({rating:"down",reasons:this.state.reasons,comment:this.state.comment},{phase:"done",rating:"down"})}undo(){return this.state.phase==="saving"?Promise.resolve():this.save({rating:"clear"},{phase:"idle",rating:void 0,reasons:[],comment:""})}}const Ji={delaysMs:[1e3,2e3,4e3],capMs:45e3},fr=e=>e==="pending"||e==="ready"||e==="failed"?e:"not_requested",El=e=>fr(e?.aiExplanation?.status);class zl{constructor(t,n,a,i={}){q(this,"transport");q(this,"onChange");q(this,"state");q(this,"handle");q(this,"disposed",!1);q(this,"generation",0);q(this,"attempt",0);q(this,"startedAt",0);q(this,"delays");q(this,"capMs");q(this,"now");q(this,"schedule");q(this,"cancelTimer");q(this,"isVisible");q(this,"onSettled");q(this,"inFlight",null);q(this,"pausedAt",null);q(this,"onVisibilityChange",()=>{this.disposed||this.pausedAt===null||!this.isVisible()||(this.startedAt+=this.now()-this.pausedAt,this.pausedAt=null,this.queue())});this.transport=n,this.onChange=a,this.delays=i.delaysMs?.length?i.delaysMs:Ji.delaysMs,this.capMs=i.capMs??Ji.capMs,this.now=i.now??(()=>Date.now()),this.schedule=i.schedule??((c,d)=>setTimeout(c,d)),this.cancelTimer=i.cancel??(c=>clearTimeout(c)),this.isVisible=i.isVisible??(()=>typeof document>"u"||document.visibilityState!=="hidden"),this.onSettled=i.onSettled;const o=El(t),s=o==="pending"&&!n?"not_requested":o;this.state={status:s,explanation:t,retryAvailable:s==="failed"&&this.canRetry(t.aiExplanation?.retryAvailable),retrying:!1,announcement:""}}get explanationId(){return this.state.explanation.aiExplanation?.explanationId||this.state.explanation.explanationId||""}canRetry(t){return!!this.transport?.retry&&t!==!1}set(t){if(this.disposed)return;const n=this.state.status;this.state={...this.state,...t},this.onChange(this.state);const a=this.state.status;a!==n&&(a==="ready"||a==="failed"||a==="not_requested")&&this.onSettled?.(a)}start(){this.state.status!=="pending"||!this.explanationId||(this.disposed=!1,this.startedAt=this.now(),this.attempt=0,typeof document<"u"&&document.addEventListener("visibilitychange",this.onVisibilityChange),this.queue())}queue(){if(this.disposed)return;if(!this.isVisible()){this.pausedAt??(this.pausedAt=this.now());return}const t=this.now()-this.startedAt;if(t>=this.capMs){this.fail(!0);return}const n=this.delays[Math.min(this.attempt,this.delays.length-1)]??4e3;this.attempt+=1;const a=this.generation;this.handle=this.schedule(()=>{this.pollOnce(a)},Math.min(n,Math.max(0,this.capMs-t)))}async pollOnce(t){if(this.disposed||t!==this.generation||!this.transport)return;if(!this.isVisible()){this.pausedAt??(this.pausedAt=this.now());return}const n=new AbortController;this.inFlight=n;try{const a=await this.transport.poll(this.explanationId,n.signal);if(this.disposed||t!==this.generation)return;this.apply(a)}catch{if(this.disposed||t!==this.generation)return;this.queue()}finally{this.inFlight===n&&(this.inFlight=null)}}apply(t){const n=fr(t.status);if(this.applyBasicUpdate(t,n),n==="ready"&&t.explanation&&ur(t.explanation)){this.set({status:"ready",explanation:t.explanation,retryAvailable:!1,retrying:!1,announcement:xt.detailedReady});return}if(n==="pending"){this.state.status!=="pending"&&this.set({status:"pending",retrying:!1,announcement:""}),this.queue();return}if(n==="not_requested"){this.set({status:"not_requested",retryAvailable:!1,retrying:!1,announcement:""});return}this.fail(this.canRetry(t.retryAvailable))}applyBasicUpdate(t,n){const a=t.basic;if(!a||n==="ready"||this.state.status==="ready"||!ur(a))return;const i=this.state.explanation;a.headline===i.headline&&a.summary===i.summary||this.set({explanation:{...a,explanationId:i.explanationId??a.explanationId,aiExplanation:i.aiExplanation,level:i.level}})}fail(t){this.generation+=1,this.set({status:"failed",retryAvailable:t&&this.canRetry(!0),retrying:!1,announcement:xt.detailedUnavailable})}async retry(){if(!this.transport?.retry||this.state.retrying||this.state.status==="ready")return;const t=this.explanationId;if(!t)return;this.generation+=1;const n=this.generation;this.set({retrying:!0,announcement:""});try{const a=await this.transport.retry(t);if(this.disposed||n!==this.generation)return;if(fr(a.status)==="pending"){this.set({status:"pending",retrying:!1,retryAvailable:!1,announcement:xt.preparingDetailed}),this.startedAt=this.now(),this.attempt=0,this.queue();return}this.apply(a)}catch{if(this.disposed||n!==this.generation)return;this.set({status:"failed",retrying:!1,retryAvailable:!1,announcement:xt.detailedUnavailable})}}dispose(){this.disposed=!0,this.generation+=1,this.inFlight?.abort(),this.inFlight=null,this.handle!==void 0&&this.cancelTimer(this.handle),typeof document<"u"&&document.removeEventListener("visibilitychange",this.onVisibilityChange)}}const Xi=Ha(xt),zn=()=>Ga(Xi),Nl=(e,t)=>{const n=R(t);n.current=t;const a=R(()=>{}),i=e.aiExplanation?.explanationId??e.explanationId??"",o=e.aiExplanation?.status==="pending"?"pending":"settled",s=Be(()=>{const u=n.current,p=u?{poll:(m,f)=>n.current.poll(m,f),...u.retry?{retry:(m,f)=>n.current.retry(m,f)}:{}}:void 0;return new zl(e,p,m=>a.current(m),{onSettled:m=>n.current?.settled?.(i,m)})},[i,o,!!t]),[c,d]=$(s.state);return X(()=>(a.current=d,d(s.state),s.start(),()=>s.dispose()),[s]),[c.status==="ready"?c:{...c,explanation:e},s]},Rl=({prefix:e,state:t,onRetry:n})=>{const a=zn();return r("div",{class:`${e}-xp__ai`,"data-ai-status":t.status,children:[t.status==="pending"?r("p",{class:`${e}-xp__ai-note`,children:a.preparingDetailed}):null,t.status==="failed"?r("p",{class:`${e}-xp__ai-note`,children:[a.detailedUnavailable,t.retryAvailable?r("button",{type:"button",class:`${e}-xp__ai-retry`,disabled:t.retrying,onClick:n,children:a.detailedRetry}):null]}):null,r("span",{class:`${e}-xp__sr`,role:"status","aria-live":"polite",children:t.announcement})]})},Ll=({citations:e,step:t,prefix:n,active:a,onToggle:i,evidenceById:o})=>{const s=zn();return e.length===0?null:r(se,{children:e.map(c=>{const d=a?.id===c.id&&a.step===t;return r("button",{type:"button",class:`${n}-xp__cite`,"data-evidence-id":c.id,"aria-expanded":d,"aria-label":`${s.citationLabel} ${c.index}: ${o[c.id]?.text??""}`.trim(),onClick:l=>i(c.id,t,l.currentTarget),children:Tl(c).slice(1,-1)},c.id)})})},Dl=(e,t)=>e.sourceTargets.find(n=>t?t(n):!0),Pl=({evidence:e,prefix:t,onClose:n,onOpenSource:a,canOpenSource:i})=>{const o=zn(),s=R(null);X(()=>{s.current?.focus()},[e.id]);const c=a?Dl(e,i):void 0;return r("div",{ref:s,class:`${t}-xp__evidence-panel`,role:"region",tabIndex:-1,"aria-label":`${o.evidence} ${e.index}`,"data-testid":"analytics-explanation-evidence",onKeyDown:d=>{d.key==="Escape"&&(d.stopPropagation(),n())},children:[r("div",{class:`${t}-xp__evidence-head`,children:[r("p",{class:`${t}-xp__evidence-text`,children:["[",e.index,"] ",e.text]}),r("button",{type:"button",class:`${t}-xp__close`,"aria-label":o.closeEvidence,onClick:n,children:"×"})]}),r("dl",{class:`${t}-xp__evidence-rows`,children:Cl(e,o).map(d=>r("div",{style:{display:"contents"},"data-row":d.key,children:[r("dt",{children:d.label}),r("dd",{children:d.value})]},d.key))}),c&&a?r("div",{class:`${t}-xp__evidence-actions`,children:r("button",{type:"button",class:`${t}-xp__button`,onClick:()=>a(c,e),children:o.openSource})}):null]})},Qi=({down:e})=>r("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",style:e?{transform:"scaleY(-1)"}:void 0,children:r("path",{d:"M7 10v11H3V10h4Zm0 0 4-7a2 2 0 0 1 2 2v4h6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.8 21H7"})}),Ol=(e,t,n)=>t==="wrong_numbers"?e.reasonWrongNumbers:t==="missing_comparison"?e.reasonMissingComparison:t==="unclear"?e.reasonUnclear:t==="too_long"?e.reasonTooLong:n,Fl=({prefix:e,explanationId:t,submit:n,context:a})=>{const i=zn(),[o,s]=$({phase:"idle",reasons:[],comment:""}),c=Be(()=>new Il(t,n,s,a),[t]),d=o.phase==="saving";return r("div",{class:`${e}-xp__feedback`,"data-testid":"analytics-explanation-feedback",children:[o.phase==="done"?r("div",{class:`${e}-xp__feedback-row`,role:"status",children:[r("span",{class:`${e}-xp__feedback-note`,children:i.feedbackThanks}),r("button",{type:"button",class:`${e}-xp__button`,onClick:()=>{c.undo()},children:i.feedbackUndo})]}):r("div",{class:`${e}-xp__feedback-row`,children:[r("span",{class:`${e}-xp__feedback-label`,children:i.feedbackPrompt}),r("button",{type:"button",class:`${e}-xp__vote`,"aria-label":i.feedbackHelpful,"aria-pressed":o.rating==="up",disabled:d,onClick:()=>{c.vote("up")},children:r(Qi,{down:!1})}),r("button",{type:"button",class:`${e}-xp__vote`,"aria-label":i.feedbackNotHelpful,"aria-pressed":o.rating==="down",disabled:d,onClick:()=>{c.vote("down")},children:r(Qi,{down:!0})})]}),o.phase==="details"||d&&o.rating==="down"?r("form",{class:`${e}-xp__feedback-form`,onSubmit:l=>{l.preventDefault(),c.send()},children:[r("fieldset",{class:`${e}-xp__reasons`,children:[r("legend",{children:i.feedbackReasonsPrompt}),Vi.map(l=>r("button",{type:"button",class:`${e}-xp__reason`,"aria-pressed":o.reasons.includes(l.id),onClick:()=>c.toggleReason(l.id),children:Ol(i,l.id,l.label)},l.id))]}),r("textarea",{class:`${e}-xp__comment`,"aria-label":i.feedbackCommentPlaceholder,placeholder:i.feedbackCommentPlaceholder,maxLength:pr,value:o.comment,onInput:l=>c.setComment(l.currentTarget.value)}),r("div",{class:`${e}-xp__feedback-row`,children:r("button",{type:"submit",class:`${e}-xp__button is-primary`,disabled:d,children:i.feedbackSubmit})})]}):null,o.error?r("p",{class:`${e}-xp__feedback-error`,role:"alert",children:o.error}):null]})},eo=({aiTransport:e,...t})=>{const[n,a]=Nl(t.explanation,e),i=Ul(t.explanation),o=Be(()=>({...xt,...t.copy}),[t.copy]);return r(Xi.Provider,{value:o,children:r(Bl,{...t,explanation:n.explanation,aiStatus:i?r(Rl,{prefix:t.classPrefix,state:n,onRetry:()=>{a.retry()}}):null})})},Ul=e=>!!(e.aiExplanation&&e.aiExplanation.status!=="not_requested"),Bl=({explanation:e,aiStatus:t,classPrefix:n,showLead:a=!0,investigateOpen:i=!1,onFollowUp:o,onOpenSource:s,canOpenSource:c,onFeedback:d,feedbackContext:l,onExpand:u,onCollapse:p,expanded:m=!1,...f})=>{const _=zn(),h=R(null),I=R(null),x=R(!1),g=()=>{const A=h.current,N=A?.getRootNode(),y=N&&"activeElement"in N?N.activeElement:null;return!!(A&&y&&A.contains(y))},T=Be(()=>(x.current=g(),Sl(e,{...f,copy:_})),[e,f.locale,f.cleanText,_]),[V,P]=$(),ee=R(null);Sn(()=>{!V||T.evidenceById[V.id]&&h.current?.querySelector('[data-testid="analytics-explanation-evidence"]')||(P(void 0),x.current&&!g()&&(I.current??h.current)?.focus())},[T]);const Z=(A,N,y)=>{ee.current=y,P(D=>D?.id===A&&D.step===N?void 0:{id:A,step:N})},Y=()=>{P(void 0);const A=ee.current;A?.isConnected?A.focus():(I.current??h.current)?.focus()},z=(A,N)=>r(Ll,{citations:A,step:N,prefix:n,active:V,onToggle:Z,evidenceById:T.evidenceById}),te=A=>{if(!V||V.step!==A)return null;const N=T.evidenceById[V.id];return N?r(Pl,{evidence:N,prefix:n,onClose:Y,onOpenSource:s,canOpenSource:c}):null},U=(A,N)=>r(se,{children:[A.text,z(A.citations,N)]}),{investigate:B}=T;return r("section",{ref:h,class:`${n}-xp${m?" is-expanded":""}${u||p?" has-expand":""}`,"data-testid":"analytics-explanation","aria-label":_.region,tabIndex:-1,children:[m&&p?r("button",{type:"button",class:`${n}-xp__expand`,"aria-label":_.collapse,title:_.collapse,onClick:p,children:"×"}):u?r("button",{type:"button",class:`${n}-xp__expand`,"aria-label":_.expand,title:_.expand,"data-testid":"analytics-explanation-expand",onClick:u,children:"⤢"}):null,a?r("div",{class:`${n}-xp__lead`,"data-step":"lead",children:[T.lead.preface?r("p",{class:`${n}-xp__preface`,children:T.lead.preface}):null,r("div",{class:`${n}-xp__meta`,children:[r("span",{class:`${n}-xp__eyebrow`,children:T.lead.eyebrow}),r("span",{class:`${n}-xp__provenance`,children:T.lead.provenance})]}),r("h3",{class:`${n}-xp__headline`,ref:I,tabIndex:-1,children:U(T.lead.headline,"lead")}),T.lead.summary?r("p",{class:`${n}-xp__summary`,children:U(T.lead.summary,"lead")}):null,te("lead")]}):null,t,T.comparison.length>0?r("section",{class:`${n}-xp__step`,"data-step":"comparison",children:[r("h4",{class:`${n}-xp__title`,children:_.comparison}),r("ul",{class:`${n}-xp__periods`,children:T.comparison.map(A=>r("li",{class:`${n}-xp__period`,"data-status":A.status??"observed",children:[r("span",{class:`${n}-xp__period-label`,children:A.label}),A.valueText?r("span",{class:`${n}-xp__period-value`,children:A.valueText}):null,A.statusLabel?r("span",{class:`${n}-xp__chip is-${A.statusTone}`,children:A.statusLabel}):null,A.inProgress?r("span",{class:`${n}-xp__chip is-progress`,children:_.inProgress}):null,A.citation?z([A.citation],"comparison"):null,A.reason?r("small",{class:`${n}-xp__period-reason`,children:A.reason}):null]},A.key))}),te("comparison")]}):null,T.conclusions.length>0||T.businessMeaning?r("section",{class:`${n}-xp__step`,"data-step":"conclusions",children:[r("h4",{class:`${n}-xp__title`,children:_.conclusions}),T.conclusions.length>0?r("ul",{class:`${n}-xp__list`,children:T.conclusions.map(A=>r("li",{children:U(A,"conclusions")},A.text))}):null,T.businessMeaning?r("p",{class:`${n}-xp__meaning`,children:[r("strong",{children:[_.whyItMatters,": "]}),U(T.businessMeaning,"conclusions")]}):null,te("conclusions")]}):null,T.limits.length>0?r("section",{class:`${n}-xp__step`,"data-step":"limits",children:[r("h4",{class:`${n}-xp__title`,children:_.limits}),r("ul",{class:`${n}-xp__list ${n}-xp__limits`,children:T.limits.map(A=>r("li",{"data-kind":A.kind,children:[A.text,A.citation?z([A.citation],"limits"):null]},A.text))}),te("limits")]}):null,T.checkedLine?r("p",{class:`${n}-xp__checked`,"data-step":"checked",children:T.checkedLine}):null,T.hasInvestigate?r("details",{class:`${n}-xp__investigate`,"data-step":"investigate",open:i,children:[r("summary",{children:_.investigate}),r("div",{class:`${n}-xp__investigate-body`,children:[B.causes.length>0?r("div",{class:`${n}-xp__group`,children:[r("div",{class:`${n}-xp__group-head`,children:[r("h4",{class:`${n}-xp__title`,children:_.causes}),r("span",{class:`${n}-xp__hint`,children:_.causesHint})]}),B.causes.map(A=>r("article",{class:`${n}-xp__card`,children:[r("p",{class:`${n}-xp__card-title`,children:[A.title,z(A.citations,"investigate")]}),A.howToCheck?r("p",{class:`${n}-xp__card-body`,children:[_.howToCheck," ",A.howToCheck]}):null]},A.title))]}):null,B.recommendations.length>0?r("div",{class:`${n}-xp__group`,children:[r("h4",{class:`${n}-xp__title`,children:_.recommendations}),B.recommendations.map(A=>r("article",{class:`${n}-xp__card`,children:[r("p",{class:`${n}-xp__card-title`,children:[A.title,z(A.citations,"investigate")]}),A.why?r("p",{class:`${n}-xp__card-body`,children:A.why}):null,A.watch?r("p",{class:`${n}-xp__card-body`,children:[_.watch," ",A.watch]}):null]},A.title))]}):null,B.outlook?r("div",{class:`${n}-xp__group`,children:[r("div",{class:`${n}-xp__group-head`,children:[r("h4",{class:`${n}-xp__title`,children:_.outlook}),r("span",{class:`${n}-xp__hint`,children:B.outlook.badge})]}),r("p",{class:`${n}-xp__card-body`,children:B.outlook.text}),B.outlook.note?r("p",{class:`${n}-xp__card-body`,children:B.outlook.note}):null]}):null,o&&B.followUps.length>0?r("div",{class:`${n}-xp__group`,children:[r("h4",{class:`${n}-xp__title`,children:_.followUps}),r("div",{class:`${n}-xp__questions`,children:B.followUps.map(A=>r("button",{type:"button",class:`${n}-xp__question`,onClick:()=>o(A),children:A},A))})]}):null,T.evidence.length>0?r("div",{class:`${n}-xp__group`,children:[r("h4",{class:`${n}-xp__title`,children:_.evidenceList}),r("ul",{class:`${n}-xp__list`,children:T.evidence.map(A=>r("li",{children:[A.text,z([{id:A.id,index:A.index}],"investigate")]},A.id))})]}):null,te("investigate")]})]}):null,r("p",{class:`${n}-xp__source`,children:T.sourceNote}),d&&T.explanationId?r(Fl,{prefix:n,explanationId:T.explanationId,submit:d,context:l}):null]})},ql=[{name:"Smileys",emojis:["😀","😃","😄","😁","😅","😂","🤣","😊","😇","🙂","🙃","😉","😌","😍","🥰","😘","😋","😛","😜","🤪","🤗","🤭","🤔","🤐","😐","😶","😏","🙄","😴","🥳","😎","🤓","🥺","😢","😭","😤","😠","🤯","😬","😱","🤩","🥱"]},{name:"Gestures",emojis:["👍","👎","👌","🤌","✌️","🤞","🤟","🤘","🤙","👈","👉","👆","👇","✋","🖐️","👋","🤝","🙏","💪","👏","🙌","👐","🤲","🫶"]},{name:"Hearts & symbols",emojis:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","💔","❣️","💕","💖","💘","💝","✨","⭐","🌟","💫","🔥","🎉","🎊","✅","❌","⚡","💯","🚀"]},{name:"Animals & nature",emojis:["🐶","🐱","🦊","🐻","🐼","🐨","🦁","🐮","🐸","🐵","🐧","🦄","🐝","🦋","🐢","🐬","🌷","🌸","🌹","🌻","🌳","🍀"]},{name:"Food & drink",emojis:["🍎","🍌","🍉","🍓","🍒","🥑","🍔","🍟","🍕","🌮","🍿","🍩","🍪","🎂","☕","🍵","🍺","🥂","🍷"]},{name:"Objects & travel",emojis:["🚀","✈️","🚗","🏠","📦","📱","💻","⌚","📷","💡","🔑","🎁","📌","✏️","📝","📞","📧","💰","📈","⏰","🔔","🎯","🏆","🎮","🎵","💬","👀"]}],ba={"contact-support":{title:"Contact support",submit:"Request support",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"subject",label:"Subject",kind:"text",required:!0},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"Describe what you need help with."}]},inquiry:{title:"Leave a message",submit:"Send message",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"How can we help?"}]},contact:{title:"Share your details",submit:"Save",fields:[{key:"name",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"email",label:"Email",kind:"email",required:!0,identity:"email"},{key:"phone",label:"Phone",kind:"tel",required:!0,identity:"phone"}]},"book-demo":{title:"Book a demo",submit:"Request demo",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"preferredAt",label:"Preferred time",kind:"text",placeholder:"e.g. Thursday 3pm"},{key:"notes",label:"Notes",kind:"textarea",placeholder:"Anything we should know?"}]},"request-callback":{title:"Request a callback",submit:"Request callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"schedule-callback":{title:"Schedule a callback",submit:"Schedule callback",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorPhone",label:"Phone number",kind:"tel",required:!0,identity:"phone"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"subscribe-newsletter":{title:"Subscribe",submit:"Subscribe",fields:[{key:"visitorName",label:"Full name",kind:"text",required:!0,identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"}]}},hr={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",reconnectSupport:"Reconnect to support",reconnectPrompt:"I can bring a teammate back into this chat.",waitingForTeam:"AI helping · team notified",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…",voiceHearing:"Hearing you…",voiceUnavailable:"Can’t hear you — check your microphone.",voiceProcessing:"Transcribing…",voiceSpeaking:"Speaking…",voiceNoise:"No clear speech heard. Move closer to the mic and try again.",voiceMisunderstood:"Could not transcribe that. Please try again or type your message.",voiceDenied:"Microphone unavailable. Allow access or type your message.",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",feedbackAnswerPrompt:"Was this answer 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.",resultExpired:"This result is not stored on this device. Ask again to see it.",attaching:"Reading file…",attachTooLarge:"That file is too large (max 5 MB).",attachFailed:"Could not attach that file. Check its type and try again.",attachPreviewTitle:"Preview of {name}",attachOpen:"Preview {name}",attachDownload:"Download",attachPreviewClose:"Close preview",attachPreviewLoading:"Loading file…",attachPreviewFailed:"This file can’t be shown right now. It may have expired.",attachPreviewUnsupported:"This file can’t be previewed here. Download it to open it.",attachAnalysisFailed:"Saved for the team; AI could not read it.",removeAttachment:"Remove attachment",attachLimit:"You can attach up to {count} files to one message.",attachedFiles:"Attached files",removeAttachmentNamed:"Remove {name}",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.",caseReference:"Reference: {reference}",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",bookingCallbackDuration:"{count}-minute callback",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:"Demo requested for {when}. The team will follow up.",bookingVerificationPending:"We received your request for {when}, but could not verify the calendar booking. The team will check it. Please do not book this time again.",bookingCallbackRequested:"Callback requested for {when}.",bookingCallbackConfirmed:"Your callback is scheduled for {when}.",bookingConfirmed:"Your demo is booked for {when}.",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. 📅",bookingScheduled:"Your demo is booked. Your booking details are saved in this chat.",bookingBackToChat:"Back to chat",bookingOpenNewTab:"Open in new tab",bookingCloseScheduler:"Close scheduler",bookingLoadingScheduler:"Loading scheduler…",bookingMeetingLink:"Meeting link",bookingManageLink:"Manage booking",bookingCheckingDetails:"Getting your meeting link…",bookingDetailsUnavailable:"We could not verify the booking details yet. Try checking again here; please do not book the same time twice.",bookingUnverifiedLink:"View unverified calendar record",bookingRetryDetails:"Retry",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"},qe=(e,t)=>e.replace(/\{(\w+)\}/g,(n,a)=>t[a]??""),Nn=(e,t,n)=>!t||e.includes(t)?e:`${e} ${qe(n.caseReference,{reference:t})}`,Vl=e=>e?{...hr,...e}:hr,to=Ha(hr),jl=to.Provider,no=Ha(void 0),Hl=no.Provider,mr=()=>Ga(no),Wl=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb"]),Gl=(e,t)=>{if(t==="ltr"||t==="rtl")return t;const n=(e??"").trim().toLowerCase().split(/[-_]/)[0]??"";return Wl.has(n)?"rtl":"ltr"},ct=()=>Ga(to),nn=[["AF","Afghanistan","93"],["AL","Albania","355"],["DZ","Algeria","213"],["AS","American Samoa","1684"],["AD","Andorra","376"],["AO","Angola","244"],["AI","Anguilla","1264"],["AG","Antigua and Barbuda","1268"],["AR","Argentina","54"],["AM","Armenia","374"],["AW","Aruba","297"],["AU","Australia","61"],["AT","Austria","43"],["AZ","Azerbaijan","994"],["BS","Bahamas","1242"],["BH","Bahrain","973"],["BD","Bangladesh","880"],["BB","Barbados","1246"],["BY","Belarus","375"],["BE","Belgium","32"],["BZ","Belize","501"],["BJ","Benin","229"],["BM","Bermuda","1441"],["BT","Bhutan","975"],["BO","Bolivia","591"],["BA","Bosnia and Herzegovina","387"],["BW","Botswana","267"],["BR","Brazil","55"],["BN","Brunei","673"],["BG","Bulgaria","359"],["BF","Burkina Faso","226"],["BI","Burundi","257"],["CV","Cabo Verde","238"],["KH","Cambodia","855"],["CM","Cameroon","237"],["CA","Canada","1"],["KY","Cayman Islands","1345"],["CF","Central African Republic","236"],["TD","Chad","235"],["CL","Chile","56"],["CN","China","86"],["CO","Colombia","57"],["KM","Comoros","269"],["CG","Congo","242"],["CD","Congo, Democratic Republic","243"],["CK","Cook Islands","682"],["CR","Costa Rica","506"],["CI","Cote d'Ivoire","225"],["HR","Croatia","385"],["CU","Cuba","53"],["CW","Curacao","599"],["CY","Cyprus","357"],["CZ","Czechia","420"],["DK","Denmark","45"],["DJ","Djibouti","253"],["DM","Dominica","1767"],["DO","Dominican Republic","1809"],["EC","Ecuador","593"],["EG","Egypt","20"],["SV","El Salvador","503"],["GQ","Equatorial Guinea","240"],["ER","Eritrea","291"],["EE","Estonia","372"],["SZ","Eswatini","268"],["ET","Ethiopia","251"],["FO","Faroe Islands","298"],["FJ","Fiji","679"],["FI","Finland","358"],["FR","France","33"],["GF","French Guiana","594"],["PF","French Polynesia","689"],["GA","Gabon","241"],["GM","Gambia","220"],["GE","Georgia","995"],["DE","Germany","49"],["GH","Ghana","233"],["GI","Gibraltar","350"],["GR","Greece","30"],["GL","Greenland","299"],["GD","Grenada","1473"],["GP","Guadeloupe","590"],["GU","Guam","1671"],["GT","Guatemala","502"],["GG","Guernsey","44"],["GN","Guinea","224"],["GW","Guinea-Bissau","245"],["GY","Guyana","592"],["HT","Haiti","509"],["HN","Honduras","504"],["HK","Hong Kong","852"],["HU","Hungary","36"],["IS","Iceland","354"],["IN","India","91"],["ID","Indonesia","62"],["IR","Iran","98"],["IQ","Iraq","964"],["IE","Ireland","353"],["IM","Isle of Man","44"],["IL","Israel","972"],["IT","Italy","39"],["JM","Jamaica","1876"],["JP","Japan","81"],["JE","Jersey","44"],["JO","Jordan","962"],["KZ","Kazakhstan","7"],["KE","Kenya","254"],["KI","Kiribati","686"],["XK","Kosovo","383"],["KW","Kuwait","965"],["KG","Kyrgyzstan","996"],["LA","Laos","856"],["LV","Latvia","371"],["LB","Lebanon","961"],["LS","Lesotho","266"],["LR","Liberia","231"],["LY","Libya","218"],["LI","Liechtenstein","423"],["LT","Lithuania","370"],["LU","Luxembourg","352"],["MO","Macao","853"],["MG","Madagascar","261"],["MW","Malawi","265"],["MY","Malaysia","60"],["MV","Maldives","960"],["ML","Mali","223"],["MT","Malta","356"],["MH","Marshall Islands","692"],["MQ","Martinique","596"],["MR","Mauritania","222"],["MU","Mauritius","230"],["MX","Mexico","52"],["FM","Micronesia","691"],["MD","Moldova","373"],["MC","Monaco","377"],["MN","Mongolia","976"],["ME","Montenegro","382"],["MS","Montserrat","1664"],["MA","Morocco","212"],["MZ","Mozambique","258"],["MM","Myanmar","95"],["NA","Namibia","264"],["NR","Nauru","674"],["NP","Nepal","977"],["NL","Netherlands","31"],["NC","New Caledonia","687"],["NZ","New Zealand","64"],["NI","Nicaragua","505"],["NE","Niger","227"],["NG","Nigeria","234"],["NU","Niue","683"],["KP","North Korea","850"],["MK","North Macedonia","389"],["MP","Northern Mariana Islands","1670"],["NO","Norway","47"],["OM","Oman","968"],["PK","Pakistan","92"],["PW","Palau","680"],["PS","Palestine","970"],["PA","Panama","507"],["PG","Papua New Guinea","675"],["PY","Paraguay","595"],["PE","Peru","51"],["PH","Philippines","63"],["PL","Poland","48"],["PT","Portugal","351"],["PR","Puerto Rico","1787"],["QA","Qatar","974"],["RE","Reunion","262"],["RO","Romania","40"],["RU","Russia","7"],["RW","Rwanda","250"],["KN","Saint Kitts and Nevis","1869"],["LC","Saint Lucia","1758"],["VC","Saint Vincent and the Grenadines","1784"],["WS","Samoa","685"],["SM","San Marino","378"],["ST","Sao Tome and Principe","239"],["SA","Saudi Arabia","966"],["SN","Senegal","221"],["RS","Serbia","381"],["SC","Seychelles","248"],["SL","Sierra Leone","232"],["SG","Singapore","65"],["SK","Slovakia","421"],["SI","Slovenia","386"],["SB","Solomon Islands","677"],["SO","Somalia","252"],["ZA","South Africa","27"],["KR","South Korea","82"],["SS","South Sudan","211"],["ES","Spain","34"],["LK","Sri Lanka","94"],["SD","Sudan","249"],["SR","Suriname","597"],["SE","Sweden","46"],["CH","Switzerland","41"],["SY","Syria","963"],["TW","Taiwan","886"],["TJ","Tajikistan","992"],["TZ","Tanzania","255"],["TH","Thailand","66"],["TL","Timor-Leste","670"],["TG","Togo","228"],["TO","Tonga","676"],["TT","Trinidad and Tobago","1868"],["TN","Tunisia","216"],["TR","Turkey","90"],["TM","Turkmenistan","993"],["TC","Turks and Caicos Islands","1649"],["TV","Tuvalu","688"],["UG","Uganda","256"],["UA","Ukraine","380"],["AE","United Arab Emirates","971"],["GB","United Kingdom","44"],["US","United States","1"],["UY","Uruguay","598"],["UZ","Uzbekistan","998"],["VU","Vanuatu","678"],["VA","Vatican City","39"],["VE","Venezuela","58"],["VN","Vietnam","84"],["VG","Virgin Islands, British","1284"],["VI","Virgin Islands, U.S.","1340"],["YE","Yemen","967"],["ZM","Zambia","260"],["ZW","Zimbabwe","263"]].map(([e,t,n])=>({iso:e,name:t,dial:n})),ao=e=>[...e.toUpperCase()].map(t=>String.fromCodePoint(127397+t.charCodeAt(0))).join(""),Kl=()=>{let e="";try{if(Intl.DateTimeFormat().resolvedOptions().timeZone==="Africa/Lagos"&&(e="NG"),!e){const t=navigator.languages?.[0]||navigator.language;e=new Intl.Locale(t).region||""}}catch{e=""}return nn.find(t=>t.iso===e)??nn.find(t=>t.iso==="US")},Yl=e=>{const t=Kl(),n=e?.trim()??"";if(!n.startsWith("+"))return{country:t,national:n.replace(/\D/g,"")};const a=n.replace(/\D/g,""),i=[...nn].sort((o,s)=>s.dial.length-o.dial.length).find(o=>a.startsWith(o.dial))??t;return{country:i,national:a.slice(i.dial.length)}},ro=(e,t)=>{const n=t.replace(/\D/g,"").replace(/^0+/,"");return n?`+${e.dial}${n}`:""},Zl=e=>{const t=e.replace(/\D/g,"");return e.startsWith("+")&&t.length>=8&&t.length<=15},$e=(e,t)=>r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",...t,children:e}),Jl=e=>r("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:r("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5 3.25h14A3.75 3.75 0 0 1 22.75 7v6A3.75 3.75 0 0 1 19 16.75h-7.19l-4.26 3.84A.75.75 0 0 1 6.25 20v-3.32A3.75 3.75 0 0 1 2.25 13V7A3.75 3.75 0 0 1 6 3.25Zm3 7.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z"})}),pn=e=>$e(r("path",{d:"m6 9 6 6 6-6"}),e),Xl=e=>$e(r(se,{children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),e),Rn=e=>$e(r(se,{children:[r("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),r("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),r("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),e),Ql=e=>$e(r(se,{children:[r("path",{d:"M9 9v1a3 3 0 0 0 4.24 2.73"}),r("path",{d:"M15 5.5V5a3 3 0 0 0-5.94-.6"}),r("path",{d:"M19 10v2a7 7 0 0 1-9.9 6.36"}),r("path",{d:"M5 10v2a6.98 6.98 0 0 0 1.11 3.79"}),r("line",{x1:"12",y1:"19",x2:"12",y2:"22"}),r("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}),e),Ln=e=>$e(r(se,{children:[r("path",{d:"M15 3h6v6"}),r("path",{d:"M10 14 21 3"}),r("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),e),ed=e=>$e(r(se,{children:[r("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),r("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),r("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),r("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),e),gr=e=>$e(r(se,{children:[r("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),r("path",{d:"m22 7-10 5L2 7"})]}),e),td=e=>$e(r("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z"}),e),io=e=>$e(r(se,{children:[r("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),r("path",{d:"M18 19h-2"}),r("rect",{x:"3",y:"13",width:"4",height:"6",rx:"2"}),r("rect",{x:"17",y:"13",width:"4",height:"6",rx:"2"})]}),e),nd=e=>$e(r(se,{children:[r("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z"}),r("path",{d:"M8 9h8M8 13h5"})]}),e),ad=e=>$e(r(se,{children:[r("path",{d:"M3 4h18M4 4v12h16V4M12 16v5M8 21h8"}),r("path",{d:"m8 12 2.5-2.5 2 2L16 8"})]}),e),rd=e=>$e(r(se,{children:[r("path",{d:"M15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}),r("path",{d:"M3 9h12M7 2v4M12 2v4"}),r("circle",{cx:"17",cy:"17",r:"4"}),r("path",{d:"M17 15v2l1.5 1"})]}),e),id=e=>$e(r(se,{children:[r("path",{d:"M4 4h16v16H5a3 3 0 0 1-3-3V6"}),r("path",{d:"M8 8h8M8 12h8M8 16h5"})]}),e),od=e=>$e(r(se,{children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M8.5 14.5a4 4 0 0 0 7 0"}),r("line",{x1:"9",y1:"9.5",x2:"9.01",y2:"9.5"}),r("line",{x1:"15",y1:"9.5",x2:"15.01",y2:"9.5"})]}),e),Dn=e=>$e(r(se,{children:[r("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),e),sd=e=>$e(r(se,{children:[r("path",{d:"M11 5 6 9H2v6h4l5 4z"}),r("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),r("path",{d:"M19 5a9 9 0 0 1 0 14"})]}),e),cd=e=>$e(r(se,{children:[r("path",{d:"M11 5 6 9H2v6h4l5 4z"}),r("line",{x1:"22",y1:"9",x2:"16",y2:"15"}),r("line",{x1:"16",y1:"9",x2:"22",y2:"15"})]}),e),fn=e=>$e(r("path",{d:"M20 6 9 17l-5-5"}),e),ld=e=>$e(r(se,{children:[r("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),r("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),e),dd=e=>$e(r(se,{children:[r("path",{d:"M1 4v6h6"}),r("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),e),ud=e=>$e(r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),e),va=e=>$e(r("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"}),e),br=e=>$e(r(se,{children:[r("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),r("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}),e),pd=e=>$e(r(se,{children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 7v5l3 2"})]}),e),oo=e=>$e(r(se,{children:[r("path",{d:"M7 10v12"}),r("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),e),so=e=>$e(r(se,{children:[r("path",{d:"M17 14V2"}),r("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]}),e),fd=e=>$e(r(se,{children:[r("path",{d:"M15 3h6v6"}),r("path",{d:"M9 21H3v-6"}),r("path",{d:"M21 3l-7 7"}),r("path",{d:"M3 21l7-7"})]}),e),hd=e=>$e(r(se,{children:[r("path",{d:"M9 3v6H3"}),r("path",{d:"M15 21v-6h6"}),r("path",{d:"M9 9 2 2"}),r("path",{d:"M15 15l7 7"})]}),e),md=e=>$e(r(se,{children:[r("rect",{x:"3",y:"4",width:"18",height:"14",rx:"2"}),r("rect",{x:"11",y:"11",width:"8",height:"6",rx:"1",fill:"currentColor",stroke:"none"})]}),e),gd=e=>$e(r(se,{children:[r("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),r("path",{d:"M12 15V9"}),r("path",{d:"m8.5 12.5 3.5-3.5 3.5 3.5"})]}),e),bd=e=>$e(r(se,{children:[r("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r("path",{d:"m19 12-7 7-7-7"})]}),e),co=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(\[[^\]]+\]\([^\s)]+\))|(https?:\/\/[^\s)]+)/g,vd=e=>e.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
|
|
164
|
+
$2`),hn=e=>{const t=[];let n=0,a=0,i;for(co.lastIndex=0;(i=co.exec(e))!==null;){i.index>n&&t.push(e.slice(n,i.index));const o=i[0];if(o.startsWith("`"))t.push(r("code",{class:"cf-md-code",children:o.slice(1,-1)},a++));else if(o.startsWith("**"))t.push(r("strong",{children:o.slice(2,-2)},a++));else if(o.startsWith("[")&&!/\]\(https?:\/\//.test(o))t.push(/^\[([^\]]+)\]/.exec(o)?.[1]??o);else if(o.startsWith("[")){const s=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(o),c=s?s[1]:o,d=s?s[2]:"#";t.push(r("a",{href:d,target:"_blank",rel:"noopener noreferrer nofollow",children:c},a++))}else t.push(r("a",{href:o,target:"_blank",rel:"noopener noreferrer nofollow",children:o},a++));n=i.index+o.length}return n<e.length&&t.push(e.slice(n)),t},xd=/^(```|#{1,6}\s|\s*[-*•]\s|\s*\d+\.\s)/,yd=(e,t,n)=>{const a=`cf-md-h cf-md-h--${Math.min(e,6)}`;return e<=2?r("h3",{class:a,children:t},n):e===3?r("h4",{class:a,children:t},n):r("h5",{class:a,children:t},n)},_d=e=>{const t=vd(e.replace(/\r\n/g,`
|
|
25
165
|
`)).split(`
|
|
26
|
-
`),
|
|
27
|
-
`)})},n++));continue}if(i.trim()===""){a++;continue}const o=/^(#{1,6})\s+(.*)$/.exec(i);if(o){r.push(P5(o[1].length,Wi(o[2]),n++)),a++;continue}if(/^\s*[-*•]\s+/.test(i)){const u=[];for(;a<e.length&&/^\s*[-*•]\s+/.test(e[a]);)u.push(_("li",{children:Wi(e[a].replace(/^\s*[-*•]\s+/,""))},u.length)),a++;r.push(_("ul",{class:"cf-md-list",children:u},n++));continue}if(/^\s*\d+\.\s+/.test(i)){const u=[];for(;a<e.length&&/^\s*\d+\.\s+/.test(e[a]);)u.push(_("li",{children:Wi(e[a].replace(/^\s*\d+\.\s+/,""))},u.length)),a++;r.push(_("ol",{class:"cf-md-list",children:u},n++));continue}const s=[i];for(a++;a<e.length&&e[a].trim()!==""&&!L5.test(e[a]);)s.push(e[a]),a++;const l=s.join(" ");if(/:\s*$/.test(l)&&a<e.length&&/^(?:\s*[-*•]\s+|\s*\d+\.\s+)/.test(e[a])){const u=/^(.*[.!?])\s+([^.!?]{2,120}:)$/.exec(l);u&&r.push(_("p",{children:Wi(u[1])},n++)),r.push(_("p",{class:"cf-md-list-intro",children:Wi(u?.[2]??l)},n++))}else r.push(_("p",{children:Wi(l)},n++))}return r},E5=t=>{const e=(t??"").trim().toLowerCase().replaceAll("-","_");return e==="low"||e==="low_quality"?"Low-confidence forecast":e==="medium"||e==="directional"?"Directional forecast":e==="high"||e==="validated"||e==="trusted"?"Validated forecast":"Forecast estimate"},O5=t=>{if(!t)return"Live data";const e=new Date(t);return Number.isNaN(e.getTime())?"Live data":`Updated ${new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e)}`},N5=({answeredAt:t,reportingPeriod:e,filters:r=[],rowCount:n})=>_("div",{class:"cf-analytics-meta","data-testid":"analytics-result-meta","aria-label":"Result details",children:[_("span",{children:[_("span",{"aria-hidden":"true",class:"cf-analytics-meta__dot"}),O5(t)]}),e?.label?_("span",{children:e.label}):null,typeof n=="number"?_("span",{children:[n," ",n===1?"row":"rows"]}):null,r.length>0?_("span",{children:[r.length," applied ",r.length===1?"filter":"filters"]}):null]}),B5=({label:t,value:e})=>_("section",{class:"cf-analytics-kpi","aria-label":t,"data-testid":"analytics-kpi",children:[_("div",{class:"cf-analytics-kpi__label",children:t}),_("div",{class:"cf-analytics-kpi__value",children:e})]}),z5=({title:t="No matching data",description:e="No approved records matched this question."})=>_("section",{class:"cf-analytics-empty",role:"status","data-testid":"analytics-empty-state",children:[_("p",{children:t}),_("p",{children:e})]}),F5=t=>t==="line"?"Best for change over time.":t==="stacked_bar"?"Compare totals and their parts.":"Compare categories or ranked values.",a1=({type:t,className:e="cf-chart-type-icon"})=>t==="line"?_("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:e,children:[_("path",{d:"M6 25h21M6 7v18",fill:"none",stroke:"#6B7280","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"}),_("path",{d:"M8 21c4-7 7 2 11-6 2.5-5 4.5-2 7-7",fill:"none",stroke:"#2563EB","stroke-width":"2.1","stroke-linecap":"round","stroke-linejoin":"round"})]}):t==="stacked_bar"?_("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:e,children:[_("path",{d:"M6 26h21M6 7v19",fill:"none",stroke:"#6B7280","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"}),[9,15,21].map((r,n)=>_("g",{children:[_("rect",{x:r,y:18-n*2,width:"4",height:8+n*2,fill:"#2563EB",rx:"0.6"}),_("rect",{x:r,y:13-n,width:"4",height:"5",fill:"#F59E0B",rx:"0.6"}),_("rect",{x:r,y:9-n,width:"4",height:"4",fill:"#22C55E",rx:"0.6"})]},r))]}):_("svg",{viewBox:"0 0 32 32","aria-hidden":"true",class:e,children:[_("path",{d:"M6 26h21M6 7v19",fill:"none",stroke:"#6B7280","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"}),_("rect",{x:"9",y:"18",width:"4",height:"8",fill:"#2563EB",rx:"0.7"}),_("rect",{x:"15",y:"13",width:"4",height:"13",fill:"#2563EB",rx:"0.7"}),_("rect",{x:"21",y:"8",width:"4",height:"18",fill:"#2563EB",rx:"0.7"})]}),H5=({explanation:t,onFollowUp:e,showLead:r=!1,maxFollowUps:n=3})=>_("section",{class:"cf-analytics-explanation","data-testid":"inline-analytics-explanation","aria-label":"Analysis and supporting evidence",children:[r?_("div",{class:"cf-analytics-explanation__lead","data-testid":"analytics-explanation-lead",children:[t.conversationalPreface?_("p",{class:"cf-analytics-explanation__summary",children:t.conversationalPreface}):null,_("div",{class:"cf-analytics-explanation__lead-meta",children:[_("span",{class:"cf-analytics-explanation__eyebrow",children:"Answer from your data"}),_("span",{class:"cf-analytics-explanation__provenance",children:[_("span",{"aria-hidden":"true",class:"cf-analytics-explanation__provenance-dot"}),t.source==="ai_grounded"?"AI-assisted · evidence checked":"Based on current values"]})]}),_("h3",{class:"cf-analytics-explanation__headline",children:t.headline}),_("p",{class:"cf-analytics-explanation__summary",children:t.summary})]}):null,_("div",{class:"cf-analytics-explanation__body",children:[(t.evidence?.length??0)>0?_("section",{class:"cf-analytics-explanation__section",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"What the numbers show"}),_("ul",{class:"cf-analytics-explanation__evidence",children:t.evidence?.slice(0,4).map(a=>_("li",{class:"cf-analytics-explanation__evidence-item",children:[_("span",{"aria-hidden":"true",class:"cf-analytics-explanation__evidence-bullet"}),_("span",{children:a})]},a))})]}):null,t.businessMeaning?_("section",{class:"cf-analytics-explanation__meaning",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Why this may matter"}),_("p",{class:"cf-analytics-explanation__paragraph",children:t.businessMeaning})]}):null,(t.possibleDrivers?.length??0)>0?_("section",{class:"cf-analytics-explanation__section",children:[_("div",{class:"cf-analytics-explanation__section-heading",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Possibilities worth checking"}),_("span",{class:"cf-analytics-explanation__hint",children:"These are not proven causes"})]}),_("div",{class:"cf-analytics-explanation__drivers",children:t.possibleDrivers?.slice(0,2).map(a=>_("article",{class:"cf-analytics-explanation__driver",children:[_("p",{class:"cf-analytics-explanation__driver-title",children:a.hypothesis}),_("p",{class:"cf-analytics-explanation__driver-body",children:[_("span",{class:"cf-analytics-explanation__driver-label",children:"How to check:"})," ",a.howToCheck]})]},`${a.hypothesis}-${a.howToCheck}`))})]}):null,(t.recommendations?.length??0)>0?_("section",{class:"cf-analytics-explanation__section",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Useful next steps"}),_("div",{class:"cf-analytics-explanation__recommendations",children:t.recommendations?.slice(0,3).map((a,i)=>_("article",{class:"cf-analytics-explanation__recommendation",children:[_("span",{class:"cf-analytics-explanation__recommendation-index",children:i+1}),_("div",{children:[_("p",{class:"cf-analytics-explanation__recommendation-title",children:a.action}),_("p",{class:"cf-analytics-explanation__recommendation-body",children:a.why}),a.successMetric?_("p",{class:"cf-analytics-explanation__recommendation-body",children:[_("span",{class:"cf-analytics-explanation__driver-label",children:"Watch:"})," ",a.successMetric]}):null]})]},`${a.action}-${a.why}`))})]}):null,t.forecast?_("section",{class:"cf-analytics-explanation__outlook",children:[_("div",{class:"cf-analytics-explanation__outlook-header",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Outlook"}),_("span",{class:"cf-analytics-explanation__outlook-badge",children:E5(t.forecast.qualityStatus)})]}),_("p",{class:"cf-analytics-explanation__paragraph",children:t.forecast.text}),t.forecast.limitations?_("p",{class:"cf-analytics-explanation__recommendation-body",children:t.forecast.limitations}):null]}):null,e&&(t.followUps?.length??0)>0?_("section",{class:"cf-analytics-explanation__section cf-analytics-explanation__follow-up",children:[_("h4",{class:"cf-analytics-explanation__heading",children:"Ask a follow-up"}),_("div",{class:"cf-analytics-explanation__questions",children:t.followUps?.slice(0,n).map(a=>_("button",{type:"button",class:"cf-analytics-explanation__question",onClick:()=>e(a),children:a},a))})]}):null,(t.limitations?.length??0)>0?_("details",{class:"cf-analytics-explanation__limits",children:[_("summary",{class:"cf-analytics-explanation__limits-summary",children:"Important limits"}),_("ul",{class:"cf-analytics-explanation__limits-list",children:t.limitations?.map(a=>_("li",{children:a},a))})]}):null]}),_("p",{class:"cf-analytics-explanation__source",children:t.source==="ai_grounded"?"AI-assisted wording, checked against the live values shown here.":"Based only on the live values shown here."})]}),Cp=t=>t.explanation?.source==="ai_grounded"?t.explanation:t.businessAnalysis?.explanation??t.explanation,i1=()=>{const t=X(null);return le(()=>{const e=requestAnimationFrame(()=>t.current?.scrollIntoView?.({block:"end"}));return()=>cancelAnimationFrame(e)},[]),t},V5=t=>t.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()??"").join("")||"🤖",ps=t=>{const e=t?.avatarId?.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-");return e?` cf-avatar-preset--${e}`:""},U5={"support-guide":"SG","sales-host":"SH","calm-advisor":"CA","technical-guide":"TG","school-desk":"SD","front-office":"FO"},tu=t=>{const e=t?.avatarId?.trim().toLowerCase();return e&&U5[e]||(t?V5(t.agentName):"·")},o1=({persona:t,small:e,hideWhenMissing:r})=>{const n=e?"cf-msg__avatar":"cf-header__avatar",a=t?.agentAvatarUrl?.trim();return a?_("span",{class:n,children:_("img",{src:a,alt:""})}):r?null:_("span",{class:`${n}${ps(t)}`,children:tu(t)})},G5=()=>{const t=kr(),[e,r]=U(0),n=["Understanding your question","Checking approved information","Preparing your answer"];return le(()=>{const a=[window.setTimeout(()=>r(1),1800),window.setTimeout(()=>r(2),5e3)];return()=>a.forEach(i=>window.clearTimeout(i))},[]),_("div",{class:"cf-msg__bubble cf-typing","aria-label":t.assistantTyping,children:[_("span",{class:"cf-typing__label","aria-live":"polite",children:n[e]}),_("span",{class:"cf-typing__dot"}),_("span",{class:"cf-typing__dot"}),_("span",{class:"cf-typing__dot"})]})},$5=3,W5=({msg:t})=>{if(!t.sources||t.sources.length===0)return null;const e=new Set,r=[];for(const i of t.sources){const o=(i.url||i.title||"").toLowerCase();!o||e.has(o)||(e.add(o),r.push(i))}if(r.length===0)return null;const n=r.slice(0,$5),a=r.length-n.length;return _("div",{class:"cf-sources",children:[n.map((i,o)=>i.url?_("a",{class:"cf-source",href:i.url,target:"_blank",rel:"noopener noreferrer nofollow",title:i.title||i.url,children:[_(hs,{}),_("span",{children:i.title||i.url})]},o):_("span",{class:"cf-source",title:i.title,children:[_(hs,{}),_("span",{children:i.title})]},o)),a>0&&_("span",{class:"cf-source cf-source--more",children:["+",a," more"]})]})},q5=({replies:t,onPick:e})=>t&&t.length>0?_("div",{class:"cf-chips",children:t.map((r,n)=>_("button",{type:"button",class:"cf-chip",onClick:()=>e(r),children:r},n))}):null,Y5=({persona:t,starters:e,onPick:r,onFocusComposer:n,speaking:a,voiceState:i="idle",replyPending:o=!1,pinned:s=!1,muted:l=!1,onToggleMute:c,onEndCall:u,onTalkNow:f,showTalkNow:h=!1,micLevel:d=0,theaterMode:p=!1,onToggleTheater:m,onMinimize:g,audioDevices:v=[],selectedAudioDeviceId:y="",onSelectAudioDevice:b,connectingOnly:x=!1})=>{if(!t)return null;const w=!!(t.allowVoiceInput&&t.talkbackMode&&t.talkbackMode!=="text");if(!(w||t.widgetModule==="assistant"))return null;const k=t.agentAvatarUrl?.trim()||"",C=t.assistantMediaUrl?.trim()||k,A=t.assistantMediaKind==="video"&&!!C,M=e.slice(0,3),T=i!=="idle",D=i!=="idle"?"End voice chat":`Speak with ${t.agentName}`,L=s&&w&&!T&&!a,R=i==="connecting"||i==="processing"||T&&o,O=["cf-assistant-card__stage","cf-assistant-card__stage--local",T?"is-live":"",R?"is-thinking":"",qi(i)&&!l?"is-listening":"",a||i==="speaking"?"is-speaking":"",l?"is-muted":""].filter(Boolean).join(" "),B=qi(i)&&!l?{"--cf-listen":String(Math.max(.18,Math.min(1,d*8)))}:void 0,j=R&&_("span",{class:"cf-call-ripple","aria-hidden":"true",children:[_("span",{}),_("span",{}),_("span",{})]});if(x)return _("div",{class:"cf-assistant-card cf-assistant-card--connecting","aria-live":"polite",children:[_("div",{class:"cf-assistant-card__connecting-avatar",children:[k?_("img",{src:k,alt:""}):_("span",{class:`cf-assistant-card__connecting-face${ps(t)}`,children:tu(t)}),j]}),_("div",{class:"cf-assistant-card__connecting-copy",children:[_("span",{class:"cf-assistant-card__connecting-eyebrow",children:t.agentName}),_("strong",{children:"Connecting with the AI…"})]})]});const P=T&&u&&_(xE,{voiceState:i,muted:l,onToggleMute:c??(()=>{}),onEndCall:u,onTalkNow:f??(()=>{}),showTalkNow:h,micLevel:d,theaterMode:p,onToggleTheater:m??(()=>{}),onMinimize:g??(()=>{}),audioDevices:v,selectedAudioDeviceId:y,onSelectAudioDevice:b??(()=>{})});return L?_("div",{class:"cf-assistant-card cf-assistant-card--pinned cf-assistant-card--compact",children:_("button",{type:"button",class:"cf-assistant-card__compact-speak",onClick:n,children:[k?_("span",{class:"cf-assistant-card__compact-avatar",children:_("img",{src:k,alt:""})}):null,_("span",{class:"cf-assistant-card__compact-mic","aria-hidden":"true",children:_(ds,{})}),_("span",{class:"cf-assistant-card__compact-label",children:D})]})}):_("div",{class:`cf-assistant-card ${s?"cf-assistant-card--pinned":""} ${a?"is-speaking":""}`,children:[(C||w)&&_("div",{class:O,style:B,children:[_("div",{class:`cf-assistant-card__media ${C?"cf-assistant-card__media--uploaded":"cf-assistant-card__media--generated"}${ps(t)}`,children:[A?_("video",{src:C,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):C?_("img",{src:C,alt:""}):_("div",{class:`cf-assistant-card__avatar-stage${ps(t)}`,children:_("div",{class:"cf-assistant-card__face",children:[_("span",{class:"cf-assistant-card__initials",children:tu(t)}),_("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--left"}),_("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--right"}),_("span",{class:"cf-assistant-card__mouth"})]})}),C&&!A&&_("span",{class:"cf-assistant-card__mouth cf-assistant-card__mouth--overlay"}),_("span",{class:"cf-avatar-aura cf-avatar-aura--one","aria-hidden":"true"}),_("span",{class:"cf-avatar-aura cf-avatar-aura--two","aria-hidden":"true"}),_("span",{class:"cf-avatar-listen-ring","aria-hidden":"true"}),_("span",{class:"cf-avatar-wave","aria-hidden":"true",children:[_("span",{}),_("span",{}),_("span",{}),_("span",{})]})]}),j,T&&_("span",{class:"cf-call-status",role:"status","aria-live":"polite",children:Ap(i)}),w&&(P||_("button",{type:"button",class:"cf-assistant-card__speak",onClick:n,children:[_(ds,{}),D]}))]}),!s&&_(Me,{children:[t.agentDescription?_("p",{class:"cf-assistant-card__copy",children:t.agentDescription}):_("p",{class:"cf-assistant-card__copy",children:t.greeting}),M.length>0&&_("div",{class:"cf-assistant-card__chips",children:M.map(V=>_("button",{type:"button",class:"cf-assistant-card__chip",onClick:()=>r(V),children:V},V))}),t.disclaimerText||t.assistantPrivacyUrl?_("p",{class:"cf-assistant-card__privacy",children:[t.disclaimerText||"This chat may be recorded for quality and support.",t.assistantPrivacyUrl?_(Me,{children:[" ",_("a",{href:t.assistantPrivacyUrl,target:"_blank",rel:"noopener noreferrer nofollow",children:"Privacy Policy"})]}):null]}):null]})]})},X5={calendar:h5,"calendar-clock":m5,headset:e1,mail:Sp,message:v5,newsletter:y5,phone:p5,presentation:g5,lifebuoy:e1},Z5=t=>X5[t]??Sp,K5=t=>{if(t.id==="public_contact_support")return"contact-support";switch(t.endpoint){case"book-demo":return"book-demo";case"request-callback":return"request-callback";case"schedule-callback":return"schedule-callback";case"subscribe-newsletter":return"subscribe-newsletter";case"contact":return"contact";default:return"inquiry"}},j5={public_contact_support:{label:"Contact support",description:"Send your request to the support team.",category:"support",icon:"headset",endpoint:"inquiry"},public_submit_inquiry:{label:"Leave a message",description:"Send your question and contact details.",category:"support",icon:"message",endpoint:"inquiry"},public_book_demo:{label:"Book a demo",description:"Request a demo from the team.",category:"sales",icon:"presentation",endpoint:"book-demo"},public_request_callback:{label:"Request a callback",description:"Ask the next available sales teammate to call you.",category:"sales",icon:"phone",endpoint:"request-callback"},public_schedule_callback:{label:"Schedule a callback",description:"Choose an available date and time for a call.",category:"sales",icon:"calendar-clock",endpoint:"schedule-callback"},public_subscribe_newsletter:{label:"Subscribe",description:"Get product updates.",category:"marketing",icon:"newsletter",endpoint:"subscribe-newsletter"}},J5=(t,e,r={})=>Array.isArray(t)?t.filter(n=>n.readiness!=="unavailable").map(n=>s1(n,r[n.id])):(e??[]).flatMap(n=>{const a=j5[n];if(!a)return[];const i=K5({...a,id:n}),o=Qc[i];return[{...a,id:n,presentation:i==="book-demo"||i==="schedule-callback"?"booking":"form",formTitle:o.title,submitLabel:o.submit,fields:o.fields,delivery:"",prompt:"",shortLabel:a.label.toLowerCase(),enabled:!0,readiness:"available",legacyFallback:!0}]}).map(n=>s1(n,r[n.id])),s1=(t,e)=>{if(!e)return t;const r=e.fields??{};return{...t,...Object.fromEntries(Object.entries(e).filter(([n,a])=>n!=="fields"&&a!==void 0)),fields:t.fields.map(n=>({...n,...r[n.key]}))}},Q5=(t,e)=>{const r=t.map(n=>n.label);return r.length===0?e.actionGetInTouch:r.length<=3?r.join(", "):`${r.slice(0,2).join(", ")} ${ct(e.actionMore,{count:String(r.length-2)})}`},l1=({label:t,required:e,value:r,onInput:n})=>{const a=Ht(()=>l5(r),[]),[i,o]=U(a.country.iso),[s,l]=U(a.national),[c,u]=U(!1),[f,h]=U(""),d=X(null),p=qa.find(v=>v.iso===i)??a.country,m=Ht(()=>{const v=f.trim().toLowerCase().replace(/^\+/,"");return v?qa.filter(y=>y.name.toLowerCase().includes(v)||y.iso.toLowerCase().includes(v)||y.dial.includes(v)):qa},[f]);le(()=>{if(!c)return;const v=b=>{d.current&&!b.composedPath().includes(d.current)&&u(!1)},y=b=>{b.key==="Escape"&&u(!1)};return document.addEventListener("pointerdown",v),document.addEventListener("keydown",y),()=>{document.removeEventListener("pointerdown",v),document.removeEventListener("keydown",y)}},[c]);const g=v=>{const y=qa.find(b=>b.iso===v)??p;o(y.iso),u(!1),h(""),n(Qx(y,s))};return _("div",{class:"cf-phone",role:"group","aria-label":`${t}${e?" *":""}`,ref:d,children:[_("span",{class:"cf-phone__label",children:[t,e?" *":""]}),_("div",{class:"cf-phone__control",children:[_("button",{type:"button",class:"cf-phone__country","aria-label":`${p.name}, +${p.dial}. Choose country and calling code`,"aria-haspopup":"listbox","aria-expanded":c,onClick:()=>u(v=>!v),children:[_("span",{"aria-hidden":"true",children:Jx(p.iso)}),_("span",{class:"cf-phone__country-code",children:["+",p.dial]}),_(Ya,{})]}),_("input",{class:"cf-phone__input",type:"tel",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"tel-national",maxLength:15,placeholder:"8028509941",value:s,"aria-label":t,onInput:v=>{const y=v.target,b=y.value.replace(/\D/g,"");y.value=b,l(b),n(Qx(p,b))}})]}),c?_("div",{class:"cf-phone__menu",children:[_("input",{class:"cf-phone__search",type:"search",placeholder:"Search country or code","aria-label":"Search countries",value:f,autoFocus:!0,onInput:v=>h(v.target.value)}),_("div",{class:"cf-phone__options",role:"listbox","aria-label":"Countries",children:m.length>0?m.map(v=>_("button",{type:"button",class:`cf-phone__option ${v.iso===p.iso?"is-selected":""}`,role:"option","aria-selected":v.iso===p.iso,onClick:()=>g(v.iso),children:[_("span",{"aria-hidden":"true",children:Jx(v.iso)}),_("span",{class:"cf-phone__option-name",children:v.name}),_("span",{class:"cf-phone__option-code",children:["+",v.dial]})]},v.iso)):_("div",{class:"cf-phone__empty",children:"No countries found"})})]}):null]})},eE=({field:t,value:e,onInput:r})=>{if(t.kind==="tel")return _(l1,{label:t.label,required:t.required,value:e,onInput:r});const n=t.placeholder??t.label,a={class:"cf-form__input",placeholder:t.required?`${n} *`:n,value:e,"aria-label":t.label,onInput:i=>r(i.target.value)};return t.kind==="textarea"?_("textarea",{rows:2,...a}):_("input",{type:t.kind,...a})},tE=({spec:t,visitor:e,onSubmit:r,onCancel:n})=>{const a=kr(),i=i1(),[o,s]=U(()=>{const v={};for(const y of t.fields)y.identity&&e[y.identity]&&(v[y.key]=e[y.identity]);return v}),[l,c]=U("idle"),[u,f]=U(""),h=v=>!!(v.identity&&e[v.identity]?.trim()),d=t.fields.filter(v=>!h(v)),p=d.every(v=>!v.required||(o[v.key]?.trim()??"")!==""),m=e.email||e.name||"",g=async()=>{if(!p||l==="submitting")return;c("submitting");const v={},y={};for(const b of t.fields){const x=o[b.key]?.trim();x&&(v[b.key]=x,b.identity&&(y[b.identity]=x))}try{const b=await r(v,y);f(fs(b.note||a.formThanks,b.caseReference,a)),c("done")}catch{c("error")}};return l==="done"?_("div",{class:"cf-form cf-form--done",children:[_(Xa,{}),_("span",{children:u})]}):_("div",{class:"cf-form",ref:i,children:[d.length===0&&m&&_("div",{class:"cf-form__as",children:ct(a.actionAs,{identity:m})}),d.map(v=>_(eE,{field:v,value:o[v.key]??"",onInput:y=>s(b=>({...b,[v.key]:y}))},v.key)),l==="error"&&_("div",{class:"cf-form__err",children:a.formError}),_("div",{class:"cf-form__actions",children:[n&&_("button",{type:"button",class:"cf-form__cancel",onClick:n,children:a.cancel}),_("button",{type:"button",class:"cf-form__submit",disabled:!p||l==="submitting",onClick:g,children:l==="submitting"?a.sending:t.submit})]})]})},c1=t=>String(t).padStart(2,"0"),rE=()=>{const t=[];for(let e=9;e<=17;e++)t.push(`${c1(e)}:00`),t.push(`${c1(e)}:30`);return t},nE=t=>{const e=new Date;return e.setHours(0,0,0,0),Array.from({length:t},(r,n)=>{const a=new Date(e);return a.setDate(e.getDate()+n),a})},aE=(t,e)=>{const[r,n]=e.split(":").map(Number),a=new Date(t.getFullYear(),t.getMonth(),t.getDate(),r??0,n??0);try{return new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"}).format(a)}catch{return`${t.toDateString()} ${e}`}},Tn=(t,e)=>{const[r,n]=e.split(":").map(Number);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),r??0,n??0)},iE=(t,e)=>{const r=Tn(t,e);try{return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(r)}catch{return e}},ru=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}},u1=(t,e)=>{try{const r=new URL(t);return r.searchParams.set("embed_type","Inline"),globalThis.location?.hostname&&r.searchParams.set("embed_domain",globalThis.location.hostname),e.name?.trim()&&r.searchParams.set("name",e.name.trim()),e.email?.trim()&&r.searchParams.set("email",e.email.trim()),r.toString()}catch{return t}},oE=(t,e)=>{if(!e?.contentWindow||t.source!==e.contentWindow)return!1;try{const r=new URL(t.origin).hostname;if(r!=="calendly.com"&&!r.endsWith(".calendly.com"))return!1}catch{return!1}return!!(t.data&&typeof t.data=="object"&&typeof t.data.event=="string")},sE=({actionId:t,fields:e=Qc["book-demo"].fields,visitor:r,onSubmit:n,onCancel:a,onDemoSlots:i,onConfirmHostedBooking:o,scheduler:s,title:l,submitLabel:c})=>{const u=t==="public_schedule_callback",f=u?Qc["schedule-callback"]:Qc["book-demo"],h=l?.trim()||f.title,d=kr(),p=i1(),m=!!(!u&&s?.connected&&s.provider==="calendly"),g=m?d.bookingOpenScheduler:c?.trim()||f.submit,v=!!(s?.connected&&s.mode==="event"&&!m&&(s.availability===void 0||s.availability.calendarIds.length>0)),y=Math.min(60,Math.max(1,s?.availability?.bookingWindowDays??14)),b=Ht(()=>nE(y),[y]),[x,w]=U(null),[S,k]=U(v?"loading":"request_only"),[C,A]=U(s?.availability?.slotDurationMinutes??30),[M,T]=U(ru()||s?.availability?.timezone||""),D=Ht(()=>v?S!=="available"||x===null?[]:[...new Set([...x].map(te=>{const Se=new Date(te);return`${String(Se.getHours()).padStart(2,"0")}:${String(Se.getMinutes()).padStart(2,"0")}`}))].sort():rE(),[x,S,v]),L=Ht(()=>{const te=Date.now();for(let Se=0;Se<b.length;Se++)if(D.some(Le=>Tn(b[Se],Le).getTime()>te))return Se;return 0},[b,D]),[R,O]=U(L),[B,j]=U(null),[P,V]=U(r.name??""),[H,Z]=U(r.email??""),[re,Te]=U(r.phone??""),[ge,xe]=U(""),[Ce,be]=U("idle"),[it,Qe]=U(""),[ze,oe]=U(!1),[pe,ot]=U(""),[Xe,kt]=U("scheduler"),[tt,lr]=U(null),[Cr,Tt]=U("idle"),[Pt,Bt]=U(""),[xt,tn]=U(""),[F,ue]=U(""),De=X(null),we=async(te,Se,Le)=>{Tt("loading");try{const ve=await o?.(te,Se,Le),Ae=ve?.meetingUrl||ve?.eventLink||"",cr=ve?.rescheduleUrl||ve?.cancelUrl||"";ot(Ae||cr),kt(Ae?"meeting":"manage"),Tt(Ae||cr?"idle":"error")}catch{Tt("error")}};le(()=>{if(!Pt)return;const te=Se=>{if(!oE(Se,De.current)||Se.data.event!=="calendly.event_scheduled")return;const Le=Se.data.payload,ve=Le?.event?.uri?.trim()||"",Ae=Le?.invitee?.uri?.trim()||"";F&&ve&&Ae?(lr({eventUri:ve,inviteeUri:Ae}),we(F,ve,Ae)):Tt("error"),Bt(""),Qe(fs(d.bookingScheduled,xt,d)),be("done")};return window.addEventListener("message",te),()=>window.removeEventListener("message",te)},[o,xt,F,Pt,d]),le(()=>{if(!v||S!=="available"||x===null)return;const te=b.findIndex(Se=>D.some(Le=>x.has(Tn(Se,Le).getTime())));te>=0&&O(te)},[x,S,b,v,D]);const rt=!!(!u&&s?.connected&&(s.mode==="link"||s.provider==="calendly")),vt=async()=>{if(Ce==="submitting"||Ce==="scheduling"||!r.name?.trim()&&!P.trim()||!r.email?.trim()&&!H.trim())return;be("submitting");const te={};H.trim()&&(te.email=H.trim()),P.trim()&&(te.name=P.trim());try{const Se=await n({...H.trim()?{visitorEmail:H.trim()}:{},...P.trim()?{visitorName:P.trim()}:{}},te),Le=Se.booking?.schedulingLink||s?.bookingLink||"";if(!Le){be("error");return}ot(Le),kt("scheduler"),tn(Se.caseReference||""),ue(Se.inquiryId||""),Bt(u1(Le,{name:P.trim()||r.name,email:H.trim()||r.email})),be("scheduling")}catch{be("error")}},[Mr,rn]=U(new Set),[Fr,bs]=U([]),[Za,Qt]=U(0),[Xi,Zi]=U(!1);le(()=>{if(!i)return;let te=!0;const Se=new Date,Le=new Date;return Le.setDate(Le.getDate()+y+1),i(Se.toISOString(),Le.toISOString()).then(ve=>{if(te)if(rn(new Set(ve.taken.map(Ae=>Date.parse(Ae)).filter(Ae=>!Number.isNaN(Ae)))),bs(ve.busy.map(Ae=>[Date.parse(Ae.start),Date.parse(Ae.end)]).filter(([Ae,cr])=>!Number.isNaN(Ae)&&!Number.isNaN(cr))),A(ve.slotDurationMinutes??30),T(ru()||ve.timezone||""),v){if(ve.status!=="available"||!Array.isArray(ve.available)){w(null),k("unavailable");return}w(new Set(ve.available.map(Ae=>Date.parse(Ae)).filter(Ae=>!Number.isNaN(Ae)))),k("available")}else k(ve.status??"request_only")}).catch(()=>{!te||!v||(w(null),k("unavailable"))}),()=>{te=!1}},[y,v,i,Za]);const nn=!!r.email?.trim(),Cn=!!r.name?.trim(),ea=!!r.phone?.trim(),an=re,Ka=!!B&&(!v||S==="available")&&(Cn||P.trim()!=="")&&(u?ea||c5(an):nn||H.trim()!==""),er=(u?r.phone||r.name:r.email||r.name)||"",tr=te=>e.find(Se=>Se.key===te),Mn=tr("visitorPhone"),zt=tr("topic"),xs=te=>Mr.has(Tn(b[R],te).getTime()),ws=te=>Tn(b[R],te).getTime()<=Date.now(),Ss=C*60*1e3,ks=te=>{const Se=Tn(b[R],te).getTime(),Le=Se+Ss;return Fr.some(([ve,Ae])=>Se<Ae&&Le>ve)},An=te=>!v||x?.has(Tn(b[R],te).getTime())===!0,Ts=async()=>{if(!Ka||Ce==="submitting"||!B)return;be("submitting"),Zi(!1);const te=Tn(b[R],B),Se=aE(b[R],B),Le={};P.trim()&&(Le.name=P.trim()),u?an&&(Le.phone=an):H.trim()&&(Le.email=H.trim());try{const ve=await n(u?{bestTime:Se,slotAt:te.toISOString(),visitorTimezone:ru()||"UTC",...an?{visitorPhone:an}:{},...P.trim()?{visitorName:P.trim()}:{},...ge.trim()?{topic:ge.trim()}:{}}:{preferredAt:Se,slotAt:te.toISOString(),visitorTimezone:ru()||"UTC",...H.trim()?{visitorEmail:H.trim()}:{},...P.trim()?{visitorName:P.trim()}:{}},Le);if(!u&&ve.booking?.mode==="link"&&ve.booking.schedulingLink?.trim()){const Ae=ve.booking.schedulingLink.trim();ot(Ae),tn(ve.caseReference||""),ue(ve.inquiryId||""),Bt(u1(Ae,{name:P.trim()||r.name,email:H.trim()||r.email})),be("scheduling");return}ve.booking?.confirmed?(Qe(fs(ve.note||ct(u?d.bookingCallbackConfirmed:d.bookingConfirmed,{when:Se}),ve.caseReference,d)),ot(ve.booking.meetingUrl||ve.booking.rescheduleUrl||ve.booking.cancelUrl||ve.booking.eventLink||""),kt(ve.booking.meetingUrl||ve.booking.eventLink?"meeting":"manage")):ve.booking?.verificationPending?(oe(!0),Qe(fs(ve.note||ct(d.bookingVerificationPending,{when:Se}),ve.caseReference,d))):Qe(fs(ve.note||ct(u?d.bookingCallbackRequested:d.bookingRequested,{when:Se}),ve.caseReference,d)),be("done")}catch(ve){ve?.status===409?(rn(Ae=>new Set(Ae).add(te.getTime())),j(null),Zi(!0),Qt(Ae=>Ae+1),be("idle")):be("error")}},ja=()=>{Bt(""),be("idle"),a?.()};return Ce==="scheduling"&&Pt?_("div",{class:"cf-scheduler-overlay",role:"dialog","aria-modal":"true","aria-label":h,children:[_("header",{class:"cf-scheduler-overlay__head",children:[_("button",{type:"button",class:"cf-scheduler-overlay__back",onClick:ja,children:d.bookingBackToChat}),_("strong",{children:h}),_("div",{class:"cf-scheduler-overlay__tools",children:[_("a",{href:pe,target:"_blank",rel:"noopener noreferrer",children:[d.bookingOpenNewTab," ",_(hs,{})]}),_("button",{type:"button","aria-label":d.bookingCloseScheduler,onClick:ja,children:_(Qn,{})})]})]}),_("div",{class:"cf-scheduler-overlay__body",children:[_("div",{class:"cf-scheduler-overlay__loading",children:d.bookingLoadingScheduler}),_("iframe",{ref:De,class:"cf-scheduler-overlay__frame",src:Pt,title:h,allow:"camera; microphone; fullscreen; payment"})]})]}):Ce==="done"?_("div",{class:`cf-form cf-form--done${ze?" cf-form--pending":""}`,role:ze?"alert":"status",children:[!ze&&_(Xa,{}),_("span",{children:it}),Cr==="loading"&&_("span",{role:"status",children:d.bookingCheckingDetails}),Cr==="error"&&_("div",{class:"cf-booking__receipt-error",role:"alert",children:[_("span",{children:d.bookingDetailsUnavailable}),tt&&F&&o&&_("button",{type:"button",class:"cf-booking__back",onClick:()=>{we(F,tt.eventUri,tt.inviteeUri)},children:d.bookingRetryDetails})]}),pe&&_("a",{class:"cf-booking__link",href:pe,target:"_blank",rel:"noopener noreferrer",children:[Xe==="meeting"?d.bookingMeetingLink:Xe==="manage"?d.bookingManageLink:d.bookingOpenScheduler," ",_(hs,{}),_("span",{class:"cf-booking__url",children:pe})]}),a&&_("button",{type:"button",class:"cf-booking__back",onClick:a,children:d.bookingBackToChat})]}):rt?_("div",{class:"cf-form cf-booking",ref:p,children:[_("div",{class:"cf-booking__hint",children:ct(d.bookingViaProvider,{provider:s?.label??d.bookingSchedulerFallback})}),nn?er?_("div",{class:"cf-form__as",children:ct(d.actionAs,{identity:er})}):null:_(Me,{children:[!r.name?.trim()&&_("input",{class:"cf-form__input",type:"text",placeholder:`${d.handoffName} *`,value:P,"aria-label":d.handoffName,onInput:te=>V(te.target.value)}),_("input",{class:"cf-form__input",type:"email",placeholder:`${d.handoffEmail} *`,value:H,"aria-label":d.handoffEmail,onInput:te=>Z(te.target.value)})]}),Ce==="error"&&_("div",{class:"cf-form__err",children:d.formError}),_("div",{class:"cf-form__actions",children:[a&&_("button",{type:"button",class:"cf-form__cancel",onClick:a,children:d.cancel}),_("button",{type:"button",class:"cf-form__submit",disabled:Ce==="submitting"||!r.name?.trim()&&P.trim()===""||!nn&&H.trim()==="",onClick:vt,children:Ce==="submitting"?d.sending:d.bookingOpenScheduler})]})]}):_("div",{class:"cf-form cf-booking",ref:p,children:[_("div",{class:"cf-booking__hint",children:[d.bookingPickTime," ·"," ",_("span",{class:"cf-booking__dur",children:ct(u?d.bookingCallbackDuration:d.bookingDuration,{count:String(C)})}),M?` · ${ct(d.bookingTimezone,{timezone:M})}`:""]}),v&&S==="loading"?_("div",{class:"cf-booking__state",role:"status",children:d.bookingCheckingAvailability}):null,v&&S==="unavailable"?_("div",{class:"cf-form__err",role:"alert",children:d.bookingAvailabilityUnavailable}):null,v&&S==="available"&&D.length===0?_("div",{class:"cf-booking__state",role:"status",children:d.bookingNoSlots}):null,D.length>0?_("div",{class:"cf-booking__dates",role:"tablist","aria-label":d.bookingPickDay,children:b.map((te,Se)=>_("button",{type:"button",role:"tab","aria-selected":Se===R,disabled:v&&S==="available"&&!D.some(Le=>x?.has(Tn(te,Le).getTime())),class:`cf-booking__date ${Se===R?"is-selected":""}`,onClick:()=>{O(Se),j(null)},children:[_("span",{class:"cf-booking__dow",children:te.toLocaleDateString(void 0,{weekday:"short"})}),_("span",{class:"cf-booking__dom",children:te.getDate()})]},Se))}):null,D.length>0?_("div",{class:"cf-booking__slots",role:"listbox","aria-label":d.bookingPickTimeLabel,children:D.map(te=>{const Se=ws(te),Le=ks(te),ve=xs(te),Ae=An(te),cr=ve||Se||Le||!Ae;return _("button",{type:"button",role:"option","aria-selected":B===te,disabled:cr,title:Se?d.bookingEarlierToday:Le?d.bookingCalendarBusy:ve?d.bookingAlreadyBooked:Ae?void 0:d.bookingNotOffered,class:`cf-booking__slot ${B===te?"is-selected":""} ${cr?"is-taken":""}`,onClick:()=>j(te),children:iE(b[R],te)},te)})}):null,Xi&&_("div",{class:"cf-form__err",children:d.bookingSlotTaken}),er?_("div",{class:"cf-form__as",children:ct(d.actionAs,{identity:er})}):null,!Cn&&_("input",{class:"cf-form__input",type:"text",placeholder:`${d.handoffName} *`,value:P,"aria-label":d.handoffName,onInput:te=>V(te.target.value)}),u&&!ea&&_(l1,{label:Mn?.label??"Phone number",required:!0,value:re,onInput:Te}),u&&zt?_("input",{class:"cf-form__input",type:"text",placeholder:zt.placeholder||zt.label,value:ge,"aria-label":zt.label,onInput:te=>xe(te.target.value)}):null,!u&&!nn&&_(Me,{children:_("input",{class:"cf-form__input",type:"email",placeholder:`${d.handoffEmail} *`,value:H,"aria-label":d.handoffEmail,onInput:te=>Z(te.target.value)})}),Ce==="error"&&_("div",{class:"cf-form__err",children:d.formError}),_("div",{class:"cf-form__actions",children:[a&&_("button",{type:"button",class:"cf-form__cancel",onClick:a,children:d.cancel}),_("button",{type:"button",class:"cf-form__submit",disabled:!Ka||Ce==="submitting",onClick:Ts,children:Ce==="submitting"?d.sending:g})]})]})},f1=({actions:t,descriptors:e,visitor:r,onSubmitForm:n,onDemoSlots:a,onConfirmHostedBooking:i,scheduler:o,exclude:s=[],openAction:l,translations:c={},onClose:u})=>{const f=kr(),[h,d]=U(null),[p,m]=U(!1),g=X(null),v=X(null),y=X(!1),b=Ht(()=>`cf-actions-${Math.random().toString(36).slice(2,9)}`,[]),x=Ht(()=>J5(e,t,c).filter(M=>!s.includes(M.id)&&!s.includes(M.endpoint)),[e,t,s,c]);le(()=>{l&&x.some(M=>M.id===l)&&(d(l),m(!0))},[l,x]);const w=h?x.find(M=>M.id===h):void 0,S=Y(()=>{if(u){u();return}y.current=!0,d(null),m(!1)},[u]),k=Y(()=>{u?u():d(null)},[u]);Mu(()=>{p||!y.current||(y.current=!1,g.current?.focus())},[p]);const C=X({drawerOpen:p,activeId:h});if(C.current={drawerOpen:p,activeId:h},le(()=>{const M=T=>{if(T.key!=="Escape")return;const{drawerOpen:D,activeId:L}=C.current;!D&&!L||(T.stopPropagation(),L?k():S())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[k,S]),le(()=>{p&&v.current?.querySelector("button, input, textarea, select")?.focus()},[p,h]),x.length===0)return null;const A=p?w?_("div",{ref:v,id:b,class:"cf-action-drawer is-open",role:"dialog","aria-modal":"false","aria-label":w.formTitle||w.label,children:[_("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),_("div",{class:"cf-action-drawer__head",children:[_("div",{children:[_("strong",{children:w.formTitle||w.label}),w.legacyFallback?_("small",{class:"cf-action-test-mode",children:f.actionTestMode}):null]}),_("button",{type:"button",class:"cf-action-drawer__close","aria-label":f.actionClose,onClick:k,children:_(Qn,{})})]}),w.readiness==="degraded"&&w.readinessNote?_("p",{class:"cf-action-drawer__note cf-action-drawer__note--warn",role:"status",children:w.readinessNote}):null,w.presentation==="booking"||w.endpoint==="book-demo"||w.endpoint==="schedule-callback"?_(sE,{actionId:w.id,fields:w.fields,visitor:r,title:w.formTitle,submitLabel:w.submitLabel,onCancel:k,onSubmit:(M,T)=>n(w.id,M,T,w.endpoint),onDemoSlots:a,onConfirmHostedBooking:i,scheduler:o}):_(tE,{spec:{title:w.formTitle||w.label,submit:w.submitLabel,fields:w.endpoint==="request-callback"?w.fields.filter(M=>M.key!=="bestTime"):w.fields},visitor:r,onCancel:k,onSubmit:(M,T)=>n(w.id,M,T,w.endpoint)})]}):_("div",{ref:v,id:b,class:"cf-action-drawer cf-action-drawer--menu",role:"dialog","aria-modal":"false","aria-label":f.actionChoose,children:[_("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),_("div",{class:"cf-action-drawer__head",children:[_("div",{children:[_("span",{class:"cf-action-drawer__eyebrow",children:f.actionNeedHelp}),_("strong",{children:f.actionChoose})]}),_("button",{type:"button",class:"cf-action-drawer__close","aria-label":f.actionClose,onClick:S,children:_(Qn,{})})]}),_("div",{class:"cf-action-drawer__grid",children:x.map(M=>{const T=Z5(M.icon);return _("button",{type:"button",class:"cf-action-card",onClick:()=>d(M.id),children:[_("span",{class:`cf-action-card__icon cf-action-card__icon--${M.category}`,children:_(T,{})}),_("span",{class:"cf-action-card__copy",children:[_("strong",{children:M.label}),M.legacyFallback?_("small",{class:"cf-action-test-mode",children:f.actionTestMode}):null,_("small",{children:M.description}),M.readiness==="degraded"&&M.readinessNote?_("small",{class:"cf-action-card__warn",children:M.readinessNote}):null]}),_(Ya,{})]},M.id)})}),_("p",{class:"cf-action-drawer__note",children:f.actionFooter})]}):null;return _("div",{class:"cf-action-shell",children:[_("button",{ref:g,type:"button",class:"cf-action-trigger",hidden:p,"aria-expanded":p,"aria-controls":b,onClick:()=>p?S():m(!0),children:[_("span",{class:"cf-action-trigger__icon",children:_(Sp,{})}),_("span",{class:"cf-action-trigger__copy",children:[_("strong",{children:f.actionContactOptions}),_("small",{children:Q5(x,f)})]}),_(Ya,{})]}),A]})},lE=({hasEmail:t,visitor:e,question:r,onSubmitForm:n})=>{const a=kr(),[i,o]=U(!1),[s,l]=U(!1),[c,u]=U(e.name??""),[f,h]=U(e.email??"");if(t)return _("div",{class:"cf-handoff cf-handoff--done",children:[_(Xa,{}),_("span",{children:"We’ve alerted the team. If someone is available, they can continue here."})]});if(i){const p=e.email||f;return _("div",{class:"cf-handoff cf-handoff--done",children:[_(Xa,{}),_("span",{children:ct(a.handoffShared,{email:p})})]})}const d=async()=>{if(!(!f.trim()||s)){l(!0);try{await n("inquiry",{visitorEmail:f.trim(),...c.trim()?{visitorName:c.trim()}:{},message:r||"I had a question the assistant couldn’t answer.",subject:"Help request from chat"},{email:f.trim(),name:c.trim()||void 0}),o(!0)}catch{l(!1)}}};return _("div",{class:"cf-handoff",children:[_("div",{class:"cf-handoff__title",children:a.handoffTitle}),_("input",{class:"cf-form__input",type:"text",placeholder:a.handoffName,value:c,"aria-label":a.handoffName,onInput:p=>u(p.target.value)}),_("input",{class:"cf-form__input",type:"email",placeholder:`${a.handoffEmail} *`,value:f,"aria-label":a.handoffEmail,onInput:p=>h(p.target.value)}),_("button",{type:"button",class:"cf-form__submit",disabled:!f.trim()||s,onClick:d,children:s?a.sending:a.handoffNotify})]})},cE=({text:t})=>{const e=kr(),[r,n]=U(!1);return _("button",{type:"button",class:"cf-tool",onClick:async()=>{try{await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),1500)}catch{}},"aria-label":e.copy,children:[r?_(Xa,{}):_(w5,{}),r?e.copied:e.copy]})},uE=({items:t,onPick:e})=>t.length===0?null:_("div",{class:"cf-starters",children:t.map((r,n)=>_("button",{type:"button",class:"cf-starter",onClick:()=>e(r),children:r},n))}),fE=({items:t})=>{const e=t.filter(r=>r.label.trim()&&r.url.trim()).slice(0,4);return e.length===0?null:_("div",{class:"cf-featured-links",children:e.map((r,n)=>_("a",{class:"cf-featured-link",href:r.url,target:"_blank",rel:"noopener noreferrer nofollow",title:r.label,children:[_(hs,{}),_("span",{children:r.label})]},`${r.url}-${n}`))})},dE=({msg:t,onRate:e})=>{const r=kr(),[n,a]=U(!1),[i,o]=U(""),s=t.feedback,l=()=>{e(t.id,"up"),a(!1)},c=()=>{e(t.id,"down"),a(!0)},u=()=>{e(t.id,"down",i.trim()),a(!1)};return _("div",{class:"cf-feedback",children:[_("div",{class:"cf-feedback__row",children:[_("button",{type:"button",class:`cf-feedback__btn ${s==="up"?"is-active":""}`,"aria-label":r.feedbackHelpful,"aria-pressed":s==="up",onClick:l,children:_(t1,{})}),_("button",{type:"button",class:`cf-feedback__btn ${s==="down"?"is-active":""}`,"aria-label":r.feedbackNotHelpful,"aria-pressed":s==="down",onClick:c,children:_(r1,{})}),s&&!n&&_("span",{class:"cf-feedback__thanks",children:r.feedbackThanks})]}),n&&s==="down"&&_("div",{class:"cf-feedback__comment",children:[_("textarea",{class:"cf-feedback__input",rows:2,placeholder:r.feedbackCommentPlaceholder,value:i,onInput:f=>o(f.target.value)}),_("button",{type:"button",class:"cf-feedback__send",onClick:u,children:r.feedbackSend})]})]})},d1=t=>t.attachments??(t.attachmentName?[{id:t.attachmentId,name:t.attachmentName}]:[]),hE=({msg:t,persona:e,isLast:r,visitor:n,hasEmail:a,lastQuestion:i,showActions:o,onPickReply:s,onSubmitForm:l,onDemoSlots:c,onConfirmHostedBooking:u,onRetry:f,ratable:h,onRate:d,onExpandVisualization:p,onReconnect:m,onOpenAttachment:g})=>{const v=kr(),y=t.role==="user",b=t.liveEventType??"",x=t.content.trim().toLowerCase(),w=b==="handoff_queued"||b==="agent_joined"||b==="agent_left"||b==="ai_handback"||b==="conversation_ended"||x.includes("joined the chat")||x.includes("left the chat")||x.includes("support agents will be with you"),S=t.role==="system"||w,k=t.requestedContactFields?.includes("email")===!0,C=r&&!y&&!S&&!t.reconnectOffer&&!!(t.handoffOffered||k),A=C&&!a?["inquiry"]:[],M=!t.pending&&!t.streaming,T=[...t.artifacts??[],...t.visualization&&!(t.artifacts??[]).some(D=>D.type==="visualization")?[{type:"visualization",visualization:t.visualization}]:[]];return S?_("div",{class:"cf-msg cf-msg--system",children:_("div",{class:"cf-system-event",children:[_("div",{class:"cf-system-event__mark","aria-hidden":"true"}),_("div",{class:"cf-system-event__text",children:t.content}),m&&_("button",{type:"button",class:"cf-system-event__action",onClick:m,children:v.reconnectSupport}),t.createdAt&&_("div",{class:"cf-system-event__time",children:new Date(t.createdAt).toLocaleString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"})})]})}):_("div",{class:`cf-msg cf-msg--${y?"user":"agent"}`,children:[!y&&_(o1,{persona:e,small:!0}),_("div",{class:"cf-msg__col",children:[t.pending&&t.content===""?_(G5,{}):t.imageUrl?_("div",{class:"cf-msg__bubble cf-msg__bubble--media",children:[_("img",{class:"cf-msg__media",src:t.imageUrl,alt:"GIF"}),t.content&&_("span",{class:"cf-msg__caption",children:t.content})]}):_("div",{class:"cf-msg__bubble",children:[y?t.content:R5(t.content),t.streaming&&_("span",{class:"cf-caret","aria-hidden":"true"})]}),y?null:T.map((D,L)=>D.type==="visualization"&&D.visualization?_(h1,{visualization:D.visualization,onExpand:p?()=>p(t.id):void 0,expandControlId:t.id},`visualization-${L}`):D.type==="image"&&(D.data||D.uri?.startsWith("https://"))&&["image/png","image/jpeg","image/webp"].includes(D.mimeType??"")?_("figure",{class:"cf-artifact",children:[D.title?_("figcaption",{children:D.title}):null,_("img",{src:D.uri||`data:${D.mimeType};base64,${D.data}`,alt:D.altText||D.caption||D.title||"Tool result"}),D.caption&&D.caption!==D.title?_("p",{children:D.caption}):null]},`image-${L}`):D.type==="video"&&D.uri?.startsWith("https://")&&(D.mimeType??"").startsWith("video/")?_("figure",{class:"cf-artifact",children:[D.title?_("figcaption",{children:D.title}):null,_("video",{controls:!0,preload:"metadata",playsInline:!0,src:D.uri}),D.caption&&D.caption!==D.title?_("p",{children:D.caption}):null]},`video-${L}`):D.type==="resource_link"&&D.uri?.startsWith("https://")?_("a",{class:"cf-artifact-link",href:D.uri,target:"_blank",rel:"noopener noreferrer nofollow",children:[_("strong",{children:D.title||D.name||"Open result"}),D.caption?_("span",{children:D.caption}):null]},`link-${L}`):null),!y&&t.visualization&&Cp(t.visualization)?_(H5,{explanation:Cp(t.visualization),onFollowUp:s,showLead:!t.content.toLocaleLowerCase().includes(Cp(t.visualization).headline.toLocaleLowerCase())}):null,y&&d1(t).length>0&&_("div",{class:"cf-attach-row cf-attach-row--sent",children:d1(t).map((D,L)=>g?_("button",{type:"button",class:"cf-attach-chip cf-attach-chip--open",title:ct(v.attachOpen,{name:D.name}),"aria-label":ct(v.attachOpen,{name:D.name}),onClick:()=>g(t,D,L),children:[_(eu,{}),_("span",{children:D.name})]},`${D.id??D.name}-${L}`):_("div",{class:"cf-attach-chip",title:D.name,children:[_(eu,{}),_("span",{children:D.name})]},`${D.id??D.name}-${L}`))}),!y&&_(Me,{children:[M&&(t.error||t.content)&&_("div",{class:"cf-msg__actions",children:[_("div",{class:"cf-msg__tools",children:t.error?_("button",{type:"button",class:"cf-tool",onClick:()=>f(t.id,t.retryText??""),children:[_(S5,{}),v.retry]}):_(cE,{text:t.content})}),h&&!t.error&&t.content&&_(dE,{msg:t,onRate:d})]}),_(W5,{msg:t}),r&&_(q5,{replies:t.suggestedReplies,onPick:s}),C&&_(lE,{hasEmail:a,visitor:n,question:i,onSubmitForm:l}),o&&_(f1,{actions:t.availableActions,descriptors:t.actions,openAction:t.selectedAction,visitor:n,onSubmitForm:l,onDemoSlots:c,onConfirmHostedBooking:u,scheduler:e?.scheduler,exclude:A})]})]})]})},h1=({visualization:t,expanded:e=!1,onExpand:r,onClose:n,expandControlId:a})=>{const i=X(null),o=Ht(()=>yp(t),[t]),[s,l]=U(o?.type);le(()=>l(o?.type),[o]);const c=Ht(()=>bR(t),[t]),u=Ht(()=>yp(t,s),[s,t]),f=s??u?.type??o?.type,h=c.find(b=>b.type===f),d=t.rows??[],p=t.columns?.length?t.columns:Object.keys(d[0]??{}),m=p.map(b=>{const x=t.columnMetadata?.find(w=>w.key===b);return x?{key:b,label:x.label,dataType:x.dataType,currencyCode:x.currencyCode}:b});if(d.length===0)return _(z5,{});const g=_(N5,{answeredAt:t.freshness?.answeredAt,reportingPeriod:t.reportingPeriod,filters:t.appliedFilters,rowCount:t.rowCount??d.length}),v=()=>t.tableAvailable===!1||p.length===0?null:_("div",{class:`cf-analytics-visualization${e?" is-expanded":""}`,children:[_("div",{class:"cf-analytics-visualization__header",children:[_("div",{children:[_("div",{class:"cf-analytics-visualization__title",children:t.title?.trim()||"Result details"}),g]}),_("div",{class:"cf-analytics-visualization__actions",children:[t.downloadAvailable?_("button",{type:"button",class:"cf-analytics-visualization__download",onClick:()=>p1(p,d),children:"Download"}):null,e&&n?_("button",{type:"button",class:"cf-analytics-visualization__close","aria-label":"Restore assistant view",onClick:n,children:_(Qn,{})}):r&&t.expandable!==!1?_("button",{type:"button",class:"cf-analytics-visualization__expand","aria-label":"Expand table","data-visualization-message":a,onClick:r,children:_(Tp,{})}):null]})]}),_(TR,{rows:d,columns:m,maxRows:100,expanded:e,classPrefix:"cf"})]});if(t.presentation==="table"||!t.presentation&&t.type==="table")return v();const y=t.chartRecommendation?.valueFields?.[0]??t.valueFields?.[0]??t.value??p[1];if(t.presentation==="kpi"||!t.presentation&&t.type==="kpi"){const b=d[0]?.[y??p[0]??""],x=typeof b=="number"?b:Number(b),w=t.columnMetadata?.find(k=>k.key===y),S=Number.isFinite(x)?us(x,w,t):String(b??"No value");return _("div",{class:`cf-analytics-visualization${e?" is-expanded":""}`,children:[_("div",{class:"cf-analytics-visualization__header",children:[_("div",{children:[_("div",{class:"cf-analytics-visualization__title",children:"Live metric"}),g]}),e&&n?_("button",{type:"button",class:"cf-analytics-visualization__close","aria-label":"Restore assistant view",onClick:n,children:_(Qn,{})}):null]}),_(B5,{label:w?.label??y??"Current value",value:S})]})}return u?_("div",{class:`cf-analytics-visualization${e?" is-expanded":""}`,children:[_("div",{class:"cf-analytics-visualization__header",children:[_("div",{children:[_("div",{class:"cf-analytics-visualization__title",children:u.title}),g]}),_("div",{class:"cf-analytics-visualization__actions",children:[c.length>1?_("details",{ref:i,class:"cf-analytics-chart-picker",children:[_("summary",{"aria-label":"Choose chart type",title:"Choose chart type",children:[_("span",{class:"cf-analytics-chart-picker__current",children:[_(a1,{type:f??u.type}),_("span",{children:h?.label??"Chart"})]}),_(Ya,{})]}),_("div",{class:"cf-analytics-chart-picker__menu",role:"listbox","aria-label":"Chart type",children:c.map(b=>{const x=b.type===f;return _("button",{type:"button",role:"option","aria-selected":x,class:x?"is-selected":"",onClick:()=>{l(b.type),i.current&&(i.current.open=!1)},children:[_("span",{class:"cf-analytics-chart-picker__icon",children:_(a1,{type:b.type})}),_("span",{class:"cf-analytics-chart-picker__copy",children:[_("strong",{children:b.label}),_("small",{children:F5(b.type)})]}),x?_(Xa,{}):null]},b.type)})})]}):null,e&&n?_("button",{type:"button",class:"cf-analytics-visualization__close","aria-label":"Restore assistant view",onClick:n,children:_(Qn,{})}):r&&t.expandable!==!1?_("button",{type:"button",class:"cf-analytics-visualization__expand","aria-label":"Expand chart","data-visualization-message":a,onClick:r,children:_(Tp,{})}):null]})]}),_(SR,{model:u,expanded:e}),t.downloadAvailable?_("button",{type:"button",class:"cf-analytics-visualization__download",onClick:()=>p1(p,d),children:"Download this data"}):null]}):v()},p1=(t,e)=>{if(typeof document>"u"||t.length===0)return;const r=kR(e,t),n=URL.createObjectURL(new Blob([r],{type:"text/csv;charset=utf-8"})),a=document.createElement("a");a.href=n,a.download="analytics-result.csv",a.click(),URL.revokeObjectURL(n)},v1=t=>new Promise((e,r)=>{const n=new FileReader;n.onload=()=>e(String(n.result).split(",")[1]??""),n.onerror=r,n.readAsDataURL(t)}),pE=({onPick:t})=>_("div",{class:"cf-picker cf-emoji",children:a5.map(e=>_("div",{class:"cf-emoji__group",children:[_("div",{class:"cf-emoji__label",children:e.name}),_("div",{class:"cf-emoji__grid",children:e.emojis.map((r,n)=>_("button",{type:"button",class:"cf-emoji__btn",onClick:()=>t(r),"aria-label":r,children:r},n))})]},e.name))}),vE=({onSearch:t,onPick:e})=>{const r=kr(),[n,a]=U(""),[i,o]=U([]),[s,l]=U(!0);return le(()=>{let c=!0;l(!0);const u=setTimeout(()=>{t(n).then(f=>c&&(o(f),l(!1))).catch(()=>c&&(o([]),l(!1)))},300);return()=>{c=!1,clearTimeout(u)}},[n,t]),_("div",{class:"cf-picker cf-gif",children:[_("input",{class:"cf-gif__search",placeholder:r.searchGifs,value:n,"aria-label":r.searchGifs,onInput:c=>a(c.target.value)}),_("div",{class:"cf-gif__grid",children:s?_("div",{class:"cf-gif__hint",children:r.searchingGifs}):i.length===0?_("div",{class:"cf-gif__hint",children:r.noGifs}):i.map(c=>_("button",{type:"button",class:"cf-gif__item",onClick:()=>e(c.url),"aria-label":c.alt,children:_("img",{src:c.preview,alt:c.alt,loading:"lazy"})},c.id))}),_("div",{class:"cf-gif__powered",children:"via Tenor"})]})},gE=5*1024*1024,Mp=5,mE="image/png,image/jpeg,image/webp,image/gif,application/pdf",yE=15e3,qi=t=>t==="listening"||t==="hearing",Ap=t=>{switch(t){case"connecting":return"Connecting with AI…";case"listening":return"Listening now — go ahead.";case"hearing":return"Hearing you…";case"unavailable":return"I can’t hear you — check your microphone.";case"speaking":return"AI is speaking — talk to interrupt.";case"processing":return"Working on it — keep talking to add more.";case"noise":return"I couldn't hear clear words. Try again closer to the mic.";case"misunderstood":return"I didn't understand that. Please try again.";case"denied":return"Microphone access is blocked. Allow the mic or type your question.";case"muted":return"Muted — tap the mic to unmute.";case"timeout":return"Didn't hear anything for a while — ending the call.";default:return""}},_E=.004,g1=({muted:t,listening:e,micLevel:r,onToggleMute:n})=>{const a=e&&r>=_E;return _("button",{type:"button",class:`cf-call-btn ${t?"is-muted":""} ${e?"is-listening":""} ${a?"is-hot":""}`,"aria-label":t?"Unmute microphone":"Mute microphone","aria-pressed":t,onClick:n,style:e?{"--cf-wave":String(Math.max(.2,Math.min(1,r*6)))}:void 0,children:t?_(d5,{}):_(ds,{})})},bE=({audioDevices:t,selectedAudioDeviceId:e,onSelectAudioDevice:r})=>{const[n,a]=U(!1),[i,o]=U(null),s=X(null);le(()=>{if(!n)return;const c=u=>{s.current&&!u.composedPath().includes(s.current)&&a(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]),Mu(()=>{if(!n){o(null);return}const c=s.current;if(!c)return;let u=new DOMRect(0,0,window.innerWidth,window.innerHeight);for(let g=c.parentElement;g;g=g.parentElement){const v=getComputedStyle(g);if(v.overflow!=="visible"||v.overflowY!=="visible"){u=g.getBoundingClientRect();break}}const f=c.getBoundingClientRect(),h=8,d=u.bottom-f.bottom-h*2,p=f.top-u.top-h*2,m=p>d;o({up:m,maxHeight:Math.max(72,Math.floor(m?p:d))})},[n]);const l=[{deviceId:"",label:"Default microphone"},...t];return _("div",{class:"cf-call-more",ref:s,children:[_("button",{type:"button",class:"cf-call-btn cf-call-btn--microphones","aria-label":"Choose microphone","aria-expanded":n,onClick:()=>a(c=>!c),children:_(Ya,{})}),n&&_("div",{class:`cf-call-menu${i?.up?" cf-call-menu--up":""}`,role:"menu",style:i?{maxHeight:`${i.maxHeight}px`}:{visibility:"hidden"},children:[_("div",{class:"cf-call-menu__label",children:"Microphone"}),l.map(c=>_("button",{type:"button",role:"menuitemradio","aria-checked":c.deviceId===e,class:`cf-call-menu__item ${c.deviceId===e?"is-active":""}`,onClick:()=>{r(c.deviceId),a(!1)},children:[c.deviceId===e?_(Xa,{}):_("span",{class:"cf-call-menu__spacer"}),_("span",{children:c.label})]},c.deviceId))]})]})},xE=({voiceState:t,muted:e,onToggleMute:r,onEndCall:n,onTalkNow:a,showTalkNow:i,micLevel:o,theaterMode:s,onToggleTheater:l,onMinimize:c,audioDevices:u,selectedAudioDeviceId:f,onSelectAudioDevice:h})=>_("div",{class:"cf-call-controls",children:[_(g1,{muted:e,listening:qi(t)&&!e,micLevel:o,onToggleMute:r}),_(bE,{audioDevices:u,selectedAudioDeviceId:f,onSelectAudioDevice:h}),i&&_("button",{type:"button",class:"cf-call-btn cf-call-btn--talk","aria-label":"Talk now",onClick:a,children:_(ds,{})}),_("button",{type:"button",class:"cf-call-btn","aria-label":s?"Exit expanded view":"Expand view","aria-pressed":s,onClick:l,children:s?_(C5,{}):_(Tp,{})}),_("button",{type:"button",class:"cf-call-btn","aria-label":"Minimize voice chat",onClick:c,children:_(M5,{})}),_("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:n,children:_(kp,{})})]}),wE=({persona:t,voiceState:e,muted:r,onToggleMute:n,onEndCall:a,micLevel:i,onExpand:o})=>{const s=h=>h.stopPropagation(),l=t?.assistantMediaUrl?.trim()||t?.agentAvatarUrl?.trim()||"",c=t?.assistantMediaKind==="video"&&!!l,u=t?.agentName||"Assistant",f=["cf-floating-call-card",qi(e)&&!r?"is-listening":"",e==="speaking"?"is-speaking":"",e==="processing"||e==="connecting"?"is-thinking":"",r?"is-muted":""].filter(Boolean).join(" ");return _("div",{class:f,style:qi(e)&&!r?{"--cf-listen":String(Math.max(.18,Math.min(1,i*8)))}:void 0,role:"button",tabIndex:0,"aria-label":`Reopen voice chat with ${u}`,onClick:o,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())},children:[_("div",{class:"cf-floating-call-card__media","aria-hidden":"true",children:l?c?_("video",{src:l,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):_("img",{src:l,alt:""}):_("div",{class:`cf-floating-call-card__avatar${ps(t)}`,children:[_("span",{children:tu(t)}),_("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--left"}),_("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--right"}),_("span",{class:"cf-floating-call-card__mouth"})]})}),_("div",{class:"cf-floating-call-card__shade","aria-hidden":"true"}),_("span",{class:"cf-floating-call-card__status",role:"status","aria-live":"polite",children:Ap(e)}),_("div",{class:"cf-floating-call-card__controls",onClick:s,onKeyDown:s,role:"presentation",children:[_(g1,{muted:r,listening:qi(e)&&!r,micLevel:i,onToggleMute:n}),_("button",{type:"button",class:"cf-call-btn cf-call-btn--restore","aria-label":"Restore voice chat",onClick:h=>{s(h),o()},children:_(A5,{})}),_("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:h=>{s(h),a()},children:_(kp,{})})]})]})},SE=(t,e)=>{switch(t){case"connecting":return e.voiceConnecting;case"listening":return e.voiceListening;case"hearing":return e.voiceHearing;case"unavailable":return e.voiceUnavailable;case"processing":return e.voiceProcessing;case"speaking":return e.voiceSpeaking;case"noise":return e.voiceNoise;case"misunderstood":return e.voiceMisunderstood;case"denied":return e.voiceDenied;default:return Ap(t)}},kE=({draftStore:t,onSend:e,onSendGif:r,onTyping:n,disabled:a,allowVoice:i,onTranscribe:o,gifEnabled:s,onSearchGifs:l,allowAttach:c,analyzeAttachments:u=!0,onUpload:f,voiceStartSignal:h=0,onVoiceStateChange:d,onPreviewAttachment:p})=>{const m=kr(),[g,v]=U(()=>t.value),y=F=>{const ue=typeof F=="function"?F(g):F;t.value=ue,v(ue)},[b,x]=U(!1),[w,S]=U(!1),[k,C]=U("idle"),[A,M]=U("none"),[T,D]=U([]),L=X([]);L.current=T;const R=X(0),[O,B]=U(!1),[j,P]=U(!1),[V,H]=U(""),Z=X(null),re=X(null),Te=X(null),ge=X(0),xe=X(null),Ce=X(void 0),be=F=>{C(F),d?.(F)},it=()=>{Ce.current&&window.clearTimeout(Ce.current),Ce.current=void 0};le(()=>{const F=Z.current;F&&(F.style.height="auto",F.style.height=`${Math.min(F.scrollHeight,110)}px`)},[g]),le(()=>()=>{for(const F of L.current)F.previewUrl&&URL.revokeObjectURL(F.previewUrl)},[]);const Qe=F=>{D(ue=>{const De=ue.find(we=>we.key===F);return De?.previewUrl&&URL.revokeObjectURL(De.previewUrl),ue.filter(we=>we.key!==F)})},ze=()=>D([]);le(()=>{if(A==="none")return;const F=ue=>{re.current&&!ue.composedPath().includes(re.current)&&M("none")};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[A]);const oe=F=>M(ue=>ue===F?"none":F),pe=F=>{const ue=Z.current;if(!ue){y(rt=>rt+F);return}const De=ue.selectionStart??g.length,we=ue.selectionEnd??g.length;y(g.slice(0,De)+F+g.slice(we)),requestAnimationFrame(()=>{ue.focus();const rt=De+F.length;ue.setSelectionRange(rt,rt)})},ot=F=>{M("none"),r(F)},Xe=async F=>{if(F.length===0)return;H("");const ue=Mp-L.current.length-R.current;if(ue<=0){H(ct(m.attachLimit,{count:String(Mp)}));return}const De=F.slice(0,ue);for(const we of De){R.current+=1;try{await kt(we)}finally{R.current-=1}}F.length>De.length&&H(ct(m.attachLimit,{count:String(Mp)}))},kt=async F=>{const ue=++ge.current;if(F.size>gE){H(m.attachTooLarge);return}if(!f){H(m.attachFailed);return}B(!0);try{const De=await v1(F),we=await f(De,F.type||"application/octet-stream",F.name,u);if(ue!==ge.current)return;const rt={key:`${we.id||F.name}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:we.id,analysisFailed:we.analysisFailed,name:F.name,text:we.text,mimeType:F.type||"application/octet-stream",size:F.size,previewUrl:F.type.startsWith("image/")?URL.createObjectURL(F):void 0,file:F};D(vt=>[...vt,rt])}catch(De){De instanceof Qi&&De.status===413?H(m.attachTooLarge):De instanceof Qi&&[400,415,503].includes(De.status)?H(De.message):H(m.attachFailed)}finally{ue===ge.current&&B(!1)}},tt=async F=>{const ue=F.target,De=Array.from(ue.files??[]);ue.value="",await Xe(De)},lr=()=>{ge.current+=1,B(!1),H("")},Cr=(!!g.trim()||T.length>0)&&!a&&!O&&!w,Tt=()=>{Cr&&(e(g,T.length>0?{attachments:T.map(F=>({id:F.id,name:F.name,text:F.text,file:F.file}))}:void 0),n?.(!1),y(""),ze(),H(""))},Pt=F=>{const ue=F.trim();if(!ue||a){be("misunderstood");return}const De=g.trim(),we=De?`${De} ${ue}`:ue;e(we),n?.(!1),y(""),ze(),H(""),be("idle")},Bt=F=>{if(F.key==="Enter"&&!F.shiftKey){if(a)return;F.preventDefault(),Tt()}else F.key==="Escape"&&A!=="none"&&(F.preventDefault(),F.stopPropagation(),M("none"))},xt=()=>{it(),xe.current?.stop("dictation-ended"),xe.current=null,x(!1),S(!1)},tn=async()=>{const F=xe.current;if(F){const{mic:we,processing:rt}=F.snapshot;we==="hearing"||rt?F.finishTurn():(xt(),be("idle"));return}const ue=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;be("connecting");const De=new Kx({transcribe:async({audio:we,mimeType:rt,durationSeconds:vt})=>o(await v1(we),rt,ue,vt),listener:{state:({mic:we,processing:rt,reason:vt})=>{if(xe.current===De){if(we==="unavailable"){if(vt==="permission-denied"||vt==="unsupported"||vt==="no-device"||vt==="error"){xt(),be("denied");return}be("unavailable");return}x(we==="listening"||we==="hearing"),S(rt),we==="starting"?be("connecting"):rt&&we!=="hearing"?be("processing"):we==="hearing"?be("hearing"):we==="listening"&&be("listening")}},speechStart:()=>it(),turn:we=>{xe.current===De&&(xt(),Pt(we.text))},noise:we=>{xe.current===De&&(xt(),be(we.reason==="transcribe-failed"?"misunderstood":"noise"))}}});xe.current=De,Ce.current=window.setTimeout(()=>{xe.current===De&&(xt(),be("noise"))},yE),await De.start()};return le(()=>{!h||!i||a||b||w||tn()},[h]),le(()=>()=>{it(),xe.current?.stop("unmounted"),xe.current=null},[]),_("div",{class:`cf-composer ${j?"is-dragging":""}`,ref:re,onDragEnter:F=>{c&&(F.preventDefault(),P(!0))},onDragOver:F=>{c&&F.preventDefault()},onDragLeave:F=>{F.currentTarget===F.target&&P(!1)},onDrop:F=>{c&&(F.preventDefault(),P(!1),Xe(Array.from(F.dataTransfer?.files??[])))},children:[A==="emoji"&&_(pE,{onPick:pe}),A==="gif"&&_(vE,{onSearch:l,onPick:ot}),(T.length>0||O||V)&&_("div",{class:"cf-attach-row",role:"list","aria-label":m.attachedFiles,children:[T.map(F=>_("span",{class:"cf-attach-chip",role:"listitem",title:F.name,children:[_("button",{type:"button",class:"cf-attach-open","aria-label":ct(m.attachOpen,{name:F.name}),disabled:!p,onClick:()=>p?.(F.file,F.name),children:[F.previewUrl?_("img",{class:"cf-attach-preview",src:F.previewUrl,alt:""}):_(eu,{}),_("span",{class:"cf-attach-copy",children:[_("span",{children:F.name}),_("small",{children:F.analysisFailed?m.attachAnalysisFailed:`${Math.max(1,Math.ceil(F.size/1024))} KB`})]})]}),_("button",{type:"button",class:"cf-attach-x","aria-label":ct(m.removeAttachmentNamed,{name:F.name}),onClick:()=>Qe(F.key),children:_(Qn,{})})]},F.key)),O&&_("span",{class:"cf-attach-status",children:[_("span",{children:m.attaching}),_("button",{type:"button",onClick:lr,children:m.cancel})]}),V&&!O&&_("span",{class:"cf-attach-status cf-attach-status--err",children:V})]}),k!=="idle"&&_("div",{class:"cf-voice-state","aria-live":"polite",children:[_("span",{class:`cf-voice-state__dot ${b?"is-live":""}`}),SE(k,m)]}),_("div",{class:"cf-composer__field",children:[_("button",{type:"button",class:`cf-iconbtn ${A==="emoji"?"is-active":""}`,"aria-label":m.emoji,"aria-pressed":A==="emoji",onClick:()=>oe("emoji"),children:A==="emoji"?_(Qn,{}):_(_5,{})}),s&&_("button",{type:"button",class:`cf-iconbtn cf-gifbtn ${A==="gif"?"is-active":""}`,"aria-label":m.gifs,"aria-pressed":A==="gif",onClick:()=>oe("gif"),children:_("span",{class:"cf-gif-label",children:"GIF"})}),c&&_(Me,{children:[_("input",{ref:Te,type:"file",class:"cf-file-input",accept:mE,multiple:!0,onChange:tt,tabIndex:-1,"aria-hidden":"true"}),_("button",{type:"button",class:"cf-iconbtn","aria-label":m.attachFile,disabled:O,onClick:()=>Te.current?.click(),children:_(eu,{})})]}),_("textarea",{ref:Z,class:"cf-textarea",rows:1,placeholder:m.composerPlaceholder,value:g,"aria-label":m.composerPlaceholder,"aria-busy":a,onInput:F=>{const ue=F.target.value;y(ue),n?.(!!ue.trim())},onPaste:F=>{const ue=Array.from(F.clipboardData?.files??[]);!c||ue.length===0||(F.preventDefault(),Xe(ue))},onKeyDown:Bt}),i&&_("button",{type:"button",class:`cf-iconbtn cf-mic ${b?"is-recording":""}`,"aria-label":b?m.stopRecording:m.recordVoice,"aria-pressed":b,disabled:w||a,onClick:tn,children:_(ds,{})}),_("button",{type:"button",class:"cf-send","aria-label":m.send,disabled:!Cr,onClick:Tt,children:_(f5,{})})]})]})},TE=t=>t.replace(/\[[^\]]{0,60}\]/g," ").replace(/\(([^)]{0,60})\)/g,(e,r)=>m1.has(r.trim().toLowerCase().replace(/[.!?,…]+$/,"").replace(/\s+/g," "))?" ":e).replace(/\*[^*]{0,60}\*/g," ").replace(/\s+/g," ").trim(),m1=new Set(["background noise","engine noise","noise","inaudible","unintelligible","silence","no speech","static","music","laughter","applause","wind","breathing","click","clicks","clicking","mouse click","mouse clicks","beep","beeps","beeping","tap","taps","tapping","typing","keyboard typing","cough","coughing","sigh","hmm","mm","mmm","uh","um","ah","oh"]),CE=/^\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?(?:\s*(?:-|–|—|to|-->)\s*\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?)?$/,ME=t=>{const e=t.trim().toLowerCase().replace(/[()[\]*]/g," ").replace(/[.!?,…]+$/,"").replace(/\s+/g," ").trim();return!e||/^(?:sh+\s*)+$/.test(e)||CE.test(e)?!0:m1.has(e)},AE=t=>{const e=t.trim().toLowerCase().replace(/\s+/g," ");return e?/^(?:transcribe|transcription|transcribed text)[.!:]*$/.test(e)?!0:e.includes("transcribe this audio recording verbatim")||e.includes("preserve the spoken language and any code-switching")||e.includes("output only the transcribed text, no commentary"):!1};let y1=!0,vs=null;const DE=t=>{y1=t},IE=()=>{const t=typeof window<"u"?window.AudioContext??window.webkitAudioContext:void 0;if(!t)return null;if(!vs)try{vs=new t}catch{return null}return vs.state==="suspended"&&vs.resume(),vs},gs=(t,e,r,n,a,i)=>{const o=t.createOscillator(),s=t.createGain();o.type=a,o.frequency.setValueAtTime(e,r),o.connect(s),s.connect(t.destination),s.gain.setValueAtTime(1e-4,r),s.gain.exponentialRampToValueAtTime(i,r+.012),s.gain.exponentialRampToValueAtTime(1e-4,r+n),o.start(r),o.stop(r+n+.03)},Yi=t=>{if(!y1)return;const e=IE();if(!e)return;const r=e.currentTime;try{t==="open"?(gs(e,523,r,.12,"sine",.05),gs(e,784,r+.08,.16,"sine",.05)):t==="send"?gs(e,660,r,.08,"triangle",.04):t==="receive"&&(gs(e,880,r,.1,"sine",.045),gs(e,1175,r+.09,.14,"sine",.045))}catch{}},LE=t=>t.startsWith("image/")?"image":t==="application/pdf"?"pdf":"other",PE=({state:t,onClose:e})=>{const r=kr(),n=X(null);le(()=>{n.current?.focus();const i=o=>{o.key==="Escape"&&(o.stopPropagation(),e())};return document.addEventListener("keydown",i,!0),()=>document.removeEventListener("keydown",i,!0)},[e]);const a=t.status==="ready"?LE(t.mimeType):"other";return _("div",{class:"cf-preview",role:"dialog","aria-modal":"true","aria-label":ct(r.attachPreviewTitle,{name:t.name}),onClick:i=>{i.target===i.currentTarget&&e()},children:_("div",{class:"cf-preview__frame",children:[_("div",{class:"cf-preview__bar",children:[_("span",{class:"cf-preview__name",title:t.name,children:t.name}),t.status==="ready"&&_("a",{class:"cf-preview__btn",href:t.url,download:t.name,children:r.attachDownload}),_("button",{ref:n,type:"button",class:"cf-preview__btn cf-preview__close","aria-label":r.attachPreviewClose,onClick:e,children:"✕"})]}),_("div",{class:"cf-preview__body",children:[t.status==="loading"&&_("p",{class:"cf-preview__note",children:r.attachPreviewLoading}),t.status==="error"&&_("p",{class:"cf-preview__note",children:r.attachPreviewFailed}),t.status==="ready"&&a==="image"&&_("img",{class:"cf-preview__image",src:t.url,alt:t.name}),t.status==="ready"&&a==="pdf"&&_("iframe",{class:"cf-preview__pdf",src:t.url,title:t.name}),t.status==="ready"&&a==="other"&&_("p",{class:"cf-preview__note",children:r.attachPreviewUnsupported})]})]})})},RE=t=>new Promise((e,r)=>{const n=new FileReader;n.onload=()=>e(String(n.result??"").split(",")[1]??""),n.onerror=()=>r(n.error),n.readAsDataURL(t)}),EE=(t,e)=>t?.status===429?e.errorRateLimit:e.errorGeneric,Dp=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),nu=(t,e)=>{const r=Dp(),n={stage:t,durationMs:Math.max(0,r-e)};try{performance.measure(`centrinfo-widget:${t}`,{start:e,end:r})}catch{}return typeof window<"u"&&typeof CustomEvent<"u"&&window.dispatchEvent(new CustomEvent("centrinfo:performance",{detail:n})),n},OE=/!?\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,NE=/https?:\/\/[^\s)]+/g,BE=t=>t.replace(/```[\s\S]*?```/g,e=>e.replace(/^```[^\n]*\n?/,"").replace(/```$/,"").trim()),zE=t=>BE(t).replace(OE,"$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(NE,e=>e.replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\/$/,"")).replace(/[ \t]+\n/g,`
|
|
166
|
+
`),n=[];let a=0,i=0;for(;i<t.length;){const o=t[i];if(o.trim().startsWith("```")){const u=[];for(i++;i<t.length&&!t[i].trim().startsWith("```");)u.push(t[i]),i++;i++,n.push(r("pre",{class:"cf-md-pre",children:r("code",{children:u.join(`
|
|
167
|
+
`)})},a++));continue}if(o.trim()===""){i++;continue}const s=/^(#{1,6})\s+(.*)$/.exec(o);if(s){n.push(yd(s[1].length,hn(s[2]),a++)),i++;continue}if(/^\s*[-*•]\s+/.test(o)){const u=[];for(;i<t.length&&/^\s*[-*•]\s+/.test(t[i]);)u.push(r("li",{children:hn(t[i].replace(/^\s*[-*•]\s+/,""))},u.length)),i++;n.push(r("ul",{class:"cf-md-list",children:u},a++));continue}if(/^\s*\d+\.\s+/.test(o)){const u=[];for(;i<t.length&&/^\s*\d+\.\s+/.test(t[i]);)u.push(r("li",{children:hn(t[i].replace(/^\s*\d+\.\s+/,""))},u.length)),i++;n.push(r("ol",{class:"cf-md-list",children:u},a++));continue}const c=[o];for(i++;i<t.length&&t[i].trim()!==""&&!xd.test(t[i]);)c.push(t[i]),i++;const d=c.join(" ");if(/:\s*$/.test(d)&&i<t.length&&/^(?:\s*[-*•]\s+|\s*\d+\.\s+)/.test(t[i])){const u=/^(.*[.!?])\s+([^.!?]{2,120}:)$/.exec(d);u&&n.push(r("p",{children:hn(u[1])},a++)),n.push(r("p",{class:"cf-md-list-intro",children:hn(u?.[2]??d)},a++))}else n.push(r("p",{children:hn(d)},a++))}return n},xa=e=>bl(e),lo=()=>{const e=R(null);return X(()=>{const t=requestAnimationFrame(()=>e.current?.scrollIntoView?.({block:"end"}));return()=>cancelAnimationFrame(t)},[]),e},wd=e=>e.trim().split(/\s+/).slice(0,2).map(t=>t[0]?.toUpperCase()??"").join("")||"🤖",Pn=e=>{const t=e?.avatarId?.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-");return t?` cf-avatar-preset--${t}`:""},kd={"support-guide":"SG","sales-host":"SH","calm-advisor":"CA","technical-guide":"TG","school-desk":"SD","front-office":"FO"},ya=e=>{const t=e?.avatarId?.trim().toLowerCase();return t&&kd[t]||(e?wd(e.agentName):"·")},uo=({persona:e,small:t,hideWhenMissing:n})=>{const a=t?"cf-msg__avatar":"cf-header__avatar",i=e?.agentAvatarUrl?.trim();return i?r("span",{class:a,children:r("img",{src:i,alt:""})}):n?null:r("span",{class:`${a}${Pn(e)}`,children:ya(e)})},Sd=()=>{const e=ct(),[t,n]=$(0),a=["Understanding your question","Checking approved information","Preparing your answer"];return X(()=>{const i=[window.setTimeout(()=>n(1),1800),window.setTimeout(()=>n(2),5e3)];return()=>i.forEach(o=>window.clearTimeout(o))},[]),r("div",{class:"cf-msg__bubble cf-typing","aria-label":e.assistantTyping,children:[r("span",{class:"cf-typing__label","aria-live":"polite",children:a[t]}),r("span",{class:"cf-typing__dot"}),r("span",{class:"cf-typing__dot"}),r("span",{class:"cf-typing__dot"})]})},$d=3,Td=({msg:e})=>{if(!e.sources||e.sources.length===0)return null;const t=new Set,n=[];for(const o of e.sources){const s=(o.url||o.title||"").toLowerCase();!s||t.has(s)||o.url&&e.content.includes(o.url)||(t.add(s),n.push(o))}if(n.length===0)return null;const a=n.slice(0,$d),i=n.length-a.length;return r("div",{class:"cf-sources",children:[a.map((o,s)=>o.url?r("a",{class:"cf-source",href:o.url,target:"_blank",rel:"noopener noreferrer nofollow",title:o.title||o.url,children:[r(Ln,{}),r("span",{children:o.title||o.url})]},s):r("span",{class:"cf-source",title:o.title,children:[r(Ln,{}),r("span",{children:o.title})]},s)),i>0&&r("span",{class:"cf-source cf-source--more",children:["+",i," more"]})]})},Cd=({replies:e,onPick:t})=>e&&e.length>0?r("div",{class:"cf-chips",children:e.map((n,a)=>r("button",{type:"button",class:"cf-chip",onClick:()=>t(n),children:n},a))}):null,Ad=({persona:e,starters:t,onPick:n,onFocusComposer:a,speaking:i,voiceState:o="idle",replyPending:s=!1,pinned:c=!1,muted:d=!1,onToggleMute:l,onEndCall:u,onTalkNow:p,showTalkNow:m=!1,micLevel:f=0,theaterMode:_=!1,onToggleTheater:h,onMinimize:I,audioDevices:x=[],selectedAudioDeviceId:g="",onSelectAudioDevice:T,connectingOnly:V=!1})=>{if(!e)return null;const P=!!(e.allowVoiceInput&&e.talkbackMode&&e.talkbackMode!=="text");if(!(P||e.widgetModule==="assistant"))return null;const Z=e.agentAvatarUrl?.trim()||"",Y=e.assistantMediaUrl?.trim()||Z,z=e.assistantMediaKind==="video"&&!!Y,te=t.slice(0,3),U=o!=="idle",B=o!=="idle"?"End voice chat":`Speak with ${e.agentName}`,A=c&&P&&!U&&!i,N=o==="connecting"||o==="processing"||U&&s,y=["cf-assistant-card__stage","cf-assistant-card__stage--local",U?"is-live":"",N?"is-thinking":"",mn(o)&&!d?"is-listening":"",i||o==="speaking"?"is-speaking":"",d?"is-muted":""].filter(Boolean).join(" "),D=mn(o)&&!d?{"--cf-listen":String(Math.max(.18,Math.min(1,f*8)))}:void 0,S=N&&r("span",{class:"cf-call-ripple","aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]});if(V)return r("div",{class:"cf-assistant-card cf-assistant-card--connecting","aria-live":"polite",children:[r("div",{class:"cf-assistant-card__connecting-avatar",children:[Z?r("img",{src:Z,alt:""}):r("span",{class:`cf-assistant-card__connecting-face${Pn(e)}`,children:ya(e)}),S]}),r("div",{class:"cf-assistant-card__connecting-copy",children:[r("span",{class:"cf-assistant-card__connecting-eyebrow",children:e.agentName}),r("strong",{children:"Connecting with the AI…"})]})]});const O=U&&u&&r(au,{voiceState:o,muted:d,onToggleMute:l??(()=>{}),onEndCall:u,onTalkNow:p??(()=>{}),showTalkNow:m,micLevel:f,theaterMode:_,onToggleTheater:h??(()=>{}),onMinimize:I??(()=>{}),audioDevices:x,selectedAudioDeviceId:g,onSelectAudioDevice:T??(()=>{})});return A?r("div",{class:"cf-assistant-card cf-assistant-card--pinned cf-assistant-card--compact",children:r("button",{type:"button",class:"cf-assistant-card__compact-speak",onClick:a,children:[Z?r("span",{class:"cf-assistant-card__compact-avatar",children:r("img",{src:Z,alt:""})}):null,r("span",{class:"cf-assistant-card__compact-mic","aria-hidden":"true",children:r(Rn,{})}),r("span",{class:"cf-assistant-card__compact-label",children:B})]})}):r("div",{class:`cf-assistant-card ${c?"cf-assistant-card--pinned":""} ${i?"is-speaking":""}`,children:[(Y||P)&&r("div",{class:y,style:D,children:[r("div",{class:`cf-assistant-card__media ${Y?"cf-assistant-card__media--uploaded":"cf-assistant-card__media--generated"}${Pn(e)}`,children:[z?r("video",{src:Y,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):Y?r("img",{src:Y,alt:""}):r("div",{class:`cf-assistant-card__avatar-stage${Pn(e)}`,children:r("div",{class:"cf-assistant-card__face",children:[r("span",{class:"cf-assistant-card__initials",children:ya(e)}),r("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--left"}),r("span",{class:"cf-assistant-card__eye cf-assistant-card__eye--right"}),r("span",{class:"cf-assistant-card__mouth"})]})}),Y&&!z&&r("span",{class:"cf-assistant-card__mouth cf-assistant-card__mouth--overlay"}),r("span",{class:"cf-avatar-aura cf-avatar-aura--one","aria-hidden":"true"}),r("span",{class:"cf-avatar-aura cf-avatar-aura--two","aria-hidden":"true"}),r("span",{class:"cf-avatar-listen-ring","aria-hidden":"true"}),r("span",{class:"cf-avatar-wave","aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{}),r("span",{})]})]}),S,U&&r("span",{class:"cf-call-status",role:"status","aria-live":"polite",children:xr(o)}),P&&(O||r("button",{type:"button",class:"cf-assistant-card__speak",onClick:a,children:[r(Rn,{}),B]}))]}),!c&&r(se,{children:[e.agentDescription?r("p",{class:"cf-assistant-card__copy",children:e.agentDescription}):r("p",{class:"cf-assistant-card__copy",children:e.greeting}),te.length>0&&r("div",{class:"cf-assistant-card__chips",children:te.map(ue=>r("button",{type:"button",class:"cf-assistant-card__chip",onClick:()=>n(ue),children:ue},ue))}),e.disclaimerText||e.assistantPrivacyUrl?r("p",{class:"cf-assistant-card__privacy",children:[e.disclaimerText||"This chat may be recorded for quality and support.",e.assistantPrivacyUrl?r(se,{children:[" ",r("a",{href:e.assistantPrivacyUrl,target:"_blank",rel:"noopener noreferrer nofollow",children:"Privacy Policy"})]}):null]}):null]})]})},Md={calendar:ed,"calendar-clock":rd,headset:io,mail:gr,message:nd,newsletter:id,phone:td,presentation:ad,lifebuoy:io},Id=e=>Md[e]??gr,Ed=e=>{if(e.id==="public_contact_support")return"contact-support";switch(e.endpoint){case"book-demo":return"book-demo";case"request-callback":return"request-callback";case"schedule-callback":return"schedule-callback";case"subscribe-newsletter":return"subscribe-newsletter";case"contact":return"contact";default:return"inquiry"}},zd={public_contact_support:{label:"Contact support",description:"Send your request to the support team.",category:"support",icon:"headset",endpoint:"inquiry"},public_submit_inquiry:{label:"Leave a message",description:"Send your question and contact details.",category:"support",icon:"message",endpoint:"inquiry"},public_book_demo:{label:"Book a demo",description:"Request a demo from the team.",category:"sales",icon:"presentation",endpoint:"book-demo"},public_request_callback:{label:"Request a callback",description:"Ask the next available sales teammate to call you.",category:"sales",icon:"phone",endpoint:"request-callback"},public_schedule_callback:{label:"Schedule a callback",description:"Choose an available date and time for a call.",category:"sales",icon:"calendar-clock",endpoint:"schedule-callback"},public_subscribe_newsletter:{label:"Subscribe",description:"Get product updates.",category:"marketing",icon:"newsletter",endpoint:"subscribe-newsletter"}},Nd=(e,t,n={})=>Array.isArray(e)?e.filter(a=>a.readiness!=="unavailable").map(a=>po(a,n[a.id])):(t??[]).flatMap(a=>{const i=zd[a];if(!i)return[];const o=Ed({...i,id:a}),s=ba[o];return[{...i,id:a,presentation:o==="book-demo"||o==="schedule-callback"?"booking":"form",formTitle:s.title,submitLabel:s.submit,fields:s.fields,delivery:"",prompt:"",shortLabel:i.label.toLowerCase(),enabled:!0,readiness:"available",legacyFallback:!0}]}).map(a=>po(a,n[a.id])),po=(e,t)=>{if(!t)return e;const n=t.fields??{};return{...e,...Object.fromEntries(Object.entries(t).filter(([a,i])=>a!=="fields"&&i!==void 0)),fields:e.fields.map(a=>({...a,...n[a.key]}))}},Rd=(e,t)=>{const n=e.map(a=>a.label);return n.length===0?t.actionGetInTouch:n.length<=3?n.join(", "):`${n.slice(0,2).join(", ")} ${qe(t.actionMore,{count:String(n.length-2)})}`},fo=({label:e,required:t,value:n,onInput:a})=>{const i=Be(()=>Yl(n),[]),[o,s]=$(i.country.iso),[c,d]=$(i.national),[l,u]=$(!1),[p,m]=$(""),f=R(null),_=nn.find(x=>x.iso===o)??i.country,h=Be(()=>{const x=p.trim().toLowerCase().replace(/^\+/,"");return x?nn.filter(g=>g.name.toLowerCase().includes(x)||g.iso.toLowerCase().includes(x)||g.dial.includes(x)):nn},[p]);X(()=>{if(!l)return;const x=T=>{f.current&&!T.composedPath().includes(f.current)&&u(!1)},g=T=>{T.key==="Escape"&&u(!1)};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",g),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",g)}},[l]);const I=x=>{const g=nn.find(T=>T.iso===x)??_;s(g.iso),u(!1),m(""),a(ro(g,c))};return r("div",{class:"cf-phone",role:"group","aria-label":`${e}${t?" *":""}`,ref:f,children:[r("span",{class:"cf-phone__label",children:[e,t?" *":""]}),r("div",{class:"cf-phone__control",children:[r("button",{type:"button",class:"cf-phone__country","aria-label":`${_.name}, +${_.dial}. Choose country and calling code`,"aria-haspopup":"listbox","aria-expanded":l,onClick:()=>u(x=>!x),children:[r("span",{"aria-hidden":"true",children:ao(_.iso)}),r("span",{class:"cf-phone__country-code",children:["+",_.dial]}),r(pn,{})]}),r("input",{class:"cf-phone__input",type:"tel",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"tel-national",maxLength:15,placeholder:"8028509941",value:c,"aria-label":e,onInput:x=>{const g=x.target,T=g.value.replace(/\D/g,"");g.value=T,d(T),a(ro(_,T))}})]}),l?r("div",{class:"cf-phone__menu",children:[r("input",{class:"cf-phone__search",type:"search",placeholder:"Search country or code","aria-label":"Search countries",value:p,autoFocus:!0,onInput:x=>m(x.target.value)}),r("div",{class:"cf-phone__options",role:"listbox","aria-label":"Countries",children:h.length>0?h.map(x=>r("button",{type:"button",class:`cf-phone__option ${x.iso===_.iso?"is-selected":""}`,role:"option","aria-selected":x.iso===_.iso,onClick:()=>I(x.iso),children:[r("span",{"aria-hidden":"true",children:ao(x.iso)}),r("span",{class:"cf-phone__option-name",children:x.name}),r("span",{class:"cf-phone__option-code",children:["+",x.dial]})]},x.iso)):r("div",{class:"cf-phone__empty",children:"No countries found"})})]}):null]})},Ld=({field:e,value:t,onInput:n})=>{if(e.kind==="tel")return r(fo,{label:e.label,required:e.required,value:t,onInput:n});const a=e.placeholder??e.label,i={class:"cf-form__input",placeholder:e.required?`${a} *`:a,value:t,"aria-label":e.label,onInput:o=>n(o.target.value)};return e.kind==="textarea"?r("textarea",{rows:2,...i}):r("input",{type:e.kind,...i})},Dd=({spec:e,visitor:t,onSubmit:n,onCancel:a})=>{const i=ct(),o=lo(),[s,c]=$(()=>{const x={};for(const g of e.fields)g.identity&&t[g.identity]&&(x[g.key]=t[g.identity]);return x}),[d,l]=$("idle"),[u,p]=$(""),m=x=>!!(x.identity&&t[x.identity]?.trim()),f=e.fields.filter(x=>!m(x)),_=f.every(x=>!x.required||(s[x.key]?.trim()??"")!==""),h=t.email||t.name||"",I=async()=>{if(!_||d==="submitting")return;l("submitting");const x={},g={};for(const T of e.fields){const V=s[T.key]?.trim();V&&(x[T.key]=V,T.identity&&(g[T.identity]=V))}try{const T=await n(x,g);p(Nn(T.note||i.formThanks,T.caseReference,i)),l("done")}catch{l("error")}};return d==="done"?r("div",{class:"cf-form cf-form--done",children:[r(fn,{}),r("span",{children:u})]}):r("div",{class:"cf-form",ref:o,children:[f.length===0&&h&&r("div",{class:"cf-form__as",children:qe(i.actionAs,{identity:h})}),f.map(x=>r(Ld,{field:x,value:s[x.key]??"",onInput:g=>c(T=>({...T,[x.key]:g}))},x.key)),d==="error"&&r("div",{class:"cf-form__err",children:i.formError}),r("div",{class:"cf-form__actions",children:[a&&r("button",{type:"button",class:"cf-form__cancel",onClick:a,children:i.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:!_||d==="submitting",onClick:I,children:d==="submitting"?i.sending:e.submit})]})]})},ho=e=>String(e).padStart(2,"0"),Pd=()=>{const e=[];for(let t=9;t<=17;t++)e.push(`${ho(t)}:00`),e.push(`${ho(t)}:30`);return e},Od=e=>{const t=new Date;return t.setHours(0,0,0,0),Array.from({length:e},(n,a)=>{const i=new Date(t);return i.setDate(t.getDate()+a),i})},Fd=(e,t)=>{const[n,a]=t.split(":").map(Number),i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,a??0);try{return new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"}).format(i)}catch{return`${e.toDateString()} ${t}`}},Lt=(e,t)=>{const[n,a]=t.split(":").map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,a??0)},Ud=(e,t)=>{const n=Lt(e,t);try{return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(n)}catch{return t}},_a=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}},mo=(e,t)=>{try{const n=new URL(e);return n.searchParams.set("embed_type","Inline"),globalThis.location?.hostname&&n.searchParams.set("embed_domain",globalThis.location.hostname),t.name?.trim()&&n.searchParams.set("name",t.name.trim()),t.email?.trim()&&n.searchParams.set("email",t.email.trim()),n.toString()}catch{return e}},Bd=(e,t)=>{if(!t?.contentWindow||e.source!==t.contentWindow)return!1;try{const n=new URL(e.origin).hostname;if(n!=="calendly.com"&&!n.endsWith(".calendly.com"))return!1}catch{return!1}return!!(e.data&&typeof e.data=="object"&&typeof e.data.event=="string")},qd=({actionId:e,fields:t=ba["book-demo"].fields,visitor:n,onSubmit:a,onCancel:i,onDemoSlots:o,onConfirmHostedBooking:s,scheduler:c,title:d,submitLabel:l})=>{const u=e==="public_schedule_callback",p=u?ba["schedule-callback"]:ba["book-demo"],m=d?.trim()||p.title,f=ct(),_=lo(),h=!!(!u&&c?.connected&&c.provider==="calendly"),I=h?f.bookingOpenScheduler:l?.trim()||p.submit,x=!!(c?.connected&&c.mode==="event"&&!h&&(c.availability===void 0||c.availability.calendarIds.length>0)),g=Math.min(60,Math.max(1,c?.availability?.bookingWindowDays??14)),T=Be(()=>Od(g),[g]),[V,P]=$(null),[ee,Z]=$(x?"loading":"request_only"),[Y,z]=$(c?.availability?.slotDurationMinutes??30),[te,U]=$(_a()||c?.availability?.timezone||""),B=Be(()=>x?ee!=="available"||V===null?[]:[...new Set([...V].map(Q=>{const he=new Date(Q);return`${String(he.getHours()).padStart(2,"0")}:${String(he.getMinutes()).padStart(2,"0")}`}))].sort():Pd(),[V,ee,x]),A=Be(()=>{const Q=Date.now();for(let he=0;he<T.length;he++)if(B.some(we=>Lt(T[he],we).getTime()>Q))return he;return 0},[T,B]),[N,y]=$(A),[D,S]=$(null),[O,ue]=$(n.name??""),[oe,Fe]=$(n.email??""),[_e,Te]=$(n.phone??""),[Le,Ie]=$(""),[Ce,ve]=$("idle"),[Xe,ge]=$(""),[ie,He]=$(!1),[We,k]=$(""),[K,j]=$("scheduler"),[G,ne]=$(null),[ye,Se]=$("idle"),[et,Ye]=$(""),[tt,at]=$(""),[M,pe]=$(""),de=R(null),fe=async(Q,he,we)=>{Se("loading");try{const ce=await s?.(Q,he,we);if(!ce?.confirmed)throw new Error("booking confirmation unavailable");const be=ce?.meetingUrl||ce?.eventLink||"",wt=ce?.rescheduleUrl||ce?.cancelUrl||"";k(be||wt),j(be?"meeting":"manage"),Se("idle"),He(!1),ge(Nn(f.bookingScheduled,tt,f))}catch{Se("error"),He(!0),ge(f.bookingDetailsUnavailable)}};X(()=>{if(!et)return;const Q=he=>{if(!Bd(he,de.current)||he.data.event!=="calendly.event_scheduled")return;const we=he.data.payload,ce=we?.event?.uri?.trim()||"",be=we?.invitee?.uri?.trim()||"";M&&ce&&be?(ne({eventUri:ce,inviteeUri:be}),fe(M,ce,be),ge(f.bookingCheckingDetails)):(Se("error"),He(!0),ge(f.bookingDetailsUnavailable)),Ye(""),ve("done")};return window.addEventListener("message",Q),()=>window.removeEventListener("message",Q)},[s,tt,M,et,f]),X(()=>{if(!x||ee!=="available"||V===null)return;const Q=T.findIndex(he=>B.some(we=>V.has(Lt(he,we).getTime())));Q>=0&&y(Q)},[V,ee,T,x,B]);const Oe=!!(!u&&c?.connected&&(c.mode==="link"||c.provider==="calendly")),Ge=async()=>{if(Ce==="submitting"||Ce==="scheduling"||!n.name?.trim()&&!O.trim()||!n.email?.trim()&&!oe.trim())return;ve("submitting");const Q={};oe.trim()&&(Q.email=oe.trim()),O.trim()&&(Q.name=O.trim());try{const he=await a({...oe.trim()?{visitorEmail:oe.trim()}:{},...O.trim()?{visitorName:O.trim()}:{}},Q),we=he.booking?.schedulingLink||c?.bookingLink||"";if(!we){ve("error");return}k(we),j("scheduler"),at(he.caseReference||""),pe(he.inquiryId||""),Ye(mo(we,{name:O.trim()||n.name,email:oe.trim()||n.email})),ve("scheduling")}catch{ve("error")}},[ht,pt]=$(new Set),[yt,Dt]=$([]),[_t,Vn]=$(0),[an,rt]=$(!1);X(()=>{if(!o)return;let Q=!0;const he=new Date,we=new Date;return we.setDate(we.getDate()+g+1),o(he.toISOString(),we.toISOString()).then(ce=>{if(Q)if(pt(new Set(ce.taken.map(be=>Date.parse(be)).filter(be=>!Number.isNaN(be)))),Dt(ce.busy.map(be=>[Date.parse(be.start),Date.parse(be.end)]).filter(([be,wt])=>!Number.isNaN(be)&&!Number.isNaN(wt))),z(ce.slotDurationMinutes??30),U(_a()||ce.timezone||""),x){if(ce.status!=="available"||!Array.isArray(ce.available)){P(null),Z("unavailable");return}P(new Set(ce.available.map(be=>Date.parse(be)).filter(be=>!Number.isNaN(be)))),Z("available")}else Z(ce.status??"request_only")}).catch(()=>{!Q||!x||(P(null),Z("unavailable"))}),()=>{Q=!1}},[g,x,o,_t]);const Pt=!!n.email?.trim(),bn=!!n.name?.trim(),jt=!!n.phone?.trim(),mt=_e,Ht=!!D&&(!x||ee==="available")&&(bn||O.trim()!=="")&&(u?jt||Zl(mt):Pt||oe.trim()!==""),Ot=(u?n.phone||n.name:n.email||n.name)||"",gt=Q=>t.find(he=>he.key===Q),dt=gt("visitorName")?.label||p.fields.find(Q=>Q.key==="visitorName").label,Qe=gt("visitorEmail")?.label||f.handoffEmail,Ft=gt("visitorPhone"),it=gt("topic"),Ut=Q=>ht.has(Lt(T[N],Q).getTime()),Wt=Q=>Lt(T[N],Q).getTime()<=Date.now(),jn=Y*60*1e3,Hn=Q=>{const he=Lt(T[N],Q).getTime(),we=he+jn;return yt.some(([ce,be])=>he<be&&we>ce)},Wn=Q=>!x||V?.has(Lt(T[N],Q).getTime())===!0,Gn=async()=>{if(!Ht||Ce==="submitting"||!D)return;ve("submitting"),rt(!1);const Q=Lt(T[N],D),he=Fd(T[N],D),we={};O.trim()&&(we.name=O.trim()),u?mt&&(we.phone=mt):oe.trim()&&(we.email=oe.trim());try{const ce=await a(u?{bestTime:he,slotAt:Q.toISOString(),visitorTimezone:_a()||"UTC",...mt?{visitorPhone:mt}:{},...O.trim()?{visitorName:O.trim()}:{},...Le.trim()?{topic:Le.trim()}:{}}:{preferredAt:he,slotAt:Q.toISOString(),visitorTimezone:_a()||"UTC",...oe.trim()?{visitorEmail:oe.trim()}:{},...O.trim()?{visitorName:O.trim()}:{}},we);if(!u&&ce.booking?.mode==="link"&&ce.booking.schedulingLink?.trim()){const be=ce.booking.schedulingLink.trim();k(be),at(ce.caseReference||""),pe(ce.inquiryId||""),Ye(mo(be,{name:O.trim()||n.name,email:oe.trim()||n.email})),ve("scheduling");return}if(ce.booking?.confirmed)ge(Nn(ce.note||qe(u?f.bookingCallbackConfirmed:f.bookingConfirmed,{when:he}),ce.caseReference,f)),k(ce.booking.meetingUrl||ce.booking.rescheduleUrl||ce.booking.cancelUrl||ce.booking.eventLink||""),j(ce.booking.meetingUrl||ce.booking.eventLink?"meeting":"manage");else if(ce.booking?.verificationPending){He(!0);const be=ce.booking.eventLink||ce.booking.meetingUrl||"";/^https?:\/\//i.test(be)&&(k(be),j("unverified")),ge(Nn(ce.note||qe(f.bookingVerificationPending,{when:he}),ce.caseReference,f))}else ge(Nn(ce.note||qe(u?f.bookingCallbackRequested:f.bookingRequested,{when:he}),ce.caseReference,f));ve("done")}catch(ce){ce?.status===409?(pt(be=>new Set(be).add(Q.getTime())),S(null),rt(!0),Vn(be=>be+1),ve("idle")):ve("error")}},Tt=()=>{Ye(""),ve("idle"),i?.()};return Ce==="scheduling"&&et?r("div",{class:"cf-scheduler-overlay",role:"dialog","aria-modal":"true","aria-label":m,children:[r("header",{class:"cf-scheduler-overlay__head",children:[r("button",{type:"button",class:"cf-scheduler-overlay__back",onClick:Tt,children:f.bookingBackToChat}),r("strong",{children:m}),r("div",{class:"cf-scheduler-overlay__tools",children:[r("a",{href:We,target:"_blank",rel:"noopener noreferrer",children:[f.bookingOpenNewTab," ",r(Ln,{})]}),r("button",{type:"button","aria-label":f.bookingCloseScheduler,onClick:Tt,children:r(Dn,{})})]})]}),r("div",{class:"cf-scheduler-overlay__body",children:[r("div",{class:"cf-scheduler-overlay__loading",children:f.bookingLoadingScheduler}),r("iframe",{ref:de,class:"cf-scheduler-overlay__frame",src:et,title:m,allow:"camera; microphone; fullscreen; payment"})]})]}):Ce==="done"?r("div",{class:`cf-form cf-form--done${ie?" cf-form--pending":""}`,role:ie?"alert":"status",children:[!ie&&r(fn,{}),r("span",{children:Xe}),ye==="loading"&&r("span",{role:"status",children:f.bookingCheckingDetails}),ye==="error"&&r("div",{class:"cf-booking__receipt-error",role:"alert",children:[r("span",{children:f.bookingDetailsUnavailable}),G&&M&&s&&r("button",{type:"button",class:"cf-booking__back",onClick:()=>{fe(M,G.eventUri,G.inviteeUri)},children:f.bookingRetryDetails})]}),We&&r("a",{class:"cf-booking__link",href:We,target:"_blank",rel:"noopener noreferrer",children:[K==="meeting"?f.bookingMeetingLink:K==="manage"?f.bookingManageLink:K==="unverified"?f.bookingUnverifiedLink:f.bookingOpenScheduler," ",r(Ln,{}),r("span",{class:"cf-booking__url",children:We})]}),i&&r("button",{type:"button",class:"cf-booking__back",onClick:i,children:f.bookingBackToChat})]}):Oe?r("div",{class:"cf-form cf-booking",ref:_,children:[r("div",{class:"cf-booking__hint",children:qe(f.bookingViaProvider,{provider:c?.label??f.bookingSchedulerFallback})}),Pt?Ot?r("div",{class:"cf-form__as",children:qe(f.actionAs,{identity:Ot})}):null:r(se,{children:[!n.name?.trim()&&r("input",{class:"cf-form__input",type:"text",placeholder:`${dt} *`,value:O,"aria-label":dt,onInput:Q=>ue(Q.target.value)}),r("input",{class:"cf-form__input",type:"email",placeholder:`${Qe} *`,value:oe,"aria-label":Qe,onInput:Q=>Fe(Q.target.value)})]}),Ce==="error"&&r("div",{class:"cf-form__err",children:f.formError}),r("div",{class:"cf-form__actions",children:[i&&r("button",{type:"button",class:"cf-form__cancel",onClick:i,children:f.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:Ce==="submitting"||!n.name?.trim()&&O.trim()===""||!Pt&&oe.trim()==="",onClick:Ge,children:Ce==="submitting"?f.sending:f.bookingOpenScheduler})]})]}):r("div",{class:"cf-form cf-booking",ref:_,children:[r("div",{class:"cf-booking__hint",children:[f.bookingPickTime," ·"," ",r("span",{class:"cf-booking__dur",children:qe(u?f.bookingCallbackDuration:f.bookingDuration,{count:String(Y)})}),te?r("span",{class:"cf-booking__timezone",children:qe(f.bookingTimezone,{timezone:te})}):null]}),x&&ee==="loading"?r("div",{class:"cf-booking__state",role:"status",children:f.bookingCheckingAvailability}):null,x&&ee==="unavailable"?r("div",{class:"cf-form__err",role:"alert",children:f.bookingAvailabilityUnavailable}):null,x&&ee==="available"&&B.length===0?r("div",{class:"cf-booking__state",role:"status",children:f.bookingNoSlots}):null,B.length>0?r("div",{class:"cf-booking__dates",role:"tablist","aria-label":f.bookingPickDay,children:T.map((Q,he)=>r("button",{type:"button",role:"tab","aria-selected":he===N,disabled:x&&ee==="available"&&!B.some(we=>V?.has(Lt(Q,we).getTime())),class:`cf-booking__date ${he===N?"is-selected":""}`,onClick:()=>{y(he),S(null)},children:[r("span",{class:"cf-booking__dow",children:Q.toLocaleDateString(void 0,{weekday:"short"})}),r("span",{class:"cf-booking__dom",children:Q.getDate()})]},he))}):null,B.length>0?r("div",{class:"cf-booking__slots",role:"listbox","aria-label":f.bookingPickTimeLabel,children:B.map(Q=>{const he=Wt(Q),we=Hn(Q),ce=Ut(Q),be=Wn(Q),wt=ce||he||we||!be;return r("button",{type:"button",role:"option","aria-selected":D===Q,disabled:wt,title:he?f.bookingEarlierToday:we?f.bookingCalendarBusy:ce?f.bookingAlreadyBooked:be?void 0:f.bookingNotOffered,class:`cf-booking__slot ${D===Q?"is-selected":""} ${wt?"is-taken":""}`,onClick:()=>S(Q),children:Ud(T[N],Q)},Q)})}):null,an&&r("div",{class:"cf-form__err",children:f.bookingSlotTaken}),Ot?r("div",{class:"cf-form__as",children:qe(f.actionAs,{identity:Ot})}):null,!bn&&r("input",{class:"cf-form__input",type:"text",placeholder:`${dt} *`,value:O,"aria-label":dt,onInput:Q=>ue(Q.target.value)}),u&&!jt&&r(fo,{label:Ft?.label??"Phone number",required:!0,value:_e,onInput:Te}),u&&it?r("input",{class:"cf-form__input",type:"text",placeholder:it.placeholder||it.label,value:Le,"aria-label":it.label,onInput:Q=>Ie(Q.target.value)}):null,!u&&!Pt&&r(se,{children:r("input",{class:"cf-form__input",type:"email",placeholder:`${Qe} *`,value:oe,"aria-label":Qe,onInput:Q=>Fe(Q.target.value)})}),Ce==="error"&&r("div",{class:"cf-form__err",children:f.formError}),r("div",{class:"cf-form__actions",children:[i&&r("button",{type:"button",class:"cf-form__cancel",onClick:i,children:f.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:!Ht||Ce==="submitting",onClick:Gn,children:Ce==="submitting"?f.sending:I})]})]})},go=({actions:e,descriptors:t,visitor:n,onSubmitForm:a,onDemoSlots:i,onConfirmHostedBooking:o,scheduler:s,exclude:c=[],openAction:d,showTrigger:l=!0,translations:u={},onClose:p})=>{const m=ct(),[f,_]=$(null),[h,I]=$(!1),x=R(null),g=R(null),T=R(!1),V=R(null),P=R(void 0),ee=R(!1),Z=Be(()=>`cf-actions-${Math.random().toString(36).slice(2,9)}`,[]),Y=Be(()=>Nd(t,e,u).filter(N=>!c.includes(N.id)&&!c.includes(N.endpoint)),[t,e,c,u]);X(()=>{if(!d){P.current=void 0;return}P.current!==d&&Y.some(N=>N.id===d)&&(P.current=d,ee.current=!0,_(d),I(!0))},[d,Y]);const z=f?Y.find(N=>N.id===f):void 0,te=F(()=>{if(p){p();return}T.current=!0,V.current=x.current||g.current?.closest(".cf-panel")?.querySelector(".cf-footer-actions .cf-action-trigger, .cf-textarea")||null,ee.current=!1,_(null),I(!1)},[p]),U=F(()=>{ee.current?te():p?p():_(null)},[p,te]);Sn(()=>{h||!T.current||(T.current=!1,V.current?.focus(),V.current=null)},[h]);const B=R({drawerOpen:h,activeId:f});if(B.current={drawerOpen:h,activeId:f},X(()=>{const N=y=>{if(y.key!=="Escape")return;const{drawerOpen:D,activeId:S}=B.current;!D&&!S||(y.stopPropagation(),S?U():te())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[U,te]),X(()=>{if(!h)return;const N=g.current;if(!N)return;N.querySelector("button, input, textarea, select")?.focus({preventScroll:!0});let y;const D=()=>{cancelAnimationFrame(y),y=requestAnimationFrame(()=>N.scrollIntoView?.({block:"nearest"}))};D();const S=N.closest(".cf-body")&&typeof ResizeObserver=="function"?new ResizeObserver(D):null;return S?.observe(N),()=>{cancelAnimationFrame(y),S?.disconnect()}},[h,f]),Y.length===0||!l&&!h)return null;const A=h?z?r("div",{ref:g,id:Z,class:"cf-action-drawer is-open",role:"dialog","aria-modal":"false","aria-label":z.formTitle||z.label,children:[r("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),r("div",{class:"cf-action-drawer__head",children:[r("div",{children:[r("strong",{children:z.formTitle||z.label}),z.legacyFallback?r("small",{class:"cf-action-test-mode",children:m.actionTestMode}):null]}),r("button",{type:"button",class:"cf-action-drawer__close","aria-label":m.actionClose,onClick:U,children:r(Dn,{})})]}),z.readiness==="degraded"&&z.readinessNote?r("p",{class:"cf-action-drawer__note cf-action-drawer__note--warn",role:"status",children:z.readinessNote}):null,z.presentation==="booking"||z.endpoint==="book-demo"||z.endpoint==="schedule-callback"?r(qd,{actionId:z.id,fields:z.fields,visitor:n,title:z.formTitle,submitLabel:z.submitLabel,onCancel:U,onSubmit:(N,y)=>a(z.id,N,y,z.endpoint),onDemoSlots:i,onConfirmHostedBooking:o,scheduler:s}):r(Dd,{spec:{title:z.formTitle||z.label,submit:z.submitLabel,fields:z.endpoint==="request-callback"?z.fields.filter(N=>N.key!=="bestTime"):z.fields},visitor:n,onCancel:U,onSubmit:(N,y)=>a(z.id,N,y,z.endpoint)})]}):r("div",{ref:g,id:Z,class:"cf-action-drawer cf-action-drawer--menu",role:"dialog","aria-modal":"false","aria-label":m.actionChoose,children:[r("div",{class:"cf-action-drawer__handle","aria-hidden":"true"}),r("div",{class:"cf-action-drawer__head",children:[r("div",{children:[r("span",{class:"cf-action-drawer__eyebrow",children:m.actionNeedHelp}),r("strong",{children:m.actionChoose})]}),r("button",{type:"button",class:"cf-action-drawer__close","aria-label":m.actionClose,onClick:te,children:r(Dn,{})})]}),r("div",{class:"cf-action-drawer__grid",children:Y.map(N=>{const y=Id(N.icon);return r("button",{type:"button",class:"cf-action-card",onClick:()=>{ee.current=!1,_(N.id)},children:[r("span",{class:`cf-action-card__icon cf-action-card__icon--${N.category}`,children:r(y,{})}),r("span",{class:"cf-action-card__copy",children:[r("strong",{children:N.label}),N.legacyFallback?r("small",{class:"cf-action-test-mode",children:m.actionTestMode}):null,r("small",{children:N.description}),N.readiness==="degraded"&&N.readinessNote?r("small",{class:"cf-action-card__warn",children:N.readinessNote}):null]}),r(pn,{})]},N.id)})}),r("p",{class:"cf-action-drawer__note",children:m.actionFooter})]}):null;return r("div",{class:"cf-action-shell",children:[l&&r("button",{ref:x,type:"button",class:"cf-action-trigger",hidden:h,"aria-expanded":h,"aria-controls":Z,onClick:()=>h?te():I(!0),children:[r("span",{class:"cf-action-trigger__icon",children:r(gr,{})}),r("span",{class:"cf-action-trigger__copy",children:[r("strong",{children:m.actionContactOptions}),r("small",{children:Rd(Y,m)})]}),r(pn,{})]}),A]})},Vd=({hasEmail:e,visitor:t,question:n,onSubmitForm:a})=>{const i=ct(),[o,s]=$(!1),[c,d]=$(!1),[l,u]=$(t.name??""),[p,m]=$(t.email??"");if(e)return r("div",{class:"cf-handoff cf-handoff--done",children:[r(fn,{}),r("span",{children:"We’ve alerted the team. If someone is available, they can continue here."})]});if(o){const _=t.email||p;return r("div",{class:"cf-handoff cf-handoff--done",children:[r(fn,{}),r("span",{children:qe(i.handoffShared,{email:_})})]})}const f=async()=>{if(!(!p.trim()||c)){d(!0);try{await a("inquiry",{visitorEmail:p.trim(),...l.trim()?{visitorName:l.trim()}:{},message:n||"I had a question the assistant couldn’t answer.",subject:"Help request from chat"},{email:p.trim(),name:l.trim()||void 0}),s(!0)}catch{d(!1)}}};return r("div",{class:"cf-handoff",children:[r("div",{class:"cf-handoff__title",children:i.handoffTitle}),r("input",{class:"cf-form__input",type:"text",placeholder:i.handoffName,value:l,"aria-label":i.handoffName,onInput:_=>u(_.target.value)}),r("input",{class:"cf-form__input",type:"email",placeholder:`${i.handoffEmail} *`,value:p,"aria-label":i.handoffEmail,onInput:_=>m(_.target.value)}),r("button",{type:"button",class:"cf-form__submit",disabled:!p.trim()||c,onClick:f,children:c?i.sending:i.handoffNotify})]})},jd=({text:e})=>{const t=ct(),[n,a]=$(!1);return r("button",{type:"button",class:"cf-tool",onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)}catch{}},"aria-label":t.copy,children:[n?r(fn,{}):r(ld,{}),n?t.copied:t.copy]})},Hd=({items:e,onPick:t})=>e.length===0?null:r("div",{class:"cf-starters",children:e.map((n,a)=>r("button",{type:"button",class:"cf-starter",onClick:()=>t(n),children:n},a))}),Wd=({items:e})=>{const t=e.filter(n=>n.label.trim()&&n.url.trim()).slice(0,4);return t.length===0?null:r("div",{class:"cf-featured-links",children:t.map((n,a)=>r("a",{class:"cf-featured-link",href:n.url,target:"_blank",rel:"noopener noreferrer nofollow",title:n.label,children:[r(Ln,{}),r("span",{children:n.label})]},`${n.url}-${a}`))})},Gd=({msg:e,onRate:t})=>{const n=ct(),[a,i]=$(!1),[o,s]=$(""),c=e.feedback,d=()=>{t(e.id,"up"),i(!1)},l=()=>{t(e.id,"down"),i(!0)},u=()=>{t(e.id,"down",o.trim()),i(!1)};return r("div",{class:"cf-feedback",children:[r("div",{class:"cf-feedback__row",children:[r("span",{class:"cf-feedback__label",children:n.feedbackAnswerPrompt}),r("button",{type:"button",class:`cf-feedback__btn ${c==="up"?"is-active":""}`,"aria-label":`${n.feedbackHelpful} answer`,"aria-pressed":c==="up",onClick:d,children:r(oo,{})}),r("button",{type:"button",class:`cf-feedback__btn ${c==="down"?"is-active":""}`,"aria-label":`${n.feedbackNotHelpful} answer`,"aria-pressed":c==="down",onClick:l,children:r(so,{})}),c&&!a&&r("span",{class:"cf-feedback__thanks",children:n.feedbackThanks})]}),a&&c==="down"&&r("div",{class:"cf-feedback__comment",children:[r("textarea",{class:"cf-feedback__input",rows:2,placeholder:n.feedbackCommentPlaceholder,value:o,onInput:p=>s(p.target.value)}),r("button",{type:"button",class:"cf-feedback__send",onClick:u,children:n.feedbackSend})]})]})},bo=e=>e.attachments??(e.attachmentName?[{id:e.attachmentId,name:e.attachmentName}]:[]),Kd=({msg:e,persona:t,isLast:n,visitor:a,hasEmail:i,lastQuestion:o,showActions:s,onPickReply:c,onSubmitForm:d,onDemoSlots:l,onConfirmHostedBooking:u,onRetry:p,ratable:m,onRate:f,onExpandVisualization:_,onExpandExplanation:h,onReconnect:I,onOpenAttachment:x,onExplanationFeedback:g,explanationTransport:T,onOpenAnalyticsSource:V})=>{const P=ct(),ee=mr(),Z=e.role==="user",Y=e.liveEventType??"",z=e.content.trim().toLowerCase(),te=Y==="handoff_queued"||Y==="agent_joined"||Y==="agent_left"||Y==="ai_handback"||Y==="conversation_ended"||z.includes("joined the chat")||z.includes("left the chat")||z.includes("support agents will be with you"),U=e.role==="system"||te,B=e.requestedContactFields?.includes("email")===!0,A=n&&!Z&&!U&&!e.reconnectOffer&&!!(e.handoffOffered||B),N=A&&!i?["inquiry"]:[],y=!e.pending&&!e.streaming,D=[...e.artifacts??[],...e.visualization&&!(e.artifacts??[]).some(S=>S.type==="visualization")?[{type:"visualization",visualization:e.visualization}]:[]];return U?r("div",{class:"cf-msg cf-msg--system",children:r("div",{class:"cf-system-event",children:[r("div",{class:"cf-system-event__mark","aria-hidden":"true"}),r("div",{class:"cf-system-event__text",children:e.content}),I&&r("button",{type:"button",class:"cf-system-event__action",onClick:I,children:P.reconnectSupport}),e.createdAt&&r("div",{class:"cf-system-event__time",children:new Date(e.createdAt).toLocaleString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"})})]})}):r("div",{class:`cf-msg cf-msg--${Z?"user":"agent"}`,children:[!Z&&r(uo,{persona:t,small:!0}),r("div",{class:`cf-msg__col${!Z&&s?" cf-msg__col--actions":""}`,children:[e.pending&&e.content===""?r(Sd,{}):e.imageUrl?r("div",{class:"cf-msg__bubble cf-msg__bubble--media",children:[r("img",{class:"cf-msg__media",src:e.imageUrl,alt:"GIF"}),e.content&&r("span",{class:"cf-msg__caption",children:e.content})]}):r("div",{class:"cf-msg__bubble",children:[Z?e.content:_d(e.content),e.streaming&&r("span",{class:"cf-caret","aria-hidden":"true"})]}),Z?null:D.map((S,O)=>S.type==="visualization"&&S.visualization?r(vo,{visualization:S.visualization,onFollowUp:c,onExpand:_?()=>_(e.id):void 0,expandControlId:e.id},`visualization-${O}`):S.type==="image"&&(S.data||S.uri?.startsWith("https://"))&&["image/png","image/jpeg","image/webp"].includes(S.mimeType??"")?r("figure",{class:"cf-artifact",children:[S.title?r("figcaption",{children:S.title}):null,r("img",{src:S.uri||`data:${S.mimeType};base64,${S.data}`,alt:S.altText||S.caption||S.title||"Tool result"}),S.caption&&S.caption!==S.title?r("p",{children:S.caption}):null]},`image-${O}`):S.type==="video"&&S.uri?.startsWith("https://")&&(S.mimeType??"").startsWith("video/")?r("figure",{class:"cf-artifact",children:[S.title?r("figcaption",{children:S.title}):null,r("video",{controls:!0,preload:"metadata",playsInline:!0,src:S.uri}),S.caption&&S.caption!==S.title?r("p",{children:S.caption}):null]},`video-${O}`):S.type==="resource_link"&&S.uri?.startsWith("https://")?r("a",{class:"cf-artifact-link",href:S.uri,target:"_blank",rel:"noopener noreferrer nofollow",children:[r("strong",{children:S.title||S.name||"Open result"}),S.caption?r("span",{children:S.caption}):null]},`link-${O}`):null),!Z&&e.resultExpired&&!e.visualization?r("p",{class:"cf-analytics-expired","data-testid":"analytics-result-expired",children:[e.resultExpired.title?r("strong",{children:[e.resultExpired.title,". "]}):null,P.resultExpired]}):null,!Z&&e.visualization&&xa(e.visualization)?r("div",{class:"cf-analytics-explanation","data-testid":"inline-analytics-explanation","data-explanation-message":e.id,children:r(eo,{classPrefix:"cf",copy:P.analytics?.explanation,locale:ee,onExpand:h?()=>h(e.id):void 0,explanation:xa(e.visualization),onFollowUp:c,onFeedback:g,aiTransport:T,canOpenSource:S=>!!V&&(S.kind==="liveboard_tile"||S.kind==="insight"),onOpenSource:V?S=>{(S.kind==="liveboard_tile"||S.kind==="insight")&&V({kind:S.kind,id:S.id,...e.visualization?.appliedFilters?.length?{appliedFilters:e.visualization.appliedFilters}:{}})}:void 0,maxFollowUps:3,showLead:(()=>{const S=xa(e.visualization).headline?.trim().toLocaleLowerCase();return!S||!e.content.toLocaleLowerCase().includes(S)})()})}):null,Z&&bo(e).length>0&&r("div",{class:"cf-attach-row cf-attach-row--sent",children:bo(e).map((S,O)=>x?r("button",{type:"button",class:"cf-attach-chip cf-attach-chip--open",title:qe(P.attachOpen,{name:S.name}),"aria-label":qe(P.attachOpen,{name:S.name}),onClick:()=>x(e,S,O),children:[r(va,{}),r("span",{children:S.name})]},`${S.id??S.name}-${O}`):r("div",{class:"cf-attach-chip",title:S.name,children:[r(va,{}),r("span",{children:S.name})]},`${S.id??S.name}-${O}`))}),!Z&&r(se,{children:[y&&(e.error||e.content)&&r("div",{class:"cf-msg__actions",children:[r("div",{class:"cf-msg__tools",children:e.error?r("button",{type:"button",class:"cf-tool",onClick:()=>p(e.id,e.retryText??""),children:[r(dd,{}),P.retry]}):r(jd,{text:e.content})}),m&&!e.error&&e.content?r(Gd,{msg:e,onRate:f}):null]}),r(Td,{msg:e}),n&&r(Cd,{replies:e.suggestedReplies,onPick:c}),A&&r(Vd,{hasEmail:i,visitor:a,question:o,onSubmitForm:d}),s&&r(go,{showTrigger:!1,actions:e.availableActions,descriptors:e.actions,openAction:e.selectedAction,visitor:a,onSubmitForm:d,onDemoSlots:l,onConfirmHostedBooking:u,scheduler:t?.scheduler,exclude:N})]})]})]})},Yd=({visualization:e,onClose:t,onFollowUp:n,onFeedback:a,transport:i,onOpenSource:o})=>{const s=ct(),c=mr(),d=xa(e);return d?r("div",{class:"cf-analytics-explanation is-expanded","data-testid":"expanded-analytics-explanation",children:r(eo,{classPrefix:"cf",explanation:d,copy:s.analytics?.explanation,locale:c,expanded:!0,onCollapse:t,onFollowUp:n,onFeedback:a,aiTransport:i,canOpenSource:l=>!!o&&(l.kind==="liveboard_tile"||l.kind==="insight"),onOpenSource:o?l=>{(l.kind==="liveboard_tile"||l.kind==="insight")&&o({kind:l.kind,id:l.id,...e.appliedFilters?.length?{appliedFilters:e.appliedFilters}:{}})}:void 0})}):null},vo=({visualization:e,expanded:t=!1,onExpand:n,onClose:a,onFollowUp:i,expandControlId:o})=>{const s=ct(),c=mr();return r(gc,{visualization:e,classPrefix:"cf",labels:s.analytics,locale:c,expanded:t,onExpand:n,onClose:a,onFollowUp:i,expandControlId:o})},xo=e=>new Promise((t,n)=>{const a=new FileReader;a.onload=()=>t(String(a.result).split(",")[1]??""),a.onerror=n,a.readAsDataURL(e)}),Zd=({onPick:e})=>r("div",{class:"cf-picker cf-emoji",children:ql.map(t=>r("div",{class:"cf-emoji__group",children:[r("div",{class:"cf-emoji__label",children:t.name}),r("div",{class:"cf-emoji__grid",children:t.emojis.map((n,a)=>r("button",{type:"button",class:"cf-emoji__btn",onClick:()=>e(n),"aria-label":n,children:n},a))})]},t.name))}),Jd=({onSearch:e,onPick:t})=>{const n=ct(),[a,i]=$(""),[o,s]=$([]),[c,d]=$(!0);return X(()=>{let l=!0;d(!0);const u=setTimeout(()=>{e(a).then(p=>l&&(s(p),d(!1))).catch(()=>l&&(s([]),d(!1)))},300);return()=>{l=!1,clearTimeout(u)}},[a,e]),r("div",{class:"cf-picker cf-gif",children:[r("input",{class:"cf-gif__search",placeholder:n.searchGifs,value:a,"aria-label":n.searchGifs,onInput:l=>i(l.target.value)}),r("div",{class:"cf-gif__grid",children:c?r("div",{class:"cf-gif__hint",children:n.searchingGifs}):o.length===0?r("div",{class:"cf-gif__hint",children:n.noGifs}):o.map(l=>r("button",{type:"button",class:"cf-gif__item",onClick:()=>t(l.url),"aria-label":l.alt,children:r("img",{src:l.preview,alt:l.alt,loading:"lazy"})},l.id))}),r("div",{class:"cf-gif__powered",children:"via Tenor"})]})},Xd=5*1024*1024,vr=5,Qd="image/png,image/jpeg,image/webp,image/gif,application/pdf",eu=15e3,mn=e=>e==="listening"||e==="hearing",xr=e=>{switch(e){case"connecting":return"Connecting with AI…";case"listening":return"Listening now — go ahead.";case"hearing":return"Hearing you…";case"unavailable":return"I can’t hear you — check your microphone.";case"speaking":return"AI is speaking — talk to interrupt.";case"processing":return"Working on it — keep talking to add more.";case"noise":return"I couldn't hear clear words. Try again closer to the mic.";case"misunderstood":return"I didn't understand that. Please try again.";case"denied":return"Microphone access is blocked. Allow the mic or type your question.";case"muted":return"Muted — tap the mic to unmute.";case"timeout":return"Didn't hear anything for a while — ending the call.";default:return""}},tu=.004,yo=({muted:e,listening:t,micLevel:n,onToggleMute:a})=>{const i=t&&n>=tu;return r("button",{type:"button",class:`cf-call-btn ${e?"is-muted":""} ${t?"is-listening":""} ${i?"is-hot":""}`,"aria-label":e?"Unmute microphone":"Mute microphone","aria-pressed":e,onClick:a,style:t?{"--cf-wave":String(Math.max(.2,Math.min(1,n*6)))}:void 0,children:e?r(Ql,{}):r(Rn,{})})},nu=({audioDevices:e,selectedAudioDeviceId:t,onSelectAudioDevice:n})=>{const[a,i]=$(!1),[o,s]=$(null),c=R(null);X(()=>{if(!a)return;const l=u=>{c.current&&!u.composedPath().includes(c.current)&&i(!1)};return document.addEventListener("pointerdown",l),()=>document.removeEventListener("pointerdown",l)},[a]),Sn(()=>{if(!a){s(null);return}const l=c.current;if(!l)return;let u=new DOMRect(0,0,window.innerWidth,window.innerHeight);for(let I=l.parentElement;I;I=I.parentElement){const x=getComputedStyle(I);if(x.overflow!=="visible"||x.overflowY!=="visible"){u=I.getBoundingClientRect();break}}const p=l.getBoundingClientRect(),m=8,f=u.bottom-p.bottom-m*2,_=p.top-u.top-m*2,h=_>f;s({up:h,maxHeight:Math.max(72,Math.floor(h?_:f))})},[a]);const d=[{deviceId:"",label:"Default microphone"},...e];return r("div",{class:"cf-call-more",ref:c,children:[r("button",{type:"button",class:"cf-call-btn cf-call-btn--microphones","aria-label":"Choose microphone","aria-expanded":a,onClick:()=>i(l=>!l),children:r(pn,{})}),a&&r("div",{class:`cf-call-menu${o?.up?" cf-call-menu--up":""}`,role:"menu",style:o?{maxHeight:`${o.maxHeight}px`}:{visibility:"hidden"},children:[r("div",{class:"cf-call-menu__label",children:"Microphone"}),d.map(l=>r("button",{type:"button",role:"menuitemradio","aria-checked":l.deviceId===t,class:`cf-call-menu__item ${l.deviceId===t?"is-active":""}`,onClick:()=>{n(l.deviceId),i(!1)},children:[l.deviceId===t?r(fn,{}):r("span",{class:"cf-call-menu__spacer"}),r("span",{children:l.label})]},l.deviceId))]})]})},au=({voiceState:e,muted:t,onToggleMute:n,onEndCall:a,onTalkNow:i,showTalkNow:o,micLevel:s,theaterMode:c,onToggleTheater:d,onMinimize:l,audioDevices:u,selectedAudioDeviceId:p,onSelectAudioDevice:m})=>r("div",{class:"cf-call-controls",children:[r(yo,{muted:t,listening:mn(e)&&!t,micLevel:s,onToggleMute:n}),r(nu,{audioDevices:u,selectedAudioDeviceId:p,onSelectAudioDevice:m}),o&&r("button",{type:"button",class:"cf-call-btn cf-call-btn--talk","aria-label":"Talk now",onClick:i,children:r(Rn,{})}),r("button",{type:"button",class:"cf-call-btn","aria-label":c?"Exit expanded view":"Expand view","aria-pressed":c,onClick:d,children:c?r(hd,{}):r(fd,{})}),r("button",{type:"button",class:"cf-call-btn","aria-label":"Minimize voice chat",onClick:l,children:r(md,{})}),r("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:a,children:r(br,{})})]}),ru=({persona:e,voiceState:t,muted:n,onToggleMute:a,onEndCall:i,micLevel:o,onExpand:s})=>{const c=m=>m.stopPropagation(),d=e?.assistantMediaUrl?.trim()||e?.agentAvatarUrl?.trim()||"",l=e?.assistantMediaKind==="video"&&!!d,u=e?.agentName||"Assistant",p=["cf-floating-call-card",mn(t)&&!n?"is-listening":"",t==="speaking"?"is-speaking":"",t==="processing"||t==="connecting"?"is-thinking":"",n?"is-muted":""].filter(Boolean).join(" ");return r("div",{class:p,style:mn(t)&&!n?{"--cf-listen":String(Math.max(.18,Math.min(1,o*8)))}:void 0,role:"button",tabIndex:0,"aria-label":`Reopen voice chat with ${u}`,onClick:s,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),s())},children:[r("div",{class:"cf-floating-call-card__media","aria-hidden":"true",children:d?l?r("video",{src:d,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):r("img",{src:d,alt:""}):r("div",{class:`cf-floating-call-card__avatar${Pn(e)}`,children:[r("span",{children:ya(e)}),r("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--left"}),r("span",{class:"cf-floating-call-card__eye cf-floating-call-card__eye--right"}),r("span",{class:"cf-floating-call-card__mouth"})]})}),r("div",{class:"cf-floating-call-card__shade","aria-hidden":"true"}),r("span",{class:"cf-floating-call-card__status",role:"status","aria-live":"polite",children:xr(t)}),r("div",{class:"cf-floating-call-card__controls",onClick:c,onKeyDown:c,role:"presentation",children:[r(yo,{muted:n,listening:mn(t)&&!n,micLevel:o,onToggleMute:a}),r("button",{type:"button",class:"cf-call-btn cf-call-btn--restore","aria-label":"Restore voice chat",onClick:m=>{c(m),s()},children:r(gd,{})}),r("button",{type:"button",class:"cf-call-btn cf-call-btn--end","aria-label":"End voice chat",onClick:m=>{c(m),i()},children:r(br,{})})]})]})},iu=(e,t)=>{switch(e){case"connecting":return t.voiceConnecting;case"listening":return t.voiceListening;case"hearing":return t.voiceHearing;case"unavailable":return t.voiceUnavailable;case"processing":return t.voiceProcessing;case"speaking":return t.voiceSpeaking;case"noise":return t.voiceNoise;case"misunderstood":return t.voiceMisunderstood;case"denied":return t.voiceDenied;default:return xr(e)}},ou=({draftStore:e,onSend:t,onSendGif:n,onTyping:a,disabled:i,allowVoice:o,onTranscribe:s,gifEnabled:c,onSearchGifs:d,allowAttach:l,analyzeAttachments:u=!0,onUpload:p,voiceStartSignal:m=0,onVoiceStateChange:f,onPreviewAttachment:_})=>{const h=ct(),[I,x]=$(()=>e.value),g=M=>{const pe=typeof M=="function"?M(I):M;e.value=pe,x(pe)},[T,V]=$(!1),[P,ee]=$(!1),[Z,Y]=$("idle"),[z,te]=$("none"),[U,B]=$([]),A=R([]);A.current=U;const N=R(0),[y,D]=$(!1),[S,O]=$(!1),[ue,oe]=$(""),Fe=R(null),_e=R(null),Te=R(null),Le=R(0),Ie=R(null),Ce=R(void 0),ve=M=>{Y(M),f?.(M)},Xe=()=>{Ce.current&&window.clearTimeout(Ce.current),Ce.current=void 0};X(()=>{const M=Fe.current;M&&(M.style.height="auto",M.style.height=`${Math.min(M.scrollHeight,110)}px`)},[I]),X(()=>()=>{for(const M of A.current)M.previewUrl&&URL.revokeObjectURL(M.previewUrl)},[]);const ge=M=>{B(pe=>{const de=pe.find(fe=>fe.key===M);return de?.previewUrl&&URL.revokeObjectURL(de.previewUrl),pe.filter(fe=>fe.key!==M)})},ie=()=>B([]);X(()=>{if(z==="none")return;const M=pe=>{_e.current&&!pe.composedPath().includes(_e.current)&&te("none")};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[z]);const He=M=>te(pe=>pe===M?"none":M),We=M=>{const pe=Fe.current;if(!pe){g(Oe=>Oe+M);return}const de=pe.selectionStart??I.length,fe=pe.selectionEnd??I.length;g(I.slice(0,de)+M+I.slice(fe)),requestAnimationFrame(()=>{pe.focus();const Oe=de+M.length;pe.setSelectionRange(Oe,Oe)})},k=M=>{te("none"),n(M)},K=async M=>{if(M.length===0)return;oe("");const pe=Le.current,de=vr-A.current.length-N.current;if(de<=0){oe(qe(h.attachLimit,{count:String(vr)}));return}const fe=M.slice(0,de);N.current+=fe.length,D(!0);for(const Oe of fe){if(pe!==Le.current)break;try{await j(Oe,pe)}finally{pe===Le.current&&(N.current-=1,D(N.current>0))}}pe===Le.current&&M.length>fe.length&&oe(qe(h.attachLimit,{count:String(vr)}))},j=async(M,pe)=>{if(M.size>Xd){oe(h.attachTooLarge);return}if(!p){oe(h.attachFailed);return}try{const de=await xo(M);if(pe!==Le.current)return;const fe=await p(de,M.type||"application/octet-stream",M.name,u);if(pe!==Le.current)return;const Oe={key:`${fe.id||M.name}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:fe.id,analysisFailed:fe.analysisFailed,name:M.name,text:fe.text,mimeType:M.type||"application/octet-stream",size:M.size,previewUrl:M.type.startsWith("image/")?URL.createObjectURL(M):void 0,file:M};B(Ge=>[...Ge,Oe])}catch(de){if(pe!==Le.current)return;de instanceof un&&de.status===413?oe(h.attachTooLarge):de instanceof un&&[400,415,503].includes(de.status)?oe(de.message):oe(h.attachFailed)}},G=async M=>{const pe=M.target,de=Array.from(pe.files??[]);pe.value="",await K(de)},ne=()=>{Le.current+=1,N.current=0,D(!1),oe("")},ye=(!!I.trim()||U.length>0)&&!i&&!y&&!P,Se=()=>{ye&&(t(I,U.length>0?{attachments:U.map(M=>({id:M.id,name:M.name,text:M.text,file:M.file}))}:void 0),a?.(!1),g(""),ie(),oe(""))},et=M=>{const pe=M.trim();if(!pe||i){ve("misunderstood");return}const de=I.trim(),fe=de?`${de} ${pe}`:pe;t(fe),a?.(!1),g(""),ie(),oe(""),ve("idle")},Ye=M=>{if(M.key==="Enter"&&!M.shiftKey){if(i)return;M.preventDefault(),Se()}else M.key==="Escape"&&z!=="none"&&(M.preventDefault(),M.stopPropagation(),te("none"))},tt=()=>{Xe(),Ie.current?.stop("dictation-ended"),Ie.current=null,V(!1),ee(!1)},at=async()=>{const M=Ie.current;if(M){const{mic:fe,processing:Oe}=M.snapshot;fe==="hearing"||Oe?M.finishTurn():(tt(),ve("idle"));return}const pe=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;ve("connecting");const de=new qi({transcribe:async({audio:fe,mimeType:Oe,durationSeconds:Ge})=>s(await xo(fe),Oe,pe,Ge),listener:{state:({mic:fe,processing:Oe,reason:Ge})=>{if(Ie.current===de){if(fe==="unavailable"){if(Ge==="permission-denied"||Ge==="unsupported"||Ge==="no-device"||Ge==="error"){tt(),ve("denied");return}ve("unavailable");return}V(fe==="listening"||fe==="hearing"),ee(Oe),fe==="starting"?ve("connecting"):Oe&&fe!=="hearing"?ve("processing"):fe==="hearing"?ve("hearing"):fe==="listening"&&ve("listening")}},speechStart:()=>Xe(),turn:fe=>{Ie.current===de&&(tt(),et(fe.text))},noise:fe=>{Ie.current===de&&(tt(),ve(fe.reason==="transcribe-failed"?"misunderstood":"noise"))}}});Ie.current=de,Ce.current=window.setTimeout(()=>{Ie.current===de&&(tt(),ve("noise"))},eu),await de.start()};return X(()=>{!m||!o||i||T||P||at()},[m]),X(()=>()=>{Xe(),Ie.current?.stop("unmounted"),Ie.current=null},[]),r("div",{class:`cf-composer ${S?"is-dragging":""}`,ref:_e,onDragEnter:M=>{l&&(M.preventDefault(),O(!0))},onDragOver:M=>{l&&M.preventDefault()},onDragLeave:M=>{M.currentTarget===M.target&&O(!1)},onDrop:M=>{l&&(M.preventDefault(),O(!1),K(Array.from(M.dataTransfer?.files??[])))},children:[z==="emoji"&&r(Zd,{onPick:We}),z==="gif"&&r(Jd,{onSearch:d,onPick:k}),(U.length>0||y||ue)&&r("div",{class:"cf-attach-row",role:"list","aria-label":h.attachedFiles,children:[U.map(M=>r("span",{class:"cf-attach-chip",role:"listitem",title:M.name,children:[r("button",{type:"button",class:"cf-attach-open","aria-label":qe(h.attachOpen,{name:M.name}),disabled:!_,onClick:()=>_?.(M.file,M.name),children:[M.previewUrl?r("img",{class:"cf-attach-preview",src:M.previewUrl,alt:""}):r(va,{}),r("span",{class:"cf-attach-copy",children:[r("span",{children:M.name}),r("small",{children:M.analysisFailed?h.attachAnalysisFailed:`${Math.max(1,Math.ceil(M.size/1024))} KB`})]})]}),r("button",{type:"button",class:"cf-attach-x","aria-label":qe(h.removeAttachmentNamed,{name:M.name}),onClick:()=>ge(M.key),children:r(Dn,{})})]},M.key)),y&&r("span",{class:"cf-attach-status",children:[r("span",{children:h.attaching}),r("button",{type:"button",onClick:ne,children:h.cancel})]}),ue&&!y&&r("span",{class:"cf-attach-status cf-attach-status--err",children:ue})]}),Z!=="idle"&&r("div",{class:"cf-voice-state","aria-live":"polite",children:[r("span",{class:`cf-voice-state__dot ${T?"is-live":""}`}),iu(Z,h)]}),r("div",{class:"cf-composer__field",children:[r("button",{type:"button",class:`cf-iconbtn ${z==="emoji"?"is-active":""}`,"aria-label":h.emoji,"aria-pressed":z==="emoji",onClick:()=>He("emoji"),children:z==="emoji"?r(Dn,{}):r(od,{})}),c&&r("button",{type:"button",class:`cf-iconbtn cf-gifbtn ${z==="gif"?"is-active":""}`,"aria-label":h.gifs,"aria-pressed":z==="gif",onClick:()=>He("gif"),children:r("span",{class:"cf-gif-label",children:"GIF"})}),l&&r(se,{children:[r("input",{ref:Te,type:"file",class:"cf-file-input",accept:Qd,multiple:!0,onChange:G,tabIndex:-1,"aria-hidden":"true"}),r("button",{type:"button",class:"cf-iconbtn","aria-label":h.attachFile,disabled:y,onClick:()=>Te.current?.click(),children:r(va,{})})]}),r("textarea",{ref:Fe,class:"cf-textarea",rows:1,placeholder:h.composerPlaceholder,value:I,"aria-label":h.composerPlaceholder,"aria-busy":i,onInput:M=>{const pe=M.target.value;g(pe),a?.(!!pe.trim())},onPaste:M=>{const pe=Array.from(M.clipboardData?.files??[]);!l||pe.length===0||(M.preventDefault(),K(pe))},onKeyDown:Ye}),o&&r("button",{type:"button",class:`cf-iconbtn cf-mic ${T?"is-recording":""}`,"aria-label":T?h.stopRecording:h.recordVoice,"aria-pressed":T,disabled:P||i,onClick:at,children:r(Rn,{})}),r("button",{type:"button",class:"cf-send","aria-label":h.send,disabled:!ye,onClick:Se,children:r(Xl,{})})]})]})},su=e=>e.replace(/\[[^\]]{0,60}\]/g," ").replace(/\(([^)]{0,60})\)/g,(t,n)=>_o.has(n.trim().toLowerCase().replace(/[.!?,…]+$/,"").replace(/\s+/g," "))?" ":t).replace(/\*[^*]{0,60}\*/g," ").replace(/\s+/g," ").trim(),_o=new Set(["background noise","engine noise","noise","inaudible","unintelligible","silence","no speech","static","music","laughter","applause","wind","breathing","click","clicks","clicking","mouse click","mouse clicks","beep","beeps","beeping","tap","taps","tapping","typing","keyboard typing","cough","coughing","sigh","hmm","mm","mmm","uh","um","ah","oh"]),cu=/^\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?(?:\s*(?:-|–|—|to|-->)\s*\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?)?$/,lu=e=>{const t=e.trim().toLowerCase().replace(/[()[\]*]/g," ").replace(/[.!?,…]+$/,"").replace(/\s+/g," ").trim();return!t||/^(?:sh+\s*)+$/.test(t)||cu.test(t)?!0:_o.has(t)},du=e=>{const t=e.trim().toLowerCase().replace(/\s+/g," ");return t?/^(?:transcribe|transcription|transcribed text)[.!:]*$/.test(t)?!0:t.includes("transcribe this audio recording verbatim")||t.includes("preserve the spoken language and any code-switching")||t.includes("output only the transcribed text, no commentary"):!1};let wo=!0,On=null;const uu=e=>{wo=e},pu=()=>{const e=typeof window<"u"?window.AudioContext??window.webkitAudioContext:void 0;if(!e)return null;if(!On)try{On=new e}catch{return null}return On.state==="suspended"&&On.resume(),On},Fn=(e,t,n,a,i,o)=>{const s=e.createOscillator(),c=e.createGain();s.type=i,s.frequency.setValueAtTime(t,n),s.connect(c),c.connect(e.destination),c.gain.setValueAtTime(1e-4,n),c.gain.exponentialRampToValueAtTime(o,n+.012),c.gain.exponentialRampToValueAtTime(1e-4,n+a),s.start(n),s.stop(n+a+.03)},gn=e=>{if(!wo)return;const t=pu();if(!t)return;const n=t.currentTime;try{e==="open"?(Fn(t,523,n,.12,"sine",.05),Fn(t,784,n+.08,.16,"sine",.05)):e==="send"?Fn(t,660,n,.08,"triangle",.04):e==="receive"&&(Fn(t,880,n,.1,"sine",.045),Fn(t,1175,n+.09,.14,"sine",.045))}catch{}},fu=e=>e.startsWith("image/")?"image":e==="application/pdf"?"pdf":"other",hu=({state:e,onClose:t})=>{const n=ct(),a=R(null);X(()=>{a.current?.focus();const o=s=>{s.key==="Escape"&&(s.stopPropagation(),t())};return document.addEventListener("keydown",o,!0),()=>document.removeEventListener("keydown",o,!0)},[t]);const i=e.status==="ready"?fu(e.mimeType):"other";return r("div",{class:"cf-preview",role:"dialog","aria-modal":"true","aria-label":qe(n.attachPreviewTitle,{name:e.name}),onClick:o=>{o.target===o.currentTarget&&t()},children:r("div",{class:"cf-preview__frame",children:[r("div",{class:"cf-preview__bar",children:[r("span",{class:"cf-preview__name",title:e.name,children:e.name}),e.status==="ready"&&r("a",{class:"cf-preview__btn",href:e.url,download:e.name,children:n.attachDownload}),r("button",{ref:a,type:"button",class:"cf-preview__btn cf-preview__close","aria-label":n.attachPreviewClose,onClick:t,children:"✕"})]}),r("div",{class:"cf-preview__body",children:[e.status==="loading"&&r("p",{class:"cf-preview__note",children:n.attachPreviewLoading}),e.status==="error"&&r("p",{class:"cf-preview__note",children:n.attachPreviewFailed}),e.status==="ready"&&i==="image"&&r("img",{class:"cf-preview__image",src:e.url,alt:e.name}),e.status==="ready"&&i==="pdf"&&r("iframe",{class:"cf-preview__pdf",src:e.url,title:e.name}),e.status==="ready"&&i==="other"&&r("p",{class:"cf-preview__note",children:n.attachPreviewUnsupported})]})]})})},mu=e=>new Promise((t,n)=>{const a=new FileReader;a.onload=()=>t(String(a.result??"").split(",")[1]??""),a.onerror=()=>n(a.error),a.readAsDataURL(e)}),gu=(e,t)=>e?.status===429?t.errorRateLimit:t.errorGeneric,yr=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),wa=(e,t)=>{const n=yr(),a={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:a})),a},bu=/!?\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,vu=/https?:\/\/[^\s)]+/g,ko=e=>Ui(e).replace(bu,"$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(vu,t=>t.replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\/$/,"")).replace(/[ \t]+\n/g,`
|
|
28
168
|
`).replace(/\n{3,}/g,`
|
|
29
169
|
|
|
30
|
-
`).replace(/[ \t]{2,}/g," ").trim(),Tr=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,au=(t,e)=>{typeof console>"u"||console.warn(`[centrinfo-widget] ${t}`,e??{})},_1=(t,e,r,n,a=1,i,o=!1,s,l)=>{t.current?.pause(),t.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),e.current=null;const c=()=>{const m=i?.trim();if(!o||!m||typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return!1;const g=new SpeechSynthesisUtterance(m);let v=!1;const y=()=>{v||(v=!0,e.current===g&&(e.current=null,l?.()))};return g.rate=a,g.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",g.onend=y,g.onerror=y,e.current=g,s?.(),window.speechSynthesis.cancel(),window.speechSynthesis.speak(g),!0};if(!r||typeof Audio>"u")return c();const u=new Audio(`data:${n||"audio/mpeg"};base64,${r}`);let f=!1,h=!1;const d=()=>{f||(f=!0,t.current===u&&(t.current=null,l?.()))},p=()=>{if(!f){if(h||t.current!==u){d();return}f=!0,t.current=null,c()||l?.()}};return u.playbackRate=a,u.onended=d,u.onerror=p,t.current=u,u.play().then(()=>{if(!f){if(t.current!==u){d();return}h=!0,s?.(Number.isFinite(u.duration)?u.duration*1e3:void 0)}}).catch(p),!0},FE=t=>{try{return t==="none"?null:t==="session"?sessionStorage:localStorage}catch{return null}},HE=t=>{let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return(e>>>0).toString(36)},VE=t=>{try{const e=t?.split(".")[1];if(!e)return;const r=e.replace(/-/g,"+").replace(/_/g,"/"),n=JSON.parse(atob(r.padEnd(Math.ceil(r.length/4)*4,"=")));for(const a of["sub","external_user_id","user_id"]){const i=n[a];if(typeof i=="string"&&i.trim())return i.trim()}}catch{}},UE=t=>{const e=t.user?.externalId?.trim()||t.user?.userId?.trim()||t.user?.email?.trim().toLowerCase()||VE(t.identityToken)||(t.identityToken||t.getIdentityToken?"authenticated":"anonymous");return`${t.token.slice(0,12)}:${t.chatSurface}:${HE(e)}`},ms=t=>`${t.chatSurface}:${Tr()}`,GE=t=>t.slice(0,12),ys=t=>`centrinfo:session:${t}`,Ip=t=>`centrinfo:visitor:${t}`,iu=(t,e)=>`centrinfo:chat:${t}:${e}`,Lp=t=>`centrinfo:history:${t}`,b1=20,Pp=720*60*60*1e3,$E=1440*60*1e3,WE=(t,e)=>{try{return JSON.parse(t?.getItem(Ip(e))||"{}")}catch{return{}}},qE=(t,e,r)=>{if(!t)return ms(r);try{const n=ys(e),a=t.getItem(n);if(a)return a;const i=ms(r);return t.setItem(n,i),i}catch{return ms(r)}},x1=(t,e,r)=>{if(!t)return{};try{const n=t.getItem(iu(e,r));return n?JSON.parse(n):{}}catch{return{}}},w1=(t,e,r)=>{const{ts:n,expiresAt:a,messages:i}=x1(t,e,r);return Array.isArray(i)?typeof a=="number"&&Date.now()>a?[]:typeof n=="number"&&Date.now()-n>Pp?[]:i:[]},YE=(t,e,r)=>{const{ts:n,expiresAt:a,messages:i,ended:o}=x1(t,e,r);return!Array.isArray(i)||i.length===0||typeof a=="number"&&Date.now()>a||typeof n=="number"&&Date.now()-n>Pp?!1:o===!0||typeof n=="number"&&Date.now()-n>$E},XE=t=>Number.isFinite(t??NaN)?Math.max(5,Math.min(200,Math.round(t))):50,ZE=t=>Number.isFinite(t??NaN)?Math.max(1,Math.min(365,Math.round(t)))*24*60*60*1e3:Pp,S1=(t,e,r,n,a,i,o,s)=>{if(t)try{if(!i){t.removeItem(iu(e,r));return}const l=n.filter(u=>!u.pending).slice(-o);if(l.length===0)return;const c=Date.now();t.setItem(iu(e,r),JSON.stringify({ts:c,expiresAt:c+s,messages:l,ended:a}))}catch{}},KE=(t,e)=>{if(!t)return[];try{const r=t.getItem(Lp(e)),n=r?JSON.parse(r):[];return Array.isArray(n)?n:[]}catch{return[]}},ou=(t,e,r)=>{if(t)try{t.setItem(Lp(e),JSON.stringify(r.slice(0,b1)))}catch{}},k1=(t,e)=>{if(t)try{const r=`centrinfo:chat:${e}:`,n=new Set([ys(e),Ip(e),Lp(e)]),a=[];for(let i=0;i<t.length;i++){const o=t.key(i);o&&(n.has(o)||o.startsWith(r))&&a.push(o)}a.forEach(i=>t.removeItem(i))}catch{}},jE=t=>{const n=(t.find(a=>a.role==="user"&&a.content.trim())?.content||t.find(a=>a.content.trim())?.content||"").trim().replace(/\s+/g," ");return n.length>60?n.slice(0,60)+"…":n||"Conversation"},JE=t=>({id:`live:${t.id}`,role:t.type==="chat"||t.type==="ai_resume"?"assistant":"system",content:t.content,authorName:t.authorName,liveEventType:t.type,createdAt:t.createdAt,offerReconnect:t.type==="ai_handback"&&t.reconnectOffered===!0}),T1=t=>(t??[]).find(e=>e.category==="support"&&e.enabled&&e.readiness!=="unavailable"&&(e.liveHandoff??e.id==="public_contact_support")),QE=(t,e)=>{if(e==="ai")for(let r=t.length-1;r>=0;r--){const n=t[r];if(n){if(n.reconnectOffer)return;if(n.liveEventType==="ai_handback")return n.offerReconnect?n.id:void 0}}},eO=(t,e,r=!0)=>{const n=X(FE(e.persistence)).current,a=UE(e),i=X(qE(n,a,e)),o=X(null),s=X(null),l=X(null),c=X(null),u=X(null),f=X(null),h=X(new Map),d=X(!1),p=X(void 0),m=X(null),g=X({}),v=X({}),[y,b]=U(null),[x,w]=U(()=>w1(n,a,i.current)),S=X(x.length>0),k=X(x.some(E=>E.role==="user")),[C,A]=U(!1),[M,T]=U(!1),[D,L]=U({status:"idle"}),R=X({}),[O,B]=U(()=>YE(n,a,i.current)),[j,P]=U(()=>WE(n,a)),[V,H]=U(()=>KE(n,a)),[Z,re]=U(null),[Te,ge]=U([]),[xe,Ce]=U("ai"),[be,it]=U(void 0),[Qe,ze]=U(void 0),oe=X(new Date().toISOString()),pe=X(void 0),ot=X(!1),Xe=X(0),kt=X(j);le(()=>{kt.current=j},[j]);const tt=y?.memoryEnabled!==!1,lr=XE(y?.memoryMessageCap),Cr=ZE(y?.memoryRetentionDays),Tt=Y(()=>{o.current?.abort(),k1(n,a),k1(n,GE(e.token));const E=ms(e);i.current=E;try{n?.setItem(ys(a),E)}catch{}re(null),ge([]),B(!1),H([]),P({}),Ce("ai"),it(void 0),ze(void 0),oe.current=new Date().toISOString(),w(y?[{id:Tr(),role:"assistant",content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[])},[n,a,e.token,y]),Pt=Y(E=>{try{n?.setItem(Ip(a),JSON.stringify(E))}catch{}},[n,a]),Bt=Y(E=>{const z=(E.email??"").trim().toLowerCase(),W=(kt.current.email??"").trim().toLowerCase();z&&W&&z!==W&&Tt();const G={};E.email?.trim()&&(G.email=E.email.trim()),E.phone?.trim()&&(G.phone=E.phone.trim());const ie=[E.firstName,E.lastName].filter(ce=>!!ce?.trim()).join(" ").trim()||E.name?.trim()||"";ie&&(G.name=ie),Object.keys(G).length>0&&P(ce=>{const ye={...G,...ce};return Pt(ye),ye}),t.identify(i.current,E).catch(()=>{})},[t,Pt,Tt]),xt=Y(E=>{b(E),w(z=>{if(z.length===0)return[{id:Tr(),role:"assistant",content:E.greeting,availableActions:E.availableActions,actions:E.actions}];const W=z.some(J=>J.role==="user"),G=z[0];return!W&&G?.role==="assistant"?[{...G,content:E.greeting,availableActions:E.availableActions,actions:E.actions},...z.slice(1)]:z})},[]);le(()=>{if(y?.memoryEnabled===!1){try{n?.removeItem(iu(a,i.current))}catch{}ou(n,a,[]),H([]),re(null),ge([]),w(E=>S.current?(S.current=!1,y?[{id:Tr(),role:"assistant",content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[]):E)}},[y,n,a]);const tn=Y(async()=>{const E=await t.bootstrap();xt(E)},[xt,t]);le(()=>{let E=!0;const z=W=>W.messages.map(G=>({id:G.id,role:G.role,content:G.content,authorName:G.authorName,liveEventType:G.messageType,offerReconnect:G.messageType==="ai_handback"&&G.reconnectOffered===!0,sources:G.sources,visualization:G.visualization,artifacts:G.artifacts,createdAt:G.createdAt}));return t.history().then(W=>{if(!E||W.conversations.length===0)return;const G=W.conversations.map(ye=>({sessionId:ye.sessionId,ts:Date.parse(ye.lastSeenAt)||Date.now(),title:ye.title,ended:ye.ended}));for(const ye of W.conversations)S1(n,a,ye.sessionId,z(ye),ye.ended,!0,lr,Cr);ou(n,a,G),H(G);const J=W.conversations.find(ye=>ye.sessionId===W.activeSessionId);if(!J||k.current)return;const ie=z(J);i.current=J.sessionId,S.current=ie.length>0;try{n?.setItem(ys(a),J.sessionId)}catch{}const ce=ie[ie.length-1]?.createdAt;ce&&(oe.current=ce),B(J.ended),w(ie)}).catch(()=>{}),()=>{E=!1}},[lr,Cr,a,n,t]),le(()=>{let E=!0;return t.bootstrap().then(z=>{E&&xt(z)}),e.user&&Bt(e.user),()=>{E=!1}},[xt,t]),le(()=>{const E=e.configRefreshSeconds;if(!r||E<=0||typeof window>"u")return;let z=!0,W=!1;const G=Math.max(10,E)*1e3,J=()=>typeof document>"u"||document.visibilityState!=="hidden",ie=async()=>{if(!(!z||W||!J())){W=!0;try{await tn()}catch{}finally{W=!1}}};ie();const ce=window.setInterval(ie,G),ye=()=>{ie()},Fe=()=>{ie()};return window.addEventListener("focus",ye),document?.addEventListener?.("visibilitychange",Fe),()=>{z=!1,window.clearInterval(ce),window.removeEventListener("focus",ye),document?.removeEventListener?.("visibilitychange",Fe)}},[r,e.configRefreshSeconds,tn]),le(()=>{S1(n,a,i.current,x,O,tt,lr,Cr)},[x,O,n,a,tt,lr,Cr]),le(()=>{if(!r||O||Z)return;const E=()=>{document.visibilityState==="visible"&&t.presence(i.current)};E();const z=window.setInterval(E,1e4);return document.addEventListener("visibilitychange",E),()=>{window.clearInterval(z),document.removeEventListener("visibilitychange",E)}},[r,O,t,Z]),le(()=>{if(O||Z)return;let E=!0,z=!1;const W=async()=>{if(!z){z=!0;try{const J=await t.liveEvents(i.current,oe.current);if(!E)return;if(Ce(J.mode),it(J.assignedAgentName||void 0),ze(J.agentTyping?J.agentTypingName||J.assignedAgentName||"Agent":void 0),J.conversationEnded){B(!0),Ce("ai"),it(void 0),ze(void 0),w(ie=>ie.some(ce=>ce.id==="live:conversation-ended")?ie:[...ie,{id:"live:conversation-ended",role:"system",content:e.strings.conversationEnded,liveEventType:"conversation_ended",createdAt:new Date().toISOString()}]);return}if(J.events.length>0){let ie=oe.current,ce=Date.parse(ie);const ye=J.events.map(Fe=>{const ne=Date.parse(Fe.createdAt);return Number.isFinite(ne)&&ne>ce&&(ce=ne,ie=Fe.createdAt),JE(Fe)});oe.current=ie,w(Fe=>{const ne=new Set(Fe.map(yt=>yt.id)),rr=ye.filter(yt=>!ne.has(yt.id));return rr.length>0?[...Fe,...rr]:Fe}),ye.some(Fe=>Fe.role==="assistant")&&Yi("receive")}}catch{}finally{z=!1}}};W();const G=window.setInterval(W,2200);return()=>{E=!1,window.clearInterval(G)}},[e.strings.conversationEnded,t,O,Z]),le(()=>{if(!tt){ou(n,a,[]),H(z=>z.length>0?[]:z);return}x.some(z=>z.role==="user")&&H(z=>{const W=i.current,J=[{sessionId:W,ts:Date.now(),title:jE(x),ended:O},...z.filter(ie=>ie.sessionId!==W)];return ou(n,a,J),J.slice(0,b1)})},[x,O,n,a,tt]);const F=Y((E,z)=>{w(W=>W.map(G=>G.id===E?{...G,...z}:G))},[]),ue=Y(()=>{p.current!==void 0&&typeof window<"u"&&window.clearInterval(p.current),p.current=void 0},[]),De=Y((E,z)=>{ue(),delete g.current[E],m.current===E&&(m.current=null),F(E,{content:z,pending:!1,streaming:!1})},[ue,F]),we=Y((E,z,W)=>{const G=z.trim();if(!G||typeof window>"u"){De(E,G);return}ue(),m.current=E;const J=G.match(/\S+\s*/g)??[G],ie=W&&W>0?W:J.length*95,ce=Math.max(28,Math.min(150,ie/Math.max(J.length,1)));let ye=0;F(E,{content:"",pending:!1,streaming:!0}),p.current=window.setInterval(()=>{ye+=1;const Fe=J.slice(0,ye).join("");F(E,{content:Fe,pending:!1,streaming:ye<J.length}),ye>=J.length&&(ue(),delete g.current[E],m.current===E&&(m.current=null),F(E,{content:G,pending:!1,streaming:!1}))},ce)},[ue,De,F]),rt=Y(()=>{const E=m.current;ue(),m.current=null;const z=g.current;g.current={};for(const[W,G]of Object.entries(z))F(W,{content:G,pending:!1,streaming:!1});E&&!(E in z)&&F(E,{pending:!1,streaming:!1})},[ue,F]),vt=Y(E=>{if(O||Z||xe==="ai"||typeof window>"u")return;if(pe.current!==void 0&&window.clearTimeout(pe.current),!E){if(!ot.current)return;ot.current=!1,Xe.current=0,t.typing(i.current,!1).catch(()=>{});return}const z=Date.now();(!ot.current||z-Xe.current>2500)&&(ot.current=!0,Xe.current=z,t.typing(i.current,!0).catch(()=>{})),pe.current=window.setTimeout(()=>{ot.current&&(ot.current=!1,Xe.current=0,t.typing(i.current,!1).catch(()=>{}))},1600)},[t,O,Z,xe]);le(()=>()=>{pe.current!==void 0&&typeof window<"u"&&window.clearTimeout(pe.current)},[]),le(()=>()=>ue(),[ue]);const Mr=Y((E,z,W={})=>{rt(),A(!0);const G=Dp();let J=!1;const ie=new AbortController;o.current=ie;const ce=!!(y?.allowVoiceInput&&y?.voiceOutputEnabled&&y.talkbackMode!=="text"),ye=!!W.forceVoicePlayback,Fe=Q=>{ye&&L(Ee=>Ee.agentId===z?{status:Q,agentId:z}:Ee)};ye&&L({status:"answering",agentId:z});const ne={pending:new Map,nextSeq:0,highestSeq:-1,playing:!1,ended:!1,started:!1,stopped:!1,utterance:null},rr=()=>{f.current===Ct&&(f.current=null),ne.started&&(ne.started=!1,T(!1),Fe("done"))},yt=()=>{ne.stopped||ne.started||(ne.started=!0,nu("voice-first-audio",G),T(!0),Fe("speaking"))},ra=()=>typeof window<"u"&&"speechSynthesis"in window&&typeof SpeechSynthesisUtterance<"u",Rt=()=>{c.current&&ne.playing&&(c.current.pause(),c.current=null),ne.utterance&&(u.current===ne.utterance&&(u.current=null),ne.utterance=null,ra()&&window.speechSynthesis.cancel()),ne.playing=!1},gt=(Q,Ee)=>{const st=Q?.trim();if(!st||!ra())return!1;const Re=new SpeechSynthesisUtterance(st);return Re.rate=y?.voiceSpeed??1,Re.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",Re.onstart=yt,Re.onend=Ee,Re.onerror=Ee,ne.utterance=Re,u.current=Re,window.speechSynthesis.speak(Re),d.current&&window.speechSynthesis.pause(),!0},Hr=()=>{for(;!ne.stopped&&!ne.playing;){let Q=ne.pending.get(ne.nextSeq);if(!Q&&ne.ended&&ne.pending.size>0&&(ne.nextSeq=Math.min(...ne.pending.keys()),Q=ne.pending.get(ne.nextSeq)),!Q){ne.ended&&rr();return}if(ne.pending.delete(ne.nextSeq),ne.nextSeq+=1,Ze(Q))return}},Ze=Q=>{let Ee=!1;const st=()=>{Ee||(Ee=!0,u.current===ne.utterance&&(u.current=null),ne.utterance=null,ne.playing=!1,Hr())};if(!Q.audioBase64||typeof Audio>"u")return ne.playing=gt(Q.text,st),ne.playing;const Re=new Audio(`data:${Q.mimeType||"audio/mpeg"};base64,${Q.audioBase64}`);Re.playbackRate=y?.voiceSpeed??1,Re.volume=d.current?.2:1,ne.playing=!0,c.current=Re;let Ft=!1,Ar=!1;const Dn=()=>{Ee||Ar||(Ar=!0,c.current===Re&&(c.current=null),!(!Ft&&!ne.stopped&>(Q.text,st))&&st())};return Re.onended=()=>{c.current===Re&&(c.current=null),st()},Re.onerror=Dn,Re.play().then(()=>{Ft=!0,yt()}).catch(Dn),!0},Ct=()=>{ne.stopped=!0,ne.pending.clear(),Rt(),rr()};t.stream(E,i.current,{voicePlaybackRequested:!!W.forceVoicePlayback,clientMessageId:W.clientMessageId,attachmentId:W.attachmentId,attachmentIds:W.attachmentIds,signal:ie.signal,onChunk:Q=>{Q&&!J&&(J=!0,nu("data-first-chunk",G)),W.forceVoicePlayback&&Q&&(v.current[z]=!0),w(Ee=>Ee.map(st=>st.id===z?{...st,content:st.content+Q,pending:!1,streaming:!0}:st))},onTextReady:()=>{w(Q=>Q.map(Ee=>Ee.id===z?{...Ee,pending:!1,streaming:!1}:Ee))},onReset:()=>{w(Q=>Q.map(Ee=>Ee.id===z?{...Ee,content:"",pending:!0,streaming:!1}:Ee)),ne.pending.clear(),ne.nextSeq=ne.highestSeq+1,Rt()},onAudioSegment:Q=>{!ye||ne.stopped||Q.seq<ne.nextSeq||ne.pending.has(Q.seq)||(f.current=Ct,ne.highestSeq=Math.max(ne.highestSeq,Q.seq),ne.pending.set(Q.seq,Q),Hr())}}).then(Q=>{if(r&&!Q.conversationEnded&&typeof document<"u"&&document.visibilityState==="visible"&&t.presence(i.current),Q.liveMode&&(Ce(Q.liveMode),it(Q.assignedAgentName||void 0)),Q.liveMode&&Q.liveMode!=="ai"&&!Q.answer.trim()){w(Re=>Re.filter(Ft=>Ft.id!==z)),Fe("done");return}const Ee=!!v.current[z];delete v.current[z];const st=!!(W.forceVoicePlayback&&ce&&!Q.liveAudio&&Q.audioBase64&&Q.answer.trim()&&!Ee);if(st&&(g.current[z]=Q.answer),w(Re=>Re.map(Ft=>Ft.id===z?{...Ft,content:st?"":Q.answer||Ft.content||e.strings.emptyReply,pending:!1,streaming:st,error:!1,retryText:void 0,sources:Q.sources,suggestedReplies:Q.suggestedReplies,availableActions:Q.availableActions,actions:Q.actions,selectedAction:Q.selectedAction,handoffOffered:Q.handoffOffered,requestedContactFields:Q.requestedContactFields,visualization:Q.visualization,artifacts:Q.artifacts}:Ft)),Yi("receive"),Q.liveAudio?(ne.ended=!0,Hr()):W.forceVoicePlayback&&!Q.audioBase64&&au(ce?"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:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode,voiceProvider:y?.voiceProvider,hasAudioBase64:!!Q.audioBase64}),W.forceVoicePlayback&&!Q.liveAudio){const Re=_1(c,u,Q.audioBase64,Q.mimeType,y?.voiceSpeed??1,Q.answer,!0,Ft=>{T(!0),Fe("speaking"),st&&we(z,Q.answer,Ft)},()=>{T(!1),Fe("done"),st&&De(z,Q.answer)});Re||Fe("done"),st&&!Re&&De(z,Q.answer)}Q.answer&&e.onMessage?.({role:"assistant",content:Q.answer}),Q.handoffOffered&&e.onHandoff?.(),Q.conversationEnded&&B(!0)}).catch(Q=>{if(ie.signal.aborted){ne.stopped||Ct(),delete v.current[z],w(st=>st.flatMap(Re=>Re.id!==z?[Re]:Re.content.trim()?[{...Re,pending:!1,streaming:!1}]:[])),Fe("done");return}Fe("failed"),delete v.current[z];const Ee=EE(Q,e.strings);F(z,{content:Ee,pending:!1,streaming:!1,error:!0,retryText:E})}).finally(()=>{nu("data-complete",G),delete v.current[z],o.current===ie&&(A(!1),o.current=null,s.current?.agentId===z&&(s.current=null))})},[t,r,e,F,y?.allowVoiceInput,y?.talkbackMode,y?.voiceOutputEnabled,y?.voiceSpeed,rt]),rn=Y((E,z={})=>{const W=E.trim(),{imageUrl:G,attachmentName:J,attachmentText:ie,attachmentId:ce,attachmentFile:ye,forceVoicePlayback:Fe,userMessageId:ne}=z,rr=z.attachments??(J||ce||ie?[{id:ce,name:J??"",text:ie,file:ye}]:[]);if(!W&&!G&&rr.length===0||o.current&&!o.current.signal.aborted||O)return;k.current=!0;let yt=W;for(const Ze of rr){const Ct=Ze.name?` "${Ze.name}"`:"";Ze.text?yt=`${yt}
|
|
31
|
-
|
|
32
|
-
[Attached file${Ct}]:
|
|
33
|
-
${Ze.text}`.trim():Ze.id&&(yt=`${yt}
|
|
34
|
-
|
|
35
|
-
[The visitor attached a file${Ct}. It is saved for staff, but its contents were not available to the AI. Do not claim to have inspected it.]`.trim())}!yt&&G&&(yt=G);const ra=rr.map(Ze=>({id:Ze.id,name:Ze.name})),Rt=rr.flatMap(Ze=>Ze.id?[Ze.id]:[]),gt={id:ne||Tr(),role:"user",content:W,imageUrl:G,attachments:ra.length>0?ra:void 0};rr.forEach((Ze,Ct)=>{Ze.file&&(h.current.set(`${gt.id}:${Ct}`,Ze.file),Ze.id&&h.current.set(Ze.id,Ze.file))});const Hr=Tr();w(Ze=>[...!!(ne&&Ze.some(Ee=>Ee.id===ne))?Ze.map(Ee=>Ee.id===ne?{...Ee,content:W,pending:!1,streaming:!1,imageUrl:G,attachments:gt.attachments}:Ee):[...Ze,gt],{id:Hr,role:"assistant",content:"",pending:!0}]),Yi("send"),e.onMessage?.({role:"user",content:yt}),R.current[Hr]=gt.id,s.current={userId:gt.id,agentId:Hr,text:W,backendText:yt},Mr(yt,Hr,{forceVoicePlayback:Fe,clientMessageId:gt.id,attachmentId:Rt[0],attachmentIds:Rt})},[O,e,Mr]),Fr=Y((E,z,W,G,J)=>{const ie=Tr();w(ce=>[...ce.filter(ye=>ye.id!==E.agentId&&(!G.userMessageId||ye.id!==G.userMessageId)).map(ye=>ye.id===E.userId?{...ye,content:z,pending:!1,streaming:!1}:ye),{id:ie,role:"assistant",content:"",pending:!0}]),J&&e.onMessage?.({role:"user",content:J}),R.current[ie]=E.userId,s.current={userId:E.userId,agentId:ie,text:z,backendText:W},Mr(W,ie,{forceVoicePlayback:G.forceVoicePlayback,clientMessageId:Tr()})},[e,Mr]),bs=Y((E,z={})=>{const W=E.trim();if(!W||O)return;const G=o.current&&!o.current.signal.aborted?s.current:null,J=G??l.current;if(l.current=null,!J){rn(W,z);return}G&&o.current?.abort(),Fr(J,`${J.text} ${W}`.replace(/\s+/g," ").trim(),`${J.backendText}
|
|
36
|
-
${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.aborted?s.current:null;return E?(l.current=E,o.current?.abort(),!0):!1},[]),Qt=Y(()=>{const E=l.current;l.current=null,!(!E||O)&&Fr(E,E.text,E.backendText,{forceVoicePlayback:!0})},[O,Fr]),Xi=Y(()=>o.current?.abort(),[]),Zi=Y(E=>{d.current=E;const z=c.current;z&&(z.volume=E?.2:1),u.current&&typeof window<"u"&&"speechSynthesis"in window&&(E?window.speechSynthesis.pause():window.speechSynthesis.resume())},[]),nn=Y(()=>{f.current?.(),f.current=null,d.current=!1,rt(),L(E=>E.status==="speaking"||E.status==="answering"?{...E,status:"done"}:E),c.current?.pause(),c.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),u.current=null,T(!1)},[rt]),Cn=Y(E=>{const z=zE(E);if(!z)return Promise.resolve(!1);rt();const W=!!(y?.allowVoiceInput&&y?.voiceOutputEnabled&&y.talkbackMode!=="text"),G=(J,ie)=>new Promise(ce=>{let ye=!1;_1(c,u,J,ie,y?.voiceSpeed??1,z,!0,()=>{ye=!0,T(!0)},()=>{T(!1),ce(ye)})||(T(!1),ce(!1))});return W?t.speak(z).then(J=>J.audioBase64?G(J.audioBase64,J.mimeType):(au("Talkback prompt TTS did not return provider audio.",{providerReady:J.providerReady,message:J.message,voiceProvider:y?.voiceProvider,voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode}),G())).catch(J=>(au("Talkback prompt TTS request failed before audio playback.",{error:J instanceof Error?J.message:String(J),voiceProvider:y?.voiceProvider,voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode}),G())):(au("Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.",{voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode,voiceProvider:y?.voiceProvider}),G())},[y?.allowVoiceInput,y?.talkbackMode,y?.voiceOutputEnabled,y?.voiceSpeed,rt,t]),ea=Y((E,z,W={})=>{if(C||O||!z)return;F(E,{content:"",pending:!0,streaming:!1,error:!1}),Yi("send");const G=x.findIndex(ie=>ie.id===E),J=G>0?x[G-1]:void 0;Mr(z,E,{...W,clientMessageId:R.current[E]??(J?.role==="user"?J.id:void 0)})},[C,O,x,F,Mr]),an=Y((E,z,W)=>{F(E,{feedback:z});const G=x.findIndex(ce=>ce.id===E),J=G>=0?x[G]?.content:void 0;let ie;for(let ce=G-1;ce>=0;ce--)if(x[ce]?.role==="user"){ie=x[ce]?.content;break}t.sendFeedback({sessionId:i.current,messageId:E,rating:z,comment:W,question:ie,answer:J}).catch(()=>{})},[t,F,x]),Ka=Y(async(E,z,W={},G)=>{e.onAction?.(E);const J=E==="public_contact_support"||E==="public_submit_inquiry"?{actionId:E}:{},ie=await t.action(E,{sessionId:i.current,...z,...J},G),ce={};return W.name?.trim()&&(ce.name=W.name.trim()),W.email?.trim()&&(ce.email=W.email.trim()),W.phone?.trim()&&(ce.phone=W.phone.trim()),Object.keys(ce).length>0&&(P(ye=>{const Fe={...ye,...ce};return Pt(Fe),Fe}),ce.email&&E!=="contact"&&t.action("contact",{sessionId:i.current,...ce}).catch(()=>{})),Yi("receive"),ie},[t,e,Pt]),er=Y((E,z,W)=>t.confirmHostedBooking?.({sessionId:i.current,inquiryId:E,eventUri:z,inviteeUri:W})??Promise.resolve(void 0),[t]),tr=Y(E=>{const z=E.trim();z&&w(W=>W.some(G=>G.role==="assistant"&&G.content===z)?W:[...W,{id:Tr(),role:"assistant",content:z}])},[]),Mn=Y(()=>{const E=T1(y?.actions);return E?(w(z=>[...z,{id:Tr(),role:"assistant",content:e.strings.reconnectPrompt,actions:[E],selectedAction:E.id,handoffOffered:!0,reconnectOffer:!0,createdAt:new Date().toISOString()}]),!0):!1},[e.strings.reconnectPrompt,y?.actions]),zt=Y(E=>{k.current=!0;const z=Tr();return w(W=>[...W,{id:z,role:"user",content:E.trim(),pending:!0}]),z},[]),xs=Y((E,z)=>{w(W=>W.map(G=>G.id===E?{...G,...z}:G))},[]),ws=Y(E=>{w(z=>z.filter(W=>W.id!==E))},[]),Ss=Y((E,z)=>{t.sendFeedback({sessionId:i.current,messageId:"__csat__",rating:E,comment:z}).catch(()=>{})},[t]),ks=Y(async(E,z,W,G)=>{const J=Dp();try{if(typeof E!="string"&&t.transcribeAudio)return await t.transcribeAudio(E,z,W,G);const ie=typeof E=="string"?E:await RE(E);return await t.transcribe(ie,z,W,G)}finally{nu("voice-transcription",J)}},[t]),An=Y(async(E,z,W=0)=>{const G=h.current.get(`${E.id}:${W}`)??(z.id?h.current.get(z.id):void 0);if(G)return G;if(!z.id||!t.fetchAttachment)throw new Error("This file is no longer available.");return t.fetchAttachment(z.id,i.current)},[t]),Ts=Y((E,z,W,G)=>t.uploadAttachment?t.uploadAttachment(E,z,W,i.current,G):Promise.reject(new Error("File upload is unavailable")),[t]),ja=Y(E=>t.searchGifs(E),[t]),te=Y((E,z)=>t.demoSlots(E,z),[t]),Se=Y(E=>rn("",{imageUrl:E}),[rn]),Le=e.demo||!!e.gifApiKey,ve=Y(()=>{o.current?.abort(),B(!0),t.endConversation(i.current).catch(()=>{})},[t]),Ae=Y(()=>{o.current?.abort();const E=ms(e);i.current=E;try{n?.setItem(ys(a),E)}catch{}re(null),ge([]),B(!1),Ce("ai"),it(void 0),ze(void 0),oe.current=new Date().toISOString(),w(y?[{id:Tr(),role:"assistant",content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[])},[n,a,y]),cr=Y(E=>{if(tt){if(E===i.current){re(null);return}ge(w1(n,a,E)),re(E)}},[n,a,tt]),ta=Y(()=>{re(null),ge([])},[]),on=e.starters.length>0?e.starters:y?.starterQuestions??[],sn=y?.featuredLinks??[];return{persona:y,messages:x,sending:C,assistantSpeaking:M,voiceReply:D,visitor:j,starters:on,featuredLinks:sn,hasEmail:!!j.email,liveMode:xe,assignedAgentName:be,agentTypingName:Qe,send:rn,amend:bs,hold:Za,resumeHeld:Qt,duckSpeaking:Zi,sendGif:Se,notifyTyping:vt,stop:Xi,retry:ea,rateMessage:an,injectAssistant:tr,reconnectSupport:Mn,appendUserDraft:zt,patchMessage:xs,removeMessage:ws,submitCsat:Ss,submitForm:Ka,confirmHostedBooking:er,transcribe:ks,uploadAttachment:Ts,loadAttachment:An,searchGifs:ja,demoSlots:te,gifEnabled:Le,identify:Bt,ended:O,endConversation:ve,startNew:Ae,history:tt?V:[],viewingSessionId:Z,viewMessages:Te,openConversation:cr,closeHistoryView:ta,shutdown:Tt,stopSpeaking:nn,speakAssistantText:Cn}},tO=({name:t,greeting:e})=>{const r=kr();return _("section",{class:"cf-empty-welcome","aria-label":ct(r.welcomeLabel,{name:t}),children:[_("span",{class:"cf-empty-welcome__eyebrow",children:r.welcomeEyebrow}),_("h2",{children:t}),_("p",{children:e||r.welcomePrompt})]})},Rp=(t,e,r)=>{if(t.key==="Escape"){t.preventDefault(),t.stopPropagation(),r();return}if(t.key!=="Tab")return;const n=Array.from(e.querySelectorAll('button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])')).filter(c=>!c.hasAttribute("disabled")&&c.getAttribute("aria-hidden")!=="true"&&c.tabIndex>=0);if(n.length===0)return;const a=e.getRootNode(),i=t.composedPath()[0],o=i instanceof HTMLElement?i:"activeElement"in a?a.activeElement:document.activeElement,s=n[0],l=n[n.length-1];t.shiftKey&&(o===s||!e.contains(o))?(t.preventDefault(),t.stopPropagation(),l.focus()):!t.shiftKey&&(o===l||!e.contains(o))&&(t.preventDefault(),t.stopPropagation(),s.focus())},su=new Map,C1=t=>{if(!t||typeof document>"u"||typeof CanvasRenderingContext2D>"u")return;const e=document.createElement("canvas").getContext("2d");if(!e)return;e.fillStyle="#010203",e.fillStyle=t;const r=e.fillStyle;if(r==="#010203"&&t.trim().toLowerCase()!=="#010203")return;const n=r.match(/^#([\da-f]{6})$/i)?.[1];if(n)return[Number.parseInt(n.slice(0,2),16),Number.parseInt(n.slice(2,4),16),Number.parseInt(n.slice(4,6),16),1];const a=r.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!a)return;const i=a.slice(1,5).map(Number);if(!i.some(o=>!Number.isFinite(o)))return[i[0],i[1],i[2],i[3]??1]},rO=(t,e="#ffffff")=>{const r=`${t??""}|${e}`;if(su.has(r))return su.get(r);const n=C1(t),a=C1(e)??[255,255,255,1];if(!n){su.set(r,void 0);return}const i=n[3],s=n.slice(0,3).map((h,d)=>h*i+a[d]*(1-i)).map(h=>{const d=h/255;return d<=.04045?d/12.92:((d+.055)/1.055)**2.4}),l=s[0]*.2126+s[1]*.7152+s[2]*.0722,c=1.05/(l+.05),u=(l+.05)/.059,f=c>=u?"#ffffff":"#0f1e2a";return su.set(r,f),f},nO=t=>{const[e,r]=U("light");return le(()=>{if(t!=="auto"||typeof matchMedia>"u")return;const n=matchMedia("(prefers-color-scheme: dark)"),a=()=>r(n.matches?"dark":"light");return a(),n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[t]),t==="auto"?e:t},aO=6e4,iO=90,M1={end:"end the call",mute:"mute your microphone",minimize:"minimize the chat",expand:"expand the view",shrink:"exit the expanded view"},A1=t=>t.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu," ").replace(/\s+/g," ").trim(),oO=[{action:"shrink",re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:"end",re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:"mute",re:/\bmute\b|\bstop listening\b/},{action:"minimize",re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:"expand",re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],sO=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,lO=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,cO=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,uO=t=>{const e=A1(t);if(!e)return null;for(const{action:r,re:n}of oO)if(n.test(e)){const a=e.split(" ").length;return{action:r,confident:r==="end"?a<=10:a<=6}}return null},fO=t=>`I didn't catch yes or no. Say yes to ${M1[t]}, or no to keep talking.`,dO=({transport:t,config:e,bindControls:r,composerDraftStore:n})=>{const a=e.strings,[i,o]=U(e.openByDefault),{persona:s,messages:l,sending:c,assistantSpeaking:u,visitor:f,hasEmail:h,liveMode:d,assignedAgentName:p,agentTypingName:m,starters:g,featuredLinks:v,send:y,sendGif:b,notifyTyping:x,stop:w,amend:S,hold:k,resumeHeld:C,duckSpeaking:A,retry:M,rateMessage:T,injectAssistant:D,reconnectSupport:L,appendUserDraft:R,patchMessage:O,removeMessage:B,submitCsat:j,submitForm:P,confirmHostedBooking:V,transcribe:H,uploadAttachment:Z,loadAttachment:re,searchGifs:Te,demoSlots:ge,gifEnabled:xe,identify:Ce,ended:be,endConversation:it,startNew:Qe,history:ze,viewingSessionId:oe,viewMessages:pe,openConversation:ot,closeHistoryView:Xe,shutdown:kt,stopSpeaking:tt,speakAssistantText:lr}=eO(t,e,i),Cr=QE(l,d),[Tt,Pt]=U(null),Bt=X(0),xt=Y((N,$,fe)=>{fe===Bt.current&&Pt({status:"ready",name:$,url:URL.createObjectURL(N),mimeType:N.type||"application/octet-stream"})},[]),tn=Y((N,$,fe)=>{const Ke=$.name,je=++Bt.current;Pt({status:"loading",name:Ke}),re(N,$,fe).then(Dr=>xt(Dr,Ke,je),()=>{je===Bt.current&&Pt({status:"error",name:Ke})})},[re,xt]),F=Y((N,$)=>xt(N,$,++Bt.current),[xt]),ue=Y(()=>{Bt.current+=1,Pt(null)},[]);le(()=>()=>{Tt?.status==="ready"&&URL.revokeObjectURL(Tt.url)},[Tt]);const De=!!T1(s?.actions),[we,rt]=U(0),[vt,Mr]=U({mic:"off",processing:!1}),[rn,Fr]=U(null),[bs,Za]=U(!1),[Qt,Xi]=U(!1),[Zi,nn]=U(!1),[Cn,ea]=U(!1),[an,Ka]=U(0),[er,tr]=U(!1),[Mn,zt]=U(null),[xs,ws]=U([]),[Ss,ks]=U(""),[An,Ts]=U(()=>{try{return localStorage.getItem("centrinfo:muted")==="1"}catch{return!1}}),ja=nO(e.theme),te=s?.soundEnabled??!0;le(()=>{DE(e.sound&&te&&!An)},[e.sound,te,An]);const Se=Y(()=>{Ts(N=>{const $=!N;try{localStorage.setItem("centrinfo:muted",$?"1":"0")}catch{}return $})},[]),Le=X(null),ve=X(null),Ae=X(null),cr=X(0),ta=X(!1),on=X(!1),sn=X(null),E=X(0),z=X(void 0),W=X(0),G=X(null),J=X(!1),ie=X(null),ce=X(""),ye=X(()=>{}),Fe=X(""),ne=X(c),rr=X(y);rr.current=y;const yt=X(S);yt.current=S;const ra=X(H);ra.current=H;const Rt=X(!1),gt=X(!1),Hr=X("");Hr.current=[...l].reverse().find(N=>N.role==="assistant")?.content??"";const Ze=X(u);ne.current=c,Ze.current=u;const Ct=Qt?bs?"timeout":Cn||vt.mic==="muted"?"muted":vt.mic==="unavailable"?vt.reason==="permission-denied"||vt.reason==="unsupported"?"denied":"unavailable":vt.mic==="off"||vt.mic==="starting"?"connecting":vt.mic==="hearing"?"hearing":u?"speaking":rn??(vt.processing||c?"processing":"listening"):"idle",[Q,Ee]=U(!0),[st,Re]=U(!1),Ft=X(0),[Ar,Dn]=U(!1),[Ja,Qa]=U(!1),R1=X(null),[na,ei]=U(!1),kO=X({value:""}),TO=n??kO.current,E1=X({confirmEnd:Ar,confirmClear:Ja,showHistory:na});E1.current={confirmEnd:Ar,confirmClear:Ja,showHistory:na};const[CO,O1]=U(!1),ut=!!oe,Op=ut?pe:l,Cs=Op.find(N=>N.id===Mn&&N.visualization)?.visualization;le(()=>{!Mn||Cs||(zt(null),tr(!1))},[Cs,Mn]);const Ki=Y(()=>{o(!0),rt(0),Yi("open"),e.onOpen?.(),e.onShow?.()},[e]),ln=Y(()=>{o(!1),tr(!1),zt(null),e.onClose?.(),e.onHide?.(),ve.current?.focus()},[e]),Ms=Y(()=>i?ln():Ki(),[i,Ki,ln]),MO=Y(()=>Dn(!0),[]),AO=Y(()=>{it(),Dn(!1)},[it]),DO=Y(()=>{Qe(),Re(!1),Ee(!0)},[Qe]);le(()=>{Ar&&R1.current?.focus()},[Ar]),le(()=>{r({open:Ki,close:ln,toggle:Ms,identify:Ce,startNew:Qe,endConversation:it,shutdown:kt})},[r,Ki,ln,Ms,Ce,Qe,it,kt]),le(()=>{const N=l.filter($=>$.role==="assistant"&&!$.pending).length;if(i){cr.current=N;return}N>cr.current&&rt(N-cr.current)},[l,i]),le(()=>{e.onUnreadChange?.(we)},[we,e]),le(()=>{const N=e.sessionDurationMinutes;if(!N||N<=0)return;const $=setTimeout(()=>kt(),N*60*1e3);return()=>clearTimeout($)},[e.sessionDurationMinutes,l,i,kt]),le(()=>{const N=e.customLauncherSelector;if(!N||typeof document>"u")return;let $=[];try{$=Array.from(document.querySelectorAll(N))}catch{return}const fe=Ke=>{Ke.preventDefault(),Ms()};return $.forEach(Ke=>Ke.addEventListener("click",fe)),()=>$.forEach(Ke=>Ke.removeEventListener("click",fe))},[e.customLauncherSelector,Ms]);const N1=X(!1);le(()=>{const N=e.proactiveMessage?.trim();if(!N||N1.current)return;const $=e.proactiveOnPaths??[],fe=typeof location<"u"?location.pathname:"";if($.length>0&&!$.some(Dr=>fe.includes(Dr)))return;const Ke=`centrinfo:proactive:${e.token.slice(0,12)}`;try{if(sessionStorage.getItem(Ke)==="1")return}catch{}const je=setTimeout(()=>{if(!(i||be||l.some(Dr=>Dr.role==="user"))){N1.current=!0;try{sessionStorage.setItem(Ke,"1")}catch{}D(N),Ki()}},Math.max(0,e.proactiveDelaySeconds)*1e3);return()=>clearTimeout(je)},[e.proactiveMessage]),le(()=>{const N=Ae.current;if(!i||!N)return;const $=l[l.length-1],fe=Date.now()<Ft.current;$?.role==="user"||Q||fe?(requestAnimationFrame(()=>{N.scrollTop=N.scrollHeight}),Re(!1),fe&&Ee(!0)):Re(!0)},[l,i,c,Q]);const IO=Y(()=>{const N=Ae.current;if(!N)return;if(ta.current&&!ut){Ee(!0),Re(!1);return}const $=N.scrollHeight-N.scrollTop-N.clientHeight<80;Ee($),$&&Re(!1)},[ut]),aa=Y(()=>{const N=Ae.current;N&&(N.scrollTop=N.scrollHeight),Re(!1),Ee(!0)},[]),lu=Y(()=>{Ft.current=Date.now()+3e3,requestAnimationFrame(aa)},[aa]);le(()=>{if(!i||ut||!Qt||Ct==="connecting")return;Ft.current=Date.now()+6e4,aa();const N=requestAnimationFrame(()=>{aa(),requestAnimationFrame(aa)}),$=[80,180,360].map(fe=>window.setTimeout(aa,fe));return()=>{cancelAnimationFrame(N),$.forEach(fe=>window.clearTimeout(fe))}},[u,l,i,aa,c,Qt,ut,Ct]);const B1=Y(()=>{Le.current?.querySelector(".cf-textarea")?.focus()},[]),As=Y((N,$)=>{Fr(N),z.current&&window.clearTimeout(z.current),z.current=window.setTimeout(()=>Fr(null),3e3),$&&!on.current&&lr($)},[lr]),cu=Y(N=>{const $=ie.current;if($)return $;lu();const fe=R(N);return ie.current=fe,O(fe,{content:ce.current||N,pending:!0,streaming:!1}),fe},[R,lu,O]),In=Y(()=>{const N=ie.current;if(N){if(ce.current){O(N,{content:ce.current,pending:!0});return}ie.current=null,B(N)}},[O,B]),ia=Y(()=>{gt.current&&(gt.current=!1,A(!1)),Rt.current&&(Rt.current=!1,C())},[A,C]),nr=Y(()=>{ta.current=!1,sn.current?.stop("call-ended"),sn.current=null,Rt.current=!1,gt.current=!1,on.current=!1,G.current=null,J.current=!1;const N=ie.current;ie.current=null,ce.current="",N&&B(N),z.current&&window.clearTimeout(z.current),Fr(null),Za(!1),Mr({mic:"off",processing:!1}),Ka(0),Xi(!1),nn(!1),ea(!1),tr(!1),zt(null),tt()},[B,tt]),LO=Y(()=>{er&&zt(null),tr(!er)},[er]),PO=Y(N=>{zt(N),tr(!0)},[]),RO=Y(()=>{const N=Mn;zt(null),tr(!1),window.requestAnimationFrame(()=>{Array.from(Le.current?.querySelectorAll("[data-visualization-message]")??[]).find(fe=>fe.dataset.visualizationMessage===N)?.focus()})},[Mn]),EO=Y(()=>{zt(null),tr(!1)},[]),z1=Y((N,$,fe=!1)=>{if(lu(),$&&(O($,{content:N,pending:!1,streaming:!1}),ie.current===$&&(ie.current=null)),ce.current="",fe){tt(),yt.current(N,{forceVoicePlayback:!0,userMessageId:$});return}ta.current&&(k()?yt.current(N,{forceVoicePlayback:!0,userMessageId:$}):rr.current(N,{forceVoicePlayback:!0,userMessageId:$}))},[lu,k,O,tt]),cn=Y(N=>{D(N),lr(N)},[D,lr]),F1=Y(()=>{if(E.current=Date.now(),Fr(null),Ze.current){gt.current=!0,A(!0);return}Rt.current||(Rt.current=k()),cu("Listening...")},[A,cu,k]),H1=Y(N=>{const $=ie.current;if(!$||gt.current)return;const fe=[ce.current,N].filter(Boolean).join(" ");O($,{content:`${fe} ...`,pending:!0})},[O]),V1=Y(N=>{E.current=Date.now();const $=[ce.current,N.text].map(un=>un.trim()).filter(Boolean).join(" ").replace(/\s+/g," ").trim();if((gt.current||N.overlappedOutput)&&AR(N.text,Hr.current)){In(),ia();return}if(!$||ME($)||AE($)){const un=gt.current||Rt.current;In(),ia(),un||As("misunderstood");return}gt.current&&(gt.current=!1,w(),tt());const Ke=G.current;if(Ke){ce.current="",In();const un=A1($);if(sO.test(un)||Ke==="end"&&cO.test(un)){G.current=null,ye.current(Ke);return}if(lO.test(un)){G.current=null,cn("Okay, never mind — what would you like to know?");return}cn(fO(Ke));return}const je=uO($);if(je){if(ce.current="",In(),ia(),je.confident){ye.current(je.action);return}G.current=je.action,cn(`Just to confirm — you want me to ${M1[je.action]}? Please say yes or no.`);return}const Dr=cu($);O(Dr,{content:$,pending:!0});const ji=Rt.current;Rt.current=!1,z1($,Dr,ji)},[cu,O,ia,z1,In,As,cn,w,tt]),U1=Y(N=>{E.current=Date.now();const $=gt.current||Rt.current;if(In(),ia(),!($||N.overlappedOutput||N.reason==="too-short")){if(N.reason==="transcribe-failed"){As("misunderstood","I couldn't transcribe that. Please try again, or type your question.");return}As("noise")}},[ia,In,As]),Ds=X({speechStart:F1,partial:H1,turn:V1,noise:U1});Ds.current={speechStart:F1,partial:H1,turn:V1,noise:U1};const G1=Y(()=>{navigator.mediaDevices?.enumerateDevices().then(N=>{ws(N.filter($=>$.kind==="audioinput").map(($,fe)=>({deviceId:$.deviceId,label:$.label||`Microphone ${fe+1}`})))}).catch(()=>{})},[]),OO=Y(()=>{if(ta.current){nr();return}if(B1(),!s?.allowVoiceInput||!s.talkbackMode||s.talkbackMode==="text"||ne.current||be||ut)return;E.current=Date.now(),on.current=!1,ta.current=!0,ea(!1),Xi(!0),nn(!1),Za(!1);let N=!1;const $=new Kx({deviceId:Fe.current||void 0,transcribe:async({audio:fe,mimeType:Ke,durationSeconds:je})=>{const Dr=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;return TE(await ra.current(fe,Ke,Dr,je))},listener:{state:fe=>{Mr(fe),fe.mic!=="starting"&&fe.mic!=="off"&&nn(!0),!N&&fe.mic==="listening"&&(N=!0,G1())},speechStart:()=>Ds.current.speechStart(),partial:({text:fe})=>Ds.current.partial(fe),turn:fe=>Ds.current.turn(fe),noise:fe=>Ds.current.noise(fe),level:fe=>{const Ke=performance.now();Ke-W.current<iO||(W.current=Ke,Ka(fe))}}});sn.current=$,$.setOutputActive(Ze.current),$.start()},[nr,be,B1,s,G1,ut]),uu=Y(()=>{const N=!on.current;on.current=N,ea(N),sn.current?.setMuted(N),N?(ce.current="",In(),ia()):E.current=Date.now()},[ia,In]),$1=Y(N=>{switch(E.current=Date.now(),N){case"end":J.current=!0,cn("Okay — ending our call now. Goodbye!"),window.setTimeout(()=>{J.current&&(J.current=!1,nr())},2e3);break;case"mute":{on.current||uu(),cn("Muted. Tap the mic button when you want me to listen again.");break}case"minimize":ln(),cn("Minimized — I'm still listening. Tap the call pill to bring the chat back.");break;case"expand":tr(!0),cn("Sure — expanding the view.");break;case"shrink":zt(null),tr(!1),cn("Okay — back to the smaller view.");break}},[ln,nr,cn,uu]);le(()=>{ye.current=$1},[$1]);const W1=X(!1);le(()=>{W1.current&&!u&&J.current&&(J.current=!1,nr()),W1.current=u},[u,nr]);const NO=Y(N=>{Fe.current=N,ks(N),sn.current?.selectDevice(N||void 0)},[]),BO=Y(()=>{!ta.current||on.current||(gt.current=!1,Rt.current=!1,w(),tt(),E.current=Date.now())},[w,tt]);le(()=>{sn.current?.setOutputActive(u),E.current=Date.now()},[u]),le(()=>{if(Ct!=="denied")return;const N=window.setTimeout(()=>nr(),3500);return()=>window.clearTimeout(N)},[nr,Ct]),le(()=>{if(!Qt)return;const N=window.setInterval(()=>{const $=sn.current;!$||on.current||ne.current||Ze.current||$.snapshot.mic==="hearing"||$.snapshot.processing||Date.now()-E.current<aO||(sn.current?.log.add("call-timeout"),Za(!0),window.setTimeout(()=>nr(),2400))},5e3);return()=>window.clearInterval(N)},[nr,Qt]);const zO=Qt&&!Cn&&(c||u);le(()=>()=>nr(),[nr]);const[FO,HO]=U(""),q1=X(!1);le(()=>{if(q1.current&&!c){const N=[...l].reverse().find($=>$.role==="assistant"&&!$.streaming&&!$.pending&&$.content);N&&HO(N.content)}q1.current=c},[c,l]),Mu(()=>{if(!i)return;const N=Le.current,$=Ar||Ja?N?.querySelector(".cf-confirm__card"):na?N?.querySelector(".cf-history"):null;if(!$)return;const fe=$.getRootNode(),Ke="activeElement"in fe?fe.activeElement:document.activeElement;(!Ke||!$.contains(Ke))&&$.querySelector('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])')?.focus()},[Ja,Ar,i,na]),le(()=>{if(!i)return;const N=Le.current,$=Ar||Ja?N?.querySelector(".cf-confirm__card"):na?N?.querySelector(".cf-history"):null,fe=N?.querySelectorAll(":scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat");fe?.forEach(je=>{$?(je.setAttribute("inert",""),je.setAttribute("aria-hidden","true")):(je.removeAttribute("inert"),je.removeAttribute("aria-hidden"))}),$||requestAnimationFrame(()=>N?.querySelector(".cf-textarea")?.focus());const Ke=je=>{if(je.key==="Escape"){je.preventDefault();const Ls=E1.current;if(Ls.confirmEnd){Dn(!1);return}if(Ls.confirmClear){Qa(!1);return}if(Ls.showHistory){ei(!1);return}ln();return}if(je.key!=="Tab"||!$)return;const Dr=$.querySelectorAll('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])'),ji=Array.from(Dr).filter(Ls=>!Ls.hasAttribute("disabled"));if(ji.length===0)return;const un=ji[0],K1=ji[ji.length-1],j1=$.getRootNode()instanceof ShadowRoot?$.getRootNode().activeElement:document.activeElement;je.shiftKey&&j1===un?(je.preventDefault(),K1.focus()):!je.shiftKey&&j1===K1&&(je.preventDefault(),un.focus())};return N?.addEventListener("keydown",Ke),()=>{N?.removeEventListener("keydown",Ke),fe?.forEach(je=>{je.removeAttribute("inert"),je.removeAttribute("aria-hidden")})}},[i,ln,Ar,Ja,na]),le(()=>{const N=Le.current;N&&(i?N.removeAttribute("inert"):N.setAttribute("inert",""))},[i]);const fu=e.accentColor??e.themeTokens?.accent??s?.accentColor,Y1=e.themeTokens?.accentText??rO(fu,e.themeTokens?.background??(ja==="dark"?"#0f1c27":"#ffffff")),VO={zIndex:e.zIndex,"--cf-h-pad":`${e.horizontalPadding}px`,"--cf-v-pad":`${e.verticalPadding}px`,...Y1?{"--cf-accent-ink":Y1}:{},...e.themeTokens?.accentStrong?{"--cf-accent-2":e.themeTokens.accentStrong}:{},...e.themeTokens?.background?{"--cf-bg":e.themeTokens.background}:{},...e.themeTokens?.surface?{"--cf-surface":e.themeTokens.surface}:{},...e.themeTokens?.surfaceMuted?{"--cf-surface-2":e.themeTokens.surfaceMuted}:{},...e.themeTokens?.text?{"--cf-text":e.themeTokens.text}:{},...e.themeTokens?.mutedText?{"--cf-muted":e.themeTokens.mutedText}:{},...e.themeTokens?.border?{"--cf-border":e.themeTokens.border}:{},...e.themeTokens?.shadow?{"--cf-shadow":e.themeTokens.shadow}:{},...e.themeTokens?.radius?{"--cf-radius":e.themeTokens.radius}:{},...e.themeTokens?.fontFamily?{"--cf-font":e.themeTokens.fontFamily}:{},...e.themeTokens?.success?{"--cf-success":e.themeTokens.success}:{},...e.themeTokens?.warning?{"--cf-warning":e.themeTokens.warning}:{},...e.themeTokens?.danger?{"--cf-danger":e.themeTokens.danger}:{},...fu?{"--cf-accent":fu,"--cf-accent-2":e.themeTokens?.accentStrong??`color-mix(in oklab, ${fu} 76%, #14141f)`}:{}},UO=N=>y(N),GO=[...l].reverse().find(N=>N.role==="user"&&N.content.trim())?.content??"",du=l.some(N=>N.role==="user"),X1=!!(s?.allowVoiceInput&&s?.talkbackMode&&s.talkbackMode!=="text"),Z1=X1,Is=!ut&&Z1&&!du?Op.filter((N,$)=>!($===0&&N.role==="assistant")):Op,$O=d==="human"&&p?p:s?.agentName??a.chatName,WO=d==="human"?a.liveSupport:d==="queued"?a.waitingForTeam:s?.offline?a.statusOffline:a.statusOnline,Np=!be&&!ut?s?.availableActions:void 0,qO=!be&&!ut?s?.actions:void 0,Bp=Qt&&!Zi&&Ct==="connecting"&&!ut;return _(o5,{value:a,children:_("div",{class:"cf-root","data-theme":ja,"data-align":e.alignment,"data-display":"floating",style:VO,children:[er&&i&&_("div",{class:"cf-theater-backdrop",onClick:EO}),_("div",{ref:Le,class:`cf-panel ${i?"is-open":""} ${Qt?"cf-panel--call":""} ${Bp?"cf-panel--voice-connecting":""} ${er&&i?"cf-panel--theater":""} ${Cs?"cf-panel--analytics-focus":""}`,role:"dialog","aria-modal":"false","aria-label":`${a.chatName}: ${s?.agentName??a.assistantName}`,"aria-hidden":!i,children:[Tt&&i&&_(PE,{state:Tt,onClose:ue}),_("div",{class:"cf-header",children:[_(o1,{persona:s,hideWhenMissing:!0}),_("div",{class:"cf-header__meta",children:[_("div",{class:"cf-header__name",children:$O}),_("div",{class:`cf-header__status ${d==="ai"&&s?.offline?"cf-header__status--offline":""}`,children:_("span",{class:"cf-header__status-text",children:WO})})]}),_("div",{class:"cf-header__actions",children:[ze.length>0&&_("button",{type:"button",class:"cf-header__btn","aria-label":a.pastConversations,title:a.pastConversations,"aria-pressed":na,onClick:()=>ei(N=>!N),children:_(T5,{})}),du&&!be&&!ut&&_("button",{type:"button",class:"cf-header__btn","aria-label":a.endChat,title:a.endChat,onClick:MO,children:_(kp,{})}),e.sound&&te&&_("button",{type:"button",class:"cf-header__btn","aria-label":An?a.unmuteSounds:a.muteSounds,"aria-pressed":An,onClick:Se,children:An?_(x5,{}):_(b5,{})}),_("button",{type:"button",class:"cf-header__btn cf-header__close","aria-label":a.closeChat,onClick:ln,children:_(Ya,{})})]})]}),_("div",{class:"cf-panel__video",children:Cs?_("div",{class:"cf-analytics-focus",role:"region","aria-label":a.expandedAnalyticsResult,children:_(h1,{visualization:Cs,expanded:!0,onClose:RO})}):!ut&&Z1?_(Y5,{persona:s,starters:[],onPick:y,onFocusComposer:OO,speaking:u,voiceState:Ct,replyPending:Qt&&c&&!u,pinned:!0,muted:Cn,onToggleMute:uu,onEndCall:nr,onTalkNow:BO,showTalkNow:zO,micLevel:an,theaterMode:er,onToggleTheater:LO,onMinimize:ln,audioDevices:xs,selectedAudioDeviceId:Ss,onSelectAudioDevice:NO,connectingOnly:Bp}):null}),!Bp&&_("div",{class:"cf-panel__chat",children:[e.preview&&_("div",{class:"cf-preview-banner",children:a.previewBanner}),ut&&_("div",{class:"cf-viewing-banner",children:a.viewingPast}),_("div",{class:"cf-body",ref:Ae,role:"log",onScroll:IO,children:[Is.map((N,$)=>_(hE,{msg:N,persona:s,isLast:!ut&&$===Is.length-1,visitor:f,hasEmail:h,lastQuestion:GO,showActions:!ut&&$===Is.length-1&&!!(N.handoffOffered||N.selectedAction),onPickReply:UO,onSubmitForm:P,onDemoSlots:ge,onConfirmHostedBooking:V,onRetry:M,ratable:!ut&&Is.slice(0,$).some(fe=>fe.role==="user"),onRate:T,onExpandVisualization:ut?void 0:PO,onOpenAttachment:tn,onReconnect:!ut&&!be&&De&&N.id===Cr?L:void 0},N.id)),!du&&!ut&&_(Me,{children:[Is.length===0&&_(tO,{name:s?.agentName??a.assistantName,greeting:s?.greeting}),_(uE,{items:g,onPick:y}),_(fE,{items:v})]}),st&&_("button",{type:"button",class:"cf-newmsg",onClick:aa,children:[_(D5,{}),a.newMessages]})]}),_("div",{class:"cf-sr-live","aria-live":"polite","aria-atomic":"true",children:FO}),c&&!be&&!ut&&_("div",{class:"cf-stopbar",children:_("button",{type:"button",class:"cf-stop",onClick:w,children:[_(k5,{}),a.stop]})}),ut?_("div",{class:"cf-ended",children:_("button",{type:"button",class:"cf-ended__btn",onClick:Xe,children:a.backToChat})}):be?_("div",{class:"cf-ended",children:[_("p",{class:"cf-ended__text",children:a.conversationEnded}),e.csat&&du?CO?_("p",{class:"cf-ended__text",children:a.feedbackThanks}):_("div",{class:"cf-csat",children:[_("span",{class:"cf-csat__q",children:a.csatPrompt}),_("button",{type:"button",class:"cf-csat__btn","aria-label":a.feedbackHelpful,onClick:()=>{j("up"),O1(!0)},children:_(t1,{})}),_("button",{type:"button",class:"cf-csat__btn","aria-label":a.feedbackNotHelpful,onClick:()=>{j("down"),O1(!0)},children:_(r1,{})})]}):null,_("button",{type:"button",class:"cf-ended__btn",onClick:DO,children:a.startNewChat})]}):_(Me,{children:[m?_("div",{class:"cf-live-typing","aria-live":"polite",children:ct(a.agentTyping,{name:m})}):null,Np&&Np.length>0&&_("div",{class:"cf-footer-actions",children:_(f1,{actions:Np,descriptors:qO,visitor:f,onSubmitForm:P,onDemoSlots:ge,onConfirmHostedBooking:V,scheduler:s?.scheduler,translations:e.actionTranslations})},"footer-actions"),_(kE,{draftStore:TO,onSend:y,onSendGif:b,onTyping:x,disabled:c,allowVoice:X1,onTranscribe:H,gifEnabled:xe,onSearchGifs:Te,allowAttach:e.attachments,analyzeAttachments:!0,onUpload:Z,onPreviewAttachment:F},"composer")]}),!be&&s?.disclaimerText&&_("div",{class:"cf-disclaimer",children:s.disclaimerText}),_("div",{class:"cf-footer",children:[_("button",{type:"button",class:"cf-footer__privacy","aria-label":a.clearDeviceData,onClick:()=>Qa(!0),children:a.privacyAndData}),_("span",{"aria-hidden":"true",children:"·"}),a.poweredBy," ",_("a",{href:"https://accurix.tech/centrinfo",target:"_blank",rel:"noopener noreferrer",children:"Centrinfo"})]})]}),Ar&&_("div",{class:"cf-confirm",onClick:()=>Dn(!1),children:_("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":a.endChatConfirm,onClick:N=>N.stopPropagation(),onKeyDownCapture:N=>Rp(N,N.currentTarget,()=>Dn(!1)),children:[_("div",{class:"cf-confirm__title",children:a.endChatConfirm}),_("div",{class:"cf-confirm__body",children:a.endChatConfirmBody}),_("div",{class:"cf-confirm__actions",children:[_("button",{ref:R1,type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>Dn(!1),children:a.cancel}),_("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:AO,children:a.endConfirmCta})]})]})},"confirm-end"),na&&_("div",{class:"cf-confirm",onClick:()=>ei(!1),children:_("div",{class:"cf-history",role:"dialog","aria-modal":"true","aria-label":a.pastConversations,onClick:N=>N.stopPropagation(),onKeyDownCapture:N=>Rp(N,N.currentTarget,()=>ei(!1)),children:[_("div",{class:"cf-history__head",children:[_("span",{children:a.pastConversations}),_("button",{type:"button",class:"cf-header__btn","aria-label":a.closeHistory,onClick:()=>ei(!1),children:_(Ya,{})})]}),_("div",{class:"cf-history__list",children:ze.map(N=>_("button",{type:"button",class:`cf-history__item ${N.sessionId===oe?"is-active":""}`,onClick:()=>{ot(N.sessionId),ei(!1)},children:[_("span",{class:"cf-history__title",children:N.title}),_("span",{class:"cf-history__meta",children:[new Date(N.ts).toLocaleDateString(void 0,{month:"short",day:"numeric"}),N.ended?` · ${a.historyEnded}`:""]})]},N.sessionId))}),_("div",{class:"cf-history__footer",children:_("button",{type:"button",class:"cf-history__clear",onClick:()=>{ei(!1),Qa(!0)},children:a.clearDeviceData})})]})},"history"),Ja&&_("div",{class:"cf-confirm",onClick:()=>Qa(!1),children:_("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":a.clearDeviceData,onClick:N=>N.stopPropagation(),onKeyDownCapture:N=>Rp(N,N.currentTarget,()=>Qa(!1)),children:[_("div",{class:"cf-confirm__title",children:a.clearDeviceData}),_("div",{class:"cf-confirm__body",children:a.clearDeviceDataBody}),_("div",{class:"cf-confirm__actions",children:[_("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>Qa(!1),children:a.cancel}),_("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:()=>{Qa(!1),kt()},children:a.clearDeviceDataCta})]})]})},"confirm-clear")]}),Qt&&!i?_(wE,{persona:s,voiceState:Ct,muted:Cn,onToggleMute:uu,onEndCall:nr,micLevel:an,onExpand:Ki}):er&&i?null:!e.hideDefaultLauncher&&_("button",{ref:ve,type:"button",class:"cf-launcher","aria-label":i?a.closeChat:we>0?`${a.openChat}. ${we===1?a.unreadMessage:ct(a.unreadMessages,{count:String(we)})}`:a.openChat,"aria-expanded":i,onClick:Ms,children:[e.launcherIcon?_("img",{class:"cf-launcher__img",src:e.launcherIcon,alt:""}):_(u5,{}),!i&&we>0&&_("span",{class:"cf-launcher__badge","aria-hidden":"true",children:we>99?"99+":we})]})]})})},hO="https://api.accurixtech.com",pO=()=>typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en",vO=(t,e)=>{if(!t)return;const r=e.trim().toLowerCase(),n=r.split("-")[0]??r,a=Object.entries(t);return a.find(([i])=>i.toLowerCase()===r)?.[1]??a.find(([i])=>i.toLowerCase()===n)?.[1]},gO=t=>{if(!t||typeof t.token!="string"||t.token.length===0)throw new Error("[centrinfo-widget] `token` is required — pass your pub_* token to Centrinfo.init({ token }).");const e=t.locale?.trim()||pO(),r=vO(t.translations,e);return{token:t.token,chatSurface:t.chatSurface??"floating",analyticsContextToken:t.analyticsContextToken,identityToken:t.identityToken,getIdentityToken:t.getIdentityToken,apiBaseUrl:(t.apiBaseUrl??hO).replace(/\/$/,""),accentColor:t.accentColor,themeTokens:t.themeTokens,agentName:t.agentName?.trim()||void 0,agentAvatarUrl:t.agentAvatarUrl?.trim()||void 0,launcherIcon:t.launcherIcon,gifApiKey:t.gifApiKey,theme:t.theme??"auto",openByDefault:t.openByDefault??!1,sound:t.sound??!0,starters:t.starters??[],strings:i5({...r?.labels,...t.labels}),locale:e,actionTranslations:r?.actions??{},persistence:t.persistence??"local",attachments:t.attachments??!0,zIndex:t.zIndex??2147483e3,styleNonce:t.styleNonce?.trim()??"",demo:t.demo??!1,preview:t.preview??!1,alignment:t.alignment==="left"?"left":"right",horizontalPadding:typeof t.horizontalPadding=="number"?t.horizontalPadding:20,verticalPadding:typeof t.verticalPadding=="number"?t.verticalPadding:20,hideDefaultLauncher:t.hideDefaultLauncher??!1,customLauncherSelector:t.customLauncherSelector,sessionDurationMinutes:typeof t.sessionDurationMinutes=="number"?t.sessionDurationMinutes:0,configRefreshSeconds:typeof t.configRefreshSeconds=="number"?t.configRefreshSeconds:30,proactiveMessage:t.proactiveMessage,proactiveDelaySeconds:typeof t.proactiveDelaySeconds=="number"?t.proactiveDelaySeconds:5,proactiveOnPaths:t.proactiveOnPaths,csat:t.csat??!0,user:t.user,onOpen:t.onOpen,onClose:t.onClose,onShow:t.onShow,onHide:t.onHide,onUnreadChange:t.onUnreadChange,onMessage:t.onMessage,onAction:t.onAction,onHandoff:t.onHandoff}},D1=`
|
|
170
|
+
`).replace(/[ \t]{2,}/g," ").trim(),xu=(e,t)=>ko(Bc(e,t)),yu=45e3,_r=e=>e.type==="visualization",_u=e=>{const t=!!e.visualization,n=(e.artifacts??[]).some(_r);if(!t&&!n)return e;const{visualization:a,artifacts:i,...o}=e,s=(i??[]).filter(d=>!_r(d)),c=a?.title??(i??[]).find(_r)?.visualization?.title??e.resultExpired?.title;return{...o,...s.length>0?{artifacts:s}:{},resultExpired:c?{title:c}:{}}},wr=e=>e.map(_u),wu=(e,t=Date.now())=>{const n=e.visualization?.explanation?.aiExplanation;if(!e.visualization?.explanation||!n||n.status!=="pending")return e;const a=e.createdAt?Date.parse(e.createdAt):NaN;return Number.isFinite(a)&&t-a<yu?e:{...e,visualization:{...e.visualization,explanation:{...e.visualization.explanation,aiExplanation:{...n,status:"failed",retryAvailable:!1}}}}},ku=e=>e instanceof DOMException&&(e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED"),Su=(e,t,n,a)=>{let i=a;for(let o=0;o<4&&i.length>0;o+=1)try{return e.setItem(t,n(i)),!0}catch(s){if(!ku(s))return!1;i=i.slice(Math.ceil(i.length/2))}try{e.removeItem(t)}catch{}return!1},$u=(e,t)=>{if(e)try{const n=[];for(let a=0;a<e.length;a+=1){const i=e.key(a);i?.startsWith(t)&&n.push(i)}for(const a of n){const i=e.getItem(a);if(!i)continue;const o=JSON.parse(i);if(!Array.isArray(o.messages))continue;const s=wr(o.messages);s.some((c,d)=>c!==o.messages[d])&&e.setItem(a,JSON.stringify({...o,messages:s}))}}catch{}},Tu=(e,t=()=>Date.now())=>{let n=null,a=null,i=Number.NEGATIVE_INFINITY;const o=()=>{a!==null&&(clearTimeout(a),a=null);const s=n;n=null,s&&(i=t(),s())};return{schedule:s=>{if(n=s,a!==null)return;const c=e-(t()-i);c<=0?o():a=setTimeout(o,c)},flush:o,cancel:()=>{a!==null&&clearTimeout(a),a=null,n=null}}},lt=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,ka=(e,t)=>{typeof console>"u"||console.warn(`[centrinfo-widget] ${e}`,t??{})},So=(e,t,n,a,i=1,o,s=!1,c,d)=>{e.current?.pause(),e.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),t.current=null;const l=()=>{const h=o?.trim();if(!s||!h||typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return!1;const I=new SpeechSynthesisUtterance(h);let x=!1;const g=()=>{x||(x=!0,t.current===I&&(t.current=null,d?.()))};return I.rate=i,I.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",I.onend=g,I.onerror=g,t.current=I,c?.(),window.speechSynthesis.cancel(),window.speechSynthesis.speak(I),!0};if(!n||typeof Audio>"u")return l();const u=new Audio(`data:${a||"audio/mpeg"};base64,${n}`);let p=!1,m=!1;const f=()=>{p||(p=!0,e.current===u&&(e.current=null,d?.()))},_=()=>{if(!p){if(m||e.current!==u){f();return}p=!0,e.current=null,l()||d?.()}};return u.playbackRate=i,u.onended=f,u.onerror=_,e.current=u,u.play().then(()=>{if(!p){if(e.current!==u){f();return}m=!0,c?.(Number.isFinite(u.duration)?u.duration*1e3:void 0)}}).catch(_),!0},Cu=e=>{try{return e==="none"?null:e==="session"?sessionStorage:localStorage}catch{return null}},Au=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)},Mu=e=>{try{const t=e?.split(".")[1];if(!t)return;const n=t.replace(/-/g,"+").replace(/_/g,"/"),a=JSON.parse(atob(n.padEnd(Math.ceil(n.length/4)*4,"=")));for(const i of["sub","external_user_id","user_id"]){const o=a[i];if(typeof o=="string"&&o.trim())return o.trim()}}catch{}},Iu=e=>{const t=e.user?.externalId?.trim()||e.user?.userId?.trim()||e.user?.email?.trim().toLowerCase()||Mu(e.identityToken)||(e.identityToken||e.getIdentityToken?"authenticated":"anonymous");return`${e.token.slice(0,12)}:${e.chatSurface}:${Au(t)}`},Un=e=>`${e.chatSurface}:${lt()}`,Eu=e=>e.slice(0,12),Bn=e=>`centrinfo:session:${e}`,kr=e=>`centrinfo:visitor:${e}`,Sa=(e,t)=>`centrinfo:chat:${e}:${t}`,Sr=e=>`centrinfo:history:${e}`,zu=1e3,$o=20,$r=720*60*60*1e3,Nu=1440*60*1e3,Ru=(e,t)=>{try{return JSON.parse(e?.getItem(kr(t))||"{}")}catch{return{}}},Lu=(e,t,n)=>{if(!e)return Un(n);try{const a=Bn(t),i=e.getItem(a);if(i)return i;const o=Un(n);return e.setItem(a,o),o}catch{return Un(n)}},To=(e,t,n)=>{if(!e)return{};try{const a=e.getItem(Sa(t,n));return a?JSON.parse(a):{}}catch{return{}}},Co=(e,t,n)=>{const{ts:a,expiresAt:i,messages:o}=To(e,t,n);return Array.isArray(o)?typeof i=="number"&&Date.now()>i?[]:typeof a=="number"&&Date.now()-a>$r?[]:wr(o):[]},Du=(e,t,n)=>{const{ts:a,expiresAt:i,messages:o,ended:s}=To(e,t,n);return!Array.isArray(o)||o.length===0||typeof i=="number"&&Date.now()>i||typeof a=="number"&&Date.now()-a>$r?!1:s===!0||typeof a=="number"&&Date.now()-a>Nu},Pu=e=>Number.isFinite(e??NaN)?Math.max(5,Math.min(200,Math.round(e))):50,Ou=e=>Number.isFinite(e??NaN)?Math.max(1,Math.min(365,Math.round(e)))*24*60*60*1e3:$r,Ao=(e,t,n,a,i,o,s,c)=>{if(e)try{if(!o){e.removeItem(Sa(t,n));return}const d=a.filter(u=>!u.pending).slice(-s);if(d.length===0)return;const l=Date.now();Su(e,Sa(t,n),u=>JSON.stringify({ts:l,expiresAt:l+c,messages:wr(u),ended:i}),d)}catch{}},Fu=(e,t)=>{if(!e)return[];try{const n=e.getItem(Sr(t)),a=n?JSON.parse(n):[];return Array.isArray(a)?a:[]}catch{return[]}},$a=(e,t,n)=>{if(e)try{e.setItem(Sr(t),JSON.stringify(n.slice(0,$o)))}catch{}},Mo=(e,t)=>{if(e)try{const n=`centrinfo:chat:${t}:`,a=new Set([Bn(t),kr(t),Sr(t)]),i=[];for(let o=0;o<e.length;o++){const s=e.key(o);s&&(a.has(s)||s.startsWith(n))&&i.push(s)}i.forEach(o=>e.removeItem(o))}catch{}},Uu=e=>{const a=(e.find(i=>i.role==="user"&&i.content.trim())?.content||e.find(i=>i.content.trim())?.content||"").trim().replace(/\s+/g," ");return a.length>60?a.slice(0,60)+"…":a||"Conversation"},Bu=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,offerReconnect:e.type==="ai_handback"&&e.reconnectOffered===!0}),Io=e=>(e??[]).find(t=>t.category==="support"&&t.enabled&&t.readiness!=="unavailable"&&(t.liveHandoff??t.id==="public_contact_support")),qu=(e,t)=>{if(t==="ai")for(let n=e.length-1;n>=0;n--){const a=e[n];if(a){if(a.reconnectOffer)return;if(a.liveEventType==="ai_handback")return a.offerReconnect?a.id:void 0}}},Vu=(e,t,n=!0)=>{const a=R(Cu(t.persistence)).current,i=Iu(t),o=R(Lu(a,i,t)),s=R(null),c=R(null),d=R(null),l=R(null),u=R(null),p=R(null),m=R(new Map),f=R(!1),_=R(void 0),h=R(null),I=R({}),x=R({}),[g,T]=$(null),[V,P]=$(()=>Co(a,i,o.current)),ee=R(null);ee.current||(ee.current=Tu(zu));const Z=R(V.length>0),Y=R(V.some(b=>b.role==="user")),[z,te]=$(!1),[U,B]=$(!1),[A,N]=$({status:"idle"}),y=R({}),[D,S]=$(()=>Du(a,i,o.current)),[O,ue]=$(()=>Ru(a,i)),[oe,Fe]=$(()=>Fu(a,i)),[_e,Te]=$(null),[Le,Ie]=$([]),[Ce,ve]=$("ai"),[Xe,ge]=$(void 0),[ie,He]=$(void 0),We=R(new Date().toISOString()),k=R(void 0),K=R(!1),j=R(0),G=R(O);X(()=>{G.current=O},[O]);const ne=g?.memoryEnabled!==!1,ye=Pu(g?.memoryMessageCap),Se=Ou(g?.memoryRetentionDays),et=F(()=>{s.current?.abort(),ee.current?.cancel(),Mo(a,i),Mo(a,Eu(t.token));const b=Un(t);o.current=b;try{a?.setItem(Bn(i),b)}catch{}Te(null),Ie([]),S(!1),Fe([]),ue({}),ve("ai"),ge(void 0),He(void 0),We.current=new Date().toISOString(),P(g?[{id:lt(),role:"assistant",content:g.greeting,availableActions:g.availableActions,actions:g.actions}]:[])},[a,i,t.token,g]),Ye=F(b=>{try{a?.setItem(kr(i),JSON.stringify(b))}catch{}},[a,i]),tt=F(b=>{const w=(b.email??"").trim().toLowerCase(),E=(G.current.email??"").trim().toLowerCase();w&&E&&w!==E&&et();const C={};b.email?.trim()&&(C.email=b.email.trim()),b.phone?.trim()&&(C.phone=b.phone.trim());const J=[b.firstName,b.lastName].filter(me=>!!me?.trim()).join(" ").trim()||b.name?.trim()||"";J&&(C.name=J),Object.keys(C).length>0&&ue(me=>{const ae={...C,...me};return Ye(ae),ae}),e.identify(o.current,b).catch(()=>{})},[e,Ye,et]),at=R(0),M=F(b=>{at.current=Date.now(),T(b),P(w=>{if(w.length===0)return[{id:lt(),role:"assistant",content:b.greeting,availableActions:b.availableActions,actions:b.actions}];const E=w.some(H=>H.role==="user"),C=w[0];return!E&&C?.role==="assistant"?[{...C,content:b.greeting,availableActions:b.availableActions,actions:b.actions},...w.slice(1)]:w})},[]);X(()=>{if(g?.memoryEnabled===!1){ee.current?.cancel();try{a?.removeItem(Sa(i,o.current))}catch{}$a(a,i,[]),Fe([]),Te(null),Ie([]),P(b=>Z.current?(Z.current=!1,g?[{id:lt(),role:"assistant",content:g.greeting,availableActions:g.availableActions,actions:g.actions}]:[]):b)}},[g,a,i]);const pe=F(async()=>{const b=await e.bootstrap();M(b)},[M,e]);X(()=>{let b=!0;const w=E=>E.messages.map(C=>wu({id:C.id,role:C.role,content:C.content,authorName:C.authorName,liveEventType:C.messageType,offerReconnect:C.messageType==="ai_handback"&&C.reconnectOffered===!0,sources:C.sources,visualization:C.visualization,artifacts:C.artifacts,createdAt:C.createdAt}));return e.history().then(E=>{if(!b||E.conversations.length===0)return;const C=E.conversations.map(ae=>({sessionId:ae.sessionId,ts:Date.parse(ae.lastSeenAt)||Date.now(),title:ae.title,ended:ae.ended}));for(const ae of E.conversations)Ao(a,i,ae.sessionId,w(ae),ae.ended,!0,ye,Se);$a(a,i,C),Fe(C);const H=E.conversations.find(ae=>ae.sessionId===E.activeSessionId);if(!H||Y.current)return;const J=w(H);o.current=H.sessionId,Z.current=J.length>0;try{a?.setItem(Bn(i),H.sessionId)}catch{}const me=J[J.length-1]?.createdAt;me&&(We.current=me),S(H.ended),P(J)}).catch(()=>{}),()=>{b=!1}},[ye,Se,i,a,e]),X(()=>{let b=!0;return at.current=Date.now(),e.bootstrap().then(w=>{b&&M(w)}),t.user&&tt(t.user),()=>{b=!1}},[M,e]),X(()=>{const b=t.configRefreshSeconds;if(!n||b<=0||typeof window>"u")return;let w=!0,E=!1;const C=Math.max(10,b)*1e3,H=()=>typeof document>"u"||document.visibilityState!=="hidden",J=async()=>{if(!(!w||E||!H())){E=!0;try{await pe()}catch{}finally{E=!1}}};Date.now()-at.current>=C&&J();const me=window.setInterval(J,C),ae=()=>{J()},xe=()=>{J()};return window.addEventListener("focus",ae),document?.addEventListener?.("visibilitychange",xe),()=>{w=!1,window.clearInterval(me),window.removeEventListener("focus",ae),document?.removeEventListener?.("visibilitychange",xe)}},[n,t.configRefreshSeconds,pe]),X(()=>{const b=o.current;ee.current.schedule(()=>Ao(a,i,b,V,D,ne,ye,Se))},[V,D,a,i,ne,ye,Se]),X(()=>{const b=ee.current,w=()=>{document.visibilityState==="hidden"&&b.flush()};return document.addEventListener("visibilitychange",w),window.addEventListener("pagehide",b.flush),()=>{document.removeEventListener("visibilitychange",w),window.removeEventListener("pagehide",b.flush),b.flush()}},[]),X(()=>{$u(a,"centrinfo:chat:")},[a]),X(()=>{if(!n||D||_e)return;const b=()=>{document.visibilityState==="visible"&&e.presence(o.current)};b();const w=window.setInterval(b,1e4);return document.addEventListener("visibilitychange",b),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",b)}},[n,D,e,_e]),X(()=>{if(!n||D||_e)return;let b=!0,w=!1,E=0,C;const H=()=>{C!==void 0&&window.clearTimeout(C),!(!b||document.hidden)&&(C=window.setTimeout(()=>{J()},Math.min(3e4,2200*2**E)))},J=async()=>{if(!(w||document.hidden||!b)){w=!0;try{const ae=await e.liveEvents(o.current,We.current);if(!b)return;if(E=0,ve(ae.mode),ge(ae.assignedAgentName||void 0),He(ae.agentTyping?ae.agentTypingName||ae.assignedAgentName||"Agent":void 0),ae.conversationEnded){S(!0),ve("ai"),ge(void 0),He(void 0),P(xe=>xe.some(re=>re.id==="live:conversation-ended")?xe:[...xe,{id:"live:conversation-ended",role:"system",content:t.strings.conversationEnded,liveEventType:"conversation_ended",createdAt:new Date().toISOString()}]);return}if(ae.events.length>0){let xe=We.current,re=Date.parse(xe);const ot=ae.events.map(Ue=>{const Ve=Date.parse(Ue.createdAt);return Number.isFinite(Ve)&&Ve>re&&(re=Ve,xe=Ue.createdAt),Bu(Ue)});We.current=xe,P(Ue=>{const Ve=new Set(Ue.map(nt=>nt.id)),Ze=ot.filter(nt=>!Ve.has(nt.id));return Ze.length>0?[...Ue,...Ze]:Ue}),ot.some(Ue=>Ue.role==="assistant")&&gn("receive")}}catch{E=Math.min(E+1,4)}finally{w=!1,H()}}},me=()=>{document.hidden?C!==void 0&&window.clearTimeout(C):J()};return document.addEventListener("visibilitychange",me),document.hidden||J(),()=>{b=!1,C!==void 0&&window.clearTimeout(C),document.removeEventListener("visibilitychange",me)}},[n,t.strings.conversationEnded,e,D,_e]),X(()=>{if(!ne){$a(a,i,[]),Fe(w=>w.length>0?[]:w);return}V.some(w=>w.role==="user")&&Fe(w=>{const E=o.current,H=[{sessionId:E,ts:Date.now(),title:Uu(V),ended:D},...w.filter(J=>J.sessionId!==E)];return $a(a,i,H),H.slice(0,$o)})},[V,D,a,i,ne]);const de=F((b,w)=>{P(E=>E.map(C=>C.id===b?{...C,...w}:C))},[]),fe=F(()=>{_.current!==void 0&&typeof window<"u"&&window.clearInterval(_.current),_.current=void 0},[]),Oe=F((b,w)=>{fe(),delete I.current[b],h.current===b&&(h.current=null),de(b,{content:w,pending:!1,streaming:!1})},[fe,de]),Ge=F((b,w,E)=>{const C=w.trim();if(!C||typeof window>"u"){Oe(b,C);return}fe(),h.current=b;const H=C.match(/\S+\s*/g)??[C],J=E&&E>0?E:H.length*95,me=Math.max(28,Math.min(150,J/Math.max(H.length,1)));let ae=0;de(b,{content:"",pending:!1,streaming:!0}),_.current=window.setInterval(()=>{ae+=1;const xe=H.slice(0,ae).join("");de(b,{content:xe,pending:!1,streaming:ae<H.length}),ae>=H.length&&(fe(),delete I.current[b],h.current===b&&(h.current=null),de(b,{content:C,pending:!1,streaming:!1}))},me)},[fe,Oe,de]),ht=F(()=>{const b=h.current;fe(),h.current=null;const w=I.current;I.current={};for(const[E,C]of Object.entries(w))de(E,{content:C,pending:!1,streaming:!1});b&&!(b in w)&&de(b,{pending:!1,streaming:!1})},[fe,de]),pt=F(b=>{if(D||_e||Ce==="ai"||typeof window>"u")return;if(k.current!==void 0&&window.clearTimeout(k.current),!b){if(!K.current)return;K.current=!1,j.current=0,e.typing(o.current,!1).catch(()=>{});return}const w=Date.now();(!K.current||w-j.current>2500)&&(K.current=!0,j.current=w,e.typing(o.current,!0).catch(()=>{})),k.current=window.setTimeout(()=>{K.current&&(K.current=!1,j.current=0,e.typing(o.current,!1).catch(()=>{}))},1600)},[e,D,_e,Ce]);X(()=>()=>{k.current!==void 0&&typeof window<"u"&&window.clearTimeout(k.current)},[]),X(()=>()=>fe(),[fe]);const yt=F((b,w,E={})=>{ht(),te(!0);const C=yr();let H=!1;const J=new AbortController;s.current=J;const me=!!(g?.allowVoiceInput&&g?.voiceOutputEnabled&&g.talkbackMode!=="text"),ae=!!E.forceVoicePlayback,xe=W=>{ae&&N(Ae=>Ae.agentId===w?{status:W,agentId:w}:Ae)};ae&&N({status:"answering",agentId:w});const re={pending:new Map,nextSeq:0,highestSeq:-1,playing:!1,ended:!1,started:!1,stopped:!1,utterance:null},ot=()=>{p.current===Mt&&(p.current=null),re.started&&(re.started=!1,B(!1),xe("done"))},Ue=()=>{re.stopped||re.started||(re.started=!0,wa("voice-first-audio",C),B(!0),xe("speaking"))},Ve=()=>typeof window<"u"&&"speechSynthesis"in window&&typeof SpeechSynthesisUtterance<"u",Ze=()=>{l.current&&re.playing&&(l.current.pause(),l.current=null),re.utterance&&(u.current===re.utterance&&(u.current=null),re.utterance=null,Ve()&&window.speechSynthesis.cancel()),re.playing=!1},nt=(W,Ae)=>{const Ee=W?.trim();if(!Ee||!Ve())return!1;const ke=new SpeechSynthesisUtterance(Ee);return ke.rate=g?.voiceSpeed??1,ke.lang=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en-US",ke.onstart=Ue,ke.onend=Ae,ke.onerror=Ae,re.utterance=ke,u.current=ke,window.speechSynthesis.speak(ke),f.current&&window.speechSynthesis.pause(),!0},ft=()=>{for(;!re.stopped&&!re.playing;){let W=re.pending.get(re.nextSeq);if(!W&&re.ended&&re.pending.size>0&&(re.nextSeq=Math.min(...re.pending.keys()),W=re.pending.get(re.nextSeq)),!W){re.ended&&ot();return}if(re.pending.delete(re.nextSeq),re.nextSeq+=1,De(W))return}},De=W=>{let Ae=!1;const Ee=()=>{Ae||(Ae=!0,u.current===re.utterance&&(u.current=null),re.utterance=null,re.playing=!1,ft())};if(!W.audioBase64||typeof Audio>"u")return re.playing=nt(W.text,Ee),re.playing;const ke=new Audio(`data:${W.mimeType||"audio/mpeg"};base64,${W.audioBase64}`);ke.playbackRate=g?.voiceSpeed??1,ke.volume=f.current?.2:1,re.playing=!0,l.current=ke;let Ke=!1,Bt=!1;const It=()=>{Ae||Bt||(Bt=!0,l.current===ke&&(l.current=null),!(!Ke&&!re.stopped&&nt(W.text,Ee))&&Ee())};return ke.onended=()=>{l.current===ke&&(l.current=null),Ee()},ke.onerror=It,ke.play().then(()=>{Ke=!0,Ue()}).catch(It),!0},Mt=()=>{re.stopped=!0,re.pending.clear(),Ze(),ot()};e.stream(b,o.current,{voicePlaybackRequested:!!E.forceVoicePlayback,clientMessageId:E.clientMessageId,attachmentId:E.attachmentId,attachmentIds:E.attachmentIds,signal:J.signal,onChunk:W=>{W&&!H&&(H=!0,wa("data-first-chunk",C)),E.forceVoicePlayback&&W&&(x.current[w]=!0),P(Ae=>Ae.map(Ee=>Ee.id===w?{...Ee,content:Ee.content+W,pending:!1,streaming:!0}:Ee))},onTextReady:()=>{P(W=>W.map(Ae=>Ae.id===w?{...Ae,pending:!1,streaming:!1}:Ae))},onReset:()=>{P(W=>W.map(Ae=>Ae.id===w?{...Ae,content:"",pending:!0,streaming:!1}:Ae)),re.pending.clear(),re.nextSeq=re.highestSeq+1,Ze()},onAudioSegment:W=>{!ae||re.stopped||W.seq<re.nextSeq||re.pending.has(W.seq)||(p.current=Mt,re.highestSeq=Math.max(re.highestSeq,W.seq),re.pending.set(W.seq,W),ft())}}).then(W=>{if(n&&!W.conversationEnded&&typeof document<"u"&&document.visibilityState==="visible"&&e.presence(o.current),W.liveMode&&(ve(W.liveMode),ge(W.assignedAgentName||void 0)),W.liveMode&&W.liveMode!=="ai"&&!W.answer.trim()){P(ke=>ke.filter(Ke=>Ke.id!==w)),xe("done");return}const Ae=!!x.current[w];delete x.current[w];const Ee=!!(E.forceVoicePlayback&&me&&!W.liveAudio&&W.audioBase64&&W.answer.trim()&&!Ae);if(Ee&&(I.current[w]=W.answer),P(ke=>ke.map(Ke=>Ke.id===w?{...Ke,content:Ee?"":W.answer||Ke.content||t.strings.emptyReply,pending:!1,streaming:Ee,error:!1,retryText:void 0,sources:W.sources,suggestedReplies:W.suggestedReplies,availableActions:W.availableActions,actions:W.actions,selectedAction:W.selectedAction,handoffOffered:W.handoffOffered,requestedContactFields:W.requestedContactFields,visualization:W.visualization,artifacts:W.artifacts}:Ke)),gn("receive"),W.liveAudio?(re.ended=!0,ft()):E.forceVoicePlayback&&!W.audioBase64&&ka(me?"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:g?.voiceOutputEnabled,talkbackMode:g?.talkbackMode,voiceProvider:g?.voiceProvider,hasAudioBase64:!!W.audioBase64}),E.forceVoicePlayback&&!W.liveAudio){const ke=So(l,u,W.audioBase64,W.mimeType,g?.voiceSpeed??1,xu(W.answer,W.visualization),!0,Ke=>{B(!0),xe("speaking"),Ee&&Ge(w,W.answer,Ke)},()=>{B(!1),xe("done"),Ee&&Oe(w,W.answer)});ke||xe("done"),Ee&&!ke&&Oe(w,W.answer)}W.answer&&t.onMessage?.({role:"assistant",content:W.answer}),W.handoffOffered&&t.onHandoff?.(),W.conversationEnded&&S(!0)}).catch(W=>{if(J.signal.aborted){re.stopped||Mt(),delete x.current[w],P(Ee=>Ee.flatMap(ke=>ke.id!==w?[ke]:ke.content.trim()?[{...ke,pending:!1,streaming:!1}]:[])),xe("done");return}xe("failed"),delete x.current[w];const Ae=gu(W,t.strings);de(w,{content:Ae,pending:!1,streaming:!1,error:!0,retryText:b})}).finally(()=>{wa("data-complete",C),delete x.current[w],s.current===J&&(te(!1),s.current=null,c.current?.agentId===w&&(c.current=null))})},[e,n,t,de,g?.allowVoiceInput,g?.talkbackMode,g?.voiceOutputEnabled,g?.voiceSpeed,ht]),Dt=F((b,w={})=>{const E=b.trim(),{imageUrl:C,attachmentName:H,attachmentText:J,attachmentId:me,attachmentFile:ae,forceVoicePlayback:xe,userMessageId:re}=w,ot=w.attachments??(H||me||J?[{id:me,name:H??"",text:J,file:ae}]:[]);if(!E&&!C&&ot.length===0||s.current&&!s.current.signal.aborted||D)return;Y.current=!0;let Ue=E;!Ue&&ot.length>0&&(Ue="Please look at the attached file."),!Ue&&C&&(Ue=C);const Ve=ot.map(De=>({id:De.id,name:De.name})),Ze=ot.flatMap(De=>De.id?[De.id]:[]),nt={id:re||lt(),role:"user",content:E,imageUrl:C,attachments:Ve.length>0?Ve:void 0};ot.forEach((De,Mt)=>{De.file&&(m.current.set(`${nt.id}:${Mt}`,De.file),De.id&&m.current.set(De.id,De.file))});const ft=lt();P(De=>[...!!(re&&De.some(Ae=>Ae.id===re))?De.map(Ae=>Ae.id===re?{...Ae,content:E,pending:!1,streaming:!1,imageUrl:C,attachments:nt.attachments}:Ae):[...De,nt],{id:ft,role:"assistant",content:"",pending:!0}]),gn("send"),t.onMessage?.({role:"user",content:Ue}),y.current[ft]=nt.id,c.current={userId:nt.id,agentId:ft,text:E,backendText:Ue},yt(Ue,ft,{forceVoicePlayback:xe,clientMessageId:nt.id,attachmentId:Ze[0],attachmentIds:Ze})},[D,t,yt]),_t=F((b,w,E,C,H)=>{const J=lt();P(me=>[...me.filter(ae=>ae.id!==b.agentId&&(!C.userMessageId||ae.id!==C.userMessageId)).map(ae=>ae.id===b.userId?{...ae,content:w,pending:!1,streaming:!1}:ae),{id:J,role:"assistant",content:"",pending:!0}]),H&&t.onMessage?.({role:"user",content:H}),y.current[J]=b.userId,c.current={userId:b.userId,agentId:J,text:w,backendText:E},yt(E,J,{forceVoicePlayback:C.forceVoicePlayback,clientMessageId:lt()})},[t,yt]),Vn=F((b,w={})=>{const E=b.trim();if(!E||D)return;const C=s.current&&!s.current.signal.aborted?c.current:null,H=C??d.current;if(d.current=null,!H){Dt(E,w);return}C&&s.current?.abort(),_t(H,`${H.text} ${E}`.replace(/\s+/g," ").trim(),`${H.backendText}
|
|
171
|
+
${E}`.trim(),w,E)},[D,_t,Dt]),an=F(()=>{const b=s.current&&!s.current.signal.aborted?c.current:null;return b?(d.current=b,s.current?.abort(),!0):!1},[]),rt=F(()=>{const b=d.current;d.current=null,!(!b||D)&&_t(b,b.text,b.backendText,{forceVoicePlayback:!0})},[D,_t]),Pt=F(()=>s.current?.abort(),[]),bn=F(b=>{f.current=b;const w=l.current;w&&(w.volume=b?.2:1),u.current&&typeof window<"u"&&"speechSynthesis"in window&&(b?window.speechSynthesis.pause():window.speechSynthesis.resume())},[]),jt=F(()=>{p.current?.(),p.current=null,f.current=!1,ht(),N(b=>b.status==="speaking"||b.status==="answering"?{...b,status:"done"}:b),l.current?.pause(),l.current=null,typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel(),u.current=null,B(!1)},[ht]),mt=F(b=>{const w=ko(b);if(!w)return Promise.resolve(!1);ht();const E=!!(g?.allowVoiceInput&&g?.voiceOutputEnabled&&g.talkbackMode!=="text"),C=(H,J)=>new Promise(me=>{let ae=!1;So(l,u,H,J,g?.voiceSpeed??1,w,!0,()=>{ae=!0,B(!0)},()=>{B(!1),me(ae)})||(B(!1),me(!1))});return E?e.speak(w).then(H=>H.audioBase64?C(H.audioBase64,H.mimeType):(ka("Talkback prompt TTS did not return provider audio.",{providerReady:H.providerReady,message:H.message,voiceProvider:g?.voiceProvider,voiceOutputEnabled:g?.voiceOutputEnabled,talkbackMode:g?.talkbackMode}),C())).catch(H=>(ka("Talkback prompt TTS request failed before audio playback.",{error:H instanceof Error?H.message:String(H),voiceProvider:g?.voiceProvider,voiceOutputEnabled:g?.voiceOutputEnabled,talkbackMode:g?.talkbackMode}),C())):(ka("Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.",{voiceOutputEnabled:g?.voiceOutputEnabled,talkbackMode:g?.talkbackMode,voiceProvider:g?.voiceProvider}),C())},[g?.allowVoiceInput,g?.talkbackMode,g?.voiceOutputEnabled,g?.voiceSpeed,ht,e]),Ht=F((b,w,E={})=>{if(z||D||!w)return;de(b,{content:"",pending:!0,streaming:!1,error:!1}),gn("send");const C=V.findIndex(J=>J.id===b),H=C>0?V[C-1]:void 0;yt(w,b,{...E,clientMessageId:y.current[b]??(H?.role==="user"?H.id:void 0)})},[z,D,V,de,yt]),Ot=F((b,w,E)=>{de(b,{feedback:w});const C=V.findIndex(me=>me.id===b),H=C>=0?V[C]?.content:void 0;let J;for(let me=C-1;me>=0;me--)if(V[me]?.role==="user"){J=V[me]?.content;break}e.sendFeedback({sessionId:o.current,messageId:b,rating:w,comment:E,question:J,answer:H}).catch(()=>{})},[e,de,V]),gt=F(b=>{const w=b.content.trim();if(!w)return;const E=b.id.trim()||lt();P(C=>C.some(H=>H.id===E)?C:[...C,{id:E,role:"assistant",content:w,createdAt:new Date().toISOString()}])},[]),dt=F(async(b,w,E={},C)=>{t.onAction?.(b);const H=b==="public_contact_support"||b==="public_submit_inquiry"?{actionId:b}:{},J=await e.action(b,{sessionId:o.current,...w,...H},C),me={};return E.name?.trim()&&(me.name=E.name.trim()),E.email?.trim()&&(me.email=E.email.trim()),E.phone?.trim()&&(me.phone=E.phone.trim()),Object.keys(me).length>0&&(ue(ae=>{const xe={...ae,...me};return Ye(xe),xe}),me.email&&b!=="contact"&&e.action("contact",{sessionId:o.current,...me}).catch(()=>{})),gt({id:J.receipt?.id||lt(),content:J.receipt?.content||J.note||(J.caseReference?`Action completed.
|
|
172
|
+
Reference: ${J.caseReference}`:"Action completed.")}),gn("receive"),J},[e,t,Ye,gt]),Qe=F(async(b,w,E)=>{const C=await e.confirmHostedBooking?.({sessionId:o.current,inquiryId:b,eventUri:w,inviteeUri:E});return C?.receipt&>(C.receipt),C},[e,gt]),Ft=F(b=>{const w=b.trim();w&&P(E=>E.some(C=>C.role==="assistant"&&C.content===w)?E:[...E,{id:lt(),role:"assistant",content:w}])},[]),it=F(()=>{const b=Io(g?.actions);return b?(P(w=>[...w,{id:lt(),role:"assistant",content:t.strings.reconnectPrompt,actions:[b],selectedAction:b.id,handoffOffered:!0,reconnectOffer:!0,createdAt:new Date().toISOString()}]),!0):!1},[t.strings.reconnectPrompt,g?.actions]),Ut=F(b=>{Y.current=!0;const w=lt();return P(E=>[...E,{id:w,role:"user",content:b.trim(),pending:!0}]),w},[]),Wt=F((b,w)=>{P(E=>E.map(C=>C.id===b?{...C,...w}:C))},[]),jn=F(b=>{P(w=>w.filter(E=>E.id!==b))},[]),Hn=F(async(b,w="widget")=>{if(!e.sendExplanationFeedback)throw new Error("Explanation feedback is unavailable.");await e.sendExplanationFeedback({...b,sessionId:o.current,surface:w})},[e]),Wn=F((b="widget")=>{const w=e.fetchExplanation?.bind(e);if(!w)return;const E=e.retryExplanation?.bind(e),C=H=>H;return{poll:async(H,J)=>C(await w(H,o.current,b,J)),settled:(H,J)=>{J!=="not_requested"&&P(me=>me.map(ae=>{const xe=ae.visualization?.explanation?.aiExplanation;return!xe||(xe.explanationId??ae.visualization?.explanation?.explanationId)!==H||xe.status===J?ae:{...ae,visualization:{...ae.visualization,explanation:{...ae.visualization.explanation,aiExplanation:{...xe,status:J}}}}}))},...E?{retry:async H=>C(await E(H,o.current,b))}:{}}},[e]),Gn=F((b,w)=>{e.sendFeedback({sessionId:o.current,messageId:"__csat__",rating:b,comment:w}).catch(()=>{})},[e]),Tt=F(async(b,w,E,C)=>{const H=yr();try{if(typeof b!="string"&&e.transcribeAudio)return await e.transcribeAudio(b,w,E,C);const J=typeof b=="string"?b:await mu(b);return await e.transcribe(J,w,E,C)}finally{wa("voice-transcription",H)}},[e]),Q=F(async(b,w,E=0)=>{const C=m.current.get(`${b.id}:${E}`)??(w.id?m.current.get(w.id):void 0);if(C)return C;if(!w.id||!e.fetchAttachment)throw new Error("This file is no longer available.");return e.fetchAttachment(w.id,o.current)},[e]),he=F((b,w,E,C)=>e.uploadAttachment?e.uploadAttachment(b,w,E,o.current,C):Promise.reject(new Error("File upload is unavailable")),[e]),we=F(b=>e.searchGifs(b),[e]),ce=F((b,w)=>e.demoSlots(b,w),[e]),be=F(b=>Dt("",{imageUrl:b}),[Dt]),wt=t.demo||!!t.gifApiKey,rn=F(()=>{s.current?.abort(),S(!0),e.endConversation(o.current).catch(()=>{})},[e]),Kn=F(()=>{s.current?.abort();const b=Un(t);o.current=b;try{a?.setItem(Bn(i),b)}catch{}Te(null),Ie([]),S(!1),ve("ai"),ge(void 0),He(void 0),We.current=new Date().toISOString(),P(g?[{id:lt(),role:"assistant",content:g.greeting,availableActions:g.availableActions,actions:g.actions}]:[])},[a,i,g]),Gt=F(b=>{if(ne){if(b===o.current){Te(null);return}Ie(Co(a,i,b)),Te(b)}},[a,i,ne]),Ct=F(()=>{Te(null),Ie([])},[]),At=t.starters.length>0?t.starters:g?.starterQuestions??[],kt=g?.featuredLinks??[];return{persona:g,messages:V,sending:z,assistantSpeaking:U,voiceReply:A,visitor:O,starters:At,featuredLinks:kt,hasEmail:!!O.email,liveMode:Ce,assignedAgentName:Xe,agentTypingName:ie,send:Dt,amend:Vn,hold:an,resumeHeld:rt,duckSpeaking:bn,sendGif:be,notifyTyping:pt,stop:Pt,retry:Ht,rateMessage:Ot,rateExplanation:Hn,explanationTransport:Wn,injectAssistant:Ft,reconnectSupport:it,appendUserDraft:Ut,patchMessage:Wt,removeMessage:jn,submitCsat:Gn,submitForm:dt,confirmHostedBooking:Qe,transcribe:Tt,uploadAttachment:he,loadAttachment:Q,searchGifs:we,demoSlots:ce,gifEnabled:wt,identify:tt,ended:D,endConversation:rn,startNew:Kn,history:ne?oe:[],viewingSessionId:_e,viewMessages:Le,openConversation:Gt,closeHistoryView:Ct,shutdown:et,stopSpeaking:jt,speakAssistantText:mt}},ju=({name:e,greeting:t})=>{const n=ct();return r("section",{class:"cf-empty-welcome","aria-label":qe(n.welcomeLabel,{name:e}),children:[r("span",{class:"cf-empty-welcome__eyebrow",children:n.welcomeEyebrow}),r("h2",{children:e}),r("p",{children:t||n.welcomePrompt})]})},Tr=(e,t,n)=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),n();return}if(e.key!=="Tab")return;const a=Array.from(t.querySelectorAll('button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])')).filter(l=>!l.hasAttribute("disabled")&&l.getAttribute("aria-hidden")!=="true"&&l.tabIndex>=0);if(a.length===0)return;const i=t.getRootNode(),o=e.composedPath()[0],s=o instanceof HTMLElement?o:"activeElement"in i?i.activeElement:document.activeElement,c=a[0],d=a[a.length-1];e.shiftKey&&(s===c||!t.contains(s))?(e.preventDefault(),e.stopPropagation(),d.focus()):!e.shiftKey&&(s===d||!t.contains(s))&&(e.preventDefault(),e.stopPropagation(),c.focus())},Ta=new Map,Eo=e=>{if(!e||typeof document>"u"||typeof CanvasRenderingContext2D>"u")return;const t=document.createElement("canvas").getContext("2d");if(!t)return;t.fillStyle="#010203",t.fillStyle=e;const n=t.fillStyle;if(n==="#010203"&&e.trim().toLowerCase()!=="#010203")return;const a=n.match(/^#([\da-f]{6})$/i)?.[1];if(a)return[Number.parseInt(a.slice(0,2),16),Number.parseInt(a.slice(2,4),16),Number.parseInt(a.slice(4,6),16),1];const i=n.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!i)return;const o=i.slice(1,5).map(Number);if(!o.some(s=>!Number.isFinite(s)))return[o[0],o[1],o[2],o[3]??1]},Hu=(e,t="#ffffff")=>{const n=`${e??""}|${t}`;if(Ta.has(n))return Ta.get(n);const a=Eo(e),i=Eo(t)??[255,255,255,1];if(!a){Ta.set(n,void 0);return}const o=a[3],c=a.slice(0,3).map((m,f)=>m*o+i[f]*(1-o)).map(m=>{const f=m/255;return f<=.04045?f/12.92:((f+.055)/1.055)**2.4}),d=c[0]*.2126+c[1]*.7152+c[2]*.0722,l=1.05/(d+.05),u=(d+.05)/.059,p=l>=u?"#ffffff":"#0f1e2a";return Ta.set(n,p),p},Wu=e=>{const[t,n]=$("light");return X(()=>{if(e!=="auto"||typeof matchMedia>"u")return;const a=matchMedia("(prefers-color-scheme: dark)"),i=()=>n(a.matches?"dark":"light");return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[e]),e==="auto"?t:e},Gu=6e4,Ku=90,zo={end:"end the call",mute:"mute your microphone",minimize:"minimize the chat",expand:"expand the view",shrink:"exit the expanded view"},No=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu," ").replace(/\s+/g," ").trim(),Yu=[{action:"shrink",re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:"end",re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:"mute",re:/\bmute\b|\bstop listening\b/},{action:"minimize",re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:"expand",re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],Zu=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,Ju=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,Xu=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,Qu=e=>{const t=No(e);if(!t)return null;for(const{action:n,re:a}of Yu)if(a.test(t)){const i=t.split(" ").length;return{action:n,confident:n==="end"?i<=10:i<=6}}return null},ep=e=>`I didn't catch yes or no. Say yes to ${zo[e]}, or no to keep talking.`,tp=({transport:e,config:t,bindControls:n,composerDraftStore:a})=>{const i=t.strings,[o,s]=$(t.openByDefault),{persona:c,messages:d,sending:l,assistantSpeaking:u,visitor:p,hasEmail:m,liveMode:f,assignedAgentName:_,agentTypingName:h,starters:I,featuredLinks:x,send:g,sendGif:T,notifyTyping:V,stop:P,amend:ee,hold:Z,resumeHeld:Y,duckSpeaking:z,retry:te,rateMessage:U,rateExplanation:B,explanationTransport:A,injectAssistant:N,reconnectSupport:y,appendUserDraft:D,patchMessage:S,removeMessage:O,submitCsat:ue,submitForm:oe,confirmHostedBooking:Fe,transcribe:_e,uploadAttachment:Te,loadAttachment:Le,searchGifs:Ie,demoSlots:Ce,gifEnabled:ve,identify:Xe,ended:ge,endConversation:ie,startNew:He,history:We,viewingSessionId:k,viewMessages:K,openConversation:j,closeHistoryView:G,shutdown:ne,stopSpeaking:ye,speakAssistantText:Se}=Vu(e,t,o),et=qu(d,f),[Ye,tt]=$(null),at=R(0),M=F((v,L,le)=>{le===at.current&&tt({status:"ready",name:L,url:URL.createObjectURL(v),mimeType:v.type||"application/octet-stream"})},[]),pe=F((v,L,le)=>{const Me=L.name,Ne=++at.current;tt({status:"loading",name:Me}),Le(v,L,le).then(bt=>M(bt,Me,Ne),()=>{Ne===at.current&&tt({status:"error",name:Me})})},[Le,M]),de=F((v,L)=>M(v,L,++at.current),[M]),fe=F(()=>{at.current+=1,tt(null)},[]);X(()=>()=>{Ye?.status==="ready"&&URL.revokeObjectURL(Ye.url)},[Ye]);const Oe=!!Io(c?.actions),[Ge,ht]=$(0),[pt,yt]=$({mic:"off",processing:!1}),[Dt,_t]=$(null),[Vn,an]=$(!1),[rt,Pt]=$(!1),[bn,jt]=$(!1),[mt,Ht]=$(!1),[Ot,gt]=$(0),[dt,Qe]=$(!1),[Ft,it]=$(null),[Ut,Wt]=$(null),[jn,Hn]=$([]),[Wn,Gn]=$(""),[Tt,Q]=$(()=>{try{return localStorage.getItem("centrinfo:muted")==="1"}catch{return!1}}),he=Wu(t.theme),we=c?.soundEnabled??!0;X(()=>{uu(t.sound&&we&&!Tt)},[t.sound,we,Tt]);const ce=F(()=>{Q(v=>{const L=!v;try{localStorage.setItem("centrinfo:muted",L?"1":"0")}catch{}return L})},[]),be=R(null),wt=R(null),rn=R(null),Kn=R(0),Gt=R(!1),Ct=R(!1),At=R(null),kt=R(0),b=R(void 0),w=R(0),E=R(null),C=R(!1),H=R(null),J=R(""),me=R(()=>{}),ae=R(""),xe=R(l),re=R(g);re.current=g;const ot=R(ee);ot.current=ee;const Ue=R(_e);Ue.current=_e;const Ve=R(!1),Ze=R(!1),nt=R("");nt.current=[...d].reverse().find(v=>v.role==="assistant")?.content??"";const ft=R(u);xe.current=l,ft.current=u;const De=rt?Vn?"timeout":mt||pt.mic==="muted"?"muted":pt.mic==="unavailable"?pt.reason==="permission-denied"||pt.reason==="unsupported"?"denied":"unavailable":pt.mic==="off"||pt.mic==="starting"?"connecting":pt.mic==="hearing"?"hearing":u?"speaking":Dt??(pt.processing||l?"processing":"listening"):"idle",[Mt,W]=$(!0),[Ae,Ee]=$(!1),ke=R(0),[Ke,Bt]=$(!1),[It,on]=$(!1),Uo=R(null),[Kt,sn]=$(!1),hp=R({value:""}),mp=a??hp.current,Bo=R({confirmEnd:Ke,confirmClear:It,showHistory:Kt});Bo.current={confirmEnd:Ke,confirmClear:It,showHistory:Kt};const[gp,qo]=$(!1),ze=!!k,Ca=ze?K:d,Yn=Ca.find(v=>v.id===Ft&&v.visualization)?.visualization,Zn=Ca.find(v=>v.id===Ut&&v.visualization);X(()=>{!Ut||Zn||(Wt(null),Qe(!1))},[Ut,Zn]),X(()=>{!Ft||Yn||(it(null),Qe(!1))},[Yn,Ft]);const vn=F(()=>{s(!0),ht(0),gn("open"),t.onOpen?.(),t.onShow?.()},[t]),Et=F(()=>{s(!1),Qe(!1),it(null),t.onClose?.(),t.onHide?.(),wt.current?.focus()},[t]),Jn=F(()=>o?Et():vn(),[o,vn,Et]),bp=F(()=>Bt(!0),[]),vp=F(()=>{ie(),Bt(!1)},[ie]),xp=F(()=>{He(),Ee(!1),W(!0)},[He]);X(()=>{Ke&&Uo.current?.focus()},[Ke]),X(()=>{n({open:vn,close:Et,toggle:Jn,identify:Xe,startNew:He,endConversation:ie,shutdown:ne})},[n,vn,Et,Jn,Xe,He,ie,ne]),X(()=>{const v=d.filter(L=>L.role==="assistant"&&!L.pending).length;if(o){Kn.current=v;return}v>Kn.current&&ht(v-Kn.current)},[d,o]),X(()=>{t.onUnreadChange?.(Ge)},[Ge,t]),X(()=>{const v=t.sessionDurationMinutes;if(!v||v<=0)return;const L=setTimeout(()=>ne(),v*60*1e3);return()=>clearTimeout(L)},[t.sessionDurationMinutes,d,o,ne]),X(()=>{const v=t.customLauncherSelector;if(!v||typeof document>"u")return;let L=[];try{L=Array.from(document.querySelectorAll(v))}catch{return}const le=Me=>{Me.preventDefault(),Jn()};return L.forEach(Me=>Me.addEventListener("click",le)),()=>L.forEach(Me=>Me.removeEventListener("click",le))},[t.customLauncherSelector,Jn]);const Vo=R(!1);X(()=>{const v=t.proactiveMessage?.trim();if(!v||Vo.current)return;const L=t.proactiveOnPaths??[],le=typeof location<"u"?location.pathname:"";if(L.length>0&&!L.some(bt=>le.includes(bt)))return;const Me=`centrinfo:proactive:${t.token.slice(0,12)}`;try{if(sessionStorage.getItem(Me)==="1")return}catch{}const Ne=setTimeout(()=>{if(!(o||ge||d.some(bt=>bt.role==="user"))){Vo.current=!0;try{sessionStorage.setItem(Me,"1")}catch{}N(v),vn()}},Math.max(0,t.proactiveDelaySeconds)*1e3);return()=>clearTimeout(Ne)},[t.proactiveMessage]),X(()=>{const v=rn.current;if(!o||!v)return;const L=d[d.length-1],le=Date.now()<ke.current;L?.role==="user"||Mt||le?(requestAnimationFrame(()=>{v.scrollTop=v.scrollHeight}),Ee(!1),le&&W(!0)):Ee(!0)},[d,o,l,Mt]);const jo=R(!0);jo.current=Mt,X(()=>{const v=rn.current;if(!(!o||!v))return yc(v,{isAtBottom:()=>jo.current,onUnseen:()=>Ee(!0)})},[o,ze]);const yp=F(()=>{const v=rn.current;if(!v)return;if(Gt.current&&!ze){W(!0),Ee(!1);return}const L=v.scrollHeight-v.scrollTop-v.clientHeight<80;W(L),L&&Ee(!1)},[ze]),Yt=F(()=>{const v=rn.current;v&&(v.scrollTop=v.scrollHeight),Ee(!1),W(!0)},[]),Aa=F(()=>{ke.current=Date.now()+3e3,requestAnimationFrame(Yt)},[Yt]);X(()=>{if(!o||ze||!rt||De==="connecting")return;ke.current=Date.now()+6e4,Yt();const v=requestAnimationFrame(()=>{Yt(),requestAnimationFrame(Yt)}),L=[80,180,360].map(le=>window.setTimeout(Yt,le));return()=>{cancelAnimationFrame(v),L.forEach(le=>window.clearTimeout(le))}},[u,d,o,Yt,l,rt,ze,De]);const Ho=F(()=>{be.current?.querySelector(".cf-textarea")?.focus()},[]),Xn=F((v,L)=>{_t(v),b.current&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>_t(null),3e3),L&&!Ct.current&&Se(L)},[Se]),Ma=F(v=>{const L=H.current;if(L)return L;Aa();const le=D(v);return H.current=le,S(le,{content:J.current||v,pending:!0,streaming:!1}),le},[D,Aa,S]),qt=F(()=>{const v=H.current;if(v){if(J.current){S(v,{content:J.current,pending:!0});return}H.current=null,O(v)}},[S,O]),Zt=F(()=>{Ze.current&&(Ze.current=!1,z(!1)),Ve.current&&(Ve.current=!1,Y())},[z,Y]),ut=F(()=>{Gt.current=!1,At.current?.stop("call-ended"),At.current=null,Ve.current=!1,Ze.current=!1,Ct.current=!1,E.current=null,C.current=!1;const v=H.current;H.current=null,J.current="",v&&O(v),b.current&&window.clearTimeout(b.current),_t(null),an(!1),yt({mic:"off",processing:!1}),gt(0),Pt(!1),jt(!1),Ht(!1),Qe(!1),it(null),ye()},[O,ye]),_p=F(()=>{dt&&it(null),Qe(!dt)},[dt]),wp=F(v=>{it(v),Qe(!0)},[]),kp=F(v=>{Wt(v),Qe(!0)},[]),Ia=F(()=>{const v=Ft,L=Ut;it(null),Wt(null),Qe(!1),window.requestAnimationFrame(()=>{(L?be.current?.querySelector(`[data-explanation-message="${L}"]`)?.querySelector('[data-testid="analytics-explanation-expand"]'):Array.from(be.current?.querySelectorAll("[data-visualization-message]")??[]).find(Me=>Me.dataset.visualizationMessage===v))?.focus()})},[Ft,Ut]),Sp=F(()=>{it(null),Wt(null),Qe(!1)},[]),Wo=F((v,L,le=!1)=>{if(Aa(),L&&(S(L,{content:v,pending:!1,streaming:!1}),H.current===L&&(H.current=null)),J.current="",le){ye(),ot.current(v,{forceVoicePlayback:!0,userMessageId:L});return}Gt.current&&(Z()?ot.current(v,{forceVoicePlayback:!0,userMessageId:L}):re.current(v,{forceVoicePlayback:!0,userMessageId:L}))},[Aa,Z,S,ye]),zt=F(v=>{N(v),Se(v)},[N,Se]),Go=F(()=>{if(kt.current=Date.now(),_t(null),ft.current){Ze.current=!0,z(!0);return}Ve.current||(Ve.current=Z()),Ma("Listening...")},[z,Ma,Z]),Ko=F(v=>{const L=H.current;if(!L||Ze.current)return;const le=[J.current,v].filter(Boolean).join(" ");S(L,{content:`${le} ...`,pending:!0})},[S]),Yo=F(v=>{kt.current=Date.now();const L=[J.current,v.text].map(Nt=>Nt.trim()).filter(Boolean).join(" ").replace(/\s+/g," ").trim();if((Ze.current||v.overlappedOutput)&&Uc(v.text,nt.current)){qt(),Zt();return}if(!L||lu(L)||du(L)){const Nt=Ze.current||Ve.current;qt(),Zt(),Nt||Xn("misunderstood");return}Ze.current&&(Ze.current=!1,P(),ye());const Me=E.current;if(Me){J.current="",qt();const Nt=No(L);if(Zu.test(Nt)||Me==="end"&&Xu.test(Nt)){E.current=null,me.current(Me);return}if(Ju.test(Nt)){E.current=null,zt("Okay, never mind — what would you like to know?");return}zt(ep(Me));return}const Ne=Qu(L);if(Ne){if(J.current="",qt(),Zt(),Ne.confident){me.current(Ne.action);return}E.current=Ne.action,zt(`Just to confirm — you want me to ${zo[Ne.action]}? Please say yes or no.`);return}const bt=Ma(L);S(bt,{content:L,pending:!0});const xn=Ve.current;Ve.current=!1,Wo(L,bt,xn)},[Ma,S,Zt,Wo,qt,Xn,zt,P,ye]),Zo=F(v=>{kt.current=Date.now();const L=Ze.current||Ve.current;if(qt(),Zt(),!(L||v.overlappedOutput||v.reason==="too-short")){if(v.reason==="transcribe-failed"){Xn("misunderstood","I couldn't transcribe that. Please try again, or type your question.");return}Xn("noise")}},[Zt,qt,Xn]),Qn=R({speechStart:Go,partial:Ko,turn:Yo,noise:Zo});Qn.current={speechStart:Go,partial:Ko,turn:Yo,noise:Zo};const Jo=F(()=>{navigator.mediaDevices?.enumerateDevices().then(v=>{Hn(v.filter(L=>L.kind==="audioinput").map((L,le)=>({deviceId:L.deviceId,label:L.label||`Microphone ${le+1}`})))}).catch(()=>{})},[]),$p=F(()=>{if(Gt.current){ut();return}if(Ho(),!c?.allowVoiceInput||!c.talkbackMode||c.talkbackMode==="text"||xe.current||ge||ze)return;kt.current=Date.now(),Ct.current=!1,Gt.current=!0,Ht(!1),Pt(!0),jt(!1),an(!1);let v=!1;const L=new qi({deviceId:ae.current||void 0,transcribe:async({audio:le,mimeType:Me,durationSeconds:Ne})=>{const bt=typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||void 0;return su(await Ue.current(le,Me,bt,Ne))},listener:{state:le=>{yt(le),le.mic!=="starting"&&le.mic!=="off"&&jt(!0),!v&&le.mic==="listening"&&(v=!0,Jo())},speechStart:()=>Qn.current.speechStart(),partial:({text:le})=>Qn.current.partial(le),turn:le=>Qn.current.turn(le),noise:le=>Qn.current.noise(le),level:le=>{const Me=performance.now();Me-w.current<Ku||(w.current=Me,gt(le))}}});At.current=L,L.setOutputActive(ft.current),L.start()},[ut,ge,Ho,c,Jo,ze]),Ea=F(()=>{const v=!Ct.current;Ct.current=v,Ht(v),At.current?.setMuted(v),v?(J.current="",qt(),Zt()):kt.current=Date.now()},[Zt,qt]),Xo=F(v=>{switch(kt.current=Date.now(),v){case"end":C.current=!0,zt("Okay — ending our call now. Goodbye!"),window.setTimeout(()=>{C.current&&(C.current=!1,ut())},2e3);break;case"mute":{Ct.current||Ea(),zt("Muted. Tap the mic button when you want me to listen again.");break}case"minimize":Et(),zt("Minimized — I'm still listening. Tap the call pill to bring the chat back.");break;case"expand":Qe(!0),zt("Sure — expanding the view.");break;case"shrink":it(null),Qe(!1),zt("Okay — back to the smaller view.");break}},[Et,ut,zt,Ea]);X(()=>{me.current=Xo},[Xo]);const Qo=R(!1);X(()=>{Qo.current&&!u&&C.current&&(C.current=!1,ut()),Qo.current=u},[u,ut]);const Tp=F(v=>{ae.current=v,Gn(v),At.current?.selectDevice(v||void 0)},[]),Cp=F(()=>{!Gt.current||Ct.current||(Ze.current=!1,Ve.current=!1,P(),ye(),kt.current=Date.now())},[P,ye]);X(()=>{At.current?.setOutputActive(u),kt.current=Date.now()},[u]),X(()=>{if(De!=="denied")return;const v=window.setTimeout(()=>ut(),3500);return()=>window.clearTimeout(v)},[ut,De]),X(()=>{if(!rt)return;const v=window.setInterval(()=>{const L=At.current;!L||Ct.current||xe.current||ft.current||L.snapshot.mic==="hearing"||L.snapshot.processing||Date.now()-kt.current<Gu||(At.current?.log.add("call-timeout"),an(!0),window.setTimeout(()=>ut(),2400))},5e3);return()=>window.clearInterval(v)},[ut,rt]);const Ap=rt&&!mt&&(l||u);X(()=>()=>ut(),[ut]);const[Mp,Ip]=$(""),es=R(!1);X(()=>{if(es.current&&!l){const v=[...d].reverse().find(L=>L.role==="assistant"&&!L.streaming&&!L.pending&&L.content);v&&Ip(v.content)}es.current=l},[l,d]),Sn(()=>{if(!o)return;const v=be.current,L=Ke||It?v?.querySelector(".cf-confirm__card"):Kt?v?.querySelector(".cf-history"):null;if(!L)return;const le=L.getRootNode(),Me="activeElement"in le?le.activeElement:document.activeElement;(!Me||!L.contains(Me))&&L.querySelector('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])')?.focus()},[It,Ke,o,Kt]),X(()=>{if(!o)return;const v=be.current,L=Ke||It?v?.querySelector(".cf-confirm__card"):Kt?v?.querySelector(".cf-history"):null,le=v?.querySelectorAll(":scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat");le?.forEach(Ne=>{L?(Ne.setAttribute("inert",""),Ne.setAttribute("aria-hidden","true")):(Ne.removeAttribute("inert"),Ne.removeAttribute("aria-hidden"))}),L||requestAnimationFrame(()=>v?.querySelector(".cf-textarea")?.focus());const Me=Ne=>{if(Ne.key==="Escape"){Ne.preventDefault();const ta=Bo.current;if(ta.confirmEnd){Bt(!1);return}if(ta.confirmClear){on(!1);return}if(ta.showHistory){sn(!1);return}if(v?.querySelector(".cf-action-drawer"))return;Et();return}if(Ne.key!=="Tab"||!L)return;const bt=L.querySelectorAll('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])'),xn=Array.from(bt).filter(ta=>!ta.hasAttribute("disabled"));if(xn.length===0)return;const Nt=xn[0],rs=xn[xn.length-1],is=L.getRootNode()instanceof ShadowRoot?L.getRootNode().activeElement:document.activeElement;Ne.shiftKey&&is===Nt?(Ne.preventDefault(),rs.focus()):!Ne.shiftKey&&is===rs&&(Ne.preventDefault(),Nt.focus())};return v?.addEventListener("keydown",Me),()=>{v?.removeEventListener("keydown",Me),le?.forEach(Ne=>{Ne.removeAttribute("inert"),Ne.removeAttribute("aria-hidden")})}},[o,Et,Ke,It,Kt]),X(()=>{const v=be.current;v&&(o?v.removeAttribute("inert"):v.setAttribute("inert",""))},[o]);const za=t.accentColor??t.themeTokens?.accent??c?.accentColor,ts=t.themeTokens?.accentText??Hu(za,t.themeTokens?.background??(he==="dark"?"#0f1c27":"#ffffff")),Ep={zIndex:t.zIndex,"--cf-h-pad":`${t.horizontalPadding}px`,"--cf-v-pad":`${t.verticalPadding}px`,...ts?{"--cf-accent-ink":ts}:{},...t.themeTokens?.accentStrong?{"--cf-accent-2":t.themeTokens.accentStrong}:{},...t.themeTokens?.background?{"--cf-bg":t.themeTokens.background}:{},...t.themeTokens?.surface?{"--cf-surface":t.themeTokens.surface}:{},...t.themeTokens?.surfaceMuted?{"--cf-surface-2":t.themeTokens.surfaceMuted}:{},...t.themeTokens?.text?{"--cf-text":t.themeTokens.text}:{},...t.themeTokens?.mutedText?{"--cf-muted":t.themeTokens.mutedText}:{},...t.themeTokens?.border?{"--cf-border":t.themeTokens.border}:{},...t.themeTokens?.shadow?{"--cf-shadow":t.themeTokens.shadow}:{},...t.themeTokens?.radius?{"--cf-radius":t.themeTokens.radius}:{},...t.themeTokens?.fontFamily?{"--cf-font":t.themeTokens.fontFamily}:{},...t.themeTokens?.success?{"--cf-success":t.themeTokens.success}:{},...t.themeTokens?.warning?{"--cf-warning":t.themeTokens.warning}:{},...t.themeTokens?.danger?{"--cf-danger":t.themeTokens.danger}:{},...za?{"--cf-accent":za,"--cf-accent-2":t.themeTokens?.accentStrong??`color-mix(in oklab, ${za} 76%, #14141f)`}:{}},zp=v=>g(v),Np=[...d].reverse().find(v=>v.role==="user"&&v.content.trim())?.content??"",Na=d.some(v=>v.role==="user"),ns=!!(c?.allowVoiceInput&&c?.talkbackMode&&c.talkbackMode!=="text"),as=ns,ea=!ze&&as&&!Na?Ca.filter((v,L)=>!(L===0&&v.role==="assistant")):Ca,Rp=f==="human"&&_?_:c?.agentName??i.chatName,Lp=f==="human"?i.liveSupport:f==="queued"?i.waitingForTeam:c?.offline?i.statusOffline:i.statusOnline,Ar=!ge&&!ze?c?.availableActions:void 0,Dp=!ge&&!ze?c?.actions:void 0,Mr=rt&&!bn&&De==="connecting"&&!ze;return r(jl,{value:i,children:r(Hl,{value:t.locale,children:r("div",{class:"cf-root",dir:t.dir,"data-theme":he,"data-align":t.alignment,"data-display":"floating",style:Ep,children:[dt&&o&&r("div",{class:"cf-theater-backdrop",onClick:Sp}),r("div",{ref:be,class:`cf-panel ${o?"is-open":""} ${rt?"cf-panel--call":""} ${Mr?"cf-panel--voice-connecting":""} ${dt&&o?"cf-panel--theater":""} ${Yn||Zn?"cf-panel--analytics-focus":""}`,role:"dialog","aria-modal":"false","aria-label":`${i.chatName}: ${c?.agentName??i.assistantName}`,"aria-hidden":!o,children:[Ye&&o&&r(hu,{state:Ye,onClose:fe}),r("div",{class:"cf-header",children:[r(uo,{persona:c,hideWhenMissing:!0}),r("div",{class:"cf-header__meta",children:[r("div",{class:"cf-header__name",children:Rp}),r("div",{class:`cf-header__status ${f==="ai"&&c?.offline?"cf-header__status--offline":""}`,children:r("span",{class:"cf-header__status-text",children:Lp})})]}),r("div",{class:"cf-header__actions",children:[We.length>0&&r("button",{type:"button",class:"cf-header__btn","aria-label":i.pastConversations,title:i.pastConversations,"aria-pressed":Kt,onClick:()=>sn(v=>!v),children:r(pd,{})}),Na&&!ge&&!ze&&r("button",{type:"button",class:"cf-header__btn","aria-label":i.endChat,title:i.endChat,onClick:bp,children:r(br,{})}),t.sound&&we&&r("button",{type:"button",class:"cf-header__btn","aria-label":Tt?i.unmuteSounds:i.muteSounds,"aria-pressed":Tt,onClick:ce,children:Tt?r(cd,{}):r(sd,{})}),r("button",{type:"button",class:"cf-header__btn cf-header__close","aria-label":i.closeChat,onClick:Et,children:r(pn,{})})]})]}),r("div",{class:"cf-panel__video",children:Yn?r("div",{class:"cf-analytics-focus",role:"region","aria-label":i.expandedAnalyticsResult,children:r(vo,{visualization:Yn,expanded:!0,onFollowUp:v=>{Ia(),g(v)},onClose:Ia})}):Zn?.visualization?r("div",{class:"cf-analytics-focus",role:"region","aria-label":i.expandedAnalyticsResult,children:r(Yd,{visualization:Zn.visualization,onClose:Ia,onFollowUp:v=>{Ia(),g(v)},onFeedback:ze?void 0:B,transport:ze?void 0:A("widget"),onOpenSource:t.onOpenAnalyticsSource})}):!ze&&as?r(Ad,{persona:c,starters:[],onPick:g,onFocusComposer:$p,speaking:u,voiceState:De,replyPending:rt&&l&&!u,pinned:!0,muted:mt,onToggleMute:Ea,onEndCall:ut,onTalkNow:Cp,showTalkNow:Ap,micLevel:Ot,theaterMode:dt,onToggleTheater:_p,onMinimize:Et,audioDevices:jn,selectedAudioDeviceId:Wn,onSelectAudioDevice:Tp,connectingOnly:Mr}):null}),!Mr&&r("div",{class:"cf-panel__chat",children:[t.preview&&r("div",{class:"cf-preview-banner",children:i.previewBanner}),ze&&r("div",{class:"cf-viewing-banner",children:i.viewingPast}),r("div",{class:"cf-body",ref:rn,role:"log",onScroll:yp,children:[ea.map((v,L)=>r(Kd,{msg:v,persona:c,isLast:!ze&&L===ea.length-1,visitor:p,hasEmail:m,lastQuestion:Np,showActions:!ze&&L===ea.length-1&&!!(v.handoffOffered||v.selectedAction),onPickReply:zp,onSubmitForm:oe,onDemoSlots:Ce,onConfirmHostedBooking:Fe,onRetry:te,ratable:!ze&&ea.slice(0,L).some(le=>le.role==="user"),onRate:U,onExplanationFeedback:ze?void 0:B,explanationTransport:ze?void 0:A("widget"),onOpenAnalyticsSource:t.onOpenAnalyticsSource,onExpandVisualization:ze?void 0:wp,onExpandExplanation:ze?void 0:kp,onOpenAttachment:pe,onReconnect:!ze&&!ge&&Oe&&v.id===et?y:void 0},v.id)),!Na&&!ze&&r(se,{children:[ea.length===0&&r(ju,{name:c?.agentName??i.assistantName,greeting:c?.greeting}),r(Hd,{items:I,onPick:g}),r(Wd,{items:x})]}),Ae&&r("button",{type:"button",class:"cf-newmsg",onClick:Yt,children:[r(bd,{}),i.newMessages]})]}),r("div",{class:"cf-sr-live","aria-live":"polite","aria-atomic":"true",children:Mp}),l&&!ge&&!ze&&r("div",{class:"cf-stopbar",children:r("button",{type:"button",class:"cf-stop",onClick:P,children:[r(ud,{}),i.stop]})}),ze?r("div",{class:"cf-ended",children:r("button",{type:"button",class:"cf-ended__btn",onClick:G,children:i.backToChat})}):ge?r("div",{class:"cf-ended",children:[r("p",{class:"cf-ended__text",children:i.conversationEnded}),t.csat&&Na?gp?r("p",{class:"cf-ended__text",children:i.feedbackThanks}):r("div",{class:"cf-csat",children:[r("span",{class:"cf-csat__q",children:i.csatPrompt}),r("button",{type:"button",class:"cf-csat__btn","aria-label":i.feedbackHelpful,onClick:()=>{ue("up"),qo(!0)},children:r(oo,{})}),r("button",{type:"button",class:"cf-csat__btn","aria-label":i.feedbackNotHelpful,onClick:()=>{ue("down"),qo(!0)},children:r(so,{})})]}):null,r("button",{type:"button",class:"cf-ended__btn",onClick:xp,children:i.startNewChat})]}):r(se,{children:[h?r("div",{class:"cf-live-typing","aria-live":"polite",children:qe(i.agentTyping,{name:h})}):null,Ar&&Ar.length>0&&r("div",{class:"cf-footer-actions",children:r(go,{actions:Ar,descriptors:Dp,visitor:p,onSubmitForm:oe,onDemoSlots:Ce,onConfirmHostedBooking:Fe,scheduler:c?.scheduler,translations:t.actionTranslations})},"footer-actions"),r(ou,{draftStore:mp,onSend:g,onSendGif:T,onTyping:V,disabled:l,allowVoice:ns,onTranscribe:_e,gifEnabled:ve,onSearchGifs:Ie,allowAttach:t.attachments,analyzeAttachments:!0,onUpload:Te,onPreviewAttachment:de},"composer")]}),!ge&&c?.disclaimerText&&r("div",{class:"cf-disclaimer",children:c.disclaimerText}),r("div",{class:"cf-footer",children:[r("button",{type:"button",class:"cf-footer__privacy","aria-label":i.clearDeviceData,onClick:()=>on(!0),children:i.privacyAndData}),r("span",{"aria-hidden":"true",children:"·"}),i.poweredBy," ",r("a",{href:"https://accurix.tech/centrinfo",target:"_blank",rel:"noopener noreferrer",children:"Centrinfo"})]})]}),Ke&&r("div",{class:"cf-confirm",onClick:()=>Bt(!1),children:r("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":i.endChatConfirm,onClick:v=>v.stopPropagation(),onKeyDownCapture:v=>Tr(v,v.currentTarget,()=>Bt(!1)),children:[r("div",{class:"cf-confirm__title",children:i.endChatConfirm}),r("div",{class:"cf-confirm__body",children:i.endChatConfirmBody}),r("div",{class:"cf-confirm__actions",children:[r("button",{ref:Uo,type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>Bt(!1),children:i.cancel}),r("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:vp,children:i.endConfirmCta})]})]})},"confirm-end"),Kt&&r("div",{class:"cf-confirm",onClick:()=>sn(!1),children:r("div",{class:"cf-history",role:"dialog","aria-modal":"true","aria-label":i.pastConversations,onClick:v=>v.stopPropagation(),onKeyDownCapture:v=>Tr(v,v.currentTarget,()=>sn(!1)),children:[r("div",{class:"cf-history__head",children:[r("span",{children:i.pastConversations}),r("button",{type:"button",class:"cf-header__btn","aria-label":i.closeHistory,onClick:()=>sn(!1),children:r(pn,{})})]}),r("div",{class:"cf-history__list",children:We.map(v=>r("button",{type:"button",class:`cf-history__item ${v.sessionId===k?"is-active":""}`,onClick:()=>{j(v.sessionId),sn(!1)},children:[r("span",{class:"cf-history__title",children:v.title}),r("span",{class:"cf-history__meta",children:[new Date(v.ts).toLocaleDateString(void 0,{month:"short",day:"numeric"}),v.ended?` · ${i.historyEnded}`:""]})]},v.sessionId))}),r("div",{class:"cf-history__footer",children:r("button",{type:"button",class:"cf-history__clear",onClick:()=>{sn(!1),on(!0)},children:i.clearDeviceData})})]})},"history"),It&&r("div",{class:"cf-confirm",onClick:()=>on(!1),children:r("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":i.clearDeviceData,onClick:v=>v.stopPropagation(),onKeyDownCapture:v=>Tr(v,v.currentTarget,()=>on(!1)),children:[r("div",{class:"cf-confirm__title",children:i.clearDeviceData}),r("div",{class:"cf-confirm__body",children:i.clearDeviceDataBody}),r("div",{class:"cf-confirm__actions",children:[r("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>on(!1),children:i.cancel}),r("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:()=>{on(!1),ne()},children:i.clearDeviceDataCta})]})]})},"confirm-clear")]}),rt&&!o?r(ru,{persona:c,voiceState:De,muted:mt,onToggleMute:Ea,onEndCall:ut,micLevel:Ot,onExpand:vn}):dt&&o?null:!t.hideDefaultLauncher&&r("button",{ref:wt,type:"button",class:"cf-launcher","aria-label":o?i.closeChat:Ge>0?`${i.openChat}. ${Ge===1?i.unreadMessage:qe(i.unreadMessages,{count:String(Ge)})}`:i.openChat,"aria-expanded":o,onClick:Jn,children:[t.launcherIcon?r("img",{class:"cf-launcher__img",src:t.launcherIcon,alt:""}):r(Jl,{}),!o&&Ge>0&&r("span",{class:"cf-launcher__badge","aria-hidden":"true",children:Ge>99?"99+":Ge})]})]})})})},np="https://api.accurixtech.com",ap=()=>typeof navigator<"u"&&(navigator.languages?.[0]||navigator.language)||"en",rp=(e,t)=>{if(!e)return;const n=t.trim().toLowerCase(),a=n.split("-")[0]??n,i=Object.entries(e);return i.find(([o])=>o.toLowerCase()===n)?.[1]??i.find(([o])=>o.toLowerCase()===a)?.[1]},ip=e=>{if(!e||typeof e.token!="string"||e.token.length===0)throw new Error("[centrinfo-widget] `token` is required — pass your pub_* token to Centrinfo.init({ token }).");const t=e.locale?.trim()||ap(),n=rp(e.translations,t);return{token:e.token,chatSurface:e.chatSurface??"floating",analyticsContextToken:e.analyticsContextToken,identityToken:e.identityToken,getIdentityToken:e.getIdentityToken,apiBaseUrl:(e.apiBaseUrl??np).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:Vl({...n?.labels,...e.labels,...n?.labels?.analytics||e.labels?.analytics?{analytics:{...n?.labels?.analytics,...e.labels?.analytics,explanation:{...n?.labels?.analytics?.explanation,...e.labels?.analytics?.explanation}}}:{}}),locale:t,dir:Gl(t,e.dir),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,onOpenAnalyticsSource:e.onOpenAnalyticsSource,onAction:e.onAction,onHandoff:e.onHandoff}},Ro=`
|
|
37
173
|
:host {
|
|
38
174
|
all: initial;
|
|
39
175
|
}
|
|
@@ -48,6 +184,8 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
48
184
|
--cf-muted: #5b7186;
|
|
49
185
|
--cf-border: #e4e9ee;
|
|
50
186
|
--cf-danger: #b42318;
|
|
187
|
+
--cf-success: #15803d;
|
|
188
|
+
--cf-warning: #b45309;
|
|
51
189
|
--cf-shadow: 0 12px 48px -12px rgba(15, 30, 42, 0.4), 0 4px 12px -4px rgba(15, 30, 42, 0.2);
|
|
52
190
|
--cf-radius: 18px;
|
|
53
191
|
--cf-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -69,6 +207,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
69
207
|
--cf-text: #eef3f7;
|
|
70
208
|
--cf-muted: #93a7b6;
|
|
71
209
|
--cf-border: #2a3d4c;
|
|
210
|
+
--cf-success: #4ade80;
|
|
211
|
+
--cf-warning: #fbbf24;
|
|
212
|
+
--cf-danger: #f87171;
|
|
72
213
|
--cf-shadow: 0 12px 48px -12px rgba(0, 0, 0, 0.6), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
|
|
73
214
|
}
|
|
74
215
|
.cf-root *,
|
|
@@ -173,7 +314,7 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
173
314
|
/* Grid (not flex) so theater mode below can reflow header/video/chat into a
|
|
174
315
|
two-column split purely in CSS, without reordering the DOM. */
|
|
175
316
|
display: grid;
|
|
176
|
-
grid-template-columns: 1fr;
|
|
317
|
+
grid-template-columns: minmax(0, 1fr);
|
|
177
318
|
grid-template-rows: auto auto minmax(0, 1fr);
|
|
178
319
|
grid-template-areas: 'header' 'video' 'chat';
|
|
179
320
|
overflow: hidden;
|
|
@@ -471,6 +612,7 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
471
612
|
.cf-msg {
|
|
472
613
|
display: flex;
|
|
473
614
|
gap: 8px;
|
|
615
|
+
min-width: 0;
|
|
474
616
|
max-width: 100%;
|
|
475
617
|
animation: cf-msg-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
|
|
476
618
|
}
|
|
@@ -524,6 +666,7 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
524
666
|
.cf-msg__bubble p { margin: 0 0 8px; }
|
|
525
667
|
.cf-msg__bubble p:last-child { margin-bottom: 0; }
|
|
526
668
|
.cf-msg__col { min-width: 0; max-width: 85%; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
|
|
669
|
+
.cf-msg__col--actions { flex: 1; max-width: 100%; }
|
|
527
670
|
.cf-msg--user .cf-msg__col { align-items: flex-end; }
|
|
528
671
|
.cf-artifact {
|
|
529
672
|
width: min(100%, 560px);
|
|
@@ -716,6 +859,7 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
716
859
|
/* Per-message 👍/👎 feedback. */
|
|
717
860
|
.cf-feedback { margin-top: 0; }
|
|
718
861
|
.cf-feedback__row { display: flex; align-items: center; gap: 4px; }
|
|
862
|
+
.cf-feedback__label { margin-right: 4px; color: var(--cf-muted); font-size: 11.5px; }
|
|
719
863
|
.cf-feedback__btn {
|
|
720
864
|
display: inline-flex;
|
|
721
865
|
align-items: center;
|
|
@@ -962,6 +1106,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
962
1106
|
display: flex;
|
|
963
1107
|
flex-direction: column;
|
|
964
1108
|
gap: 8px;
|
|
1109
|
+
width: 100%;
|
|
1110
|
+
min-width: 0;
|
|
1111
|
+
max-width: 100%;
|
|
965
1112
|
}
|
|
966
1113
|
|
|
967
1114
|
.cf-form {
|
|
@@ -969,6 +1116,7 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
969
1116
|
flex-direction: column;
|
|
970
1117
|
gap: 8px;
|
|
971
1118
|
width: 100%;
|
|
1119
|
+
min-width: 0;
|
|
972
1120
|
max-width: 300px;
|
|
973
1121
|
padding: 12px;
|
|
974
1122
|
border-radius: 14px;
|
|
@@ -977,9 +1125,11 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
977
1125
|
animation: cf-msg-in 0.2s ease both;
|
|
978
1126
|
}
|
|
979
1127
|
.cf-form__title { font-size: 13.5px; font-weight: 700; color: var(--cf-fg, var(--cf-text)); }
|
|
980
|
-
.cf-form__as { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; }
|
|
1128
|
+
.cf-form__as { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; overflow-wrap: anywhere; }
|
|
981
1129
|
.cf-form__input {
|
|
982
1130
|
width: 100%;
|
|
1131
|
+
min-width: 0;
|
|
1132
|
+
max-width: 100%;
|
|
983
1133
|
padding: 9px 11px;
|
|
984
1134
|
border: 1.5px solid var(--cf-border);
|
|
985
1135
|
border-radius: 10px;
|
|
@@ -1099,14 +1249,17 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1099
1249
|
.cf-phone__option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1100
1250
|
.cf-phone__option-code { color: var(--cf-muted); font-variant-numeric: tabular-nums; }
|
|
1101
1251
|
.cf-phone__empty { padding: 12px 8px; color: var(--cf-muted); font-size: 12px; text-align: center; }
|
|
1102
|
-
.cf-form__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
|
|
1252
|
+
.cf-form__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 2px; }
|
|
1103
1253
|
.cf-form__submit {
|
|
1254
|
+
min-height: 36px;
|
|
1255
|
+
max-width: 100%;
|
|
1104
1256
|
padding: 8px 14px;
|
|
1105
1257
|
border-radius: 10px;
|
|
1106
1258
|
font-size: 13.5px;
|
|
1107
1259
|
font-weight: 600;
|
|
1108
1260
|
background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
|
|
1109
1261
|
color: var(--cf-accent-ink);
|
|
1262
|
+
overflow-wrap: anywhere;
|
|
1110
1263
|
transition: opacity 0.15s ease, transform 0.1s ease;
|
|
1111
1264
|
}
|
|
1112
1265
|
.cf-form__submit:disabled { opacity: 0.45; cursor: default; }
|
|
@@ -1282,8 +1435,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1282
1435
|
|
|
1283
1436
|
/* ---------- Demo booking picker ---------- */
|
|
1284
1437
|
.cf-booking { max-width: 320px; }
|
|
1285
|
-
.cf-booking__hint { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; }
|
|
1438
|
+
.cf-booking__hint { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; line-height: 1.45; overflow-wrap: anywhere; }
|
|
1286
1439
|
.cf-booking__dur { font-weight: 600; color: var(--cf-text); }
|
|
1440
|
+
.cf-booking__timezone { display: block; margin-top: 3px; font-size: 11.5px; }
|
|
1287
1441
|
.cf-booking__state {
|
|
1288
1442
|
padding: 12px;
|
|
1289
1443
|
border: 1px dashed var(--cf-border);
|
|
@@ -1297,6 +1451,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1297
1451
|
.cf-booking__dates {
|
|
1298
1452
|
display: flex;
|
|
1299
1453
|
gap: 6px;
|
|
1454
|
+
width: 100%;
|
|
1455
|
+
min-width: 0;
|
|
1456
|
+
max-width: 100%;
|
|
1300
1457
|
overflow-x: auto;
|
|
1301
1458
|
padding-bottom: 4px;
|
|
1302
1459
|
scrollbar-width: thin;
|
|
@@ -1330,7 +1487,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1330
1487
|
.cf-booking__dom { font-size: 15px; font-weight: 700; line-height: 1.1; }
|
|
1331
1488
|
.cf-booking__slots {
|
|
1332
1489
|
display: grid;
|
|
1333
|
-
grid-template-columns: repeat(
|
|
1490
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 80px), 1fr));
|
|
1491
|
+
width: 100%;
|
|
1492
|
+
min-width: 0;
|
|
1334
1493
|
gap: 6px;
|
|
1335
1494
|
max-height: 156px;
|
|
1336
1495
|
overflow-y: auto;
|
|
@@ -1339,7 +1498,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1339
1498
|
.cf-booking__slots::-webkit-scrollbar { width: 6px; }
|
|
1340
1499
|
.cf-booking__slots::-webkit-scrollbar-thumb { background: var(--cf-border); border-radius: 3px; }
|
|
1341
1500
|
.cf-booking__slot {
|
|
1342
|
-
|
|
1501
|
+
min-width: 0;
|
|
1502
|
+
min-height: 36px;
|
|
1503
|
+
padding: 8px 4px;
|
|
1343
1504
|
border-radius: 9px;
|
|
1344
1505
|
border: 1px solid var(--cf-border);
|
|
1345
1506
|
background: var(--cf-bg);
|
|
@@ -1625,6 +1786,9 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1625
1786
|
white-space: nowrap;
|
|
1626
1787
|
}
|
|
1627
1788
|
.cf-action-drawer {
|
|
1789
|
+
width: 100%;
|
|
1790
|
+
min-width: 0;
|
|
1791
|
+
max-width: 100%;
|
|
1628
1792
|
border: 1px solid color-mix(in oklab, var(--cf-border) 86%, var(--cf-accent));
|
|
1629
1793
|
border-radius: 18px 18px 12px 12px;
|
|
1630
1794
|
padding: 7px;
|
|
@@ -1645,18 +1809,24 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1645
1809
|
background: color-mix(in oklab, var(--cf-muted) 42%, transparent);
|
|
1646
1810
|
}
|
|
1647
1811
|
.cf-action-drawer__head {
|
|
1812
|
+
position: sticky;
|
|
1813
|
+
top: -7px;
|
|
1814
|
+
z-index: 1;
|
|
1648
1815
|
display: flex;
|
|
1649
1816
|
align-items: center;
|
|
1650
1817
|
justify-content: space-between;
|
|
1651
1818
|
gap: 10px;
|
|
1652
1819
|
padding: 0 3px 6px;
|
|
1820
|
+
background: var(--cf-bg);
|
|
1653
1821
|
color: var(--cf-text);
|
|
1654
1822
|
}
|
|
1655
1823
|
.cf-action-drawer__head strong {
|
|
1656
1824
|
display: block;
|
|
1657
1825
|
font-size: 13px;
|
|
1658
1826
|
line-height: 1.2;
|
|
1827
|
+
overflow-wrap: anywhere;
|
|
1659
1828
|
}
|
|
1829
|
+
.cf-action-drawer__head > div { min-width: 0; }
|
|
1660
1830
|
.cf-action-drawer__eyebrow {
|
|
1661
1831
|
display: block;
|
|
1662
1832
|
margin-bottom: 2px;
|
|
@@ -1668,6 +1838,7 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1668
1838
|
}
|
|
1669
1839
|
.cf-action-drawer__close {
|
|
1670
1840
|
display: inline-flex;
|
|
1841
|
+
flex-shrink: 0;
|
|
1671
1842
|
align-items: center;
|
|
1672
1843
|
justify-content: center;
|
|
1673
1844
|
width: 28px;
|
|
@@ -1781,6 +1952,13 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1781
1952
|
background: transparent;
|
|
1782
1953
|
box-shadow: none;
|
|
1783
1954
|
}
|
|
1955
|
+
.cf-action-drawer .cf-form__actions {
|
|
1956
|
+
position: sticky;
|
|
1957
|
+
bottom: -7px;
|
|
1958
|
+
z-index: 1;
|
|
1959
|
+
padding-top: 8px;
|
|
1960
|
+
background: var(--cf-bg);
|
|
1961
|
+
}
|
|
1784
1962
|
.cf-footer-actions .cf-actions {
|
|
1785
1963
|
display: grid;
|
|
1786
1964
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
@@ -1805,6 +1983,14 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
1805
1983
|
.cf-footer-actions .cf-booking {
|
|
1806
1984
|
max-width: none;
|
|
1807
1985
|
}
|
|
1986
|
+
.cf-body .cf-action-drawer,
|
|
1987
|
+
.cf-footer-actions .cf-action-drawer {
|
|
1988
|
+
max-height: min(420px, 45dvh);
|
|
1989
|
+
overflow-y: auto;
|
|
1990
|
+
overflow-x: hidden;
|
|
1991
|
+
overscroll-behavior: contain;
|
|
1992
|
+
scrollbar-width: thin;
|
|
1993
|
+
}
|
|
1808
1994
|
|
|
1809
1995
|
@keyframes cf-drawer-up {
|
|
1810
1996
|
from {
|
|
@@ -2914,20 +3100,6 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
2914
3100
|
.cf-attach-x:hover { background: var(--cf-surface); color: var(--cf-text); }
|
|
2915
3101
|
.cf-attach-x svg { width: 11px; height: 11px; }
|
|
2916
3102
|
|
|
2917
|
-
/* ---------- Mobile: full-screen panel ---------- */
|
|
2918
|
-
@media (max-width: 480px) {
|
|
2919
|
-
.cf-panel {
|
|
2920
|
-
bottom: 0;
|
|
2921
|
-
right: 0;
|
|
2922
|
-
width: 100vw;
|
|
2923
|
-
max-width: 100vw;
|
|
2924
|
-
height: 100dvh;
|
|
2925
|
-
max-height: 100dvh;
|
|
2926
|
-
border-radius: 0;
|
|
2927
|
-
}
|
|
2928
|
-
.cf-launcher { bottom: 16px; right: 16px; }
|
|
2929
|
-
}
|
|
2930
|
-
|
|
2931
3103
|
/* ---------- Keyframes ---------- */
|
|
2932
3104
|
@keyframes cf-pop {
|
|
2933
3105
|
from { transform: scale(0); opacity: 0; }
|
|
@@ -2962,223 +3134,6 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
2962
3134
|
scroll-behavior: auto !important;
|
|
2963
3135
|
}
|
|
2964
3136
|
}
|
|
2965
|
-
.cf-analytics-visualization {
|
|
2966
|
-
box-sizing: border-box;
|
|
2967
|
-
width: 100%;
|
|
2968
|
-
max-width: 100%;
|
|
2969
|
-
margin-top: 8px;
|
|
2970
|
-
min-width: 0;
|
|
2971
|
-
overflow: hidden;
|
|
2972
|
-
border: 1px solid var(--cf-border);
|
|
2973
|
-
border-radius: 13px;
|
|
2974
|
-
background: var(--cf-surface);
|
|
2975
|
-
padding: 12px;
|
|
2976
|
-
color: var(--cf-muted);
|
|
2977
|
-
font-size: 11px;
|
|
2978
|
-
}
|
|
2979
|
-
.cf-analytics-visualization.is-expanded {
|
|
2980
|
-
display: flex;
|
|
2981
|
-
min-height: 100%;
|
|
2982
|
-
flex-direction: column;
|
|
2983
|
-
margin: 0;
|
|
2984
|
-
border: 0;
|
|
2985
|
-
border-radius: 0;
|
|
2986
|
-
background: transparent;
|
|
2987
|
-
padding: 0;
|
|
2988
|
-
}
|
|
2989
|
-
.cf-analytics-visualization__header {
|
|
2990
|
-
display: flex;
|
|
2991
|
-
width: 100%;
|
|
2992
|
-
min-width: 0;
|
|
2993
|
-
min-height: 32px;
|
|
2994
|
-
align-items: center;
|
|
2995
|
-
justify-content: space-between;
|
|
2996
|
-
gap: 10px;
|
|
2997
|
-
}
|
|
2998
|
-
.cf-analytics-visualization__header > div:first-child {
|
|
2999
|
-
min-width: 0;
|
|
3000
|
-
}
|
|
3001
|
-
.cf-analytics-visualization__actions {
|
|
3002
|
-
display: flex;
|
|
3003
|
-
flex: 0 0 auto;
|
|
3004
|
-
align-items: center;
|
|
3005
|
-
gap: 6px;
|
|
3006
|
-
}
|
|
3007
|
-
.cf-analytics-chart-picker {
|
|
3008
|
-
position: relative;
|
|
3009
|
-
display: inline-flex;
|
|
3010
|
-
min-width: 0;
|
|
3011
|
-
color: var(--cf-muted);
|
|
3012
|
-
font-size: 9px;
|
|
3013
|
-
font-weight: 700;
|
|
3014
|
-
}
|
|
3015
|
-
|
|
3016
|
-
.cf-analytics-chart-picker summary {
|
|
3017
|
-
display: inline-flex;
|
|
3018
|
-
min-width: 92px;
|
|
3019
|
-
max-width: 138px;
|
|
3020
|
-
height: 30px;
|
|
3021
|
-
align-items: center;
|
|
3022
|
-
gap: 6px;
|
|
3023
|
-
border: 1px solid var(--cf-border);
|
|
3024
|
-
border-radius: 8px;
|
|
3025
|
-
background: var(--cf-bg);
|
|
3026
|
-
padding: 0 8px;
|
|
3027
|
-
color: var(--cf-text);
|
|
3028
|
-
list-style: none;
|
|
3029
|
-
cursor: pointer;
|
|
3030
|
-
box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
|
|
3031
|
-
transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
|
|
3032
|
-
}
|
|
3033
|
-
|
|
3034
|
-
.cf-analytics-chart-picker summary::-webkit-details-marker { display: none; }
|
|
3035
|
-
.cf-analytics-chart-picker summary:hover,
|
|
3036
|
-
.cf-analytics-chart-picker[open] summary {
|
|
3037
|
-
border-color: var(--cf-accent);
|
|
3038
|
-
background: color-mix(in oklab, var(--cf-accent) 9%, var(--cf-bg));
|
|
3039
|
-
}
|
|
3040
|
-
.cf-analytics-chart-picker summary:focus-visible {
|
|
3041
|
-
outline: 2px solid var(--cf-accent);
|
|
3042
|
-
outline-offset: 2px;
|
|
3043
|
-
}
|
|
3044
|
-
.cf-analytics-chart-picker summary > svg:last-child {
|
|
3045
|
-
width: 13px;
|
|
3046
|
-
height: 13px;
|
|
3047
|
-
flex: 0 0 13px;
|
|
3048
|
-
margin-left: auto;
|
|
3049
|
-
color: var(--cf-muted);
|
|
3050
|
-
transition: transform .16s ease;
|
|
3051
|
-
}
|
|
3052
|
-
.cf-analytics-chart-picker[open] summary > svg:last-child { transform: rotate(180deg); }
|
|
3053
|
-
.cf-analytics-chart-picker__current {
|
|
3054
|
-
display: inline-flex;
|
|
3055
|
-
min-width: 0;
|
|
3056
|
-
align-items: center;
|
|
3057
|
-
gap: 6px;
|
|
3058
|
-
}
|
|
3059
|
-
.cf-analytics-chart-picker__current > span {
|
|
3060
|
-
overflow: hidden;
|
|
3061
|
-
text-overflow: ellipsis;
|
|
3062
|
-
white-space: nowrap;
|
|
3063
|
-
}
|
|
3064
|
-
.cf-chart-type-icon {
|
|
3065
|
-
width: 17px;
|
|
3066
|
-
height: 17px;
|
|
3067
|
-
flex: 0 0 17px;
|
|
3068
|
-
}
|
|
3069
|
-
.cf-analytics-chart-picker__menu {
|
|
3070
|
-
position: absolute;
|
|
3071
|
-
top: calc(100% + 7px);
|
|
3072
|
-
right: 0;
|
|
3073
|
-
z-index: 60;
|
|
3074
|
-
display: grid;
|
|
3075
|
-
min-width: 196px;
|
|
3076
|
-
padding: 6px;
|
|
3077
|
-
border: 1px solid var(--cf-border);
|
|
3078
|
-
border-radius: 12px;
|
|
3079
|
-
background: var(--cf-bg);
|
|
3080
|
-
box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
|
|
3081
|
-
}
|
|
3082
|
-
.cf-analytics-chart-picker__menu button {
|
|
3083
|
-
display: flex;
|
|
3084
|
-
width: 100%;
|
|
3085
|
-
min-height: 46px;
|
|
3086
|
-
align-items: flex-start;
|
|
3087
|
-
gap: 8px;
|
|
3088
|
-
border: 0;
|
|
3089
|
-
border-radius: 9px;
|
|
3090
|
-
background: transparent;
|
|
3091
|
-
padding: 7px;
|
|
3092
|
-
color: var(--cf-text);
|
|
3093
|
-
font: inherit;
|
|
3094
|
-
text-align: left;
|
|
3095
|
-
cursor: pointer;
|
|
3096
|
-
}
|
|
3097
|
-
.cf-analytics-chart-picker__menu button:hover,
|
|
3098
|
-
.cf-analytics-chart-picker__menu button.is-selected {
|
|
3099
|
-
background: color-mix(in oklab, var(--cf-accent) 10%, var(--cf-bg));
|
|
3100
|
-
color: var(--cf-accent);
|
|
3101
|
-
}
|
|
3102
|
-
.cf-analytics-chart-picker__menu button > svg:last-child {
|
|
3103
|
-
width: 13px;
|
|
3104
|
-
height: 13px;
|
|
3105
|
-
flex: 0 0 13px;
|
|
3106
|
-
margin-top: 4px;
|
|
3107
|
-
}
|
|
3108
|
-
.cf-analytics-chart-picker__icon {
|
|
3109
|
-
display: inline-flex;
|
|
3110
|
-
width: 30px;
|
|
3111
|
-
height: 30px;
|
|
3112
|
-
flex: 0 0 30px;
|
|
3113
|
-
align-items: center;
|
|
3114
|
-
justify-content: center;
|
|
3115
|
-
border-radius: 9px;
|
|
3116
|
-
background: var(--cf-bg-soft);
|
|
3117
|
-
box-shadow: inset 0 0 0 1px var(--cf-border);
|
|
3118
|
-
}
|
|
3119
|
-
.cf-analytics-chart-picker__icon .cf-chart-type-icon {
|
|
3120
|
-
width: 25px;
|
|
3121
|
-
height: 25px;
|
|
3122
|
-
flex-basis: 25px;
|
|
3123
|
-
}
|
|
3124
|
-
.cf-analytics-chart-picker__copy {
|
|
3125
|
-
display: grid;
|
|
3126
|
-
min-width: 0;
|
|
3127
|
-
flex: 1;
|
|
3128
|
-
gap: 2px;
|
|
3129
|
-
}
|
|
3130
|
-
.cf-analytics-chart-picker__copy strong {
|
|
3131
|
-
font-size: 10px;
|
|
3132
|
-
line-height: 1.25;
|
|
3133
|
-
}
|
|
3134
|
-
.cf-analytics-chart-picker__copy small {
|
|
3135
|
-
color: var(--cf-muted);
|
|
3136
|
-
font-size: 9px;
|
|
3137
|
-
font-weight: 560;
|
|
3138
|
-
line-height: 1.3;
|
|
3139
|
-
}
|
|
3140
|
-
.cf-analytics-visualization__title {
|
|
3141
|
-
overflow: hidden;
|
|
3142
|
-
color: var(--cf-muted);
|
|
3143
|
-
font-size: 10px;
|
|
3144
|
-
font-weight: 750;
|
|
3145
|
-
letter-spacing: .08em;
|
|
3146
|
-
text-overflow: ellipsis;
|
|
3147
|
-
text-transform: uppercase;
|
|
3148
|
-
white-space: nowrap;
|
|
3149
|
-
}
|
|
3150
|
-
.cf-analytics-meta {
|
|
3151
|
-
display: flex;
|
|
3152
|
-
flex-wrap: wrap;
|
|
3153
|
-
align-items: center;
|
|
3154
|
-
gap: 3px 7px;
|
|
3155
|
-
margin-top: 4px;
|
|
3156
|
-
color: var(--cf-muted);
|
|
3157
|
-
font-size: 9px;
|
|
3158
|
-
line-height: 1.35;
|
|
3159
|
-
}
|
|
3160
|
-
.cf-analytics-meta__dot {
|
|
3161
|
-
display: inline-block;
|
|
3162
|
-
width: 5px;
|
|
3163
|
-
height: 5px;
|
|
3164
|
-
margin-right: 4px;
|
|
3165
|
-
border-radius: 999px;
|
|
3166
|
-
background: var(--cf-accent);
|
|
3167
|
-
}
|
|
3168
|
-
.cf-analytics-visualization__download {
|
|
3169
|
-
width: fit-content;
|
|
3170
|
-
border: 1px solid var(--cf-border) !important;
|
|
3171
|
-
border-radius: 8px;
|
|
3172
|
-
background: var(--cf-surface) !important;
|
|
3173
|
-
padding: 6px 9px;
|
|
3174
|
-
color: var(--cf-text) !important;
|
|
3175
|
-
font-size: 10px;
|
|
3176
|
-
font-weight: 700;
|
|
3177
|
-
}
|
|
3178
|
-
.cf-analytics-visualization__download:hover {
|
|
3179
|
-
border-color: var(--cf-accent) !important;
|
|
3180
|
-
color: var(--cf-accent) !important;
|
|
3181
|
-
}
|
|
3182
3137
|
.cf-analytics-table-wrap {
|
|
3183
3138
|
box-sizing: border-box;
|
|
3184
3139
|
width: 100%;
|
|
@@ -3313,7 +3268,11 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
3313
3268
|
font-weight: 650;
|
|
3314
3269
|
}
|
|
3315
3270
|
.cf-segment.is-active { background: var(--cf-accent) !important;color: var(--cf-accent-ink) !important; }
|
|
3316
|
-
.cf-table-column-bar { display: flex;align-items: center;padding: 0 8px 7px; }
|
|
3271
|
+
.cf-table-column-bar { display: flex;align-items: center;flex-wrap: wrap;gap: 5px;padding: 0 8px 7px; }
|
|
3272
|
+
.cf-table-view-button { min-height: 27px;padding: 4px 6px;border: 1px solid var(--cf-border);border-radius: 7px;background: var(--cf-bg);color: var(--cf-text);cursor: pointer;font-size: 9px; }
|
|
3273
|
+
.cf-table-view-button[aria-pressed="true"] { background: var(--cf-surface); }
|
|
3274
|
+
.cf-table-filter-bar { display: flex;flex-wrap: wrap;gap: 4px;padding: 4px 8px; }
|
|
3275
|
+
.cf-table-filter-chip { padding: 4px 7px;border: 0;border-radius: 999px;background: var(--cf-surface);color: var(--cf-accent);cursor: pointer;font-size: 9px; }
|
|
3317
3276
|
.cf-column-picker { position: relative; }
|
|
3318
3277
|
.cf-column-picker > summary {
|
|
3319
3278
|
min-height: 27px;
|
|
@@ -3342,6 +3301,10 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
3342
3301
|
box-shadow: 0 10px 24px rgba(15,30,42,.16);
|
|
3343
3302
|
}
|
|
3344
3303
|
.cf-column-menu label { display: flex;align-items: center;gap: 7px;color: var(--cf-text);font-size: 9px; }
|
|
3304
|
+
.cf-column-picker-row { display: flex;align-items: center;gap: 3px; }
|
|
3305
|
+
.cf-column-picker-row label { min-width: 0;flex: 1; }
|
|
3306
|
+
.cf-column-picker-row button { width: 22px;height: 22px;border: 0;border-radius: 5px;background: transparent;color: var(--cf-muted);cursor: pointer; }
|
|
3307
|
+
.cf-column-picker-row button:disabled { opacity: .4;cursor: default; }
|
|
3345
3308
|
.cf-table-wrap {
|
|
3346
3309
|
position: relative;
|
|
3347
3310
|
min-height: 0;
|
|
@@ -3354,6 +3317,30 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
3354
3317
|
.cf-table { width: 100%;border-collapse: separate;border-spacing: 0;color: var(--cf-text);font-size: 10px; }
|
|
3355
3318
|
.cf-table th { position: sticky;top: 0;z-index: 1;background: var(--cf-surface);color: var(--cf-muted);font-size: 9px;font-weight: 720;text-align: left; }
|
|
3356
3319
|
.cf-table th,.cf-table td { padding: 8px 9px;border-bottom: 1px solid var(--cf-border);white-space: nowrap; }
|
|
3320
|
+
.cf-table.is-compact th,.cf-table.is-compact td { padding-top: 4px;padding-bottom: 4px; }
|
|
3321
|
+
.cf-table td.is-wrapped { min-width: 110px;max-width: 240px;white-space: normal;overflow-wrap: anywhere; }
|
|
3322
|
+
.cf-table th.is-pinned,.cf-table td.is-pinned { position: sticky;z-index: 2;background: var(--cf-bg);box-shadow: 3px 0 6px -5px var(--cf-muted); }
|
|
3323
|
+
.cf-table th.is-pinned { z-index: 4;background: var(--cf-surface); }
|
|
3324
|
+
.cf-table th:not(.cf-select-cell) { min-width: 100px; }
|
|
3325
|
+
.cf-table th:not(.cf-select-cell) .cf-table-sort { max-width: calc(100% - 18px); }
|
|
3326
|
+
.cf-table-column-menu { position: absolute;right: 3px;top: 4px; }
|
|
3327
|
+
.cf-table-column-menu > summary { display: flex;width: 17px;height: 17px;align-items: center;justify-content: center;border-radius: 4px;list-style: none;cursor: pointer; }
|
|
3328
|
+
.cf-table-column-menu > summary::-webkit-details-marker { display: none; }
|
|
3329
|
+
.cf-table-column-menu > summary:hover { background: var(--cf-surface); }
|
|
3330
|
+
.cf-table-column-panel { position: fixed;z-index: 2147483000;display: grid;gap: 4px;width: min(220px,calc(100vw - 20px));max-height: 65vh;overflow: auto;margin: 0;padding: 9px;border: 1px solid var(--cf-border);border-radius: 9px;background: var(--cf-bg);box-shadow: 0 12px 30px rgba(15,30,42,.2);color: var(--cf-text);text-align: left; }
|
|
3331
|
+
.cf-table-column-panel > strong { padding: 4px 6px;font-size: 10px; }
|
|
3332
|
+
.cf-table-column-panel > span { padding: 7px 6px 2px;border-top: 1px solid var(--cf-border);font-size: 9px;font-weight: 750;text-transform: uppercase; }
|
|
3333
|
+
.cf-table-column-panel input,.cf-table-column-panel select { min-width: 0;height: 27px;padding: 4px 6px;border: 1px solid var(--cf-border);border-radius: 6px;background: var(--cf-bg);color: var(--cf-text);font-size: 9px; }
|
|
3334
|
+
.cf-table-column-panel button { padding: 6px 7px;border: 0;border-radius: 6px;background: transparent;color: var(--cf-text);cursor: pointer;font-size: 9px;text-align: left; }
|
|
3335
|
+
.cf-table-column-panel button:hover { background: var(--cf-surface); }
|
|
3336
|
+
.cf-sdk-select { position: relative;min-width: 0; }
|
|
3337
|
+
.cf-sdk-select-trigger { display: flex;min-height: 27px;align-items: center;justify-content: space-between;gap: 7px;padding: 4px 7px;border: 1px solid var(--cf-border);border-radius: 6px;background: var(--cf-bg);color: var(--cf-text);cursor: pointer;list-style: none;font-size: 9px; }
|
|
3338
|
+
.cf-sdk-select-trigger::-webkit-details-marker { display: none; }
|
|
3339
|
+
.cf-sdk-select-trigger:focus-visible { outline: 2px solid var(--cf-accent);outline-offset: 2px; }
|
|
3340
|
+
.cf-sdk-select-list { position: fixed;z-index: 2147483000;display: none;max-height: 220px;overflow: auto;margin: 0;padding: 4px;border: 1px solid var(--cf-border);border-radius: 7px;background: var(--cf-bg);box-shadow: 0 12px 28px rgba(15,30,42,.2); }
|
|
3341
|
+
.cf-sdk-select-list:popover-open,.cf-sdk-select[open] > .cf-sdk-select-list:not(:popover-open) { display: grid; }
|
|
3342
|
+
.cf-sdk-select-list button { padding: 6px 8px;border: 0;border-radius: 5px;background: transparent;color: var(--cf-text);cursor: pointer;font-size: 9px;text-align: left; }
|
|
3343
|
+
.cf-sdk-select-list button:hover,.cf-sdk-select-list button[aria-selected="true"] { background: var(--cf-surface); }
|
|
3357
3344
|
.cf-table .cf-select-cell { width: 28px;padding-right: 3px;text-align: center; }
|
|
3358
3345
|
.cf-table input[type="checkbox"],.cf-column-menu input[type="checkbox"] { width: 13px;height: 13px;accent-color: var(--cf-accent); }
|
|
3359
3346
|
.cf-table-sort { display: flex !important;width: 100%;align-items: center;gap: 5px;color: inherit !important;font: inherit;text-align: left; }
|
|
@@ -3369,150 +3356,6 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
3369
3356
|
.cf-table-controls { grid-template-columns: 1fr; }
|
|
3370
3357
|
.cf-table-summary span:last-child { display: none; }
|
|
3371
3358
|
}
|
|
3372
|
-
.cf-analytics-visualization__expand,
|
|
3373
|
-
.cf-analytics-visualization__close {
|
|
3374
|
-
display: grid;
|
|
3375
|
-
width: 30px;
|
|
3376
|
-
height: 30px;
|
|
3377
|
-
flex: 0 0 auto;
|
|
3378
|
-
place-items: center;
|
|
3379
|
-
border: 1px solid var(--cf-border) !important;
|
|
3380
|
-
border-radius: 9px;
|
|
3381
|
-
background: var(--cf-bg) !important;
|
|
3382
|
-
color: var(--cf-text) !important;
|
|
3383
|
-
}
|
|
3384
|
-
.cf-analytics-visualization__expand:hover,
|
|
3385
|
-
.cf-analytics-visualization__close:hover { background: var(--cf-surface-2) !important; }
|
|
3386
|
-
.cf-analytics-visualization__expand:focus-visible,
|
|
3387
|
-
.cf-analytics-visualization__close:focus-visible {
|
|
3388
|
-
outline: 2px solid var(--cf-accent);
|
|
3389
|
-
outline-offset: 2px;
|
|
3390
|
-
}
|
|
3391
|
-
.cf-analytics-visualization__expand svg,
|
|
3392
|
-
.cf-analytics-visualization__close svg { width: 15px; height: 15px; }
|
|
3393
|
-
.cf-analytics-visualization__kpi {
|
|
3394
|
-
padding: 8px 0 6px;
|
|
3395
|
-
color: var(--cf-text);
|
|
3396
|
-
font-size: 30px;
|
|
3397
|
-
font-weight: 750;
|
|
3398
|
-
letter-spacing: -.035em;
|
|
3399
|
-
}
|
|
3400
|
-
.cf-analytics-kpi {
|
|
3401
|
-
padding: 9px 0 5px;
|
|
3402
|
-
}
|
|
3403
|
-
.cf-analytics-kpi__label {
|
|
3404
|
-
color: var(--cf-muted);
|
|
3405
|
-
font-size: 9px;
|
|
3406
|
-
font-weight: 700;
|
|
3407
|
-
letter-spacing: .06em;
|
|
3408
|
-
text-transform: uppercase;
|
|
3409
|
-
}
|
|
3410
|
-
.cf-analytics-kpi__value {
|
|
3411
|
-
margin-top: 5px;
|
|
3412
|
-
color: var(--cf-text);
|
|
3413
|
-
font-size: 30px;
|
|
3414
|
-
font-weight: 750;
|
|
3415
|
-
letter-spacing: -.035em;
|
|
3416
|
-
line-height: 1;
|
|
3417
|
-
}
|
|
3418
|
-
.cf-analytics-empty {
|
|
3419
|
-
margin-top: 8px;
|
|
3420
|
-
border: 1px dashed var(--cf-border);
|
|
3421
|
-
border-radius: 11px;
|
|
3422
|
-
padding: 18px 14px;
|
|
3423
|
-
color: var(--cf-text);
|
|
3424
|
-
text-align: center;
|
|
3425
|
-
}
|
|
3426
|
-
.cf-analytics-empty p { margin: 0; }
|
|
3427
|
-
.cf-analytics-empty p + p {
|
|
3428
|
-
margin-top: 4px;
|
|
3429
|
-
color: var(--cf-muted);
|
|
3430
|
-
font-size: 10px;
|
|
3431
|
-
}
|
|
3432
|
-
.cf-analytics-echart {
|
|
3433
|
-
position: relative;
|
|
3434
|
-
width: 100%;
|
|
3435
|
-
height: 196px;
|
|
3436
|
-
min-width: 0;
|
|
3437
|
-
}
|
|
3438
|
-
.cf-analytics-visualization.is-expanded .cf-analytics-echart {
|
|
3439
|
-
height: auto;
|
|
3440
|
-
min-height: 310px;
|
|
3441
|
-
flex: 1;
|
|
3442
|
-
}
|
|
3443
|
-
.cf-analytics-echart canvas:focus-visible {
|
|
3444
|
-
outline: 2px solid var(--cf-accent);
|
|
3445
|
-
outline-offset: -2px;
|
|
3446
|
-
}
|
|
3447
|
-
.cf-analytics-echart__fallback {
|
|
3448
|
-
display: grid;
|
|
3449
|
-
height: 100%;
|
|
3450
|
-
place-items: center;
|
|
3451
|
-
border: 1px dashed var(--cf-border);
|
|
3452
|
-
border-radius: 9px;
|
|
3453
|
-
padding: 16px;
|
|
3454
|
-
color: var(--cf-muted);
|
|
3455
|
-
text-align: center;
|
|
3456
|
-
line-height: 1.5;
|
|
3457
|
-
}
|
|
3458
|
-
.cf-analytics-zoom {
|
|
3459
|
-
display: flex;
|
|
3460
|
-
min-width: 0;
|
|
3461
|
-
align-items: center;
|
|
3462
|
-
justify-content: space-between;
|
|
3463
|
-
gap: 8px;
|
|
3464
|
-
margin-top: 4px;
|
|
3465
|
-
border-top: 1px solid var(--cf-border);
|
|
3466
|
-
padding-top: 8px;
|
|
3467
|
-
}
|
|
3468
|
-
.cf-analytics-zoom__range {
|
|
3469
|
-
min-width: 0;
|
|
3470
|
-
overflow: hidden;
|
|
3471
|
-
color: var(--cf-muted);
|
|
3472
|
-
font-size: 10px;
|
|
3473
|
-
font-weight: 650;
|
|
3474
|
-
line-height: 1.3;
|
|
3475
|
-
text-overflow: ellipsis;
|
|
3476
|
-
white-space: nowrap;
|
|
3477
|
-
}
|
|
3478
|
-
.cf-analytics-zoom__controls {
|
|
3479
|
-
display: inline-flex;
|
|
3480
|
-
flex: 0 0 auto;
|
|
3481
|
-
align-items: center;
|
|
3482
|
-
overflow: hidden;
|
|
3483
|
-
border: 1px solid var(--cf-border);
|
|
3484
|
-
border-radius: 9px;
|
|
3485
|
-
background: var(--cf-bg);
|
|
3486
|
-
}
|
|
3487
|
-
.cf-analytics-zoom__controls button {
|
|
3488
|
-
display: grid;
|
|
3489
|
-
min-width: 40px;
|
|
3490
|
-
height: 40px;
|
|
3491
|
-
place-items: center;
|
|
3492
|
-
border: 0 !important;
|
|
3493
|
-
border-radius: 0;
|
|
3494
|
-
background: transparent !important;
|
|
3495
|
-
color: var(--cf-text) !important;
|
|
3496
|
-
font: inherit;
|
|
3497
|
-
font-size: 16px;
|
|
3498
|
-
font-weight: 700;
|
|
3499
|
-
line-height: 1;
|
|
3500
|
-
}
|
|
3501
|
-
.cf-analytics-zoom__controls button + button { border-left: 1px solid var(--cf-border) !important; }
|
|
3502
|
-
.cf-analytics-zoom__controls button:hover:not(:disabled) { background: var(--cf-surface-2) !important; }
|
|
3503
|
-
.cf-analytics-zoom__controls button:focus-visible {
|
|
3504
|
-
position: relative;
|
|
3505
|
-
z-index: 1;
|
|
3506
|
-
outline: 2px solid var(--cf-accent);
|
|
3507
|
-
outline-offset: -2px;
|
|
3508
|
-
}
|
|
3509
|
-
.cf-analytics-zoom__controls button:disabled { cursor: not-allowed; opacity: .38; }
|
|
3510
|
-
.cf-analytics-zoom__controls .cf-analytics-zoom__reset {
|
|
3511
|
-
min-width: 56px;
|
|
3512
|
-
padding: 0 10px;
|
|
3513
|
-
font-size: 10px;
|
|
3514
|
-
font-weight: 700;
|
|
3515
|
-
}
|
|
3516
3359
|
.cf-analytics-focus {
|
|
3517
3360
|
height: 100%;
|
|
3518
3361
|
min-height: 0;
|
|
@@ -3529,6 +3372,14 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
3529
3372
|
.cf-panel--analytics-focus .cf-panel__video { height: 100%; }
|
|
3530
3373
|
.cf-panel--analytics-focus .cf-panel__chat { display: none; }
|
|
3531
3374
|
}
|
|
3375
|
+
.cf-analytics-expired {
|
|
3376
|
+
margin: 8px 0 0;
|
|
3377
|
+
padding: 8px 10px;
|
|
3378
|
+
border: 1px dashed var(--cf-border);
|
|
3379
|
+
border-radius: 10px;
|
|
3380
|
+
color: var(--cf-muted);
|
|
3381
|
+
font-size: 12.5px;
|
|
3382
|
+
}
|
|
3532
3383
|
.cf-analytics-explanation {
|
|
3533
3384
|
margin-top: 10px;
|
|
3534
3385
|
overflow: hidden;
|
|
@@ -3536,222 +3387,14 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
3536
3387
|
border-radius: 12px;
|
|
3537
3388
|
background: var(--cf-surface);
|
|
3538
3389
|
color: var(--cf-text);
|
|
3539
|
-
font-size: 12px;
|
|
3540
|
-
line-height: 1.55;
|
|
3541
|
-
}
|
|
3542
|
-
.cf-analytics-explanation h3,
|
|
3543
|
-
.cf-analytics-explanation h4,
|
|
3544
|
-
.cf-analytics-explanation p { margin: 0; }
|
|
3545
|
-
.cf-analytics-explanation__lead {
|
|
3546
|
-
border-bottom: 1px solid var(--cf-border);
|
|
3547
3390
|
padding: 12px;
|
|
3548
3391
|
}
|
|
3549
|
-
.cf-analytics-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
}
|
|
3555
|
-
.cf-analytics-explanation__eyebrow {
|
|
3556
|
-
color: var(--cf-accent);
|
|
3557
|
-
font-size: 9px;
|
|
3558
|
-
font-weight: 750;
|
|
3559
|
-
letter-spacing: .1em;
|
|
3560
|
-
text-transform: uppercase;
|
|
3561
|
-
}
|
|
3562
|
-
.cf-analytics-explanation__provenance {
|
|
3563
|
-
display: inline-flex;
|
|
3564
|
-
align-items: center;
|
|
3565
|
-
gap: 5px;
|
|
3566
|
-
color: var(--cf-muted);
|
|
3567
|
-
font-size: 9px;
|
|
3568
|
-
font-weight: 650;
|
|
3569
|
-
}
|
|
3570
|
-
.cf-analytics-explanation__provenance-dot {
|
|
3571
|
-
width: 5px;
|
|
3572
|
-
height: 5px;
|
|
3573
|
-
border-radius: 999px;
|
|
3574
|
-
background: var(--cf-accent);
|
|
3575
|
-
}
|
|
3576
|
-
.cf-analytics-explanation__headline {
|
|
3577
|
-
margin-top: 8px !important;
|
|
3578
|
-
color: var(--cf-text);
|
|
3579
|
-
font-size: 15px;
|
|
3580
|
-
font-weight: 750;
|
|
3581
|
-
letter-spacing: -.012em;
|
|
3582
|
-
line-height: 1.45;
|
|
3583
|
-
}
|
|
3584
|
-
.cf-analytics-explanation__summary {
|
|
3585
|
-
margin-top: 5px !important;
|
|
3586
|
-
color: var(--cf-muted);
|
|
3587
|
-
font-size: 12px;
|
|
3588
|
-
line-height: 1.6;
|
|
3589
|
-
}
|
|
3590
|
-
.cf-analytics-explanation__body {
|
|
3591
|
-
display: grid;
|
|
3592
|
-
gap: 14px;
|
|
3593
|
-
padding: 12px;
|
|
3594
|
-
}
|
|
3595
|
-
.cf-analytics-explanation__status { color: var(--cf-muted); }
|
|
3596
|
-
.cf-analytics-explanation__error {
|
|
3597
|
-
border-radius: 8px;
|
|
3598
|
-
background: color-mix(in srgb, #d97706 10%, var(--cf-surface));
|
|
3599
|
-
padding: 9px 10px;
|
|
3600
|
-
color: var(--cf-text);
|
|
3601
|
-
}
|
|
3602
|
-
.cf-analytics-explanation__heading {
|
|
3603
|
-
color: var(--cf-text);
|
|
3604
|
-
font-size: 12px;
|
|
3605
|
-
font-weight: 750;
|
|
3606
|
-
line-height: 1.45;
|
|
3607
|
-
}
|
|
3608
|
-
.cf-analytics-explanation__evidence {
|
|
3609
|
-
display: grid;
|
|
3610
|
-
gap: 7px;
|
|
3611
|
-
margin: 8px 0 0;
|
|
3612
|
-
padding: 0;
|
|
3613
|
-
list-style: none;
|
|
3614
|
-
color: var(--cf-muted);
|
|
3615
|
-
}
|
|
3616
|
-
.cf-analytics-explanation__evidence-item {
|
|
3617
|
-
display: flex;
|
|
3618
|
-
gap: 8px;
|
|
3619
|
-
align-items: flex-start;
|
|
3620
|
-
}
|
|
3621
|
-
.cf-analytics-explanation__evidence-bullet {
|
|
3622
|
-
width: 5px;
|
|
3623
|
-
height: 5px;
|
|
3624
|
-
flex: 0 0 auto;
|
|
3625
|
-
margin-top: 7px;
|
|
3626
|
-
border-radius: 999px;
|
|
3627
|
-
background: var(--cf-accent);
|
|
3628
|
-
}
|
|
3629
|
-
.cf-analytics-explanation__meaning {
|
|
3630
|
-
border-left: 2px solid var(--cf-accent);
|
|
3631
|
-
border-radius: 0 8px 8px 0;
|
|
3632
|
-
background: color-mix(in srgb, var(--cf-accent) 7%, var(--cf-surface));
|
|
3633
|
-
padding: 10px 11px;
|
|
3634
|
-
}
|
|
3635
|
-
.cf-analytics-explanation__paragraph {
|
|
3636
|
-
margin-top: 5px !important;
|
|
3637
|
-
color: var(--cf-muted);
|
|
3638
|
-
}
|
|
3639
|
-
.cf-analytics-explanation__section-heading,
|
|
3640
|
-
.cf-analytics-explanation__outlook-header {
|
|
3641
|
-
display: flex;
|
|
3642
|
-
flex-wrap: wrap;
|
|
3643
|
-
align-items: baseline;
|
|
3644
|
-
justify-content: space-between;
|
|
3645
|
-
gap: 4px 8px;
|
|
3646
|
-
}
|
|
3647
|
-
.cf-analytics-explanation__hint,
|
|
3648
|
-
.cf-analytics-explanation__outlook-badge {
|
|
3649
|
-
color: var(--cf-muted);
|
|
3650
|
-
font-size: 9px;
|
|
3651
|
-
font-weight: 650;
|
|
3652
|
-
}
|
|
3653
|
-
.cf-analytics-explanation__outlook-badge {
|
|
3654
|
-
color: var(--cf-accent);
|
|
3655
|
-
letter-spacing: .06em;
|
|
3656
|
-
text-transform: uppercase;
|
|
3657
|
-
}
|
|
3658
|
-
.cf-analytics-explanation__drivers,
|
|
3659
|
-
.cf-analytics-explanation__recommendations {
|
|
3660
|
-
display: grid;
|
|
3661
|
-
gap: 7px;
|
|
3662
|
-
margin-top: 8px;
|
|
3663
|
-
}
|
|
3664
|
-
.cf-analytics-explanation__driver {
|
|
3665
|
-
border-radius: 8px;
|
|
3666
|
-
background: var(--cf-bg);
|
|
3667
|
-
padding: 9px 10px;
|
|
3668
|
-
}
|
|
3669
|
-
.cf-analytics-explanation__driver-title,
|
|
3670
|
-
.cf-analytics-explanation__recommendation-title {
|
|
3671
|
-
color: var(--cf-text);
|
|
3672
|
-
font-weight: 750;
|
|
3673
|
-
}
|
|
3674
|
-
.cf-analytics-explanation__driver-body,
|
|
3675
|
-
.cf-analytics-explanation__recommendation-body {
|
|
3676
|
-
margin-top: 3px !important;
|
|
3677
|
-
color: var(--cf-muted);
|
|
3678
|
-
font-size: 11px;
|
|
3679
|
-
}
|
|
3680
|
-
.cf-analytics-explanation__driver-label { color: var(--cf-text); font-weight: 700; }
|
|
3681
|
-
.cf-analytics-explanation__recommendation {
|
|
3682
|
-
display: grid;
|
|
3683
|
-
grid-template-columns: 22px minmax(0, 1fr);
|
|
3684
|
-
gap: 8px;
|
|
3685
|
-
border-radius: 8px;
|
|
3686
|
-
background: var(--cf-bg);
|
|
3687
|
-
padding: 9px 10px;
|
|
3688
|
-
}
|
|
3689
|
-
.cf-analytics-explanation__recommendation-index {
|
|
3690
|
-
display: grid;
|
|
3691
|
-
width: 22px;
|
|
3692
|
-
height: 22px;
|
|
3693
|
-
place-items: center;
|
|
3694
|
-
border-radius: 999px;
|
|
3695
|
-
background: color-mix(in srgb, var(--cf-accent) 12%, var(--cf-surface));
|
|
3696
|
-
color: var(--cf-accent);
|
|
3697
|
-
font-size: 10px;
|
|
3698
|
-
font-weight: 750;
|
|
3699
|
-
}
|
|
3700
|
-
.cf-analytics-explanation__outlook {
|
|
3701
|
-
border-radius: 8px;
|
|
3702
|
-
background: var(--cf-bg);
|
|
3703
|
-
padding: 10px 11px;
|
|
3704
|
-
}
|
|
3705
|
-
.cf-analytics-explanation__follow-up {
|
|
3706
|
-
border-top: 1px solid var(--cf-border);
|
|
3707
|
-
padding-top: 12px;
|
|
3708
|
-
}
|
|
3709
|
-
.cf-analytics-explanation__questions {
|
|
3710
|
-
display: grid;
|
|
3711
|
-
gap: 6px;
|
|
3712
|
-
margin-top: 8px;
|
|
3713
|
-
}
|
|
3714
|
-
.cf-analytics-explanation__question {
|
|
3715
|
-
width: 100%;
|
|
3716
|
-
border: 1px solid var(--cf-border);
|
|
3717
|
-
border-radius: 8px;
|
|
3718
|
-
background: var(--cf-bg);
|
|
3719
|
-
padding: 8px 9px;
|
|
3720
|
-
color: var(--cf-text);
|
|
3721
|
-
font: inherit;
|
|
3722
|
-
text-align: left;
|
|
3723
|
-
cursor: pointer;
|
|
3724
|
-
}
|
|
3725
|
-
.cf-analytics-explanation__question:hover {
|
|
3726
|
-
border-color: color-mix(in srgb, var(--cf-accent) 45%, var(--cf-border));
|
|
3727
|
-
background: color-mix(in srgb, var(--cf-accent) 6%, var(--cf-bg));
|
|
3728
|
-
}
|
|
3729
|
-
.cf-analytics-explanation__question:focus-visible,
|
|
3730
|
-
.cf-analytics-explanation__limits-summary:focus-visible {
|
|
3731
|
-
outline: 2px solid var(--cf-accent);
|
|
3732
|
-
outline-offset: 2px;
|
|
3733
|
-
}
|
|
3734
|
-
.cf-analytics-explanation__limits {
|
|
3735
|
-
border-top: 1px solid var(--cf-border);
|
|
3736
|
-
padding-top: 10px;
|
|
3737
|
-
}
|
|
3738
|
-
.cf-analytics-explanation__limits-summary {
|
|
3739
|
-
cursor: pointer;
|
|
3740
|
-
color: var(--cf-text);
|
|
3741
|
-
font-weight: 700;
|
|
3742
|
-
}
|
|
3743
|
-
.cf-analytics-explanation__limits-list {
|
|
3744
|
-
margin: 8px 0 0;
|
|
3745
|
-
padding-left: 17px;
|
|
3746
|
-
color: var(--cf-muted);
|
|
3747
|
-
}
|
|
3748
|
-
.cf-analytics-explanation__source {
|
|
3749
|
-
border-top: 1px solid var(--cf-border);
|
|
3750
|
-
margin: 0;
|
|
3751
|
-
padding: 9px 12px;
|
|
3752
|
-
color: var(--cf-muted);
|
|
3753
|
-
font-size: 10px;
|
|
3754
|
-
}
|
|
3392
|
+
.cf-analytics-explanation.is-expanded { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 0; }
|
|
3393
|
+
.cf-analytics-explanation .cf-xp { font-size: 12px; }
|
|
3394
|
+
.cf-analytics-explanation.is-expanded .cf-xp { font-size: 14px; }
|
|
3395
|
+
.cf-analytics-explanation .cf-xp__headline { font-size: 15px; }
|
|
3396
|
+
${Ml("cf",{surface:"var(--cf-surface)",subtle:"var(--cf-bg)",text:"var(--cf-text)",muted:"var(--cf-muted)",border:"var(--cf-border)",accent:"var(--cf-accent)",warning:"var(--cf-warning)",danger:"var(--cf-danger)",success:"var(--cf-success)",onAccent:"var(--cf-accent-ink)"})}
|
|
3397
|
+
${xc("cf",{bg:"var(--cf-bg)",surface:"var(--cf-surface)",surface2:"var(--cf-surface-2)",text:"var(--cf-text)",muted:"var(--cf-muted)",border:"var(--cf-border)",accent:"var(--cf-accent)",onAccent:"var(--cf-accent-ink)",chart:bc,chartDark:vc,darkSelector:".cf-root[data-theme='dark']"})}
|
|
3755
3398
|
|
|
3756
3399
|
@media (max-width: 639px) {
|
|
3757
3400
|
.cf-panel.cf-panel--analytics-focus {
|
|
@@ -3872,4 +3515,4 @@ ${W}`.trim(),z,W)},[O,Fr,rn]),Za=Y(()=>{const E=o.current&&!o.current.signal.abo
|
|
|
3872
3515
|
max-height: calc(100dvh - 24px);
|
|
3873
3516
|
}
|
|
3874
3517
|
}
|
|
3875
|
-
`,
|
|
3518
|
+
`,Cr="centrinfo-widget";class op extends HTMLElement{constructor(){super(...arguments);q(this,"controls",null);q(this,"composerDraftStore",{value:""})}mountWith(n){const a=ip(n),i=this.shadowRoot??this.attachShadow({mode:"open"});if(this.style.zIndex=String(a.zIndex),"adoptedStyleSheets"in Document.prototype&&typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync=="function"){const s=new CSSStyleSheet;s.replaceSync(Ro),i.adoptedStyleSheets=[s]}else{const s=document.createElement("style");a.styleNonce&&(s.nonce=a.styleNonce),s.textContent=Ro,i.appendChild(s)}const o=Pc(a);Jr(r(tp,{transport:o,config:a,bindControls:s=>this.controls=s,composerDraftStore:this.composerDraftStore}),i)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(n){this.controls?.identify(n)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&Jr(null,this.shadowRoot)}}typeof customElements<"u"&&!customElements.get(Cr)&&customElements.define(Cr,op);const sp=(e,t=document.body)=>{if(typeof document>"u")throw new Error("[centrinfo-widget] createWidget must run in a browser.");const n=document.createElement(Cr);return n.style.pointerEvents="none",n.style.position="fixed",n.style.inset="0",n.style.width="0",n.style.height="0",t.appendChild(n),n.mountWith(e),{open:()=>n.open(),close:()=>n.close(),toggle:()=>n.toggle(),show:()=>n.open(),hide:()=>n.close(),identify:a=>n.identify(a),update:a=>n.identify(a),clear:()=>n.clear(),shutdown:()=>n.shutdown(),logout:()=>n.shutdown(),destroy:()=>{n.unmount(),n.remove()}}},Lo=e=>sp(e);let Do=null;const Po=e=>{Do?.destroy();const t=Lo(e);return Do=t,t},cp=e=>e==="light"||e==="dark"||e==="auto"?e:void 0,qn=e=>{if(e==null||e.trim()==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0},lp=e=>{if(e)try{const t=JSON.parse(e);return t&&typeof t=="object"?t:void 0}catch{return}},dp=e=>{const t=a=>e.getAttribute(a),n=t("data-token");return n?{token:n,apiBaseUrl:t("data-api-base")??void 0,accentColor:t("data-accent")??void 0,agentName:t("data-agent-name")??void 0,agentAvatarUrl:t("data-agent-avatar-url")??void 0,launcherIcon:t("data-launcher-icon")??void 0,gifApiKey:t("data-gif-api-key")??void 0,theme:cp(t("data-theme")),sound:t("data-sound")!=="false",openByDefault:t("data-open")==="true",demo:t("data-demo")==="true",preview:t("data-preview")==="true",alignment:t("data-alignment")==="left"?"left":void 0,horizontalPadding:qn(t("data-horizontal-padding")),verticalPadding:qn(t("data-vertical-padding")),hideDefaultLauncher:t("data-hide-launcher")==="true",styleNonce:(t("data-style-nonce")??e.nonce)||void 0,customLauncherSelector:t("data-custom-launcher-selector")??void 0,sessionDurationMinutes:qn(t("data-session-duration")),configRefreshSeconds:qn(t("data-config-refresh")),proactiveMessage:t("data-proactive-message")??void 0,proactiveDelaySeconds:qn(t("data-proactive-delay")),csat:t("data-csat")==="false"?!1:void 0,user:lp(t("data-user"))}:null},up=document.currentScript?.src||document.querySelector('script[src*="centrinfo-widget"]')?.src||"",Oo=e=>new URL(e,up||location.href).href;Fs(()=>import(Oo("centrinfo-widget-charts.js"))),Dc(()=>import(Oo("centrinfo-widget-dev.js")));const pp=e=>{typeof document>"u"||(document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e,{once:!0}))},fp=()=>{const e=document.currentScript??document.querySelector("script[data-token]");if(!e)return;const t=dp(e);t&&Po(t)};pp(()=>{try{fp()}catch(e){console.error("[centrinfo-widget]",e)}});const Fo=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}));return St.createWidget=Lo,St.init=Po,Object.defineProperty(St,Symbol.toStringTag,{value:"Module"}),St})({});
|