|
- import{j as $,E as Zu,I as Ju,b as Qu,D as jC,n as OI,B as Zv,C as Sh,A as zC,l as GS,m as Xd,o as HC,p as td,q as WS,r as NS,s as DI,t as LI,S as BI,M as II,u as Fh,v as FI,d as jI,w as zI,x as HI,y as GI,z as WI,G as NI,H as VI}from"./semi-ui-BMB0_gSU.js";import{g as GC,R as Wi,r as yt,u as WC}from"./react-core-CMEN6BYR.js";import{bT as Cb,aT as UI,aU as $I,bU as kp,bV as Pb,bW as Eb,bX as NC,bY as YI,bZ as Gp,b_ as XI,b$ as KI,c0 as qI,aW as ZI,aV as JI,c1 as QI,A as Lm,s as Bm,c2 as Wr,c3 as t2,c4 as e2,c5 as i2,c6 as jh,c7 as ja,c8 as s2,c9 as n2,ca as r2,aR as a2,cb as o2}from"./index-gPcw8Cof.js";import{u as VC}from"./i18n-D_ruByvS.js";import{m as Jv}from"./tools-DogoVVJ5.js";import"./react-components-CFDFlXwp.js";const VS={mode:"desktop-browser"},To={shadows:"",bordered:!0,headerLine:!0},Im="flex items-center gap-2",No={width:96,height:96},l2=[{label:"小时",value:"hour"},{label:"天",value:"day"},{label:"周",value:"week"}],US={hour:{seconds:3600,minutes:60},day:{seconds:86400,minutes:1440},week:{seconds:604800,minutes:10080}},h2=[{color:"grey",label:"默认",type:"default"},{color:"blue",label:"进行中",type:"ongoing"},{color:"green",label:"成功",type:"success"},{color:"orange",label:"警告",type:"warning"},{color:"red",label:"异常",type:"error"}],Fm={1:{color:"#10b981",label:"正常",text:"可用率"},0:{color:"#ef4444",label:"异常",text:"有异常"},2:{color:"#f59e0b",label:"高延迟",text:"高延迟"},3:{color:"#3b82f6",label:"维护中",text:"维护中"}},d2={DATA_EXPORT_DEFAULT_TIME:"data_export_default_time"},$S={MAX_TREND_POINTS:7};/**
- * @license lucide-react v0.511.0 - ISC
- *
- * This source code is licensed under the ISC license.
- * See the LICENSE file in the root directory of this source tree.
- */const u2=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],c2=Cb("chart-pie",u2);/**
- * @license lucide-react v0.511.0 - ISC
- *
- * This source code is licensed under the ISC license.
- * See the LICENSE file in the root directory of this source tree.
- */const p2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],g2=Cb("external-link",p2);/**
- * @license lucide-react v0.511.0 - ISC
- *
- * This source code is licensed under the ISC license.
- * See the LICENSE file in the root directory of this source tree.
- */const f2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_2=Cb("search",f2),UC=()=>localStorage.getItem(d2.DATA_EXPORT_DEFAULT_TIME)||"hour",$C=(s,t=!1)=>{const e=US[s]||US.hour;return t?e.seconds:e.minutes},m2=()=>{const s=UC(),t=new Date().getTime()/1e3;switch(s){case"hour":return kp(t-86400);case"week":return kp(t-86400*30);default:return kp(t-86400*7)}},YS=(s,t,e)=>{s.has(t)||s.set(t,0),s.set(t,s.get(t)+e)},v2=(s,...t)=>{t.forEach(e=>{e.has(s)||e.set(s,0)})},Cc=(s,t,e,i,n)=>{s(r=>({...r,data:[{id:n,values:t}],title:{...r.title,subtext:e},color:{specified:i}}))},y2=(s,t)=>({type:"line",data:[{id:"trend",values:s.map((e,i)=>({x:i,y:e}))}],xField:"x",yField:"y",height:40,width:100,axes:[{orient:"bottom",visible:!1},{orient:"left",visible:!1}],padding:0,autoFit:!1,legends:{visible:!1},tooltip:{visible:!1},crosshair:{visible:!1},line:{style:{stroke:t,lineWidth:2}},point:{visible:!1},background:{fill:"transparent"}}),Pc=(s,t)=>$.jsxs("div",{className:"flex items-center gap-2",children:[$.jsx(s,{size:16}),t]}),b2=async(s,t)=>{await UI(s)&&$I(t("复制成功"))},x2=s=>{const e=`https://www.tcptest.cn/http/${encodeURIComponent(s)}`;window.open(e,"_blank","noopener,noreferrer")},S2=(s,t)=>{var e;return((e=t[s])==null?void 0:e.color)||"#8b9aa7"},A2=(s,t,e)=>{var i;return((i=t[s])==null?void 0:i.text)||e("未知")},k2=(s,t,e,i)=>{if(!s||s.length===0)return $.jsx("div",{className:"flex justify-center items-center py-4",children:$.jsx(Zu,{image:$.jsx(Qu,{style:No}),darkModeImage:$.jsx(Ju,{style:No}),title:i("暂无监控数据")})});const n={};s.forEach(a=>{const o=a.group||"";n[o]||(n[o]=[]),n[o].push(a)});const r=(a,o)=>$.jsxs("div",{className:"p-2 hover:bg-white rounded-lg transition-colors",children:[$.jsxs("div",{className:"flex items-center justify-between mb-1",children:[$.jsxs("div",{className:"flex items-center gap-2",children:[$.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:t(a.status)}}),$.jsx("span",{className:"text-sm font-medium text-gray-900",children:a.name})]}),$.jsxs("span",{className:"text-xs text-gray-500",children:[((a.uptime||0)*100).toFixed(2),"%"]})]}),$.jsxs("div",{className:"flex items-center gap-2",children:[$.jsx("span",{className:"text-xs text-gray-500",children:e(a.status)}),$.jsx("div",{className:"flex-1",children:$.jsx(OI,{percent:(a.uptime||0)*100,showInfo:!1,"aria-label":`${a.name} uptime`,stroke:t(a.status)})})]})]},o);return Object.entries(n).map(([a,o])=>$.jsxs("div",{className:"mb-2",children:[a&&$.jsxs($.Fragment,{children:[$.jsx("div",{className:"text-md font-semibold text-gray-500 px-2 py-1",children:a}),$.jsx(jC,{})]}),o.map(r)]},a||"default"))},w2=(s,t,e,i)=>{const n={totalQuota:0,totalTimes:0,totalTokens:0,uniqueModels:new Set,timePoints:[],timeQuotaMap:new Map,timeTokensMap:new Map,timeCountMap:new Map},r=Pb(s.map(a=>a.created_at));return s.forEach(a=>{n.uniqueModels.add(a.model_name),n.totalTokens+=a.token_used,n.totalQuota+=a.quota,n.totalTimes+=a.count;const o=Eb(a.created_at,t,r);n.timePoints.includes(o)||n.timePoints.push(o),e(o,n.timeQuotaMap,n.timeTokensMap,n.timeCountMap),i(n.timeQuotaMap,o,a.quota),i(n.timeTokensMap,o,a.token_used),i(n.timeCountMap,o,a.count)}),n.timePoints.sort(),n},T2=(s,t,e,i,n)=>{const r=s.map(d=>t.get(d)||0),a=s.map(d=>e.get(d)||0),o=s.map(d=>i.get(d)||0),l=[],h=[];if(s.length>=2){const d=$C(n);for(let u=0;u<s.length;u++)l.push(i.get(s[u])/d),h.push(e.get(s[u])/d)}return{balance:[],usedQuota:[],requestCount:[],times:o,consumeQuota:r,tokens:a,rpm:l,tpm:h}},M2=(s,t)=>{const e=new Map,i=Pb(s.map(n=>n.created_at));return s.forEach(n=>{const r=Eb(n.created_at,t,i),a=n.model_name,o=`${r}-${a}`;e.has(o)||e.set(o,{time:r,model:a,quota:0,count:0});const l=e.get(o);l.quota+=n.quota,l.count+=n.count}),e},C2=(s,t,e)=>{let i=Array.from(new Set([...s.values()].map(n=>n.time)));if(i.length<$S.MAX_TREND_POINTS){const n=Math.max(...t.map(l=>l.created_at)),r=$C(e,!0),a=Array.from({length:$S.MAX_TREND_POINTS},(l,h)=>n-(6-h)*r),o=Pb(a);i=a.map(l=>Eb(l,e,o))}return i},P2=({getGreeting:s,greetingVisible:t,showSearchModal:e,refresh:i,loading:n,t:r})=>{const a="text-white hover:bg-opacity-80 !rounded-full";return $.jsxs("div",{className:"flex items-center justify-between mb-4",children:[$.jsx("h2",{className:"text-2xl font-semibold text-gray-800 transition-opacity duration-1000 ease-in-out",style:{opacity:t?1:0},children:s}),$.jsxs("div",{className:"flex gap-3",children:[$.jsx(Zv,{type:"tertiary",icon:$.jsx(_2,{size:16}),onClick:e,className:`bg-green-500 hover:bg-green-600 ${a}`}),$.jsx(Zv,{type:"tertiary",icon:$.jsx(NC,{size:16}),onClick:i,loading:n,className:`bg-blue-500 hover:bg-blue-600 ${a}`})]})]})},E2=s=>s;var Ze;(function(s){s["desktop-browser"]="desktop-browser",s["mobile-browser"]="mobile-browser",s.node="node",s.worker="worker",s.miniApp="miniApp",s.wx="wx",s["desktop-miniApp"]="desktop-miniApp",s.lynx="lynx"})(Ze||(Ze={}));var J;(function(s){s.cartesianAxis="cartesianAxis",s.cartesianBandAxis="cartesianAxis-band",s.cartesianLinearAxis="cartesianAxis-linear",s.cartesianTimeAxis="cartesianAxis-time",s.cartesianLogAxis="cartesianAxis-log",s.cartesianSymlogAxis="cartesianAxis-symlog",s.polarAxis="polarAxis",s.polarBandAxis="polarAxis-band",s.polarLinearAxis="polarAxis-linear",s.crosshair="crosshair",s.cartesianCrosshair="cartesianCrosshair",s.polarCrosshair="polarCrosshair",s.dataZoom="dataZoom",s.geoCoordinate="geoCoordinate",s.indicator="indicator",s.discreteLegend="discreteLegend",s.continuousLegend="continuousLegend",s.colorLegend="colorLegend",s.sizeLegend="sizeLegend",s.mapLabel="mapLabel",s.markLine="markLine",s.markArea="markArea",s.markPoint="markPoint",s.tooltip="tooltip",s.title="title",s.player="player",s.scrollBar="scrollBar",s.label="label",s.totalLabel="totalLabel",s.brush="brush",s.poptip="poptip",s.customMark="customMark"})(J||(J={}));var YC={exports:{}};(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function n(l,h,d){this.fn=l,this.context=h,this.once=d||!1}function r(l,h,d,u,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new n(d,u||l,c),g=e?e+h:h;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],p]:l._events[g].push(p):(l._events[g]=p,l._eventsCount++),l}function a(l,h){--l._eventsCount===0?l._events=new i:delete l._events[h]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var h=[],d,u;if(this._eventsCount===0)return h;for(u in d=this._events)t.call(d,u)&&h.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(d)):h},o.prototype.listeners=function(h){var d=e?e+h:h,u=this._events[d];if(!u)return[];if(u.fn)return[u.fn];for(var c=0,p=u.length,g=new Array(p);c<p;c++)g[c]=u[c].fn;return g},o.prototype.listenerCount=function(h){var d=e?e+h:h,u=this._events[d];return u?u.fn?1:u.length:0},o.prototype.emit=function(h,d,u,c,p,g){var f=e?e+h:h;if(!this._events[f])return!1;var _=this._events[f],m=arguments.length,v,y;if(_.fn){switch(_.once&&this.removeListener(h,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,u),!0;case 4:return _.fn.call(_.context,d,u,c),!0;case 5:return _.fn.call(_.context,d,u,c,p),!0;case 6:return _.fn.call(_.context,d,u,c,p,g),!0}for(y=1,v=new Array(m-1);y<m;y++)v[y-1]=arguments[y];_.fn.apply(_.context,v)}else{var b=_.length,x;for(y=0;y<b;y++)switch(_[y].once&&this.removeListener(h,_[y].fn,void 0,!0),m){case 1:_[y].fn.call(_[y].context);break;case 2:_[y].fn.call(_[y].context,d);break;case 3:_[y].fn.call(_[y].context,d,u);break;case 4:_[y].fn.call(_[y].context,d,u,c);break;default:if(!v)for(x=1,v=new Array(m-1);x<m;x++)v[x-1]=arguments[x];_[y].fn.apply(_[y].context,v)}}return!0},o.prototype.on=function(h,d,u){return r(this,h,d,u,!1)},o.prototype.once=function(h,d,u){return r(this,h,d,u,!0)},o.prototype.removeListener=function(h,d,u,c){var p=e?e+h:h;if(!this._events[p])return this;if(!d)return a(this,p),this;var g=this._events[p];if(g.fn)g.fn===d&&(!c||g.once)&&(!u||g.context===u)&&a(this,p);else{for(var f=0,_=[],m=g.length;f<m;f++)(g[f].fn!==d||c&&!g[f].once||u&&g[f].context!==u)&&_.push(g[f]);_.length?this._events[p]=_.length===1?_[0]:_:a(this,p)}return this},o.prototype.removeAllListeners=function(h){var d;return h?(d=e?e+h:h,this._events[d]&&a(this,d)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,s.exports=o})(YC);var R2=YC.exports;const vo=GC(R2),Ah=(s,t)=>Object.prototype.toString.call(s)===`[object ${t}]`,pe=(s,t=!1)=>t?typeof s=="boolean":s===!0||s===!1||Ah(s,"Boolean"),q=s=>typeof s=="function",C=s=>s==null,E=s=>s!=null,Vt=s=>{const t=typeof s;return s!==null&&t==="object"||t==="function"},Qv=s=>typeof s=="object"&&s!==null,vn=function(s){if(!Qv(s)||!Ah(s,"Object"))return!1;if(Object.getPrototypeOf(s)===null)return!0;let t=s;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(s)===t},ke=s=>s===void 0,ot=(s,t=!1)=>{const e=typeof s;return t?e==="string":e==="string"||Ah(s,"String")},U=s=>Array.isArray?Array.isArray(s):Ah(s,"Array"),__=function(s){return s!==null&&typeof s!="function"&&Number.isFinite(s.length)},O2=s=>Ah(s,"Date"),lt=(s,t=!1)=>{const e=typeof s;return t?e==="number":e==="number"||Ah(s,"Number")},D2=s=>typeof s=="string"&&!isNaN(Number(s))&&!isNaN(parseFloat(s)),H=s=>lt(s)&&Number.isFinite(s),XC=s=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(s),KC=s=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s),L2=s=>({}).toString.call(s).replace(/^\[object /,"").replace(/]$/,""),B2=Object.prototype,I2=function(s){const t=s&&s.constructor;return s===(typeof t=="function"&&t.prototype||B2)},F2=Object.prototype.hasOwnProperty;function ft(s){if(C(s))return!0;if(__(s))return!s.length;const t=L2(s);if(t==="Map"||t==="Set")return!s.size;if(I2(s))return!Object.keys(s).length;for(const e in s)if(F2.call(s,e))return!1;return!0}const Et=(s,t,e)=>{const i=ot(t)?t.split("."):t;for(let n=0;n<i.length;n++)s=s?s[i[n]]:void 0;return s===void 0?e:s},j2=Object.prototype.hasOwnProperty,Gs=(s,t)=>s!=null&&j2.call(s,t);function hi(s){let t;if(!E(s)||typeof s!="object")return s;const e=U(s),i=s.length;t=e?new Array(i):typeof s=="object"?{}:pe(s)||lt(s)||ot(s)?s:O2(s)?new Date(+s):void 0;const n=e?void 0:Object.keys(Object(s));let r=-1;if(t)for(;++r<(n||s).length;){const a=n?n[r]:r,o=s[a];t[a]=hi(o)}return t}function qC(s,t,e=!1){if(t){if(s===t)return;if(E(t)&&typeof t=="object"){const i=Object(t),n=[];for(const o in i)n.push(o);let{length:r}=n,a=-1;for(;r--;){const o=n[++a];E(i[o])&&typeof i[o]=="object"?z2(s,t,o,e):ZC(s,o,i[o])}}}}function z2(s,t,e,i=!1){const n=s[e],r=t[e];let a=t[e],o=!0;if(U(r)){if(i)a=[];else if(U(n))a=n;else if(__(n)){a=new Array(n.length);let l=-1;const h=n.length;for(;++l<h;)a[l]=n[l]}}else vn(r)?(a=n,typeof n!="function"&&typeof n=="object"||(a={})):o=!1;o&&qC(a,r,i),ZC(s,e,a)}function ZC(s,t,e){(e!==void 0&&!H2(s[t],e)||e===void 0&&!(t in s))&&(s[t]=e)}function H2(s,t){return s===t||Number.isNaN(s)&&Number.isNaN(t)}function at(s,...t){let e=-1;const i=t.length;for(;++e<i;)qC(s,t[e],!0);return s}function Kl(s,t){if(!s||!vn(s))return s;const e={};return Object.keys(s).forEach(i=>{const n=s[i];let r=!1;t.forEach(a=>{(ot(a)&&a===i||a instanceof RegExp&&i.match(a))&&(r=!0)}),r||(e[i]=n)}),e}function XS(s){return Object.prototype.toString.call(s)}function KS(s){return Object.keys(s)}function _e(s,t,e){if(s===t)return!0;if(typeof s!=typeof t||s==null||t==null)return!1;if(Number.isNaN(s)&&Number.isNaN(t))return!0;if(XS(s)!==XS(t))return!1;if(q(s))return!!(e!=null&&e.skipFunction);if(typeof s!="object")return!1;if(U(s)){if(s.length!==t.length)return!1;for(let r=s.length-1;r>=0;r--)if(!_e(s[r],t[r],e))return!1;return!0}if(!vn(s))return!1;const i=KS(s),n=KS(t);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let r=i.length-1;r>=0;r--)if(i[r]!=n[r])return!1;for(let r=i.length-1;r>=0;r--){const a=i[r];if(!_e(s[a],t[a],e))return!1}return!0}function G2(s){if(!s)return[];if(Object.keys)return Object.keys(s);const t=[];for(const e in s)s.hasOwnProperty(e)&&t.push(e);return t}function W2(s,t,e){const i=G2(t);for(let n=0;n<i.length;n++){const r=i[n];(e?t[r]!=null:s[r]==null)&&(s[r]=t[r])}return s}function ci(s,t,e=!0){if(s="prototype"in s?s.prototype:s,t="prototype"in t?t.prototype:t,Object.getOwnPropertyNames){const i=Object.getOwnPropertyNames(t);for(let n=0;n<i.length;n++){const r=i[n];r!=="constructor"&&(e?t[r]!=null:s[r]==null)&&(s[r]=t[r])}}else W2(s,t,e)}function Y(s){return E(s)?U(s)?s:[s]:[]}function la(s){if(__(s))return s[s.length-1]}const Ye=(s,t)=>{var e;if(s.length===0)return;let i=s[0];for(let n=1;n<s.length;n++){const r=s[n];((e=t==null?void 0:t(r,i))!==null&&e!==void 0?e:r-i>0)&&(i=r)}return i},pi=(s,t)=>{var e;if(s.length===0)return;let i=s[0];for(let n=1;n<s.length;n++){const r=s[n];((e=t==null?void 0:t(r,i))!==null&&e!==void 0?e:r-i<0)&&(i=r)}return i};function Ec(s,t){if(!U(s)||!U(t)||s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!==t[e])return!1;return!0}function N2(s){return s&&U(s)?Array.from(new Set(Y(s))):s}function JC(s,t=Math.random){let e,i,n=s.length;for(;n;)e=Math.floor(t()*n),i=s[--n],s[n]=s[e],s[e]=i;return s}function t0(s){if(!U(s))return[s];const t=[];for(const e of s)t.push(...t0(e));return t}function QC(s,t,e){E(t)||(t=s,s=0),E(e)||(e=1);let i=-1;const n=0|Math.max(0,Math.ceil((t-s)/e)),r=new Array(n);for(;++i<n;)r[i]=s+i*e;return r}function tP(s,t){return s<t?-1:s>t?1:s>=t?0:NaN}function zn(s){return Number(s)}function V2(s,t,e=zn){const i=s.length;if(!i)return;if(i<2)return e(s[0],0,s);const n=(i-1)*t,r=Math.floor(n),a=e(s[r],r,s);return a+(e(s[r+1],r+1,s)-a)*(n-r)}function eP(s,t,e=0,i){for(C(i)&&(i=s.length);e<i;){const n=e+i>>>1;tP(s[n],t)>0?i=n:e=n+1}return e}const U2=(s,t)=>{let e=s;return e=s.sort(tP),V2(e,.5)},$2=1e-10,Y2=1e-10;function ns(s,t,e=Y2,i=$2){const n=i,r=e*Math.max(s,t);return Math.abs(s-t)<=Math.max(n,r)}function En(s,t,e,i){return s>t&&!ns(s,t,e,i)}function on(s,t,e,i){return s<t&&!ns(s,t,e,i)}const kh=s=>{let t=null,e=null;return(...i)=>(t&&i.every((n,r)=>n===t[r])||(t=i,e=s(...i)),e)},di=function(s,t,e){return s<t?t:s>e?e:s},Fr=(s,t,e)=>{let[i,n]=s;n<i&&(i=s[1],n=s[0]);const r=n-i;return r>=e-t?[t,e]:(i=Math.min(Math.max(i,t),e-r),[i,i+r])};function Rb(s,t){let e;return s>t&&(e=s,s=t,t=e),i=>Math.max(s,Math.min(t,i))}let Wp=!1;try{Wp=typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"}catch{Wp=!1}function Xn(s,t,e){let i,n,r,a,o,l,h=0,d=!1,u=!1,c=!0;const p=!t&&t!==0&&Wp;if(typeof s!="function")throw new TypeError("Expected a function");function g(b){const x=i,S=n;return i=n=void 0,h=b,a=s.apply(S,x),a}function f(b,x){return p?(cancelAnimationFrame(o),requestAnimationFrame(b)):setTimeout(b,x)}function _(b){const x=b-l;return l===void 0||x>=t||x<0||u&&b-h>=r}function m(){const b=Date.now();if(_(b))return v(b);o=f(m,function(x){const S=x-h,A=t-(x-l);return u?Math.min(A,r-S):A}(b))}function v(b){return o=void 0,c&&i?g(b):(i=n=void 0,a)}function y(...b){const x=Date.now(),S=_(x);if(i=b,n=this,l=x,S){if(o===void 0)return function(A){return h=A,o=f(m,t),d?g(A):a}(l);if(u)return o=f(m,t),g(l)}return o===void 0&&(o=f(m,t)),a}return t=+t||0,Vt(e)&&(d=!!e.leading,u="maxWait"in e,u&&(r=Math.max(H(e.maxWait)?e.maxWait:0,t)),c="trailing"in e?!!e.trailing:c),y.cancel=function(){o!==void 0&&function(b){if(p)return cancelAnimationFrame(b);clearTimeout(b)}(o),h=0,i=l=n=o=void 0},y.flush=function(){return o===void 0?a:v(Date.now())},y.pending=function(){return o!==void 0},y}Wp=!1;function Ea(s,t,e){let i=!0,n=!0;if(typeof s!="function")throw new TypeError("Expected a function");return Vt(e)&&(i="leading"in e?!!e.leading:i,n="trailing"in e?!!e.trailing:n),Xn(s,t,{leading:i,trailing:n,maxWait:t})}function md(s,t){return e=>s*(1-e)+t*e}function X2(s,t){return function(e){return Math.round(s*(1-e)+t*e)}}function K2(s,t){const e=s.valueOf(),i=t.valueOf(),n=new Date;return r=>(n.setTime(e*(1-r)+i*r),n)}const e0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jm=new RegExp(e0.source,"g");function q2(s){return function(){return s}}function Z2(s){return function(t){return s(t)+""}}function J2(s,t){let e,i,n,r=e0.lastIndex=jm.lastIndex=0,a=-1;const o=[],l=[];for(s+="",t+="";(e=e0.exec(s))&&(i=jm.exec(t));)(n=i.index)>r&&(n=t.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(e=e[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,l.push({i:a,x:md(e,i)})),r=jm.lastIndex;return r<t.length&&(n=t.slice(r),o[a]?o[a]+=n:o[++a]=n),o.length<2?l[0]?Z2(l[0].x):q2(t):(t=l.length,function(h){for(let d,u=0;u<t;++u)o[(d=l[u]).i]=d.x(h);return o.join("")})}function Q2(s,t){return s&&t?s.replace(/\\?\{([^{}]+)\}/g,(e,i)=>e.charAt(0)==="\\"?e.slice(1):t[i]===void 0?"":t[i]):s}const se=1e-12,ne=Math.PI,Ws=ne/2,ni=2*ne,It=2*Math.PI,Xt=Math.abs,re=Math.atan2,oe=Math.cos,ss=Math.max,vi=Math.min,ee=Math.sin,rs=Math.sqrt,Mo=Math.pow;function iP(s){return s>1?0:s<-1?ne:Math.acos(s)}function qS(s){return s>=1?Ws:s<=-1?-Ws:Math.asin(s)}function ZS(s,t,e,i,n){let r,a;return typeof s=="number"&&typeof e=="number"&&(r=(1-n)*s+n*e),typeof t=="number"&&typeof i=="number"&&(a=(1-n)*t+n*i),{x:r,y:a}}function JS(s,t){return s[0]*t[1]-s[1]*t[0]}function tF(s,t){return Xt(s[0]-t[0])+Xt(s[1]-t[1])<1e-12}function sP(s,t=10){return Math.round(s*t)/t}function ql(s){const t=s.toString().split(/[eE]/),e=(t[0].split(".")[1]||"").length-(+t[1]||0);return e>0?e:0}function i0(s,t){return sP(s+t,10**Math.max(ql(s),ql(t)))}function eF(s,t){return sP(s-t,10**Math.max(ql(s),ql(t)))}class De{constructor(t=0,e=0,i,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new De(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return lt(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return lt(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Ee{static distancePP(t,e){return rs(Mo(t.x-e.x,2)+Mo(t.y-e.y,2))}static distanceNN(t,e,i,n){return rs(Mo(t-i,2)+Mo(e-n,2))}static distancePN(t,e,i){return rs(Mo(e-t.x,2)+Mo(i-t.y,2))}static pointAtPP(t,e,i){return new De((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function s0(s,t,e){const{x1:i,y1:n,x2:r,y2:a}=t;return e.onlyTranslate()?(s!==t&&s.setValue(t.x1,t.y1,t.x2,t.y2),s.translate(e.e,e.f),t):(s.clear(),s.add(e.a*i+e.c*n+e.e,e.b*i+e.d*n+e.f),s.add(e.a*r+e.c*n+e.e,e.b*r+e.d*n+e.f),s.add(e.a*r+e.c*a+e.e,e.b*r+e.d*a+e.f),s.add(e.a*i+e.c*a+e.e,e.b*i+e.d*a+e.f),t)}class yi{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new yi(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,i=0,n=0){return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(t=0,e=0,i=0,n=0){return i<t?(this.x2=t,this.x1=i):(this.x1=t,this.x2=i),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return U(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,i=0,n=0){const r=this.scalePoints(t,e,i,n);return this.clear().add(r[0],r[1]).add(r[2],r[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return s0(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:r,x2:a,y2:o}=this,l=Math.cos(t),h=Math.sin(t),d=e-e*l+i*h,u=i-e*h-i*l;return[l*n-h*r+d,h*n+l*r+u,l*n-h*o+d,h*n+l*o+u,l*a-h*r+d,h*a+l*r+u,l*a-h*o+d,h*a+l*o+u]}scalePoints(t,e,i,n){const{x1:r,y1:a,x2:o,y2:l}=this;return[t*r+(1-t)*i,e*a+(1-e)*n,t*o+(1-t)*i,e*l+(1-e)*n]}}class Me extends yi{}function le(s){return s*(Math.PI/180)}function Zl(s){return 180*s/Math.PI}const iF=(s=0)=>{if(s<0)for(;s<-ni;)s+=ni;else if(s>0)for(;s>ni;)s-=ni;return s},sF=iF;function ln(s,t,e){return{x:s.x+t*Math.cos(e),y:s.y+t*Math.sin(e)}}function Np(s,t){return Math.atan2(t.y-s.y,t.x-s.x)}class ze{constructor(t=1,e=0,i=0,n=1,r=0,a=0){this.a=t,this.b=e,this.c=i,this.d=n,this.e=r,this.f=a}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,r,a){return!(this.e!==r||this.f!==a||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,r,a){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=r,this.f=a,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,r=this.e,a=this.f,o=new ze,l=t*n-e*i;return o.a=n/l,o.b=-e/l,o.c=-i/l,o.d=t/l,o.e=(i*a-n*r)/l,o.f=-(t*a-e*r)/l,o}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,r=this.b*e+this.d*i,a=this.a*-i+this.c*e,o=this.b*-i+this.d*e;return this.a=n,this.b=r,this.c=a,this.d=o,this}rotateByCenter(t,e,i){const n=Math.cos(t),r=Math.sin(t),a=(1-n)*e+r*i,o=(1-n)*i-r*e,l=n*this.a-r*this.b,h=r*this.a+n*this.b,d=n*this.c-r*this.d,u=r*this.c+n*this.d,c=n*this.e-r*this.f+a,p=r*this.e+n*this.f+o;return this.a=l,this.b=h,this.c=d,this.d=u,this.e=c,this.f=p,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,r,a){return this.multiply(t,e,i,n,r,a),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:r,f:a}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=a,this.f=r,this}multiply(t,e,i,n,r,a){const o=this.a,l=this.b,h=this.c,d=this.d,u=o*t+h*e,c=l*t+d*e,p=o*i+h*n,g=l*i+d*n,f=o*r+h*a+this.e,_=l*r+d*a+this.f;return this.a=u,this.b=c,this.c=p,this.d=g,this.e=f,this.f=_,this}interpolate(t,e){const i=new ze;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:r,d:a,e:o,f:l}=this,h=i*a-n*r,d=a/h,u=-n/h,c=-r/h,p=i/h,g=(r*l-a*o)/h,f=-(i*l-n*o)/h,{x:_,y:m}=t;e.x=_*d+m*c+g,e.y=_*u+m*p+f}onlyTranslate(t=1){return this.a===t&&this.b===0&&this.c===0&&this.d===t}clone(){return new ze(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,r=t*n-e*i,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!==0||e!==0){const o=Math.sqrt(t*t+e*e);a.rotateDeg=e>0?Math.acos(t/o):-Math.acos(t/o),a.scaleX=o,a.scaleY=r/o,a.skewX=(t*i+e*n)/r,a.skewY=0}else if(i!==0||n!==0){const o=Math.sqrt(i*i+n*n);a.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/o):-Math.acos(i/o)),a.scaleX=r/o,a.scaleY=o,a.skewX=0,a.skewY=(t*i+e*n)/r}return a.rotateDeg=Zl(a.rotateDeg),a}}function nF(s,t,e,i,n,r,a,o){const l=t.a,h=t.b,d=t.c,u=t.d,c=t.e,p=t.f,g=oe(a),f=ee(a);let _,m;o?(_=o[0],m=o[1]):(_=e,m=i);const v=_-e,y=m-i,b=l*g+d*f,x=h*g+u*f,S=d*g-l*f,A=u*g-h*f;s.a=n*b,s.b=n*x,s.c=r*S,s.d=r*A,s.e=c+l*_+d*m-b*v-S*y,s.f=p+h*_+u*m-x*v-A*y}class rF{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<i)return 0;let a=0;const o=h=>{a++,t.delete(h)},l=Date.now();return t.forEach((h,d)=>{if(h.timestamp.length<r)return o(d);let u=0;for(;l-h.timestamp[h.timestamp.length-1-u]<n&&(u++,!(u>=r)););if(u<r)return o(d);for(;l-h.timestamp[0]>n;)h.timestamp.shift()}),a}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach(r=>{for(;n-r.timestamp[0]>i;)r.timestamp.shift()})}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function Vp(s,t,e){t/=100,e/=100;const i=(1-Math.abs(2*e-1))*t,n=i*(1-Math.abs(s/60%2-1)),r=e-i/2;let a=0,o=0,l=0;return 0<=s&&s<60?(a=i,o=n,l=0):60<=s&&s<120?(a=n,o=i,l=0):120<=s&&s<180?(a=0,o=i,l=n):180<=s&&s<240?(a=0,o=n,l=i):240<=s&&s<300?(a=n,o=0,l=i):300<=s&&s<360&&(a=i,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function m_(s,t,e){s/=255,t/=255,e/=255;const i=Math.min(s,t,e),n=Math.max(s,t,e),r=n-i;let a=0,o=0,l=0;return a=r===0?0:n===s?(t-e)/r%6:n===t?(e-s)/r+2:(s-t)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+i)/2,o=r===0?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l}}const QS=/^#([0-9a-f]{3,8})$/,tA={transparent:4294967040},wp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Rc(s){return((s=Math.max(0,Math.min(255,Math.round(s)||0)))<16?"0":"")+s.toString(16)}function zm(s){return lt(s)?new wi(s>>16,s>>8&255,255&s,1):U(s)?new wi(s[0],s[1],s[2]):new wi(255,255,255)}function aF(s){return lt(s)?new wi(s>>>24,s>>>16&255,s>>>8&255,255&s):U(s)?new wi(s[0],s[1],s[2],s[3]):new wi(255,255,255,1)}function Hm(s){return s<.04045?.0773993808*s:Math.pow(.9478672986*s+.0521327014,2.4)}function Gm(s){return s<.0031308?12.92*s:1.055*Math.pow(s,.41666)-.055}class Ue{static Brighter(t,e=1){return e===1?t:new Ue(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return e===1?t:new Ue(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Ue?t:new Ue(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(E(tA[t]))return aF(tA[t]);if(E(wp[t]))return zm(wp[t]);const e=`${t}`.trim().toLowerCase(),i=QS.exec(e);if(i){const n=parseInt(i[1],16),r=i[1].length;return r===3?new wi((n>>8&15)+((n>>8&15)<<4),(n>>4&15)+((n>>4&15)<<4),(15&n)+((15&n)<<4),1):r===6?zm(n):r===8?new wi(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const n=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new wi(parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10),parseFloat(n[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const n=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),r=Vp(parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10));return new wi(r.r,r.g,r.b,parseFloat(n[3]))}}constructor(t){const e=Ue.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new wi(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,r=m_(this.color.r,this.color.g,this.color.b),a=Vp(C(t)?r.h:di(t,0,360),C(e)?r.s:e>=0&&e<=1?100*e:e,C(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new wi(a.r,a.g,a.b,n),this}setRGB(t,e,i){return!C(t)&&(this.color.r=t),!C(e)&&(this.color.g=e),!C(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=QS.exec(e),n=parseInt(i[1],16),r=i[1].length;return r===3?new wi((n>>8&15)+((n>>8&15)<<4),(n>>4&15)+((n>>4&15)<<4),(15&n)+((15&n)<<4),1):r===6?zm(n):r===8?new wi(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):this}setColorName(t){const e=wp[t.toLowerCase()];return e!==void 0?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new Ue(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Hm(t.color.r),this.color.g=Hm(t.color.g),this.color.b=Hm(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Gm(t.color.r),this.color.g=Gm(t.color.g),this.color.b=Gm(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class wi{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),E(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${Rc(this.r)+Rc(this.g)+Rc(this.b)+(this.opacity===1?"":Rc(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${t===1?"rgb(":"rgba("}${this.r},${this.g},${this.b}${t===1?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=m_(this.r,this.g,this.b);return`${t===1?"hsl(":"hsla("}${e},${i}%,${n}%${t===1?")":`,${t})`}`}toString(){return this.formatHex()}}function nP(s){let t="",e="",i="";const n=s[0]==="#"?1:0;for(let r=n;r<s.length;r++)s[r]!=="#"&&(r<n+2?t+=s[r]:r<n+4?e+=s[r]:r<n+6&&(i+=s[r]));return[parseInt(t,16),parseInt(e,16),parseInt(i,16)]}function oF(s,t){const e=s.r,i=t.r,n=s.g,r=t.g,a=s.b,o=t.b,l=s.opacity,h=t.opacity;return d=>{const u=Math.round(e*(1-d)+i*d),c=Math.round(n*(1-d)+r*d),p=Math.round(a*(1-d)+o*d);return new wi(u,c,p,l*(1-d)+h*d)}}const lF=Object.freeze(Object.defineProperty({__proto__:null,Color:Ue,DEFAULT_COLORS:wp,RGB:wi,hexToRgb:nP,hslToRgb:Vp,interpolateRgb:oF,rgbToHsl:m_},Symbol.toStringTag,{value:"Module"}));function Wm(s,t,e){s[0]=t[0]-e[0],s[1]=t[1]-e[1]}let Vi,Ui,$i,Yi,dn,un,cn,pn;function rP(s,t,e,i){let n,r=s[0],a=t[0],o=e[0],l=i[0];return a<r&&(n=a,a=r,r=n),l<o&&(n=l,l=o,o=n),!(a<o||l<r)&&(r=s[1],a=t[1],o=e[1],l=i[1],a<r&&(n=a,a=r,r=n),l<o&&(n=l,l=o,o=n),!(a<o||l<r))}function aP(s,t,e,i){if(!rP(s,t,e,i))return!1;const n=[0,0],r=[0,0],a=[0,0];if(Wm(n,t,s),Wm(r,i,e),tF(n,r))return!0;Wm(a,e,s);const o=JS(a,r)/JS(n,r);return o>=0&&o<=1&&[s[0]+n[0]*o,s[1]+n[1]*o]}function oP(s,t,e){return s===null?t:t===null?s:(Vi=s.x1,Ui=s.x2,$i=s.y1,Yi=s.y2,dn=t.x1,un=t.x2,cn=t.y1,pn=t.y2,Vi>=un||Ui<=dn||$i>=pn||Yi<=cn?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Vi,dn),y1:Math.max($i,cn),x2:Math.min(Ui,un),y2:Math.min(Yi,pn)})}var Vo;(function(s){s[s.NONE=0]="NONE",s[s.BBOX1=1]="BBOX1",s[s.BBOX2=2]="BBOX2"})(Vo||(Vo={}));function hF(s,t,e){return s&&t?(Vi=s.x1,Ui=s.x2,$i=s.y1,Yi=s.y2,dn=t.x1,un=t.x2,cn=t.y1,pn=t.y2,Vi>dn&&Ui<un&&$i>cn&&Yi<pn?Vo.BBOX1:dn>Vi&&un<Ui&&cn>$i&&pn<Yi?Vo.BBOX2:Vo.NONE):Vo.NONE}function Kd(s,t,e){return!s||!t||(e?(Vi=s.x1,Ui=s.x2,$i=s.y1,Yi=s.y2,dn=t.x1,un=t.x2,cn=t.y1,pn=t.y2,Vi>Ui&&([Vi,Ui]=[Ui,Vi]),$i>Yi&&([$i,Yi]=[Yi,$i]),dn>un&&([dn,un]=[un,dn]),cn>pn&&([cn,pn]=[pn,cn]),!(Vi>un||Ui<dn||$i>pn||Yi<cn)):!(s.x1>t.x2||s.x2<t.x1||s.y1>t.y2||s.y2<t.y1))}function vd(s,t,e){return!t||(e?(Vi=t.x1,Ui=t.x2,$i=t.y1,Yi=t.y2,Vi>Ui&&([Vi,Ui]=[Ui,Vi]),$i>Yi&&([$i,Yi]=[Yi,$i]),s.x>=Vi&&s.x<=Ui&&s.y>=$i&&s.y<=Yi):s.x>=t.x1&&s.x<=t.x2&&s.y>=t.y1&&s.y<=t.y2)}function Nm(s,t){return Math.abs(t[0]*s[0]+t[1]*s[1])}function Oc({x:s,y:t},e,i={x:0,y:0}){return{x:(s-i.x)*Math.cos(e)+(t-i.y)*Math.sin(e)+i.x,y:(s-i.x)*Math.sin(e)+(i.y-t)*Math.cos(e)+i.y}}function ed(s){return s/180*Math.PI}function n0(s){return{x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2}}function eA(s,t){const e=t?s.angle:ed(s.angle),i=n0(s);return[Oc({x:s.x1,y:s.y1},e,i),Oc({x:s.x2,y:s.y1},e,i),Oc({x:s.x2,y:s.y2},e,i),Oc({x:s.x1,y:s.y2},e,i)]}function dF(s,t,e=!1,i){const n=eA(s,e),r=eA(t,e),a=(y,b)=>[b.x-y.x,b.y-y.y],o=n0(s),l=n0(t),h=a(o,l),d=a(n[0],n[1]),u=a(n[1],n[2]),c=a(r[0],r[1]),p=a(r[1],r[2]),g=e?s.angle:ed(s.angle);let f=e?s.angle+Ws:ed(90-s.angle);const _=e?t.angle:ed(t.angle);let m=e?t.angle+Ws:ed(90-t.angle);f>It&&(f-=It),m>It&&(m-=It);const v=(y,b,x,S)=>{const A=[Math.cos(b),Math.sin(b)];return y+(Nm(A,x)+Nm(A,S))/2>Nm(A,h)};return v((s.x2-s.x1)/2,g,c,p)&&v((s.y2-s.y1)/2,f,c,p)&&v((t.x2-t.x1)/2,_,d,u)&&v((t.y2-t.y1)/2,m,d,u)}let Dc,Lc,Bc,Ic;function uF(s){return Dc=1/0,Lc=1/0,Bc=-1/0,Ic=-1/0,s.forEach(t=>{Dc>t.x&&(Dc=t.x),Bc<t.x&&(Bc=t.x),Lc>t.y&&(Lc=t.y),Ic<t.y&&(Ic=t.y)}),{x1:Dc,y1:Lc,x2:Bc,y2:Ic}}const cF=1e-8;function pF(s,t,e,i,n){for(let r=0,a=n[n.length-1];r<n.length;r++){const o=n[r];if(rP([s,t],[e,i],[o.x,o.y],[a.x,a.y]))return!0;a=o}return!1}function $a(s,t,e){let i=0,n=s[0];if(!n)return!1;for(let a=1;a<s.length;a++){const o=s[a];i+=iA(n.x,n.y,o.x,o.y,t,e),n=o}const r=s[0];return sA(n.x,r.x)&&sA(n.y,r.y)||(i+=iA(n.x,n.y,r.x,r.y,t,e)),i!==0}function iA(s,t,e,i,n,r){if(r>t&&r>i||r<t&&r<i||i===t)return 0;const a=(r-t)/(i-t);let o=i<t?1:-1;a!==1&&a!==0||(o=i<t?.5:-.5);const l=a*(e-s)+s;return l===n?1/0:l>n?o:0}function sA(s,t){return Math.abs(s-t)<cF}function nA(s,t){for(let e=0;e<t.length;e++)if($a(s,t[e].x,t[e].y)||e>0&&pF(t[e-1].x,t[e-1].y,t[e].x,t[e].y,s))return!0;return!1}const rA=s=>{let t=s.charCodeAt(0),e=s.length===2?s.charCodeAt(1):0,i=t;return 55296<=t&&t<=56319&&56320<=e&&e<=57343&&(t&=1023,e&=1023,i=t<<10|e,i+=65536),i===12288||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":i===8361||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||i===172||i===175||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":i===161||i===164||167<=i&&i<=168||i===170||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||i===198||i===208||215<=i&&i<=216||222<=i&&i<=225||i===230||232<=i&&i<=234||236<=i&&i<=237||i===240||242<=i&&i<=243||247<=i&&i<=250||i===252||i===254||i===257||i===273||i===275||i===283||294<=i&&i<=295||i===299||305<=i&&i<=307||i===312||319<=i&&i<=322||i===324||328<=i&&i<=331||i===333||338<=i&&i<=339||358<=i&&i<=359||i===363||i===462||i===464||i===466||i===468||i===470||i===472||i===474||i===476||i===593||i===609||i===708||i===711||713<=i&&i<=715||i===717||i===720||728<=i&&i<=731||i===733||i===735||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||i===1025||1040<=i&&i<=1103||i===1105||i===8208||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||i===8240||8242<=i&&i<=8243||i===8245||i===8251||i===8254||i===8308||i===8319||8321<=i&&i<=8324||i===8364||i===8451||i===8453||i===8457||i===8467||i===8470||8481<=i&&i<=8482||i===8486||i===8491||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||i===8585||8592<=i&&i<=8601||8632<=i&&i<=8633||i===8658||i===8660||i===8679||i===8704||8706<=i&&i<=8707||8711<=i&&i<=8712||i===8715||i===8719||i===8721||i===8725||i===8730||8733<=i&&i<=8736||i===8739||i===8741||8743<=i&&i<=8748||i===8750||8756<=i&&i<=8759||8764<=i&&i<=8765||i===8776||i===8780||i===8786||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||i===8853||i===8857||i===8869||i===8895||i===8978||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||i===9675||9678<=i&&i<=9681||9698<=i&&i<=9701||i===9711||9733<=i&&i<=9734||i===9737||9742<=i&&i<=9743||9748<=i&&i<=9749||i===9756||i===9758||i===9792||i===9794||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||i===9839||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||i===9955||9960<=i&&i<=9983||i===10045||i===10071||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||i===65533||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"};function gF(s,t={}){const{fontStyle:e=t.fontStyle,fontVariant:i=t.fontVariant,fontWeight:n=t.fontWeight,fontSize:r=t.fontSize,fontFamily:a=t.fontFamily}=s;return(e?e+" ":"")+(i?i+" ":"")+(n?n+" ":"")+r+"px "+(a||"sans-serif")}class li{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet=`-/: .,@%'"~`,this._option=t,this._userSpec=e??{},this.textSpec=this._initSpec(),E(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=E(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(C(this._canvas)&&(E(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),C(this._canvas)&&typeof window<"u"&&window.document!==void 0&&globalThis&&E(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),C(this._context)&&E(this._canvas)){const t=this._canvas.getContext("2d");E(t)&&(t.save(),t.font=gF(this.textSpec),this._contextSaved=!0,this._context=t)}return!C(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:r=n.fontStyle,fontVariant:a=n.fontVariant,fontWeight:o=(t=n.fontWeight)!==null&&t!==void 0?t:"normal",fontSize:l=(e=n.fontSize)!==null&&e!==void 0?e:12,fontFamily:h=(i=n.fontFamily)!==null&&i!==void 0?i:"sans-serif",align:d,textAlign:u=d??"center",baseline:c,textBaseline:p=c??"middle",ellipsis:g,limit:f}=this._userSpec;let{lineHeight:_=l}=this._userSpec;if(ot(_)&&_[_.length-1]==="%"){const m=Number.parseFloat(_.substring(0,_.length-1))/100;_=l*m}return{fontStyle:r,fontVariant:a,fontFamily:h,fontSize:l,fontWeight:o,textAlign:u,textBaseline:p,ellipsis:g,limit:f,lineHeight:_}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(C(t))return{width:0,height:0};if(C(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:a,ellipsis:o,limit:l,lineHeight:h}=this.textSpec;let d;try{const u=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:a,ellipsis:!!o,maxLineWidth:l||1/0,lineHeight:h});d={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,d=this.measureWithNaiveCanvas(t)}return d}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:r}=this.textSpec;return{width:i.width,height:(e=r)!==null&&e!==void 0?e:n}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;i<t.length;i++){const n=t[i];let r=this._measureSpecialChar(n);C(r)&&li.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),C(r)&&["F","W"].includes(rA(n))&&(r=this._measureFullSizeChar()),C(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let a=0;a<t.length;a++){const o=t[a],l=["F","W"].includes(rA(o))?1:.53;i.width+=l*n}return i.height=(e=r)!==null&&e!==void 0?e:n,i}_measureReduce(t,e){var i;const{fontSize:n,lineHeight:r}=this.textSpec,a={width:0,height:0};if(C(t))return a;if(U(t)){const o=t.filter(E).map(l=>l.toString());return o.length===0?a:o.length===1?e(o[0]):{width:o.reduce((l,h)=>Math.max(l,e(h).width),0),height:o.length*(((i=r)!==null&&i!==void 0?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(C(this._numberCharSize)){const t=this._standardMethod(li.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/li.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return C(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(li.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(C(this._letterCharSize)){const t=this._standardMethod(li.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/li.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return E(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){E(this._canvas)&&(this._canvas=null),E(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}li.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",li.NUMBERS_CHAR_SET="0123456789",li.FULL_SIZE_CHAR="字";const fF=typeof console<"u";function Fc(s,t,e){const i=[t].concat([].slice.call(e));fF&&console[s].apply(console,i)}var Ss;(function(s){s[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug"})(Ss||(Ss={}));class zt{static getInstance(t,e){return zt._instance&<(t)?zt._instance.level(t):zt._instance||(zt._instance=new zt(t,e)),zt._instance}static setInstance(t){return zt._instance=t}static setInstanceLevel(t){zt._instance?zt._instance.level(t):zt._instance=new zt(t)}static clearInstance(){zt._instance=null}constructor(t=Ss.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find(e=>e===t)||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex(i=>i===t);e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach(e=>e(...t))}canLogInfo(){return this._level>=Ss.Info}canLogDebug(){return this._level>=Ss.Debug}canLogError(){return this._level>=Ss.Error}canLogWarn(){return this._level>=Ss.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=Ss.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):Fc((e=this._method)!==null&&e!==void 0?e:"error","ERROR",t)),this}warn(...t){return this._level>=Ss.Warn&&Fc(this._method||"warn","WARN",t),this}info(...t){return this._level>=Ss.Info&&Fc(this._method||"log","INFO",t),this}debug(...t){return this._level>=Ss.Debug&&Fc(this._method||"log","DEBUG",t),this}}zt._instance=null;function as(s){if(H(s))return[s,s,s,s];if(U(s)){const t=s.length;if(t===1){const e=s[0];return[e,e,e,e]}if(t===2){const[e,i]=s;return[e,i,e,i]}if(t===3){const[e,i,n]=s;return[e,i,n,i]}if(t===4)return s}if(Vt(s)){const{top:t=0,right:e=0,bottom:i=0,left:n=0}=s;return[t,e,i,n]}return[0,0,0,0]}function r0(s,t=0,e=0){if(!s)return{width:t,height:e};let i;try{i=window==null?void 0:window.getComputedStyle}catch{i=()=>({})}const n=i(s);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const r=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||s.clientWidth-1,a=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||s.clientHeight-1;return{width:r<=0?t:r,height:a<=0?e:a}}return{width:t,height:e}}function _F(s){const{x:t,y:e}=s.getBoundingClientRect();return{x:t,y:e}}function mF(s,t){let e=s.parentNode;for(;e!==null;){if(e===t)return!0;e=e.parentNode}return!1}var cs=63710088e-1,vF={centimeters:cs*100,centimetres:cs*100,degrees:cs/111325,feet:cs*3.28084,inches:cs*39.37,kilometers:cs/1e3,kilometres:cs/1e3,meters:cs,metres:cs,miles:cs/1609.344,millimeters:cs*1e3,millimetres:cs*1e3,nauticalmiles:cs/1852,radians:1,yards:cs*1.0936};function aA(s,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=s,i}function lP(s,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=s,e}function yF(s,t){t===void 0&&(t="kilometers");var e=vF[t];if(!e)throw new Error(t+" units is invalid");return s/e}function bF(s){return!!s&&s.constructor===Object}function xF(s){return s.type==="Feature"?s.geometry:s}function SF(s,t){if(!s||!t)return!1;const e=xF(t),i=e.type,n=t.bbox;let r=e.coordinates;if(n&&vd(s,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0)===!0)return!1;i==="Polygon"&&(r=[r]);let a=!1;for(let o=0;o<r.length;++o)for(let l=0;l<r[o].length;++l)if($a(r[o][l].map(h=>({x:h[0],y:h[1]})),s.x,s.y))return a=!0,a;return a}function AF(s,t,e,i={}){const n=le(s[0]),r=le(s[1]),a=le(e),o=yF(t,i.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a)),h=n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l));return{x:Zl(h),y:Zl(l)}}const kF=(s,t)=>{const{callback:e}=t;return e&&(s=s.filter(e)),s};function v_(){return new Up}function Up(){this.reset()}Up.prototype={constructor:Up,reset:function(){this.s=this.t=0},add:function(s){oA(jc,s,this.t),oA(this,jc.s,this.s),this.s?this.t+=jc.t:this.s=jc.t},valueOf:function(){return this.s}};var jc=new Up;function oA(s,t,e){var i=s.s=t+e,n=i-t,r=i-n;s.t=t-r+(e-n)}var Wt=1e-6,wF=1e-12,te=Math.PI,$e=te/2,lA=te/4,Cs=te*2,Fi=180/te,Fe=te/180,fe=Math.abs,wh=Math.atan,br=Math.atan2,qt=Math.cos,hP=Math.exp,$p=Math.log,Vm=Math.pow,Nt=Math.sin,Us=Math.sign||function(s){return s>0?1:s<0?-1:0},_s=Math.sqrt,Ob=Math.tan;function dP(s){return s>1?0:s<-1?te:Math.acos(s)}function Zs(s){return s>1?$e:s<-1?-$e:Math.asin(s)}function $s(){}function Yp(s,t){s&&dA.hasOwnProperty(s.type)&&dA[s.type](s,t)}var hA={Feature:function(s,t){Yp(s.geometry,t)},FeatureCollection:function(s,t){for(var e=s.features,i=-1,n=e.length;++i<n;)Yp(e[i].geometry,t)}},dA={Sphere:function(s,t){t.sphere()},Point:function(s,t){s=s.coordinates,t.point(s[0],s[1],s[2])},MultiPoint:function(s,t){for(var e=s.coordinates,i=-1,n=e.length;++i<n;)s=e[i],t.point(s[0],s[1],s[2])},LineString:function(s,t){a0(s.coordinates,t,0)},MultiLineString:function(s,t){for(var e=s.coordinates,i=-1,n=e.length;++i<n;)a0(e[i],t,0)},Polygon:function(s,t){uA(s.coordinates,t)},MultiPolygon:function(s,t){for(var e=s.coordinates,i=-1,n=e.length;++i<n;)uA(e[i],t)},GeometryCollection:function(s,t){for(var e=s.geometries,i=-1,n=e.length;++i<n;)Yp(e[i],t)}};function a0(s,t,e){var i=-1,n=s.length-e,r;for(t.lineStart();++i<n;)r=s[i],t.point(r[0],r[1],r[2]);t.lineEnd()}function uA(s,t){var e=-1,i=s.length;for(t.polygonStart();++e<i;)a0(s[e],t,1);t.polygonEnd()}function Io(s,t){s&&hA.hasOwnProperty(s.type)?hA[s.type](s,t):Yp(s,t)}function o0(s){return[br(s[1],s[0]),Zs(s[2])]}function Jl(s){var t=s[0],e=s[1],i=qt(e);return[i*qt(t),i*Nt(t),Nt(e)]}function zc(s,t){return s[0]*t[0]+s[1]*t[1]+s[2]*t[2]}function Xp(s,t){return[s[1]*t[2]-s[2]*t[1],s[2]*t[0]-s[0]*t[2],s[0]*t[1]-s[1]*t[0]]}function Um(s,t){s[0]+=t[0],s[1]+=t[1],s[2]+=t[2]}function Hc(s,t){return[s[0]*t,s[1]*t,s[2]*t]}function l0(s){var t=_s(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]);s[0]/=t,s[1]/=t,s[2]/=t}function h0(s,t){function e(i,n){return i=s(i,n),t(i[0],i[1])}return s.invert&&t.invert&&(e.invert=function(i,n){return i=t.invert(i,n),i&&s.invert(i[0],i[1])}),e}function d0(s,t){return[fe(s)>te?s+Math.round(-s/Cs)*Cs:s,t]}d0.invert=d0;function uP(s,t,e){return(s%=Cs)?t||e?h0(pA(s),gA(t,e)):pA(s):t||e?gA(t,e):d0}function cA(s){return function(t,e){return t+=s,[t>te?t-Cs:t<-te?t+Cs:t,e]}}function pA(s){var t=cA(s);return t.invert=cA(-s),t}function gA(s,t){var e=qt(s),i=Nt(s),n=qt(t),r=Nt(t);function a(o,l){var h=qt(l),d=qt(o)*h,u=Nt(o)*h,c=Nt(l),p=c*e+d*i;return[br(u*n-p*r,d*e-c*i),Zs(p*n+u*r)]}return a.invert=function(o,l){var h=qt(l),d=qt(o)*h,u=Nt(o)*h,c=Nt(l),p=c*n-u*r;return[br(u*n+c*r,d*e+p*i),Zs(p*e-d*i)]},a}function TF(s){s=uP(s[0]*Fe,s[1]*Fe,s.length>2?s[2]*Fe:0);function t(e){return e=s(e[0]*Fe,e[1]*Fe),e[0]*=Fi,e[1]*=Fi,e}return t.invert=function(e){return e=s.invert(e[0]*Fe,e[1]*Fe),e[0]*=Fi,e[1]*=Fi,e},t}function MF(s,t,e,i,n,r){if(e){var a=qt(t),o=Nt(t),l=i*e;n==null?(n=t+i*Cs,r=t-l/2):(n=fA(a,n),r=fA(a,r),(i>0?n<r:n>r)&&(n+=i*Cs));for(var h,d=n;i>0?d>r:d<r;d-=l)h=o0([a,-o*qt(d),-o*Nt(d)]),s.point(h[0],h[1])}}function fA(s,t){t=Jl(t),t[0]-=s,l0(t);var e=dP(-t[1]);return((-t[2]<0?-e:e)+Cs-Wt)%Cs}function cP(){var s=[],t;return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){s.push(t=[])},lineEnd:$s,rejoin:function(){s.length>1&&s.push(s.pop().concat(s.shift()))},result:function(){var e=s;return s=[],t=null,e}}}function Tp(s,t){return fe(s[0]-t[0])<Wt&&fe(s[1]-t[1])<Wt}function Gc(s,t,e,i){this.x=s,this.z=t,this.o=e,this.e=i,this.v=!1,this.n=this.p=null}function pP(s,t,e,i,n){var r=[],a=[],o,l;if(s.forEach(function(g){if(!((f=g.length-1)<=0)){var f,_=g[0],m=g[f],v;if(Tp(_,m)){if(!_[2]&&!m[2]){for(n.lineStart(),o=0;o<f;++o)n.point((_=g[o])[0],_[1]);n.lineEnd();return}m[0]+=2*Wt}r.push(v=new Gc(_,g,null,!0)),a.push(v.o=new Gc(_,null,v,!1)),r.push(v=new Gc(m,g,null,!1)),a.push(v.o=new Gc(m,null,v,!0))}}),!!r.length){for(a.sort(t),_A(r),_A(a),o=0,l=a.length;o<l;++o)a[o].e=e=!e;for(var h=r[0],d,u;;){for(var c=h,p=!0;c.v;)if((c=c.n)===h)return;d=c.z,n.lineStart();do{if(c.v=c.o.v=!0,c.e){if(p)for(o=0,l=d.length;o<l;++o)n.point((u=d[o])[0],u[1]);else i(c.x,c.n.x,1,n);c=c.n}else{if(p)for(d=c.p.z,o=d.length-1;o>=0;--o)n.point((u=d[o])[0],u[1]);else i(c.x,c.p.x,-1,n);c=c.p}c=c.o,d=c.z,p=!p}while(!c.v);n.lineEnd()}}}function _A(s){if(t=s.length){for(var t,e=0,i=s[0],n;++e<t;)i.n=n=s[e],n.p=i,i=n;i.n=n=s[0],n.p=i}}var $m=v_();function Ym(s){return fe(s[0])<=te?s[0]:Us(s[0])*((fe(s[0])+te)%Cs-te)}function CF(s,t){var e=Ym(t),i=t[1],n=Nt(i),r=[Nt(e),-qt(e),0],a=0,o=0;$m.reset(),n===1?i=$e+Wt:n===-1&&(i=-$e-Wt);for(var l=0,h=s.length;l<h;++l)if(u=(d=s[l]).length)for(var d,u,c=d[u-1],p=Ym(c),g=c[1]/2+lA,f=Nt(g),_=qt(g),m=0;m<u;++m,p=y,f=x,_=S,c=v){var v=d[m],y=Ym(v),b=v[1]/2+lA,x=Nt(b),S=qt(b),A=y-p,k=A>=0?1:-1,w=k*A,T=w>te,M=f*x;if($m.add(br(M*k*Nt(w),_*S+M*qt(w))),a+=T?A+k*Cs:A,T^p>=e^y>=e){var P=Xp(Jl(c),Jl(v));l0(P);var O=Xp(r,P);l0(O);var D=(T^A>=0?-1:1)*Zs(O[2]);(i>D||i===D&&(P[0]||P[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Wt||a<Wt&&$m<-Wt)^o&1}function gP(s,t){return s<t?-1:s>t?1:s>=t?0:NaN}function PF(s){return s.length===1&&(s=EF(s)),{left:function(t,e,i,n){for(i==null&&(i=0),n==null&&(n=t.length);i<n;){var r=i+n>>>1;s(t[r],e)<0?i=r+1:n=r}return i},right:function(t,e,i,n){for(i==null&&(i=0),n==null&&(n=t.length);i<n;){var r=i+n>>>1;s(t[r],e)>0?n=r:i=r+1}return i}}}function EF(s){return function(t,e){return gP(s(t),e)}}PF(gP);function fP(s){for(var t=s.length,e,i=-1,n=0,r,a;++i<t;)n+=s[i].length;for(r=new Array(n);--t>=0;)for(a=s[t],e=a.length;--e>=0;)r[--n]=a[e];return r}function _P(s,t,e,i){return function(n){var r=t(n),a=cP(),o=t(a),l=!1,h,d,u,c={point:p,lineStart:f,lineEnd:_,polygonStart:function(){c.point=m,c.lineStart=v,c.lineEnd=y,d=[],h=[]},polygonEnd:function(){c.point=p,c.lineStart=f,c.lineEnd=_,d=fP(d);var b=CF(h,i);d.length?(l||(n.polygonStart(),l=!0),pP(d,OF,b,e,n)):b&&(l||(n.polygonStart(),l=!0),n.lineStart(),e(null,null,1,n),n.lineEnd()),l&&(n.polygonEnd(),l=!1),d=h=null},sphere:function(){n.polygonStart(),n.lineStart(),e(null,null,1,n),n.lineEnd(),n.polygonEnd()}};function p(b,x){s(b,x)&&n.point(b,x)}function g(b,x){r.point(b,x)}function f(){c.point=g,r.lineStart()}function _(){c.point=p,r.lineEnd()}function m(b,x){u.push([b,x]),o.point(b,x)}function v(){o.lineStart(),u=[]}function y(){m(u[0][0],u[0][1]),o.lineEnd();var b=o.clean(),x=a.result(),S,A=x.length,k,w,T;if(u.pop(),h.push(u),u=null,!!A){if(b&1){if(w=x[0],(k=w.length-1)>0){for(l||(n.polygonStart(),l=!0),n.lineStart(),S=0;S<k;++S)n.point((T=w[S])[0],T[1]);n.lineEnd()}return}A>1&&b&2&&x.push(x.pop().concat(x.shift())),d.push(x.filter(RF))}}return c}}function RF(s){return s.length>1}function OF(s,t){return((s=s.x)[0]<0?s[1]-$e-Wt:$e-s[1])-((t=t.x)[0]<0?t[1]-$e-Wt:$e-t[1])}const mA=_P(function(){return!0},DF,BF,[-te,-$e]);function DF(s){var t=NaN,e=NaN,i=NaN,n;return{lineStart:function(){s.lineStart(),n=1},point:function(r,a){var o=r>0?te:-te,l=fe(r-t);fe(l-te)<Wt?(s.point(t,e=(e+a)/2>0?$e:-$e),s.point(i,e),s.lineEnd(),s.lineStart(),s.point(o,e),s.point(r,e),n=0):i!==o&&l>=te&&(fe(t-i)<Wt&&(t-=i*Wt),fe(r-o)<Wt&&(r-=o*Wt),e=LF(t,e,r,a),s.point(i,e),s.lineEnd(),s.lineStart(),s.point(o,e),n=0),s.point(t=r,e=a),i=o},lineEnd:function(){s.lineEnd(),t=e=NaN},clean:function(){return 2-n}}}function LF(s,t,e,i){var n,r,a=Nt(s-e);return fe(a)>Wt?wh((Nt(t)*(r=qt(i))*Nt(e)-Nt(i)*(n=qt(t))*Nt(s))/(n*r*a)):(t+i)/2}function BF(s,t,e,i){var n;if(s==null)n=e*$e,i.point(-te,n),i.point(0,n),i.point(te,n),i.point(te,0),i.point(te,-n),i.point(0,-n),i.point(-te,-n),i.point(-te,0),i.point(-te,n);else if(fe(s[0]-t[0])>Wt){var r=s[0]<t[0]?te:-te;n=e*r/2,i.point(-r,n),i.point(0,n),i.point(r,n)}else i.point(t[0],t[1])}function IF(s){var t=qt(s),e=6*Fe,i=t>0,n=fe(t)>Wt;function r(d,u,c,p){MF(p,s,e,c,d,u)}function a(d,u){return qt(d)*qt(u)>t}function o(d){var u,c,p,g,f;return{lineStart:function(){g=p=!1,f=1},point:function(_,m){var v=[_,m],y,b=a(_,m),x=i?b?0:h(_,m):b?h(_+(_<0?te:-te),m):0;if(!u&&(g=p=b)&&d.lineStart(),b!==p&&(y=l(u,v),(!y||Tp(u,y)||Tp(v,y))&&(v[2]=1)),b!==p)f=0,b?(d.lineStart(),y=l(v,u),d.point(y[0],y[1])):(y=l(u,v),d.point(y[0],y[1],2),d.lineEnd()),u=y;else if(n&&u&&i^b){var S;!(x&c)&&(S=l(v,u,!0))&&(f=0,i?(d.lineStart(),d.point(S[0][0],S[0][1]),d.point(S[1][0],S[1][1]),d.lineEnd()):(d.point(S[1][0],S[1][1]),d.lineEnd(),d.lineStart(),d.point(S[0][0],S[0][1],3)))}b&&(!u||!Tp(u,v))&&d.point(v[0],v[1]),u=v,p=b,c=x},lineEnd:function(){p&&d.lineEnd(),u=null},clean:function(){return f|(g&&p)<<1}}}function l(d,u,c){var p=Jl(d),g=Jl(u),f=[1,0,0],_=Xp(p,g),m=zc(_,_),v=_[0],y=m-v*v;if(!y)return!c&&d;var b=t*m/y,x=-t*v/y,S=Xp(f,_),A=Hc(f,b),k=Hc(_,x);Um(A,k);var w=S,T=zc(A,w),M=zc(w,w),P=T*T-M*(zc(A,A)-1);if(!(P<0)){var O=_s(P),D=Hc(w,(-T-O)/M);if(Um(D,A),D=o0(D),!c)return D;var R=d[0],L=u[0],B=d[1],F=u[1],z;L<R&&(z=R,R=L,L=z);var N=L-R,V=fe(N-te)<Wt,G=V||N<Wt;if(!V&&F<B&&(z=B,B=F,F=z),G?V?B+F>0^D[1]<(fe(D[0]-R)<Wt?B:F):B<=D[1]&&D[1]<=F:N>te^(R<=D[0]&&D[0]<=L)){var X=Hc(w,(-T+O)/M);return Um(X,A),[D,o0(X)]}}}function h(d,u){var c=i?s:te-s,p=0;return d<-c?p|=1:d>c&&(p|=2),u<-c?p|=4:u>c&&(p|=8),p}return _P(a,o,r,i?[0,-s]:[-te,s-te])}function FF(s,t,e,i,n,r){var a=s[0],o=s[1],l=t[0],h=t[1],d=0,u=1,c=l-a,p=h-o,g;if(g=e-a,!(!c&&g>0)){if(g/=c,c<0){if(g<d)return;g<u&&(u=g)}else if(c>0){if(g>u)return;g>d&&(d=g)}if(g=n-a,!(!c&&g<0)){if(g/=c,c<0){if(g>u)return;g>d&&(d=g)}else if(c>0){if(g<d)return;g<u&&(u=g)}if(g=i-o,!(!p&&g>0)){if(g/=p,p<0){if(g<d)return;g<u&&(u=g)}else if(p>0){if(g>u)return;g>d&&(d=g)}if(g=r-o,!(!p&&g<0)){if(g/=p,p<0){if(g>u)return;g>d&&(d=g)}else if(p>0){if(g<d)return;g<u&&(u=g)}return d>0&&(s[0]=a+d*c,s[1]=o+d*p),u<1&&(t[0]=a+u*c,t[1]=o+u*p),!0}}}}}var id=1e9,Wc=-id;function mP(s,t,e,i){function n(h,d){return s<=h&&h<=e&&t<=d&&d<=i}function r(h,d,u,c){var p=0,g=0;if(h==null||(p=a(h,u))!==(g=a(d,u))||l(h,d)<0^u>0)do c.point(p===0||p===3?s:e,p>1?i:t);while((p=(p+u+4)%4)!==g);else c.point(d[0],d[1])}function a(h,d){return fe(h[0]-s)<Wt?d>0?0:3:fe(h[0]-e)<Wt?d>0?2:1:fe(h[1]-t)<Wt?d>0?1:0:d>0?3:2}function o(h,d){return l(h.x,d.x)}function l(h,d){var u=a(h,1),c=a(d,1);return u!==c?u-c:u===0?d[1]-h[1]:u===1?h[0]-d[0]:u===2?h[1]-d[1]:d[0]-h[0]}return function(h){var d=h,u=cP(),c,p,g,f,_,m,v,y,b,x,S,A={point:k,lineStart:P,lineEnd:O,polygonStart:T,polygonEnd:M};function k(R,L){n(R,L)&&d.point(R,L)}function w(){for(var R=0,L=0,B=p.length;L<B;++L)for(var F=p[L],z=1,N=F.length,V=F[0],G,X,Z=V[0],et=V[1];z<N;++z)G=Z,X=et,V=F[z],Z=V[0],et=V[1],X<=i?et>i&&(Z-G)*(i-X)>(et-X)*(s-G)&&++R:et<=i&&(Z-G)*(i-X)<(et-X)*(s-G)&&--R;return R}function T(){d=u,c=[],p=[],S=!0}function M(){var R=w(),L=S&&R,B=(c=fP(c)).length;(L||B)&&(h.polygonStart(),L&&(h.lineStart(),r(null,null,1,h),h.lineEnd()),B&&pP(c,o,R,r,h),h.polygonEnd()),d=h,c=p=g=null}function P(){A.point=D,p&&p.push(g=[]),x=!0,b=!1,v=y=NaN}function O(){c&&(D(f,_),m&&b&&u.rejoin(),c.push(u.result())),A.point=k,b&&d.lineEnd()}function D(R,L){var B=n(R,L);if(p&&g.push([R,L]),x)f=R,_=L,m=B,x=!1,B&&(d.lineStart(),d.point(R,L));else if(B&&b)d.point(R,L);else{var F=[v=Math.max(Wc,Math.min(id,v)),y=Math.max(Wc,Math.min(id,y))],z=[R=Math.max(Wc,Math.min(id,R)),L=Math.max(Wc,Math.min(id,L))];FF(F,z,s,t,e,i)?(b||(d.lineStart(),d.point(F[0],F[1])),d.point(z[0],z[1]),B||d.lineEnd(),S=!1):B&&(d.lineStart(),d.point(R,L),S=!1)}v=R,y=L,b=B}return A}}function qd(s){return s}var Xm=v_(),u0=v_(),vP,yP,c0,p0,lr={point:$s,lineStart:$s,lineEnd:$s,polygonStart:function(){lr.lineStart=jF,lr.lineEnd=HF},polygonEnd:function(){lr.lineStart=lr.lineEnd=lr.point=$s,Xm.add(fe(u0)),u0.reset()},result:function(){var s=Xm/2;return Xm.reset(),s}};function jF(){lr.point=zF}function zF(s,t){lr.point=bP,vP=c0=s,yP=p0=t}function bP(s,t){u0.add(p0*s-c0*t),c0=s,p0=t}function HF(){bP(vP,yP)}var Ql=1/0,Kp=Ql,Zd=-Ql,qp=Zd,Zp={point:GF,lineStart:$s,lineEnd:$s,polygonStart:$s,polygonEnd:$s,result:function(){var s=[[Ql,Kp],[Zd,qp]];return Zd=qp=-(Kp=Ql=1/0),s}};function GF(s,t){s<Ql&&(Ql=s),s>Zd&&(Zd=s),t<Kp&&(Kp=t),t>qp&&(qp=t)}var g0=0,f0=0,sd=0,Jp=0,Qp=0,Uo=0,_0=0,m0=0,nd=0,xP,SP,Ln,Bn,Ns={point:io,lineStart:vA,lineEnd:yA,polygonStart:function(){Ns.lineStart=VF,Ns.lineEnd=UF},polygonEnd:function(){Ns.point=io,Ns.lineStart=vA,Ns.lineEnd=yA},result:function(){var s=nd?[_0/nd,m0/nd]:Uo?[Jp/Uo,Qp/Uo]:sd?[g0/sd,f0/sd]:[NaN,NaN];return g0=f0=sd=Jp=Qp=Uo=_0=m0=nd=0,s}};function io(s,t){g0+=s,f0+=t,++sd}function vA(){Ns.point=WF}function WF(s,t){Ns.point=NF,io(Ln=s,Bn=t)}function NF(s,t){var e=s-Ln,i=t-Bn,n=_s(e*e+i*i);Jp+=n*(Ln+s)/2,Qp+=n*(Bn+t)/2,Uo+=n,io(Ln=s,Bn=t)}function yA(){Ns.point=io}function VF(){Ns.point=$F}function UF(){AP(xP,SP)}function $F(s,t){Ns.point=AP,io(xP=Ln=s,SP=Bn=t)}function AP(s,t){var e=s-Ln,i=t-Bn,n=_s(e*e+i*i);Jp+=n*(Ln+s)/2,Qp+=n*(Bn+t)/2,Uo+=n,n=Bn*s-Ln*t,_0+=n*(Ln+s),m0+=n*(Bn+t),nd+=n*3,io(Ln=s,Bn=t)}function kP(s){this._context=s}kP.prototype={_radius:4.5,pointRadius:function(s){return this._radius=s,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(s,t){switch(this._point){case 0:{this._context.moveTo(s,t),this._point=1;break}case 1:{this._context.lineTo(s,t);break}default:{this._context.moveTo(s+this._radius,t),this._context.arc(s,t,this._radius,0,Cs);break}}},result:$s};var v0=v_(),Km,wP,TP,rd,ad,Jd={point:$s,lineStart:function(){Jd.point=YF},lineEnd:function(){Km&&MP(wP,TP),Jd.point=$s},polygonStart:function(){Km=!0},polygonEnd:function(){Km=null},result:function(){var s=+v0;return v0.reset(),s}};function YF(s,t){Jd.point=MP,wP=rd=s,TP=ad=t}function MP(s,t){rd-=s,ad-=t,v0.add(_s(rd*rd+ad*ad)),rd=s,ad=t}function CP(){this._string=[]}CP.prototype={_radius:4.5,_circle:bA(4.5),pointRadius:function(s){return(s=+s)!==this._radius&&(this._radius=s,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(s,t){switch(this._point){case 0:{this._string.push("M",s,",",t),this._point=1;break}case 1:{this._string.push("L",s,",",t);break}default:{this._circle==null&&(this._circle=bA(this._radius)),this._string.push("M",s,",",t,this._circle);break}}},result:function(){if(this._string.length){var s=this._string.join("");return this._string=[],s}else return null}};function bA(s){return"m0,"+s+"a"+s+","+s+" 0 1,1 0,"+-2*s+"a"+s+","+s+" 0 1,1 0,"+2*s+"z"}function Db(s,t){var e=4.5,i,n;function r(a){return a&&(typeof e=="function"&&n.pointRadius(+e.apply(this,arguments)),Io(a,i(n))),n.result()}return r.area=function(a){return Io(a,i(lr)),lr.result()},r.measure=function(a){return Io(a,i(Jd)),Jd.result()},r.bounds=function(a){return Io(a,i(Zp)),Zp.result()},r.centroid=function(a){return Io(a,i(Ns)),Ns.result()},r.projection=function(a){return arguments.length?(i=a==null?(s=null,qd):(s=a).stream,r):s},r.context=function(a){return arguments.length?(n=a==null?(t=null,new CP):new kP(t=a),typeof e!="function"&&n.pointRadius(e),r):t},r.pointRadius=function(a){return arguments.length?(e=typeof a=="function"?a:(n.pointRadius(+a),+a),r):e},r.projection(s).context(t)}function y_(s){return function(t){var e=new y0;for(var i in s)e[i]=s[i];return e.stream=t,e}}function y0(){}y0.prototype={constructor:y0,point:function(s,t){this.stream.point(s,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Lb(s,t,e){var i=s.clipExtent&&s.clipExtent();return s.scale(150).translate([0,0]),i!=null&&s.clipExtent(null),Io(e,s.stream(Zp)),t(Zp.result()),i!=null&&s.clipExtent(i),s}function b_(s,t,e){return Lb(s,function(i){var n=t[1][0]-t[0][0],r=t[1][1]-t[0][1],a=Math.min(n/(i[1][0]-i[0][0]),r/(i[1][1]-i[0][1])),o=+t[0][0]+(n-a*(i[1][0]+i[0][0]))/2,l=+t[0][1]+(r-a*(i[1][1]+i[0][1]))/2;s.scale(150*a).translate([o,l])},e)}function Bb(s,t,e){return b_(s,[[0,0],t],e)}function Ib(s,t,e){return Lb(s,function(i){var n=+t,r=n/(i[1][0]-i[0][0]),a=(n-r*(i[1][0]+i[0][0]))/2,o=-r*i[0][1];s.scale(150*r).translate([a,o])},e)}function Fb(s,t,e){return Lb(s,function(i){var n=+t,r=n/(i[1][1]-i[0][1]),a=-r*i[0][0],o=(n-r*(i[1][1]+i[0][1]))/2;s.scale(150*r).translate([a,o])},e)}var xA=16,XF=qt(30*Fe);function SA(s,t){return+t?qF(s,t):KF(s)}function KF(s){return y_({point:function(t,e){t=s(t,e),this.stream.point(t[0],t[1])}})}function qF(s,t){function e(i,n,r,a,o,l,h,d,u,c,p,g,f,_){var m=h-i,v=d-n,y=m*m+v*v;if(y>4*t&&f--){var b=a+c,x=o+p,S=l+g,A=_s(b*b+x*x+S*S),k=Zs(S/=A),w=fe(fe(S)-1)<Wt||fe(r-u)<Wt?(r+u)/2:br(x,b),T=s(w,k),M=T[0],P=T[1],O=M-i,D=P-n,R=v*O-m*D;(R*R/y>t||fe((m*O+v*D)/y-.5)>.3||a*c+o*p+l*g<XF)&&(e(i,n,r,a,o,l,M,P,w,b/=A,x/=A,S,f,_),_.point(M,P),e(M,P,w,b,x,S,h,d,u,c,p,g,f,_))}}return function(i){var n,r,a,o,l,h,d,u,c,p,g,f,_={point:m,lineStart:v,lineEnd:b,polygonStart:function(){i.polygonStart(),_.lineStart=x},polygonEnd:function(){i.polygonEnd(),_.lineStart=v}};function m(k,w){k=s(k,w),i.point(k[0],k[1])}function v(){u=NaN,_.point=y,i.lineStart()}function y(k,w){var T=Jl([k,w]),M=s(k,w);e(u,c,d,p,g,f,u=M[0],c=M[1],d=k,p=T[0],g=T[1],f=T[2],xA,i),i.point(u,c)}function b(){_.point=m,i.lineEnd()}function x(){v(),_.point=S,_.lineEnd=A}function S(k,w){y(n=k,w),r=u,a=c,o=p,l=g,h=f,_.point=y}function A(){e(u,c,d,p,g,f,r,a,n,o,l,h,xA,i),_.lineEnd=b,b()}return _}}var ZF=y_({point:function(s,t){this.stream.point(s*Fe,t*Fe)}});function JF(s){return y_({point:function(t,e){var i=s(t,e);return this.stream.point(i[0],i[1])}})}function QF(s,t,e,i,n){function r(a,o){return a*=i,o*=n,[t+s*a,e-s*o]}return r.invert=function(a,o){return[(a-t)/s*i,(e-o)/s*n]},r}function AA(s,t,e,i,n,r){var a=qt(r),o=Nt(r),l=a*s,h=o*s,d=a/s,u=o/s,c=(o*e-a*t)/s,p=(o*t+a*e)/s;function g(f,_){return f*=i,_*=n,[l*f-h*_+t,e-h*f-l*_]}return g.invert=function(f,_){return[i*(d*f-u*_+c),n*(p-u*f-d*_)]},g}function wr(s){return PP(function(){return s})()}function PP(s){var t,e=150,i=480,n=250,r=0,a=0,o=0,l=0,h=0,d,u=0,c=1,p=1,g=null,f=mA,_=null,m,v,y,b=qd,x=.5,S,A,k,w,T;function M(R){return k(R[0]*Fe,R[1]*Fe)}function P(R){return R=k.invert(R[0],R[1]),R&&[R[0]*Fi,R[1]*Fi]}M.stream=function(R){return w&&T===R?w:w=ZF(JF(d)(f(S(b(T=R)))))},M.preclip=function(R){return arguments.length?(f=R,g=void 0,D()):f},M.postclip=function(R){return arguments.length?(b=R,_=m=v=y=null,D()):b},M.clipAngle=function(R){return arguments.length?(f=+R?IF(g=R*Fe):(g=null,mA),D()):g*Fi},M.clipExtent=function(R){return arguments.length?(b=R==null?(_=m=v=y=null,qd):mP(_=+R[0][0],m=+R[0][1],v=+R[1][0],y=+R[1][1]),D()):_==null?null:[[_,m],[v,y]]},M.scale=function(R){return arguments.length?(e=+R,O()):e},M.translate=function(R){return arguments.length?(i=+R[0],n=+R[1],O()):[i,n]},M.center=function(R){return arguments.length?(r=R[0]%360*Fe,a=R[1]%360*Fe,O()):[r*Fi,a*Fi]},M.rotate=function(R){return arguments.length?(o=R[0]%360*Fe,l=R[1]%360*Fe,h=R.length>2?R[2]%360*Fe:0,O()):[o*Fi,l*Fi,h*Fi]},M.angle=function(R){return arguments.length?(u=R%360*Fe,O()):u*Fi},M.reflectX=function(R){return arguments.length?(c=R?-1:1,O()):c<0},M.reflectY=function(R){return arguments.length?(p=R?-1:1,O()):p<0},M.precision=function(R){return arguments.length?(S=SA(A,x=R*R),D()):_s(x)},M.fitExtent=function(R,L){return b_(M,R,L)},M.fitSize=function(R,L){return Bb(M,R,L)},M.fitWidth=function(R,L){return Ib(M,R,L)},M.fitHeight=function(R,L){return Fb(M,R,L)};function O(){var R=AA(e,0,0,c,p,u).apply(null,t(r,a)),L=(u?AA:QF)(e,i-R[0],n-R[1],c,p,u);return d=uP(o,l,h),A=h0(t,L),k=h0(d,A),S=SA(A,x),D()}function D(){return w=T=null,M}return function(){return t=s.apply(this,arguments),M.invert=t.invert&&P,O()}}function jb(s){var t=0,e=te/3,i=PP(s),n=i(t,e);return n.parallels=function(r){return arguments.length?i(t=r[0]*Fe,e=r[1]*Fe):[t*Fi,e*Fi]},n}function tj(s){var t=qt(s);function e(i,n){return[i*t,Nt(n)/t]}return e.invert=function(i,n){return[i/t,Zs(n*t)]},e}function ej(s,t){var e=Nt(s),i=(e+Nt(t))/2;if(fe(i)<Wt)return tj(s);var n=1+e*(2*i-e),r=_s(n)/i;function a(o,l){var h=_s(n-2*i*Nt(l))/i;return[h*Nt(o*=i),r-h*qt(o)]}return a.invert=function(o,l){var h=r-l,d=br(o,fe(h))*Us(h);return h*i<0&&(d-=te*Us(o)*Us(h)),[d/i,Zs((n-(o*o+h*h)*i*i)/(2*i))]},a}function tg(){return jb(ej).scale(155.424).center([0,33.6442])}function EP(){return tg().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function ij(s){var t=s.length;return{point:function(e,i){for(var n=-1;++n<t;)s[n].point(e,i)},sphere:function(){for(var e=-1;++e<t;)s[e].sphere()},lineStart:function(){for(var e=-1;++e<t;)s[e].lineStart()},lineEnd:function(){for(var e=-1;++e<t;)s[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<t;)s[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<t;)s[e].polygonEnd()}}}function sj(){var s,t,e=EP(),i,n=tg().rotate([154,0]).center([-2,58.5]).parallels([55,65]),r,a=tg().rotate([157,0]).center([-3,19.9]).parallels([8,18]),o,l,h={point:function(c,p){l=[c,p]}};function d(c){var p=c[0],g=c[1];return l=null,i.point(p,g),l||(r.point(p,g),l)||(o.point(p,g),l)}d.invert=function(c){var p=e.scale(),g=e.translate(),f=(c[0]-g[0])/p,_=(c[1]-g[1])/p;return(_>=.12&&_<.234&&f>=-.425&&f<-.214?n:_>=.166&&_<.234&&f>=-.214&&f<-.115?a:e).invert(c)},d.stream=function(c){return s&&t===c?s:s=ij([e.stream(t=c),n.stream(c),a.stream(c)])},d.precision=function(c){return arguments.length?(e.precision(c),n.precision(c),a.precision(c),u()):e.precision()},d.scale=function(c){return arguments.length?(e.scale(c),n.scale(c*.35),a.scale(c),d.translate(e.translate())):e.scale()},d.translate=function(c){if(!arguments.length)return e.translate();var p=e.scale(),g=+c[0],f=+c[1];return i=e.translate(c).clipExtent([[g-.455*p,f-.238*p],[g+.455*p,f+.238*p]]).stream(h),r=n.translate([g-.307*p,f+.201*p]).clipExtent([[g-.425*p+Wt,f+.12*p+Wt],[g-.214*p-Wt,f+.234*p-Wt]]).stream(h),o=a.translate([g-.205*p,f+.212*p]).clipExtent([[g-.214*p+Wt,f+.166*p+Wt],[g-.115*p-Wt,f+.234*p-Wt]]).stream(h),u()},d.fitExtent=function(c,p){return b_(d,c,p)},d.fitSize=function(c,p){return Bb(d,c,p)},d.fitWidth=function(c,p){return Ib(d,c,p)},d.fitHeight=function(c,p){return Fb(d,c,p)};function u(){return s=t=null,d}return d.scale(1070)}function RP(s){return function(t,e){var i=qt(t),n=qt(e),r=s(i*n);return[r*n*Nt(t),r*Nt(e)]}}function tc(s){return function(t,e){var i=_s(t*t+e*e),n=s(i),r=Nt(n),a=qt(n);return[br(t*r,i*a),Zs(i&&e*r/i)]}}var OP=RP(function(s){return _s(2/(1+s))});OP.invert=tc(function(s){return 2*Zs(s/2)});function nj(){return wr(OP).scale(124.75).clipAngle(180-.001)}var DP=RP(function(s){return(s=dP(s))&&s/Nt(s)});DP.invert=tc(function(s){return s});function rj(){return wr(DP).scale(79.4188).clipAngle(180-.001)}function x_(s,t){return[s,$p(Ob(($e+t)/2))]}x_.invert=function(s,t){return[s,2*wh(hP(t))-$e]};function aj(){return LP(x_).scale(961/Cs)}function LP(s){var t=wr(s),e=t.center,i=t.scale,n=t.translate,r=t.clipExtent,a=null,o,l,h;t.scale=function(u){return arguments.length?(i(u),d()):i()},t.translate=function(u){return arguments.length?(n(u),d()):n()},t.center=function(u){return arguments.length?(e(u),d()):e()},t.clipExtent=function(u){return arguments.length?(u==null?a=o=l=h=null:(a=+u[0][0],o=+u[0][1],l=+u[1][0],h=+u[1][1]),d()):a==null?null:[[a,o],[l,h]]};function d(){var u=te*i(),c=t(TF(t.rotate()).invert([0,0]));return r(a==null?[[c[0]-u,c[1]-u],[c[0]+u,c[1]+u]]:s===x_?[[Math.max(c[0]-u,a),o],[Math.min(c[0]+u,l),h]]:[[a,Math.max(c[1]-u,o)],[l,Math.min(c[1]+u,h)]])}return d()}function Nc(s){return Ob(($e+s)/2)}function oj(s,t){var e=qt(s),i=s===t?Nt(s):$p(e/qt(t))/$p(Nc(t)/Nc(s)),n=e*Vm(Nc(s),i)/i;if(!i)return x_;function r(a,o){n>0?o<-$e+Wt&&(o=-$e+Wt):o>$e-Wt&&(o=$e-Wt);var l=n/Vm(Nc(o),i);return[l*Nt(i*a),n-l*qt(i*a)]}return r.invert=function(a,o){var l=n-o,h=Us(i)*_s(a*a+l*l),d=br(a,fe(l))*Us(l);return l*i<0&&(d-=te*Us(a)*Us(l)),[d/i,2*wh(Vm(n/h,1/i))-$e]},r}function lj(){return jb(oj).scale(109.5).parallels([30,30])}function eg(s,t){return[s,t]}eg.invert=eg;function hj(){return wr(eg).scale(152.63)}function dj(s,t){var e=qt(s),i=s===t?Nt(s):(e-qt(t))/(t-s),n=e/i+s;if(fe(i)<Wt)return eg;function r(a,o){var l=n-o,h=i*a;return[l*Nt(h),n-l*qt(h)]}return r.invert=function(a,o){var l=n-o,h=br(a,fe(l))*Us(l);return l*i<0&&(h-=te*Us(a)*Us(l)),[h/i,n-Us(i)*_s(a*a+l*l)]},r}function uj(){return jb(dj).scale(131.154).center([0,13.9389])}var yd=1.340264,bd=-.081106,xd=893e-6,Sd=.003796,ig=_s(3)/2,cj=12;function BP(s,t){var e=Zs(ig*Nt(t)),i=e*e,n=i*i*i;return[s*qt(e)/(ig*(yd+3*bd*i+n*(7*xd+9*Sd*i))),e*(yd+bd*i+n*(xd+Sd*i))]}BP.invert=function(s,t){for(var e=t,i=e*e,n=i*i*i,r=0,a,o,l;r<cj&&(o=e*(yd+bd*i+n*(xd+Sd*i))-t,l=yd+3*bd*i+n*(7*xd+9*Sd*i),e-=a=o/l,i=e*e,n=i*i*i,!(fe(a)<wF));++r);return[ig*s*(yd+3*bd*i+n*(7*xd+9*Sd*i))/qt(e),Zs(Nt(e)/ig)]};function pj(){return wr(BP).scale(177.158)}function IP(s,t){var e=qt(t),i=qt(s)*e;return[e*Nt(s)/i,Nt(t)/i]}IP.invert=tc(wh);function gj(){return wr(IP).scale(144.049).clipAngle(60)}function fj(){var s=1,t=0,e=0,i=1,n=1,r=0,a,o,l=null,h,d,u,c=1,p=1,g=y_({point:function(b,x){var S=y([b,x]);this.stream.point(S[0],S[1])}}),f=qd,_,m;function v(){return c=s*i,p=s*n,_=m=null,y}function y(b){var x=b[0]*c,S=b[1]*p;if(r){var A=S*a-x*o;x=x*a+S*o,S=A}return[x+t,S+e]}return y.invert=function(b){var x=b[0]-t,S=b[1]-e;if(r){var A=S*a+x*o;x=x*a-S*o,S=A}return[x/c,S/p]},y.stream=function(b){return _&&m===b?_:_=g(f(m=b))},y.postclip=function(b){return arguments.length?(f=b,l=h=d=u=null,v()):f},y.clipExtent=function(b){return arguments.length?(f=b==null?(l=h=d=u=null,qd):mP(l=+b[0][0],h=+b[0][1],d=+b[1][0],u=+b[1][1]),v()):l==null?null:[[l,h],[d,u]]},y.scale=function(b){return arguments.length?(s=+b,v()):s},y.translate=function(b){return arguments.length?(t=+b[0],e=+b[1],v()):[t,e]},y.angle=function(b){return arguments.length?(r=b%360*Fe,o=Nt(r),a=qt(r),v()):r*Fi},y.reflectX=function(b){return arguments.length?(i=b?-1:1,v()):i<0},y.reflectY=function(b){return arguments.length?(n=b?-1:1,v()):n<0},y.fitExtent=function(b,x){return b_(y,b,x)},y.fitSize=function(b,x){return Bb(y,b,x)},y.fitWidth=function(b,x){return Ib(y,b,x)},y.fitHeight=function(b,x){return Fb(y,b,x)},y}function FP(s,t){var e=t*t,i=e*e;return[s*(.8707-.131979*e+i*(-.013791+i*(.003971*e-.001529*i))),t*(1.007226+e*(.015085+i*(-.044475+.028874*e-.005916*i)))]}FP.invert=function(s,t){var e=t,i=25,n;do{var r=e*e,a=r*r;e-=n=(e*(1.007226+r*(.015085+a*(-.044475+.028874*r-.005916*a)))-t)/(1.007226+r*(.015085*3+a*(-.044475*7+.028874*9*r-.005916*11*a)))}while(fe(n)>Wt&&--i>0);return[s/(.8707+(r=e*e)*(-.131979+r*(-.013791+r*r*r*(.003971-.001529*r)))),e]};function _j(){return wr(FP).scale(175.295)}function jP(s,t){return[qt(t)*Nt(s),Nt(t)]}jP.invert=tc(Zs);function mj(){return wr(jP).scale(249.5).clipAngle(90+Wt)}function zP(s,t){var e=qt(t),i=1+qt(s)*e;return[e*Nt(s)/i,Nt(t)/i]}zP.invert=tc(function(s){return 2*wh(s)});function vj(){return wr(zP).scale(250).clipAngle(142)}function HP(s,t){return[$p(Ob(($e+t)/2)),-s]}HP.invert=function(s,t){return[-t,2*wh(hP(s))-$e]};function yj(){var s=LP(HP),t=s.center,e=s.rotate;return s.center=function(i){return arguments.length?t([-i[1],i[0]]):(i=t(),[i[1],-i[0]])},s.rotate=function(i){return arguments.length?e([i[0],i[1],i.length>2?i[2]+90:90]):(i=e(),[i[0],i[1],i[2]-90])},e([0,0,90]).scale(159.155)}function bj(s){return s}function xj(s){if(s==null)return bj;var t,e,i=s.scale[0],n=s.scale[1],r=s.translate[0],a=s.translate[1];return function(o,l){l||(t=e=0);var h=2,d=o.length,u=new Array(d);for(u[0]=(t+=o[0])*i+r,u[1]=(e+=o[1])*n+a;h<d;)u[h]=o[h],++h;return u}}function Sj(s,t){for(var e,i=s.length,n=i-t;n<--i;)e=s[n],s[n++]=s[i],s[i]=e}function Aj(s,t){return typeof t=="string"&&(t=s.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(e){return kA(s,e)})}:kA(s,t)}function kA(s,t){var e=t.id,i=t.bbox,n=t.properties==null?{}:t.properties,r=kj(s,t);return e==null&&i==null?{type:"Feature",properties:n,geometry:r}:i==null?{type:"Feature",id:e,properties:n,geometry:r}:{type:"Feature",id:e,bbox:i,properties:n,geometry:r}}function kj(s,t){var e=xj(s.transform),i=s.arcs;function n(d,u){u.length&&u.pop();for(var c=i[d<0?~d:d],p=0,g=c.length;p<g;++p)u.push(e(c[p],p));d<0&&Sj(u,g)}function r(d){return e(d)}function a(d){for(var u=[],c=0,p=d.length;c<p;++c)n(d[c],u);return u.length<2&&u.push(u[0]),u}function o(d){for(var u=a(d);u.length<4;)u.push(u[0]);return u}function l(d){return d.map(o)}function h(d){var u=d.type,c;switch(u){case"GeometryCollection":return{type:u,geometries:d.geometries.map(h)};case"Point":c=r(d.coordinates);break;case"MultiPoint":c=d.coordinates.map(r);break;case"LineString":c=a(d.arcs);break;case"MultiLineString":c=d.arcs.map(a);break;case"Polygon":c=l(d.arcs);break;case"MultiPolygon":c=d.arcs.map(l);break;default:return null}return{type:u,coordinates:c}}return h(t)}var GP={exports:{}},Sn=function(s,t){this.p1=s,this.p2=t};Sn.prototype.rise=function(){return this.p2[1]-this.p1[1]};Sn.prototype.run=function(){return this.p2[0]-this.p1[0]};Sn.prototype.slope=function(){return this.rise()/this.run()};Sn.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)};Sn.prototype.isVertical=function(){return!isFinite(this.slope())};Sn.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]};Sn.prototype._perpendicularDistanceHorizontal=function(s){return Math.abs(this.p1[1]-s[1])};Sn.prototype._perpendicularDistanceVertical=function(s){return Math.abs(this.p1[0]-s[0])};Sn.prototype._perpendicularDistanceHasSlope=function(s){var t=this.slope(),e=this.yIntercept();return Math.abs(t*s[0]-s[1]+e)/Math.sqrt(Math.pow(t,2)+1)};Sn.prototype.perpendicularDistance=function(s){return this.isVertical()?this._perpendicularDistanceVertical(s):this.isHorizontal()?this._perpendicularDistanceHorizontal(s):this._perpendicularDistanceHasSlope(s)};var wj=Sn,Tj=wj,b0=function(s,t){for(var e=0,i=0,n=1;n<=s.length-2;n++){var r=new Tj(s[0],s[s.length-1]).perpendicularDistance(s[n]);r>e&&(i=n,e=r)}if(e>t)var a=b0(s.slice(0,i),t),o=b0(s.slice(i,s.length),t),l=a.concat(o);else s.length>1?l=[s[0],s[s.length-1]]:l=[s[0]];return l},Mj=b0;(function(s){var t=Mj;s.exports=function(n,r,a){return a||(n=JSON.parse(JSON.stringify(n))),n.features?i(n,r):n.type&&n.type==="Feature"?e(n,r):new Error("FeatureCollection or individual Feature required")},s.exports.simplify=function(n,r){return t(n,r)};function e(n,r){var a=n.geometry,o=a.type;if(o==="LineString")a.coordinates=s.exports.simplify(a.coordinates,r);else if(o==="Polygon"||o==="MultiLineString")for(var l=0;l<a.coordinates.length;l++)a.coordinates[l]=s.exports.simplify(a.coordinates[l],r);else if(o==="MultiPolygon")for(var h=0;h<a.coordinates.length;h++)for(var d=0;d<a.coordinates[h].length;d++)a.coordinates[h][d]=s.exports.simplify(a.coordinates[h][d],r);return n}function i(n,r){for(var a=0;a<n.features.length;a++)n.features[a]=e(n.features[a],r);return n}})(GP);var Cj=GP.exports;const Pj=GC(Cj),S_=function(s,...t){return Rj(hi(s),...t)};function WP(s,t,e){const i=t[e];if(i===void 0)s[e]=null;else if(Vt(i)){Vt(s[e])||(s[e]={});for(const n in i)WP(s[e],i,n)}else s[e]=i}function Ej(s,t){if(Vt(t)&&s!==t)for(const e in t)WP(s,t,e)}function Rj(s,...t){s||(s={});let e=-1;const i=t.length;for(;++e<i;)Ej(s,t[e]);return s}const Oj={tolerance:.01},NP=(s,t)=>{const e=S_(Oj,t),{tolerance:i}=e;return Pj(s,i)};var so;(function(s){s.DSV="dsv",s.TREE="tree",s.GEO="geo",s.BYTE="bytejson",s.HEX="hex",s.GRAPH="graph",s.TABLE="table",s.GEO_GRATICULE="geo-graticule"})(so||(so={}));const Dj=(s,t)=>{const{fields:e,key:i,value:n,retains:r}=t,a=[];for(let o=0;o<s.length;o++)e.forEach(l=>{const h={};if(h[i]=l,h[n]=s[o][l],r)r.forEach(d=>{h[d]=s[o][d]});else for(const d in s[o])e.indexOf(d)===-1&&(h[d]=s[o][d]);a.push(h)});return a},VP=(s,t)=>{var e,i;if(!(t!=null&&t.fields)||s.length===0)return s;const n=t.fields,r=s[0],a={},o=[];for(const l in n)if(Object.prototype.hasOwnProperty.call(n,l)){const h=n[l];if(!h.type){let u=r;l in r||(u=(e=s.find(c=>l in c))!==null&&e!==void 0?e:r),h.type=typeof u[l]=="number"?"linear":"ordinal"}let d;if(typeof h.sortIndex=="number"&&(d={key:l,type:h.type,index:h.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:h.sortReverse===!0},o.push(d)),((i=h.domain)===null||i===void 0?void 0:i.length)>0)if(h.type==="ordinal"){h._domainCache={},a[l]=h;const u={};h.domain.forEach((c,p)=>{u[c]=p,h._domainCache[c]=p}),d&&(d.sortIndex=u,d.sortIndexCount=h.domain.length)}else h.domain.length>=2&&(a[l]=h)}return Object.keys(a).length>0&&(s=s.filter(l=>{for(const h in a){const d=a[h];if(d.type==="ordinal"){if(!(l[h]in d._domainCache))return!1}else if(d.domain[0]>l[h]||d.domain[1]<l[h])return!1}return!0})),o.sort((l,h)=>l.index-h.index),s.sort((l,h)=>Lj(l,h,o)),s};function Lj(s,t,e){for(let i=0;i<e.length;i++){const n=e[i];let r=0;if(n.type==="ordinal"?(n.sortIndex[t[n.key]]===void 0&&(n.sortIndex[t[n.key]]=n.sortIndexCount++),n.sortIndex[s[n.key]]===void 0&&(n.sortIndex[s[n.key]]=n.sortIndexCount++),r=n.sortIndex[s[n.key]]-n.sortIndex[t[n.key]]):n.type==="linear"&&(r=s[n.key]-t[n.key]),n.sortReverse&&(r=-r),r!==0)return r}return 0}var wA={},qm={},Zm=34,zh=10,Jm=13;function UP(s){return new Function("d","return {"+s.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Bj(s,t){var e=UP(s);return function(i,n){return t(e(i),n,s)}}function TA(s){var t=Object.create(null),e=[];return s.forEach(function(i){for(var n in i)n in t||e.push(t[n]=n)}),e}function ps(s,t){var e=s+"",i=e.length;return i<t?new Array(t-i+1).join(0)+e:e}function Ij(s){return s<0?"-"+ps(-s,6):s>9999?"+"+ps(s,6):ps(s,4)}function Fj(s){var t=s.getUTCHours(),e=s.getUTCMinutes(),i=s.getUTCSeconds(),n=s.getUTCMilliseconds();return isNaN(s)?"Invalid Date":Ij(s.getUTCFullYear())+"-"+ps(s.getUTCMonth()+1,2)+"-"+ps(s.getUTCDate(),2)+(n?"T"+ps(t,2)+":"+ps(e,2)+":"+ps(i,2)+"."+ps(n,3)+"Z":i?"T"+ps(t,2)+":"+ps(e,2)+":"+ps(i,2)+"Z":e||t?"T"+ps(t,2)+":"+ps(e,2)+"Z":"")}function zb(s){var t=new RegExp('["'+s+`
- \r]`),e=s.charCodeAt(0);function i(u,c){var p,g,f=n(u,function(_,m){if(p)return p(_,m-1);g=_,p=c?Bj(_,c):UP(_)});return f.columns=g||[],f}function n(u,c){var p=[],g=u.length,f=0,_=0,m,v=g<=0,y=!1;u.charCodeAt(g-1)===zh&&--g,u.charCodeAt(g-1)===Jm&&--g;function b(){if(v)return qm;if(y)return y=!1,wA;var S,A=f,k;if(u.charCodeAt(A)===Zm){for(;f++<g&&u.charCodeAt(f)!==Zm||u.charCodeAt(++f)===Zm;);return(S=f)>=g?v=!0:(k=u.charCodeAt(f++))===zh?y=!0:k===Jm&&(y=!0,u.charCodeAt(f)===zh&&++f),u.slice(A+1,S-1).replace(/""/g,'"')}for(;f<g;){if((k=u.charCodeAt(S=f++))===zh)y=!0;else if(k===Jm)y=!0,u.charCodeAt(f)===zh&&++f;else if(k!==e)continue;return u.slice(A,S)}return v=!0,u.slice(A,g)}for(;(m=b())!==qm;){for(var x=[];m!==wA&&m!==qm;)x.push(m),m=b();c&&(x=c(x,_++))==null||p.push(x)}return p}function r(u,c){return u.map(function(p){return c.map(function(g){return d(p[g])}).join(s)})}function a(u,c){return c==null&&(c=TA(u)),[c.map(d).join(s)].concat(r(u,c)).join(`
- `)}function o(u,c){return c==null&&(c=TA(u)),r(u,c).join(`
- `)}function l(u){return u.map(h).join(`
- `)}function h(u){return u.map(d).join(s)}function d(u){return u==null?"":u instanceof Date?Fj(u):t.test(u+="")?'"'+u.replace(/"/g,'""')+'"':u}return{parse:i,parseRows:n,format:a,formatBody:o,formatRows:l,formatRow:h,formatValue:d}}var jj=zb(","),zj=jj.parse,Hj=zb(" "),Gj=Hj.parse;const Wj={delimiter:","},$P=(s,t={},e)=>{e.type=so.DSV;const i=S_(Wj,t),{delimiter:n}=i;if(!ot(n))throw new TypeError("Invalid delimiter: must be a string!");return zb(n).parse(s)},YP=(s,t={},e)=>(e.type=so.DSV,zj(s)),XP=(s,t={},e)=>(e.type=so.DSV,Gj(s));function Nj(s){if(!s)throw new Error("geojson is required");switch(s.type){case"Feature":return KP(s);case"FeatureCollection":return Vj(s);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Hb(s);default:throw new Error("unknown GeoJSON type")}}function KP(s){var t={type:"Feature"};return Object.keys(s).forEach(function(e){switch(e){case"type":case"properties":case"geometry":return;default:t[e]=s[e]}}),t.properties=qP(s.properties),t.geometry=Hb(s.geometry),t}function qP(s){var t={};return s&&Object.keys(s).forEach(function(e){var i=s[e];typeof i=="object"?i===null?t[e]=null:Array.isArray(i)?t[e]=i.map(function(n){return n}):t[e]=qP(i):t[e]=i}),t}function Vj(s){var t={type:"FeatureCollection"};return Object.keys(s).forEach(function(e){switch(e){case"type":case"features":return;default:t[e]=s[e]}}),t.features=s.features.map(function(e){return KP(e)}),t}function Hb(s){var t={type:s.type};return s.bbox&&(t.bbox=s.bbox),s.type==="GeometryCollection"?(t.geometries=s.geometries.map(function(e){return Hb(e)}),t):(t.coordinates=ZP(s.coordinates),t)}function ZP(s){var t=s;return typeof t[0]!="object"?t.slice():t.map(function(e){return ZP(e)})}function od(s){if(Array.isArray(s))return s;if(s.type==="Feature"){if(s.geometry!==null)return s.geometry.coordinates}else if(s.coordinates)return s.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function x0(s){for(var t=od(s),e=0,i=1,n,r;i<t.length;)n=r||t[0],r=t[i],e+=(r[0]-n[0])*(r[1]+n[1]),i++;return e>0}function MA(s,t){if(s.type==="Feature")t(s,0);else if(s.type==="FeatureCollection")for(var e=0;e<s.features.length&&t(s.features[e],e)!==!1;e++);}function Gb(s,t){var e,i,n,r,a,o,l,h,d,u,c=0,p=s.type==="FeatureCollection",g=s.type==="Feature",f=p?s.features.length:1;for(e=0;e<f;e++){for(o=p?s.features[e].geometry:g?s.geometry:s,h=p?s.features[e].properties:g?s.properties:{},d=p?s.features[e].bbox:g?s.bbox:void 0,u=p?s.features[e].id:g?s.id:void 0,l=o?o.type==="GeometryCollection":!1,a=l?o.geometries.length:1,n=0;n<a;n++){if(r=l?o.geometries[n]:o,r===null){if(t(null,c,h,d,u)===!1)return!1;continue}switch(r.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(r,c,h,d,u)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<r.geometries.length;i++)if(t(r.geometries[i],c,h,d,u)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}c++}}function Uj(s,t){Gb(s,function(e,i,n,r,a){var o=e===null?null:e.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return t(aA(e,n,{bbox:r,id:a}),i,0)===!1?!1:void 0}var l;switch(o){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var h=0;h<e.coordinates.length;h++){var d=e.coordinates[h],u={type:l,coordinates:d};if(t(aA(u,n),i,h)===!1)return!1}})}function $j(s,t){if(t=t||{},!bF(t))throw new Error("options is invalid");var e=t.reverse||!1,i=t.mutate||!1;if(!s)throw new Error("<geojson> is required");if(typeof e!="boolean")throw new Error("<reverse> must be a boolean");if(typeof i!="boolean")throw new Error("<mutate> must be a boolean");i===!1&&(s=Nj(s));var n=[];switch(s.type){case"GeometryCollection":return Gb(s,function(r){Mp(r,e)}),s;case"FeatureCollection":return MA(s,function(r){MA(Mp(r,e),function(a){n.push(a)})}),lP(n)}return Mp(s,e)}function Mp(s,t){var e=s.type==="Feature"?s.geometry.type:s.type;switch(e){case"GeometryCollection":return Gb(s,function(i){Mp(i,t)}),s;case"LineString":return CA(od(s),t),s;case"Polygon":return PA(od(s),t),s;case"MultiLineString":return od(s).forEach(function(i){CA(i,t)}),s;case"MultiPolygon":return od(s).forEach(function(i){PA(i,t)}),s;case"Point":case"MultiPoint":return s}}function CA(s,t){x0(s)===t&&s.reverse()}function PA(s,t){x0(s[0])!==t&&s[0].reverse();for(var e=1;e<s.length;e++)x0(s[e])===t&&s[e].reverse()}function Yj(s){if(!s)throw new Error("geojson is required");var t=[];return Uj(s,function(e){t.push(e)}),lP(t)}const EA=Db(),JP={centroid:!1,name:!1,bbox:!1,rewind:!1},RA=s=>{if(s.geometry.type.startsWith("Multi")){const t=Yj(s).features[0];return Object.assign(Object.assign({},t),t.properties)}return Object.assign(Object.assign({},s),s.properties)},Xj=s=>{const t=[];return s.forEach(e=>{e.type==="FeatureCollection"?e.features.forEach(i=>{t.push(RA(i))}):t.push(RA(e))}),t},QP=(s,t={},e)=>{e.type=so.GEO;const i=S_(JP,t),{centroid:n,name:r,bbox:a,rewind:o}=i;if(Array.isArray(s))return Xj(s);let l=s.features;return o&&(l=$j(s,{reverse:!Vt(o)||o.reverse}).features),l.forEach(h=>{if(n){const d=EA.centroid(h);h.centroidX=d[0],h.centroidY=d[1]}if(r&&(h.name=h.properties.name),a){const d=EA.bounds(h);h.bbox=d}}),s.features=l,s},Kj={},qj=(s,t,e)=>{e.type=so.GEO;const i=S_(JP,Kj,t),{object:n}=i;if(!ot(n))throw new TypeError("Invalid object: must be a string!");const r=Aj(s,s.objects[n]);return QP(r,i,e)},A_=(s,t,e)=>{const i=!pe(t==null?void 0:t.dependencyUpdate)||(t==null?void 0:t.dependencyUpdate);if(!s||!U(s))throw new TypeError("Invalid data: must be DataView array!");return U(e.rawData)&&e.rawData.forEach(n=>{n.target&&(n.target.removeListener("change",e.reRunAllTransform),n.target.removeListener("markRunning",e.markRunning))}),i&&s.forEach(n=>{n.target.addListener("change",e.reRunAllTransform),n.target.addListener("markRunning",e.markRunning)}),s};let Qm=0;const Zj=1e8;function tE(s="dataset"){return Qm>Zj&&(Qm=0),s+"_"+Qm++}class no{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new vo,i=t!=null&&t.name?t.name:tE("dataset"),this.name=i,this._logger=(e=t==null?void 0:t.logger)!==null&&e!==void 0?e:zt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&((i=this._logger)===null||i===void 0||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&((i=this._logger)===null||i===void 0||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&((i=this._logger)===null||i===void 0||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let n=this._callMap.get(i);n||(n=()=>{t.some(r=>r.isRunning)||i()}),t.forEach(r=>{r.target.addListener(e,n)}),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const n=this._callMap.get(i);n&&t.forEach(r=>{r.target.removeListener(e,n)}),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach(e=>{var i;return(i=this.getDataView(e.name))===null||i===void 0?void 0:i.markRunning()}),t.forEach(e=>{var i;return(i=this.getDataView(e.name))===null||i===void 0?void 0:i.parseNewData(e.data,e.options)})}multipleDataViewUpdateInRawData(t){t.forEach(e=>{var i;return(i=this.getDataView(e.name))===null||i===void 0?void 0:i.markRunning()}),t.forEach(e=>{var i;return(i=this.getDataView(e.name))===null||i===void 0?void 0:i.updateRawData(e.data,e.options)})}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const tv="_data-view-diff-rank";class Zt{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new vo,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(n={pushHistory:!0,emitMessage:!0})=>(this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach(r=>{this.executeTransform(r,{pushHistory:n.pushHistory,emitMessage:!1}),this.isLastTransform(r)&&this.diffLastData()}),this.isRunning=!1,n.emitMessage!==!1&&this.target.emit("change",[]),this),this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=e!=null&&e.name?e.name:tE("dataview"),this.name=i,e!=null&&e.history&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(e==null?void 0:e.fields)}parse(t,e,i=!1){var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const r=this.cloneParseData(t,e);if(e!=null&&e.type){const a=((n=this.dataSet.getParser(e.type))!==null&&n!==void 0?n:this.dataSet.getParser("bytejson"))(r,e.options,this);this.rawData=r,this.parserData=a,this.history&&this.historyData.push(r,a),this.latestData=a}else this.parserData=r,this.rawData=r,this.history&&this.historyData.push(r),this.latestData=r;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if(t.type==="fields"){this._fields=t.options.fields;const n=this.transformsArr.findIndex(r=>r.type===t.type);n>=0&&(i=!1,this.transformsArr[n].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const n=this.isLastTransform(t);this.executeTransform(t),n&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort((t,e)=>{var i,n;return((i=t.level)!==null&&i!==void 0?i:0)-((n=e.level)!==null&&n!==void 0?n:0)})}executeTransform(t,e={pushHistory:!0,emitMessage:!0}){const{pushHistory:i,emitMessage:n}=e,r=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&i!==!1&&this.historyData.push(r),this.latestData=r,n!==!1&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,this._diffMap=new Map,this._diffRank=0}disableDiff(){this._diffData=!1,this._diffMap=null,this._diffRank=null}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData||!this.latestData.forEach||!(!((t=this._diffKeys)===null||t===void 0)&&t.length))return;const e=this._diffRank+1;if(this._diffRank===0)this.latestData.forEach(i=>{i[tv]=e,this._diffMap.set(this._diffKeys.reduce((n,r)=>n+i[r],""),i)}),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let i;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach(n=>{n[tv]=e,i=this._diffKeys.reduce((r,a)=>r+n[a],""),this._diffMap.get(i)?this.latestDataAUD.update.push(n):this.latestDataAUD.add.push(n),this._diffMap.set(i,n)}),this._diffMap.forEach((n,r)=>{n[tv]<e&&(this.latestDataAUD.del.push(n),this._diffMap.delete(r))})}this._diffRank=e}cloneParseData(t,e){let i=!1;return t instanceof Zt||(e==null?void 0:e.clone)!==!0||(i=!0),i?hi(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:((t=this.parseOption)===null||t===void 0?void 0:t.type)==="dataview"&&this.rawData.length===1&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?at({},this._fields,t):t;const i=this.transformsArr.find(n=>n.type==="fields");!C(this._fields)&&C(i)?(this.dataSet.registerTransform("fields",VP),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this._diffMap=null,this._diffRank=null,this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class $r{static getInstance(){return $r.instance||($r.instance=new $r),$r.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map((e,i)=>[e.toLowerCase(),i]))}pad(t,e,i){const n=t<0?"-":"",r=(n?-t:t)+"",a=r.length;return n+(a<i?new Array(i-a+1).join(e)+r:r)}parseSpecifier(t,e,i,n){let r=0;const a=e.length,o=i.length;let l,h;for(;r<a;){if(n>=o)return-1;if(l=e.charCodeAt(r++),l===37){if(l=e.charAt(r++),h=this.parses[l in this.pads?e.charAt(r++):l],!h||(n=h(t,i,n))<0)return-1}else if(l!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const r=i.newDate(1900,void 0,1);return i.parseSpecifier(r,t,n+="",0)!==n.length?null:"Q"in r?new Date(r.Q):"s"in r?new Date(1e3*r.s+("L"in r?r.L:0)):(e&&!("Z"in r)&&(r.Z=0),"p"in r&&(r.H=r.H%12+12*r.p),r.m===void 0&&(r.m="q"in r?r.q:0),"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,i.utcDate(r)):i.localDate(r))}}newFormat(t,e){const i=this;return function(n){const r=[];let a=-1,o=0;const l=t.length;let h,d,u;for(n instanceof Date||(n=new Date(+n));++a<l;)t.charCodeAt(a)===37&&(r.push(t.slice(o,a)),(d=i.pads[h=t.charAt(++a)])?h=t.charAt(++a):d=h==="e"?" ":"0",u=e[h],h=u(n,d),r.push(h),o=a+1);return r.push(t.slice(o,a)),r.join("")}}getFullTimeStamp(t){const e=parseInt(t+"",10);return String(e).length===10?1e3*e:e}}const Sa=(s,t)=>(q(sg.warnHandler)&&sg.warnHandler.call(null,s,t),zt.getInstance().warn(`[VChart warn]: ${s}`)),th=(s,t,e)=>{{if(!q(sg.errorHandler))throw new Error(s);sg.errorHandler.call(null,s,t)}},sg={warnHandler:!1,errorHandler:!1};class Xe{static GenAutoIncrementId(){return Xe.auto_increment_id++}}Xe.auto_increment_id=0;class Pt{constructor(t){this.id=Xe.GenAutoIncrementId(),this.registry=t}}const k_="named",eE="inject",iE="multi_inject",sE="inversify:tagged",nE="inversify:paramtypes";class Wb{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===k_?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var OA={};const Bl=function(s){var t;return function(e){const i=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",r=n&&Symbol.toPrimitive!==void 0?Symbol.toPrimitive:"@@toPrimitive",a=n&&Symbol.iterator!==void 0?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",l={__proto__:[]}instanceof Array,h=!o&&!l,d={create:o?function(){return et(Object.create(null))}:l?function(){return et({__proto__:null})}:function(){return et({})},has:h?function(K,W){return i.call(K,W)}:function(K,W){return W in K},get:h?function(K,W){return i.call(K,W)?K[W]:void 0}:function(K,W){return K[W]}},u=Object.getPrototypeOf(Function),c=typeof process=="object"&&OA&&OA.REFLECT_METADATA_USE_MAP_POLYFILL==="true",p=c||typeof Map!="function"||typeof Map.prototype.entries!="function"?G():Map,g=((c||typeof Set!="function"||typeof Set.prototype.entries!="function")&&X(),new(c||typeof WeakMap!="function"?Z():WeakMap));function f(K,W,it,ht){if(!O(it))throw new TypeError;return k(K,W,it,ht)}function _(K,W,it){if(!O(W))throw new TypeError;return T(it)||(it=F(it)),b(K,W,it)}function m(K,W,it){if(!O(W))throw new TypeError;return T(it)||(it=F(it)),x(K,W,it)}function v(K,W,it){if(!O(W))throw new TypeError;return T(it)||(it=F(it)),S(K,W,it)}function y(K,W,it){let ht=g.get(K);if(T(ht)){if(!it)return;ht=new p,g.set(K,ht)}let dt=ht.get(W);if(T(dt)){if(!it)return;dt=new p,ht.set(W,dt)}return dt}function b(K,W,it){if(x(K,W,it))return!0;const ht=V(W);return!M(ht)&&b(K,ht,it)}function x(K,W,it){const ht=y(W,it,!1);return!T(ht)&&L(ht.has(K))}function S(K,W,it){if(x(K,W,it))return A(K,W,it);const ht=V(W);return M(ht)?void 0:S(K,ht,it)}function A(K,W,it){const ht=y(W,it,!1);if(!T(ht))return ht.get(K)}function k(K,W,it,ht){y(it,ht,!0).set(K,W)}function w(K){if(K===null)return 1;switch(typeof K){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return K===null?1:6;default:return 6}}function T(K){return K===void 0}function M(K){return K===null}function P(K){return typeof K=="symbol"}function O(K){return typeof K=="object"?K!==null:typeof K=="function"}function D(K,W){switch(w(K)){case 0:case 1:case 2:case 3:case 4:case 5:return K}const it="string",ht=N(K,r);if(ht!==void 0){const dt=ht.call(K,it);if(O(dt))throw new TypeError;return dt}return R(K)}function R(K,W){{const it=K.toString;if(z(it)){const dt=it.call(K);if(!O(dt))return dt}const ht=K.valueOf;if(z(ht)){const dt=ht.call(K);if(!O(dt))return dt}}throw new TypeError}function L(K){return!!K}function B(K){return""+K}function F(K){const W=D(K);return P(W)?W:B(W)}function z(K){return typeof K=="function"}function N(K,W){const it=K[W];if(it!=null){if(!z(it))throw new TypeError;return it}}function V(K){const W=Object.getPrototypeOf(K);if(typeof K!="function"||K===u||W!==u)return W;const it=K.prototype,ht=it&&Object.getPrototypeOf(it);if(ht==null||ht===Object.prototype)return W;const dt=ht.constructor;return typeof dt!="function"||dt===K?W:dt}function G(){const K={},W=[],it=function(){function gt(wt,kt,Lt){this._index=0,this._keys=wt,this._values=kt,this._selector=Lt}return gt.prototype["@@iterator"]=function(){return this},gt.prototype[a]=function(){return this},gt.prototype.next=function(){const wt=this._index;if(wt>=0&&wt<this._keys.length){const kt=this._selector(this._keys[wt],this._values[wt]);return wt+1>=this._keys.length?(this._index=-1,this._keys=W,this._values=W):this._index++,{value:kt,done:!1}}return{value:void 0,done:!0}},gt.prototype.throw=function(wt){throw this._index>=0&&(this._index=-1,this._keys=W,this._values=W),wt},gt.prototype.return=function(wt){return this._index>=0&&(this._index=-1,this._keys=W,this._values=W),{value:wt,done:!0}},gt}();return function(){function gt(){this._keys=[],this._values=[],this._cacheKey=K,this._cacheIndex=-2}return Object.defineProperty(gt.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),gt.prototype.has=function(wt){return this._find(wt,!1)>=0},gt.prototype.get=function(wt){const kt=this._find(wt,!1);return kt>=0?this._values[kt]:void 0},gt.prototype.set=function(wt,kt){const Lt=this._find(wt,!0);return this._values[Lt]=kt,this},gt.prototype.delete=function(wt){const kt=this._find(wt,!1);if(kt>=0){const Lt=this._keys.length;for(let Ot=kt+1;Ot<Lt;Ot++)this._keys[Ot-1]=this._keys[Ot],this._values[Ot-1]=this._values[Ot];return this._keys.length--,this._values.length--,wt===this._cacheKey&&(this._cacheKey=K,this._cacheIndex=-2),!0}return!1},gt.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=K,this._cacheIndex=-2},gt.prototype.keys=function(){return new it(this._keys,this._values,ht)},gt.prototype.values=function(){return new it(this._keys,this._values,dt)},gt.prototype.entries=function(){return new it(this._keys,this._values,Rt)},gt.prototype["@@iterator"]=function(){return this.entries()},gt.prototype[a]=function(){return this.entries()},gt.prototype._find=function(wt,kt){return this._cacheKey!==wt&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=wt)),this._cacheIndex<0&&kt&&(this._cacheIndex=this._keys.length,this._keys.push(wt),this._values.push(void 0)),this._cacheIndex},gt}();function ht(gt,wt){return gt}function dt(gt,wt){return wt}function Rt(gt,wt){return[gt,wt]}}function X(){return function(){function K(){this._map=new p}return Object.defineProperty(K.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),K.prototype.has=function(W){return this._map.has(W)},K.prototype.add=function(W){return this._map.set(W,W),this},K.prototype.delete=function(W){return this._map.delete(W)},K.prototype.clear=function(){this._map.clear()},K.prototype.keys=function(){return this._map.keys()},K.prototype.values=function(){return this._map.values()},K.prototype.entries=function(){return this._map.entries()},K.prototype["@@iterator"]=function(){return this.keys()},K.prototype[a]=function(){return this.keys()},K}()}function Z(){const W=d.create(),it=ht();return function(){function kt(){this._key=ht()}return kt.prototype.has=function(Lt){const Ot=dt(Lt,!1);return Ot!==void 0&&d.has(Ot,this._key)},kt.prototype.get=function(Lt){const Ot=dt(Lt,!1);return Ot!==void 0?d.get(Ot,this._key):void 0},kt.prototype.set=function(Lt,Ot){return dt(Lt,!0)[this._key]=Ot,this},kt.prototype.delete=function(Lt){const Ot=dt(Lt,!1);return Ot!==void 0&&delete Ot[this._key]},kt.prototype.clear=function(){this._key=ht()},kt}();function ht(){let kt;do kt="@@WeakMap@@"+wt();while(d.has(W,kt));return W[kt]=!0,kt}function dt(kt,Lt){if(!i.call(kt,it)){if(!Lt)return;Object.defineProperty(kt,it,{value:d.create()})}return kt[it]}function Rt(kt,Lt){for(let Ot=0;Ot<Lt;++Ot)kt[Ot]=255*Math.random()|0;return kt}function gt(kt){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(kt)):Rt(new Uint8Array(kt),kt):Rt(new Array(kt),kt)}function wt(){const kt=gt(16);kt[6]=79&kt[6]|64,kt[8]=191&kt[8]|128;let Lt="";for(let Ot=0;Ot<16;++Ot){const mi=kt[Ot];Ot!==4&&Ot!==6&&Ot!==8||(Lt+="-"),mi<16&&(Lt+="0"),Lt+=mi.toString(16).toLowerCase()}return Lt}}function et(K){return K.__=void 0,delete K.__,K}e("defineMetadata",f),e("hasMetadata",_),e("hasOwnMetadata",m),e("getMetadata",v)}((t=s,function(e,i){typeof t[e]!="function"&&Object.defineProperty(t,e,{configurable:!0,writable:!0,value:i})})),s}({});function Jj(s,t,e,i){const n=[i];let r={};Bl.hasOwnMetadata(s,t)&&(r=Bl.getMetadata(s,t));let a=r[e];a===void 0&&(a=[]),a.push(...n),r[e]=a,Bl.defineMetadata(s,r,t)}function Qj(s,t,e,i){Jj(sE,s,e.toString(),i)}function rE(s){return(t,e,i)=>{Qj(t,e,i,s)}}function aE(s){return t=>(e,i,n)=>rE(new Wb(s,t))(e,i,n)}const Dt=aE(eE),oE=aE(iE);function ct(){return function(s){return Bl.defineMetadata(nE,null,s),s}}function gi(s){return rE(new Wb(k_,s))}const ro={Singleton:"Singleton",Transient:"Transient"},Yr={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid"};class Nb{constructor(t,e){this.id=Xe.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Yr.Invalid,this.constraint=i=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Nb(this.serviceIdentifier,this.scope);return t.activated=t.scope===ro.Singleton&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class t3{getConstructorMetadata(t){return{compilerGeneratedMetadata:Bl.getMetadata(nE,t),userGeneratedMetadata:Bl.getMetadata(sE,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const e3=s=>t=>{const e=i=>{if(i==null)return!1;if(i.key===s&&i.value===t)return!0;if(i.constructorArgsMetadata==null)return!1;const n=i.constructorArgsMetadata;for(let r=0;r<n.length;r++)if(n[r].key===s&&n[r].value===t)return!0;return!1};return e.metaData=new Wb(s,t),e},i3=e3(k_);class Vc{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=ro.Singleton,this}inTransientScope(){return this._binding.scope=ro.Transient,this}whenTargetNamed(t){return this._binding.constraint=i3(t),this}}class s3{constructor(t){this._binding=t}to(t){return this._binding.type=Yr.Instance,this._binding.implementationType=t,new Vc(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=Yr.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new Vc(this._binding)}toConstantValue(t){return this._binding.type=Yr.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=ro.Singleton,new Vc(this._binding)}toFactory(t){return this._binding.type=Yr.Factory,this._binding.factory=t,this._binding.scope=ro.Singleton,new Vc(this._binding)}toService(t){this.toDynamicValue(e=>e.container.get(t))}}class n3{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||ro.Transient,this.options=e,this.id=Xe.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new t3}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,k_,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Nb(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),new s3(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(a,o)=>{a._binding.moduleId=o},e=a=>o=>{const l=this.bind(o);return t(l,a),l},i=()=>a=>this.unbind(a),n=()=>a=>this.isBound(a),r=a=>o=>{const l=this.rebind(o);return t(l,a),l};return a=>({bindFunction:e(a),isboundFunction:n(),rebindFunction:r(a),unbindFunction:i(),unbindAsyncFunction:o=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter(i=>i.constraint(t)).forEach(i=>{e.push(this._resolveFromBinding(i))}),t.isMultiInject||e.length!==1?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),n=Object.keys(i),r=[];for(let a=0;a<n.length;a++){const o=i[a],l={};o.forEach(p=>{l[p.key]=p.value});const h={inject:l[eE],multiInject:l[iE]},d=h.inject||h.multiInject,u={serviceIdentifier:d,constructorArgsMetadata:o},c={injectIdentifier:d,metadata:o,bindings:this._bindingDictionary.get(d).filter(p=>p.constraint(u))};r.push(c)}return r}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Yr.ConstantValue:case Yr.Function:e=t.cache;break;case Yr.Instance:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map(e=>e.bindings.length>1?e.bindings.map(i=>this._resolveFromBinding(i)):this._resolveFromBinding(e.bindings[0]))}_saveToScope(t,e){t.scope===ro.Singleton&&(t.cache=e,t.activated=!0)}}const Qe=Symbol("ContributionProvider");class lE{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Ci(s,t){s(Qe).toDynamicValue(({container:e})=>new lE(t,e)).inSingletonScope().whenTargetNamed(t)}function r3(s,t){s(Qe).toDynamicValue(({container:e})=>new lE(t,e)).whenTargetNamed(t)}class a3{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i=typeof t=="string"?t.trim():t.name;i&&(this.taps=this.taps.filter(n=>n.name!==i&&(!e||n.fn===e)))}_parseOptions(t,e,i){let n;if(typeof e=="string")n={name:e.trim()};else if(typeof e!="object"||e===null)throw new Error("Invalid tap options");if(typeof n.name!="string"||n.name==="")throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;typeof t.before=="string"?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;typeof t.stage=="number"&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const r=this.taps[n];this.taps[n+1]=r;const a=r.stage||0;if(e){if(e.has(r.name)){e.delete(r.name);continue}if(e.size>0)continue}if(!(a>i)){n++;break}}this.taps[n]=t}}class As extends a3{call(...t){this.taps.map(e=>e.fn).forEach(e=>e(...t))}}const w_=Symbol.for("EnvContribution"),Vb=Symbol.for("VGlobal");var o3=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},l3=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},DA=function(s,t){return function(e,i){t(e,i,s)}};let S0=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(s){this._env||this.setEnv("browser"),this.envContribution.supportEvent=s}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(s){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=s}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(s){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=s}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(s){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=s}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(s){this._env||this.setEnv("browser"),this.envContribution.applyStyles=s}constructor(s){this.contributions=s,this.id=Xe.GenAutoIncrementId(),this.hooks={onSetEnv:new As(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(s){const t=[];if(this.contributions.getContributions().forEach(e=>{const i=e.configure(this,s);i&&i.then&&t.push(i)}),t.length)return Promise.all(t)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(s,t){if(t&&t.force===!0||this._env!==s)return this.deactiveCurrentEnv(),this.activeEnv(s,t)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(s,t){const e=this._env;this._env=s;const i=this.bindContribution(t);if(i&&i.then)return i.then(()=>{this.envParams=t,this.hooks.onSetEnv.call(e,s,this)});this.envParams=t,this.hooks.onSetEnv.call(e,s,this)}setActiveEnvContribution(s){this.envContribution=s}createCanvas(s){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(s)}createOffscreenCanvas(s){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(s)}releaseCanvas(s){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(s)}addEventListener(s,t,e){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(s,t,e)}removeEventListener(s,t,e){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(s,t,e)}dispatchEvent(s){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(s)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(s){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(s):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(s,t){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(s,t):null}loadImage(s){return this._env||this.setEnv("browser"),this.envContribution.loadImage(s)}loadSvg(s){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(s)}loadJson(s){return this._env||this.setEnv("browser"),this.envContribution.loadJson(s)}loadArrayBuffer(s){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(s)}loadBlob(s){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(s)}isChrome(){return this._isChrome!=null||(this._env||this.setEnv("browser"),this._isChrome=this._env==="browser"&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return this._isSafari!=null||(this._env||this.setEnv("browser"),this._isSafari=this._env==="browser"&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(s){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(s)}removeDom(s){return this._env||this.setEnv("browser"),this.envContribution.removeDom(s)}createDom(s){return this._env||this.setEnv("browser"),this.envContribution.createDom(s)}getElementTop(s,t=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(s,t)}getElementLeft(s,t=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(s,t)}getElementTopLeft(s,t=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(s,t)}};S0=o3([ct(),DA(0,Dt(Qe)),DA(0,gi(w_)),l3("design:paramtypes",[Object])],S0);const h3=ni-1e-8;class hE{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,r,a){if(Math.abs(r-n)>h3)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let o,l,h,d,u=1/0,c=-1/0,p=1/0,g=-1/0;function f(_){h=i*Math.cos(_),d=i*Math.sin(_),h<u&&(u=h),h>c&&(c=h),d<p&&(p=d),d>g&&(g=d)}if(f(n),f(r),r!==n)if((n%=ni)<0&&(n+=ni),(r%=ni)<0&&(r+=ni),r<n&&(a=!a,o=n,n=r,r=o),a)for(r-=ni,o=n-n%Ws,l=0;l<4&&o>r;++l,o-=Ws)f(o);else for(o=n-n%Ws+Ws,l=0;l<4&&o<r;++l,o+=Ws)f(o);this.bounds.add(t+u,e+p),this.bounds.add(t+c,e+g)}arcTo(t,e,i,n,r){throw new Error("不支持arcTo")}bezierCurveTo(t,e,i,n,r,a){this.bounds.add(t,e),this.bounds.add(i,n),this.bounds.add(r,a)}closePath(){}ellipse(){throw new Error("不支持ellipse")}lineTo(t,e){this.bounds.add(t,e)}moveTo(t,e){this.bounds.add(t,e)}quadraticCurveTo(t,e,i,n){this.bounds.add(t,e),this.bounds.add(i,n)}rect(t,e,i,n){this.bounds.add(t,e),this.bounds.add(t+i,e+n)}clear(){this.bounds.clear()}release(...t){}}class d3{constructor(){this.curves=[],this.bounds=new Me}getCurveLengths(){return this.curves.map(t=>t.getLength())}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const u3=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,c3={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Bt={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ev,LA,Uc,BA,iv,$c;function p3(s){if(!s)return[];const t=s.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(t===null)return[];let e,i;const n=[];for(let r=0,a=t.length;r<a;r++)if(ev=t[r],LA=ev.slice(1),Uc=ev[0],e=[Uc],i=LA.match(u3),i!==null){for(let o=0,l=i.length;o<l;o++)BA=i[o],iv=parseFloat(BA),Number.isNaN(iv)||e.push(iv);if($c=c3[Uc],e.length-1>$c){let o;for(let l=1,h=e.length;l<h;l+=$c){o=[Uc];for(let d=l,u=l+$c;d<u;d++)o.push(e[d]);n.push(o)}}else n.push(e)}else n.push(e);return n}var ue;(function(s){s[s.NONE=0]="NONE",s[s.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",s[s.UPDATE_SHAPE=2]="UPDATE_SHAPE",s[s.CLEAR_SHAPE=253]="CLEAR_SHAPE",s[s.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",s[s.INIT=179]="INIT",s[s.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",s[s.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",s[s.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",s[s.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",s[s.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",s[s.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",s[s.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",s[s.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"})(ue||(ue={}));var Qd;(function(s){s[s.GLOBAL=1]="GLOBAL",s[s.LOCAL=16]="LOCAL",s[s.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",s[s.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"})(Qd||(Qd={}));var Pe;(function(s){s[s.INIT=0]="INIT",s[s.DEFAULT=1]="DEFAULT",s[s.STATE=2]="STATE",s[s.ANIMATE_BIND=10]="ANIMATE_BIND",s[s.ANIMATE_PLAY=11]="ANIMATE_PLAY",s[s.ANIMATE_START=12]="ANIMATE_START",s[s.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",s[s.ANIMATE_END=14]="ANIMATE_END",s[s.TRANSLATE=20]="TRANSLATE",s[s.TRANSLATE_TO=21]="TRANSLATE_TO",s[s.SCALE=22]="SCALE",s[s.SCALE_TO=23]="SCALE_TO",s[s.ROTATE=24]="ROTATE",s[s.ROTATE_TO=25]="ROTATE_TO"})(Pe||(Pe={}));var Ii;(function(s){s[s.INITIAL=0]="INITIAL",s[s.RUNNING=1]="RUNNING",s[s.PAUSED=2]="PAUSED",s[s.END=3]="END"})(Ii||(Ii={}));var eh;(function(s){s[s.NORMAL=0]="NORMAL",s[s.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"})(eh||(eh={}));var $o;(function(s){s.wait="wait",s.from="from",s.to="to",s.customAnimate="customAnimate"})($o||($o={}));var ye;(function(s){s[s.ROW=1]="ROW",s[s.COLUMN=2]="COLUMN"})(ye||(ye={}));var ng;(function(s){s[s.CubicBezierCurve=0]="CubicBezierCurve",s[s.QuadraticBezierCurve=1]="QuadraticBezierCurve",s[s.ArcCurve=2]="ArcCurve",s[s.LineCurve=3]="LineCurve",s[s.EllipseCurve=4]="EllipseCurve",s[s.MoveCurve=5]="MoveCurve"})(ng||(ng={}));var fi;(function(s){s[s.beforeFillStroke=0]="beforeFillStroke",s[s.afterFillStroke=1]="afterFillStroke"})(fi||(fi={}));function g3(s,t,e,i,n,r,a,o,l){const h=le(a),d=Math.sin(h),u=Math.cos(h),c=u*(o-s)*.5+d*(l-t)*.5,p=u*(l-t)*.5-d*(o-s)*.5;let g=c*c/((e=Math.abs(e))*e)+p*p/((i=Math.abs(i))*i);g>1&&(g=Math.sqrt(g),e*=g,i*=g);const f=u/e,_=d/e,m=-d/i,v=u/i,y=f*o+_*l,b=m*o+v*l,x=f*s+_*t,S=m*s+v*t;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const w=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),M=Math.atan2(b-T,y-w);let P=Math.atan2(S-T,x-w)-M;P<0&&r===1?P+=ni:P>0&&r===0&&(P-=ni);const O=Math.ceil(Math.abs(P/(Ws+.001))),D=[];for(let R=0;R<O;++R){const L=M+R*P/O,B=M+(R+1)*P/O;D[R]=[w,T,L,B,e,i,d,u]}return D}function f3(s){const t=s[0],e=s[1],i=s[2],n=s[3],r=s[4],a=s[5],o=s[6],l=s[7],h=l*r,d=-o*a,u=o*r,c=l*a,p=Math.cos(i),g=Math.sin(i),f=Math.cos(n),_=Math.sin(n),m=.5*(n-i),v=Math.sin(.5*m),y=8/3*v*v/Math.sin(m),b=t+p-y*g,x=e+g+y*p,S=t+f,A=e+_,k=S+y*_,w=A-y*f;return[h*b+d*x,u*b+c*x,h*k+d*w,u*k+c*w,h*S+d*A,u*S+c*A]}function IA(s,t,e,i){const n=g3(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,e);for(let r=0;r<n.length;++r){const a=f3(n[r]);s.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5])}}const Cp=(s,t,e,i,n,r,a)=>{const o=Math.abs(e-t),l=4*Math.tan(o/4)/3,h=e<t?-1:1,d=Math.cos(t),u=Math.sin(t),c=Math.cos(e),p=Math.sin(e),g=d*r+i,f=u*a+n,_=c*r+i,m=p*a+n,v=r*l*h,y=a*l*h;s.push(g-v*u,f+y*d,_+v*p,m-y*c,_,m)},_3=[(s,t,e,i,n,r,a)=>t.arc(s[1]*n+e,s[2]*r+i,s[3]*(n+r)/2,s[4],s[5],s[6],a),(s,t,e,i,n,r,a)=>t.arcTo(s[1]*n+e,s[2]*r+i,s[3]*n+e,s[4]*r+i,s[5]*(n+r)/2,a),(s,t,e,i,n,r,a)=>t.bezierCurveTo(s[1]*n+e,s[2]*r+i,s[3]*n+e,s[4]*r+i,s[5]*n+e,s[6]*r+i,a),(s,t,e,i)=>t.closePath(),(s,t,e,i,n,r)=>t.ellipse(s[1]*n+e,s[2]*r+i,s[3]*n,s[4]*r,s[5],s[6],s[7],s[8]),(s,t,e,i,n,r,a)=>t.lineTo(s[1]*n+e,s[2]*r+i,a),(s,t,e,i,n,r,a)=>t.moveTo(s[1]*n+e,s[2]*r+i,a),(s,t,e,i,n,r,a)=>t.quadraticCurveTo(s[1]*n+e,s[2]*r+i,s[3]*n+e,s[4]*r+i,a),(s,t,e,i,n,r,a)=>t.rect(s[1]*n+e,s[2]*r+i,s[3]*n,s[4]*r,a)];function ur(s,t,e=0,i=0,n=1,r=1,a){for(let o=0;o<s.length;o++){const l=s[o];_3[l[0]](l,t,e,i,n,r,a)}}class dE{getLength(t){return t!=null?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function m3(s,t){let e=0;const i=s.length;for(let n=0;n<i;n++){const r=s[n],a=t[n],o=s[(n+1)%i],l=t[(n+1)%i];e+=Ee.distanceNN(r,a,o,l)}return e/2}function v3(s,t,e,i,n){return m3([s.x,t.x,e.x,i.x],[s.y,t.y,e.y,i.y])}function FA(s,t,e,i,n){const r=1-n;return r*r*r*s+3*t*n*r*r+3*e*n*n*r+i*n*n*n}function uE(s,t,e,i,n){const r=FA(s.x,t.x,e.x,i.x,n),a=FA(s.y,t.y,e.y,i.y,n);return new De(r,a)}function A0(s,t){const{p0:e,p1:i,p2:n,p3:r}=s,a=uE(e,i,n,r,t),o=Ee.pointAtPP(e,i,t),l=Ee.pointAtPP(i,n,t),h=Ee.pointAtPP(n,r,t),d=Ee.pointAtPP(o,l,t),u=Ee.pointAtPP(l,h,t);return[new k0(e,o,d,a),new k0(a,u,h,r)]}class k0 extends dE{constructor(t,e,i,n){super(),this.type=ng.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=n}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y+this.p3.x+this.p3.y)}getPointAt(t){if(this.defined!==!1)return uE(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?v3(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(t){return t===ye.ROW?Xt(this.p0.x-this.p3.x):t===ye.COLUMN?Xt(this.p0.y-this.p3.y):0}getAngleAt(t){const e=ss(t-.01,0),i=vi(t+.01,1),n=this.getPointAt(e),r=this.getPointAt(i);return re(r.y-n.y,r.x-n.x)}}function jA(s,t){const{p0:e,p1:i}=s,n=Ee.pointAtPP(e,i,t);return[new w0(e,n),new w0(n,i)]}class w0 extends dE{constructor(t,e){super(),this.type=ng.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(this.defined!==!1)return Ee.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return this.angle==null&&(this.angle=re(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ee.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===ye.ROW?Xt(this.p0.x-this.p1.x):t===ye.COLUMN?Xt(this.p0.y-this.p1.y):0}}class Ub{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,n,r,a,o,l){const h=new k0(new De(this._lastX,this._lastY),new De(t,e),new De(i,n),new De(r,a));h.originP1=this._lastOriginP,h.originP2=l,h.defined=o,this.curves.push(h),this._lastX=r,this._lastY=a,this._lastOriginP=l}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,n){const r=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,r){const a=new w0(new De(this._lastX,this._lastY),new De(t,e));return a.originP1=n,a.originP2=r,a.defined=i,a}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===ye.COLUMN){if(!this.curves.length)return 0;const n=this.curves[0],r=this.curves[this.curves.length-1],a=(e=r.p3)!==null&&e!==void 0?e:r.p1;return Xt(n.p0.y-a.y)}if(t===ye.ROW){if(!this.curves.length)return 0;const n=this.curves[0],r=this.curves[this.curves.length-1],a=(i=r.p3)!==null&&i!==void 0?i:r.p1;return Xt(n.p0.x-a.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce((n,r)=>n+r.getLength(),0)),this.length}}class y3 extends Ub{bezierCurveTo(t,e,i,n,r,a,o,l){return super.bezierCurveTo(e,t,n,i,a,r,o,l)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Th(s,t,e=1){let i=!1;for(let n=0,r=t.length;n<=r;n++)n>=r===i&&((i=!i)?s.lineStart():s.lineEnd()),i&&s.point(t[n])}function ec(s,t,e){const i=t??(Xt(e[e.length-1].x-e[0].x)>Xt(e[e.length-1].y-e[0].y)?ye.ROW:ye.COLUMN);return s==="monotoneY"?new y3(s,i):new Ub(s,i)}class cE{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,this._lastDefined!==!1&&t.defined!==!1,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,this._lastDefined!==!1&&t.defined!==!1,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ic(s,t={}){const{direction:e,startPoint:i}=t;if(s.length<2-+!!i)return null;const n=ec("linear",e,s);return b3(new cE(n,i),s),n}function b3(s,t){return Th(s,t,1)}function zA(s,t,e,i,n){s.context.bezierCurveTo((2*s._x0+s._x1)/3,(2*s._y0+s._y1)/3,(s._x0+2*s._x1)/3,(s._y0+2*s._y1)/3,(s._x0+4*s._x1+t)/6,(s._y0+4*s._y1+e)/6,i,s.lastPoint1)}class x3{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){this._point===2&&zA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1),(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,this._lastDefined1!==!1&&this._lastDefined2!==!1,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:zA(this,e,i,this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function S3(s,t){return Th(s,t,2)}function pE(s,t={}){const{direction:e,startPoint:i}=t;if(s.length<2-+!!i)return null;if(s.length<3-+!!i)return ic(s,t);const n=ec("basis",e,s);return S3(new x3(n,i),s),n}function HA(s){return s<0?-1:1}function GA(s,t,e){const i=s._x1-s._x0,n=t-s._x1,r=(s._y1-s._y0)/(i||Number(n<0&&-0)),a=(e-s._y1)/(n||Number(i<0&&-0)),o=(r*n+a*i)/(i+n);return(HA(r)+HA(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function WA(s,t){const e=s._x1-s._x0;return e?(3*(s._y1-s._y0)/e-t)/2:t}function sv(s,t,e,i,n){const r=s._x0,a=s._y0,o=s._x1,l=s._y1,h=(o-r)/3;s.context.bezierCurveTo(r+h,a+h*t,o-h,l-h*e,o,l,i,s.lastPoint1)}class gE{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1);break;case 3:sv(this,this._t0,WA(this,this._t0),this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1)}(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,this._lastDefined1!==!1&&this._lastDefined2!==!1,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,sv(this,WA(this,e=GA(this,i,n)),e,this._lastDefined1!==!1&&this._lastDefined2!==!1);break;default:sv(this,this._t0,e=GA(this,i,n),this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined!==!1,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class A3 extends gE{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function k3(s,t){return Th(s,t,2)}function fE(s,t={}){const{direction:e,startPoint:i}=t;if(s.length<2-+!!i)return null;if(s.length<3-+!!i)return ic(s,t);const n=ec("monotoneX",e,s);return k3(new gE(n,i),s),n}function w3(s,t){return Th(s,t,2)}function _E(s,t={}){const{direction:e,startPoint:i}=t;if(s.length<2-+!!i)return null;if(s.length<3-+!!i)return ic(s,t);const n=ec("monotoneY",e,s);return w3(new A3(n,i),s),n}let T3=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&this._point===2&&this.context.lineTo(this._x,this._y,this._lastDefined!==!1,this.lastPoint),(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,this._lastDefined!==!1&&t.defined!==!1,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,this._lastDefined!==!1&&t.defined!==!1,this.lastPoint),this.context.lineTo(e,i,this._lastDefined!==!1&&t.defined!==!1,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,this._lastDefined!==!1&&t.defined!==!1,this.lastPoint),this.context.lineTo(n,i,this._lastDefined!==!1&&t.defined!==!1,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Il(s,t,e={}){const{direction:i,startPoint:n}=e;if(s.length<2-+!!n)return null;const r=new Ub("step",i??(Xt(s[s.length-1].x-s[0].x)>Xt(s[s.length-1].y-s[0].y)?ye.ROW:ye.COLUMN));return M3(new T3(r,t,n),s),r}function M3(s,t){return Th(s,t,1)}class C3 extends cE{lineEnd(){this.context.closePath()}}function mE(s,t={}){const{direction:e,startPoint:i}=t;if(s.length<2-+!!i)return null;const n=ec("linear",e,s);return P3(new C3(n,i),s),n}function P3(s,t){return Th(s,t,1)}function T0(s,t,e){switch(t){case"linear":default:return ic(s,e);case"basis":return pE(s,e);case"monotoneX":return fE(s,e);case"monotoneY":return _E(s,e);case"step":return Il(s,.5,e);case"stepBefore":return Il(s,0,e);case"stepAfter":return Il(s,1,e);case"linearClosed":return mE(s,e)}}class Je extends d3{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new hE(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Bt.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Bt.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([Bt.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,a){return this.commandList.push([Bt.C,t,e,i,n,r,a]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,r,a),this}arcTo(t,e,i,n,r){return this.commandList.push([Bt.AT,t,e,i,n,r]),this._ctx&&this._ctx.arcTo(t,e,i,n,r),this}ellipse(t,e,i,n,r,a,o,l){return this.commandList.push([Bt.E,t,e,i,n,r,a,o,l]),this._ctx&&this._ctx.ellipse(t,e,i,n,r,a,o,l),this}rect(t,e,i,n){return this.commandList.push([Bt.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,r,a){return this.commandList.push([Bt.A,t,e,i,n,r,a]),this._ctx&&this._ctx.arc(t,e,i,n,r,a),this}closePath(){return this.commandList.push([Bt.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}toString(){if(!this.toStringCbList){const i=[];i[Bt.M]=n=>`M${n[1]} ${n[2]}`,i[Bt.L]=n=>`L${n[1]} ${n[2]}`,i[Bt.Q]=n=>`Q${n[1]} ${n[2]} ${n[3]} ${n[4]}`,i[Bt.C]=n=>`C${n[1]} ${n[2]} ${n[3]} ${n[4]} ${n[5]} ${n[6]}`,i[Bt.A]=n=>{const r=[];Cp(r,n[4],n[5],n[1],n[2],n[3],n[3]);let a="";for(let o=0;o<r.length;o+=6)a+=`C${r[o]} ${r[o+1]} ${r[o+2]} ${r[o+3]} ${r[o+4]} ${r[o+5]}`;return a},i[Bt.Z]=n=>"Z",this.toStringCbList=i}const t=this.toStringCbList;let e="";return this.commandList.forEach(i=>{e+=t[i[0]](i)}),e}fromString(t,e,i,n,r){this.clear();const a=p3(t);return this._runCommandStrList(a,e,i,n,r),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:n}=t.attribute;if(!e)return;const r=T0(e,i);n==="x"?this.direction=ye.ROW:n==="y"?this.direction=ye.COLUMN:n==="auto"&&(this.direction=r.direction),this.curves=r.curves}fromCustomPath2D(t,e,i,n,r){return this.clear(),this._runCommandList(t.commandList,e,i,n,r),this._updateBounds(),this}transform(t,e,i,n){const r=this.commandList;if(!this.transformCbList){const a=[];a[Bt.M]=this.moveToTransform,a[Bt.L]=this.lineToTransform,a[Bt.Q]=this.quadraticCurveToTransform,a[Bt.C]=this.bezierCurveToTransform,a[Bt.AT]=this.arcToTransform,a[Bt.E]=this.ellipseTransform,a[Bt.R]=this.rectTransform,a[Bt.A]=this.arcTransform,a[Bt.Z]=this.closePathTransform,this.transformCbList=a}r.forEach(a=>{this.transformCbList[a[0]](a,t,e,i,n)}),this._updateBounds()}moveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*n+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*(n+r)/2}ellipseTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}rectTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}arcTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*(n+r)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,n=1,r=1){let a,o,l,h,d,u=null,c=0,p=0,g=0,f=0;for(let _=0,m=t.length;_<m;++_){switch(a=t[_],n===1&&r===1||(a=E3(a,n,r)),a[0]){case"l":c+=a[1],p+=a[2],this.lineTo(c+e,p+i);break;case"L":c=a[1],p=a[2],this.lineTo(c+e,p+i);break;case"h":c+=a[1],this.lineTo(c+e,p+i);break;case"H":c=a[1],this.lineTo(c+e,p+i);break;case"v":p+=a[1],this.lineTo(c+e,p+i);break;case"V":p=a[1],this.lineTo(c+e,p+i);break;case"m":c+=a[1],p+=a[2],this.moveTo(c+e,p+i);break;case"M":c=a[1],p=a[2],this.moveTo(c+e,p+i);break;case"c":o=c+a[5],l=p+a[6],g=c+a[3],f=p+a[4],this.bezierCurveTo(c+a[1]+e,p+a[2]+i,g+e,f+i,o+e,l+i),c=o,p=l;break;case"C":c=a[5],p=a[6],g=a[3],f=a[4],this.bezierCurveTo(a[1]+e,a[2]+i,g+e,f+i,c+e,p+i);break;case"s":o=c+a[3],l=p+a[4],g=2*c-g,f=2*p-f,this.bezierCurveTo(g+e,f+i,c+a[1]+e,p+a[2]+i,o+e,l+i),g=c+a[1],f=p+a[2],c=o,p=l;break;case"S":o=a[3],l=a[4],g=2*c-g,f=2*p-f,this.bezierCurveTo(g+e,f+i,a[1]+e,a[2]+i,o+e,l+i),c=o,p=l,g=a[1],f=a[2];break;case"q":o=c+a[3],l=p+a[4],g=c+a[1],f=p+a[2],this.quadraticCurveTo(g+e,f+i,o+e,l+i),c=o,p=l;break;case"Q":o=a[3],l=a[4],this.quadraticCurveTo(a[1]+e,a[2]+i,o+e,l+i),c=o,p=l,g=a[1],f=a[2];break;case"t":o=c+a[1],l=p+a[2],u[0].match(/[QqTt]/)===null?(g=c,f=p):u[0]==="t"?(g=2*c-h,f=2*p-d):u[0]==="q"&&(g=2*c-g,f=2*p-f),h=g,d=f,this.quadraticCurveTo(g+e,f+i,o+e,l+i),c=o,p=l,g=c+a[1],f=p+a[2];break;case"T":o=a[1],l=a[2],g=2*c-g,f=2*p-f,this.quadraticCurveTo(g+e,f+i,o+e,l+i),c=o,p=l;break;case"a":IA(this,c+e,p+i,[a[1],a[2],a[3],a[4],a[5],a[6]+c+e,a[7]+p+i]),c+=a[6],p+=a[7];break;case"A":IA(this,c+e,p+i,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+i]),c=a[6],p=a[7];break;case"z":case"Z":this.closePath()}u=a}}_runCommandList(t,e=0,i=0,n=1,r=1){if(e!==0||i!==0||n!==1||r!==1)for(let a=0,o=t.length;a<o;++a){const l=t[a].slice();switch(l[0]){case Bt.L:this.lineToTransform(l,e,i,n,r);break;case Bt.M:this.moveToTransform(l,e,i,n,r);break;case Bt.C:this.bezierCurveToTransform(l,e,i,n,r);break;case Bt.Q:this.quadraticCurveToTransform(l,e,i,n,r);break;case Bt.A:this.arcToTransform(l,e,i,n,r);break;case Bt.E:this.ellipseTransform(l,e,i,n,r);break;case Bt.R:this.rectTransform(l,e,i,n,r);break;case Bt.AT:this.arcToTransform(l,e,i,n,r);break;case Bt.Z:this.closePath()}}else this.commandList=t.map(a=>a.slice())}_updateBounds(){this.bounds.clear(),ur(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===ye.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Xt(t.p0.y-e.p1.y)}if(this.direction===ye.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Xt(t.p0.x-e.p1.x)}return this.curves.reduce((t,e)=>t+e.getLength(),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let r=0;r<this.curves.length;r++){e=this.curves[r];const a=e.getLength(this.direction);if(i+a>=t)break;i+=a}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Ds=["l",0,0,0,0,0,0,0];function E3(s,t,e){const i=Ds[0]=s[0];if(i==="a"||i==="A")Ds[1]=t*s[1],Ds[2]=e*s[2],Ds[3]=s[3],Ds[4]=s[4],Ds[5]=s[5],Ds[6]=t*s[6],Ds[7]=e*s[7];else if(i==="h"||i==="H")Ds[1]=t*s[1];else if(i==="v"||i==="V")Ds[1]=e*s[1];else for(let n=1,r=s.length;n<r;++n)Ds[n]=(n%2==1?t:e)*s[n];return Ds}const R3={alignSelf:"auto"},oi={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new ze},vE={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},nv={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},yE=Object.assign({outerBorder:Object.assign(Object.assign({},nv),{distance:0}),innerBorder:Object.assign(Object.assign({},nv),{distance:0})},nv),_r={text:"",maxLineWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:`PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,
- Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol`,fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",disableAutoClipedPoptip:void 0},O3={pickStrokeBuffer:0},D3=Object.assign(Object.assign(Object.assign(Object.assign({opacity:1,background:null,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,blur:0,cursor:null,html:null},vE),yE),R3),O3),bE={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},L3={_debug_bounds:!1},Re=Object.assign(Object.assign(Object.assign({strokeSeg:null,pickable:!0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden"},L3),D3),oi),B3=Object.assign(Object.assign({},Re),{startAngle:0,endAngle:It,innerRadius:0,outerRadius:1,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),I3=Object.assign(Object.assign(Object.assign({},Re),bE),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1}),F3=Object.assign(Object.assign({},Re),{radius:1,startAngle:0,endAngle:It}),j3=Object.assign(Object.assign({},Re),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start"}),z3=Object.assign(Object.assign({},Re),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),H3=Object.assign(Object.assign(Object.assign({},Re),bE),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1}),G3=Object.assign(Object.assign({},Re),{path:new Je,customPath:()=>{zt.getInstance().warn("空函数")}}),W3=Object.assign(Object.assign({},Re),{points:[],cornerRadius:0,closePath:!0}),N3=Object.assign(Object.assign({},Re),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),V3=Object.assign(Object.assign({},Re),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),U3=Object.assign(Object.assign({},Re),{symbolType:"circle",size:10,keepDirIn3d:!0}),xE=Object.assign(Object.assign(Object.assign({},Re),_r),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Pn=Object.assign(Object.assign({},Re),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),tu=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Re),{fill:!0,cornerRadius:0}),$3=Object.assign(Object.assign({},tu),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class Y3{}const tt=new Y3,$b={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},SE={fill:!0,stroke:!1},NA=/\w|\(|\)|-/,X3=/[.?!,;:/,。?!、;:]/,K3=/\S/;function q3(s,t){const e=t&&t.fill||SE.fill;s.globalAlpha=1,s.fillStyle=e;let i=t.fontSize||16;switch(t.script){case"super":case"sub":i*=.8}s.setTextStyle({textAlign:"left",textBaseline:t.textBaseline||"alphabetic",fontStyle:t.fontStyle||"",fontWeight:t.fontWeight||"",fontSize:i,fontFamily:t.fontFamily||"sans-serif"})}function Z3(s,t){const e=t&&t.stroke||SE.stroke;if(!e)return void(s.globalAlpha=0);s.globalAlpha=1,s.lineWidth=t&&typeof t.lineHeight=="number"?t.lineHeight:1,s.strokeStyle=e;let i=t.fontSize||16;switch(t.script){case"super":case"sub":i*=.8}s.setTextStyle({textAlign:"left",textBaseline:t.textBaseline||"alphabetic",fontStyle:t.fontStyle||"",fontWeight:t.fontWeight||"",fontSize:i,fontFamily:t.fontFamily||"sans-serif"})}function M0(s,t,e,i,n){if(!t||t<=0)return 0;const r=tt.graphicUtil.textMeasure;let a=i,o=s.slice(0,a),l=Math.floor(r.measureText(o,e).width),h=s.slice(0,a+1),d=Math.floor(r.measureText(h,e).width);for(;l>t||d<=t;){if(l>t?a--:a++,a>s.length){a=s.length;break}if(a<0){a=0;break}o=s.slice(0,a),l=Math.floor(r.measureText(o,e).width),h=s.slice(0,a+1),d=Math.floor(r.measureText(h,e).width)}return n&&(a=Pp(s,a)),a}function Pp(s,t){let e=t;for(;NA.test(s[e-1])&&NA.test(s[e])||X3.test(s[e]);)if(e--,e<=0)return t;return e}function Yo(s,t){const e=tt.graphicUtil.textMeasure.measureText(s,t),i={ascent:0,height:0,descent:0,width:0};return typeof e.actualBoundingBoxAscent!="number"||typeof e.actualBoundingBoxDescent!="number"?(i.width=Math.floor(e.width),i.height=t.fontSize||0,i.ascent=i.height,i.descent=0):(i.width=Math.floor(e.width),i.height=Math.floor(e.actualBoundingBoxAscent+e.actualBoundingBoxDescent),i.ascent=Math.floor(e.actualBoundingBoxAscent),i.descent=i.height-i.ascent),i}var J3=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let C0=class{configure(s,t){this.canvas=s.canvas,this.context=s.context,s.bindTextMeasure(this)}measureTextWidth(s,t){return this.context?(this.context.setTextStyleWithoutAlignBaseline(t),this.context.measureText(s).width):this.estimate(s,t).width}estimate(s,{fontSize:t=xE.fontSize}){let e=0,i=0;for(let n=0;n<s.length;n++)s.charCodeAt(n)<128?e++:i++;return{width:~~(.8*e*t+i*t),height:t}}measureTextPixelHeight(s,t){var e;if(!this.context)return(e=t.fontSize)!==null&&e!==void 0?e:_r.fontSize;this.context.setTextStyleWithoutAlignBaseline(t);const i=this.context.measureText(s);return Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)}measureTextBoundHieght(s,t){var e;if(!this.context)return(e=t.fontSize)!==null&&e!==void 0?e:_r.fontSize;this.context.setTextStyleWithoutAlignBaseline(t);const i=this.context.measureText(s);return Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)}measureText(s,t){return this.context?(this.context.setTextStyleWithoutAlignBaseline(t),this.context.measureText(s)):this.estimate(s,t)}clipTextVertical(s,t,e,i){if(s.length===0)return{verticalList:s,width:0};const{fontSize:n=12}=t;s.forEach(l=>{l.width=l.direction===0?n:this.measureTextWidth(l.text,t)});const r=[];let a=0,o=0;for(;o<s.length&&a+s[o].width<e;o++)a+=s[o].width,r.push(s[o]);if(s[o]&&s[o].text.length>1){const l=this._clipText(s[o].text,t,e-a,0,s[o].text.length-1,"end",!1);if(i&&l.str!==s[o].text){let h="",d=0;for(let p=0;p<o;p++){const g=s[p];h+=g.text,d+=g.text.length}h+=s[o].text;const u=d+l.str.length;let c=Pp(h,u);c-=d,c!==l.str.length-1&&(l.str=l.str.substring(0,c),l.width=this.measureTextWidth(l.str,t))}r.push(Object.assign(Object.assign({},s[o]),{text:l.str,width:l.width})),a+=l.width}return{verticalList:r,width:a}}clipText(s,t,e,i){if(s.length===0)return{str:"",width:0};let n=this.measureTextWidth(s,t);if(n<=e)return{str:s,width:n};if(n=this.measureTextWidth(s[0],t),n>e)return{str:"",width:0};const r=this._clipText(s,t,e,0,s.length-1,"end",!1);if(i&&r.str!==s){const a=Pp(s,r.str.length);a!==r.str.length&&(r.str=s.substring(0,a),r.width=this.measureTextWidth(r.str,t))}return r}_clipText(s,t,e,i,n,r,a){let o;if(r==="start")o=this._clipTextStart(s,t,e,i,n),a&&(o.result=a+o.str);else if(r==="middle"){const l=this._clipTextMiddle(s,t,e,"","",0,0,1);o={str:"none",width:l.width,result:l.left+a+l.right}}else o=this._clipTextEnd(s,t,e,i,n),a&&(o.result=o.str+a);return o}_clipTextEnd(s,t,e,i,n){const r=Math.floor((i+n)/2),a=s.substring(0,r+1),o=this.measureTextWidth(a,t);let l;if(o>e){if(a.length<=1)return{str:"",width:0};const h=s.substring(0,r);return l=this.measureTextWidth(h,t),l<=e?{str:h,width:l}:this._clipTextEnd(s,t,e,i,r)}if(o<e){if(r>=s.length-1)return{str:s,width:this.measureTextWidth(s,t)};const h=s.substring(0,r+2);return l=this.measureTextWidth(h,t),l>=e?{str:a,width:o}:this._clipTextEnd(s,t,e,r,n)}return{str:a,width:o}}_clipTextStart(s,t,e,i,n){const r=Math.ceil((i+n)/2),a=s.substring(r-1,s.length-1),o=this.measureTextWidth(a,t);let l;if(o>e){if(a.length<=1)return{str:"",width:0};const h=s.substring(r,s.length-1);return l=this.measureTextWidth(h,t),l<=e?{str:h,width:l}:this._clipTextStart(s,t,e,r,s.length-1)}if(o<e){if(r<=0)return{str:s,width:this.measureTextWidth(s,t)};const h=s.substring(r-2,s.length-1);return l=this.measureTextWidth(h,t),l>=e?{str:a,width:o}:this._clipTextStart(s,t,e,i,r)}return{str:a,width:o}}_clipTextMiddle(s,t,e,i,n,r,a,o){const l=s.substring(0,o),h=this.measureTextWidth(l,t);if(h+a>e)return{left:i,right:n,width:r+a};const d=s.substring(s.length-o,s.length),u=this.measureTextWidth(d,t);return h+u>e?{left:l,right:n,width:h+a}:this._clipTextMiddle(s,t,e,l,d,h,u,o+1)}clipTextWithSuffixVertical(s,t,e,i,n,r){if(i==="")return this.clipTextVertical(s,t,e,n);if(s.length===0)return{verticalList:s,width:0};const a=this.clipTextVertical(s,t,e,n);if(a.verticalList.length===s.length&&a.verticalList[a.verticalList.length-1].width===s[s.length-1].width)return a;const o=this.measureTextWidth(i,t);if(o>e)return a;let l;if(e-=o,r==="start"){const h=this.revertVerticalList(s);l=this.clipTextVertical(h,t,e,n);const d=this.revertVerticalList(l.verticalList);d.unshift({text:i,direction:1,width:o}),l.verticalList=d}else if(r==="middle"){const h=this.clipTextVertical(s,t,e/2,n),d=this.revertVerticalList(s),u=this.clipTextVertical(d,t,e/2,n);h.verticalList.push({text:i,direction:1,width:o}),this.revertVerticalList(u.verticalList).forEach(c=>h.verticalList.push(c)),l={verticalList:h.verticalList,width:h.width+u.width}}else l=this.clipTextVertical(s,t,e,n),l.verticalList.push({text:i,direction:1,width:o});return l.width+=o,l}revertVerticalList(s){return s.reverse().map(t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})})}clipTextWithSuffix(s,t,e,i,n,r){if(i==="")return this.clipText(s,t,e,n);if(s.length===0)return{str:"",width:0};const a=this.measureTextWidth(s,t);if(a<=e)return{str:s,width:a};const o=this.measureTextWidth(i,t);if(o>e)return{str:"",width:0};e-=o;const l=this._clipText(s,t,e,0,s.length-1,r,i);if(n&&l.str!==s){const h=Pp(s,l.str.length);h!==l.str.length&&(l.str=s.substring(0,h),l.width=this.measureTextWidth(l.str,t))}return l.str=l.result,l.width+=o,l}};C0=J3([ct()],C0);var Q3=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};const P0=Symbol.for("TextMeasureContribution");let E0=class extends C0{};E0=Q3([ct()],E0);const Ct=new n3,AE=Symbol.for("CanvasFactory"),tz=Symbol.for("Context2dFactory");function rg(s){return Ct.getNamed(AE,tt.global.env)(s)}function ez(s){return typeof s=="number"&&Number.isFinite(s)}class iz{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const i=rg(Object.assign({nativeCanvas:tt.global.createCanvas(t)},t));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const i={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},n=rg(Object.assign({nativeCanvas:tt.global.createCanvas(i)},i));return this.allocatedCanvas.push(n),n}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const ih=new iz;var sz=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},nz=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};const ag=Symbol.for("VWindow"),Yb=Symbol.for("WindowHandlerContribution");let R0=class{get width(){if(this._handler){const s=this._handler.getWH();return this._width=s.width}return this._width}get height(){if(this._handler){const s=this._handler.getWH();return this._height=s.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new As(["x","y","width","height"])},this._uid=Xe.GenAutoIncrementId(),this.global=tt.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",()=>{this.active()}),this.active()}active(){const s=this.global;!s.env||this.actived||(Ct.getNamed(Yb,s.env).configure(this,s),this.actived=!0)}get style(){return this._handler.getStyle()}set style(s){this._handler.setStyle(s)}create(s){this._handler.createWindow(s);const t=this._handler.getWH();this._width=t.width,this._height=t.height,this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(s){this._handler=s}setDpr(s){return this._handler.setDpr(s)}resize(s,t){return this._handler.resizeWindow(s,t)}configure(){throw new Error("暂不支持")}release(){return this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(s){return this._handler.getImageBuffer?this._handler.getImageBuffer(s):null}addEventListener(s,t,e){return this._handler.addEventListener(s,t,e)}removeEventListener(s,t,e){return this._handler.removeEventListener(s,t,e)}dispatchEvent(s){return this._handler.dispatchEvent(s)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(s,t){this._handler.clearViewBox(s,t)}isVisible(s){return this._handler.isVisible(s)}onVisibleChange(s){return this._handler.onVisibleChange(s)}getTopLeft(s){return this._handler.getTopLeft(s)}};R0=sz([ct(),nz("design:paramtypes",[])],R0);var kE=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},wE=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},VA=function(s,t){return function(e,i){t(e,i,s)}};let O0=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(s){this.contributions=s,this.configured=!1,this.global=tt.global,this.global.hooks.onSetEnv.tap("graphic-util",(t,e,i)=>{this.configured=!1,this.configure(i,e)})}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(s,t){this.configured||(this.contributions.getContributions().forEach(e=>{e.configure(this,t)}),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const s=ih.shareCanvas();this._canvas=s,this._context=s.getContext("2d")}}bindTextMeasure(s){this._textMeasure=s}measureText(s,t,e="native"){var i;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=e;const r={width:this._textMeasure.measureTextWidth(s,t),height:(i=t.fontSize)!==null&&i!==void 0?i:_r.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(s,t,e){return this.configure(this.global,this.global.env),new li(Object.assign({defaultFontParams:{fontFamily:_r.fontFamily,fontSize:_r.fontSize},getCanvasForMeasure:e||(()=>this.canvas),getTextBounds:void 0,specialCharSet:`-/: .,@%'"~`+li.ALPHABET_CHAR_SET+li.ALPHABET_CHAR_SET.toUpperCase()},t??{}),s)}drawGraphicToCanvas(s,t,e){if(!t.defaultLayer)return null;const i=Ct.get(ag),n=s.AABBBounds,r=n.width(),a=n.height();i.create({width:r,height:a,canvas:e,dpr:t.window.dpr,canvasControled:!0,offscreen:!0,title:""});const o=-n.x1,l=-n.y1,h=t.params.optimize.disableCheckGraphicWidthOutRange;t.params.optimize.disableCheckGraphicWidthOutRange=!0,t.defaultLayer.getNativeHandler().drawTo(i,[s],{x:o,y:l,width:r,height:a,stage:t,layer:t.defaultLayer,renderService:t.renderService,background:"transparent",clear:!0,updateBounds:!1}),t.params.optimize.disableCheckGraphicWidthOutRange=h;const d=i.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}};O0=kE([ct(),VA(0,Dt(Qe)),VA(0,gi(P0)),wE("design:paramtypes",[Object])],O0);var jr;(function(s){s[s.transform=0]="transform",s[s.matrix=1]="matrix"})(jr||(jr={}));const qe=new ze;let D0=class{constructor(){this.matrix=new ze}init(s){return this.mode=jr.transform,this.originTransform=s,this.matrix.reset(),this}fromMatrix(s,t){return this.mode=jr.matrix,this.outSourceMatrix=s,this.outTargetMatrix=t,this}scaleMatrix(s,t,e){const i=this.outSourceMatrix;if(qe.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:n,y:r}=e;this.outTargetMatrix.translate(n,r),this.outTargetMatrix.scale(s,t),this.outTargetMatrix.translate(-n,-r)}else this.outTargetMatrix.scale(s,t);return this.outTargetMatrix.multiply(qe.a,qe.b,qe.c,qe.d,qe.e,qe.f),this}rotateMatrix(s,t){const e=this.outSourceMatrix;if(qe.setValue(e.a,e.b,e.c,e.d,e.e,e.f),this.outTargetMatrix.reset(),t){const{x:i,y:n}=t;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(s),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(s);return this.outTargetMatrix.multiply(qe.a,qe.b,qe.c,qe.d,qe.e,qe.f),this}scale(s,t,e){return this.mode===jr.matrix?this.scaleMatrix(s,t,e):this}rotate(s,t){return this.mode===jr.matrix?this.rotateMatrix(s,t):this}translateMatrix(s,t){const e=this.outSourceMatrix;return qe.setValue(e.a,e.b,e.c,e.d,e.e,e.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(s,t),this.outTargetMatrix.multiply(qe.a,qe.b,qe.c,qe.d,qe.e,qe.f),this}translate(s,t){return this.mode===jr.matrix?this.translateMatrix(s,t):this}simplify(s){return this.mode===jr.matrix?this.simplifyMatrix(s):this}simplifyMatrix(s){return this}};D0=kE([ct(),wE("design:paramtypes",[])],D0);const Bi={arc:B3,area:I3,circle:F3,line:H3,path:G3,symbol:U3,text:xE,rect:N3,rect3d:V3,polygon:W3,richtext:Pn,richtextIcon:$3,image:tu,group:j3,glyph:z3},rv=Object.keys(Bi);function rz(){return{arc:Object.assign({},Bi.arc),area:Object.assign({},Bi.area),circle:Object.assign({},Bi.circle),line:Object.assign({},Bi.line),path:Object.assign({},Bi.path),symbol:Object.assign({},Bi.symbol),text:Object.assign({},Bi.text),rect:Object.assign({},Bi.rect),rect3d:Object.assign({},Bi.rect3d),polygon:Object.assign({},Bi.polygon),richtext:Object.assign({},Bi.richtext),richtextIcon:Object.assign({},Bi.richtextIcon),image:Object.assign({},Bi.image),group:Object.assign({},Bi.group),glyph:Object.assign({},Bi.glyph)}}function Yc(s,t){Object.keys(t).forEach(e=>{s[e]=t[e]})}const UA=rz();class eu{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},rv.forEach(t=>{this._defaultTheme[t]=Object.create(UA[t])}),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const n=this.getParentWithTheme(t);if(n){const r=n.theme;(r.dirty||i)&&r.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,zt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;rv.forEach(n=>{const r=Object.create(UA[n]);t&&t[n]&&Yc(r,t[n]),i[n]&&Yc(r,i[n]),e[n]&&Yc(r,e[n]),this.combinedTheme[n]=r}),e.common&&rv.forEach(n=>{Yc(this.combinedTheme[n],e.common)}),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach(n=>{i[n]?Object.assign(i[n],t[n]):i[n]=Object.assign({},t[n])}):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren(e=>{e.isContainer&&(e.theme&&(e.theme.dirty=!0),this.dirtyChildren(e))})}}const TE=new eu;function rt(s,t){return s.glyphHost?rt(s.glyphHost):t?(s.isContainer,t):az(s)||TE.getTheme()}function az(s){let t;if(t=s.isContainer?s:s.parent,t){for(;t&&!t.theme;)t=t.parent;return t?(t.theme||t.createTheme(),t.theme.getTheme(t)):TE.getTheme()}return null}var oz=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};class lz extends vo{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Xe.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let i=this._lastChild,n=0;for(;i;){if(t(i,n++))return;i=i._prev}}else{let i=this._firstChild,n=0;for(;i;){if(t(i,n++))return;i=i._next}}}forEachChildrenAsync(t,e=!1){return oz(this,void 0,void 0,function*(){if(e){let i=this._lastChild,n=0;for(;i;){let r=t(i,n++);if(r.then&&(r=yield r),r)return;i=i._prev}}else{let i=this._firstChild,n=0;for(;i;){let r=t(i,n++);if(r.then&&(r=yield r),r)return;i=i._next}}})}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&zt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,e===0)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let n=0;n<e;n++){if(!i)return null;n>0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const r=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,r)}let i;this._nodeList[e]=t;for(let r=e-1;r>=0&&(i=this._nodeList[r],!i);r--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap||!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex(i=>i===t);e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren((n,r)=>!(n===this||!t(n,r))&&(i=n,!0)),e&&this.forEachChildren(n=>{if(n.isContainer){const r=n.find(t,!0);if(r)return i=r,!0}return!1}),i}findAll(t,e=!1){let i=[];return this.forEachChildren((n,r)=>{n!==this&&t(n,r)&&i.push(n)}),e&&this.forEachChildren(n=>{if(n.isContainer){const r=n.findAll(t,!0);r.length&&(i=i.concat(r))}}),i}getElementById(t){return this.find(e=>e.id===t,!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll(e=>e.name===t,!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll(e=>e.type===t,!0)}getChildByName(t,e=!1){return this.find(i=>i.name===t,e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<t;i++){if(!e._next)return null;e=e._next}return e}at(t){return this.getChildAt(t)}containNode(t){if(!this._idMap)return!1;if(this._idMap.has(t._uid))return!0;let e=this._firstChild;for(;e;){if(e.containNode(t))return!0;e=e._next}return!1}getRootNode(){let t=this.parent;for(;t!=null&&t.parent;)t=t.parent;return t||this}hasChildNodes(){return this._firstChild!==null}addChild(t){return this.appendChild(t)}add(t){return this.appendChild(t)}getChildren(){const t=[];let e=this._firstChild;for(;e;)t.push(e),e=e._next;return t}isChildOf(t){return!!this.parent&&this.parent._uid===t._uid}isParentOf(t){return t.isChildOf(this)}isDescendantsOf(t){let e=this.parent;if(!e)return!1;do{if(e._uid===t._uid)return!0;e=e.parent}while(e!==null);return!1}isAncestorsOf(t){return t.isDescendantsOf(this)}getAncestor(t){throw new Error("暂不支持")}setAllDescendantsProps(t,e){let i=this._firstChild;for(;i;)i[t]=e,i.setAllDescendantsProps(t,e),i=i._next}setCount(t){this._count+=t;let e=this.parent;if(e)do e._count+=t,e=e.parent;while(e!==null)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const n=pe(i,!0)&&i||Vt(i)&&i.capture,r=Vt(i)&&i.once,a=q(e)?void 0:e;return t=n?`${t}capture`:t,e=q(e)?e:e.handleEvent,r?super.once(t,e,a):super.on(t,e,a),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const n=pe(i,!0)&&i||Vt(i)&&i.capture,r=q(e)?void 0:e;t=n?`${t}capture`:t,e=q(e)?e:e.handleEvent;const a=Vt(i)&&i.once;return super.off(t,e,r,a),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return Vt(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class sc{get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get x(){return this.canvas.x}get y(){return this.canvas.y}get canvasX(){return this.canvas.x}get canvasY(){return this.canvas.y}get viewX(){return this.viewport.x}get viewY(){return this.viewport.y}constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=sc.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation(),this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class og extends sc{constructor(){super(...arguments),this.client={x:0,y:0},this.movement={x:0,y:0},this.offset={x:0,y:0},this.global={x:0,y:0},this.screen={x:0,y:0}}get clientX(){return this.client.x}get clientY(){return this.client.y}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,n,r,a,o,l,h,d,u,c,p,g,f){throw new Error("Method not implemented.")}}class xs extends og{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}clone(){var t,e,i;const n=new xs(this.manager);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,(t=this.manager)===null||t===void 0||t.copyPointerData(this,n),(e=this.manager)===null||e===void 0||e.copyMouseData(this,n),(i=this.manager)===null||i===void 0||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice(),n.type=this.type,n}}class ha extends og{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const n=new ha(this.manager);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,(t=this.manager)===null||t===void 0||t.copyWheelData(this,n),(e=this.manager)===null||e===void 0||e.copyMouseData(this,n),(i=this.manager)===null||i===void 0||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice(),n.type=this.type,n}}ha.DOM_DELTA_PIXEL=0,ha.DOM_DELTA_LINE=1,ha.DOM_DELTA_PAGE=2;class Xb extends sc{constructor(t,e){super(),this.type=t,this.detail=e}}const ME="*",Ya=typeof performance=="object"&&performance.now?performance:Date;function Rr(s){return s==="mouse"||s==="pen"}class hz{constructor(t,e){this.dispatch=new vo,this.cursorTarget=null,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(i,n)=>{if(!(i instanceof xs))return void zt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(i,i.type,n);if(this.dispatchEvent(r,"pointerdown"),r.pointerType==="touch")this.dispatchEvent(r,"touchstart");else if(Rr(r.pointerType)){const a=r.button===2;this.dispatchEvent(r,a?"rightdown":"mousedown")}this.trackingData(i.pointerId).pressTargetsByButton[i.button]=r.composedPath(),this.freeEvent(r)},this.onPointerMove=(i,n)=>{var r,a;if(!(i instanceof xs))return void zt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const o=this.createPointerEvent(i,i.type,n),l=Rr(o.pointerType),h=this.trackingData(i.pointerId),d=this.findMountedTarget(h.overTargets);if(h.overTargets&&d&&d!==this.rootTarget&&d!==o.target){const u=i.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(i,u,d||void 0);if(this.dispatchEvent(c,"pointerout"),l&&this.dispatchEvent(c,"mouseout"),!o.composedPath().includes(d)){const p=this.createPointerEvent(i,"pointerleave",d||void 0);for(p.eventPhase=p.AT_TARGET;p.target&&!o.composedPath().includes(p.target);)p.currentTarget=p.target,this.notifyTarget(p),l&&this.notifyTarget(p,"mouseleave"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(c)}if(d!==o.target){const u=i.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(o,u);this.dispatchEvent(c,"pointerover"),l&&this.dispatchEvent(c,"mouseover");let p=d==null?void 0:d.parent;for(;p&&p!==this.rootTarget.parent&&p!==o.target;)p=p.parent;if(!p||p===this.rootTarget.parent){const g=this.clonePointerEvent(o,"pointerenter");for(g.eventPhase=g.AT_TARGET;g.target&&g.target!==d&&g.target!==this.rootTarget.parent;)g.currentTarget=g.target,this.notifyTarget(g),l&&this.notifyTarget(g,"mouseenter"),g.target=g.target.parent;this.freeEvent(g)}this.freeEvent(c)}this.dispatchEvent(o,"pointermove"),o.pointerType==="touch"&&this.dispatchEvent(o,"touchmove"),l&&(this.dispatchEvent(o,"mousemove"),this.cursorTarget=o.target,this.cursor=((a=(r=o.target)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.cursor)||this.rootTarget.getCursor()),h.overTargets=o.composedPath(),this.freeEvent(o)},this.onPointerOver=(i,n)=>{var r,a;if(!(i instanceof xs))return void zt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const o=this.trackingData(i.pointerId),l=this.createPointerEvent(i,i.type,n),h=Rr(l.pointerType);this.dispatchEvent(l,"pointerover"),h&&this.dispatchEvent(l,"mouseover"),l.pointerType==="mouse"&&(this.cursorTarget=l.target,this.cursor=((a=(r=l.target)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.cursor)||this.rootTarget.getCursor());const d=this.clonePointerEvent(l,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),h&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;o.overTargets=l.composedPath(),this.freeEvent(l),this.freeEvent(d)},this.onPointerOut=(i,n)=>{if(!(i instanceof xs))return void zt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId);if(r.overTargets){const a=Rr(i.pointerType),o=this.findMountedTarget(r.overTargets),l=this.createPointerEvent(i,"pointerout",o||void 0);this.dispatchEvent(l),a&&this.dispatchEvent(l,"mouseout");const h=this.createPointerEvent(i,"pointerleave",o||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&h.target!==this.rootTarget.parent;)h.currentTarget=h.target,this.notifyTarget(h),a&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;r.overTargets=[],this.freeEvent(l),this.freeEvent(h)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(i,n)=>{var r;if(!(i instanceof xs))return void zt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const a=Ya.now(),o=this.createPointerEvent(i,i.type,n);if(this.dispatchEvent(o,"pointerup"),o.pointerType==="touch")this.dispatchEvent(o,"touchend");else if(Rr(o.pointerType)){const u=o.button===2;this.dispatchEvent(o,u?"rightup":"mouseup")}const l=this.trackingData(i.pointerId),h=this.findMountedTarget(l.pressTargetsByButton[i.button]);let d=h;if(h&&!o.composedPath().includes(h)){let u=h;for(;u&&!o.composedPath().includes(u);){if(o.currentTarget=u,this.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch")this.notifyTarget(o,"touchendoutside");else if(Rr(o.pointerType)){const c=o.button===2;this.notifyTarget(o,c?"rightupoutside":"mouseupoutside")}u=u.parent}delete l.pressTargetsByButton[i.button],d=u}if(d){const u=this.clonePointerEvent(o,"click");u.target=d,u.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:u.target,timeStamp:a});const c=l.clicksByButton[i.button];c.target===u.target&&a-c.timeStamp<((r=this._config.clickInterval)!==null&&r!==void 0?r:200)?++c.clickCount:c.clickCount=1,c.target=u.target,c.timeStamp=a,u.detail=c.clickCount,Rr(u.pointerType)?(this.dispatchEvent(u,"click"),c.clickCount===2&&this.dispatchEvent(u,"dblclick")):u.pointerType==="touch"&&(this.dispatchEvent(u,"tap"),c.clickCount===2&&this.dispatchEvent(u,"dbltap")),this.dispatchEvent(u,"pointertap"),this.freeEvent(u)}this.freeEvent(o)},this.onPointerUpOutside=(i,n)=>{if(!(i instanceof xs))return void zt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[i.button]),o=this.createPointerEvent(i,i.type,n);if(a){let l=a;for(;l;)o.currentTarget=l,this.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"?this.notifyTarget(o,"touchendoutside"):Rr(o.pointerType)&&this.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),l=l.parent;delete r.pressTargetsByButton[i.button]}this.freeEvent(o)},this.onWheel=(i,n)=>{if(!(i instanceof ha))return void zt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const r=this.createWheelEvent(i,n);this.dispatchEvent(r),this.freeEvent(r)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,n)=>i.priority-n.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,r,a,o,l;if(!this.rootTarget)return;const h=this.mappingTable[t.type];let d;const u=`${t.canvasX}-${t.canvasY}`;if(!((e=this._prePointTargetCache)===null||e===void 0)&&e[u]&&(!((n=(i=this._prePointTargetCache)===null||i===void 0?void 0:i[u])===null||n===void 0)&&n.stage)&&((a=(r=this._prePointTargetCache)===null||r===void 0?void 0:r[u])===null||a===void 0?void 0:a.stage.renderCount)===((o=this._prePointTargetCache)===null||o===void 0?void 0:o.stageRenderCount)?d=this._prePointTargetCache[u]:(d=this.pickTarget(t.canvasX,t.canvasY,t),t.pickParams||(this._prePointTargetCache={[u]:d,stageRenderCount:(l=d==null?void 0:d.stage.renderCount)!==null&&l!==void 0?l:-1})),h)for(let c=0,p=h.length;c<p;c++)h[c].fn(t,d);else zt.getInstance().warn(`[EventManager]: Event mapping not defined for ${t.type}`)}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let n=0,r=i.length-1;n<r;n++)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){e=e??t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const n=this.allocateEvent(xs);return this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=i||this.pickTarget(n.global.x,n.global.y,n),typeof e=="string"&&(n.type=e),n}createWheelEvent(t,e){const i=this.allocateEvent(ha);return this.copyWheelData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=e||this.pickTarget(i.global.x,i.global.y,i),i}clonePointerEvent(t,e){const i=this.allocateEvent(xs);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof xs&&e instanceof xs&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof og&&e instanceof og&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.shiftKey=t.shiftKey,e.metaKey=t.metaKey,["client","movement","canvas","screen","global","offset","viewport"].forEach(i=>{e[i].x=t[i].x,e[i].y=t[i].y}))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Ya.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=((e=this.eventPool.get(t))===null||e===void 0?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),(e=this.eventPool.get(i))===null||e===void 0||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].once&&t.currentTarget.removeEventListener(e,i[n].fn,{once:!0}),i[n].fn.call(i[n].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const i=t.currentTarget._events[ME];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,t,e)}pickTarget(t,e,i){let n;const r=this.rootTarget.pick(t,e);return n=r&&r.graphic?r.graphic:r&&r.group?r.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=r.params),n}}const dz={pickable:!0,visible:!0,dispatchEvent(s){var t;if(!(s instanceof sc))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return s.defaultPrevented=!1,s.path=[],s.target=this,(t=s==null?void 0:s.manager)===null||t===void 0||t.dispatchEvent(s),!s.defaultPrevented},emit(s,t){return this.dispatchEvent(new Xb(s,t))}},uz={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class cz{constructor(t){this.resolution=1,this.onPointerDown=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.normalizeToPointerData(u);this.autoPreventDefault&&c[0].isNormalized&&(u.cancelable||!("cancelable"in u))&&u.preventDefault();for(let p=0,g=c.length;p<g;p++){const f=c[p],_=this.bootstrapEvent(this.rootPointerEvent,f);this.manager.mapEvent(_)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerMove=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch"||this.isEventOutsideOfTargetElement(u))return;const c=this.normalizeToPointerData(u);for(let p=0,g=c.length;p<g;p++){const f=this.bootstrapEvent(this.rootPointerEvent,c[p]);this.manager.mapEvent(f)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerUp=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.isEventOutsideOfTargetElement(u)?"outside":"",p=this.normalizeToPointerData(u);for(let g=0,f=p.length;g<f;g++){const _=this.bootstrapEvent(this.rootPointerEvent,p[g]);_.type+=c,this.manager.mapEvent(_)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onPointerOverOut=u=>{if(this.supportsTouchEvents&&u.pointerType==="touch")return;const c=this.normalizeToPointerData(u);for(let p=0,g=c.length;p<g;p++){const f=this.bootstrapEvent(this.rootPointerEvent,c[p]);this.manager.mapEvent(f)}this.setCursor(this.manager.cursor,this.manager.cursorTarget)},this.onWheel=u=>{const c=this.normalizeWheelEvent(u);this.manager.mapEvent(c)};const{targetElement:e,resolution:i,rootNode:n,global:r,viewport:a,autoPreventDefault:o=!1,clickInterval:l,supportsTouchEvents:h=r.supportsTouchEvents,supportsPointerEvents:d=r.supportsPointerEvents}=t;this.manager=new hz(n,{clickInterval:l}),this.globalObj=r,this.supportsPointerEvents=d,this.supportsTouchEvents=h,this.supportsMouseEvents=r.supportsMouseEvents,this.applyStyles=r.applyStyles,this.autoPreventDefault=o,this.eventsAdded=!1,this.viewport=a,this.rootPointerEvent=new xs,this.rootWheelEvent=new ha,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const r=this.cursorStyles[t];r?typeof r=="string"&&i?n.style.cursor=r:typeof r=="function"?r(t):typeof r=="object"&&i&&Object.assign(n.style,r):i&&ot(t)&&!Gs(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=(e=this.globalObj)===null||e===void 0?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:r}=t,a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i<n;i++){const r=t.changedTouches[i];ke(r.button)&&(r.button=0),ke(r.buttons)&&(r.buttons=1),ke(r.isPrimary)&&(r.isPrimary=t.touches.length===1&&t.type==="touchstart"),ke(r.width)&&(r.width=r.radiusX||1),ke(r.height)&&(r.height=r.radiusY||1),ke(r.tiltX)&&(r.tiltX=0),ke(r.tiltY)&&(r.tiltY=0),ke(r.pointerType)&&(r.pointerType="touch"),ke(r.pointerId)&&(r.pointerId=r.identifier||0),ke(r.pressure)&&(r.pressure=r.force||.5),ke(r.twist)&&(r.twist=0),ke(r.tangentialPressure)&&(r.tangentialPressure=0),ke(r.layerX)&&(r.layerX=r.offsetX=r.clientX),ke(r.layerY)&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=t.type,e.push(r)}else if(this.globalObj.supportsMouseEvents&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof PointerEvent))e.push(t);else{const i=t;ke(i.isPrimary)&&(i.isPrimary=!0),ke(i.width)&&(i.width=1),ke(i.height)&&(i.height=1),ke(i.tiltX)&&(i.tiltX=0),ke(i.tiltY)&&(i.tiltY=0),ke(i.pointerType)&&(i.pointerType="mouse"),ke(i.pointerId)&&(i.pointerId=1),ke(i.pressure)&&(i.pressure=.5),ke(i.twist)&&(i.twist=0),ke(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;const{x:i,y:n}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=n,e.global.x=i,e.global.y=n,e.offset.x=i,e.offset.y=n;const{x:r,y:a}=this.mapToViewportPoint(e);return e.viewport.x=r,e.viewport.y=a,e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:i,y:n}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=n,t.global.x=i,t.global.y=n,t.offset.x=i,t.offset.y=n;const{x:r,y:a}=this.mapToViewportPoint(t);return t.viewport.x=r,t.viewport.y=a,t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=uz[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Ya.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class lg{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return lg.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class hg{static Avaliable(){return!0}avaliable(){return hg.Avaliable()}tick(t,e){this.timerId=setTimeout(()=>{e(this)},t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class Ad{static Avaliable(){return!!tt.global.getRequestAnimationFrame()}avaliable(){return Ad.Avaliable()}tick(t,e){tt.global.getRequestAnimationFrame()(()=>{this.released||e(this)})}release(){this.released=!0}getTime(){return Date.now()}}var Is;(function(s){s[s.INITIAL=0]="INITIAL",s[s.RUNNING=1]="RUNNING",s[s.PAUSE=2]="PAUSE"})(Is||(Is={}));class pz{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(t=[]){this.handleTick=(e,i)=>{const{once:n=!1}=i??{};this.ifCanStop()?this.stop():(this._handlerTick(e),n||e.tick(this.interval,this.handleTick))},this._handlerTick=e=>{const i=this.tickerHandler.getTime();let n=0;this.lastFrameTime>=0&&(n=i-this.lastFrameTime),this.lastFrameTime=i,this.status===Is.RUNNING&&(this.tickCounts++,this.timelines.forEach(r=>{r.tick(n)}))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=Is.INITIAL,tt.global.hooks.onSetEnv.tap("default-ticker",()=>{this.initHandler()}),tt.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter(e=>e!==t)}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:Ad},{mode:"timeout",cons:hg},{mode:"manual",cons:lg}];for(let e=0;e<t.length;e++)if(t[e].cons.Avaliable()){this.mode=t[e].mode;break}return null}setupTickHandler(){let t;switch(this._mode){case"raf":t=new Ad;break;case"timeout":t=new hg;break;case"manual":t=new lg;break;default:zt.getInstance().warn("非法的计时器模式"),t=new Ad}return!!t.avaliable()&&(this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0)}setInterval(t){this.interval=t}getInterval(){return this.interval}setFPS(t){this.setInterval(1e3/t)}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,e=>{this.handleTick(e,{once:!0})})}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,e=>{this.handleTick(e,{once:!0})})}pause(){return this.status!==Is.INITIAL&&(this.status=Is.PAUSE,!0)}resume(){return this.status!==Is.INITIAL&&(this.status=Is.RUNNING,!0)}ifCanStop(){return!!(this.autoStop&&(!this.timelines.length||this.timelines.reduce((t,e)=>t+e.animateCount,0)===0))}start(t=!1){return this.status===Is.RUNNING||!this.tickerHandler||!t&&(this.status===Is.PAUSE||!this.timelines.length||this.timelines.reduce((e,i)=>e+i.animateCount,0)===0)?!1:(this.status=Is.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0)}stop(){this.status=Is.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}}class Gt{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return t===0?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return t===0?0:Math.pow(2,10*t-10)}static expoOut(t){return t===1?1:1-Math.pow(2,-10*t)}static expoInOut(t){return t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(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}static bounceIn(t){return 1-Gt.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Gt.bounceIn(2*t):.5*Gt.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(i===0||i===1)return i;const n=e/It*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*It/e)}}static getElasticOut(t,e){return function(i){if(i===0||i===1)return i;const n=e/It*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*It/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/It*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*It/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*It/e)*.5+1}}}Gt.quadIn=Gt.getPowIn(2),Gt.quadOut=Gt.getPowOut(2),Gt.quadInOut=Gt.getPowInOut(2),Gt.cubicIn=Gt.getPowIn(3),Gt.cubicOut=Gt.getPowOut(3),Gt.cubicInOut=Gt.getPowInOut(3),Gt.quartIn=Gt.getPowIn(4),Gt.quartOut=Gt.getPowOut(4),Gt.quartInOut=Gt.getPowInOut(4),Gt.quintIn=Gt.getPowIn(5),Gt.quintOut=Gt.getPowOut(5),Gt.quintInOut=Gt.getPowInOut(5),Gt.backIn=Gt.getBackIn(1.7),Gt.backOut=Gt.getBackOut(1.7),Gt.backInOut=Gt.getBackInOut(1.7),Gt.elasticIn=Gt.getElasticIn(1,.3),Gt.elasticOut=Gt.getElasticOut(1,.3),Gt.elasticInOut=Gt.getElasticInOut(1,.3*1.5);class CE{constructor(){this.id=Xe.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===Ii.END?this.removeAnimate(e):e.status===Ii.RUNNING||e.status===Ii.INITIAL?(this.animateCount++,e.advance(t)):e.status===Ii.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t,e=!0){t._onRemove&&t._onRemove.forEach(i=>i()),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const PE=new CE;class os{constructor(t,e,i,n,r){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=r,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},(t=this.step.prev.getLastProps())!==null&&t!==void 0?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(this.updateCount===0){this.onFirstRun();const n=this.step.getLastProps();Object.keys(n).forEach(r=>{this.subAnimate.animate.validAttr(r)&&(i[r]=n[r])})}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class gz extends os{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let dg=class ld{constructor(t=Xe.GenAutoIncrementId(),e=PE){this.id=t,this.timeline=e,this.status=Ii.INITIAL,this.tailAnimate=new $A(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce((t,e)=>t+e.totalDuration,0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach(i=>{e=ss(i.getDuration(),e)}),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){ld.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this.subAnimates.length===1&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t,e=ld.mode){t&&e&eh.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:Pe.ANIMATE_PLAY})}runCb(t){const e=new gz(()=>{t(this,e.step.prev)});return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,r,a){const o=ld.interpolateMap.get(t)||ld.interpolateMap.get("");return!!o&&o(t,e,i,n,r,a)}pause(){this.status===Ii.RUNNING&&(this.status=Ii.PAUSED)}resume(){this.status===Ii.PAUSED&&(this.status=Ii.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}subAnimate(){const t=new $A(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach(e=>this.preventAttr(e))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach(e=>{e.bind(t)}),this}advance(t){if(this._duringTime<this._startTime){if(this._duringTime+t*this.timeScale<this._startTime)return void(this._duringTime+=t*this.timeScale);t=this._duringTime+t*this.timeScale-this._startTime,this._duringTime=this._startTime}this.status===Ii.INITIAL&&(this.status=Ii.RUNNING,this._onStart&&this._onStart.forEach(e=>e())),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===Ii.RUNNING&&(this.status=Ii.END,this._onEnd&&this._onEnd.forEach(e=>e()))}setPosition(t){let e,i=0;const n=this.rawPosition,r=this.subAnimates.reduce((o,l)=>o+l.totalDuration,0);t<0&&(t=0);const a=t>=r;if(a&&(t=r),t===n)return a;for(let o=0;o<this.subAnimates.length&&(e=this.subAnimates[o],!(i+e.totalDuration>=t));o++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),a}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=Ii.END}stop(t){t||this.target.onStop(),t==="start"?this.target.onStop(this.getStartProps()):t==="end"?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};dg.mode=eh.NORMAL,dg.interpolateMap=new Map;class $A{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new YA(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(e==null||e<0)&&(e=0);const i=t.easing,n=typeof i=="string"?Gt[i]:i,r=this._addStep(e,null,n);return r.type=$o.customAnimate,this._appendProps(t.getEndProps(),r,!1),this._appendCustomAnimate(t,r),this}to(t,e,i,n){(e==null||e<0)&&(e=0);const r=typeof i=="string"?Gt[i]:i,a=this._addStep(e,null,r);return a.type=$o.to,this._appendProps(t,a,!!n&&n.tempProps),a.propKeys||(a.propKeys=Object.keys(a.props)),n&&n.noPreventAttrs||this.target.animates.forEach(o=>{o.id!==this.animate.id&&o.preventAttrs(a.propKeys)}),this}from(t,e,i,n){this.to(t,0,i,n);const r={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach(a=>{r[a]=this.getLastPropByName(a,this.stepTail)}),this.to(r,e,i,n),this.stepTail.type=$o.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return(t=this.stepHead)===null||t===void 0?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=$o.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new YA(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const r=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach(o=>{e.props[o]===void 0&&(e.props[o]=this.target.getDefaultAttribute(o))});n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach(o=>{r[o]===void 0&&(r[o]=n.props[o])})),e.propKeys=Object.keys(e.props),n=n.prev;const a=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(r)),e.propKeys.forEach(o=>{if(a[o]===void 0){const l=this.animate.getStartProps();a[o]=l[o]=this.target.getComputedAttribute(o)}}),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,r=this.rawPosition;let a,o,l=!1;const h=(e=this._startAt)!==null&&e!==void 0?e:0;if(t<0&&(t=0),t<h)return this.rawPosition=t,!1;if(t-=h,i<=0)return l=!0,l;if(a=Math.floor(t/i),o=t-a*i,l=t>=n*i+i,l&&(o=i,a=n,t=o*a+i),t===r)return l;const d=!this.reversed!=!(this.bounce&&a%2);return d&&(o=i-o),this._deltaPosition=o-this.position,this.position=o,this.rawPosition=t+h,this.updatePosition(l,d),l}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,r=this.duration;if(this.target&&i){let a=i.next;for(;a&&a.position<=n;)i=a,a=i.next;let o=t?r===0?1:n/r:(n-i.position)/i.duration;i.easing&&(o=i.easing(o)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,o,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach(l=>l(i,o))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let n=e.prev;for(;n&&n!==t;)n.customAnimate&&(n.customAnimate.onStart&&n.customAnimate.onStart(),n.customAnimate.onEnd&&n.customAnimate.onEnd()),n=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let n=e.next;for(;n&&n!==t;)n.customAnimate&&(n.customAnimate.onStart&&n.customAnimate.onStart(),n.customAnimate.onEnd&&n.customAnimate.onEnd()),n=n.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&i.props[t]!==void 0)return i.props[t];if(i.customAnimate){const n=i.customAnimate.getEndProps()[t];if(n!==void 0)return n}i=i.prev}return zt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){t.props==null&&t.customAnimate==null||this.target.onStep(this,this.animate,t,e,i)}}class YA{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const XA={duration:200,easing:"cubicOut"},Xo={duration:1e3,easing:"quadInOut"};var KA;(function(s){s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=4]="Bottom",s[s.Left=8]="Left",s[s.ALL=15]="ALL"})(KA||(KA={}));const qn=[!1,!1,!1,!1],fz=s=>{var t;let e=!0;if(pe(s,!0)){for(let i=0;i<4;i++)qn[i]=s,e&&(e=!((t=qn[i])!==null&&t!==void 0&&!t));e=s}else if(Array.isArray(s))for(let i=0;i<4;i++)qn[i]=!!s[i],e&&(e=!!qn[i]);else qn[0]=!1,qn[1]=!1,qn[2]=!1,qn[3]=!1;return{isFullStroke:e,stroke:qn}},Hh=[0,0,0,0],bi=s=>s?U(s)?s.length===0?0:s.length===1?s[0]:s.length===2?(Hh[0]=s[0],Hh[2]=s[0],Hh[1]=s[1],Hh[3]=s[1],Hh):s:s:0,Co=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Xc=[1,2,3,0,1,2,3,0];function av(s,t,e,i){for(;s>=It;)s-=It;for(;s<0;)s+=It;for(;s>t;)t+=It;Co[0].x=e,Co[1].y=e,Co[2].x=-e,Co[3].y=-e;const n=Math.ceil(s/Ws)%4,r=Math.ceil(t/Ws)%4;if(i.add(oe(s)*e,ee(s)*e),i.add(oe(t)*e,ee(t)*e),n!==r||t-s>ne){let a=!1;for(let o=0;o<Xc.length;o++)if(a||n!==Xc[o]){if(a&&r===Xc[o])break;if(a){const l=Co[Xc[o]];i.add(l.x,l.y)}}else{a=!0;const l=Co[n];i.add(l.x,l.y)}}}function L0(s,t,e){const{x:i,y:n}=ZS(s.x,s.y,t.x,t.y,e),{x:r,y:a}=ZS(s.x1,s.y1,t.x1,t.y1,e),o=new De(i,n,r,a);return o.defined=t.defined,o}function Kb(s,t,e){if(!s||!t)return[];Array.isArray(s)||(s=[s]),Array.isArray(t)||(t=[t]);let i=[];if(s.length>t.length){i=t.map(n=>{const r=new De(n.x,n.y,n.x1,n.y1);return r.defined=n.defined,r});for(let n=0;n<t.length;n++)i[n]=L0(s[n],t[n],e)}else{i=t.map(n=>{const r=new De(n.x,n.y,n.x1,n.y1);return r.defined=n.defined,r});for(let n=0;n<s.length;n++)i[n]=L0(s[n],t[n],e)}return i}const _z=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],mz=s=>_z.includes(s);function Kc(s,t){if(U(s)){let e;for(let i=0;i<s.length&&e===void 0;i++)e=s[i][t];return e}return s[t]}class T_{constructor(){this.durations=[],this.timeout=T_.TimeOut,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout(()=>{this.appendDuration(Date.now()-this.lastDate),t(0)},this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce((e,i)=>e+i,0)/this.durations.length,1e3/60),1e3/30)}}T_.TimeOut=1e3/60;const qA=new T_,In=(s,t)=>ot(s)&&s[s.length-1]==="%"?t*(Number.parseFloat(s.substring(0,s.length-1))/100):s;class vz extends os{constructor(t,e,i,n,r){super(t,e,i,n,r)}getEndProps(){return this.valid===!1?{}:{text:this.to}}onBind(){var t,e,i,n,r,a,o,l;this.fromNumber=lt((t=this.from)===null||t===void 0?void 0:t.text)?(e=this.from)===null||e===void 0?void 0:e.text:Number.parseFloat((i=this.from)===null||i===void 0?void 0:i.text),this.toNumber=lt((n=this.to)===null||n===void 0?void 0:n.text)?(r=this.to)===null||r===void 0?void 0:r.text:Number.parseFloat((a=this.to)===null||a===void 0?void 0:a.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),this.valid!==!1&&(this.decimalLength=(l=(o=this.params)===null||o===void 0?void 0:o.fixed)!==null&&l!==void 0?l:Math.max(ql(this.fromNumber),ql(this.toNumber)))}onEnd(){}onUpdate(t,e,i){this.valid!==!1&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var ZA;(function(s){s[s.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",s[s.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",s[s.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",s[s.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",s[s.STROKE=4]="STROKE"})(ZA||(ZA={}));class EE extends os{constructor(t,e,i,n,r){super(t,e,i,n,r),this.newPointAnimateType=(r==null?void 0:r.newPointAnimateType)==="appear"?"appear":"grow"}onBind(){var t,e;const i=(t=this.from)===null||t===void 0?void 0:t.points,n=(e=this.to)===null||e===void 0?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const r=new Map;this.fromPoints.forEach(u=>{u.context&&r.set(u.context,u)});let a,o,l=1/0,h=-1/0;for(let u=0;u<this.toPoints.length;u+=1)if(r.has(this.toPoints[u].context)){l=u,a=r.get(this.toPoints[u].context);break}for(let u=this.toPoints.length-1;u>=0;u-=1)if(r.has(this.toPoints[u].context)){h=u,o=r.get(this.toPoints[u].context);break}let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map((u,c)=>{const p=r.get(u.context);return p?(d=p,[p,u]):this.newPointAnimateType==="appear"?[u,u]:c<l&&a?[a,u]:c>h&&o?[o,u]:[d,u]}),this.points=this.interpolatePoints.map(u=>{const c=u[0],p=u[1],g=new De(c.x,c.y,c.x1,c.y1);return g.defined=p.defined,g.context=p.context,g})}onUpdate(t,e,i){this.points=this.points.map((n,r)=>{const a=L0(this.interpolatePoints[r][0],this.interpolatePoints[r][1],e);return a.context=n.context,a}),i.points=this.points}}class RE extends os{constructor(t,e,i,n,r){super(null,null,i,n,r),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=r==null?void 0:r.group,this._clipGraphic=r==null?void 0:r.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:Pe.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Pe.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach(r=>{n[r]=this.clipFromAttribute[r]+(this.clipToAttribute[r]-this.clipFromAttribute[r])*e}),this._clipGraphic.setAttributes(n,!1,{type:Pe.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class yz extends RE{constructor(t,e,i,n,r){var a,o,l,h,d,u,c,p,g,f,_,m;const v=(o=(a=r==null?void 0:r.group)===null||a===void 0?void 0:a.attribute)!==null&&o!==void 0?o:{},y=(l=v.width)!==null&&l!==void 0?l:0,b=(h=v.height)!==null&&h!==void 0?h:0,x=(d=r==null?void 0:r.animationType)!==null&&d!==void 0?d:"in",S=(u=r==null?void 0:r.startAngle)!==null&&u!==void 0?u:0,A=(c=r==null?void 0:r.orient)!==null&&c!==void 0?c:"clockwise";let k=0,w=0;A==="anticlockwise"?(w=x==="in"?S+2*Math.PI:S,w=S+2*Math.PI):(k=S,w=x==="out"?S+2*Math.PI:S);const T=tt.graphicService.creator.arc({x:(g=(p=r==null?void 0:r.center)===null||p===void 0?void 0:p.x)!==null&&g!==void 0?g:y/2,y:(_=(f=r==null?void 0:r.center)===null||f===void 0?void 0:f.y)!==null&&_!==void 0?_:b/2,outerRadius:(m=r==null?void 0:r.radius)!==null&&m!==void 0?m:(y+b)/2,innerRadius:0,startAngle:k,endAngle:w,fill:!0});let M,P;A==="anticlockwise"?(M={startAngle:S+2*Math.PI},P={startAngle:S}):(M={endAngle:S},P={endAngle:S+2*Math.PI}),super(x==="in"?M:P,x==="in"?P:M,i,n,{group:r==null?void 0:r.group,clipGraphic:T})}}class JA extends RE{constructor(t,e,i,n,r){var a,o,l,h,d,u,c,p,g;const f=(o=(a=r==null?void 0:r.group)===null||a===void 0?void 0:a.attribute)!==null&&o!==void 0?o:{},_=(h=(l=r==null?void 0:r.width)!==null&&l!==void 0?l:f.width)!==null&&h!==void 0?h:0,m=(u=(d=r==null?void 0:r.height)!==null&&d!==void 0?d:f.height)!==null&&u!==void 0?u:0,v=(c=r==null?void 0:r.animationType)!==null&&c!==void 0?c:"in",y=(p=r==null?void 0:r.direction)!==null&&p!==void 0?p:"x",b=(g=r==null?void 0:r.orient)!==null&&g!==void 0?g:"positive",x=tt.graphicService.creator.rect({x:0,y:0,width:v==="in"&&y==="x"?0:_,height:v==="in"&&y==="y"?0:m,fill:!0});let S={},A={};y==="y"?b==="negative"?(S={y:m,height:0},A={y:0,height:m}):(S={height:0},A={height:m}):b==="negative"?(S={x:_,width:0},A={x:0,width:_}):(S={width:0},A={width:_}),super(v==="in"?S:A,v==="in"?A:S,i,n,{group:r==null?void 0:r.group,clipGraphic:x})}}class bz extends os{onStart(){const{center:t,r:e}=typeof this.params=="function"?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),r=this.target.getComputedAttribute("z"),a=Math.acos((n-t.y)/e);let o=Math.acos((i-t.x)/e/Math.sin(a));r-t.z<0&&(o=It-o),this.theta=o,this.phi=a}onBind(){}onEnd(){}onUpdate(t,e,i){if(this.phi==null||this.theta==null)return;const{center:n,r,cb:a}=typeof this.params=="function"?this.params():this.params,o=2*Math.PI*e,l=this.theta+o,h=this.phi,d=r*Math.sin(h)*Math.cos(l)+n.x,u=r*Math.cos(h)+n.y,c=r*Math.sin(h)*Math.sin(l)+n.z;for(i.x=d,i.y=u,i.z=c,i.alpha=l+ne/2;i.alpha>It;)i.alpha-=It;i.alpha=It-i.alpha,i.zIndex=-1e4*i.z,a&&a(i)}}class xz extends os{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Sz extends os{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach(t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target})}getEndProps(){const t={};return this.customAnimates.forEach(e=>{Object.assign(t,e.getEndProps())}),t}onBind(){this.initAnimates(),this.customAnimates.forEach(t=>{t.onBind()})}onEnd(){this.customAnimates.forEach(t=>{t.onEnd()})}onStart(){this.customAnimates.forEach(t=>{t.onStart()})}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach(n=>{const r=n.easing;e=(typeof r=="string"?Gt[r]:r)(e),n.onUpdate(t,e,i)}),this.updating=!1)}}function QA(s,t,e,i,n,r){const a=(t-s)*n+s,o=(e-t)*n+t,l=(i-e)*n+e,h=(o-a)*n+a,d=(l-o)*n+o,u=(d-h)*n+h;r[0]=s,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=d,r[6]=l,r[7]=i}function Az(s,t){const e=s.length,i=t.length;if(e===i)return[s,t];const n=[],r=[],a=e<i?s:t,o=Math.min(e,i),l=Math.abs(i-e)/6,h=(o-2)/6,d=Math.ceil(l/h),u=[a[0],a[1]];let c=l;for(let p=2;p<o;p+=6){let g=a[p-2],f=a[p-1],_=a[p],m=a[p+1],v=a[p+2],y=a[p+3];const b=a[p+4],x=a[p+5];if(c<=0){u.push(_,m,v,y,b,x);continue}const S=Math.min(c,d)+1;for(let A=1;A<=S;A++){const k=A/S;QA(g,_,v,b,k,n),QA(f,m,y,x,k,r),g=n[3],f=r[3],u.push(n[1],r[1],n[2],r[2],g,f),_=n[5],m=r[5],v=n[6],y=r[6]}c-=S-1}return a===s?[u,t]:[s,u]}function t1(s,t){const e=s||t,i=e.length,n=e[i-2],r=e[i-1],a=[];for(let o=0;o<t.length;o+=2)a[o]=n,a[o+1]=r;return a}function kz(s){const t=[],e=s.length;for(let i=0;i<e;i+=2)t[i]=s[e-i-2],t[i+1]=s[e-i-1];return t}function e1(s){let t=0,e=0,i=0;const n=s.length;for(let r=0,a=n-2;r<n;a=r,r+=2){const o=s[a],l=s[a+1],h=s[r],d=s[r+1],u=o*d-h*l;t+=u,e+=(o+h)*u,i+=(l+d)*u}return t===0?[s[0]||0,s[1]||0,0]:[e/t/3,i/t/3,t]}function wz(s,t,e,i){const n=(s.length-2)/6;let r=1/0,a=0;const o=s.length,l=o-2;for(let h=0;h<n;h++){const d=6*h;let u=0;for(let c=0;c<o;c+=2){const p=c===0?d:(d+c-2)%l+2,g=s[p]-e[0],f=s[p+1]-e[1],_=t[c]-i[0]-g,m=t[c+1]-i[1]-f;u+=_*_+m*m}u<r&&(r=u,a=h)}return a}function Tz(s,t,e,i){const n=[];let r;for(let a=0;a<s.length;a++){let o=s[a];const l=t[a],h=e1(o),d=e1(l);r==null&&(r=h[2]<0!=d[2]<0);const u=[],c=[];let p=0,g=1/0;const f=[],_=o.length;r&&(o=kz(o));const m=6*wz(o,l,h,d),v=_-2;for(let y=0;y<v;y+=2){const b=(m+y)%v+2;u[y+2]=o[b]-h[0],u[y+3]=o[b+1]-h[1]}if(u[0]=o[m]-h[0],u[1]=o[m+1]-h[1],e>0){const y=i/e;for(let b=-i/2;b<=i/2;b+=y){const x=Math.sin(b),S=Math.cos(b);let A=0;for(let k=0;k<o.length;k+=2){const w=u[k],T=u[k+1],M=l[k]-d[0],P=l[k+1]-d[1],O=M*S-P*x,D=M*x+P*S;f[k]=O,f[k+1]=D;const R=O-w,L=D-T;A+=R*R+L*L}if(A<g){g=A,p=b;for(let k=0;k<f.length;k++)c[k]=f[k]}}}n.push({from:u,to:c,fromCp:h,toCp:d,rotation:-p})}return n}function Mz(s,t){let e,i;const n=[],r=[];for(let a=0;a<Math.max(s.length,t.length);a++){const o=s[a],l=t[a];let h,d;o?l?([h,d]=Az(o,l),e=h,i=d):(d=t1(i,o),h=o):(h=t1(e,l),d=l),n.push(h),r.push(d)}return[n,r]}const Zn=(s,t,e,i,n)=>{ns(t,i)&&ns(e,n)||s.push(t,e,i,n,i,n)};function B0(s){const t=s.commandList,e=[];let i,n=0,r=0,a=0,o=0;const l=(p,g)=>{i&&i.length>2&&e.push(i),i=[p,g]};let h,d,u,c;for(let p=0,g=t.length;p<g;p++){const f=t[p],_=p===0;switch(_&&(a=n=f[1],o=r=f[2],[Bt.L,Bt.C,Bt.Q].includes(f[0])&&(i=[a,o])),f[0]){case Bt.M:n=a=f[1],r=o=f[2],l(a,o);break;case Bt.L:h=f[1],d=f[2],Zn(i,n,r,h,d),n=h,r=d;break;case Bt.C:i.push(f[1],f[2],f[3],f[4],n=f[5],r=f[6]);break;case Bt.Q:h=f[1],d=f[2],u=f[3],c=f[4],i.push(n+2/3*(h-n),r+2/3*(d-r),u+2/3*(h-u),c+2/3*(d-c),u,c),n=u,r=c;break;case Bt.A:{const m=f[1],v=f[2],y=f[3],b=y,x=f[4],S=f[5],A=!!f[6];h=Math.cos(x)*y+m,d=Math.sin(x)*y+v,_?(a=h,o=d,l(a,o)):Zn(i,n,r,h,d),n=Math.cos(S)*y+m,r=Math.sin(S)*y+v;const k=(A?-1:1)*Math.PI/2;for(let w=x;A?w>S:w<S;w+=k){const T=A?Math.max(w+k,S):Math.min(w+k,S);Cp(i,w,T,m,v,y,b)}break}case Bt.E:{const m=f[1],v=f[2],y=f[3],b=f[4],x=f[5],S=f[6],A=f[7]+S,k=!!f[8],w=!ns(x,0),T=Math.cos(x),M=Math.sin(x);let P=Math.cos(S)*y,O=Math.sin(S)*b;w?(h=P*T-O*M+m,d=P*M+O*T+v):(h=P+m,d=O+v),_?(a=h,o=d,l(a,o)):Zn(i,n,r,h,d),P=Math.cos(A)*y,O=Math.sin(A)*b,w?(n=P*T-O*M+m,r=P*M+O*T+v):(n=P+m,r=O+v);const D=(k?-1:1)*Math.PI/2;for(let R=S;k?R>A:R<A;R+=D){const L=k?Math.max(R+D,A):Math.min(R+D,A);if(Cp(i,R,L,m,v,y,b),w){const B=i.length;for(let F=B-6;F<=B-1;F+=2)P=i[F],O=i[F+1],i[F]=(P-m)*T-(O-v)*M+m,i[F+1]=(P-m)*M+(O-v)*T+v}}break}case Bt.R:a=n=f[1],o=r=f[2],h=a+f[3],d=o+f[4],l(h,o),Zn(i,h,o,h,d),Zn(i,h,d,a,d),Zn(i,a,d,a,o),Zn(i,a,o,h,o);break;case Bt.AT:{const m=f[1],v=f[2],y=f[3],b=f[4],x=f[5],S=Ee.distancePP({x:n,y:r},{x:m,y:v}),A=Ee.distancePP({x:y,y:b},{x:m,y:v}),k=((n-m)*(y-m)+(r-v)*(b-v))/(S*A),w=x/Math.sin(k/2),T=(n+y-2*m)/2,M=(r+b-2*v)/2,P=Ee.distancePP({x:T,y:M},{x:0,y:0}),O=m+w*T/P,D=y+w*M/P,R=Math.sqrt(w*w-x*x);a=m+R*(n-m)/S,o=v+R*(r-v)/S,Zn(i,n,r,a,o),n=m+R*(y-m)/A,r=v+R*(b-v)/A;const L=Np({x:O,y:D},{x:a,y:o}),B=Np({x:O,y:D},{x:n,y:r});Cp(i,L,B,O,D,x,x);break}case Bt.Z:i&&Zn(i,n,r,a,o),n=a,r=o}}return i&&i.length>2&&e.push(i),e}function i1(s,t){for(let e=0;e<s.length;e++){const i=s[e];for(let n=0;n<i.length;n+=2){const r=i[n],a=i[n+1],o={x:r,y:a};t.transformPoint({x:r,y:a},o),i[n]=o.x,i[n+1]=o.y}}}function Cz(s){const t=new Je;for(let e=0;e<s.length;e++){const i=s[e];if(i.length>2){t.moveTo(i[0],i[1]);for(let n=2;n<i.length;n+=6)t.bezierCurveTo(i[n],i[n+1],i[n+2],i[n+3],i[n+4],i[n+5])}}return t}const OE=s=>{if(!s)return{x:0,y:0,width:0,height:0};let t=C(s.width)?s.x1-s.x:s.width,e=C(s.height)?s.y1-s.y:s.height,i=0,n=0;return t<0?(i=t,t=-t):Number.isNaN(t)&&(t=0),e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),{x:i,y:n,width:t,height:e}};function qb(s,t,e){const i=s/t;let n,r;s>=t?(r=Math.ceil(Math.sqrt(e*i)),n=Math.floor(e/r),n===0&&(n=1,r=e)):(n=Math.ceil(Math.sqrt(e/i)),r=Math.floor(e/n),r===0&&(r=1,n=e));const a=[];for(let l=0;l<n;l++)a.push(r);const o=e-n*r;if(o>0)for(let l=0;l<o;l+=r)l+r<o?a.push(r):a.push(o-l);return a}const Pz=(s,t)=>{const{width:e,height:i}=OE(s.attribute),n=qb(e,i,t),r=[],a=i/n.length;for(let o=0,l=n.length;o<l;o++){const h=n[o],d=e/h;for(let u=0;u<h;u++)r.push({x:0+u*d,y:0+o*a,width:d,height:a})}return r},Ez=(s,t)=>{const e=s.getParsedAngle(),i=e.startAngle,n=e.endAngle,r=s.getComputedAttribute("innerRadius"),a=s.getComputedAttribute("outerRadius"),o=Math.abs(i-n),l=Math.abs(a-r),h=qb(o*(r+a)/2,l,t),d=[],u=l/h.length,c=a>=r?1:-1,p=n>=i?1:-1;for(let g=0,f=h.length;g<f;g++){const _=h[g],m=o/_;for(let v=0;v<_;v++)d.push({innerRadius:a-u*g*c,outerRadius:a-u*(g+1)*c,startAngle:i+m*v*p,endAngle:i+m*(v+1)*p})}return d},Rz=(s,t)=>{const e=s.getComputedAttribute("startAngle"),i=s.getComputedAttribute("endAngle"),n=s.getComputedAttribute("radius"),r=Math.abs(e-i),a=qb(r*n,n,t),o=[],l=r/a[0],h=n/a.length,d=i>=e?1:-1;for(let u=0,c=a.length;u<c;u++)for(let p=0,g=a[u];p<g;p++)o.push({innerRadius:h*u,outerRadius:h*(u+1),startAngle:e+l*p*d,endAngle:e+l*(p+1)*d});return o},s1=(s,t)=>{const e=s.filter(o=>o.defined!==!1&<(o.x)&<(o.y));if(e.length===0)return[];if(e.length===1)return new Array(t).fill(0).map(o=>e[0]);const i=[];if(t<=e.length){const o=e.length/t;let l=0,h=0;for(;l<t;)i.push(e[Math.floor(h)]),h+=o,l++;return i}const n=t-e.length,r=1/(n/(e.length-1)+1);let a=0;for(let o=0,l=s.length;o<l;o++)if(i.push(s[o]),o<l-1){let h=r;const d=s[o].x,u=s[o].y,c=s[o+1].x,p=s[o+1].y;for(;h<1&&a<n;)i.push({x:d+(c-d)*h,y:u+(p-u)*h}),h+=r,a+=1}return i},Oz=(s,t)=>{var e,i;const n=s.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce((d,u)=>{var c;return d.concat((c=u.points)!==null&&c!==void 0?c:[])},[]));const o=r.filter(d=>d.defined!==!1&<(d.x)&<(d.y));if(!o.length)return[];const l=[];o.forEach(d=>{l.push({x:d.x,y:d.y})});for(let d=o.length-1;d>=0;d--){const u=o[d];l.push({x:(e=u.x1)!==null&&e!==void 0?e:u.x,y:(i=u.y1)!==null&&i!==void 0?i:u.y})}const h=[];return iu(r,t,h),h},Dz=(s,t)=>{const e=s.attribute,i=e.points;if(i)return s1(i,t);if(e.segments){const n=e.segments.reduce((r,a)=>{var o;return r.concat((o=a.points)!==null&&o!==void 0?o:[])},[]);return s1(n,t)}return[]};function Lz(s,t){return s[0]*t[1]-s[1]*t[0]}const I0=s=>s.map(t=>({x:t.x,y:t.y})),n1=(s,t,e)=>{const i=s.length,n=[];for(let u=0;u<i;u++){const c=s[u],p=u===i-1?s[0]:s[u+1],g=aP([t.x,t.y],[e.x,e.y],[c.x,c.y],[p.x,p.y]);g&&typeof g!="boolean"&&n.push({dot:Lz([g[0]-t.x,g[1]-t.x],[e.x-t.x,e.y-t.x]),point:{x:g[0],y:g[1]},edgeIndex:u})}if(n.length<2)return[I0(s),I0(s)];n.sort((u,c)=>u.dot-c.dot);let r=n[0],a=n[n.length-1];r.edgeIndex>a.edgeIndex&&([r,a]=[a,r]);const o=r.point,l=a.point,h=[{x:o.x,y:o.y}];for(let u=r.edgeIndex+1;u<=a.edgeIndex;u++)h.push({x:s[u].x,y:s[u].y});h.push({x:l.x,y:l.y});const d=[{x:l.x,y:l.y}];for(let u=a.edgeIndex+1,c=r.edgeIndex+i;u<=c;u++){const p=s[u%i];d.push({x:p.x,y:p.y})}return d.push({x:o.x,y:o.y}),[h,d]},Bz=s=>{const t=new yi;s.forEach(r=>{t.add(r.x,r.y)});const e=t.width(),i=t.height();if(e>=i){const r=t.x1+e/2;return n1(s,{x:r,y:t.y1},{x:r,y:t.y2})}const n=t.y1+i/2;return n1(s,{x:t.x1,y:n},{x:t.x2,y:n})},iu=(s,t,e)=>{if(t===1)e.push({points:s});else{const i=Math.floor(t/2),n=Bz(s);iu(n[0],i,e),iu(n[1],t-i,e)}},Iz=(s,t)=>{const e=s.attribute.points;if(!e||!e.length)return[];if(t===1)return[{points:I0(e)}];const i=[];return iu(e,t,i),i},Fz=(s,t)=>{const e=s.getParsedPathShape(),i=B0(e);if(!i.length||t<0)return[];const n=i.length;if(i.length>=t){const l=[],h=Math.floor(i.length/t);for(let d=0;d<t;d++){const u=i.slice(d*h,d===t-1?n:(d+1)*h);l.push({path:Cz(u)})}return l}const r=[],a=Math.floor(t/n);let o=t;for(let l=0;l<n;l++){const h=[];for(let d=2,u=i[l].length;d<u;d+=2)h.push({x:i[0][d],y:i[0][d+1]});iu(h,l===n-1?o:a,r),o-=a}return r};var Xi;(function(s){s[s.Color255=0]="Color255",s[s.Color1=1]="Color1"})(Xi||(Xi={}));class we{static Get(t,e=Xi.Color1,i=[0,0,0,1]){if(e===Xi.Color1){const a=we.store1[t];if(a)return i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],i;const o=Ue.parseColorString(t);if(o){const l=[o.r/255,o.g/255,o.b/255,o.opacity];we.store1[t]=l,we.store255[t]=[o.r,o.g,o.b,o.opacity],i[0]=l[0],i[1]=l[1],i[2]=l[2],i[3]=l[3]}return i}const n=we.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const r=Ue.parseColorString(t);return r&&(we.store1[t]=[r.r/255,r.g/255,r.b/255,r.opacity],we.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=r.r,i[1]=r.g,i[2]=r.b,i[3]=r.opacity),i}static Set(t,e,i){if(e===Xi.Color1){if(we.store1[t])return;we.store1[t]=i,we.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(we.store255[t])return;we.store255[t]=i,we.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}we.store255={},we.store1={};function qc(s,t=!1){return Array.isArray(s)?t?`rgb(${Math.round(s[0])},${Math.round(s[1])},${Math.round(s[2])},${s[3].toFixed(2)})`:`rgb(${Math.round(s[0])},${Math.round(s[1])},${Math.round(s[2])})`:s}function qa(s,t,e,i,n){if(!s||!t)return s&&qc(s)||t&&qc(t)||!1;let r,a,o=!1,l=!1;if(Array.isArray(s)?r=s:typeof s=="string"?r=we.Get(s,Xi.Color255):o=!0,Array.isArray(t)?a=t:typeof t=="string"?a=we.Get(t,Xi.Color255):l=!0,o!==l){const h=o?s:t,d=o?t:s,u=Object.assign(Object.assign({},h),{stops:h.stops.map(c=>Object.assign(Object.assign({},c),{color:qc(d)}))});return o?qa(h,u,e,i,n):qa(u,h,e,i,n)}if(o){if(s.gradient===t.gradient){const h=s,d=t,u=h.stops,c=d.stops;if(u.length!==c.length)return!1;if(h.gradient==="linear")return jz(h,d,e);if(h.gradient==="radial")return zz(h,d,e);if(h.gradient==="conical")return Hz(h,d,e)}return!1}return n&&n(r,a),qc(Gz(r,a,e),i)}function jz(s,t,e){const i=s.stops,n=t.stops;return{gradient:"linear",x0:s.x0+(t.x0-s.x0)*e,x1:s.x1+(t.x1-s.x1)*e,y0:s.y0+(t.y0-s.y0)*e,y1:s.y1+(t.y1-s.y1)*e,stops:new Array(i.length).fill(0).map((r,a)=>({color:Zb(i[a].color,n[a].color,e),offset:i[a].offset+(n[a].offset-i[a].offset)*e}))}}function zz(s,t,e){const i=s.stops,n=t.stops;return{gradient:"radial",x0:s.x0+(t.x0-s.x0)*e,x1:s.x1+(t.x1-s.x1)*e,y0:s.y0+(t.y0-s.y0)*e,y1:s.y1+(t.y1-s.y1)*e,r0:s.r0+(t.r0-s.r0)*e,r1:s.r1+(t.r1-s.r1)*e,stops:new Array(i.length).fill(0).map((r,a)=>({color:Zb(i[a].color,n[a].color,e),offset:i[a].offset+(n[a].offset-i[a].offset)*e}))}}function Hz(s,t,e){const i=s.stops,n=t.stops;return{gradient:"conical",startAngle:s.startAngle+(t.startAngle-s.startAngle)*e,endAngle:s.endAngle+(t.endAngle-s.endAngle)*e,x:s.x+(t.x-s.x)*e,y:s.y+(t.y-s.y)*e,stops:new Array(i.length).fill(0).map((r,a)=>({color:Zb(i[a].color,n[a].color,e),offset:i[a].offset+(n[a].offset-i[a].offset)*e}))}}function Gz(s,t,e){return[s[0]+(t[0]-s[0])*e,s[1]+(t[1]-s[1])*e,s[2]+(t[2]-s[2])*e,s[3]+(t[3]-s[3])*e]}const Jn=[0,0,0,0],Gh=[0,0,0,0];function Zb(s,t,e){return we.Get(s,Xi.Color255,Jn),we.Get(t,Xi.Color255,Gh),`rgba(${Math.round(Jn[0]+(Gh[0]-Jn[0])*e)},${Math.round(Jn[1]+(Gh[1]-Jn[1])*e)},${Math.round(Jn[2]+(Gh[2]-Jn[2])*e)},${Jn[3]+(Gh[3]-Jn[3])*e})`}const DE=(s,t,e)=>{s.forEach(i=>{if(Number.isFinite(i.to))t[i.key]=i.from+(i.to-i.from)*e;else if(i.key==="fill"||i.key==="stroke"){const n=qa(i.from,i.to,e,!1);n&&(t[i.key]=n)}})},LE=(s,t,e)=>{const i=[],n=[];t.clear();for(let r=0;r<s.length;r++){const a=s[r],o=a.from,l=a.to,h=a.rotation*e,d=a.fromCp,u=a.toCp,c=Math.sin(h),p=Math.cos(h);n[0]=d[0]+(u[0]-d[0])*e,n[1]=d[1]+(u[1]-d[1])*e;for(let _=0;_<o.length;_+=2){const m=o[_],v=o[_+1],y=m*(1-e)+l[_]*e,b=v*(1-e)+l[_+1]*e;i[_]=y*p-b*c+n[0],i[_+1]=y*c+b*p+n[1]}let g=i[0],f=i[1];t.moveTo(g,f);for(let _=2;_<o.length;_+=6){const m=i[_],v=i[_+1],y=i[_+2],b=i[_+3],x=i[_+4],S=i[_+5];g===m&&f===v&&y===x&&b===S?t.lineTo(x,S):t.bezierCurveTo(m,v,y,b,x,S),g=x,f=S}}},BE=(s,t,e)=>{const i=s?B0(s):[],n=B0(t);e&&i&&(e.fromTransform&&i1(i,e.fromTransform.clone().getInverse()),i1(i,e.toTransfrom));const[r,a]=Mz(i,n);return s?Tz(r,a,10,Math.PI):a.map((o,l)=>({from:r[l],to:o,fromCp:[0,0],toCp:[0,0],rotation:0}))},Wz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],IE=(s,t)=>{if(!s||!t)return null;const e=[];let i=!1;return Object.keys(s).forEach(n=>{if(!Wz.includes(n))return;const r=t[n];C(r)||C(s[n])||r===s[n]||(n==="fill"||n==="stroke"?e.push({from:typeof s[n]=="string"?we.Get(s[n],Xi.Color255):s[n],to:typeof r=="string"?we.Get(r,Xi.Color255):r,key:n}):e.push({from:s[n],to:r,key:n}),i=!0)}),i?e:null};class FE extends os{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,r=typeof n.pathProxy=="function"?n.pathProxy(n.attribute):n.pathProxy;LE(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&DE(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const jE=(s,t,e,i)=>{var n,r,a;if(s&&(!s.valid||!s.toCustomPath))return __DEV__&&console.error(s," is not validate"),null;if(!t.valid||!t.toCustomPath)return __DEV__&&console.error(t," is not validate"),null;let o=s==null?void 0:s.globalTransMatrix;i&&o&&(o=i.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=BE((n=s==null?void 0:s.toCustomPath)===null||n===void 0?void 0:n.call(s),t.toCustomPath(),{fromTransform:o,toTransfrom:t.globalTransMatrix}),h=IE(s==null?void 0:s.attribute,t.attribute),d=t.animate(e);return e!=null&&e.delay&&d.wait(e.delay),d.play(new FE({morphingData:l,otherAttrs:h},(r=e==null?void 0:e.duration)!==null&&r!==void 0?r:Xo.duration,(a=e==null?void 0:e.easing)!==null&&a!==void 0?a:Xo.easing)),d},Nz=(s,t,e)=>{var i;const n=t.filter(h=>h&&h.toCustomPath&&h.valid);n.length||__DEV__&&console.error(n," is not validate"),s.valid&&s.toCustomPath||__DEV__&&console.error(s," is not validate");const r=((e==null?void 0:e.splitPath)==="clone"?HE:(i=e==null?void 0:e.splitPath)!==null&&i!==void 0?i:GE)(s,n.length,!1),a=e==null?void 0:e.onEnd;let o=n.length;const l=()=>{o--,o===0&&a&&a()};n.forEach((h,d)=>{var u;const c=r[d],p=((u=e==null?void 0:e.delay)!==null&&u!==void 0?u:0)+(e!=null&&e.individualDelay?e.individualDelay(d,n.length,c,h):0);jE(c,h,Object.assign({},e,{onEnd:l,delay:p}),s.globalTransMatrix)})};class Vz extends os{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren(t=>{t.createPathProxy()}),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren(t=>{t.pathProxy=null})}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren((n,r)=>{var a;LE(this.morphingData[r],typeof n.pathProxy=="function"?n.pathProxy(n.attribute):n.pathProxy,e),!((a=this.otherAttrs)===null||a===void 0)&&a[r]&&this.otherAttrs[r].length&&DE(this.otherAttrs[r],n.attribute,e)}),t&&(this.clearPathProxy(),this.morphingData=null)}}const Jb=s=>{const t={};return Object.keys(s).forEach(e=>{mz(e)||(t[e]=s[e])}),t},zE=(s,t,e)=>{const i=Jb(s.attribute),n=s.attachShadow();if(t.length)n.setTheme({[t[0].type]:i}),t.forEach(r=>{n.appendChild(r)});else{const r=s.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:i}),new Array(e).fill(0).forEach(l=>{const h=tt.graphicService.creator.rect({x:0,y:0,width:a,height:o});n.appendChild(h),t.push(h)})}},HE=(s,t,e)=>{const i=[],n=e?null:Jb(s.attribute),r=s.toCustomPath();for(let a=0;a<t;a++){const o={path:new Je().fromCustomPath2D(r)};i.push(tt.graphicService.creator.path(e?o:Object.assign({},n,o)))}return e&&zE(s,i,t),i},GE=(s,t,e)=>{const i=[],n=e?null:Jb(s.attribute);if(s.type==="rect")Pz(s,t).forEach(r=>{i.push(tt.graphicService.creator.rect(e?r:Object.assign({},n,r)))});else if(s.type==="arc")Ez(s,t).forEach(r=>{i.push(tt.graphicService.creator.arc(e?r:Object.assign({},n,r)))});else if(s.type==="circle")Rz(s,t).forEach(r=>{i.push(tt.graphicService.creator.arc(e?r:Object.assign({},n,r)))});else if(s.type==="line"){const r=Dz(s,t),a={size:10,symbolType:"circle"};r.forEach(o=>{i.push(tt.graphicService.creator.symbol(e?Object.assign({},o,a):Object.assign({},n,o,a)))})}else s.type==="polygon"?Iz(s,t).forEach(r=>{i.push(tt.graphicService.creator.polygon(e?r:Object.assign({},n,r)))}):s.type==="area"?Oz(s,t).forEach(r=>{i.push(tt.graphicService.creator.polygon(e?r:Object.assign({},n,r)))}):s.type==="path"&&Fz(s,t).forEach(r=>{"path"in r?i.push(tt.graphicService.creator.path(e?r:Object.assign({},n,r))):i.push(tt.graphicService.creator.polygon(e?r:Object.assign({},n,r)))});return e&&zE(s,i,t),i},Uz=(s,t,e)=>{var i,n,r;const a=s.filter(u=>u.toCustomPath&&u.valid);a.length||__DEV__&&console.error(s," is not validate"),t.valid&&t.toCustomPath||__DEV__&&console.error(t," is not validate");const o=((e==null?void 0:e.splitPath)==="clone"?HE:(i=e==null?void 0:e.splitPath)!==null&&i!==void 0?i:GE)(t,a.length,!0),l=t.attribute;t.setAttribute("visible",!1);const h=a.map((u,c)=>BE(u.toCustomPath(),o[c].toCustomPath(),{fromTransform:u.globalTransMatrix,toTransfrom:o[c].globalTransMatrix})),d=a.map((u,c)=>IE(u.attribute,l));if(e!=null&&e.individualDelay){const u=e.onEnd;let c=a.length;const p=()=>{c--,c===0&&(t.setAttributes({visible:!0,ratio:null},!1,{type:Pe.ANIMATE_END}),t.detachShadow(),u&&u())};o.forEach((g,f)=>{var _,m,v;const y=((_=e.delay)!==null&&_!==void 0?_:0)+e.individualDelay(f,a.length,s[f],g),b=g.animate(Object.assign({},e,{onEnd:p}));b.wait(y),b.play(new FE({morphingData:h[f],saveOnEnd:!0,otherAttrs:d[f]},(m=e.duration)!==null&&m!==void 0?m:Xo.duration,(v=e.easing)!==null&&v!==void 0?v:Xo.easing))})}else{const u=e==null?void 0:e.onEnd,c=e?Object.assign({},e):{};c.onEnd=()=>{t.setAttribute("visible",!0,!1,{type:Pe.ANIMATE_END}),t.detachShadow(),u&&u()};const p=t.animate(c);e!=null&&e.delay&&p.wait(e.delay),p.play(new Vz({morphingData:h,otherAttrs:d},(n=e==null?void 0:e.duration)!==null&&n!==void 0?n:Xo.duration,(r=e==null?void 0:e.easing)!==null&&r!==void 0?r:Xo.easing))}};class On{static GetImage(t,e){var i;let n=On.cache.get(t);n?n.loadState==="fail"?tt.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):n.loadState==="init"||n.loadState==="loading"?(i=n.waitingMark)===null||i===void 0||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},On.cache.set(t,n),n.dataPromise=tt.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then(r=>{var a;n.loadState=r!=null&&r.data?"success":"fail",n.data=r==null?void 0:r.data,(a=n.waitingMark)===null||a===void 0||a.map((o,l)=>{r!=null&&r.data?(n.loadState="success",n.data=r.data,o.imageLoadSuccess(t,r.data)):(n.loadState="fail",o.imageLoadFail(t))})})):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=On.cache.get(t);n?n.loadState==="fail"?tt.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):n.loadState==="init"||n.loadState==="loading"?(i=n.waitingMark)===null||i===void 0||i.push(e):e&&tt.global.getRequestAnimationFrame()(()=>{e.imageLoadSuccess(t,n.data)}):(n={type:"image",loadState:"init"},On.cache.set(t,n),n.dataPromise=tt.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then(r=>{var a;n.loadState=r!=null&&r.data?"success":"fail",n.data=r==null?void 0:r.data,(a=n.waitingMark)===null||a===void 0||a.map((o,l)=>{r!=null&&r.data?(n.loadState="success",n.data=r.data,o.imageLoadSuccess(t,r.data)):(n.loadState="fail",o.imageLoadFail(t))})})):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=On.cache.get(t);return i?i.loadState==="init"||i.loadState==="fail"?Promise.reject():i.loadState==="loading"?i.dataPromise.then(n=>n.data):Promise.resolve(i.data):(i={type:e,loadState:"init"},On.cache.set(t,i),e==="arrayBuffer"?i.dataPromise=tt.global.loadArrayBuffer(t):e==="blob"?i.dataPromise=tt.global.loadBlob(t):e==="json"&&(i.dataPromise=tt.global.loadJson(t)),i.dataPromise.then(n=>n.data))}}On.cache=new Map;const $z=new ze,r1=new Me,Ps=["lineWidth","scaleX","scaleY","angle","anchor","visible"],a1=["x","y"],o1=["scaleX","scaleY"],l1=["angle"],Wh=new De,Oi={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Ki extends lz{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(Ki.prototype,n,Object.getOwnPropertyDescriptor(t,n))}}get AABBBounds(){return this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise")}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}constructor(t={}){var e;super(),this._AABBBounds=new Me,this._updateTag=ue.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage((e=t.background.background)!==null&&e!==void 0?e:t.background,!0)}setMode(t){t==="3d"?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var i,n;const{dx:r=t.dx,dy:a=t.dy}=this.attribute;if(e&&this.parent){const o=this.parent.attribute;Wh.x=r+((i=o.scrollX)!==null&&i!==void 0?i:0),Wh.y=a+((n=o.scrollY)!==null&&n!==void 0?n:0)}else Wh.x=r,Wh.y=a;return Wh}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;tt.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.addUpdateLayoutTag(),tt.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const e=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new ze),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ue.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ue.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ue.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ue.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ue.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite(((t=i.x)!==null&&t!==void 0?t:0)+((e=i.y)!==null&&e!==void 0?e:0))}_validNumber(t){return t==null||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&ue.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ue.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===Qd.GLOBAL){const r=new De(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(r,r),t=r.x,e=r.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t,e=!1,i){(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t,e=!1,i){const n=Object.keys(t);for(let r=0;r<n.length;r++){const a=n[r];this.attribute[a]=t[a]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(n)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,n){var r;const a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);a?this._setAttributes(a,i,n):C((r=this.normalAttrs)===null||r===void 0?void 0:r[t])?(this.attribute[t]=e,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n)):this.normalAttrs[t]=e,t==="background"&&this.loadImage(e,!0)}needUpdateTags(t,e=Ps){for(let i=0;i<e.length;i++){const n=e[i];if(t.indexOf(n)!==-1)return!0}return!1}needUpdateTag(t,e=Ps){for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:Pe.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background&&this.loadImage(t.background,!0),this._updateTag=ue.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,n;if(t===0&&e===0)return this;const r={type:Pe.TRANSLATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,a1,r);a&&(t=a.x,e=a.y,delete a.x,delete a.y,this._setAttributes(a));const o=this.attribute,l=o.postMatrix;return l?tt.transformUtil.fromMatrix(l,l).translate(t,e):(o.x=((i=o.x)!==null&&i!==void 0?i:oi.x)+t,o.y=((n=o.y)!==null&&n!==void 0?n:oi.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}translateTo(t,e){const i=this.attribute;if(i.x===t&&i.y===e)return this;const n={type:Pe.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,a1,n);return r?(this._setAttributes(r,!1,n),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}scale(t,e,i){var n,r;if(t===1&&e===1)return this;const a={type:Pe.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,o1,a);o&&(t=o.scaleX,e=o.scaleY,delete o.scaleX,delete o.scaleY,this._setAttributes(o));const l=this.attribute;if(i){let{postMatrix:h}=this.attribute;h||(h=new ze,l.postMatrix=h),tt.transformUtil.fromMatrix(h,h).scale(t,e,i)}else l.scaleX=((n=l.scaleX)!==null&&n!==void 0?n:oi.scaleX)*t,l.scaleY=((r=l.scaleY)!==null&&r!==void 0?r:oi.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(a),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const n={type:Pe.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,o1,n);return r?(this._setAttributes(r,!1,n),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}rotate(t,e){var i;if(t===0)return this;const n={type:Pe.ROTATE},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,l1,n);r&&(delete r.angle,this._setAttributes(r,!1,n));const a=this.attribute;if(e){let{postMatrix:o}=this.attribute;o||(o=new ze,a.postMatrix=o),tt.transformUtil.fromMatrix(o,o).rotate(t,e)}else a.angle=((i=a.angle)!==null&&i!==void 0?i:oi.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:Pe.ROTATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,l1,i);return n?(this._setAttributes(n,!1,i),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}skewTo(t,e){return this}animate(t){this.animates||(this.animates=new Map);const e=new dg(t==null?void 0:t.id).bind(this);if(t){const{onStart:i,onFrame:n,onEnd:r,onRemove:a}=t;i!=null&&e.onStart(i),n!=null&&e.onFrame(n),r!=null&&e.onEnd(r),a!=null&&e.onRemove(a),e.interpolateFunc=t.interpolate}return this.animates.set(e.id,e),e.onRemove(()=>{this.animates.delete(e.id)}),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(tt.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!C(t)||this.currentStates.includes(t))}getState(t){var e;return(e=this.states)===null||e===void 0?void 0:e[t]}applyStateAttrs(t,e,i,n){var r,a,o,l;if(i){const h=Object.keys(t),d=this.getNoWorkAnimateAttr(),u={};let c;n?h.forEach(g=>{d[g]?(c||(c={}),c[g]=t[g]):u[g]=t[g]===void 0?this.getDefaultAttribute(g):t[g]}):h.forEach(g=>{d[g]?(c||(c={}),c[g]=t[g]):u[g]=t[g]});const p=this.animate();p.stateNames=e,p.to(u,(a=(r=this.stateAnimateConfig)===null||r===void 0?void 0:r.duration)!==null&&a!==void 0?a:XA.duration,(l=(o=this.stateAnimateConfig)===null||o===void 0?void 0:o.easing)!==null&&l!==void 0?l:XA.easing),c&&this.setAttributes(c,!1,{type:Pe.STATE})}else this.setAttributes(t,!1,{type:Pe.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach(i=>{i in this.normalAttrs?(e[i]=this.normalAttrs[i],delete this.normalAttrs[i]):e[i]=this.getNormalAttribute(i)}),Object.keys(this.normalAttrs).forEach(i=>{t[i]=this.normalAttrs[i]})):Object.keys(t).forEach(i=>{e[i]=this.getNormalAttribute(i)}),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach(i=>{if(i.stateNames){const n=i.getEndProps();Gs(n,t)&&(e=n[t])}}),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter(n=>n!==t);this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||this.currentStates.length===1))return;const r=e&&(!((n=this.currentStates)===null||n===void 0)&&n.length)?this.currentStates.concat([t]):[t];this.useStates(r,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if(!(((i=this.currentStates)===null||i===void 0?void 0:i.length)!==t.length||t.some((r,a)=>this.currentStates[a]!==r)))return;const n={};t.forEach(r=>{var a;const o=this.stateProxy?this.stateProxy(r,t):(a=this.states)===null||a===void 0?void 0:a[r];o&&Object.assign(n,o)}),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=ue.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ue.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ue.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ue.UPDATE_SHAPE_AND_BOUNDS)===ue.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ue.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ue.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ue.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ue.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ue.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ue.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ue.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ue.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],n=()=>{if(e.b)return e.b;const{scaleX:r,scaleY:a,angle:o}=this.attribute;return r1.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(r1),this.setAttributes({scaleX:r,scaleY:a,angle:o}),e.b};if(typeof t[0]=="string"){const r=parseFloat(t[0])/100,a=n();i[0]=a.x1+(a.x2-a.x1)*r}else i[0]=t[0];if(typeof t[1]=="string"){const r=parseFloat(t[1])/100,a=n();i[1]=a.y1+(a.y2-a.y1)*r}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=oi.x,y:e=oi.y,scaleX:i=oi.scaleX,scaleY:n=oi.scaleY,angle:r=oi.angle,scaleCenter:a,anchor:o,postMatrix:l}=this.attribute;let h=[0,0];const d={};if(o&&(h=this.getAnchor(o,d)),!a||i===1&&n===1)nF(this._transMatrix,this._transMatrix.reset(),t,e,i,n,r,o&&h);else{const c=this._transMatrix;c.reset(),c.translate(h[0],h[1]),c.rotate(r),c.translate(-h[0],-h[1]),c.translate(t,e),h=this.getAnchor(a,d),tt.transformUtil.fromMatrix(c,c).scale(i,n,{x:h[0],y:h[1]})}const u=this.getOffsetXY(oi);if(this._transMatrix.e+=u.x,this._transMatrix.f+=u.y,l){const c=$z.setValue(l.a,l.b,l.c,l.d,l.e,l.f),p=this._transMatrix;c.multiply(p.a,p.b,p.c,p.d,p.e,p.f),p.setValue(c.a,c.b,c.c,c.d,c.e,c.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const i=t.getTimeline();this.animates.forEach(n=>{n.setTimeline(i)})}this._onSetStage&&this._onSetStage(this,t,e),tt.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Pe.ANIMATE_END})}onStep(t,e,i,n,r){const a={};if(i.customAnimate)i.customAnimate.update(r,n,a);else{const o=i.props,l=i.parsedProps,h=i.propKeys;this.stepInterpolate(t,e,a,i,n,r,o,void 0,l,h)}this.setAttributes(a,!1,{type:Pe.ANIMATE_UPDATE,animationState:{ratio:n,end:r,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,r,a,o,l,h,d){d||(d=Object.keys(o),n.propKeys=d),a?n.propKeys.forEach(u=>{e.validAttr(u)&&(i[u]=o[u])}):d.forEach(u=>{var c;if(!e.validAttr(u))return;const p=o[u],g=(c=l&&l[u])!==null&&c!==void 0?c:t.getLastPropByName(u,n);if(p==null||g==null)return void(i[u]=p);let f;f=e.interpolateFunc&&e.interpolateFunc(u,r,g,p,i),f||(f=e.customInterpolate(u,r,g,p,this,i),f||this.defaultInterpolate(p,g,u,i,h,r)||this._interpolate(u,r,g,p,i))}),n.parsedProps=h}defaultInterpolate(t,e,i,n,r,a){if(Number.isFinite(t))return n[i]=e+(t-e)*a,!0;if(i==="fill"){r||(r={});const o=r.fillColorArray,l=qa(e,o??t,a,!1,(h,d)=>{r.fillColorArray=d});return l&&(n[i]=l),!0}if(i==="stroke"){r||(r={});const o=r.strokeColorArray,l=qa(e,o??t,a,!1,(h,d)=>{r.strokeColorArray=d});return l&&(n[i]=l),!0}if(i==="shadowColor"){r||(r={});const o=r.shadowColorArray,l=qa(e,o??t,a,!0,(h,d)=>{r.shadowColorArray=d});return l&&(n[i]=l),!0}return!1}_interpolate(t,e,i,n,r){}getDefaultAttribute(t){return rt(this)[this.type][t]}getComputedAttribute(t){var e;return(e=this.attribute[t])!==null&&e!==void 0?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=t??tt.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map(t=>t.toJson())}}createPathProxy(t){return ot(t,!0)?this.pathProxy=new Je().fromString(t):this.pathProxy=new Je,this.pathProxy}loadImage(t,e=!1){if(!t||e&&Yz(t))return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),typeof t=="string"?(n.state="loading",t.startsWith("<svg")?(On.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(XC(t)||t.includes("/")||KC(t))&&(On.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):(n.state="success",n.data=t,this.backgroundImg=this.backgroundImg||e)}imageLoadSuccess(t,e,i){if(!this.resources)return;const n=this.resources.get(t);n&&(n.state="success",n.data=e,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="fail",e&&e())}_stopAnimates(t){t&&t.forEach(e=>{e.stop()})}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren(e=>{e.stopAnimates(t)})}release(){this.releaseStatus="released",tt.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const r=new Xb(t,e);r.bubbles=!1,r.manager=(n=(i=this.stage)===null||i===void 0?void 0:i.eventSystem)===null||n===void 0?void 0:n.manager,this.dispatchEvent(r)}}}function Yz(s){return!(!s.fill&&!s.stroke)}Ki.mixin(dz);function Xz(s,t){const e=[];let i=t.exec(s);for(;i;){const n=[];n.startIndex=t.lastIndex-i[0].length;const r=i.length;for(let a=0;a<r;a++)n.push(i[a]);e.push(n),i=t.exec(s)}return e}class ov{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function h1(s,t,e,i){const n=s.indexOf(t,e);if(n===-1)throw new Error(i);return n+t.length-1}function Kz(s,t,e=">"){let i,n="";for(let r=t;r<s.length;r++){let a=s[r];if(i)a===i&&(i="");else if(a==='"'||a==="'")i=a;else if(a===e[0]){if(!e[1])return{data:n,index:r};if(s[r+1]===e[1])return{data:n,index:r}}else a===" "&&(a=" ");n+=a}}function d1(s,t,e,i=">"){const n=Kz(s,t+1,i);if(!n)return;let r=n.data;const a=n.index,o=r.search(/\s/);let l=r,h=!0;return o!==-1&&(l=r.substr(0,o).replace(/\s\s*$/,""),r=r.substr(o+1)),{tagName:l,tagExp:r,closeIndex:a,attrExpPresent:h,rawTagName:l}}const qz=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");class Zz{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;typeof n=="string"&&(e.tagname=n),t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const r=Xz(t,qz),a=r.length;for(let o=0;o<a;o++){const l=r[o][1],h=r[o][4],d=l;l&&(n[d]=h===void 0||(isNaN(h)?h:Number(h)))}return n}parseXml(t){t=t.replace(/\r\n?/g,`
- `);const e=new ov("!xml");let i=e,n="",r="";for(let a=0;a<t.length;a++)if(t[a]==="<")if(t[a+1]==="/"){const o=h1(t,">",a,"Closing Tag is not closed."),l=r.lastIndexOf(".");r=r.substring(0,l),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",a=o}else if(t[a+1]==="?")a=d1(t,a,!1,"?>").closeIndex+1;else if(t.substr(a+1,3)==="!--")a=h1(t,"-->",a+4,"Comment is not closed.");else{const o=d1(t,a);let l=o.tagName,h=o.tagExp;const d=o.attrExpPresent,u=o.closeIndex;if(l!==e.tagname&&(r+=r?"."+l:l),h.length>0&&h.lastIndexOf("/")===h.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),h=l):h=h.substr(0,h.length-1);const c=new ov(l);l!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,l)),this.addChild(i,c,r),r=r.substr(0,r.lastIndexOf("."))}else{const c=new ov(l);this.tagsNodeStack.push(i),l!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,l)),this.addChild(i,c,r),i=c}n="",a=u}else n+=t[a];return e.child}}function Jz(s,t){return WE(s)}function WE(s,t){const e={};for(let i=0;i<s.length;i++){const n=s[i],r=Qz(n);if(r!==void 0&&n[r]){const a=WE(n[r]);eH(a),n[":@"]&&tH(a,n[":@"]),e[r]!==void 0&&e.hasOwnProperty(r)?(Array.isArray(e[r])||(e[r]=[e[r]]),e[r].push(a)):e[r]=a}}return e}function Qz(s){const t=Object.keys(s);for(let e=0;e<t.length;e++){const i=t[e];if(i!==":@")return i}}function tH(s,t,e){if(t){const i=Object.keys(t),n=i.length;for(let r=0;r<n;r++){const a=i[r];s[a]=t[a]}}}function eH(s){return Object.keys(s).length===0}class M_{constructor(t){this.options=Object.assign({},M_.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;const e=new Zz(this.options).parseXml(t);return Jz(e,this.options)}}M_.defaultOptions={};function iH(s){return s.startsWith("<svg")||s.startsWith("<?xml")}var sH=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};function nH(s){return sH(this,void 0,void 0,function*(){const t=[],e=s.getChildren();yield new Promise(i=>{tt.global.getRequestAnimationFrame()(()=>{i(null)})}),e.forEach(i=>{i.subLayers.size&&i.subLayers.forEach(n=>{n.drawContribution&&n.drawContribution.hooks&&n.drawContribution.rendering&&t.push(new Promise(r=>{n.drawContribution.hooks.completeDraw.tap("outWait",()=>{n.drawContribution.hooks.completeDraw.taps=n.drawContribution.hooks.completeDraw.taps.filter(a=>a.name!=="outWait"),r(null)})}))})}),yield Promise.all(t)})}function Ep(s,t,e,i=0){return s.expand(t+(i/2+(e?rH(e,t):0))),s}function rH(s,t){return s?t:0}let aH=0;function qi(){return aH++}var Za;(function(s){s[s.HORIZONTAL=0]="HORIZONTAL",s[s.VERTICAL=1]="VERTICAL"})(Za||(Za={}));function u1(s){const t=[];let e=0,i="";for(let n=0;n<s.length;n++)hH(s[n])?e?i+=s[n]:(e=1,i=s[n]):(e&&(t.push({text:i,direction:Za.VERTICAL}),i="",e=0),t.push({text:s[n],direction:Za.HORIZONTAL}));return i&&t.push({text:i,direction:Za.VERTICAL}),t}const oH=["…","(",")","—","【","】","「","」","《","》"],NE=new Map;oH.forEach(s=>NE.set(s,!0));const lH=[""],VE=new Map;function hH(s){if(NE.has(s))return!0;if(VE.has(s))return!1;let t=!1;return s.codePointAt(0)<256&&(t=!0),t}lH.forEach(s=>VE.set(s,!0));const C_=qi(),nc=qi(),rc=qi(),P_=qi(),E_=qi(),Qb=qi(),R_=qi(),ac=qi(),O_=qi(),D_=qi(),tx=qi(),L_=qi(),ex=qi(),ix=qi(),B_=qi(),I_=qi(),UE=Symbol.for("GraphicService"),$E=Symbol.for("GraphicCreator"),YE={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},dH=Object.keys(YE);var c1;(function(s){s[s.LESS_GROUP=0]="LESS_GROUP",s[s.MORE_GROUP=1]="MORE_GROUP"})(c1||(c1={}));let Mh=class F0 extends Ki{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Qb,this._childUpdateTag=ue.UPDATE_BOUNDS}setMode(t){t==="3d"?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new eu),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new eu)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren(t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)})}showAll(){this.setAttribute("visible",!0),this.forEachChildren(t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)})}containsPoint(t,e,i){if(i===Qd.GLOBAL){const n=new De(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(n,n),this.AABBBounds.contains(n.x,n.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&ue.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;tt.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),tt.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=oi.x,y:e=oi.y,dx:i=oi.dx,dy:n=oi.dy,scaleX:r=oi.scaleX,scaleY:a=oi.scaleY,angle:o=oi.angle,postMatrix:l}=this.attribute;if(t!==0||e!==0||i!==0||n!==0||r!==1||a!==1||o!==0||l)return super.doUpdateLocalMatrix();this._transMatrix.reset()}doUpdateAABBBounds(){const t=this.attribute,e=rt(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=tt.graphicService.updateGroupAABBBounds(t,e,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,r=bi(n);return r&&i.expand(r),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=ue.CLEAR_BOUNDS,this._childUpdateTag&=ue.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=ue.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ue.UPDATE_BOUNDS||(this._childUpdateTag|=ue.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),tt.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),tt.graphicService.onClearIncremental(this,this.stage)}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,tt.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren(t=>{tt.graphicService.onRemove(t)}),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),tt.graphicService.onSetStage(this,t),this.forEachChildren(i=>{i.setStage(t,this.layer)}))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const e=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ue.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find(i=>i.name===t,e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=tt.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new F0(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return F0.NOWORK_ANIMATE_ATTR}};Mh.NOWORK_ANIMATE_ATTR=Oi;function sx(s){return new Mh(s)}class uH extends Mh{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:(r=n.zIndex)!==null&&r!==void 0?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new eu,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort((i,n)=>i.zIndex-n.zIndex);this.layerHandler.merge(e.map(i=>(i.layer.subLayers.size&&i.layer.combineSubLayer(t),i.layer.getNativeHandler()))),t&&e.forEach(i=>{i.group&&(i.group.incremental=0)}),e.forEach(i=>{tt.layerService.releaseLayer(this.stage,i.layer)}),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach(i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)})}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:(i=t.background)!==null&&i!==void 0?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach(r=>r(this)),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i,n,r;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:(i=e.background)!==null&&i!==void 0?i:this.background,renderService:e.renderService,x:(n=e.x)!==null&&n!==void 0?n:this.stage.x,y:(r=e.y)!==null&&r!==void 0?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach(a=>a(this)))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach(t=>{tt.layerService.releaseLayer(this.stage,t.layer)})}drawTo(t,e){var i,n,r;this.layerHandler.drawTo(t,[this],Object.assign({background:(i=e.background)!==null&&i!==void 0?i:this.background,renderService:e.renderService,x:(n=e.x)!==null&&n!==void 0?n:this.stage.x,y:(r=e.y)!==null&&r!==void 0?r:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach(a=>a(this))}}const XE=Symbol.for("TransformUtil"),KE=Symbol.for("GraphicUtil"),nx=Symbol.for("LayerService"),qE=Symbol.for("StaticLayerHandlerContribution"),ZE=Symbol.for("DynamicLayerHandlerContribution"),JE=Symbol.for("VirtualLayerHandlerContribution");var hd,cH=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},pH=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let dd=hd=class{static GenerateLayerId(){return`${hd.idprefix}_${hd.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=tt.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(s){return this.layerMap.get(s)}getRecommendedLayerType(s){return s||(this.staticLayerCountInEnv!==0?"static":this.dynamicLayerCountInEnv!==0?"dynamic":"virtual")}getLayerHandler(s){let t;return t=s==="static"?Ct.get(qE):s==="dynamic"?Ct.get(ZE):Ct.get(JE),t}createLayer(s,t={main:!1}){var e;this.tryInit();let i=this.getRecommendedLayerType(t.layerMode);i=t.main||t.canvasId?"static":i;const n=this.getLayerHandler(i),r=new uH(s,this.global,s.window,Object.assign(Object.assign({main:!1},t),{layerMode:i,canvasId:(e=t.canvasId)!==null&&e!==void 0?e:hd.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(s)||[];return a.push(r),this.layerMap.set(s,a),this.staticLayerCountInEnv--,r}prepareStageLayer(s){let t;s.forEachChildren(e=>{const i=e.getNativeHandler();i.type==="virtual"?(i.mainHandler=t,t.secondaryHandlers.push(i)):(t=i,t.secondaryHandlers=[])})}releaseLayer(s,t){t.release();const e=this.layerMap.get(s)||[];this.layerMap.set(s,e.filter(i=>i!==t))}layerCount(s){return(this.layerMap.get(s)||[]).length}restLayerCount(s){return this.global.env==="browser"?10:0}};dd.idprefix="visactor_layer",dd.prefix_count=0,dd=hd=cH([ct(),pH("design:paramtypes",[])],dd);const gH=new Pt(s=>{s(Vb).to(S0).inSingletonScope(),s(ag).to(R0),s(KE).to(O0).inSingletonScope(),s(XE).to(D0).inSingletonScope(),s(nx).to(dd).inSingletonScope()});function yo(s,t){return!(!s&&!t)}function Ch(s,t){let e;return e=U(s)?s.some(i=>i||i===void 0):!!s,e&&t>0}function ao(s,t,e){return e&&s*t>0}function rx(s,t,e,i,n){return n&&s*t>0&&e!==0&&i!==0}function ax(s,t){return s*t>0}function ox(s,t,e,i){return s*t>0&&e!==0&&i!==0}function fH(s,t,e,i,n,r,a,o){if(!s.pathProxy)return!1;const l=rt(s,r==null?void 0:r.theme)[s.type],{fill:h=l.fill,stroke:d=l.stroke,opacity:u=l.opacity,fillOpacity:c=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible}=s.attribute,_=ao(u,c,h),m=ax(u,g),v=yo(h),y=Ch(d,p);if(!f||!v&&!y||!(_||m||a||o))return!0;t.beginPath();const b=typeof s.pathProxy=="function"?s.pathProxy(s.attribute):s.pathProxy;return ur(b.commandList,t,e,i),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),y&&m&&(t.setStrokeStyle(s,s.attribute,e,i,l),t.stroke()),v&&_&&(t.setCommonStyle(s,s.attribute,e,i,l),t.fill()),!0}function QE(s,t,e,i,n,r,a,o){const l=e-s,h=i-t,d=a-n,u=o-r;let c=u*l-d*h;return c*c<se?[]:(c=(d*(t-r)-u*(s-n))/c,[s+c*l,t+c*h])}function Xr(s,t,e,i,n,r,a){const o=s-e,l=t-i,h=(a?r:-r)/Math.sqrt(o*o+l*l),d=h*l,u=-h*o,c=s+d,p=t+u,g=e+d,f=i+u,_=(c+g)/2,m=(p+f)/2,v=g-c,y=f-p,b=v*v+y*y,x=n-r,S=c*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-v*A)/b,w=(-S*v-y*A)/b;const T=(S*y+v*A)/b,M=(-S*v+y*A)/b,P=k-_,O=w-m,D=T-_,R=M-m;return P*P+O*O>D*D+R*R&&(k=T,w=M),{cx:k,cy:w,x01:-d,y01:-u,x11:k*(n/x-1),y11:w*(n/x-1)}}function ug(s,t,e,i,n,r,a){const{startAngle:o,endAngle:l}=s.getParsedAngle(),h=Xt(l-o),d=l>o;let u=!1;if(n<r){const c=n;n=r,r=c}if(n<=se)t.moveTo(e,i);else if(h>=It-se)t.moveTo(e+n*oe(o),i+n*ee(o)),t.arc(e,i,n,o,l,!d),r>se&&(t.moveTo(e+r*oe(l),i+r*ee(l)),t.arc(e,i,r,l,o,d));else{const c=s.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:_,innerEndAngle:m,innerStartAngle:v}=s.getParsePadAngle(o,l),y=c,b=c,x=c,S=c,A=Math.max(b,y),k=Math.max(x,S);let w=A,T=k;const M=n*oe(f),P=n*ee(f),O=r*oe(m),D=r*ee(m);let R,L,B,F;if((k>se||A>se)&&(R=n*oe(_),L=n*ee(_),B=r*oe(v),F=r*ee(v),h<ne)){const z=QE(M,P,B,F,R,L,O,D);if(z){const N=M-z[0],V=P-z[1],G=R-z[0],X=L-z[1],Z=1/ee(iP((N*G+V*X)/(rs(N*N+V*V)*rs(G*G+X*X)))/2),et=rs(z[0]*z[0]+z[1]*z[1]);T=vi(k,(r-et)/(Z-1)),w=vi(A,(n-et)/(Z+1))}}if(p<.001)a&&(a[3]||a[1])&&t.moveTo(e+M,i+P),u=!0;else if(w>se){const z=vi(y,w),N=vi(b,w),V=Xr(B,F,M,P,n,z,Number(d)),G=Xr(R,L,O,D,n,N,Number(d));w<A&&z===N?!a||a[0]?(t.moveTo(e+V.cx+V.x01,i+V.cy+V.y01),t.arc(e+V.cx,i+V.cy,w,re(V.y01,V.x01),re(G.y01,G.x01),!d)):t.moveTo(e+V.cx+w*oe(re(G.y01,G.x01)),i+V.cy+w*ee(re(G.y01,G.x01))):!a||a[0]?(t.moveTo(e+V.cx+V.x01,i+V.cy+V.y01),z>0&&t.arc(e+V.cx,i+V.cy,z,re(V.y01,V.x01),re(V.y11,V.x11),!d),t.arc(e,i,n,re(V.cy+V.y11,V.cx+V.x11),re(G.cy+G.y11,G.cx+G.x11),!d),N>0&&t.arc(e+G.cx,i+G.cy,N,re(G.y11,G.x11),re(G.y01,G.x01),!d)):N>0?t.moveTo(e+G.cx+N*oe(re(G.y01,G.x01)),i+G.cy+N*ee(re(G.y01,G.x01))):t.moveTo(e+R,i+n*ee(_))}else!a||a[0]?(t.moveTo(e+M,i+P),t.arc(e,i,n,f,_,!d)):t.moveTo(e+n*oe(_),i+n*ee(_));if(!(r>se)||g<.001)!a||a[1]?t.lineTo(e+O,i+D):t.moveTo(e+O,i+D),u=!0;else if(T>se){const z=vi(S,T),N=vi(x,T),V=Xr(O,D,R,L,r,-N,Number(d)),G=Xr(M,P,B,F,r,-z,Number(d));if(!a||a[1]?t.lineTo(e+V.cx+V.x01,i+V.cy+V.y01):t.moveTo(e+V.cx+V.x01,i+V.cy+V.y01),T<k&&z===N){const X=re(G.y01,G.x01);!a||a[2]?t.arc(e+V.cx,i+V.cy,T,re(V.y01,V.x01),X,!d):t.moveTo(e+V.cx+oe(X),i+V.cy+ee(X))}else!a||a[2]?(N>0&&t.arc(e+V.cx,i+V.cy,N,re(V.y01,V.x01),re(V.y11,V.x11),!d),t.arc(e,i,r,re(V.cy+V.y11,V.cx+V.x11),re(G.cy+G.y11,G.cx+G.x11),d),z>0&&t.arc(e+G.cx,i+G.cy,z,re(G.y11,G.x11),re(G.y01,G.x01),!d)):z>0?t.moveTo(e+G.cx+z*oe(re(G.y01,G.x01)),i+G.cy+z*ee(re(G.y01,G.x01))):t.moveTo(e+B,i+F)}else!a||a[1]?t.lineTo(e+O,i+D):t.moveTo(e+O,i+D),!a||a[2]?t.arc(e,i,r,m,v,d):t.moveTo(e+r*oe(v),i+r*ee(v))}return a?a[3]&&t.lineTo(e+n*oe(o),i+n*ee(o)):t.closePath(),u}class zs{static GetCanvas(){try{return zs.canvas||(zs.canvas=tt.global.createCanvas({})),zs.canvas}catch{return null}}static GetCtx(){if(!zs.ctx){const t=zs.GetCanvas();zs.ctx=t.getContext("2d")}return zs.ctx}}class Ua extends rF{static getInstance(){return Ua._instance||(Ua._instance=new Ua),Ua._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=zs.GetCanvas(),n=zs.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const r=n.createLinearGradient(0,0,e,0);t.forEach(a=>{r.addColorStop(a[0],a[1])}),n.fillStyle=r,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n,r=[],a=100){let o=`${t}${e}${i}${n}`;r.forEach(h=>o+=h.join()),o+=a;let l=this.dataMap.get(o);return l||(l={data:new Ua(r,a),timestamp:[]},this.addLimitedTimestamp(l,Date.now(),{}),this.dataMap.set(o,l)),this.clearCache(this.dataMap,this.cacheParams),l.data}}class ji{static GetSize(t){for(let e=0;e<ji.ImageSize.length;e++)if(ji.ImageSize[e]>=t)return ji.ImageSize[e];return t}static Get(t,e,i,n,r,a,o){const l=ji.GenKey(t,e,i,n,r),h=ji.cache[l];if(!h||h.length===0)return null;for(let d=0;d<h.length;d++)if(h[d].width>=a&&h[d].height>=o)return h[d].pattern;return null}static Set(t,e,i,n,r,a,o,l){const h=ji.GenKey(t,e,i,n,r);ji.cache[h]?ji.cache[h].push({width:o,height:l,pattern:a}):ji.cache[h]=[{width:o,height:l,pattern:a}]}static GenKey(t,e,i,n,r){return`${e},${i},${n},${r},${t.join()}`}}ji.cache={},ji.ImageSize=[20,40,80,160,320,640,1280,2560];function _H(s,t,e,i){const{stops:n,startAngle:r,endAngle:a}=i;for(;e<0;)e+=It;for(;e>It;)e-=It;if(e<r||e>a)return n[0].color;let o,l,h=(e-r)/(a-r);for(let d=0;d<n.length;d++)if(n[d].offset>=h){o=n[d-1],l=n[d];break}return h=(h-o.offset)/(l.offset-o.offset),qa(o.color,l.color,h,!1)}function mH(s,t,e,i,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),d=zs.GetCanvas(),u=zs.GetCtx();if(!u)return null;const c=ji.GetSize(o),p=ji.GetSize(l);let g=ji.Get(t,e,i,r,a,c,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(e,2)+Math.pow(i,2),Math.pow(c-e,2)+Math.pow(i,2)),Math.max(Math.pow(c-e,2)+Math.pow(p-i,2),Math.pow(e,2)+Math.pow(p-i,2)))),_=h+1,m=n/Math.max(1,_-1),v=Ua.getInstance().GetOrCreate(e,i,c,p,t,_),y=2*Math.PI*f/360;d.width=c,d.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,c,p),u.translate(e,i),u.rotate(r);for(let x=0,S=_-1;x<S&&!(r+x*m>a);x++){const A=v.getColor(x);u.beginPath(),u.rotate(m),u.moveTo(0,0),u.lineTo(f,-2*y),u.lineTo(f,0),u.fillStyle=A,u.closePath(),u.fill()}const b=u.getImageData(0,0,c,p);return d.width=b.width,d.height=b.height,u.putImageData(b,0,0),g=s.createPattern(d,"no-repeat"),g&&ji.Set(t,e,i,r,a,g,c,p),g}const j0=Symbol.for("ArcRenderContribution"),z0=Symbol.for("AreaRenderContribution"),H0=Symbol.for("CircleRenderContribution"),tR=Symbol.for("GroupRenderContribution"),G0=Symbol.for("ImageRenderContribution"),W0=Symbol.for("PathRenderContribution"),N0=Symbol.for("PolygonRenderContribution"),ud=Symbol.for("RectRenderContribution"),V0=Symbol.for("SymbolRenderContribution"),U0=Symbol.for("TextRenderContribution"),lx=Symbol.for("InteractiveSubRenderContribution"),p1=["radius","startAngle","endAngle",...Ps];class su extends Ki{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=P_}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=rt(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=tt.graphicService.updateCircleAABBBounds(i,rt(this).circle,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,a=bi(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rt(this).circle[t]}needUpdateTags(t){return super.needUpdateTags(t,p1)}needUpdateTag(t){return super.needUpdateTag(t,p1)}toCustomPath(){var t,e,i;const n=this.attribute,r=(t=n.radius)!==null&&t!==void 0?t:this.getDefaultAttribute("radius"),a=(e=n.startAngle)!==null&&e!==void 0?e:this.getDefaultAttribute("startAngle"),o=(i=n.endAngle)!==null&&i!==void 0?i:this.getDefaultAttribute("endAngle"),l=new Je;return l.arc(0,0,r,a,o),l}clone(){return new su(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return su.NOWORK_ANIMATE_ATTR}}su.NOWORK_ANIMATE_ATTR=Oi;function vH(s){return new su(s)}function $0(s,t={},e){e||(e=1);const{fontStyle:i=t.fontStyle,fontVariant:n=t.fontVariant,fontWeight:r=t.fontWeight,fontSize:a=t.fontSize,fontFamily:o=t.fontFamily}=s;return(i?i+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*e+"px "+(o||"sans-serif")}function rr(s,t){return s==="end"||s==="right"?-t:s==="center"?-t/2:0}function ar(s,t,e,i=0){return s==="middle"?-t/2:s==="top"?0:s==="bottom"?i-t:s&&s!=="alphabetic"?0:(e||(e=t),-(t-e)/2-.79*e)}class Y0{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if(e==="left"||e==="start")t.xOffset=0;else if(e==="center")t.xOffset=t.width/-2;else{if(e!=="right"&&e!=="end")throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset=i==="top"?0:i==="middle"?t.height/-2:i==="alphabetic"?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,r,a,o,l,h){const d=[],u=[e,i],c=[0,0];for(;t.length>0;){const{str:g}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,o,l,h);d.push({str:g,width:this.textMeasure.measureTextWidth(g,this.textOptions)}),t=t.substring(g.length)}n==="left"||n==="start"||(n==="center"?c[0]=u[0]/-2:n!=="right"&&n!=="end"||(c[0]=-u[0])),r==="top"||(r==="middle"?c[1]=u[1]/-2:r==="bottom"&&(c[1]=-u[1]));const p={xOffset:c[0],yOffset:c[1],width:u[0],height:u[1]};return this.layoutWithBBox(p,d,n,r,a)}GetLayoutByLines(t,e,i,n,r="",a,o,l="end"){t=t.map(c=>c.toString());const h=[],d=[0,0];if(typeof o=="number"&&o!==1/0){let c;for(let p=0,g=t.length;p<g;p++)c=Math.min(this.textMeasure.measureTextWidth(t[p],this.textOptions),o),h.push({str:this.textMeasure.clipTextWithSuffix(t[p],this.textOptions,c,r,a,l).str,width:c});d[0]=o}else{let c,p;o=0;for(let g=0,f=t.length;g<f;g++)p=t[g],c=this.textMeasure.measureTextWidth(p,this.textOptions),o=Math.max(o,c),h.push({str:p,width:c});d[0]=o}d[1]=h.length*n,d[0]=h.reduce((c,p)=>Math.max(c,p.width),0);const u={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(u,e,i),this.layoutWithBBox(u,h,e,i,n)}layoutWithBBox(t,e,i,n,r){const a=[0,0],o=e.length*r;n==="top"||(n==="middle"?a[1]=(t.height-o)/2:n==="bottom"&&(a[1]=t.height-o));for(let l=0;l<e.length;l++)this.lineOffset(t,e[l],i,n,r,a);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:r,textAlign:i,textBaseline:n}}lineOffset(t,e,i,n,r,a){return i==="left"||i==="start"?e.leftOffset=0:i==="center"?e.leftOffset=(t.width-e.width)/2:i!=="right"&&i!=="end"||(e.leftOffset=t.width-e.width),e.topOffset=(r-this.textOptions.fontSize)/2+.79*this.textOptions.fontSize+a[1],a[1]+=r,e}}const g1=["text","maxLineWidth","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Ps];let kd=class er extends Ki{get font(){const t=rt(this).text;return this._font||(this._font=$0(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=rt(this).text;if(!this.isSimplify())return;const{maxLineWidth:n=i.maxLineWidth}=e;return Number.isFinite(n)?(this.tryUpdateAABBBounds(),this.cache.clipedText):((t=e.text)!==null&&t!==void 0?t:i.text).toString()}get clipedWidth(){if(this.isSimplify())return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){const t=rt(this).text,e=this.attribute;if(this.isMultiLine)return;const{maxLineWidth:i=t.maxLineWidth}=e;return!!Number.isFinite(i)&&(this.tryUpdateAABBBounds(),e.direction==="vertical"&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map(n=>n.text).join("")!==e.text.toString():this.clipedText!=null&&this.clipedText!==e.text.toString())}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&this.attribute.direction!=="vertical"}get isMultiLine(){return Array.isArray(this.attribute.text)||this.attribute.whiteSpace==="normal"}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=I_,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return U(t)?!t.every(e=>e==null||e===""):t!=null&&t!==""}doUpdateAABBBounds(){const t=rt(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}updateWrapAABBBounds(t){var e,i,n,r;const a=rt(this).text,{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:c,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:_=a.fontWeight,ignoreBuf:m=a.ignoreBuf,suffixPosition:v=a.suffixPosition,heightLimit:y=0,lineClamp:b}=this.attribute,x=(e=In(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))!==null&&e!==void 0?e:this.attribute.fontSize||a.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const R=this.cache.layoutData.bbox;return this._AABBBounds.set(R.xOffset,R.yOffset,R.xOffset+R.width,R.yOffset+R.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=tt.graphicUtil.textMeasure,k=new Y0(o,{fontSize:d,fontWeight:_,fontFamily:o},A),w=U(t)?t.map(R=>R.toString()):[t.toString()],T=[],M=[0,0];let P=1/0;if(y>0&&(P=Math.max(Math.floor(y/x),1)),b&&(P=Math.min(P,b)),typeof c=="number"&&c!==1/0){if(c>0)for(let L=0;L<w.length;L++){const B=w[L];let F=!0;if(L===P-1){const N=k.textMeasure.clipTextWithSuffix(B,k.textOptions,c,u,!1,v);T.push({str:N.str,width:N.width});break}const z=k.textMeasure.clipText(B,k.textOptions,c,f==="break-word");if(B!==""&&z.str===""){if(u){const N=k.textMeasure.clipTextWithSuffix(B,k.textOptions,c,u,!1,v);z.str=(n=N.str)!==null&&n!==void 0?n:"",z.width=(r=N.width)!==null&&r!==void 0?r:0}else z.str="",z.width=0;F=!1}if(T.push({str:z.str,width:z.width}),z.str.length!==B.length){if(F){const N=B.substring(z.str.length);w.splice(L+1,0,N)}}}let R=0;T.forEach(L=>{R=Math.max(R,L.width)}),M[0]=R}else{let R,L,B=0;for(let F=0,z=w.length;F<z;F++){if(F===P-1){const N=k.textMeasure.clipTextWithSuffix(w[F],k.textOptions,c,u,!1,v);T.push({str:N.str,width:N.width}),B=Math.max(B,N.width);break}L=w[F],R=k.textMeasure.measureTextWidth(L,k.textOptions,f==="break-word"),B=Math.max(B,R),T.push({str:L,width:R})}M[0]=B}M[1]=T.length*(x+S);const O={xOffset:0,yOffset:0,width:M[0],height:M[1]};k.LayoutBBox(O,l,h);const D=k.layoutWithBBox(O,T,l,h,x);return this.cache.layoutData=D,this.clearUpdateShapeTag(),this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateSingallineAABBBounds(t){const e=rt(this).text,{direction:i=e.direction}=this.attribute;return i==="horizontal"?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=rt(this).text,{direction:i=e.direction}=this.attribute;return i==="horizontal"?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e,i;const n=rt(this).text,{wrap:r=n.wrap}=this.attribute;if(r)return this.updateWrapAABBBounds([t]);const a=tt.graphicUtil.textMeasure;let o,l;const h=this.attribute,{maxLineWidth:d=n.maxLineWidth,ellipsis:u=n.ellipsis,textAlign:c=n.textAlign,textBaseline:p=n.textBaseline,fontFamily:g=n.fontFamily,fontSize:f=n.fontSize,fontWeight:_=n.fontWeight,stroke:m=n.stroke,lineWidth:v=n.lineWidth,ignoreBuf:y=n.ignoreBuf,whiteSpace:b=n.whiteSpace,suffixPosition:x=n.suffixPosition}=h;if(b==="normal")return this.updateWrapAABBBounds(t);const S=y?0:Math.max(2,.075*f),A=h.fontSize||n.fontSize,k=(e=In(h.lineHeight,A))!==null&&e!==void 0?e:A+S;if(!this.shouldUpdateShape()&&this.cache){o=(i=this.cache.clipedWidth)!==null&&i!==void 0?i:0;const P=rr(c,o),O=ar(p,k,f);return this._AABBBounds.set(P,O,P+o,O+k),m&&this._AABBBounds.expand(v/2),this._AABBBounds}if(Number.isFinite(d)){if(u){const P=u===!0?n.ellipsis:u,O=a.clipTextWithSuffix(t.toString(),{fontSize:f,fontWeight:_,fontFamily:g},d,P,!1,x);l=O.str,o=O.width}else{const P=a.clipText(t.toString(),{fontSize:f,fontWeight:_,fontFamily:g},d,!1);l=P.str,o=P.width}this.cache.clipedText=l,this.cache.clipedWidth=o}else o=a.measureTextWidth(t.toString(),{fontSize:f,fontWeight:_,fontFamily:g}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=o;this.clearUpdateShapeTag();const w=rr(c,o);let T=k;tt.global&&tt.global.isSafari()&&(T+=.2*f);const M=ar(p,T,f,S);return this._AABBBounds.set(w,M,w+o,M+T),m&&this._AABBBounds.expand(v/2),this._AABBBounds}getBaselineMapAlign(){return er.baselineMapAlign}getAlignMapBaseline(){return er.alignMapBaseline}updateVerticalSinglelineAABBBounds(t){var e,i,n;const r=rt(this).text,a=tt.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,d=h?0:2,{maxLineWidth:u=r.maxLineWidth,ellipsis:c=r.ellipsis,fontSize:p=r.fontSize,fontWeight:g=r.fontWeight,fontFamily:f=r.fontFamily,stroke:_=r.stroke,lineWidth:m=r.lineWidth,verticalMode:v=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=(e=In(l.lineHeight,l.fontSize||r.fontSize))!==null&&e!==void 0?e:(l.fontSize||r.fontSize)+d;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!v){const T=x;x=(i=er.baselineMapAlign[S])!==null&&i!==void 0?i:"left",S=(n=er.alignMapBaseline[T])!==null&&n!==void 0?n:"top"}if(!this.shouldUpdateShape()&&this.cache){o=this.cache.clipedWidth;const T=rr(x,o),M=ar(S,b,p);return this._AABBBounds.set(M,T,M+b,T+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}let A=[u1(t.toString())];if(Number.isFinite(u)){if(c){const T=c===!0?r.ellipsis:c,M=a.clipTextWithSuffixVertical(A[0],{fontSize:p,fontWeight:g,fontFamily:f},u,T,!1,y);A=[M.verticalList],o=M.width}else{const T=a.clipTextVertical(A[0],{fontSize:p,fontWeight:g,fontFamily:f},u,!1);A=[T.verticalList],o=T.width}this.cache.verticalList=A,this.cache.clipedWidth=o}else o=0,A[0].forEach(T=>{const M=T.direction===Za.HORIZONTAL?p:a.measureTextWidth(T.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=M,T.width=M}),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=rr(x,o),w=ar(S,b,p);return this._AABBBounds.set(w,k,w+b,k+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const n=rt(this).text,{wrap:r=n.wrap}=this.attribute;if(r)return this.updateWrapAABBBounds(t);const a=this.attribute,{fontFamily:o=n.fontFamily,textAlign:l=n.textAlign,textBaseline:h=n.textBaseline,fontSize:d=n.fontSize,fontWeight:u=n.fontWeight,ellipsis:c=n.ellipsis,maxLineWidth:p,stroke:g=n.stroke,lineWidth:f=n.lineWidth,whiteSpace:_=n.whiteSpace,suffixPosition:m=n.suffixPosition}=a,v=(e=In(a.lineHeight,a.fontSize||n.fontSize))!==null&&e!==void 0?e:a.fontSize||n.fontSize;if(_==="normal")return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const S=this.cache.layoutData.bbox;return this._AABBBounds.set(S.xOffset,S.yOffset,S.xOffset+S.width,S.yOffset+S.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}const y=tt.graphicUtil.textMeasure,b=new Y0(o,{fontSize:d,fontWeight:u,fontFamily:o},y).GetLayoutByLines(t,l,h,v,c===!0?n.ellipsis:c||void 0,!1,p,m),{bbox:x}=b;return this.cache.layoutData=b,this.clearUpdateShapeTag(),this._AABBBounds.set(x.xOffset,x.yOffset,x.xOffset+x.width,x.yOffset+x.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,i,n;const r=rt(this).text,a=tt.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,d=h?0:2,{maxLineWidth:u=r.maxLineWidth,ellipsis:c=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,stroke:_=r.stroke,lineWidth:m=r.lineWidth,verticalMode:v=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=(e=In(l.lineHeight,l.fontSize||r.fontSize))!==null&&e!==void 0?e:(l.fontSize||r.fontSize)+d;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!v){const M=x;x=(i=er.baselineMapAlign[S])!==null&&i!==void 0?i:"left",S=(n=er.alignMapBaseline[M])!==null&&n!==void 0?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach(D=>{const R=D.reduce((L,B)=>L+B.width,0);o=ss(R,o)});const M=rr(x,o),P=this.cache.verticalList.length*b,O=ar(S,P,g);return this._AABBBounds.set(O,M,O+P,M+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}const A=t.map(M=>u1(M.toString()));A.forEach((M,P)=>{if(Number.isFinite(u))if(c){const O=c===!0?r.ellipsis:c,D=a.clipTextWithSuffixVertical(M,{fontSize:g,fontWeight:f,fontFamily:p},u,O,!1,y);A[P]=D.verticalList,o=D.width}else{const O=a.clipTextVertical(M,{fontSize:g,fontWeight:f,fontFamily:p},u,!1);A[P]=O.verticalList,o=O.width}else o=0,M.forEach(O=>{const D=O.direction===Za.HORIZONTAL?g:a.measureTextWidth(O.text,{fontSize:g,fontWeight:f,fontFamily:p});o+=D,O.width=D})}),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach(M=>{const P=M.reduce((O,D)=>O+D.width,0);o=ss(P,o)});const k=rr(x,o),w=this.cache.verticalList.length*b,T=ar(S,w,g);return this._AABBBounds.set(T,k,T+w,k+o),_&&this._AABBBounds.expand(m/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rt(this).text[t]}needUpdateTags(t,e=g1){return super.needUpdateTags(t,e)}needUpdateTag(t,e=g1){return super.needUpdateTag(t,e)}clone(){return new er(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return er.NOWORK_ANIMATE_ATTR}};kd.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Oi),kd.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kd.alignMapBaseline={left:"top",right:"bottom",center:"middle"};function oo(s){return new kd(s)}const Zc=["heightLimit","lineClamp"];class hx extends kd{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return U(t)?!t.every(e=>e==null||e===""):t!=null&&t!==""}updateMultilineAABBBounds(t){var e,i,n,r;const a=rt(this).text,{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:c,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:_=a.fontWeight,ignoreBuf:m=a.ignoreBuf,heightLimit:v=0,suffixPosition:y=a.suffixPosition,lineClamp:b}=this.attribute,x=(e=In(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))!==null&&e!==void 0?e:this.attribute.fontSize||a.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const R=this.cache.layoutData.bbox;return this._AABBBounds.set(R.xOffset,R.yOffset,R.xOffset+R.width,R.yOffset+R.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=tt.graphicUtil.textMeasure,k=new Y0(o,{fontSize:d,fontWeight:_,fontFamily:o},A),w=t.map(R=>R.toString()),T=[],M=[0,0];let P=1/0;if(v>0&&(P=Math.max(Math.floor(v/x),1)),b&&(P=Math.min(P,b)),typeof c=="number"&&c!==1/0){if(c>0)for(let L=0;L<w.length;L++){const B=w[L];let F=!0;if(L===P-1){const N=k.textMeasure.clipTextWithSuffix(B,k.textOptions,c,u,!1,y);T.push({str:N.str,width:N.width});break}const z=k.textMeasure.clipText(B,k.textOptions,c,f==="break-word");if(B!==""&&z.str===""){if(u){const N=k.textMeasure.clipTextWithSuffix(B,k.textOptions,c,u,!1,y);z.str=(n=N.str)!==null&&n!==void 0?n:"",z.width=(r=N.width)!==null&&r!==void 0?r:0}else z.str="",z.width=0;F=!1}if(T.push({str:z.str,width:z.width}),z.str.length!==B.length){if(F){const N=B.substring(z.str.length);w.splice(L+1,0,N)}}}let R=0;T.forEach(L=>{R=Math.max(R,L.width)}),M[0]=R}else{let R,L,B=0;for(let F=0,z=w.length;F<z;F++){if(F===P-1){const N=k.textMeasure.clipTextWithSuffix(w[F],k.textOptions,c,u,!1,y);T.push({str:N.str,width:N.width}),B=Math.max(B,N.width);break}L=w[F],R=k.textMeasure.measureTextWidth(L,k.textOptions,f==="break-word"),B=Math.max(B,R),T.push({str:L,width:R})}M[0]=B}M[1]=T.length*(x+S);const O={xOffset:0,yOffset:0,width:M[0],height:M[1]};k.LayoutBBox(O,l,h);const D=k.layoutWithBBox(O,T,l,h,x);return this.cache.layoutData=D,this.clearUpdateShapeTag(),this._AABBBounds.set(O.xOffset,O.yOffset,O.xOffset+O.width,O.yOffset+O.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<Zc.length;e++){const i=Zc[e];if(t.indexOf(i)!==-1)return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<Zc.length;e++)if(t===Zc[e])return!0;return super.needUpdateTag(t)}getNoWorkAnimateAttr(){return hx.NOWORK_ANIMATE_ATTR}}function yH(s){return new hx(s)}class ti{bounds(t,e){if(lt(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function f1(s,t,e,i,n){return n?s.arc(e,i,t,0,ni,!1,n):s.arc(e,i,t,0,ni),!1}class bH extends ti{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,r){return f1(t,e/2,i,n,r)}drawOffset(t,e,i,n,r,a){return f1(t,e/2+r,i,n,a)}drawToSvgPath(t,e,i,n){const r=t/2;return`M ${e-r}, ${i} a ${r},${r} 0 1,0 ${2*r},0 a ${r},${r} 0 1,0 -${2*r},0`}}const xH=new bH;function SH(s,t,e,i,n){return s.moveTo(-3*t+e,-t+i,n),s.lineTo(-t+e,-t+i,n),s.lineTo(-t+e,-3*t+i,n),s.lineTo(t+e,-3*t+i,n),s.lineTo(t+e,-t+i,n),s.lineTo(3*t+e,-t+i,n),s.lineTo(3*t+e,t+i,n),s.lineTo(t+e,t+i,n),s.lineTo(t+e,3*t+i,n),s.lineTo(-t+e,3*t+i,n),s.lineTo(-t+e,t+i,n),s.lineTo(-3*t+e,t+i,n),s.closePath(),!0}function AH(s,t,e,i,n,r){return s.moveTo(-3*t+e-n,-t+i-n,r),s.lineTo(-t+e-n,-t+i-n,r),s.lineTo(-t+e-n,-3*t+i-n,r),s.lineTo(t+e+n,-3*t+i-n,r),s.lineTo(t+e+n,-t+i-n,r),s.lineTo(3*t+e+n,-t+i-n,r),s.lineTo(3*t+e+n,t+i+n,r),s.lineTo(t+e+n,t+i+n,r),s.lineTo(t+e+n,3*t+i+n,r),s.lineTo(-t+e-n,3*t+i+n,r),s.lineTo(-t+e-n,t+i+n,r),s.lineTo(-3*t+e-n,t+i+n,r),s.closePath(),!0}class kH extends ti{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,r){return SH(t,e/6,i,n,r)}drawOffset(t,e,i,n,r,a){return AH(t,e/6,i,n,r,a)}}const wH=new kH;function lv(s,t,e,i,n){return s.moveTo(e,i-t,n),s.lineTo(t+e,i,n),s.lineTo(e,i+t,n),s.lineTo(e-t,i,n),s.closePath(),!0}class TH extends ti{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,r){return lv(t,e/2,i,n,r)}drawFitDir(t,e,i,n,r){return lv(t,e/2,i,n,r)}drawOffset(t,e,i,n,r,a){return lv(t,e/2+r,i,n,a)}}const MH=new TH;function _1(s,t,e,i){const n=2*t;return s.rect(e-t,i-t,n,n),!1}class CH extends ti{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return _1(t,e/2,i,n)}drawOffset(t,e,i,n,r){return _1(t,e/2+r,i,n)}}const PH=new CH;function EH(s,t,e,i){return s.moveTo(e+t,t+i),s.lineTo(e-t,t+i),s.lineTo(e,i-t),s.closePath(),!0}function RH(s,t,e,i,n){return s.moveTo(e+t+2*n,t+i+n),s.lineTo(e-t-2*n,t+i+n),s.lineTo(e,i-t-2*n),s.closePath(),!0}class dx extends ti{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return EH(t,e/2,i,n)}drawOffset(t,e,i,n,r){return RH(t,e/2,i,n,r)}}const OH=new dx;class DH extends dx{constructor(){super(...arguments),this.type="triangle"}}const LH=new DH,eR=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),BH=Math.sin(ni/10)*eR,IH=-Math.cos(ni/10)*eR;function m1(s,t,e,i){const n=BH*t,r=IH*t;s.moveTo(e,-t+i),s.lineTo(n+e,r+i);for(let a=1;a<5;++a){const o=ni*a/5,l=Math.cos(o),h=Math.sin(o);s.lineTo(h*t+e,-l*t+i),s.lineTo(l*n-h*r+e,h*n+l*r+i)}return s.closePath(),!0}class FH extends ti{constructor(){super(...arguments),this.type="star",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(t,e,i,n){return m1(t,e/2,i,n)}drawOffset(t,e,i,n,r){return m1(t,e/2+r,i,n)}}const jH=new FH,zH=rs(3);function v1(s,t,e,i){const n=t,r=n/zH,a=r/5,o=t;return s.moveTo(0+e,-n+i),s.lineTo(r/2+e,i),s.lineTo(a/2+e,i),s.lineTo(a/2+e,o+i),s.lineTo(-a/2+e,o+i),s.lineTo(-a/2+e,i),s.lineTo(-r/2+e,i),s.closePath(),!0}class HH extends ti{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return v1(t,e/2,i,n)}drawOffset(t,e,i,n,r){return v1(t,e/2+r,i,n)}}const GH=new HH;function y1(s,t,e,i){const n=2*t;return s.moveTo(e,-t+i),s.lineTo(n/3/2+e,t+i),s.lineTo(-n/3/2+e,t+i),s.closePath(),!0}class WH extends ti{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return y1(t,e/2,i,n)}drawOffset(t,e,i,n,r){return y1(t,e/2+r,i,n)}}const NH=new WH;function b1(s,t,e,i){return s.moveTo(-t+e,i),s.lineTo(e,t+i),!1}class VH extends ti{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return b1(t,e/2,i,n)}drawOffset(t,e,i,n,r){return b1(t,e/2+r,i,n)}}const UH=new VH,Ls=-.5,Bs=rs(3)/2,x1=1/rs(12);function S1(s,t,e,i){const n=t/2,r=t*x1,a=n,o=t*x1+t,l=-a,h=o;return s.moveTo(n+e,r+i),s.lineTo(a+e,o+i),s.lineTo(l+e,h+i),s.lineTo(Ls*n-Bs*r+e,Bs*n+Ls*r+i),s.lineTo(Ls*a-Bs*o+e,Bs*a+Ls*o+i),s.lineTo(Ls*l-Bs*h+e,Bs*l+Ls*h+i),s.lineTo(Ls*n+Bs*r+e,Ls*r-Bs*n+i),s.lineTo(Ls*a+Bs*o+e,Ls*o-Bs*a+i),s.lineTo(Ls*l+Bs*h+e,Ls*h-Bs*l+i),s.closePath(),!1}class $H extends ti{constructor(){super(...arguments),this.type="wye",this.pathStr="M4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,-4.51351666838205,0A4.51351666838205,4.51351666838205,0,1,1,4.51351666838205,0"}draw(t,e,i,n){return S1(t,e/2,i,n)}drawOffset(t,e,i,n,r){return S1(t,e/2+r,i,n)}}const YH=new $H;function XH(s,t,e,i){return s.moveTo(-t+e,i),s.lineTo(t+e,t+i),s.lineTo(t+e,i-t),s.closePath(),!0}function KH(s,t,e,i,n){return s.moveTo(-t+e-2*n,i),s.lineTo(t+e+n,t+i+2*n),s.lineTo(t+e+n,i-t-2*n),s.closePath(),!0}class qH extends ti{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return XH(t,e/2,i,n)}drawOffset(t,e,i,n,r){return KH(t,e/2,i,n,r)}}const ZH=new qH;function JH(s,t,e,i){return s.moveTo(e-t,t+i),s.lineTo(t+e,i),s.lineTo(e-t,i-t),s.closePath(),!0}function QH(s,t,e,i,n){return s.moveTo(e-t-n,t+i+2*n),s.lineTo(t+e+2*n,i),s.lineTo(e-t-n,i-t-2*n),s.closePath(),!0}class t5 extends ti{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return JH(t,e/2,i,n)}drawOffset(t,e,i,n,r){return QH(t,e/2,i,n,r)}}const e5=new t5;function i5(s,t,e,i){return s.moveTo(e-t,i-t),s.lineTo(e+t,i-t),s.lineTo(e,i+t),s.closePath(),!0}function s5(s,t,e,i,n){return s.moveTo(e-t-2*n,i-t-n),s.lineTo(e+t+2*n,i-t-n),s.lineTo(e,i+t+2*n),s.closePath(),!0}class n5 extends ti{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return i5(t,e/2,i,n)}drawOffset(t,e,i,n,r){return s5(t,e/2,i,n,r)}}const r5=new n5,X0=rs(3);function A1(s,t,e,i){const n=t*X0;return s.moveTo(e,i+-n/3*2),s.lineTo(t+e,i+n),s.lineTo(e-t,i+n),s.closePath(),!0}class a5 extends dx{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return A1(t,e/2/X0,i,n)}drawOffset(t,e,i,n,r){return A1(t,e/2/X0+r,i,n)}}const o5=new a5;function k1(s,t,e,i){const n=2*t;return s.moveTo(t+e,i-n),s.lineTo(e-t,i),s.lineTo(t+e,n+i),!0}class l5 extends ti{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return k1(t,e/4,i,n)}drawOffset(t,e,i,n,r){return k1(t,e/4+r,i,n)}}const h5=new l5;function w1(s,t,e,i){const n=2*t;return s.moveTo(e-t,i-n),s.lineTo(e+t,i),s.lineTo(e-t,n+i),!0}class d5 extends ti{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return w1(t,e/4,i,n)}drawOffset(t,e,i,n,r){return w1(t,e/4+r,i,n)}}const u5=new d5;function T1(s,t,e,i){const n=2*t;return s.moveTo(e-n,i+t),s.lineTo(e,i-t),s.lineTo(e+n,i+t),!0}class c5 extends ti{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return T1(t,e/4,i,n)}drawOffset(t,e,i,n,r){return T1(t,e/4+r,i,n)}}const p5=new c5;function M1(s,t,e,i){const n=2*t;return s.moveTo(e-n,i-t),s.lineTo(e,i+t),s.lineTo(e+n,i-t),!0}class g5 extends ti{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return M1(t,e/4,i,n)}drawOffset(t,e,i,n,r){return M1(t,e/4+r,i,n)}}const f5=new g5;function C1(s,t,e,i,n){return s.moveTo(e,i-t),s.lineTo(e,i+t),!0}class _5 extends ti{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,r){return C1(t,e/2,i,n)}drawOffset(t,e,i,n,r,a){return C1(t,e/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=t/2;return`M ${e}, ${i-r} L ${e},${i+r}`}}const m5=new _5;function P1(s,t,e,i,n){return s.moveTo(e-t,i),s.lineTo(e+t,i),!0}class v5 extends ti{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,r){return P1(t,e/2,i,n)}drawOffset(t,e,i,n,r,a){return P1(t,e/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=t/2;return`M ${e-r}, ${i} L ${e+r},${i}`}}const y5=new v5;function E1(s,t,e,i,n){return s.moveTo(e-t,i-t),s.lineTo(e+t,i+t),s.moveTo(e+t,i-t),s.lineTo(e-t,i+t),!0}class b5 extends ti{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,r){return E1(t,e/2,i,n)}drawOffset(t,e,i,n,r,a){return E1(t,e/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=t/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}}const x5=new b5;function R1(s,t,e,i){return s.rect(e-t[0]/2,i-t[1]/2,t[0],t[1]),!1}function O1(s,t,e,i){const n=t,r=t/2;return s.rect(e-n/2,i-r/2,n,r),!1}class S5 extends ti{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return lt(e)?O1(t,e,i,n):R1(t,e,i,n)}drawOffset(t,e,i,n,r){return lt(e)?O1(t,e+2*r,i,n):R1(t,[e[0]+2*r,e[1]+2*r],i,n)}}const A5=new S5,Nh=new Me;class D1{constructor(t,e,i=!1){this.pathStr="",this.type=t,U(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,r,a,o){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(l=>{t.beginPath(),ur(l.path.commandList,t,i,n,e,e),o&&o(l.path,l.attribute)}),!1):(ur(this.path.commandList,t,i,n,e+r,e+r),!1)}draw(t,e,i,n,r,a){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(o=>{t.beginPath(),ur(o.path.commandList,t,i,n,e,e),a&&a(o.path,o.attribute)}),!1):(ur(this.path.commandList,t,i,n,e,e),!1)}bounds(t,e){if(this.isSvg)return this.svgCache?(e.clear(),void this.svgCache.forEach(({path:i})=>{Nh.x1=i.bounds.x1*t,Nh.y1=i.bounds.y1*t,Nh.x2=i.bounds.x2*t,Nh.y2=i.bounds.y2*t,e.union(Nh)})):void 0;this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const k5=[xH,wH,MH,PH,o5,LH,jH,GH,NH,UH,YH,ZH,e5,OH,r5,h5,u5,p5,f5,A5,m5,y5,x5],cg={};k5.forEach(s=>{cg[s.type]=s});const w5={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},Jc=new Me,L1=["symbolType","size",...Ps];let nu=class Fo extends Ki{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=B_}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return U(t)?t.length===2&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const t=rt(this).symbol;let{symbolType:e=t.symbolType}=this.attribute,i=cg[e];if(i)return this._parsedPath=i,i;if(i=Fo.userSymbolMap[e],i)return this._parsedPath=i,i;if(e=w5[e]||e,iH(e)===!0){const l=new M_,{svg:h}=l.parse(e);if(!h)return null;const d=U(h.path)?h.path:[h.path];Jc.clear();const u=[];d.forEach(f=>{const _=new Je().fromString(f.d),m={};dH.forEach(v=>{f[v]&&(m[YE[v]]=f[v])}),u.push({path:_,attribute:m}),Jc.union(_.bounds)});const c=Jc.width(),p=Jc.height(),g=1/ss(c,p);return u.forEach(f=>f.path.transform(0,0,g,g)),this._parsedPath=new D1(e,u,!0),Fo.userSymbolMap[e]=this._parsedPath,this._parsedPath}const n=new Je().fromString(e),r=n.bounds.width(),a=n.bounds.height(),o=1/ss(r,a);return n.transform(0,0,o,o),this._parsedPath=new D1(e,n),Fo.userSymbolMap[e]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=rt(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=tt.graphicService.updateSymbolAABBBounds(i,rt(this).symbol,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,a=bi(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rt(this).symbol[t]}needUpdateTags(t){return super.needUpdateTags(t,L1)}needUpdateTag(t){return super.needUpdateTag(t,L1)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=U(e)?e:[e,e];return t.path?new Je().fromCustomPath2D(t.path,0,0,i[0],i[1]):new Je().fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new Fo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fo.NOWORK_ANIMATE_ATTR}};nu.userSymbolMap={},nu.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Oi);function F_(s){return new nu(s)}const B1=["segments","points","curveType",...Ps];let iR=class K0 extends Ki{constructor(t={}){super(t),this.type="line",this.numberType=ac}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?e.length!==0:!!t&&!(t.length<=1)}_interpolate(t,e,i,n,r){t==="points"&&(r.points=Kb(i,n,e))}doUpdateAABBBounds(){const t=rt(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updateLineAABBBounds(e,rt(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rt(this).line[t]}needUpdateTags(t){return super.needUpdateTags(t,B1)}needUpdateTag(t){return super.needUpdateTag(t,B1)}toCustomPath(){const t=this.attribute,e=new Je,i=t.segments,n=r=>{if(r&&r.length){let a=!0;r.forEach(o=>{o.defined!==!1&&(a?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y),a=!1)})}};return i&&i.length?i.forEach(r=>{n(r.points)}):t.points&&n(t.points),e}clone(){return new K0(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return K0.NOWORK_ANIMATE_ATTR}};iR.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Oi);function ux(s){return new iR(s)}const I1=["width","x1","y1","height","cornerRadius",...Ps];class sh extends Ki{constructor(t){super(t),this.type="rect",this.numberType=L_}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}doUpdateAABBBounds(){const t=rt(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updateRectAABBBounds(e,rt(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rt(this).rect[t]}needUpdateTags(t){return super.needUpdateTags(t,I1)}needUpdateTag(t){return super.needUpdateTag(t,I1)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:r}=OE(t),a=new Je;return a.moveTo(e,i),a.rect(e,i,n,r),a}clone(){return new sh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sh.NOWORK_ANIMATE_ATTR}}sh.NOWORK_ANIMATE_ATTR=Oi;function nh(s){return new sh(s)}const F1=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class j_ extends sh{constructor(t){super(t),this.type="rect3d",this.numberType=ex}findFace(){const t={polygons:[],vertices:[],edges:[]},e=rt(this).rect3d,{x1:i,y1:n,x:r,y:a,length:o=vi(e.width,e.height)}=this.attribute;let{width:l,height:h}=this.attribute;l=l??i-r,h=h??n-a;for(let d=0;d<F1.length;d++){const u=F1[d];t.vertices.push([u[0]*l,u[1]*h,u[2]*o])}return t.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),t.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),t.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),t.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),t.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),t.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),t.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],t}getNoWorkAnimateAttr(){return j_.NOWORK_ANIMATE_ATTR}}j_.NOWORK_ANIMATE_ATTR=Oi;function sR(s){return new j_(s)}class ru extends Ki{constructor(t){super(t),this.type="glyph",this.numberType=E_,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach(e=>{e.glyphHost=this,Object.setPrototypeOf(e.attribute,this.attribute)}),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach(t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})})}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach(r=>{r.addUpdateShapeAndBoundsTag(),r.addUpdatePositionTag()})}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach(n=>{n.addUpdateShapeAndBoundsTag(),n.addUpdatePositionTag()})}translate(t,e){return super.translate(t,e),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach(n=>{n.addUpdatePositionTag(),n.addUpdateBoundTag()}),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach(i=>{i.addUpdatePositionTag(),i.addUpdateBoundTag()}),this}rotate(t){return super.rotate(t),this.subGraphic.forEach(e=>{e.addUpdatePositionTag(),e.addUpdateBoundTag()}),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach(e=>{e.addUpdatePositionTag(),e.addUpdateBoundTag()}),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=tt.graphicService.updateGlyphAABBBounds(this.attribute,rt(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if(!(((i=this.currentStates)===null||i===void 0?void 0:i.length)!==t.length||t.some((a,o)=>this.currentStates[o]!==a)))return;const n={},r=this.subGraphic.map(()=>({}));t.forEach(a=>{var o;const l=this.glyphStateProxy?this.glyphStateProxy(a,t):this.glyphStates[a];l&&(Object.assign(n,l.attributes),!((o=l.subAttributes)===null||o===void 0)&&o.length&&r.forEach((h,d)=>{Object.assign(h,l.subAttributes[d])}))}),this.subGraphic.forEach((a,o)=>{a.updateNormalAttrs(r[o]),a.applyStateAttrs(r[o],t,e)}),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach(e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null}),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new ru(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map(e=>e.clone())),t}getNoWorkAnimateAttr(){return ru.NOWORK_ANIMATE_ATTR}}ru.NOWORK_ANIMATE_ATTR=Oi;function nR(s){return new ru(s)}class T5{constructor(t,e,i,n,r,a,o,l,h,d,u,c,p,g){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=r,this.wordBreak=a,this.verticalDirection=o,this.lines=[],this.globalAlign=l,this.globalBaseline=h,this.layoutDirection=d,this.directionKey=$b[this.layoutDirection],this.isWidthMax=u,this.isHeightMax=c,this.singleLine=p,g?(g.clear(),this.icons=g):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),r=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let a=this.isHeightMax?Math.min(this.height,n):this.height||n||0;a=Math.min(a,n);let o=0;switch(this.globalBaseline){case"top":o=0;break;case"middle":o=-a/2;break;case"bottom":o=-a}let l=0;switch(this.globalAlign){case"left":l=0;break;case"center":l=-r/2;break;case"right":l=-r}let h=this[this.directionKey.height];this.singleLine&&(h=this.lines[0].height+1);let d=!1;if(this.verticalDirection==="middle")if(this.actualHeight>=h&&h!==0)for(let u=0;u<this.lines.length;u++){const{top:c,height:p}=this.lines[u];if(c+p<this[this.directionKey.top]||c+p>this[this.directionKey.top]+h)return d;let g=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(g=!0,d=!0),this.lines[u].draw(t,g,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,e)}else{const u=Math.floor((h-this.actualHeight)/2);this.layoutDirection==="vertical"?l+=u:o+=u;for(let c=0;c<this.lines.length;c++)this.lines[c].draw(t,!1,this.lines[c][this.directionKey.left]+l,this.lines[c][this.directionKey.top]+o,e)}else if(this.verticalDirection==="bottom"&&this.layoutDirection!=="vertical")for(let u=0;u<this.lines.length;u++){const{top:c,height:p}=this.lines[u],g=h-this.lines[u].top-this.lines[u].height;if(h===0)this.lines[u].draw(t,!1,l,g+o,e);else{if(g+p>this[this.directionKey.top]+h||g<this[this.directionKey.top])return d;{let f=!1;this.ellipsis&&this.lines[u+1]&&g-this.lines[u+1].height<this[this.directionKey.top]&&(f=!0,d=!0),this.lines[u].draw(t,f,l,g+o,e)}}}else{this.verticalDirection==="bottom"&&this.layoutDirection==="vertical"&&this.singleLine&&this.isWidthMax&&(l+=this.lines[0].height+1);for(let u=0;u<this.lines.length;u++){this.verticalDirection==="bottom"&&this.layoutDirection==="vertical"&&(l-=this.lines[u].height+this.lines[u].top);const{top:c,height:p}=this.lines[u];if(h===0)this.lines[u].draw(t,!1,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,e);else{if(c+p<this[this.directionKey.top]||c+p>this[this.directionKey.top]+h)return d;{let g=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(g=!0,d=!0),this.lines[u].draw(t,g,this.lines[u][this.directionKey.left]+l,this.lines[u][this.directionKey.top]+o,e)}}}}return d}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;i<this.lines.length;i++){const n=this.lines[i];n.actualWidth>t&&(t=n.actualWidth),e+=n.height}return{width:this.layoutDirection==="vertical"?e:t,height:this.layoutDirection==="vertical"?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let r=this[this.directionKey.height];if(this.singleLine&&(r=this.lines[0].height+1),this.verticalDirection==="middle")if(this.actualHeight>=r&&r!==0)for(let a=0;a<this.lines.length;a++){const{top:o,height:l}=this.lines[a];if(!(o+l<this[this.directionKey.top]||o+l>this[this.directionKey.top]+r))if(this.ellipsis&&this.lines[a+1]&&this.lines[a+1].top+this.lines[a+1].height>this[this.directionKey.top]+r){const h=this.lines[a].getWidthWithEllips();h>t&&(t=h),e+=this.lines[a].height}else this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}else{Math.floor((r-this.actualHeight)/2);for(let a=0;a<this.lines.length;a++)this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}else if(this.verticalDirection==="bottom")for(let a=0;a<this.lines.length;a++){const{top:o,height:l}=this.lines[a],h=r-this.lines[a].top-this.lines[a].height;if(r===0)this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height;else if(!(h+l>this[this.directionKey.top]+r||h<this[this.directionKey.top]))if(this.ellipsis&&this.lines[a+1]&&h-this.lines[a+1].height<this[this.directionKey.top]){const d=this.lines[a].getWidthWithEllips();d>t&&(t=d),e+=this.lines[a].height}else this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}else for(let a=0;a<this.lines.length;a++){const{top:o,height:l}=this.lines[a];if(r===0)this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height;else if(!(o+l<this[this.directionKey.top]||o+l>this[this.directionKey.top]+r))if(this.ellipsis&&this.lines[a+1]&&this.lines[a+1].top+this.lines[a+1].height>this[this.directionKey.top]+r){const h=this.lines[a].getWidthWithEllips();h>t&&(t=h),e+=this.lines[a].height}else this.lines[a].actualWidth>t&&(t=this.lines[a].actualWidth),e+=this.lines[a].height}return{width:this.layoutDirection==="vertical"?e:t,height:this.layoutDirection==="vertical"?t:e}}}class au{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=In(i.lineHeight,this.fontSize);this.lineHeight=typeof n=="number"?n>this.fontSize?n:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:r,height:a,descent:o,width:l}=Yo(t,i);let h=0,d=0,u=0;this.height>a&&(h=(this.height-a)/2,d=Math.ceil(h),u=Math.floor(h)),this.textBaseline==="top"?(this.ascent=h,this.descent=a-h):this.textBaseline==="bottom"?(this.ascent=a-h,this.descent=h):this.textBaseline==="middle"?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=r+d,this.descent=o+u),this.length=t.length,this.width=l||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,i.direction==="vertical"&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=Yo(this.text,this.character);this.width=t,this.direction==="vertical"&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,r){let a=this.text,o=this.left+i;e+=this.top;let l=this.direction;if(this.verticalEllipsis)a="...",l="vertical",e-=this.ellipsisWidth/2;else{if(this.ellipsis==="hide")return;if(this.ellipsis==="add")a+="...",r==="right"&&(o-=this.ellipsisWidth);else if(this.ellipsis==="replace"){const h=M0(a,(l==="vertical"?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,a.length-1);if(a=a.slice(0,h),a+="...",r==="right"){const{width:d}=Yo(this.text.slice(h),this.character);l==="vertical"||(o-=this.ellipsisWidth-d)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}l==="vertical"&&(t.save(),t.rotateAbout(Math.PI/2,o,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(o,e),o=0,e=0),this.character.stroke&&(Z3(t,this.character),t.strokeText(a,o,e)),q3(t,this.character),this.character.fill&&t.fillText(a,o,e),this.character.fill&&(typeof this.character.lineThrough=="boolean"||typeof this.character.underline=="boolean"?(this.character.underline&&t.fillRect(o,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(o,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):this.character.textDecoration==="underline"?t.fillRect(o,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):this.character.textDecoration==="line-through"&&t.fillRect(o,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),l==="vertical"&&t.restore()}getWidthWithEllips(t){let e=this.text;const i=t==="vertical"?this.height:this.width;if(this.ellipsis==="hide")return i;if(this.ellipsis==="add")return i+this.ellipsisWidth;if(this.ellipsis==="replace"){const n=M0(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,n),e+="...";const{width:r}=Yo(this.text.slice(n),this.character);return i+this.ellipsisWidth-r}return i}}function M5(s,t){const e=s.text.slice(0,t),i=s.text.slice(t);return[new au(e,s.newLine,s.character),new au(i,!0,s.character)]}const j1=["width","height","image",...Ps];class rh extends Ki{constructor(t){super(t),this.type="image",this.numberType=R_,this.loadImage(this.attribute.image)}get width(){var t;return(t=this.attribute.width)!==null&&t!==void 0?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return(t=this.attribute.height)!==null&&t!==void 0?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return(t=this.attribute.repeatX)!==null&&t!==void 0?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return(t=this.attribute.repeatY)!==null&&t!==void 0?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,()=>{this.successCallback&&this.successCallback()})}imageLoadFail(t,e){super.imageLoadFail(t,()=>{this.failCallback&&this.failCallback()})}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return t==="image"&&this.loadImage(e),super.setAttribute(t,e,i,n)}doUpdateAABBBounds(){const t=rt(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updateImageAABBBounds(e,rt(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return tu[t]}needUpdateTags(t){return super.needUpdateTags(t,j1)}needUpdateTag(t){return super.needUpdateTag(t,j1)}clone(){return new rh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rh.NOWORK_ANIMATE_ATTR}}rh.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Oi);function cx(s){return new rh(s)}class or extends rh{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],t.backgroundShowMode==="always"&&(this._hovered=!0),t.margin){const e=bi(t.margin);this._marginArray=typeof e=="number"?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(e,i,n)=>{if(U(n)&&n.indexOf("margin")!==-1||n==="margin")if(i.margin){const r=bi(i.margin);this._marginArray=typeof r=="number"?[r,r,r,r]:r}else this._marginArray=[0,0,0,0]}}get width(){var t;return((t=this.attribute.width)!==null&&t!==void 0?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return((t=this.attribute.height)!==null&&t!==void 0?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=tu.width,height:e=tu.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,r=(i-t)/2,a=(n-e)/2;return this._AABBBounds.expand([0,2*r,2*a,0]),this._AABBBounds}setHoverState(t){this.attribute.backgroundShowMode==="hover"&&this._hovered!==t&&(this._hovered=t)}}class C5{constructor(t,e,i,n,r,a,o,l){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=r,this.top=i-n,this.paragraphs=a.map(d=>d),this.textAlign=(this.paragraphs[0]instanceof or?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=o,this.directionKey=$b[this.direction],this.actualWidth=0;let h=0;this.paragraphs.forEach((d,u)=>{if(u===0&&d instanceof au){const c=K3.exec(d.text);(c==null?void 0:c.index)!==0&&(d.text=d.text.slice(c==null?void 0:c.index),d.updateWidth())}this.actualWidth+=d[this.directionKey.width],h=Math.max(d[this.directionKey.height],h)}),this.height=h,this.blankWidth=l?0:this.width-this.actualWidth,this.calcOffset(e,l)}calcOffset(t,e){const i=this.directionKey,n=this.height;let r=this.left,a=0;if(this.actualWidth<t&&!e)switch(this.textAlign){case"right":r=t-this.actualWidth;break;case"center":r=(t-this.actualWidth)/2;break;case"justify":this.paragraphs.length<2?r=(t-this.actualWidth)/2:a=(t-this.actualWidth)/(this.paragraphs.length-1)}this.paragraphs.map(function(o){o instanceof or?(o["_"+i.x]=r,r+=o[i.width]+a,o["_"+i.y]=o.attribute.textBaseline==="top"?0:o.attribute.textBaseline==="bottom"?n-o.height:(n-o.height)/2):(o[i.left]=r,r+=o[i.width]+a)})}draw(t,e,i,n,r){if(e){let a=0;for(let o=this.paragraphs.length-1;o>=0;o--){const l=this.paragraphs[o];if(l instanceof or)break;if(this.direction==="vertical"&&l.direction!=="vertical"){l.verticalEllipsis=!0;break}const{width:h}=Yo("...",l.character),d=h||0;if(d<=this.blankWidth+a){l.ellipsis="add";break}if(d<=this.blankWidth+a+l.width){l.ellipsis="replace",l.ellipsisWidth=d,l.ellipsisOtherParagraphWidth=this.blankWidth+a;break}l.ellipsis="hide",a+=l.width}}this.paragraphs.map((a,o)=>{if(a instanceof or)return a.setAttributes({x:i+a._x,y:n+a._y}),void r(a,t,i+a._x,n+a._y,this.ascent);a.draw(t,n+this.ascent,i,o===0,this.textAlign)})}getWidthWithEllips(){let t=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof or)break;const{width:r}=Yo("...",n.character),a=r||0;if(a<=this.blankWidth+t){n.ellipsis="add",n.ellipsisWidth=a;break}if(a<=this.blankWidth+t+n.width){n.ellipsis="replace",n.ellipsisWidth=a,n.ellipsisOtherParagraphWidth=this.blankWidth+t;break}n.ellipsis="hide",t+=n.width}let e=0;return this.paragraphs.map((i,n)=>{e+=i instanceof or?i.width:i.getWidthWithEllips(this.direction)}),e}}class P5{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=$b[this.direction]}store(t){if(t instanceof or){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;t.attribute.textBaseline==="top"?(e=0,i=t.height):t.attribute.textBaseline==="bottom"?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),t.text.length!==0?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(this.lineBuffer.length===0)return;const t=this.maxAscent===0?this.maxAscentForBlank:this.maxAscent,e=this.maxDescent===0?this.maxDescentForBlank:this.maxDescent,i=new C5(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,this.direction==="horizontal"?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof or?this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineBuffer.length===0?(this.store(t),this.send()):(this.send(),this.deal(t)):typeof this.width!="number"||this.width<0||(t.newLine&&this.send(),t.text.length!==0&&(this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=M0(t.text,e,t.character,i,this.frame.wordBreak==="break-word");if(n!==0){const[r,a]=M5(t,n);this.store(r),this.deal(a)}else this.lineBuffer.length!==0&&(this.send(),this.deal(t))}}const z1=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...Ps];class ou extends Ki{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ix}get width(){var t;return(t=this.attribute.width)!==null&&t!==void 0?t:Pn.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return(t=this.attribute.height)!==null&&t!==void 0?t:Pn.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return(t=this.attribute.ellipsis)!==null&&t!==void 0?t:Pn.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return(t=this.attribute.wordBreak)!==null&&t!==void 0?t:Pn.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return(t=this.attribute.verticalDirection)!==null&&t!==void 0?t:Pn.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return(t=this.attribute.textAlign)!==null&&t!==void 0?t:Pn.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return(t=this.attribute.textBaseline)!==null&&t!==void 0?t:Pn.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return(t=this.attribute.textConfig)!==null&&t!==void 0?t:Pn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=rt(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updateRichTextAABBBounds(e,rt(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Pn[t]}needUpdateTags(t){return super.needUpdateTags(t,z1)}needUpdateTag(t){return super.needUpdateTag(t,z1)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}doUpdateFrameCache(){var t;const{textConfig:e=[],maxWidth:i,maxHeight:n,width:r,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:d,textBaseline:u,layoutDirection:c,singleLine:p}=this.attribute,g=[];for(let x=0;x<e.length;x++)if("image"in e[x]){const S=e[x],A=S.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(S.id);if(A)g.push(A);else{const k=new or(S);k.successCallback=()=>{var w;this.addUpdateBoundTag(),(w=this.stage)===null||w===void 0||w.renderNextFrame()},k.richtextId=S.id,g.push(k)}}else if(e[x].text.includes(`
- `)){const S=e[x].text.split(`
- `);for(let A=0;A<S.length;A++)g.push(new au(S[A],A!==0,e[x]))}else g.push(new au(e[x].text,!1,e[x]));const f=typeof i=="number"&&Number.isFinite(i)&&i>0,_=typeof n=="number"&&Number.isFinite(n)&&n>0,m=typeof r=="number"&&Number.isFinite(r)&&r>0&&(!f||r<=i),v=typeof a=="number"&&Number.isFinite(a)&&a>0&&(!_||a<=n),y=new T5(0,0,(m?r:f?i:0)||0,(v?a:_?n:0)||0,o,l,h,d,u,c||"horizontal",!m&&f,!v&&_,p||!1,(t=this._frameCache)===null||t===void 0?void 0:t.icons),b=new P5(y);for(let x=0;x<g.length;x++)b.deal(g[x]);if(b.send(),!(y.layoutDirection==="horizontal"?m:v)){const x=y.getActualSizeWidthEllipsis();let S=y.layoutDirection==="horizontal"?x.width:x.height;(y.layoutDirection==="horizontal"?f:_)&&(S=Math.min(S,y.layoutDirection==="horizontal"?i:n)),y.lines.forEach(function(A){A.calcOffset(S,!1)})}this._frameCache=y}clone(){return new ou(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach(i=>{i.setStage(t,e)})}bindIconEvent(){this.addEventListener("pointermove",t=>{var e,i,n,r,a;const o=this.pickIcon(t.global);o&&o===this._currentHoverIcon||(o?((e=this._currentHoverIcon)===null||e===void 0||e.setHoverState(!1),this._currentHoverIcon=o,this._currentHoverIcon.setHoverState(!0),(i=this.stage)===null||i===void 0||i.setCursor(o.attribute.cursor),(n=this.stage)===null||n===void 0||n.renderNextFrame()):!o&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,(r=this.stage)===null||r===void 0||r.setCursor(),(a=this.stage)===null||a===void 0||a.renderNextFrame()))}),this.addEventListener("pointerleave",t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,(e=this.stage)===null||e===void 0||e.setCursor(),(i=this.stage)===null||i===void 0||i.renderNextFrame())})}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let r;return e.icons.forEach(a=>{var o,l;a.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(r=a,r.globalX=((o=r.attribute.x)!==null&&o!==void 0?o:0)+i,r.globalY=((l=r.attribute.y)!==null&&l!==void 0?l:0)+n)}),r}getNoWorkAnimateAttr(){return ou.NOWORK_ANIMATE_ATTR}}ou.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Oi);function rR(s){return new ou(s)}const H1=["path","customPath",...Ps];class lu extends Ki{constructor(t){super(t),this.type="path",this.numberType=O_}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return t!=null&&t!==""}getParsedPathShape(){const t=rt(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Je?e.path:(C(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Je?this.cache:t.path)}doUpdateAABBBounds(){const t=rt(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updatePathAABBBounds(e,rt(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;ot(t.path,!0)?this.cache=new Je().fromString(t.path):t.customPath&&(this.cache=new Je,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rt(this).path[t]}needUpdateTags(t){return super.needUpdateTags(t,H1)}needUpdateTag(t){return super.needUpdateTag(t,H1)}toCustomPath(){return new Je().fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lu.NOWORK_ANIMATE_ATTR}}lu.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Oi);function aR(s){return new lu(s)}const G1=["segments","points","curveType",...Ps];class hu extends Ki{constructor(t){super(t),this.type="area",this.numberType=rc}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?e.length!==0:!!t&&t.length!==0}doUpdateAABBBounds(){const t=rt(this).area;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updateAreaAABBBounds(e,rt(this).area,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){t==="points"&&(r.points=Kb(i,n,e))}getDefaultAttribute(t){return rt(this).area[t]}needUpdateTags(t){return super.needUpdateTags(t,G1)}needUpdateTag(t){return super.needUpdateTag(t,G1)}toCustomPath(){const t=new Je,e=this.attribute,i=e.segments,n=r=>{if(r&&r.length){let a=!0;const o=[];if(r.forEach(l=>{var h,d;l.defined!==!1&&(a?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y),o.push({x:(h=l.x1)!==null&&h!==void 0?h:l.x,y:(d=l.y1)!==null&&d!==void 0?d:l.y}),a=!1)}),o.length){for(let l=o.length-1;l>=0;l--)t.lineTo(o[l].x,o[l].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach(r=>{n(r.points)}),t}clone(){return new hu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hu.NOWORK_ANIMATE_ATTR}}hu.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Oi);function oR(s){return new hu(s)}const W1=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ps];class ah extends Ki{constructor(t){super(t),this.type="arc",this.numberType=C_}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=rt(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(e===0||e==="0%")return 0;const r=Math.abs(i-n);return Math.min(lt(e,!0)?e:r*parseFloat(e)/100,r/2)}getParsedAngle(){const t=rt(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,r=i-e>=0?1:-1,a=i-e;if(e=sF(e),i=e+a,n&&Xt(a)<It-se){let o=1,l=1;n.length&&(o=Number(n[0]),l=Number(n[1]));const{outerRadius:h=t.outerRadius,innerRadius:d=t.innerRadius}=this.attribute,u=Math.abs(h-d)/2,c=u/h;if(u>se&&h>se)return{startAngle:e-r*c*o,endAngle:i+r*c*l,sc:r*c*o,ec:r*c*l}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=rt(this).arc,{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius,padAngle:a=i.padAngle}=this.attribute,{padRadius:o=rs(n*n+r*r)}=this.attribute,l=Xt(e-t);let h=t,d=e,u=t,c=e;const p=a/2;let g=l,f=l;if(p>se&&o>se){const _=e>t?1:-1;let m=qS(Number(o)/r*ee(p)),v=qS(Number(o)/n*ee(p));return(g-=2*m)>se?(m*=_,u+=m,c-=m):(g=0,u=c=(t+e)/2),(f-=2*v)>se?(v*=_,h+=v,d-=v):(f=0,h=d=(t+e)/2),{outerStartAngle:h,outerEndAngle:d,innerStartAngle:u,innerEndAngle:c,innerDeltaAngle:g,outerDeltaAngle:f}}return{outerStartAngle:h,outerEndAngle:d,innerStartAngle:u,innerEndAngle:c,innerDeltaAngle:g,outerDeltaAngle:f}}doUpdateAABBBounds(t){const e=rt(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=tt.graphicService.updateArcAABBBounds(i,rt(this).arc,this._AABBBounds,t,this),{boundsPadding:r=e.boundsPadding}=i,a=bi(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return super.needUpdateTags(t,W1)}needUpdateTag(t){return super.needUpdateTag(t,W1)}getDefaultAttribute(t){return rt(this).arc[t]}toCustomPath(){const t=this.attribute,{startAngle:e,endAngle:i}=this.getParsedAngle();let n=t.innerRadius,r=t.outerRadius;const a=Xt(i-e),o=i>e;if(r<n){const h=r;r=n,n=h}const l=new Je;if(r<=se)l.moveTo(0,0);else if(a>=It-se)l.moveTo(0+r*oe(e),0+r*ee(e)),l.arc(0,0,r,e,i,!o),n>se&&(l.moveTo(0+n*oe(i),0+n*ee(i)),l.arc(0,0,n,i,e,o));else{const h=r*oe(e),d=r*ee(e),u=n*oe(i),c=n*ee(i);l.moveTo(0+h,0+d),l.arc(0,0,r,e,i,!o),l.lineTo(0+u,0+c),l.arc(0,0,n,i,e,o),l.closePath()}return l}clone(){return new ah(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ah.NOWORK_ANIMATE_ATTR}}ah.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Oi);function px(s){return new ah(s)}class z_ extends ah{constructor(t){super(t),this.type="arc3d",this.numberType=nc}doUpdateAABBBounds(){const t=rt(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updateArc3dAABBBounds(e,rt(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}getNoWorkAnimateAttr(){return z_.NOWORK_ANIMATE_ATTR}}z_.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Oi);function lR(s){return new z_(s)}const N1=["points","cornerRadius",...Ps];class oh extends Ki{constructor(t){super(t),this.type="polygon",this.numberType=D_}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=rt(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updatePolygonAABBBounds(e,rt(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,r){t==="points"&&(r.points=Kb(i,n,e))}getDefaultAttribute(t){return rt(this).polygon[t]}needUpdateTags(t){return super.needUpdateTags(t,N1)}needUpdateTag(t){return super.needUpdateTag(t,N1)}toCustomPath(){const t=this.attribute.points,e=new Je;return t.forEach((i,n)=>{n===0?e.moveTo(i.x,i.y):e.lineTo(i.x,i.y)}),e.closePath(),e}clone(){return new oh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return oh.NOWORK_ANIMATE_ATTR}}oh.NOWORK_ANIMATE_ATTR=Oi;function hR(s){return new oh(s)}class H_ extends oh{constructor(t){super(t),this.type="pyramid3d",this.numberType=tx}doUpdateAABBBounds(){const t=rt(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=tt.graphicService.updatePyramid3dAABBBounds(e,rt(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,r=bi(n);return r&&i.expand(r),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map((o,l)=>{const h=l===3?t[0]:t[l+1],d=o.x-h.x;return d===0?0:(o.y-h.y)/d}),i=t.map(o=>({p:o,d:0}));let n=!1,r=0;for(let o=0;o<e.length-1;o++){for(let l=o+1;l<e.length;l++){if(e[o]===e[l]){n=!0;const h=Ee.distancePP(i[o].p,i[o+1].p);i[o].d=h,i[o+1].d=h,r=ss(r,h);const d=Ee.distancePP(i[l].p,i[l+1].p);i[l].d=d,i[l+1].d=d,r=ss(r,d)}if(n)break}if(n)break}for(let o=t.length-1;o>=0;o--){const l=t[o];i.unshift({p:l,d:0})}for(let o=0;o<t.length;o++){const l=(r-i[o+t.length].d)/2;i[o].d+=l,i[o+t.length].d+=l}const a={polygons:[],vertices:[],edges:[]};return i.forEach(o=>{a.vertices.push([o.p.x,o.p.y,o.d])}),a.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),a.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),a.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),a.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),a.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),a.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),a.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],a}_isValid(){return super._isValid()&&this.attribute.points.length===4}getNoWorkAnimateAttr(){return H_.NOWORK_ANIMATE_ATTR}}H_.NOWORK_ANIMATE_ATTR=Oi;function dR(s){return new H_(s)}class E5 extends Mh{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function R5(s){return new E5(s)}class cd{updateBounds(t,e,i,n){const{outerBorder:r,shadowBlur:a=e.shadowBlur}=t;if(r){const o=e.outerBorder,{distance:l=o.distance,lineWidth:h=o.lineWidth}=r;i.expand(l+(a+h)/2)}return i}}class O5 extends cd{updateBounds(t,e,i,n){const{outerBorder:r,shadowBlur:a=e.shadowBlur,strokeBoundsBuffer:o=e.strokeBoundsBuffer}=t;if(r){const l=e.outerBorder,{distance:h=l.distance,lineWidth:d=l.lineWidth}=r;Ep(i,h+(a+d)/2,!0,o)}return i}}function V1(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class D5{constructor(){this.pools=[]}allocate(t,e,i,n,r,a){if(!this.pools.length)return new ze(t,e,i,n,r,a);const o=this.pools.pop();return o.a=t,o.b=e,o.c=i,o.d=n,o.e=r,o.f=a,o}allocateByObj(t){if(!this.pools.length)return new ze(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}class G_{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return V1();const t=this.pools.pop();return G_.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():V1();for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const Ys=new D5,ce=new G_;var L5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},B5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},I5=function(s,t){return function(e,i){t(e,i,s)}};function F5(s){return s[0]=1,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=1,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function j5(s,t,e){const i=Math.sin(e),n=Math.cos(e),r=t[4],a=t[5],o=t[6],l=t[7],h=t[8],d=t[9],u=t[10],c=t[11];return t!==s&&(s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[4]=r*n+h*i,s[5]=a*n+d*i,s[6]=o*n+u*i,s[7]=l*n+c*i,s[8]=h*n-r*i,s[9]=d*n-a*i,s[10]=u*n-o*i,s[11]=c*n-l*i,s}function z5(s,t,e){const i=Math.sin(e),n=Math.cos(e),r=t[0],a=t[1],o=t[2],l=t[3],h=t[8],d=t[9],u=t[10],c=t[11];return t!==s&&(s[4]=t[4],s[5]=t[5],s[6]=t[6],s[7]=t[7],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[0]=r*n-h*i,s[1]=a*n-d*i,s[2]=o*n-u*i,s[3]=l*n-c*i,s[8]=r*i+h*n,s[9]=a*i+d*n,s[10]=o*i+u*n,s[11]=l*i+c*n,s}function H5(s,t,e){const i=Math.sin(e),n=Math.cos(e),r=t[0],a=t[1],o=t[2],l=t[3],h=t[4],d=t[5],u=t[6],c=t[7];return t!==s&&(s[8]=t[8],s[9]=t[9],s[10]=t[10],s[11]=t[11],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[0]=r*n+h*i,s[1]=a*n+d*i,s[2]=o*n+u*i,s[3]=l*n+c*i,s[4]=h*n-r*i,s[5]=d*n-a*i,s[6]=u*n-o*i,s[7]=c*n-l*i,s}function Vh(s,t,e){const i=e[0],n=e[1],r=e[2];let a,o,l,h,d,u,c,p,g,f,_,m;return t===s?(s[12]=t[0]*i+t[4]*n+t[8]*r+t[12],s[13]=t[1]*i+t[5]*n+t[9]*r+t[13],s[14]=t[2]*i+t[6]*n+t[10]*r+t[14],s[15]=t[3]*i+t[7]*n+t[11]*r+t[15]):(a=t[0],o=t[1],l=t[2],h=t[3],d=t[4],u=t[5],c=t[6],p=t[7],g=t[8],f=t[9],_=t[10],m=t[11],s[0]=a,s[1]=o,s[2]=l,s[3]=h,s[4]=d,s[5]=u,s[6]=c,s[7]=p,s[8]=g,s[9]=f,s[10]=_,s[11]=m,s[12]=a*i+d*n+g*r+t[12],s[13]=o*i+u*n+f*r+t[13],s[14]=l*i+c*n+_*r+t[14],s[15]=h*i+p*n+m*r+t[15]),s}function q0(s,t){s[0]=t.a,s[1]=t.b,s[2]=0,s[3]=0,s[4]=t.c,s[5]=t.d,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0,s[12]=t.e,s[13]=t.f,s[14]=0,s[15]=1}function G5(s,t,e){const i=e[0],n=e[1],r=e[2];return s[0]=t[0]*i,s[1]=t[1]*i,s[2]=t[2]*i,s[3]=t[3]*i,s[4]=t[4]*n,s[5]=t[5]*n,s[6]=t[6]*n,s[7]=t[7]*n,s[8]=t[8]*r,s[9]=t[9]*r,s[10]=t[10]*r,s[11]=t[11]*r,s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15],s}function oc(s,t,e){const i=t[0],n=t[1],r=t[2],a=t[3],o=t[4],l=t[5],h=t[6],d=t[7],u=t[8],c=t[9],p=t[10],g=t[11],f=t[12],_=t[13],m=t[14],v=t[15];let y=e[0],b=e[1],x=e[2],S=e[3];return s[0]=y*i+b*o+x*u+S*f,s[1]=y*n+b*l+x*c+S*_,s[2]=y*r+b*h+x*p+S*m,s[3]=y*a+b*d+x*g+S*v,y=e[4],b=e[5],x=e[6],S=e[7],s[4]=y*i+b*o+x*u+S*f,s[5]=y*n+b*l+x*c+S*_,s[6]=y*r+b*h+x*p+S*m,s[7]=y*a+b*d+x*g+S*v,y=e[8],b=e[9],x=e[10],S=e[11],s[8]=y*i+b*o+x*u+S*f,s[9]=y*n+b*l+x*c+S*_,s[10]=y*r+b*h+x*p+S*m,s[11]=y*a+b*d+x*g+S*v,y=e[12],b=e[13],x=e[14],S=e[15],s[12]=y*i+b*o+x*u+S*f,s[13]=y*n+b*l+x*c+S*_,s[14]=y*r+b*h+x*p+S*m,s[15]=y*a+b*d+x*g+S*v,s}function uR(s,t,e){var i;const{x:n=e.x,y:r=e.y,z:a=e.z,dx:o=e.dx,dy:l=e.dy,dz:h=e.dz,scaleX:d=e.scaleX,scaleY:u=e.scaleY,scaleZ:c=e.scaleZ,alpha:p=e.alpha,beta:g=e.beta,angle:f=e.angle,anchor3d:_=t.attribute.anchor,anchor:m}=t.attribute,v=[0,0,0];if(_){if(typeof _[0]=="string"){const y=parseFloat(_[0])/100,b=t.AABBBounds;v[0]=b.x1+(b.x2-b.x1)*y}else v[0]=_[0];if(typeof _[1]=="string"){const y=parseFloat(_[1])/100,b=t.AABBBounds;v[1]=b.x1+(b.x2-b.x1)*y}else v[1]=_[1];v[2]=(i=_[2])!==null&&i!==void 0?i:0}if(F5(s),Vh(s,s,[n+o,r+l,a+h]),Vh(s,s,[v[0],v[1],v[2]]),j5(s,s,g),z5(s,s,p),Vh(s,s,[-v[0],-v[1],v[2]]),G5(s,s,[d,u,c]),f){const y=ce.allocate(),b=[0,0];if(m){if(typeof _[0]=="string"){const x=parseFloat(_[0])/100,S=t.AABBBounds;b[0]=S.x1+(S.x2-S.x1)*x}else b[0]=_[0];if(typeof _[1]=="string"){const x=parseFloat(_[1])/100,S=t.AABBBounds;b[1]=S.x1+(S.x2-S.x1)*x}else b[1]=_[1]}Vh(y,y,[b[0],b[1],0]),H5(y,y,f),Vh(y,y,[-b[0],-b[1],0]),oc(s,s,y)}}function W5(s){const{alpha:t,beta:e}=s.attribute;return t||e}let Z0=class{constructor(s){this.creator=s,this.hooks={onAttributeUpdate:new As(["graphic"]),onSetStage:new As(["graphic","stage"]),onRemove:new As(["graphic"]),onRelease:new As(["graphic"]),onAddIncremental:new As(["graphic","group","stage"]),onClearIncremental:new As(["graphic","group","stage"]),beforeUpdateAABBBounds:new As(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new As(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Me,this.tempAABBBounds2=new Me,this._rectBoundsContribitions=[new cd],this._symbolBoundsContribitions=[new O5],this._circleBoundsContribitions=[new cd],this._arcBoundsContribitions=[new cd],this._pathBoundsContribitions=[new cd]}onAttributeUpdate(s){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(s)}onSetStage(s,t){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(s,t)}onRemove(s){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(s)}onRelease(s){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(s)}onAddIncremental(s,t,e){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(s,t,e)}onClearIncremental(s,t){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(s,t)}beforeUpdateAABBBounds(s,t,e,i){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(s,t,e,i)}afterUpdateAABBBounds(s,t,e,i,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(s,t,e,i,n)}updatePathProxyAABBBounds(s,t){const e=typeof t.pathProxy=="function"?t.pathProxy(t.attribute):t.pathProxy;if(!e)return!1;const i=new hE(s);return ur(e.commandList,i,0,0),!0}updateRectAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;if(!this.updatePathProxyAABBBounds(e,i)){let{width:a,height:o}=s;const{x1:l,y1:h,x:d,y:u}=s;a=a??l-d,o=o??h-u,e.set(0,0,a||0,o||0)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach(a=>{a.updateBounds(s,t,n,i),e.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)}),this.transformAABBBounds(s,e,t,!1,i),e}updateGroupAABBBounds(s,t,e,i){const{width:n,height:r,path:a,clip:o=t.clip}=s;a&&a.length?a.forEach(d=>{e.union(d.AABBBounds)}):n!=null&&r!=null&&e.set(0,0,n,r),o||i.forEachChildren(d=>{e.union(d.AABBBounds)});const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(e.x1,e.y1,e.x2,e.y2),h.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updateGlyphAABBBounds(s,t,e,i){return this._validCheck(s,t,e,i)&&i.getSubGraphic().forEach(n=>{e.union(n.AABBBounds)}),e}updateRichTextAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i)||!i)return e;const{width:n=t.width,height:r=t.height,maxWidth:a=t.maxWidth,maxHeight:o=t.maxHeight,textAlign:l=t.textAlign,textBaseline:h=t.textBaseline}=s;if(n>0&&r>0)e.set(0,0,n,r);else{const g=i.getFrameCache(),{width:f,height:_}=g.getActualSize();let m=n||f||0,v=r||_||0;v=typeof o=="number"&&v>o?o:v||0,m=typeof a=="number"&&m>a?a:m||0,e.set(0,0,m,v)}let d=0;switch(h){case"top":d=0;break;case"middle":d=-e.height()/2;break;case"bottom":d=-e.height()}let u=0;switch(l){case"left":u=0;break;case"center":u=-e.width()/2;break;case"right":u=-e.width()}e.translate(u,d);const c=this.tempAABBBounds1,p=this.tempAABBBounds2;return c.setValue(e.x1,e.y1,e.x2,e.y2),p.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updateTextAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i)||!i)return e;const{text:n=t.text}=i.attribute;Array.isArray(n)?i.updateMultilineAABBBounds(n):i.updateSingallineAABBBounds(n);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2);const{scaleX:o=t.scaleX,scaleY:l=t.scaleY,shadowBlur:h=t.shadowBlur,strokeBoundsBuffer:d=t.strokeBoundsBuffer}=s;if(h){const u=h/Math.abs(o+l);Ep(r,u,!0,d),e.union(r)}return this.combindShadowAABBBounds(e,i),s0(e,e,i.transMatrix),e}updatePathAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||this.updatePathAABBBoundsImprecise(s,t,e,i);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach(o=>{o.updateBounds(s,t,n,i),e.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2)});const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updatePathAABBBoundsImprecise(s,t,e,i){if(!i)return e;const n=i.getParsedPathShape();return e.union(n.getBounds()),e}updatePyramid3dAABBBounds(s,t,e,i){if(!i)return e;const n=i.stage;if(!n||!n.camera)return e;i.findFace().vertices.forEach(o=>{const l=o[0],h=o[1];e.add(l,h)});const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updateArc3dAABBBounds(s,t,e,i){if(!i)return e;const n=i.stage;if(!n||!n.camera)return e;const{outerRadius:r=t.outerRadius,height:a=0}=s,o=r+a;e.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(e.x1,e.y1,e.x2,e.y2),h.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}updatePolygonAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||this.updatePolygonAABBBoundsImprecise(s,t,e,i);const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2);const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updatePolygonAABBBoundsImprecise(s,t,e,i){const{points:n=t.points}=s;return n.forEach(r=>{e.add(r.x,r.y)}),e}updateLineAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||(s.segments?this.updateLineAABBBoundsBySegments(s,t,e,i):this.updateLineAABBBoundsByPoints(s,t,e,i));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2);const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updateLineAABBBoundsByPoints(s,t,e,i){const{points:n=t.points}=s,r=e;return n.forEach(a=>{r.add(a.x,a.y)}),r}updateLineAABBBoundsBySegments(s,t,e,i){const{segments:n=t.segments}=s,r=e;return n.forEach(a=>{a.points.forEach(o=>{r.add(o.x,o.y)})}),r}updateAreaAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;this.updatePathProxyAABBBounds(e,i)||(s.segments?this.updateAreaAABBBoundsBySegments(s,t,e,i):this.updateAreaAABBBoundsByPoints(s,t,e,i));const n=this.tempAABBBounds1,r=this.tempAABBBounds2;n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2);const{lineJoin:a=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,a==="miter",i),e}updateAreaAABBBoundsByPoints(s,t,e,i){const{points:n=t.points}=s,r=e;return n.forEach(a=>{var o,l;r.add(a.x,a.y),r.add((o=a.x1)!==null&&o!==void 0?o:a.x,(l=a.y1)!==null&&l!==void 0?l:a.y)}),r}updateAreaAABBBoundsBySegments(s,t,e,i){const{segments:n=t.segments}=s,r=e;return n.forEach(a=>{a.points.forEach(o=>{var l,h;r.add(o.x,o.y),r.add((l=o.x1)!==null&&l!==void 0?l:o.x,(h=o.y1)!==null&&h!==void 0?h:o.y)})}),r}updateCircleAABBBounds(s,t,e,i,n){if(!this._validCheck(s,t,e,n))return e;this.updatePathProxyAABBBounds(e,n)||(i?this.updateCircleAABBBoundsImprecise(s,t,e,n):this.updateCircleAABBBoundsAccurate(s,t,e,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach(o=>{o.updateBounds(s,t,r,n),e.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}),this.transformAABBBounds(s,e,t,!1,n),e}updateCircleAABBBoundsImprecise(s,t,e,i){const{radius:n=t.radius}=s;return e.set(-n,-n,n,n),e}updateCircleAABBBoundsAccurate(s,t,e,i){const{startAngle:n=t.startAngle,endAngle:r=t.endAngle,radius:a=t.radius}=s;return r-n>It-se?e.set(-a,-a,a,a):av(n,r,a,e),e}updateArcAABBBounds(s,t,e,i,n){if(!this._validCheck(s,t,e,n))return e;this.updatePathProxyAABBBounds(e,n)||(i?this.updateArcAABBBoundsImprecise(s,t,e,n):this.updateArcAABBBoundsAccurate(s,t,e,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach(l=>{l.updateBounds(s,t,r,n),e.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)});const{lineJoin:o=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,o==="miter",n),e}updateArcAABBBoundsImprecise(s,t,e,i){const{innerRadius:n=t.innerRadius}=s;let{outerRadius:r=t.outerRadius}=s;return r<n&&(r=n),e.set(-r,-r,r,r),e}updateArcAABBBoundsAccurate(s,t,e,i){let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=s;if(n<r){const l=n;n=r,r=l}let{endAngle:a=t.endAngle,startAngle:o=t.startAngle}=s;if(o>a){const l=o;o=a,a=l}return n<=se?e.set(0,0,0,0):Math.abs(a-o)>It-se?e.set(-n,-n,n,n):(av(o,a,n,e),av(o,a,r,e)),e}updateSymbolAABBBounds(s,t,e,i,n){if(!this._validCheck(s,t,e,n))return e;this.updatePathProxyAABBBounds(e,n)||(i?this.updateSymbolAABBBoundsImprecise(s,t,e,n):this.updateSymbolAABBBoundsAccurate(s,t,e,n));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(e.x1,e.y1,e.x2,e.y2),a.setValue(e.x1,e.y1,e.x2,e.y2),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach(l=>{l.updateBounds(s,t,r,n),e.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)});const{lineJoin:o=t.lineJoin}=s;return this.transformAABBBounds(s,e,t,o==="miter",n),e}updateSymbolAABBBoundsImprecise(s,t,e,i){const{size:n=t.size}=s;if(U(n))e.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const r=n/2;e.set(-r,-r,r,r)}return e}updateSymbolAABBBoundsAccurate(s,t,e,i){if(!i)return e;const{size:n=t.size}=s;return i.getParsedPath().bounds(n,e),e}updateImageAABBBounds(s,t,e,i){if(!this._validCheck(s,t,e,i))return e;if(!this.updatePathProxyAABBBounds(e,i)){const{width:a=t.width,height:o=t.height}=s;e.set(0,0,a,o)}const n=this.tempAABBBounds1,r=this.tempAABBBounds2;return n.setValue(e.x1,e.y1,e.x2,e.y2),r.setValue(e.x1,e.y1,e.x2,e.y2),this.transformAABBBounds(s,e,t,!1,i),e}combindShadowAABBBounds(s,t){if(t&&t.shadowRoot){const e=t.shadowRoot.AABBBounds;s.union(e)}}transformAABBBounds(s,t,e,i,n){const{scaleX:r=e.scaleX,scaleY:a=e.scaleY,stroke:o=e.stroke,shadowBlur:l=e.shadowBlur,lineWidth:h=e.lineWidth,pickStrokeBuffer:d=e.pickStrokeBuffer,strokeBoundsBuffer:u=e.strokeBoundsBuffer}=s,c=this.tempAABBBounds1,p=this.tempAABBBounds2;if(o&&h){const _=(h+d)/Math.abs(r+a);Ep(c,_,i,u),t.union(c),c.setValue(p.x1,p.y1,p.x2,p.y2)}if(l){const{shadowOffsetX:_=e.shadowOffsetX,shadowOffsetY:m=e.shadowOffsetY}=s,v=l/Math.abs(r+a)*2;Ep(c,v,!1,u+1),c.translate(_,m),t.union(c)}this.combindShadowAABBBounds(t,n);let g=!0;const f=n.transMatrix;n&&n.isContainer&&(g=!(f.a===1&&f.b===0&&f.c===0&&f.d===1&&f.e===0&&f.f===0)),g&&s0(t,t,f)}_validCheck(s,t,e,i){if(!i)return!0;if(!i.valid)return e.clear(),!1;const{visible:n=t.visible}=s;return!!n||(e.clear(),!1)}};Z0=L5([ct(),I5(0,Dt($E)),B5("design:paramtypes",[Object])],Z0);class N5{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}}const pt=new N5;let Qc,tp;function lc(s){return Qc||(Qc=pt.CreateGraphic("text",{})),Qc.initAttributes(s),Qc.AABBBounds}function V5(s){return tp||(tp=pt.CreateGraphic("richtext",{})),tp.setAttributes(s),tp.AABBBounds}const Ne={x:0,y:0,z:0,lastModelMatrix:null};class ls{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach(e=>this._renderContribitions.push(e)),this._renderContribitions.length&&(this._renderContribitions.sort((e,i)=>i.order-e.order),this._beforeRenderContribitions=this._renderContribitions.filter(e=>e.time===fi.beforeFillStroke),this._afterRenderContribitions=this._renderContribitions.filter(e=>e.time===fi.afterFillStroke))}beforeRenderStep(t,e,i,n,r,a,o,l,h,d,u,c,p){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach(g=>{g.drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p)})}afterRenderStep(t,e,i,n,r,a,o,l,h,d,u,c,p){this._afterRenderContribitions&&this._afterRenderContribitions.forEach(g=>{g.drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p)})}valid(t,e,i,n){const{fill:r=e.fill,background:a,stroke:o=e.stroke,opacity:l=e.opacity,fillOpacity:h=e.fillOpacity,lineWidth:d=e.lineWidth,strokeOpacity:u=e.strokeOpacity,visible:c=e.visible}=t.attribute,p=ao(l,h,r),g=ax(l,u),f=yo(r,a),_=Ch(o,d);return!(!t.valid||!c)&&!(!f&&!_)&&!!(p||g||i||n||a)&&{fVisible:p,sVisible:g,doFill:f,doStroke:_}}transform(t,e,i,n=!1){const{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:d=e.angle,postMatrix:u}=t.attribute,c=i.modelMatrix,p=i.camera;Ne.x=r,Ne.y=a,Ne.z=o,Ne.lastModelMatrix=c;const g=p&&(n||W5(t)),f=g?t.transMatrix.onlyTranslate()&&!u:l===1&&h===1&&d===0&&!u;if(g){const _=ce.allocate(),m=ce.allocate();uR(m,t,e),oc(_,c||_,m),Ne.x=0,Ne.y=0,Ne.z=0,i.modelMatrix=_,i.setTransform(1,0,0,1,0,0,!0),ce.free(m)}if(f&&!c){const _=t.getOffsetXY(e);Ne.x+=_.x,Ne.y+=_.y,Ne.z=o,i.setTransformForCurrent()}else if(g)Ne.x=0,Ne.y=0,Ne.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(p&&i.project){const _=t.getOffsetXY(e);Ne.x+=_.x,Ne.y+=_.y,this.transformWithoutTranslate(i,Ne.x,Ne.y,Ne.z,l,h,d)}else i.transformFromMatrix(t.transMatrix,!0),Ne.x=0,Ne.y=0,Ne.z=0;return Ne}transformUseContext2d(t,e,i,n){const r=n.camera;if(this.camera=r,r){const a=t.AABBBounds,o=a.x2-a.x1,l=a.y2-a.y1,h=n.project(0,0,i),d=n.project(o,0,i),u=n.project(o,l,i),c={x:0,y:0},p={x:o,y:0},g={x:o,y:l};n.camera=null;const f=1/(c.x*(g.y-p.y)-p.x*g.y+g.x*p.y+(p.x-g.x)*c.y),_=-(c.y*(u.x-d.x)-p.y*u.x+g.y*d.x+(p.y-g.y)*h.x)*f,m=(p.y*u.y+c.y*(d.y-u.y)-g.y*d.y+(g.y-p.y)*h.y)*f,v=(c.x*(u.x-d.x)-p.x*u.x+g.x*d.x+(p.x-g.x)*h.x)*f,y=-(p.x*u.y+c.x*(d.y-u.y)-g.x*d.y+(g.x-p.x)*h.y)*f,b=(c.x*(g.y*d.x-p.y*u.x)+c.y*(p.x*u.x-g.x*d.x)+(g.x*p.y-p.x*g.y)*h.x)*f,x=(c.x*(g.y*d.y-p.y*u.y)+c.y*(p.x*u.y-g.x*d.y)+(g.x*p.y-p.x*g.y)*h.y)*f;n.setTransform(_,m,v,y,b,x,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,r,a,o){const l=t.project(e,i,n);t.translate(l.x,l.y,!1),t.scale(r,a,!1),t.rotate(o,!1),t.translate(-l.x,-l.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,r){const{context:a}=n;if(!a)return;a.highPerformanceSave();const o=this.transform(t,e,a,i),{x:l,y:h,z:d,lastModelMatrix:u}=o;this.z=d,fH(t,a,l,h,n,r)||(this.drawShape(t,a,l,h,n,r),this.z=0,a.modelMatrix!==u&&ce.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}const U5=function(){const s={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i};let t="";function e(b){const x=new Error(t+": "+b);throw x.source=t,x}function i(){const b=p(n);return t.length>0&&e("Invalid input not EOF"),b}function n(){return r("linear",s.linearGradient,a)||r("radial",s.radialGradient,l)||r("conic",s.conicGradient,o)}function r(b,x,S){return function(A,k){const w=v(A);if(w){v(s.startCall)||e("Missing (");const T=k(w);return v(s.endCall)||e("Missing )"),T}}(x,function(A){const k=S();return k&&(v(s.comma)||e("Missing comma before color stops")),{type:b,orientation:k,colorStops:p(g)}})}function a(){return m("directional",s.sideOrCorner,1)||m("angular",s.angleValue,1)}function o(){return m("angular",s.fromAngleValue,1)}function l(){let b,x,S=h();return S&&(b=[],b.push(S),x=t,v(s.comma)&&(S=h(),S?b.push(S):t=x)),b}function h(){let b=function(){const x=m("shape",/^(circle)/i,0);return x&&(x.style=_()||d()),x}()||function(){const x=m("shape",/^(ellipse)/i,0);return x&&(x.style=f()||d()),x}();if(b)b.at=u();else{const x=d();if(x){b=x;const S=u();S&&(b.at=S)}else{const S=c();S&&(b={type:"default-radial",at:S})}}return b}function d(){return m("extent-keyword",s.extentKeywords,1)}function u(){if(m("position",/^at/,0)){const b=c();return b||e("Missing positioning value"),b}}function c(){const b={x:f(),y:f()};if(b.x||b.y)return{type:"position",value:b}}function p(b){let x=b();const S=[];if(x)for(S.push(x);v(s.comma);)x=b(),x?S.push(x):e("One extra comma");return S}function g(){const b=m("hex",s.hexColor,1)||m("rgba",s.rgbaColor,1)||m("rgb",s.rgbColor,1)||m("literal",s.literalColor,0);return b||e("Expected color definition"),b.length=f(),b}function f(){return m("%",s.percentageValue,1)||m("position-keyword",s.positionKeywords,1)||_()}function _(){return m("px",s.pixelValue,1)||m("em",s.emValue,1)}function m(b,x,S){const A=v(x);if(A)return{type:b,value:A[S]}}function v(b){const x=/^[\n\r\t\s]+/.exec(t);x&&y(x[0].length);const S=b.exec(t);return S&&y(S[0].length),S}function y(b){t=t.substr(b)}return function(b){return t=b.toString(),i()}}();class Ko{static IsGradient(t){return!(typeof t=="string"&&t.length<10)}static IsGradientStr(t){return typeof t=="string"&&t.length>10}static Parse(t){if(Ko.IsGradientStr(t))try{const e=U5(t)[0];if(e){if(e.type==="linear")return Ko.ParseLinear(e);if(e.type==="radial")return Ko.ParseRadial(e);if(e.type==="conic")return Ko.ParseConic(e)}}catch{return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=ne/2,r=parseFloat(e.value)/180*ne-n;return{gradient:"conical",x:.5,y:.5,startAngle:r,endAngle:r+It,stops:i.map(a=>({color:a.value,offset:parseFloat(a.length.value)/100}))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map(i=>({color:i.value,offset:parseFloat(i.length.value)/100}))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=ne/2;let r=e.type==="angular"?parseFloat(e.value)/180*ne:0;for(;r<0;)r+=It;for(;r>It;)r-=It;let a=0,o=0,l=0,h=0;return r<n?(a=0,o=1,l=Math.sin(r),h=Math.cos(r)):r<ne?(a=0,o=0,l=Math.cos(r-n),h=Math.sin(r-n)):r<ne+n?(a=1,o=0,l=a-Math.sin(r-ne),h=Math.cos(r-ne)):(a=1,l=a-Math.cos(r-n-ne),h-=Math.sin(r-n-ne)),{gradient:"linear",x0:a,y0:o,x1:l,y1:h,stops:i.map(d=>({color:d.value,offset:parseFloat(d.length.value)/100}))}}}function Ei(s,t,e){let i=t;const{a:n,b:r,c:a,d:o}=s.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(i=i/Math.abs(l+h)*2*e,i)}function J0(s,t,e,i,n){if(!t||t===!0)return"black";let r,a;if(U(t))for(let o=0;o<t.length&&(a=t[o],!a);o++);else a=t;return a=Ko.Parse(a),typeof a=="string"?a:(a.gradient==="linear"?r=$5(s,a,e,i,n):a.gradient==="conical"?r=X5(s,a,e,i,n):a.gradient==="radial"&&(r=Y5(s,a,e,i,n)),r||"orange")}function $5(s,t,e,i=0,n=0){var r,a,o,l;const h=e.AABBBounds;if(!h)return;let d=h.x2-h.x1,u=h.y2-h.y1,c=h.x1-i,p=h.y1-n;if(e.attribute){const{scaleX:f=1,scaleY:_=1}=e.attribute;if(f*_==0)return;d/=f,u/=_,c/=f,p/=_}const g=s.createLinearGradient(c+((r=t.x0)!==null&&r!==void 0?r:0)*d,p+((a=t.y0)!==null&&a!==void 0?a:0)*u,c+((o=t.x1)!==null&&o!==void 0?o:1)*d,p+((l=t.y1)!==null&&l!==void 0?l:0)*u);return t.stops.forEach(f=>{g.addColorStop(f.offset,f.color)}),g}function Y5(s,t,e,i=0,n=0){var r,a,o,l,h,d;const u=e.AABBBounds;if(!u)return;let c=u.x2-u.x1,p=u.y2-u.y1,g=u.x1-i,f=u.y1-n;if(e.attribute){const{scaleX:m=1,scaleY:v=1}=e.attribute;if(m*v==0)return;g/=m,f/=v,c/=m,p/=v}const _=s.createRadialGradient(g+((r=t.x0)!==null&&r!==void 0?r:.5)*c,f+((a=t.y0)!==null&&a!==void 0?a:.5)*p,Math.max(c,p)*((o=t.r0)!==null&&o!==void 0?o:0),g+((l=t.x1)!==null&&l!==void 0?l:.5)*c,f+((h=t.y1)!==null&&h!==void 0?h:.5)*p,Math.max(c,p)*((d=t.r1)!==null&&d!==void 0?d:.5));return t.stops.forEach(m=>{_.addColorStop(m.offset,m.color)}),_}function X5(s,t,e,i=0,n=0){var r,a;const o=e.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,d=o.x1-i,u=o.y1-n;if(e.attribute){const{scaleX:p=1,scaleY:g=1}=e.attribute;if(p*g==0)return;l/=p,h/=g,d/=p,u/=g}const c=s.createConicGradient(d+((r=t.x)!==null&&r!==void 0?r:0)*l,u+((a=t.y)!==null&&a!==void 0?a:0)*h,t.startAngle,t.endAngle);return t.stops.forEach(p=>{c.addColorStop(p.offset,p.color)}),c.GetPattern(l+d,h+u,void 0)}var K5=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},q5=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},U1=function(s,t){return function(e,i){t(e,i,s)}};class hc{constructor(){this.time=fi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p){const{background:g,backgroundMode:f=h.backgroundMode,backgroundFit:_=h.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const m=t.resources.get(g);if(m.state!=="success"||!m.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const y=rt(t.parent).group,{scrollX:b=y.scrollX,scrollY:x=y.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(b,x)}e.clip();const v=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,h),this.doDrawImage(e,m.data,v,f,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n,r){if(n==="no-repeat")t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const a=i.width(),o=i.height();let l=a,h=o;if(r&&n!=="repeat"&&(e.width||e.height)){const c=e.width,p=e.height;n==="repeat-x"?(l=c*(o/p),h=o):n==="repeat-y"&&(h=p*(a/c),l=a);const g=t.dpr,f=ih.allocate({width:l,height:h,dpr:g}),_=f.getContext("2d");_&&(_.inuse=!0,_.clearMatrix(),_.setTransformForCurrent(!0),_.clearRect(0,0,l,h),_.drawImage(e,0,0,l,h),e=f.nativeCanvas),ih.free(f)}const d=t.dpr,u=t.createPattern(e,n);u.setTransform&&u.setTransform(new DOMMatrix([1/d,0,0,1/d,0,0])),t.fillStyle=u,t.translate(i.x1,i.y1),t.fillRect(0,0,a,o),t.translate(-i.x1,-i.y1)}}}const bo=new hc;let Js=class{constructor(s){this.subRenderContribitions=s,this.time=fi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(s,t,e,i,n,r,a,o,l,h,d,u,c){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach(p=>{p.render(s,t,e,i,n,r,a,o,l,h,d,u,c)})}};Js=K5([ct(),U1(0,Dt(Qe)),U1(0,gi(lx)),q5("design:paramtypes",[Object])],Js);class gx{constructor(){this.time=fi.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,r){const a=(t-2*e)/2,o=n.dpr,l=ih.allocate({width:t,height:t,dpr:o}),h=l.getContext("2d");if(!h)return null;h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,t,t),r(a,h);const d=n.createPattern(l.nativeCanvas,"repeat");return d.setTransform&&d.setTransform(new DOMMatrix([1/o,0,0,1/o,0,0])),ih.free(l),d}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{a.fillStyle=i,a.arc(r,r,r,0,It),a.fill()})}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=t/2,l=o;a.fillStyle=i,a.moveTo(o,l-r),a.lineTo(r+o,l),a.lineTo(o,l+r),a.lineTo(o-r,l),a.closePath(),a.fill()})}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e,l=o;a.fillStyle=i,a.fillRect(o,l,2*r,2*r)})}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e;a.fillStyle=i,a.fillRect(o,0,2*r,t)})}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e;a.fillStyle=i,a.fillRect(0,o,t,2*r)})}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{a.strokeStyle=i,a.lineWidth=r,a.moveTo(0,0),a.lineTo(t,t);const o=t/2,l=-o;a.moveTo(o,l),a.lineTo(o+t,l+t),a.moveTo(-o,-l),a.lineTo(-o+t,-l+t),a.stroke()})}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{a.strokeStyle=i,a.lineWidth=r,a.moveTo(t,0),a.lineTo(0,t);const o=t/2,l=o;a.moveTo(t+o,l),a.lineTo(o,l+t),a.moveTo(t-o,-l),a.lineTo(-o,-l+t),a.stroke()})}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,(r,a)=>{const o=e,l=o;a.fillStyle=i,a.fillRect(o,l,r,r),a.fillRect(o+r,l+r,r,r)})}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p){this.textureMap||this.initTextureMap(e,t.stage);const{texture:g=h.texture,textureColor:f=h.textureColor,textureSize:_=h.textureSize,texturePadding:m=h.texturePadding}=t.attribute;g&&this.drawTexture(g,t,e,i,n,h,f,_,m)}drawTexture(t,e,i,n,r,a,o,l,h){let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(l,h,o,i);break;case"diamond":d=this.createDiamondPattern(l,h,o,i);break;case"rect":d=this.createRectPattern(l,h,o,i);break;case"vertical-line":d=this.createVerticalLinePattern(l,h,o,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(l,h,o,i);break;case"bias-lr":d=this.createBiasLRLinePattern(l,h,o,i);break;case"bias-rl":d=this.createBiasRLLinePattern(l,h,o,i);break;case"grid":d=this.createGridPattern(l,h,o,i)}d&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,r,a),i.fillStyle=d,i.fill(),i.highPerformanceRestore())}}const Ph=new gx;class Z5{constructor(){this.time=fi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&p.visible!==!1,_=g&&g.visible!==!1;if(!f&&!_)return;const{innerRadius:m=h.innerRadius,outerRadius:v=h.outerRadius,startAngle:y=h.startAngle,endAngle:b=h.endAngle,opacity:x=h.opacity,x:S=h.x,y:A=h.y,scaleX:k=h.scaleX,scaleY:w=h.scaleY}=t.attribute,T=!(!p||!p.stroke),M=!(!g||!g.stroke);if(f){const{distance:P=h.outerBorder.distance}=p,O=Ei(e,P,e.dpr),D=P/v;if(t.setAttributes({outerRadius:v+O,innerRadius:m-O,startAngle:y-D,endAngle:b+D}),e.beginPath(),ug(t,e,i,n,v+O,m-O),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,p,h.outerBorder);else if(T){const R=h.outerBorder.opacity;h.outerBorder.opacity=x,e.setStrokeStyle(t,p,(S-i)/k,(A-n)/w,h.outerBorder),h.outerBorder.opacity=R,e.stroke()}}if(_){const{distance:P=h.innerBorder.distance}=g,O=Ei(e,P,e.dpr),D=P/v;if(t.setAttributes({outerRadius:v-O,innerRadius:m+O,startAngle:y+D,endAngle:b-D}),e.beginPath(),ug(t,e,i,n,v-O,m+O),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.innerBorder);else if(M){const R=h.innerBorder.opacity;h.innerBorder.opacity=x,e.setStrokeStyle(t,g,(S-i)/k,(A-n)/w,h.innerBorder),h.innerBorder.opacity=R,e.stroke()}}t.setAttributes({outerRadius:v,innerRadius:m,startAngle:y,endAngle:b})}}const J5=new Z5,Q5=Ph,tG=bo;class eG{constructor(){this.time=fi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&p.visible!==!1,_=g&&g.visible!==!1;if(!f&&!_)return;const{radius:m=h.radius,startAngle:v=h.startAngle,endAngle:y=h.endAngle,opacity:b=h.opacity,x=h.x,y:S=h.y,scaleX:A=h.scaleX,scaleY:k=h.scaleY}=t.attribute,w=!(!p||!p.stroke),T=!(!g||!g.stroke);if(f){const{distance:M=h.outerBorder.distance}=p,P=Ei(e,M,e.dpr);if(e.beginPath(),e.arc(i,n,m+P,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,p,h.outerBorder);else if(w){const O=h.outerBorder.opacity;h.outerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/A,(S-n)/k,h.outerBorder),h.outerBorder.opacity=O,e.stroke()}}if(_){const{distance:M=h.innerBorder.distance}=g,P=Ei(e,M,e.dpr);if(e.beginPath(),e.arc(i,n,m-P,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.innerBorder);else if(T){const O=h.innerBorder.opacity;h.innerBorder.opacity=b,e.setStrokeStyle(t,g,(x-i)/A,(S-n)/k,h.innerBorder),h.innerBorder.opacity=O,e.stroke()}}}}const iG=new eG,sG=Ph,nG=bo;class rG extends hc{constructor(){super(...arguments),this.time=fi.beforeFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{background:p,backgroundMode:g=h.backgroundMode,backgroundFit:f=h.backgroundFit}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const _=t.resources.get(p);if(_.state!=="success"||!_.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const m=t.AABBBounds;this.doDrawImage(e,_.data,m,g,f),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}}const aG=new rG,ep=ne/2;function lo(s,t,e,i,n,r){let a;if(i<0&&(t+=i,i=-i),n<0&&(e+=n,n=-n),lt(r,!0))a=[r=Xt(r),r,r,r];else if(Array.isArray(r)){const x=r;let S,A;switch(x.length){case 0:a=[0,0,0,0];break;case 1:S=Xt(x[0]),a=[S,S,S,S];break;case 2:case 3:S=Xt(x[0]),A=Xt(x[1]),a=[S,A,S,A];break;default:a=x,a[0]=Xt(a[0]),a[1]=Xt(a[1]),a[2]=Xt(a[2]),a[3]=Xt(a[3])}}else a=[0,0,0,0];if(i<0||a[0]+a[1]+a[2]+a[3]<1e-12)return s.rect(t,e,i,n);const[o,l,h,d]=[[t,e],[t+i,e],[t+i,e+n],[t,e+n]],u=Math.min(i/2,n/2),c=[Math.min(u,a[0]),Math.min(u,a[1]),Math.min(u,a[2]),Math.min(u,a[3])],p=[o[0]+c[0],o[1]],g=[o[0],o[1]+c[0]],f=[l[0]-c[1],l[1]],_=[l[0],l[1]+c[1]],m=[h[0]-c[2],h[1]],v=[h[0],h[1]-c[2]],y=[d[0]+c[3],d[1]],b=[d[0],d[1]-c[3]];if(s.moveTo(p[0],p[1]),s.lineTo(f[0],f[1]),!Ec(f,_)){const x=f[0],S=f[1]+c[1];s.arc(x,S,c[1],-ep,0,!1)}if(s.lineTo(v[0],v[1]),!Ec(m,v)){const x=v[0]-c[2],S=v[1];s.arc(x,S,c[2],0,ep,!1)}if(s.lineTo(y[0],y[1]),!Ec(y,b)){const x=y[0],S=y[1]-c[3];s.arc(x,S,c[3],ep,ne,!1)}if(s.lineTo(g[0],g[1]),!Ec(p,g)){const x=p[0],S=p[1]+c[0];s.arc(x,S,c[0],ne,ne+ep,!1)}return s.closePath(),s}class oG extends hc{constructor(){super(...arguments),this.time=fi.beforeFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{background:p,backgroundMode:g=h.backgroundMode,backgroundFit:f=h.backgroundFit}=t.attribute;if(p)if(t.backgroundImg){const _=t.resources.get(p);if(_.state!=="success"||!_.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const v=rt(t.parent).group,{scrollX:y=v.scrollX,scrollY:b=v.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(y,b)}const m=t.AABBBounds;this.doDrawImage(e,_.data,m,g,f),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(Vt(p)){const{stroke:_,fill:m,lineWidth:v=1,cornerRadius:y=0,expandX:b=0,expandY:x=0}=p;if(!_&&!m)return;e.beginPath();const{x:S,y:A,width:k,height:w}=lG(t);y?lo(e,S-b,A-x,k+2*b,w+2*x,y):e.rect(S-b,A-x,k+2*b,w+2*x),e.globalAlpha=1,m&&(e.fillStyle=m,e.fill()),_&&v>0&&(e.lineWidth=v,e.strokeStyle=_,e.stroke())}else{e.beginPath();const _=t.AABBBounds;e.rect(i,n,_.width(),_.height()),e.fillStyle=p,e.globalAlpha=1,e.fill()}}}function lG(s){const t=bi(s.attribute.boundsPadding),e=s.AABBBounds;let i=e.x1,n=e.y1,r=e.width(),a=e.height();return lt(t)?(i+=t,n+=t,r-=2*t,a-=2*t):(i+=t[3],n+=t[0],r-=t[1]+t[3],a-=t[0]+t[2]),{x:i,y:n,width:r,height:a}}const hG=new oG;var cR=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};class dG{constructor(){this.time=fi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&p.visible!==!1,_=g&&g.visible!==!1;if(!f&&!_)return;const{cornerRadius:m=h.cornerRadius,opacity:v=h.opacity,x:y=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY,x1:A,y1:k}=t.attribute;let{width:w,height:T}=t.attribute;w=(w??A-i)||0,T=(T??k-n)||0;const M=!(!p||!p.stroke),P=!(!g||!g.stroke);if(f){const{distance:O=h.outerBorder.distance}=p,D=Ei(e,O,e.dpr),R=i-D,L=n-D,B=2*D;if(m===0||U(m)&&m.every(F=>F===0)?(e.beginPath(),e.rect(R,L,w+B,T+B)):(e.beginPath(),lo(e,R,L,w+B,T+B,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,p,h.outerBorder);else if(M){const F=h.outerBorder.opacity;h.outerBorder.opacity=v,e.setStrokeStyle(t,p,(y-i)/x,(b-n)/S,h.outerBorder),h.outerBorder.opacity=F,e.stroke()}}if(_){const{distance:O=h.innerBorder.distance}=g,D=Ei(e,O,e.dpr),R=i+D,L=n+D,B=2*D;if(m===0||U(m)&&m.every(F=>F===0)?(e.beginPath(),e.rect(R,L,w-B,T-B)):(e.beginPath(),lo(e,R,L,w-B,T-B,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.innerBorder);else if(P){const F=h.innerBorder.opacity;h.innerBorder.opacity=v,e.setStrokeStyle(t,g,(y-i)/x,(b-n)/S,h.innerBorder),h.innerBorder.opacity=F,e.stroke()}}}}let pg=class{constructor(){this.time=fi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(s,t,e,i,n,r,a,o,l,h,d,u,c){const{stroke:p=l.stroke}=s.attribute;Array.isArray(p)&&p.some(g=>g===!1)&&(c.doStroke=!1)}};pg=cR([ct()],pg);let gg=class{constructor(){this.time=fi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(s,t,e,i,n,r,a,o,l,h,d,u){const{width:c=l.width,height:p=l.height,stroke:g=l.stroke}=s.attribute;if(Array.isArray(g)&&g.some(f=>f===!1)){if(t.setStrokeStyle(s,s.attribute,e,i,l),t.beginPath(),t.moveTo(e,i),g[0]?t.lineTo(e+c,i):t.moveTo(e+c,i),g[1]?t.lineTo(e+c,i+p):t.moveTo(e+c,i+p),g[2]?t.lineTo(e,i+p):t.moveTo(e,i+p),g[3]){const f=g[0]?i-t.lineWidth/2:i;t.lineTo(e,f)}else t.moveTo(e,i);t.stroke()}}};gg=cR([ct()],gg);const uG=new dG,cG=Ph,pG=bo;class gG{constructor(){this.time=fi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){const p=t.getParsedPath();if(!p)return;const{outerBorder:g,innerBorder:f}=t.attribute,_=g&&g.visible!==!1,m=f&&f.visible!==!1;if(!_&&!m)return;const{size:v=h.size,opacity:y=h.opacity,x:b=h.x,y:x=h.y,scaleX:S=h.scaleX,scaleY:A=h.scaleY}=t.attribute,k=!(!g||!g.stroke),w=!(!f||!f.stroke);if(_){const{distance:T=h.outerBorder.distance}=g,M=Ei(e,T,e.dpr);if(e.beginPath(),p.drawOffset(e,v,i,n,M)===!1&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,g,h.outerBorder);else if(k){const P=h.outerBorder.opacity;h.outerBorder.opacity=y,e.setStrokeStyle(t,g,(b-i)/S,(x-n)/A,h.outerBorder),h.outerBorder.opacity=P,e.stroke()}}if(m){const{distance:T=h.innerBorder.distance}=f,M=Ei(e,T,e.dpr);if(e.beginPath(),p.drawOffset(e,v,i,n,-M)===!1&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,f,h.innerBorder);else if(w){const P=h.innerBorder.opacity;h.innerBorder.opacity=y,e.setStrokeStyle(t,f,(b-i)/S,(x-n)/A,h.innerBorder),h.innerBorder.opacity=P,e.stroke()}}}}const fG=new gG,_G=Ph,mG=bo;class vG extends gx{constructor(){super(...arguments),this.time=fi.afterFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c,p){var g,f,_,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=p||{},{texture:y=(g=t.attribute.texture)!==null&&g!==void 0?g:Kc(h,"texture"),textureColor:b=(f=t.attribute.textureColor)!==null&&f!==void 0?f:Kc(h,"textureColor"),textureSize:x=(_=t.attribute.textureSize)!==null&&_!==void 0?_:Kc(h,"textureSize"),texturePadding:S=(m=t.attribute.texturePadding)!==null&&m!==void 0?m:Kc(h,"texturePadding")}=v;y&&this.drawTexture(y,t,e,i,n,h,b,x,S)}}var yG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},bG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},$1=function(s,t){return function(e,i){t(e,i,s)}};let fg=class extends ls{constructor(s){super(),this.arcRenderContribitions=s,this.numberType=C_,this.builtinContributions=[J5,tG,Q5],this.init(s)}drawArcTailCapPath(s,t,e,i,n,r,a,o){const l=o-a,h=s.getParsedAngle(),d=h.startAngle;let u=h.endAngle;u=o;const c=Xt(u-d),p=u>d;let g=!1;if(n<r){const G=n;n=r,r=G}const f=s.getParsedCornerRadius(),{outerDeltaAngle:_,innerDeltaAngle:m,outerStartAngle:v,outerEndAngle:y,innerEndAngle:b,innerStartAngle:x}=s.getParsePadAngle(d,u),S=f,A=f,k=f,w=f,T=Math.max(A,S),M=Math.max(k,w);let P=T,O=M;const D=n*oe(v),R=n*ee(v),L=r*oe(b),B=r*ee(b);let F,z,N,V;if((M>se||T>se)&&(F=n*oe(y),z=n*ee(y),N=r*oe(x),V=r*ee(x),c<ne)){const G=QE(D,R,N,V,F,z,L,B);if(G){const X=D-G[0],Z=R-G[1],et=F-G[0],K=z-G[1],W=1/ee(iP((X*et+Z*K)/(rs(X*X+Z*Z)*rs(et*et+K*K)))/2),it=rs(G[0]*G[0]+G[1]*G[1]);O=vi(M,(r-it)/(W-1)),P=vi(T,(n-it)/(W+1))}}if(P>se){const G=vi(S,P),X=vi(A,P),Z=Xr(N,V,D,R,n,G,Number(p)),et=Xr(F,z,L,B,n,X,Number(p));if(P<T&&G===X)t.moveTo(e+Z.cx+Z.x01,i+Z.cy+Z.y01),t.arc(e+Z.cx,i+Z.cy,P,re(Z.y01,Z.x01),re(et.y01,et.x01),!p);else{const K=u-l-.03,W=re(et.y11,et.x11);t.arc(e,i,n,K,W,!p),X>0&&t.arc(e+et.cx,i+et.cy,X,re(et.y11,et.x11),re(et.y01,et.x01),!p)}}else t.moveTo(e+D,i+R);if(!(r>se)||m<.001)t.lineTo(e+L,i+B),g=!0;else if(O>se){const G=vi(w,O),X=vi(k,O),Z=Xr(L,B,F,z,r,-X,Number(p)),et=Xr(D,R,N,V,r,-G,Number(p));if(t.lineTo(e+Z.cx+Z.x01,i+Z.cy+Z.y01),O<M&&G===X){const K=re(et.y01,et.x01);t.arc(e+Z.cx,i+Z.cy,O,re(Z.y01,Z.x01),K,!p)}else{X>0&&t.arc(e+Z.cx,i+Z.cy,X,re(Z.y01,Z.x01),re(Z.y11,Z.x11),!p);const K=re(Z.cy+Z.y11,Z.cx+Z.x11),W=u-l-.03;t.arc(e,i,r,K,W,p)}}else t.lineTo(e+r*oe(x),i+r*ee(x));return g}drawShape(s,t,e,i,n,r,a,o){const l=rt(s,r==null?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:c=l.y}=s.attribute,p=this.valid(s,l,a,o);if(!p)return;const{fVisible:g,sVisible:f,doFill:_,doStroke:m}=p,{outerRadius:v=l.outerRadius,innerRadius:y=l.innerRadius,cap:b=l.cap,forceShowCap:x=l.forceShowCap}=s.attribute;let S=0;const A=(pe(b)&&b||b[0])&&h.gradient==="conical";if(A){const{sc:M,startAngle:P,endAngle:O}=s.getParsedAngle();Xt(O-P)<It-se&&(S=M||0,h.startAngle-=S,h.endAngle-=S)}let k=!1;const{isFullStroke:w,stroke:T}=fz(d);if((_||w)&&(t.beginPath(),ug(s,t,e,i,v,y),k=!0,t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),this.beforeRenderStep(s,t,e,i,_,m,g,f,l,n,a,o),_&&(a?a(t,s.attribute,l):g&&(t.setCommonStyle(s,s.attribute,u-e,c-i,l),t.fill())),m&&w&&(o?o(t,s.attribute,l):f&&(t.setStrokeStyle(s,s.attribute,u-e,c-i,l),t.stroke()))),!w&&m&&(t.beginPath(),ug(s,t,e,i,v,y,T),k||this.beforeRenderStep(s,t,e,i,_,m,g,f,l,n,a,o),o?o(t,s.attribute,l):f&&(t.setStrokeStyle(s,s.attribute,e,i,l),t.stroke())),(pe(b)&&b||b[1])&&x){const{startAngle:M,endAngle:P}=s.getParsedAngle();if(Xt(P-M)>=It-se){t.beginPath();const O=Math.abs(v-y)/2/v,{endAngle:D=l.endAngle,fill:R=l.fill}=s.attribute,L=D;if(this.drawArcTailCapPath(s,t,e,i,v,y,L,L+O),k||this.beforeRenderStep(s,t,e,i,_,m,g,f,l,n,a,o),_){const B=R;if(B.gradient==="conical"){const F=_H(0,0,D,B);a||ao&&(t.setCommonStyle(s,s.attribute,e,i,l),t.fillStyle=F,t.fill())}}m&&(o||f&&(t.setStrokeStyle(s,s.attribute,e,i,l),t.stroke()))}}this.afterRenderStep(s,t,e,i,_,m,g,f,l,n,a,o),A&&(h.startAngle+=S,h.endAngle+=S)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).arc;this._draw(s,n,!1,e,i)}};fg=yG([ct(),$1(0,Dt(Qe)),$1(0,gi(j0)),bG("design:paramtypes",[Object])],fg);var xG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},SG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Y1=function(s,t){return function(e,i){t(e,i,s)}};let _g=class extends ls{constructor(s){super(),this.circleRenderContribitions=s,this.numberType=P_,this.builtinContributions=[iG,nG,sG],this.init(s)}drawShape(s,t,e,i,n,r,a,o){const l=rt(s,r==null?void 0:r.theme).circle,{radius:h=l.radius,startAngle:d=l.startAngle,endAngle:u=l.endAngle,x:c=l.x,y:p=l.y}=s.attribute,g=this.valid(s,l,a,o);if(!g)return;const{fVisible:f,sVisible:_,doFill:m,doStroke:v}=g;t.beginPath(),t.arc(e,i,h,d,u),t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),this.beforeRenderStep(s,t,e,i,m,v,f,_,l,n,a,o),m&&(a?a(t,s.attribute,l):f&&(t.setCommonStyle(s,s.attribute,c-e,p-i,l),t.fill())),v&&(o?o(t,s.attribute,l):_&&(t.setStrokeStyle(s,s.attribute,c-e,p-i,l),t.stroke())),this.afterRenderStep(s,t,e,i,m,v,f,_,l,n,a,o)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).circle;this._draw(s,n,!1,e,i)}};_g=xG([ct(),Y1(0,Dt(Qe)),Y1(0,gi(H0)),SG("design:paramtypes",[Object])],_g);function mg(s,t,e,i){if(!t.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=i||{};if(e===1)t.p2&&t.p3?s.bezierCurveTo(n+t.p1.x,r+t.p1.y,n+t.p2.x,r+t.p2.y,n+t.p3.x,r+t.p3.y,a):s.lineTo(n+t.p1.x,r+t.p1.y,a);else if(t.p2&&t.p3){const[o]=A0(t,e);s.bezierCurveTo(n+o.p1.x,r+o.p1.y,n+o.p2.x,r+o.p2.y,n+o.p3.x,r+o.p3.y,a)}else{const o=t.getPointAt(e);s.lineTo(n+o.x,r+o.y,a)}}function Q0(s,t,e,i,n){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:d=!1,zeroX:u=0,zeroY:c=0}=n||{};if(d&&h==="none"||!t)return;let p=!0;const{curves:g}=t;if(e>=1){if(d){let b,x=!0;g.forEach((S,A)=>{var k;let w=S.p0;if(S.originP1!==S.originP2){if(b&&b.originP1===b.originP2&&(w=b.p0),S.defined)x||(s.lineTo(w.x+a,w.y+o,l),x=!x);else{const{originP1:T,originP2:M}=S;let P;if(T&&T.defined!==!1?P=w:T&&M.defined!==!1&&(P=(k=S.p3)!==null&&k!==void 0?k:S.p1),x){x=!x;const O=P?P.x:S.p0.x,D=P?P.y:S.p0.y;s.moveTo(O+a,D+o,l)}else P&&(x=!x,s.lineTo(P.x+a,P.y+o,l))}b=S}else b=S})}else g.forEach(b=>{b.defined?(p&&s.moveTo(b.p0.x+a,b.p0.y+o,l),mg(s,b,1,n),p=!1):p=!0});return}if(e<=0)return;let f;i==="x"?f=ye.ROW:i==="y"?f=ye.COLUMN:i==="auto"&&(f=t.direction);const _=e*t.tryUpdateLength(f);let m=0,v=!0,y=null;for(let b=0,x=g.length;b<x;b++){const S=g[b],A=S.getLength(f),k=(_-m)/A;if(m+=A,k<0)break;if(d){let w=S.p0;if(S.originP1===S.originP2){y=S;continue}if(y&&y.originP1===y.originP2&&(w=y.p0),S.defined)v||(s.lineTo(w.x+a,w.y+o,l),v=!v);else{const{originP1:T,originP2:M}=S;let P;if(T&&T.defined!==!1?P=w:T&&M.defined!==!1&&(P=(r=S.p3)!==null&&r!==void 0?r:S.p1),v){v=!v;const O=P?P.x:S.p0.x,D=P?P.y:S.p0.y;s.moveTo(O+a,D+o,l)}else P&&(v=!v,s.lineTo(P.x+a,P.y+o,l))}y=S}else{if(!S.defined){p=!0;continue}p&&s.moveTo(S.p0.x+a,S.p0.y+o,l),mg(s,S,vi(k,1),n),p=!1}}}function AG(s,t,e,i){const{offsetX:n=0,offsetY:r=0}=i||{},a=t?t.points[t.points.length-1]:e.points[0];s.moveTo(a.x+n,a.y+r),e.points.forEach(o=>{o.defined!==!1?s.lineTo(o.x+n,o.y+r):s.moveTo(o.x+n,o.y+r)})}function kG(s,t,e,i){const{offsetX:n=0,offsetY:r=0}=i||{},{points:a}=e,o=[];for(let l=0;l<a.length;l++)a[l].defined;o.push(a),o.forEach((l,h)=>{var d,u,c,p;const g=t&&h===0?t.points[t.points.length-1]:l[0];s.moveTo(g.x+n,g.y+r),l.forEach(f=>{f.defined!==!1?s.lineTo(f.x+n,f.y+r):s.moveTo(f.x+n,f.y+r)});for(let f=l.length-1;f>=0;f--){const _=l[f];s.lineTo((d=_.x1)!==null&&d!==void 0?d:_.x,(u=_.y1)!==null&&u!==void 0?u:_.y)}s.lineTo((c=g.x1)!==null&&c!==void 0?c:g.x,(p=g.y1)!==null&&p!==void 0?p:g.y),s.closePath()})}var wG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let du=class extends ls{constructor(){super(...arguments),this.numberType=ac}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).line;this._draw(s,n,!1,e,i)}drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,g){var f,_,m,v,y;if(!t)return;s.beginPath();const b=(f=this.z)!==null&&f!==void 0?f:0;Q0(s.camera?s:s.nativeContext,t,l,h,{offsetX:d,offsetY:u,offsetZ:b}),c.cache&&!U(c.cache)&&c.cache.curves.every(M=>M.defined)&&c.attribute.curveType&&c.attribute.curveType.includes("Closed")&&s.closePath(),s.setShadowBlendStyle&&s.setShadowBlendStyle(c,a,o);const{x=0,x:S=0}=a;e!==!1&&(p?p(s,a,o):n&&(s.setCommonStyle(c,a,x-d,S-u,o),s.fill())),i!==!1&&(g?g(s,a,o):r&&(s.setStrokeStyle(c,a,x-d,S-u,o),s.stroke()));let{connectedType:A,connectedX:k,connectedY:w,connectedStyle:T}=a;if(U(o)?(A=(_=A??o[0].connectedType)!==null&&_!==void 0?_:o[1].connectedType,k=(m=k??o[0].connectedX)!==null&&m!==void 0?m:o[1].connectedX,w=(v=w??o[0].connectedY)!==null&&v!==void 0?v:o[1].connectedY,T=(y=T??o[0].connectedStyle)!==null&&y!==void 0?y:o[1].connectedStyle):(A=A??o.connectedType,k=k??o.connectedX,w=w??o.connectedY,T=T??o.connectedStyle),A!=="connect"&&A!=="zero"&&(A="none"),A!=="none"){s.beginPath(),Q0(s.camera?s:s.nativeContext,t,l,h,{offsetX:d,offsetY:u,offsetZ:b,drawConnect:!0,mode:A,zeroX:k,zeroY:w});const M=[];U(o)?o.forEach(P=>M.push(P)):M.push(o),M.push(a),e!==!1&&(p?p(s,a,o):n&&(s.setCommonStyle(c,T,x-d,S-u,M),s.fill())),i!==!1&&(g?g(s,a,o):r&&(s.setStrokeStyle(c,T,x-d,S-u,M),s.stroke()))}return!1}drawLinearLineHighPerformance(s,t,e,i,n,r,a,o,l,h,d,u,c){var p;t.beginPath();const g=(p=this.z)!==null&&p!==void 0?p:0,{points:f}=s.attribute,_=f[0];t.moveTo(_.x+a,_.y+o,g);for(let y=1;y<f.length;y++){const b=f[y];t.lineTo(b.x+a,b.y+o,g)}t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l);const{x:m=0,x:v=0}=s.attribute;e!==!1&&(u?u(t,s.attribute,l):n&&(t.setCommonStyle(s,s.attribute,m-a,v-o,l),t.fill())),i!==!1&&(c?c(t,s.attribute,l):r&&(t.setStrokeStyle(s,s.attribute,m-a,v-o,l),t.stroke()))}drawShape(s,t,e,i,n,r,a,o){const l=rt(s,r==null?void 0:r.theme).line,{fill:h=l.fill,stroke:d=l.stroke,fillOpacity:u=l.fillOpacity,strokeOpacity:c=l.strokeOpacity,segments:p,points:g,closePath:f}=s.attribute;if(!this.valid(s,l,a,o))return;let{curveType:_=l.curveType}=s.attribute;f&&_==="linear"&&(_="linearClosed");const{clipRange:m=l.clipRange,clipRangeByDimension:v=l.clipRangeByDimension}=s.attribute;if(m===1&&!p&&!g.some(y=>y.defined===!1)&&_==="linear")return this.drawLinearLineHighPerformance(s,t,!!h,!!d,u,c,e,i,l,n,r,a,o);if(s.shouldUpdateShape()){const{points:y,segments:b}=s.attribute,x=y;if(b&&b.length){let S,A;if(s.cache=b.map((k,w)=>{if(k.points.length<=1&&w===0)return k.points[0]&&(A={endX:k.points[0].x,endY:k.points[0].y,curves:[{defined:k.points[0].defined!==!1}]}),null;w===1?S={x:A.endX,y:A.endY,defined:A.curves[A.curves.length-1].defined}:w>1&&(S.x=A.endX,S.y=A.endY,S.defined=A.curves[A.curves.length-1].defined);const T=T0(k.points,_,{startPoint:S});return A=T,T}).filter(k=>!!k),_==="linearClosed"){let k;for(let w=0;w<s.cache.length;w++){const T=s.cache[w];for(let M=0;M<T.curves.length;M++)if(T.curves[M].defined){k=T.curves[M].p0;break}if(k)break}s.cache[s.cache.length-1]&&s.cache[s.cache.length-1].lineTo(k.x,k.y,!0)}}else{if(!y||!y.length)return s.cache=null,void s.clearUpdateShapeTag();s.cache=T0(x,_)}s.clearUpdateShapeTag()}if(Array.isArray(s.cache)){const y=s.attribute.segments.filter(b=>b.points.length);if(y[0].points.length===1&&y.shift(),m===1){let b=!1;s.cache.forEach((x,S)=>{b||(b=this.drawSegmentItem(t,x,!!h,!!d,u,c,y[S],[l,s.attribute],m,v,e,i,s,a,o))})}else{const b=s.cache.reduce((k,w)=>k+w.getLength(),0),x=m*b;let S=0,A=!1;s.cache.forEach((k,w)=>{if(A)return;const T=k.getLength(),M=(x-S)/T;S+=T,M>0&&(A=this.drawSegmentItem(t,k,!!h,!!d,u,c,y[w],[l,s.attribute],vi(M,1),v,e,i,s,a,o))})}}else this.drawSegmentItem(t,s.cache,!!h,!!d,u,c,s.attribute,l,m,v,e,i,s,a,o)}};du=wG([ct()],du);function TG(s,t,e,i){var n;const{drawConnect:r=!1,mode:a="none"}=i||{};if(r&&a==="none")return;const{top:o,bottom:l}=t;if(o.curves.length!==l.curves.length)return;if(e>=1){const S=[],A=[];let k=!0;if(r){let w,T,M=!0;const P=o.curves.length;o.curves.forEach((O,D)=>{const R=l.curves[P-D-1];let L=O,B=R;if(O.originP1===O.originP2)return w=O,void(T=R);if(w&&w.originP1===w.originP2&&(L=w,B=T),O.defined)M||(S.push(L),A.push(B),Po(s,S,A,i),S.length=0,A.length=0,M=!M);else{const{originP1:F,originP2:z}=O;let N,V;F&&F.defined!==!1?(N=L,V=B):F&&z.defined!==!1&&(N=O,V=R),M?(M=!M,S.push(N||O),A.push(V||R)):N&&(M=!M,S.push(N||O),A.push(V||R),Po(s,S,A,i),S.length=0,A.length=0)}w=O}),Po(s,S,A,i)}else{for(let w=0,T=o.curves.length;w<T;w++){const M=o.curves[w];k!==M.defined?(k?(ip(s,S,A,i),S.length=0,A.length=0):(S.push(M),A.push(l.curves[T-w-1])),k=!k):k&&(S.push(M),A.push(l.curves[T-w-1]))}ip(s,S,A,i)}return}if(e<=0)return;let{direction:h}=i||{};const{curves:d}=o,u=(n=d[d.length-1].p3)!==null&&n!==void 0?n:d[d.length-1].p1,c=Xt(u.x-d[0].p0.x),p=Xt(u.y-d[0].p0.y);h=h??(c>p?ye.ROW:ye.COLUMN),Number.isFinite(c)||(h=ye.COLUMN),Number.isFinite(p)||(h=ye.ROW);const g=e*(h===ye.ROW?c:p);let f=0,_=!0;const m=[],v=[];let y,b,x=!0;for(let S=0,A=o.curves.length;S<A;S++){const k=o.curves[S],w=k.getLength(h),T=(g-f)/w;if(T<0)break;if(f+=w,r){const M=l.curves[A-S-1];let P=k,O=M;if(k.originP1===k.originP2){y=k,b=M;continue}if(y&&y.originP1===y.originP2&&(P=y,O=b),k.defined)x||(m.push(P),v.push(O),Po(s,m,v,i),m.length=0,v.length=0,x=!x);else{const{originP1:D,originP2:R}=k;let L,B;D&&D.defined!==!1?(L=P,B=O):D&&R.defined!==!1&&(L=k,B=M),x?(x=!x,m.push(L||k),v.push(B||M)):L&&(x=!x,m.push(L||k),v.push(B||M),Po(s,m,v,i),m.length=0,v.length=0)}y=k}else{let M=null,P=null;_!==k.defined?(_?(ip(s,m,v,i),m.length=0,v.length=0):(M=k,P=l.curves[A-S-1]),_=!_):_&&(M=k,P=l.curves[A-S-1]),M&&P&&(T<1&&(M=M.p2&&M.p3?A0(M,T)[0]:jA(M,T)[0],P=P.p2&&P.p3?A0(P,1-T)[1]:jA(P,1-T)[1]),M.defined=_,P.defined=_,m.push(M),v.push(P)),M=null,P=null}}r?Po(s,m,v,i):ip(s,m,v,i)}function Po(s,t,e,i){if(t.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=i||{};let o=t[0];s.moveTo(o.p0.x+n,o.p0.y+r,a),o=t[t.length-1];let l=o.p3||o.p1;s.lineTo(l.x+n,l.y+r,a),o=e[e.length-1],s.lineTo(o.p0.x+n,o.p0.y+r,a),o=e[0],l=o.p3||o.p1,s.lineTo(l.x+n,l.y+r,a),s.closePath()}function ip(s,t,e,i){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=i||{};let o=!0;t.forEach(l=>{l.defined?(o&&s.moveTo(l.p0.x+n,l.p0.y+r,a),mg(s,l,1,i),o=!1):o=!0}),o=!0;for(let l=e.length-1;l>=0;l--){const h=e[l];h.defined?(o&&s.lineTo(h.p0.x+n,h.p0.y+r,a),mg(s,h,1,i),o=!1):o=!0}s.closePath()}const MG=new vG,CG=bo;var PG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},EG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},X1=function(s,t){return function(e,i){t(e,i,s)}};function sp(s,t,e){switch(t){case"linear":default:return ic(s,e);case"basis":return pE(s,e);case"monotoneX":return fE(s,e);case"monotoneY":return _E(s,e);case"step":return Il(s,.5,e);case"stepBefore":return Il(s,0,e);case"stepAfter":return Il(s,1,e);case"linearClosed":return mE(s,e)}}let uu=class extends ls{constructor(s){super(),this.areaRenderContribitions=s,this.numberType=rc,this.builtinContributions=[MG,CG],this.init(s)}drawLinearAreaHighPerformance(s,t,e,i,n,r,a,o,l,h,d,u,c){var p,g,f,_,m;t.beginPath();const v=(p=this.z)!==null&&p!==void 0?p:0,{points:y}=s.attribute,b=y[0];t.moveTo(b.x+a,b.y+o,v);for(let A=1;A<y.length;A++){const k=y[A];t.lineTo(k.x+a,k.y+o,v)}for(let A=y.length-1;A>=0;A--){const k=y[A];t.lineTo(((g=k.x1)!==null&&g!==void 0?g:k.x)+a,((f=k.y1)!==null&&f!==void 0?f:k.y)+o,v)}t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),this.beforeRenderStep(s,t,a,o,!!n,!1,e,!1,l,h,u,null,{attribute:s.attribute});const{x=0,x:S=0}=s.attribute;if(e!==!1&&(u?u(t,s.attribute,l):n&&(t.setCommonStyle(s,s.attribute,x-a,S-o,l),t.fill())),this.afterRenderStep(s,t,a,o,!!n,!1,e,!1,l,h,u,null,{attribute:s.attribute}),i){const{stroke:A=l&&l.stroke}=s.attribute;if(U(A)&&(A[0]||A[2])&&A[1]===!1){if(t.beginPath(),A[0]){t.moveTo(b.x+a,b.y+o,v);for(let k=1;k<y.length;k++){const w=y[k];t.lineTo(w.x+a,w.y+o,v)}}else if(A[2]){const k=y[y.length-1];t.moveTo(k.x+a,k.y+o,v);for(let w=y.length-2;w>=0;w--){const T=y[w];t.lineTo(((_=T.x1)!==null&&_!==void 0?_:T.x)+a,((m=T.y1)!==null&&m!==void 0?m:T.y)+o,v)}}}c?c(t,s.attribute,l):(t.setStrokeStyle(s,s.attribute,x-a,S-o,l),t.stroke())}}drawShape(s,t,e,i,n,r,a,o){var l,h,d,u,c,p;const g=rt(s,r==null?void 0:r.theme).area,{fill:f=g.fill,stroke:_=g.stroke,fillOpacity:m=g.fillOpacity,z:v=g.z,strokeOpacity:y=g.strokeOpacity}=s.attribute,b=this.valid(s,g,a,o);if(!b)return;const{doFill:x,doStroke:S}=b,{clipRange:A=g.clipRange,closePath:k,points:w,segments:T}=s.attribute;let{curveType:M=g.curveType}=s.attribute;if(k&&M==="linear"&&(M="linearClosed"),A===1&&!T&&!w.some(P=>P.defined===!1)&&M==="linear")return this.drawLinearAreaHighPerformance(s,t,!!f,S,m,y,e,i,g,n,r,a,o);if(s.shouldUpdateShape()){if(T&&T.length){let P,O;const D=T.map((B,F)=>{if(B.points.length<=1&&F===0)return B.points[0]&&(O={endX:B.points[0].x,endY:B.points[0].y}),null;F===1?P={x:O.endX,y:O.endY}:F>1&&(P.x=O.endX,P.y=O.endY);const z=sp(B.points,M,{startPoint:P});return O=z,z}).filter(B=>!!B);let R;const L=[];for(let B=T.length-1;B>=0;B--){const F=T[B].points,z=[];for(let N=F.length-1;N>=0;N--)z.push({x:(l=F[N].x1)!==null&&l!==void 0?l:F[N].x,y:(h=F[N].y1)!==null&&h!==void 0?h:F[N].y});if(B!==0){const N=T[B-1].points,V=N[N.length-1];V&&z.push({x:(d=V.x1)!==null&&d!==void 0?d:V.x,y:(u=V.y1)!==null&&u!==void 0?u:V.y})}z.length>1&&(R=sp(z,M==="stepBefore"?"stepAfter":M==="stepAfter"?"stepBefore":M),L.unshift(R))}s.cacheArea=L.map((B,F)=>({top:D[F],bottom:B}))}else{if(!w||!w.length)return s.cacheArea=null,void s.clearUpdateShapeTag();{const P=w,O=[];for(let L=w.length-1;L>=0;L--)O.push({x:(c=w[L].x1)!==null&&c!==void 0?c:w[L].x,y:(p=w[L].y1)!==null&&p!==void 0?p:w[L].y});const D=sp(P,M),R=sp(O,M==="stepBefore"?"stepAfter":M==="stepAfter"?"stepBefore":M);s.cacheArea={top:D,bottom:R}}}s.clearUpdateShapeTag()}if(Array.isArray(s.cacheArea)){const P=s.attribute.segments.filter(O=>O.points.length);if(P[0].points.length===1&&P.shift(),A===1){let O=!1;s.cacheArea.forEach((D,R)=>{O||(O=this.drawSegmentItem(t,D,x,m,S,y,P[R],[g,s.attribute],A,e,i,v,s,n,a,o))})}else{const O=s.cacheArea.reduce((B,F)=>B+F.top.getLength(),0),D=A*O;let R=0,L=!1;s.cacheArea.forEach((B,F)=>{if(L)return;const z=B.top.getLength(),N=(D-R)/z;R+=z,N>0&&(L=this.drawSegmentItem(t,B,x,m,S,y,P[F],[g,s.attribute],vi(N,1),e,i,v,s,n,a,o))})}}else this.drawSegmentItem(t,s.cacheArea,x,m,S,y,s.attribute,g,A,e,i,v,s,n,a,o)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).area;this._draw(s,n,!1,e,i)}drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,g,f){let _=!1;return _=_||this._drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,!1,g,f),_=_||this._drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,!0,g,f),_}_drawSegmentItem(s,t,e,i,n,r,a,o,l,h,d,u,c,p,g,f,_){var m,v,y,b;let{connectedType:x,connectedX:S,connectedY:A,connectedStyle:k}=a;const w=[];if(g&&(U(o)?(x=(m=x??o[0].connectedType)!==null&&m!==void 0?m:o[1].connectedType,S=(v=S??o[0].connectedX)!==null&&v!==void 0?v:o[1].connectedX,A=(y=A??o[0].connectedY)!==null&&y!==void 0?y:o[1].connectedY,k=(b=k??o[0].connectedStyle)!==null&&b!==void 0?b:o[1].connectedStyle):(x=x??o.connectedType,S=S??o.connectedX,A=A??o.connectedY,k=k??o.connectedStyle),x!=="connect"&&x!=="zero"&&(x="none"),U(o)?o.forEach(B=>w.push(B)):w.push(o),w.push(a)),g&&x==="none")return!1;if(!t)return;s.beginPath();const{points:T,segments:M}=c.attribute;let P,O,D=ye.ROW;if(M){const B=M[M.length-1];O=M[0].points[0],P=B.points[B.points.length-1]}else O=T[0],P=T[T.length-1];D=Xt(P.x-O.x)>Xt(P.y-O.y)?ye.ROW:ye.COLUMN,TG(s.camera?s:s.nativeContext,t,l,{offsetX:h,offsetY:d,offsetZ:u,direction:D,drawConnect:g,mode:x}),this.beforeRenderStep(c,s,h,d,!!i,!1,e,!1,o,p,f,null,{attribute:a}),s.setShadowBlendStyle&&s.setShadowBlendStyle(c,a,o);const{x:R=0,x:L=0}=a;if(e!==!1&&(f?f(s,a,o):i&&(s.setCommonStyle(c,g?k:a,R-h,L-d,g?w:o),s.fill())),this.afterRenderStep(c,s,h,d,!!i,!1,e,!1,o,p,f,null,{attribute:a}),n!==!1)if(_)_(s,a,o);else{const{stroke:B=o&&o[1]&&o[1].stroke}=a;U(B)&&(B[0]||B[2])&&B[1]===!1&&(s.beginPath(),Q0(s.camera?s:s.nativeContext,B[0]?t.top:t.bottom,l,D===ye.ROW?"x":"y",{offsetX:h,offsetY:d,offsetZ:u,drawConnect:g,mode:x,zeroX:S,zeroY:A})),s.setStrokeStyle(c,g?k:a,R-h,L-d,g?w:o),s.stroke()}return!1}};uu=PG([ct(),X1(0,Dt(Qe)),X1(0,gi(z0)),EG("design:paramtypes",[Object])],uu);const RG=Ph,OG=bo;var DG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},LG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},K1=function(s,t){return function(e,i){t(e,i,s)}};let vg=class extends ls{constructor(s){super(),this.pathRenderContribitions=s,this.numberType=O_,this.builtinContributions=[OG,RG],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l,h,d;const u=(l=this.tempTheme)!==null&&l!==void 0?l:rt(s,r==null?void 0:r.theme).path,{x:c=u.x,y:p=u.y}=s.attribute,g=(h=this.z)!==null&&h!==void 0?h:0,f=this.valid(s,u,a,o);if(!f)return;const{fVisible:_,sVisible:m,doFill:v,doStroke:y}=f;if(t.beginPath(),s.pathShape)ur(s.pathShape.commandList,t,e,i,1,1,g);else{const b=(d=s.attribute.path)!==null&&d!==void 0?d:u.path;ur(b.commandList,t,e,i,1,1,g)}t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,u),this.beforeRenderStep(s,t,e,i,v,y,_,m,u,n,a,o),y&&(o?o(t,s.attribute,u):m&&(t.setStrokeStyle(s,s.attribute,c-e,p-i,u),t.stroke())),v&&(a?a(t,s.attribute,u):_&&(t.setCommonStyle(s,s.attribute,c-e,p-i,u),t.fill())),this.afterRenderStep(s,t,e,i,v,y,_,m,u,n,a,o)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).path;this.tempTheme=n,this._draw(s,n,!1,e,i),this.tempTheme=null}};vg=DG([ct(),K1(0,Dt(Qe)),K1(0,gi(W0)),LG("design:paramtypes",[Object])],vg);var BG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},IG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},q1=function(s,t){return function(e,i){t(e,i,s)}};let yg=class extends ls{constructor(s){super(),this.rectRenderContribitions=s,this.type="rect",this.numberType=L_,this.builtinContributions=[uG,pG,cG],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l;const h=(l=this.tempTheme)!==null&&l!==void 0?l:rt(s,r==null?void 0:r.theme).rect,{fill:d=h.fill,background:u,stroke:c=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:_=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:v=h.visible,x1:y,y1:b,x=h.x,y:S=h.y}=s.attribute;let{width:A,height:k}=s.attribute;A=(A??y-x)||0,k=(k??b-S)||0;const w=rx(g,f,A,k,d),T=ox(g,m,A,k),M=yo(d,u),P=Ch(c,_);if(!s.valid||!v||!M&&!P||!(w||T||a||o||u))return;p===0||U(p)&&p.every(D=>D===0)?(t.beginPath(),t.rect(e,i,A,k)):(t.beginPath(),lo(t,e,i,A,k,p));const O={doFill:M,doStroke:P};t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),this.beforeRenderStep(s,t,e,i,M,P,w,T,h,n,a,o,O),O.doFill&&(a?a(t,s.attribute,h):w&&(t.setCommonStyle(s,s.attribute,x-e,S-i,h),t.fill())),O.doStroke&&(o?o(t,s.attribute,h):T&&(t.setStrokeStyle(s,s.attribute,x-e,S-i,h),t.stroke())),this.afterRenderStep(s,t,e,i,M,P,w,T,h,n,a,o)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).rect;this.tempTheme=n,this._draw(s,n,!1,e,i),this.tempTheme=null}};yg=BG([ct(),q1(0,Dt(Qe)),q1(0,gi(ud)),IG("design:paramtypes",[Object])],yg);var FG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},jG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Z1=function(s,t){return function(e,i){t(e,i,s)}};let bg=class extends ls{constructor(s){super(),this.symbolRenderContribitions=s,this.numberType=B_,this.builtinContributions=[fG,mG,_G],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l;const h=rt(s,r==null?void 0:r.theme).symbol,{size:d=h.size,x:u=h.x,y:c=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY}=s.attribute,f=this.valid(s,h,a,o);if(!f)return;const{fVisible:_,sVisible:m,doFill:v,doStroke:y}=f,b=s.getParsedPath();if(!b)return;const{keepDirIn3d:x=h.keepDirIn3d}=s.attribute,S=(l=this.z)!==null&&l!==void 0?l:0;if(t.beginPath(),x&&t.camera&&t.project){const A=t.project(e,i,S),k=t.camera;t.camera=null,b.draw(t,U(d)?[d[0]*p,d[1]*g]:d*p,A.x,A.y,void 0,(w,T)=>{var M,P,O;if(s._parsedPath.svgCache){const D=Object.assign({},T);D.fill=(M=T.fill)!==null&&M!==void 0?M:s.attribute.fill,D.opacity=(P=T.fill)!==null&&P!==void 0?P:s.attribute.opacity,D.fillOpacity=s.attribute.fillOpacity,D.stroke=(O=T.stroke)!==null&&O!==void 0?O:s.attribute.stroke,T=D}T.fill&&(a?a(t,s.attribute,h):(t.setCommonStyle(s,T,u-e,c-i,h),t.fill())),T.stroke&&(o?o(t,s.attribute,h):(t.setStrokeStyle(s,T,(u-e)/p,(c-i)/g,h),t.stroke()))})===!1&&t.closePath(),t.camera=k}else b.draw(t,d,e,i,S,(A,k)=>{var w,T,M;if(s._parsedPath.svgCache){const P=Object.assign({},k);P.fill=(w=k.fill)!==null&&w!==void 0?w:s.attribute.fill,P.opacity=(T=k.opacity)!==null&&T!==void 0?T:s.attribute.opacity,P.fillOpacity=s.attribute.fillOpacity,P.stroke=(M=k.stroke)!==null&&M!==void 0?M:s.attribute.stroke,k=P}k.fill&&(a?a(t,s.attribute,h):(t.setCommonStyle(s,k,u-e,c-i,h),t.fill())),k.stroke&&(o?o(t,s.attribute,h):(t.setStrokeStyle(s,k,(u-e)/p,(c-i)/g,h),t.stroke()))})===!1&&t.closePath();t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),this.beforeRenderStep(s,t,e,i,v,y,_,m,h,n,a,o),v&&!b.isSvg&&(a?a(t,s.attribute,h):_&&(t.setCommonStyle(s,s.attribute,u-e,c-i,h),t.fill())),y&&!b.isSvg&&(o?o(t,s.attribute,h):m&&(t.setStrokeStyle(s,s.attribute,(u-e)/p,(c-i)/g,h),t.stroke())),this.afterRenderStep(s,t,e,i,v,y,_,m,h,n,a,o)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).symbol;this._draw(s,n,!1,e,i)}};bg=FG([ct(),Z1(0,Dt(Qe)),Z1(0,gi(V0)),jG("design:paramtypes",[Object])],bg);class zG{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Me)}allocate(t,e,i,n){if(!this.pools.length)return new Me().setValue(t,e,i,n);const r=this.pools.pop();return r.x1=t,r.y1=e,r.x2=i,r.y2=n,r}allocateByObj(t){if(!this.pools.length)return new Me(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const xg=new zG;class HG extends hc{constructor(){super(...arguments),this.time=fi.beforeFillStroke}drawShape(t,e,i,n,r,a,o,l,h,d,u,c){var p,g,f,_,m,v,y,b,x,S;const{backgroundMode:A=h.backgroundMode,backgroundFit:k=h.backgroundFit}=t.attribute;let w,{background:T}=t.attribute;if(!T)return;const M=Vt(T)&&T.background,P=t.transMatrix.onlyTranslate();if(M){const O=t.AABBBounds,D=((p=T.x)!==null&&p!==void 0?p:O.x1)+((g=T.dx)!==null&&g!==void 0?g:0),R=((f=T.y)!==null&&f!==void 0?f:O.y1)+((_=T.dy)!==null&&_!==void 0?_:0),L=(m=T.width)!==null&&m!==void 0?m:O.width(),B=(v=T.height)!==null&&v!==void 0?v:O.height();if(w=xg.allocate(D,R,D+L,R+B),T=T.background,!P){const F=w.width(),z=w.height();w.set(((y=T.x)!==null&&y!==void 0?y:0)+((b=T.dx)!==null&&b!==void 0?b:0),((x=T.y)!==null&&x!==void 0?x:0)+((S=T.dy)!==null&&S!==void 0?S:0),F,z)}}else w=t.AABBBounds,P||w.set(0,0,w.width(),w.height());if(t.backgroundImg&&t.resources){const O=t.resources.get(T);if(O.state!=="success"||!O.data)return;e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,h),this.doDrawImage(e,O.data,w,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=T,e.fillRect(w.x1,w.y1,w.width(),w.height()),e.highPerformanceRestore();M&&xg.free(w)}}const pR=new HG;var GG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},WG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},J1=function(s,t){return function(e,i){t(e,i,s)}};let ty=class extends ls{constructor(s){super(),this.textRenderContribitions=s,this.numberType=I_,this.builtinContributions=[pR],this.init(s)}drawShape(s,t,e,i,n,r,a,o){var l,h,d;const u=rt(s,r==null?void 0:r.theme).text,{text:c,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:_=u.direction,whiteSpace:m=u.whiteSpace,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:b=u.x,y:x=u.y}=s.attribute;let{textAlign:S=u.textAlign,textBaseline:A=u.textBaseline}=s.attribute;if(!y&&_==="vertical"){const B=S;S=(l=s.getBaselineMapAlign()[A])!==null&&l!==void 0?l:"left",A=(h=s.getAlignMapBaseline()[B])!==null&&h!==void 0?h:"top"}const k=(d=In(s.attribute.lineHeight,v))!==null&&d!==void 0?d:v,w=this.valid(s,u,a,o);if(!w)return;const{fVisible:T,sVisible:M,doFill:P,doStroke:O}=w,D=!f,R=this.z||0;t.beginPath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,u),this.beforeRenderStep(s,t,e,i,P,O,T,M,u,n,a,o),D&&this.transformUseContext2d(s,u,R,t);const L=(B,F,z,N)=>{let V=e+F;const G=i+z;if(N){t.highPerformanceSave(),V+=v;const X=Ys.allocate(1,0,0,1,0,0);X.rotateByCenter(Math.PI/2,V,G),t.transformFromMatrix(X,!0),Ys.free(X)}O&&(o?o(t,s.attribute,u):M&&(t.setStrokeStyle(s,s.attribute,b-e,x-i,u),t.strokeText(B,V,G,R))),P&&(a?a(t,s.attribute,u):T&&(t.setCommonStyle(s,s.attribute,b-e,x-i,u),t.fillText(B,V,G,R),this.drawUnderLine(p,g,s,V,G,R,u,t))),N&&(t.highPerformanceRestore(),t.setTransformForCurrent())};if(s.isMultiLine)if(t.setTextStyleWithoutAlignBaseline(s.attribute,u,R),_==="horizontal"){const{multilineLayout:B}=s;if(!B)return void t.highPerformanceRestore();const{xOffset:F,yOffset:z}=B.bbox;O&&(o?o(t,s.attribute,u):M&&(t.setStrokeStyle(s,s.attribute,b-e,x-i,u),B.lines.forEach(N=>{t.strokeText(N.str,(N.leftOffset||0)+F+e,(N.topOffset||0)+z+i,R)}))),P&&(a?a(t,s.attribute,u):T&&(t.setCommonStyle(s,s.attribute,b-e,x-i,u),B.lines.forEach(N=>{t.fillText(N.str,(N.leftOffset||0)+F+e,(N.topOffset||0)+z+i,R),this.drawMultiUnderLine(p,g,s,(N.leftOffset||0)+e,(N.topOffset||0)+z+i,R,N.width,u,t)})))}else{s.tryUpdateAABBBounds();const B=s.cache,{verticalList:F}=B;t.textAlign="left",t.textBaseline="top";const z=k*F.length;let N=0;F.forEach(X=>{const Z=X.reduce((et,K)=>et+(K.width||0),0);N=ss(Z,N)});let V=0,G=0;A==="bottom"?G=-z:A==="middle"&&(G=-z/2),S==="center"?V-=N/2:S==="right"&&(V-=N),F.forEach((X,Z)=>{const et=X.reduce((it,ht)=>it+(ht.width||0),0),K=N-et;let W=V;S==="center"?W+=K/2:S==="right"&&(W+=K),X.forEach(it=>{const{text:ht,width:dt,direction:Rt}=it;L(ht,z-(Z+1)*k+G,W,Rt),W+=dt})})}else if(_==="horizontal"){t.setTextStyle(s.attribute,u,R);const B=s.clipedText;let F=0;k!==v&&(A==="top"?F=(k-v)/2:A==="middle"||A==="bottom"&&(F=-(k-v)/2)),L(B,0,F,0)}else{s.tryUpdateAABBBounds();const B=s.cache;if(B){t.setTextStyleWithoutAlignBaseline(s.attribute,u,R);const{verticalList:F}=B;let z=0;const N=F[0].reduce((G,X)=>G+(X.width||0),0);let V=0;A==="bottom"?V=-k:A==="middle"&&(V=-k/2),S==="center"?z-=N/2:S==="right"&&(z-=N),t.textAlign="left",t.textBaseline="top",F[0].forEach(G=>{const{text:X,width:Z,direction:et}=G;L(X,V,z,et),z+=Z})}}D&&this.restoreTransformUseContext2d(s,u,R,t),this.afterRenderStep(s,t,e,i,P,O,T,M,u,n,a,o)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=s.attribute,a=!r;this._draw(s,n,a,e,i)}drawUnderLine(s,t,e,i,n,r,a,o){if(t+s<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:d=a.fontSize,fill:u=a.fill,opacity:c=a.opacity,fillOpacity:p=a.fillOpacity}=e.attribute,g=e.clipedWidth,f=rr(l,g),_=ar(h,d,d),m={lineWidth:0,stroke:u,opacity:c,strokeOpacity:p};if(s){m.lineWidth=s,o.setStrokeStyle(e,m,i,n,a),o.beginPath();const v=n+_+d;o.moveTo(i+f,v,r),o.lineTo(i+f+g,v,r),o.stroke()}if(t){m.lineWidth=t,o.setStrokeStyle(e,m,i,n,a),o.beginPath();const v=n+_+d/2;o.moveTo(i+f,v,r),o.lineTo(i+f+g,v,r),o.stroke()}}drawMultiUnderLine(s,t,e,i,n,r,a,o,l){if(t+s<=0)return;const{textAlign:h=o.textAlign,fontSize:d=o.fontSize,fill:u=o.fill,opacity:c=o.opacity,fillOpacity:p=o.fillOpacity}=e.attribute,g=rr(h,a),f=ar("alphabetic",d,d),_={lineWidth:0,stroke:u,opacity:c,strokeOpacity:p};let m=-3;if(s){_.lineWidth=s,l.setStrokeStyle(e,_,i,n,o),l.beginPath();const v=n+f+d+m;l.moveTo(i+g,v,r),l.lineTo(i+g+a,v,r),l.stroke()}if(m=-1,t){_.lineWidth=t,l.setStrokeStyle(e,_,i,n,o),l.beginPath();const v=n+f+d/2+m;l.moveTo(i+g,v,r),l.lineTo(i+g+a,v,r),l.stroke()}}};ty=GG([ct(),J1(0,Dt(Qe)),J1(0,gi(U0)),WG("design:paramtypes",[Object])],ty);function gR(s,t,e,i){s.moveTo(t[0].x+e,t[0].y+i);for(let n=1;n<t.length;n++)s.lineTo(t[n].x+e,t[n].y+i)}function NG(s,t,e,i,n,r=!0){var a;if(t.length<3)return void gR(s,t,e,i);let o=0,l=t.length-1;r||(o+=1,l-=1,s.moveTo(t[0].x+e,t[0].y+i));for(let h=o;h<=l;h++){const d=t[h===0?l:(h-1)%t.length],u=t[h%t.length],c=t[(h+1)%t.length],p=u.x-d.x,g=u.y-d.y,f=u.x-c.x,_=u.y-c.y,m=(Math.atan2(g,p)-Math.atan2(_,f))/2,v=Math.abs(Math.tan(m));let y=Array.isArray(n)?(a=n[h%t.length])!==null&&a!==void 0?a:0:n,b=y/v;const x=np(p,g),S=np(f,_),A=Math.min(x,S);b>A&&(b=A,y=A*v);const k=hv(u,b,x,p,g),w=hv(u,b,S,f,_),T=2*u.x-k.x-w.x,M=2*u.y-k.y-w.y,P=np(T,M),O=hv(u,np(b,y),P,T,M);let D=Math.atan2(k.y-O.y,k.x-O.x);const R=Math.atan2(w.y-O.y,w.x-O.x);let L=R-D;L<0&&(D=R,L=-L),L>Math.PI&&(L-=Math.PI),h===0?s.moveTo(k.x+e,k.y+i):s.lineTo(k.x+e,k.y+i),L&&s.arcTo(u.x+e,u.y+i,w.x+e,w.y+i,y),s.lineTo(w.x+e,w.y+i)}r||s.lineTo(t[l+1].x+e,t[l+1].y+i)}function np(s,t){return Math.sqrt(s*s+t*t)}function hv(s,t,e,i,n){const r=t/e;return{x:s.x-i*r,y:s.y-n*r}}const VG=Ph,UG=bo;var $G=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},YG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Q1=function(s,t){return function(e,i){t(e,i,s)}};let ey=class extends ls{constructor(s){super(),this.polygonRenderContribitions=s,this.numberType=D_,this.builtinContributions=[UG,VG],this.init(s)}drawShape(s,t,e,i,n,r,a,o){const l=rt(s,r==null?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:d=l.cornerRadius,x:u=l.x,y:c=l.y,closePath:p=l.closePath}=s.attribute,g=this.valid(s,l,a,o);if(!g)return;const{fVisible:f,sVisible:_,doFill:m,doStroke:v}=g;t.beginPath(),d<=0||U(d)&&d.every(y=>y===0)?gR(t.camera?t:t.nativeContext,h,e,i):NG(t.camera?t:t.nativeContext,h,e,i,d,p),p&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),this.beforeRenderStep(s,t,e,i,m,v,f,_,l,n,a,o),m&&(a?a(t,s.attribute,l):f&&(t.setCommonStyle(s,s.attribute,u-e,c-i,l),t.fill())),v&&(o?o(t,s.attribute,l):_&&(t.setStrokeStyle(s,s.attribute,u-e,c-i,l),t.stroke())),this.afterRenderStep(s,t,e,i,m,v,f,_,l,n,a,o)}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).polygon;this._draw(s,n,!1,e,i)}};ey=$G([ct(),Q1(0,Dt(Qe)),Q1(0,gi(N0)),YG("design:paramtypes",[Object])],ey);var XG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},KG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},tk=function(s,t){return function(e,i){t(e,i,s)}};const qG=["","repeat-x","repeat-y","repeat"];let iy=class extends ls{constructor(s){super(),this.imageRenderContribitions=s,this.numberType=R_,this.builtinContributions=[hG],this.init(s)}drawShape(s,t,e,i,n,r,a){const o=rt(s).image,{width:l=o.width,height:h=o.height,repeatX:d=o.repeatX,repeatY:u=o.repeatY,cornerRadius:c=o.cornerRadius,image:p}=s.attribute,g=this.valid(s,o,a);if(!g)return;const{fVisible:f,sVisible:_,doFill:m,doStroke:v}=g;if(t.setShadowBlendStyle&&t.setShadowBlendStyle(s,o),this.beforeRenderStep(s,t,e,i,m,!1,f,!1,o,n,a),m){if(a)a(t,s.attribute,o);else if(f){if(!p||!s.resources)return;const y=s.resources.get(p);if(y.state!=="success")return;let b=!1;c===0||U(c)&&c.every(S=>S===0)||(t.beginPath(),lo(t,e,i,l,h,c),t.save(),t.clip(),b=!0),t.setCommonStyle(s,s.attribute,e,i,o);let x=0;if(d==="repeat"&&(x|=1),u==="repeat"&&(x|=2),x){const S=t.createPattern(y.data,qG[x]);t.fillStyle=S,t.translate(e,i,!0),t.fillRect(0,0,l,h),t.translate(-e,-i,!0)}else t.drawImage(y.data,e,i,l,h);b&&t.restore()}}this.afterRenderStep(s,t,e,i,m,!1,f,!1,o,n,a)}draw(s,t,e){const{image:i}=s.attribute;if(!i||!s.resources||s.resources.get(i).state!=="success")return;const{context:n}=t.drawParams;if(!n)return;const r=rt(s).image;this._draw(s,r,!1,e)}};iy=XG([ct(),tk(0,Dt(Qe)),tk(0,gi(G0)),KG("design:paramtypes",[Object])],iy);const fR=Symbol.for("IncrementalDrawContribution"),Sg=Symbol.for("ArcRender"),sy=Symbol.for("Arc3dRender"),Ag=Symbol.for("AreaRender"),kg=Symbol.for("CircleRender"),_i=Symbol.for("GraphicRender"),ek=Symbol.for("GroupRender"),wg=Symbol.for("LineRender"),Tg=Symbol.for("PathRender"),Mg=Symbol.for("PolygonRender"),Cg=Symbol.for("RectRender"),ny=Symbol.for("Rect3DRender"),Pg=Symbol.for("SymbolRender"),ry=Symbol.for("TextRender"),ay=Symbol.for("RichTextRender"),oy=Symbol.for("Pyramid3dRender"),Eg=Symbol.for("GlyphRender"),ik=Symbol.for("ImageRender"),fx=Symbol.for("DrawContribution");var ZG=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},JG=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},QG=function(s,t){return function(e,i){t(e,i,s)}};const _R=Symbol.for("RenderService");let ly=class{constructor(s){this.drawContribution=s}prepare(s){s&&this.renderTreeRoots.forEach(t=>{this._prepare(t,s)})}_prepare(s,t){s.forEachChildren(e=>{this._prepare(e,t)}),s.update({bounds:t,trans:!0})}prepareRenderList(){}beforeDraw(s){}draw(s){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(s){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(s,t){this.renderTreeRoots=s,this.drawParams=t;const e=t.updateBounds;this.prepare(e),this.prepareRenderList(),this.beforeDraw(t),this.draw(t),this.afterDraw(t)}};ly=ZG([ct(),QG(0,Dt(fx)),JG("design:paramtypes",[Object])],ly);const tW=new Pt(s=>{s(_R).to(ly).inSingletonScope()}),Fl=Symbol.for("PickerService"),sk=Symbol.for("GlobalPickerService");var _x=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};const qo=Symbol.for("PickItemInterceptor");let Rg=class{constructor(){this.order=1}afterPickItem(s,t,e,i,n){return s.attribute.shadowRootIdx>0||!s.attribute.shadowRootIdx?this._pickItem(s,t,e,i,n):null}beforePickItem(s,t,e,i,n){return s.attribute.shadowRootIdx<0?this._pickItem(s,t,e,i,n):null}_pickItem(s,t,e,i,n){if(!s.shadowRoot)return null;const{parentMatrix:r}=n||{};if(!r)return null;const a=t.pickContext;a.highPerformanceSave();const o=s.shadowRoot,l=Ys.allocateByObj(r),h=new De(l.a*e.x+l.c*e.y+l.e,l.b*e.x+l.d*e.y+l.f),d=t.pickGroup(o,h,l,i);return a.highPerformanceRestore(),d}};Rg=_x([ct()],Rg);let Og=class{constructor(){this.order=1}beforePickItem(s,t,e,i,n){const r=s.baseGraphic;if(r&&r.parent){const a=new De(e.x,e.y),o=t.pickContext;o.highPerformanceSave();const l=r.parent.globalTransMatrix;l.transformPoint(a,a);const h=r.isContainer?t.pickGroup(r,a.clone(),l,i):t.pickItem(r,a.clone(),l,i);return o.highPerformanceRestore(),h}return null}};Og=_x([ct()],Og);let Dg=class{constructor(){this.order=1}beforePickItem(s,t,e,i,n){if(!s.in3dMode||i.in3dInterceptor)return null;const r=t.pickContext,a=s.stage;if(!r||!a)return null;if(i.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,s.isContainer){let o,l=!1,h=!1;if(s.forEachChildren(d=>(l=d.numberType===nc,!l)),s.forEachChildren(d=>(h=!!d.findFace,!h)),l){const d=s.getChildren(),u=[...d];u.sort((c,p)=>{var g,f,_,m;let v=((f=(g=c.attribute.startAngle)!==null&&g!==void 0?g:0+c.attribute.endAngle)!==null&&f!==void 0?f:0)/2,y=((m=(_=p.attribute.startAngle)!==null&&_!==void 0?_:0+p.attribute.endAngle)!==null&&m!==void 0?m:0)/2;for(;v<0;)v+=It;for(;y<0;)y+=It;return y-v}),u.forEach(c=>{c._next=null,c._prev=null}),s.removeAllChild(),s.update(),u.forEach(c=>{s.appendChild(c)}),i.hack_pieFace="outside",o=t.pickGroup(s,e,n.parentMatrix,i),o.graphic||(i.hack_pieFace="inside",o=t.pickGroup(s,e,n.parentMatrix,i)),o.graphic||(i.hack_pieFace="top",o=t.pickGroup(s,e,n.parentMatrix,i)),s.removeAllChild(),d.forEach(c=>{c._next=null,c._prev=null}),d.forEach(c=>{s.appendChild(c)})}else if(h){const d=s.getChildren(),u=d.map(c=>({ave_z:c.findFace().vertices.map(p=>{var g;return r.view(p[0],p[1],(g=p[2]+c.attribute.z)!==null&&g!==void 0?g:0)[2]}).reduce((p,g)=>p+g,0),g:c}));u.sort((c,p)=>p.ave_z-c.ave_z),s.removeAllChild(),u.forEach(c=>{c.g._next=null,c.g._prev=null}),s.update(),u.forEach(c=>{s.add(c.g)}),o=t.pickGroup(s,e,n.parentMatrix,i),s.removeAllChild(),d.forEach(c=>{c._next=null,c._prev=null}),s.update(),d.forEach(c=>{s.add(c)})}else o=t.pickGroup(s,e,n.parentMatrix,i);return r.camera=null,i.in3dInterceptor=!1,r.restore(),o}return r.restore(),null}initCanvasCtx(s){s.setTransformForCurrent()}};Dg=_x([ct()],Dg);const eW=new Pt((s,t,e)=>{e(Fl)||(s(sk).toSelf(),s(Fl).toService(sk)),s(Dg).toSelf().inSingletonScope(),s(qo).toService(Dg),s(Rg).toSelf().inSingletonScope(),s(qo).toService(Rg),s(Og).toSelf().inSingletonScope(),s(qo).toService(Og),Ci(s,qo)}),iW=new Pt(s=>{s(UE).to(Z0).inSingletonScope(),s($E).toConstantValue(pt)}),cu=Symbol.for("AutoEnablePlugins"),mR=Symbol.for("PluginService");var sW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},nW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},nk=function(s,t){return function(e,i){t(e,i,s)}};let hy=class{constructor(s){this.autoEnablePlugins=s,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(s,t){this.stage=s,this.actived=!0;const{pluginList:e}=t;e&&Ct.isBound(cu)&&this.autoEnablePlugins.getContributions().forEach(i=>{e.includes(i.name)&&this.register(i)})}findPluginsByName(s){const t=[];return this.onStartupFinishedPlugin.forEach(e=>{e.name===s&&t.push(e)}),this.onRegisterPlugin.forEach(e=>{e.name===s&&t.push(e)}),t}register(s){s.activeEvent==="onStartupFinished"?this.onStartupFinishedPlugin.push(s):s.activeEvent==="onRegister"&&(this.onRegisterPlugin.push(s),s.activate(this))}unRegister(s){s.activeEvent==="onStartupFinished"?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(s),1):s.activeEvent==="onRegister"&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(s),1),s.deactivate(this)}release(...s){this.onStartupFinishedPlugin.forEach(t=>{t.deactivate(this)}),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach(t=>{t.deactivate(this)}),this.onRegisterPlugin=[]}};hy=sW([ct(),nk(0,Dt(Qe)),nk(0,gi(cu)),nW("design:paramtypes",[Object])],hy);const rW=new Pt(s=>{s(mR).to(hy),r3(s,cu)}),aW=new Pt(s=>{Ci(s,w_)}),oW=new Pt(s=>{s(P0).to(E0).inSingletonScope(),Ci(s,P0)});var lW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},hW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Lg=class{constructor(){this.type="static",this.offscreen=!1,this.global=tt.global}setDpr(s){this.canvas.dpr=s}init(s,t,e){if(this.layer=s,this.window=t,e.main)this.main=!0,this.context=t.getContext(),this.canvas=this.context.getCanvas();else{let i;this.main=!1,e.canvasId&&(i=this.global.getElementById(e.canvasId)),i||(i=this.global.createCanvas({width:t.width,height:t.height})),i.style&&(i.style["pointer-events"]="none");const n=t.getContext().getCanvas().nativeCanvas,r=rg({nativeCanvas:i,width:t.width,height:t.height,dpr:t.dpr,id:e.canvasId,canvasControled:!0,container:t.getContainer(),x:n.offsetLeft,y:n.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(s,t){this.canvas.resize(s,t)}resizeView(s,t){}render(s,t,e){var i;if(!this.main){const n=this.window.getContext().getCanvas().nativeCanvas;!n||this.canvas.x===n.offsetLeft&&this.canvas.y===n.offsetTop||(this.canvas.x=n.offsetLeft,this.canvas.y=n.offsetTop,this.canvas.applyPosition())}t.renderService.render(s,Object.assign(Object.assign({context:this.context,clear:(i=t.background)!==null&&i!==void 0?i:"#ffffff"},t),e))}merge(s){s.forEach(t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)})}prepare(s,t){}drawTo(s,t,e){var i;const n=s.getContext();e.renderService.render(t,Object.assign(Object.assign({context:n},e),{clear:e.clear?(i=e.background)!==null&&i!==void 0?i:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Lg=lW([ct(),hW("design:paramtypes",[])],Lg);var dW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},uW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Bg=class{constructor(){this.offscreen=!1,this.type="virtual",this.global=tt.global}setDpr(s){}init(s,t,e){if(this.layer=s,this.window=t,e.main)throw new Error("virtual layer不能作为main layer");this.main=!1,this.canvas=null,this.context=null}resize(s,t){}resizeView(s,t){}render(s,t,e){this.mainHandler.render(s,t,Object.assign(Object.assign({},e),{clear:!1}))}merge(s){}prepare(s,t){}drawTo(s,t,e){var i;const n=s.getContext();e.renderService.render(t,Object.assign(Object.assign({context:n},e),{clear:e.clear?(i=e.background)!==null&&i!==void 0?i:"#fff":void 0}))}getContext(){return null}release(){}};Bg=dW([ct(),uW("design:paramtypes",[])],Bg);var cW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},pW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Ig=class{constructor(){this.offscreen=!0,this.type="dynamic",this.global=tt.global}setDpr(s){this.canvas.dpr=s}init(s,t,e){this.layer=s;const i=this.global.createOffscreenCanvas({width:e.width,height:e.height,dpr:t.dpr}),n=rg({nativeCanvas:i,width:e.width,height:e.height,dpr:t.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(s,t){this.canvas.resize(s,t)}resizeView(s,t){this.canvas.resize(s,t)}render(s,t){var e;t.renderService.render(s,Object.assign(Object.assign({context:this.context},t),{x:0,y:0,clear:(e=t.background)!==null&&e!==void 0?e:"#ffffff"}))}prepare(s,t){}release(){this.canvas.release()}getContext(){return this.context}drawTo(s,t,e){const i=s.getContext(),n=s.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=e;i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),e.clear&&i.clearRect(r,a,o,l),i.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),i.nativeContext.restore()}merge(s){}};Ig=cW([ct(),pW("design:paramtypes",[])],Ig);const gW=new Pt(s=>{s(Lg).toSelf(),s(Ig).toSelf(),s(Bg).toSelf(),s(qE).toService(Lg),s(ZE).toService(Ig),s(JE).toService(Bg)});function fW(s){s.load(aW),s.load(oW),s.load(gW)}var _W=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};function vR(s,t,e,i=!1,n=!1){const r={},a=[];let o=!1;if(n)o=!0;else{let l;s.forEachChildren((h,d)=>{const{zIndex:u=t}=h.attribute;if(d===0)l=u;else if(l!==u)return o=!0,!0;return!1},i)}if(o){s.forEachChildren(h=>{const{zIndex:d=t}=h.attribute;r[d]?r[d].push(h):(r[d]=[h],a.push(d))},i),a.sort((h,d)=>i?d-h:h-d);let l=!1;for(let h=0;h<a.length&&!l;h++){const d=a[h],u=r[d];n&&u.sort((c,p)=>{var g,f;return(i?-1:1)*(((g=p.attribute.z)!==null&&g!==void 0?g:0)-((f=c.attribute.z)!==null&&f!==void 0?f:0))});for(let c=0;c<u.length;c++)if(e(u[c],c)){l=!0;break}}}else s.forEachChildren(e,i)}function rk(s,t,e,i=!1){return _W(this,void 0,void 0,function*(){yield s.forEachChildrenAsync(e,i)})}function mW(s,t,e,i=!1){const n={},r=[];let a=!1;s.forEachChildren((h,d)=>{const{zIndex:u=e}=h.attribute;if(d!==0){if(u!==void 0)return a=!0,!0}return!1},i);let o=null,l=!1;if(a){s.forEachChildren(d=>{const{zIndex:u=e}=d.attribute;n[u]?n[u].push(d):(n[u]=[d],r.push(u))},i),r.sort((d,u)=>i?u-d:d-u);let h=!1;for(let d=0;d<r.length&&!h;d++){const u=r[d],c=n[u];for(let p=0;p<c.length;p++){if(l){h=!0,o=c[p];break}c[p]._uid!==t||(l=!0)}}}else s.forEachChildren(h=>l?(o=h,!0):(h._uid===t&&(l=!0),!1),i);return o}var vW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},yW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};const Fg=Symbol.for("DrawItemInterceptor"),ak=new Me;class bW{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx)&&this.drawItem(t,e,i,n,r),!1}beforeDrawItem(t,e,i,n,r){return t.attribute.shadowRootIdx<0&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.shadowRoot)return!1;const{context:a}=i;if(a.highPerformanceSave(),a.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){ak.copy(n.dirtyBounds);const o=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(o)}return n.renderGroup(t.shadowRoot,i,t.parent.globalTransMatrix),a.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(ak),!0}}class xW{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.attribute._debug_bounds)return!1;const{context:a}=i;a.highPerformanceSave(),t.parent&&a.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&a.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const o=t.AABBBounds;return t.attribute._debug_bounds!==!0&&t.attribute._debug_bounds(a,t),a.strokeRect(o.x1,o.y1,o.width(),o.height()),a.highPerformanceRestore(),!0}}let jg=class{constructor(){this.order=1,this.interceptors=[new bW,new AW,new SW,new xW]}afterDrawItem(s,t,e,i,n){for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].afterDrawItem&&this.interceptors[r].afterDrawItem(s,t,e,i,n))return!0;return!1}beforeDrawItem(s,t,e,i,n){if((!s.in3dMode||e.in3dInterceptor)&&!s.shadowRoot&&!(s.baseGraphic||s.attribute.globalZIndex||s.interactiveGraphic))return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].beforeDrawItem&&this.interceptors[r].beforeDrawItem(s,t,e,i,n))return!0;return!1}};jg=vW([ct(),yW("design:paramtypes",[])],jg);class SW{constructor(){this.order=1}beforeDrawItem(t,e,i,n,r){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,n,r):this.beforeSetInteractive(t,e,i,n,r))}beforeSetInteractive(t,e,i,n,r){let a=t.interactiveGraphic;if(t.attribute.globalZIndex){a||(a=t.clone(),t.interactiveGraphic=a,a.baseGraphic=t),a.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const o=i.stage.getLayer("_builtin_interactive");return o&&this.getShadowRoot(o).add(a),!0}if(a){i.stage.tryInitInteractiveLayer();const o=i.stage.getLayer("_builtin_interactive");o&&this.getShadowRoot(o).removeChild(a),t.interactiveGraphic=null,a.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,n,r){const a=t.baseGraphic;if(a){this.processing=!0;const{context:o}=i;return o.highPerformanceSave(),o.setTransformFromMatrix(a.parent.globalTransMatrix,!0),a.isContainer?n.renderGroup(a,i,a.parent.globalTransMatrix):n.renderItem(a,i),o.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=pt.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),(e=i.shadowRoot)!==null&&e!==void 0?e:i.attachShadow()}}class AW{constructor(){this.order=1}beforeDrawItem(t,e,i,n,r){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:a,stage:o}=e.drawParams;a.canvas,a.save(),this.initCanvasCtx(a),a.camera=o.camera;const l=a.currentMatrix;l.a/=a.dpr,l.b/=a.dpr,l.c/=a.dpr,l.d/=a.dpr,l.e/=a.dpr,l.f/=a.dpr;const h=ce.allocate();q0(h,l);const d=a.modelMatrix;if(d){if(h){const u=ce.allocate();a.modelMatrix=oc(u,d,h)}}else a.modelMatrix=h;if(a.setTransform(1,0,0,1,0,0,!0),t.isContainer){let u=!1,c=!1;if(t.forEachChildren(p=>(u=p.numberType===nc,!u)),t.forEachChildren(p=>(c=!!p.findFace,!c)),u){const p=t.getChildren(),g=[...p];g.sort((_,m)=>{var v,y,b,x;let S=(((v=_.attribute.startAngle)!==null&&v!==void 0?v:0)+((y=_.attribute.endAngle)!==null&&y!==void 0?y:0))/2,A=(((b=m.attribute.startAngle)!==null&&b!==void 0?b:0)+((x=m.attribute.endAngle)!==null&&x!==void 0?x:0))/2;for(;S<0;)S+=It;for(;A<0;)A+=It;return A-S}),g.forEach(_=>{_._next=null,_._prev=null}),t.removeAllChild(),t.update(),g.forEach(_=>{t.appendChild(_)});const f=t.parent.globalTransMatrix;i.hack_pieFace="outside",n.renderGroup(t,i,f),i.hack_pieFace="inside",n.renderGroup(t,i,f),i.hack_pieFace="top",n.renderGroup(t,i,f),t.removeAllChild(),p.forEach(_=>{_._next=null,_._prev=null}),p.forEach(_=>{t.appendChild(_)})}else if(c){const p=t.getChildren(),g=p.map(f=>({ave_z:f.findFace().vertices.map(_=>{var m;return a.view(_[0],_[1],(m=_[2]+f.attribute.z)!==null&&m!==void 0?m:0)[2]}).reduce((_,m)=>_+m,0),g:f}));g.sort((f,_)=>_.ave_z-f.ave_z),t.removeAllChild(),g.forEach(f=>{f.g._next=null,f.g._prev=null}),t.update(),g.forEach(f=>{t.add(f.g)}),n.renderGroup(t,i,t.parent.globalTransMatrix,!0),t.removeAllChild(),p.forEach(f=>{f._next=null,f._prev=null}),t.update(),p.forEach(f=>{t.add(f)})}else n.renderGroup(t,i,t.parent.globalTransMatrix)}else n.renderItem(t,i);return a.camera=null,a.restore(),a.modelMatrix!==d&&ce.free(a.modelMatrix),a.modelMatrix=d,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var kW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},wW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},dv=function(s,t){return function(e,i){t(e,i,s)}};let zg=class{constructor(s,t){this.contributions=s,this.drawItemInterceptorContributions=t,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new yi,this.backupDirtyBounds=new yi,this.global=tt.global,this.layerService=tt.layerService,this.init()}init(){this.contributions.forEach(s=>{if(s.style){const t=this.styleRenderMap.get(s.style)||new Map;t.set(s.numberType,s),this.styleRenderMap.set(s.style,t)}else this.defaultRenderMap.set(s.numberType,s)}),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort((s,t)=>s.order-t.order)}prepareForDraw(s,t){t.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!t.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(s,t){this.prepareForDraw(s,t),t.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(t.renderStyle)||this.defaultRenderMap,this.currentRenderService=s;const{context:e,stage:i,x:n=0,y:r=0,width:a,height:o}=t;if(!e)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(i.dirtyBounds&&!i.dirtyBounds.empty()){const u=oP(l,i.dirtyBounds);l.x1=Math.floor(u.x1),l.y1=Math.floor(u.y1),l.x2=Math.ceil(u.x2),l.y2=Math.ceil(u.y2)}const h=e.dpr%1;(h||h!==.5)&&(l.x1=Math.floor(l.x1*e.dpr)/e.dpr,l.y1=Math.floor(l.y1*e.dpr)/e.dpr,l.x2=Math.ceil(l.x2*e.dpr)/e.dpr,l.y2=Math.ceil(l.y2*e.dpr)/e.dpr),this.backupDirtyBounds.copy(l),e.inuse=!0,e.clearMatrix(),e.setTransformForCurrent(!0);const d=l.width()*e.dpr<e.canvas.width||l.height()*e.dpr<e.canvas.height;e.save(),e.translate(n,r,!0),d&&(e.beginPath(),e.rect(l.x1,l.y1,l.width(),l.height()),e.clip()),i.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(s,e,t),e.save(),s.renderTreeRoots.sort((u,c)=>{var p,g;return((p=u.attribute.zIndex)!==null&&p!==void 0?p:Re.zIndex)-((g=c.attribute.zIndex)!==null&&g!==void 0?g:Re.zIndex)}).forEach(u=>{u.isContainer?this.renderGroup(u,t,Ys.allocate(1,0,0,1,0,0)):this.renderItem(u,t)}),e.restore(),e.restore(),e.draw(),e.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(s){let t=s.parent,e=s._uid;for(;t;){const i=mW(t,e,Re.zIndex);if(i)return i;e=t._uid,t=t.parent}return null}renderGroup(s,t,e,i){if(t.break||s.attribute.visibleAll===!1)return;if(s.incremental&&(t.startAtId==null||t.startAtId===s._uid))return t.break=!0,void this._increaseRender(s,t);if(this.useDirtyBounds&&!Kd(s.AABBBounds,this.dirtyBounds,!1))return;let n,r=e;if(this.useDirtyBounds){n=xg.allocateByObj(this.dirtyBounds);const a=s.transMatrix;r=Ys.allocateByObj(e).multiply(a.a,a.b,a.c,a.d,a.e,a.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(s,t,{drawingCb:()=>{var a;i?s.forEachChildren(o=>{t.break||(o.isContainer?this.renderGroup(o,t,r):this.renderItem(o,t))}):vR(s,Re.zIndex,o=>{t.break||(o.isContainer?this.renderGroup(o,t,r):this.renderItem(o,t))},!1,!!(!((a=t.context)===null||a===void 0)&&a.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),xg.free(n),Ys.free(r))}_increaseRender(s,t){const{layer:e,stage:i}=t,{subLayers:n}=e;let r=n.get(s._uid);r||(r={layer:this.layerService.createLayer(i),zIndex:n.size,group:s},n.set(s._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Ct.get(fR);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},t),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:s._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(s);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,t);else{let h=n.get(l._uid);h||(h={layer:this.layerService.createLayer(i),zIndex:n.size},n.set(l._uid,h));const d=h.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},t),{drawContribution:o,clear:"transparent",layer:h.layer,context:d,startAtId:l._uid,break:!1}))}}getRenderContribution(s){let t;return t||(t=this.selectRenderByNumberType(s.numberType)),t||(t=this.selectRenderByType(s.type)),t}renderItem(s,t,e){if(this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.beforeDrawItem&&l.beforeDrawItem(s,this.currentRenderService,t,this,e))return}const i=this.getRenderContribution(s);if(!i)return;let n,r=!1;if(s.parent){const{scrollX:o=0,scrollY:l=0}=s.parent.attribute;if(r=!(!o&&!l),r){n=this.dirtyBounds.clone();const h=s.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(h),this.dirtyBounds.translate(-o,-l)}}if(this.useDirtyBounds&&!s.isContainer&&!Kd(s.AABBBounds,this.dirtyBounds,!1))return void(r&&this.dirtyBounds.copy(n));const a=t.startAtId!=null&&s._uid!==t.startAtId;if(s._uid===t.startAtId&&(t.startAtId=null),e&&(e.skipDraw=a),a?s.isContainer&&i.draw(s,this.currentRenderService,t,e):i.draw(s,this.currentRenderService,t,e),r&&this.dirtyBounds.copy(n),this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.afterDrawItem&&l.afterDrawItem(s,this.currentRenderService,t,this))return}}selectRenderByType(s){return zt.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(s){return this.currentRenderMap.get(s)||this.defaultRenderMap.get(s)}clearScreen(s,t,e){var i,n;const{clear:r}=e;if(r){const a=t.getCanvas(),{width:o=a.width,height:l=a.height}=e,h=0,d=0;t.clearRect(h,d,o,l);const u=(i=s.drawParams)===null||i===void 0?void 0:i.stage;if(u&&(t.globalAlpha=(n=u.attribute.opacity)!==null&&n!==void 0?n:1),u&&u.backgroundImg&&u.resources){const c=u.resources.get(r);c&&c.state==="success"&&c.data&&t.drawImage(c.data,h,d,o,l)}else t.fillStyle=J0(t,r,{AABBBounds:{x1:h,y1:d,x2:h+o,y2:d+l}},0,0),t.fillRect(h,d,o,l)}}afterDraw(s,t){}};zg=kW([ct(),dv(0,oE(_i)),dv(1,Dt(Qe)),dv(1,gi(Fg)),wW("design:paramtypes",[Array,Object])],zg);var TW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},MW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},ok=function(s,t){return function(e,i){t(e,i,s)}};let dy=class{constructor(s){this.groupRenderContribitions=s,this.numberType=Qb}drawShape(s,t,e,i,n,r,a,o){const l=rt(s,r==null?void 0:r.theme).group,{fill:h=l.fill,background:d,stroke:u=l.stroke,opacity:c=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:_=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:y=l.path,lineWidth:b=l.lineWidth,visible:x=l.visible}=s.attribute,S=rx(c,_,p,g,h),A=ox(c,m,p,g),k=yo(h,d),w=Ch(u,b);if(!s.valid||!x||!f&&(!k&&!w||!(S||A||a||o||d)))return;if(y&&y.length&&n.drawContribution){const M=t.disableFill,P=t.disableStroke,O=t.disableBeginPath;t.disableFill=!0,t.disableStroke=!0,t.disableBeginPath=!0,y.forEach(D=>{n.drawContribution.getRenderContribution(D).draw(D,n.renderService,n,r)}),t.disableFill=M,t.disableStroke=P,t.disableBeginPath=O}else v===0||U(v)&&v.every(M=>M===0)?(t.beginPath(),t.rect(e,i,p,g)):(t.beginPath(),lo(t,e,i,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(aG));const T={doFill:k,doStroke:w};this._groupRenderContribitions.forEach(M=>{M.time===fi.beforeFillStroke&&M.drawShape(s,t,e,i,k,w,S,A,l,n,a,o,T)}),f&&t.clip(),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,l),T.doFill&&(a?a(t,s.attribute,l):S&&(t.setCommonStyle(s,s.attribute,e,i,l),t.fill())),T.doStroke&&(o?o(t,s.attribute,l):A&&(t.setStrokeStyle(s,s.attribute,e,i,l),t.stroke())),this._groupRenderContribitions.forEach(M=>{M.time===fi.afterFillStroke&&M.drawShape(s,t,e,i,k,w,S,A,l,n,a,o)})}draw(s,t,e,i){const{context:n}=e;if(!n)return;const{clip:r}=s.attribute;r?n.save():n.highPerformanceSave();const a=rt(s,i==null?void 0:i.theme).group,o=n.modelMatrix;if(n.camera){const u=ce.allocate(),c=ce.allocate();uR(c,s,a),oc(u,o||u,c),n.modelMatrix=u,ce.free(c),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(s.transMatrix,!0);n.beginPath(),i.skipDraw?this.drawShape(s,n,0,0,e,i,()=>!1,()=>!1):this.drawShape(s,n,0,0,e);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=s.attribute;let d;(l||h)&&n.translate(l,h),i&&i.drawingCb&&(d=i.drawingCb()),n.modelMatrix!==o&&ce.free(n.modelMatrix),n.modelMatrix=o,d&&d.then?d.then(()=>{r?n.restore():n.highPerformanceRestore()}):r?n.restore():n.highPerformanceRestore()}};dy=TW([ct(),ok(0,Dt(Qe)),ok(0,gi(tR)),MW("design:paramtypes",[Object])],dy);var CW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Hg=class extends du{constructor(){super(...arguments),this.numberType=ac}drawShape(s,t,e,i,n,r,a,o){if(s.incremental&&n.multiGraphicOptions){const{startAtIdx:l,length:h}=n.multiGraphicOptions,{segments:d=[]}=s.attribute;if(l>d.length)return;const u=rt(s).line,{fill:c=u.fill,stroke:p=u.stroke,opacity:g=u.opacity,fillOpacity:f=u.fillOpacity,strokeOpacity:_=u.strokeOpacity,lineWidth:m=u.lineWidth,visible:v=u.visible}=s.attribute,y=ao(g,f,c),b=ax(g,_),x=yo(c),S=Ch(p,m);if(!s.valid||!v||!x&&!S||!(y||b||a||o))return;const{context:A}=n;for(let k=l;k<l+h;k++)this.drawIncreaseSegment(s,A,d[k-1],d[k],s.attribute.segments[k],[u,s.attribute],e,i)}else super.drawShape(s,t,e,i,n,r,a,o)}drawIncreaseSegment(s,t,e,i,n,r,a,o){i&&(t.beginPath(),AG(t.nativeContext,e,i,{offsetX:a,offsetY:o}),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,n,r),t.setStrokeStyle(s,n,a,o,r),t.stroke())}};Hg=CW([ct()],Hg);var PW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Gg=class extends uu{constructor(){super(...arguments),this.numberType=rc}drawShape(s,t,e,i,n,r,a){if(s.incremental&&n.multiGraphicOptions){const{startAtIdx:o,length:l}=n.multiGraphicOptions,{segments:h=[]}=s.attribute;if(o>h.length)return;const d=rt(s).area,{fill:u=d.fill,fillOpacity:c=d.fillOpacity,opacity:p=d.opacity,visible:g=d.visible}=s.attribute,f=ao(p,c,u),_=yo(u);if(!s.valid||!g||!_||!f&&!a)return;for(let m=o;m<o+l;m++)this.drawIncreaseSegment(s,t,h[m-1],h[m],s.attribute.segments[m],[d,s.attribute],e,i)}else super.drawShape(s,t,e,i,n,r,a)}drawIncreaseSegment(s,t,e,i,n,r,a,o){i&&(t.beginPath(),kG(t.camera?t:t.nativeContext,e,i,{offsetX:a,offsetY:o}),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,n,r),t.setCommonStyle(s,n,a,o,r),t.fill())}};Gg=PW([ct()],Gg);var Zo,EW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},RW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Uh=function(s,t){return function(e,i){t(e,i,s)}},Mn=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};(function(s){s[s.NORMAL=0]="NORMAL",s[s.STOP=1]="STOP"})(Zo||(Zo={}));let uy=class extends zg{constructor(s,t,e,i){super(s,i),this.contributions=s,this.lineRender=t,this.areaRender=e,this.drawItemInterceptorContributions=i,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Zo.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new As([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(s,t){return Mn(this,void 0,void 0,function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=s,this.lastDrawContext=t,this.checkingForDrawPromise=this.checkForDraw(t);const e=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,e)return;this.currentRenderService=s;const{context:i,x:n=0,y:r=0}=t;i&&(i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0),i.save(),t.restartIncremental&&this.clearScreen(this.currentRenderService,i,t),i.translate(n,r,!0),i.save(),s.renderTreeRoots.sort((a,o)=>{var l,h;return((l=a.attribute.zIndex)!==null&&l!==void 0?l:Re.zIndex)-((h=o.attribute.zIndex)!==null&&h!==void 0?h:Re.zIndex)}).forEach(a=>{this.renderGroup(a,t)}),this.hooks.completeDraw.tap("top-draw",()=>{i.restore(),i.restore(),i.draw(),i.inuse=!1,this.rendering=!1}))})}_increaseRender(s,t){return Mn(this,void 0,void 0,function*(){this.rendering=!0,yield this._renderIncrementalGroup(s,t)})}_renderIncrementalGroup(s,t){return Mn(this,void 0,void 0,function*(){this.count=s.count,yield new Promise(e=>{this.renderItem(s,t,{drawingCb:()=>Mn(this,void 0,void 0,function*(){if(s.count!==2)yield rk(s,Re.zIndex,(i,n)=>{if(this.status===Zo.STOP)return!0;if(i.isContainer||n<this.currentIdx)return!1;const r=this.currFrameStartAt+s.incremental;return n<r&&(this.currentIdx=n+1,this.renderItem(i,t)),n===r-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())}),e(!1);else{const i=s.getChildAt(0);if(i.incremental&&i.attribute.segments)for(i.incrementalAt||(i.incrementalAt=0);i.incrementalAt<i.attribute.segments.length;)t.multiGraphicOptions={startAtIdx:i.incrementalAt,length:i.incremental},this.renderItem(i,t),i.incrementalAt+=i.incremental,yield this.waitToNextFrame();else this.renderItem(i,t);e(!1)}})})}),this.hooks.completeDraw.call()})}waitToNextFrame(){return Mn(this,void 0,void 0,function*(){return new Promise(s=>{this.global.getRequestAnimationFrame()(()=>{s(!1)})})})}checkForDraw(s){return Mn(this,void 0,void 0,function*(){let t=this.rendering;return s.restartIncremental&&(t=!1,yield this.forceStop(),this.resetToInit()),t})}forceStop(){return Mn(this,void 0,void 0,function*(){this.rendering&&(this.status=Zo.STOP,yield new Promise(s=>{this.hooks.completeDraw.tap("stopCb",()=>{this.status=Zo.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter(t=>t.name!=="stopCb"),s(!1)})}))})}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(s,t){return Mn(this,void 0,void 0,function*(){if(!t.break&&s.attribute.visibleAll!==!1)return s.incremental&&t.startAtId===s._uid?(yield this._increaseRender(s,t),void(t.break=!0)):void(yield new Promise(e=>{this.renderItem(s,t,{drawingCb:()=>Mn(this,void 0,void 0,function*(){yield rk(s,Re.zIndex,i=>Mn(this,void 0,void 0,function*(){t.break||i.isContainer&&(yield this.renderGroup(i,t))})),e(!1)})})}))})}};uy=EW([ct(),Uh(0,oE(_i)),Uh(1,Dt(Hg)),Uh(2,Dt(Gg)),Uh(3,Dt(Qe)),Uh(3,gi(Fg)),RW("design:paramtypes",[Array,Object,Object,Object])],uy);const OW=new Pt(s=>{s(hc).toSelf().inSingletonScope(),s(gx).toSelf().inSingletonScope(),s(fx).to(zg),s(fR).to(uy),s(ek).to(dy).inSingletonScope(),s(_i).toService(ek),Ci(s,tR),s(Js).toSelf().inSingletonScope(),Ci(s,lx),Ci(s,_i),s(jg).toSelf().inSingletonScope(),s(Fg).toService(jg),Ci(s,Fg)});function DW(s){s.load(OW)}function Wg(){Wg.__loaded||(Wg.__loaded=!0,Ct.load(gH),Ct.load(iW),Ct.load(tW),Ct.load(eW),Ct.load(rW),fW(Ct),DW(Ct))}Wg.__loaded=!1,Wg();const Ht=Ct.get(Vb);tt.global=Ht;const LW=Ct.get(KE);tt.graphicUtil=LW;const BW=Ct.get(XE);tt.transformUtil=BW;const IW=Ct.get(UE);tt.graphicService=IW;const FW=Ct.get(nx);tt.layerService=FW;class jW{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Xe.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,tt.graphicService.hooks.onAttributeUpdate.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&e.stage!=null&&e.stage.renderNextFrame()}),tt.graphicService.hooks.onSetStage.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&e.stage!=null&&e.stage.renderNextFrame()})}deactivate(t){tt.graphicService.hooks.onAttributeUpdate.taps=tt.graphicService.hooks.onAttributeUpdate.taps.filter(e=>e.name!==this.key),tt.graphicService.hooks.onSetStage.taps=tt.graphicService.hooks.onSetStage.taps.filter(e=>e.name!==this.key)}}class zW{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Xe.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=t.page.x-this.pageX,a=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const o=r/100,l=a/100;this.option3d.alpha=((e=this.option3d.alpha)!==null&&e!==void 0?e:0)+o,this.option3d.beta=((i=this.option3d.beta)!==null&&i!==void 0?i:0)+l,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class HW{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Xe.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,tt.graphicService.hooks.onAddIncremental.tap(this.key,(e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&e.stage!=null&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))}),tt.graphicService.hooks.onClearIncremental.tap(this.key,(e,i)=>{e.stage===t.stage&&e.stage!=null&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})}deactivate(t){tt.graphicService.hooks.onAddIncremental.taps=tt.graphicService.hooks.onAddIncremental.taps.filter(e=>e.name!==this.key),tt.graphicService.hooks.onClearIncremental.taps=tt.graphicService.hooks.onClearIncremental.taps.filter(e=>e.name!==this.key)}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,tt.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach(e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))}),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}class GW{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Xe.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}),tt.graphicService.hooks.onRelease.tap(this.key,e=>{this.removeDom(e)})}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter(e=>e.name!==this.key)}drawHTML(t){tt.global.env==="browser"&&t.renderTreeRoots.sort((e,i)=>{var n,r;return((n=e.attribute.zIndex)!==null&&n!==void 0?n:Re.zIndex)-((r=i.attribute.zIndex)!==null&&r!==void 0?r:Re.zIndex)}).forEach(e=>{this.renderGroupHTML(e)})}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren(e=>{e.isContainer?this.renderGroupHTML(e):this.renderGraphicHTML(e)})}removeDom(t){t.bindDom&&t.bindDom.size&&(t.bindDom.forEach(e=>{e.dom&&e.dom.parentElement.removeChild(e.dom)}),t.bindDom.clear())}renderGraphicHTML(t){const{html:e}=t.attribute;if(!e)return void(t.bindDom&&t.bindDom.size&&(t.bindDom.forEach(S=>{S.dom&&S.dom.parentElement.removeChild(S.dom)}),t.bindDom.clear()));const i=t.stage;if(!i)return;const{dom:n,container:r,width:a,height:o,style:l,anchorType:h="boundsLeftTop"}=e;t.bindDom||(t.bindDom=new Map);const d=t.bindDom.get(n);if(d&&(!r||r===d.container))return;let u,c;t.bindDom.forEach(({wrapGroup:S})=>{tt.global.removeDom(S)}),typeof n=="string"?(u=new DOMParser().parseFromString(n,"text/html").firstChild,u.lastChild&&(u=u.lastChild.firstChild)):u=n;const p=r||(i.params.enableHtmlAttribute===!0?null:i.params.enableHtmlAttribute);c=p?typeof p=="string"?tt.global.getElementById(p):p:t.stage.window.getContainer();const g=tt.global.createDom({tagName:"div",width:a,height:o,style:l,parent:c});g&&(g.appendChild(u),t.bindDom.set(n,{dom:u,container:r,wrapGroup:g})),g.style.pointerEvents="none",g.style.position||(g.style.position="absolute",c.style.position="relative");let f=0,_=0;const m=t.globalAABBBounds;if(h==="position"||m.empty()){const S=t.globalTransMatrix;f=S.e,_=S.f}else f=m.x1,_=m.y1;const v=tt.global.getElementTopLeft(c,!1),y=i.window.getTopLeft(!1),b=f+y.left-v.left,x=_+y.top-v.top;g.style.left=`${b}px`,g.style.top=`${x}px`}}const lk=new Me;class WW{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Xe.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,e=>{e&&e===this.pluginService.stage&&e.dirtyBounds.clear()}),tt.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(e,i,n,r)=>{e.glyphHost&&(e=e.glyphHost),i&&i===this.pluginService.stage&&i.renderCount&&(e.isContainer&&!e.shouldSelfChangeUpdateAABBBounds()||n&&(lk.setValue(r.x1,r.y1,r.x2,r.y2),i.dirty(lk,e.parent&&e.parent.globalTransMatrix)))}),tt.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(e,i,n,r,a)=>{i&&i===this.pluginService.stage&&i.renderCount&&(e.isContainer&&!a||i.dirty(r.globalAABBBounds))}),tt.graphicService.hooks.onRemove.tap(this.key,e=>{const i=e.stage;i&&i===this.pluginService.stage&&i.renderCount&&i&&i.dirty(e.globalAABBBounds)})}deactivate(t){tt.graphicService.hooks.beforeUpdateAABBBounds.taps=tt.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(e=>e.name!==this.key),tt.graphicService.hooks.afterUpdateAABBBounds.taps=tt.graphicService.hooks.afterUpdateAABBBounds.taps.filter(e=>e.name!==this.key),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter(e=>e.name!==this.key),tt.graphicService.hooks.onRemove.taps=tt.graphicService.hooks.onRemove.taps.filter(e=>e.name!==this.key)}}const hk=new Me;class NW{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Xe.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Me}tryLayout(t){if(this.layouting)return;this.layouting=!0;const e=t.parent;if(!e||!t.needUpdateLayout())return;const i=rt(e).group,{display:n=i.display}=e.attribute;if(n!=="flex")return;const{flexDirection:r=i.flexDirection,flexWrap:a=i.flexWrap,justifyContent:o=i.justifyContent,alignItems:l=i.alignItems,alignContent:h=i.alignContent,clip:d=i.clip}=e.attribute;let u=0,c=0,p=0;if(e.forEachChildren(w=>{const T=w.AABBBounds;r==="column"||r==="column-reverse"?(c+=T.height(),u=Math.max(u,T.width())):(u+=T.width(),c=Math.max(c,T.height())),p+=T.x1,p+=T.y1,p+=T.x2,p+=T.y2}),!isFinite(p))return;const g=e.attribute.width||u,f=e.attribute.height||c;e.attribute.width||(e.attribute.width=0),e.attribute.height||(e.attribute.height=0),this.tempBounds.copy(e._AABBBounds);const _={main:{len:g,field:"x"},cross:{len:f,field:"y"},dir:1},m=_.main,v=_.cross;r==="row-reverse"?_.dir=-1:r==="column"?(m.len=f,v.len=g,m.field="y",v.field="x"):r==="column-reverse"&&(m.len=f,v.len=g,m.field="y",v.field="x",_.dir=-1);let y=0,b=0;const x=[];e.forEachChildren(w=>{const T=w.AABBBounds,M=m.field==="x"?T.width():T.height(),P=v.field==="x"?T.width():T.height();x.push({mainLen:M,crossLen:P}),y+=M,b=Math.max(b,P)});const S=[];if(y>m.len&&a==="wrap"){let w=0,T=0;x.forEach(({mainLen:M,crossLen:P},O)=>{w+M>m.len?w===0?(S.push({idx:O,mainLen:w+M,crossLen:P}),w=0,T=0):(S.push({idx:O-1,mainLen:w,crossLen:P}),w=M,T=P):(w+=M,T=Math.max(T,P))}),S.push({idx:x.length-1,mainLen:w,crossLen:T})}else S.push({idx:x.length-1,mainLen:y,crossLen:b});const A=e.getChildren();let k=0;if(S.forEach(w=>{this.layoutMain(e,A,o,m,x,k,w),k=w.idx+1}),b=S.reduce((w,T)=>w+T.crossLen,0),S.length===1)if(l==="flex-end"){const w=v.len;this.layoutCross(A,l,v,w,x,S[0],0)}else if(l==="center"){const w=v.len/2;this.layoutCross(A,l,v,w,x,S[0],0)}else A.forEach(w=>{w.attribute[v.field]=rn(w,v.field)});else if(h==="flex-start"){k=0;let w=0;S.forEach((T,M)=>{this.layoutCross(A,"flex-start",v,w,x,S[M],k),k=T.idx+1,w+=T.crossLen})}else if(h==="center"){k=0;let w=Math.max(0,(v.len-b)/2);S.forEach((T,M)=>{this.layoutCross(A,"center",v,w+T.crossLen/2,x,S[M],k),k=T.idx+1,w+=T.crossLen})}else if(h==="space-around"){k=0;const w=Math.max(0,(v.len-b)/S.length/2);let T=w;S.forEach((M,P)=>{this.layoutCross(A,"flex-start",v,T,x,S[P],k),k=M.idx+1,T+=M.crossLen+2*w})}else if(h==="space-between"){k=0;const w=Math.max(0,(v.len-b)/(2*S.length-2));let T=0;S.forEach((M,P)=>{this.layoutCross(A,"flex-start",v,T,x,S[P],k),k=M.idx+1,T+=M.crossLen+2*w})}A.forEach((w,T)=>{w.addUpdateBoundTag(),w.addUpdatePositionTag(),w.clearUpdateLayoutTag()}),e.addUpdateLayoutTag(),d||this.tempBounds.equals(e.AABBBounds)||(this.tryLayout(e),this.layouting=!1)}layoutMain(t,e,i,n,r,a,o){if(i==="flex-start"){let l=0;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+rn(e[h],n.field),l+=r[h].mainLen}else if(i==="flex-end"){let l=n.len;for(let h=a;h<=o.idx;h++)l-=r[h].mainLen,e[h].attribute[n.field]=l+rn(e[h],n.field)}else if(i==="space-around")if(o.mainLen>=n.len){let l=0;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+rn(e[h],n.field),l+=r[h].mainLen}else{const l=o.idx-a+1,h=(n.len-o.mainLen)/l/2;let d=h;for(let u=a;u<=o.idx;u++)e[u].attribute[n.field]=d+rn(e[u],n.field),d+=r[u].mainLen+2*h}else if(i==="space-between")if(o.mainLen>=n.len){let l=0;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+rn(e[h],n.field),l+=r[h].mainLen}else{const l=o.idx-a+1,h=(n.len-o.mainLen)/(2*l-2);let d=0;for(let u=a;u<=o.idx;u++)e[u].attribute[n.field]=d+rn(e[u],n.field),d+=r[u].mainLen+2*h}else if(i==="center"){let l=(n.len-o.mainLen)/2;for(let h=a;h<=o.idx;h++)e[h].attribute[n.field]=l+rn(e[h],n.field),l+=r[h].mainLen}}layoutCross(t,e,i,n,r,a,o){if(e==="flex-end")for(let l=o;l<=a.idx;l++)t[l].attribute[i.field]=n-r[l].crossLen+rn(t[l],i.field);else if(e==="center")for(let l=o;l<=a.idx;l++)t[l].attribute[i.field]=n-r[l].crossLen/2+rn(t[l],i.field);else for(let l=o;l<=a.idx;l++)t[l].attribute[i.field]=n+rn(t[l],i.field)}activate(t){this.pluginService=t,tt.graphicService.hooks.onAttributeUpdate.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),this.tryLayout(e),this.layouting=!1}),tt.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,(e,i,n,r)=>{e.glyphHost&&(e=e.glyphHost),i&&i===this.pluginService.stage&&e.isContainer&&hk.copy(r)}),tt.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,(e,i,n,r,a)=>{i&&i===this.pluginService.stage&&e.isContainer&&(hk.equals(n)||(this.tryLayout(e),this.layouting=!1))}),tt.graphicService.hooks.onSetStage.tap(this.key,e=>{e.glyphHost&&(e=e.glyphHost),this.tryLayout(e),this.layouting=!1})}deactivate(t){tt.graphicService.hooks.onAttributeUpdate.taps=tt.graphicService.hooks.onAttributeUpdate.taps.filter(e=>e.name!==this.key),tt.graphicService.hooks.onSetStage.taps=tt.graphicService.hooks.onSetStage.taps.filter(e=>e.name!==this.key)}}function rn(s,t){if(!s.attribute.boundsPadding)return 0;if(ez(s.attribute.boundsPadding))return s.attribute.boundsPadding;if(U(s.attribute.boundsPadding)&&s.attribute.boundsPadding.length===1)return s.attribute.boundsPadding[0];const e=bi(s.attribute.boundsPadding);return t==="x"?e[3]:t==="y"?e[0]:0}const mx=new pz;mx.addTimeline(PE);mx.setFPS(60);class VW{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=we.Get(e,Xi.Color1),this.ambient=i;const n=rs(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=vi(ss((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let r;r=ot(e)?we.Get(e,Xi.Color1):e;const a=this.colorRgb;return`rgb(${a[0]*r[0]*n}, ${a[1]*r[1]*n}, ${a[2]*r[2]*n})`}}function UW(s,t,e,i){let n,r,a,o,l,h,d,u,c,p;const g=t[0],f=t[1],_=t[2],m=i[0],v=i[1],y=i[2],b=e[0],x=e[1],S=e[2];return Math.abs(g-b)<se&&Math.abs(f-x)<se&&Math.abs(_-S)<se?G_.identity(s):(d=g-b,u=f-x,c=_-S,p=1/Math.hypot(d,u,c),d*=p,u*=p,c*=p,n=v*c-y*u,r=y*d-m*c,a=m*u-v*d,p=Math.hypot(n,r,a),p?(p=1/p,n*=p,r*=p,a*=p):(n=0,r=0,a=0),o=u*a-c*r,l=c*n-d*a,h=d*r-u*n,p=Math.hypot(o,l,h),p?(p=1/p,o*=p,l*=p,h*=p):(o=0,l=0,h=0),s[0]=n,s[1]=o,s[2]=d,s[3]=0,s[4]=r,s[5]=l,s[6]=u,s[7]=0,s[8]=a,s[9]=h,s[10]=c,s[11]=0,s[12]=-(n*g+r*f+a*_),s[13]=-(o*g+l*f+h*_),s[14]=-(d*g+u*f+c*_),s[15]=1,s)}function $W(s,t,e,i,n,r,a){const o=1/(t-e),l=1/(i-n),h=1/(r-a);return s[0]=-2*o,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=-2*l,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=2*h,s[11]=0,s[12]=(t+e)*o,s[13]=(n+i)*l,s[14]=(a+r)*h,s[15]=1,s}function dk(s,t,e){const i=t[0],n=t[1],r=t[2],a=t[3],o=t[4],l=t[5],h=t[6],d=t[7],u=t[8],c=t[9],p=t[10],g=t[11],f=t[12],_=t[13],m=t[14],v=t[15];let y=e[0],b=e[1],x=e[2],S=e[3];return s[0]=y*i+b*o+x*u+S*f,s[1]=y*n+b*l+x*c+S*_,s[2]=y*r+b*h+x*p+S*m,s[3]=y*a+b*d+x*g+S*v,y=e[4],b=e[5],x=e[6],S=e[7],s[4]=y*i+b*o+x*u+S*f,s[5]=y*n+b*l+x*c+S*_,s[6]=y*r+b*h+x*p+S*m,s[7]=y*a+b*d+x*g+S*v,y=e[8],b=e[9],x=e[10],S=e[11],s[8]=y*i+b*o+x*u+S*f,s[9]=y*n+b*l+x*c+S*_,s[10]=y*r+b*h+x*p+S*m,s[11]=y*a+b*d+x*g+S*v,y=e[12],b=e[13],x=e[14],S=e[15],s[12]=y*i+b*o+x*u+S*f,s[13]=y*n+b*l+x*c+S*_,s[14]=y*r+b*h+x*p+S*m,s[15]=y*a+b*d+x*g+S*v,s}function bs(s,t,e){const i=t[0],n=t[1],r=t[2];let a=e[3]*i+e[7]*n+e[11]*r+e[15];return a=a||1,s[0]=(e[0]*i+e[4]*n+e[8]*r+e[12])/a,s[1]=(e[1]*i+e[5]*n+e[9]*r+e[13])/a,s[2]=(e[2]*i+e[6]*n+e[10]*r+e[14])/a,s}class YW{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=ce.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=ce.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return UW(this._viewMatrixCached,t,e,i),this._vp||(this._vp=ce.allocate()),this._vp=dk(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=ce.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=ce.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return $W(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=ce.allocate()),this._vp=dk(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:n}=this._params;return(e??n-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const n=[0,0,0];return bs(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:r}=this._params.viewParams;bs(n,[t,e,i],this._viewMatrixCached),t=n[0],e=n[1],i=n[2];const a=this.getProjectionScale(i);return{x:t*a+r[0],y:e*a+r[1]}}}let jo;function XW(){if(jo==null)try{jo=globalThis===window,jo&&(jo=!!document.createElement)}catch{jo=!1}}function vx(){XW();const s=tt.global&&tt.global.env;return s?s==="browser":jo}const uk={BACKGROUND:"white"};class KW extends Mh{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return(t=this._background)!==null&&t!==void 0?t:uk.BACKGROUND}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(t={}){var e;super({}),this._onVisibleChange=i=>{this._skipRender<0||(i?(this.dirtyBounds&&this.dirtyBounds.setValue(0,0,this._viewBox.width(),this._viewBox.height()),this._skipRender>1&&this.renderNextFrame(),this._skipRender=0):this._skipRender=1)},this.beforeRender=i=>{this._beforeRender&&this._beforeRender(i)},this.afterRender=i=>{this.renderCount++,this._afterRender&&this._afterRender(i),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach(n=>n(i)),this._afterNextRenderCbs=null},this.params=t,this.theme=new eu,this.hooks={beforeRender:new As(["stage"]),afterRender:new As(["stage"])},this.global=tt.global,!this.global.env&&vx()&&this.global.setEnv("browser"),this.window=Ct.get(ag),this.renderService=Ct.get(_R),this.pluginService=Ct.get(mR),this.layerService=Ct.get(nx),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:t.canvasControled!==!1,title:t.title||"",canvas:t.canvas}),this._viewBox=new Me,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=(e=t.background)!==null&&e!==void 0?e:uk.BACKGROUND,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.disableDirtyBounds===!1&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||mx,this.supportInteractiveLayer=t.interactiveLayer!==!1,this.timeline=new CE,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&ot(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new cz(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:this.params.optimize.skipRenderWithOutRange!==!1?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:r=0,camera:a,fieldRatio:o=1,fieldDepth:l}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:r,camera:a,fieldRatio:o,fieldDepth:l})}set3dOptions(t){var e,i,n,r,a,o;this.option3d=t;const l=this.get3dOptions(t),{light:h,center:d,camera:u,alpha:c,beta:p,fieldRatio:g,fieldDepth:f}=l,{dir:_=[1,1,-1],color:m="white",ambient:v}=h,y=((e=d.x)!==null&&e!==void 0?e:this.width/2)+((i=d.dx)!==null&&i!==void 0?i:0),b=((n=d.y)!==null&&n!==void 0?n:this.height/2)+((r=d.dy)!==null&&r!==void 0?r:0),x=[y,b,((a=d.z)!==null&&a!==void 0?a:0)+((o=d.dz)!==null&&o!==void 0?o:0)];let S=0,A=0,k=0;u||(S=Math.sin(c)+y,A=Math.sin(p)+b,k=Math.cos(c)*Math.cos(p)*1),this.light=new VW(_,m,v);const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:g,fieldDepth:f,viewParams:{pos:[S,A,k],center:x,up:[0,1,0]}};this.camera?this.camera.params=w:this.camera=new YW(w),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new zW))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new jW))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new HW))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new yi;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new WW,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new NW))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach(t=>{this.pluginService.unRegister(t)}))}enableHtmlAttribute(t){this.htmlAttribute||(this.htmlAttribute=t,this.pluginService.register(new GW))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach(t=>{this.pluginService.unRegister(t)}))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach(i=>{this.appendChild(i)})}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach(i=>{this.nextFrameRenderLayerSet.add(i)}),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()(()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1}))}_doRenderInThisFrame(){this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear()),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let n=0;n<t.length;n++){let r=t[n];r.layerMode==="virtual"&&(r=r.getNativeHandler().mainHandler.layer),i.includes(r)||i.push(r)}i.forEach(n=>{n.renderCount>this.renderCount||(n.renderCount=this.renderCount+1,n.render({renderService:this.renderService,background:n===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},e)))}),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())},Object.assign({renderStyle:this.renderStyle},e))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){this.window.resize(t,e),this.forEachChildren(n=>{n.resize(t,e)}),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e,i=!0){this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren(n=>{n.resizeView(t,e)}),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,r){let a=!0;typeof t=="object"?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),e===!1&&(a=!1)):(this.viewBox.setValue(t,e,t+i,e+n),r===!1&&(a=!1)),this.forEachChildren(o=>{o.resizeView(this.viewBox.width(),this.viewBox.height())}),a&&this.render()}setDpr(t,e=!0){this.forEachChildren(i=>{i.setDpr(t)}),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){this.pickerService||(this.pickerService=Ct.get(Fl));const i=this.pickerService.pick(this.children,new De(t,e),{bounds:this.AABBBounds});return!(!(i!=null&&i.graphic)&&!(i!=null&&i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach(t=>{t.release()}),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter(e=>e.name===t)[0]}renderTo(t,e){this.forEachChildren((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:n===0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())}))})}renderToNewWindow(t=!0,e){const i=Ct.get(ag);if(t)i.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""});else{const a=e?e.width():Math.min(this.viewWidth,this.window.width-this.x),o=e?e.height():Math.min(this.viewHeight,this.window.height-this.y);i.create({width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""})}const n=e?-e.x1:0,r=e?-e.y1:0;return this.renderTo(i,{x:n,y:r,width:e?e.x2:i.width,height:e?e.y2:i.height}),i}toCanvas(t=!0,e){const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}}function qW(s){return new KW(s)}var ZW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},JW=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};const uv={WIDTH:500,HEIGHT:500,DPR:1};let wd=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(s){this._x=s}get y(){return this._y}set y(s){this._y=s}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(s){this._pixelWidth=s,this._displayWidth=s/(this._dpr||1)}get height(){return this._pixelHeight}set height(s){this._pixelHeight=s,this._displayHeight=s/(this._dpr||1)}getContext(s){return this._context}get visiable(){return this._visiable}set visiable(s){this._visiable=s,s?this.show():this.hide()}get dpr(){return this._dpr}set dpr(s){this._dpr=s,this.resize(this._displayWidth,this._displayHeight)}constructor(s){var t;const{nativeCanvas:e,width:i=uv.WIDTH,height:n=uv.HEIGHT,dpr:r=uv.DPR,x:a,y:o,id:l,canvasControled:h=!0}=s;this._x=a??0,this._y=o??0,this._pixelWidth=i*r,this._pixelHeight=n*r,this._visiable=s.visiable!==!1,this.controled=h,this._displayWidth=i,this._displayHeight=n,this._dpr=r,this._nativeCanvas=e,this._id=(t=e.id)!==null&&t!==void 0?t:l,l&&(e.id=l),this.init(s)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(s){}resize(s,t){}toDataURL(s,t){return""}readPixels(s,t,e,i){return this._context.getImageData(s,t,e,i)}convertToBlob(s){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...s){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};wd.env="browser",wd=ZW([ct(),JW("design:paramtypes",[Object])],wd);var QW=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Ng=class{configure(s,...t){s.env===this.type&&s.setActiveEnvContribution(this)}getNativeAABBBounds(s){return new Me}removeDom(s){return!1}createDom(s){return null}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(s){return document.getElementById(s)}getRootElement(){return document.body}loadJson(s){const t=fetch(s).then(e=>e.json());return t.then(e=>({data:e,state:"success"})).catch(()=>({data:null,state:"fail"})),t}loadArrayBuffer(s){return fetch(s).then(t=>t.arrayBuffer()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadBlob(s){return fetch(s).then(t=>t.blob()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}getElementTop(s,t){return 0}getElementLeft(s,t){return 0}getElementTopLeft(s,t){return{top:0,left:0}}};Ng=QW([ct()],Ng);var tN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},eN=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Vg=class{constructor(){this._uid=Xe.GenAutoIncrementId()}onChange(s){this._onChangeCb=s}configure(s,t){t.env===this.type&&s.setWindowHandler(this)}release(...s){this.releaseWindow()}isVisible(s){return!0}onVisibleChange(s){}getTopLeft(s){return{top:0,left:0}}};Vg=tN([ct(),eN("design:paramtypes",[])],Vg);var iN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},sN=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},ck=function(s,t){return function(e,i){t(e,i,s)}};let cy=class{constructor(s){this.pickItemInterceptorContributions=s,this.type="default",this.global=tt.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort((s,t)=>s.order-t.order)}pick(s,t,e){let i={graphic:null,group:null};e.pickerService=this;let n=0,r=0;if(e&&e.bounds){if(!e.bounds.contains(t.x,t.y))return i;n=e.bounds.x1,r=e.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),e.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ze(1,0,0,1,n,r);let o;for(let l=s.length-1;l>=0&&(i=s[l].isContainer?this.pickGroup(s[l],t,a,e):this.pickItem(s[l],t,a,e),!i.graphic);l--)o||(o=i.group);if(i.graphic||(i.group=o),this.pickContext&&(this.pickContext.inuse=!1),i.graphic){let l=i.graphic;for(;l.parent;)l=l.parent;l.shadowHost&&(i.params={shadowTarget:i.graphic},i.graphic=l.shadowHost)}return i}containsPoint(s,t,e){var i;return!!(!((i=this.pickItem(s,t,null,e??{pickContext:this.pickContext,pickerService:this}))===null||i===void 0)&&i.graphic)}pickGroup(s,t,e,i){let n={group:null,graphic:null};if(s.attribute.visibleAll===!1)return n;const r=i.pickContext,a=r.modelMatrix;if(r.camera){const p=s.transMatrix,g=ce.allocate();if(q0(g,p),a){if(g){const f=ce.allocate();r.modelMatrix=oc(f,a,g),ce.free(g)}}else q0(g,s.globalTransMatrix),r.modelMatrix=g}if(this.InterceptorContributions.length)for(let p=0;p<this.InterceptorContributions.length;p++){const g=this.InterceptorContributions[p];if(g.beforePickItem){const f=g.beforePickItem(s,this,t,i,{parentMatrix:e});if(f)return r.modelMatrix!==a&&ce.free(r.modelMatrix),r.modelMatrix=a,f}}const o=s.transMatrix,l=Ys.allocateByObj(e),h=new De(t.x,t.y);l.transformPoint(h,h);const d=s.AABBBounds.containsPoint(h);if(!d&&!s.stage.camera)return n;const u=this.pickItem(s,h.clone(),e,i);u&&u.graphic&&(n.graphic=u.graphic,n.params=u.params);const c=s.attribute.pickable!==!1&&d;return l.multiply(o.a,o.b,o.c,o.d,o.e,o.f),s.attribute.childrenPickable===!1||u&&u.graphic||vR(s,Re.zIndex,p=>{if(p.isContainer){const g=new De(t.x,t.y),f=rt(s).group,{scrollX:_=f.scrollX,scrollY:m=f.scrollY}=s.attribute;g.x-=_,g.y-=m,n=this.pickGroup(p,g,l,i)}else{const g=new De(t.x,t.y);l.transformPoint(g,g);const f=rt(s).group,{scrollX:_=f.scrollX,scrollY:m=f.scrollY}=s.attribute;g.x-=_,g.y-=m;const v=this.pickItem(p,g,e,i);v&&v.graphic&&(n.graphic=v.graphic,n.params=v.params)}return!!n.graphic||!!n.group},!0,!!r.camera),r.modelMatrix!==a&&ce.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!c||s.stage.camera||(n.group=s),Ys.free(l),n}selectPicker(s){return this.pickerMap.get(s.numberType)||null}};cy=iN([ct(),ck(0,Dt(Qe)),ck(0,gi(qo)),sN("design:paramtypes",[Object])],cy);let pk=!1;const nN=new Pt(s=>{pk||(pk=!0,s(fg).toSelf().inSingletonScope(),s(Sg).to(fg).inSingletonScope(),s(_i).toService(Sg),s(j0).toService(Js),Ci(s,j0))});let gk=!1;const rN=new Pt(s=>{gk||(gk=!0,s(yg).toSelf().inSingletonScope(),s(Cg).to(yg).inSingletonScope(),s(_i).toService(Cg),s(gg).toSelf(),s(pg).toSelf(),s(ud).toService(gg),s(ud).toService(pg),s(ud).toService(Js),Ci(s,ud))});let fk=!1;const aN=new Pt(s=>{fk||(fk=!0,s(du).toSelf().inSingletonScope(),s(Hg).toSelf().inSingletonScope(),s(wg).to(du).inSingletonScope(),s(_i).toService(wg))});let _k=!1;const oN=new Pt(s=>{_k||(_k=!0,s(uu).toSelf().inSingletonScope(),s(Ag).to(uu).inSingletonScope(),s(_i).toService(Ag),s(z0).toService(Js),Ci(s,z0),s(Gg).toSelf().inSingletonScope())});let mk=!1;const lN=new Pt(s=>{mk||(mk=!0,s(bg).toSelf().inSingletonScope(),s(Pg).to(bg).inSingletonScope(),s(_i).toService(Pg),s(V0).toService(Js),Ci(s,V0))});let vk=!1;const hN=new Pt(s=>{vk||(vk=!0,s(_g).toSelf().inSingletonScope(),s(kg).to(_g).inSingletonScope(),s(_i).toService(kg),s(H0).toService(Js),Ci(s,H0))});let yk=!1;const dN=new Pt(s=>{yk||(yk=!0,s(ry).to(ty).inSingletonScope(),s(_i).toService(ry),s(U0).toService(Js),Ci(s,U0))});let bk=!1;const uN=new Pt(s=>{bk||(bk=!0,s(vg).toSelf().inSingletonScope(),s(Tg).to(vg).inSingletonScope(),s(_i).toService(Tg),s(W0).toService(Js),Ci(s,W0))});let xk=!1;const cN=new Pt(s=>{xk||(xk=!0,s(Mg).to(ey).inSingletonScope(),s(_i).toService(Mg),s(N0).toService(Js),Ci(s,N0))});var pN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let py=class{constructor(){this.numberType=E_}drawShape(s,t,e,i,n,r,a,o){n.drawContribution&&s.getSubGraphic().forEach(l=>{const h=n.drawContribution.getRenderContribution(l);h&&h.drawShape&&h.drawShape(l,t,e,i,n,r,a,o)})}draw(s,t,e,i){const{context:n}=e;if(!n||(n.highPerformanceSave(),!e.drawContribution))return;const r=rt(s),a=s.getSubGraphic();a.length&&a.forEach(o=>{e.drawContribution.renderItem(o,e,{theme:r})}),n.highPerformanceRestore()}};py=pN([ct()],py);let Sk=!1;const gN=new Pt(s=>{Sk||(Sk=!0,s(Eg).to(py).inSingletonScope(),s(_i).toService(Eg))});var fN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},_N=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let gy=class extends ls{constructor(){super(),this.numberType=ix,this.builtinContributions=[pR],this.init()}drawShape(s,t,e,i,n){const r=rt(s).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=s.attribute;if(!s.valid||!h)return;const d=ao(o,l,!0),u=ao(o,a,!0);d&&(t.translate(e,i),this.beforeRenderStep(s,t,e,i,d,u,d,u,r,n),s.getFrameCache().draw(t,this.drawIcon),this.afterRenderStep(s,t,e,i,d,u,d,u,r,n))}drawIcon(s,t,e,i,n){var r;const a=rt(s).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:d,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:c=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:_}=s.attribute,{backgroundWidth:m=o,backgroundHeight:v=l}=s.attribute;if(_&&(e+=s._marginArray[3],i+=s._marginArray[0]),s._hovered){const b=(m-o)/2,x=(v-l)/2;f===0?(t.beginPath(),t.rect(e-b,i-x,m,v)):(t.beginPath(),lo(t,e-b,i-x,m,v,f)),u&&(t.globalAlpha=c,t.fillStyle=u,t.fill()),p&&(t.globalAlpha=g,t.strokeStyle=p,t.stroke())}const y=d&&((r=s==null?void 0:s.resources)===null||r===void 0?void 0:r.get(d));y&&y.state==="success"&&(t.globalAlpha=h,t.drawImage(y.data,e,i,o,l))}draw(s,t,e){const i=rt(s).richtext;this._draw(s,i,!1,e)}};gy=fN([ct(),_N("design:paramtypes",[])],gy);let Ak=!1;const mN=new Pt(s=>{Ak||(Ak=!0,s(ay).to(gy).inSingletonScope(),s(_i).toService(ay))});let kk=!1;const vN=new Pt(s=>{kk||(kk=!0,s(ik).to(iy).inSingletonScope(),s(_i).toService(ik),s(G0).toService(Js),Ci(s,G0))});var yN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let fy=class extends ls{constructor(){super(...arguments),this.type="rect3d",this.numberType=ex}drawShape(s,t,e,i,n,r,a,o){var l;const h=rt(s,r==null?void 0:r.theme).rect3d,{fill:d=h.fill,stroke:u=h.stroke,x1:c,y1:p,x:g,y:f,opacity:_=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:b=h.visible}=s.attribute;let{width:x,height:S}=s.attribute;x=(x??c-g)||0,S=(S??p-f)||0;const A=(l=this.z)!==null&&l!==void 0?l:0,k=rx(_,m,x,S,d),w=ox(_,y,x,S),T=yo(d),M=Ch(u,v);if(!s.valid||!b||!T&&!M||!(k||w||a||o))return;const{light:P,camera:O}=n.stage||{},D=s.findFace();if(d!==!1){t.setCommonStyle(s,s.attribute,e,i,h);let R=d;typeof R!="string"&&(R="black"),this.fill(e,i,A,D,R,t,P,a)}u!==!1&&(t.setStrokeStyle(s,s.attribute,e,i,h),this.stroke(e,i,A,D,t))}stroke(s,t,e,i,n){const r=i.vertices;i.edges.forEach(a=>{const o=r[a[0]],l={x:s+o[0],y:t+o[1],z:e+o[2]},h=r[a[1]],d={x:s+h[0],y:t+h[1],z:e+h[2]};n.beginPath(),n.moveTo(l.x,l.y,l.z),n.lineTo(d.x,d.y,d.z),n.stroke()})}fill(s,t,e,i,n,r,a,o){const l=we.Get(n,Xi.Color255),h=i.vertices,d=h.map(c=>r.view(c[0],c[1],c[2])[2]),u=[];i.polygons.forEach((c,p)=>{u.push({faceIdx:p,polygon:c});const{polygon:g,normal:f}=c,_=d[g[0]],m=d[g[1]],v=d[g[2]],y=d[g[3]];c.ave_z=_+m+v+y}),u.sort((c,p)=>p.polygon.ave_z-c.polygon.ave_z),u.forEach(c=>{const{polygon:p,normal:g}=c.polygon,f=h[p[0]],_=h[p[1]],m=h[p[2]],v=h[p[3]],y={x:s+f[0],y:t+f[1],z:e+f[2]},b={x:s+_[0],y:t+_[1],z:e+_[2]},x={x:s+m[0],y:t+m[1],z:e+m[2]},S={x:s+v[0],y:t+v[1],z:e+v[2]};r.beginPath(),r.moveTo(y.x,y.y,y.z),r.lineTo(b.x,b.y,b.z),r.lineTo(x.x,x.y,x.z),r.lineTo(S.x,S.y,S.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(g,l):n,r.fill())})}draw(s,t,e){const i=rt(s).rect;this._draw(s,i,!1,e)}};fy=yN([ct()],fy);let wk=!1;const bN=new Pt(s=>{wk||(wk=!0,s(ny).to(fy).inSingletonScope(),s(_i).toService(ny))});var xN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};function SN(s,t,e,i,n,r,a){const{startAngle:o,endAngle:l}=s.getParsedAngle(),h=Xt(l-o),d=l>o;let u=!1;if(r<a){const c=r;r=a,a=c}if(r<=se)t.moveTo(e,i,n);else if(h>=It-se)t.moveTo(e+r*oe(o),i+r*ee(o),n),t.arc(e,i,r,o,l,!d,n),a>se&&(t.moveTo(e+a*oe(l),i+a*ee(l),n),t.arc(e,i,a,l,o,d,n));else{const{outerDeltaAngle:c,innerDeltaAngle:p,outerStartAngle:g,outerEndAngle:f,innerEndAngle:_,innerStartAngle:m}=s.getParsePadAngle(o,l),v=r*oe(g),y=r*ee(g),b=a*oe(_),x=a*ee(_);c<.001?u=!0:(t.moveTo(e+v,i+y,n),t.arc(e,i,r,g,f,!d,n)),!(a>se)||p<.001?(t.lineTo(e+b,i+x,n),u=!0):(t.lineTo(e+b,i+x,n),t.arc(e,i,a,_,m,d,n))}return t.closePath(),u}function AN(s,t,e,i,n,r,a,o){const{startAngle:l,endAngle:h}=s.getParsedAngle(),d=Xt(h-l),u=h>l;let c=!1;if(a<=se)t.moveTo(e,i,n);else if(d>=It-se)t.moveTo(e+a*oe(l),i+a*ee(l),n),t.arc(e,i,a,l,h,!u,n),t.lineTo(e+a*oe(h),i+a*ee(h),r),t.arc(e,i,a,h,l,u,r);else{const{innerouterDeltaAngle:p,innerouterStartAngle:g,innerouterEndAngle:f}=o(l,h),_=a*oe(g),m=a*ee(g),v=a*oe(f),y=a*ee(f);p<.001?c=!0:(t.moveTo(e+_,i+m,n),t.arc(e,i,a,g,f,!u,n),t.lineTo(e+v,i+y,r),t.arc(e,i,a,f,g,u,r))}return t.closePath(),c}let _y=class extends ls{constructor(){super(...arguments),this.numberType=nc}drawShape(s,t,e,i,n,r,a,o){var l;const h=rt(s,r==null?void 0:r.theme).arc,{fill:d=h.fill}=s.attribute,u=this.valid(s,h,a,o);if(!u)return;const{fVisible:c,sVisible:p,doFill:g,doStroke:f}=u,_=(l=this.z)!==null&&l!==void 0?l:0,{outerRadius:m=h.outerRadius,innerRadius:v=h.innerRadius,height:y=10}=s.attribute,b=we.Get(d,Xi.Color255),{light:x}=n.stage||{},S=n.hack_pieFace,A={top:_,bottom:_+y},k={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};S==="bottom"||S==="top"?(t.beginPath(),SN(s,t,e,i,A[S],m,v),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),g&&(a?a(t,s.attribute,h):c&&(t.setCommonStyle(s,s.attribute,e,i,h),t.fillStyle=x?x.computeColor(k[S],b):d,t.fill())),f&&(o?o(t,s.attribute,h):p&&(t.setStrokeStyle(s,s.attribute,e,i,h),t.stroke()))):S!=="outside"&&S!=="inside"||(S==="inside"&&(t.save(),t.beginPath(),t.arc(e,i,v,0,It,!0,A.top),t.clip()),t.beginPath(),AN(s,t,e,i,A.top,A.bottom,S==="outside"?m:v,(w,T)=>{const{outerDeltaAngle:M,innerDeltaAngle:P,outerStartAngle:O,outerEndAngle:D,innerEndAngle:R,innerStartAngle:L}=s.getParsePadAngle(w,T);return S==="outside"?{innerouterDeltaAngle:M,innerouterEndAngle:D,innerouterStartAngle:O}:{innerouterDeltaAngle:P,innerouterEndAngle:R,innerouterStartAngle:L}}),t.setShadowBlendStyle&&t.setShadowBlendStyle(s,s.attribute,h),g&&(a?a(t,s.attribute,h):c&&(t.setCommonStyle(s,s.attribute,e,i,h),t.fillStyle=x?x.computeColor(k[S],b):d,t.fill())),f&&(o?o(t,s.attribute,h):p&&(t.setStrokeStyle(s,s.attribute,e,i,h),t.stroke())),S==="inside"&&t.restore())}draw(s,t,e,i){const n=rt(s,i==null?void 0:i.theme).arc;this._draw(s,n,!1,e,i)}};_y=xN([ct()],_y);let Tk=!1;const kN=new Pt(s=>{Tk||(Tk=!0,s(sy).to(_y).inSingletonScope(),s(_i).toService(sy))});var wN=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let my=class extends ls{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=tx}drawShape(s,t,e,i,n,r,a,o){var l;const h=rt(s,r==null?void 0:r.theme).polygon,{fill:d=h.fill,stroke:u=h.stroke,face:c=[!0,!0,!0,!0,!0,!0]}=s.attribute,p=(l=this.z)!==null&&l!==void 0?l:0;if(!this.valid(s,h,a,o))return;const{light:g,camera:f}=n.stage||{},_=s.findFace();if(d!==!1){t.setCommonStyle(s,s.attribute,e,i,h);let m=d;typeof m!="string"&&(m="black"),this.fill(e,i,p,_,c,m,t,g,f,s,h,a)}u!==!1&&(t.setStrokeStyle(s,s.attribute,e,i,h),this.stroke(e,i,p,_,t))}stroke(s,t,e,i,n){const r=i.vertices;i.edges.forEach(a=>{const o=r[a[0]],l=r[a[1]],h={x:s+o[0],y:t+o[1],z:e+o[2]},d={x:s+l[0],y:t+l[1],z:e+l[2]};n.beginPath(),n.moveTo(h.x,h.y,h.z),n.lineTo(d.x,d.y,d.z),n.stroke()})}fill(s,t,e,i,n,r,a,o,l,h,d,u){const c=we.Get(r,Xi.Color255),p=i.vertices,g=p.map(_=>a.view(_[0],_[1],_[2])[2]),f=[];i.polygons.forEach((_,m)=>{if(!n[m])return;f.push({faceIdx:m,polygon:_});const{polygon:v,normal:y}=_,b=g[v[0]],x=g[v[1]],S=g[v[2]],A=g[v[3]];_.ave_z=b+x+S+A}),f.sort((_,m)=>m.polygon.ave_z-_.polygon.ave_z),f.forEach(_=>{const{polygon:m,normal:v}=_.polygon,y=p[m[0]],b=p[m[1]],x=p[m[2]],S=p[m[3]],A={x:s+y[0],y:t+y[1],z:e+y[2]},k={x:s+b[0],y:t+b[1],z:e+b[2]},w={x:s+x[0],y:t+x[1],z:e+x[2]},T={x:s+S[0],y:t+S[1],z:e+S[2]};a.beginPath(),a.moveTo(A.x,A.y,A.z),a.lineTo(k.x,k.y,k.z),a.lineTo(w.x,w.y,w.z),a.lineTo(T.x,T.y,T.z),a.closePath(),u?u(a,h.attribute,d):(a.fillStyle=o?o.computeColor(v,c):r,a.fill())})}draw(s,t,e){const i=rt(s).polygon;this._draw(s,i,!1,e)}};my=wN([ct()],my);let Mk=!1;const TN=new Pt(s=>{Mk||(Mk=!0,s(oy).to(my).inSingletonScope(),s(_i).toService(oy))});function MN(){pt.RegisterGraphicCreator("arc",px)}function CN(){pt.RegisterGraphicCreator("arc3d",lR)}function PN(){pt.RegisterGraphicCreator("area",oR)}function EN(){pt.RegisterGraphicCreator("circle",vH)}function RN(){pt.RegisterGraphicCreator("glyph",nR)}function ON(){pt.RegisterGraphicCreator("group",sx)}function DN(){pt.RegisterGraphicCreator("image",cx)}function LN(){pt.RegisterGraphicCreator("line",ux)}function BN(){pt.RegisterGraphicCreator("path",aR)}function IN(){pt.RegisterGraphicCreator("polygon",hR)}function FN(){pt.RegisterGraphicCreator("pyramid3d",dR)}function jN(){pt.RegisterGraphicCreator("rect",nh)}function zN(){pt.RegisterGraphicCreator("rect3d",sR)}function HN(){pt.RegisterGraphicCreator("richtext",rR)}function GN(){pt.RegisterGraphicCreator("symbol",F_)}function WN(){pt.RegisterGraphicCreator("text",oo)}function NN(){pt.RegisterGraphicCreator("shadowRoot",R5)}function VN(){pt.RegisterGraphicCreator("wrapText",yH)}const yR=vx(),Kr=yR&&globalThis?globalThis.document:void 0;function Xs(s){return(s==="desktop-browser"||s==="mobile-browser")&&yR}function Aa(s){return ka(s)||s==="mobile-browser"}function ka(s){return s.includes("miniApp")||s==="lynx"||s==="wx"}let cv=0;function xo(){return cv>=9999999&&(cv=0),cv++}function Un(s){return s!=null&&s!==""&&(!!lt(s)||+s==+s)}function UN(s){if(H(s))return s;const t=+s;return H(t)?t:0}function Jo(s){return!(!s||s.length===0)&&!C(s[0])&&!C(s[0].dataId)&&U(s[0].fields)}const So=(s,t,e)=>(s.fields=t||[],s.fname=e,s),$N=s=>t=>Et(t,s),Ja=s=>{zt.getInstance().error(s)},YN=s=>{const t=[],e=s.length;let i,n,r,a=null,o=0,l="";s+="";const h=()=>{t.push(l+s.substring(i,n)),l="",i=n+1};for(i=0,n=0;n<e;n+=1)if(r=s[n],r==="\\")l+=s.substring(i,n),l+=s.substring(++n,++n),i=n;else if(r===a)h(),a=null,o=-1;else{if(a)continue;i===o&&r==='"'||i===o&&r==="'"?(i=n+1,a=r):r!=="."||o?r==="["?(n>i&&h(),i=n+1,o=i):r==="]"&&(o||Ja("Access path missing open bracket: "+s),o>0&&h(),o=0,i=n+1):n>i?h():i=n+1}return o&&Ja("Access path missing closing bracket: "+s),a&&Ja("Access path missing closing quote: "+s),n>i&&(n+=1,h()),t},Ck=(s,t,e={})=>{if(q(s))return s;const i=YN(s),n=i.length===1?i[0]:s;return So((e&&e.get||$N)(i),[n],n)},bn=(s,t,e={})=>{if(U(s)){const i=s.map(n=>Ck(n,t,e));return n=>i.map(r=>r(n))}return Ck(s,t,e)};bn("id");const XN=So(function(s){return s},[],"identity"),KN=So(function(){return 0},[],"zero");So(function(){return 1},[],"one");So(function(){return!0},[],"true");So(function(){return!1},[],"false");So(function(){return{}},[],"emptyObject");const vy=(s,t)=>{const e=q(t)?t:r=>r;let i,n;if(s&&s.length){const r=s.length;for(let a=0;a<r;a+=1){let o=e(s[a]);C(o)||!lt(o=+o)||Number.isNaN(o)||(C(i)?(i=o,n=o):(i=Math.min(i,o),n=Math.max(n,o)))}return[i,n]}return[i,n]},W_=(s,t,e,i=!0)=>{if(t===e)return!0;if(C(t)||C(e))return C(t)&&C(e);if(!Qv(t)&&!Qv(e))return t===e;const n=U(t)?t:t[s],r=U(e)?e:e[s];return n===r||i!==!1&&(U(r)?!(!U(n)||r.length!==n.length||!r.every((a,o)=>a===n[o])):!!Vt(r)&&!(!Vt(n)||Object.keys(r).length!==Object.keys(n).length||!Object.keys(r).every(a=>W_(a,r,n))))},Ts=(s,t)=>C(s)?t:ot(s)?t*parseFloat(s)/100:s;function qN(s,t,e,i){const n=i-s*s,r=Math.abs(n)<1e-24?0:(e-s*t)/n;return[t-r*s,r]}function bR(s,t,e,i){let n,r,a=-1;s.forEach(o=>{n=t(o),r=e(o),!C(n)&&(n=+n)>=n&&!C(r)&&(r=+r)>=r&&i(n,r,++a)})}function ZN(s,t,e,i,n){let r=0,a=0;return bR(s,t,e,(o,l)=>{const h=l-n(o),d=l-i;r+=h*h,a+=d*d}),1-r/a}function JN(s,t=i=>i.x,e=i=>i.y){let i=0,n=0,r=0,a=0,o=0;bR(s,t,e,(d,u)=>{++o,i+=(d-i)/o,n+=(u-n)/o,r+=(d*u-r)/o,a+=(d*d-a)/o});const l=qN(i,n,r,a),h=d=>l[0]+l[1]*d;return{coef:l,predict:h,rSquared:ZN(s,t,e,n,h)}}function Ti(s){return s==="horizontal"}function Pk(s){return s==="vertical"}var Le;(function(s){s.Identity="identity",s.Linear="linear",s.Log="log",s.Pow="pow",s.Sqrt="sqrt",s.Symlog="symlog",s.Time="time",s.Quantile="quantile",s.Quantize="quantize",s.Threshold="threshold",s.Ordinal="ordinal",s.Point="point",s.Band="band"})(Le||(Le={}));const xR={};Object.values(Le).forEach(s=>{xR[s]=!0});function Kt(s){switch(s){case Le.Linear:case Le.Log:case Le.Pow:case Le.Sqrt:case Le.Symlog:case Le.Time:return!0;default:return!1}}function yy(s){return!!xR[s]}function Pi(s){switch(s){case Le.Ordinal:case Le.Point:case Le.Band:return!0;default:return!1}}function zo(s){return s}const QN=s=>s<0?-Math.sqrt(-s):Math.sqrt(s),tV=s=>s<0?-s*s:s*s,eV=s=>-Math.log(-s),iV=s=>-Math.exp(-s),sV=s=>isFinite(s)?Math.pow(10,s):s<0?0:s,Ek=s=>s===10?sV:s===Math.E?Math.exp:t=>Math.pow(s,t),Rk=s=>s===Math.E?Math.log:s===10?Math.log10:s===2?Math.log2:(s=Math.log(s),t=>Math.log(t)/s),Ok=s=>t=>Math.sign(t)*Math.log1p(Math.abs(t/s)),Dk=s=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*s;function by(s,t){if(s=Number(s),t=Number(t),t-=s)return i=>(i-s)/t;const e=Number.isNaN(t)?NaN:.5;return()=>e}function Lk(s,t,e){const i=s[0],n=s[1],r=t[0],a=t[1];let o,l;return n<i?(o=by(n,i),l=e(a,r)):(o=by(i,n),l=e(r,a)),h=>l(o(h))}function yx(s,t,e){let i;return i=s===1?s+2*e:s-t+2*e,s?i>0?i:1:0}function SR(s,t,e,i){return e===1&&(e=0),yx(s,e,i)*(t/(1-e))}function nV(s,t,e,i,n){const r=yx(s,e,i);let a=t/Math.max(1,r||1);n&&(a=Math.floor(a));let o=a*(1-e);return n&&(o=Math.round(o)),o}function AR(s,t){const e=(s[1]-s[0])/(t[1]-t[0]),i=s[0]-e*t[0];return[i,e+i]}function rV(s,t,e){const i=Math.min(s.length,t.length)-1,n=new Array(i),r=new Array(i);let a=-1;for(s[i]<s[0]&&(s=s.slice().reverse(),t=t.slice().reverse());++a<i;)n[a]=by(s[a],s[a+1]),r[a]=e(t[a],t[a+1]);return function(o){const l=eP(s,o,1,i)-1;return r[l](n[l](o))}}const kR=(s,t)=>{const e=s.slice();let i=0,n=e.length-1,r=e[i],a=e[n];return a<r&&([i,n]=[n,i],[r,a]=[a,r]),e[i]=t.floor(r),e[n]=t.ceil(a),e},wR=(s,t=!1)=>{const e=Math.floor(Math.log10(s)),i=s/Math.pow(10,e);let n;return n=t?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10,n*Math.pow(10,e)},aV=(s,t)=>{let e,i;return t[0]<t[1]?(e=t[0],i=t[1]):(e=t[1],i=t[0]),Math.min(Math.max(s,e),i)};class TR{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&t.length===2?(this._wholeRange=AR(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(t.length===2&&t.every(n=>n>=0&&n<=1)&&(this._wholeRange=null,t[0]===0&&t[1]===1?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):E(this._rangeFactorStart)&&E(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return C(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,t!==0||!C(this._rangeFactorEnd)&&this._rangeFactorEnd!==1?(this._rangeFactorStart=t,this._rangeFactorEnd=(i=this._rangeFactorEnd)!==null&&i!==void 0?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return C(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,t!==0||!C(this._rangeFactorStart)&&this._rangeFactorStart!==0?(this._rangeFactorEnd=t,this._rangeFactorStart=(i=this._rangeFactorStart)!==null&&i!==void 0?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,r=this.range(),a=r[0],o=r[r.length-1],l=Math.min(a,o),h=Math.max(a,o),d=di((t=this._fishEyeOptions.focus)!==null&&t!==void 0?t:0,l,h),u=C(n)?(h-l)*i:n;let c=Math.exp(e);c=c/(c-1)*u;const p=e/u;this._fishEyeTransform=g=>{const f=Math.abs(g-d);if(f>=u)return g;if(f<=1e-6)return d;const _=c*(1-Math.exp(-f*p))/f*.75+.25;return d+(g-d)*_}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const xy=Symbol("implicit");class ho extends TR{specified(t){var e;return t?(this._specified=Object.assign((e=this._specified)!==null&&e!==void 0?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=Le.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=xy}clone(){return new ho().domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&t.length===2?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(i!==void 0)return i;let n=this._index.get(e);if(!n){if(this._unknown!==xy)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const r=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(r):r}invert(t){let e=0;for(;e<this._ordinalRange.length&&this._ordinalRange[e]!==t;)e++;return this._domain[(e-1)%this._domain.length]}domain(t){if(!t)return this._domain.slice();this._domain=[],this._index=new Map;for(const e of t){const i=`${e}`;this._index.has(i)||this._index.set(i,this._domain.push(e))}return this}range(t){if(!t)return this._ordinalRange.slice();const e=Array.from(t);return this._ordinalRange=e,this}}function Bk(s,t,e,i){let n;const r=[];let a;if(t=Math.floor(+t),s=Math.floor(+s),!(e=Math.floor(+e)))return[];if(s===t)return[s];if(n=t<s){const h=s;s=t,t=h}let o=Rb(1,t-s+1)(e);if(a=Math.floor((t-s+1)/o),!i)for(;Math.ceil((t-s+1)/a)>e&&o>1;)o-=1,a=Math.floor((t-s)/o);let l=s;for(;l<=t;)r.push(l),l+=a;return n&&r.reverse(),r}function oV(s,t,e){const i=[];let n;if(t=Math.floor(+t),s=Math.floor(+s),e=Rb(1,t-s+1)(Math.floor(+e)),n=t<s){const a=s;s=t,t=a}let r=s;for(;r<=t;)i.push(r),r+=e;return n&&i.reverse(),i}class Ao extends ho{constructor(t){super(),this.type=Le.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),n=super.domain().length,r=i[1]<i[0];let a=i[Number(r)-0];const o=i[1-Number(r)],l=yx(n,this._paddingInner,this._paddingOuter);return this._step=(o-a)/Math.max(1,l||1),this._round&&(this._step=Math.floor(this._step)),a+=(o-a-this._step*(n-this._paddingInner))*this._align,this.isBandwidthFixed()||(this._bandwidth=this._step*(1-this._paddingInner)),this._round&&(a=Math.round(a),this.isBandwidthFixed()||(this._bandwidth=Math.round(this._bandwidth))),this._bandRangeState={reverse:r,start:r?a+this._step*(n-1):a,count:n},this.generateFishEyeTransform(),this}scale(t){if(!this._bandRangeState)return;const e=`${t}`,i=this._getSpecifiedValue(e);if(i!==void 0)return i;let n=this._index.get(e);if(!n){if(this._unknown!==xy)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const{count:r,start:a,reverse:o}=this._bandRangeState,l=a+(o?-1:1)*((n-1)%r)*this._step;return this._fishEyeTransform?this._fishEyeTransform(l):l}_calculateWholeRange(t,e){if(this._wholeRange)return this._wholeRange;if((this._minBandwidth||this._maxBandwidth)&&!this._isBandwidthFixedByUser()){let i;if(E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&t.length===2){const r=AR(t,[this._rangeFactorStart,this._rangeFactorEnd]);i=Math.abs(r[1]-r[0])}else i=Math.abs(t[1]-t[0]);const n=nV(super.domain().length,i,this._paddingInner,this._paddingOuter,this._round);n<this._minBandwidth?(this._bandwidth=this._minBandwidth,this._isFixed=!0):n>this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=n,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=SR(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(E(this._rangeFactorStart)&&E(this._rangeFactorEnd)){if(i>0){const o=t[0]-i*this._rangeFactorStart,l=o+i;this._wholeRange=[o,l]}else{const o=t[1]+i*(1-this._rangeFactorEnd),l=o-i;this._wholeRange=[l,o]}const r=this._rangeFactorStart+n<=1,a=this._rangeFactorEnd-n>=0;e==="rangeFactorStart"&&r?this._rangeFactorEnd=this._rangeFactorStart+n:e==="rangeFactorEnd"&&a?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?r?this._rangeFactorEnd=this._rangeFactorStart+n:a?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):a?this._rangeFactorStart=this._rangeFactorEnd-n:r?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[zn(t[0]),zn(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[zn(t[0]),zn(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return t===-1?e:Bk(0,e.length-1,t,!1).map(i=>e[i])}tickData(t=10){return this.ticks(t).map((e,i)=>({index:i,tick:e,value:(this.scale(e)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])}))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Bk(0,e.length-1,t,!0).filter(i=>i<e.length).map(i=>e[i])}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return oV(0,e.length-1,t).map(i=>e[i])}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,r=this._domain.length,a=this.range(),o=a[0]>a[a.length-1];for(e=0;e<r;e++){const l=this.scale(this._domain[e])+n;if(e===0&&(!o&&!En(t,l+i)||o&&!on(t,l-i))||e===r-1||!on(t,l-i)&&!En(t,l+i))break}return e>=0&&e<=r-1?e:r-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return t!==void 0?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return t!==void 0?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return t!==void 0?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return t!==void 0?(this._round=t,this.rescale(e)):this._round}align(t,e){return t!==void 0?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return C(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return C(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?(t==="auto"?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth=t==="auto"?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth=t==="auto"?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&<(this._userBandwidth)}clone(){var t,e,i;return new Ao(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth((t=this._userBandwidth)!==null&&t!==void 0?t:"auto",!0).maxBandwidth((e=this._maxBandwidth)!==null&&e!==void 0?e:"auto",!0).minBandwidth((i=this._maxBandwidth)!==null&&i!==void 0?i:"auto")}}const{interpolateRgb:pv}=lF;function lV(s,t){const e=typeof t;let i;if(C(t)||e==="boolean")return()=>t;if(e==="number")return md(s,t);if(e==="string"){if(i=Ue.parseColorString(t)){const n=pv(Ue.parseColorString(s),i);return r=>n(r).formatRgb()}return md(Number(s),Number(t))}return t instanceof wi?pv(s,t):t instanceof Ue?pv(s.color,t.color):t instanceof Date?K2(s,t):md(Number(s),Number(t))}class MR extends TR{constructor(t=zo,e=zo){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=zo,this._piecewise=Lk,this._interpolate=lV}calculateVisibleDomain(t){var e;return E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&t.length===2?[this.invert(t[0]),this.invert(t[1])]:(e=this._niceDomain)!==null&&e!==void 0?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise(((e=this._niceDomain)!==null&&e!==void 0?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),((e=this._niceDomain)!==null&&e!==void 0?e:this._domain).map(this.transformer),md)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return((i=this._niceDomain)!==null&&i!==void 0?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,zn);return this._domain=n,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=X2,this.rescale(e)}rescale(t){var e;if(t)return this;const i=(e=this._niceDomain)!==null&&e!==void 0?e:this._domain,n=i.length,r=this._range.length;let a=Math.min(n,r);if(n&&n<r&&this._forceAlign){const o=r-n+1,l=i[n-1],h=n>=2?(l-i[n-2])/o:0;for(let d=1;d<=o;d++)i[n-2+d]=l-h*(o-d);a=r}return this._autoClamp&&(this._clamp=Rb(i[0],i[a-1])),this._piecewise=a>2?rV:Lk,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:zo),this.rescale(i)):this._clamp!==zo}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(e??[]).map((i,n)=>({index:n,tick:i,value:(this.scale(i)-this._range[0])/(this._range[1]-this._range[0])}))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return C(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return C(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const hV=Math.sqrt(50),dV=Math.sqrt(10),uV=Math.sqrt(2),rp=[1,2,5,10],Ik=(s,t,e)=>{let i=1,n=s;const r=Math.floor((t-1)/2),a=Math.abs(s);return s>=0&&s<=Number.MIN_VALUE?n=0:s<0&&s>=-Number.MIN_VALUE?n=-(t-1):!e&&a<1?i=CR(a).step:(e||a>1)&&(n=Math.floor(s)-r*i),i>0?(s>0?n=Math.max(n,0):s<0&&(n=Math.min(n,-(t-1)*i)),QC(0,t).map(o=>n+o*i)):s>0?Ug(0,-(t-1)/i,i):Ug((t-1)/i,0,i)},cV=kh((s,t,e,i)=>{let n,r,a,o,l=-1;if(e=+e,(s=+s)==(t=+t))return[s];if(Math.abs(s-t)<=Number.MIN_VALUE&&e>0)return[s];if((n=t<s)&&(r=s,s=t,t=r),o=bx(s,t,e).step,!isFinite(o))return[];if(o>0){let h=Math.round(s/o),d=Math.round(t/o);for(h*o<s&&++h,d*o>t&&--d,a=new Array(r=d-h+1);++l<r;)a[l]=(h+l)*o}else if(o<0&&(i!=null&&i.noDecimals)){o=1;const h=Math.ceil(s),d=Math.floor(t);if(!(h<=d))return[];for(a=new Array(r=d-h+1);++l<r;)a[l]=h+l}else{o=-o;let h=Math.round(s*o),d=Math.round(t*o);for(h/o<s&&++h,d/o>t&&--d,a=new Array(r=d-h+1);++l<r;)a[l]=(h+l)/o}return n&&a.reverse(),a}),Ug=(s,t,e)=>{let i,n,r=-1;if(e>0){let a=Math.floor(s/e),o=Math.ceil(t/e);for((a+1)*e<s&&++a,(o-1)*e>t&&--o,n=new Array(i=o-a+1);++r<i;)n[r]=(a+r)*e}else{e=-e;let a=Math.floor(s*e),o=Math.ceil(t*e);for((a+1)/e<s&&++a,(o-1)/e>t&&--o,n=new Array(i=o-a+1);++r<i;)n[r]=(a+r)/e}return n},pV=(s,t,e)=>{let i;const n=s[0],r=s[s.length-1],a=t-s.length;if(r<=0){const h=[];for(i=a;i>=1;i--)h.push(n-i*e);return h.concat(s)}if(n>=0){for(i=1;i<=a;i++)s.push(r+i*e);return s}let o=[];const l=[];for(i=1;i<=a;i++)i%2==0?o=[n-Math.floor(i/2)*e].concat(o):l.push(r+Math.ceil(i/2)*e);return o.concat(s).concat(l)},$g=kh((s,t,e,i)=>{let n,r,a;if(e=+e,(s=+s)==(t=+t)||Math.abs(s-t)<=Number.MIN_VALUE&&e>0)return Ik(s,e,i==null?void 0:i.noDecimals);(n=t<s)&&(a=s,s=t,t=a);const o=bx(s,t,e);let l=o.step;if(!isFinite(l))return[];if(l>0){let h=1;const{power:d,gap:u}=o,c=u===10?2*10**d:1*10**d;for(;h<=5&&(r=Ug(s,t,l),r.length>e+1)&&e>2;)l+=c,h+=1;e>2&&r.length<e-1&&(r=pV(r,e,l))}else i!=null&&i.noDecimals&&l<0&&(l=1),r=Ug(s,t,l);return n&&r.reverse(),r}),CR=s=>{const t=Math.floor(Math.log(s)/Math.LN10),e=s/10**t;let i=rp[0];return e>=hV?i=rp[3]:e>=dV?i=rp[2]:e>=uV&&(i=rp[1]),t>=0?{step:i*10**t,gap:i,power:t}:{step:-(10**-t)/i,gap:i,power:t}};function bx(s,t,e){const i=(t-s)/Math.max(0,e);return CR(i)}function PR(s,t,e){let i;if(e=+e,(s=+s)==(t=+t)&&e>0)return[s];if(e<=0||(i=gV(s,t,e))===0||!isFinite(i))return[];const n=new Array(e);for(let r=0;r<e;r++)n[r]=s+r*i;return n}function gV(s,t,e){return(t-s)/Math.max(1,e-1)}function fV(s,t,e){let i,n,r=-1;if(e=+e,(n=(t=+t)<(s=+s))&&(i=s,s=t,t=i),!isFinite(e)||t-s<=e)return[s];const a=Math.floor((t-s)/e+1),o=new Array(a);for(;++r<a;)o[r]=s+r*e;return n&&o.reverse(),o}function gv(s,t=10){let e,i,n=0,r=s.length-1,a=s[n],o=s[r],l=10;for(o<a&&(i=a,a=o,o=i,i=n,n=r,r=i);l-- >0;){if(i=bx(a,o,t).step,i===e)return s[n]=a,s[r]=o,s;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function xx(s,t){const e=lt(t.forceMin),i=lt(t.forceMax);let n=null;const r=[];let a=null;const o=e&&i?l=>l>=t.forceMin&&l<=t.forceMax:e?l=>l>=t.forceMin:i?l=>l<=t.forceMax:null;return e?r[0]=t.forceMin:lt(t.min)&&t.min<=Math.min(s[0],s[s.length-1])&&(r[0]=t.min),i?r[1]=t.forceMax:lt(t.max)&&t.max>=Math.max(s[0],s[s.length-1])&&(r[1]=t.max),lt(r[0])&<(r[1])?(a=s.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=lt(r[0])||lt(r[1])?lt(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const fv=(s,t,e)=>Math.abs(t-s)<1?+e.toFixed(1):Math.round(+e),ER=kh((s,t,e,i,n,r,a)=>{let o=s,l=t;const h=l<o;h&&([o,l]=[l,o]);let d,u,c=n(o),p=n(l),g=[];if(!(i%1)&&p-c<e){if(c=Math.floor(c),p=Math.ceil(p),o>0){for(;c<=p;++c)for(d=1;d<i;++d)if(u=c<0?d/r(-c):d*r(c),!(u<o)){if(u>l)break;g.push(u)}}else for(;c<=p;++c)for(d=i-1;d>=1;--d)if(u=c>0?d/r(-c):d*r(c),!(u<o)){if(u>l)break;g.push(u)}2*g.length<e&&(g=$g(o,l,e))}else g=$g(c,p,Math.min(p-c,e)).map(r);return g=g.filter(f=>f!==0),a!=null&&a.noDecimals&&(g=Array.from(new Set(g.map(f=>Math.floor(f))))),h?g.reverse():g}),RR=kh((s,t,e,i,n,r)=>{const a=[],o={},l=n(s),h=n(t);let d=[];if(Number.isInteger(i))d=$g(l,h,e);else{const u=(h-l)/(e-1);for(let c=0;c<e;c++)d.push(l+c*u)}return d.forEach(u=>{const c=r(u),p=Number.isInteger(i)?fv(s,t,c):fv(s,t,wR(c)),g=fv(s,t,aV(p,[s,t]));!o[g]&&!isNaN(g)&&d.length>1&&(o[g]=1,a.push(g))}),a}),Yg=kh((s,t,e,i,n)=>PR(i(s),i(t),e).map(r=>wR(n(r))));class Qs extends MR{constructor(){super(...arguments),this.type=Le.Linear}clone(){return new Qs().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return cV(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(E(this._rangeFactorStart)&&E(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&this._range.length===2||!this._niceType)return this.d3Ticks(t,e);const n=(i=this._niceDomain)!==null&&i!==void 0?i:this._domain,r=this._domain,a=n[0],o=n[n.length-1];let l=$g(r[0],r[r.length-1],t,e);if(!l.length)return l;if(this._domainValidator)l=l.filter(this._domainValidator);else if((l[0]!==a||l[l.length-1]!==o)&&this._niceType){const h=n.slice();if(this._niceType==="all"?(h[0]=l[0],h[h.length-1]=l[l.length-1],this._niceDomain=h,this.rescale()):this._niceType==="min"&&l[0]!==a?(h[0]=l[0],this._niceDomain=h,this.rescale()):this._niceType==="max"&&l[l.length-1]!==o&&(h[h.length-1]=l[l.length-1],this._niceDomain=h,this.rescale()),this._niceType!=="all"){const d=Math.min(h[0],h[h.length-1]),u=Math.max(h[0],h[h.length-1]);l=l.filter(c=>c>=d&&c<=u)}}return l}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return PR(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return fV(e[0],e[e.length-1],t)}nice(t=10,e){var i,n;const r=this._domain;let a=[];if(e){const o=xx(r,e);if(a=o.niceMinMax,this._domainValidator=o.domainValidator,this._niceType=o.niceType,o.niceDomain)return this._niceDomain=o.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const o=gv(r.slice(),t);this._niceType==="min"?o[o.length-1]=(i=a[1])!==null&&i!==void 0?i:o[o.length-1]:this._niceType==="max"&&(o[0]=(n=a[0])!==null&&n!==void 0?n:o[0]),this._niceDomain=o,this.rescale()}return this}niceMin(t=10){this._niceType="min";const e=this._domain[this._domain.length-1],i=gv(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(t=10){this._niceType="max";const e=this._domain[0],i=gv(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function Fk(s){return t=>-s(-t)}function jk(s=Number.EPSILON){return t=>Math.max(t,s)}function _V(s=Number.EPSILON){return t=>Math.min(t,-s)}class Sx extends MR{constructor(){super(Rk(10),Ek(10)),this.type=Le.Log,this._limit=jk(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return new Sx().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=Rk(this._base),n=Ek(this._base);return((e=this._niceDomain)!==null&&e!==void 0?e:this._domain)[0]<0?(this._logs=Fk(i),this._pows=Fk(n),this._limit=_V(),this.transformer=eV,this.untransformer=iV):(this._logs=i,this._pows=n,this._limit=jk(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise(((e=this._niceDomain)!==null&&e!==void 0?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return zo}d3Ticks(t=10,e){const i=this.domain(),n=this._limit(i[0]),r=this._limit(i[i.length-1]);return ER(n,r,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return RR(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Yg(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Yg(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}nice(t=10,e){var i,n;const r=this._domain;let a=[],o=null;if(e){const l=xx(r,e);if(a=l.niceMinMax,this._domainValidator=l.domainValidator,o=l.niceType,l.niceDomain)return this._niceDomain=l.niceDomain,this.rescale(),this}else o="all";if(o){const l=kR(r.slice(),{floor:h=>this._pows(Math.floor(this._logs(this._limit(h)))),ceil:h=>Math.abs(h)>=1?Math.ceil(h):this._pows(Math.ceil(this._logs(this._limit(h))))});return o==="min"?l[l.length-1]=(i=a[1])!==null&&i!==void 0?i:l[l.length-1]:o==="max"&&(l[0]=(n=a[0])!==null&&n!==void 0?n:l[0]),this._niceDomain=l,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class mV extends Ao{constructor(t){super(!1),this.type=Le.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Xg extends Qs{constructor(){super(QN,tV),this.type=Le.Sqrt}clone(){return new Xg().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Ax extends Qs{constructor(){super(Ok(1),Dk(1)),this.type=Le.Symlog,this._const=1}clone(){return new Ax().domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=Ok(t),this.untransformer=Dk(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),n=i[0],r=i[i.length-1];return ER(n,r,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return RR(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return Yg(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Yg(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(t=10,e){var i,n;const r=this._domain;let a=[],o=null;if(e){const l=xx(r,e);if(a=l.niceMinMax,this._domainValidator=l.domainValidator,o=l.niceType,l.niceDomain)return this._niceDomain=l.niceDomain,this.rescale(),this}else o="all";if(o){const l=kR(r.slice(),{floor:h=>Math.floor(h),ceil:h=>Math.ceil(h)});return o==="min"?l[l.length-1]=(i=a[1])!==null&&i!==void 0?i:l[l.length-1]:o==="max"&&(l[0]=(n=a[0])!==null&&n!==void 0?n:l[0]),this._niceDomain=l,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}class kx{constructor(){this.type=Le.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!C(t)&&H(+t)?this._range[eP(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return new kx().domain(this._domain).range(this._range).unknown(this._unknown)}}const zk=5,wx=(s,t,e,i)=>new li(Object.assign({defaultFontParams:Object.assign({fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14},i),getTextBounds:e?void 0:lc,specialCharSet:`-/: .,@%'"~`+li.ALPHABET_CHAR_SET+li.ALPHABET_CHAR_SET.toUpperCase()},t??{}),s);function Tx(s){for(;s<0;)s+=2*Math.PI;for(;s>=2*Math.PI;)s-=2*Math.PI;return s}function OR(s){let t="center",e="middle";return t=(s=Tx(s))>=Math.PI*(5/3)||s<=Math.PI*(1/3)?"left":s>=Math.PI*(2/3)&&s<=Math.PI*(4/3)?"right":"center",e=s>=Math.PI*(7/6)&&s<=Math.PI*(11/6)?"bottom":s>=Math.PI*(1/6)&&s<=Math.PI*(5/6)?"top":"middle",{align:t,baseline:e}}const Vn=s=>s.map((t,e)=>({index:e,value:t})),Hk=(s,t,e=0)=>{const i=new Me(s).expand(e/2),n=new Me(t).expand(e/2);return i.intersects(n)};function DR(s,t,e){return e>Math.max(t.x1-s.x2,s.x1-t.x2,t.y1-s.y2,s.y1-t.y2)}function vV(s,t){for(let e,i=1,n=s.length,r=s[0];i<n;r=e,++i)if(e=s[i],DR(r.AABBBounds,e.AABBBounds,t))return!0;return!1}const LR=(s,t,e)=>{var i;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=e;let h=(i=n.angle)!==null&&i!==void 0?i:0;n.direction==="vertical"&&(h+=le(90));const d=["bottom","top"].includes(r),u=["left","right"].includes(r);let c=1,p=0;d||(u?(c=0,p=1):l&&(c=Math.cos(l),p=-Math.sin(l)));const g=wx(n);return t.map((_,m)=>{var v,y;const b=o?o(_):`${_}`,{width:x,height:S}=g.quickMeasure(b),A=Math.max(x,12),k=Math.max(S,12),w=s.scale(_),T=c*w,M=p*w;let P,O,D=T,R=M;P=a&&d&&m===0?"left":a&&d&&m===t.length-1?"right":(v=n.textAlign)!==null&&v!==void 0?v:"center",P==="right"?D-=A:P==="center"&&(D-=A/2),O=a&&u&&m===0?"top":a&&u&&m===t.length-1?"bottom":(y=n.textBaseline)!==null&&y!==void 0?y:"middle",O==="bottom"?R-=k:O==="middle"&&(R-=k/2);const L=new Me().set(D,R,D+A,R+k);return h&&L.rotate(h,T,M),L})},yV=(s,t,e)=>{var i;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o}=e,l=r==null?void 0:r(),h=(i=n.angle)!==null&&i!==void 0?i:0,d=wx(n);return t.map(u=>{const c=o?o(u):`${u}`,{width:p,height:g}=d.quickMeasure(c),f=Math.max(p,12),_=Math.max(g,12),m=s.scale(u);let v=0,y=0;const b=OR(m),{x,y:S}=ln({x:0,y:0},l+a,m);return v=x+(b.align==="right"?-f:b.align==="center"?-f/2:0),y=S+(b.baseline==="bottom"?-_:b.baseline==="middle"?-_/2:0),new Me().set(v,y,v+f,y+_).rotate(h,v+f/2,y+_/2)})},bV=s=>["bottom","top","z"].includes(s),xV=(s,t)=>{if(!Kt(s.type))return Vn(s.domain());const e=s.range(),i=Math.abs(e[e.length-1]-e[0]);if(i<2)return Vn([s.domain()[0]]);const{tickCount:n,forceTickCount:r,tickStep:a,noDecimals:o=!1,labelStyle:l}=t;let h;if(E(a))h=s.stepTicks(a);else if(E(r))h=s.forceTicks(r);else if(t.tickMode==="d3"){const d=q(n)?n({axisLength:i,labelStyle:l}):n;h=s.d3Ticks(d??zk,{noDecimals:o})}else{const d=q(n)?n({axisLength:i,labelStyle:l}):n;h=s.ticks(d??zk,{noDecimals:o})}if(t.sampling&&(t.coordinateType==="cartesian"||t.coordinateType==="polar"&&t.axisOrientType==="radius")){const{labelGap:d=4,labelFlush:u}=t;let c=LR(s,h,t).map((g,f)=>({AABBBounds:g,value:h[f]}));for(;c.length>=3&&vV(c,d);)c=SV.parity(c);const p=c.map(g=>g.value);p.length<3&&u&&(p.length>1&&p.pop(),la(p)!==la(h)&&p.push(la(h))),h=p}return Vn(h)},SV={parity:function(s){return s.filter((t,e)=>e%2==0)},greedy:function(s,t){let e;return s.filter((i,n)=>(!n||!DR(e.AABBBounds,i.AABBBounds,t))&&(e=i,!0))}},Gk=(s,t)=>BR(0,s.length,e=>t(s[e])),BR=(s,t,e)=>{let i=s,n=t;for(;i<n;){const r=Math.floor((i+n)/2);e(r)>=0?n=r:i=r+1}return i},Wk=(s,t,e,i)=>LR(s,t,e).map(n=>i?[n.x1,n.x2,n.width()]:[n.y1,n.y2,n.height()]),Nk=(s,t,e=0)=>Math.max(s[0],t[0])-e/2<=Math.min(s[1],t[1])+e/2,Vk=(s,t)=>s[1]<t[0]?t[0]-s[1]:t[1]<s[0]?s[0]-t[1]:0,AV=(s,t)=>{var e;const i=s.domain();if(!i.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=t,d=bV(l),u=s.range(),c=s.calculateWholeRangeSize();if(c<2)return t.labelLastVisible?Vn([i[i.length-1]]):Vn([i[0]]);let p;if(E(a))p=s.stepTicks(a);else if(E(r))p=s.forceTicks(r);else if(E(n)){const g=q(n)?n({axisLength:c,labelStyle:h}):n;p=s.ticks(g)}else if(t.sampling){const g=((e=t.labelStyle.fontSize)!==null&&e!==void 0?e:12)+2,f=pi(u),_=Ye(u);if(i.length<=c/g){const m=(_-f)/i.length,v=Wk(s,i,t,d),y=Math.min(...v.map(x=>x[2])),b=kV(i,v,o,t.labelLastVisible,Math.floor(y/m));p=s.stepTicks(b.step),t.labelLastVisible&&(b.delCount&&(p=p.slice(0,p.length-b.delCount)),p.push(i[i.length-1]))}else{const m=[i[0],i[Math.floor(i.length/2)],i[i.length-1]],v=Wk(s,m,t,d);let y=null;v.forEach(x=>{y?y[2]<x[2]&&(y=x):y=x});const b=_-f-o>0?Math.ceil(i.length*(o+y[2])/(_-f-o)):i.length-1;p=s.stepTicks(b),!t.labelLastVisible||p.length&&p[p.length-1]===i[i.length-1]||(p.length&&Math.abs(s.scale(p[p.length-1])-s.scale(i[i.length-1]))<y[2]&&(p=p.slice(0,-1)),p.push(i[i.length-1]))}}else p=s.domain();return Vn(p)},kV=(s,t,e,i,n,r)=>{let a=0,o=0,l=-1,h=Number.MAX_VALUE;const d=p=>{let g=!0,f=0;do f+p<s.length&&Nk(t[f],t[f+p],e)&&(g=!1),f+=p;while(g&&f<s.length);return g},u=BR(n,s.length,p=>d(p)?1:-1);let c=u;do if(c>u&&!d(c))c++;else{if(!i){o=c;break}{const p=s.length-1;let g,f=0;g=s.length%c>0?s.length-s.length%c+c:s.length;do{if(g-=c,g!==p&&!Nk(t[g],t[p],e))break;f++}while(g>0);if(g===p){o=c,a=f;break}{const _=Math.floor(s.length/c)-f+1;if(_<l)break;{l=_;const m=Vk(t[g],t[p]),v=g-c>=0?Vk(t[g-c],t[g]):m,y=Math.abs(m-v);if(y<h&&(h=y,o=c,a=f),m<=v)break}}}c++}while(c<=s.length);return{step:o,delCount:a}},wV=(s,t)=>{const{tickCount:e,forceTickCount:i,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=t,h=r==null?void 0:r();if(!h)return Vn(s.domain());let d;if(E(n))d=s.stepTicks(n);else if(E(i))d=s.forceTicks(i);else if(E(e)){const u=s.range(),c=Math.abs(u[u.length-1]-u[0]),p=q(e)?e({axisLength:c,labelStyle:l}):e;d=s.ticks(p)}else if(t.sampling){const u=s.domain(),c=s.range(),p=yV(s,u,t),g=pi(c),f=Ye(c),_=Math.abs(f-g)*(h+a)/u.length,{step:m,delCount:v}=TV(u,p,o,Math.floor(p.reduce((y,b)=>Math.min(y,b.width(),b.height()),Number.MAX_VALUE)/_));d=s.stepTicks(m),d=d.slice(0,d.length-v)}else d=s.domain();return Vn(d)},TV=(s,t,e,i)=>{let n=i;do{let a=!0;n++;let o=0;do o+n<s.length&&Hk(t[o],t[o+n],e)&&(a=!1),o+=n;while(a&&o<s.length);if(a)break}while(n<=s.length);let r=0;if(s.length>2){let a=s.length-s.length%n;for(a>=s.length&&(a-=n);a>0&&Hk(t[0],t[a]);)r++,a-=n}return{step:n,delCount:r}},MV=(s,t)=>{if(Kt(s.type))return xV(s,t);if(Pi(s.type)){if(t.coordinateType==="cartesian")return AV(s,t);if(t.coordinateType==="polar"&&t.axisOrientType==="angle")return wV(s,t)}return Vn(s.domain())},Rp=(s,t,e)=>{if(C(t))return s;const i=t[0];return C(i)?s:t.length===1?(s[i]=e,s):(C(s[i])&&(typeof t[1]=="number"?s[i]=[]:s[i]={}),Rp(s[i],t.slice(1),e))},CV=(s,t,e)=>{if(!C(t))return Et(s,t,e)};function qr(s){return s.radius?{x:Math.cos(s.angle)*s.radius,y:Math.sin(s.angle)*s.radius}:{x:0,y:0}}function PV(s){return(s=Tx(s))>0&&s<=Math.PI/2?2:s>Math.PI/2&&s<=Math.PI?3:s>Math.PI&&s<=3*Math.PI/2?4:1}function EV(s,t){let e=0,i=2*Math.PI;const n=E(s),r=E(t);for(n||r?r?n?(e=s,i=t):(e=t-2*Math.PI,i=t):(e=s,i=s+2*Math.PI):(e=0,i=2*Math.PI);i<=e;)i+=2*Math.PI;for(;e>2*Math.PI;)e-=2*Math.PI,i-=2*Math.PI;for(;i<0;)e+=2*Math.PI,i+=2*Math.PI;return{startAngle:e,endAngle:i}}function RV(s,t,e){return s.x1>t||s.x2<t||s.y1>e||s.y2<e}function IR(s,t){const e=[];return s.forEach(i=>{const n=+i[t];H(n)&&e.push(n)}),e.length===0?null:pi(e)}function Mx(s,t){const e=[];return s.forEach(i=>{const n=+i[t];H(n)&&e.push(n)}),e.length===0?null:Ye(e)}function FR(s,t){return s.reduce((e,i)=>{const n=t?+i[t]:+i;return H(n)&&(e+=n),e},0)}function jR(s,t){let e=0,i=0;return s.forEach(n=>{const r=t?+n[t]:+n;H(r)&&(e+=r,i++)}),e/i}function zR(s,t){const e=jR(s,t);return s.length<=1?0:s.reduce((n,r)=>n+(t?+r[t]:+r-e)**2,0)/(s.length-1)}function OV(s,t){return Math.sqrt(zR(s,t))}function DV(s,t){return U2(s.map(e=>e[t]))}function LV(s,t,e){const{predict:i}=JN(s,l=>l[t],l=>l[e]),n=IR(s,t),r=Mx(s,t),a=i(n),o=i(r);return[{[t]:n,[e]:a},{[t]:r,[e]:o}]}function BV(s){let t="center",e="middle";return t=(s=Tx(s))>=Math.PI*(7/6)&&s<=Math.PI*(11/6)?"right":s>=Math.PI*(1/6)&&s<=Math.PI*(5/6)?"left":"center",e=s>=Math.PI*(5/3)||s<=Math.PI*(1/3)?"bottom":s>=Math.PI*(2/3)&&s<=Math.PI*(4/3)?"top":"middle",{align:t,baseline:e}}function Uk(s,t){const e=Kg(s),i=Kg(t),n=Math.asin((s.x*t.y-t.x*s.y)/e/i),r=Math.acos((s.x*t.x+s.y*t.y)/e/i);return n<0?-r:r}function Kg(s,t={x:0,y:0}){return Ee.distancePP(s,t)}function Te(s,t,e){let i=!1;if(t&&q(t)){for(const n of s)for(const r of n.getSeries(e))if(i=!!t.call(null,r),i)return i}return i}function IV(s,t){const e=[];for(const i of s)for(const n of i.getSeries(t))e.push(n);return e}const Cx=(s,t)=>{for(let e=0;e<s.length;e++){const i=s[e].getSeries();for(let n=0;n<i.length;n++){const r=i[n];if(t&&r&&r.coordinate===t||!t&&r)return r}}return null};function Op(s){return function(t){let e;return e=U(s)?s.reduce((i,n)=>i==null?void 0:i[n],t):t==null?void 0:t[s],e}}var j;(function(s){s.area="area",s.line="line",s.bar="bar",s.bar3d="bar3d",s.rangeColumn="rangeColumn",s.rangeColumn3d="rangeColumn3d",s.rangeArea="rangeArea",s.dot="dot",s.geo="geo",s.link="link",s.map="map",s.pie="pie",s.pie3d="pie3d",s.radar="radar",s.rose="rose",s.scatter="scatter",s.circularProgress="circularProgress",s.wordCloud="wordCloud",s.wordCloud3d="wordCloud3d",s.funnel="funnel",s.funnel3d="funnel3d",s.linearProgress="linearProgress",s.boxPlot="boxPlot",s.sankey="sankey",s.gaugePointer="gaugePointer",s.gauge="gauge",s.treemap="treemap",s.sunburst="sunburst",s.circlePacking="circlePacking",s.waterfall="waterfall",s.heatmap="heatmap",s.correlation="correlation"})(j||(j={}));var $k;(function(s){s.label="label",s.point="point",s.line="line",s.area="area",s.bar="bar",s.bar3d="bar3d",s.boxPlot="boxPlot",s.outlier="outlier",s.circlePacking="circlePacking",s.group="group",s.gridBackground="gridBackground",s.grid="grid",s.dot="dot",s.title="title",s.subTitle="subTitle",s.symbol="symbol",s.funnel="funnel",s.funnel3d="funnel3d",s.transform="transform",s.transform3d="transform3d",s.transformLabel="transformLabel",s.outerLabel="outerLabel",s.outerLabelLine="outerLabelLine",s.pin="pin",s.pinBackground="pinBackground",s.pointer="pointer",s.segment="segment",s.track="track",s.cell="cell",s.cellBackground="cellBackground",s.link="link",s.arrow="arrow",s.pie="pie",s.pie3d="pie3d",s.labelLine="labelLine",s.progress="progress",s.minLabel="minLabel",s.maxLabel="maxLabel",s.rose="rose",s.node="node",s.sunburst="sunburst",s.nonLeaf="nonLeaf",s.leaf="leaf",s.nonLeafLabel="nonLeafLabel",s.leaderLine="leaderLine",s.stackLabel="stackLabel",s.word="word",s.fillingWord="fillingWord",s.nodePoint="nodePoint",s.ripplePoint="ripplePoint",s.centerPoint="centerPoint",s.centerLabel="centerLabel",s.barBackground="barBackground",s.lineLabel="lineLabel",s.areaLabel="areaLabel"})($k||($k={}));const xt="__VCHART",Qo=500,tl=500,FV=`${xt}_LABEL_VISIBLE`,_v=`${xt}_ARC_TRANSFORM_VALUE`,HR=`${xt}_ARC_RATIO`,Yk=`${xt}_ARC_START_ANGLE`,Xk=`${xt}_ARC_END_ANGLE`,jV=`${xt}_ARC_K`,cr=`${xt}_ARC_MIDDLE_ANGLE`,zV=`${xt}_ARC_QUADRANT`,HV=`${xt}_ARC_RADIAN`,N_=-Math.PI/2,Px=3*Math.PI/2,Td=-90,Dp=270,pu=.6,zr=9,gs=0;var Fn;(function(s){s.enter="enter",s.update="update",s.exit="exit",s.group="group"})(Fn||(Fn={}));var ie;(function(s){s.enter="enter",s.update="update",s.exit="exit",s.unChange="unChange"})(ie||(ie={}));var nt;(function(s){s.arc="arc",s.arc3d="arc3d",s.area="area",s.image="image",s.line="line",s.path="path",s.rect="rect",s.rect3d="rect3d",s.rule="rule",s.shape="shape",s.symbol="symbol",s.text="text",s.richtext="richtext",s.polygon="polygon",s.pyramid3d="pyramid3d",s.circle="circle",s.cell="cell",s.interval="interval",s.group="group",s.glyph="glyph",s.component="component",s.largeRects="largeRects",s.largeSymbols="largeSymbols"})(nt||(nt={}));var ge;(function(s){s.axis="axis",s.grid="grid",s.legend="legend",s.slider="slider",s.label="label",s.datazoom="datazoom",s.player="player",s.title="title",s.scrollbar="scrollbar"})(ge||(ge={}));var Kk;(function(s){s[s.player=1]="player",s[s.rollUp=2]="rollUp",s[s.drillDown=3]="drillDown",s[s.slider=4]="slider",s[s.datazoom=5]="datazoom",s[s.legend=6]="legend",s[s.scrollbar=7]="scrollbar",s[s.brush=8]="brush",s[s.normal=9]="normal"})(Kk||(Kk={}));var Hn;(function(s){s.lineAxis="lineAxis",s.circleAxis="circleAxis"})(Hn||(Hn={}));var ai;(function(s){s.lineAxisGrid="lineAxisGrid",s.circleAxisGrid="circleAxisGrid"})(ai||(ai={}));var qk;(function(s){s.discreteLegend="discreteLegend",s.colorLegend="colorLegend",s.sizeLegend="sizeLegend"})(qk||(qk={}));var Zk;(function(s){s.lineCrosshair="lineCrosshair",s.rectCrosshair="rectCrosshair",s.sectorCrosshair="sectorCrosshair",s.circleCrosshair="circleCrosshair",s.polygonCrosshair="polygonCrosshair",s.ringCrosshair="ringCrosshair"})(Zk||(Zk={}));var Jk;(function(s){s.symbolLabel="symbolLabel",s.rectLabel="rectLabel",s.lineLabel="lineLabel",s.dataLabel="dataLabel"})(Jk||(Jk={}));var Qk;(function(s){s.continuousPlayer="continuousPlayer",s.discretePlayer="discretePlayer"})(Qk||(Qk={}));var Fs;(function(s){s.before="before",s.layouting="layouting",s.reevaluate="reevaluate",s.after="after"})(Fs||(Fs={}));var ut;(function(s){s.BEFORE_EVALUATE_DATA="beforeEvaluateData",s.AFTER_EVALUATE_DATA="afterEvaluateData",s.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",s.AFTER_EVALUATE_SCALE="afterEvaluateScale",s.BEFORE_PARSE_VIEW="beforeParseView",s.AFTER_PARSE_VIEW="afterParseView",s.BEFORE_TRANSFORM="beforeTransform",s.AFTER_TRANSFORM="afterTransform",s.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",s.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",s.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",s.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",s.BEFORE_STAGE_RESIZE="beforeStageResize",s.AFTER_STAGE_RESIZE="afterStageResize",s.BEFORE_VRENDER_DRAW="beforeVRenderDraw",s.AFTER_VRENDER_DRAW="afterVRenderDraw",s.BEFORE_MARK_JOIN="beforeMarkJoin",s.AFTER_MARK_JOIN="afterMarkJoin",s.BEFORE_MARK_UPDATE="beforeMarkUpdate",s.AFTER_MARK_UPDATE="afterMarkUpdate",s.BEFORE_MARK_STATE="beforeMarkState",s.AFTER_MARK_STATE="afterMarkState",s.BEFORE_MARK_ENCODE="beforeMarkEncode",s.AFTER_MARK_ENCODE="afterMarkEncode",s.BEFORE_DO_LAYOUT="beforeDoLayout",s.AFTER_DO_LAYOUT="afterDoLayout",s.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",s.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",s.BEFORE_DO_RENDER="beforeDoRender",s.AFTER_DO_RENDER="afterDoRender",s.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",s.AFTER_MARK_RENDER_END="afterMarkRenderEnd",s.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",s.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",s.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",s.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",s.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",s.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",s.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",s.BEFORE_ELEMENT_STATE="beforeElementState",s.AFTER_ELEMENT_STATE="afterElementState",s.BEFORE_ELEMENT_ENCODE="beforeElementEncode",s.AFTER_ELEMENT_ENCODE="afterElementEncode",s.ANIMATION_START="animationStart",s.ANIMATION_END="animationEnd",s.ELEMENT_ANIMATION_START="elementAnimationStart",s.ELEMENT_ANIMATION_END="elementAnimationEnd",s.ALL_ANIMATION_START="allAnimationStart",s.ALL_ANIMATION_END="allAnimationEnd"})(ut||(ut={}));var Sy;(function(s){s.signal="signal",s.data="data",s.scale="scale",s.coordinate="coordinate",s.mark="mark"})(Sy||(Sy={}));var tw;(function(s){s.active="active",s.selected="selected",s.highlight="highlight",s.blur="blur"})(tw||(tw={}));const uo="__vgrammar_scene_item__",GR=[nt.line,nt.area],GV=[nt.arc3d,nt.rect3d,nt.pyramid3d],Gn="key",Lp=[{}],WV=["key"],NV=!0,VV=!0,UV=!1,$V=null,YV=!0,ew="VGRAMMAR_IMMEDIATE_ANIMATION",iw=0,WR=1e3,Ay=0,sw=0,nw=!1,ky=!1,wy="quintInOut",rw={stopWhenStateChange:!1,immediatelyApply:!0},XV="VGRAMMAR_ANIMATION_PARAMETERS";function Ex(s,t){return Y(s).reduce((e,i)=>{const n=ot(i)?t.getGrammarById(i):i;return n&&e.push(n),e},[])}function KV(s){return!q(s)&&!!(s!=null&&s.signal)}function qV(s){return!q(s)&&!!(s!=null&&s.callback)}function Hi(s,t){if(C(s))return[];if(KV(s)){const e=s.signal;if(ot(e))return Y(t.getGrammarById(e));if((e==null?void 0:e.grammarType)==="signal")return[e]}else if(qV(s))return Ex(s.dependency,t);return[]}function Zr(s){return q(s)||(s==null?void 0:s.signal)||!!(s!=null&&s.callback)}function Be(s,t,e,i){if(C(s))return s;if(q(s))return i?s.call(null,e,i,t):s.call(null,e,t);if(s.signal){const n=s.signal;return ot(n)?t==null?void 0:t[n]:n.output()}return s.callback?i?s.callback.call(null,e,i,t):s.callback.call(null,e,t):s}function mv(s,t){if(C(s))return s;if(q(s))return s.call(null,t);if(s.signal){const e=s.signal;return ot(e)?t==null?void 0:t[e]:e.output()}return s.callback?s.callback.call(null,t):s}function gu(s,t){return dc(s)?s.output():t[s]}function ZV(s){return s&&(s.signal||s.callback)}const dc=s=>s&&!C(s.grammarType),jl=s=>q(s)?s:t=>t[s];function V_(s){return!!(s!=null&&s.scale)}function Rx(s){return!!(s!=null&&s.field)}function za(s,t){if(!s)return[];let e=[];return s.scale&&(e=dc(s.scale)?[s.scale]:Y(t.getScaleById(s.scale))),e.concat(Hi(s,t))}function qg(s,t){switch(t){case"line":return s.some(e=>["x","y","defined"].includes(e));case"area":return s.some(e=>["x","y","x1","y1","defined"].includes(e));case"largeRects":return s.some(e=>["x","y","width","y1"].includes(e));case"largeSymbols":return s.some(e=>["x","y"].includes(e))}return!1}function JV(s){const{x:t,y:e,x1:i,y1:n}=s;return H(t)&&H(e)&&H(i)&&H(n)?[{x:t,y:e},{x:i,y:n}]:[]}function QV(s,t,e,i){return!s||!s.length||s.length===1&&t?[]:s.some(n=>qg(Object.keys(n.nextAttrs),"line"))?s.map((n,r)=>{var a;const o=n.nextAttrs,{x:l,y:h,x1:d,y1:u,defined:c}=(a=e==null?void 0:e[r])!==null&&a!==void 0?a:{};return C(o.x)&&(o.x=l),C(o.y)&&(o.y=h),C(o.defined)&&c===!1&&(o.defined=!1),o.context=n.key,i&&(C(o.x1)&&(o.x1=d),C(o.y1)&&(o.y1=u)),o}):e??[]}function tU(s,t,e=[]){if(!s||!s.length||s.length===1&&t)return[];const i=new Float32Array(4*s.length);return s.forEach((n,r)=>{var a,o,l,h;const d=n.nextAttrs,u=(a=d.x)!==null&&a!==void 0?a:e[4*r],c=(o=d.y)!==null&&o!==void 0?o:e[4*r+1],p=(l=d.width)!==null&&l!==void 0?l:e[4*r+2],g=(h=d.y1)!==null&&h!==void 0?h:e[4*r+3];i[4*r]=u,i[4*r+1]=c,i[4*r+2]=p,i[4*r+3]=g-c}),i}function eU(s,t,e=[]){if(!s||!s.length||s.length===1&&t)return[];const i=new Float32Array(2*s.length);return s.forEach((n,r)=>{var a,o;const l=n.nextAttrs,h=(a=l.x)!==null&&a!==void 0?a:e[2*r],d=(o=l.y)!==null&&o!==void 0?o:e[2*r+1];i[2*r]=h,i[2*r+1]=d}),i}function Zg(s,t){if(["x","y","dx","dy"].includes(t))return!0;switch(s){case nt.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(t);case nt.group:case nt.rect:case nt.image:return["width","height","y1"].includes(t);case nt.path:case nt.shape:return["path","customPath"].includes(t);case nt.line:return t==="defined";case nt.area:return["x1","y1","defined"].includes(t);case nt.rule:return["x1","y1"].includes(t);case nt.symbol:return t==="size";case nt.polygon:return t==="points";case nt.text:return t==="text"}return!1}function iU(s){return[nt.line,nt.area,nt.largeRects,nt.largeSymbols].includes(s)}class sU{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return ot(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}let st=class Ie{static registerPlotMarks(t,e){Ie._plotMarks[t]=e}static createPlotMark(t,e){return Ie._plotMarks[t]?new Ie._plotMarks[t](e):null}static registerMark(t,e){Ie._marks[t]=e}static createMark(t,e,i){return Ie._marks[t]?new Ie._marks[t](e,t,i):null}static hasMark(t){return!!Ie._marks[t]}static registerComponent(t,e){Ie._components[t]=e}static createComponent(t,e,i,n){const r=Ie._components[t];return r?new r(e,i,n):null}static hasComponent(t){return!!Ie._components[t]}static registerGraphicComponent(t,e){Ie._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const n=Ie._graphicComponents[t];return n?n(e,i):null}static registerTransform(t,e,i){Ie._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return Ie._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(Ie._transforms).forEach(t=>{Ie._transforms[t]&&!Ie._transforms[t].isBuiltIn&&(Ie._transforms[t]=null)})}static registerGrammar(t,e,i){Ie._grammars[t]={grammarClass:e,specKey:i??t}}static createGrammar(t,e,i){var n;const r=(n=Ie._grammars[t])===null||n===void 0?void 0:n.grammarClass;return r?new r(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return Ie._glyphs[t]}static createInteraction(t,e,i){const n=Ie._interactions[t];return n?new n(e,i):null}};st._plotMarks={},st._marks={},st._components={},st._graphicComponents={},st._transforms={},st._grammars={},st._glyphs={},st._animations={},st._interactions={},st._graphics={},st.registerGlyph=(s,t,e,i,n)=>(st._glyphs[s]=new sU(t,e,i,n),st._glyphs[s]),st.registerAnimationType=(s,t)=>{st._animations[s]=t},st.getAnimationType=s=>st._animations[s],st.registerInteraction=(s,t)=>{st._interactions[s]=t},st.registerGraphic=(s,t)=>{st._graphics[s]=t},st.getGraphicType=s=>st._graphics[s],st.createGraphic=(s,t)=>{const e=st._graphics[s];return e?e(t):null};function nr(s,t,e,i,n){e&&(Zr(e)?t.forEach(r=>{const a=Be(e,i,r.datum,s);Object.assign(r.nextAttrs,a)}):Object.keys(e).forEach(r=>{var a,o;const l=e[r],h=n&&!Zg(s.mark.markType,r)?[t[0]]:t;if(V_(l)){const d=gu(l.scale,i),u=(a=l==null?void 0:l.offset)!==null&&a!==void 0?a:0,c=!C(l.band)&&d.bandwidth?d.bandwidth()*l.band:null,p=ot(l==null?void 0:l.field),g=p?bn(l.field):null;let f=p?null:C(l==null?void 0:l.value)?0:(o=d.scale)===null||o===void 0?void 0:o.call(d,l.value);h.forEach(_=>{var m;p&&(f=(m=d.scale)===null||m===void 0?void 0:m.call(d,g(_.datum))),_.nextAttrs[r]=lt(f)||lt(c)?f+u+c:f})}else if(Rx(l)){const d=bn(l.field);h.forEach(u=>{u.nextAttrs[r]=d(u.datum)})}else h.forEach(d=>{d.nextAttrs[r]=Be(l,i,d.datum,s)})}))}function Qa(s,t,e,i){if(!s)return null;if(Zr(s))return Be(s,i,t,e);const n={};return Object.keys(s).forEach(r=>{var a,o,l;const h=s[r];if(V_(h)){const d=gu(h.scale,i),u=(a=h==null?void 0:h.offset)!==null&&a!==void 0?a:0,c=!C(h.band)&&d.bandwidth?d.bandwidth()*h.band:null,p=ot(h==null?void 0:h.field),g=p?bn(h.field):null,f=p?(o=d.scale)===null||o===void 0?void 0:o.call(d,g(t)):C(h==null?void 0:h.value)?0:(l=d.scale)===null||l===void 0?void 0:l.call(d,h.value);n[r]=lt(f)||lt(c)?f+u+c:f}else if(Rx(h)){const d=bn(h.field);n[r]=d(t)}else n[r]=Be(h,i,t,e)}),n}function nU(s,t,e){if(Zr(t))return{themeEncoder:{},positionEncoder:t};const i={},n={};if(s===nt.glyph&&st.getGlyph(e)){const r=st.getGlyph(e),a=r.getProgressiveChannels();if(a)Object.keys(t).forEach(o=>{a.includes(o)?n[o]=t[o]:i[o]=t[o]});else{const o=Array.from(new Set(Object.values(r.getMarks())));Object.keys(t).forEach(l=>{o.some(h=>Zg(h,l))?n[l]=t[l]:i[l]=t[l]})}}else Object.keys(t).forEach(r=>{Zg(s,r)?n[r]=t[r]:i[r]=t[r]});return{positionEncoder:n,themeEncoder:i}}const NR=s=>!!nt[s];function Md(s,t,e={}){var i;const n=st.getGraphicType(t)?st.createGraphic(t,e):st.createGraphicComponent(t,e,{skipDefault:(i=s==null?void 0:s.spec)===null||i===void 0?void 0:i.skipTheme});return n||zt.getInstance().error(`create ${t} graphic failed!`),n}function rU(s,t,e={}){if(!st.getGraphicType(nt.glyph))return;const i=st.createGraphic(nt.glyph,e),n=t.getMarks(),r=Object.keys(n).map(a=>{if(st.getGraphicType(n[a])){const o=st.createGraphic(n[a]);if(o)return o.name=a,o}});return i.setSubGraphic(r),i}const Jg=s=>{s&&(s[uo]=null,s.release(),s.parent&&s.parent.removeChild(s))},aw=["fillOpacity"],ow=(s,t,e)=>{var i;return t==="fillOpacity"?(s.fillOpacity=(i=e.fillOpacity)!==null&&i!==void 0?i:1,["fillOpacity"]):[]};function aU(s,t,e,i,n,r){const a=n.getGraphicAttribute(s,!1,r);if(a)return t.forEach(l=>{l in i&&(a[l]=i[l])}),a;const o={};return t.forEach(l=>{o[l]=i[l]}),e[s]=o,o}const co={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(s,t,e)=>{var i,n,r,a,o,l,h,d,u,c,p,g;H(t.width)||!H(t.x1)&&H(e.width)?(s.x=Math.min((i=e.x)!==null&&i!==void 0?i:0,(n=e.x1)!==null&&n!==void 0?n:1/0),s.width=e.width):H(t.x1)||!H(t.width)&&H(e.x1)?(s.x=Math.min(e.x,e.x1),s.width=Math.abs(e.x1-e.x)):(s.x=Math.min((r=e.x)!==null&&r!==void 0?r:0,(a=e.x1)!==null&&a!==void 0?a:1/0),s.width=e.width),H(t.height)||!H(t.y1)&&H(e.height)?(s.y=Math.min((o=e.y)!==null&&o!==void 0?o:0,(l=e.y1)!==null&&l!==void 0?l:1/0),s.height=e.height):H(t.y1)||!H(t.height)&&H(e.y1)?(s.y=Math.min(e.y,e.y1),s.height=Math.abs(e.y1-e.y)):(s.y=Math.min((h=e.y)!==null&&h!==void 0?h:0,(d=e.y1)!==null&&d!==void 0?d:1/0),s.height=e.height),H(t.length)||!H(t.z1)&&H(e.length)?(s.z=Math.min((u=e.z)!==null&&u!==void 0?u:0,(c=e.z1)!==null&&c!==void 0?c:1/0),s.length=e.length):H(t.z1)||!H(t.length)&&H(e.z1)?(s.z=Math.min(e.z,e.z1),s.length=Math.abs(e.z1-e.z)):(s.z=Math.min((p=e.z)!==null&&p!==void 0?p:0,(g=e.z1)!==null&&g!==void 0?g:1/0),s.length=e.length)},storedAttrs:"sizeAttrs"}],[nt.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(s,t,e)=>{var i,n,r,a;const o=(i=e.limit)!==null&&i!==void 0?i:1/0,l=(n=e.autoLimit)!==null&&n!==void 0?n:1/0,h=Math.min(o,l),d=vn(e.text)&&!C(e.text.text),u=d?e.text.text:e.text;s.maxLineWidth=h===1/0?e.maxLineWidth:h,d?e.text.type==="html"?(s.html={dom:u,width:(r=t.width)!==null&&r!==void 0?r:h,height:(a=t.height)!==null&&a!==void 0?a:t.fontSize,anchorType:"position"},s.text=""):e.text.type==="rich"?s.textConfig=u:s.text=u:s.text=u},storedAttrs:"limitAttrs"}],[nt.rule]:[{channels:["x","y","x1","y1"],transform:(s,t,e)=>{const i=JV(e);s.points=i,s.x=0,s.y=0},storedAttrs:"pointAttrs"}],[nt.symbol]:[{channels:["shape","symbolType"],transform:(s,t,e)=>{var i;s.symbolType=(i=t.shape)!==null&&i!==void 0?i:t.symbolType}},{channels:["image","fill","background"],transform:(s,t,e)=>{t.image?(s.background=t.image,s.fill=!1):e.image?(s.background=e.image,s.fill=!1):(s.fill=e.fill,s.background=e.background)},storedAttrs:"imageAttrs"}],[nt.richtext]:[{channels:["text","textConfig"],transform:(s,t,e)=>{var i,n,r,a;s.text=null,((i=t.text)===null||i===void 0?void 0:i.type)==="rich"?s.textConfig=t.text.text:((n=t.textConfig)===null||n===void 0?void 0:n.type)==="html"?(s.html={dom:t.textConfig.text,width:t.width,height:(r=t.height)!==null&&r!==void 0?r:t.fontSize,anchorType:"position"},s.text=""):((a=t.textConfig)===null||a===void 0?void 0:a.type)==="rich"?s.textConfig=t.textConfig.text:s.textConfig=t.textConfig}}]};function oU(s,t){var e;return((e=co[s])!==null&&e!==void 0?e:[]).reduce((i,n)=>(n.channels.forEach(r=>{Gs(t,r)&&(i[r]=t[r])}),i),{})}const fu=(s,t,e,i)=>{const n={},r=t?Object.keys(t):[],a=ot(s)?co[s]:s;if(a&&a.length){const o=[];r.forEach(l=>{let h=!1;a.forEach((d,u)=>{if(d.channels.includes(l)){if(!o[u])if(d.storedAttrs){const c=aU(d.storedAttrs,d.channels,n,t,e,i);d.transform(n,t,c)}else d.transform(n,t,null);o[u]=!0,h=!0}}),h||(aw.includes(l)?ow(n,l,t):n[l]=t[l])})}else r.forEach(o=>{aw.includes(o)?ow(n,o,t):n[o]=t[o]});return n},lU=(s,t)=>{var e,i;if(s===t)return!0;const n=(e=s&&s.length)!==null&&e!==void 0?e:0;return n===((i=t&&t.length)!==null&&i!==void 0?i:0)&&n!==0&&s.every((r,a)=>!r&&!t[a]||r&&t[a]&&r.color===t[a].color&&r.offset===t[a].offset)},hU=(s,t)=>{if(s===t)return!0;if(typeof s!=typeof t||ot(s)||s.gradient!==t.gradient)return!1;const e=Object.keys(s),i=Object.keys(t);return e.length===i.length&&e.every(n=>n==="stops"?lU(s[n],t[n]):s[n]===t[n])},dU=(s,t)=>s.length===t.length&&s.join("-")===t.join("-"),uU=(s,t,e)=>!(!C(s)||!C(t))||!C(s)&&!C(t)&&(e==="lineDash"?dU(s,t):e==="stroke"||e==="fill"?hU(s,t):s===t),cU=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"],VR=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],pU=cU.concat(VR);function gU(s,t,e){var i;if(!s||s.length<=1)return null;const n=((i=e==null?void 0:e.mark)===null||i===void 0?void 0:i.markType)==="area"?pU:VR,r=[];let a=null;return s.forEach((o,l)=>{a&&n.every(h=>uU(a[h],o[h],h))||(r.length&&(r[r.length-1].endIndex=l),a=o,r.push({attrs:a,startIndex:l}))}),r.length>=2?r.map(o=>{const l=fu(nt.line,UR(o.attrs),e);return l.points=t.slice(o.startIndex,C(o.endIndex)?t.length:o.endIndex),l}):null}function fU(s){return s?s.reduce((t,e)=>t.concat(e.points),[]):null}function UR(s){const t={};return s&&Object.keys(s).forEach(e=>{e!=="x"&&e!=="y"&&e!=="x1"&&e!=="y1"&&e!=="defined"&&e!=="size"&&e!=="width"&&e!=="height"&&e!=="context"&&(t[e]=s[e])}),t}let $R=class{constructor(t){this.data=null,this.states=[],this.diffState=ie.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(e,i)=>{var n,r,a;const o=!C((n=this.runtimeStatesEncoder)===null||n===void 0?void 0:n[e]),l=o?this.runtimeStatesEncoder[e]:(r=this.mark.getSpec().encode)===null||r===void 0?void 0:r[e];if(!l)return{};if(q(l))return l(this.getDatum(),this,e,i);if(!o&&(!((a=this.graphicItem.states)===null||a===void 0)&&a[e]))return this.graphicItem.states[e];const h=this.items.map(u=>Object.assign({},u,{nextAttrs:{}}));nr(this,h,l,this.mark.parameters());const d=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[e]||(this.graphicItem.states[e]=d):this.graphicItem.states={[e]:d},d},this.mark=t}initGraphicItem(t={}){if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?fu(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[uo]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=i=>this.mark?fu(e,i,this):i),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t)))}updateGraphicItem(t){if(!this.graphicItem)return;C(t.clip)||this.graphicItem.setAttribute("clip",t.clip),C(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),C(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===ie.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=this.mark.animate.getAnimationConfigs("state");e.length!==0&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&((e=(t=this.graphicItem.animates)===null||t===void 0?void 0:t.forEach)===null||e===void 0||e.call(t,i=>i.stop())),this.graphicItem&&(Jg(this.graphicItem),this.graphicItem[uo]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return(t=this.graphicItem)===null||t===void 0?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var n;this.mark.emit(ut.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const r=jl(i);return this.items=e.map(a=>({datum:a,key:r(a),view:this.mark.view,nextAttrs:{}})),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:(n=this.items)===null||n===void 0?void 0:n[0].key,this.mark.emit(ut.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),r=this.states,a=Y(Be(t,e,this.getDatum(),this)),o=(i=this.mark.getSpec())===null||i===void 0?void 0:i.stateSort;o&&o.sort(o);const l=a.length!==r.length||a.some((h,d)=>h!==r[d]);this.states=a,!n&&l&&this.diffState===ie.unChange&&(this.diffState=ie.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&(this.mark.isCollectionMark()&&delete t.defined,Object.assign(e,t)),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==ie.enter&&this.diffState!==ie.update||!this.states.length||this.useStates(this.states),this.mark.markType===nt.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach(i=>{i.nextAttrs={}}),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=(t=this.mark.getSpec())===null||t===void 0?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=i=>e(this.data,i,new Je))}encodeItems(t,e,i=!1,n){const r=this.mark.isCollectionMark(),a=e[Fn.update],o=e[Fn.enter],l=e[Fn.exit],h=this.mark.isLargeMode()||r&&!this.mark.getSpec().enableSegments;this.diffState===ie.enter?(o&&nr(this,t,o,n,h),a&&nr(this,t,a,n,h)):this.diffState===ie.update?((r&&o||i)&&nr(this,t,o,n,h),a&&nr(this,t,a,n,h)):this.diffState===ie.exit&&l&&(i&&nr(this,t,o,n,h),nr(this,t,l,n,h))}coordinateTransformEncode(t){if(!this.mark.coord||this.mark.markType==="arc"||this.mark.disableCoordinateTransform===!0)return;const e=this.mark.coord.output();t.forEach(i=>{const n=i.nextAttrs,r=e.convert(n);Object.assign(n,r)})}clearStates(t){const e=pe(t)?t:this.mark.animate.getAnimationConfigs("state").length!==0;this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&ot(t)&&!_e(e,(i=this.runtimeStatesEncoder)===null||i===void 0?void 0:i[t])){const a=this.states.slice();return a.includes(t)?this.graphicItem.clearStates():a.push(t),this._updateRuntimeStates(t,e),this.useStates(a),!0}const n=this.mark.getSpec().encode,r=Y(t).reduce((a,o)=>(o&&!a.includes(o)&&(n!=null&&n[o])&&a.push(o),a),this.states.slice());return r.length!==this.states.length&&(this.useStates(r),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter(n=>!e.includes(n));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach(n=>{this.runtimeStatesEncoder[n]=null}),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(ut.BEFORE_ELEMENT_STATE,{states:t},this);const n=(i=this.mark.getSpec())===null||i===void 0?void 0:i.stateSort;n&&t.sort(n),this.states=t;const r=pe(e)?e:this.mark.animate.getAnimationConfigs("state").length!==0;return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(ut.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)W_(n,i,t)&&Gs(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,r,a,o;const l=t[0];if(!l.nextAttrs||Object.keys(l.nextAttrs).length===0)return{};let h=l.nextAttrs;if(iU(e)&&t&&t.length&&C((n=l.nextAttrs)===null||n===void 0?void 0:n.points)&&(i===!0||qg(Object.keys(l.nextAttrs),this.mark.markType))){const d=this.getGraphicAttribute("points",!1),u=this.getGraphicAttribute("segments",!1),c=this.mark.getSpec().enableSegments,p=t.map(f=>f.nextAttrs),g=this.mark.isProgressive();if(h=UR(h),e===nt.line||e===nt.area){const f=QV(t,!0,d,e===nt.area);if(c&&!g){const _=f&&f.length!==0?f:fU(u),m=gU(p,_,this);m?(h.segments=m,h.points=null):(h.segments=null,h.points=_)}else g?h.segments=((o=(a=(r=this.graphicItem)===null||r===void 0?void 0:r.attribute)===null||a===void 0?void 0:a.segments)!==null&&o!==void 0?o:[]).concat([{points:f}]):(h.points=f,h.segments=null)}else e===nt.largeRects?h.points=tU(t,!0,d):e===nt.largeSymbols&&(h.points=eU(t,!0,d))}return h}applyGraphicAttributes(t){var e,i;if(!ft(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=(e=this.getPrevGraphicAttributes())!==null&&e!==void 0?e:{},a=(i=this.getFinalGraphicAttributes())!==null&&i!==void 0?i:{};Object.keys(n).forEach(h=>{r[h]=this.getGraphicAttribute(h),a[h]=n[h]}),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=this.mark.animate.getElementAnimators(this).reduce((h,d)=>Object.assign(h,d.getEndAttributes()),{}),l=Object.assign({},o,a);this.graphicItem.setAttributes(l)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t,e=!1){var i;if(!this.graphicItem)return;if(e){let a;const o=this.getPrevGraphicAttributes();if(!C(a=Et(o,t)))return a}const n=this.mark.getAttributeTransforms();let r=[t];if(n&&n.length){const a=n.find(o=>o.storedAttrs&&o.channels.includes(t));a&&(r=[a.storedAttrs,t])}return Et((i=this.graphicItem)===null||i===void 0?void 0:i.attribute,r)}setGraphicAttribute(t,e,i=!0){if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),r=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),r&&!Gs(r,t)&&(r[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t,e=!0){if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach(r=>{i&&e&&(i[r]=t[r]),n&&!Gs(n,r)&&(n[r]=this.graphicItem.attribute[r])}),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null))}clearGraphicAttributes(){this.graphicItem&&(this.graphicItem.prevAttrs&&this.setPrevGraphicAttributes(null),this.graphicItem.nextAttrs&&this.setNextGraphicAttributes(null),this.graphicItem.finalAttrs&&this.setFinalGraphicAttributes(null))}remove(){this.graphicItem&&(Jg(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(!((e=this.items)===null||e===void 0)&&e.length)return this.mark.isCollectionMark()?C(t)?this.items.map(n=>n.nextAttrs):this.items.map(n=>{var r;return(r=n.nextAttrs)===null||r===void 0?void 0:r[t]}):C(t)?this.items[0].nextAttrs:(i=this.items[0].nextAttrs)===null||i===void 0?void 0:i[t]}setItemAttributes(t){var e;!((e=this.items)===null||e===void 0)&&e.length&&(this.mark.isCollectionMark()?U(t)&&this.items.forEach((i,n)=>{Object.assign(i.nextAttrs,t[n])}):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?(t=this.items)!==null&&t!==void 0?t:[]:(e=this.items)===null||e===void 0?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?(t=this.data)!==null&&t!==void 0?t:[]:(e=this.data)===null||e===void 0?void 0:e[0]}};const lw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class ri extends Mh{constructor(t,e){super(t),e!=null&&e.mode&&(this.mode=e.mode,this.setMode(e.mode)),e!=null&&e.skipDefault&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage(()=>{this.render(),this.bindEvents()})}setAttribute(t,e,i){vn(this.attribute[t])&&vn(e)&&!q(this.attribute[t])&&!q(e)?at(this.attribute[t],e):this.attribute[t]=e,lw.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every(n=>lw.includes(n))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){C(e)&&(e=Object.keys(t));for(let i=0;i<e.length;i++){const n=e[i];!vn(this.attribute[n])||q(this.attribute[n])||q(t[n])?this.attribute[n]=t[n]:at(this.attribute[n],t[n])}}bindEvents(){}_getNodeId(t){return`${this.id}-${this.name}-${t}`}_dispatchEvent(t,e){var i;const n=new Xb(t,e);n.manager=(i=this.stage)===null||i===void 0?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}class _U{constructor(t){this.onPointerDown=e=>{const i=e.target,n=this.rootNode,r=i===n;if(i&&!r){let l=function(d){if(o||(d.type="dragstart",i==null||i.dispatchEvent(d),o=!0),d.type="drag",i==null||i.dispatchEvent(d),!r){i.pickable=!1;const u=(n==null?void 0:n.pick(d.global.x,d.global.y)).graphic;i.pickable=!0,a!==u&&(a&&(d.type="dragleave",d.target=a,a.dispatchEvent(d)),u&&(d.type="dragenter",d.target=u,u.dispatchEvent(d)),a=u,a&&(d.type="dragover",d.target=a,a.dispatchEvent(d)))}},a,o=!1;n==null||n.addEventListener("pointermove",l);const h=function(){o&&(a&&(e.type="drop",e.target=a,a.dispatchEvent(e)),e.type="dragend",i.dispatchEvent(e),o=!1),n==null||n.removeEventListener("pointermove",l)};i.addEventListener("pointerup",h,{once:!0}),i.addEventListener("pointerupoutside",h,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;(t=this.rootNode)===null||t===void 0||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;(t=this.rootNode)===null||t===void 0||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const hw=(s,t)=>{const e=t.x-s.x,i=t.y-s.y;return Math.abs(e)>Math.abs(i)?e>0?"right":"left":i>0?"down":"up"},ap=(s,t)=>{const e=Math.abs(t.x-s.x),i=Math.abs(t.y-s.y);return Math.sqrt(e*e+i*i)},mU=s=>{const t=s.length;if(t===1)return{x:Math.round(s[0].x),y:Math.round(s[0].y)};let e=0,i=0,n=0;for(;n<t;)e+=s[n].x,i+=s[n].y,n++;return{x:Math.round(e/t),y:Math.round(i/t)}};class vU extends vo{constructor(t,e={}){var i,n,r,a,o,l,h,d,u,c;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=p=>{this.reset(),this.startTime=Ya.now();const{cachedEvents:g,startPoints:f}=this;p&&g.push(p.clone()),f.length=g.length;for(let _=0;_<g.length;_++){const{x:m,y:v}=g[_],y={x:m,y:v};f[_]=y}if(f.length!==1)this.startDistance=ap(f[0],f[1]),this.center=mU([f[0],f[1]]);else{const _=g[0];this.pressTimeout=setTimeout(()=>{_.direction="none",_.deltaX=0,_.deltaY=0,_.points=f,this.triggerStartEvent("press",_),this.triggerEvent("press",_),this.eventType="press",this.direction="none"},this.config.press.time)}},this.onMove=p=>{this.clearPressTimeout();const{startPoints:g,cachedEvents:f}=this;if(!g.length)return;const _=p.clone(),{x:m,y:v,pointerId:y}=_;for(let w=0,T=f.length;w<T;w++)if(y===f[w].pointerId){f[w]=_;break}const b={x:m,y:v},x=f.map(w=>({x:w.x,y:w.y})),S=Ya.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=S,this.lastMovePoint=b,g.length===1){const w=g[0],T=m-w.x,M=v-w.y,P=this.direction||hw(w,b);this.direction=P;const O=this.getEventType(b);return _.direction=P,_.deltaX=T,_.deltaY=M,_.points=x,this.triggerStartEvent(O,_),void this.triggerEvent(O,_)}const{startDistance:A}=this,k=ap(x[0],x[1]);_.scale=k/A,_.center=this.center,_.points=x,this.triggerStartEvent("pinch",_),this.triggerEvent("pinch",_)},this.onEnd=p=>{const g=p.clone(),{cachedEvents:f,startPoints:_}=this,m=f.map(v=>({x:v.x,y:v.y}));if(g.points=m,this.triggerEndEvent(g),f.length===1){const v=Ya.now(),y=this.lastMoveTime;if(v-y<100){const b=y-(this.prevMoveTime||this.startTime);if(b>0){const x=this.prevMovePoint||_[0],S=this.lastMovePoint||_[0],A=ap(x,S),k=A/b;k>this.config.swipe.velocity&&A>this.config.swipe.threshold&&(g.velocity=k,g.direction=hw(x,S),this.triggerEvent("swipe",g))}}v-this.lastTapTime<this.config.tap.interval&&p.target===this.lastTapTarget?this.tapCount++:this.tapCount=1,this.lastTapTime=v,this.lastTapTarget=p.target,this.tapCount===1?this.triggerEvent("tap",g):this.tapCount===2&&(this.triggerEvent("doubletap",g),this.tapCount=0)}for(let v=0,y=f.length;v<y;v++)if(f[v].pointerId===g.pointerId){f.splice(v,1),_.splice(v,1);break}this.reset(),f.length>0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:(n=(i=e==null?void 0:e.press)===null||i===void 0?void 0:i.time)!==null&&n!==void 0?n:251,threshold:(a=(r=e==null?void 0:e.press)===null||r===void 0?void 0:r.threshold)!==null&&a!==void 0?a:9},swipe:{threshold:(l=(o=e==null?void 0:e.swipe)===null||o===void 0?void 0:o.threshold)!==null&&l!==void 0?l:10,velocity:(d=(h=e==null?void 0:e.swipe)===null||h===void 0?void 0:h.velocity)!==null&&d!==void 0?d:.3},tap:{interval:(c=(u=e==null?void 0:e.tap)===null||u===void 0?void 0:u.interval)!==null&&c!==void 0?c:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let r;return r=Ya.now()-i>this.config.press.time&&ap(n[0],t)<this.config.press.threshold?"press":"pan",this.eventType=r,r}enable(t){this.processEvent[t]=!0}isProcess(t){return this.processEvent[t]}pushEvent(t,e){const{emitThrottles:i}=this,n={type:t,ev:e};for(let r=0,a=i.length;r<a;r++)if(i[r].type===t)return void i.splice(r,1,n);i.push(n)}clearPressTimeout(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=null)}reset(){this.clearPressTimeout(),this.startTime=0,this.startDistance=0,this.direction=null,this.eventType=null,this.prevMoveTime=0,this.prevMovePoint=null,this.lastMoveTime=0,this.lastMovePoint=null}triggerEvent(t,e){this.pushEvent(t,e);const{throttleTimer:i,emitThrottles:n}=this;i||(this.throttleTimer=tt.global.getRequestAnimationFrame()(()=>{for(let r=0,a=n.length;r<a;r++){const{type:o,ev:l}=n[r];this.emitEvent(o,l)}this.throttleTimer=0,this.emitThrottles.length=0}))}triggerStartEvent(t,e){this.isProcess(t)||(this.enable(t),this.triggerEvent(`${t}start`,e))}triggerEndEvent(t){const e=this.processEvent;Object.keys(e).forEach(i=>{this.triggerEvent(`${i}end`,t),i==="press"&&this.triggerEvent(`${i}up`,t),delete e[i]})}emitEvent(t,e){const i=this.element._events[ME];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,r=i.length;n<r&&!e.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,e,t);this.emit(t,e)}}var yU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},bU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};const jt=[0,0,0],xU=new ze(1,0,0,1,0,0),SU=(s,t,e,i,n,r,a,o)=>{if(o)for(;e>t;)e-=It;else for(;e<t;)e+=It;const l=ne/3*(e>t?1:-1);let h=t,d=h;for(;d!==e;){d=l>0?Math.min(d+l,e):Math.max(d+l,e);const u=Math.abs(d-h),c=4*Math.tan(u/4)/3,p=d<h?-1:1,g=Math.cos(h),f=Math.sin(h),_=Math.cos(d),m=Math.sin(d),v=g*r+i,y=f*a+n,b=_*r+i,x=m*a+n,S=r*c*p,A=a*c*p;s.push([v-S*f,y+A*g,b+S*m,x-A*_,b,x]),h=d}};let zl=class{set fillStyle(s){this.nativeContext.fillStyle=s}get fillStyle(){return this.nativeContext.fillStyle}set font(s){this.nativeContext.font=s}get font(){return this.nativeContext.font}set globalAlpha(s){this.nativeContext.globalAlpha=s}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(s){this.nativeContext.lineCap=s}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(s){this.nativeContext.lineDashOffset=s}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(s){this.nativeContext.lineJoin=s}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(s){this.nativeContext.lineWidth=s}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(s){this.nativeContext.miterLimit=s}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(s){this.nativeContext.shadowBlur=s}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(s){this.nativeContext.shadowColor=s}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(s){this.nativeContext.shadowOffsetX=s}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(s){this.nativeContext.shadowOffsetY=s}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(s){this.nativeContext.strokeStyle=s}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(s){this.nativeContext.textAlign=s}get textAlign(){return this.nativeContext.textAlign}set textBaseline(s){this.nativeContext.textBaseline=s}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(s){s!==!!this._inuse&&(this._inuse=s,s?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(s,t){this.fillAttributes=Object.assign(Object.assign({},vE),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},yE),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},_r),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const e=s.nativeCanvas.getContext("2d");if(!e)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=e,this.canvas=s,this.matrix=new ze(1,0,0,1,0,0),this.stack=[],this.dpr=t,this.applyedMatrix=new ze(1,0,0,1,0,0)}reset(){this.stack.length&&zt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ze(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(s=!1){!s&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(s){return Ys.allocateByObj(s)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(Ys.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Ys.free(this.matrix),this.matrix=this.stack.pop())}rotate(s,t=!0){this.matrix.rotate(s),t&&this.setTransformForCurrent()}save(){const s=this.cloneMatrix(this.matrix);this.stack.push(s),this.nativeContext.save()}highPerformanceSave(){const s=this.cloneMatrix(this.matrix);this.stack.push(s)}scale(s,t,e=!0){this.matrix.scale(s,t),e&&this.setTransformForCurrent()}setScale(s,t,e=!0){this.matrix.setScale(s,t),e&&this.setTransformForCurrent()}scalePoint(s,t,e,i,n=!0){this.translate(e,i,!1),this.scale(s,t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}setTransform(s,t,e,i,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*s,o*t,o*e,o*i,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(s,t=!0,e=this.dpr){this.matrix.setValue(s.a*e,s.b*e,s.c*e,s.d*e,s.e*e,s.f*e),t&&this.setTransformForCurrent()}resetTransform(s=!0,t=this.dpr){this.setTransform(t,0,0,t,0,0),s&&this.setTransformForCurrent()}transform(s,t,e,i,n,r,a=!0){this.matrix.multiply(s,t,e,i,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(s,t){this.matrix.multiply(s.a,s.b,s.c,s.d,s.e,s.f),t&&this.setTransformForCurrent()}translate(s,t,e=!0){this.matrix.translate(s,t),e&&this.setTransformForCurrent()}rotateDegrees(s,t=!0){const e=s*Math.PI/180;this.rotate(e,t)}rotateAbout(s,t,e,i=!0){this.translate(t,e,!1),this.rotate(s,!1),this.translate(-t,-e,!1),i&&this.setTransformForCurrent()}rotateDegreesAbout(s,t,e,i=!0){this.translate(t,e,!1),this.rotateDegrees(s,!1),this.translate(-t,-e,!1),i&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(s,t){s?typeof s=="string"?this.nativeContext.clip(s):this.nativeContext.clip(s,t):this.nativeContext.clip()}arc(s,t,e,i,n,r,a){if(a=a||0,this.camera){const o=[];SU(o,i,n,s,t,e,e,r);for(let l=0;l<o.length;++l){const h=o[l];this.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5],a)}}else this.nativeContext.arc(s,t,e,i,n,r)}arcTo(s,t,e,i,n){this.nativeContext.arcTo(s,t,e,i,n)}bezierCurveTo(s,t,e,i,n,r,a){if(a=a||0,this.camera){let o=a,l=a;this.modelMatrix&&(bs(jt,[s,t,a],this.modelMatrix),s=jt[0],t=jt[1],o=jt[2],bs(jt,[e,i,a],this.modelMatrix),e=jt[0],i=jt[1],l=jt[2],bs(jt,[n,r,a],this.modelMatrix),n=jt[0],r=jt[1],a=jt[2]);let h=this.camera.vp(n,r,a);n=h.x,r=h.y,h=this.camera.vp(s,t,o),s=h.x,t=h.y,h=this.camera.vp(e,i,l),e=h.x,i=h.y}this.nativeContext.bezierCurveTo(s,t,e,i,n,r)}closePath(){this.nativeContext.closePath()}ellipse(s,t,e,i,n,r,a,o){o==null?this.nativeContext.ellipse(s,t,e,i,n,r,a):this.nativeContext.ellipse(s,t,e,i,n,r,a,o)}lineTo(s,t,e){if(e=e||0,this.camera){this.modelMatrix&&(bs(jt,[s,t,e],this.modelMatrix),s=jt[0],t=jt[1],e=jt[2]);const i=this.camera.vp(s,t,e);s=i.x,t=i.y}this.nativeContext.lineTo(s,t)}moveTo(s,t,e){if(e=e||0,this.camera){this.modelMatrix&&(bs(jt,[s,t,e],this.modelMatrix),s=jt[0],t=jt[1],e=jt[2]);const i=this.camera.vp(s,t,e);s=i.x,t=i.y}this.nativeContext.moveTo(s,t)}quadraticCurveTo(s,t,e,i,n){if(n=n||0,this.camera){let r=n;this.modelMatrix&&(bs(jt,[s,t,n],this.modelMatrix),s=jt[0],t=jt[1],r=jt[2],bs(jt,[e,i,n],this.modelMatrix),e=jt[0],i=jt[1],n=jt[2]);let a=this.camera.vp(e,i,n);e=a.x,i=a.y,a=this.camera.vp(s,t,r),s=a.x,t=a.y}this.nativeContext.quadraticCurveTo(s,t,e,i)}rect(s,t,e,i,n){n=n||0,this.camera?(this.moveTo(s,t,n),this.lineTo(s+e,t,n),this.lineTo(s+e,t+i,n),this.lineTo(s,t+i,n),this.closePath()):this.nativeContext.rect(s,t,e,i)}createImageData(){const s=arguments;return s.length===2?this.nativeContext.createImageData(s[0],s[1]):s.length===1?this.nativeContext.createImageData(s[0]):null}createLinearGradient(s,t,e,i){return this.nativeContext.createLinearGradient(s,t,e,i)}createPattern(s,t){return s.width===0||s.height===0?null:this.nativeContext.createPattern(s,t)}createRadialGradient(s,t,e,i,n,r){return this.nativeContext.createRadialGradient(s,t,e,i,n,r)}createConicGradient(s,t,e,i){let n,r=!1;const a=this;return{stops:[],addColorStop(o,l){this.stops.push([o,l]),r=!0},GetPattern(o,l,h){return r&&(h||(h=i-e),n=mH(a,this.stops,s,t,h,e,i,o,l),r=!1),n}}}fill(s,t){this.disableFill||(s?this.nativeContext.fill(s):this.nativeContext.fill())}fillRect(s,t,e,i){this.nativeContext.fillRect(s,t,e,i)}clearRect(s,t,e,i){this.nativeContext.clearRect(s,t,e,i)}project(s,t,e){if(e=e||0,this.camera){this.modelMatrix&&(bs(jt,[s,t,e],this.modelMatrix),s=jt[0],t=jt[1],e=jt[2]);const i=this.camera.vp(s,t,e);s=i.x,t=i.y}return{x:s,y:t}}view(s,t,e){return e=e||0,this.camera?(this.modelMatrix&&(bs(jt,[s,t,e],this.modelMatrix),s=jt[0],t=jt[1],e=jt[2]),this.camera.view(s,t,e)):[s,t,e]}fillText(s,t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(bs(jt,[t,e,i],this.modelMatrix),t=jt[0],e=jt[1],i=jt[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.fillText(s,t,e)}getImageData(s,t,e,i){return this.nativeContext.getImageData(s,t,e,i)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(s,t){return this.nativeContext.isPointInPath(s,t)}isPointInStroke(s,t){return this.nativeContext.isPointInStroke(s,t)}measureText(s,t=tt.global.measureTextMethod){var e,i;if(!t||t==="native")return this.nativeContext.measureText(s);this.mathTextMeasure||(this.mathTextMeasure=tt.graphicUtil.createTextMeasureInstance({},{},()=>this.canvas.nativeCanvas));const n=(e=this.fontFamily)!==null&&e!==void 0?e:_r.fontFamily,r=(i=this.fontSize)!==null&&i!==void 0?i:_r.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(s,t)}putImageData(s,t,e){this.nativeContext.putImageData(s,t,e)}setLineDash(s){const t=arguments,e=this.nativeContext;this.nativeContext.setLineDash?e.setLineDash(t[0]):"mozDash"in e?e.mozDash=t[0]:"webkitLineDash"in e&&(e.webkitLineDash=t[0])}stroke(s){this.disableStroke||(s?this.nativeContext.stroke(s):this.nativeContext.stroke())}strokeRect(s,t,e,i){this.nativeContext.strokeRect(s,t,e,i)}strokeText(s,t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(bs(jt,[t,e,i],this.modelMatrix),t=jt[0],e=jt[1],i=jt[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.strokeText(s,t,e)}drawImage(){const s=this.nativeContext,t=arguments;t.length===3?s.drawImage(t[0],t[1],t[2]):t.length===5?s.drawImage(t[0],t[1],t[2],t[3],t[4]):t.length===9&&s.drawImage(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}setCommonStyle(s,t,e,i,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(s,t,e,i,n[0]);const r=Object.create(n[0]);return n.forEach((a,o)=>{o!==0&&Object.assign(r,a)}),this._setCommonStyle(s,t,e,i,r)}return this._setCommonStyle(s,t,e,i,n)}_setCommonStyle(s,t,e,i,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=t;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=J0(this,l,s,e,i)):r.globalAlpha=a*o}setShadowBlendStyle(s,t,e){if(Array.isArray(e)){if(e.length<=1)return this._setShadowBlendStyle(s,e[0]);const i=Object.create(e[0]);return e.forEach((n,r)=>{r!==0&&Object.assign(i,n)}),this._setShadowBlendStyle(s,t,i)}return this._setShadowBlendStyle(s,t,e)}_setShadowBlendStyle(s,t,e){const i=this.nativeContext;e||(e=this.fillAttributes);const{opacity:n=e.opacity,shadowBlur:r=e.shadowBlur,shadowColor:a=e.shadowColor,shadowOffsetX:o=e.shadowOffsetX,shadowOffsetY:l=e.shadowOffsetY,blur:h=e.blur,globalCompositeOperation:d=e.globalCompositeOperation}=t;n<=1e-12||(r||o||l?(i.shadowBlur=r*this.dpr,i.shadowColor=a,i.shadowOffsetX=o*this.dpr,i.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0),h?(i.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(i.filter="blur(0px)",this._clearFilterStyle=!1),d?(i.globalCompositeOperation=d,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(i.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(s,t,e,i,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(s,t,e,i,n[0]);const r=Object.create(n[0]);return n.forEach((a,o)=>{o!==0&&Object.assign(r,a)}),this._setStrokeStyle(s,t,e,i,r)}return this._setStrokeStyle(s,t,e,i,n)}_setStrokeStyle(s,t,e,i,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=t;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:d=n.lineJoin,lineDash:u=n.lineDash,lineCap:c=n.lineCap,miterLimit:p=n.miterLimit}=t;r.globalAlpha=a*o,r.lineWidth=Ei(this,l,this.dpr),r.strokeStyle=J0(this,h,s,e,i),r.lineJoin=d,r.setLineDash(u),r.lineCap=c,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(s,t,e){const i=this.nativeContext;t||(t=this.textAttributes);const{scaleIn3d:n=t.scaleIn3d}=s;s.font?i.font=s.font:i.font=$0(s,t,n&&this.camera&&this.camera.getProjectionScale(e));const{fontFamily:r=t.fontFamily,fontSize:a=t.fontSize}=s;this.fontFamily=r,this.fontSize=a,i.textAlign="left",i.textBaseline="alphabetic"}setTextStyle(s,t,e){var i,n;const r=this.nativeContext;t||(t=this.textAttributes),s.font?r.font=s.font:r.font=$0(s,t,this.camera&&this.camera.getProjectionScale(e));const{fontFamily:a=t.fontFamily,fontSize:o=t.fontSize}=s;this.fontFamily=a,this.fontSize=o,r.textAlign=(i=s.textAlign)!==null&&i!==void 0?i:t.textAlign,r.textBaseline=(n=s.textBaseline)!==null&&n!==void 0?n:t.textBaseline}draw(){}clearMatrix(s=!0,t=this.dpr){this.setTransformFromMatrix(xU,s,t)}onlyTranslate(s=this.dpr){return this.matrix.a===s&&this.matrix.b===0&&this.matrix.c===0&&this.matrix.d===s}release(...s){this.stack.forEach(t=>Ys.free(t)),this.stack.length=0}};zl.env="browser",zl=yU([ct(),bU("design:paramtypes",[Object,Number])],zl);var AU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},kU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Hl=class extends wd{constructor(s){super(s)}init(s){const{container:t}=s;if(typeof t=="string"){const e=tt.global.getElementById(t);e&&(this._container=e)}else this._container=t;this._context=new zl(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:s}=this;s.width=this._pixelWidth,s.height=this._pixelHeight,!s.style||this.setCanvasStyle(s,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(s),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const s=this._nativeCanvas;s.style.position="absolute",s.style.top=`${this._y}px`,s.style.left=`${this._x}px`}resetStyle(s){if(!this.controled)return;const{width:t=this._displayWidth,height:e=this._displayHeight,dpr:i=this._dpr,x:n=this._x,y:r=this._y}=s,{nativeCanvas:a}=this;a.width=t*i,a.height=e*i,!a.style||this.setCanvasStyle(a,n,r,t,e),s.id&&(a.id=s.id),this.visiable||this.hide()}setCanvasStyle(s,t,e,i,n){this.controled&&(s.style.width=`${i}px`,s.style.height=`${n}px`)}toDataURL(s,t){return s==="image/jpeg"?this._nativeCanvas.toDataURL(s,t):s==="image/png"?this._nativeCanvas.toDataURL(s):this._nativeCanvas.toDataURL(s,t)}resize(s,t){this.controled&&(this._pixelWidth=s*this._dpr,this._pixelHeight=t*this._dpr,this._displayWidth=s,this._displayHeight=t,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${s}px`,this._nativeCanvas.style.height=`${t}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};Hl.env="browser",Hl=AU([ct(),kU("design:paramtypes",[Object])],Hl);function YR(s,t){return new Pt(e=>{e(AE).toDynamicValue(()=>i=>new s(i)).whenTargetNamed(s.env),e(tz).toDynamicValue(()=>(i,n)=>new t(i,n)).whenTargetNamed(t.env)})}const wU=YR(Hl,zl),Tr=Symbol.for("MathPickerContribution"),dw=Symbol.for("MathArcPicker"),uw=Symbol.for("MathAreaPicker"),cw=Symbol.for("MathCirclePicker"),Qg=Symbol.for("MathImagePicker"),pw=Symbol.for("MathLinePicker"),gw=Symbol.for("MathPathPicker"),fw=Symbol.for("MathRectPicker"),_w=Symbol.for("MathSymbolPicker"),mw=Symbol.for("MathTextPicker"),vw=Symbol.for("MathPolygonPicker"),yw=Symbol.for("MathGlyphPicker"),bw=Symbol.for("CanvasArcPicker"),xw=Symbol.for("CanvasArc3dPicker"),Sw=Symbol.for("CanvasAreaPicker"),Aw=Symbol.for("CanvasCirclePicker"),kw=Symbol.for("CanvasImagePicker"),ww=Symbol.for("CanvasLinePicker"),Tw=Symbol.for("CanvasPathPicker"),Mw=Symbol.for("CanvasRectPicker"),Cw=Symbol.for("CanvasRect3dPicker"),Pw=Symbol.for("CanvasSymbolPicker"),Ew=Symbol.for("CanvasTextPicker"),Rw=Symbol.for("CanvasPolygonPicker"),Ow=Symbol.for("CanvasPyramid3dPicker"),Dw=Symbol.for("CanvasRichTextPicker"),Lw=Symbol.for("CanvasGlyphPicker"),Bw=Symbol.for("CanvasGroupPicker"),xi=Symbol.for("CanvasPickerContribution");var TU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},MU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},$h=function(s,t){return function(e,i){t(e,i,s)}};let el=class extends cy{constructor(s,t,e){super(e),this.contributions=s,this.drawContribution=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("canvas-picker-service",(i,n,r)=>{this.configure(r,n)}),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach(s=>{this.pickerMap.set(s.numberType,s)}),super._init()}configure(s,t){this.pickCanvas=ih.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(s,t,e,i){if(s.attribute.pickable===!1)return null;if(this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.beforePickItem){const h=l.beforePickItem(s,this,t,i,{parentMatrix:e});if(h)return h}}const n=this.pickerMap.get(s.numberType);if(!n)return null;const r=n.contains(s,t,i)?s:null,a={graphic:r};if(r)return a;if(this.InterceptorContributions.length)for(let o=0;o<this.InterceptorContributions.length;o++){const l=this.InterceptorContributions[o];if(l.afterPickItem){const h=l.afterPickItem(s,this,t,i,{parentMatrix:e});if(h)return h}}return a}};el=TU([ct(),$h(0,Dt(Qe)),$h(0,gi(xi)),$h(1,Dt(fx)),$h(2,Dt(Qe)),$h(2,gi(qo)),MU("design:paramtypes",[Object,Object,Object])],el);var CU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Ty=class{constructor(){this.type="group",this.numberType=Qb}contains(s,t,e){return!1}};Ty=CU([ct()],Ty);const tf=new Pt((s,t,e,i)=>{tf.__vloaded||(tf.__vloaded=!0,s(Bw).to(Ty).inSingletonScope(),s(xi).toService(Bw),Ci(s,xi))});tf.__vloaded=!1;const PU=new Pt((s,t,e,i)=>{e(el)||s(el).toSelf().inSingletonScope(),e(Fl)?i(Fl).toService(el):s(Fl).toService(el)});function EU(s){s.load(tf),s.load(PU)}var pd,RU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},OU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Nr=pd=class extends Vg{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${pd.idprefix}_${pd.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=tt.global}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(s){s.canvas?this.createWindowByCanvas(s):this.createWindowByConfig(s),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch{console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(s){const t=s.getBoundingClientRect(),e=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight;return!(t.right<0||t.bottom<0||t.left>e||t.top>i)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const s=new IntersectionObserver((t,e)=>{t.forEach(i=>{this._canvasIsIntersecting!==i.isIntersecting?(this._canvasIsIntersecting=i.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(i.isIntersecting)):this._canvasIsIntersecting=i.isIntersecting})});s&&s.observe(this.canvas.nativeCanvas)}createWindowByConfig(s){const t=this.global.createCanvas({width:s.width,height:s.height});let e;if(e=typeof s.container=="string"?this.global.getElementById(s.container):s.container?s.container:this.global.getRootElement(),!e)throw new Error("发生错误,containerId可能传入有误");s.offscreen?e=null:e.appendChild(t);const i={width:s.width,height:s.height,dpr:s.dpr,nativeCanvas:t,container:e,id:pd.GenerateCanvasId(),canvasControled:!0};this.canvas=new Hl(i)}createWindowByCanvas(s){var t;let e;if(typeof s.canvas=="string"){if(e=this.global.getElementById(s.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=s.canvas;if(!e)throw new Error("发生错误,传入的canvas不正确");let i=s.width,n=s.height;if(i==null||n==null||!s.canvasControled){const a=e.getBoundingClientRect();i=a.width,n=a.height}let r=s.dpr;r==null&&(r=(t=e.getContext("2d").pixelRatio)!==null&&t!==void 0?t:e.width/i),this.canvas=new Hl({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:s.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(s,t){this.canvas.resize(s,t)}setDpr(s){this.canvas.dpr=s}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(s,t,e){return this.canvas.nativeCanvas.addEventListener(s,t,e)}removeEventListener(s,t,e){return this.canvas.nativeCanvas.removeEventListener(s,t,e)}dispatchEvent(s){return this.canvas.nativeCanvas.dispatchEvent(s)}getStyle(){return this.canvas.nativeCanvas.style}setStyle(s){this.canvas.nativeCanvas.style=s}getBoundingClientRect(){const s=this.canvas.nativeCanvas,t=this.getWH();return s.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(s,t){const e=this.getContext(),i=this.getDpr();e.nativeContext.save(),e.nativeContext.setTransform(i,0,0,i,0,0),e.clearRect(s.x1,s.y1,s.x2-s.x1,s.y2-s.y1),t&&(e.fillStyle=t,e.fillRect(s.x1,s.y1,s.x2-s.x1,s.y2-s.y1)),e.nativeContext.restore()}isVisible(s){return this._canvasIsIntersecting}onVisibleChange(s){this._onVisibleChangeCb=s}getTopLeft(s){return this.global.getElementTopLeft(this.canvas.nativeCanvas,s)}};Nr.env="browser",Nr.idprefix="visactor_window",Nr.prefix_count=0,Nr=pd=RU([ct(),OU("design:paramtypes",[])],Nr);const DU=new Pt(s=>{s(Nr).toSelf(),s(Yb).toDynamicValue(t=>t.container.get(Nr)).whenTargetNamed(Nr.env)});var LU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},BU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};class IU{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Iw(s,t=!1){const e=document.createElement("img");if(e.crossOrigin="anonymous",t){const i=new Blob([s],{type:"image/svg+xml"});s=window.URL.createObjectURL(i)}return e.src=s,e.complete?Promise.resolve(e):new Promise((i,n)=>{e.onload=()=>{i(e)},e.onerror=()=>{n(new Error("加载失败"))}})}let ef=class extends Ng{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch{this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(s,t){var e;if(t){const{clientX:i,clientY:n}=s,r=t.getBoundingClientRect(),a=(e=t.getNativeHandler)===null||e===void 0?void 0:e.call(t).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(i-r.left)/(H(o)?o:1),y:(n-r.top)/(H(l)?l:1)}}return{x:s.offsetX,y:s.offsetY}}getNativeAABBBounds(s){let t=s;if(typeof s=="string"&&(t=new DOMParser().parseFromString(s,"text/html").firstChild,t.lastChild&&(t=t.lastChild.firstChild)),t.getBoundingClientRect){const e=t.getBoundingClientRect();return new IU(e)}return new Me}removeDom(s){return s.parentElement.removeChild(s),!0}createDom(s){const{tagName:t="div",width:e,height:i,style:n,parent:r}=s,a=document.createElement(t);if(n&&(ot(n)?a.setAttribute("style",n):Object.keys(n).forEach(o=>{a.setAttribute(o,n[o])})),e!=null&&(a.style.width=`${e}px`),i!=null&&(a.style.height=`${i}px`),r){const o=ot(r)?this.getElementById(r):r;o&&o.appendChild&&o.appendChild(a)}return a}loadImage(s){return Iw(s,!1).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadSvg(s){return Iw(s,!0).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}createCanvas(s){var t,e;const i=document.createElement("canvas");s.id&&(i.id=(t=s.id)!==null&&t!==void 0?t:Xe.GenAutoIncrementId().toString());const n=(e=s.dpr)!==null&&e!==void 0?e:window.devicePixelRatio;return s.width&&s.height&&(i.style.width=`${s.width}px`,i.style.height=`${s.height}px`,i.width=s.width*n,i.height=s.height*n),i}createOffscreenCanvas(s){var t;const e=(t=s.dpr)!==null&&t!==void 0?t:window.devicePixelRatio;return new OffscreenCanvas(s.width*e,s.height*e)}releaseCanvas(s){let t;t=typeof s=="string"?document.getElementById(s):s,t&&t.parentElement&&t.parentElement.removeChild(t)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(s,t,e){return document.addEventListener(s,t,e)}removeEventListener(s,t,e){return document.removeEventListener(s,t,e)}dispatchEvent(s){return document.dispatchEvent(s)}getElementById(s){return document.getElementById(s)}getRootElement(){return document.body}getDocument(){return document}release(...s){}getElementTop(s,t){let e=s.offsetTop,i=s.offsetParent;for(;i!==null;)e+=i.offsetTop,i=i.offsetParent;return e}getElementLeft(s,t){let e=s.offsetLeft,i=s.offsetParent;for(;i!==null;)e+=i.offsetLeft,i=i.offsetParent;return e}getElementTopLeft(s,t){let e=s.offsetTop,i=s.offsetLeft,n=s.offsetParent;for(;n!==null;)e+=n.offsetTop,i+=n.offsetLeft,n=n.offsetParent;return{top:e,left:i}}};ef=LU([ct(),BU("design:paramtypes",[])],ef);const sf=new Pt(s=>{sf.isBrowserBound||(sf.isBrowserBound=!0,s(ef).toSelf().inSingletonScope(),s(w_).toService(ef))});sf.isBrowserBound=!1;function nf(s,t=!0){nf.__loaded||(nf.__loaded=!0,s.load(sf),s.load(wU),s.load(DU),t&&EU(s))}nf.__loaded=!1;var FU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},jU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Cd=class extends zl{constructor(s,t){super(s,t);const e=s.nativeCanvas.getContext("2d");if(!e)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=e,this.canvas=s,this.matrix=new ze(1,0,0,1,0,0),this.stack=[],this.dpr=t??1}release(...s){}};Cd.env="node",Cd=FU([ct(),jU("design:paramtypes",[Object,Number])],Cd);var zU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},HU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};let Gl=class extends wd{constructor(s){super(s)}init(){this._context=new Cd(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...s){this._nativeCanvas.release&&q(this._nativeCanvas.release)&&this._nativeCanvas.release()}};Gl.env="node",Gl=zU([ct(),HU("design:paramtypes",[Object])],Gl);const GU=YR(Gl,Cd);var WU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},NU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},VU=function(s,t){return function(e,i){t(e,i,s)}};let Wl=class extends Vg{get container(){return null}constructor(s){super(),this.global=s,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(s){s.canvas?this.createWindowByCanvas(s):this.createWindowByConfig(s)}createWindowByConfig(s){const t=this.global.createCanvas({width:s.width,height:s.height}),e={width:s.width,height:s.height,dpr:s.dpr,nativeCanvas:t,id:Xe.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new Gl(e)}createWindowByCanvas(s){const t=s.canvas;let e=s.width,i=s.height;e!=null&&i!=null&&s.canvasControled||(e=t.width,i=t.height),this.canvas=new Gl({width:e,height:i,dpr:1,nativeCanvas:t,canvasControled:s.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(s,t){this.canvas.resize(s,t)}setDpr(s){this.canvas.dpr=s}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(s="image/png"){return this.canvas.nativeCanvas.toBuffer(s)}addEventListener(s,t,e){}dispatchEvent(s){return!0}removeEventListener(s,t,e){}getStyle(){}setStyle(s){}getBoundingClientRect(){return null}clearViewBox(s,t){}};Wl.env="node",Wl=WU([ct(),VU(0,Dt(Vb)),NU("design:paramtypes",[Object])],Wl);const UU=new Pt(s=>{s(Wl).toSelf(),s(Yb).toDynamicValue(t=>t.container.get(Wl)).whenTargetNamed(Wl.env)});var $U=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let rf=class extends Ng{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(s,t){s.env===this.type&&(s.setActiveEnvContribution(this),this.pkg=t)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(s){const t=fetch(s).then(e=>e.json());return t.then(e=>({data:e,state:"success"})).catch(()=>({data:null,state:"fail"})),t}loadArrayBuffer(s){return fetch(s).then(t=>t.arrayBuffer()).then(t=>({data:t,loadState:"success"})).catch(()=>({data:null,loadState:"fail"}))}loadImage(s){const{loadImage:t}=this.pkg;return t?t(s).then(e=>({loadState:e?"success":"fail",data:e})).catch(()=>({loadState:"fail",data:null})):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(s){const t=this.pkg.Resvg;if(!t)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const e=new t(s).render().asPng();return this.loadImage(e)}createCanvas(s){return this.pkg.createCanvas(s.width,s.height)}releaseCanvas(s){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(s){return qA.call(s)}}getCancelAnimationFrame(){return s=>{qA.clear(s)}}addEventListener(s,t,e){}removeEventListener(s,t,e){}getElementById(s){return null}getRootElement(){return null}dispatchEvent(s){}release(...s){}createOffscreenCanvas(s){}};rf=$U([ct()],rf);const af=new Pt(s=>{af.isNodeBound||(af.isNodeBound=!0,s(rf).toSelf().inSingletonScope(),s(w_).toService(rf))});af.isNodeBound=!1;function of(s,t=!0){of.__loaded||(of.__loaded=!0,s.load(af),s.load(GU),s.load(UU))}of.__loaded=!1;var YU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},XU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},KU=function(s,t){return function(e,i){t(e,i,s)}};let My=class{constructor(s){this.canvasRenderer=s,this.type="arc",this.numberType=C_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).arc;i.highPerformanceSave();let{x:r=n.x,y:a=n.y}=s.attribute;if(s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=Ei(i,u+c,i.dpr),o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};My=YU([ct(),KU(0,Dt(Sg)),XU("design:paramtypes",[Object])],My);let Fw=!1;const qU=new Pt((s,t,e,i)=>{Fw||(Fw=!0,s(bw).to(My).inSingletonScope(),s(xi).toService(bw))});var ZU=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},JU=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},QU=function(s,t){return function(e,i){t(e,i,s)}};let Cy=class{constructor(s){this.canvasRenderer=s,this.type="arc",this.numberType=C_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).arc;i.highPerformanceSave();let{x:r=n.x,y:a=n.y}=s.attribute;if(s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};Cy=ZU([ct(),QU(0,Dt(Sg)),JU("design:paramtypes",[Object])],Cy);let jw=!1;const t4=new Pt((s,t,e,i)=>{jw||(jw=!0,s(dw).to(Cy).inSingletonScope(),s(Tr).toService(dw))});var e4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},i4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},s4=function(s,t){return function(e,i){t(e,i,s)}};const vv=new Me;let Py=class{constructor(s){this.canvasRenderer=s,this.type="rect",this.numberType=L_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).rect,{cornerRadius:r=n.cornerRadius}=s.attribute;let{x:a=n.x,y:o=n.y}=s.attribute;i.highPerformanceSave();let l=!0;if(s.transMatrix.onlyTranslate()){const d=s.getOffsetXY(n);a+=d.x,o+=d.y,i.setTransformForCurrent()}else a=0,o=0,l=!1,i.transformFromMatrix(s.transMatrix,!0);let h=!0;if(!l||s.shadowRoot||lt(r,!0)&&r!==0||U(r)&&r.some(d=>d!==0))h=!1,this.canvasRenderer.drawShape(s,i,a,o,{},null,(d,u,c)=>!!h||(h=d.isPointInPath(t.x,t.y),h),(d,u,c)=>{if(h)return!0;const p=u.lineWidth||c.lineWidth,g=u.pickStrokeBuffer||c.pickStrokeBuffer;return i.lineWidth=Ei(i,p+g,i.dpr),h=d.isPointInStroke(t.x,t.y),h});else{const{fill:d=n.fill,stroke:u=n.stroke,lineWidth:c=n.lineWidth}=s.attribute;if(d)h=!0;else if(u){const p=s.AABBBounds;vv.setValue(p.x1,p.y1,p.x2,p.y2),vv.expand(-c/2),h=!vv.containsPoint(t)}}return i.highPerformanceRestore(),h}};Py=e4([ct(),s4(0,Dt(Cg)),i4("design:paramtypes",[Object])],Py);let zw=!1;const n4=new Pt((s,t,e,i)=>{zw||(zw=!0,s(Mw).to(Py).inSingletonScope(),s(xi).toService(Mw))});var r4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},a4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},o4=function(s,t){return function(e,i){t(e,i,s)}};const yv=new Me;let Ey=class{constructor(s){this.canvasRenderer=s,this.type="rect",this.numberType=L_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).rect,{cornerRadius:r=n.cornerRadius}=s.attribute;let{x:a=n.x,y:o=n.y}=s.attribute;i.highPerformanceSave();let l=!0;if(s.transMatrix.onlyTranslate()){const d=s.getOffsetXY(n);a+=d.x,o+=d.y,i.setTransformForCurrent()}else a=0,o=0,l=!1,i.transformFromMatrix(s.transMatrix,!0);let h=!0;if(!l||lt(r,!0)&&r!==0||U(r)&&r.some(d=>d!==0))h=!1,this.canvasRenderer.drawShape(s,i,a,o,{},null,(d,u,c)=>!!h||(h=d.isPointInPath(t.x,t.y),h),(d,u,c)=>{if(h)return!0;const p=u.lineWidth||c.lineWidth,g=u.pickStrokeBuffer||c.pickStrokeBuffer;return i.lineWidth=p+g,h=d.isPointInStroke(t.x,t.y),h});else if(h){const{fill:d=n.fill,stroke:u=n.stroke,lineWidth:c=n.lineWidth}=s.attribute;if(d)h=!0;else if(u){const p=s.AABBBounds;yv.setValue(p.x1,p.y1,p.x2,p.y2),yv.expand(-c/2),h=!yv.containsPoint(t)}}return i.highPerformanceRestore(),h}};Ey=r4([ct(),o4(0,Dt(Cg)),a4("design:paramtypes",[Object])],Ey);let Hw=!1;const l4=new Pt((s,t,e,i)=>{Hw||(Hw=!0,s(fw).to(Ey).inSingletonScope(),s(Tr).toService(fw))});var h4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let xr=class extends ls{};xr=h4([ct()],xr);var d4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},u4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},c4=function(s,t){return function(e,i){t(e,i,s)}};let Ry=class extends xr{constructor(s){super(),this.canvasRenderer=s,this.type="line",this.numberType=ac}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;i.highPerformanceSave();const n=rt(s).line,r=this.transform(s,n,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=t;if(i.camera){d=t.clone();const c=s.parent.globalTransMatrix;d.x=c.a*t.x+c.c*t.y+c.e,d.y=c.b*t.x+c.d*t.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(s,i,a,o,{},null,c=>!!u||(u=c.isPointInPath(d.x,d.y),u),(c,p,g)=>{if(u)return!0;const f=p.lineWidth||g.lineWidth,_=p.pickStrokeBuffer||g.pickStrokeBuffer;return i.lineWidth=Ei(i,f+_,i.dpr),u=c.isPointInStroke(d.x,d.y),u}),this.canvasRenderer.z=0,i.modelMatrix!==h&&ce.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Ry=d4([ct(),c4(0,Dt(wg)),u4("design:paramtypes",[Object])],Ry);let Gw=!1;const p4=new Pt((s,t,e,i)=>{Gw||(Gw=!0,s(ww).to(Ry).inSingletonScope(),s(xi).toService(ww))});var g4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},f4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},_4=function(s,t){return function(e,i){t(e,i,s)}};let Oy=class{constructor(s){this.canvasRenderer=s,this.type="line",this.numberType=ac}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).line;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,l=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};Oy=g4([ct(),_4(0,Dt(wg)),f4("design:paramtypes",[Object])],Oy);let Ww=!1;const m4=new Pt((s,t,e,i)=>{Ww||(Ww=!0,s(pw).to(Oy).inSingletonScope(),s(Tr).toService(pw))});var v4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},y4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},b4=function(s,t){return function(e,i){t(e,i,s)}};let Dy=class{constructor(s){this.canvasRenderer=s,this.type="area",this.numberType=rc}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).area;let{x:r=n.x,y:a=n.y}=s.attribute;const{fillPickable:o=n.fillPickable,strokePickable:l=n.strokePickable}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const d=s.getOffsetXY(n);r+=d.x,a+=d.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let h=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,d=>!!h||!!o&&(h=d.isPointInPath(t.x,t.y),h),(d,u,c)=>{if(h)return!0;if(!l)return!1;const p=u.lineWidth||c.lineWidth,g=u.pickStrokeBuffer||c.pickStrokeBuffer;return i.lineWidth=Ei(i,p+g,i.dpr),h=d.isPointInStroke(t.x,t.y),h}),i.highPerformanceRestore(),h}};Dy=v4([ct(),b4(0,Dt(Ag)),y4("design:paramtypes",[Object])],Dy);let Nw=!1;const x4=new Pt((s,t,e,i)=>{Nw||(Nw=!0,s(Sw).to(Dy).inSingletonScope(),s(xi).toService(Sw))});var S4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},A4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},k4=function(s,t){return function(e,i){t(e,i,s)}};let Ly=class{constructor(s){this.canvasRenderer=s,this.type="area",this.numberType=rc}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).area;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,l=>!!o||(o=l.isPointInPath(t.x,t.y),o)),i.highPerformanceRestore(),o}};Ly=S4([ct(),k4(0,Dt(Ag)),A4("design:paramtypes",[Object])],Ly);let Vw=!1;const w4=new Pt((s,t,e,i)=>{Vw||(Vw=!0,s(uw).to(Ly).inSingletonScope(),s(Tr).toService(uw))});var T4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},M4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},C4=function(s,t){return function(e,i){t(e,i,s)}};let By=class extends xr{constructor(s){super(),this.canvasRenderer=s,this.type="symbol",this.numberType=B_}contains(s,t,e){const{pickContext:i}=e??{};if(!i)return!1;const n=s.getParsedPath();if(!i.camera){if(!s.AABBBounds.containsPoint(t))return!1;if(n.isSvg||s.attribute.pickMode==="imprecise")return!0}i.highPerformanceSave();const r=rt(s).symbol,a=this.transform(s,r,i),{x:o,y:l,z:h,lastModelMatrix:d}=a;let u=t;if(i.camera){u=t.clone();const p=s.parent.globalTransMatrix;u.x=p.a*t.x+p.c*t.y+p.e,u.y=p.b*t.x+p.d*t.y+p.f}this.canvasRenderer.z=h;let c=!1;return this.canvasRenderer.drawShape(s,i,o,l,{},null,(p,g,f)=>!!c||(c=p.isPointInPath(u.x,u.y),c),(p,g,f)=>{if(c)return!0;const _=g.lineWidth||f.lineWidth,m=g.pickStrokeBuffer||f.pickStrokeBuffer;return i.lineWidth=Ei(i,_+m,i.dpr),c=p.isPointInStroke(u.x,u.y),c}),this.canvasRenderer.z=0,i.modelMatrix!==d&&ce.free(i.modelMatrix),i.modelMatrix=d,i.highPerformanceRestore(),c}};By=T4([ct(),C4(0,Dt(Pg)),M4("design:paramtypes",[Object])],By);let Uw=!1;const P4=new Pt((s,t,e,i)=>{Uw||(Uw=!0,s(Pw).to(By).inSingletonScope(),s(xi).toService(Pw))});var E4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},R4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},O4=function(s,t){return function(e,i){t(e,i,s)}};let Iy=class{constructor(s){this.canvasRenderer=s,this.type="symbol",this.numberType=B_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).symbol;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};Iy=E4([ct(),O4(0,Dt(Pg)),R4("design:paramtypes",[Object])],Iy);let $w=!1;const D4=new Pt((s,t,e,i)=>{$w||($w=!0,s(_w).to(Iy).inSingletonScope(),s(Tr).toService(_w))});var L4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},B4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},I4=function(s,t){return function(e,i){t(e,i,s)}};let Fy=class{constructor(s){this.canvasRenderer=s,this.type="circle",this.numberType=P_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).circle;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=Ei(i,u+c,i.dpr),o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};Fy=L4([ct(),I4(0,Dt(kg)),B4("design:paramtypes",[Object])],Fy);let Yw=!1;const F4=new Pt((s,t,e,i)=>{Yw||(Yw=!0,s(Aw).to(Fy).inSingletonScope(),s(xi).toService(Aw))});var j4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},z4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},H4=function(s,t){return function(e,i){t(e,i,s)}};let jy=class{constructor(s){this.canvasRenderer=s,this.type="circle",this.numberType=P_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).circle;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};jy=j4([ct(),H4(0,Dt(kg)),z4("design:paramtypes",[Object])],jy);let Xw=!1;const G4=new Pt((s,t,e,i)=>{Xw||(Xw=!0,s(cw).to(jy).inSingletonScope(),s(Tr).toService(cw))});var W4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},N4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},V4=function(s,t){return function(e,i){t(e,i,s)}};let zy=class extends xr{constructor(s){super(),this.canvasRenderer=s,this.type="text",this.numberType=I_}contains(s,t,e){const{pickContext:i}=e??{};if(!i)return!1;const n=s.AABBBounds;if(!i.camera)return!!n.containsPoint(t);i.highPerformanceSave();const r=rt(s).text,{keepDirIn3d:a=r.keepDirIn3d}=s.attribute,o=!a,l=this.transform(s,r,i,o),{x:h,y:d,z:u,lastModelMatrix:c}=l;this.canvasRenderer.z=u;let p=t;if(i.camera){p=t.clone();const f=s.parent.globalTransMatrix;p.x=f.a*t.x+f.c*t.y+f.e,p.y=f.b*t.x+f.d*t.y+f.f}let g=!1;return this.canvasRenderer.drawShape(s,i,h,d,{},null,(f,_,m)=>{if(g)return!0;const{fontSize:v=r.fontSize,textBaseline:y=r.textBaseline,textAlign:b=r.textAlign}=s.attribute,x=s.AABBBounds,S=x.height(),A=x.width(),k=ar(y,S,v),w=rr(b,A);return f.rect(w+h,k+d,A,S,u),g=f.isPointInPath(p.x,p.y),g},(f,_,m)=>g),this.canvasRenderer.z=0,i.modelMatrix!==c&&ce.free(i.modelMatrix),i.modelMatrix=c,i.highPerformanceRestore(),g}};zy=W4([ct(),V4(0,Dt(ry)),N4("design:paramtypes",[Object])],zy);let Kw=!1;const U4=new Pt((s,t,e,i)=>{Kw||(Kw=!0,s(Ew).to(zy).inSingletonScope(),s(xi).toService(Ew))});var $4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Hy=class{constructor(){this.type="text",this.numberType=I_}contains(s,t,e){return!!s.AABBBounds.containsPoint(t)}};Hy=$4([ct()],Hy);let qw=!1;const Y4=new Pt((s,t,e,i)=>{qw||(qw=!0,s(mw).to(Hy).inSingletonScope(),s(Tr).toService(mw))});var X4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},K4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},q4=function(s,t){return function(e,i){t(e,i,s)}};let Gy=class extends xr{constructor(s){super(),this.canvasRenderer=s,this.type="path",this.numberType=O_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).path;i.highPerformanceSave();const r=this.transform(s,n,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=t;if(i.camera){d=t.clone();const c=s.parent.globalTransMatrix;d.x=c.a*t.x+c.c*t.y+c.e,d.y=c.b*t.x+c.d*t.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(s,i,a,o,{},null,(c,p,g)=>!!u||(u=c.isPointInPath(d.x,d.y),u),(c,p,g)=>{if(u)return!0;const f=p.lineWidth||g.lineWidth,_=p.pickStrokeBuffer||g.pickStrokeBuffer;return i.lineWidth=Ei(i,f+_,i.dpr),u=c.isPointInStroke(d.x,d.y),u}),this.canvasRenderer.z=0,i.modelMatrix!==h&&ce.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Gy=X4([ct(),q4(0,Dt(Tg)),K4("design:paramtypes",[Object])],Gy);let Zw=!1;const Z4=new Pt((s,t,e,i)=>{Zw||(Zw=!0,s(Tw).to(Gy).inSingletonScope(),s(xi).toService(Tw))});var J4=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},Q4=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},t$=function(s,t){return function(e,i){t(e,i,s)}};let Wy=class{constructor(s){this.canvasRenderer=s,this.type="path",this.numberType=O_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).path;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};Wy=J4([ct(),t$(0,Dt(Tg)),Q4("design:paramtypes",[Object])],Wy);let Jw=!1;const e$=new Pt((s,t,e,i)=>{Jw||(Jw=!0,s(gw).to(Wy).inSingletonScope(),s(Tr).toService(gw))});var i$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},s$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},n$=function(s,t){return function(e,i){t(e,i,s)}};let Ny=class{constructor(s){this.canvasRenderer=s,this.type="polygon",this.numberType=D_}contains(s,t,e){if(!s.AABBBounds.contains(t.x,t.y))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).polygon;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=Ei(i,u+c,i.dpr),o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};Ny=i$([ct(),n$(0,Dt(Mg)),s$("design:paramtypes",[Object])],Ny);let Qw=!1;const r$=new Pt((s,t,e,i)=>{Qw||(Qw=!0,s(Rw).to(Ny).inSingletonScope(),s(xi).toService(Rw))});var a$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},o$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},l$=function(s,t){return function(e,i){t(e,i,s)}};let Vy=class{constructor(s){this.canvasRenderer=s,this.type="polygon",this.numberType=D_}contains(s,t,e){if(!s.AABBBounds.contains(t.x,t.y))return!1;const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).polygon;let{x:r=n.x,y:a=n.y}=s.attribute;if(i.highPerformanceSave(),s.transMatrix.onlyTranslate()){const l=s.getOffsetXY(n);r+=l.x,a+=l.y,i.setTransformForCurrent()}else r=0,a=0,i.transformFromMatrix(s.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(s,i,r,a,{},null,(l,h,d)=>!!o||(o=l.isPointInPath(t.x,t.y),o),(l,h,d)=>{if(o)return!0;const u=h.lineWidth||d.lineWidth,c=h.pickStrokeBuffer||d.pickStrokeBuffer;return i.lineWidth=u+c,o=l.isPointInStroke(t.x,t.y),o}),i.highPerformanceRestore(),o}};Vy=a$([ct(),l$(0,Dt(Mg)),o$("design:paramtypes",[Object])],Vy);let tT=!1;const h$=new Pt((s,t,e,i)=>{tT||(tT=!0,s(vw).to(Vy).inSingletonScope(),s(Tr).toService(vw))});var d$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},u$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},c$=function(s,t){return function(e,i){t(e,i,s)}};let Uy=class{constructor(s){this.canvasRenderer=s,this.type="glyph",this.numberType=E_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=e==null?void 0:e.pickerService;if(n){let r=!1;return s.getSubGraphic().forEach(a=>{if(r)return;const o=n.pickItem(a,t,null,e);r=!(!o||!o.graphic)}),r}return!1}};Uy=d$([ct(),c$(0,Dt(Eg)),u$("design:paramtypes",[Object])],Uy);let eT=!1;const p$=new Pt((s,t,e,i)=>{eT||(eT=!0,s(Lw).to(Uy).inSingletonScope(),s(xi).toService(Lw))});var g$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},f$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},_$=function(s,t){return function(e,i){t(e,i,s)}};let lf=class{constructor(s){this.canvasRenderer=s,this.type="glyph",this.numberType=E_}contains(s,t,e){if(!s.AABBBounds.containsPoint(t))return!1;if(s.attribute.pickMode==="imprecise")return!0;const{pickContext:i}=e??{};if(!i)return!1;const n=e==null?void 0:e.pickerService;if(n){let r=!1;return s.getSubGraphic().forEach(a=>{r||(r=!!n.pickItem(a,t,null,e))}),r}return!1}};lf=g$([ct(),_$(0,Dt(Eg)),f$("design:paramtypes",[Object])],lf);let iT=!1;const m$=new Pt((s,t,e,i)=>{iT||(iT=!0,s(yw).to(lf).inSingletonScope(),s(lf).toService(yw))});var v$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},y$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},b$=function(s,t){return function(e,i){t(e,i,s)}};let $y=class{constructor(s){this.canvasRenderer=s,this.type="richtext",this.numberType=ix}contains(s,t,e){return!!s.AABBBounds.containsPoint(t)}};$y=v$([ct(),b$(0,Dt(ay)),y$("design:paramtypes",[Object])],$y);let sT=!1;const x$=new Pt((s,t,e,i)=>{sT||(sT=!0,s(Dw).to($y).inSingletonScope(),s(xi).toService(Dw))});var S$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let lh=class{constructor(){this.type="image",this.numberType=R_}contains(s,t,e){const{pickContext:i}=e??{};return!!i&&!!s.AABBBounds.containsPoint(t)}};lh=S$([ct()],lh);let nT=!1;const A$=new Pt((s,t,e,i)=>{nT||(nT=!0,s(Qg).to(lh).inSingletonScope(),s(lh).toService(Qg))});var k$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Yy=class{constructor(){this.type="image",this.numberType=R_}contains(s,t,e){const{pickContext:i}=e??{};return!!i&&!!s.AABBBounds.containsPoint(t)}};Yy=k$([ct()],Yy);let rT=!1;const w$=new Pt((s,t,e,i)=>{rT||(rT=!0,s(kw).to(Yy).inSingletonScope(),s(xi).toService(kw))});let aT=!1;const T$=new Pt((s,t,e,i)=>{aT||(aT=!0,s(Qg).to(lh).inSingletonScope(),s(lh).toService(Qg))});var M$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},C$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},P$=function(s,t){return function(e,i){t(e,i,s)}};new Me;let Xy=class extends xr{constructor(s){super(),this.canvasRenderer=s,this.type="rect3d",this.numberType=ex}contains(s,t,e){const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).rect;i.highPerformanceSave();const r=this.transform(s,n,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=t;if(i.camera){d=t.clone();const c=s.parent.globalTransMatrix;d.x=c.a*t.x+c.c*t.y+c.e,d.y=c.b*t.x+c.d*t.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(s,i,a,o,e,null,(c,p,g)=>!!u||(u=c.isPointInPath(d.x,d.y),u)),this.canvasRenderer.z=0,i.modelMatrix!==h&&ce.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Xy=M$([ct(),P$(0,Dt(ny)),C$("design:paramtypes",[Object])],Xy);let oT=!1;const E$=new Pt((s,t,e,i)=>{oT||(oT=!0,s(Cw).to(Xy).inSingletonScope(),s(xi).toService(Cw))});var R$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},O$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},D$=function(s,t){return function(e,i){t(e,i,s)}};let Ky=class extends xr{constructor(s){super(),this.canvasRenderer=s,this.type="arc3d",this.numberType=nc}contains(s,t,e){const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).arc;i.highPerformanceSave();const r=this.transform(s,n,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=t;if(i.camera){d=t.clone();const c=s.parent.globalTransMatrix;d.x=c.a*t.x+c.c*t.y+c.e,d.y=c.b*t.x+c.d*t.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(s,i,a,o,e,null,(c,p,g)=>!!u||(u=c.isPointInPath(d.x,d.y),u)),this.canvasRenderer.z=0,i.modelMatrix!==h&&ce.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};Ky=R$([ct(),D$(0,Dt(sy)),O$("design:paramtypes",[Object])],Ky);let lT=!1;const L$=new Pt((s,t,e,i)=>{lT||(lT=!0,s(xw).to(Ky).inSingletonScope(),s(xi).toService(xw))});var B$=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a},I$=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},F$=function(s,t){return function(e,i){t(e,i,s)}};let qy=class extends xr{constructor(s){super(),this.canvasRenderer=s,this.type="pyramid3d",this.numberType=tx}contains(s,t,e){const{pickContext:i}=e??{};if(!i)return!1;const n=rt(s).polygon;i.highPerformanceSave();const r=this.transform(s,n,i),{x:a,y:o,z:l,lastModelMatrix:h}=r;let d=t;if(i.camera){d=t.clone();const c=s.parent.globalTransMatrix;d.x=c.a*t.x+c.c*t.y+c.e,d.y=c.b*t.x+c.d*t.y+c.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(s,i,a,o,{},null,(c,p,g)=>!!u||(u=c.isPointInPath(d.x,d.y),u),(c,p,g)=>!1),this.canvasRenderer.z=0,i.modelMatrix!==h&&ce.free(i.modelMatrix),i.modelMatrix=h,i.highPerformanceRestore(),u}};qy=B$([ct(),F$(0,Dt(oy)),I$("design:paramtypes",[Object])],qy);let hT=!1;const j$=new Pt((s,t,e,i)=>{hT||(hT=!0,s(Ow).to(qy).inSingletonScope(),s(xi).toService(Ow))}),tn=vx();function hf(){hf.__loaded||(hf.__loaded=!0,MN(),Ct.load(nN),Ct.load(tn?qU:t4))}hf.__loaded=!1;const Ox=hf;function df(){df.__loaded||(df.__loaded=!0,CN(),Ct.load(kN),Ct.load(L$))}df.__loaded=!1;const z$=df;function uf(){uf.__loaded||(uf.__loaded=!0,PN(),Ct.load(oN),Ct.load(tn?x4:w4))}uf.__loaded=!1;const XR=uf;function cf(){cf.__loaded||(cf.__loaded=!0,EN(),Ct.load(hN),Ct.load(tn?F4:G4))}cf.__loaded=!1;const H$=cf;function pf(){pf.__loaded||(pf.__loaded=!0,RN(),Ct.load(gN),Ct.load(tn?p$:m$))}pf.__loaded=!1;const G$=pf;function gf(){gf.__loaded||(gf.__loaded=!0,ON())}gf.__loaded=!1;const He=gf;function ff(){ff.__loaded||(ff.__loaded=!0,DN(),Ct.load(vN),Ct.load(tn?w$:T$))}ff.__loaded=!1;const KR=ff;function _f(){_f.__loaded||(_f.__loaded=!0,LN(),Ct.load(aN),Ct.load(tn?p4:m4))}_f.__loaded=!1;const Ra=_f;function mf(){mf.__loaded||(mf.__loaded=!0,BN(),Ct.load(uN),Ct.load(tn?Z4:e$))}mf.__loaded=!1;const uc=mf;function vf(){vf.__loaded||(vf.__loaded=!0,IN(),Ct.load(cN),Ct.load(tn?r$:h$))}vf.__loaded=!1;const U_=vf;function yf(){yf.__loaded||(yf.__loaded=!0,FN(),Ct.load(TN),Ct.load(j$))}yf.__loaded=!1;const W$=yf;function bf(){bf.__loaded||(bf.__loaded=!0,jN(),Ct.load(rN),Ct.load(tn?n4:l4))}bf.__loaded=!1;const Mr=bf;function xf(){xf.__loaded||(xf.__loaded=!0,zN(),Ct.load(bN),Ct.load(E$))}xf.__loaded=!1;const N$=xf;function Sf(){Sf.__loaded||(Sf.__loaded=!0,HN(),Ct.load(mN),Ct.load(tn?x$:A$))}Sf.__loaded=!1;const Oa=Sf;function Af(){Af.__loaded||(Af.__loaded=!0,NN())}Af.__loaded=!1;const Di=Af;function kf(){kf.__loaded||(kf.__loaded=!0,GN(),Ct.load(lN),Ct.load(tn?P4:D4))}kf.__loaded=!1;const An=kf;function wf(){wf.__loaded||(wf.__loaded=!0,WN(),Ct.load(dN),Ct.load(tn?U4:Y4))}wf.__loaded=!1;const Da=wf;function Tf(){Tf.__loaded||(Tf.__loaded=!0,VN())}Tf.__loaded=!1;const qR=Tf;function V$(){He(),Mr()}const dT={debounce:Xn,throttle:Ea};V$();let ZR=class JR extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},JR.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=i=>{const{viewX:n,viewY:r}=i,{direction:a,width:o,height:l,range:h}=this.attribute,d=this._sliderSize,[u,c]=this._getScrollRange();let p;if(a==="vertical"){const g=r-this._viewPosition.y,f=di(g-d/2,u,c);p=g/l,this._slider.setAttribute("y",f,!0)}else{const g=n-this._viewPosition.x,f=di(g-d/2,u,c);p=g/o,this._slider.setAttribute("x",f,!0)}this.setScrollRange([p-(h[1]-h[0])/2,p+(h[1]-h[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=i=>{i.stopPropagation();const{direction:n}=this.attribute;this._prePos=n==="horizontal"?i.clientX:i.clientY,this._dispatchEvent("scrollDown",{pos:this._prePos,event:i}),Ht.env==="browser"?(Ht.addEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),Ht.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=i=>{const{direction:n}=this.attribute;let r,a,o=0;const{width:l,height:h}=this._getSliderRenderBounds();return n==="vertical"?(a=i.clientY,o=a-this._prePos,r=o/h):(a=i.clientX,o=a-this._prePos,r=o/l),[a,r]},this._onSliderPointerMove=dT[this.attribute.delayType](i=>{i.stopPropagation();const n=this.getScrollRange(),[r,a]=this._computeScrollValue(i);this.setScrollRange([n[0]+a,n[1]+a],!0),this._prePos=r},this.attribute.delayTime),this._onSliderPointerUp=i=>{i.preventDefault();const{realTime:n=!0,range:r,limitRange:a=[0,1]}=this.attribute,o=this.getScrollRange(),[l,h]=this._computeScrollValue(i),d=[o[0]+h,o[1]+h];n||this._dispatchEvent("scroll",{pre:r,value:Fr(d,a[0],a[1])}),this._dispatchEvent("scrollUp",{pre:r,value:Fr(d,a[0],a[1])}),Ht.env==="browser"?(Ht.removeEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),Ht.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:n=[0,1],range:r,realTime:a=!0}=this.attribute,o=Fr(t,n[0],n[1]);if(e){const l=this._getSliderPos(o);this._slider&&(i==="horizontal"?this._slider.setAttribute("x",l[0],!0):this._slider.setAttribute("y",l[0],!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame())}this.attribute.range=o,a&&(this._dispatchEvent("scroll",{pre:r,value:o}),this._dispatchEvent("scrollDrag",{pre:r,value:o}))}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",dT[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:r=[0,1],railStyle:a,sliderStyle:o,padding:l=2}=this.attribute,h=this.createOrUpdateChild("scrollbar-container",{},"group"),d=h.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},a),"rect");this._rail=d;const u=this._getSliderRenderBounds(),c=this._getSliderPos(Fr(n,r[0],r[1])),p=c[1]-c[0];let g;this._sliderSize=p,g=t==="horizontal"?{x:c[0],y:u.y1,width:p,height:u.height}:{x:u.x1,y:c[0],width:u.width,height:p};const f=h.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},g),{cornerRadius:this._getDefaultSliderCornerRadius()}),o),{boundsPadding:as(l),pickMode:"imprecise"}),"rect");this._slider=f,this._container=h;const _=this._container.AABBBounds;this._viewPosition={x:_.x1,y:_.y1}}_getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,r,a,o]=as(i),l={x1:o,y1:n,x2:t-r,y2:e-a,width:Math.max(0,t-(o+r)),height:Math.max(0,e-(n+a))};return this._sliderRenderBounds=l,l}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:i,height:n}=this._getSliderRenderBounds();return t==="horizontal"?n:i}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:r,y1:a}=this._getSliderRenderBounds();return e==="horizontal"?[i*t[0]+r,i*t[1]+r]:[n*t[0]+a,n*t[1]+a]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=Fr(t,0,1),{width:r,height:a,x1:o,y1:l}=this._getSliderRenderBounds(),h=this._sliderSize;return e==="horizontal"?Fr([o+i*r,o+n*r],o,r-h):Fr([l+i*a,l+n*a],l,a-h)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};ZR.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};function fn(s,t){s.forEachChildren(e=>{const i=t(e);e.isContainer&&!i&&fn(e,t)})}const Ve=s=>!C(s)&&s.visible!==!1;function U$(s,t){if(!t)return[];const e=s.find(i=>i.name===t,!0);return e?e.getChildren():[]}function $$(s,t){if(!t)return[];const e=s.find(i=>i.name===t,!0);return e?e.findAll(i=>i.type!=="group",!0):[]}const Y$=["#ffffff","#000000"];function uT(s,t,e,i,n,r){if(typeof s!="string"||typeof t!="string")return s;const a=new Ue(s).toHex(),o=new Ue(t).toHex();return Dx(a,o,e,i,r)?a:X$(a,o,e,i,n,r)}function X$(s,t,e,i,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...Y$);for(const o of a)if(s!==o&&Dx(o,t,e,i,r))return o}function Dx(s,t,e,i,n){if(n==="lightness"){const r=Ue.getColorBrightness(new Ue(t));return Ue.getColorBrightness(new Ue(s))<.5?r>=.5:r<.5}return i?bv(s,t)>i:e==="largeText"?bv(s,t)>3:bv(s,t)>4.5}function bv(s,t){const e=cT(s),i=cT(t);return((e>i?e:i)+.05)/((e>i?i:e)+.05)}function cT(s){const t=nP(s),e=t[0]/255,i=t[1]/255,n=t[2]/255;let r,a,o;return r=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),a=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function Eo(s,t,e,i){let n;switch(s){case"base":n=t;break;case"invertBase":n=e;break;case"similarBase":n=i}return n}function QR(s,t){return[s[0]*t,s[1]*t]}function K$(s){const[t,e]=s;return Math.sqrt(t*t+e*e)}function q$(s){const[t,e]=s;let i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i)),[s[0]*i,s[1]*i]}function Z$(s,t){const[e,i]=s,[n,r]=t,a=Math.sqrt((e*e+i*i)*(n*n+r*r)),o=a&&(e*n+i*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}function J$(s,t){return s[0]*t[1]-t[0]*s[1]}function Q$(s,t,e){const i=Z$(s,t),n=J$(s,t)>=0;return e?n?2*Math.PI-i:i:n?i:2*Math.PI-i}const hh=-.5*Math.PI,dh=1.5*Math.PI,Pd="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",t8=11;var je;(function(s){s.selected="selected",s.selectedReverse="selected_reverse",s.hover="hover",s.hoverReverse="hover_reverse"})(je||(je={}));const Ro={[je.selectedReverse]:{},[je.selected]:{},[je.hover]:{},[je.hoverReverse]:{}},Sr={container:"",width:30,height:30,style:{}},xv=(s,t,e)=>new li(Object.assign({defaultFontParams:{fontFamily:Pd,fontSize:t8},getTextBounds:lc,specialCharSet:`-/: .,@%'"~`+li.ALPHABET_CHAR_SET+li.ALPHABET_CHAR_SET.toUpperCase()},{}),s);function $_(s,t,e=Pd){var i,n;if(!s)return{width:0,height:0};const r=lc({text:s,fontFamily:(i=t.fontFamily)!==null&&i!==void 0?i:e,fontSize:t.fontSize||12,fontWeight:t.fontWeight,textAlign:(n=t.textAlign)!==null&&n!==void 0?n:"center",textBaseline:t.textBaseline,ellipsis:!!t.ellipsis,maxLineWidth:t.maxLineWidth||1/0,lineHeight:t.fontSize||12});return{width:r.width(),height:r.height()}}function Y_(){He(),Mr(),An(),Oa(),Da()}var op=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};Y_();class kn extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},kn.defaultAttributes,t)),this.name="tag"}render(){var t,e,i,n;const{text:r="",textStyle:a={},shape:o={},panel:l={},space:h=4,minWidth:d,maxWidth:u,padding:c=4,visible:p,state:g,type:f,textAlwaysCenter:_}=this.attribute,m=as(c),v=this.createOrUpdateChild("tag-content",{x:0,y:0,zIndex:1},"group");let y,b=m[1]+m[3],x=m[0]+m[2],S=0,A=0;const{visible:k}=o,w=op(o,["visible"]);if(pe(k)){const M=(w==null?void 0:w.size)||10,P=lt(M)?M:Math.max(M[0],M[1]);y=v.createOrUpdateChild("tag-shape",Object.assign(Object.assign({symbolType:"circle",size:M,strokeBoundsBuffer:0},w),{visible:k,x:P/2,y:P/2}),"symbol"),ft(g==null?void 0:g.shape)||(y.states=g.shape),k&&(A=P+h)}let T;if(b+=A,S+=A,f==="rich"){const M=Object.assign(Object.assign({textConfig:r,visible:E(r)&&p!==!1},a),{x:S,y:0,width:(t=a.width)!==null&&t!==void 0?t:0,height:(e=a.height)!==null&&e!==void 0?e:0});T=v.createOrUpdateChild("tag-text",M,"richtext");const{visible:P}=l,O=op(l,["visible"]);if(p&&pe(P)){const D=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},O),{visible:P&&!!r,x:T.AABBBounds.x1,y:T.AABBBounds.y1,width:T.AABBBounds.width(),height:T.AABBBounds.height()}),"rect");ft(g==null?void 0:g.panel)||(D.states=g.panel)}}else if(f==="html"){const M=Object.assign(Object.assign({textConfig:[],visible:E(r)&&p!==!1,html:Object.assign(Object.assign({dom:r},Sr),a)},a),{x:S,y:0});T=v.createOrUpdateChild("tag-text",M,"richtext");const{visible:P}=l,O=op(l,["visible"]);if(p&&pe(P)){const D=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},O),{visible:P&&!!r,x:T.AABBBounds.x1,y:T.AABBBounds.y1,width:T.AABBBounds.width(),height:T.AABBBounds.height()}),"rect");ft(g==null?void 0:g.panel)||(D.states=g.panel)}}else{const M=Object.assign(Object.assign({text:r,visible:E(r)&&p!==!1,lineHeight:a==null?void 0:a.fontSize},a),{x:S,y:0});C(M.lineHeight)&&(M.lineHeight=a.fontSize),T=v.createOrUpdateChild("tag-text",M,"text"),ft(g==null?void 0:g.text)||(T.states=g.text);const P=$_(M.text,a,(i=this.stage)===null||i===void 0?void 0:i.getTheme().text.fontFamily),O=P.width,D=P.height;b+=O;const R=(n=o.size)!==null&&n!==void 0?n:10,L=lt(R)?R:Math.max(R[0],R[1]);x+=Math.max(D,o.visible?L:0);const{textAlign:B,textBaseline:F}=a;(E(d)||E(u))&&(E(d)&&b<d&&(b=d),E(u)&&b>u&&(b=u,T.setAttribute("maxLineWidth",u-m[1]-m[2])));let z=0,N=0;B==="center"?(z-=b/2,y&&y.setAttribute("x",(y.attribute.x||0)-O/2),v.setAttribute("x",-A/2)):B==="right"||B==="end"?(z-=b,y&&y.setAttribute("x",(y.attribute.x||0)-O),v.setAttribute("x",-m[1]-A)):B!=="left"&&B!=="start"||v.setAttribute("x",m[3]),!_||B!=="left"&&B!=="start"||T.setAttributes({x:S+b/2,textAlign:"center"}),F==="middle"?(N-=x/2,y&&y.setAttribute("y",0)):F==="bottom"?(N-=x,y&&y.setAttribute("y",-D/2),v.setAttribute("y",-m[2])):F==="top"&&(v.setAttribute("y",m[0]),y&&y.setAttribute("y",D/2));const{visible:V}=l,G=op(l,["visible"]);if(p&&pe(V)){const X=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:V&&!!r,x:z,y:N,width:b,height:x}),"rect");ft(g==null?void 0:g.panel)||(X.states=g.panel)}}}}kn.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const tO={visible:!0,position:"auto",titleStyle:{fontSize:16,fill:"#08979c"},contentStyle:{fontSize:12,fill:"green"},panel:{visible:!0,fill:"#e6fffb",size:12,space:0,stroke:"#87e8de",lineWidth:1,cornerRadius:4}},eO={poptip:at({},tO)};function e8(){He(),qR(),An(),Mr()}function i8(s){at(eO.poptip,tO,s)}var s8=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};const pT=new Me;e8();class _u extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},_u.defaultAttributes,t)),this.name="poptip",this.positionList=["top","tl","tr","bottom","bl","br","left","lt","lb","right","rt","rb"]}render(){var t,e,i,n,r,a,o,l;const{titleStyle:h={},position:d,contentStyle:u={},panel:c={},space:p=4,minWidth:g=0,maxWidth:f=1/0,padding:_=4,maxWidthPercent:m,visible:v,state:y,dx:b=0,dy:x=0}=this.attribute;let{title:S="",content:A=""}=this.attribute;S=this.attribute.titleFormatMethod?this.attribute.titleFormatMethod(S):S,A=this.attribute.contentFormatMethod?this.attribute.contentFormatMethod(A):A;const k=as(_),w=this.createOrUpdateChild("poptip-content",{x:0,y:0,zIndex:1},"group"),T=f-k[1]-k[3],M=E(S)&&v!==!1,P=Object.assign(Object.assign({text:U(S)?S:[S],visible:M},h),{x:k[3],y:k[0],maxLineWidth:T,textAlign:"left",textBaseline:"top"}),O=w.createOrUpdateChild("poptip-title",P,"wrapText");ft(y==null?void 0:y.title)||(O.states=y.title);const D=O.AABBBounds,R=D.height(),L=D.width();let B=R+p;M||(B=0);const F=E(A)&&v!==!1,z=Object.assign(Object.assign({text:U(A)?A:[A],visible:F},u),{x:k[3],y:k[0]+B,maxLineWidth:T,textAlign:"left",textBaseline:"top"}),N=w.createOrUpdateChild("poptip-content",z,"wrapText");ft(y==null?void 0:y.content)||(N.states=y.content);const V=N.AABBBounds,G=V.height(),X=V.width();F&&(B+=G);let Z=ss(L+k[1]+k[3],X+k[1]+k[3]);Z>f?Z=f:Z<g&&(Z=g);let et=k[0]+k[2]+B;const{visible:K}=c,W=s8(c,["visible"]),it=(t=W.size)!==null&&t!==void 0?t:12,ht=U(it)?[it[0]+((e=W.space)!==null&&e!==void 0?e:0),it[1]+((i=W.space)!==null&&i!==void 0?i:0)]:it+((n=W.space)!==null&&n!==void 0?n:0),dt=(r=W.lineWidth)!==null&&r!==void 0?r:1,Rt=this.stage?[(a=this.stage.viewWidth)!==null&&a!==void 0?a:this.stage.width,(o=this.stage.viewHeight)!==null&&o!==void 0?o:this.stage.height]:void 0;if(Rt){const Lt=this.AABBBounds,Ot=(l=this.attribute.x)!==null&&l!==void 0?l:Lt.x1,mi=Rt[0]-Lt.x1;let Se=Math.max(Ot,mi);const us=(U(it)?it[0]:12)+3;if(Se=Math.min(Se-us,Se*m),Se<Z){Z=Se;const Ge=k[1]+k[3];O.setAttribute("maxLineWidth",Se-Ge),N.setAttribute("maxLineWidth",Se-Ge),et=k[0]+k[2],M&&(et+=O.AABBBounds.height()+p),et+=N.AABBBounds.height()}}const gt=d==="auto";let wt,kt=-1/0;for(let Lt=0;Lt<this.positionList.length+1;Lt++){const Ot=gt?this.positionList[Lt===this.positionList.length?wt:Lt]:d,{angle:mi,offset:Se,rectOffset:us}=this.getAngleAndOffset(Ot,Z,et,U(ht)?ht:[ht,ht-dt]);if(pe(K)){const Ge=(U(it)?it[0]:it)/4,Li=w.createOrUpdateChild("poptip-symbol-panel",Object.assign(Object.assign({},W),{visible:K&&(F||M),x:Ge,y:0,strokeBoundsBuffer:-1,boundsPadding:-2,anchor:[0,0],symbolType:"arrow2Left",angle:mi,dx:Se[0],dy:Se[1],size:it,zIndex:-9}),"symbol");ft(y==null?void 0:y.panel)||(Li.states=y.panel);const ae=w.createOrUpdateChild("poptip-rect-panel",Object.assign(Object.assign({},W),{visible:K&&(F||M),x:0,y:0,width:Z,height:et,zIndex:-8}),"rect");ft(y==null?void 0:y.panel)||(ae.states=y.panel)}if(w.setAttributes({x:-Se[0]+b,y:-Se[1]+x}),!gt||!Rt)break;{pT.setValue(0,0,Z,et).transformWithMatrix(w.globalTransMatrix);const Ge=pT,Li=new yi().setValue(0,0,Rt[0],Rt[1]);if(hF(Ge,Li))break;{const ae=oP(Ge,Li),me=(ae.x2-ae.x1)*(ae.y2-ae.y1);me>kt&&(kt=me,wt=Lt)}}}}getAngleAndOffset(t,e,i,n){const r=n[1]/2;switch(t){case"tl":return{angle:ne/2*3,offset:[e/4,i+r],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:ne/2*3,offset:[e/2,i+r],rectOffset:[0,-i-n[1]]};case"tr":return{angle:ne/2*3,offset:[e/4*3,i+r],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-r,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-r,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-r,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:ne/2,offset:[e/4,-r],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:ne/2,offset:[e/2,-r],rectOffset:[0,-i-n[1]]};case"br":return{angle:ne/2,offset:[e/4*3,-r],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:ne,offset:[e+r,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:ne,offset:[e+r,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:ne,offset:[e+r,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}_u.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};var n8=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};function r8(s,t){return at(s,eO.poptip,t),s}let Ed=class{render(s,t,e,i,n,r,a,o,l,h,d,u,c){var p;if(s._showPoptip===1){const{visible:g,visibleCb:f}=s.attribute.poptip||{};if(g===!1||f&&f(s)===!1)return;const _={};at(_,_u.defaultAttributes,s.attribute.poptip?s.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(_):this.poptipComponent=new _u(_);let m=s.attribute.poptip||{};if(s.type==="text"&&m.title==null&&m.content==null){const b={};r8(b,m),m=b,m.content=(p=m.content)!==null&&p!==void 0?p:s.attribute.text}const v=s.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},m),{x:v.e,y:v.f})),h.stage.tryInitInteractiveLayer();const y=h.stage.getLayer("_builtin_interactive");y&&y.add(this.poptipComponent)}else s._showPoptip===2&&(s._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};Ed=n8([ct()],Ed);var iO=function(s,t,e,i){var n,r=arguments.length,a=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,i);else for(var o=s.length-1;o>=0;o--)(n=s[o])&&(a=(r<3?n(a):r>3?n(t,e,a):n(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a};let Rd=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=Xe.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=s=>{const t=s.target;if(t.isContainer||!t.attribute)return void this.unpoptip(s);if(t===this.activeGraphic)return;const{poptip:e}=t.attribute;e&&(t.setAttributes({}),t._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(t,!0)},this.unpoptip=s=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(s){this.pluginService=s;const{stage:t}=this.pluginService;t.addEventListener("pointerover",this.poptip)}setActiveGraphic(s,t){this.activeGraphic=s,this.pluginService.stage.renderNextFrame()}deactivate(s){const{stage:t}=this.pluginService;t.removeEventListener("pointerover",this.poptip)}};Rd=iO([ct()],Rd);let Od=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=Xe.GenAutoIncrementId(),this.key=this.name+this._uid,this.pointerlave=s=>{const{stage:t}=this.pluginService;s.target===t&&this.unpoptip(s)},this.poptip=s=>{const t=s.target;if(t.type!=="text"||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip)return void this.unpoptip(s);if(t===this.activeGraphic)return;const{poptip:e={}}=t.attribute;e&&(t.setAttributes({}),t._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(t,!0)},this.unpoptip=s=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(s){this.pluginService=s;const{stage:t}=this.pluginService;t.addEventListener("pointerover",this.poptip),t.addEventListener("pointerleave",this.pointerlave)}setActiveGraphic(s,t){this.activeGraphic=s,this.pluginService.stage.renderNextFrame()}deactivate(s){const{stage:t}=this.pluginService;t.removeEventListener("pointerover",this.poptip),t.removeEventListener("pointerleave",this.pointerlave)}};Od=iO([ct()],Od);const a8=new Pt((s,t,e,i)=>{e(Ed)||(s(Ed).toSelf().inSingletonScope(),s(lx).toService(Ed)),e(Rd)||(s(Rd).toSelf(),s(cu).toService(Rd)),e(Od)||(s(Od).toSelf(),s(cu).toService(Od))});function o8(){Ct.load(a8)}class cc extends ri{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}function l8(){He(),Ra()}function h8(){He(),Ox()}function d8(){He(),uc()}function u8(){He(),Mr()}function c8(){He(),Ox()}l8();class pc extends cc{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},pc.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}pc.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};u8();class X_ extends cc{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},X_.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}X_.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};h8();class K_ extends cc{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},K_.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=Ee.distancePP(t,e);this.setAttribute("radius",i)}}K_.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};c8();class q_ extends cc{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},q_.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:r}=this.attribute,{startAngle:a,endAngle:o}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:a,endAngle:o}),r),"arc")}setLocation(t){const{center:e,startAngle:i=hh,endAngle:n=dh}=this.attribute,r=n-i,a=Zl(Np(e,t));this.setAttributes({startAngle:a-r/2,endAngle:a+r/2})}}q_.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};d8();class Z_ extends cc{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},Z_.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:r}=this.attribute,{startAngle:a,endAngle:o}=this.attribute,l=(o-a)%(2*Math.PI)==0,h=(o-a)/n;let d;for(let u=0;u<=n;u++){const c=ln(e,i,a+h*u);u===0?d=`M${c.x},${c.y}`:d+=`L${c.x},${c.y}`,u===n&&l&&(d+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:d},r),"path")}setLocation(t){const{center:e}=this.attribute,i=Ee.distancePP(t,e);this.setAttribute("radius",i)}}Z_.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const Hr=new Uint32Array(33),hn=new Uint32Array(33);hn[0]=0,Hr[0]=~hn[0];for(let s=1;s<=32;++s)hn[s]=hn[s-1]<<1|1,Hr[s]=~hn[s];function p8(s,t){const e=new Uint32Array(~~((s*t+32)/32));function i(r,a){e[r]|=a}function n(r,a){e[r]&=a}return{array:e,get:(r,a)=>{const o=a*s+r;return e[o>>>5]&1<<(31&o)},set:(r,a)=>{const o=a*s+r;i(o>>>5,1<<(31&o))},clear:(r,a)=>{const o=a*s+r;n(o>>>5,~(1<<(31&o)))},getRange:({x1:r,y1:a,x2:o,y2:l})=>{if(o<0||l<0||r>s||a>t)return!0;let h,d,u,c,p=l;for(;p>=a;--p)if(h=p*s+r,d=p*s+o,u=h>>>5,c=d>>>5,u===c){if(e[u]&Hr[31&h]&hn[1+(31&d)])return!0}else{if(e[u]&Hr[31&h]||e[c]&hn[1+(31&d)])return!0;for(let g=u+1;g<c;++g)if(e[g])return!0}return!1},setRange:({x1:r,y1:a,x2:o,y2:l})=>{if(o<0||l<0||r>s||a>t)return;let h,d,u,c,p;for(;a<=l;++a)if(h=a*s+r,d=a*s+o,u=h>>>5,c=d>>>5,u===c)i(u,Hr[31&h]&hn[1+(31&d)]);else for(i(u,Hr[31&h]),i(c,hn[1+(31&d)]),p=u+1;p<c;++p)i(p,4294967295)},clearRange:({x1:r,y1:a,x2:o,y2:l})=>{let h,d,u,c,p;for(;a<=l;++a)if(h=a*s+r,d=a*s+o,u=h>>>5,c=d>>>5,u===c)n(u,hn[31&h]|Hr[1+(31&d)]);else for(n(u,hn[31&h]),n(c,Hr[1+(31&d)]),p=u+1;p<c;++p)n(p,0)},outOfBounds:({x1:r,y1:a,x2:o,y2:l})=>r<0||a<0||l>=t||o>=s,toImageData:r=>{const a=r.createImageData(s,t),o=a.data;for(let l=0;l<t;++l)for(let h=0;h<s;++h){const d=l*s+h,u=4*d,c=e[d>>>5]&1<<(31&d);o[u+0]=255*c,o[u+1]=255*c,o[u+2]=255*c,o[u+3]=31}return a}}}function sO(s,t,e=0){const i=Math.max(1,Math.sqrt(s*t/1e6)),n=~~((s+2*e+i)/i),r=~~((t+2*e+i)/i),a=o=>~~((o+e)/i);return a.invert=o=>o*i-e,a.bitmap=()=>p8(n,r),a.ratio=i,a.padding=e,a.width=s,a.height=t,a}function Rn(s,t,e=!1){if(e){const{x1:i,x2:n,y1:r,y2:a}=t,o=di(i,0,s.width),l=di(n,0,s.width),h=di(r,0,s.height),d=di(a,0,s.height);return{x1:s(o),x2:s(l),y1:s(h),y2:s(d)}}return{x1:s(t.x1),x2:s(t.x2),y1:s(t.y1),y2:s(t.y2)}}function Bp(s,t,e,i=!0,n=0){let r=e;return n>0&&(r={x1:e.x1-n,x2:e.x2+n,y1:e.y1-n,y2:e.y2+n}),r=Rn(s,r),!(i&&t.outOfBounds(r))&&!t.getRange(r)}function Sv(s,t,e,i=[],n=!0,r=0){const a=i.filter(o=>E(o));for(let o=0;o<a.length;o++){const l=e.clone();if(l.setAttributes(a[o]),l.update(),Bp(s,t,Rn(s,l.AABBBounds),n,r))return t.setRange(Rn(s,l.AABBBounds,!0)),a[o]}return!1}function g8(s,t,e,i,n,r,a){var o,l;const h=(o=i.overlap)===null||o===void 0?void 0:o.clampForce,d=(l=i.overlap)===null||l===void 0?void 0:l.overlapPadding;if(e.type==="bound"||e.type==="position"){if(q(a)){const u=((q(e.position)?e.position(n.attribute):e.position)||m8(i.type)).map(c=>a(n.AABBBounds,r,c,i.offset));return Sv(s,t,n,u,h,d)}return!1}if(e.type==="moveY"){const u=(e.offset?q(e.offset)?e.offset(n.attribute):e.offset:[]).map(c=>({x:n.attribute.x,y:n.attribute.y+c}));return Sv(s,t,n,u,h,d)}if(e.type==="moveX"){const u=(e.offset?q(e.offset)?e.offset(n.attribute):e.offset:[]).map(c=>({x:n.attribute.x+c,y:n.attribute.y}));return Sv(s,t,n,u,h,d)}return!1}const f8=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],_8=["top","inside-top","inside"];function m8(s){return s==="rect"?_8:f8}function v8(s,t,e){const{x1:i,x2:n,y1:r,y2:a}=s.AABBBounds,o=Math.min(i,n),l=Math.max(i,n),h=Math.min(r,a),d=Math.max(r,a);let u=0,c=0;return o<0&&l-o<=t?u=-o:l>t&&o-(l-t)>=0&&(u=t-l),h<0&&d-h<=e?c=-h:d>e&&h-(d-e)>=0&&(c=e-d),{dx:u,dy:c}}const y8=(s={})=>{var t,e,i;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:(t=s.opacity)!==null&&t!==void 0?t:1,fillOpacity:(e=s.fillOpacity)!==null&&e!==void 0?e:1,strokeOpacity:(i=s.strokeOpacity)!==null&&i!==void 0?i:1}}},b8=(s={})=>{var t,e,i;return{from:{opacity:(t=s.opacity)!==null&&t!==void 0?t:1,fillOpacity:(e=s.fillOpacity)!==null&&e!==void 0?e:1,strokeOpacity:(i=s.strokeOpacity)!==null&&i!==void 0?i:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},gT={fadeIn:y8,fadeOut:b8};function fT(s,t){var e,i;return(i=(e=gT[t])===null||e===void 0?void 0:e.call(gT,s))!==null&&i!==void 0?i:{from:{},to:{}}}function x8(s,t,e){if(!U(e)){const{duration:i,easing:n,increaseEffect:r=!0}=e;return s.animate().to(t.attribute,i,n),void(r&&_T(s,t,i,n))}e.forEach((i,n)=>{const{duration:r,easing:a,increaseEffect:o=!0,channel:l}=i,{from:h,to:d}=S8(s,t,l,i.options);ft(d)||s.animate().to(d,r,a),"text"in h&&"text"in d&&o&&_T(s,t,r,a)})}const S8=(s,t,e,i)=>{const n=Object.assign({},s.attribute),r=Object.assign({},t.attribute);return Y(i==null?void 0:i.excludeChannels).forEach(a=>{delete r[a]}),Object.keys(r).forEach(a=>{e&&!e.includes(a)&&delete r[a]}),{from:n,to:r}};function _T(s,t,e,i){s.attribute.text!==t.attribute.text&&H(Number(s.attribute.text)*Number(t.attribute.text))&&s.animate().play(new vz({text:s.attribute.text},{text:t.attribute.text},e,i))}const Av={mode:"same-time",duration:300,easing:"linear"};function A8(s){return s.radius?{x:Math.cos(s.angle)*s.radius,y:Math.sin(s.angle)*s.radius}:{x:0,y:0}}function lp(s,t,e,i){const n=A8({radius:e,angle:i});return{x:s+n.x,y:t+n.y}}function k8(s){return(s=w8(s))>0&&s<=Math.PI/2?2:s>Math.PI/2&&s<=Math.PI?3:s>Math.PI&&s<=3*Math.PI/2?4:1}function w8(s){for(;s<0;)s+=2*Math.PI;for(;s>=2*Math.PI;)s-=2*Math.PI;return s}function Ha(s){return s===3||s===4}function T8(s){return s===1||s===2}function M8(s,t,e,i,n,r){if(s===0&&t===0||r<=0)return[];if(s===0){const c=-e/t,p=r**2-(c-n)**2;return p<0?[]:p===0?[{x:i,y:c}]:[{x:Math.sqrt(p)+i,y:c},{x:-Math.sqrt(p)+i,y:c}]}if(t===0){const c=-e/s,p=r**2-(c-i)**2;return p<0?[]:p===0?[{x:c,y:n}]:[{x:c,y:Math.sqrt(p)+n},{x:c,y:-Math.sqrt(p)+n}]}const a=(t/s)**2+1,o=2*((e/s+i)*(t/s)-n),l=o**2-4*a*((e/s+i)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),d=(-o-Math.sqrt(l))/(2*a),u=-(t*h+e)/s;return l===0?[{x:u,y:h}]:[{x:u,y:h},{x:-(t*d+e)/s,y:d}]}function C8(s,t){return t>2*s?NaN:2*Math.asin(t/2/s)}function P8(s,t){const{x1:e,y1:i,x2:n,y2:r}=s,{x1:a,y1:o,x2:l,y2:h}=t;return!(e<=a&&n<=a||e>=l&&n>=l||i<=o&&r<=o||i>=h&&r>=h)}const nO=(s,t,e="top",i=0)=>{if(!s)return;const{x1:n,y1:r,x2:a,y2:o}=s,l=Math.abs(a-n),h=Math.abs(o-r),d=(t.x1+t.x2)/2,u=(t.y1+t.y2)/2;let c=0,p=0,g=0,f=0;t&&(g=Math.abs(t.x1-t.x2)/2,f=Math.abs(t.y1-t.y2)/2);const _={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(e){case"top":p=-1;break;case"bottom":p=1;break;case"left":c=-1;break;case"right":c=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":c=Math.sin(_[e]*(Math.PI/180)),p=Math.cos(_[e]*(Math.PI/180));break;case"center":c=0,p=0}return{x:d+c*(i+g)+Math.sign(c)*(l/2),y:u+p*(i+f)+Math.sign(p)*(h/2)}},E8=s=>{if(!s||!s.attribute)return[];const{points:t,segments:e}=s.attribute;if(e&&e.length){const i=[];return e.forEach(n=>{n.points.forEach(r=>{i.push(r)})}),i}return t};function rO(s,t,e="end",i=0){if(!s||!t)return{x:1/0,y:1/0};const{x1:n,x2:r}=s,a=Math.abs(r-n),o=t.x1;let l=o;return e==="end"?l=o+a/2+i:e==="start"&&(l=o-a/2-i),{x:l,y:t.y1}}function R8(s,t){if(!s||!t||Kd(s,t,!0))return;const e=Math.min(s.x1,s.x2),i=Math.min(s.y1,s.y2),n=Math.min(t.x1,t.x2),r=Math.min(t.y1,t.y2),a=Math.abs(s.x2-e)/2,o=Math.abs(s.y2-i)/2,l=Math.abs(t.x2-n)/2,h=Math.abs(t.y2-r)/2,d=e+a,u=i+o,c=n+l,p=r+h,g=c-d,f=p-u;return[mT(g,f,d,u,a,o),mT(-g,-f,c,p,l,h)]}function mT(s,t,e,i,n,r){return Math.abs(t/s)<r/n?{x:e+(s>0?n:-n),y:i+t*n/Math.abs(s)}:{x:e+s*r/Math.abs(t),y:i+(t>0?r:-r)}}function O8(){He(),Da(),Oa(),Ra()}O8();class Kn extends ri{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t,e){super(e!=null&&e.skipDefault?t:at({},Kn.defaultAttributes,t)),this.name="label",this._onHover=i=>{const n=i.target;n===this._lastHover||ft(n.states)||(n.addState(je.hover,!0),fn(this,r=>{r===n||ft(r.states)||r.addState(je.hoverReverse,!0)}),this._lastHover=n)},this._onUnHover=i=>{this._lastHover&&(fn(this,n=>{ft(n.states)||(n.removeState(je.hoverReverse),n.removeState(je.hover))}),this._lastHover=null)},this._onClick=i=>{const n=i.target;if(this._lastSelect===n&&n.hasState("selected"))return this._lastSelect=null,void fn(this,r=>{ft(r.states)||(r.removeState(je.selectedReverse),r.removeState(je.selected))});ft(n.states)||(n.addState(je.selected,!0),fn(this,r=>{r===n||ft(r.states)||r.addState(je.selectedReverse,!0)}),this._lastSelect=n)},this._handleRelatedGraphicSetState=i=>{var n,r,a,o,l;if(((n=i.detail)===null||n===void 0?void 0:n.type)===Pe.STATE||((r=i.detail)===null||r===void 0?void 0:r.type)===Pe.ANIMATE_UPDATE&&(!((a=i.detail.animationState)===null||a===void 0)&&a.isFirstFrameOfStep)){const h=(l=(o=i.target)===null||o===void 0?void 0:o.currentStates)!==null&&l!==void 0?l:[];(this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(i.target)]).forEach(d=>{d&&(d.text&&d.text.useStates(h),d.labelLine&&d.labelLine.useStates(h))})}}}labeling(t,e,i,n){}_createLabelLine(t,e){const i=R8(t.AABBBounds,e==null?void 0:e.AABBBounds);if(i){const n=pt.line({points:i});return e&&e.attribute.fill&&n.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!ft(this.attribute.line.style)&&n.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(n),n}}render(){if(this._prepare(),C(this._idToGraphic)||this._isCollectionBase&&C(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a,o=this.attribute.data;q(i)&&(o=i(o)),a=q(n)?n(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?l=>this._idToPoint.get(l.id):null):this._layout(o),q(r)?a=r(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?l=>this._idToPoint.get(l.id):null):t!==!1&&(a=this._overlapping(a)),a&&a.length&&a.forEach(l=>{this._bindEvent(l),this._setStatesOfText(l)}),e!==!1&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent||!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!ft(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!ft(e)&&(t.states=e)}_createLabelText(t){var e,i;return t.textType==="rich"?(t.textConfig=t.text,t.width=(e=t.width)!==null&&e!==void 0?e:0,t.height=(i=t.height)!==null&&i!==void 0?i:0,pt.richtext(t)):t.textType==="html"?(t.textConfig=[],t.html=Object.assign(Object.assign({dom:t.text},Sr),t),pt.richtext(t)):pt.text(t)}_prepare(){var t,e,i,n,r;const a=[];let o;if(o=q(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():U$(this.getRootNode(),this.attribute.baseMarkGroupName),o.forEach(h=>{h.releaseStatus!=="willRelease"&&a.push(h)}),(t=this._idToGraphic)===null||t===void 0||t.clear(),(e=this._idToPoint)===null||e===void 0||e.clear(),this._baseMarks=a,this._isCollectionBase=this.attribute.type==="line-data",!a||a.length===0)return;const{data:l}=this.attribute;if(l&&l.length!==0){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let h=0;for(let d=0;d<a.length;d++){const u=a[d],c=E8(u);if(c&&c.length)for(let p=0;p<c.length;p++){const g=l[h];g&&c[p]&&(E(g.id)||(g.id=`vrender-component-${this.name}-${h}`),this._idToPoint.set(g.id,c[p]),this._idToGraphic.set(g.id,u)),h++}}}else for(let h=0;h<a.length;h++){const d=l[h],u=a[h];d&&u&&(E(d.id)||(d.id=`vrender-component-${this.name}-${h}`),this._idToGraphic.set(d.id,u))}if(this.attribute.animation!==!1){const h=Vt(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:at({},Av,h,(i=this.attribute.animationEnter)!==null&&i!==void 0?i:{}),exit:at({},Av,h,(n=this.attribute.animationExit)!==null&&n!==void 0?n:{}),update:U(this.attribute.animationUpdate)?this.attribute.animationUpdate:at({},Av,h,(r=this.attribute.animationUpdate)!==null&&r!==void 0?r:{})}}}}getRelatedGraphic(t){return this._idToGraphic.get(t.id)}_layout(t=[]){const{textStyle:e={},position:i,offset:n}=this.attribute,r=[];for(let a=0;a<t.length;a++){const o=t[a],l=this.getRelatedGraphic(o);if(!l)continue;const h=Object.assign(Object.assign({fill:this._isCollectionBase?U(l.attribute.stroke)?l.attribute.stroke.find(f=>!!f&&f!==!0):l.attribute.stroke:l.attribute.fill},e),o),d=this._createLabelText(h),u=this.getGraphicBounds(d),c=q(i)?i(o):i,p=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(o.id),c):this.getGraphicBounds(l,{x:o.x,y:o.y},c),g=this.labeling(u,p,c,n);g&&(h.x=g.x,h.y=g.y,d.setAttributes(g)),r.push(d)}return r}_overlapping(t){var e,i,n,r;if(t.length===0)return[];const a=Vt(this.attribute.overlap)?this.attribute.overlap:{},o=[],l=this.getBaseMarkGroup(),h=(e=a.size)!==null&&e!==void 0?e:{width:(i=l==null?void 0:l.AABBBounds.width())!==null&&i!==void 0?i:0,height:(n=l==null?void 0:l.AABBBounds.height())!==null&&n!==void 0?n:0};if(h.width===0||h.height===0)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:c=!0,clampForce:p=!0,avoidMarks:g=[],overlapPadding:f}=a,_=this._bmpTool||sO(h.width,h.height),m=this._bitmap||_.bitmap(),v=u.some(y=>y.type==="bound");d&&((r=this._baseMarks)===null||r===void 0||r.forEach(y=>{y.AABBBounds&&m.setRange(Rn(_,y.AABBBounds,!0))})),g.length>0&&g.forEach(y=>{ot(y)?$$(this.getRootNode(),y).forEach(b=>{b.AABBBounds&&m.setRange(Rn(_,b.AABBBounds,!0))}):y.AABBBounds&&m.setRange(Rn(_,y.AABBBounds,!0))});for(let y=0;y<t.length;y++){if(t[y].visible===!1)continue;const b=t[y],x=this.getRelatedGraphic(b.attribute);if(b.update(),!Kd(x.AABBBounds,{x1:0,x2:_.width,y1:0,y2:_.height},!0))continue;if(Bp(_,m,b.AABBBounds,p,f)){if(!v){m.setRange(Rn(_,b.AABBBounds,!0)),o.push(b);continue}if(v&&x&&x.AABBBounds&&this._canPlaceInside(b.AABBBounds,x.AABBBounds)){m.setRange(Rn(_,b.AABBBounds,!0)),o.push(b);continue}}let S=!1;for(let A=0;A<u.length;A++)if(S=g8(_,m,u[A],this.attribute,b,this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t[y].attribute.id)):this.getGraphicBounds(x,t[y].attribute),this.labeling),S!==!1){b.setAttributes({x:S.x,y:S.y}),o.push(b);break}if(!S&&p){const{dx:A=0,dy:k=0}=v8(b,_.width,_.height);if(A===0&&k===0){if(Bp(_,m,b.AABBBounds)){m.setRange(Rn(_,b.AABBBounds,!0)),o.push(b);continue}}else if(Bp(_,m,{x1:b.AABBBounds.x1+A,x2:b.AABBBounds.x2+A,y1:b.AABBBounds.y1+k,y2:b.AABBBounds.y2+k})){b.setAttributes({x:b.attribute.x+A,y:b.attribute.y+k}),m.setRange(Rn(_,b.AABBBounds,!0)),o.push(b);continue}}!S&&!c&&o.push(b)}return q(this.onAfterLabelOverlap)&&this.onAfterLabelOverlap(m),o}getBaseMarkGroup(){const{baseMarkGroupName:t}=this.attribute;if(t)return this.getRootNode().find(e=>e.name===t,!0)}getGraphicBounds(t,e={}){if(t){if(t.attribute.visible!==!1)return t.AABBBounds;const{x:r,y:a}=t.attribute;return{x1:r,x2:r,y1:a,y2:a}}const{x:i,y:n}=e;return{x1:i,x2:i,y1:n,y2:n}}_renderLabels(t){this._enableAnimation===!1||this.attribute.animation===!1?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e;const i=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=(e=this.attribute.line)!==null&&e!==void 0?e:{};t.forEach((l,h)=>{const d=this.getRelatedGraphic(l.attribute),u=l.attribute.id,c=this._isCollectionBase?u:d,p=n!=null&&n.get(c)?"update":"enter";let g;if(o&&(g=this._createLabelLine(l,d)),p==="enter"){if(r.push(l),i.set(c,g?{text:l,labelLine:g}:{text:l}),d){const{from:f,to:_}=fT(l.attribute,"fadeIn");this.add(l),g&&(a.push(g),this.add(g)),this._syncStateWithRelatedGraphic(d),this._animationConfig.enter.duration>0&&d.once("animate-bind",m=>{l.setAttributes(f),g&&g.setAttributes(f);const v=this._afterRelatedGraphicAttributeUpdate(l,r,g,a,h,d,_,this._animationConfig.enter);d.on("afterAttributeUpdate",v)})}}else if(p==="update"){const f=n.get(c);n.delete(c),i.set(c,f);const _=f.text,{duration:m,easing:v}=this._animationConfig.update;x8(_,l,this._animationConfig.update),f.labelLine&&g&&f.labelLine.animate().to(g.attribute,m,v)}}),n.forEach(l=>{var h;(h=l.text)===null||h===void 0||h.animate().to(fT(l.text.attribute,"fadeOut").to,this._animationConfig.exit.duration,this._animationConfig.exit.easing).onEnd(()=>{this.removeChild(l.text),l.labelLine&&this.removeChild(l.labelLine)})}),this._graphicToText=i}_renderWithOutAnimation(t){var e;const i=new Map,n=this._graphicToText||new Map,{visible:r}=(e=this.attribute.line)!==null&&e!==void 0?e:{};t.forEach(a=>{const o=this.getRelatedGraphic(a.attribute),l=n!=null&&n.get(o)?"update":"enter",h=this._isCollectionBase?a.attribute.id:o;let d;if(r&&(d=this._createLabelLine(a,o)),l==="enter")i.set(h,d?{text:a,labelLine:d}:{text:a}),this.add(a),d&&this.add(d),this._syncStateWithRelatedGraphic(o);else if(l==="update"){const u=n.get(h);n.delete(h),i.set(h,u),u.text.setAttributes(a.attribute),u.labelLine&&d&&u.labelLine.setAttributes(d.attribute)}}),n.forEach(a=>{this.removeChild(a.text),a.labelLine&&this.removeChild(a.labelLine)}),this._graphicToText=i}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,n,r,a,o,{mode:l,duration:h,easing:d,delay:u}){const c=p=>{var g,f,_;const{detail:m}=p;if(!m)return{};const v=(g=m.animationState)===null||g===void 0?void 0:g.step;if(!(m.type===Pe.ANIMATE_UPDATE&&v&&!(v.type==="wait"&&((f=v.prev)===null||f===void 0?void 0:f.type)==null)))return{};if(m.type===Pe.ANIMATE_END)return t.setAttributes(o),void(i&&i.setAttributes(o));const y=()=>{a&&(a.onAnimateBind=void 0,a.removeEventListener("afterAttributeUpdate",c))};switch(l){case"after":m.animationState.end&&(t.animate({onStart:y}).wait(u).to(o,h,d),i&&i.animate().wait(u).to(o,h,d));break;case"after-all":r===e.length-1&&m.animationState.end&&(e.forEach(b=>{b.animate({onStart:y}).wait(u).to(o,h,d)}),n.forEach(b=>{b.animate().wait(u).to(o,h,d)}));break;default:if(this._isCollectionBase){const b=this._idToPoint.get(t.attribute.id);!b||t.animates&&t.animates.has("label-animate")||!a.containsPoint(b.x,b.y,Qd.LOCAL,(_=this.stage)===null||_===void 0?void 0:_.pickerService)||(t.animate({onStart:y}).wait(u).to(o,h,d),i&&i.animate().wait(u).to(o,h,d))}else m.animationState.isFirstFrameOfStep&&(t.animate({onStart:y}).wait(u).to(o,h,d),i&&i.animate().wait(u).to(o,h,d))}};return c}_smartInvert(t){var e,i,n,r,a;const o=Vt(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:l,contrastRatiosThreshold:h,alternativeColors:d,mode:u}=o,c=(e=o.fillStrategy)!==null&&e!==void 0?e:"invertBase",p=(i=o.strokeStrategy)!==null&&i!==void 0?i:"base",g=(n=o.brightColor)!==null&&n!==void 0?n:"#ffffff",f=(r=o.darkColor)!==null&&r!==void 0?r:"#000000",_=(a=o.outsideEnable)!==null&&a!==void 0&&a;if(c!=="null"||p!=="null")for(let m=0;m<t.length;m++){const v=t[m];if(!v)continue;const y=this.getRelatedGraphic(v.attribute),b=y.attribute.fill,x=v.attribute.fill,S=b,A=uT(x,b,l,h,d,u),k=Dx(A,g)?g:f;if(_){const w=Eo(c,S,A,k);if(w&&v.setAttributes({fill:w}),v.attribute.lineWidth===0)continue;const T=Eo(p,S,A,k);T&&v.setAttributes({stroke:T})}else if(this._canPlaceInside(v.AABBBounds,y.AABBBounds)){const w=Eo(c,S,A,k);if(w&&v.setAttributes({fill:w}),v.attribute.lineWidth===0)continue;const T=Eo(p,S,A,k);T&&v.setAttributes({stroke:T})}else{if(v.attribute.lineWidth===0)continue;if(v.attribute.stroke){v.setAttributes({fill:uT(v.attribute.fill,v.attribute.stroke,l,h,d,u)});continue}const w=Eo(c,S,A,k);w&&v.setAttributes({fill:w});const T=Eo(p,S,A,k);T&&v.setAttributes({stroke:T})}}}_canPlaceInside(t,e){return!(!t||!e)&&e.encloses(t)}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}Kn.defaultAttributes={textStyle:{fontSize:12,textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},offset:0,pickable:!1};class J_ extends Kn{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},J_.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e,i="top",n=0){return nO(t,e,i,n)}}J_.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class mu extends Kn{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},mu.defaultAttributes,t))}labeling(t,e,i="top",n=0){if(!t||!e)return;const{x1:r,y1:a,x2:o,y2:l}=t,h=Math.abs(o-r),d=Math.abs(l-a),u=Math.abs(e.x2-e.x1),c=Math.abs(e.y2-e.y1);let p=(e.x1+e.x2)/2,g=(e.y1+e.y2)/2,f=0,_=0;switch(i){case"top":case"inside-top":_=-.5;break;case"bottom":case"inside-bottom":_=.5;break;case"left":case"inside-left":f=-.5;break;case"right":case"inside-right":f=.5;break;case"top-right":f=.5,_=-.5;break;case"top-left":f=-.5,_=-.5;break;case"bottom-right":f=.5,_=.5;break;case"bottom-left":f=-.5,_=.5}p+=f*u,g+=_*c;let m=0,v=0;const y=i.includes("inside");switch(i.includes("top")?v=y?1:-1:i.includes("bottom")?v=y?-1:1:i.includes("left")?m=y?1:-1:i.includes("right")&&(m=y?-1:1),i){case"top-right":case"bottom-right":m=-1;break;case"top-left":case"bottom-left":m=1}return{x:p+m*n+m*h/2,y:g+v*n+v*d/2}}}mu.tag="rect-label",mu.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};let aO=class oO extends Kn{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},oO.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t,e={},i="end"){if(!t||t.type!=="line")return super.getGraphicBounds(t,e);const n=t.attribute.points||[e],r=i==="start"?0:n.length-1;return n[r]?{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}:void 0}labeling(t,e,i="end",n=0){return rO(t,e,i,n)}};aO.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};class D8{constructor(t,e,i,n,r,a,o,l,h){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=r,this.middleAngle=a,this.innerRadius=o,this.outerRadius=l,this.circleCenter=h,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class Q_ extends Kn{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},Q_.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e,i="outside",n=0){if(t&&e)return{x:0,y:0}}_layout(t=[]){const e=super._layout(t),i=e.map(h=>this.getGraphicBounds(h)),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"}),r=this._createLabelText(n),a=this.getGraphicBounds(r),o=a.x2-a.x1,l=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,o);for(let h=0;h<t.length;h++){const d=t[h],u=l.find(c=>{var p;return((p=c.refDatum)===null||p===void 0?void 0:p.id)===d.id});if(u){const c={visible:u.labelVisible,x:u.labelPosition.x,y:u.labelPosition.y,angle:u.angle,maxLineWidth:u.labelLimit,points:u.pointA&&u.pointB&&u.pointC?[u.pointA,u.pointB,u.pointC]:void 0,line:u.labelLine};e[h].setAttributes(c)}}return e}layoutArcLabels(t,e,i,n,r,a){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=a;let o=0;i.forEach(u=>{u.attribute.outerRadius>o&&(o=u.attribute.outerRadius)}),n.forEach((u,c)=>{var p,g;const f=this._idToGraphic.get(u.id).attribute,_={x:(p=f==null?void 0:f.x)!==null&&p!==void 0?p:0,y:(g=f==null?void 0:f.y)!==null&&g!==void 0?g:0};if(!C(n[c])&&!C(r[c])){const m=n[c]?n[c]:null,v=r[c]?r[c]:{x1:0,x2:0,y1:0,y2:0},y=(f.startAngle+f.endAngle)/2,b=f.endAngle-f.startAngle,x=k8(f.endAngle-b/2),S=lp(_.x,_.y,f.outerRadius,y),A=lp(_.x,_.y,o+e.line.line1MinLength,y),k=new D8(m,S,A,x,b,y,f.innerRadius,f.outerRadius,_);k.pointA=lp(_.x,_.y,this.computeDatumRadius(2*_.x,2*_.y,f.outerRadius),k.middleAngle),k.labelSize={width:v.x2-v.x1,height:v.y2-v.y1},T8(k.quadrant)?this._arcRight.set(k.refDatum,k):Ha(k.quadrant)&&this._arcLeft.set(k.refDatum,k)}});const l=Array.from(this._arcLeft.values()),h=Array.from(this._arcRight.values()),d=[];switch(t){case"inside":case"inside-inner":case"inside-outer":d.push(...this._layoutInsideLabels(h,e,i)),d.push(...this._layoutInsideLabels(l,e,i));break;default:d.push(...this._layoutOutsideLabels(h,e,i)),d.push(...this._layoutOutsideLabels(l,e,i))}return d}_layoutInsideLabels(t,e,i){var n,r;const a=e,o=a.spaceWidth,l=(n=a.position)!==null&&n!==void 0?n:"inside",h=(r=a.offsetRadius)!==null&&r!==void 0?r:-o;return t.forEach(d=>{var u,c,p;const{labelSize:g,radian:f}=d,_=d.innerRadius,m=d.outerRadius;let v;if(f<C8(m,g.height))v=0;else{let w;w=f>=Math.PI?_:Math.max(_,g.height/2/Math.tan(f/2)),v=m-w-o}a.rotate!==!0&&(v=m-o);const y=this._getFormatLabelText(d.refDatum,v);d.labelText=y;const b=Math.min(v,d.labelSize.width),x=this._computeAlign(d,e);let S,A=0;l==="inside"&&(A=x==="left"?b:x==="right"?0:b/2),S=l==="inside-inner"?_-h+A:m+h-A,d.labelPosition=lp(d.circleCenter.x,d.circleCenter.y,S,d.middleAngle),d.labelLimit=b,En(b,0)||(d.labelVisible=!1),d.angle=(c=(u=e.textStyle)===null||u===void 0?void 0:u.angle)!==null&&c!==void 0?c:d.middleAngle;let k=(p=a.offsetAngle)!==null&&p!==void 0?p:0;["inside-inner","inside-outer"].includes(l)&&(k+=Math.PI/2),d.angle+=k}),t}_layoutOutsideLabels(t,e,i){var n,r,a;const o=(n=i[0].attribute.x)!==null&&n!==void 0?n:0,l=2*((r=i[0].attribute.y)!==null&&r!==void 0?r:0),h=e.line.line2MinLength,d=e.layout,u=e.spaceWidth;if(t.forEach(p=>{const g=Ha(p.quadrant)?-1:1;p.labelPosition={x:p.outerCenter.x+g*(p.labelSize.width/2+h+u),y:p.outerCenter.y}}),t.sort((p,g)=>p.labelPosition.y-g.labelPosition.y),e.coverEnable!==!1||d.strategy==="none"){for(const p of t){const{labelPosition:g,labelSize:f}=p;p.labelLimit=f.width,p.pointB=Ha(p.quadrant)?{x:g.x+f.width/2+h+u,y:g.y}:{x:g.x-f.width/2-h-u,y:g.y},this._computeX(p,e,i)}e.coverEnable===!1&&d.strategy==="none"&&this._coverLabels(t)}else{const p=l/(((a=e.textStyle)===null||a===void 0?void 0:a.fontSize)||16);this._adjustY(t,p,e,i);const{minY:g,maxY:f}=t.reduce((v,y)=>{const{y1:b,y2:x}=y.getLabelBounds();return v.minY=Math.max(0,Math.min(b,v.minY)),v.maxY=Math.min(l,Math.max(x,v.maxY)),v},{minY:1/0,maxY:-1/0}),_=Math.max(Math.abs(l/2-g),Math.abs(f-l/2)),m=this._computeLayoutRadius(_,e,i);for(const v of t)this._computePointB(v,m,e,i),this._computeX(v,e,i)}const c=2*o;return t.forEach(p=>{var g,f;p.labelVisible&&(on(p.pointB.x,h+u)||En(p.pointB.x,c-h-u))&&(p.labelVisible=!1),p.angle=(f=(g=e.textStyle)===null||g===void 0?void 0:g.angle)!==null&&f!==void 0?f:0,e.offsetAngle&&(p.angle+=e.offsetAngle),p.labelLine=Object.assign({},e.line)}),t}_computeX(t,e,i){var n;const r=t.circleCenter,a=2*r.x;r.y;let o=0;i.forEach(A=>{A.attribute.outerRadius>o&&(o=A.attribute.outerRadius)});const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=e.line.line1MinLength,d=e.line.line2MinLength,u=(n=e.layout)===null||n===void 0?void 0:n.align,c=e.spaceWidth,{labelPosition:p,quadrant:g,pointB:f}=t;H(f.x*f.y)||(t.pointC={x:NaN,y:NaN},p.x=NaN,t.labelLimit=0);const _=this.computeRadius(l,e.width,e.height),m=Ha(g)?-1:1;let v=0,y=(m>0?a-f.x:f.x)-d-c;u==="labelLine"&&(v=(_+h+d)*m+r.x,y=(m>0?a-v:v)-c);const b=this._getFormatLabelText(t.refDatum,y);t.labelText=b;let x=Math.min(y,t.labelSize.width);switch(u){case"labelLine":break;case"edge":v=m>0?a-x-c:x+c;break;default:v=f.x+m*d}x=Math.max(this._ellipsisWidth,x),t.labelLimit=x,t.pointC={x:v,y:p.y};const S=.5*(t.labelLimit<t.labelSize.width?t.labelLimit:t.labelSize.width);u==="edge"?p.x=(m>0?a+0:0)-m*S:p.x=v+0+m*(c+S)}_computeAlign(t,e){var i,n,r,a,o,l;const h=e,d=(n=(i=h.textStyle)===null||i===void 0?void 0:i.textAlign)!==null&&n!==void 0?n:(r=h.textStyle)===null||r===void 0?void 0:r.align,u=(o=(a=h.layout)===null||a===void 0?void 0:a.textAlign)!==null&&o!==void 0?o:(l=h.layout)===null||l===void 0?void 0:l.align;return h.position!=="inside"?C(d)||d==="auto"?u==="edge"?Ha(t.quadrant)?"left":"right":Ha(t.quadrant)?"right":"left":d:C(d)||d==="auto"?"center":d}_getFormatLabelText(t,e){var i;return(i=t==null?void 0:t.text)!==null&&i!==void 0?i:""}_adjustY(t,e,i,n){var r;n[0].attribute.x;const a=2*((r=n[0].attribute.y)!==null&&r!==void 0?r:0),o=i.layout;if(o.strategy==="vertical"){let l,h=0;const d=t.length;if(d<=0)return;for(let c=0;c<d;c++){const{y1:p}=t[c].getLabelBounds();if(l=p-h,on(l,0)){const f=this._shiftY(t,c,d-1,-l);this._shiftY(t,f,0,l/2)}const{y2:g}=t[c].getLabelBounds();h=g}const{y1:u}=t[0].getLabelBounds();l=u-0,on(l,0)&&this._shiftY(t,0,d-1,-l);for(let c=t.length-1;c>=0&&t[c].getLabelBounds().y2>a;c--)t[c].labelVisible=!1}else if(o.strategy!=="none"){const l=t.map((u,c)=>({arc:u,originIndex:c,priorityIndex:0}));l.sort((u,c)=>c.arc.radian-u.arc.radian),l.forEach((u,c)=>{u.priorityIndex=c,u.arc.labelVisible=!1});let h=1/0,d=-1/0;for(let u=0;u<e&&u<t.length;u++){this._storeY(t);const c=l[u].arc;this._computeYRange(c,i,n),c.labelVisible=!0;const p=c.labelPosition.y,{lastIndex:g,nextIndex:f}=this._findNeighborIndex(t,l[u]),_=t[g],m=t[f];if(g===-1&&f!==-1){const x=m.labelPosition.y;p>x?c.labelPosition.y=x-m.labelSize.height/2-c.labelSize.height/2:this._twoWayShift(t,c,m,f)}else if(g!==-1&&f===-1){const x=_.labelPosition.y;p<x?c.labelPosition.y=x+_.labelSize.height/2+c.labelSize.height/2:this._twoWayShift(t,_,c,l[u].originIndex)}else if(g!==-1&&f!==-1){const x=_.labelPosition.y,S=m.labelPosition.y;p>S?(c.labelPosition.y=S-m.labelSize.height/2-c.labelSize.height/2,this._twoWayShift(t,_,c,l[u].originIndex)):p<x?(c.labelPosition.y=x+_.labelSize.height/2+c.labelSize.height/2,this._twoWayShift(t,c,m,f)):(this._twoWayShift(t,_,c,l[u].originIndex),this._twoWayShift(t,c,m,f))}const v=Math.min(h,l[u].originIndex),y=Math.max(d,l[u].originIndex);let b;if(b=t[y].getLabelBounds().y2-a,En(b,0)&&this._shiftY(t,y,0,-b),b=t[v].getLabelBounds().y1-0,on(b,0)&&this._shiftY(t,v,t.length-1,-b),b=t[y].getLabelBounds().y2-a,En(b,0)){c.labelVisible=!1,this._restoreY(t);break}o.tangentConstraint&&!this._checkYRange(t)?(c.labelVisible=!1,this._restoreY(t)):(h=v,d=y)}}}_shiftY(t,e,i,n){const r=e<i?1:-1;let a=e;for(;a!==-1;){t[a].labelPosition.y+=n;const o=this._findNextVisibleIndex(t,a,i,r);if(o>=0&&o<t.length){const{y1:l,y2:h}=t[a].getLabelBounds(),{y1:d,y2:u}=t[o].getLabelBounds();if(r>0&&h<d||r<0&&l>u)return a}a=o}return i}_findNextVisibleIndex(t,e,i,n){const r=(i-e)*n;for(let a=1;a<=r;a++){const o=e+a*n;if(t[o].labelVisible)return o}return-1}_computePointB(t,e,i,n){const r=i;let a=0;n.forEach(h=>{h.attribute.outerRadius>a&&(a=h.attribute.outerRadius)});const o=this.computeLayoutOuterRadius(a,i.width,i.height),l=r.line.line1MinLength;if(r.layout.strategy==="none")t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const h=t.circleCenter,d=this.computeRadius(o,i.width,i.height),{labelPosition:u,quadrant:c}=t,p=e-Math.max(d+l,t.outerRadius),g=Math.sqrt(e**2-Math.abs(h.y-u.y)**2)-p;H(g)?t.pointB={x:h.x+g*(Ha(c)?-1:1),y:u.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const n=t.circleCenter,r={width:2*n.x,height:2*n.y};let a=0;i.forEach(x=>{x.attribute.outerRadius>a&&(a=x.attribute.outerRadius)});const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,{width:h,height:d}=r,u=this.computeRadius(o,e.width,e.height),c=this._computeLayoutRadius(d/2,e,i),p=Math.abs(t.center.x-h/2),g=t.center.y-d/2;let f,_,m;if(ns(h/2,p))f=0,_=1,m=-g;else if(ns(d/2,g))f=1,_=0,m=-p;else{const x=-1/(g/p);f=x,_=-1,m=g-x*p}const v=M8(f,_,m,l+u-c,0,c);if(v.length<2)return;let y,b;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ns(v[0].y,v[1].y)?En(t.middleAngle,-Math.PI)&&on(t.middleAngle,0)||En(t.middleAngle,Math.PI)&&on(t.middleAngle,2*Math.PI)?(y=0,b=v[1].y+d/2):(y=v[1].y+d/2,b=d):v[0].y<v[1].y?(y=0,b=v[1].y+d/2):(y=v[1].y+d/2,b=r.height):(y=Math.min(v[0].y,v[1].y)+d/2,b=Math.max(v[0].y,v[1].y)+d/2),t.labelYRange=[y,b]}_computeLayoutRadius(t,e,i){const n=e,r=n.layoutArcGap,a=n.line.line1MinLength;let o=0;i.forEach(u=>{u.attribute.outerRadius>o&&(o=u.attribute.outerRadius)});const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=this.computeRadius(l,e.width,e.height)+a,d=h-r;return Math.max((d**2+t**2)/(2*d),h)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,r=-1;for(let a=i-1;a>=0;a--)if(t[a].labelVisible){n=a;break}for(let a=i+1;a<t.length;a++)if(t[a].labelVisible){r=a;break}return{lastIndex:n,nextIndex:r}}_twoWayShift(t,e,i,n){const r=i.getLabelBounds().y1-e.getLabelBounds().y2;if(on(r,0)){const a=this._shiftY(t,n,t.length-1,-r);this._shiftY(t,a,0,r/2)}}_restoreY(t){for(const e of t)e.labelVisible&&(e.labelPosition.y=e.lastLabelY)}_checkYRange(t){for(const e of t){const{labelYRange:i,labelPosition:n}=e;if(e.labelVisible&&i&&(on(n.y,i[0])||En(n.y,i[1])))return!1}return!0}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i<t.length;i++){const n=t[i].getLabelBounds();P8(e,n)?t[i].labelVisible=!1:e=n}}_createLabelLine(t,e){var i,n,r,a,o,l,h;const{points:d,line:u={},visible:c,fill:p}=t.attribute,g=t.attribute.points?pt.line({visible:(r=(i=u.visible&&c)!==null&&i!==void 0?i:(n=t.attribute)===null||n===void 0?void 0:n.visible)===null||r===void 0||r,stroke:(o=(a=u.style)===null||a===void 0?void 0:a.stroke)!==null&&o!==void 0?o:p,lineWidth:(h=(l=u.style)===null||l===void 0?void 0:l.lineWidth)!==null&&h!==void 0?h:1,points:d,curveType:u.smooth?"basis":null}):void 0;return g&&this._setStatesOfLabelLine(g),g}computeRadius(t,e,i,n){return this.computeLayoutRadius(e||0,i||0)*t*(C(n)?1:n)}computeLayoutRadius(t,e){return Math.min(t/2,e/2)}_canPlaceInside(t,e){return this.attribute.position==="inside"}computeLayoutOuterRadius(t,e,i){return t/(Math.min(e,i)/2)}computeDatumRadius(t,e,i){const n=this.computeLayoutOuterRadius(i,t,e);return this.computeLayoutRadius(t||0,e||0)*n}}Q_.defaultAttributes={coverEnable:!1,spaceWidth:5,layoutArcGap:6,textStyle:{visible:!0,fontSize:14,fontWeight:"normal",fillOpacity:1,textAlign:"center",textBaseline:"middle"},position:"outside",offset:0,line:{visible:!0,line1MinLength:20,line2MinLength:10},layout:{align:"arc",strategy:"priority",tangentConstraint:!0},pickable:!1};class tm extends Kn{constructor(t){super(at({},tm.defaultAttributes,t)),this.name="line-label"}getGraphicBounds(t,e={},i="end"){var n;if(t.type!=="area")return super.getGraphicBounds(t,e);const r=((n=t==null?void 0:t.attribute)===null||n===void 0?void 0:n.points)||[e],a=i==="start"?0:r.length-1;return{x1:r[a].x,x2:r[a].x,y1:r[a].y,y2:r[a].y}}labeling(t,e,i="end",n=0){return rO(t,e,i,n)}}tm.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"end",offset:6,pickable:!1};class em extends Kn{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},em.defaultAttributes,t)),this.name="line-data-label"}labeling(t,e,i="top",n=0){return nO(t,e,i,n)}}em.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const L8={rect:mu,symbol:J_,arc:Q_,line:aO,area:tm,"line-data":em};class im extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},im.defaultAttributes,t)),this.name="data-label"}render(){var t;const{dataLabels:e,size:i}=this.attribute;if(!e||e.length===0)return;const{width:n=0,height:r=0}=i||{};if(!n||!r||!H(r*n))return;this._componentMap||(this._componentMap=new Map);const a=sO(n,r),o=a.bitmap(),l=new Map,h=this._componentMap;for(let d=0;d<e.length;d++){const u=e[d],c=L8[u.type]||Kn;if(c){const{baseMarkGroupName:p,type:g}=u,f=(t=u.id)!==null&&t!==void 0?t:`${p}-${g}-${d}`;let _=this._componentMap.get(f);_?(_.setBitmapTool(a),_.setBitmap(o),_.setAttributes(u),l.set(f,_)):(_=new c(u),_.setBitmap(o),_.setBitmapTool(a),this.add(_),l.set(f,_))}}h.forEach((d,u)=>{l.get(u)||this.removeChild(d)}),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach(t=>{t.disableAnimation()})}enableAnimation(){this._componentMap.forEach(t=>{t.enableAnimation()})}}im.defaultAttributes={pickable:!1};function Lx(){He(),Ra(),U_(),An()}Lx();class Eh extends ri{getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super(e!=null&&e.skipDefault?t:at({},Eh.defaultAttributes,t)),this.name="segment"}render(){this.removeAllChild(),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:n,visible:r=!0,multiSegment:a,mainSegmentIndex:o}=this.attribute;if(!r)return;this._computeLineAngle();const l=this._renderSymbol(t,"start"),h=this._renderSymbol(e,"end");if(this.startSymbol=l,this.endSymbol=h,a){const d=[...this.attribute.points];if(H(o))d[o]=this._clipPoints(d[o]);else{const u=this._clipPoints(t0(d));d[0][0]=u[0],d[d.length-1][d[d.length-1].length-1]=u[u.length-1]}d.forEach((u,c)=>{var p,g;const f=pt.line(Object.assign(Object.assign({points:u},U(i)?(p=i[c])!==null&&p!==void 0?p:i[i.length-1]:i),{fill:!1}));f.name=`${this.name}-line`,f.id=this._getNodeId("line"+c),ft(n==null?void 0:n.line)||(f.states=U(n.line)?(g=n.line[c])!==null&&g!==void 0?g:n.line[n.line.length-1]:n.line),this.add(f)})}else{const d=pt.polygon(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));d.name=`${this.name}-line`,d.id=this._getNodeId("line"),ft(n==null?void 0:n.line)||(d.states=[].concat(n.line)[0]),this.add(d)}}_renderSymbol(t,e){const i=this._getMainSegmentPoints();if(!i.length)return;const{autoRotate:n=!0}=t;let r;if(t&&t.visible){const a=this._startAngle,o=this._endAngle,{state:l}=this.attribute,h=i[0],d=i[i.length-1],{refX:u=0,refY:c=0,refAngle:p=0,style:g,symbolType:f,size:_=12}=t;let m,v;e==="start"?(m={x:h.x+(H(a)?u*Math.cos(a)+c*Math.cos(a-Math.PI/2):0),y:h.y+(H(a)?u*Math.sin(a)+c*Math.sin(a-Math.PI/2):0)},v=a+Math.PI/2):(m={x:d.x+(H(o)?u*Math.cos(o)+c*Math.cos(o-Math.PI/2):0),y:d.y+(H(o)?u*Math.sin(o)+c*Math.sin(o-Math.PI/2):0)},v=o+Math.PI/2),r=pt.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:f,size:_,angle:n?v+p:0,strokeBoundsBuffer:0}),g)),r.name=`${this.name}-${e}-symbol`,r.id=this._getNodeId(`${e}-symbol`),ft(l==null?void 0:l.symbol)||(r.states=l.symbol),this.add(r)}return r}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let n;return n=e?H(i)?t[i]:t0(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let n=t;if(e.visible){const r=e.clip?e.size||10:0;n=[{x:t[0].x-r/2*(Math.cos(this._startAngle)||0),y:t[0].y-r/2*(Math.sin(this._startAngle)||0)},...n.slice(1)]}if(i.visible){const r=i.clip?i.size||10:0,a={x:t[t.length-1].x-r/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-r/2*(Math.sin(this._endAngle)||0)};n=[...n.slice(0,n.length-1),a]}return n}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],n=t[t.length-2],r=t[t.length-1],a=[e.x-i.x,e.y-i.y],o=Math.atan2(a[1],a[0]),l=[r.x-n.x,r.y-n.y],h=Math.atan2(l[1],l[0]);this._startAngle=o,this._endAngle=h}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Eh.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,autoRotate:!0,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}};var Gi;(function(s){s.innerView="inner-view",s.axisContainer="axis-container",s.labelContainer="axis-label-container",s.tickContainer="axis-tick-container",s.tick="axis-tick",s.subTick="axis-sub-tick",s.label="axis-label",s.title="axis-title",s.gridContainer="axis-grid-container",s.grid="axis-grid",s.gridRegion="axis-grid-region",s.line="axis-line",s.background="axis-background",s.axisLabelBackground="axis-label-background"})(Gi||(Gi={}));var il;(function(s){s.selected="selected",s.selectedReverse="selected_reverse",s.hover="hover",s.hoverReverse="hover_reverse"})(il||(il={}));const Dn={[il.selectedReverse]:{},[il.selected]:{},[il.hover]:{},[il.hoverReverse]:{}},Mf={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}};class lO extends ri{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{const e=t.target;e!==this._lastHover&&e.name&&!ft(e.states)&&(e.addState(je.hover,!0),fn(this.axisContainer,i=>{i!==e&&i.name&&!ft(i.states)&&i.addState(je.hoverReverse,!0)}),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(fn(this.axisContainer,e=>{e.name&&!ft(e.states)&&(e.removeState(je.hoverReverse),e.removeState(je.hover))}),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(je.selected))return this._lastSelect=null,void fn(this.axisContainer,i=>{i.name&&!ft(i.states)&&(i.removeState(je.selectedReverse),i.removeState(je.selected))});e.name&&!ft(e.states)&&(e.addState(je.selected,!0),fn(this.axisContainer,i=>{i!==e&&i.name&&!ft(i.states)&&i.addState(je.selectedReverse,!0)}),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=hi(this.attribute);at(this.attribute,t);const i=pt.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=pt.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:r,items:a}=this.attribute,o=pt.group({x:0,y:0,zIndex:1});if(o.name=Gi.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,t.add(o),r&&r.visible&&this.renderLine(o),a&&a.length&&(this.data=this._transformItems(a[0]),n&&n.visible&&this.renderTicks(o),i&&i.visible)){const l=pt.group({x:0,y:0,pickable:!1});l.name=Gi.labelContainer,l.id=this._getNodeId("label-container"),this.axisLabelsContainer=l,o.add(l),a.forEach((h,d)=>{const u=this.renderLabels(l,h,d),c=u.getChildren();this.beforeLabelsOverlap(c,h,u,d,a.length),this.handleLabelsOverlap(c,h,u,d,a.length),this.afterLabelsOverlap(c,h,u,d,a.length);let p=0,g=0,f="center",_="middle";c.forEach(m=>{var v;const y=m.attribute,b=(v=y.angle)!==null&&v!==void 0?v:0,x=m.AABBBounds;let S=x.width(),A=x.height();b&&(S=Math.abs(S*Math.cos(b)),A=Math.abs(A*Math.sin(b))),p=Math.max(p,S),g=Math.max(g,A),f=y.textAlign,_=y.textBaseline}),this.axisLabelLayerSize[d]={width:p,height:g,textAlign:f,textBaseline:_}})}e&&e.visible&&this.renderTitle(o)}renderTicks(t){const e=this.getTickLineItems(),i=pt.group({x:0,y:0,pickable:!1});i.name=Gi.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach((r,a)=>{var o;const l=pt.line(Object.assign({},this._getTickLineAttribute("tick",r,a,e)));if(l.name=Gi.tick,l.id=this._getNodeId(r.id),ft((o=this.attribute.tick)===null||o===void 0?void 0:o.state))l.states=Ro;else{const h=this.data[a],d=at({},Ro,this.attribute.tick.state);Object.keys(d).forEach(u=>{q(d[u])&&(d[u]=d[u](h.rawValue,a,h,this.data))}),l.states=d}i.add(l)}),this.tickLineItems=e;const{subTick:n}=this.attribute;if(n&&n.visible){const r=this.getSubTickLineItems();r.length&&r.forEach((a,o)=>{const l=pt.line(Object.assign({},this._getTickLineAttribute("subTick",a,o,e)));if(l.name=Gi.subTick,l.id=this._getNodeId(`${o}`),ft(n.state))l.states=Ro;else{const h=at({},Ro,n.state);Object.keys(h).forEach(d=>{q(h[d])&&(h[d]=h[d](a.value,o,a,e))}),l.states=h}i.add(l)}),this.subTickLineItems=r}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&q(n)&&(e=n(e,i));const r=this._transformItems(e),a=pt.group({x:0,y:0,pickable:!1});return a.name=`${Gi.labelContainer}-layer-${i}`,a.id=this._getNodeId(`label-container-layer-${i}`),t.add(a),r.forEach((o,l)=>{var h,d,u;const c=this._getLabelAttribute(o,l,r,i);let p;if(c.type==="rich"?(c.textConfig=c.text,c.width=(h=c.width)!==null&&h!==void 0?h:0,c.height=(d=c.height)!==null&&d!==void 0?d:0,p=pt.richtext(c)):c.type==="html"?(c.textConfig=[],c.html=Object.assign(Object.assign({dom:c.text},Sr),c),p=pt.richtext(c)):p=pt.text(c),p.name=Gi.label,p.id=this._getNodeId(`layer${i}-label-${o.id}`),ft((u=this.attribute.label)===null||u===void 0?void 0:u.state))p.states=Ro;else{const g=at({},Ro,this.attribute.label.state);Object.keys(g).forEach(f=>{q(g[f])&&(g[f]=g[f](o,l,r,i))}),p.states=g}a.add(p)}),a}renderTitle(t){const e=this.getTitleAttribute(),i=new kn(Object.assign({},e));i.name=Gi.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return ns(t[0],0)?ns(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:r=!1,length:a,dataFilter:o}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(o&&q(o)?o(e):e).forEach(h=>{let d=h.point,u=h.value;if(!n){const p=h.value-l/2;if(this.isInValidValue(p))return;d=this.getTickCoord(p),u=p}const c=this.getVerticalCoord(d,a,r);if(this.mode==="3d"){const p=this.getVerticalVector(a,r,d);let g=0,f=0;Xt(p[0])>Xt(p[1])?g=ne/2*(c.x>d.x?1:-1):f=ne/2*(c.y>d.y?-1:1),i.push({start:d,end:c,value:u,id:`tick-${h.id}`,anchor:[d.x,d.y],alpha:g,beta:f})}else i.push({start:d,end:c,value:u,id:`tick-${h.id}`})}),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:r=2}=t,a=this.tickLineItems,o=a.length;if(o>=2)for(let l=0;l<o-1;l++){const h=a[l],d=a[l+1];for(let u=0;u<i;u++){const c=(u+1)/(i+1),p=(1-c)*h.value+c*d.value,g=this.getTickCoord(p),f=this.getVerticalCoord(g,r,n);e.push({start:g,end:f,value:p,id:`sub-tick-${p}`})}}return e}_getTickLineAttribute(t,e,i,n){let r=Et(this.attribute,`${t}.style`);const a=this.data[i];r=q(r)?at({},Et(Mf,`${t}.style`),t==="tick"?r(a.rawValue,i,a,this.data):r(e.value,i,e,n)):r;const{start:o,end:l,anchor:h,alpha:d,beta:u}=e;return Object.assign({points:[o,l],anchor:h,alpha:d,beta:u},r)}_getLabelAttribute(t,e,i,n){var r,a;const{space:o=4,inside:l=!1,formatMethod:h,type:d="text",text:u}=this.attribute.label;let c=o,p=0;!((r=this.attribute.tick)===null||r===void 0)&&r.visible&&this.attribute.tick.inside===l&&(p=this.attribute.tick.length||4),!((a=this.attribute.subTick)===null||a===void 0)&&a.visible&&this.attribute.subTick.inside===l&&(p=Math.max(p,this.attribute.subTick.length||2)),c+=p;const g=this.getRelativeVector(t.point);n>0&&(g[1]===0?c+=(this.axisLabelLayerSize[n-1].height+Et(this.attribute,"label.space",4))*n:c+=(this.axisLabelLayerSize[n-1].width+Et(this.attribute,"label.space",4))*n);const f=this.getVerticalCoord(t.point,c,l),_=this.getVerticalVector(c||1,l,f),m=h?h(`${t.label}`,t,e,i,n):t.label;let{style:v}=this.attribute.label;v=q(v)?at({},Mf.label.style,v(t,e,i,n)):v;const y=this.getLabelAlign(_,l,v.angle);return v=at(y,v),q(v.text)&&(v.text=v.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,_,m,v)),{text:u??m,lineHeight:v==null?void 0:v.fontSize,type:d}),v)}getLabelPosition(t,e,i,n){return t}_transformItems(t){const e=[];return t.forEach(i=>{var n;e.push(Object.assign(Object.assign({},i),{point:this.getTickCoord(i.value),id:(n=i.id)!==null&&n!==void 0?n:i.label}))}),e}}function B8(s,t,e,i,n){return{x:(s-i)*Math.cos(e)+(t-n)*Math.sin(e)+i,y:(s-i)*Math.sin(e)+(n-t)*Math.cos(e)+n}}function I8(s){const t=s.AABBBounds;return{x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,centerX:s.attribute.x,centerY:s.attribute.y,angle:s.attribute.angle}}function hO(s){s.forEach(t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=I8(t),i=B8(e.centerX,e.centerY,e.angle,t.attribute.x,t.attribute.y),n=i.x-e.centerX,r=i.y-e.centerY;e.x1+=n,e.x2+=n,e.y1+=r,e.y2+=r,e.centerX+=n,e.centerY+=r,t.rotatedBounds=e})}function F8(s,t){return Kd(s.AABBBounds,t.AABBBounds,!1)&&(!s.rotatedBounds||!t.rotatedBounds||dF(s.rotatedBounds,t.rotatedBounds,!0))}const vT={parity:function(s){return s.filter((t,e)=>e%2?t.setAttribute("opacity",0):1)},greedy:function(s,t){let e;return s.filter((i,n)=>n&&Bx(e,i,t)?i.setAttribute("opacity",0):(e=i,1))}};function Bx(s,t,e){const i=s.AABBBounds,n=t.AABBBounds;return e>Math.max(n.x1-i.x2,i.x1-n.x2,n.y1-i.y2,i.y1-n.y2)&&(!s.rotatedBounds||!t.rotatedBounds||e>Math.max(t.rotatedBounds.x1-s.rotatedBounds.x2,s.rotatedBounds.x1-t.rotatedBounds.x2,t.rotatedBounds.y1-s.rotatedBounds.y2,s.rotatedBounds.y1-t.rotatedBounds.y2))}function yT(s,t){for(let e,i=1,n=s.length,r=s[0];i<n;r=e,++i)if(Bx(r,e=s[i],t))return!0}function j8(s){const t=s.AABBBounds;return t.width()>1&&t.height()>1}function z8(s){return s.forEach(t=>t.setAttribute("opacity",1)),s}function H8(s,t){if(ft(s))return;const e=s.filter(j8);if(ft(e))return;let i;i=z8(e),hO(i);const{method:n="parity",separation:r=0}=t,a=q(n)?n:vT[n]||vT.parity;if(i.length>=3&&yT(i,r)){do i=a(i,r);while(i.length>=3&&yT(i,r));if(i.length<3||t.lastVisible){const o=la(e);if(!o.attribute.opacity){const l=i.length;if(l>1){o.setAttribute("opacity",1);for(let h=l-1;h>=0&&Bx(i[h],o,r);h--)i[h].setAttribute("opacity",0)}}}}e.forEach(o=>{o.setAttribute("visible",!!o.attribute.opacity)})}function G8(s,t){if(ft(s))return;const{orient:e,labelRotateAngle:i=[0,45,90]}=t;if(i.length===0||s.some(a=>!!a.attribute.angle))return;let n=0,r=0;for(i&&i.length>0&&(r=i.length);n<r;){const a=i[n++];if(s.forEach(o=>{o.attribute.angle=le(a)}),N8(e,s),!W8(s))break}}function W8(s){for(let t=1;t<s.length;t++)if(F8(s[t-1],s[t]))return!0;return!1}function N8(s,t){s!=="bottom"&&s!=="top"||U8(s,t),s!=="left"&&s!=="right"||V8(s,t),hO(t)}function sm(s=0){if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;return s}function V8(s,t){t.forEach((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},uO(s,e.attribute.angle)),{angle:sm(e.attribute.angle)}))})}function U8(s,t){t.forEach(e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},dO(s,e.attribute.angle)),{angle:sm(e.attribute.angle)}))})}function dO(s,t=0){let e=["center","left","left","left","center","right","right","right","left"],i=["top","top","middle","bottom","bottom","bottom","middle","top","top"];s==="top"&&(e=["center","right","right","right","center","left","left","left","right"],i=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(t=sm(t))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:e[r],textBaseline:i[r]}}function uO(s,t=0){let e=["right","right","center","left","center","left","center","right","right"],i=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];s==="right"&&(e=["left","right","right","right","left","left","left","left","right"],i=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(t=sm(t))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:e[r],textBaseline:i[r]}}function $8(s,t){const{limitLength:e,verticalLimitLength:i,ellipsis:n="...",orient:r}=t;!ft(s)&&H(e)&&s.forEach(a=>{if((r==="top"||r==="bottom")&&Math.floor(a.AABBBounds.height())<=e)return;const o=a.attribute.direction;if((r==="left"||r==="right")&&(o==="vertical"&&Math.floor(a.AABBBounds.height())<=i||o!=="vertical"&&Math.floor(a.AABBBounds.width())<=e))return;const l=a.attribute.angle;let h=l===0||C(l)?r==="top"||r==="bottom"?null:o==="vertical"?i:e:Math.abs(e/Math.sin(l));H(a.attribute.maxLineWidth)&&(h=H(h)?Math.min(a.attribute.maxLineWidth,h):a.attribute.maxLineWidth),a.setAttributes({maxLineWidth:h,ellipsis:a.attribute.ellipsis||n})})}function Y8(s,t,e,i,n){if(i==="right"||i==="left"){if(n==="left"){const r=i==="right"?0:-1;s.forEach(a=>{a.setAttributes({x:t+e*r,textAlign:"left"})})}else if(n==="right"){const r=i==="right"?1:0;s.forEach(a=>{a.setAttributes({x:t+e*r,textAlign:"right"})})}else if(n==="center"){const r=i==="right"?1:-1;s.forEach(a=>{a.setAttributes({x:t+.5*e*r,textAlign:"center"})})}}else if(i==="bottom"||i==="top"){if(n==="top"){const r=i==="bottom"?0:-1;s.forEach(a=>{a.setAttributes({y:t+e*r,textBaseline:"top"})})}else if(n==="bottom"){const r=i==="bottom"?1:0;s.forEach(a=>{a.setAttributes({y:t+e*r,textBaseline:"bottom"})})}else if(n==="middle"){const r=i==="bottom"?1:-1;s.forEach(a=>{a.setAttributes({y:t+.5*e*r,textBaseline:"middle"})})}}}class cO{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:n=1}=this.attribute,r=this.getRelativeVector(),a=q$(r),o=[a[1],-1*a[0]];return QR(o,t*(e?1:-1)*n)}}function pO(){He(),Ra(),Oa(),Da()}function X8(){pO(),Mr()}function K8(){pO(),H$()}function q8(){He(),uc()}function Z8(){He(),uc()}var bT=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};X8();class vu extends lO{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},vu.defaultAttributes,t),e)}_renderInner(t){var e;super._renderInner(t);const{panel:i}=this.attribute;if(i&&i.visible){const n=this.axisContainer,r=n.AABBBounds,a=pt.rect(Object.assign({x:r.x1,y:r.y1,width:r.width(),height:r.height()},i.style));a.name=Gi.background,a.id=this._getNodeId("background"),a.states=at({},Dn,(e=i.state)!==null&&e!==void 0?e:{}),n.insertBefore(a,n.firstChild)}}renderLine(t){const{start:e,end:i,line:n}=this.attribute,r=n,{startSymbol:a,endSymbol:o,style:l,breakRange:h,breakShape:d,breakShapeStyle:u,state:c}=r,p=bT(r,["startSymbol","endSymbol","style","breakRange","breakShape","breakShapeStyle","state"]),g=Object.assign({points:[e,i],startSymbol:a,endSymbol:o,lineStyle:l},p);ft(c)||(g.state={line:at({},Dn,c),symbol:at({},Dn,c)});const f=new Eh(g);f.name=Gi.line,f.id=this._getNodeId("line"),t.add(f)}getTitleAttribute(){var t,e,i;const n=this.attribute.title,{position:r="middle",space:a=4,textStyle:o={},autoRotate:l=!0,shape:h,background:d,state:u={}}=n,c=bT(n,["position","space","textStyle","autoRotate","shape","background","state"]);let p=.5;r==="start"?p=0:r==="end"&&(p=1);const{verticalFactor:g=1}=this.attribute,f=-1*g,_=this.getTickCoord(p),m=this.getRelativeVector();let v=0;if(!((t=this.attribute.label)===null||t===void 0)&&t.visible&&this.attribute.label.inside===!1){const M=+Et(this.attribute,"label.space",4);v+=M;const P=Object.keys(this.axisLabelLayerSize).length;if(m[1]===0){const O=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(O)?v+=O+(P-1)*M:v=0}else{if(m[0]===0){const B=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.width():0;isFinite(B)?v+=B+(P-1)*M:v=0}else Object.keys(this.axisLabelLayerSize).forEach((B,F)=>{v+=this.axisLabelLayerSize[B].width+(F>0?M:0)});const O=this.axisLabelLayerSize[0].textAlign,D=O==="start"||O==="left",R=O==="center",L=m[1]>0;v=f===1?L?D?v:R?v/2:M:D?M:R?v/2:v:L?D?M:R?v/2:v:D?v:R?v/2:M}}let y=0;!((e=this.attribute.tick)===null||e===void 0)&&e.visible&&this.attribute.tick.inside===!1&&(y=this.attribute.tick.length||4),!((i=this.attribute.subTick)===null||i===void 0)&&i.visible&&this.attribute.subTick.inside===!1&&(y=Math.max(y,this.attribute.subTick.length||2));const b=y+v+a,x=this.getVerticalCoord(_,b,!1),S=this.getVerticalVector(b,!1,{x:0,y:0});let A,k,{angle:w}=c;if(A=r==="start"?"start":r==="end"?"end":"center",C(w)&&l){w=Q$(m,[1,0],!0);const{verticalFactor:M=1}=this.attribute;k=-1*M===1?"bottom":"top"}else A=this.getTextAlign(S),k=this.getTextBaseline(S,!1);const T=Object.assign(Object.assign(Object.assign({},x),c),{textStyle:Object.assign({textAlign:A,textBaseline:k},o),state:{text:at({},Dn,u.text),shape:at({},Dn,u.shape),panel:at({},Dn,u.background)}});return T.angle=w,h&&h.visible&&(T.shape=Object.assign({visible:!0},h.style),h.space&&(T.space=h.space)),d&&d.visible&&(T.panel=Object.assign({visible:!0},d.style)),T}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,r=(e?1:-1)*n;return ns(t[1],0)?i=!ns(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":r===1?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(H(i)||t[0]===0&&t[1]===0){if(n==="top"||n==="bottom")return dO(n,i);if(n==="left"||n==="right")return uO(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,r){var a,o,l,h;const{flush:d=!1}=this.attribute.label||{};if(d&&t.length){const{orient:u,start:c,end:p}=this.attribute,g=u==="bottom"||u==="top",f=t[0],_=la(t),m=g?f.attribute.x>_.attribute.x:f.attribute.y<_.attribute.y;if(g){const v=m?_:f,y=m?f:_,b=c.x,x=p.x,S=v.AABBBounds.x1,A=y.AABBBounds.x2;S<b&&(v.attribute.angle?v.setAttributes({dx:((a=v.attribute.dx)!==null&&a!==void 0?a:0)+b-S}):v.setAttributes({x:b,textAlign:"left"})),A>x&&(y.attribute.angle?y.setAttributes({dx:((o=y.attribute.dx)!==null&&o!==void 0?o:0)+x-A}):y.setAttributes({x,textAlign:"right"}))}else{const v=m?_:f,y=m?f:_,b=v.AABBBounds.y2,x=y.AABBBounds.y1,S=c.y,A=p.y;x<S&&(y.attribute.angle?y.setAttributes({dy:((l=y.attribute.dy)!==null&&l!==void 0?l:0)+S-x}):y.setAttributes({y:S,textBaseline:"top"})),b>A&&(v.attribute.angle?v.setAttributes({dy:((h=v.attribute.dy)!==null&&h!==void 0?h:0)+A-b}):v.setAttributes({y:A,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,n,r){if(ft(t))return;const{verticalLimitSize:a,label:o,orient:l}=this.attribute,h=this._getAxisLabelLimitLength(a,r),{layoutFunc:d,autoRotate:u,autoRotateAngle:c,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:_,autoHideSeparation:m,lastVisible:v}=o;if(q(d))d(t,e,n,this);else{if(u&&G8(t,{labelRotateAngle:c,orient:l}),p&&H(h)&&h>0){const y=l!=="left"&&l!=="right"||!t.some(b=>b.attribute.direction==="vertical")?1/0:Math.abs(this.attribute.start.y-this.attribute.end.y)/t.length;$8(t,{limitLength:h,verticalLimitLength:y,ellipsis:g,orient:l})}f&&H8(t,{method:_,separation:m,lastVisible:v})}}afterLabelsOverlap(t,e,i,n,r){const{verticalLimitSize:a,orient:o}=this.attribute,l=o==="bottom"||o==="top",h=i.AABBBounds;let d=l?h.height():h.width();const{verticalMinSize:u}=this.attribute;if(H(u)&&(!H(a)||u<=a)){const c=this._getAxisLabelLimitLength(u,r);let p,g;d=Math.max(d,c),o==="left"?(p=h.x2-d,g=h.y1):o==="right"?(p=h.x1,g=h.y1):o==="top"?(p=h.x1,g=h.y2-d):o==="bottom"&&(p=h.x1,g=h.y1);const f=pt.rect({x:p,y:g,width:l?h.width():d,height:l?d:h.height(),pickable:!1});f.name=Gi.axisLabelBackground,f.id=this._getNodeId("axis-label-background"),i.insertBefore(f,i.firstChild)}if(E(this.attribute.label.containerAlign)){let c;o==="left"?c=h.x2:o==="right"?c=h.x1:o==="top"?c=h.y2:o==="bottom"&&(c=h.y1),Y8(t,c,d,o,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,r,a;const{label:o,title:l,line:h,tick:d}=this.attribute,u=(i=o.space)!==null&&i!==void 0?i:4;let c=t,p=0,g=0;const f=h&&h.visible?(n=h.style.lineWidth)!==null&&n!==void 0?n:1:0,_=d&&d.visible?(r=d.length)!==null&&r!==void 0?r:4:0;if(l&&l.visible&&typeof l.text=="string"){p=$_(l.text,l.textStyle,(a=this.stage)===null||a===void 0?void 0:a.getTheme().text.fontFamily).height;const m=as(l.padding);g=l.space+m[0]+m[2]}return c&&(c=(c-u-g-p-f-_)/e),c}}vu.defaultAttributes=Mf,ci(vu,cO);class gO{isInValidValue(t){const{startAngle:e=hh,endAngle:i=dh}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=hh,endAngle:i=dh,center:n,radius:r,inside:a=!1,innerRadius:o=0}=this.attribute;return ln(n,a&&o>0?o:r,e+(i-e)*t)}getVerticalVector(t,e=!1,i){const{inside:n=!1}=this.attribute,{center:r}=this.attribute,a=[i.x-r.x,i.y-r.y];return QR(a,(e?-1:1)*(n?-1:1)*t/K$(a))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}const xT=(s=0)=>{if(s<0)for(;s<0;)s+=ni;else if(s>0)for(;s>ni;)s-=ni;return s};function hp(s,t,e){return!on(s,t,0,1e-6)&&!En(s,e,0,1e-6)}function J8(s,t,e,i){const n=lc(Object.assign({text:e},i)),r=n.width(),a=n.height(),o=xT(Math.atan2(t[1],t[0]))-Math.PI,l=3*Math.PI/4,h=Math.PI/4,d=Math.PI/2,u=s.x;let c=0;c=hp(o,-l,-h)?((o+l)/d-.5)*r:hp(o,h,l)?(.5-(o-h)/d)*r:Math.cos(o)>=0?.5*r:.5*-r;const p=u-c,g=s.y;let f=0;return f=hp(o,-l,-h)?.5*-a:hp(o,h,l)?.5*a:Math.cos(o)>=0?(.5-(h-o)/d)*a:(.5-xT(o-l)/d)*a,{x:p,y:g-f}}var Q8=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};K8();class yu extends lO{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},yu.defaultAttributes,t))}renderLine(t){const{startAngle:e=hh,endAngle:i=dh,radius:n,center:r,innerRadius:a=0,line:o={},inside:l=!1}=this.attribute;let h=n,d=a;l&&a>0&&(h=a,d=0);const u=Object.assign(Object.assign(Object.assign({},r),{startAngle:e,endAngle:i,radius:h,innerRadius:d}),o.style),c=pt.circle(u);c.name=Gi.line,c.id=this._getNodeId("line"),ft(o.state)||(c.states=at({},Dn,o.state)),t.add(c)}getTitleAttribute(){var t,e,i;const{center:n,radius:r,innerRadius:a=0}=this.attribute,o=this.attribute.title,{space:l=4,textStyle:h={},shape:d,background:u,state:c={}}=o,p=Q8(o,["space","textStyle","shape","background","state"]);let g=n,f=0;!((t=this.attribute.label)===null||t===void 0)&&t.visible&&this.attribute.label.inside===!1&&(f=Et(this.attribute.label,"style.fontSize",12)+Et(this.attribute.label,"space",4));let _=0;!((e=this.attribute.tick)===null||e===void 0)&&e.visible&&this.attribute.tick.inside===!1&&(_=this.attribute.tick.length||4),!((i=this.attribute.subTick)===null||i===void 0)&&i.visible&&this.attribute.subTick.inside===!1&&(_=Math.max(_,this.attribute.subTick.length||2));const m=r+_+f+l;let v="middle",{position:y}=this.attribute.title;C(y)&&(y=a===0?"end":"middle"),y==="start"?(v="bottom",g={x:n.x,y:n.y-m}):y==="end"&&(v="top",g={x:n.x,y:n.y+m});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:v,textAlign:"center"},h),state:{text:at({},Dn,c.text),shape:at({},Dn,c.shape),panel:at({},Dn,c.background)}}),{angle:x}=p;return b.angle=x,d&&d.visible&&(b.shape=Object.assign({visible:!0},d.style),d.space&&(b.space=d.space)),u&&u.visible&&(b.panel=Object.assign({visible:!0},u.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:r=4,inside:a=!1,length:o=2}=i,l=this.tickLineItems,h=l.length;if(h>=2){const d=this.data[1].value-this.data[0].value,u=(e=(t=this.attribute)===null||t===void 0?void 0:t.tick)===null||e===void 0?void 0:e.alignWithLabel;for(let c=0;c<h;c++){const p=l[c],g=l[c+1];for(let f=0;f<r;f++){const _=(f+1)/(r+1),m=(1-_)*p.value+_*(g?g.value:u?1:p.value+d),v=this.getTickCoord(m),y=this.getVerticalCoord(v,o,a);n.push({start:v,end:y,value:m})}}}return n}getTextBaseline(t){let e="middle";return ns(t[1],0)?e="middle":t[1]>0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,r){}handleLabelsOverlap(t,e,i,n,r){}afterLabelsOverlap(t,e,i,n,r){}getLabelAlign(t,e,i){return{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,n){return J8(t,e,i,n)}}yu.defaultAttributes=Mf,ci(yu,gO);function t6(s){const t={};return fn(s,e=>{e.type!=="group"&&e.id&&(t[e.id]=e)}),t}class e6 extends os{constructor(){super(...arguments),this.mode=eh.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=t6(e),this._newElementAttrMap={},fn(t,i=>{var n,r,a,o,l,h;if(i.type!=="group"&&i.id){const d=this._oldElementMap[i.id];if(d){if(!_e(i.attribute,d.attribute)){const u=hi(i.attribute);this._newElementAttrMap[i.id]={state:"update",node:i,attrs:Object.assign(Object.assign({},u),{opacity:(n=u.opacity)!==null&&n!==void 0?n:1,fillOpacity:(r=u.fillOpacity)!==null&&r!==void 0?r:1,strokeOpacity:(a=u.strokeOpacity)!==null&&a!==void 0?a:1})},i.setAttributes(d.attribute)}}else{const u={opacity:(o=i.attribute.opacity)!==null&&o!==void 0?o:1,fillOpacity:(l=i.attribute.fillOpacity)!==null&&l!==void 0?l:1,strokeOpacity:(h=i.attribute.strokeOpacity)!==null&&h!==void 0?h:1};this._newElementAttrMap[i.id]={state:"enter",node:i,attrs:u},i.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}}))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach(i=>{var n;const{node:r,attrs:a,state:o}=this._newElementAttrMap[i];if(o==="enter"){const{enter:l={}}=(n=this.params)!==null&&n!==void 0?n:{};t=H(l.duration)?l.duration:t,e=l.easing?l.easing:e}r.type==="path"?r.animate({interpolate:(l,h,d,u,c)=>l==="path"&&(c.path=J2(d,u)(h),!0)}).to(a,t,e):r.animate().to(a,t,e)})}onUpdate(t,e,i){}}class i6 extends os{constructor(t,e,i,n){super(null,null,i,n)}getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}function sl(s,t){let e="";return s.length===0||(s.forEach((i,n)=>{n===0?e=`M${i.x},${i.y}`:e+=`L${i.x},${i.y}`}),t&&(e+="Z")),e}function Zy(s,t,e,i){let n="";if(!s||t.length===0)return n;const r=t[0],a=Ee.distancePP(s,r),o=e?0:1;return i?n+=`M${s.x},${s.y-a}A${a},${a},0,0,${o},${s.x},${s.y+a}A${a},${a},0,0,${o},${s.x},${s.y-a}Z`:t.forEach((l,h)=>{h===0?n=`M${l.x},${l.y}`:n+=`A${a},${a},0,0,${o},${l.x},${l.y}`}),n}function s6(s,t,e){const{type:i,closed:n}=e,r=t.slice(0).reverse();let a="",o="";if(i==="line"&&e.smoothLink&&e.center){const l=s[0],h=r[0],d=e.center;a=sl(s,!!n),o=sl(r,!!n);const u=Ee.distancePP(h,d),c=Ee.distancePP(l,d);a+=`A${u},${u},0,0,1,${h.x},${h.y}L${h.x},${h.y}`,o+=`A${c},${c},0,0,0,${l.x},${l.y}`}else if(i==="circle"){const{center:l}=e;a=Zy(l,s,!1,!!n),o=Zy(l,r,!0,!!n)}else i!=="line"&&i!=="polygon"||(a=sl(s,!!n),o=sl(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class wa extends ri{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=pt.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&e!==!1&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}_transformItems(t){const e=[];return t.forEach(i=>{var n;e.push(Object.assign(Object.assign({},i),{point:this.getTickCoord(i.value),id:(n=i.id)!==null&&n!==void 0?n:i.label}))}),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=at({},this.attribute,this.getGridAttribute(t)),{type:n,items:r,style:a,closed:o,alternateColor:l,depth:h=0}=i,d=t?`${Gi.grid}-sub`:`${Gi.grid}`;if(r.forEach((u,c)=>{const{id:p,points:g}=u;let f="";if(n==="line"||n==="polygon")f=sl(g,!!o);else if(n==="circle"){const{center:m}=this.attribute;f=Zy(m,g,!1,!!o)}const _=pt.path(Object.assign({path:f,z:h},q(a)?at({},this.skipDefault?null:wa.defaultAttributes.style,a(u,c)):a));_.name=`${d}-line`,_.id=this._getNodeId(`${d}-path-${p}`),e.add(_)}),h&&n==="line"&&r.forEach((u,c)=>{const{id:p,points:g}=u,f=[];f.push(g[0]);const _=g[1].x-g[0].x,m=g[1].y-g[0].y,v=Math.sqrt(_*_+m*m),y=h/v;f.push({x:g[0].x+_*y,y:g[0].y+m*y});const b=sl(f,!!o),x=Xt(f[0].x-f[1].x),S=Xt(f[0].y-f[1].y),A=pt.path(Object.assign({path:b,z:0,alpha:x>S?(g[1].x-g[0].x>0?-1:1)*ne/2:0,beta:x<S?-ne/2:0,anchor3d:x>S?[f[0].x,0]:[0,f[0].y]},q(a)?at({},this.skipDefault?null:wa.defaultAttributes.style,a(u,c)):a));A.name=`${d}-line`,A.id=this._getNodeId(`${d}-path-${p}`),e.add(A)}),r.length>1&&l){const u=U(l)?l:[l,"transparent"],c=p=>u[p%u.length];for(let p=0;p<r.length-1;p++){const[g,f]=[r[p].points,r[p+1].points],_=s6(g,f,i),m=pt.path({path:_,fill:c(p)});m.name=`${d}-region`,m.id=this._getNodeId(`${d}-region-${p}`),e.add(m)}}}_getNodeId(t){return`${this.id}-${t}`}}wa.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};function n6(s,t,e,i,n){const r=[],a=n-i;for(let o=0;o<t;o++){const l=i+o*a/t;r.push(ln(s,e,l))}return r}q8();class fO extends wa{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},wa.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if(t==="line"){const{length:n}=this.attribute;i=[e,this.getVerticalCoord(e,n,!0)]}else if(t==="circle"||t==="polygon"){const{center:n,sides:r=6,startAngle:a=hh,endAngle:o=dh}=this.attribute;i=n6(n,r,Ee.distancePP(n,e),a,o)}return i}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute;let n=1,r;this.data.length>=2&&(n=this.data[1].value-this.data[0].value);let a=[];if(t){r=at({},this.attribute,this.attribute.subGrid);const o=[],{count:l=4}=this.attribute.subGrid||{};if(this.data.length>=2){const h=[];this.data.forEach(d=>{let u=d.value;if(!i){const c=d.value-n/2;if(this.isInValidValue(c))return;u=c}h.push({value:u})});for(let d=0;d<h.length-1;d++){const u=h[d],c=h[d+1];o.push({id:`sub-${d}-0`,points:this._getGridPoint(e,this.getTickCoord(u.value)),datum:{}});for(let p=0;p<l;p++){const g=(p+1)/(l+1),f=(1-g)*u.value+g*c.value,_=this.getTickCoord(f);o.push({id:`sub-${d}-${p+1}`,points:this._getGridPoint(e,_),datum:{}})}d===h.length-2&&o.push({id:`sub-${d}-${l+1}`,points:this._getGridPoint(e,this.getTickCoord(c.value)),datum:{}})}a=o}}else{r=this.attribute;const o=[];this.data.forEach(l=>{let{point:h}=l;if(!i){const d=l.value-n/2;if(this.isInValidValue(d))return;h=this.getTickCoord(d)}o.push({id:l.label,datum:l,points:this._getGridPoint(e,h)})}),a=o}return Object.assign(Object.assign({},r),{items:a})}}ci(fO,cO);var r6=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};Z8();class _O extends wa{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},wa.defaultAttributes,t),e)}getGridAttribute(t){let e,i=[];const n=this.attribute,{radius:r,innerRadius:a=0,startAngle:o=hh,endAngle:l=dh,center:h,subGrid:d}=n,u=r6(n,["radius","innerRadius","startAngle","endAngle","center","subGrid"]),{alignWithLabel:c=!0}=u||{},p=r-a;let g=1;if(this.data.length>=2&&(g=this.data[1].value-this.data[0].value),t){e=at({},u,d);const f=[],{count:_=4}=d||{},m=this.data.length;if(m>=2){const v=[];this.data.forEach(y=>{let b=y.value;if(!c){const x=y.value-g/2;if(this.isInValidValue(x))return;b=x}v.push({value:b})});for(let y=0;y<m;y++){const b=v[y],x=v[y+1];f.push({id:`sub-${y}-0`,points:[this.getTickCoord(b.value),this.getVerticalCoord(this.getTickCoord(b.value),p,!0)],datum:{}});for(let S=0;S<_;S++){const A=(S+1)/(_+1),k=(1-A)*b.value+A*(x?x.value:c?1:b.value+g),w=this.getTickCoord(k),T=this.getVerticalCoord(w,p,!0);f.push({id:`sub-${y}-${S+1}`,points:[w,T],datum:{}})}}Math.abs(l-o)%(2*Math.PI)==0&&f.push(f[0]),i=f}}else{e=u;const f=[];let _;_=Math.abs(l-o)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,_.forEach(m=>{let{point:v}=m;if(!c){const b=m.value-g/2;if(this.isInValidValue(b))return;v=this.getTickCoord(b)}const y=this.getVerticalCoord(v,p,!0);f.push({id:m.id,points:[v,y],datum:m})}),i=f}return Object.assign(Object.assign({},e),{items:i,center:h,type:"line"})}}ci(_O,gO);const ST="M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z",a6={orient:"bottom",showDetail:"auto",brushSelect:!0,zoomLock:!1,minSpan:0,maxSpan:1,delayType:"throttle",delayTime:0,realTime:!0,backgroundStyle:{fill:"white",stroke:"#D1DBEE",lineWidth:1,cornerRadius:2},dragMaskStyle:{fill:"#B0C8F9",fillOpacity:.2},backgroundChartStyle:{area:{visible:!0,stroke:"#D1DBEE",lineWidth:1,fill:"#F6F8FC"},line:{visible:!0,stroke:"#D1DBEE",lineWidth:1}},selectedBackgroundStyle:{fill:"#B0C8F9",fillOpacity:.5},selectedBackgroundChartStyle:{area:{visible:!0,stroke:"#B0C8F9",lineWidth:1,fill:"#fbb934"},line:{visible:!0,stroke:"#fbb934",lineWidth:1}},middleHandlerStyle:{visible:!0,background:{size:8,style:{fill:"white",stroke:"#B0C8F9",cornerRadius:2}},icon:{size:6,fill:"white",stroke:"#B0C8F9",symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}},startHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:ST,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:ST,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},Or={horizontal:{angle:0,strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise",cursor:"ew-resize"},vertical:{angle:Math.PI/180*90,cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0}};var Qi;(function(s){s.startHandler="startHandler",s.endHandler="endHandler",s.middleHandler="middleHandler",s.background="background"})(Qi||(Qi={}));function o6(){Y_(),Mr(),An(),XR(),Ra()}var AT=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};const l6={debounce:Xn,throttle:Ea};o6();let mO=class vO extends ri{setPropsFromAttrs(){const{start:t,end:e,orient:i,previewData:n,previewPointsX:r,previewPointsY:a,previewPointsX1:o,previewPointsY1:l}=this.attribute;t&&(this.state.start=t),e&&(this.state.end=e);const{width:h,height:d}=this.getLayoutAttrFromConfig();this._spanCache=this.state.end-this.state.start,this._isHorizontal=i==="top"||i==="bottom",this._layoutCache.max=this._isHorizontal?h:d,this._layoutCache.attPos=this._isHorizontal?"x":"y",this._layoutCache.attSize=this._isHorizontal?"width":"height",n&&(this._previewData=n),q(r)&&(this._previewPointsX=r),q(a)&&(this._previewPointsY=a),q(o)&&(this._previewPointsX1=o),q(l)&&(this._previewPointsY1=l)}constructor(t,e){super(e!=null&&e.skipDefault?t:at({},vO.defaultAttributes,t)),this.name="dataZoom",this._previewData=[],this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",max:0},this.state={start:0,end:1},this._statePointToData=r=>r,this._onHandlerPointerDown=(r,a)=>{r.stopPropagation(),a==="start"?(this._activeTag=Qi.startHandler,this._activeItem=this._startHandlerMask):a==="end"?(this._activeTag=Qi.endHandler,this._activeItem=this._endHandlerMask):a==="middleRect"?(this._activeTag=Qi.middleHandler,this._activeItem=this._middleHandlerRect):a==="middleSymbol"?(this._activeTag=Qi.middleHandler,this._activeItem=this._middleHandlerSymbol):a==="background"&&(this._activeTag=Qi.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(r),this._activeCache.lastPos=this.eventPosToStagePos(r),Ht.env==="browser"&&(Ht.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Ht.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._onHandlerPointerMove=l6[this.attribute.delayType](r=>{r.stopPropagation();const{start:a,end:o,brushSelect:l,realTime:h=!0}=this.attribute,d=this.eventPosToStagePos(r),{attPos:u,max:c}=this._layoutCache,p=(d[u]-this._activeCache.lastPos[u])/c;let{start:g,end:f}=this.state;this._activeState&&(this._activeTag===Qi.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+p):this._activeTag===Qi.startHandler?g+p>f?(g=f,f=g+p,this._activeTag=Qi.endHandler):g+=p:this._activeTag===Qi.endHandler&&(f+p<g?(f=g,g=f+p,this._activeTag=Qi.startHandler):f+=p),this._activeCache.lastPos=d,l&&this.renderDragMask()),g=Math.min(Math.max(g,0),1),f=Math.min(Math.max(f,0),1),a===g&&o===f||(this.setStateAttr(g,f,!0),this._dispatchEvent("change",{start:g,end:f,tag:this._activeTag}))},this.attribute.delayTime);const{position:i,showDetail:n}=t;this._activeCache.startPos=i,this._activeCache.lastPos=i,this._showText=n!=="auto"&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,"start")),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,"end")),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,"middleSymbol")),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,"middleRect"));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,i)),e&&this._background&&this._background.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,"background")),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,"background")),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",n=>this._onHandlerPointerDown(n,i)),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),t==="auto"&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:n=!1,minSpan:r=0,maxSpan:a=1}=this.attribute,o=e-t;o!==this._spanCache&&(n||o<r||o>a)||(this._spanCache=o,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){var e,i;const{x:n,y:r}=Ht.mapToCanvasPoint(t);return{x:n-(((e=this.stage)===null||e===void 0?void 0:e.x)||0),y:r-(((i=this.stage)===null||i===void 0?void 0:i.y)||0)}}_onHandlerPointerUp(t){t.preventDefault();const{start:e,end:i,brushSelect:n,realTime:r=!0}=this.attribute;if(this._activeState&&this._activeTag===Qi.background){const a=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,a)}this._activeState=!1,n&&this.renderDragMask(),r&&e===this.state.start&&i===this.state.end||(this.setStateAttr(this.state.start,this.state.end,!0),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag})),Ht.env==="browser"&&(Ht.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Ht.removeEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:r}=this.attribute,a=t[i]-r[i],o=e[i]-r[i],l=Math.min(Math.max(Math.min(a,o)/n,0),1),h=Math.min(Math.max(Math.max(a,o)/n,0),1);Math.abs(l-h)<.01?this.moveZoomWithMiddle(l):this.setStateAttr(l,h,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;e!==0&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:di(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===Qi.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:di(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===Qi.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if(i==="start"){if(e.x1<t.x1)return!0}else if(e.x2>t.x2)return!0}else if(i==="start"){if(e.y1<t.y1)return!0}else if(e.y2>t.y2)return!0;return!1}setTextAttr(t,e){const{startTextStyle:i,endTextStyle:n}=this.attribute,{formatMethod:r}=i,a=AT(i,["formatMethod"]),{formatMethod:o}=n,l=AT(n,["formatMethod"]),{start:h,end:d}=this.state;this._startValue=this._statePointToData(h),this._endValue=this._statePointToData(d);const{position:u,width:c,height:p}=this.getLayoutAttrFromConfig(),g=r?r(this._startValue):this._startValue,f=o?o(this._endValue):this._endValue,_={x1:u.x,y1:u.y,x2:u.x+c,y2:u.y+p};let m,v,y,b;this._isHorizontal?(m={x:u.x+h*c,y:u.y+p/2},v={x:u.x+d*c,y:u.y+p/2},y={textAlign:this.isTextOverflow(_,t,"start")?"left":"right",textBaseline:"middle"},b={textAlign:this.isTextOverflow(_,e,"end")?"right":"left",textBaseline:"middle"}):(m={x:u.x+c/2,y:u.y+h*p},v={x:u.x+c/2,y:u.y+d*p},y={textAlign:"center",textBaseline:this.isTextOverflow(_,t,"start")?"top":"bottom"},b={textAlign:"center",textBaseline:this.isTextOverflow(_,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,at({},a,{text:g,x:m.x,y:m.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:y}),`data-zoom-start-text-${u}`),this._endText=this.maybeAddLabel(this._container,at({},l,{text:f,x:v.x,y:v.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:b}),`data-zoom-end-text-${u}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:n,y1:r,y2:a}=t,{dx:o=0,dy:l=0}=this.attribute.startTextStyle;if(new yi().set(i,r,n,a).intersects(e)){const h=this.attribute.orient==="bottom"||this.attribute.orient==="right"?-1:1;this._isHorizontal?this._startText.setAttribute("dy",l+h*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",o+h*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",l):this._startText.setAttribute("dx",o)}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:r,size:a,orient:o,middleHandlerStyle:l={},startHandlerStyle:h={},endHandlerStyle:d={}}=this.attribute,{width:u,height:c}=a,p=(e=(t=l.background)===null||t===void 0?void 0:t.size)!==null&&e!==void 0?e:10;let g,f,_;l.visible?this._isHorizontal?(g=u,f=c-p,_={x:r.x,y:r.y+p}):(g=u-p,f=c,_={x:r.x+(o==="left"?p:0),y:r.y}):(g=u,f=c,_=r);const m=(i=h.size)!==null&&i!==void 0?i:this._isHorizontal?f:g,v=(n=d.size)!==null&&n!==void 0?n:this._isHorizontal?f:g;return h.visible&&(this._isHorizontal?(g-=(m+v)/2,_={x:_.x+m/2,y:_.y}):(f-=(m+v)/2,_={x:_.x,y:_.y+m})),this._layoutAttrFromConfig={position:_,width:g,height:f},this._layoutAttrFromConfig}render(){var t,e,i,n,r,a,o,l,h,d,u,c,p,g,f,_,m,v;this._layoutAttrFromConfig=null;const{orient:y,backgroundStyle:b,backgroundChartStyle:x={},selectedBackgroundStyle:S={},selectedBackgroundChartStyle:A={},middleHandlerStyle:k={},startHandlerStyle:w={},endHandlerStyle:T={},brushSelect:M,zoomLock:P}=this.attribute,{start:O,end:D}=this.state,{position:R,width:L,height:B}=this.getLayoutAttrFromConfig(),F=(t=w.triggerMinSize)!==null&&t!==void 0?t:40,z=(e=T.triggerMinSize)!==null&&e!==void 0?e:40,N=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=N,this._background=N.createOrUpdateChild("background",Object.assign(Object.assign({x:R.x,y:R.y,width:L,height:B,cursor:M?"crosshair":"auto"},b),{pickable:!P}),"rect"),!((i=x.line)===null||i===void 0)&&i.visible&&this.setPreviewAttributes("line",N),!((n=x.area)===null||n===void 0)&&n.visible&&this.setPreviewAttributes("area",N),M&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=N.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:R.x+O*L,y:R.y,width:(D-O)*L,height:B,cursor:M?"crosshair":"move"},S),{pickable:!P}),"rect"):this._selectedBackground=N.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:R.x,y:R.y+O*B,width:L,height:(D-O)*B,cursor:M?"crosshair":"move"},S),{pickable:!P}),"rect"),!((r=A.line)===null||r===void 0)&&r.visible&&this.setSelectedPreviewAttributes("line",N),!((a=A.area)===null||a===void 0)&&a.visible&&this.setSelectedPreviewAttributes("area",N),this._isHorizontal){if(k.visible){const et=((o=k.background)===null||o===void 0?void 0:o.size)||10;this._middleHandlerRect=N.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:R.x+O*L,y:R.y-et,width:(D-O)*L,height:et},(l=k.background)===null||l===void 0?void 0:l.style),{pickable:!P}),"rect"),this._middleHandlerSymbol=N.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:R.x+(O+D)/2*L,y:R.y-et/2,strokeBoundsBuffer:0,angle:0,symbolType:(d=(h=k.icon)===null||h===void 0?void 0:h.symbolType)!==null&&d!==void 0?d:"square"},k.icon),{pickable:!P}),"symbol")}this._startHandler=N.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:R.x+O*L,y:R.y+B/2,size:B,symbolType:(u=w.symbolType)!==null&&u!==void 0?u:"square"},Or.horizontal),w),{pickable:!P}),"symbol"),this._endHandler=N.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:R.x+D*L,y:R.y+B/2,size:B,symbolType:(c=T.symbolType)!==null&&c!==void 0?c:"square"},Or.horizontal),T),{pickable:!P}),"symbol");const V=Math.max(this._startHandler.AABBBounds.width(),F),G=Math.max(this._startHandler.AABBBounds.height(),F),X=Math.max(this._endHandler.AABBBounds.width(),z),Z=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=N.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:R.x+O*L-V/2,y:R.y+B/2-G/2,width:V,height:G,fill:"white",fillOpacity:0,zIndex:999},Or.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=N.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:R.x+D*L-X/2,y:R.y+B/2-Z/2,width:X,height:Z,fill:"white",fillOpacity:0,zIndex:999},Or.horizontal),{pickable:!P}),"rect")}else{if(k.visible){const et=((p=k.background)===null||p===void 0?void 0:p.size)||10;this._middleHandlerRect=N.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:y==="left"?R.x-et:R.x+L,y:R.y+O*B,width:et,height:(D-O)*B},(g=k.background)===null||g===void 0?void 0:g.style),{pickable:!P}),"rect"),this._middleHandlerSymbol=N.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:y==="left"?R.x-et/2:R.x+L+et/2,y:R.y+(O+D)/2*B,angle:Math.PI/180*90,symbolType:(_=(f=k.icon)===null||f===void 0?void 0:f.symbolType)!==null&&_!==void 0?_:"square",strokeBoundsBuffer:0},k.icon),{pickable:!P}),"symbol")}this._startHandler=N.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:R.x+L/2,y:R.y+O*B,size:L,symbolType:(m=w.symbolType)!==null&&m!==void 0?m:"square"},Or.vertical),w),{pickable:!P}),"symbol"),this._endHandler=N.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:R.x+L/2,y:R.y+D*B,size:L,symbolType:(v=T.symbolType)!==null&&v!==void 0?v:"square"},Or.vertical),T),{pickable:!P}),"symbol");const V=Math.max(this._startHandler.AABBBounds.width(),F),G=Math.max(this._startHandler.AABBBounds.height(),F),X=Math.max(this._endHandler.AABBBounds.width(),z),Z=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=N.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:R.x+L/2+V/2,y:R.y+O*B-G/2,width:Z,height:X,fill:"white",fillOpacity:0,zIndex:999},Or.vertical),{pickable:!P}),"rect"),this._endHandlerMask=N.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:R.x+L/2+X/2,y:R.y+D*B-Z/2,width:Z,height:X,fill:"white",fillOpacity:0,zIndex:999},Or.vertical),{pickable:!P}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let r,a;return this._isHorizontal?(r=[{x:e.x,y:e.y+n}],a=[{x:e.x+i,y:e.y+n}]):t==="left"?(r=[{x:e.x+i,y:e.y}],a=[{x:e.x+i,y:e.y+n}]):(r=[{x:e.x,y:e.y+n}],a=[{x:e.x,y:e.y}]),{basePointStart:r,basePointEnd:a}}getPreviewLinePoints(){const t=this._previewData.map(n=>({x:this._previewPointsX&&this._previewPointsX(n),y:this._previewPointsY&&this._previewPointsY(n)}));if(t.length===0)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map(n=>({x:this._previewPointsX&&this._previewPointsX(n),y:this._previewPointsY&&this._previewPointsY(n),x1:this._previewPointsX1&&this._previewPointsX1(n),y1:this._previewPointsY1&&this._previewPointsY1(n)}));if(t.length===0)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),t==="line"?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;t==="line"&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),t==="area"&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),t==="line"?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:n,end:r}=this.state,{position:a,width:o,height:l}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?a.x+n*o:a.x,y:this._isHorizontal?a.y:a.y+n*l,width:this._isHorizontal?(r-n)*o:o,height:this._isHorizontal?l:(r-n)*l,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?a.x+n*o:a.x),y:-(this._isHorizontal?a.y:a.y+n*l),width:this._isHorizontal?(r-n)*o:o,height:this._isHorizontal?l:(r-n)*l,pickable:!1}),t==="line"&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),t==="area"&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let n=this.find(r=>r.name===i,!0);return n?n.setAttributes(e):(n=new kn(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;E(t)&&E(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){e==="start"?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:r={}}=this.attribute,a=(e=(t=r.background)===null||t===void 0?void 0:t.size)!==null&&e!==void 0?e:10,o=(n=(i=r.icon)===null||i===void 0?void 0:i.size)!==null&&n!==void 0?n:10;return Math.max(a,...Y(o))}setPreviewPointsX(t){q(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){q(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){q(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){q(t)&&(this._previewPointsY1=t)}setStatePointToData(t){q(t)&&(this._statePointToData=t)}};mO.defaultAttributes=a6;var Jy;(function(s){s.start="start",s.middle="middle",s.end="end",s.insideStartTop="insideStartTop",s.insideStartBottom="insideStartBottom",s.insideMiddleTop="insideMiddleTop",s.insideMiddleBottom="insideMiddleBottom",s.insideEndTop="insideEndTop",s.insideEndBottom="insideEndBottom"})(Jy||(Jy={}));var Qy;(function(s){s.left="left",s.right="right",s.top="top",s.bottom="bottom",s.middle="middle",s.insideLeft="insideLeft",s.insideRight="insideRight",s.insideTop="insideTop",s.insideBottom="insideBottom"})(Qy||(Qy={}));var tb;(function(s){s.top="top",s.bottom="bottom",s.middle="middle",s.insideTop="insideTop",s.insideBottom="insideBottom",s.insideMiddle="insideMiddle"})(tb||(tb={}));class Ix extends ri{constructor(){super(...arguments),this.name="marker"}setAttribute(t,e,i){super.setAttribute(t,e,i),t==="visible"&&this.render()}_initContainer(){var t,e;const{limitRect:i={},clipInRange:n}=this.attribute;let r;if(n){const a=pt.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));r=pt.group({x:-((t=i.x)!==null&&t!==void 0?t:0),y:-((e=i.y)!==null&&e!==void 0?e:0),pickable:!1}),a.add(r),this._containerClip=a,this.add(a)}else r=pt.group({x:0,y:0,pickable:!1}),this.add(r);r.name="marker-container",this._container=r}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:n}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:n?-((t=i.x)!==null&&t!==void 0?t:0):0,y:n?-((e=i.y)!==null&&e!==void 0?e:0):0})}render(){var t;this.setAttribute("pickable",!1);const e=(t=this.attribute.visible)===null||t===void 0||t;this.attribute.interactive===!1&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)):(this._container=null,this.removeAllChild())}}const h6={startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{position:Jy.end,refX:0,refY:0,refAngle:0,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},d6={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},u6={label:{position:Qy.right,textStyle:{fill:"#fff",stroke:"#fff",lineWidth:0,fontSize:10,fontWeight:"normal",fontStyle:"normal"},padding:[2,2,4,4],panel:{visible:!0,cornerRadius:0,fill:"rgb(48, 115, 242)",fillOpacity:.8}},areaStyle:{fill:"#b2bacf",visible:!0}},c6={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"}},p6={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}},g6={top:{textAlign:"left",textBaseline:"bottom"},bottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"left",textBaseline:"middle"},insideTop:{textAlign:"right",textBaseline:"bottom"},insideBottom:{textAlign:"right",textBaseline:"top"},insideMiddle:{textAlign:"right",textBaseline:"middle"}};function yO(s,t){const{x1:e,y1:i,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=s.AABBBounds;let d=0,u=0;return a<e&&(d=e-a),o<i&&(u=i-o),l>n&&(d=n-l),h>r&&(u=r-h),{dx:d,dy:u}}function bO(s,t){const{dx:e,dy:i}=yO(s,t),{dx:n=0,dy:r=0}=s.attribute;e&&s.setAttribute("dx",e+n),i&&s.setAttribute("dy",i+r)}function Fx(){He(),Y_()}function f6(){Fx(),Lx()}function _6(){Fx(),U_()}function m6(){Fx(),Lx(),An(),KR(),Ra()}f6();let xO=class SO extends Ix{getLine(){return this._line}getLabel(){return this._label}constructor(t,e){super(e!=null&&e.skipDefault?t:at({},SO.defaultAttributes,t)),this.name="markLine"}setLabelPos(){var t,e;const{label:i={},limitRect:n}=this.attribute,{position:r="end",refX:a=0,refY:o=0,confine:l}=i,h=this._line.getMainSegmentPoints(),d=(t=this._line.getEndAngle())!==null&&t!==void 0?t:0,u=a*Math.cos(d)+o*Math.cos(d-Math.PI/2),c=a*Math.sin(d)+o*Math.sin(d-Math.PI/2);let p;if(p=r.includes("start")||r.includes("Start")?{x:h[0].x+u,y:h[0].y+c}:r.includes("middle")||r.includes("Middle")?{x:(h[0].x+h[h.length-1].x)/2+u,y:(h[0].y+h[h.length-1].y)/2+c}:{x:h[h.length-1].x+u,y:h[h.length-1].y+c},this._label.setAttributes(Object.assign(Object.assign({},p),{angle:i.autoRotate?d+((e=i.refAngle)!==null&&e!==void 0?e:0):0,textStyle:Object.assign(Object.assign({},d6[r]),i.textStyle)})),n&&l){const{x:g,y:f,width:_,height:m}=n;bO(this._label,{x1:g,y1:f,x2:g+_,y2:f+m})}}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:r,lineStyle:a,mainSegmentIndex:o,multiSegment:l}=this.attribute,h=new Eh({points:e,startSymbol:i,endSymbol:n,lineStyle:a,mainSegmentIndex:o,multiSegment:l,pickable:!1});h.name="mark-line-line",this._line=h,t.add(h);const d=new kn(Object.assign({},r));d.name="mark-line-label",this._label=d,t.add(d),this.setLabelPos()}updateMarker(){const{points:t,startSymbol:e,endSymbol:i,label:n,lineStyle:r,mainSegmentIndex:a,multiSegment:o}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:r,mainSegmentIndex:a,multiSegment:o}),this._label&&this._label.setAttributes(Object.assign({dx:0,dy:0},n)),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach(i=>{if(i.length)i.forEach(n=>{H(n.x)&&H(n.y)||(e=!1)});else if(!H(i.x)||!H(i.y))return void(e=!1)}),e}};xO.defaultAttributes=h6;_6();let AO=class kO extends Ix{getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super(e!=null&&e.skipDefault?t:at({},kO.defaultAttributes,t)),this.name="markArea"}_getPositionByDirection(t,e){const{x1:i,x2:n,y1:r,y2:a}=this._area.AABBBounds;return e.includes("left")||e.includes("Left")?{x:i,y:(r+a)/2}:e.includes("right")||e.includes("Right")?{x:n,y:(r+a)/2}:e.includes("top")||e.includes("Top")?{x:(i+n)/2,y:r}:e.includes("bottom")||e.includes("Bottom")?{x:(i+n)/2,y:a}:{x:(i+n)/2,y:(r+a)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=(t=e.position)!==null&&t!==void 0?t:"middle",n=this._getPositionByDirection(this._area,i);if(this._label.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},c6[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:r,y:a,width:o,height:l}=this.attribute.limitRect;bO(this._label,{x1:r,y1:a,x2:r+o,y2:a+l})}}}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,r=pt.polygon(Object.assign({points:e},n));r.name="mark-area-area",this._area=r,t.add(r);const a=new kn(Object.assign({},i));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i}=this.attribute;this._area&&this._area.setAttributes(Object.assign({points:t},i)),this._area&&this._label.setAttributes(Object.assign({dx:0,dy:0},e)),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach(i=>{H(i.x)&&H(i.y)||(e=!1)}),e}};AO.defaultAttributes=u6;m6();let jx=class wO extends Ix{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},wO.defaultAttributes,t)),this.name="markPoint"}setLabelPos(){}setItemAttributes(t,e,i,n){var r;if(!t)return;const{autoRotate:a=!0,refX:o=0,refY:l=0,refAngle:h=0,textStyle:d={},richTextStyle:u={},imageStyle:c={},position:p=tb.middle}=e,g=((r=this._line)===null||r===void 0?void 0:r.getEndAngle())||0,f=o*Math.cos(g)+l*Math.cos(g-Math.PI/2),_=o*Math.sin(g)+l*Math.sin(g-Math.PI/2);n==="text"?t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},g6[(e==null?void 0:e.position)||"end"]),d.textStyle)})):n==="richText"?t.setAttributes({dx:this.getItemDx(t,p,u)+(u.dx||0),dy:this.getItemDy(t,p,u)+(u.dy||0)}):n==="image"&&t.setAttributes({dx:this.getItemDx(t,p,c)+(c.dx||0),dy:this.getItemDy(t,p,c)+(c.dy||0)}),t.setAttributes({x:i.x+(f||0),y:i.y+(_||0),angle:a&&g+h})}getItemDx(t,e,i){var n,r;const a=(r=(n=t==null?void 0:t.AABBBounds)===null||n===void 0?void 0:n.width())!==null&&r!==void 0?r:(i==null?void 0:i.width)||0;return e.includes("inside")?-a:0}getItemDy(t,e,i){var n,r;const a=(r=(n=t==null?void 0:t.AABBBounds)===null||n===void 0?void 0:n.height())!==null&&r!==void 0?r:(i==null?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-a:e.includes("middle")||e.includes("Middle")?-a/2:0}initItem(t,e){const{type:i="text",symbolStyle:n,richTextStyle:r,imageStyle:a,renderCustomCallback:o}=t;let l;return i==="symbol"?l=pt.symbol(Object.assign(Object.assign({},e),n)):i==="text"?l=new kn(Object.assign({},e)):i==="richText"?l=pt.richtext(Object.assign(Object.assign({},e),r)):i==="image"?l=pt.image(Object.assign(Object.assign({},e),a)):i==="custom"&&o&&(l=o()),this.setItemAttributes(l,t,e,i),l}getItemLineAttr(t,e,i){let n=[];const{type:r="type-s"}=t;return n=r==="type-do"?[e,{x:(e.x+i.x)/2,y:i.y},i]:r==="type-po"?[e,{x:i.x,y:e.y},i]:r==="type-op"?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){if(this._line){const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);this._line.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}}getDecorativeLineAttr(t,e){var i;const n=((i=t==null?void 0:t.decorativeLine)===null||i===void 0?void 0:i.length)||10,r=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(r-Math.PI/2),startPointOffsetY:n/2*Math.sin(r-Math.PI/2),endPointOffsetX:-n/2*Math.cos(r-Math.PI/2),endPointOffsetY:-n/2*Math.sin(r-Math.PI/2)}}setDecorativeLineAttr(t,e,i){if(this._decorativeLine){const{lineStyle:n}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);this._decorativeLine.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},n),{visible:i}))}}setAllOfItemsAttr(t){var e;const{position:i,itemLine:n={},itemContent:r={},limitRect:a}=this.attribute,{type:o="text",confine:l}=r;if(a&&l){const{x:h,y:d,width:u,height:c}=a,{dx:p,dy:g}=yO(this._item,{x1:h,y1:d,x2:h+u,y2:d+c});t.x=t.x+p,t.y=t.y+g}this.setItemAttributes(this._item,r,t,o),this.setItemLineAttr(n,i,t,n.visible),this.setDecorativeLineAttr(n,t,(e=n.decorativeLine)===null||e===void 0?void 0:e.visible)}initMarker(t){const{position:e,itemContent:i={}}=this.attribute,n={x:e.x+(i.offsetX||0),y:e.y+(i.offsetY||0)},r=new Eh({points:[],pickable:!1});r.name="mark-point-line",this._line=r,t.add(r);const a=pt.line({points:[]});a.name="mark-point-decorativeLine",this._decorativeLine=a,t.add(a);const o=this.initItem(i,n);this._item=o,this.setAllOfItemsAttr(n),t.add(o)}updateMarker(){const{position:t,itemContent:e={}}=this.attribute,{type:i="text"}=e,n={x:t.x+(e.offsetX||0),y:t.y+(e.offsetY||0)};this.setItemAttributes(this._item,e,n,i),this.setAllOfItemsAttr(n)}isValidPoints(){const{position:t}=this.attribute;return!(!H(t.x)||!H(t.y))}};jx.defaultAttributes=p6;function TO(){He(),An(),Da()}const MO={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};TO();class bu extends ri{getCurrent(){return this._current}constructor(t,e){super(e!=null&&e.skipDefault?t:at({},bu.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=i=>{const n=i.target;n.hasState("disable")||n.addState("hover")},this._onUnHover=i=>{i.target.removeState("hover")},this._onClick=i=>{const n=i.target;if(n.name==="preHandler"){if(this._current===1)return;this._current-=1,this._current===1?n.addState("disable"):n.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:i})}if(n.name==="nextHandler"){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:i})}this._current>1&&this.preHandler.removeState("disable"),this._current<this._total&&this.nextHandler.removeState("disable"),this.text.setAttribute("text",`${this._current}/${this._total}`)}}render(){var t,e;this._reset();const{layout:i="horizontal",handler:n=MO,total:r,defaultCurrent:a=1,textStyle:o,padding:l=0}=this.attribute;this._current=a;const h=as(l),d=i==="horizontal",u=pt.group({x:0,y:0}),c=n.style||{},p=c.size||15,g=(t=n.space)!==null&&t!==void 0?t:8,f=n.state||{};let{preShape:_,nextShape:m}=n;_||(_=d?"triangleLeft":"triangleUp"),m||(m=d?"triangleRight":"triangleDown");const v=pt.symbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:0,y:0,symbolType:_,size:p}));v.states=f,v.name="preHandler",this.preHandler=v,u.add(v);const{width:y,height:b}=$_(`${r}/${r}`,Object.assign({textAlign:"center",textBaseline:"middle"},o),(e=this.stage)===null||e===void 0?void 0:e.getTheme().text.fontFamily),x=lt(p)?p:p[0],S=lt(p)?p:p[1],A=pt.text(Object.assign({x:d?x/2+g+y/2:0,y:d?0:S/2+g+b/2,text:`${a}/${r}`,textAlign:"center",textBaseline:"middle",lineHeight:o==null?void 0:o.fontSize},o));this.text=A,u.add(A);const k=pt.symbol(Object.assign(Object.assign({strokeBoundsBuffer:0,pickMode:"imprecise"},c),{x:d?x+2*g+y:0,y:d?0:S+2*g+b,symbolType:m,size:p}));k.name="nextHandler",k.states=f,this.nextHandler=k,u.add(k),this._total===1?(v.addState("disable"),k.addState("disable")):this._current===1?v.addState("disable"):this._current===r&&k.addState("disable");const w=u.AABBBounds,T=w.width(),M=w.height();u.translateTo(0-w.x1+h[3],0-w.y1+h[0]),this.add(u),this.attribute.width=T+h[1]+h[3],this.attribute.height=M+h[0]+h[2],this._bindEvents()}_bindEvents(){this.attribute.disableTriggerEvent||(this.preHandler&&(this.preHandler.addEventListener("pointerenter",this._onHover),this.preHandler.addEventListener("pointerleave",this._onUnHover),this.preHandler.addEventListener("pointerdown",this._onClick)),this.nextHandler&&(this.nextHandler.addEventListener("pointerenter",this._onHover),this.nextHandler.addEventListener("pointerleave",this._onUnHover),this.nextHandler.addEventListener("pointerdown",this._onClick)))}_reset(){this.removeAllChild(),this._current=1,this._total=this.attribute.total,this.preHandler=this.nextHandler=this.text=null}}bu.defaultAttributes={handler:MO,textStyle:{fill:"rgb(51, 51, 51)",fontSize:12}};const Cf=10,CO=8,PO=8,v6=8,eb=16,ib=8,gc=12,EO=12;var Tt;(function(s){s.selected="selected",s.unSelected="unSelected",s.selectedHover="selectedHover",s.unSelectedHover="unSelectedHover",s.focus="focus"})(Tt||(Tt={}));var Hs;(function(s){s.legendItemHover="legendItemHover",s.legendItemUnHover="legendItemUnHover",s.legendItemClick="legendItemClick",s.legendItemAttributeUpdate="legendItemAttributeUpdate"})(Hs||(Hs={}));var ki;(function(s){s.innerView="innerView",s.title="legendTitle",s.item="legendItem",s.itemShape="legendItemShape",s.itemLabel="legendItemLabel",s.itemValue="legendItemValue",s.focus="legendItemFocus"})(ki||(ki={}));class zx extends ri{constructor(){super(...arguments),this.name="legend",this._title=null}render(){this.removeAllChild();const{interactive:t=!0,title:e,padding:i=0}=this.attribute,n=as(i),r=pt.group({x:n[3],y:n[0],pickable:t,childrenPickable:t});r.name=ki.innerView,this.add(r),this._innerView=r,e!=null&&e.visible&&this._renderTitle(e),this._renderContent(),this._adjustLayout(),t&&this._bindEvents();const a=this._innerView.AABBBounds;this.attribute.width=a.width()+n[1]+n[3],this.attribute.height=a.height()+n[0]+n[2]}_renderTitle(t){const{text:e="",textStyle:i,padding:n=0,background:r,minWidth:a,maxWidth:o,shape:l}=t,h={x:0,y:0,text:e,textStyle:i,padding:as(n),minWidth:a,maxWidth:o};l&&l.visible&&(h.shape=Object.assign({visible:!0},l.style),E(l.space)&&(h.space=l.space)),r&&r.visible&&(h.panel=Object.assign({visible:!0},r.style));const d=new kn(h);d.name=ki.title,this._title=d,this._innerView.add(d)}_adjustLayout(){var t;if(this._title){const e=this._innerView.AABBBounds.width(),i=this._title.AABBBounds.width(),n=(t=this.attribute.title)===null||t===void 0?void 0:t.align;n==="center"?this._title.setAttribute("x",(e-i)/2):n==="end"&&this._title.setAttribute("x",e-i)}}}function nm(){He(),Da(),Mr(),An()}function Hx(){He(),Y_()}function y6(){Hx(),TO()}function b6(){Hx(),nm()}function x6(){Hx(),nm(),uc()}var S6=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};const A6={[Tt.focus]:{},[Tt.selected]:{},[Tt.selectedHover]:{},[Tt.unSelected]:{},[Tt.unSelectedHover]:{}};y6();let RO=class OO extends zx{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},OO.defaultAttributes,t)),this.name="discreteLegend",this._itemsContainer=null,this._itemHeightByUser=void 0,this._itemHeight=0,this._itemMaxWidth=0,this._onHover=i=>{const n=i.target;if(n&&n.name&&n.name.startsWith(ki.item)){const r=n.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===r.id)return;this._unHover(this._lastActiveItem,i)}this._hover(r,i)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,i),this._lastActiveItem=null)},this._onUnHover=i=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,i),this._lastActiveItem=null)},this._onClick=i=>{var n,r,a,o;const l=i.target;if(l&&l.name&&l.name.startsWith(ki.item)){const h=l.delegate;if(l.name===ki.focus){const d=h.hasState(Tt.focus);h.toggleState(Tt.focus),d?(n=this._itemsContainer)===null||n===void 0||n.getChildren().forEach(u=>{this._removeLegendItemState(u,[Tt.unSelected,Tt.unSelectedHover,Tt.focus],i),this._setLegendItemState(u,Tt.selected,i)}):(this._setLegendItemState(h,Tt.selected,i),this._removeLegendItemState(h,[Tt.unSelected,Tt.unSelectedHover],i),(r=this._itemsContainer)===null||r===void 0||r.getChildren().forEach(u=>{h!==u&&(this._removeLegendItemState(u,[Tt.selected,Tt.selectedHover,Tt.focus],i),this._setLegendItemState(u,Tt.unSelected,i))}))}else{(a=this._itemsContainer)===null||a===void 0||a.getChildren().forEach(g=>{g.removeState(Tt.focus)});const{selectMode:d="multiple",allowAllCanceled:u=!0}=this.attribute,c=h.hasState(Tt.selected),p=this._getSelectedLegends();if(d==="multiple"){if(u===!1&&c&&p.length===1)return void this._dispatchLegendEvent(Hs.legendItemClick,h,i);c?(this._removeLegendItemState(h,[Tt.selected,Tt.selectedHover],i),this._setLegendItemState(h,Tt.unSelected,i)):(this._setLegendItemState(h,Tt.selected,i),this._removeLegendItemState(h,[Tt.unSelected,Tt.unSelectedHover],i))}else this._setLegendItemState(h,Tt.selected,i),this._removeLegendItemState(h,[Tt.unSelected,Tt.unSelectedHover],i),(o=this._itemsContainer)===null||o===void 0||o.getChildren().forEach(g=>{h!==g&&(this._removeLegendItemState(g,[Tt.selected,Tt.selectedHover],i),this._setLegendItemState(g,Tt.unSelected,i))})}this._dispatchLegendEvent(Hs.legendItemClick,h,i)}}}setSelected(t){var e;((e=this._itemsContainer)===null||e===void 0?void 0:e.getChildren()).forEach(i=>{const n=i.data;t.includes(n.label)?(this._setLegendItemState(i,Tt.selected),this._removeLegendItemState(i,[Tt.unSelected,Tt.unSelectedHover])):(this._removeLegendItemState(i,[Tt.selected,Tt.selectedHover]),this._setLegendItemState(i,Tt.unSelected))})}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:r=2}=this.attribute;if(t.visible===!1||ft(e))return;let a=e;i&&(a=e==null?void 0:e.reverse());const o=pt.group({x:0,y:0});this._itemsContainer=o;const{layout:l,maxWidth:h,maxHeight:d,defaultSelected:u=[],autoPage:c}=this.attribute,p=l==="horizontal",{spaceCol:g=eb,spaceRow:f=ib,maxWidth:_,width:m,height:v}=t;E(_)?E(m)?this._itemWidthByUser=Math.min(_,m):this._itemWidthByUser=_:E(m)&&(this._itemWidthByUser=m),E(v)&&(this._itemHeightByUser=v);let y=!1,b=0,x=0,S=0,A=1,k=1;a.forEach((T,M)=>{T.id||(T.id=T.label),T.index=M;const P=this._renderEachItem(T,!!ft(u)||(u==null?void 0:u.includes(T.label)),M,a),O=P.attribute.width,D=P.attribute.height;this._itemHeight=Math.max(this._itemHeight,D),b=Math.max(O,b),this._itemMaxWidth=Math.max(O,this._itemMaxWidth),p?(A=r,E(h)&&(O>=h?(y=!0,M>0&&(x=0,S+=D+f,k+=1)):h<x+O&&(y=!0,x=0,S+=D+f,k+=1)),M>0&&P.setAttributes({x,y:S}),x+=g+O):(A=n,E(d)&&d<S+D&&(y=!0,S=0,x+=b+g,b=0,k+=1),M>0&&P.setAttributes({x,y:S}),S+=f+D),o.add(P)});let w=!1;y&&c&&k>A&&(w=this._renderPager(p)),w||(o.setAttribute("y",this._title?this._title.AABBBounds.height()+Et(this.attribute,"title.space",8):0),this._innerView.add(o))}_bindEvents(){if(this.attribute.disableTriggerEvent||!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerleave",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){var r,a;const{id:o,label:l,value:h,shape:d}=t,{padding:u=0,focus:c,focusIconStyle:p}=this.attribute.item,{shape:g,label:f,value:_,background:m}=this.attribute.item,v=this._handleStyle(g,t,e,i,n),y=this._handleStyle(f,t,e,i,n),b=this._handleStyle(_,t,e,i,n),x=this._handleStyle(m,t,e,i,n),S=as(u);let A;m.visible===!1?(A=pt.group({x:0,y:0,cursor:(r=x.style)===null||r===void 0?void 0:r.cursor}),this._appendDataToShape(A,ki.item,t,A)):(A=pt.group(Object.assign({x:0,y:0},x.style)),this._appendDataToShape(A,ki.item,t,A,x.state)),A.id=`${o??l}-${i}`,A.addState(e?Tt.selected:Tt.unSelected);const k=pt.group({x:0,y:0,pickable:!1});A.add(k);let w,T=0,M=0,P=0;if(g&&g.visible!==!1){const V=Et(v,"style.size",Cf);M=U(V)?V[0]||0:V,P=Et(g,"space",CO);const G=pt.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},d),v.style));Object.keys(v.state||{}).forEach(X=>{const Z=v.state[X].fill||v.state[X].stroke;d.fill&&C(v.state[X].fill)&&Z&&(v.state[X].fill=Z),d.stroke&&C(v.state[X].stroke)&&Z&&(v.state[X].stroke=Z)}),this._appendDataToShape(G,ki.itemShape,t,A,v.state),G.addState(e?Tt.selected:Tt.unSelected),k.add(G)}let O=0;if(c){const V=Et(p,"size",Cf);w=pt.symbol(Object.assign(Object.assign({x:0,y:-V/2-1,strokeBoundsBuffer:0},p),{visible:!0,pickMode:"imprecise",boundsPadding:S})),this._appendDataToShape(w,ki.focus,t,A),O=V}const D=pt.text(Object.assign(Object.assign({x:M/2+P,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(a=y.style)===null||a===void 0?void 0:a.fontSize},y.style),{text:f.formatMethod?f.formatMethod(l,t,i):l}));this._appendDataToShape(D,ki.itemLabel,t,A,y.state),D.addState(e?Tt.selected:Tt.unSelected),k.add(D);const R=Et(f,"space",PO);if(E(h)){const V=Et(_,"space",c?v6:0),G=pt.text(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:b.style.fontSize},b.style),{text:_.formatMethod?_.formatMethod(h,t,i):h}));if(this._appendDataToShape(G,ki.itemValue,t,A,b.state),G.addState(e?Tt.selected:Tt.unSelected),this._itemWidthByUser){const X=this._itemWidthByUser-S[1]-S[3]-M-P-R-O-V,Z=G.AABBBounds,et=D.AABBBounds,K=Z.width(),W=et.width();W>X?(X-K)/W>.4?D.setAttribute("maxLineWidth",X-K):(G.setAttribute("maxLineWidth",.5*X),D.setAttribute("maxLineWidth",.5*X)):G.setAttribute("maxLineWidth",X-W),_.alignRight?G.setAttributes({textAlign:"right",x:this._itemWidthByUser-M/2-S[1]-S[3]-O-V}):G.setAttribute("x",D.AABBBounds.x2+V)}else G.setAttribute("x",D.AABBBounds.x2+V);T=G.AABBBounds.x2+V,k.add(G)}else this._itemWidthByUser&&D.setAttribute("maxLineWidth",this._itemWidthByUser-S[1]-S[3]-M-P-O),T=D.AABBBounds.x2+R;w&&(w.setAttribute("x",T),k.add(w));const L=k.AABBBounds,B=L.width(),F=L.height(),z=E(this.attribute.item.width)?this.attribute.item.width:B+S[1]+S[3],N=this._itemHeightByUser||F+S[0]+S[2];return A.attribute.width=z,A.attribute.height=N,w&&w.setAttribute("visible",!1),k.translateTo(-L.x1+S[3],-L.y1+S[0]),A}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+Et(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:r=1,maxRow:a=2,item:o={},pager:l={},disableTriggerEvent:h}=this.attribute,{spaceCol:d=eb,spaceRow:u=ib}=o,c=this._itemsContainer,{animation:p=!0,animationDuration:g=450,animationEasing:f="quadIn",space:_=EO,position:m="middle"}=l,v=S6(l,["animation","animationDuration","animationEasing","space","position"]);let y,b=0,x=0,S=0,A=0,k=1;if(t){if(y=new bu(Object.assign(Object.assign({layout:a===1?"horizontal":"vertical",total:99},at({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},v)),{disableTriggerEvent:h})),this._pager=y,this._innerView.add(y),b=(a-1)*u+this._itemHeight*a,x=i-y.AABBBounds.width()-_,x<=0)return this._innerView.removeChild(y),!1;let M;c.getChildren().forEach((P,O)=>{const{width:D,height:R}=P.attribute;x<S+D&&(S=0,A+=R+u,k+=1),O>0&&P.setAttributes({x:S,y:A}),S+=d+D}),y.setAttribute("total",Math.ceil(k/a)),M=m==="start"?e:m==="end"?e+b-y.AABBBounds.height()/2:e+b/2-y.AABBBounds.height()/2,y.setAttributes({x,y:M})}else{if(y=new bu(Object.assign({layout:"horizontal",total:99,disableTriggerEvent:h},v)),this._pager=y,this._innerView.add(y),x=this._itemMaxWidth*r+(r-1)*d,b=n-y.AABBBounds.height()-_-e,b<=0)return this._innerView.removeChild(y),!1;let M;c.getChildren().forEach((P,O)=>{const{height:D}=P.attribute;b<A+D&&(A=0,S+=this._itemMaxWidth+d,k+=1),O>0&&P.setAttributes({x:S,y:A}),A+=u+D}),y.setAttribute("total",Math.ceil(k/r)),M=m==="start"?0:m==="end"?x-y.AABBBounds.width():(x-y.AABBBounds.width())/2,y.setAttributes({x:M,y:n-y.AABBBounds.height()})}l.defaultCurrent>1&&(t?c.setAttribute("y",-(l.defaultCurrent-1)*(b+u)):c.setAttribute("x",-(l.defaultCurrent-1)*(x+d)));const w=pt.group({x:0,y:e,width:x,height:b,clip:!0,pickable:!1});w.add(c),this._innerView.add(w);const T=M=>{const{current:P}=M.detail;p?c.animate().to(t?{y:-(P-1)*(b+u)}:{x:-(P-1)*(x+d)},g,f):t?c.setAttribute("y",-(P-1)*(b+u)):c.setAttribute("x",-(P-1)*(x+d))};return this._pager.addEventListener("toPrev",T),this._pager.addEventListener("toNext",T),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(Tt.selected)?this._setLegendItemState(t,Tt.selectedHover,e):this._setLegendItemState(t,Tt.unSelectedHover,e);const i=t.getChildren()[0].find(n=>n.name===ki.focus,!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(Hs.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(Tt.unSelectedHover)||t.hasState(Tt.selectedHover))&&(i=!0),t.removeState(Tt.unSelectedHover),t.removeState(Tt.selectedHover),t.getChildren()[0].getChildren().forEach(r=>{i||!r.hasState(Tt.unSelectedHover)&&!r.hasState(Tt.selectedHover)||(i=!0),r.removeState(Tt.unSelectedHover),r.removeState(Tt.selectedHover)});const n=t.getChildren()[0].find(r=>r.name===ki.focus,!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(Hs.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(Hs.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let n=!1;t.hasState(e)||(n=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach(r=>{r.name!==ki.focus&&(n||r.hasState(e)||(n=!0),r.addState(e,!0))}),n&&this._dispatchLegendEvent(Hs.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let n=!1;e.forEach(r=>{!n&&t.hasState(r)&&(n=!0),t.removeState(r)}),t.getChildren()[0].getChildren().forEach(r=>{r.name!==ki.focus&&e.forEach(a=>{!n&&r.hasState(a)&&(n=!0),r.removeState(a)})}),n&&this._dispatchLegendEvent(Hs.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return(t=this._itemsContainer)===null||t===void 0||t.getChildren().forEach(i=>{i.hasState(Tt.selected)&&e.push(i.data)}),e}_appendDataToShape(t,e,i,n,r={}){t.name=e,t.data=i,t.delegate=n,t.states=at({},A6,r)}_dispatchLegendEvent(t,e,i){const n=this._getSelectedLegends();n.sort((a,o)=>a.index-o.index);const r=n.map(a=>a.label);this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(Tt.selected),currentSelectedItems:n,currentSelected:r,event:i})}_handleStyle(t,e,i,n,r){const a={};return t.style&&(q(t.style)?a.style=t.style(e,i,n,r):a.style=t.style),t.state&&(a.state={},Object.keys(t.state).forEach(o=>{t.state[o]&&(q(t.state[o])?a.state[o]=t.state[o](e,i,n,r):a.state[o]=t.state[o])})),a}};RO.defaultAttributes={layout:"horizontal",title:{align:"start",space:gc,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eb,spaceRow:ib,shape:{space:CO,style:{size:Cf,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:PO,style:{fontSize:12,fill:"#2C3542",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"}},focus:!1,focusIconStyle:{size:Cf,symbolType:"M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z",fill:"#333",cursor:"pointer"}},autoPage:!0,pager:{space:EO,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};var Ai;(function(s){s.innerView="innerView",s.railContainer="sliderRailContainer",s.rail="sliderRail",s.startText="sliderStartText",s.endText="sliderEndText",s.startHandler="sliderStartHandler",s.startHandlerText="startHandlerText",s.endHandler="sliderEndHandler",s.endHandlerText="sliderEndHandlerText",s.track="sliderTrack",s.trackContainer="sliderTrackContainer"})(Ai||(Ai={}));function kv(s){return U(s)?s:[s,s]}function dp(s){return s?"ew-resize":"ns-resize"}nm();class Rh extends ri{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(t,e){super(e!=null&&e.skipDefault?t:at({},Rh.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=i=>{i.stopPropagation(),this._currentHandler=i.target,this._prePos=this._isHorizontal?i.clientX:i.clientY,Ht.env==="browser"?(Ht.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Ht.addEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onHandlerPointerUp),this.stage.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=i=>{var n,r;i.stopPropagation();const{railWidth:a,railHeight:o,min:l,max:h}=this.attribute;if(h===l)return;let d,u,c,p=0;this._isHorizontal?(d=i.clientX,p=d-this._prePos,u=(r=this._currentHandler)===null||r===void 0?void 0:r.attribute.x,c=a):(d=i.clientY,p=d-this._prePos,u=(n=this._currentHandler)===null||n===void 0?void 0:n.attribute.y,c=o);const g=di(u+p,0,c),f=g/c*(h-l)+l;this._currentHandler.type==="text"?this._updateHandlerText(this._currentHandler,g,f):this._updateHandler(this._currentHandler,g,f),this._updateTrack(),this._prePos=d,this._dispatchChangeEvent()},this._onHandlerPointerUp=i=>{i.preventDefault(),this._currentHandler=null,Ht.env==="browser"?(Ht.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Ht.removeEventListener("pointerup",this._onHandlerPointerUp)):(this.stage.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onHandlerPointerUp),this.stage.removeEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onTrackPointerdown=i=>{i.stopPropagation(),this._prePos=this._isHorizontal?i.clientX:i.clientY,Ht.env==="browser"?(Ht.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Ht.addEventListener("pointerup",this._onTrackPointerUp)):(this.stage.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.addEventListener("pointerup",this._onTrackPointerUp),this.stage.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=i=>{i.stopPropagation();const{railWidth:n,railHeight:r,min:a,max:o}=this.attribute;if(o===a)return;const{startHandler:l,endHandler:h}=this._getHandlers();let d,u,c;this._isHorizontal?(d=i.clientX,u=this._track.attribute.width,c=n):(d=i.clientY,u=this._track.attribute.height,c=r);const p=d-this._prePos;if(l){const g=this._isHorizontal?l.attribute.x:l.attribute.y,f=di(g+p,0,c-u),_=f/c*(o-a)+a;this._updateHandler(l,f,_)}if(h){const g=this._isHorizontal?h.attribute.x:h.attribute.y,f=di(g+p,u,c),_=f/c*(o-a)+a,m=l==null?void 0:l.attribute;this._updateHandler(h,f,_),this._track.setAttributes(this._isHorizontal?{x:Math.min(m.x,h.attribute.x),width:Math.abs(m.x-h.attribute.x)}:{y:Math.min(m.y,h.attribute.y),height:Math.abs(m.y-h.attribute.y)})}this._prePos=d,this._dispatchChangeEvent()},this._onTrackPointerUp=i=>{i.preventDefault(),Ht.env==="browser"?(Ht.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Ht.removeEventListener("pointerup",this._onTrackPointerUp)):(this.stage.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),this.stage.removeEventListener("pointerup",this._onTrackPointerUp),this.stage.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=i=>{i.stopPropagation();const{railWidth:n,railHeight:r,min:a,max:o}=this.attribute;if(o===a)return;const l=this._startHandler,h=this._endHandler;let d,u,c,p;this._isHorizontal?(d=i.viewX-this._rail.globalAABBBounds.x1,u=l==null?void 0:l.attribute.x,c=h==null?void 0:h.attribute.x,p=n):(d=i.viewY-this._rail.globalAABBBounds.y1,u=l==null?void 0:l.attribute.y,c=h==null?void 0:h.attribute.y,p=r);const g=d/p*(o-a)+a;if(E(c)){const f=Math.abs(d-u)>Math.abs(d-c)?h:l;this._updateHandler(f,d,g)}else this._updateHandler(l,d,g);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const[o,l]=Y(t),{startHandler:h,endHandler:d}=this._getHandlers(),u=e==="vertical"?n:i,c=(o-r)/(a-r)*u;if(h&&this._updateHandler(h,c,o),d){const p=(l-r)/(a-r)*u;this._updateHandler(d,p,l)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:r,startText:a,endText:o,min:l,max:h,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;C(u)&&(u=[l,h]),this._currentValue={startValue:kv(u)[0],endValue:kv(u)[1]};const c=i==="horizontal";this._isHorizontal=c;const p=pt.group({x:0,y:0});p.name=Ai.innerView,this.add(p),this._innerView=p;let g,f=0;if(a&&a.visible){g=pt.text(Object.assign({x:c?0:n/2,y:c?r/2:0,textAlign:c?"start":"center",textBaseline:c?"middle":"top",text:a.text,lineHeight:(t=a.style)===null||t===void 0?void 0:t.fontSize},a.style)),g.name=Ai.startText,p.add(g);const y=E(a.space)?a.space:0;f+=(c?g.AABBBounds.width():g.AABBBounds.height())+y}const _=pt.group({x:c?f:0,y:c?0:f});p.add(_);const m=pt.group({x:0,y:0});let v;if(m.name=Ai.railContainer,this._railContainer=m,_.add(m),this._renderRail(m),f+=c?n:r,o&&o.visible){const y=E(o.space)?o.space:0;v=pt.text(Object.assign({x:c?f+y:n/2,y:c?r/2:f+y,textAlign:c?"start":"center",textBaseline:c?"middle":"top",text:o.text,lineHeight:(e=o.style)===null||e===void 0?void 0:e.fontSize},o.style)),v.name=Ai.endText,p.add(v)}this._renderTrack(m),d&&(this._renderHandlers(_),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:r}=this.attribute;let a="default";r!==!1&&(a="pointer");const o=pt.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:a},n));return o.name=Ai.rail,t.add(o),this._rail=o,o}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:r=14,handlerStyle:a,handlerText:o,railHeight:l,railWidth:h,slidable:d}=this.attribute;let{value:u}=this.attribute;C(u)&&(u=[i,n]);const c=o&&o.visible,p=this._isHorizontal,g=p?h:l,[f,_]=kv(u),m=n===i?e?0:g:(f-i)/(n-i)*g,v=this._renderHandler(Object.assign({x:p?m:h/2,y:p?l/2:m,size:r,strokeBoundsBuffer:0,cursor:d===!1?"default":dp(p)},a));if(v.name=Ai.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,c){const y=this._renderHandlerText(f,e?"start":"end");y.name=Ai.startHandlerText,t.add(y),this._startHandlerText=y}if(e){const y=n===i?g:(_-i)/(n-i)*g,b=this._renderHandler(Object.assign({x:p?y:h/2,y:p?l/2:y,size:r,strokeBoundsBuffer:0,cursor:d===!1?"default":dp(p)},a));if(b.name=Ai.endHandler,this._endHandler=b,t.add(b),this._currentValue.endPos=y,c){const x=this._renderHandlerText(_,"end");x.name=Ai.endHandlerText,t.add(x),this._endHandlerText=x}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:r,railWidth:a,trackStyle:o,railStyle:l,slidable:h,value:d}=this.attribute;let u,c;if(C(d))e?(u=i,c=n):u=c=i;else if(e){const x=Fr(d,i,n);u=x[0],c=x[1]}else u=i,c=di(d,i,n);const p=this._isHorizontal,g=p?a:r;e||(u=i);const f=pt.group({x:0,y:0,width:a,height:r,cornerRadius:l==null?void 0:l.cornerRadius,clip:!0,pickable:!1});f.name=Ai.trackContainer;const _=Vt(e)&&e.draggableTrack===!0;let m;m=h===!1?"default":e===!1||_===!1?"pointer":dp(p);const v=n===i?g:(c-u)/(n-i)*g,y=n===i?0:(u-i)/(n-i)*g,b=pt.rect(Object.assign({x:p?y:0,y:p?0:y,width:p?v:a,height:p?r:v,cursor:m},o));b.name=Ai.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pt.symbol(t)}_renderHandlerText(t,e){var i,n,r;const{align:a,min:o,max:l,handlerSize:h=14,handlerText:d={},railHeight:u,railWidth:c,slidable:p}=this.attribute,g=this._isHorizontal,f=g?c:u,_=l===o?e==="start"?0:f:(t-o)/(l-o)*f,m=(i=d.space)!==null&&i!==void 0?i:4,v={text:d.formatter?d.formatter(t):t.toFixed((n=d.precision)!==null&&n!==void 0?n:0),lineHeight:(r=d.style)===null||r===void 0?void 0:r.lineHeight,cursor:p===!1?"default":dp(g)};return g?a==="top"?(v.textBaseline="bottom",v.textAlign="center",v.x=_,v.y=(u-h)/2-m):(v.textBaseline="top",v.textAlign="center",v.x=_,v.y=(u+h)/2+m):a==="left"?(v.textBaseline="middle",v.textAlign="end",v.x=(c-h)/2-m,v.y=_):(v.textBaseline="middle",v.textAlign="start",v.x=(c+h)/2+m,v.y=_),pt.text(Object.assign(Object.assign({},v),d.style))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),Vt(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=t==null?void 0:t.attribute.x;if(e){const n=e==null?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,n),width:Math.abs(i-n)})}else this._track.setAttributes({width:i})}else{const i=t==null?void 0:t.attribute.y;if(e){const n=e==null?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,n),height:Math.abs(i-n)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const r=this._isHorizontal;t.setAttribute(r?"x":"y",e);const a=t.name===Ai.startHandler?this._startHandlerText:this._endHandlerText;if(a){const{handlerText:o={}}=this.attribute;a.setAttributes({text:o.formatter?o.formatter(i):i.toFixed((n=o.precision)!==null&&n!==void 0?n:0),[r?"x":"y"]:e})}t.name===Ai.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const r=this._isHorizontal,{handlerText:a={}}=this.attribute;t.setAttributes({[r?"x":"y"]:e,text:a.formatter?a.formatter(i):i.toFixed((n=a.precision)!==null&&n!==void 0?n:0)});const o=t.name===Ai.startHandlerText?this._startHandler:this._endHandler;o&&o.setAttributes({[r?"x":"y"]:e}),t.name===Ai.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(e==null?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(e==null?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}}Rh.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};b6();class rm extends zx{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},rm.defaultAttributes,t)),this.name="colorLegend",this._onSliderChange=i=>{this._updateColor(),this.dispatchEvent(i)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:n,min:r,max:a,value:o,railWidth:l,railHeight:h,showHandler:d=!0,handlerSize:u,handlerStyle:c,railStyle:p,trackStyle:g,startText:f,endText:_,handlerText:m,showTooltip:v,tooltip:y,disableTriggerEvent:b}=this.attribute,x=[],S=(a-r)/(t.length-1);for(let k=0;k<t.length;k++)x.push(r+S*k);this._colorScale=new Qs().domain(x,!0).range(t),this._color=this._getTrackColor();const A=new Rh({x:0,y:0,range:{draggableTrack:!0},slidable:e,layout:i,align:n,min:r,max:a,value:o,railWidth:l,railHeight:h,showHandler:d,handlerSize:u,handlerStyle:c,railStyle:p,trackStyle:Object.assign({fill:this._color},g),startText:f,endText:_,handlerText:m,showTooltip:v,tooltip:y,disableTriggerEvent:b});this._innerView.add(A),this._slider=A,A.translateTo(0-A.AABBBounds.x1,(this._title?this._title.AABBBounds.height()+Et(this.attribute,"title.space",gc):0)-A.AABBBounds.y1),this._updateColor()}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&this._slider.addEventListener("change",this._onSliderChange)}_getTrackColor(){const{colors:t,layout:e}=this.attribute;if(ft(t))return;const i=t.length;if(i===1)return t[0];const n=[];for(let a=0;a<i;a++){const o=a/(i-1);n.push({offset:o,color:t[a]})}const r=e==="horizontal";return{gradient:"linear",stops:n,x0:0,y0:0,x1:r?1:0,y1:r?0:1}}_updateColor(){const{layout:t="horizontal",colors:e,railWidth:i,railHeight:n}=this.attribute,{startHandler:r,endHandler:a,track:o}=this._slider,{startValue:l,endValue:h,startPos:d,endPos:u}=this._slider.currentValue,c=this._colorScale.scale(l),p=this._colorScale.scale(h);r==null||r.setAttribute("fill",c),a==null||a.setAttribute("fill",p);const g=t==="horizontal"?i:n;if(Math.abs(d-u)!==g&&e&&e.length>1){const f=this._color.stops,_=Math.min(d,u),m=Math.max(d,u),v=_/g,y=m/g,b=y-v,x=f.filter(M=>M.offset>v&&M.offset<y),S=Math.min(l,h),A=Math.max(l,h),k=this._colorScale.scale(S),w=this._colorScale.scale(A),T=[{offset:0,color:k}];x.forEach(M=>{T.push({offset:(M.offset-v)/b,color:M.color})}),T.push({offset:1,color:w}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:T}))}}}rm.defaultAttributes={layout:"horizontal",title:{align:"start",space:gc,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};function k6(s="bottom"){let t=0;return s==="top"?`
- M${t},-6L${t-3.5},-2.5
- v5
- h7
- v-5
- Z
- `:s==="left"?(t=1,`
- M${t-6},0L${t-6+2.5},-3.5
- h5
- v7
- h-5
- Z
- `):s==="right"?(t=-1,`
- M${t+6},0L${t+6-2.5},-3.5
- h-5
- v7
- h5
- Z
- `):`
- M${t},6L${t-3.5},2.5
- v-5
- h7
- v5
- Z
- `}x6();class am extends zx{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},am.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=i=>{this.dispatchEvent(i)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:d,handlerStyle:u,railStyle:c,trackStyle:p,startText:g,endText:f,handlerText:_,showTooltip:m,tooltip:v,sizeBackground:y,disableTriggerEvent:b}=this.attribute,x=pt.group({x:0,y:0});this._innerView.add(x);const S=new Rh({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h,handlerSize:d,handlerStyle:Object.assign({symbolType:k6(i)},u),railStyle:c,trackStyle:p,startText:g,endText:f,handlerText:_,showTooltip:m,tooltip:v,disableTriggerEvent:b});x.add(S);let A,k=0;e==="horizontal"?i==="top"?(A=`M0,0L${o},0L${o},12Z`,k=l):(A=`M0,12L${o},12L${o},0Z`,S.setAttribute("y",12)):i==="left"?A=`M${o},0L${o},0L${o+12},${l}L${o},${l}Z`:(A=`M0,${l}L12,${l}L12,0Z`,S.setAttribute("x",12));const w=pt.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(w);const T=this._title?this._title.AABBBounds.height()+Et(this.attribute,"title.space",gc):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}am.defaultAttributes={layout:"horizontal",title:{align:"start",space:gc,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:1,stroke:"#ccc",fill:"#fff"},sizeBackground:{fill:"rgba(20,20,20,0.1)"}};function w6(){He(),qR(),Oa()}w6();let DO=class LO extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},LO.defaultAttributes,t)),this.name="title"}render(){var t,e,i,n,r,a,o,l,h,d,u,c,p,g,f,_,m,v,y,b,x,S,A,k,w,T,M,P,O,D,R,L,B,F,z,N,V,G,X,Z,et,K;const{textType:W,text:it,subtextType:ht,textStyle:dt={},subtext:Rt,subtextStyle:gt={},width:wt,height:kt,minWidth:Lt,maxWidth:Ot,minHeight:mi,maxHeight:Se,align:us,verticalAlign:Ge,padding:Li=0}=this.attribute,ae=as(Li),me=this.createOrUpdateChild("title-container",{x:ae[3],y:ae[0],zIndex:1},"group");if(this.attribute.visible!==!1&&dt.visible!==!1)if(W==="rich"||E(dt.character)){const St=Object.assign({x:(t=dt.x)!==null&&t!==void 0?t:0,y:(e=dt.y)!==null&&e!==void 0?e:0,width:(n=(i=dt.width)!==null&&i!==void 0?i:wt)!==null&&n!==void 0?n:0,height:(a=(r=dt.height)!==null&&r!==void 0?r:kt)!==null&&a!==void 0?a:0,ellipsis:(o=dt.ellipsis)===null||o===void 0||o,wordBreak:(l=dt.wordBreak)!==null&&l!==void 0?l:"break-word",maxHeight:dt.maxHeight,maxWidth:dt.maxWidth,textConfig:(h=dt.character)!==null&&h!==void 0?h:it},dt);this._mainTitle=me.createOrUpdateChild("mainTitle",St,"richtext")}else if(W==="html"){const St=Object.assign({html:Object.assign(Object.assign({dom:it},Sr),dt),x:(d=dt.x)!==null&&d!==void 0?d:0,y:(u=dt.y)!==null&&u!==void 0?u:0,width:(p=(c=dt.width)!==null&&c!==void 0?c:wt)!==null&&p!==void 0?p:0,height:(f=(g=dt.height)!==null&&g!==void 0?g:kt)!==null&&f!==void 0?f:0,ellipsis:(_=dt.ellipsis)===null||_===void 0||_,wordBreak:(m=dt.wordBreak)!==null&&m!==void 0?m:"break-word",maxHeight:dt.maxHeight,maxWidth:dt.maxWidth,textConfig:[]},dt);this._mainTitle=me.createOrUpdateChild("mainTitle",St,"richtext")}else E(it)&&(this._mainTitle=me.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:U(it)?it:[it]},dt),{maxLineWidth:(v=dt.maxLineWidth)!==null&&v!==void 0?v:wt,heightLimit:dt.heightLimit,lineClamp:dt.lineClamp,ellipsis:(y=dt.ellipsis)===null||y===void 0||y,x:0,y:0}),"wrapText"));const ms=this._mainTitle?this._mainTitle.AABBBounds.height():0,Zi=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(this.attribute.visible!==!1&>.visible!==!1)if(ht==="rich"||E(gt.character)){const St=Object.assign({x:(b=gt.x)!==null&&b!==void 0?b:0,y:(x=gt.y)!==null&&x!==void 0?x:0,width:(A=(S=gt.width)!==null&&S!==void 0?S:wt)!==null&&A!==void 0?A:0,height:(w=(k=gt.height)!==null&&k!==void 0?k:kt)!==null&&w!==void 0?w:0,ellipsis:(T=gt.ellipsis)===null||T===void 0||T,wordBreak:(M=gt.wordBreak)!==null&&M!==void 0?M:"break-word",maxHeight:gt.maxHeight,maxWidth:gt.maxWidth,textConfig:(P=gt.character)!==null&&P!==void 0?P:Rt},gt);this._subTitle=me.createOrUpdateChild("subTitle",St,"richtext")}else if(ht==="html"){const St=Object.assign({html:Object.assign(Object.assign({dom:Rt},Sr),gt),x:(O=gt.x)!==null&&O!==void 0?O:0,y:(D=gt.y)!==null&&D!==void 0?D:0,width:(L=(R=gt.width)!==null&&R!==void 0?R:wt)!==null&&L!==void 0?L:0,height:(F=(B=gt.height)!==null&&B!==void 0?B:kt)!==null&&F!==void 0?F:0,ellipsis:(z=gt.ellipsis)===null||z===void 0||z,wordBreak:(N=gt.wordBreak)!==null&&N!==void 0?N:"break-word",maxHeight:gt.maxHeight,maxWidth:gt.maxWidth,textConfig:[]},gt);this._subTitle=me.createOrUpdateChild("subTitle",St,"richtext")}else E(Rt)&&(this._subTitle=me.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:U(Rt)?Rt:[Rt]},gt),{maxLineWidth:(V=gt.maxLineWidth)!==null&&V!==void 0?V:wt,heightLimit:gt.heightLimit,lineClamp:gt.lineClamp,ellipsis:(G=gt.ellipsis)===null||G===void 0||G,x:0,y:ms}),"wrapText"));const Tn=this._subTitle?this._subTitle.AABBBounds.height():0,nn=this._subTitle?this._subTitle.AABBBounds.width():0;let Ke=Math.max(Zi,nn),Ae=ms+((X=gt.height)!==null&&X!==void 0?X:Tn);if(E(wt)&&(Ke=wt,this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",wt),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",wt)),E(kt)&&(Ae=kt),E(Lt)&&Ke<Lt&&(Ke=Lt),E(Ot)&&(this._mainTitle&&this._mainTitle.setAttribute("maxLineWidth",Ot),this._subTitle&&this._subTitle.setAttribute("maxLineWidth",Ot),this._mainTitle&&this._mainTitle.setAttribute("maxWidth",Ot),this._subTitle&&this._subTitle.setAttribute("maxWidth",Ot),Ke>Ot&&(Ke=Ot)),E(mi)&&Ae<mi&&(Ae=mi),E(Se)&&(this._mainTitle&&this._mainTitle.setAttribute("maxHeight",Se),this._subTitle&&this._subTitle.setAttribute("maxHeight",Se-ms),Ae>Se&&(Ae=Se)),me.attribute.width=Ke,me.attribute.height=Ae,me.attribute.boundsPadding=ae,this._mainTitle){if(E(us)||E(dt.align)){const St=dt.align?dt.align:us,$t=(Z=dt.width)!==null&&Z!==void 0?Z:Zi;St==="left"?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):St==="center"?(this._mainTitle.setAttribute("x",$t/2),this._mainTitle.setAttribute("textAlign","center")):St==="right"&&(this._mainTitle.setAttribute("x",$t),this._mainTitle.setAttribute("textAlign","right"))}if(E(Ge)||E(dt.verticalAlign)){const St=dt.verticalAlign?dt.verticalAlign:Ge,$t=dt.height?dt.height:Ae;St==="top"?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):St==="middle"?(this._mainTitle.setAttribute("y",$t/2),this._mainTitle.setAttribute("textBaseline","middle")):St==="bottom"&&(this._mainTitle.setAttribute("y",$t),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(E(us)||E(gt.align)){const St=gt.align?gt.align:us,$t=(et=gt.width)!==null&&et!==void 0?et:nn;St==="left"?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):St==="center"?(this._subTitle.setAttribute("x",$t/2),this._subTitle.setAttribute("textAlign","center")):St==="right"&&(this._subTitle.setAttribute("x",$t),this._subTitle.setAttribute("textAlign","right"))}if(E(Ge)||E(dt.verticalAlign)){const St=gt.verticalAlign?gt.verticalAlign:Ge,$t=ms,We=(K=gt.height)!==null&&K!==void 0?K:0;St==="top"?(this._subTitle.setAttribute("y",$t),this._subTitle.setAttribute("textBaseline","top")):St==="middle"?(this._subTitle.setAttribute("y",$t+We/2),this._subTitle.setAttribute("textBaseline","middle")):St==="bottom"&&(this._subTitle.setAttribute("y",$t+We),this._subTitle.setAttribute("textBaseline","bottom"))}}}};DO.defaultAttributes={textStyle:{ellipsis:"...",fill:"#333",fontSize:20,fontWeight:"bold",textAlign:"left",textBaseline:"top"},subtextStyle:{ellipsis:"...",fill:"#6F6F6F",fontSize:16,fontWeight:"normal",textAlign:"left",textBaseline:"top"}};const kT={title:{style:{text:"",fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{style:{text:"",fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}};function T6(){He(),Da(),Oa()}T6();let M6=class extends ri{constructor(){super(...arguments),this.name="indicator"}render(){var t,e,i;const{visible:n,title:r={},content:a,size:o,limitRatio:l=1/0}=this.attribute,h=Math.min(o.width,o.height)*l,d=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(n!==!0)return void(d&&d.hideAll());if(E(r))if(r.visible!==!1){const c=at({},Et(kT,"title.style"),r.style);c.type==="rich"?this._title=d.createOrUpdateChild("indicator-title",Object.assign(Object.assign({textConfig:c.text},c),{visible:r.visible,x:0,y:0,width:(t=c.width)!==null&&t!==void 0?t:0,height:(e=c.height)!==null&&e!==void 0?e:0}),"richtext"):c.type==="html"?this._title=d.createOrUpdateChild("indicator-title",Object.assign(Object.assign({textConfig:[],html:Object.assign(Object.assign({dom:c.text},Sr),c)},c),{visible:r.visible,x:0,y:0}),"richtext"):this._title=d.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},c),{lineHeight:E(c.lineHeight)?c.lineHeight:c.fontSize,visible:r.visible,x:0,y:0}),"text"),r.autoFit&&H(h)&&this._setLocalAutoFit(h,this._title,r),r.autoLimit&&H(l)&&this._title.setAttribute("maxLineWidth",h)}else{const c=d.find(p=>p.name==="indicator-title",!1);c&&d.removeChild(c),this._title=void 0}if(E(a)){const c=Y(a),p=[];c.forEach((g,f)=>{var _,m;if(g.visible!==!1){const v=at({},Et(kT,"content.style"),g.style);let y;y=v.type==="rich"?d.createOrUpdateChild("indicator-content-"+f,Object.assign(Object.assign({textConfig:v.text},v),{visible:r.visible,x:0,y:0,width:(_=v.width)!==null&&_!==void 0?_:0,height:(m=v.height)!==null&&m!==void 0?m:0}),"richtext"):v.type==="html"?d.createOrUpdateChild("indicator-content-"+f,Object.assign(Object.assign({textConfig:[],html:Object.assign(Object.assign({dom:v.text},Sr),v)},v),{visible:r.visible,x:0,y:0}),"richtext"):d.createOrUpdateChild("indicator-content-"+f,Object.assign(Object.assign({},v),{lineHeight:E(v.lineHeight)?v.lineHeight:v.fontSize,visible:g.visible,x:0,y:0}),"text"),g.autoFit&&H(h)&&this._setLocalAutoFit(h,y,g),g.autoLimit&&H(l)&&y.setAttribute("maxLineWidth",h),p.push(y)}else{const v=d.find(y=>y.name==="indicator-content-"+f,!1);v&&d.removeChild(v)}}),this._content=p}this._setGlobalAutoFit(h),this._setYPosition();const u=(i=d==null?void 0:d.AABBBounds.height())!==null&&i!==void 0?i:0;d.setAttribute("y",o.height/2-u/2),d.setAttribute("x",o.width/2)}_setLocalAutoFit(t,e,i){var n,r,a,o,l,h,d,u;if(((n=i.fitStrategy)!==null&&n!==void 0?n:"default")!=="default")return;const c=$_((a=(r=i.style)===null||r===void 0?void 0:r.text)!==null&&a!==void 0?a:"",(o=i.style)!==null&&o!==void 0?o:{},(l=this.stage)===null||l===void 0?void 0:l.getTheme().text.fontFamily).width;if(c>0){const p=t*((h=i.fitPercent)!==null&&h!==void 0?h:.5)/c,g=Math.floor(((u=(d=i.style)===null||d===void 0?void 0:d.fontSize)!==null&&u!==void 0?u:20)*p);e.setAttribute("fontSize",g),e.setAttribute("lineHeight",E(i.style.lineHeight)?i.style.lineHeight:g)}}_setGlobalAutoFit(t){var e,i,n,r,a,o,l;const h=t/2,d=[];let u=0;const c=(e=this.attribute.title)!==null&&e!==void 0?e:{};c.autoFit&&c.fitStrategy==="inscribed"?(this._title.setAttribute("fontSize",12),d.push({text:this._title,spec:(i=this.attribute.title)!==null&&i!==void 0?i:{}})):u+=(o=(a=(r=(n=this._title)===null||n===void 0?void 0:n.AABBBounds)===null||r===void 0?void 0:r.height)===null||a===void 0?void 0:a.call(r))!==null&&o!==void 0?o:0;const p=(l=c.space)!==null&&l!==void 0?l:0;if(u+=p,Y(this.attribute.content).filter(x=>x.visible!==!1).forEach((x,S)=>{var A,k,w,T;const M=this._content[S];x.autoFit&&x.fitStrategy==="inscribed"?(M.setAttribute("fontSize",12),d.push({text:M,spec:x})):u+=(w=(k=(A=M==null?void 0:M.AABBBounds)===null||A===void 0?void 0:A.height)===null||k===void 0?void 0:k.call(A))!==null&&w!==void 0?w:0;const P=(T=x.space)!==null&&T!==void 0?T:0;u+=P}),d.length<=0)return;const g=12/d.reduce((x,S)=>Math.max(x,S.text.AABBBounds.width()),0)*d.length,f=u/2,_=g**2+1,m=2*f*g,v=f**2-h**2,y=2*(g*((-m+Math.sqrt(m**2-4*_*v))/(2*_))+f),b=(y-u)/d.length;H(y)&&d.forEach(x=>{var S;const A=(S=x.spec.style)===null||S===void 0?void 0:S.lineHeight;x.text.setAttribute("fontSize",b),x.text.setAttribute("lineHeight",E(A)?A:b)})}_setYPosition(){var t,e,i,n,r,a;let o=0;const l=(n=(i=(e=(t=this._title)===null||t===void 0?void 0:t.AABBBounds)===null||e===void 0?void 0:e.height)===null||i===void 0?void 0:i.call(e))!==null&&n!==void 0?n:0,h=(a=(r=this.attribute.title)===null||r===void 0?void 0:r.space)!==null&&a!==void 0?a:0;Y(this.attribute.content).filter(d=>d.visible!==!1).forEach((d,u)=>{var c;const p=this._content[u];p.setAttribute("y",l+h+o);const g=(c=d.space)!==null&&c!==void 0?c:0;o+=p.AABBBounds.height()+g})}};const C6="M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -73.1429 161.4994 a 48.7619 48.7619 0 0 1 25.9901 7.5093 l 201.7524 127.1223 a 48.7619 48.7619 0 0 1 0.3657 82.2613 l -201.7524 129.6335 A 48.7619 48.7619 0 0 1 292.5952 540.1838 v -256.7314 a 48.7619 48.7619 0 0 1 48.7619 -48.7619 z m 24.381 92.9402 v 167.9116 l 131.9497 -84.7726 L 365.7381 327.6063 z",P6="M 414.5 0.0238 c 228.9128 0 414.4762 185.5634 414.4762 414.4762 s -185.5634 414.4762 -414.4762 414.4762 S 0.0238 643.4128 0.0238 414.5 S 185.5872 0.0238 414.5 0.0238 z m 0 73.1429 C 225.9865 73.1667 73.1667 225.9865 73.1667 414.5 s 152.8198 341.3333 341.3333 341.3333 s 341.3333 -152.8198 341.3333 -341.3333 S 603.0135 73.1667 414.5 73.1667 z m -48.7619 195.0476 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z m 158.4762 0 v 316.9524 h -73.1429 V 268.2143 h 73.1429 z",E6="M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",R6="M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z",O6="m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",D6="M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z";class wv extends nu{constructor(t){super(t)}}var Wn;(function(s){s.OnPlay="onPlay",s.OnPause="onPause",s.OnForward="onForward",s.OnBackward="onBackward"})(Wn||(Wn={}));var nl;(function(s){s.Start="start",s.Pause="pause",s.Forward="forward",s.Backward="backward"})(nl||(nl={}));class hr extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},hr.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:C6},hr.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:P6},hr.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},hr.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},hr.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var i,n,r,a;this._layout=this.attribute.layout,this._layout==="horizontal"?(this._backwardAttr.style.symbolType=(i=this._backwardAttr.style.symbolType)!==null&&i!==void 0?i:E6,this._forwardAttr.style.symbolType=(n=this._forwardAttr.style.symbolType)!==null&&n!==void 0?n:D6):this._layout==="vertical"&&(this._backwardAttr.style.symbolType=(r=this._backwardAttr.style.symbolType)!==null&&r!==void 0?r:O6,this._forwardAttr.style.symbolType=(a=this._forwardAttr.style.symbolType)!==null&&a!==void 0?a:R6)},this._initPlay=()=>{C(this._playController)&&(this._playController=new wv(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{C(this._backwardController)&&(this._backwardController=new wv(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{C(this._forwardController)&&(this._forwardController=new wv(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",i=>{i.stopPropagation(),this._isPaused===!0?this.play():this.pause()}),this._backwardController.addEventListener("pointerdown",i=>{i.stopPropagation(),this.backward()}),this._forwardController.addEventListener("pointerdown",i=>{i.stopPropagation(),this.forward()}))},this.renderPlay=()=>{this._isPaused?this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._startAttr.style)):this._playController.setAttributes(Object.assign({symbolType:this._playController.getComputedAttribute("symbolType")},this._pauseAttr.style))},this.renderBackward=()=>{this._backwardController.setAttributes(this._backwardAttr.style)},this.renderForward=()=>{this._forwardController.setAttributes(this._forwardAttr.style)},this.play=()=>{this._dispatchEvent("ControllerEventEnum.OnPlay")},this.pause=()=>{this._dispatchEvent("ControllerEventEnum.OnPause")},this.forward=()=>{this._dispatchEvent("ControllerEventEnum.OnForward")},this.backward=()=>{this._dispatchEvent("ControllerEventEnum.OnBackward")},this.togglePlay=()=>{this._playController.setAttributes(this._startAttr.style),this._isPaused=!0},this.togglePause=()=>{this._playController.setAttributes(this._pauseAttr.style),this._isPaused=!1},this.updateAttributes(),this._initPlay(),this._initBackward(),this._initForward(),this._initEvents()}render(){this.updateAttributes(),this.renderPlay(),this.renderBackward(),this.renderForward()}}hr.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hr.defaultAttributes={[nl.Start]:{},[nl.Pause]:{},[nl.Backward]:{},[nl.Forward]:{}};const up={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},Tv=[200,10];var Ta;(function(s){s.Default="default",s.Reverse="reverse"})(Ta||(Ta={}));var Oe;(function(s){s.change="change",s.play="play",s.pause="pause",s.backward="backward",s.forward="forward",s.end="end",s.OnChange="change",s.OnPlay="play",s.OnPause="pause",s.OnBackward="backward",s.OnForward="forward",s.OnEnd="end"})(Oe||(Oe={}));const L6=({direction:s,maxIndex:t,dataIndex:e})=>s===Ta.Default&&e===t,B6=({direction:s,minIndex:t,dataIndex:e})=>s===Ta.Reverse&&e===t,I6=({direction:s,maxIndex:t,minIndex:e,dataIndex:i})=>L6({direction:s,maxIndex:t,dataIndex:i})||B6({direction:s,minIndex:e,dataIndex:i}),F6=({direction:s,minIndex:t,dataIndex:e})=>s===Ta.Default&&e===t,j6=({direction:s,maxIndex:t,dataIndex:e})=>s===Ta.Reverse&&e===t,z6=({direction:s,maxIndex:t,minIndex:e,dataIndex:i})=>F6({direction:s,minIndex:e,dataIndex:i})||j6({direction:s,maxIndex:t,dataIndex:i}),Cn=s=>s==="top"||s==="bottom",H6=(s,t,e,i)=>s==="default"?Math.min(t+1,i):Math.max(t-1,e);class fc extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},fc.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var i,n,r;let a;H(this._handlerStyle.size)?a=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(a=ss(this._handlerStyle.size[0],this._handlerStyle.size[1]));const o={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:(i=this.attribute.dataIndex)!==null&&i!==void 0?i:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:H(a)?a:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(Cn(this._orient)){const l=Math.max(0,this._layoutInfo.slider.size),h=(n=this._railStyle.height)!==null&&n!==void 0?n:Tv[1];o.layout="horizontal",o.railHeight=h,o.railWidth=l,o.x=this._layoutInfo.slider.x,o.y=this._layoutInfo.slider.y}else{const l=Math.max(0,this._layoutInfo.slider.size),h=(r=this._railStyle.width)!==null&&r!==void 0?r:Tv[1];o.layout="vertical",o.railWidth=h,o.railHeight=l,o.x=this._layoutInfo.slider.x,o.y=this._layoutInfo.slider.y}return o},this._initSlider=()=>{const i=this._updateSliderAttrs();this._slider=new Rh(i),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const i={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return Cn(this._orient)?(i.layout="horizontal",i.start=Object.assign(Object.assign({},i.start),{style:Object.assign(Object.assign({},i.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.pause=Object.assign(Object.assign({},i.pause),{style:Object.assign(Object.assign({},i.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.backward=Object.assign(Object.assign({},i.backward),{style:Object.assign(Object.assign({},i.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),i.forward=Object.assign(Object.assign({},i.forward),{style:Object.assign(Object.assign({},i.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})):(i.layout="vertical",i.start=Object.assign(Object.assign({},i.start),{style:Object.assign(Object.assign({},i.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.pause=Object.assign(Object.assign({},i.pause),{style:Object.assign(Object.assign({},i.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),i.backward=Object.assign(Object.assign({},i.backward),{style:Object.assign(Object.assign({},i.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),i.forward=Object.assign(Object.assign({},i.forward),{style:Object.assign(Object.assign({},i.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})})),i},this._initController=()=>{const i=this._updateControllerAttrs();this._controller=new hr(i),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1;const{slider:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort((c,p)=>c.order-p.order),r=n.filter(c=>c.position!=="end"),a=n.filter(c=>c.position==="end"),o=(t=Cn(this._orient)?this._railStyle.height:this._railStyle.width)!==null&&t!==void 0?t:Tv[1],l=n.reduce((c,p)=>{const g=p.style.size,f=lt(g)?g:ss(g[0],g[1]);return c+p.space+f},0),h=this._sliderVisible?(Cn(this._orient)?(e=this._size)===null||e===void 0?void 0:e.width:(i=this._size)===null||i===void 0?void 0:i.height)-l:0,d=h-this.attribute.slider.space,u=r.reduce((c,p)=>{const{key:g,space:f,style:{size:_}}=p,m=lt(_)?_:ss(_[0],_[1]);return this._layoutInfo[g]=Object.assign(Object.assign({},this._layoutInfo[g]),{size:m,x:Cn(this._orient)?c+f:(this._size.width-m)/2,y:Cn(this._orient)?(this._size.height-m)/2:c+f}),c+f+m},0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:d,x:Cn(this._orient)?u+this.attribute.slider.space:(this._size.width-o)/2,y:Cn(this._orient)?(this._size.height-o)/2:u+this.attribute.slider.space}),a.reduce((c,p)=>{const{key:g,space:f,style:{size:_}}=p,m=lt(_)?_:ss(_[0],_[1]);return this._layoutInfo[g]=Object.assign(Object.assign({},this._layoutInfo[g]),{size:m,x:Cn(this._orient)?c+f:(this._size.width-m)/2,y:Cn(this._orient)?(this._size.height-m)/2:c+f}),c+f+m},u+h)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}fc.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{visible:!0,space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{visible:!0,start:Object.assign(Object.assign({},up),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},up),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},up),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},up),{key:"backward",position:"start"})}};function BO(){nm(),He(),An()}function G6(){BO()}function W6(){BO()}G6();class N6 extends fc{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var i,n,r,a;super._initAttributes(),this._alternate=(i=this.attribute.alternate)!==null&&i!==void 0&&i,this._interval=(n=this.attribute.interval)!==null&&n!==void 0?n:1e3,this._direction=(r=this.attribute.direction)!==null&&r!==void 0?r:Ta.Default,this._dataIndex=C(this.attribute.dataIndex)?this._direction==="default"?this._minIndex:this._maxIndex:(a=this.attribute.dataIndex)!==null&&a!==void 0?a:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(Wn.OnPlay,i=>{i.stopPropagation(),this.play()}),this._controller.addEventListener(Wn.OnPause,i=>{i.stopPropagation(),this.pause()}),this._controller.addEventListener(Wn.OnForward,i=>{i.stopPropagation(),this.forward()}),this._controller.addEventListener(Wn.OnBackward,i=>{i.stopPropagation(),this.backward()}),this._slider.addEventListener("change",i=>{const n=Math.floor(i.detail.value)+.5;this._dataIndex=i.detail.value>=n?Math.ceil(i.detail.value):Math.floor(i.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(Oe.change)}))},this.play=()=>{this._isPlaying||this._data.length!==1&&(this._controller.togglePause(),this._isPlaying=!0,(I6({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||z6({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===Ta.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(Oe.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Ht.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=i=>{const n=Date.now();if(this._isReachEnd&&n-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();i&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(Oe.change),this._activeIndex=this._dataIndex):n-this._tickTime>=this._interval&&(this._tickTime=n,this._updateDataIndex(H6(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(Oe.change)),(this._direction==="default"&&this._dataIndex>=this._maxIndex||this._direction==="reverse"&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Ht.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=i=>{this._dataIndex=i,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Ht.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(Oe.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Ht.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(Oe.pause))},this.backward=()=>{const i=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(i),this.dispatchCustomEvent(Oe.change),this.dispatchCustomEvent(Oe.backward)},this.forward=()=>{const i=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(i),this.dispatchCustomEvent(Oe.change),this.dispatchCustomEvent(Oe.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var V6=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};W6();class U6 extends fc{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var e,i;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=(e=this.attribute.interval)!==null&&e!==void 0?e:1e3,this._dataIndex=(i=this.attribute.dataIndex)!==null&&i!==void 0?i:this._minIndex;const n=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(n??1)):(this._totalDuration=this._interval*n,this._interval=this.attribute.interval)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(Wn.OnPlay,e=>{e.stopPropagation(),this.play()}),this._controller.addEventListener(Wn.OnPause,e=>{e.stopPropagation(),this.pause()}),this._controller.addEventListener(Wn.OnForward,e=>{e.stopPropagation(),this.forward()}),this._controller.addEventListener(Wn.OnBackward,e=>{e.stopPropagation(),this.backward()}),this._slider.addEventListener("change",e=>{var i;e.stopPropagation();const n=(i=e.detail)===null||i===void 0?void 0:i.value,r=n/this._maxIndex;this._elapsed=r*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(n)}))},this._getSliderValue=()=>{const e=this._elapsed/this._totalDuration;return Math.min(e*this._maxIndex,this._maxIndex)},this._updateSlider=()=>{const e=this._getSliderValue();this._dataIndex=Math.floor(e),this._slider.setValue(Math.min(e,this._maxIndex)),this._dispatchChange(Math.floor(e))},this._dispatchChange=e=>{const i=Math.floor(e);i!==this._activeIndex&&(this._dataIndex=i,this._activeIndex=i,i!==this._maxIndex&&this.dispatchCustomEvent(Oe.change))},this.play=()=>V6(this,void 0,void 0,function*(){this._isPlaying||(this._controller.togglePause(),this._isPlaying=!0,this._elapsed>=this._totalDuration&&(this._elapsed=0),this._startTime=Date.now()-this._elapsed,this.dispatchCustomEvent(Oe.play),this._rafId=Ht.getRequestAnimationFrame()(this._play.bind(this)))}),this._play=()=>{this._elapsed=Date.now()-this._startTime;const e=this._getSliderValue();this._updateSlider(),e>=this._maxIndex?this._playEnd():this._rafId=Ht.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Ht.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(Oe.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Ht.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(Oe.pause))},this.backward=()=>{const e=Date.now(),i=1*this._interval,n=this._elapsed-i;n<=0?(this._elapsed=0,this._startTime=e):(this._elapsed=n,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(Oe.backward)},this.forward=()=>{const e=Date.now(),i=1*this._interval,n=this._elapsed+i;n>=this._totalDuration?(this._startTime=e-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-i,this._elapsed=n),this._updateSlider(),this.dispatchCustomEvent(Oe.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}var Ni;(function(s){s.drawStart="drawStart",s.drawEnd="drawEnd",s.drawing="drawing",s.moving="moving",s.moveStart="moveStart",s.moveEnd="moveEnd",s.brushClear="brushClear"})(Ni||(Ni={}));const ir={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:"pointerup",resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{y1:-1/0,y2:1/0,x1:-1/0,x2:1/0}},$6=5;function Y6(){He(),U_()}const wT={debounce:Xn,throttle:Ea};Y6();let IO=class FO extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},FO.defaultAttributes,t)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=i=>{var n;if(this._outOfInteractiveRange(i))return;i.stopPropagation();const r=(n=this.attribute.brushMoved)===null||n===void 0||n;this._activeMoveState=r&&this._isPosInBrushMask(i),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(i),this._activeMoveState&&this._initMove(i)},this._onBrushing=i=>{this._outOfInteractiveRange(i)||((this._activeDrawState||this._activeMoveState)&&i.stopPropagation(),this._activeDrawState&&this._drawing(i),this._activeMoveState&&this._moving(i))},this._onBrushEnd=i=>{i.preventDefault();const{removeOnClick:n=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&n?(this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={},this._dispatchEvent(Ni.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:i})):(this._activeDrawState&&this._dispatchEvent(Ni.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:i}),this._activeMoveState&&this._dispatchEvent(Ni.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:i})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0,trigger:i=ir.trigger,updateTrigger:n=ir.updateTrigger,endTrigger:r=ir.endTrigger,resetTrigger:a=ir.resetTrigger}=this.attribute;this.stage.addEventListener(i,this._onBrushStart),this.stage.addEventListener(n,wT[t](this._onBrushing,e)),this.stage.addEventListener(r,this._onBrushEnd),this.stage.addEventListener(a,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let n=0;n<i.length;n++){const{points:r=[],dx:a=0,dy:o=0}=i[n].attribute,l=r.map(h=>({x:h.x+a,y:h.y+o}));if($a(l,e.x,e.y))return this._operatingMask=i[n],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,e==="single"&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(Ni.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=(e=this._operatingMask.attribute.dx)!==null&&e!==void 0?e:0,this._operatingMaskMoveDy=(i=this._operatingMask.attribute.dy)!==null&&i!==void 0?i:0;const{interactiveRange:n}=this.attribute,{minY:r=-1/0,maxY:a=1/0,minX:o=-1/0,maxX:l=1/0}=n,{x1:h,x2:d,y1:u,y2:c}=this._operatingMask.globalAABBBounds,p=o-h,g=l-d,f=r-u,_=a-c;this._operatingMaskMoveRangeX=[p,g],this._operatingMaskMoveRangeY=[f,_],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(Ni.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const n=this.eventPosToStagePos(t),{x1:r=0,x2:a=0,y1:o=0,y2:l=0}=(e=this._operatingMask)===null||e===void 0?void 0:e._AABBBounds,{sizeThreshold:h=$6,brushType:d}=this.attribute,u=this._cacheDrawPoints.length;if(this._isDrawedBeforeEnd=Math.abs(a-r)>h||Math.abs(o-l)>h,u>0){const p=(i=this._cacheDrawPoints[this._cacheDrawPoints.length-1])!==null&&i!==void 0?i:{};if(n.x===p.x&&n.y===p.y)return}d==="polygon"||u<=1?this._cacheDrawPoints.push(n):this._cacheDrawPoints[u-1]=n;const c=this._computeMaskPoints();this._operatingMask.setAttribute("points",c),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(Ni.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(e==null?void 0:e.x)&&i.y===(e==null?void 0:e.y))return;const n=i.x-e.x,r=i.y-e.y,a=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,o=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],r))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:a,dy:o}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(Ni.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const r=this._cacheDrawPoints[0],a=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n=t==="rect"?[r,{x:a.x,y:r.y},a,{x:r.x,y:a.y}]:t==="x"?[{x:r.x,y:i[0]},{x:a.x,y:i[0]},{x:a.x,y:i[1]},{x:r.x,y:i[1]}]:t==="y"?[{x:e[0],y:r.y},{x:e[0],y:a.y},{x:e[1],y:a.y},{x:e[1],y:r.y}]:hi(this._cacheDrawPoints),n}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,n=pt.polygon(Object.assign(Object.assign({points:hi(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?(t=e.opacity)!==null&&t!==void 0?t:1:0}));n.name=`brush-${Date.now()}`,this._operatingMask=n,this._container.add(n),this._brushMaskAABBBoundsDict[n.name]=n.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:r=-1/0,maxX:a=1/0}=e,o=this.eventPosToStagePos(t);return o.x>a||o.x<r||o.y>n||o.y<i}eventPosToStagePos(t){var e,i;const{x:n,y:r}=Ht.mapToCanvasPoint(t);return{x:n-(((e=this.stage)===null||e===void 0?void 0:e.x)||0),y:r-(((i=this.stage)===null||i===void 0?void 0:i.y)||0)}}render(){this._bindBrushEvents();const t=this.createOrUpdateChild("brush-container",{},"group");this._container=t}releaseBrushEvents(){const{delayType:t="throttle",delayTime:e=0,trigger:i=ir.trigger,updateTrigger:n=ir.updateTrigger,endTrigger:r=ir.endTrigger,resetTrigger:a=ir.resetTrigger}=this.attribute;this.stage.removeEventListener(i,this._onBrushStart),this.stage.removeEventListener(n,wT[t](this._onBrushing,e)),this.stage.removeEventListener(r,this._onBrushEnd),this.stage.removeEventListener(a,this._onBrushEnd)}};IO.defaultAttributes=ir;const TT=(s,...t)=>{const e=[s.shape,...t.map(r=>r==null?void 0:r.shape)],i=[s.key,...t.map(r=>r==null?void 0:r.key)],n=[s.value,...t.map(r=>r==null?void 0:r.value)];return at(s,...t,{shape:e.every(C)?void 0:at({},...e),key:i.every(C)?void 0:at({},...i),value:n.every(C)?void 0:at({},...n)})},Oo=s=>{const{width:t,height:e,wordBreak:i="break-word",textAlign:n,textBaseline:r,text:a}=s;return Array.isArray(a)?{width:t,height:e,wordBreak:i,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map(o=>Object.assign(Object.assign({},s),{text:o}))}:{width:t,height:e,wordBreak:i,textAlign:n,textBaseline:r,singleLine:!1,textConfig:a.text}},X6={panel:{visible:!0,cornerRadius:[3,3,3,3],fill:"white",shadow:!0,shadowBlur:12,shadowColor:"rgba(0, 0, 0, 0.1)",shadowOffsetX:0,shadowOffsetY:4,shadowSpread:0,stroke:"white"},titleStyle:{value:{fill:"#4E5969",fontFamily:Pd,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:Pd,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:Pd,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:new Me().setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},K6=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];function q6(){He(),Mr(),An(),Da(),Oa()}q6();let jO=class ys extends ri{constructor(t,e){super(e!=null&&e.skipDefault?t:at({},ys.defaultAttributes,t),e),this.name="tooltip"}render(){var t;const{visible:e,content:i,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h}=this.attribute;if(!e)return void this.hideAll();h&&ys.measureTooltip(this.attribute),l&&ys.calculateTooltipPosition(this.attribute);const d=as(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=ys.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",at({symbolType:"circle"},u.shape,{visible:Ve(u)&&Ve(u.shape)}),"symbol"),typeof u.value.text!="object"||u.value.text===null||u.value.text.type!=="rich"&&u.value.text.type!=="html"?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Ve(u)&&Ve(u.value)},Oo(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:(t=u.value.text)!==null&&t!==void 0?t:"",visible:Ve(u)&&Ve(u.value)},u.value),"text"):u.value.text.type==="rich"?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:Ve(u)&&Ve(u.value)},Oo(u.value)),"richtext"):u.value.text.type==="html"&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},Sr),u.value),visible:Ve(u)&&Ve(u.value),width:u.value.width,height:u.value.height,wordBreak:u.value.wordBreak,textAlign:u.value.textAlign,textBaseline:u.value.textBaseline,singleLine:!1,textConfig:[]},u.value),"richtext"));const c=Ve(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:p,textBaseline:g}=u.value,f=n.width-d[3]-d[0]-c;p==="center"?this._tooltipTitle.setAttribute("x",c+f/2):p==="right"||p==="end"?this._tooltipTitle.setAttribute("x",c+f):this._tooltipTitle.setAttribute("x",c),g==="bottom"?this._tooltipTitle.setAttribute("y",u.height):g==="middle"?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=Ve(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),i&&i.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let m=0;i.forEach((v,y)=>{var b,x,S;const A=ys.getContentAttr(this.attribute,y);if(!Ve(A))return;const k=`tooltip-content-${y}`,w=this._tooltipContent.createOrUpdateChild(k,{visible:!0,x:0,y:m},"group");let T=0;if(Ve(A.shape)&&w.createOrUpdateChild(`${k}-shape`,Object.assign({visible:!0,x:A.shape.size/2,y:A.shape.size/2+(((b=In(A.key.lineHeight,A.key.fontSize))!==null&&b!==void 0?b:A.key.fontSize)-A.shape.size)/2},A.shape),"symbol"),o&&(T+=A.shape.size+A.shape.spacing),Ve(A.key)){let M;M=A.key.multiLine?w.createOrUpdateChild(`${k}-key`,Object.assign(Object.assign({visible:!0},Oo(A.key)),{textBaseline:"top"}),"richtext"):typeof A.key.text!="object"||A.key.text===null||A.key.text.type!=="rich"&&A.key.text.type!=="html"?w.createOrUpdateChild(`${k}-key`,Object.assign(Object.assign({visible:!0,text:(x=A.key.text)!==null&&x!==void 0?x:""},A.key),{textBaseline:"top"}),"text"):A.key.text.type==="rich"?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0},Oo(A.key)),{textBaseline:"top"}),"richtext"):w.createOrUpdateChild(`${k}-value`,{html:Object.assign(Object.assign({dom:A.key.text.text},Sr),A.key)},"richtext");const{textAlign:P}=A.key;P==="center"?M.setAttribute("x",T+r/2):P==="right"||P==="end"?M.setAttribute("x",T+r):M.setAttribute("x",T),M.setAttribute("y",0),T+=r+A.key.spacing}if(Ve(A.value)){let M;M=A.value.multiLine?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0},Oo(A.value)),{textBaseline:"top"}),"richtext"):typeof A.value.text!="object"||A.value.text===null||A.value.text.type!=="rich"&&A.value.text.type!=="html"?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0,text:(S=A.value.text)!==null&&S!==void 0?S:""},A.value),{textBaseline:"top"}),"text"):A.value.text.type==="rich"?w.createOrUpdateChild(`${k}-value`,Object.assign(Object.assign({visible:!0},Oo(A.value)),{textBaseline:"top"}),"richtext"):w.createOrUpdateChild(`${k}-value`,{html:Object.assign({dom:A.value.text.text,container:"",width:30,height:30,style:{}},A.value)},"richtext");let P="right";E(A.value.textAlign)?P=A.value.textAlign:Ve(A.key)||(P="left"),M.setAttribute("textAlign",P),P==="center"?M.setAttribute("x",T+a/2):P==="right"||P==="end"?M.setAttribute("x",T+a):M.setAttribute("x",T),T+=a,M.setAttribute("y",0),w.add(M)}m+=A.height+A.spaceRow})}}setAttributes(t,e){const i=Object.keys(t);this.attribute.autoCalculatePosition&&i.every(n=>K6.includes(n))?(this._mergeAttributes(t,i),C(this.attribute.panel.width)&&this.attribute.autoMeasure&&ys.measureTooltip(this.attribute),ys.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},e)):super.setAttributes(t,e)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:r,pointerX:a,pointerY:o,positionX:l,positionY:h,parentBounds:d}=t;let u=a,c=o;return l==="left"?u-=e+n:l==="center"?u-=e/2:u+=n,h==="top"?c-=i+r:h==="middle"?c-=i/2:c+=r,u+e>d.x2&&(u-=e+n),c+i>d.y2&&(c-=i+r),u<d.x1&&(u=d.x1),c<d.y1&&(c=d.y1),t.x=u,t.y=c,t}static measureTooltip(t){const{content:e,contentStyle:i}=t,n=as(t.padding),r=ys.getTitleAttr(t);let a=0,o=n[0]+n[2],l=0;const{value:h,shape:d}=r,{visible:u=!1,symbolType:c=""}=d??{};if(E(h)&&typeof r.value.text!="object"){const{width:p,height:g}=xv(h).quickMeasure(h.text);a=p,l=g}if(u&&cg[c]&&(a+=d.size+d.spacing,l=Math.max(d.size,l)),t.title&&(t.title.width=a,t.title.height=l),Ve(r)&&(o+=l+r.spaceRow),e&&e.length){const p=[];if(e.forEach((g,f)=>{const _=ys.getContentAttr(t,f);(g.key||g.value)&&Ve(_)&&p.push([g,_])}),p.length){let g=!1;const f=[],_=[],m=[];p.forEach(([x,S],A)=>{var k;const{key:w,value:T,shape:M,spaceRow:P}=S,O=Ve(M),D=(k=M==null?void 0:M.symbolType)!==null&&k!==void 0?k:"",R=xv(w),L=xv(T);let B=0;if(Ve(w)){const{width:F,height:z}=R.quickMeasure(w.text);_.push(F),B=Math.max(B,z)}if(Ve(T)){const{width:F,height:z}=L.quickMeasure(T.text);m.push(F),B=Math.max(B,z)}O&&cg[D]&&(g=!0,f.push(M.size),B=Math.max(M.size,B)),x.height=B,o+=B,A<p.length-1&&(o+=P??i.spaceRow)});const v=f.length?Math.max(...f):0,y=_.length?Math.max(..._):0,b=m.length?Math.max(...m):0;a=Math.max(y+b+i.key.spacing+i.value.spacing+(g?v+i.shape.spacing:0),a),e.forEach(x=>{x.width=a}),t.hasContentShape=g,t.keyWidth=y,t.valueWidth=b}}return t.panel.width=a+n[1]+n[3],t.panel.height=o,t}static getTitleAttr(t){return TT({},ys.defaultAttributes.titleStyle,ys.defaultAttributes.title,t.titleStyle,t.title)}static getContentAttr(t,e){return TT({},ys.defaultAttributes.contentStyle,t.contentStyle,t.content[e])}};jO.defaultAttributes=X6;function MT(s){if(s)return s.type===Le.Band?s.bandwidth():s.type===Le.Point?s.step():void 0}const CT=(s,t)=>dc(s)?s.output():s&&Vt(s)?q(s.callback)?e=>s.callback(e,t):q(s.value)?s.value(t):s:s,PT=(s,t)=>s&&(Vt(s)?Object.keys(s).reduce((e,i)=>{const n=s[i];return e[i]=CT(n,t),e},{}):s.map(e=>CT(e,t)));var Z6=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};let J6=-1;class om extends vo{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++J6}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(!((e=this.spec)===null||e===void 0)&&e.dependency){const n=Y(this.spec.dependency).map(r=>ot(r)?this.view.getGrammarById(r):r);this.detach(n)}this.spec.dependency=t;const i=Y(t).map(n=>ot(n)?this.view.getGrammarById(n):n);return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&i.trap===!1||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t,...e){var i,n;return(n=(i=this.view)===null||i===void 0?void 0:i.emit)===null||n===void 0||n.call(i,t,...e),super.emit(t,...e)}emitGrammarEvent(t,...e){return super.emit(t,...e)}evaluateTransform(t,e,i){return Z6(this,void 0,void 0,function*(){if(!t||!t.length)return e;let n=e,r=0;const a=t.length;for(;r<a;){const o=t[r];this.emit(ut.BEFORE_TRANSFORM,o.type),n=o.transform(o.isRawOptions?o.options:PT(o.options,i),n,i,this.view),n!=null&&n.then&&(n=yield n),r++,this.emit(ut.AFTER_TRANSFORM,o.type)}return n})}evaluateTransformSync(t,e,i){if(!t||!t.length)return e;let n=e,r=0;const a=t.length;for(;r<a;){const o=t[r];this.emit(ut.BEFORE_TRANSFORM,o.type),n=o.transform(o.isRawOptions?o.options:PT(o.options,i),n,i,this.view),r++,this.emit(ut.AFTER_TRANSFORM,o.type)}return n}set(t){return!1}id(t){return arguments.length?(this.view.grammars.unrecord(this),this._id=t,this.view.grammars.record(this),this):this._id}name(t){return arguments.length?(this._name=t,this):this._name}attach(t,e=1){return Y(t).filter(i=>!C(i)).forEach(i=>{var n;C(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,((n=this.references.get(i))!==null&&n!==void 0?n:0)+e))}),this}detach(t,e=1){return Y(t).filter(i=>!C(i)).forEach(i=>{const n=this.references.get(i)-e;n>0?this.references.set(i,n-1):(this.references.delete(i),i.targets.includes(this)&&(i.targets=i.targets.filter(r=>r!==this)))}),this}detachAll(){this.references.forEach((t,e)=>{this.detach(e,t)})}link(t){this.grammarSource=t}run(){var t;const e=(t=this.grammarSource)===null||t===void 0?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=(t=this.grammarSource)===null||t===void 0?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach((e,i)=>{E(i.id())&&(t[i.id()]=i.output())}),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return C(this.spec[e])||this.detach(Hi(this.spec[e],this.view)),this.spec[e]=t,this.attach(Hi(t,this.view)),this.commit(),this}}const ET=(s,t,e)=>{var i;if(s==="callback"&&q(t))return{references:[],value:{callback:t,dependency:[]}};if(!C(t.data)){const n=e.getDataById(t.data);return{references:[n],value:n}}if(!C(t.customized)){const n=e.getCustomizedById(t.customized);return{references:[n],value:n}}if(!C(t.scale)){const n=e.getScaleById(t.scale);return{references:[n],value:n}}if(ZV(t)){const n=Hi(t,e);return{references:n,value:t.callback?{value:t.callback,dependency:n}:(i=n==null?void 0:n[0])!==null&&i!==void 0?i:t}}return{value:t}},Q6=(s,t,e)=>{if(C(t))return{value:t};if(U(t)){const i=t.map(n=>ET(s,n,e));return{references:i.reduce((n,r)=>(r.references&&n.concat(r.references),n),[]),value:i.map(n=>n.value)}}return ET(s,t,e)},tY=(s,t)=>{const e=st.getTransform(s.type);if(!e)return;const i={};let n=[];return Object.keys(s).forEach(r=>{var a;if(r==="type")return;const o=s[r];if(r==="dependency")return void((o==null?void 0:o.length)&&(n=n.concat(Ex(o,t))));const l=Q6(r,o,t);l&&(!((a=l.references)===null||a===void 0)&&a.length&&(n=n.concat(l.references)),i[r]=l.value)}),{markPhase:e.markPhase,transform:e.transform,canProgressive:e.canProgressive,type:e.type,options:i,references:n}},Pf=(s,t)=>{if(s!=null&&s.length){const e=[];let i=[];return s.forEach(n=>{var r;const a=tY(n,t);a&&(!((r=a.references)===null||r===void 0)&&r.length&&(i=i.concat(a.references)),e.push(a))}),{transforms:e,refs:i}}return null};var eY=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};const iY=(s,t={},e)=>{if(!ot(s))return Y(s);try{return Y(JSON.parse(s))}catch{return[]}},RT={csv:YP,dsv:$P,tsv:XP,json:iY},sY=(s,t)=>{if(!t||!RT[t.type])return Y(s);const e=t.type==="dsv"?{delimiter:t.delimiter}:{};return RT[t.type](s,e,new Zt(new no))},nY=s=>eY(void 0,void 0,void 0,function*(){try{return(yield fetch(s)).text()}catch{return null}});var rY=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};class aY extends om{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=n=>{const r=mv(n.format,this.parameters());return this._input=sY(n.values,r),this._input},this.load=n=>{var r;if(n.values)return this.ingest(n);const a=mv(n.url,this.parameters()),o=(r=mv(n.format,this.parameters()))!==null&&r!==void 0?r:{type:"json"};return nY(a).then(l=>this.ingest({values:l,format:o}))},this.relay=n=>n[0],this.evaluateSync=(n,r)=>{this.view.emit(ut.BEFORE_EVALUATE_DATA);const a=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),o=this.evaluateTransformSync(a,this.grammarSource?n:this._input,r),l=this._evaluateFilter(o,r);return this.setValues(l),this._isLoaded=!0,this.view.emit(ut.AFTER_EVALUATE_DATA),this},this._loadTasks=[],C(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],n=t.format?Hi(t.format,this.view)[0]:null;if(n&&e.push(n),t.values){const r=Hi(t.values,this.view)[0];r&&e.push(r),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const r=Hi(t.url,this.view)[0];r&&e.push(r),i.push({type:"load",transform:this.load,options:{url:r??t.url,format:n??t.format}})}else if(t.source){const r=[];Y(t.source).forEach(a=>{const o=dc(a)?a:this.view.getDataById(a);o&&(e.push(o),r.push(o))}),r.length&&(i.push({type:"relay",transform:this.relay,options:r}),this.grammarSource=r[0])}return{transforms:i,refs:e}}evaluate(t,e){return rY(this,void 0,void 0,function*(){this.view.emit(ut.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),r=this._evaluateFilter(n,e);return this.setValues(r),this._isLoaded=!0,this.view.emit(ut.AFTER_EVALUATE_DATA),this})}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e,i=!0){const n=Object.assign({},this.spec,{values:t,format:e});return C(t)||(n.url=void 0,n.source=void 0),i?this.parseLoad(n):this}url(t,e,i=!0){const n=Object.assign({},this.spec,{url:t,format:e});return C(t)||(n.values=void 0,n.source=void 0),i?this.parseLoad(n):this}source(t,e,i=!0){const n=Object.assign({},this.spec,{source:t,format:e});return C(t)||(n.values=void 0,n.url=void 0),i?this.parseLoad(n):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map((e,i)=>{const n=e===Object(e)?e:{data:e};return n[this._dataIDKey]=i,n})}field(t){return this._values.map(e=>e[t])}transform(t){const e=Pf(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=Pf(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort((e,i)=>{var n,r;return((n=e.rank)!==null&&n!==void 0?n:0)-((r=i.rank)!==null&&r!==void 0?r:0)}),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter(i=>!e.includes(i)),this}_evaluateFilter(t,e){return this._postFilters.reduce((i,n)=>n.filter(i,e),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}const to="window",Xa="view",oY="browser",lY={trap:!1},Jr="width",Qr="height",Nl="viewWidth",Vl="viewHeight",js="padding",Gx="viewBox",Dd="autoFit";function hY(s){const t=Object.assign({defaults:{}},s),e=(i,n)=>{n.forEach(r=>{U(i[r])&&(i[r]=i[r].reduce((a,o)=>(a[o]=!0,a),{}))})};return e(t.defaults,["prevent","allow"]),e(t,[Xa,to]),t}function dY(s,t){const e=s.defaults,i=e.prevent,n=e.allow;return i!==!1&&n!==!0&&(i===!0||n===!1||(i?i[t]:!!n&&!n[t]))}function uY(s,t,e){const i=s==null?void 0:s[t];return!(i===!1||Vt(i)&&!i[e])}function Ip(s,t,e,i){let n,r;const a=s[t];for(;t>e&&(r=Math.floor((t-1)/2),n=s[r],a&&n&&i(a,n)<0);)s[t]=n,t=r;return s[t]=a}function Mv(s,t,e,i){const n=t,r=s.length,a=s[t];let o,l=2*t+1;for(;l<r;)o=l+1,o<r&&i(s[l],s[o])>=0&&(l=o),s[t]=s[l],l=2*(t=l)+1;return s[t]=a,Ip(s,t,n,i)}class cY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return Ip(this.nodes,e,0,this.compare),Mv(this.nodes,e,null,this.compare)}return this.nodes.push(t),Ip(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),Ip(this.nodes,e,0,this.compare),Mv(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,Mv(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class OT{constructor(t){this.list=[],this.ids={},this.idFunc=t||XN}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter(i=>i!==t)),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var DT=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};class pY{constructor(){this.grammars=[],this.logger=zt.getInstance(),this._curRank=0,this._committed=new OT(t=>t.uid),this._heap=new cY((t,e)=>(t==null?void 0:t.qrank)-(e==null?void 0:e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return DT(this,void 0,void 0,function*(){try{yield t(this)}catch(e){this.logger.error(e)}})}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter(e=>e!==t))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach(r=>{e.push(r),r===t&&this.logger.error("Cycle detected in dataflow graph.")})}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce((i,n,r)=>C(n.value)?i:`${i}${r?" , ":""}${n.key}: ${n.value}`,"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach(t=>{t.targets.some(e=>(e==null?void 0:e.rank)<(t==null?void 0:t.rank))&&this._reRank(t)}),this._committed.forEach(t=>this._enqueue(t)),this._committed=new OT(t=>t.uid)}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach(e=>this._enqueue(e))}evaluate(){return DT(this,void 0,void 0,function*(){if(this._isReleased)return;if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,r=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0&&!this._isReleased;)if(t=this._heap.pop(),t)if(t.rank===t.qrank){if(e=t.run(),e&&e.then&&(e=yield e),!this._isRunning)return!1;this._logGrammarRunInfo(t),this._enqueueTargets(t),r+=1}else this._enqueue(t)}catch(a){this._heap.clear(),n=a}return!this._isReleased&&(this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${r} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0)})}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}stop(){this._isRunning&&(this._isRunning=!1)}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this.stop(),this._isReleased=!0,this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const Cv=(s,t,e,i,n)=>{const r=a=>{if(n||!a||i&&!i(a)||e.call(null,a),a.markType===nt.group){const o=a[t];o&&o.forEach(l=>{r(l)})}n&&(!a||i&&!i(a)||e.call(null,a))};r(s)};class gY{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(ut.AFTER_VRENDER_DRAW),this._view.emit(ut.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return(t=this._stage)!==null&&t!==void 0?t:null}gestureController(){var t;return(t=this._gestureController)!==null&&t!==void 0?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&nH(this._stage).then(()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return(n=(i=this._stage)===null||i===void 0?void 0:i.setDpr)===null||n===void 0||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(ut.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(ut.AFTER_STAGE_RESIZE),this}setViewBox(t,e=!0){return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(t=!1){return this._view.emit(ut.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(ut.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree(e=>{e.release()}),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==((t=this._viewOptions)===null||t===void 0?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,r;this._view.emit(ut.BEFORE_CREATE_VRENDER_STAGE);const a=this._viewOptions,o=(t=a.stage)!==null&&t!==void 0?t:qW({width:this._width,height:this._height,renderStyle:a.renderStyle,viewBox:a.viewBox,dpr:a.dpr,canvas:a.renderCanvas,canvasControled:a.canvasControled,container:a.container,title:a.rendererTitle,beforeRender:a.beforeRender,afterRender:a.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:a.pluginList,enableHtmlAttribute:a.enableHtmlAttribute,optimize:a.optimize,supportsTouchEvents:a.supportsTouchEvents,supportsPointerEvents:a.supportsPointerEvents});!((e=a.options3d)===null||e===void 0)&&e.enable&&o.set3dOptions(a.options3d),o.enableIncrementalAutoRender(),this._viewBox=a.viewBox,this._view.emit(ut.AFTER_CREATE_VRENDER_STAGE),this._view.emit(ut.BEFORE_CREATE_VRENDER_LAYER);const l=(i=a.layer)!==null&&i!==void 0?i:o.defaultLayer;if(this._view.emit(ut.AFTER_CREATE_VRENDER_LAYER),!((n=this._eventConfig)===null||n===void 0)&&n.drag&&(this._dragController=new _U(o)),(r=this._eventConfig)===null||r===void 0?void 0:r.gesture){const h=Vt(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new vU(o,h)}return{stage:o,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function fY(s){["touches","changedTouches","targetTouches"].forEach(e=>{s[e]&&s[e].length&&Array.from(s[e]).forEach(i=>{BT(i,LT(i),!1)})});const t=LT(s);return BT(s,t)}function LT(s){return C(s.offsetX)?C(s.x)?s.changedTouches&&s.changedTouches.length?vY(s):{canvasX:0,canvasY:0}:mY(s):_Y(s)}function _Y(s){return{canvasX:s.offsetX,canvasY:s.offsetY}}function mY(s){return{canvasX:s.x,canvasY:s.y}}function vY(s){return{canvasX:s.changedTouches[0].x,canvasY:s.changedTouches[0].y}}function BT(s,t,e=!0){return H(t.canvasX)&&Object.defineProperty(s,"canvasX",{value:t.canvasX,writable:!0}),H(t.canvasY)&&Object.defineProperty(s,"canvasY",{value:t.canvasY,writable:!0}),e&&H(t.clientX)&&Object.defineProperty(s,"clientX",{value:t.clientX,writable:!0}),e&&H(t.clientY)&&Object.defineProperty(s,"clientY",{value:t.clientY,writable:!0}),[t.canvasX,t.canvasY]}function sb(s,t,e,i,n){if(n===to){const r=t.changedTouches?t.changedTouches[0]:t;fY(r)}return t.element=e,t}class yY extends om{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?Be(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(U(t)&&U(this.value)&&t.length===this.value.length){for(let e=0;e<t.length;e++)if(this.value[e]!==t[e])return this._signal=t,this.spec.value=t,!0;return!1}return this._signal!==t&&(this._signal=t,this.spec.value=t,!0)}update(t){return C(t)||this.value(void 0),this.setFunctionSpec(t,"update")}value(t){return C(t)||this.update(void 0),this.spec.value=t,this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this._signal=t.output()),this}clear(){super.clear(),this._signal=null}}let bY=-1;const IT=[Jr,Qr,js,Nl,Vl,Gx,Dd],xY=(s,t,e)=>{var i,n,r,a,o;return[{id:Jr,value:(i=s[Jr])!==null&&i!==void 0?i:0},{id:Qr,value:(n=s[Qr])!==null&&n!==void 0?n:0},{id:js,value:ta((a=(r=s[js])!==null&&r!==void 0?r:t[js])!==null&&a!==void 0?a:e==null?void 0:e.padding)},{id:Nl,update:{callback:(l,h)=>{const d=ta(h[js]);return h[Jr]-d.left-d.right},dependency:[Jr,js]}},{id:Vl,update:{callback:(l,h)=>{const d=ta(h[js]);return h[Qr]-d.top-d.bottom},dependency:[Qr,js]}},{id:Gx,update:{callback:(l,h)=>{const d=ta(h[js]);return(l||new yi).setValue(d.left,d.top,d.left+h[Nl],d.top+h[Vl])},dependency:[Nl,Vl,js]}},{id:Dd,value:(o=s[Dd])!==null&&o!==void 0?o:t[Dd]}]},ta=s=>{var t,e,i,n;return lt(s)?{top:s,bottom:s,left:s,right:s}:{top:(t=s==null?void 0:s.top)!==null&&t!==void 0?t:0,bottom:(e=s==null?void 0:s.bottom)!==null&&e!==void 0?e:0,left:(i=s==null?void 0:s.left)!==null&&i!==void 0?i:0,right:(n=s==null?void 0:s.right)!==null&&n!==void 0?n:0}},SY=s=>{var t;const e=(i,n)=>{var r,a;i.group=n;const o=(r=i.id)!==null&&r!==void 0?r:"VGRAMMAR_MARK_"+ ++bY;i.id=o,((a=i.marks)!==null&&a!==void 0?a:[]).forEach(l=>e(l,o))};return((t=s.marks)!==null&&t!==void 0?t:[]).forEach(i=>e(i,"root")),s},FT=s=>{var t,e,i,n,r;const{reuse:a=NV,morph:o=VV,morphAll:l=UV,animation:h={},enableExitAnimation:d=YV}=s??{};return{reuse:a,morph:o,morphAll:l,animation:{easing:(t=h.easing)!==null&&t!==void 0?t:wy,delay:(e=h.delay)!==null&&e!==void 0?e:Ay,duration:(i=h.duration)!==null&&i!==void 0?i:WR,oneByOne:(n=h.oneByOne)!==null&&n!==void 0?n:ky,splitPath:(r=h.splitPath)!==null&&r!==void 0?r:$V},enableExitAnimation:d}},AY=s=>C(s.markId)?t=>t&&t.mark.id()===s.markId:C(s.markName)?t=>t&&t.mark.name()===s.markName:C(s.type)?t=>t&&t.mark.markType===s.type:()=>!0,kY=(s,t)=>t&&t.debounce?Xn(s,t.debounce):t&&t.throttle?Ea(s,t.throttle):s,wY="@",TY="#",MY=(s,t=Xa)=>{const e={},i=s.split(":");if(i.length===2){const[n,r]=i;n[0]==="#"?(e.markId=n.slice(1),e.source=t):n[0]==="@"?(e.markName=n.slice(1),e.source=t):NR(n)?(e.markType=n,e.source=t):e.source=n===to?to:t,e.type=r}else i.length===1&&(e.type=s,e.source=t);return e};function CY(s){s.mode&&Ht.setEnv(s.mode,s.modeParams||{})}class PY extends $R{constructor(t){super(t),this.getStateAttrs=(e,i)=>{var n,r,a;const o=!C((n=this.runtimeStatesEncoder)===null||n===void 0?void 0:n[e]),l=o?this.runtimeStatesEncoder[e]:(r=this.mark.getSpec().encode)===null||r===void 0?void 0:r[e],h={};if(!l)return h;if(q(l))return h.attributes=l(this.getDatum(),this,e,i),h;if(!o&&(!((a=this.graphicItem.glyphStates)===null||a===void 0)&&a[e]))return this.graphicItem.glyphStates[e];if(l){const d=this.items[0],u=[Object.assign({},d,{nextAttrs:{}})];return nr(this,u,l,this.mark.parameters()),this.coordinateTransformEncode(u),h.attributes=u[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[e]||(this.graphicItem.glyphStates[e]=h):this.graphicItem.glyphStates={[e]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(t={}){if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[uo]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach(i=>{const n=e[i.name];this.glyphGraphicItems[i.name]=i,i.onBeforeAttributeUpdate=r=>this.mark?fu(n,r,this,i.name):r}),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(ut.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=pe(e)?e:this.mark.animate.getAnimationConfigs("state").length!==0;return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(ut.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===ie.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==ie.enter&&this.diffState!==ie.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach(e=>{e.states={}}),this.useStates(this.states)),this.items.map(e=>{e.nextAttrs={}})}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),r=this.glyphMeta.getFunctionEncoder();if(r&&(i=r.call(null,Object.assign({},(e=this.graphicItem)===null||e===void 0?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let a;Object.keys(n).forEach(o=>{var l;if(!C(t[o])){a||(a=Object.assign({},(l=this.graphicItem)===null||l===void 0?void 0:l.attribute,t));const h=n[o].call(null,o,t[o],a,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(h??{}).forEach(d=>{var u;i[d]=Object.assign((u=i[d])!==null&&u!==void 0?u:{},h[d])})}})}return i}encodeDefault(){const t={};if(this.diffState===ie.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(t=!1){return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=fu(this.mark.getAttributeTransforms(),e,this),r=t?this.encodeDefault():null,a=this.encodeCustom(e);return Object.keys(i).forEach(o=>{const l=i[o],h=this.glyphGraphicItems[o],d=a==null?void 0:a[o],u=Object.assign({},d);if(t){const f=r==null?void 0:r[o];Object.keys(f??{}).forEach(_=>{Gs(this.items[0].nextAttrs,_)||Gs(u,_)||(u[_]=f[_])})}const c=Object.assign({},oU(l,e),u),p=this._generateGlyphItems(l,this.items,c);this.coordinateTransformEncode(p);const g=this.transformElementItems(p,l);this.applyGlyphGraphicAttributes(g,o,h),l===nt.shape&&(h.datum=p[0].datum)}),n}}_generateGlyphItems(t,e,i){const n=e.map(r=>Object.assign({},r,{nextAttrs:i}));return GR.includes(t)&&this.mark.getSpec().enableSegments&&n.forEach((r,a)=>{r.nextAttrs=Object.assign({},e[a].nextAttrs,i)}),n}getGraphicAttribute(t,e=!1,i){if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&Gs(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e,i=!0,n){if(!this.graphicItem)return;const r=n?this.glyphGraphicItems[n]:this.graphicItem,a=this.getFinalGraphicAttributes(n),o=this.getPrevGraphicAttributes(n);i&&(a[t]=e),Gs(o,t)||(o[t]=r.attribute[t]),r.setAttribute(t,e)}setGraphicAttributes(t,e=!0,i){if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,r=this.getFinalGraphicAttributes(i),a=this.getPrevGraphicAttributes(i);Object.keys(t).forEach(o=>{e&&(r[o]=t[o]),Gs(a,o)||(a[o]=n.attribute[o])}),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const r in t)W_(r,n,t)||(i[r]=t[r]);return i}applyGlyphGraphicAttributes(t,e,i){var n,r;if(this.mark.needAnimate()){const a=this.diffAttributes(t,e),o=(n=this.getPrevGraphicAttributes(e))!==null&&n!==void 0?n:{},l=(r=this.getFinalGraphicAttributes(e))!==null&&r!==void 0?r:{};Object.keys(a).forEach(h=>{o[h]=i.attribute[h],l[h]=a[h]}),this.setNextGraphicAttributes(a,e),this.setPrevGraphicAttributes(o,e),this.setFinalGraphicAttributes(l,e),i.setAttributes(a)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach(t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)})}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach(t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)})}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach(t=>{t[uo]=null}),this.glyphGraphicItems=null),super.release()}}const Fp=s=>s.markType===nt.glyph?new PY(s):new $R(s);function pr(s,t,e){const i=new Map;if(!s||s.length===0)return{keys:[],data:i};if(!t)return i.set(Gn,e?s.slice().sort(e):s.slice()),{keys:WV,data:i};const n=jl(t);if(s.length===1){const a=n(s[0]);return i.set(a,[s[0]]),{keys:[a],data:i}}const r=new Set;return s.forEach(a=>{var o;const l=n(a),h=(o=i.get(l))!==null&&o!==void 0?o:[];h.push(a),i.set(l,h),r.add(l)}),e&&r.forEach(a=>{i.get(a).sort(e)}),{keys:Array.from(r),data:i}}class Wx{constructor(t,e,i){this.prevData=t!=null&&t.length?pr(t,e??null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach(e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)}),this.prevData.keys.forEach(e=>{t.has(e)&&this.callback(e,null,t.get(e))})}else this.currentData?this.currentData.keys.forEach(t=>{this.callback(t,this.currentData.data.get(t),null)}):this.prevData&&this.prevData.keys.forEach(t=>{this.callback(t,null,this.prevData.data.get(t))})}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}function EY(s,t,e){const i={enter:[],exit:[],update:[]},n=new Wx(s,e);return n.setCallback((r,a,o)=>{C(a)?i.exit.push({prev:o[0]}):C(o)?i.enter.push({next:a[0]}):i.update.push({next:a[0],prev:o[0]})}),n.setCurrentData(pr(t,e)),n.doDiff(),i}function RY(s,t,e){const i={enter:[],exit:[],update:[]},n=new Wx(s,e);return n.setCallback((r,a,o)=>{C(a)?i.exit.push({prev:o}):C(o)?i.enter.push({next:a}):i.update.push({next:a,prev:o})}),n.setCurrentData(pr(t,e)),n.doDiff(),i}const zO=(s,t)=>{if(!s)return null;if(s.from){const e=s.from,i=Object.keys(e);i.forEach(r=>{C(e[r])&&delete e[r]});const n=qg(i,t.mark.markType)&&!E(e.segments);if(n){const r=t.items.map(a=>Object.assign({},a,{nextAttrs:Object.assign({},e)}));s.from=t.transformElementItems(r,t.mark.markType,n)}}if(s.to){const e=s.to,i=Object.keys(e);i.forEach(r=>{C(e[r])&&delete e[r]});const n=qg(i,t.mark.markType)&&!E(e.segments);if(n){const r=t.items.map(a=>Object.assign({},a,{nextAttrs:Object.assign({},e)}));s.to=t.transformElementItems(r,t.mark.markType,n)}}return s};function OY(s,t,e,i){const n=q(t.options)?t.options.call(null,s.getDatum(),s,i):t.options;if(!t.type||!st.getAnimationType(t.type))return null;const r=st.getAnimationType(t.type)(s,n,e);return zO(r,s)}const jT=(s,t,e,i,n)=>q(e)?e(s.getDatum(),s,n):e;function DY(s,t,e,i){const n=t.channel;let r=null;return U(n)?r=n.reduce((a,o)=>(a.from[o]=s.getGraphicAttribute(o,!0),a.to[o]=s.getGraphicAttribute(o,!1),a),{from:{},to:{}}):Vt(n)&&(r=Object.keys(n).reduce((a,o)=>{var l,h;const d=!C((l=n[o])===null||l===void 0?void 0:l.from),u=!C((h=n[o])===null||h===void 0?void 0:h.to);return(d||u)&&(a.from[o]=d?jT(s,0,n[o].from,0,i):void 0,a.to[o]=u?jT(s,0,n[o].to,0,i):s.getGraphicAttribute(o,!1)),a},{from:{},to:{}})),zO(r,s)}class LY extends os{constructor(t,e,i,n,r){super(t,e,i,n,r),this._interpolator=r==null?void 0:r.interpolator,this._element=r==null?void 0:r.element}onBind(){var t,e;this.from=(t=this.from)!==null&&t!==void 0?t:{},this.to=(e=this.to)!==null&&e!==void 0?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class BY extends os{getEndProps(){return this.to}onBind(){var t,e;this.from=(t=this.from)!==null&&t!==void 0?t:{},this.to=(e=this.to)!==null&&e!==void 0?e:{}}onStart(){var t;const e=(t=this.target.constructor.NOWORK_ANIMATE_ATTR)!==null&&t!==void 0?t:Oi,i=Object.keys(e).filter(a=>e[a]!==0);this.subAnimate.animate.preventAttrs(i);const n=Object.assign({},this.from),r=Object.assign({},this.to);Object.keys(r).forEach(a=>{i.includes(a)?(n[a]=r[a],this.from[a]=r[a]):C(n[a])&&(n[a]=this.target.getComputedAttribute(a))}),this.target.setAttributes(n,!1,{type:Pe.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=n,this._toAttribute=r}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:Pe.ANIMATE_END})}update(t,e,i){this.updateCount===0&&this.onFirstRun(),this.updateCount+=1;const n=this.step.getLastProps();Object.keys(n).forEach(r=>{this.subAnimate.animate.validAttr(r)&&(i[r]=n[r])}),this.onUpdate(t,e,i),t&&this.onEnd()}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}dg.mode|=eh.SET_ATTR_IMMEDIATELY;let IY=0;const zT=s=>!C(s)&&s.prototype instanceof os;class FY{constructor(t,e,i){this.id=IY++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),this.runnings.length===0&&this.animationEnd(),this}stop(t="end",e=!0){return this.runnings.forEach(i=>i.stop(t)),this.animationEnd(e),this}pause(){return this.runnings.forEach(t=>t.pause()),this}resume(){return this.runnings.forEach(t=>t.resume()),this}startAt(t){return this.runnings.forEach(e=>{const i=this.unit.initialDelay;e.startAt(i+t)}),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return(t=this.unit.totalTime)!==null&&t!==void 0?t:e}getEndAttributes(){return this.runnings.reduce((t,e)=>Object.assign(t,e.getEndProps()),{})}animationEnd(t=!0){var e;this.isAnimating=!1,this.runnings=null,t&&((e=this.callbackFunction)===null||e===void 0||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem();if(!i)return;const n=i.animate();this.runnings.push(n),n.startAt(this.unit.initialDelay),n.wait(this.unit.loopDelay),this.unit.timeSlices.forEach(r=>{this.animateTimeSlice(n,r,t,e)}),n.wait(this.unit.loopDelayAfter),n.loop(this.unit.loopCount-1),H(this.unit.totalTime)&&setTimeout(()=>{n&&n.stop("end")},this.unit.totalTime),n.onEnd(()=>{this.runnings=this.runnings.filter(r=>r!==n),this.runnings.length===0&&this.animationEnd()})}animateTimeSlice(t,e,i,n){const r=e.delay,a=e.delayAfter,o=e.duration,l=e.effects;if(r>0&&t.wait(r),l.length<0)t.wait(o);else{const h=l.map((d,u)=>{var c;const p=(c=d.type?OY(this.element,d,i,n):d.channel?DY(this.element,d,i,n):void 0)!==null&&c!==void 0?c:{},g=p.custom||(d==null?void 0:d.custom),f=(p==null?void 0:p.customParameters)||(d==null?void 0:d.customParameters);p.from&&Object.keys(p.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&this.element.mark.markType!=="component"&&this.element.getGraphicItem().setAttributes(p.from);const _=zT(g);return!C(g)&&!zT(g)?new LY(p.from,p.to,o,d.easing,{interpolator:g,element:this.element,parameters:f}):_?new g(p.from,p.to,o,d.easing,f):p.to?new BY(p.from,p.to,o,d.easing):void 0}).filter(d=>!C(d));h.length===1?t.play(h[0]):h.length>1&&t.play(new Sz(o,h))}a>0&&t.wait(a)}}function jY(s){var t,e,i,n,r,a,o,l,h,d,u,c;if(C(s.timeSlices)){const g=s;return{startTime:(t=g.startTime)!==null&&t!==void 0?t:iw,totalTime:g.totalTime,oneByOne:(e=g.oneByOne)!==null&&e!==void 0?e:ky,loop:(i=g.loop)!==null&&i!==void 0?i:nw,controlOptions:at({},rw,(n=g.controlOptions)!==null&&n!==void 0?n:{}),timeSlices:[{duration:(r=g.duration)!==null&&r!==void 0?r:WR,delay:(a=g.delay)!==null&&a!==void 0?a:Ay,delayAfter:(o=g.delayAfter)!==null&&o!==void 0?o:sw,effects:[{type:g.type,channel:g.channel,custom:g.custom,easing:(l=g.easing)!==null&&l!==void 0?l:wy,customParameters:g.customParameters,options:g.options}]}]}}const p=Y(s.timeSlices).filter(g=>g.effects&&Y(g.effects).filter(f=>f.channel||f.type).length);if(p.length)return{startTime:(h=s.startTime)!==null&&h!==void 0?h:iw,totalTime:s.totalTime,oneByOne:(d=s.oneByOne)!==null&&d!==void 0?d:ky,loop:(u=s.loop)!==null&&u!==void 0?u:nw,controlOptions:at({},rw,(c=s.controlOptions)!==null&&c!==void 0?c:{}),timeSlices:p.map(g=>{var f,_;return{duration:g.duration,delay:(f=g.delay)!==null&&f!==void 0?f:Ay,delayAfter:(_=g.delayAfter)!==null&&_!==void 0?_:sw,effects:Y(g.effects).filter(m=>m.channel||m.type).map(m=>{var v;return{type:m.type,channel:m.channel,custom:m.custom,easing:(v=m.easing)!==null&&v!==void 0?v:wy,customParameters:m.customParameters,options:m.options}})}}),partitioner:s.partitioner,sort:s.sort}}function HT(s){let t=[];return Object.keys(s).forEach(e=>{t=t.concat(HO(e,s[e]))}),t}function HO(s,t,e=0){const i=[];let n=e;return Y(t).forEach(r=>{var a;const o=jY(r);o&&(i.push({state:s,id:(a=o.id)!==null&&a!==void 0?a:`${s}-${n}`,timeline:o,originConfig:r}),n+=1)}),i}function Dr(s,t,e){return q(s)?s.call(null,t.getDatum(),t,e):s}class GT{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter(e=>!C(e)),this.totalTime=this.animators.reduce((e,i)=>Math.max(e,i.getTotalAnimationTime()),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach(i=>{i.parallelArrangers=e}),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce((i,n)=>Math.max(i,n.totalTime),this.totalTime),e=this.parallelArrangers.reduce((i,n)=>{var r,a;return Math.max(i,(a=(r=n.afterArranger)===null||r===void 0?void 0:r.endTime)!==null&&a!==void 0?a:0)},0);this.parallelArrangers.forEach(i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach(n=>{n.startAt(e)})})}}class WT{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=HT(e??{})}getAnimationConfigs(t){var e;return this.isEnabled?((e=this.configs)!==null&&e!==void 0?e:[]).filter(i=>i.state===t):[]}updateConfig(t){this.configs=HT(t??{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach(i=>{var n;i.isReserved&&i.diffState!==ie.exit&&(i.isReserved=!1);const r=(n=this.elementRecorder.get(i))===null||n===void 0?void 0:n.prevState;this.configs.some(a=>r!==i.diffState&&a.state===r&&a.timeline.controlOptions.stopWhenStateChange)&&this.clearElementAnimation(i,!1)}),this.configs.forEach(i=>{this.animateByTimeline(i,t,e)}),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter(a=>a.state===t),i=this.mark.getAllElements(),n=this.mark.parameters(),r=e.reduce((a,o)=>a.concat(this.animateByTimeline(o,i,n,!0)),[]);return new GT(r)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach(i=>i.stop()),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach(i=>i.pause()),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach(i=>i.resume()),this}run(t){if(!this.isEnabled)return;const e=HO(ew,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),r=e.reduce((a,o)=>a.concat(this.animateByTimeline(o,i,n,!0)),[]);return new GT(r)}stop(){return this.animators.forEach(t=>{t.forEach(e=>e.stop())}),this}pause(){return this.animators.forEach(t=>t.forEach(e=>e.pause())),this}resume(){return this.animators.forEach(t=>t.forEach(e=>e.resume())),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach(e=>{t=t||e.some(i=>i.isAnimating)}),t}isElementAnimating(t){var e;const i=(e=this.elementRecorder.get(t))===null||e===void 0?void 0:e.count;return C(i)||Object.values(i).every(n=>n===0)}getAnimatorCount(){let t=0;return this.animators.forEach(e=>t+=e.length),t}getAllAnimators(){const t=[];return this.animators.forEach(e=>{t.push(...e)}),t}getElementAnimators(t,e){var i;const n=Y(t);let r=[];return e?r=(i=this.animators.get(e))!==null&&i!==void 0?i:[]:this.animators.forEach(a=>{r=r.concat(a)}),r.filter(a=>n.includes(a.element))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.filter(i=>!e.includes(i)),this}disableAnimationState(t){const e=Y(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i,n=!1){var r;const a=[],o=e.filter(l=>{const h=!(l.isReserved&&l.diffState===ie.exit),d=this.getAnimationState(l),u=!this.disabledStates.includes(d),c=n||d===t.state,p=!t.timeline.partitioner||t.timeline.partitioner(l.getDatum(),l,i);return h&&u&&c&&p});if(o.length){C(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&o.sort((h,d)=>t.timeline.sort(h.getDatum(),d.getDatum(),h,d,i));const l={width:this.mark.view.width(),height:this.mark.view.height(),group:(r=this.mark.group)!==null&&r!==void 0?r:null,mark:this.mark,view:this.mark.view,elementCount:o.length,elementIndex:0};o.forEach((h,d)=>{l.elementIndex=d;const u=Object.assign({[XV]:l},i),c=this.getAnimationUnit(t.timeline,h,d,o.length,u);a.push(this.animateElement(t,c,h,l,u))})}return a}animateElement(t,e,i,n,r){var a,o;const l=new FY(i,e,t);if(l.animate(n,r),!l.isAnimating)return;i.diffState===ie.exit&&(i.isReserved=!0);const h=this.timelineCount[t.id]===0;this.timelineCount[t.id]+=1;const d=(a=this.elementRecorder.get(i))!==null&&a!==void 0?a:{prevState:t.state,count:{}};d.prevState=t.state,d.count[t.state]=((o=d.count[t.state])!==null&&o!==void 0?o:0)+1,this.elementRecorder.set(i,d);const u=this.animators.get(t.state);u?u.push(l):this.animators.set(t.state,[l]),l.callback(()=>{this.handleAnimatorEnd(l)});const c={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(ut.ANIMATION_START,c),this.mark.emit(ut.ELEMENT_ANIMATION_START,c,i),l}getAnimationState(t){const e=Be(this.state,this.mark.parameters(),t.getDatum(),t);return e??t.diffState}getAnimationUnit(t,e,i,n,r){const a=[],o=Dr(t.startTime,e,r),l=Dr(t.totalTime,e,r),h=Dr(t.oneByOne,e,r),d=Dr(t.loop,e,r);let u=0;t.timeSlices.forEach(p=>{var g;const f=Dr(p.delay,e,r),_=Dr(p.delayAfter,e,r),m=(g=Dr(p.duration,e,r))!==null&&g!==void 0?g:l/n,v=Y(p.effects).map(y=>Object.assign({},y,{customParameters:Dr(y.customParameters,e,r)}));a.push({effects:v,duration:m,delay:f,delayAfter:_}),u+=f+m+_});const c=lt(h)?h:h===!0?u:0;return{initialDelay:o,loopCount:lt(d)?d:d===!0?1/0:1,loopDelay:c*i,loopDelayAfter:c*(n-i-1),loopAnimateDuration:u,loopDuration:u+c*(n-1),totalTime:l,timeSlices:a}}clearElementAnimation(t,e=!0){this.animators.forEach(i=>{i.forEach(n=>{n.element===t&&(n.animationOptions.state===ie.exit?n.stop("start",!1):n.stop("end",!1),this.handleAnimatorEnd(n,e))})}),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach((e,i)=>{this.clearElement(e,i===t.length-1)})}clearElement(t,e=!0){this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===ie.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t,e=!0){const i=t.element,n=t.animationOptions,r=n.state,a=r===ew,o=this.elementRecorder.get(i).count;o[r]-=1,this.animators.set(r,this.animators.get(r).filter(u=>u!==t)),this.animators.get(r).length===0&&this.animators.delete(r),this.timelineCount[n.id]-=1;const l=this.timelineCount[n.id]===0,h=a?this.immediateConfigs.find(u=>u.id===n.id).originConfig:this.configs.find(u=>u.id===n.id).originConfig;l&&(delete this.timelineCount[n.id],a&&(this.immediateConfigs=this.immediateConfigs.filter(u=>u.id!==n.id))),e&&(Object.keys(this.timelineCount).length===0?this.clearAllElements():r===ie.exit&&o[ie.exit]===0&&this.clearElement(i));const d={mark:this.mark,animationState:r,animationConfig:h};l&&this.mark.emit(ut.ANIMATION_END,d),this.mark.emit(ut.ELEMENT_ANIMATION_END,d,i)}}var zY=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};class Oh extends om{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new WT(this,{}),this.differ=new Wx([]),this.evaluateSync=(n,r)=>{var a;return this.evaluateMainTasks(n,r),!((a=this.renderContext)===null||a===void 0)&&a.progressive||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,r),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const a=ot(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(a)}const r=ot(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(r),this.join((e=t.from)===null||e===void 0?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys((i=this.spec.encode)!==null&&i!==void 0?i:{}).forEach(a=>{this.encodeState(a,{},!0)}),Object.keys((n=t.encode)!==null&&n!==void 0?n:{}).forEach(a=>{this.encodeState(a,t.encode[a])}),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return(t=this._finalParameters)!==null&&t!==void 0?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach(i=>i.mark=this),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this._context=e._context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!C(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach(t=>{t.diffState===ie.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()}),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===Fs.before)return this;const n=(i=this.view.renderer)===null||i===void 0?void 0:i.stage();this.init(n,e);const r=this.evaluateTransformSync(this._getTransformsBeforeJoin(),t??Lp,e);let a=r!=null&&r.progressive?t:r;return this.evaluateGroup(a),this.renderContext=this.parseRenderContext(a,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):(r!=null&&r.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,a=r.progressive.output()),this.emit(ut.BEFORE_MARK_JOIN),this.evaluateJoin(a),this.emit(ut.AFTER_MARK_JOIN),this.emit(ut.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(ut.AFTER_MARK_STATE),this.emit(ut.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(ut.AFTER_MARK_ENCODE)),this.emit(ut.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(ut.AFTER_MARK_UPDATE),this}evaluateGroup(t){if(this.markType===nt.group)return;const e=pr(t??Lp,this.spec.groupBy,this.spec.groupSort),i=e.keys;this._groupKeys=i,this.differ.setCurrentData(e)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter(t=>t.markPhase==="afterEncodeItems")}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter(t=>C(t.markPhase)||t.markPhase==="afterEncode")}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter(t=>t.markPhase==="beforeJoin"):[]}evaluate(t,e){var i;return zY(this,void 0,void 0,function*(){return this.evaluateMainTasks(t,e),!((i=this.renderContext)===null||i===void 0)&&i.progressive||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this})}output(){return this}join(t,e,i,n,r){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,C(t)||(ot(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=r,this.commit(),this}coordinate(t){return ot(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(ie.update,t,e,i)}encodeState(t,e,i,n){if(t===ie.enter&&(this._isReentered=!0),this.spec.encode[t]){const r=this.spec.encode[t];if(Zr(r))this.detach(za(r,this.view));else{const a=ot(e);a&&n||!a&&i?(Object.keys(r).forEach(o=>{this.detach(za(r[o],this.view))}),this.spec.encode[t]={}):a?this.detach(za(r[e],this.view)):Object.keys(e).forEach(o=>{this.detach(za(r[o],this.view))})}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),ot(e)?(this.spec.encode[t][e]=i,this.attach(za(i,this.view))):Zr(e)?(this.spec.encode[t]=e,this.attach(za(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach(r=>{this.attach(za(r,this.view))}))),this.commit(),this}_getEncoders(){var t;return(t=this.spec.encode)!==null&&t!==void 0?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=Pf(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=Pf(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments"];return t===null?(e.forEach(i=>{C(this.spec[i])||(this.spec[i]=void 0)}),this):(e.forEach(i=>{C(t[i])||(this.spec[i]=t[i])}),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return GR.includes(this.markType)}needAnimate(){var t;return!(!((t=this.renderContext)===null||t===void 0)&&t.progressive)&&!C(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach(e=>{e.diffState!==ie.exit||t.includes(e)||t.push(e)}),this.spec.sort&&t.sort((e,i)=>this.spec.sort(e.getDatum(),i.getDatum())),t}getScales(){const t={};return this.references.forEach((e,i)=>{i.grammarType===Sy.scale&&(t[i.id()]=i.output())}),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach(n=>{const r=t[n];r&&!Zr(r)&&Object.keys(r).forEach(a=>{V_(r[a])&&(e[a]=gu(r[a].scale,i))})}),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach(i=>{const n=t[i];Zr(n)||Object.keys(n).forEach(r=>{Rx(n[r])&&(e[r]=n[r].field)})}),e}init(t,e){var i,n,r,a;if(this._delegateEvent||(this._delegateEvent=(h,d)=>{var u;const c=(u=h.target)===null||u===void 0?void 0:u[uo];if((c==null?void 0:c.mark)===this){const p=sb(this.view,h,c,d,Xa);this.emitGrammarEvent(d,p,c)}},this.initEvent()),this.animate||(this.animate=new WT(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const h=gu(this.spec.group,e);this.group=h,h&&h.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=(r=(n=(i=this.group)===null||i===void 0?void 0:i.children)===null||n===void 0?void 0:n.indexOf(this))!==null&&r!==void 0?r:0;if(this.markType!==nt.group){if(!this.graphicItem){const h=Md(this,nt.group,{pickable:!1,zIndex:(a=this.spec.zIndex)!==null&&a!==void 0?a:0});(this.spec.support3d||GV.includes(this.markType))&&h.setMode("3d"),h.name=`${this.id()||this.markType}`,this.graphicItem=h}this.graphicParent=this.graphicItem,!o||this.graphicIndex===l&&this.graphicItem.parent===o||o.insertIntoKeepIdx(this.graphicItem,l)}else this.graphicParent=o;this.graphicIndex=l}update(t){this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==nt.group?(C(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),C(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach(e=>{e.updateGraphicItem({interactive:t.interactive})})):this.elementMap.forEach(e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})})}evaluateJoin(t){var e,i,n,r;this.needClear=!0;const a=jl((n=(e=this.spec.key)!==null&&e!==void 0?e:(i=this.grammarSource)===null||i===void 0?void 0:i.getDataIDKey())!==null&&n!==void 0?n:()=>Gn),o=jl((r=this.spec.groupBy)!==null&&r!==void 0?r:()=>Gn),l=this.spec.sort,h=this.isCollectionMark(),d=new Set(this.elements.filter(p=>p.diffState===ie.enter)),u=[];this.differ.setCallback((p,g,f)=>{const _=p;let m;if(C(g))m=this.elementMap.get(_),m&&(m.diffState=ie.exit);else if(C(f)){m=this.elementMap.has(_)?this.elementMap.get(_):Fp(this),m.diffState===ie.exit&&(m.diffState=ie.enter,this.animate.getElementAnimators(m,ie.exit).forEach(y=>y.stop("start"))),m.diffState=ie.enter;const v=h?p:o(g[0]);m.updateData(v,g,a,this.view),this.elementMap.set(_,m),u.push(m)}else if(m=this.elementMap.get(_),m){m.diffState=ie.update;const v=h?p:o(g[0]);m.updateData(v,g,a,this.view),u.push(m)}d.delete(m)});const c=t??Lp;h||this.differ.setCurrentData(pr(c,p=>`${o(p)}-${a(p)}`,void 0)),this.differ.doDiff(),d.forEach(p=>{this.elementMap.delete(h?p.groupKey:`${p.groupKey}-${p.key}`),p.remove(),p.release()}),this.elements=u,l&&this.elements.length>=2&&this.elements.sort((p,g)=>l(p.getDatum(),g.getDatum()))}evaluateState(t,e,i){e&&t.forEach(n=>{n.state(e,i)})}evaluateGroupEncode(t,e,i){var n;if(this.markType===nt.group){const a=this.elements[0],o={},l=[Object.assign({},(n=a.items)===null||n===void 0?void 0:n[0],{nextAttrs:o})];return nr(a,l,e,i),o}if(!this._groupKeys||!e)return;const r={};return this._groupKeys.forEach(a=>{const o=t.find(l=>l.groupKey===a);o&&(r[a]=Qa(e,o.items&&o.items[0]&&o.items[0].datum,o,i))}),r}evaluateEncode(t,e,i){if(e){this.emit(ut.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const n=this.evaluateGroupEncode(t,e[Fn.group],i);t.forEach(r=>{this.markType===nt.group&&n?r.items.forEach(a=>{a.nextAttrs=Object.assign(a.nextAttrs,n)}):n!=null&&n[r.groupKey]&&!this.isCollectionMark()&&r.items.forEach(a=>{a.nextAttrs=Object.assign(a.nextAttrs,n[r.groupKey])}),r.encodeItems(r.items,e,this._isReentered,i)}),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach(r=>{r.encodeGraphic(this.isCollectionMark()?n==null?void 0:n[r.groupKey]:null)}),this.emit(ut.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach(n=>{n.initGraphicItem()})}addGraphicItem(t,e,i){var n;const r=i??Md(this,this.markType,t);if(r){if(!((n=this.renderContext)===null||n===void 0)&&n.progressive){let a;if(this._groupKeys){const o=this._groupKeys.indexOf(e);o>=0&&(a=this.graphicParent.getChildAt(o))}else a=this.graphicParent.at(0);this.isCollectionMark()?(r.incremental=1,a.appendChild(r)):a.incrementalAppendChild(r)}else this.graphicParent.appendChild(r);return r}}parseRenderContext(t,e){const i=this.markType!==nt.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep<this.spec.progressiveThreshold,n=this.spec.large&&this.spec.largeThreshold>0&&t.length>=this.spec.largeThreshold;if(i){const r=this.differ.getCurrentData();return r&&r.keys&&r.keys.some(a=>r.data.get(a).length>this.spec.progressiveThreshold)?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:r.keys.reduce((a,o)=>Math.max(Math.ceil(r.data.get(o).length/this.spec.progressiveStep),a),1),groupedData:r.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex<this.renderContext.progressive.totalStep||this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.unfinished())}clearProgressive(){this.renderContext&&this.renderContext.progressive&&(this.elements=[],this.graphicParent.children.forEach(t=>{t.incrementalClearChild()}),this.graphicParent.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,r=jl((i=(t=this.spec.key)!==null&&t!==void 0?t:(e=this.grammarSource)===null||e===void 0?void 0:e.getDataIDKey())!==null&&i!==void 0?i:()=>Gn),a=[];if(this.isCollectionMark())return this._groupKeys.forEach((l,h)=>{const d=this.renderContext.progressive.groupedData.get(l),u=this.renderContext.progressive.step,c=d.slice(n*u,(n+1)*u);if(n===0){const p=Fp(this);p.diffState=ie.enter,p.updateData(l,c,r,this.view),a.push(p)}else{const p=this.elements[h];p.updateData(l,c,r,this.view),a.push(p)}}),a;const o={};return this._groupKeys.forEach(l=>{const h=this.renderContext.progressive.groupedData.get(l),d=this.renderContext.progressive.step,u=h.slice(n*d,(n+1)*d),c=[];u.forEach(p=>{const g=Fp(this);g.diffState=ie.enter,g.updateData(l,[p],r,this.view),c.push(g),a.push(g)}),o[l]=c}),{groupElements:o,elements:a}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach(l=>{l.initGraphicItem()});const n=Object.keys(e).reduce((l,h)=>(!e[h]||h!==Fn.enter&&h!==Fn.exit&&h!==Fn.update||(l[h]=nU(this.markType,e[h],this.glyphType).positionEncoder),l),{}),r=this.renderContext.progressive.currentIndex,a=this.isCollectionMark();this.emit(ut.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const o=this.evaluateGroupEncode(t,e[Fn.group],i);if(t.forEach((l,h)=>{const d=r>0||!a&&h>0;!d&&(o!=null&&o[l.groupKey])&&l.items.forEach(u=>{u.nextAttrs=Object.assign(u.nextAttrs,o[l.groupKey])}),l.encodeItems(l.items,d?n:e,this._isReentered,i)}),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach(l=>{l.encodeGraphic()}),this.emit(ut.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),r===0&&!a){const l=t[0].getGraphicItem(),h=l==null?void 0:l.parent;if(h){const d=l.attribute,u={},c={};Object.keys(d).forEach(p=>{["pickable","zIndex"].includes(p)||(Zg(this.markType,p)?c[p]=d[p]:u[p]=d[p])}),h.setTheme({common:u}),l.initAttributes(c)}}}evaluateProgressive(){var t,e,i;if(!((t=this.renderContext)===null||t===void 0)&&t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const l=this.renderContext.beforeTransformProgressive.output();return this.emit(ut.BEFORE_MARK_JOIN),this.evaluateJoin(l),this.emit(ut.AFTER_MARK_JOIN),this.emit(ut.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(ut.AFTER_MARK_STATE),this.emit(ut.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(ut.AFTER_MARK_ENCODE)}if(!(!((e=this.renderContext)===null||e===void 0)&&e.progressive))return;const n=this.renderContext.parameters;this.emit(ut.BEFORE_MARK_JOIN);const r=this.evaluateJoinProgressive(),a=Array.isArray(r)?r:r.elements;if(this.emit(ut.AFTER_MARK_JOIN),this.renderContext.progressive.currentIndex===0?(this.graphicParent.removeAllChild(),this._groupKeys.forEach(l=>{const h=Md(this,nt.group,{pickable:!1,zIndex:this.spec.zIndex});h.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(h)}),this.elements=a):this.elements=this.elements.concat(a),this.emit(ut.BEFORE_MARK_STATE),this.evaluateState(a,this.spec.state,n),this.emit(ut.AFTER_MARK_STATE),this.emit(ut.BEFORE_MARK_ENCODE),Array.isArray(r))this.evaluateEncodeProgressive(a,this._getEncoders(),n);else{const l=r.groupElements;Object.keys(l).forEach(h=>{this.evaluateEncodeProgressive(l[h],this._getEncoders(),n)})}this.emit(ut.AFTER_MARK_ENCODE);const o=(i=this._getTransformsAfterEncode())===null||i===void 0?void 0:i.filter(l=>l.canProgressive===!0);o!=null&&o.length&&this.evaluateTransformSync(o,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach((t,e)=>{t.diffState!==ie.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())})}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:(t=this.getGroupGraphicItem())===null||t===void 0?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:(t=this.spec.morph)!==null&&t!==void 0&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return(t=this.spec.attributeTransforms)!==null&&t!==void 0?t:co[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(((t=this.spec.layout)===null||t===void 0?void 0:t.skipBeforeLayouted)===!0)return!0;let i=this.group;for(;i;){if(((e=i.getSpec().layout)===null||e===void 0?void 0:e.skipBeforeLayouted)===!0)return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,(t=this.group)===null||t===void 0||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach(t=>t.diffState=ie.exit),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach(t=>t.release()),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&Jg(this.graphicItem),this.detachAll(),super.release()}}let HY=class extends Oh{constructor(t,e){super(t,nt.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter(e=>e!==t),this}includesChild(t,e=!0){return!!this.children.includes(t)||!!e&&this.children.some(i=>i.markType===nt.group&&i.includesChild(t,!0))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter(t=>t.needLayout()),this):this}getAttributeTransforms(){return co.rect}evaluateJoin(t){if(!this.elements.length){const e=Fp(this);e.updateData(Gn,Lp,()=>"",this.view),this.elements=[e],this.elementMap.set(Gn,e)}}addGraphicItem(t,e,i){const n=i??Md(this,this.markType,t);if(n)return this.emit(ut.BEFORE_ADD_VRENDER_MARK),n.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(n,this.graphicIndex),this.emit(ut.AFTER_ADD_VRENDER_MARK),n}};function NT(s,t){if(H(s))return s;const e=s.trim();if(e==="auto")return 0;if(e.endsWith("%")){const i=parseFloat(e.substring(0,e.length-1));return H(i)?i*t:0}return 0}function GY(s,t,e){var i,n,r,a;const o=(i=s.gridTemplateRows)!==null&&i!==void 0?i:[e],l=(n=s.gridTemplateColumns)!==null&&n!==void 0?n:[t],h=(r=s.gridRowGap)!==null&&r!==void 0?r:0,d=(a=s.gridColumnGap)!==null&&a!==void 0?a:0,u=o.map(y=>NT(y,e)),c=l.map(y=>NT(y,t)),p=Math.max(0,u.reduce((y,b)=>y-b,e)-u.length*h)/o.filter(y=>y==="auto").length,g=Math.max(0,c.reduce((y,b)=>y-b,t)-c.length*d)/l.filter(y=>y==="auto").length;let f=0;const _=u.map((y,b)=>{const x=o[b]==="auto"?p:y,S=f;return f+=x+h,S});_.push(f);let m=0;const v=c.map((y,b)=>{const x=l[b]==="auto"?g:y,S=m;return m+=x+d,S});return v.push(m),{rows:_,columns:v,rowGap:h,columnGap:d}}function cp(s,t){return Math.min(s<0?s+t:s-1,t)}function VT(s,t,e){let i=cp(s,e),n=cp(t,e);if(H(s)||H(t)?H(s)?H(t)||(i=cp(Math.max(0,n-1),e)):n=cp(i+1,e):(i=1,n=2),i>n){const r=n;n=i,i=r}return{start:i,end:n}}function WY(s,t,e,i,n){const r=s.rows.length,a=s.columns.length,{start:o,end:l}=VT(t,e,r),{start:h,end:d}=VT(i,n,a),u=s.columns[o],c=s.columns[l]-(d===a?0:s.columnGap),p=s.rows[h],g=s.rows[d]-(l===r?0:s.rowGap);return new yi().set(u,p,c,g)}const NY=(s,t,e,i)=>{const n=GY(s.getSpec().layout,e.width(),e.height());t&&t.forEach(r=>{const a=r.getSpec().layout;r.layoutBounds=WY(n,a.gridRowStart,a.gridRowEnd,a.gridColumnStart,a.gridColumnEnd),r.commit()})},VY={[ge.axis]:0,[ge.legend]:1,[ge.slider]:2,[ge.player]:3,[ge.datazoom]:4},UT=s=>{var t,e,i;return(e=(t=s.getSpec().layout)===null||t===void 0?void 0:t.order)!==null&&e!==void 0?e:s.markType==="component"&&(i=VY[s.componentType])!==null&&i!==void 0?i:1/0},$T=(s,t,e,i)=>{const n=e.clone(),r=s.getSpec().layout,a=Ts(r.maxChildWidth,n.width()),o=Ts(r.maxChildHeight,n.width());let l=0,h=0,d=0,u=0;t.forEach(m=>{const v=m.getSpec().layout,y=ta(v.padding),b=i.parseMarkBounds?i.parseMarkBounds(m.getBounds(),m):m.getBounds();if(v.position==="top"||v.position==="bottom"){const x=Math.min(b.height()+y.top+y.bottom,o);v.position==="top"?n.y1+=x:n.y2-=x,b.x1<e.x1&&(l=Math.max(l,e.x1-b.x1)),b.x2>e.x2&&(h=Math.max(h,b.x2-e.x2))}if(v.position==="left"||v.position==="right"){const x=Math.min(b.width()+y.left+y.right,a);v.position==="left"?n.x1+=x:n.x2-=x,b.y1<e.y1&&(d=Math.max(d,e.y1-b.y1)),b.y2>e.y2&&(u=Math.max(u,b.y2-e.y2))}v.position==="outside"&&(n.x1+=Math.max(e.x1-b.x1,0)+y.left,n.x2-=Math.max(b.x2-e.x2,0)+y.right,n.y1+=Math.max(e.y1-b.y1,0)+y.top,n.y2-=Math.max(b.y2-e.y2)+y.bottom)}),l>n.x1-e.x1&&l<e.width()&&(n.x1=e.x1+l),h>e.x2-n.x2&&h<e.width()&&(n.x2=e.x2-h),d>n.y1-e.y1&&d<e.height()&&(n.y1=e.y1+d),u>e.y2-n.y2&&u<e.height()&&(n.y2=e.y2-u);let c=n.y1,p=n.y2,g=n.x1,f=n.x2;const _=t.slice().sort((m,v)=>UT(m)-UT(v));for(let m=0,v=_.length;m<v;m++){const y=_[m],b=y.getSpec().layout,x=ta(b.padding),S=i.parseMarkBounds?i.parseMarkBounds(y.getBounds(),y):y.getBounds();if(b.position==="top"||b.position==="bottom"){const A=Math.min(S.height()+x.top+x.bottom,o);if(b.position==="top"?(y.layoutBounds=new yi().set(n.x1,c-A,n.x2,c),c-=A):(y.layoutBounds=new yi().set(n.x1,p,n.x2,p+A),p+=A),y.relativePosition={top:y.layoutBounds.y1-n.y1,bottom:y.layoutBounds.y1-n.y2},b.align){const k=S.width()+x.left+x.right;k<n.width()&&(b.align==="center"?(y.layoutBounds.x1=(n.x1+n.x2)/2-k/2,y.layoutBounds.x2=y.layoutBounds.x1+k,y.relativePosition.left=y.relativePosition.right=(n.width()-k)/2):b.align==="right"?(y.layoutBounds.x1=n.x2-k,y.layoutBounds.x2=n.x2,y.relativePosition.right=0,y.relativePosition.left=n.width()-k):b.align==="left"&&(y.layoutBounds.x1=n.x1,y.layoutBounds.x2=n.x1+k,y.relativePosition.left=0,y.relativePosition.right=n.width()-k))}}else if(b.position==="left"||b.position==="right"){const A=Math.min(S.width()+x.left+x.right,a);if(b.position==="left"?(y.layoutBounds=new yi().set(g-A,n.y1,g,n.y2),g-=A):(y.layoutBounds=new yi().set(f,n.y1,f+A,n.y2),f+=A),y.relativePosition={left:y.layoutBounds.x1-n.x1,right:y.layoutBounds.x1-n.x2},b.align){const k=S.height()+x.top+x.bottom;A<n.width()&&(b.align==="middle"?(y.layoutBounds.y1=(n.y1+n.y2)/2-k/2,y.layoutBounds.y2=y.layoutBounds.y1+k,y.relativePosition.top=y.relativePosition.bottom=(n.height()-k)/2):b.align==="bottom"?(y.layoutBounds.y1=n.y2-k,y.layoutBounds.y2=n.y2,y.relativePosition.top=n.height()-k,y.relativePosition.bottom=0):b.align==="top"&&(y.layoutBounds.y1=n.y1,y.layoutBounds.y2=n.y1+k,y.relativePosition.bottom=n.height()-k,y.relativePosition.top=0))}}else b.position==="outside"?(g-=Math.max(e.x1-S.x1,0)+x.left,f-=Math.max(S.x2-e.x2,0)+x.right,c-=Math.max(e.y1-S.y1,0)+x.top,p+=Math.max(S.y2-e.y2)+x.bottom):y.layoutBounds=n}return n},GO=(s,t,e)=>{s==null||s.forEach(i=>{var n;if(i.markType!==nt.group)return;const r=i.layoutChildren,a=i.getSpec().layout,o=(n=i.layoutBounds)!==null&&n!==void 0?n:i.getBounds();if(o){if(q(a))a.call(null,i,r,o,t);else if(q(a.callback))a.callback.call(null,i,r,o,t);else if(a.display==="relative")if(a.updateViewSignals){const l=e.getViewBox();l&&o.intersect(l);const h=$T(i,r,o,t),d=h.width(),u=h.height(),c={top:h.y1,right:e.width()-h.x2,left:h.x1,bottom:e.height()-h.y2};e.updateSignal(Nl,d),e.updateSignal(Vl,u),e.updateSignal(js,c)}else $T(i,r,o,t);else a.display==="grid"&&NY(i,r,o);GO(r,t,e)}})};class UY extends Oh{constructor(t,e,i){super(t,nt.glyph,i),this.glyphType=e,this.glyphMeta=st.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=rU(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}const Pv=Symbol.for("key");class $Y{diffGrammar(t,e){return EY(t,e,i=>{var n;return(n=i.id())!==null&&n!==void 0?n:Symbol()})}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let r=[],a=[];t.forEach(u=>{u.markType!==nt.group&&(i.morph&&u.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(u):n.exit.push({prev:[u]})}),e.forEach(u=>{u.markType!==nt.group&&(i.morph&&u.getMorphConfig().morph||i.morphAll||i.reuse)?a.push(u):n.enter.push({next:[u]})});const o=this.diffUpdateByGroup(r,a,u=>u.getMorphConfig().morphKey,u=>u.getMorphConfig().morphKey);r=o.prev,a=o.next,n.update=n.update.concat(o.update);const l=this.diffUpdateByGroup(r,a,u=>u.id(),u=>u.id());r=l.prev,a=l.next,n.update=n.update.concat(l.update);const h=pr(r,u=>{var c,p;return(p=(c=u.group)===null||c===void 0?void 0:c.id)===null||p===void 0?void 0:p.call(c)}),d=pr(a,u=>{var c,p;return(p=(c=u.group)===null||c===void 0?void 0:c.id)===null||p===void 0?void 0:p.call(c)});return Object.keys(d).forEach(u=>{const c=h.data.get(u),p=d.data.get(u);if(c&&p){for(let g=0;g<Math.max(c.length,p.length);g+=1){const f=c[g],_=p[g];f&&_?n.update.push({prev:[f],next:[_]}):f?n.exit.push({prev:[f]}):_&&n.enter.push({next:[_]})}r=r.filter(g=>!c.includes(g)),a=a.filter(g=>!p.includes(g))}}),r.forEach(u=>n.exit.push({prev:[u]})),a.forEach(u=>n.enter.push({next:[u]})),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!C(e.morphElementKey)){const i=jl(e.morphElementKey);t.elements&&t.elements.forEach(n=>{n.morphKey=i(n.getDatum())})}}morph(t,e,i){const n=t.reduce((d,u)=>(this._appendMorphKeyToElements(u),d.concat(u.elements)),[]),r=e.reduce((d,u)=>(this._appendMorphKeyToElements(u),d.concat(u.elements)),[]),a=RY(n,r,d=>{var u;return(u=d.morphKey)!==null&&u!==void 0?u:d.key});t.forEach(d=>{var u,c;return(c=(u=d.animate)===null||u===void 0?void 0:u.disable)===null||c===void 0?void 0:c.call(u)}),e.forEach(d=>{var u,c;return(c=(u=d.animate)===null||u===void 0?void 0:u.disable)===null||c===void 0?void 0:c.call(u)});const o=t.concat(e).reduce((d,u)=>(Object.assign(d,u.parameters()),d),{});let l=0;const h=()=>{l-=1,l===0&&e.forEach(d=>{var u,c;(c=(u=d.animate)===null||u===void 0?void 0:u.enable)===null||c===void 0||c.call(u)})};a.enter.forEach(d=>{d.next.forEach(u=>{this.doMorph([],[u],i,h,o)}),l+=1}),a.update.forEach(d=>{const u=Math.min(d.prev.length,d.next.length),c=this.divideElements(d.prev,u),p=this.divideElements(d.next,u);for(let g=0;g<u;g++)this.doMorph(c[g],p[g],i,h,o),l+=1})}diffUpdateByGroup(t,e,i,n){const r=pr(t,d=>{var u;return(u=i(d))!==null&&u!==void 0?u:Pv}),a=pr(e,d=>{var u;return(u=n(d))!==null&&u!==void 0?u:Pv});let o=t,l=e;const h=[];return a.keys.forEach(d=>{if(d!==Pv){const u=r.data.get(d),c=a.data.get(d);u&&c&&(h.push({prev:u,next:c}),o=o.filter(p=>!u.includes(p)),l=l.filter(p=>!c.includes(p)))}}),{prev:o,next:l,update:h}}doMorph(t,e,i,n,r){var a,o;const l={prev:t.map(_=>_.getDatum()),next:e.map(_=>_.getDatum())},h={prev:t.slice(),next:e.slice()},d=i.animation.easing,u=Be(i.animation.delay,r,l,h),c=Be(i.animation.duration,r,l,h),p=Be(i.animation.oneByOne,r,l,h),g=Be(i.animation.splitPath,r,l,h),f=H(p)&&p>0?_=>lt(p)?_*p:p===!0?_*c:0:void 0;t.length!==1&&t.length!==0||e.length!==1?t.length===1&&e.length>1?Nz(t[0].getGraphicItem(),e.map(_=>_.getGraphicItem()),{delay:u,duration:c,easing:d,onEnd:n,individualDelay:f,splitPath:g}):t.length>1&&e.length===1&&Uz(t.map(_=>_.getGraphicItem()),e[0].getGraphicItem(),{delay:u,duration:c,easing:d,onEnd:n,individualDelay:f,splitPath:g}):jE((o=(a=t[0])===null||a===void 0?void 0:a.getGraphicItem)===null||o===void 0?void 0:o.call(a),e[0].getGraphicItem(),{delay:u,duration:c,easing:d,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map((n,r)=>t.slice(i*r,r===e-1?t.length:i*(r+1)))}}class WO{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=ot(t)?i=>i[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,r=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),C(r)||(this._grammarMap[n][r]?(e=this._warning)===null||e===void 0||e.call(this,r,t):this._grammarMap[n][r]=t)):(this._grammars.customized.push(t),C(r)||(this._grammarMap.customized[r]?(i=this._warning)===null||i===void 0||i.call(this,r,t):this._grammarMap.customized[r]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter(n=>n!==t),C(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter(n=>n!==t),C(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return(e=this._grammarMap.signal[t])!==null&&e!==void 0?e:null}getData(t){var e;return(e=this._grammarMap.data[t])!==null&&e!==void 0?e:null}getScale(t){var e;return(e=this._grammarMap.scale[t])!==null&&e!==void 0?e:null}getCoordinate(t){var e;return(e=this._grammarMap.coordinate[t])!==null&&e!==void 0?e:null}getMark(t){var e;return(e=this._grammarMap.mark[t])!==null&&e!==void 0?e:null}getCustomized(t){var e;return(e=this._grammarMap.customized[t])!==null&&e!==void 0?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values((e=this._grammars)!==null&&e!==void 0?e:{}).forEach(i=>(i??[]).forEach(n=>{t.call(null,n)}))}find(t){let e=null;return this.traverse(i=>t.call(null,i)===!0&&(e=i,!0)),e}filter(t){const e=[];return this.traverse(i=>{t.call(null,i)===!0&&e.push(i)}),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class YY extends WO{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),t.grammarType==="mark"){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach(n=>{const r=n.mark;r.markType===nt.group&&r.includesChild(e,!1)?(n.children.push(i),i.parent=n):e.markType===nt.group&&e.includesChild(r,!1)&&(i.children.push(n),n.parent=i)}),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),t.grammarType==="mark"){const e=t,i=this._markNodes.find(n=>n.mark===e);this._markNodes.forEach(n=>{const r=n.mark;r.markType===nt.group&&r.includesChild(e,!1)?(n.children=n.children.filter(a=>a!==i),i.parent=null):e.markType===nt.group&&e.includesChild(r,!1)&&(i.children=i.children.filter(a=>a!==n),n.parent=null)}),this._markNodes=this._markNodes.filter(n=>n!==i)}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class XY{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this.isEnabled=!0,this._onAnimationStart=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter(i=>{var n;return(n=i==null?void 0:i.animate)===null||n===void 0?void 0:n.isAnimating()}),this._animations.length===0&&this._additionalAnimateMarks.length===0&&this._view.emit(ut.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:e.animationConfig,mark:e.mark})},this._onAnimationEnd=e=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter(i=>{var n;return(n=i==null?void 0:i.animate)===null||n===void 0?void 0:n.isAnimating()}),this._animations=this._animations.filter(i=>i.config!==e.animationConfig||i.mark!==e.mark),this._animations.length===0&&this._additionalAnimateMarks.length===0&&this._view.emit(ut.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(ut.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(ut.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree(t=>{var e,i;t.animate&&((i=(e=t.animate).stop)===null||i===void 0||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&((i=(e=t.animate).stop)===null||i===void 0||i.call(e))}),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree(t=>{var e,i;t.animate&&((i=(e=t.animate).pause)===null||i===void 0||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&((i=(e=t.animate).pause)===null||i===void 0||i.call(e))}),this}resume(){return this._view.traverseMarkTree(t=>{var e,i;t.animate&&((i=(e=t.animate).resume)===null||i===void 0||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&((i=(e=t.animate).resume)===null||i===void 0||i.call(e))}),this}enable(){return this.isEnabled=!0,this._view.traverseMarkTree(t=>{var e,i;t.animate&&((i=(e=t.animate).enable)===null||i===void 0||i.call(e))}),this}disable(){return this.isEnabled=!1,this._view.traverseMarkTree(t=>{var e,i;t.animate&&((i=(e=t.animate).disable)===null||i===void 0||i.call(e))}),this._additionalAnimateMarks.forEach(t=>{var e,i;t.view&&t.animate&&((i=(e=t.animate).stop)===null||i===void 0||i.call(e))}),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree(e=>{var i,n;e.animate&&((n=(i=e.animate).enableAnimationState)===null||n===void 0||n.call(i,t))}),this}disableAnimationState(t){return this._view.traverseMarkTree(e=>{var i,n;e.animate&&((n=(i=e.animate).disableAnimationState)===null||n===void 0||n.call(i,t))}),this}isAnimating(){return this._animations.length!==0||this._additionalAnimateMarks.some(t=>{var e;return((e=t==null?void 0:t.animate)===null||e===void 0?void 0:e.isAnimating())||!1})}animate(){return this.isEnabled?(this._view.traverseMarkTree(t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1},null,!0),this):this}animateAddition(t){return t.animate.animate(),this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(ut.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(ut.ALL_ANIMATION_END,this._onAnimationEnd)}}class NO extends Oh{addGraphicItem(t,e){const i=t==null?void 0:t.text,n=(i==null?void 0:i.type)==="rich",r=Md(this,n?nt.richtext:nt.text,t);return n&&(t.textConfig=[]),super.addGraphicItem(t,e,r)}getAttributeTransforms(){var t;return((t=this.getGroupGraphicItem())===null||t===void 0?void 0:t.type)==="richtext"?co.richtext:co.text}release(){super.release()}}NO.markType=nt.text;const KY={label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#89909d",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},qY={title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#D9DDE4",strokeOpacity:1}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},ZY={style:{stroke:"#f1f2f5"}},JY={style:{stroke:"#f1f2f5"}},QY={layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},t7={title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},e7={title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},i7={start:{x:0,y:0},end:{x:0,y:0}},s7={start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},n7={center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},r7={center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},a7={center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},o7={layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},l7={size:{width:400,height:400},dataLabels:[]},h7={type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},d7={type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},u7={type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},c7={type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},p7={type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},g7={type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},f7={data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},_7={orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},m7={},v7={},y7={},b7={textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},x7={width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}},VO={axis:KY,circleAxis:qY,grid:ZY,circleGrid:JY,discreteLegend:QY,colorLegend:t7,sizeLegend:e7,lineCrosshair:i7,rectCrosshair:s7,sectorCrosshair:n7,circleCrosshair:r7,polygonCrosshair:a7,slider:o7,dataLabel:l7,pointLabel:f7,lineLabel:d7,areaLabel:u7,rectLabel:c7,symbolLabel:p7,arcLabel:g7,lineDataLabel:h7,datazoom:_7,continuousPlayer:m7,discretePlayer:v7,tooltip:y7,title:b7,scrollbar:x7},UO=5,$O={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},Si=Object.assign({},VO);Si.axis=Object.assign({},Si.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),Si.circleAxis=Object.assign({},Si.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),Si.grid=Object.assign({},Si.grid,{style:{stroke:"#404349"}}),Si.circleGrid=Object.assign({},Si.circleGrid,{style:{stroke:"#404349"}}),Si.rectLabel=Object.assign({},Si.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),Si.lineLabel=Object.assign({},Si.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),Si.symbolLabel=Object.assign({},Si.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),Si.title=Object.assign({},Si.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const S7={name:"dark",padding:UO,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:$O,components:Si},A7={name:"default",padding:UO,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:$O,components:VO};let Ka=class gd{static registerTheme(t,e){t&&gd._themes.set(t,e)}static unregisterTheme(t){gd._themes.delete(t)}static getTheme(t){return gd._themes.get(t)}static getDefaultTheme(){return gd.getTheme("default")}};Ka._themes=new Map,Ka.registerTheme("default",A7),Ka.registerTheme("dark",S7);class Nx extends Oh{constructor(t,e,i,n){super(t,nt.component,i),this._componentDatum={[Gn]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=n,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=i??st.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return this.emit(ut.BEFORE_ADD_VRENDER_MARK),this.graphicParent.appendChild(n),this.emit(ut.AFTER_ADD_VRENDER_MARK),n}join(t){return super.join(t,Gn)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[Gn]+=1}evaluateJoin(t){return this.spec.key=Gn,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return(t=this._encoders)!==null&&t!==void 0?t:{}}}var Yh=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};class ko extends vo{static useRegisters(t){t.forEach(e=>{e()})}constructor(t={},e={}){super(),this._observer=null,this._onResize=Xn((...i)=>{const n=this._getContainerSize();n&&this.resize(n.width,n.height)},100),this.delegateEvent=(i,n)=>{var r;const a=(r=i.target)===null||r===void 0?void 0:r[uo],o=sb(this,i,a,n,Xa);this.emit(n,o,a)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach(i=>{i.isDoingProgressive()&&i.evaluateProgressive()}),this.doPreProgressive()},this._config=e,this._options=Object.assign({mode:oY},t),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter(e=>e.name()===t)}getGrammarsByType(t){return this.grammars.filter(e=>e.grammarType===t)}getMarksByType(t){return this.grammars.getAllMarks().filter(e=>e.markType===t)}getMarksByName(t){return this.grammars.getAllMarks().filter(e=>e.name()===t)}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach(n=>{if(dc(n))return void i.push(n);if(n[0]===TY){const a=this.getMarkById(n.slice(1));return void(a&&i.push(a))}const r=n[0]===wY?this.getMarksByName(n.slice(1)):NR(n)?this.getMarksByType(n):null;r&&r.length&&r.forEach(a=>{i.push(a)})}),i}updateSignal(t,e){ot(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new yY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new aY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=st.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=st.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const n=ot(e)?this.getMarkById(e):e;let r;switch(t){case nt.group:r=new HY(this,n);break;case nt.glyph:r=new UY(this,i==null?void 0:i.glyphType,n);break;case nt.component:r=st.hasComponent(i==null?void 0:i.componentType)?st.createComponent(i==null?void 0:i.componentType,this,n,i==null?void 0:i.mode):new Nx(this,i==null?void 0:i.componentType,n,i==null?void 0:i.mode);break;case nt.text:r=new NO(this,t,n);break;default:r=st.hasMark(t)?st.createMark(t,this,n):new Oh(this,t,n)}return this.grammars.record(r),this._dataflow.add(r),r}group(t){return this.mark(nt.group,t)}glyph(t,e){return this.mark(nt.glyph,e,{glyphType:t})}component(t,e,i="2d"){return this.mark(nt.component,e,{componentType:t,mode:i})}axis(t,e="2d"){return this.mark(nt.component,t,{componentType:ge.axis,mode:e})}grid(t,e="2d"){return this.mark(nt.component,t,{componentType:ge.grid,mode:e})}legend(t){return this.mark(nt.component,t,{componentType:ge.legend})}slider(t){return this.mark(nt.component,t,{componentType:ge.slider})}label(t){return this.mark(nt.component,t,{componentType:ge.label})}datazoom(t){return this.mark(nt.component,t,{componentType:ge.datazoom})}player(t){return this.mark(nt.component,t,{componentType:ge.player})}title(t){return this.mark(nt.component,t,{componentType:ge.title})}scrollbar(t){return this.mark(nt.component,t,{componentType:ge.scrollbar})}customized(t,e){const i=st.createGrammar(t,this,e==null?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find(e=>e.uid===t.uid)||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=ot(t)?this.getGrammarById(t):t;return e&&this.grammars.find(i=>i.uid===e.uid)?(e.grammarType==="mark"&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse(t=>{t.grammarType==="signal"&&IT.includes(t.id())||t.grammarType==="mark"&&t.id()==="root"||this.removeGrammar(t)}),this}removeAllGraphicItems(){return this.traverseMarkTree(t=>{t.graphicItem&&(Jg(t.graphicItem),t.elementMap.forEach(e=>{e.resetGraphicItem()}),t.graphicItem=null)}),this}parseSpec(t){var e,i,n,r,a,o;if(this.emit(ut.BEFORE_PARSE_VIEW),this._spec=t,SY(t),t.theme?this.theme(t.theme):this.theme(Ka.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding((i=(e=t.padding)!==null&&e!==void 0?e:this._options.padding)!==null&&i!==void 0?i:this._theme.padding),!this.width()||!this.height()){const h=this._getContainerSize();h&&(this.updateSignal(Jr,h.width),this.updateSignal(Qr,h.height))}!((n=t.signals)===null||n===void 0)&&n.length&&t.signals.forEach(h=>{this.signal().parse(h)}),!((r=t.data)===null||r===void 0)&&r.length&&t.data.forEach(h=>{this.data(null).parse(h)}),!((a=t.coordinates)===null||a===void 0)&&a.length&&t.coordinates.forEach(h=>{var d;(d=this.coordinate(h.type))===null||d===void 0||d.parse(h)}),!((o=t.scales)===null||o===void 0)&&o.length&&t.scales.forEach(h=>{var d;(d=this.scale(h.type))===null||d===void 0||d.parse(h)});const l=st.getGrammars();return Object.keys(l).forEach(h=>{const{specKey:d}=l[h];t[d]&&t[d].length&&t[d].forEach(u=>{this.customized(h,u)})}),t.marks&&t.marks.length&&t.marks.forEach(h=>{this.parseMarkSpec(h)}),t.events&&t.events.length&&t.events.forEach(h=>{this.event(h)}),t.interactions&&t.interactions.length&&t.interactions.forEach(h=>{this.interaction(h.type,h)}),t.animation===!1?this.animate.disable():this.animate.enable(),this.emit(ut.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=Fs.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){xY(this._options,this._config,this.getCurrentTheme()).forEach(t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)}),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseMarkSpec(t){var e;const i=t.type===nt.glyph?{glyphType:t.glyphType}:t.type===nt.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),(e=t.marks)===null||e===void 0||e.forEach(n=>{this.parseMarkSpec(n)})}theme(t){var e,i,n,r,a,o;ot(t)?this._theme=(e=Ka.getTheme(t))!==null&&e!==void 0?e:Ka.getDefaultTheme():this._theme=t;const{background:l,padding:h}=(i=this._spec)!==null&&i!==void 0?i:{};return this._theme?(this.background((n=l??this._options.background)!==null&&n!==void 0?n:this._theme.background),this.padding((r=h??this._options.padding)!==null&&r!==void 0?r:this._theme.padding),(o=(a=this.renderer.stage())===null||a===void 0?void 0:a.setTheme)===null||o===void 0||o.call(a,Object.assign({},this._theme.marks))):(this.background(l??this._options.background),this.padding(h??this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t,e=!0){return Yh(this,void 0,void 0,function*(){if(!this._isReleased){if(this.theme(t),this.grammars.getAllMarks().forEach(i=>{i.commit()}),e){if(yield this.evaluate(),this._isReleased)return;this.renderer.render(!0)}else yield this._dataflow.evaluate();return this}})}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(Jr);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(Qr);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(Nl);if(arguments.length){const i=this.padding();return this.width(t+i.left+i.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(Vl);if(arguments.length){const i=this.padding();return this.height(t+i.top+i.bottom),t}return e.output()}padding(t){const e=this.getSignalById(js);if(arguments.length){const i=ta(t);return this.updateSignal(e,i),i}return ta(e.output())}autoFit(t){const e=this.getSignalById(Dd);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(Gx);return t==null?void 0:t.output()}updateLayoutTag(){return this._layoutState=Fs.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree(i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===nt.group&&i.updateLayoutChildren()},i=>i.needLayout()),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||GO;e&&(!((t=this._layoutMarks)===null||t===void 0)&&t.length)&&(this.emit(ut.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(ut.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(ut.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach(t=>{Cv(t,"layoutChildren",e=>{e.handleLayoutEnd()},e=>e!==t)}),this.emit(ut.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(ut.BEFORE_MARK_RENDER_END),Cv(this.rootMark,"children",t=>{t.handleRenderEnd()}),this.emit(ut.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return Yh(this,void 0,void 0,function*(){if(this._isReleased)return;for(;this._running&&(yield this._running,!this._isReleased););const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running})}runNextTick(t){return Yh(this,void 0,void 0,function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then(()=>this.runAsync(t).then(()=>{this._currentDataflow=null}).catch(e=>{this._currentDataflow=null,this.logger.error(e)}))),yield this._currentDataflow,this})}doRender(t){this.emit(ut.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(ut.AFTER_DO_RENDER)}evaluate(t){var e,i,n,r;return Yh(this,void 0,void 0,function*(){if(this._isReleased)return;const a=FT(t),o=this._cachedGrammars.size()>0;o&&(this.reuseCachedGrammars(a),this.detachCachedGrammar());const l=this._resizeRenderer(),h=this._dataflow.hasCommitted();if(!(o||h||this._layoutState||l))return this;if(this.clearProgressive(),(e=this.renderer)===null||e===void 0||e.preventRender(!0),yield this._dataflow.evaluate(),!this._isReleased){if(this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState){if(this._layoutState=Fs.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=Fs.reevaluate,yield this._dataflow.evaluate(),this._isReleased))return;this._layoutState=Fs.after,!((i=this._layoutMarks)===null||i===void 0)&&i.length&&this.handleLayoutEnd()}return(n=this.renderer)===null||n===void 0||n.preventRender(!1),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),(r=this._willMorphMarks)===null||r===void 0||r.forEach(d=>{this._morph.morph(d.prev,d.next,a)}),this._willMorphMarks=null,this.releaseCachedGrammars(a),this.doPreProgressive(),this}})}evaluateSync(t){var e,i;const n=FT(t),r=this._cachedGrammars.size()>0;r&&(this.reuseCachedGrammars(n),this.detachCachedGrammar());const a=this._resizeRenderer(),o=this._dataflow.hasCommitted();return r||o||this._layoutState||a?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=Fs.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=Fs.reevaluate,this._dataflow.evaluateSync()),this._layoutState=Fs.after,!((e=this._layoutMarks)===null||e===void 0)&&e.length&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),(i=this._willMorphMarks)===null||i===void 0||i.forEach(l=>{this._morph.morph(l.prev,l.next,n)}),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const e=i=>{i.next.reuse(i.prev),i.prev.detachAll(),i.prev.clear(),this._cachedGrammars.unrecord(i.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter(i=>!IT.includes(i.id()))).update.forEach(e),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(e),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(e),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(e)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter(e=>e.id()!=="root"),t).update.forEach(e=>{const i=e.prev.length===1&&e.next.length===1&&e.prev[0].markType===e.next[0].markType,n=e.prev.every(r=>r.getMorphConfig().morph)&&e.next.every(r=>r.getMorphConfig().morph);i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})})}detachCachedGrammar(){this._cachedGrammars.traverse(t=>{var e,i;if(t.detachAll(),t.grammarType==="mark"){const n=t;(i=(e=n.group)===null||e===void 0?void 0:e.removeChild)===null||i===void 0||i.call(e,n)}})}releaseCachedGrammars(t){this._cachedGrammars.traverse(n=>{n.grammarType!=="mark"&&n.release()});const e=this._cachedGrammars.getAllMarkNodes();e.forEach(n=>{n.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(n.mark)});const i=n=>{if(n.mark.view&&n.mark.animate.getAnimatorCount()===0&&(!n.children||n.children.length===0)){n.mark.release();const r=n.parent;r&&(n.parent.children=n.parent.children.filter(a=>a!==n),n.parent=null,i(r))}};e.forEach(n=>{const r=n.mark;r.animate.getAnimatorCount()===0?i(n):r.addEventListener("animationEnd",()=>{r.animate.getAnimatorCount()===0&&i(n)})}),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter(()=>{t.call(null,this)}),this}runBefore(t){return this._dataflow.runBefore(()=>{t.call(null,this)}),this}getImageBuffer(){var t,e;if(this._options.mode!=="node")return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=(e=(t=this.renderer)===null||t===void 0?void 0:t.stage)===null||e===void 0?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return Cv(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,r,a;if(this.autoFit()){const o=(r=(n=(i=(e=(t=this.renderer)===null||t===void 0?void 0:t.stage)===null||e===void 0?void 0:e.call(t))===null||i===void 0?void 0:i.window)===null||n===void 0?void 0:n.getContainer)===null||r===void 0?void 0:r.call(n);if(o){const l=window.ResizeObserver;this._observer=new l(this._onResize),(a=this._observer)===null||a===void 0||a.observe(o)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,r,a,o,l,h,d,u;const c=(r=(n=(i=(e=(t=this.renderer)===null||t===void 0?void 0:t.stage)===null||e===void 0?void 0:e.call(t))===null||i===void 0?void 0:i.window)===null||n===void 0?void 0:n.getContainer)===null||r===void 0?void 0:r.call(n);if(c){const{width:p,height:g}=r0(c);return{width:(l=(o=(a=this._spec)===null||a===void 0?void 0:a.width)!==null&&o!==void 0?o:this._options.width)!==null&&l!==void 0?l:p,height:(u=(d=(h=this._spec)===null||h===void 0?void 0:h.height)!==null&&d!==void 0?d:this._options.height)!==null&&u!==void 0?u:g}}return null}resize(t,e,i=!0){return Yh(this,void 0,void 0,function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(Jr,t)),e!==this.height()&&(n=!0,this.updateSignal(Qr,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this})}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:r,debounce:a,consume:o,target:l,dependency:h}=t,d=MY(e);if(!d)return;const{source:u,type:c}=d,p=AY(d),g=(Array.isArray(l)&&l.length?l.map(m=>({signal:this.getSignalById(m.target),callback:m.callback})):[{signal:ot(l)?this.getSignalById(l):null,callback:n}]).filter(m=>m.signal||m.callback),f=Ex(h,this),_=kY((m,v)=>{const y=u===Xa&&dY(this._eventConfig,c)||o&&(m.cancelable===void 0||m.cancelable);u===to&&(m=sb(this,m,v,c,to));let b=!1;if((!i||i(m))&&(!p||p(v))&&g.length){const x=f.reduce((S,A)=>(S[A.id()]=A.output(),S),{});g.forEach(S=>{S.callback&&S.signal?S.signal.set(S.callback(m,x))&&(this.commit(S.signal),b=!0):S.callback?S.callback(m,x):(this.commit(S.signal),b=!0)})}y&&m.preventDefault(),o&&m.stopPropagation(),b&&this.runAsync()},{throttle:r,debounce:a});if(u===Xa){if(uY(this._eventConfig,Xa,c))return this.addEventListener(c,_,lY),()=>{this.removeEventListener(c,_)}}else if(u===to)return Ht.addEventListener(c,_),this._eventListeners.push({type:c,source:Ht,handler:_}),()=>{Ht.removeEventListener(c,_);const m=this._eventListeners.findIndex(v=>v.type===c&&v.source===Ht&&v.handler===_);m>=0&&this._eventListeners.splice(m,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let r;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const a=this.bindEvents(t);this._eventCache[n]=a}r||(r=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach(e=>{const i=Object.assign({},t);ot(e)?i.type=e:Vt(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)}):this.bindEvents(t)}interaction(t,e){const i=st.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter(n=>{var r;return C(e)?ot(t)?n.type===t:t?n===t:void 0:((r=n.options)===null||r===void 0?void 0:r.id)===e});i.length&&i.forEach(n=>{n.unbind()})}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach(t=>{t.unbind()}),this._boundInteractions=null),this}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&i.trap===!1||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new gY(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t;this.grammars=new WO(e=>e.id(),(e,i)=>this.logger.warn(`Grammar id '${e}' has been occupied`,i)),this._cachedGrammars=new YY(e=>e.id()),this._options.logger&&zt.setInstance(this._options.logger),this.logger=zt.getInstance((t=this._options.logLevel)!==null&&t!==void 0?t:0),this._dataflow=new pY,this.animate=new XY(this),this._morph=new $Y,this._options.hooks&&(Object.keys(this._options.hooks).forEach(e=>{this.on(e,this._options.hooks[e])}),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._eventListeners=[],this._eventConfig=hY(this._options.eventConfig),this._theme=this._options.disableTheme?null:Ka.getDefaultTheme(),this.parseBuiltIn(),CY(this._options),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=Fs.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree(e=>{t.push(e)},e=>e.markType!==nt.group&&e.isProgressive()),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some(t=>t.isDoingProgressive())){const t=Ht.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&Ht.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach(t=>{t.clearProgressive()}),this._progressiveMarks=null)}release(){var t,e,i;this._isReleased=!0,this._unBindResizeEvent(),this.clearProgressive(),st.unregisterRuntimeTransforms(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,(e=(t=this.renderer)===null||t===void 0?void 0:t.release)===null||e===void 0||e.call(t),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),(i=this._eventListeners)===null||i===void 0||i.forEach(n=>{n.source.removeEventListener(n.type,n.handler)}),this._eventListeners=null}}const YO=()=>{Di(),Ox(),st.registerGraphic(nt.arc,px)},k7=()=>{Di(),z$(),st.registerGraphic(nt.arc3d,lR)},w7=()=>{Di(),W$(),st.registerGraphic(nt.pyramid3d,dR)},T7=()=>{Di(),XR(),st.registerGraphic(nt.area,oR)},M7=()=>{Di(),He(),st.registerGraphic(nt.group,sx)},C7=()=>{Di(),KR(),st.registerGraphic(nt.image,cx)},P7=()=>{Di(),Ra(),st.registerGraphic(nt.line,ux)},XO=()=>{Di(),uc(),st.registerGraphic(nt.path,aR)},Vx=()=>{Di(),Mr(),st.registerGraphic(nt.rect,nh)},E7=()=>{Di(),N$(),st.registerGraphic(nt.rect3d,sR)},Ux=()=>{Di(),Ra(),st.registerGraphic(nt.rule,ux)},KO=()=>{Di(),An(),st.registerGraphic(nt.symbol,F_)},qO=()=>{Di(),Da(),Oa(),st.registerGraphic(nt.text,oo)},R7=()=>{Di(),U_(),st.registerGraphic(nt.polygon,hR)},O7=()=>{Di(),Oa(),st.registerGraphic(nt.richtext,rR)},D7=()=>{Di(),An(),st.registerGraphic(nt.cell,F_)},lm=()=>{Di(),G$(),st.registerGraphic(nt.glyph,nR)},ZO=s=>(t,e,i)=>{var n,r,a;const o=(a=(n=t.getGraphicAttribute("direction",!1))!==null&&n!==void 0?n:(r=t.mark.getGlyphConfig())===null||r===void 0?void 0:r.direction)!==null&&a!==void 0?a:"vertical",l=s(t,o,e);if(!H(l))return{};const h=t.getGraphicAttribute("x",!1),d=t.getGraphicAttribute("y",!1),u=t.getGraphicAttribute("min",!1),c=t.getGraphicAttribute("max",!1),p=t.getGraphicAttribute("q1",!1),g=t.getGraphicAttribute("q3",!1),f=t.getGraphicAttribute("median",!1),_={from:{x:h,y:d},to:{x:h,y:d}};return H(u)&&(_.from.min=l,_.to.min=u),H(c)&&(_.from.max=l,_.to.max=c),H(p)&&(_.from.q1=l,_.to.q1=p),H(g)&&(_.from.q3=l,_.to.q3=g),H(f)&&(_.from.median=l,_.to.median=f),_},JO=s=>(t,e,i)=>{var n,r,a;const o=(a=(n=t.getGraphicAttribute("direction",!1))!==null&&n!==void 0?n:(r=t.mark.getGlyphConfig())===null||r===void 0?void 0:r.direction)!==null&&a!==void 0?a:"vertical",l=s(t,o,e);if(!H(l))return{};const h=t.getGraphicAttribute("x",!0),d=t.getGraphicAttribute("y",!0),u=t.getGraphicAttribute("min",!0),c=t.getGraphicAttribute("max",!0),p=t.getGraphicAttribute("q1",!0),g=t.getGraphicAttribute("q3",!0),f=t.getGraphicAttribute("median",!0),_={from:{x:h,y:d},to:{x:h,y:d}};return H(u)&&(_.to.min=l,_.from.min=u),H(c)&&(_.to.max=l,_.from.max=c),H(p)&&(_.to.q1=l,_.from.q1=p),H(g)&&(_.to.q3=l,_.from.q3=g),H(f)&&(_.to.median=l,_.from.median=f),_},QO=(s,t,e)=>{var i,n,r,a,o,l,h,d,u,c,p,g;if(e&&H(e.center))return e.center;let f,_,m,v,y;if(Ti(t)){f=(n=(i=s.getGraphicAttribute("points",!1,"median"))===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.x,_=(a=(r=s.getGraphicAttribute("points",!1,"max"))===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.x,m=(l=(o=s.getGraphicAttribute("points",!1,"min"))===null||o===void 0?void 0:o[0])===null||l===void 0?void 0:l.x;const b=s.getGraphicAttribute("width",!1,"box"),x=s.getGraphicAttribute("x",!1,"box");v=x,y=x+b}else{f=(d=(h=s.getGraphicAttribute("points",!1,"median"))===null||h===void 0?void 0:h[0])===null||d===void 0?void 0:d.y,_=(c=(u=s.getGraphicAttribute("points",!1,"max"))===null||u===void 0?void 0:u[0])===null||c===void 0?void 0:c.y,m=(g=(p=s.getGraphicAttribute("points",!1,"min"))===null||p===void 0?void 0:p[0])===null||g===void 0?void 0:g.y;const b=s.getGraphicAttribute("height",!1,"box"),x=s.getGraphicAttribute("y",!1,"box");v=x,y=x+b}return H(f)?f:H(v)&&H(y)?(v+y)/2:H(_)&&H(m)?(_+m)/2:H(m)?m:H(_)?_:NaN},L7=(s,t,e,i)=>{var n,r,a,o,l,h,d,u;const c={shaft:{},box:{},max:{},min:{},median:{}},p=(n=s.x)!==null&&n!==void 0?n:e.getGraphicAttribute("x",!1),g=(r=s.y)!==null&&r!==void 0?r:e.getGraphicAttribute("y",!1),f=(a=s.width)!==null&&a!==void 0?a:e.getGraphicAttribute("width",!1),_=(o=s.height)!==null&&o!==void 0?o:e.getGraphicAttribute("height",!1),m=(l=s.boxWidth)!==null&&l!==void 0?l:e.getGraphicAttribute("boxWidth",!1),v=(h=s.boxHeight)!==null&&h!==void 0?h:e.getGraphicAttribute("boxHeight",!1),y=(d=s.ruleWidth)!==null&&d!==void 0?d:e.getGraphicAttribute("ruleWidth",!1),b=(u=s.ruleHeight)!==null&&u!==void 0?u:e.getGraphicAttribute("ruleHeight",!1);return i&&Ti(i.direction)?(H(v)?(Object.assign(c.box,{y:g-v/2,y1:g+v/2}),Object.assign(c.median,{y:g-v/2,y1:g+v/2})):(Object.assign(c.box,{y:g-_/2,y1:g+_/2}),Object.assign(c.median,{y:g-_/2,y1:g+_/2})),H(b)?(Object.assign(c.max,{y:g-b/2,y1:g+b/2}),Object.assign(c.min,{y:g-b/2,y1:g+b/2})):(Object.assign(c.max,{y:g-_/2,y1:g+_/2}),Object.assign(c.min,{y:g-_/2,y1:g+_/2}))):(H(m)?(Object.assign(c.box,{x:p-m/2,x1:p+m/2}),Object.assign(c.median,{x:p-m/2,x1:p+m/2})):(Object.assign(c.box,{x:p-f/2,x1:p+f/2}),Object.assign(c.median,{x:p-f/2,x1:p+f/2})),H(y)?(Object.assign(c.max,{x:p-y/2,x1:p+y/2}),Object.assign(c.min,{x:p-y/2,x1:p+y/2})):(Object.assign(c.max,{x:p-f/2,x1:p+f/2}),Object.assign(c.min,{x:p-f/2,x1:p+f/2}))),c},B7=ZO(QO),I7=JO(QO);function F7(){st.registerGlyph("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(L7).registerChannelEncoder("x",(s,t,e,i,n,r)=>r&&Ti(r.direction)?null:{shaft:{x:t,x1:t}}).registerChannelEncoder("y",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{shaft:{y:t,y1:t}}:null).registerChannelEncoder("q1",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{box:{x:t}}:{box:{y:t}}).registerChannelEncoder("q3",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{box:{x1:t}}:{box:{y1:t}}).registerChannelEncoder("min",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{shaft:{x:t},min:{x:t,x1:t,visible:!0}}:{shaft:{y:t},min:{y:t,y1:t,visible:!0}}).registerChannelEncoder("max",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{shaft:{x1:t},max:{x:t,x1:t,visible:!0}}:{shaft:{y1:t},max:{y:t,y1:t,visible:!0}}).registerChannelEncoder("median",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{median:{x:t,x1:t,visible:!0}}:{median:{y:t,y1:t,visible:!0}}).registerChannelEncoder("angle",(s,t,e,i,n,r)=>{var a;const o=r&&Ti(r.direction)?[(e.min+e.max)/2,e.y]:[e.x,(e.min+e.max)/2],l=(a=e.anchor)!==null&&a!==void 0?a:o;return{shaft:{angle:t,anchor:l},box:{angle:t,anchor:l},max:{angle:t,anchor:l},min:{angle:t,anchor:l},median:{angle:t,anchor:l}}}).registerDefaultEncoder(()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}})),st.registerAnimationType("boxplotScaleIn",B7),st.registerAnimationType("boxplotScaleOut",I7),lm(),Vx(),Ux()}const tD=(s,t,e)=>{var i,n,r,a;if(H(e==null?void 0:e.center))return e.center;let o,l,h,d,u;if(Ti(t)){o=(n=(i=s.getGraphicAttribute("points",!1,"median"))===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.x;const c=s.getGraphicAttribute("width",!1,"minMaxBox"),p=s.getGraphicAttribute("x",!1,"minMaxBox");h=p,l=p+c;const g=s.getGraphicAttribute("width",!1,"q1q3Box"),f=s.getGraphicAttribute("x",!1,"q1q3Box");d=f,u=f+g}else{o=(a=(r=s.getGraphicAttribute("points",!1,"median"))===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.y;const c=s.getGraphicAttribute("height",!1,"minMaxBox"),p=s.getGraphicAttribute("y",!1,"minMaxBox");h=p,l=p+c;const g=s.getGraphicAttribute("height",!1,"q1q3Box"),f=s.getGraphicAttribute("y",!1,"q1q3Box");d=f,u=f+g}return H(o)?o:H(d)&&H(u)?(d+u)/2:H(l)&&H(h)?(l+h)/2:H(h)?h:H(l)?l:NaN},j7=(s,t,e,i)=>{var n,r,a,o,l,h,d,u;const c={minMaxBox:{},q1q3Box:{},median:{}},p=(n=s.x)!==null&&n!==void 0?n:e.getGraphicAttribute("x",!1),g=(r=s.y)!==null&&r!==void 0?r:e.getGraphicAttribute("y",!1),f=(a=s.width)!==null&&a!==void 0?a:e.getGraphicAttribute("width",!1),_=(o=s.minMaxWidth)!==null&&o!==void 0?o:e.getGraphicAttribute("minMaxWidth",!1),m=(l=s.q1q3Width)!==null&&l!==void 0?l:e.getGraphicAttribute("q1q3Width",!1),v=(h=s.height)!==null&&h!==void 0?h:e.getGraphicAttribute("height",!1),y=(d=s.minMaxHeight)!==null&&d!==void 0?d:e.getGraphicAttribute("minMaxHeight",!1),b=(u=s.q1q3Height)!==null&&u!==void 0?u:e.getGraphicAttribute("q1q3Height",!1);return i&&Ti(i.direction)?(H(y)?Object.assign(c.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(c.minMaxBox,{y:g-v/2,y1:g+v/2}),H(b)?(Object.assign(c.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(c.median,{y:g-b/2,y1:g+b/2})):(Object.assign(c.q1q3Box,{y:g-v/2,y1:g+v/2}),Object.assign(c.median,{y:g-v/2,y1:g+v/2}))):(H(_)?Object.assign(c.minMaxBox,{x:p-_/2,x1:p+_/2}):Object.assign(c.minMaxBox,{x:p-f/2,x1:p+f/2}),H(m)?(Object.assign(c.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(c.median,{x:p-m/2,x1:p+m/2})):(Object.assign(c.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(c.median,{x:p-f/2,x1:p+f/2}))),c},z7=ZO(tD),H7=JO(tD);function G7(){st.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(j7).registerChannelEncoder("q1",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{q1q3Box:{x:t}}:{q1q3Box:{y:t}}).registerChannelEncoder("q3",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{q1q3Box:{x1:t}}:{q1q3Box:{y1:t}}).registerChannelEncoder("min",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{minMaxBox:{x:t}}:{minMaxBox:{y:t}}).registerChannelEncoder("max",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{minMaxBox:{x1:t}}:{minMaxBox:{y1:t}}).registerChannelEncoder("median",(s,t,e,i,n,r)=>r&&Ti(r.direction)?{median:{x:t,x1:t,visible:!0}}:{median:{y:t,y1:t,visible:!0}}).registerChannelEncoder("angle",(s,t,e,i,n,r)=>{var a;const o=(a=e.anchor)!==null&&a!==void 0?a:[e.x,(e.min+e.max)/2];return{minMaxBox:{angle:t,anchor:o},q1q3Box:{angle:t,anchor:o},median:{angle:t,anchor:o}}}).registerChannelEncoder("lineWidth",(s,t,e,i,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}})).registerChannelEncoder("minMaxFillOpacity",(s,t,e,i,n,r)=>({minMaxBox:{fillOpacity:t}})).registerChannelEncoder("stroke",(s,t,e,i,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})).registerDefaultEncoder(()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}})),st.registerAnimationType("barBoxplotScaleIn",z7),st.registerAnimationType("barBoxplotScaleOut",H7),lm(),Vx(),Ux()}const W7=()=>{st.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder((s,t,e,i)=>{var n;const r=Math.max(0,Math.min(s.ripple,1)),a=(n=s.size)!==null&&n!==void 0?n:e.getGraphicAttribute("size"),o=.5*a;return{ripple0:{size:a+o*r,fillOpacity:.75-.25*r},ripple1:{size:a+o*(1+r),fillOpacity:.5-.25*r},ripple2:{size:a+o*(2+r),fillOpacity:.25-.25*r}}}).registerDefaultEncoder(()=>({ripple0:{fillOpacity:.75},ripple1:{fillOpacity:.5},ripple2:{fillOpacity:.25}})),lm(),KO()},N7=(s,t)=>{var e;const i=(e=s.curvature)!==null&&e!==void 0?e:.5,n=typeof t=="number"?s.thickness*t:s.thickness;let r=s.x0,a=s.x1,o=s.y0,l=s.y1,h=r+i*(a-r),d=a+i*(r-a),u=m=>m;s.round!==!1&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),d=Math.round(d),u=Math.round),s.pathType==="line"||s.pathType,s.align==="center"?(o=u(s.y0-n/2),l=u(s.y1-n/2)):s.align==="end"?(o=u(s.y0+s.thickness/2-n),l=u(s.y1+s.thickness/2-n)):(o=u(s.y0-s.thickness/2),l=u(s.y1-s.thickness/2));const c=u(o+n),p=u(l+n),g=Math.abs(a-r)>1e-6,f=s.endArrow&&g?`L${a},${u(l-n/2)}L${u(a+n)},${u((l+p)/2)}L${a},${u(p+n/2)}`:"",_=s.startArrow&&g?`L${r},${u(c+n/2)}L${u(r-n)},${u((o+c)/2)}L${r},${u(o-n/2)}`:"";return s.pathType==="line"?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${c}${_}Z`:s.pathType==="polyline"?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}
- ${f}L${a},${p}L${h},${p}L${h},${c}L${r},${c}${_}Z`:`M${r},${o}C${h},${o},${d},${l},${a},${l}
- ${f}L${a},${p}C${d},${p},${h},${c},${r},${c}${_}Z`},V7=(s,t)=>{var e;const i=(e=s.curvature)!==null&&e!==void 0?e:.5,n=typeof t=="number"?s.thickness*t:s.thickness;let r=s.y0,a=s.y1,o=s.x0,l=s.x1,h=r+i*(a-r),d=a+i*(r-a),u=m=>m;s.round!==!1&&(u=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),d=Math.round(d)),s.pathType==="line"||s.pathType,s.align==="center"?(o=u(s.x0-n/2),l=u(s.x1-n/2)):s.align==="end"?(o=u(s.x0+s.thickness/2-n),l=u(s.x1+s.thickness/2-n)):(o=u(s.x0-s.thickness/2),l=u(s.x1-s.thickness/2));const c=u(o+n),p=u(l+n),g=Math.abs(a-r)>1e-6,f=s.endArrow&&g?`L${u(l-n/2)},${a}L${u((l+p)/2)},${u(a+n)}L${u(p+n/2)},${a}`:"",_=s.startArrow&&g?`L${u(c+n/2)},${r}L${u((c+o)/2)},${u(r-n)}L${u(o-n/2)},${r}`:"";return s.pathType==="line"?`M${o},${r}L${l},${a}${f}L${p},${a}L${c},${r}${_}Z`:s.pathType==="polyline"?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}
- ${f}L${p},${a}L${p},${h}L${c},${h}L${c},${r}${_}Z`:`M${o},${r}C${o},${h},${l},${d},${l},${a}
- ${f}L${p},${a}C${p},${d},${c},${h},${c},${r}${_}Z`},U7=(s,t,e,i)=>{var n;const r=(n=s.direction)!==null&&n!==void 0?n:i==null?void 0:i.direction,a=["vertical","TB","BT"].includes(r)?V7:N7,o=typeof s.ratio=="number"&&s.ratio>=0&&s.ratio<=1,l=Object.keys(s);return["x0","y0","x1","y1"].every(h=>l.includes(h))?{back:{path:o?a(s,1):""},front:{path:a(s,o?s.ratio:1)}}:{}},$7=(s,t,e)=>{const i={x0:s.getGraphicAttribute("x0",!1),x1:s.getGraphicAttribute("x1",!1),y0:s.getGraphicAttribute("y0",!1),y1:s.getGraphicAttribute("y1",!1),thickness:s.getGraphicAttribute("thickness",!1),round:s.getGraphicAttribute("round",!1),align:s.getGraphicAttribute("align",!1),pathType:s.getGraphicAttribute("pathType",!1),endArrow:s.getGraphicAttribute("endArrow",!1),startArrow:s.getGraphicAttribute("startArrow",!1)};return Object.keys(i).forEach(n=>{C(i[n])&&delete i[n]}),{from:Object.assign({},i,{x1:i.x0,y1:i.y0}),to:i}},Y7=(s,t,e)=>{const i={x0:s.getGraphicAttribute("x0",!0),x1:s.getGraphicAttribute("x1",!0),y0:s.getGraphicAttribute("y0",!0),y1:s.getGraphicAttribute("y1",!0),thickness:s.getGraphicAttribute("thickness",!0),round:s.getGraphicAttribute("round",!0),align:s.getGraphicAttribute("align",!0),pathType:s.getGraphicAttribute("pathType",!0),endArrow:s.getGraphicAttribute("endArrow",!0),startArrow:s.getGraphicAttribute("startArrow",!0)};return Object.keys(i).forEach(n=>{C(i[n])&&delete i[n]}),{from:i,to:Object.assign({},i,{x1:i.x0,y1:i.y0})}},X7=(s,t,e)=>{const i={thickness:s.getGraphicAttribute("thickness",!1),round:s.getGraphicAttribute("round",!1),align:s.getGraphicAttribute("align",!1),pathType:s.getGraphicAttribute("pathType",!1),endArrow:s.getGraphicAttribute("endArrow",!1),startArrow:s.getGraphicAttribute("startArrow",!1)};return Object.keys(i).forEach(n=>{C(i[n])&&delete i[n]}),{from:Object.assign(Object.assign({x0:s.getGraphicAttribute("x0",!0),x1:s.getGraphicAttribute("x1",!0),y0:s.getGraphicAttribute("y0",!0),y1:s.getGraphicAttribute("y1",!0)},i),i),to:Object.assign({x0:s.getGraphicAttribute("x0",!1),x1:s.getGraphicAttribute("x1",!1),y0:s.getGraphicAttribute("y0",!1),y1:s.getGraphicAttribute("y1",!1)},i)}},K7=()=>{st.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(U7).registerChannelEncoder("backgroundStyle",(s,t)=>({back:t})).registerDefaultEncoder(()=>({back:{zIndex:0},front:{zIndex:1}})),st.registerAnimationType("linkPathGrowIn",$7),st.registerAnimationType("linkPathGrowOut",Y7),st.registerAnimationType("linkPathUpdate",X7),lm(),XO()};class eD extends Nx{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const i=ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(i),this.spec.scale=void 0}const e=ot(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const q7=(s,t,e,i)=>{var n,r,a,o;const l=(r=(n=t==null?void 0:t.components)===null||n===void 0?void 0:n.axis)!==null&&r!==void 0?r:{};if(!s)return at({},l,e??{});const h=[((o=(a=s.tickData)===null||a===void 0?void 0:a.call(s,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}))];return at({},l,{items:h},e??{})},Z7=(s,t,e,i)=>{var n,r,a,o;const l=(r=(n=t==null?void 0:t.components)===null||n===void 0?void 0:n.circleAxis)!==null&&r!==void 0?r:{};if(!s)return at({},l,e??{});const h=[((o=(a=s.tickData)===null||a===void 0?void 0:a.call(s,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}))];return at({},l,{items:h},e??{})},iD=(s,t,e,i,n,r)=>{var a;const o=s.getCoordinateAxisPosition();n&&n.position==="auto"&&(n.position=e?"content":o);const l=s.getCoordinateAxisPoints(i);if(l){const u={start:l[0],end:l[1],verticalFactor:(o==="top"||o==="left"?-1:1)*(e?-1:1)*(!((a=s.getSpec().range)===null||a===void 0)&&a.reversed?-1:1)};if(r&&t.type==="polar"){const c=t.angle();u.center=t.origin(),u.startAngle=c[0],u.endAngle=c[1]}return u}const h=t.radius(),d=t.angle();return{center:t.origin(),radius:h[1],innerRadius:h[0],inside:e,startAngle:d[0],endAngle:d[1]}};class sD extends eD{constructor(t,e,i){super(t,ge.axis,e),this.spec.componentType=ge.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=at({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=st.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,n)}tickCount(t){const e=ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce((n,r)=>{const a=e[r];return a&&(n[r]={callback:(o,l,h)=>{var d,u;const c=this.spec.skipTheme?null:this.view.getCurrentTheme();let p=Qa(a,o,l,h);const g=Be(this.spec.inside,h,o,l),f=Be(this.spec.baseValue,h,o,l),_=(d=t==null?void 0:t.getCoordinate)===null||d===void 0?void 0:d.call(t);_&&(p=Object.assign(iD(t,_,g,f,this.spec.layout),p));const m=(u=t==null?void 0:t.getScale)===null||u===void 0?void 0:u.call(t),v=Be(this.spec.tickCount,h,o,l);switch(this._getAxisComponentType()){case Hn.lineAxis:return q7(m,c,p,v);case Hn.circleAxis:return Z7(m,c,p,v)}return p}}),n},{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(C(e)){const i=ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=!((t=i==null?void 0:i.getCoordinate)===null||t===void 0)&&t.call(i)?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType=e==="circle"?Hn.circleAxis:Hn.lineAxis,this._axisComponentType}}sD.componentType=ge.axis;const J7=()=>{st.registerGraphicComponent(Hn.lineAxis,(s,t)=>new vu(s,t)),st.registerGraphicComponent(Hn.circleAxis,s=>new yu(s)),st.registerComponent(ge.axis,sD)},Q7=(s,t,e,i,n,r={})=>{var a;const o=(a=r.components)===null||a===void 0?void 0:a.dataLabel,l=s.map((h,d)=>{var u,c,p,g,f;const _=Object.assign(Object.assign({},n),{labelIndex:d}),m=(u=Be(i,_,h))!==null&&u!==void 0?u:{},{components:v={}}=r;let y={};switch(h.markType){case nt.line:case nt.area:y=m.type==="line"?v.lineLabel:m.type==="area"?v.areaLabel:v.lineDataLabel;break;case nt.rect:case nt.rect3d:case nt.interval:y=v.rectLabel;break;case nt.symbol:case nt.circle:case nt.cell:y=v.symbolLabel;break;case nt.arc:case nt.arc3d:y=v.arcLabel;break;case nt.polygon:case nt.path:default:y=v.pointLabel}const b=(c=m.data)!==null&&c!==void 0?c:[],x=(g=(p=y==null?void 0:y.data)===null||p===void 0?void 0:p[0])!==null&&g!==void 0?g:{};b&&b.length>0?b.forEach((A,k)=>{if(h.elements[k]){const w=Qa(e,A,h.elements[k],_);at(A,x,w)}}):h.elements.forEach(A=>{if(A.getGraphicItem().releaseStatus!=="willRelease")if(h.isCollectionMark())A.getDatum().forEach(k=>{const w=Qa(e,k,A,_);b.push(at({},x,w))});else{const k=Qa(e,A.getDatum(),A,_),w=at({},x,k);b.push(w)}});const S=(f=h.graphicItem)===null||f===void 0?void 0:f.name;return at({},y,{data:b,baseMarkGroupName:S,getBaseMarks:()=>h.elements.map(A=>A.getGraphicItem())},m??{})}).filter(h=>!C(h));return at({},o,{size:t,dataLabels:l})};let nD=class extends Nx{constructor(t,e){super(t,ge.label,e),this.spec.componentType=ge.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const e=Y(this.spec.target).map(i=>ot(i)?this.view.getMarkById(i):i);this.detach(e)}if(this.spec.target=t,t){const e=Y(t).map(i=>ot(i)?this.view.getMarkById(i):i);this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((i,n)=>{const r=t[n];return r&&(i[n]={callback:(a,o,l)=>{var h,d,u,c;const p=Y(this.spec.target).map(m=>ot(m)?this.view.getMarkById(m):m),g=(d=(h=this.group)===null||h===void 0?void 0:h.getGroupGraphicItem)===null||d===void 0?void 0:d.call(h);let f=Be(this.spec.size,l);f||(f=g?{width:(u=g.attribute.width)!==null&&u!==void 0?u:g.AABBBounds.width(),height:(c=g.attribute.height)!==null&&c!==void 0?c:g.AABBBounds.height()}:{width:1/0,height:1/0});const _=this.spec.skipTheme?null:this.view.getCurrentTheme();return Q7(p,f,r,this.spec.labelStyle,l,_)}}),i},{});this._encoders=e}};nD.componentType=ge.label;const rD=()=>{st.registerGraphicComponent(ge.label,s=>new im(s)),st.registerComponent(ge.label,nD)},t9=(s,t,e,i)=>{var n,r,a,o;const l=(r=(n=t==null?void 0:t.components)===null||n===void 0?void 0:n.grid)!==null&&r!==void 0?r:{};if(!s)return at({},l,e??{});const h=((o=(a=s.tickData)===null||a===void 0?void 0:a.call(s,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}));return at({},l,{items:h},e??{})},e9=(s,t,e,i)=>{var n,r,a,o;const l=(r=(n=t==null?void 0:t.components)===null||n===void 0?void 0:n.circleGrid)!==null&&r!==void 0?r:{};if(!s)return at({},l,e??{});const h=((o=(a=s.tickData)===null||a===void 0?void 0:a.call(s,i))!==null&&o!==void 0?o:[]).map(d=>({id:d.index,label:d.tick,value:d.value,rawValue:d.tick}));return at({},l,{items:h},e??{})};class aD extends eD{constructor(t,e,i){super(t,ge.grid,e),this.spec.componentType=ge.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const i=ot(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(i)}this.spec.target=t;const e=ot(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=at({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=st.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,n)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce((i,n)=>{const r=t[n];return r&&(i[n]={callback:(a,o,l)=>{var h,d,u,c;const p=this.spec.skipTheme?null:this.view.getCurrentTheme();let g,f=Qa(r,a,o,l);const _=Be(this.spec.baseValue,l,a,o);if(this._targetAxis){const y=(h=this._targetAxis.getSpec())===null||h===void 0?void 0:h.scale;g=ot(y)?this.view.getScaleById(y):y;const b=this._targetAxis.elements[0];if(b)switch(this._getGridComponentType()){case ai.lineAxisGrid:f=Object.assign({x:b.getGraphicAttribute("x"),y:b.getGraphicAttribute("y"),start:b.getGraphicAttribute("start"),end:b.getGraphicAttribute("end"),verticalFactor:(d=b.getGraphicAttribute("verticalFactor"))!==null&&d!==void 0?d:1},f);break;case ai.circleAxisGrid:f=Object.assign({x:b.getGraphicAttribute("x"),y:b.getGraphicAttribute("y"),center:b.getGraphicAttribute("center"),radius:b.getGraphicAttribute("radius"),innerRadius:b.getGraphicAttribute("innerRadius"),inside:b.getGraphicAttribute("inside"),startAngle:b.getGraphicAttribute("startAngle"),endAngle:b.getGraphicAttribute("endAngle")},f)}}else{g=ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const y=Be(this.spec.inside,l,a,o),b=(u=g==null?void 0:g.getCoordinate)===null||u===void 0?void 0:u.call(g);b&&(f=Object.assign(iD(g,b,y,_,this.spec.layout,!0),f))}this._getGridComponentType()===ai.lineAxisGrid&&(f=this.spec.gridShape!=="line"&&this.spec.gridShape?Object.assign({center:f.start,closed:!0},f,{type:this.spec.gridShape}):Object.assign({},f,{type:"line"}));const m=(c=g==null?void 0:g.getScale)===null||c===void 0?void 0:c.call(g),v=Be(this.spec.tickCount,l,a,o);switch(this._getGridComponentType()){case ai.lineAxisGrid:return t9(m,p,f,v);case ai.circleAxisGrid:return e9(m,p,f,v)}return f}}),i},{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)this.spec.gridType==="circle"?this._gridComponentType=ai.circleAxisGrid:this._gridComponentType=ai.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case Hn.circleAxis:this._gridComponentType=ai.circleAxisGrid;break;case Hn.lineAxis:default:this._gridComponentType=ai.lineAxisGrid}else if(this.spec.scale){const e=ot(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=!((t=e==null?void 0:e.getCoordinate)===null||t===void 0)&&t.call(e)?e.getCoordinateAxisPoints()?ai.lineAxisGrid:ai.circleAxisGrid:ai.lineAxisGrid}else this._gridComponentType=ai.lineAxisGrid;return this._gridComponentType}}aD.componentType=ge.grid;const i9=()=>{st.registerGraphicComponent(ai.lineAxisGrid,(s,t)=>new fO(s,t)),st.registerGraphicComponent(ai.circleAxisGrid,(s,t)=>new _O(s,t)),st.registerComponent(ge.grid,aD)},s9=(s,t,e)=>t.filter(i=>s.callback(i,e)),n9=(s,t,e)=>{const i=s.callback,n=s.as;if(!s.all)return t.forEach(a=>{const o=i(a,e);if(!C(n)){if(C(a))return;a[n]=o}return o}),t;const r=i(t,e);return C(n)||C(t)?r:(t[n]=r,t)};function oD(s){return s.reduce((t,e)=>t+e,0)}function r9(s){return s.length===0?0:oD(s)/s.length}const a9={min:pi,max:Ye,average:r9,sum:oD};function o9(s,t,e,i){const n=Math.floor(t.length/s),r=[],a=t.length;let o,l,h,d=0,u=0;r[u++]=d;for(let c=1;c<a-1;c+=n){const p=Math.min(c+n,a-1),g=Math.min(c+2*n,a),f=(g+p)/2;let _=0;for(let x=p;x<g;x++){const S=t[x][i];Number.isNaN(S)||(_+=S)}_/=g-p;const m=c,v=Math.min(c+n,a),y=c-1,b=t[d][i];o=-1,h=m;for(let x=m;x<v;x++){const S=t[x][i];Number.isNaN(i)||(l=Math.abs((y-f)*(S-b)-(y-x)*(_-b)),l>o&&(o=l,h=x))}r[u++]=h,d=h}return r[u-1]!==a-1&&(r[u++]=a-1),r.map(c=>e?t[c].i:c)}function hm(s,t,e,i,n){let r=Math.floor(t.length/s);const a=[],o=t.length;let l=0,h=[];a.push(l),t[l][n]=t[l][n];for(let d=1;d<o-1;d+=r){r>o-d&&(r=o-d,h.length=r),h=[];for(let c=0;c<r;c++)h.push(t[d+c][n]);const u=a9[i](h);l=Math.min(Math.round(d+h.length/2)||0,o-1),t[l][n]=u,a.push(l)}return a.map(d=>e?t[d].i:d)}function l9(s,t,e,i){return hm(s,t,e,"min",i)}function h9(s,t,e,i){return hm(s,t,e,"max",i)}function d9(s,t,e,i){return hm(s,t,e,"average",i)}function u9(s,t,e,i){return hm(s,t,e,"sum",i)}const c9=(s,t)=>{let e=s.size;const i=s.factor||1;if(Array.isArray(e)&&(e=Math.floor(e[1]-e[0])),e*=i,e<=0)return[];if(t.length<=e)return t;if(s.skipfirst)return t.slice(0,1);const{mode:n,yfield:r,groupBy:a}=s,o=r??"y";let l=o9;if(n==="min"?l=l9:n==="max"?l=h9:n==="average"?l=d9:n==="sum"&&(l=u9),t.length){const h={};if(a){for(let u=0,c=t.length;u<c;u++){const p=t[u],g=p[a];h[g]?h[g].push({[o]:p[o],i:u}):(h[g]=[],h[g].push({[o]:p[o],i:u}))}let d=[];return Object.keys(h).forEach(u=>{const c=h[u];if(c.length<=e){const p=c.map(g=>g.i);d=d.concat(p)}else{const p=l(e,c,!0,o);d=d.concat(p),c.forEach(g=>t[g.i][o]=g[o])}}),d.sort((u,c)=>u-c),d.map(u=>t[u])}return l(e,t,!1,o).map(d=>t[d])}return[]},dm="_mo_hide_";function p9(s){return s.forEach(t=>{t.getGraphicAttribute("HIDE_KEY")&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(dm,!1))}),s}function g9(s,t,e,i){if(i){let n=-1/0,r=0;const a=C(t);let o=t;s.forEach(l=>{if(l.getGraphicAttribute("visible")===!1)return;const h=l.getGraphicAttribute("size")/2,d=l.getGraphicAttribute("x");a&&(o=(h+r)*e),Math.abs(d-n)<o+r+h?l.getGraphicAttribute("forceShow")||(l.setGraphicAttribute(dm,!0),l.setGraphicAttribute("visible",!1)):n=d,r=h})}}function f9(s,t,e,i){if(i){let n=-1/0,r=0;const a=C(t);let o=t;s.forEach(l=>{if(l.getGraphicAttribute("visible")===!1)return;const h=l.getGraphicAttribute("size")/2,d=l.getGraphicAttribute("y");a&&(o=(h+r)*e),Math.abs(d-n)<o+r+h?l.getGraphicAttribute("forceShow")||(l.setGraphicAttribute(dm,!0),l.setGraphicAttribute("visible",!1)):n=d,r=h})}}function _9(s,t,e,i){if(i){let r=-1/0,a=0,o=0;const l=C(t);let h=t;s.forEach(d=>{if(d.getGraphicAttribute("visible")===!1)return;const u=d.getGraphicAttribute("size")/2,c=d.getGraphicAttribute("x"),p=d.getGraphicAttribute("y");l&&(h=(u+a)*e),o=(-1/0-c)**2+(r-p)**2,o<(h+a+u)**2?d.getGraphicAttribute("forceShow")||(d.setGraphicAttribute(dm,!0),d.setGraphicAttribute("visible",!1)):r=p,a=u})}}const m9=(s,t)=>{if(!t||t.length===0)return;let{radius:e}=s;C(e)&&t[0].mark.markType==="symbol"&&(e=!0);const{direction:i,delta:n,deltaMul:r=1,groupBy:a}=s,o=l=>{p9(l);const h=l.slice().sort((d,u)=>d.getGraphicAttribute("x")-u.getGraphicAttribute("x"));i===0?_9(h,n,r,e):i===1?g9(h,n,r,e):f9(h,n,r,e)};if(a){const l=t.reduce((h,d)=>{const u=d.getDatum()[a];return h[u]?h[u].push(d):h[u]=[d],h},{});Object.keys(l).forEach(h=>{o(l[h])})}else o(t);return t},v9=()=>{st.registerTransform("filter",{transform:s9,markPhase:"beforeJoin"},!0)},y9=()=>{st.registerTransform("map",{transform:n9,markPhase:"beforeJoin"},!0)},$x=()=>{st.registerTransform("sampling",{transform:c9,markPhase:"afterEncode"},!0)},Yx=()=>{st.registerTransform("markoverlap",{transform:m9,markPhase:"afterEncode"},!0)},b9=(s,t,e)=>{var i;const n=s.getGraphicAttribute("clipRangeByDimension",!1),r=(i=s.getGraphicAttribute("clipRange",!1))!==null&&i!==void 0?i:1;return t&&t.clipDimension?{from:{clipRange:0,clipRangeByDimension:t.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},x9=(s,t,e)=>{var i;const n=s.getGraphicAttribute("clipRangeByDimension",!0),r=(i=s.getGraphicAttribute("clipRange",!0))!==null&&i!==void 0?i:1;return t&&t.clipDimension?{from:{clipRange:r,clipRangeByDimension:t.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},S9=(s,t,e)=>{var i,n,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:(i=s.getGraphicAttribute("opacity",!1))!==null&&i!==void 0?i:1,fillOpacity:(n=s.getGraphicAttribute("fillOpacity",!1))!==null&&n!==void 0?n:1,strokeOpacity:(r=s.getGraphicAttribute("strokeOpacity",!1))!==null&&r!==void 0?r:1}}},A9=(s,t,e)=>{var i,n,r;return{from:{opacity:(i=s.getGraphicAttribute("opacity",!0))!==null&&i!==void 0?i:1,fillOpacity:(n=s.getGraphicAttribute("fillOpacity",!0))!==null&&n!==void 0?n:1,strokeOpacity:(r=s.getGraphicAttribute("strokeOpacity",!0))!==null&&r!==void 0?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},k9=(s,t,e)=>{switch(t==null?void 0:t.direction){case"x":{const i=s.getGraphicAttribute("x",!1),n=s.getGraphicAttribute("x1",!1),r=s.getGraphicAttribute("width",!1);return{from:E(r)?{x:i+r/2,x1:void 0,width:0}:{x:(i+n)/2,x1:(i+n)/2,width:void 0},to:{x:i,x1:n,width:r}}}case"y":{const i=s.getGraphicAttribute("y",!1),n=s.getGraphicAttribute("y1",!1),r=s.getGraphicAttribute("height",!1);return{from:E(r)?{y:i+r/2,y1:void 0,height:0}:{y:(i+n)/2,y1:(i+n)/2,height:void 0},to:{y:i,y1:n,height:r}}}default:{const i=s.getGraphicAttribute("x",!1),n=s.getGraphicAttribute("x1",!1),r=s.getGraphicAttribute("width",!1),a=s.getGraphicAttribute("y",!1),o=s.getGraphicAttribute("y1",!1),l=s.getGraphicAttribute("height",!1),h={};return E(r)?(h.x=i+r/2,h.width=0,h.x1=void 0):(h.x=(i+n)/2,h.x1=(i+n)/2,h.width=void 0),E(l)?(h.y=a+l/2,h.height=0,h.y1=void 0):(h.y=(a+o)/2,h.y1=(a+o)/2,h.height=void 0),{from:h,to:{x:i,y:a,x1:n,y1:o,width:r,height:l}}}}},w9=(s,t,e)=>{switch(t==null?void 0:t.direction){case"x":{const i=s.getGraphicAttribute("x",!1),n=s.getGraphicAttribute("x1",!1),r=s.getGraphicAttribute("width",!1);return{to:E(r)?{x:i+r/2,x1:void 0,width:0}:{x:(i+n)/2,x1:(i+n)/2,width:void 0}}}case"y":{const i=s.getGraphicAttribute("y",!1),n=s.getGraphicAttribute("y1",!1),r=s.getGraphicAttribute("height",!1);return{to:E(r)?{y:i+r/2,y1:void 0,height:0}:{y:(i+n)/2,y1:(i+n)/2,height:void 0}}}default:{const i=s.getGraphicAttribute("x",!1),n=s.getGraphicAttribute("y",!1),r=s.getGraphicAttribute("x1",!1),a=s.getGraphicAttribute("y1",!1),o=s.getGraphicAttribute("width",!1),l=s.getGraphicAttribute("height",!1),h={};return E(o)?(h.x=i+o/2,h.width=0,h.x1=void 0):(h.x=(i+r)/2,h.x1=(i+r)/2,h.width=void 0),E(l)?(h.y=n+l/2,h.height=0,h.y1=void 0):(h.y=(n+a)/2,h.y1=(n+a)/2,h.height=void 0),{to:h}}}};function T9(s,t,e){const i=s.getGraphicAttribute("x",!1),n=s.getGraphicAttribute("x1",!1),r=s.getGraphicAttribute("width",!1);if(t&&t.orient==="negative"){const o=E(r)?Math.max(i,i+r):Math.max(i,n);return{from:{x:o,x1:C(n)?void 0:o,width:C(r)?void 0:0},to:{x:i,x1:n,width:r}}}const a=E(r)?Math.min(i,i+r):Math.min(i,n);return{from:{x:a,x1:C(n)?void 0:a,width:C(r)?void 0:0},to:{x:i,x1:n,width:r}}}function M9(s,t,e){var i;const n=s.getGraphicAttribute("x",!1),r=s.getGraphicAttribute("x1",!1),a=s.getGraphicAttribute("width",!1);let o;return t&&t.orient==="negative"?lt(t.overall)?o=t.overall:e.group?(o=(i=e.groupWidth)!==null&&i!==void 0?i:e.group.getBounds().width(),e.groupWidth=o):o=e.width:o=lt(t==null?void 0:t.overall)?t==null?void 0:t.overall:0,{from:{x:o,x1:C(r)?void 0:o,width:C(a)?void 0:0},to:{x:n,x1:r,width:a}}}const C9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?M9(s,t,e):T9(s,t)};function P9(s,t,e){const i=s.getGraphicAttribute("x",!1),n=s.getGraphicAttribute("x1",!1),r=s.getGraphicAttribute("width",!1);if(t&&t.orient==="negative"){const o=E(r)?Math.max(i,i+r):Math.max(i,n);return{to:{x:o,x1:C(n)?void 0:o,width:C(r)?void 0:0}}}const a=E(r)?Math.min(i,i+r):Math.min(i,n);return{to:{x:a,x1:C(n)?void 0:a,width:C(r)?void 0:0}}}function E9(s,t,e){var i;const n=s.getGraphicAttribute("x1",!1),r=s.getGraphicAttribute("width",!1);let a;return t&&t.orient==="negative"?lt(t.overall)?a=t.overall:e.group?(a=(i=e.groupWidth)!==null&&i!==void 0?i:e.group.getBounds().width(),e.groupWidth=a):a=e.width:a=lt(t==null?void 0:t.overall)?t.overall:0,{to:{x:a,x1:C(n)?void 0:a,width:C(r)?void 0:0}}}const R9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?E9(s,t,e):P9(s,t)};function O9(s,t,e){const i=s.getGraphicAttribute("y",!1),n=s.getGraphicAttribute("y1",!1),r=s.getGraphicAttribute("height",!1);if(t&&t.orient==="negative"){const o=E(r)?Math.max(i,i+r):Math.max(i,n);return{from:{y:o,y1:C(n)?void 0:o,height:C(r)?void 0:0},to:{y:i,y1:n,height:r}}}const a=E(r)?Math.min(i,i+r):Math.min(i,n);return{from:{y:a,y1:C(n)?void 0:a,height:C(r)?void 0:0},to:{y:i,y1:n,height:r}}}function D9(s,t,e){var i;const n=s.getGraphicAttribute("y",!1),r=s.getGraphicAttribute("y1",!1),a=s.getGraphicAttribute("height",!1);let o;return t&&t.orient==="negative"?lt(t.overall)?o=t.overall:e.group?(o=(i=e.groupHeight)!==null&&i!==void 0?i:e.group.getBounds().height(),e.groupHeight=o):o=e.height:o=lt(t==null?void 0:t.overall)?t.overall:0,{from:{y:o,y1:C(r)?void 0:o,height:C(a)?void 0:0},to:{y:n,y1:r,height:a}}}const L9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?D9(s,t,e):O9(s,t)};function B9(s,t,e){const i=s.getGraphicAttribute("y",!1),n=s.getGraphicAttribute("y1",!1),r=s.getGraphicAttribute("height",!1);if(t&&t.orient==="negative"){const o=E(r)?Math.max(i,i+r):Math.max(i,n);return{to:{y:o,y1:C(n)?void 0:o,height:C(r)?void 0:0}}}const a=E(r)?Math.min(i,i+r):Math.min(i,n);return{to:{y:a,y1:C(n)?void 0:a,height:C(r)?void 0:0}}}function I9(s,t,e){var i;const n=s.getGraphicAttribute("y1",!1),r=s.getGraphicAttribute("height",!1);let a;return t&&t.orient==="negative"?lt(t.overall)?a=t.overall:e.group?(a=(i=e.groupHeight)!==null&&i!==void 0?i:e.group.getBounds().height(),e.groupHeight=a):a=e.height:a=lt(t==null?void 0:t.overall)?t.overall:0,{to:{y:a,y1:C(n)?void 0:a,height:C(r)?void 0:0}}}const F9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?I9(s,t,e):B9(s,t)},j9=(s,t,e)=>t&&t.orient==="anticlockwise"?{from:{startAngle:s.getGraphicAttribute("endAngle",!1)},to:{startAngle:s.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:s.getGraphicAttribute("startAngle",!1)},to:{endAngle:s.getGraphicAttribute("endAngle",!1)}},z9=(s,t,e)=>{if(t&&t.orient==="anticlockwise"){const n=lt(t.overall)?t.overall:2*Math.PI;return{from:{startAngle:n,endAngle:n},to:{startAngle:s.getGraphicAttribute("startAngle",!1),endAngle:s.getGraphicAttribute("endAngle",!1)}}}const i=lt(t==null?void 0:t.overall)?t.overall:0;return{from:{startAngle:i,endAngle:i},to:{startAngle:s.getGraphicAttribute("startAngle",!1),endAngle:s.getGraphicAttribute("endAngle",!1)}}},H9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?z9(s,t):j9(s,t)},G9=(s,t,e)=>t&&t.orient==="anticlockwise"?{from:{startAngle:s.getGraphicAttribute("startAngle",!0)},to:{startAngle:s.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:s.getGraphicAttribute("endAngle",!0)},to:{endAngle:s.getGraphicAttribute("startAngle",!1)}},W9=(s,t,e)=>{if(t&&t.orient==="anticlockwise"){const n=lt(t.overall)?t.overall:2*Math.PI;return{from:{startAngle:s.getGraphicAttribute("startAngle",!0),endAngle:s.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}}const i=lt(t==null?void 0:t.overall)?t.overall:0;return{from:{startAngle:s.getGraphicAttribute("startAngle",!0),endAngle:s.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}},N9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?W9(s,t):G9(s,t)},V9=(s,t,e)=>t&&t.orient==="inside"?{from:{innerRadius:s.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:s.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:s.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:s.getGraphicAttribute("outerRadius",!1)}},U9=(s,t,e)=>{const i=lt(t==null?void 0:t.overall)?t.overall:0;return{from:{innerRadius:i,outerRadius:i},to:{innerRadius:s.getGraphicAttribute("innerRadius",!1),outerRadius:s.getGraphicAttribute("outerRadius",!1)}}},$9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?U9(s,t):V9(s,t)},Y9=(s,t,e)=>t&&t.orient==="inside"?{from:{innerRadius:s.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:s.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:s.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:s.getGraphicAttribute("innerRadius",!1)}},X9=(s,t,e)=>{const i=lt(t==null?void 0:t.overall)?t.overall:0;return{from:{innerRadius:s.getGraphicAttribute("innerRadius",!0),outerRadius:s.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:i,outerRadius:i}}},K9=(s,t,e)=>{var i;return((i=t==null?void 0:t.overall)!==null&&i!==void 0&&i)!==!1?X9(s,t):Y9(s,t)},lD=(s,t,e)=>{const i=s.getGraphicAttribute("points",!1),n={x:0,y:0};return i.forEach(r=>{n.x+=r.x,n.y+=r.y}),n.x/=i.length,n.y/=i.length,t&&t.center&&(H(t.center.x)&&(n.x=t.center.x),H(t.center.y)&&(n.y=t.center.y)),s.mark.markType==="area"&&(n.x1=n.x,n.y1=n.y),i.map(()=>Object.assign(n))},q9=(s,t,e)=>({from:{points:lD(s,t)},to:{points:s.getGraphicAttribute("points",!1)}}),Z9=(s,t,e)=>({from:{points:s.getGraphicAttribute("points",!0)},to:{points:lD(s,t)}}),hD=(s,t,e)=>s.getGraphicAttribute("points",!1).map(i=>{var n;if(t&&t.orient==="negative"){let r=e.width;return e.group&&(r=(n=e.groupWidth)!==null&&n!==void 0?n:e.group.getBounds().width(),e.groupWidth=r),{x:r,y:i.y,x1:r,y1:i.y1,defined:i.defined!==!1}}return{x:0,y:i.y,x1:0,y1:i.y1,defined:i.defined!==!1}}),J9=(s,t,e)=>({from:{points:hD(s,t,e)},to:{points:s.getGraphicAttribute("points",!1)}}),Q9=(s,t,e)=>({from:{points:s.getGraphicAttribute("points",!0)},to:{points:hD(s,t,e)}}),dD=(s,t,e)=>s.getGraphicAttribute("points",!1).map(i=>{var n;if(t&&t.orient==="negative"){let r=e.height;return e.group&&(r=(n=e.groupHeight)!==null&&n!==void 0?n:e.group.getBounds().height(),e.groupHeight=r),{x:i.x,y:r,x1:i.x1,y1:r,defined:i.defined!==!1}}return{x:i.x,y:0,x1:i.x1,y1:0,defined:i.defined!==!1}}),tX=(s,t,e)=>({from:{points:dD(s,t,e)},to:{points:s.getGraphicAttribute("points",!1)}}),eX=(s,t,e)=>({from:{points:s.getGraphicAttribute("points",!0)},to:{points:dD(s,t,e)}}),iX=(s,t,e)=>{var i,n;const{offset:r=0,orient:a,direction:o,point:l}=t??{};let h=0,d=0;a==="negative"&&(e.group?(h=(i=e.groupWidth)!==null&&i!==void 0?i:e.group.getBounds().width(),d=(n=e.groupHeight)!==null&&n!==void 0?n:e.group.getBounds().height(),e.groupWidth=h,e.groupHeight=d):(h=e.width,d=e.height)),h+=r,d+=r;const u=q(l)?l.call(null,s.getDatum(),s,e):l,c=u&&H(u.x)?u.x:h,p=u&&H(u.y)?u.y:d;switch(o){case"x":return{from:{x:c},to:{x:s.getGraphicAttribute("x",!1)}};case"y":return{from:{y:p},to:{y:s.getGraphicAttribute("y",!1)}};default:return{from:{x:c,y:p},to:{x:s.getGraphicAttribute("x",!1),y:s.getGraphicAttribute("y",!1)}}}},sX=(s,t,e)=>{var i,n;const{offset:r=0,orient:a,direction:o,point:l}=t??{},h=e.group?e.group.getBounds():null,d=(i=h==null?void 0:h.width())!==null&&i!==void 0?i:e.width,u=(n=h==null?void 0:h.height())!==null&&n!==void 0?n:e.height,c=(a==="negative"?d:0)+r,p=(a==="negative"?u:0)+r,g=q(l)?l.call(null,s.getDatum(),s,e):l,f=g&&H(g.x)?g.x:c,_=g&&H(g.y)?g.y:p;switch(o){case"x":return{from:{x:s.getGraphicAttribute("x",!0)},to:{x:f}};case"y":return{from:{y:s.getGraphicAttribute("y",!0)},to:{y:_}};default:return{from:{x:s.getGraphicAttribute("x",!0),y:s.getGraphicAttribute("y",!0)},to:{x:f,y:_}}}},nX=(s,t,e)=>{var i,n,r,a;switch(t==null?void 0:t.direction){case"x":return{from:{scaleX:0},to:{scaleX:(i=s.getGraphicAttribute("scaleX",!1))!==null&&i!==void 0?i:1}};case"y":return{from:{scaleY:0},to:{scaleY:(n=s.getGraphicAttribute("scaleY",!1))!==null&&n!==void 0?n:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:(r=s.getGraphicAttribute("scaleX",!1))!==null&&r!==void 0?r:1,scaleY:(a=s.getGraphicAttribute("scaleY",!1))!==null&&a!==void 0?a:1}}}},rX=(s,t,e)=>{var i,n,r,a;switch(t==null?void 0:t.direction){case"x":return{from:{scaleX:(i=s.getGraphicAttribute("scaleX",!0))!==null&&i!==void 0?i:1},to:{scaleX:0}};case"y":return{from:{scaleY:(n=s.getGraphicAttribute("scaleY",!0))!==null&&n!==void 0?n:1},to:{scaleY:0}};default:return{from:{scaleX:(r=s.getGraphicAttribute("scaleX",!0))!==null&&r!==void 0?r:1,scaleY:(a=s.getGraphicAttribute("scaleY",!0))!==null&&a!==void 0?a:1},to:{scaleX:0,scaleY:0}}}},aX=(s,t,e)=>{const i=Object.assign({},s.getPrevGraphicAttributes()),n=Object.assign({},s.getNextGraphicAttributes());return t&&Y(t.excludeChannels).forEach(r=>{delete i[r],delete n[r]}),Object.keys(n).forEach(r=>{W_(r,i,n)&&(delete i[r],delete n[r])}),{from:i,to:n}},oX=(s,t,e)=>{var i;const n=(i=s.getGraphicAttribute("angle",!1))!==null&&i!==void 0?i:0;let r=0;return r=ns(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:H(t==null?void 0:t.angle)?t.angle:(t==null?void 0:t.orient)==="anticlockwise"?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:n}}},lX=(s,t,e)=>{var i;const n=(i=s.getGraphicAttribute("angle",!0))!==null&&i!==void 0?i:0;let r=0;return r=ns(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:H(t==null?void 0:t.angle)?t.angle:(t==null?void 0:t.orient)==="anticlockwise"?Math.ceil(n/(2*Math.PI))*Math.PI*2:Math.floor(n/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:r}}},hX=()=>{st.registerAnimationType("clipIn",b9)},dX=()=>{st.registerAnimationType("clipOut",x9)},uX=()=>{st.registerAnimationType("fadeIn",S9)},cX=()=>{st.registerAnimationType("fadeOut",A9)},pX=()=>{st.registerAnimationType("growCenterIn",k9)},gX=()=>{st.registerAnimationType("growCenterOut",w9)},fX=()=>{st.registerAnimationType("growHeightIn",L9)},_X=()=>{st.registerAnimationType("growHeightOut",F9)},mX=()=>{st.registerAnimationType("growWidthIn",C9)},vX=()=>{st.registerAnimationType("growWidthOut",R9)},uD=()=>{st.registerAnimationType("growPointsIn",q9)},cD=()=>{st.registerAnimationType("growPointsOut",Z9)},yX=()=>{st.registerAnimationType("growPointsXIn",J9)},bX=()=>{st.registerAnimationType("growPointsXOut",Q9)},xX=()=>{st.registerAnimationType("growPointsYIn",tX)},SX=()=>{st.registerAnimationType("growPointsYOut",eX)},AX=()=>{st.registerAnimationType("growAngleIn",H9)},kX=()=>{st.registerAnimationType("growAngleOut",N9)},wX=()=>{st.registerAnimationType("growRadiusIn",$9)},TX=()=>{st.registerAnimationType("growRadiusOut",K9)},MX=()=>{st.registerAnimationType("moveIn",iX)},CX=()=>{st.registerAnimationType("moveOut",sX)},PX=()=>{st.registerAnimationType("scaleIn",nX)},EX=()=>{st.registerAnimationType("scaleOut",rX)},RX=()=>{st.registerAnimationType("rotateIn",oX)},OX=()=>{st.registerAnimationType("rotateOut",lX)},DX=()=>{st.registerAnimationType("update",aX)};class pD extends Oh{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&t==="update"){const i=this.parameters(),n=Zr(e)?null:Object.keys(e).reduce((r,a)=>(V_(e[a])&&(r[a]=gu(e[a].scale,i)),r),{});this._encoders[t]={callback:(r,a,o)=>{const l=Qa(e,r,a,o);if(C(l.size)){const h=n.x?MT(n.x):void 0,d=n.y?MT(n.y):void 0;C(h)&&C(d)?l.size=10:C(h)?l.size=d:C(d)&&(l.size=h),l.size=[h,d]}return C(l.shape)&&(l.shape="rect"),l}}}else this._encoders[t]=e}_getEncoders(){var t;return(t=this._encoders)!==null&&t!==void 0?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(lt(i.padding)&&i.padding>0)t.size=U(i.size)?i.size.map(n=>Math.max(n-i.padding,1)):Math.max(i.size-i.padding,1);else if(U(i.padding)&&i.padding.length===2){const n=U(i.size)?i.size:[i.size,i.size];t.size=[Math.max(n[0]-i.padding[0],1),Math.max(n[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(co.symbol)}release(){super.release(),this._encoders=null}}pD.markType=nt.cell;const LX=()=>{st.registerMark(nt.cell,pD)},BX=["pointerdown","pointerup","pointerupoutside","pointertap","pointerover","pointermove","pointerenter","pointerleave","pointerout","mousedown","mouseup","mouseupoutside","rightdown","rightup","rightupoutside","click","dblclick","mousemove","mouseover","mouseout","mouseenter","mouseleave","wheel","touchstart","touchend","touchendoutside","touchmove","touchcancel","tap","dragstart","drag","dragenter","dragleave","dragover","dragend","drop","pan","panstart","panend","press","pressup","pressend","pinch","pinchstart","pinchend","swipe"];var bt;(function(s){s.initialized="initialized",s.rendered="rendered",s.renderFinished="renderFinished",s.animationFinished="animationFinished",s.regionSeriesDataFilterOver="regionSeriesDataFilterOver",s.afterInitData="afterInitData",s.afterInitEvent="afterInitEvent",s.afterInitMark="afterInitMark",s.rawDataUpdate="rawDataUpdate",s.viewDataFilterOver="viewDataFilterOver",s.viewDataUpdate="viewDataUpdate",s.viewDataStatisticsUpdate="viewDataStatisticsUpdate",s.markDeltaYUpdate="markDeltaYUpdate",s.viewDataLabelUpdate="viewDataLabelUpdate",s.scaleDomainUpdate="scaleDomainUpdate",s.scaleUpdate="scaleUpdate",s.dataZoomChange="dataZoomChange",s.drill="drill",s.layoutStart="layoutStart",s.layoutEnd="layoutEnd",s.layoutRectUpdate="layoutRectUpdate",s.playerPlay="playerPlay",s.playerPause="playerPause",s.playerEnd="playerEnd",s.playerChange="playerChange",s.playerForward="playerForward",s.playerBackward="playerBackward",s.scrollBarChange="scrollBarChange",s.brushStart="brushStart",s.brushChange="brushChange",s.brushEnd="brushEnd",s.brushClear="brushClear",s.legendSelectedDataChange="legendSelectedDataChange",s.legendFilter="legendFilter",s.legendItemClick="legendItemClick",s.legendItemHover="legendItemHover",s.legendItemUnHover="legendItemUnHover",s.tooltipShow="tooltipShow",s.tooltipHide="tooltipHide",s.tooltipRelease="tooltipRelease",s.afterResize="afterResize",s.afterRender="afterRender",s.afterLayout="afterLayout"})(bt||(bt={}));var Jt;(function(s){s.chart="chart",s.window="window",s.canvas="canvas"})(Jt||(Jt={}));var Yt;(function(s){s.vchart="vchart",s.chart="chart",s.model="model",s.mark="mark"})(Yt||(Yt={}));const Ef=`${xt}_waterfall_default_seriesField`,gD=`${xt}_CORRELATION_X`,fD=`${xt}_CORRELATION_Y`,_D=`${xt}_CORRELATION_SIZE`,ui=`${xt}_DEFAULT_DATA_INDEX`,$n=`${xt}_DEFAULT_DATA_KEY`,Ms=`${xt}_DEFAULT_DATA_SERIES_FIELD`,YT=`${xt}_DEFAULT_SERIES_STYLE_NAME`;var Q;(function(s){s[s.Default=0]="Default",s[s.Theme=1]="Theme",s[s.Chart=2]="Chart",s[s.Base_Series=3]="Base_Series",s[s.Series=4]="Series",s[s.Mark=5]="Mark",s[s.User_Chart=6]="User_Chart",s[s.User_Series=7]="User_Series",s[s.User_Mark=8]="User_Mark",s[s.Built_In=99]="Built_In"})(Q||(Q={}));const qs=`${xt}_STACK_START`,ii=`${xt}_STACK_END`,xu=`${xt}_STACK_START_PERCENT`,Ma=`${xt}_STACK_END_PERCENT`,nb=`${xt}_STACK_START_OffsetSilhouette`,rb=`${xt}_STACK_END_OffsetSilhouette`,mD=`${xt}_STACK_TOTAL`,IX=`${xt}_STACK_TOTAL_PERCENT`,ab=`${xt}_STACK_TOTAL_TOP`,jp=`${xt}_SEGMENT_START`,Ev=`${xt}_SEGMENT_END`;var he;(function(s){s[s.Axis_Grid=50]="Axis_Grid",s[s.CrossHair_Grid=100]="CrossHair_Grid",s[s.Region=450]="Region",s[s.Mark=300]="Mark",s[s.Node=400]="Node",s[s.Axis=100]="Axis",s[s.MarkLine=500]="MarkLine",s[s.MarkArea=100]="MarkArea",s[s.MarkPoint=500]="MarkPoint",s[s.DataZoom=500]="DataZoom",s[s.ScrollBar=500]="ScrollBar",s[s.Player=500]="Player",s[s.Legend=500]="Legend",s[s.CrossHair=500]="CrossHair",s[s.Indicator=500]="Indicator",s[s.Title=500]="Title",s[s.Label=500]="Label",s[s.Brush=500]="Brush",s[s.CustomMark=500]="CustomMark",s[s.Interaction=700]="Interaction"})(he||(he={}));var xn;(function(s){s[s.Indicator=10]="Indicator",s[s.Region=20]="Region",s[s.Axis=30]="Axis",s[s.DataZoom=40]="DataZoom",s[s.Player=40]="Player",s[s.ScrollBar=40]="ScrollBar",s[s.Legend=50]="Legend",s[s.Title=70]="Title",s[s.CustomMark=70]="CustomMark"})(xn||(xn={}));const XT=["linear","radial","conical"],FX={x0:0,y0:0,x1:1,y1:1},jX={x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},zX={x:.5,y:.5,startAngle:0,endAngle:2*Math.PI},HX={linear:FX,radial:jX,conical:zX},be={label:{name:"label",type:"text"}},Rv=`${xt}_rect_x`,Ov=`${xt}_rect_x1`,Dv=`${xt}_rect_y`,Lv=`${xt}_rect_y1`,um=Object.assign(Object.assign({},be),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),Xx=Object.assign(Object.assign({},be),{bar3d:{name:"bar3d",type:"rect3d"}}),Vr={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},vD=Object.assign(Object.assign({},be),Vr),yD=Object.assign(Object.assign({},be),{point:{name:"point",type:"symbol"}}),Kx=Object.assign(Object.assign(Object.assign({},be),Vr),{area:{name:"area",type:"area"}}),bD=Object.assign(Object.assign(Object.assign({},be),Vr),{area:{name:"area",type:"area"}}),xD=Object.assign(Object.assign({},be),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),SD=Object.assign(Object.assign({},be),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}}),AD=Object.assign(Object.assign({},be),{rose:{name:"rose",type:"arc"}}),kD=Object.assign(Object.assign({},be),{area:{name:"area",type:"path"}}),qx=Object.assign(Object.assign({},be),{group:{name:"group",type:"group"}}),wD=Object.assign(Object.assign({},qx),{track:{name:"track",type:"progressArc"},progress:{name:"progress",type:"progressArc"}}),TD=Object.assign(Object.assign({},be),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),MD=Object.assign(Object.assign({},be),{group:{name:"group",type:"group"},grid:{name:"grid",type:"rule"},gridBackground:{name:"gridBackground",type:"rect"},dot:{name:"dot",type:"symbol"},title:{name:"title",type:"text"},subTitle:{name:"subTitle",type:"text"},symbol:{name:"symbol",type:"symbol"}}),ob=Object.assign(Object.assign({},be),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"}}),CD=Object.assign(Object.assign({},be),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),PD=Object.assign(Object.assign({},be),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}}),ED=Object.assign(Object.assign({},be),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),RD=Object.assign(Object.assign({},um),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),OD=Object.assign(Object.assign({},be),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),DD=Object.assign(Object.assign({},be),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),LD=Object.assign(Object.assign({},be),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}}),BD=Object.assign(Object.assign({},qx),{segment:{name:"segment",type:"progressArc"},track:{name:"track",type:"progressArc"}}),ID=Object.assign(Object.assign({},be),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),FD=Object.assign(Object.assign({},be),{sunburst:{name:"sunburst",type:"arc"}}),jD=Object.assign(Object.assign({},um),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),zD=Object.assign(Object.assign({},Xx),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),HD=Object.assign(Object.assign({},be),{circlePacking:{name:"circlePacking",type:"arc"}}),GD=Object.assign(Object.assign({},be),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}}),WD=Object.assign(Object.assign({},be),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),ND=Object.assign({},Kx);var KT;(function(s){s.area_horizontal="area_horizontal",s.area_vertical="area_vertical",s.line_horizontal="line_horizontal",s.line_vertical="line_vertical",s.bar_horizontal="bar_horizontal",s.bar_vertical="bar_vertical",s.bar3d_horizontal="bar3d_horizontal",s.bar3d_vertical="bar3d_vertical",s.rangeColumn_horizontal="rangeColumn_horizontal",s.rangeColumn_vertical="rangeColumn_vertical",s.rangeColumn3d_horizontal="rangeColumn3d_horizontal",s.rangeColumn3d_vertical="rangeColumn3d_vertical",s.rangeArea_horizontal="rangeArea_horizontal",s.rangeArea_vertical="rangeArea_vertical",s.linearProgress_horizontal="linearProgress_horizontal",s.linearProgress_vertical="linearProgress_vertical",s.boxPlot_horizontal="boxPlot_horizontal",s.boxPlot_vertical="boxPlot_vertical",s.sankey_horizontal="sankey_horizontal",s.sankey_vertical="sankey_vertical",s.waterfall_horizontal="waterfall_horizontal",s.waterfall_vertical="waterfall_vertical"})(KT||(KT={}));const Rf={[j.bar]:um,[j.bar3d]:Xx,[j.line]:vD,[j.scatter]:yD,[j.area]:Kx,[j.radar]:bD,[j.pie]:xD,[j.pie3d]:SD,[j.rose]:AD,[j.geo]:be,[j.map]:kD,[j.circularProgress]:wD,[j.link]:TD,[j.dot]:MD,[j.wordCloud]:ob,[j.wordCloud3d]:ob,[j.funnel]:CD,[j.funnel3d]:PD,[j.linearProgress]:ED,[j.waterfall]:RD,[j.boxPlot]:OD,[j.treemap]:DD,[j.sankey]:LD,[j.gauge]:BD,[j.gaugePointer]:ID,[j.sunburst]:FD,[j.rangeColumn]:jD,[j.rangeColumn3d]:zD,[j.circlePacking]:HD,[j.heatmap]:GD,[j.correlation]:WD,[j.rangeArea]:ND};function VD(s){var t,e;const{type:i}=s;return i===j.sankey?(t=s.direction)!==null&&t!==void 0?t:"horizontal":(e=s.direction)!==null&&e!==void 0?e:"vertical"}const GX={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},WX={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function NX(s,t){const e=GX[t];if(e&&s[e])return s[e];if(s[t])return s[t];const i=WX[t];return i?s[i]:void 0}function Su(s,t){var e;if(!s)return[];const i=UD(s,t);if(!i||U(i))return(e=i)!==null&&e!==void 0?e:[];if(Vt(i)){const{dataScheme:n}=i;return n?Zx(n)?n.map(r=>Object.assign(Object.assign({},r),{scheme:r.scheme.map(a=>Of(a)?hb(s,a,t):a).filter(E)})):n.map(r=>Of(r)?hb(s,r,t):r).filter(E):[]}return[]}function lb(s,t){var e,i;return Zx(s)?(i=(e=s.find(n=>E(n.isAvailable)?q(n.isAvailable)?n.isAvailable(t):!!n.isAvailable:!E(n.maxDomainLength)||(t==null?void 0:t.length)<=n.maxDomainLength))===null||e===void 0?void 0:e.scheme)!==null&&i!==void 0?i:s[s.length-1].scheme:s}function hb(s,t,e){var i;const n=UD(s,e);if(!n)return;let r;const{palette:a}=n;if(Vt(a)&&(r=(i=NX(a,t.key))!==null&&i!==void 0?i:t.default),!r)return;if(C(t.a)&&C(t.l)||!ot(r))return r;let o=new Ue(r);if(E(t.l)){const{r:l,g:h,b:d}=o.color,{h:u,s:c}=m_(l,h,d),p=Vp(u,c,t.l),g=new Ue(`rgb(${p.r}, ${p.g}, ${p.b})`);g.setOpacity(o.color.opacity),o=g}return E(t.a)&&o.setOpacity(t.a),o.toRGBA()}const VX=(s,t,e)=>{if(t&&Of(s)){const i=hb(t,s,e);if(i)return i}return s};function Of(s){return s&&s.type==="palette"&&!!s.key}function Zx(s){return!(!U(s)||s.length===0)&&s.every(t=>E(t.scheme))}function UX(s){return U(s)?{dataScheme:s}:s}function UD(s,t){var e,i;const{type:n}=t??{};let r;if(!t||C(n))r=s==null?void 0:s.default;else{const a=VD(t);r=(i=(e=s==null?void 0:s[`${n}_${a}`])!==null&&e!==void 0?e:s==null?void 0:s[n])!==null&&i!==void 0?i:s==null?void 0:s.default}return r}class _c extends ho{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!Zx(this._range))return void super.range(this._range);const t=lb(this._range,this._domain);super.range(t)}}const $X={linear:Qs,band:Ao,point:mV,ordinal:ho,threshold:kx,colorOrdinal:_c};function db(s){const t=$X[s];return t?new t:null}function YX(s,t){if("scale"in s&&s.scale)return ot(s.scale)&&(t!=null&&t.globalScale)?t.globalScale.registerMarkAttributeScale(s,t.seriesId):s.scale;const e=db(s.type);return e&&XX(e,s),e}function XX(s,t){s&&t&&(t.domain&&s.domain(t.domain),t.range&&s.range(t.range),t.specified&&s.specified&&s.specified(t.specified))}function Qt(s,t){if(!t)return s;const e=t.range(),i=Math.min(e[0],e[e.length-1]),n=Math.max(e[0],e[e.length-1]);return Math.min(Math.max(i,s),n)}function qT(s){return E(s==null?void 0:s.field)&&E(s==null?void 0:s.scale)}function Jx(s){switch(s){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function fs(s){return!!ot(s)&&!!s.endsWith("%")&&Un(s.substring(0,s.length-1))}function KX(s){return!!Vt(s)&&("percent"in s||"offset"in s)}function zi(s,t,e){var i,n;return lt(s)?s:fs(s)?Number(s.substring(0,s.length-1))*t/100:q(s)?s(e):Vt(s)?t*((i=s.percent)!==null&&i!==void 0?i:0)+((n=s.offset)!==null&&n!==void 0?n:0):0}function $D(s,t,e){var i,n,r,a;const o={top:0,bottom:0,left:0,right:0};return Object.values(s).every(l=>lt(l))?(o.top=(i=s.top)!==null&&i!==void 0?i:0,o.right=(n=s.right)!==null&&n!==void 0?n:0,o.bottom=(r=s.bottom)!==null&&r!==void 0?r:0,o.left=(a=s.left)!==null&&a!==void 0?a:0,o):([{orients:["left","right"],size:t.width},{orients:["top","bottom"],size:t.height}].forEach(l=>{l.orients.forEach(h=>{o[h]=zi(s[h],l.size,e)})}),o)}function qX(s,t){return s?{width:Math.ceil(Math.min(s.x2-s.x1,t.width)),height:Math.ceil(Math.min(s.y2-s.y1,t.height))}:{width:0,height:0}}function Ar(s){let t={};return U(s)?(C(s[0])||(t.top=t.left=t.bottom=t.right=s[0]),C(s[1])||(t.left=t.right=s[1]),C(s[2])||(t.bottom=s[2]),C(s[3])||(t.left=s[3]),t):lt(s)||fs(s)||q(s)||KX(s)?(t.top=t.left=t.bottom=t.right=s,t):(Vt(s)&&(t=Object.assign({},s)),t)}function ZT(s,t,e){return e?{x:s.x+t.x,y:s.y+t.y}:s}const rl=(s,t)=>{const e=Number(s),i=s.toString();return isNaN(e)&&i[i.length-1]==="%"?t*(Number(i.slice(0,i.length-1))/100):e};function ZX(s){if(!s)return null;if(typeof s=="string")return{fill:s,fillOpacity:1};if(typeof s!="object")return null;const t=Kl(s,["x","y","width","height","x1","y1","image"]);return t.background=s.image,t}const YD=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}],JX={default:{dataScheme:YD,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2"}}},QX={label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}}},tK={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},eK={bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},iK={outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},vt={defaultFontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",defaultFontSize:14,l1FontSize:32,l2FontSize:20,l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%",axisTickSize:4,areaOpacity:.2},sK={dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight}}},nK={transform:{style:{fill:{type:"palette",key:"axisGridColor"}}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}},rK={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fill:"#707070",textBaseline:"middle"}}},aK={outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},oK="M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z",JT="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",lK={pointer:{type:"path",width:.4,height:.4,style:{path:oK}},pin:{width:.025,height:.025,style:{path:JT,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:JT,fill:"#ddd"}}},hK={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dK={bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},uK={arrow:{style:{size:10}}},cK={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:vt.l6FontSize,lineHeight:vt.l6LineHeight,textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},pK={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}}},gK={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside"}},fK={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},_K={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},mK={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight}},label:{visible:!1,offset:12,position:"inside"}},vK={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},yK={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},bK={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight}},nonLeafLabel:{padding:2*vt.l5FontSize,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,textBaseline:"middle",textAlign:"center"}}},xK={innerRadius:0,outerRadius:1,startAngle:Td,endAngle:Dp,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight}}},SK={label:{visible:!1,offset:5,position:"inside",style:{fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},AK={layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight}}},kK={cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},wK={link:{style:{fillOpacity:.15,round:!0}}},TK={rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},MK={boxPlot:{style:{lineWidth:1}}},CK={centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},PK={scatter:_K,line:hK,area:QX,bar:tK,bar3d:eK,pie:pK,pie3d:gK,map:cK,radar:fK,dot:sK,link:uK,wordCloud:vK,wordCloud3d:yK,funnel:nK,funnel3d:rK,linearProgress:dK,circularProgress:iK,waterfall:mK,gauge:aK,gaugePointer:lK,treemap:bK,sunburst:xK,rangeColumn:SK,circlePacking:AK,heatmap:kK,sankey:wK,rose:TK,boxPlot:MK,correlation:CK},EK={text:{style:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fontWeight:"normal",fillOpacity:1}}},RK={label:{style:{fontSize:vt.l4FontSize,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:vt.areaOpacity}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},circlePacking:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},funnel3d:{style:{stroke:!1}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06}}}},OK={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},XD={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:vt.l5FontSize,fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},DK={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:vt.l5FontSize,fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},LK=Object.assign(Object.assign({},XD),{label:{space:0}}),BK={domainLine:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},grid:{visible:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:{type:"palette",key:"axisGridColor"},strokeOpacity:1,lineDash:[4,4]}},tick:{visible:!0,inside:!1,tickSize:vt.axisTickSize,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:vt.axisTickSize/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:vt.l5FontSize,fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},IK={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},FK={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},jK={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},zK={style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},QT=()=>({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:vt.l5FontSize},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}),HK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:QT()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[2,3]}},label:QT()}},tM=`M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3
- C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6
- C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6
- C0.3-1.4,0.3-1.4,0.3-1.4z;`,GK={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"sliderHandleColor"},stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},symbolType:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",lineWidth:.5}}},background:{size:20,style:{fill:{type:"palette",key:"sliderRailColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"sliderTrackColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:tM,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:tM,fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},WK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:vt.l1FontSize,fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:vt.l2FontSize,fill:{type:"palette",key:"tertiaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},Df={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},eM={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}},NK={horizontal:Object.assign(Object.assign({},Df),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:eM}),vertical:Object.assign(Object.assign({},Df),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:eM})},VK={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:vt.l5FontSize,lineHeight:vt.l5LineHeight,opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},iM={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}},UK={horizontal:Object.assign(Object.assign({},Df),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:iM}),vertical:Object.assign(Object.assign({},Df),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"sliderRailColor"}}},handler:iM})},$K={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:vt.l6FontSize}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:vt.l6FontSize}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},YK={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:vt.l4FontSize,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},XK={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:{visible:!1,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{visible:!0,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},label:{refY:5,style:{fontSize:vt.l4FontSize,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},KK={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}},qK={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},ZK={padding:{top:4,bottom:20},textStyle:{fontSize:vt.l3FontSize,lineHeight:vt.l3LineHeight,fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fill:{type:"palette",key:"tertiaryFontColor"}}},JK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:vt.l4FontSize,lineHeight:vt.l4LineHeight,fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},QK={visible:!0,position:"auto",padding:8,titleStyle:{fontSize:vt.l5FontSize,fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:vt.l5FontSize,fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}},tq={visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:vt.l4FontSize,fill:{type:"palette",key:"primaryFontColor"}}},eq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},iq={discreteLegend:VK,colorLegend:NK,sizeLegend:UK,axis:BK,axisBand:OK,axisLinear:IK,axisX:XD,axisY:DK,axisZ:LK,axisAngle:jK,axisRadius:FK,markLine:XK,markArea:YK,markPoint:KK,tooltip:JK,dataZoom:GK,crosshair:HK,player:qK,brush:zK,indicator:WK,title:ZK,mapLabel:$K,poptip:QK,totalLabel:tq,scrollBar:eq},Au={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:vt.defaultFontFamily,colorScheme:JX,mark:EK,markByName:RK,series:PK,component:iq,animationThreshold:2e3},sq={default:{dataScheme:YD,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff"}}},sM={name:"dark",colorScheme:sq,component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}};function KD(s,t,e=!1){if(t){if(s===t)return;if(E(t)&&typeof t=="object"){const i=Object(t),n=[];for(const o in i)n.push(o);let{length:r}=n,a=-1;for(;r--;){const o=n[++a];E(i[o])&&typeof i[o]=="object"&&!U(s[o])?nq(s,t,o,e):qD(s,o,i[o])}}}}function nq(s,t,e,i=!1){const n=s[e],r=t[e];let a=t[e],o=!0;if(U(r)){if(i)a=[];else if(U(n))a=n;else if(__(n)){a=new Array(n.length);let l=-1;const h=n.length;for(;++l<h;)a[l]=n[l]}}else vn(r)?(a=n??{},typeof n!="function"&&typeof n=="object"||(a={})):o=!1;o&&KD(a,r,i),qD(s,e,a)}function qD(s,t,e){(e!==void 0&&!rq(s[t],e)||e===void 0&&!(t in s))&&(s[t]=e)}function rq(s,t){return s===t||Number.isNaN(s)&&Number.isNaN(t)}function _t(s,...t){let e=-1;const i=t.length;for(;++e<i;)KD(s,t[e],!0);return s}function nM(s,t,e,i){Object.keys(s).forEach(n=>{if(Vt(t))t.type===n&&(U(s[n])?s[n].length>=t.index&&(s[n][t.index]=i?_t({},s[n][t.index],e):e):s[n]=i?_t({},s[n],e):e);else if(U(s[n])){const r=s[n].findIndex(a=>a.id===t);r>=0&&(s[n][r]=i?_t({},s[n][r],e):e)}else s.id===t&&(s[n]=i?_t({},s[n],e):e)})}function ub(s,...t){return _t(rM(s),...t.map(rM))}function rM(s){if(!s)return s;const t=aq(s.colorScheme),{series:e}=s,{mark:i,markByName:n}=s;let r;return(i||n)&&(r=Object.keys(Rf).reduce((a,o)=>{var l;const h=(l=e==null?void 0:e[o])!==null&&l!==void 0?l:{};return a[o]=cb(h,o,i,n),a},{})),Object.assign({},s,{colorScheme:t,series:Object.assign({},s.series,r)})}function aq(s){return s&&(s=Object.keys(s).reduce((t,e)=>{const i=s[e];return t[e]=UX(i),t},{})),s}function cb(s,t,e,i){if(!Rf[t])return s;const n={};return Object.values(Rf[t]).forEach(({type:r,name:a})=>{n[a]=_t({},e==null?void 0:e[Y(r)[0]],i==null?void 0:i[a],s==null?void 0:s[a])}),Object.assign(Object.assign({},s),n)}const oq=["animationThreshold","colorScheme","fontFamily","name","padding"];function cm(s,t,e){if(!s)return s;const i={};return Object.keys(s).forEach(n=>{const r=s[n];oq.includes(n)?i[n]=r:vn(r)?Of(r)?i[n]=VX(r,t,e):i[n]=cm(r,t,e):i[n]=r}),i}const Ul={[Au.name]:Au},mc=Au.name,uh=new Map(Object.keys(Ul).map(s=>[s,Ul[s]])),Qx=new Map(Object.keys(Ul).map(s=>[s,cm(Ul[s],Ul[s].colorScheme)])),Lf=new Map(Object.keys(Ul).map(s=>[s,s===mc])),tS=(s,t)=>{if(!s)return;const e=dq(t);uh.set(s,e),Qx.set(s,cm(e,e.colorScheme)),Lf.set(s,!0)},ZD=(s=mc,t=!1)=>(Lf.has(s)&&!Lf.get(s)&&tS(s,uh.get(s)),t?Qx.get(s):uh.get(s)),lq=s=>uh.delete(s)&&Qx.delete(s)&&Lf.delete(s),hq=s=>!!ot(s)&&uh.has(s),dq=s=>{var t;const e=(t=s.type)!==null&&t!==void 0?t:mc,i=ZD(e);return ub({},i,s)};class Vs{static registerInstance(t){Vs.instances.set(t.id,t)}static unregisterInstance(t){Vs.instances.delete(t.id)}static getInstance(t){return Vs.instances.get(t)}static instanceExist(t){return Vs.instances.has(t)}static forEach(t,e=[],i){const n=Y(e);return Vs.instances.forEach((r,a,o)=>{n.includes(a)||t(r,a,o)},i)}}Vs.instances=new Map;class es{static registerTheme(t,e){tS(t,e)}static getTheme(t,e=!1){return ZD(t,e)}static removeTheme(t){return lq(t)}static themeExist(t){return hq(t)}static getDefaultTheme(){return es.themes.get(mc)}static setCurrentTheme(t){es.themeExist(t)&&(es._currentThemeName=t,Vs.forEach(e=>e==null?void 0:e.setCurrentTheme(t)))}static getCurrentTheme(){return es.getTheme(es._currentThemeName)}static getCurrentThemeName(){return es._currentThemeName}}es.themes=uh,es._currentThemeName=mc;function Lr(s,t){return ot(s)?es.themeExist(s)?es.getTheme(s,t):{}:Vt(s)?s:{}}function pb(s,t={data:e=>e}){if(!s)return s;if(s.constructor===Object){const e={};for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){if(t[i]){e[i]=t[i](s[i]);continue}e[i]=pb(s[i],t)}return e}return U(s)?s.map(e=>pb(e,t)):s}function gb(s,t){if(!s)return s;if(vn(s)){const e={};for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){if(ot(s[i])&&t.getFunction(s[i])){e[i]=t.getFunction(s[i]);continue}e[i]=gb(s[i],t)}return e}return U(s)?s.map(e=>gb(e,t)):s}const uq=(s,t,e)=>wx(s,t,e,{fontFamily:vt.defaultFontFamily,fontSize:vt.defaultFontSize}),cq=(s,t,e,i)=>uq(t,e,i).measure(s);function $l(s,t){for(let e=0;e<t.length;e++){const i=t[e],n=pq(s,i.key);n?n.operations=[...new Set(n.operations.concat(i.operations))]:s.push(i)}return s}function pq(s,t){return s.find(e=>e.key===t)}function Bf(s,t){var e;if(!s)return t??null;const i=s.getFields();return i&&i[t]?(e=i[t].alias)!==null&&e!==void 0?e:t:t??null}function JD(s,t,e){const i={};return s.getSeries().forEach(n=>{var r;const a=n.getStackData(),o=n.getStackValue(),l=n.getStackValueField(),h=!e||e(n);a&&l&&h&&(i[o]=(r=i[o])!==null&&r!==void 0?r:{nodes:{}},eL(n,a,i[o],l,t))}),i}function QD(s,t){if("values"in s&&s.values.length){const e=FR(s.values,t),i=Mx(s.values,Ma);s.values.forEach(r=>{r[mD]=e,r[IX]=i,delete r[ab]});const n=s.values.reduce((r,a)=>a[ii]>r[ii]?a:r);n[ab]=!0}else for(const e in s.nodes)QD(s.nodes[e],t)}function gq(s){if(!s.values.length)return;const t=s.values[s.values.length-1][ii]/2;for(let e=0;e<s.values.length;e++)s.values[e][nb]=s.values[e][qs]-t,s.values[e][rb]=s.values[e][ii]-t}function tL(s,t,e){if(s.values.length>0){let i=0,n=0,r=1,a=0;const o=s.values.length;for(let l=0;l<o;l++){const h=s.values[t?o-1-l:l];a=h[ii],a>=0?(h[qs]=i,i+=h[ii],h[ii]=i):(h[qs]=n,n+=h[ii],h[ii]=n)}if(e)for(let l=0;l<o;l++){const h=s.values[t?o-1-l:l];a=h[ii];const d=a>=0?i:n;r=a>=0?1:-1,h[xu]=d===0?0:Math.min(1,h[qs]/d)*r,h[Ma]=d===0?0:Math.min(1,h[ii]/d)*r}}for(const i in s.nodes)tL(s.nodes[i],t,e)}function eL(s,t,e,i,n){if("values"in t)return n&&t.values.forEach(r=>r[ii]=UN(r[i])),e.values.push(...t.values),void e.series.push({s,values:t.values});for(const r in t.nodes)!e.nodes[r]&&(e.nodes[r]={values:[],series:[],nodes:{}}),eL(s,t.nodes[r],e.nodes[r],i,n)}const iL=(s,t,e="key",i="children")=>{for(let n=0;n<s.length;n++){const r=s[n];if(r[e]===t)return r;if(r[i]){const a=iL(r[i],t,e,i);if(a)return a}}return null},sL=(s,t,e="key",i="children")=>{for(let n=0;n<s.length;n++){const r=s[n];if(r[i])for(let a=0;a<r[i].length;a++){const o=r[i][a];if(o[e]===t)return r;const l=sL([o],t,e,i);if(l)return l}}return null},fq=(s,t,e="key",i="children")=>{const n=[],r=(a,o)=>{for(const l of a){if(l[e]===t)return n.push(...o,l[e].toString()),!0;if(l[i]){const h=r(l[i],[...o,l[e]]);if(h===!0)return h}}return!1};return r(s,[]),n};function gn(s={}){const t=Object.assign({},s);if(q(s.style)?t.style=(e,i,n,r)=>At(s.style(e,i,n,r)):ft(s.style)||(t.style=At(s.style)),!ft(s.state)){const e={};Object.keys(s.state).forEach(i=>{q(s.state[i])?e[i]=(n,r,a,o)=>At(s.state[i](n,r,a,o)):ft(s.state[i])||(e[i]=At(s.state[i]))}),t.state=e}return t}function Do(s){if(ft(s))return null;const t={};return Object.keys(s).forEach(e=>{q(s[e])?t[e]=(i,n,r,a)=>At(s[e](i,n,r,a)):ft(s[e])||(t[e]=At(s[e]))}),t}function _q(s){if(ft(s))return null;const t={};return Object.keys(s).forEach(e=>{q(s[e])?t[e]=(i,n,r,a)=>At(s[e](i.rawValue,n,i,r,a)):ft(s[e])||(t[e]=At(s[e]))}),t}function At(s){return s!=null&&s.angle&&(s.angle=le(s.angle)),s}class I{static registerChart(t,e){I._charts[t]=e}static registerSeries(t,e){I._series[t]=e}static registerComponent(t,e,i){I._components[t]={cmp:e,alwaysCheck:i}}static registerMark(t,e){I._marks[t]=e}static registerRegion(t,e){I._regions[t]=e}static registerTransform(t,e){I.transforms[t]=e}static registerLayout(t,e){I._layout[t]=e}static registerAnimation(t,e){I._animations[t]=e}static registerImplement(t,e){I._implements[t]=e}static registerChartPlugin(t,e){I._chartPlugin[t]=e}static createChart(t,e,i){return I._charts[t]?new I._charts[t](e,i):null}static createChartSpecTransformer(t,e){if(!I._charts[t])return null;const i=I._charts[t];return new i.transformerConstructor(Object.assign({seriesType:i.seriesType},e))}static createRegion(t,e,i){return I._regions[t]?new I._regions[t](e,i):null}static createRegionSpecTransformer(t,e){return I._regions[t]?new I._regions[t].transformerConstructor(e):null}static createSeries(t,e,i){return I._series[t]?new I._series[t](e,i):null}static createSeriesSpecTransformer(t,e){return I._series[t]?new I._series[t].transformerConstructor(e):null}static createMark(t,e,i){if(!I._marks[t])return null;const n=new I._marks[t](e,i);return n.type==="group"&&n.setInteractive(!1),n}static getComponents(){return Object.values(I._components)}static getComponentInKey(t){return I._components[t].cmp}static getLayout(){return Object.values(I._layout)}static getLayoutInKey(t){return I._layout[t]}static getSeries(){return Object.values(I._series)}static getSeriesInType(t){return I._series[t]}static getRegionInType(t){return I._regions[t]}static getAnimationInKey(t){return I._animations[t]}static getImplementInKey(t){return I._implements[t]}static getSeriesMarkMap(t){return I._series[t]?I._series[t].mark:{}}static getChartPlugins(){return Object.values(I._chartPlugin)}}I._charts={},I._series={},I._components={},I._marks={},I._regions={},I._animations={},I._implements={},I._chartPlugin={},I.transforms={simplify:NP,fields:VP,filter:kF,fold:Dj},I.dataParser={csv:YP,dsv:$P,tsv:XP},I._layout={};const mq=(s,t,e)=>s.x>=t.x&&s.x<=e.x&&s.y>=t.y&&s.y<=e.y,vq=(s,t,e)=>{const i=s.getRegionsInIds(Y(t.layout.layoutBindRegionID));return i==null?void 0:i.some(n=>{const r=n.getLayoutRect(),a=n.getLayoutStartPoint();return mq(e,{x:a.x,y:a.y},{x:r.width+a.x,y:r.height+a.y})})},nL=(s,t)=>{var e,i;return s===t||!C(s)&&!C(t)&&s.value===t.value&&((e=s.axis)===null||e===void 0?void 0:e.id)===((i=t.axis)===null||i===void 0?void 0:i.id)},fb=(s,t,e,i)=>{var n;const r=t.getScale(),a=Pi(r.type),o=[],l=t.getRegions();for(const h of l){const d=h.getSeries();for(const u of d)if(u.coordinate===e){const c=Y(i(u)),p=(n=u.getViewData())===null||n===void 0?void 0:n.latestData;if(c&&p)if(a)o.push({series:u,datum:p.filter(g=>{var f;return((f=g[c[0]])===null||f===void 0?void 0:f.toString())===(s==null?void 0:s.toString())})});else if(E(c[1]))o.push({series:u,datum:p.filter(g=>{var f;return((f=g[c[0]])===null||f===void 0?void 0:f.toString())===(s==null?void 0:s.toString())||E(g[c[0]])&&E(g[c[1]])&&s>=g[c[0]]&&s<g[c[1]]})});else{const g=t.getSpec().tooltipFilterRange,f=H(g)?[-g,g]:g;let _=[];if(f)p.forEach(m=>{if(E(m[c[0]])){const v=m[c[0]]-s;v>=f[0]&&v<=f[1]&&_.push(m)}});else{let m=1/0,v=0;p.forEach(y=>{if(E(y[c[0]])){const b=Math.abs(y[c[0]]-s),x=Math.sign(y[c[0]]-s);b<m?(m=b,_=[y],v=x):b===m&&x===v&&_.push(y)}})}o.push({series:u,datum:_})}}}return o},If=(s,t,e)=>{const i=s.getAllComponents().filter(n=>n.specKey==="axes"&&t(n)&&vq(s,n,e));return i.length?i:null},yq=(s,t)=>{const e=2*Math.PI,i=pi(t),n=Ye(t);return s<i?s+=Math.ceil((i-s)/e)*e:s>n&&(s-=Math.ceil((s-n)/e)*e),s},rL=(s,t)=>{if(!s||!Cx(s.getRegionsInIndex(),"polar"))return null;const{x:e,y:i}=t,n=If(s,l=>l.getOrient()==="angle",t),r=If(s,l=>l.getOrient()==="radius",t),a=[],o=l=>l.getDimensionField()[0];return n&&n.forEach(l=>{var h;const d=l.getScale();if(d&&Pi(d.type)){const u=d.domain(),c=d.range(),p=l.getCenter(),g={x:e-l.getLayoutStartPoint().x-p.x,y:i-l.getLayoutStartPoint().y-p.y};let f=Uk({x:1,y:0},g);f=yq(f,c);const _=Kg(g),m=(h=r[0])===null||h===void 0?void 0:h.getScale(),v=m==null?void 0:m.range();if((f-(c==null?void 0:c[0]))*(f-(c==null?void 0:c[1]))>0||(_-(v==null?void 0:v[0]))*(_-(v==null?void 0:v[1]))>0)return;const y=l.invert(f);if(C(y))return;let b=u.findIndex(S=>(S==null?void 0:S.toString())===y.toString());b<0&&(b=void 0);const x=fb(y,l,"polar",o);a.push({index:b,value:y,axis:l,data:x})}}),r&&r.forEach(l=>{var h;const d=l.getScale(),u=d==null?void 0:d.range();if(d&&Pi(d.type)){const c=l.getCenter(),p={x:e-l.getLayoutStartPoint().x-c.x,y:i-l.getLayoutStartPoint().y-c.y};let g=Uk({x:1,y:0},p);g<-Math.PI/2&&(g=2*Math.PI+g);const f=Kg(p),_=(h=n[0])===null||h===void 0?void 0:h.getScale(),m=_==null?void 0:_.range();if((g-(m==null?void 0:m[0]))*(g-(m==null?void 0:m[1]))>0||(f-(u==null?void 0:u[0]))*(f-(u==null?void 0:u[1]))>0)return;const v=d.invert(f);if(C(v))return;let y=d.domain().findIndex(x=>(x==null?void 0:x.toString())===v.toString());y<0&&(y=void 0);const b=fb(v,l,"polar",o);a.push({index:y,value:v,axis:l,data:b})}}),a.length?a:null};function Ce(s){return s==="bottom"||s==="top"}function dr(s){return s==="left"||s==="right"}function Br(s){return s==="z"}function bq(s,t){return t?Ce(s)?"linear":"band":Ce(s)?"band":"linear"}function Gr(s,t){return Jx(s.orient)||t&&t.includes(s.orient)?s.orient:"left"}function aL(s){return s==="top"||s==="bottom"?"horizontal":"vertical"}function xq(s,t){let e=s.inverse;return t&&!Ce(s.orient)&&(e=!E(s.inverse)||!s.inverse),e}function aM(s,t){var e;const i=(e=s.type)!==null&&e!==void 0?e:bq(s.orient,t);return{axisType:i,componentName:`${J.cartesianAxis}-${i}`}}const oL=s=>s.fieldX[0],lL=s=>s.fieldY[0],Sq=s=>[s.fieldX[0],s.fieldX2],Aq=s=>[s.fieldY[0],s.fieldY2],hL=(s,t)=>{var e,i;if(!s||!Cx(s.getRegionsInIndex(),"cartesian"))return null;const{x:n,y:r}=t,a=(e=If(s,c=>Ce(c.getOrient()),t))!==null&&e!==void 0?e:[],o=(i=If(s,c=>dr(c.getOrient()),t))!==null&&i!==void 0?i:[],l=new Set,h=new Set;[a,o].forEach(c=>c.forEach(p=>{Pi(p.getScale().type)?l.add(p):h.add(p)}));const d=[],u=(c,p)=>{(c==="x"?a:o).forEach(g=>{if((p?l:h).has(g)){const f=kq(g,c==="x"?n:r,c,c==="x"?p?oL:Sq:p?lL:Aq);f&&d.push(f)}})};return s.getSpec().direction==="horizontal"?(u("y",l.size>0),d.length===0&&u("x",l.size>0)):(u("x",l.size>0),d.length===0&&u("y",l.size>0)),d.length?d:null},kq=(s,t,e,i)=>{const n=s.getScale(),r=t-s.getLayoutStartPoint()[e];if((r-n.range()[0])*(r-n.range()[1])>0)return null;const a=n.invert(r);return dL(s,a,i)},dL=(s,t,e)=>{const i=s.getScale();if(C(t))return null;let n=i.domain().findIndex(a=>(a==null?void 0:a.toString())===t.toString());n<0&&(n=void 0);const r=fb(t,s,"cartesian",e??(Ce(s.getOrient())?oL:lL));return{index:n,value:t,axis:s,data:r}};class uL{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=(e=(t=this._eventDispatcher.globalInstance).getChart)===null||e===void 0?void 0:e.call(t)),this._chart}register(t,e){var i,n;((n=(i=this.chart)===null||i===void 0?void 0:i.getOption().onError)!==null&&n!==void 0?n:th)("Method not implemented.")}unregister(){var t,e;((e=(t=this.chart)===null||t===void 0?void 0:t.getOption().onError)!==null&&e!==void 0?e:th)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const r=(i=hL(this.chart,{x:t,y:e}))!==null&&i!==void 0?i:[],a=(n=rL(this.chart,{x:t,y:e}))!==null&&n!==void 0?n:[],o=[].concat(r,a);return o.length===0?null:o}dispatch(t,e){var i;const n=(i=this.chart)===null||i===void 0?void 0:i.getAllComponents().filter(a=>{if(a.specKey!=="axes")return!1;const o=a.getScale();return!!Pi(o.type)&&(!(e!=null&&e.filter)||e.filter(a))}),r=[];return n.forEach(a=>{const o=dL(a,t);o&&r.push(o)}),this._callback.call(null,{action:"enter",dimensionInfo:r}),r}}class wq extends uL{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:n.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:Jt.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}class Tq extends uL{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n===null&&this._cacheDimensionInfo!==null?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=n):n===null||this._cacheDimensionInfo!==null&&n.length===this._cacheDimensionInfo.length&&!n.some((r,a)=>!nL(r,this._cacheDimensionInfo[a]))?n!==null&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:n.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:n.slice()})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:Jt.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:Jt.canvas}),callback:this.onMouseOut}),Aa(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:Jt.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Aa(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var kr;(function(s){s.dimensionHover="dimensionHover",s.dimensionClick="dimensionClick"})(kr||(kr={}));const Bv={[kr.dimensionHover]:Tq,[kr.dimensionClick]:wq};let vc=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n=typeof e=="function"?{query:null,callback:e}:{query:e,callback:i};if(Bv[t]){const r=new Bv[t](this._eventDispatcher,this._mode);r.register(t,n),this._composedEventMap.set(i,{eventType:t,event:r})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,r;const a=i??e;if(Bv[t])if(a)(n=this._composedEventMap.get(a))===null||n===void 0||n.event.unregister(),this._composedEventMap.delete(a);else for(const o of this._composedEventMap.entries())o[1].eventType===t&&((r=this._composedEventMap.get(o[0]))===null||r===void 0||r.event.unregister(),this._composedEventMap.delete(o[0]));else if(a){const o={callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,o)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class Mq{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(Yt.vchart,[]),this._levelNodes.set(Yt.chart,[]),this._levelNodes.set(Yt.model,[]),this._levelNodes.set(Yt.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return(i=this._levelNodes.get(e))===null||i===void 0||i.push(n),this._map.set(t.callback,n),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=i==null?void 0:i.findIndex(r=>r.handler.callback===t.callback);return n!==void 0&&n>=0&&(i==null||i.splice(n,1)),this}getHandlers(t){var e;return((e=this._levelNodes.get(t))===null||e===void 0?void 0:e.map(i=>i.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const oM={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class Cq{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.globalInstance=t,this._compiler=e}register(t,e){var i,n,r,a;this._parseQuery(e);const o=this.getEventBubble(((i=e.filter)===null||i===void 0?void 0:i.source)||Jt.chart),l=this.getEventListeners(((n=e.filter)===null||n===void 0?void 0:n.source)||Jt.chart);if(o.get(t)||o.set(t,new Mq),o.get(t).addHandler(e,(r=e.filter)===null||r===void 0?void 0:r.level),this._isValidEvent(t)&&!l.has(t)){const h=this._onDelegate.bind(this);this._compiler.addEventListener((a=e.filter)===null||a===void 0?void 0:a.source,t,h),l.set(t,h)}return this}unregister(t,e){var i,n,r,a;let o=!1;const l=this.getEventBubble(((i=e==null?void 0:e.filter)===null||i===void 0?void 0:i.source)||Jt.chart),h=this.getEventListeners(((n=e==null?void 0:e.filter)===null||n===void 0?void 0:n.source)||Jt.chart);if(e){const d=l.get(t);d==null||d.removeHandler(e),(d==null?void 0:d.getCount())===0&&(d==null||d.release(),l.delete(t),o=!0),!((r=e==null?void 0:e.wrappedCallback)===null||r===void 0)&&r.cancel&&e.wrappedCallback.cancel()}else{const d=l.get(t);d==null||d.release(),l.delete(t),o=!0}if(o&&this._isValidEvent(t)){const d=h.get(t);this._compiler.removeEventListener(((a=e==null?void 0:e.filter)===null||a===void 0?void 0:a.source)||Jt.chart,t,d),h.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||Jt.chart).get(t);if(!n)return this;let r=!1;if(i){const a=n.getHandlers(i);r=this._invoke(a,t,e)}else{const a=n.getHandlers(Yt.mark);if(r=this._invoke(a,t,e),!r){const o=n.getHandlers(Yt.model);r=this._invoke(o,t,e)}if(!r){const o=n.getHandlers(Yt.chart);r=this._invoke(o,t,e)}if(!r){const o=n.getHandlers(Yt.vchart);r=this._invoke(o,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(Jt.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(Jt.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._canvasListeners.entries())this._compiler.removeEventListener(Jt.canvas,t[0],t[1]);this._canvasListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear();for(const t of this._canvasBubbles.values())t.release();this._canvasBubbles.clear()}_filter(t,e,i){var n,r,a;if(q(t.filter)&&!t.filter(i)||t.nodeName&&Et(i,"node.name")!==t.nodeName||t.markName&&((n=i==null?void 0:i.mark)===null||n===void 0?void 0:n.name)!==t.markName)return!1;let o=(r=i.model)===null||r===void 0?void 0:r.type;return oM[o]&&(o=oM[o]),(!t.type||o===t.type)&&!(t.level==="mark"&&!t.type&&!(i!=null&&i.mark))&&!(t.level==="model"&&!t.type&&!(i!=null&&i.model))&&(!E(t.userId)||((a=i.model)===null||a===void 0?void 0:a.userId)===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const i=e.mark.getProductId(),n=e.itemMap.get(i),r=n==null?void 0:n.getDatum();return Object.assign(Object.assign({},e),{item:n,datum:r})}return Object.assign({},e)}_onDelegate(t){var e;const i=this.globalInstance.getChart(),n=E(t.modelId)&&(i==null?void 0:i.getModelById(t.modelId))||void 0,r=E(t.markId)&&(i==null?void 0:i.getMarkById(t.markId))||null,a=new Map;let o=(e=t.item)===null||e===void 0?void 0:e.mark;for(o&&E(o.id())&&a.set(o.id(),t.item);o!=null&&o.elements;){const h=o.id();E(h)&&!a.has(h)&&a.set(h,o.elements[0]),o=o.group}const l={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:a,chart:i,model:n,mark:r??void 0,node:Et(t.event,"target")};this.dispatch(t.type,l)}_invoke(t,e,i){return t.map(n=>{var r,a,o;const l=n.filter;if(!n.query||this._filter(l,e,i)){const h=(n.wrappedCallback||n.callback).call(null,this._prepareParams(l,i)),d=h??((r=n.query)===null||r===void 0?void 0:r.consume);return d&&((a=i.event)===null||a===void 0||a.stopPropagation(),(o=i.event)===null||o===void 0||o.preventDefault()),!!d}}).some(n=>n===!0)}_getQueryLevel(t){return t?t.level?t.level:E(t.id)?Yt.model:Yt.vchart:Yt.vchart}_parseQuery(t){var e;const i=t.query;i!=null&&i.throttle?t.wrappedCallback=Ea(t.callback,i.throttle):i!=null&&i.debounce&&(t.wrappedCallback=Xn(t.callback,i.debounce));let n=this._getQueryLevel(i),r=null,a=Jt.chart,o=null,l=null,h=null;return i!=null&&i.nodeName&&(o=i.nodeName),i!=null&&i.markName&&(l=i.markName),!(i!=null&&i.type)||n!==Yt.model&&n!==Yt.mark||(r=i.type),i!=null&&i.source&&(a=i.source),E(i==null?void 0:i.id)&&(h=i==null?void 0:i.id,n=Yt.model),t.filter={level:n,markName:l,type:r,source:a,nodeName:o,userId:h,filter:(e=i==null?void 0:i.filter)!==null&&e!==void 0?e:null},t}getEventBubble(t){switch(t){case Jt.chart:return this._viewBubbles;case Jt.window:return this._windowBubbles;case Jt.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case Jt.chart:return this._viewListeners;case Jt.window:return this._windowListeners;case Jt.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return BX.includes(t)||Object.values(ut).includes(t)||Object.values(bt).includes(t)}}function Mt(s,t,e){s.getTransform(t)||s.registerTransform(t,e)}function mr(s,t,e){s.getParser(t)||s.registerParser(t,e)}const po=new Map;let Ho;function Pq(){Ho||(Ho=new no,mr(Ho,"geojson",QP),mr(Ho,"topojson",qj),Mt(Ho,"simplify",NP))}function Eq(s,t,e={type:"geojson",centroid:!0}){po.has(s)&&Sa(`map type of '${s}' already exists, will be overwritten.`),Pq();const i=new Zt(Ho),n=at({},{centroid:!0,simplify:!1},e);e.type==="topojson"?i.parse(t,{type:"topojson",options:n}):i.parse(t,{type:"geojson",options:n}),e.simplify===!0&&i.transform({type:"simplify"}),po.set(s,i)}function Rq(s){po.has(s)?po.delete(s):Sa(`map type of '${s}' does not exists.`)}function Oq(s){return po.get(s)}function lM(s,t=!1){let e=t;return s.latestData instanceof Zt&&(e=!1),e?hi(s.latestData):s.latestData.slice()}const pm=(s,t)=>s.length===0?[]:s.length===1?lM(s[0],t==null?void 0:t.deep):s.map(e=>lM(e,t==null?void 0:t.deep));function _b(s,t,e){t=t instanceof no?t:s.dataSet,Mt(t,"copyDataView",pm);const i=new Zt(t,e);return i.parse([s],{type:"dataview"}),i.transform({type:"copyDataView",level:Es.copyDataView}),i}function Ff(s,t,e=[],i={}){var n,r,a;if(s instanceof Zt)return s;const{id:o,values:l=[],fromDataIndex:h,fromDataId:d,transforms:u=[]}=s,c=s.parser?hi(s.parser):{clone:!0},p=hi(s.fields);let g;c.clone=c.clone!==!1;const f=e.find(_=>_.name===o);if(f)g=f;else{const _={name:o};if(p&&(_.fields=p),g=new Zt(t,_),typeof d=="string"){const m=e.find(v=>v.name===d);if(!m)return((n=i.onError)!==null&&n!==void 0?n:th)(`no data matches fromDataId ${d}`),null;g.parse([m],{type:"dataview"}),g.transform({type:"copyDataView"})}else if(typeof h=="number"){const m=e[h];if(!m)return((r=i.onError)!==null&&r!==void 0?r:th)(`no data matches fromDataIndex ${h}`),null;g.parse([m],{type:"dataview"}),g.transform({type:"copyDataView"})}else Array.isArray(l)?g.parse(l,c):!ot(l)||c&&!["csv","dsv","tsv"].includes(c.type)?(g.parse([]),Sa("values should be array")):g.parse(l,(a=c)!==null&&a!==void 0?a:{type:"csv"});u&&u.length&&u.forEach(m=>{t.getTransform(m.type)&&g.transform(m)})}return g}function eS(s,t,e){s&&(t.fields&&s.setFields(t.fields,e),s.parseNewData(t.values,t.parser))}var Es;(function(s){s[s.copyDataView=-10]="copyDataView",s[s.treemapFilter=-8]="treemapFilter",s[s.treemapFlatten=-7]="treemapFlatten",s[s.dotObjFlat=-7]="dotObjFlat",s[s.linkDotInfo=-7]="linkDotInfo",s[s.sankeyLayout=-7]="sankeyLayout",s[s.dataZoomFilter=-6]="dataZoomFilter",s[s.legendFilter=-5]="legendFilter"})(Es||(Es={}));const Dq=(s,t)=>{const e={nodes:{}},{fields:i}=t;if(!(i!=null&&i.length))return e;const n=i.length-1;let r,a,o=e;return s.forEach(l=>{l.latestData.forEach(h=>{o=e;for(let d=0;d<i.length;d++){const u=h[i[d]];if(C(u))break;o.nodes[u]||(d===n?o.nodes[u]={values:[]}:(r={nodes:{}},o.nodes[u]=r)),d===n?(a=o.nodes[u],a.values.push(h)):o=o.nodes[u]}})}),e};var si;(function(s){s.appear="appear",s.disappear="disappear",s.enter="enter",s.update="update",s.state="state",s.exit="exit",s.normal="normal",s.none="none"})(si||(si={}));var da;(function(s){s.data="data",s.signal="signal",s.mark="mark"})(da||(da={}));function Lq(s){switch(s){case Ze["desktop-browser"]:case Ze["mobile-browser"]:return"browser";case Ze.node:case Ze.worker:return"node";case Ze.miniApp:case Ze["desktop-miniApp"]:return"feishu";case Ze.lynx:return"lynx";case Ze.wx:return"wx"}return"browser"}var Bq=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};class Iq{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[da.signal]:{},[da.data]:{},[da.mark]:{}},this._compileChart=null,this._container=t,this._option=e}getRenderer(){var t;return(t=this._view)===null||t===void 0?void 0:t.renderer}getCanvas(){var t;return(t=this._view)===null||t===void 0?void 0:t.renderer.canvas()}getStage(){var t;return(t=this._view)===null||t===void 0?void 0:t.renderer.stage()}initView(){var t,e,i,n;if(this.isReleased||(this.isInited=!0,this._view))return;const r=new zt((t=this._option.logLevel)!==null&&t!==void 0?t:Ss.Error);!((e=this._option)===null||e===void 0)&&e.onError&&r.addErrorHandler((...a)=>{var o,l;(l=(o=this._option)===null||o===void 0?void 0:o.onError)===null||l===void 0||l.call(o,...a)}),this._view=new ko(Object.assign(Object.assign({width:this._width,height:this._height,container:(i=this._container.dom)!==null&&i!==void 0?i:null,renderCanvas:(n=this._container.canvas)!==null&&n!==void 0?n:null,hooks:this._option.performanceHook},this._option),{mode:Lq(this._option.mode),autoFit:!1,eventConfig:{gesture:Aa(this._option.mode),disable:this._option.interactive===!1},doLayout:()=>{var a;(a=this._compileChart)===null||a===void 0||a.onLayout(this._view)},logger:r,logLevel:r.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",()=>{var a,o;(o=(a=this._compileChart)===null||a===void 0?void 0:a.getEvent())===null||o===void 0||o.emit(bt.afterRender,{chart:this._compileChart})}),this._option.interactive!==!1&&this._viewListeners.forEach(a=>{var o;(o=this._view)===null||o===void 0||o.addEventListener(a.type,a.callback)})}_setCanvasStyle(){if(this._view&&this._container.dom&&!ot(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(t,e=!1){const{chart:i}=t;i.clear(),this.releaseGrammar(e)}renderAsync(t){var e;return Bq(this,void 0,void 0,function*(){if(!this.isReleased)return this.initView(),this._view?(yield(e=this._view)===null||e===void 0?void 0:e.runNextTick(t),this):Promise.reject("srView init fail")})}renderSync(t){var e;this.initView(),this._view&&((e=this._view)===null||e===void 0||e.runSync(t))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){return this._view?(this._width=t,this._height=e,this._view.resize(t,e),i?this.renderAsync({morph:!1}):this):Promise.reject()}setBackground(t){var e;(e=this._view)===null||e===void 0||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var n,r;if(this._option.interactive!==!1){if(t===Jt.chart){const a=(function(o,l){var h,d,u;const c=(d=(h=l==null?void 0:l.mark)===null||h===void 0?void 0:h.getContext())!==null&&d!==void 0?d:{},p=E(c.modelId)?c.modelId:null,g=E(c.markId)?c.markId:null,f=E(c.modelUserId)?c.modelUserId:null,_=E(c.markUserId)?c.markUserId:null,m={event:o,type:e,source:t,item:l,datum:((u=l==null?void 0:l.getDatum)===null||u===void 0?void 0:u.call(l))||null,markId:g,modelId:p,markUserId:_,modelUserId:f};i.call(null,m)}).bind(this);this._viewListeners.set(i,{type:e,callback:a}),(n=this._view)===null||n===void 0||n.addEventListener(e,a)}else if(t===Jt.window){const a=(function(l){const h={event:l,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,h)}).bind(this);this._windowListeners.set(i,{type:e,callback:a});const o=this._getGlobalThis();o==null||o.addEventListener(e,a)}else if(t===Jt.canvas){const a=(function(l){const h={event:l,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,h)}).bind(this);this._canvasListeners.set(i,{type:e,callback:a});const o=(r=this.getStage())===null||r===void 0?void 0:r.window;o==null||o.addEventListener(e,a)}}}removeEventListener(t,e,i){var n,r,a,o;if(this._option.interactive!==!1){if(t===Jt.chart){const l=(n=this._viewListeners.get(i))===null||n===void 0?void 0:n.callback;l&&((r=this._view)===null||r===void 0||r.removeEventListener(e,l)),this._viewListeners.delete(i)}else if(t===Jt.window){const l=this._getGlobalThis(),h=(a=this._windowListeners.get(i))===null||a===void 0?void 0:a.callback;h&&(l==null||l.removeEventListener(e,h)),this._windowListeners.delete(i)}else if(t===Jt.canvas){const l=this._getGlobalThis(),h=(o=this._canvasListeners.get(i))===null||o===void 0?void 0:o.callback;h&&(l==null||l.removeEventListener(e,h)),this._canvasListeners.delete(i)}}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),(t=this._view)===null||t===void 0||t.release(),this._view=null,this.isInited=!1,this.isReleased=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&((e=this._view)===null||e===void 0||e.removeAllGraphicItems()),(i=this._view)===null||i===void 0||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach(t=>{Object.values(this._model[t]).forEach(e=>{Object.values(e).forEach(i=>{i.removeProduct(!0)})}),this._model[t]={}})}addGrammarItem(t){const e=t.getProduct();if(C(e))return;const i=e.id(),n=t.grammarType;C(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(C(n))return;const r=n.id(),a=t.grammarType,o=this._model[a][r];E(o)&&(delete o[t.id],Object.keys(o).length===0&&delete this._model[a][r]),e||(i=this._view)===null||i===void 0||i.removeGrammar(n)}updateDepend(t){return E(t)&&t.length>0?t.every(e=>e.updateDepend()):(Object.values(this._model).forEach(e=>{Object.values(e).forEach(i=>{const n=Object.values(i),r=n[0].getProduct(),a=n.reduce((o,l)=>l.getDepend().length>0?o.concat(l.getDepend()):o,[]).filter(o=>!!o).map(o=>o.getProduct());r.depend(a)})}),!0)}_getGlobalThis(){var t;return Xs(this._option.mode)?globalThis:(t=this.getStage())===null||t===void 0?void 0:t.window}}var Fq=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};function jq(s="vchart",t){const e=document.createElement("a");e.setAttribute("href",t),e.setAttribute("target","_blank"),e.setAttribute("download",`${s}.png`),e.dispatchEvent(new MouseEvent("click"))}function zq(s){return new Promise(t=>{s.convertToBlob().then(e=>{const i=new FileReader;i.readAsDataURL(e),i.onload=()=>{t(i.result)}})})}function Hq(s,t){var e;return Fq(this,void 0,void 0,function*(){if(!s)return"";try{if(OffscreenCanvas!==void 0&&s instanceof OffscreenCanvas)return zq(s)}catch(i){((e=t==null?void 0:t.onError)!==null&&e!==void 0?e:th)(`getCanvasDataURL error : ${i.toString()}`)}return s.toDataURL()})}function La(s){s.crosshair=Y(s.crosshair||{}).map(t=>_t({[s.direction==="horizontal"?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},t))}function cL(s,t,e){var i;const{width:n,height:r}=s;if(E(n)&&E(r))return{width:n,height:r};let a=e.width,o=e.height;const l=t.container,h=t.canvas;if(l){const{width:d,height:u}=r0(l,e.width,e.height);a=d,o=u}else if(h&&Xs(t.mode)){let d;d=ot(h)?document==null?void 0:document.getElementById(h):h;const{width:u,height:c}=r0(d,e.width,e.height);a=u,o=c}else if(ka(t.mode)&&(!((i=t.modeParams)===null||i===void 0)&&i.domref)){const d=t.modeParams.domref;a=d.width,o=d.height}return a=n??a,o=r??o,{width:a,height:o}}function Go(s,...t){const e=i=>t.reduce((n,r)=>n||(r==null?void 0:r[i]),s[i]);return Object.assign(s,{change:e("change"),reCompile:e("reCompile"),reMake:e("reMake"),reRender:e("reRender"),reSize:e("reSize")}),s}function pL(s,t){return s==="line"||s==="area"||s==="common"&&t.series.every(e=>e.type==="area"||e.type==="line")?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var mt;(function(s){s.STATE_NORMAL="normal",s.STATE_HOVER="hover",s.STATE_HOVER_REVERSE="hover_reverse",s.STATE_DIMENSION_HOVER="dimension_hover",s.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",s.STATE_SELECTED="selected",s.STATE_SELECTED_REVERSE="selected_reverse"})(mt||(mt={}));var Ld;(function(s){s.STATE_HOVER_REVERSE="hover_reverse",s.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",s.STATE_SELECTED_REVERSE="selected_reverse"})(Ld||(Ld={}));class Ca{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){C(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,at({},Ca.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex(i=>i.name===t);e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter(i=>e.includes(i.type))}getMarkInId(t){return this._children.find(e=>e.id===t)}getMarkWithInfo(t){return this._children.find(e=>Object.keys(t).every(i=>t[i]===this._infoMap.get(e)[i]))}}Ca.defaultMarkInfo={};class Gq{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new Ca,this._markReverse=new Ca,this._lastDimensionEvent=null,this.onHover=e=>{const i=this.getEventElement(e);switch(e.action){case"enter":this.interaction.getEventElement(mt.STATE_DIMENSION_HOVER).forEach(n=>{this.interaction.addEventElement(mt.STATE_DIMENSION_HOVER_REVERSE,n)}),this.interaction.clearEventElement(mt.STATE_DIMENSION_HOVER,!1),i.forEach(({el:n,mark:r})=>{this.interaction.addEventElement(mt.STATE_DIMENSION_HOVER,n)}),this.interaction.reverseEventElement(mt.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(mt.STATE_DIMENSION_HOVER,!0),e=null}this._lastDimensionEvent=e},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){ft(t.stateStyle[mt.STATE_DIMENSION_HOVER])||this._marks.addMark(t),ft(t.stateStyle[mt.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(kr.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach(n=>{n.data.forEach(r=>{(e?this._markReverse:this._marks).getMarks().filter(a=>a.model===r.series&&a.getVisible()).forEach(a=>{const o=a.getProduct().elements.filter(l=>{const h=l.getDatum();let d;return d=U(h)?h.every((u,c)=>u===r.datum[c]):r.datum.some(u=>u===h),e?!d:d}).map(l=>({el:l,mark:a}));i.push(...o)})})}),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t||this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e<this._lastDimensionEvent.dimensionInfo.length;e++){const i=this._lastDimensionEvent.dimensionInfo[e],n=t.dimensionInfo[e];if(i.value!==n.value||i.axis!==n.axis||i.data.length!==n.data.length)return!1;for(let r=0;r<i.data.length;r++){const a=i.data[r],o=n.data[r];if(a.series!==o.series||a.datum.length!==o.datum.length)return!1;for(let l=0;l<a.datum.length;l++)if(a.datum[l]!==o.datum[l])return!1}}return!0}}function Wq(s,t,e){var i;const n=(i=t[s])===null||i===void 0?void 0:i.style;return Nq(s,n)||q(n)?!0:!(!(n!=null&&n.scale)||n.field===e)}function Nq(s,t){return(s==="fill"||s==="stroke")&&(t==null?void 0:t.gradient)&&(t==null?void 0:t.stops)}const gL={};Object.values(mt).forEach(s=>{gL[s]=!0});function Vq(s){return!!gL[s]}const Uq={[mt.STATE_HOVER]:mt.STATE_HOVER_REVERSE,[mt.STATE_SELECTED]:mt.STATE_SELECTED_REVERSE,[mt.STATE_DIMENSION_HOVER]:mt.STATE_DIMENSION_HOVER_REVERSE};function pp(s){return Uq[s]}class $q{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._disableTriggerEvent=!1}static markStateEnable(t,e){return!ft(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),(i=this._stateMarks.get(t))===null||i===void 0||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(!((i=this._stateMarks.get(e))===null||i===void 0)&&i.includes(t.mark)))}getEventElement(t){var e;return(e=this._stateElements.get(t))!==null&&e!==void 0?e:[]}getEventElementData(t){return this.getEventElement(t).map(e=>e.getDatum())}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const n=pp(t);(i=this._stateElements.get(t))===null||i===void 0||i.forEach(r=>{r.removeState(t),n&&this.addEventElement(n,r)}),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;if(this._disableTriggerEvent)return;e.removeState(t);const r=(n=(i=this._stateElements.get(t))===null||i===void 0?void 0:i.filter(o=>o!==e))!==null&&n!==void 0?n:[];this._stateElements.set(t,r);const a=pp(t);a&&(r.length===0?this.clearEventElement(a,!1):this.addEventElement(a,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const n=(i=this._stateElements.get(t))!==null&&i!==void 0?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&((i=this._stateElements.get(t))===null||i===void 0||i.forEach(n=>{n.removeState(t)}),this._stateElements.set(t,[]),e)){const n=pp(t);n&&this.clearEventElement(n,!1)}}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=pp(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);n.length&&(this.getEventElement(e).length||(n.length===1?i.forEach(r=>{r.getProduct().elements.filter(a=>a!==n[0]).forEach(a=>{this.addEventElement(e,a)})}):i.forEach(r=>{r.getProduct().elements.filter(a=>!n.includes(a)).forEach(a=>{this.addEventElement(e,a)})})))}}class gm{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return(t=this.getCompiler())===null||t===void 0?void 0:t.getVGrammarView()}release(){this._option=null}}class iS extends gm{constructor(){super(...arguments),this.id=xo(),this._compiledProductId=null,this._depend=[]}getProduct(){if(E(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return E(e)&&E(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return(t=this._compiledProductId)!==null&&t!==void 0?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;E(this._product)&&((e=this.getCompiler())===null||e===void 0||e.addGrammarItem(this))}updateDepend(){if(E(this._product)){const t=this.getDepend().map(e=>e.getProduct()).filter(E);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class Yq extends iS{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=da.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(t){if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}E(this._value)&&this._product.value(this._value),E(this._updateFunc)&&this._product.update(this._updateFunc)}}generateProductId(){return this.name}_lookupGrammar(t){var e;return(e=this.getCompiler().getVGrammarView())===null||e===void 0?void 0:e.getSignalById(t)}}class Xq extends gm{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new Yq(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach(t=>{t.compile()})}release(){super.release(),Object.values(this._signalMap).forEach(t=>{t.release()}),this._signalMap={}}}class fL extends Xq{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach(i=>{const n=this.stateKeyToSignalName(i),r=e[i];this.updateSignal(n,r)})}updateState(t,e){return t?(at(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().renderAsync()):Promise.resolve()}}class _L extends fL{constructor(){super(...arguments),this.id=xo(),this.stateKeyToSignalName=t=>`${xt}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===si.update?this.updateState({animationState:{callback:(i,n)=>n.diffState}},e):t===si.appear?this.updateState({animationState:{callback:(i,n)=>n.diffState==="exit"?si.none:si.appear}},e):this.updateState({animationState:{callback:(i,n)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState==="exit"?si.exit:si.appear}}}}class fm{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const n=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(n.spec,e,i),n}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),r=a=>_t({},i,n,a);return U(t)?{spec:t.map(a=>r(a)),theme:i}:{spec:r(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class sS extends gm{getSpec(){return this._spec||{}}getSpecPath(){return this._option.specPath}getSpecInfoPath(){var t;return(t=this._option.specInfoPath)!==null&&t!==void 0?t:this._option.specPath}getData(){return this._data}get layout(){return this._layout}getSpecIndex(){return this._specIndex}getOption(){return this._option}getMarks(){var t,e;return(e=(t=this._marks)===null||t===void 0?void 0:t.getMarks())!==null&&e!==void 0?e:[]}getMarkNameMap(){var t;return(t=this._marks)===null||t===void 0?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map(t=>({type:t.type,name:t.name}))}getChart(){return this._option.getChart()}get _theme(){var t;return(t=this.getSpecInfo())===null||t===void 0?void 0:t.theme}constructor(t,e){var i,n;super(e),this.transformerConstructor=fm,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this._specIndex=0,this.specKey="",this._marks=new Ca,this._lastLayoutRect=null,this.id=xo(),this.userId=t.id,this._spec=t,this._specIndex=(i=e.specIndex)!==null&&i!==void 0?i:0,this.effect={},this.event=new vc(e.eventDispatcher,e.mode),(n=e.map)===null||n===void 0||n.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return((t=this._spec)===null||t===void 0?void 0:t.visible)!==!1}onLayoutStart(t,e,i){var n;(n=this._layout)===null||n===void 0||n.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;(e=this._layout)===null||e===void 0||e.onLayoutEnd(t),this.getMarks().forEach(i=>i.updateLayoutState(!0,!0))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach(e=>e.release()),(t=this._data)===null||t===void 0||t.release(),this._data=this._specIndex=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e.reMake||this.reInit(),e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;(t=this._layout)===null||t===void 0||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){E(t)&&E(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!E(t)||!E(e))return;const{style:n,state:r}=e,a=Object.assign({},e);n&&(a.style=this._convertMarkStyle(n)),r&&(a.state={},Object.keys(r).forEach(o=>{a.state[o]=this._convertMarkStyle(r[o])})),t.initStyleWithSpec(a,i)}stateKeyToSignalName(t,e){let i=`${xt}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;(t=this._data)===null||t===void 0||t.compile()}compileMarks(t){this.getMarks().forEach(e=>{e.compile({group:t})})}_createMark(t,e={}){const{type:i,name:n}=t,r=I.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r==null||r.created(),r}_getDataIdKey(){}getColorScheme(){var t,e;return(e=(t=this._option).getTheme)===null||e===void 0?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;const n=(i=(e=(t=this._option).getSpecInfo)===null||e===void 0?void 0:e.call(t))!==null&&i!==void 0?i:{};return CV(n,this.getSpecInfoPath())}}class Kq{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:gs,height:gs},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=xn.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=(i=t==null?void 0:t.getSpec)===null||i===void 0?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,n,r,a;if(this._spec&&this._spec.visible!==!1){const o=Ar(t.padding),l=$D(o,e,e);this.layoutPaddingLeft=l.left,this.layoutPaddingRight=l.right,this.layoutPaddingTop=l.top,this.layoutPaddingBottom=l.bottom,this._minHeight=C(t.minHeight)?(i=this._minHeight)!==null&&i!==void 0?i:null:zi(t.minHeight,e.height,e),this._maxHeight=C(t.maxHeight)?(n=this._maxHeight)!==null&&n!==void 0?n:null:zi(t.maxHeight,e.height,e),this._minWidth=C(t.minWidth)?(r=this._minWidth)!==null&&r!==void 0?r:null:zi(t.minWidth,e.width,e),this._maxWidth=C(t.maxWidth)?(a=this._maxWidth)!==null&&a!==void 0?a:null:zi(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:zi(t.width,e.width,e)},{width:zr}),t.height&&this.setLayoutRect({height:zi(t.height,e.height,e)},{height:zr}),C(t.offsetX)||(this.layoutOffsetX=zi(t.offsetX,e.width,e)),C(t.offsetY)||(this.layoutOffsetY=zi(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,n,r,a;this._spec=t,this.layoutType=(i=t.layoutType)!==null&&i!==void 0?i:this.layoutType,this.layoutLevel=(n=t.layoutLevel)!==null&&n!==void 0?n:this.layoutLevel,this.layoutOrient=(r=t.orient)!==null&&r!==void 0?r:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=(a=t.clip)!==null&&a!==void 0?a:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach(i=>{C(this._spec[i])||(e[i]=zi(this._spec[i],i==="top"||i==="bottom"?t.height:t.width,t))}),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:r}=this._getAbsoluteSpecValue(t),a={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};C(n)||(a.width-=n),C(r)||(a.width-=r),C(e)||(a.height-=e),C(i)||(a.height-=i),this.setLayoutRect(a);const{width:o,height:l}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:o,height:l});const h={x:t.x,y:t.y};this._spec.center===!0?(h.x=t.x+.5*t.width-.5*o,h.y=t.y+.5*t.height-.5*l):(C(n)?C(r)||(h.x=t.x+t.width-this.layoutPaddingRight-r-o):h.x=t.x+n+this.layoutPaddingLeft,C(e)?C(i)||(h.y=t.y+t.height-this.layoutPaddingBottom-i-l):h.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),H(t.x)&&(this._layoutStartPoint.x=t.x),H(t.y)&&(this._layoutStartPoint.y=t.y),(i=(e=this._model).afterSetLayoutStartPoint)===null||i===void 0||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var n,r,a,o;H(t)&&((n=i==null?void 0:i.width)!==null&&n!==void 0?n:gs)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=(r=i==null?void 0:i.width)!==null&&r!==void 0?r:gs),H(e)&&((a=i==null?void 0:i.height)!==null&&a!==void 0?a:gs)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=(o=i==null?void 0:i.height)!==null&&o!==void 0?o:gs),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>gs&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>gs&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return this._layoutOrient==="bottom"||this._layoutOrient==="top"?"x":"y"}getOrientSizeAttribute(){return this._layoutOrient==="bottom"||this._layoutOrient==="top"?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>gs&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>gs&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<zr?(C(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),C(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<zr?(C(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),C(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,this.layoutType==="region-relative"&&(this._layoutRectLevelMap.width===zr&&(this.layoutOrient==="left"||this.layoutOrient==="right")||this._layoutRectLevelMap.height===zr&&(this.layoutOrient==="bottom"||this.layoutOrient==="top")))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(qX(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class mL extends sS{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){this.layoutType!=="none"&&(this._layout=new Kq(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&this._orient!=="radius"&&this._orient!=="angle"&&this.layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&_e(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,(t=this._option.globalInstance.getChart())===null||t===void 0||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=at(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=at(this._layoutRect,t)}getLastComputeOutBounds(){var t;return(t=this._layout)===null||t===void 0?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.layoutClip=(t=this._spec.clip)!==null&&t!==void 0?t:this.layoutClip,this.layoutZIndex=(e=this._spec.zIndex)!==null&&e!==void 0?e:this.layoutZIndex,this.layoutType=(i=this._spec.layoutType)!==null&&i!==void 0?i:this.layoutType}}class vL extends fm{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Yl extends mL{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return this._spec.stackInverse===!0}constructor(t,e){var i;super(t,e),this.transformerConstructor=vL,this.modelType="region",this.specKey="region",this.type=Yl.type,this._series=[],this.layoutType="region",this.layoutZIndex=he.Region,this.interaction=new $q,this.seriesDataFilterOver=()=>{this.event.emit(bt.regionSeriesDataFilterOver,{model:this}),this._series.forEach(n=>{n.getViewDataFilter()&&n.reTransformViewData()})},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=(i=t.coordinate)!==null&&i!==void 0?i:"cartesian",this._option.animation&&(this.animate=new _L({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,n;const r=this._option.getChart().getSpec(),a=(e=(t=r.dataZoom)===null||t===void 0?void 0:t.some)===null||e===void 0?void 0:e.call(t,l=>{var h;return((h=l.filterMode)!==null&&h!==void 0?h:"filter")==="axis"}),o=(n=(i=r.scrollBar)===null||i===void 0?void 0:i.some)===null||n===void 0?void 0:n.call(i,l=>{var h;return((h=l.filterMode)!==null&&h!==void 0?h:"axis")==="axis"});return!(!a&&!o)||this._layout.layoutClip}created(){var t;this.initLayout(),super.created();const e=(t=this._spec.clip)!==null&&t!==void 0?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",this.userId+"_interaction",he.Interaction),this._spec.style&&(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),e&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach(i=>{i&&(i.created(),this.setMarkStyle(i,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",Q.Built_In),this._groupMark.addMark(i))}),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(he.Mark+1)),this.createTrigger()}_createGroupMark(t,e,i){var n,r;const a=this._createMark({type:"group",name:t});a.setUserId(e),a.setZIndex(i);const o=(n=this._spec.clip)!==null&&n!==void 0?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",Q.Built_In),this.setMarkStyle(a,{cornerRadius:(r=this._spec.style)===null||r===void 0?void 0:r.cornerRadius},"normal",Q.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:!((t=this._spec.style)===null||t===void 0)&&t.fill?1:0},this._spec.style),"normal",Q.User_Mark),((e=this._spec.clip)!==null&&e!==void 0?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",Q.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",Q.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return _e(e==null?void 0:e.style,t==null?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex(i=>i===t);e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter(e=>{var i,n;return(!t.name||(e==null?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!E(t.specIndex)||!e.getSpecIndex||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||((n=(i=e.getRawData)===null||i===void 0?void 0:i.call(e))===null||n===void 0?void 0:n.name)===t.dataName)})}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map(e=>{var i;return(i=e.getViewDataFilter())!==null&&i!==void 0?i:e.getViewData()}).filter(e=>!!e);this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new Gq(t)}initTrigger(){this._series.forEach(t=>{t.getMarksWithoutRoot().forEach(e=>{this._trigger.registerMark(e)})}),this._trigger.init()}initInteraction(){this._series.forEach(t=>{t.getMarksWithoutRoot().forEach(e=>{for(const i in Ld)ft(e.stateStyle[Ld[i]])||this.interaction.registerMark(Ld[i],e)})})}compileMarks(t){this.getMarks().forEach(e=>{var i;e.compile({group:t}),(i=e.getProduct())===null||i===void 0||i.configure({context:{model:this}}).layout((n,r,a,o)=>{})})}compile(){var t;(t=this.animate)===null||t===void 0||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach(e=>e.onLayoutEnd(t)),super.onLayoutEnd(t)}}Yl.type="region",Yl.transformerConstructor=vL,Yl.specKey="region";function _m(s){const t=[],e=[],i=[];return s.forEach(n=>{C(n.getSpec().position)||n.getSpec().position==="start"?t.push(n):n.getSpec().position==="middle"?e.push(n):n.getSpec().position==="end"&&i.push(n)}),{startItems:t,endItems:i,middleItems:e}}function yL(s,t,e){t?s.forEach(i=>{const n=la(i),r=n.getLayoutStartPoint().y+n.getLayoutRect().height-i[0].getLayoutStartPoint().y,a=(e-r)/2;i.forEach(o=>{o.setLayoutStartPosition({x:o.getLayoutStartPoint().x,y:o.getLayoutStartPoint().y+a})})}):s.forEach(i=>{const n=la(i),r=n.getLayoutStartPoint().x+n.getLayoutRect().width-i[0].getLayoutStartPoint().x,a=(e-r)/2;i.forEach(o=>{o.setLayoutStartPosition({x:o.getLayoutStartPoint().x+a,y:o.getLayoutStartPoint().y})})})}function mm(s,t,e,i){let n;s.forEach((r,a)=>{r.length>1&&(n=e[a],r.forEach(o=>{if(!o.alignSelf||o.alignSelf==="start")return;const l=o.getLayoutStartPoint(),h=o.alignSelf==="middle"?.5:1,d=t?n-(o.getLayoutRect().width+o.layoutPaddingLeft+o.layoutPaddingRight):n-(o.getLayoutRect().height+o.layoutPaddingTop+o.layoutPaddingBottom);t?o.setLayoutStartPosition({x:l.x+i*d*h,y:l.y}):o.setLayoutStartPosition({x:l.x,y:l.y+i*d*h})}))})}function jf(s,t,e,i,n){if(s.length){let r=0;const a=n==="right",o=a?-1:1;let l=a?t.rightCurrent:t.leftCurrent,h=t.topCurrent;const d=[];let u=[];const c=[];s.forEach(p=>{const g=t.getItemComputeLayoutRect(p),f=p.computeBoundsInRect(g);p.setLayoutRect(f);const _=f.height+p.layoutPaddingTop+p.layoutPaddingBottom,m=f.width+p.layoutPaddingLeft+p.layoutPaddingRight,v=a?-f.width-p.layoutPaddingRight:p.layoutPaddingLeft;p.setLayoutStartPosition({x:l+p.layoutOffsetX+v,y:h+p.layoutOffsetY+p.layoutPaddingTop}),h+=_,h>e&&u.length?(c.push(r),l+=o*r,r=m,h=t.topCurrent+_,p.setLayoutStartPosition({x:l+p.layoutOffsetX+v,y:t.topCurrent+p.layoutOffsetY+p.layoutPaddingTop}),d.push(u),u=[p]):(r=Math.max(r,m),u.push(p))}),c.push(r),d.push(u),mm(d,!0,c,o),i&&yL(d,!0,e),a?t.rightCurrent=l+o*r:t.leftCurrent=l+o*r}}function bL(s,t,e,i){if(s.length){let n=0;const r=i==="right",a=r?-1:1;let o=r?t.rightCurrent:t.leftCurrent,l=t.bottomCurrent;const h=[];let d=[];const u=[];s.forEach(c=>{const p=t.getItemComputeLayoutRect(c),g=c.computeBoundsInRect(p);c.setLayoutRect(g);const f=g.height+c.layoutPaddingTop+c.layoutPaddingBottom,_=g.width+c.layoutPaddingLeft+c.layoutPaddingRight,m=r?-g.width-c.layoutPaddingRight:c.layoutPaddingLeft;l<f&&d.length?(u.push(n),o+=a*n,n=_,l=t.bottomCurrent,c.setLayoutStartPosition({x:o+c.layoutOffsetX+m,y:l+c.layoutOffsetY-g.height-c.layoutPaddingBottom}),h.push(d),d=[c]):(c.setLayoutStartPosition({x:o+c.layoutOffsetX+m,y:l+c.layoutOffsetY-g.height-c.layoutPaddingBottom}),n=Math.max(n,_),l-=f,d.push(c))}),u.push(n),h.push(d),mm(h,!0,u,a),r?t.rightCurrent=o+a*n:t.leftCurrent=o+a*n}}function zf(s,t,e,i,n){if(s.length){const r=n==="top",a=r?1:-1;let o=0,l=t.leftCurrent,h=r?t.topCurrent:t.bottomCurrent;const d=[];let u=[];const c=[];s.forEach(p=>{const g=t.getItemComputeLayoutRect(p),f=p.computeBoundsInRect(g);p.setLayoutRect(f);const _=f.height+p.layoutPaddingTop+p.layoutPaddingBottom,m=f.width+p.layoutPaddingLeft+p.layoutPaddingRight,v=r?p.layoutPaddingTop:-f.height-p.layoutPaddingBottom;p.setLayoutStartPosition({x:l+p.layoutOffsetX+p.layoutPaddingLeft,y:h+p.layoutOffsetY+v}),l+=m,l>e&&u.length?(c.push(o),l=t.leftCurrent+m,h+=a*o,o=_,p.setLayoutStartPosition({x:t.leftCurrent+p.layoutOffsetX+p.layoutPaddingLeft,y:h+p.layoutOffsetY+v}),d.push(u),u=[p]):(o=Math.max(o,_),u.push(p))}),c.push(o),d.push(u),mm(d,!1,c,a),i&&yL(d,!1,e),r?t.topCurrent=h+a*o:t.bottomCurrent=h+a*o}}function xL(s,t,e,i){if(s.length){const n=i==="top",r=n?1:-1;let a=0,o=t.rightCurrent,l=n?t.topCurrent:t.bottomCurrent;const h=[];let d=[];const u=[];s.forEach(c=>{const p=t.getItemComputeLayoutRect(c),g=c.computeBoundsInRect(p);c.setLayoutRect(g);const f=g.height+c.layoutPaddingTop+c.layoutPaddingBottom,_=g.width+c.layoutPaddingLeft+c.layoutPaddingRight,m=n?c.layoutPaddingTop:-g.height-c.layoutPaddingBottom;o<_&&d.length?(o=t.rightCurrent,l+=r*a,a=f,c.setLayoutStartPosition({x:t.rightCurrent+c.layoutOffsetX-g.width-c.layoutPaddingRight,y:l+c.layoutOffsetY+m}),h.push(d),d=[c]):(d.push(c),c.setLayoutStartPosition({x:o+c.layoutOffsetX-g.width-c.layoutPaddingRight,y:l+c.layoutOffsetY+m}),a=Math.max(a,f),o-=_)}),u.push(a),h.push(d),mm(h,!1,u,r),n?t.topCurrent=l+r*a:t.bottomCurrent=l+r*a}}function qq(s,t,e){const{startItems:i,middleItems:n,endItems:r}=_m(s);i.length&&jf(i,t,e,!1,"left"),n.length&&jf(n,t,e,!0,"left"),r.length&&bL(r,t,e,"left")}function Zq(s,t,e){const{startItems:i,middleItems:n,endItems:r}=_m(s);i.length&&jf(i,t,e,!1,"right"),n.length&&jf(n,t,e,!0,"right"),r.length&&bL(r,t,e,"right")}function Jq(s,t,e){const{startItems:i,middleItems:n,endItems:r}=_m(s);i.length&&zf(i,t,e,!1,"top"),n.length&&zf(n,t,e,!0,"top"),r.length&&xL(r,t,e,"top")}function Qq(s,t,e){const{startItems:i,middleItems:n,endItems:r}=_m(s);i.length&&zf(i,t,e,!1,"bottom"),n.length&&zf(n,t,e,!0,"bottom"),r.length&&xL(r,t,e,"bottom")}class nS{constructor(t,e){this.leftCurrent=0,this.topCurrent=0,this.rightCurrent=0,this.bottomCurrent=0,this._onError=e==null?void 0:e.onError}_layoutInit(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this.leftCurrent=i.x,this.topCurrent=i.y,this.rightCurrent=i.x+i.width,this.bottomCurrent=i.height+i.y,e.sort((r,a)=>a.layoutLevel-r.layoutLevel)}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter(e=>e.layoutType==="normal-inline")),this.layoutNormalItems(t.filter(e=>e.layoutType==="normal"))}_groupItems(t){const e=t.filter(o=>o.layoutType==="region"),i=t.filter(o=>o.layoutType==="region-relative"),n=t.filter(o=>o.layoutType==="region-relative-overlap"),r=i.concat(n),a={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return n.forEach(o=>{a[o.layoutOrient].items.push(o)}),{regionItems:e,relativeItems:i,relativeOverlapItems:n,allRelatives:r,overlapItems:a}}layoutItems(t,e,i,n){this._layoutInit(t,e,i,n),this._layoutNormalItems(e);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:d}=this._groupItems(e);this.layoutRegionItems(a,o,l,d),this._processAutoIndent(a,o,l,d,h,r),this.layoutAbsoluteItems(e.filter(u=>u.layoutType==="absolute"))}_processAutoIndent(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},r,a){if(r.some(o=>o.autoIndent)){const{top:o,bottom:l,left:h,right:d}=this._checkAutoIndent(r,a);(o||l||h||d)&&(this.topCurrent=a.top+o,this.bottomCurrent=a.bottom-l,this.leftCurrent=a.left+h,this.rightCurrent=a.right-d,this.layoutRegionItems(t,e,i,n))}}layoutNormalItems(t){t.forEach(e=>{const i=this.getItemComputeLayoutRect(e),n=e.computeBoundsInRect(i);e.setLayoutRect(n),e.layoutOrient==="left"?(e.setLayoutStartPosition({x:this.leftCurrent+e.layoutOffsetX+e.layoutPaddingLeft,y:this.topCurrent+e.layoutOffsetY+e.layoutPaddingTop}),this.leftCurrent+=n.width+e.layoutPaddingLeft+e.layoutPaddingRight):e.layoutOrient==="top"?(e.setLayoutStartPosition({x:this.leftCurrent+e.layoutOffsetX+e.layoutPaddingLeft,y:this.topCurrent+e.layoutOffsetY+e.layoutPaddingTop}),this.topCurrent+=n.height+e.layoutPaddingTop+e.layoutPaddingBottom):e.layoutOrient==="right"?(e.setLayoutStartPosition({x:this.rightCurrent+e.layoutOffsetX-n.width-e.layoutPaddingRight,y:this.topCurrent+e.layoutOffsetY+e.layoutPaddingTop}),this.rightCurrent-=n.width+e.layoutPaddingLeft+e.layoutPaddingRight):e.layoutOrient==="bottom"&&(e.setLayoutStartPosition({x:this.leftCurrent+e.layoutOffsetX+e.layoutPaddingRight,y:this.bottomCurrent+e.layoutOffsetY-n.height-e.layoutPaddingBottom}),this.bottomCurrent-=n.height+e.layoutPaddingTop+e.layoutPaddingBottom)})}layoutNormalInlineItems(t){const e=t.filter(l=>l.layoutOrient==="left"),i=t.filter(l=>l.layoutOrient==="right"),n=t.filter(l=>l.layoutOrient==="top"),r=t.filter(l=>l.layoutOrient==="bottom"),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&qq(e,this,o),n.length&&Jq(n,this,a),i.length&&Zq(i,this,o),r.length&&Qq(r,this,a)}_layoutRelativeOverlap(t,e){e.items.forEach(i=>{const n=this.getItemComputeLayoutRect(i),r=i.computeBoundsInRect(n);e.rect.width=Math.max(r.width,e.rect.width),e.rect.height=Math.max(r.height,e.rect.height)}),e.items.forEach(i=>{i.setLayoutRect(e.rect),t==="left"?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX+i.layoutPaddingLeft}):t==="right"?i.setLayoutStartPosition({x:this.rightCurrent+i.layoutOffsetX+i.layoutPaddingLeft}):t==="top"?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetX+i.layoutPaddingLeft}):i.setLayoutStartPosition({x:this.bottomCurrent+i.layoutOffsetX+i.layoutPaddingLeft})}),t==="left"?this.leftCurrent+=e.rect.width:t==="right"?this.rightCurrent-=e.rect.width:t==="top"?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);t.layoutOrient==="left"||t.layoutOrient==="right"?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),t.layoutOrient==="left"?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):t.layoutOrient==="right"?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):t.layoutOrient==="top"?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):t.layoutOrient==="bottom"&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const n=Math.max(Math.min(e,...t.map(a=>{var o;return(o=a.maxWidth)!==null&&o!==void 0?o:Number.MAX_VALUE})),0),r=Math.max(Math.min(i,...t.map(a=>{var o;return(o=a.maxHeight)!==null&&o!==void 0?o:Number.MAX_VALUE})),0);return t.forEach(a=>{a.setLayoutRect({width:n,height:r}),a.setLayoutStartPosition({x:this.leftCurrent+a.layoutOffsetX+a.layoutPaddingLeft,y:this.topCurrent+a.layoutOffsetY+a.layoutPaddingTop})}),{regionHeight:r,regionWidth:n}}layoutRegionItems(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter(h=>h.layoutOrient==="left"||h.layoutOrient==="right").forEach(h=>{this._layoutRelativeItem(h,this.getItemComputeLayoutRect(h))}),this._layoutRelativeOverlap("left",n.left),this._layoutRelativeOverlap("right",n.right),r=this.rightCurrent-this.leftCurrent,e.filter(h=>h.layoutOrient==="top"||h.layoutOrient==="bottom").forEach(h=>{this._layoutRelativeItem(h,this.getItemComputeLayoutRect(h))}),this._layoutRelativeOverlap("top",n.top),this._layoutRelativeOverlap("bottom",n.bottom),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);e.concat(i).forEach(h=>{if(["left","right"].includes(h.layoutOrient)){const d=this.filterRegionsWithID(t,h.layoutBindRegionID[0]);h.setLayoutRect({height:d.getLayoutRect().height}),h.setLayoutStartPosition({y:d.getLayoutStartPoint().y+h.layoutOffsetY+h.layoutPaddingTop}),h.layoutOrient==="right"&&h.setLayoutStartPosition({x:h.getLayoutStartPoint().x+o-r})}else if(["top","bottom"].includes(h.layoutOrient)){const d=this.filterRegionsWithID(t,h.layoutBindRegionID[0]);h.setLayoutRect({width:d.getLayoutRect().width}),h.setLayoutStartPosition({x:d.getLayoutStartPoint().x+h.layoutOffsetX+h.layoutPaddingLeft}),h.layoutOrient==="bottom"&&h.setLayoutStartPosition({y:h.getLayoutStartPoint().y+l-a})}})}layoutAbsoluteItems(t){t.forEach(e=>{e.absoluteLayoutInRect(this._chartLayoutRect)})}filterRegionsWithID(t,e){var i;const n=t.find(r=>r.getModelId()===e);return n||((i=this._onError)!==null&&i!==void 0?i:th)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach(n=>{if(!n.getModelVisible()||!n.autoIndent)return;const r=n.layoutOrient==="left"||n.layoutOrient==="right",a=n.getLastComputeOutBounds(),o=this._getOutInLayout(a,n,e);r?(i.top=Math.max(i.top,o.top),i.bottom=Math.max(i.bottom,o.bottom)):(i.left=Math.max(i.left,o.left),i.right=Math.max(i.right,o.right))}),i}_getOutInLayout(t,e,i){const{x:n,y:r}=e.getLayoutStartPoint(),{width:a,height:o}=e.getLayoutRect();return{left:i.left-(n-t.x1),right:n+a+t.x2-i.right,top:i.top-(r-t.y1),bottom:r+o+t.y2-i.bottom}}}nS.type="base";const tZ=["line","area","trail"];function Iv(s){return tZ.includes(s)}class eZ extends fL{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find(e=>e.stateValue===t)}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;i<this._stateInfoList.length;i++){const n=this._stateInfoList[i].level;if(n&&n>t.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(t.datums!==void 0&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),t.items!==void 0&&(this._clearStateBeforeSet(e),e.items=t.items),t.fields!==void 0)if(this._clearStateBeforeSet(e),t.fields===null)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const r=e.fields[i];E(n.domain)&&(r.domain=n.domain),E(n.type)&&(r.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach(e=>{this.getStateInfo(e)&&this.changeStateInfo({stateValue:e,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})})}checkOneState(t,e,i,n){var r;n=pe(Iv)?n:!t.mark||Iv(t.mark.markType);let a=!1,o=!1;if(E(i.datums)&&i.datums.length>0)a=this.checkDatumState(i,e,n),o=!0;else if(i.items)a=(r=this.checkItemsState(i,t))!==null&&r!==void 0&&r,o=!0;else if(i.fields)a=this.checkFieldsState(i,e,t,n),o=!0;else if(!a&&i.filter){const l={mark:this._mark,renderNode:t,type:t.mark.markType};a=i.filter(e,l),o=!0}return o?a?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter(r=>Vq(r)).map(r=>[r,10]),n=!t.mark||Iv(t.mark.markType);for(let r=0;r<this._stateInfoList.length;r++){const a=this._stateInfoList[r],o=this.checkOneState(t,e,a,n);o!=="skip"&&o==="in"&&i.push([a.stateValue,a.level])}return i.map(r=>r[0])}checkDatumState(t,e,i){let n=!1;const r=i?e[0]:e;if(U(t.datums)){const a=t.datumKeys||Object.keys(t.datums[0]).filter(o=>!o.startsWith(xt));n=t.datums.some(o=>i&&U(o==null?void 0:o.items)?a.every(l=>{var h,d;return((d=(h=o==null?void 0:o.items)===null||h===void 0?void 0:h[0])===null||d===void 0?void 0:d[l])===(r==null?void 0:r[l])}):a.every(l=>(o==null?void 0:o[l])===(r==null?void 0:r[l])))}else Vt(t.datums)?n=(t.datumKeys||Object.keys(t.datums).filter(a=>!a.startsWith(xt))).every(a=>{var o,l;return i?((o=t.datums.items)===null||o===void 0?void 0:o[0][a])===r[a]:((l=t.datums)===null||l===void 0?void 0:l[a])===r[a]}):n=e===t.datums;return n}checkItemsState(t,e){var i;return(i=t.items)===null||i===void 0?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var r;let a=!0;for(const o in t.fields){const l=t.fields[o],h=l.type,d=l.domain,u=n?(r=e[0])===null||r===void 0?void 0:r[o]:e[o];if(Kt(h)&&d.length>1){if(this.checkLinearFieldState(d,o,e,i,n)){a=!1;break}a=!0}else{if(!d.some(c=>c===u)){a=!1;break}a=!0}}return a}checkLinearFieldState(t,e,i,n,r){var a;const o=r?(a=i[0])===null||a===void 0?void 0:a[e]:i[e];return o<t[0]||o>t[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(e,i)=>this.checkState(i,e)})}}class Cr extends iS{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return(t=this._data)===null||t===void 0?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=da.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().renderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();C(t)||(C(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){var t;return`${(t=this.getDataView())===null||t===void 0?void 0:t.name}`}_lookupGrammar(t){var e,i;return(i=(e=this.getCompiler().getVGrammarView())===null||e===void 0?void 0:e.getDataById)===null||i===void 0?void 0:i.call(e,t)}}class iZ extends Cr{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return E(t)?t:`${xt}_markData_${this._mark.id}`}_compileProduct(){var t;const e=(t=this._data)===null||t===void 0?void 0:t.latestData;C(e)||E(this.getProduct())||this._initProduct(e)}}var hM=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};class sZ extends iS{getSkipTheme(){return this._skipTheme}setSkipTheme(t){this._skipTheme=t}getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){E(t)&&(this._userId=t)}getDataView(){var t;return(t=this._data)===null||t===void 0?void 0:t.getDataView()}setDataView(t,e){C(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),E(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}setCustomizedShapeCallback(t){this._setCustomizedShape=t}setEnableSegments(t){this._enableSegments=t}constructor(t,e,i){super(t),this.grammarType=da.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=he.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=e,this.model=i,this.key=t.key,this.state=new eZ(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._option.skipTheme&&this.setSkipTheme(!0),this._event=new vc(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new iZ(t)}stateKeyToSignalName(t){return`${xt}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(E(e)&&this.removeProduct());E(e)||this.getCompiler().isInited&&(this._initProduct(t==null?void 0:t.group),C(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(C(this._data))return;this._data.compile();const e=this._data.getProduct();E(this._product)&&E(e)&&this._product.join(e,this.key,void 0,(t=this._groupKey)!==null&&t!==void 0?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,e=mt.STATE_NORMAL,i=t[e],n=(hM(t,[typeof e=="symbol"?e:e+""]),this._option.noSeparateStyle?null:{}),r={};return Object.keys(i).forEach(a=>{this._unCompileChannel[a]||(this._option.noSeparateStyle||Wq(a,i,this.getFacet())?r[a]={callback:this.compileCommonAttributeCallback(a,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[a]=this.compileCommonAttributeCallback(a,"normal"))}),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,e=mt.STATE_NORMAL,i=(t[e],hM(t,[typeof e=="symbol"?e:e+""])),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(i).forEach(a=>{const o={};Object.keys(i[a]).forEach(l=>{this._unCompileChannel[l]||(o[l]={callback:this.compileCommonAttributeCallback(l,a),dependency:[this.stateKeyToSignalName("markUpdateRank")]})}),this._product.encodeState(a,o,!0)}),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var t,e;if(this._animationConfig){let i;this.type==="component"?i=(t=this.model.animate)===null||t===void 0?void 0:t.getAnimationStateSignalName():i=(e=this.model.getRegion().animate)===null||e===void 0?void 0:e.getAnimationStateSignalName(),this._product.animation(this._animationConfig),this._product.animationState({callback:(n,r,a)=>{var o;return(o=a[i])===null||o===void 0?void 0:o.callback(n,r)},dependency:i}),this._animationConfig.normal&&this._event.on(ut.ANIMATION_END,({event:n})=>{n.mark===this.getProduct()&&n.animationState===si.appear&&this.runAnimationByState(si.normal)})}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},skipTheme:this.getSkipTheme(),support3d:this.getSupport3d(),enableSegments:!!this._enableSegments};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._setCustomizedShape&&(t.setCustomizedShape=this._setCustomizedShape),this._product.configure(t)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(i,n)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),n={mark:null,parent:null,element:null};return(r,a)=>(n.mark=a.mark,n.parent=a.mark.group,n.element=a,i(r,n))}compileTransform(){var t;!((t=this._transform)===null||t===void 0)&&t.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return(e=this.getCompiler().getVGrammarView())===null||e===void 0?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach(i=>i.state.updateLayoutState(!0)),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach(i=>{this.state.checkOneState(i,i.getDatum(),e)==="in"?i.addState(t):i.removeState(t)})}getMarks(){return[]}runAnimationByState(t){var e,i;return(i=(e=this.getProduct())===null||e===void 0?void 0:e.animate)===null||i===void 0?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return(i=(e=this.getProduct())===null||e===void 0?void 0:e.animate)===null||i===void 0?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return(i=(e=this.getProduct())===null||e===void 0?void 0:e.animate)===null||i===void 0?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return(i=(e=this.getProduct())===null||e===void 0?void 0:e.animate)===null||i===void 0?void 0:i.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}var dM=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};class Ri extends sZ{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,(i=e.map)===null||i===void 0||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(E(t.id)&&(this._userId=t.id),pe(t.interactive)&&(this._interactive=t.interactive),E(t.zIndex)&&this.setZIndex(t.zIndex),pe(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(lt(t))return le(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(le)),t}return typeof t=="function"?(e,i,n,r)=>le(t(e,i,n,r)):t}isUserLevel(t){return[Q.User_Mark,Q.User_Series,Q.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(C(t))return;t=this._filterStyle(t,e,i,n),n[e]===void 0&&(n[e]={});const r=this.isUserLevel(i);Object.keys(t).forEach(a=>{let o=t[a];C(o)||(o=this._filterAttribute(a,o,e,i,r,n),this.setAttribute(a,o,e,i,n))})}getStyle(t,e="normal"){var i;return(i=this.stateStyle[e][t])===null||i===void 0?void 0:i.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,r,a=this.stateStyle){let o=this._styleConvert(e);return r&&t==="angle"&&(o=this.convertAngleToRadian(o)),o}setReferer(t,e,i,n=this.stateStyle){var r;if(t)if(e&&i){const a=(r=n[i])!==null&&r!==void 0?r:{[e]:{}};n[i][e]=Object.assign(Object.assign({},a[e]),{referer:t})}else Object.entries(n).forEach(([a,o])=>{Object.entries(o).forEach(([l,h])=>{n[a][l].referer=t})})}setPostProcess(t,e,i="normal"){var n;!((n=this.stateStyle[i])===null||n===void 0)&&n[t]&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,i)(e,n)}setAttribute(t,e,i="normal",n=0,r=this.stateStyle){var a;r[i]===void 0&&(r[i]={}),r[i][t]===void 0&&(r[i][t]={level:n,style:e,referer:void 0});const o=(a=r[i][t])===null||a===void 0?void 0:a.level;E(o)&&o<=n&&_t(r[i][t],{style:e,level:n}),i!=="normal"&&t in this._extensionChannel&&this._extensionChannel[t].forEach(l=>{r[i][l]===void 0&&(r[i][l]=r.normal[l])})}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(yy(t.type)||t.scale){const e=YX(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let n=(i=this.stateStyle[e])===null||i===void 0?void 0:i[t];n||(n=this.stateStyle.normal[t]);const r=this._computeStateAttribute(n,t,e),a=q(n==null?void 0:n.postProcess),o=t in this._computeExChannel;if(a&&o){const l=this._computeExChannel[t];return(h,d)=>{let u=r(h,d);return u=n.postProcess(u,h,this._attributeContext,d,this.getDataView()),l(t,h,e,d,u)}}if(a)return(l,h)=>n.postProcess(r(l,h),l,this._attributeContext,h,this.getDataView());if(o){const l=this._computeExChannel[t];return(h,d)=>l(t,h,e,d,r(h,d))}return r}_computeStateAttribute(t,e,i){var n;return t?t.referer?t.referer._computeAttribute(e,i):typeof t.style=="function"?(r,a)=>t.style(r,this._attributeContext,a,this.getDataView()):XT.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):yy((n=t.style.scale)===null||n===void 0?void 0:n.type)?(r,a)=>t.style.scale.scale(r[t.style.field]):(r,a)=>t.style:(r,a)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",Q.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach(r=>{const a=n[r];if("style"in a){const o=a.style;let l={stateValue:r};"level"in a&&(l.level=a.level),"filter"in a&&(l=q(a.filter)?Object.assign({filter:a.filter},l):Object.assign(Object.assign({},a.filter),l)),this.state.addStateInfo(l),this.setStyle(o,r,Q.User_Mark,e)}else this.setStyle(a,r,Q.User_Mark,e)})}_computeGradientAttr(t){var e,i;const{gradient:n,scale:r,field:a}=t,o=dM(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||this.model.modelType!=="series")){const{scale:c,field:p}=this.model.getColorAttribute();r||(l=c),h||(h=p)}const d=lb(Su(this.model.getColorScheme(),this.model.modelType==="series"?(i=(e=this.model).getSpec)===null||i===void 0?void 0:i.call(e):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},HX[n]),o);return(c,p)=>{const g={},f=this.getDataView();return Object.keys(u).forEach(_=>{const m=u[_];_==="stops"?g.stops=m.map(v=>{const{opacity:y,color:b,offset:x}=v;let S=b??(l==null?void 0:l.scale(c[h]));return q(b)&&(S=b(c,this._attributeContext,p,f)),E(y)&&(S=Ue.SetOpacity(S,y)),{offset:q(x)?x(c,this._attributeContext,p,f):x,color:S||d[0]}}):q(m)?g[_]=m(c,this._attributeContext,p,f):g[_]=m}),g.gradient=n,g}}_computeBorderAttr(t){const{scale:e,field:i}=t,n=dM(t,["scale","field"]);return(r,a)=>{var o,l,h;const d={};if(Object.keys(n).forEach(u=>{const c=n[u];q(c)?d[u]=c(r,this._attributeContext,a,this.getDataView()):d[u]=c}),"stroke"in d)XT.includes((h=n.stroke)===null||h===void 0?void 0:h.gradient)&&(d.stroke=this._computeGradientAttr(n.stroke)(r,a));else{const u=lb(Su(this.model.getColorScheme(),this.model.modelType==="series"?(l=(o=this.model).getSpec)===null||l===void 0?void 0:l.call(o):void 0),this.model.getDefaultColorDomain());let c=e,p=i;if(!(e&&i||this.model.modelType!=="series")){const{scale:g,field:f}=this.model.getColorAttribute();e||(c=g),p||(p=f),d.stroke=(c==null?void 0:c.scale(r[p]))||u[0]}}return d}}}class ku extends Ri{constructor(){super(...arguments),this.type=ku.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(t){return this._marks.find(e=>e.id===t.id||e.name===t.name)!==void 0}addMark(t){return this.isMarkExist(t)?(Sa("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex(i=>i.id===t.id||i.name===t.name);return e===-1?(Sa("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter(e=>e.type===t)}getMarkInId(t){return this._marks.find(e=>e.id===t)}getMarkInName(t){return this._marks.find(e=>e.name===t)}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t!=null&&t.ignoreChildren||this.getMarks().forEach(e=>{e.getProduct()&&e.removeProduct(),e.compile({group:this._product})})}}ku.type="group";const nZ=()=>{M7(),I.registerMark(ku.type,ku)},rZ={type:"clipIn"},aZ={type:"fadeIn"},oZ=s=>({type:s.direction==="horizontal"?"growPointsXIn":"growPointsYIn",options:{orient:s.direction==="horizontal"?"positive":"negative"}});function lZ(s,t){switch(t){case"grow":return oZ(s);case"fadeIn":return aZ;default:return rZ}}const ea={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"}},rS={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},vm={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},ym=()=>{I.registerAnimation("scaleInOut",()=>rS)},Pr=()=>{I.registerAnimation("fadeInOut",()=>vm)},hZ=()=>{I.registerAnimation("cartesianGroupClip",s=>({appear:{custom:JA,customParameters:(t,e)=>({animationType:"in",group:e.getGraphicItem(),direction:s.direction(),width:s.width(),height:s.height(),orient:s.orient()})},disappear:{custom:JA,customParameters:(t,e)=>({animationType:"out",group:e.getGraphicItem(),direction:s.direction(),width:s.width(),height:s.height(),orient:s.orient()})}}))},SL=()=>{I.registerAnimation("line",(s,t)=>({appear:lZ(s,t),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:EE,duration:ea.update.duration,easing:ea.update.easing}],disappear:{type:"clipOut"}}))},dZ=()=>{ko.useRegisters([PX,EX,uX,cX,MX,CX,RX,OX,DX])},AL=()=>{ko.useRegisters([fX,_X,mX,vX,pX,gX])},aS=()=>{ko.useRegisters([wX,TX,AX,kX])},kL=()=>{ko.useRegisters([uD,cD,yX,bX,xX,SX,hX,dX])},wL=()=>{ko.useRegisters([uD,cD])},uZ={measureText:cq};class ks{static instance(){return ks.instance_||(ks.instance_=new ks),ks.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}const cZ=()=>{nf(Ct)},pZ=()=>{of(Ct)};class TL{constructor(){this.id=xo(),this._plugins=[]}add(t){if(!t||t.length===0)return null;const e=[];return t.forEach(i=>{this._plugins.find(n=>n.id===i.id)?Sa("不要重复添加相同的plugin"):(this._plugins.push(i),e.push(i),i.onAdd&&i.onAdd(this))}),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach(e=>{e.init&&e.init()})}get(t){return this._plugins.find(e=>e.id===t)}getAll(){return this._plugins.slice()}dispose(t){const e=this._plugins.find(i=>i.id===t);e&&e.dispose&&e.dispose(this)}disposeAll(){this._plugins.forEach(t=>{t.dispose&&t.dispose(this)})}}class gZ extends TL{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach(e=>{e.onInit&&e.onInit(this,t)})}onBeforeResize(t,e){this._plugins.forEach(i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)})}onAfterChartSpecTransform(t,e){this._plugins.forEach(i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)})}onBeforeInitChart(t,e){this._plugins.forEach(i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)})}}var an=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})},fZ=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};let Mi=class zp{static useRegisters(t){t.forEach(e=>{typeof e=="function"?e():console.error("Invalid function:",e)})}static useChart(t){t.forEach(e=>I.registerChart(e.type,e))}static useSeries(t){t.forEach(e=>I.registerSeries(e.type,e))}static useComponent(t){t.forEach(e=>I.registerComponent(e.type,e))}static useMark(t){t.forEach(e=>{var i;return I.registerMark((i=e.constructorType)!==null&&i!==void 0?i:e.type,e)})}static useLayout(t){t.forEach(e=>I.registerLayout(e.type,e))}static registerDataSetTransform(t,e){I.registerTransform(t,e)}static registerFunction(t,e){t&&e&&ks.instance().registerFunction(t,e)}static unregisterFunction(t){t&&ks.instance().unregisterFunction(t)}static getFunction(t){return t?ks.instance().getFunction(t):null}static getFunctionList(){return ks.instance().getFunctionNameList()}static registerMap(t,e,i){const n=I.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=I.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return Oq(t)}static hideTooltip(t=[]){Vs.forEach(e=>{var i;return(i=e==null?void 0:e.hideTooltip)===null||i===void 0?void 0:i.call(e)},t)}static getLogger(){return zt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(t,e){var i,n,r,a,o,l,h;this.id=xo(),this._userEvents=[],this._autoSize=!0,this._option={mode:Ze["desktop-browser"],onError:v=>{throw new Error(v)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._onResize=Xn((...v)=>{this._doResize()},100),this._option=at(this._option,{animation:t.animation!==!1},e),this._onError=(i=this._option)===null||i===void 0?void 0:i.onError;const d=this._option,{dom:u,renderCanvas:c,mode:p,stage:g,poptip:f}=d,_=fZ(d,["dom","renderCanvas","mode","stage","poptip"]),m=Xs(p);m&&u&&(this._container=ot(u)?document==null?void 0:document.getElementById(u):u),c&&(this._canvas=c),g&&(this._stage=g),p==="node"||this._container||this._canvas||this._stage?(m?cZ():p==="node"&&pZ(),this._viewBox=this._option.viewBox,this._currentThemeName=es.getCurrentThemeName(),this._setNewSpec(t),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new Iq({dom:(r=this._container)!==null&&r!==void 0?r:"none",canvas:c},Object.assign(Object.assign({mode:this._option.mode,stage:g,pluginList:f!==!1?["poptipForText"]:[]},_),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new Cq(this,this._compiler),this._event=new vc(this._eventDispatcher,p),this._compiler.initView(),(a=this.getStage())===null||a===void 0||a.setTheme({text:{fontFamily:(o=this._currentTheme)===null||o===void 0?void 0:o.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!m&&((h=(l=t.autoFit)!==null&&l!==void 0?l:this._option.autoFit)===null||h===void 0||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),Vs.registerInstance(this)):(n=this._option)===null||n===void 0||n.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(ot(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=_t({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=pb(this._originalSpec);return e.data=(t=e.data)!==null&&t!==void 0?t:[],e}_initChartSpec(t,e){var i;zp.getFunctionList()&&zp.getFunctionList().length&&(t=gb(t,zp)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=I.createChartSpecTransformer(this._spec.type,{type:this._spec.type,getTheme:()=>{var n;return(n=this._currentTheme)!==null&&n!==void 0?n:{}},animation:this._option.animation})),this._chartSpecTransformer.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=(i=this._chartSpecTransformer)===null||i===void 0?void 0:i.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=I.createChartSpecTransformer(this._spec.type,{type:this._spec.type,getTheme:()=>{var e;return(e=this._currentTheme)!==null&&e!==void 0?e:{}}})),this._specInfo=(t=this._chartSpecTransformer)===null||t===void 0?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i;if(!this._compiler)return void((e=this._option)===null||e===void 0||e.onError("compiler is not initialized"));const n=I.createChart(t.type,t,{type:t.type,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._option.mode||Ze["desktop-browser"],modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var r;return(r=this._currentTheme)!==null&&r!==void 0?r:{}},getSpecInfo:()=>{var r;return(r=this._specInfo)!==null&&r!==void 0?r:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:this._option.disableTriggerEvent===!0});n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(bt.initialized,{})):(i=this._option)===null||i===void 0||i.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(ut.ALL_ANIMATION_END,()=>{this._event.emit(bt.animationFinished,{})}),this._compiler.getVGrammarView().addEventListener(ut.AFTER_VRENDER_NEXT_RENDER,()=>{this._event.emit(bt.renderFinished,{})}))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;this._observer=new e(this._onResize),(t=this._observer)===null||t===void 0||t.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,n;return cL(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||Ze["desktop-browser"],modeParams:this._option.modeParams},{width:(e=(t=this._currentSize)===null||t===void 0?void 0:t.width)!==null&&e!==void 0?e:Qo,height:(n=(i=this._currentSize)===null||i===void 0?void 0:i.height)!==null&&n!==void 0?n:tl})}_doResize(){const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resize(t,e))}_initDataSet(t){this._dataSet=t instanceof no?t:new no,mr(this._dataSet,"dataview",A_),mr(this._dataSet,"array",E2),Mt(this._dataSet,"stackSplit",Dq),Mt(this._dataSet,"copyDataView",pm);for(const e in I.transforms)Mt(this._dataSet,e,I.transforms[e]);for(const e in I.dataParser)mr(this._dataSet,e,I.dataParser[e])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return q(t)&&(t=t()),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,n,r,a,o,l,h;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,this._chart.release(),this._chart=null,(i=this._compiler)===null||i===void 0||i.releaseGrammar(((n=this._option)===null||n===void 0?void 0:n.animation)===!1||((r=this._spec)===null||r===void 0?void 0:r.animation)===!1),this._userEvents.forEach(d=>{var u;return(u=this._event)===null||u===void 0?void 0:u.on(d.eType,d.query,d.handler)}),t.reSize&&this._doResize();else if(t.reCompile&&((a=this._compiler)===null||a===void 0||a.clear({chart:this._chart,vChart:this},!this._option.animation||!this._spec.animation),(o=this._compiler)===null||o===void 0||o.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:d,height:u}=this.getCurrentSize();this._chart.onResize(d,u,!1),(h=(l=this._compiler).resize)===null||h===void 0||h.call(l,d,u,!1)}}_beforeRender(t={}){var e,i,n,r,a,o,l,h;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:d,actionSource:u}=t;return d&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,u),(i=(e=this._option.performanceHook)===null||e===void 0?void 0:e.beforeInitializeChart)===null||i===void 0||i.call(e),this._initChart(this._spec),(r=(n=this._option.performanceHook)===null||n===void 0?void 0:n.afterInitializeChart)===null||r===void 0||r.call(n),!(!this._chart||!this._compiler)&&((o=(a=this._option.performanceHook)===null||a===void 0?void 0:a.beforeCompileToVGrammar)===null||o===void 0||o.call(a),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),(h=(l=this._option.performanceHook)===null||l===void 0?void 0:l.afterCompileToVGrammar)===null||h===void 0||h.call(l),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(bt.rendered,{}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return an(this,void 0,void 0,function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})})}_renderSync(t={}){var e;const i=this;return this._beforeRender(t)&&((e=this._compiler)===null||e===void 0||e.renderSync(t.morphConfig),this._afterRender()),i}_renderAsync(t={}){var e;return an(this,void 0,void 0,function*(){const i=this;return this._beforeRender(t)&&(yield(e=this._compiler)===null||e===void 0?void 0:e.renderAsync(t.morphConfig),this._afterRender()),i})}_updateAnimateState(){var t,e;this._option.animation&&((t=this._chart)===null||t===void 0||t.getAllRegions().forEach(i=>{var n;(n=i.animate)===null||n===void 0||n.updateAnimateState(si.update,!0)}),(e=this._chart)===null||e===void 0||e.getAllComponents().forEach(i=>{var n;(n=i.animate)===null||n===void 0||n.updateAnimateState(si.update,!0)}))}release(){var t,e,i,n;!((t=this._onResize)===null||t===void 0)&&t.cancel&&this._onResize.cancel(),this._chartPluginApply("disposeAll"),this._chartSpecTransformer=null,(e=this._chart)===null||e===void 0||e.release(),(i=this._compiler)===null||i===void 0||i.release(),(n=this._eventDispatcher)===null||n===void 0||n.release(),this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Vs.unregisterInstance(this)}updateData(t,e,i){return an(this,void 0,void 0,function*(){if(C(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=Y(this._spec.data);const n=this._spec.data.find(r=>r.name===t||r.id===t);return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):U(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this})}updateDataInBatches(t){return an(this,void 0,void 0,function*(){return this._chart?(this._chart.updateFullData(t.map(({id:e,data:i,options:n})=>({id:e,values:i,parser:n}))),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(t.forEach(({id:e,data:i,options:n})=>{const r=this._spec.data.find(a=>a.name===e);if(r)r.parse(i,n);else{const a=new Zt(this._dataSet,{name:e});a.parse(i,n),this._spec.data.push(a)}}),this)})}updateDataSync(t,e,i){if(C(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find(r=>r.name===t);if(n)n.parse(e,i);else{const r=new Zt(this._dataSet,{name:t});r.parse(e,i),this._spec.data.push(r)}return this}updateFullDataSync(t,e=!0){return this._chart?(this._chart.updateFullData(t),e&&this._compiler.renderSync(),this):(Y(t).forEach(i=>{var n;const{id:r,values:a,parser:o,fields:l}=i,h=this._spec.data.find(d=>d.name===r);if(h)h.setFields(hi(l)),h.parse(a,hi(o));else{const d=Ff(i,this._dataSet,this._spec.data,{onError:(n=this._option)===null||n===void 0?void 0:n.onError});this._spec.data.push(d)}}),this)}updateFullData(t,e=!0){return an(this,void 0,void 0,function*(){return this._chart?(this._chart.updateFullData(t),e&&(yield this._compiler.renderAsync()),this):(Y(t).forEach(i=>{var n;const{id:r,values:a,parser:o,fields:l}=i,h=this._spec.data.find(d=>d.name===r);if(h)h.setFields(hi(l)),h.parse(a,hi(o));else{const d=Ff(i,this._dataSet,this._spec.data,{onError:(n=this._option)===null||n===void 0?void 0:n.onError});this._spec.data.push(d)}}),this)})}updateSpec(t,e=!1,i){return an(this,void 0,void 0,function*(){const n=this._updateSpec(t,e);return yield this.updateCustomConfigAndRerender(n,!1,{morphConfig:i,transformSpec:!0,actionSource:"updateSpec"}),this})}updateSpecSync(t,e=!1,i){const n=this._updateSpec(t,e);return this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:!0,actionSource:"updateSpec"}),this}updateSpecAndRecompile(t,e=!1,i={}){const n=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(n,Object.assign({actionSource:"updateSpecAndRecompile"},i))}_updateSpec(t,e=!1){var i,n;const r=this._spec;if(!this._setNewSpec(t,e))return;_e(r.theme,this._spec.theme)||this._setCurrentTheme();const a=this._shouldChartResize(r);return(n=(i=this._compiler)===null||i===void 0?void 0:i.getVGrammarView())===null||n===void 0||n.updateLayoutTag(),Go(this._chart.updateSpec(this._spec),{change:a,reMake:!1,reCompile:!1,reSize:a})}updateModelSpec(t,e,i=!1,n){return an(this,void 0,void 0,function*(){if(!e||!this._spec)return this;if(ot(e)&&(e=JSON.parse(e)),q(t)||nM(this._spec,t,e,i),this._chart){const r=this._chart.getModelInFilter(t);if(r)return this._updateModelSpec(r,e,!1,i,n)}return this})}updateModelSpecSync(t,e,i=!1,n){if(!e||!this._spec)return this;if(ot(e)&&(e=JSON.parse(e)),q(t)||nM(this._spec,t,e,i),this._chart){const r=this._chart.getModelInFilter(t);if(r)return this._updateModelSpec(r,e,!0,i,n)}return this}_updateModelSpec(t,e,i=!1,n=!1,r){n&&(e=_t({},t.getSpec(),e));const a=t.updateSpec(e);return t.reInit(e),(a.change||a.reCompile||a.reMake||a.reSize||a.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(a,i,{morphConfig:r,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){var i,n,r,a,o,l;return an(this,void 0,void 0,function*(){if(!this._chart||!this._compiler)return this;const h=this._chart.getCanvasRect();return h&&h.width===t&&h.height===e?this:(this._chartPluginApply("onBeforeResize",t,e),(n=(i=this._option.performanceHook)===null||i===void 0?void 0:i.beforeResizeWithUpdate)===null||n===void 0||n.call(i),this._chart.onResize(t,e,!1),(a=(r=this._option.performanceHook)===null||r===void 0?void 0:r.afterResizeWithUpdate)===null||a===void 0||a.call(r),yield(l=(o=this._compiler).resize)===null||l===void 0?void 0:l.call(o,t,e),this._isReleased||this._event.emit(bt.afterResize,{chart:this._chart}),this)})}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.renderSync(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents&&(this._userEvents.push({eType:t,query:typeof e=="function"?null:e,handler:typeof e=="function"?e:i}),(n=this._event)===null||n===void 0||n.on(t,e,i))}off(t,e){var i;if(this._userEvents&&this._userEvents.length!==0)if(e){const n=this._userEvents.findIndex(r=>r.eType===t&&r.handler===e);n>=0&&(this._userEvents.splice(n,1),(i=this._event)===null||i===void 0||i.off(t,e))}else this._userEvents.forEach(n=>{var r;n.eType===t&&((r=this._event)===null||r===void 0||r.off(t,n.handler))}),this._userEvents=this._userEvents.filter(n=>n.eType!==t)}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}_updateCurrentTheme(t){var e,i;const n=this._option.theme,r=(e=this._spec)===null||e===void 0?void 0:e.theme;if(t&&(this._currentThemeName=t),ft(n)&&ft(r))this._currentTheme=Lr(this._currentThemeName,!0);else if(ot(n)&&(!r||ot(r))||ot(r)&&(!n||ot(n))){const a=ub({},Lr(this._currentThemeName,!0),Lr(n,!0),Lr(r,!0));this._currentTheme=a}else{const a=ub({},Lr(this._currentThemeName),Lr(n),Lr(r));this._currentTheme=cm(a,a.colorScheme)}i8(Et(this._currentTheme,"component.poptip")),(i=this._compiler)===null||i===void 0||i.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let n=!1;C(this._spec.width)?this._spec.width=t.width:this._spec.width!==t.width&&(n=!0),C(this._spec.height)?this._spec.height=t.height:this._spec.height!==t.height&&(n=!0);const r=this._autoSize;return this._autoSize=!!Xs(this._option.mode)&&((i=(e=this._spec.autoFit)!==null&&e!==void 0?e:this._option.autoFit)===null||i===void 0||i),this._autoSize!==r&&(n=!0),n}_getBackground(){return(typeof this._spec.background=="string"?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Lr(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return an(this,void 0,void 0,function*(){if(!es.themeExist(t))return this;const e=this._setCurrentTheme(t);return yield this.updateCustomConfigAndRerender(e,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this})}setCurrentThemeSync(t){if(!es.themeExist(t))return this;const e=this._setCurrentTheme(t);return this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),(e=this._chart)===null||e===void 0||e.setCurrentTheme(),{change:!0,reMake:!1}}_getTooltipComponent(){var t;return(t=this._chart)===null||t===void 0?void 0:t.getAllComponents().find(e=>e.type===J.tooltip)}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&((i=(e=n.tooltipHandler)===null||e===void 0?void 0:e.release)===null||i===void 0||i.call(e),n.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return(t=this._context)===null||t===void 0?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const n=this._getTooltipComponent();return(i=E(t)&&(n==null?void 0:n.showTooltip(t,e))!=="none")!==null&&i!==void 0&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return(t=e==null?void 0:e.hideTooltip())!==null&&t!==void 0&&t}getLegendDataById(t){var e;const i=(e=this._chart)===null||e===void 0?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=(e=this._chart)===null||e===void 0?void 0:e.getAllComponents().filter(n=>n.type===J.discreteLegend);return i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=(e=this._chart)===null||e===void 0?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=(e=this._chart)===null||e===void 0?void 0:e.getAllComponents().filter(n=>n.type===J.discreteLegend);return i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=(i=this._chart)===null||i===void 0?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=(i=this._chart)===null||i===void 0?void 0:i.getAllComponents().filter(r=>r.type===J.discreteLegend);n[t]&&n[t].setSelectedData(e)}getDataURL(){var t;return an(this,void 0,void 0,function*(){const e=this.getStage();if(this._chart&&e){e.render();const i=this._chart.getCanvas();return yield Hq(i,{onError:this._onError})}return(t=this._option)===null||t===void 0||t.onError(new ReferenceError("render is not defined")),null})}exportImg(t){var e,i;return an(this,void 0,void 0,function*(){if(!Xs(this._option.mode))return void((e=this._option)===null||e===void 0||e.onError(new TypeError("non-browser environment can not export img")));const n=yield this.getDataURL();n?jq(t,n):(i=this._option)===null||i===void 0||i.onError(new ReferenceError("render is not defined"))})}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();(t=this._option)===null||t===void 0||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if(this._option.mode!=="node")return void((t=this._option)===null||t===void 0||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();return i?(i.render(),i.window.getImageBuffer()):((e=this._option)===null||e===void 0||e.onError(new ReferenceError("render is not defined")),null)}setLayout(t){var e;this._option.layout=t,(e=this._chart)===null||e===void 0||e.setLayout(t)}reLayout(){var t;(t=this._chart)===null||t===void 0||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return(t=this._compiler)===null||t===void 0?void 0:t.getCanvas()}getContainer(){var t;if(E(this._container))return this._container;let e;return e=ot(this._canvas)?document==null?void 0:document.getElementById(this._canvas):this._canvas,E(e)?e.parentElement:(t=this.getCanvas())===null||t===void 0?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){var i;return(i=this._chart)===null||i===void 0?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;(i=(e=(t=this._compiler)===null||t===void 0?void 0:t.getVGrammarView())===null||e===void 0?void 0:e.animate)===null||i===void 0||i.stop()}pauseAnimation(){var t,e,i;(i=(e=(t=this._compiler)===null||t===void 0?void 0:t.getVGrammarView())===null||e===void 0?void 0:e.animate)===null||i===void 0||i.pause()}resumeAnimation(){var t,e,i;(i=(e=(t=this._compiler)===null||t===void 0?void 0:t.getVGrammarView())===null||e===void 0?void 0:e.animate)===null||i===void 0||i.resume()}convertDatumToPosition(t,e={},i=!1){var n;if(!this._chart||ft(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(E(r)?o=this._chart.getSeriesInUserId(r):E(a)&&(o=(n=this._chart.getSeriesInIndex([a]))===null||n===void 0?void 0:n[0]),o){const l=Object.keys(t),h=o.getViewData().latestData.find(c=>l.every(p=>c[p]==t[p])),d=o.getRegion().getLayoutStartPoint();let u;return u=h?o.dataToPosition(h):o.dataToPosition(t),ZT(u,d,i)}return null}convertValueToPosition(t,e,i=!1){var n,r;if(!this._chart||C(t)||ft(e))return null;if(!U(t)){const{axisId:h,axisIndex:d}=e;let u;if(E(h)?u=this._chart.getComponentsByKey("axes").find(p=>p.userId===h):E(d)&&(u=(n=this._chart.getComponentsByKey("axes"))===null||n===void 0?void 0:n[d]),!u)return Sa("Please check whether the `axisId` or `axisIndex` is set!"),null;const c=u==null?void 0:u.valueToPosition(t);if(i){const p=u.getLayoutStartPoint(),g=u.getOrient();return c+(g==="bottom"||g==="top"?p.x:p.y)}return c}const{seriesId:a,seriesIndex:o}=e;let l;return E(a)?l=this._chart.getSeriesInUserId(a):E(o)&&(l=(r=this._chart.getSeriesInIndex([o]))===null||r===void 0?void 0:r[0]),l?ZT(l.valueToPosition(t[0],t[1]),l.getRegion().getLayoutStartPoint(),i):(Sa("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return ks.instance().getFunction(t)}registerFunction(t,e){t&&e&&ks.instance().registerFunction(t,e)}unregisterFunction(t){t&&ks.instance().unregisterFunction(t)}getFunctionList(){return ks.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}_initChartPlugin(){const t=I.getChartPlugins();t.length>0&&(this._chartPlugin=new gZ(this),this._chartPlugin.load(t.map(e=>new e)),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}};Mi.InstanceManager=Vs,Mi.ThemeManager=es,Mi.globalConfig={uniqueTooltip:!0},Mi.Utils=uZ;I.registerRegion("region",Yl),I.registerLayout("base",nS),nZ(),ko.useRegisters([v9,y9]),dZ(),tS(sM.name,sM),zt.getInstance(Ss.Error);class _Z{constructor(t){this.id=xo(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}const Dh=(s,t)=>{const e=t.beforeCall();return s.forEach((i,n)=>t.call(i,n,e)),e.keyMap&&(e.keyMap.clear(),e.keyMap=null),s};function mZ(s){return s===Ze["desktop-browser"]||s===Ze["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Aa(s)||ka(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"pointerleave"},select:{enable:!0,trigger:"tap"}}:null}class vZ{get hover(){return this._hover}get select(){return this._select}constructor(t,e){this._fields=null,this._marks=new Ca,this._markReverse=new Ca,this.onHover=i=>{this.filterEventMark(i)?(this._isHovered=!0,this.hoverItem(i)):this._isHovered&&(this._isHovered=!1,this.unhoverItem())},this.onUnHover=i=>{this.filterEventMark(i)||this.interaction.filterEventMark(i,mt.STATE_HOVER)||this.interaction.getEventElement(mt.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=i=>{this.handleSingleEventSelect(i)},this.onUnSelect=i=>{this.interaction.filterEventMark(i,mt.STATE_SELECTED)||this.clearSelectedItems()},this._spec=t,this._option=e,this.event=new vc(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=t.slice()}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(mt.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(mt.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:r,trigger:a,triggerOff:o}=this._select;e&&(Y(i).forEach(l=>{t.on(l,{level:Yt.chart},this.onHover)}),n&&n!=="none"&&Y(n).forEach(l=>{t.on(l,{level:Yt.vchart,source:Jt.chart},this.onUnHover)})),r&&(Y(a).forEach(l=>{t.on(l,{level:Yt.mark},this.onSelect)}),o&&o!=="none"&&Y(o).forEach(l=>{t.on(l,{level:Yt.mark},this.onUnSelect)}),o||Y(o??a).forEach(l=>{t.on(l,{level:Yt.vchart},this.onUnSelect)}))}releaseEvent(){this.event.release()}initConfig(t){const e=mZ(t);this._hover=Object.assign({},e==null?void 0:e.hover),this._select=Object.assign({},e==null?void 0:e.select);const i=this._spec.hover;pe(i)?this._hover.enable=i:Vt(i)&&(this._hover.enable=!0,this._hover=_t(this._hover,i));const n=this._spec.select;pe(n)?this._select.enable=n:Vt(n)&&(this._select.enable=!0,this._select=_t(this._select,n))}hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(mt.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(mt.STATE_HOVER,t.item),this.interaction.reverseEventElement(mt.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(mt.STATE_HOVER);this.interaction.clearEventElement(mt.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(mt.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,mt.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(mt.STATE_SELECTED);this.interaction.clearEventElement(mt.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){const{triggerOff:e}=this._select;e!=="none"&&(this.interaction.removeEventElement(mt.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item}))}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(mt.STATE_SELECTED))this.unselectItems(t);else{this._select.mode==="multiple"?this.interaction.addEventElement(mt.STATE_SELECTED,t.item):this.interaction.exchangeEventElement(mt.STATE_SELECTED,t.item),this.interaction.reverseEventElement(mt.STATE_SELECTED);const e=this.interaction.getEventElementData(mt.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,mt.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every(i=>t[i]===e[i])}}class yZ{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const ia=s=>{var t,e;if((s==null?void 0:s.visible)===!1)return[];const i={mark:((t=s==null?void 0:s.mark)===null||t===void 0?void 0:t.visible)!==!1,dimension:((e=s==null?void 0:s.dimension)===null||e===void 0?void 0:e.visible)!==!1};return E(s==null?void 0:s.activeType)&&Object.keys(i).forEach(n=>{var r;i[n]=(r=s==null?void 0:s.activeType)===null||r===void 0?void 0:r.includes(n)}),Object.keys(i).filter(n=>i[n])};function bZ(s){return C(s.mark)&&C(s.model)&&C(s.datum)}class hs extends yZ{constructor(t){super(),this._getSeriesCacheInfo=()=>{var e,i,n;const{series:r}=this,a=r.getSeriesField();return{seriesFields:E(a)?Y(a):(e=r.getSeriesKeys())!==null&&e!==void 0?e:[],dimensionFields:(i=r.getDimensionField())!==null&&i!==void 0?i:[],measureFields:(n=r.getMeasureField())!==null&&n!==void 0?n:[],type:r.type}},this._getDimensionData=e=>{const{dimensionFields:i}=this._seriesCacheInfo;return i[0]&&(e==null?void 0:e[i[0]])},this._getMeasureData=e=>{const{measureFields:i}=this._seriesCacheInfo;return i[0]&&(e==null?void 0:e[i[0]])},this._getSeriesStyle=(e,i,n)=>{var r;for(const a of Y(i)){const o=(r=this.series.getSeriesStyle(e))===null||r===void 0?void 0:r(a);if(E(o))return o}return n},this.contentKeyCallback=(e,i)=>{const{dimensionFields:n,seriesFields:r}=this._seriesCacheInfo,a=n[n.length-1];return E(r[0])&&(e!=null&&e[r[0]])?e==null?void 0:e[r[0]]:(n.length>1&&(r.length===0||this.series.getSeriesKeys().length),e==null?void 0:e[a])},this.contentValueCallback=(e,i)=>this._getMeasureData(e),this.contentShapeTypeCallback=(e,i)=>{var n;return(n=this._getSeriesStyle(e,"shape",null))!==null&&n!==void 0?n:this._getSeriesStyle(e,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(e,i)=>this._getSeriesStyle(e,["fill","stroke"]),this.titleValueCallback=(e,i)=>this._getDimensionData(e),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const r=(e=(t=this.series.getSpec())===null||t===void 0?void 0:t.tooltip)!==null&&e!==void 0?e:{},a=(n=(i=this.series.getChart().getSpec())===null||i===void 0?void 0:i.tooltip)!==null&&n!==void 0?n:{},o=Object.assign(Object.assign({},a),r);["mark","dimension"].forEach(l=>{const h=o[l];E(h)&&(o[l]=Object.assign(Object.assign({},h),{title:E(h.title)?q(h.title)?h.title:Object.assign(Object.assign({},h.title),{seriesId:this.series.id}):void 0,content:E(h.content)?q(h.content)?h.content:Y(h.content).map(d=>q(d)?d:Object.assign(Object.assign({},d),{seriesId:this.series.id})):void 0}))}),this.spec=o,this.activeType=ia(o),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){if(t==="mark")return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]};if(t==="dimension"&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach(({data:r})=>r.forEach(({series:a})=>{n.push({seriesId:a.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1})})),{visible:!0,activeType:t,title:i,content:n}}return null}}const xZ={min:s=>s.length?pi(s.map(t=>1*t)):0,max:s=>s.length?Ye(s.map(t=>1*t)):0,"array-min":s=>s.length?pi(s.map(t=>1*t)):0,"array-max":s=>s.length?Ye(s.map(t=>1*t)):0,values:s=>{const t={},e=[];for(const i of s)t[i]||(e.push(i),t[i]=1);return e}},mb=(s,t)=>{var e,i;let n=t.fields;if(q(n)&&(n=n()),!(n!=null&&n.length)||!(s!=null&&s.length))return{};n=$l([],n);const r=t.target==="parser"?"parserData":"latestData",a=s[0][r]?s[0][r]:s||[],o=(i=(e=s[0]).getFields)===null||i===void 0?void 0:i.call(e);return ML(a,n,o)},ML=(s,t,e)=>{const i={};let n=[],r=[];return t.forEach(a=>{const o=a.key;i[o]={};const l=e==null?void 0:e[o],h=a.operations,d=h.some(p=>p==="min"||p==="max"||p==="allValid");let u=!0;n.length=0,s.forEach(p=>{p&&n.push(p[o])});const c=n.length;if(d){r.length=0,n.forEach((g,f)=>{Un(g)&&r.push(g)});const p=n;n=r,r=p,u=n.length===c}else n=h.some(p=>p==="array-min"||p==="array-max")?n.reduce((p,g)=>(g&&g.forEach(f=>{Un(f)&&p.push(f)}),p),[]):n.filter(p=>p!==void 0);h.forEach(p=>{if(a.customize)i[o][p]=a.customize;else{if(l&&l.lockStatisticsByDomain&&!C(l.domain)){if(p==="values")return void(i[o][p]=l.domain.slice())}else if(p==="allValid")return;i[o][p]=xZ[p](n),p==="array-max"&&(i[o].max=i[o][p]),p==="array-min"&&(i[o].min=i[o][p])}}),d&&(i[o].allValid=u)}),i},SZ=(s,t)=>{const{config:e}=t;if(!e)return s;const{invalidType:i,checkField:n}=e();return i!=="zero"||s.forEach(r=>{Un(r[n])||(r[n]=0)}),s};class Yn extends Cr{_compileProduct(){var t;const e=(t=this._data)===null||t===void 0?void 0:t.latestData;C(e)||E(this.getProduct())||this._initProduct([])}generateProductId(){var t;return(t=this._data)===null||t===void 0?void 0:t.name}}const wu=`${xt}_HIERARCHY_DEPTH`,Pa=`${xt}_HIERARCHY_ROOT`,AZ=`${xt}_HIERARCHY_ROOT_INDEX`;function Tu(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function ch(s,t,e){s&&(e.needDefaultSeriesField&&(s[Ms]=e.defaultSeriesField),s[ui]=t,s[$n]=e.getKey(s,t,e))}function oS(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function bm(s,t,e,i=0,n,r){r===void 0&&(r=t),ch(s,t,e),s[wu]=i,s[Pa]=n||s[e.categoryField],s[AZ]=r,s.children&&s.children.length&&s.children.forEach((a,o)=>bm(a,o,e,s[wu]+1,s[Pa],r))}const uM=["appear","enter","update","exit","disappear","normal"];function Ft(s={},t,e){const i={};for(let n=0;n<uM.length;n++){const r=uM[n],a=t?t[r]:void 0;if(a===!1)continue;if(r==="normal"){a&&(i.normal=a);continue}if(r!=="update"&&!a&&!s[r])continue;let o,l;o=U(s[r])?s[r]:[Object.assign(Object.assign({},ea[r]),s[r])],r==="exit"&&o.forEach(h=>{h.controlOptions={stopWhenStateChange:!0}}),a?(l=U(a)?a.map((h,d)=>{var u;let c=h;return gM(c)&&delete c.type,c.oneByOne&&(c=cM(c,(u=e==null?void 0:e.dataIndex)!==null&&u!==void 0?u:pM,e==null?void 0:e.dataCount)),c}):o.map((h,d)=>{var u;let c=_t({},o[d],a);return gM(c)&&delete c.type,c.oneByOne&&(c=cM(c,(u=e==null?void 0:e.dataIndex)!==null&&u!==void 0?u:pM,e==null?void 0:e.dataCount)),c}),i[r]=l):i[r]=o}return i.state=i.update,i}function Ut(s,t,e){var i,n,r,a,o;const l={};return t.animationAppear&&(l.appear=(i=t.animationAppear[s])!==null&&i!==void 0?i:t.animationAppear),t.animationDisappear&&(l.disappear=(n=t.animationDisappear[s])!==null&&n!==void 0?n:t.animationDisappear),t.animationEnter&&(l.enter=(r=t.animationEnter[s])!==null&&r!==void 0?r:t.animationEnter),t.animationExit&&(l.exit=(a=t.animationExit[s])!==null&&a!==void 0?a:t.animationExit),t.animationUpdate&&(l.update=(o=t.animationUpdate[s])!==null&&o!==void 0?o:t.animationUpdate),t.animationNormal&&t.animationNormal[s]&&(l.normal=t.animationNormal[s]),wZ(l,e)}function cM(s,t,e){const{oneByOne:i,duration:n,delay:r,delayAfter:a}=s;return s.delay=(o,l,h)=>{const d=t(o),u=q(n)?n(o,l,h):H(n)?n:0,c=q(r)?r(o,l,h):H(r)?r:0;let p=q(i)?i(o,l,h):i;return p===!1?c:(p=p===!0?0:p,c+d*(u+p))},s.delayAfter=(o,l,h)=>{const d=t(o),u=q(n)?n(o,l,h):H(n)?n:0,c=q(a)?a(o,l,h):H(a)?a:0;let p=q(i)?i(o,l,h):i;return p===!1?c:(p=p===!0?0:p,c+((e?e():l.mark.elements.length)-d)*(u+p))},delete s.oneByOne,s}function pM(s){return s==null?void 0:s[ui]}function Er(s,t){var e,i,n,r,a;if(s.animation===!1||((e=s.morph)===null||e===void 0?void 0:e.enable)===!1)return!1;const o=((n=(i=s.animationAppear)===null||i===void 0?void 0:i[t])!==null&&n!==void 0?n:s.animationAppear)!==!1,l=((a=(r=s.animationUpdate)===null||r===void 0?void 0:r[t])!==null&&a!==void 0?a:s.animationUpdate)!==!1;return!(!o||!l)}function kZ(s){return E(s.timeSlices)}function gM(s){return!kZ(s)&&E(s.channel)}function wZ(s,t){return s&&(vb(s=hi(s),e=>{var i;return q(e)&&((i=e.prototype)===null||i===void 0?void 0:i.constructor)!==e?(...n)=>e(...n,t):e}),s)}function vb(s,t){if(U(s))s.forEach((e,i)=>{s[i]=t(s[i],i),vb(s[i],t)});else if(Vt(s))for(const e in s)s[e]=t(s[e],e),vb(s[e],t)}function TZ(s){return s.getSpec().animation!==!1&&E(s.getRegion().animate)}class Rs extends fm{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i;const n=VD(t),r=(i=this._option)===null||i===void 0?void 0:i.getTheme(),{markByName:a,mark:o}=r,l=this._option.type,h=cb(Et(r,`series.${l}`),l,o,a),d=cb(Et(r,`series.${l}_${n}`),`${l}_${n}`,o,a);return _t({},h,d)}transformSpec(t,e,i){const n=super.transformSpec(t,e,i);return this._transformLabelSpec(n.spec),Object.assign(Object.assign({},n),{markLabelSpec:this.markLabelSpec})}_transformLabelSpec(t){}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",r,a){const o=t==null?void 0:t[i];o!=null&&o.visible&&this.addLabelSpec(e,Object.assign(Object.assign({animation:r??t.animation},o),{getStyleHandler:l=>{var h;return(h=l[n])===null||h===void 0?void 0:h.bind(l)}}),a)}_getDefaultSpecFromChart(t){var e;const i=(e=super._getDefaultSpecFromChart(t))!==null&&e!==void 0?e:{},{outerRadius:n,innerRadius:r}=t;return E(n)&&(i.outerRadius=n),E(r)&&(i.innerRadius=r),Object.keys(i).length>0?i:void 0}}class go extends sS{getTrigger(){return this._trigger}getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return(t=this._data)===null||t===void 0?void 0:t.getDataView()}getViewDataProductId(){var t;return(t=this._data)===null||t===void 0?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){E(t)&&(this._seriesField=t,this.getMarks().filter(e=>e.getDataView()===this.getViewData()).forEach(e=>{e.setFacet(this._seriesField)}))}getGroups(){return this._groups}getStack(){return this._stack}getStackValue(){var t;return(t=this._spec.stackValue)!==null&&t!==void 0?t:`${xt}_series_${this.type}`}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,(e=this.getViewData())===null||e===void 0||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Rs,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var n,r;return{width:(n=this._layoutRect.width)!==null&&n!==void 0?n:this._region.getLayoutRect().width,height:(r=this._layoutRect.height)!==null&&r!==void 0?r:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._percent=!1,this._stackOffsetSilhouette=!1,this.layoutZIndex=0,this._invalidType="break",this._getInvalidDefined=n=>Un(n[this.getStackValueField()]),this._region=e.region,this._dataSet=e.dataSet,!((i=this._spec)===null||i===void 0)&&i.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(bt.afterInitData,{model:this}),this.initTrigger(),this.initRootMark(),this.initMark();const t=TZ(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(bt.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return(i=this._option.globalScale.getScale(t))===null||i===void 0?void 0:i.scale(e)},seriesColor:t=>{var e;return C(t)&&(t=this.getSeriesKeys()[0]),(e=this._option.globalScale.getScale("color"))===null||e===void 0?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),pe(this._spec.stack)&&(this._stack=this._spec.stack),pe(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),pe(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),E(this._spec.stackValue)&&(this._stack=!0),C(this._stack)&&this._supportStack&&this._seriesField&&(this._stack=!0),E(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}initData(){var t,e,i,n,r,a;const o=(t=this._spec.data)!==null&&t!==void 0?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(o&&(this._rawData=Ff(o,this._dataSet,this._option.sourceDataList,{onError:(e=this._option)===null||e===void 0?void 0:e.onError})),(n=(i=this._rawData)===null||i===void 0?void 0:i.target)===null||n===void 0||n.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._stack&&(this._viewDataFilter=_b(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const l=_b(this._stack?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Yn(this._option,l),this._stack&&this._viewDataFilter.target.removeListener("change",l.reRunAllTransform)}this._invalidType==="zero"&&(!((r=this._rawData)===null||r===void 0)&&r.dataSet)&&(Mt(this._rawData.dataSet,"invalidTravel",SZ),(a=this._rawData)===null||a===void 0||a.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(!((i=this._viewDataStatistics.latestData)===null||i===void 0)&&i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const r=(n=this._rawData.getFields())===null||n===void 0?void 0:n[t];r&&r.lockStatisticsByDomain&&r.domain?(this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=pi(r.domain),this._rawStatisticsCache[t].max=Ye(r.domain)):this._rawStatisticsCache[t].values=r.domain):this._rawStatisticsCache[t]=ML(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t]}}return e&&(C(this._rawStatisticsCache[t].min)||C(this._rawStatisticsCache[t].max))&&(this._rawStatisticsCache[t].min=pi(this._rawStatisticsCache[t].values),this._rawStatisticsCache[t].max=Ye(this._rawStatisticsCache[t].values)),this._rawStatisticsCache[t]}_statisticViewData(){Mt(this._dataSet,"dimensionStatistics",mb);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Zt(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const e=this.getStatisticFields();return this._seriesField&&$l(e,[{key:this._seriesField,operations:["values"]}]),e},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this._stack&&this.createdStackData()}createStatisticalData(t,e,i){Mt(this._dataSet,"dimensionStatistics",mb);const n=new Zt(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var r;const a=$l(this.getStatisticFields(),(r=i==null?void 0:i(e.name))!==null&&r!==void 0?r:[]);return this._seriesField&&$l(a,[{key:this._seriesField,operations:["values"]}]),a},target:"latest"}},!1),n}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Zt(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return C(t)?(i,n,r)=>{if(this._spec.animation===!1){const l=this._noAnimationDataKey(i,n);if(l!==void 0)return l}const{keyMap:a}=r,o=this._getSeriesDataKey(i);return a.get(o)===void 0?(a.set(o,0),o):(a.set(o,a.get(o)+1),`${o}_${a.get(o)}`)}:ot(t)?i=>i[t]:U(t)&&t.every(i=>ot(i))?i=>t.map(n=>i[n]).join("-"):q(t)?(i,n)=>t(i,n):((e=this._option)===null||e===void 0||e.onError(`invalid dataKey: ${t}`),(i,n)=>{})}_addDataIndexAndKey(){var t;!((t=this._rawData)===null||t===void 0)&&t.dataSet&&(Mt(this._rawData.dataSet,"addVChartProperty",Dh),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Tu.bind(this),call:ch}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;(e=this._rawDataStatistics)===null||e===void 0||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(bt.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(bt.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(bt.viewDataUpdate,{model:this}),(e=this._data)===null||e===void 0||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(bt.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||C(e)?null:t[e]}getDatumPositionValues(t,e){return!t||C(e)?[]:ot(e)?[t[e]]:e.map(i=>t[i])}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:(e=(t=this._region).getGroupMark)===null||e===void 0?void 0:e.call(t),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(t){var e;this._spec.extensionMark&&((e=this._spec.extensionMark)===null||e===void 0||e.forEach((i,n)=>{this._createExtensionMark(i,null,`${xt}_series_${this.id}_extensionMark`,n,t)}))}_createExtensionMark(t,e,i,n,r){var a;const o=this._createMark({type:t.type,name:`${i}_${n}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,customShape:t==null?void 0:t.customShape});if(o){if(r.hasAnimation){const l=Ft({},Ut(t.type,t,this._markAttributeContext));o.setAnimationConfig(l)}if(t.type==="group")i=`${i}_${n}`,(a=t.children)===null||a===void 0||a.forEach((l,h)=>{this._createExtensionMark(l,o,i,h,r)});else if(!(e||C(t.dataId)&&C(t.dataIndex))){const l=this._option.getSeriesData(t.dataId,t.dataIndex);l===this._rawData?o.setDataView(this.getViewData(),this.getViewDataProductId()):o.setDataView(l)}}}_updateExtensionMarkSpec(t){var e;(e=this._spec.extensionMark)===null||e===void 0||e.forEach((i,n)=>{var r;const a=this._marks.getMarkWithInfo({name:`${this.type}_${this.id}_extensionMark_${n}`});a&&(t&&_e((r=t.extensionMark)===null||r===void 0?void 0:r[n],i)||(this.initMarkStyleWithSpec(a,i),a.updateStaticEncode(),a.updateLayoutState()))})}getStackData(){var t;return(t=this._viewStackData)===null||t===void 0?void 0:t.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new vZ(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=(t=this._seriesField)!==null&&t!==void 0?t:Ms;this.getMarksWithoutRoot().forEach(n=>{const r={},a={},o={};e.forEach(h=>{var d;const u=(d=h[n.name])===null||d===void 0?void 0:d.style;u&&(r[h.name]=!0,o[h.name]=o[h.name]||{},Object.keys(u).forEach(c=>{a[c]=!0,o[h.name][c]=u[c]}))}),n.state.addStateInfo({stateValue:YT,level:-1,filter:h=>Array.isArray(h)?h.length!==0&&r[h[0][i]]===!0:r[h[i]]===!0});const l={};Object.keys(a).forEach(h=>{l[h]=d=>{var u,c;let p;if(Array.isArray(d)){if(d.length===0)return;p=(u=o[d[0][i]])===null||u===void 0?void 0:u[h]}return p=(c=o[d[i]])===null||c===void 0?void 0:c[h],p||n.getAttribute(h,d)}}),this.setMarkStyle(n,l,YT)})}afterInitMark(){var t,e,i;this.event.emit(bt.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let n=(t=this._spec.animationThreshold)!==null&&t!==void 0?t:Number.MAX_SAFE_INTEGER;this.getMarks().forEach(r=>{var a,o;!((o=(a=r.stateStyle)===null||a===void 0?void 0:a.normal)===null||o===void 0)&&o.lineWidth&&r.setAttribute("stroke",this.getColorAttribute(),"normal",Q.Base_Series);const l=r.getProgressiveConfig();l&&(l.large&&l.largeThreshold&&(n=Math.min(n,l.largeThreshold)),l.progressiveThreshold&&(n=Math.min(n,l.progressiveThreshold)))}),((i=(e=this._rawData)===null||e===void 0?void 0:e.latestData)===null||i===void 0?void 0:i.length)>=n&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter(t=>!t.name.includes("seriesGroup"))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find(e=>e.id===t)}initEvent(){var t,e,i;this._trigger.init(),(e=(t=this._data)===null||t===void 0?void 0:t.getDataView())===null||e===void 0||e.target.addListener("change",this.viewDataUpdate.bind(this)),(i=this._viewDataStatistics)===null||i===void 0||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new hs(this)}_compareSpec(t,e,i){var n,r;const a=super._compareSpec(t,e),o=Object.keys(e||{}).sort(),l=Object.keys(t||{}).sort();return _e(o,l)?((i=i??{data:!0}).invalidType=!0,t.invalidType!==e.invalidType&&(a.reCompile=!0),i.extensionMark=!0,(Y(t.extensionMark).length!==Y(e.extensionMark).length||!((n=e.extensionMark)===null||n===void 0)&&n.some((h,d)=>h.type!==t.extensionMark[d].type||h.id!==t.extensionMark[d].id))&&(a.reMake=!0),a.reMake?a:(!((r=e.extensionMark)===null||r===void 0)&&r.some((h,d)=>h.visible!==t.extensionMark[d].visible)&&(a.reCompile=!0),this._marks.getMarks().some(h=>{var d,u;return i[h.name]=!0,((d=e[h.name])===null||d===void 0?void 0:d.visible)!==((u=t[h.name])===null||u===void 0?void 0:u.visible)})&&(a.reCompile=!0),o.some(h=>!i[h]&&!_e(t[h],e[h]))&&(a.reMake=!0),a)):(a.reMake=!0,a)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Zt||eS(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach(i=>{this._spec[i.name]&&this.initMarkStyleWithSpec(i,this._spec[i.name])}),this.initMarkStyle(),e.forEach(i=>{i.updateStaticEncode(),i.updateLayoutState(!0)}),this._updateExtensionMarkSpec(t),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const n=(e=(t=this._rawData)===null||t===void 0?void 0:t.transformsArr)===null||e===void 0?void 0:e.findIndex(r=>r.type==="addVChartProperty");n>=0&&this._rawData.transformsArr.splice(n,1),(i=this._data)===null||i===void 0||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){H(t.x)&&(this._layoutStartPoint.x=t.x),H(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){H(t)&&(this._layoutRect.width=t),H(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?(e=(t=this.getRawDataStatisticsByField(this._seriesField))===null||t===void 0?void 0:t.values)!==null&&e!==void 0?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return(n=(i=this._seriesMark)===null||i===void 0?void 0:i.getAttribute(e,t))!==null&&n!==void 0?n:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map(n=>({key:n,style:this.getSeriesStyle({[t]:n}),shapeType:i}))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,(i=(e=this.getRawDataStatisticsByField(t))===null||e===void 0?void 0:e.values)!==null&&i!==void 0?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo((t=this._seriesField)!==null&&t!==void 0?t:Ms,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return(e=(t=new _c().domain(i)).range)===null||e===void 0?void 0:e.call(t,n)}_getDataScheme(){return Su(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?(e=(t=this.getViewDataStatistics())===null||t===void 0?void 0:t.latestData[this._seriesField])===null||e===void 0?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:(t=this._option.globalScale.getScale("color"))!==null&&t!==void 0?t:this._getDefaultColorScale(),field:(e=this._seriesField)!==null&&e!==void 0?e:Ms}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={}){var i,n,r,a;const{key:o,groupKey:l,skipBeforeLayouted:h,themeSpec:d={},markSpec:u,dataView:c,dataProductId:p,parent:g,isSeriesMark:f,depend:_,progressive:m,support3d:v=this._spec.support3d||!!this._spec.zField,morph:y=!1,customShape:b}=e,x=super._createMark(t,{key:o??this._getDataIdKey(),support3d:v,seriesId:this.id,attributeContext:this._markAttributeContext});if(E(x)){this._marks.addMark(x,{name:t.name}),f&&(this._seriesMark=x),C(g)?(i=this._rootMark)===null||i===void 0||i.addMark(x):g!==!1&&g.addMark(x),C(c)?(x.setDataView(this.getViewData(),this.getViewDataProductId()),x.setSkipBeforeLayouted(!0)):c!==!1&&x.setDataView(c,p),pe(h)&&x.setSkipBeforeLayouted(h),E(_)&&x.setDepend(...Y(_));const S=this.getSpec()||{};x.setMorph(y),x.setMorphKey(((n=S.morph)===null||n===void 0?void 0:n.morphKey)||`${this._specIndex}`),x.setMorphElementKey((a=(r=S.morph)===null||r===void 0?void 0:r.morphElementKey)!==null&&a!==void 0?a:e.defaultMorphElementKey),C(m)||x.setProgressiveConfig(m),C(l)||x.setGroupKey(l),b&&x.setCustomizedShapeCallback(b),this.initMarkStyleWithSpec(x,_t({},d,u||S[x.name]))}return x}_getDataIdKey(){var t;return(t=super._getDataIdKey())!==null&&t!==void 0?t:$n}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map(r=>t[r]).join("_");const n=this.getSeriesField();return n&&!i.includes(n)&&(e+=`_${t[n]}`),e}addViewDataFilter(t){var e,i;(i=(e=this._viewDataFilter)!==null&&e!==void 0?e:this.getViewData())===null||i===void 0||i.transform(t,!1)}reFilterViewData(){var t,e;(e=(t=this._viewDataFilter)!==null&&t!==void 0?t:this.getViewData())===null||e===void 0||e.reRunAllTransform()}reTransformViewData(){var t,e;(e=(t=this._data)===null||t===void 0?void 0:t.getDataView())===null||e===void 0||e.reRunAllTransform()}fillData(){var t;(t=this.getRawData())===null||t===void 0||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ii&&t!==Ma&&t!==qs&&t!==xu||(t=this.getStackValueField()),(e=Bf(this.getRawData(),t))!==null&&e!==void 0?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values((t=Rf[this.type])!==null&&t!==void 0?t:{})}_getInvalidConnectType(){return this._invalidType==="zero"?"zero":this._invalidType==="link"?"connect":"none"}}go.mark=be,go.transformerConstructor=Rs;function MZ(s){return[j.rose,j.radar,j.circularProgress].includes(s)}function CL(s,t,e){const i=s.getScale(0),n="isInverse"in s&&s.isInverse();Kt(i.type)?e.sort((r,a)=>(r[t]-a[t])*(n?-1:1)):e.sort((r,a)=>(i._index.get(r[t])-i._index.get(a[t]))*(n?-1:1))}function Ba(s){return{dataIndex:t=>{var e,i;const n=s.direction==="horizontal"?s.fieldY[0]:s.fieldX[0],r=t==null?void 0:t[n],a=s.direction==="horizontal"?s.scaleY:s.scaleX;return((i=(e=a==null?void 0:a.domain)===null||e===void 0?void 0:e.call(a))!==null&&i!==void 0?i:[]).indexOf(r)||0},dataCount:()=>{var t,e,i;const n=s.direction==="horizontal"?s.scaleY:s.scaleX;return(i=((e=(t=n==null?void 0:n.domain)===null||t===void 0?void 0:t.call(n))!==null&&e!==void 0?e:[]).length)!==null&&i!==void 0?i:0}}}class en extends go{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getInvalidDefined=t=>{var e,i;return!(!((e=this._xAxisHelper)===null||e===void 0)&&e.isContinuous&&!Un(t[this._specXField[0]]))&&!(!((i=this._yAxisHelper)===null||i===void 0)&&i.isContinuous&&!Un(t[this._specYField[0]]))}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){var t,e,i;const n=[];return!((t=this.getXAxisHelper())===null||t===void 0)&&t.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach(r=>{const a={key:r,operations:[]};Kt(this.getXAxisHelper().getScale(0).type)?a.operations=["max","min"]:a.operations=["values"],n.push(a)}),!((e=this.getYAxisHelper())===null||e===void 0)&&e.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach(r=>{const a={key:r,operations:[]};Kt(this.getYAxisHelper().getScale(0).type)?a.operations=["max","min"]:a.operations=["values"],n.push(a)}),this._fieldZ&&(!((i=this.getZAxisHelper())===null||i===void 0)&&i.getScale)&&this._fieldZ.forEach(r=>{const a={key:r,operations:[]};Kt(this.getZAxisHelper().getScale(0).type)?a.operations=["max","min"]:a.operations=["values"],n.push(a)}),this.getStack()&&n.push({key:this.getStackValueField(),operations:["allValid"]}),n}getGroupFields(){return this.direction==="vertical"?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t;return(t=this._spec.stackValue)!==null&&t!==void 0?t:`${xt}_series_${this.type}_${(this.direction==="horizontal"?this.getXAxisHelper():this.getYAxisHelper()).getAxisId()}`}getStackValueField(){return this.direction==="vertical"?Y(this._spec.yField)[0]:Y(this._spec.xField)[0]}setValueFieldToStack(){this.direction==="vertical"?(this.setFieldY(ii),this.setFieldY2(qs)):(this.setFieldX(ii),this.setFieldX2(qs))}setValueFieldToPercent(){this.direction==="vertical"?(this.setFieldY(Ma),this.setFieldY2(xu)):(this.setFieldX(Ma),this.setFieldX2(xu))}setValueFieldToStackOffsetSilhouette(){this.direction==="vertical"?(this.setFieldY(rb),this.setFieldY2(nb)):(this.setFieldX(rb),this.setFieldX2(nb))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),E(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2((t=this._spec)===null||t===void 0?void 0:t.x2Field),this.setFieldY2((e=this._spec)===null||e===void 0?void 0:e.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),E(this._spec.sortDataByAxis)&&(this._sortDataByAxis=this._spec.sortDataByAxis===!0)}dataToPosition(t){return t?{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,n;return(n=(i=(e=this.getXAxisHelper()).getBandwidth)===null||i===void 0?void 0:i.call(e,t))!==null&&n!==void 0?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return(n=(i=(e=this.getYAxisHelper()).getBandwidth)===null||i===void 0?void 0:i.call(e,t))!==null&&n!==void 0?n:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}dataToPositionX(t){if(this._positionXEncoder)return this._positionXEncoder(t);if(!this._xAxisHelper)return this._positionXEncoder=i=>Number.NaN,Number.NaN;const e=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return e&&e.length!==0?(this._xAxisHelper.isContinuous?this._positionXEncoder=i=>(this._scaleConfig.datum=i,this._xAxisHelper.valueToPosition(this.getDatumPositionValue(i,e[0]),this._scaleConfig)):this._positionXEncoder=i=>(this._scaleConfig.datum=i,this._xAxisHelper.dataToPosition(Y(this.getDatumPositionValues(i,e)),this._scaleConfig)),this._positionXEncoder(t)):(this._positionXEncoder=i=>null,null)}dataToPositionY(t){if(this._positionYEncoder)return this._positionYEncoder(t);if(!this._yAxisHelper)return this._positionYEncoder=i=>Number.NaN,Number.NaN;const e=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return e&&e.length!==0?(this._yAxisHelper.isContinuous?this._positionYEncoder=i=>(this._scaleConfig.datum=i,this._yAxisHelper.valueToPosition(this.getDatumPositionValue(i,e[0]),this._scaleConfig)):this._positionYEncoder=i=>(this._scaleConfig.datum=i,this._yAxisHelper.dataToPosition(Y(this.getDatumPositionValues(i,e)),this._scaleConfig)),this._positionYEncoder(t)):(this._positionYEncoder=i=>null,null)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction==="vertical"?this._specXField:this._specYField}getMeasureField(){return this._direction==="vertical"?this._specYField:this._specXField}viewDataUpdate(t){super.viewDataUpdate(t),this.sortDataByAxis&&this._sortDataInAxisDomain()}_sortDataInAxisDomain(){var t,e,i;!((e=(t=this.getViewData())===null||t===void 0?void 0:t.latestData)===null||e===void 0)&&e.length&&(CL(this._direction==="horizontal"?this._yAxisHelper:this._xAxisHelper,this._direction==="horizontal"?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),(i=this._data)===null||i===void 0||i.updateData(!0))}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const lS="monotone",PL="linear",CZ="bevel";class hS{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],n=this._fieldY,r=this._fieldX;i.push({type:"sampling",size:this._direction==="vertical"?t:e,factor:this._spec.samplingFactor,yfield:this._direction==="vertical"?n[0]:r[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:this._direction==="horizontal"&&this.coordinate==="cartesian"?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),(t=this._symbolMark)===null||t===void 0||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i;return this._lineMark=this._createMark(Vr.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e==null||e,progressive:t,customShape:(i=this._spec.line)===null||i===void 0?void 0:i.customShape}),this._lineMark}initLineMarkStyle(t,e){var i,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",Q.Series),this._invalidType!=="zero"&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",Q.Series),this.event.on(bt.viewDataStatisticsUpdate,{filter:a=>a.model===this},()=>{this.encodeDefined(r,"defined")}),this.coordinate==="polar")this.setMarkStyle(r,{lineJoin:CZ,curveType:PL,closePath:!0},"normal",Q.Series);else{const a=e??((n=(i=this.getSpec().line)===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.curveType),o=a===lS?t==="vertical"?"monotoneX":"monotoneY":a;this.setMarkStyle(r,{curveType:o},"normal",Q.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",Q.Series),this._trigger.registerMark(r)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some(n=>(n.data.some(r=>r.series===this&&(i=r.datum,!0)),!i.length)),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){var i,n,r;if(((i=this._spec.point)===null||i===void 0?void 0:i.visible)!==!1&&(this._symbolMark=this._createMark(Vr.point,{morph:Er(this._spec,Vr.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:t,isSeriesMark:!!e,customShape:(n=this._spec.point)===null||n===void 0?void 0:n.customShape})),this._spec.activePoint===!0){const a=new Zt(this._option.dataSet,{name:`${xt}_series_${this.id}_active_point`});a.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:"symbol"},{morph:!1,groupKey:this._seriesField,isSeriesMark:!1,dataView:a,parent:this._region.getInteractionMark(),customShape:(r=this._spec.point)===null||r===void 0?void 0:r.customShape}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._trigger.registerMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(kr.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])this._symbolActiveMark.stateStyle[e][i]={style:null,level:Q.Series,referer:t}}this._symbolActiveMark.state.changeStateInfo({stateValue:mt.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",Q.Series),this._invalidType!=="zero"&&this.setMarkStyle(t,{visible:this._getInvalidDefined},"normal",Q.Series),this.event.on(bt.viewDataStatisticsUpdate,{filter:e=>e.model===this},()=>{this.encodeDefined(t,"visible")}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",Q.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(!((e=(t=this._spec[Vr.point.name])===null||t===void 0?void 0:t.state)===null||e===void 0)&&e.dimension_hover)&&(i.setVisible(!0),this.event.on(kr.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,_t({},this._spec[Vr.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:mt.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&(((e=t.getTarget())===null||e===void 0?void 0:e.type)!=="symbol"&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:i=>i[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._invalidType!=="zero"&&this.setMarkStyle(t,{visible:this._getInvalidDefined},"normal",Q.Series),this.event.on(bt.viewDataStatisticsUpdate,{filter:i=>i.model===this},()=>{this.encodeDefined(t,"visible")}))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:e=>e[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,n,r,a,o,l;if(!t)return;const h=(n=(i=this.getViewDataStatistics())===null||i===void 0?void 0:i.latestData)===null||n===void 0?void 0:n[this.getStackValueField()];if(this._invalidType==="zero"||h&&(h!=null&&h.allValid)){if(((a=(r=t.stateStyle.normal)===null||r===void 0?void 0:r[e])===null||a===void 0?void 0:a.style)===!0)return;this.setMarkStyle(t,{[e]:!0},"normal",Q.Series)}else{if(((l=(o=t.stateStyle.normal)===null||o===void 0?void 0:o[e])===null||l===void 0?void 0:l.style)!==!0)return;this.setMarkStyle(t,{[e]:this._getInvalidDefined},"normal",Q.Series)}t.getProduct()&&t.compileEncode()}}class EL extends Ri{setStyle(t,e="normal",i=0,n=this.stateStyle){if(C(t))return;n[e]===void 0&&(n[e]={});const r=this._getIgnoreAttributes(),a=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],o=this.isUserLevel(i);let l=!1;Object.keys(t).forEach(h=>{const d=t[h];if(C(d)||r.includes(h))return;o&&a.includes(h)&&(yy(d==null?void 0:d.type)||d!=null&&d.scale||q(d))&&(l=!0);let u=this._styleConvert(d);o&&h==="angle"&&(u=this.convertAngleToRadian(u)),this.setAttribute(h,u,e,i,n)}),l&&this.setEnableSegments(l)}}class Mu extends EL{constructor(){super(...arguments),this.type=Mu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return((t=this.model)===null||t===void 0?void 0:t.type)===j.radar&&((e=this.model)===null||e===void 0?void 0:e.coordinate)==="polar"?[]:["fill","fillOpacity"]}}Mu.type="line";const dS=()=>{I.registerMark(Mu.type,Mu),P7(),kL()};class RL extends Ri{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class Cu extends RL{constructor(){super(...arguments),this.type=Cu.type}}Cu.type="symbol";const Ia=()=>{I.registerMark(Cu.type,Cu),KO()};class yc extends Rs{_transformLabelSpec(t){var e,i,n;((e=t.point)===null||e===void 0?void 0:e.visible)!==!1&&((n=(i=t.point)===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.visible)!==!1?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}class al extends en{constructor(){super(...arguments),this.type=j.line,this.transformerConstructor=yc,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=(t=this._spec.seriesMark)!==null&&t!==void 0?t:"line";this.initLineMark(e,i==="line"),this.initSymbolMark(e,i==="point")}initTooltip(){super.initTooltip(),this._lineMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const r={direction:this.direction},a=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;if(this._lineMark.setAnimationConfig(Ft((i=I.getAnimationInKey("line"))===null||i===void 0?void 0:i(r,a),Ut("line",this._spec,this._markAttributeContext))),this._symbolMark){const o=Ba(this);this._symbolMark.setAnimationConfig(Ft((n=I.getAnimationInKey("scaleInOut"))===null||n===void 0?void 0:n(),Ut("point",this._spec,this._markAttributeContext),o))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i=((e=this._spec)===null||e===void 0?void 0:e.seriesMark)!=="point";return n=>{var r,a;return i&&n==="fill"&&(n="stroke"),(a=(r=this._seriesMark)===null||r===void 0?void 0:r.getAttribute(n,t))!==null&&a!==void 0?a:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}al.type=j.line,al.mark=vD,al.transformerConstructor=yc,ci(al,hS);const PZ=()=>{$x(),Yx(),dS(),Ia(),SL(),ym(),I.registerSeries(al.type,al)};class EZ{get dataList(){return this._dataArr}constructor(t,e){this._dataArr=[],this._onError=e,this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let i=0;i<e.length;i++)this._dataArr.push(Ff(e[i],this._dataSet,this._dataArr,{onError:this._onError}))}updateData(t,e=!1,i=!0){const n=Y(t);return(!e||n.length===this._dataArr.length)&&(this._dataValueForEach(n,(r,a)=>{a.markRunning()}),this._dataValueForEach(n,(r,a)=>{eS(a,r,i)}),!0)}_dataValueForEach(t,e){t.forEach((i,n)=>{if(i instanceof Zt)return;const r=this.getSeriesData(i.id,n);r&&e(i,r,n)})}getSeriesData(t,e){var i,n;if(!this._dataArr.length)return null;if(typeof t=="string"){const r=this._dataArr.filter(a=>a.name===t);return r[0]?r[0]:((i=this._onError)===null||i===void 0||i.call(this,`no data matches dataId ${t}!`),null)}return typeof e=="number"?this._dataArr[e]?this._dataArr[e]:((n=this._onError)===null||n===void 0||n.call(this,`no data matches dataIndex ${e}!`),null):this._dataArr[0]}}class RZ{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=i=>{const n=[];return this._scaleSpecMap.forEach((r,a)=>{Jo(r.domain)&&r.domain.forEach(o=>{o.dataId===i&&o.fields.forEach(l=>{$l(n,[{key:l,operations:Kt(r.type)?["max","min"]:["values"]}])})})}),this._markAttributeScaleMap.forEach((r,a)=>{const o=this.getScale(a);r.forEach(l=>{this._getSeriesBySeriesId(l.seriesId).getRawData().name===i&&l.field&&$l(n,[{key:l.field,operations:Kt(o.type)?["max","min"]:["values"]}])})}),n},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e=t.type==="ordinal"&&t.id==="color"?db("colorOrdinal"):db(t.type)),e?(U(t.range)&&e.range(t.range),U(t.domain)&&(Jo(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(!((t=this._spec)===null||t===void 0)&&t.length))return;const e=new Map,i=new Map;this._spec.forEach(n=>{const r=this._createFromSpec(n);r&&(e.set(n.id,r),i.set(n.id,n))}),this._modelScaleSpecMap.forEach(n=>{const r=this._createFromSpec(n);r&&(e.set(n.id,r),i.set(n.id,n))}),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(_e(t,this._spec))return e;e.change=!0;for(let i=0;i<t.length;i++){const n=t[i],r=this._scaleMap.get(n.id);if(!r)return e.reMake=!0,e;const a=this._spec.find(o=>o.id===n.id);if(!a.id||a.type!==n.type)return e.reMake=!0,e;n.range&&!_e(n.range,r.range())&&(r.range(n.range),e.reRender=!0),Jo(n.domain)?e.reRender=!0:_e(n.domain,r.domain())||(r.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach(e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))})}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const n=e[i];if(n.getRawData().name===t)return n}return null}_getSeriesBySeriesId(t){const e=this._chart.getAllSeries();for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}return null}updateScaleDomain(t){this._scaleSpecMap.forEach((e,i)=>{const n=this._scaleMap.get(i);if(!n)return;if(!Jo(e.domain))return e.domain&&e.domain.length!==0||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let r;r=Kt(e.type)?[null,null]:new Set,e.domain.forEach(o=>{const l=this._getSeriesByRawDataId(o.dataId);if(!l)return;const h=Kt(e.type);o.fields.forEach(d=>{const u=l.getRawDataStatisticsByField(d,h);u&&(h?(C(r[0])?r[0]=u.min:r[0]=Math.min(u.min,r[0]),C(r[1])?r[1]=u.max:r[1]=Math.max(u.max,r[1])):u.values.forEach(c=>{r.add(c)}))})});const a=r;Kt(e.type)||(r=Array.from(r)),n.domain(r),this._updateMarkScale(i,n,a)})}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&n.length!==0&&n.forEach(r=>{if(!r.field||!r.markScale||r.markScale===e)return;if(C(r.changeDomain)||r.changeDomain==="none"||C(r.seriesId))return void(Kt(e.type)?r.markScale.domain(i):e.domain(Array.from(i)));const a=this._getSeriesBySeriesId(r.seriesId),o=Kt(e.type),l=a.getRawDataStatisticsByField(r.field,o);if(!ft(l))return r.changeDomain==="expand"?(o?(i[0]=Math.min(i[0],l.min),i[1]=Math.max(i[1],l.max)):(l.values.forEach(h=>{i.add(h)}),i=Array.from(i)),void r.markScale.domain(i)):void(r.changeDomain!=="replace"||(o?r.markScale.domain([l.min,l.max]):r.markScale.domain(l.values)));Kt(e.type)?r.markScale.domain(i):e.domain(Array.from(i))})}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let r=i;return(C(t.field)||!C(t.changeDomain)&&t.changeDomain!=="none"&&!C(e))&&(r=i.clone()),n.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:r})),r}}class OZ{constructor(t){this.stackRegion=({model:e})=>{const i=e.getSeries();if(!i.some(l=>l.getStack()))return;const n=i.some(l=>{var h,d;return(d=(h=l.getSpec())===null||h===void 0?void 0:h.totalLabel)===null||d===void 0?void 0:d.visible}),r=n||i.some(l=>l.getPercent()),a=i.some(l=>l.getStackOffsetSilhouette()),o=JD(e,!0);for(const l in o)for(const h in o[l].nodes)tL(o[l].nodes[h],e.getStackInverse(),r);if(a)for(const l in o)for(const h in o[l].nodes)gq(o[l].nodes[h]);n&&e.getSeries().forEach(l=>{const h=l.getStackData(),d=l.getStackValue(),u=l.getStackValueField();h&&u&&QD(o[d],u)})},this._chart=t}init(){this._chart.getAllRegions().forEach(t=>{t.event.on(bt.regionSeriesDataFilterOver,{filter:({model:e})=>(e==null?void 0:e.id)===t.id},this.stackRegion)})}stackAll(){this._chart.getAllRegions().forEach(t=>{this.stackRegion({model:t})})}}var fM=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};let xe=class extends gm{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,!((n=this.getCompiler())===null||n===void 0)&&n.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderAsync(e)),this._layoutTag}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,n,r,a;super(e),this.type="chart",this.id=xo(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:Qo,height:tl},this._viewRect={width:Qo,height:tl},this._viewBox={x1:0,y1:0,x2:Qo,y2:tl},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var o;return(o=this._series)!==null&&o!==void 0?o:[]},this.getRegionsInIndex=o=>o&&o.length!==0?this._regions.filter((l,h)=>o.includes(h)):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=o=>o?this._regions.filter(l=>o.includes(l.id)):[],this.getRegionsInQuerier=o=>o?this._regions.filter((l,h)=>Y(o).some(d=>E(d.regionId)&&d.regionId===l.userId||d.regionIndex===h)):this._regions,this.getRegionsInUserId=o=>{if(o)return this._regions.find(l=>l.userId===o)},this.getRegionsInUserIdOrIndex=(o,l)=>this.getAllRegions().filter(h=>o!=null&&o.length?h.userId&&o.includes(h.userId):!(l!=null&&l.length)||l.includes(h.getSpecIndex())),this.getComponents=()=>this._components,this.getSeriesInIndex=o=>o&&o.length!==0?this._series.filter((l,h)=>o.includes(h)):[this._series[0]],this.getSeriesInIds=o=>o?this._series.filter(l=>o.includes(l.id)):[],this.getSeriesInUserId=o=>{if(o)return this._series.find(l=>l.userId===o)},this.getSeriesInUserIdOrIndex=(o,l)=>this.getAllSeries().filter(h=>o!=null&&o.length?h.userId&&o.includes(h.userId):!(l!=null&&l.length)||l.includes(h.getSpecIndex())),this.getComponentByIndex=(o,l)=>{const h=this._components.filter(d=>(d.specKey||d.type)===o);if(h&&h.length!==0)return h[l]},this.getComponentsByKey=o=>this._components.filter(l=>(l.specKey||l.type)===o),this.getComponentByUserId=o=>{const l=this._components.find(h=>h.userId===o);if(l)return l},this._paddingSpec=Ar((i=t.padding)!==null&&i!==void 0?i:e.getTheme().padding),this._event=new vc(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new EZ(this._dataSet,(n=this._option)===null||n===void 0?void 0:n.onError),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:(r=this._option)===null||r===void 0?void 0:r.onError,disableTriggerEvent:((a=this._option)===null||a===void 0?void 0:a.disableTriggerEvent)===!0,getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor({type:this.type,seriesType:this.seriesType,getTheme:this._option.getTheme,animation:this._option.animation}),this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._spec.background&&typeof this._spec.background=="object"&&this._createBackground(),this._createLayout(),this._transformer.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),this._transformer.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),this._transformer.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}init(){this._regions.forEach(t=>t.init({})),this._series.forEach(t=>t.init({})),this._components.forEach(t=>t.init({dataSet:this._dataSet})),this._initEvent(),this._canStack&&(this._stack=new OZ(this),this._stack.init()),this.reDataFlow()}reDataFlow(){this._series.forEach(t=>{var e;return(e=t.getRawData())===null||e===void 0?void 0:e.markRunning()}),this._series.forEach(t=>t.fillData()),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const n={width:t,height:e};this._canvasRect=n,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=ZX(this._spec.background);t&&(this._backgroundMark=I.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},t),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})))}_createRegion(t,e){if(!t)return;const{spec:i}=e,n=fM(e,["spec"]),r=new t(i,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,e){if(!t)return;const{spec:i}=e,n=fM(e,["spec"]);let r;if(E(i.regionId)?r=this.getRegionsInUserId(i.regionId):E(i.regionIndex)&&(r=this.getRegionsInIndex([i.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(i,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:i.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find(e=>e.id===t)}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(ot(t))return this.getAllModels().find(i=>i.userId===t);if(q(t))return this.getAllModels().find(i=>t(i));let e=0;return this.getAllModels().find(i=>{var n;if(((n=i.specKey)!==null&&n!==void 0?n:i.type)===t.type){if(e===t.index)return!0;e++}return!1})}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let n=!1;(this._spec.zField||this._spec.series&&this._spec.series.some(a=>a.zField))&&(n=!0);const r=I.getLayoutInKey((e=(t=this._spec.layout)===null||t===void 0?void 0:t.type)!==null&&e!==void 0?e:n?"layout3d":"base");if(r){const a=new r(this._spec.layout,{onError:(i=this._option)===null||i===void 0?void 0:i.onError});this._layoutFunc=a.layoutItems.bind(a)}}}layout(t){var e,i,n,r;if((i=(e=this._option.performanceHook)===null||e===void 0?void 0:e.beforeLayoutWithSceneGraph)===null||i===void 0||i.call(e),this.getLayoutTag()){this._event.emit(bt.layoutStart,{chart:this}),this.onLayoutStart(t);const a=this.getLayoutElements();this._layoutFunc(this,a,this._layoutRect,this._viewBox),this._event.emit(bt.afterLayout,{elements:a}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(bt.layoutEnd,{chart:this})}(r=(n=this._option.performanceHook)===null||n===void 0?void 0:n.afterLayoutWithSceneGraph)===null||r===void 0||r.call(n)}onLayoutStart(t){this.getAllModels().forEach(e=>e.onLayoutStart(this._layoutRect,this._viewRect,t))}onLayoutEnd(t){this.getAllModels().forEach(e=>e.onLayoutEnd(t))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach(e=>e.onEvaluateEnd(t))}getLayoutElements(){return this.getAllModels().map(t=>t.layout).filter(t=>!!t)}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof sS)return e}getModelByUserId(t){const e=this._series.find(r=>r.userId===t);if(e)return e;const i=this._regions.find(r=>r.userId===t);return i||this._components.find(r=>r.userId===t)||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter(t=>t&&t instanceof Ri)}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof Ri)return e}updateData(t,e,i=!0,n){const r=this._dataSet.getDataView(t);r&&(r.markRunning(),r.parseNewData(e,n)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach(a=>a.onDataUpdate())}updateFullData(t,e=!0){Y(t).forEach(i=>{const n=this._dataSet.getDataView(i.id);n&&n.markRunning()}),Y(t).forEach(i=>{const n=this._dataSet.getDataView(i.id);n&&eS(n,i,!0)}),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach(i=>i.onDataUpdate())}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=cL(this._spec,this._option,{width:Qo,height:tl})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t,e;const i=(t=this._spec.scales)!==null&&t!==void 0?t:[];let n=i.find(a=>a.id==="color");const r=this.getColorScheme();if(!n&&(n={type:"ordinal",id:"color",domain:null,range:null},i.push(n),this._spec.color)){const a=this._spec.color;if(U(a))n.range=a;else{const o=a;Object.prototype.hasOwnProperty.call(o,"type")&&(n.type=o.type),Object.prototype.hasOwnProperty.call(o,"domain")&&(n.domain=o.domain),Object.prototype.hasOwnProperty.call(o,"range")&&(n.range=o.range),Object.prototype.hasOwnProperty.call(o,"specified")&&(n.specified=o.specified)}}return!((e=n.range)===null||e===void 0)&&e.length||(n.range=Su(r),n.rangeTheme=!0),i}_createGlobalScale(){this._globalScale=new RZ(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach(i=>{const n=i.getSeriesKeys();n&&n.forEach(r=>t.add(r))});const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){Go(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=Su(e),this._globalScale.getScale("color").range(t.range))}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=Object.keys(this._spec).sort(),n=Object.keys(t).sort();if(JSON.stringify(i)!==JSON.stringify(n))return e.reMake=!0,e;const r=this._spec;return this._spec=t,this.updateChartConfig(e,r),e.reMake?e:(this.updateGlobalScale(e),e.reMake?e:(this.updateRegionSpec(e),e.reMake?e:(this.updateComponentSpec(e),e.reMake?e:(this.updateSeriesSpec(e),e.reMake||(this.updateDataSpec(e),e.reMake||this.updateGlobalScaleDomain()),e))))}updateChartConfig(t,e){var i,n;this._paddingSpec=Ar((i=this._spec.padding)!==null&&i!==void 0?i:(n=this._option)===null||n===void 0?void 0:n.getTheme().padding),this._updateLayoutRect(this._viewBox),_e(this._spec.background,e.background)||(t.reMake=!0)}updateDataSpec(t){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;!((e=this._spec)===null||e===void 0)&&e.region&&(this._spec.region.length===this._regions.length?this._regions.forEach(i=>{Go(t,i.updateSpec(this._spec.region[i.getSpecIndex()]))}):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach(i=>{var n,r;const a=i.specKey||i.type,o=(n=this._spec[a])!==null&&n!==void 0?n:{};U(o)?(e[a]=e[a]||{specCount:o.length,componentCount:0},e[a].componentCount++,Go(t,i.updateSpec((r=o[i.getSpecIndex()])!==null&&r!==void 0?r:{},o))):Go(t,i.updateSpec(o))});for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach(e=>{const i=this._spec.series[e.getSpecIndex()];Go(t,e.updateSpec(i))}):t.reMake=!0}getCanvas(){var t,e;return(e=(t=this.getCompiler())===null||t===void 0?void 0:t.getCanvas())!==null&&e!==void 0?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:r,y2:a}=t;e={width:r-i,height:a-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=$D(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(bt.layoutRectUpdate,{})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this._regions.forEach(t=>t.reInit(t.getSpecInfo().spec)),this._series.forEach(t=>t.reInit(t.getSpecInfo().spec)),this._components.forEach(t=>t.reInit(t.getSpecInfo().spec))}clear(){this.getAllModels().forEach(t=>{var e;return(e=t.clear)===null||e===void 0?void 0:e.call(t)})}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach(t=>{var e;(e=t.afterCompile)===null||e===void 0||e.call(t)}),this.getAllSeries().forEach(t=>{var e;(e=t.afterCompile)===null||e===void 0||e.call(t)}),this.getAllComponents().forEach(t=>{var e;(e=t.afterCompile)===null||e===void 0||e.call(t)})}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),(t=this._backgroundMark.getProduct())===null||t===void 0||t.configure({context:{model:this}}).layout(()=>{}))}compileRegions(){var t,e,i,n;(e=(t=this._option.performanceHook)===null||t===void 0?void 0:t.beforeRegionCompile)===null||e===void 0||e.call(t),this.getAllRegions().forEach(r=>{r.compile()}),(n=(i=this._option.performanceHook)===null||i===void 0?void 0:i.afterRegionCompile)===null||n===void 0||n.call(i)}compileSeries(){var t,e,i,n;(e=(t=this._option.performanceHook)===null||t===void 0?void 0:t.beforeSeriesCompile)===null||e===void 0||e.call(t),this.getAllSeries().forEach(r=>{r.compile()}),(n=(i=this._option.performanceHook)===null||i===void 0?void 0:i.afterSeriesCompile)===null||n===void 0||n.call(i)}compileComponents(){var t,e,i,n;(e=(t=this._option.performanceHook)===null||t===void 0?void 0:t.beforeComponentCompile)===null||e===void 0||e.call(t),this.getAllComponents().forEach(r=>{r.compile()}),(n=(i=this._option.performanceHook)===null||i===void 0?void 0:i.afterComponentCompile)===null||n===void 0||n.call(i)}release(){[...this._components,...this._regions,...this._series].forEach(t=>{t.beforeRelease()}),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach(t=>{t.release()}),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(ft(t[n]))continue;const r=t[n];let a={stateValue:n};a=q(r.filter)?Object.assign({filter:r.filter},a):Object.assign(Object.assign({},r.filter),a),r.level&&(a.level=r.level),i.forEach(o=>{o.getMarks().forEach(l=>{l.stateStyle[n]&&(e&&!e(o,l,n)||(l.state.changeStateInfo(a),l.updateMarkState(n)))})})}}setSelected(t,e,i){this._setStateInDatum(mt.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(mt.STATE_HOVER,!0,t,e,i)}_initEvent(){[bt.dataZoomChange,bt.scrollBarChange].forEach(t=>{this._event.on(t,({value:e})=>{if(!e.filterData)return;this._disableMarkAnimation(["exit","update"]);const i=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(ut.AFTER_MARK_RENDER_END,i)};this._event.on(ut.AFTER_MARK_RENDER_END,i)})})}_enableMarkAnimation(t){this.getAllMarks().forEach(e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)})}_disableMarkAnimation(t){this.getAllMarks().forEach(e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)})}_setStateInDatum(t,e,i,n,r){const a=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(r).forEach(o=>{i?(o.getSeries().forEach(l=>{l.getMarks().forEach(h=>{if(h.getProduct()&&(!n||q(n)&&n(l,h))){const d=h.getProduct().isCollectionMark(),u=h.getProduct().elements;let c=u;if(d)c=u.filter(p=>{const g=p.getDatum();i.every((f,_)=>a.every(m=>f[m]==g[_][m]))});else if(i.length>1){const p=i.slice();c=u.filter(g=>{if(p.length===0)return!1;const f=g.getDatum(),_=p.findIndex(m=>a.every(v=>m[v]==f[v]));return _>=0&&(p.splice(_,1),!0)})}else{const p=u.find(g=>a.every(f=>i[0][f]==g.getDatum()[f]));p&&(c=[p])}c.forEach(p=>{o.interaction.addEventElement(t,p)})}})}),e&&o.interaction.reverseEventElement(t)):o.interaction.clearEventElement(t,!0)})}setDimensionIndex(t,e){var i,n,r,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach(h=>{const{eventType:d,event:u}=h;if(d===kr.dimensionHover||d===kr.dimensionClick){const c=u.dispatch(t,e);c!=null&&c.length&&(o=c)}});const l=C(t)||!o||o.every(h=>Pi(h.axis.getScale().type)&&C(h.index));if(e.tooltip!==!1){const h=this._components.find(d=>d.type===J.tooltip);if(h!=null&&h.getVisible())if(l)(n=(i=h).hideTooltip)===null||n===void 0||n.call(i);else{const d={};o.forEach(u=>{const{axis:c,value:p,data:g}=u,f=c.getOrient()==="left"||c.getOrient()==="right";g.forEach(_=>{f?d[_.series.fieldY[0]]=p:d[_.series.fieldX[0]]=p})}),h.showTooltip(d,e.showTooltipOption)}}if(e.crosshair!==!1){const h=this._components.find(d=>d.type===J.cartesianCrosshair);h&&h.clearAxisValue&&h.setAxisValue&&(l?((r=h.clearAxisValue)===null||r===void 0||r.call(h),(a=h.hide)===null||a===void 0||a.call(h)):o.forEach(d=>{const{axis:u,value:c}=d;h.clearAxisValue(),h.setAxisValue(c,u),h.layoutByValue()}))}}getColorScheme(){var t,e;return(e=(t=this._option).getTheme)===null||e===void 0?void 0:e.call(t).colorScheme}};class sn{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&t.region.length!==0||(t.region=[{}]),Gs(t,"tooltip")||(t.tooltip={}),E(t.stackInverse)&&t.region.forEach(e=>!E(e.stackInverse)&&(e.stackInverse=t.stackInverse))}transformModelSpec(t){return this.createSpecInfo(t,(e,i,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=i,h=new e.transformerConstructor({type:l,getTheme:this._option.getTheme}).transformSpec(r,t,n);Rp(t,a,h.spec),Rp(n,o??a,Object.assign(Object.assign({},i),h))})}createSpecInfo(t,e){var i;e||(e=(a,o,l)=>{const{spec:h,specPath:d,specInfoPath:u,type:c}=o,p=new a.transformerConstructor({type:c,getTheme:this._option.getTheme});Rp(l,u??d,Object.assign(Object.assign({},o),{theme:p.getTheme(h,t)}))});const n={};let r;return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),(i=n.series)===null||i===void 0||i.forEach(({spec:{regionId:a,regionIndex:o}},l)=>{var h,d,u;E(a)?r=(h=n.region)===null||h===void 0?void 0:h.find(({spec:c})=>c.id===a):E(o)&&(r=(d=n.region)===null||d===void 0?void 0:d[o]),(r||(r=(u=n.region)===null||u===void 0?void 0:u[0]))&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(l))}),this.forEachComponentInSpec(t,e,n),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,n,r;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:(e=t.animation)!==null&&e!==void 0?e:this._option.animation,animationThreshold:(i=t.animationThreshold)!==null&&i!==void 0?i:(r=(n=this._option).getTheme)===null||r===void 0?void 0:r.call(n).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph}}forEachRegionInSpec(t,e,i){var n;return((n=t.region)!==null&&n!==void 0?n:[]).map((r,a)=>e(I.getRegionInType("region"),{spec:r,specIndex:a,specPath:["region",a],type:"region"},i))}forEachSeriesInSpec(t,e,i){var n;return((n=t.series)!==null&&n!==void 0?n:[]).map((r,a)=>e(I.getSeriesInType(r.type),{spec:r,specIndex:a,specPath:["series",a],type:r.type},i))}forEachComponentInSpec(t,e,i){var n,r,a,o;const l=[],h=I.getComponents();let d,u,c,p,g;const f=[];for(let m=0;m<h.length;m++){const{cmp:v,alwaysCheck:y}=h[m];v.type.startsWith(J.cartesianAxis)?d=v:v.type.startsWith(J.polarAxis)?u=v:v.type===J.geoCoordinate?c=v:(y||t[(n=v.specKey)!==null&&n!==void 0?n:v.type])&&(v.type===J.label?p=v:v.type===J.totalLabel&&(g=v),f.push(v))}let _=!1;if(d){const m=d.getSpecInfo(t);(m==null?void 0:m.length)>0&&(_=!0,m.forEach(v=>{const y=I.getComponentInKey(v.type);l.push(e(y,v,i))}))}if(u&&!_){const m=u.getSpecInfo(t);(m==null?void 0:m.length)>0&&(_=!0,m.forEach(v=>{const y=I.getComponentInKey(v.type);l.push(e(y,v,i))}))}return c&&!_&&((r=c.getSpecInfo(t))===null||r===void 0||r.forEach(m=>{l.push(e(c,m,i))})),p&&i&&((a=p.getSpecInfo(t,i))===null||a===void 0||a.forEach(m=>{l.push(e(p,m,i))})),g&&i&&((o=g.getSpecInfo(t,i))===null||o===void 0||o.forEach(m=>{l.push(e(g,m,i))})),f.forEach(m=>{var v;(v=m.getSpecInfo(t))===null||v===void 0||v.forEach(y=>{l.push(e(m,y,i))})}),l}}class wn extends sn{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={x:!1,y:!1,z:!1};t.axes.forEach(n=>{const{orient:r}=n;r!=="top"&&r!=="bottom"||(i.x=!0),r!=="left"&&r!=="right"||(i.y=!0),r==="z"&&(i.z=!0),Et(n,"trimPadding")&&_t(n,pL(this.type,t))}),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})}const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class OL extends wn{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:(e=t.seriesMark)!==null&&e!==void 0?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),La(t)}}class ol extends xe{constructor(){super(...arguments),this.transformerConstructor=OL,this.type="line",this.seriesType=j.line,this._canStack=!0}}ol.type="line",ol.seriesType=j.line,ol.view="singleDefault",ol.transformerConstructor=OL;const DZ=()=>{PZ(),I.registerChart(ol.type,ol)};class Pu extends EL{constructor(){super(...arguments),this.type=Pu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}Pu.type="area";const uS=()=>{I.registerMark(Pu.type,Pu),T7(),kL()};class LZ extends hs{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,r,a,o;for(const l of Y(e)){let h=(n=this.series.getSeriesStyle(t))===null||n===void 0?void 0:n(l);if(h!==!1||l!=="fill"&&l!=="stroke"||(h=l==="fill"?(a=(r=this.series.getSeriesStyle(t))===null||r===void 0?void 0:r("stroke"))===null||a===void 0?void 0:a[0]:(o=this.series.getSeriesStyle(t))===null||o===void 0?void 0:o("fill")),E(h))return h}return i}}}const BZ={type:"clipIn"},IZ=s=>({type:s.direction==="horizontal"?"growPointsXIn":"growPointsYIn",options:{orient:s.direction==="horizontal"?"positive":"negative"}}),FZ={type:"fadeIn"};function jZ(s,t){if(t===!1)return{};switch(t){case"grow":return IZ(s);case"fadeIn":return FZ;default:return BZ}}const zZ=()=>{I.registerAnimation("area",(s,t)=>({appear:jZ(s,t),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}})),SL(),ym()};class DL extends yc{_transformLabelSpec(t){var e,i,n;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0),((e=t.point)===null||e===void 0?void 0:e.visible)!==!1&&((n=(i=t.point)===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.visible)!==!1||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var n,r,a,o,l;super._transformSpecAfterMergingTheme(t,e,i);const{area:h={},line:d={},seriesMark:u="area"}=t,c=h.visible!==!1&&((n=h.style)===null||n===void 0?void 0:n.visible)!==!1,p=d.visible!==!1&&((r=d.style)===null||r===void 0?void 0:r.visible)!==!1;h.interactive=!(!h.interactive&&(a=d.interactive)!==null&&a!==void 0&&!a),h.support3d=!(!h.support3d&&!d.support3d),h.zIndex=E(h.zIndex)||E(d.zIndex)?Math.max((o=h.zIndex)!==null&&o!==void 0?o:0,(l=d.zIndex)!==null&&l!==void 0?l:0):void 0,h.style&&delete h.style.stroke,h.state&&Object.keys(h.state).forEach(_=>{"style"in h.state[_]?delete h.state[_].style.stroke:delete h.state[_].stroke});let g=h,f=d;(u==="line"||p&&!c)&&(g=d,f=h),h.style=_t({},f.style,g.style),h.state=_t({},f.state,g.state),c||(h.style.fill=!1),p||(h.style.stroke=!1),h.visible=!(!c&&!p),t.area=h,t.line=d}}class gr extends en{constructor(){super(...arguments),this.type=j.area,this.transformerConstructor=DL,this._supportStack=!0,this._sortDataByAxis=!1}initMark(){var t,e,i,n,r;const a={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},o=((t=this._spec.area)===null||t===void 0?void 0:t.visible)!==!1&&((i=(e=this._spec.area)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.visible)!==!1,l=(n=this._spec.seriesMark)!==null&&n!==void 0?n:"area";this._areaMark=this._createMark(gr.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:a,isSeriesMark:o&&l!=="point",customShape:(r=this._spec.area)===null||r===void 0?void 0:r.customShape}),this.initSymbolMark(a,l==="point")}initMarkStyle(){var t,e,i,n,r;const a=(i=(e=(t=this.getSpec().area)===null||t===void 0?void 0:t.style)===null||e===void 0?void 0:e.curveType)!==null&&i!==void 0?i:(r=(n=this.getSpec().line)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.curveType,o=a===lS?this._direction==="vertical"?"monotoneX":"monotoneY":a,l=this._areaMark;l&&(this._direction==="vertical"?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:h=>{var d,u;return Qt(this.dataToPositionY1(h),(u=(d=this._yAxisHelper)===null||d===void 0?void 0:d.getScale)===null||u===void 0?void 0:u.call(d,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",Q.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:h=>{var d,u;return Qt(this.dataToPositionX1(h),(u=(d=this._xAxisHelper)===null||d===void 0?void 0:d.getScale)===null||u===void 0?void 0:u.call(d,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",Q.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",Q.Series),this._invalidType!=="zero"&&this.setMarkStyle(l,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",Q.Series),this.setMarkStyle(l,{curveType:o},"normal",Q.Built_In),this._trigger.registerMark(l),Object.keys(l.stateStyle).forEach(h=>{l.stateStyle[h].stroke&&l.setPostProcess("stroke",d=>[d,!1,!1,!1],h)})),this.initLineMarkStyle(this._direction,a),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const r={direction:this.direction},a=(t=this._spec.animationAppear)===null||t===void 0?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Ft((e=I.getAnimationInKey("line"))===null||e===void 0?void 0:e(r,a),Ut("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Ft((i=I.getAnimationInKey("area"))===null||i===void 0?void 0:i(r,a),Ut("area",this._spec,this._markAttributeContext))),this._symbolMark){const o=Ba(this);this._symbolMark.setAnimationConfig(Ft((n=I.getAnimationInKey("scaleInOut"))===null||n===void 0?void 0:n(),Ut("point",this._spec,this._markAttributeContext),o))}}initTooltip(){this._tooltipHelper=new LZ(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark),this._lineMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,n,r,a,o;const l=(i=this._spec.seriesMark)!==null&&i!==void 0?i:"area";let h=(r=(n=this._seriesMark)===null||n===void 0?void 0:n.getAttribute(e,t))!==null&&r!==void 0?r:void 0;return e!=="fill"||h&&l!=="line"||(e="stroke",h=(o=(a=this._seriesMark)===null||a===void 0?void 0:a.getAttribute(e,t))!==null&&o!==void 0?o:void 0),e==="stroke"&&U(h)?h[0]:h}}}gr.type=j.area,gr.mark=Kx,gr.transformerConstructor=DL,ci(gr,hS);const HZ=()=>{$x(),Yx(),dS(),uS(),Ia(),zZ(),I.registerSeries(gr.type,gr)};class LL extends wn{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:(e=t.seriesMark)!==null&&e!==void 0?e:"area",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),La(t)}}class ll extends xe{constructor(){super(...arguments),this.transformerConstructor=LL,this.type="area",this.seriesType=j.area,this._canStack=!0}}ll.type="area",ll.seriesType=j.area,ll.view="singleDefault",ll.transformerConstructor=LL;const GZ=()=>{HZ(),I.registerChart(ll.type,ll)};function BL(s,t=!0){return(e,i,n)=>{const r=s.direction==="vertical"?s.yField:s.xField,a=e==null?void 0:e[r];return s.direction==="vertical"?{overall:t&&s.growFrom(),orient:a>0?"negative":"positive"}:{overall:!!t&&s.growFrom(),orient:a>0?"positive":"negative"}}}const bc=(s,t=!0)=>({type:s.direction==="horizontal"?"growWidthIn":"growHeightIn",options:BL(s,t)}),ph=(s,t=!0)=>({type:s.direction==="horizontal"?"growWidthOut":"growHeightOut",options:BL(s,t)}),WZ={type:"fadeIn"},NZ={type:"growCenterIn"};function IL(s,t){if(t===!1)return{};switch(t){case"fadeIn":return WZ;case"scaleIn":return NZ;default:return bc(s)}}const VZ=()=>{I.registerAnimation("bar",(s,t)=>({appear:IL(s,t),enter:bc(s,!1),exit:ph(s,!1),disappear:ph(s)}))},UZ=()=>{I.registerAnimation("bar3d",(s,t)=>({appear:IL(s,t),enter:bc(s,!1),exit:ph(s,!1),disappear:ph(s)}))};class Eu extends Ri{constructor(){super(...arguments),this.type=Eu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}Eu.type="rect";const Fa=()=>{I.registerMark(Eu.type,Eu),Vx(),AL()};function FL(s,t,e){if(s.values.length>0){let i,n=s.series;t&&(n=n.slice().reverse()),n.forEach(({s:r,values:a},o)=>{var l,h;const d=r.getSpec().barMinHeight,u=(h=(l=r[e.axisHelper]).getScale)===null||h===void 0?void 0:h.call(l,0),c=r[e.axisHelper].isInverse();for(let p=0;p<a.length;p++){const g=a[t?a.length-1-p:p],f=Qt(r[e.startMethod](g),u);let _=Qt(r[e.endMethod](g),u);p===0&&o===0&&(i=f);let m=Math.abs(f-_);m<d&&(m=d);let v=1;_<f?v=-1:_===f&&(v=e.isVertical?c?1:-1:c?-1:1),_=i+v*m,g[e.start]=i,g[e.end]=_,i=_}})}for(const i in s.nodes)FL(s.nodes[i],t,e)}class xm extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar")}}class yn extends en{constructor(){super(...arguments),this.type=j.bar,this._barMarkName="bar",this._barMarkType="rect",this.transformerConstructor=xm,this._supportStack=!0,this._bandPosition=0}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._initBarBackgroundMark(e),this._barMark=this._createMark(Object.assign(Object.assign({},yn.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:Er(this._spec,this._barMarkName),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,progressive:e,customShape:(t=this._spec.bar)===null||t===void 0?void 0:t.customShape})}_initBarBackgroundMark(t){var e,i;!((e=this._spec.barBackground)===null||e===void 0)&&e.visible&&(this._barBackgroundMark=this._createMark(yn.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),progressive:t,customShape:(i=this._spec.barBackground)===null||i===void 0?void 0:i.customShape}))}initMarkStyle(){this._barMark&&(this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",Q.Series),this._trigger.registerMark(this._barMark))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:e=>e[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip(),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark)}_statisticViewData(){var t,e;if(super._statisticViewData(),!(!((t=this._spec.barBackground)===null||t===void 0)&&t.visible))return;Mt(this._option.dataSet,"addVChartProperty",Dh),Mt(this._option.dataSet,"dimensionItems",([n],r)=>{var a;let o=[{}];const l=this.getDimensionField();for(let h=0;h<l.length;h++){const d=l[h],u=(a=n.latestData[d])===null||a===void 0?void 0:a.values;if(!(u!=null&&u.length))continue;const c=[];for(let p=0;p<u.length;p++)for(let g=0;g<o.length;g++)c.push(Object.assign(Object.assign({},o[g]),{[d]:u[p]}));o=c}return o});const i=new Zt(this._option.dataSet).parse([this._viewDataStatistics],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:Tu.bind(this),call:ch}},!1);(e=this._viewDataStatistics)===null||e===void 0||e.target.addListener("change",i.reRunAllTransform),this._barBackgroundViewData=new Yn(this._option,i)}init(t){var e,i;super.init(t),this.direction==="vertical"?((e=this._xAxisHelper)===null||e===void 0?void 0:e.getScale(0).type)==="band"?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():((i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale(0).type)==="band"?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this._stack&&t.getSeries().filter(e=>e.type===this.type&&e.getSpec().barMinHeight).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,n,r,a,o;e._bar_series_position_calculated=!0,t?(i=Lv,n=Dv,r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(i=Ov,n=Rv,r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=JD(e,!1,h=>h.type===this.type);for(const h in l)for(const d in l[h].nodes)FL(l[h].nodes[d],e.getStackInverse(),{isVertical:t,start:i,end:n,startMethod:r,endMethod:a,axisHelper:o})}_calculateRectPosition(t,e){var i,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=(n=(i=this[o]).getScale)===null||n===void 0?void 0:n.call(i,0),h=this[o].isInverse(),d=this._spec.barMinHeight,u=Qt(this[r](t),l),c=Qt(this[a](t),l);let p=Math.abs(u-c);p<d&&(p=d);let g=1;return c<u?g=-1:c===u&&(g=e?h?1:-1:h?-1:1),u+g*p}_dataToPosX(t){return this.dataToPositionX(t)}_dataToPosX1(t){return this.dataToPositionX1(t)}_dataToPosY(t){return this.dataToPositionY(t)}_dataToPosY1(t){return this.dataToPositionY1(t)}initBandRectMarkStyle(){var t,e,i,n;const r=(e=(t=this._xAxisHelper)===null||t===void 0?void 0:t.getScale)===null||e===void 0?void 0:e.call(t,0),a=(n=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||n===void 0?void 0:n.call(i,0);this.direction==="horizontal"?this.setMarkStyle(this._barMark,{x:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[Rv]):this._spec.barMinHeight?this._calculateRectPosition(o,!1):Qt(this._dataToPosX(o),r),x1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[Ov]):Qt(this._dataToPosX1(o),r),y:o=>this._getPosition(this.direction,o),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",Q.Series):this.setMarkStyle(this._barMark,{x:o=>this._getPosition(this.direction,o),y:(o,l,h,d)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[Dv]):this._spec.barMinHeight?this._calculateRectPosition(o,!0):Qt(this._dataToPosY(o),a),y1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[Lv]):Qt(this._dataToPosY1(o),a),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",Q.Series),this._initBarBackgroundMarkStyle()}_initBarBackgroundMarkStyle(){var t,e,i,n;if(!this._barBackgroundMark)return;const r=(e=(t=this._xAxisHelper)===null||t===void 0?void 0:t.getScale)===null||e===void 0?void 0:e.call(t,0),a=(n=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||n===void 0?void 0:n.call(i,0);this.direction==="horizontal"?this.setMarkStyle(this._barBackgroundMark,{x:()=>{const o=r.range();return Math.min(o[0],o[o.length-1])},x1:()=>{const o=r.range();return Math.max(o[0],o[o.length-1])},y:o=>this._getPosition(this.direction,o),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",Q.Series):this.setMarkStyle(this._barBackgroundMark,{x:o=>this._getPosition(this.direction,o),y:()=>{const o=a.range();return Math.min(o[0],o[o.length-1])},y1:()=>{const o=a.range();return Math.max(o[0],o[o.length-1])},width:()=>this._getBarWidth(this._xAxisHelper)},"normal",Q.Series)}initLinearRectMarkStyle(){var t,e,i,n;const r=(e=(t=this._xAxisHelper)===null||t===void 0?void 0:t.getScale)===null||e===void 0?void 0:e.call(t,0),a=(n=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||n===void 0?void 0:n.call(i,0);this.direction==="vertical"?this.setMarkStyle(this._barMark,{x:o=>Qt(this.dataToPositionX(o),r),x1:o=>Qt(this.dataToPositionX1(o),r),y:(o,l,h,d)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[Dv]):this._spec.barMinHeight?this._calculateRectPosition(o,!0):Qt(this.dataToPositionY(o),a),y1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),o[Lv]):Qt(this.dataToPositionY1(o),a)},"normal",Q.Series):this.setMarkStyle(this._barMark,{x:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[Rv]):this._spec.barMinHeight?this._calculateRectPosition(o,!1):Qt(this.dataToPositionX(o),r),x1:o=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),o[Ov]):Qt(this.dataToPositionX1(o),r),y:o=>Qt(this.dataToPositionY(o),a),y1:o=>Qt(this.dataToPositionY1(o),a)},"normal",Q.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var a,o;return this.direction==="horizontal"?(a=this._xAxisHelper)===null||a===void 0?void 0:a.getScale(0).scale(0):(o=this._yAxisHelper)===null||o===void 0?void 0:o.getScale(0).scale(0)}},n=(t=this._spec.animationAppear)===null||t===void 0?void 0:t.preset,r=Ba(this);this._barMark.setAnimationConfig(Ft((e=I.getAnimationInKey("bar"))===null||e===void 0?void 0:e(i,n),Ut(this._barMarkName,this._spec,this._markAttributeContext),r))}_getBarWidth(t){var e,i;const n=this._spec.barWidth!==void 0,r=(i=(e=t.getBandwidth)===null||e===void 0?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))!==null&&i!==void 0?i:6;if(n)return rl(this._spec.barWidth,r);const a=this._spec.barMinWidth!==void 0,o=this._spec.barMaxWidth!==void 0;let l=r;return a&&(l=Math.max(l,rl(this._spec.barMinWidth,r))),o&&(l=Math.min(l,rl(this._spec.barMaxWidth,r))),l}_getPosition(t,e){var i,n,r,a,o,l,h,d,u;let c,p,g;t==="horizontal"?(c=this.getYAxisHelper(),p="height",g=this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),p="width",g=this.dataToPositionX.bind(this));const f=c.getScale(0),_=this._barMark.getAttribute(p,e),m=(n=(i=c.getBandwidth)===null||i===void 0?void 0:i.call(c,this._groups?this._groups.fields.length-1:0))!==null&&n!==void 0?n:6;if(((a=(r=this._groups)===null||r===void 0?void 0:r.fields)===null||a===void 0?void 0:a.length)>1&&E(this._spec.barGapInGroup)){const y=this._groups.fields,b=Y(this._spec.barGapInGroup);let x=0,S=0;for(let A=y.length-1;A>=1;A--){const k=y[A],w=(d=(h=(l=(o=this.getViewDataStatistics())===null||o===void 0?void 0:o.latestData)===null||l===void 0?void 0:l[k])===null||h===void 0?void 0:h.values)!==null&&d!==void 0?d:[],T=w.length,M=rl((u=b[A-1])!==null&&u!==void 0?u:la(b),m),P=w.indexOf(e[k]);A===y.length-1?(x+=T*_+(T-1)*M,S+=P*(_+M)):(S+=P*(x+M),x+=x+(T-1)*M)}return f.scale(e[y[0]])+c.getBandwidth(0)/2-x/2+S}const v=Kt(f.type||"band");return g(e)+.5*(m-_)+(v?-m/2:0)}onLayoutEnd(t){super.onLayoutEnd(t),this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],n=this._fieldY,r=this._fieldX;i.push({type:"sampling",size:this._direction==="vertical"?t:e,factor:this._spec.samplingFactor,yfield:this._direction==="vertical"?n[0]:r[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),(t=this._barBackgroundViewData)===null||t===void 0||t.compile()}fillData(){var t,e;super.fillData(),(e=(t=this._barBackgroundViewData)===null||t===void 0?void 0:t.getDataView())===null||e===void 0||e.reRunAllTransform()}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),(i=(e=this._barBackgroundViewData)===null||e===void 0?void 0:e.getDataView())===null||i===void 0||i.reRunAllTransform(),(n=this._barBackgroundViewData)===null||n===void 0||n.updateData()}release(){var t;super.release(),(t=this._barBackgroundViewData)===null||t===void 0||t.release(),this._barBackgroundViewData=null}}yn.type=j.bar,yn.mark=um,yn.transformerConstructor=xm;const jL=()=>{$x(),Fa(),VZ(),I.registerSeries(yn.type,yn)};class Sm extends wn{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground})}transformSpec(t){super.transformSpec(t),La(t)}}class sa extends xe{constructor(){super(...arguments),this.transformerConstructor=Sm,this.type="bar",this.seriesType=j.bar,this._canStack=!0}}sa.type="bar",sa.seriesType=j.bar,sa.view="singleDefault",sa.transformerConstructor=Sm;const $Z=()=>{jL(),I.registerChart(sa.type,sa)};class Ru extends Ri{constructor(){super(...arguments),this.type=Ru.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}Ru.type="rect3d";const zL=()=>{I.registerMark(Ru.type,Ru),E7(),AL()};class Hf extends yn{constructor(){super(...arguments),this.type=j.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}Hf.type=j.bar3d,Hf.mark=Xx;const HL=()=>{UZ(),zL(),I.registerSeries(Hf.type,Hf)};class GL extends Sm{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class hl extends sa{constructor(){super(...arguments),this.transformerConstructor=GL,this.type="bar3d",this.seriesType=j.bar3d}}hl.type="bar3d",hl.seriesType=j.bar3d,hl.view="singleDefault",hl.transformerConstructor=GL;const YZ=()=>{HL(),I.registerChart(hl.type,hl)},_M=10,XZ=[10,20],KZ=Le.Linear,mM="circle",qZ=Le.Ordinal,ZZ=["circle","square","triangle","diamond","star"],JZ=(s,t)=>t==="fadeIn"?{type:"fadeIn"}:{type:"scaleIn"},QZ=()=>{I.registerAnimation("scatter",(s,t)=>Object.assign({appear:JZ(0,t)},rS))};class WL extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class ua extends en{constructor(){super(...arguments),this.type=j.scatter,this.transformerConstructor=WL,this._invalidType="zero"}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},r){var a,o,l,h;if(q(e))return e;if(U(e)){if(C(t))return(a=this._option)===null||a===void 0||a.onError(`${r}Field is required.`),e;if(i!=="ordinal"&&e.length>2)return(o=this._option)===null||o===void 0||o.onError(`${r} length is invalid, specify up to 2 ${r}s.`),e;const d=`${xt}_series_scatter_${this.id}_scale_${r}`;return this._option.globalScale.registerModelScale({id:d,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:d,field:t}}if(Vt(e)){if(C(t))return(l=this._option)===null||l===void 0||l.onError(`${r}Field is required.`),e;const d=`${xt}_series_scatter_${this.id}_scale_${r}`,u=Object.assign({id:d,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n},e);return this._option.globalScale.registerModelScale(u),{scale:u.id,field:t}}return(h=this._option)===null||h===void 0||h.onError(`${r} attribute is invalid.`),e}getSizeAttribute(t,e){return C(e)?_M:lt(e)?e:ot(e)&&D2(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:KZ,defaultRange:XZ},"size")}getShapeAttribute(t,e){return C(e)?mM:ot(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:qZ,defaultRange:ZZ},"shape")}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(ua.mark.point,{morph:Er(this._spec,ua.mark.point.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,progressive:e,isSeriesMark:!0,customShape:(t=this._spec.point)===null||t===void 0?void 0:t.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const n=Ba(this),r=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this._symbolMark.setAnimationConfig(Ft((i=I.getAnimationInKey("scatter"))===null||i===void 0?void 0:i({},r),Ut("point",this._spec,this._markAttributeContext),n))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this._invalidType!=="zero"&&this.setMarkStyle(t,{visible:this._getInvalidDefined}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:lt(this._size)||q(this._size)?this._size:_M,symbolType:ot(this._shape)||q(this._shape)?this._shape:mM},mt.STATE_NORMAL,Q.Series),(E(this._sizeField)||E(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},mt.STATE_NORMAL,Q.User_Mark),(E(this._shapeField)||E(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},mt.STATE_NORMAL,Q.User_Mark),this._trigger.registerMark(t))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every(i=>{var n,r,a;return i&&((a=(r=(n=this.getViewDataStatistics())===null||n===void 0?void 0:n.latestData)===null||r===void 0?void 0:r[i])===null||a===void 0?void 0:a.allValid)});this._invalidType==="zero"||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",Q.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",Q.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:e=>e[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},mt.STATE_NORMAL,Q.Series),this._invalidType!=="zero"&&this.setMarkStyle(t,{visible:this._getInvalidDefined},mt.STATE_NORMAL,Q.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach(r=>{const a=r.getProduct();!a||!a.elements||!a.elements.length||a.elements.forEach((o,l)=>{const h=o.getGraphicItem(),d=o.getDatum(),u=this.dataToPosition(d);u&&h&&h.translateTo(u.x,u.y)})});const n=(i=(e=this._labelMark)===null||e===void 0?void 0:e.getComponent())===null||i===void 0?void 0:i.getProduct();n&&n.evaluateSync(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach(r=>{const a=r.getProduct();!a||!a.elements||!a.elements.length||a.elements.forEach((o,l)=>{const h=o.getGraphicItem(),d=o.getDatum(),u=this.dataToPosition(d);u&&h&&h.translateTo(u.x,u.y)})});const n=(i=(e=this._labelMark)===null||e===void 0?void 0:e.getComponent())===null||i===void 0?void 0:i.getProduct();n&&n.evaluateSync(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}ua.type=j.scatter,ua.mark=yD,ua.transformerConstructor=WL;const tJ=()=>{Ia(),QZ(),I.registerSeries(ua.type,ua)};class NL extends wn{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class dl extends xe{constructor(){super(...arguments),this.transformerConstructor=NL,this.type="scatter",this.seriesType=j.scatter,this._canStack=!0}}dl.type="scatter",dl.seriesType=j.scatter,dl.view="singleDefault",dl.transformerConstructor=NL;const eJ=()=>{tJ(),I.registerChart(dl.type,dl)};Db();const vM={},cS=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function iJ(s,t){return function e(){const i=t();return i.type=s,i.path=Db().projection(i),i.copy=i.copy||function(){const n=e();return cS.forEach(r=>{i[r]&&n[r](i[r]())}),n.path.pointRadius(i.path.pointRadius()),n},i}}function Ur(s,t){s&&ot(s)||Ja("Projection type must be a name string.");const e=s.toLowerCase();return arguments.length>1&&(vM[e]=iJ(e,t)),vM[e]||null}const yM={albers:EP,albersusa:sj,azimuthalequalarea:nj,azimuthalequidistant:rj,conicconformal:lj,conicequalarea:tg,conicequidistant:uj,equalEarth:pj,equirectangular:hj,gnomonic:gj,identity:fj,mercator:aj,naturalEarth1:_j,orthographic:mj,stereographic:vj,transversemercator:yj};Object.keys(yM).forEach(s=>{Ur(s,yM[s])});const bM="Feature",VL="FeatureCollection";function sJ(s){return s.type===VL?s.features:Y(s).filter(t=>!C(t)).map(t=>t.type===bM?t:{type:bM,geometry:t})}function nJ(s){const t=Y(s);return t.length===1?t[0]:{type:VL,features:t.reduce((e,i)=>e.concat(sJ(i)),[])}}function rJ(s){const t=Ur((s||"mercator").toLowerCase());return t||Ja("Unrecognized projection type: "+s),t()}function aJ(s,t,e){q(s[t])&&s[t](e)}const oJ=cS.concat(["pointRadius","fit","extent","size"]);function xM(s,t){let e=[];return s&&Object.keys(s).forEach(i=>{oJ.includes(i)&&(e=e.concat(Hi(s[i],t)))}),e}let lJ=class extends om{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return C(this.spec.pointRadius)||this.detach(Hi(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(Hi(t,this.view)),this.commit(),this}size(t){return C(this.spec.size)||this.detach(Hi(this.spec.size,this.view)),this.spec.size=t,this.attach(Hi(t,this.view)),this.commit(),this}extent(t){return C(this.spec.extent)||this.detach(Hi(this.spec.extent,this.view)),this.spec.extent=t,this.attach(Hi(t,this.view)),this.commit(),this}fit(t){return C(this.spec.fit)||this.detach(Hi(this.spec.fit,this.view)),this.spec.fit=t,this.attach(Hi(t,this.view)),this.commit(),this}configure(t){return this.detach(xM(this.spec,this.view)),C(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(xM(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=rJ(this.spec.type),this.projection.type=this.spec.type),cS.forEach(i=>{C(this.spec[i])||aJ(this.projection,i,Be(this.spec[i],e,Ur))}),C(this.spec.pointRadius)||this.projection.path.pointRadius(Be(this.spec.pointRadius,e,Ur)),!(C(this.spec.fit)||C(this.spec.extent)&&C(this.spec.size))){const i=nJ(Be(this.spec.fit,e,Ur));this.spec.extent?this.projection.fitExtent(Be(this.spec.extent,e,Ur),i):this.spec.size&&this.projection.fitSize(Be(this.spec.size,e,Ur),i)}return this.projection}output(){return this.projection}};const hJ=()=>{st.registerGrammar("projection",lJ,"projections")},dJ=(s,t)=>{if(!t.from||!t.from())return s;const e=t.fields,i=t.key,n=t.values,r=t.default,a=t.as||[e],o=t.from().reduce(function(h,d){return d[e]&&h.set(d[e],d),h},new Map);let l;if(q(t.set))l=function(h){const d=o.get(h[i]);t.set(h,d)};else if(n){const h=n.length;l=function(d){const u=o.get(d[i]);if(C(u))for(let c=0;c<h;++c)d[a[c]]=r;else for(let c=0;c<h;++c)d[a[c]]=u[n[c]]}}else l=function(h){const d=o.get(h[i]);h[a[0]]=E(d)?d:r};return s.length===0?[]:s.map(h=>(l(h),h))};class uJ extends go{constructor(){super(...arguments),this.type=j.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return(t=this._mapViewData)===null||t===void 0?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t){var e;let i=null;if(!t)return i;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(i=this.nameToPosition(t),i===null){const o=a?t==null?void 0:t[a]:Number.NaN,l=r?t==null?void 0:t[r]:Number.NaN;i=(e=n==null?void 0:n([o,l]))!==null&&e!==void 0?e:null}return i}nameToPosition(t){var e,i;const n=this.getDatumName(t);if(C(n))return null;const r=(i=(e=this.getMapViewData())===null||e===void 0?void 0:e.latestData)===null||i===void 0?void 0:i.filter(h=>this.getDatumName(h)===n)[0];if(C(r))return null;const{dataToPosition:a}=this._coordinateHelper,o=this.getDatumCenter(r),l=a==null?void 0:a(o);return C(l)||isNaN(l.x)||isNaN(l.y)?null:l}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return(e=this._option)===null||e===void 0||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return(e=this._option)===null||e===void 0||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return(e=this._option)===null||e===void 0||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;(t=this._mapViewData)===null||t===void 0||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${xt}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,n,r;return this._seriesField?(r=(e=(t=this.getRawDataStatisticsByField(this._seriesField))===null||t===void 0?void 0:t.values)!==null&&e!==void 0?e:(n=(i=this._mapViewDataStatistics)===null||i===void 0?void 0:i.latestData[this._seriesField])===null||n===void 0?void 0:n.values)!==null&&r!==void 0?r:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),(t=this._mapViewData.getDataView())===null||t===void 0||t.reRunAllTransform(),(e=this._mapViewDataStatistics)===null||e===void 0||e.reRunAllTransform()}getActiveMarks(){return[]}}const Gf=`${xt}_MAP_LOOK_UP_KEY`,cJ=(s,t)=>(s.features&&s.features.forEach((e,i)=>{var n,r;e[ui]=i,t.nameMap?e[Gf]=t.nameMap[(n=e.properties)===null||n===void 0?void 0:n[t.nameProperty]]:e[Gf]=(r=e.properties)===null||r===void 0?void 0:r[t.nameProperty]}),s.features);class pJ extends hs{constructor(){super(...arguments),this.titleValueCallback=t=>{var e;const i=this.series;return(e=this._getDimensionData(t))!==null&&e!==void 0?e:i.getDatumName(t)}}}class Ou extends Ri{constructor(){super(...arguments),this.type=Ou.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}Ou.type="path";const UL=()=>{I.registerMark(Ou.type,Ou),XO()};class gJ{constructor(t){this.projection=Ur(t.type)()}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){var e,i;(i=(e=this.projection)===null||e===void 0?void 0:e.center)===null||i===void 0||i.call(e,t)}project(t){var e;return(e=this.projection)===null||e===void 0?void 0:e.call(this,t)}shape(t){var e,i;return(i=(e=this.projection)===null||e===void 0?void 0:e.path)===null||i===void 0?void 0:i.call(e,t)}invert(t){var e,i;return(i=(e=this.projection)===null||e===void 0?void 0:e.invert)===null||i===void 0?void 0:i.call(e,t)}scale(t){var e;if(!((e=this.projection)===null||e===void 0)&&e.scale){if(t===void 0)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(!((e=this.projection)===null||e===void 0)&&e.scale){if(t===void 0)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const n=this.projection.copy();return n==null?void 0:n.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class fJ extends TL{constructor(t){super(),this.component=t}}function is(s,t){return Et(t,`component.${s}`)}const _J={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mJ(s){return(s=gn(s)).startSymbol=gn(s.startSymbol),s.endSymbol=gn(s.endSymbol),s}function Du(s){let t=0;return Et(s,"tick.visible")&&(t+=Et(s,"tick.tickSize")),Et(s,"label.visible")&&(t+=Et(s,"label.space")),t}function Lu(s,t){var e,i,n,r,a,o;return{min:(n=(e=s.min)!==null&&e!==void 0?e:(i=s.range)===null||i===void 0?void 0:i.min)!==null&&n!==void 0?n:t==null?void 0:t.min,max:(o=(r=s.max)!==null&&r!==void 0?r:(a=s.range)===null||a===void 0?void 0:a.max)!==null&&o!==void 0?o:t==null?void 0:t.max}}function SM(s){const t=s==null?void 0:s.orient;return t==="top"||t==="bottom"||t==="left"||t==="right"||t==="z"}function AM(s){const t=s==null?void 0:s.orient;return t==="angle"||t==="radius"}const Xh=(s,t,e)=>{var i;const n=(i=t==="band"?is("axisBand",e):["linear","log","symlog"].includes(t)?is("axisLinear",e):{})!==null&&i!==void 0?i:{},r=Ce(s)?is("axisX",e):dr(s)?is("axisY",e):is("axisZ",e);return _t({},is("axis",e),n,r)},Fv=(s,t,e)=>{var i;const n=(i=t==="band"?is("axisBand",e):t==="linear"?is("axisLinear",e):{})!==null&&i!==void 0?i:{},r=is(s==="angle"?"axisAngle":"axisRadius",e);return _t({},is("axis",e),n,r)},$L=s=>s==="band"||s==="ordinal"||s==="point";function YL(s,t){const{x1:e,y1:i,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=s.AABBBounds,{dx:d=0,dy:u=0}=s.attribute;let c=0,p=0;a<e&&(c=e-a),o<i&&(p=i-o),l>n&&(c=n-l),h>r&&(p=r-h),c&&s.setAttribute("dx",c+d),p&&s.setAttribute("dy",p+u)}function kM(s,t,e,i){let n=0,r=s.length-1;for(;n<=r;){const a=Math.floor((n+r)/2),o=s[a];if(o[e]<=t&&o[i||e]>=t)return o;o[e]>t?r=a-1:n=a+1}return null}const vJ=(s,t)=>{var e,i;const n=Y((e=t.axes)!==null&&e!==void 0?e:[]),{bandField:r,linearField:a,xField:o,yField:l}=(i=is(J.crosshair,s))!==null&&i!==void 0?i:{},h=n.find(p=>Ce(p.orient));let d;d=E(h)?_t({},$L(h.type)?r:a,o):o;const u=n.find(p=>dr(p.orient));let c;return c=E(u)?_t({},Pi(u.type)?r:a,l):l,{xField:d,yField:c}},yJ=(s,t)=>{var e,i;const n=Y((e=t.axes)!==null&&e!==void 0?e:[]),{bandField:r,linearField:a,categoryField:o,valueField:l}=(i=is(J.crosshair,s))!==null&&i!==void 0?i:{},h=n.find(p=>p.orient==="angle");let d;d=E(h)?_t({},$L(h.type)?r:a,o):o;const u=n.find(p=>p.orient==="radius");let c;return c=E(u)?_t({},Pi(u.type)?r:a,l):l,{categoryField:d,valueField:c}},bJ=(s,t)=>{const{getNewDomain:e,isContinuous:i,field:n}=t,r=n(),a=e();if(C(a)||C(r))return s;if(a.length===0)return[];let o=null;return o=i()?l=>l[r]>=a[0]&&l[r]<=a[1]:l=>a.indexOf(l[r]+"")>=0||a.indexOf(l[r])>=0,s.filter(o)},xJ=(s,t)=>{const{stateFields:e,valueFields:i,dataCollection:n}=t.input,{stateField:r,valueField:a}=t.output,o={},l=[];return n.forEach((h,d)=>{var u;if(C(e[d]))return;const c=(u=h.getFields())===null||u===void 0?void 0:u[e[d]];c&&c.lockStatisticsByDomain&&c.domain.forEach(p=>{o[p]=0}),h.latestData.forEach(p=>{Y(e[d]).forEach(g=>{C(p[g])||(C(o[p[g]])&&(o[p[g]]=0),C(i[d])||(o[p[g]]+=isNaN(parseFloat(p[i[d]]))?1:parseFloat(p[i[d]])))})})}),Object.keys(o).forEach((h,d)=>{const u={[r]:h};a&&(u[a]=o[h]),l.push(u)}),l},SJ=(s,t,e)=>{const i=is(t,e),n=i[aL(s)],r=_t({},i,n);return delete r.horizontal,delete r.vertical,r};function XL(s){var t,e;const i=Object.assign({},s);return ft(s.style)||(i.textStyle=At(s.style)),ft(s.textStyle)||_t(i.textStyle,At(s.textStyle)),!((t=s.shape)===null||t===void 0)&&t.style&&At(i.shape.style),!((e=s.background)===null||e===void 0)&&e.style&&At(i.background.style),i}function AJ(s){return s.orient==="bottom"||s.orient==="top"?"horizontal":"vertical"}function kJ(s,t,e,i){switch(s){case J.cartesianBandAxis:return Xh(Gr(e,["z"]),"band",t);case J.cartesianLinearAxis:return Xh(Gr(e,["z"]),"linear",t);case J.cartesianLogAxis:return Xh(Gr(e,["z"]),"log",t);case J.cartesianSymlogAxis:return Xh(Gr(e,["z"]),"symlog",t);case J.cartesianAxis:case J.cartesianTimeAxis:return Xh(Gr(e),void 0,t);case J.polarBandAxis:return Fv(e.orient,"band",t);case J.polarLinearAxis:return Fv(e.orient,"linear",t);case J.polarAxis:return Fv(e.orient,void 0,t);case J.cartesianCrosshair:return vJ(t,i);case J.polarCrosshair:return yJ(t,i);case J.colorLegend:case J.sizeLegend:return is(`${s}.${AJ(e)}`,t);case J.dataZoom:case J.scrollBar:return SJ(Gr(e),s,t);default:return is(s,t)}}class xc extends fm{getTheme(t,e){return kJ(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:n}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:n}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:n}=t;i&&e&&n&&(t.padding=Object.assign(Object.assign({},Ar(e)),{[n]:0}))}}var wJ=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};class ds extends mL{static createComponent(t,e){const{spec:i}=t,n=wJ(t,["spec"]);return new this(i,Object.assign(Object.assign({},e),n))}getRegions(){return this._regions}created(){this.initLayout(),super.created(),this.pluginService=new fJ(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=xc,this._delegateEvent=(i,n,r,a=null,o=null)=>{var l,h;this.event.emit(r,{model:this,node:i,event:n,item:a,datum:o,source:Jt.chart,chart:(h=(l=this._option)===null||l===void 0?void 0:l.globalInstance)===null||h===void 0?void 0:h.getChart()},"model")},this._option.animation&&(this.animate=new _L({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=(t=this._regions)!==null&&t!==void 0?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map(e=>e==null?void 0:e.id))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach(e=>t(e))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}getContainer(){var t;return this._container||(this._container=(t=this._option)===null||t===void 0?void 0:t.globalInstance.getStage().find(e=>e.name==="root",!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some(n=>_e(e==null?void 0:e[n],t[n]))),(e==null?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){super.release(),this.clear()}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach(i=>{var n;i&&((n=this.getContainer())===null||n===void 0||n.removeChild(i),i=null)}),this._container=null,(t=this.pluginService)===null||t===void 0||t.disposeAll(),this.pluginService=null}compile(){this.compileMarks()}compileMarks(t){this.getMarks().forEach(e=>{var i;e.compile({group:t}),(i=e.getProduct())===null||i===void 0||i.configure({context:{model:this}})})}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}ds.transformerConstructor=xc;class TJ{parserScrollEvent(t){return t&&!(t.ctrlKey||t.deltaY===0&&t.deltaX===0)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t)}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class MJ{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!0)}parserZoomEvent(t){const e=t.scale;if(this._lastScale===0)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function sr(s){return s===Ze["desktop-browser"]||s===Ze["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:TJ}:Aa(s)||ka(s)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:MJ}:null}const Lo={debounce:Xn,throttle:Ea};class pS{constructor(){this._isGestureListener=!1}initZoomable(t,e=Ze["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=Aa(this._renderMode)||ka(this._renderMode),sr(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return sr(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o}=n;C(r)||vd({x:a,y:o},this._getRegionOrSeriesLayout(e),!1)&&(this._clickEnable=!1,i&&i({zoomDelta:r,zoomX:a,zoomY:o},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}_getRegionOrSeriesLayout(t){t.type!=="region"&&(t=t.getRegion());const{x:e,y:i,width:n,height:r}=t.layout.getLayout();return{x1:e,y1:i,x2:e+n,y2:i+r}}_bindZoomEventAsRegion(t,e,i,n){var r,a;const o=(r=n==null?void 0:n.delayType)!==null&&r!==void 0?r:"throttle",l=(a=n==null?void 0:n.delayTime)!==null&&a!==void 0?a:0,h=this._isGestureListener?this._gestureController:t,d=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:Yt.chart,consume:!0}],u=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:Yt.chart,consume:!1}];h.on(...u,Lo[o](c=>{this._zoomableTrigger.clearZoom()},l)),h.on(...d,Lo[o](c=>{this._zoomEventDispatch(c,e,i)},l))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||sr(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,n){this._option.disableTriggerEvent||sr(this._renderMode)&&t.forEach(r=>{e?r.getSeries().forEach(a=>{e(a)&&this._bindZoomEventAsRegion(a.event,a,i,n)}):this._bindZoomEventAsRegion(this._eventObj,r,i,n)})}_scrollEventDispatch(t,e,i){let n=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return n;const r=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(r);const{scrollX:a,scrollY:o,canvasX:l,canvasY:h}=r;return C(a)&&C(o)||vd({x:l,y:h},this._getRegionOrSeriesLayout(e),!1)&&(this._clickEnable=!1,i&&(n=i({scrollX:a,scrollY:o},r)),this._eventObj.emit("scroll",{scrollX:a,scrollY:o,model:this})),n}_bindScrollEventAsRegion(t,e,i,n){var r,a;const o=(r=n==null?void 0:n.delayType)!==null&&r!==void 0?r:"throttle",l=(a=n==null?void 0:n.delayTime)!==null&&a!==void 0?a:0,h=this._isGestureListener?this._gestureController:t,d=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:Yt.chart,consume:!0}],u=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:Yt.chart,consume:!1}];h.on(...u,Lo[o](c=>{this._zoomableTrigger.clearScroll()},l)),h.on(...d,Lo[o](c=>this._scrollEventDispatch(c,e,i),l))}initScrollEventOfSeries(t,e,i){sr(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,n){this._option.disableTriggerEvent||sr(this._renderMode)&&t.forEach(r=>{e?r.getSeries().forEach(a=>{e(a)&&this._bindScrollEventAsRegion(a.event,a,i,n)}):this._bindScrollEventAsRegion(this._eventObj,r,i,n)})}_bindDragEventAsRegion(t,e,i,n){t.on(this._getZoomTriggerEvent("start"),{level:Yt.chart},r=>{if(!r.event)return;const{event:a}=r;vd({x:a.canvasX,y:a.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(r,i,n)}),t.on("click",{level:Yt.chart},()=>!this._clickEnable)}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||sr(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:Yt.model,filter:({model:n})=>(n==null?void 0:n.id)===t.id},n=>{this._handleDrag(n,e,i)})}initDragEventOfRegions(t,e,i,n){this._option.disableTriggerEvent||sr(this._renderMode)&&t.forEach(r=>{e?r.getSeries().forEach(a=>{e(a)&&(a.event.on(this._getZoomTriggerEvent("start"),{level:Yt.model,filter:({model:o})=>(o==null?void 0:o.id)===a.id},o=>{this._handleDrag(o,i)}),a.event.on("click",{level:Yt.model,filter:({model:o})=>(o==null?void 0:o.id)===a.id},()=>!this._clickEnable))}):this._bindDragEventAsRegion(this._eventObj,r,i,n)})}_handleDrag(t,e,i){var n,r,a;if(this._option.disableTriggerEvent||(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event)))return;const o=(n=i==null?void 0:i.delayType)!==null&&n!==void 0?n:"throttle",l=(r=i==null?void 0:i.delayTime)!==null&&r!==void 0?r:0,h=(a=i==null?void 0:i.realTime)===null||a===void 0||a,d=this._getZoomTriggerEvent("move"),u=this._getZoomTriggerEvent("end"),c=t.event;let p=c.canvasX,g=c.canvasY,f=c.canvasX,_=c.canvasY;const m=Lo[o](y=>{this._clickEnable=!1;const b=y.event,x=[b.canvasX-f,b.canvasY-_];f=b.canvasX,_=b.canvasY,!h&&e&&e(x,y.event),this._eventObj.emit("panend",{delta:x,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(d,{level:Yt.chart,source:Jt.chart},v),this._eventObj.off(u,{level:Yt.chart,source:Jt.window},m)},l),v=Lo[o](y=>{if(!this._zoomableTrigger.parserDragEvent(y.event))return;this._clickEnable=!1;const b=y.event,x=[b.canvasX-p,b.canvasY-g];p=b.canvasX,g=b.canvasY,h&&e&&e(x,y.event),this._eventObj.emit("panmove",{delta:x,model:this})},l);this._eventObj.on(d,{level:Yt.chart,source:Jt.chart},v),this._eventObj.on(u,{level:Yt.chart,source:Jt.chart},m)}}function CJ(s,t){return`${xt}_${t}_${s}`}class Wf extends ds{constructor(){super(...arguments),this.type=J.geoCoordinate,this.name=J.geoCoordinate,this.layoutType="none",this.layoutZIndex=he.Mark,this._projectionSpec={name:CJ(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,n,r,a,o,l;let h=t.zoomDelta;const d=this._actualScale;return this._actualScale*=h,this._actualScale<((i=this._spec.zoomLimit)===null||i===void 0?void 0:i.min)?(this._actualScale=(n=this._spec.zoomLimit)===null||n===void 0?void 0:n.min,h=((r=this._spec.zoomLimit)===null||r===void 0?void 0:r.min)/d):this._actualScale>((a=this._spec.zoomLimit)===null||a===void 0?void 0:a.max)&&(this._actualScale=(o=this._spec.zoomLimit)===null||o===void 0?void 0:o.max,h=((l=this._spec.zoomLimit)===null||l===void 0?void 0:l.max)/d),e&&(e.zoomDelta=h),this.zoom(h,[t.zoomX,t.zoomY]),h},this.pan=(t=[0,0])=>{var e,i,n;const r=(i=(e=this._projection)===null||e===void 0?void 0:e.translate())!==null&&i!==void 0?i:[0,0];let a=r[0],o=r[1];a+=t[0],o+=t[1],(n=this._projection)===null||n===void 0||n.translate([a,o])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(C(t))return null;const e=[];return t.region.forEach((i,n)=>{if(i.coordinate==="geo"){const r=Object.assign(Object.assign({},i),{padding:0});e.push({spec:r,regionIndex:n,type:J.geoCoordinate,specInfoPath:["region",n,"geoCoordinate"]})}}),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=_t(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>((t=this._spec.zoomLimit)===null||t===void 0?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<((e=this._spec.zoomLimit)===null||e===void 0?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=(i=this._projectionSpec.zoom)!==null&&i!==void 0?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},n=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});n!==1&&this.event.emit("zoom",{scale:n,scaleCenter:i,model:this})}initEvent(){this.event.on(bt.scaleUpdate,{filter:({model:t})=>(t==null?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,()=>!0,this.pan),this._regions.forEach(t=>{t.getSeries().forEach(e=>{e.event.on("zoom",i=>(e.handleZoom(i),!0)),e.event.on("panmove",i=>(e.handlePan(i),!0))})}))}initProjection(){var t;this._projection=new gJ(this._projectionSpec),this._projection.projection!==null||(t=this._option)===null||t===void 0||t.onError("unsupported projection type!")}coordinateHelper(){const t={longitudeField:this._longitudeField,latitudeField:this._latitudeField,dataToPosition:this.dataToPosition.bind(this),dataToLongitude:this.dataToLongitude.bind(this),dataToLatitude:this.dataToLatitude.bind(this),shape:this.shape.bind(this),getCoordinateId:()=>this.id};this._regions.forEach(e=>{e.getSeries().forEach(i=>{i.type===j.map?i.setCoordinateHelper(t):(i.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(n,r)=>{var a;let o=n[0];if(C(o)&&(r!=null&&r.datum)){const l=r.datum[i.getDimensionField()[0]];o=(a=this._centerCache.get(l))===null||a===void 0?void 0:a.x}return this.dataToLongitude(o)},valueToPosition:(n,r)=>{var a;if(C(n)&&(r!=null&&r.datum)){const o=r.datum[i.getDimensionField()[0]];n=(a=this._centerCache.get(o))===null||a===void 0?void 0:a.x}return this.dataToLongitude(n)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),i.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(n,r)=>{var a;let o=n[0];if(C(o)&&(r!=null&&r.datum)){const l=r.datum[i.getDimensionField()[0]];o=(a=this._centerCache.get(l))===null||a===void 0?void 0:a.y}return this.dataToLatitude(o)},valueToPosition:(n,r)=>{var a;if(C(n)&&(r!=null&&r.datum)){const o=r.datum[i.getDimensionField()[0]];n=(a=this._centerCache.get(o))===null||a===void 0?void 0:a.y}return this.dataToLatitude(n)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))})})}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:n,scale:r,center:a}=this.evaluateProjection([0,0],[e,i]);n&&this._projection.translate(n),r&&this._projection.scale(r),a&&this._projection.center(a),Te(this._regions,o=>{var l;if(o.type===j.map){o.areaPath.clear();const h=(l=o.getRootMark().getProduct())===null||l===void 0?void 0:l.getGroupGraphicItem();h&&h.attribute.postMatrix&&h.setAttributes({postMatrix:new ze})}}),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach(e=>{e.getSeries().forEach(i=>{var n,r;i.type===j.map&&t.push(...(r=(n=i.getMapViewData())===null||n===void 0?void 0:n.latestData)!==null&&r!==void 0?r:[])})}),t}dataToPosition(t=[]){var e;const i=(e=this._projection)===null||e===void 0?void 0:e.project([t[0],t[1]]);return{x:i==null?void 0:i[0],y:i==null?void 0:i[1]}}dataToLatitude(t){var e;const i=(e=this._projection)===null||e===void 0?void 0:e.project([0,t]);return i==null?void 0:i[1]}dataToLongitude(t){var e;const i=(e=this._projection)===null||e===void 0?void 0:e.project([t,0]);return i==null?void 0:i[0]}zoom(t,e=[0,0]){var i,n,r,a,o,l;let h=(n=(i=this._projection)===null||i===void 0?void 0:i.scale())!==null&&n!==void 0?n:0;const d=(a=(r=this._projection)===null||r===void 0?void 0:r.translate())!==null&&a!==void 0?a:[0,0];let u=d[0],c=d[1];h*=t,u-=(e[0]-u)*(t-1),c-=(e[1]-c)*(t-1),(o=this._projection)===null||o===void 0||o.scale(h),(l=this._projection)===null||l===void 0||l.translate([u,c])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const n=this._projection.evaluate(t,e,this.collectFeatures());let r=n.translate();const a=n.scale()*this._initialScale,o=(i=this._projectionSpec.center)!==null&&i!==void 0?i:n.invert([e[0]/2,e[1]/2]);return o&&(r=[e[0]/2,e[1]/2]),{translate:r,scale:a,center:o}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach(t=>{t.getSeries().forEach(e=>{var i,n;e.type==="map"&&((n=(i=e.getMapViewData())===null||i===void 0?void 0:i.latestData)!==null&&n!==void 0?n:[]).forEach((r={})=>{const a=r[e.getDimensionField()[0]]||r[Gf],o=e.getDatumCenter(r);a&&E(o)&&this._centerCache.set(a,{x:o[0],y:o[1]})})})})}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}Wf.type=J.geoCoordinate,ci(Wf,pS);const KL=()=>{I.registerComponent(Wf.type,Wf)};class qL extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class ca extends uJ{constructor(){super(...arguments),this.type=j.map,this.transformerConstructor=qL,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.map=this._spec.map,this._nameMap=this._spec.nameMap,this._nameField=this._spec.nameField,this._valueField=this._spec.valueField,this._spec.nameProperty&&(this._nameProperty=this._spec.nameProperty),this._spec.centroidProperty&&(this._centroidProperty=this._spec.centroidProperty),this.map||(t=this._option)===null||t===void 0||t.onError(`map type '${this.map}' is not specified !`),po.get(this.map)||(e=this._option)===null||e===void 0||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),Mt(this._dataSet,"copyDataView",pm),Mt(this._dataSet,"map",cJ),Mt(this._dataSet,"lookup",dJ);const i=po.get(this.map);i||(t=this._option)===null||t===void 0||t.onError("no valid map data found!");const n=new Zt(this._dataSet,{name:`map_${this.id}_data`});n.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:Es.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var r;return(r=this._data)===null||r===void 0?void 0:r.getLatestData()},key:Gf,fields:this._nameField,set:(r,a)=>{a&&Object.keys(a).forEach(o=>{o in r||(r[o]=a[o])})}}}),(e=this._data)===null||e===void 0||e.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Yn(this._option,n)}initMark(){this._pathMark=this._createMark(ca.mark.area,{morph:Er(this._spec,ca.mark.area.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:e=>{var i,n,r,a;return E(e[(i=this._seriesField)!==null&&i!==void 0?i:Ms])?((n=this._option.globalScale.getScale("color"))!==null&&n!==void 0?n:this._getDefaultColorScale()).scale(e[(r=this._seriesField)!==null&&r!==void 0?r:Ms]):(a=this._spec)===null||a===void 0?void 0:a.defaultFillColor},path:this.getPath.bind(this)},"normal",Q.Series),t.setPostProcess("fill",e=>E(e)?e:this._spec.defaultFillColor),this.setMarkStyle(t,{smoothScale:!0},"normal",Q.Built_In),this._trigger.registerMark(t))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:e=>this.getDatumName(e),x:e=>{var i;return(i=this.dataToPosition(e))===null||i===void 0?void 0:i.x},y:e=>{var i;return(i=this.dataToPosition(e))===null||i===void 0?void 0:i.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Ft((t=I.getAnimationInKey("fadeInOut"))===null||t===void 0?void 0:t(),Ut("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new pJ(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[ui]);if(i)return i.shape;const n=(e=this._coordinateHelper)===null||e===void 0?void 0:e.shape(t);return this._areaCache.set(t[ui],{shape:n}),n}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}handleZoom(t){var e,i,n;const{scale:r,scaleCenter:a}=t;if(r===1)return;const o=(e=this.getRootMark().getProduct())===null||e===void 0?void 0:e.getGroupGraphicItem();o&&(o.attribute.postMatrix||o.setAttributes({postMatrix:new ze}),o.scale(r,r,a));const l=(n=(i=this._labelMark)===null||i===void 0?void 0:i.getComponent())===null||n===void 0?void 0:n.getProduct();l&&l.evaluateSync(null,null)}handlePan(t){var e,i,n;const{delta:r}=t;if(r[0]===0&&r[1]===0)return;const a=(e=this.getRootMark().getProduct())===null||e===void 0?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new ze}),a.translate(r[0],r[1]));const o=(n=(i=this._labelMark)===null||i===void 0?void 0:i.getComponent())===null||n===void 0?void 0:n.getProduct();o&&o.evaluateSync(null,null)}getDatumCenter(t){var e,i,n,r;return this._centroidProperty&&(!((e=t.properties)===null||e===void 0)&&e[this._centroidProperty])?(i=t.properties)===null||i===void 0?void 0:i[this._centroidProperty]:H(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:!((n=t.properties)===null||n===void 0)&&n.center?t.properties.center:!((r=t.properties)===null||r===void 0)&&r.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e,i,n,r;return t[this.nameField]?t[this.nameField]:!((e=t.properties)===null||e===void 0)&&e[this._nameProperty]?!((i=this._spec)===null||i===void 0)&&i.nameMap?(n=this._spec.nameMap[t.properties[this._nameProperty]])!==null&&n!==void 0?n:"":(r=t.properties[this._nameProperty])!==null&&r!==void 0?r:"":""}dataToPositionX(t){var e;return(e=this._option)===null||e===void 0||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return(e=this._option)===null||e===void 0||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),(i=(e=this._mapViewData)===null||e===void 0?void 0:e.getDataView())===null||i===void 0||i.reRunAllTransform(),(n=this._mapViewData)===null||n===void 0||n.updateData()}_getDataIdKey(){return ui}getActiveMarks(){return[this._pathMark]}}ca.type=j.map,ca.mark=kD,ca.transformerConstructor=qL;const PJ=()=>{hJ(),KL(),UL(),I.registerSeries(ca.type,ca),I.registerImplement("registerMap",Eq),I.registerImplement("unregisterMap",Rq),Pr()},EJ=(s,t)=>{if(!s||s.length===0)return s;const{indexField:e,valueField:i,startAs:n,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:h}=t,d=[],{dimensionValues:u,dimensionData:c}=h().latestData,p=Array.from(u[e]);let g={start:0,end:0,lastIndex:null};return p.forEach((f,_)=>{const m={start:g.end,end:g.end,lastIndex:g.lastIndex,lastEnd:g.end,index:f,isTotal:!1};c[f].forEach(v=>{let y=!1;if(a&&a.type!=="end"){if((a.type==="field"||a.type==="custom")&&v[a.tagField])if(y=!0,a.type==="custom"){const{start:b,end:x}=a.product(v,g);v[n]=b,v[r]=x,m.end=x,m.start=b}else{let b=0,x=m.end;if(a.collectCountField&&!C(v[a.collectCountField])){const S=d.length-+v[a.collectCountField],A=d.length-1;S<0?console.warn("total.collectCountField error"):b=d[S].start,A<0?console.warn("total.collectCountField error"):x=d[A].end}else a.startField&&!C(v[a.startField])&&(b=+v[a.startField]),a.valueField&&!C(v[a.valueField])&&(x=i0(b,+v[a.valueField]));v[n]=b,v[r]=x,v[i]=x-b,m.start=b,m.end=x}}else _===p.length-1&&(m.start=0,v[n]=m.start,v[r]=m.end,y=!0);y||(v[n]=+m.end,v[r]=i0(v[n],+v[i]),m.end=v[r]),m.isTotal=y,(C(o)||o===Ef)&&(v[Ef]=y?l.total:+v[i]>=0?l.increase:l.decrease)}),g=Object.assign(Object.assign({},m),{lastIndex:f}),d.push(m)}),d},RJ=(s,t)=>{if(!s)return s;const{indexField:e,valueField:i,total:n,seriesField:r}=t,a={[e]:(n==null?void 0:n.text)||"total",[i]:s.reduce((o,l)=>i0(o,+l[i]),0)};return r&&(a[r]="total"),s.push(a),s},OJ={type:"fadeIn"},DJ={type:"growCenterIn"};function LJ(s,t){switch(t){case"fadeIn":return OJ;case"scaleIn":return DJ;default:return bc(s,!1)}}const BJ=()=>{I.registerAnimation("waterfall",(s,t)=>({appear:LJ(s,t),enter:bc(s,!1),exit:ph(s,!1),disappear:ph(s,!1)}))};class Bu extends Ri{constructor(){super(...arguments),this.type=Bu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}Bu.type="rule";const Sc=()=>{I.registerMark(Bu.type,Bu),Ux()},IJ=(s,t)=>{if(!t.fields)return s;const e={};return{dimensionValues:e,dimensionData:ZL(s.map(i=>i.latestData).flat(),t.fields,e)}};function ZL(s,t,e){if(t.length===0)return s;const i=t[0],n=t.slice(1);e[i]=new Set;const r=FJ(s,i,e[i]);return n.length?jJ(r,(a,o)=>ZL(a,n,e)):r}function FJ(s,t,e){const i={};return s.forEach(n=>{const r=n[t];i[r]||(i[r]=[],e.add(r)),i[r].push(n)}),i}function jJ(s,t){return Object.keys(s).reduce((e,i)=>(e[i]=t(s[i],i),e),{})}class zJ{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,n=new Zt(e instanceof no?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),Mt(e,"dimensionTree",IJ),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){var e,i,n;const r=(n=(i=(e=this.groupData)===null||e===void 0?void 0:e.latestData)===null||i===void 0?void 0:i.dimensionValues)===null||n===void 0?void 0:n[t];return r?Array.from(r):[]}}class JL extends xm{_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel")}}class eo extends yn{constructor(){super(...arguments),this.type=j.waterfall,this.transformerConstructor=JL,this._stack=!1,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return(t=this._totalData)===null||t===void 0?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new zJ(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],C(this._seriesField)&&(this._seriesField=Ef)}getSeriesKeys(){return this._seriesField===Ef?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),Mt(this._dataSet,"waterfallFillTotal",RJ),Mt(this._dataSet,"waterfall",EJ),(C(this._spec.total)||this._spec.total.type==="end")&&((t=this._rawData)===null||t===void 0||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=_b(this.getViewData(),this._dataSet,{name:`${xt}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Yn(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:qs,endAs:ii,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e,i,n;const r={yField:this.direction==="horizontal"?this._fieldY[0]:this.getStackValueField(),xField:this.direction==="horizontal"?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var l,h;return this.direction==="horizontal"?(l=this._xAxisHelper)===null||l===void 0?void 0:l.getScale(0).scale(0):(h=this._yAxisHelper)===null||h===void 0?void 0:h.getScale(0).scale(0)}},a=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset,o=Ba(this);this._barMark.setAnimationConfig(Ft((i=I.getAnimationInKey("waterfall"))===null||i===void 0?void 0:i(r,a),Ut("bar",this._spec,this._markAttributeContext),o)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Ft((n=I.getAnimationInKey("fadeInOut"))===null||n===void 0?void 0:n(),Ut("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t;super.initMark();const e=this._createMark(eo.mark.leaderLine,{key:"index",customShape:(t=this._spec.leaderLine)===null||t===void 0?void 0:t.customShape});e&&(this._leaderLineMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t){if(!this._labelMark&&(!((e=this._spec.label)===null||e===void 0)&&e.visible))return super.initLabelMarkStyle(t),void(this._labelMark=t);this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:i=>{var n;return((n=this._spec.stackLabel)===null||n===void 0?void 0:n.valueType)==="absolute"?i.end:eF(i.end,i.start)}})}}totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:r}=this._xAxisHelper;return this._direction==="vertical"?n([t[e]],{bandPosition:this._bandPosition})+.5*r(0)-this._barMark.getAttribute("width",t)*(.5-i):Qt(n([t[e]],{bandPosition:this._bandPosition}))}totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:r}=this._yAxisHelper;return this._direction==="vertical"?Qt(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*r(0)-this._barMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&(this._direction==="vertical"?this.setMarkStyle(this._leaderLineMark,{visible:t=>!C(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",Q.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!C(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",Q.Series))}}eo.type=j.waterfall,eo.mark=RD,eo.transformerConstructor=JL;const HJ=()=>{Sc(),Fa(),BJ(),Pr(),I.registerSeries(eo.type,eo)},Iu=`${xt}_BOX_PLOT_OUTLIER_VALUE`;var de;(function(s){s.OUTLIER="outlier",s.MAX="max",s.MIN="min",s.MEDIAN="median",s.Q1="q1",s.Q3="q3",s.SERIES_FIELD="seriesField"})(de||(de={}));const GJ=(s,t)=>{const e=[],{outliersField:i,dimensionField:n}=t;return(s[0].latestData||[]).forEach(r=>{let a=r[i];U(a)||(a=[a]),e.push(...a.map(o=>{const l={[Iu]:o};return n.forEach(h=>{l[h]=r[h]}),l}))}),e};class WJ extends hs{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e))return t===de.OUTLIER?this.series.getOutliersField():t===de.SERIES_FIELD?this.series.getSeriesField():null;switch(t){case de.MIN:return this.series.getMinField();case de.MAX:return this.series.getMaxField();case de.MEDIAN:return this.series.getMedianField();case de.Q1:return this.series.getQ1Field();case de.Q3:return this.series.getQ3Field();case de.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e))return t===de.OUTLIER?e[Iu]:t===de.SERIES_FIELD?e[this.series.getSeriesField()]:null;switch(t){case de.MIN:return e[this.series.getMinField()];case de.MAX:return e[this.series.getMaxField()];case de.MEDIAN:return e[this.series.getMedianField()];case de.Q1:return e[this.series.getQ1Field()];case de.Q3:return e[this.series.getQ3Field()];case de.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=t=>this.series.getShaftShape()==="line"?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return(e=i==null?void 0:i.fill)!==null&&e!==void 0?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>E(t[Iu])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(de.OUTLIER),value:this.getContentValue(de.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(de.MAX),value:this.getContentValue(de.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(de.Q3),value:this.getContentValue(de.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(de.MEDIAN),value:this.getContentValue(de.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(de.Q1),value:this.getContentValue(de.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(de.MIN),value:this.getContentValue(de.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(de.SERIES_FIELD),value:this.getContentValue(de.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]}}}class Fu extends Ri{constructor(){super(...arguments),this.type=Fu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),n=this.getProductId(),r=e==="bar"?"barBoxplot":"boxplot",a=this.getStyle("direction");this._product=i.glyph(r,t??i.rootMark).id(n).configureGlyph({direction:a}),this._compiledProductId=n}}Fu.type="boxPlot";const NJ=()=>{I.registerMark(Fu.type,Fu),F7(),G7()};class fo extends en{constructor(){super(...arguments),this.type=j.boxPlot}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}setAttrFromSpec(){var t,e,i,n,r;super.setAttrFromSpec();const a=(e=(t=this._spec.boxPlot)===null||t===void 0?void 0:t.style)!==null&&e!==void 0?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=(i=a.lineWidth)!==null&&i!==void 0?i:2,this._boxWidth=a.boxWidth,this._shaftShape=(n=a.shaftShape)!==null&&n!==void 0?n:"line",this._shaftWidth=a.shaftWidth,this._boxFillColor=a.boxFill,this._strokeColor=a.stroke,this._shaftFillOpacity=this._shaftShape==="bar"?(r=a.shaftFillOpacity)!==null&&r!==void 0?r:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(fo.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(fo.mark.outlier,{progressive:t,key:ui,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var t,e,i,n,r;const a=this._boxPlotMark;if(a){const l={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:(t=this._boxFillColor)!==null&&t!==void 0?t:this._shaftShape==="line"?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:(e=this._strokeColor)!==null&&e!==void 0?e:this._shaftShape==="line"?this.getColorAttribute():"#000"},h=this._direction==="vertical"?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},l),{boxWidth:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},ruleWidth:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()},q1q3Width:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},minMaxWidth:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},l),{boxHeight:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},ruleHeight:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()},q1q3Height:()=>{var d;return(d=this._boxWidth)!==null&&d!==void 0?d:this._getMarkWidth()},minMaxHeight:()=>{var d;return(d=this._shaftWidth)!==null&&d!==void 0?d:this._getMarkWidth()}});this.setMarkStyle(a,h,mt.STATE_NORMAL,Q.Series),this._trigger.registerMark(a)}const o=this._outlierMark;o&&(this.setMarkStyle(o,{fill:(n=(i=this._outliersStyle)===null||i===void 0?void 0:i.fill)!==null&&n!==void 0?n:this.getColorAttribute(),size:lt((r=this._outliersStyle)===null||r===void 0?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},mt.STATE_NORMAL,Q.Series),this._trigger.registerMark(o))}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,n=this._direction==="vertical"?this._yAxisHelper:this._xAxisHelper;if(i&&n){const{dataToPosition:a}=n,o=(t=n==null?void 0:n.getScale)===null||t===void 0?void 0:t.call(n,0);this.setMarkStyle(i,{min:l=>Qt(a(this.getDatumPositionValues(l,this._minField),{bandPosition:this._bandPosition}),o),q1:l=>Qt(a(this.getDatumPositionValues(l,this._q1Field),{bandPosition:this._bandPosition}),o),median:l=>Qt(a(this.getDatumPositionValues(l,this._medianField),{bandPosition:this._bandPosition}),o),q3:l=>Qt(a(this.getDatumPositionValues(l,this._q3Field),{bandPosition:this._bandPosition}),o),max:l=>Qt(a(this.getDatumPositionValues(l,this._maxField),{bandPosition:this._bandPosition}),o)},mt.STATE_NORMAL,Q.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:a}=n,o=(e=n==null?void 0:n.getScale)===null||e===void 0?void 0:e.call(n,0),l=this._direction==="vertical"?{x:this.dataToPositionX.bind(this),y:h=>Qt(a(this.getDatumPositionValues(h,Iu),{bandPosition:this._bandPosition}),o)}:{y:this.dataToPositionY.bind(this),x:h=>Qt(a(this.getDatumPositionValues(h,Iu),{bandPosition:this._bandPosition}),o)};this.setMarkStyle(r,l,mt.STATE_NORMAL,Q.Series)}}initData(){if(super.initData(),!this._data)return;Mt(this._dataSet,"foldOutlierData",GJ),Mt(this._dataSet,"addVChartProperty",Dh);const t=new Zt(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${xt}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction==="vertical"?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:Tu.bind(this),call:ch}},!1),this._outlierDataView=new Yn(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction==="vertical"?this._xAxisHelper:this._yAxisHelper,e=this._direction==="vertical"?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=at({},t);return["appear","enter","update","exit","disappear"].forEach(i=>{e[i]&&e[i].type==="scaleIn"?e[i].type=this._shaftShape==="line"?"boxplotScaleIn":"barBoxplotScaleIn":e[i]&&e[i].type==="scaleOut"&&(e[i].type=this._shaftShape==="line"?"boxplotScaleOut":"barBoxplotScaleOut")}),e}initAnimation(){var t,e,i,n,r,a,o;const l=Ba(this);if(this._boxPlotMark){const h=this._initAnimationSpec((t=I.getAnimationInKey("scaleInOut"))===null||t===void 0?void 0:t()),d=this._initAnimationSpec(Ut("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Ft(h,d,l))}if(this._outlierMark){const h={appear:(e=this._spec.animationAppear)===null||e===void 0?void 0:e.symbol,disappear:(i=this._spec.animationDisappear)===null||i===void 0?void 0:i.symbol,enter:(n=this._spec.animationEnter)===null||n===void 0?void 0:n.symbol,exit:(r=this._spec.animationExit)===null||r===void 0?void 0:r.symbol,update:(a=this._spec.animationUpdate)===null||a===void 0?void 0:a.symbol};this._outlierMark.setAnimationConfig(Ft((o=I.getAnimationInKey("scaleInOut"))===null||o===void 0?void 0:o(),h,l))}}initTooltip(){this._tooltipHelper=new WJ(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find(i=>i.key===this._outliersField);return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}fo.type=j.boxPlot,fo.mark=OD;const VJ=()=>{NJ(),Ia(),ym(),I.registerSeries(fo.type,fo)};class gh extends Ri{constructor(){super(...arguments),this.type=gh.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this.getStyle("textType")==="rich"?this._product=e.mark(nt.richtext,t??e.rootMark).id(i):this._product=e.mark(nt.text,t??e.rootMark).id(i),this._compiledProductId=i}}gh.type="text";const Os=()=>{I.registerMark(gh.type,gh),qO(),O7()};function wM(s,t,e,i,n,r,a,o,l){s.setMarkStyle(t,{textAlign:h=>{if(l()==="vertical")return"center";const d=n(h),u=r(h);if(e==="middle")return"center";if(d>=u){if(e==="start")return"left";if(e==="end")return"right";if(e==="outside")return"left"}else{if(e==="start")return"right";if(e==="end")return"left";if(e==="outside")return"right"}return"center"},textBaseline:h=>{if(l()==="horizontal")return"middle";const d=a(h),u=o(h);if(e==="middle")return"middle";if(u>=d){if(e==="start")return"bottom";if(e==="end")return"top";if(e==="outside")return"bottom"}else{if(e==="start")return"top";if(e==="end")return"bottom";if(e==="outside")return"top"}return"middle"}}),s.setMarkStyle(t,{x:h=>{const d=l(),u=n(h),c=r(h);if(d==="vertical"||e==="middle")return(u+c)/2;if(u>=c){if(e==="start")return c+i;if(e==="end")return u-i;if(e==="outside")return u+i}else{if(e==="start")return c-i;if(e==="end")return u+i;if(e==="outside")return u-i}return(u+c)/2},y:h=>{const d=l(),u=a(h),c=o(h);if(d==="horizontal"||e==="middle")return(u+c)/2;if(u>=c){if(e==="start")return c+i;if(e==="end")return u-i;if(e==="outside")return u+i}else{if(e==="start")return c-i;if(e==="end")return u+i;if(e==="outside")return u-i}return(u+c)/2}},"normal",Q.Series)}class UJ extends hs{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:e=>this.series.getSpec().direction==="horizontal"?e[this.series.getSpec().xField[0]]+"-"+e[this.series.getSpec().xField[1]]:e[this.series.getSpec().yField[0]]+"-"+e[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]}}}const QL=s=>({type:"growCenterIn",options:{direction:s.direction==="horizontal"?"x":"y"}}),$J={type:"fadeIn"},TM=s=>({type:"growCenterOut",options:{direction:s.direction==="horizontal"?"x":"y"}});function YJ(s,t){return t==="fadeIn"?$J:QL(s)}const XJ=()=>{I.registerAnimation("rangeColumn",(s,t)=>({appear:YJ(s,t),enter:QL(s),exit:TM(s),disappear:TM(s)}))};class tB extends xm{_transformLabelSpec(t){var e;((e=t.label)===null||e===void 0?void 0:e.position)!=="bothEnd"&&this._addMarkLabelSpec(t,"bar")}}class _n extends yn{constructor(){super(...arguments),this.type=j.rangeColumn,this._barMarkType="rect",this._barName=j.bar,this.transformerConstructor=tB,this._stack=!1}initMark(){var t,e,i,n,r,a,o,l,h;this._initBarBackgroundMark();const d=(t=this._spec.label)===null||t===void 0?void 0:t.position;this._barMark=this._createMark(_n.mark.bar,{morph:Er(this._spec,_n.mark.bar.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:(e=this._spec.bar)===null||e===void 0?void 0:e.customShape}),((i=this._spec.label)===null||i===void 0?void 0:i.visible)!==!1&&d==="bothEnd"&&(((r=(n=this._spec.label)===null||n===void 0?void 0:n.minLabel)===null||r===void 0?void 0:r.visible)!==!1&&(this._minLabelMark=this._createMark(_n.mark.minLabel,{markSpec:(a=this._spec.label)===null||a===void 0?void 0:a.minLabel})),((l=(o=this._spec.label)===null||o===void 0?void 0:o.maxLabel)===null||l===void 0?void 0:l.visible)!==!1&&(this._maxLabelMark=this._createMark(_n.mark.maxLabel,{markSpec:(h=this._spec.label)===null||h===void 0?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,n,r,a,o,l,h,d;super.initMarkStyle();const u=this._minLabelMark,c=(t=this._spec.label)===null||t===void 0?void 0:t.minLabel;if(u){this.setMarkStyle(u,{fill:(i=(e=c==null?void 0:c.style)===null||e===void 0?void 0:e.fill)!==null&&i!==void 0?i:this.getColorAttribute(),text:m=>{const v=this._spec.direction==="horizontal"?m[this._spec.xField[0]]:m[this._spec.yField[0]];return c!=null&&c.formatMethod?c.formatMethod(v,m):v}});const f=(n=c==null?void 0:c.position)!==null&&n!==void 0?n:"end",_=(r=c==null?void 0:c.offset)!==null&&r!==void 0?r:this._direction==="vertical"?-20:-25;wM(this,u,f,_,m=>this._barMark.getAttribute("x",m),m=>this._direction==="vertical"?this._barMark.getAttribute("x",m)+this._barMark.getAttribute("width",m):this._barMark.getAttribute("x1",m),m=>this._barMark.getAttribute("y",m),m=>this._direction==="vertical"?this._barMark.getAttribute("y1",m):this._barMark.getAttribute("y",m)+this._barMark.getAttribute("height",m),()=>this._direction)}const p=this._maxLabelMark,g=(a=this._spec.label)===null||a===void 0?void 0:a.maxLabel;if(p){this.setMarkStyle(p,{fill:(l=(o=g==null?void 0:g.style)===null||o===void 0?void 0:o.fill)!==null&&l!==void 0?l:this.getColorAttribute(),text:m=>{const v=this._spec.direction==="horizontal"?m[this._spec.xField[1]]:m[this._spec.yField[1]];return g!=null&&g.formatMethod?g.formatMethod(v,m):v}});const f=(h=g==null?void 0:g.position)!==null&&h!==void 0?h:"start",_=(d=g==null?void 0:g.offset)!==null&&d!==void 0?d:this._direction==="vertical"?-20:-25;wM(this,p,f,_,m=>this._barMark.getAttribute("x",m),m=>this._direction==="vertical"?this._barMark.getAttribute("x",m)+this._barMark.getAttribute("width",m):this._barMark.getAttribute("x1",m),m=>this._barMark.getAttribute("y",m),m=>this._direction==="vertical"?this._barMark.getAttribute("y1",m):this._barMark.getAttribute("y",m)+this._barMark.getAttribute("height",m),()=>this._direction)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:e=>{let i,n;return this._spec.direction==="horizontal"?(i=e[this._spec.xField[0]],n=e[this._spec.xField[1]]):(i=e[this._spec.yField[0]],n=e[this._spec.yField[1]]),i+"-"+n},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,n,r;const a=Ba(this),o=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this._barMark.setAnimationConfig(Ft((i=I.getAnimationInKey("rangeColumn"))===null||i===void 0?void 0:i({direction:this.direction},o),Ut("bar",this._spec,this._markAttributeContext),a)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Ft((n=I.getAnimationInKey("fadeInOut"))===null||n===void 0?void 0:n(),Ut("label",this._spec,this._markAttributeContext),a)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Ft((r=I.getAnimationInKey("fadeInOut"))===null||r===void 0?void 0:r(),Ut("label",this._spec,this._markAttributeContext),a))}initTooltip(){this._tooltipHelper=new UJ(this),this._barMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._barMark),this._minLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._minLabelMark),this._maxLabelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._maxLabelMark),this._labelMark&&this._tooltipHelper.ignoreTriggerSet.mark.add(this._labelMark)}}_n.type=j.rangeColumn,_n.mark=jD,_n.transformerConstructor=tB;const KJ=()=>{Fa(),Os(),XJ(),Pr(),I.registerSeries(_n.type,_n)};class Nf extends _n{constructor(){super(...arguments),this.type=j.rangeColumn3d,this._barMarkType="rect3d",this._barName=j.bar3d}}Nf.type=j.rangeColumn3d,Nf.mark=zD;const qJ=()=>{zL(),I.registerSeries(Nf.type,Nf)};class ZJ extends hs{getDefaultTooltipPattern(t,e){if(t==="mark")return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]};if(t==="dimension"&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach(({data:r})=>r.forEach(({series:a})=>{a.type==="rangeArea"&&n.push({seriesId:a.id,key:this.contentKeyCallback,value:o=>this.series.getSpec().direction==="horizontal"?o[this.series.getSpec().xField[0]]+"-"+o[this.series.getSpec().xField[1]]:o[this.series.getSpec().yField[0]]+"-"+o[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1})})),{visible:!0,activeType:t,title:i,content:n}}return null}}class fh extends gr{constructor(){super(...arguments),this.type=j.rangeArea}initMark(){var t;this._areaMark=this._createMark(fh.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:(t=this._spec.area)===null||t===void 0?void 0:t.customShape})}initMarkStyle(){var t,e,i,n,r;const a=(i=(e=(t=this.getSpec().area)===null||t===void 0?void 0:t.style)===null||e===void 0?void 0:e.curveType)!==null&&i!==void 0?i:(r=(n=this.getSpec().line)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.curveType,o=a===lS?this._direction==="vertical"?"monotoneX":"monotoneY":a,l=this._areaMark;l&&(this._direction==="vertical"?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:h=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:d}=this._yAxisHelper;return d(this.getDatumPositionValues(h,this._spec.yField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this)},"normal",Q.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:h=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:d}=this._xAxisHelper;return d(this.getDatumPositionValues(h,this._spec.xField[1]),{bandPosition:this._bandPosition})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",Q.Series),this.setMarkStyle(l,{fill:this.getColorAttribute(),stroke:!1},"normal",Q.Series),this._invalidType!=="zero"&&this.setMarkStyle(l,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",Q.Series),this.setMarkStyle(l,{curveType:o},"normal",Q.Built_In),this._trigger.registerMark(l))}initTooltip(){this._tooltipHelper=new ZJ(this),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}}fh.type=j.rangeArea,fh.mark=ND;const JJ=()=>{uS(),I.registerSeries(fh.type,fh)};class Ac extends go{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=pu,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1,this._getInvalidDefined=t=>!(this.angleAxisHelper.isContinuous&&!Un(t[this._angleField[0]]))&&!(this.radiusAxisHelper.isContinuous&&!Un(t[this._radiusField[0]]))}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=E(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=E(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(C(t)||C(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(Y(t)),n=this.radiusAxisHelper.dataToPosition(Y(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return!((t=this.radiusAxisHelper)===null||t===void 0)&&t.getScale&&this._radiusField.forEach(n=>{const r={key:n,operations:[]};Kt(this.radiusAxisHelper.getScale(0).type)?r.operations=["max","min"]:r.operations=["values"],i.push(r)}),!((e=this.angleAxisHelper)===null||e===void 0)&&e.getScale&&this._angleField.forEach(n=>{const r={key:n,operations:[]};Kt(this.angleAxisHelper.getScale(0).type)?r.operations=["max","min"]:r.operations=["values"],i.push(r)}),i}setAttrFromSpec(){super.setAttrFromSpec(),E(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),E(this._spec.radius)&&(this._outerRadius=this._spec.radius),E(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),E(this._spec.sortDataByAxis)&&(this._sortDataByAxis=this._spec.sortDataByAxis===!0)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}fillData(){super.fillData(),this.sortDataByAxis&&this._sortDataInAxisDomain()}_sortDataInAxisDomain(){var t,e;!((e=(t=this.getViewData())===null||t===void 0?void 0:t.latestData)===null||e===void 0)&&e.length&&CL(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}function QJ(s){return Un(s)?Number.parseFloat(s):0}const tQ=(s,t)=>{const e=s.map(x=>Object.assign({},x));if(!e||e.length===0)return e;const{angleField:i,startAngle:n,endAngle:r,minAngle:a,asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:d,asRatio:u,asQuadrant:c,asK:p}=t,g=(x,S,A)=>{x[o]=S,x[l]=S+A,x[h]=S+A/2,x[d]=A,x[c]=PV(S+A/2)};let f=0,_=-1/0;for(let x=0;x<e.length;x++){const S=QJ(e[x][i]);f+=S,_=Math.max(S,_),e[x][_v]=S}const m=r-n;let v=n,y=m,b=0;if(e.forEach(x=>{const S=x[_v],A=f?S/f:0;let k=A*m;k<a?(k=a,y-=a):b+=S;const w=v,T=v+k;x[u]=A,x[p]=_?S/_:0,g(x,w,k),v=T}),y<m)if(y<=.001){const x=m/e.length;e.forEach((S,A)=>{g(S,n+A*x,x)})}else{const x=y/b;v=n,e.forEach(S=>{const A=S[d]===a?a:S[_v]*x;g(S,v,A),v+=A})}return f!==0&&(e[e.length-1][l]=r),e};function Am(s,t,e){return(i,n,r)=>t?s.growField==="radius"?{overall:0}:{overall:s.growFrom(i,n,e)}:{overall:!1}}const MM=s=>({type:s.growField==="radius"?"growRadiusIn":"growAngleIn",options:Am(s,!0,si.appear)}),eQ={type:"fadeIn"},eB=s=>({type:s.growField==="radius"?"growRadiusIn":"growAngleIn",easing:"linear",options:Am(s,!0,si.enter)}),iB=s=>({type:s.growField==="radius"?"growRadiusOut":"growAngleOut",easing:"linear",options:Am(s,!0,si.exit)}),sB=s=>({type:s.growField==="radius"?"growRadiusOut":"growAngleOut",options:Am(s,!0,si.exit)});function nB(s,t){if(t===!1)return{};switch(t){case"fadeIn":return eQ;case"growRadius":return MM(Object.assign(Object.assign({},s),{growField:"radius"}));default:return MM(Object.assign(Object.assign({},s),{growField:"angle"}))}}const iQ=()=>{I.registerAnimation("pie",(s,t)=>({appear:nB(s,t),enter:eB(s),exit:iB(s),disappear:sB(s)}))},sQ=()=>{I.registerAnimation("pie3d",(s,t)=>({appear:nB(s,t),enter:eB(s),exit:iB(s),disappear:sB(s)}))};function nQ(s,t){var e,i,n,r;const a=(i=(e=t.options)===null||e===void 0?void 0:e.distance)!==null&&i!==void 0?i:10,o=H(t.duration)?t.duration/2:1e3,l=(n=t.options.easing)!==null&&n!==void 0?n:"cubicOut";return{oneByOne:t.oneByOne,loop:(r=t.loop)!==null&&r!==void 0&&r,timeSlices:[{duration:o,effects:{easing:l,channel:{x:{from:h=>s.getAttribute("x",h),to:h=>s.getAttribute("x",h)+qr({angle:h[cr],radius:a}).x},y:{from:h=>s.getAttribute("y",h),to:h=>s.getAttribute("y",h)+qr({angle:h[cr],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:h=>s.getAttribute("x",h),from:h=>s.getAttribute("x",h)+qr({angle:h[cr],radius:a}).x},y:{to:h=>s.getAttribute("y",h),from:h=>s.getAttribute("y",h)+qr({angle:h[cr],radius:a}).y}}}}]}}class gS extends Ri{constructor(t,e){super(t,e),this.type=_h.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(i,n,r="normal",a,o)=>{var l;return o+((l=this.getAttribute("radiusOffset",n,r,a))!==null&&l!==void 0?l:0)},this.computeCenter=(i,n,r="normal",a,o)=>o+qr({angle:n[cr],radius:this.getAttribute("centerOffset",n,r,a)})[i],this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0})}}class _h extends gS{constructor(){super(...arguments),this.type=_h.type}}_h.type="arc";const kc=()=>{YO(),aS(),I.registerMark(_h.type,_h)};class fS extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const r=this._getDefaultSpecFromChart(e);n=_t({},this._theme,r,t),n.label.position==="inside"?n.label=_t({},this._theme.innerLabel,n.label):n.label=_t({},this._theme.outerLabel,n.label)}return{spec:n,theme:i}}}class mh extends Ac{constructor(){super(...arguments),this.transformerConstructor=fS,this._pieMarkName="pie",this._pieMarkType="arc",this._startAngle=N_,this._endAngle=Px,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[cr];if(C(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),r=this.computeCenter(t),a=qr({angle:e,radius:(i+n)/2});return{x:r.x+a.x,y:r.y+a.y}}}get center(){var t,e,i,n;return{x:(e=(t=this._spec)===null||t===void 0?void 0:t.centerX)!==null&&e!==void 0?e:this._region.getLayoutRect().width/2,y:(n=(i=this._spec)===null||i===void 0?void 0:i.centerY)!==null&&n!==void 0?n:this._region.getLayoutRect().height/2}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>{var t,e;return(e=(t=this._center)===null||t===void 0?void 0:t.x)!==null&&e!==void 0?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return(e=(t=this._center)===null||t===void 0?void 0:t.y)!==null&&e!==void 0?e:this._region.getLayoutRect().height/2}}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._centerOffset=(t=this._spec.centerOffset)!==null&&t!==void 0?t:0,this._cornerRadius=(e=this._spec.cornerRadius)!==null&&e!==void 0?e:0;const i=EV(E(this._spec.startAngle)?le(this._spec.startAngle):this._startAngle,E(this._spec.endAngle)?le(this._spec.endAngle):this._endAngle);this._startAngle=i.startAngle,this._endAngle=i.endAngle,this._padAngle=E(this._spec.padAngle)?le(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;Mt(this._dataSet,"pie",tQ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,minAngle:E(this._spec.minAngle)?le(this._spec.minAngle):0,asStartAngle:Yk,asEndAngle:Xk,asRatio:HR,asMiddleAngle:cr,asRadian:HV,asQuadrant:zV,asK:jV}},!1);const e=new Zt(this._dataSet,{name:`${xt}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Yn(this._option,e)}initMark(){var t;this._pieMark=this._createMark(Object.assign(Object.assign({},mh.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:Er(this._spec,this._pieMarkName),defaultMorphElementKey:this._seriesField,key:$n,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,customShape:(t=this._spec.pie)===null||t===void 0?void 0:t.customShape})}startAngleScale(t){return Op(Yk)(t)}endAngleScale(t){return Op(Xk)(t)}initMarkStyle(){const t=this._pieMark;t&&(this.setMarkStyle(t,{x:()=>{var e,i;return(i=(e=this._center)===null||e===void 0?void 0:e.x)!==null&&i!==void 0?i:this._region.getLayoutRect().width/2},y:()=>{var e,i;return(i=(e=this._center)===null||e===void 0?void 0:e.y)!==null&&i!==void 0?i:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:qT(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:qT(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:e=>this.startAngleScale(e),endAngle:e=>this.endAngleScale(e),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",Q.Series),this._trigger.registerMark(t))}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const n=this.getSpec()[t.name];if(n)for(const r in n.state||{})this.setMarkStyle(t,this.generateRadiusStyle(n.state[r]),r,Q.User_Mark)}}initLabelMarkStyle(t){var e,i,n,r,a,o;t&&this.setMarkStyle(t,{visible:Op(FV).bind(this),text:l=>l[this.getDimensionField()[0]],fill:((i=(e=this._spec.label)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.fill)||this.getColorAttribute(),angle:(r=(n=this._spec.label)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.angle,limit:(o=(a=this._spec.label)===null||a===void 0?void 0:a.style)===null||o===void 0?void 0:o.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var t;super.initEvent(),(t=this._viewDataLabel.getDataView())===null||t===void 0||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(bt.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this.computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this.computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this.computeLayoutRadius()*t.cornerRadius),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,n,r,a,o,l;const h=t==="normal"?(n=(i=this.getSpec()[((e=this._pieMark)===null||e===void 0?void 0:e.name)||"pie"])===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.outerRadius:(l=(o=(a=this.getSpec()[((r=this._pieMark)===null||r===void 0?void 0:r.name)||"pie"])===null||a===void 0?void 0:a.state)===null||o===void 0?void 0:o[t])===null||l===void 0?void 0:l.outerRadius;return h??this._outerRadius}getInnerRadius(t="normal"){var e,i,n,r,a,o,l;const h=t==="normal"?(n=(i=this.getSpec()[((e=this._pieMark)===null||e===void 0?void 0:e.name)||"pie"])===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.innerRadius:(l=(o=(a=this.getSpec()[((r=this._pieMark)===null||r===void 0?void 0:r.name)||"pie"])===null||a===void 0?void 0:a.state)===null||o===void 0?void 0:o[t])===null||l===void 0?void 0:l.innerRadius;return h??this._innerRadius}computeRadius(t,e){return this.computeLayoutRadius()*t*(C(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){(i=i??{data:!0}).centerX=!0,i.centerX=!0,i.centerY=!0,i.centerOffset=!0,i.radius=!0,i.innerRadius=!0,i.cornerRadius=!0,i.startAngle=!0,i.endAngle=!0,i.padAngle=!0;const{centerX:n,centerY:r,centerOffset:a,radius:o,innerRadius:l,cornerRadius:h,startAngle:d,endAngle:u,padAngle:c}=e,p=super._compareSpec(t,e,i);return(t=t??{}).centerY===r&&t.centerX===n&&t.centerOffset===a&&t.radius===o&&t.innerRadius===l&&t.cornerRadius===h&&t.startAngle===d&&t.endAngle===u&&t.padAngle===c||(p.reRender=!0,p.change=!0),p}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[cr];if(C(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),r=qr({angle:e,radius:i});return{x:n.x+r.x,y:n.y+r.y}}initAnimation(){var t,e;const i={growFrom:(r,a,o)=>{var l;if(o===si.appear)return this._startAngle;if(o===si.disappear)return this._endAngle;const h=[si.disappear,si.exit],d=a.mark.elements,u=r,c=u==null?void 0:u[ui];if(d.find(g=>{var f;return((f=g.data[0])===null||f===void 0?void 0:f[ui])<c})===void 0)return this._startAngle;if(d.find(g=>{var f;return((f=g.data[0])===null||f===void 0?void 0:f[ui])>c})===void 0)return this._endAngle;const p=[...d].reverse().find(g=>{var f;return((f=g.data[0])===null||f===void 0?void 0:f[ui])<c});return h.includes(o)?(l=p==null?void 0:p.getNextGraphicAttributes())===null||l===void 0?void 0:l.endAngle:p==null?void 0:p.getGraphicAttribute("endAngle",!0)}},n=(t=this._spec.animationAppear)===null||t===void 0?void 0:t.preset;if(this._pieMark){const r=Ft((e=I.getAnimationInKey("pie"))===null||e===void 0?void 0:e(i,n),Ut("pie",this._spec,this._markAttributeContext));r.normal&&r.normal.type&&(r.normal=nQ(this._pieMark,r.normal)),this._pieMark.setAnimationConfig(r)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}mh.transformerConstructor=fS,mh.mark=xD;class yb extends mh{constructor(){super(...arguments),this.type=j.pie}}yb.type=j.pie;const rQ=()=>{kc(),iQ(),I.registerSeries(yb.type,yb)};class ju extends gS{constructor(){super(...arguments),this.type=ju.type,this._support3d=!0}}ju.type="arc3d";const aQ=()=>{aS(),k7(),I.registerMark(ju.type,ju)};class rB extends fS{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class Bd extends mh{constructor(){super(...arguments),this.type=j.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=rB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=(e=(t=this._spec)===null||t===void 0?void 0:t.angle3d)!==null&&e!==void 0?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",Q.Series)}initLabelMarkStyle(t){if(!t)return;super.initLabelMarkStyle(t);const e={};t.setSupport3d(!0),e.beta=this._angle3d,e.anchor3d=i=>{var n,r,a,o;return[(r=(n=this._center)===null||n===void 0?void 0:n.x)!==null&&r!==void 0?r:this._region.getLayoutRect().width/2,(o=(a=this._center)===null||a===void 0?void 0:a.y)!==null&&o!==void 0?o:this._region.getLayoutRect().height/2]},e.angle=i=>{var n;const r=i[cr];return((n=this._spec.label)===null||n===void 0?void 0:n.position)==="inside"?Zl(r):0},this.setMarkStyle(t,Object.assign(Object.assign({},e),{z:100}),void 0,Q.Mark)}}Bd.type=j.pie3d,Bd.mark=SD,Bd.transformerConstructor=rB;const oQ=()=>{sQ(),aQ(),I.registerSeries(Bd.type,Bd)},CM=s=>{const t=s.growField==="angle"?0:s.innerRadius;return s.growField==="angle"?{type:s.growField==="angle"?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:t,to:(e,i)=>i.getGraphicAttribute("innerRadius")},outerRadius:{from:t,to:(e,i)=>i.getGraphicAttribute("outerRadius")}}}},lQ={type:"fadeIn"},hQ=s=>({type:s.growField==="angle"?"growAngleIn":"growRadiusIn"}),dQ=s=>({type:s.growField==="angle"?"growAngleOut":"growRadiusOut"}),uQ=s=>({type:s.growField==="angle"?"growAngleOut":"growRadiusOut"});function cQ(s,t){if(t===!1)return{};switch(t){case"fadeIn":return lQ;case"growAngle":return CM(Object.assign(Object.assign({},s),{growField:"angle"}));default:return CM(Object.assign(Object.assign({},s),{growField:"radius"}))}}const pQ=()=>{I.registerAnimation("rose",(s,t)=>({appear:cQ(s,t),enter:hQ(s),exit:dQ(s),disappear:uQ(s)}))};class aB extends Ac{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(ii),this.setInnerRadiusField(qs)}setValueFieldToPercent(){this.setRadiusField(Ma),this.setInnerRadiusField(xu)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}class oB extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class pa extends aB{constructor(){super(...arguments),this.type=j.rose,this.transformerConstructor=oB,this._supportStack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t;this._roseMark=this._createMark(pa.mark.rose,{morph:Er(this._spec,pa.mark.rose.name),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,customShape:(t=this._spec.rose)===null||t===void 0?void 0:t.customShape})}getRoseAngle(){var t,e,i;return(i=(e=(t=this.angleAxisHelper).getBandwidth)===null||e===void 0?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))!==null&&i!==void 0?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:e=>this.startAngleScale(e),endAngle:e=>this.endAngleScale(e),fill:this.getColorAttribute(),outerRadius:e=>Qt(this.radiusAxisHelper.dataToPosition([e[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:e=>{var i;if(!this._stack)return 0;const n=Qt(this.radiusAxisHelper.dataToPosition([e[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return n<=Number.MIN_VALUE?this._computeLayoutRadius()*((i=this._spec.innerRadius)!==null&&i!==void 0?i:0):n}}),this._trigger.registerMark(t))}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){var e,i,n,r,a,o,l,h;t&&this.setMarkStyle(t,{visible:(i=(e=this._spec)===null||e===void 0?void 0:e.label)===null||i===void 0?void 0:i.visible,text:d=>d[this.getDimensionField()[0]],fill:((r=(n=this._spec.label)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.fill)||this.getColorAttribute(),angle:(o=(a=this._spec.label)===null||a===void 0?void 0:a.style)===null||o===void 0?void 0:o.angle,limit:(h=(l=this._spec.label)===null||l===void 0?void 0:l.style)===null||h===void 0?void 0:h.limit,z:0})}initAnimation(){var t,e,i;const n=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;if(this._roseMark){const r={innerRadius:()=>{var a;return this._computeLayoutRadius()*((a=this._spec.innerRadius)!==null&&a!==void 0?a:0)}};this._roseMark.setAnimationConfig(Ft((i=I.getAnimationInKey("rose"))===null||i===void 0?void 0:i(r,n),Ut("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}pa.type=j.rose,pa.mark=AD,pa.transformerConstructor=oB;const gQ=()=>{I.registerSeries(pa.type,pa),kc(),pQ()};class fQ extends os{constructor(t,e,i,n,r){super(t,e,i,n,r);const a=this.params.pointToCoord,o=this.params.coordToPoint;q(a)&&q(o)||(this.valid=!1),this._pointToCoord=a,this._coordToPoint=o}getEndProps(){return this.valid===!1?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);H(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);H(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(this.valid!==!1)if(t){const{x:n,y:r}=this.getEndProps();i.x=n,i.y=r}else{const{x:n,y:r}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=n,i.y=r}}}class _Q extends EE{constructor(t,e,i,n,r){super(t,e,i,n,r);const a=this.params.pointToCoord,o=this.params.coordToPoint;this._pointToCoord=a,this._coordToPoint=o}onUpdate(t,e,i){this.points=this.points.map((n,r)=>{const a=this.polarPointInterpolation(this.interpolatePoints[r][0],this.interpolatePoints[r][1],e);return a.context=n.context,a}),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),r=this._pointToCoord({x:t.x1,y:t.y1}),a=this._pointToCoord(e),o=this._pointToCoord({x:e.x1,y:e.y1}),l=n.angle+(a.angle-n.angle)*i,h=n.radius+(a.radius-n.radius)*i,d=r.angle+(o.angle-r.angle)*i,u=r.radius+(o.radius-r.radius)*i,{x:c,y:p}=this._coordToPoint({angle:l,radius:h}),{x:g,y:f}=this._coordToPoint({angle:d,radius:u}),_=new De(c,p,g,f);return _.defined=e.defined,_}}const lB=s=>({type:s==="in"?"fadeIn":"fadeOut"}),mQ=(s,t)=>({type:t==="in"?"growPointsIn":"growPointsOut",options:()=>({center:s.center()})});function gp(s,t,e){return t==="fadeIn"?lB(e):mQ(s,e)}const vQ=(s,t)=>{const e=()=>{var a;return(a=s.center())===null||a===void 0?void 0:a.x},i=(a,o)=>o.getGraphicAttribute("x"),n=()=>{var a;return(a=s.center())===null||a===void 0?void 0:a.y},r=(a,o)=>o.getGraphicAttribute("y");return t==="in"?{channel:{x:{from:e,to:i},y:{from:n,to:r}}}:{channel:{x:{from:i,to:e},y:{from:r,to:n}}}};function PM(s,t,e){return t==="fadeIn"?lB(e):vQ(s,e)}const EM=(s,t)=>({custom:yz,customParameters:(e,i)=>{var n;return{group:i.getGraphicItem(),startAngle:(n=s.startAngle)!==null&&n!==void 0?n:Math.PI/2,orient:"clockwise",center:s.center(),radius:s.radius(),animationType:t}}}),yQ=()=>{I.registerAnimation("radar",(s,t)=>({appear:t==="clipIn"?void 0:gp(s,t,"in"),enter:gp(s,t,"in"),exit:gp(s,t,"out"),disappear:t==="clipIn"?void 0:gp(s,t,"out"),update:[{options:{excludeChannels:["points","defined"]}},{channel:["points"],custom:_Q,customParameters:s,duration:ea.update.duration,easing:ea.update.easing}]})),I.registerAnimation("radarSymbol",(s,t)=>({appear:t==="clipIn"?void 0:PM(s,t,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:t==="clipIn"?void 0:PM(s,t,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:fQ,customParameters:s,duration:ea.update.duration,easing:ea.update.easing}]})),I.registerAnimation("radarGroup",(s,t)=>({appear:EM(s,"in"),disappear:EM(s,"out")}))};class na extends aB{constructor(){super(...arguments),this.type=j.radar,this.transformerConstructor=yc,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,n;const r={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},a=((t=this._spec.area)===null||t===void 0?void 0:t.visible)!==!1&&((i=(e=this._spec.area)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.visible)!==!1,o=(n=this._spec.seriesMark)!==null&&n!==void 0?n:"area";this.initAreaMark(r,a&&o==="area"),this.initLineMark(r,o==="line"||o==="area"&&!a),this.initSymbolMark(r,o==="point")}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){var i;this._areaMark=this._createMark(na.mark.area,{progressive:t,isSeriesMark:e,customShape:(i=this._spec.area)===null||i===void 0?void 0:i.customShape})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:e=>e&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(e,this._angleField),this._stack?this.getDatumPositionValues(e,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:e=>!e||!this.angleAxisHelper||!this.radiusAxisHelper?Number.NaN:this.valueToPosition(this.getDatumPositionValues(e,this._angleField),this._stack?this.getDatumPositionValues(e,this._innerRadiusField):this.radiusScale.domain()[0]).y,fill:this.getColorAttribute(),curveType:PL,closePath:!0},"normal",Q.Series),this._invalidType!=="zero"&&this.setMarkStyle(t,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",Q.Series),this.event.on(bt.viewDataStatisticsUpdate,{filter:e=>e.model===this},()=>{this.encodeDefined(t,"defined")}),this._trigger.registerMark(t))}initTooltip(){super.initTooltip(),this._lineMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark),this._areaMark&&this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark)}initAnimation(){var t,e,i,n;const r={center:()=>{var o;return(o=this.angleAxisHelper)===null||o===void 0?void 0:o.center()},radius:()=>{const o=this.getLayoutRect();return Math.min(o.width,o.height)},startAngle:E(this._spec.startAngle)?le(this._spec.startAngle):N_,pointToCoord:o=>{var l;return(l=this.angleAxisHelper)===null||l===void 0?void 0:l.pointToCoord(o)},coordToPoint:o=>this.angleAxisHelper.coordToPoint(o)},a=(i=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset)!==null&&i!==void 0?i:"clipIn";a==="clipIn"&&this._rootMark&&this._rootMark.setAnimationConfig(Ft((n=I.getAnimationInKey("radarGroup"))===null||n===void 0?void 0:n(r,a),Ut("group",this._spec,this._markAttributeContext))),[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach(([o,l])=>{if(E(o)){const h=I.getAnimationInKey(l);o.setAnimationConfig(Ft(h==null?void 0:h(r,a),Ut(o.name,this._spec,this._markAttributeContext)))}})}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,n,r,a;let o=(n=(i=this._seriesMark)===null||i===void 0?void 0:i.getAttribute(e,t))!==null&&n!==void 0?n:void 0;return e!=="fill"||o||(e="stroke",o=(a=(r=this._seriesMark)===null||r===void 0?void 0:r.getAttribute(e,t))!==null&&a!==void 0?a:void 0),e==="stroke"&&U(o)?o[0]:o}}}na.type=j.radar,na.mark=bD,na.transformerConstructor=yc,ci(na,hS);const bQ=()=>{Yx(),uS(),dS(),Ia(),yQ(),I.registerSeries(na.type,na)};class xQ extends hs{updateTooltipSpec(){var t;super.updateTooltipSpec(),E((t=this.spec)===null||t===void 0?void 0:t.mark)&&(this.spec.mark.updateContent=(e,i,n)=>{const r=[],a=e.filter(o=>o.key==="children");return a.length>0&&a[0].value.forEach(o=>{let l=!0;for(const h in o)r.push({shapeType:"circle",hasShape:l,shapeColor:this.contentShapeColorCallback(i[0].datum[0]),shapeStroke:this.contentShapeColorCallback(i[0].datum[0]),key:h,value:o[h]+""}),l=!1}),e.concat(r)})}getDefaultTooltipPattern(t){return t==="mark"?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:e=>e.type,value:e=>e.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"event_time",value:e=>$r.getInstance().timeFormat("%Y%m%d",e.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"action_type",value:e=>e.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"children",value:e=>e.children}],updateContent:(e,i,n)=>{const r=[];return e[3].value.forEach(a=>{let o=!0;for(const l in a)r.push({shapeType:"circle",hasShape:o,shapeColor:this.contentShapeColorCallback(i[0].datum[0]),shapeStroke:this.contentShapeColorCallback(i[0].datum[0]),key:l,value:a[l]+""}),o=!1}),e.concat(r)}}:null}}const SQ=(s,t)=>{var e;const i=!((e=s[0])===null||e===void 0)&&e.latestData?s[0].latestData:s||[],n=[];return i.forEach(r=>{const a={};for(const l in r)l!==t&&(a[l]=r[l]);const o=r[t];o==null||o.forEach(l=>{n.push(Object.assign({},a,l))})}),n},AQ={fill:"#bbb",fillOpacity:.2};class ws extends en{constructor(){super(...arguments),this.type=j.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){E(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){E(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){E(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){E(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){E(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){E(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map(e=>e[this._fieldY[0]]),Mt(this._option.dataSet,"objFlat",SQ),Mt(this._option.dataSet,"copyDataView",pm),mr(this._option.dataSet,"dataview",A_),(t=this.getViewData())===null||t===void 0||t.transform({type:"objFlat",options:"dots",level:Es.dotObjFlat},!1)}setSeriesField(t){E(t)&&(this._seriesField=t,this.getMarksInType(["line","area"]).forEach(e=>{e.setFacet(this._seriesField)}))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(_t(AQ,((t=this._spec.grid)===null||t===void 0?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(ws.mark.group),this._containerMark=this._createMark(ws.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(ws.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(ws.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(ws.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(ws.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(ws.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(ws.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",Q.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",Q.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",Q.Series),this._trigger.registerMark(i));const n=this._gridMark;n&&(this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",Q.Series),this._trigger.registerMark(n));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",Q.Series),this._trigger.registerMark(r));const a=this._titleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:h=>h[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",Q.Series),this._trigger.registerMark(a));const o=this._subTitleMark;o&&(this.setMarkStyle(o,{fill:this.getColorAttribute(),text:h=>h[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",Q.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",Q.Series),this._trigger.registerMark(l))}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,n,r;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:a,getScale:o}=this._xAxisHelper;return a(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})<o(0).range()[0]||a(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})>o(0).range()[1]?0:(r=(n=(i=(e=this._theme)===null||e===void 0?void 0:e.dot)===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.fillOpacity)!==null&&r!==void 0?r:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const n=(i=(e=this._spec)===null||e===void 0?void 0:e.leftAppendPadding)!==null&&i!==void 0?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+n},"normal",Q.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?(t=this.getViewDataStatistics())===null||t===void 0?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?(e=this.getViewDataStatistics())===null||e===void 0?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:(t=this._option.globalScale.getScale("color"))!==null&&t!==void 0?t:this._getDefaultColorScale(),field:(i=(e=this._seriesGroupField)!==null&&e!==void 0?e:this._seriesField)!==null&&i!==void 0?i:Ms}}getDotColorScale(){var t,e,i;const n=this._dotTypeField?(t=this.getViewDataStatistics())===null||t===void 0?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?(e=this.getViewDataStatistics())===null||e===void 0?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?(i=this.getViewDataStatistics())===null||i===void 0?void 0:i.latestData[this._seriesField].values:[],r=this._getDataScheme();return new _c().domain(n).range(r)}getDotColorAttribute(){var t,e,i,n;return{scale:(t=this._option.globalScale.getScale("color"))!==null&&t!==void 0?t:this.getDotColorScale(),field:(n=(i=(e=this._dotTypeField)!==null&&e!==void 0?e:this._seriesGroupField)!==null&&i!==void 0?i:this._seriesField)!==null&&n!==void 0?n:Ms}}initTooltip(){this._tooltipHelper=new xQ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach(e=>{e.type==="group"?this.onMarkTreePositionUpdate(e.getMarks()):e.updateLayoutState()})}getDotData(){var t;return(t=this._dotMark)===null||t===void 0?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}ws.type=j.dot,ws.mark=MD;const kQ=()=>{Ia(),Sc(),Fa(),Os(),I.registerSeries(ws.type,ws)};class wQ extends hs{getDefaultTooltipPattern(t){return t==="mark"?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"time",value:e=>$r.getInstance().timeFormat("%Y%m%d %H:%M",e.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"type",value:e=>e.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"from",value:e=>e.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,key:"to",value:e=>e.to}]}:null}}const TQ=(s,t)=>{const{infoKey:e,fields:i,linkData:n,dotData:r}=t,{fromField:a,toField:o,xField:l,yField:h}=i(),d=n(),u=r(),c={};return u.forEach(p=>{const g={};for(const _ in p)_!==e&&(g[_]=p[_]);const f=p[e];f==null||f.forEach(_=>{c[_.node_name]=Object.assign({},g,_)})}),d.forEach(p=>{var g,f,_,m;p[a+"_xField"]=(g=c==null?void 0:c[p[a]])===null||g===void 0?void 0:g[l],p[a+"_yField"]=(f=c==null?void 0:c[p[a]])===null||f===void 0?void 0:f[h],p[o+"_xField"]=(_=c==null?void 0:c[p[o]])===null||_===void 0?void 0:_[l],p[o+"_yField"]=(m=c==null?void 0:c[p[o]])===null||m===void 0?void 0:m[h]}),d};class fr extends en{constructor(){super(...arguments),this.type=j.link}getFromField(){return this._fromField}setFromField(t){E(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){E(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){E(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){E(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),Mt(this._option.dataSet,"linkDotInfo",TQ),(t=this.getViewData())===null||t===void 0||t.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:Es.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(fr.mark.group),this._containerMark=this._createMark(fr.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(fr.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(fr.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",Q.Series),r.setInteractive(!1));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",Q.Series),a.setInteractive(!1));const o=this._linkMark;o&&(this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",Q.Series),this._trigger.registerMark(o));const l=this._arrowMark;if(l){const h=(n=(i=(e=(t=this._theme)===null||t===void 0?void 0:t.arrow)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.size)!==null&&n!==void 0?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:d=>this.dataToPositionArrowYTo(d,h),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:h,symbolType:d=>this.isPositionYFromHigher(d)?"triangleDown":"triangleUp"},"normal",Q.Series),this._trigger.registerMark(l)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)<this.dataToPositionYTo(t)}isPositionXOuterRange(t,e){if(!this._xAxisHelper)return!1;const{dataToPosition:i,getScale:n}=this._xAxisHelper;return i(this.getDatumPositionValues(t,e),{bandPosition:this._bandPosition})<n(0).range()[0]||i(this.getDatumPositionValues(t,e),{bandPosition:this._bandPosition})>n(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?(t=this.getViewDataStatistics())===null||t===void 0?void 0:t.latestData[this._dotTypeField].values:this._seriesField?(e=this.getViewDataStatistics())===null||e===void 0?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:(t=this._option.globalScale.getScale("color"))!==null&&t!==void 0?t:this._getDefaultColorScale(),field:(i=(e=this._dotTypeField)!==null&&e!==void 0?e:this._seriesField)!==null&&i!==void 0?i:Ms}}initTooltip(){this._tooltipHelper=new wQ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach(e=>{e.type==="group"?this.onMarkTreePositionUpdate(e.getMarks()):e.updateLayoutState()})}getDotInfoData(){var t,e;return(e=(t=this._linkMark)!==null&&t!==void 0?t:this._arrowMark)===null||e===void 0?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}fr.type=j.link,fr.mark=TD;const MQ=()=>{Sc(),Ia(),I.registerSeries(fr.type,fr)};class Lh extends Ac{constructor(){super(...arguments),this._supportStack=!0,this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if(i!=null&&i.forceAlign&&this._isTickMaskVisible(e)){const n=t[this._stack?qs:jp],r=this._getAngleAxisSubTickData(e),a=r[1].value-r[0].value,o=le(i.offsetAngle);let l;if(E(n)){const h=Gk(r,u=>u.value-n),d=n>r[h].value-a/2?Math.min(h,r.length-1):h>0?h-1:void 0;d!==void 0&&(l=this.angleAxisHelper.dataToPosition([r[d].value-a/2]))}return C(l)&&(l=this.angleAxisHelper.dataToPosition([r[0].value-a/2])),l+o}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if(i!=null&&i.forceAlign&&this._isTickMaskVisible(e)){const n=t[this._stack?ii:this._angleField[0]],r=this._getAngleAxisSubTickData(e),a=r[1].value-r[0].value,o=le(i.offsetAngle),l=Gk(r,u=>u.value-n),h=n>r[l].value-a/2?Math.min(l,r.length-1):l>0?l-1:void 0;let d;return d=h!==void 0?this.angleAxisHelper.dataToPosition([r[h].value+a/2]):this.angleAxisHelper.dataToPosition([r[0].value-a/2]),d+o}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const n=(t=this._option.globalInstance.getChart())===null||t===void 0?void 0:t.getSpec(),r=(e=this._spec.startAngle)!==null&&e!==void 0?e:n==null?void 0:n.startAngle;this._startAngle=E(r)?le(r):N_;const a=(i=this._spec.endAngle)!==null&&i!==void 0?i:n==null?void 0:n.endAngle;this._endAngle=E(a)?le(a):Px,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return(t=this._angleField)===null||t===void 0?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t);if(e.fill){const i=t.fill;(i==null?void 0:i.gradient)!=="conical"||E(i==null?void 0:i.startAngle)||E(i==null?void 0:i.endAngle)||(e.fill=Object.assign(Object.assign({},i),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this._stack){const e=Qt(this.angleAxisHelper.dataToPosition([t[qs]]),this.angleAxisHelper.getScale(0));if(H(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this._stack){const e=Qt(this.angleAxisHelper.dataToPosition([t[ii]]),this.angleAxisHelper.getScale(0));if(H(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(Lh.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const e=this._getAngleAxis();if(this._isTickMaskVisible(e)){const{tickMask:r}=this._spec,{angle:a,offsetAngle:o,style:l={}}=r,h=this._getAngleAxisSubTickData(e),{x:d,y:u}=this.angleAxisHelper.center(),c=this._computeLayoutRadius(),p=l;return h.map(({value:g})=>{const f=this.angleAxisHelper.dataToPosition([g])+le(o),_=le(a)/2;return px(Object.assign(Object.assign({},p),{x:d,y:u,startAngle:f-_,endAngle:f+_,innerRadius:c*this._innerRadius,outerRadius:c*this._outerRadius,fill:!0}))})}const{width:i,height:n}=this.getLayoutRect();return[nh({width:i,height:n,fill:!0})]}},"normal",Q.Series),this._arcGroupMark.setInteractive(!1)}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find(e=>e.id===t)}_getAngleAxisTickData(t){var e;return(e=t==null?void 0:t.getTickData())===null||e===void 0?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&i.visible!==!1&&(e==null?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),n=[],{subTick:r={},tick:a={}}=(e=t==null?void 0:t.getSpec())!==null&&e!==void 0?e:{},{tickCount:o=4}=r,{alignWithLabel:l}=a;if((i==null?void 0:i.length)>=2){const h=i[1].value-i[0].value;for(let d=0;d<i.length-1;d++){const u=i[d],c=i[d+1];n.push(u);for(let p=0;p<o;p++){const g=(p+1)/(o+1),f=(1-g)*u.value+g*(c?c.value:l?1:u.value+h);n.push({value:f})}}return n.push(i[i.length-1]),n}return i}}Lh.mark=qx;class Vf extends gS{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(t,e,i,n=this.stateStyle){var r,a,o,l,h,d,u,c,p,g,f,_,m,v,y,b,x,S;E(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),E(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const A=(r=t.innerPadding)!==null&&r!==void 0?r:(o=(a=n[e])===null||a===void 0?void 0:a.innerPadding)===null||o===void 0?void 0:o.style,k=(l=t.outerPadding)!==null&&l!==void 0?l:(d=(h=n[e])===null||h===void 0?void 0:h.outerPadding)===null||d===void 0?void 0:d.style,w=(g=(u=t.innerRadius)!==null&&u!==void 0?u:(p=(c=this._cacheStateStyle[e])===null||c===void 0?void 0:c.innerRadius)===null||p===void 0?void 0:p.style)!==null&&g!==void 0?g:(_=(f=n[e])===null||f===void 0?void 0:f.innerRadius)===null||_===void 0?void 0:_.style,T=(b=(m=t.outerRadius)!==null&&m!==void 0?m:(y=(v=this._cacheStateStyle[e])===null||v===void 0?void 0:v.outerRadius)===null||y===void 0?void 0:y.style)!==null&&b!==void 0?b:(S=(x=n[e])===null||x===void 0?void 0:x.outerRadius)===null||S===void 0?void 0:S.style;if(w===0&&T===0)return t;const M=E(t.innerPadding)&&E(w)||E(t.outerPadding)&&E(T),P=E(t.innerRadius)&&A||E(t.outerRadius)&&k;if(M||P){const O=Object.assign({},t);return A&&E(w)&&(q(w)?O.innerRadius=(D,R,L,B)=>w(D,R,L,B)+(q(A)?A(D,R,L,B):A):q(A)?O.innerRadius=(D,R,L,B)=>{const F=A(D,R,L,B);return w+F}:O.innerRadius=w+A),k&&E(T)&&(q(T)?O.outerRadius=(D,R,L,B)=>T(D,R,L,B)-(q(k)?k(D,R,L,B):k):q(k)?O.outerRadius=(D,R,L,B)=>{const F=k(D,R,L,B);return T-F}:O.outerRadius=T-k),O}return t}}Vf.type="arc",Vf.constructorType="progressArc";const hB=()=>{YO(),aS(),I.registerMark(Vf.constructorType,Vf)},CQ=s=>({type:"growAngleIn",options:{overall:s.startAngle}}),PQ={type:"fadeIn"};function EQ(s,t){return t==="fadeIn"?PQ:CQ(s)}const dB=()=>{I.registerAnimation("circularProgress",(s,t)=>({appear:EQ(s,t),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}))};class _o extends Lh{constructor(){super(...arguments),this.type=j.circularProgress,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(H(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const n=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+((i=(e=this.radiusAxisHelper).getBandwidth)===null||i===void 0?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(H(n))return n}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(_o.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,customShape:(t=this._spec.progress)===null||t===void 0?void 0:t.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:(t=this._spec.roundCap)!==null&&t!==void 0&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",Q.Series),this._trigger.registerMark(e))}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t;return this._trackMark=this._createMark(_o.mark.track,{parent:this._arcGroupMark,customShape:(t=this._spec.track)===null||t===void 0?void 0:t.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{visible:e=>{const i=this.angleAxisHelper.getScale(0).range(),n=Math.min(i[0],i[i.length-1]),r=this._getAngleValueStartWithoutMask(e);return Math.abs(r-n)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const e=this._stack?qs:this._angleField[0],i=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[e]:i[0]})},endAngle:()=>{const e=this._stack?ii:this._angleField[0],i=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[e]:i[i.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",Q.Series),this._trigger.registerMark(t))}initAnimation(){var t,e,i,n;const r=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this._progressMark.setAnimationConfig(Ft((i=I.getAnimationInKey("circularProgress"))===null||i===void 0?void 0:i({startAngle:this._startAngle},r),Ut("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Ft((n=I.getAnimationInKey("fadeInOut"))===null||n===void 0?void 0:n(),Ut("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}_o.type=j.circularProgress,_o.mark=wD;const RQ=()=>{hB(),kc(),dB(),Pr(),I.registerSeries(_o.type,_o)};function uB(s){return()=>s.direction==="vertical"?{orient:"negative"}:{orient:"positive"}}const OQ=s=>({type:s.direction==="horizontal"?"growWidthIn":"growHeightIn",options:uB(s)}),DQ=s=>({type:s.direction==="horizontal"?"growWidthOut":"growHeightOut",options:uB(s)}),LQ={type:"fadeIn"};function BQ(s,t){return t===!1?{}:t==="fadeIn"?LQ:OQ(s)}const IQ=()=>{I.registerAnimation("linearProgress",(s,t)=>({appear:BQ(s,t),enter:{type:"grow"},disappear:DQ(s)}))};class FQ extends hs{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return t==="mark"?i:t==="dimension"?(i.visible=!1,i):null}}class ga extends en{constructor(){super(...arguments),this.type=j.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this._initProgressGroupMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initProgressGroupMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(ga.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark,customShape:(t=this._spec.progress)===null||t===void 0?void 0:t.customShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,n,r,a,o,l;const h=this._progressMark;if(h){if(this._spec.direction==="vertical"){const d=(e=(t=this._spec.progress)===null||t===void 0?void 0:t.leftPadding)!==null&&e!==void 0?e:0,u=(n=(i=this._spec.progress)===null||i===void 0?void 0:i.rightPadding)!==null&&n!==void 0?n:0;this.setMarkStyle(h,{x:c=>{var p,g;return Qt(this.dataToPositionX(c),(g=(p=this._xAxisHelper)===null||p===void 0?void 0:p.getScale)===null||g===void 0?void 0:g.call(p,0))-this._spec.bandWidth/2+d},y:c=>{var p,g;return Qt(this.dataToPositionY(c),(g=(p=this._yAxisHelper)===null||p===void 0?void 0:p.getScale)===null||g===void 0?void 0:g.call(p,0))},height:()=>{var c;return(c=this._yAxisHelper)===null||c===void 0?void 0:c.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-d-u,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",Q.Series)}else{const d=(a=(r=this._spec.progress)===null||r===void 0?void 0:r.topPadding)!==null&&a!==void 0?a:0,u=(l=(o=this._spec.progress)===null||o===void 0?void 0:o.bottomPadding)!==null&&l!==void 0?l:0;this.setMarkStyle(h,{x:c=>{var p,g;return Qt(this.dataToPositionX(c),(g=(p=this._xAxisHelper)===null||p===void 0?void 0:p.getScale)===null||g===void 0?void 0:g.call(p,0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:c=>{var p,g;return Qt(this.dataToPositionY(c),(g=(p=this._yAxisHelper)===null||p===void 0?void 0:p.getScale)===null||g===void 0?void 0:g.call(p,0))-this._spec.bandWidth/2+d},height:this._spec.bandWidth-d-u,width:()=>{var c;return(c=this._xAxisHelper)===null||c===void 0?void 0:c.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",Q.Series)}this._trigger.registerMark(h)}}_initTrackMark(){var t;return this._trackMark=this._createMark(ga.mark.track,{parent:this._progressGroupMark,customShape:(t=this._spec.track)===null||t===void 0?void 0:t.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&(this._spec.direction==="vertical"?this.setMarkStyle(t,{x:e=>{var i,n;return Qt(this.dataToPositionX(e),(n=(i=this._xAxisHelper)===null||i===void 0?void 0:i.getScale)===null||n===void 0?void 0:n.call(i,0))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",Q.Series):this.setMarkStyle(t,{x:0,y:e=>{var i,n;return Qt(this.dataToPositionY(e),(n=(i=this._yAxisHelper)===null||i===void 0?void 0:i.getScale)===null||n===void 0?void 0:n.call(i,0))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",Q.Series),this._trigger.registerMark(t))}_initProgressGroupMark(){return this._progressGroupMark=this._createMark(ga.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}_initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{var e;const i=[];return(e=this._rawData)===null||e===void 0||e.rawData.forEach((n,r)=>{var a,o,l,h;if(this._spec.direction==="vertical"){const d=Qt(this.dataToPositionX(n),(o=(a=this._xAxisHelper)===null||a===void 0?void 0:a.getScale)===null||o===void 0?void 0:o.call(a,0))-this._spec.bandWidth/2,u=this._scaleY.range()[0];i.push(nh({x:d,y:0,height:u,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const d=Qt(this.dataToPositionY(n),(h=(l=this._yAxisHelper)===null||l===void 0?void 0:l.getScale)===null||h===void 0?void 0:h.call(l,0))-this._spec.bandWidth/2,u=this._scaleX.range()[1];i.push(nh({x:0,y:d,height:this._spec.bandWidth,width:u,cornerRadius:this._spec.cornerRadius,fill:!0}))}}),i}},"normal",Q.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var t,e,i,n;const r={direction:this.direction},a=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this._progressMark.setAnimationConfig(Ft((i=I.getAnimationInKey("linearProgress"))===null||i===void 0?void 0:i(r,a),Ut("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Ft((n=I.getAnimationInKey("fadeInOut"))===null||n===void 0?void 0:n(),Ut("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new FQ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}ga.type=j.linearProgress,ga.mark=ED;const jQ=()=>{Fa(),IQ(),Pr(),I.registerSeries(ga.type,ga)},RM=[0],zQ="hidden",OM=20,HQ=[20,40],GQ=[200,500],WQ="circle",NQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},VQ=!0,DM=1,UQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],LM=`${xt}_WORD_CLOUD_ANGLE`,$Q=`${xt}_WORD_CLOUD_FILLING_ANGLE`,jv=`${xt}_WORD_CLOUD_WEIGHT`,BM=`${xt}_WORD_CLOUD_TEXT`;class fa extends go{constructor(){super(...arguments),this._fontSizeRange=[OM,OM],this._isWordCloudShape=!1}setValueField(t){E(t)&&(this._valueField=t)}setFontSizeRange(t){E(t)?this._fontSizeRange=t:this._fontSizeRange=HQ}setAttrFromSpec(){var t,e,i,n,r,a,o,l,h,d;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=(t=this._spec.colorMode)!==null&&t!==void 0?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=(e=this._spec.fontWeightRange)!==null&&e!==void 0?e:GQ,this._rotateAngles=(i=this._spec.rotateAngles)!==null&&i!==void 0?i:RM,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=(n=this._spec.maskShape)!==null&&n!==void 0?n:WQ,this._keepAspect=this._spec.keepAspect,this._random=(r=this._spec.random)!==null&&r!==void 0?r:VQ,this._fontPadding=(o=(a=this._spec.word)===null||a===void 0?void 0:a.padding)!==null&&o!==void 0?o:DM,this._textField=!((l=this._spec.word)===null||l===void 0)&&l.formatMethod?BM:this._nameField,this._wordCloudConfig=Object.assign({drawOutOfBound:zQ,layoutMode:"default",zoomToFit:NQ},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:RM,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._fillingFontPadding=(d=(h=this._spec.fillingWord)===null||h===void 0?void 0:h.padding)!==null&&d!==void 0?d:DM,this._isWordCloudShape=!UQ.includes(this._maskShape),this._defaultFontFamily=this._option.getTheme().fontFamily}initMark(){this._wordMark=this._createMark(fa.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(fa.mark.fillingWord))}initMarkStyle(){var t,e,i,n,r;const a=this._wordMark,o=this._fillingWordMark,l=(t=this._spec.word)!==null&&t!==void 0?t:{};a&&(this.setMarkStyle(a,{fill:this._colorHexField?h=>h[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:h=>h[this._textField],x:h=>h.x,y:h=>h.y,fontFamily:h=>h.fontFamily,fontSize:h=>h.fontSize,fontStyle:h=>h.fontStyle,fontWeight:h=>h.fontWeight,angle:h=>h.angle,visible:h=>!h.isFillingWord&&h.visible},"normal",Q.Series),this.setMarkStyle(a,{fontFamily:(i=(e=l.style)===null||e===void 0?void 0:e.fontFamily)!==null&&i!==void 0?i:this._defaultFontFamily},"normal",Q.User_Mark)),o&&(this.setMarkStyle(o,{fill:this._wordCloudShapeConfig.fillingColorHexField?h=>h[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:h=>h[this._textField],x:h=>h.x,y:h=>h.y,fontFamily:h=>h.fontFamily,fontSize:h=>h.fontSize,fontStyle:h=>h.fontStyle,fontWeight:h=>h.fontWeight,angle:h=>h.angle,visible:h=>h.isFillingWord&&h.visible},"normal",Q.Series),this.setMarkStyle(o,{fontFamily:(r=(n=l.style)===null||n===void 0?void 0:n.fontFamily)!==null&&r!==void 0?r:this._defaultFontFamily},"normal",Q.User_Mark)),this._trigger.registerMark(a),this._trigger.registerMark(o)}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark),this._fillingWordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._fillingWordMark)}initAnimation(){[this._wordMark,this._fillingWordMark].forEach(t=>{var e,i;if(t){const n=(i=(e=this._spec)===null||e===void 0?void 0:e.animationAppear)===null||i===void 0?void 0:i.preset,r={animationConfig:()=>{var a,o;return(o=(a=t.getAnimationConfig())===null||a===void 0?void 0:a.appear)===null||o===void 0?void 0:o[0]}};t.setAnimationConfig(Ft(I.getAnimationInKey("wordCloud")(r,n),Ut("word",this._spec,this._markAttributeContext)))}})}getWordOrdinalColorScale(t,e){var i,n,r,a,o;const l=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,h=t?(i=this.getViewData())===null||i===void 0?void 0:i.latestData.map(u=>u[t]):[],d=(r=l??((n=this._option.globalScale.getScale("color"))===null||n===void 0?void 0:n.range()))!==null&&r!==void 0?r:this._getDataScheme();return(o=(a=new _c().domain(h)).range)===null||o===void 0?void 0:o.call(a,d)}getWordColorAttribute(t,e){var i,n;if(this._colorMode==="ordinal")return{scale:this.getWordOrdinalColorScale(t,e),field:(i=this._seriesField)!==null&&i!==void 0?i:Ms};let r=(n=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)!==null&&n!==void 0?n:this._option.globalScale.getScale("color").range();return r.length===1&&(r=[r[0],r[0]]),a=>r[0]}compile(){var t,e;super.compile();const{width:i,height:n}=this._region.getLayoutRect();if(!H(i)||!H(n)||!(n>0&&i>0))return;const r=[],a=this._valueField,o=new Qs,l=this._fontWeightRange,h=this._rotateAngles,d=this._wordCloudShapeConfig.fillingRotateAngles;if(a){const[c,p]=vy((t=this.getViewData())===null||t===void 0?void 0:t.latestData.map(g=>+g[a]));o.domain([c,p],!0).range(l),r.push({type:"map",as:jv,callback:g=>c===p?o.scale(p):o.scale(g[a])})}r.push({type:"map",as:LM,callback:()=>h[Math.floor(Math.random()*h.length)]}),r.push({type:"map",as:$Q,callback:()=>d[Math.floor(Math.random()*d.length)]});const u=(e=this._spec.word)!==null&&e!==void 0?e:{};u.formatMethod&&r.push({type:"map",as:BM,callback:u.formatMethod}),this._isWordCloudShape?r.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):(r.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.getProduct().transform(r)),this._data.getProduct().transform(r)}_wordCloudTransformOption(){var t,e,i,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=(e=(t=this._spec.word)===null||t===void 0?void 0:t.style)!==null&&e!==void 0?e:{};return{layoutType:Xs(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[a,o],shape:this._maskShape,dataIndexKey:$n,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange==="auto"?null:this._fontSizeRange,padding:this._fontPadding,rotate:{field:LM},fontFamily:(n=(i=this._fontFamilyField)!==null&&i!==void 0?i:l.fontFamily)!==null&&n!==void 0?n:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jv}:null,fontStyle:(r=this._fontStyleField)!==null&&r!==void 0?r:l.fontStyle,randomVisible:this._random,clip:this._wordCloudConfig.drawOutOfBound==="clip",shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}}_wordCloudShapeTransformOption(){var t,e,i,n,r,a,o,l,h,d;const{width:u,height:c}=this._region.getLayoutRect(),p=(e=(t=this._spec.word)===null||t===void 0?void 0:t.style)!==null&&e!==void 0?e:{},g=(i=this._wordCloudShapeConfig)!==null&&i!==void 0?i:{},f=this._wordCloudShapeConfig.fillingRotateAngles;return{dataIndexKey:$n,size:[u,c],shape:this._maskShape,text:{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange==="auto"?null:this._fontSizeRange,padding:this._fontPadding,rotateList:this._rotateAngles,fontFamily:(r=(n=this._fontFamilyField)!==null&&n!==void 0?n:p.fontFamily)!==null&&r!==void 0?r:this._defaultFontFamily,fontWeight:this._fontWeightField?{field:this._fontWeightField}:this._valueField?{field:jv}:null,fontStyle:(a=this._fontStyleField)!==null&&a!==void 0?a:p.fontStyle,fillingFontFamily:(l=(o=g.fillingFontFamilyField)!==null&&o!==void 0?o:p.fontFamily)!==null&&l!==void 0?l:this._defaultFontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:(h=g.fillingFontStyleField)!==null&&h!==void 0?h:p.fontStyle,fillingFontWeight:(d=g.fillingFontWeightField)!==null&&d!==void 0?d:p.fontWeight,fillingRotateList:f,fillingTimes:g.fillingTimes,fillingXStep:g.fillingXStep,fillingYStep:g.fillingYStep,fillingXRatioStep:g.fillingXRatioStep,fillingYRatioStep:g.fillingYRatioStep,fillingInitialOpacity:g.fillingInitialOpacity,fillingDeltaOpacity:g.fillingDeltaOpacity,fillingInitialFontSize:g.fillingInitialFontSize,fillingDeltaFontSize:g.fillingDeltaFontSize,ratio:g.ratio,fillingRatio:g.fillingRatio,removeWhiteBorder:g.removeWhiteBorder,textLayoutTimes:g.textLayoutTimes,fontSizeShrinkFactor:g.fontSizeShrinkFactor,stepFactor:g.stepFactor,layoutMode:g.layoutMode,importantWordCount:g.importantWordCount,globalShinkLimit:g.globalShinkLimit,fontSizeEnlargeFactor:g.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:g.fillingDeltaFontSizeFactor}}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile()}getActiveMarks(){return[this._wordMark,this._fillingWordMark]}}fa.mark=ob;const YQ=s=>({custom:bz,customParameters:(t,e)=>s,easing:"linear",loop:1/0,duration:6e3});function XQ(s,t,e){return s*e<t?s+(t-e*s)/(e-1):(t-s)/(e-1)}const KQ=s=>({channel:{fontSize:{from:0}},duration:200,delay:(t,e,i)=>{const n=s.animationConfig(),r=(n==null?void 0:n.duration)||200,a=(n==null?void 0:n.totalTime)||ea.appear.duration,o=i.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return i.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*XQ(r,a,o)}});function qQ(s,t){return t===!1?{}:t==="fadeIn"?{type:"fadeIn"}:KQ(s)}const cB=()=>{I.registerAnimation("wordCloud",(s,t)=>({appear:qQ(s,t),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))},pB=()=>{I.registerAnimation("wordCloud3d",s=>({appear:YQ(s)}))},zv={triangleForward:ttt,triangleUpright:IM,triangle:IM,diamond:ZQ,square:QQ,star:JQ,cardioid:ett,circle:itt,pentagon:stt};function ZQ(){return function(s){const t=s%(2*Math.PI/4);return 1/(Math.cos(t)+Math.sin(t))}}function JQ(){return function(s){const t=(s+.955)%(2*Math.PI/10);return(s+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-t)+3.07768*Math.sin(2*Math.PI/10-t)):1/(Math.cos(t)+3.07768*Math.sin(t))}}function QQ(){return function(s){return Math.min(1/Math.abs(Math.cos(s)),1/Math.abs(Math.sin(s)))}}function IM(){return function(s){const t=(s+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(t)+Math.sqrt(3)*Math.sin(t))}}function ttt(){return function(s){const t=s%(2*Math.PI/3);return 1/(Math.cos(t)+Math.sqrt(3)*Math.sin(t))}}function ett(){return function(s){return 1-Math.sin(s)}}function itt(){return function(){return 1}}function stt(){return function(s){const t=(s+.955)%(2*Math.PI/5);return 1/(Math.cos(t)+.726543*Math.sin(t))}}function gB(s,t){const e=t[0],i=t[1];let n=1;const r=[t[0]>>1,t[1]>>1];switch(s){case"cardioid":r[1]=~~(i/2.7*.6),n=Math.floor(Math.min(e/2.3,i/2.6));break;case"triangleForward":n=i/Math.sqrt(.75)>e?Math.floor(e/2):Math.floor(i/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(i/1.5),n=Math.floor(Math.min(i/1.5,e/2));break;case"rect":n=Math.floor(Math.max(i/2,e/2));break;default:n=Math.floor(Math.min(e/2,i/2))}return{maxRadius:n,center:r}}const ntt=s=>zv[s]?zv[s]():zv.circle(),FM=(s,t)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(t-s)+s).toFixed()+"%)";function Va(s){return q(s)?s:function(){return s}}class Bh{constructor(t){var e,i;switch(this.options=at({},Bh.defaultOptions,t),q(this.options.shape)?this.shape=this.options.shape:this.shape=ntt(this.options.shape),this.getText=(e=Va(this.options.text))!==null&&e!==void 0?e:n=>n,this.getTextFontWeight=Va(this.options.fontWeight),this.getTextFontSize=Va(this.options.fontSize),this.getTextFontStyle=Va(this.options.fontStyle),this.getTextFontFamily=Va(this.options.fontFamily),this.outputCallback=(i=this.options.outputCallback)!==null&&i!==void 0?i:n=>n,this.options.color){case"random-dark":this.getTextColor=()=>FM(10,50);break;case"random-light":this.getTextColor=()=>FM(50,90);break;default:this.getTextColor=Va(this.options.color)}if(C(this.options.rotate))if(this.options.useRandomRotate){const n=Math.abs(this.options.maxRotation-this.options.minRotation),r=Math.abs(Math.floor(this.options.rotationSteps)),a=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>this.options.rotateRatio===0||Math.random()>this.options.rotateRatio?0:n===0?a:r>0?a+Math.floor(Math.random()*r)*n/(r-1):a+Math.random()*n}else this.getTextRotate=()=>0;else this.getTextRotate=q(this.options.rotate)?n=>{var r;return le((r=this.options.rotate(n))!==null&&r!==void 0?r:0)}:()=>{var n;return le((n=this.options.rotate)!==null&&n!==void 0?n:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=(((t=this.currentStepIndex)!==null&&t!==void 0?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&new Date().getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=((t=this.currentStepIndex)!==null&&t!==void 0?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex<this.data.length){this.progressiveResult=[];const e=this.data.length;let i=this.progressiveIndex;for(;i<e&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.progressiveResult}return this.result}initProgressive(){this.progressiveIndex=-1,this.options.progressiveStep>0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!C(this.progressiveIndex)&&this.progressiveIndex<this.data.length}release(){this.data=null,this.result=null,this.progressiveIndex=null,this.progressiveResult=null}}Bh.defaultOptions={fontFamily:'"Trebuchet MS", "Heiti TC", "微軟正黑體", "Arial Unicode MS", "Droid Fallback Sans", sans-serif',fontWeight:"normal",color:"random-dark",fontStyle:"normal",minFontSize:12,drawOutOfBound:!1,shrink:!1,minRotation:-Math.PI/2,maxRotation:Math.PI/2,rotationSteps:0,rotateRatio:.1,random:!1,shape:"circle",progressiveTime:0,progressiveStep:0,backgroundColor:"#fff"};const jM={archimedean:rtt,rectangular:att};function rtt(s){const t=s[0]/s[1];return e=>[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}function att(s){const t=4*s[0]/s[1];let e=0,i=0;return n=>{const r=n<0?-1:1;switch(Math.sqrt(1+4*r*n)-r&3){case 0:e+=t;break;case 1:i+=4;break;case 2:e-=t;break;default:i-=4}return[e,i]}}class Xl extends Bh{constructor(t){var e;super(at({},Xl.defaultOptions,t)),this.cw=64,this.ch=2048,this._size=[256,256],this._isBoardExpandCompleted=!1,this._placeStatus=0,this._tTemp=null,this._dtTemp=null,this._dy=0,this.cacheMap=new Map,this.options.minFontSize<=Xl.defaultOptions.minFontSize&&(this.options.minFontSize=Xl.defaultOptions.minFontSize),this.spiral=ot(this.options.spiral)?(e=jM[this.options.spiral])!==null&&e!==void 0?e:jM.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=Va(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if((""+e.text).trim()==="")return!0;const{maxRadius:i,center:n}=gB(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],ott(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?htt(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(this._placeStatus===1){const r=e.fontSize*this._originSize[0]/this.options.minFontSize,a=Math.max(e.width,e.height);if(a<=r)this.expandBoard(this._board,this._bounds,a/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,r/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Ht.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let r=0;this.result=[];const a=t.map(l=>({text:this.getText(l),fontFamily:this.getTextFontFamily(l),fontStyle:this.getTextFontStyle(l),fontWeight:this.getTextFontWeight(l),angle:this.getTextRotate(l),fontSize:~~this.getTextFontSize(l),padding:this.getTextPadding(l),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:l,x:0,y:0,width:0,height:0})).sort(function(l,h){return h.fontSize-l.fontSize});this.data=a;let o=0;for(;r<n&&(this.layoutWord(r)||o>=2?(r++,o=0):o++,this.progressiveIndex=r,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const l=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(l-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),n=this.dy(),r=e[0]>>1,a=e[1]>>1,o=t.length,l=[];let h,d;for(let u=0;u<o;++u)h=t[u],d={},d.datum=h.datum,d.x=(h.x+r)*i,d.y=(h.y+a+n)*i,d.fontFamily=h.fontFamily,d.fontSize=h.fontSize*i,d.fontStyle=h.fontStyle,d.fontWeight=h.fontWeight,d.angle=h.angle,l.push(d);return l}output(){return this.outputCallback?this.outputCallback(this.formatTagItem(this.result)):this.formatTagItem(this.result)}progressiveOutput(){return this.outputCallback?this.outputCallback(this.formatTagItem(this.progressiveResult)):this.formatTagItem(this.progressiveResult)}updateBoardExpandStatus(t){this._isBoardExpandCompleted=t*(this._originSize[0]/this._size[0])<this.options.minFontSize}shouldShrinkContinue(){return!this.options.clip&&this.options.shrink&&!this._isBoardExpandCompleted}shrinkBoard(t){const e=t[0],i=t[1];if(i.x>=this._size[0]||i.y>=this._size[1])return;const n=Math.min(e.x,this._size[0]-i.x),r=Math.min(e.y,this._size[1]-i.y),a=2*Math.min(n/this._size[0],r/this._size[1]);this._size=this._size.map(o=>o*(1-a))}expandBoard(t,e,i){const n=this._size[0]*(i||1.1)-this._size[0]>>5;let r=2*n>2?n:2;r%2!=0&&r++;let a=Math.ceil(this._size[1]*(r<<5)/this._size[0]);a%2!=0&&a++;const o=this._size[0],l=this._size[1],h=new Array(r).fill(0),d=new Array(a/2*(r+(o>>5))).fill(0);this.insertZerosToArray(t,l*(o>>5),d.length+r/2);for(let u=l-1;u>0;u--)this.insertZerosToArray(t,u*(o>>5),h.length);this.insertZerosToArray(t,0,d.length+r/2),this._size=[o+(r<<5),l+a],e&&(e[0].x+=(r<<5)/2,e[0].y+=a/2,e[1].x+=(r<<5)/2,e[1].y+=a/2)}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),r=i%6e4;for(let a=0;a<n;a++)t.splice(e+6e4*a,0,...new Array(6e4).fill(0));t.splice(e+6e4*n,0,...new Array(r).fill(0))}getContext(t){t.width=1,t.height=1;const e=t.getContext("2d").getImageData(0,0,1,1),i=Math.sqrt(e.data.length>>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let r=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const a=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,a))return null;const o=e.x,l=e.y,h=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),d=this.spiral(this._size);let u,c,p,g,f=-a;for(this._tTemp=null,this._dtTemp=null;u=d(f+=a);){c=u[0],p=u[1];const _=Math.sqrt(c**2+p**2);let m=Math.atan(p/c);c<0?m+=Math.PI:p<0&&(m=2*Math.PI+m);const v=this.shape(m);if(Math.min(Math.abs(c),Math.abs(p))>=h)break;if(_>=n)r&&this._tTemp===null&&(this._tTemp=f,this._dtTemp=a);else{if(e.x=o+~~(_*v*Math.cos(-m)),e.y=l+~~(_*v*Math.sin(-m)),g=e,this.options.clip)if(this.shouldShrinkContinue()){if(Hv(g,this._size)){r&&this._tTemp===null&&(this._tTemp=f,this._dtTemp=a);continue}}else{if(utt(g,this._size)){r&&this._tTemp===null&&(this._tTemp=f,this._dtTemp=a);continue}Hv(g,this._size)&&(g=ctt(g,this._size))}else if(Hv(g,this._size)){r&&this._tTemp===null&&(this._tTemp=f,this._dtTemp=a);continue}if(r=!0,(!i||dtt(g,i))&&(!i||!ltt(g,t,this._size))){const y=g.sprite,b=g.width>>5,x=this._size[0]>>5,S=g.x-(b<<4),A=127&S,k=32-A,w=g.y1-g.y0;let T,M=(g.y+g.y0)*x+(S>>5);for(let P=0;P<w;P++){T=0;for(let O=0;O<=b;O++)t[M+O]|=T<<k|(O<b?(T=y[P*b+O])>>>A:0);M+=x}return e.sprite=null,g.sprite=null,!0}}}return this._tTemp!==null&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(g,a),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,n=t.x1-t.x0,r=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:r});const{width:a,height:o}=this.cacheMap.get(i);(n<a&&r<o||n<=a&&r<o)&&this.cacheMap.set(i,{width:n,height:r})}isSizeLargerThanMax(t,e){const i=`${t.angle}-${e}`;if(!this.cacheMap.has(i))return!1;const{width:n,height:r}=this.cacheMap.get(i),a=t.x1-t.x0,o=t.y1-t.y0;return a>=n&&o>=r}}function ott(s,t,e,i,n,r){if(t.sprite)return;const a=s.context,o=s.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,d=0;const u=e.length;let c,p,g,f,_;for(--i;++i<u;){if(t=e[i],a.save(),a.font=t.fontStyle+" "+t.fontWeight+" "+~~((t.fontSize+1)/o)+"px "+t.fontFamily,c=a.measureText(t.text+"m").width*o,g=t.fontSize<<1,t.angle){const y=Math.sin(t.angle),b=Math.cos(t.angle),x=c*b,S=c*y,A=g*b,k=g*y;c=Math.max(Math.abs(x+k),Math.abs(x-k))+31>>5<<5,g=~~Math.max(Math.abs(S+A),Math.abs(S-A))}else c=c+31>>5<<5;if(g>d&&(d=g),l+c>=n<<5&&(l=0,h+=d,d=0),h+g>=r)break;a.translate((l+(c>>1))/o,(h+(g>>1))/o),t.angle&&a.rotate(t.angle),a.fillText(t.text,0,0),t.padding&&(a.lineWidth=2*t.padding,a.strokeText(t.text,0,0)),a.restore(),t.width=c,t.height=g,t.xoff=l,t.yoff=h,t.x1=c>>1,t.y1=g>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,l+=c}const m=a.getImageData(0,0,(n<<5)/o,r/o).data,v=[];for(;--i>=0;){if(!(t=e[i]).hasText)continue;for(c=t.width,p=c>>5,g=t.y1-t.y0,f=0;f<g*p;f++)v[f]=0;if(l=t.xoff,l==null)return;h=t.yoff;let y=0,b=-1;for(_=0;_<g;_++){for(f=0;f<c;f++){const x=p*_+(f>>5),S=m[(h+_)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;v[x]|=S,y|=S}y?b=_:(t.y0++,g--,_--,h++)}t.y1=t.y0+b,t.sprite=v.slice(0,(t.y1-t.y0)*p)}}function ltt(s,t,e){const i=e[0]>>5,n=s.sprite,r=s.width>>5,a=s.x-(r<<4),o=127&a,l=32-o,h=s.y1-s.y0;let d,u=(s.y+s.y0)*i+(a>>5);for(let c=0;c<h;c++){d=0;for(let p=0;p<=r;p++)if((d<<l|(p<r?(d=n[c*r+p])>>>o:0))&t[u+p])return!0;u+=i}return!1}function htt(s,t){const e=s[0],i=s[1];t.x+t.x0<e.x&&(e.x=t.x+t.x0),t.y+t.y0<e.y&&(e.y=t.y+t.y0),t.x+t.x1>i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function dtt(s,t){return s.x+s.x1>t[0].x&&s.x+s.x0<t[1].x&&s.y+s.y1>t[0].y&&s.y+s.y0<t[1].y}Xl.defaultOptions={enlarge:!1,minFontSize:2};const utt=(s,t)=>s.x+s.x0>t[0]||s.y+s.y0>t[0]||s.x+s.x1<0||s.y+s.y1<0,Hv=(s,t)=>s.x+s.x0<0||s.y+s.y0<0||s.x+s.x1>t[0]||s.y+s.y1>t[1];function ctt(s,t){const e=s.sprite,i=s.y1-s.y0,n=s.width>>5;let r=0;const a=[],o=Math.max(-(s.y0+s.y),0),l=Math.min(i+(t[1]-(s.y1+s.y)),i),h=Math.max(-(s.x0+s.x),0)>>5,d=Math.min(n+(t[0]-(s.x1+s.x)>>5)+1,n);for(let f=0;f<i;f++){for(let _=0;_<n;_++)f<o||l<=f||_<h||d<=_||a.push(e[r+_]);r+=n}const u=h<<5,c=n-d<<5,p=o,g=i-l;return Object.assign(Object.assign({},s),{width:s.width-u-c,height:s.height-p-g,x0:s.x0+u,x1:s.x1-c,y0:s.y0+p,y1:s.y1-g,x:s.x+u/2-c/2,sprite:a})}let fB=class _B extends Bh{constructor(t){super(at({},_B.defaultOptions,t)),this.fillGridAt=(e,i)=>{e>=this.ngx||i>=this.ngy||e<0||i<0||(this.grid[e][i]=!1)},this.updateGrid=(e,i,n,r,a)=>{const o=a.occupied;let l=o.length;for(;l--;){const h=e+o[l][0],d=i+o[l][1];h>=this.ngx||d>=this.ngy||h<0||d<0||this.fillGridAt(h,d)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const n=[];for(t===0&&n.push([this.center[0],this.center[1],0]);i--;){const r=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*r*Math.cos(-i/e*2*Math.PI),this.center[1]+t*r*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t,e=1){var i;const n=this.options.clip?1:e,r=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&(i=this.getTextRotate(t))!==null&&i!==void 0?i:0,d=this.getTextFontFamily(t),u=document.createElement("canvas"),c=u.getContext("2d",{willReadFrequently:!0});c.font=l+" "+o+" "+r.toString(10)+"px "+d;const p=c.measureText(a).width,g=Math.max(r,c.measureText("m").width,c.measureText("W").width);let f=p+2*g,_=3*g;const m=Math.ceil(f/this.gridSize),v=Math.ceil(_/this.gridSize);f=m*this.gridSize,_=v*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+_*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+_*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;u.setAttribute("width",""+A),u.setAttribute("height",""+k),c.scale(1,1),c.translate(A/2,k/2),c.rotate(-h),c.font=l+" "+o+" "+r.toString(10)+"px "+d,c.fillStyle="#000",c.textBaseline="middle",c.fillText(a,y,b);const w=c.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,P=S;const O=[x/2,S/2,x/2,S/2],D=(R,L,B)=>{let F=this.gridSize;for(;F--;){let z=this.gridSize;for(;z--;)if(w[4*((L*this.gridSize+F)*A+(R*this.gridSize+z))+3])return B.push([R,L]),R<O[3]&&(O[3]=R),R>O[1]&&(O[1]=R),L<O[0]&&(O[0]=L),void(L>O[2]&&(O[2]=L))}};for(;P--;)for(M=x;M--;)D(P,M,T);return{datum:t,occupied:T,bounds:O,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:d,angle:h,text:a}}canFitText(t,e,i,n,r){let a=r.length;for(;a--;){const o=t+r[a][0],l=e+r[a][1];if(o>=this.ngx||l>=this.ngy||o<0||l<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[o][l])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],n=this.getTextInfo(i,e);if(!n||this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const o=n.bounds;if(o[1]-o[3]+1>this.ngx||o[2]-o[0]+1>this.ngy)return!1}let r=this.maxRadius+1;const a=o=>{const l=Math.floor(o[0]-n.gw/2),h=Math.floor(o[1]-n.gh/2),d=n.gw,u=n.gh;return!!this.canFitText(l,h,d,u,n.occupied)&&(n.distance=this.maxRadius-r,n.theta=o[2],this.outputText(l,h,n),this.updateGrid(l,h,d,u,n),!0)};for(;r--;){let o=this.getPointsAtRadius(this.maxRadius-r);if(this.options.random&&(o=[].concat(o),JC(o)),o.some(a))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),r={text:i.text,datum:i.datum,color:n,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(r),this.progressiveResult&&this.progressiveResult.push(r)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,r=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const a=(l,h)=>{let d=this.gridSize;for(;d--;){let u=this.gridSize;for(;u--;)for(e=4;e--;)if(r[4*((h*this.gridSize+d)*this.ngx*this.gridSize+(l*this.gridSize+u))+e]!==n[e])return void(this.grid[l][h]=!1)}};let o=this.ngx;for(;o--;){this.grid[o]=[];let l=this.ngy;for(;l--;)a(o,l),this.grid[o][l]!==!1&&(this.grid[o][l]=!0)}r=i=n=void 0}else{let i=this.ngx;for(;i--;){this.grid[i]=[];let n=this.ngy;for(;n--;)this.grid[i][n]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:n}=gB(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let r=0;for(;r<t.length&&(this.layoutWord(r),r++,this.progressiveIndex=r,!this.exceedTime()););return this.result}};fB.defaultOptions={gridSize:8,ellipticity:1};class km extends Bh{constructor(t){super(at({},km.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e<i;e++)if(ptt(t,this.result[e]))return!1;return!0}getTextInfo(t){const e={datum:t,fontSize:this.getTextFontSize(t),fontWeight:this.getTextFontWeight(t),fontStyle:this.getTextFontStyle(t),fontFamily:this.getTextFontFamily(t),angle:this.getTextRotate(t),text:this.getText(t)+"",x:this.center[0],y:this.center[1]},i=lc(e);return e.width=i.width(),e.height=i.height(),e.top=this.center[1]-e.height+.21*e.height,e.left=this.center[0]-e.width/2,e}layoutWord(t){const e=this.getTextInfo(this.data[t]);let i=2*Math.PI,n=0,r=e.left,a=e.top;const o=e.width,l=e.height;let h=1,d=this.fit(e);for(;!d&&n<this.maxRadius;)n+=.5,h=this.shape(n/this.maxRadius*2*Math.PI),i+=.5*(this.options.random?this.random()>.5?1:-1:t%2==0?1:-1),r=this.center[0]-o/2+n*h*Math.cos(i)*this.aspectRatio,a=this.center[1]-l/2+n*h*Math.sin(i),e.left=r,e.top=a,e.x=r+o/2,e.y=a+l/2,d=this.fit(e);return!!d&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(t!=null&&t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort((n,r)=>this.getTextFontSize(r)-this.getTextFontSize(n));let i=0;for(;i<t.length&&(this.layoutWord(i),i++,this.progressiveIndex=i,!this.exceedTime()););return this.result}}function ptt(s,t){return!(s.left+s.width<t.left||s.top+s.height<t.top||s.left>t.left+t.width||s.top>t.top+t.height)}km.defaultOptions={enlarge:!1};const gtt={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},ftt=(s,t)=>{var e,i,n,r,a,o;if(s.size&&(s.size[0]<=0||s.size[1]<=0))return zt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=t,h=((e=s.size)!==null&&e!==void 0?e:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const d=s.fontFamily?Ga(s.fontFamily):"sans-serif",u=s.fontStyle?Ga(s.fontStyle):"normal",c=s.fontWeight?Ga(s.fontWeight):"normal",p=s.rotate?Ga(s.rotate):0,g=Ga(s.text),f=(i=s.spiral)!==null&&i!==void 0?i:"archimedean",_=s.padding?Ga(s.padding):1,m=(n=s.shape)!==null&&n!==void 0?n:"square",v=(r=s.shrink)!==null&&r!==void 0&&r,y=(a=s.enlarge)!==null&&a!==void 0&&a,b=(o=s.clip)!==null&&o!==void 0&&o,x=s.minFontSize,S=s.randomVisible,A=s.as||gtt,k=s.depth_3d,w=s.postProjection;let T=s.fontSize?Ga(s.fontSize):14;const M=s.fontSizeRange;if(M&&!lt(T)){const D=T,R=_tt(mtt(D,l),M);T=L=>R(D(L))}let P=Xl;s.layoutType==="fast"?P=km:s.layoutType==="grid"&&(P=fB);const O=new P({text:g,padding:_,spiral:f,shape:m,rotate:p,fontFamily:d,fontStyle:u,fontWeight:c,fontSize:T,shrink:v,clip:b,enlarge:y,minFontSize:x,random:S,progressiveStep:s.progressiveStep,progressiveTime:s.progressiveTime,outputCallback:D=>{const R=[];let L,B;for(let F=0,z=D.length;F<z;F++)B=D[F],L=B.datum,L[A.x]=B.x,L[A.y]=B.y,L[A.fontFamily]=B.fontFamily,L[A.fontSize]=B.fontSize,L[A.fontStyle]=B.fontStyle,L[A.fontWeight]=B.fontWeight,L[A.angle]=B.angle,w==="StereographicProjection"&&vtt(h,B,L,A,k),R.push(L);return R}});return O.layout(l,{width:h[0],height:h[1]}),s.progressiveStep>0||s.progressiveTime>0?{progressive:O}:O.output()},Ga=s=>ot(s)||lt(s)||q(s)?s:t=>t[s.field],Gv=s=>s<0?-Math.sqrt(-s):Math.sqrt(s),_tt=(s,t)=>{if(s[0]===s[1])return a=>t[0];const e=Gv(s[0]),i=Gv(s[1]),n=Math.min(e,i),r=Math.max(e,i);return a=>(Gv(a)-n)/(r-n)*(t[1]-t[0])+t[0]},mtt=(s,t)=>{let e=1/0,i=-1/0;const n=t.length;let r;for(let a=0;a<n;++a)r=zn(s(t[a])),r<e&&(e=r),r>i&&(i=r);return t.length===1&&e===i&&(e-=1e4),[e,i]};function vtt(s,t,e,i,n){const r=Math.max(s[0],s[1])/2,a=ytt(s[0],s[1],r,{x:r,y:r,z:n??r},t);e[i.x]=a.x,e[i.y]=a.y,e[i.z]=a.z}function ytt(s,t,e,i,n){const{x:r,y:a}=n,o=r/s*Math.PI*2;let l=Math.PI-a/t*Math.PI;return l+=(l<Math.PI/2?1:-1)*Math.pow(Math.min(l-Math.PI/2,1),2)/5,{x:e*Math.sin(l)*Math.cos(o)+i.x,y:e*Math.cos(l)+i.y,z:e*Math.sin(l)*Math.sin(o)+i.z}}const wm=()=>{st.registerTransform("wordcloud",{transform:ftt,markPhase:"beforeJoin"},!0)};var Uf;(function(s){s.BEFORE_WORDCLOUD_SHAPE_LAYOUT="beforeWordcloudShapeLayout",s.AFTER_WORDCLOUD_SHAPE_LAYOUT="afterWordcloudShapeLayout"})(Uf||(Uf={}));const btt=(s,t)=>{if(t.length===1&&t[0]==="#537EF5")return!0;if(!Array.isArray(s)||!Array.isArray(t)||s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!==t[e])return!1;return!0},xtt=()=>{let s=-1;const t=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(s=(s+1)%t.length,t[s])},Stt=s=>/^[\u4e00-\u9fa5]+$/.test(s),mB=(s,t)=>{if(C(s))return 0;let e=0;for(const i of s)Stt(i)?e+=1:e+=.53;return e};function Att(s){return s&&(XC(s)||KC(s)||s.startsWith("<svg"))?new Promise((t,e)=>{var i;const n=cx({image:s}),r=(i=n.resources)===null||i===void 0?void 0:i.get(s);r&&r.state==="success"&&r.data?t(r.data):(n.successCallback=()=>{var a;if(n){const o=(a=n.resources)===null||a===void 0?void 0:a.get(s);o&&o.state==="success"&&o.data?t(o.data):e(new Error("image load failed"+s))}else e(new Error("image load failed"+s))},n.failCallback=()=>{zt.getInstance().error("image 加载失败!",s)})}):null}function ktt(s){return typeof s=="function"?s:function(){return s}}var wtt=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};function Ttt(s){return wtt(this,void 0,void 0,function*(){const t=yield Att(s.shapeUrl);return s.removeWhiteBorder&&t?Ctt(t,s.tempCanvas,s.tempCtx):t})}function Mtt(s,t){const{size:e,tempCanvas:i,tempCtx:n}=t,r=Ptt(s,e);i.width=e[0],i.height=e[1],n.clearRect(0,0,i.width,i.height),n.drawImage(s,r.x,r.y,r.width,r.height);const a=n.getImageData(0,0,e[0],e[1]),o=new Array(e[0]*e[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let d=[];for(let M=0;M<e[1];M++)for(let P=0;P<e[0];P++)if(o[M*e[0]+P]===0&&!$f(a,M,P)){o[M*e[0]+P]=l,d.push([M,P]);for(let O=0;O<d.length;O++)for(let D=0;D<4;D++){let R=d[O][0]+h[D][0],L=d[O][1]+h[D][1];R=R<0?0:R>=e[1]?e[1]-1:R,L=L<0?0:L>=e[0]?e[0]-1:L,o[R*e[0]+L]!==0||$f(a,R,L)||(o[R*e[0]+L]=l,d.push([R,L]))}l++,d=[]}const u={},c={},p={},g={},f={},_={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let M=0;M<e[1];M++)for(let P=0;P<e[0];P++){const O=o[M*e[0]+P];O!==0&&(T(M,P)&&(u[O]=u[O]||[],u[O].push([P,M]),g[O]||(g[O]=[1/0,-1/0,1/0,-1/0]),M<g[O][0]&&(g[O][0]=M),M>g[O][1]&&(g[O][1]=M),P<g[O][2]&&(g[O][2]=P),P>g[O][3]&&(g[O][3]=P),P<m.x1&&(m.x1=P),P>m.x2&&(m.x2=P),M<m.y1&&(m.y1=M),M>m.y2&&(m.y2=M)),c[O]=c[O]||0,c[O]++)}const v=[];for(const M in u){const P=u[M],O=~~(P.reduce((z,N)=>z+N[0],0)/P.length),D=~~(P.reduce((z,N)=>z+N[1],0)/P.length);p[M]=[O,D],v.push(...P);const[R,L,B,F]=g[M];f[M]=~~Math.max(Math.sqrt((O-B)**2+(D-R)**2),Math.sqrt((O-F)**2+(D-L)**2),Math.sqrt((O-B)**2+(D-L)**2),Math.sqrt((O-F)**2+(D-R)**2)),_[M]=(F-B)/(L-R)}const y=Object.keys(p).map(M=>({label:M-1,boundary:u[M],area:c[M],center:p[M],maxPoint:g[M],maxR:f[M],ratio:_[M]}));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const b=~~(v.reduce((M,P)=>M+P[0],0)/v.length),x=~~(v.reduce((M,P)=>M+P[1],0)/v.length),S=~~Math.max(Math.sqrt((b-m.x1)**2+(x-m.y1)**2),Math.sqrt((b-m.x2)**2+(x-m.y2)**2),Math.sqrt((b-m.x1)**2+(x-m.y2)**2),Math.sqrt((b-m.x2)**2+(x-m.y1)**2)),A=m.width/m.height,k=Object.keys(c).reduce((M,P)=>M+c[P],0),w={regions:y,labels:o,labelNumber:l-1};return Object.assign(t,{segmentation:w,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:A,shapeCenter:[b,x],shapeArea:k});function T(M,P){const O=[[0,1],[1,0],[-1,0],[0,-1]];if(M===0||P===0||M===e[1]-1||P===e[0]-1)return!0;for(let D=0;D<4;D++){let R=M+O[D][0],L=P+O[D][1];if(R=R<0?0:R>=e[1]?e[1]-1:R,L=L<0?0:L>=e[0]?e[0]-1:L,o[R*e[0]+L]===0)return!0}return!1}}function $f(s,t,e){const i=s.width;return s.data[t*i*4+4*e+3]===0||s.data[t*i*4+4*e+0]===255&&s.data[t*i*4+4*e+1]===255&&s.data[t*i*4+4*e+2]===255}function Ctt(s,t,e){t.width=s.width,t.height=s.height,e.clearRect(0,0,t.width,t.height),e.drawImage(s,0,0);const i=t.width,n=e.getImageData(0,0,t.width,t.height);let r=0,a=n.height,o=0,l=n.width;for(;r<a&&zM(n,i,r);)++r;for(;a-1>r&&zM(n,i,a-1);)--a;for(;o<l&&HM(n,i,o,r,a);)++o;for(;l-1>o&&HM(n,i,l-1,r,a);)--l;const h=e.getImageData(o,r,l-o,a-r);return t.width=h.width,t.height=h.height,e.clearRect(0,0,t.width,t.height),e.putImageData(h,0,0),t}function zM(s,t,e){for(let i=0;i<t;++i)if(!$f(s,e,i))return!1;return!0}function HM(s,t,e,i,n){for(let r=i;r<n;++r)if(!$f(s,r,e))return!1;return!0}function Ptt(s,t){const e=s.width,i=s.height;let n=t[0]/e;i*n>t[1]&&(n=t[1]/i);const r=Math.floor(n*e),a=Math.floor(n*i);return{x:(t[0]-r)/2,y:(t[1]-a)/2,width:r,height:a,scale:n}}function Ett(s,t){const{segmentation:{regions:e}}=t;let i=-1/0,n=0,r=0;e.forEach((h,d)=>{const u=h.area;u>i&&(i=u,r=d),n+=u});let a=0;e.forEach(h=>{const d=h.area,u=Math.ceil(d/n*s.length),c=d/i;h.words=[],h.regionNum=u,h.regionWeight=c,a+=u}),a<s.length&&(e[r].wordsNum+=s.length-a);let o=r;const l=e.map(h=>h.regionNum);s.forEach(h=>{let d=0,u=0;h.regionIndex=-1;do{if(l[o]>0&&h.weight<=e[o].regionWeight){h.regionIndex=o,e[o].words.push(h),l[o]--,o=(o+1)%e.length;break}o=(o+1)%e.length,d++,u++,u>e.length+1&&(e.forEach(c=>{c.regionWeight+=.15}),u=0)}while(h.regionIndex===-1&&d<3*e.length);h.regionIndex===-1&&(h.regionIndex=r,e[r].words.push(h),l[r]--)}),e.forEach(h=>{h.words.sort((d,u)=>u.weight-d.weight)})}function Rtt(s,t,e){const{size:i,stepFactor:n}=t,{segmentation:{regions:r},tempCtx:a,tempCanvas:o,boardSize:l,shapeCenter:h,shapeMaxR:d,shapeRatio:u}=e,c=_S(e);for(const p of r){const{words:g,center:f,maxR:_,ratio:m}=p;for(let v=0;v<g.length;v++){mo(o,a,s,v);const y=g[v];y.x=f[0],y.y=f[1],y.hasText&&y.sprite&&vh(c,y,_,m,i,l,n)&&(y.hasPlaced=!0)}}for(let p=0;p<t.textLayoutTimes;p++){const g=s.filter(f=>(f.hasPlaced||(f.hasText=!1,f.sprite=null,f.fontSize=Math.max(~~(f.fontSize*t.fontSizeShrinkFactor),t.minFontSize)),!f.hasPlaced));if(g.length===0)break;for(let f=0;f<g.length;f++){const _=g[f];mo(o,a,g,f),_.x=h[0],_.y=h[1],_.hasText&&vh(c,_,d,u,i,l,n)&&(_.hasPlaced=!0)}}t.board=c}function vB(s,t,e){const{stepFactor:i,importantWordCount:n,globalShinkLimit:r}=t,{size:a,segmentation:{regions:o},tempCtx:l,tempCanvas:h,boardSize:d,shapeCenter:u,shapeMaxR:c,shapeRatio:p}=e,g=_S(e);let f=g.slice(0);const _=t.fontSizeShrinkFactor;let m=null,v=1,y=1;const b=n;let x=0;s.length>b&&(x=s.sort((S,A)=>A.weight-S.weight)[b].weight);for(let S=0;S<o.length;S++){const A=o[S],{words:k,center:w,maxR:T,ratio:M}=A;let P=!1;for(let O=0;O<k.length;O++){mo(h,l,s,O);const D=k[O];if(D.x=w[0],D.y=w[1],!D.skip&&D.hasText&&D.sprite&&vh(f,D,T,M,a,d,i))D.hasPlaced=!0;else{if(!D.skip&&D.weight>x&&y>r){const R=D.datum[Symbol.for("vGrammar_id")];R!==m&&(m=R,v=y),y*=_,s.forEach(L=>{L.hasText=!1,L.sprite=null,L.fontSize=L.fontSize*_}),f=g.slice(0),P=!0;break}if(!D.skip&&D.datum[Symbol.for("vGrammar_id")]===m){s.forEach(R=>{R.hasText=!1,R.sprite=null,R.fontSize=R.fontSize/y}),D.skip=!0,y=v,m=null,f=g.slice(0),P=!0;break}}}P&&(S=-1)}for(let S=0;S<t.textLayoutTimes;S++){const A=s.filter(k=>(k.hasPlaced||(k.hasText=!1,k.sprite=null,k.fontSize=Math.max(~~(k.fontSize*t.fontSizeShrinkFactor),t.minFontSize)),!k.hasPlaced));if(A.length===0)break;for(let k=0;k<A.length;k++){const w=A[k];mo(h,l,A,k),w.x=u[0],w.y=u[1],w.hasText&&vh(f,w,c,p,a,d,i)&&(w.hasPlaced=!0)}}t.board=f}function Ott(s,t,e){const{size:i,stepFactor:n,importantWordCount:r}=t,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:d,shapeMaxR:u,shapeRatio:c}=e,p=_S(e);let g=p.slice(0);const f=t.fontSizeEnlargeFactor,_=Math.min(r,s.length);let m=0;s.length>_&&(m=s.sort((x,S)=>S.weight-x.weight)[_-1].weight);let v=0,y=1,b=!1;for(let x=0;x<a.length;x++){const S=a[x],{words:A,center:k,maxR:w,ratio:T}=S;let M=!1;for(let P=0;P<A.length;P++){mo(l,o,s,P);const O=A[P];if(O.x=k[0],O.y=k[1],O.hasText&&O.sprite&&vh(g,O,w,T,i,h,n)){if(O.hasPlaced=!0,O.weight>=m&&v++,v>=_&&!b){y*=f,s.forEach(D=>{D.hasText=!1,D.sprite=null,D.fontSize=D.fontSize*f}),g=p.slice(0),M=!0,v=0;break}}else{if(O.weight>=m&&y>1){s.forEach(D=>{D.hasText=!1,D.sprite=null,D.fontSize=D.fontSize/f}),y/=f,b=!0,g=p.slice(0),M=!0;break}if(O.weight>=m)return vB(s,t,e)}}M&&(x=-1)}for(let x=0;x<t.textLayoutTimes;x++){const S=s.filter(A=>(A.hasPlaced||(A.hasText=!1,A.sprite=null,A.fontSize=Math.max(~~(A.fontSize*t.fontSizeShrinkFactor),t.minFontSize)),!A.hasPlaced));if(S.length===0)break;for(let A=0;A<S.length;A++){const k=S[A];mo(l,o,S,A),k.x=d[0],k.y=d[1],k.hasText&&vh(g,k,u,c,i,h,n)&&(k.hasPlaced=!0)}}t.board=g}function vh(s,t,e,i,n,r,a){const o=t.x,l=t.y,h=Dtt(i),d=1*a;let u,c,p,g=-d;for(;u=h(g+=d);){const{wordSize:f,bounds:{dTop:_,dBottom:m,dLeft:v,dRight:y}}=t;if(c=u[0],p=u[1],Math.min(Math.abs(c),Math.abs(p))>=e)break;if(t.x=~~(o+c),t.y=~~(l+p),!(t.x-v<0||t.x+y>n[0]||t.y-_<0||t.y+m>n[1]||bB(t,s,r)))return yB(t,s,r),!0}return!1}function yB(s,t,e){const{wordSize:i}=s,n=s.sprite,r=i[0]>>5,a=e[0]>>5,o=s.x-(r<<4),l=o%32,h=32-l,d=i[1];let u,c=(s.y-(i[1]>>1))*a+(o>>5);if(l===0)for(let p=0;p<d;p++){for(let g=0;g<r;g++)t[c+g]|=n[p*r+g];c+=a}else for(let p=0;p<d;p++){u=0;for(let g=0;g<=r;g++)t[c+g]|=u<<h|(g<r?(u=n[p*r+g])>>>l:0);c+=a}}function bB(s,t,e){const{sprite:i,wordSize:n}=s,r=e[0]>>5,a=n[0]>>5,o=s.x-(a<<4),l=o%32,h=32-l,d=n[1];let u,c=(s.y-(n[1]>>1))*r+(o>>5);if(l===0)for(let p=0;p<d;p++){for(let g=0;g<a;g++)if(t[c+g]&i[p*a+g])return!0;c+=r}else for(let p=0;p<d;p++){u=0;for(let g=0;g<=a;g++)if((u<<h|(g<a?(u=i[p*a+g])>>>l:0))&t[c+g])return!0;c+=r}return!1}function Dtt(s){return function(t){return[s*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function mo(s,t,e,i){if(e[i].sprite||e[i].fontSize===0)return;const n=2048,r=Math.PI/180,a=e.length;s.width=n,s.height=2048,t.clearRect(0,0,n,2048),t.textAlign="center";let o,l,h=0,d=0,u=0,c=0;const p=i;for(--i;++i<a;){const m=e[i],v=Math.max(m.fontSize,2);if(t.save(),t.font=m.fontStyle+" "+m.fontWeight+" "+v+"px "+m.fontFamily,o=t.measureText(m.text+"m").width+2*m.padding,l=2*v+2*m.padding,m.rotate!==0){const y=Math.sin(m.rotate*r),b=Math.cos(m.rotate*r),x=o*b,S=o*y,A=l*b,k=l*y;o=Math.max(Math.abs(x+k),Math.abs(x-k)),l=~~Math.max(Math.abs(S+A),Math.abs(S-A))}if(o=o+31>>5<<5,l=Math.ceil(l),l>u&&(u=l),h+o>=n&&(h=0,d+=u,u=l),d+l>=2048){if(d===0){m.hasText=!1;continue}break}d+l>=c&&(c=d+l),t.translate(h+(o>>1),d+(l>>1)),m.rotate!==0&&t.rotate(m.rotate*r),t.fillText(m.text,0,0),m.padding&&(t.lineWidth=2*m.padding,t.strokeText(m.text,0,0)),t.restore(),m.LT=[h,d],m.wordSize=[o,l],m.hasText=!0,h+=o}if(c===0)return;const g=t.getImageData(0,0,n,c).data;let f,_;for(;--i>=p;){const m=e[i];if(!m.hasText){m.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:v=[0,0],wordSize:y}=m;[h,d]=v;const b=y[0]>>5,x=new Array(b*y[1]).fill(0);let[S,A,k,w]=[1/0,-1/0,1/0,-1/0];for(_=0;_<y[1];_++){let T;for(f=0;f<y[0];f++)if(g[4*((d+_)*n+(h+f))+3]>0){const M=1<<31-f%32;x[b*_+(f>>5)]|=M,f<k&&(k=f),f>w&&(w=f),T|=M}T&&(_<S&&(S=_),_>A&&(A=_))}m.bounds={dTop:(y[1]>>1)-S,dBottom:A-(y[1]>>1),dLeft:(y[0]>>1)-k,dRight:w-(y[0]>>1)},m.sprite=x,delete m.LT}}function _S(s){const{segmentation:{labels:t},boardSize:e,size:i}=s,n=e[0]>>5,r=new Array(n*i[1]).fill(0);for(let a=0;a<i[1];a++)for(let o=0;o<i[0];o++)if(t[a*i[0]+o]===0){const l=1<<31-o%32;r[n*a+(o>>5)]|=l}if(e[0]>i[0]){const a=(1<<e[0]-i[0])-1;for(let o=0;o<i[1];o++)r[n*o+n-1]|=a}return r}function Ltt(s,t,e){const{size:i,fillingTimes:n,fillingXStep:r,fillingYStep:a,getFillingFontStyle:o,getFillingFontWeight:l,getFillingFontFamily:h,fillingInitialFontSize:d,fillingDeltaFontSize:u,fillingInitialOpacity:c,fillingDeltaOpacity:p,fillingRotateList:g,getFillingPadding:f,random:_,board:m,minFillFoontSize:v}=t,{boardSize:y,shapeBounds:b,tempCtx:x,tempCanvas:S,randomGenerator:A}=e;let k=d,w=c;const T=[];for(let O=0;O<n;O++)M(k,w),k=Math.max(k>u?k-u:u,v),w=w>p?w-p:p;return T;function M(O,D){const R=s.map(X=>{const{text:Z,color:et,fillingColor:K,hasPlaced:W,datum:it}=X;return{x:0,y:0,weight:0,text:Z,fontFamily:h(it),fontStyle:o(it),fontWeight:l(it),fontSize:O,rotate:g[~~(A()*g.length)],padding:f(it),opacity:D,visible:!0,color:et,fillingColor:K,hasPlaced:W,datum:it}});P(R);let L=0;const{x1:B,y1:F,x2:z,y2:N}=b,[V,G]=[B+~~(A()*r*2),F+~~(A()*a*2)];for(let X=G;X<=N;X+=a)for(let Z=V;Z<=z;Z+=r){mo(S,x,R,L);const et=R[L];et.x=Z,et.y=X;const{wordSize:K,bounds:W,hasPlaced:it}=et;if(!it||!W){++L===R.length&&(L=0,_&&P(R));continue}const{dTop:ht,dBottom:dt,dLeft:Rt,dRight:gt}=W;et.x-Rt<0||et.x+gt>i[0]||et.y-ht<0||et.y+dt>i[1]||et.hasText&&et.sprite&&!bB(et,m,y)&&(yB(et,m,y),T.push(Object.assign({},et)),++L===R.length&&(L=0,_&&P(R)))}}function P(O){return O.sort(()=>A()-.5)}}function Btt(s,t,e){Ett(s,e),t.layoutMode==="ensureMapping"?vB(s,t,e):t.layoutMode==="ensureMappingEnlarge"?Ott(s,t,e):Rtt(s,t,e);const i=Ltt(s,t,e),n=[],r=[];for(let a=0;a<s.length;a++)s[a].hasPlaced?r.push(s[a]):n.push(s[a]);return n.forEach(a=>a.visible=!1),{fillingWords:i,successedWords:r,failedWords:n}}var Itt=function(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(h){try{l(i.next(h))}catch(d){r(d)}}function o(h){try{l(i.throw(h))}catch(d){r(d)}}function l(h){var d;h.done?n(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(a,o)}l((i=i.apply(s,t||[])).next())})};const Ftt={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},jtt=(s,t,e,i)=>Itt(void 0,void 0,void 0,function*(){var n,r,a;if(!s.size||C(s.size[0])||C(s.size[1])||s.size[0]<=0||s.size[1]<=0)return zt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];s.size=[Math.ceil(s.size[0]),Math.ceil(s.size[1])],s.shape||Ja("WordcloudShape shape must be specified."),s.text||Ja("WordcloudShape text must be specified."),i!=null&&i.emit&&i.emit(Uf.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const o=t,l=s.as||Ftt;if(!o||o.length===0)return[];const h={shapeUrl:s.shape,size:s.size,ratio:s.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:s.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},d=Ht.createCanvas({width:s.size[0],height:s.size[1]}),u=d.getContext("2d");u.textAlign="center",u.textBaseline="middle",h.tempCanvas=d,h.tempCtx=u;const c=s.size[0]+31>>5<<5;h.boardSize=[c,s.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=xtt();const p=yield Ttt(h);if(!p)return[];const g=Mtt(p,h),f=s.colorMode||"ordinal",_={getText:Ji(s.text),getFontSize:Ji(s.fontSize),fontSizeRange:s.fontSizeRange,colorMode:f,getColor:s.colorField?Ji(s.colorField):Ji(s.text),getFillingColor:Ji(s.fillingColorField),colorList:s.colorList||(f==="ordinal"?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:Ji(s.colorHexField),getFontFamily:Ji(s.fontFamily||"sans-serif"),rotateList:s.rotateList||[0],getPadding:Ji(s.padding||1),getFontStyle:Ji(s.fontStyle||"normal"),getFontWeight:Ji(s.fontWeight||"normal"),getFontOpacity:s.fontOpacity?Ji(s.fontOpacity):()=>1};Htt(o,_,g);const m={size:s.size,ratio:s.ratio||.8,shapeUrl:s.shape,random:s.random===void 0||s.random,textLayoutTimes:s.textLayoutTimes||3,removeWhiteBorder:s.removeWhiteBorder||!1,layoutMode:s.layoutMode||"default",fontSizeShrinkFactor:s.fontSizeShrinkFactor||.8,stepFactor:s.stepFactor||1,importantWordCount:s.importantWordCount||10,globalShinkLimit:s.globalShinkLimit||.2,fontSizeEnlargeFactor:s.fontSizeEnlargeFactor||1.5,fillingRatio:s.fillingRatio||.7,fillingTimes:s.fillingTimes||4,fillingXStep:s.fillingXRatioStep?Math.max(Math.floor(s.size[0]*s.fillingXRatioStep),1):s.fillingXStep||4,fillingYStep:s.fillingYRatioStep?Math.max(Math.floor(s.size[1]*s.fillingYRatioStep),1):s.fillingYStep||4,fillingInitialFontSize:s.fillingInitialFontSize,fillingDeltaFontSize:s.fillingDeltaFontSize,fillingInitialOpacity:s.fillingInitialOpacity||.8,fillingDeltaOpacity:s.fillingDeltaOpacity||.05,getFillingFontFamily:Ji(s.fillingFontFamily||"sans-serif"),getFillingFontStyle:Ji(s.fillingFontStyle||"normal"),getFillingFontWeight:Ji(s.fillingFontWeight||"normal"),getFillingPadding:Ji(s.fillingPadding||.4),fillingRotateList:s.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:s.fillingDeltaFontSizeFactor||.2,fillingColorList:s.fillingColorList||["#537EF5"],sameColorList:!1,minInitFontSize:s.minInitFontSize||10,minFontSize:s.minFontSize||4,minFillFoontSize:s.minFillFoontSize||2},v=btt(_.colorList,m.fillingColorList);m.sameColorList=v,ztt(o,_,m,s),Gtt(o,_,m,g);const{getText:y,getFontFamily:b,getFontStyle:x,getFontWeight:S,getPadding:A,getColor:k,getFillingColor:w,getColorHex:T,fontSizeScale:M,colorScale:P,fillingColorScale:O,getFontOpacity:D,rotateList:R}=_,L=o.map(W=>{var it,ht;return{x:0,y:0,weight:0,text:y(W),fontFamily:b(W),fontWeight:S(W),fontStyle:x(W),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:Math.max(m.minInitFontSize,~~M(W)),opacity:D(W),padding:A(W),color:T&&T(W)||P&&P(k(W))||"black",fillingColor:!w||((it=s.colorField)===null||it===void 0?void 0:it.field)===((ht=s.fillingColorField)===null||ht===void 0?void 0:ht.field)&&v?void 0:T&&T(W)||O&&O(w(W))||"black",datum:W,visible:!0,hasPlaced:!1}}),B=Ye(L.map(W=>W.fontSize));L.forEach(W=>W.weight=W.fontSize/B),L.sort((W,it)=>it.weight-W.weight);const{fillingWords:F,successedWords:z,failedWords:N}=Btt(L,m,g);let V,G;const X=[];for(let W=0;W<L.length;++W)V=L[W],G=V.datum,G[l.x]=V.x,G[l.y]=V.y,G[l.fontFamily]=V.fontFamily,G[l.fontSize]=V.fontSize,G[l.fontStyle]=V.fontStyle,G[l.fontWeight]=V.fontWeight,G[l.angle]=le(V.rotate),G[l.opacity]=V.opacity,G[l.visible]=V.visible,G[l.isFillingWord]=!1,G[l.color]=V.color,X.push(G);const Z=(r=(n=s.text)===null||n===void 0?void 0:n.field)!==null&&r!==void 0?r:"textKey",et=(a=s.dataIndexKey)!==null&&a!==void 0?a:"defaultDataIndexKey",K=[];return F.forEach((W,it)=>{var ht,dt;const Rt={};Rt[l.x]=W.x,Rt[l.y]=W.y,Rt[l.fontFamily]=W.fontFamily,Rt[l.fontSize]=W.fontSize,Rt[l.fontStyle]=W.fontStyle,Rt[l.fontWeight]=W.fontWeight,Rt[l.angle]=le(W.rotate),Rt[l.opacity]=W.opacity,Rt[l.visible]=W.visible,Rt[l.isFillingWord]=!0,Rt[l.color]=w?((ht=s.colorField)===null||ht===void 0?void 0:ht.field)===((dt=s.fillingColorField)===null||dt===void 0?void 0:dt.field)&&v?W.color:W.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],Rt[Z]=W.text,Rt[et]=`${W.text}_${it}_fillingWords`,K.push(Rt)}),i!=null&&i.emit&&i.emit(Uf.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:z,failedWords:N}),X.concat(K)}),ztt=(s,t,e,i)=>{var n,r,a,o;const{colorMode:l,getColor:h,getFillingColor:d}=t,{sameColorList:u}=e;let c,p,g=t.colorList,f=e.fillingColorList;if(l==="ordinal"){const _=s.map(m=>h(m));if(c=m=>new ho().domain(_).range(g).scale(m),d&&(((n=i.colorField)===null||n===void 0?void 0:n.field)!==((r=i.fillingColorField)===null||r===void 0?void 0:r.field)||!u)){const m=s.map(v=>d(v));p=v=>new ho().domain(m).range(f).scale(v)}}else{g.length===1&&(g=[g[0],g[0]]);const _=new Qs().domain(Id(h,s)).range(g);if(c=m=>_.scale(m),d&&(((a=i.colorField)===null||a===void 0?void 0:a.field)!==((o=i.fillingColorField)===null||o===void 0?void 0:o.field)||!u)){f.length===1&&(f=[f[0],f[0]]);const m=new Qs().domain(Id(d,s)).range(f);p=v=>m.scale(v)}}Object.assign(t,{colorScale:c,fillingColorScale:p})},Htt=(s,t,e)=>{let{fontSizeRange:i}=t;const{getFontSize:n,getText:r}=t;let a;if(n){if(n&&i){const o=new Xg().domain(Id(n,s)).range(i);a=l=>o.scale(n(l))}else if(n&&q(n)&&!i){const[l,h]=Id(n,s),d=s.map(p=>({text:r(p),value:n(p),weight:h===l?1:(n(p)-l)/(h-l)})),u=GM(d,e,!0);i=[~~(.5*u),~~u];const c=new Xg().domain(Id(n,s)).range(i);a=p=>c.scale(n(p))}}else{const o=s.map(h=>({text:r(h)})),l=GM(o,e,!1);a=ktt(l)}Object.assign(t,{getFontSize:n,fontSizeRange:i,fontSizeScale:a})},GM=(s,t,e)=>{const i=t.shapeArea,n=t.ratio,r=t.segmentation.regions,a=Math.ceil(Math.sqrt(i)/12),o=s.reduce((h,d)=>{const u=mB(d.text);return u<a?h+u*(e?(.5+.5*d.weight)**2:1):h},0);if(o===0)return 12;let l=20;if(r.length===1)l=Math.sqrt(n*(i/(1.7*o)));else{const h=[];for(let d=0;d<r.length;d++){const u=r[d].area,c=r[d].ratio,p=u/i;if(p<.1)continue;const g=p*(o*(c<1?2.7-c:1.7)),f=Math.sqrt(n*(u/g));h.push(f)}l=h.length?Math.min(...h):Math.sqrt(n*(i/(1.7*o)))}return l};function Gtt(s,t,e,i){const{getText:n}=t;let{fillingInitialFontSize:r,fillingDeltaFontSize:a}=e;const{fillingRatio:o}=e,l=Math.ceil(Math.sqrt(i.shapeArea)/4);if(!r||!a){const h=o/100,d=s.reduce((c,p)=>{const g=mB(n(p));return g>l?c:c+g},0)/s.length;let u;if(d===0)u=8;else{const c=.2*i.shapeArea;u=Math.sqrt(h*(c/d))}r=~~u,a=u*e.fillingDeltaFontSizeFactor,Object.assign(e,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}const Id=(s,t)=>{let e=1/0,i=-1/0;const n=t.length;let r;for(let a=0;a<n;++a)r=zn(s(t[a])),r<e&&(e=r),r>i&&(i=r);return t.length===1&&e===i&&(e-=1e4),[e,i]},Ji=s=>s?typeof s=="string"||typeof s=="number"?()=>s:q(s)?s:t=>t[s.field]:null,xB=()=>{st.registerTransform("wordcloudShape",{transform:jtt,markPhase:"beforeJoin"},!0)};class zu extends fa{constructor(){super(...arguments),this.type=j.wordCloud}}zu.type=j.wordCloud;const SB=()=>{wm(),Os(),cB(),I.registerSeries(zu.type,zu)},Wtt=()=>{xB(),wm(),Os(),cB(),I.registerSeries(zu.type,zu)};class Hu extends fa{constructor(){super(...arguments),this.type=j.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:(t=this._spec.postProjection)!==null&&t!==void 0?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:(t=this._spec.postProjection)!==null&&t!==void 0?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(fa.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(fa.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){super.initMarkStyle();const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{z:i=>{var n;return(n=i.z)!==null&&n!==void 0?n:0}},"normal",Q.Series),e&&this.setMarkStyle(e,{z:i=>{var n;return(n=i.z)!==null&&n!==void 0?n:0}},"normal",Q.Series)}initAnimation(){var t,e,i;const n=(t=this._padding)!==null&&t!==void 0?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Ft((e=I.getAnimationInKey("wordCloud3d"))===null||e===void 0?void 0:e(()=>{var r;const a=this.getCompiler().getVGrammarView(),o=a.width()-n.left||0-n.right||0,l=a.height()-n.top||0-n.bottom||0,h=Math.max(o,l)/2;return{center:{x:h,y:h,z:(r=this._spec.depth_3d)!==null&&r!==void 0?r:h},r:h}}),Ut("word",this._spec,this._markAttributeContext))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(Ft((i=I.getAnimationInKey("wordCloud3d"))===null||i===void 0?void 0:i(()=>{var r;const a=this.getCompiler().getVGrammarView(),o=a.width()-n.left||0-n.right||0,l=a.height()-n.top||0-n.bottom||0,h=Math.max(o,l)/2;return{center:{x:h,y:h,z:(r=this._spec.depth_3d)!==null&&r!==void 0?r:h},r:h}}),Ut("fillingWord",this._spec,this._markAttributeContext)))}}Hu.type=j.wordCloud3d;const AB=()=>{wm(),Os(),pB(),I.registerSeries(Hu.type,Hu)},Ntt=()=>{xB(),wm(),Os(),pB(),I.registerSeries(Hu.type,Hu)},Vtt=(s,t)=>{var e,i;const n=s.map(x=>Object.assign({},x));if(!n||n.length===0)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:d,asLastValueRatio:u,asLastValue:c,asCurrentValue:p,asNextValue:g,heightVisual:f=!1,isCone:_=!0,range:m}=t,v=n.reduce((x,S)=>Math.max(x,Number.parseFloat(S[r])||-1/0),-1/0),y=n.reduce((x,S)=>Math.min(x,Number.parseFloat(S[r])||1/0),1/0),b=[(e=m==null?void 0:m.min)!==null&&e!==void 0?e:y,(i=m==null?void 0:m.max)!==null&&i!==void 0?i:v];return n.forEach((x,S)=>{var A,k;const w=Number.parseFloat(x[r]),T=Number.parseFloat((A=n[S-1])===null||A===void 0?void 0:A[r]),M=Number.parseFloat((k=n[S+1])===null||k===void 0?void 0:k[r]),P=H(M*w)&&w!==0?M/w:0,O=H(w*T)&&T!==0?w/T:0;c&&(x[c]=T),g&&(x[g]=M),a&&(x[a]=P),o&&(x[o]=S===0?1:O),l&&(x[l]=f===!0?P:1/n.length),h&&(x[h]=w/b[1]),d&&(x[d]=S===n.length-1?_?0:x[h]:M/b[1]),u&&(x[u]=S===0?1:T/b[1]),p&&(x[p]=w)}),n},Utt=(s,t)=>{var e,i;const n=(i=(e=s[0])===null||e===void 0?void 0:e.latestData)===null||i===void 0?void 0:i.map(r=>Object.assign({},r));return n&&n.length!==0&&(n.shift(),n.forEach(r=>{r[t.asIsTransformLevel]=!0})),n},$tt=`${xt}_FUNNEL_TRANSFORM_RATIO`,bb=`${xt}_FUNNEL_REACH_RATIO`,Ytt=`${xt}_FUNNEL_HEIGHT_RATIO`,fp=`${xt}_FUNNEL_VALUE_RATIO`,WM=`${xt}_FUNNEL_LAST_VALUE_RATIO`,NM=`${xt}_FUNNEL_NEXT_VALUE_RATIO`,Xtt=`${xt}_FUNNEL_LAST_VALUE`,Ktt=`${xt}_FUNNEL_CURRENT_VALUE`,qtt=`${xt}_FUNNEL_NEXT_VALUE`,VM=`${xt}_FUNNEL_TRANSFORM_LEVEL`,Qn=20,Wa=5,Ztt="80%",Jtt=0;class Qtt extends hs{constructor(){super(...arguments),this.titleValueCallback=(t,e)=>{var i,n,r;const a=this.series;return((i=e==null?void 0:e.mark)===null||i===void 0?void 0:i.name)==="transform"?"转化率":(n=this._getDimensionData(t))!==null&&n!==void 0?n:(r=t.properties)===null||r===void 0?void 0:r[`${a.getCategoryField()}`]},this.contentValueCallback=(t,e)=>{var i;return((i=e==null?void 0:e.mark)===null||i===void 0?void 0:i.name)==="transform"?`${(100*(t==null?void 0:t[bb])).toFixed(1)}%`:this._getMeasureData(t)},this.contentKeyCallback=(t,e)=>{var i;if(((i=e==null?void 0:e.mark)===null||i===void 0?void 0:i.name)==="transform")return"转化率";const{dimensionFields:n,seriesFields:r}=this._seriesCacheInfo,a=n[n.length-1];return E(r[0])?t==null?void 0:t[r[0]]:t==null?void 0:t[a]}}}class kB extends Ri{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class Gu extends kB{constructor(){super(...arguments),this.type=Gu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}Gu.type="polygon";const tet=()=>{I.registerMark(Gu.type,Gu),R7(),wL()};class mS extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class mn extends go{constructor(){super(...arguments),this.type=j.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=mS,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=(t=this._spec.funnelOrient)!==null&&t!==void 0?t:"top",this._shape=(e=this._spec.shape)!==null&&e!==void 0?e:"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;Mt(this._dataSet,"funnel",Vtt),Mt(this._dataSet,"funnelTransform",Utt);const t=new Zt(this._dataSet,{name:`${xt}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Yn(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,n,r,a,o,l,h;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Ktt,asTransformRatio:$tt,asReachRatio:bb,asHeightRatio:Ytt,asValueRatio:fp,asNextValueRatio:NM,asLastValueRatio:WM,asLastValue:Xtt,asNextValue:qtt,range:{min:(e=(t=this._spec.range)===null||t===void 0?void 0:t.min)!==null&&e!==void 0?e:(n=(i=this.getViewDataStatistics().latestData)===null||i===void 0?void 0:i[this.getValueField()])===null||n===void 0?void 0:n.min,max:(a=(r=this._spec.range)===null||r===void 0?void 0:r.max)!==null&&a!==void 0?a:(l=(o=this.getViewDataStatistics().latestData)===null||o===void 0?void 0:o[this.getValueField()])===null||l===void 0?void 0:l.max}}}),(h=this._viewDataTransform.getDataView())===null||h===void 0||h.transform({type:"funnelTransform",options:{asIsTransformLevel:VM}})}initMark(){var t,e,i,n,r,a,o,l,h,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},mn.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:(t=this._theme)===null||t===void 0?void 0:t.funnel,morph:Er(this._spec,this._funnelMarkName),defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0,customShape:(e=this._spec.funnel)===null||e===void 0?void 0:e.customShape}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},mn.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:(i=this._theme)===null||i===void 0?void 0:i.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),customShape:(n=this._spec.transform)===null||n===void 0?void 0:n.customShape})),(a=(r=this._spec)===null||r===void 0?void 0:r.outerLabel)===null||a===void 0?void 0:a.visible){const{line:u}=(o=this._spec.outerLabel)!==null&&o!==void 0?o:{},{line:c}=(h=(l=this._theme)===null||l===void 0?void 0:l.outerLabel)!==null&&h!==void 0?h:{};this._funnelOuterLabelMark.label=this._createMark(mn.mark.outerLabel,{themeSpec:(d=this._theme)===null||d===void 0?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0}),this._funnelOuterLabelMark.line=this._createMark(mn.mark.outerLabelLine,{themeSpec:c,markSpec:u,depend:[this._funnelOuterLabelMark.label]})}}initTooltip(){this._tooltipHelper=new Qtt(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:r=>this.getPoints(r),visible:r=>E(r[this._valueField]),fill:this.getColorAttribute()},"normal",Q.Series),this._trigger.registerMark(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:r=>this.getPoints(r)},"normal",Q.Series),this._trigger.registerMark(e));const i=this._funnelOuterLabelMark.label;i&&this.setMarkStyle(i,{text:r=>{const a=`${r[this.getCategoryField()]}`;return q(this._spec.outerLabel.formatMethod)?this._spec.outerLabel.formatMethod(a,r):a},x:r=>this._computeOuterLabelPosition(r).x,y:r=>this._computeOuterLabelPosition(r).y,textAlign:r=>this._computeOuterLabelPosition(r).align,textBaseline:r=>this._computeOuterLabelPosition(r).textBaseline,limit:r=>this._computeOuterLabelLimit(r)},"normal",Q.Series);const n=this._funnelOuterLabelMark.line;n&&i&&this.setMarkStyle(n,{x:r=>this._computeOuterLabelLinePosition(r).x1,y:r=>this._computeOuterLabelLinePosition(r).y1,x1:r=>this._computeOuterLabelLinePosition(r).x2,y1:r=>this._computeOuterLabelLinePosition(r).y2},"normal",Q.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const n=t.getTarget(),r=t.getComponent();n===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:a=>`${a[this.getCategoryField()]} ${a[this.getValueField()]}`,x:a=>this._computeLabelPosition(a).x,y:a=>this._computeLabelPosition(a).y,maxLineWidth:a=>this._computeLabelLimit(a,this._spec.label),stroke:this.getColorAttribute()},"normal",Q.Series),!((e=this._funnelOuterLabelMark)===null||e===void 0)&&e.label&&this._funnelOuterLabelMark.label.setDepend(r),!((i=this._funnelOuterLabelMark)===null||i===void 0)&&i.line&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&n===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:a=>`${(100*Op(bb).bind(this)(a)).toFixed(1)}%`,x:a=>this._computeLabelPosition(a).x,y:a=>this._computeLabelPosition(a).y,maxLineWidth:a=>this._computeLabelLimit(a,this._spec.transformLabel)},"normal",Q.Series))}initAnimation(){var t,e,i,n,r,a,o;const l=(i=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset)!==null&&i!==void 0?i:"clipIn";l==="clipIn"&&this._rootMark&&this._rootMark.setAnimationConfig(Ft((n=I.getAnimationInKey("cartesianGroupClip"))===null||n===void 0?void 0:n({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const h=this.getRootMark().getProduct();if(h){const{x1:d,x2:u}=h.getBounds();return Math.max(d,u)}return this.getLayoutRect().width},height:()=>{const h=this.getRootMark().getProduct();if(h){const{y1:d,y2:u}=h.getBounds();return Math.max(d,u)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},l),Ut("group",this._spec,this._markAttributeContext))),[(r=this._funnelOuterLabelMark)===null||r===void 0?void 0:r.label].forEach(h=>{h&&h.setAnimationConfig(Ft(I.getAnimationInKey("fadeInOut")(),Ut(h.name,this._spec,this._markAttributeContext)))}),[this._funnelMark,this._funnelTransformMark].forEach(h=>{h&&h.setAnimationConfig(Ft(I.getAnimationInKey("funnel")({},l),Ut(h.name,this._spec,this._markAttributeContext)))}),!((a=this._funnelOuterLabelMark)===null||a===void 0)&&a.line&&this._funnelOuterLabelMark.line.setAnimationConfig(Ft((o=I.getAnimationInKey("fadeInOut"))===null||o===void 0?void 0:o(),Ut("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),(t=this._viewDataTransform.getDataView())===null||t===void 0||t.target.addListener("change",e=>{this._viewDataTransform.updateData()})}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,r;e?(n=this._shape==="rect"?this._getSecondaryAxisLength(t[WM])/2:this._getSecondaryAxisLength(t[fp])/2,r=this._getSecondaryAxisLength(t[fp])/2):(n=this._getSecondaryAxisLength(t[fp])/2,r=this._shape==="rect"?n:this._getSecondaryAxisLength(t[NM])/2);const{x:a,y:o}=this._getPositionByData(t),l=this._getPolygonPoints([a,o],n,r,n,r,i);return this._funnelAlign!=="center"&&this._adjustPoints(l),l}isTransformLevel(t){return!!(t!=null&&t[VM])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){var e,i,n;const r=(n=(i=(e=this.getViewData())===null||e===void 0?void 0:e.latestData)===null||i===void 0?void 0:i.find)===null||n===void 0?void 0:n.call(i,a=>a[this._categoryField]===t);return E(r)?this._getPolygonCenter(this.getPoints(r)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,n=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,r=!!this._spec.isTransform,a=r?0:(e=this._spec.gap)!==null&&e!==void 0?e:0,o=r?Math.max(0,i-1):0,l=(n-a*Math.max(0,i-1))/(i+.5*o);return t?r?.5*l:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){var e;const i=(e=this.getViewData().latestData)===null||e===void 0?void 0:e.findIndex(c=>c[this._categoryField]===t[this._categoryField]&&c[$n]===t[$n]);if(!E(i)||i<0)return{};const n=this.isTransformLevel(t),r=this._isHorizontal(),a=r?this.getLayoutRect().height:this.getLayoutRect().width,o=r?this.getLayoutRect().width:this.getLayoutRect().height,l=a/2;let h=0;const d=this._getMainAxisLength(),u=this._getMainAxisLength(!0);return h+=i*(d+u),h+=n?-u/2:d/2,!this._spec.isTransform&&this._spec.gap&&(h+=this._spec.gap*i),this._isReverse()&&(h=o-h),this._isHorizontal()?{x:h,y:l}:{x:l,y:h}}_getPolygonPoints(t,e,i,n,r,a){const o=t[0],l=t[1];switch(this._funnelOrient){case"left":return[{x:o-a,y:l+e},{x:o-a,y:l-n},{x:o+a,y:l-r},{x:o+a,y:l+i}];case"right":return[{x:o+a,y:l-n},{x:o+a,y:l+n},{x:o-a,y:l+i},{x:o-a,y:l-i}];case"bottom":return[{x:o+e,y:l+a},{x:o-n,y:l+a},{x:o-r,y:l-a},{x:o+i,y:l-a}];default:return[{x:o-e,y:l-a},{x:o+n,y:l-a},{x:o+r,y:l+a},{x:o-i,y:l+a}]}}_getPolygonCenter(t){if(this._isHorizontal()){const n=(t[0].x+t[3].x)/2,r=(t[0].y+t[3].y)/2;return{x:(n+(t[1].x+t[2].x)/2)/2,y:(r+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,n;return this._isHorizontal()?(n="y",this._funnelOrient==="left"?(e=this._funnelAlign==="bottom"?-t[1].y:t[1].y,i=this._funnelAlign==="bottom"?-t[2].y:t[2].y):(e=this._funnelAlign==="bottom"?-t[0].y:t[0].y,i=this._funnelAlign==="bottom"?-t[3].y:t[3].y)):(n="x",this._funnelOrient==="top"?(e=this._funnelAlign==="left"?t[0].x:-t[0].x,i=this._funnelAlign==="left"?t[3].x:-t[3].x):(e=this._funnelAlign==="left"?t[1].x:-t[1].x,i=this._funnelAlign==="left"?t[2].x:-t[2].x)),t[0][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e==null?void 0:e.limit;if(lt(i))return i;const n=this.getPoints(t);return i==="shapeSize"?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let n,r,a=(e=this._spec.outerLabel)===null||e===void 0?void 0:e.position,o="center",l="middle";if(a=this._isHorizontal()?["top","bottom"].includes(a)?a:this._funnelAlign==="bottom"?"top":"bottom":["left","right"].includes(a)?a:this._funnelAlign==="left"?"right":"left",((i=this._spec.outerLabel)===null||i===void 0?void 0:i.alignLabel)!==!1)({x:n,y:r}=this._getPositionByData(t)),a==="left"?(n=0,o="left"):a==="right"?(n=this.getLayoutRect().width,o="right"):a==="top"?(r=0,l="top"):a==="bottom"&&(r=this.getLayoutRect().height,l="bottom");else{const{x2:h,y2:d}=this._computeOuterLabelLinePosition(t);n=h,r=d,a==="left"?(n-=Wa,o="right"):a==="right"?(n+=Wa,o="left"):a==="top"?(r-=Wa,l="bottom"):a==="bottom"&&(r+=Wa,l="top")}return{x:n,y:r,align:o,textBaseline:l}}_computeOuterLabelLimit(t){var e,i,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),d=(n=(i=(e=this._labelMark)===null||e===void 0?void 0:e.getComponent())===null||i===void 0?void 0:i.getProduct().getGroupGraphicItem().find(({attribute:c,type:p})=>{var g;return p==="text"&&((g=c.data)===null||g===void 0?void 0:g[h])===t[h]},!0))===null||n===void 0?void 0:n.AABBBounds,u=d?d.x2-d.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,u/2)-Qn-2*((a=(r=this._spec.outerLabel)===null||r===void 0?void 0:r.spaceWidth)!==null&&a!==void 0?a:Wa)}_computeOuterLabelLinePosition(t){var e,i,n,r,a,o,l,h,d,u,c;const p=this.getCategoryField(),g=(a=(r=(n=(i=(e=this._funnelOuterLabelMark)===null||e===void 0?void 0:e.label)===null||i===void 0?void 0:i.getProduct())===null||n===void 0?void 0:n.elements)===null||r===void 0?void 0:r.find(w=>{var T;return((T=w.data[0])===null||T===void 0?void 0:T[p])===t[p]}))===null||a===void 0?void 0:a.getBounds(),f=(h=(l=(o=this._labelMark)===null||o===void 0?void 0:o.getComponent())===null||l===void 0?void 0:l.getProduct().getGroupGraphicItem().find(({attribute:w,type:T})=>{var M;return T==="text"&&((M=w.data)===null||M===void 0?void 0:M[p])===t[p]},!0))===null||h===void 0?void 0:h.AABBBounds,_=(d=this._spec.outerLabel)!==null&&d!==void 0?d:{};let m,v,y,b;if(this._isHorizontal()){const w=(u=_.spaceWidth)!==null&&u!==void 0?u:Wa,T=this.getPoints(t),M=(Math.abs(T[0].y-T[1].y)+Math.abs(T[2].y-T[3].y))/2;return this._spec.outerLabel.position==="top"||this._funnelAlign==="bottom"?(y=this._getPolygonCenter(T).y-M/2-w,b=_.alignLabel!==!1?(g==null?void 0:g.y2)+w:y-w,m=this._getPolygonCenter(T).x,y-b<Qn&&(b=y-Qn),v=m):(y=this._getPolygonCenter(T).y+M/2+w,b=_.alignLabel!==!1?(g==null?void 0:g.y1)-w:y+w,m=this._getPolygonCenter(T).x,b-y<Qn&&(b=y+Qn),v=m),{x1:m,x2:v,y1:y,y2:b}}const x=this.getPoints(t),S=(Math.abs(x[0].x-x[1].x)+Math.abs(x[2].x-x[3].x))/2,A=(f==null?void 0:f.x2)-(f==null?void 0:f.x1)||0,k=(c=_.spaceWidth)!==null&&c!==void 0?c:Wa;return this._spec.outerLabel.position==="right"||this._funnelAlign==="left"?(m=this._getPolygonCenter(x).x+Math.max(A/2,S/2)+k,v=_.alignLabel!==!1?(g==null?void 0:g.x1)-k:m+k,y=this._getPolygonCenter(x).y,v-m<Qn&&(v=m+Qn),b=y):(m=this._getPolygonCenter(x).x-Math.max(A/2,S/2)-k,v=_.alignLabel!==!1?(g==null?void 0:g.x2)+k:m-k,y=this._getPolygonCenter(x).y,m-v<Qn&&(v=m-Qn),b=y),{x1:m,x2:v,y1:y,y2:b}}_computeMaxSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width,i=(t=this._spec.maxSize)!==null&&t!==void 0?t:Ztt;return zi(i,e)}_computeMinSize(){var t;const e=this._isHorizontal()?this.getLayoutRect().height:this.getLayoutRect().width,i=(t=this._spec.minSize)!==null&&t!==void 0?t:Jtt;return zi(i,e)}_isHorizontal(){return this._funnelOrient==="left"||this._funnelOrient==="right"}_isReverse(){return this._funnelOrient==="bottom"||this._funnelOrient==="right"}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._funnelMark]}}mn.type=j.funnel,mn.mark=CD,mn.transformerConstructor=mS;const eet=()=>{tet(),Os(),Sc(),I.registerSeries(mn.type,mn),I.registerAnimation("funnel",(s,t)=>Object.assign({appear:t==="clipIn"?void 0:{type:"fadeIn"}},vm)),hZ(),Pr()};class Wu extends kB{constructor(){super(...arguments),this.type=Wu.type}}Wu.type="pyramid3d";const iet=()=>{I.registerMark(Wu.type,Wu),w7(),wL()};class wB extends mS{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class Nn extends mn{constructor(){super(...arguments),this.type=j.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=wB}initMark(){var t,e,i,n,r,a,o,l;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},Nn.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:(t=this._theme)===null||t===void 0?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0,support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},Nn.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:(e=this._theme)===null||e===void 0?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(n=(i=this._spec)===null||i===void 0?void 0:i.outerLabel)===null||n===void 0?void 0:n.visible){const{line:h}=(r=this._spec.outerLabel)!==null&&r!==void 0?r:{},{line:d}=(o=(a=this._theme)===null||a===void 0?void 0:a.outerLabel)!==null&&o!==void 0?o:{};this._funnelOuterLabelMark.label=this._createMark(Nn.mark.outerLabel,{themeSpec:(l=this._theme)===null||l===void 0?void 0:l.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(Nn.mark.outerLabelLine,{themeSpec:d,key:this._seriesField,markSpec:h,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:e=>{if(this._isHorizontal())return 0;const i=this.getPoints(e),n=Math.max(Math.abs(i[0].x-i[1].x),Math.abs(i[2].x-i[3].x));return(this._computeMaxSize()-n)/2}},"normal",Q.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:n=>{if(this._isHorizontal())return 0;const r=this.getPoints(n),a=Math.max(Math.abs(r[0].x-r[1].x),Math.abs(r[2].x-r[3].x));return(this._computeMaxSize()-a)/2}},"normal",Q.Series),this._labelMark=t,!((e=this._funnelOuterLabelMark)===null||e===void 0)&&e.label&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),!((i=this._funnelOuterLabelMark)===null||i===void 0)&&i.line&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}Nn.type=j.funnel3d,Nn.mark=PD,Nn.transformerConstructor=wB;const set=()=>{iet(),Os(),Sc(),I.registerSeries(Nn.type,Nn)},Yf=(s,t)=>{const e=(s-t[0])/(t[1]-t[0]||1);return Math.max(0,Math.min(1,e))},Xf=s=>{const t=s.mark.elements.filter(i=>i.diffState===ie.update),e=pi(t.map(i=>{var n;return(n=i==null?void 0:i.data)===null||n===void 0?void 0:n[0].depth}));return t.filter(i=>{var n;return((n=i==null?void 0:i.data)===null||n===void 0?void 0:n[0].depth)===e})},UM=(s,t,e)=>ft(s)?[t,e]:[pi(s.map(i=>1*i.getGraphicAttribute("startAngle",!1))),Ye(s.map(i=>1*i.getGraphicAttribute("endAngle",!1)))],net=s=>({channel:{startAngle:{from:(t,e)=>{const{startAngle:i,endAngle:n}=s.animationInfo(),r=Xf(e),a=UM(r,i,n);return Yf(t.startAngle,a)*(n-i)+i},to:t=>t.startAngle},endAngle:{from:(t,e)=>{const{startAngle:i,endAngle:n}=s.animationInfo(),r=Xf(e),a=UM(r,i,n);return Yf(t.endAngle,a)*(n-i)+i},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),$M=s=>[pi(s.map(t=>1*t.getGraphicAttribute("startAngle",!1))),Ye(s.map(t=>1*t.getGraphicAttribute("endAngle",!1)))],YM=s=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(t,e)=>{const{startAngle:i,endAngle:n}=s.animationInfo(),r=Xf(e),a=$M(r);return Yf(e.getGraphicAttribute("startAngle",!1),a)*(n-i)+i}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(t,e)=>{const{startAngle:i,endAngle:n}=s.animationInfo(),r=Xf(e),a=$M(r);return Yf(e.getGraphicAttribute("endAngle",!1),a)*(n-i)+i}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>s.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>s.animationInfo().innerRadius}}}),ret=(s,t)=>{switch(t){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},aet=()=>{I.registerAnimation("sunburst",(s,t)=>({appear:ret(s,t),enter:net(s),exit:YM(s),disappear:YM(s)}))},TB=(s,t=[],e)=>{const i=(e==null?void 0:e.maxDepth)>=0;return s.forEach(n=>{(!i||n.depth<=e.maxDepth)&&(t.push(e!=null&&e.callback?e.callback(n):n),n.children&&(i&&n.depth===e.maxDepth?(n.children=null,n.isLeaf=!0):TB(n.children,t,e)))}),t};function oet(s,t,e,i,n){const r=s.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let d=0;d<a;++d)o+=r[d].value,l[d+1]=o;const h=(d,u,c,p,g,f,_)=>{if(d>=u-1){const A=r[d];return A.x0=p,A.y0=g,A.x1=f,void(A.y1=_)}const m=l[d],v=c/2+m;let y=d+1,b=u-1;for(;y<b;){const A=y+b>>>1;l[A]<v?y=A+1:b=A}v-l[y-1]<l[y]-v&&d+1<y&&--y;const x=l[y]-m,S=c-x;if(f-p>_-g){const A=c?(p*S+f*x)/c:f;h(d,y,x,p,g,A,_),h(y,u,S,A,g,f,_)}else{const A=c?(g*S+_*x)/c:_;h(d,y,x,p,g,f,A),h(y,u,S,p,A,f,_)}};h(0,a,s.value,t,e,i,n)}function Tm(s,t,e,i,n,r={x0:"x0",x1:"x1",y0:"y0",y1:"y1"}){const a=s.children;let o,l=-1;const h=a.length,d=s.value&&(i-t)/s.value;for(;++l<h;)o=a[l],o[r.y0]=e,o[r.y1]=n,o[r.x0]=t,o[r.x1]=t+=o.value*d}function vS(s,t,e,i,n){const r=s.children;let a,o=-1;const l=r.length,h=s.value&&(n-e)/s.value;for(;++o<l;)a=r[o],a.x0=t,a.x1=i,a.y0=e,e+=a.value*h,a.y1=e}function het(s,t,e,i,n){(s.depth%2==1?vS:Tm)(s,t,e,i,n)}function det(s,t,e,i,n,r){const a=[],o=t.children;let l,h,d=0,u=0;const c=o.length;let p,g,f,_,m,v,y,b,x,S=t.value;for(;d<c;){p=n-e,g=r-i;do f=o[u++].value;while(!f&&u<c);for(_=f,m=f,b=Math.max(g/p,p/g)/(S*s),x=f*f*b,y=Math.max(m/x,x/_);u<c;++u){if(h=o[u].value,f+=h,h<_&&(_=h),h>m&&(m=h),x=f*f*b,v=Math.max(m/x,x/_),v>y){f-=h;break}y=v}l=Object.assign({},t,{value:f,children:o.slice(d,u)}),a.push(l),p<g?Tm(l,e,i,n,S?i+=g*f/S:r):vS(l,e,i,S?e+=p*f/S:n,r),S-=f,d=u}return a}const uet=s=>(t,e,i,n,r)=>{det(s,t,e,i,n,r)},Mm=(s,t,e=0,i=-1,n,r)=>{let a=0,o=i??-1,l=e;return s.forEach((h,d)=>{var u,c;const p={flattenIndex:++o,key:r?r(h):`${(u=n==null?void 0:n.key)!==null&&u!==void 0?u:""}-${d}`,maxDepth:-1,depth:e,index:d,value:h.value,isLeaf:!0,datum:n?n.datum.concat(h):[h],parentKey:n==null?void 0:n.key};if(!((c=h.children)===null||c===void 0)&&c.length){p.children=[],p.isLeaf=!1;const g=Mm(h.children,p.children,e+1,o,p,r);p.value=C(h.value)?g.sum:Math.max(g.sum,p.value),o=g.flattenIndex,l=Math.max(g.maxDepth,l)}else p.isLeaf=!0,p.value=C(h.value)?0:h.value;a+=Math.abs(p.value),t.push(p)}),{sum:a,maxDepth:l,flattenIndex:o}},Wo=(s,t,e,i)=>{let n=i;return s.forEach((r,a)=>{var o;n=t(r,a,e,n),!((o=r.children)===null||o===void 0)&&o.length&&(n=Wo(r.children,t,r,n))}),i},Hp=(s,t,e,i)=>{let n=i;return s.forEach((r,a)=>{var o;!((o=r.children)===null||o===void 0)&&o.length&&(n=Hp(r.children,t,r,n)),n=t(r,a,e,n)}),n},XM={binary:oet,dice:Tm,slice:vS,sliceDice:het};class Cm{constructor(t){var e;this._filterByArea=(r,a)=>{var o;const l=this._getMinAreaByDepth(r.depth);if(l>0&&r.value*a<l)return!1;if(!((o=r.children)===null||o===void 0)&&o.length){const h=r.children.filter(d=>this._filterByArea(d,a));h.length?h.length!==r.children.length&&(r.children=h):(r.isLeaf=!0,r.children=null)}return!0},this._getMinAreaByDepth=r=>{var a;return r<0?0:(a=U(this.options.minVisibleArea)?this.options.minVisibleArea[r]:this.options.minVisibleArea)!==null&&a!==void 0?a:0},this._getGapWidthByDepth=r=>{var a;return r<0?0:(a=U(this.options.gapWidth)?this.options.gapWidth[r]:this.options.gapWidth)!==null&&a!==void 0?a:0},this._getPaddingByDepth=r=>{var a;return r<0?0:(a=U(this.options.padding)?this.options.padding[r]:this.options.padding)!==null&&a!==void 0?a:0},this._getLabelPaddingByDepth=r=>{var a;return r<0?0:(a=U(this.options.labelPadding)?this.options.labelPadding[r]:this.options.labelPadding)!==null&&a!==void 0?a:0},this._layoutNode=r=>{const a=this._getGapWidthByDepth(r.depth);let o=r.x0,l=r.y0,h=r.x1,d=r.y1;if(r.maxDepth=this._maxDepth,a>0&&(o+=a/2,h-=a/2,l+=a/2,d-=a/2,o>h&&(o=(o+h)/2,h=o),l>d&&(l=(l+d)/2,d=l),r.x0=o,r.x1=h,r.y0=l,r.y1=d),r.children){const u=this._getLabelPaddingByDepth(r.depth),c=this._getPaddingByDepth(r.depth);c>0&&c<Math.min(h-o,d-l)/2&&(l+=c,d-=c,o+=c,h-=c),u>0&&(this.options.labelPosition==="top"&&l+u<d?(r.labelRect={x0:o,y0:l,x1:h,y1:l+u},l+=u):this.options.labelPosition==="bottom"&&d-u>l?(r.labelRect={x0:o,y0:d-u,x1:h,y1:d},d-=u):this.options.labelPosition==="left"&&o+u<h?(r.labelRect={x0:o,y0:l,x1:o+u,y1:d},o+=u):this.options.labelPosition==="right"&&h-u>o&&(r.labelRect={x0:h-u,y0:l,x1:h,y1:d},h-=u));const p=this._getGapWidthByDepth(r.depth+1);p>0&&(o-=p/2,h+=p/2,l-=p/2,d+=p/2),this._splitNode(r,o,l,h,d)}},this.options=Object.assign({},Cm.defaultOpionts,t);const i=this.options.nodeKey,n=q(i)?i:i?bn(i):null;this._getNodeKey=n,this._splitNode=this.options.splitType==="squarify"?uet(this.options.aspectRatio):(e=XM[this.options.splitType])!==null&&e!==void 0?e:XM.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},r=[],a=Mm(t,r,0,-1,null,this._getNodeKey);if(this._maxDepth=a.maxDepth,a.sum<=0)return[];const o={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:a.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:r},l=n.width*n.height/a.sum;return this._filterByArea(o,l),this._layout(o),(i=o.children)!==null&&i!==void 0?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(lt(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(lt(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0))<i)return!1;const n=this.options.minChildrenVisibleSize;return!lt(n)||!(Math.abs(t.x1-t.x0)<n||Math.abs(t.y1-t.y0)<n)}_layout(t){var e;this._filterChildren(t)||(t.children=null,t.isLeaf=!0),this._layoutNode(t),!((e=t.children)===null||e===void 0)&&e.length&&t.children.forEach(i=>{var n;!((n=i==null?void 0:i.children)===null||n===void 0)&&n.length?this._layout(i):this._layoutNode(i)})}}Cm.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const cet={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Nu{constructor(t){this._layoutNode=n=>{if(n.maxDepth=this._maxDepth,n.children){const r=this._parsedInnerRadius[n.depth+1],a=this._parsedOutterRadius[n.depth+1];Tm(n,n.startAngle,Math.min(r,a),n.endAngle,Math.max(r,a),cet);const o=U(this.options.label)?this.options.label[n.depth+1]:this.options.label;n.children.forEach(l=>{if(l.x=this._parsedCenter[0],l.y=this._parsedCenter[1],o)return this._layoutLabel(l,pe(o)?{align:"center",rotate:"radial"}:o)})}},this.options=t?Object.assign({},Nu.defaultOpionts,t):Object.assign({},Nu.defaultOpionts);const e=this.options.nodeKey,i=q(e)?e:e?bn(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Ts(this.options.center[0],t.width),n=t.y0+Ts(this.options.center[1],t.height),r=Math.min(t.width/2,t.height/2),a=this.options.innerRadius,o=this.options.outerRadius,l=U(a),h=l?a.map(g=>Ts(g,r)):Ts(a,r),d=U(o),u=this.options.gapRadius,c=d?o.map(g=>Ts(g,r)):Ts(o,r),p=QC(0,e+1);if(l)this._parsedInnerRadius=p.map((g,f)=>{const _=h[f];return C(_)?r:_}),this._parsedOutterRadius=p.map((g,f)=>{var _;return d?c[f]:f<e?this._parsedInnerRadius[f+1]-(U(u)?(_=u[f])!==null&&_!==void 0?_:0:u):c});else if(d)this._parsedOutterRadius=p.map((g,f)=>C(c[f])?r:c[f]),this._parsedInnerRadius=p.map((g,f)=>{var _;return f===0?h:this._parsedOutterRadius[f-1]-(U(u)?(_=u[f])!==null&&_!==void 0?_:0:u)});else{const g=Ts(a,r),f=(c-g)/(e+1);this._parsedInnerRadius=p.map((_,m)=>g+m*f),this._parsedOutterRadius=p.map((_,m)=>{var v;return this._parsedInnerRadius[m]+f-(U(u)?(v=u[m])!==null&&v!==void 0?v:0:u)})}this._parsedCenter=[i,n],this._maxRadius=r}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=Mm(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,r.maxDepth),this._maxDepth=r.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_layout(t,e){this._layoutNode(e),t.forEach(i=>{var n;!((n=i==null?void 0:i.children)===null||n===void 0)&&n.length?this._layout(i.children,i):this._layoutNode(i)})}_layoutLabel(t,e){var i;const n=(t.startAngle+t.endAngle)/2,r=(e.align==="start"?t.innerRadius:e.align==="end"?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+((i=e.offset)!==null&&i!==void 0?i:0),a=ln({x:this._parsedCenter[0],y:this._parsedCenter[1]},r,n);if(t.label={x:a.x,y:a.y,textBaseline:"middle"},e.rotate==="tangential")t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*r;else{const o=n%(2*Math.PI),l=o<0?o+2*Math.PI:o;l>Math.PI/2&&l<1.5*Math.PI?(t.label.angle=l+Math.PI,t.label.textAlign=e.align==="start"?"end":e.align==="end"?"start":"center"):(t.label.angle=l,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}Nu.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const pet=1664525,get=1013904223,KM=4294967296;function fet(s=1){let t=s;return()=>(t=(pet*t+get)%KM)/KM}function _et(s,t){let e=0;const i=JC(Array.from(s),t),n=i.length;let r,a,o=[];for(;e<n;)r=i[e],a&&MB(a,r)?++e:(o=met(o,r),a=vet(o),e=0);return a}function met(s,t){let e,i;if(Wv(t,s))return[t];for(e=0;e<s.length;++e)if(_p(t,s[e])&&Wv(fd(s[e],t),s))return[s[e],t];for(e=0;e<s.length-1;++e)for(i=e+1;i<s.length;++i)if(_p(fd(s[e],s[i]),t)&&_p(fd(s[e],t),s[i])&&_p(fd(s[i],t),s[e])&&Wv(CB(s[e],s[i],t),s))return[s[e],s[i],t];zt.getInstance().error("error when packEncloseRandom")}function _p(s,t){const e=s.radius-t.radius,i=t.x-s.x,n=t.y-s.y;return e<0||e*e<i*i+n*n}function MB(s,t){const e=s.radius-t.radius+1e-9*Math.max(s.radius,t.radius,1),i=t.x-s.x,n=t.y-s.y;return e>0&&e*e>i*i+n*n}function Wv(s,t){for(let e=0;e<t.length;++e)if(!MB(s,t[e]))return!1;return!0}function vet(s){switch(s.length){case 1:return yet(s[0]);case 2:return fd(s[0],s[1]);case 3:return CB(s[0],s[1],s[2])}}function yet(s){return{x:s.x,y:s.y,radius:s.radius}}function fd(s,t){const e=s.x,i=s.y,n=s.radius,r=t.x,a=t.y,o=t.radius,l=r-e,h=a-i,d=o-n,u=Math.sqrt(l*l+h*h);return{x:(e+r+l/u*d)/2,y:(i+a+h/u*d)/2,radius:(u+n+o)/2}}function CB(s,t,e){const i=s.x,n=s.y,r=s.radius,a=t.x,o=t.y,l=t.radius,h=e.x,d=e.y,u=e.radius,c=i-a,p=i-h,g=n-o,f=n-d,_=l-r,m=u-r,v=i*i+n*n-r*r,y=v-a*a-o*o+l*l,b=v-h*h-d*d+u*u,x=p*g-c*f,S=(g*b-f*y)/(2*x)-i,A=(f*_-g*m)/x,k=(p*y-c*b)/(2*x)-n,w=(c*m-p*_)/x,T=A*A+w*w-1,M=2*(r+S*A+k*w),P=S*S+k*k-r*r,O=-(Math.abs(T)>1e-6?(M+Math.sqrt(M*M-4*T*P))/(2*T):P/M);return{x:i+S+A*O,y:n+k+w*O,radius:O}}function qM(s,t,e){const i=s.x-t.x;let n,r;const a=s.y-t.y;let o,l;const h=i*i+a*a;h?(r=t.radius+e.radius,r*=r,l=s.radius+e.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),e.x=s.x-n*i-o*a,e.y=s.y-n*a+o*i):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),e.x=t.x+n*i-o*a,e.y=t.y+n*a+o*i)):(e.x=t.x+e.radius,e.y=t.y)}function ZM(s,t){const e=s.radius+t.radius-1e-6,i=t.x-s.x,n=t.y-s.y;return e>0&&e*e>i*i+n*n}function JM(s){const t=s._,e=s.next._,i=t.radius+e.radius,n=(t.x*e.radius+e.x*t.radius)/i,r=(t.y*e.radius+e.y*t.radius)/i;return n*n+r*r}function mp(s){return{_:s,next:null,prev:null}}function bet(s,t){const e=(s=Y(s)).length;if(!e)return 0;let i=s[0];if(i.x=0,i.y=0,e===1)return i.radius;const n=s[1];if(i.x=-n.radius,n.x=i.radius,n.y=0,e===2)return i.radius+n.radius;let r=s[2];qM(n,i,r);let a,o,l,h,d,u,c,p=mp(i),g=mp(n),f=mp(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let m=3;m<e;++m){c=!1,r=s[m],qM(p._,g._,r),f=mp(r),a=g.next,o=p.prev,l=g._.radius,h=p._.radius;do if(l<=h){if(ZM(a._,f._)){g=a,p.next=g,g.prev=p,--m,c=!0;break}l+=a._.radius,a=a.next}else{if(ZM(o._,f._)){p=o,p.next=g,g.prev=p,--m,c=!0;break}h+=o._.radius,o=o.prev}while(a!==o.next);if(!c){for(f.prev=p,f.next=g,p.next=g.prev=g=f,d=JM(p),f=f.next;f!==g;)u=JM(f),u<d&&(p=f,d=u),f=f.next;g=p.next}}const _=[g._];for(f=g.next;f!==g;)_.push(f._),f=f.next;r=_et(_,t);for(let m=0;m<e;++m)i=s[m],i.x-=r.x,i.y-=r.y;return r.radius}function QM(s){return function(t){t.children||(t.radius=Math.max(0,+s(t)||0))}}function Nv(s,t,e){return function(i){const n=i==null?void 0:i.children;if(n){let r;const a=n.length,o=s(i)*t||0;if(o)for(r=0;r<a;++r)n[r].radius+=o;const l=bet(n,e);if(o)for(r=0;r<a;++r)n[r].radius-=o;i.radius=l+o}}}function tC(s,t){return function(e,i,n){e.radius*=s,e.maxDepth=t,n&&(e.x=n.x+s*e.x,e.y=n.y+s*e.y)}}class Vu{constructor(t){this.options=t;const e=t==null?void 0:t.nodeKey,i=q(e)?e:e?bn(e):null;this._getNodeKey=i,this._getPadding=lt(t==null?void 0:t.padding)?n=>t.padding:U(t==null?void 0:t.padding)?n=>{var r;return(r=t.padding[n.depth+1])!==null&&r!==void 0?r:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const n="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const r=[],a=Mm(t,r,0,-1,null,this._getNodeKey);this._maxDepth=a.maxDepth;const o=fet(),l={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:a.sum,datum:null,children:r,x:n.x0+n.width/2,y:n.y0+n.height/2},{nodeSort:h,setRadius:d,padding:u,includeRoot:c}=(i=this.options)!==null&&i!==void 0?i:{};if(h!==!1){const p=q(h)?this.options.nodeKey:Vu.defaultOpionts.nodeSort;Wo([l],g=>{g.children&&g.children.length&&g.children.sort(p)})}if(d)Wo([l],QM(d)),Hp([l],Nv(this._getPadding,.5,o)),Wo([l],tC(1,this._maxDepth));else{const p=Math.min(n.width,n.height);Wo([l],QM(Vu.defaultOpionts.setRadius)),Hp([l],Nv(KN,1,o)),u&&Hp([l],Nv(this._getPadding,l.radius/p,o)),Wo([l],tC(p/(2*l.radius),this._maxDepth))}return c?[l]:r}}Vu.defaultOpionts={setRadius:s=>Math.sqrt(s.value),padding:0,nodeSort:(s,t)=>t.value-s.value};const yh=(s,t={})=>{if(!s)return[];const e=[];return TB(s,e,t),e},xet=(s,t)=>{if(!s)return s;const e=t(),{width:i,height:n}=e;return new Nu(e).layout(s,{width:i,height:n})},Aet=10;class ket extends hs{constructor(){super(...arguments),this.contentKeyCallback=t=>t==null?void 0:t[this.series.getDimensionField()[0]]}}var ra;(function(s){s.DrillDown="drillDown",s.DrillUp="drillUp"})(ra||(ra={}));const wet=(s,t)=>{const e=t.info(),i=t.keyField(),n=e==null?void 0:e.key;if(C(n))return s;if(e.type===ra.DrillDown){const r=iL(s,n,i,"children");return Y(r)}if(e.type===ra.DrillUp){const r=sL(s,n,i,"children");if(r)return Y(r)}return s};class yS{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return(e=sr(i))===null||e===void 0?void 0:e[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find(e=>e.type===J.tooltip);t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;Mt(t,"drillFilter",wet),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),r=>{var a,o,l;if(C(r.datum)||C((a=r.datum)===null||a===void 0?void 0:a[n]))return void this.drillUp();this._hideTooltip();const h=r.datum[n],d=(l=(o=this._drillInfo)===null||o===void 0?void 0:o.path)!==null&&l!==void 0?l:[],u=fq(e().rawData,h,n,"children");d[d.length-1]===u[u.length-1]?this.drillUp():this.drillDown(u)})}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!U(t)||ft(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:ra.DrillDown},e().reRunAllTransform(),i.emit(bt.drill,{value:{path:t,type:ra.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:n}=this._drillParams,r=(e=(t=this._drillInfo)===null||t===void 0?void 0:t.path)!==null&&e!==void 0?e:[];if(!U(r)||ft(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:ra.DrillUp},i().reRunAllTransform(),n.emit(bt.drill,{value:{path:r,type:ra.DrillUp},model:this}),r}}class _a extends Ac{constructor(){super(...arguments),this.type=j.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((t=this._spec.seriesField)!==null&&t!==void 0?t:Pa),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var e;return(e=this._spec.drillField)!==null&&e!==void 0?e:$n},getRawData:()=>this.getRawData()}),this._startAngle=le(this._spec.startAngle),this._endAngle=le(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),Mt(this._dataSet,"sunburstLayout",xet),Mt(this._dataSet,"flatten",yh),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:e,outerRadius:i,gap:n,label:r}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[E(this._centerX)?this._centerX:this.getLayoutRect().width/2,E(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:e,outerRadius:i,gapRadius:n,label:r}}}),t.transform({type:"flatten",options:{callback:e=>{if(e.datum){const i=e.datum[e.depth];return Object.assign(Object.assign({},e),i)}return e}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:wu,operations:["max","min","values"]},{key:Pa,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();C(t==null?void 0:t.dataSet)||(Mt(t.dataSet,"addVChartProperty",Dh),t.transform({type:"addVChartProperty",options:{beforeCall:oS.bind(this),call:bm}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t;if(this._sunburst.visible===!1)return;const e=this._createMark(_a.mark.sunburst,{isSeriesMark:!0,customShape:(t=this._spec.sunburst)===null||t===void 0?void 0:t.customShape});this._sunburstMark=e,this._trigger.registerMark(this._sunburstMark)}_initArcMarkStyle(){C(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(E(this._offsetX)?this._offsetX:0),y:t=>t.y+(E(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},mt.STATE_NORMAL,Q.Series)}_initLabelMark(){if(this._label.visible!==!0)return;const t=this._createMark(_a.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t)}_initLabelMarkStyle(){C(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return Vt(i)&&i.enable===!0?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>((e=i==null?void 0:i.circumference)!==null&&e!==void 0?e:Aet):this._spec.label.visible},x:t=>{var e;return((e=t.label)===null||e===void 0?void 0:e.x)+(E(this._offsetX)?this._offsetX:0)},y:t=>{var e;return((e=t.label)===null||e===void 0?void 0:e.y)+(E(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return(e=t.label)===null||e===void 0?void 0:e.textBaseline},textAlign:t=>{var e;return(e=t.label)===null||e===void 0?void 0:e.textAlign},angle:t=>{var e,i;return(i=(e=t.label)===null||e===void 0?void 0:e.angle)!==null&&i!==void 0?i:0},fontSize:10,text:t=>t.name},mt.STATE_NORMAL,Q.Series)}initTooltip(){this._tooltipHelper=new ket(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},n=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this.getMarksInType("arc").forEach(r=>{var a;r.setAnimationConfig(Ft((a=I.getAnimationInKey("sunburst"))===null||a===void 0?void 0:a(i,n),Ut(r.name,this._spec,this._markAttributeContext)))}),this.getMarksInType("text").forEach(r=>{var a;r.setAnimationConfig(Ft((a=I.getAnimationInKey("fadeInOut"))===null||a===void 0?void 0:a(),Ut(r.name,this._spec,this._markAttributeContext)))})}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(U(t))return t.map(n=>{const{width:r,height:a}=this.getRegion().getLayoutRect();return Math.min(r/2,a/2)*n});const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}}_a.type=j.sunburst,_a.mark=FD,ci(_a,yS);const Tet=()=>{I.registerSeries(_a.type,_a),kc(),Os(),Pr(),aet()},Met=(s,t)=>{if(!s)return s;const e=t(),{width:i,height:n}=e;return i===0||n===0?s:new Vu(e).layout(s,{width:i,height:n})};class Cet extends hs{constructor(){super(...arguments),this.contentKeyCallback=t=>t==null?void 0:t[this.series.getDimensionField()[0]]}}const Pet=s=>s==="fadeIn"?{type:"fadeIn"}:{type:"growRadiusIn"},Eet=()=>{I.registerAnimation("circlePacking",(s,t)=>({appear:Pet(t),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}))};class ma extends en{constructor(){super(...arguments),this.type=j.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((t=this._spec.seriesField)!==null&&t!==void 0?t:Pa),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var e;return(e=this._spec.drillField)!==null&&e!==void 0?e:$n},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();C(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),Mt(this._dataSet,"circlePackingLayout",Met),Mt(this._dataSet,"flatten",yh),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:e=>{if(e.datum){const i=e.datum[e.depth];return Object.assign(Object.assign({},e),i)}return e}}}))}_addDataIndexAndKey(){const t=this.getRawData();C(t==null?void 0:t.dataSet)||(Mt(t.dataSet,"addVChartProperty",Dh),t.transform({type:"addVChartProperty",options:{beforeCall:oS.bind(this),call:bm}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(((t=this._circlePacking)===null||t===void 0?void 0:t.visible)===!1)return;const i=this._createMark(ma.mark.circlePacking,{isSeriesMark:!0,customShape:(e=this._spec.circlePacking)===null||e===void 0?void 0:e.customShape});this._circlePackingMark=i,this._trigger.registerMark(i)}_initCirclePackingMarkStyle(){C(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},mt.STATE_NORMAL,Q.Series)}_initLabelMark(){var t;if(((t=this._label)===null||t===void 0?void 0:t.visible)===!1)return;const e=this._createMark(ma.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e)}_initLabelMarkStyle(){C(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},mt.STATE_NORMAL,Q.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:wu,operations:["max","min","values"]},{key:Pa,operations:["values"]}])}initTooltip(){this._tooltipHelper=new Cet(this),this._tooltipHelper.updateTooltipSpec(),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=(t=this._spec.animationAppear)===null||t===void 0?void 0:t.preset;this.getMarksInType("arc").forEach(i=>{var n;i.setAnimationConfig(Ft((n=I.getAnimationInKey("circlePacking"))===null||n===void 0?void 0:n(void 0,e),Ut(i.name,this._spec,this._markAttributeContext)))}),this.getMarksInType("text").forEach(i=>{var n;i.setAnimationConfig(Ft((n=I.getAnimationInKey("scaleInOut"))===null||n===void 0?void 0:n(),Ut(i.name,this._spec,this._markAttributeContext)))})}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}}ma.type=j.circlePacking,ma.mark=HD,ci(ma,yS);const Ret=()=>{I.registerSeries(ma.type,ma),kc(),Os(),ym(),Eet()},PB=s=>{let t=0;return s.forEach((e,i)=>{var n;C(e.value)&&(!((n=e.children)===null||n===void 0)&&n.length?e.value=PB(e.children):e.value=0),t+=Math.abs(e.value)}),t};function eC(s){return s.depth}function iC(s,t){return t-1-s.endDepth}function Oet(s,t){return s.sourceLinks.length?s.depth:t-1}function Det(s,t,e){return s.targetLinks.length?s.depth:s.sourceLinks.length?pi(s.sourceLinks.map(i=>e[i.target].depth))-1:0}const vp=(s,t)=>s.y0-t.y0,sC=(s,t)=>{if(C(s.value))return null;const e=(t?s.targetLinks:s.sourceLinks).reduce((i,n)=>(C(n.value)?i.count+=1:i.sum+=n.value,i),{sum:0,count:0});return e.count>0?(s.value-e.sum)/e.count:null},Let={left:eC,right:iC,justify:Oet,center:Det,start:eC,end:iC};class wc{constructor(t){this._ascendingSourceBreadth=(n,r)=>vp(this._nodeMap[n.source],this._nodeMap[r.source])||n.index-r.index,this._ascendingTargetBreadth=(n,r)=>vp(this._nodeMap[n.target],this._nodeMap[r.target])||n.index-r.index,this.options=Object.assign({},wc.defaultOptions,t);const e=this.options.nodeKey,i=q(e)?e:e?bn(e):null;this._getNodeKey=i,this._logger=zt.getInstance(),this._alignFunc=q(this.options.setNodeLayer)?n=>this.options.setNodeLayer(n.datum):Let[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Pk(this.options.direction)?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const n=this.computeNodeLinks(t),r=n.nodes,a=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(r),this.computeNodeDepths(r),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(r),this._maxDepth<=1)return null;const o=this.computeNodeBreadths(r);return this.computeLinkBreadths(r),Pk(this.options.direction)&&(r.forEach(l=>{const h=l.y0,d=l.y1;l.y0=l.x0,l.y1=l.x1,l.x0=h,l.x1=d}),a.forEach(l=>{l.vertical=!0;const h=l.x0,d=l.x1;l.x0=l.y0,l.x1=l.y1,l.y0=h,l.y1=d})),a.forEach(l=>{const h=this._nodeMap[l.source],d=this._nodeMap[l.target];l.sourceRect={x0:h.x0,x1:h.x1,y0:h.y0,y1:h.y1},l.targetRect={x0:d.x0,x1:d.x1,y1:d.y1,y0:d.y0}}),{nodes:r,links:a,columns:o}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},r={},a=[];PB(t);const o=(l,h,d)=>{l.forEach((u,c)=>{var p,g;const f=this._getNodeKey?this._getNodeKey(u):d?`${d[d.length-1].key}-${c}`:`${h}-${c}`;if(n[f])n[f].value=void 0;else{const _={depth:h,datum:u,index:c,key:f,value:(p=u.value)!==null&&p!==void 0?p:0,sourceLinks:[],targetLinks:[]};n[f]=_,e.push(_)}d&&a.push({source:d[d.length-1].key,target:f,value:(g=u.value)!==null&&g!==void 0?g:0,parents:d}),u.children&&u.children.length&&o(u.children,h+1,d?d.concat([n[f]]):[n[f]])})};return o(t,0,null),a.forEach((l,h)=>{const d=`${l.source}-${l.target}`;if(r[d])return r[d].value+=l.value,void r[d].datum.push(l);const u={index:h,key:`${l.source}-${l.target}`,source:l.source,target:l.target,datum:[l],value:l.value,parents:l.parents.map(c=>c.key)};i.push(u),n[l.source].sourceLinks.push(u),n[l.target].targetLinks.push(u),r[d]=u}),{nodes:e,links:i,nodeMap:n}}computeSourceTargetNodeLinks(t){const e=[],i=[],n={};t.nodes&&t.nodes.forEach((a,o)=>{const l={depth:-1,datum:a,index:o,key:this._getNodeKey?this._getNodeKey(a):o,value:a.value,sourceLinks:[],targetLinks:[]};n[l.key]=l,e.push(l)});const r=[];return t.links.forEach((a,o)=>{if(C(a.source)||C(a.target)||t.nodes&&(!n[a.source]||!n[a.target]))return;t.nodes||n[a.source]||(n[a.source]={value:void 0,depth:-1,index:e.length,key:a.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[a.source])),t.nodes||n[a.target]||(n[a.target]={value:void 0,depth:-1,index:e.length,key:a.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[a.target]));const l={index:o,source:a.source,target:a.target,datum:a,value:a.value};this.options.divideNodeValueToLink&&C(a.value)&&r.push(l),i.push(l),n[a.source].sourceLinks.push(l),n[a.target].targetLinks.push(l)}),this.options.divideNodeValueToLink&&r.length&&r.forEach(a=>{const o=[sC(n[a.source]),sC(n[a.target],!0)].filter(l=>!C(l));o.length&&(a.value=pi(o))}),{nodeMap:n,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const n=e.links;if(this.options.linkSortBy)for(let r=0,a=i.length;r<a;r++)i[r].sourceLinks.sort(this.options.linkSortBy),i[r].targetLinks.sort(this.options.linkSortBy);return this.options.dropIsolatedNode&&(i=i.filter(r=>r.targetLinks.length||r.sourceLinks.length)),{nodes:i,links:n,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e<i;e++){const n=t[e];n.value=Math.max(C(n.value)?0:n.value,n.sourceLinks.reduce((r,a)=>{var o;return r+((o=a.value)!==null&&o!==void 0?o:0)},0),n.targetLinks.reduce((r,a)=>{var o;return r+((o=a.value)!==null&&o!==void 0?o:0)},0))}}computeNodeDepths(t){const e=t.length;let i,n,r=t,a=0;for(;r.length&&a<e;){i=[],n={};for(let o=0,l=r.length;o<l;o++){const h=r[o];h.depth=a;for(let d=0,u=h.sourceLinks.length;d<u;d++){const c=h.sourceLinks[d];n[c.target]||(i.push(this._nodeMap[c.target]),n[c.target]=!0)}}r=i,a+=1}a>e&&this._logger.warn("Error: there is a circular link"),this._maxDepth=a}computeNodeEndDepths(t){const e=t.length;let i,n,r=t,a=0;for(;r.length&&a<e;){i=[],n={};for(let o=0,l=r.length;o<l;o++){const h=r[o];h.endDepth=a;for(let d=0,u=h.targetLinks.length;d<u;d++){const c=h.targetLinks[d];n[c.source]||(i.push(this._nodeMap[c.source]),n[c.source]=!0)}}r=i,a+=1}a>e&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,r=this._viewBox.width;let a=null,o=null,l=!1;if(ot(e)){const d=di(parseFloat(e.replace("%",""))/100,0,1);let u=r/(this._maxDepth-1+d);n>0&&(u=Math.max(n,u)),a=u*d,o=u*(1-d),l=!0}else if(lt(e)){if(a=e,lt(i))o=i;else if(C(i)){let d=(r-e)/(this._maxDepth-1);n>0&&(d=Math.max(n,d)),o=d-e}l=!0}else q(e)&<(i)&&(o=i);const h=[];for(let d=0,u=t.length;d<u;d++){const c=t[d];c.layer=this._isHierarchic?c.depth:di(Math.floor(this._alignFunc(c,this._maxDepth,this._nodeMap)),0,this._maxDepth-1);const p=c.layer;p===this._maxDepth-1&&(c.isLastLayer=!0),l&&(c.x0=this._viewBox.x0+p*(a+o),c.x1=c.x0+a),h[p]?h[p].push(c):h[p]=[c]}if(this.options.nodeSortBy)for(let d=0,u=h.length;d<u;d++)h[d].sort(this.options.nodeSortBy);if(!l&&q(e)){let d=this._viewBox.x0;for(let u=0;u<this._maxDepth;u++){const c=h[u];let p=0;for(let g=0,f=c.length;g<f;g++){const _=c[g],m=e(_);_.x0=d,_.x1=d+m,p=Math.max(a,m);const v=_.sourceLinks;for(let y=0,b=v.length;y<b;y++){const x=v[y];q(i)&&i(x)}}d+=p}}return h}initializeNodeBreadths(t){const e=this.options.minLinkHeight;let i=this.options.minNodeHeight;(C(i)||i<e)&&(i=e);let n=0,r=null;if(q(this.options.nodeGap))r=this.options.nodeGap,n=t.reduce((l,h)=>{const d=h.reduce((c,p)=>c+p.value,0),u=h.reduce((c,p)=>c+this.options.nodeGap(p),0);return Math.min(l,(this._viewBox.height-u)/d)},1/0);else{const l=t.reduce((d,u)=>Math.max(d,u.length),0),h=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/l);r=()=>h,this._gapY=h,n=t.reduce((d,u)=>{const c=u.reduce((p,g)=>p+g.value,0);return Math.min(d,(this._viewBox.height-(u.length-1)*h)/c)},1/0)}const a=this.options.gapPosition==="start",o=!a&&this.options.gapPosition!=="end";for(let l=0,h=t.length;l<h;l++){const d=t[l];let u=this._viewBox.y0,c=0;for(let g=0,f=d.length;g<f;g++){const _=d[g];c=r(_),a&&(u+=c),_.y0=u,_.y1=u+(i>0&&_.value!==0?Math.max(_.value*n,i):_.value*n),u=a?_.y1:_.y1+c;for(let m=0,v=_.sourceLinks.length;m<v;m++){const y=_.sourceLinks[m];y.thickness=e>0&&y.value!==0?Math.max(y.value*n,e):y.value*n}}let p=this._viewBox.y1-u+(o?c:0);if(p>0){if(this.options.crossNodeAlign!=="start")if(this.options.crossNodeAlign==="end")for(let g=0,f=d.length;g<f;++g){const _=d[g];_.y0+=p,_.y1+=p}else{p/=d.length+1;for(let g=0,f=d.length;g<f;++g){const _=d[g];_.y0+=p*(g+1),_.y1+=p*(g+1)}}}else if(p<0&&d.length>1&&(p/=d.length-1,c+p>0)){c+=p;for(let g=1,f=d.length;g<f;++g){const _=d[g];_.y0+=p*g,_.y1+=p*g}}this.reorderLinks(d)}}computeNodeBreadths(t){const e=this.computeNodeLayers(t);this.initializeNodeBreadths(e);const i=this.options.iterations;if(!this._isHierarchic&&!q(this.options.setNodeLayer)&&!q(this.options.nodeGap))for(let n=0;n<i;++n){const r=Math.pow(.99,n),a=Math.max(1-r,(n+1)/i);this.relaxRightToLeft(e,r,a),this.relaxLeftToRight(e,r,a)}return e}relaxLeftToRight(t,e,i){for(let n=1,r=t.length;n<r;++n){const a=t[n];for(let o=0,l=a.length;o<l;o++){const h=a[o];let d=0,u=0;for(let p=0,g=h.targetLinks.length;p<g;p++){const f=h.targetLinks[p],_=f.value*(h.layer-this._nodeMap[f.source].layer);d+=this.targetTop(this._nodeMap[f.source],h)*_,u+=_}if(!(u>0))continue;const c=(d/u-h.y0)*e;h.y0+=c,h.y1+=c,this.reorderNodeLinks(h)}C(this.options.nodeSortBy)&&a.sort(vp),this.resolveCollisions(a,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const r=t[n];for(let a=0,o=r.length;a<o;a++){const l=r[a];let h=0,d=0;for(let c=0,p=l.sourceLinks.length;c<p;c++){const g=l.sourceLinks[c],f=g.value*(this._nodeMap[g.target].layer-l.layer);h+=this.sourceTop(l,this._nodeMap[g.target])*f,d+=f}if(!(d>0))continue;const u=(h/d-l.y0)*e;l.y0+=u,l.y1+=u,this.reorderNodeLinks(l)}this.options.nodeSortBy===void 0&&r.sort(vp),this.resolveCollisions(r,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,n){for(;i<t.length;++i){const r=t[i],a=(e-r.y0)*n;a>1e-6&&(r.y0+=a,r.y1+=a),e=r.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const r=t[i],a=(r.y1-e)*n;a>1e-6&&(r.y0-=a,r.y1-=a),e=r.y0-this._gapY}}targetTop(t,e){let i,n,r,a=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i<n&&(r=t.sourceLinks[i],r.target!==e.key);i++)a+=r.thickness+this._gapY;for(i=0,n=e.targetLinks.length;i<n&&(r=e.targetLinks[i],r.source!==t.key);i++)a-=r.thickness;return a}sourceTop(t,e){let i,n,r,a=e.y0-(e.targetLinks.length-1)*this._gapY/2;for(i=0,n=e.targetLinks.length;i<n&&(r=e.targetLinks[i],r.source!==t.key);i++)a+=r.thickness+this._gapY;for(i=0,n=t.sourceLinks.length;i<n&&(r=t.sourceLinks[i],r.target!==e.key);i++)a-=r.thickness;return a}computeLinkBreadths(t){for(let e=0,i=t.length;e<i;e++){const n=t[e];let r=n.y0,a=r;for(let o=0,l=n.sourceLinks.length;o<l;o++){const h=n.sourceLinks[o];h.y0=r+h.thickness/2,h.x0=n.x1,r+=h.thickness}for(let o=0,l=n.targetLinks.length;o<l;o++){const h=n.targetLinks[o];h.y1=a+h.thickness/2,h.x1=n.x0,a+=h.thickness}}}reorderNodeLinks(t){if(C(this.options.linkSortBy)){const e=t.targetLinks,i=t.sourceLinks;for(let n=0,r=e.length;n<r;n++){const a=e[n];this._nodeMap[a.source].sourceLinks.sort(this._ascendingTargetBreadth)}for(let n=0,r=i.length;n<r;n++){const a=i[n];this._nodeMap[a.target].targetLinks.sort(this._ascendingSourceBreadth)}}}reorderLinks(t){if(C(this.options.linkSortBy))for(let e=0,i=t.length;e<i;e++){const n=t[e];n.sourceLinks.sort(this._ascendingTargetBreadth),n.targetLinks.sort(this._ascendingSourceBreadth)}}}wc.defaultOptions={iterations:6,nodeAlign:"justify",direction:"horizontal",nodeWidth:24,nodeGap:8,crossNodeAlign:"middle",dropIsolatedNode:!0};const Bet=(s,t)=>{const e=new wc(s).layout(Array.isArray(t)?t[0]:t,"width"in s?{width:s.width,height:s.height}:{x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1});return e?[e]:[]},Iet=()=>{st.registerTransform("sankey",{transform:Bet,markPhase:"beforeJoin"},!0)},EB=(s,t,e)=>{t.forEach(i=>{C(i[e])||s.add(i[e]),i.children&&i.children.length>0&&EB(s,i.children,e)})},RB=s=>{s.forEach(t=>{t.value=ot(t.value)?+t.value:t.value,t.children&&t.children.length>0&&RB(t.children)})},Fet=s=>{var t;if(!s||!U(s))return[];if(s.length>1){const e={links:[],nodes:[]};return s.forEach(i=>{i.id!=="links"&&i.id!=="nodes"||(e[i.id]=i.values)}),[e]}return!((t=s[0])===null||t===void 0)&&t.latestData?s[0].latestData:s},jet=(s,t)=>{var e,i;if(!s||!(t!=null&&t.view)||!s.length)return[];const n=t.view();if(n.x1-n.x0==0||n.y1-n.y0==0||n.x1-n.x0==-1/0||n.x1-n.x0==1/0||n.y1-n.y0==-1/0||n.y1-n.y0==1/0)return[];const r=s[0];if((t.sourceField!=="source"||t.targetField!=="target"||t.valueField!=="value")&&r.links){const l=[];r.links.forEach(h=>{const d={};for(const u in h)u===t.sourceField?d.source=h[t.sourceField]:u===t.targetField?d.target=h[t.targetField]:u===t.valueField?d.value=h[t.valueField]:d[u]=h[u];l.push(d)}),r.links=l}if(r.links){const l=[];r.links.forEach(h=>{const d={};for(const u in h)u==="value"?d.value=ot(h.value)?+h.value:h.value:d[u]=h[u];l.push(d)}),r.links=l}else!((i=(e=r.nodes)===null||e===void 0?void 0:e[0])===null||i===void 0)&&i.children&&RB(r.nodes);const a=new wc(t),o=[];return o.push(a.layout(r,n)),o},zet=s=>{var t,e;return s&&U(s)&&(!((t=s[0])===null||t===void 0)&&t.latestData)&&s[0].latestData.length&&s[0].latestData[0]&&(e=s[0].latestData[0].nodes)!==null&&e!==void 0?e:[]},Het=s=>{var t,e;return s&&U(s)&&(!((t=s[0])===null||t===void 0)&&t.latestData)&&s[0].latestData.length&&s[0].latestData[0]&&(e=s[0].latestData[0].links)!==null&&e!==void 0?e:[]};class Get extends hs{getDefaultTooltipPattern(t,e){if(t==="mark")return{visible:!0,activeType:t,title:{key:void 0,value:i=>{if(i.source){if(lt(i.source)){const n=this.series.getSeriesKeys();return n[i.source]+" => "+n[i.target]}return i.source+" => "+i.target}return i.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:i=>i.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1}]};if(t==="dimension"&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach(({data:r})=>r.forEach(({series:a})=>{n.push({seriesId:a.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeStroke:this.contentShapeColorCallback,shapeHollow:!1})})),{visible:!0,activeType:t,title:i,content:n}}return null}}const Wet=(s,t=!0)=>({type:s.direction==="horizontal"?"growWidthIn":"growHeightIn",options:{overall:t&&s.growFrom(),orient:"positive"}}),Net=(s,t)=>t==="fadeIn"?{type:"fadeIn"}:Wet(s),Vet=s=>s==="fadeIn"?{type:"fadeIn"}:{type:"linkPathGrowIn"},Uet=()=>{I.registerAnimation("sankeyNode",(s,t)=>Object.assign({appear:Net(s,t)},vm)),I.registerAnimation("sankeyLinkPath",(s,t)=>({appear:Vet(t),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))};class Uu extends Ri{constructor(){super(...arguments),this.type=Uu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}Uu.type="linkPath";const $et=()=>{K7(),I.registerMark(Uu.type,Uu)};class va extends en{constructor(){super(...arguments),this.type=j.sankey,this._nodeLayoutZIndex=he.Node,this._labelLayoutZIndex=he.Label,this._viewBox=new yi,this._handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")?this._handleLinkAdjacencyClick(e):this._handleClearEmpty()},this._handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")?this._handleLinkRelatedClick(e):this._handleClearEmpty()},this._handleClearEmpty=()=>{const t=this._nodeMark.getProduct();if(!t||!t.elements||!t.elements.length)return;const e=t.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,r=this._labelMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;e.forEach(o=>{o.clearStates()}),n.forEach(o=>{o.clearStates()}),a.forEach(o=>{o.clearStates()})},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const n=this._linkMark.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((r,a)=>{r.clearStates();const o=r.getDatum(),l=o!=null&&o.parents?"parents":"source";if(Y(o[l]).includes(e.key)){let h;if(i.includes(o.source)||i.push(o.source),i.includes(o.target)||i.push(o.target),l==="parents"){const d=o.datum;h=(d?d.filter(u=>u.parents.some(c=>c.key===e.key)).reduce((u,c)=>u+c.value,0):0)/o.value}r.addState("selected",{ratio:h})}else o.target===e.key?i.includes(o.source)||i.push(o.source):r.useStates(["blur"])})}if(this._nodeMark){const n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}if(this._labelMark){const n=this._labelMark.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const n=this._linkMark.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(r=>{r.clearStates(),r===t?r.addState("selected",{ratio:1}):r.useStates(["blur"])})}if(this._nodeMark){const n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}if(this._labelMark){const n=this._labelMark.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(r=>{r.clearStates(),i.includes(r.getDatum().key)||r.useStates(["blur"])})}},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;const r=n.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;const o=a.elements;if((!((e=o[0].getDatum())===null||e===void 0)&&e.parents?"parents":"source")=="source"){const l=[i.key],h=[];if(o.forEach((d,u)=>{var c,p,g,f;d.clearStates();const _=d.getDatum(),m=_!=null&&_.parents?"parents":"source";if(Y(_[m]).includes(i.key)){if(h.includes((c=_.key)!==null&&c!==void 0?c:_.index)||h.push((p=_.key)!==null&&p!==void 0?p:_.index),l.includes(_.source)||l.push(_.source),!l.includes(_.target)){l.push(_.target);let v=r.find(y=>y.data[0].key===_.target).data[0].sourceLinks;for(;(v==null?void 0:v.length)>0;){const y=[];return v.forEach(b=>{var x,S;if(!h.includes((x=b.key)!==null&&x!==void 0?x:b.index)&&(h.push((S=b.key)!==null&&S!==void 0?S:b.index),!l.includes(b.target))){l.push(b.target);const A=r.find(k=>k.data[0].key===b.target);y.push(A.data[0].targetLinks)}}),void(v=y)}}}else if(_.target===i.key&&(h.includes((g=_.key)!==null&&g!==void 0?g:_.index)||h.push((f=_.key)!==null&&f!==void 0?f:_.index),!l.includes(_.source))){l.push(_.source);let v=r.find(y=>y.data[0].key===_.source).data[0].targetLinks;for(;(v==null?void 0:v.length)>0;){const y=[];return v.forEach(b=>{var x,S;if(!h.includes((x=b.key)!==null&&x!==void 0?x:b.index)&&(h.push((S=b.key)!==null&&S!==void 0?S:b.index),!l.includes(b.source))){l.push(b.source);const A=r.find(k=>k.data[0].key===b.source);y.push(A.data[0].targetLinks)}}),void(v=y)}}}),this._linkMark){const d=this._linkMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach((u,c)=>{var p;u.clearStates(),h.includes((p=u.getDatum().key)!==null&&p!==void 0?p:u.getDatum().index)?u.useStates(["selected"]):u.useStates(["blur"])})}if(this._nodeMark){const d=this._nodeMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}if(this._labelMark){const d=this._labelMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}}else{const l=[i.key],h=i.targetLinks.reduce((d,u)=>(Y(u.datum).forEach(c=>{const p=c.parents,g=p.length;for(let f=0;f<g;f++){const _=p[f].key,m=p[f+1]?p[f+1].key:i.key,v=c.value,y=d.find(b=>b.source===_&&b.target===m);y?y.value+=v:d.push({source:_,target:m,value:v})}}),d),[]);if(o.forEach((d,u)=>{d.clearStates();const c=d.getDatum(),p=c!=null&&c.parents?"parents":"source",g=c.datum,f=g?g.filter(m=>m[p].some(v=>v.key===i.key)):null,_=h.find(m=>m.source===c.source&&m.target===c.target);if(f&&f.length){l.includes(c.source)||l.push(c.source),l.includes(c.target)||l.push(c.target);const m=f.reduce((v,y)=>v+y.value,0)/c.value;return d.useStates(["selected"]),void d.addState("selected",{ratio:m})}if(_)return l.includes(c.source)||l.push(c.source),l.includes(c.target)||l.push(c.target),d.useStates(["selected"]),void d.addState("selected",{ratio:_.value/c.value});d.useStates(["blur"])}),this._nodeMark){const d=this._nodeMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}if(this._labelMark){const d=this._labelMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if((!((e=t.getDatum())===null||e===void 0)&&e.parents?"parents":"source")=="source"){if(this._linkMark){const o=this._linkMark.getProduct();if(!o||!o.elements||!o.elements.length)return;o.elements.forEach(l=>{l.clearStates()})}if(this._nodeMark){const o=this._nodeMark.getProduct();if(!o||!o.elements||!o.elements.length)return;o.elements.forEach(l=>{l.clearStates()})}if(this._labelMark){const o=this._labelMark.getProduct();if(!o||!o.elements||!o.elements.length)return;o.elements.forEach(l=>{l.clearStates()})}}else{const o=t.getDatum(),l=[o.source,o.target],h=[];if(Y(o.datum).forEach(d=>{const u=d.parents,c=u.length;for(let p=0;p<c-1;p++){const g=u[p].key,f=u[p+1].key,_=d.value,m=h.find(v=>v.source===g&&v.target===f);h.push({source:u[p].key,target:u[p+1].key,value:d.value}),m?m.value+=_:h.push({source:g,target:f,value:_})}}),a.forEach(d=>{d.clearStates();const u=d.getDatum(),c=u.datum;if(u.source===o.source&&u.target===o.target)return d.useStates(["selected"]),void d.addState("selected",{ratio:1});const p=c?c.filter(f=>{const _=f.parents.map(m=>m.key);return _.includes(o.source)&&_.includes(o.target)}):null;if(p&&p.length){l.includes(u.source)||l.push(u.source),l.includes(u.target)||l.push(u.target);const f=p.filter(m=>m.parents.some((v,y)=>{var b;return v.key===o.source&&((b=m.parents[y+1])===null||b===void 0?void 0:b.key)===o.target})).reduce((m,v)=>m+v.value,0),_=f/u.value;return d.useStates(["selected"]),void d.addState("selected",{ratio:_})}const g=h.find(f=>f.source===u.source&&f.target===u.target);if(g)return l.includes(u.source)||l.push(u.source),l.includes(u.target)||l.push(u.target),d.useStates(["selected"]),void d.addState("selected",{ratio:g.value/u.value});d.useStates(["blur"])}),n.forEach(d=>{d.clearStates(),l.includes(d.getDatum().key)||d.useStates(["blur"])}),this._labelMark){const d=this._labelMark.getProduct();if(!d||!d.elements||!d.elements.length)return;d.elements.forEach(u=>{u.clearStates(),l.includes(u.getDatum().key)||u.useStates(["blur"])})}}}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((t=this._spec.seriesField)!==null&&t!==void 0?t:this._spec.categoryField),this._labelLimit=(i=(e=this._spec.label)===null||e===void 0?void 0:e.limit)!==null&&i!==void 0?i:100}initData(){var t,e,i,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){Mt(this._dataSet,"sankeyLayout",jet),Mt(this._dataSet,"sankeyFormat",Fet),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this._spec.direction,nodeAlign:(t=this._spec.nodeAlign)!==null&&t!==void 0?t:"justify",nodeGap:(e=this._spec.nodeGap)!==null&&e!==void 0?e:8,nodeWidth:(i=this._spec.nodeWidth)!==null&&i!==void 0?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:(n=this._spec.minNodeHeight)!==null&&n!==void 0?n:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer},level:Es.sankeyLayout});const{dataSet:o}=this._option;Mt(o,"sankeyNodes",zet),Mt(o,"flatten",yh);const l=new Zt(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:d=>{if(d.datum){const u=d.datum[d.depth];return Object.assign(Object.assign({},d),u)}return d}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:Tu.bind(this),call:ch}},!1),this._nodesSeriesData=new Yn(this._option,l),Mt(o,"sankeyLinks",Het);const h=new Zt(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:Tu.bind(this),call:ch}},!1),this._linksSeriesData=new Yn(this._option,h)}}initMark(){var t,e,i;const n=this._createMark(va.mark.node,{isSeriesMark:!0,key:ui,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),customShape:(t=this._spec.node)===null||t===void 0?void 0:t.customShape});n&&(n.setZIndex(this._nodeLayoutZIndex),this._nodeMark=n);const r=this._createMark(va.mark.link,{key:ui,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),customShape:(e=this._spec.link)===null||e===void 0?void 0:e.customShape});if(r&&(this._linkMark=r),(i=this._spec.label)===null||i===void 0?void 0:i.visible){const a=this._createMark(va.mark.label,{key:ui,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});a&&(this._labelMark=a)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:e=>e.x0,x1:e=>e.x1,y:e=>e.y0,y1:e=>e.y1,fill:e=>{var i,n,r,a;return(r=(n=(i=this._spec.node)===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.fill)!==null&&r!==void 0?r:(a=this._colorScale)===null||a===void 0?void 0:a.scale(this._getNodeNameFromData(e))}},mt.STATE_NORMAL,Q.Mark),this._trigger.registerMark(t))}_initLinkMarkStyle(){var t;const e=this._linkMark;e&&(this.setMarkStyle(e,{x0:i=>i.x0,x1:i=>i.x1,y0:i=>i.y0,y1:i=>i.y1,thickness:i=>i.thickness,fill:i=>{var n,r,a,o,l,h;const d=(r=(n=this._spec.link)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.fill;if(d)return d;const u=this._spec.nodeKey||!((l=(o=(a=this._rawData.latestData[0])===null||a===void 0?void 0:a.nodes)===null||o===void 0?void 0:o[0])===null||l===void 0)&&l.children?i.source:this.getNodeList()[i.source];return(h=this._colorScale)===null||h===void 0?void 0:h.scale(u)},direction:(t=this._spec.direction)!==null&&t!==void 0?t:"horizontal"},mt.STATE_NORMAL,Q.Series),this._trigger.registerMark(e))}_initLabelMarkStyle(){this._labelMark&&(this._spec.direction==="vertical"?this._spec.label.position==="inside-start"?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return(e=this._spec.label.limit)!==null&&e!==void 0?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this._spec.label.position==="inside-middle"?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return(e=this._spec.label.limit)!==null&&e!==void 0?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this._spec.label.position==="inside-end"?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return(e=this._spec.label.limit)!==null&&e!==void 0?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>{var e,i,n,r;return(n=(i=(e=this._spec.node)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.fill)!==null&&n!==void 0?n:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(t))},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},mt.STATE_NORMAL,Q.Series):this._spec.label.position==="inside-start"?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return(e=this._spec.label.limit)!==null&&e!==void 0?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this._spec.label.position==="inside-middle"?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return(e=this._spec.label.limit)!==null&&e!==void 0?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this._spec.label.position==="inside-end"?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return(e=this._spec.label.limit)!==null&&e!==void 0?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this._spec.label.position==="left"?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n,r;return(n=(i=(e=this._spec.node)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.fill)!==null&&n!==void 0?n:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(t))},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this._spec.label.position==="right"?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n,r;return(n=(i=(e=this._spec.node)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.fill)!==null&&n!==void 0?n:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(t))},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n,r;return(n=(i=(e=this._spec.node)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.fill)!==null&&n!==void 0?n:(r=this._colorScale)===null||r===void 0?void 0:r.scale(this._getNodeNameFromData(t))},text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},mt.STATE_NORMAL,Q.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark))}_createText(t){var e;if(C(t)||C(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return!((e=this._spec.label)===null||e===void 0)&&e.formatMethod&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e,i,n,r;const a={direction:this.direction,growFrom:()=>{var l,h;return this.direction==="horizontal"?(l=this._xAxisHelper)===null||l===void 0?void 0:l.getScale(0).scale(0):(h=this._yAxisHelper)===null||h===void 0?void 0:h.getScale(0).scale(0)}},o=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Ft((i=I.getAnimationInKey("sankeyNode"))===null||i===void 0?void 0:i(a,o),Ut("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Ft((n=I.getAnimationInKey("sankeyLinkPath"))===null||n===void 0?void 0:n(a,o),Ut("link",this._spec,this._markAttributeContext))),this._labelMark&&this._labelMark.setAnimationConfig(Ft((r=I.getAnimationInKey("fadeInOut"))===null||r===void 0?void 0:r(),Ut("label",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),(t=this._nodesSeriesData.getDataView())===null||t===void 0||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),(e=this._linksSeriesData.getDataView())===null||e===void 0||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const n=(i=this._spec.emphasis)!==null&&i!==void 0?i:{};this._option.disableTriggerEvent!==!0&&(n.enable&&n.effect==="adjacency"&&(n.trigger==="hover"?this.event.on("pointerover",{level:Yt.chart},this._handleAdjacencyClick):this.event.on("pointerdown",{level:Yt.chart},this._handleAdjacencyClick)),n.enable&&n.effect==="related"&&(n.trigger==="hover"?this.event.on("pointerover",{level:Yt.chart},this._handleRelatedClick):this.event.on("pointerdown",{level:Yt.chart},this._handleRelatedClick)))}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new Get(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}_setNodeOrdinalColorScale(){var t,e,i,n,r;const a=(e=(t=this._option)===null||t===void 0?void 0:t.globalScale)===null||e===void 0?void 0:e.getScale("color");if(a!=null&&a._specified)return void(this._colorScale=a);let o,l;a&&(o=a.domain(),l=a.range()),l||(l=this._getDataScheme()),o&&!C(o[0])||(o=this.getNodeList(),o.length>10&&(l=(i=this._getDataScheme()[1])===null||i===void 0?void 0:i.scheme));const h=new _c;(r=(n=h.domain(o)).range)===null||r===void 0||r.call(n,l),this._colorScale=h}getNodeList(){var t,e,i;return!((t=this._rawData.latestData[0])===null||t===void 0)&&t.nodes?!((e=this._rawData.latestData[0].nodes[0])===null||e===void 0)&&e.children?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes,this._spec.categoryField)):this._rawData.latestData[0].nodes.map((n,r)=>n[this._spec.categoryField]):(i=this._rawData.latestData[0])===null||i===void 0?void 0:i.values.map((n,r)=>n[this._spec.categoryField])}_getNodeNameFromData(t){return t!=null&&t.datum?t==null?void 0:t.datum[this._spec.categoryField]:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach(n=>{i.add(n[e]),n.children&&this.extractNamesFromTree(n.children,e).forEach(r=>i.add(r))}),i}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;return this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&(this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(!((i=this._viewDataStatistics.latestData)===null||i===void 0)&&i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})),this._rawStatisticsCache[t]}_collectByField(t){var e,i,n;const r=[],a=(i=(e=this.getRawData())===null||e===void 0?void 0:e.latestData)===null||i===void 0?void 0:i[0];if(!a)return[];if(a.links)!((n=a.nodes)===null||n===void 0)&&n.length&&a.nodes.forEach(o=>{o[this._seriesField]&&r.push(o[this._seriesField])});else if(a.nodes){const o=new Set;return EB(o,a.nodes,this._seriesField),Array.from(o)}return r}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}}va.type=j.sankey,va.mark=LD;const Yet=()=>{Iet(),Fa(),$et(),Os(),Uet(),Pr(),I.registerSeries(va.type,va)},Xet=(s,t)=>{if(!s||!(t!=null&&t.range))return s;const e=t.range();return e.x1-e.x0==0||e.y1-e.y0==0?s:new Cm(t).layout(s,e)},Ket=(s,t)=>{let e={},i=t.fields;if(q(i)&&(i=i()),!(i!=null&&i.length)||!(s!=null&&s.length)||!s[0].latestData)return e;const n=s[0].latestData,r=yh(n);return e=mb([{latestData:r}],t),e};class qet extends hs{constructor(){super(...arguments),this.contentKeyCallback=t=>t==null?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}const Zet=s=>s==="fadeIn"?{type:"fadeIn"}:{type:"growCenterIn"},Jet=()=>{I.registerAnimation("treemap",(s,t)=>({appear:Zet(t),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))};class OB extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class jn extends en{constructor(){super(...arguments),this.type=j.treemap,this.transformerConstructor=OB,this._viewBox=new yi,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField((t=this._spec.seriesField)!==null&&t!==void 0?t:Pa),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ze),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var e,i;return(i=(e=this._spec.drillField)!==null&&e!==void 0?e:this._categoryField)!==null&&i!==void 0?i:$n},getRawData:()=>this.getRawData()}),H(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,n;super.initData(),this.getViewData()&&(this._spec.drill&&this.initDrillableData(this._dataSet),Mt(this._dataSet,"treemap",Xet),Mt(this._dataSet,"flatten",yh),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:!((t=this._spec.nonLeafLabel)===null||t===void 0)&&t.visible?(e=this._spec.nonLeafLabel)===null||e===void 0?void 0:e.padding:0,labelPosition:(i=this._spec.nonLeafLabel)===null||i===void 0?void 0:i.position,minVisibleArea:(n=this._spec.minVisibleArea)!==null&&n!==void 0?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize},level:Es.treemapFilter}),this.addViewDataFilter({type:"flatten",options:{callback:r=>{if(r.datum){const a=r.datum[r.depth];return Object.assign(Object.assign({},r),a)}return r}},level:Es.treemapFlatten}))}_addDataIndexAndKey(){var t;!((t=this._rawData)===null||t===void 0)&&t.dataSet&&(Mt(this._rawData.dataSet,"addVChartProperty",Dh),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oS.bind(this),call:bm}}))}getRawDataStatisticsByField(t,e){var i;if(!this._rawDataStatistics){const n=`${this.type}_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(n,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}return(i=this._rawDataStatistics.latestData)===null||i===void 0?void 0:i[t]}_createHierarchyDataStatistics(t,e){Mt(this._dataSet,"hierarchyDimensionStatistics",Ket),Mt(this._dataSet,"flatten",yh);const i=new Zt(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const n=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&n.push({key:this._seriesField,operations:["values"]}),n}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:wu,operations:["max","min","values"]},{key:Pa,operations:["values"]}])}initMark(){var t,e;const i=this._createMark(jn.mark.nonLeaf,{isSeriesMark:!0,customShape:(t=this._spec.nonLeaf)===null||t===void 0?void 0:t.customShape});i&&(i.setTransform([{type:"filter",callback:r=>!this._shouldFilterElement(r,"nonLeaf")}]),this._trigger.registerMark(i),this._nonLeafMark=i);const n=this._createMark(jn.mark.leaf,{isSeriesMark:!0,customShape:(e=this._spec.leaf)===null||e===void 0?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:r=>!this._shouldFilterElement(r,"leaf")}]),this._leafMark=n,this._trigger.registerMark(n))}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},mt.STATE_NORMAL,Q.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},mt.STATE_NORMAL,Q.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:e=>(e.x0+e.x1)/2,y:e=>(e.y0+e.y1)/2,text:e=>{var i;return(i=e.datum[e.depth])===null||i===void 0?void 0:i[this.getDimensionField()[0]]},maxLineWidth:e=>e.x1===e.x0?Number.MIN_VALUE:e.x1-e.x0},mt.STATE_NORMAL,Q.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:e=>e.labelRect?(e.labelRect.x0+e.labelRect.x1)/2:(e.x0+e.x1)/2,y:e=>e.labelRect?(e.labelRect.y0+e.labelRect.y1)/2:(e.y0+e.y1)/2,text:e=>{var i;return(i=e.datum[e.depth])===null||i===void 0?void 0:i[this.getDimensionField()[0]]},maxLineWidth:e=>e.x1===e.x0?Number.MIN_VALUE:e.x1-e.x0},mt.STATE_NORMAL,Q.Series))}initAnimation(){this.getMarksInType("rect").forEach(t=>{var e;t.setAnimationConfig(Ft((e=I.getAnimationInKey("treemap"))===null||e===void 0?void 0:e(),Ut(t.name,this._spec,this._markAttributeContext)))}),this.getMarksInType("text").forEach(t=>{var e;t.setAnimationConfig(Ft((e=I.getAnimationInKey("fadeInOut"))===null||e===void 0?void 0:e(),Ut(t.name,this._spec,this._markAttributeContext)))})}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",t=>{this.handlePan(t)}),this.initZoomEventOfSeries(this),this.event.on("zoom",t=>{this.handleZoom(t)})),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new qet(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return e==="leaf"?!i:i}handlePan(t){const{delta:e}=t;if(e[0]===0&&e[1]===0)return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:n,c:r,d:a,e:o,f:l}=this._matrix;this._matrix.multiply(i,n,r,a,o,l),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(e===1)return;this._matrix.reset();const{x:n,y:r}=i;this._matrix.translate(n,r),this._matrix.scale(e,e),this._matrix.translate(-n,-r);const{a,b:o,c:l,d:h,e:d,f:u}=this._matrix;this._matrix.multiply(a,o,l,h,d,u),this.disableMarkAnimation(),this.event.on(ut.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach(t=>{var e;(e=t.getProduct().animate)===null||e===void 0||e.enable()}),[this._labelMark,this._nonLeafLabelMark].forEach(t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()}),this.event.off(ut.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach(t=>{var e;(e=t.getProduct().animate)===null||e===void 0||e.disable()}),[this._labelMark,this._nonLeafLabelMark].forEach(t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()})}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}}jn.type=j.treemap,jn.mark=DD,jn.transformerConstructor=OB,ci(jn,yS),ci(jn,pS);const Qet=()=>{Fa(),Os(),Jet(),Pr(),I.registerSeries(jn.type,jn)},tit=s=>({channel:{angle:{from:s.startAngle+Math.PI/2}}}),eit={type:"fadeIn"};function iit(s,t){return t==="fadeIn"?eit:tit(s)}const sit=()=>{I.registerAnimation("gaugePointer",(s,t)=>{const e=iit(s,t);return{appear:e,enter:e,disappear:{type:"fadeOut"}}})};class ya extends Lh{constructor(){super(...arguments),this.type=j.gaugePointer,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null,this._stack=!1}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType=((t=this._spec.pointer)===null||t===void 0?void 0:t.type)==="rect"?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(ya.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},ya.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(ya.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:i=>{var n,r;const{x:a}=this._getPointerAnchor(i,e);return a-this._getPointerWidth()*((r=(n=e==null?void 0:e.center)===null||n===void 0?void 0:n[0])!==null&&r!==void 0?r:0)},y:i=>{var n,r;const{y:a}=this._getPointerAnchor(i,e);return a-this._getPointerHeight(i)*((r=(n=e==null?void 0:e.center)===null||n===void 0?void 0:n[1])!==null&&r!==void 0?r:0)},anchor:i=>{const{x:n,y:r}=this._getPointerAnchor(i,e);return[n,r]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType==="path"?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:i=>this._getPointerAngle(i)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:i=>this._getPointerAngle(i)-Math.PI/2}),this._trigger.registerMark(t))}initTooltip(){super.initTooltip(),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return(i=e.isOnCenter)===null||i===void 0||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const n=this._spec.pointer,r=this._radiusField[0];return E(this.radiusAxisHelper)&&E(r)?this.radiusAxisHelper.dataToPosition([t[r]])-((e=n==null?void 0:n.innerPadding)!==null&&e!==void 0?e:0)-((i=n==null?void 0:n.outerPadding)!==null&&i!==void 0?i:10):n.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){var e,i,n,r;const a=this._spec.pointer,o=this._getPointerWidth()*((i=(e=a==null?void 0:a.center)===null||e===void 0?void 0:e[0])!==null&&i!==void 0?i:0),l=-this._getPointerHeight(t)*((r=(n=a==null?void 0:a.center)===null||n===void 0?void 0:n[1])!==null&&r!==void 0?r:0),h=this._getPointerAngle(t)-Math.PI/2,d=Math.cos(h),u=Math.sin(h);return{x:o*d+l*u,y:-(l*d-o*u)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:i=>this._getPointerAnchor(i,e).x,y:i=>this._getPointerAnchor(i,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:i=>this._getPointerAnchor(i,e).x,y:i=>this._getPointerAnchor(i,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var t,e,i;const n=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this._pointerMark.setAnimationConfig(Ft((i=I.getAnimationInKey("gaugePointer"))===null||i===void 0?void 0:i({startAngle:this._startAngle},n),Ut("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}ya.type=j.gaugePointer,ya.mark=ID;const nit=()=>{UL(),Fa(),sit(),I.registerSeries(ya.type,ya)};class DB extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class ba extends Lh{constructor(){super(...arguments),this.type=j.gauge,this.transformerConstructor=DB,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=le((t=this._spec.padAngle)!==null&&t!==void 0?t:0)}initData(){var t;super.initData(),Mt(this._option.dataSet,"spiltSegment",(e,i)=>{const n=e.slice();return n.sort((r,a)=>r[this._angleField[0]]-a[this._angleField[0]]),n.forEach((r,a)=>{r[Ev]=r[this._angleField[0]],r[jp]=a>0?n[a-1][Ev]:void 0}),n}),(t=this.getViewData())===null||t===void 0||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(ba.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(ba.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var i;return this._computeLayoutRadius()*((i=this._spec.innerRadius)!==null&&i!==void 0?i:0)},outerRadius:()=>{var i,n;return this._computeLayoutRadius()*((n=(i=this._spec.radius)!==null&&i!==void 0?i:this._spec.outerRadius)!==null&&n!==void 0?n:1)},cap:(t=this._spec.roundCap)!==null&&t!==void 0&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(e))}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var i;return this._computeLayoutRadius()*((i=this._spec.innerRadius)!==null&&i!==void 0?i:0)},outerRadius:()=>{var i,n;return this._computeLayoutRadius()*((n=(i=this._spec.radius)!==null&&i!==void 0?i:this._spec.outerRadius)!==null&&n!==void 0?n:1)},cap:(t=this._spec.roundCap)!==null&&t!==void 0&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(e))}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.min(e+this._padAngle/2,(e+i)/2)}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return Math.max(i-this._padAngle/2,(e+i)/2)}_getAngleValueStartWithoutPadAngle(t){return E(t[jp])?this.angleAxisHelper.dataToPosition([t[jp]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[Ev]])}initAnimation(){var t,e,i;const n=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset;this._segmentMark.setAnimationConfig(Ft((i=I.getAnimationInKey("circularProgress"))===null||i===void 0?void 0:i({startAngle:this._startAngle},n),Ut("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}ba.type=j.gauge,ba.mark=BD,ba.transformerConstructor=DB;const rit=()=>{hB(),dB(),I.registerSeries(ba.type,ba)};class $u extends RL{constructor(){super(...arguments),this.type=$u.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}$u.type="cell";const ait=()=>{I.registerMark($u.type,$u),D7(),LX()};function oit(s){return s===!1?{}:{type:"fadeIn"}}const lit=()=>{I.registerAnimation("heatmap",(s,t)=>Object.assign(Object.assign({},vm),{appear:oit(t)}))};class hit extends hs{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return E(i)&&t==="dimension"&&(i.visible=!1),i}}class LB extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class vr extends en{constructor(){super(...arguments),this.type=j.heatmap,this.transformerConstructor=LB}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e;const i={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(vr.mark.cell,{morph:Er(this._spec,vr.mark.cell.name),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,progressive:i,customShape:(t=this._spec.cell)===null||t===void 0?void 0:t.customShape}),this._backgroundMark=this._createMark(vr.mark.cellBackground,{progressive:i,customShape:(e=this._spec.cellBackground)===null||e===void 0?void 0:e.customShape})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:e=>e[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",Q.Series),this._trigger.registerMark(this._cellMark)}initCellBackgroundMarkStyle(){var t,e,i;const n=as((i=(e=(t=this._spec.cellBackground)===null||t===void 0?void 0:t.style)===null||e===void 0?void 0:e.padding)!==null&&i!==void 0?i:0);this.setMarkStyle(this._backgroundMark,{x:r=>{const a=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(r)-a/2+n[3]},y:r=>{const a=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(r)-a/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",Q.Series)}getColorAttribute(){var t;return{scale:(t=this._option.globalScale.getScale("color"))!==null&&t!==void 0?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var t,e,i;const n=(e=(t=this._spec)===null||t===void 0?void 0:t.animationAppear)===null||e===void 0?void 0:e.preset,r=Ba(this);this._cellMark.setAnimationConfig(Ft((i=I.getAnimationInKey("heatmap"))===null||i===void 0?void 0:i(n),Ut("cell",this._spec,this._markAttributeContext),r))}getCellSize(t){var e,i;return(i=(e=t.getBandwidth)===null||e===void 0?void 0:e.call(t,0))!==null&&i!==void 0?i:6}initTooltip(){this._tooltipHelper=new hit(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}vr.type=j.heatmap,vr.mark=GD,vr.transformerConstructor=LB;const dit=()=>{Os(),ait(),lit(),I.registerSeries(vr.type,vr)},uit=(s,t)=>{var e,i,n,r,a,o,l,h,d,u,c,p,g,f,_;if(!s||!(t!=null&&t.view)||!U(s))return s;const m=t.view();if(m.x1-m.x0==0||m.y1-m.y0==0||m.x1-m.x0==-1/0||m.x1-m.x0==1/0||m.y1-m.y0==-1/0||m.y1-m.y0==1/0)return s;const v=le((e=t.startAngle)!==null&&e!==void 0?e:-90),y=le((i=t.endAngle)!==null&&i!==void 0?i:270),b=Math.max((m.x1-m.x0)/2,(m.y1-m.y0)/2),x=Ts((n=t.innerRadius)!==null&&n!==void 0?n:0,b),S=Ts(t.outerRadius,b),A=[lt((r=t.center)===null||r===void 0?void 0:r[0])?t.center[0]:m.x0+Ts((o=(a=t.center)===null||a===void 0?void 0:a[0])!==null&&o!==void 0?o:"50%",m.x1-m.x0),lt((l=t.center)===null||l===void 0?void 0:l[1])?t.center[1]:m.y0+Ts((d=(h=t.center)===null||h===void 0?void 0:h[1])!==null&&d!==void 0?d:"50%",m.y1-m.y0)],k=bn(t.field),w=s.map(k),[T,M]=vy(w),P=T===M?V=>(x+S)/2:V=>x+(S-x)*(V-T)/(M-T),O=C(t.radiusField)?k:bn(t.radiusField),D=(c=(u=t==null?void 0:t.radiusRange)===null||u===void 0?void 0:u[1])!==null&&c!==void 0?c:5;let R=V=>D;if(O){const[V,G]=O!==k?vy(s.map(O)):[T,M],X=(g=(p=t.radiusRange)===null||p===void 0?void 0:p[0])!==null&&g!==void 0?g:5,Z=(_=(f=t.radiusRange)===null||f===void 0?void 0:f[1])!==null&&_!==void 0?_:5;V!==G&&(R=et=>X+(Z-X)*(O(et)-V)/(G-V))}const L=Math.min(v,y),B=Math.max(v,y),F=cit(L,B,s.length),z=[],N=(B-L)/60;return s.forEach((V,G)=>{const X=P(w[G]),Z=R(V);let et,K,W=F[G];for(let it=0;it<60&&(et=A[0]+X*Math.cos(W),K=A[1]+X*Math.sin(W),pit({x:et,y:K,size:Z},z)||et-Z<m.x0||et+Z>m.x1||K-Z<m.y0||K+Z>m.y1);it++)it<59&&(W+=N,W>B?W=L:W<L&&(W=B));z.push(Object.assign({[gD]:et,[fD]:K,[_D]:Z},V))}),z},cit=(s,t,e)=>{let i=0,n=Math.max(Math.ceil(2*(t-s)/Math.PI),2),r=(t-s)/n,a=0,o=1,l=0,h=0;const d=[];let u=s;for(;l<e;)h<n&&(d.push(u+(h%2?Math.floor(h/2)+Math.floor(n/2):h/2)*r*o),h++),l++,h===n&&(h=0,a+=1,o*=-1,i===0?i=r/2:i/=2,u=o===-1?t-i:s+i,a>=2&&(r/=2,n*=2));return d},pit=(s,t)=>!(!t||!t.length)&&t.some(e=>Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2)<Math.pow(s.size+e.size,2)),git=(s,t)=>{if(!s||!U(s))return[];const{keyword:e,categoryField:i}=t,n=s[0].latestData[0];return{[i]:e,[ui]:n==null?void 0:n[ui],[Ms]:n==null?void 0:n[Ms]}};class Yu extends Ri{constructor(){super(...arguments),this.type=Yu.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",t??e.rootMark).id(i),this._compiledProductId=i}}Yu.type="ripple";const fit=()=>{I.registerMark(Yu.type,Yu),W7()},_it=(s,t)=>t==="fadeIn"?{type:"fadeIn"}:{type:"scaleIn"},mit=()=>{I.registerAnimation("correlation",(s,t)=>Object.assign({appear:_it(0,t)},rS))};class BB extends Rs{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class yr extends Ac{constructor(){super(...arguments),this.type=j.correlation,this.transformerConstructor=BB,this._viewBox=new yi}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){E(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){E(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){E(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;Mt(this._dataSet,"correlation",uit);const n=new no;mr(n,"dataview",A_),Mt(n,"correlationCenter",git);const r=new Zt(n,{name:`${this.type}_${this.id}_center`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"correlationCenter",options:{keyword:(i=(e=(t=this._spec.centerLabel)===null||t===void 0?void 0:t.style)===null||e===void 0?void 0:e.text)!==null&&i!==void 0?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new Yn(this._option,r)}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e;const i=this._createMark(yr.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:ui,customShape:(t=this._spec.nodePoint)===null||t===void 0?void 0:t.customShape});i&&(i.setZIndex(he.Node),this._nodePointMark=i);const n=this._createMark(yr.mark.ripplePoint,{key:ui,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});n&&(this._ripplePointMark=n);const r=this._createMark(yr.mark.centerPoint,{key:ui,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),customShape:(e=this._spec.centerPoint)===null||e===void 0?void 0:e.customShape});r&&(r.setZIndex(he.Node),this._centerPointMark=r)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,n;const r=this._nodePointMark;if(!r)return;const a=(e=(t=this._spec.nodePoint)===null||t===void 0?void 0:t.style)!==null&&e!==void 0?e:{};this.setMarkStyle(r,{x:o=>o[gD],y:o=>o[fD],size:o=>o[_D],fill:(i=a.fill)!==null&&i!==void 0?i:this.getColorAttribute(),fillOpacity:(n=a.fillOpacity)!==null&&n!==void 0?n:1,lineWidth:0},mt.STATE_NORMAL,Q.Series),this._trigger.registerMark(r)}_initRipplePointMarkStyle(){var t,e,i,n,r;const a=this._ripplePointMark;if(!a)return;const o=(e=(t=this._spec.ripplePoint)===null||t===void 0?void 0:t.style)!==null&&e!==void 0?e:{};this.setMarkStyle(a,{x:()=>{var l;return(l=this._spec.centerX)!==null&&l!==void 0?l:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var l;return(l=this._spec.centerY)!==null&&l!==void 0?l:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:(i=o.fill)!==null&&i!==void 0?i:this.getColorAttribute(),opacity:(n=o.fillOpacity)!==null&&n!==void 0?n:.2,ripple:(r=o.ripple)!==null&&r!==void 0?r:0},mt.STATE_NORMAL,Q.Series)}_initCenterPointMarkStyle(){var t,e,i,n,r,a;const o=this._centerPointMark;o&&(this.setMarkStyle(o,{x:()=>{var l;return(l=this._spec.centerX)!==null&&l!==void 0?l:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var l;return(l=this._spec.centerY)!==null&&l!==void 0?l:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:(i=(e=(t=this._spec.centerPoint)===null||t===void 0?void 0:t.style)===null||e===void 0?void 0:e.fill)!==null&&i!==void 0?i:this.getColorAttribute(),fillOpacity:(a=(r=(n=this._spec.centerPoint)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.fillOpacity)!==null&&a!==void 0?a:1},mt.STATE_NORMAL,Q.Series),this._trigger.registerMark(o))}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:e=>e[this._categoryField],z:this.dataToPositionZ.bind(this)},mt.STATE_NORMAL,Q.Series)}initAnimation(){var t,e;const i=(t=this._spec.animationAppear)===null||t===void 0?void 0:t.preset;this._nodePointMark.setAnimationConfig(Ft((e=I.getAnimationInKey("correlation"))===null||e===void 0?void 0:e({},i),Ut("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}yr.type=j.correlation,yr.mark=WD,yr.transformerConstructor=BB;const vit=()=>{Ia(),fit(),I.registerSeries(yr.type,yr),mit()};class IB extends sn{_isValidSeries(t){return t===j.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor})}transformSpec(t){super.transformSpec(t),t.region.forEach(i=>{i.coordinate="geo"});const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class ul extends xe{constructor(){super(...arguments),this.transformerConstructor=IB,this.type="map",this.seriesType=j.map}}ul.type="map",ul.seriesType=j.map,ul.view="singleDefault",ul.transformerConstructor=IB;const yit=()=>{PJ(),I.registerChart(ul.type,ul)};class bS extends sn{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const r=Y(t.indicator),a=(e=t.innerRadius)!==null&&e!==void 0?e:(n=(i=t.series)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.innerRadius;return E(a)&&r.forEach(o=>{C(o.limitRatio)&&(o.limitRatio=a)}),r}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),U(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach(i=>{i.filterMode==="axis"&&(i.filterMode="filter")});const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e],E(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class FB extends bS{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,n,r){var a,o;t.axes||(t.axes=[]);let l=((a=t.axes)!==null&&a!==void 0?a:[]).find(u=>u.orient==="radius"),h=((o=t.axes)!==null&&o!==void 0?o:[]).find(u=>u.orient==="angle");h||(h=e,t.axes.push(h)),l||(l=i,t.axes.push(l)),C(h.type)&&(h.type="linear"),C(l.type)&&(l.type="band");const d=Lu(h,{min:0,max:1});C(h.min)&&(h.min=d.min),C(h.max)&&(h.max=d.max),n&&Object.assign(h,_t({},n,h)),r&&Object.assign(l,_t({},r,l))}}class jB extends bS{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};((e=t.axes)!==null&&e!==void 0?e:[]).forEach(n=>{const{orient:r}=n;r==="radius"&&(i.radius=!0),r==="angle"&&(i.angle=!0)}),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class Tc extends bS{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle})}}class xS extends xe{constructor(){super(...arguments),this.transformerConstructor=Tc}}xS.transformerConstructor=Tc;class cl extends xS{constructor(){super(...arguments),this.transformerConstructor=Tc,this.type="pie",this.seriesType=j.pie}}cl.type="pie",cl.seriesType=j.pie,cl.view="singleDefault",cl.transformerConstructor=Tc;const bit=()=>{rQ(),I.registerChart(cl.type,cl)};class zB extends Tc{transformSpec(t){super.transformSpec(t),t.series.forEach(e=>{e.type==="pie3d"&&(e.angle3d=t.angle3d)})}}class pl extends xS{constructor(){super(...arguments),this.transformerConstructor=zB,this.type="pie3d",this.seriesType=j.pie3d}}pl.type="pie3d",pl.seriesType=j.pie3d,pl.view="singleDefault",pl.transformerConstructor=zB;const xit=()=>{oQ(),I.registerChart(pl.type,pl)};class HB extends jB{_getDefaultSeriesSpec(t){var e,i,n;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:(e=t.radius)!==null&&e!==void 0?e:pu,outerRadius:(i=t.outerRadius)!==null&&i!==void 0?i:pu,innerRadius:(n=t.innerRadius)!==null&&n!==void 0?n:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),((e=t.axes)!==null&&e!==void 0?e:[]).forEach(i=>{["domainLine","grid","label","tick"].forEach(n=>{i[n]||(i[n]={visible:!1})}),i.orient==="angle"&&C(i.bandPosition)&&(i.bandPosition=.5)}),t.crosshair=Y(t.crosshair||{}).map(i=>_t({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},i))}}class gl extends xe{constructor(){super(...arguments),this.transformerConstructor=HB,this.type="rose",this.seriesType=j.rose,this._canStack=!0}}gl.type="rose",gl.seriesType=j.rose,gl.view="singleDefault",gl.transformerConstructor=HB;const Sit=()=>{gQ(),I.registerChart(gl.type,gl)};class GB extends jB{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:_t({visible:!1},t.area),seriesMark:(e=t.seriesMark)!==null&&e!==void 0?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),((e=t.axes)!==null&&e!==void 0?e:[]).forEach(i=>{i.orient==="radius"&&(["domainLine","label","tick"].forEach(n=>{i[n]||(i[n]={visible:!1})}),i.grid||(i.grid={visible:!0,smooth:!0}))}),t.crosshair=Y(t.crosshair||{}).map(i=>_t({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},i))}}class fl extends xe{constructor(){super(...arguments),this.transformerConstructor=GB,this.type="radar",this.seriesType=j.radar,this._canStack=!0}}fl.type="radar",fl.seriesType=j.radar,fl.view="singleDefault",fl.transformerConstructor=GB;const Ait=()=>{bQ(),I.registerChart(fl.type,fl)};class WB extends sn{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})})}t.axes&&t.axes.length&&t.axes.forEach(e=>{Et(e,"trimPadding")&&_t(e,pL(this.type,t))})}}class Fd extends xe{constructor(){super(...arguments),this.transformerConstructor=WB,this.type="common",this._canStack=!0}}Fd.type="common",Fd.view="singleDefault",Fd.transformerConstructor=WB;const kit=()=>{I.registerChart(Fd.type,Fd)},xb=12;class NB extends sn{_getSeriesDataLength(t,e){var i,n;if(e.data){const a=Y(e.data)[0];return a instanceof Zt?(i=a.latestData)===null||i===void 0?void 0:i.length:(n=a.values)===null||n===void 0?void 0:n.length}const r=Y(t.data).find((a,o)=>e.dataId?a instanceof Zt?a.name===e.dataId:a.id===e.dataId:e.dataIndex===o);return r?r instanceof Zt?r.latestData.length:r.values.length:0}addAttrToComponentSpec(t,e,i){return Array.isArray(t)?t[0][e]=i:t[e]=i,t}transformSpec(t){var e,i,n,r,a,o,l,h,d,u,c;super.transformSpec(t);let p=0;const g=[],f=[],_=[],m=[],v=[],y=t.series.filter(k=>k.type!==j.link).length,b=(500-20*(y-1))/y,x=((e=t==null?void 0:t.appendPadding)===null||e===void 0?void 0:e.left)||0,S=((i=t==null?void 0:t.appendPadding)===null||i===void 0?void 0:i.right)||0;if(t!=null&&t.legends){g.push({modelId:`legendRow${p}`,col:1,row:p}),this.addAttrToComponentSpec(t.legends,"id",`legendRow${p}`);const k=Y(t.legends);let w=(n=k[0].height)!==null&&n!==void 0?n:40;if(k[0].padding){const T=Ar(k[0].padding);w+=Number((r=T==null?void 0:T.bottom)!==null&&r!==void 0?r:0),w+=Number((a=T==null?void 0:T.top)!==null&&a!==void 0?a:0),k[0].offsetY=Number((l=(o=k[0])===null||o===void 0?void 0:o.offsetY)!==null&&l!==void 0?l:0)+Number((h=T==null?void 0:T.top)!==null&&h!==void 0?h:0)}v.push({index:p,size:w}),p++}t!=null&&t.dataZoom&&(g.push({modelId:`dataZoomRow${p}`,col:1,row:p}),this.addAttrToComponentSpec(t.dataZoom,"id",`dataZoomRow${p}`),p++,v.push({index:p,size:10}),p++),f.push({id:`regionAxesRow${p}`}),g.push({modelId:`axesRow${p}`,col:1,row:p}),t.axes[0].id=`axesRow${p}`,t.axes[0].regionIndex=Array.from(Array(t.series.length),(k,w)=>w+1),p++,(d=t==null?void 0:t.series)===null||d===void 0||d.forEach(k=>{var w,T;if([j.bar,j.line,j.area,j.dot].includes(k.type)){if(g.push({modelId:`${k.type}Row${p}`,col:1,row:p}),g.push({modelId:`axesLeftRow${p}`,col:0,row:p}),f.push({id:`${k.type}Row${p}`,clip:!1}),v.push({index:p,size:(k==null?void 0:k.height)||b}),_.push({orient:"left",id:`axesLeftRow${p}`,type:k.type===j.dot?"band":"linear",visible:k.type!==j.dot,title:{visible:!0,autoRotate:!1,style:{text:k==null?void 0:k.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:typeof((w=k==null?void 0:k.grid)===null||w===void 0?void 0:w.visible)!="boolean"||((T=k==null?void 0:k.grid)===null||T===void 0?void 0:T.visible),style:(M,P)=>{var O,D,R,L,B;let F=0;if(P===0){const z=(O=k==null?void 0:k.grid)===null||O===void 0?void 0:O.style;F=(R=(D=z==null?void 0:z.lineWidth)!==null&&D!==void 0?D:z==null?void 0:z.strokeWidth)!==null&&R!==void 0?R:1}return{lineWidth:F,stroke:((B=(L=k==null?void 0:k.grid)===null||L===void 0?void 0:L.style)===null||B===void 0?void 0:B.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:f.length-1}),k.type===j.dot){g.push({modelId:`scrollBarRightRow${p}`,col:2,row:p});const M=this._getSeriesDataLength(t,k);let P=0;M&&(P=((k==null?void 0:k.height)||b)/(30*M)),m.push(Object.assign({orient:"right",visible:k.type===j.dot&&P<1,id:`scrollBarRightRow${p}`,start:0,end:Math.min(P,1),filterMode:"axis",regionIndex:f.length-1,axisId:`axesLeftRow${p}`},Y(t==null?void 0:t.scrollBar)[0]))}k.regionIndex=f.length-1,p++,v.push({index:p,size:(k==null?void 0:k.padding)||20}),p++,k.leftAppendPadding=x,k.type===j.dot&&(k.title.style.dx=-x,k.subTitle.style.dx=-x)}}),(u=t==null?void 0:t.series)===null||u===void 0||u.forEach(k=>{if(k.type===j.link){const w=k.dotSeriesIndex+1;g.push({modelId:`${k.type}Row${w}`,col:1,row:w-1}),k.regionIndex=t.series[k.dotSeriesIndex].regionIndex,k.leftAppendPadding=x,k.height=t.series[k.dotSeriesIndex].height,k.clipHeight=t.series[k.dotSeriesIndex].clipHeight}}),t!=null&&t.legends&&this.addAttrToComponentSpec(t.legends,"regionIndex",[f.length-1]);const A={type:"grid",col:4,row:p,colWidth:[{index:0,size:x},{index:2,size:xb},{index:3,size:S}],rowHeight:v,elements:g};t.layout=A,t.region=f,(c=t.axes)===null||c===void 0||c.push(..._),t.scrollBar=m}}var wit=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};class jd extends xe{constructor(){super(...arguments),this.transformerConstructor=NB,this.type="sequence"}_createSeries(t,e){if(!t)return;const{spec:i}=e,n=wit(e,["spec"]);let r;if(i.type===j.link&&(i.dotSeriesSpec=this._spec.series[i.dotSeriesIndex]),i.regionId&&(r=this.getRegionsInUserId(i.regionId)),r||(r=this.getRegionsInIndex(i.regionIndex?[i.regionIndex]:void 0)[0]),!r)return;const a=new t(i,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{region:r,specKey:"series",globalScale:this._globalScale}));a&&(a.created(),this._series.push(a),r.addSeries(a))}}jd.type="sequence",jd.view="singleDefault",jd.transformerConstructor=NB;const Tit=()=>{kQ(),MQ(),I.registerChart(jd.type,jd)};class SS extends wn{transformSpec(t){super.transformSpec(t),t.axes.forEach(e=>e.type="linear")}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:t==null?void 0:t.x2Field,y2Field:t==null?void 0:t.y2Field,barMinHeight:t==null?void 0:t.barMinHeight})}}class AS extends xe{constructor(){super(...arguments),this.transformerConstructor=SS,this._canStack=!0}}AS.transformerConstructor=SS;class Pm extends SS{transformSpec(t){super.transformSpec(t),La(t)}}class _l extends AS{constructor(){super(...arguments),this.transformerConstructor=Pm,this.type="histogram",this.seriesType=j.bar}}_l.type="histogram",_l.seriesType=j.bar,_l.view="singleDefault",_l.transformerConstructor=Pm;const Mit=()=>{jL(),I.registerChart(_l.type,_l)};class ml extends AS{constructor(){super(...arguments),this.transformerConstructor=Pm,this.type="histogram3d",this.seriesType=j.bar3d}}ml.type="histogram3d",ml.seriesType=j.bar3d,ml.view="singleDefault",ml.transformerConstructor=Pm;const Cit=()=>{HL(),I.registerChart(ml.type,ml)};class VB extends FB{_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{cornerRadius:(e=t.cornerRadius)!==null&&e!==void 0?e:0,roundCap:(i=t.roundCap)!==null&&i!==void 0&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}class vl extends xe{constructor(){super(...arguments),this.transformerConstructor=VB,this.type="circularProgress",this.seriesType=j.circularProgress,this._canStack=!0}}vl.type="circularProgress",vl.seriesType=j.circularProgress,vl.view="singleDefault",vl.transformerConstructor=VB;const Pit=()=>{RQ(),I.registerChart(vl.type,vl)};class UB extends FB{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:j.circularProgress})}transformSpec(t){var e,i,n,r,a;super.transformSpec(t);let o=(e=t.series)===null||e===void 0?void 0:e.find(l=>l.type===j.gauge||l.type===j.circularProgress);C(o)&&(o=(i=t.gauge)!==null&&i!==void 0?i:this._getDefaultCircularProgressSeriesSpec(t),o.type==="circularProgress"&&(C(o.radiusField)&&C(o.categoryField)&&(o.radiusField=(r=(n=t.radiusField)!==null&&n!==void 0?n:t.categoryField)!==null&&r!==void 0?r:t.seriesField),C(o.valueField)&&C(o.angleField)&&(o.valueField=(a=t.valueField)!==null&&a!==void 0?a:t.angleField)),t.series.length===1?t.series.push(o):t.series.forEach(l=>{l.type===o.type&&Object.keys(o).forEach(h=>{h in l||(l[h]=o[h])})})),o.type===j.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:he.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};((e=t.axes)!==null&&e!==void 0?e:[]).forEach(n=>{const{orient:r}=n;r==="radius"&&(i.radius=n),r==="angle"&&(i.angle=n)}),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),C(i.angle.type)&&(i.angle.type="linear"),C(i.radius.type)&&(i.radius.type="linear"),C(i.angle.zIndex)&&(i.angle.zIndex=he.Region+50)}}class yl extends xe{constructor(){super(...arguments),this.transformerConstructor=UB,this.type="gauge",this.seriesType=j.gaugePointer}}yl.type="gauge",yl.seriesType=j.gaugePointer,yl.view="singleDefault",yl.transformerConstructor=UB;const Eit=()=>{nit(),rit(),I.registerChart(yl.type,yl)};class Em extends sn{transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class kS extends xe{constructor(){super(...arguments),this.transformerConstructor=Em,this.type="wordCloud",this.seriesType=j.wordCloud}}kS.transformerConstructor=Em;class $B extends Em{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class aa extends kS{constructor(){super(...arguments),this.transformerConstructor=$B,this.type="wordCloud",this.seriesType=j.wordCloud}}aa.type="wordCloud",aa.seriesType=j.wordCloud,aa.view="singleDefault",aa.transformerConstructor=$B;const Rit=()=>{SB(),I.registerChart(aa.type,aa)},Oit=()=>{Wtt(),SB(),I.registerChart(aa.type,aa)};class YB extends Em{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class oa extends kS{constructor(){super(...arguments),this.transformerConstructor=YB,this.type="wordCloud3d",this.seriesType=j.wordCloud3d}}oa.type="wordCloud3d",oa.seriesType=j.wordCloud3d,oa.view="singleDefault",oa.transformerConstructor=YB;const Dit=()=>{AB(),I.registerChart(oa.type,oa)},Lit=()=>{Ntt(),AB(),I.registerChart(oa.type,oa)};class Rm extends sn{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class bl extends xe{constructor(){super(...arguments),this.transformerConstructor=Rm,this.type="funnel",this.seriesType=j.funnel}}bl.type="funnel",bl.seriesType=j.funnel,bl.view="singleDefault",bl.transformerConstructor=Rm;const Bit=()=>{eet(),I.registerChart(bl.type,bl)};class xl extends xe{constructor(){super(...arguments),this.transformerConstructor=Rm,this.type="funnel3d",this.seriesType=j.funnel3d}}xl.type="funnel3d",xl.seriesType=j.funnel3d,xl.view="singleDefault",xl.transformerConstructor=Rm;const Iit=()=>{set(),I.registerChart(xl.type,xl)};class XB extends wn{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{direction:(e=t.direction)!==null&&e!==void 0?e:"horizontal",cornerRadius:(i=t.cornerRadius)!==null&&i!==void 0?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),t.direction==="vertical"){let n=null,r=null;((e=t.axes)!==null&&e!==void 0?e:[]).forEach(o=>{const{orient:l}=o;l==="left"&&(n=o),l==="bottom"&&(r=o)}),n||(n={orient:"left",visible:!1},t.axes.push(n)),r||(r={orient:"bottom",visible:!1},t.axes.push(r)),C(r.type)&&(r.type="band"),C(n.type)&&(n.type="linear");const a=Lu(n,{min:0,max:1});C(n.min)&&(n.min=a.min),C(n.max)&&(n.max=a.max)}else{let n=null,r=null;((i=t.axes)!==null&&i!==void 0?i:[]).forEach(o=>{const{orient:l}=o;l==="left"&&(n=o),l==="bottom"&&(r=o)}),n||(n={type:"band",orient:"left",visible:!1},t.axes.push(n)),r||(r={orient:"bottom",visible:!1},t.axes.push(r)),C(r.type)&&(r.type="linear"),C(n.type)&&(n.type="band");const a=Lu(r,{min:0,max:1});C(r.min)&&(r.min=a.min),C(r.max)&&(r.max=a.max)}}}class Sl extends xe{constructor(){super(...arguments),this.transformerConstructor=XB,this.type="linearProgress",this.seriesType=j.linearProgress,this._canStack=!0}}Sl.type="linearProgress",Sl.seriesType=j.linearProgress,Sl.view="singleDefault",Sl.transformerConstructor=XB;const Fit=()=>{jQ(),I.registerChart(Sl.type,Sl)};class KB extends wn{_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight});return n.bar=t.bar,t.direction==="horizontal"?n.xField=(e=t.xField)!==null&&e!==void 0?e:[t.minField,t.maxField]:n.yField=(i=t.yField)!==null&&i!==void 0?i:[t.minField,t.maxField],n}transformSpec(t){super.transformSpec(t),La(t)}}class Al extends xe{constructor(){super(...arguments),this.transformerConstructor=KB,this.type="rangeColumn",this.seriesType=j.rangeColumn}}Al.type="rangeColumn",Al.seriesType=j.rangeColumn,Al.view="singleDefault",Al.transformerConstructor=KB;const jit=()=>{KJ(),I.registerChart(Al.type,Al)};class qB extends wn{_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar3d=t.bar3d,t.direction==="horizontal"?n.xField=(e=t.xField)!==null&&e!==void 0?e:[t.minField,t.maxField]:n.yField=(i=t.yField)!==null&&i!==void 0?i:[t.minField,t.maxField],n}}class kl extends xe{constructor(){super(...arguments),this.transformerConstructor=qB,this.type="rangeColumn3d",this.seriesType=j.rangeColumn3d}}kl.type="rangeColumn3d",kl.seriesType=j.rangeColumn3d,kl.view="singleDefault",kl.transformerConstructor=qB;const zit=()=>{qJ(),I.registerChart(kl.type,kl)};class ZB extends sn{_getDefaultSeriesSpec(t){const e=E(t.startAngle)?t.startAngle:Td,i=E(t.endAngle)?t.endAngle:e+Zl(2*Math.PI),n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),r=j.sunburst;return n.type=r,n[r]=t[r],n}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class wl extends xe{constructor(){super(...arguments),this.transformerConstructor=ZB,this.type="sunburst",this.seriesType=j.sunburst}}wl.type="sunburst",wl.seriesType=j.sunburst,wl.view="singleDefault",wl.transformerConstructor=ZB;const Hit=()=>{Tet(),I.registerChart(wl.type,wl)};class JB extends sn{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=j.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class Tl extends xe{constructor(){super(...arguments),this.transformerConstructor=JB,this.type="circlePacking",this.seriesType=j.circlePacking}}Tl.type="circlePacking",Tl.seriesType=j.circlePacking,Tl.view="singleDefault",Tl.transformerConstructor=JB;const Git=()=>{Ret(),I.registerChart(Tl.type,Tl)};class QB extends sn{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class Ml extends xe{constructor(){super(...arguments),this.transformerConstructor=QB,this.type="treemap",this.seriesType=j.treemap}}Ml.type="treemap",Ml.seriesType=j.treemap,Ml.view="singleDefault",Ml.transformerConstructor=QB;const Wit=()=>{Qet(),I.registerChart(Ml.type,Ml)};class tI extends Sm{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach(e=>{e.select=!1,e.hover=!1,e.filter=!1}),La(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class Cl extends sa{constructor(){super(...arguments),this.transformerConstructor=tI,this.type="waterfall",this.seriesType=j.waterfall}}Cl.type="waterfall",Cl.seriesType=j.waterfall,Cl.view="singleDefault",Cl.transformerConstructor=tI;const Nit=()=>{HJ(),I.registerChart(Cl.type,Cl)};class eI extends wn{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:(e=t.direction)!==null&&e!==void 0?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return n[n.direction==="vertical"?"yField":"xField"]=i,n}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),La(t)}}class Pl extends xe{constructor(){super(...arguments),this.transformerConstructor=eI,this.type="boxPlot",this.seriesType=j.boxPlot}}Pl.type="boxPlot",Pl.seriesType=j.boxPlot,Pl.view="singleDefault",Pl.transformerConstructor=eI;const Vit=()=>{VJ(),I.registerChart(Pl.type,Pl)};class iI extends sn{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class El extends xe{constructor(){super(...arguments),this.transformerConstructor=iI,this.type="sankey",this.seriesType=j.sankey}}El.type="sankey",El.seriesType=j.sankey,El.view="singleDefault",El.transformerConstructor=iI;const Uit=()=>{Yet(),I.registerChart(El.type,El)};class sI extends wn{_getDefaultSeriesSpec(t){var e,i;const n=Object.assign({},super._getDefaultSeriesSpec(t));return n.area=t.area,t.direction==="horizontal"?n.xField=(e=t.xField)!==null&&e!==void 0?e:[t.minField,t.maxField]:n.yField=(i=t.yField)!==null&&i!==void 0?i:[t.minField,t.maxField],n.stack=!1,n}transformSpec(t){super.transformSpec(t),La(t)}}class Rl extends xe{constructor(){super(...arguments),this.transformerConstructor=sI,this.type="rangeArea",this.seriesType=j.rangeArea}}Rl.type="rangeArea",Rl.seriesType=j.rangeArea,Rl.view="singleDefault",Rl.transformerConstructor=sI;const $it=()=>{JJ(),I.registerChart(Rl.type,Rl)};class nI extends wn{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class Ol extends xe{constructor(){super(...arguments),this.transformerConstructor=nI,this.type="heatmap",this.seriesType=j.heatmap}}Ol.type="heatmap",Ol.seriesType=j.heatmap,Ol.view="singleDefault",Ol.transformerConstructor=nI;const Yit=()=>{dit(),I.registerChart(Ol.type,Ol)};class rI extends sn{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=j.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&t.series.length!==0?t.series.forEach(i=>{this._isValidSeries(i.type)&&Object.keys(e).forEach(n=>{n in i||(i[n]=e[n])})}):t.series=[e]}}class Dl extends xe{constructor(){super(...arguments),this.transformerConstructor=rI,this.type="correlation",this.seriesType=j.correlation}}Dl.type="correlation",Dl.seriesType=j.correlation,Dl.view="singleDefault",Dl.transformerConstructor=rI;const Xit=()=>{vit(),I.registerChart(Dl.type,Dl)};function nC(s){return s.length===2&&H(s[0])&&H(s[1])&&s[1]>=s[0]}function rC(s,t){const e=t[1]-t[0],i=t[1]*t[0]<0;let n=t[0]<=0?0-t[0]:0,r=t[1]>0?t[1]-0:0;e===0?t[0]<0?(n=1,r=0):t[0]>0&&(n=0,r=1):(n/=e,r/=e);const a=s.getDomainSpec();return{total:e,negative:n,positive:r,includeZero:i,domain:t,extendable_min:!H(a.min),extendable_max:!H(a.max)}}function aC(s,t){const{positive:e,negative:i,extendable_min:n,extendable_max:r,domain:a}=s,{positive:o,negative:l,extendable_min:h,extendable_max:d,domain:u}=t;if(o>0){if(!h)return!1;let c=i/e;r&&(c=i/Math.max(e,o),a[1]=-a[0]/c),u[0]=-u[1]*c}else if(l>0){if(!d)return!1;let c=e/i;n&&(c=e/Math.max(i,i),a[0]=-a[1]/c),u[1]=-u[0]*c}return!0}function oC(s,t){const{extendable_min:e,extendable_max:i,domain:n}=s,{positive:r,negative:a,domain:o}=t;return(r!==0||a!==0)&&!(r>0&&!i)&&!(a>0&&!e)&&(n[0]=o[0],n[1]=o[1],!0)}function lC(s,t){const{positive:e,negative:i,extendable_max:n,domain:r}=s,{positive:a,negative:o,extendable_min:l,domain:h}=t;if(n&&l){const d=Math.max(i,o)/Math.max(e,a);r[1]=-r[0]/d,h[0]=-h[1]*d}else if(l){const d=i/e;h[0]=-h[1]*d}else{if(!n)return!1;{const d=o/a;r[1]=-r[0]/d}}return!0}function hC(s,t){const{extendable_min:e,domain:i}=s,{extendable_max:n,domain:r}=t;return!(!e||!n)&&(i[0]=-i[1],r[1]=-r[0],!0)}const Kit=(s,t)=>{const e=s.getScale(),i=t.getScale();if(!e||!i||!Kt(e.type)||!Kt(i.type))return;const n=e.domain().slice(),r=i.domain().slice();if(!nC(n)||!nC(r))return;const a=rC(s,n),o=rC(t,r),{positive:l,negative:h,extendable_min:d,extendable_max:u,includeZero:c}=a,{positive:p,negative:g,extendable_min:f,extendable_max:_,includeZero:m}=o;if(l===0&&h===0){if(!oC(a,o))return}else if(p===0&&g===0){if(!oC(o,a))return}else if(c||m)if(c&&!m){if(!aC(a,o))return}else if(m&&!c){if(!aC(o,a))return}else{if(h===g)return;if(h>g){if(!lC(a,o))return}else if(!lC(o,a))return}else{if(h===0&&p===0){if(!hC(a,o))return}else if(g===0&&l===0&&!hC(o,a))return;if(h===0&&g===0)if(n[0]===0&&r[0]>0){if(!f)return;r[0]=0}else{if(!(r[0]===0&&n[0]>0)||!d)return;n[0]=0}if(l===0&&p===0)if(n[1]===0&&r[1]>0){if(!_)return;r[1]=0}else{if(!(r[1]===0&&n[1]>0)||!u)return;n[1]=0}}e.domain(n),i.domain(r)},qit=(s,t)=>{var e,i,n,r,a;if(!s)return s;const o=(e=t==null?void 0:t.targetAxis)===null||e===void 0?void 0:e.call(t);if(!o)return s;const l=(i=t==null?void 0:t.currentAxis)===null||i===void 0?void 0:i.call(t);if(!l)return s;const h=(n=l.getTickData())===null||n===void 0?void 0:n.getDataView();if(!h||!h.transformsArr.find(v=>v.type==="ticks"))return s;const d=l.getScale();if(!d)return s;const u=(a=(r=o.getTickData())===null||r===void 0?void 0:r.getDataView())===null||a===void 0?void 0:a.latestData;if(!(u!=null&&u.length))return s;const c=o.getScale();if(!c)return s;const p=c.domain(),g=p[1]-p[0];if(g===0)return s;const f=d.domain(),_=f[1]-f[0];if(g===0)return s;const m=u.map(v=>{const y=(v.value-p[0])/g;return _*y+f[0]});return Vn(m)};class Xu extends _Z{constructor(){super(Xu.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Kt(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(e!=null&&e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i!=null&&i.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i||!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(bt.scaleDomainUpdate,{filter:({model:r})=>r.id===e.id||r.id===n.id},()=>{Kit(n,e)})}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){Mt(e.getOption().dataSet,"tickAlign",qit);const r={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:r,level:Number.MAX_SAFE_INTEGER},!1)}}}Xu.pluginType="component",Xu.type="AxisSyncPlugin";const Zit={AxisSyncPlugin:Xu};class Sb extends Ri{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(nt.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}Sb.type="component";const wS=()=>{I.registerMark(Sb.type,Sb)},Jit=s=>s;class TS extends ds{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}get visible(){return this._visible}getInverse(){return this._inverse}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._visible=!0,this._tick=void 0,this._visible=(i=t.visible)===null||i===void 0||i}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e;return Y((e=(t=this._axisMark)===null||t===void 0?void 0:t.getProduct())===null||e===void 0?void 0:e.getGroupGraphicItem())}created(){var t,e,i,n,r,a,o,l,h,d,u,c,p,g,f,_,m;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this.getVisible()&&this._initData(),this._visible){const v=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:this.getOrient()==="angle"?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});if(this._axisMark=v,v.setZIndex(this.layoutZIndex),E(this._spec.id)&&v.setUserId(this._spec.id),this._marks.addMark(v),(t=this._spec.grid)===null||t===void 0?void 0:t.visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:this.getOrient()==="angle"?ai.circleAxisGrid:ai.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0,skipTheme:!0});y.setZIndex((a=(n=(i=(e=this._spec.grid)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.zIndex)!==null&&n!==void 0?n:(r=this._spec.grid)===null||r===void 0?void 0:r.zIndex)!==null&&a!==void 0?a:he.Axis_Grid),this._marks.addMark(y),this._gridMark=y}if(pe(this._spec.interactive)&&this._marks.forEach(y=>y.setInteractive(this._spec.interactive)),this._option.animation!==!1&&Et(this._option.getChart().getSpec(),"animation")!==!1&&this._spec.animation===!0){const y=Ft((o=I.getAnimationInKey("axis"))===null||o===void 0?void 0:o(),{appear:(h=(l=this._spec.animationAppear)!==null&&l!==void 0?l:Et(this._option.getChart().getSpec(),"animationAppear.axis"))!==null&&h!==void 0?h:Et(this._option.getChart().getSpec(),"animationAppear"),disappear:(u=(d=this._spec.animationDisappear)!==null&&d!==void 0?d:Et(this._option.getChart().getSpec(),"animationDisappear.axis"))!==null&&u!==void 0?u:Et(this._option.getChart().getSpec(),"animationDisappear"),enter:(p=(c=this._spec.animationEnter)!==null&&c!==void 0?c:Et(this._option.getChart().getSpec(),"animationEnter.axis"))!==null&&p!==void 0?p:Et(this._option.getChart().getSpec(),"animationEnter"),exit:(f=(g=this._spec.animationExit)!==null&&g!==void 0?g:Et(this._option.getChart().getSpec(),"animationExit.axis"))!==null&&f!==void 0?f:Et(this._option.getChart().getSpec(),"animationExit"),update:(m=(_=this._spec.animationUpdate)!==null&&_!==void 0?_:Et(this._option.getChart().getSpec(),"animationUpdate.axis"))!==null&&m!==void 0?m:Et(this._option.getChart().getSpec(),"animationUpdate")});y.enter&&(y.update[0].customParameters={enter:y.enter[0]}),this._marks.forEach(b=>b.setAnimationConfig(y))}}}isSeriesDataEnable(){let t=!0;return Te(this._regions,e=>{var i;U((i=e.getViewDataStatistics())===null||i===void 0?void 0:i.latestData)&&(t=!1)},{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;E(t)&&(this._seriesUserId=Y(t)),E(i)&&(this._regionUserId=Y(i)),E(e)&&(this._seriesIndex=Y(e)),E(n)&&(this._regionIndex=Y(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map(r=>r.id)}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(bt.scaleUpdate,{filter:({model:e})=>(e==null?void 0:e.id)===this.id},this.effect.scaleUpdate.bind(this));const t=IV(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map(e=>e.getViewDataStatistics()).filter(e=>!!e);t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",()=>{this.updateScaleDomain()}):t.length===1&&t[0].target.addListener("change",()=>{this.updateScaleDomain()}),Te(this._regions,e=>{e.event.on(bt.rawDataUpdate,{filter:({model:i})=>(i==null?void 0:i.id)===e.id},()=>{this._clearRawDomain()})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}computeData(t){!this._tickData||t!=="force"&&_e(this._scale.range(),[0,1])||(this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData())}initScales(){this._scales=[this._scale];const t=[];if(Te(this._regions,e=>{const i=e.getGroups();i&&t.push(i)},{userId:this._seriesUserId,specIndex:this._seriesIndex}),t.length!==0){const e=Ye(t.map(i=>i.fields.length));for(let i=1;i<e;i++){const n=this._scale.clone();this._scales.push(n)}}}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(e==null?void 0:e.type)!==(t==null?void 0:t.type)&&(i.reMake=!0),i}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return U(this._tickData.getLatestData())?[this._tickData.getLatestData().map(e=>({id:e.value,label:e.value,value:t===0?0:this.dataToPosition([e.value])/t,rawValue:e.value})).filter(e=>e.value>=0&&e.value<=1)]:[]}_delegateAxisContainerEvent(t){t.addEventListener("*",(e,i)=>this._delegateEvent(t,e,i))}_getAxisAttributes(){var t,e,i,n,r,a,o,l,h,d,u;const c=this._spec;let p,g=c.title.angle;c.orient!=="left"&&c.orient!=="right"||!((t=c.title)===null||t===void 0)&&t.autoRotate&&C(c.title.angle)&&(g=c.orient==="left"?-90:90,p=_J[c.orient]);const f=Kl(c.label,["style","formatMethod","state"]),_=(e=c.background)!==null&&e!==void 0?e:{},m=(i=c.title.background)!==null&&i!==void 0?i:{};return{orient:this.getOrient(),select:this._option.disableTriggerEvent!==!0&&c.select,hover:this._option.disableTriggerEvent!==!0&&c.hover,line:mJ(c.domainLine),label:Object.assign({style:q(c.label.style)?(v,y,b,x)=>{var S;const A=c.label.style(v.rawValue,y,v,b,x);return At(_t({},(S=this._theme.label)===null||S===void 0?void 0:S.style,A))}:At(c.label.style),formatMethod:c.label.formatMethod?(v,y,b)=>c.label.formatMethod(y.rawValue,y):null,state:_q(c.label.state)},f),tick:c.tick.visible===!1?{visible:!1}:{visible:c.tick.visible,length:c.tick.tickSize,inside:c.tick.inside,alignWithLabel:c.tick.alignWithLabel,style:q(c.tick.style)?(v,y,b,x)=>{var S;const A=c.tick.style(v,y,b,x);return At(_t({},(S=this._theme.tick)===null||S===void 0?void 0:S.style,A))}:At(c.tick.style),state:Do(c.tick.state),dataFilter:c.tick.dataFilter},subTick:c.subTick.visible===!1?{visible:!1}:{visible:c.subTick.visible,length:c.subTick.tickSize,inside:c.subTick.inside,count:c.subTick.tickCount,style:q(c.subTick.style)?(v,y,b,x)=>{var S;const A=c.subTick.style(v,y,b,x);return At(_t({},(S=this._theme.subTick)===null||S===void 0?void 0:S.style,A))}:At(c.subTick.style),state:Do(c.subTick.state)},title:c.title.visible===!1?{visible:!1}:Object.assign({visible:c.title.visible,position:c.title.position,space:c.title.space,autoRotate:!1,angle:g?le(g):null,textStyle:_t({},p,At(c.title.style)),padding:c.title.padding,shape:((n=c.title.shape)===null||n===void 0?void 0:n.visible)===!1?{visible:!1}:{visible:(r=c.title.shape)===null||r===void 0?void 0:r.visible,space:(a=c.title.shape)===null||a===void 0?void 0:a.space,style:At((o=c.title.shape)===null||o===void 0?void 0:o.style)},background:m.visible===!1?{visible:!1}:{visible:m.visible,style:At(m.style)},state:{text:Do(c.title.state),shape:Do((l=c.title.shape)===null||l===void 0?void 0:l.state),background:Do((h=c.title.background)===null||h===void 0?void 0:h.state)},pickable:((d=c.title.style)===null||d===void 0?void 0:d.pickable)!==!1,childrenPickable:((u=c.title.style)===null||u===void 0?void 0:u.pickable)!==!1},c.title),panel:_.visible===!1?{visible:!1}:{visible:_.visible,style:At(_.style),state:Do(_.state)}}}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:q(t.grid.style)?()=>(e,i)=>{var n,r;const a=t.grid.style((n=e.datum)===null||n===void 0?void 0:n.rawValue,i,e.datum);return At(_t({},(r=this._theme.grid)===null||r===void 0?void 0:r.style,a))}:At(t.grid.style),subGrid:t.subGrid.visible===!1?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:At(t.subGrid.style)}}}_initTickDataSet(t){return mr(this._option.dataSet,"scale",Jit),Mt(this._option.dataSet,"ticks",MV),new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:t},!1)}_tickTransformOption(t){const e=this._tick||{},i=this._spec.label||{},{tickCount:n,forceTickCount:r,tickStep:a,tickMode:o}=e,{style:l,formatMethod:h,minGap:d}=i;return{sampling:this._spec.sampling!==!1,tickCount:n,forceTickCount:r,tickStep:a,tickMode:o,axisOrientType:this._orient,coordinateType:t,labelStyle:l,labelFormatter:h,labelGap:d}}addTransformToTickData(t,e){var i,n;(n=(i=this._tickData)===null||i===void 0?void 0:i.getDataView())===null||n===void 0||n.transform(t,e)}dataToPosition(t){return this._scale.scale(t)}}TS.specKey="axes";const wo=()=>{J7(),i9(),wS(),I.registerAnimation("axis",()=>({appear:{custom:i6},update:{custom:e6},exit:{custom:xz}}))};var dC=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};const Qit=[Zit.AxisSyncPlugin];class Kf extends TS{getOrient(){return this._orient}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,e){super(t,e),this.type=J.cartesianAxis,this.name=J.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=he.Axis,this.layoutLevel=xn.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:i=>{this.computeData(i==null?void 0:i.value),Te(this._regions,n=>{const r=this.getOrient();Ce(r)?n.setXAxisHelper(this.axisHelper()):dr(r)?n.setYAxisHelper(this.axisHelper()):Br(r)&&n.setZAxisHelper(this.axisHelper())},{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=i=>{let{x:n,y:r}=i;return H(n)&&(n+=+(this._orient==="left")*this.getLayoutRect().width),H(r)&&(r+=+(this._orient==="top")*this.getLayoutRect().height),{x:n,y:r}},this._transformLayoutRect=i=>{if(!this._visible)return i;const n=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":this._layout.layoutRectLevelMap.width===gs&&(i.width=n.x1<0?-n.x1:0);break;case"right":this._layout.layoutRectLevelMap.width===gs&&(i.width=n.x2>0?n.x2:0);break;case"top":this._layout.layoutRectLevelMap.height===gs&&(i.height=n.y1<0?-n.y1:0);break;case"bottom":this._layout.layoutRectLevelMap.height===gs&&(i.height=n.y2>0?n.y2:0)}return i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),this._layout.setRectInSpec(this._layoutCacheProcessing(i))},this._fixAxisOnZero=()=>{const{onZero:i,visible:n}=this._spec.domainLine;if(this.visible&&i&&n!==!1){const{onZeroAxisId:r,onZeroAxisIndex:a}=this._spec.domainLine,o=this._option.getComponentsByKey("axes"),l=Ce(this.getOrient()),h=u=>{var c;return(l?!Ce(u.getOrient()):Ce(u.getOrient()))&&Kt(u.getScale().type)&&u.getTickData()?(c=u.getTickData().getLatestData())===null||c===void 0?void 0:c.find(p=>p.value===0):u.getScale().ticks().includes(0)},d=o.filter(u=>h(u));if(d.length){let u;if(E(r))u=d.find(c=>c.id===r);else if(E(a)){const c=o[a];h(c)&&(u=c)}else u=d[0];if(u){const c=this._axisMark.getProduct(),p=u.valueToPosition(0);l?c.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:this._orient==="bottom"?-(u.getScale().range()[0]-p):p})}):c.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:this._orient==="left"?p:-(u.getScale().range()[1]-p)})})}}}},this._orient=Gr(t,["z"]),Br(this._orient)&&(this.layoutType="absolute"),this._dataSet=e.dataSet}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i=t.direction==="horizontal";if(!U(e)){if(!SM(e))return null;const{axisType:o,componentName:l}=aM(e,i);return e.type=o,[{spec:e,specPath:[this.specKey],type:l}]}let n=!0;if(e.filter(o=>o.orient==="z")[0]){const o=e.filter(h=>h.orient==="bottom")[0],l=e.filter(h=>dr(h.orient))[0];n=e.length===3&&o&&l}let r=e.map((o,l)=>({spec:o,index:l}));n||(r=r.filter(({spec:o})=>o.orient!=="z"));const a=[];return r.forEach(({spec:o,index:l})=>{if(!SM(o))return;const{axisType:h,componentName:d}=aM(o,i);o.type=h,a.push({spec:o,specIndex:l,specPath:[this.specKey,l],type:d})}),a}static createComponent(t,e){const{spec:i}=t,n=dC(t,["spec"]),r=I.getComponentInKey(n.type);return r?new r(i,Object.assign(Object.assign({},e),n)):(e.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=this._spec.autoIndent!==!1,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),{left:n,right:r,top:a,bottom:o}=this._innerOffset;let l=[];Ce(this.getOrient())?H(e)&&(l=this._inverse?[e-r,n]:[n,e-r]):Br(this.getOrient())?H(e)&&(l=this._inverse?[e-r,n]:[n,e-r],this._scale.range(l)):H(i)&&(l=this._inverse?[a,i-o]:[i-o,a]);const[h,d]=this._scale.range();return l[0]===h&&l[1]===d||(t=!0,this._scale.range(l)),t}init(t){var e;super.init(t),(e=this.pluginService)===null||e===void 0||e.load(Qit.map(i=>new i)),this.callPlugin(i=>{this.pluginService&&i.onInit&&i.onInit(this.pluginService,this)})}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){Ce(this.getOrient())?ke(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):ke(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const i=this._getAxisAttributes();i.label.formatMethod=this.getLabelFormatMethod(),i.verticalFactor=this.getOrient()==="top"||this.getOrient()==="right"?-1:1,this._axisStyle=i}this._tick=this._spec.tick;const e=(t=this._option.getChart())===null||t===void 0?void 0:t.getSpec();this._inverse=xq(this._spec,(e==null?void 0:e.direction)==="horizontal")}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!Br(this.getOrient())&&this._spec.innerOffset){const n=this._spec;dr(this.getOrient())?["top","bottom"].forEach(r=>{this._innerOffset[r]=zi(n.innerOffset[r],e.height,e)}):["left","right"].forEach(r=>{this._innerOffset[r]=zi(n.innerOffset[r],e.width,e)})}}getSeriesStatisticsField(t){let e;return e=Ce(this.getOrient())?t.fieldX:Br(this.getOrient())?t.fieldZ:t.fieldY,Kt(this._scale.type)?e:[e[0]]}_tickTransformOption(t){var e,i;return Object.assign(Object.assign({},super._tickTransformOption(t)),{noDecimals:this._tick.noDecimals,labelLastVisible:(e=this._spec.label)===null||e===void 0?void 0:e.lastVisible,labelFlush:(i=this._spec.label)===null||i===void 0?void 0:i.flush})}_initData(){const t=this._initTickDataSet(this._tickTransformOption("cartesian"));t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new Cr(this._option,t)}axisHelper(){return{isContinuous:Kt(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse===!0}}afterCompile(){var t;const e=(t=this._axisMark)===null||t===void 0?void 0:t.getProduct();e&&e.addEventListener(ut.AFTER_ELEMENT_ENCODE,()=>{if(this._isLayout===!1&&(Ce(this.getOrient())?this.callPlugin(i=>{this.pluginService&&i.onDidLayoutHorizontal&&i.onDidLayoutHorizontal(this.pluginService,this)}):this.callPlugin(i=>{this.pluginService&&i.onDidLayoutVertical&&i.onDidLayoutVertical(this.pluginService,this)}),this._delegateAxisContainerEvent(e.getGroupGraphicItem()),this._unitText)){const i=e.graphicItem.AABBBounds,n=Ce(this._orient)?{x:i.x2,y:this.getLayoutStartPoint().y}:{x:this.getLayoutStartPoint().x,y:i.y1};this._unitText.setAttributes(n)}}),this.callPlugin(i=>{this.pluginService&&i.onDidCompile&&i.onDidCompile(this.pluginService,this)})}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(bt.scaleUpdate,{model:this,value:"range"}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Te(this._regions,e=>{t.push(this.getOrient()==="left"||this.getOrient()==="right"?e.scaleY:e.scaleX)},{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t,e){const i=[];return Te(this._regions,n=>{var r,a,o;let l;if(l=t>0?(a=(r=n.getGroups())===null||r===void 0?void 0:r.fields)===null||a===void 0?void 0:a[t]:Ce(this.getOrient())?n.fieldX2?[...n.fieldX,n.fieldX2]:n.fieldX:Br(this.getOrient())?n.fieldZ:n.fieldY,l=U(l)?Kt(this._scale.type)?l:[l[0]]:[l],t||(this._dataFieldText=n.getFieldAlias(l[0])),l){const h=n.getViewData();if(e)l.forEach(d=>{i.push(n.getRawDataStatisticsByField(d,!1))});else if(h&&h.latestData&&h.latestData.length){const d=(o=n.getViewDataStatistics)===null||o===void 0?void 0:o.call(n);l.forEach(u=>{var c;!((c=d==null?void 0:d.latestData)===null||c===void 0)&&c[u]&&i.push(d.latestData[u])})}}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}updateSeriesScale(){const t=this.getOrient();Te(this._regions,e=>{Ce(t)?(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):dr(t)?(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Br(t)&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))},{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=Ce(this.getOrient())?t.height:t.width,this.setLayoutRect(t),!this.updateScaleRange()&&U(this._tickData.getLatestData())||this.computeData("range");const i={skipLayout:!1},n=Ce(this.getOrient());this.pluginService&&(n?this.callPlugin(o=>{o.onWillLayoutHorizontal&&o.onWillLayoutHorizontal(this.pluginService,i,this)}):this.callPlugin(o=>{o.onWillLayoutVertical&&o.onWillLayoutVertical(this.pluginService,i,this)}));const r=this._axisMark.getProduct();let a=!1;if(!i.skipLayout){const o=this._getUpdateAttribute(!0),l=r.getGroupGraphicItem(),h=_t(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,o,{line:{visible:!1}}),d=l.getBoundsWithoutRender(h);a=!0,this._latestBounds=d,isFinite(d.width())&&(e=this._appendAxisUnit(d,n))}return a||(this._latestBounds=r.getBounds()),e}updateLayoutAttribute(){if(!this.visible)return;const t=this.getLayoutStartPoint(),e=this._getUpdateAttribute(!1),{grid:i}=e,n=dC(e,["grid"]),r=this._axisMark.getProduct(),a=_t({x:t.x,y:t.y},this._axisStyle,n);r.encode(a),this._gridMark&&this._gridMark.getProduct().encode(_t({x:t.x,y:t.y},this._getGridAttributes(),i)),super.updateLayoutAttribute()}_getTitleLimit(t){var e,i,n,r,a;if(this._spec.title.visible&&C((e=this._spec.title.style)===null||e===void 0?void 0:e.maxLineWidth)){const o=(a=(n=(i=this._axisStyle.title)===null||i===void 0?void 0:i.angle)!==null&&n!==void 0?n:(r=this._spec.title.style)===null||r===void 0?void 0:r.angle)!==null&&a!==void 0?a:0;if(t){const d=this.getLayoutRect().width,u=Math.abs(Math.cos(o));return u<1e-6?1/0:d/u}const l=this.getLayoutRect().height,h=Math.abs(Math.sin(o));return h<1e-6?1/0:l/h}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const m=this.getRegions();let{x:v,y}=m[0].getLayoutStartPoint(),b=v+m[0].getLayoutRect().width,x=y+m[0].getLayoutRect().height;for(let S=1;S<m.length;S++){const A=m[S],{x:k,y:w}=A.getLayoutStartPoint(),{width:T,height:M}=A.getLayoutRect();v=Math.min(v,k),b=Math.max(b,T+k),y=Math.min(y,w),x=Math.max(x,M+w)}i=Math.abs(x-y),n=Math.abs(b-v)}const{width:r,height:a}=this.getLayoutRect(),o=Ce(this._orient),l=dr(this._orient),h=Br(this._orient);let d={x:0,y:0},u=0,c=0;const p=this.layout3dBox?this.layout3dBox.length:0;if(o?(d={x:r,y:0},u=i,c=r):l&&(d={x:0,y:a},u=n,c=a),h){const m=(e=this.directionStr)!==null&&e!==void 0?e:"r2l",v=this.layout3dBox?this.layout3dBox.width:0;let y=[0,0],b=-Math.PI/2,x=0;m==="l2r"&&(x=this.layout3dBox.length,y=[0,0,0],b=Math.PI/2);const S=this.getLabelItems(r),A={start:{x:0,y:0},end:{x:p,y:0},z:x,alpha:b,anchor3d:y,title:{text:this._spec.title.text||this._dataFieldText,maxWidth:this._getTitleLimit(o)},items:S};return t||(A.grid={type:"line",start:{x:0,y:0},end:{x:p,y:0},items:S[0],verticalFactor:this._axisStyle.verticalFactor,depth:v,length:i,z:x,alpha:b,anchor3d:y}),A}let g=o?this.layout.minHeight:this.layout.minWidth;(o&&this._layout.layoutRectLevelMap.height===zr||l&&this._layout.layoutRectLevelMap.width===zr)&&(g=this._verticalLimitSize);const f=this.getLabelItems(c),_={start:{x:0,y:0},end:d,title:{text:this._spec.title.text||this._dataFieldText,maxWidth:this._getTitleLimit(o)},items:f,verticalLimitSize:this._verticalLimitSize,verticalMinSize:g};return t||(_.grid={type:"line",start:{x:0,y:0},end:d,items:f[0],verticalFactor:this._axisStyle.verticalFactor,depth:p,length:u}),_}initEvent(){super.initEvent(),this.visible&&(this.event.on(bt.layoutEnd,this._fixAxisOnZero),this.event.on(bt.layoutRectUpdate,()=>{this._clearLayoutCache()}))}_layoutCacheProcessing(t){return["width","height"].forEach(e=>{t[e]<this._layoutCache[e]?t[e]=this._layoutCache[e]:this._layoutCache[e]=t[e]}),this._autoIndentOnce&&this._hasAutoIndent?["x1","x2","y1","y2"].forEach(e=>{this.layout.getLastComputeOutBounds()[e]=this._layoutCache._lastComputeOutBounds[e]}):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach(e=>{this.layout.getLastComputeOutBounds()[e]<this._layoutCache._lastComputeOutBounds[e]?this.layout.getLastComputeOutBounds()[e]=this._layoutCache._lastComputeOutBounds[e]:this._layoutCache._lastComputeOutBounds[e]=this.layout.getLastComputeOutBounds()[e]})),t}_clearLayoutCache(){this._hasAutoIndent=!1,this._layoutCache.width=0,this._layoutCache.height=0,this._layoutCache._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0}}onDataUpdate(){this._clearLayoutCache()}_appendAxisUnit(t,e){var i;if(this._spec.unit&&this._spec.unit.visible){const{text:n,style:r}=this._spec.unit;let a,o;e?(a={x:t.x2,y:this.getLayoutStartPoint().y},o={textAlign:"left",textBaseline:"middle"}):(a={x:this.getLayoutStartPoint().x,y:t.y1},o={textAlign:this._orient==="left"?"left":"right",textBaseline:"bottom"}),o=Object.assign(Object.assign(Object.assign({},o),r),{x:a.x,y:a.y,text:n}),this._unitText?this._unitText.setAttributes(o):(this._unitText=oo(o),this._unitText.name="axis-unit",(i=this.getContainer())===null||i===void 0||i.add(this._unitText));const l=this._unitText.AABBBounds;e?(t.x2+=l.x2>t.x2?l.x2-t.x2:0,t.y2+=l.y2>t.y2?l.y2-t.y2:0):(t.x1+=l.x1<t.x1?l.x1-t.x1:0,t.y1+=l.y1<t.y1?l.y1-t.y1:0)}return t}_getNeedClearVRenderComponents(){return this._unitText?[this._unitText]:[]}}Kf.type=J.cartesianAxis,Kf.specKey="axes";const tst=Math.sqrt(50),est=Math.sqrt(10),ist=Math.sqrt(2);class Om{constructor(){this._extend={}}setExtraAttrFromSpec(){E(this._spec.nice)&&(this._nice=this._spec.nice),E(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Lu(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;let e=5;const i=this._spec.tick||{};if(H(i.forceTickCount))e=i.forceTickCount;else if(q(i.tickCount)){const a=this._scale.range();let o=Math.abs(a[a.length-1]-a[0]);o===1&&this._option&&(o=Ce(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height),e=i.tickCount({rangeSize:o,labelStyle:this._spec.label&&this._spec.label.style})}else e=H(i.tickCount)?i.tickCount:5;this._spec.niceType==="accurateFirst"&&(e=Math.max(5,e));const{min:n,max:r}=(t=this._domain)!==null&&t!==void 0?t:{};C(n)&&C(r)?this._nice&&this._scale.nice(e):E(n)&&C(r)?this._nice&&this._scale.niceMax(e):C(n)&&E(r)&&this._nice&&this._scale.niceMin(e)}setLogScaleNice(){var t;const{min:e,max:i}=(t=this._domain)!==null&&t!==void 0?t:{};C(e)&&C(i)?this._nice&&this._scale.nice():E(e)&&C(i)?this._nice&&this._scale.niceMax():C(e)&&E(i)&&this._nice&&this._scale.niceMin()}setScaleNice(){this._spec.type==="log"?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._spec.type!=="log"||C(t)||t!==0&&t[0]!==0?this._scale.scale(t):this._scale.range()[0]}computeLinearDomain(t){const e=[];return t.length?t.forEach(i=>{const{min:n,max:r}=i;e[0]=e[0]===void 0?n:Math.min(e[0],n),e[1]=e[1]===void 0?r:Math.max(e[1],r)}):(e[0]=0,e[1]=0),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(i===0?i=1:i>0?e=0:i<0&&(i=0)),E(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),E(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Lu(this._spec);if(E(e)||E(i)||this._spec.type!=="linear")return t;if(Math.abs(pi(t)-Ye(t))<=1e-12){let n=t[0];const r=n>=0?1:-1;if(n=Math.abs(n),n<1)t[0]=0,t[1]=1;else{let a=n/5;const o=Math.floor(Math.log(a)/Math.LN10),l=a/Math.pow(10,o);a=(l>=tst?10:l>=est?5:l>=ist?2:1)*Math.pow(10,o),t[0]=0,t[1]=10*a}r<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(e===void 0)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.setScaleNice(),this.event.emit(bt.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,r=n?i:0,a=n?0:i;for(const o in this._extend)e=this._extend[o],e>t[a]&&(t[a]=e),e<t[r]&&(t[r]=e)}getDomainSpec(){return this._domain}setDomainMinMax(t){if(!this._domain)return;const{min:e,max:i}=this._domain;E(e)&&(t[0]=e),E(i)&&(t[1]=i)}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){t=t??this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this.setScaleNice(),this.event.emit(bt.scaleDomainUpdate,{model:this}),this.event.emit(bt.scaleUpdate,{model:this,value:"domain"})}}class xa extends Kf{constructor(){super(...arguments),this.type=J.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new Qs}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];E((t=this._domain)===null||t===void 0?void 0:t.min)&&(i[0]=this._domain.min),E((e=this._domain)===null||e===void 0?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}}xa.type=J.cartesianLinearAxis,xa.specKey="axes",ci(xa,Om);const sst=()=>{wo(),I.registerComponent(xa.type,xa)};class aI{constructor(){this._rawDomainIndex=[]}dataToPosition(t,e={}){var i,n;if(t.length===0||this._scales.length===0)return 0;const{position:r,bandScale:a}=this.getPosition(t);return r+a.bandwidth()*((n=(i=e.bandPosition)!==null&&i!==void 0?i:this._spec.bandPosition)!==null&&n!==void 0?n:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)})}getPosition(t){let e=0,i=this._scale;if(this._scales.length===1||t.length===1)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let r=0;r<n;r++)e+=this._scales[r].scale(t[r]);i=this._scales[n-1]}return{position:e,bandScale:i}}calcScales(t,e){var i,n;const{bandPadding:r,paddingInner:a,paddingOuter:o}=this._spec,l=U(r),h=U(a),d=U(o);for(let u=0;u<this._scales.length;u++){const c=l?r[u]:r,p=h?a[u]:a,g=d?o[u]:o;this._scales[u].paddingInner((i=p??c)!==null&&i!==void 0?i:t,!0).paddingOuter((n=g??c)!==null&&n!==void 0?n:e,!0)}}computeBandDomain(t){if(!t.length)return[];if(t.length===1)return t[0].values;const e=new Set;for(let i=0;i<t.length;i++)for(let n=0;n<t[i].values.length;n++)e.add(t[i].values[n]);return Array.from(e)}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(!((t=this._rawDomainIndex)===null||t===void 0)&&t.length)&&this._scales.length&&this._updateRawDomain();const e=this._spec.domain;for(let i=0;i<this._scales.length;i++)if(e&&e.length&&i===0)this._scales[i].domain(e);else{const n=this.collectData(i),r=this.computeDomain(n);this._scales[i].domain(r.sort((a,o)=>this._rawDomainIndex[i][a]-this._rawDomainIndex[i][o]))}this.transformScaleDomain(),this.event.emit(bt.scaleDomainUpdate,{model:this}),this.event.emit(bt.scaleUpdate,{model:this,value:"domain"})}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;e<this._scales.length;e++)if(t&&t.length&&e===0)this._scales[e].domain(t);else{const i=this.collectData(e,!0),n=this.computeDomain(i);this._rawDomainIndex[e]={},n.forEach((r,a)=>this._rawDomainIndex[e][r]=a)}}_clearRawDomain(){this._rawDomainIndex=[]}}class zd extends Kf{constructor(){super(...arguments),this.type=J.cartesianBandAxis,this._scale=new Ao}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=e=>this._scales[e];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse}}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){var t;if(this._scale&&(this._spec.bandSize&&this._scale.bandwidth(this._spec.bandSize),this._spec.maxBandSize&&this._scale.maxBandwidth(this._spec.maxBandSize),this._spec.minBandSize&&this._scale.minBandwidth(this._spec.minBandSize),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(this._spec.bandSize||this._spec.maxBandSize))){const e=SR(this._scale.domain().length,(t=this._spec.bandSize)!==null&&t!==void 0?t:this._spec.maxBandSize,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach(i=>i.setMaxWidth(e)):["left","right"].includes(this._orient)&&this._regions.forEach(i=>i.setMaxHeight(e))}}}zd.type=J.cartesianBandAxis,zd.specKey="axes",ci(zd,aI);const nst=()=>{wo(),I.registerComponent(zd.type,zd)};class qf extends xa{constructor(){super(...arguments),this.type=J.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(t==null?void 0:t.value),Te(this._regions,e=>{Ce(this.getOrient())?e.setXAxisHelper(this.axisHelper()):e.setYAxisHelper(this.axisHelper())},{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=_t({},this._spec.tick,(t=this._spec.layers)===null||t===void 0?void 0:t[0])}_initData(){var t;if(super._initData(),(t=this._spec.layers)===null||t===void 0?void 0:t[1]){const e=new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:Object.assign(Object.assign({},this._tickTransformOption("cartesian")),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Cr(this._option,e)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var t,e,i,n,r,a,o,l;const h=$r.getInstance(),d=((e=(t=this._spec.layers)===null||t===void 0?void 0:t[1])===null||e===void 0?void 0:e.timeFormat)||"%Y%m%d",u=(((n=(i=this._spec.layers)===null||i===void 0?void 0:i[1])===null||n===void 0?void 0:n.timeFormatMode)||"local")==="local"?h.timeFormat:h.timeUTCFormat,c=((a=(r=this._spec.layers)===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.timeFormat)||"%Y%m%d",p=(((l=(o=this._spec.layers)===null||o===void 0?void 0:o[0])===null||l===void 0?void 0:l.timeFormatMode)||"local")==="local"?h.timeFormat:h.timeUTCFormat;return(g,f,_,m,v)=>{var y;let b;return b=v===0?p(c,g):u(d,g),!((y=this._spec.label)===null||y===void 0)&&y.formatMethod?this._spec.label.formatMethod(b,f):b}}getLabelItems(t){const e=[];return U(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map(i=>({id:i.value,label:i.value,value:t===0?0:this.dataToPosition([i.value])/t,rawValue:i.value}))),this._layerTickData&&U(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map(i=>{const n=this.dataToPosition([i.value]);return{id:i.value,label:i.value,value:n/t,rawValue:i.value}})),e}transformScaleDomain(){}}qf.type=J.cartesianTimeAxis,qf.specKey="axes";const rst=()=>{wo(),I.registerComponent(qf.type,qf)};class Hd extends xa{constructor(){super(...arguments),this.type=J.cartesianLogAxis,this._zero=!1,this._scale=new Sx}initScales(){var t;super.initScales(),this._scale.base((t=this._spec.base)!==null&&t!==void 0?t:10)}transformScaleDomain(){}}Hd.type=J.cartesianLogAxis,Hd.specKey="axes",ci(Hd,Om);const ast=()=>{wo(),I.registerComponent(Hd.type,Hd)};class Gd extends xa{constructor(){super(...arguments),this.type=J.cartesianSymlogAxis,this._zero=!1,this._scale=new Ax}initScales(){var t;super.initScales(),this._scale.constant((t=this._spec.constant)!==null&&t!==void 0?t:10)}transformScaleDomain(){}}Gd.type=J.cartesianSymlogAxis,Gd.specKey="axes",ci(Gd,Om);const ost=()=>{wo(),I.registerComponent(Gd.type,Gd)},uC=s=>{var t;const e=(t=s.type)!==null&&t!==void 0?t:s.orient==="angle"?"band":"linear";return{axisType:e,componentName:`${J.polarAxis}-${e}`}};var cC=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};class Zf extends TS{constructor(){super(...arguments),this.type=J.polarAxis,this.name=J.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=he.Axis,this._tick=void 0,this._center=null,this._startAngle=N_,this._endAngle=Px,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(t==null?void 0:t.value),Te(this._regions,e=>{this.getOrient()==="radius"?e.radiusAxisHelper=this.axisHelper():e.angleAxisHelper=this.axisHelper()},{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=(e=this.getRegions())===null||e===void 0?void 0:e[0];return i?i.getLayoutStartPoint():t}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){var e,i;const n=t[this.specKey];if(!n)return null;if(!U(n)){if(!AM(n))return null;const{axisType:l,componentName:h}=uC(n);return n.center=t.center,n.startAngle=(e=t.startAngle)!==null&&e!==void 0?e:Td,n.endAngle=(i=t.endAngle)!==null&&i!==void 0?i:E(t.startAngle)?t.startAngle+360:Dp,n.type=l,[{spec:n,specPath:[this.specKey],type:h}]}const r=[];let a;const o=[];return n.forEach((l,h)=>{var d,u,c,p,g;if(!AM(l))return;const{axisType:f,componentName:_}=uC(l);l.center=t.center,l.startAngle=(d=t.startAngle)!==null&&d!==void 0?d:Td,l.endAngle=(u=t.endAngle)!==null&&u!==void 0?u:E(t.startAngle)?t.startAngle+360:Dp,l.outerRadius=(g=(p=(c=l.radius)!==null&&c!==void 0?c:t.outerRadius)!==null&&p!==void 0?p:t.radius)!==null&&g!==void 0?g:pu,l.type=f;const m={spec:l,specIndex:h,specPath:[this.specKey,h],type:_};r.push(m),l.orient==="radius"?o.push(m):a=h}),o.forEach(l=>{l.angleAxisIndex=a}),r}static createComponent(t,e){const{spec:i}=t,n=cC(t,["spec"]),r=I.getComponentInKey(n.type);return r?new r(i,Object.assign(Object.assign({},e),n)):(e.onError(`Component ${n.type} not found`),null)}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient=this._spec.orient==="angle"?"angle":"radius",this._center=this._spec.center;const i=this.getChart().getSpec(),n=(t=this._spec.startAngle)!==null&&t!==void 0?t:i.startAngle,r=(e=this._spec.endAngle)!==null&&e!==void 0?e:i.endAngle;this._startAngle=le(n??Td),this._endAngle=le(r??(E(n)?n+360:Dp)),this._inverse=this._spec.inverse}onLayoutEnd(t){this.updateScaleRange()&&(this.updateSeriesScale(),this.event.emit(bt.scaleUpdate,{model:this,value:"range"})),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){const t=this._initTickDataSet(this._tickTransformOption("polar"));t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new Cr(this._option,t)}_tickTransformOption(t){return Object.assign(Object.assign({},super._tickTransformOption(t)),{noDecimal:this._tick.noDecimals,startAngle:this.startAngle,labelOffset:Du(this._spec),getRadius:()=>this.getOuterRadius()})}afterCompile(){var t;const e=(t=this._axisMark)===null||t===void 0?void 0:t.getProduct();e&&e.addEventListener(ut.AFTER_ELEMENT_ENCODE,()=>{this._isLayout===!1&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())})}updateScaleRange(){const t=this._scale.range();let e;return e=this.getOrient()==="radius"?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectData(t,e){const i=[];return Te(this._regions,n=>{var r,a,o;let l;if(l=t>0?(a=(r=n.getGroups())===null||r===void 0?void 0:r.fields)===null||a===void 0?void 0:a[t]:this.getOrient()==="radius"?n.getRadiusField():n.getAngleField(),l=U(l)?Kt(this._scale.type)?l:[l[0]]:[l],t||(this._dataFieldText=n.getFieldAlias(l[0])),l){const h=n.getViewData();if(e)l.forEach(d=>{i.push(n.getRawDataStatisticsByField(d,!1))});else if(h&&h.latestData&&h.latestData.length){const d=(o=n.getViewDataStatistics)===null||o===void 0?void 0:o.call(n);l.forEach(u=>{var c;!((c=d==null?void 0:d.latestData)===null||c===void 0)&&c[u]&&i.push(d.latestData[u])})}}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}updateSeriesScale(){Te(this._regions,t=>{this.getOrient()==="radius"?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())},{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e=this.getOrient()==="radius"?t.getRadiusField():t.getAngleField();return Kt(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Kt(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}positionToData(t){const e=this.pointToCoord(t);return this.getOrient()==="radius"?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),r=qr({angle:e,radius:t.radius});return{x:r.x+i,y:r.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,r=t.y-i;const a=this._startAngle,o=this._endAngle,l=Math.sqrt(n*n+r*r);n/=l,r/=l;let h=Math.atan2(r,n);if(h<a)for(;h<=a;)h+=2*Math.PI;if(h>o)for(;h>=o;)h-=2*Math.PI;return{radius:l,angle:h}}getCenter(){var t,e;return{x:((t=this._center)===null||t===void 0?void 0:t.x)||this.getRefLayoutRect().width/2,y:((e=this._center)===null||e===void 0?void 0:e.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){if(this._tickData){const t=this._tickData.getLatestData();if(!t||U(t))return t||[];this.computeData("force")}return this._scale.ticks()}updateLayoutAttribute(){this._visible&&(this.getOrient()==="radius"?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,r=U(this._tickData.getLatestData())?this._tickData.getLatestData().map(l=>{const h=this.dataToPosition([l.value]);return{id:l.value,label:l.value,value:(h-this._startAngle)/n,rawValue:l.value}}):[],a=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle}),o=Object.assign(Object.assign({},a),{title:{text:this._spec.title.text||this._dataFieldText},items:r.length?[r]:[],orient:"angle"});this._spec.grid.visible&&(o.grid=Object.assign({type:"line",smoothLink:!0,items:r},a)),this._update(o)}_layoutRadiusAxis(){var t,e,i;const n=this.getCenter(),r=this.computeLayoutOuterRadius(),a=this.computeLayoutInnerRadius(),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=this.coordToPoint({angle:this._startAngle,radius:a}),h=Ee.distancePP(l,o),d=U(this._tickData.getLatestData())?this._tickData.getLatestData().map(p=>{const g=this.dataToPosition([p.value]);return{id:p.value,label:p.value,value:(g-a)/h,rawValue:p.value}}):[],u=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:l,end:o,verticalFactor:-1}),c=Object.assign(Object.assign({},u),{title:{text:this._spec.title.text||this._dataFieldText},items:d.length?[d]:[],orient:"radius"});!((t=this._spec.grid)===null||t===void 0)&&t.visible&&(c.grid=Object.assign({items:d,type:!((e=this._spec.grid)===null||e===void 0)&&e.smooth?"circle":"polygon",center:n,closed:!0,sides:(i=this._getRelatedAngleAxis())===null||i===void 0?void 0:i.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},u)),this._update(c)}_getRelatedAngleAxis(){const t=this._option.angleAxisIndex;if(E(t))return this._option.getComponentByIndex(this.specKey,t)}computeLayoutOuterRadius(){var t;const e=(t=this._spec.outerRadius)!==null&&t!==void 0?t:this._spec.radius,i=e??this.getRefSeriesRadius().outerRadius,{width:n,height:r}=this.getRefLayoutRect();return Math.min(n,r)/2*i}computeLayoutInnerRadius(){var t;const e=(t=this._spec.innerRadius)!==null&&t!==void 0?t:this.getRefSeriesRadius().innerRadius,{width:i,height:n}=this.getRefLayoutRect();return Math.min(i,n)/2*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=pu,e=0;const i=this.getChart().getSpec();return Te(this.getRegions(),n=>{const r=n;if(MZ(r.type)){const{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=r;H(a)&&(t=a),H(o)&&(e=o)}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:e}=t,i=cC(t,["grid"]);this._axisMark.getProduct().encode(_t({},this._axisStyle,i)),this._gridMark&&this._gridMark.getProduct().encode(_t({},this._gridStyle,e))}invert(t){var e;if(this.getOrient()==="angle"&&this._scale.type==="band"){const i=this._scale.range(),n=i[i.length-1]-i[0],r=((e=this.getSpec().bandPosition)!==null&&e!==void 0?e:this._defaultBandPosition)===.5?0:this._scale.bandwidth()/2;if(i[0]<0){const a=(t+r+Math.abs(i[0]))%n-Math.abs(i[0]);return this._scale.invert(a)}return this._scale.invert((t+r)%n)}return this._scale.invert(t)}}Zf.type=J.polarAxis,Zf.specKey="axes";class Wd extends Zf{constructor(){super(...arguments),this.type=J.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new Qs}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}Wd.type=J.polarLinearAxis,Wd.specKey="axes",ci(Wd,Om);const lst=()=>{wo(),I.registerComponent(Wd.type,Wd)};class Nd extends Zf{constructor(){super(...arguments),this.type=J.polarBandAxis,this._scale=new Ao}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}transformScaleDomain(){}}Nd.type=J.polarBandAxis,Nd.specKey="axes",ci(Nd,aI);const hst=()=>{wo(),I.registerComponent(Nd.type,Nd)};var dst=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};function ust(s,t){const{title:e={},item:i={},pager:n={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:c,regionId:p,regionIndex:g,seriesIndex:f,seriesId:_,padding:m}=s,v=dst(s,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return e.visible&&(v.title=XL(e)),ft(i.focusIconStyle)||At(i.focusIconStyle),i.shape=gn(i.shape),i.label=gn(i.label),i.value=gn(i.value),i.background=gn(i.background),fs(i.maxWidth)&&(i.maxWidth=Number(i.maxWidth.substring(0,i.maxWidth.length-1))*t.width/100),fs(i.width)&&(i.width=Number(i.width.substring(0,i.width.length-1))*t.width/100),fs(i.height)&&(i.height=Number(i.height.substring(0,i.height.length-1))*t.width/100),v.item=i,ft(n.textStyle)||At(n.textStyle),gn(n.handler),v.pager=n,r.visible&&!ft(r.style)&&(_t(v,r.style),E(r.padding)&&(v.padding=r.padding)),v}const cst=(s,t)=>{const e=[],i={},{series:n,seriesField:r}=t;return n().forEach(a=>{const o=r(a);let l;l=o===a.getSeriesField()?a.getSeriesInfoList():a.getSeriesInfoInField(o),l.forEach(h=>{i[h.key]||(i[h.key]=!0,e.push(h))})}),e},pst=(s,t)=>{var e,i,n;const{selected:r,field:a,data:o}=t,l=r(),h=o();if(l.length===0&&h.length)return[];if(l.length===h.length)return s;const d={};l.forEach(c=>{d[c]=!0});const u=(e=a())!==null&&e!==void 0?e:Ms;return U(s)&&(!((i=s[0])===null||i===void 0)&&i.nodes)?(s[0].nodes=s[0].nodes.filter(c=>d[c.key]===!0),!((n=s[0])===null||n===void 0)&&n.links&&(s[0].links=s[0].links.filter(c=>d[c.source]===!0&&d[c.target]===!0))):E(u)&&(s=s.filter(c=>d[c[u]]===!0)),s};class MS extends ds{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=he.Legend,this.layoutLevel=xn.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{Te(this._regions,t=>{var e;(e=t.getViewData())===null||e===void 0||e.markRunning()},{userId:this._seriesUserId,specIndex:this._seriesIndex}),Te(this._regions,t=>{t.reFilterViewData()},{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Jx(this._spec.orient)?this._spec.orient:"left",this._position=(t=this._spec.position)!==null&&t!==void 0?t:"middle",this._visible=this._spec.visible!==!1;const{regionId:e,regionIndex:i,seriesId:n,seriesIndex:r}=this._spec;E(n)&&(this._seriesUserId=Y(n)),E(e)&&(this._regionUserId=Y(e)),E(r)&&(this._seriesIndex=Y(r)),E(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(t==null?void 0:t.orient)!==(e==null?void 0:e.orient)?(i.reMake=!0,i):(_e(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Cr(this._option,t),this._initSelectedData(),Te(this._regions,e=>{e.event.on(bt.rawDataUpdate,{filter:({model:i})=>(i==null?void 0:i.id)===e.id},()=>{this._legendData.getDataView().reRunAllTransform()})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,n;const r=this._selectedData;C(t)||JSON.stringify(r)===JSON.stringify(t)||(this._selectedData=[...t],(i=(e=this.effect).onSelectedDataChange)===null||i===void 0||i.call(e),this.event.emit(bt.legendSelectedDataChange,{model:this}),(n=this._legendComponent)===null||n===void 0||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;H(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(n.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)_e(n,this._cacheAttrs)||this._legendComponent.setAttributes(_t({},n,{defaultSelected:this._selectedData}));else{const o=new(this._getLegendConstructor())(_t({},n,{defaultSelected:this._selectedData}));o.name="legend",this._legendComponent=o,this.getContainer().add(o),this._option.disableTriggerEvent||this._initEvent(),o.on("*",(l,h)=>this._delegateEvent(this._legendComponent,l,h))}this._cacheAttrs=n;const r=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,a=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if(this.layoutType!=="normal-inline"){const o=this.layoutOrient==="bottom"||this.layoutOrient==="top"?"horizontal":"vertical",l=this._position,{width:h,height:d}=e;let u=0,c=0;o==="horizontal"?l==="middle"?u=(h-r)/2:l==="end"&&(u=h-r):l==="middle"?c=(d-a)/2:l==="end"&&(c=d-a),this._legendComponent.setAttributes({dx:u,dy:c})}return i.x2=i.x1+r,i.y2=i.y1+a,i}onDataUpdate(){var t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const i=this._getLegendAttributes(this.getLayoutRect());_e(i,this._cacheAttrs)||this._legendComponent.setAttributes(_t({},i,{defaultSelected:this._selectedData}))}(e=(t=this.effect).onSelectedDataChange)===null||e===void 0||e.call(t),this.event.emit(bt.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}MS.specKey="legends";class Jf extends MS{constructor(){super(...arguments),this.type=J.discreteLegend,this.name=J.discreteLegend}static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!U(e))return e.type&&e.type!=="discrete"?void 0:[{spec:e,specIndex:0,specPath:[this.specKey],type:J.discreteLegend}];const i=[];return e.forEach((n,r)=>{n.type&&n.type!=="discrete"||i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.discreteLegend})}),i}init(t){super.init(t),Te(this._regions,e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this._getLegendDefaultData()},level:Es.legendFilter})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){Mt(this._option.dataSet,"discreteLegendFilter",pst),Mt(this._option.dataSet,"discreteLegendDataMake",cst);const t=new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const e=[];return Te(this._regions,i=>{e.push(i)},{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),e},seriesField:e=>this._getSeriesLegendField(e)}}),t}_getSeriesLegendField(t){var e,i;const n=t.getSeriesField();if(!this._spec.scaleName||!t.getRawData())return n;const r=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!r)return n;if(this._spec.field)return this._spec.field;if(!Jo(r.domain))return n;const a=r.domain.find(o=>o.dataId===t.getRawData().name);return a&&(i=(e=a.fields)===null||e===void 0?void 0:e[0])!==null&&i!==void 0?i:n}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._getLegendDefaultData()}_getLegendDefaultData(){return q(this._spec.data)?this._getLegendItems().map(t=>t.label):this._legendData.getLatestData().map(t=>t.key)}_addDefaultTitleText(t){var e,i,n,r;if(!((e=t.title)===null||e===void 0)&&e.visible&&C(t.title.text)&&C((i=t.title.style)===null||i===void 0?void 0:i.text)){const a=(r=(n=this._regions)===null||n===void 0?void 0:n[0])===null||r===void 0?void 0:r.getSeries()[0];if(!a)return;t.title.text=Bf(a.getRawData(),a.getSeriesField())}}_getLegendAttributes(t){const e=this.layoutOrient==="bottom"||this.layoutOrient==="top"?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},ust(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return RO}_initEvent(){if(this._legendComponent){const t=this._spec.filter!==!1;this._legendComponent.addEventListener(Hs.legendItemClick,e=>{const i=Et(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(bt.legendItemClick,{model:this,value:i,event:e})}),this._legendComponent.addEventListener(Hs.legendItemHover,e=>{const i=Et(e,"detail");this.event.emit(bt.legendItemHover,{model:this,value:i,event:e})}),this._legendComponent.addEventListener(Hs.legendItemUnHover,e=>{const i=Et(e,"detail");this.event.emit(bt.legendItemUnHover,{model:this,value:i,event:e})})}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map(e=>{var i,n;const r=e.style("fillOpacity"),a=e.style("strokeOpacity"),o=e.style("opacity"),l=e.style("texture");return{label:e.key,shape:{symbolType:(n=(i=e.style("symbolType"))!==null&&i!==void 0?i:e.shapeType)!==null&&n!==void 0?n:"circle",fillOpacity:H(r)?r:1,strokeOpacity:H(a)?a:1,opacity:H(o)?o:1,texturePadding:l?1:null,textureSize:l?4:null,texture:l,fill:e.style("fill"),stroke:e.style("stroke"),textureColor:e.style("textureColor"),innerBorder:e.style("innerBorder"),outerBorder:e.style("outerBorder"),lineDash:e.style("lineDash"),lineDashOffset:e.style("lineDashOffset"),lineWidth:e.style("lineWidth")}}});return q(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}}Jf.specKey="legends",Jf.type=J.discreteLegend;const gst=()=>{I.registerComponent(Jf.type,Jf)},fst=(s,t)=>{const{series:e,field:i,scale:n}=t,r=i();if(i&&r){let a=Number.MAX_VALUE,o=Number.MIN_VALUE;return e().forEach(l=>{const h=l.getRawDataStatisticsByField(r,!0),d=h==null?void 0:h.min,u=h==null?void 0:h.max;H(d)&&(a=d),H(u)&&(o=u)}),[a,o]}if(n){const a=n();return a?a.domain():[]}return[]},_st=(s,t)=>{const{selected:e,field:i,data:n}=t,r=e(),a=i();if(r===n())return s;if(a&&!ft(r)){const[o,l]=r;return s.filter(h=>h[a]>=o&&h[a]<=l)}return s};var mst=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};function vst(s){const t=_t({},s),{title:e={},handler:i={},rail:n={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:h,background:d={},type:u,id:c,visible:p,orient:g,position:f,data:_,defaultSelected:m,field:v,filter:y,regionId:b,regionIndex:x,seriesIndex:S,seriesId:A,padding:k}=t,w=mst(t,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return e.visible&&(w.title=XL(e)),w.showHandler=i.visible!==!1,ft(i.style)||(w.handlerStyle=At(i.style)),E(n.width)&&(w.railWidth=n.width),E(n.height)&&(w.railHeight=n.height),ft(n.style)||(w.railStyle=At(n.style)),ft(r.style)||(w.trackStyle=At(r.style)),w.startText=gn(a),w.endText=gn(o),w.handlerText=gn(l),ft(h)||(w.sizeBackground=At(h)),d.visible&&!ft(d.style)&&(_t(w,d.style),E(d.padding)&&(w.padding=d.padding)),w}function pC(s){return s==="color"||s==="size"}const yst={color:rm,size:am},bst=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],xst=[2,10];class Qf extends MS{static getSpecInfo(t){const e=t[this.specKey];if(!e)return;if(!U(e))return pC(e.type)?[{spec:e,specIndex:0,specPath:[this.specKey],type:e.type==="color"?J.colorLegend:J.sizeLegend}]:void 0;const i=[];return e.forEach((n,r)=>{pC(n.type)&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:n.type==="color"?J.colorLegend:J.sizeLegend})}),i}constructor(t,e){super(t,e),this.type=J.colorLegend,this.name=J.colorLegend;const i=this._spec.type==="color"?J.colorLegend:J.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),Te(this._regions,e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()},level:Es.legendFilter})},{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){Mt(this._option.dataSet,"continuousLegendFilter",_st),Mt(this._option.dataSet,"continuousLegendDataMake",fst);const t=new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce((e,i)=>(e.push(...i.getSeries()),e),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,n,r;if(!((e=t.title)===null||e===void 0)&&e.visible&&C(t.title.text)&&C((i=t.title.style)===null||i===void 0?void 0:i.text)){const a=this._field;if(a){const d=(r=(n=this._regions)===null||n===void 0?void 0:n[0])===null||r===void 0?void 0:r.getSeries()[0];return d?void(t.title.text=Bf(d.getRawData(),a)):void 0}let o=this._spec.scale;o||(o=this._legendType);const l=this._option.globalScale.getScaleSpec(o);if(!Jo(l==null?void 0:l.domain))return;const h=l.domain[0];if(h.fields.length===0)return;t.title.text=Bf(this._option.dataSet.getDataView(h.dataId),h.fields[0])}}_getLegendAttributes(t){var e,i;const n=this.layoutOrient==="bottom"||this.layoutOrient==="top"?"horizontal":"vertical",r=n==="horizontal"?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&o.type==="linear"&&(a=o.range()),ft(a)&&(a=this._legendType==="color"?bst:xst);let l=(e=this._legendData.getLatestData()[0])!==null&&e!==void 0?e:0,h=(i=this._legendData.getLatestData()[1])!==null&&i!==void 0?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=this._legendData.getLatestData()[0]===0?1:Math.max(0,this._legendData.getLatestData()[0]));const d=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,[this._legendType==="color"?"colors":"sizeRange"]:a},vst(this._spec));return this._addDefaultTitleText(d),d}_getLegendConstructor(){return yst[this._legendType]}_initEvent(){if(this._legendComponent){const t=this._spec.filter!==!1;this._legendComponent.addEventListener("change",Xn(e=>{const i=Et(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(bt.legendFilter,{model:this,value:i,event:e})},30))}}}Qf.specKey="legends",Qf.type=J.continuousLegend;const Sst=()=>{I.registerComponent(Qf.type,Qf)};function Ast(s){return String(s).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\(/g,"(").replace(/ /g," ")}const ts=(s,t,e)=>C(s)?s:q(s)?s(t,e):s,Vd=(s,t,e)=>{if(C(s))return s;if(U(s)){const i=[];return s.forEach(n=>{if(q(n)){const r=n(t,e);E(r)&&i.push(r)}else i.push(n)}),i}return q(s)?s(t,e):s};function kst(s){var t;const e=!((t=s[0])===null||t===void 0)&&t.series?[{data:s,value:""}]:s;for(const{data:i}of e)for(const{datum:n}of i)for(const r of n??[])if(r)return r}const yp=(s,t)=>s?(t||(t=s.getBoundingClientRect()),s.offsetWidth>0?t.width/s.offsetWidth:t.height/s.offsetHeight):1,Vv=(s,t)=>{var e;let i,n;(s==null?void 0:s.type)!=="rich"&&(s==null?void 0:s.type)!=="html"?(s=(s??"").toString(),t.multiLine?(i=s.split(`
- `),i=i.map((a,o)=>o<i.length-1?a+`
- `:a)):i=[s],n=i.map(a=>Object.assign(Object.assign({},t),{text:a}))):(n=s.text,i=s);const r=V5({wordBreak:(e=t.wordBreak)!==null&&e!==void 0?e:"break-word",maxWidth:t.maxWidth?t.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:i}},wst="vchart-tooltip-element",gC="vchart-tooltip-container",Tst=20,fC="",_C={key:"其他",value:"..."},Uv={offsetX:10,offsetY:10,sanitize:Ast};class t_{}t_.dom=`${xt}_TOOLTIP_HANDLER_DOM`,t_.canvas=`${xt}_TOOLTIP_HANDLER_CANVAS`;const bp=(s,t)=>{let e;if(E(s)){if(lt(s))e=s;else if(q(s)){const i=s(t);lt(i)&&(e=i)}}return e},oI={left:["left","middle"],right:["right","middle"],inside:["middle","middle"],top:["middle","top"],lt:["left","top"],tl:["left","top"],rt:["right","top"],tr:["right","top"],bottom:["middle","bottom"],bl:["left","bottom"],lb:["left","bottom"],br:["right","bottom"],rb:["right","bottom"]},Kh=(s,t)=>{var e,i;return(i=(e=oI[s])===null||e===void 0?void 0:e[0])!==null&&i!==void 0?i:t},qh=(s,t)=>{var e,i;return(i=(e=oI[s])===null||e===void 0?void 0:e[1])!==null&&i!==void 0?i:t},Mst=(s,t,e)=>{var i,n,r,a,o;if(!t||((i=e==null?void 0:e.event)===null||i===void 0?void 0:i.type)==="mouseout")return null;const l=Vd(s.title,t,e),h=Y(Vd(s.content,t,e)),d={title:{value:(n=l==null?void 0:l.value)===null||n===void 0?void 0:n.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=Tst}=s,c=ts(l==null?void 0:l.visible,t,e)!==!1;if(l&&c){const p=kst(t);d.title={value:ts(l==null?void 0:l.value,p,e),valueStyle:ts(l==null?void 0:l.valueStyle,p,e),hasShape:l.hasShape}}else d.title={hasShape:!1,visible:!1};if(s.activeType==="mark")for(const p of h??[]){const g=mC((r=t[0])===null||r===void 0?void 0:r.datum[0],p,e);if(g.visible!==!1){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},g),_C));break}if(!(d.content.length<u))break;d.content.push(g)}}else if(s.activeType==="dimension")for(const{data:p}of t){for(const{datum:g,series:f}of p){if(!ia((a=f.tooltipHelper)===null||a===void 0?void 0:a.spec).includes("dimension"))continue;const _=(o=h==null?void 0:h.filter(m=>C(m.seriesId)||m.seriesId===f.id))!==null&&o!==void 0?o:[];for(const m of g){for(const v of _){const y=mC(m,v,e);if(y.visible!==!1){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},y),_C));break}if(!(d.content.length<u))break;d.content.push(y)}}if(d.content.length>=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(C(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),C(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d},mC=(s,t,e)=>{const i=ts(t.key,s,e),n=ts(t.value,s,e),r=ts(t.visible,s,e)!==!1&&(E(i)||E(n)),a=ts(t.isKeyAdaptive,s,e),o=ts(t.spaceRow,s,e),l=ts(t.shapeType,s,e),h=ts(t.shapeColor,s,e),d=ts(t.shapeFill,s,e),u=ts(t.shapeStroke,s,e),c=ts(t.shapeLineWidth,s,e),p=ts(t.keyStyle,s,e),g=ts(t.valueStyle,s,e);return{key:i,value:n,visible:r,isKeyAdaptive:a,hasShape:t.hasShape,shapeType:l,shapeFill:d,shapeStroke:u,shapeLineWidth:c,shapeHollow:t.shapeHollow,shapeColor:h,keyStyle:p,valueStyle:g,spaceRow:o,datum:s}},vC=(s,t,e)=>{var i,n;return(n=(i=s.tooltipHelper)===null||i===void 0?void 0:i.getDefaultTooltipPattern(t,e))!==null&&n!==void 0?n:null},Cst=(s,t,e,i)=>{var n,r,a,o,l,h,d;const u=Object.assign(Object.assign({},t),{activeType:s});if(s==="mark"&&e){const v=(r=(n=e.tooltipHelper)===null||n===void 0?void 0:n.spec)!==null&&r!==void 0?r:{};if(E(v.visible)||E(v.activeType)?u.visible=ia(v).includes("mark"):E(t.visible)||E(t.activeType)?u.visible=ia(t).includes("mark"):u.visible=!0,u.handler=(o=(a=v.handler)!==null&&a!==void 0?a:t.handler)!==null&&o!==void 0?o:void 0,(l=u.handler)===null||l===void 0?void 0:l.showTooltip)return u}else if(s==="dimension"&&(i!=null&&i.length)&&(lI(i).every(v=>{var y;return!ia((y=v.tooltipHelper)===null||y===void 0?void 0:y.spec).includes("dimension")})?u.visible=!1:E(t.visible)||E(t.activeType)?u.visible=ia(t).includes("dimension"):u.visible=!0,u.handler=(h=t.handler)!==null&&h!==void 0?h:void 0,(d=u.handler)===null||d===void 0?void 0:d.showTooltip))return u;const c=Pst(s,e,i),p=Est(s,e,i),g=_t({},hi(t[s]),p),f=c.title,_=xp(void 0,g,void 0,f);if(E(g.title))if(q(g.title)){const v=g.title;g.title=(y,b)=>{var x;const S=(x=v(y,b))!==null&&x!==void 0?x:{};return Object.assign(Object.assign({},_),S)}}else g.title=Object.assign(Object.assign(Object.assign({},c.title),_),g.title);else g.title=Object.assign(Object.assign({},c.title),_);const m=Y(c.content);if(E(g.content)){const v=Rst(m);if(q(g.content)){const y=g.content;g.content=(b,x)=>{var S;const A=[];return Y((S=y(b,x))!==null&&S!==void 0?S:[]).forEach(k=>{A.push(Object.assign(Object.assign({},xp(k,g,v)),k))}),A}}else{const y=[];Y(g.content).forEach(b=>{y.push(Object.assign(Object.assign({},xp(b,g,v)),b))}),g.content=y}}else g.content=m.map(v=>Object.assign(Object.assign({},v),xp(void 0,g,void 0,v)));return u[s]=Object.assign(Object.assign(Object.assign({},c),g),{activeType:s}),u},Pst=(s,t,e)=>{var i;let n={};if(s==="mark"&&t)n=(i=vC(t,"mark"))!==null&&i!==void 0?i:{};else if(s==="dimension"&&(e!=null&&e.length)){const r=[];e[0].data.forEach(o=>{const{series:l}=o,h=[Object.assign(Object.assign({},e[0]),{data:[o]})],d=vC(l,"dimension",h);d&&r.push(d)});const a=[];r.forEach(({content:o})=>{q(o)?a.push(o):a.push(...Y(o))}),n=Object.assign(Object.assign({},r[0]),{content:a})}return n},Est=(s,t,e)=>{var i,n;let r={};if(s==="mark"&&t){const a=(n=(i=t.tooltipHelper)===null||i===void 0?void 0:i.spec)!==null&&n!==void 0?n:{};r=a.mark?hi(a.mark):{}}else if(s==="dimension"&&(e!=null&&e.length)){const a=lI(e).filter(o=>{var l;const h=(l=o.tooltipHelper)===null||l===void 0?void 0:l.spec;return E(h==null?void 0:h.dimension)&&ia(h).includes("dimension")}).map(o=>o.tooltipHelper.spec.dimension);if(a.length){let o=[];a.every(({content:l})=>C(l))?o=void 0:a.forEach(({content:l})=>{C(l)||(q(l)?o==null||o.push(l):o==null||o.push(...Y(l)))}),r=Object.assign(Object.assign({},a[0]),{content:o})}}return r},lI=kh(s=>s.reduce((t,e)=>t.concat(e.data.map(i=>i.series).filter(E)),[])),Rst=s=>{const t={};return s.forEach(e=>{var i;const n=(i=e.seriesId)!==null&&i!==void 0?i:0;t[n]||(t[n]=e)}),t},xp=(s,t,e,i)=>{var n,r;const a=(r=e==null?void 0:e[(n=s==null?void 0:s.seriesId)!==null&&n!==void 0?n:0])!==null&&r!==void 0?r:e==null?void 0:e[0],o=new Set([].concat(Object.keys(s??{}),Object.keys(t??{}),Object.keys(a??{}),Object.keys(i??{})).filter(h=>h.toLowerCase().includes("shape"))),l={};return o.forEach(h=>{var d,u,c;const p=(c=(u=(d=s==null?void 0:s[h])!==null&&d!==void 0?d:t==null?void 0:t[h])!==null&&u!==void 0?u:a==null?void 0:a[h])!==null&&c!==void 0?c:i==null?void 0:i[h];p!==void 0&&(l[h]=p)}),l};var ei;(function(s){s[s.success=0]="success",s[s.failed=1]="failed"})(ei||(ei={}));const Ost={fontFamily:vt.defaultFontFamily,spacing:10,wordBreak:"break-word"};function Bo(s={},t,e){var i,n;return Object.assign(Object.assign({},e??Ost),{fill:(i=s.fill)!==null&&i!==void 0?i:s.fontColor,textAlign:s.textAlign,textBaseline:s.textBaseline,fontFamily:(n=s.fontFamily)!==null&&n!==void 0?n:t==null?void 0:t.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,lineHeight:s.lineHeight,spacing:s.spacing,multiLine:s.multiLine,maxWidth:s.maxWidth,wordBreak:s.wordBreak,autoWidth:s.autoWidth})}const Dst=s=>{var t;const{backgroundColor:e,border:i,shadow:n}=s,r={lineWidth:(t=i==null?void 0:i.width)!==null&&t!==void 0?t:0,shadow:!!n};i!=null&&i.color&&(r.stroke=i.color),e&&(r.fill=e),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=i??{};return E(a)&&(r.cornerRadius=[a,a,a,a]),r},Lst=(s,t,e)=>{var i,n,r,a,o;const{style:l={},enterable:h,transitionDuration:d}=t,{panel:u={},titleLabel:c,shape:p,keyLabel:g,valueLabel:f,spaceRow:_}=l,m=as(u.padding),v=Ar(u.padding),y=Bo(c,e),b=Bo(g,e),x=Bo(f,e),S={fill:!0,size:(i=p==null?void 0:p.size)!==null&&i!==void 0?i:8,spacing:(n=p==null?void 0:p.spacing)!==null&&n!==void 0?n:6},A={panel:Dst(u),padding:m,title:{},content:[],titleStyle:{value:y,spaceRow:_},contentStyle:{shape:S,key:b,value:x,spaceRow:_},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:d},{title:k={},content:w=[]}=s;let T=v.left+v.right,M=v.top+v.bottom,P=0;const O=w.filter(W=>(W.key||W.value)&&W.visible!==!1),D=!!O.length;let R=0,L=0,B=0,F=0;if(D){const W=[],it=[],ht=[],dt=[];A.content=O.map((Rt,gt)=>{let wt=0;const{hasShape:kt,key:Lt,shapeType:Ot="",shapeFill:mi,shapeStroke:Se,shapeLineWidth:us,shapeSize:Ge,value:Li,isKeyAdaptive:ae,spaceRow:me,keyStyle:ms,valueStyle:Zi,shapeColor:Tn,shapeHollow:nn}=Rt,Ke={height:0,spaceRow:me??_};if(E(Lt)){const Ae=_t({},b,Bo(ms,void 0,{})),{width:St,height:$t,text:We}=Vv(Lt,Ae);Ke.key=Object.assign(Object.assign({width:St,height:$t},Ae),{text:We}),ae?it.push(St):W.push(St),wt=Math.max(wt,$t)}if(E(Li)){const Ae=_t({},x,Bo(Zi,void 0,{})),{width:St,height:$t,text:We}=Vv(Li,Ae);Ke.value=Object.assign(Object.assign({width:St,height:$t},Ae),{text:We}),ht.push(St),wt=Math.max(wt,$t)}if(kt){const Ae={visible:!0,symbolType:Ot},St=mi??Tn;nn?Ae.stroke=St:Ae.fill=St,Ae.stroke=Se??St,Ae.lineWidth=us,Ke.shape=Ae;const $t=Ge??S.size;wt=Math.max($t,wt),dt.push($t)}else Ke.shape={visible:!1};return Ke.height=wt,M+=wt,gt<O.length-1&&(M+=Ke.spaceRow),Ke}),R=W.length?Ye(W):0,L=it.length?Ye(it):0,B=ht.length?Ye(ht):0,F=dt.length?Ye(dt)+S.spacing:0,P=Math.max(F+R+b.spacing+B+x.spacing,F+L,P),A.hasContentShape=!!dt.length,A.keyWidth=R,A.valueWidth=B}let z=0,N=0;const{visible:V=!0,value:G="",valueStyle:X,spaceRow:Z}=k;A.title.visible=V,A.title.spaceRow=Z??_;let et={};const K=()=>et.autoWidth&&et.multiLine!==!1;if(V){et=_t({},y,Bo(X,void 0,{})),K()&&(et.multiLine=(r=et.multiLine)===null||r===void 0||r,et.maxWidth=(a=et.maxWidth)!==null&&a!==void 0?a:D?Math.ceil(P):void 0);const{text:W,width:it,height:ht}=Vv(G,et);A.title.value=Object.assign(Object.assign({width:K()?Math.min(it,(o=et.maxWidth)!==null&&o!==void 0?o:Number.MAX_VALUE):it,height:ht},et),{text:W}),z=A.title.value.width,N=A.title.value.height,M+=N+(D?A.title.spaceRow:0)}return A.title.width=z,A.title.height=N,K()?T+=P||z:T+=Math.max(z,P),D&&A.content.forEach(W=>{var it;const ht=W.value;ht&&((it=ht.autoWidth)===null||it===void 0||it)&&(ht.width=T-v.left-v.right-F-R-b.spacing-x.spacing,ht.maxWidth||(ht.maxWidth=Math.ceil(ht.width)),A.valueWidth=Math.max(A.valueWidth,ht.width))}),A.panel.width=T,A.panel.height=M,A};class hI{get id(){return this._id}get env(){return this._env}constructor(t,e){this._visible=!0,this._id="",this._attributes=null,this._isReleased=!1,this.showTooltip=(i,n,r)=>{var a;let o=!!r.changePositionOnly;return r.changePositionOnly&&((a=this._cacheActualTooltip)===null||a===void 0?void 0:a.activeType)===i||(o=!1,this._clearCacheOfContent()),o&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(o,n,r):this.changeTooltip(!0,r,o,i,n)},this._changeTooltip=(i,n,r,a,o)=>{var l,h,d,u,c,p,g,f,_,m,v,y,b;const x=this._component.getSpec();if(this._isReleased||!x)return ei.failed;if(!i)return this._clearAllCache(),x.handler?(d=(h=(l=x.handler).hideTooltip)===null||h===void 0?void 0:h.call(l,n))!==null&&d!==void 0?d:ei.success:(this._updateTooltip(!1,n),ei.success);if(C(a)||C(o))return ei.failed;let S;if(r&&this._cacheViewSpec?S=this._cacheViewSpec:(S=Cst(a,x,n.model,n.dimensionInfo),this._cacheViewSpec=S),S.visible===!1)return ei.failed;if(S.handler)return(p=(c=(u=S.handler).showTooltip)===null||c===void 0?void 0:c.call(u,a,o,n))!==null&&p!==void 0?p:ei.success;const A=S[a];if(!A)return ei.failed;let k;return r&&this._cacheActualTooltip?k=this._cacheActualTooltip:(k=this._getActualTooltipContent(A,o,n),k.title=(f=(g=A.updateTitle)===null||g===void 0?void 0:g.call(A,k.title,o,n))!==null&&f!==void 0?f:k.title,k.content=(m=(_=A.updateContent)===null||_===void 0?void 0:_.call(A,k.content,o,n))!==null&&m!==void 0?m:k.content),C((v=k.title)===null||v===void 0?void 0:v.key)&&C((y=k.title)===null||y===void 0?void 0:y.value)&&!(!((b=k.content)===null||b===void 0)&&b.length)?ei.failed:(this._cacheActualTooltip=k,this._changeTooltipPosition(!!r,o,n))},this._changeTooltipPosition=(i,n,r)=>{var a,o,l;if(this._isReleased)return ei.failed;const h=r.event,d=this._cacheViewSpec,u=this._cacheActualTooltip;if(!d||!u)return ei.failed;if(d.enterable){if(!this._isPointerEscaped&&this._isPointerMovingToTooltip(r))return this._isTooltipPaused||(this._isTooltipPaused=!0,this._cachePointerTimer=setTimeout(()=>{this._isPointerEscaped=!0},300)),ei.success;this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerPosition=this._getPointerPositionRelativeToTooltipParent(r)}const c=u.activeType;if(d.handler)return(l=(o=(a=d.handler).showTooltip)===null||o===void 0?void 0:o.call(a,c,n,r))!==null&&l!==void 0?l:ei.success;const p=d[c];if(!p)return ei.failed;const g=this._getActualTooltipPosition(u,r,this._getTooltipBoxSize(u,i));u.position=g,p.updatePosition&&(u.position=p.updatePosition(u.position,n,r));let f=(p==null?void 0:p.visible)!==!1;return n&&h.type!=="pointerout"&&u.visible&&(u.title||u.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},r),{changePositionOnly:i}),u),ei.success},this._getActualTooltipContent=(i,n,r)=>{const a=Vd(i.visible,n,r);let o=null;return o=Mst(i,n,r),Object.assign(Object.assign({},o),{visible:!!E(o)&&a!==!1,activeType:i.activeType,data:n})},this._getActualTooltipPosition=(i,n,r)=>{var a,o,l,h,d;const u=n.event,c={x:1/0,y:1/0},{offsetX:p,offsetY:g}=this._option,f=this._cacheViewSpec;if(!f)return this._cacheTooltipPosition=void 0,c;const{activeType:_,data:m}=i,v=f[_],y=Vd(v.position,m,n),b=Vd(v.positionMode,m,n),x=this._getParentElement(f),{width:S=0,height:A=0}=r??{},k=f.renderMode==="canvas",w=(a=n==null?void 0:n.chart)===null||a===void 0?void 0:a.getCanvasRect(),T=(o=w==null?void 0:w.width)!==null&&o!==void 0?o:Qo,M=(l=w==null?void 0:w.height)!==null&&l!==void 0?l:tl;let P=!1;const O={width:0,height:0};let D={x:0,y:0},R={x:0,y:0},L=1,B=1;if(Xs(this._env)&&!f.confine){if(O.width=window.innerWidth,O.height=window.innerHeight,!k){R=(h=x==null?void 0:x.getBoundingClientRect())!==null&&h!==void 0?h:c;const ae=(d=this._compiler.getCanvas())!==null&&d!==void 0?d:this._chartContainer,me=ae==null?void 0:ae.getBoundingClientRect();D={x:me.x-R.x,y:me.y-R.y},L=yp(ae,me),B=yp(x,R)}}else O.width=T,O.height=M;const F=B/L;let z,N,V,G,X,Z;if(Vt(y)){const{left:ae,right:me,top:ms,bottom:Zi}=y;z=bp(ae,u),N=bp(ms,u),V=bp(me,u),G=bp(Zi,u)}else if(E(y)&&b!=="pointer"&&i.activeType==="mark"){P=!0;const ae=n.item,me=n.model,ms=ae==null?void 0:ae.getBounds(),Zi=me==null?void 0:me.getLayoutStartPoint();if(ms&&Zi){let{x1:Tn,y1:nn,x2:Ke,y2:Ae}=ms;switch(Tn+=Zi.x,Ke+=Zi.x,nn+=Zi.y,Ae+=Zi.y,Kh(y)){case"left":z=Tn-S*F-p;break;case"right":z=Ke+p;break;case"middle":z=(Tn+Ke)/2-S*F/2}switch(qh(y)){case"top":N=nn-A*F-g;break;case"bottom":N=Ae+g;break;case"middle":N=(nn+Ae)/2-A*F/2}}}const{canvasX:et,canvasY:K}=u;if(H(z))X=z;else if(H(V))X=T-S*F-V;else{const ae=et;switch(Kh(y,"right")){case"middle":X=ae-S*F/2;break;case"left":X=ae-S*F-p;break;case"right":X=ae+p}}if(H(N))Z=N;else if(H(G))Z=M-A*F-G;else{const ae=K;switch(qh(y,"bottom")){case"middle":Z=ae-A*F/2;break;case"top":Z=ae-A*F-g;break;case"bottom":Z=ae+g}}X*=L,Z*=L,Xs(this._env)&&(X+=D.x,Z+=D.y),X/=B,Z/=B;const{width:W,height:it}=O,ht=()=>X*B+R.x<0,dt=()=>(X+S)*B+R.x>W,Rt=()=>Z*B+R.y<0,gt=()=>(Z+A)*B+R.y>it,wt=()=>{ht()&&(P?X=-R.x/B:Kh(y,"right")==="middle"?X+=p+S/2:X+=2*p+S)},kt=()=>{ht()&&(X=-R.x/B)},Lt=()=>{dt()&&(P?X=(W-R.x)/B-S:Kh(y,"right")==="middle"?X-=p+S/2:X-=2*p+S)},Ot=()=>{dt()&&(X=(W-R.x)/B-S)},mi=()=>{Rt()&&(P?Z=-R.y/B:qh(y,"bottom")==="middle"?Z+=g+A/2:Z+=2*g+A)},Se=()=>{Rt()&&(Z=0-R.y/B)},us=()=>{gt()&&(P?Z=(it-R.y)/B-A:qh(y,"bottom")==="middle"?Z-=g+A/2:Z-=2*g+A)},Ge=()=>{gt()&&(Z=(it-R.y)/B-A)};switch(Kh(y,"right")){case"middle":ht()?(wt(),Ot()):(Lt(),kt());break;case"left":wt(),Ot();break;case"right":Lt(),kt()}switch(qh(y,"bottom")){case"middle":Rt()?(mi(),Ge()):(us(),Se());break;case"top":mi(),Ge();break;case"bottom":us(),Se()}const Li={x:X,y:Z};return this._cacheTooltipPosition=Li,this._cacheTooltipSize={width:S,height:A},Li},this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._clearAllCache();const n=(t=this._component.getSpec())!==null&&t!==void 0?t:{};n.handler?(i=(e=n.handler).release)===null||i===void 0||i.call(e):(this._removeTooltip(),this._isReleased=!0)}_clearAllCache(){this._clearCacheOfContent(),this._clearCacheOfPosition()}_clearCacheOfContent(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0}_clearCacheOfPosition(){this._isTooltipPaused=!1,this._isPointerEscaped=!1,clearTimeout(this._cachePointerTimer),this._cachePointerTimer=-1,this._cachePointerPosition=void 0,this._cacheTooltipPosition=void 0,this._cacheTooltipSize=void 0}_throttle(t){const e=this._component.getSpec();let i;return i=lt(e.throttleInterval)?e.throttleInterval:e.renderMode==="html"&&e.transitionDuration?50:10,Ea(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},Uv),{offsetX:(t=i==null?void 0:i.x)!==null&&t!==void 0?t:Uv.offsetX,offsetY:(e=i==null?void 0:i.y)!==null&&e!==void 0?e:Uv.offsetY})}_getTooltipBoxSize(t,e){var i,n,r,a,o,l;if(!e||C(this._attributes)){const h=(n=(i=this._chartOption)===null||i===void 0?void 0:i.getTheme())!==null&&n!==void 0?n:{};this._attributes=Lst(t,this._component.getSpec(),h)}return{width:(a=(r=this._attributes)===null||r===void 0?void 0:r.panel)===null||a===void 0?void 0:a.width,height:(l=(o=this._attributes)===null||o===void 0?void 0:o.panel)===null||l===void 0?void 0:l.height}}_getPointerPositionRelativeToTooltipParent(t){var e,i;let{canvasX:n,canvasY:r}=t.event;const a={x:1/0,y:1/0},o=this._cacheViewSpec,l=o.renderMode==="canvas",h=this._getParentElement(o);let d={x:0,y:0},u={x:0,y:0},c=1,p=1;if(Xs(this._env)&&!o.confine&&!l){u=(e=h==null?void 0:h.getBoundingClientRect())!==null&&e!==void 0?e:a;const g=(i=this._compiler.getCanvas())!==null&&i!==void 0?i:this._chartContainer,f=g==null?void 0:g.getBoundingClientRect();d={x:f.x-u.x,y:f.y-u.y},c=yp(g,f),p=yp(h,u)}return n*=c,r*=c,Xs(this._env)&&(n+=d.x,r+=d.y),n/=p,r/=p,{x:n,y:r}}_isPointerMovingToTooltip(t){if(!this._cacheTooltipPosition||!this._cacheTooltipSize||!this._cachePointerPosition)return!1;const{width:e,height:i}=this._cacheTooltipSize,{x:n=0,y:r}=this._cacheTooltipPosition,a=this._getPointerPositionRelativeToTooltipParent(t);if(vd(a,{x1:n,y1:r,x2:n+e,y2:r+i},!1))return!0;const o={x:n,y:r},l={x:o.x+e,y:o.y},h={x:o.x,y:o.y+i},d={x:l.x,y:h.y},u=this._cachePointerPosition;return $a([u,o,l],a.x,a.y)||$a([u,h,d],a.x,a.y)||$a([u,o,d],a.x,a.y)||$a([u,l,h],a.x,a.y)}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption(),this.changeTooltip=this._throttle(this._changeTooltip),this.changeTooltipPosition=this._throttle(this._changeTooltipPosition)}reInit(){this._initFromSpec()}}const ve=(s,t)=>E(s)?U(s)?s.map(e=>`${e}px`).join(" "):`${s}px`:t??"initial",Bst=s=>{const t=s.split(" ").map(e=>Number.isNaN(e)?Number.parseFloat(e.substring(0,e.length-2)):Number.parseFloat(e));return t.length===1?t[0]:t};function Ist(s){var t,e,i,n,r;const{panel:a={},title:o,content:l,titleStyle:h={},contentStyle:d={},padding:u,keyWidth:c,valueWidth:p,enterable:g,transitionDuration:f}=s??{},{fill:_,shadow:m,shadowBlur:v,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:w=0,width:T=0,height:M=0}=a,{value:P={}}=h,{shape:O={},key:D={},value:R={}}=d,L=Fst(O),B=Zh(D),F=Zh(R),{bottom:z,left:N,right:V,top:G}=Ar(u);return{panel:{width:ve(T+2*w),minHeight:ve(M+2*w),paddingBottom:ve(z),paddingLeft:ve(N),paddingRight:ve(V),paddingTop:ve(G),borderColor:k,borderWidth:ve(w),borderRadius:ve(A),backgroundColor:_?`${_}`:"transparent",boxShadow:m?`${b}px ${x}px ${v}px ${S}px ${y}`:"initial",pointerEvents:g?"auto":"none",transitionDuration:f?`${f}ms`:"initial",transitionProperty:f?"transform":"initial",transitionTimingFunction:f?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:l!=null&&l.length?ve(o==null?void 0:o.spaceRow):"0px"},Zh(_t({},P,o==null?void 0:o.value))),content:{},shapeColumn:{common:L,items:[],width:ve(O.size),marginRight:ve((t=O.spacing)!==null&&t!==void 0?t:8),marginBottom:ve(-((i=(e=l==null?void 0:l[(l==null?void 0:l.length)-1])===null||e===void 0?void 0:e.spaceRow)!==null&&i!==void 0?i:0))},keyColumn:{common:B,items:l==null?void 0:l.map(({key:X,spaceRow:Z},et)=>Object.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:et<l.length-1?ve(Z):"0px"},B),Zh(X)),X!=null&&X.multiLine?{width:ve(Math.ceil(X.width))}:void 0)),width:ve(c),marginRight:ve((n=D.spacing)!==null&&n!==void 0?n:26)},valueColumn:{common:F,items:l==null?void 0:l.map(({value:X,spaceRow:Z},et)=>Object.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:et<l.length-1?ve(Z):"0px"},F),Zh(X)),X!=null&&X.multiLine?{width:ve(Math.ceil(X.width))}:void 0)),width:ve(p),marginRight:ve((r=R.spacing)!==null&&r!==void 0?r:0)}}}function Zh(s,t){if(!s)return;const{fontFamily:e,fontSize:i,fill:n,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:d}=_t({},t,s),u={};return u.fontFamily=e,u.fontSize=ve(i),u.color=n,u.textAlign=r,u.lineHeight=ve(In(a,i)),u.fontWeight=o,u.whiteSpace=l?"initial":"nowrap",u.wordBreak=l?h??"break-word":"normal",u.maxWidth=ve(d),u}function Fst(s,t){if(!s)return;const{size:e}=_t({},t,s),i={};return i.width=ve(e),i}class Ks{static isInstance(t){return!!t&&t.type===Ks.type}setOption(t){this._option=t,Object.values(this.children).forEach(e=>e.setOption(t))}getParentEl(){return Ks.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=Ks.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach(t=>t.initAll())}setStyle(t){this.product&&t&&Object.keys(t).forEach(e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])})}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach(i=>i.setVisibility(t))}getVisibility(){var t,e;return!!(!((e=(t=this.product)===null||t===void 0?void 0:t.style)===null||e===void 0)&&e.visibility)&&this.product.style.visibility!=="hidden"}release(){var t;if(Object.values(this.children).forEach(e=>e.release()),this.children={},this.product){try{(t=this.getParentEl())===null||t===void 0||t.removeChild(this.product)}catch{}this.product=null}}createElement(t,e,i,n){const r=Kr==null?void 0:Kr.createElement(t),a=this.getParentEl();if(!r||!a)return;e&&r.classList.add(...e),i&&Object.keys(i).forEach(l=>{r.style[l]=i[l]}),n&&(r.id=n);let o=this.childIndex;if(Ks.isInstance(this.parent)){let l=Number.MAX_VALUE;for(let h=0;h<a.children.length;h++){const d=Object.values(this.parent.children).find(u=>u.product===a.children[h]);d.childIndex>this.childIndex&&d.childIndex<l&&(l=d.childIndex,o=h)}}return o>=a.children.length?a.appendChild(r):a.insertBefore(r,a.children[o]),r}}Ks.type="tooltipModel";const jst={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},zst={boxSizing:"border-box"},Hst={display:"flex",whiteSpace:"nowrap"},Gst={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},Wst={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},Nst={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},Vst={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},Ust={lineHeight:"normal"};class dI extends Ks{init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=Yst(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}const $st={star:"M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"};function Yst(s,t){var e,i,n,r,a,o,l;if(!(s!=null&&s.hasShape)||!s.symbolType)return"";const{symbolType:h,fill:d,stroke:u,hollow:c=!1}=s,p=s.size?t(s.size):"8px",g=s.marginTop?t(s.marginTop):"0px",f=s.lineWidth?t(s.lineWidth)+"px":"0px";let _="currentColor";const m=()=>u?t(u):_,v=Bst(p),y=T=>new nu({symbolType:T,size:v,fill:!0});let b=y((e=$st[h])!==null&&e!==void 0?e:h);const x=b.getParsedPath();x.path||(b=y(x.pathStr));const S=b.getParsedPath().path,A=S.toString(),k=S.bounds;let w=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if(f!=="0px"){const[T,M,P,O]=w.split(" ").map(R=>Number(R)),D=Number(f.slice(0,-2));w=`${T-D/2} ${M-D/2} ${P+D} ${O+D}`}if(!d||ot(d)||c)return _=c?"none":d?t(d):"currentColor",`
- <svg width="${p}" height="${p}" viewBox="${w}"
- style="display: inline-block; vertical-align: middle; margin-top: ${g};">
- <path
- d="${A}"
- style="fill: ${_}; stroke: ${m()}; stroke-width: ${f}"
- >
- </path>
- </svg>`;if(Vt(d)){_=(i="gradientColor"+s.index)!==null&&i!==void 0?i:"";let T="";const M=((n=d.stops)!==null&&n!==void 0?n:[]).map(P=>`<stop offset="${t(P.offset.toString())}" stop-color="${t(P.color)}"/>`).join("");return d.gradient==="radial"?T=`<radialGradient id="${_}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">
- ${M}
- </radialGradient>`:d.gradient==="linear"&&(T=`<linearGradient id="${_}" x1="${100*((r=d.x0)!==null&&r!==void 0?r:0)}%" y1="${100*((a=d.y0)!==null&&a!==void 0?a:0)}%" x2="${100*((o=d.x1)!==null&&o!==void 0?o:0)}%" y2="${100*((l=d.y1)!==null&&l!==void 0?l:0)}%">
- ${M}
- </linearGradient>`),`
- <svg width="${p}" height="${p}" viewBox="-0.5 -0.5 1 1"
- style="display: inline-block; vertical-align: middle; margin-top: ${g};">
- ${T}
- <path
- d="${A}"
- style="fill: url(#${_}); stroke: ${m()}; stroke-width: ${f}"
- >
- </path>
- </svg>`}return""}class uI extends Ks{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll(`
- `,"<br>")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const yC={overflowWrap:"normal",wordWrap:"normal"};class $v extends Ks{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=(e=(t=this._option.getTooltipActual())===null||t===void 0?void 0:t.content)!==null&&e!==void 0?e:[];if(this.className!=="shape-box"||i.some(n=>n.hasShape&&n.shapeType)){Object.keys(this.children).forEach(n=>{const r=zn(n);r>=i.length&&(this.children[r].release(),delete this.children[r])});for(let n=0;n<i.length;n++)if(!this.children[n]){if(this.className==="key-box"||this.className==="value-box"){const r=new uI(this.product,this._option,n);r.init([this.className.substring(0,this.className.indexOf("-"))],void 0,"div"),this.children[n]=r}else if(this.className==="shape-box"){const r=new dI(this.product,this._option,n);r.init(["shape"],void 0,"div"),this.children[n]=r}}}else Object.keys(this.children).forEach(n=>{const r=zn(n);this.children[r].release(),delete this.children[r]})}setStyle(){var t,e,i,n;const r=this._option.getTooltipStyle();super.setStyle(_t({},Gst,r.content,this._getContentColumnStyle()));const a=(e=(t=this._option.getTooltipActual())===null||t===void 0?void 0:t.content)!==null&&e!==void 0?e:[],o=(n=(i=this._option.getTooltipAttributes())===null||i===void 0?void 0:i.content)!==null&&n!==void 0?n:[];a.forEach((l,h)=>{var d,u,c,p,g;let f={};if(this.className==="key-box"){const{key:_,isKeyAdaptive:m}=l;f=_t({},m?Nst:Wst,Object.assign(Object.assign(Object.assign({height:ve(o[h].height)},yC),r.keyColumn.common),(d=r.keyColumn.items)===null||d===void 0?void 0:d[h])),ot(_)&&((u=_==null?void 0:_.trim)===null||u===void 0?void 0:u.call(_))!==""||lt(_)||f.visibility?f.visibility="visible":f.visibility="hidden",this.children[h].setStyle(f)}else this.className==="value-box"?(f=_t({},Vst,Object.assign(Object.assign(Object.assign({height:ve(o[h].height)},yC),r.valueColumn.common),(c=r.valueColumn.items)===null||c===void 0?void 0:c[h])),this.children[h].setStyle(f)):this.className==="shape-box"&&(f=_t({},Ust,Object.assign(Object.assign({height:ve(o[h].height+o[h].spaceRow)},r.shapeColumn.common),(p=r.shapeColumn.items)===null||p===void 0?void 0:p[h])),(g=this.children[h])===null||g===void 0||g.setStyle(f,this._getShapeSvgOption(l,h)))})}setContent(){var t,e,i,n;const r=(e=(t=this._option.getTooltipActual())===null||t===void 0?void 0:t.content)!==null&&e!==void 0?e:[],a=(n=(i=this._option.getTooltipAttributes())===null||i===void 0?void 0:i.content)!==null&&n!==void 0?n:[];r.forEach((o,l)=>{var h,d,u,c,p,g,f;let _;if(this.className==="key-box"){const m=o.key;_=ot(m)&&((h=m==null?void 0:m.trim)===null||h===void 0?void 0:h.call(m))!==""||lt(m)?m:fC,(d=this.children[l])===null||d===void 0||d.setContent(_,(u=a[l].key)===null||u===void 0?void 0:u.multiLine)}else if(this.className==="value-box"){const m=o.value;_=ot(m)&&((c=m==null?void 0:m.trim)===null||c===void 0?void 0:c.call(m))!==""||lt(m)?m:fC,(p=this.children[l])===null||p===void 0||p.setContent(_,(g=a[l].value)===null||g===void 0?void 0:g.multiLine)}else this.className==="shape-box"&&(_=this._getShapeSvgOption(o,l),(f=this.children[l])===null||f===void 0||f.setContent(_))})}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=(e=(t=this._option.getTooltipActual())===null||t===void 0?void 0:t.content)!==null&&e!==void 0?e:[];return Object.assign(Object.assign({},i.shapeColumn),this.className!=="shape-box"||n.some(r=>r.hasShape&&r.shapeType)?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n,r,a,o,l;const h=this._option.getTooltipStyle(),d=Object.assign(Object.assign({},h.shapeColumn),(i=h.shapeColumn.items)===null||i===void 0?void 0:i[e]),u=Object.assign(Object.assign({},h.keyColumn),(n=h.keyColumn.items)===null||n===void 0?void 0:n[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:d.width,fill:(r=t.shapeFill)!==null&&r!==void 0?r:t.shapeColor,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,marginTop:`calc((${(o=(a=u.lineHeight)!==null&&a!==void 0?a:u.fontSize)!==null&&o!==void 0?o:"18px"} - ${(l=d.width)!==null&&l!==void 0?l:"8px"}) / 2)`,index:e}}}class Xst extends Ks{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new $v(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new $v(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new $v(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(_t({},Hst,t)),Object.values(this.children).forEach(e=>{e.setStyle()})}setContent(){Object.values(this.children).forEach(t=>{t.setContent()})}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class Kst extends Ks{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e!=null&&e.hasShape&&(e!=null&&e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new dI(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new uI(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),{title:l}=o;super.setStyle(_t({},jst,a.title,t)),(e=this.shape)===null||e===void 0||e.setStyle({paddingRight:(i=a.shapeColumn.common)===null||i===void 0?void 0:i.marginRight},{hasShape:l==null?void 0:l.hasShape,symbolType:l==null?void 0:l.shapeType,size:(n=a.shapeColumn.common)===null||n===void 0?void 0:n.width,fill:l==null?void 0:l.shapeColor,hollow:l==null?void 0:l.shapeHollow}),(r=this.textSpan)===null||r===void 0||r.setStyle({color:"inherit"})}setContent(){var t,e,i,n,r,a;const o=this._option.getTooltipStyle(),l=this._option.getTooltipActual(),h=this._option.getTooltipAttributes(),{title:d}=l;this.init(),(t=this.shape)===null||t===void 0||t.setStyle(void 0,{hasShape:d==null?void 0:d.hasShape,symbolType:d==null?void 0:d.shapeType,size:(e=o.shapeColumn.common)===null||e===void 0?void 0:e.width,fill:d==null?void 0:d.shapeColor,hollow:d==null?void 0:d.shapeHollow}),(i=this.textSpan)===null||i===void 0||i.setStyle({color:"inherit"}),(n=this.textSpan)===null||n===void 0||n.setContent(d==null?void 0:d.value,(a=(r=h.title)===null||r===void 0?void 0:r.value)===null||a===void 0?void 0:a.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class qst extends Ks{constructor(t,e,i,n){super(t,e,0),this.title=null,this.content=null,this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;(i==null?void 0:i.visible)!==!1&&E(i==null?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle(),((t=e.content)!==null&&t!==void 0?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new Kst(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new Xst(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(_t({},zst,t.panel)),Object.values(this.children).forEach(e=>e.setStyle())}setContent(){Object.values(this.children).forEach(t=>{t.setContent()})}release(){super.release(),this.title=null,this.content=null}}class Zst extends hI{getVisibility(){var t;return!!(!((t=this.model)===null||t===void 0)&&t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&((e=this.model)===null||e===void 0||e.setVisibility(t))}constructor(t,e){super(t,e),this.type=t_.dom,this._tooltipContainer=Kr==null?void 0:Kr.body,this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(Kr&&e){for(let i=0;i<e.children.length;i++)if(e.children[i].classList.contains(gC)){this._container=e.children[i];break}this._container||(this._container=Kr.createElement("div"),this._container.style.position="relative",this._container.classList.add(gC),e.appendChild(this._container)),this.model=new qst(this._container,{valueToHtml:this._option.sanitize,getTooltipStyle:()=>this._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes},[t.className],this.id)}}_removeTooltip(){var t;(t=this.model)===null||t===void 0||t.release(),this._container=null}_updateTooltip(t,e,i){var n,r;if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);let{x:a=0,y:o=0}=(n=i.position)!==null&&n!==void 0?n:{};const l=this.model.product;if(l){if(!((r=this._cacheViewSpec)===null||r===void 0)&&r.updateElement){this._cacheViewSpec.updateElement(l,i,e);const h=this._getActualTooltipPosition(i,e,{width:l.offsetWidth,height:l.offsetHeight});a=h.x,o=h.y}l.style.transform=`translate3d(${a}px, ${o}px, 0)`}}else this.setVisibility(t)}_initStyle(){this._domStyle=Ist(this._attributes)}_getParentElement(t){var e;return(e=this._container)!==null&&e!==void 0?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class Jst extends hI{constructor(t,e){var i;super(t,e),this.type=t_.canvas,this._tooltipCanvasId=(i=this._chartOption.modeParams)===null||i===void 0?void 0:i.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new jO({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(n);const r=i==null?void 0:i.position;e.changePositionOnly?E(r)&&this._tooltipComponent.setAttributes(r):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),r)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return(t=this._tooltipComponent)===null||t===void 0?void 0:t.attribute.visibleAll}release(){var t;super.release(),(t=this._layer)===null||t===void 0||t.release()}}const Ir=(s,t)=>E(t)?s.map(e=>t[e]):void 0,tr=(s,t)=>e=>s.every((i,n)=>e[i]===(t==null?void 0:t[n])),Na=s=>!C(s)&&(U(s)?s.length>0&&s.every(E):Object.keys(s).length>0);function Qst(s,t,e,i){var n,r,a,o,l;const h=Object.assign({regionIndex:0},t),d=i.getRegionsInUserIdOrIndex(E(h.regionId)?[h.regionId]:void 0,E(h.regionIndex)?[h.regionIndex]:void 0)[0];if(!d)return"none";const u=d.getSeries(),c=[];u.forEach(b=>{var x,S,A,k,w,T,M,P;const O=b.getDimensionField(),D=b.getMeasureField(),R=b.getSeriesField(),L=E(R)?s[R]:void 0,B=E(R)&&(k=(A=(S=(x=b.getViewDataStatistics)===null||x===void 0?void 0:x.call(b))===null||S===void 0?void 0:S.latestData[R])===null||A===void 0?void 0:A.values)!==null&&k!==void 0?k:[],F=Ir(O,s);let z=Ir(D,s);const N=Na(z),V=!N&&E(R)&&C(L)&&B.length>0;if(b.coordinate==="cartesian"){const G=b,X=O.map((et,K)=>[et,K]).filter(([,et])=>C(F==null?void 0:F[et]));let Z=[F??[]];X.length>0&&X.forEach(([et,K])=>{var W,it,ht,dt;const Rt=(dt=(ht=(it=(W=b.getViewDataStatistics)===null||W===void 0?void 0:W.call(b))===null||it===void 0?void 0:it.latestData[et])===null||ht===void 0?void 0:ht.values)!==null&&dt!==void 0?dt:[],gt=[];Z.forEach(wt=>{Rt.forEach(kt=>{var Lt;const Ot=(Lt=wt==null?void 0:wt.slice())!==null&&Lt!==void 0?Lt:[];Ot[K]=kt,gt.push(Ot)})}),Z=gt}),Z.forEach(et=>{var K,W;if(V){const it=(K=G.getViewData())===null||K===void 0?void 0:K.latestData.filter(tr(O,et));B.forEach(ht=>{const dt=it.find(gt=>gt[R]===ht);if(z=Ir(D,dt),!Na(z))return;const Rt=G.dataToPosition(dt);C(Rt)||isNaN(Rt.x)||isNaN(Rt.y)||c.push({pos:Rt,data:{dimensionFields:O,dimensionData:et,measureFields:D,measureData:z,hasMeasureData:N,groupField:R,groupData:ht},series:b})})}else{const it=(W=G.getViewData())===null||W===void 0?void 0:W.latestData.find(tr(O,et));if(!N&&(z=Ir(D,it),!Na(z)))return;const ht=G.dataToPosition(it);if(C(ht)||isNaN(ht.x)||isNaN(ht.y))return;c.push({pos:ht,data:{dimensionFields:O,dimensionData:et,measureFields:D,measureData:z,hasMeasureData:N,groupField:R,groupData:L},series:b})}})}else if(b.coordinate==="polar")if(b.type===j.pie){const G=b,X=(w=G.getViewData())===null||w===void 0?void 0:w.latestData.find(tr(O,F));if(!N&&(z=Ir(D,X),!Na(z)))return;const Z=G.dataToCentralPosition(X);if(C(Z)||isNaN(Z.x)||isNaN(Z.y))return;c.push({pos:Z,data:{dimensionFields:O,dimensionData:F,measureFields:D,measureData:z,hasMeasureData:N,groupField:R,groupData:L},series:b})}else{const G=b;if(V){const X=((T=G.getViewData())===null||T===void 0?void 0:T.latestData.filter(tr(O,F))).find(Z=>Z[R]===L);B.forEach(Z=>{if(z=Ir(D,X),!Na(z))return;const et=G.dataToPosition(X);C(et)||isNaN(et.x)||isNaN(et.y)||c.push({pos:et,data:{dimensionFields:O,dimensionData:F,measureFields:D,measureData:z,hasMeasureData:N,groupField:R,groupData:Z},series:b})})}else{const X=(M=G.getViewData())===null||M===void 0?void 0:M.latestData.find(tr(O,F));if(!N&&(z=Ir(D,X),!Na(z)))return;const Z=G.dataToPosition(X);if(C(Z)||isNaN(Z.x)||isNaN(Z.y))return;c.push({pos:Z,data:{dimensionFields:O,dimensionData:F,measureFields:D,measureData:z,hasMeasureData:N,groupField:R,groupData:L},series:b})}}else if(b.coordinate==="geo"){const G=b,X=(P=G.getViewData())===null||P===void 0?void 0:P.latestData.find(tr(O,F));if(!N&&(z=Ir(D,X),!Na(z)))return;const Z=G.dataToPosition(X);if(C(Z)||isNaN(Z.x)||isNaN(Z.y))return;c.push({pos:Z,data:{dimensionFields:O,dimensionData:F,measureFields:D,measureData:z,hasMeasureData:N,groupField:R,groupData:L},series:b})}});const p=(n=h.activeType)!==null&&n!==void 0?n:c.length>1?"dimension":"mark",g=d.getLayoutStartPoint(),f=d.getLayoutRect(),_=i.globalInstance.getContainer(),m=Object.assign({x:0,y:0},_?_F(_):{}),v=b=>{var x;const{dimensionFields:S,dimensionData:A,measureFields:k,measureData:w,groupField:T,groupData:M}=b.data;return(x=b.series.getViewData())===null||x===void 0?void 0:x.latestData.find(O=>tr(S,A)(O)&&tr(k,w)(O)&&(C(T)||tr([T],[M])(O)))},y=b=>{var x,S;const A=(T=>({x:Math.min(Math.max(T.x,0),f.width),y:Math.min(Math.max(T.y,0),f.height)}))(b),k=(x=h.x)!==null&&x!==void 0?x:g.x+A.x,w=(S=h.y)!==null&&S!==void 0?S:g.y+A.y;return{canvasX:k,canvasY:w,clientX:m.x+k,clientY:m.y+w}};if(p==="dimension"){const b=c[0];if(!b)return"none";const x=new Map;c.forEach(w=>{var T;x.has(w.series)||x.set(w.series,[]),(T=x.get(w.series))===null||T===void 0||T.push(w)});const S=[{value:s[b.data.dimensionFields[0]],data:[...x.keys()].map(w=>{var T,M;return{series:w,datum:(M=(T=x.get(w))===null||T===void 0?void 0:T.map(P=>v(P)))!==null&&M!==void 0?M:[]}})}],A={changePositionOnly:!1,dimensionInfo:S,chart:(r=i.globalInstance.getChart())!==null&&r!==void 0?r:void 0,datum:void 0,model:void 0,source:Jt.chart,event:y({x:c.reduce((w,T)=>w+T.pos.x,0)/c.length,y:c.reduce((w,T)=>w+T.pos.y,0)/c.length}),item:void 0,itemMap:new Map};(a=e==null?void 0:e.showTooltip)===null||a===void 0||a.call(e,p,S,A);const k=i.globalInstance;return Mi.globalConfig.uniqueTooltip&&Mi.hideTooltip(k.id),p}if(p==="mark"){const b=c[0];if(!b)return"none";const x=Object.assign(Object.assign({},v(b)),s),S={changePositionOnly:!1,chart:(o=i.globalInstance.getChart())!==null&&o!==void 0?o:void 0,datum:x,model:b.series,source:Jt.chart,event:y(b.pos),item:void 0,itemMap:new Map};(l=e==null?void 0:e.showTooltip)===null||l===void 0||l.call(e,p,[{datum:[x],series:b.series}],S);const A=i.globalInstance;return Mi.globalConfig.uniqueTooltip&&Mi.hideTooltip(A.id),p}return"none"}class cI{constructor(t){this._showTooltipByHandler=(e,i)=>{var n,r;return this.component.event.emit(bt.tooltipShow,Object.assign(Object.assign({},i),{tooltipData:e,activeType:this.activeType,tooltip:this.component})),!((n=this.component.tooltipHandler)===null||n===void 0)&&n.showTooltip&&E(e)?(r=this.component.tooltipHandler.showTooltip(this.activeType,e,i))!==null&&r!==void 0?r:ei.success:ei.failed},this.component=t}_preprocessDimensionInfo(t){const e=[];if(t==null||t.forEach(i=>{const n=Object.assign(Object.assign({},i),{data:i.data.filter(({series:r})=>{var a,o;return((o=(a=r.getSpec())===null||a===void 0?void 0:a.tooltip)===null||o===void 0?void 0:o.visible)!==!1})});n.data.length>0&&e.push(n)}),e.length>0)return e}_getDimensionInfo(t){var e,i;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=[...(e=hL(r,o))!==null&&e!==void 0?e:[],...(i=rL(r,o))!==null&&i!==void 0?i:[]],n.length===0)n=void 0;else if(n.length>1){const l=n.filter(h=>{var d;const u=h.axis;if(!Pi(u.getScale().type))return!1;let c;for(const p of(d=u==null?void 0:u.getRegions())!==null&&d!==void 0?d:[]){for(const g of p.getSeries())if(g.coordinate==="cartesian"){c=g;break}if(E(c))break}return E(c)&&c.getDimensionField()[0]===c.fieldY[0]?u.getOrient()==="left"||u.getOrient()==="right":u.getOrient()==="bottom"||u.getOrient()==="top"});n=l.length?l:n.slice(0,1)}return n}}class tnt extends cI{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:r}=e;if(C(r))return!1;const a=(i=t.model)===null||i===void 0?void 0:i.tooltipHelper;return!!((n=a==null?void 0:a.activeType)!==null&&n!==void 0?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...(e=this.component.getOption().getAllSeries())!==null&&e!==void 0?e:[]].some(i=>{var n;const r=(n=i.tooltipHelper)===null||n===void 0?void 0:n.ignoreTriggerSet.dimension;return t.model&&(r==null?void 0:r.has(t.model))||t.mark&&(r==null?void 0:r.has(t.mark))})}}}const bC=s=>E(s)&&!U(s),Yv=s=>E(s)&&U(s);class ent extends cI{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:r,dimensionInfo:a}=t,o=[{datum:[n],series:r}],l=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(a),changePositionOnly:i});return this._showTooltipByHandler(o,l)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(C(n))return!1;const r=(i=t.model)===null||i===void 0?void 0:i.tooltipHelper;return!!(r!=null&&r.activeType.includes("mark"))}getMouseEventData(t){var e;let i,n;if(((e=t.model)===null||e===void 0?void 0:e.modelType)==="series"){const r=t.model,a=r.tooltipHelper,o=a==null?void 0:a.activeTriggerSet.mark,l=a==null?void 0:a.ignoreTriggerSet.mark;o!=null&&o.has(t.model)||o!=null&&o.has(t.mark)?i={mark:t.mark,datum:t.datum,series:r,dimensionInfo:this._getDimensionInfo(t)}:(l!=null&&l.has(t.model)||l!=null&&l.has(t.mark))&&(n=!0)}return{tooltipInfo:i,ignore:n}}}class pI extends xc{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:n}=super._initTheme(t,e);return i.style=_t({},this._theme,i.style),{spec:i,theme:n}}}class Ud extends ds{constructor(){super(...arguments),this.layoutZIndex=1,this.type=J.tooltip,this.name=J.tooltip,this.transformerConstructor=pI,this.specKey="tooltip",this.layoutType="none",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._getMouseOutHandler=t=>e=>{var i,n;if(this._alwaysShow||!this._isTooltipShown&&!(!((n=(i=this.tooltipHandler)===null||i===void 0?void 0:i.isTooltipShown)===null||n===void 0)&&n.call(i)))return;const r=Xs(this._option.mode),{clientX:a,clientY:o}=e.event;r&&this._isPointerOnTooltip(e)||r&&t&&this._isPointerInChart({x:a,y:o})||this._handleChartMouseOut(e)},this._handleChartMouseOut=t=>{this._alwaysShow||this._spec.triggerOff!=="none"&&(this._hideTooltipByHandler(Object.assign({},t)),this._cacheInfo=void 0)},this._handleMouseMove=t=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow||this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:r}}=e;let a=!1,o=!1;a=this._showTooltipByMouseEvent("mark",e,t),a||(o=this._showTooltipByMouseEvent("dimension",e,t)),a||o||bZ(t)||(n&&bC(this._cacheInfo)?a=this._showTooltipByMouseEvent("mark",e,t,!0):r&&Yv(this._cacheInfo)?o=this._showTooltipByMouseEvent("dimension",e,t,!0):E(i)&&(o=this._showTooltipByMouseEvent("dimension",e,t))),a||o&&!C(i)||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n)=>{const r=this._processor[t];if(!r.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let a;if(n)a=!r.showTooltip(this._cacheInfo,i,!0);else{const l=e.tooltipInfo[t],h=this._isSameAsCacheInfo(l);a=!r.showTooltip(l,i,h),a&&(this._cacheInfo=l)}a&&(this._isTooltipShown=!0);const o=this._option.globalInstance;return a&&Mi.globalConfig.uniqueTooltip&&Mi.hideTooltip(o.id),a},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach(i=>{const{tooltipInfo:n,ignore:r}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=r}),e},this._hideTooltipByHandler=t=>{var e,i,n;if(!this._isTooltipShown&&!(!((i=(e=this.tooltipHandler)===null||e===void 0?void 0:e.isTooltipShown)===null||i===void 0)&&i.call(e)))return ei.success;if(this.event.emit(bt.tooltipHide,Object.assign(Object.assign({},t),{source:Jt.chart,tooltip:this})),(n=this.tooltipHandler)===null||n===void 0?void 0:n.hideTooltip){const r=this.tooltipHandler.hideTooltip(t);return r||(this._isTooltipShown=!1),r}return ei.failed}}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;if(!U(e))return[{spec:e,specPath:[this.specKey],type:J.tooltip}];const i=[];return e.forEach((n,r)=>{i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.tooltip})}),i}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._eventList.forEach(({eventType:i,handler:n})=>{this.event.off(i,n)}),this._eventList=[],(e=(t=this.tooltipHandler)===null||t===void 0?void 0:t.release)===null||e===void 0||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(bt.tooltipHide,{tooltip:this}),this.event.emit(bt.tooltipRelease,{tooltip:this})}_initHandler(){var t,e,i;const n=(t=this._spec.renderMode)!==null&&t!==void 0?t:"html",r=this._option.globalInstance.getTooltipHandlerByUser();if(r)this.tooltipHandler=r;else{const a=n==="canvas"?Jst:Zst,o=`${this._spec.className}-${(e=this._option.globalInstance.id)!==null&&e!==void 0?e:0}-${(i=this._option.specIndex)!==null&&i!==void 0?i:0}`;this.tooltipHandler=new a(o,this)}}_initProcessor(){this._processor={mark:new ent(this),dimension:new tnt(this)}}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=(t=this._spec.trigger)!==null&&t!==void 0?t:"hover",i=this._option.mode;e==="hover"?(this._mountEvent("pointermove",{level:Yt.chart},this._handleMouseMove),(Aa(i)||ka(i))&&(this._mountEvent("pointerdown",{level:Yt.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerout",{source:"canvas"},this._getMouseOutHandler(!1))):e==="click"&&(this._mountEvent("pointertap",{level:Yt.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0)))}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?(i=(e=this.tooltipHandler).reInit)===null||i===void 0||i.call(e):this._initHandler()}setAttrFromSpec(){var t;super.setAttrFromSpec();const e=this._spec;this._spec=Object.assign(Object.assign({},e),{visible:!E(e.visible)||e.visible,activeType:ia(e),renderMode:"html",trigger:E(e.trigger)?e.trigger:"hover",className:E(e.className)?e.className:wst,enterable:!!E(e.enterable)&&e.enterable,transitionDuration:E(e.transitionDuration)?e.transitionDuration:150}),this._spec.triggerOff=E(e.triggerOff)?e.triggerOff:this._spec.trigger,E(e.renderMode)?this._spec.renderMode=e.renderMode:ka(this._option.mode)&&(this._spec.renderMode="canvas"),E(e.mark)&&(this._spec.mark=Object.assign(Object.assign({},hi(e.mark)),{activeType:"mark"})),E(e.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},hi(e.dimension)),{activeType:"dimension"})),E(e.parentElement)?ot(e.parentElement)?this._spec.parentElement=(t=globalThis==null?void 0:globalThis.document)===null||t===void 0?void 0:t.getElementById(e.parentElement):this._spec.parentElement=e.parentElement:Xs(this._option.mode)&&(this._spec.parentElement=Kr==null?void 0:Kr.body),E(e.confine)?this._spec.confine=e.confine:this._spec.confine=this._spec.renderMode==="canvas"}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),!(!((i=this.tooltipHandler)===null||i===void 0)&&i.showTooltip))return!1;const n=Qst(t,e,this.tooltipHandler,this._option);return n!=="none"&&(this._alwaysShow=!!(e!=null&&e.alwaysShow)),n}hideTooltip(){const t={changePositionOnly:!1,item:void 0,datum:void 0,source:Jt.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(C(this._cacheInfo)||C(t))return!1;if(Yv(t)){if(bC(this._cacheInfo))return!1;const i=this._cacheInfo;return i.length===t.length&&t.every((n,r)=>nL(n,i[r]))}if(Yv(this._cacheInfo))return!1;const e=this._cacheInfo;return(t==null?void 0:t.datum)===e.datum&&(t==null?void 0:t.mark)===e.mark&&(t==null?void 0:t.series)===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,r=e.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return i>=a&&i<=a+l&&n>=o&&n<=o+h}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&this._spec.renderMode==="html"){const{event:n}=t;let r;if(E(n.nativeEvent)){const o=n.nativeEvent;r=o.relatedTarget,o.composedPath&&o.composedPath().length>0&&(r=o.composedPath()[0])}else r=n.relatedTarget;const a=(i=(e=this.tooltipHandler)===null||e===void 0?void 0:e.getTooltipContainer)===null||i===void 0?void 0:i.call(e);if(E(a)&&E(r)&&mF(r,a))return!0}return!1}getVisible(){return this._spec.visible!==!1}}Ud.type=J.tooltip,Ud.transformerConstructor=pI,Ud.specKey="tooltip";const int=()=>{I.registerComponent(Ud.type,Ud)};function snt(s){return s===Ze["desktop-browser"]||s===Ze["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Aa(s)||ka(s)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}var xC;(function(s){s[s.ALL=3]="ALL",s[s.HORIZONTAL=2]="HORIZONTAL",s[s.VERTICAL=1]="VERTICAL",s[s.NONE=0]="NONE"})(xC||(xC={}));var SC=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};const nnt={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class CS extends ds{get enableRemain(){return this.triggerOff==="none"}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=he.CrossHair_Grid,this.labelZIndex=he.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=Ea(i=>{if(!this._option)return;const{event:n}=i,r=this._option.getCompiler().getStage().getLayer(void 0),a={x:n.viewX,y:n.viewY};r.globalTransMatrix.transformPoint({x:n.viewX,y:n.viewY},a);const o=a.x-this.getLayoutStartPoint().x,l=a.y-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(o,l)},10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=(e=(t=this._option.globalInstance.getChart())===null||t===void 0?void 0:t.getCanvasRect())!==null&&e!==void 0?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||_e(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(this._option.disableTriggerEvent)return;const t=this._getTriggerEvent();if(t){const{in:e,out:i}=t;Y(e).forEach((n,r)=>this._registerEvent(n,U(i)?i[r]:i))}}_registerEvent(t,e){this.event.on(t,{source:Jt.chart},this._handleEvent),this.event.on(e,{level:Yt.chart},(...i)=>{this.enableRemain||this.hide()})}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:t=Ze["desktop-browser"]}=this._option,e=snt(t);if(e){const i=this.trigger||"hover",n=r=>r==="click"?"clickOut":"hoverOut";if(U(i)){let r=[],a=[];return i.forEach(o=>{r=r.concat(e[o]),a=a.concat(e[n(o)])}),{in:r,out:a}}return{in:e[i],out:e[n(i)]}}return null}_getAxisInfoByField(t){var e,i;const n=(i=(e=this._option)===null||e===void 0?void 0:e.getComponentsByKey)===null||i===void 0?void 0:i.call(e,"axes");if(!(n!=null&&n.length))return null;let r=Et(this._spec,`${t}Field.bindingAxesIndex`);if(r||(r=[],n.forEach((p,g)=>{nnt[t].includes(p.getOrient())&&r.push(g)})),!r.length)return null;const a=new Map;let o=1/0,l=1/0,h=-1/0,d=-1/0;const{x:u,y:c}=this.getLayoutStartPoint();return r.forEach(p=>{o=1/0,l=1/0,h=-1/0,d=-1/0;const g=n.find(f=>f.getSpecIndex()===p);g&&(g.getRegions().forEach(f=>{const{x:_,y:m}=f.getLayoutStartPoint();o=Math.min(o,_-u),l=Math.min(l,m-c),h=Math.max(h,_+f.getLayoutRect().width-u),d=Math.max(d,m+f.getLayoutRect().height-c)}),a.set(p,{x1:o,y1:l,x2:h,y2:d,axis:g}))}),a}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){const t=this._getTriggerEvent();if(t){const{in:e,out:i}=t;U(e)?e.forEach(n=>this._eventOff(n)):this._eventOff(e),U(i)?i.forEach(n=>this._eventOff(n)):this._eventOff(i)}}_firstSeries(){for(let t=0;t<this._regions.length;t++){const e=this._regions[t].getSeries();for(let i=0;i<e.length;i++){const n=e[i];if(n)return n}}return null}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:n}=this._spec;t&&(this.trigger=t),this.triggerOff=e||this.trigger,i!==void 0&&(this.labelZIndex=i),n!==void 0&&(this.gridZIndex=n)}_parseField(t,e){var i,n,r,a;const o={},{line:l={},label:h={},visible:d}=t;o.visible=d,o.type=l.type||"line";const u=l.style||{},{strokeOpacity:c,fillOpacity:p,opacity:g,stroke:f,fill:_,lineWidth:m}=u,v=SC(u,["strokeOpacity","fillOpacity","opacity","stroke","fill","lineWidth"]),y=o.type==="line";let b=y?c:p;if(lt(g)&&(b=(b??1)*g),o.style=(l==null?void 0:l.visible)===!1?{visible:!1}:Object.assign({opacity:b,pickable:!1,visible:!0},v),y)o.style.stroke=f||_,o.style.lineWidth=Et(l,"width",m||2);else{o.style.fill=_||f,!((r=(n=(i=this._spec[e])===null||i===void 0?void 0:i.line)===null||n===void 0?void 0:n.style)===null||r===void 0)&&r.stroke&&(o.style.stroke=this._spec[e].line.style.stroke);const P=Et(l,"width");if(typeof P=="string"){const O=parseInt(P.substring(0,P.length-1),10)/100;o.style.sizePercent=O}else typeof P!="number"&&typeof P!="function"||(o.style.size=P)}const x=h.labelBackground||{},S=h.style||{},A=x.style||{},{fill:k="rgba(47, 59, 82, 0.9)",stroke:w,outerBorder:T}=A,M=SC(A,["fill","stroke","outerBorder"]);return o.label=h!=null&&h.visible?{visible:!0,formatMethod:h.formatMethod,minWidth:x.minWidth,maxWidth:x.maxWidth,padding:x.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},S),{fill:(a=S.fill)!==null&&a!==void 0?a:"#fff",stroke:Et(S,"stroke")}),panel:(pe(x==null?void 0:x.visible)?x!=null&&x.visible:x)?Object.assign({visible:!0,pickable:!1,fill:k,stroke:w,outerBorder:Object.assign({stroke:k,distance:0,lineWidth:3},T)},M):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}:{visible:!1},o}_filterAxisByPoint(t,e,i){return t&&t.forEach(n=>{const r=n.axis;if(RV(n,e,i)&&t.delete(r.getSpecIndex()),r.type.startsWith("polarAxis")){const a=r.getCenter(),o=r.getInnerRadius(),l=r.getOuterRadius(),h=Ee.distancePP({x:e,y:i},a);(h>l||h<o)&&t.delete(r.getSpecIndex())}}),t}}CS.specKey="crosshair";class e_ extends CS{static getSpecInfo(t){const e=t[this.specKey];if(C(e))return;if(!U(e))return e.xField||e.yField?[{spec:e,specPath:[this.specKey],type:J.cartesianCrosshair}]:void 0;const i=[];return e.forEach((n,r)=>{(n.xField||n.yField)&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.cartesianCrosshair})}),i}constructor(t,e){super(t,e),this.type=J.cartesianCrosshair,this.name=J.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if(t!=null&&t.visible&&t.defaultSelect){const{axisIndex:i,datum:n}=t.defaultSelect;this._defaultCrosshair(i,n,1)}if(e!=null&&e.visible&&e.defaultSelect){const{axisIndex:i,datum:n}=e.defaultSelect;this._defaultCrosshair(i,n,2)}}_defaultCrosshair(t,e,i){const n=this._option.getComponentsByKey("axes").find(r=>r.getSpecIndex()===t);n&&(i===1?(this._currValueX.clear(),this._currValueX.set(t,{axis:n,v:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:n,v:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}_getValueAt(t,e){let i=t.getScale().invert(e);return Kt(t.getScale().type)&&H(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){Ce(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{v:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{v:t,axis:e})}_getAllAxisValues(t,e,i,n){let r=!1;return t.forEach(a=>{Pi(a.axis.getScale().type)&&(r?this.enable=!1:r=!0)}),!!this.enable&&(t.forEach((a,o)=>{const l=a.axis;i.set(o,{v:this._getValueAt(l,e-(n?l.getLayoutStartPoint().x-this.getLayoutStartPoint().x:l.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:l})}),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this._findAllAxisContains(t,e);if(i&&i.size===0||n&&n.size===0){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),i&&i.size&&this._getAllAxisValues(i,t,this._currValueX,!0),n&&n.size&&this._getAllAxisValues(n,e,this._currValueY,!1),this.layoutByValue(3)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=3){var e,i,n,r;if(!this.enable)return;const a=this._firstSeries();if(!a)return;let o={height:0,leftPos:0,rightPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1,axis:null},l={width:0,leftPos:0,topPos:0,bottomPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1,axis:null};const h=(v,y)=>{y.forEach(({axis:b})=>{b.getRegions().forEach(x=>{v.x1=Math.min(v.x1,x.getLayoutStartPoint().x),v.y1=Math.min(v.y1,x.getLayoutStartPoint().y),v.x2=Math.max(v.x2,x.getLayoutStartPoint().x+x.getLayoutRect().width),v.y2=Math.max(v.y2,x.getLayoutStartPoint().y+x.getLayoutRect().height)})})};let d=0,u=0;if(this._currValueX.size){const v=Array.from(this._currValueX.values())[0];d=v.axis.getScale().scale(v.v)+v.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x,o.axis=v.axis}if(this._currValueY.size){const v=Array.from(this._currValueY.values())[0];u=v.axis.getScale().scale(v.v)+v.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y,l.axis=v.axis}o.visible=!!this._currValueX.size&&Number.isFinite(d),l.visible=!!this._currValueY.size&&Number.isFinite(u);const c={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},p={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let g;h(c,this._currValueX),h(p,this._currValueY);let f,_=0,m=0;if(this._xHair&&this._currValueX.forEach(({axis:v,v:y})=>{var b;y=y??"";const x=v.getScale();if(Pi(x.type))g=x.bandwidth(),g===0&&x.step&&(_=x.step());else if(Kt(x.type)){const S=a.fieldX[0],A=a.fieldX2,k=kM(a.getViewData().latestData,+y,S,A);if(k){const w=a.dataToPositionX(k);A?(g=Math.abs(w-a.dataToPositionX1(k)),y=`${k[S]} ~ ${k[A]}`):g=1,d=w}}if(!((b=this._xHair.label)===null||b===void 0)&&b.visible){const S=Du(v.getSpec());v.getOrient()==="bottom"?(o.bottom.visible=!0,o.bottom.text=y,o.bottom.dx=0,o.bottom.dy=S):v.getOrient()==="top"&&(o.top.visible=!0,o.top.text=y,o.top.dx=0,o.top.dy=-S)}}),this._yHair&&this._currValueY.forEach(({axis:v,v:y})=>{var b;y=y??"";const x=v.getScale();if(Pi(x.type))f=x.bandwidth(),f===0&&x.step&&(m=x.step());else if(Kt(x.type)){const S=a.fieldY[0],A=a.fieldY2,k=kM(a.getViewData().latestData,+y,S,A);if(k){const w=a.dataToPositionY(k);A?(f=Math.abs(w-a.dataToPositionY1(k)),y=`${k[S]} ~ ${k[A]}`):f=1,u=w}}if(!((b=this._yHair.label)===null||b===void 0)&&b.visible){const S=Du(v.getSpec());v.getOrient()==="left"?(l.left.visible=!0,l.left.text=y,l.left.dx=-S,l.left.dy=0):v.getOrient()==="right"&&(l.right.visible=!0,l.right.text=y,l.right.dx=S,l.right.dy=0)}}),this.enableRemain&&!o.visible&&E(this._cacheXCrossHairInfo))o=this._cacheXCrossHairInfo;else if(o.leftPos=c.x1,o.rightPos=c.x2,o.topPos=c.y1,o.height=c.y2-c.y1,o.x=d+this.getLayoutStartPoint().x,(i=(e=this._xHair)===null||e===void 0?void 0:e.label)===null||i===void 0?void 0:i.formatMethod){const{top:v,bottom:y}=o;y.visible&&(y.text=this._xHair.label.formatMethod(y.text,"bottom")),v.visible&&(v.text=this._xHair.label.formatMethod(v.text,"top"))}if(this.enableRemain&&!l.visible&&E(this._cacheYCrossHairInfo))l=this._cacheYCrossHairInfo;else if(l.leftPos=p.x1,l.topPos=p.y1,l.bottomPos=p.y2,l.width=p.x2-p.x1,l.y=u+this.getLayoutStartPoint().y,(r=(n=this._yHair)===null||n===void 0?void 0:n.label)===null||r===void 0?void 0:r.formatMethod){const{left:v,right:y}=l;v.visible&&(v.text=this._yHair.label.formatMethod(v.text,"left")),y.visible&&(y.text=this._yHair.label.formatMethod(y.text,"right"))}t&&(this._layoutHorizontal(l,f??0,m),this._layoutVertical(o,g??0,_)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},l),{_isCache:!0}))}_layoutVertical(t,e,i){var n,r;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:a,topPos:o,height:l,top:h,bottom:d,visible:u}=t;if(u){const c=this._xHair.type;let p;if(c==="line")p={start:{x:a+e/2,y:o},end:{x:a+e/2,y:o+l}};else if(c==="rect"){const g=this._getRectSize(this._xHair,e,t.axis),{leftPos:f,rightPos:_}=t;p={start:{x:Math.max(a-g/2-i/2,f),y:o},end:{x:Math.min(a+e+g/2+i/2,_),y:o+l}}}if(this._updateCrosshair("x",c,p),h.visible){const g=Object.assign(Object.assign(Object.assign({x:a+e/2,y:o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},(n=this._xHair.label)===null||n===void 0?void 0:n.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,g,f=>{f.name="crosshair-x-top-label",this._xTopLabel=f})}else this._xTopLabel&&this._xTopLabel.hideAll();if(d.visible){const g=Object.assign(Object.assign(Object.assign({x:a+e/2,y:o+l},d),this._xHair.label),{textStyle:Object.assign(Object.assign({},(r=this._xHair.label)===null||r===void 0?void 0:r.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,g,f=>{f.name="crosshair-x-bottom-label",this._xBottomLabel=f})}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var n,r;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:a,width:o,y:l,left:h,right:d,visible:u}=t;if(u){const c=this._yHair.type;let p;if(c==="line")p={start:{x:a,y:l+e/2},end:{x:a+o,y:l+e/2}};else if(c==="rect"){const g=this._getRectSize(this._yHair,e,t.axis),{topPos:f,bottomPos:_}=t;p={start:{x:a,y:Math.max(l-g/2-i/2,f)},end:{x:a+o,y:Math.min(l+e+g/2+i/2,_)}}}if(this._updateCrosshair("y",c,p),h.visible){const g=Object.assign(Object.assign(Object.assign({x:a,y:l+e/2},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},(n=this._yHair.label)===null||n===void 0?void 0:n.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,g,f=>{f.name="crosshair-y-left-label",this._yLeftLabel=f})}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(d.visible){const g=Object.assign(Object.assign(Object.assign({x:a+o,y:l+e},d),this._yHair.label),{textStyle:Object.assign(Object.assign({},(r=this._yHair.label)===null||r===void 0?void 0:r.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,g,f=>{f.name="crosshair-y-right-label",this._yRightLabel=f})}else this._yRightLabel&&this._yRightLabel.hideAll()}}_getRectSize(t,e,i){var n,r,a;let o=0;if(!((n=t.style)===null||n===void 0)&&n.sizePercent)o=(t.style.sizePercent-1)*e;else if(typeof((r=t.style)===null||r===void 0?void 0:r.size)=="number")o=t.style.size-e;else if(typeof((a=t.style)===null||a===void 0?void 0:a.size)=="function"){const l=i.getLayoutRect();o=t.style.size(l,i)-e}return o}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;t&&t.visible&&(this._xHair=this._parseField(t,"xField")),e&&e.visible&&(this._yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let r,a;t==="x"?(r=this._xCrosshair,a=this._xHair.style):(r=this._yCrosshair,a=this._yHair.style),r?r.setAttributes(i):(e==="line"?r=new pc(Object.assign(Object.assign({},i),{lineStyle:a,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent})):e==="rect"&&(r=new X_(Object.assign(Object.assign({},i),{rectStyle:a,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent}))),n==null||n.add(r),t==="x"?this._xCrosshair=r:this._yCrosshair=r)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new kn(e)),n==null||n.add(t)),YL(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}e_.specKey="crosshair",e_.type=J.cartesianCrosshair;const rnt=()=>{I.registerComponent(e_.type,e_)};var AC=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};class i_ extends CS{static getSpecInfo(t){const e=t[this.specKey];if(C(e))return;if(!U(e))return e.categoryField||e.valueField?[{spec:e,specPath:[this.specKey],type:J.polarCrosshair}]:void 0;const i=[];return e.forEach((n,r)=>{(n.categoryField||n.valueField)&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.polarCrosshair})}),i}constructor(t,e){super(t,e),this.type=J.polarCrosshair,this.name=J.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if(t!=null&&t.visible&&t.defaultSelect){const{axisIndex:i,datum:n}=t.defaultSelect;this._defaultCrosshair(i,n,1)}if(e!=null&&e.visible&&e.defaultSelect){const{axisIndex:i,datum:n}=e.defaultSelect;this._defaultCrosshair(i,n,2)}}_defaultCrosshair(t,e,i){const n=this._option.getComponentsByKey("axes").find(r=>r.getSpecIndex()===t);if(n){if(i===1){this._currValueAngle.clear();const r={angle:n.valueToPosition(e),radius:n.getOuterRadius()},a=n.coordToPoint(r);this._currValueAngle.set(t,this._getValueByAxis(n,a))}else{this._currValueRadius.clear();const r={angle:n.startAngle,radius:n.valueToPosition(e)},a=n.coordToPoint(r);this._currValueRadius.set(t,this._getValueByAxis(n,a))}this.layoutByValue(3)}}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(n,t,e)}}_getAllAxisValues(t,e,i){let n=!1;return t.forEach(r=>{Pi(r.axis.getScale().type)&&(n?this.enable=!1:n=!0)}),!!this.enable&&(t.forEach((r,a)=>{const o=r.axis;i.set(a,this._getValueByAxis(o,e))}),!0)}_getValueByAxis(t,e){const{x:i,y:n}=t.getLayoutStartPoint(),{x:r,y:a}=this.getLayoutStartPoint();let o=t.positionToData({x:e.x-(i-r),y:e.y-(n-a)});Kt(t.getScale().type)&&H(+o)&&(o=(+o).toFixed(2));const l={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{v:o,axis:t,center:l,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Ee.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e){const{angleAxisMap:i,radiusAxisMap:n}=this._findAllAxisContains(t,e);if(i.size!==0||n.size!==0)this._currValueAngle.clear(),this._currValueRadius.clear(),i&&this._getAllAxisValues(i,{x:t,y:e},this._currValueAngle),n&&this._getAllAxisValues(n,{x:t,y:e},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){var e,i,n,r;if(!this.enable)return;const a=this._firstSeries();if(!a)return;let o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},l={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:a.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this._angleHair){o.visible=!!this._currValueAngle.size;const h=a.angleAxisHelper.getBandwidth(0);this._currValueAngle.forEach(d=>{var u,{axis:c,v:p,coord:g}=d,f=AC(d,["axis","v","coord"]);p=p??"",_t(o,f);const _=a.angleAxisHelper.dataToPosition([p]);o.angle=_,!((u=this._angleHair.label)===null||u===void 0)&&u.visible&&(o.label.visible=!0,o.label.text=p,o.label.offset=Du(c.getSpec())),o.startAngle=_-h/2,o.endAngle=_+h/2})}if(this._radiusHair&&(l.visible=!!this._currValueRadius.size,this._currValueRadius.forEach(h=>{var d,{axis:u,v:c,coord:p}=h,g=AC(h,["axis","v","coord"]);c=c??"",!((d=this._radiusHair.label)===null||d===void 0)&&d.visible&&(l.label.visible=!0,l.label.text=c,l.label.offset=Du(u.getSpec())),l.angle=p.angle,l.axis=u,_t(l,g)})),this.enableRemain&&!o.visible&&E(this._cacheAngleCrossHairInfo))o=this._cacheAngleCrossHairInfo;else if(!((i=(e=this._angleHair)===null||e===void 0?void 0:e.label)===null||i===void 0)&&i.formatMethod&&o.label.visible){const{label:h}=o;h.text=this._angleHair.label.formatMethod(h.text,"angle")}if(this.enableRemain&&!l.visible&&E(this._cacheRadiusCrossHairInfo))l=this._cacheRadiusCrossHairInfo;else if(!((r=(n=this._radiusHair)===null||n===void 0?void 0:n.label)===null||r===void 0)&&r.formatMethod&&l.label.visible){const{label:h}=l;h.text=this._radiusHair.label.formatMethod(h.text,"radius")}t&&(this._layoutHorizontal(l),this._layoutVertical(o)),this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},l),{_isCache:!0}))}_layoutVertical(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:n,innerRadius:r,radius:a,label:o,startAngle:l,endAngle:h,center:d,visible:u}=t;if(u){const c=this._angleHair.type==="rect"?"sector":"line";let p;if(p=c==="sector"?{center:d,innerRadius:r,radius:a,startAngle:l,endAngle:h}:{start:ln(d,r,n),end:ln(d,a,n)},this._angleCrosshair)this._angleCrosshair.setAttributes(p);else{let g;c==="line"?g=new pc(Object.assign(Object.assign({},p),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex})):c==="sector"&&(g=new q_(Object.assign(Object.assign({},p),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=g,i.add(g)}if(o.visible){const g=OR(n),f=Object.assign(Object.assign(Object.assign(Object.assign({},ln(d,a+o.offset,n)),this._angleHair.label),o),{textStyle:Object.assign(Object.assign({},(e=this._angleHair.label)===null||e===void 0?void 0:e.textStyle),{textAlign:g.align,textBaseline:g.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,f,_=>{_.name="crosshair-angle-label",this._angleLabelCrosshair=_})}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:n,endAngle:r,distance:a,sides:o,axis:l,label:h,point:d,radius:u,innerRadius:c,visible:p}=t,g=this.getContainer();if(p){const f=this._radiusHair.smooth?"circle":"polygon";let _=a;if(f==="polygon"){const v=l.getCenter(),y=Np(v,d),b=(r-n)/o,x=Math.floor((y-n)/b),S=x*b+n,A=Math.min((x+1)*b+n,r),k=ln(v,a,S),w=ln(v,a,A),T=aP([w.x,w.y],[k.x,k.y],[v.x,v.y],[d.x,d.y]);T&&(_=di(Ee.distancePN(d,T[0],T[1])+a,c,u))}const m={center:i,startAngle:n,endAngle:r,radius:_,sides:o};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(m);else{let v;v=f==="polygon"?new Z_(Object.assign(Object.assign({},m),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new K_(Object.assign(Object.assign({},m),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=v,g.add(v)}if(h.visible){const v=BV(n),y=Object.assign(Object.assign(Object.assign(Object.assign({},ln(i,_,n)),this._radiusHair.label),h),{textStyle:Object.assign(Object.assign({},(e=this._radiusHair.label)===null||e===void 0?void 0:e.textStyle),{textAlign:v.align,textBaseline:v.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,y,b=>{b.name="crosshair-radius-label",this._radiusLabelCrosshair=b})}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=(t=i==null?void 0:i.line)===null||t===void 0?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new kn(e),n==null||n.add(t),i(t)),YL(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}i_.specKey="crosshair",i_.type=J.polarCrosshair;const ant=()=>{I.registerComponent(i_.type,i_)};class PS extends ds{get orient(){return this._orient}setStartAndEnd(t,e,i=["percent","percent"]){const[n="percent",r="percent"]=i,a=n==="percent"?t:this._dataToStatePoint(t),o=r==="percent"?e:this._dataToStatePoint(e);this._handleChange(a,o,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:t==null?void 0:t.x,zoomY:t==null?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:t==null?void 0:t.x,zoomY:t==null?void 0:t.y})}_handleChange(t,e,i){var n,r;(r=(n=this._spec)===null||n===void 0?void 0:n.zoomLock)!==null&&r!==void 0&&r||e-t<this._minSpan||this._maxSpan}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t,e){const i=this._relatedAxisComponent.getScale(),n=this._isReverse(),r=n?[1-this._end,1-this._start]:[this._start,this._end];if(n)switch(t){case"startHandler":i.rangeFactorEnd(r[1]);break;case"endHandler":i.rangeFactorStart(r[0]);break;default:i.rangeFactorStart(r[0],!0),i.rangeFactorEnd(r[1])}else switch(t){case"startHandler":i.rangeFactorStart(r[0]);break;case"endHandler":i.rangeFactorEnd(r[1]);break;default:i.rangeFactorEnd(r[1],!0),i.rangeFactorStart(r[0])}const a=i.rangeFactor();a?(this._start=n?1-a[1]:a[0],this._end=n?1-a[0]:a[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._stateField="x",this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.effect={onZoomChange:i=>{var n,r;const a=this._relatedAxisComponent;if(a&&this._filterMode==="axis"){const o=a.getScale(),l=a.getSpec();this._auto&&this._getAxisBandSize(l)&&this._spec.ignoreBandSize&&(o.bandwidth("auto"),o.maxBandwidth("auto"),o.minBandwidth("auto")),this._updateRangeFactor(i,"zoomChange"),(r=(n=this._component)===null||n===void 0?void 0:n.setStartAndEnd)===null||r===void 0||r.call(n,this._start,this._end),a.effect.scaleUpdate()}else Te(this._regions,o=>{var l;(l=o.getViewData())===null||l===void 0||l.markRunning()},{userId:this._seriesUserId,specIndex:this._seriesIndex}),Te(this._regions,o=>{o.reFilterViewData()},{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(i,n,r)=>{var a,o;return this._startValue=i,this._endValue=n,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),(o=(a=this.effect).onZoomChange)===null||o===void 0||o.call(a,r),!0},this._handleChartZoom=i=>{var n,r;if(!this._activeRoam)return;const{zoomDelta:a,zoomX:o,zoomY:l}=i,{x:h,y:d}=this._regions[0].getLayoutStartPoint(),{width:u,height:c}=this._regions[0].getLayoutRect(),p=Math.abs(this._start-this._end),g=(r=(n=this._spec.roamZoom)===null||n===void 0?void 0:n.rate)!==null&&r!==void 0?r:1;if(p>=1&&a<1||p<=.01&&a>1)return;const f=this._isHorizontal?o:l,_=p*(a-1)*g;let m=_/2,v=_/2;if(f){const x=this._isHorizontal?h:d,S=this._isHorizontal?u:c;m=Math.abs(x-f)/Math.abs(S-x)*_,v=Math.abs(S-f)/Math.abs(S-x)*_}const y=di(this._start+m,0,1),b=di(this._end-v,0,1);this._handleChange(Math.min(y,b),Math.max(y,b),!0)},this._handleChartScroll=(i,n)=>{var r;if(!this._activeRoam)return!1;const{scrollX:a,scrollY:o}=i;let l=this._isHorizontal?a:o;const h=this._isHorizontal?Xt(a/o)>=.5:Xt(o/a)>=.5;return this._scrollAttr.reverse||(l=-l),h&&this._handleChartMove(l,(r=this._scrollAttr.rate)!==null&&r!==void 0?r:1),h},this._handleChartDrag=(i,n)=>{var r;if(!this._activeRoam)return;const[a,o]=i;let l=this._isHorizontal?a:o;this._dragAttr.reverse&&(l=-l),this._handleChartMove(l,(r=this._dragAttr.rate)!==null&&r!==void 0?r:1)},this._handleChartMove=(i,n)=>{const r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(i)>=1e-6){if(i>0&&this._end<1){const a=Math.min(1-this._end,i/r)*n;this._handleChange(this._start+a,this._end+a,!0)}else if(i<0&&this._start>0){const a=Math.max(-this._start,i/r)*n;this._handleChange(this._start+a,this._end+a,!0)}}},this._orient=Gr(t),this._isHorizontal=aL(this._orient)==="horizontal"}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}_setAxisFromSpec(){if(E(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):E(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),C(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find(i=>i._orient===this._orient);if(e)this._relatedAxisComponent=e;else{const i=t.find(n=>!Kt(n.getScale().type));this._relatedAxisComponent=i}}this._relatedAxisComponent&&this._filterMode==="axis"&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?(e=(t=this._relatedAxisComponent).getBindSeriesFilter)===null||e===void 0?void 0:e.call(t):null;if(E(i)&&(E(i.userId)&&(this._seriesUserId=Y(i.userId)),E(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),E(this._spec.seriesId)){const n=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter(r=>n.includes(r)):this._seriesUserId=n}if(E(this._spec.seriesIndex)){const n=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter(r=>n.includes(r)):this._seriesIndex=n}if(E(this._spec.regionIndex)){const n=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter(r=>n.includes(r))}else if(E(this._spec.regionId)){const n=Y(this._spec.regionId);this._regions=n.length?this._regions.filter(r=>n.includes(r.id)):[]}}onDataUpdate(){const t=this._computeDomainOfStateScale(Kt(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map(i=>i[this._stateField]);if(t){const i=e.map(n=>1*n);return e.length?[pi(i),Ye(i)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const a={};Te(this._regions,o=>{var l,h;const d=o.coordinate==="cartesian"?o.getXAxisHelper():o.coordinate==="polar"?o.angleAxisHelper:null,u=o.coordinate==="cartesian"?o.getYAxisHelper():o.coordinate==="polar"?o.radiusAxisHelper:null;if(!d||!u)return;const c=d.getAxisId()===this._relatedAxisComponent.id?d:u.getAxisId()===this._relatedAxisComponent.id?u:this._isHorizontal?d:u,p=c===d?u:d,g=Kt(p.getScale(0).type);t.push(o.getRawData());const f=o.getSpec(),_=Y(f.xField),m=Y(f.yField),v=o.coordinate==="cartesian"?_[0]:(l=f.angleField)!==null&&l!==void 0?l:f.categoryField,y=o.coordinate==="cartesian"?m[0]:(h=f.radiusField)!==null&&h!==void 0?h:f.valueField;if(a[o.id]=o.type==="link"?"from_xField":c===d?v:y,e.push(a[o.id]),this._valueField){const b=o.type==="link"?"from_yField":p===d?v:y;i.push(g?b:null)}},{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=a}else C(this._spec.valueField),Te(this._regions,a=>{t.push(a.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)},{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;mr(n,"dataview",A_),Mt(n,"dataFilterComputeDomain",xJ);const r=new Zt(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Cr(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._spec.roamZoom===!0||this._spec.roamZoom?this._zoomAttr=at({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,this._spec.roamDrag===!0||this._spec.roamDrag?this._dragAttr=at({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,this._spec.roamScroll===!0||this._spec.roamScroll?this._scrollAttr=at({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=(t=this._spec.visible)===null||t===void 0||t}_statePointToData(t){const e=this._stateScale;let i=e.range();this._isReverse()&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&Kt(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return t==="start"?e==="percent"&&this._spec.start||e==="value"&&this._spec.startValue:e==="percent"&&this._spec.end||e==="value"&&this._spec.endValue}_setStateFromSpec(){var t,e;let i,n;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[r,a]=this._spec.rangeMode;this._modeCheck("start",r)&&this._modeCheck("end",a)&&(i=r==="percent"?this._spec.start:this._dataToStatePoint(this._spec.startValue),n=a==="percent"?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else i=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,n=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(i),this._endValue=this._statePointToData(n),this._start=i,this._end=n,this._minSpan=(t=this._spec.minSpan)!==null&&t!==void 0?t:0,this._maxSpan=(e=this._spec.maxSpan)!==null&&e!==void 0?e:1,Kt(this._stateScale.type)&&this._stateScale.domain[0]!==this._stateScale.domain[1]&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(this._stateScale.domain()[1]-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&this._filterMode==="axis"||this._start===0&&this._end===1||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return(e=this._originalStateFields)===null||e===void 0?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=Kt(e.type),n=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const r=n.map(a=>1*a);this._stateScale.domain(n.length?[pi(r),Ye(r)]:[0,1],!0).range(t)}else this._stateScale.domain(n,!0).range(t)}else this._stateScale=new Ao,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),this._start===0&&this._end===1||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&this._filterMode==="axis"||(Mt(this._option.dataSet,"dataFilterWithNewDomain",bJ),Te(this._regions,t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return(e=this._field)!==null&&e!==void 0?e:this._parseFieldOfSeries(t)},isContinuous:()=>Kt(this._stateScale.type)},level:Es.dataZoomFilter})},{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||_e(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach(e=>{e.getMarks().forEach(i=>{this.initMarkStyleWithSpec(i,this._spec[i.name])})})}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(Kt(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),r=i.indexOf(e);return i.slice(Math.min(n,r),Math.max(n,r)+1)}_initCommonEvent(){var t,e,i,n,r,a,o;const l={delayType:(e=(t=this._spec)===null||t===void 0?void 0:t.delayType)!==null&&e!==void 0?e:"throttle",delayTime:E((i=this._spec)===null||i===void 0?void 0:i.delayType)?(r=(n=this._spec)===null||n===void 0?void 0:n.delayTime)!==null&&r!==void 0?r:30:0,realTime:(o=(a=this._spec)===null||a===void 0?void 0:a.realTime)===null||o===void 0||o};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const n=this._autoUpdate(t),r=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[r]:n?this[`_${r}`]:0},{[r]:Q.Built_In})}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;(t=this._component)===null||t===void 0||t.hideAll()}show(){var t;(t=this._component)===null||t===void 0||t.showAll()}_getAxisBandSize(t){const e=t==null?void 0:t.bandSize,i=t==null?void 0:t.maxBandSize,n=t==null?void 0:t.minBandSize;if(e||n||i)return{bandSize:e,maxBandSize:i,minBandSize:n}}_autoUpdate(t){var e,i,n,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=l==null?void 0:l.getSpec(),d=l==null?void 0:l.getScale(),u=this._getAxisBandSize(h);if(Pi(d.type)&&(t==null?void 0:t.height)===((e=this._cacheRect)===null||e===void 0?void 0:e.height)&&(t==null?void 0:t.width)===((i=this._cacheRect)===null||i===void 0?void 0:i.width)&&this._fixedBandSize===(u==null?void 0:u.bandSize))return this._cacheVisibility;let c=!0;if(this._isHorizontal&&(t==null?void 0:t.width)!==((n=this._cacheRect)===null||n===void 0?void 0:n.width)?d.range(l.getInverse()?[t.width,0]:[0,t.width]):(t==null?void 0:t.height)!==((r=this._cacheRect)===null||r===void 0?void 0:r.height)&&d.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:t==null?void 0:t.width,height:t==null?void 0:t.height},this._fixedBandSize=u==null?void 0:u.bandSize,Pi(d.type)){u&&(this._start||this._end)&&this._updateRangeFactor(null,"auto");const[p,g]=(a=d.rangeFactor())!==null&&a!==void 0?a:[];c=(!C(p)||!C(g))&&!(p===0&&g===1)}else{const[p,g]=(o=d.rangeFactor())!==null&&o!==void 0?o:[this._start,this._end];c=!(p===0&&g===1)}return this.setStartAndEnd(this._start,this._end),c?this.show():this.hide(),this._cacheVisibility=c,c}_getNeedClearVRenderComponents(){return[this._component]}}ci(PS,pS);class gI extends xc{_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const r=o=>{const l=_t({selectedBackgroundChart:{line:{},area:{}}},this._theme,o),{selectedBackgroundChart:h={}}=o,{line:d,area:u}=h;return d&&d.visible!==!1&&(l.selectedBackgroundChart.line.style=Object.assign(Object.assign({},l.selectedBackgroundChart.line.style),{visible:!0})),u&&u.visible!==!1&&(l.selectedBackgroundChart.area.style=Object.assign(Object.assign({},l.selectedBackgroundChart.area.style),{visible:!0})),l},a=t;n=U(a)?a.map(o=>r(o)):r(a)}return this._adjustPadding(n),{spec:n,theme:i}}}class $d extends PS{static getSpecInfo(t){const e=t[this.specKey];if(C(e))return;if(!U(e))return[{spec:e,specPath:[this.specKey],type:J.dataZoom}];const i=[];return e.forEach((n,r)=>{i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.dataZoom})}),i}constructor(t,e){var i;super(t,e),this.type=J.dataZoom,this.name=J.dataZoom,this.transformerConstructor=gI,this.specKey="dataZoom",this.layoutZIndex=he.DataZoom,this.layoutLevel=xn.DataZoom,this.layoutType="region-relative",this._dataToPositionX=n=>{const r=this._orient==="left"?this._middleHandlerSize:0,a=this._isHorizontal?this._startHandlerSize/2:0,o=this._isHorizontal?this._stateScale:this._valueScale,l=this._isHorizontal?this._stateField:this._valueField;return o.scale(n[l])+this.getLayoutStartPoint().x+r+a},this._dataToPositionX2=n=>{const r=this._orient==="left"?this._middleHandlerSize:0,a=this._isHorizontal?this._startHandlerSize/2:0,o=this._isHorizontal?this._stateScale:this._valueScale,l=o.domain()[0];return o.scale(l)+this.getLayoutStartPoint().x+r+a},this._dataToPositionY=n=>{const r=this._isHorizontal?this._middleHandlerSize:0,a=this._isHorizontal?0:this._startHandlerSize/2,o=this._isHorizontal?this._valueScale:this._stateScale,l=this._isHorizontal?this._valueField:this._stateField;return o.scale(n[l])+this.getLayoutStartPoint().y+r+a},this._dataToPositionY2=n=>{const r=this._isHorizontal?this._middleHandlerSize:0,a=this._isHorizontal?0:this._startHandlerSize/2,o=this._isHorizontal?this._valueScale:this._stateScale,l=o.domain()[0];return o.scale(l)+this.getLayoutStartPoint().y+r+a},this._valueField="y",this._filterMode=(i=t.filterMode)!==null&&i!==void 0?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,n,r,a,o,l,h,d;super.setAttrFromSpec(),pe(this._spec.roam)&&(this._zoomAttr.enable=this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode),this._backgroundSize=(e=(t=this._spec.background)===null||t===void 0?void 0:t.size)!==null&&e!==void 0?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),C((r=(n=(i=this._spec)===null||i===void 0?void 0:i.startHandler)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),C((l=(o=(a=this._spec)===null||a===void 0?void 0:a.endHandler)===null||o===void 0?void 0:o.style)===null||l===void 0?void 0:l.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const u=(h=this._spec.startHandler.style.visible)===null||h===void 0||h,c=(d=this._spec.endHandler.style.visible)===null||d===void 0||d;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=c?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._cacheVisibility!==!1&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new Qs;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=(this._startHandlerSize+this._endHandlerSize)/2;if(!this._stateScale||!this._valueScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,a=(e=(t=this._relatedAxisComponent)===null||t===void 0?void 0:t.getScale().range())!==null&&e!==void 0?e:[0,r];this._isHorizontal?(n=this._visible?[0,this._computeWidth()-i]:a,this._stateScale.range(n),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):this.layoutOrient==="left"?(n=this._visible?[0,this._computeHeight()-i]:a,this._stateScale.range(n),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(n=this._visible?[0,this._computeHeight()-i]:a,this._stateScale.range(n),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._cacheVisibility!==!1&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map(i=>i[this._valueField]),e=t.map(i=>1*i);return t.length?[pi(e),Ye(e)]:null}_computeMiddleHandlerSize(){var t,e,i,n;let r=0;if(!((e=(t=this._spec)===null||t===void 0?void 0:t.middleHandler)===null||e===void 0)&&e.visible){const a=(i=this._spec.middleHandler.icon.style.size)!==null&&i!==void 0?i:8,o=(n=this._spec.middleHandler.background.size)!==null&&n!==void 0?n:40;r+=Math.max(a,o)}return r}_computeWidth(){return this._visible===!1?0:lt(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return this._visible===!1?0:lt(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Kt(t.type)||e[0]!==e[1])&&(!Pi(t.type)||N2(e).length!==1)}_getAttrs(t){var e,i,n,r,a;const o=(e=this._spec)!==null&&e!==void 0?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:o.showDetail,brushSelect:(i=o.brushSelect)!==null&&i!==void 0&&i,zoomLock:(n=o.zoomLock)!==null&&n!==void 0&&n,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:o.delayType,delayTime:E(o.delayType)?(r=o.delayTime)!==null&&r!==void 0?r:30:0,realTime:(a=o.realTime)===null||a===void 0||a,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY},this._getComponentAttrs())}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e),n=this._getAttrs(i);if(this._component)this._component.setAttributes(n);else{const r=this.getContainer();this._component=new mO(n),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData(a=>this._statePointToData(a)),this._component.addEventListener("change",a=>{const{start:o,end:l,tag:h}=a.detail;this._handleChange(o,l,void 0,h)}),r.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,n){super._handleChange(t,e,i),i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e,this._handleStateChange(this._statePointToData(t),this._statePointToData(e),n)&&this.event.emit(bt.dataZoomChange,{model:this,value:{filterData:this._filterMode!=="axis",start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),(t=this._component)===null||t===void 0||t.setPreviewData(e.latestData),this._valueScale){const i=this._computeDomainOfValueScale();i&&this._valueScale.domain(i)}}_getComponentAttrs(){var t,e,i,n,r,a,o,l,h,d,u;const{middleHandler:c={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:_={}}=this._spec;return{backgroundStyle:At((t=this._spec.background)===null||t===void 0?void 0:t.style),startHandlerStyle:At((e=this._spec.startHandler)===null||e===void 0?void 0:e.style),middleHandlerStyle:c.visible?{visible:!0,icon:At((i=c.icon)===null||i===void 0?void 0:i.style),background:{size:(n=c.background)===null||n===void 0?void 0:n.size,style:At((r=c.background)===null||r===void 0?void 0:r.style)}}:{visible:!1},endHandlerStyle:At((a=this._spec.endHandler)===null||a===void 0?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:p.formatMethod,textStyle:At(p.style)},endTextStyle:{padding:g.padding,formatMethod:g.formatMethod,textStyle:At(g.style)},selectedBackgroundStyle:At(this._spec.selectedBackground.style),dragMaskStyle:At((o=this._spec.dragMask)===null||o===void 0?void 0:o.style),backgroundChartStyle:{line:_t(At((l=f.line)===null||l===void 0?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},At((h=f.area)===null||h===void 0?void 0:h.style))},selectedBackgroundChartStyle:{line:_t(At((d=_.line)===null||d===void 0?void 0:d.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},At((u=_.area)===null||u===void 0?void 0:u.style))},disableTriggerEvent:this._option.disableTriggerEvent}}_getNeedClearVRenderComponents(){return[this._component]}}$d.type=J.dataZoom,$d.transformerConstructor=gI,$d.specKey="dataZoom";const ont=()=>{I.registerComponent($d.type,$d)};class s_ extends PS{static getSpecInfo(t){const e=t[this.specKey];if(C(e))return;if(!U(e))return[{spec:e,specPath:[this.specKey],type:J.scrollBar}];const i=[];return e.forEach((n,r)=>{i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.scrollBar})}),i}constructor(t,e){var i;super(t,e),this.type=J.scrollBar,this.name=J.scrollBar,this.specKey="scrollBar",this.layoutZIndex=he.DataZoom,this.layoutLevel=xn.DataZoom,this.layoutType="region-relative",this._filterMode=(i=t.filterMode)!==null&&i!==void 0?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),pe(this._spec.roam)&&(this._zoomAttr.enable=!1,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.event,this._option.mode)}onLayoutEnd(t){var e,i;this._updateScaleRange(),(i=(e=this.effect).onZoomChange)===null||i===void 0||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return lt(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:xb}_computeHeight(){return lt(this._spec.height)?this._spec.height:this._isHorizontal?xb:this.getLayoutRect().height}_getAttrs(){var t,e,i,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:(t=this._spec)===null||t===void 0?void 0:t.delayType,delayTime:E((e=this._spec)===null||e===void 0?void 0:e.delayType)?(n=(i=this._spec)===null||i===void 0?void 0:i.delayTime)!==null&&n!==void 0?n:30:0,realTime:(a=(r=this._spec)===null||r===void 0?void 0:r.realTime)===null||a===void 0||a},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new ZR(t),this._component.addEventListener("scroll",i=>{const n=i.detail.value;this._handleChange(n[0],n[1])}),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i),i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e,this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(bt.scrollBarChange,{model:this,value:{filterData:this._filterMode!=="axis",start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scroll",t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return C(i)||(n.padding=i),ft(t==null?void 0:t.style)||(n.railStyle=At(t.style)),ft(e==null?void 0:e.style)||(n.sliderStyle=At(e.style)),n.disableTriggerEvent=this._option.disableTriggerEvent,n}_getNeedClearVRenderComponents(){return[this._component]}}s_.type=J.scrollBar,s_.specKey="scrollBar";const lnt=()=>{I.registerComponent(s_.type,s_)},hnt=(s,t)=>{const{datum:e,title:i,content:n}=t,r=[],a=e.call(null);return i.visible&&r.push({type:"title",index:0,datum:a,spec:i}),Y(n).forEach((o,l)=>{o.visible&&r.push({type:"content",index:l,datum:a,spec:o})}),r};class bh extends ds{constructor(){super(...arguments),this.type=J.indicator,this.name=J.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=he.Indicator,this.layoutLevel=xn.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){if(this.type!==bh.type)return null;const e=t[this.specKey];if(!U(e))return e.visible===!1?[]:[{spec:e,specPath:[this.specKey],type:J.indicator}];const i=[];return e.forEach((n,r)=>{n&&n.visible!==!1&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.indicator})}),i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){this._option.disableTriggerEvent||this._spec.trigger!=="none"&&(this._spec.trigger==="hover"?(this.event.on("hovered",t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])}),this.event.on("unhovered",t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)})):(this.event.on("selected",t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])}),this.event.on("unselected",t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)})))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){Mt(this._option.dataSet,"indicatorFilter",hnt);const t=new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new Cr(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=[];return Y(this._spec.content).forEach(o=>{const l=_t({},this._theme.content,o);a.push({visible:l.visible!==!1&&(!l.field||this._activeDatum!==null),space:l.space||this._gap,autoLimit:l.autoLimit,autoFit:l.autoFit,fitPercent:l.fitPercent,style:Object.assign(Object.assign({},At(l.style)),{text:this._createText(l.field,l.style.text)})})}),{visible:this._spec.visible!==!1&&(this._spec.fixed!==!1||this._activeDatum!==null),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:r,dx:this._spec.offsetX?rl(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?rl(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:this._spec.title.visible!==!1&&(!E(this._spec.title.field)||this._activeDatum!==null),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},At(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:a}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)_e(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new M6(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",(n,r)=>this._delegateEvent(this._indicatorComponent,n,r))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":q(e)?(i=e(this._activeDatum,void 0))!==null&&i!==void 0?i:"":e??""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return Te(this._regions,e=>t===e)||this._regions.includes(t)}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}}bh.type=J.indicator,bh.specKey="indicator";const dnt=()=>{I.registerComponent(bh.type,bh)},unt=(s,t)=>{const e=s[0].latestData;return IR(e,t.field)},cnt=(s,t)=>{const e=s[0].latestData;return Mx(e,t.field)};function pnt(s,t){const e=s[0].latestData;return FR(e,t.field)}function gnt(s,t){const e=s[0].latestData;return jR(e,t.field)}function fnt(s,t){const e=s[0].latestData;return zR(e,t.field)}function _nt(s,t){const e=s[0].latestData;return OV(e,t.field)}function mnt(s,t){const e=s[0].latestData;return DV(e,t.field)}function ES(s,t){const e=[];return t.forEach(i=>{const n={x:null,y:null};if(E(i.x)){const r=i.x;U(r)?n.x=r.map(a=>Sp(a,s,i)):n.x=Sp(r,s,i)}if(E(i.y)){const r=i.y;U(r)?n.y=r.map(a=>Sp(a,s,i)):n.y=Sp(r,s,i)}i.getRefRelativeSeries&&(n.getRefRelativeSeries=i.getRefRelativeSeries),e.push(n)}),e}const vnt={min:unt,max:cnt,sum:pnt,average:gnt,variance:fnt,standardDeviation:_nt,median:mnt};function Sp(s,t,e){const i=e.getRelativeSeries(),n=e.getStartRelativeSeries(),r=e.getEndRelativeSeries(),a=i.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(q(s))return s(a,o,l,i,n,r);if(vn(s)){const{aggrType:h,field:d}=s;return vnt[h](t,{field:d})}return s}const ynt=["sum","average","min","max","variance","standardDeviation","median"];var bnt=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};function n_(s,t,e){if(!e)return!1;const i=s.map(a=>1*a),n=pi(i),r=Ye(i);return t<n||t>r}function kC(s,t,e,i,n,r){var a,o;const{relativeSeries:l}=i;let h;return lt(s.x)&&n_(t,s.x,e)&&((o=l==null?void 0:(a=l.getXAxisHelper()).setExtendDomain)===null||o===void 0||o.call(a,"marker_xAxis_extend",s.x)),h=fs(s.x)?Ll(s.x,n)+r.x:l.getXAxisHelper().dataToPosition([s.x])+r.x,h}function wC(s,t,e,i,n,r){var a,o;const{relativeSeries:l}=i;let h;return lt(s.y)&&n_(t,s.y,e)&&((o=(a=l.getYAxisHelper())===null||a===void 0?void 0:a.setExtendDomain)===null||o===void 0||o.call(a,"marker_yAxis_extend",s.y)),h=fs(s.y)?Ll(s.y,n)+r.y:l.getYAxisHelper().dataToPosition([s.y])+r.y,h}function Ll(s,t){return Number(s.substring(0,s.length-1))*t/100}function Xv(s){return ynt.includes(s)}function r_(s,t,e,i,n){const r=t.getRegion(),a=r.getLayoutStartPoint(),o=e.getRegion(),l=o.getLayoutStartPoint(),h=Math.abs(Math.min(a.x,l.x)-Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width)),d=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),u={relativeSeries:i},c=[],p=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData,g=i.getXAxisHelper().getScale(0).domain(),f=i.getYAxisHelper().getScale(0).domain();return p.forEach(_=>{const m=E(_.x),v=E(_.y);if(m&&v){const y=kC(_,g,n,u,h,a),b=wC(_,f,n,u,d,a);c.push([{x:y,y:b}])}else if(E(_.x)){const y=kC(_,g,n,u,h,a),b=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),x=Math.min(a.y,l.y);c.push([{x:y,y:b},{x:y,y:x}])}else if(E(_.y)){const y=Math.min(a.x,l.x),b=wC(_,f,n,u,d,a),x=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:y,y:b},{x,y:b}])}}),c}function RS(s,t,e,i){const n=[],r=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData,a=U(i);return r.forEach((o,l)=>{var h,d,u,c;const p=o!=null&&o.getRefRelativeSeries?o.getRefRelativeSeries():t,g=p.getRegion(),f=g.getLayoutStartPoint(),{width:_,height:m}=g.getLayoutRect();let v=0,y=0;if(i){const k=a?i[l]:i,w=k.x,T=k.y;w&&(v=fs(w)?Number(w.substring(0,w.length-1))*_/100:w),T&&(y=fs(T)?Number(T.substring(0,T.length-1))*m/100:T)}const b=p.getXAxisHelper().getScale(0).domain(),x=p.getYAxisHelper().getScale(0).domain(),S=Y(o.x),A=Y(o.y);S.length===1&<(S[0])&&n_(b,S[0],e)&&((d=(h=p.getXAxisHelper())===null||h===void 0?void 0:h.setExtendDomain)===null||d===void 0||d.call(h,"marker_xAxis_extend",S[0])),A.length===1&<(A[0])&&n_(x,A[0],e)&&((c=(u=p.getYAxisHelper())===null||u===void 0?void 0:u.setExtendDomain)===null||c===void 0||c.call(u,"marker_yAxis_extend",A[0])),n.push({x:p.getXAxisHelper().dataToPosition(S)+f.x+v,y:p.getYAxisHelper().dataToPosition(A)+f.y+y})}),n}function OS(s,t,e){if(e){const r=t.getRegion(),{x:a,y:o}=r.getLayoutStartPoint(),{width:l,height:h}=r.getLayoutRect();return s.map(d=>{let{x:u,y:c}=d;return fs(u)&&(u=Ll(u,l)),u+=a,fs(c)&&(c=Ll(c,h)),c+=o,{x:u,y:c}})}const{width:i,height:n}=t.getOption().getChart().getCanvasRect();return s.map(r=>{let{x:a,y:o}=r;return fs(a)&&(a=Ll(a,i)),fs(o)&&(o=Ll(o,n)),{x:a,y:o}})}function DS(s){let t=1/0,e=-1/0,i=1/0,n=-1/0;return s.forEach(r=>{const a=r.getLayoutStartPoint(),o=r.getLayoutRect();a.x<t&&(t=a.x),a.x+o.width>e&&(e=a.x+o.width),a.y<i&&(i=a.y),a.y+o.height>n&&(n=a.y+o.height)}),{minX:t,maxX:e,minY:i,maxY:n}}function LS(s){const{labelBackground:t={},style:e,shape:i}=s,n=bnt(s,["labelBackground","style","shape"]);if(s.visible!==!1){const r=n;return i!=null&&i.visible?r.shape=Object.assign({visible:!0},At(i.style)):r.shape={visible:!1},t.visible!==!1?(r.panel=Object.assign({visible:!0},At(t.style)),E(t.padding)&&(r.padding=as(t.padding))):(r.panel={visible:!1},r.padding=0),e&&(r.textStyle=At(e)),r}return{visible:!1}}class BS extends ds{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const n=t==="x"?i.getSpec().xField:i.getSpec().yField;return ot(e)&&Xv(e)?{field:n,aggrType:e}:e}_processSpecX(t){const e=this._relativeSeries;return Object.assign({x:this._getFieldInfoFromSpec("x",t,e)},this._getAllRelativeSeries())}_processSpecY(t){const e=this._relativeSeries;return Object.assign({y:this._getFieldInfoFromSpec("y",t,e)},this._getAllRelativeSeries())}_processSpecXY(t,e){const i=this._relativeSeries;return Object.assign({x:this._getFieldInfoFromSpec("x",t,i),y:this._getFieldInfoFromSpec("y",e,i)},this._getAllRelativeSeries())}_processSpecCoo(t){var e;return((e=t.coordinates)!==null&&e!==void 0?e:Y(t.coordinate)).map(i=>{const n=this._getSeriesByIdOrIndex(i.refRelativeSeriesId,i.refRelativeSeriesIndex),{xField:r,yField:a}=n.getSpec(),{xFieldDim:o,xFieldIndex:l,yFieldDim:h,yFieldIndex:d}=i;let u=r;E(l)&&(u=Y(r)[l]),o&&Y(r).includes(o)&&(u=o);let c=a;E(d)&&(c=Y(a)[d]),h&&Y(a).includes(h)&&(c=h);const p=Object.assign({x:void 0,y:void 0},this._getAllRelativeSeries());return ot(i[u])&&Xv(i[u])?p.x={field:u,aggrType:i[u]}:p.x=Y(u).map(g=>i[g]),ot(i[c])&&Xv(i[c])?p.y={field:c,aggrType:i[c]}:p.y=Y(c).map(g=>i[g]),p.getRefRelativeSeries=()=>n,p})}updateLayoutAttribute(){var t,e,i;if((t=this._spec.visible)===null||t===void 0||t){if(!this._markerComponent){const n=this._createMarkerComponent();n.name=(e=this._spec.name)!==null&&e!==void 0?e:this.type,n.id=(i=this._spec.id)!==null&&i!==void 0?i:`${this.type}-${this.id}`,this._markerComponent=n,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",(r,a)=>this._delegateEvent(this._markerComponent,r,a))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,n;let r;return r=(i=this._option.getSeriesInUserIdOrIndex(E(t)?[t]:[],[e]))===null||i===void 0?void 0:i[0],r||(r=(n=this._relativeSeries)!==null&&n!==void 0?n:this._getFirstSeries()),r}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex)}initEvent(){}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=Cx(this._regions);return e?(this._firstSeries=e,e):((t=this._option)===null||t===void 0||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){C(this._spec.offsetX)||(this._layoutOffsetX=zi(this._spec.offsetX,e.width,e)),C(this._spec.offsetY)||(this._layoutOffsetY=zi(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}}function xnt(s,t){const e=s[0].latestData;return LV(e,t.fieldX,t.fieldY)}function Snt(s,t,e,i=0){const n=[],r=s.y-t.y,a=s.x-t.x;switch(e){case"top":n.push(s),n.push({x:s.x,y:r>0?s.y-i-Math.abs(r):s.y-i}),n.push({x:t.x,y:r>0?t.y-i:t.y-i-Math.abs(r)}),n.push(t);break;case"bottom":n.push(s),n.push({x:s.x,y:r<0?s.y+i+Math.abs(r):s.y+i}),n.push({x:t.x,y:r<0?t.y+i:t.y+i+Math.abs(r)}),n.push(t);break;case"left":n.push(s),n.push({x:a>0?s.x-i-Math.abs(a):s.x-i,y:s.y}),n.push({x:a>0?t.x-i:t.x-i-Math.abs(a),y:t.y}),n.push(t);break;case"right":n.push(s),n.push({x:a>0?s.x+i:s.x+i+Math.abs(a),y:s.y}),n.push({x:a>0?t.x+i+Math.abs(a):t.x+i,y:t.y}),n.push(t)}return n}function Ant(s,t,e,i=0){const n=s.y-t.y,r=s.x-t.x;return e==="bottom"?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?i:Math.abs(n)+i}:e==="top"?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+i):-i}:e==="left"?{dx:r>0?-r-i:-i,dy:n>0?-n/2:Math.abs(n/2)}:e==="right"?{dx:r>0?i:Math.abs(r)+i,dy:n>0?-n/2:Math.abs(n/2)}:{}}function IS(s,t){if(t&&t.getRelativeSeries){const e=t.getRelativeSeries();if(e){const i=e.getViewData();return i&&i.latestData&&i.latestData.length?s:[]}}return s}class a_ extends BS{constructor(){super(...arguments),this.type=J.markLine,this.name=J.markLine,this.specKey="markLine",this.layoutZIndex=he.MarkLine}static getSpecInfo(t){const e=t[this.specKey];if(ft(e))return;if(!U(e)&&e.visible!==!1)return[{spec:e,specPath:[this.specKey],type:J.markLine}];const i=[];return e.forEach((n,r)=>{n.visible!==!1&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.markLine})}),i}_createMarkerComponent(){var t,e,i;const{label:n={},startSymbol:r={},endSymbol:a={}}=this._spec,o={zIndex:this.layoutZIndex,interactive:(t=this._spec.interactive)!==null&&t!==void 0&&t,points:[{x:0,y:0},{x:0,y:0}],lineStyle:(e=this._spec.line)===null||e===void 0?void 0:e.style,clipInRange:(i=this._spec.clip)!==null&&i!==void 0&&i,label:LS(n)};return r.visible?o.startSymbol=Object.assign(Object.assign({},r),{visible:!0,style:At(r.style)}):o.startSymbol={visible:!1},a.visible?o.endSymbol=Object.assign(Object.assign({},a),{visible:!0,style:At(a.style)}):o.endSymbol={visible:!1},new xO(o)}_markerLayout(){var t,e,i,n,r,a,o;const l=this._spec,h=this._markerData,d=this._startRelativeSeries,u=this._endRelativeSeries,c=this._relativeSeries,p=E(l.coordinates),g=E(l.process),f=g&&E(l.process.x),_=g&&E(l.process.y),m=p&&(!g||"process"in l&&"xy"in l.process),v=E(l.positions),y=(t=l.autoRange)!==null&&t!==void 0&&t;let b=[];if(this._isXYLayout||p&&f||p&&_){const T=r_(h,d,u,c,y);b=T.length===1?T[0]:T.map(M=>M[0])}else m?b=RS(h,c,y,l.coordinatesOffset):v&&(b=OS(l.positions,c,l.regionRelative));const x=this._relativeSeries.getViewData().latestData,S=h.latestData[0]&&h.latestData[0].latestData?h.latestData[0].latestData:h.latestData;let A;if(l.clip||!((e=l.label)===null||e===void 0)&&e.confine){const{minX:T,maxX:M,minY:P,maxY:O}=DS([d.getRegion(),u.getRegion(),c.getRegion()]);A={x:T,y:P,width:M-T,height:O-P}}const k=(n=(i=this._markerComponent)===null||i===void 0?void 0:i.attribute)!==null&&n!==void 0?n:{},w=Object.assign(Object.assign({},k.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(S,x):(r=k.label)===null||r===void 0?void 0:r.text});if(this._spec.type==="type-step"){const{multiSegment:T,mainSegmentIndex:M}=this._spec.line||{},{connectDirection:P,expandDistance:O=0}=this._spec;let D;if(fs(O)){const B=d.getRegion(),F=B.getLayoutStartPoint(),z=u.getRegion(),N=z.getLayoutStartPoint();if(P==="bottom"||P==="top"){const V=Math.abs(Math.min(F.y,N.y)-Math.max(F.y+B.getLayoutRect().height,N.y+z.getLayoutRect().height));D=Number(O.substring(0,O.length-1))*V/100}else{const V=Math.abs(Math.min(F.x,N.x)-Math.max(F.x+B.getLayoutRect().width,N.x+z.getLayoutRect().width));D=Number(O.substring(0,O.length-1))*V/100}}else D=O;const R=Snt(b[0],b[1],P,D);let L;L=T&&E(M)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},Ant(b[0],b[1],P,D)),{refX:0,refY:0}),(a=this._markerComponent)===null||a===void 0||a.setAttributes({points:T?[[R[0],R[1]],[R[1],R[2]],[R[2],R[3]]]:R,label:Object.assign(Object.assign(Object.assign({},w),L),{textStyle:Object.assign(Object.assign({},k.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:A,multiSegment:T,mainSegmentIndex:M,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else(o=this._markerComponent)===null||o===void 0||o.setAttributes({points:b,label:w,limitRect:A,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,r="x1"in t,a="y1"in t,o="coordinates"in t,l=i&&!n&&!a,h=i&&n&&a,d=n&&!i&&!r,u=n&&i&&r,c=i&&n&&r&&a;if(this._markerData=e.getViewData(),!(l||d||h||u||c||o))return;let p;Mt(this._option.dataSet,"markerAggregation",ES),Mt(this._option.dataSet,"markerRegression",xnt),Mt(this._option.dataSet,"markerFilter",IS),this._isXYLayout=l||h||d||u||c;let g=e.getViewData(),f=!0,_=!1;if(c){const{x:v,x1:y,y:b,y1:x}=t;p=[this._processSpecXY(v,b),this._processSpecXY(y,x)]}else if(l)p=[this._processSpecX(t.x)];else if(d)p=[this._processSpecY(t.y)];else if(h){const{x:v,y,y1:b}=t;p=[this._processSpecXY(v,y),this._processSpecXY(v,b)]}else if(u){const{x:v,x1:y,y:b}=t;p=[this._processSpecXY(v,b),this._processSpecXY(y,b)]}else if(o){if(p=this._processSpecCoo(t),f=!1,g=new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:p}),t.process&&"x"in t.process&&(p=[this._processSpecX(t.process.x)],f=!0),t.process&&"y"in t.process&&(p=[this._processSpecY(t.process.y)],f=!0),t.process&&"xy"in t.process){const{xField:v,yField:y}=e.getSpec();p={fieldX:v,fieldY:y},_=!0}}else f=!1;const m=new Zt(this._option.dataSet);m.parse([g],{type:"dataview"}),f&&m.transform({type:"markerAggregation",options:p}),_&&m.transform({type:"markerRegression",options:p}),(f||_)&&m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",()=>{this._markerLayout()}),this._markerData=m}}a_.type=J.markLine,a_.specKey="markLine";const knt=()=>{I.registerComponent(a_.type,a_)};class o_ extends ds{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=J.title,this.specKey=J.title,this.layoutType="normal",this.layoutZIndex=he.Title,this.layoutLevel=xn.Title,this._orient="top",this._orient=Jx(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){const e=t[this.specKey];if(!e||e.visible===!1)return null;if(!U(e))return[{spec:e,specPath:[this.specKey],type:J.title}];const i=[];return e.forEach((n,r)=>{n.visible!==!1&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.title})}),i}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(e==null?void 0:e.orient)!==(t==null?void 0:t.orient)&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){H(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),H(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:r}=this.getLayoutStartPoint();return{x1:n,y1:r,x2:n+e.width,y2:r+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:H(t.width())?t.width():0,height:this._spec.height?this._spec.height:H(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,n,r,a,o,l,h;const d=Math.max(0,(t=this._spec.width)!==null&&t!==void 0?t:this.getLayoutRect().width);return Object.assign(Object.assign({},Kl(this._spec,["padding"])),{textType:(e=this._spec.textType)!==null&&e!==void 0?e:"text",text:(i=this._spec.text)!==null&&i!==void 0?i:"",subtextType:(n=this._spec.subtextType)!==null&&n!==void 0?n:"text",subtext:(r=this._spec.subtext)!==null&&r!==void 0?r:"",x:(a=this._spec.x)!==null&&a!==void 0?a:0,y:(o=this._spec.y)!==null&&o!==void 0?o:0,width:d,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:(l=this._spec.align)!==null&&l!==void 0?l:"left",verticalAlign:(h=this._spec.verticalAlign)!==null&&h!==void 0?h:"top",textStyle:Object.assign({width:d},this._spec.textStyle),subtextStyle:Object.assign({width:d},this._spec.subtextStyle)})}_createOrUpdateTitleComponent(t){if(this._titleComponent)_e(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new DO(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",(n,r)=>this._delegateEvent(i,n,r))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}o_.type=J.title,o_.specKey=J.title;const wnt=()=>{I.registerComponent(o_.type,o_)};class l_ extends BS{constructor(){super(...arguments),this.type=J.markArea,this.name=J.markArea,this.specKey="markArea",this.layoutZIndex=he.MarkArea}static getSpecInfo(t){const e=t[this.specKey];if(ft(e))return;if(!U(e)&&e.visible!==!1)return[{spec:e,specPath:[this.specKey],type:J.markArea}];const i=[];return e.forEach((n,r)=>{n.visible!==!1&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.markArea})}),i}_createMarkerComponent(){var t,e,i,n;const r=(t=this._spec.label)!==null&&t!==void 0?t:{},a={zIndex:this.layoutZIndex,interactive:(e=this._spec.interactive)!==null&&e!==void 0&&e,points:[{x:0,y:0}],areaStyle:At((i=this._spec.area)===null||i===void 0?void 0:i.style),clipInRange:(n=this._spec.clip)!==null&&n!==void 0&&n,label:LS(r)};return new AO(a)}_markerLayout(){var t,e,i,n,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,h=this._endRelativeSeries,d=this._relativeSeries,u=E(a.x)&&E(a.x1),c=E(a.y)&&E(a.y1),p=u&&c,g=E(a.coordinates),f=E(a.positions),_=(t=a.autoRange)!==null&&t!==void 0&&t;let m=[],v=[];p?(v=r_(o,l,h,d,_),m=[{x:v[0][0].x,y:v[1][0].y},v[0][0],{x:v[1][0].x,y:v[0][0].y},v[1][0]]):u||c?(v=r_(o,l,h,d,_),m=[...v[0],v[1][1],v[1][0]]):g?m=RS(o,d,_,a.coordinatesOffset):f&&(m=OS(a.positions,d,a.regionRelative));const y=this._relativeSeries.getViewData().latestData,b=o?o.latestData[0]&&o.latestData[0].latestData?o.latestData[0].latestData:o.latestData:y;let x;if(a.clip||!((e=a.label)===null||e===void 0)&&e.confine){const{minX:S,maxX:A,minY:k,maxY:w}=DS([l.getRegion(),h.getRegion(),d.getRegion()]);x={x:S,y:k,width:A-S,height:w-k}}this._markerComponent&&this._markerComponent.setAttributes({points:m,label:Object.assign(Object.assign({},(i=this._markerComponent.attribute)===null||i===void 0?void 0:i.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(b,y):(r=(n=this._markerComponent.attribute)===null||n===void 0?void 0:n.label)===null||r===void 0?void 0:r.text}),limitRect:x,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=E(t.x)&&E(t.x1),n=E(t.y)&&E(t.y1),r=i&&n,a=E(t.coordinates);if(!i&&!n&&!a)return null;let o;r?o=[this._processSpecXY(t.x,t.y),this._processSpecXY(t.x1,t.y1)]:i?o=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?o=[this._processSpecY(t.y),this._processSpecY(t.y1)]:a&&(o=this._processSpecCoo(t));const l=e.getViewData();Mt(this._option.dataSet,"markerAggregation",ES),Mt(this._option.dataSet,"markerFilter",IS);const h=new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_data`});h.parse([l],{type:"dataview"}),h.transform({type:"markerAggregation",options:o}),o&&h.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),h.target.on("change",()=>{this._markerLayout()}),this._markerData=h}}l_.type=J.markArea,l_.specKey="markArea";const Tnt=()=>{I.registerComponent(l_.type,l_)},TC=s=>{const t=Object.assign({},s);return At(t)},Mnt=s=>{const t=Object.assign({},s);return At(t)},Ap=s=>Object.assign(Object.assign({},s),{style:Object.assign({},At(s.style))}),fI=s=>{var t,e,i,n,r,a,o,l,h,d,u,c,p,g;const f=TC((e=(t=s==null?void 0:s.slider)===null||t===void 0?void 0:t.trackStyle)!==null&&e!==void 0?e:{}),_=TC((n=(i=s==null?void 0:s.slider)===null||i===void 0?void 0:i.railStyle)!==null&&n!==void 0?n:{}),m=Mnt((a=(r=s==null?void 0:s.slider)===null||r===void 0?void 0:r.handlerStyle)!==null&&a!==void 0?a:{}),v=Ap((l=(o=s==null?void 0:s.controller)===null||o===void 0?void 0:o.start)!==null&&l!==void 0?l:{}),y=Ap((d=(h=s==null?void 0:s.controller)===null||h===void 0?void 0:h.pause)!==null&&d!==void 0?d:{}),b=Ap((c=(u=s==null?void 0:s.controller)===null||u===void 0?void 0:u.backward)!==null&&c!==void 0?c:{}),x=Ap((g=(p=s==null?void 0:s.controller)===null||p===void 0?void 0:p.forward)!==null&&g!==void 0?g:{});return Object.assign(Object.assign({},s),{direction:s.direction,interval:s.interval,visible:s.visible,orient:s.orient,slider:Object.assign(Object.assign({},s.slider),{trackStyle:f,railStyle:_,handlerStyle:m}),controller:Object.assign(Object.assign({},s.controller),{start:v,pause:y,backward:b,forward:x})})},Cnt=(s,t)=>Object.assign(Object.assign({},fI(s)),{data:t,type:"continuous"}),Pnt=(s,t)=>Object.assign(Object.assign({},fI(s)),{data:t,type:"discrete"}),Jh=s=>s==="left"||s==="right",Kv=s=>s==="top"||s==="bottom";class h_ extends ds{constructor(){super(...arguments),this.layoutZIndex=he.Player,this.layoutLevel=xn.Player,this.specKey="player",this.type=J.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e;const i=this._spec.type,n={size:{width:this._width,height:this._height},dx:(t=this._spec.dx)!==null&&t!==void 0?t:0+this._dx,dy:(e=this._spec.dy)!==null&&e!==void 0?e:0+this._dy};return i==="discrete"?Object.assign(Object.assign(Object.assign({},Pnt(this._spec,this._specs)),n),{disableTriggerEvent:this._option.disableTriggerEvent}):Object.assign(Object.assign(Object.assign({},Cnt(this._spec,this._specs)),n),{disableTriggerEvent:this._option.disableTriggerEvent})},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?_e(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):(t.type==="discrete"?this._playerComponent=new N6(t):this._playerComponent=new U6(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,n,r,a,o,l,h;return Math.max(...Y((e=(t=this._spec.controller.start)===null||t===void 0?void 0:t.style)===null||e===void 0?void 0:e.size),...Y((n=(i=this._spec.controller.pause)===null||i===void 0?void 0:i.style)===null||n===void 0?void 0:n.size),...Y((a=(r=this._spec.controller.backward)===null||r===void 0?void 0:r.style)===null||a===void 0?void 0:a.size),...Y((l=(o=this._spec.controller.forward)===null||o===void 0?void 0:o.style)===null||l===void 0?void 0:l.size),(h=Jh(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)!==null&&h!==void 0?h:10)},this._sliderExceededSize=()=>{var t,e,i,n,r,a,o,l,h;const d=(t=Jh(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)!==null&&t!==void 0?t:10,u=Math.max(...Y((i=(e=this._spec.controller.start)===null||e===void 0?void 0:e.style)===null||i===void 0?void 0:i.size),...Y((r=(n=this._spec.controller.pause)===null||n===void 0?void 0:n.style)===null||r===void 0?void 0:r.size),...Y((o=(a=this._spec.controller.backward)===null||a===void 0?void 0:a.style)===null||o===void 0?void 0:o.size),...Y((h=(l=this._spec.controller.forward)===null||l===void 0?void 0:l.style)===null||h===void 0?void 0:h.size));return d>=u?d-u:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(bt.rendered,()=>{var t;!((t=this._spec)===null||t===void 0)&&t.auto&&this._playerComponent.play()}),this._playerComponent.addEventListener(Oe.OnEnd,()=>{var t;this.event.emit(bt.playerEnd,{model:this}),this._alternate&&this._spec.type==="discrete"&&(this._direction=this._direction==="default"?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:this._direction==="reverse"?this._specs.length-2:1})),!((t=this._spec)===null||t===void 0)&&t.loop&&this._playerComponent.play()}),this._playerComponent.addEventListener(Oe.OnChange,t=>{const{index:e}=t.detail,i=this._specs[e];Y(i.data).forEach(n=>{var r,a;(a=(r=this._option)===null||r===void 0?void 0:r.globalInstance)===null||a===void 0||a.updateData(n.id,n.values)}),this.event.emit(bt.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}),this._playerComponent.addEventListener(Oe.OnBackward,t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bt.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})}),this._playerComponent.addEventListener(Oe.OnForward,t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bt.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})}),this._playerComponent.addEventListener(Oe.OnPlay,t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bt.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})}),this._playerComponent.addEventListener(Oe.OnPause,t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bt.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}static getSpecInfo(t){const e=t[this.specKey];return C(e)||e.visible===!1?null:[{spec:e,specPath:[this.specKey],type:J.player}]}setAttrFromSpec(){var t,e,i,n,r,a,o;super.setAttrFromSpec(),this._orient=(t=this._spec.orient)!==null&&t!==void 0?t:"bottom",this._specs=(e=this._spec.specs)!==null&&e!==void 0?e:[],this._direction=(i=this._spec.direction)!==null&&i!==void 0?i:"default",this._alternate=(n=this._spec.alternate)!==null&&n!==void 0&&n,this._dx=(r=this._spec.dx)!==null&&r!==void 0?r:0,this._dy=(a=this._spec.dy)!==null&&a!==void 0?a:0,this._position=(o=this._spec.position)!==null&&o!==void 0?o:"middle"}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),H(t.x)){const e=Jh(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(H(t.y)){const e=Kv(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return lt(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Jh(this._orient)?this._maxSize():t.width}_computeHeight(t){return lt(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):Kv(this._orient)?this._maxSize():t.height}_computeDx(t){return Jh(this._orient)||this._position==="start"?0:this._position==="middle"?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Kv(this._orient)||this._position==="start"?0:this._position==="middle"?(t.height-this._height)/2:t.height-this._height}}h_.specKey="player",h_.type=J.player;const Ent=()=>{I.registerComponent(h_.type,h_)},MC={rect:CC,symbol:_I,arc:PC,point:Bnt,"line-data":Ont,stackLabel:Int,line:EC,area:EC,rect3d:CC,arc3d:PC,treemap:Fnt};function Rnt(s,t){var e;const{labelSpec:i}=t;return i.overlap&&!Vt(i.overlap)&&(i.overlap={}),((e=MC[s])!==null&&e!==void 0?e:MC.point)(t)}function Dm(s,t,e,i){var n;const{labelMark:r,series:a}=s,o={text:t[a.getMeasureField()[0]],data:t,textType:(n=s.labelSpec.textType)!==null&&n!==void 0?n:"text"},l=Object.keys(r.stateStyle.normal);for(const h of l){const d=r.getAttribute(h,t);o[h]=d}return e&&(o.text=e(o.text,t,{series:a})),i&&(a.type==="pie"?t._percent_=(100*t[HR]).toFixed(2)+"%":t[Ma]&&(t._percent_=(100*t[Ma]).toFixed(2)+"%"),o.text=Q2(i,t)),o}function FS(s){return q(s)?t=>s(t.data):s}function _I(s){var t,e,i;const{series:n,labelSpec:r}=s,a=n.direction==="horizontal"?"right":"top",o=(t=FS(r.position))!==null&&t!==void 0?t:a;let l;return l=r.overlap!==!1&&{strategy:(i=(e=r.overlap)===null||e===void 0?void 0:e.strategy)!==null&&i!==void 0?i:Dnt(),avoidBaseMark:o!=="center"},{position:o,overlap:l}}function Ont(s){const t=_I(s);return pe(t.overlap)||(t.overlap.avoidBaseMark=!1),t}function Dnt(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function CC(s){var t,e,i,n,r,a;const{series:o,labelSpec:l={}}=s,h=(t=FS(l.position))!==null&&t!==void 0?t:"outside",d=(e=o.direction)!==null&&e!==void 0?e:"vertical",u=o.direction==="horizontal"?(i=o.getXAxisHelper())===null||i===void 0?void 0:i.isInverse():(n=o.getYAxisHelper())===null||n===void 0?void 0:n.isInverse();let c,p=h;ot(h)&&p!=="inside"&&(p=f=>{const{data:_}=f,m=o.getMeasureField()[0];if(h==="outside"){const v={vertical:["top","bottom"],horizontal:["right","left"]},y=(_==null?void 0:_[m])>=0&&u||(_==null?void 0:_[m])<0&&!u?1:0;return v[d][y]}return h==="inside-bottom"?o.direction==="horizontal"?"inside-left":"inside-bottom":h==="inside-top"?o.direction==="horizontal"?"inside-right":"inside-top":h}),c=l.overlap!==!1&&{strategy:(a=(r=l.overlap)===null||r===void 0?void 0:r.strategy)!==null&&a!==void 0?a:Lnt(o)};let g=!1;return ot(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:c,smartInvert:g}}function Lnt(s){return[{type:"position",position:t=>{var e,i;const{data:n}=t,r=s.getMeasureField()[0];return(s.direction==="horizontal"?!((e=s.getXAxisHelper())===null||e===void 0)&&e.isInverse():!((i=s.getYAxisHelper())===null||i===void 0)&&i.isInverse())?(n==null?void 0:n[r])>=0?s.direction==="horizontal"?["left","inside-left"]:["bottom","inside-bottom"]:s.direction==="horizontal"?["right","inside-right"]:["top","inside-top"]:(n==null?void 0:n[r])>=0?s.direction==="horizontal"?["right","inside-right"]:["top","inside-top"]:s.direction==="horizontal"?["left","inside-left"]:["bottom","inside-bottom"]}}]}function Bnt(s){const{labelSpec:t}=s;let e;return e=t.overlap!==!1&&{avoidBaseMark:!1},{position:"center",overlap:e}}function PC(s){var t;const{labelSpec:e}=s,i=(t=FS(e.position))!==null&&t!==void 0?t:"outside",n=i;let r;return r=e.smartInvert?e.smartInvert:ot(i)&&i.includes("inside"),{position:n,smartInvert:r}}function Int(s){const t=s.series,e=s.labelSpec||{},i=t.getTotalData();return{customLayoutFunc:n=>n.map(r=>{const a=e.position||"withChange",o=e.offset||0,l=r.data,h=Dm(s,l,e.formatMethod);return h.x=(d=>t.direction==="vertical"?t.totalPositionX(d,"index",.5):a==="middle"?.5*(t.totalPositionX(d,"end")+t.totalPositionY(d,"start")):a==="max"?t.totalPositionX(d,d.end>=d.start?"end":"start")+o:a==="min"?t.totalPositionX(d,d.end>=d.start?"start":"end")-o:t.totalPositionX(d,"end")+(d.end>=d.start?o:-o))(l),h.y=(d=>t.direction==="vertical"?a==="middle"?.5*(t.totalPositionY(d,"end")+t.totalPositionY(d,"start")):a==="max"?t.totalPositionY(d,d.end>=d.start?"end":"start")-o:a==="min"?t.totalPositionY(d,d.end>=d.start?"start":"end")+o:t.totalPositionY(d,"end")+(d.end>=d.start?-o:o):t.totalPositionY(d,"index",.5))(l),t.direction==="vertical"?h.textBaseline=a==="middle"?a:a==="withChange"&&l.end-l.start>=0||a==="max"?"bottom":"top":h.textAlign=a==="middle"?"center":a==="withChange"&&l.end-l.start>=0||a==="max"?"left":"right",oo(Object.assign(Object.assign({},h),{id:r.id}))}),dataFilter:n=>{const r=[];return i.forEach(a=>{const o=n.find(l=>{var h;return a.index===((h=l.data)===null||h===void 0?void 0:h[t.getDimensionField()[0]])});o&&(o.data=a,r.push(o))}),r},overlap:{strategy:[]}}}function Fnt(s){const t=s.labelSpec;return{customLayoutFunc:e=>e.map(i=>{const n=i.data,r=Dm(s,n,t.formatMethod);return oo(Object.assign(Object.assign({},r),{id:i.id,pickable:!1}))}),overlap:!1}}function EC(s){var t,e,i,n;const{labelSpec:r,series:a}=s,o=(i=(e=(t=a.getViewDataStatistics)===null||t===void 0?void 0:t.call(a).latestData)===null||e===void 0?void 0:e[a.getSeriesField()])===null||i===void 0?void 0:i.values,l=o?o.map((h,d)=>({[a.getSeriesField()]:h,index:d})):[];return{position:(n=r.position)!==null&&n!==void 0?n:"end",data:l}}class jS extends ds{constructor(t,e){super(t,e),this.type=J.label,this.name=J.label,this.layoutType="none",this.layoutZIndex=he.Label,this._regions=e.getRegionsInIndex([e.specIndex])}_interactiveConfig(t){const{interactive:e}=t;if(e!==!0)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:r}=this._option.getChart().getSpec();return n===!1&&n.enable===!1||(i.hover=!0),r===!1&&r.enable===!1||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,_e(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}jS.type=J.label;class d_ extends gh{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}d_.type="text",d_.constructorType="label";const mI=()=>{I.registerMark(d_.constructorType,d_),qO()};class vI extends xc{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Yd extends jS{constructor(t,e){super(t,e),this.type=J.label,this.name=J.label,this.specKey="label",this.transformerConstructor=vI,this.layoutZIndex=he.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[];return((e==null?void 0:e.region)||[]).forEach((r,a)=>{const o=(r.seriesIndexes||[]).some(l=>{const h=e.series[l],{markLabelSpec:d={}}=h;return Object.values(d).some(u=>Array.isArray(u)&&(c=>c.some(p=>p.visible))(u))});(t.labelLayout!=="region"||o)&&i.push({spec:t,type:J.label,specInfoPath:["region",a,"markLabel"],specIndex:a})}),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(bt.dataZoomChange,()=>{this._labelComponentMap.forEach((e,i)=>{const n=i.getProduct().getGroupGraphicItem();n&&n.disableAnimation()}),this.event.on(ut.AFTER_MARK_RENDER_END,t)});const t=()=>{this._labelComponentMap.forEach((e,i)=>{const n=i.getProduct().getGroupGraphicItem();n&&n.enableAnimation()}),this.event.off(ut.AFTER_MARK_RENDER_END,t)};this.event.on("afterElementEncode",e=>{var i;const n=e.item;this._option.getChart().getLayoutTag()===!1&&((i=n.getContext())===null||i===void 0?void 0:i.model)===this&&this._delegateLabelEvent(n.getGroupGraphicItem())})}_delegateLabelEvent(t){const e=t==null?void 0:t.findAll(i=>i.type==="text",!0).filter(i=>!i.__vchart_event);e&&e.length>0&&e.forEach(i=>{i.__vchart_event=!0,i.addEventListener("*",(n,r)=>this._delegateEvent(t,n,r,i,i.attribute.data))})}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Te(this._regions,t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),n=t.getRegion();this._labelInfoMap.get(n)||this._labelInfoMap.set(n,[]);for(let r=0;r<i.length;r++){const a=i[r],o=t.getMarkInName(a);o&&e[a].forEach((l,h)=>{if(l.visible){const d=this._labelInfoMap.get(n),u=this._createMark({type:"label",name:`${a}-label-${h}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});u.setTarget(o),d.push({labelMark:u,baseMark:o,series:t,labelSpec:l})}})}})}_initLabelComponent(){this._labelInfoMap.forEach((t,e)=>{if(this._layoutRule==="region"){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),this._marks.addMark(i),this._labelComponentMap.set(i,()=>this._labelInfoMap.get(e)))}else t.forEach((i,n)=>{const r=this._createMark({type:"component",name:`${i.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0,support3d:i.baseMark.getSupport3d()});r&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),this._labelComponentMap.set(r,()=>this._labelInfoMap.get(e)[n]),i.labelMark.setComponent(r))})})}_initTextMarkStyle(){this._labelInfoMap.forEach(t=>{t.forEach(e=>{var i,n;const{labelMark:r,labelSpec:a,series:o}=e;if(this.initMarkStyleWithSpec(r,a,void 0),q(a==null?void 0:a.getStyleHandler)){const l=a.getStyleHandler(o);l==null||l.call(o,r)}!((n=(i=r.stateStyle)===null||i===void 0?void 0:i.normal)===null||n===void 0)&&n.lineWidth&&r.setAttribute("stroke",o.getColorAttribute(),"normal",Q.Base_Series)})})}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((t,e)=>{const i=t();U(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)})}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map(({baseMark:i})=>i.getProduct()),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const n=this._option.getAllComponents().filter(r=>r.type==="totalLabel");t.target(e).configure({interactive:!1}).depend(n.map(r=>r.getMarks()[0].getProduct())).labelStyle((r,a)=>{var o,l;const h=i[a.labelIndex];if(h){const{labelSpec:d,labelMark:u}=h,c=u.getRule(),p=this._interactiveConfig(d),g=(l=(o=this._spec)===null||o===void 0?void 0:o.centerOffset)!==null&&l!==void 0?l:0,f=_t({textStyle:Object.assign({pickable:d.interactive===!0},d.style),overlap:{avoidMarks:this._option.getAllComponents().filter(_=>_.type==="totalLabel").map(_=>_.getMarks()[0].getProductId())},x:0,y:0},Rnt(c,h),Object.assign(Object.assign(Object.assign({},Kl(d,["position","style","state","type"])),p),{centerOffset:g}));return c!=="line"&&c!=="area"||(f.type=c),f}}).encode((r,a,o)=>{if(i[o.labelIndex]){const{labelSpec:l,labelMark:h}=i[o.labelIndex];return h.skipEncode?{data:r}:Dm(i[o.labelIndex],r,l.formatMethod,l.formatter)}}).size(()=>i[0].series.getRegion().getLayoutRect())}compileMarks(){this.getMarks().forEach(t=>{var e;const i=this._labelComponentMap.get(t)();let n;n=U(i)?i[0].series.getRegion().getGroupMark().getProduct():i.series.getRegion().getGroupMark().getProduct(),t.compile({group:n}),(e=t.getProduct())===null||e===void 0||e.configure({context:{model:this,labelInfo:i}})})}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach((e,i)=>{const n=i.getProduct().getGroupGraphicItem();n&&t.push(n)}),t}}Yd.type=J.label,Yd.specKey="label",Yd.transformerConstructor=vI;const jnt=()=>{rD(),mI(),wS(),I.registerComponent(Yd.type,Yd,!0)};class u_ extends jS{constructor(){super(...arguments),this.type=J.totalLabel,this.name=J.totalLabel,this.specKey="totalLabel",this.layoutZIndex=he.Label}static getSpecInfo(t,e){var i;const n=[];return(i=e==null?void 0:e.region)===null||i===void 0||i.forEach((r,a)=>{var o;(o=r.seriesIndexes)===null||o===void 0||o.forEach(l=>{const{spec:h}=e.series[l],d=h[this.specKey];d!=null&&d.visible&&n.push({spec:d,type:J.totalLabel,specPath:["series",l,this.specKey],specIndex:a})})}),n}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;const e=this._getSeries();if(!((t=e.getSpec().totalLabel)===null||t===void 0)&&t.visible){const i=e.getMarksInType(["rect","symbol"])[0],n=this._createMark({type:"label",name:`${i.name}-total-label`});this._baseMark=i,this._textMark=n,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[mD]},"normal",Q.Default)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0,support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle(()=>{if(this._baseMark){const{offset:n,animation:r,overlap:a}=this._spec,o=this._interactiveConfig(this._spec);return _t({textStyle:{pickable:this._spec.interactive===!0},position:znt(t,this._baseMark.type),x:0,y:0},Object.assign({offset:n,animation:r,overlap:a,dataFilter:l=>l.filter(h=>h.data[ab])},o))}}).encode(n=>Dm({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},n,this._spec.formatMethod)).size(()=>this._regions[0].getLayoutRect())})}compileMarks(){this.getMarks().forEach(t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),(e=t.getProduct())===null||e===void 0||e.configure({context:{model:this}})})}getVRenderComponents(){const t=[];return this.getMarks().forEach(e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)}),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}u_.type=J.totalLabel,u_.specKey="totalLabel";function znt(s,t){let e;return t==="rect"?e=s.direction==="horizontal"?"right":"top":e="top",e}const Hnt=()=>{rD(),mI(),wS(),I.registerComponent(u_.type,u_,!0)};var RC=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};class c_ extends BS{constructor(){super(...arguments),this.type=J.markPoint,this.name=J.markPoint,this.specKey="markPoint",this.layoutZIndex=he.MarkPoint}static getSpecInfo(t){const e=t[this.specKey];if(ft(e))return;if(!U(e)&&e.visible!==!1)return[{spec:e,specPath:[this.specKey],type:J.markPoint}];const i=[];return e.forEach((n,r)=>{n.visible!==!1&&i.push({spec:n,specIndex:r,specPath:[this.specKey,r],type:J.markPoint})}),i}_createMarkerComponent(){var t,e;const{itemContent:i={},itemLine:n={}}=this._spec,{text:r={},symbol:a,image:o,richText:l}=i,h=RC(i,["text","symbol","image","richText"]),d={zIndex:this.layoutZIndex,interactive:(t=this._spec.interactive)!==null&&t!==void 0&&t,position:{x:0,y:0},clipInRange:(e=this._spec.clip)!==null&&e!==void 0&&e,itemContent:Object.assign({symbolStyle:At(a==null?void 0:a.style),imageStyle:o==null?void 0:o.style,textStyle:LS(r),richTextStyle:l==null?void 0:l.style},h)},{visible:u,line:c={}}=n,p=RC(n,["visible","line"]);return d.itemLine=u!==!1?Object.assign(Object.assign({},p),{visible:!0,lineStyle:At(c.style)}):{visible:!1},new jx(d)}_markerLayout(){var t,e,i,n,r,a;const o=this._spec,l=this._markerData,h=this._relativeSeries,d="x"in o&&"y"in o,u="coordinate"in o,c="position"in o,p=(t=o==null?void 0:o.autoRange)!==null&&t!==void 0&&t;let g;d?g=r_(l,h,h,h,p)[0][0]:u?g=RS(l,h,p,o.coordinatesOffset)[0]:c&&(g=OS([o.position],h,o.regionRelative)[0]);const f=this._relativeSeries.getViewData().latestData,_=l?l.latestData[0]&&l.latestData[0].latestData?l.latestData[0].latestData:l.latestData:f;let m;if(o.clip||!((e=o.itemContent)===null||e===void 0)&&e.confine){const{minX:v,maxX:y,minY:b,maxY:x}=DS([h.getRegion()]);m={x:v,y:b,width:y-v,height:x-b}}if(this._markerComponent){const v=(i=this._markerComponent.attribute)!==null&&i!==void 0?i:{},y=(r=(n=v.itemContent)===null||n===void 0?void 0:n.textStyle)!==null&&r!==void 0?r:{};this._markerComponent.setAttributes({position:g,itemContent:Object.assign(Object.assign({},v.itemContent),{textStyle:Object.assign(Object.assign({},y),{text:!((a=this._spec.itemContent.text)===null||a===void 0)&&a.formatMethod?this._spec.itemContent.text.formatMethod(_,f):y.text})}),limitRect:m,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,e=this._relativeSeries,i=E(t.x)&&E(t.y),n=E(t.coordinate);if(!n&&!i)return;let r;Mt(this._option.dataSet,"markerAggregation",ES),Mt(this._option.dataSet,"markerFilter",IS),i?r=[this._processSpecXY(t.x,t.y)]:n&&(r=this._processSpecCoo(t));const a=new Zt(this._option.dataSet,{name:`${this.type}_${this.id}_data`});a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),r&&a.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),a.target.on("change",()=>{this._markerLayout()}),this._markerData=a}}c_.type=J.markPoint,c_.specKey="markPoint";const Gnt=()=>{I.registerComponent(c_.type,c_)};class p_ extends ds{constructor(){super(...arguments),this.layoutType="none",this.type=J.brush,this.name=J.brush,this.specKey="brush",this.layoutZIndex=he.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach(i=>{i.getActiveMarks().forEach(n=>{n&&(i.setMarkStyle(n,Object.assign({},t),"inBrush",Q.Series),i.setMarkStyle(n,Object.assign({},e),"outOfBrush",Q.Series))})})}static getSpecInfo(t){const e=t[this.specKey];if(!C(e)&&e.visible!==!1)return[{spec:e,specPath:[this.specKey],type:J.brush}]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),n=e.x,r=n+i.width,a=e.y,o=a+i.height;return{interactiveRange:{minY:a,maxY:o,minX:n,maxX:r},xRange:[n,r],yRange:[a,o]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(i),this._initMarkBrushState(e,""),n.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,n;const r=this._getBrushInteractiveAttr(t),a=new IO(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:At((i=this._spec)===null||i===void 0?void 0:i.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=(n=this._spec.id)!==null&&n!==void 0?n:`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single"}=this._spec;this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(Ni.drawStart,l=>{this._emitEvent(bt.brushStart,t)}),a.addEventListener(Ni.moveStart,l=>{this._emitEvent(bt.brushStart,t)}),a.addEventListener(Ni.drawing,l=>{this._needInitOutState&&o==="single"&&this._initMarkBrushState(e,"outOfBrush"),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(bt.brushChange,t,l)}),a.addEventListener(Ni.moving,l=>{this._handleBrushChange(bt.brushChange,t,l)}),a.addEventListener(Ni.brushClear,l=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(bt.brushChange,t,l),this._handleBrushChange(bt.brushClear,t,l)}),a.addEventListener(Ni.drawEnd,l=>{this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(bt.brushEnd,t,l)}),a.addEventListener(Ni.moveEnd,l=>{this._handleBrushChange(bt.brushEnd,t,l)})}_handleBrushChange(t,e,i){const{operateMask:n}=i.detail;this._reconfigItem(n,e),this._reconfigLinkedItem(n,e),this._emitEvent(t,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}_transformBrushedMarkAttr(t){const e={};return t!=null&&t.symbol&&(e.symbolType=t.symbol),t!=null&&t.symbolSize&&(e.size=t.symbolSize),t!=null&&t.color&&(e.fill=t.color),t!=null&&t.colorAlpha&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},At(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach(i=>{const n=i.getProduct();!n||!n.elements||!n.elements.length||n.elements.forEach(r=>{var a,o,l;const h=r.getGraphicItem(),d=i.id+"_"+r.key;!((a=this._outOfBrushElementsMap)===null||a===void 0)&&a[d]&&this._isBrushContainItem(t,h)?(r.addState("inBrush"),this._inBrushElementsMap[t==null?void 0:t.name]||(this._inBrushElementsMap[t==null?void 0:t.name]={}),this._inBrushElementsMap[t==null?void 0:t.name][d]=r,delete this._outOfBrushElementsMap[d]):!((l=(o=this._inBrushElementsMap)===null||o===void 0?void 0:o[t==null?void 0:t.name])===null||l===void 0)&&l[d]&&!this._isBrushContainItem(t,h)&&(r.removeState("inBrush"),r.addState("outOfBrush"),this._outOfBrushElementsMap[d]=r,delete this._inBrushElementsMap[t.name][d]),h.setAttribute("pickable",!this._needDisablePickable)})})}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),n=e.getSeries().map(r=>r.id);this._linkedSeries.forEach(r=>{if(!n.includes(r.id)){const a=r.getRegion().getLayoutStartPoint(),o=a.x-i.x,l=a.y-i.y;this._linkedItemMap[r.id].forEach(h=>{const d=h.getProduct();!d||!d.elements||!d.elements.length||d.elements.forEach(u=>{var c,p,g;const f=u.getGraphicItem(),_=h.id+"_"+u.key;!((c=this._linkedOutOfBrushElementsMap)===null||c===void 0)&&c[_]&&this._isBrushContainItem(t,f,{dx:o,dy:l})?(u.addState("inBrush"),this._linkedInBrushElementsMap[t==null?void 0:t.name]||(this._linkedInBrushElementsMap[t==null?void 0:t.name]={}),this._linkedInBrushElementsMap[t==null?void 0:t.name][_]=u,delete this._linkedOutOfBrushElementsMap[_]):!((g=(p=this._linkedInBrushElementsMap)===null||p===void 0?void 0:p[t==null?void 0:t.name])===null||g===void 0)&&g[_]&&!this._isBrushContainItem(t,f,{dx:o,dy:l})&&(u.removeState("inBrush"),u.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[_]=u),f.setAttribute("pickable",!this._needDisablePickable)})})}})}_isBrushContainItem(t,e,i){var n,r,a;if(!(t!=null&&t.globalTransMatrix)||!(!((n=t==null?void 0:t.attribute)===null||n===void 0)&&n.points))return!1;const o=(a=(r=t==null?void 0:t.attribute)===null||r===void 0?void 0:r.points)!==null&&a!==void 0?a:[],{a:l,b:h,c:d,d:u,e:c,f:p}=t.globalTransMatrix,g=(i==null?void 0:i.dx)||0,f=(i==null?void 0:i.dy)||0,_=o.map(b=>({x:l*b.x+d*b.y+c+g,y:h*b.x+u*b.y+p+f}));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+g,t.globalAABBBounds.y1+f,t.globalAABBBounds.x2+g,t.globalAABBBounds.y2+f);const m=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let y=[];if(e.type==="symbol"){const{size:b=0}=e==null?void 0:e.attribute,x=Y(b)[0]/2;return y=[{x:m-x,y:v-x},{x:m+x,y:v-x},{x:m+x,y:v+x},{x:m-x,y:v+x}],nA(_,y)}if(e.type==="rect"){const{x1:b,x2:x,y1:S,y2:A}=e==null?void 0:e.AABBBounds,k=Math.abs(b-x),w=Math.abs(S-A);return y=[{x:m,y:v},{x:m+k,y:v},{x:m+k,y:v+w},{x:m,y:v+w}],nA(_,y)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){E(this._spec.regionId)&&E(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_bindLinkedSeries(){E(this._spec.brushLinkSeriesId)&&E(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach(i=>{const n=[];i.getSeries().forEach(r=>{(t&&Y(t).includes(r.userId.toString())||e&&Y(e).includes(r.getSpecIndex())||!e&&!t)&&n.push(...r.getMarksWithoutRoot()),this._itemMap[i.id]=n})}),this._linkedSeries.forEach(i=>{this._linkedItemMap[i.id]=i.getMarksWithoutRoot()})}_initMarkBrushState(t,e){this._brushComponents.forEach((i,n)=>{n!==t&&i.children[0].removeAllChild()}),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach(i=>{i.getMarksWithoutRoot().forEach(n=>{const r=n.getProduct();!r||!r.elements||!r.elements.length||r.elements.forEach(a=>{const o=n.id+"_"+a.key;a.removeState("inBrush"),a.removeState("outOfBrush"),a.addState(e),this._outOfBrushElementsMap[o]=a,this._linkedOutOfBrushElementsMap[o]=a})})})}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach((n,r)=>{this._updateBrushComponent(n,r)});const i=super._compareSpec(t,e);return _e(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;super.onLayoutEnd(t),!this._option.disableTriggerEvent&&((e=this._spec.visible)===null||e===void 0||e)&&(this._brushComponents?this._relativeRegions.forEach((i,n)=>{this._updateBrushComponent(i,n)}):(this._brushComponents=[],this._relativeRegions.forEach((i,n)=>{this._createBrushComponent(i,n)})))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach(t=>{t._container.incrementalClearChild()})}clear(){var t;this._brushComponents&&((t=this.getContainer())===null||t===void 0||t.removeChild(this._brushComponents),this._brushComponents.forEach(e=>{e.removeAllChild(),e.releaseBrushEvents()}),this._brushComponents=null),super.clear()}}p_.type=J.brush,p_.specKey="brush";const Wnt=()=>{I.registerComponent(p_.type,p_)};class Ku extends Ri{constructor(){super(...arguments),this.type=Ku.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}Ku.type="image";const Nnt=()=>{I.registerMark(Ku.type,Ku),C7()};class g_ extends ds{constructor(){super(...arguments),this.type=J.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=he.CustomMark,this.layoutLevel=xn.CustomMark}static getSpecInfo(t){const e=t[this.specKey];return e?[{spec:e,specIndex:0,specPath:[this.specKey],type:J.customMark}]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach((t,e)=>{this._createExtensionMark(t,null,`${xt}_series_${this.id}_extensionMark`,e)})}_createExtensionMark(t,e,i,n){var r;const a=this._createMark({type:t.type,name:`${xt}_${n}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext()});if(a&&(C(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),t.type==="group"&&(i=`${i}_${n}`,(r=t.children)===null||r===void 0||r.forEach((o,l)=>{this._createExtensionMark(o,a,i,l)})),E(t.dataId)||H(t.dataIndex))){const o=this.getChart().getSeriesData(t.dataId,t.dataIndex);o&&(o.target.addListener("change",()=>{a.getData().updateData()}),a.setDataView(o))}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return _e(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return(i=this._option.globalScale.getScale(t))===null||i===void 0?void 0:i.scale(e)}}}}g_.type=J.customMark,g_.specKey="customMark";const Vnt=()=>{Nnt(),I.registerComponent(g_.type,g_)};function OC(s,t,e=0){return e>Math.max(t.x1-s.x2,s.x1-t.x2,t.y1-s.y2,s.y1-t.y2)}function Unt(s){return{x1:s.x,x2:s.x+s.width,y1:s.y,y2:s.y+s.height}}function $nt(s){return{x:s.x1,y:s.y1,width:s.x2-s.x1,height:s.y2-s.y1}}function yI(s){var t;if(!s||s.length===0)return[];if(s.length===1)return[s[0].rect];const e=s.map(n=>{var r;return Object.assign(Object.assign({},n),{bound:Unt(n.rect),anchorCandidates:Knt((r=n.anchors)!==null&&r!==void 0?r:[],n.point,n.rect,n.offset)})}),i=[];i.push(e[0].bound);for(let n=1;n<=e.length-1;n++){const r=e[n],a=r.bound;let o=i.some(l=>OC(l,a));if(r.anchorCandidates)if(o&&((t=r.anchorCandidates)===null||t===void 0?void 0:t.length)>0){for(let l=0;l<r.anchorCandidates.length;l++){const h=r.anchorCandidates[l],d={x1:h.x,y1:h.y,x2:h.x+a.x2-a.x1,y2:h.y+a.y2-a.y1,anchor:h};if(!i.some(u=>OC(u,d))){i.push(d),o=!1;break}}o&&i.push(r.bound)}else i.push(r.bound)}return i.map(n=>$nt(n))}function Ynt(s,t,e){const i=s.map(h=>h.pointCoord),{x1:n,x2:r,y1:a,y2:o}=uF(i),l=e([(n+r)/2,(a+o)/2]);return l?yI(s.map(h=>{const d=h.rect,u=bI(t,h.pointCoord)?e(Xnt(t,[h.pointCoord.x,h.pointCoord.y],DC(LC(h.point,l)))):h.point;u&&(d.x=u.x,d.y=u.y);const c=DC(LC(h.point,l));let p;const g=[];return c>=-45&&c<45?(p="top",g.push("left","right")):c>=45&&c<135?p="right":c>=-135&&c<-45?(p="left",g.push("left")):(p="bottom",g.push("left","right")),h.anchors=g,h.offset=20,h.rect=zS(h.rect,p,0),h})):[]}function DC(s){return s>180?s-360:s}function LC(s,t){return 180*Math.atan2(s.y-t.y,s.x-t.x)/Math.PI+90}function Xnt(s,t,e,i=200){const n=5621/i;let r=t;for(let a=1;a<=n;a++){const o=AF(r,i,e);if(!bI(s,o))return[o.x,o.y];r=[o.x,o.y]}return t}function bI(s,t){for(let e=0;e<s.length;e++)if(SF(t,s[e]))return!0;return!1}function zS(s,t,e=0){const i=Object.assign({},s);return t==="top"?(i.x-=s.width/2,i.y-=e+s.height/2):t==="bottom"?(i.x-=s.width/2,i.y+=e-s.height/2):t==="left"?(i.x-=e+s.width,i.y-=s.height/2):t==="right"&&(i.x+=e,i.y-=s.height/2),i}function Knt(s,t,e,i=0){const n=[];return s.forEach(r=>{const{x:a,y:o}=zS(Object.assign(Object.assign({},t),{width:e.width,height:e.height}),r,i);n.push({x:a,y:o})}),n}class f_ extends ds{constructor(){super(...arguments),this.type=J.mapLabel,this.name=J.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=he.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){const e=t[this.specKey];return e&&e.visible&&!E(e.series)?[{spec:e,specPath:[this.specKey],type:J.mapLabel}]:null}setAttrFromSpec(){var t,e,i,n;this.nameField=(t=this._spec.nameField)!==null&&t!==void 0?t:(e=this._series)===null||e===void 0?void 0:e.getDimensionField()[0],this.valueField=(i=this._spec.valueField)!==null&&i!==void 0?i:(n=this._series)===null||n===void 0?void 0:n.getMeasureField()[0]}created(){super.created(),this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,r,a,o,l;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],this._spec.position==="outer"&&(this._map=(e=(t=this._regions[0].getSeriesInType("map")[0])===null||t===void 0?void 0:t.getMapViewData())===null||e===void 0?void 0:e.latestData,this._longitudeField=(r=(n=(i=this._regions[0]).getSpec)===null||n===void 0?void 0:n.call(i))===null||r===void 0?void 0:r.longitudeField,this._latitudeField=(l=(o=(a=this._regions[0]).getSpec)===null||o===void 0?void 0:o.call(a))===null||l===void 0?void 0:l.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const i=new Zt(this._option.dataSet,{name:`${this.name}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"copyDataView",level:Es.copyDataView},!1),this._data=new Cr(this._option,i),i.target.addListener("change",()=>{this._spec.trigger!=="hover"&&this._spec.trigger!=="click"&&(this._activeDatum=this._data.getLatestData())})}}initEvent(){this.event.on("zoom",{filter:e=>this._isRelativeModel(e.model)},e=>(this.handleZoom(e),!0)),this.event.on("panmove",{filter:e=>this._isRelativeModel(e.model)},e=>(this.handlePan(e),!0));const t=this._spec.trigger;t!=="none"&&(t==="hover"?(this.event.on("hovered",{filter:e=>this._isRelativeSeries(e.model)},e=>{this._updateDatum(e.value)}),this.event.on("unhovered",()=>{this._updateDatum([])})):t==="click"&&(this.event.on("selected",{filter:e=>this._isRelativeSeries(e.model)},e=>{this._updateDatum(e.value)}),this.event.on("unselected",()=>{this._updateDatum([])})))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach(i=>{i.translate(e[0],e[1])})}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach((e,i)=>{var n;const r=(n=this._data)===null||n===void 0?void 0:n.getLatestData()[i];this._activeDatum.includes(r)?e.setAttribute("visible",!0):e.setAttribute("visible",!1)})}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=(t=this._data)===null||t===void 0?void 0:t.getLatestData();e&&e.length!==0&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=(t=this._data)===null||t===void 0?void 0:t.getLatestData().map((r,a)=>{var o;const l=new jx({position:void 0});return l&&(l.name=`${this.name}_marker_${a}`,l.id=(o=this._spec.id)!==null&&o!==void 0?o:`${this.name}_marker_${this.id}`,l.setAttribute("zIndex",this.layoutZIndex)),l})),this._markerComponents.forEach((r,a)=>{r.removeAllChild();const{pairInfo:o,contentMarks:l}=this._evaluateMarker(this._data.getLatestData()[a],a);o&&e.push(o),l&&i.push(l)});const n=this._layoutLabels(e);this._layoutMarkers(n,i),this._renderMarkers()}_evaluateMarker(t,e){var i,n,r,a,o,l,h,d,u,c,p,g;let f=0,_=0,m=0,v=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=Ar((i=this._spec.background)===null||i===void 0?void 0:i.padding),A=this._spec.space||0;_+=((S==null?void 0:S.left)||0)+((S==null?void 0:S.right)||0),m+=((S==null?void 0:S.top)||0)+((S==null?void 0:S.bottom)||0);const k={},w=this.dataToPosition(t),T=sx({});if(T.name=`${this.name}_marker_itemContainer_${e}`,k.container=T,(n=this._spec.background)===null||n===void 0?void 0:n.visible){const R=nh(At(Object.assign({},this._spec.background.style)));R.setAttributes(w),k.labelBackground=R,T.appendChild(R)}if(!((r=this._spec.icon)===null||r===void 0)&&r.visible){const R=F_(At(Object.assign({},this._spec.icon.style)));R.setAttributes(w),R.setAttribute("symbolType",(a=this._spec.icon.style)===null||a===void 0?void 0:a.shape);const L=R.AABBBounds,B=(o=(L==null?void 0:L.y2)-(L==null?void 0:L.y1))!==null&&o!==void 0?o:0,F=(l=(L==null?void 0:L.x2)-(L==null?void 0:L.x1))!==null&&l!==void 0?l:0;k.icon=R,T.appendChild(R),y=B,v+=F,f++}if(!((h=this._spec.nameLabel)===null||h===void 0)&&h.visible){const R=oo(At(Object.assign({},this._spec.nameLabel.style)));R.setAttributes(w),R.setAttribute("text",t[this.nameField]);const L=R.AABBBounds,B=(d=(L==null?void 0:L.y2)-(L==null?void 0:L.y1))!==null&&d!==void 0?d:0,F=(u=(L==null?void 0:L.x2)-(L==null?void 0:L.x1))!==null&&u!==void 0?u:0;k.nameLabel=R,T.appendChild(R),y=Math.max(y,B),v+=F,f++}if(!((c=this._spec.valueLabel)===null||c===void 0)&&c.visible&&E(t[this.valueField])){const R=oo(At(Object.assign({},this._spec.valueLabel.style)));R.setAttributes(w),R.setAttribute("text",t[this.valueField]);const L=R.AABBBounds,B=(p=(L==null?void 0:L.y2)-(L==null?void 0:L.y1))!==null&&p!==void 0?p:0,F=(g=(L==null?void 0:L.x2)-(L==null?void 0:L.x1))!==null&&g!==void 0?g:0;k.valueLabel=R,T.appendChild(R),y=Math.max(y,B),v+=F,f++}const M=Object.values(k).find(R=>!!R&&R.type!=="group"),P={x:M==null?void 0:M.getComputedAttribute("x"),y:M==null?void 0:M.getComputedAttribute("y")},O={x:P.x,y:P.y,width:0,height:0};O.width=_+v+(f-1)*A,O.height=m+y;const D={rect:O,point:P,index:e};if(b!=="outer"){const R=["top","right","left","bottom"].filter(L=>L!==b);D.rect=zS(O,b,x),D.anchors=R,D.offset=x}else D.pointCoord={x:+(t==null?void 0:t[this._longitudeField]),y:+(t==null?void 0:t[this._latitudeField])};return{pairInfo:D,contentMarks:k}}_layoutMarkers(t,e){var i,n,r;for(let a=0;a<e.length;a++){if(!t[a]||!e[a])return;const{icon:o,nameLabel:l,valueLabel:h,labelBackground:d,container:u}=e[a],c=t[a],p=Ar((i=this._spec.background)===null||i===void 0?void 0:i.padding),g=this._spec.space||0,f=c.height/2;let _=(p==null?void 0:p.left)||0;[o,l,h].forEach((x,S)=>{var A,k;if(x){const w=x.AABBBounds;let T=0;x.type==="symbol"&&(T+=((A=w.x2-w.x1)!==null&&A!==void 0?A:0)/2),x.setAttributes({x:_+T,y:f}),_+=(k=w.x2-w.x1)!==null&&k!==void 0?k:0,S!==2&&(_+=g)}}),d==null||d.setAttributes({x:0,y:0,width:c.width,height:c.height}),u==null||u.setAttributes({dx:-c.width/2,dy:-c.height/2});const m=this._data.getLatestData()[a],v=this.dataToPosition(m),y=this.getRegions()[0].getLayoutStartPoint(),b=!(!(!((n=this._spec.leader)===null||n===void 0)&&n.visible)||!(o||l||h));this._markerComponents[a].setAttributes({x:y.x,y:y.y,position:v,visible:this._activeDatum.includes(m),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>u,autoRotate:!1,offsetX:c.x+c.width/2-v.x,offsetY:c.y+c.height/2-v.y},itemLine:{visible:b,type:"type-po",lineStyle:At(Object.assign({},(r=this._spec.leader)===null||r===void 0?void 0:r.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;t<this._markerComponents.length;t++)this.getContainer().add(this._markerComponents[t])}_layoutLabels(t){return this._spec.position==="outer"&&this._map?Ynt(t,this._map,e=>this._series.dataToPosition({[this._longitudeField]:e[0],[this._latitudeField]:e[1]})):yI(t)}_isRelativeModel(t){var e,i,n;const r=(i=(e=this._series.getXAxisHelper())===null||e===void 0?void 0:e.getAxisId())!==null&&i!==void 0?i:(n=this._series.getCoordinateHelper())===null||n===void 0?void 0:n.getCoordinateId();return(t==null?void 0:t.id)===r}_isRelativeSeries(t){return(t==null?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}f_.type=J.mapLabel,f_.specKey="mapLabel";const qnt=()=>{I.registerComponent(f_.type,f_)};class Ab{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=e==null?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,n;t.col=(e=t.col)!==null&&e!==void 0?e:1,t.row=(i=t.row)!==null&&i!==void 0?i:1,t.elements=(n=t.elements)!==null&&n!==void 0?n:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}),this._rowSize.forEach((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})}setSizeFromUserSetting(t,e,i,n){t.forEach(r=>{r.index<0&&r.index>=i||(H(r.size)?e[r.index]={value:+r.size,isUserSetting:!0,isLayoutSetting:!1}:q(r.size)&&(e[r.index]={value:r.size(n),isUserSetting:!0,isLayoutSetting:!1}))})}clearLayoutSize(){this._colSize.forEach(t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}),this._rowSize.forEach(t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let n;return n=(e=this._gridInfo.elements)===null||e===void 0?void 0:e.find(r=>{var a;if("modelId"in r&&E(r.modelId)){if(E(t.model.userId)&&t.model.userId===r.modelId)return!0}else if("modelKey"in r&&E(r.modelKey)&&"modelIndex"in r&&E(r.modelIndex)&&((a=t.model.specKey)!==null&&a!==void 0?a:t.model.type)===r.modelKey&&t.model.getSpecIndex()===r.modelIndex)return!0;return!1}),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){var i;const n=e==="col"?this._colSize:this._rowSize;let r=0;for(let a=t[e];a<t[e]+((i=t[`${e}Span`])!==null&&i!==void 0?i:1);a++)r+=n[a].value;return r}getSizeFromUser(t,e){var i,n;const r=e==="col"?this._colSize:this._rowSize;if(!(!((i=r[t[e]])===null||i===void 0)&&i.isUserSetting))return;let a=0;for(let o=t[e];o<t[e]+((n=t[`${e}Span`])!==null&&n!==void 0?n:1);o++){if(!r[o].isUserSetting)return;a+=r[o].value}return a}setItemLayoutSizeToGrid(t,e){if(Qh(t)){if(e.colSpan&&e.colSpan>1||this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1||this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e=t==="col"?this._colSize:this._rowSize;let i=t==="col"?this._chartLayoutRect.width:this._chartLayoutRect.height;const n=[];e.forEach(r=>{r.isUserSetting||r.isLayoutSetting?i-=r.value:n.push(r)}),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach(r=>r.value=i/n.length)}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let n=0;n<e.col;n++)i.x+=this._colSize[n].value;for(let n=0;n<e.row;n++)i.y+=this._rowSize[n].value;return i.x+=t.layoutPaddingLeft+t.layoutOffsetX,i.y+=t.layoutPaddingTop+t.layoutOffsetY,i}getItemLayoutRect(t){var e,i;const n=this.getItemGridInfo(t);return{width:((e=this.getSizeFromGird(n,"col"))!==null&&e!==void 0?e:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:((i=this.getSizeFromGird(n,"row"))!==null&&i!==void 0?i:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom}}layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this.clearLayoutSize(),e.sort((u,c)=>c.layoutLevel-u.layoutLevel);const r=e.filter(u=>u.layoutType==="normal"&&u.getModelVisible()!==!1),a=r.filter(u=>Qh(u)),o=r.filter(u=>!Qh(u));r.forEach(u=>{this.layoutOneItem(u,"user",!1)});const l=e.filter(u=>u.layoutType==="region-relative"),h=l.filter(u=>Qh(u)),d=l.filter(u=>!Qh(u));h.forEach(u=>this.layoutOneItem(u,"user",!1)),this.layoutGrid("col"),o.forEach(u=>this.layoutOneItem(u,"colGrid",!1)),d.forEach(u=>{this.layoutOneItem(u,"colGrid",!1)}),this.layoutGrid("row"),d.forEach(u=>{this.layoutOneItem(u,"grid",!1)}),a.forEach(u=>this.layoutOneItem(u,"grid",!1)),h.forEach(u=>{this.layoutOneItem(u,"grid",!0)}),this.layoutGrid("col"),e.filter(u=>u.layoutType==="region").forEach(u=>this.layoutOneItem(u,"grid",!1)),this.layoutAbsoluteItems(e.filter(u=>u.layoutType==="absolute")),e.filter(u=>u.layoutType!=="absolute").forEach(u=>{u.setLayoutStartPosition(this.getItemPosition(u))})}layoutAbsoluteItems(t){t.forEach(e=>{e.absoluteLayoutInRect(this._chartLayoutRect)})}layoutOneItem(t,e,i){var n,r;const a=e==="rowGrid"||e==="grid"?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=e==="colGrid"||e==="grid"?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),l=this.getItemGridInfo(t),h={width:((n=o(l,"col"))!==null&&n!==void 0?n:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:((r=a(l,"row"))!==null&&r!==void 0?r:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},d=t.computeBoundsInRect(h);H(d.width)||(d.width=h.width),H(d.height)||(d.height=h.height),t.setLayoutRect(e!=="grid"?d:h),this.setItemLayoutSizeToGrid(t,l)}}function Qh(s){return s.layoutOrient==="left"||s.layoutOrient==="right"}Ab.type="grid";const Znt=()=>{I.registerLayout(Ab.type,Ab)};class kb extends nS{layoutItems(t,e,i,n){this._layoutInit(t,e,i,n),this._layoutNormalItems(e);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},a=e.filter(m=>m.layoutType==="absolute"),o=a.filter(m=>m.layoutOrient==="z");let l={width:0,height:0};o.length&&(l=o[0].getLayoutRect()),this.leftCurrent+=l.width/8,this.rightCurrent-=l.width/8,this.topCurrent+=l.height/8,this.bottomCurrent-=l.height/8;const{regionItems:h,relativeItems:d,relativeOverlapItems:u,allRelatives:c,overlapItems:p}=this._groupItems(e);this.layoutRegionItems(h,d,u,p),this._processAutoIndent(h,d,u,p,c,r);const g=a.filter(m=>m.layoutOrient!=="z");this.layoutAbsoluteItems(g);const f=d.filter(m=>m.model.specKey==="axes"&&Ce(m.layoutOrient))[0],_=d.filter(m=>m.model.specKey==="axes"&&dr(m.layoutOrient))[0];if(f&&o.length){const m=f.getLayoutStartPoint(),v=f.getLayoutRect(),y={x:_.layoutOrient==="left"?m.x+v.width:m.x,y:m.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};o[0].model.directionStr=_.layoutOrient==="left"?"r2l":"l2r";const b=f.getLayoutRect(),x=_.getLayoutRect(),S={length:o[0].getLayoutRect().width,width:b.width,height:x.height};f.model.setLayout3dBox&&f.model.setLayout3dBox(S),_.model.setLayout3dBox&&_.model.setLayout3dBox(S),o[0].model.setLayout3dBox&&o[0].model.setLayout3dBox(S),this.layoutZAxisItems(o,y)}}layoutZAxisItems(t,e){t.forEach(i=>{i.absoluteLayoutInRect(e)})}getItemComputeLayoutRect(t,e){return e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this.rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this.bottomCurrent;return t.forEach(r=>{if(!r.getModelVisible()||!r.autoIndent)return;const a=r.layoutOrient==="left"||r.layoutOrient==="right",o=r.getLastComputeOutBounds();a?(e.top=Math.max(e.top,o.y1-this.topCurrent),e.bottom=Math.max(e.bottom,o.y2-n)):(e.left=Math.max(e.left,o.x1-this.leftCurrent),e.right=Math.max(e.right,o.x2-i))}),e}}kb.type="layout3d";const Jnt=()=>{I.registerLayout(kb.type,kb)},Qnt=()=>{o8()};Mi.useRegisters([DZ,GZ,$Z,eJ,bit,Sit,Ait,Mit,yit,Eit,Rit,Oit,Bit,Nit,Vit,Pit,Fit,jit,$it,Hit,Git,Wit,Uit,Yit,Tit,Xit,kit,YZ,xit,Cit,Iit,zit,Dit,Lit,sst,nst,rst,ast,ost,hst,lst,gst,Sst,int,rnt,ant,ont,lnt,dnt,KL,Gnt,knt,Tnt,wnt,Ent,jnt,Hnt,Wnt,Vnt,qnt,Qnt,Znt,Jnt]);var trt=function(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e};function ert(s,t="ChartContainer",e){const i=Wi.forwardRef((n,r)=>{const a=yt.useRef(),[o,l]=yt.useState(!1),{className:h,style:d,width:u}=n,c=trt(n,["className","style","width"]);return yt.useLayoutEffect(()=>{l(!0)},[]),Wi.createElement("div",{ref:a,className:h,style:Object.assign({position:"relative",height:n.height||"100%",width:n.width||"100%"},d)},o?Wi.createElement(s,Object.assign({ref:r,container:a.current},e?e(c):c)):Wi.createElement(Wi.Fragment,null))});return i.displayName=t||s.name,i}const xI=Wi.createContext(null);xI.displayName="ChartContext";const SI=Wi.createContext(null);SI.displayName="ViewContext";const AI=s=>{let t=[];return Wi.Children.forEach(s,e=>{C(e)||(YI.isFragment(e)?t=t.concat(AI(e.props.children)):t.push(e))}),t},irt=["children","hooks","ref"],qu={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerUpOutside:"pointerupoutside",onPointerTap:"pointertap",onPointerOver:"pointerover",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerOut:"pointerout",onMouseDown:"mousedown",onMouseUp:"mouseup",onMouseUpOutside:"mouseupoutside",onMouseMove:"mousemove",onMouseOver:"mouseover",onMouseOut:"mouseout",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onPinch:"pinch",onPinchStart:"pinchstart",onPinchEnd:"pinchend",onPan:"pan",onPanStart:"panstart",onPanEnd:"panend",onDrag:"drag",onDragStart:"dragstart",onDragEnter:"dragenter",onDragLeave:"dragleave",onDragOver:"dragover",onDragEnd:"dragend",onRightDown:"rightdown",onRightUp:"rightup",onRightUpOutside:"rightupoutside",onTouchStart:"touchstart",onTouchEnd:"touchend",onTouchEndOutside:"touchendoutside",onTouchMove:"touchmove",onTouchCancel:"touchcancel",onPress:"press",onPressUp:"pressup",onPressEnd:"pressend",onSwipe:"swipe",onDrop:"drop",onWeel:"wheel",onClick:"click",onDblClick:"dblclick"},srt={onLegendItemHover:"legendItemHover",onLegendItemUnHover:"legendItemUnHover",onLegendItemClick:"legendItemClick",onLegendFilter:"legendFilter",onLegendSelectedDataChange:"legendSelectedDataChange"},nrt={onBrushStart:"brushStart",onBrushChange:"brushChange",onBrushEnd:"brushEnd",onBrushClear:"brushClear"},rrt={onDataZoomChange:"dataZoomChange"},art={onPlayerPlay:"playerPlay",onPlayerPause:"playerPause",onPlayerEnd:"playerEnd",onPlayerChange:"playerChange",onPlayerForward:"playerForward",onPlayerBackward:"playerBackward"},ort={onScrollBarChange:"scrollBarChange"},lrt={onDimensionHover:"dimensionHover",onDimensionClick:"dimensionClick"},hrt={onDrill:"drill"},drt={onInitialized:"initialized",onRendered:"rendered",onRenderFinished:"renderFinished",onAnimationFinished:"animationFinished",onLayoutStart:"layoutStart",onLayoutEnd:"layoutEnd"},wb=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},srt),nrt),art),rrt),ort),lrt),drt),hrt),qu),urt=Object.keys(wb);Object.keys(qu).reduce((s,t)=>(s[qu[t]]=t,s),{});const BC=(s,t=qu)=>{const e={};return Object.keys(s).forEach(i=>{t[i]&&(e[i]=s[i])}),e},IC=(s,t,e,i=qu)=>{if(!t&&!e||!s)return!1;const n=e?BC(e,i):null,r=t?BC(t,i):null;return n&&Object.keys(n).forEach(a=>{(!r||!r[a]||r[a]!==n[a])&&s.off(i[a],e[a])}),r&&Object.keys(r).forEach(a=>{n&&n[a]&&n[a]===r[a]||s.on(i[a],r[a])}),!0},FC=[...irt,...urt,"skipFunctionDiff","onError","onReady","spec","container","options"],crt=Wi.forwardRef((s,t)=>{const[e,i]=yt.useState(0),n=yt.useRef({specFromChildren:{}});yt.useImperativeHandle(t,()=>{var f;return(f=n.current)===null||f===void 0?void 0:f.chart});const r=!!s.spec,[a,o]=yt.useState(null),l=yt.useRef(!1),h=yt.useRef(Kl(s,FC)),d=Wi.useRef(null),u=!!s.skipFunctionDiff,c=!!s.useSyncRender,p=f=>{var _;return r&&f.spec?f.spec:Object.assign(Object.assign({},h.current),(_=n.current)===null||_===void 0?void 0:_.specFromChildren)},g=()=>{if(!l.current){if(!n.current||!n.current.chart)return;IC(n.current.chart,s,d.current,wb);const f=n.current.chart.getCompiler().getVGrammarView();i(e+1),s.onReady&&s.onReady(n.current.chart,e===0),o(f)}};return yt.useEffect(()=>{var f;if(!(!((f=n.current)===null||f===void 0)&&f.chart))return(m=>{const v=new m.vchartConstrouctor(p(m),Object.assign(Object.assign({},m.options),{onError:m.onError,autoFit:!0,dom:m.container}));n.current=Object.assign(Object.assign({},n.current),{chart:v})})(s),n.current.chart&&(c?(n.current.chart.renderSync(),g()):n.current.chart.renderAsync().then(g)),IC(n.current.chart,s,null,wb),n.current=Object.assign(Object.assign({},n.current),{isChildrenUpdated:!1}),void(d.current=s);if(r)return void(_e(d.current.spec,s.spec,{skipFunction:u})||(d.current=s,c?(n.current.chart.updateSpecSync(p(s),void 0,{morph:!1,enableExitAnimation:!1}),g()):n.current.chart.updateSpec(p(s),void 0,{morph:!1,enableExitAnimation:!1}).then(g)));const _=Kl(s,FC);_e(_,h.current,{skipFunction:u})&&!n.current.isChildrenUpdated||(h.current=_,c?(n.current.chart.updateSpecSync(p(s),void 0,{morph:!1,enableExitAnimation:!1}),g()):n.current.chart.updateSpec(p(s),void 0,{morph:!1,enableExitAnimation:!1}).then(g)),n.current=Object.assign(Object.assign({},n.current),{isChildrenUpdated:!1})},[s]),yt.useEffect(()=>()=>{n&&(n.current.chart&&n.current.chart.release(),n.current=null),l.current=!0},[]),Wi.createElement(xI.Provider,{value:n.current},Wi.createElement(SI.Provider,{value:a},AI(s.children).map((f,_)=>{var m,v,y;return Wi.createElement(Wi.Fragment,{key:(y=(v=(m=f==null?void 0:f.props)===null||m===void 0?void 0:m.id)!==null&&v!==void 0?v:f==null?void 0:f.id)!==null&&y!==void 0?y:`child-${_}`},Wi.cloneElement(f,{updateId:e}))})))}),prt=(s,t,e)=>{const i=ert(crt,s,n=>t?Object.assign(n,t):n);return i.displayName=s,i},_d=prt("VChart",{vchartConstrouctor:Mi}),grt=({groupedStatsData:s,loading:t,getTrendSpec:e,CARD_PROPS:i,CHART_CONFIG:n})=>{const r=WC(),{t:a}=VC();return $.jsx("div",{className:"mb-4",children:$.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:s.map((o,l)=>$.jsx(Sh,{...i,className:`${o.color} border-0 !rounded-2xl w-full`,title:o.title,children:$.jsx("div",{className:"space-y-4",children:o.items.map((h,d)=>$.jsxs("div",{className:"flex items-center justify-between cursor-pointer",onClick:h.onClick,children:[$.jsxs("div",{className:"flex items-center",children:[$.jsx(zC,{className:"mr-3",size:"small",color:h.avatarColor,children:h.icon}),$.jsxs("div",{children:[$.jsx("div",{className:"text-xs text-gray-500",children:h.title}),$.jsx("div",{className:"text-lg font-semibold",children:$.jsx(GS,{loading:t,active:!0,placeholder:$.jsx(GS.Paragraph,{active:!0,rows:1,style:{width:"65px",height:"24px",marginTop:"4px"}}),children:h.value})})]})]}),h.title===a("当前余额")?$.jsx(Xd,{color:"white",shape:"circle",size:"large",onClick:u=>{u.stopPropagation(),r("/console/topup")},children:a("充值")}):(t||h.trendData&&h.trendData.length>0)&&$.jsx("div",{className:"w-24 h-10",children:$.jsx(_d,{spec:e(h.trendData,h.trendColor),option:n})})]},d))})},l))})})},frt=({activeChartTab:s,setActiveChartTab:t,spec_line:e,spec_model_line:i,spec_pie:n,spec_rank_bar:r,CARD_PROPS:a,CHART_CONFIG:o,FLEX_CENTER_GAP2:l,hasApiInfoPanel:h,t:d})=>$.jsx(Sh,{...a,className:`!rounded-2xl ${h?"lg:col-span-3":""}`,title:$.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between w-full gap-3",children:[$.jsxs("div",{className:l,children:[$.jsx(c2,{size:16}),d("模型数据分析")]}),$.jsxs(HC,{type:"slash",activeKey:s,onChange:t,children:[$.jsx(td,{tab:$.jsx("span",{children:d("消耗分布")}),itemKey:"1"}),$.jsx(td,{tab:$.jsx("span",{children:d("消耗趋势")}),itemKey:"2"}),$.jsx(td,{tab:$.jsx("span",{children:d("调用次数分布")}),itemKey:"3"}),$.jsx(td,{tab:$.jsx("span",{children:d("调用次数排行")}),itemKey:"4"})]})]}),bodyStyle:{padding:0},children:$.jsxs("div",{className:"h-96 p-2",children:[s==="1"&&$.jsx(_d,{spec:e,option:o}),s==="2"&&$.jsx(_d,{spec:i,option:o}),s==="3"&&$.jsx(_d,{spec:n,option:o}),s==="4"&&$.jsx(_d,{spec:r,option:o})]})}),xh=yt.forwardRef(({children:s,maxHeight:t="24rem",className:e="",contentClassName:i="",fadeIndicatorClassName:n="",checkInterval:r=100,scrollThreshold:a=5,debounceDelay:o=16,onScroll:l,onScrollStateChange:h,...d},u)=>{const c=yt.useRef(null),p=yt.useRef(null),g=yt.useRef(null),f=yt.useRef(null),_=yt.useRef(h),m=yt.useRef(l),[v,y]=yt.useState(!1);yt.useEffect(()=>{_.current=h},[h]),yt.useEffect(()=>{m.current=l},[l]);const b=yt.useCallback((T,M)=>(...P)=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>T(...P),M)},[]),x=yt.useCallback(()=>{if(!c.current)return;const T=c.current,M=T.scrollHeight>T.clientHeight,P=T.scrollTop+T.clientHeight>=T.scrollHeight-a,O=M&&!P;y(O),_.current&&_.current({isScrollable:M,isAtBottom:P,showScrollHint:O,scrollTop:T.scrollTop,scrollHeight:T.scrollHeight,clientHeight:T.clientHeight})},[a]),S=yt.useMemo(()=>b(x,o),[b,x,o]),A=yt.useCallback(T=>{S(),m.current&&m.current(T)},[S]);yt.useImperativeHandle(u,()=>({checkScrollable:()=>{x()},scrollToTop:()=>{c.current&&(c.current.scrollTop=0)},scrollToBottom:()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)},getScrollInfo:()=>{if(!c.current)return null;const T=c.current;return{scrollTop:T.scrollTop,scrollHeight:T.scrollHeight,clientHeight:T.clientHeight,isScrollable:T.scrollHeight>T.clientHeight,isAtBottom:T.scrollTop+T.clientHeight>=T.scrollHeight-a}}}),[x,a]),yt.useEffect(()=>{const T=setTimeout(()=>{x()},r);return()=>clearTimeout(T)},[x,r]),yt.useEffect(()=>{if(c.current){if(typeof ResizeObserver>"u"){if(typeof MutationObserver<"u"){const T=new MutationObserver(()=>{S()});return T.observe(c.current,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>T.disconnect()}return}return f.current=new ResizeObserver(T=>{for(const M of T)S()}),f.current.observe(c.current),()=>{f.current&&f.current.disconnect()}}},[S]),yt.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const k=yt.useMemo(()=>({maxHeight:t}),[t]),w=yt.useMemo(()=>({opacity:v?1:0}),[v]);return $.jsxs("div",{ref:p,className:`card-content-container ${e}`,...d,children:[$.jsx("div",{ref:c,className:`overflow-y-auto card-content-scroll ${i}`,style:k,onScroll:A,children:s}),$.jsx("div",{className:`card-content-fade-indicator ${n}`,style:w})]})});xh.displayName="ScrollableContainer";const _rt=({apiInfoData:s,handleCopyUrl:t,handleSpeedTest:e,CARD_PROPS:i,FLEX_CENTER_GAP2:n,ILLUSTRATION_SIZE:r,t:a})=>$.jsx(Sh,{...i,className:"bg-gray-50 border-0 !rounded-2xl",title:$.jsxs("div",{className:n,children:[$.jsx(XI,{size:16}),a("API信息")]}),bodyStyle:{padding:0},children:$.jsx(xh,{maxHeight:"24rem",children:s.length>0?s.map(o=>$.jsxs(Wi.Fragment,{children:[$.jsxs("div",{className:"flex p-2 hover:bg-white rounded-lg transition-colors cursor-pointer",children:[$.jsx("div",{className:"flex-shrink-0 mr-3",children:$.jsx(zC,{size:"extra-small",color:o.color,children:o.route.substring(0,2)})}),$.jsxs("div",{className:"flex-1",children:[$.jsxs("div",{className:"flex flex-wrap items-center justify-between mb-1 w-full gap-2",children:[$.jsx("span",{className:"text-sm font-medium text-gray-900 !font-bold break-all",children:o.route}),$.jsxs("div",{className:"flex items-center gap-1 mt-1 lg:mt-0",children:[$.jsx(Xd,{prefixIcon:$.jsx(Gp,{size:12}),size:"small",color:"white",shape:"circle",onClick:()=>e(o.url),className:"cursor-pointer hover:opacity-80 text-xs",children:a("测速")}),$.jsx(Xd,{prefixIcon:$.jsx(g2,{size:12}),size:"small",color:"white",shape:"circle",onClick:()=>window.open(o.url,"_blank","noopener,noreferrer"),className:"cursor-pointer hover:opacity-80 text-xs",children:a("跳转")})]})]}),$.jsx("div",{className:"!text-semi-color-primary break-all cursor-pointer hover:underline mb-1",onClick:()=>t(o.url),children:o.url}),$.jsx("div",{className:"text-gray-500",children:o.description})]})]}),$.jsx(jC,{})]},o.id)):$.jsx("div",{className:"flex justify-center items-center min-h-[20rem] w-full",children:$.jsx(Zu,{image:$.jsx(Qu,{style:r}),darkModeImage:$.jsx(Ju,{style:r}),title:a("暂无API信息"),description:a("请联系管理员在系统设置中配置API信息")})})})}),mrt=({announcementData:s,announcementLegendData:t,CARD_PROPS:e,ILLUSTRATION_SIZE:i,t:n})=>$.jsx(Sh,{...e,className:"shadow-sm !rounded-2xl lg:col-span-2",title:$.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-2 w-full",children:[$.jsxs("div",{className:"flex items-center gap-2",children:[$.jsx(KI,{size:16}),n("系统公告"),$.jsx(Xd,{color:"white",shape:"circle",children:n("显示最新20条")})]}),$.jsx("div",{className:"flex flex-wrap gap-3 text-xs",children:t.map((r,a)=>$.jsxs("div",{className:"flex items-center gap-1",children:[$.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r.color==="grey"?"#8b9aa7":r.color==="blue"?"#3b82f6":r.color==="green"?"#10b981":r.color==="orange"?"#f59e0b":r.color==="red"?"#ef4444":"#8b9aa7"}}),$.jsx("span",{className:"text-gray-600",children:r.label})]},a))})]}),bodyStyle:{padding:0},children:$.jsx(xh,{maxHeight:"24rem",children:s.length>0?$.jsx(WS,{mode:"left",children:s.map((r,a)=>{const o=r.extra?Jv.parse(r.extra):"";return $.jsx(WS.Item,{type:r.type||"default",time:`${r.relative?r.relative+" ":""}${r.time}`,extra:r.extra?$.jsx("div",{className:"text-xs text-gray-500",dangerouslySetInnerHTML:{__html:o}}):null,children:$.jsx("div",{children:$.jsx("div",{dangerouslySetInnerHTML:{__html:Jv.parse(r.content||"")}})})},a)})}):$.jsx("div",{className:"flex justify-center items-center py-8",children:$.jsx(Zu,{image:$.jsx(Qu,{style:i}),darkModeImage:$.jsx(Ju,{style:i}),title:n("暂无系统公告"),description:n("请联系管理员在系统设置中配置公告信息")})})})}),vrt=({faqData:s,CARD_PROPS:t,FLEX_CENTER_GAP2:e,ILLUSTRATION_SIZE:i,t:n})=>$.jsx(Sh,{...t,className:"shadow-sm !rounded-2xl lg:col-span-1",title:$.jsxs("div",{className:e,children:[$.jsx(qI,{size:16}),n("常见问答")]}),bodyStyle:{padding:0},children:$.jsx(xh,{maxHeight:"24rem",children:s.length>0?$.jsx(NS,{accordion:!0,expandIcon:$.jsx(LI,{}),collapseIcon:$.jsx(DI,{}),children:s.map((r,a)=>$.jsx(NS.Panel,{header:r.question,itemKey:a.toString(),children:$.jsx("div",{dangerouslySetInnerHTML:{__html:Jv.parse(r.answer||"")}})},a))}):$.jsx("div",{className:"flex justify-center items-center py-8",children:$.jsx(Zu,{image:$.jsx(Qu,{style:i}),darkModeImage:$.jsx(Ju,{style:i}),title:n("暂无常见问答"),description:n("请联系管理员在系统设置中配置常见问答")})})})}),yrt=({uptimeData:s,uptimeLoading:t,activeUptimeTab:e,setActiveUptimeTab:i,loadUptimeData:n,uptimeLegendData:r,renderMonitorList:a,CARD_PROPS:o,ILLUSTRATION_SIZE:l,t:h})=>$.jsxs(Sh,{...o,className:"shadow-sm !rounded-2xl lg:col-span-1",title:$.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[$.jsxs("div",{className:"flex items-center gap-2",children:[$.jsx(Gp,{size:16}),h("服务可用性")]}),$.jsx(Zv,{icon:$.jsx(NC,{size:14}),onClick:n,loading:t,size:"small",theme:"borderless",type:"tertiary",className:"text-gray-500 hover:text-blue-500 hover:bg-blue-50 !rounded-full"})]}),bodyStyle:{padding:0},children:[$.jsx("div",{className:"relative",children:$.jsx(BI,{spinning:t,children:s.length>0?s.length===1?$.jsx(xh,{maxHeight:"24rem",children:a(s[0].monitors)}):$.jsx(HC,{type:"card",collapsible:!0,activeKey:e,onChange:i,size:"small",children:s.map((d,u)=>$.jsx(td,{tab:$.jsxs("span",{className:"flex items-center gap-2",children:[$.jsx(Gp,{size:14}),d.categoryName,$.jsx(Xd,{color:e===d.categoryName?"red":"grey",size:"small",shape:"circle",children:d.monitors?d.monitors.length:0})]}),itemKey:d.categoryName,children:$.jsx(xh,{maxHeight:"21.5rem",children:a(d.monitors)})},u))}):$.jsx("div",{className:"flex justify-center items-center py-8",children:$.jsx(Zu,{image:$.jsx(Qu,{style:l}),darkModeImage:$.jsx(Ju,{style:l}),title:h("暂无监控数据"),description:h("请联系管理员在系统设置中配置Uptime")})})})}),s.length>0&&$.jsx("div",{className:"p-3 bg-gray-50 rounded-b-2xl",children:$.jsx("div",{className:"flex flex-wrap gap-3 text-xs justify-center",children:r.map((d,u)=>$.jsxs("div",{className:"flex items-center gap-1",children:[$.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d.color}}),$.jsx("span",{className:"text-gray-600",children:d.label})]},u))})})]}),brt=({searchModalVisible:s,handleSearchConfirm:t,handleCloseModal:e,isMobile:i,isAdminUser:n,inputs:r,dataExportDefaultTime:a,timeOptions:o,handleInputChange:l,t:h})=>{const d=yt.useRef(),u={className:"w-full mb-2 !rounded-lg"},c=(_,m)=>$.jsx(_,{...u,...m}),{start_timestamp:p,end_timestamp:g,username:f}=r;return $.jsx(II,{title:h("搜索条件"),visible:s,onOk:t,onCancel:e,closeOnEsc:!0,size:i?"full-width":"small",centered:!0,children:$.jsxs(Fh,{ref:d,layout:"vertical",className:"w-full",children:[c(Fh.DatePicker,{field:"start_timestamp",label:h("起始时间"),initValue:p,value:p,type:"dateTime",name:"start_timestamp",onChange:_=>l(_,"start_timestamp")}),c(Fh.DatePicker,{field:"end_timestamp",label:h("结束时间"),initValue:g,value:g,type:"dateTime",name:"end_timestamp",onChange:_=>l(_,"end_timestamp")}),c(Fh.Select,{field:"data_export_default_time",label:h("时间粒度"),initValue:a,placeholder:h("时间粒度"),name:"data_export_default_time",optionList:o,onChange:_=>l(_,"data_export_default_time")}),n&&c(Fh.Input,{field:"username",label:h("用户名称"),value:f,placeholder:h("可选值"),name:"username",onChange:_=>l(_,"username")})]})})},xrt=(s,t,e)=>{var Zi,Tn,nn,Ke,Ae;const{t:i}=VC(),n=WC(),r=ZI(),a=yt.useRef(!1),[o,l]=yt.useState(!1),[h,d]=yt.useState(!1),[u,c]=yt.useState(!1),p=JI(o),[g,f]=yt.useState({username:"",token_name:"",model_name:"",start_timestamp:m2(),end_timestamp:kp(new Date().getTime()/1e3+3600),channel:"",data_export_default_time:""}),[_,m]=yt.useState(UC()),[v,y]=yt.useState([]),[b,x]=yt.useState(0),[S,A]=yt.useState(0),[k,w]=yt.useState(0),[T,M]=yt.useState([{type:"null",value:"0"}]),[P,O]=yt.useState([]),[D,R]=yt.useState({}),[L,B]=yt.useState("1"),[F,z]=yt.useState({balance:[],usedQuota:[],requestCount:[],times:[],consumeQuota:[],tokens:[],rpm:[],tpm:[]}),[N,V]=yt.useState([]),[G,X]=yt.useState(!1),[Z,et]=yt.useState(""),K=new Date,W=QI(),it=((Zi=e==null?void 0:e.status)==null?void 0:Zi.api_info_enabled)??!0,ht=((Tn=e==null?void 0:e.status)==null?void 0:Tn.announcements_enabled)??!0,dt=((nn=e==null?void 0:e.status)==null?void 0:nn.faq_enabled)??!0,Rt=((Ke=e==null?void 0:e.status)==null?void 0:Ke.uptime_kuma_enabled)??!0,gt=it,wt=ht||dt||Rt,kt=yt.useMemo(()=>l2.map(St=>({...St,label:i(St.label)})),[i]),Lt=yt.useMemo(()=>{const{start_timestamp:St,end_timestamp:$t}=g,We=(Date.parse($t)-Date.parse(St))/6e4,vs=isNaN(k/We)?"0":(k/We).toFixed(3),Mc=isNaN(S/We)?"0":(S/We).toFixed(3);return{avgRPM:vs,avgTPM:Mc,timeDiff:We}},[k,S,g.start_timestamp,g.end_timestamp]),Ot=yt.useMemo(()=>{var vs;const St=new Date().getHours();let $t="";St>=5&&St<12?$t=i("早上好"):St>=12&&St<14?$t=i("中午好"):St>=14&&St<18?$t=i("下午好"):$t=i("晚上好");const We=((vs=s==null?void 0:s.user)==null?void 0:vs.username)||"";return`👋${$t},${We}`},[i,(Ae=s==null?void 0:s.user)==null?void 0:Ae.username]),mi=yt.useCallback((St,$t)=>{if($t==="data_export_default_time"){m(St),localStorage.setItem("data_export_default_time",St);return}f(We=>({...We,[$t]:St}))},[]),Se=yt.useCallback(()=>{c(!0)},[]),us=yt.useCallback(()=>{c(!1)},[]),Ge=yt.useCallback(async()=>{l(!0);try{let St="";const{start_timestamp:$t,end_timestamp:We,username:vs}=g;let Mc=Date.parse($t)/1e3,HS=Date.parse(We)/1e3;W?St=`/api/data/?username=${vs}&start_timestamp=${Mc}&end_timestamp=${HS}&default_time=${_}`:St=`/api/data/self/?start_timestamp=${Mc}&end_timestamp=${HS}&default_time=${_}`;const MI=await Lm.get(St),{success:CI,message:PI,data:Ih}=MI.data;return CI?(y(Ih),Ih.length===0&&Ih.push({count:0,model_name:i("无数据"),quota:0,created_at:K.getTime()/1e3}),Ih.sort((EI,RI)=>EI.created_at-RI.created_at),Ih):(Bm(PI),[])}finally{l(!1)}},[g,_,W,K]),Li=yt.useCallback(async()=>{X(!0);try{const St=await Lm.get("/api/uptime/status"),{success:$t,message:We,data:vs}=St.data;$t?(V(vs||[]),vs&&vs.length>0&&!Z&&et(vs[0].categoryName)):Bm(We)}catch(St){console.error(St)}finally{X(!1)}},[Z]),ae=yt.useCallback(async()=>{let St=await Lm.get("/api/user/self");const{success:$t,message:We,data:vs}=St.data;$t?t({type:"login",payload:vs}):Bm(We)},[t]),me=yt.useCallback(async()=>{const St=await Ge();return await Li(),St},[Ge,Li]),ms=yt.useCallback(async St=>{const $t=await me();$t&&$t.length>0&&St&&St($t),c(!1)},[me]);return yt.useEffect(()=>{const St=setTimeout(()=>{d(!0)},100);return()=>clearTimeout(St)},[]),yt.useEffect(()=>{a.current||(ae(),a.current=!0)},[ae]),{loading:p,greetingVisible:h,searchModalVisible:u,inputs:g,dataExportDefaultTime:_,quotaData:v,consumeQuota:b,setConsumeQuota:x,consumeTokens:S,setConsumeTokens:A,times:k,setTimes:w,pieData:T,setPieData:M,lineData:P,setLineData:O,modelColors:D,setModelColors:R,activeChartTab:L,setActiveChartTab:B,trendData:F,setTrendData:z,uptimeData:N,uptimeLoading:G,activeUptimeTab:Z,setActiveUptimeTab:et,timeOptions:kt,performanceMetrics:Lt,getGreeting:Ot,isAdminUser:W,hasApiInfoPanel:gt,hasInfoPanels:wt,apiInfoEnabled:it,announcementsEnabled:ht,faqEnabled:dt,uptimeEnabled:Rt,handleInputChange:mi,showSearchModal:Se,handleCloseModal:us,loadQuotaData:Ge,loadUptimeData:Li,getUserData:ae,refresh:me,handleSearchConfirm:ms,navigate:n,t:i,isMobile:r}},Srt=(s,t,e,i,n,r,a,o)=>{var h,d,u;return{groupedStatsData:yt.useMemo(()=>{var c,p,g;return[{title:Pc(t2,o("账户数据")),color:"bg-blue-50",items:[{title:o("当前余额"),value:Wr((c=s==null?void 0:s.user)==null?void 0:c.quota),icon:$.jsx(FI,{}),avatarColor:"blue",trendData:[],trendColor:"#3b82f6"},{title:o("历史消耗"),value:Wr((p=s==null?void 0:s.user)==null?void 0:p.used_quota),icon:$.jsx(jI,{}),avatarColor:"purple",trendData:[],trendColor:"#8b5cf6"}]},{title:Pc(e2,o("使用统计")),color:"bg-green-50",items:[{title:o("请求次数"),value:(g=s.user)==null?void 0:g.request_count,icon:$.jsx(zI,{}),avatarColor:"green",trendData:[],trendColor:"#10b981"},{title:o("统计次数"),value:i,icon:$.jsx(HI,{}),avatarColor:"cyan",trendData:n.times,trendColor:"#06b6d4"}]},{title:Pc(i2,o("资源消耗")),color:"bg-yellow-50",items:[{title:o("统计额度"),value:Wr(t),icon:$.jsx(GI,{}),avatarColor:"yellow",trendData:n.consumeQuota,trendColor:"#f59e0b"},{title:o("统计Tokens"),value:isNaN(e)?0:e.toLocaleString(),icon:$.jsx(WI,{}),avatarColor:"pink",trendData:n.tokens,trendColor:"#ec4899"}]},{title:Pc(Gp,o("性能指标")),color:"bg-indigo-50",items:[{title:o("平均RPM"),value:r.avgRPM,icon:$.jsx(NI,{}),avatarColor:"indigo",trendData:n.rpm,trendColor:"#6366f1"},{title:o("平均TPM"),value:r.avgTPM,icon:$.jsx(VI,{}),avatarColor:"orange",trendData:n.tpm,trendColor:"#f97316"}]}]},[(h=s==null?void 0:s.user)==null?void 0:h.quota,(d=s==null?void 0:s.user)==null?void 0:d.used_quota,(u=s==null?void 0:s.user)==null?void 0:u.request_count,i,t,e,n,r,a,o])}},kI="Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif",Tb="theme-mode",wI=(s,t,e)=>{const i=s&&getComputedStyle(document.body).getPropertyValue(s)||t;return i&&!isNaN(i[0])?`rgba(${i})`:i},Art=(s,t,e)=>{new MutationObserver(i=>{i.forEach(n=>{n.attributeName===t&&e(n)})}).observe(s,{attributes:!0})},krt=(s,t,e,i)=>t.map((n,r)=>{const{scheme:a}=e[r];return Object.assign(Object.assign({},n),{scheme:n.scheme.map((o,l)=>wI(typeof o=="object"?o[s]:o,a==null?void 0:a[l]))})}),wrt=(s,t,e,i)=>{const n={};return Object.keys(t).forEach(r=>{const a=typeof t[r]=="object"?t[r][s]:t[r];n[r]=wI(a,e[r])}),n},TI=()=>document.body.hasAttribute(Tb)&&document.body.getAttribute(Tb)==="dark"?"dark":"light",Trt=s=>`semiDesign${s[0].toUpperCase()}${s.slice(1)}`,Mrt=s=>{new MutationObserver(t=>{t.forEach(e=>{var i;if(e.addedNodes.length===1){const n=e.addedNodes[0];n.tagName==="LINK"&&((i=n.getAttribute)===null||i===void 0?void 0:i.call(n,"semi-theme-switcher"))==="true"&&s(e,n)}})}).observe(document.body,{childList:!0})},Crt={default:{dataScheme:Au.colorScheme.default.dataScheme,palette:{backgroundColor:"#16161a",borderColor:"rgba(255,255,255,0.08)",shadowColor:"rgba(0,0,0,0.25)",hoverBackgroundColor:"rgba(255,255,255,0.12)",sliderRailColor:"rgba(255,255,255,0.12)",sliderHandleColor:"#e4e7f5",sliderTrackColor:"rgba(84,169,255,1)",popupBackgroundColor:"#43444a",primaryFontColor:"rgba(249,249,249,1)",secondaryFontColor:"rgba(249,249,249,0.8)",tertiaryFontColor:"rgba(249,249,249,0.6)",axisLabelFontColor:"rgba(249,249,249,0.6)",disableFontColor:"rgba(249,249,249,0.35)",axisMarkerFontColor:"#16161a",axisGridColor:"rgba(255,255,255,0.08)",axisDomainColor:"rgba(255,255,255,0.08)",dataZoomHandleStrokeColor:"rgba(46,50,56,0.13)",dataZoomChartColor:"rgba(255,255,255,0.16)",playerControllerColor:"rgba(84,169,255,1)",axisMarkerBackgroundColor:"rgba(249,249,249,1)",markLabelBackgroundColor:"rgba(255,255,255,0.08)",markLineStrokeColor:"rgba(249,249,249,0.8)",dangerColor:"rgba(252,114,90,1)",warningColor:"rgba(255,174,67,1)",successColor:"rgba(93,194,100,1)",infoColor:"rgba(84,169,255,1)"}}},Prt={name:"semiDesignDark",description:"Semi Design - dark",type:"dark",fontFamily:kI,colorScheme:Crt},Ert={default:{dataScheme:Au.colorScheme.default.dataScheme,palette:{backgroundColor:"rgba(255,255,255,1)",borderColor:"rgba(28,31,35,0.08)",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"rgba(46,50,56,0.05)",sliderRailColor:"rgba(46,50,56,0.05)",sliderHandleColor:"rgba(255,255,255,1)",sliderTrackColor:"rgba(0,100,250,1)",popupBackgroundColor:"rgba(255,255,255,1)",primaryFontColor:"rgba(28,31,35,1)",secondaryFontColor:"rgba(28,31,35,0.8)",tertiaryFontColor:"rgba(28,31,35,0.62)",axisLabelFontColor:"rgba(28,31,35,0.62)",disableFontColor:"rgba(28,31,35,0.35)",axisMarkerFontColor:"rgba(255,255,255,1)",axisGridColor:"rgba(28,31,35,0.08)",axisDomainColor:"rgba(28,31,35,0.15)",dataZoomHandleStrokeColor:"rgba(46,50,56,0.13)",dataZoomChartColor:"rgba(46,50,56,0.09)",playerControllerColor:"rgba(0,100,250,1)",axisMarkerBackgroundColor:"rgba(28,31,35,1)",markLabelBackgroundColor:"rgba(28,31,35,0.08)",markLineStrokeColor:"rgba(28,31,35,0.8)",dangerColor:"rgba(249,57,32,1)",warningColor:"rgba(252,136,0,1)",successColor:"rgba(59,179,70,1)",infoColor:"rgba(0,100,250,1)"}}},Rrt={name:"semiDesignLight",description:"Semi Design - light",type:"light",fontFamily:kI,colorScheme:Ert},Ort={backgroundColor:"--semi-color-bg-0",borderColor:"--semi-color-border",hoverBackgroundColor:"--semi-color-fill-0",sliderRailColor:"--semi-color-fill-0",sliderHandleColor:"--semi-white",sliderTrackColor:"--semi-color-primary",popupBackgroundColor:"--semi-color-bg-3",primaryFontColor:"--semi-color-text-0",secondaryFontColor:"--semi-color-text-1",tertiaryFontColor:"--semi-color-text-2",axisLabelFontColor:"--semi-color-text-0",disableFontColor:"--semi-color-disabled-text",axisMarkerFontColor:"--semi-color-bg-0",axisGridColor:"--semi-color-border",axisDomainColor:{light:"--semi-grey-9",dark:"--semi-color-border"},dataZoomHandleStrokeColor:{light:"--semi-color-fill-2"},dataZoomChartColor:"--semi-color-fill-1",playerControllerColor:"--semi-color-primary",axisMarkerBackgroundColor:"--semi-color-text-0",markLabelBackgroundColor:"--semi-color-border",markLineStrokeColor:"--semi-color-text-1",dangerColor:"--semi-color-danger",warningColor:"--semi-color-warning",successColor:"--semi-color-success",infoColor:"--semi-color-info"},Drt=[{maxDomainLength:10,scheme:["--semi-color-data-0","--semi-color-data-2","--semi-color-data-4","--semi-color-data-6","--semi-color-data-8","--semi-color-data-10","--semi-color-data-12","--semi-color-data-14","--semi-color-data-16","--semi-color-data-18"]},{scheme:["--semi-color-data-0","--semi-color-data-1","--semi-color-data-2","--semi-color-data-3","--semi-color-data-4","--semi-color-data-5","--semi-color-data-6","--semi-color-data-7","--semi-color-data-8","--semi-color-data-9","--semi-color-data-10","--semi-color-data-11","--semi-color-data-12","--semi-color-data-13","--semi-color-data-14","--semi-color-data-15","--semi-color-data-16","--semi-color-data-17","--semi-color-data-18","--semi-color-data-19"]}],Lrt={light:Rrt,dark:Prt},Mb=(s,t)=>{const e=Lrt[s],{dataScheme:i,palette:n}=e.colorScheme.default,r={default:{dataScheme:krt(s,Drt,i),palette:wrt(s,Ort,n)}};return Object.assign(Object.assign({},e),{colorScheme:r})},Brt=s=>{const{defaultMode:t,isWatchingMode:e=!0,isWatchingThemeSwitch:i=!1}=s??{};qv(!1,t),e&&Art(document.body,Tb,()=>qv()),i&&Mrt(()=>{const n=TI(),r=JSON.stringify(Mb(n).colorScheme);let a=0;const o=setInterval(()=>{const l=Mb(n);(a>50||r!==JSON.stringify(l.colorScheme))&&(qv(!0,n,l),clearInterval(o)),a++},100)})},qv=(s,t,e)=>{t||(t=TI());const i=Trt(t);(s||Mi.ThemeManager.getCurrentTheme()!==i)&&(s&&Mi.ThemeManager.removeTheme(i),Mi.ThemeManager.themeExist(i)||Mi.ThemeManager.registerTheme(i,e??Mb(t)),Mi.ThemeManager.setCurrentTheme(i))},Irt=(s,t,e,i,n,r,a,o,l)=>{const[h,d]=yt.useState({type:"pie",data:[{id:"id0",values:[{type:"null",value:"0"}]}],outerRadius:.8,innerRadius:.5,padAngle:.6,valueField:"value",categoryField:"type",pie:{style:{cornerRadius:10},state:{hover:{outerRadius:.85,stroke:"#000",lineWidth:1},selected:{outerRadius:.85,stroke:"#000",lineWidth:1}}},title:{visible:!0,text:l("模型调用次数占比"),subtext:`${l("总计")}:${ja(0)}`},legends:{visible:!0,orient:"left"},label:{visible:!0},tooltip:{mark:{content:[{key:y=>y.type,value:y=>ja(y.value)}]}},color:{specified:jh}}),[u,c]=yt.useState({type:"bar",data:[{id:"barData",values:[]}],xField:"Time",yField:"Usage",seriesField:"Model",stack:!0,legends:{visible:!0,selectMode:"single"},title:{visible:!0,text:l("模型消耗分布"),subtext:`${l("总计")}:${Wr(0,2)}`},bar:{state:{hover:{stroke:"#000",lineWidth:1}}},tooltip:{mark:{content:[{key:y=>y.Model,value:y=>Wr(y.rawQuota||0,4)}]},dimension:{content:[{key:y=>y.Model,value:y=>y.rawQuota||0}],updateContent:y=>{y.sort((x,S)=>S.value-x.value);let b=0;for(let x=0;x<y.length;x++){if(y[x].key=="其他")continue;let S=parseFloat(y[x].value);isNaN(S)&&(S=0),y[x].datum&&y[x].datum.TimeSum&&(b=y[x].datum.TimeSum),y[x].value=Wr(S,4)}return y.unshift({key:l("总计"),value:Wr(b,4)}),y}}},color:{specified:jh}}),[p,g]=yt.useState({type:"line",data:[{id:"lineData",values:[]}],xField:"Time",yField:"Count",seriesField:"Model",legends:{visible:!0,selectMode:"single"},title:{visible:!0,text:l("模型消耗趋势"),subtext:""},tooltip:{mark:{content:[{key:y=>y.Model,value:y=>ja(y.Count)}]}},color:{specified:jh}}),[f,_]=yt.useState({type:"bar",data:[{id:"rankData",values:[]}],xField:"Model",yField:"Count",seriesField:"Model",legends:{visible:!0,selectMode:"single"},title:{visible:!0,text:l("模型调用次数排行"),subtext:""},bar:{state:{hover:{stroke:"#000",lineWidth:1}}},tooltip:{mark:{content:[{key:y=>y.Model,value:y=>ja(y.Count)}]}},color:{specified:jh}}),m=yt.useCallback((y,b)=>{const x={};return Array.from(y).forEach(S=>{x[S]=jh[S]||b[S]||s2(S)}),x},[]),v=yt.useCallback(y=>{const b=w2(y,s,v2,YS),{totalQuota:x,totalTimes:S,totalTokens:A,uniqueModels:k,timePoints:w,timeQuotaMap:T,timeTokensMap:M,timeCountMap:P}=b,O=T2(w,T,M,P,s);t(O);const D=m(k,{});o(D);const R=M2(y,s),L=new Map;for(let[G,X]of R)YS(L,X.model,X.count);const B=Array.from(L).map(([G,X])=>({type:G,value:X})).sort((G,X)=>X.value-G.value),F=C2(R,y,s);let z=[];F.forEach(G=>{let X=Array.from(k).map(et=>{const K=`${G}-${et}`,W=R.get(K);return{Time:G,Model:et,rawQuota:(W==null?void 0:W.quota)||0,Usage:W!=null&&W.quota?n2(W.quota,4):0}});const Z=X.reduce((et,K)=>et+K.rawQuota,0);X.sort((et,K)=>K.rawQuota-et.rawQuota),X=X.map(et=>({...et,TimeSum:Z})),z.push(...X)}),z.sort((G,X)=>G.Time.localeCompare(X.Time)),Cc(d,B,`${l("总计")}:${ja(S)}`,D,"id0"),Cc(c,z,`${l("总计")}:${Wr(x,2)}`,D,"barData");let N=[];F.forEach(G=>{const X=Array.from(k).map(Z=>{const et=`${G}-${Z}`,K=R.get(et);return{Time:G,Model:Z,Count:(K==null?void 0:K.count)||0}});N.push(...X)}),N.sort((G,X)=>G.Time.localeCompare(X.Time));const V=Array.from(L).map(([G,X])=>({Model:G,Count:X})).sort((G,X)=>X.Count-G.Count);Cc(g,N,`${l("总计")}:${ja(S)}`,D,"lineData"),Cc(_,V,`${l("总计")}:${ja(S)}`,D,"rankData"),r(B),a(z),e(x),i(S),n(A)},[s,t,m,o,r,a,e,i,n,l]);return yt.useEffect(()=>{Brt({isWatchingThemeSwitch:!0})},[]),{spec_pie:h,spec_line:u,spec_model_line:p,spec_rank_bar:f,updateChartData:v,generateModelColors:m}},Frt=()=>{var g,f,_;const[s,t]=yt.useContext(r2),[e,i]=yt.useContext(a2),n=xrt(s,t,e),r=Irt(n.dataExportDefaultTime,n.setTrendData,n.setConsumeQuota,n.setTimes,n.setConsumeTokens,n.setPieData,n.setLineData,n.setModelColors,n.t),{groupedStatsData:a}=Srt(s,n.consumeQuota,n.consumeTokens,n.times,n.trendData,n.performanceMetrics,n.navigate,n.t),o=async()=>{await n.loadQuotaData().then(m=>{m&&m.length>0&&r.updateChartData(m)}),await n.loadUptimeData()},l=async()=>{const m=await n.refresh();m&&m.length>0&&r.updateChartData(m)},h=async()=>{await n.handleSearchConfirm(r.updateChartData)},d=((g=e==null?void 0:e.status)==null?void 0:g.api_info)||[],u=(((f=e==null?void 0:e.status)==null?void 0:f.announcements)||[]).map(m=>{const v=m!=null&&m.publishDate?new Date(m.publishDate):null,y=v&&!isNaN(v.getTime())?`${v.getFullYear()}-${String(v.getMonth()+1).padStart(2,"0")}-${String(v.getDate()).padStart(2,"0")} ${String(v.getHours()).padStart(2,"0")}:${String(v.getMinutes()).padStart(2,"0")}`:(m==null?void 0:m.publishDate)||"",b=o2(m.publishDate);return{...m,time:y,relative:b}}),c=((_=e==null?void 0:e.status)==null?void 0:_.faq)||[],p=Object.entries(Fm).map(([m,v])=>({status:Number(m),color:v.color,label:n.t(v.label)}));return yt.useEffect(()=>{o()},[]),$.jsxs("div",{className:"h-full",children:[$.jsx(P2,{getGreeting:n.getGreeting,greetingVisible:n.greetingVisible,showSearchModal:n.showSearchModal,refresh:l,loading:n.loading,t:n.t}),$.jsx(brt,{searchModalVisible:n.searchModalVisible,handleSearchConfirm:h,handleCloseModal:n.handleCloseModal,isMobile:n.isMobile,isAdminUser:n.isAdminUser,inputs:n.inputs,dataExportDefaultTime:n.dataExportDefaultTime,timeOptions:n.timeOptions,handleInputChange:n.handleInputChange,t:n.t}),$.jsx(grt,{groupedStatsData:a,loading:n.loading,getTrendSpec:y2,CARD_PROPS:To,CHART_CONFIG:VS}),$.jsx("div",{className:"mb-4",children:$.jsxs("div",{className:`grid grid-cols-1 gap-4 ${n.hasApiInfoPanel?"lg:grid-cols-4":""}`,children:[$.jsx(frt,{activeChartTab:n.activeChartTab,setActiveChartTab:n.setActiveChartTab,spec_line:r.spec_line,spec_model_line:r.spec_model_line,spec_pie:r.spec_pie,spec_rank_bar:r.spec_rank_bar,CARD_PROPS:To,CHART_CONFIG:VS,FLEX_CENTER_GAP2:Im,hasApiInfoPanel:n.hasApiInfoPanel,t:n.t}),n.hasApiInfoPanel&&$.jsx(_rt,{apiInfoData:d,handleCopyUrl:m=>b2(m,n.t),handleSpeedTest:x2,CARD_PROPS:To,FLEX_CENTER_GAP2:Im,ILLUSTRATION_SIZE:No,t:n.t})]})}),n.hasInfoPanels&&$.jsx("div",{className:"mb-4",children:$.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-4",children:[n.announcementsEnabled&&$.jsx(mrt,{announcementData:u,announcementLegendData:h2.map(m=>({...m,label:n.t(m.label)})),CARD_PROPS:To,ILLUSTRATION_SIZE:No,t:n.t}),n.faqEnabled&&$.jsx(vrt,{faqData:c,CARD_PROPS:To,FLEX_CENTER_GAP2:Im,ILLUSTRATION_SIZE:No,t:n.t}),n.uptimeEnabled&&$.jsx(yrt,{uptimeData:n.uptimeData,uptimeLoading:n.uptimeLoading,activeUptimeTab:n.activeUptimeTab,setActiveUptimeTab:n.setActiveUptimeTab,loadUptimeData:n.loadUptimeData,uptimeLegendData:p,renderMonitorList:m=>k2(m,v=>S2(v,Fm),v=>A2(v,Fm,n.t),n.t),CARD_PROPS:To,ILLUSTRATION_SIZE:No,t:n.t})]})})]})},Jrt=()=>$.jsx("div",{className:"mt-[60px] px-2",children:$.jsx(Frt,{})});export{Jrt as default};
|