import{V as T1,d as N2,s as Qf,t as O2,c as Ma,g as B2,w as jl,a as S1,o as F2,b as k2,h as z2,i as Ql,n as U2,e as H2,u as V2}from"./index-CckO8w-f.js";var rv=T1;T1.util.warn;/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var iv=function(t,e){return iv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},iv(t,e)};function K(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");iv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var G2=function(){function t(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return t}(),W2=function(){function t(){this.browser=new G2,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<"u"}return t}(),vt=new W2;typeof wx=="object"&&typeof wx.getSystemInfoSync=="function"?(vt.wxa=!0,vt.touchEventsSupported=!0):typeof document>"u"&&typeof self<"u"?vt.worker=!0:typeof navigator>"u"||navigator.userAgent.indexOf("Node.js")===0?(vt.node=!0,vt.svgSupported=!0):X2(navigator.userAgent,vt);function X2(t,e){var r=e.browser,i=t.match(/Firefox\/([\d.]+)/),n=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),a=t.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(t);i&&(r.firefox=!0,r.version=i[1]),n&&(r.ie=!0,r.version=n[1]),a&&(r.edge=!0,r.version=a[1],r.newEdge=+a[1].split(".")[0]>18),o&&(r.weChat=!0),e.svgSupported=typeof SVGRect<"u",e.touchEventsSupported="ontouchstart"in window&&!r.ie&&!r.edge,e.pointerEventsSupported="onpointerdown"in window&&(r.edge||r.ie&&+r.version>=11),e.domSupported=typeof document<"u";var s=document.documentElement.style;e.transform3dSupported=(r.ie&&"transition"in s||r.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||r.ie&&+r.version>=9}var Md=12,w1="sans-serif",Zi=Md+"px "+w1,Y2=20,Z2=100,q2="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function $2(t){var e={};if(typeof JSON>"u")return e;for(var r=0;r=0)s=o*r.length;else for(var l=0;l>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[l]+":0",n[u]+":0",i[1-l]+":auto",n[1-u]+":auto",""].join("!important;"),t.appendChild(o),r.push(o)}return r}function mb(t,e,r){for(var i=r?"invTrans":"trans",n=e[i],a=e.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var f=t[u].getBoundingClientRect(),h=2*u,v=f.left,c=f.top;o.push(v,c),l=l&&a&&v===a[h]&&c===a[h+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&n?n:(e.srcCoords=o,e[i]=r?lg(s,o):lg(o,s))}function R1(t){return t.nodeName.toUpperCase()==="CANVAS"}var _b=/([&<>"'])/g,yb={"&":"&","<":"<",">":">",'"':""","'":"'"};function _e(t){return t==null?"":(t+"").replace(_b,function(e,r){return yb[r]})}var xb=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rh=[],Tb=vt.browser.firefox&&+vt.browser.version.split(".")[0]<39;function uv(t,e,r,i){return r=r||{},i?fg(t,e,r):Tb&&e.layerX!=null&&e.layerX!==e.offsetX?(r.zrX=e.layerX,r.zrY=e.layerY):e.offsetX!=null?(r.zrX=e.offsetX,r.zrY=e.offsetY):fg(t,e,r),r}function fg(t,e,r){if(vt.domSupported&&t.getBoundingClientRect){var i=e.clientX,n=e.clientY;if(R1(t)){var a=t.getBoundingClientRect();r.zrX=i-a.left,r.zrY=n-a.top;return}else if(lv(rh,t,i,n)){r.zrX=rh[0],r.zrY=rh[1];return}}r.zrX=r.zrY=0}function Id(t){return t||window.event}function sr(t,e,r){if(e=Id(e),e.zrX!=null)return e;var i=e.type,n=i&&i.indexOf("touch")>=0;if(n){var o=i!=="touchend"?e.targetTouches[0]:e.changedTouches[0];o&&uv(t,o,e,r)}else{uv(t,e,e,r);var a=Sb(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return e.which==null&&s!==void 0&&xb.test(e.type)&&(e.which=s&1?1:s&2?3:s&4?2:0),e}function Sb(t){var e=t.wheelDelta;if(e)return e;var r=t.deltaX,i=t.deltaY;if(r==null||i==null)return e;var n=Math.abs(i!==0?i:r),a=i>0?-1:i<0?1:r>0?-1:1;return 3*n*a}function wb(t,e,r,i){t.addEventListener(e,r,i)}function bb(t,e,r,i){t.removeEventListener(e,r,i)}var gi=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function hg(t){return t.which===2||t.which===3}var Ab=function(){function t(){this._track=[]}return t.prototype.recognize=function(e,r,i){return this._doTrack(e,r,i),this._recognize(e)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(e,r,i){var n=e.touches;if(n){for(var a={points:[],touches:[],target:r,event:e},o=0,s=n.length;o1&&i&&i.length>1){var a=cg(i)/cg(n);!isFinite(a)&&(a=1),e.pinchScale=a;var o=Eb(i);return e.pinchX=o[0],e.pinchY=o[1],{type:"pinch",target:t[0].target,event:e}}}}};function Va(){return[1,0,0,1,0,0]}function Nd(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Mb(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Ga(t,e,r){var i=e[0]*r[0]+e[2]*r[1],n=e[1]*r[0]+e[3]*r[1],a=e[0]*r[2]+e[2]*r[3],o=e[1]*r[2]+e[3]*r[3],s=e[0]*r[4]+e[2]*r[5]+e[4],l=e[1]*r[4]+e[3]*r[5]+e[5];return t[0]=i,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t}function fv(t,e,r){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+r[0],t[5]=e[5]+r[1],t}function Od(t,e,r,i){i===void 0&&(i=[0,0]);var n=e[0],a=e[2],o=e[4],s=e[1],l=e[3],u=e[5],f=Math.sin(r),h=Math.cos(r);return t[0]=n*h+s*f,t[1]=-n*f+s*h,t[2]=a*h+l*f,t[3]=-a*f+h*l,t[4]=h*(o-i[0])+f*(u-i[1])+i[0],t[5]=h*(u-i[1])-f*(o-i[0])+i[1],t}function Cb(t,e,r){var i=r[0],n=r[1];return t[0]=e[0]*i,t[1]=e[1]*n,t[2]=e[2]*i,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*n,t}function cf(t,e){var r=e[0],i=e[2],n=e[4],a=e[1],o=e[3],s=e[5],l=r*o-a*i;return l?(l=1/l,t[0]=o*l,t[1]=-a*l,t[2]=-i*l,t[3]=r*l,t[4]=(i*s-o*n)*l,t[5]=(a*n-r*s)*l,t):null}var yt=function(){function t(e,r){this.x=e||0,this.y=r||0}return t.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(e,r){return this.x=e,this.y=r,this},t.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},t.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},t.prototype.scale=function(e){this.x*=e,this.y*=e},t.prototype.scaleAndAdd=function(e,r){this.x+=e.x*r,this.y+=e.y*r},t.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},t.prototype.dot=function(e){return this.x*e.x+this.y*e.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},t.prototype.distance=function(e){var r=this.x-e.x,i=this.y-e.y;return Math.sqrt(r*r+i*i)},t.prototype.distanceSquare=function(e){var r=this.x-e.x,i=this.y-e.y;return r*r+i*i},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(e){if(e){var r=this.x,i=this.y;return this.x=e[0]*r+e[2]*i+e[4],this.y=e[1]*r+e[3]*i+e[5],this}},t.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},t.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},t.set=function(e,r,i){e.x=r,e.y=i},t.copy=function(e,r){e.x=r.x,e.y=r.y},t.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},t.lenSquare=function(e){return e.x*e.x+e.y*e.y},t.dot=function(e,r){return e.x*r.x+e.y*r.y},t.add=function(e,r,i){e.x=r.x+i.x,e.y=r.y+i.y},t.sub=function(e,r,i){e.x=r.x-i.x,e.y=r.y-i.y},t.scale=function(e,r,i){e.x=r.x*i,e.y=r.y*i},t.scaleAndAdd=function(e,r,i,n){e.x=r.x+i.x*n,e.y=r.y+i.y*n},t.lerp=function(e,r,i,n){var a=1-n;e.x=a*r.x+n*i.x,e.y=a*r.y+n*i.y},t}(),tl=Math.min,el=Math.max,Qi=new yt,Ji=new yt,tn=new yt,en=new yt,vo=new yt,po=new yt,Pt=function(){function t(e,r,i,n){i<0&&(e=e+i,i=-i),n<0&&(r=r+n,n=-n),this.x=e,this.y=r,this.width=i,this.height=n}return t.prototype.union=function(e){var r=tl(e.x,this.x),i=tl(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=el(e.x+e.width,this.x+this.width)-r:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=el(e.y+e.height,this.y+this.height)-i:this.height=e.height,this.x=r,this.y=i},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(e){var r=this,i=e.width/r.width,n=e.height/r.height,a=Va();return fv(a,a,[-r.x,-r.y]),Cb(a,a,[i,n]),fv(a,a,[e.x,e.y]),a},t.prototype.intersect=function(e,r){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,n=i.x,a=i.x+i.width,o=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,f=e.y,h=e.y+e.height,v=!(ad&&(d=y,pd&&(d=x,m<_?yt.set(po,0,-m):yt.set(po,0,_)):y=i.x&&e<=i.x+i.width&&r>=i.y&&r<=i.y+i.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return this.width===0||this.height===0},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(e,r){e.x=r.x,e.y=r.y,e.width=r.width,e.height=r.height},t.applyTransform=function(e,r,i){if(!i){e!==r&&t.copy(e,r);return}if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var n=i[0],a=i[3],o=i[4],s=i[5];e.x=r.x*n+o,e.y=r.y*a+s,e.width=r.width*n,e.height=r.height*a,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Qi.x=tn.x=r.x,Qi.y=en.y=r.y,Ji.x=en.x=r.x+r.width,Ji.y=tn.y=r.y+r.height,Qi.transform(i),en.transform(i),Ji.transform(i),tn.transform(i),e.x=tl(Qi.x,Ji.x,tn.x,en.x),e.y=tl(Qi.y,Ji.y,tn.y,en.y);var l=el(Qi.x,Ji.x,tn.x,en.x),u=el(Qi.y,Ji.y,tn.y,en.y);e.width=l-e.x,e.height=u-e.y},t}(),P1="silent";function Db(t,e,r){return{type:t,event:r,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:r.zrX,offsetY:r.zrY,gestureEvent:r.gestureEvent,pinchX:r.pinchX,pinchY:r.pinchY,pinchScale:r.pinchScale,wheelDelta:r.zrDelta,zrByTouch:r.zrByTouch,which:r.which,stop:Lb}}function Lb(){gi(this.event)}var Rb=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.handler=null,r}return e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(zr),go=function(){function t(e,r){this.x=e,this.y=r}return t}(),Pb=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],nh=new Pt(0,0,0,0),I1=function(t){K(e,t);function e(r,i,n,a,o){var s=t.call(this)||this;return s._hovered=new go(0,0),s.storage=r,s.painter=i,s.painterRoot=a,s._pointerSize=o,n=n||new Rb,s.proxy=null,s.setHandlerProxy(n),s._draggingMgr=new vb(s),s}return e.prototype.setHandlerProxy=function(r){this.proxy&&this.proxy.dispose(),r&&(C(Pb,function(i){r.on&&r.on(i,this[i],this)},this),r.handler=this),this.proxy=r},e.prototype.mousemove=function(r){var i=r.zrX,n=r.zrY,a=N1(this,i,n),o=this._hovered,s=o.target;s&&!s.__zr&&(o=this.findHover(o.x,o.y),s=o.target);var l=this._hovered=a?new go(i,n):this.findHover(i,n),u=l.target,f=this.proxy;f.setCursor&&f.setCursor(u?u.cursor:"default"),s&&u!==s&&this.dispatchToElement(o,"mouseout",r),this.dispatchToElement(l,"mousemove",r),u&&u!==s&&this.dispatchToElement(l,"mouseover",r)},e.prototype.mouseout=function(r){var i=r.zrEventControl;i!=="only_globalout"&&this.dispatchToElement(this._hovered,"mouseout",r),i!=="no_globalout"&&this.trigger("globalout",{type:"globalout",event:r})},e.prototype.resize=function(){this._hovered=new go(0,0)},e.prototype.dispatch=function(r,i){var n=this[r];n&&n.call(this,i)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(r){var i=this.proxy;i.setCursor&&i.setCursor(r)},e.prototype.dispatchToElement=function(r,i,n){r=r||{};var a=r.target;if(!(a&&a.silent)){for(var o="on"+i,s=Db(i,r,n);a&&(a[o]&&(s.cancelBubble=!!a[o].call(a,s)),a.trigger(i,s),a=a.__hostTarget?a.__hostTarget:a.parent,!s.cancelBubble););s.cancelBubble||(this.trigger(i,s),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(l){typeof l[o]=="function"&&l[o].call(l,s),l.trigger&&l.trigger(i,s)}))}},e.prototype.findHover=function(r,i,n){var a=this.storage.getDisplayList(),o=new go(r,i);if(vg(a,o,r,i,n),this._pointerSize&&!o.target){for(var s=[],l=this._pointerSize,u=l/2,f=new Pt(r-u,i-u,l,l),h=a.length-1;h>=0;h--){var v=a[h];v!==n&&!v.ignore&&!v.ignoreCoarsePointer&&(!v.parent||!v.parent.ignoreCoarsePointer)&&(nh.copy(v.getBoundingRect()),v.transform&&nh.applyTransform(v.transform),nh.intersect(f)&&s.push(v))}if(s.length)for(var c=4,d=Math.PI/12,p=Math.PI*2,g=0;g4)return;this._downPoint=null}this.dispatchToElement(a,t,e)}});function Ib(t,e,r){if(t[t.rectHover?"rectContain":"contain"](e,r)){for(var i=t,n=void 0,a=!1;i;){if(i.ignoreClip&&(a=!0),!a){var o=i.getClipPath();if(o&&!o.contain(e,r))return!1}i.silent&&(n=!0);var s=i.__hostTarget;i=s||i.parent}return n?P1:!0}return!1}function vg(t,e,r,i,n){for(var a=t.length-1;a>=0;a--){var o=t[a],s=void 0;if(o!==n&&!o.ignore&&(s=Ib(o,r,i))&&(!e.topTarget&&(e.topTarget=o),s!==P1)){e.target=o;break}}}function N1(t,e,r){var i=t.painter;return e<0||e>i.getWidth()||r<0||r>i.getHeight()}var O1=32,mo=7;function Nb(t){for(var e=0;t>=O1;)e|=t&1,t>>=1;return t+e}function dg(t,e,r,i){var n=e+1;if(n===r)return 1;if(i(t[n++],t[e])<0){for(;n=0;)n++;return n-e}function Ob(t,e,r){for(r--;e>>1,n(a,t[l])<0?s=l:o=l+1;var u=i-o;switch(u){case 3:t[o+3]=t[o+2];case 2:t[o+2]=t[o+1];case 1:t[o+1]=t[o];break;default:for(;u>0;)t[o+u]=t[o+u-1],u--}t[o]=a}}function ah(t,e,r,i,n,a){var o=0,s=0,l=1;if(a(t,e[r+n])>0){for(s=i-n;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}else{for(s=n+1;ls&&(l=s);var u=o;o=n-l,l=n-u}for(o++;o>>1);a(t,e[r+f])>0?o=f+1:l=f}return l}function oh(t,e,r,i,n,a){var o=0,s=0,l=1;if(a(t,e[r+n])<0){for(s=n+1;ls&&(l=s);var u=o;o=n-l,l=n-u}else{for(s=i-n;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=n,l+=n}for(o++;o>>1);a(t,e[r+f])<0?l=f:o=f+1}return l}function Bb(t,e){var r=mo,i,n,a=0,o=[];i=[],n=[];function s(c,d){i[a]=c,n[a]=d,a+=1}function l(){for(;a>1;){var c=a-2;if(c>=1&&n[c-1]<=n[c]+n[c+1]||c>=2&&n[c-2]<=n[c]+n[c-1])n[c-1]n[c+1])break;f(c)}}function u(){for(;a>1;){var c=a-2;c>0&&n[c-1]=mo||w>=mo);if(b)break;S<0&&(S=0),S+=2}if(r=S,r<1&&(r=1),d===1){for(m=0;m=0;m--)t[T+m]=t[S+m];t[x]=o[y];return}for(var w=r;;){var b=0,A=0,M=!1;do if(e(o[y],t[_])<0){if(t[x--]=t[_--],b++,A=0,--d===0){M=!0;break}}else if(t[x--]=o[y--],A++,b=0,--g===1){M=!0;break}while((b|A)=0;m--)t[T+m]=t[S+m];if(d===0){M=!0;break}}if(t[x--]=o[y--],--g===1){M=!0;break}if(A=g-ah(t[_],o,0,g,g-1,e),A!==0){for(x-=A,y-=A,g-=A,T=x+1,S=y+1,m=0;m=mo||A>=mo);if(M)break;w<0&&(w=0),w+=2}if(r=w,r<1&&(r=1),g===1){for(x-=d,_-=d,T=x+1,S=_+1,m=d-1;m>=0;m--)t[T+m]=t[S+m];t[x]=o[y]}else{if(g===0)throw new Error;for(S=x-(g-1),m=0;ms&&(l=s),pg(t,r,r+l,r+a,e),a=l}o.pushRun(r,a),o.mergeRuns(),n-=a,r+=a}while(n!==0);o.forceMergeRuns()}}var er=1,Yo=2,Ca=4,gg=!1;function sh(){gg||(gg=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function mg(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var Fb=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=mg}return t.prototype.traverse=function(e,r){for(var i=0;i0&&(f.__clipPaths=[]),isNaN(f.z)&&(sh(),f.z=0),isNaN(f.z2)&&(sh(),f.z2=0),isNaN(f.zlevel)&&(sh(),f.zlevel=0),this._displayList[this._displayListLen++]=f}var h=e.getDecalElement&&e.getDecalElement();h&&this._updateAndAddDisplayable(h,r,i);var v=e.getTextGuideLine();v&&this._updateAndAddDisplayable(v,r,i);var c=e.getTextContent();c&&this._updateAndAddDisplayable(c,r,i)}},t.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},t.prototype.delRoot=function(e){if(e instanceof Array){for(var r=0,i=e.length;r=0&&this._roots.splice(n,1)},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}(),ms;ms=vt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var is={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return .5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return t===0?0:Math.pow(1024,t-1)},exponentialOut:function(t){return t===1?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,r=.1,i=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=i/4):e=i*Math.asin(1/r)/(2*Math.PI),-(r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)))},elasticOut:function(t){var e,r=.1,i=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=i/4):e=i*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/i)+1)},elasticInOut:function(t){var e,r=.1,i=.4;return t===0?0:t===1?1:(!r||r<1?(r=1,e=i/4):e=i*Math.asin(1/r)/(2*Math.PI),(t*=2)<1?-.5*(r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)):r*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-is.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?is.bounceIn(t*2)*.5:is.bounceOut(t*2-1)*.5+.5}},rl=Math.pow,Gi=Math.sqrt,Tu=1e-8,B1=1e-4,_g=Gi(3),il=1/3,Kr=so(),hr=so(),Wa=so();function Fi(t){return t>-Tu&&tTu||t<-Tu}function ce(t,e,r,i,n){var a=1-n;return a*a*(a*t+3*n*e)+n*n*(n*i+3*a*r)}function yg(t,e,r,i,n){var a=1-n;return 3*(((e-t)*a+2*(r-e)*n)*a+(i-r)*n*n)}function Su(t,e,r,i,n,a){var o=i+3*(e-r)-t,s=3*(r-e*2+t),l=3*(e-t),u=t-n,f=s*s-3*o*l,h=s*l-9*o*u,v=l*l-3*s*u,c=0;if(Fi(f)&&Fi(h))if(Fi(s))a[0]=0;else{var d=-l/s;d>=0&&d<=1&&(a[c++]=d)}else{var p=h*h-4*f*v;if(Fi(p)){var g=h/f,d=-s/o+g,m=-g/2;d>=0&&d<=1&&(a[c++]=d),m>=0&&m<=1&&(a[c++]=m)}else if(p>0){var _=Gi(p),y=f*s+1.5*o*(-h+_),x=f*s+1.5*o*(-h-_);y<0?y=-rl(-y,il):y=rl(y,il),x<0?x=-rl(-x,il):x=rl(x,il);var d=(-s-(y+x))/(3*o);d>=0&&d<=1&&(a[c++]=d)}else{var S=(2*f*s-3*o*h)/(2*Gi(f*f*f)),T=Math.acos(S)/3,w=Gi(f),b=Math.cos(T),d=(-s-2*w*b)/(3*o),m=(-s+w*(b+_g*Math.sin(T)))/(3*o),A=(-s+w*(b-_g*Math.sin(T)))/(3*o);d>=0&&d<=1&&(a[c++]=d),m>=0&&m<=1&&(a[c++]=m),A>=0&&A<=1&&(a[c++]=A)}}return c}function k1(t,e,r,i,n){var a=6*r-12*e+6*t,o=9*e+3*i-3*t-9*r,s=3*e-3*t,l=0;if(Fi(o)){if(F1(a)){var u=-s/a;u>=0&&u<=1&&(n[l++]=u)}}else{var f=a*a-4*o*s;if(Fi(f))n[0]=-a/(2*o);else if(f>0){var h=Gi(f),u=(-a+h)/(2*o),v=(-a-h)/(2*o);u>=0&&u<=1&&(n[l++]=u),v>=0&&v<=1&&(n[l++]=v)}}return l}function wu(t,e,r,i,n,a){var o=(e-t)*n+t,s=(r-e)*n+e,l=(i-r)*n+r,u=(s-o)*n+o,f=(l-s)*n+s,h=(f-u)*n+u;a[0]=t,a[1]=o,a[2]=u,a[3]=h,a[4]=h,a[5]=f,a[6]=l,a[7]=i}function z1(t,e,r,i,n,a,o,s,l,u,f){var h,v=.005,c=1/0,d,p,g,m;Kr[0]=l,Kr[1]=u;for(var _=0;_<1;_+=.05)hr[0]=ce(t,r,n,o,_),hr[1]=ce(e,i,a,s,_),g=Ha(Kr,hr),g=0&&g=0&&u<=1&&(n[l++]=u)}}else{var f=o*o-4*a*s;if(Fi(f)){var u=-o/(2*a);u>=0&&u<=1&&(n[l++]=u)}else if(f>0){var h=Gi(f),u=(-o+h)/(2*a),v=(-o-h)/(2*a);u>=0&&u<=1&&(n[l++]=u),v>=0&&v<=1&&(n[l++]=v)}}return l}function U1(t,e,r){var i=t+r-2*e;return i===0?.5:(t-e)/i}function bu(t,e,r,i,n){var a=(e-t)*i+t,o=(r-e)*i+e,s=(o-a)*i+a;n[0]=t,n[1]=a,n[2]=s,n[3]=s,n[4]=o,n[5]=r}function H1(t,e,r,i,n,a,o,s,l){var u,f=.005,h=1/0;Kr[0]=o,Kr[1]=s;for(var v=0;v<1;v+=.05){hr[0]=Ae(t,r,n,v),hr[1]=Ae(e,i,a,v);var c=Ha(Kr,hr);c=0&&c=1?1:Su(0,i,a,1,l,s)&&ce(0,n,o,1,s[0])}}}var Vb=function(){function t(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Te,this.ondestroy=e.ondestroy||Te,this.onrestart=e.onrestart||Te,e.easing&&this.setEasing(e.easing)}return t.prototype.step=function(e,r){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),this._paused){this._pausedTime+=r;return}var i=this._life,n=e-this._startTime-this._pausedTime,a=n/i;a<0&&(a=0),a=Math.min(a,1);var o=this.easingFunc,s=o?o(a):a;if(this.onframe(s),a===1)if(this.loop){var l=n%i;this._startTime=e-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(e){this.easing=e,this.easingFunc=ct(e)?e:is[e]||Bd(e)},t}(),V1=function(){function t(e){this.value=e}return t}(),Gb=function(){function t(){this._len=0}return t.prototype.insert=function(e){var r=new V1(e);return this.insertEntry(r),r},t.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},t.prototype.remove=function(e){var r=e.prev,i=e.next;r?r.next=i:this.head=i,i?i.prev=r:this.tail=r,e.next=e.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),lo=function(){function t(e){this._list=new Gb,this._maxSize=10,this._map={},this._maxSize=e}return t.prototype.put=function(e,r){var i=this._list,n=this._map,a=null;if(n[e]==null){var o=i.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=i.head;i.remove(l),delete n[l.key],a=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new V1(r),s.key=e,i.insertEntry(s),n[e]=s}return a},t.prototype.get=function(e){var r=this._map[e],i=this._list;if(r!=null)return r!==i.tail&&(i.remove(r),i.insertEntry(r)),r.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}(),Tg={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ir(t){return t=Math.round(t),t<0?0:t>255?255:t}function Wb(t){return t=Math.round(t),t<0?0:t>360?360:t}function _s(t){return t<0?0:t>1?1:t}function lh(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?Ir(parseFloat(e)/100*255):Ir(parseInt(e,10))}function Vn(t){var e=t;return e.length&&e.charAt(e.length-1)==="%"?_s(parseFloat(e)/100):_s(parseFloat(e))}function uh(t,e,r){return r<0?r+=1:r>1&&(r-=1),r*6<1?t+(e-t)*r*6:r*2<1?e:r*3<2?t+(e-t)*(2/3-r)*6:t}function ki(t,e,r){return t+(e-t)*r}function or(t,e,r,i,n){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t}function hv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var G1=new lo(20),nl=null;function na(t,e){nl&&hv(nl,e),nl=G1.put(t,nl||e.slice())}function Be(t,e){if(t){e=e||[];var r=G1.get(t);if(r)return hv(e,r);t=t+"";var i=t.replace(/ /g,"").toLowerCase();if(i in Tg)return hv(e,Tg[i]),na(t,e),e;var n=i.length;if(i.charAt(0)==="#"){if(n===4||n===5){var a=parseInt(i.slice(1,4),16);if(!(a>=0&&a<=4095)){or(e,0,0,0,1);return}return or(e,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,n===5?parseInt(i.slice(4),16)/15:1),na(t,e),e}else if(n===7||n===9){var a=parseInt(i.slice(1,7),16);if(!(a>=0&&a<=16777215)){or(e,0,0,0,1);return}return or(e,(a&16711680)>>16,(a&65280)>>8,a&255,n===9?parseInt(i.slice(7),16)/255:1),na(t,e),e}return}var o=i.indexOf("("),s=i.indexOf(")");if(o!==-1&&s+1===n){var l=i.substr(0,o),u=i.substr(o+1,s-(o+1)).split(","),f=1;switch(l){case"rgba":if(u.length!==4)return u.length===3?or(e,+u[0],+u[1],+u[2],1):or(e,0,0,0,1);f=Vn(u.pop());case"rgb":if(u.length>=3)return or(e,lh(u[0]),lh(u[1]),lh(u[2]),u.length===3?f:Vn(u[3])),na(t,e),e;or(e,0,0,0,1);return;case"hsla":if(u.length!==4){or(e,0,0,0,1);return}return u[3]=Vn(u[3]),cv(u,e),na(t,e),e;case"hsl":if(u.length!==3){or(e,0,0,0,1);return}return cv(u,e),na(t,e),e;default:return}}or(e,0,0,0,1)}}function cv(t,e){var r=(parseFloat(t[0])%360+360)%360/360,i=Vn(t[1]),n=Vn(t[2]),a=n<=.5?n*(i+1):n+i-n*i,o=n*2-a;return e=e||[],or(e,Ir(uh(o,a,r+1/3)*255),Ir(uh(o,a,r)*255),Ir(uh(o,a,r-1/3)*255),1),t.length===4&&(e[3]=t[3]),e}function Xb(t){if(t){var e=t[0]/255,r=t[1]/255,i=t[2]/255,n=Math.min(e,r,i),a=Math.max(e,r,i),o=a-n,s=(a+n)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(a+n):u=o/(2-a-n);var f=((a-e)/6+o/2)/o,h=((a-r)/6+o/2)/o,v=((a-i)/6+o/2)/o;e===a?l=v-h:r===a?l=1/3+f-v:i===a&&(l=2/3+h-f),l<0&&(l+=1),l>1&&(l-=1)}var c=[l*360,u,s];return t[3]!=null&&c.push(t[3]),c}}function Sg(t,e){var r=Be(t);if(r){for(var i=0;i<3;i++)r[i]=r[i]*(1-e)|0,r[i]>255?r[i]=255:r[i]<0&&(r[i]=0);return pi(r,r.length===4?"rgba":"rgb")}}function fh(t,e,r){if(!(!(e&&e.length)||!(t>=0&&t<=1))){r=r||[];var i=t*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=e[n],s=e[a],l=i-n;return r[0]=Ir(ki(o[0],s[0],l)),r[1]=Ir(ki(o[1],s[1],l)),r[2]=Ir(ki(o[2],s[2],l)),r[3]=_s(ki(o[3],s[3],l)),r}}function Yb(t,e,r){if(!(!(e&&e.length)||!(t>=0&&t<=1))){var i=t*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=Be(e[n]),s=Be(e[a]),l=i-n,u=pi([Ir(ki(o[0],s[0],l)),Ir(ki(o[1],s[1],l)),Ir(ki(o[2],s[2],l)),_s(ki(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:n,rightIndex:a,value:i}:u}}function hh(t,e,r,i){var n=Be(t);if(t)return n=Xb(n),e!=null&&(n[0]=Wb(e)),r!=null&&(n[1]=Vn(r)),i!=null&&(n[2]=Vn(i)),pi(cv(n),"rgba")}function Zb(t,e){var r=Be(t);if(r&&e!=null)return r[3]=_s(e),pi(r,"rgba")}function pi(t,e){if(!(!t||!t.length)){var r=t[0]+","+t[1]+","+t[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(r+=","+t[3]),e+"("+r+")"}}function Au(t,e){var r=Be(t);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*e:0}var wg=new lo(100);function vv(t){if(Q(t)){var e=wg.get(t);return e||(e=Sg(t,-.1),wg.put(t,e)),e}else if(ff(t)){var r=Y({},t);return r.colorStops=tt(t.colorStops,function(i){return{offset:i.offset,color:Sg(i.color,-.1)}}),r}return t}var Eu=Math.round;function ys(t){var e;if(!t||t==="transparent")t="none";else if(typeof t=="string"&&t.indexOf("rgba")>-1){var r=Be(t);r&&(t="rgb("+r[0]+","+r[1]+","+r[2]+")",e=r[3])}return{color:t,opacity:e??1}}var bg=1e-4;function zi(t){return t-bg}function al(t){return Eu(t*1e3)/1e3}function dv(t){return Eu(t*1e4)/1e4}function qb(t){return"matrix("+al(t[0])+","+al(t[1])+","+al(t[2])+","+al(t[3])+","+dv(t[4])+","+dv(t[5])+")"}var $b={left:"start",right:"end",center:"middle",middle:"middle"};function Kb(t,e,r){return r==="top"?t+=e/2:r==="bottom"&&(t-=e/2),t}function jb(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}function Qb(t){var e=t.style,r=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),r[0],r[1]].join(",")}function W1(t){return t&&!!t.image}function Jb(t){return t&&!!t.svgElement}function Fd(t){return W1(t)||Jb(t)}function X1(t){return t.type==="linear"}function Y1(t){return t.type==="radial"}function Z1(t){return t&&(t.type==="linear"||t.type==="radial")}function vf(t){return"url(#"+t+")"}function q1(t){var e=t.getGlobalScale(),r=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(r)/Math.log(10)),1)}function $1(t){var e=t.x||0,r=t.y||0,i=(t.rotation||0)*tu,n=ft(t.scaleX,1),a=ft(t.scaleY,1),o=t.skewX||0,s=t.skewY||0,l=[];return(e||r)&&l.push("translate("+e+"px,"+r+"px)"),i&&l.push("rotate("+i+")"),(n!==1||a!==1)&&l.push("scale("+n+","+a+")"),(o||s)&&l.push("skew("+Eu(o*tu)+"deg, "+Eu(s*tu)+"deg)"),l.join(" ")}var tA=function(){return vt.hasGlobalWindow&&ct(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:typeof Buffer<"u"?function(t){return Buffer.from(t).toString("base64")}:function(t){return null}}(),pv=Array.prototype.slice;function fi(t,e,r){return(e-t)*r+t}function ch(t,e,r,i){for(var n=e.length,a=0;ai?e:t,a=Math.min(r,i),o=n[a-1]||{color:[0,0,0,0],offset:0},s=a;so;if(s)i.length=o;else for(var l=a;l=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(e,r,i){this._needsSort=!0;var n=this.keyframes,a=n.length,o=!1,s=Eg,l=r;if(ke(r)){var u=nA(r);s=u,(u===1&&!$t(r[0])||u===2&&!$t(r[0][0]))&&(o=!0)}else if($t(r)&&!yu(r))s=sl;else if(Q(r))if(!isNaN(+r))s=sl;else{var f=Be(r);f&&(l=f,s=Zo)}else if(ff(r)){var h=Y({},l);h.colorStops=tt(r.colorStops,function(c){return{offset:c.offset,color:Be(c.color)}}),X1(r)?s=gv:Y1(r)&&(s=mv),l=h}a===0?this.valType=s:(s!==this.valType||s===Eg)&&(o=!0),this.discrete=this.discrete||o;var v={time:e,value:l,rawValue:r,percent:0};return i&&(v.easing=i,v.easingFunc=ct(i)?i:is[i]||Bd(i)),n.push(v),v},t.prototype.prepare=function(e,r){var i=this.keyframes;this._needsSort&&i.sort(function(p,g){return p.time-g.time});for(var n=this.valType,a=i.length,o=i[a-1],s=this.discrete,l=ll(n),u=Mg(n),f=0;f=0&&!(o[f].percent<=r);f--);f=v(f,s-2)}else{for(f=h;fr);f++);f=v(f-1,s-2)}d=o[f+1],c=o[f]}if(c&&d){this._lastFr=f,this._lastFrP=r;var g=d.percent-c.percent,m=g===0?1:v((r-c.percent)/g,1);d.easingFunc&&(m=d.easingFunc(m));var _=i?this._additiveValue:u?_o:e[l];if((ll(a)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)e[l]=m<1?c.rawValue:d.rawValue;else if(ll(a))a===iu?ch(_,c[n],d[n],m):eA(_,c[n],d[n],m);else if(Mg(a)){var y=c[n],x=d[n],S=a===gv;e[l]={type:S?"linear":"radial",x:fi(y.x,x.x,m),y:fi(y.y,x.y,m),colorStops:tt(y.colorStops,function(w,b){var A=x.colorStops[b];return{offset:fi(w.offset,A.offset,m),color:ru(ch([],w.color,A.color,m))}}),global:x.global},S?(e[l].x2=fi(y.x2,x.x2,m),e[l].y2=fi(y.y2,x.y2,m)):e[l].r=fi(y.r,x.r,m)}else if(u)ch(_,c[n],d[n],m),i||(e[l]=ru(_));else{var T=fi(c[n],d[n],m);i?this._additiveValue=T:e[l]=T}i&&this._addToTarget(e)}}},t.prototype._addToTarget=function(e){var r=this.valType,i=this.propName,n=this._additiveValue;r===sl?e[i]=e[i]+n:r===Zo?(Be(e[i],_o),ol(_o,_o,n,1),e[i]=ru(_o)):r===iu?ol(e[i],e[i],n,1):r===K1&&Ag(e[i],e[i],n,1)},t}(),oA=function(){function t(e,r,i,n){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=e,this._loop=r,r&&n){Ld("Can' use additive animation on looped animation.");return}this._additiveAnimators=n,this._allowDiscrete=i}return t.prototype.getMaxTime=function(){return this._maxTime},t.prototype.getDelay=function(){return this._delay},t.prototype.getLoop=function(){return this._loop},t.prototype.getTarget=function(){return this._target},t.prototype.changeTarget=function(e){this._target=e},t.prototype.when=function(e,r,i){return this.whenWithKeys(e,r,mt(r),i)},t.prototype.whenWithKeys=function(e,r,i,n){for(var a=this._tracks,o=0;o0&&l.addKeyframe(0,ns(u),n),this._trackKeys.push(s)}l.addKeyframe(e,ns(r[s]),n)}return this._maxTime=Math.max(this._maxTime,e),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var r=e.length,i=0;i0)){this._started=1;for(var r=this,i=[],n=this._maxTime||0,a=0;a1){var s=o.pop();a.addKeyframe(s.time,e[n]),a.prepare(this._maxTime,a.getAdditiveTrack())}}}},t}();const df=oA;function Na(){return new Date().getTime()}var sA=function(t){K(e,t);function e(r){var i=t.call(this)||this;return i._running=!1,i._time=0,i._pausedTime=0,i._pauseStart=0,i._paused=!1,r=r||{},i.stage=r.stage||{},i}return e.prototype.addClip=function(r){r.animation&&this.removeClip(r),this._head?(this._tail.next=r,r.prev=this._tail,r.next=null,this._tail=r):this._head=this._tail=r,r.animation=this},e.prototype.addAnimator=function(r){r.animation=this;var i=r.getClip();i&&this.addClip(i)},e.prototype.removeClip=function(r){if(r.animation){var i=r.prev,n=r.next;i?i.next=n:this._head=n,n?n.prev=i:this._tail=i,r.next=r.prev=r.animation=null}},e.prototype.removeAnimator=function(r){var i=r.getClip();i&&this.removeClip(i),r.animation=null},e.prototype.update=function(r){for(var i=Na()-this._pausedTime,n=i-this._time,a=this._head;a;){var o=a.next,s=a.step(i,n);s&&(a.ondestroy(),this.removeClip(a)),a=o}this._time=i,r||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var r=this;this._running=!0;function i(){r._running&&(ms(i),!r._paused&&r.update())}ms(i)},e.prototype.start=function(){this._running||(this._time=Na(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=Na(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=Na()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var r=this._head;r;){var i=r.next;r.prev=r.next=r.animation=null,r=i}this._head=this._tail=null},e.prototype.isFinished=function(){return this._head==null},e.prototype.animate=function(r,i){i=i||{},this.start();var n=new df(r,i.loop);return this.addAnimator(n),n},e}(zr),lA=300,vh=vt.domSupported,dh=function(){var t=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],e=["touchstart","touchend","touchmove"],r={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},i=tt(t,function(n){var a=n.replace("mouse","pointer");return r.hasOwnProperty(a)?a:n});return{mouse:t,touch:e,pointer:i}}(),Cg={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},Dg=!1;function _v(t){var e=t.pointerType;return e==="pen"||e==="touch"}function uA(t){t.touching=!0,t.touchTimer!=null&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout(function(){t.touching=!1,t.touchTimer=null},700)}function ph(t){t&&(t.zrByTouch=!0)}function fA(t,e){return sr(t.dom,new hA(t,e),!0)}function j1(t,e){for(var r=e,i=!1;r&&r.nodeType!==9&&!(i=r.domBelongToZr||r!==e&&r===t.painterRoot);)r=r.parentNode;return i}var hA=function(){function t(e,r){this.stopPropagation=Te,this.stopImmediatePropagation=Te,this.preventDefault=Te,this.type=r.type,this.target=this.currentTarget=e.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return t}(),Lr={mousedown:function(t){t=sr(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=sr(this.dom,t);var e=this.__mayPointerCapture;e&&(t.zrX!==e[0]||t.zrY!==e[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=sr(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){t=sr(this.dom,t);var e=t.toElement||t.relatedTarget;j1(this,e)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){Dg=!0,t=sr(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){Dg||(t=sr(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){t=sr(this.dom,t),ph(t),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Lr.mousemove.call(this,t),Lr.mousedown.call(this,t)},touchmove:function(t){t=sr(this.dom,t),ph(t),this.handler.processGesture(t,"change"),Lr.mousemove.call(this,t)},touchend:function(t){t=sr(this.dom,t),ph(t),this.handler.processGesture(t,"end"),Lr.mouseup.call(this,t),+new Date-+this.__lastTouchMomentPg||t<-Pg}var nn=[],aa=[],mh=Va(),_h=Math.abs,pf=function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},t.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},t.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},t.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},t.prototype.needLocalTransform=function(){return rn(this.rotation)||rn(this.x)||rn(this.y)||rn(this.scaleX-1)||rn(this.scaleY-1)||rn(this.skewX)||rn(this.skewY)},t.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,r=this.needLocalTransform(),i=this.transform;if(!(r||e)){i&&(Rg(i),this.invTransform=null);return}i=i||Va(),r?this.getLocalTransform(i):Rg(i),e&&(r?Ga(i,e,i):Mb(i,e)),this.transform=i,this._resolveGlobalScaleRatio(i)},t.prototype._resolveGlobalScaleRatio=function(e){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(nn);var i=nn[0]<0?-1:1,n=nn[1]<0?-1:1,a=((nn[0]-i)*r+i)/nn[0]||0,o=((nn[1]-n)*r+n)/nn[1]||0;e[0]*=a,e[1]*=a,e[2]*=o,e[3]*=o}this.invTransform=this.invTransform||Va(),cf(this.invTransform,e)},t.prototype.getComputedTransform=function(){for(var e=this,r=[];e;)r.push(e),e=e.parent;for(;e=r.pop();)e.updateTransform();return this.transform},t.prototype.setLocalTransform=function(e){if(e){var r=e[0]*e[0]+e[1]*e[1],i=e[2]*e[2]+e[3]*e[3],n=Math.atan2(e[1],e[0]),a=Math.PI/2+n-Math.atan2(e[3],e[2]);i=Math.sqrt(i)*Math.cos(a),r=Math.sqrt(r),this.skewX=a,this.skewY=0,this.rotation=-n,this.x=+e[4],this.y=+e[5],this.scaleX=r,this.scaleY=i,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,r=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||Va(),Ga(aa,e.invTransform,r),r=aa);var i=this.originX,n=this.originY;(i||n)&&(mh[4]=i,mh[5]=n,Ga(aa,r,mh),aa[4]-=i,aa[5]-=n,r=aa),this.setLocalTransform(r)}},t.prototype.getGlobalScale=function(e){var r=this.transform;return e=e||[],r?(e[0]=Math.sqrt(r[0]*r[0]+r[1]*r[1]),e[1]=Math.sqrt(r[2]*r[2]+r[3]*r[3]),r[0]<0&&(e[0]=-e[0]),r[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},t.prototype.transformCoordToLocal=function(e,r){var i=[e,r],n=this.invTransform;return n&&_r(i,i,n),i},t.prototype.transformCoordToGlobal=function(e,r){var i=[e,r],n=this.transform;return n&&_r(i,i,n),i},t.prototype.getLineScale=function(){var e=this.transform;return e&&_h(e[0]-1)>1e-10&&_h(e[3]-1)>1e-10?Math.sqrt(_h(e[0]*e[3]-e[2]*e[1])):1},t.prototype.copyTransform=function(e){J1(this,e)},t.getLocalTransform=function(e,r){r=r||[];var i=e.originX||0,n=e.originY||0,a=e.scaleX,o=e.scaleY,s=e.anchorX,l=e.anchorY,u=e.rotation||0,f=e.x,h=e.y,v=e.skewX?Math.tan(e.skewX):0,c=e.skewY?Math.tan(-e.skewY):0;if(i||n||s||l){var d=i+s,p=n+l;r[4]=-d*a-v*p*o,r[5]=-p*o-c*d*a}else r[4]=r[5]=0;return r[0]=a,r[3]=o,r[1]=c*a,r[2]=v*o,u&&Od(r,r,u),r[4]+=i+f,r[5]+=n+h,r},t.initDefaultProps=function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),t}(),ii=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function J1(t,e){for(var r=0;r=0?parseFloat(t)/100*e:parseFloat(t):t}function tx(t,e,r){var i=e.position||"inside",n=e.distance!=null?e.distance:5,a=r.height,o=r.width,s=a/2,l=r.x,u=r.y,f="left",h="top";if(i instanceof Array)l+=mi(i[0],r.width),u+=mi(i[1],r.height),f=null,h=null;else switch(i){case"left":l-=n,u+=s,f="right",h="middle";break;case"right":l+=n+o,u+=s,h="middle";break;case"top":l+=o/2,u-=n,f="center",h="bottom";break;case"bottom":l+=o/2,u+=a+n,f="center";break;case"inside":l+=o/2,u+=s,f="center",h="middle";break;case"insideLeft":l+=n,u+=s,h="middle";break;case"insideRight":l+=o-n,u+=s,f="right",h="middle";break;case"insideTop":l+=o/2,u+=n,f="center";break;case"insideBottom":l+=o/2,u+=a-n,f="center",h="bottom";break;case"insideTopLeft":l+=n,u+=n;break;case"insideTopRight":l+=o-n,u+=n,f="right";break;case"insideBottomLeft":l+=n,u+=a-n,h="bottom";break;case"insideBottomRight":l+=o-n,u+=a-n,f="right",h="bottom";break}return t=t||{},t.x=l,t.y=u,t.align=f,t.verticalAlign=h,t}var yh="__zr_normal__",xh=ii.concat(["ignore"]),gA=Qn(ii,function(t,e){return t[e]=!0,t},{ignore:!1}),oa={},mA=new Pt(0,0,0,0),mf=function(){function t(e){this.id=E1(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return t.prototype._init=function(e){this.attr(e)},t.prototype.drift=function(e,r,i){switch(this.draggable){case"horizontal":r=0;break;case"vertical":e=0;break}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=e,n[5]+=r,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(e){var r=this._textContent;if(r&&(!r.ignore||e)){this.textConfig||(this.textConfig={});var i=this.textConfig,n=i.local,a=r.innerTransformable,o=void 0,s=void 0,l=!1;a.parent=n?this:null;var u=!1;if(a.copyTransform(r),i.position!=null){var f=mA;i.layoutRect?f.copy(i.layoutRect):f.copy(this.getBoundingRect()),n||f.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(oa,i,f):tx(oa,i,f),a.x=oa.x,a.y=oa.y,o=oa.align,s=oa.verticalAlign;var h=i.origin;if(h&&i.rotation!=null){var v=void 0,c=void 0;h==="center"?(v=f.width*.5,c=f.height*.5):(v=mi(h[0],f.width),c=mi(h[1],f.height)),u=!0,a.originX=-a.x+v+(n?0:f.x),a.originY=-a.y+c+(n?0:f.y)}}i.rotation!=null&&(a.rotation=i.rotation);var d=i.offset;d&&(a.x+=d[0],a.y+=d[1],u||(a.originX=-d[0],a.originY=-d[1]));var p=i.inside==null?typeof i.position=="string"&&i.position.indexOf("inside")>=0:i.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),m=void 0,_=void 0,y=void 0;p&&this.canBeInsideText()?(m=i.insideFill,_=i.insideStroke,(m==null||m==="auto")&&(m=this.getInsideTextFill()),(_==null||_==="auto")&&(_=this.getInsideTextStroke(m),y=!0)):(m=i.outsideFill,_=i.outsideStroke,(m==null||m==="auto")&&(m=this.getOutsideFill()),(_==null||_==="auto")&&(_=this.getOutsideStroke(m),y=!0)),m=m||"#000",(m!==g.fill||_!==g.stroke||y!==g.autoStroke||o!==g.align||s!==g.verticalAlign)&&(l=!0,g.fill=m,g.stroke=_,g.autoStroke=y,g.align=o,g.verticalAlign=s,r.setDefaultTextStyle(g)),r.__dirty|=er,l&&r.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(e){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?Sv:Tv},t.prototype.getOutsideStroke=function(e){var r=this.__zr&&this.__zr.getBackgroundColor(),i=typeof r=="string"&&Be(r);i||(i=[255,255,255,1]);for(var n=i[3],a=this.__zr.isDarkMode(),o=0;o<3;o++)i[o]=i[o]*n+(a?0:255)*(1-n);return i[3]=1,pi(i,"rgba")},t.prototype.traverse=function(e,r){},t.prototype.attrKV=function(e,r){e==="textConfig"?this.setTextConfig(r):e==="textContent"?this.setTextContent(r):e==="clipPath"?this.setClipPath(r):e==="extra"?(this.extra=this.extra||{},Y(this.extra,r)):this[e]=r},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(e,r){if(typeof e=="string")this.attrKV(e,r);else if(rt(e))for(var i=e,n=mt(i),a=0;a0},t.prototype.getState=function(e){return this.states[e]},t.prototype.ensureState=function(e){var r=this.states;return r[e]||(r[e]={}),r[e]},t.prototype.clearStates=function(e){this.useState(yh,!1,e)},t.prototype.useState=function(e,r,i,n){var a=e===yh,o=this.hasState();if(!(!o&&a)){var s=this.currentStates,l=this.stateTransition;if(!(bt(s,e)>=0&&(r||s.length===1))){var u;if(this.stateProxy&&!a&&(u=this.stateProxy(e)),u||(u=this.states&&this.states[e]),!u&&!a){Ld("State "+e+" not exists.");return}a||this.saveCurrentToNormalState(u);var f=!!(u&&u.hoverLayer||n);f&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,u,this._normalState,r,!i&&!this.__inHover&&l&&l.duration>0,l);var h=this._textContent,v=this._textGuide;return h&&h.useState(e,r,i,f),v&&v.useState(e,r,i,f),a?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!f&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~er),u}}},t.prototype.useStates=function(e,r,i){if(!e.length)this.clearStates();else{var n=[],a=this.currentStates,o=e.length,s=o===a.length;if(s){for(var l=0;l0,d);var p=this._textContent,g=this._textGuide;p&&p.useStates(e,r,v),g&&g.useStates(e,r,v),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!v&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~er)}},t.prototype.isSilent=function(){for(var e=this.silent,r=this.parent;!e&&r;){if(r.silent){e=!0;break}r=r.parent}return e},t.prototype._updateAnimationTargets=function(){for(var e=0;e=0){var i=this.currentStates.slice();i.splice(r,1),this.useStates(i)}},t.prototype.replaceState=function(e,r,i){var n=this.currentStates.slice(),a=bt(n,e),o=bt(n,r)>=0;a>=0?o?n.splice(a,1):n[a]=r:i&&!o&&n.push(r),this.useStates(n)},t.prototype.toggleState=function(e,r){r?this.useState(e,!0):this.removeState(e)},t.prototype._mergeStates=function(e){for(var r={},i,n=0;n=0&&a.splice(o,1)}),this.animators.push(e),i&&i.animation.addAnimator(e),i&&i.wakeUp()},t.prototype.updateDuringAnimation=function(e){this.markRedraw()},t.prototype.stopAnimation=function(e,r){for(var i=this.animators,n=i.length,a=[],o=0;o0&&r.during&&a[0].during(function(d,p){r.during(p)});for(var v=0;v0||n.force&&!o.length){var b=void 0,A=void 0,M=void 0;if(s){A={},v&&(b={});for(var x=0;x=0&&(n.splice(a,0,r),this._doAdd(r))}return this},e.prototype.replace=function(r,i){var n=bt(this._children,r);return n>=0&&this.replaceAt(i,n),this},e.prototype.replaceAt=function(r,i){var n=this._children,a=n[i];if(r&&r!==this&&r.parent!==this&&r!==a){n[i]=r,a.parent=null;var o=this.__zr;o&&a.removeSelfFromZr(o),this._doAdd(r)}return this},e.prototype._doAdd=function(r){r.parent&&r.parent.remove(r),r.parent=this;var i=this.__zr;i&&i!==r.__zr&&r.addSelfToZr(i),i&&i.refresh()},e.prototype.remove=function(r){var i=this.__zr,n=this._children,a=bt(n,r);return a<0?this:(n.splice(a,1),r.parent=null,i&&r.removeSelfFromZr(i),i&&i.refresh(),this)},e.prototype.removeAll=function(){for(var r=this._children,i=this.__zr,n=0;n0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&this.painter.getType()==="canvas"&&this.painter.refreshHover())},t.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},t.prototype.findHover=function(e,r){if(!this._disposed)return this.handler.findHover(e,r)},t.prototype.on=function(e,r,i){return this._disposed||this.handler.on(e,r,i),this},t.prototype.off=function(e,r){this._disposed||this.handler.off(e,r)},t.prototype.trigger=function(e,r){this._disposed||this.handler.trigger(e,r)},t.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),r=0;r0){if(t<=n)return o;if(t>=a)return s}else{if(t>=n)return o;if(t<=a)return s}else{if(t===n)return o;if(t===a)return s}return(t-n)/l*u+o}function se(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%";break}return Q(t)?CA(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):t==null?NaN:+t}function Jt(t,e,r){return e==null&&(e=10),e=Math.min(Math.max(0,e),ix),t=(+t).toFixed(e),r?t:+t}function On(t){return t.sort(function(e,r){return e-r}),t}function ci(t){if(t=+t,isNaN(t))return 0;if(t>1e-14){for(var e=1,r=0;r<15;r++,e*=10)if(Math.round(t*e)/e===t)return r}return zd(t)}function zd(t){var e=t.toString().toLowerCase(),r=e.indexOf("e"),i=r>0?+e.slice(r+1):0,n=r>0?r:e.length,a=e.indexOf("."),o=a<0?0:n-1-a;return Math.max(0,o-i)}function nx(t,e){var r=Math.log,i=Math.LN10,n=Math.floor(r(t[1]-t[0])/i),a=Math.round(r(Math.abs(e[1]-e[0]))/i),o=Math.min(Math.max(-n+a,0),20);return isFinite(o)?o:20}function DA(t,e){var r=Math.max(ci(t),ci(e)),i=t+e;return r>ix?i:Jt(i,r)}function ax(t){var e=Math.PI*2;return(t%e+e)%e}function Cu(t){return t>-Og&&t=10&&e++,e}function ox(t,e){var r=Ud(t),i=Math.pow(10,r),n=t/i,a;return n<1.5?a=1:n<2.5?a=2:n<4?a=3:n<7?a=5:a=10,t=a*i,r>=-20?+t.toFixed(r<0?-r:0):t}function Bg(t){t.sort(function(l,u){return s(l,u,0)?-1:1});for(var e=-1/0,r=1,i=0;i=0||a&&bt(a,l)<0)){var u=i.getShallow(l,e);u!=null&&(o[t[s][0]]=u)}}return o}}var rE=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],iE=Ts(rE),nE=function(){function t(){}return t.prototype.getAreaStyle=function(e,r){return iE(this,e,r)},t}(),Av=new lo(50);function aE(t){if(typeof t=="string"){var e=Av.get(t);return e&&e.image}else return t}function Wd(t,e,r,i,n){if(t)if(typeof t=="string"){if(e&&e.__zrImageSrc===t||!r)return e;var a=Av.get(t),o={hostEl:r,cb:i,cbPayload:n};return a?(e=a.image,!yf(e)&&a.pending.push(o)):(e=oo.loadImage(t,Hg,Hg),e.__zrImageSrc=t,Av.put(t,e.__cachedImgObj={image:e,pending:[o]})),e}else return t;else return e}function Hg(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=o;l++)s-=o;var u=rr(r,e);return u>s&&(r="",u=0),s=t-u,n.ellipsis=r,n.ellipsisWidth=u,n.contentWidth=s,n.containerWidth=t,n}function mx(t,e){var r=e.containerWidth,i=e.font,n=e.contentWidth;if(!r)return"";var a=rr(t,i);if(a<=r)return t;for(var o=0;;o++){if(a<=n||o>=e.maxIterations){t+=e.ellipsis;break}var s=o===0?sE(t,n,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(t.length*n/a):0;t=t.substr(0,s),a=rr(t,i)}return t===""&&(t=e.placeholder),t}function sE(t,e,r,i){for(var n=0,a=0,o=t.length;ac&&u){var d=Math.floor(c/s);h=h.slice(0,d)}if(t&&a&&f!=null)for(var p=gx(f,n,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),g=0;gs&&Ah(r,t.substring(s,u),e,o),Ah(r,l[2],e,o,l[1]),s=bh.lastIndex}sn){S>0?(_.tokens=_.tokens.slice(0,S),g(_,x,y),r.lines=r.lines.slice(0,m+1)):r.lines=r.lines.slice(0,m);break t}var D=w.width,R=D==null||D==="auto";if(typeof D=="string"&&D.charAt(D.length-1)==="%")T.percentWidth=D,f.push(T),T.contentWidth=rr(T.text,M);else{if(R){var P=w.backgroundColor,I=P&&P.image;I&&(I=aE(I),yf(I)&&(T.width=Math.max(T.width,I.width*E/I.height)))}var N=d&&i!=null?i-x:null;N!=null&&N0&&d+i.accumWidth>i.width&&(f=e.split(` `),u=!0),i.accumWidth=d}else{var p=_x(e,l,i.width,i.breakAll,i.accumWidth);i.accumWidth=p.accumWidth+c,h=p.linesWidths,f=p.lines}}else f=e.split(` `);for(var g=0;g=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}var vE=Qn(",&?/;] ".split(""),function(t,e){return t[e]=!0,t},{});function dE(t){return cE(t)?!!vE[t]:!0}function _x(t,e,r,i,n){for(var a=[],o=[],s="",l="",u=0,f=0,h=0;hr:n+f+c>r){f?(s||l)&&(d?(s||(s=l,l="",u=0,f=u),a.push(s),o.push(f-u),l+=v,u+=c,s="",f=u):(l&&(s+=l,l="",u=0),a.push(s),o.push(f),s=v,f=c)):d?(a.push(l),o.push(u),l=v,u=c):(a.push(v),o.push(c));continue}f+=c,d?(l+=v,u+=c):(l&&(s+=l,l="",u=0),s+=v)}return!a.length&&!s&&(s=t,l="",u=0),l&&(s+=l),s&&(a.push(s),o.push(f)),a.length===1&&(f+=n),{accumWidth:f,lines:a,linesWidths:o}}var Ev="__zr_style_"+Math.round(Math.random()*10),Gn={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},xf={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Gn[Ev]=!0;var Gg=["z","z2","invisible"],pE=["invisible"],Jn=function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype._init=function(r){for(var i=mt(r),n=0;n1e-4){s[0]=t-r,s[1]=e-i,l[0]=t+r,l[1]=e+i;return}if(ul[0]=Dh(n)*r+t,ul[1]=Ch(n)*i+e,fl[0]=Dh(a)*r+t,fl[1]=Ch(a)*i+e,u(s,ul,fl),f(l,ul,fl),n=n%on,n<0&&(n=n+on),a=a%on,a<0&&(a=a+on),n>a&&!o?a+=on:nn&&(hl[0]=Dh(c)*r+t,hl[1]=Ch(c)*i+e,u(s,hl,s),f(l,hl,l))}var Bt={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},sn=[],ln=[],Hr=[],Ai=[],Vr=[],Gr=[],Lh=Math.min,Rh=Math.max,un=Math.cos,fn=Math.sin,si=Math.abs,Mv=Math.PI,Oi=Mv*2,Ph=typeof Float32Array<"u",yo=[];function Ih(t){var e=Math.round(t/Mv*1e8)/1e8;return e%2*Mv}function xE(t,e){var r=Ih(t[0]);r<0&&(r+=Oi);var i=r-t[0],n=t[1];n+=i,!e&&n-r>=Oi?n=r+Oi:e&&r-n>=Oi?n=r-Oi:!e&&r>n?n=r+(Oi-Ih(r-n)):e&&r0&&(this._ux=si(i/Mu/e)||0,this._uy=si(i/Mu/r)||0)},t.prototype.setDPR=function(e){this.dpr=e},t.prototype.setContext=function(e){this._ctx=e},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(e,r){return this._drawPendingPt(),this.addData(Bt.M,e,r),this._ctx&&this._ctx.moveTo(e,r),this._x0=e,this._y0=r,this._xi=e,this._yi=r,this},t.prototype.lineTo=function(e,r){var i=si(e-this._xi),n=si(r-this._yi),a=i>this._ux||n>this._uy;if(this.addData(Bt.L,e,r),this._ctx&&a&&this._ctx.lineTo(e,r),a)this._xi=e,this._yi=r,this._pendingPtDist=0;else{var o=i*i+n*n;o>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=r,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(e,r,i,n,a,o){return this._drawPendingPt(),this.addData(Bt.C,e,r,i,n,a,o),this._ctx&&this._ctx.bezierCurveTo(e,r,i,n,a,o),this._xi=a,this._yi=o,this},t.prototype.quadraticCurveTo=function(e,r,i,n){return this._drawPendingPt(),this.addData(Bt.Q,e,r,i,n),this._ctx&&this._ctx.quadraticCurveTo(e,r,i,n),this._xi=i,this._yi=n,this},t.prototype.arc=function(e,r,i,n,a,o){this._drawPendingPt(),yo[0]=n,yo[1]=a,xE(yo,o),n=yo[0],a=yo[1];var s=a-n;return this.addData(Bt.A,e,r,i,i,n,s,0,o?0:1),this._ctx&&this._ctx.arc(e,r,i,n,a,o),this._xi=un(a)*i+e,this._yi=fn(a)*i+r,this},t.prototype.arcTo=function(e,r,i,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,r,i,n,a),this},t.prototype.rect=function(e,r,i,n){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,r,i,n),this.addData(Bt.R,e,r,i,n),this},t.prototype.closePath=function(){this._drawPendingPt(),this.addData(Bt.Z);var e=this._ctx,r=this._x0,i=this._y0;return e&&e.closePath(),this._xi=r,this._yi=i,this},t.prototype.fill=function(e){e&&e.fill(),this.toStatic()},t.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},t.prototype.len=function(){return this._len},t.prototype.setData=function(e){var r=e.length;!(this.data&&this.data.length===r)&&Ph&&(this.data=new Float32Array(r));for(var i=0;if.length&&(this._expandData(),f=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],r=0;r11&&(this.data=new Float32Array(e)))}},t.prototype.getBoundingRect=function(){Hr[0]=Hr[1]=Vr[0]=Vr[1]=Number.MAX_VALUE,Ai[0]=Ai[1]=Gr[0]=Gr[1]=-Number.MAX_VALUE;var e=this.data,r=0,i=0,n=0,a=0,o;for(o=0;oi||si(y)>n||v===r-1)&&(p=Math.sqrt(_*_+y*y),a=g,o=m);break}case Bt.C:{var x=e[v++],S=e[v++],g=e[v++],m=e[v++],T=e[v++],w=e[v++];p=kb(a,o,x,S,g,m,T,w,10),a=T,o=w;break}case Bt.Q:{var x=e[v++],S=e[v++],g=e[v++],m=e[v++];p=Ub(a,o,x,S,g,m,10),a=g,o=m;break}case Bt.A:var b=e[v++],A=e[v++],M=e[v++],E=e[v++],D=e[v++],R=e[v++],P=R+D;v+=1,d&&(s=un(D)*M+b,l=fn(D)*E+A),p=Rh(M,E)*Lh(Oi,Math.abs(R)),a=un(P)*M+b,o=fn(P)*E+A;break;case Bt.R:{s=a=e[v++],l=o=e[v++];var I=e[v++],N=e[v++];p=I*2+N*2;break}case Bt.Z:{var _=s-a,y=l-o;p=Math.sqrt(_*_+y*y),a=s,o=l;break}}p>=0&&(u[h++]=p,f+=p)}return this._pathLen=f,f},t.prototype.rebuildPath=function(e,r){var i=this.data,n=this._ux,a=this._uy,o=this._len,s,l,u,f,h,v,c=r<1,d,p,g=0,m=0,_,y=0,x,S;if(!(c&&(this._pathSegLen||this._calculateLength(),d=this._pathSegLen,p=this._pathLen,_=r*p,!_)))t:for(var T=0;T0&&(e.lineTo(x,S),y=0),w){case Bt.M:s=u=i[T++],l=f=i[T++],e.moveTo(u,f);break;case Bt.L:{h=i[T++],v=i[T++];var A=si(h-u),M=si(v-f);if(A>n||M>a){if(c){var E=d[m++];if(g+E>_){var D=(_-g)/E;e.lineTo(u*(1-D)+h*D,f*(1-D)+v*D);break t}g+=E}e.lineTo(h,v),u=h,f=v,y=0}else{var R=A*A+M*M;R>y&&(x=h,S=v,y=R)}break}case Bt.C:{var P=i[T++],I=i[T++],N=i[T++],V=i[T++],O=i[T++],X=i[T++];if(c){var E=d[m++];if(g+E>_){var D=(_-g)/E;wu(u,P,N,O,D,sn),wu(f,I,V,X,D,ln),e.bezierCurveTo(sn[1],ln[1],sn[2],ln[2],sn[3],ln[3]);break t}g+=E}e.bezierCurveTo(P,I,N,V,O,X),u=O,f=X;break}case Bt.Q:{var P=i[T++],I=i[T++],N=i[T++],V=i[T++];if(c){var E=d[m++];if(g+E>_){var D=(_-g)/E;bu(u,P,N,D,sn),bu(f,I,V,D,ln),e.quadraticCurveTo(sn[1],ln[1],sn[2],ln[2]);break t}g+=E}e.quadraticCurveTo(P,I,N,V),u=N,f=V;break}case Bt.A:var G=i[T++],lt=i[T++],J=i[T++],ot=i[T++],at=i[T++],Dt=i[T++],pt=i[T++],Ot=!i[T++],Ht=J>ot?J:ot,Nt=si(J-ot)>.001,wt=at+Dt,et=!1;if(c){var E=d[m++];g+E>_&&(wt=at+Dt*(_-g)/E,et=!0),g+=E}if(Nt&&e.ellipse?e.ellipse(G,lt,J,ot,pt,at,wt,Ot):e.arc(G,lt,Ht,at,wt,Ot),et)break t;b&&(s=un(at)*J+G,l=fn(at)*ot+lt),u=un(wt)*J+G,f=fn(wt)*ot+lt;break;case Bt.R:s=u=i[T],l=f=i[T+1],h=i[T++],v=i[T++];var xt=i[T++],re=i[T++];if(c){var E=d[m++];if(g+E>_){var Vt=_-g;e.moveTo(h,v),e.lineTo(h+Lh(Vt,xt),v),Vt-=xt,Vt>0&&e.lineTo(h+xt,v+Lh(Vt,re)),Vt-=re,Vt>0&&e.lineTo(h+Rh(xt-Vt,0),v+re),Vt-=xt,Vt>0&&e.lineTo(h,v+Rh(re-Vt,0));break t}g+=E}e.rect(h,v,xt,re);break;case Bt.Z:if(c){var E=d[m++];if(g+E>_){var D=(_-g)/E;e.lineTo(u*(1-D)+s*D,f*(1-D)+l*D);break t}g+=E}e.closePath(),u=s,f=l}}},t.prototype.clone=function(){var e=new t,r=this.data;return e.data=r.slice?r.slice():Array.prototype.slice.call(r),e._len=this._len,e},t.CMD=Bt,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),t}();function sa(t,e,r,i,n,a,o){if(n===0)return!1;var s=n,l=0,u=t;if(o>e+s&&o>i+s||ot+s&&a>r+s||ae+h&&f>i+h&&f>a+h&&f>s+h||ft+h&&u>r+h&&u>n+h&&u>o+h||ue+u&&l>i+u&&l>a+u||lt+u&&s>r+u&&s>n+u||sr||f+un&&(n+=xo);var v=Math.atan2(l,s);return v<0&&(v+=xo),v>=i&&v<=n||v+xo>=i&&v+xo<=n}function hn(t,e,r,i,n,a){if(a>e&&a>i||an?s:0}var Ei=_i.CMD,cn=Math.PI*2,bE=1e-4;function AE(t,e){return Math.abs(t-e)e&&u>i&&u>a&&u>s||u1&&EE(),c=ce(e,i,a,s,ur[0]),v>1&&(d=ce(e,i,a,s,ur[1]))),v===2?ge&&s>i&&s>a||s=0&&u<=1){for(var f=0,h=Ae(e,i,a,u),v=0;vr||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Pe[0]=-l,Pe[1]=l;var u=Math.abs(i-n);if(u<1e-4)return 0;if(u>=cn-1e-4){i=0,n=cn;var f=a?1:-1;return o>=Pe[0]+t&&o<=Pe[1]+t?f:0}if(i>n){var h=i;i=n,n=h}i<0&&(i+=cn,n+=cn);for(var v=0,c=0;c<2;c++){var d=Pe[c];if(d+t>o){var p=Math.atan2(s,d),f=a?1:-1;p<0&&(p=cn+p),(p>=i&&p<=n||p+cn>=i&&p+cn<=n)&&(p>Math.PI/2&&p1&&(r||(s+=hn(l,u,f,h,i,n))),g&&(l=a[d],u=a[d+1],f=l,h=u),p){case Ei.M:f=a[d++],h=a[d++],l=f,u=h;break;case Ei.L:if(r){if(sa(l,u,a[d],a[d+1],e,i,n))return!0}else s+=hn(l,u,a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Ei.C:if(r){if(TE(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=ME(l,u,a[d++],a[d++],a[d++],a[d++],a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Ei.Q:if(r){if(SE(l,u,a[d++],a[d++],a[d],a[d+1],e,i,n))return!0}else s+=CE(l,u,a[d++],a[d++],a[d],a[d+1],i,n)||0;l=a[d++],u=a[d++];break;case Ei.A:var m=a[d++],_=a[d++],y=a[d++],x=a[d++],S=a[d++],T=a[d++];d+=1;var w=!!(1-a[d++]);v=Math.cos(S)*y+m,c=Math.sin(S)*x+_,g?(f=v,h=c):s+=hn(l,u,v,c,i,n);var b=(i-m)*x/y+m;if(r){if(wE(m,_,x,S,S+T,w,e,b,n))return!0}else s+=DE(m,_,x,S,S+T,w,b,n);l=Math.cos(S+T)*y+m,u=Math.sin(S+T)*x+_;break;case Ei.R:f=l=a[d++],h=u=a[d++];var A=a[d++],M=a[d++];if(v=f+A,c=h+M,r){if(sa(f,h,v,h,e,i,n)||sa(v,h,v,c,e,i,n)||sa(v,c,f,c,e,i,n)||sa(f,c,f,h,e,i,n))return!0}else s+=hn(v,h,v,c,i,n),s+=hn(f,c,f,h,i,n);break;case Ei.Z:if(r){if(sa(l,u,f,h,e,i,n))return!0}else s+=hn(l,u,f,h,i,n);l=f,u=h;break}}return!r&&!AE(u,h)&&(s+=hn(l,u,f,h,i,n)||0),s!==0}function LE(t,e,r){return yx(t,0,!1,e,r)}function RE(t,e,r,i){return yx(t,e,!0,r,i)}var Lu=Et({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Gn),PE={style:Et({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},xf.style)},Nh=ii.concat(["invisible","culling","z","z2","zlevel","parent"]),kt=function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.update=function(){var r=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var n=this._decalEl=this._decalEl||new e;n.buildPath===e.prototype.buildPath&&(n.buildPath=function(l){r.buildPath(l,r.shape)}),n.silent=!0;var a=n.style;for(var o in i)a[o]!==i[o]&&(a[o]=i[o]);a.fill=i.fill?i.decal:null,a.decal=null,a.shadowColor=null,i.strokeFirst&&(a.stroke=null);for(var s=0;s.5?Tv:i>.2?pA:Sv}else if(r)return Sv}return Tv},e.prototype.getInsideTextStroke=function(r){var i=this.style.fill;if(Q(i)){var n=this.__zr,a=!!(n&&n.isDarkMode()),o=Au(r,0)0))},e.prototype.hasFill=function(){var r=this.style,i=r.fill;return i!=null&&i!=="none"},e.prototype.getBoundingRect=function(){var r=this._rect,i=this.style,n=!r;if(n){var a=!1;this.path||(a=!0,this.createPathProxy());var o=this.path;(a||this.__dirty&Ca)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),r=o.getBoundingRect()}if(this._rect=r,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=r.clone());if(this.__dirty||n){s.copy(r);var l=i.strokeNoScale?this.getLineScale():1,u=i.lineWidth;if(!this.hasFill()){var f=this.strokeContainThreshold;u=Math.max(u,f??4)}l>1e-10&&(s.width+=u/l,s.height+=u/l,s.x-=u/l/2,s.y-=u/l/2)}return s}return r},e.prototype.contain=function(r,i){var n=this.transformCoordToLocal(r,i),a=this.getBoundingRect(),o=this.style;if(r=n[0],i=n[1],a.contain(r,i)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,u=o.strokeNoScale?this.getLineScale():1;if(u>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),RE(s,l/u,r,i)))return!0}if(this.hasFill())return LE(s,r,i)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=Ca,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(r){return this.animate("shape",r)},e.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():r==="shape"?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(r,i){r==="shape"?this.setShape(i):t.prototype.attrKV.call(this,r,i)},e.prototype.setShape=function(r,i){var n=this.shape;return n||(n=this.shape={}),typeof r=="string"?n[r]=i:Y(n,r),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&Ca)},e.prototype.createStyle=function(r){return hf(Lu,r)},e.prototype._innerSaveToNormal=function(r){t.prototype._innerSaveToNormal.call(this,r);var i=this._normalState;r.shape&&!i.shape&&(i.shape=Y({},this.shape))},e.prototype._applyStateObj=function(r,i,n,a,o,s){t.prototype._applyStateObj.call(this,r,i,n,a,o,s);var l=!(i&&a),u;if(i&&i.shape?o?a?u=i.shape:(u=Y({},n.shape),Y(u,i.shape)):(u=Y({},a?this.shape:n.shape),Y(u,i.shape)):l&&(u=n.shape),u)if(o){this.shape=Y({},this.shape);for(var f={},h=mt(u),v=0;v0},e.prototype.hasFill=function(){var r=this.style,i=r.fill;return i!=null&&i!=="none"},e.prototype.createStyle=function(r){return hf(IE,r)},e.prototype.setBoundingRect=function(r){this._rect=r},e.prototype.getBoundingRect=function(){var r=this.style;if(!this._rect){var i=r.text;i!=null?i+="":i="";var n=kd(i,r.font,r.textAlign,r.textBaseline);if(n.x+=r.x||0,n.y+=r.y||0,this.hasStroke()){var a=r.lineWidth;n.x-=a/2,n.y-=a/2,n.width+=a,n.height+=a}this._rect=n}return this._rect},e.initDefaultProps=function(){var r=e.prototype;r.dirtyRectTolerance=10}(),e}(Jn);Ss.prototype.type="tspan";var NE=Et({x:0,y:0},Gn),OE={style:Et({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},xf.style)};function BE(t){return!!(t&&typeof t!="string"&&t.width&&t.height)}var ir=function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.createStyle=function(r){return hf(NE,r)},e.prototype._getSize=function(r){var i=this.style,n=i[r];if(n!=null)return n;var a=BE(i.image)?i.image:this.__image;if(!a)return 0;var o=r==="width"?"height":"width",s=i[o];return s==null?a[r]:a[r]/a[o]*s},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return OE},e.prototype.getBoundingRect=function(){var r=this.style;return this._rect||(this._rect=new Pt(r.x||0,r.y||0,this.getWidth(),this.getHeight())),this._rect},e}(Jn);ir.prototype.type="image";function FE(t,e){var r=e.x,i=e.y,n=e.width,a=e.height,o=e.r,s,l,u,f;n<0&&(r=r+n,n=-n),a<0&&(i=i+a,a=-a),typeof o=="number"?s=l=u=f=o:o instanceof Array?o.length===1?s=l=u=f=o[0]:o.length===2?(s=u=o[0],l=f=o[1]):o.length===3?(s=o[0],l=f=o[1],u=o[2]):(s=o[0],l=o[1],u=o[2],f=o[3]):s=l=u=f=0;var h;s+l>n&&(h=s+l,s*=n/h,l*=n/h),u+f>n&&(h=u+f,u*=n/h,f*=n/h),l+u>a&&(h=l+u,l*=a/h,u*=a/h),s+f>a&&(h=s+f,s*=a/h,f*=a/h),t.moveTo(r+s,i),t.lineTo(r+n-l,i),l!==0&&t.arc(r+n-l,i+l,l,-Math.PI/2,0),t.lineTo(r+n,i+a-u),u!==0&&t.arc(r+n-u,i+a-u,u,0,Math.PI/2),t.lineTo(r+f,i+a),f!==0&&t.arc(r+f,i+a-f,f,Math.PI/2,Math.PI),t.lineTo(r,i+s),s!==0&&t.arc(r+s,i+s,s,Math.PI,Math.PI*1.5)}var Oa=Math.round;function xx(t,e,r){if(e){var i=e.x1,n=e.x2,a=e.y1,o=e.y2;t.x1=i,t.x2=n,t.y1=a,t.y2=o;var s=r&&r.lineWidth;return s&&(Oa(i*2)===Oa(n*2)&&(t.x1=t.x2=Bn(i,s,!0)),Oa(a*2)===Oa(o*2)&&(t.y1=t.y2=Bn(a,s,!0))),t}}function Tx(t,e,r){if(e){var i=e.x,n=e.y,a=e.width,o=e.height;t.x=i,t.y=n,t.width=a,t.height=o;var s=r&&r.lineWidth;return s&&(t.x=Bn(i,s,!0),t.y=Bn(n,s,!0),t.width=Math.max(Bn(i+a,s,!1)-t.x,a===0?0:1),t.height=Math.max(Bn(n+o,s,!1)-t.y,o===0?0:1)),t}}function Bn(t,e,r){if(!e)return t;var i=Oa(t*2);return(i+Oa(e))%2===0?i/2:(i+(r?1:-1))/2}var kE=function(){function t(){this.x=0,this.y=0,this.width=0,this.height=0}return t}(),zE={},Kt=function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new kE},e.prototype.buildPath=function(r,i){var n,a,o,s;if(this.subPixelOptimize){var l=Tx(zE,i,this.style);n=l.x,a=l.y,o=l.width,s=l.height,l.r=i.r,i=l}else n=i.x,a=i.y,o=i.width,s=i.height;i.r?FE(r,i):r.rect(n,a,o,s)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(kt);Kt.prototype.type="rect";var qg={fill:"#000"},$g=2,UE={style:Et({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},xf.style)},Xt=function(t){K(e,t);function e(r){var i=t.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=qg,i.attr(r),i}return e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var r=0;r0,D=r.width!=null&&(r.overflow==="truncate"||r.overflow==="break"||r.overflow==="breakAll"),R=o.calculatedLineHeight,P=0;P=0&&(P=T[R],P.align==="right");)this._placeToken(P,r,b,m,D,"right",y),A-=P.width,D-=P.width,R--;for(E+=(a-(E-g)-(_-D)-A)/2;M<=R;)P=T[M],this._placeToken(P,r,b,m,E+P.width/2,"center",y),E+=P.width,M++;m+=b}},e.prototype._placeToken=function(r,i,n,a,o,s,l){var u=i.rich[r.styleName]||{};u.text=r.text;var f=r.verticalAlign,h=a+n/2;f==="top"?h=a+r.height/2:f==="bottom"&&(h=a+n-r.height/2);var v=!r.isLineHolder&&Oh(u);v&&this._renderBackground(u,i,s==="right"?o-r.width:s==="center"?o-r.width/2:o,h-r.height/2,r.width,r.height);var c=!!u.backgroundColor,d=r.textPadding;d&&(o=em(o,s,d),h-=r.height/2-d[0]-r.innerHeight/2);var p=this._getOrCreateChild(Ss),g=p.createStyle();p.useStyle(g);var m=this._defaultStyle,_=!1,y=0,x=tm("fill"in u?u.fill:"fill"in i?i.fill:(_=!0,m.fill)),S=Jg("stroke"in u?u.stroke:"stroke"in i?i.stroke:!c&&!l&&(!m.autoStroke||_)?(y=$g,m.stroke):null),T=u.textShadowBlur>0||i.textShadowBlur>0;g.text=r.text,g.x=o,g.y=h,T&&(g.shadowBlur=u.textShadowBlur||i.textShadowBlur||0,g.shadowColor=u.textShadowColor||i.textShadowColor||"transparent",g.shadowOffsetX=u.textShadowOffsetX||i.textShadowOffsetX||0,g.shadowOffsetY=u.textShadowOffsetY||i.textShadowOffsetY||0),g.textAlign=s,g.textBaseline="middle",g.font=r.font||Zi,g.opacity=Jl(u.opacity,i.opacity,1),jg(g,u),S&&(g.lineWidth=Jl(u.lineWidth,i.lineWidth,y),g.lineDash=ft(u.lineDash,i.lineDash),g.lineDashOffset=i.lineDashOffset||0,g.stroke=S),x&&(g.fill=x);var w=r.contentWidth,b=r.contentHeight;p.setBoundingRect(new Pt(qo(g.x,w,g.textAlign),Da(g.y,b,g.textBaseline),w,b))},e.prototype._renderBackground=function(r,i,n,a,o,s){var l=r.backgroundColor,u=r.borderWidth,f=r.borderColor,h=l&&l.image,v=l&&!h,c=r.borderRadius,d=this,p,g;if(v||r.lineHeight||u&&f){p=this._getOrCreateChild(Kt),p.useStyle(p.createStyle()),p.style.fill=null;var m=p.shape;m.x=n,m.y=a,m.width=o,m.height=s,m.r=c,p.dirtyShape()}if(v){var _=p.style;_.fill=l||null,_.fillOpacity=ft(r.fillOpacity,1)}else if(h){g=this._getOrCreateChild(ir),g.onload=function(){d.dirtyStyle()};var y=g.style;y.image=l.image,y.x=n,y.y=a,y.width=o,y.height=s}if(u&&f){var _=p.style;_.lineWidth=u,_.stroke=f,_.strokeOpacity=ft(r.strokeOpacity,1),_.lineDash=r.borderDash,_.lineDashOffset=r.borderDashOffset||0,p.strokeContainThreshold=0,p.hasFill()&&p.hasStroke()&&(_.strokeFirst=!0,_.lineWidth*=2)}var x=(p||g).style;x.shadowBlur=r.shadowBlur||0,x.shadowColor=r.shadowColor||"transparent",x.shadowOffsetX=r.shadowOffsetX||0,x.shadowOffsetY=r.shadowOffsetY||0,x.opacity=Jl(r.opacity,i.opacity,1)},e.makeFont=function(r){var i="";return bx(r)&&(i=[r.fontStyle,r.fontWeight,Sx(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),i&&jr(i)||r.textFont||r.font},e}(Jn),HE={left:!0,right:1,center:1},VE={top:1,bottom:1,middle:1},Kg=["fontStyle","fontWeight","fontSize","fontFamily"];function Sx(t){return typeof t=="string"&&(t.indexOf("px")!==-1||t.indexOf("rem")!==-1||t.indexOf("em")!==-1)?t:isNaN(+t)?Md+"px":t+"px"}function jg(t,e){for(var r=0;r=0,a=!1;if(t instanceof kt){var o=Ax(t),s=n&&o.selectFill||o.normalFill,l=n&&o.selectStroke||o.normalStroke;if(la(s)||la(l)){i=i||{};var u=i.style||{};u.fill==="inherit"?(a=!0,i=Y({},i),u=Y({},u),u.fill=s):!la(u.fill)&&la(s)?(a=!0,i=Y({},i),u=Y({},u),u.fill=vv(s)):!la(u.stroke)&&la(l)&&(a||(i=Y({},i),u=Y({},u)),u.stroke=vv(l)),i.style=u}}if(i&&i.z2==null){a||(i=Y({},i));var f=t.z2EmphasisLift;i.z2=t.z2+(f??XE)}return i}function jE(t,e,r){if(r&&r.z2==null){r=Y({},r);var i=t.z2SelectLift;r.z2=t.z2+(i??YE)}return r}function QE(t,e,r){var i=bt(t.currentStates,e)>=0,n=t.style.opacity,a=i?null:$E(t,["opacity"],e,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=Y({},r),o=Y({opacity:i?n:a.opacity*.1},o),r.style=o),r}function Bh(t,e){var r=this.states[t];if(this.style){if(t==="emphasis")return KE(this,t,e,r);if(t==="blur")return QE(this,t,r);if(t==="select")return jE(this,t,r)}return r}function JE(t){t.stateProxy=Bh;var e=t.getTextContent(),r=t.getTextGuideLine();e&&(e.stateProxy=Bh),r&&(r.stateProxy=Bh)}function sm(t,e){!Px(t,e)&&!t.__highByOuter&&xi(t,Ex)}function lm(t,e){!Px(t,e)&&!t.__highByOuter&&xi(t,Mx)}function Pu(t,e){t.__highByOuter|=1<<(e||0),xi(t,Ex)}function Iu(t,e){!(t.__highByOuter&=~(1<<(e||0)))&&xi(t,Mx)}function tM(t){xi(t,Zd)}function Dx(t){xi(t,Cx)}function Lx(t){xi(t,ZE)}function Rx(t){xi(t,qE)}function Px(t,e){return t.__highDownSilentOnTouch&&e.zrByTouch}function Ix(t){var e=t.getModel(),r=[],i=[];e.eachComponent(function(n,a){var o=Xd(a),s=n==="series",l=s?t.getViewOfSeriesModel(a):t.getViewOfComponentModel(a);!s&&i.push(l),o.isBlured&&(l.group.traverse(function(u){Cx(u)}),s&&r.push(a)),o.isBlured=!1}),C(i,function(n){n&&n.toggleBlurSeries&&n.toggleBlurSeries(r,!1,e)})}function Cv(t,e,r,i){var n=i.getModel();r=r||"coordinateSystem";function a(u,f){for(var h=0;h0){var s={dataIndex:o,seriesIndex:r.seriesIndex};a!=null&&(s.dataType=a),e.push(s)}})}),e}function Nu(t,e,r){$d(t,!0),xi(t,JE),sM(t,e,r)}function oM(t){$d(t,!1)}function Lv(t,e,r,i){i?oM(t):Nu(t,e,r)}function sM(t,e,r){var i=Mt(t);e!=null?(i.focus=e,i.blurScope=r):i.focus&&(i.focus=null)}var fm=["emphasis","blur","select"],lM={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function hm(t,e,r,i){r=r||"itemStyle";for(var n=0;n1&&(o*=Fh(d),s*=Fh(d));var p=(n===a?-1:1)*Fh((o*o*(s*s)-o*o*(c*c)-s*s*(v*v))/(o*o*(c*c)+s*s*(v*v)))||0,g=p*o*c/s,m=p*-s*v/o,_=(t+r)/2+vl(h)*g-cl(h)*m,y=(e+i)/2+cl(h)*g+vl(h)*m,x=pm([1,0],[(v-g)/o,(c-m)/s]),S=[(v-g)/o,(c-m)/s],T=[(-1*v-g)/o,(-1*c-m)/s],w=pm(S,T);if(Iv(S,T)<=-1&&(w=To),Iv(S,T)>=1&&(w=0),w<0){var b=Math.round(w/To*1e6)/1e6;w=To*2+b%2*To}f.addData(u,_,y,o,s,x,w,h,a)}var dM=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,pM=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function gM(t){var e=new _i;if(!t)return e;var r=0,i=0,n=r,a=i,o,s=_i.CMD,l=t.match(dM);if(!l)return e;for(var u=0;uP*P+I*I&&(b=M,A=E),{cx:b,cy:A,x0:-f,y0:-h,x1:b*(n/S-1),y1:A*(n/S-1)}}function bM(t){var e;if(j(t)){var r=t.length;if(!r)return t;r===1?e=[t[0],t[0],0,0]:r===2?e=[t[0],t[0],t[1],t[1]]:r===3?e=t.concat(t[2]):e=t}else e=[t,t,t,t];return e}function AM(t,e){var r,i=$o(e.r,0),n=$o(e.r0||0,0),a=i>0,o=n>0;if(!(!a&&!o)){if(a||(i=n,n=0),n>i){var s=i;i=n,n=s}var l=e.startAngle,u=e.endAngle;if(!(isNaN(l)||isNaN(u))){var f=e.cx,h=e.cy,v=!!e.clockwise,c=mm(u-l),d=c>kh&&c%kh;if(d>Cr&&(c=d),!(i>Cr))t.moveTo(f,h);else if(c>kh-Cr)t.moveTo(f+i*fa(l),h+i*vn(l)),t.arc(f,h,i,l,u,!v),n>Cr&&(t.moveTo(f+n*fa(u),h+n*vn(u)),t.arc(f,h,n,u,l,v));else{var p=void 0,g=void 0,m=void 0,_=void 0,y=void 0,x=void 0,S=void 0,T=void 0,w=void 0,b=void 0,A=void 0,M=void 0,E=void 0,D=void 0,R=void 0,P=void 0,I=i*fa(l),N=i*vn(l),V=n*fa(u),O=n*vn(u),X=c>Cr;if(X){var G=e.cornerRadius;G&&(r=bM(G),p=r[0],g=r[1],m=r[2],_=r[3]);var lt=mm(i-n)/2;if(y=Wr(lt,m),x=Wr(lt,_),S=Wr(lt,p),T=Wr(lt,g),A=w=$o(y,x),M=b=$o(S,T),(w>Cr||b>Cr)&&(E=i*fa(u),D=i*vn(u),R=n*fa(l),P=n*vn(l),cCr){var Nt=Wr(m,A),wt=Wr(_,A),et=dl(R,P,I,N,i,Nt,v),xt=dl(E,D,V,O,i,wt,v);t.moveTo(f+et.cx+et.x0,h+et.cy+et.y0),A0&&t.arc(f+et.cx,h+et.cy,Nt,we(et.y0,et.x0),we(et.y1,et.x1),!v),t.arc(f,h,i,we(et.cy+et.y1,et.cx+et.x1),we(xt.cy+xt.y1,xt.cx+xt.x1),!v),wt>0&&t.arc(f+xt.cx,h+xt.cy,wt,we(xt.y1,xt.x1),we(xt.y0,xt.x0),!v))}else t.moveTo(f+I,h+N),t.arc(f,h,i,l,u,!v);if(!(n>Cr)||!X)t.lineTo(f+V,h+O);else if(M>Cr){var Nt=Wr(p,M),wt=Wr(g,M),et=dl(V,O,E,D,n,-wt,v),xt=dl(I,N,R,P,n,-Nt,v);t.lineTo(f+et.cx+et.x0,h+et.cy+et.y0),M0&&t.arc(f+et.cx,h+et.cy,wt,we(et.y0,et.x0),we(et.y1,et.x1),!v),t.arc(f,h,n,we(et.cy+et.y1,et.cx+et.x1),we(xt.cy+xt.y1,xt.cx+xt.x1),v),Nt>0&&t.arc(f+xt.cx,h+xt.cy,Nt,we(xt.y1,xt.x1),we(xt.y0,xt.x0),!v))}else t.lineTo(f+V,h+O),t.arc(f,h,n,u,l,v)}t.closePath()}}}var EM=function(){function t(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return t}(),Af=function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new EM},e.prototype.buildPath=function(r,i){AM(r,i)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(kt);Af.prototype.type="sector";var MM=function(){function t(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return t}(),jd=function(t){K(e,t);function e(r){return t.call(this,r)||this}return e.prototype.getDefaultShape=function(){return new MM},e.prototype.buildPath=function(r,i){var n=i.cx,a=i.cy,o=Math.PI*2;r.moveTo(n+i.r,a),r.arc(n,a,i.r,0,o,!1),r.moveTo(n+i.r0,a),r.arc(n,a,i.r0,0,o,!0)},e}(kt);jd.prototype.type="ring";function CM(t,e,r,i){var n=[],a=[],o=[],s=[],l,u,f,h;if(i){f=[1/0,1/0],h=[-1/0,-1/0];for(var v=0,c=t.length;v=2){if(i){var a=CM(n,i,r,e.smoothConstraint);t.moveTo(n[0][0],n[0][1]);for(var o=n.length,s=0;s<(r?o:o-1);s++){var l=a[s*2],u=a[s*2+1],f=n[(s+1)%o];t.bezierCurveTo(l[0],l[1],u[0],u[1],f[0],f[1])}}else{t.moveTo(n[0][0],n[0][1]);for(var s=1,h=n.length;spn[1]){if(s=!1,a)return s;var f=Math.abs(pn[0]-dn[1]),h=Math.abs(dn[0]-pn[1]);Math.min(f,h)>n.len()&&(f0){var h=f.duration,v=f.delay,c=f.easing,d={duration:h,delay:v||0,easing:c,done:a,force:!!a||!!o,setToFinal:!u,scope:t,during:o};s?e.animateFrom(r,d):e.animateTo(r,d)}else e.stopAnimation(),!s&&e.attr(r),o&&o(1),a&&a()}function Sr(t,e,r,i,n,a){ep("update",t,e,r,i,n,a)}function $i(t,e,r,i,n,a){ep("enter",t,e,r,i,n,a)}function Xa(t){if(!t.__zr)return!0;for(var e=0;eMath.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function xm(t){return!t.isGroup}function jM(t){return t.shape!=null}function Xx(t,e,r){if(!t||!e)return;function i(o){var s={};return o.traverse(function(l){xm(l)&&l.anid&&(s[l.anid]=l)}),s}function n(o){var s={x:o.x,y:o.y,rotation:o.rotation};return jM(o)&&(s.shape=Y({},o.shape)),s}var a=i(t);e.traverse(function(o){if(xm(o)&&o.anid){var s=a[o.anid];if(s){var l=n(o);o.attr(n(s)),Sr(o,l,r,Mt(o).dataIndex)}}})}function QM(t,e){return tt(t,function(r){var i=r[0];i=Fu(i,e.x),i=ku(i,e.x+e.width);var n=r[1];return n=Fu(n,e.y),n=ku(n,e.y+e.height),[i,n]})}function JM(t,e){var r=Fu(t.x,e.x),i=ku(t.x+t.width,e.x+e.width),n=Fu(t.y,e.y),a=ku(t.y+t.height,e.y+e.height);if(i>=r&&a>=n)return{x:r,y:n,width:i-r,height:a-n}}function np(t,e,r){var i=Y({rectHover:!0},e),n=i.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},t)return t.indexOf("image://")===0?(n.image=t.slice(8),Et(n,r),new ir(i)):rp(t.replace("path://",""),i,r,"center")}function tC(t,e,r,i,n){for(var a=0,o=n[n.length-1];a1)return!1;var g=zh(c,d,f,h)/v;return!(g<0||g>1)}function zh(t,e,r,i){return t*i-r*e}function eC(t){return t<=1e-6&&t>=-1e-6}function Mf(t){var e=t.itemTooltipOption,r=t.componentModel,i=t.itemName,n=Q(e)?{formatter:e}:e,a=r.mainType,o=r.componentIndex,s={componentType:a,name:i,$vars:["name"]};s[a+"Index"]=o;var l=t.formatterParamsExtra;l&&C(mt(l),function(f){gt(s,f)||(s[f]=l[f],s.$vars.push(f))});var u=Mt(t.el);u.componentMainType=a,u.componentIndex=o,u.tooltipConfig={name:i,option:Et({content:i,encodeHTMLContent:!0,formatterParams:s},n)}}function Tm(t,e){var r;t.isGroup&&(r=e(t)),r||t.traverse(e)}function ap(t,e){if(t)if(j(t))for(var r=0;r=0&&s.push(l)}),s}}function Xs(t,e){return dt(dt({},t,!0),e,!0)}const gC={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}},mC={time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}};var zu="ZH",lp="EN",Ya=lp,lu={},up={},Kx=vt.domSupported?function(){var t=(document.documentElement.lang||navigator.language||navigator.browserLanguage||Ya).toUpperCase();return t.indexOf(zu)>-1?zu:Ya}():Ya;function jx(t,e){t=t.toUpperCase(),up[t]=new Zt(e),lu[t]=e}function _C(t){if(Q(t)){var e=lu[t.toUpperCase()]||{};return t===zu||t===lp?ut(e):dt(ut(e),ut(lu[Ya]),!1)}else return dt(ut(t),ut(lu[Ya]),!1)}function yC(t){return up[t]}function xC(){return up[Ya]}jx(lp,gC);jx(zu,mC);var fp=1e3,hp=fp*60,fs=hp*60,gr=fs*24,Mm=gr*365,Ko={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},ml="{yyyy}-{MM}-{dd}",Cm={year:"{yyyy}",month:"{yyyy}-{MM}",day:ml,hour:ml+" "+Ko.hour,minute:ml+" "+Ko.minute,second:ml+" "+Ko.second,millisecond:Ko.none},Vh=["year","month","day","hour","minute","second","millisecond"],Qx=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Ie(t,e){return t+="","0000".substr(0,e-t.length)+t}function Za(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function TC(t){return t===Za(t)}function SC(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Rf(t,e,r,i){var n=ni(t),a=n[cp(r)](),o=n[qa(r)]()+1,s=Math.floor((o-1)/3)+1,l=n[Pf(r)](),u=n["get"+(r?"UTC":"")+"Day"](),f=n[bs(r)](),h=(f-1)%12+1,v=n[If(r)](),c=n[Nf(r)](),d=n[Of(r)](),p=f>=12?"pm":"am",g=p.toUpperCase(),m=i instanceof Zt?i:yC(i||Kx)||xC(),_=m.getModel("time"),y=_.get("month"),x=_.get("monthAbbr"),S=_.get("dayOfWeek"),T=_.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,p+"").replace(/{A}/g,g+"").replace(/{yyyy}/g,a+"").replace(/{yy}/g,Ie(a%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,y[o-1]).replace(/{MMM}/g,x[o-1]).replace(/{MM}/g,Ie(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Ie(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,S[u]).replace(/{ee}/g,T[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Ie(f,2)).replace(/{H}/g,f+"").replace(/{hh}/g,Ie(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,Ie(v,2)).replace(/{m}/g,v+"").replace(/{ss}/g,Ie(c,2)).replace(/{s}/g,c+"").replace(/{SSS}/g,Ie(d,3)).replace(/{S}/g,d+"")}function wC(t,e,r,i,n){var a=null;if(Q(r))a=r;else if(ct(r))a=r(t.value,e,{level:t.level});else{var o=Y({},Ko);if(t.level>0)for(var s=0;s=0;--s)if(l[u]){a=l[u];break}a=a||o.none}if(j(a)){var h=t.level==null?0:t.level>=0?t.level:a.length+t.level;h=Math.min(h,a.length-1),a=a[h]}}return Rf(new Date(t.value),a,n,i)}function Jx(t,e){var r=ni(t),i=r[qa(e)]()+1,n=r[Pf(e)](),a=r[bs(e)](),o=r[If(e)](),s=r[Nf(e)](),l=r[Of(e)](),u=l===0,f=u&&s===0,h=f&&o===0,v=h&&a===0,c=v&&n===1,d=c&&i===1;return d?"year":c?"month":v?"day":h?"hour":f?"minute":u?"second":"millisecond"}function Dm(t,e,r){var i=$t(t)?ni(t):t;switch(e=e||Jx(t,r),e){case"year":return i[cp(r)]();case"half-year":return i[qa(r)]()>=6?1:0;case"quarter":return Math.floor((i[qa(r)]()+1)/4);case"month":return i[qa(r)]();case"day":return i[Pf(r)]();case"half-day":return i[bs(r)]()/24;case"hour":return i[bs(r)]();case"minute":return i[If(r)]();case"second":return i[Nf(r)]();case"millisecond":return i[Of(r)]()}}function cp(t){return t?"getUTCFullYear":"getFullYear"}function qa(t){return t?"getUTCMonth":"getMonth"}function Pf(t){return t?"getUTCDate":"getDate"}function bs(t){return t?"getUTCHours":"getHours"}function If(t){return t?"getUTCMinutes":"getMinutes"}function Nf(t){return t?"getUTCSeconds":"getSeconds"}function Of(t){return t?"getUTCMilliseconds":"getMilliseconds"}function bC(t){return t?"setUTCFullYear":"setFullYear"}function tT(t){return t?"setUTCMonth":"setMonth"}function eT(t){return t?"setUTCDate":"setDate"}function rT(t){return t?"setUTCHours":"setHours"}function iT(t){return t?"setUTCMinutes":"setMinutes"}function nT(t){return t?"setUTCSeconds":"setSeconds"}function aT(t){return t?"setUTCMilliseconds":"setMilliseconds"}function Uu(t){if(!PA(t))return Q(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function oT(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(r,i){return i.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var Ys=M1;function Bv(t,e,r){var i="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function n(f){return f&&jr(f)?f:"-"}function a(f){return!!(f!=null&&!isNaN(f)&&isFinite(f))}var o=e==="time",s=t instanceof Date;if(o||s){var l=o?ni(t):t;if(isNaN(+l)){if(s)return"-"}else return Rf(l,i,r)}if(e==="ordinal")return nv(t)?n(t):$t(t)&&a(t)?t+"":"-";var u=Du(t);return a(u)?Uu(u):nv(t)?n(t):typeof t=="boolean"?t+"":"-"}var Lm=["a","b","c","d","e","f","g"],Gh=function(t,e){return"{"+t+(e??"")+"}"};function sT(t,e,r){j(e)||(e=[e]);var i=e.length;if(!i)return"";for(var n=e[0].$vars||[],a=0;a':'';var o=r.markerId||"markerX";return{renderMode:a,content:"{"+o+"|} ",style:n==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}}function AC(t,e,r){(t==="week"||t==="month"||t==="quarter"||t==="half-year"||t==="year")&&(t=`MM-dd yyyy`);var i=ni(e),n="get",a=i[n+"FullYear"](),o=i[n+"Month"]()+1,s=i[n+"Date"](),l=i[n+"Hours"](),u=i[n+"Minutes"](),f=i[n+"Seconds"](),h=i[n+"Milliseconds"]();return t=t.replace("MM",Ie(o,2)).replace("M",o).replace("yyyy",a).replace("yy",Ie(a%100+"",2)).replace("dd",Ie(s,2)).replace("d",s).replace("hh",Ie(l,2)).replace("h",l).replace("mm",Ie(u,2)).replace("m",u).replace("ss",Ie(f,2)).replace("s",f).replace("SSS",Ie(h,3)),t}function $n(t,e){return e=e||"transparent",Q(t)?t:rt(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}var uu=C,uT=["left","right","top","bottom","width","height"],_l=[["width","left","right"],["height","top","bottom"]];function vp(t,e,r,i,n){var a=0,o=0;i==null&&(i=1/0),n==null&&(n=1/0);var s=0;e.eachChild(function(l,u){var f=l.getBoundingRect(),h=e.childAt(u+1),v=h&&h.getBoundingRect(),c,d;if(t==="horizontal"){var p=f.width+(v?-v.x+f.x:0);c=a+p,c>i||l.newline?(a=0,c=p,o+=s+r,s=f.height):s=Math.max(s,f.height)}else{var g=f.height+(v?-v.y+f.y:0);d=o+g,d>n||l.newline?(a+=s+r,o=0,d=g,s=f.width):s=Math.max(s,f.width)}l.newline||(l.x=a,l.y=o,l.markRedraw(),t==="horizontal"?a=c+r:o=d+r)})}var $a=vp;le(vp,"vertical");le(vp,"horizontal");function Ki(t,e,r){r=Ys(r||0);var i=e.width,n=e.height,a=se(t.left,i),o=se(t.top,n),s=se(t.right,i),l=se(t.bottom,n),u=se(t.width,i),f=se(t.height,n),h=r[2]+r[0],v=r[1]+r[3],c=t.aspect;switch(isNaN(u)&&(u=i-s-v-a),isNaN(f)&&(f=n-l-h-o),c!=null&&(isNaN(u)&&isNaN(f)&&(c>i/n?u=i*.8:f=n*.8),isNaN(u)&&(u=c*f),isNaN(f)&&(f=u/c)),isNaN(a)&&(a=i-s-u-v),isNaN(o)&&(o=n-l-f-h),t.left||t.right){case"center":a=i/2-u/2-r[3];break;case"right":a=i-u-v;break}switch(t.top||t.bottom){case"middle":case"center":o=n/2-f/2-r[0];break;case"bottom":o=n-f-h;break}a=a||0,o=o||0,isNaN(u)&&(u=i-v-a-(s||0)),isNaN(f)&&(f=n-h-o-(l||0));var d=new Pt(a+r[3],o+r[0],u,f);return d.margin=r,d}function fT(t,e,r,i,n,a){var o=!n||!n.hv||n.hv[0],s=!n||!n.hv||n.hv[1],l=n&&n.boundingMode||"all";if(a=a||t,a.x=t.x,a.y=t.y,!o&&!s)return!1;var u;if(l==="raw")u=t.type==="group"?new Pt(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(u=t.getBoundingRect(),t.needLocalTransform()){var f=t.getLocalTransform();u=u.clone(),u.applyTransform(f)}var h=Ki(Et({width:u.width,height:u.height},e),r,i),v=o?h.x-u.x:0,c=s?h.y-u.y:0;return l==="raw"?(a.x=v,a.y=c):(a.x+=v,a.y+=c),a===t&&t.markRedraw(),!0}function As(t){var e=t.layoutMode||t.constructor.layoutMode;return rt(e)?e:e?{type:e}:null}function Kn(t,e,r){var i=r&&r.ignoreSize;!j(i)&&(i=[i,i]);var n=o(_l[0],0),a=o(_l[1],1);u(_l[0],t,n),u(_l[1],t,a);function o(f,h){var v={},c=0,d={},p=0,g=2;if(uu(f,function(y){d[y]=t[y]}),uu(f,function(y){s(e,y)&&(v[y]=d[y]=e[y]),l(v,y)&&c++,l(d,y)&&p++}),i[h])return l(e,f[1])?d[f[2]]=null:l(e,f[2])&&(d[f[1]]=null),d;if(p===g||!c)return d;if(c>=g)return v;for(var m=0;m=0;l--)s=dt(s,n[l],!0);i.defaultOption=s}return i.defaultOption},e.prototype.getReferringComponents=function(r,i){var n=r+"Index",a=r+"Id";return Vs(this.ecModel,r,{index:this.get(n,!0),id:this.get(a,!0)},i)},e.prototype.getBoxLayoutParams=function(){var r=this;return{left:r.get("left"),top:r.get("top"),right:r.get("right"),bottom:r.get("bottom"),width:r.get("width"),height:r.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(r){this.option.zlevel=r},e.protoInitialize=function(){var r=e.prototype;r.type="component",r.id="",r.name="",r.mainType="",r.subType="",r.componentIndex=0}(),e}(Zt);px(Rt,Zt);_f(Rt);dC(Rt);pC(Rt,MC);function MC(t){var e=[];return C(Rt.getClassesByMainType(t),function(r){e=e.concat(r.dependencies||r.prototype.dependencies||[])}),e=tt(e,function(r){return Qr(r).main}),t!=="dataset"&&bt(e,"dataset")<=0&&e.unshift("dataset"),e}var cT="";typeof navigator<"u"&&(cT=navigator.platform||"");var ha="rgba(0, 0, 0, 0.2)";const CC={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:ha,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:ha,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:ha,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:ha,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:ha,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:ha,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:cT.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var vT=ht(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),wr="original",je="arrayRows",ai="objectRows",Ti="keyedColumns",Xi="typedArray",dT="unknown",Jr="column",uo="row",Je={Must:1,Might:2,Not:3},pT=Yt();function DC(t){pT(t).datasetMap=ht()}function LC(t,e,r){var i={},n=gT(e);if(!n||!t)return i;var a=[],o=[],s=e.ecModel,l=pT(s).datasetMap,u=n.uid+"_"+r.seriesLayoutBy,f,h;t=t.slice(),C(t,function(p,g){var m=rt(p)?p:t[g]={name:p};m.type==="ordinal"&&f==null&&(f=g,h=d(m)),i[m.name]=[]});var v=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});C(t,function(p,g){var m=p.name,_=d(p);if(f==null){var y=v.valueWayDim;c(i[m],y,_),c(o,y,_),v.valueWayDim+=_}else if(f===g)c(i[m],0,_),c(a,0,_);else{var y=v.categoryWayDim;c(i[m],y,_),c(o,y,_),v.categoryWayDim+=_}});function c(p,g,m){for(var _=0;_e)return t[i];return t[r-1]}function BC(t,e,r,i,n,a,o){a=a||t;var s=e(a),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(n))return u[n];var f=o==null||!i?r:OC(i,o);if(f=f||r,!(!f||!f.length)){var h=f[l];return n&&(u[n]=h),s.paletteIdx=(l+1)%f.length,h}}function FC(t,e){e(t).paletteIdx=0,e(t).paletteNameMap={}}var yl,So,Pm,Im="\0_ec_inner",kC=1,pp=function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(r,i,n,a,o,s){a=a||{},this.option=null,this._theme=new Zt(a),this._locale=new Zt(o),this._optionManager=s},e.prototype.setOption=function(r,i,n){var a=Bm(i);this._optionManager.setOption(r,n,a),this._resetOption(null,a)},e.prototype.resetOption=function(r,i){return this._resetOption(r,Bm(i))},e.prototype._resetOption=function(r,i){var n=!1,a=this._optionManager;if(!r||r==="recreate"){var o=a.mountOption(r==="recreate");!this.option||r==="recreate"?Pm(this,o):(this.restoreData(),this._mergeOption(o,i)),n=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=a.getTimelineOption(this);s&&(n=!0,this._mergeOption(s,i))}if(!r||r==="recreate"||r==="media"){var l=a.getMediaOption(this);l.length&&C(l,function(u){n=!0,this._mergeOption(u,i)},this)}return n},e.prototype.mergeOption=function(r){this._mergeOption(r,null)},e.prototype._mergeOption=function(r,i){var n=this.option,a=this._componentsMap,o=this._componentsCount,s=[],l=ht(),u=i&&i.replaceMergeMainTypeMap;DC(this),C(r,function(h,v){h!=null&&(Rt.hasClass(v)?v&&(s.push(v),l.set(v,!0)):n[v]=n[v]==null?ut(h):dt(n[v],h,!0))}),u&&u.each(function(h,v){Rt.hasClass(v)&&!l.get(v)&&(s.push(v),l.set(v,!0))}),Rt.topologicalTravel(s,Rt.getAllClassMainTypes(),f,this);function f(h){var v=NC(this,h,ue(r[h])),c=a.get(h),d=c?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",p=fx(c,v,d);HA(p,h,Rt),n[h]=null,a.set(h,null),o.set(h,0);var g=[],m=[],_=0,y;C(p,function(x,S){var T=x.existing,w=x.newOption;if(!w)T&&(T.mergeOption({},this),T.optionUpdated({},!1));else{var b=h==="series",A=Rt.getClass(h,x.keyInfo.subType,!b);if(!A)return;if(h==="tooltip"){if(y)return;y=!0}if(T&&T.constructor===A)T.name=x.keyInfo.name,T.mergeOption(w,this),T.optionUpdated(w,!1);else{var M=Y({componentIndex:S},x.keyInfo);T=new A(w,this,this,M),Y(T,M),x.brandNew&&(T.__requireNewView=!0),T.init(w,this,this),T.optionUpdated(null,!0)}}T?(g.push(T.option),m.push(T),_++):(g.push(void 0),m.push(void 0))},this),n[h]=g,a.set(h,m),o.set(h,_),h==="series"&&yl(this)}this._seriesIndices||yl(this)},e.prototype.getOption=function(){var r=ut(this.option);return C(r,function(i,n){if(Rt.hasClass(n)){for(var a=ue(i),o=a.length,s=!1,l=o-1;l>=0;l--)a[l]&&!xs(a[l])?s=!0:(a[l]=null,!s&&o--);a.length=o,r[n]=a}}),delete r[Im],r},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(r){this._payload=r},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(r,i){var n=this._componentsMap.get(r);if(n){var a=n[i||0];if(a)return a;if(i==null){for(var o=0;o=e:r==="max"?t<=e:t===e}function ZC(t,e){return t.join(",")===e.join(",")}var Ar=C,Es=rt,Fm=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function Xh(t){var e=t&&t.itemStyle;if(e)for(var r=0,i=Fm.length;r=0;g--){var m=t[g];if(s||(d=m.data.rawIndexOf(m.stackedByDimension,c)),d>=0){var _=m.data.getByRawIndex(m.stackResultDimension,d);if(l==="all"||l==="positive"&&_>0||l==="negative"&&_<0||l==="samesign"&&v>=0&&_>0||l==="samesign"&&v<=0&&_<0){v=DA(v,_),p=_;break}}}return i[0]=v,i[1]=p,i})})}var Ff=function(){function t(e){this.data=e.data||(e.sourceFormat===Ti?{}:[]),this.sourceFormat=e.sourceFormat||dT,this.seriesLayoutBy=e.seriesLayoutBy||Jr,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var r=this.dimensionsDefine=e.dimensionsDefine;if(r)for(var i=0;ip&&(p=y)}c[0]=d,c[1]=p}},n=function(){return this._data?this._data.length/this._dimSize:0};Wm=(e={},e[je+"_"+Jr]={pure:!0,appendData:a},e[je+"_"+uo]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},e[ai]={pure:!0,appendData:a},e[Ti]={pure:!0,appendData:function(o){var s=this._data;C(o,function(l,u){for(var f=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)f.push(l[h])})}},e[wr]={appendData:a},e[Xi]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},e);function a(o){for(var s=0;s=0&&(p=o.interpolatedValue[g])}return p!=null?p+"":""})}},t.prototype.getRawValue=function(e,r){return Qa(this.getData(r),e)},t.prototype.formatTooltip=function(e,r,i){},t}();function qm(t){var e,r;return rt(t)?t.type&&(r=t):e=t,{text:e,frag:r}}function hs(t){return new hD(t)}var hD=function(){function t(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return t.prototype.perform=function(e){var r=this._upstream,i=e&&e.skip;if(this._dirty&&r){var n=this.context;n.data=n.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var a;this._plan&&!i&&(a=this._plan(this.context));var o=f(this._modBy),s=this._modDataCount||0,l=f(e&&e.modBy),u=e&&e.modDataCount||0;(o!==l||s!==u)&&(a="reset");function f(_){return!(_>=1)&&(_=1),_}var h;(this._dirty||a==="reset")&&(this._dirty=!1,h=this._doReset(i)),this._modBy=l,this._modDataCount=u;var v=e&&e.step;if(r?this._dueEnd=r._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var c=this._dueIndex,d=Math.min(v!=null?this._dueIndex+v:1/0,this._dueEnd);if(!i&&(h||c1&&i>0?s:o}};return a;function o(){return e=t?null:ln?-this._resultLT:0},t}(),vD=function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(e){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(e){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(e,r){},t.prototype.retrieveValueFromItem=function(e,r){},t.prototype.convertValue=function(e,r){return fu(e,r)},t}();function dD(t,e){var r=new vD,i=t.data,n=r.sourceFormat=t.sourceFormat,a=t.startIndex,o="";t.seriesLayoutBy!==Jr&&Xe(o);var s=[],l={},u=t.dimensionsDefine;if(u)C(u,function(p,g){var m=p.name,_={index:g,name:m,displayName:p.displayName};if(s.push(_),m!=null){var y="";gt(l,m)&&Xe(y),l[m]=_}});else for(var f=0;f65535?SD:wD}function ca(){return[1/0,-1/0]}function bD(t){var e=t.constructor;return e===Array?t.slice():new e(t)}function jm(t,e,r,i,n){var a=LT[r||"float"];if(n){var o=t[e],s=o&&o.length;if(s!==i){for(var l=new a(i),u=0;ug[1]&&(g[1]=p)}return this._rawCount=this._count=l,{start:s,end:l}},t.prototype._initDataFromProvider=function(e,r,i){for(var n=this._provider,a=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=tt(o,function(_){return _.property}),f=0;fm[1]&&(m[1]=g)}}!n.persistent&&n.clean&&n.clean(),this._rawCount=this._count=r,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(e,r){if(!(r>=0&&r=0&&r=this._rawCount||e<0)return-1;if(!this._indices)return e;var r=this._indices,i=r[e];if(i!=null&&ie)a=o-1;else return o}return-1},t.prototype.indicesOfNearest=function(e,r,i){var n=this._chunks,a=n[e],o=[];if(!a)return o;i==null&&(i=1/0);for(var s=1/0,l=-1,u=0,f=0,h=this.count();f=0&&l<0)&&(s=d,l=c,u=0),c===l&&(o[u++]=f))}return o.length=u,o},t.prototype.getIndices=function(){var e,r=this._indices;if(r){var i=r.constructor,n=this._count;if(i===Array){e=new i(n);for(var a=0;a=h&&_<=v||isNaN(_))&&(l[u++]=p),p++}d=!0}else if(a===2){for(var g=c[n[0]],y=c[n[1]],x=e[n[1]][0],S=e[n[1]][1],m=0;m=h&&_<=v||isNaN(_))&&(T>=x&&T<=S||isNaN(T))&&(l[u++]=p),p++}d=!0}}if(!d)if(a===1)for(var m=0;m=h&&_<=v||isNaN(_))&&(l[u++]=w)}else for(var m=0;me[M][1])&&(b=!1)}b&&(l[u++]=r.getRawIndex(m))}return um[1]&&(m[1]=g)}}}},t.prototype.lttbDownSample=function(e,r){var i=this.clone([e],!0),n=i._chunks,a=n[e],o=this.count(),s=0,l=Math.floor(1/r),u=this.getRawIndex(0),f,h,v,c=new(bo(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));c[s++]=u;for(var d=1;df&&(f=h,v=x)}E>0&&Ef-d&&(l=f-d,s.length=l);for(var p=0;ph[1]&&(h[1]=m),v[c++]=_}return a._count=c,a._indices=v,a._updateGetRawIdx(),a},t.prototype.each=function(e,r){if(this._count)for(var i=e.length,n=this._chunks,a=0,o=this.count();al&&(l=h)}return o=[s,l],this._extent[e]=o,o},t.prototype.getRawDataItem=function(e){var r=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(r);for(var i=[],n=this._chunks,a=0;a=0?this._indices[e]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function e(r,i,n,a){return fu(r[a],this._dimensions[a])}qh={arrayRows:e,objectRows:function(r,i,n,a){return fu(r[i],this._dimensions[a])},keyedColumns:e,original:function(r,i,n,a){var o=r&&(r.value==null?r:r.value);return fu(o instanceof Array?o[a]:o,this._dimensions[a])},typedArray:function(r,i,n,a){return r[a]}}}(),t}(),RT=function(){function t(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(e,r){this._sourceList=e,this._upstreamSignList=r,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var e=this._sourceHost,r=this._getUpstreamSourceManagers(),i=!!r.length,n,a;if(xl(e)){var o=e,s=void 0,l=void 0,u=void 0;if(i){var f=r[0];f.prepareSource(),u=f.getSource(),s=u.data,l=u.sourceFormat,a=[f._getVersionSign()]}else s=o.get("data",!0),l=Ke(s)?Xi:wr,a=[];var h=this._getSourceMetaRawOption()||{},v=u&&u.metaRawOption||{},c=ft(h.seriesLayoutBy,v.seriesLayoutBy)||null,d=ft(h.sourceHeader,v.sourceHeader),p=ft(h.dimensions,v.dimensions),g=c!==v.seriesLayoutBy||!!d!=!!v.sourceHeader||p;n=g?[Fv(s,{seriesLayoutBy:c,sourceHeader:d,dimensions:p},l)]:[]}else{var m=e;if(i){var _=this._applyTransform(r);n=_.sourceList,a=_.upstreamSignList}else{var y=m.get("source",!0);n=[Fv(y,this._getSourceMetaRawOption(),null)],a=[]}}this._setLocalSource(n,a)},t.prototype._applyTransform=function(e){var r=this._sourceHost,i=r.get("transform",!0),n=r.get("fromTransformResult",!0);if(n!=null){var a="";e.length!==1&&Jm(a)}var o,s=[],l=[];return C(e,function(u){u.prepareSource();var f=u.getSource(n||0),h="";n!=null&&!f&&Jm(h),s.push(f),l.push(u._getVersionSign())}),i?o=xD(i,s,{datasetIndex:r.componentIndex}):n!=null&&(o=[iD(s[0])]),{sourceList:o,upstreamSignList:l}},t.prototype._isDirty=function(){if(this._dirty)return!0;for(var e=this._getUpstreamSourceManagers(),r=0;r1||r>0&&!t.noHeader;return C(t.blocks,function(n){var a=OT(n);a>=e&&(e=a+ +(i&&(!a||zv(n)&&!n.noHeader)))}),e}return 0}function MD(t,e,r,i){var n=e.noHeader,a=DD(OT(e)),o=[],s=e.blocks||[];xr(!s||j(s)),s=s||[];var l=t.orderMode;if(e.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(gt(u,l)){var f=new cD(u[l],null);s.sort(function(d,p){return f.evaluate(d.sortParam,p.sortParam)})}else l==="seriesDesc"&&s.reverse()}C(s,function(d,p){var g=e.valueFormatter,m=NT(d)(g?Y(Y({},t),{valueFormatter:g}):t,d,p>0?a.html:0,i);m!=null&&o.push(m)});var h=t.renderMode==="richText"?o.join(a.richText):Uv(o.join(""),n?r:a.html);if(n)return h;var v=Bv(e.header,"ordinal",t.useUTC),c=IT(i,t.renderMode).nameStyle;return t.renderMode==="richText"?BT(t,v,c)+a.richText+h:Uv('
'+_e(v)+"
"+h,r)}function CD(t,e,r,i){var n=t.renderMode,a=e.noName,o=e.noValue,s=!e.markerType,l=e.name,u=t.useUTC,f=e.valueFormatter||t.valueFormatter||function(x){return x=j(x)?x:[x],tt(x,function(S,T){return Bv(S,j(c)?c[T]:c,u)})};if(!(a&&o)){var h=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",n),v=a?"":Bv(l,"ordinal",u),c=e.valueType,d=o?[]:f(e.value,e.dataIndex),p=!s||!a,g=!s&&a,m=IT(i,n),_=m.nameStyle,y=m.valueStyle;return n==="richText"?(s?"":h)+(a?"":BT(t,v,_))+(o?"":PD(t,d,p,g,y)):Uv((s?"":h)+(a?"":LD(v,!s,_))+(o?"":RD(d,p,g,y)),r)}}function t0(t,e,r,i,n,a){if(t){var o=NT(t),s={useUTC:n,renderMode:r,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter};return o(s,t,0,a)}}function DD(t){return{html:AD[t],richText:ED[t]}}function Uv(t,e){var r='
',i="margin: "+e+"px 0 0";return'
'+t+r+"
"}function LD(t,e,r){var i=e?"margin-left:2px":"";return''+_e(t)+""}function RD(t,e,r,i){var n=r?"10px":"20px",a=e?"float:right;margin-left:"+n:"";return t=j(t)?t:[t],''+tt(t,function(o){return _e(o)}).join("  ")+""}function BT(t,e,r){return t.markupStyleCreator.wrapRichTextStyle(e,r)}function PD(t,e,r,i,n){var a=[n],o=i?10:20;return r&&a.push({padding:[0,0,0,o],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(j(e)?e.join(" "):e,a)}function ID(t,e){var r=t.getData().getItemVisual(e,"style"),i=r[t.visualDrawType];return $n(i)}function FT(t,e){var r=t.get("padding");return r??(e==="richText"?[8,10]:10)}var $h=function(){function t(){this.richTextStyles={},this._nextStyleNameId=sx()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(e,r,i){var n=i==="richText"?this._generateStyleName():null,a=lT({color:r,type:e,renderMode:i,markerId:n});return Q(a)?a:(this.richTextStyles[n]=a.style,a.content)},t.prototype.wrapRichTextStyle=function(e,r){var i={};j(r)?C(r,function(a){return Y(i,a)}):Y(i,r);var n=this._generateStyleName();return this.richTextStyles[n]=i,"{"+n+"|"+e+"}"},t}();function ND(t){var e=t.series,r=t.dataIndex,i=t.multipleSeries,n=e.getData(),a=n.mapDimensionsAll("defaultedTooltip"),o=a.length,s=e.getRawValue(r),l=j(s),u=ID(e,r),f,h,v,c;if(o>1||l&&!o){var d=OD(s,e,r,a,u);f=d.inlineValues,h=d.inlineValueTypes,v=d.blocks,c=d.inlineValues[0]}else if(o){var p=n.getDimensionInfo(a[0]);c=f=Qa(n,r,a[0]),h=p.type}else c=f=l?s[0]:s;var g=Hd(e),m=g&&e.name||"",_=n.getName(r),y=i?m:_;return Ms("section",{header:m,noHeader:i||!g,sortParam:c,blocks:[Ms("nameValue",{markerType:"item",markerColor:u,name:y,noName:!jr(y),value:f,valueType:h,dataIndex:r})].concat(v||[])})}function OD(t,e,r,i,n){var a=e.getData(),o=Qn(t,function(h,v,c){var d=a.getDimensionInfo(c);return h=h||d&&d.tooltip!==!1&&d.displayName!=null},!1),s=[],l=[],u=[];i.length?C(i,function(h){f(Qa(a,r,h),h)}):C(t,f);function f(h,v){var c=a.getDimensionInfo(v);!c||c.otherDims.tooltip===!1||(o?u.push(Ms("nameValue",{markerType:"subItem",markerColor:n,name:c.displayName,value:h,valueType:c.type})):(s.push(h),l.push(c.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var Mi=Yt();function Tl(t,e){return t.getName(e)||t.getId(e)}var BD="__universalTransitionEnabled",yi=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._selectedDataIndicesMap={},r}return e.prototype.init=function(r,i,n){this.seriesIndex=this.componentIndex,this.dataTask=hs({count:kD,reset:zD}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,n);var a=Mi(this).sourceManager=new RT(this);a.prepareSource();var o=this.getInitialData(r,n);r0(o,this),this.dataTask.context.data=o,Mi(this).dataBeforeProcessed=o,e0(this),this._initSelectedMapFromData(o)},e.prototype.mergeDefaultAndTheme=function(r,i){var n=As(this),a=n?Zs(r):{},o=this.subType;Rt.hasClass(o)&&(o+="Series"),dt(r,i.getTheme().get(this.subType)),dt(r,this.getDefaultOption()),zg(r,"label",["show"]),this.fillDataTextStyle(r.data),n&&Kn(r,a,n)},e.prototype.mergeOption=function(r,i){r=dt(this.option,r,!0),this.fillDataTextStyle(r.data);var n=As(this);n&&Kn(this.option,r,n);var a=Mi(this).sourceManager;a.dirty(),a.prepareSource();var o=this.getInitialData(r,i);r0(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,Mi(this).dataBeforeProcessed=o,e0(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(r){if(r&&!Ke(r))for(var i=["show"],n=0;nthis.getShallow("animationThreshold")&&(i=!1),!!i},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(r,i,n){var a=this.ecModel,o=dp.prototype.getColorFromPalette.call(this,r,i,n);return o||(o=a.getColorFromPalette(r,i,n)),o},e.prototype.coordDimToDataDim=function(r){return this.getRawData().mapDimensionsAll(r)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(r,i){this._innerSelect(this.getData(i),r)},e.prototype.unselect=function(r,i){var n=this.option.selectedMap;if(n){var a=this.option.selectedMode,o=this.getData(i);if(a==="series"||n==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s=0&&n.push(o)}return n},e.prototype.isSelected=function(r,i){var n=this.option.selectedMap;if(!n)return!1;var a=this.getData(i);return(n==="all"||n[Tl(a,r)])&&!a.getItemModel(r).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[BD])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},e.prototype._innerSelect=function(r,i){var n,a,o=this.option,s=o.selectedMode,l=i.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){rt(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,f=0;f0&&this._innerSelect(r,i)}},e.registerClass=function(r){return Rt.registerClass(r)},e.protoInitialize=function(){var r=e.prototype;r.type="series.__base__",r.seriesIndex=0,r.ignoreStyleOnData=!1,r.hasSymbolVisual=!1,r.defaultSymbol="circle",r.visualStyleAccessPath="itemStyle",r.visualDrawType="fill"}(),e}(Rt);kr(yi,fD);kr(yi,dp);px(yi,Rt);function e0(t){var e=t.name;Hd(t)||(t.name=FD(t)||e)}function FD(t){var e=t.getRawData(),r=e.mapDimensionsAll("seriesName"),i=[];return C(r,function(n){var a=e.getDimensionInfo(n);a.displayName&&i.push(a.displayName)}),i.join(" ")}function kD(t){return t.model.getRawData().count()}function zD(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),UD}function UD(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function r0(t,e){C(ob(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),function(r){t.wrapMethod(r,le(HD,e))})}function HD(t,e){var r=Hv(t);return r&&r.setOutputEnd((e||this).count()),e}function Hv(t){var e=(t.ecModel||{}).scheduler,r=e&&e.getPipeline(t.uid);if(r){var i=r.currentTask;if(i){var n=i.agentStubMap;n&&(i=n.get(t.uid))}return i}}var ze=function(){function t(){this.group=new ee,this.uid=Lf("viewComponent")}return t.prototype.init=function(e,r){},t.prototype.render=function(e,r,i,n){},t.prototype.dispose=function(e,r){},t.prototype.updateView=function(e,r,i,n){},t.prototype.updateLayout=function(e,r,i,n){},t.prototype.updateVisual=function(e,r,i,n){},t.prototype.toggleBlurSeries=function(e,r,i){},t.prototype.eachRendered=function(e){var r=this.group;r&&r.traverse(e)},t}();Gd(ze);_f(ze);function kT(){var t=Yt();return function(e){var r=t(e),i=e.pipelineContext,n=!!r.large,a=!!r.progressiveRender,o=r.large=!!(i&&i.large),s=r.progressiveRender=!!(i&&i.progressiveRender);return(n!==o||a!==s)&&"reset"}}var zT=Yt(),VD=kT(),Nr=function(){function t(){this.group=new ee,this.uid=Lf("viewChart"),this.renderTask=hs({plan:GD,reset:WD}),this.renderTask.context={view:this}}return t.prototype.init=function(e,r){},t.prototype.render=function(e,r,i,n){},t.prototype.highlight=function(e,r,i,n){var a=e.getData(n&&n.dataType);a&&n0(a,n,"emphasis")},t.prototype.downplay=function(e,r,i,n){var a=e.getData(n&&n.dataType);a&&n0(a,n,"normal")},t.prototype.remove=function(e,r){this.group.removeAll()},t.prototype.dispose=function(e,r){},t.prototype.updateView=function(e,r,i,n){this.render(e,r,i,n)},t.prototype.updateLayout=function(e,r,i,n){this.render(e,r,i,n)},t.prototype.updateVisual=function(e,r,i,n){this.render(e,r,i,n)},t.prototype.eachRendered=function(e){ap(this.group,e)},t.markUpdateMethod=function(e,r){zT(e).updateMethod=r},t.protoInitialize=function(){var e=t.prototype;e.type="chart"}(),t}();function i0(t,e,r){t&&Rv(t)&&(e==="emphasis"?Pu:Iu)(t,r)}function n0(t,e,r){var i=qn(t,e),n=e&&e.highlightKey!=null?uM(e.highlightKey):null;i!=null?C(ue(i),function(a){i0(t.getItemGraphicEl(a),r,n)}):t.eachItemGraphicEl(function(a){i0(a,r,n)})}Gd(Nr);_f(Nr);function GD(t){return VD(t.model)}function WD(t){var e=t.model,r=t.ecModel,i=t.api,n=t.payload,a=e.pipelineContext.progressiveRender,o=t.view,s=n&&zT(n).updateMethod,l=a?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](e,r,i,n),XD[l]}var XD={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},Hu="\0__throttleOriginMethod",a0="\0__throttleRate",o0="\0__throttleType";function yp(t,e,r){var i,n=0,a=0,o=null,s,l,u,f;e=e||0;function h(){a=new Date().getTime(),o=null,t.apply(l,u||[])}var v=function(){for(var c=[],d=0;d=0?h():o=setTimeout(h,-s),n=i};return v.clear=function(){o&&(clearTimeout(o),o=null)},v.debounceNextCall=function(c){f=c},v}function zf(t,e,r,i){var n=t[e];if(n){var a=n[Hu]||n,o=n[o0],s=n[a0];if(s!==r||o!==i){if(r==null||!i)return t[e]=a;n=t[e]=yp(a,r,i==="debounce"),n[Hu]=a,n[o0]=i,n[a0]=r}return n}}function Vu(t,e){var r=t[e];r&&r[Hu]&&(r.clear&&r.clear(),t[e]=r[Hu])}var s0=Yt(),l0={itemStyle:Ts($x,!0),lineStyle:Ts(qx,!0)},YD={lineStyle:"stroke",itemStyle:"fill"};function UT(t,e){var r=t.visualStyleMapper||l0[e];return r||(console.warn("Unknown style type '"+e+"'."),l0.itemStyle)}function HT(t,e){var r=t.visualDrawType||YD[e];return r||(console.warn("Unknown style type '"+e+"'."),"fill")}var ZD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var r=t.getData(),i=t.visualStyleAccessPath||"itemStyle",n=t.getModel(i),a=UT(t,i),o=a(n),s=n.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=HT(t,i),u=o[l],f=ct(u)?u:null,h=o.fill==="auto"||o.stroke==="auto";if(!o[l]||f||h){var v=t.getColorFromPalette(t.name,null,e.getSeriesCount());o[l]||(o[l]=v,r.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||ct(o.fill)?v:o.fill,o.stroke=o.stroke==="auto"||ct(o.stroke)?v:o.stroke}if(r.setVisual("style",o),r.setVisual("drawType",l),!e.isSeriesFiltered(t)&&f)return r.setVisual("colorFromPalette",!1),{dataEach:function(c,d){var p=t.getDataParams(d),g=Y({},o);g[l]=f(p),c.setItemVisual(d,"style",g)}}}},Ao=new Zt,qD={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!(t.ignoreStyleOnData||e.isSeriesFiltered(t))){var r=t.getData(),i=t.visualStyleAccessPath||"itemStyle",n=UT(t,i),a=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[i]){Ao.option=l[i];var u=n(Ao),f=o.ensureUniqueItemVisual(s,"style");Y(f,u),Ao.option.decal&&(o.setItemVisual(s,"decal",Ao.option.decal),Ao.option.decal.dirty=!0),a in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},$D={performRawSeries:!0,overallReset:function(t){var e=ht();t.eachSeries(function(r){var i=r.getColorBy();if(!r.isColorBySeries()){var n=r.type+"-"+i,a=e.get(n);a||(a={},e.set(n,a)),s0(r).scope=a}}),t.eachSeries(function(r){if(!(r.isColorBySeries()||t.isSeriesFiltered(r))){var i=r.getRawData(),n={},a=r.getData(),o=s0(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=HT(r,s);a.each(function(u){var f=a.getRawIndex(u);n[f]=u}),i.each(function(u){var f=n[u],h=a.getItemVisual(f,"colorFromPalette");if(h){var v=a.ensureUniqueItemVisual(f,"style"),c=i.getName(u)||u+"",d=i.count();v[l]=r.getColorFromPalette(c,o,d)}})}})}},Sl=Math.PI;function KD(t,e){e=e||{},Et(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var r=new ee,i=new Kt({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});r.add(i);var n=new Xt({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new Kt({style:{fill:"none"},textContent:n,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});r.add(a);var o;return e.showSpinner&&(o=new Ef({shape:{startAngle:-Sl/2,endAngle:-Sl/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:Sl*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:Sl*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=n.getBoundingRect().width,l=e.showSpinner?e.spinnerRadius:0,u=(t.getWidth()-l*2-(e.showSpinner&&s?10:0)-s)/2-(e.showSpinner&&s?0:5+s/2)+(e.showSpinner?0:s/2)+(s?0:l),f=t.getHeight()/2;e.showSpinner&&o.setShape({cx:u,cy:f}),a.setShape({x:u-l,y:f-l,width:l*2,height:l*2}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},r.resize(),r}var VT=function(){function t(e,r,i,n){this._stageTaskMap=ht(),this.ecInstance=e,this.api=r,i=this._dataProcessorHandlers=i.slice(),n=this._visualHandlers=n.slice(),this._allHandlers=i.concat(n)}return t.prototype.restoreData=function(e,r){e.restoreData(r),this._stageTaskMap.each(function(i){var n=i.overallTask;n&&n.dirty()})},t.prototype.getPerformArgs=function(e,r){if(e.__pipeline){var i=this._pipelineMap.get(e.__pipeline.id),n=i.context,a=!r&&i.progressiveEnabled&&(!n||n.progressiveRender)&&e.__idxInPipeline>i.blockIndex,o=a?i.step:null,s=n&&n.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},t.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},t.prototype.updateStreamModes=function(e,r){var i=this._pipelineMap.get(e.uid),n=e.getData(),a=n.count(),o=i.progressiveEnabled&&r.incrementalPrepareRender&&a>=i.threshold,s=e.get("large")&&a>=e.get("largeThreshold"),l=e.get("progressiveChunkMode")==="mod"?a:null;e.pipelineContext=i.context={progressiveRender:o,modDataCount:l,large:s}},t.prototype.restorePipelines=function(e){var r=this,i=r._pipelineMap=ht();e.eachSeries(function(n){var a=n.getProgressive(),o=n.uid;i.set(o,{id:o,head:null,tail:null,threshold:n.getProgressiveThreshold(),progressiveEnabled:a&&!(n.preventIncremental&&n.preventIncremental()),blockIndex:-1,step:Math.round(a||700),count:0}),r._pipe(n,n.dataTask)})},t.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,r=this.api.getModel(),i=this.api;C(this._allHandlers,function(n){var a=e.get(n.uid)||e.set(n.uid,{}),o="";xr(!(n.reset&&n.overallReset),o),n.reset&&this._createSeriesStageTask(n,a,r,i),n.overallReset&&this._createOverallStageTask(n,a,r,i)},this)},t.prototype.prepareView=function(e,r,i,n){var a=e.renderTask,o=a.context;o.model=r,o.ecModel=i,o.api=n,a.__block=!e.incrementalPrepareRender,this._pipe(r,a)},t.prototype.performDataProcessorTasks=function(e,r){this._performStageTasks(this._dataProcessorHandlers,e,r,{block:!0})},t.prototype.performVisualTasks=function(e,r,i){this._performStageTasks(this._visualHandlers,e,r,i)},t.prototype._performStageTasks=function(e,r,i,n){n=n||{};var a=!1,o=this;C(e,function(l,u){if(!(n.visualType&&n.visualType!==l.visualType)){var f=o._stageTaskMap.get(l.uid),h=f.seriesTaskMap,v=f.overallTask;if(v){var c,d=v.agentStubMap;d.each(function(g){s(n,g)&&(g.dirty(),c=!0)}),c&&v.dirty(),o.updatePayload(v,i);var p=o.getPerformArgs(v,n.block);d.each(function(g){g.perform(p)}),v.perform(p)&&(a=!0)}else h&&h.each(function(g,m){s(n,g)&&g.dirty();var _=o.getPerformArgs(g,n.block);_.skip=!l.performRawSeries&&r.isSeriesFiltered(g.context.model),o.updatePayload(g,i),g.perform(_)&&(a=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=a||this.unfinished},t.prototype.performSeriesTasks=function(e){var r;e.eachSeries(function(i){r=i.dataTask.perform()||r}),this.unfinished=r||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each(function(e){var r=e.tail;do{if(r.__block){e.blockIndex=r.__idxInPipeline;break}r=r.getUpstream()}while(r)})},t.prototype.updatePayload=function(e,r){r!=="remain"&&(e.context.payload=r)},t.prototype._createSeriesStageTask=function(e,r,i,n){var a=this,o=r.seriesTaskMap,s=r.seriesTaskMap=ht(),l=e.seriesType,u=e.getTargetSeries;e.createOnAllSeries?i.eachRawSeries(f):l?i.eachRawSeriesByType(l,f):u&&u(i,n).each(f);function f(h){var v=h.uid,c=s.set(v,o&&o.get(v)||hs({plan:eL,reset:rL,count:nL}));c.context={model:h,ecModel:i,api:n,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:a},a._pipe(h,c)}},t.prototype._createOverallStageTask=function(e,r,i,n){var a=this,o=r.overallTask=r.overallTask||hs({reset:jD});o.context={ecModel:i,api:n,overallReset:e.overallReset,scheduler:a};var s=o.agentStubMap,l=o.agentStubMap=ht(),u=e.seriesType,f=e.getTargetSeries,h=!0,v=!1,c="";xr(!e.createOnAllSeries,c),u?i.eachRawSeriesByType(u,d):f?f(i,n).each(d):(h=!1,C(i.getSeries(),d));function d(p){var g=p.uid,m=l.set(g,s&&s.get(g)||(v=!0,hs({reset:QD,onDirty:tL})));m.context={model:p,overallProgress:h},m.agent=o,m.__block=h,a._pipe(p,m)}v&&o.dirty()},t.prototype._pipe=function(e,r){var i=e.uid,n=this._pipelineMap.get(i);!n.head&&(n.head=r),n.tail&&n.tail.pipe(r),n.tail=r,r.__idxInPipeline=n.count++,r.__pipeline=n},t.wrapStageHandler=function(e,r){return ct(e)&&(e={overallReset:e,seriesType:aL(e)}),e.uid=Lf("stageHandler"),r&&(e.visualType=r),e},t}();function jD(t){t.overallReset(t.ecModel,t.api,t.payload)}function QD(t){return t.overallProgress&&JD}function JD(){this.agent.dirty(),this.getDownstream().dirty()}function tL(){this.agent&&this.agent.dirty()}function eL(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function rL(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=ue(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?tt(e,function(r,i){return GT(i)}):iL}var iL=GT(0);function GT(t){return function(e,r){var i=r.data,n=r.resetDefines[t];if(n&&n.dataEach)for(var a=e.start;a0&&c===u.length-v.length){var d=u.slice(0,c);d!=="data"&&(r.mainType=d,r[v.toLowerCase()]=l,f=!0)}}s.hasOwnProperty(u)&&(i[u]=l,f=!0),f||(n[u]=l)})}return{cptQuery:r,dataQuery:i,otherQuery:n}},t.prototype.filter=function(e,r){var i=this.eventInfo;if(!i)return!0;var n=i.targetEl,a=i.packedEvent,o=i.model,s=i.view;if(!o||!s)return!0;var l=r.cptQuery,u=r.dataQuery;return f(l,o,"mainType")&&f(l,o,"subType")&&f(l,o,"index","componentIndex")&&f(l,o,"name")&&f(l,o,"id")&&f(u,a,"name")&&f(u,a,"dataIndex")&&f(u,a,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(e,r.otherQuery,n,a));function f(h,v,c,d){return h[c]==null||v[d||c]===h[c]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),Vv=["symbol","symbolSize","symbolRotate","symbolOffset"],c0=Vv.concat(["symbolKeepAspect"]),lL={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var r=t.getData();if(t.legendIcon&&r.setVisual("legendIcon",t.legendIcon),!t.hasSymbolVisual)return;for(var i={},n={},a=!1,o=0;o=0&&Fn(l)?l:.5;var u=t.createRadialGradient(o,s,0,o,s,l);return u}function Gv(t,e,r){for(var i=e.type==="radial"?AL(t,e,r):bL(t,e,r),n=e.colorStops,a=0;a0)?null:t==="dashed"?[4*e,2*e]:t==="dotted"?[e]:$t(t)?[t]:j(t)?t:null}function xp(t){var e=t.style,r=e.lineDash&&e.lineWidth>0&&ML(e.lineDash,e.lineWidth),i=e.lineDashOffset;if(r){var n=e.strokeNoScale&&t.getLineScale?t.getLineScale():1;n&&n!==1&&(r=tt(r,function(a){return a/n}),i/=n)}return[r,i]}var CL=new _i(!0);function Xu(t){var e=t.stroke;return!(e==null||e==="none"||!(t.lineWidth>0))}function v0(t){return typeof t=="string"&&t!=="none"}function Yu(t){var e=t.fill;return e!=null&&e!=="none"}function d0(t,e){if(e.fillOpacity!=null&&e.fillOpacity!==1){var r=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=r}else t.fill()}function p0(t,e){if(e.strokeOpacity!=null&&e.strokeOpacity!==1){var r=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=r}else t.stroke()}function Wv(t,e,r){var i=Wd(e.image,e.__image,r);if(yf(i)){var n=t.createPattern(i,e.repeat||"repeat");if(typeof DOMMatrix=="function"&&n&&n.setTransform){var a=new DOMMatrix;a.translateSelf(e.x||0,e.y||0),a.rotateSelf(0,0,(e.rotation||0)*tu),a.scaleSelf(e.scaleX||1,e.scaleY||1),n.setTransform(a)}return n}}function DL(t,e,r,i){var n,a=Xu(r),o=Yu(r),s=r.strokePercent,l=s<1,u=!e.path;(!e.silent||l)&&u&&e.createPathProxy();var f=e.path||CL,h=e.__dirty;if(!i){var v=r.fill,c=r.stroke,d=o&&!!v.colorStops,p=a&&!!c.colorStops,g=o&&!!v.image,m=a&&!!c.image,_=void 0,y=void 0,x=void 0,S=void 0,T=void 0;(d||p)&&(T=e.getBoundingRect()),d&&(_=h?Gv(t,v,T):e.__canvasFillGradient,e.__canvasFillGradient=_),p&&(y=h?Gv(t,c,T):e.__canvasStrokeGradient,e.__canvasStrokeGradient=y),g&&(x=h||!e.__canvasFillPattern?Wv(t,v,e):e.__canvasFillPattern,e.__canvasFillPattern=x),m&&(S=h||!e.__canvasStrokePattern?Wv(t,c,e):e.__canvasStrokePattern,e.__canvasStrokePattern=x),d?t.fillStyle=_:g&&(x?t.fillStyle=x:o=!1),p?t.strokeStyle=y:m&&(S?t.strokeStyle=S:a=!1)}var w=e.getGlobalScale();f.setScale(w[0],w[1],e.segmentIgnoreThreshold);var b,A;t.setLineDash&&r.lineDash&&(n=xp(e),b=n[0],A=n[1]);var M=!0;(u||h&Ca)&&(f.setDPR(t.dpr),l?f.setContext(null):(f.setContext(t),M=!1),f.reset(),e.buildPath(f,e.shape,i),f.toStatic(),e.pathUpdated()),M&&f.rebuildPath(t,l?s:1),b&&(t.setLineDash(b),t.lineDashOffset=A),i||(r.strokeFirst?(a&&p0(t,r),o&&d0(t,r)):(o&&d0(t,r),a&&p0(t,r))),b&&t.setLineDash([])}function LL(t,e,r){var i=e.__image=Wd(r.image,e.__image,e,e.onload);if(!(!i||!yf(i))){var n=r.x||0,a=r.y||0,o=e.getWidth(),s=e.getHeight(),l=i.width/i.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=i.width,s=i.height),r.sWidth&&r.sHeight){var u=r.sx||0,f=r.sy||0;t.drawImage(i,u,f,r.sWidth,r.sHeight,n,a,o,s)}else if(r.sx&&r.sy){var u=r.sx,f=r.sy,h=o-u,v=s-f;t.drawImage(i,u,f,h,v,n,a,o,s)}else t.drawImage(i,n,a,o,s)}}function RL(t,e,r){var i,n=r.text;if(n!=null&&(n+=""),n){t.font=r.font||Zi,t.textAlign=r.textAlign,t.textBaseline=r.textBaseline;var a=void 0,o=void 0;t.setLineDash&&r.lineDash&&(i=xp(e),a=i[0],o=i[1]),a&&(t.setLineDash(a),t.lineDashOffset=o),r.strokeFirst?(Xu(r)&&t.strokeText(n,r.x,r.y),Yu(r)&&t.fillText(n,r.x,r.y)):(Yu(r)&&t.fillText(n,r.x,r.y),Xu(r)&&t.strokeText(n,r.x,r.y)),a&&t.setLineDash([])}}var g0=["shadowBlur","shadowOffsetX","shadowOffsetY"],m0=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function KT(t,e,r,i,n){var a=!1;if(!i&&(r=r||{},e===r))return!1;if(i||e.opacity!==r.opacity){Ye(t,n),a=!0;var o=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(o)?Gn.opacity:o}(i||e.blend!==r.blend)&&(a||(Ye(t,n),a=!0),t.globalCompositeOperation=e.blend||Gn.blend);for(var s=0;s0&&r.unfinished);r.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(r,i,n){if(!this[be]){if(this._disposed){this.id;return}var a,o,s;if(rt(i)&&(n=i.lazyUpdate,a=i.silent,o=i.replaceMerge,s=i.transition,i=i.notMerge),this[be]=!0,!this._model||i){var l=new GC(this._api),u=this._theme,f=this._model=new pp;f.scheduler=this._scheduler,f.ssr=this._ssr,f.init(null,null,null,u,this._locale,l)}this._model.setOption(r,{replaceMerge:o},Zv);var h={seriesTransition:s,optionChanged:!0};if(n)this[We]={silent:a,updateParams:h},this[be]=!1,this.getZr().wakeUp();else{try{da(this),Ci.update.call(this,null,h)}catch(v){throw this[We]=null,this[be]=!1,v}this._ssr||this._zr.flush(),this[We]=null,this[be]=!1,Eo.call(this,a),Mo.call(this,a)}}},e.prototype.setTheme=function(){},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||vt.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(r){return this.renderToCanvas(r)},e.prototype.renderToCanvas=function(r){r=r||{};var i=this._zr.painter;return i.getRenderedCanvas({backgroundColor:r.backgroundColor||this._model.get("backgroundColor"),pixelRatio:r.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(r){r=r||{};var i=this._zr.painter;return i.renderToString({useViewBox:r.useViewBox})},e.prototype.getSvgDataURL=function(){if(vt.svgSupported){var r=this._zr,i=r.storage.getDisplayList();return C(i,function(n){n.stopAnimation(null,!0)}),r.painter.toDataURL()}},e.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var i=r.excludeComponents,n=this._model,a=[],o=this;C(i,function(l){n.eachComponent({mainType:l},function(u){var f=o._componentsMap[u.__viewId];f.group.ignore||(a.push(f),f.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(r).toDataURL("image/"+(r&&r.type||"png"));return C(a,function(l){l.group.ignore=!1}),s},e.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var i=r.type==="svg",n=this.group,a=Math.min,o=Math.max,s=1/0;if(P0[n]){var l=s,u=s,f=-s,h=-s,v=[],c=r&&r.pixelRatio||this.getDevicePixelRatio();C(vs,function(y,x){if(y.group===n){var S=i?y.getZr().painter.getSvgDom().innerHTML:y.renderToCanvas(ut(r)),T=y.getDom().getBoundingClientRect();l=a(T.left,l),u=a(T.top,u),f=o(T.right,f),h=o(T.bottom,h),v.push({dom:S,left:T.left,top:T.top})}}),l*=c,u*=c,f*=c,h*=c;var d=f-l,p=h-u,g=oo.createCanvas(),m=wv(g,{renderer:i?"svg":"canvas"});if(m.resize({width:d,height:p}),i){var _="";return C(v,function(y){var x=y.left-l,S=y.top-u;_+=''+y.dom+""}),m.painter.getSvgRoot().innerHTML=_,r.connectedBackgroundColor&&m.painter.setBackgroundColor(r.connectedBackgroundColor),m.refreshImmediately(),m.painter.toDataURL()}else return r.connectedBackgroundColor&&m.add(new Kt({shape:{x:0,y:0,width:d,height:p},style:{fill:r.connectedBackgroundColor}})),C(v,function(y){var x=new ir({style:{x:y.left*c-l,y:y.top*c-u,image:y.dom}});m.add(x)}),m.refreshImmediately(),g.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},e.prototype.convertToPixel=function(r,i){return tc(this,"convertToPixel",r,i)},e.prototype.convertFromPixel=function(r,i){return tc(this,"convertFromPixel",r,i)},e.prototype.containPixel=function(r,i){if(this._disposed){this.id;return}var n=this._model,a,o=wh(n,r);return C(o,function(s,l){l.indexOf("Models")>=0&&C(s,function(u){var f=u.coordinateSystem;if(f&&f.containPoint)a=a||!!f.containPoint(i);else if(l==="seriesModels"){var h=this._chartsMap[u.__viewId];h&&h.containPoint&&(a=a||h.containPoint(i,u))}},this)},this),!!a},e.prototype.getVisual=function(r,i){var n=this._model,a=wh(n,r,{defaultMainType:"series"}),o=a.seriesModel,s=o.getData(),l=a.hasOwnProperty("dataIndexInside")?a.dataIndexInside:a.hasOwnProperty("dataIndex")?s.indexOfRawIndex(a.dataIndex):null;return l!=null?ZT(s,l,i):qT(s,i)},e.prototype.getViewOfComponentModel=function(r){return this._componentsMap[r.__viewId]},e.prototype.getViewOfSeriesModel=function(r){return this._chartsMap[r.__viewId]},e.prototype._initEvents=function(){var r=this;C(rR,function(i){var n=function(a){var o=r.getModel(),s=a.target,l,u=i==="globalout";if(u?l={}:s&&Ba(s,function(d){var p=Mt(d);if(p&&p.dataIndex!=null){var g=p.dataModel||o.getSeriesByIndex(p.seriesIndex);return l=g&&g.getDataParams(p.dataIndex,p.dataType,s)||{},!0}else if(p.eventData)return l=Y({},p.eventData),!0},!0),l){var f=l.componentType,h=l.componentIndex;(f==="markLine"||f==="markPoint"||f==="markArea")&&(f="series",h=l.seriesIndex);var v=f&&h!=null&&o.getComponent(f,h),c=v&&r[v.mainType==="series"?"_chartsMap":"_componentsMap"][v.__viewId];l.event=a,l.type=i,r._$eventProcessor.eventInfo={targetEl:s,packedEvent:l,model:v,view:c},r.trigger(i,l)}};n.zrEventfulCallAtLast=!0,r._zr.on(i,n,r)}),C(cs,function(i,n){r._messageCenter.on(n,function(a){this.trigger(n,a)},r)}),C(["selectchanged"],function(i){r._messageCenter.on(i,function(n){this.trigger(i,n)},r)}),hL(this._messageCenter,this,this._api)},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var r=this.getDom();r&&cx(this.getDom(),bp,"");var i=this,n=i._api,a=i._model;C(i._componentsViews,function(o){o.dispose(a,n)}),C(i._chartsViews,function(o){o.dispose(a,n)}),i._zr.dispose(),i._dom=i._model=i._chartsMap=i._componentsMap=i._chartsViews=i._componentsViews=i._scheduler=i._api=i._zr=i._throttledZrFlush=i._theme=i._coordSysMgr=i._messageCenter=null,delete vs[i.id]},e.prototype.resize=function(r){if(!this[be]){if(this._disposed){this.id;return}this._zr.resize(r);var i=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!i){var n=i.resetOption("media"),a=r&&r.silent;this[We]&&(a==null&&(a=this[We].silent),n=!0,this[We]=null),this[be]=!0;try{n&&da(this),Ci.update.call(this,{type:"resize",animation:Y({duration:0},r&&r.animation)})}catch(o){throw this[be]=!1,o}this[be]=!1,Eo.call(this,a),Mo.call(this,a)}}},e.prototype.showLoading=function(r,i){if(this._disposed){this.id;return}if(rt(r)&&(i=r,r=""),r=r||"default",this.hideLoading(),!!qv[r]){var n=qv[r](this._api,i),a=this._zr;this._loadingFX=n,a.add(n)}},e.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},e.prototype.makeActionFromEvent=function(r){var i=Y({},r);return i.type=cs[r.type],i},e.prototype.dispatchAction=function(r,i){if(this._disposed){this.id;return}if(rt(i)||(i={silent:!!i}),!!Zu[r.type]&&this._model){if(this[be]){this._pendingActions.push(r);return}var n=i.silent;rc.call(this,r,n);var a=i.flush;a?this._zr.flush():a!==!1&&vt.browser.weChat&&this._throttledZrFlush(),Eo.call(this,n),Mo.call(this,n)}},e.prototype.updateLabelLayout=function(){Rr.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(r){if(this._disposed){this.id;return}var i=r.seriesIndex,n=this.getModel(),a=n.getSeriesByIndex(i);a.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},e.internalField=function(){da=function(h){var v=h._scheduler;v.restorePipelines(h._model),v.prepareStageTasks(),Jh(h,!0),Jh(h,!1),v.plan()},Jh=function(h,v){for(var c=h._model,d=h._scheduler,p=v?h._componentsViews:h._chartsViews,g=v?h._componentsMap:h._chartsMap,m=h._zr,_=h._api,y=0;yv.get("hoverLayerThreshold")&&!vt.node&&!vt.worker&&v.eachSeries(function(g){if(!g.preventUsingHoverLayer){var m=h._chartsMap[g.__viewId];m.__alive&&m.eachRendered(function(_){_.states.emphasis&&(_.states.emphasis.hoverLayer=!0)})}})}function o(h,v){var c=h.get("blendMode")||null;v.eachRendered(function(d){d.isGroup||(d.style.blend=c)})}function s(h,v){if(!h.preventAutoZ){var c=h.get("z")||0,d=h.get("zlevel")||0;v.eachRendered(function(p){return l(p,c,d,-1/0),!0})}}function l(h,v,c,d){var p=h.getTextContent(),g=h.getTextGuideLine(),m=h.isGroup;if(m)for(var _=h.childrenRef(),y=0;y<_.length;y++)d=Math.max(l(_[y],v,c,d),d);else h.z=v,h.zlevel=c,d=Math.max(h.z2,d);if(p&&(p.z=v,p.zlevel=c,isFinite(d)&&(p.z2=d+2)),g){var x=h.textGuideLineConfig;g.z=v,g.zlevel=c,isFinite(d)&&(g.z2=d+(x&&x.showAbove?1:-1))}return d}function u(h,v){v.eachRendered(function(c){if(!Xa(c)){var d=c.getTextContent(),p=c.getTextGuideLine();c.stateTransition&&(c.stateTransition=null),d&&d.stateTransition&&(d.stateTransition=null),p&&p.stateTransition&&(p.stateTransition=null),c.hasState()?(c.prevStates=c.currentStates,c.clearStates()):c.prevStates&&(c.prevStates=null)}})}function f(h,v){var c=h.getModel("stateAnimation"),d=h.isAnimationEnabled(),p=c.get("duration"),g=p>0?{duration:p,delay:c.get("delay"),easing:c.get("easing")}:null;v.eachRendered(function(m){if(m.states&&m.states.emphasis){if(Xa(m))return;if(m instanceof kt&&fM(m),m.__dirty){var _=m.prevStates;_&&m.useStates(_)}if(d){m.stateTransition=g;var y=m.getTextContent(),x=m.getTextGuideLine();y&&(y.stateTransition=g),x&&(x.stateTransition=g)}m.__dirty&&n(m)}})}L0=function(h){return new(function(v){K(c,v);function c(){return v!==null&&v.apply(this,arguments)||this}return c.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},c.prototype.getComponentByElement=function(d){for(;d;){var p=d.__ecComponentInfo;if(p!=null)return h._model.getComponent(p.mainType,p.index);d=d.parent}},c.prototype.enterEmphasis=function(d,p){Pu(d,p),nr(h)},c.prototype.leaveEmphasis=function(d,p){Iu(d,p),nr(h)},c.prototype.enterBlur=function(d){tM(d),nr(h)},c.prototype.leaveBlur=function(d){Dx(d),nr(h)},c.prototype.enterSelect=function(d){Lx(d),nr(h)},c.prototype.leaveSelect=function(d){Rx(d),nr(h)},c.prototype.getModel=function(){return h.getModel()},c.prototype.getViewOfComponentModel=function(d){return h.getViewOfComponentModel(d)},c.prototype.getViewOfSeriesModel=function(d){return h.getViewOfSeriesModel(d)},c}(_T))(h)},fS=function(h){function v(c,d){for(var p=0;p=0)){I0.push(r);var a=VT.wrapStageHandler(r,n);a.__prio=e,a.__raw=r,t.push(a)}}function mS(t,e){qv[t]=e}function uR(t,e,r){var i=HL("registerMap");i&&i(t,e,r)}var fR=yD;ea(Sp,ZD);ea(Uf,qD);ea(Uf,$D);ea(Sp,lL);ea(Uf,uL);ea(nS,zL);Ap(xT);dS(WL,eD);mS("default",KD);ta({type:Wn,event:Wn,update:Wn},Te);ta({type:ou,event:ou,update:ou},Te);ta({type:os,event:os,update:os},Te);ta({type:su,event:su,update:su},Te);ta({type:ss,event:ss,update:ss},Te);vS("light",oL);vS("dark",YT);function Co(t){return t==null?0:t.length||1}function N0(t){return t}var hR=function(){function t(e,r,i,n,a,o){this._old=e,this._new=r,this._oldKeyGetter=i||N0,this._newKeyGetter=n||N0,this.context=a,this._diffModeMultiple=o==="multiple"}return t.prototype.add=function(e){return this._add=e,this},t.prototype.update=function(e){return this._update=e,this},t.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},t.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},t.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},t.prototype.remove=function(e){return this._remove=e,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var e=this._old,r=this._new,i={},n=new Array(e.length),a=new Array(r.length);this._initIndexMap(e,null,n,"_oldKeyGetter"),this._initIndexMap(r,i,a,"_newKeyGetter");for(var o=0;o1){var f=l.shift();l.length===1&&(i[s]=l[0]),this._update&&this._update(f,o)}else u===1?(i[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(a,i)},t.prototype._executeMultiple=function(){var e=this._old,r=this._new,i={},n={},a=[],o=[];this._initIndexMap(e,i,a,"_oldKeyGetter"),this._initIndexMap(r,n,o,"_newKeyGetter");for(var s=0;s1&&v===1)this._updateManyToOne&&this._updateManyToOne(f,u),n[l]=null;else if(h===1&&v>1)this._updateOneToMany&&this._updateOneToMany(f,u),n[l]=null;else if(h===1&&v===1)this._update&&this._update(f,u),n[l]=null;else if(h>1&&v>1)this._updateManyToMany&&this._updateManyToMany(f,u),n[l]=null;else if(h>1)for(var c=0;c1)for(var s=0;s30}var Do=rt,Di=tt,_R=typeof Int32Array>"u"?Array:Int32Array,yR="e\0\0",O0=-1,xR=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],TR=["_approximateExtent"],B0,Ml,Lo,Ro,ac,Cl,oc,wS=function(){function t(e,r){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","lttbDownSample"];var i,n=!1;yS(e)?(i=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(n=!0,i=e),i=i||["x","y"];for(var a={},o=[],s={},l=!1,u={},f=0;f=r)){var i=this._store,n=i.getProvider();this._updateOrdinalMeta();var a=this._nameList,o=this._idList,s=n.getSource().sourceFormat,l=s===wr;if(l&&!n.pure)for(var u=[],f=e;f0},t.prototype.ensureUniqueItemVisual=function(e,r){var i=this._itemVisuals,n=i[e];n||(n=i[e]={});var a=n[r];return a==null&&(a=this.getVisual(r),j(a)?a=a.slice():Do(a)&&(a=Y({},a)),n[r]=a),a},t.prototype.setItemVisual=function(e,r,i){var n=this._itemVisuals[e]||{};this._itemVisuals[e]=n,Do(r)?Y(n,r):n[r]=i},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(e,r){Do(e)?Y(this._layout,e):this._layout[e]=r},t.prototype.getLayout=function(e){return this._layout[e]},t.prototype.getItemLayout=function(e){return this._itemLayouts[e]},t.prototype.setItemLayout=function(e,r,i){this._itemLayouts[e]=i?Y(this._itemLayouts[e]||{},r):r},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(e,r){var i=this.hostModel&&this.hostModel.seriesIndex;WE(i,this.dataType,e,r),this._graphicEls[e]=r},t.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},t.prototype.eachItemGraphicEl=function(e,r){C(this._graphicEls,function(i,n){i&&e&&e.call(r,i,n)})},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:Di(this.dimensions,this._getDimInfo,this),this.hostModel)),ac(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(e,r){var i=this[e];ct(i)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var n=i.apply(this,arguments);return r.apply(this,[n].concat(Pd(arguments)))})},t.internalField=function(){B0=function(e){var r=e._invertedIndicesMap;C(r,function(i,n){var a=e._dimInfos[n],o=a.ordinalMeta,s=e._store;if(o){i=r[n]=new _R(o.categories.length);for(var l=0;l1&&(l+="__ec__"+f),n[r]=l}}}(),t}();function SR(t,e){return bS(t,e).dimensions}function bS(t,e){gp(t)||(t=TT(t)),e=e||{};var r=e.coordDimensions||[],i=e.dimensionsDefine||t.dimensionsDefine||[],n=ht(),a=[],o=bR(t,r,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&SS(o),l=i===t.dimensionsDefine,u=l?TS(t):xS(i),f=e.encodeDefine;!f&&e.encodeDefaulter&&(f=e.encodeDefaulter(t,o));for(var h=ht(f),v=new DT(o),c=0;c0&&(i.name=n+(a-1)),a++,e.set(n,a)}}function bR(t,e,r,i){var n=Math.max(t.dimensionsDetectedCount||1,e.length,r.length,i||0);return C(e,function(a){var o;rt(a)&&(o=a.dimsDef)&&(n=Math.max(n,o.length))}),n}function AR(t,e,r){if(r||e.hasKey(t)){for(var i=0;e.hasKey(t+i);)i++;t+=i}return e.set(t,!0),t}var ER=function(){function t(e){this.coordSysDims=[],this.axisMap=ht(),this.categoryAxisMap=ht(),this.coordSysName=e}return t}();function MR(t){var e=t.get("coordinateSystem"),r=new ER(e),i=CR[e];if(i)return i(t,r,r.axisMap,r.categoryAxisMap),r}var CR={cartesian2d:function(t,e,r,i){var n=t.getReferringComponents("xAxis",Ze).models[0],a=t.getReferringComponents("yAxis",Ze).models[0];e.coordSysDims=["x","y"],r.set("x",n),r.set("y",a),pa(n)&&(i.set("x",n),e.firstCategoryDimIndex=0),pa(a)&&(i.set("y",a),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,r,i){var n=t.getReferringComponents("singleAxis",Ze).models[0];e.coordSysDims=["single"],r.set("single",n),pa(n)&&(i.set("single",n),e.firstCategoryDimIndex=0)},polar:function(t,e,r,i){var n=t.getReferringComponents("polar",Ze).models[0],a=n.findAxisModel("radiusAxis"),o=n.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],r.set("radius",a),r.set("angle",o),pa(a)&&(i.set("radius",a),e.firstCategoryDimIndex=0),pa(o)&&(i.set("angle",o),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=1))},geo:function(t,e,r,i){e.coordSysDims=["lng","lat"]},parallel:function(t,e,r,i){var n=t.ecModel,a=n.getComponent("parallel",t.get("parallelIndex")),o=e.coordSysDims=a.dimensions.slice();C(a.parallelAxisIndex,function(s,l){var u=n.getComponent("parallelAxis",s),f=o[l];r.set(f,u),pa(u)&&(i.set(f,u),e.firstCategoryDimIndex==null&&(e.firstCategoryDimIndex=l))})}};function pa(t){return t.get("type")==="category"}function AS(t,e,r){r=r||{};var i=r.byIndex,n=r.stackedCoordDimension,a,o,s;DR(e)?a=e:(o=e.schema,a=o.dimensions,s=e.store);var l=!!(t&&t.get("stack")),u,f,h,v;if(C(a,function(_,y){Q(_)&&(a[y]=_={name:_}),l&&!_.isExtraCoord&&(!i&&!u&&_.ordinalMeta&&(u=_),!f&&_.type!=="ordinal"&&_.type!=="time"&&(!n||n===_.coordDim)&&(f=_))}),f&&!i&&!u&&(i=!0),f){h="__\0ecstackresult_"+t.id,v="__\0ecstackedover_"+t.id,u&&(u.createInvertedIndices=!0);var c=f.coordDim,d=f.type,p=0;C(a,function(_){_.coordDim===c&&p++});var g={name:h,coordDim:c,coordDimIndex:p,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},m={name:v,coordDim:v,coordDimIndex:p+1,type:d,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(g.storeDimIndex=s.ensureCalculationDimension(v,d),m.storeDimIndex=s.ensureCalculationDimension(h,d)),o.appendCalculationDimension(g),o.appendCalculationDimension(m)):(a.push(g),a.push(m))}return{stackedDimension:f&&f.name,stackedByDimension:u&&u.name,isStackedByIndex:i,stackedOverDimension:v,stackResultDimension:h}}function DR(t){return!yS(t.schema)}function Ja(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function ES(t,e){return Ja(t,e)?t.getCalculationInfo("stackResultDimension"):e}function LR(t,e){var r=t.get("coordinateSystem"),i=Bf.get(r),n;return e&&e.coordSysDims&&(n=tt(e.coordSysDims,function(a){var o={name:a},s=e.axisMap.get(a);if(s){var l=s.get("type");o.type=dR(l)}return o})),n||(n=i&&(i.getDimensionsInfo?i.getDimensionsInfo():i.dimensions.slice())||["x","y"]),n}function RR(t,e,r){var i,n;return r&&C(t,function(a,o){var s=a.coordDim,l=r.categoryAxisMap.get(s);l&&(i==null&&(i=o),a.ordinalMeta=l.getOrdinalMeta(),e&&(a.createInvertedIndices=!0)),a.otherDims.itemName!=null&&(n=!0)}),!n&&i!=null&&(t[i].otherDims.itemName=0),i}function PR(t,e,r){r=r||{};var i=e.getSourceManager(),n,a=!1;n=i.getSource(),a=n.sourceFormat===wr;var o=MR(e),s=LR(e,o),l=r.useEncodeDefaulter,u=ct(l)?l:l?le(LC,s,e):null,f={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!a},h=bS(n,f),v=RR(h.dimensions,r.createInvertedIndices,o),c=a?null:i.getSharedDataStore(h),d=AS(e,{schema:h,store:c}),p=new wS(h,e);p.setCalculationInfo(d);var g=v!=null&&IR(n)?function(m,_,y,x){return x===v?y:this.defaultDimValueGetter(m,_,y,x)}:null;return p.hasItemOption=!1,p.initData(a?n:c,null,g),p}function IR(t){if(t.sourceFormat===wr){var e=NR(t.data||[]);return!j(Hs(e))}}function NR(t){for(var e=0;er[1]&&(r[1]=e[1])},t.prototype.unionExtentFromData=function(e,r){this.unionExtent(e.getApproximateExtent(r))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(e,r){var i=this._extent;isNaN(e)||(i[0]=e),isNaN(r)||(i[1]=r)},t.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(e){this._isBlank=e},t}();_f(oi);var OR=0,$u=function(){function t(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++OR}return t.createByAxisModel=function(e){var r=e.option,i=r.data,n=i&&tt(i,BR);return new t({categories:n,needCollect:!n,deduplication:r.dedplication!==!1})},t.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},t.prototype.parseAndCollect=function(e){var r,i=this._needCollect;if(!Q(e)&&!i)return e;if(i&&!this._deduplication)return r=this.categories.length,this.categories[r]=e,r;var n=this._getOrCreateMap();return r=n.get(e),r==null&&(i?(r=this.categories.length,this.categories[r]=e,n.set(e,r)):r=NaN),r},t.prototype._getOrCreateMap=function(){return this._map||(this._map=ht(this.categories))},t}();function BR(t){return rt(t)&&t.value!=null?t.value:t+""}function $v(t){return t.type==="interval"||t.type==="log"}function FR(t,e,r,i){var n={},a=t[1]-t[0],o=n.interval=ox(a/e);r!=null&&oi&&(o=n.interval=i);var s=n.intervalPrecision=MS(o),l=n.niceTickExtent=[Jt(Math.ceil(t[0]/o)*o,s),Jt(Math.floor(t[1]/o)*o,s)];return kR(l,t),n}function sc(t){var e=Math.pow(10,Ud(t)),r=t/e;return r?r===2?r=3:r===3?r=5:r*=2:r=1,Jt(r*e)}function MS(t){return ci(t)+2}function F0(t,e,r){t[e]=Math.max(Math.min(t[e],r[1]),r[0])}function kR(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),F0(t,0,e),F0(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function Hf(t,e){return t>=e[0]&&t<=e[1]}function Vf(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function Gf(t,e){return t*(e[1]-e[0])+e[0]}var Cp=function(t){K(e,t);function e(r){var i=t.call(this,r)||this;i.type="ordinal";var n=i.getSetting("ordinalMeta");return n||(n=new $u({})),j(n)&&(n=new $u({categories:tt(n,function(a){return rt(a)?a.value:a})})),i._ordinalMeta=n,i._extent=i.getSetting("extent")||[0,n.categories.length-1],i}return e.prototype.parse=function(r){return r==null?NaN:Q(r)?this._ordinalMeta.getOrdinal(r):Math.round(r)},e.prototype.contain=function(r){return r=this.parse(r),Hf(r,this._extent)&&this._ordinalMeta.categories[r]!=null},e.prototype.normalize=function(r){return r=this._getTickNumber(this.parse(r)),Vf(r,this._extent)},e.prototype.scale=function(r){return r=Math.round(Gf(r,this._extent)),this.getRawOrdinalNumber(r)},e.prototype.getTicks=function(){for(var r=[],i=this._extent,n=i[0];n<=i[1];)r.push({value:n}),n++;return r},e.prototype.getMinorTicks=function(r){},e.prototype.setSortInfo=function(r){if(r==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var i=r.ordinalNumbers,n=this._ordinalNumbersByTick=[],a=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Math.min(s,i.length);o=0&&r=0&&r=r},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(oi);oi.registerClass(Cp);var yn=Jt,fo=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="interval",r._interval=0,r._intervalPrecision=2,r}return e.prototype.parse=function(r){return r},e.prototype.contain=function(r){return Hf(r,this._extent)},e.prototype.normalize=function(r){return Vf(r,this._extent)},e.prototype.scale=function(r){return Gf(r,this._extent)},e.prototype.setExtent=function(r,i){var n=this._extent;isNaN(r)||(n[0]=parseFloat(r)),isNaN(i)||(n[1]=parseFloat(i))},e.prototype.unionExtent=function(r){var i=this._extent;r[0]i[1]&&(i[1]=r[1]),this.setExtent(i[0],i[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(r){this._interval=r,this._niceExtent=this._extent.slice(),this._intervalPrecision=MS(r)},e.prototype.getTicks=function(r){var i=this._interval,n=this._extent,a=this._niceExtent,o=this._intervalPrecision,s=[];if(!i)return s;var l=1e4;n[0]l)return[];var f=s.length?s[s.length-1].value:a[1];return n[1]>f&&(r?s.push({value:yn(f+i,o)}):s.push({value:n[1]})),s},e.prototype.getMinorTicks=function(r){for(var i=this.getTicks(!0),n=[],a=this.getExtent(),o=1;oa[0]&&c0&&(a=a===null?s:Math.min(a,s))}r[i]=a}}return r}function GR(t){var e=VR(t),r=[];return C(t,function(i){var n=i.coordinateSystem,a=n.getBaseAxis(),o=a.getExtent(),s;if(a.type==="category")s=a.getBandWidth();else if(a.type==="value"||a.type==="time"){var l=a.dim+"_"+a.index,u=e[l],f=Math.abs(o[1]-o[0]),h=a.scale.getExtent(),v=Math.abs(h[1]-h[0]);s=u?f/v*u:f}else{var c=i.getData();s=Math.abs(o[1]-o[0])/c.count()}var d=se(i.get("barWidth"),s),p=se(i.get("barMaxWidth"),s),g=se(i.get("barMinWidth")||(ZR(i)?.5:1),s),m=i.get("barGap"),_=i.get("barCategoryGap");r.push({bandWidth:s,barWidth:d,barMaxWidth:p,barMinWidth:g,barGap:m,barCategoryGap:_,axisKey:LS(a),stackId:DS(i)})}),WR(r)}function WR(t){var e={};C(t,function(i,n){var a=i.axisKey,o=i.bandWidth,s=e[a]||{bandWidth:o,remainedWidth:o,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},l=s.stacks;e[a]=s;var u=i.stackId;l[u]||s.autoWidthCount++,l[u]=l[u]||{width:0,maxWidth:0};var f=i.barWidth;f&&!l[u].width&&(l[u].width=f,f=Math.min(s.remainedWidth,f),s.remainedWidth-=f);var h=i.barMaxWidth;h&&(l[u].maxWidth=h);var v=i.barMinWidth;v&&(l[u].minWidth=v);var c=i.barGap;c!=null&&(s.gap=c);var d=i.barCategoryGap;d!=null&&(s.categoryGap=d)});var r={};return C(e,function(i,n){r[n]={};var a=i.stacks,o=i.bandWidth,s=i.categoryGap;if(s==null){var l=mt(a).length;s=Math.max(35-l*4,15)+"%"}var u=se(s,o),f=se(i.gap,1),h=i.remainedWidth,v=i.autoWidthCount,c=(h-u)/(v+(v-1)*f);c=Math.max(c,0),C(a,function(m){var _=m.maxWidth,y=m.minWidth;if(m.width){var x=m.width;_&&(x=Math.min(x,_)),y&&(x=Math.max(x,y)),m.width=x,h-=x+f*x,v--}else{var x=c;_&&_x&&(x=y),x!==c&&(m.width=x,h-=x+f*x,v--)}}),c=(h-u)/(v+(v-1)*f),c=Math.max(c,0);var d=0,p;C(a,function(m,_){m.width||(m.width=c),p=m,d+=m.width*(1+f)}),p&&(d-=p.width*f);var g=-d/2;C(a,function(m,_){r[n][_]=r[n][_]||{bandWidth:o,offset:g,width:m.width},g+=m.width*(1+f)})}),r}function XR(t,e,r){if(t&&e){var i=t[LS(e)];return i!=null&&r!=null?i[DS(r)]:i}}function YR(t){return t.coordinateSystem&&t.coordinateSystem.type==="cartesian2d"}function ZR(t){return t.pipelineContext&&t.pipelineContext.large}var qR=function(t,e,r,i){for(;r>>1;t[n][1]n&&(this._approxInterval=n);var s=Dl.length,l=Math.min(qR(Dl,this._approxInterval,0,s),s-1);this._interval=Dl[l][1],this._minLevelUnit=Dl[Math.max(l-1,0)][0]},e.prototype.parse=function(r){return $t(r)?r:+ni(r)},e.prototype.contain=function(r){return Hf(this.parse(r),this._extent)},e.prototype.normalize=function(r){return Vf(this.parse(r),this._extent)},e.prototype.scale=function(r){return Gf(r,this._extent)},e.type="time",e}(fo),Dl=[["second",fp],["minute",hp],["hour",fs],["quarter-day",fs*6],["half-day",fs*12],["day",gr*1.2],["half-week",gr*3.5],["week",gr*7],["month",gr*31],["quarter",gr*95],["half-year",Mm/2],["year",Mm]];function $R(t,e,r,i){var n=ni(e),a=ni(r),o=function(d){return Dm(n,d,i)===Dm(a,d,i)},s=function(){return o("year")},l=function(){return s()&&o("month")},u=function(){return l()&&o("day")},f=function(){return u()&&o("hour")},h=function(){return f()&&o("minute")},v=function(){return h()&&o("second")},c=function(){return v()&&o("millisecond")};switch(t){case"year":return s();case"month":return l();case"day":return u();case"hour":return f();case"minute":return h();case"second":return v();case"millisecond":return c()}}function KR(t,e){return t/=gr,t>16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function jR(t){var e=30*gr;return t/=e,t>6?6:t>3?3:t>2?2:1}function QR(t){return t/=fs,t>12?12:t>6?6:t>3.5?4:t>2?2:1}function k0(t,e){return t/=e?hp:fp,t>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function JR(t){return ox(t)}function tP(t,e,r){var i=new Date(t);switch(Za(e)){case"year":case"month":i[tT(r)](0);case"day":i[eT(r)](1);case"hour":i[rT(r)](0);case"minute":i[iT(r)](0);case"second":i[nT(r)](0),i[aT(r)](0)}return i.getTime()}function eP(t,e,r,i){var n=1e4,a=Qx,o=0;function s(M,E,D,R,P,I,N){for(var V=new Date(E),O=E,X=V[R]();O1&&I===0&&D.unshift({value:D[0].value-O})}}for(var I=0;I=i[0]&&_<=i[1]&&h++)}var y=(i[1]-i[0])/e;if(h>y*1.5&&v>y/1.5||(u.push(g),h>y||t===a[c]))break}f=[]}}}for(var x=oe(tt(u,function(M){return oe(M,function(E){return E.value>=i[0]&&E.value<=i[1]&&!E.notAdd})}),function(M){return M.length>0}),S=[],T=x.length-1,c=0;c0;)a*=10;var s=[Jt(nP(i[0]/a)*a),Jt(iP(i[1]/a)*a)];this._interval=a,this._niceExtent=s}},e.prototype.calcNiceExtent=function(r){ds.calcNiceExtent.call(this,r),this._fixMin=r.fixMin,this._fixMax=r.fixMax},e.prototype.parse=function(r){return r},e.prototype.contain=function(r){return r=Er(r)/Er(this.base),Hf(r,this._extent)},e.prototype.normalize=function(r){return r=Er(r)/Er(this.base),Vf(r,this._extent)},e.prototype.scale=function(r){return r=Gf(r,this._extent),Ll(this.base,r)},e.type="log",e}(oi),PS=Dp.prototype;PS.getMinorTicks=ds.getMinorTicks;PS.getLabel=ds.getLabel;function Rl(t,e){return rP(t,ci(e))}oi.registerClass(Dp);var aP=function(){function t(e,r,i){this._prepareParams(e,r,i)}return t.prototype._prepareParams=function(e,r,i){i[1]0&&l>0&&!u&&(s=0),s<0&&l<0&&!f&&(l=0));var v=this._determinedMin,c=this._determinedMax;return v!=null&&(s=v,u=!0),c!=null&&(l=c,f=!0),{min:s,max:l,minFixed:u,maxFixed:f,isBlank:h}},t.prototype.modifyDataMinMax=function(e,r){this[sP[e]]=r},t.prototype.setDeterminedMinMax=function(e,r){var i=oP[e];this[i]=r},t.prototype.freeze=function(){this.frozen=!0},t}(),oP={min:"_determinedMin",max:"_determinedMax"},sP={min:"_dataMin",max:"_dataMax"};function IS(t,e,r){var i=t.rawExtentInfo;return i||(i=new aP(t,e,r),t.rawExtentInfo=i,i)}function Pl(t,e){return e==null?null:yu(e)?NaN:t.parse(e)}function NS(t,e){var r=t.type,i=IS(t,e,t.getExtent()).calculate();t.setBlank(i.isBlank);var n=i.min,a=i.max,o=e.ecModel;if(o&&r==="time"){var s=HR("bar",o),l=!1;if(C(s,function(h){l=l||h.getBaseAxis()===e.axis}),l){var u=GR(s),f=lP(n,a,e,u);n=f.min,a=f.max}}return{extent:[n,a],fixMin:i.minFixed,fixMax:i.maxFixed}}function lP(t,e,r,i){var n=r.axis.getExtent(),a=n[1]-n[0],o=XR(i,r.axis);if(o===void 0)return{min:t,max:e};var s=1/0;C(o,function(c){s=Math.min(c.offset,s)});var l=-1/0;C(o,function(c){l=Math.max(c.offset+c.width,l)}),s=Math.abs(s),l=Math.abs(l);var u=s+l,f=e-t,h=1-(s+l)/a,v=f/h-f;return e+=v*(l/u),t-=v*(s/u),{min:t,max:e}}function Kv(t,e){var r=e,i=NS(t,r),n=i.extent,a=r.get("splitNumber");t instanceof Dp&&(t.base=r.get("logBase"));var o=t.type,s=r.get("interval"),l=o==="interval"||o==="time";t.setExtent(n[0],n[1]),t.calcNiceExtent({splitNumber:a,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?r.get("minInterval"):null,maxInterval:l?r.get("maxInterval"):null}),s!=null&&t.setInterval&&t.setInterval(s)}function OS(t,e){if(e=e||t.get("type"),e)switch(e){case"category":return new Cp({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new RS({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(oi.getClass(e)||fo)}}function uP(t){var e=t.scale.getExtent(),r=e[0],i=e[1];return!(r>0&&i>0||r<0&&i<0)}function ho(t){var e=t.getLabelModel().get("formatter"),r=t.type==="category"?t.scale.getExtent()[0]:null;return t.scale.type==="time"?function(i){return function(n,a){return t.scale.getFormattedLabel(n,a,i)}}(e):Q(e)?function(i){return function(n){var a=t.scale.getLabel(n),o=i.replace("{value}",a??"");return o}}(e):ct(e)?function(i){return function(n,a){return r!=null&&(a=n.value-r),i(Lp(t,n),a,n.level!=null?{level:n.level}:null)}}(e):function(i){return t.scale.getLabel(i)}}function Lp(t,e){return t.type==="category"?t.scale.getLabel(e):e.value}function fP(t){var e=t.model,r=t.scale;if(!(!e.get(["axisLabel","show"])||r.isBlank())){var i,n,a=r.getExtent();r instanceof Cp?n=r.count():(i=r.getTicks(),n=i.length);var o=t.getLabelModel(),s=ho(t),l,u=1;n>40&&(u=Math.ceil(n/40));for(var f=0;ft[1]&&(t[1]=n[1])})}var kS=function(){function t(){}return t.prototype.getNeedCrossZero=function(){var e=this.option;return!e.scale},t.prototype.getCoordSysModel=function(){},t}(),vP={isDimensionStacked:Ja,enableDataStack:AS,getStackedDimension:ES};function dP(t,e){var r=e;e instanceof Zt||(r=new Zt(e));var i=OS(r);return i.setExtent(t[0],t[1]),Kv(i,r),i}function pP(t){kr(t,kS)}var U0=[],gP={registerPreprocessor:Ap,registerProcessor:dS,registerPostInit:pS,registerPostUpdate:gS,registerUpdateLifecycle:Ep,registerAction:ta,registerCoordinateSystem:oR,registerLayout:lR,registerVisual:ea,registerTransform:fR,registerLoading:mS,registerMap:uR,registerImpl:UL,PRIORITY:JL,ComponentModel:Rt,ComponentView:ze,SeriesModel:yi,ChartView:Nr,registerComponentModel:function(t){Rt.registerClass(t)},registerComponentView:function(t){ze.registerClass(t)},registerSeriesModel:function(t){yi.registerClass(t)},registerChartView:function(t){Nr.registerClass(t)},registerSubTypeDefaulter:function(t,e){Rt.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){AA(t,e)}};function Qe(t){if(j(t)){C(t,function(e){Qe(e)});return}bt(U0,t)>=0||(U0.push(t),ct(t)&&(t={install:t}),t.install(gP))}var Ls=Yt();function zS(t,e){var r=tt(e,function(i){return t.scale.parse(i)});return t.type==="time"&&r.length>0&&(r.sort(),r.unshift(r[0]),r.push(r[r.length-1])),r}function mP(t){var e=t.getLabelModel().get("customValues");if(e){var r=ho(t);return{labels:zS(t,e).map(function(i){var n={value:i};return{formattedLabel:r(n),rawLabel:t.scale.getLabel(n),tickValue:i}})}}return t.type==="category"?yP(t):TP(t)}function _P(t,e){var r=t.getTickModel().get("customValues");return r?{ticks:zS(t,r)}:t.type==="category"?xP(t,e):{ticks:tt(t.scale.getTicks(),function(i){return i.value})}}function yP(t){var e=t.getLabelModel(),r=US(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:r.labelCategoryInterval}:r}function US(t,e){var r=HS(t,"labels"),i=Rp(e),n=VS(r,i);if(n)return n;var a,o;return ct(i)?a=XS(t,i):(o=i==="auto"?SP(t):i,a=WS(t,o)),GS(r,i,{labels:a,labelCategoryInterval:o})}function xP(t,e){var r=HS(t,"ticks"),i=Rp(e),n=VS(r,i);if(n)return n;var a,o;if((!e.get("show")||t.scale.isBlank())&&(a=[]),ct(i))a=XS(t,i,!0);else if(i==="auto"){var s=US(t,t.getLabelModel());o=s.labelCategoryInterval,a=tt(s.labels,function(l){return l.tickValue})}else o=i,a=WS(t,o,!0);return GS(r,i,{ticks:a,tickCategoryInterval:o})}function TP(t){var e=t.scale.getTicks(),r=ho(t);return{labels:tt(e,function(i,n){return{level:i.level,formattedLabel:r(i,n),rawLabel:t.scale.getLabel(i),tickValue:i.value}})}}function HS(t,e){return Ls(t)[e]||(Ls(t)[e]=[])}function VS(t,e){for(var r=0;r40&&(s=Math.max(1,Math.floor(o/40)));for(var l=a[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),f=Math.abs(u*Math.cos(i)),h=Math.abs(u*Math.sin(i)),v=0,c=0;l<=a[1];l+=s){var d=0,p=0,g=kd(r({value:l}),e.font,"center","top");d=g.width*1.3,p=g.height*1.3,v=Math.max(v,d,7),c=Math.max(c,p,7)}var m=v/f,_=c/h;isNaN(m)&&(m=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(m,_))),x=Ls(t.model),S=t.getExtent(),T=x.lastAutoInterval,w=x.lastTickCount;return T!=null&&w!=null&&Math.abs(T-y)<=1&&Math.abs(w-o)<=1&&T>y&&x.axisExtent0===S[0]&&x.axisExtent1===S[1]?y=T:(x.lastTickCount=o,x.lastAutoInterval=y,x.axisExtent0=S[0],x.axisExtent1=S[1]),y}function bP(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function WS(t,e,r){var i=ho(t),n=t.scale,a=n.getExtent(),o=t.getLabelModel(),s=[],l=Math.max((e||0)+1,1),u=a[0],f=n.count();u!==0&&l>1&&f/l>2&&(u=Math.round(Math.ceil(u/l)*l));var h=BS(t),v=o.get("showMinLabel")||h,c=o.get("showMaxLabel")||h;v&&u!==a[0]&&p(a[0]);for(var d=u;d<=a[1];d+=l)p(d);c&&d-l!==a[1]&&p(a[1]);function p(g){var m={value:g};s.push(r?g:{formattedLabel:i(m),rawLabel:n.getLabel(m),tickValue:g})}return s}function XS(t,e,r){var i=t.scale,n=ho(t),a=[];return C(i.getTicks(),function(o){var s=i.getLabel(o),l=o.value;e(o.value,s)&&a.push(r?l:{formattedLabel:n(o),rawLabel:s,tickValue:l})}),a}var H0=[0,1],Pp=function(){function t(e,r,i){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=r,this._extent=i||[0,0]}return t.prototype.contain=function(e){var r=this._extent,i=Math.min(r[0],r[1]),n=Math.max(r[0],r[1]);return e>=i&&e<=n},t.prototype.containData=function(e){return this.scale.contain(e)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(e){return nx(e||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(e,r){var i=this._extent;i[0]=e,i[1]=r},t.prototype.dataToCoord=function(e,r){var i=this._extent,n=this.scale;return e=n.normalize(e),this.onBand&&n.type==="ordinal"&&(i=i.slice(),V0(i,n.count())),te(e,H0,i,r)},t.prototype.coordToData=function(e,r){var i=this._extent,n=this.scale;this.onBand&&n.type==="ordinal"&&(i=i.slice(),V0(i,n.count()));var a=te(e,i,H0,r);return this.scale.scale(a)},t.prototype.pointToData=function(e,r){},t.prototype.getTicksCoords=function(e){e=e||{};var r=e.tickModel||this.getTickModel(),i=_P(this,r),n=i.ticks,a=tt(n,function(s){return{coord:this.dataToCoord(this.scale.type==="ordinal"?this.scale.getRawOrdinalNumber(s):s),tickValue:s}},this),o=r.get("alignWithLabel");return AP(this,a,o,e.clamp),a},t.prototype.getMinorTicksCoords=function(){if(this.scale.type==="ordinal")return[];var e=this.model.getModel("minorTick"),r=e.get("splitNumber");r>0&&r<100||(r=5);var i=this.scale.getMinorTicks(r),n=tt(i,function(a){return tt(a,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return n},t.prototype.getViewLabels=function(){return mP(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var e=this._extent,r=this.scale.getExtent(),i=r[1]-r[0]+(this.onBand?1:0);i===0&&(i=1);var n=Math.abs(e[1]-e[0]);return Math.abs(n)/i},t.prototype.calculateCategoryInterval=function(){return wP(this)},t}();function V0(t,e){var r=t[1]-t[0],i=e,n=r/i/2;t[0]+=n,t[1]-=n}function AP(t,e,r,i){var n=e.length;if(!t.onBand||r||!n)return;var a=t.getExtent(),o,s;if(n===1)e[0].coord=a[0],o=e[1]={coord:a[1]};else{var l=e[n-1].tickValue-e[0].tickValue,u=(e[n-1].coord-e[0].coord)/l;C(e,function(c){c.coord-=u/2});var f=t.scale.getExtent();s=1+f[1]-e[n-1].tickValue,o={coord:e[n-1].coord+u*s},e.push(o)}var h=a[0]>a[1];v(e[0].coord,a[0])&&(i?e[0].coord=a[0]:e.shift()),i&&v(a[0],e[0].coord)&&e.unshift({coord:a[0]}),v(a[1],o.coord)&&(i?o.coord=a[1]:e.pop()),i&&v(o.coord,a[1])&&e.push({coord:a[1]});function v(c,d){return c=Jt(c),d=Jt(d),h?c>d:cn&&(n+=Po);var c=Math.atan2(s,o);if(c<0&&(c+=Po),c>=i&&c<=n||c+Po>=i&&c+Po<=n)return l[0]=f,l[1]=h,u-r;var d=r*Math.cos(i)+t,p=r*Math.sin(i)+e,g=r*Math.cos(n)+t,m=r*Math.sin(n)+e,_=(d-o)*(d-o)+(p-s)*(p-s),y=(g-o)*(g-o)+(m-s)*(m-s);return _0){e=e/180*Math.PI,zn.fromArray(t[0]),me.fromArray(t[1]),tr.fromArray(t[2]),yt.sub(za,zn,me),yt.sub(Io,tr,me);var r=za.len(),i=Io.len();if(!(r<.001||i<.001)){za.scale(1/r),Io.scale(1/i);var n=za.dot(Io),a=Math.cos(e);if(a1&&yt.copy(Tn,tr),Tn.toArray(t[1])}}}}function lc(t,e,r,i){var n=r==="normal",a=n?t:t.ensureState(r);a.ignore=e;var o=i.get("smooth");o&&o===!0&&(o=.3),a.shape=a.shape||{},o>0&&(a.shape.smooth=o);var s=i.getModel("lineStyle").getLineStyle();n?t.useStyle(s):a.style=s}function PP(t,e){var r=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),r>0&&i.length>=3){var n=ov(i[0],i[1]),a=ov(i[1],i[2]);if(!n||!a){t.lineTo(i[1][0],i[1][1]),t.lineTo(i[2][0],i[2][1]);return}var o=Math.min(n,a)*r,s=th([],i[1],i[0],o/n),l=th([],i[1],i[2],o/a),u=th([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var f=1;f0&&a&&S(-f/o,0,o);var p=t[0],g=t[o-1],m,_;y(),m<0&&T(-m,.8),_<0&&T(_,.8),y(),x(m,_,1),x(_,m,-1),y(),m<0&&w(-m),_<0&&w(_);function y(){m=p.rect[e]-i,_=n-g.rect[e]-g.rect[r]}function x(b,A,M){if(b<0){var E=Math.min(A,-b);if(E>0){S(E*M,0,o);var D=E+b;D<0&&T(-D*M,1)}else T(-b*M,1)}}function S(b,A,M){b!==0&&(u=!0);for(var E=A;E0)for(var D=0;D0;D--){var N=M[D-1]*I;S(-N,D,o)}}}function w(b){var A=b<0?-1:1;b=Math.abs(b);for(var M=Math.ceil(b/(o-1)),E=0;E0?S(M,0,E+1):S(-M,o-E-1,o),b-=M,b<=0)return}return u}function OP(t,e,r,i){return qS(t,"x","width",e,r,i)}function BP(t,e,r,i){return qS(t,"y","height",e,r,i)}function $S(t){var e=[];t.sort(function(p,g){return g.priority-p.priority});var r=new Pt(0,0,0,0);function i(p){if(!p.ignore){var g=p.ensureState("emphasis");g.ignore==null&&(g.ignore=!1)}p.ignore=!0}for(var n=0;n=0&&i.attr(a.oldLayoutSelect),bt(v,"emphasis")>=0&&i.attr(a.oldLayoutEmphasis)),Sr(i,u,r,l)}else if(i.attr(u),!Df(i).valueAnimation){var h=ft(i.style.opacity,1);i.style.opacity=0,$i(i,{style:{opacity:h}},r,l)}if(a.oldLayout=u,i.states.select){var c=a.oldLayoutSelect={};Il(c,u,Nl),Il(c,i.states.select,Nl)}if(i.states.emphasis){var d=a.oldLayoutEmphasis={};Il(d,u,Nl),Il(d,i.states.emphasis,Nl)}oC(i,l,f,r,r)}if(n&&!n.ignore&&!n.invisible){var a=zP(n),o=a.oldLayout,p={points:n.shape.points};o?(n.attr({shape:o}),Sr(n,{shape:p},r)):(n.setShape(p),n.style.strokePercent=0,$i(n,{style:{strokePercent:1}},r)),a.oldLayout=p}},t}(),fc=Yt();function HP(t){t.registerUpdateLifecycle("series:beforeupdate",function(e,r,i){var n=fc(r).labelManager;n||(n=fc(r).labelManager=new UP),n.clearLabels()}),t.registerUpdateLifecycle("series:layoutlabels",function(e,r,i){var n=fc(r).labelManager;i.updatedSeries.forEach(function(a){n.addLabelsOfSeries(r.getViewOfSeriesModel(a))}),n.updateLayoutConfig(r),n.layout(r),n.processLabelsOverall()})}const VP=["getWidth","getHeight","getDom","getOption","resize","dispatchAction","convertToPixel","convertFromPixel","containPixel","getDataURL","getConnectedDataURL","appendData","clear","isDisposed","dispose"];function GP(t){function e(i){return(...n)=>{if(!t.value)throw new Error("ECharts is not initialized yet.");return t.value[i].apply(t.value,n)}}function r(){const i=Object.create(null);return VP.forEach(n=>{i[n]=e(n)}),i}return r()}function WP(t,e,r){jl([r,t,e],([i,n,a],o,s)=>{let l=null;if(i&&n&&a){const{offsetWidth:u,offsetHeight:f}=i,h=a===!0?{}:a,{throttle:v=100,onResize:c}=h;let d=!1;const p=()=>{n.resize(),c==null||c()},g=v?yp(p,v):p;l=new ResizeObserver(()=>{!d&&(d=!0,i.offsetWidth===u&&i.offsetHeight===f)||g()}),l.observe(i)}s(()=>{l&&(l.disconnect(),l=null)})})}const XP={autoresize:[Boolean,Object]},YP=/^on[^a-z]/,KS=t=>YP.test(t);function ZP(t){const e={};for(const r in t)KS(r)||(e[r]=t[r]);return e}function cu(t,e){const r=H2(t)?V2(t):t;return r&&typeof r=="object"&&"value"in r?r.value||e:r||e}const qP="ecLoadingOptions";function $P(t,e,r){const i=Ql(qP,{}),n=Ma(()=>({...cu(i,{}),...r==null?void 0:r.value}));S1(()=>{const a=t.value;a&&(e.value?a.showLoading(n.value):a.hideLoading())})}const KP={loading:Boolean,loadingOptions:Object};let No=null;const Ip="x-vue-echarts";function jP(){if(No!=null)return No;if(typeof HTMLElement>"u"||typeof customElements>"u")return No=!1;try{new Function("tag","class EChartsElement extends HTMLElement{__dispose=null;disconnectedCallback(){this.__dispose&&(this.__dispose(),this.__dispose=null)}}customElements.get(tag)==null&&customElements.define(tag,EChartsElement);")(Ip)}catch{return No=!1}return No=!0}document.head.appendChild(document.createElement("style")).textContent=`x-vue-echarts{display:block;width:100%;height:100%;min-width:0} `;const QP=jP();rv&&rv.config.ignoredElements.push(Ip);const JP="ecTheme",tI="ecInitOptions",eI="ecUpdateOptions",Y0=/(^&?~?!?)native:/;var f4=N2({name:"echarts",props:{option:Object,theme:{type:[Object,String]},initOptions:Object,updateOptions:Object,group:String,manualUpdate:Boolean,...XP,...KP},emits:{},inheritAttrs:!1,setup(t,{attrs:e}){const r=Qf(),i=Qf(),n=Qf(),a=Ql(JP,null),o=Ql(tI,null),s=Ql(eI,null),{autoresize:l,manualUpdate:u,loading:f,loadingOptions:h}=O2(t),v=Ma(()=>n.value||t.option||null),c=Ma(()=>t.theme||cu(a,{})),d=Ma(()=>t.initOptions||cu(o,{})),p=Ma(()=>t.updateOptions||cu(s,{})),g=Ma(()=>ZP(e)),m={},_=B2().proxy.$listeners,y={};_?Object.keys(_).forEach(A=>{Y0.test(A)?m[A.replace(Y0,"$1")]=_[A]:y[A]=_[A]}):Object.keys(e).filter(A=>KS(A)).forEach(A=>{let M=A.charAt(2).toLowerCase()+A.slice(3);if(M.indexOf("native:")===0){const E=`on${M.charAt(7).toUpperCase()}${M.slice(8)}`;m[E]=e[A];return}M.substring(M.length-4)==="Once"&&(M=`~${M.substring(0,M.length-4)}`),y[M]=e[A]});function x(A){if(!r.value)return;const M=i.value=nR(r.value,c.value,d.value);t.group&&(M.group=t.group),Object.keys(y).forEach(R=>{let P=y[R];if(!P)return;let I=R.toLowerCase();I.charAt(0)==="~"&&(I=I.substring(1),P.__once__=!0);let N=M;if(I.indexOf("zr:")===0&&(N=M.getZr(),I=I.substring(3)),P.__once__){delete P.__once__;const V=P;P=(...O)=>{V(...O),N.off(I,P)}}N.on(I,P)});function E(){M&&!M.isDisposed()&&M.resize()}function D(){const R=A||v.value;R&&M.setOption(R,p.value)}l.value?U2(()=>{E(),D()}):D()}function S(A,M){t.manualUpdate&&(n.value=A),i.value?i.value.setOption(A,M||{}):x(A)}function T(){i.value&&(i.value.dispose(),i.value=void 0)}let w=null;jl(u,A=>{typeof w=="function"&&(w(),w=null),A||(w=jl(()=>t.option,(M,E)=>{M&&(i.value?i.value.setOption(M,{notMerge:M!==E,...p.value}):x())},{deep:!0}))},{immediate:!0}),jl([c,d],()=>{T(),x()},{deep:!0}),S1(()=>{t.group&&i.value&&(i.value.group=t.group)});const b=GP(i);return $P(i,f,h),WP(i,l,r),F2(()=>{x()}),k2(()=>{QP&&r.value?r.value.__dispose=T:T()}),{chart:i,root:r,setOption:S,nonEventAttrs:g,nativeListeners:m,...b}},render(){const t=rv?{attrs:this.nonEventAttrs,on:this.nativeListeners}:{...this.nonEventAttrs,...this.nativeListeners};return t.ref="root",t.class=t.class?["echarts"].concat(t.class):"echarts",z2(Ip,t)}}),rI=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.hasSymbolVisual=!0,r}return e.prototype.getInitialData=function(r){return PR(null,this,{useEncodeDefaulter:!0})},e.prototype.getLegendIcon=function(r){var i=new ee,n=Br("line",0,r.itemHeight/2,r.itemWidth,0,r.lineStyle.stroke,!1);i.add(n),n.setStyle(r.lineStyle);var a=this.getData().getVisual("symbol"),o=this.getData().getVisual("symbolRotate"),s=a==="none"?"circle":a,l=r.itemHeight*.8,u=Br(s,(r.itemWidth-l)/2,(r.itemHeight-l)/2,l,l,r.itemStyle.fill);i.add(u),u.setStyle(r.itemStyle);var f=r.iconRotate==="inherit"?o:r.iconRotate||0;return u.rotation=f*Math.PI/180,u.setOrigin([r.itemWidth/2,r.itemHeight/2]),s.indexOf("empty")>-1&&(u.style.stroke=u.style.fill,u.style.fill="#fff",u.style.lineWidth=2),i},e.type="series.line",e.dependencies=["grid","polar"],e.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},e}(yi);function jS(t,e){var r=t.mapDimensionsAll("defaultedLabel"),i=r.length;if(i===1){var n=Qa(t,e,r[0]);return n!=null?n+"":null}else if(i){for(var a=[],o=0;o=0&&i.push(e[a])}return i.join(" ")}var Np=function(t){K(e,t);function e(r,i,n,a){var o=t.call(this)||this;return o.updateData(r,i,n,a),o}return e.prototype._createSymbol=function(r,i,n,a,o){this.removeAll();var s=Br(r,-1,-1,2,2,null,o);s.attr({z2:100,culling:!0,scaleX:a[0]/2,scaleY:a[1]/2}),s.drift=nI,this._symbolType=r,this.add(s)},e.prototype.stopSymbolAnimation=function(r){this.childAt(0).stopAnimation(null,r)},e.prototype.getSymbolType=function(){return this._symbolType},e.prototype.getSymbolPath=function(){return this.childAt(0)},e.prototype.highlight=function(){Pu(this.childAt(0))},e.prototype.downplay=function(){Iu(this.childAt(0))},e.prototype.setZ=function(r,i){var n=this.childAt(0);n.zlevel=r,n.z=i},e.prototype.setDraggable=function(r,i){var n=this.childAt(0);n.draggable=r,n.cursor=!i&&r?"move":n.cursor},e.prototype.updateData=function(r,i,n,a){this.silent=!1;var o=r.getItemVisual(i,"symbol")||"circle",s=r.hostModel,l=e.getSymbolSize(r,i),u=o!==this._symbolType,f=a&&a.disableAnimation;if(u){var h=r.getItemVisual(i,"symbolKeepAspect");this._createSymbol(o,r,i,l,h)}else{var v=this.childAt(0);v.silent=!1;var c={scaleX:l[0]/2,scaleY:l[1]/2};f?v.attr(c):Sr(v,c,s,i),WM(v)}if(this._updateCommon(r,i,l,n,a),u){var v=this.childAt(0);if(!f){var c={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:v.style.opacity}};v.scaleX=v.scaleY=0,v.style.opacity=0,$i(v,c,s,i)}}f&&this.childAt(0).stopAnimation("leave")},e.prototype._updateCommon=function(r,i,n,a,o){var s=this.childAt(0),l=r.hostModel,u,f,h,v,c,d,p,g,m;if(a&&(u=a.emphasisItemStyle,f=a.blurItemStyle,h=a.selectItemStyle,v=a.focus,c=a.blurScope,p=a.labelStatesModels,g=a.hoverScale,m=a.cursorStyle,d=a.emphasisDisabled),!a||r.hasItemOption){var _=a&&a.itemModel?a.itemModel:r.getItemModel(i),y=_.getModel("emphasis");u=y.getModel("itemStyle").getItemStyle(),h=_.getModel(["select","itemStyle"]).getItemStyle(),f=_.getModel(["blur","itemStyle"]).getItemStyle(),v=y.get("focus"),c=y.get("blurScope"),d=y.get("disabled"),p=sp(_),g=y.getShallow("scale"),m=_.getShallow("cursor")}var x=r.getItemVisual(i,"symbolRotate");s.attr("rotation",(x||0)*Math.PI/180||0);var S=$T(r.getItemVisual(i,"symbolOffset"),n);S&&(s.x=S[0],s.y=S[1]),m&&s.attr("cursor",m);var T=r.getItemVisual(i,"style"),w=T.fill;if(s instanceof ir){var b=s.style;s.useStyle(Y({image:b.image,x:b.x,y:b.y,width:b.width,height:b.height},T))}else s.__isEmptyBrush?s.useStyle(Y({},T)):s.useStyle(T),s.style.decal=null,s.setColor(w,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var A=r.getItemVisual(i,"liftZ"),M=this._z2;A!=null?M==null&&(this._z2=s.z2,s.z2+=A):M!=null&&(s.z2=M,this._z2=null);var E=o&&o.useNameLabel;op(s,p,{labelFetcher:l,labelDataIndex:i,defaultText:D,inheritColor:w,defaultOpacity:T.opacity});function D(I){return E?r.getName(I):jS(r,I)}this._sizeX=n[0]/2,this._sizeY=n[1]/2;var R=s.ensureState("emphasis");R.style=u,s.ensureState("select").style=h,s.ensureState("blur").style=f;var P=g==null||g===!0?Math.max(1.1,3/this._sizeY):isFinite(g)&&g>0?+g:1;R.scaleX=this._sizeX*P,R.scaleY=this._sizeY*P,this.setSymbolScale(1),Lv(this,v,c,d)},e.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},e.prototype.fadeOut=function(r,i,n){var a=this.childAt(0),o=Mt(this).dataIndex,s=n&&n.animation;if(this.silent=a.silent=!0,n&&n.fadeLabel){var l=a.getTextContent();l&&Bu(l,{style:{opacity:0}},i,{dataIndex:o,removeOpt:s,cb:function(){a.removeTextContent()}})}else a.removeTextContent();Bu(a,{style:{opacity:0},scaleX:0,scaleY:0},i,{dataIndex:o,cb:r,removeOpt:s})},e.getSymbolSize=function(r,i){return wL(r.getItemVisual(i,"symbolSize"))},e}(ee);function nI(t,e){this.parent.drift(t,e)}function hc(t,e,r,i){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(i.isIgnore&&i.isIgnore(r))&&!(i.clipShape&&!i.clipShape.contain(e[0],e[1]))&&t.getItemVisual(r,"symbol")!=="none"}function Z0(t){return t!=null&&!rt(t)&&(t={isIgnore:t}),t||{}}function q0(t){var e=t.hostModel,r=e.getModel("emphasis");return{emphasisItemStyle:r.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:r.get("focus"),blurScope:r.get("blurScope"),emphasisDisabled:r.get("disabled"),hoverScale:r.get("scale"),labelStatesModels:sp(e),cursorStyle:e.get("cursor")}}var aI=function(){function t(e){this.group=new ee,this._SymbolCtor=e||Np}return t.prototype.updateData=function(e,r){this._progressiveEls=null,r=Z0(r);var i=this.group,n=e.hostModel,a=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=q0(e),u={disableAnimation:s},f=r.getSymbolPoint||function(h){return e.getItemLayout(h)};a||i.removeAll(),e.diff(a).add(function(h){var v=f(h);if(hc(e,v,h,r)){var c=new o(e,h,l,u);c.setPosition(v),e.setItemGraphicEl(h,c),i.add(c)}}).update(function(h,v){var c=a.getItemGraphicEl(v),d=f(h);if(!hc(e,d,h,r)){i.remove(c);return}var p=e.getItemVisual(h,"symbol")||"circle",g=c&&c.getSymbolType&&c.getSymbolType();if(!c||g&&g!==p)i.remove(c),c=new o(e,h,l,u),c.setPosition(d);else{c.updateData(e,h,l,u);var m={x:d[0],y:d[1]};s?c.attr(m):Sr(c,m,n)}i.add(c),e.setItemGraphicEl(h,c)}).remove(function(h){var v=a.getItemGraphicEl(h);v&&v.fadeOut(function(){i.remove(v)},n)}).execute(),this._getSymbolPoint=f,this._data=e},t.prototype.updateLayout=function(){var e=this,r=this._data;r&&r.eachItemGraphicEl(function(i,n){var a=e._getSymbolPoint(n);i.setPosition(a),i.markRedraw()})},t.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=q0(e),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(e,r,i){this._progressiveEls=[],i=Z0(i);function n(l){l.isGroup||(l.incremental=!0,l.ensureState("emphasis").hoverLayer=!0)}for(var a=e.start;a0?r=i[0]:i[1]<0&&(r=i[1]),r}function JS(t,e,r,i){var n=NaN;t.stacked&&(n=r.get(r.getCalculationInfo("stackedOverDimension"),i)),isNaN(n)&&(n=t.valueStart);var a=t.baseDataOffset,o=[];return o[a]=r.get(t.baseDim,i),o[1-a]=n,e.dataToPoint(o)}function sI(t,e){var r=[];return e.diff(t).add(function(i){r.push({cmd:"+",idx:i})}).update(function(i,n){r.push({cmd:"=",idx:n,idx1:i})}).remove(function(i){r.push({cmd:"-",idx:i})}).execute(),r}function lI(t,e,r,i,n,a,o,s){for(var l=sI(t,e),u=[],f=[],h=[],v=[],c=[],d=[],p=[],g=QS(n,e,o),m=t.getLayout("points")||[],_=e.getLayout("points")||[],y=0;y=n||p<0)break;if(Xn(m,_)){if(l){p+=a;continue}break}if(p===r)t[a>0?"moveTo":"lineTo"](m,_),h=m,v=_;else{var y=m-u,x=_-f;if(y*y+x*x<.5){p+=a;continue}if(o>0){for(var S=p+a,T=e[S*2],w=e[S*2+1];T===m&&w===_&&g=i||Xn(T,w))c=m,d=_;else{M=T-u,E=w-f;var P=m-u,I=T-m,N=_-f,V=w-_,O=void 0,X=void 0;if(s==="x"){O=Math.abs(P),X=Math.abs(I);var G=M>0?1:-1;c=m-G*O*o,d=_,D=m+G*X*o,R=_}else if(s==="y"){O=Math.abs(N),X=Math.abs(V);var lt=E>0?1:-1;c=m,d=_-lt*O*o,D=m,R=_+lt*X*o}else O=Math.sqrt(P*P+N*N),X=Math.sqrt(I*I+V*V),A=X/(X+O),c=m-M*o*(1-A),d=_-E*o*(1-A),D=m+M*o*A,R=_+E*o*A,D=Li(D,Ri(T,m)),R=Li(R,Ri(w,_)),D=Ri(D,Li(T,m)),R=Ri(R,Li(w,_)),M=D-m,E=R-_,c=m-M*O/X,d=_-E*O/X,c=Li(c,Ri(u,m)),d=Li(d,Ri(f,_)),c=Ri(c,Li(u,m)),d=Ri(d,Li(f,_)),M=m-c,E=_-d,D=m+M*X/O,R=_+E*X/O}t.bezierCurveTo(h,v,c,d,m,_),h=D,v=R}else t.lineTo(m,_)}u=m,f=_,p+=a}return g}var tw=function(){function t(){this.smooth=0,this.smoothConstraint=!0}return t}(),uI=function(t){K(e,t);function e(r){var i=t.call(this,r)||this;return i.type="ec-polyline",i}return e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new tw},e.prototype.buildPath=function(r,i){var n=i.points,a=0,o=n.length/2;if(i.connectNulls){for(;o>0&&Xn(n[o*2-2],n[o*2-1]);o--);for(;a=0){var x=u?(d-l)*y+l:(c-s)*y+s;return u?[r,x]:[x,r]}s=c,l=d;break;case o.C:c=a[h++],d=a[h++],p=a[h++],g=a[h++],m=a[h++],_=a[h++];var S=u?Su(s,c,p,m,r,f):Su(l,d,g,_,r,f);if(S>0)for(var T=0;T=0){var x=u?ce(l,d,g,_,w):ce(s,c,p,m,w);return u?[r,x]:[x,r]}}s=m,l=_;break}}},e}(kt),fI=function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(tw),hI=function(t){K(e,t);function e(r){var i=t.call(this,r)||this;return i.type="ec-polygon",i}return e.prototype.getDefaultShape=function(){return new fI},e.prototype.buildPath=function(r,i){var n=i.points,a=i.stackedOnPoints,o=0,s=n.length/2,l=i.smoothMonotone;if(i.connectNulls){for(;s>0&&Xn(n[s*2-2],n[s*2-1]);s--);for(;oe){a?r.push(o(a,l,e)):n&&r.push(o(n,l,0),o(n,l,e));break}else n&&(r.push(o(n,l,0)),n=null),r.push(l),a=l}return r}function mI(t,e,r){var i=t.getVisual("visualMeta");if(!(!i||!i.length||!t.count())&&e.type==="cartesian2d"){for(var n,a,o=i.length-1;o>=0;o--){var s=t.getDimensionInfo(i[o].dimension);if(n=s&&s.coordDim,n==="x"||n==="y"){a=i[o];break}}if(a){var l=e.getAxis(n),u=tt(a.stops,function(y){return{coord:l.toGlobalCoord(l.dataToCoord(y.value)),color:y.color}}),f=u.length,h=a.outerColors.slice();f&&u[0].coord>u[f-1].coord&&(u.reverse(),h.reverse());var v=gI(u,n==="x"?r.getWidth():r.getHeight()),c=v.length;if(!c&&f)return u[0].coord<0?h[1]?h[1]:u[f-1].color:h[0]?h[0]:u[0].color;var d=10,p=v[0].coord-d,g=v[c-1].coord+d,m=g-p;if(m<.001)return"transparent";C(v,function(y){y.offset=(y.coord-p)/m}),v.push({offset:c?v[c-1].offset:.5,color:h[1]||"transparent"}),v.unshift({offset:c?v[0].offset:.5,color:h[0]||"transparent"});var _=new Jd(0,0,0,0,v,!0);return _[n]=p,_[n+"2"]=g,_}}}function _I(t,e,r){var i=t.get("showAllSymbol"),n=i==="auto";if(!(i&&!n)){var a=r.getAxesByScale("ordinal")[0];if(a&&!(n&&yI(a,e))){var o=e.mapDimension(a.dim),s={};return C(a.getViewLabels(),function(l){var u=a.scale.getRawOrdinalNumber(l.tickValue);s[u]=1}),function(l){return!s.hasOwnProperty(e.get(o,l))}}}}function yI(t,e){var r=t.getExtent(),i=Math.abs(r[1]-r[0])/t.scale.count();isNaN(i)&&(i=0);for(var n=e.count(),a=Math.max(1,Math.round(n/5)),o=0;oi)return!1;return!0}function xI(t,e){return isNaN(t)||isNaN(e)}function TI(t){for(var e=t.length/2;e>0&&xI(t[e*2-2],t[e*2-1]);e--);return e-1}function J0(t,e){return[t[e*2],t[e*2+1]]}function SI(t,e,r){for(var i=t.length/2,n=r==="x"?0:1,a,o,s=0,l=-1,u=0;u=e||a>=e&&o<=e){l=u;break}s=u,a=o}return{range:[s,l],t:(e-a)/(o-a)}}function ew(t){if(t.get(["endLabel","show"]))return!0;for(var e=0;e0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var G=p.getState("emphasis").style;G.lineWidth=+p.style.lineWidth+1}Mt(p).seriesIndex=r.seriesIndex,Lv(p,V,O,X);var lt=Q0(r.get("smooth")),J=r.get("smoothMonotone");if(p.setShape({smooth:lt,smoothMonotone:J,connectNulls:b}),g){var ot=l.getCalculationInfo("stackedOnSeries"),at=0;g.useStyle(Et(f.getAreaStyle(),{fill:R,opacity:.7,lineJoin:"bevel",decal:l.getVisual("style").decal})),ot&&(at=Q0(ot.get("smooth"))),g.setShape({smooth:lt,stackedOnSmooth:at,smoothMonotone:J,connectNulls:b}),hm(g,r,"areaStyle"),Mt(g).seriesIndex=r.seriesIndex,Lv(g,V,O,X)}var Dt=function(pt){a._changePolyState(pt)};l.eachItemGraphicEl(function(pt){pt&&(pt.onHoverStateChange=Dt)}),this._polyline.onHoverStateChange=Dt,this._data=l,this._coordSys=o,this._stackedOnPoints=T,this._points=h,this._step=E,this._valueOrigin=x,r.get("triggerLineEvent")&&(this.packEventData(r,p),g&&this.packEventData(r,g))},e.prototype.packEventData=function(r,i){Mt(i).eventData={componentType:"series",componentSubType:"line",componentIndex:r.componentIndex,seriesIndex:r.seriesIndex,seriesName:r.name,seriesType:"line"}},e.prototype.highlight=function(r,i,n,a){var o=r.getData(),s=qn(o,a);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var f=l[s*2],h=l[s*2+1];if(isNaN(f)||isNaN(h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(f,h))return;var v=r.get("zlevel")||0,c=r.get("z")||0;u=new Np(o,s),u.x=f,u.y=h,u.setZ(v,c);var d=u.getSymbolPath().getTextContent();d&&(d.zlevel=v,d.z=c,d.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else Nr.prototype.highlight.call(this,r,i,n,a)},e.prototype.downplay=function(r,i,n,a){var o=r.getData(),s=qn(o,a);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else Nr.prototype.downplay.call(this,r,i,n,a)},e.prototype._changePolyState=function(r){var i=this._polygon;om(this._polyline,r),i&&om(i,r)},e.prototype._newPolyline=function(r){var i=this._polyline;return i&&this._lineGroup.remove(i),i=new uI({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(i),this._polyline=i,i},e.prototype._newPolygon=function(r,i){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new hI({shape:{points:r,stackedOnPoints:i},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},e.prototype._initSymbolLabelAnimation=function(r,i,n){var a,o,s=i.getBaseAxis(),l=s.inverse;i.type==="cartesian2d"?(a=s.isHorizontal(),o=!1):i.type==="polar"&&(a=s.dim==="angle",o=!0);var u=r.hostModel,f=u.get("animationDuration");ct(f)&&(f=f(null));var h=u.get("animationDelay")||0,v=ct(h)?h(null):h;r.eachItemGraphicEl(function(c,d){var p=c;if(p){var g=[c.x,c.y],m=void 0,_=void 0,y=void 0;if(n)if(o){var x=n,S=i.pointToCoord(g);a?(m=x.startAngle,_=x.endAngle,y=-S[1]/180*Math.PI):(m=x.r0,_=x.r,y=S[0])}else{var T=n;a?(m=T.x,_=T.x+T.width,y=c.x):(m=T.y+T.height,_=T.y,y=c.y)}var w=_===m?0:(y-m)/(_-m);l&&(w=1-w);var b=ct(h)?h(d):f*w+v,A=p.getSymbolPath(),M=A.getTextContent();p.attr({scaleX:0,scaleY:0}),p.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:b}),M&&M.animateFrom({style:{opacity:0}},{duration:300,delay:b}),A.disableLabelAnimation=!0}})},e.prototype._initOrUpdateEndLabel=function(r,i,n){var a=r.getModel("endLabel");if(ew(r)){var o=r.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new Xt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var f=TI(l);f>=0&&(op(s,sp(r,"endLabel"),{inheritColor:n,labelFetcher:r,labelDataIndex:f,defaultText:function(h,v,c){return c!=null?iI(o,c):jS(o,h)},enableTextSetter:!0},wI(a,i)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},e.prototype._endLabelOnDuring=function(r,i,n,a,o,s,l){var u=this._endLabel,f=this._polyline;if(u){r<1&&a.originalX==null&&(a.originalX=u.x,a.originalY=u.y);var h=n.getLayout("points"),v=n.hostModel,c=v.get("connectNulls"),d=s.get("precision"),p=s.get("distance")||0,g=l.getBaseAxis(),m=g.isHorizontal(),_=g.inverse,y=i.shape,x=_?m?y.x:y.y+y.height:m?y.x+y.width:y.y,S=(m?p:0)*(_?-1:1),T=(m?0:-p)*(_?-1:1),w=m?"x":"y",b=SI(h,x,w),A=b.range,M=A[1]-A[0],E=void 0;if(M>=1){if(M>1&&!c){var D=J0(h,A[0]);u.attr({x:D[0]+S,y:D[1]+T}),o&&(E=v.getRawValue(A[0]))}else{var D=f.getPointOn(x,w);D&&u.attr({x:D[0]+S,y:D[1]+T});var R=v.getRawValue(A[0]),P=v.getRawValue(A[1]);o&&(E=vx(n,d,R,P,b.t))}a.lastFrameIndex=A[0]}else{var I=r===1||a.lastFrameIndex>0?A[0]:0,D=J0(h,I);o&&(E=v.getRawValue(I)),u.attr({x:D[0]+S,y:D[1]+T})}if(o){var N=Df(u);typeof N.setLabelText=="function"&&N.setLabelText(E)}}},e.prototype._doUpdateAnimation=function(r,i,n,a,o,s,l){var u=this._polyline,f=this._polygon,h=r.hostModel,v=lI(this._data,r,this._stackedOnPoints,i,this._coordSys,n,this._valueOrigin),c=v.current,d=v.stackedOnCurrent,p=v.next,g=v.stackedOnNext;if(o&&(c=Pi(v.current,n,o,l),d=Pi(v.stackedOnCurrent,n,o,l),p=Pi(v.next,n,o,l),g=Pi(v.stackedOnNext,n,o,l)),j0(c,p)>3e3||f&&j0(d,g)>3e3){u.stopAnimation(),u.setShape({points:p}),f&&(f.stopAnimation(),f.setShape({points:p,stackedOnPoints:g}));return}u.shape.__points=v.current,u.shape.points=c;var m={shape:{points:p}};v.current!==c&&(m.shape.__points=v.next),u.stopAnimation(),Sr(u,m,h),f&&(f.setShape({points:c,stackedOnPoints:d}),f.stopAnimation(),Sr(f,{shape:{stackedOnPoints:g}},h),u.shape.points!==f.shape.points&&(f.shape.points=u.shape.points));for(var _=[],y=v.status,x=0;xe&&(e=t[r]);return isFinite(e)?e:NaN},min:function(t){for(var e=1/0,r=0;re&&(e=a,r=n)}return isFinite(r)?r:NaN},nearest:function(t){return t[0]}},MI=function(t){return Math.round(t.length/2)};function CI(t){return{seriesType:t,reset:function(e,r,i){var n=e.getData(),a=e.get("sampling"),o=e.coordinateSystem,s=n.count();if(s>10&&o.type==="cartesian2d"&&a){var l=o.getBaseAxis(),u=o.getOtherAxis(l),f=l.getExtent(),h=i.getDevicePixelRatio(),v=Math.abs(f[1]-f[0])*(h||1),c=Math.round(s/v);if(isFinite(c)&&c>1){a==="lttb"&&e.setData(n.lttbDownSample(n.mapDimension(u.dim),1/c));var d=void 0;Q(a)?d=EI[a]:ct(a)&&(d=a),d&&e.setData(n.downSample(n.mapDimension(u.dim),1/c,d,MI))}}}}}function DI(t){t.registerChartView(bI),t.registerSeriesModel(rI),t.registerLayout(AI("line")),t.registerVisual({seriesType:"line",reset:function(e){var r=e.getData(),i=e.getModel("lineStyle").getLineStyle();i&&!i.stroke&&(i.stroke=r.getVisual("style").fill),r.setVisual("legendLineStyle",i)}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,CI("line"))}var LI=function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Rt),Jv=function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Ze).models[0]},e.type="cartesian2dAxis",e}(Rt);kr(Jv,kS);var rw={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},RI=dt({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},rw),Op=dt({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},rw),PI=dt({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},Op),II=Et({logBase:10},Op);const NI={category:RI,value:Op,time:PI,log:II};var OI={value:1,category:1,time:1,log:1};function t_(t,e,r,i){C(OI,function(n,a){var o=dt(dt({},NI[a],!0),i,!0),s=function(l){K(u,l);function u(){var f=l!==null&&l.apply(this,arguments)||this;return f.type=e+"Axis."+a,f}return u.prototype.mergeDefaultAndTheme=function(f,h){var v=As(this),c=v?Zs(f):{},d=h.getTheme();dt(f,d.get(a+"Axis")),dt(f,this.getDefaultOption()),f.type=e_(f),v&&Kn(f,c,v)},u.prototype.optionUpdated=function(){var f=this.option;f.type==="category"&&(this.__ordinalMeta=$u.createByAxisModel(this))},u.prototype.getCategories=function(f){var h=this.option;if(h.type==="category")return f?h.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.type=e+"Axis."+a,u.defaultOption=o,u}(r);t.registerComponentModel(s)}),t.registerSubTypeDefaulter(e+"Axis",e_)}function e_(t){return t.type||(t.data?"category":"value")}var Bp=function(){function t(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return t.prototype.getAxis=function(e){return this._axes[e]},t.prototype.getAxes=function(){return tt(this._dimList,function(e){return this._axes[e]},this)},t.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),oe(this.getAxes(),function(r){return r.scale.type===e})},t.prototype.addAxis=function(e){var r=e.dim;this._axes[r]=e,this._dimList.push(r)},t}(),td=["x","y"];function r_(t){return t.type==="interval"||t.type==="time"}var BI=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="cartesian2d",r.dimensions=td,r}return e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,i=this.getAxis("y").scale;if(!(!r_(r)||!r_(i))){var n=r.getExtent(),a=i.getExtent(),o=this.dataToPoint([n[0],a[0]]),s=this.dataToPoint([n[1],a[1]]),l=n[1]-n[0],u=a[1]-a[0];if(!(!l||!u)){var f=(s[0]-o[0])/l,h=(s[1]-o[1])/u,v=o[0]-n[0]*f,c=o[1]-a[0]*h,d=this._transform=[f,0,0,h,v,c];this._invTransform=cf([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(r){var i=this.getAxis("x"),n=this.getAxis("y");return i.contain(i.toLocalCoord(r[0]))&&n.contain(n.toLocalCoord(r[1]))},e.prototype.containData=function(r){return this.getAxis("x").containData(r[0])&&this.getAxis("y").containData(r[1])},e.prototype.containZone=function(r,i){var n=this.dataToPoint(r),a=this.dataToPoint(i),o=this.getArea(),s=new Pt(n[0],n[1],a[0]-n[0],a[1]-n[1]);return o.intersect(s)},e.prototype.dataToPoint=function(r,i,n){n=n||[];var a=r[0],o=r[1];if(this._transform&&a!=null&&isFinite(a)&&o!=null&&isFinite(o))return _r(n,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return n[0]=s.toGlobalCoord(s.dataToCoord(a,i)),n[1]=l.toGlobalCoord(l.dataToCoord(o,i)),n},e.prototype.clampData=function(r,i){var n=this.getAxis("x").scale,a=this.getAxis("y").scale,o=n.getExtent(),s=a.getExtent(),l=n.parse(r[0]),u=a.parse(r[1]);return i=i||[],i[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),i[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),i},e.prototype.pointToData=function(r,i){var n=[];if(this._invTransform)return _r(n,r,this._invTransform);var a=this.getAxis("x"),o=this.getAxis("y");return n[0]=a.coordToData(a.toLocalCoord(r[0]),i),n[1]=o.coordToData(o.toLocalCoord(r[1]),i),n},e.prototype.getOtherAxis=function(r){return this.getAxis(r.dim==="x"?"y":"x")},e.prototype.getArea=function(r){r=r||0;var i=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),a=Math.min(i[0],i[1])-r,o=Math.min(n[0],n[1])-r,s=Math.max(i[0],i[1])-a+r,l=Math.max(n[0],n[1])-o+r;return new Pt(a,o,s,l)},e}(Bp),FI=function(t){K(e,t);function e(r,i,n,a,o){var s=t.call(this,r,i,n)||this;return s.index=0,s.type=a||"value",s.position=o||"bottom",s}return e.prototype.isHorizontal=function(){var r=this.position;return r==="top"||r==="bottom"},e.prototype.getGlobalExtent=function(r){var i=this.getExtent();return i[0]=this.toGlobalCoord(i[0]),i[1]=this.toGlobalCoord(i[1]),r&&i[0]>i[1]&&i.reverse(),i},e.prototype.pointToData=function(r,i){return this.coordToData(this.toLocalCoord(r[this.dim==="x"?0:1]),i)},e.prototype.setCategorySortInfo=function(r){if(this.type!=="category")return!1;this.model.option.categorySortInfo=r,this.scale.setSortInfo(r)},e}(Pp);function ed(t,e,r){r=r||{};var i=t.coordinateSystem,n=e.axis,a={},o=n.getAxesOnZeroOf()[0],s=n.position,l=o?"onZero":s,u=n.dim,f=i.getRect(),h=[f.x,f.x+f.width,f.y,f.y+f.height],v={left:0,right:1,top:0,bottom:1,onZero:2},c=e.get("offset")||0,d=u==="x"?[h[2]-c,h[3]+c]:[h[0]-c,h[1]+c];if(o){var p=o.toGlobalCoord(o.dataToCoord(0));d[v.onZero]=Math.max(Math.min(p,d[1]),d[0])}a.position=[u==="y"?d[v[l]]:h[0],u==="x"?d[v[l]]:h[3]],a.rotation=Math.PI/2*(u==="x"?0:1);var g={top:-1,bottom:1,left:-1,right:1};a.labelDirection=a.tickDirection=a.nameDirection=g[s],a.labelOffset=o?d[v[s]]-d[v.onZero]:0,e.get(["axisTick","inside"])&&(a.tickDirection=-a.tickDirection),ja(r.labelInside,e.get(["axisLabel","inside"]))&&(a.labelDirection=-a.labelDirection);var m=e.get(["axisLabel","rotate"]);return a.labelRotate=l==="top"?-m:m,a.z2=1,a}function i_(t){return t.get("coordinateSystem")==="cartesian2d"}function n_(t){var e={xAxisModel:null,yAxisModel:null};return C(e,function(r,i){var n=i.replace(/Model$/,""),a=t.getReferringComponents(n,Ze).models[0];e[i]=a}),e}var vc=Math.log;function kI(t,e,r){var i=fo.prototype,n=i.getTicks.call(r),a=i.getTicks.call(r,!0),o=n.length-1,s=i.getInterval.call(r),l=NS(t,e),u=l.extent,f=l.fixMin,h=l.fixMax;if(t.type==="log"){var v=vc(t.base);u=[vc(u[0])/v,vc(u[1])/v]}t.setExtent(u[0],u[1]),t.calcNiceExtent({splitNumber:o,fixMin:f,fixMax:h});var c=i.getExtent.call(t);f&&(u[0]=c[0]),h&&(u[1]=c[1]);var d=i.getInterval.call(t),p=u[0],g=u[1];if(f&&h)d=(g-p)/o;else if(f)for(g=u[0]+d*o;gu[0]&&isFinite(p)&&isFinite(u[0]);)d=sc(d),p=u[1]-d*o;else{var m=t.getTicks().length-1;m>o&&(d=sc(d));var _=d*o;g=Math.ceil(u[1]/d)*d,p=Jt(g-_),p<0&&u[0]>=0?(p=0,g=Jt(_)):g>0&&u[1]<=0&&(g=0,p=-Jt(_))}var y=(n[0].value-a[0].value)/s,x=(n[o].value-a[o].value)/s;i.setExtent.call(t,p+d*y,g+d*x),i.setInterval.call(t,d),(y||x)&&i.setNiceExtent.call(t,p+d,g-d)}var zI=function(){function t(e,r,i){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=td,this._initCartesian(e,r,i),this.model=e}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(e,r){var i=this._axesMap;this._updateScale(e,this.model);function n(o){var s,l=mt(o),u=l.length;if(u){for(var f=[],h=u-1;h>=0;h--){var v=+l[h],c=o[v],d=c.model,p=c.scale;$v(p)&&d.get("alignTicks")&&d.get("interval")==null?f.push(c):(Kv(p,d),$v(p)&&(s=c))}f.length&&(s||(s=f.pop(),Kv(s.scale,s.model)),C(f,function(g){kI(g.scale,g.model,s.scale)}))}}n(i.x),n(i.y);var a={};C(i.x,function(o){a_(i,"y",o,a)}),C(i.y,function(o){a_(i,"x",o,a)}),this.resize(this.model,r)},t.prototype.resize=function(e,r,i){var n=e.getBoxLayoutParams(),a=!i&&e.get("containLabel"),o=Ki(n,{width:r.getWidth(),height:r.getHeight()});this._rect=o;var s=this._axesList;l(),a&&(C(s,function(u){if(!u.model.get(["axisLabel","inside"])){var f=fP(u);if(f){var h=u.isHorizontal()?"height":"width",v=u.model.get(["axisLabel","margin"]);o[h]-=f[h]+v,u.position==="top"?o.y+=f.height+v:u.position==="left"&&(o.x+=f.width+v)}}}),l()),C(this._coordsList,function(u){u.calcAffineTransform()});function l(){C(s,function(u){var f=u.isHorizontal(),h=f?[0,o.width]:[0,o.height],v=u.inverse?1:0;u.setExtent(h[v],h[1-v]),UI(u,f?o.x:o.y)})}},t.prototype.getAxis=function(e,r){var i=this._axesMap[e];if(i!=null)return i[r||0]},t.prototype.getAxes=function(){return this._axesList.slice()},t.prototype.getCartesian=function(e,r){if(e!=null&&r!=null){var i="x"+e+"y"+r;return this._coordsMap[i]}rt(e)&&(r=e.yAxisIndex,e=e.xAxisIndex);for(var n=0,a=this._coordsList;n0?"top":"bottom",a="center"):Cu(n-Ui)?(o=i>0?"bottom":"top",a="center"):(o="middle",n>0&&n0?"right":"left":a=i>0?"left":"right"),{rotation:n,textAlign:a,textVerticalAlign:o}},t.makeAxisEventDataBase=function(e){var r={componentType:e.mainType,componentIndex:e.componentIndex};return r[e.mainType+"Index"]=e.componentIndex,r},t.isLabelSilent=function(e){var r=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||r&&r.show)},t}(),s_={axisLine:function(t,e,r,i){var n=e.get(["axisLine","show"]);if(n==="auto"&&t.handleAutoShown&&(n=t.handleAutoShown("axisLine")),!!n){var a=e.axis.getExtent(),o=i.transform,s=[a[0],0],l=[a[1],0],u=s[0]>l[0];o&&(_r(s,s,o),_r(l,l,o));var f=Y({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),h=new qi({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:f,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});ws(h.shape,h.style.lineWidth),h.anid="line",r.add(h);var v=e.get(["axisLine","symbol"]);if(v!=null){var c=e.get(["axisLine","symbolSize"]);Q(v)&&(v=[v,v]),(Q(c)||$t(c))&&(c=[c,c]);var d=$T(e.get(["axisLine","symbolOffset"])||0,c),p=c[0],g=c[1];C([{rotate:t.rotation+Math.PI/2,offset:d[0],r:0},{rotate:t.rotation-Math.PI/2,offset:d[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(m,_){if(v[_]!=="none"&&v[_]!=null){var y=Br(v[_],-p/2,-g/2,p,g,f.stroke,!0),x=m.r+m.offset,S=u?l:s;y.attr({rotation:m.rotate,x:S[0]+x*Math.cos(t.rotation),y:S[1]-x*Math.sin(t.rotation),silent:!0,z2:11}),r.add(y)}})}}},axisTickLabel:function(t,e,r,i){var n=GI(r,i,e,t),a=XI(r,i,e,t);if(VI(e,a,n),WI(r,i,e,t.tickDirection),e.get(["axisLabel","hideOverlap"])){var o=ZS(tt(a,function(s){return{label:s,priority:s.z2,defaultAttr:{ignore:s.ignore}}}));$S(o)}},axisName:function(t,e,r,i){var n=ja(t.axisName,e.get("name"));if(n){var a=e.get("nameLocation"),o=t.nameDirection,s=e.getModel("nameTextStyle"),l=e.get("nameGap")||0,u=e.axis.getExtent(),f=u[0]>u[1]?-1:1,h=[a==="start"?u[0]-f*l:a==="end"?u[1]+f*l:(u[0]+u[1])/2,u_(a)?t.labelOffset+o*l:0],v,c=e.get("nameRotate");c!=null&&(c=c*Ui/180);var d;u_(a)?v=Yi.innerTextLayout(t.rotation,c??t.rotation,o):(v=HI(t.rotation,a,c||0,u),d=t.axisNameAvailableWidth,d!=null&&(d=Math.abs(d/Math.sin(v.rotation)),!isFinite(d)&&(d=null)));var p=s.getFont(),g=e.get("nameTruncate",!0)||{},m=g.ellipsis,_=ja(t.nameTruncateMaxWidth,g.maxWidth,d),y=new Xt({x:h[0],y:h[1],rotation:v.rotation,silent:Yi.isLabelSilent(e),style:qe(s,{text:n,font:p,overflow:"truncate",width:_,ellipsis:m,fill:s.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:s.get("align")||v.textAlign,verticalAlign:s.get("verticalAlign")||v.textVerticalAlign}),z2:1});if(Mf({el:y,componentModel:e,itemName:n}),y.__fullText=n,y.anid="name",e.get("triggerEvent")){var x=Yi.makeAxisEventDataBase(e);x.targetType="axisName",x.name=n,Mt(y).eventData=x}i.add(y),y.updateTransform(),r.add(y),y.decomposeTransform()}}};function HI(t,e,r,i){var n=ax(r-t),a,o,s=i[0]>i[1],l=e==="start"&&!s||e!=="start"&&s;return Cu(n-Ui/2)?(o=l?"bottom":"top",a="center"):Cu(n-Ui*1.5)?(o=l?"top":"bottom",a="center"):(o="middle",nUi/2?a=l?"left":"right":a=l?"right":"left"),{rotation:n,textAlign:a,textVerticalAlign:o}}function VI(t,e,r){if(!BS(t.axis)){var i=t.get(["axisLabel","showMinLabel"]),n=t.get(["axisLabel","showMaxLabel"]);e=e||[],r=r||[];var a=e[0],o=e[1],s=e[e.length-1],l=e[e.length-2],u=r[0],f=r[1],h=r[r.length-1],v=r[r.length-2];i===!1?(ar(a),ar(u)):l_(a,o)&&(i?(ar(o),ar(f)):(ar(a),ar(u))),n===!1?(ar(s),ar(h)):l_(l,s)&&(n?(ar(l),ar(v)):(ar(s),ar(h)))}}function ar(t){t&&(t.ignore=!0)}function l_(t,e){var r=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(!(!r||!i)){var n=Nd([]);return Od(n,n,-t.rotation),r.applyTransform(Ga([],n,t.getLocalTransform())),i.applyTransform(Ga([],n,e.getLocalTransform())),r.intersect(i)}}function u_(t){return t==="middle"||t==="center"}function iw(t,e,r,i,n){for(var a=[],o=[],s=[],l=0;l=0||t===e}function jI(t){var e=Fp(t);if(e){var r=e.axisPointerModel,i=e.axis.scale,n=r.option,a=r.get("status"),o=r.get("value");o!=null&&(o=i.parse(o));var s=rd(r);a==null&&(n.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(o==null||o>l[1])&&(o=l[1]),o3?1.4:o>1?1.2:1.1,f=a>0?u:1/u;gc(this,"zoom","zoomOnMouseWheel",r,{scale:f,originX:s,originY:l,isAvailableBehavior:null})}if(n){var h=Math.abs(a),v=(a>0?1:-1)*(h>3?.4:h>1?.15:.05);gc(this,"scrollMove","moveOnMouseWheel",r,{scrollDelta:v,originX:s,originY:l,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(r){if(!v_(this._zr,"globalPan")){var i=r.pinchScale>1?1.1:1/1.1;gc(this,"zoom",null,r,{scale:i,originX:r.pinchX,originY:r.pinchY,isAvailableBehavior:null})}},e}(zr);function gc(t,e,r,i,n){t.pointerChecker&&t.pointerChecker(i,n.originX,n.originY)&&(gi(i.event),sw(t,e,r,i,n))}function sw(t,e,r,i,n){n.isAvailableBehavior=nt(vu,null,r,i),t.trigger(e,n)}function vu(t,e,r){var i=r[t];return!t||i&&(!Q(i)||e.event[i+"Key"])}var Ps=C,uN=rt,Ku=-1,Me=function(){function t(e){var r=e.mappingMethod,i=e.type,n=this.option=ut(e);this.type=i,this.mappingMethod=r,this._normalizeData=cN[r];var a=t.visualHandlers[i];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[r],r==="piecewise"?(mc(n),fN(n)):r==="category"?n.categories?hN(n):mc(n,!0):(xr(r!=="linear"||n.dataExtent),mc(n))}return t.prototype.mapValueToVisual=function(e){var r=this._normalizeData(e);return this._normalizedToVisual(r,e)},t.prototype.getNormalizer=function(){return nt(this._normalizeData,this)},t.listVisualTypes=function(){return mt(t.visualHandlers)},t.isValidType=function(e){return t.visualHandlers.hasOwnProperty(e)},t.eachVisual=function(e,r,i){rt(e)?C(e,r,i):r.call(i,e)},t.mapVisual=function(e,r,i){var n,a=j(e)?[]:rt(e)?{}:(n=!0,null);return t.eachVisual(e,function(o,s){var l=r.call(i,o,s);n?a=l:a[s]=l}),a},t.retrieveVisuals=function(e){var r={},i;return e&&Ps(t.visualHandlers,function(n,a){e.hasOwnProperty(a)&&(r[a]=e[a],i=!0)}),i?r:null},t.prepareVisualTypes=function(e){if(j(e))e=e.slice();else if(uN(e)){var r=[];Ps(e,function(i,n){r.push(n)}),e=r}else return[];return e.sort(function(i,n){return n==="color"&&i!=="color"&&i.indexOf("color")===0?1:-1}),e},t.dependsOn=function(e,r){return r==="color"?!!(e&&e.indexOf(r)===0):e===r},t.findPieceIndex=function(e,r,i){for(var n,a=1/0,o=0,s=r.length;o=0;a--)i[a]==null&&(delete r[e[a]],e.pop())}function mc(t,e){var r=t.visual,i=[];rt(r)?Ps(r,function(a){i.push(a)}):r!=null&&i.push(r);var n={color:1,symbol:1};!e&&i.length===1&&!n.hasOwnProperty(t.type)&&(i[1]=i[0]),lw(t,i)}function Ol(t){return{applyVisual:function(e,r,i){var n=this.mapValueToVisual(e);i("color",t(r("color"),n))},_normalizedToVisual:nd([0,1])}}function d_(t){var e=this.option.visual;return e[Math.round(te(t,[0,1],[0,e.length-1],!0))]||{}}function Oo(t){return function(e,r,i){i(t,this.mapValueToVisual(e))}}function Qo(t){var e=this.option.visual;return e[this.option.loop&&t!==Ku?t%e.length:t]}function Rn(){return this.option.visual[0]}function nd(t){return{linear:function(e){return te(e,t,this.option.visual,!0)},category:Qo,piecewise:function(e,r){var i=ad.call(this,r);return i==null&&(i=te(e,t,this.option.visual,!0)),i},fixed:Rn}}function ad(t){var e=this.option,r=e.pieceList;if(e.hasSpecialVisual){var i=Me.findPieceIndex(t,r),n=r[i];if(n&&n.visual)return n.visual[this.type]}}function lw(t,e){return t.visual=e,t.type==="color"&&(t.parsedVisual=tt(e,function(r){var i=Be(r);return i||[0,0,0,1]})),e}var cN={linear:function(t){return te(t,this.option.dataExtent,[0,1],!0)},piecewise:function(t){var e=this.option.pieceList,r=Me.findPieceIndex(t,e,!0);if(r!=null)return te(r,[0,e.length-1],[0,1],!0)},category:function(t){var e=this.option.categories?this.option.categoryMap[t]:t;return e??Ku},fixed:Te};function Bl(t,e,r){return t?e<=r:ea&&(e[1-i]=e[i]+h.sign*a),e}function _c(t,e){var r=t[e]-t[1-e];return{span:Math.abs(r),sign:r>0?-1:r<0?1:e?-1:1}}function ga(t,e){return Math.min(e[1]!=null?e[1]:1/0,Math.max(e[0]!=null?e[0]:-1/0,t))}function vN(t,e,r,i){return t&&(t.legacy||t.legacy!==!1&&!r&&!i&&e!=="tspan"&&(e==="text"||gt(t,"text")))}function dN(t,e,r){var i=t,n,a,o;if(e==="text")o=i;else{o={},gt(i,"text")&&(o.text=i.text),gt(i,"rich")&&(o.rich=i.rich),gt(i,"textFill")&&(o.fill=i.textFill),gt(i,"textStroke")&&(o.stroke=i.textStroke),gt(i,"fontFamily")&&(o.fontFamily=i.fontFamily),gt(i,"fontSize")&&(o.fontSize=i.fontSize),gt(i,"fontStyle")&&(o.fontStyle=i.fontStyle),gt(i,"fontWeight")&&(o.fontWeight=i.fontWeight),a={type:"text",style:o,silent:!0},n={};var s=gt(i,"textPosition");n.position=s?i.textPosition:"inside",gt(i,"textPosition")&&(n.position=i.textPosition),gt(i,"textOffset")&&(n.offset=i.textOffset),gt(i,"textRotation")&&(n.rotation=i.textRotation),gt(i,"textDistance")&&(n.distance=i.textDistance)}return p_(o,t),C(o.rich,function(l){p_(l,l)}),{textConfig:n,textContent:a}}function p_(t,e){e&&(e.font=e.textFont||e.font,gt(e,"textStrokeWidth")&&(t.lineWidth=e.textStrokeWidth),gt(e,"textAlign")&&(t.align=e.textAlign),gt(e,"textVerticalAlign")&&(t.verticalAlign=e.textVerticalAlign),gt(e,"textLineHeight")&&(t.lineHeight=e.textLineHeight),gt(e,"textWidth")&&(t.width=e.textWidth),gt(e,"textHeight")&&(t.height=e.textHeight),gt(e,"textBackgroundColor")&&(t.backgroundColor=e.textBackgroundColor),gt(e,"textPadding")&&(t.padding=e.textPadding),gt(e,"textBorderColor")&&(t.borderColor=e.textBorderColor),gt(e,"textBorderWidth")&&(t.borderWidth=e.textBorderWidth),gt(e,"textBorderRadius")&&(t.borderRadius=e.textBorderRadius),gt(e,"textBoxShadowColor")&&(t.shadowColor=e.textBoxShadowColor),gt(e,"textBoxShadowBlur")&&(t.shadowBlur=e.textBoxShadowBlur),gt(e,"textBoxShadowOffsetX")&&(t.shadowOffsetX=e.textBoxShadowOffsetX),gt(e,"textBoxShadowOffsetY")&&(t.shadowOffsetY=e.textBoxShadowOffsetY))}var uw={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},g_=mt(uw);Qn(ii,function(t,e){return t[e]=1,t},{});ii.join(", ");var ju=["","style","shape","extra"],to=Yt();function kp(t,e,r,i,n){var a=t+"Animation",o=tp(t,i,n)||{},s=to(e).userDuring;return o.duration>0&&(o.during=s?nt(xN,{el:e,userDuring:s}):null,o.setToFinal=!0,o.scope=t),Y(o,r[a]),o}function yc(t,e,r,i){i=i||{};var n=i.dataIndex,a=i.isInit,o=i.clearStyle,s=r.isAnimationEnabled(),l=to(t),u=e.style;l.userDuring=e.during;var f={},h={};if(SN(t,e,h),__("shape",e,h),__("extra",e,h),!a&&s&&(TN(t,e,f),m_("shape",t,e,f),m_("extra",t,e,f),wN(t,e,u,f)),h.style=u,gN(t,h,o),_N(t,e),s)if(a){var v={};C(ju,function(d){var p=d?e[d]:e;p&&p.enterFrom&&(d&&(v[d]=v[d]||{}),Y(d?v[d]:v,p.enterFrom))});var c=kp("enter",t,e,r,n);c.duration>0&&t.animateFrom(v,c)}else mN(t,e,n||0,r,f);fw(t,e),u?t.dirty():t.markRedraw()}function fw(t,e){for(var r=to(t).leaveToProps,i=0;i0&&t.animateFrom(n,a)}}function _N(t,e){gt(e,"silent")&&(t.silent=e.silent),gt(e,"ignore")&&(t.ignore=e.ignore),t instanceof Jn&>(e,"invisible")&&(t.invisible=e.invisible),t instanceof kt&>(e,"autoBatch")&&(t.autoBatch=e.autoBatch)}var Xr={},yN={setTransform:function(t,e){return Xr.el[t]=e,this},getTransform:function(t){return Xr.el[t]},setShape:function(t,e){var r=Xr.el,i=r.shape||(r.shape={});return i[t]=e,r.dirtyShape&&r.dirtyShape(),this},getShape:function(t){var e=Xr.el.shape;if(e)return e[t]},setStyle:function(t,e){var r=Xr.el,i=r.style;return i&&(i[t]=e,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(t){var e=Xr.el.style;if(e)return e[t]},setExtra:function(t,e){var r=Xr.el.extra||(Xr.el.extra={});return r[t]=e,this},getExtra:function(t){var e=Xr.el.extra;if(e)return e[t]}};function xN(){var t=this,e=t.el;if(e){var r=to(e).userDuring,i=t.userDuring;if(r!==i){t.el=t.userDuring=null;return}Xr.el=e,i(yN)}}function m_(t,e,r,i){var n=r[t];if(n){var a=e[t],o;if(a){var s=r.transition,l=n.transition;if(l)if(!o&&(o=i[t]={}),Yn(l))Y(o,a);else for(var u=ue(l),f=0;f=0){!o&&(o=i[t]={});for(var c=mt(a),f=0;f=0)){var v=t.getAnimationStyleProps(),c=v?v.style:null;if(c){!a&&(a=i.style={});for(var d=mt(r),u=0;u=s)}}for(var h=this.__startIndex;h15)break}}P.prevElClipPaths&&m.restore()};if(_)if(_.length===0)b=g.__endIndex;else for(var M=c.dpr,E=0;E<_.length;++E){var D=_[E];m.save(),m.beginPath(),m.rect(D.x*M,D.y*M,D.width*M,D.height*M),m.clip(),A(D),m.restore()}else m.save(),A(),m.restore();g.__drawIndex=b,g.__drawIndex0&&e>n[0]){for(l=0;le);l++);s=i[n[l]]}if(n.splice(l+1,0,e),i[e]=r,!r.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(r.dom,u.nextSibling):o.appendChild(r.dom)}else o.firstChild?o.insertBefore(r.dom,o.firstChild):o.appendChild(r.dom);r.painter||(r.painter=this)}},t.prototype.eachLayer=function(e,r){for(var i=this._zlevelList,n=0;n0?Fl:0),this._needsManuallyCompositing),f.__builtin__||Ld("ZLevel "+u+" has been used by unkown layer "+f.id),f!==a&&(f.__used=!0,f.__startIndex!==l&&(f.__dirty=!0),f.__startIndex=l,f.incremental?f.__drawIndex=-1:f.__drawIndex=l,r(l),a=f),n.__dirty&er&&!n.__inHover&&(f.__dirty=!0,f.incremental&&f.__drawIndex<0&&(f.__drawIndex=l))}r(l),this.eachBuiltinLayer(function(h,v){!h.__used&&h.getElementCount()>0&&(h.__dirty=!0,h.__startIndex=h.__endIndex=h.__drawIndex=0),h.__dirty&&h.__drawIndex<0&&(h.__drawIndex=h.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(e){e.clear()},t.prototype.setBackgroundColor=function(e){this._backgroundColor=e,C(this._layers,function(r){r.setUnpainted()})},t.prototype.configLayer=function(e,r){if(r){var i=this._layerConfig;i[e]?dt(i[e],r,!0):i[e]=r;for(var n=0;n=400?t.onerror&&t.onerror():t.onload&&t.onload(e.response)},t.onerror&&(e.onerror=t.onerror),e.send(null)}const HN={get:UN};var Tc,Ct={};Ct.supportWebGL=function(){if(Tc==null)try{var t=document.createElement("canvas"),e=t.getContext("webgl")||t.getContext("experimental-webgl");if(!e)throw new Error}catch{Tc=!1}return Tc};Ct.Int8Array=typeof Int8Array>"u"?Array:Int8Array;Ct.Uint8Array=typeof Uint8Array>"u"?Array:Uint8Array;Ct.Uint16Array=typeof Uint16Array>"u"?Array:Uint16Array;Ct.Uint32Array=typeof Uint32Array>"u"?Array:Uint32Array;Ct.Int16Array=typeof Int16Array>"u"?Array:Int16Array;Ct.Float32Array=typeof Float32Array>"u"?Array:Float32Array;Ct.Float64Array=typeof Float64Array>"u"?Array:Float64Array;var Un={};typeof window<"u"?Un=window:typeof global<"u"&&(Un=global);Ct.requestAnimationFrame=Un.requestAnimationFrame||Un.msRequestAnimationFrame||Un.mozRequestAnimationFrame||Un.webkitRequestAnimationFrame||function(t){setTimeout(t,16)};Ct.createCanvas=function(){return document.createElement("canvas")};Ct.createImage=function(){return new Un.Image};Ct.request={get:HN.get};Ct.addEventListener=function(t,e,r,i){t.addEventListener(e,r,i)};Ct.removeEventListener=function(t,e,r){t.removeEventListener(e,r)};var pe=function(){this.head=null,this.tail=null,this._length=0};pe.prototype.insert=function(t){var e=new pe.Entry(t);return this.insertEntry(e),e};pe.prototype.insertAt=function(t,e){if(!(t<0)){for(var r=this.head,i=0;r&&i!=t;)r=r.next,i++;if(r){var n=new pe.Entry(e),a=r.prev;a?(a.next=n,n.prev=a):this.head=n,n.next=r,r.prev=n}else this.insert(e)}};pe.prototype.insertBeforeEntry=function(t,e){var r=new pe.Entry(t),i=e.prev;i?(i.next=r,r.prev=i):this.head=r,r.next=e,e.prev=r,this._length++};pe.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._length++};pe.prototype.remove=function(t){var e=t.prev,r=t.next;e?e.next=r:this.head=r,r?r.prev=e:this.tail=e,t.next=t.prev=null,this._length--};pe.prototype.removeAt=function(t){if(!(t<0)){for(var e=this.head,r=0;e&&r!=t;)e=e.next,r++;if(e)return this.remove(e),e.value}};pe.prototype.getHead=function(){if(this.head)return this.head.value};pe.prototype.getTail=function(){if(this.tail)return this.tail.value};pe.prototype.getAt=function(t){if(!(t<0)){for(var e=this.head,r=0;e&&r!=t;)e=e.next,r++;return e.value}};pe.prototype.indexOf=function(t){for(var e=this.head,r=0;e;){if(e.value===t)return r;e=e.next,r++}};pe.prototype.length=function(){return this._length};pe.prototype.isEmpty=function(){return this._length===0};pe.prototype.forEach=function(t,e){for(var r=this.head,i=0,n=typeof e<"u";r;)n?t.call(e,r.value,i):t(r.value,i),r=r.next,i++};pe.prototype.clear=function(){this.tail=this.head=null,this._length=0};pe.Entry=function(t){this.value=t,this.next=null,this.prev=null};var ra=function(t){this._list=new pe,this._map={},this._maxSize=t||10};ra.prototype.setMaxSize=function(t){this._maxSize=t};ra.prototype.put=function(t,e){if(!this._map.hasOwnProperty(t)){var r=this._list.length();if(r>=this._maxSize&&r>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var n=this._list.insert(e);n.key=t,this._map[t]=n}};ra.prototype.get=function(t){var e=this._map[t];if(this._map.hasOwnProperty(t))return e!==this._list.tail&&(this._list.remove(e),this._list.insertEntry(e)),e.value};ra.prototype.remove=function(t){var e=this._map[t];typeof e<"u"&&(delete this._map[t],this._list.remove(e))};ra.prototype.clear=function(){this._list.clear(),this._map={}};var qt={},A_={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Or(t){return t=Math.round(t),t<0?0:t>255?255:t}function VN(t){return t=Math.round(t),t<0?0:t>360?360:t}function Is(t){return t<0?0:t>1?1:t}function Sc(t){return t.length&&t.charAt(t.length-1)==="%"?Or(parseFloat(t)/100*255):Or(parseInt(t,10))}function eo(t){return t.length&&t.charAt(t.length-1)==="%"?Is(parseFloat(t)/100):Is(parseFloat(t))}function wc(t,e,r){return r<0?r+=1:r>1&&(r-=1),r*6<1?t+(e-t)*r*6:r*2<1?e:r*3<2?t+(e-t)*(2/3-r)*6:t}function Hi(t,e,r){return t+(e-t)*r}function Dr(t,e,r,i,n){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t}function sd(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var dw=new ra(20),kl=null;function ma(t,e){kl&&sd(kl,e),kl=dw.put(t,kl||e.slice())}qt.parse=function(t,e){if(t){e=e||[];var r=dw.get(t);if(r)return sd(e,r);t=t+"";var i=t.replace(/ /g,"").toLowerCase();if(i in A_)return sd(e,A_[i]),ma(t,e),e;if(i.charAt(0)==="#"){if(i.length===4){var n=parseInt(i.substr(1),16);if(!(n>=0&&n<=4095)){Dr(e,0,0,0,1);return}return Dr(e,(n&3840)>>4|(n&3840)>>8,n&240|(n&240)>>4,n&15|(n&15)<<4,1),ma(t,e),e}else if(i.length===7){var n=parseInt(i.substr(1),16);if(!(n>=0&&n<=16777215)){Dr(e,0,0,0,1);return}return Dr(e,(n&16711680)>>16,(n&65280)>>8,n&255,1),ma(t,e),e}return}var a=i.indexOf("("),o=i.indexOf(")");if(a!==-1&&o+1===i.length){var s=i.substr(0,a),l=i.substr(a+1,o-(a+1)).split(","),u=1;switch(s){case"rgba":if(l.length!==4){Dr(e,0,0,0,1);return}u=eo(l.pop());case"rgb":if(l.length!==3){Dr(e,0,0,0,1);return}return Dr(e,Sc(l[0]),Sc(l[1]),Sc(l[2]),u),ma(t,e),e;case"hsla":if(l.length!==4){Dr(e,0,0,0,1);return}return l[3]=eo(l[3]),ld(l,e),ma(t,e),e;case"hsl":if(l.length!==3){Dr(e,0,0,0,1);return}return ld(l,e),ma(t,e),e;default:return}}Dr(e,0,0,0,1)}};qt.parseToFloat=function(t,e){if(e=qt.parse(t,e),!!e)return e[0]/=255,e[1]/=255,e[2]/=255,e};function ld(t,e){var r=(parseFloat(t[0])%360+360)%360/360,i=eo(t[1]),n=eo(t[2]),a=n<=.5?n*(i+1):n+i-n*i,o=n*2-a;return e=e||[],Dr(e,Or(wc(o,a,r+1/3)*255),Or(wc(o,a,r)*255),Or(wc(o,a,r-1/3)*255),1),t.length===4&&(e[3]=t[3]),e}function GN(t){if(t){var e=t[0]/255,r=t[1]/255,i=t[2]/255,n=Math.min(e,r,i),a=Math.max(e,r,i),o=a-n,s=(a+n)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(a+n):u=o/(2-a-n);var f=((a-e)/6+o/2)/o,h=((a-r)/6+o/2)/o,v=((a-i)/6+o/2)/o;e===a?l=v-h:r===a?l=1/3+f-v:i===a&&(l=2/3+h-f),l<0&&(l+=1),l>1&&(l-=1)}var c=[l*360,u,s];return t[3]!=null&&c.push(t[3]),c}}qt.lift=function(t,e){var r=qt.parse(t);if(r){for(var i=0;i<3;i++)e<0?r[i]=r[i]*(1-e)|0:r[i]=(255-r[i])*e+r[i]|0;return qt.stringify(r,r.length===4?"rgba":"rgb")}};qt.toHex=function(t){var e=qt.parse(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)};qt.fastLerp=function(t,e,r){if(!(!(e&&e.length)||!(t>=0&&t<=1))){r=r||[];var i=t*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=e[n],s=e[a],l=i-n;return r[0]=Or(Hi(o[0],s[0],l)),r[1]=Or(Hi(o[1],s[1],l)),r[2]=Or(Hi(o[2],s[2],l)),r[3]=Is(Hi(o[3],s[3],l)),r}};qt.fastMapToColor=qt.fastLerp;qt.lerp=function(t,e,r){if(!(!(e&&e.length)||!(t>=0&&t<=1))){var i=t*(e.length-1),n=Math.floor(i),a=Math.ceil(i),o=qt.parse(e[n]),s=qt.parse(e[a]),l=i-n,u=qt.stringify([Or(Hi(o[0],s[0],l)),Or(Hi(o[1],s[1],l)),Or(Hi(o[2],s[2],l)),Is(Hi(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:n,rightIndex:a,value:i}:u}};qt.mapToColor=qt.lerp;qt.modifyHSL=function(t,e,r,i){if(t=qt.parse(t),t)return t=GN(t),e!=null&&(t[0]=VN(e)),r!=null&&(t[1]=eo(r)),i!=null&&(t[2]=eo(i)),qt.stringify(ld(t),"rgba")};qt.modifyAlpha=function(t,e){if(t=qt.parse(t),t&&e!=null)return t[3]=Is(e),qt.stringify(t,"rgba")};qt.stringify=function(t,e){if(!(!t||!t.length)){var r=t[0]+","+t[1]+","+t[2];return(e==="rgba"||e==="hsva"||e==="hsla")&&(r+=","+t[3]),e+"("+r+")"}};var WN=qt.parseToFloat,bc={};function E_(t){var e=Object.keys(t);e.sort();for(var r=[],i=0;i=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(t,e){if(typeof t=="object")for(var r in t){var i=t[r];this.setUniform(r,i)}else this.setUniform(t,e)},get:function(t){var e=this.uniforms[t];if(e)return e.value},attachShader:function(t,e){var r=this.uniforms;this.uniforms=t.createUniforms(),this.shader=t;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter(function(u){var f=this.uniforms[u].type;return f==="t"||f==="tv"},this);var n=this.vertexDefines,a=this.fragmentDefines;if(this.vertexDefines=ne.clone(t.vertexDefines),this.fragmentDefines=ne.clone(t.fragmentDefines),e){for(var o in r)i[o]&&(i[o].value=r[o].value);ne.defaults(this.vertexDefines,n),ne.defaults(this.fragmentDefines,a)}var s={};for(var l in t.textures)s[l]={shaderType:t.textures[l].shaderType,type:t.textures[l].type,enabled:e&&this._textureStatus[l]?this._textureStatus[l].enabled:!1};this._textureStatus=s,this._programKey=""},clone:function(){var t=new this.constructor({name:this.name,shader:this.shader});for(var e in this.uniforms)t.uniforms[e].value=this.uniforms[e].value;return t.depthTest=this.depthTest,t.depthMask=this.depthMask,t.transparent=this.transparent,t.blend=this.blend,t.vertexDefines=ne.clone(this.vertexDefines),t.fragmentDefines=ne.clone(this.fragmentDefines),t.enableTexture(this.getEnabledTextures()),t.precision=this.precision,t},define:function(t,e,r){var i=this.vertexDefines,n=this.fragmentDefines;t!=="vertex"&&t!=="fragment"&&t!=="both"&&arguments.length<3&&(r=e,e=t,t="both"),r=r??null,(t==="vertex"||t==="both")&&i[e]!==r&&(i[e]=r,this._programKey=""),(t==="fragment"||t==="both")&&n[e]!==r&&(n[e]=r,t!=="both"&&(this._programKey=""))},undefine:function(t,e){t!=="vertex"&&t!=="fragment"&&t!=="both"&&arguments.length<2&&(e=t,t="both"),(t==="vertex"||t==="both")&&this.isDefined("vertex",e)&&(delete this.vertexDefines[e],this._programKey=""),(t==="fragment"||t==="both")&&this.isDefined("fragment",e)&&(delete this.fragmentDefines[e],t!=="both"&&(this._programKey=""))},isDefined:function(t,e){switch(t){case"vertex":return this.vertexDefines[e]!==void 0;case"fragment":return this.fragmentDefines[e]!==void 0}},getDefine:function(t,e){switch(t){case"vertex":return this.vertexDefines[e];case"fragment":return this.fragmentDefines[e]}},enableTexture:function(t){if(Array.isArray(t)){for(var e=0;e0&&(n=1/Math.sqrt(n),t[0]=e[0]*n,t[1]=e[1]*n),t};H.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]};H.cross=function(t,e,r){var i=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=i,t};H.lerp=function(t,e,r,i){var n=e[0],a=e[1];return t[0]=n+i*(r[0]-n),t[1]=a+i*(r[1]-a),t};H.random=function(t,e){e=e||1;var r=GLMAT_RANDOM()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t};H.transformMat2=function(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n,t[1]=r[1]*i+r[3]*n,t};H.transformMat2d=function(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n+r[4],t[1]=r[1]*i+r[3]*n+r[5],t};H.transformMat3=function(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[3]*n+r[6],t[1]=r[1]*i+r[4]*n+r[7],t};H.transformMat4=function(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t};H.forEach=function(){var t=H.create();return function(e,r,i,n,a,o){var s,l;for(r||(r=2),i||(i=0),n?l=Math.min(n*r+i,e.length):l=e.length,s=i;s0&&i.push("#define "+n.toUpperCase()+"_COUNT "+a)}if(r)for(var o=0;ol.getMaxJointNumber()&&(v.USE_SKIN_MATRICES_TEXTURE=null),h+=` `+Ec(v)+` `}a&&(h+=` #define INSTANCING `);var c=h+Ec(e.vertexDefines,s,f),d=h+Ec(e.fragmentDefines,s,f),p=c+` `+e.shader.vertex,g=["OES_standard_derivatives","EXT_shader_texture_lod"].filter(function(T){return l.getGLExtension(T)!=null});g.indexOf("EXT_shader_texture_lod")>=0&&(d+=` #define SUPPORT_TEXTURE_LOD`),g.indexOf("OES_standard_derivatives")>=0&&(d+=` #define SUPPORT_STANDARD_DERIVATIVES`);var m=$N(g)+` `+KN(e.precision)+` `+d+` `+e.shader.fragment,_=I_(p,e.vertexDefines,s),y=I_(m,e.fragmentDefines,s),x=new ZN;x.uniformSemantics=e.shader.uniformSemantics,x.attributes=e.shader.attributes;var S=x.buildProgram(u,e.shader,_,y);return x.__error=S,i[o]=x,x};var N_=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g,jN=/attribute\s+(float|int|vec2|vec3|vec4)\s+([\s\S]*?);/g,O_=/#define\s+(\w+)?(\s+[\d-.]+)?\s*;?\s*\n/g,QN={bool:"1i",int:"1i",sampler2D:"t",samplerCube:"t",float:"1f",vec2:"2f",vec3:"3f",vec4:"4f",ivec2:"2i",ivec3:"3i",ivec4:"4i",mat2:"m2",mat3:"m3",mat4:"m4"};function ui(t){for(var e=[],r=0;r=0){if(v!==s&&v!==f){_a();break}v=l,d=[];continue}else if(v===s){t==="bool"?c[p].value=m==="true":c[p].value=parseFloat(m),d=null;continue}else if(v===f){var _=m;ud.indexOf(_)>=0||gw.indexOf(_)>=0||mw.indexOf(_)>=0?c[p].semantic=_:_==="ignore"||_==="unconfigurable"?c[p].ignore=!0:t==="bool"?c[p].value=_==="true":c[p].value=parseFloat(_);continue}g(m),v=o}}return c}function $(t,e){typeof t=="object"&&(e=t.fragment,t=t.vertex),t=F_(t),e=F_(e),this._shaderID=tO(t,e),this._vertexCode=$.parseImport(t),this._fragmentCode=$.parseImport(e),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}$.prototype={constructor:$,createUniforms:function(){var t={};for(var e in this.uniformTemplates){var r=this.uniformTemplates[e];t[e]={type:r.type,value:r.value()}}return t},_parseImport:function(){this._vertexCode=$.parseImport(this.vertex),this._fragmentCode=$.parseImport(this.fragment)},_addSemanticUniform:function(t,e,r){if(ud.indexOf(r)>=0)this.attributeSemantics[r]={symbol:t,type:e};else if(mw.indexOf(r)>=0){var i=!1,n=r;r.match(/TRANSPOSE$/)&&(i=!0,n=r.slice(0,-9)),this.matrixSemantics[r]={symbol:t,type:e,isTranspose:i,semanticNoTranspose:n}}else gw.indexOf(r)>=0&&(this.uniformSemantics[r]={symbol:t,type:e})},_addMaterialUniform:function(t,e,r,i,n,a){a[t]={type:r,value:n?B_.array:i||B_[e],semantic:null}},_parseUniforms:function(){var t={},e=this,r="vertex";this._uniformList=[],this._vertexCode=this._vertexCode.replace(N_,n),r="fragment",this._fragmentCode=this._fragmentCode.replace(N_,n),e.matrixSemanticKeys=Object.keys(this.matrixSemantics);function i(a){return a!=null?function(){return a}:null}function n(a,o,s){var l=k_(o,s),u=[];for(var f in l){var h=l[f],v=h.semantic,c=f,d=QN[o],p=i(l[f].value);l[f].isArray&&(c+="["+l[f].arraySize+"]",d+="v"),u.push(c),e._uniformList.push(f),h.ignore||((o==="sampler2D"||o==="samplerCube")&&(e.textures[f]={shaderType:r,type:o}),v?e._addSemanticUniform(f,d,v):e._addMaterialUniform(f,o,d,p,l[f].isArray,t))}return u.length>0?"uniform "+o+" "+u.join(",")+`; `:""}this.uniformTemplates=t},_parseAttributes:function(){var t={},e=this;this._vertexCode=this._vertexCode.replace(jN,r);function r(i,n,a){var o=k_(n,a),s=JN[n]||1,l=[];for(var u in o){var f=o[u].semantic;if(t[u]={type:"float",size:s,semantic:f||null},f){if(ud.indexOf(f)<0)throw new Error('Unkown semantic "'+f+'"');e.attributeSemantics[f]={symbol:u,type:n}}l.push(u)}return"attribute "+n+" "+l.join(",")+`; `}this.attributes=t},_parseDefines:function(){var t=this,e="vertex";this._vertexCode=this._vertexCode.replace(O_,r),e="fragment",this._fragmentCode=this._fragmentCode.replace(O_,r);function r(i,n,a){var o=e==="vertex"?t.vertexDefines:t.fragmentDefines;return o[n]||(a==="false"?o[n]=!1:a==="true"?o[n]=!0:o[n]=a?isNaN(parseFloat(a))?a.trim():parseFloat(a):null),""}},clone:function(){var t=_w[this._shaderID],e=new $(t.vertex,t.fragment);return e}};Object.defineProperty&&(Object.defineProperty($.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty($.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty($.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty($.prototype,"uniforms",{get:function(){return this._uniformList}}));var eO=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;$.parseImport=function(t){return t=t.replace(eO,function(n,r,i){var n=$.source(i);return n?$.parseImport(n):(console.error('Shader chunk "'+i+'" not existed in library'),"")}),t};var rO=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;$.import=function(t){t.replace(rO,function(e,r,i,a){var a=a.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"");if(a){for(var o=i.split("."),s=$.codes,l=0,u;l 0.0) { if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) { discard; } } gl_FragColor = vec4(0.0,0.0,0.0,1.0); } @end`;var z={};z.create=function(){var t=new xe(16);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};z.clone=function(t){var e=new xe(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e};z.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t};z.identity=function(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};z.transpose=function(t,e){if(t===e){var r=e[1],i=e[2],n=e[3],a=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=a,t[11]=e[14],t[12]=n,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t};z.invert=function(t,e){var r=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],f=e[8],h=e[9],v=e[10],c=e[11],d=e[12],p=e[13],g=e[14],m=e[15],_=r*s-i*o,y=r*l-n*o,x=r*u-a*o,S=i*l-n*s,T=i*u-a*s,w=n*u-a*l,b=f*p-h*d,A=f*g-v*d,M=f*m-c*d,E=h*g-v*p,D=h*m-c*p,R=v*m-c*g,P=_*R-y*D+x*E+S*M-T*A+w*b;return P?(P=1/P,t[0]=(s*R-l*D+u*E)*P,t[1]=(n*D-i*R-a*E)*P,t[2]=(p*w-g*T+m*S)*P,t[3]=(v*T-h*w-c*S)*P,t[4]=(l*M-o*R-u*A)*P,t[5]=(r*R-n*M+a*A)*P,t[6]=(g*x-d*w-m*y)*P,t[7]=(f*w-v*x+c*y)*P,t[8]=(o*D-s*M+u*b)*P,t[9]=(i*M-r*D-a*b)*P,t[10]=(d*T-p*x+m*_)*P,t[11]=(h*x-f*T-c*_)*P,t[12]=(s*A-o*E-l*b)*P,t[13]=(r*E-i*A+n*b)*P,t[14]=(p*y-d*S-g*_)*P,t[15]=(f*S-h*y+v*_)*P,t):null};z.adjoint=function(t,e){var r=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],f=e[8],h=e[9],v=e[10],c=e[11],d=e[12],p=e[13],g=e[14],m=e[15];return t[0]=s*(v*m-c*g)-h*(l*m-u*g)+p*(l*c-u*v),t[1]=-(i*(v*m-c*g)-h*(n*m-a*g)+p*(n*c-a*v)),t[2]=i*(l*m-u*g)-s*(n*m-a*g)+p*(n*u-a*l),t[3]=-(i*(l*c-u*v)-s*(n*c-a*v)+h*(n*u-a*l)),t[4]=-(o*(v*m-c*g)-f*(l*m-u*g)+d*(l*c-u*v)),t[5]=r*(v*m-c*g)-f*(n*m-a*g)+d*(n*c-a*v),t[6]=-(r*(l*m-u*g)-o*(n*m-a*g)+d*(n*u-a*l)),t[7]=r*(l*c-u*v)-o*(n*c-a*v)+f*(n*u-a*l),t[8]=o*(h*m-c*p)-f*(s*m-u*p)+d*(s*c-u*h),t[9]=-(r*(h*m-c*p)-f*(i*m-a*p)+d*(i*c-a*h)),t[10]=r*(s*m-u*p)-o*(i*m-a*p)+d*(i*u-a*s),t[11]=-(r*(s*c-u*h)-o*(i*c-a*h)+f*(i*u-a*s)),t[12]=-(o*(h*g-v*p)-f*(s*g-l*p)+d*(s*v-l*h)),t[13]=r*(h*g-v*p)-f*(i*g-n*p)+d*(i*v-n*h),t[14]=-(r*(s*g-l*p)-o*(i*g-n*p)+d*(i*l-n*s)),t[15]=r*(s*v-l*h)-o*(i*v-n*h)+f*(i*l-n*s),t};z.determinant=function(t){var e=t[0],r=t[1],i=t[2],n=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],f=t[9],h=t[10],v=t[11],c=t[12],d=t[13],p=t[14],g=t[15],m=e*o-r*a,_=e*s-i*a,y=e*l-n*a,x=r*s-i*o,S=r*l-n*o,T=i*l-n*s,w=u*d-f*c,b=u*p-h*c,A=u*g-v*c,M=f*p-h*d,E=f*g-v*d,D=h*g-v*p;return m*D-_*E+y*M+x*A-S*b+T*w};z.multiply=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=e[3],s=e[4],l=e[5],u=e[6],f=e[7],h=e[8],v=e[9],c=e[10],d=e[11],p=e[12],g=e[13],m=e[14],_=e[15],y=r[0],x=r[1],S=r[2],T=r[3];return t[0]=y*i+x*s+S*h+T*p,t[1]=y*n+x*l+S*v+T*g,t[2]=y*a+x*u+S*c+T*m,t[3]=y*o+x*f+S*d+T*_,y=r[4],x=r[5],S=r[6],T=r[7],t[4]=y*i+x*s+S*h+T*p,t[5]=y*n+x*l+S*v+T*g,t[6]=y*a+x*u+S*c+T*m,t[7]=y*o+x*f+S*d+T*_,y=r[8],x=r[9],S=r[10],T=r[11],t[8]=y*i+x*s+S*h+T*p,t[9]=y*n+x*l+S*v+T*g,t[10]=y*a+x*u+S*c+T*m,t[11]=y*o+x*f+S*d+T*_,y=r[12],x=r[13],S=r[14],T=r[15],t[12]=y*i+x*s+S*h+T*p,t[13]=y*n+x*l+S*v+T*g,t[14]=y*a+x*u+S*c+T*m,t[15]=y*o+x*f+S*d+T*_,t};z.multiplyAffine=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=e[4],s=e[5],l=e[6],u=e[8],f=e[9],h=e[10],v=e[12],c=e[13],d=e[14],p=r[0],g=r[1],m=r[2];return t[0]=p*i+g*o+m*u,t[1]=p*n+g*s+m*f,t[2]=p*a+g*l+m*h,p=r[4],g=r[5],m=r[6],t[4]=p*i+g*o+m*u,t[5]=p*n+g*s+m*f,t[6]=p*a+g*l+m*h,p=r[8],g=r[9],m=r[10],t[8]=p*i+g*o+m*u,t[9]=p*n+g*s+m*f,t[10]=p*a+g*l+m*h,p=r[12],g=r[13],m=r[14],t[12]=p*i+g*o+m*u+v,t[13]=p*n+g*s+m*f+c,t[14]=p*a+g*l+m*h+d,t};z.mul=z.multiply;z.mulAffine=z.multiplyAffine;z.translate=function(t,e,r){var i=r[0],n=r[1],a=r[2],o,s,l,u,f,h,v,c,d,p,g,m;return e===t?(t[12]=e[0]*i+e[4]*n+e[8]*a+e[12],t[13]=e[1]*i+e[5]*n+e[9]*a+e[13],t[14]=e[2]*i+e[6]*n+e[10]*a+e[14],t[15]=e[3]*i+e[7]*n+e[11]*a+e[15]):(o=e[0],s=e[1],l=e[2],u=e[3],f=e[4],h=e[5],v=e[6],c=e[7],d=e[8],p=e[9],g=e[10],m=e[11],t[0]=o,t[1]=s,t[2]=l,t[3]=u,t[4]=f,t[5]=h,t[6]=v,t[7]=c,t[8]=d,t[9]=p,t[10]=g,t[11]=m,t[12]=o*i+f*n+d*a+e[12],t[13]=s*i+h*n+p*a+e[13],t[14]=l*i+v*n+g*a+e[14],t[15]=u*i+c*n+m*a+e[15]),t};z.scale=function(t,e,r){var i=r[0],n=r[1],a=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t};z.rotate=function(t,e,r,i){var n=i[0],a=i[1],o=i[2],s=Math.sqrt(n*n+a*a+o*o),l,u,f,h,v,c,d,p,g,m,_,y,x,S,T,w,b,A,M,E,D,R,P,I;return Math.abs(s)0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t};L.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]};L.cross=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=n*l-a*s,t[1]=a*o-i*l,t[2]=i*s-n*o,t};L.lerp=function(t,e,r,i){var n=e[0],a=e[1],o=e[2];return t[0]=n+i*(r[0]-n),t[1]=a+i*(r[1]-a),t[2]=o+i*(r[2]-o),t};L.random=function(t,e){e=e||1;var r=Ua()*2*Math.PI,i=Ua()*2-1,n=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t[2]=i*e,t};L.transformMat4=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,t[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,t[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,t};L.transformMat3=function(t,e,r){var i=e[0],n=e[1],a=e[2];return t[0]=i*r[0]+n*r[3]+a*r[6],t[1]=i*r[1]+n*r[4]+a*r[7],t[2]=i*r[2]+n*r[5]+a*r[8],t};L.transformQuat=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],f=u*i+s*a-l*n,h=u*n+l*i-o*a,v=u*a+o*n-s*i,c=-o*i-s*n-l*a;return t[0]=f*u+c*-o+h*-l-v*-s,t[1]=h*u+c*-s+v*-o-f*-l,t[2]=v*u+c*-l+f*-s-h*-o,t};L.rotateX=function(t,e,r,i){var n=[],a=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t};L.rotateY=function(t,e,r,i){var n=[],a=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t};L.rotateZ=function(t,e,r,i){var n=[],a=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t};L.forEach=function(){var t=L.create();return function(e,r,i,n,a,o){var s,l;for(r||(r=3),i||(i=0),n?l=Math.min(n*r+i,e.length):l=e.length,s=i;s1?0:Math.acos(n)};$.import(yw);var Wt=z.create,z_={};function U_(t){return t.material}function iO(t,e,r){return e.uniforms[r].value}function nO(t,e,r,i){return r!==i}function aO(t){return!0}function H_(){}var V_={float:F.FLOAT,byte:F.BYTE,ubyte:F.UNSIGNED_BYTE,short:F.SHORT,ushort:F.UNSIGNED_SHORT};function oO(t,e,r){this.availableAttributes=t,this.availableAttributeSymbols=e,this.indicesBuffer=r,this.vao=null}function sO(t){var e,r;this.bind=function(i){e||(e=Ct.createCanvas(),e.width=e.height=1,e.getContext("2d"));var n=i.gl,a=!r;a&&(r=n.createTexture()),n.bindTexture(n.TEXTURE_2D,r),a&&n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e)},this.unbind=function(i){i.gl.bindTexture(i.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var yr=Se.extend(function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}},function(){this.canvas||(this.canvas=Ct.createCanvas());var t=this.canvas;try{var e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!this.gl)throw new Error;this._glinfo=new zN(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(r){throw"Error creating WebGL Context "+r}this._programMgr=new pw(this),this._placeholderTexture=new sO},{resize:function(t,e){var r=this.canvas,i=this.devicePixelRatio;t!=null?(r.style&&(r.style.width=t+"px",r.style.height=e+"px"),r.width=t*i,r.height=e*i,this._width=t,this._height=e):(this._width=r.width/i,this._height=r.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var t=this.viewport;return t.width/t.height},setDevicePixelRatio:function(t){this.devicePixelRatio=t,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(t){return this._glinfo.getExtension(t)},getGLParameter:function(t){return this._glinfo.getParameter(t)},setViewport:function(t,e,r,i,n){if(typeof t=="object"){var a=t;t=a.x,e=a.y,r=a.width,i=a.height,n=a.devicePixelRatio}n=n||this.devicePixelRatio,this.gl.viewport(t*n,e*n,r*n,i*n),this.viewport={x:t,y:e,width:r,height:i,devicePixelRatio:n}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var t=this._clearStack.pop();this.clearColor=t.clearColor,this.clearBit=t.clearBit}},bindSceneRendering:function(t){this._sceneRendering=t},render:function(t,e,r,i){var n=this.gl,a=this.clearColor;if(this.clearBit){n.colorMask(!0,!0,!0,!0),n.depthMask(!0);var o=this.viewport,s=!1,l=o.devicePixelRatio;(o.width!==this._width||o.height!==this._height||l&&l!==this.devicePixelRatio||o.x||o.y)&&(s=!0,n.enable(n.SCISSOR_TEST),n.scissor(o.x*l,o.y*l,o.width*l,o.height*l)),n.clearColor(a[0],a[1],a[2],a[3]),n.clear(this.clearBit),s&&n.disable(n.SCISSOR_TEST)}if(r||t.update(!1),t.updateLights(),e=e||t.getMainCamera(),!e){console.error("Can't find camera in the scene.");return}e.update();var u=t.updateRenderList(e,!0);this._sceneRendering=t;var f=u.opaque,h=u.transparent,v=t.material;t.trigger("beforerender",this,t,e,u),i?(this.renderPreZ(f,t,e),n.depthFunc(n.LEQUAL)):n.depthFunc(n.LESS);for(var c=Wt(),d=L.create(),p=0;p0){var s=t[n-1],l=s.joints?s.joints.length:0,u=a.joints?a.joints.length:0;if(u===l&&a.material===s.material&&a.lightGroup===s.lightGroup){a.__program=s.__program;continue}}var f=this._programMgr.getProgram(a,o,e);this.validateProgram(f),a.__program=f}},renderPass:function(t,e,r){this.trigger("beforerenderpass",this,t,e,r),r=r||{},r.getMaterial=r.getMaterial||U_,r.getUniform=r.getUniform||iO,r.isMaterialChanged=r.isMaterialChanged||nO,r.beforeRender=r.beforeRender||H_,r.afterRender=r.afterRender||H_;var i=r.ifRender||aO;this.updatePrograms(t,this._sceneRendering,r),r.sortCompare&&t.sort(r.sortCompare);var n=this.viewport,a=n.devicePixelRatio,o=[n.x*a,n.y*a,n.width*a,n.height*a],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],u=[o[2],o[3]],f=Date.now();e?(z.copy(Gt.VIEW,e.viewMatrix.array),z.copy(Gt.PROJECTION,e.projectionMatrix.array),z.copy(Gt.VIEWINVERSE,e.worldTransform.array)):(z.identity(Gt.VIEW),z.identity(Gt.PROJECTION),z.identity(Gt.VIEWINVERSE)),z.multiply(Gt.VIEWPROJECTION,Gt.PROJECTION,Gt.VIEW),z.invert(Gt.PROJECTIONINVERSE,Gt.PROJECTION),z.invert(Gt.VIEWPROJECTIONINVERSE,Gt.VIEWPROJECTION);for(var h=this.gl,v=this._sceneRendering,c,d,p,g,m,_,y,x,S,T,w,b,A=null,M=0;Mthis.getMaxJointNumber()){var a=n.getSubSkinMatricesTexture(t.__uid__,t.joints);e.useTextureSlot(this,a,r),e.setUniform(i,"1i","skinMatricesTexture",r),e.setUniform(i,"1f","skinMatricesTextureSize",a.width)}else{var o=n.getSubSkinMatrices(t.__uid__,t.joints);e.setUniformOfSemantic(i,"SKIN_MATRIX",o)}},_renderObject:function(t,e,r){var i=this.gl,n=t.geometry,a=t.mode;a==null&&(a=4);var o=null,s=t.isInstancedMesh&&t.isInstancedMesh();if(s&&(o=this.getGLExtension("ANGLE_instanced_arrays"),!o)){console.warn("Device not support ANGLE_instanced_arrays extension");return}var l;if(s&&(l=this._bindInstancedAttributes(t,r,o)),e.indicesBuffer){var u=this.getGLExtension("OES_element_index_uint"),f=u&&n.indices instanceof Uint32Array,h=f?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?o.drawElementsInstancedANGLE(a,e.indicesBuffer.count,h,0,t.getInstanceCount()):i.drawElements(a,e.indicesBuffer.count,h,0)}else s?o.drawArraysInstancedANGLE(a,0,n.vertexCount,t.getInstanceCount()):i.drawArrays(a,0,n.vertexCount);if(s)for(var v=0;vr?r:t}var Ft=Math.atan2,pr=Math.asin,ya=Math.abs;B.eulerFromQuat=function(t,e,v){t._dirty=!0,e=e.array;var i=t.array,n=e[0],a=e[1],o=e[2],s=e[3],l=n*n,u=a*a,f=o*o,h=s*s,v=(v||"XYZ").toUpperCase();switch(v){case"XYZ":i[0]=Ft(2*(n*s-a*o),h-l-u+f),i[1]=pr(dr(2*(n*o+a*s),-1,1)),i[2]=Ft(2*(o*s-n*a),h+l-u-f);break;case"YXZ":i[0]=pr(dr(2*(n*s-a*o),-1,1)),i[1]=Ft(2*(n*o+a*s),h-l-u+f),i[2]=Ft(2*(n*a+o*s),h-l+u-f);break;case"ZXY":i[0]=pr(dr(2*(n*s+a*o),-1,1)),i[1]=Ft(2*(a*s-o*n),h-l-u+f),i[2]=Ft(2*(o*s-n*a),h-l+u-f);break;case"ZYX":i[0]=Ft(2*(n*s+o*a),h-l-u+f),i[1]=pr(dr(2*(a*s-n*o),-1,1)),i[2]=Ft(2*(n*a+o*s),h+l-u-f);break;case"YZX":i[0]=Ft(2*(n*s-o*a),h-l+u-f),i[1]=Ft(2*(a*s-n*o),h+l-u-f),i[2]=pr(dr(2*(n*a+o*s),-1,1));break;case"XZY":i[0]=Ft(2*(n*s+a*o),h-l+u-f),i[1]=Ft(2*(n*o+a*s),h+l-u-f),i[2]=pr(dr(2*(o*s-n*a),-1,1));break;default:console.warn("Unkown order: "+v)}return t};B.eulerFromMat3=function(t,e,d){var i=e.array,n=i[0],a=i[3],o=i[6],s=i[1],l=i[4],u=i[7],f=i[2],h=i[5],v=i[8],c=t.array,d=(d||"XYZ").toUpperCase();switch(d){case"XYZ":c[1]=pr(dr(o,-1,1)),ya(o)<.99999?(c[0]=Ft(-u,v),c[2]=Ft(-a,n)):(c[0]=Ft(h,l),c[2]=0);break;case"YXZ":c[0]=pr(-dr(u,-1,1)),ya(u)<.99999?(c[1]=Ft(o,v),c[2]=Ft(s,l)):(c[1]=Ft(-f,n),c[2]=0);break;case"ZXY":c[0]=pr(dr(h,-1,1)),ya(h)<.99999?(c[1]=Ft(-f,v),c[2]=Ft(-a,l)):(c[1]=0,c[2]=Ft(s,n));break;case"ZYX":c[1]=pr(-dr(f,-1,1)),ya(f)<.99999?(c[0]=Ft(h,v),c[2]=Ft(s,n)):(c[0]=0,c[2]=Ft(-a,l));break;case"YZX":c[2]=pr(dr(s,-1,1)),ya(s)<.99999?(c[0]=Ft(-u,l),c[1]=Ft(-f,n)):(c[0]=0,c[1]=Ft(o,v));break;case"XZY":c[2]=pr(-dr(a,-1,1)),ya(a)<.99999?(c[0]=Ft(h,l),c[1]=Ft(o,n)):(c[0]=Ft(-u,v),c[1]=0);break;default:console.warn("Unkown order: "+d)}return t._dirty=!0,t};Object.defineProperties(B,{POSITIVE_X:{get:function(){return new B(1,0,0)}},NEGATIVE_X:{get:function(){return new B(-1,0,0)}},POSITIVE_Y:{get:function(){return new B(0,1,0)}},NEGATIVE_Y:{get:function(){return new B(0,-1,0)}},POSITIVE_Z:{get:function(){return new B(0,0,1)}},NEGATIVE_Z:{get:function(){return new B(0,0,-1)}},UP:{get:function(){return new B(0,1,0)}},ZERO:{get:function(){return new B}}});var Dc=1e-5,Zn=function(t,e){this.origin=t||new B,this.direction=e||new B};Zn.prototype={constructor:Zn,intersectPlane:function(t,e){var r=t.normal.array,i=t.distance,n=this.origin.array,a=this.direction.array,o=L.dot(r,a);if(o===0)return null;e||(e=new B);var s=(L.dot(r,n)-i)/o;return L.scaleAndAdd(e.array,n,a,-s),e._dirty=!0,e},mirrorAgainstPlane:function(t){var e=L.dot(t.normal.array,this.direction.array);L.scaleAndAdd(this.direction.array,this.direction.array,t.normal.array,-e*2),this.direction._dirty=!0},distanceToPoint:function(){var t=L.create();return function(e){L.sub(t,e,this.origin.array);var r=L.dot(t,this.direction.array);if(r<0)return L.distance(this.origin.array,e);var i=L.lenSquared(t);return Math.sqrt(i-r*r)}}(),intersectSphere:function(){var t=L.create();return function(e,r,i){var n=this.origin.array,a=this.direction.array;e=e.array,L.sub(t,e,n);var o=L.dot(t,a),s=L.squaredLength(t),l=s-o*o,u=r*r;if(!(l>u)){var f=Math.sqrt(u-l),h=o-f,v=o+f;return i||(i=new B),h<0?v<0?null:(L.scaleAndAdd(i.array,n,a,v),i):(L.scaleAndAdd(i.array,n,a,h),i)}}}(),intersectBoundingBox:function(t,e){var r=this.direction.array,i=this.origin.array,n=t.min.array,a=t.max.array,o=1/r[0],s=1/r[1],l=1/r[2],u,f,h,v,c,d;if(o>=0?(u=(n[0]-i[0])*o,f=(a[0]-i[0])*o):(f=(n[0]-i[0])*o,u=(a[0]-i[0])*o),s>=0?(h=(n[1]-i[1])*s,v=(a[1]-i[1])*s):(v=(n[1]-i[1])*s,h=(a[1]-i[1])*s),u>v||h>f||((h>u||u!==u)&&(u=h),(v=0?(c=(n[2]-i[2])*l,d=(a[2]-i[2])*l):(d=(n[2]-i[2])*l,c=(a[2]-i[2])*l),u>d||c>f)||((c>u||u!==u)&&(u=c),(d=0?u:f;return e||(e=new B),L.scaleAndAdd(e.array,i,r,p),e},intersectTriangle:function(){var t=L.create(),e=L.create(),r=L.create(),i=L.create();return function(n,a,o,s,l,u){var f=this.direction.array,h=this.origin.array;n=n.array,a=a.array,o=o.array,L.sub(t,a,n),L.sub(e,o,n),L.cross(i,e,f);var v=L.dot(t,i);if(s){if(v>-Dc)return null}else if(v>-Dc&&v1)return null;L.cross(i,t,r);var d=L.dot(f,i)/v;if(d<0||d>1||c+d>1)return null;L.cross(i,t,e);var p=-L.dot(r,i)/v;return p<0?null:(l||(l=new B),u&&B.set(u,1-c-d,c,d),L.scaleAndAdd(l.array,h,f,p),l)}}(),applyTransform:function(t){B.add(this.direction,this.direction,this.origin),B.transformMat4(this.origin,this.origin,t),B.transformMat4(this.direction,this.direction,t),B.sub(this.direction,this.direction,this.origin),B.normalize(this.direction,this.direction)},copy:function(t){B.copy(this.origin,t.origin),B.copy(this.direction,t.direction)},clone:function(){var t=new Zn;return t.copy(this),t}};var k={};k.create=function(){var t=new xe(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t};k.clone=function(t){var e=new xe(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e};k.fromValues=function(t,e,r,i){var n=new xe(4);return n[0]=t,n[1]=e,n[2]=r,n[3]=i,n};k.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t};k.set=function(t,e,r,i,n){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t};k.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t};k.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t};k.sub=k.subtract;k.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t};k.mul=k.multiply;k.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t};k.div=k.divide;k.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t};k.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t};k.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t};k.scaleAndAdd=function(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t};k.distance=function(t,e){var r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+i*i+n*n+a*a)};k.dist=k.distance;k.squaredDistance=function(t,e){var r=e[0]-t[0],i=e[1]-t[1],n=e[2]-t[2],a=e[3]-t[3];return r*r+i*i+n*n+a*a};k.sqrDist=k.squaredDistance;k.length=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];return Math.sqrt(e*e+r*r+i*i+n*n)};k.len=k.length;k.squaredLength=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];return e*e+r*r+i*i+n*n};k.sqrLen=k.squaredLength;k.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t};k.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t};k.normalize=function(t,e){var r=e[0],i=e[1],n=e[2],a=e[3],o=r*r+i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t[3]=e[3]*o),t};k.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]};k.lerp=function(t,e,r,i){var n=e[0],a=e[1],o=e[2],s=e[3];return t[0]=n+i*(r[0]-n),t[1]=a+i*(r[1]-a),t[2]=o+i*(r[2]-o),t[3]=s+i*(r[3]-s),t};k.random=function(t,e){return e=e||1,t[0]=Ua(),t[1]=Ua(),t[2]=Ua(),t[3]=Ua(),k.normalize(t,t),k.scale(t,t,e),t};k.transformMat4=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,t};k.transformQuat=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],f=u*i+s*a-l*n,h=u*n+l*i-o*a,v=u*a+o*n-s*i,c=-o*i-s*n-l*a;return t[0]=f*u+c*-o+h*-l-v*-s,t[1]=h*u+c*-s+v*-o-f*-l,t[2]=v*u+c*-l+f*-s-h*-o,t};k.forEach=function(){var t=k.create();return function(e,r,i,n,a,o){var s,l;for(r||(r=4),i||(i=0),n?l=Math.min(n*r+i,e.length):l=e.length,s=i;s.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(L.cross(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+o,Z.normalize(i,i))}}();Z.setAxes=function(){var t=it.create();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],Z.normalize(e,Z.fromMat3(e,t))}}();Z.clone=k.clone;Z.fromValues=k.fromValues;Z.copy=k.copy;Z.set=k.set;Z.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t};Z.setAxisAngle=function(t,e,r){r=r*.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t};Z.add=k.add;Z.multiply=function(t,e,r){var i=e[0],n=e[1],a=e[2],o=e[3],s=r[0],l=r[1],u=r[2],f=r[3];return t[0]=i*f+o*s+n*u-a*l,t[1]=n*f+o*l+a*s-i*u,t[2]=a*f+o*u+i*l-n*s,t[3]=o*f-i*s-n*l-a*u,t};Z.mul=Z.multiply;Z.scale=k.scale;Z.rotateX=function(t,e,r){r*=.5;var i=e[0],n=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=i*l+o*s,t[1]=n*l+a*s,t[2]=a*l-n*s,t[3]=o*l-i*s,t};Z.rotateY=function(t,e,r){r*=.5;var i=e[0],n=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=i*l-a*s,t[1]=n*l+o*s,t[2]=a*l+i*s,t[3]=o*l-n*s,t};Z.rotateZ=function(t,e,r){r*=.5;var i=e[0],n=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=i*l+n*s,t[1]=n*l-i*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t};Z.calculateW=function(t,e){var r=e[0],i=e[1],n=e[2];return t[0]=r,t[1]=i,t[2]=n,t[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),t};Z.dot=k.dot;Z.lerp=k.lerp;Z.slerp=function(t,e,r,i){var n=e[0],a=e[1],o=e[2],s=e[3],l=r[0],u=r[1],f=r[2],h=r[3],v,c,d,p,g;return c=n*l+a*u+o*f+s*h,c<0&&(c=-c,l=-l,u=-u,f=-f,h=-h),1-c>1e-6?(v=Math.acos(c),d=Math.sin(v),p=Math.sin((1-i)*v)/d,g=Math.sin(i*v)/d):(p=1-i,g=i),t[0]=p*n+g*l,t[1]=p*a+g*u,t[2]=p*o+g*f,t[3]=p*s+g*h,t};Z.invert=function(t,e){var r=e[0],i=e[1],n=e[2],a=e[3],o=r*r+i*i+n*n+a*a,s=o?1/o:0;return t[0]=-r*s,t[1]=-i*s,t[2]=-n*s,t[3]=a*s,t};Z.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t};Z.length=k.length;Z.len=Z.length;Z.squaredLength=k.squaredLength;Z.sqrLen=Z.squaredLength;Z.normalize=k.normalize;Z.fromMat3=function(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[o*3+o]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+o]-e[o*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[o]=(e[o*3+n]+e[n*3+o])*i}return t};var q=function(){this._axisX=new B,this._axisY=new B,this._axisZ=new B,this.array=z.create(),this._dirty=!0};q.prototype={constructor:q,setArray:function(t){for(var e=0;e0){var e=this.min,r=this.max,i=e.array,n=r.array;Vl(i,t[0]),Vl(n,t[0]);for(var a=1;an[0]&&(n[0]=o[0]),o[1]>n[1]&&(n[1]=o[1]),o[2]>n[2]&&(n[2]=o[2])}e._dirty=!0,r._dirty=!0}},union:function(t){var e=this.min,r=this.max;return L.min(e.array,e.array,t.min.array),L.max(r.array,r.array,t.max.array),e._dirty=!0,r._dirty=!0,this},intersection:function(t){var e=this.min,r=this.max;return L.max(e.array,e.array,t.min.array),L.min(r.array,r.array,t.max.array),e._dirty=!0,r._dirty=!0,this},intersectBoundingBox:function(t){var e=this.min.array,r=this.max.array,i=t.min.array,n=t.max.array;return!(e[0]>n[0]||e[1]>n[1]||e[2]>n[2]||r[0]=n[0]&&r[1]>=n[1]&&r[2]>=n[2]},containPoint:function(t){var e=this.min.array,r=this.max.array,i=t.array;return e[0]<=i[0]&&e[1]<=i[1]&&e[2]<=i[2]&&r[0]>=i[0]&&r[1]>=i[1]&&r[2]>=i[2]},isFinite:function(){var t=this.min.array,e=this.max.array;return isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])},applyTransform:function(t){this.transformFrom(this,t)},transformFrom:function(){var t=L.create(),e=L.create(),r=L.create(),i=L.create(),n=L.create(),a=L.create();return function(o,s){var l=o.min.array,u=o.max.array,f=s.array;return t[0]=f[0]*l[0],t[1]=f[1]*l[0],t[2]=f[2]*l[0],e[0]=f[0]*u[0],e[1]=f[1]*u[0],e[2]=f[2]*u[0],r[0]=f[4]*l[1],r[1]=f[5]*l[1],r[2]=f[6]*l[1],i[0]=f[4]*u[1],i[1]=f[5]*u[1],i[2]=f[6]*u[1],n[0]=f[8]*l[2],n[1]=f[9]*l[2],n[2]=f[10]*l[2],a[0]=f[8]*u[2],a[1]=f[9]*u[2],a[2]=f[10]*u[2],l=this.min.array,u=this.max.array,l[0]=Math.min(t[0],e[0])+Math.min(r[0],i[0])+Math.min(n[0],a[0])+f[12],l[1]=Math.min(t[1],e[1])+Math.min(r[1],i[1])+Math.min(n[1],a[1])+f[13],l[2]=Math.min(t[2],e[2])+Math.min(r[2],i[2])+Math.min(n[2],a[2])+f[14],u[0]=Math.max(t[0],e[0])+Math.max(r[0],i[0])+Math.max(n[0],a[0])+f[12],u[1]=Math.max(t[1],e[1])+Math.max(r[1],i[1])+Math.max(n[1],a[1])+f[13],u[2]=Math.max(t[2],e[2])+Math.max(r[2],i[2])+Math.max(n[2],a[2])+f[14],this.min._dirty=!0,this.max._dirty=!0,this}}(),applyProjection:function(t){var e=this.min.array,r=this.max.array,i=t.array,n=e[0],a=e[1],o=e[2],s=r[0],l=r[1],u=e[2],f=r[0],h=r[1],v=r[2];if(i[15]===1)e[0]=i[0]*n+i[12],e[1]=i[5]*a+i[13],r[2]=i[10]*o+i[14],r[0]=i[0]*f+i[12],r[1]=i[5]*h+i[13],e[2]=i[10]*v+i[14];else{var c=-1/o;e[0]=i[0]*n*c,e[1]=i[5]*a*c,r[2]=(i[10]*o+i[14])*c,c=-1/u,r[0]=i[0]*s*c,r[1]=i[5]*l*c,c=-1/v,e[2]=(i[10]*v+i[14])*c}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var t=this.vertices;if(!t){t=[];for(var e=0;e<8;e++)t[e]=L.fromValues(0,0,0);this.vertices=t}var r=this.min.array,i=this.max.array;return Ii(t[0],r[0],r[1],r[2]),Ii(t[1],r[0],i[1],r[2]),Ii(t[2],i[0],r[1],r[2]),Ii(t[3],i[0],i[1],r[2]),Ii(t[4],r[0],r[1],i[2]),Ii(t[5],r[0],i[1],i[2]),Ii(t[6],i[0],r[1],i[2]),Ii(t[7],i[0],i[1],i[2]),this},copy:function(t){var e=this.min,r=this.max;return Vl(e.array,t.min.array),Vl(r.array,t.max.array),e._dirty=!0,r._dirty=!0,this},clone:function(){var t=new ye;return t.copy(this),t}};var lO=0,ti=Se.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},function(){this.name||(this.name=(this.type||"NODE")+"_"+lO++),this.position||(this.position=new B),this.rotation||(this.rotation=new It),this.scale||(this.scale=new B(1,1,1)),this.worldTransform=new q,this.localTransform=new q,this._children=[]},{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(t){var e=this._scene;if(e){var r=e._nodeRepository;delete r[this.name],r[t]=this}this.name=t},add:function(t){var e=t._parent;if(e!==this){e&&e.remove(t),t._parent=this,this._children.push(t);var r=this._scene;r&&r!==t.scene&&t.traverse(this._addSelfToScene,this),t._needsUpdateWorldTransform=!0}},remove:function(t){var e=this._children,r=e.indexOf(t);r<0||(e.splice(r,1),t._parent=null,this._scene&&t.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var t=this._children,e=0;e0},beforeRender:function(t){},afterRender:function(t,e){},getBoundingBox:function(t,e){return e=ti.prototype.getBoundingBox.call(this,t,e),this.geometry&&this.geometry.boundingBox&&e.union(this.geometry.boundingBox),e},clone:function(){var t=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"];return function(){var e=ti.prototype.clone.call(this);e.geometry=this.geometry,e.material=this.material;for(var r=0;r=0&&S[y]>1e-4&&(L.transformMat4(b,x,m[T[y]]),L.scaleAndAdd(w,w,b,S[y]));A.set(_,w)}}for(var _=0;_>e;return t+1},dispose:function(t){var e=this._cache;e.use(t.__uid__);var r=e.get("webgl_texture");r&&t.gl.deleteTexture(r),e.deleteContext(t.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(W.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}});Object.defineProperty(W.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}});W.BYTE=F.BYTE;W.UNSIGNED_BYTE=F.UNSIGNED_BYTE;W.SHORT=F.SHORT;W.UNSIGNED_SHORT=F.UNSIGNED_SHORT;W.INT=F.INT;W.UNSIGNED_INT=F.UNSIGNED_INT;W.FLOAT=F.FLOAT;W.HALF_FLOAT=36193;W.UNSIGNED_INT_24_8_WEBGL=34042;W.DEPTH_COMPONENT=F.DEPTH_COMPONENT;W.DEPTH_STENCIL=F.DEPTH_STENCIL;W.ALPHA=F.ALPHA;W.RGB=F.RGB;W.RGBA=F.RGBA;W.LUMINANCE=F.LUMINANCE;W.LUMINANCE_ALPHA=F.LUMINANCE_ALPHA;W.SRGB=35904;W.SRGB_ALPHA=35906;W.COMPRESSED_RGB_S3TC_DXT1_EXT=33776;W.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777;W.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778;W.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779;W.NEAREST=F.NEAREST;W.LINEAR=F.LINEAR;W.NEAREST_MIPMAP_NEAREST=F.NEAREST_MIPMAP_NEAREST;W.LINEAR_MIPMAP_NEAREST=F.LINEAR_MIPMAP_NEAREST;W.NEAREST_MIPMAP_LINEAR=F.NEAREST_MIPMAP_LINEAR;W.LINEAR_MIPMAP_LINEAR=F.LINEAR_MIPMAP_LINEAR;W.REPEAT=F.REPEAT;W.CLAMP_TO_EDGE=F.CLAMP_TO_EDGE;W.MIRRORED_REPEAT=F.MIRRORED_REPEAT;var Ve=Ue.extend({skeleton:null,joints:null},function(){this.joints||(this.joints=[])},{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var t=Ue.prototype.clone.call(this);return t.skeleton=this.skeleton,this.joints&&(t.joints=this.joints.slice()),t}});Ve.POINTS=F.POINTS;Ve.LINES=F.LINES;Ve.LINE_LOOP=F.LINE_LOOP;Ve.LINE_STRIP=F.LINE_STRIP;Ve.TRIANGLES=F.TRIANGLES;Ve.TRIANGLE_STRIP=F.TRIANGLE_STRIP;Ve.TRIANGLE_FAN=F.TRIANGLE_FAN;Ve.BACK=F.BACK;Ve.FRONT=F.FRONT;Ve.FRONT_AND_BACK=F.FRONT_AND_BACK;Ve.CW=F.CW;Ve.CCW=F.CCW;var $s={};$s.isPowerOfTwo=function(t){return(t&t-1)===0};$s.nextPowerOfTwo=function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t};$s.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))};var G_=$s.isPowerOfTwo;function W_(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function uO(t,e){var r=W_(t.width),i=W_(t.height);e=e||document.createElement("canvas"),e.width=r,e.height=i;var n=e.getContext("2d");return n.drawImage(t.image,0,0,r,i),e}var At=W.extend(function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}},{textureType:"texture2D",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(t);var r=this.format,i=this.type,n=!!(this.convertToPOT&&!this.mipmaps.length&&this.image&&(this.wrapS===W.REPEAT||this.wrapT===W.REPEAT)&&this.NPOT);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,n?this.wrapS:this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,n?this.wrapT:this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,n?this.magFilter:this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n?this.minFilter:this.getAvailableMinFilter());var a=t.getGLExtension("EXT_texture_filter_anisotropic");if(a&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_2D,a.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),i===36193){var o=t.getGLExtension("OES_texture_half_float");o||(i=F.FLOAT)}if(this.mipmaps.length)for(var s=this.width,l=this.height,u=0;u=W.COMPRESSED_RGB_S3TC_DXT1_EXT?t.compressedTexImage2D(t.TEXTURE_2D,r,a,i,n,0,e.pixels):t.texImage2D(t.TEXTURE_2D,r,a,i,n,0,a,o,e.pixels)},generateMipmap:function(t){var e=t.gl;this.useMipmap&&!this.NPOT&&(e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),e.generateMipmap(e.TEXTURE_2D))},isPowerOfTwo:function(){return G_(this.width)&&G_(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!!(this.width&&this.height)},bind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,this.getWebGLTexture(t))},unbind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},load:function(t,e){var r=Ct.createImage();e&&(r.crossOrigin=e);var i=this;return r.onload=function(){i.dirty(),i.trigger("success",i)},r.onerror=function(){i.trigger("error",i)},r.src=t,this.image=r,this}});Object.defineProperty(At.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(t){this.image?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}});Object.defineProperty(At.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(t){this.image?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});function xw(t){return{byte:Ct.Int8Array,ubyte:Ct.Uint8Array,short:Ct.Int16Array,ushort:Ct.Uint16Array}[t]||Ct.Float32Array}function Rc(t){return"attr_"+t}function io(t,e,r,i){switch(this.name=t,this.type=e,this.size=r,this.semantic=i||"",this.value=null,r){case 1:this.get=function(n){return this.value[n]},this.set=function(n,a){this.value[n]=a},this.copy=function(n,a){this.value[n]=this.value[n]};break;case 2:this.get=function(n,a){var o=this.value;return a[0]=o[n*2],a[1]=o[n*2+1],a},this.set=function(n,a){var o=this.value;o[n*2]=a[0],o[n*2+1]=a[1]},this.copy=function(n,a){var o=this.value;a*=2,n*=2,o[n]=o[a],o[n+1]=o[a+1]};break;case 3:this.get=function(n,a){var o=n*3,s=this.value;return a[0]=s[o],a[1]=s[o+1],a[2]=s[o+2],a},this.set=function(n,a){var o=n*3,s=this.value;s[o]=a[0],s[o+1]=a[1],s[o+2]=a[2]},this.copy=function(n,a){var o=this.value;a*=3,n*=3,o[n]=o[a],o[n+1]=o[a+1],o[n+2]=o[a+2]};break;case 4:this.get=function(n,a){var o=this.value,s=n*4;return a[0]=o[s],a[1]=o[s+1],a[2]=o[s+2],a[3]=o[s+3],a},this.set=function(n,a){var o=this.value,s=n*4;o[s]=a[0],o[s+1]=a[1],o[s+2]=a[2],o[s+3]=a[3]},this.copy=function(n,a){var o=this.value;a*=4,n*=4,o[n]=o[a],o[n+1]=o[a+1],o[n+2]=o[a+2],o[n+3]=o[a+3]}}}io.prototype.init=function(t){if(!this.value||this.value.length!==t*this.size){var e=xw(this.type);this.value=new e(t*this.size)}};io.prototype.fromArray=function(t){var e=xw(this.type),r;if(t[0]&&t[0].length){var i=0,n=this.size;r=new e(t.length*n);for(var a=0;a=0){e||(e=[]);var r=this.indices;return e[0]=r[t*3],e[1]=r[t*3+1],e[2]=r[t*3+2],e}},setTriangleIndices:function(t,e){var r=this.indices;r[t*3]=e[0],r[t*3+1]=e[1],r[t*3+2]=e[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(t){var e,r=this.vertexCount>65535?Ct.Uint32Array:Ct.Uint16Array;if(t[0]&&t[0].length){var i=0,n=3;e=new r(t.length*n);for(var a=0;a=0?(e.splice(r,1),delete this.attributes[t],!0):!1},getAttribute:function(t){return this.attributes[t]},getEnabledAttributes:function(){var t=this._enabledAttributes,e=this._attributeList;if(t)return t;for(var r=[],i=this.vertexCount,n=0;na[0]&&(a[0]=s),l>a[1]&&(a[1]=l),u>a[2]&&(a[2]=u)}r._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var t=this.indices,e=this.attributes,r=e.position.value,i=e.normal.value;if(!i||i.length!==r.length)i=e.normal.value=new Ct.Float32Array(r.length);else for(var n=0;n65535&&(this.indices=new Ct.Uint32Array(this.indices));for(var t=this.attributes,e=this.indices,r=this.getEnabledAttributes(),i={},n=0;nthis.distance,n=1;n<8;n++)if(L.dot(e[n].array,r)>this.distance!=i)return!0},intersectLine:function(){var t=L.create();return function(e,r,i){var n=this.distanceToPoint(e),a=this.distanceToPoint(r);if(n>0&&a>0||n<0&&a<0)return null;var o=this.normal.array,s=this.distance,l=e.array;L.sub(t,r.array,e.array),L.normalize(t,t);var u=L.dot(o,t);if(u===0)return null;i||(i=new B);var f=(L.dot(o,l)-s)/u;return L.scaleAndAdd(i.array,l,t,-f),i._dirty=!0,i}}(),applyTransform:function(){var t=z.create(),e=k.create(),r=k.create();return r[3]=1,function(i){i=i.array,L.scale(r,this.normal.array,this.distance),k.transformMat4(r,r,i),this.distance=L.dot(r,this.normal.array),z.invert(t,i),z.transpose(t,t),e[3]=0,L.copy(e,this.normal.array),k.transformMat4(e,e,t),L.copy(this.normal.array,e)}}(),copy:function(t){L.copy(this.normal.array,t.normal.array),this.normal._dirty=!0,this.distance=t.distance},clone:function(){var t=new ps;return t.copy(this),t}};var ie=L.set,X_=L.copy,Y_=L.transformMat4,Pc=Math.min,Ic=Math.max,Wf=function(){this.planes=[];for(var t=0;t<6;t++)this.planes.push(new ps);this.boundingBox=new ye,this.vertices=[];for(var t=0;t<8;t++)this.vertices[t]=L.fromValues(0,0,0)};Wf.prototype={setFromProjection:function(t){var e=this.planes,r=t.array,i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],l=r[5],u=r[6],f=r[7],h=r[8],v=r[9],c=r[10],d=r[11],p=r[12],g=r[13],m=r[14],_=r[15];ie(e[0].normal.array,o-i,f-s,d-h),e[0].distance=-(_-p),e[0].normalize(),ie(e[1].normal.array,o+i,f+s,d+h),e[1].distance=-(_+p),e[1].normalize(),ie(e[2].normal.array,o+n,f+l,d+v),e[2].distance=-(_+g),e[2].normalize(),ie(e[3].normal.array,o-n,f-l,d-v),e[3].distance=-(_-g),e[3].normalize(),ie(e[4].normal.array,o-a,f-u,d-c),e[4].distance=-(_-m),e[4].normalize(),ie(e[5].normal.array,o+a,f+u,d+c),e[5].distance=-(_+m),e[5].normalize();var y=this.boundingBox,x=this.vertices;if(_===0){var S=l/i,T=-m/(c-1),w=-m/(c+1),b=-w/l,A=-T/l;y.min.set(-b*S,-b,w),y.max.set(b*S,b,T),ie(x[0],-b*S,-b,w),ie(x[1],-b*S,b,w),ie(x[2],b*S,-b,w),ie(x[3],b*S,b,w),ie(x[4],-A*S,-A,T),ie(x[5],-A*S,A,T),ie(x[6],A*S,-A,T),ie(x[7],A*S,A,T)}else{var M=(-1-p)/i,E=(1-p)/i,D=(1-g)/l,R=(-1-g)/l,P=(-1-m)/c,I=(1-m)/c;y.min.set(Math.min(M,E),Math.min(R,D),Math.min(I,P)),y.max.set(Math.max(E,M),Math.max(D,R),Math.max(P,I));var N=y.min.array,V=y.max.array;ie(x[0],N[0],N[1],N[2]),ie(x[1],N[0],V[1],N[2]),ie(x[2],V[0],N[1],N[2]),ie(x[3],V[0],V[1],N[2]),ie(x[4],N[0],N[1],V[2]),ie(x[5],N[0],V[1],V[2]),ie(x[6],V[0],N[1],V[2]),ie(x[7],V[0],V[1],V[2])}},getTransformedBoundingBox:function(){var t=L.create();return function(e,r){var i=this.vertices,n=r.array,a=e.min,o=e.max,s=a.array,l=o.array,u=i[0];Y_(t,u,n),X_(s,t),X_(l,t);for(var f=1;f<8;f++)u=i[f],Y_(t,u,n),s[0]=Pc(t[0],s[0]),s[1]=Pc(t[1],s[1]),s[2]=Pc(t[2],s[2]),l[0]=Ic(t[0],l[0]),l[1]=Ic(t[1],l[1]),l[2]=Ic(t[2],l[2]);return a._dirty=!0,o._dirty=!0,e}}()};var no=ti.extend(function(){return{projectionMatrix:new q,invProjectionMatrix:new q,viewMatrix:new q,frustum:new Wf}},function(){this.update(!0)},{update:function(t){ti.prototype.update.call(this,t),q.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),q.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(t){q.copy(this.viewMatrix,t),q.invert(this.worldTransform,t),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(t){q.copy(this.projectionMatrix,t),q.invert(this.invProjectionMatrix,t),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:function(){var t=k.create();return function(e,r){var i=r!==void 0?r:new Zn,n=e.array[0],a=e.array[1];return k.set(t,n,a,-1,1),k.transformMat4(t,t,this.invProjectionMatrix.array),k.transformMat4(t,t,this.worldTransform.array),L.scale(i.origin.array,t,1/t[3]),k.set(t,n,a,1,1),k.transformMat4(t,t,this.invProjectionMatrix.array),k.transformMat4(t,t,this.worldTransform.array),L.scale(t,t,1/t[3]),L.sub(i.direction.array,t,i.origin.array),L.normalize(i.direction.array,i.direction.array),i.direction._dirty=!0,i.origin._dirty=!0,i}}()}),cO=z.create(),Z_=z.create(),Nc={};function vO(t){var e=[],r=Object.keys(t);r.sort();for(var i=0;i0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(t)):t instanceof Fr&&this.lights.push(t),t.name&&(this._nodeRepository[t.name]=t)},removeFromScene:function(t){var e;t instanceof no?(e=this._cameraList.indexOf(t),e>=0&&this._cameraList.splice(e,1)):t instanceof Fr&&(e=this.lights.indexOf(t),e>=0&&this.lights.splice(e,1)),t.name&&delete this._nodeRepository[t.name]},getNode:function(t){return this._nodeRepository[t]},setMainCamera:function(t){var e=this._cameraList.indexOf(t);e>=0&&this._cameraList.splice(e,1),this._cameraList.unshift(t)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var t=this.lights;this._previousLightNumber=this._lightNumber;for(var e={},r=0;r0&&this._doUpdateRenderList(o,e,r,i,n)}},isFrustumCulled:function(){var t=new ye,e=new q;return function(r,i,n){var a=r.boundingBox;if(a||(r.skeleton&&r.skeleton.boundingBox?a=r.skeleton.boundingBox:a=r.geometry.boundingBox),!a)return!1;if(e.array=n,t.transformFrom(a,e),r.castShadow&&this.viewBoundingBoxLastFrame.union(t),r.frustumCulling){if(!t.intersectBoundingBox(i.frustum.boundingBox))return!0;e.array=i.projectionMatrix.array,t.max.array[2]>0&&t.min.array[2]<0&&(t.max.array[2]=-1e-20),t.applyProjection(e);var o=t.min.array,s=t.max.array;if(s[0]<-1||o[0]>1||s[1]<-1||o[1]>1||s[2]<-1||o[2]>1)return!0}return!1}}(),_updateLightUniforms:function(){var t=this.lights;t.sort(dO);var e=this._lightUniforms;for(var r in e)for(var i in e[r])e[r][i].value.length=0;for(var n=0;n1&&e.texParameterf(e.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),i===36193){var a=t.getGLExtension("OES_texture_half_float");a||(i=F.FLOAT)}if(this.mipmaps.length)for(var o=this.width,s=this.height,l=0;l0&&t.height>0}var ve=no.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var t=this.fov/180*Math.PI;this.projectionMatrix.perspective(t,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array,e=Math.atan(1/t[5])*2;this.fov=e/Math.PI*180,this.aspect=t[5]/t[0],this.near=t[14]/(t[10]-1),this.far=t[14]/(t[10]+1)},clone:function(){var t=no.prototype.clone.call(this);return t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t}}),Wl="framebuffer",hi="renderbuffer",q_=hi+"_width",$_=hi+"_height",Oc=hi+"_attached",Bc="depthtexture_attached",bn=F.FRAMEBUFFER,zo=F.RENDERBUFFER,Jo=F.DEPTH_ATTACHMENT,ww=F.COLOR_ATTACHMENT0,he=Se.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},function(){this._cache=new ro,this._textures={}},{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(t){if(t.__currentFrameBuffer){if(t.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}t.__currentFrameBuffer=this;var e=t.gl;e.bindFramebuffer(bn,this._getFrameBufferGL(t)),this._boundRenderer=t;var r=this._cache;r.put("viewport",t.viewport);var i=!1,n,a;for(var o in this._textures){i=!0;var s=this._textures[o];s&&(n=s.texture.width,a=s.texture.height,this._doAttach(t,s.texture,o,s.target))}this._width=n,this._height=a,!i&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?t.setViewport(this.viewport):t.setViewport(0,0,n,a,1);var l=r.get("attached_textures");if(l){for(var o in l)if(!this._textures[o]){var u=l[o];this._doDetach(e,o,u)}}if(!r.get(Bc)&&this.depthBuffer){r.miss(hi)&&r.put(hi,e.createRenderbuffer());var f=r.get(hi);(n!==r.get(q_)||a!==r.get($_))&&(e.bindRenderbuffer(zo,f),e.renderbufferStorage(zo,e.DEPTH_COMPONENT16,n,a),r.put(q_,n),r.put($_,a),e.bindRenderbuffer(zo,null)),r.get(Oc)||(e.framebufferRenderbuffer(bn,Jo,zo,f),r.put(Oc,!0))}},unbind:function(t){t.__currentFrameBuffer=null;var e=t.gl;e.bindFramebuffer(bn,null),this._boundRenderer=null,this._cache.use(t.__uid__);var r=this._cache.get("viewport");r&&t.setViewport(r),this.updateMipmap(t)},updateMipmap:function(t){var e=t.gl;for(var r in this._textures){var i=this._textures[r];if(i){var n=i.texture;if(!n.NPOT&&n.useMipmap&&n.minFilter===W.LINEAR_MIPMAP_LINEAR){var a=n.textureType==="textureCube"?F.TEXTURE_CUBE_MAP:F.TEXTURE_2D;e.bindTexture(a,n.getWebGLTexture(t)),e.generateMipmap(a),e.bindTexture(a,null)}}}},checkStatus:function(t){return t.checkFramebufferStatus(bn)},_getFrameBufferGL:function(t){var e=this._cache;return e.use(t.__uid__),e.miss(Wl)&&e.put(Wl,t.gl.createFramebuffer()),e.get(Wl)},attach:function(t,e,r){if(!t.width)throw new Error("The texture attached to color buffer is not a valid.");e=e||ww,r=r||F.TEXTURE_2D;var i=this._boundRenderer,n=i&&i.gl,a;if(n){var o=this._cache;o.use(i.__uid__),a=o.get("attached_textures")}var s=this._textures[e];if(!(s&&s.target===r&&s.texture===t&&a&&a[e]!=null)){var l=!0;i&&(l=this._doAttach(i,t,e,r),this.viewport||i.setViewport(0,0,t.width,t.height,1)),l&&(this._textures[e]=this._textures[e]||{},this._textures[e].texture=t,this._textures[e].target=r)}},_doAttach:function(t,e,r,i){var n=t.gl,a=e.getWebGLTexture(t),o=this._cache.get("attached_textures");if(o&&o[r]){var s=o[r];if(s.texture===e&&s.target===i)return}r=+r;var l=!0;if(r===Jo||r===F.DEPTH_STENCIL_ATTACHMENT){var u=t.getGLExtension("WEBGL_depth_texture");if(u||(console.error("Depth texture is not supported by the browser"),l=!1),e.format!==F.DEPTH_COMPONENT&&e.format!==F.DEPTH_STENCIL&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l){var f=this._cache.get(hi);f&&(n.framebufferRenderbuffer(bn,Jo,zo,null),n.deleteRenderbuffer(f),this._cache.put(hi,!1)),this._cache.put(Oc,!1),this._cache.put(Bc,!0)}}return n.framebufferTexture2D(bn,r,i,a,0),o||(o={},this._cache.put("attached_textures",o)),o[r]=o[r]||{},o[r].texture=e,o[r].target=i,l},_doDetach:function(t,e,r){t.framebufferTexture2D(bn,e,r,null,0);var i=this._cache.get("attached_textures");i&&i[e]&&(i[e]=null),(e===Jo||e===F.DEPTH_STENCIL_ATTACHMENT)&&this._cache.put(Bc,!1)},detach:function(t,e){if(this._textures[t]=null,this._boundRenderer){var r=this._cache;r.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,t,e)}},dispose:function(t){var e=t.gl,r=this._cache;r.use(t.__uid__);var i=r.get(hi);i&&e.deleteRenderbuffer(i);var n=r.get(Wl);n&&e.deleteFramebuffer(n),r.deleteContext(t.__uid__),this._textures={}}});he.DEPTH_ATTACHMENT=Jo;he.COLOR_ATTACHMENT0=ww;he.STENCIL_ATTACHMENT=F.STENCIL_ATTACHMENT;he.DEPTH_STENCIL_ATTACHMENT=F.DEPTH_STENCIL_ATTACHMENT;var gO=["px","nx","py","ny","pz","nz"],Hp=Se.extend(function(){var t={position:new B,far:1e3,near:.1,texture:null,shadowMapPass:null},e=t._cameras={px:new ve({fov:90}),nx:new ve({fov:90}),py:new ve({fov:90}),ny:new ve({fov:90}),pz:new ve({fov:90}),nz:new ve({fov:90})};return e.px.lookAt(B.POSITIVE_X,B.NEGATIVE_Y),e.nx.lookAt(B.NEGATIVE_X,B.NEGATIVE_Y),e.py.lookAt(B.POSITIVE_Y,B.POSITIVE_Z),e.ny.lookAt(B.NEGATIVE_Y,B.NEGATIVE_Z),e.pz.lookAt(B.POSITIVE_Z,B.NEGATIVE_Y),e.nz.lookAt(B.NEGATIVE_Z,B.NEGATIVE_Y),t._frameBuffer=new he,t},{getCamera:function(t){return this._cameras[t]},render:function(t,e,r){var i=t.gl;r||e.update();for(var n=this.texture.width,a=2*Math.atan(n/(n-.5))/Math.PI*180,o=0;o<6;o++){var s=gO[o],l=this._cameras[s];if(B.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=a,this.shadowMapPass){l.update();var u=e.getBoundingBox();u.applyTransform(l.viewMatrix),e.viewBoundingBoxLastFrame.copy(u),this.shadowMapPass.render(t,e,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._frameBuffer.bind(t),t.render(e,l,!0),this._frameBuffer.unbind(t)}},dispose:function(t){this._frameBuffer.dispose(t)}}),Vp=Ut.extend({dynamic:!1,widthSegments:1,heightSegments:1},function(){this.build()},{build:function(){for(var t=this.heightSegments,e=this.widthSegments,r=this.attributes,i=[],n=[],a=[],o=[],s=0;s<=t;s++)for(var l=s/t,u=0;u<=e;u++){var f=u/e;if(i.push([2*f-1,2*l-1,0]),n&&n.push([f,l]),a&&a.push([0,0,1]),u0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),t.renderPass([this],r)}}),_O=542327876,yO=131072,xO=512,TO=4;function Gp(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}var SO=31,wO=Gp("DXT1"),bO=Gp("DXT3"),AO=Gp("DXT5"),EO=0,MO=1,CO=2,DO=3,LO=4,RO=7,PO=20,IO=21,NO=28,OO={parse:function(t,e){var r=new Int32Array(t,0,SO);if(r[EO]!==_O||!r(PO)&TO)return null;var i=r(IO),n=r[LO],a=r[DO],o=r[NO]&xO,s=r[CO]&yO,l,u;switch(i){case wO:l=8,u=W.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case bO:l=16,u=W.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case AO:l=16,u=W.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var f=r[MO]+4,h=o?6:1,v=1;s&&(v=Math.max(1,r[RO]));for(var c=[],d=0;d0){var n=Math.pow(2,t[3]-128-8+i);e[r+0]=t[0]*n,e[r+1]=t[1]*n,e[r+2]=t[2]*n}else e[r+0]=0,e[r+1]=0,e[r+2]=0;return e[r+3]=1,e}function zO(t,e,r){for(var i="",n=e;n0;)if(t[a][0]=e[r++],t[a][1]=e[r++],t[a][2]=e[r++],t[a][3]=e[r++],t[a][0]===1&&t[a][1]===1&&t[a][2]===1){for(var s=t[a][3]<>>0;s>0;s--)UO(t[a-1],t[a]),a++,o--;n+=8}else a++,o--,n=0;return r}function HO(t,e,r,i){if(iFO)return K_(t,e,r,i);var n=e[r++];if(n!=2)return K_(t,e,r-1,i);if(t[0][1]=e[r++],t[0][2]=e[r++],n=e[r++],(t[0][2]<<8>>>0|n)>>>0!==i)return null;for(var n=0;n<4;n++)for(var a=0;a128){o=(o&127)>>>0;for(var s=e[r++];o--;)t[a++][n]=s}else for(;o--;)t[a++][n]=e[r++]}return r}var VO={parseRGBE:function(t,e,r){r==null&&(r=0);var i=new Uint8Array(t),n=i.length;if(zO(i,0,2)==="#?"){for(var a=2;a=n)){a+=2;for(var o="";a20)return console.warn("Given image is not a height map"),t}var c,d,p,g;l%(i*4)===0?(c=o.data[l],p=o.data[l+4]):l%(i*4)===(i-1)*4?(c=o.data[l-4],p=o.data[l]):(c=o.data[l-4],p=o.data[l+4]),li*(n-1)*4?(d=o.data[l-i*4],g=o.data[l]):(d=o.data[l-i*4],g=o.data[l+i*4]),s.data[l]=c-p+127,s.data[l+1]=d-g+127,s.data[l+2]=255,s.data[l+3]=255}return a.putImageData(s,0,0),r},isHeightImage:function(t,e,r){if(!t||!t.width||!t.height)return!1;var i=document.createElement("canvas"),n=i.getContext("2d"),a=e||32;r=r||20,i.width=i.height=a,n.drawImage(t,0,0,a,a);for(var o=n.getImageData(0,0,a,a),s=0;sr)return!1}return!0},_fetchTexture:function(t,e,r){Ct.request.get({url:t,responseType:"arraybuffer",onload:e,onerror:r})},createChessboard:function(t,e,r,i){t=t||512,e=e||64,r=r||"black",i=i||"white";var n=Math.ceil(t/e),a=document.createElement("canvas");a.width=t,a.height=t;var o=a.getContext("2d");o.fillStyle=i,o.fillRect(0,0,t,t),o.fillStyle=r;for(var s=0;s=0||(fd.forEach(function(e){t.on(e,this[hd(e)],this)},this),this._meshes.push(t))},detachFromMesh:function(t){var e=this._meshes.indexOf(t);e>=0&&this._meshes.splice(e,1),fd.forEach(function(r){t.off(r,this[hd(r)])},this)},dispose:function(){this._meshes.forEach(function(t){this.detachFromMesh(t)},this)}};var Os=no.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array;this.left=(-1-t[12])/t[0],this.right=(1-t[12])/t[0],this.top=(1-t[13])/t[5],this.bottom=(-1-t[13])/t[5],this.near=-(-1-t[14])/t[10],this.far=-(1-t[14])/t[10]},clone:function(){var t=no.prototype.clone.call(this);return t.left=this.left,t.right=this.right,t.near=this.near,t.far=this.far,t.top=this.top,t.bottom=this.bottom,t}});const GO=` @export clay.compositor.vertex uniform mat4 worldViewProjection : WORLDVIEWPROJECTION; attribute vec3 position : POSITION; attribute vec2 texcoord : TEXCOORD_0; varying vec2 v_Texcoord; void main() { v_Texcoord = texcoord; gl_Position = worldViewProjection * vec4(position, 1.0); } @end`;$.import(GO);var WO=new Vp,j_=new Ve({geometry:WO,frustumCulling:!1}),XO=new Os,Oe=Se.extend(function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}},function(){var t=new $($.source("clay.compositor.vertex"),this.fragment),e=new Si({shader:t});e.enableTexturesAll(),this.material=e},{setUniform:function(t,e){this.material.setUniform(t,e)},getUniform:function(t){var e=this.material.uniforms[t];if(e)return e.value},attachOutput:function(t,e){this.outputs||(this.outputs={}),e=e||F.COLOR_ATTACHMENT0,this.outputs[e]=t},detachOutput:function(t){for(var e in this.outputs)this.outputs[e]===t&&(this.outputs[e]=null)},bind:function(t,e){if(this.outputs)for(var r in this.outputs){var i=this.outputs[r];i&&e.attach(i,r)}e&&e.bind(t)},unbind:function(t,e){e.unbind(t)},render:function(t,e){var r=t.gl;if(e){this.bind(t,e);var i=t.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var n=[];for(var a in this.outputs)a=+a,a>=r.COLOR_ATTACHMENT0&&a<=r.COLOR_ATTACHMENT0+8&&n.push(a);i.drawBuffersEXT(n)}}this.trigger("beforerender",this,t);var o=this.clearDepth?r.DEPTH_BUFFER_BIT:0;if(r.depthMask(!0),this.clearColor){o=o|r.COLOR_BUFFER_BIT,r.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&r.clearColor(s[0],s[1],s[2],s[3])}r.clear(o),this.blendWithPrevious?(r.enable(r.BLEND),this.material.transparent=!0):(r.disable(r.BLEND),this.material.transparent=!1),this.renderQuad(t),this.trigger("afterrender",this,t),e&&this.unbind(t,e)},renderQuad:function(t){j_.material=this.material,t.renderPass([j_],XO)},dispose:function(t){}});const YO=`#define SAMPLE_NUMBER 1024 #define PI 3.14159265358979 uniform sampler2D normalDistribution; uniform vec2 viewportSize : [512, 256]; const vec3 N = vec3(0.0, 0.0, 1.0); const float fSampleNumber = float(SAMPLE_NUMBER); vec3 importanceSampleNormal(float i, float roughness, vec3 N) { vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb; vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0); vec3 tangentX = normalize(cross(N, upVector)); vec3 tangentZ = cross(N, tangentX); return normalize(tangentX * H.x + N * H.y + tangentZ * H.z); } float G_Smith(float roughness, float NoV, float NoL) { float k = roughness * roughness / 2.0; float G1V = NoV / (NoV * (1.0 - k) + k); float G1L = NoL / (NoL * (1.0 - k) + k); return G1L * G1V; } void main() { vec2 uv = gl_FragCoord.xy / viewportSize; float NoV = uv.x; float roughness = uv.y; vec3 V; V.x = sqrt(1.0 - NoV * NoV); V.y = 0.0; V.z = NoV; float A = 0.0; float B = 0.0; for (int i = 0; i < SAMPLE_NUMBER; i++) { vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N); vec3 L = reflect(-V, H); float NoL = clamp(L.z, 0.0, 1.0); float NoH = clamp(H.z, 0.0, 1.0); float VoH = clamp(dot(V, H), 0.0, 1.0); if (NoL > 0.0) { float G = G_Smith(roughness, NoV, NoL); float G_Vis = G * VoH / (NoH * NoV); float Fc = pow(1.0 - VoH, 5.0); A += (1.0 - Fc) * G_Vis; B += Fc * G_Vis; } } gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0); } `,ZO=`#define SHADER_NAME prefilter #define SAMPLE_NUMBER 1024 #define PI 3.14159265358979 uniform mat4 viewInverse : VIEWINVERSE; uniform samplerCube environmentMap; uniform sampler2D normalDistribution; uniform float roughness : 0.5; varying vec2 v_Texcoord; varying vec3 v_WorldPosition; @import clay.util.rgbm vec3 importanceSampleNormal(float i, float roughness, vec3 N) { vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb; vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0); vec3 tangentX = normalize(cross(N, upVector)); vec3 tangentZ = cross(N, tangentX); return normalize(tangentX * H.x + N * H.y + tangentZ * H.z); } void main() { vec3 eyePos = viewInverse[3].xyz; vec3 V = normalize(v_WorldPosition - eyePos); vec3 N = V; vec3 prefilteredColor = vec3(0.0); float totalWeight = 0.0; float fMaxSampleNumber = float(SAMPLE_NUMBER); for (int i = 0; i < SAMPLE_NUMBER; i++) { vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N); vec3 L = reflect(-V, H); float NoL = clamp(dot(N, L), 0.0, 1.0); if (NoL > 0.0) { prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL; totalWeight += NoL; } } gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0)); } `;var ri={},Fc=["px","nx","py","ny","pz","nz"];ri.prefilterEnvironmentMap=function(t,e,r,i,n){(!n||!i)&&(i=ri.generateNormalDistribution(),n=ri.integrateBRDF(t,i)),r=r||{};var a=r.width||64,o=r.height||64,s=r.type||e.type,l=new jn({width:a,height:o,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var u=Math.min(a,o),f=Math.log(u)/Math.log(2)+1,h=new Si({shader:new $({vertex:$.source("clay.skybox.vertex"),fragment:ZO})});h.set("normalDistribution",i),r.encodeRGBM&&h.define("fragment","RGBM_ENCODE"),r.decodeRGBM&&h.define("fragment","RGBM_DECODE");var v=new ji,c;if(e.textureType==="texture2D"){var d=new jn({width:a,height:o,type:s===W.FLOAT?W.HALF_FLOAT:s});ei.panoramaToCubeMap(t,e,d,{encodeRGBM:r.decodeRGBM}),e=d}c=new Ns({scene:v,material:h}),c.material.set("environmentMap",e);var p=new Hp({texture:l});r.encodeRGBM&&(s=l.type=W.UNSIGNED_BYTE);for(var g=new At({width:a,height:o,type:s}),m=new he({depthBuffer:!1}),_=Ct[s===W.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y>>16)>>>0;h=((h&1431655765)<<1|(h&2863311530)>>>1)>>>0,h=((h&858993459)<<2|(h&3435973836)>>>2)>>>0,h=((h&252645135)<<4|(h&4042322160)>>>4)>>>0,h=(((h&16711935)<<8|(h&4278255360)>>>8)>>>0)/4294967296;var v=Math.sqrt((1-h)/(1+(u*u-1)*h));o[f]=v}for(var f=0;f65535?Uint32Array:Uint16Array,s=this.indices=new o(e*t*6),l,u,f,h,v,c,d,y=this.radius,p=this.phiStart,g=this.phiLength,m=this.thetaStart,_=this.thetaLength,y=this.radius,x=[],S=[],T=0,w=1/y;for(d=0;d<=t;d++)for(c=0;c<=e;c++)h=c/e,v=d/t,l=-y*Math.cos(p+h*g)*Math.sin(m+v*_),u=y*Math.cos(m+v*_),f=y*Math.sin(p+h*g)*Math.sin(m+v*_),x[0]=l,x[1]=u,x[2]=f,S[0]=h,S[1]=v,r.set(T,x),i.set(T,S),x[0]*=w,x[1]*=w,x[2]*=w,n.set(T,x),T++;var b,A,M,E,D=e+1,R=0;for(d=0;d=0&&l.splice(h,1)}),l.push(u),this.__zr&&this.__zr.animation.addAnimator(u),u},stopAnimation:function(t){this._animators=this._animators||[];for(var e=this._animators,r=e.length,i=0;i 1e-4) { skinMatrixWS += getSkinMatrix(joint.y) * weight.y; } if (weight.z > 1e-4) { skinMatrixWS += getSkinMatrix(joint.z) * weight.z; } float weightW = 1.0-weight.x-weight.y-weight.z; if (weightW > 1e-4) { skinMatrixWS += getSkinMatrix(joint.w) * weightW; } @end @export clay.chunk.instancing_header #ifdef INSTANCING attribute vec4 instanceMat1; attribute vec4 instanceMat2; attribute vec4 instanceMat3; #endif @end @export clay.chunk.instancing_matrix mat4 instanceMat = mat4( vec4(instanceMat1.xyz, 0.0), vec4(instanceMat2.xyz, 0.0), vec4(instanceMat3.xyz, 0.0), vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0) ); @end @export clay.util.parallax_correct vec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) { vec3 first = (boxMax - pos) / dir; vec3 second = (boxMin - pos) / dir; vec3 further = max(first, second); float dist = min(further.x, min(further.y, further.z)); vec3 fixedPos = pos + dir * dist; vec3 boxCenter = (boxMax + boxMin) * 0.5; return normalize(fixedPos - boxCenter); } @end @export clay.util.clamp_sample vec4 clampSample(const in sampler2D texture, const in vec2 coord) { #ifdef STEREO float eye = step(0.5, coord.x) * 0.5; vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0)); #else vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0)); #endif return texture2D(texture, coordClamped); } @end @export clay.util.ACES vec3 ACESToneMapping(vec3 color) { const float A = 2.51; const float B = 0.03; const float C = 2.43; const float D = 0.59; const float E = 0.14; return (color * (A * color + B)) / (color * (C * color + D) + E); } @end`,o3=` @export ecgl.common.transformUniforms uniform mat4 worldViewProjection : WORLDVIEWPROJECTION; uniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE; uniform mat4 world : WORLD; @end @export ecgl.common.attributes attribute vec3 position : POSITION; attribute vec2 texcoord : TEXCOORD_0; attribute vec3 normal : NORMAL; @end @export ecgl.common.uv.header uniform vec2 uvRepeat : [1.0, 1.0]; uniform vec2 uvOffset : [0.0, 0.0]; uniform vec2 detailUvRepeat : [1.0, 1.0]; uniform vec2 detailUvOffset : [0.0, 0.0]; varying vec2 v_Texcoord; varying vec2 v_DetailTexcoord; @end @export ecgl.common.uv.main v_Texcoord = texcoord * uvRepeat + uvOffset; v_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset; @end @export ecgl.common.uv.fragmentHeader varying vec2 v_Texcoord; varying vec2 v_DetailTexcoord; @end @export ecgl.common.albedo.main vec4 albedoTexel = vec4(1.0); #ifdef DIFFUSEMAP_ENABLED albedoTexel = texture2D(diffuseMap, v_Texcoord); #ifdef SRGB_DECODE albedoTexel = sRGBToLinear(albedoTexel); #endif #endif #ifdef DETAILMAP_ENABLED vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord); #ifdef SRGB_DECODE detailTexel = sRGBToLinear(detailTexel); #endif albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a); albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a; #endif @end @export ecgl.common.wireframe.vertexHeader #ifdef WIREFRAME_QUAD attribute vec4 barycentric; varying vec4 v_Barycentric; #elif defined(WIREFRAME_TRIANGLE) attribute vec3 barycentric; varying vec3 v_Barycentric; #endif @end @export ecgl.common.wireframe.vertexMain #if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE) v_Barycentric = barycentric; #endif @end @export ecgl.common.wireframe.fragmentHeader uniform float wireframeLineWidth : 1; uniform vec4 wireframeLineColor: [0, 0, 0, 0.5]; #ifdef WIREFRAME_QUAD varying vec4 v_Barycentric; float edgeFactor () { vec4 d = fwidth(v_Barycentric); vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric); return min(min(min(a4.x, a4.y), a4.z), a4.w); } #elif defined(WIREFRAME_TRIANGLE) varying vec3 v_Barycentric; float edgeFactor () { vec3 d = fwidth(v_Barycentric); vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric); return min(min(a3.x, a3.y), a3.z); } #endif @end @export ecgl.common.wireframe.fragmentMain #if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE) if (wireframeLineWidth > 0.) { vec4 lineColor = wireframeLineColor; #ifdef SRGB_DECODE lineColor = sRGBToLinear(lineColor); #endif gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a); } #endif @end @export ecgl.common.bumpMap.header #ifdef BUMPMAP_ENABLED uniform sampler2D bumpMap; uniform float bumpScale : 1.0; vec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal) { vec2 dSTdx = dFdx(v_Texcoord); vec2 dSTdy = dFdy(v_Texcoord); float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x; float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll; float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll; vec3 vSigmaX = dFdx(surfPos); vec3 vSigmaY = dFdy(surfPos); vec3 vN = surfNormal; vec3 R1 = cross(vSigmaY, vN); vec3 R2 = cross(vN, vSigmaX); float fDet = dot(vSigmaX, R1); vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2); return normalize(abs(fDet) * baseNormal - vGrad); } #endif @end @export ecgl.common.normalMap.vertexHeader #ifdef NORMALMAP_ENABLED attribute vec4 tangent : TANGENT; varying vec3 v_Tangent; varying vec3 v_Bitangent; #endif @end @export ecgl.common.normalMap.vertexMain #ifdef NORMALMAP_ENABLED if (dot(tangent, tangent) > 0.0) { v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz); v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w); } #endif @end @export ecgl.common.normalMap.fragmentHeader #ifdef NORMALMAP_ENABLED uniform sampler2D normalMap; varying vec3 v_Tangent; varying vec3 v_Bitangent; #endif @end @export ecgl.common.normalMap.fragmentMain #ifdef NORMALMAP_ENABLED if (dot(v_Tangent, v_Tangent) > 0.0) { vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz; if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0; mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal); N = normalize(tbn * N); } } #endif @end @export ecgl.common.vertexAnimation.header #ifdef VERTEX_ANIMATION attribute vec3 prevPosition; attribute vec3 prevNormal; uniform float percent; #endif @end @export ecgl.common.vertexAnimation.main #ifdef VERTEX_ANIMATION vec3 pos = mix(prevPosition, position, percent); vec3 norm = mix(prevNormal, normal, percent); #else vec3 pos = position; vec3 norm = normal; #endif @end @export ecgl.common.ssaoMap.header #ifdef SSAOMAP_ENABLED uniform sampler2D ssaoMap; uniform vec4 viewport : VIEWPORT; #endif @end @export ecgl.common.ssaoMap.main float ao = 1.0; #ifdef SSAOMAP_ENABLED ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r; #endif @end @export ecgl.common.diffuseLayer.header #if (LAYER_DIFFUSEMAP_COUNT > 0) uniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT]; uniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT]; #endif @end @export ecgl.common.emissiveLayer.header #if (LAYER_EMISSIVEMAP_COUNT > 0) uniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT]; uniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT]; #endif @end @export ecgl.common.layers.header @import ecgl.common.diffuseLayer.header @import ecgl.common.emissiveLayer.header @end @export ecgl.common.diffuseLayer.main #if (LAYER_DIFFUSEMAP_COUNT > 0) for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{ float intensity = layerDiffuseIntensity[_idx_]; vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord); #ifdef SRGB_DECODE texel2 = sRGBToLinear(texel2); #endif albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a); albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a; }} #endif @end @export ecgl.common.emissiveLayer.main #if (LAYER_EMISSIVEMAP_COUNT > 0) for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++) {{ vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_]; #ifdef SRGB_DECODE texel2 = sRGBToLinear(texel2); #endif float intensity = layerEmissionIntensity[_idx_]; gl_FragColor.rgb += texel2.rgb * texel2.a * intensity; }} #endif @end `,s3=`@export ecgl.color.vertex uniform mat4 worldViewProjection : WORLDVIEWPROJECTION; @import ecgl.common.uv.header attribute vec2 texcoord : TEXCOORD_0; attribute vec3 position: POSITION; @import ecgl.common.wireframe.vertexHeader #ifdef VERTEX_COLOR attribute vec4 a_Color : COLOR; varying vec4 v_Color; #endif #ifdef VERTEX_ANIMATION attribute vec3 prevPosition; uniform float percent : 1.0; #endif #ifdef ATMOSPHERE_ENABLED attribute vec3 normal: NORMAL; uniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE; varying vec3 v_Normal; #endif void main() { #ifdef VERTEX_ANIMATION vec3 pos = mix(prevPosition, position, percent); #else vec3 pos = position; #endif gl_Position = worldViewProjection * vec4(pos, 1.0); @import ecgl.common.uv.main #ifdef VERTEX_COLOR v_Color = a_Color; #endif #ifdef ATMOSPHERE_ENABLED v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz); #endif @import ecgl.common.wireframe.vertexMain } @end @export ecgl.color.fragment #define LAYER_DIFFUSEMAP_COUNT 0 #define LAYER_EMISSIVEMAP_COUNT 0 uniform sampler2D diffuseMap; uniform sampler2D detailMap; uniform vec4 color : [1.0, 1.0, 1.0, 1.0]; #ifdef ATMOSPHERE_ENABLED uniform mat4 viewTranspose: VIEWTRANSPOSE; uniform vec3 glowColor; uniform float glowPower; varying vec3 v_Normal; #endif #ifdef VERTEX_COLOR varying vec4 v_Color; #endif @import ecgl.common.layers.header @import ecgl.common.uv.fragmentHeader @import ecgl.common.wireframe.fragmentHeader @import clay.util.srgb void main() { #ifdef SRGB_DECODE gl_FragColor = sRGBToLinear(color); #else gl_FragColor = color; #endif #ifdef VERTEX_COLOR gl_FragColor *= v_Color; #endif @import ecgl.common.albedo.main @import ecgl.common.diffuseLayer.main gl_FragColor *= albedoTexel; #ifdef ATMOSPHERE_ENABLED float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower); gl_FragColor.rgb += glowColor * atmoIntensity; #endif @import ecgl.common.emissiveLayer.main @import ecgl.common.wireframe.fragmentMain } @end`,l3=`/** * http: */ @export ecgl.lambert.vertex @import ecgl.common.transformUniforms @import ecgl.common.uv.header @import ecgl.common.attributes @import ecgl.common.wireframe.vertexHeader #ifdef VERTEX_COLOR attribute vec4 a_Color : COLOR; varying vec4 v_Color; #endif @import ecgl.common.vertexAnimation.header varying vec3 v_Normal; varying vec3 v_WorldPosition; void main() { @import ecgl.common.uv.main @import ecgl.common.vertexAnimation.main gl_Position = worldViewProjection * vec4(pos, 1.0); v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz); v_WorldPosition = (world * vec4(pos, 1.0)).xyz; #ifdef VERTEX_COLOR v_Color = a_Color; #endif @import ecgl.common.wireframe.vertexMain } @end @export ecgl.lambert.fragment #define LAYER_DIFFUSEMAP_COUNT 0 #define LAYER_EMISSIVEMAP_COUNT 0 #define NORMAL_UP_AXIS 1 #define NORMAL_FRONT_AXIS 2 @import ecgl.common.uv.fragmentHeader varying vec3 v_Normal; varying vec3 v_WorldPosition; uniform sampler2D diffuseMap; uniform sampler2D detailMap; @import ecgl.common.layers.header uniform float emissionIntensity: 1.0; uniform vec4 color : [1.0, 1.0, 1.0, 1.0]; uniform mat4 viewInverse : VIEWINVERSE; #ifdef ATMOSPHERE_ENABLED uniform mat4 viewTranspose: VIEWTRANSPOSE; uniform vec3 glowColor; uniform float glowPower; #endif #ifdef AMBIENT_LIGHT_COUNT @import clay.header.ambient_light #endif #ifdef AMBIENT_SH_LIGHT_COUNT @import clay.header.ambient_sh_light #endif #ifdef DIRECTIONAL_LIGHT_COUNT @import clay.header.directional_light #endif #ifdef VERTEX_COLOR varying vec4 v_Color; #endif @import ecgl.common.ssaoMap.header @import ecgl.common.bumpMap.header @import clay.util.srgb @import ecgl.common.wireframe.fragmentHeader @import clay.plugin.compute_shadow_map void main() { #ifdef SRGB_DECODE gl_FragColor = sRGBToLinear(color); #else gl_FragColor = color; #endif #ifdef VERTEX_COLOR #ifdef SRGB_DECODE gl_FragColor *= sRGBToLinear(v_Color); #else gl_FragColor *= v_Color; #endif #endif @import ecgl.common.albedo.main @import ecgl.common.diffuseLayer.main gl_FragColor *= albedoTexel; vec3 N = v_Normal; #ifdef DOUBLE_SIDED vec3 eyePos = viewInverse[3].xyz; vec3 V = normalize(eyePos - v_WorldPosition); if (dot(N, V) < 0.0) { N = -N; } #endif float ambientFactor = 1.0; #ifdef BUMPMAP_ENABLED N = bumpNormal(v_WorldPosition, v_Normal, N); ambientFactor = dot(v_Normal, N); #endif vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]); vec3 diffuseColor = vec3(0.0, 0.0, 0.0); @import ecgl.common.ssaoMap.main #ifdef AMBIENT_LIGHT_COUNT for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++) { diffuseColor += ambientLightColor[i] * ambientFactor * ao; } #endif #ifdef AMBIENT_SH_LIGHT_COUNT for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++) {{ diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao; }} #endif #ifdef DIRECTIONAL_LIGHT_COUNT #if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT]; if(shadowEnabled) { computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir); } #endif for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) { vec3 lightDirection = -directionalLightDirection[i]; vec3 lightColor = directionalLightColor[i]; float shadowContrib = 1.0; #if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) if (shadowEnabled) { shadowContrib = shadowContribsDir[i]; } #endif float ndl = dot(N, normalize(lightDirection)) * shadowContrib; diffuseColor += lightColor * clamp(ndl, 0.0, 1.0); } #endif gl_FragColor.rgb *= diffuseColor; #ifdef ATMOSPHERE_ENABLED float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower); gl_FragColor.rgb += glowColor * atmoIntensity; #endif @import ecgl.common.emissiveLayer.main @import ecgl.common.wireframe.fragmentMain } @end`,u3=`@export ecgl.realistic.vertex @import ecgl.common.transformUniforms @import ecgl.common.uv.header @import ecgl.common.attributes @import ecgl.common.wireframe.vertexHeader #ifdef VERTEX_COLOR attribute vec4 a_Color : COLOR; varying vec4 v_Color; #endif #ifdef NORMALMAP_ENABLED attribute vec4 tangent : TANGENT; varying vec3 v_Tangent; varying vec3 v_Bitangent; #endif @import ecgl.common.vertexAnimation.header varying vec3 v_Normal; varying vec3 v_WorldPosition; void main() { @import ecgl.common.uv.main @import ecgl.common.vertexAnimation.main gl_Position = worldViewProjection * vec4(pos, 1.0); v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz); v_WorldPosition = (world * vec4(pos, 1.0)).xyz; #ifdef VERTEX_COLOR v_Color = a_Color; #endif #ifdef NORMALMAP_ENABLED v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz); v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w); #endif @import ecgl.common.wireframe.vertexMain } @end @export ecgl.realistic.fragment #define LAYER_DIFFUSEMAP_COUNT 0 #define LAYER_EMISSIVEMAP_COUNT 0 #define PI 3.14159265358979 #define ROUGHNESS_CHANEL 0 #define METALNESS_CHANEL 1 #define NORMAL_UP_AXIS 1 #define NORMAL_FRONT_AXIS 2 #ifdef VERTEX_COLOR varying vec4 v_Color; #endif @import ecgl.common.uv.fragmentHeader varying vec3 v_Normal; varying vec3 v_WorldPosition; uniform sampler2D diffuseMap; uniform sampler2D detailMap; uniform sampler2D metalnessMap; uniform sampler2D roughnessMap; @import ecgl.common.layers.header uniform float emissionIntensity: 1.0; uniform vec4 color : [1.0, 1.0, 1.0, 1.0]; uniform float metalness : 0.0; uniform float roughness : 0.5; uniform mat4 viewInverse : VIEWINVERSE; #ifdef ATMOSPHERE_ENABLED uniform mat4 viewTranspose: VIEWTRANSPOSE; uniform vec3 glowColor; uniform float glowPower; #endif #ifdef AMBIENT_LIGHT_COUNT @import clay.header.ambient_light #endif #ifdef AMBIENT_SH_LIGHT_COUNT @import clay.header.ambient_sh_light #endif #ifdef AMBIENT_CUBEMAP_LIGHT_COUNT @import clay.header.ambient_cubemap_light #endif #ifdef DIRECTIONAL_LIGHT_COUNT @import clay.header.directional_light #endif @import ecgl.common.normalMap.fragmentHeader @import ecgl.common.ssaoMap.header @import ecgl.common.bumpMap.header @import clay.util.srgb @import clay.util.rgbm @import ecgl.common.wireframe.fragmentHeader @import clay.plugin.compute_shadow_map vec3 F_Schlick(float ndv, vec3 spec) { return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0); } float D_Phong(float g, float ndh) { float a = pow(8192.0, g); return (a + 2.0) / 8.0 * pow(ndh, a); } void main() { vec4 albedoColor = color; vec3 eyePos = viewInverse[3].xyz; vec3 V = normalize(eyePos - v_WorldPosition); #ifdef VERTEX_COLOR #ifdef SRGB_DECODE albedoColor *= sRGBToLinear(v_Color); #else albedoColor *= v_Color; #endif #endif @import ecgl.common.albedo.main @import ecgl.common.diffuseLayer.main albedoColor *= albedoTexel; float m = metalness; #ifdef METALNESSMAP_ENABLED float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL]; m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0); #endif vec3 baseColor = albedoColor.rgb; albedoColor.rgb = baseColor * (1.0 - m); vec3 specFactor = mix(vec3(0.04), baseColor, m); float g = 1.0 - roughness; #ifdef ROUGHNESSMAP_ENABLED float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL]; g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0); #endif vec3 N = v_Normal; #ifdef DOUBLE_SIDED if (dot(N, V) < 0.0) { N = -N; } #endif float ambientFactor = 1.0; #ifdef BUMPMAP_ENABLED N = bumpNormal(v_WorldPosition, v_Normal, N); ambientFactor = dot(v_Normal, N); #endif @import ecgl.common.normalMap.fragmentMain vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]); vec3 diffuseTerm = vec3(0.0); vec3 specularTerm = vec3(0.0); float ndv = clamp(dot(N, V), 0.0, 1.0); vec3 fresnelTerm = F_Schlick(ndv, specFactor); @import ecgl.common.ssaoMap.main #ifdef AMBIENT_LIGHT_COUNT for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++) {{ diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao; }} #endif #ifdef AMBIENT_SH_LIGHT_COUNT for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++) {{ diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao; }} #endif #ifdef DIRECTIONAL_LIGHT_COUNT #if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT]; if(shadowEnabled) { computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir); } #endif for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{ vec3 L = -directionalLightDirection[_idx_]; vec3 lc = directionalLightColor[_idx_]; vec3 H = normalize(L + V); float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0); float ndh = clamp(dot(N, H), 0.0, 1.0); float shadowContrib = 1.0; #if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) if (shadowEnabled) { shadowContrib = shadowContribsDir[_idx_]; } #endif vec3 li = lc * ndl * shadowContrib; diffuseTerm += li; specularTerm += li * fresnelTerm * D_Phong(g, ndh); }} #endif #ifdef AMBIENT_CUBEMAP_LIGHT_COUNT vec3 L = reflect(-V, N); L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]); float rough2 = clamp(1.0 - g, 0.0, 1.0); float bias2 = rough2 * 5.0; vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy; vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y; vec3 envTexel2; for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++) {{ envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12); specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao; }} #endif gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm; gl_FragColor.a = albedoColor.a; #ifdef ATMOSPHERE_ENABLED float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower); gl_FragColor.rgb += glowColor * atmoIntensity; #endif #ifdef SRGB_ENCODE gl_FragColor = linearTosRGB(gl_FragColor); #endif @import ecgl.common.emissiveLayer.main @import ecgl.common.wireframe.fragmentMain } @end`,f3=`@export ecgl.hatching.vertex @import ecgl.realistic.vertex @end @export ecgl.hatching.fragment #define NORMAL_UP_AXIS 1 #define NORMAL_FRONT_AXIS 2 @import ecgl.common.uv.fragmentHeader varying vec3 v_Normal; varying vec3 v_WorldPosition; uniform vec4 color : [0.0, 0.0, 0.0, 1.0]; uniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0]; uniform mat4 viewInverse : VIEWINVERSE; #ifdef AMBIENT_LIGHT_COUNT @import clay.header.ambient_light #endif #ifdef AMBIENT_SH_LIGHT_COUNT @import clay.header.ambient_sh_light #endif #ifdef DIRECTIONAL_LIGHT_COUNT @import clay.header.directional_light #endif #ifdef VERTEX_COLOR varying vec4 v_Color; #endif @import ecgl.common.ssaoMap.header @import ecgl.common.bumpMap.header @import clay.util.srgb @import ecgl.common.wireframe.fragmentHeader @import clay.plugin.compute_shadow_map uniform sampler2D hatch1; uniform sampler2D hatch2; uniform sampler2D hatch3; uniform sampler2D hatch4; uniform sampler2D hatch5; uniform sampler2D hatch6; float shade(in float tone) { vec4 c = vec4(1. ,1., 1., 1.); float step = 1. / 6.; vec2 uv = v_DetailTexcoord; if (tone <= step / 2.0) { c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone); } else if (tone <= step) { c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone); } if(tone > step && tone <= 2. * step){ c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step)); } if(tone > 2. * step && tone <= 3. * step){ c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step)); } if(tone > 3. * step && tone <= 4. * step){ c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step)); } if(tone > 4. * step && tone <= 5. * step){ c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step)); } if(tone > 5. * step){ c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step)); } return c.r; } const vec3 w = vec3(0.2125, 0.7154, 0.0721); void main() { #ifdef SRGB_DECODE vec4 inkColor = sRGBToLinear(color); #else vec4 inkColor = color; #endif #ifdef VERTEX_COLOR #ifdef SRGB_DECODE inkColor *= sRGBToLinear(v_Color); #else inkColor *= v_Color; #endif #endif vec3 N = v_Normal; #ifdef DOUBLE_SIDED vec3 eyePos = viewInverse[3].xyz; vec3 V = normalize(eyePos - v_WorldPosition); if (dot(N, V) < 0.0) { N = -N; } #endif float tone = 0.0; float ambientFactor = 1.0; #ifdef BUMPMAP_ENABLED N = bumpNormal(v_WorldPosition, v_Normal, N); ambientFactor = dot(v_Normal, N); #endif vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]); @import ecgl.common.ssaoMap.main #ifdef AMBIENT_LIGHT_COUNT for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++) { tone += dot(ambientLightColor[i], w) * ambientFactor * ao; } #endif #ifdef AMBIENT_SH_LIGHT_COUNT for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++) {{ tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao; }} #endif #ifdef DIRECTIONAL_LIGHT_COUNT #if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT]; if(shadowEnabled) { computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir); } #endif for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) { vec3 lightDirection = -directionalLightDirection[i]; float lightTone = dot(directionalLightColor[i], w); float shadowContrib = 1.0; #if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) if (shadowEnabled) { shadowContrib = shadowContribsDir[i]; } #endif float ndl = dot(N, normalize(lightDirection)) * shadowContrib; tone += lightTone * clamp(ndl, 0.0, 1.0); } #endif gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0))); } @end `,h3=`@export ecgl.sm.depth.vertex uniform mat4 worldViewProjection : WORLDVIEWPROJECTION; attribute vec3 position : POSITION; attribute vec2 texcoord : TEXCOORD_0; #ifdef VERTEX_ANIMATION attribute vec3 prevPosition; uniform float percent : 1.0; #endif varying vec4 v_ViewPosition; varying vec2 v_Texcoord; void main(){ #ifdef VERTEX_ANIMATION vec3 pos = mix(prevPosition, position, percent); #else vec3 pos = position; #endif v_ViewPosition = worldViewProjection * vec4(pos, 1.0); gl_Position = v_ViewPosition; v_Texcoord = texcoord; } @end @export ecgl.sm.depth.fragment @import clay.sm.depth.fragment @end`;Object.assign(ti.prototype,n3);$.import(a3);$.import(yw);$.import(o3);$.import(s3);$.import(l3);$.import(u3);$.import(f3);$.import(h3);function c3(t){return!t||t==="none"}function Ew(t){return t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof Image}function v3(t){return t.getZr&&t.setOption}var d3=ji.prototype.addToScene,p3=ji.prototype.removeFromScene;ji.prototype.addToScene=function(t){if(d3.call(this,t),this.__zr){var e=this.__zr;t.traverse(function(r){r.__zr=e,r.addAnimatorsToZr&&r.addAnimatorsToZr(e)})}};ji.prototype.removeFromScene=function(t){p3.call(this,t),t.traverse(function(e){var r=e.__zr;e.__zr=null,r&&e.removeAnimatorsFromZr&&e.removeAnimatorsFromZr(r)})};Si.prototype.setTextureImage=function(t,e,r,i){if(this.shader){var n=r.getZr(),a=this,o;return a.autoUpdateTextureStatus=!1,a.disableTexture(t),c3(e)||(o=U.loadTexture(e,r,i,function(s){a.enableTexture(t),n&&n.refresh()}),a.set(t,o)),o}};var U={};U.Renderer=yr;U.Node=ti;U.Mesh=Ve;U.Shader=$;U.Material=Si;U.Texture=W;U.Texture2D=At;U.Geometry=Ut;U.SphereGeometry=JO;U.PlaneGeometry=Vp;U.CubeGeometry=bw;U.AmbientLight=t3;U.DirectionalLight=e3;U.PointLight=r3;U.SpotLight=i3;U.PerspectiveCamera=ve;U.OrthographicCamera=Os;U.Vector2=st;U.Vector3=B;U.Vector4=St;U.Quaternion=It;U.Matrix2=Fe;U.Matrix2d=$e;U.Matrix3=fe;U.Matrix4=q;U.Plane=ps;U.Ray=Zn;U.BoundingBox=ye;U.Frustum=Wf;var Yl=null;function g3(){return Yl!==null||(Yl=ei.createBlank("rgba(255,255,255,0)").image),Yl}function Q_(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function J_(t){if((t.wrapS===W.REPEAT||t.wrapT===W.REPEAT)&&t.image){var e=Q_(t.width),r=Q_(t.height);if(e!==t.width||r!==t.height){var i=document.createElement("canvas");i.width=e,i.height=r;var n=i.getContext("2d");n.drawImage(t.image,0,0,e,r),t.image=i}}}U.loadTexture=function(t,e,r,i){typeof r=="function"&&(i=r,r={}),r=r||{};for(var n=Object.keys(r).sort(),a="",o=0;o3?e[3]=t[3]:e[3]=1,e):(e=Be(t||"#000",e)||[0,0,0,0],e[0]/=255,e[1]/=255,e[2]/=255,e)};U.directionFromAlphaBeta=function(t,e){var r=t/180*Math.PI+Math.PI/2,i=-e/180*Math.PI+Math.PI/2,n=[],a=Math.sin(r);return n[0]=a*Math.cos(i),n[1]=-Math.cos(r),n[2]=a*Math.sin(i),n};U.getShadowResolution=function(t){var e=1024;switch(t){case"low":e=512;break;case"medium":break;case"high":e=2048;break;case"ultra":e=4096;break}return e};U.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"];U.createShader=function(t){t==="ecgl.shadow"&&(t="ecgl.displayShadow");var e=$.source(t+".vertex"),r=$.source(t+".fragment");e||console.error("Vertex shader of '%s' not exits",t),r||console.error("Fragment shader of '%s' not exits",t);var i=new $(e,r);return i.name=t,i};U.createMaterial=function(t,e){e instanceof Array||(e=[e]);var r=U.createShader(t),i=new Si({shader:r});return e.forEach(function(n){typeof n=="string"&&i.define(n)}),i};U.setMaterialFromModel=function(t,e,r,i){e.autoUpdateTextureStatus=!1;var n=r.getModel(t+"Material"),a=n.get("detailTexture"),o=mr.firstNotNull(n.get("textureTiling"),1),s=mr.firstNotNull(n.get("textureOffset"),0);typeof o=="number"&&(o=[o,o]),typeof s=="number"&&(s=[s,s]);var l=o[0]>1||o[1]>1?U.Texture.REPEAT:U.Texture.CLAMP_TO_EDGE,u={anisotropic:8,wrapS:l,wrapT:l};if(t==="realistic"){var f=n.get("roughness"),h=n.get("metalness");h!=null?isNaN(h)&&(e.setTextureImage("metalnessMap",h,i,u),h=mr.firstNotNull(n.get("metalnessAdjust"),.5)):h=0,f!=null?isNaN(f)&&(e.setTextureImage("roughnessMap",f,i,u),f=mr.firstNotNull(n.get("roughnessAdjust"),.5)):f=.5;var v=n.get("normalTexture");e.setTextureImage("detailMap",a,i,u),e.setTextureImage("normalMap",v,i,u),e.set({roughness:f,metalness:h,detailUvRepeat:o,detailUvOffset:s})}else if(t==="lambert")e.setTextureImage("detailMap",a,i,u),e.set({detailUvRepeat:o,detailUvOffset:s});else if(t==="color")e.setTextureImage("detailMap",a,i,u),e.set({detailUvRepeat:o,detailUvOffset:s});else if(t==="hatching"){var c=n.get("hatchingTextures")||[];c.length<6;for(var d=0;d<6;d++)e.setTextureImage("hatch"+(d+1),c[d],i,{anisotropic:8,wrapS:U.Texture.REPEAT,wrapT:U.Texture.REPEAT});e.set({detailUvRepeat:o,detailUvOffset:s})}};U.updateVertexAnimation=function(t,e,r,i){var n=i.get("animation"),a=i.get("animationDurationUpdate"),o=i.get("animationEasingUpdate"),s=r.shadowDepthMaterial;if(n&&e&&a>0&&e.geometry.vertexCount===r.geometry.vertexCount){r.material.define("vertex","VERTEX_ANIMATION"),r.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(e,1),this.views.push(t),t.layer=this;var r=this.zr;t.scene.traverse(function(i){i.__zr=r,i.addAnimatorsToZr&&i.addAnimatorsToZr(r)})}};function Mw(t){var e=t.__zr;t.__zr=null,e&&t.removeAnimatorsFromZr&&t.removeAnimatorsFromZr(e)}zt.prototype.removeView=function(t){if(t.layer===this){var e=this.views.indexOf(t);e>=0&&(this.views.splice(e,1),t.scene.traverse(Mw,this),t.layer=null,this._viewsToDispose.push(t))}};zt.prototype.removeViewsAll=function(){this.views.forEach(function(t){t.scene.traverse(Mw,this),t.layer=null,this._viewsToDispose.push(t)},this),this.views.length=0};zt.prototype.resize=function(t,e){var r=this.renderer;r.resize(t,e)};zt.prototype.clear=function(){var t=this.renderer.gl,e=this._backgroundColor||[0,0,0,0];t.clearColor(e[0],e[1],e[2],e[3]),t.depthMask(!0),t.colorMask(!0,!0,!0,!0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT)};zt.prototype.clearDepth=function(){var t=this.renderer.gl;t.clear(t.DEPTH_BUFFER_BIT)};zt.prototype.clearColor=function(){var t=this.renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)};zt.prototype.needsRefresh=function(){this.zr.refresh()};zt.prototype.refresh=function(t){this._backgroundColor=t?U.parseColor(t):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var e=0;e20)){t=t.event;var i=this.pickObject(t.offsetX,t.offsetY);i&&(this._dispatchEvent(t.type,t,i),this._dispatchDataEvent(t.type,t,i));var n=this._clickToSetFocusPoint(t);if(n){var a=n.view.setDOFFocusOnPoint(n.distance);a&&this.zr.refresh()}}}};zt.prototype._clickToSetFocusPoint=function(t){for(var e=this.renderer,r=e.viewport,i=this.views.length-1;i>=0;i--){var n=this.views[i];if(n.hasDOF()&&n.containPoint(t.offsetX,t.offsetY)){this._picking.scene=n.scene,this._picking.camera=n.camera,e.viewport=n.viewport;var a=this._picking.pick(t.offsetX,t.offsetY,!0);if(a)return a.view=n,a}}e.viewport=r};zt.prototype.onglobalout=function(t){var e=this._hovered;e&&this._dispatchEvent("mouseout",t,{target:e.target})};zt.prototype.pickObject=function(t,e){for(var r=[],i=this.renderer,n=i.viewport,a=0;a=0&&(f.dataIndex=this._lastDataIndex,f.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0):o!=null&&o!==this._lastEventData&&(this._lastEventData!=null&&(f.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0),this._lastEventData=o,this._lastDataIndex=n,this._lastSeriesIndex=a),f.eventData=o,f.dataIndex=n,f.seriesIndex=a,(o!=null||parseInt(n,10)>=0&&parseInt(a,10)>=0)&&(this.zr.handler.dispatchToElement(u,t,e),s&&this.zr.handler.dispatchToElement(u,"mouseover",e))};zt.prototype._dispatchToView=function(t,e){for(var r=0;r=0&&(x3(e),e.coordinateSystem==="mapbox"&&(e.coordinateSystem="mapbox3D",t.mapbox3D=t.mapbox))}),ql(t.xAxis3D),ql(t.yAxis3D),ql(t.zAxis3D),ql(t.grid3D),ts(t.geo3D)}function Cw(t){this._layers={},this._zr=t}Cw.prototype.update=function(t,e){var r=this,i=e.getZr();if(!i.getWidth()||!i.getHeight()){console.warn("Dom has no width or height");return}function n(s){i.setSleepAfterStill(0);var l;s.coordinateSystem&&s.coordinateSystem.model,l=s.get("zlevel");var u=r._layers,f=u[l];if(!f){if(f=u[l]=new zt("gl-"+l,i),i.painter.isSingleCanvas()){f.virtual=!0;var h=new ir({z:1e4,style:{image:f.renderer.canvas},silent:!0});f.__hostImage=h,i.add(h)}i.painter.insertLayer(l,f)}return f.__hostImage&&f.__hostImage.setStyle({width:f.renderer.getWidth(),height:f.renderer.getHeight()}),f}function a(s,l){s&&s.traverse(function(u){u.isRenderable&&u.isRenderable()&&(u.ignorePicking=u.$ignorePicking!=null?u.$ignorePicking:l)})}for(var o in this._layers)this._layers[o].removeViewsAll();t.eachComponent(function(s,l){if(s!=="series"){var u=e.getViewOfComponentModel(l),f=l.coordinateSystem;if(u.__ecgl__){var h;if(f){if(!f.viewGL){console.error("Can't find viewGL in coordinateSystem of component "+l.id);return}h=f.viewGL}else{if(!l.viewGL){console.error("Can't find viewGL of component "+l.id);return}h=f.viewGL}var h=f.viewGL,v=n(l);v.addView(h),u.afterRender&&u.afterRender(l,t,e,v),a(u.groupGL,l.get("silent"))}}}),t.eachSeries(function(s){var l=e.getViewOfSeriesModel(s),u=s.coordinateSystem;if(l.__ecgl__){if(u&&!u.viewGL&&!l.viewGL){console.error("Can't find viewGL of series "+l.id);return}var f=u&&u.viewGL||l.viewGL,h=n(s);h.addView(f),l.afterRender&&l.afterRender(s,t,e,h),a(l.groupGL,s.get("silent"))}})};pS(function(t){var e=t.getZr(),r=e.painter.dispose;e.painter.dispose=function(){typeof this.eachOtherLayer=="function"&&this.eachOtherLayer(function(i){i instanceof zt&&i.dispose()}),r.call(this)},e.painter.getRenderedCanvas=function(i){if(i=i||{},this._singleCanvas)return this._layers[0].dom;var n=document.createElement("canvas"),a=i.pixelRatio||this.dpr;n.width=this.getWidth()*a,n.height=this.getHeight()*a;var o=n.getContext("2d");o.dpr=a,o.clearRect(0,0,n.width,n.height),i.backgroundColor&&(o.fillStyle=i.backgroundColor,o.fillRect(0,0,n.width,n.height));var s=this.storage.getDisplayList(!0),l={},u,f=this;function h(p,g){var m=f._zlevelList;p==null&&(p=-1/0);for(var _,y=0;yp&&x0&&this._notFirst?this.animateTo({alpha:u,beta:f,center:h,distance:a,orthographicSize:o,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(a),this.setAlpha(u),this.setBeta(f),this.setCenter(h),this.setOrthographicSize(o)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){},animateTo:function(t){var e=this.zr,r=this,i={},n={};return t.distance!=null&&(i.distance=this.getDistance(),n.distance=t.distance),t.orthographicSize!=null&&(i.orthographicSize=this.getOrthographicSize(),n.orthographicSize=t.orthographicSize),t.alpha!=null&&(i.alpha=this.getAlpha(),n.alpha=t.alpha),t.beta!=null&&(i.beta=this.getBeta(),n.beta=t.beta),t.center!=null&&(i.center=this.getCenter(),n.center=t.center),this._addAnimator(e.animation.animate(i).when(t.duration||1e3,n).during(function(){i.alpha!=null&&r.setAlpha(i.alpha),i.beta!=null&&r.setBeta(i.beta),i.distance!=null&&r.setDistance(i.distance),i.center!=null&&r.setCenter(i.center),i.orthographicSize!=null&&r.setOrthographicSize(i.orthographicSize),r._needsUpdate=!0})).start(t.easing||"linear")},stopAllAnimation:function(){for(var t=0;t0},_update:function(t){if(this._rotating){var e=(this.autoRotateDirection==="cw"?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=e*t/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(t=Math.min(t,50),this._updateDistanceOrSize(t),this._updatePan(t),this._updateRotate(t),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(t){var e=this._rotateVelocity;this._phi=e.y*t/20+this._phi,this._theta=e.x*t/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(e,Math.pow(this.damping,t/16))},_updateDistanceOrSize:function(t){this._projection==="perspective"?this._setDistance(this._distance+this._zoomSpeed*t/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*t/20),this._zoomSpeed*=Math.pow(this.damping,t/16)},_setDistance:function(t){this._distance=Math.max(Math.min(t,this.maxDistance),this.minDistance)},_setOrthoSize:function(t){this._orthoSize=Math.max(Math.min(t,this.maxOrthographicSize),this.minOrthographicSize);var e=this.getCamera(),r=this._orthoSize,i=r/this.viewGL.viewport.height*this.viewGL.viewport.width;e.left=-i/2,e.right=i/2,e.top=r/2,e.bottom=-r/2},_updatePan:function(t){var e=this._panVelocity,r=this._distance,i=this.getCamera(),n=i.worldTransform.y,a=i.worldTransform.x;this._center.scaleAndAdd(a,-e.x*r/200).scaleAndAdd(n,-e.y*r/200),this._vectorDamping(e,0)},_updateTransform:function(){var t=this.getCamera(),e=new B,r=this._theta+Math.PI/2,i=this._phi+Math.PI/2,n=Math.sin(r);e.x=n*Math.cos(i),e.y=-Math.cos(r),e.z=n*Math.sin(i),t.position.copy(this._center).scaleAndAdd(e,this._distance),t.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var t=this.autoRotateAfterStill,e=this;!isNaN(t)&&t>0&&(this._stillTimeout=setTimeout(function(){e._rotating=!0},t*1e3))},_vectorDamping:function(t,e){var r=t.len();r=r*e,r<1e-4&&(r=0),t.normalize().scale(r)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var t=this.getCamera().worldTransform.z,e=Math.asin(t.y),r=Math.atan2(t.x,t.z);this._theta=e,this._phi=-r,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(t){if(!t.target&&!this._isAnimating()){var e=t.offsetX,r=t.offsetY;this.viewGL&&!this.viewGL.containPoint(e,r)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),t.event.targetTouches?t.event.targetTouches.length===1&&(this._mode="rotate"):t.event.button===ty[this.rotateMouseButton]?this._mode="rotate":t.event.button===ty[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=t.offsetX,this._mouseY=t.offsetY)}},_mouseMoveHandler:function(t){if(!(t.target&&t.target.__isGLToZRProxy)&&!this._isAnimating()){var e=ey(this.panSensitivity),r=ey(this.rotateSensitivity);this._mode==="rotate"?(this._rotateVelocity.y=(t.offsetX-this._mouseX)/this.zr.getHeight()*2*r[0],this._rotateVelocity.x=(t.offsetY-this._mouseY)/this.zr.getWidth()*2*r[1]):this._mode==="pan"&&(this._panVelocity.x=(t.offsetX-this._mouseX)/this.zr.getWidth()*e[0]*400,this._panVelocity.y=(-t.offsetY+this._mouseY)/this.zr.getHeight()*e[1]*400),this._mouseX=t.offsetX,this._mouseY=t.offsetY,t.event.preventDefault()}},_mouseWheelHandler:function(t){if(!this._isAnimating()){var e=t.event.wheelDelta||-t.event.detail;this._zoomHandler(t,e)}},_pinchHandler:function(t){this._isAnimating()||(this._zoomHandler(t,t.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(t,e){if(e!==0){var r=t.offsetX,i=t.offsetY;if(!(this.viewGL&&!this.viewGL.containPoint(r,i))){var n;this._projection==="perspective"?n=Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):n=Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(e>0?-1:1)*n*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&this._mode==="rotate"&&this._startCountingStill(),t.event.preventDefault()}}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return this.rotateMouseButton==="right"||this.panMouseButton==="right"},_contextMenuHandler:function(t){this._isRightMouseButtonUsed()&&t.preventDefault()},_addAnimator:function(t){var e=this._animators;return e.push(t),t.done(function(){var r=e.indexOf(t);r>=0&&e.splice(r,1)}),t}});Object.defineProperty(Dw.prototype,"autoRotate",{get:function(t){return this._autoRotate},set:function(t){this._autoRotate=t,this._rotating=t}});const Wp={convertToDynamicArray:function(t){t&&this.resetOffset();var e=this.attributes;for(var r in e)t||!e[r].value?e[r].value=[]:e[r].value=Array.prototype.slice.call(e[r].value);t||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var t=this.attributes;for(var e in t)t[e].value&&t[e].value.length>0?t[e].value=new Float32Array(t[e].value):t[e].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},Zf={vec2:H,vec3:L,vec4:k,mat2:Tt,mat2d:Lt,mat3:it,mat4:z,quat:Z};var kc=Zf.vec3,ry=[[0,0],[1,1]],qf=Ut.extend(function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new Ut.Attribute("position","float",3,"POSITION"),positionPrev:new Ut.Attribute("positionPrev","float",3),positionNext:new Ut.Attribute("positionNext","float",3),prevPositionPrev:new Ut.Attribute("prevPositionPrev","float",3),prevPosition:new Ut.Attribute("prevPosition","float",3),prevPositionNext:new Ut.Attribute("prevPositionNext","float",3),offset:new Ut.Attribute("offset","float",1),color:new Ut.Attribute("color","float",4,"COLOR")}}},{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(t){var e=this.attributes;this.vertexCount!==t&&(e.position.init(t),e.color.init(t),this.useNativeLine||(e.positionPrev.init(t),e.positionNext.init(t),e.offset.init(t)),t>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(t===0?this.indices=null:this.indices=this.vertexCount>65535?new Uint32Array(t*3):new Uint16Array(t*3))},_getCubicCurveApproxStep:function(t,e,r,i){var n=kc.dist(t,e)+kc.dist(r,e)+kc.dist(i,r),a=1/(n+1)*this.segmentScale;return a},getCubicCurveVertexCount:function(t,e,r,i){var n=this._getCubicCurveApproxStep(t,e,r,i),a=Math.ceil(1/n);return this.useNativeLine?a*2:a*2+2},getCubicCurveTriangleCount:function(t,e,r,i){var n=this._getCubicCurveApproxStep(t,e,r,i),a=Math.ceil(1/n);return this.useNativeLine?0:a*2},getLineVertexCount:function(){return this.getPolylineVertexCount(ry)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(ry)},getPolylineVertexCount:function(t){var e;if(typeof t=="number")e=t;else{var r=typeof t[0]!="number";e=r?t.length:t.length/3}return this.useNativeLine?(e-1)*2:(e-1)*2+2},getPolylineTriangleCount:function(t){var e;if(typeof t=="number")e=t;else{var r=typeof t[0]!="number";e=r?t.length:t.length/3}return this.useNativeLine?0:Math.max(e-1,0)*2},addCubicCurve:function(t,e,r,i,n,a){a==null&&(a=1);for(var o=t[0],s=t[1],l=t[2],u=e[0],f=e[1],h=e[2],v=r[0],c=r[1],d=r[2],p=i[0],g=i[1],m=i[2],_=this._getCubicCurveApproxStep(t,e,r,i),y=_*_,x=y*_,S=3*_,T=3*y,w=6*y,b=6*x,A=o-u*2+v,M=s-f*2+c,E=l-h*2+d,D=(u-v)*3-o+p,R=(f-c)*3-s+g,P=(h-d)*3-l+m,I=o,N=s,V=l,O=(u-o)*S+A*T+D*x,X=(f-s)*S+M*T+R*x,G=(h-l)*S+E*T+P*x,lt=A*w+D*b,J=M*w+R*b,ot=E*w+P*b,at=D*b,Dt=R*b,pt=P*b,Ot=0,Ht=0,Nt=Math.ceil(1/_),wt=new Float32Array((Nt+1)*3),wt=[],et=0,Ht=0;Ht1&&(I=O>0?Math.min(I,p):Math.max(I,p),N=X>0?Math.min(N,g):Math.max(N,g),V=G>0?Math.min(V,m):Math.max(V,m));return this.addPolyline(wt,n,a)},addLine:function(t,e,r,i){return this.addPolyline([t,e],r,i)},addPolyline:function(t,e,r,i,n){if(t.length){var a=typeof t[0]!="number";if(n==null&&(n=a?t.length:t.length/3),!(n<2)){i==null&&(i=0),r==null&&(r=1),this._itemVertexOffsets.push(this._vertexOffset);var a=typeof t[0]!="number",o=a?typeof e[0]!="number":e.length/4===n,s=this.attributes.position,l=this.attributes.positionPrev,u=this.attributes.positionNext,f=this.attributes.color,h=this.attributes.offset,v=this.indices,c=this._vertexOffset,d,p;r=Math.max(r,.01);for(var g=i;g1&&(s.copy(c,c-1),f.copy(c,c-1),c++):(g0&&(u.set(c-2,d),u.set(c-1,d)),s.set(c,d),s.set(c+1,d),f.set(c,p),f.set(c+1,p),h.set(c,r/2),h.set(c+1,-r/2),c+=2),this.useNativeLine)f.set(c,p),s.set(c,d),c++;else if(g>0){var y=this._triangleOffset*3,v=this.indices;v[y]=c-4,v[y+1]=c-3,v[y+2]=c-2,v[y+3]=c-3,v[y+4]=c-1,v[y+5]=c-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,S=this._vertexOffset+n*2;l.copy(x,x+2),l.copy(x+1,x+3),u.copy(S-1,S-3),u.copy(S-2,S-4)}return this._vertexOffset=c,this._vertexOffset}}},setItemColor:function(t,e){for(var r=this._itemVertexOffsets[t],i=to&&(n=this._x=0,a+=this._rowHeight+l,this._y=a,this._rowHeight=0),this._x+=e+l,this._rowHeight=Math.max(this._rowHeight,r),a+r+l>s)return null;t.x+=this.offsetX*this.dpr+n,t.y+=this.offsetY*this.dpr+a,this._zr.add(t);var u=[this.offsetX/this.width,this.offsetY/this.height],f=[[n/o+u[0],a/s+u[1]],[(n+e)/o+u[0],(a+r)/s+u[1]]];return f},_fitElement:function(t,e,r){var i=t.getBoundingRect(),n=e/i.width,a=r/i.height;t.x=-i.x*n,t.y=-i.y*a,t.scaleX=n,t.scaleY=a,t.update()}};function vd(t){t=t||{},t.width=t.width||512,t.height=t.height||512,t.devicePixelRatio=t.devicePixelRatio||1,t.gap=t.gap==null?2:t.gap;var e=document.createElement("canvas");e.width=t.width*t.devicePixelRatio,e.height=t.height*t.devicePixelRatio,this._canvas=e,this._texture=new At({image:e,flipY:!1});var r=this;this._zr=wv(e);var i=this._zr.refreshImmediately;this._zr.refreshImmediately=function(){i.call(this),r._texture.dirty(),r.onupdate&&r.onupdate()},this._dpr=t.devicePixelRatio,this._coords={},this.onupdate=t.onupdate,this._gap=t.gap,this._textureAtlasNodes=[new tf(this._zr,0,0,t.width,t.height,this._gap,this._dpr)],this._nodeWidth=t.width,this._nodeHeight=t.height,this._currentNodeIdx=0}vd.prototype={clear:function(){for(var t=0;t=t)){var a=(i+this._nodeWidth)*this._dpr,o=(n+this._nodeHeight)*this._dpr;try{this._zr.resize({width:a,height:o})}catch{this._canvas.width=a,this._canvas.height=o}var s=new tf(this._zr,i,n,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(s),s}},add:function(t,e,r){if(this._coords[t.id])return this._coords[t.id];var i=this._getCurrentNode().add(t,e,r);if(!i){var n=this._expand();if(!n)return;i=n.add(t,e,r)}return this._coords[t.id]=i,i},getCoordsScale:function(){var t=this._dpr;return[this._nodeWidth/this._canvas.width*t,this._nodeHeight/this._canvas.height*t]},getCoords:function(t){return this._coords[t]},dispose:function(){this._zr.dispose()}};function dd(){}dd.prototype={constructor:dd,setScene:function(t){this._scene=t,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(t){this._lightRoot=t,this.mainLight=new U.DirectionalLight({shadowBias:.005}),this.ambientLight=new U.AmbientLight,t.add(this.mainLight),t.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(t){var e=this.mainLight,r=this.ambientLight,i=t.getModel("light"),n=i.getModel("main"),a=i.getModel("ambient");e.intensity=n.get("intensity"),r.intensity=a.get("intensity"),e.color=U.parseColor(n.get("color")).slice(0,3),r.color=U.parseColor(a.get("color")).slice(0,3);var o=n.get("alpha")||0,s=n.get("beta")||0;e.position.setArray(U.directionFromAlphaBeta(o,s)),e.lookAt(U.Vector3.ZERO),e.castShadow=n.get("shadow"),e.shadowResolution=U.getShadowResolution(n.get("shadowQuality"))},updateAmbientCubemap:function(t,e,r){var i=e.getModel("light.ambientCubemap"),n=i.get("texture");if(n){this._cubemapLightsCache=this._cubemapLightsCache||{};var a=this._cubemapLightsCache[n];if(!a){var o=this;a=this._cubemapLightsCache[n]=U.createAmbientCubemap(i.option,t,r,function(){o._isSkyboxFromAmbientCubemap&&o._skybox.setEnvironmentMap(a.specular.cubemap),r.getZr().refresh()})}this._lightRoot.add(a.diffuse),this._lightRoot.add(a.specular),this._currentCubemapLights=a}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(t,e,r){var i=e.get("environment"),n=this;function a(){return n._skybox=n._skybox||new Ns,n._skybox}var o=a();if(i&&i!=="none")if(i==="auto")if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var s=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(s),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if(typeof i=="object"&&i.colorStops||typeof i=="string"&&Be(i)){this._isSkyboxFromAmbientCubemap=!1;var l=new U.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(l);var u=l.image=document.createElement("canvas");u.width=u.height=16;var f=u.getContext("2d"),h=new Kt({shape:{x:0,y:0,width:16,height:16},style:{fill:i}});Tp(f,h),o.attachScene(this._scene)}else{this._isSkyboxFromAmbientCubemap=!1;var l=U.loadTexture(i,r,{anisotropic:8,flipY:!1});o.setEnvironmentMap(l),o.attachScene(this._scene)}else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var v=e.coordinateSystem;if(this._skybox)if(v&&v.viewGL&&i!=="auto"&&!(i.match&&i.match(/.hdr$/))){var c=v.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[c]("fragment","SRGB_DECODE")}else this._skybox.material.undefine("fragment","SRGB_DECODE")}};var An=Zf.vec3,Lw=Ut.extend(function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new Ut.Attribute("position","float",3,"POSITION"),normal:new Ut.Attribute("normal","float",3,"NORMAL"),color:new Ut.Attribute("color","float",4,"COLOR")}}},{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(t){var e=this.attributes,r=this.getQuadVertexCount()*t,i=this.getQuadTriangleCount()*t;this.vertexCount!==r&&(e.position.init(r),e.normal.init(r),e.color.init(r)),this.triangleCount!==i&&(this.indices=r>65535?new Uint32Array(i*3):new Uint16Array(i*3))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var t=An.create(),e=An.create(),r=An.create(),i=[0,3,1,3,2,1];return function(n,a){var o=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;An.sub(t,n[1],n[0]),An.sub(e,n[2],n[1]),An.cross(r,t,e),An.normalize(r,r);for(var u=0;u<4;u++)o.set(this._vertexOffset+u,n[u]),l.set(this._vertexOffset+u,a),s.set(this._vertexOffset+u,r);for(var f=this._faceOffset*3,u=0;u<6;u++)this.indices[f+u]=i[u]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});Et(Lw.prototype,Wp);var pd=mr.firstNotNull,A3={x:0,y:2,z:1};function E3(t,e,r,i){var n=[0,0,0],a=i<0?r.getExtentMin():r.getExtentMax();n[A3[r.dim]]=a,t.position.setArray(n),t.rotation.identity(),e.distance=-Math.abs(a),e.normal.set(0,0,0),r.dim==="x"?(t.rotation.rotateY(i*Math.PI/2),e.normal.x=-i):r.dim==="z"?(t.rotation.rotateX(-i*Math.PI/2),e.normal.y=-i):(i>0&&t.rotation.rotateY(Math.PI),e.normal.z=-i)}function $f(t,e,r){this.rootNode=new U.Node;var i=new U.Mesh({geometry:new qf({useNativeLine:!1}),material:e,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),n=new U.Mesh({geometry:new Lw,material:r,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(n),this.rootNode.add(i),this.faceInfo=t,this.plane=new U.Plane,this.linesMesh=i,this.quadsMesh=n}$f.prototype.update=function(t,e,r){var i=t.coordinateSystem,n=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],a=this.linesMesh.geometry,o=this.quadsMesh.geometry;a.convertToDynamicArray(!0),o.convertToDynamicArray(!0),this._updateSplitLines(a,n,t,r),this._udpateSplitAreas(o,n,t,r),a.convertToTypedArray(),o.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);E3(this.rootNode,this.plane,s,this.faceInfo[3])};$f.prototype._updateSplitLines=function(t,e,r,i){var n=i.getDevicePixelRatio();e.forEach(function(a,o){var s=a.model,l=e[1-o].getExtent();if(!a.scale.isBlank()){var u=s.getModel("splitLine",r.getModel("splitLine"));if(u.get("show")){var f=u.getModel("lineStyle"),h=f.get("color"),v=pd(f.get("opacity"),1),c=pd(f.get("width"),1);h=j(h)?h:[h];for(var d=a.getTicksCoords({tickModel:u}),p=0,g=0;g65535?new Uint32Array(r*3):new Uint16Array(r*3))},setSpriteAlign:function(t,e,r,i,n){r==null&&(r="left"),i==null&&(i="top");var a,o,s,l;switch(n=n||0,r){case"left":a=n,s=e[0]+n;break;case"center":case"middle":a=-e[0]/2,s=e[0]/2;break;case"right":a=-e[0]-n,s=-n;break}switch(i){case"bottom":o=n,l=e[1]+n;break;case"middle":o=-e[1]/2,l=e[1]/2;break;case"top":o=-e[1]-n,l=-n;break}var u=t*4,f=this.attributes.offset;f.set(u,[a,l]),f.set(u+1,[s,l]),f.set(u+2,[s,o]),f.set(u+3,[a,o])},addSprite:function(t,e,r,i,n,a){var o=this._vertexOffset;this.setSprite(this._vertexOffset/4,t,e,r,i,n,a);for(var s=0;s 0.0) { currProj = clipNear(currProj, nextProj); } else if (prevProj.w > 0.0) { currProj = clipNear(currProj, prevProj); } } vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw; vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw; vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw; vec2 dir; float len = offset; if (position == positionPrev) { dir = normalize(nextScreen - currScreen); } else if (position == positionNext) { dir = normalize(currScreen - prevScreen); } else { vec2 dirA = normalize(currScreen - prevScreen); vec2 dirB = normalize(nextScreen - currScreen); vec2 tanget = normalize(dirA + dirB); float miter = 1.0 / max(dot(tanget, dirA), 0.5); len *= miter; dir = tanget; } dir = vec2(-dir.y, dir.x) * len; currScreen += dir; currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w); @end @export ecgl.meshLines3D.vertex attribute vec3 position: POSITION; attribute vec3 positionPrev; attribute vec3 positionNext; attribute float offset; attribute vec4 a_Color : COLOR; #ifdef VERTEX_ANIMATION attribute vec3 prevPosition; attribute vec3 prevPositionPrev; attribute vec3 prevPositionNext; uniform float percent : 1.0; #endif uniform mat4 worldViewProjection : WORLDVIEWPROJECTION; uniform vec4 viewport : VIEWPORT; uniform float near : NEAR; varying vec4 v_Color; @import ecgl.common.wireframe.vertexHeader @import ecgl.lines3D.clipNear void main() { @import ecgl.lines3D.expandLine gl_Position = currProj; v_Color = a_Color; @import ecgl.common.wireframe.vertexMain } @end @export ecgl.meshLines3D.fragment uniform vec4 color : [1.0, 1.0, 1.0, 1.0]; varying vec4 v_Color; @import ecgl.common.wireframe.fragmentHeader @import clay.util.srgb void main() { #ifdef SRGB_DECODE gl_FragColor = sRGBToLinear(color * v_Color); #else gl_FragColor = color * v_Color; #endif @import ecgl.common.wireframe.fragmentMain } @end`;var ny=mr.firstNotNull;U.Shader.import(C3);var Cn={x:0,y:2,z:1};const D3=ze.extend({type:"grid3D",__ecgl__:!0,init:function(t,e){var r=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]],i=["x","y","z"],n=new U.Material({shader:U.createShader("ecgl.color"),depthMask:!1,transparent:!0}),a=new U.Material({shader:U.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});n.define("fragment","DOUBLE_SIDED"),n.define("both","VERTEX_COLOR"),this.groupGL=new U.Node,this._control=new Dw({zr:e.getZr()}),this._control.init(),this._faces=r.map(function(s){var l=new $f(s,a,n);return this.groupGL.add(l.rootNode),l},this),this._axes=i.map(function(s){var l=new Xp(s,a);return this.groupGL.add(l.rootNode),l},this);var o=e.getDevicePixelRatio();this._axisLabelSurface=new vd({width:256,height:256,devicePixelRatio:o}),this._axisLabelSurface.onupdate=function(){e.getZr().refresh()},this._axisPointerLineMesh=new U.Mesh({geometry:new qf({useNativeLine:!1}),material:a,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new vd({width:128,height:128,devicePixelRatio:o}),this._axisPointerLabelsMesh=new Pw({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new U.Node,this._sceneHelper=new dd,this._sceneHelper.initLight(this._lightRoot)},render:function(t,e,r){this._model=t,this._api=r;var i=t.coordinateSystem;i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var n=this._control;n.setViewGL(i.viewGL);var a=t.getModel("viewControl");n.setFromViewControlModel(a,0),this._axisLabelSurface.clear(),n.off("update"),t.get("show")&&(this._faces.forEach(function(o){o.update(t,e,r)},this),this._axes.forEach(function(o){o.update(t,this._axisLabelSurface,r)},this)),n.on("update",this._onCameraChange.bind(this,t,r),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(t),i.viewGL.setPostEffect(t.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._initMouseHandler(t)},afterRender:function(t,e,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,t,r),this._sceneHelper.updateSkybox(n,t,r)},showAxisPointer:function(t,e,r,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(t,e,r,i){this._doHideAxisPointer()},_initMouseHandler:function(t){var e=t.coordinateSystem,r=e.viewGL;t.get("show")&&t.get("axisPointer.show")?r.on("mousemove",this._updateAxisPointerOnMousePosition,this):r.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(t){if(!t.target){for(var e=this._model,r=e.coordinateSystem,i=r.viewGL,n=i.castRay(t.offsetX,t.offsetY,new U.Ray),a,o=0;oi[1]?0:1,s=this._faces[r*2+o],l=this._faces[r*2+1-o];s.rootNode.invisible=!0,l.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var t=this._model.coordinateSystem,e=t.getAxis("x"),r=t.getAxis("y"),i=t.getAxis("z"),n=i.getExtentMax(),a=i.getExtentMin(),o=e.getExtentMin(),s=e.getExtentMax(),l=r.getExtentMax(),u=r.getExtentMin(),f=this._axes[0].rootNode,h=this._axes[1].rootNode,v=this._axes[2].rootNode,c=this._faces,d=c[4].rootNode.invisible?u:l,p=c[2].rootNode.invisible?n:a,g=c[0].rootNode.invisible?o:s,m=c[2].rootNode.invisible?n:a,_=c[0].rootNode.invisible?s:o,y=c[4].rootNode.invisible?u:l;f.rotation.identity(),h.rotation.identity(),v.rotation.identity(),c[4].rootNode.invisible&&(this._axes[0].flipped=!0,f.rotation.rotateX(Math.PI)),c[0].rootNode.invisible&&(this._axes[1].flipped=!0,h.rotation.rotateZ(Math.PI)),c[4].rootNode.invisible&&(this._axes[2].flipped=!0,v.rotation.rotateY(Math.PI)),f.position.set(0,p,d),h.position.set(g,m,0),v.position.set(_,0,y),f.update(),h.update(),v.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var t=this._control.getCamera(),e=[new U.Vector4,new U.Vector4],r=new U.Vector4;this.groupGL.getWorldPosition(r),r.w=1,r.transformMat4(t.viewMatrix).transformMat4(t.projectionMatrix),r.x/=r.w,r.y/=r.w,this._axes.forEach(function(i){var n=i.axisLineCoords;i.labelsMesh.geometry;for(var a=0;ar.y?"bottom":"top"):(h="middle",f=l>r.x?"left":"right"),i.setSpriteAlign(f,h,this._api)},this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(t){var e=this._model.coordinateSystem,r=e.dataToPoint(t),i=this._axisPointerLineMesh,n=i.geometry,a=this._model.getModel("axisPointer"),o=this._api.getDevicePixelRatio();n.convertToDynamicArray(!0);function s(b){return mr.firstNotNull(b.model.get("axisPointer.show"),a.get("show"))}function l(b){var A=b.model.getModel("axisPointer",a),M=A.getModel("lineStyle"),E=U.parseColor(M.get("color")),D=ny(M.get("width"),1),R=ny(M.get("opacity"),1);return E[3]*=R,{color:E,lineWidth:D}}for(var u=0;u 0.0) { if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) { discard; } } #ifdef USE_VSM depth = depth * 0.5 + 0.5; float moment1 = depth; float moment2 = depth * depth; #ifdef SUPPORT_STANDARD_DERIVATIVES float dx = dFdx(depth); float dy = dFdy(depth); moment2 += 0.25*(dx*dx+dy*dy); #endif gl_FragColor = vec4(moment1, moment2, 0.0, 1.0); #else #ifdef SUPPORT_STANDARD_DERIVATIVES float dx = dFdx(depth); float dy = dFdy(depth); depth += sqrt(dx*dx + dy*dy) * slopeScale + bias; #else depth += bias; #endif gl_FragColor = encodeFloat(depth * 0.5 + 0.5); #endif } @end @export clay.sm.debug_depth uniform sampler2D depthMap; varying vec2 v_Texcoord; @import clay.util.decode_float void main() { vec4 tex = texture2D(depthMap, v_Texcoord); #ifdef USE_VSM gl_FragColor = vec4(tex.rgb, 1.0); #else float depth = decodeFloat(tex); gl_FragColor = vec4(depth, depth, depth, 1.0); #endif } @end @export clay.sm.distance.vertex uniform mat4 worldViewProjection : WORLDVIEWPROJECTION; uniform mat4 world : WORLD; attribute vec3 position : POSITION; @import clay.chunk.skinning_header varying vec3 v_WorldPosition; void main (){ vec4 P = vec4(position, 1.0); #ifdef SKINNING @import clay.chunk.skin_matrix P = skinMatrixWS * P; #endif #ifdef INSTANCING @import clay.chunk.instancing_matrix P = instanceMat * P; #endif gl_Position = worldViewProjection * P; v_WorldPosition = (world * P).xyz; } @end @export clay.sm.distance.fragment uniform vec3 lightPosition; uniform float range : 100; varying vec3 v_WorldPosition; @import clay.util.encode_float void main(){ float dist = distance(lightPosition, v_WorldPosition); #ifdef USE_VSM gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0); #else dist = dist / range; gl_FragColor = encodeFloat(dist); #endif } @end @export clay.plugin.shadow_map_common @import clay.util.decode_float float tapShadowMap(sampler2D map, vec2 uv, float z){ vec4 tex = texture2D(map, uv); return step(z, decodeFloat(tex) * 2.0 - 1.0); } float pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) { float shadowContrib = tapShadowMap(map, uv, z); vec2 offset = vec2(1.0 / textureSize) * scale; #ifdef PCF_KERNEL_SIZE for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{ shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z); }} return shadowContrib / float(PCF_KERNEL_SIZE + 1); #else shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z); shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z); shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z); shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z); shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z); shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z); shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z); shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z); return shadowContrib / 9.0; #endif } float pcf(sampler2D map, vec2 uv, float z, float textureSize) { return pcf(map, uv, z, textureSize, vec2(1.0)); } float chebyshevUpperBound(vec2 moments, float z){ float p = 0.0; z = z * 0.5 + 0.5; if (z <= moments.x) { p = 1.0; } float variance = moments.y - moments.x * moments.x; variance = max(variance, 0.0000001); float mD = moments.x - z; float pMax = variance / (variance + mD * mD); pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0); return max(p, pMax); } float computeShadowContrib( sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset ) { vec4 posInLightSpace = lightVPM * vec4(position, 1.0); posInLightSpace.xyz /= posInLightSpace.w; float z = posInLightSpace.z; if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) && all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){ vec2 uv = (posInLightSpace.xy+1.0) / 2.0; #ifdef USE_VSM vec2 moments = texture2D(map, uv * scale + offset).xy; return chebyshevUpperBound(moments, z); #else return pcf(map, uv * scale + offset, z, textureSize, scale); #endif } return 1.0; } float computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) { return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0)); } float computeShadowContribOmni(samplerCube map, vec3 direction, float range) { float dist = length(direction); vec4 shadowTex = textureCube(map, direction); #ifdef USE_VSM vec2 moments = shadowTex.xy; float variance = moments.y - moments.x * moments.x; float mD = moments.x - dist; float p = variance / (variance + mD * mD); if(moments.x + 0.001 < dist){ return clamp(p, 0.0, 1.0); }else{ return 1.0; } #else return step(dist, (decodeFloat(shadowTex) + 0.0002) * range); #endif } @end @export clay.plugin.compute_shadow_map #if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT) #ifdef SPOT_LIGHT_SHADOWMAP_COUNT uniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable; uniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable; uniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable; #endif #ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT #if defined(SHADOW_CASCADE) uniform sampler2D directionalLightShadowMaps[1]:unconfigurable; uniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable; uniform float directionalLightShadowMapSizes[1]:unconfigurable; uniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable; uniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable; #else uniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable; uniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable; uniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable; #endif #endif #ifdef POINT_LIGHT_SHADOWMAP_COUNT uniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable; #endif uniform bool shadowEnabled : true; #ifdef PCF_KERNEL_SIZE uniform vec2 pcfKernel[PCF_KERNEL_SIZE]; #endif @import clay.plugin.shadow_map_common #if defined(SPOT_LIGHT_SHADOWMAP_COUNT) void computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) { float shadowContrib; for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{ shadowContrib = computeShadowContrib( spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position, spotLightShadowMapSizes[_idx_] ); shadowContribs[_idx_] = shadowContrib; }} for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{ shadowContribs[_idx_] = 1.0; }} } #endif #if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) #ifdef SHADOW_CASCADE void computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){ float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) / (gl_DepthRange.far - gl_DepthRange.near); float shadowContrib; shadowContribs[0] = 1.0; for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{ if ( depth >= shadowCascadeClipsNear[_idx_] && depth <= shadowCascadeClipsFar[_idx_] ) { shadowContrib = computeShadowContrib( directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position, directionalLightShadowMapSizes[0], vec2(1.0 / float(SHADOW_CASCADE), 1.0), vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0) ); shadowContribs[0] = shadowContrib; } }} for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{ shadowContribs[_idx_] = 1.0; }} } #else void computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){ float shadowContrib; for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{ shadowContrib = computeShadowContrib( directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position, directionalLightShadowMapSizes[_idx_] ); shadowContribs[_idx_] = shadowContrib; }} for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{ shadowContribs[_idx_] = 1.0; }} } #endif #endif #if defined(POINT_LIGHT_SHADOWMAP_COUNT) void computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){ vec3 lightPosition; vec3 direction; for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{ lightPosition = pointLightPosition[_idx_]; direction = position - lightPosition; shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]); }} for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{ shadowContribs[_idx_] = 1.0; }} } #endif #endif @end`;var Ni=["px","nx","py","ny","pz","nz"];$.import(P3);function Hc(t,e,r){if(r==="alphaMap")return t.material.get("diffuseMap");if(r==="alphaCutoff"){if(t.material.isDefined("fragment","ALPHA_TEST")&&t.material.get("diffuseMap")){var i=t.material.get("alphaCutoff");return i||0}return 0}else return r==="uvRepeat"?t.material.get("uvRepeat"):r==="uvOffset"?t.material.get("uvOffset"):e.get(r)}function oy(t,e){var r=t.material,i=e.material;return r.get("diffuseMap")!==i.get("diffuseMap")||(r.get("alphaCutoff")||0)!==(i.get("alphaCutoff")||0)}var qr=Se.extend(function(){return{softShadow:qr.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new he,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new rf}},function(){this._gaussianPassH=new Oe({fragment:$.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new Oe({fragment:$.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new Oe({fragment:$.source("clay.sm.debug_depth")})},{render:function(t,e,r,i){r||(r=e.getMainCamera()),this.trigger("beforerender",this,t,e,r),this._renderShadowPass(t,e,r,i),this.trigger("afterrender",this,t,e,r)},renderDebug:function(t,e){t.saveClear();var r=t.viewport,i=0,n=0,a=e||r.width/4,o=a;this.softShadow===qr.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM");for(var s in this._textures){var l=this._textures[s];t.setViewport(i,n,a*l.width/l.height,o),this._outputDepthPass.setUniform("depthMap",l),this._outputDepthPass.render(t),i+=a*l.width/l.height}t.setViewport(r),t.restoreClear()},_updateReceivers:function(t,e){if(e.receiveShadow?(this._receivers.push(e),e.material.set("shadowEnabled",1),e.material.set("pcfKernel",this.kernelPCF)):e.material.set("shadowEnabled",0),this.softShadow===qr.VSM)e.material.define("fragment","USE_VSM"),e.material.undefine("fragment","PCF_KERNEL_SIZE");else{e.material.undefine("fragment","USE_VSM");var r=this.kernelPCF;r&&r.length?e.material.define("fragment","PCF_KERNEL_SIZE",r.length/2):e.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(t,e){var r=this;e.traverse(function(a){a.isRenderable()&&r._updateReceivers(t,a)});for(var i=0;i4){console.warn("Support at most 4 cascade");continue}d.shadowCascade>1&&(v=d),this.renderDirectionalLightShadow(t,e,r,d,f,u,l)}else d.type==="SPOT_LIGHT"?this.renderSpotLightShadow(t,e,d,s,o):d.type==="POINT_LIGHT"&&this.renderPointLightShadow(t,e,d,h);this._shadowMapNumber[d.type]++}for(var p in this._shadowMapNumber)for(var g=this._shadowMapNumber[p],m=p+"_SHADOWMAP_COUNT",c=0;c0?y.define("fragment",m,g):y.isDefined("fragment",m)&&y.undefine("fragment",m))}for(var c=0;c0){var T=l.map(S);if(x.directionalLightShadowMaps={value:l,type:"tv"},x.directionalLightMatrices={value:u,type:"m4v"},x.directionalLightShadowMapSizes={value:T,type:"1fv"},v){var w=f.slice(),b=f.slice();w.pop(),b.shift(),w.reverse(),b.reverse(),u.reverse(),x.shadowCascadeClipsNear={value:w,type:"1fv"},x.shadowCascadeClipsFar={value:b,type:"1fv"}}}if(o.length>0){var A=o.map(S),x=e.shadowUniforms;x.spotLightShadowMaps={value:o,type:"tv"},x.spotLightMatrices={value:s,type:"m4v"},x.spotLightShadowMapSizes={value:A,type:"1fv"}}h.length>0&&(x.pointLightShadowMaps={value:h,type:"tv"})},renderDirectionalLightShadow:function(){var t=new Wf,e=new q,r=new ye,i=new q,n=new q,a=new q,o=new q;return function(s,l,u,f,h,v,c){var d=this._getDepthMaterial(f),p={getMaterial:function(ot){return ot.shadowDepthMaterial||d},isMaterialChanged:oy,getUniform:Hc,ifRender:function(ot){return ot.castShadow},sortCompare:yr.opaqueSortCompare};if(!l.viewBoundingBoxLastFrame.isFinite()){var g=l.getBoundingBox();l.viewBoundingBoxLastFrame.copy(g).applyTransform(u.viewMatrix)}var m=Math.min(-l.viewBoundingBoxLastFrame.min.z,u.far),_=Math.max(-l.viewBoundingBoxLastFrame.max.z,u.near),y=this._getDirectionalLightCamera(f,l,u),x=a.array;o.copy(y.projectionMatrix),z.invert(n.array,y.worldTransform.array),z.multiply(n.array,n.array,u.worldTransform.array),z.multiply(x,o.array,n.array);for(var S=[],T=u instanceof ve,w=(u.near+u.far)/(u.near-u.far),b=2*u.near*u.far/(u.near-u.far),A=0;A<=f.shadowCascade;A++){var M=_*Math.pow(m/_,A/f.shadowCascade),E=_+(m-_)*A/f.shadowCascade,D=M*f.cascadeSplitLogFactor+E*(1-f.cascadeSplitLogFactor);S.push(D),h.push(-(-D*w+b)/-D)}var R=this._getTexture(f,f.shadowCascade);c.push(R);var P=s.viewport,I=s.gl;this._frameBuffer.attach(R),this._frameBuffer.bind(s),I.clear(I.COLOR_BUFFER_BIT|I.DEPTH_BUFFER_BIT);for(var A=0;AM?A>E?d[T>0?"px":"nx"]=!0:d[b>0?"pz":"nz"]=!0:M>E?d[w>0?"py":"ny"]=!0:d[b>0?"pz":"nz"]=!0}for(var x=0;x0){var e=this.outputs[t];e.keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t])}}}),sy=Se.extend(function(){return{nodes:[]}},{dirty:function(){this._dirty=!0},addNode:function(t){this.nodes.indexOf(t)>=0||(this.nodes.push(t),this._dirty=!0)},removeNode:function(t){typeof t=="string"&&(t=this.getNodeByName(t));var e=this.nodes.indexOf(t);e>=0&&(this.nodes.splice(e,1),this._dirty=!0)},getNodeByName:function(t){for(var e=0;e=e.COLOR_ATTACHMENT0&&l<=e.COLOR_ATTACHMENT0+8&&f.push(l);u.drawBuffersEXT(f)}t.saveClear(),t.clearBit=F.DEPTH_BUFFER_BIT|F.COLOR_BUFFER_BIT,r=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),t.restoreClear(),i.unbind(t)}this.trigger("afterrender",r),this._rendering=!1,this._rendered=!0}}),O3=Fs.extend(function(){return{texture:null,outputs:{color:{}}}},function(){},{getOutput:function(t,e){return this.texture},beforeFrame:function(){},afterFrame:function(){}}),B3=Fs.extend(function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}},function(){var t=new Oe({fragment:this.shader});this.pass=t},{render:function(t,e){this.trigger("beforerender",t),this._rendering=!0;var r=t.gl;for(var i in this.inputLinks){var n=this.inputLinks[i],a=n.node.getOutput(t,n.pin);this.pass.setUniform(i,a)}if(!this.outputs)this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(t),this.pass.render(t,e);else{this.pass.outputs={};var o={};for(var s in this.outputs){var l=this.updateParameter(s,t);isNaN(l.width)&&this.updateParameter(s,t);var u=this.outputs[s],f=this._compositor.allocateTexture(l);this._outputTextures[s]=f;var h=u.attachment||r.COLOR_ATTACHMENT0;typeof h=="string"&&(h=r[h]),o[h]=f}this._compositor.getFrameBuffer().bind(t);for(var h in o)this._compositor.getFrameBuffer().attach(o[h],h);this.pass.render(t),this._compositor.getFrameBuffer().updateMipmap(t)}for(var i in this.inputLinks){var n=this.inputLinks[i];n.node.removeReference(n.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",t)},updateParameter:function(t,e){var r=this.outputs[t],i=r.parameters,n=r._parametersCopy;if(n||(n=r._parametersCopy={}),i)for(var a in i)a!=="width"&&a!=="height"&&(n[a]=i[a]);var o,s;return typeof i.width=="function"?o=i.width.call(this,e):o=i.width,typeof i.height=="function"?s=i.height.call(this,e):s=i.height,o=Math.ceil(o),s=Math.ceil(s),(n.width!==o||n.height!==s)&&this._outputTextures[t]&&this._outputTextures[t].dispose(e),n.width=o,n.height=s,n},setParameter:function(t,e){this.pass.setUniform(t,e)},getParameter:function(t){return this.pass.getUniform(t)},setParameters:function(t){for(var e in t)this.setParameter(e,t[e])},define:function(t,e){this.pass.material.define("fragment",t,e)},undefine:function(t){this.pass.material.undefine("fragment",t)},removeReference:function(t){if(this._outputReferences[t]--,this._outputReferences[t]===0){var e=this.outputs[t];e.keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t])}},clear:function(){Fs.prototype.clear.call(this),this.pass.material.disableTexturesAll()}});const F3=`@export clay.compositor.coloradjust varying vec2 v_Texcoord; uniform sampler2D texture; uniform float brightness : 0.0; uniform float contrast : 1.0; uniform float exposure : 0.0; uniform float gamma : 1.0; uniform float saturation : 1.0; const vec3 w = vec3(0.2125, 0.7154, 0.0721); void main() { vec4 tex = texture2D( texture, v_Texcoord); vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0); color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0); color = clamp( color * pow(2.0, exposure), 0.0, 1.0); color = clamp( pow(color, vec3(gamma)), 0.0, 1.0); float luminance = dot( color, w ); color = mix(vec3(luminance), color, saturation); gl_FragColor = vec4(color, tex.a); } @end @export clay.compositor.brightness varying vec2 v_Texcoord; uniform sampler2D texture; uniform float brightness : 0.0; void main() { vec4 tex = texture2D( texture, v_Texcoord); vec3 color = tex.rgb + vec3(brightness); gl_FragColor = vec4(color, tex.a); } @end @export clay.compositor.contrast varying vec2 v_Texcoord; uniform sampler2D texture; uniform float contrast : 1.0; void main() { vec4 tex = texture2D( texture, v_Texcoord); vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5); gl_FragColor = vec4(color, tex.a); } @end @export clay.compositor.exposure varying vec2 v_Texcoord; uniform sampler2D texture; uniform float exposure : 0.0; void main() { vec4 tex = texture2D(texture, v_Texcoord); vec3 color = tex.rgb * pow(2.0, exposure); gl_FragColor = vec4(color, tex.a); } @end @export clay.compositor.gamma varying vec2 v_Texcoord; uniform sampler2D texture; uniform float gamma : 1.0; void main() { vec4 tex = texture2D(texture, v_Texcoord); vec3 color = pow(tex.rgb, vec3(gamma)); gl_FragColor = vec4(color, tex.a); } @end @export clay.compositor.saturation varying vec2 v_Texcoord; uniform sampler2D texture; uniform float saturation : 1.0; const vec3 w = vec3(0.2125, 0.7154, 0.0721); void main() { vec4 tex = texture2D(texture, v_Texcoord); vec3 color = tex.rgb; float luminance = dot(color, w); color = mix(vec3(luminance), color, saturation); gl_FragColor = vec4(color, tex.a); } @end`,Nw=`@export clay.compositor.kernel.gaussian_9 float gaussianKernel[9]; gaussianKernel[0] = 0.07; gaussianKernel[1] = 0.09; gaussianKernel[2] = 0.12; gaussianKernel[3] = 0.14; gaussianKernel[4] = 0.16; gaussianKernel[5] = 0.14; gaussianKernel[6] = 0.12; gaussianKernel[7] = 0.09; gaussianKernel[8] = 0.07; @end @export clay.compositor.kernel.gaussian_13 float gaussianKernel[13]; gaussianKernel[0] = 0.02; gaussianKernel[1] = 0.03; gaussianKernel[2] = 0.06; gaussianKernel[3] = 0.08; gaussianKernel[4] = 0.11; gaussianKernel[5] = 0.13; gaussianKernel[6] = 0.14; gaussianKernel[7] = 0.13; gaussianKernel[8] = 0.11; gaussianKernel[9] = 0.08; gaussianKernel[10] = 0.06; gaussianKernel[11] = 0.03; gaussianKernel[12] = 0.02; @end @export clay.compositor.gaussian_blur #define SHADER_NAME gaussian_blur uniform sampler2D texture;varying vec2 v_Texcoord; uniform float blurSize : 2.0; uniform vec2 textureSize : [512.0, 512.0]; uniform float blurDir : 0.0; @import clay.util.rgbm @import clay.util.clamp_sample void main (void) { @import clay.compositor.kernel.gaussian_9 vec2 off = blurSize / textureSize; off *= vec2(1.0 - blurDir, blurDir); vec4 sum = vec4(0.0); float weightAll = 0.0; for (int i = 0; i < 9; i++) { float w = gaussianKernel[i]; vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off)); sum += texel * w; weightAll += w; } gl_FragColor = encodeHDR(sum / max(weightAll, 0.01)); } @end `,k3=`@export clay.compositor.hdr.log_lum varying vec2 v_Texcoord; uniform sampler2D texture; const vec3 w = vec3(0.2125, 0.7154, 0.0721); @import clay.util.rgbm void main() { vec4 tex = decodeHDR(texture2D(texture, v_Texcoord)); float luminance = dot(tex.rgb, w); luminance = log(luminance + 0.001); gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0)); } @end @export clay.compositor.hdr.lum_adaption varying vec2 v_Texcoord; uniform sampler2D adaptedLum; uniform sampler2D currentLum; uniform float frameTime : 0.02; @import clay.util.rgbm void main() { float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r; float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r); fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime)); gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0)); } @end @export clay.compositor.lum varying vec2 v_Texcoord; uniform sampler2D texture; const vec3 w = vec3(0.2125, 0.7154, 0.0721); void main() { vec4 tex = texture2D( texture, v_Texcoord ); float luminance = dot(tex.rgb, w); gl_FragColor = vec4(vec3(luminance), 1.0); } @end`,Ow=` @export clay.compositor.lut varying vec2 v_Texcoord; uniform sampler2D texture; uniform sampler2D lookup; void main() { vec4 tex = texture2D(texture, v_Texcoord); float blueColor = tex.b * 63.0; vec2 quad1; quad1.y = floor(floor(blueColor) / 8.0); quad1.x = floor(blueColor) - (quad1.y * 8.0); vec2 quad2; quad2.y = floor(ceil(blueColor) / 8.0); quad2.x = ceil(blueColor) - (quad2.y * 8.0); vec2 texPos1; texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r); texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g); vec2 texPos2; texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r); texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g); vec4 newColor1 = texture2D(lookup, texPos1); vec4 newColor2 = texture2D(lookup, texPos2); vec4 newColor = mix(newColor1, newColor2, fract(blueColor)); gl_FragColor = vec4(newColor.rgb, tex.w); } @end`,z3=`@export clay.compositor.vignette #define OUTPUT_ALPHA varying vec2 v_Texcoord; uniform sampler2D texture; uniform float darkness: 1; uniform float offset: 1; @import clay.util.rgbm void main() { vec4 texel = decodeHDR(texture2D(texture, v_Texcoord)); gl_FragColor.rgb = texel.rgb; vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset); gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a)); } @end`,Bw=`@export clay.compositor.output #define OUTPUT_ALPHA varying vec2 v_Texcoord; uniform sampler2D texture; @import clay.util.rgbm void main() { vec4 tex = decodeHDR(texture2D(texture, v_Texcoord)); gl_FragColor.rgb = tex.rgb; #ifdef OUTPUT_ALPHA gl_FragColor.a = tex.a; #else gl_FragColor.a = 1.0; #endif gl_FragColor = encodeHDR(gl_FragColor); #ifdef PREMULTIPLY_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif } @end`,Fw=`@export clay.compositor.bright uniform sampler2D texture; uniform float threshold : 1; uniform float scale : 1.0; uniform vec2 textureSize: [512, 512]; varying vec2 v_Texcoord; const vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721); @import clay.util.rgbm vec4 median(vec4 a, vec4 b, vec4 c) { return a + b + c - min(min(a, b), c) - max(max(a, b), c); } void main() { vec4 texel = decodeHDR(texture2D(texture, v_Texcoord)); #ifdef ANTI_FLICKER vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0); vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz)); vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz)); vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy)); vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy)); texel = median(median(texel, s1, s2), s3, s4); #endif float lum = dot(texel.rgb , lumWeight); vec4 color; if (lum > threshold && texel.a > 0.0) { color = vec4(texel.rgb * scale, texel.a * scale); } else { color = vec4(0.0); } gl_FragColor = encodeHDR(color); } @end `,kw=`@export clay.compositor.downsample uniform sampler2D texture; uniform vec2 textureSize : [512, 512]; varying vec2 v_Texcoord; @import clay.util.rgbm float brightness(vec3 c) { return max(max(c.r, c.g), c.b); } @import clay.util.clamp_sample void main() { vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy; #ifdef ANTI_FLICKER vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb; vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb; vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb; vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb; float s1w = 1.0 / (brightness(s1) + 1.0); float s2w = 1.0 / (brightness(s2) + 1.0); float s3w = 1.0 / (brightness(s3) + 1.0); float s4w = 1.0 / (brightness(s4) + 1.0); float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w); vec4 color = vec4( (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum, 1.0 ); #else vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy)); color += decodeHDR(clampSample(texture, v_Texcoord + d.zy)); color += decodeHDR(clampSample(texture, v_Texcoord + d.xw)); color += decodeHDR(clampSample(texture, v_Texcoord + d.zw)); color *= 0.25; #endif gl_FragColor = encodeHDR(color); } @end`,zw=` @export clay.compositor.upsample #define HIGH_QUALITY uniform sampler2D texture; uniform vec2 textureSize : [512, 512]; uniform float sampleScale: 0.5; varying vec2 v_Texcoord; @import clay.util.rgbm @import clay.util.clamp_sample void main() { #ifdef HIGH_QUALITY vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale; vec4 s; s = decodeHDR(clampSample(texture, v_Texcoord - d.xy)); s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0; s += decodeHDR(clampSample(texture, v_Texcoord - d.zy)); s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0; s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0; s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0; s += decodeHDR(clampSample(texture, v_Texcoord + d.zy)); s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0; s += decodeHDR(clampSample(texture, v_Texcoord + d.xy)); gl_FragColor = encodeHDR(s / 16.0); #else vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy; vec4 s; s = decodeHDR(clampSample(texture, v_Texcoord + d.xy)); s += decodeHDR(clampSample(texture, v_Texcoord + d.zy)); s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)); s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)); gl_FragColor = encodeHDR(s / 4.0); #endif } @end`,Uw=`@export clay.compositor.hdr.composite #define TONEMAPPING uniform sampler2D texture; #ifdef BLOOM_ENABLED uniform sampler2D bloom; #endif #ifdef LENSFLARE_ENABLED uniform sampler2D lensflare; uniform sampler2D lensdirt; #endif #ifdef LUM_ENABLED uniform sampler2D lum; #endif #ifdef LUT_ENABLED uniform sampler2D lut; #endif #ifdef COLOR_CORRECTION uniform float brightness : 0.0; uniform float contrast : 1.0; uniform float saturation : 1.0; #endif #ifdef VIGNETTE uniform float vignetteDarkness: 1.0; uniform float vignetteOffset: 1.0; #endif uniform float exposure : 1.0; uniform float bloomIntensity : 0.25; uniform float lensflareIntensity : 1; varying vec2 v_Texcoord; @import clay.util.srgb vec3 ACESToneMapping(vec3 color) { const float A = 2.51; const float B = 0.03; const float C = 2.43; const float D = 0.59; const float E = 0.14; return (color * (A * color + B)) / (color * (C * color + D) + E); } float eyeAdaption(float fLum) { return mix(0.2, fLum, 0.5); } #ifdef LUT_ENABLED vec3 lutTransform(vec3 color) { float blueColor = color.b * 63.0; vec2 quad1; quad1.y = floor(floor(blueColor) / 8.0); quad1.x = floor(blueColor) - (quad1.y * 8.0); vec2 quad2; quad2.y = floor(ceil(blueColor) / 8.0); quad2.x = ceil(blueColor) - (quad2.y * 8.0); vec2 texPos1; texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r); texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g); vec2 texPos2; texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r); texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g); vec4 newColor1 = texture2D(lut, texPos1); vec4 newColor2 = texture2D(lut, texPos2); vec4 newColor = mix(newColor1, newColor2, fract(blueColor)); return newColor.rgb; } #endif @import clay.util.rgbm void main() { vec4 texel = vec4(0.0); vec4 originalTexel = vec4(0.0); #ifdef TEXTURE_ENABLED texel = decodeHDR(texture2D(texture, v_Texcoord)); originalTexel = texel; #endif #ifdef BLOOM_ENABLED vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord)); texel.rgb += bloomTexel.rgb * bloomIntensity; texel.a += bloomTexel.a * bloomIntensity; #endif #ifdef LENSFLARE_ENABLED texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity; #endif texel.a = min(texel.a, 1.0); #ifdef LUM_ENABLED float fLum = texture2D(lum, vec2(0.5, 0.5)).r; float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum))); float exposureBias = adaptedLumDest * exposure; #else float exposureBias = exposure; #endif #ifdef TONEMAPPING texel.rgb *= exposureBias; texel.rgb = ACESToneMapping(texel.rgb); #endif texel = linearTosRGB(texel); #ifdef LUT_ENABLED texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0))); #endif #ifdef COLOR_CORRECTION texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0); texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0); float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721)); texel.rgb = mix(vec3(lum), texel.rgb, saturation); #endif #ifdef VIGNETTE vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset); texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv)); #endif gl_FragColor = encodeHDR(texel); #ifdef DEBUG #if DEBUG == 1 gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord))); #elif DEBUG == 2 gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity); #elif DEBUG == 3 gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity)); #endif #endif if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) { gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721)); } #ifdef PREMULTIPLY_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif } @end`,U3=`@export clay.compositor.lensflare #define SAMPLE_NUMBER 8 uniform sampler2D texture; uniform sampler2D lenscolor; uniform vec2 textureSize : [512, 512]; uniform float dispersal : 0.3; uniform float haloWidth : 0.4; uniform float distortion : 1.0; varying vec2 v_Texcoord; @import clay.util.rgbm vec4 textureDistorted( in vec2 texcoord, in vec2 direction, in vec3 distortion ) { return vec4( decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r, decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g, decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b, 1.0 ); } void main() { vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize; vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal; vec2 haloVec = normalize(ghostVec) * haloWidth; vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion); vec4 result = vec4(0.0); for (int i = 0; i < SAMPLE_NUMBER; i++) { vec2 offset = fract(texcoord + ghostVec * float(i)); float weight = length(vec2(0.5) - offset) / length(vec2(0.5)); weight = pow(1.0 - weight, 10.0); result += textureDistorted(offset, normalize(ghostVec), distortion) * weight; } result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5))); float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5)); weight = pow(1.0 - weight, 10.0); vec2 offset = fract(texcoord + haloVec); result += textureDistorted(offset, normalize(ghostVec), distortion) * weight; gl_FragColor = result; } @end`,Hw=`@export clay.compositor.blend #define SHADER_NAME blend #ifdef TEXTURE1_ENABLED uniform sampler2D texture1; uniform float weight1 : 1.0; #endif #ifdef TEXTURE2_ENABLED uniform sampler2D texture2; uniform float weight2 : 1.0; #endif #ifdef TEXTURE3_ENABLED uniform sampler2D texture3; uniform float weight3 : 1.0; #endif #ifdef TEXTURE4_ENABLED uniform sampler2D texture4; uniform float weight4 : 1.0; #endif #ifdef TEXTURE5_ENABLED uniform sampler2D texture5; uniform float weight5 : 1.0; #endif #ifdef TEXTURE6_ENABLED uniform sampler2D texture6; uniform float weight6 : 1.0; #endif varying vec2 v_Texcoord; @import clay.util.rgbm void main() { vec4 tex = vec4(0.0); #ifdef TEXTURE1_ENABLED tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1; #endif #ifdef TEXTURE2_ENABLED tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2; #endif #ifdef TEXTURE3_ENABLED tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3; #endif #ifdef TEXTURE4_ENABLED tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4; #endif #ifdef TEXTURE5_ENABLED tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5; #endif #ifdef TEXTURE6_ENABLED tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6; #endif gl_FragColor = encodeHDR(tex); } @end`,Vw=`@export clay.compositor.fxaa uniform sampler2D texture; uniform vec4 viewport : VIEWPORT; varying vec2 v_Texcoord; #define FXAA_REDUCE_MIN (1.0/128.0) #define FXAA_REDUCE_MUL (1.0/8.0) #define FXAA_SPAN_MAX 8.0 @import clay.util.rgbm void main() { vec2 resolution = 1.0 / viewport.zw; vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz; vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz; vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz; vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz; vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) ); vec3 rgbM = rgbaM.xyz; float opacity = rgbaM.w; vec3 luma = vec3( 0.299, 0.587, 0.114 ); float lumaNW = dot( rgbNW, luma ); float lumaNE = dot( rgbNE, luma ); float lumaSW = dot( rgbSW, luma ); float lumaSE = dot( rgbSE, luma ); float lumaM = dot( rgbM, luma ); float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) ); float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) ); vec2 dir; dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN ); float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce ); dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX), max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * resolution; vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz; rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz; rgbA *= 0.5; vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz; rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz; rgbB *= 0.25; rgbB += rgbA * 0.5; float lumaB = dot( rgbB, luma ); if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) { gl_FragColor = vec4( rgbA, opacity ); } else { gl_FragColor = vec4( rgbB, opacity ); } } @end`;function H3(t){t.import(F3),t.import(Nw),t.import(k3),t.import(Ow),t.import(z3),t.import(Bw),t.import(Fw),t.import(kw),t.import(zw),t.import(Uw),t.import(U3),t.import(Hw),t.import(Vw)}H3($);var V3=/^#source\((.*?)\)/;function G3(t,e){var r=new I3;e=e||{};var i={textures:{},parameters:{}},n=function(s,l){for(var u=0;u0;)r=r+i*(n%e),n=Math.floor(n/e),i=i/e;return r}const K3=`@export ecgl.ssao.estimate uniform sampler2D depthTex; uniform sampler2D normalTex; uniform sampler2D noiseTex; uniform vec2 depthTexSize; uniform vec2 noiseTexSize; uniform mat4 projection; uniform mat4 projectionInv; uniform mat4 viewInverseTranspose; uniform vec3 kernel[KERNEL_SIZE]; uniform float radius : 1; uniform float power : 1; uniform float bias: 1e-2; uniform float intensity: 1.0; varying vec2 v_Texcoord; float ssaoEstimator(in vec3 originPos, in mat3 kernelBasis) { float occlusion = 0.0; for (int i = 0; i < KERNEL_SIZE; i++) { vec3 samplePos = kernel[i]; #ifdef NORMALTEX_ENABLED samplePos = kernelBasis * samplePos; #endif samplePos = samplePos * radius + originPos; vec4 texCoord = projection * vec4(samplePos, 1.0); texCoord.xy /= texCoord.w; vec4 depthTexel = texture2D(depthTex, texCoord.xy * 0.5 + 0.5); float sampleDepth = depthTexel.r * 2.0 - 1.0; if (projection[3][3] == 0.0) { sampleDepth = projection[3][2] / (sampleDepth * projection[2][3] - projection[2][2]); } else { sampleDepth = (sampleDepth - projection[3][2]) / projection[2][2]; } float rangeCheck = smoothstep(0.0, 1.0, radius / abs(originPos.z - sampleDepth)); occlusion += rangeCheck * step(samplePos.z, sampleDepth - bias); } #ifdef NORMALTEX_ENABLED occlusion = 1.0 - occlusion / float(KERNEL_SIZE); #else occlusion = 1.0 - clamp((occlusion / float(KERNEL_SIZE) - 0.6) * 2.5, 0.0, 1.0); #endif return pow(occlusion, power); } void main() { vec4 depthTexel = texture2D(depthTex, v_Texcoord); #ifdef NORMALTEX_ENABLED vec4 tex = texture2D(normalTex, v_Texcoord); if (dot(tex.rgb, tex.rgb) == 0.0) { gl_FragColor = vec4(1.0); return; } vec3 N = tex.rgb * 2.0 - 1.0; N = (viewInverseTranspose * vec4(N, 0.0)).xyz; vec2 noiseTexCoord = depthTexSize / vec2(noiseTexSize) * v_Texcoord; vec3 rvec = texture2D(noiseTex, noiseTexCoord).rgb * 2.0 - 1.0; vec3 T = normalize(rvec - N * dot(rvec, N)); vec3 BT = normalize(cross(N, T)); mat3 kernelBasis = mat3(T, BT, N); #else if (depthTexel.r > 0.99999) { gl_FragColor = vec4(1.0); return; } mat3 kernelBasis; #endif float z = depthTexel.r * 2.0 - 1.0; vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0); vec4 p4 = projectionInv * projectedPos; vec3 position = p4.xyz / p4.w; float ao = ssaoEstimator(position, kernelBasis); ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0); gl_FragColor = vec4(vec3(ao), 1.0); } @end @export ecgl.ssao.blur #define SHADER_NAME SSAO_BLUR uniform sampler2D ssaoTexture; #ifdef NORMALTEX_ENABLED uniform sampler2D normalTex; #endif varying vec2 v_Texcoord; uniform vec2 textureSize; uniform float blurSize : 1.0; uniform int direction: 0.0; #ifdef DEPTHTEX_ENABLED uniform sampler2D depthTex; uniform mat4 projection; uniform float depthRange : 0.5; float getLinearDepth(vec2 coord) { float depth = texture2D(depthTex, coord).r * 2.0 - 1.0; return projection[3][2] / (depth * projection[2][3] - projection[2][2]); } #endif void main() { float kernel[5]; kernel[0] = 0.122581; kernel[1] = 0.233062; kernel[2] = 0.288713; kernel[3] = 0.233062; kernel[4] = 0.122581; vec2 off = vec2(0.0); if (direction == 0) { off[0] = blurSize / textureSize.x; } else { off[1] = blurSize / textureSize.y; } vec2 coord = v_Texcoord; float sum = 0.0; float weightAll = 0.0; #ifdef NORMALTEX_ENABLED vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0; #endif #if defined(DEPTHTEX_ENABLED) float centerDepth = getLinearDepth(v_Texcoord); #endif for (int i = 0; i < 5; i++) { vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0)); float w = kernel[i]; #ifdef NORMALTEX_ENABLED vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0; w *= clamp(dot(normal, centerNormal), 0.0, 1.0); #endif #ifdef DEPTHTEX_ENABLED float d = getLinearDepth(coord); w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0)); #endif weightAll += w; sum += texture2D(ssaoTexture, coord).r * w; } gl_FragColor = vec4(vec3(sum / weightAll), 1.0); } @end `;$.import(K3);function Ww(t){for(var e=new Uint8Array(t*t*4),r=0,i=new B,n=0;n 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0); vec3 tangentX = normalize(cross(N, upVector)); vec3 tangentZ = cross(N, tangentX); return normalize(tangentX * H.x + N * H.y + tangentZ * H.z); } vec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) { float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES)); vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb; return transformNormal(H, N); } float G_Smith(float g, float ndv, float ndl) { float roughness = 1.0 - g; float k = roughness * roughness / 2.0; float G1V = ndv / (ndv * (1.0 - k) + k); float G1L = ndl / (ndl * (1.0 - k) + k); return G1L * G1V; } vec3 F_Schlick(float ndv, vec3 spec) { return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0); } #endif float fetchDepth(sampler2D depthTexture, vec2 uv) { vec4 depthTexel = texture2D(depthTexture, uv); return depthTexel.r * 2.0 - 1.0; } float linearDepth(float depth) { if (projection[3][3] == 0.0) { return projection[3][2] / (depth * projection[2][3] - projection[2][2]); } else { return (depth - projection[3][2]) / projection[2][2]; } } bool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel) { if (rayZFar > rayZNear) { float t = rayZFar; rayZFar = rayZNear; rayZNear = t; } float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel)); return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold; } bool traceScreenSpaceRay( vec3 rayOrigin, vec3 rayDir, float jitter, out vec2 hitPixel, out vec3 hitPoint, out float iterationCount ) { float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ) ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance; vec3 rayEnd = rayOrigin + rayDir * rayLength; vec4 H0 = projection * vec4(rayOrigin, 1.0); vec4 H1 = projection * vec4(rayEnd, 1.0); float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w; vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1; vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize; vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize; P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0; vec2 delta = P1 - P0; bool permute = false; if (abs(delta.x) < abs(delta.y)) { permute = true; delta = delta.yx; P0 = P0.yx; P1 = P1.yx; } float stepDir = sign(delta.x); float invdx = stepDir / delta.x; vec3 dQ = (Q1 - Q0) * invdx; float dk = (k1 - k0) * invdx; vec2 dP = vec2(stepDir, delta.y * invdx); float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff); float pixStride = 1.0 + strideScaler * pixelStride; dP *= pixStride; dQ *= pixStride; dk *= pixStride; vec4 pqk = vec4(P0, Q0.z, k0); vec4 dPQK = vec4(dP, dQ.z, dk); pqk += dPQK * jitter; float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w); float rayZNear; bool intersect = false; vec2 texelSize = 1.0 / viewportSize; iterationCount = 0.0; for (int i = 0; i < MAX_ITERATION; i++) { pqk += dPQK; rayZNear = rayZFar; rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w); hitPixel = permute ? pqk.yx : pqk.xy; hitPixel *= texelSize; intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel); iterationCount += 1.0; dPQK *= 1.2; if (intersect) { break; } } Q0.xy += dQ.xy * iterationCount; Q0.z = pqk.z; hitPoint = Q0 / pqk.w; return intersect; } float calculateAlpha( float iterationCount, float reflectivity, vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir ) { float alpha = clamp(reflectivity, 0.0, 1.0); alpha *= 1.0 - (iterationCount / float(MAX_ITERATION)); vec2 hitPixelNDC = hitPixel * 2.0 - 1.0; float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y))); alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart); float _eyeFadeStart = eyeFadeStart; float _eyeFadeEnd = eyeFadeEnd; if (_eyeFadeStart > _eyeFadeEnd) { float tmp = _eyeFadeEnd; _eyeFadeEnd = _eyeFadeStart; _eyeFadeStart = tmp; } float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd); alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart); alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0); return alpha; } @import clay.util.rand @import clay.util.rgbm void main() { vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord); if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) { discard; } float g = normalAndGloss.a; #if !defined(PHYSICALLY_CORRECT) if (g <= minGlossiness) { discard; } #endif float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness); vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0); N = normalize((toViewSpace * vec4(N, 0.0)).xyz); vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0); vec4 pos = projectionInv * projectedPos; vec3 rayOrigin = pos.xyz / pos.w; vec3 V = -normalize(rayOrigin); float ndv = clamp(dot(N, V), 0.0, 1.0); float iterationCount; float jitter = rand(fract(v_Texcoord + jitterOffset)); #ifdef PHYSICALLY_CORRECT vec4 color = vec4(vec3(0.0), 1.0); vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord); vec3 albedo = albedoMetalness.rgb; float m = albedoMetalness.a; vec3 diffuseColor = albedo * (1.0 - m); vec3 spec = mix(vec3(0.04), albedo, m); float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES); for (int i = 0; i < SAMPLE_PER_FRAME; i++) { vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N); vec3 rayDir = normalize(reflect(-V, H)); #else vec3 rayDir = normalize(reflect(-V, N)); #endif vec2 hitPixel; vec3 hitPoint; bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount); float dist = distance(rayOrigin, hitPoint); vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0; hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz); #ifdef PHYSICALLY_CORRECT float ndl = clamp(dot(N, rayDir), 0.0, 1.0); float vdh = clamp(dot(V, H), 0.0, 1.0); float ndh = clamp(dot(N, H), 0.0, 1.0); vec3 litTexel = vec3(0.0); if (dot(hitNormal, rayDir) < 0.0 && intersect) { litTexel = texture2D(sourceTexture, hitPixel).rgb; litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0); } else { #ifdef SPECULARCUBEMAP_ENABLED vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb; litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity; #endif } color.rgb += ndl * litTexel * ( F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001) ); } color.rgb /= float(SAMPLE_PER_FRAME); #else #if !defined(SPECULARCUBEMAP_ENABLED) if (dot(hitNormal, rayDir) >= 0.0) { discard; } if (!intersect) { discard; } #endif float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0); vec4 color = texture2D(sourceTexture, hitPixel); color.rgb *= alpha; #ifdef SPECULARCUBEMAP_ENABLED vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb; alpha = alpha * (intersect ? 1.0 : 0.0); float bias = (1.0 -g) * 5.0; color.rgb += (1.0 - alpha) * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb * specularIntensity; #endif #endif gl_FragColor = encodeHDR(color); } @end @export ecgl.ssr.blur uniform sampler2D texture; uniform sampler2D gBufferTexture1; uniform sampler2D gBufferTexture2; uniform mat4 projection; uniform float depthRange : 0.05; varying vec2 v_Texcoord; uniform vec2 textureSize; uniform float blurSize : 1.0; #ifdef BLEND #ifdef SSAOTEX_ENABLED uniform sampler2D ssaoTex; #endif uniform sampler2D sourceTexture; #endif float getLinearDepth(vec2 coord) { float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0; return projection[3][2] / (depth * projection[2][3] - projection[2][2]); } @import clay.util.rgbm void main() { @import clay.compositor.kernel.gaussian_9 vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord); float g = centerNTexel.a; float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize; #ifdef VERTICAL vec2 off = vec2(0.0, maxBlurSize / textureSize.y); #else vec2 off = vec2(maxBlurSize / textureSize.x, 0.0); #endif vec2 coord = v_Texcoord; vec4 sum = vec4(0.0); float weightAll = 0.0; vec3 cN = centerNTexel.rgb * 2.0 - 1.0; float cD = getLinearDepth(v_Texcoord); for (int i = 0; i < 9; i++) { vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0)); float w = gaussianKernel[i] * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0); float d = getLinearDepth(coord); w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0)); weightAll += w; sum += decodeHDR(texture2D(texture, coord)) * w; } #ifdef BLEND float aoFactor = 1.0; #ifdef SSAOTEX_ENABLED aoFactor = texture2D(ssaoTex, v_Texcoord).r; #endif gl_FragColor = encodeHDR( sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord)) ); #else gl_FragColor = encodeHDR(sum / weightAll); #endif } @end`;$.import(Q3);function bi(t){t=t||{},this._ssrPass=new Oe({fragment:$.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new Oe({fragment:$.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new Oe({fragment:$.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new Oe({fragment:$.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",t.normalTexture),this._ssrPass.setUniform("gBufferTexture2",t.depthTexture),this._blurPass1.setUniform("gBufferTexture1",t.normalTexture),this._blurPass1.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.setUniform("gBufferTexture1",t.normalTexture),this._blurPass2.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new At({type:W.HALF_FLOAT}),this._texture2=new At({type:W.HALF_FLOAT}),this._texture3=new At({type:W.HALF_FLOAT}),this._prevTexture=new At({type:W.HALF_FLOAT}),this._currentTexture=new At({type:W.HALF_FLOAT}),this._frameBuffer=new he({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}bi.prototype.setAmbientCubemap=function(t,e){this._ssrPass.material.set("specularCubemap",t),this._ssrPass.material.set("specularIntensity",e);var r=t&&e;this._ssrPass.material[r?"enableTexture":"disableTexture"]("specularCubemap")};bi.prototype.update=function(t,e,r,i){var n=t.getWidth(),a=t.getHeight(),o=this._ssrTexture,s=this._texture2,l=this._texture3;o.width=this._prevTexture.width=this._currentTexture.width=n/this._downScale,o.height=this._prevTexture.height=this._currentTexture.height=a/this._downScale,s.width=l.width=n,s.height=l.height=a;var u=this._frameBuffer,f=this._ssrPass,h=this._blurPass1,v=this._blurPass2,c=this._blendPass,d=new q,p=new q;q.transpose(d,e.worldTransform),q.transpose(p,e.viewMatrix),f.setUniform("sourceTexture",r),f.setUniform("projection",e.projectionMatrix.array),f.setUniform("projectionInv",e.invProjectionMatrix.array),f.setUniform("toViewSpace",d.array),f.setUniform("toWorldSpace",p.array),f.setUniform("nearZ",e.near);var g=i/this._totalSamples*this._samplePerFrame;if(f.setUniform("jitterOffset",g),f.setUniform("sampleOffset",i*this._samplePerFrame),h.setUniform("textureSize",[o.width,o.height]),v.setUniform("textureSize",[n,a]),v.setUniform("sourceTexture",r),h.setUniform("projection",e.projectionMatrix.array),v.setUniform("projection",e.projectionMatrix.array),u.attach(o),u.bind(t),f.render(t),this._physicallyCorrect&&(u.attach(this._currentTexture),c.setUniform("texture1",this._prevTexture),c.setUniform("texture2",o),c.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),c.render(t)),u.attach(s),h.setUniform("texture",this._physicallyCorrect?this._currentTexture:o),h.render(t),u.attach(l),v.setUniform("texture",s),v.render(t),u.unbind(t),this._physicallyCorrect){var m=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=m}};bi.prototype.getTargetTexture=function(){return this._texture3};bi.prototype.setParameter=function(t,e){t==="maxIteration"?this._ssrPass.material.define("fragment","MAX_ITERATION",e):this._ssrPass.setUniform(t,e)};bi.prototype.setPhysicallyCorrect=function(t){t?(this._normalDistribution||(this._normalDistribution=ri.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=t};bi.prototype.setSSAOTexture=function(t){var e=this._blurPass2;t?(e.material.enableTexture("ssaoTex"),e.material.set("ssaoTex",t)):e.material.disableTexture("ssaoTex")};bi.prototype.isFinished=function(t){return this._physicallyCorrect?t>this._totalSamples/this._samplePerFrame:!0};bi.prototype.dispose=function(t){this._ssrTexture.dispose(t),this._texture2.dispose(t),this._texture3.dispose(t),this._prevTexture.dispose(t),this._currentTexture.dispose(t),this._frameBuffer.dispose(t)};const uy=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925],J3=`@export ecgl.normal.vertex @import ecgl.common.transformUniforms @import ecgl.common.uv.header @import ecgl.common.attributes varying vec3 v_Normal; varying vec3 v_WorldPosition; @import ecgl.common.normalMap.vertexHeader @import ecgl.common.vertexAnimation.header void main() { @import ecgl.common.vertexAnimation.main @import ecgl.common.uv.main v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz); v_WorldPosition = (world * vec4(pos, 1.0)).xyz; @import ecgl.common.normalMap.vertexMain gl_Position = worldViewProjection * vec4(pos, 1.0); } @end @export ecgl.normal.fragment #define ROUGHNESS_CHANEL 0 uniform bool useBumpMap; uniform bool useRoughnessMap; uniform bool doubleSide; uniform float roughness; @import ecgl.common.uv.fragmentHeader varying vec3 v_Normal; varying vec3 v_WorldPosition; uniform mat4 viewInverse : VIEWINVERSE; @import ecgl.common.normalMap.fragmentHeader @import ecgl.common.bumpMap.header uniform sampler2D roughnessMap; void main() { vec3 N = v_Normal; bool flipNormal = false; if (doubleSide) { vec3 eyePos = viewInverse[3].xyz; vec3 V = normalize(eyePos - v_WorldPosition); if (dot(N, V) < 0.0) { flipNormal = true; } } @import ecgl.common.normalMap.fragmentMain if (useBumpMap) { N = bumpNormal(v_WorldPosition, v_Normal, N); } float g = 1.0 - roughness; if (useRoughnessMap) { float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL]; g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0); } if (flipNormal) { N = -N; } gl_FragColor.rgb = (N.xyz + 1.0) * 0.5; gl_FragColor.a = g; } @end`;$.import(J3);function Vc(t,e,r,i,n){var a=t.gl;e.setUniform(a,"1i",r,n),a.activeTexture(a.TEXTURE0+n),i.isRenderable()?i.bind(t):i.unbind(t)}function tB(t,e,r,i,n){var a,o,s,l,u=t.gl;return function(f,h,v){if(!(l&&l.material===f.material)){var c=f.material,d=f.__program,p=c.get("roughness");p==null&&(p=1);var g=c.get("normalMap")||e,m=c.get("roughnessMap"),_=c.get("bumpMap"),y=c.get("uvRepeat"),x=c.get("uvOffset"),S=c.get("detailUvRepeat"),T=c.get("detailUvOffset"),w=!!_&&c.isTextureEnabled("bumpMap"),b=!!m&&c.isTextureEnabled("roughnessMap"),A=c.isDefined("fragment","DOUBLE_SIDED");_=_||r,m=m||i,v!==h?(h.set("normalMap",g),h.set("bumpMap",_),h.set("roughnessMap",m),h.set("useBumpMap",w),h.set("useRoughnessMap",b),h.set("doubleSide",A),y!=null&&h.set("uvRepeat",y),x!=null&&h.set("uvOffset",x),S!=null&&h.set("detailUvRepeat",S),T!=null&&h.set("detailUvOffset",T),h.set("roughness",p)):(d.setUniform(u,"1f","roughness",p),a!==g&&Vc(t,d,"normalMap",g,0),o!==_&&_&&Vc(t,d,"bumpMap",_,1),s!==m&&m&&Vc(t,d,"roughnessMap",m,2),y!=null&&d.setUniform(u,"2f","uvRepeat",y),x!=null&&d.setUniform(u,"2f","uvOffset",x),S!=null&&d.setUniform(u,"2f","detailUvRepeat",S),T!=null&&d.setUniform(u,"2f","detailUvOffset",T),d.setUniform(u,"1i","useBumpMap",+w),d.setUniform(u,"1i","useRoughnessMap",+b),d.setUniform(u,"1i","doubleSide",+A)),a=g,o=_,s=m,l=f}}}function co(t){this._depthTex=new At({format:W.DEPTH_COMPONENT,type:W.UNSIGNED_INT}),this._normalTex=new At({type:W.HALF_FLOAT}),this._framebuffer=new he,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,he.DEPTH_ATTACHMENT),this._normalMaterial=new Si({shader:new $($.source("ecgl.normal.vertex"),$.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=ei.createBlank("#000"),this._defaultBumpMap=ei.createBlank("#000"),this._defaultRoughessMap=ei.createBlank("#000"),this._debugPass=new Oe({fragment:$.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}co.prototype.getDepthTexture=function(){return this._depthTex};co.prototype.getNormalTexture=function(){return this._normalTex};co.prototype.update=function(t,e,r){var i=t.getWidth(),n=t.getHeight(),a=this._depthTex,o=this._normalTex,s=this._normalMaterial;a.width=i,a.height=n,o.width=i,o.height=n;var l=e.getRenderList(r).opaque;this._framebuffer.bind(t),t.gl.clearColor(0,0,0,0),t.gl.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.gl.disable(t.gl.BLEND),t.renderPass(l,r,{getMaterial:function(){return s},ifRender:function(u){return u.renderNormal},beforeRender:tB(t,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:t.opaqueSortCompare}),this._framebuffer.unbind(t)};co.prototype.renderDebug=function(t){this._debugPass.render(t)};co.prototype.dispose=function(t){this._depthTex.dispose(t),this._normalTex.dispose(t)};function Ks(t){t=t||{},this._edgePass=new Oe({fragment:$.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",t.normalTexture),this._edgePass.setUniform("depthTexture",t.depthTexture),this._targetTexture=new At({type:W.HALF_FLOAT}),this._frameBuffer=new he,this._frameBuffer.attach(this._targetTexture)}Ks.prototype.update=function(t,e,r,i){var n=t.getWidth(),a=t.getHeight(),o=this._targetTexture;o.width=n,o.height=a;var s=this._frameBuffer;s.bind(t),this._edgePass.setUniform("projectionInv",e.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[n,a]),this._edgePass.setUniform("texture",r),this._edgePass.render(t),s.unbind(t)};Ks.prototype.getTargetTexture=function(){return this._targetTexture};Ks.prototype.setParameter=function(t,e){this._edgePass.setUniform(t,e)};Ks.prototype.dispose=function(t){this._targetTexture.dispose(t),this._frameBuffer.dispose(t)};const eB={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]},rB=`@export ecgl.dof.coc uniform sampler2D depth; uniform float zNear: 0.1; uniform float zFar: 2000; uniform float focalDistance: 3; uniform float focalRange: 1; uniform float focalLength: 30; uniform float fstop: 2.8; varying vec2 v_Texcoord; @import clay.util.encode_float void main() { float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0; float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear)); float aperture = focalLength / fstop; float coc; float uppper = focalDistance + focalRange; float lower = focalDistance - focalRange; if (dist <= uppper && dist >= lower) { coc = 0.5; } else { float focalAdjusted = dist > uppper ? uppper : lower; coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength))); coc = clamp(coc, 0.0, 2.0) / 2.00001; if (dist < lower) { coc = -coc; } coc = coc * 0.5 + 0.5; } gl_FragColor = encodeFloat(coc); } @end @export ecgl.dof.composite #define DEBUG 0 uniform sampler2D original; uniform sampler2D blurred; uniform sampler2D nearfield; uniform sampler2D coc; uniform sampler2D nearcoc; varying vec2 v_Texcoord; @import clay.util.rgbm @import clay.util.float void main() { vec4 blurredColor = texture2D(blurred, v_Texcoord); vec4 originalColor = texture2D(original, v_Texcoord); float fCoc = decodeFloat(texture2D(coc, v_Texcoord)); fCoc = abs(fCoc * 2.0 - 1.0); float weight = smoothstep(0.0, 1.0, fCoc); #ifdef NEARFIELD_ENABLED vec4 nearfieldColor = texture2D(nearfield, v_Texcoord); float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord)); fNearCoc = abs(fNearCoc * 2.0 - 1.0); gl_FragColor = encodeHDR( mix( nearfieldColor, mix(originalColor, blurredColor, weight), pow(1.0 - fNearCoc, 4.0) ) ); #else gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight)); #endif } @end @export ecgl.dof.diskBlur #define POISSON_KERNEL_SIZE 16; uniform sampler2D texture; uniform sampler2D coc; varying vec2 v_Texcoord; uniform float blurRadius : 10.0; uniform vec2 textureSize : [512.0, 512.0]; uniform vec2 poissonKernel[POISSON_KERNEL_SIZE]; uniform float percent; float nrand(const in vec2 n) { return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453); } @import clay.util.rgbm @import clay.util.float void main() { vec2 offset = blurRadius / textureSize; float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent ); float cosa = cos(rnd); float sina = sin(rnd); vec4 basis = vec4(cosa, -sina, sina, cosa); #if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC) offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0); #endif #ifdef BLUR_COC float cocSum = 0.0; #else vec4 color = vec4(0.0); #endif float weightSum = 0.0; for (int i = 0; i < POISSON_KERNEL_SIZE; i++) { vec2 ofs = poissonKernel[i]; ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw)); vec2 uv = v_Texcoord + ofs * offset; vec4 texel = texture2D(texture, uv); float w = 1.0; #ifdef BLUR_COC float fCoc = decodeFloat(texel) * 2.0 - 1.0; cocSum += clamp(fCoc, -1.0, 0.0) * w; #else texel = texel; #if !defined(BLUR_NEARFIELD) float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0; w *= abs(fCoc); #endif texel.rgb *= texel.a; color += texel * w; #endif weightSum += w; } #ifdef BLUR_COC gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5); #else color /= weightSum; color.rgb /= (color.a + 0.0001); gl_FragColor = color; #endif } @end`,iB=`@export ecgl.edge uniform sampler2D texture; uniform sampler2D normalTexture; uniform sampler2D depthTexture; uniform mat4 projectionInv; uniform vec2 textureSize; uniform vec4 edgeColor: [0,0,0,0.8]; varying vec2 v_Texcoord; vec3 packColor(vec2 coord) { float z = texture2D(depthTexture, coord).r * 2.0 - 1.0; vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0); vec4 p4 = projectionInv * p; return vec3( texture2D(normalTexture, coord).rg, -p4.z / p4.w / 5.0 ); } void main() { vec2 cc = v_Texcoord; vec3 center = packColor(cc); float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5; float dx = size / textureSize.x; float dy = size / textureSize.y; vec2 coord; vec3 topLeft = packColor(cc+vec2(-dx, -dy)); vec3 top = packColor(cc+vec2(0.0, -dy)); vec3 topRight = packColor(cc+vec2(dx, -dy)); vec3 left = packColor(cc+vec2(-dx, 0.0)); vec3 right = packColor(cc+vec2(dx, 0.0)); vec3 bottomLeft = packColor(cc+vec2(-dx, dy)); vec3 bottom = packColor(cc+vec2(0.0, dy)); vec3 bottomRight = packColor(cc+vec2(dx, dy)); vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight; vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight; float edge = sqrt(dot(h, h) + dot(v, v)); edge = smoothstep(0.8, 1.0, edge); gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge); } @end`;$.import(Nw);$.import(Ow);$.import(Bw);$.import(Fw);$.import(kw);$.import(zw);$.import(Uw);$.import(Hw);$.import(Vw);$.import(rB);$.import(iB);function Xw(t,e){return{color:{parameters:{width:t,height:e}}}}var Zp=["composite","FXAA"];function _t(){this._width,this._height,this._dpr,this._sourceTexture=new At({type:W.HALF_FLOAT}),this._depthTexture=new At({format:W.DEPTH_COMPONENT,type:W.UNSIGNED_INT}),this._framebuffer=new he,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,he.DEPTH_ATTACHMENT),this._normalPass=new co,this._compositor=G3(eB);var t=this._compositor.getNodeByName("source");t.texture=this._sourceTexture;var e=this._compositor.getNodeByName("coc");this._sourceNode=t,this._cocNode=e,this._compositeNode=this._compositor.getNodeByName("composite"),this._fxaaNode=this._compositor.getNodeByName("FXAA"),this._dofBlurNodes=["dof_far_blur","dof_near_blur","dof_coc_blur"].map(function(i){return this._compositor.getNodeByName(i)},this),this._dofBlurKernel=0,this._dofBlurKernelSize=new Float32Array(0),this._finalNodesChain=Zp.map(function(i){return this._compositor.getNodeByName(i)},this);var r={normalTexture:this._normalPass.getNormalTexture(),depthTexture:this._normalPass.getDepthTexture()};this._ssaoPass=new wi(r),this._ssrPass=new bi(r),this._edgePass=new Ks(r)}_t.prototype.resize=function(i,n,r){r=r||1;var i=i*r,n=n*r,a=this._sourceTexture,o=this._depthTexture;a.width=i,a.height=n,o.width=i,o.height=n;var s={getWidth:function(){return i},getHeight:function(){return n},getDevicePixelRatio:function(){return r}};function l(u,f){if(typeof u[f]=="function"){var h=u[f].__original||u[f];u[f]=function(v){return h.call(this,s)},u[f].__original=h}}this._compositor.nodes.forEach(function(u){for(var f in u.outputs){var h=u.outputs[f].parameters;h&&(l(h,"width"),l(h,"height"))}for(var v in u.parameters)l(u.parameters,v)}),this._width=i,this._height=n,this._dpr=r};_t.prototype.getWidth=function(){return this._width};_t.prototype.getHeight=function(){return this._height};_t.prototype._ifRenderNormalPass=function(){return this._enableSSAO||this._enableEdge||this._enableSSR};_t.prototype._getPrevNode=function(t){for(var e=Zp.indexOf(t.name)-1,r=this._finalNodesChain[e];r&&!this._compositor.getNodeByName(r.name);)e-=1,r=this._finalNodesChain[e];return r};_t.prototype._getNextNode=function(t){for(var e=Zp.indexOf(t.name)+1,r=this._finalNodesChain[e];r&&!this._compositor.getNodeByName(r.name);)e+=1,r=this._finalNodesChain[e];return r};_t.prototype._addChainNode=function(t){var e=this._getPrevNode(t),r=this._getNextNode(t);e&&(t.inputs.texture=e.name,r?(t.outputs=Xw(this.getWidth.bind(this),this.getHeight.bind(this)),r.inputs.texture=t.name):t.outputs=null,this._compositor.addNode(t))};_t.prototype._removeChainNode=function(t){var e=this._getPrevNode(t),r=this._getNextNode(t);e&&(r?(e.outputs=Xw(this.getWidth.bind(this),this.getHeight.bind(this)),r.inputs.texture=e.name):e.outputs=null,this._compositor.removeNode(t))};_t.prototype.updateNormal=function(t,e,r,i){this._ifRenderNormalPass()&&this._normalPass.update(t,e,r)};_t.prototype.updateSSAO=function(t,e,r,i){this._ssaoPass.update(t,r,i)};_t.prototype.enableSSAO=function(){this._enableSSAO=!0};_t.prototype.disableSSAO=function(){this._enableSSAO=!1};_t.prototype.enableSSR=function(){this._enableSSR=!0};_t.prototype.disableSSR=function(){this._enableSSR=!1};_t.prototype.getSSAOTexture=function(){return this._ssaoPass.getTargetTexture()};_t.prototype.getSourceFrameBuffer=function(){return this._framebuffer};_t.prototype.getSourceTexture=function(){return this._sourceTexture};_t.prototype.disableFXAA=function(){this._removeChainNode(this._fxaaNode)};_t.prototype.enableFXAA=function(){this._addChainNode(this._fxaaNode)};_t.prototype.enableBloom=function(){this._compositeNode.inputs.bloom="bloom_composite",this._compositor.dirty()};_t.prototype.disableBloom=function(){this._compositeNode.inputs.bloom=null,this._compositor.dirty()};_t.prototype.enableDOF=function(){this._compositeNode.inputs.texture="dof_composite",this._compositor.dirty()};_t.prototype.disableDOF=function(){this._compositeNode.inputs.texture="source",this._compositor.dirty()};_t.prototype.enableColorCorrection=function(){this._compositeNode.define("COLOR_CORRECTION"),this._enableColorCorrection=!0};_t.prototype.disableColorCorrection=function(){this._compositeNode.undefine("COLOR_CORRECTION"),this._enableColorCorrection=!1};_t.prototype.enableEdge=function(){this._enableEdge=!0};_t.prototype.disableEdge=function(){this._enableEdge=!1};_t.prototype.setBloomIntensity=function(t){this._compositeNode.setParameter("bloomIntensity",t)};_t.prototype.setSSAOParameter=function(t,e){switch(t){case"quality":var r={low:6,medium:12,high:32,ultra:62}[e]||12;this._ssaoPass.setParameter("kernelSize",r);break;case"radius":this._ssaoPass.setParameter(t,e),this._ssaoPass.setParameter("bias",e/200);break;case"intensity":this._ssaoPass.setParameter(t,e);break}};_t.prototype.setDOFParameter=function(t,e){switch(t){case"focalDistance":case"focalRange":case"fstop":this._cocNode.setParameter(t,e);break;case"blurRadius":for(var r=0;r=this._haltonSequence.length},render:function(t,e,r){var i=this._blendPass;this._frame===0?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",e||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(t),i.render(t),this._blendFb.unbind(t),r||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(t));var n=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=n,this._frame++},dispose:function(t){this._sourceFb.dispose(t),this._blendFb.dispose(t),this._prevFrameTex.dispose(t),this._outputTex.dispose(t),this._sourceTex.dispose(t),this._outputPass.dispose(t),this._blendPass.dispose(t)}};function jt(t){t=t||"perspective",this.layer=null,this.scene=new ji,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(t),this._compositor=new _t,this._temporalSS=new gd,this._shadowMapPass=new qr;for(var e=[],r=0,i=0;i<30;i++){for(var n=[],a=0;a<6;a++)n.push(ao(r,2)*4-2),n.push(ao(r,3)*4-2),r++;e.push(n)}this._pcfKernels=e,this.scene.on("beforerender",function(o,s,l){this.needsTemporalSS()&&this._temporalSS.jitterProjection(o,l)},this)}jt.prototype.setProjection=function(t){var e=this.camera;e&&e.update(),t==="perspective"?this.camera instanceof ve||(this.camera=new ve,e&&this.camera.setLocalTransform(e.localTransform)):this.camera instanceof Os||(this.camera=new Os,e&&this.camera.setLocalTransform(e.localTransform)),this.camera.near=.1,this.camera.far=2e3};jt.prototype.setViewport=function(t,e,r,i,n){this.camera instanceof ve&&(this.camera.aspect=r/i),n=n||1,this.viewport.x=t,this.viewport.y=e,this.viewport.width=r,this.viewport.height=i,this.viewport.devicePixelRatio=n,this._compositor.resize(r*n,i*n),this._temporalSS.resize(r*n,i*n)};jt.prototype.containPoint=function(t,e){var r=this.viewport,i=this.layer.renderer.getHeight();return e=i-e,t>=r.x&&e>=r.y&&t<=r.x+r.width&&e<=r.y+r.height};var fy=new st;jt.prototype.castRay=function(t,e,r){var i=this.layer.renderer,n=i.viewport;return i.viewport=this.viewport,i.screenToNDC(t,e,fy),this.camera.castRay(fy,r),i.viewport=n,r};jt.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var t=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var e=0;e30};jt.prototype._doRender=function(t,e,r){var i=this.scene,n=this.camera;r=r||0,this._updateTransparent(t,i,n,r),e||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(t,i,n,!0)),this._updateShadowPCFKernel(r);var a=t.clearColor;if(t.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,n),this._compositor.updateNormal(t,i,n,this._temporalSS.getFrame())),this._updateSSAO(t,i,n,this._temporalSS.getFrame()),this._enablePostEffect){var o=this._compositor.getSourceFrameBuffer();o.bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),t.render(i,n,!0,!0),o.unbind(t),this.needsTemporalSS()&&e?(this._compositor.composite(t,i,n,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),this._compositor.composite(t,i,n,null,0))}else if(this.needsTemporalSS()&&e){var o=this._temporalSS.getSourceFrameBuffer();o.bind(t),t.saveClear(),t.clearBit=t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT,t.render(i,n,!0,!0),t.restoreClear(),o.unbind(t),t.setViewport(this.viewport),this._temporalSS.render(t)}else t.setViewport(this.viewport),t.render(i,n,!0,!0)};jt.prototype._updateTransparent=function(t,e,r,i){for(var n=new B,a=new q,o=r.getWorldPosition(),s=e.getRenderList(r).transparent,l=0;lthis.camera.far||tl&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u});var l=a[o].pivot+1,u=a[o].right;u>l&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u})}a=this._parts=s}else for(var o=0;o=2e4},doSortTriangles:function(t,e){var r=this.indices;if(e===0){var i=this.attributes.position,t=t.array;(!this._triangleZList||this._triangleZList.length!==this.triangleCount)&&(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new r.constructor(r.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var n=0,a,o=0;o"+v.join("
")}var n=t.getData(),a=t.getRawValue(e),o=j(a)?i(a):_e(Uu(a)),s=n.getName(e),l=md(n,e);rt(l)&&l.colorStops&&(l=(l.colorStops[0]||{}).color),l=l||"transparent";var u=lT(l),f=t.name;return f==="\0-"&&(f=""),f=f?_e(f)+(r?": ":"
"):"",r?u+f+o:f+u+(s?_e(s)+": "+o:o)}function _B(t,e,r){r=r||t.getSource();var i=e||sR(t.get("coordinateSystem"))||["x","y","z"],n=SR(r,{dimensionsDefine:r.dimensionsDefine||t.get("dimensions"),encodeDefine:r.encodeDefine||t.get("encode"),coordDimensions:i.map(function(s){var l=t.getReferringComponents(s+"Axis3D").models[0];return{type:l&&l.get("type")==="category"?"ordinal":"float",name:s}})});t.get("coordinateSystem")==="cartesian3D"&&n.forEach(function(s){if(i.indexOf(s.coordDim)>=0){var l=t.getReferringComponents(s.coordDim+"Axis3D").models[0];l&&l.get("type")==="category"&&(s.ordinalMeta=l.getOrdinalMeta())}});var a=vP.enableDataStack(t,n,{byIndex:!0,stackedCoordDimension:"z"}),o=new wS(n,t);return o.setCalculationInfo(a),o.initData(r),o}var Kw=yi.extend({type:"series.surface",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",formatTooltip:function(t){return mB(this,t)},getInitialData:function(t,e){var r=t.data;function i(V){return!(isNaN(V.min)||isNaN(V.max)||isNaN(V.step))}function n(V){var O=zd;return Math.max(O(V.min),O(V.max),O(V.step))+1}if(!r)if(t.parametric){var x=t.parametricEquation||{},S=x.u||{},T=x.v||{};["u","v"].forEach(function(O){i(x[O])}),["x","y","z"].forEach(function(O){x[O]});var w=Math.floor((S.max+S.step-S.min)/S.step),b=Math.floor((T.max+T.step-T.min)/T.step);r=new Float32Array(w*b*5);for(var A=n(S),M=n(T),v=0,c=0;c0;this._updateSurfaceMesh(this._surfaceMesh,t,f,c);var d=this._surfaceMesh.material;c?(d.define("WIREFRAME_QUAD"),d.set("wireframeLineWidth",v),d.set("wireframeLineColor",U.parseColor(h.get("lineStyle.color")))):d.undefine("WIREFRAME_QUAD"),this._initHandler(t,r),this._updateAnimation(t)},_updateAnimation:function(t){U.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,t)},_createSurfaceMesh:function(){var t=new U.Mesh({geometry:new U.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new U.Material({shader:new U.Shader(U.Shader.source("ecgl.sm.depth.vertex"),U.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return t.geometry.createAttribute("barycentric","float",4),t.geometry.createAttribute("prevPosition","float",3),t.geometry.createAttribute("prevNormal","float",3),Object.assign(t.geometry,pB),t},_initHandler:function(t,e){var r=t.getData(),i=this._surfaceMesh,n=t.coordinateSystem;function a(s,l){for(var u=1/0,f=-1,h=[],v=0;v=0){var u=[];i.geometry.attributes.position.get(l,u);for(var f=n.pointToData(u),h=1/0,v=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((d-1)*(p-1)*6),T=function(re,Vt,Ce){Ce[1]=re*p+Vt,Ce[0]=re*p+Vt+1,Ce[3]=(re+1)*p+Vt+1,Ce[2]=(re+1)*p+Vt},w=!1;if(l){var b=[],A=[],M=0;m?f.init(n.vertexCount):f.value=null;for(var E=[[],[],[]],D=[],R=[],P=Dn.create(),I=function(re,Vt,Ce){var br=Vt*3;return Ce[0]=re[br],Ce[1]=re[br+1],Ce[2]=re[br+2],Ce},N=new Float32Array(o.length),V=new Float32Array(o.length/3*4),O=0;O0;){if(Math.floor(s/f)===s/f)return[f,s/f];f--}return f=Math.floor(Math.sqrt(s)),[f,f]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function TB(t){t.registerChartView(xB),t.registerSeriesModel(Kw),t.registerLayout(function(e,r){e.eachSeriesByType("surface",function(i){var n=i.coordinateSystem;!n||n.type;var a=i.getData(),o=new Float32Array(3*a.count()),s=[NaN,NaN,NaN];if(n&&n.type==="cartesian3D"){var l=n.dimensions,u=l.map(function(f){return i.coordDimToDataDim(f)[0]});a.each(u,function(f,h,v,c){var d;a.hasValue(c)?d=n.dataToPoint([f,h,v]):d=s,o[c*3]=d[0],o[c*3+1]=d[1],o[c*3+2]=d[2]})}a.setLayout("points",o)})})}var In=Yt(),py=ut,Wc=nt,SB=function(){function t(){this._dragging=!1,this.animationThreshold=15}return t.prototype.render=function(e,r,i,n){var a=r.get("value"),o=r.get("status");if(this._axisModel=e,this._axisPointerModel=r,this._api=i,!(!n&&this._lastValue===a&&this._lastStatus===o)){this._lastValue=a,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,a,e,r,i);var f=u.graphicKey;f!==this._lastGraphicKey&&this.clear(i),this._lastGraphicKey=f;var h=this._moveAnimation=this.determineAnimation(e,r);if(!s)s=this._group=new ee,this.createPointerEl(s,u,e,r),this.createLabelEl(s,u,e,r),i.getZr().add(s);else{var v=le(gy,r,h);this.updatePointerEl(s,u,v),this.updateLabelEl(s,u,v,r)}_y(s,r,!0),this._renderHandle(a)}},t.prototype.remove=function(e){this.clear(e)},t.prototype.dispose=function(e){this.clear(e)},t.prototype.determineAnimation=function(e,r){var i=r.get("animation"),n=e.axis,a=n.type==="category",o=r.get("snap");if(!o&&!a)return!1;if(i==="auto"||i==null){var s=this.animationThreshold;if(a&&n.getBandWidth()>s)return!0;if(o){var l=Fp(e).seriesDataCount,u=n.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return i===!0},t.prototype.makeElOption=function(e,r,i,n,a){},t.prototype.createPointerEl=function(e,r,i,n){var a=r.pointer;if(a){var o=In(e).pointerEl=new rC[a.type](py(r.pointer));e.add(o)}},t.prototype.createLabelEl=function(e,r,i,n){if(r.label){var a=In(e).labelEl=new Xt(py(r.label));e.add(a),my(a,n)}},t.prototype.updatePointerEl=function(e,r,i){var n=In(e).pointerEl;n&&r.pointer&&(n.setStyle(r.pointer.style),i(n,{shape:r.pointer.shape}))},t.prototype.updateLabelEl=function(e,r,i,n){var a=In(e).labelEl;a&&(a.setStyle(r.label.style),i(a,{x:r.label.x,y:r.label.y}),my(a,n))},t.prototype._renderHandle=function(e){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,i=this._api.getZr(),n=this._handle,a=r.getModel("handle"),o=r.get("status");if(!a.get("show")||!o||o==="hide"){n&&i.remove(n),this._handle=null;return}var s;this._handle||(s=!0,n=this._handle=np(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){gi(u.event)},onmousedown:Wc(this._onHandleDragMove,this,0,0),drift:Wc(this._onHandleDragMove,this),ondragend:Wc(this._onHandleDragEnd,this)}),i.add(n)),_y(n,r,!1),n.setStyle(a.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=a.get("size");j(l)||(l=[l,l]),n.scaleX=l[0]/2,n.scaleY=l[1]/2,zf(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,s)}},t.prototype._moveHandleToValue=function(e,r){gy(this._axisPointerModel,!r&&this._moveAnimation,this._handle,Xc(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(e,r){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(Xc(i),[e,r],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(Xc(n)),In(i).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){var e=this._handle;if(e){var r=this._payloadInfo,i=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:i.axis.dim,axisIndex:i.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){this._dragging=!1;var e=this._handle;if(e){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var r=e.getZr(),i=this._group,n=this._handle;r&&i&&(this._lastGraphicKey=null,i&&r.remove(i),n&&r.remove(n),this._group=null,this._handle=null,this._payloadInfo=null),Vu(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(e,r,i){return i=i||0,{x:e[i],y:e[1-i],width:r[i],height:r[1-i]}},t}();function gy(t,e,r,i){jw(In(r).lastProp,i)||(In(r).lastProp=i,e?Sr(r,i,t):(r.stopAnimation(),r.attr(i)))}function jw(t,e){if(rt(t)&&rt(e)){var r=!0;return C(e,function(i,n){r=r&&jw(t[n],i)}),!!r}else return t===e}function my(t,e){t[e.get(["label","show"])?"show":"hide"]()}function Xc(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function _y(t,e,r){var i=e.get("z"),n=e.get("zlevel");t&&t.traverse(function(a){a.type!=="group"&&(i!=null&&(a.z=i),n!=null&&(a.zlevel=n),a.silent=r)})}function wB(t){var e=t.get("type"),r=t.getModel(e+"Style"),i;return e==="line"?(i=r.getLineStyle(),i.fill=null):e==="shadow"&&(i=r.getAreaStyle(),i.stroke=null),i}function bB(t,e,r,i,n){var a=r.get("value"),o=Qw(a,e.axis,e.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=Ys(s.get("padding")||0),u=s.getFont(),f=kd(o,u),h=n.position,v=f.width+l[1]+l[3],c=f.height+l[0]+l[2],d=n.align;d==="right"&&(h[0]-=v),d==="center"&&(h[0]-=v/2);var p=n.verticalAlign;p==="bottom"&&(h[1]-=c),p==="middle"&&(h[1]-=c/2),AB(h,v,c,i);var g=s.get("backgroundColor");(!g||g==="auto")&&(g=e.get(["axisLine","lineStyle","color"])),t.label={x:h[0],y:h[1],style:qe(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:g}),z2:10}}function AB(t,e,r,i){var n=i.getWidth(),a=i.getHeight();t[0]=Math.min(t[0]+e,n)-e,t[1]=Math.min(t[1]+r,a)-r,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}function Qw(t,e,r,i,n){t=e.scale.parse(t);var a=e.scale.getLabel({value:t},{precision:n.precision}),o=n.formatter;if(o){var s={value:Lp(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};C(i,function(l){var u=r.getSeriesByIndex(l.seriesIndex),f=l.dataIndexInside,h=u&&u.getDataParams(f);h&&s.seriesData.push(h)}),Q(o)?a=o.replace("{value}",a):ct(o)&&(a=o(s))}return a}function Jw(t,e,r){var i=Va();return Od(i,i,r.rotation),fv(i,i,r.position),Wi([t.dataToCoord(e),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],i)}function EB(t,e,r,i,n,a){var o=Yi.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=n.get(["label","margin"]),bB(e,i,n,a,{position:Jw(i.axis,t,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function MB(t,e,r){return r=r||0,{x1:t[r],y1:t[1-r],x2:e[r],y2:e[1-r]}}function CB(t,e,r){return r=r||0,{x:t[r],y:t[1-r],width:e[r],height:e[1-r]}}var DB=function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.makeElOption=function(r,i,n,a,o){var s=n.axis,l=s.grid,u=a.get("type"),f=yy(l,s).getOtherAxis(s).getGlobalExtent(),h=s.toGlobalCoord(s.dataToCoord(i,!0));if(u&&u!=="none"){var v=wB(a),c=LB[u](s,h,f);c.style=v,r.graphicKey=c.type,r.pointer=c}var d=ed(l.model,n);EB(i,r,d,n,a,o)},e.prototype.getHandleTransform=function(r,i,n){var a=ed(i.axis.grid.model,i,{labelInside:!1});a.labelMargin=n.get(["handle","margin"]);var o=Jw(i.axis,r,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(r,i,n,a){var o=n.axis,s=o.grid,l=o.getGlobalExtent(!0),u=yy(s,o).getOtherAxis(o).getGlobalExtent(),f=o.dim==="x"?0:1,h=[r.x,r.y];h[f]+=i[f],h[f]=Math.min(l[1],h[f]),h[f]=Math.max(l[0],h[f]);var v=(u[1]+u[0])/2,c=[v,v];c[f]=h[f];var d=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:c,tooltipOption:d[f]}},e}(SB);function yy(t,e){var r={};return r[e.dim+"AxisIndex"]=e.index,t.getCartesian(r)}var LB={line:function(t,e,r){var i=MB([e,r[0]],[e,r[1]],xy(t));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(t,e,r){var i=Math.max(1,t.getBandWidth()),n=r[1]-r[0];return{type:"Rect",shape:CB([e-i/2,r[0]],[i,n],xy(t))}}};function xy(t){return t.dim==="x"?0:1}var RB=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(Rt),di=Yt(),PB=C;function t2(t,e,r){if(!vt.node){var i=e.getZr();di(i).records||(di(i).records={}),IB(i,e);var n=di(i).records[t]||(di(i).records[t]={});n.handler=r}}function IB(t,e){if(di(t).initialized)return;di(t).initialized=!0,r("click",le(Ty,"click")),r("mousemove",le(Ty,"mousemove")),r("globalout",OB);function r(i,n){t.on(i,function(a){var o=BB(e);PB(di(t).records,function(s){s&&n(s,a,o.dispatchAction)}),NB(o.pendings,e)})}}function NB(t,e){var r=t.showTip.length,i=t.hideTip.length,n;r?n=t.showTip[r-1]:i&&(n=t.hideTip[i-1]),n&&(n.dispatchAction=null,e.dispatchAction(n))}function OB(t,e,r){t.handler("leave",null,r)}function Ty(t,e,r,i){e.handler(t,r,i)}function BB(t){var e={showTip:[],hideTip:[]},r=function(i){var n=e[i.type];n?n.push(i):(i.dispatchAction=r,t.dispatchAction(i))};return{dispatchAction:r,pendings:e}}function _d(t,e){if(!vt.node){var r=e.getZr(),i=(di(r).records||{})[t];i&&(di(r).records[t]=null)}}var FB=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.render=function(r,i,n){var a=i.getComponent("tooltip"),o=r.get("triggerOn")||a&&a.get("triggerOn")||"mousemove|click";t2("axisPointer",n,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},e.prototype.remove=function(r,i){_d("axisPointer",i)},e.prototype.dispose=function(r,i){_d("axisPointer",i)},e.type="axisPointer",e}(ze);function e2(t,e){var r=[],i=t.seriesIndex,n;if(i==null||!(n=e.getSeriesByIndex(i)))return{point:[]};var a=n.getData(),o=qn(a,t);if(o==null||o<0||j(o))return{point:[]};var s=a.getItemGraphicEl(o),l=n.coordinateSystem;if(n.getTooltipPosition)r=n.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),f=l.getOtherAxis(u),h=f.dim,v=u.dim,c=h==="x"||h==="radius"?1:0,d=a.mapDimension(v),p=[];p[c]=a.get(d,o),p[1-c]=a.get(a.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(p)||[]}else r=l.dataToPoint(a.getValues(tt(l.dimensions,function(m){return a.mapDimension(m)}),o))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),r=[g.x+g.width/2,g.y+g.height/2]}return{point:r,el:s}}var Sy=Yt();function kB(t,e,r){var i=t.currTrigger,n=[t.x,t.y],a=t,o=t.dispatchAction||nt(r.dispatchAction,r),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){gu(n)&&(n=e2({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=gu(n),u=a.axesInfo,f=s.axesInfo,h=i==="leave"||gu(n),v={},c={},d={list:[],map:{}},p={showPointer:le(UB,c),showTooltip:le(HB,d)};C(s.coordSysMap,function(m,_){var y=l||m.containPoint(n);C(s.coordSysAxesInfo[_],function(x,S){var T=x.axis,w=XB(u,x);if(!h&&y&&(!u||w)){var b=w&&w.value;b==null&&!l&&(b=T.pointToData(n)),b!=null&&wy(x,b,p,!1,v)}})});var g={};return C(f,function(m,_){var y=m.linkGroup;y&&!c[_]&&C(y.axesInfo,function(x,S){var T=c[S];if(x!==m&&T){var w=T.value;y.mapper&&(w=m.axis.scale.parse(y.mapper(w,by(x),by(m)))),g[m.key]=w}})}),C(g,function(m,_){wy(f[_],m,p,!0,v)}),VB(c,f,v),GB(d,n,t,o),WB(f,o,r),v}}function wy(t,e,r,i,n){var a=t.axis;if(!(a.scale.isBlank()||!a.containData(e))){if(!t.involveSeries){r.showPointer(t,e);return}var o=zB(e,t),s=o.payloadBatch,l=o.snapToValue;s[0]&&n.seriesIndex==null&&Y(n,s[0]),!i&&t.snap&&a.containData(l)&&l!=null&&(e=l),r.showPointer(t,e,s),r.showTooltip(t,o,l)}}function zB(t,e){var r=e.axis,i=r.dim,n=t,a=[],o=Number.MAX_VALUE,s=-1;return C(e.seriesModels,function(l,u){var f=l.getData().mapDimensionsAll(i),h,v;if(l.getAxisTooltipData){var c=l.getAxisTooltipData(f,t,r);v=c.dataIndices,h=c.nestestValue}else{if(v=l.getData().indicesOfNearest(f[0],t,r.type==="category"?.5:null),!v.length)return;h=l.getData().get(f[0],v[0])}if(!(h==null||!isFinite(h))){var d=t-h,p=Math.abs(d);p<=o&&((p=0&&s<0)&&(o=p,s=d,n=h,a.length=0),C(v,function(g){a.push({seriesIndex:l.seriesIndex,dataIndexInside:g,dataIndex:l.getData().getRawIndex(g)})}))}}),{payloadBatch:a,snapToValue:n}}function UB(t,e,r,i){t[e.key]={value:r,payloadBatch:i}}function HB(t,e,r,i){var n=r.payloadBatch,a=e.axis,o=a.model,s=e.axisPointerModel;if(!(!e.triggerTooltip||!n.length)){var l=e.coordSys.model,u=Rs(l),f=t.map[u];f||(f=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(f)),f.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:n.slice()})}}function VB(t,e,r){var i=r.axesInfo=[];C(e,function(n,a){var o=n.axisPointerModel.option,s=t[a];s?(!n.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!n.useHandle&&(o.status="hide"),o.status==="show"&&i.push({axisDim:n.axis.dim,axisIndex:n.axis.model.componentIndex,value:o.value})})}function GB(t,e,r,i){if(gu(e)||!t.list.length){i({type:"hideTip"});return}var n=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:n.dataIndexInside,dataIndex:n.dataIndex,seriesIndex:n.seriesIndex,dataByCoordSys:t.list})}function WB(t,e,r){var i=r.getZr(),n="axisPointerLastHighlights",a=Sy(i)[n]||{},o=Sy(i)[n]={};C(t,function(u,f){var h=u.axisPointerModel.option;h.status==="show"&&u.triggerEmphasis&&C(h.seriesDataIndices,function(v){var c=v.seriesIndex+" | "+v.dataIndex;o[c]=v})});var s=[],l=[];C(a,function(u,f){!o[f]&&l.push(u)}),C(o,function(u,f){!a[f]&&s.push(u)}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function XB(t,e){for(var r=0;r<(t||[]).length;r++){var i=t[r];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}function by(t){var e=t.axis.model,r={},i=r.axisDim=t.axis.dim;return r.axisIndex=r[i+"AxisIndex"]=e.componentIndex,r.axisName=r[i+"AxisName"]=e.name,r.axisId=r[i+"AxisId"]=e.id,r}function gu(t){return!t||t[0]==null||isNaN(t[0])||t[1]==null||isNaN(t[1])}function r2(t){nw.registerAxisPointerClass("CartesianAxisPointer",DB),t.registerComponentModel(RB),t.registerComponentView(FB),t.registerPreprocessor(function(e){if(e){(!e.axisPointer||e.axisPointer.length===0)&&(e.axisPointer={});var r=e.axisPointer.link;r&&!j(r)&&(e.axisPointer.link=[r])}}),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,function(e,r){e.getComponent("axisPointer").coordSysAxesInfo=YI(e,r)}),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},kB)}function YB(t){Qe(oN),Qe(r2)}function ZB(t,e){var r=t.existing;if(e.id=t.keyInfo.id,!e.type&&r&&(e.type=r.type),e.parentId==null){var i=e.parentOption;i?e.parentId=i.id:r&&(e.parentId=r.parentId)}e.parentOption=null}function Ay(t,e){var r;return C(e,function(i){t[i]!=null&&t[i]!=="auto"&&(r=!0)}),r}function qB(t,e,r){var i=Y({},r),n=t[e],a=r.$action||"merge";a==="merge"?n?(dt(n,i,!0),Kn(n,i,{ignoreSize:!0}),hT(r,n),$l(r,n),$l(r,n,"shape"),$l(r,n,"style"),$l(r,n,"extra"),r.clipPath=n.clipPath):t[e]=i:a==="replace"?t[e]=i:a==="remove"&&n&&(t[e]=null)}var i2=["transition","enterFrom","leaveTo"],$B=i2.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function $l(t,e,r){if(r&&(!t[r]&&e[r]&&(t[r]={}),t=t[r],e=e[r]),!(!t||!e))for(var i=r?i2:$B,n=0;n=0;f--){var h=n[f],v=Ne(h.id,null),c=v!=null?o.get(v):null;if(c){var d=c.parent,m=fr(d),_=d===a?{width:s,height:l}:{width:m.width,height:m.height},y={},x=fT(c,h,_,null,{hv:h.hv,boundingMode:h.bounding},y);if(!fr(c).isNew&&x){for(var S=h.transition,T={},w=0;w=0)?T[b]=A:c[b]=A}Sr(c,T,r,0)}else c.attr(y)}}},e.prototype._clear=function(){var r=this,i=this._elMap;i.each(function(n){mu(n,fr(n).option,i,r._lastGraphicModel)}),this._elMap=ht()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(ze);function yd(t){var e=gt(Ey,t)?Ey[t]:Hx(t),r=new e({});return fr(r).type=t,r}function My(t,e,r,i){var n=yd(r);return e.add(n),i.set(t,n),fr(n).id=t,fr(n).isNew=!0,n}function mu(t,e,r,i){var n=t&&t.parent;n&&(t.type==="group"&&t.traverse(function(a){mu(a,e,r,i)}),pN(t,e,i),r.removeKey(fr(t).id))}function Cy(t,e,r,i){t.isGroup||C([["cursor",Jn.prototype.cursor],["zlevel",i||0],["z",r||0],["z2",0]],function(n){var a=n[0];gt(e,a)?t[a]=ft(e[a],n[1]):t[a]==null&&(t[a]=n[1])}),C(mt(e),function(n){if(n.indexOf("on")===0){var a=e[n];t[n]=ct(a)?a:null}}),gt(e,"draggable")&&(t.draggable=e.draggable),e.name!=null&&(t.name=e.name),e.id!=null&&(t.id=e.id)}function JB(t){return t=Y({},t),C(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(uT),function(e){delete t[e]}),t}function tF(t,e,r){var i=Mt(t).eventData;!t.silent&&!t.ignore&&!i&&(i=Mt(t).eventData={componentType:"graphic",componentIndex:e.componentIndex,name:t.name}),i&&(i.info=r.info)}function eF(t){t.registerComponentModel(jB),t.registerComponentView(QB),t.registerPreprocessor(function(e){var r=e.graphic;j(r)?!r[0]||!r[0].elements?e.graphic=[{elements:r}]:e.graphic=[e.graphic[0]]:r&&!r.elements&&(e.graphic=[{elements:[r]}])})}var Dy=["x","y","radius","angle","single"],rF=["cartesian2d","polar","singleAxis"];function iF(t){var e=t.get("coordinateSystem");return bt(rF,e)>=0}function Vi(t){return t+"Axis"}function nF(t,e){var r=ht(),i=[],n=ht();t.eachComponent({mainType:"dataZoom",query:e},function(f){n.get(f.uid)||s(f)});var a;do a=!1,t.eachComponent("dataZoom",o);while(a);function o(f){!n.get(f.uid)&&l(f)&&(s(f),a=!0)}function s(f){n.set(f.uid,!0),i.push(f),u(f)}function l(f){var h=!1;return f.eachTargetAxis(function(v,c){var d=r.get(v);d&&d[c]&&(h=!0)}),h}function u(f){f.eachTargetAxis(function(h,v){(r.get(h)||r.set(h,[]))[v]=!0})}return i}function n2(t){var e=t.ecModel,r={infoList:[],infoMap:ht()};return t.eachTargetAxis(function(i,n){var a=e.getComponent(Vi(i),n);if(a){var o=a.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(a)}}}),r}var Yc=function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},t}(),of=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return e.prototype.init=function(r,i,n){var a=Ly(r);this.settledOption=a,this.mergeDefaultAndTheme(r,n),this._doInit(a)},e.prototype.mergeOption=function(r){var i=Ly(r);dt(this.option,r,!0),dt(this.settledOption,i,!0),this._doInit(i)},e.prototype._doInit=function(r){var i=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var n=this.settledOption;C([["start","startValue"],["end","endValue"]],function(a,o){this._rangePropMode[o]==="value"&&(i[a[0]]=n[a[0]]=null)},this),this._resetTarget()},e.prototype._resetTarget=function(){var r=this.get("orient",!0),i=this._targetAxisInfoMap=ht(),n=this._fillSpecifiedTargetAxis(i);n?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(i,this._orient)),this._noTarget=!0,i.each(function(a){a.indexList.length&&(this._noTarget=!1)},this)},e.prototype._fillSpecifiedTargetAxis=function(r){var i=!1;return C(Dy,function(n){var a=this.getReferringComponents(Vi(n),XA);if(a.specified){i=!0;var o=new Yc;C(a.models,function(s){o.add(s.componentIndex)}),r.set(n,o)}},this),i},e.prototype._fillAutoTargetAxisByOrient=function(r,i){var n=this.ecModel,a=!0;if(a){var o=i==="vertical"?"y":"x",s=n.findComponents({mainType:o+"Axis"});l(s,o)}if(a){var s=n.findComponents({mainType:"singleAxis",filter:function(f){return f.get("orient",!0)===i}});l(s,"single")}function l(u,f){var h=u[0];if(h){var v=new Yc;if(v.add(h.componentIndex),r.set(f,v),a=!1,f==="x"||f==="y"){var c=h.getReferringComponents("grid",Ze).models[0];c&&C(u,function(d){h.componentIndex!==d.componentIndex&&c===d.getReferringComponents("grid",Ze).models[0]&&v.add(d.componentIndex)})}}}a&&C(Dy,function(u){if(a){var f=n.findComponents({mainType:Vi(u),filter:function(v){return v.get("type",!0)==="category"}});if(f[0]){var h=new Yc;h.add(f[0].componentIndex),r.set(u,h),a=!1}}},this)},e.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(i){!r&&(r=i)},this),r==="y"?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var i=this.ecModel.option;this.option.throttle=i.animation&&i.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(r){var i=this._rangePropMode,n=this.get("rangeMode");C([["start","startValue"],["end","endValue"]],function(a,o){var s=r[a[0]]!=null,l=r[a[1]]!=null;s&&!l?i[o]="percent":!s&&l?i[o]="value":n?i[o]=n[o]:s&&(i[o]="percent")})},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(i,n){r==null&&(r=this.ecModel.getComponent(Vi(i),n))},this),r},e.prototype.eachTargetAxis=function(r,i){this._targetAxisInfoMap.each(function(n,a){C(n.indexList,function(o){r.call(i,a,o)})})},e.prototype.getAxisProxy=function(r,i){var n=this.getAxisModel(r,i);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(r,i){var n=this._targetAxisInfoMap.get(r);if(n&&n.indexMap[i])return this.ecModel.getComponent(Vi(r),i)},e.prototype.setRawRange=function(r){var i=this.option,n=this.settledOption;C([["start","startValue"],["end","endValue"]],function(a){(r[a[0]]!=null||r[a[1]]!=null)&&(i[a[0]]=n[a[0]]=r[a[0]],i[a[1]]=n[a[1]]=r[a[1]])},this),this._updateRangeUse(r)},e.prototype.setCalculatedRange=function(r){var i=this.option;C(["start","startValue","end","endValue"],function(n){i[n]=r[n]})},e.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getDataPercentWindow()},e.prototype.getValueRange=function(r,i){if(r==null&&i==null){var n=this.findRepresentativeAxisProxy();if(n)return n.getDataValueWindow()}else return this.getAxisProxy(r,i).getDataValueWindow()},e.prototype.findRepresentativeAxisProxy=function(r){if(r)return r.__dzAxisProxy;for(var i,n=this._targetAxisInfoMap.keys(),a=0;ao[1];if(y&&!x&&!S)return!0;y&&(g=!0),x&&(d=!0),S&&(p=!0)}return g&&d&&p})}else La(f,function(c){if(a==="empty")l.setData(u=u.map(c,function(p){return s(p)?p:NaN}));else{var d={};d[c]=o,u.selectRange(d)}});La(f,function(c){u.setApproximateExtent(o,c)})}});function s(l){return l>=o[0]&&l<=o[1]}},t.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},r=this._dataZoomModel,i=this._dataExtent;La(["min","max"],function(n){var a=r.get(n+"Span"),o=r.get(n+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?a=te(i[0]+o,i,[0,100],!0):a!=null&&(o=te(a,[0,100],i,!0)-i[0]),e[n+"Span"]=a,e[n+"ValueSpan"]=o},this)},t.prototype._setAxisModel=function(){var e=this.getAxisModel(),r=this._percentWindow,i=this._valueWindow;if(r){var n=nx(i,[0,500]);n=Math.min(n,20);var a=e.axis.scale.rawExtentInfo;r[0]!==0&&a.setDeterminedMinMax("min",+i[0].toFixed(n)),r[1]!==100&&a.setDeterminedMinMax("max",+i[1].toFixed(n)),a.freeze()}},t}();function oF(t,e,r){var i=[1/0,-1/0];La(r,function(o){cP(i,o.getData(),e)});var n=t.getAxisModel(),a=IS(n.axis.scale,n,i).calculate();return[a.min,a.max]}var sF={getTargetSeries:function(t){function e(n){t.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=t.getComponent(Vi(o),s);n(o,s,l,a)})})}e(function(n,a,o,s){o.__dzAxisProxy=null});var r=[];e(function(n,a,o,s){o.__dzAxisProxy||(o.__dzAxisProxy=new aF(n,a,s,t),r.push(o.__dzAxisProxy))});var i=ht();return C(r,function(n){C(n.getTargetSeriesModels(),function(a){i.set(a.uid,a)})}),i},overallReset:function(t,e){t.eachComponent("dataZoom",function(r){r.eachTargetAxis(function(i,n){r.getAxisProxy(i,n).reset(r)}),r.eachTargetAxis(function(i,n){r.getAxisProxy(i,n).filterData(r,e)})}),t.eachComponent("dataZoom",function(r){var i=r.findRepresentativeAxisProxy();if(i){var n=i.getDataPercentWindow(),a=i.getDataValueWindow();r.setCalculatedRange({start:n[0],end:n[1],startValue:a[0],endValue:a[1]})}})}};function lF(t){t.registerAction("dataZoom",function(e,r){var i=nF(r,e);C(i,function(n){n.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}var Py=!1;function o2(t){Py||(Py=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,sF),lF(t),t.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}function uF(t,e){var r=Ys(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),t=new Kt({shape:{x:t.x-r[3],y:t.y-r[0],width:t.width+r[1]+r[3],height:t.height+r[0]+r[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1}),t}var fF=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(Rt);function s2(t){var e=t.get("confine");return e!=null?!!e:t.get("renderMode")==="richText"}function l2(t){if(vt.domSupported){for(var e=document.documentElement.style,r=0,i=t.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=a==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=a==="top"?225:45)+"deg)");var f=u*Math.PI/180,h=o+n,v=h*Math.abs(Math.cos(f))+h*Math.abs(Math.sin(f)),c=Math.round(((v-Math.SQRT2*n)/2+Math.SQRT2*n-(v-h)/2)*100)/100;s+=";"+a+":-"+c+"px";var d=e+" solid "+n+"px;",p=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+d,"border-right:"+d,"background-color:"+i+";"];return'
'}function mF(t,e){var r="cubic-bezier(0.23,1,0.32,1)",i=" "+t/2+"s "+r,n="opacity"+i+",visibility"+i;return e||(i=" "+t+"s "+r,n+=vt.transformSupported?","+$p+i:",left"+i+",top"+i),vF+":"+n}function Iy(t,e,r){var i=t.toFixed(0)+"px",n=e.toFixed(0)+"px";if(!vt.transformSupported)return r?"top:"+n+";left:"+i+";":[["top",n],["left",i]];var a=vt.transform3dSupported,o="translate"+(a?"3d":"")+"("+i+","+n+(a?",0":"")+")";return r?"top:0;left:0;"+$p+":"+o+";":[["top",0],["left",0],[u2,o]]}function _F(t){var e=[],r=t.get("fontSize"),i=t.getTextColor();i&&e.push("color:"+i),e.push("font:"+t.getFont()),r&&e.push("line-height:"+Math.round(r*3/2)+"px");var n=t.get("textShadowColor"),a=t.get("textShadowBlur")||0,o=t.get("textShadowOffsetX")||0,s=t.get("textShadowOffsetY")||0;return n&&a&&e.push("text-shadow:"+o+"px "+s+"px "+a+"px "+n),C(["decoration","align"],function(l){var u=t.get(l);u&&e.push("text-"+l+":"+u)}),e.join(";")}function yF(t,e,r){var i=[],n=t.get("transitionDuration"),a=t.get("backgroundColor"),o=t.get("shadowBlur"),s=t.get("shadowColor"),l=t.get("shadowOffsetX"),u=t.get("shadowOffsetY"),f=t.getModel("textStyle"),h=FT(t,"html"),v=l+"px "+u+"px "+o+"px "+s;return i.push("box-shadow:"+v),e&&n&&i.push(mF(n,r)),a&&i.push("background-color:"+a),C(["width","color","radius"],function(c){var d="border-"+c,p=oT(d),g=t.get(p);g!=null&&i.push(d+":"+g+(c==="color"?"":"px"))}),i.push(_F(f)),h!=null&&i.push("padding:"+Ys(h).join("px ")+"px"),i.join(";")+";"}function Ny(t,e,r,i,n){var a=e&&e.painter;if(r){var o=a&&a.getViewportRoot();o&&pb(t,o,r,i,n)}else{t[0]=i,t[1]=n;var s=a&&a.getViewportRootOffset();s&&(t[0]+=s.offsetLeft,t[1]+=s.offsetTop)}t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}var xF=function(){function t(e,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,vt.wxa)return null;var i=document.createElement("div");i.domBelongToZr=!0,this.el=i;var n=this._zr=e.getZr(),a=r.appendTo,o=a&&(Q(a)?document.querySelector(a):gs(a)?a:ct(a)&&a(e.getDom()));Ny(this._styleCoord,n,o,e.getWidth()/2,e.getHeight()/2),(o||e.getDom()).appendChild(i),this._api=e,this._container=o;var s=this;i.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},i.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=n.handler,f=n.painter.getViewportRoot();sr(f,l,!0),u.dispatch("mousemove",l)}},i.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return t.prototype.update=function(e){if(!this._container){var r=this._api.getDom(),i=cF(r,"position"),n=r.style;n.position!=="absolute"&&i!=="absolute"&&(n.position="relative")}var a=e.get("alwaysShowContent");a&&this._moveIfResized(),this._alwaysShowContent=a,this.el.className=e.get("className")||""},t.prototype.show=function(e,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var i=this.el,n=i.style,a=this._styleCoord;i.innerHTML?n.cssText=dF+yF(e,!this._firstShow,this._longHide)+Iy(a[0],a[1],!0)+("border-color:"+$n(r)+";")+(e.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):n.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},t.prototype.setContent=function(e,r,i,n,a){var o=this.el;if(e==null){o.innerHTML="";return}var s="";if(Q(a)&&i.get("trigger")==="item"&&!s2(i)&&(s=gF(i,n,a)),Q(e))o.innerHTML=e+s;else if(e){o.innerHTML="",j(e)||(e=[e]);for(var l=0;l=0?this._tryShow(a,o):n==="leave"&&this._hide(o))},this))},e.prototype._keepShow=function(){var r=this._tooltipModel,i=this._ecModel,n=this._api,a=r.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&a!=="none"&&a!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&o.manuallyShowTip(r,i,n,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},e.prototype.manuallyShowTip=function(r,i,n,a){if(!(a.from===this.uid||vt.node||!n.getDom())){var o=Fy(a,n);this._ticket="";var s=a.dataByCoordSys,l=MF(a,i,n);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:a.position,positionDefault:"bottom"},o)}else if(a.tooltip&&a.x!=null&&a.y!=null){var f=SF;f.x=a.x,f.y=a.y,f.update(),Mt(f).tooltipConfig={name:null,option:a.tooltip},this._tryShow({offsetX:a.x,offsetY:a.y,target:f},o)}else if(s)this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,dataByCoordSys:s,tooltipOption:a.tooltipOption},o);else if(a.seriesIndex!=null){if(this._manuallyAxisShowTip(r,i,n,a))return;var h=e2(a,i),v=h.point[0],c=h.point[1];v!=null&&c!=null&&this._tryShow({offsetX:v,offsetY:c,target:h.el,position:a.position,positionDefault:"bottom"},o)}else a.x!=null&&a.y!=null&&(n.dispatchAction({type:"updateAxisPointer",x:a.x,y:a.y}),this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,target:n.getZr().findHover(a.x,a.y).target},o))}},e.prototype.manuallyHideTip=function(r,i,n,a){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,a.from!==this.uid&&this._hide(Fy(a,n))},e.prototype._manuallyAxisShowTip=function(r,i,n,a){var o=a.seriesIndex,s=a.dataIndex,l=i.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=i.getSeriesByIndex(o);if(u){var f=u.getData(),h=Vo([f.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return n.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:a.position}),!0}}},e.prototype._tryShow=function(r,i){var n=r.target,a=this._tooltipModel;if(a){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(n){var s=Mt(n);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null;var l,u;Ba(n,function(f){if(Mt(f).dataIndex!=null)return l=f,!0;if(Mt(f).tooltipConfig!=null)return u=f,!0},!0),l?this._showSeriesItemTooltip(r,l,i):u?this._showComponentItemTooltip(r,u,i):this._hide(i)}else this._lastDataByCoordSys=null,this._hide(i)}},e.prototype._showOrMove=function(r,i){var n=r.get("showDelay");i=nt(i,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(i,n):i()},e.prototype._showAxisTooltip=function(r,i){var n=this._ecModel,a=this._tooltipModel,o=[i.offsetX,i.offsetY],s=Vo([i.tooltipOption],a),l=this._renderMode,u=[],f=Ms("section",{blocks:[],noHeader:!0}),h=[],v=new $h;C(r,function(_){C(_.dataByAxis,function(y){var x=n.getComponent(y.axisDim+"Axis",y.axisIndex),S=y.value;if(!(!x||S==null)){var T=Qw(S,x.axis,n,y.seriesDataIndices,y.valueLabelOpt),w=Ms("section",{header:T,noHeader:!jr(T),sortBlocks:!0,blocks:[]});f.blocks.push(w),C(y.seriesDataIndices,function(b){var A=n.getSeriesByIndex(b.seriesIndex),M=b.dataIndexInside,E=A.getDataParams(M);if(!(E.dataIndex<0)){E.axisDim=y.axisDim,E.axisIndex=y.axisIndex,E.axisType=y.axisType,E.axisId=y.axisId,E.axisValue=Lp(x.axis,{value:S}),E.axisValueLabel=T,E.marker=v.makeTooltipMarker("item",$n(E.color),l);var D=qm(A.formatTooltip(M,!0,null)),R=D.frag;if(R){var P=Vo([A],a).get("valueFormatter");w.blocks.push(P?Y({valueFormatter:P},R):R)}D.text&&h.push(D.text),u.push(E)}})}})}),f.blocks.reverse(),h.reverse();var c=i.position,d=s.get("order"),p=t0(f,v,l,d,n.get("useUTC"),s.get("textStyle"));p&&h.unshift(p);var g=l==="richText"?` `:"
",m=h.join(g);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,c,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,m,u,Math.random()+"",o[0],o[1],c,null,v)})},e.prototype._showSeriesItemTooltip=function(r,i,n){var a=this._ecModel,o=Mt(i),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,f=o.dataIndex,h=o.dataType,v=u.getData(h),c=this._renderMode,d=r.positionDefault,p=Vo([v.getItemModel(f),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),g=p.get("trigger");if(!(g!=null&&g!=="item")){var m=u.getDataParams(f,h),_=new $h;m.marker=_.makeTooltipMarker("item",$n(m.color),c);var y=qm(u.formatTooltip(f,!1,h)),x=p.get("order"),S=p.get("valueFormatter"),T=y.frag,w=T?t0(S?Y({valueFormatter:S},T):T,_,c,x,a.get("useUTC"),p.get("textStyle")):y.text,b="item_"+u.name+"_"+f;this._showOrMove(p,function(){this._showTooltipContent(p,w,m,b,r.offsetX,r.offsetY,r.position,r.target,_)}),n({type:"showTip",dataIndexInside:f,dataIndex:v.getRawIndex(f),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(r,i,n){var a=this._renderMode==="html",o=Mt(i),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(Q(l)){var f=l;l={content:f,formatter:f},u=!0}u&&a&&l.content&&(l=ut(l),l.content=_e(l.content));var h=[l],v=this._ecModel.getComponent(o.componentMainType,o.componentIndex);v&&h.push(v),h.push({formatter:l.content});var c=r.positionDefault,d=Vo(h,this._tooltipModel,c?{position:c}:null),p=d.get("content"),g=Math.random()+"",m=new $h;this._showOrMove(d,function(){var _=ut(d.get("formatterParams")||{});this._showTooltipContent(d,p,_,g,r.offsetX,r.offsetY,r.position,i,m)}),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(r,i,n,a,o,s,l,u,f){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var h=this._tooltipContent;h.setEnterable(r.get("enterable"));var v=r.get("formatter");l=l||r.get("position");var c=i,d=this._getNearestPoint([o,s],n,r.get("trigger"),r.get("borderColor")),p=d.color;if(v)if(Q(v)){var g=r.ecModel.get("useUTC"),m=j(n)?n[0]:n,_=m&&m.axisType&&m.axisType.indexOf("time")>=0;c=v,_&&(c=Rf(m.axisValue,c,g)),c=sT(c,n,!0)}else if(ct(v)){var y=nt(function(x,S){x===this._ticket&&(h.setContent(S,f,r,p,l),this._updatePosition(r,l,o,s,h,n,u))},this);this._ticket=a,c=v(n,a,y)}else c=v;h.setContent(c,f,r,p,l),h.show(r,p),this._updatePosition(r,l,o,s,h,n,u)}},e.prototype._getNearestPoint=function(r,i,n,a){if(n==="axis"||j(i))return{color:a||(this._renderMode==="html"?"#fff":"none")};if(!j(i))return{color:a||i.color||i.borderColor}},e.prototype._updatePosition=function(r,i,n,a,o,s,l){var u=this._api.getWidth(),f=this._api.getHeight();i=i||r.get("position");var h=o.getSize(),v=r.get("align"),c=r.get("verticalAlign"),d=l&&l.getBoundingRect().clone();if(l&&d.applyTransform(l.transform),ct(i)&&(i=i([n,a],s,o.el,d,{viewSize:[u,f],contentSize:h.slice()})),j(i))n=se(i[0],u),a=se(i[1],f);else if(rt(i)){var p=i;p.width=h[0],p.height=h[1];var g=Ki(p,{width:u,height:f});n=g.x,a=g.y,v=null,c=null}else if(Q(i)&&l){var m=EF(i,d,h,r.get("borderWidth"));n=m[0],a=m[1]}else{var m=bF(n,a,o,u,f,v?null:20,c?null:20);n=m[0],a=m[1]}if(v&&(n-=ky(v)?h[0]/2:v==="right"?h[0]:0),c&&(a-=ky(c)?h[1]/2:c==="bottom"?h[1]:0),s2(r)){var m=AF(n,a,o,u,f);n=m[0],a=m[1]}o.moveTo(n,a)},e.prototype._updateContentNotChangedOnAxis=function(r,i){var n=this._lastDataByCoordSys,a=this._cbParamsList,o=!!n&&n.length===r.length;return o&&C(n,function(s,l){var u=s.dataByAxis||[],f=r[l]||{},h=f.dataByAxis||[];o=o&&u.length===h.length,o&&C(u,function(v,c){var d=h[c]||{},p=v.seriesDataIndices||[],g=d.seriesDataIndices||[];o=o&&v.value===d.value&&v.axisType===d.axisType&&v.axisId===d.axisId&&p.length===g.length,o&&C(p,function(m,_){var y=g[_];o=o&&m.seriesIndex===y.seriesIndex&&m.dataIndex===y.dataIndex}),a&&C(v.seriesDataIndices,function(m){var _=m.seriesIndex,y=i[_],x=a[_];y&&x&&x.data!==y.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=i,!!o},e.prototype._hide=function(r){this._lastDataByCoordSys=null,r({type:"hideTip",from:this.uid})},e.prototype.dispose=function(r,i){vt.node||!i.getDom()||(Vu(this,"_updatePosition"),this._tooltipContent.dispose(),_d("itemTooltip",i))},e.type="tooltip",e}(ze);function Vo(t,e,r){var i=e.ecModel,n;r?(n=new Zt(r,i,i),n=new Zt(e.option,n,i)):n=e;for(var a=t.length-1;a>=0;a--){var o=t[a];o&&(o instanceof Zt&&(o=o.get("tooltip",!0)),Q(o)&&(o={formatter:o}),o&&(n=new Zt(o,n,i)))}return n}function Fy(t,e){return t.dispatchAction||nt(e.dispatchAction,e)}function bF(t,e,r,i,n,a,o){var s=r.getSize(),l=s[0],u=s[1];return a!=null&&(t+l+a+2>i?t-=l+a:t+=a),o!=null&&(e+u+o>n?e-=u+o:e+=o),[t,e]}function AF(t,e,r,i,n){var a=r.getSize(),o=a[0],s=a[1];return t=Math.min(t+o,i)-o,e=Math.min(e+s,n)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function EF(t,e,r,i){var n=r[0],a=r[1],o=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,f=e.height;switch(t){case"inside":s=e.x+u/2-n/2,l=e.y+f/2-a/2;break;case"top":s=e.x+u/2-n/2,l=e.y-a-o;break;case"bottom":s=e.x+u/2-n/2,l=e.y+f+o;break;case"left":s=e.x-n-o,l=e.y+f/2-a/2;break;case"right":s=e.x+u+o,l=e.y+f/2-a/2}return[s,l]}function ky(t){return t==="center"||t==="middle"}function MF(t,e,r){var i=Vd(t).queryOptionMap,n=i.keys()[0];if(!(!n||n==="series")){var a=Vs(e,n,i.get(n),{useDefault:!1,enableAll:!1,enableNone:!1}),o=a.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var f=Mt(u).tooltipConfig;if(f&&f.name===t.name)return l=u,!0}),l)return{componentMainType:n,componentIndex:o.componentIndex,el:l}}}}function CF(t){Qe(r2),t.registerComponentModel(fF),t.registerComponentView(wF),t.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Te),t.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Te)}var zy=C;function Uy(t){if(t){for(var e in t)if(t.hasOwnProperty(e))return!0}}function Hy(t,e,r){var i={};return zy(e,function(a){var o=i[a]=n();zy(t[a],function(s,l){if(Me.isValidType(l)){var u={type:l,visual:s};r&&r(u,a),o[l]=new Me(u),l==="opacity"&&(u=ut(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Me(u))}})}),i;function n(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function DF(t,e,r){var i;C(r,function(n){e.hasOwnProperty(n)&&Uy(e[n])&&(i=!0)}),i&&C(r,function(n){e.hasOwnProperty(n)&&Uy(e[n])?t[n]=ut(e[n]):delete t[n]})}function LF(t,e,r,i){var n={};return C(t,function(a){var o=Me.prepareVisualTypes(e[a]);n[a]=o}),{progress:function(o,s){var l;i!=null&&(l=s.getDimensionIndex(i));function u(S){return ZT(s,h,S)}function f(S,T){fL(s,h,S,T)}for(var h,v=s.getStore();(h=o.next())!=null;){var c=s.getRawDataItem(h);if(!(c&&c.visualMap===!1))for(var d=i!=null?v.get(l,h):h,p=r(d),g=e[p],m=n[p],_=0,y=m.length;_=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Rt),Aa=le,Td=C,Kl=ee,h2=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.newlineDisabled=!1,r}return e.prototype.init=function(){this.group.add(this._contentGroup=new Kl),this.group.add(this._selectorGroup=new Kl),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(r,i,n){var a=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),u=r.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,r,i,n,l,s,u);var f=r.getBoxLayoutParams(),h={width:n.getWidth(),height:n.getHeight()},v=r.get("padding"),c=Ki(f,h,v),d=this.layoutInner(r,o,c,a,l,u),p=Ki(Et({width:d.width,height:d.height},f),h,v);this.group.x=p.x-d.x,this.group.y=p.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=uF(d,r))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(r,i,n,a,o,s,l){var u=this.getContentGroup(),f=ht(),h=i.get("selectedMode"),v=[];n.eachRawSeries(function(c){!c.get("legendHoverLink")&&v.push(c.id)}),Td(i.getData(),function(c,d){var p=c.get("name");if(!this.newlineDisabled&&(p===""||p===` `)){var g=new Kl;g.newline=!0,u.add(g);return}var m=n.getSeriesByName(p)[0];if(!f.get(p))if(m){var _=m.getData(),y=_.getVisual("legendLineStyle")||{},x=_.getVisual("legendIcon"),S=_.getVisual("style"),T=this._createItem(m,p,d,c,i,r,y,S,x,h,a);T.on("click",Aa(Vy,p,null,a,v)).on("mouseover",Aa(Sd,m.name,null,a,v)).on("mouseout",Aa(wd,m.name,null,a,v)),n.ssr&&T.eachChild(function(w){var b=Mt(w);b.seriesIndex=m.seriesIndex,b.dataIndex=d,b.ssrType="legend"}),f.set(p,!0)}else n.eachRawSeries(function(w){if(!f.get(p)&&w.legendVisualProvider){var b=w.legendVisualProvider;if(!b.containName(p))return;var A=b.indexOfName(p),M=b.getItemVisual(A,"style"),E=b.getItemVisual(A,"legendIcon"),D=Be(M.fill);D&&D[3]===0&&(D[3]=.2,M=Y(Y({},M),{fill:pi(D,"rgba")}));var R=this._createItem(w,p,d,c,i,r,{},M,E,h,a);R.on("click",Aa(Vy,null,p,a,v)).on("mouseover",Aa(Sd,null,p,a,v)).on("mouseout",Aa(wd,null,p,a,v)),n.ssr&&R.eachChild(function(P){var I=Mt(P);I.seriesIndex=w.seriesIndex,I.dataIndex=d,I.ssrType="legend"}),f.set(p,!0)}},this)},this),o&&this._createSelector(o,i,a,s,l)},e.prototype._createSelector=function(r,i,n,a,o){var s=this.getSelectorGroup();Td(r,function(u){var f=u.type,h=new Xt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:f==="all"?"legendAllSelect":"legendInverseSelect"})}});s.add(h);var v=i.getModel("selectorLabel"),c=i.getModel(["emphasis","selectorLabel"]);op(h,{normal:v,emphasis:c},{defaultText:u.title}),Nu(h)})},e.prototype._createItem=function(r,i,n,a,o,s,l,u,f,h,v){var c=r.visualDrawType,d=o.get("itemWidth"),p=o.get("itemHeight"),g=o.isSelected(i),m=a.get("symbolRotate"),_=a.get("symbolKeepAspect"),y=a.get("icon");f=y||f||"roundRect";var x=PF(f,a,l,u,c,g,v),S=new Kl,T=a.getModel("textStyle");if(ct(r.getLegendIcon)&&(!y||y==="inherit"))S.add(r.getLegendIcon({itemWidth:d,itemHeight:p,icon:f,iconRotate:m,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:_}));else{var w=y==="inherit"&&r.getData().getVisual("symbol")?m==="inherit"?r.getData().getVisual("symbolRotate"):m:0;S.add(IF({itemWidth:d,itemHeight:p,icon:f,iconRotate:w,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:_}))}var b=s==="left"?d+5:-5,A=s,M=o.get("formatter"),E=i;Q(M)&&M?E=M.replace("{name}",i??""):ct(M)&&(E=M(i));var D=g?T.getTextColor():a.get("inactiveColor");S.add(new Xt({style:qe(T,{text:E,x:b,y:p/2,fill:D,align:A,verticalAlign:"middle"},{inheritColor:D})}));var R=new Kt({shape:S.getBoundingRect(),style:{fill:"transparent"}}),P=a.getModel("tooltip");return P.get("show")&&Mf({el:R,componentModel:o,itemName:i,itemTooltipOption:P.option}),S.add(R),S.eachChild(function(I){I.silent=!0}),R.silent=!h,this.getContentGroup().add(S),Nu(S),S.__legendDataIndex=n,S},e.prototype.layoutInner=function(r,i,n,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();$a(r.get("orient"),l,r.get("itemGap"),n.width,n.height);var f=l.getBoundingRect(),h=[-f.x,-f.y];if(u.markRedraw(),l.markRedraw(),o){$a("horizontal",u,r.get("selectorItemGap",!0));var v=u.getBoundingRect(),c=[-v.x,-v.y],d=r.get("selectorButtonGap",!0),p=r.getOrient().index,g=p===0?"width":"height",m=p===0?"height":"width",_=p===0?"y":"x";s==="end"?c[p]+=f[g]+d:h[p]+=v[g]+d,c[1-p]+=f[m]/2-v[m]/2,u.x=c[0],u.y=c[1],l.x=h[0],l.y=h[1];var y={x:0,y:0};return y[g]=f[g]+d+v[g],y[m]=Math.max(f[m],v[m]),y[_]=Math.min(0,v[_]+c[1-p]),y}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(ze);function PF(t,e,r,i,n,a,o){function s(g,m){g.lineWidth==="auto"&&(g.lineWidth=m.lineWidth>0?2:0),Td(g,function(_,y){g[y]==="inherit"&&(g[y]=m[y])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),f=t.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?i.decal:Xv(h,o),u.fill==="inherit"&&(u.fill=i[n]),u.stroke==="inherit"&&(u.stroke=i[f]),u.opacity==="inherit"&&(u.opacity=(n==="fill"?i:r).opacity),s(u,i);var v=e.getModel("lineStyle"),c=v.getLineStyle();if(s(c,r),u.fill==="auto"&&(u.fill=i.fill),u.stroke==="auto"&&(u.stroke=i.fill),c.stroke==="auto"&&(c.stroke=i.fill),!a){var d=e.get("inactiveBorderWidth"),p=u[f];u.lineWidth=d==="auto"?i.lineWidth>0&&p?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),c.stroke=v.get("inactiveColor"),c.lineWidth=v.get("inactiveWidth")}return{itemStyle:u,lineStyle:c}}function IF(t){var e=t.icon||"roundRect",r=Br(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);return r.setStyle(t.itemStyle),r.rotation=(t.iconRotate||0)*Math.PI/180,r.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(r.style.stroke=r.style.fill,r.style.fill="#fff",r.style.lineWidth=2),r}function Vy(t,e,r,i){wd(t,e,r,i),r.dispatchAction({type:"legendToggleSelect",name:t??e}),Sd(t,e,r,i)}function c2(t){for(var e=t.getZr().storage.getDisplayList(),r,i=0,n=e.length;in[o],g=[-c.x,-c.y];i||(g[a]=f[u]);var m=[0,0],_=[-d.x,-d.y],y=ft(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(p){var x=r.get("pageButtonPosition",!0);x==="end"?_[a]+=n[o]-d[o]:m[a]+=d[o]+y}_[1-a]+=c[s]/2-d[s]/2,f.setPosition(g),h.setPosition(m),v.setPosition(_);var S={x:0,y:0};if(S[o]=p?n[o]:c[o],S[s]=Math.max(c[s],d[s]),S[l]=Math.min(0,d[l]+_[1-a]),h.__rectSize=n[o],p){var T={x:0,y:0};T[o]=Math.max(n[o]-d[o]-y,0),T[s]=S[s],h.setClipPath(new Kt({shape:T})),h.__rectSize=T[o]}else v.eachChild(function(b){b.attr({invisible:!0,silent:!0})});var w=this._getPageInfo(r);return w.pageIndex!=null&&Sr(f,{x:w.contentPosition[0],y:w.contentPosition[1]},p?r:null),this._updatePageInfoView(r,w),S},e.prototype._pageGo=function(r,i,n){var a=this._getPageInfo(i)[r];a!=null&&n.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:i.id})},e.prototype._updatePageInfoView=function(r,i){var n=this._controllerGroup;C(["pagePrev","pageNext"],function(f){var h=f+"DataIndex",v=i[h]!=null,c=n.childOfName(f);c&&(c.setStyle("fill",v?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),c.cursor=v?"pointer":"default")});var a=n.childOfName("pageText"),o=r.get("pageFormatter"),s=i.pageIndex,l=s!=null?s+1:0,u=i.pageCount;a&&o&&a.setStyle("text",Q(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(r){var i=r.get("scrollDataIndex",!0),n=this.getContentGroup(),a=this._containerGroup.__rectSize,o=r.getOrient().index,s=Zc[o],l=qc[o],u=this._findTargetItemIndex(i),f=n.children(),h=f[u],v=f.length,c=v?1:0,d={contentPosition:[n.x,n.y],pageCount:c,pageIndex:c-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return d;var p=x(h);d.contentPosition[o]=-p.s;for(var g=u+1,m=p,_=p,y=null;g<=v;++g)y=x(f[g]),(!y&&_.e>m.s+a||y&&!S(y,m.s))&&(_.i>m.i?m=_:m=y,m&&(d.pageNextDataIndex==null&&(d.pageNextDataIndex=m.i),++d.pageCount)),_=y;for(var g=u-1,m=p,_=p,y=null;g>=-1;--g)y=x(f[g]),(!y||!S(_,y.s))&&m.i<_.i&&(_=m,d.pagePrevDataIndex==null&&(d.pagePrevDataIndex=m.i),++d.pageCount,++d.pageIndex),m=y;return d;function x(T){if(T){var w=T.getBoundingRect(),b=w[l]+T[l];return{s:b,e:b+w[s],i:T.__legendDataIndex}}}function S(T,w){return T.e>=w&&T.s<=w+a}},e.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var i,n=this.getContentGroup(),a;return n.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===r&&(i=s)}),i??a},e.type="legend.scroll",e}(h2);function kF(t){t.registerAction("legendScroll","legendscroll",function(e,r){var i=e.scrollDataIndex;i!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:e},function(n){n.setScrollDataIndex(i)})})}function zF(t){Qe(v2),t.registerComponentModel(BF),t.registerComponentView(FF),kF(t)}function UF(t){Qe(v2),Qe(zF)}var HF=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="dataZoom.inside",e.defaultOption=Xs(of.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}(of),Kp=Yt();function VF(t,e,r){Kp(t).coordSysRecordMap.each(function(i){var n=i.dataZoomInfoMap.get(e.uid);n&&(n.getRange=r)})}function GF(t,e){for(var r=Kp(t).coordSysRecordMap,i=r.keys(),n=0;ni[r+e]&&(e=s),n=n&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!n}}}function qF(t){t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,function(e,r){var i=Kp(r),n=i.coordSysRecordMap||(i.coordSysRecordMap=ht());n.each(function(a){a.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=n2(a);C(o.infoList,function(s){var l=s.model.uid,u=n.get(l)||n.set(l,WF(r,s.model)),f=u.dataZoomInfoMap||(u.dataZoomInfoMap=ht());f.set(a.uid,{dzReferCoordSysInfo:s,model:a,getRange:null})})}),n.each(function(a){var o=a.controller,s,l=a.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){d2(n,a);return}var f=ZF(l);o.enable(f.controlType,f.opt),o.setPointerChecker(a.containsPoint),zf(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var $F=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return e.prototype.render=function(r,i,n){if(t.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),VF(n,r,{pan:nt($c.pan,this),zoom:nt($c.zoom,this),scrollMove:nt($c.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),t.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){GF(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(a2),$c={zoom:function(t,e,r,i){var n=this.range,a=n.slice(),o=t.axisModels[0];if(o){var s=Kc[e](null,[i.originX,i.originY],o,r,t),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/i.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var f=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(qs(0,a,[0,100],0,f.minSpan,f.maxSpan),this.range=a,n[0]!==a[0]||n[1]!==a[1])return a}},pan:Xy(function(t,e,r,i,n,a){var o=Kc[i]([a.oldX,a.oldY],[a.newX,a.newY],e,n,r);return o.signal*(t[1]-t[0])*o.pixel/o.pixelLength}),scrollMove:Xy(function(t,e,r,i,n,a){var o=Kc[i]([0,0],[a.scrollDelta,a.scrollDelta],e,n,r);return o.signal*(t[1]-t[0])*a.scrollDelta})};function Xy(t){return function(e,r,i,n){var a=this.range,o=a.slice(),s=e.axisModels[0];if(s){var l=t(o,s,e,r,i,n);if(qs(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var Kc={grid:function(t,e,r,i,n){var a=r.axis,o={},s=n.model.coordinateSystem.getRect();return t=t||[0,0],a.dim==="x"?(o.pixel=e[0]-t[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=e[1]-t[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(t,e,r,i,n){var a=r.axis,o={},s=n.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),r.mainType==="radiusAxis"?(o.pixel=e[0]-t[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?1:-1):(o.pixel=e[1]-t[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=a.inverse?-1:1),o},singleAxis:function(t,e,r,i,n){var a=r.axis,o=n.model.coordinateSystem.getRect(),s={};return t=t||[0,0],a.orient==="horizontal"?(s.pixel=e[0]-t[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function KF(t){o2(t),t.registerComponentModel(HF),t.registerComponentView($F),qF(t)}var jF=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=Xs(of.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),e}(of),Wo=Kt,Yy=7,QF=1,jc=30,JF=7,Xo="horizontal",Zy="vertical",t5=5,e5=["line","bar","candlestick","scatter"],r5={easing:"cubicOut",duration:100,delay:0},i5=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r._displayables={},r}return e.prototype.init=function(r,i){this.api=i,this._onBrush=nt(this._onBrush,this),this._onBrushEnd=nt(this._onBrushEnd,this)},e.prototype.render=function(r,i,n,a){if(t.prototype.render.apply(this,arguments),zf(this,"_dispatchZoomAction",r.get("throttle"),"fixRate"),this._orient=r.getOrient(),r.get("show")===!1){this.group.removeAll();return}if(r.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),t.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Vu(this,"_dispatchZoomAction");var r=this.api.getZr();r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var r=this.group;r.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var i=this._displayables.sliderGroup=new ee;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(i),this._positionGroup()},e.prototype._resetLocation=function(){var r=this.dataZoomModel,i=this.api,n=r.get("brushSelect"),a=n?JF:0,o=this._findCoordRect(),s={width:i.getWidth(),height:i.getHeight()},l=this._orient===Xo?{right:s.width-o.x-o.width,top:s.height-jc-Yy-a,width:o.width,height:jc}:{right:Yy,top:o.y,width:jc,height:o.height},u=Zs(r.option);C(["right","top","width","height"],function(h){u[h]==="ph"&&(u[h]=l[h])});var f=Ki(u,s);this._location={x:f.x,y:f.y},this._size=[f.width,f.height],this._orient===Zy&&this._size.reverse()},e.prototype._positionGroup=function(){var r=this.group,i=this._location,n=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(n===Xo&&!o?{scaleY:l?1:-1,scaleX:1}:n===Xo&&o?{scaleY:l?1:-1,scaleX:-1}:n===Zy&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=r.getBoundingRect([s]);r.x=i.x-u.x,r.y=i.y-u.y,r.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var r=this.dataZoomModel,i=this._size,n=this._displayables.sliderGroup,a=r.get("brushSelect");n.add(new Wo({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new Wo({shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:"transparent"},z2:0,onclick:nt(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),n.add(o)},e.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var i=this._size,n=this._shadowSize||[],a=r.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,f=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||i[0]!==n[0]||i[1]!==n[1]){var h=o.getDataExtent(l),v=(h[1]-h[0])*.3;h=[h[0]-v,h[1]+v];var c=[0,i[1]],d=[0,i[0]],p=[[i[0],0],[0,0]],g=[],m=d[1]/(o.count()-1),_=0,y=Math.round(o.count()/i[0]),x;o.each([l],function(A,M){if(y>0&&M%y){_+=m;return}var E=A==null||isNaN(A)||A==="",D=E?0:te(A,h,c,!0);E&&!x&&M?(p.push([p[p.length-1][0],0]),g.push([g[g.length-1][0],0])):!E&&x&&(p.push([_,0]),g.push([_,0])),p.push([_,D]),g.push([_,D]),_+=m,x=E}),u=this._shadowPolygonPts=p,f=this._shadowPolylinePts=g}this._shadowData=o,this._shadowDim=l,this._shadowSize=[i[0],i[1]];var S=this.dataZoomModel;function T(A){var M=S.getModel(A?"selectedDataBackground":"dataBackground"),E=new ee,D=new Gs({shape:{points:u},segmentIgnoreThreshold:1,style:M.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),R=new Ws({shape:{points:f},segmentIgnoreThreshold:1,style:M.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return E.add(D),E.add(R),E}for(var w=0;w<3;w++){var b=T(w===1);this._displayables.sliderGroup.add(b),this._displayables.dataShadowSegs.push(b)}},e.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,i=r.get("showDataShadow");if(i!==!1){var n,a=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();C(l,function(u){if(!n&&!(i!==!0&&bt(e5,u.get("type"))<0)){var f=a.getComponent(Vi(o),s).axis,h=n5(o),v,c=u.coordinateSystem;h!=null&&c.getOtherAxis&&(v=c.getOtherAxis(f).inverse),h=u.getData().mapDimension(h),n={thisAxis:f,series:u,thisDim:o,otherDim:h,otherAxisInverse:v}}},this)},this),n}},e.prototype._renderHandle=function(){var r=this.group,i=this._displayables,n=i.handles=[null,null],a=i.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,f=l.get("borderRadius")||0,h=l.get("brushSelect"),v=i.filler=new Wo({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(v),o.add(new Wo({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:f},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:QF,fill:"rgba(0,0,0,0)"}})),C([0,1],function(y){var x=l.get("handleIcon");!Wu[x]&&x.indexOf("path://")<0&&x.indexOf("image://")<0&&(x="path://"+x);var S=Br(x,-1,0,2,2,null,!0);S.attr({cursor:qy(this._orient),draggable:!0,drift:nt(this._onDragMove,this,y),ondragend:nt(this._onDragEnd,this),onmouseover:nt(this._showDataInfo,this,!0),onmouseout:nt(this._showDataInfo,this,!1),z2:5});var T=S.getBoundingRect(),w=l.get("handleSize");this._handleHeight=se(w,this._size[1]),this._handleWidth=T.width/T.height*this._handleHeight,S.setStyle(l.getModel("handleStyle").getItemStyle()),S.style.strokeNoScale=!0,S.rectHover=!0,S.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Nu(S);var b=l.get("handleColor");b!=null&&(S.style.fill=b),o.add(n[y]=S);var A=l.getModel("textStyle");r.add(a[y]=new Xt({silent:!0,invisible:!0,style:qe(A,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:A.getTextColor(),font:A.getFont()}),z2:10}))},this);var c=v;if(h){var d=se(l.get("moveHandleSize"),s[1]),p=i.moveHandle=new Kt({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:d}}),g=d*.8,m=i.moveHandleIcon=Br(l.get("moveHandleIcon"),-g/2,-g/2,g,g,"#fff",!0);m.silent=!0,m.y=s[1]+d/2-.5,p.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(d,10));c=i.moveZone=new Kt({invisible:!0,shape:{y:s[1]-_,height:d+_}}),c.on("mouseover",function(){u.enterEmphasis(p)}).on("mouseout",function(){u.leaveEmphasis(p)}),o.add(p),o.add(m),o.add(c)}c.attr({draggable:!0,cursor:qy(this._orient),drift:nt(this._onDragMove,this,"all"),ondragstart:nt(this._showDataInfo,this,!0),ondragend:nt(this._onDragEnd,this),onmouseover:nt(this._showDataInfo,this,!0),onmouseout:nt(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),i=this._getViewExtent();this._handleEnds=[te(r[0],[0,100],i,!0),te(r[1],[0,100],i,!0)]},e.prototype._updateInterval=function(r,i){var n=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=n.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];qs(i,a,o,n.get("zoomLock")?"all":r,s.minSpan!=null?te(s.minSpan,l,o,!0):null,s.maxSpan!=null?te(s.maxSpan,l,o,!0):null);var u=this._range,f=this._range=On([te(a[0],o,l,!0),te(a[1],o,l,!0)]);return!u||u[0]!==f[0]||u[1]!==f[1]},e.prototype._updateView=function(r){var i=this._displayables,n=this._handleEnds,a=On(n.slice()),o=this._size;C([0,1],function(c){var d=i.handles[c],p=this._handleHeight;d.attr({scaleX:p/2,scaleY:p/2,x:n[c]+(c?-1:1),y:o[1]/2-p/2})},this),i.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};i.moveHandle&&(i.moveHandle.setShape(s),i.moveZone.setShape(s),i.moveZone.getBoundingRect(),i.moveHandleIcon&&i.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=i.dataShadowSegs,u=[0,a[0],a[1],o[0]],f=0;fi[0]||n[1]<0||n[1]>i[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",n[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(r){var i=r.offsetX,n=r.offsetY;this._brushStart=new yt(i,n),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(r){if(this._brushing){var i=this._displayables.brushRect;if(this._brushing=!1,!!i){i.attr("ignore",!0);var n=i.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(n.width)<5)){var o=this._getViewExtent(),s=[0,100];this._range=On([te(n.x,o,s,!0),te(n.x+n.width,o,s,!0)]),this._handleEnds=[n.x,n.x+n.width],this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(r){this._brushing&&(gi(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},e.prototype._updateBrushRect=function(r,i){var n=this._displayables,a=this.dataZoomModel,o=n.brushRect;o||(o=n.brushRect=new Wo({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(r,i),f=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:f[0],y:0,width:u[0]-f[0],height:h[1]})},e.prototype._dispatchZoomAction=function(r){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:r?r5:null,start:i[0],end:i[1]})},e.prototype._findCoordRect=function(){var r,i=n2(this.dataZoomModel).infoList;if(!r&&i.length){var n=i[0].model.coordinateSystem;r=n.getRect&&n.getRect()}if(!r){var a=this.api.getWidth(),o=this.api.getHeight();r={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return r},e.type="dataZoom.slider",e}(a2);function n5(t){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[t]}function qy(t){return t==="vertical"?"ns-resize":"ew-resize"}function a5(t){t.registerComponentModel(jF),t.registerComponentView(i5),o2(t)}function o5(t){Qe(KF),Qe(a5)}var p2={get:function(t,e,r){var i=ut((s5[t]||{})[e]);return r&&j(i)?i[i.length-1]:i}},s5={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},$y=Me.mapVisual,l5=Me.eachVisual,u5=j,Ky=C,f5=On,h5=te,sf=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r.stateList=["inRange","outOfRange"],r.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],r.layoutMode={type:"box",ignoreSize:!0},r.dataBound=[-1/0,1/0],r.targetVisuals={},r.controllerVisuals={},r}return e.prototype.init=function(r,i,n){this.mergeDefaultAndTheme(r,n)},e.prototype.optionUpdated=function(r,i){var n=this.option;!i&&DF(n,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(r){var i=this.stateList;r=nt(r,this),this.controllerVisuals=Hy(this.option.controller,i,r),this.targetVisuals=Hy(this.option.target,i,r)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var r=this.option.seriesIndex,i=[];return r==null||r==="all"?this.ecModel.eachSeries(function(n,a){i.push(a)}):i=ue(r),i},e.prototype.eachTargetSeries=function(r,i){C(this.getTargetSeriesIndices(),function(n){var a=this.ecModel.getSeriesByIndex(n);a&&r.call(i,a)},this)},e.prototype.isTargetSeries=function(r){var i=!1;return this.eachTargetSeries(function(n){n===r&&(i=!0)}),i},e.prototype.formatValueText=function(r,i,n){var a=this.option,o=a.precision,s=this.dataBound,l=a.formatter,u;n=n||["<",">"],j(r)&&(r=r.slice(),u=!0);var f=i?r:u?[h(r[0]),h(r[1])]:h(r);if(Q(l))return l.replace("{value}",u?f[0]:f).replace("{value2}",u?f[1]:f);if(ct(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?n[0]+" "+f[1]:r[1]===s[1]?n[1]+" "+f[0]:f[0]+" - "+f[1];return f;function h(v){return v===s[0]?"min":v===s[1]?"max":(+v).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var r=this.option,i=f5([r.min,r.max]);this._dataExtent=i},e.prototype.getDataDimensionIndex=function(r){var i=this.option.dimension;if(i!=null)return r.getDimensionIndex(i);for(var n=r.dimensions,a=n.length-1;a>=0;a--){var o=n[a],s=r.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var r=this.ecModel,i=this.option,n={inRange:i.inRange,outOfRange:i.outOfRange},a=i.target||(i.target={}),o=i.controller||(i.controller={});dt(a,n),dt(o,n);var s=this.isCategory();l.call(this,a),l.call(this,o),u.call(this,a,"inRange","outOfRange"),f.call(this,o);function l(h){u5(i.color)&&!h.inRange&&(h.inRange={color:i.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,v,c){var d=h[v],p=h[c];d&&!p&&(p=h[c]={},Ky(d,function(g,m){if(Me.isValidType(m)){var _=p2.get(m,"inactive",s);_!=null&&(p[m]=_,m==="color"&&!p.hasOwnProperty("opacity")&&!p.hasOwnProperty("colorAlpha")&&(p.opacity=[0,0]))}}))}function f(h){var v=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,c=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,d=this.get("inactiveColor"),p=this.getItemSymbol(),g=p||"roundRect";Ky(this.stateList,function(m){var _=this.itemSize,y=h[m];y||(y=h[m]={color:s?d:[d]}),y.symbol==null&&(y.symbol=v&&ut(v)||(s?g:[g])),y.symbolSize==null&&(y.symbolSize=c&&ut(c)||(s?_[0]:[_[0],_[0]])),y.symbol=$y(y.symbol,function(T){return T==="none"?g:T});var x=y.symbolSize;if(x!=null){var S=-1/0;l5(x,function(T){T>S&&(S=T)}),y.symbolSize=$y(x,function(T){return h5(T,[0,S],[0,_[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(r){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(r){return null},e.prototype.getVisualMeta=function(r){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},e}(Rt),jy=[20,140],c5=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.optionUpdated=function(r,i){t.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(n){n.mappingMethod="linear",n.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){t.prototype.resetItemSize.apply(this,arguments);var r=this.itemSize;(r[0]==null||isNaN(r[0]))&&(r[0]=jy[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=jy[1])},e.prototype._resetRange=function(){var r=this.getExtent(),i=this.option.range;!i||i.auto?(r.auto=1,this.option.range=r):j(i)&&(i[0]>i[1]&&i.reverse(),i[0]=Math.max(i[0],r[0]),i[1]=Math.min(i[1],r[1]))},e.prototype.completeVisualOption=function(){t.prototype.completeVisualOption.apply(this,arguments),C(this.stateList,function(r){var i=this.option.controller[r].symbolSize;i&&i[0]!==i[1]&&(i[0]=i[1]/3)},this)},e.prototype.setSelected=function(r){this.option.range=r.slice(),this._resetRange()},e.prototype.getSelected=function(){var r=this.getExtent(),i=On((this.get("range")||[]).slice());return i[0]>r[1]&&(i[0]=r[1]),i[1]>r[1]&&(i[1]=r[1]),i[0]=n[1]||r<=i[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(r){var i=[];return this.eachTargetSeries(function(n){var a=[],o=n.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&a.push(l)},this),i.push({seriesId:n.id,dataIndex:a})},this),i},e.prototype.getVisualMeta=function(r){var i=Qy(this,"outOfRange",this.getExtent()),n=Qy(this,"inRange",this.option.range.slice()),a=[];function o(c,d){a.push({value:c,color:r(c,d)})}for(var s=0,l=0,u=n.length,f=i.length;lr[1])break;a.push({color:this.getControllerVisual(l,"color",i),offset:s/n})}return a.push({color:this.getControllerVisual(r[1],"color",i),offset:1}),a},e.prototype._createBarPoints=function(r,i){var n=this.visualMapModel.itemSize;return[[n[0]-i[0],r[0]],[n[0],r[0]],[n[0],r[1]],[n[0]-i[1],r[1]]]},e.prototype._createBarGroup=function(r){var i=this._orient,n=this.visualMapModel.get("inverse");return new ee(i==="horizontal"&&!n?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:i==="horizontal"&&n?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:i==="vertical"&&!n?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},e.prototype._updateHandle=function(r,i){if(this._useHandle){var n=this._shapes,a=this.visualMapModel,o=n.handleThumbs,s=n.handleLabels,l=a.itemSize,u=a.getExtent();v5([0,1],function(f){var h=o[f];h.setStyle("fill",i.handlesColor[f]),h.y=r[f];var v=Zr(r[f],[0,l[1]],u,!0),c=this.getControllerVisual(v,"symbolSize");h.scaleX=h.scaleY=c/l[0],h.x=l[0]-c/2;var d=Wi(n.handleLabelPoints[f],us(h,this.group));s[f].setStyle({x:d[0],y:d[1],text:a.formatValueText(this._dataInterval[f]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",n.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(r,i,n,a){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],f=this._shapes,h=f.indicator;if(h){h.attr("invisible",!1);var v={convertOpacityToAlpha:!0},c=this.getControllerVisual(r,"color",v),d=this.getControllerVisual(r,"symbolSize"),p=Zr(r,s,u,!0),g=l[0]-d/2,m={x:h.x,y:h.y};h.y=p,h.x=g;var _=Wi(f.indicatorLabelPoint,us(h,this.group)),y=f.indicatorLabel;y.attr("invisible",!1);var x=this._applyTransform("left",f.mainGroup),S=this._orient,T=S==="horizontal";y.setStyle({text:(n||"")+o.formatValueText(i),verticalAlign:T?x:"middle",align:T?"center":x});var w={x:g,y:p,style:{fill:c}},b={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var A={duration:100,easing:"cubicInOut",additive:!0};h.x=m.x,h.y=m.y,h.animateTo(w,A),y.animateTo(b,A)}else h.attr(w),y.attr(b);this._firstShowIndicator=!1;var M=this._shapes.handleLabels;if(M)for(var E=0;Eo[1]&&(h[1]=1/0),i&&(h[0]===-1/0?this._showIndicator(f,h[1],"< ",l):h[1]===1/0?this._showIndicator(f,h[0],"> ",l):this._showIndicator(f,f,"≈ ",l));var v=this._hoverLinkDataIndices,c=[];(i||r1(n))&&(c=this._hoverLinkDataIndices=n.findTargetDataIndices(h));var d=GA(v,c);this._dispatchHighDown("downplay",_u(d[0],n)),this._dispatchHighDown("highlight",_u(d[1],n))}},e.prototype._hoverLinkFromSeriesMouseOver=function(r){var i;if(Ba(r.target,function(l){var u=Mt(l);if(u.dataIndex!=null)return i=u,!0},!0),!!i){var n=this.ecModel.getSeriesByIndex(i.seriesIndex),a=this.visualMapModel;if(a.isTargetSeries(n)){var o=n.getData(i.dataType),s=o.getStore().get(a.getDataDimensionIndex(o),i.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var r=this._shapes;r.indicator&&r.indicator.attr("invisible",!0),r.indicatorLabel&&r.indicatorLabel.attr("invisible",!0);var i=this._shapes.handleLabels;if(i)for(var n=0;n=0&&(a.dimension=o,i.push(a))}}),t.getData().setVisual("visualMeta",i)}}];function T5(t,e,r,i){for(var n=e.targetVisuals[i],a=Me.prepareVisualTypes(n),o={color:qT(t.getData(),"color")},s=0,l=a.length;s0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),t.registerAction(_5,y5),C(x5,function(e){t.registerVisual(t.PRIORITY.VISUAL.COMPONENT,e)}),t.registerPreprocessor(S5))}function w5(t){t.registerComponentModel(c5),t.registerComponentView(g5),_2(t)}var b5=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r._pieceList=[],r}return e.prototype.optionUpdated=function(r,i){t.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var n=this._mode=this._determineMode();this._pieceList=[],A5[this._mode].call(this,this._pieceList),this._resetSelected(r,i);var a=this.option.categories;this.resetVisual(function(o,s){n==="categories"?(o.mappingMethod="category",o.categories=ut(a)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=tt(this._pieceList,function(l){return l=ut(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var r=this.option,i={},n=Me.listVisualTypes(),a=this.isCategory();C(r.pieces,function(s){C(n,function(l){s.hasOwnProperty(l)&&(i[l]=1)})}),C(i,function(s,l){var u=!1;C(this.stateList,function(f){u=u||o(r,f,l)||o(r.target,f,l)},this),!u&&C(this.stateList,function(f){(r[f]||(r[f]={}))[l]=p2.get(l,f==="inRange"?"active":"inactive",a)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}t.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(r,i){var n=this.option,a=this._pieceList,o=(i?n:r).selected||{};if(n.selected=o,C(a,function(l,u){var f=this.getSelectedMapKey(l);o.hasOwnProperty(f)||(o[f]=!0)},this),n.selectedMode==="single"){var s=!1;C(a,function(l,u){var f=this.getSelectedMapKey(l);o[f]&&(s?o[f]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(r){return this._mode==="categories"?r.value+"":r.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var r=this.option;return r.pieces&&r.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(r){this.option.selected=ut(r)},e.prototype.getValueState=function(r){var i=Me.findPieceIndex(r,this._pieceList);return i!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[i])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(r){var i=[],n=this._pieceList;return this.eachTargetSeries(function(a){var o=[],s=a.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var f=Me.findPieceIndex(l,n);f===r&&o.push(u)},this),i.push({seriesId:a.id,dataIndex:o})},this),i},e.prototype.getRepresentValue=function(r){var i;if(this.isCategory())i=r.value;else if(r.value!=null)i=r.value;else{var n=r.interval||[];i=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return i},e.prototype.getVisualMeta=function(r){if(this.isCategory())return;var i=[],n=["",""],a=this;function o(f,h){var v=a.getRepresentValue({interval:f});h||(h=a.getValueState(v));var c=r(v,h);f[0]===-1/0?n[0]=c:f[1]===1/0?n[1]=c:i.push({value:f[0],color:c},{value:f[1],color:c})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return C(s,function(f){var h=f.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:i,outerColors:n}},e.type="visualMap.piecewise",e.defaultOption=Xs(sf.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e}(sf),A5={splitNumber:function(t){var e=this.option,r=Math.min(e.precision,20),i=this.getExtent(),n=e.splitNumber;n=Math.max(parseInt(n,10),1),e.splitNumber=n;for(var a=(i[1]-i[0])/n;+a.toFixed(r)!==a&&r<5;)r++;e.precision=r,a=+a.toFixed(r),e.minOpen&&t.push({interval:[-1/0,i[0]],close:[0,0]});for(var o=0,s=i[0];o","≥"][i[0]]];r.text=r.text||this.formatValueText(r.value!=null?r.value:r.interval,!1,n)},this)}};function o1(t,e){var r=t.inverse;(t.orient==="vertical"?!r:r)&&e.reverse()}var E5=function(t){K(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=e.type,r}return e.prototype.doRender=function(){var r=this.group;r.removeAll();var i=this.visualMapModel,n=i.get("textGap"),a=i.textStyleModel,o=a.getFont(),s=a.getTextColor(),l=this._getItemAlign(),u=i.itemSize,f=this._getViewData(),h=f.endsText,v=ja(i.get("showLabel",!0),!h);h&&this._renderEndsText(r,h[0],u,v,l),C(f.viewPieceList,function(c){var d=c.piece,p=new ee;p.onclick=nt(this._onItemClick,this,d),this._enableHoverLink(p,c.indexInModelPieceList);var g=i.getRepresentValue(d);if(this._createItemSymbol(p,g,[0,0,u[0],u[1]]),v){var m=this.visualMapModel.getValueState(g);p.add(new Xt({style:{x:l==="right"?-n:u[0]+n,y:u[1]/2,text:d.text,verticalAlign:"middle",align:l,font:o,fill:s,opacity:m==="outOfRange"?.5:1}}))}r.add(p)},this),h&&this._renderEndsText(r,h[1],u,v,l),$a(i.get("orient"),r,i.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},e.prototype._enableHoverLink=function(r,i){var n=this;r.on("mouseover",function(){return a("highlight")}).on("mouseout",function(){return a("downplay")});var a=function(o){var s=n.visualMapModel;s.option.hoverLink&&n.api.dispatchAction({type:o,batch:_u(s.findTargetDataIndices(i),s)})}},e.prototype._getItemAlign=function(){var r=this.visualMapModel,i=r.option;if(i.orient==="vertical")return m2(r,this.api,r.itemSize);var n=i.align;return(!n||n==="auto")&&(n="left"),n},e.prototype._renderEndsText=function(r,i,n,a,o){if(i){var s=new ee,l=this.visualMapModel.textStyleModel;s.add(new Xt({style:qe(l,{x:a?o==="right"?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:"middle",align:a?o:"center",text:i})})),r.add(s)}},e.prototype._getViewData=function(){var r=this.visualMapModel,i=tt(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),n=r.get("text"),a=r.get("orient"),o=r.get("inverse");return(a==="horizontal"?o:!o)?i.reverse():n&&(n=n.slice().reverse()),{viewPieceList:i,endsText:n}},e.prototype._createItemSymbol=function(r,i,n){r.add(Br(this.getControllerVisual(i,"symbol"),n[0],n[1],n[2],n[3],this.getControllerVisual(i,"color")))},e.prototype._onItemClick=function(r){var i=this.visualMapModel,n=i.option,a=n.selectedMode;if(a){var o=ut(n.selected),s=i.getSelectedMapKey(r);a==="single"||a===!0?(o[s]=!0,C(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e}(g2);function M5(t){t.registerComponentModel(b5),t.registerComponentView(E5),_2(t)}function C5(t){Qe(w5),Qe(M5)}var Jc=Math.sin,tv=Math.cos,y2=Math.PI,Ln=Math.PI*2,D5=180/y2,x2=function(){function t(){}return t.prototype.reset=function(e){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,e||4)},t.prototype.moveTo=function(e,r){this._add("M",e,r)},t.prototype.lineTo=function(e,r){this._add("L",e,r)},t.prototype.bezierCurveTo=function(e,r,i,n,a,o){this._add("C",e,r,i,n,a,o)},t.prototype.quadraticCurveTo=function(e,r,i,n){this._add("Q",e,r,i,n)},t.prototype.arc=function(e,r,i,n,a,o){this.ellipse(e,r,i,i,0,n,a,o)},t.prototype.ellipse=function(e,r,i,n,a,o,s,l){var u=s-o,f=!l,h=Math.abs(u),v=zi(h-Ln)||(f?u>=Ln:-u>=Ln),c=u>0?u%Ln:u%Ln+Ln,d=!1;v?d=!0:zi(h)?d=!1:d=c>=y2==!!f;var p=e+i*tv(o),g=r+n*Jc(o);this._start&&this._add("M",p,g);var m=Math.round(a*D5);if(v){var _=1/this._p,y=(f?1:-1)*(Ln-_);this._add("A",i,n,m,1,+f,e+i*tv(o+y),r+n*Jc(o+y)),_>.01&&this._add("A",i,n,m,0,+f,p,g)}else{var x=e+i*tv(s),S=r+n*Jc(s);this._add("A",i,n,m,+d,+f,x,S)}},t.prototype.rect=function(e,r,i,n){this._add("M",e,r),this._add("l",i,0),this._add("l",0,n),this._add("l",-i,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(e,r,i,n,a,o,s,l,u){for(var f=[],h=this._p,v=1;v"}function k5(t){return""}function Qp(t,e){e=e||{};var r=e.newline?` `:"";function i(n){var a=n.children,o=n.tag,s=n.attrs,l=n.text;return F5(o,s)+(o!=="style"?_e(l):l||"")+(a?""+r+tt(a,function(u){return i(u)}).join(r)+r:"")+k5(o)}return i(t)}function z5(t,e,r){r=r||{};var i=r.newline?` `:"",n=" {"+i,a=i+"}",o=tt(mt(t),function(l){return l+n+tt(mt(t[l]),function(u){return u+":"+t[l][u]+";"}).join(i)+a}).join(i),s=tt(mt(e),function(l){return"@keyframes "+l+n+tt(mt(e[l]),function(u){return u+n+tt(mt(e[l][u]),function(f){var h=e[l][u][f];return f==="d"&&(h='path("'+h+'")'),f+":"+h+";"}).join(i)+a}).join(i)+a}).join(i);return!o&&!s?"":[""].join(i)}function Ad(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function l1(t,e,r,i){return de("svg","root",{width:t,height:e,xmlns:T2,"xmlns:xlink":S2,version:"1.1",baseProfile:"full",viewBox:i?"0 0 "+t+" "+e:!1},r)}var U5=0;function b2(){return U5++}var u1={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},Pn="transform-origin";function H5(t,e,r){var i=Y({},t.shape);Y(i,e),t.buildPath(r,i);var n=new x2;return n.reset(q1(t)),r.rebuildPath(n,1),n.generateStr(),n.getStr()}function V5(t,e){var r=e.originX,i=e.originY;(r||i)&&(t[Pn]=r+"px "+i+"px")}var G5={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function A2(t,e){var r=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[r]=t,r}function W5(t,e,r){var i=t.shape.paths,n={},a,o;if(C(i,function(l){var u=Ad(r.zrId);u.animation=!0,Kf(l,{},u,!0);var f=u.cssAnims,h=u.cssNodes,v=mt(f),c=v.length;if(c){o=v[c-1];var d=f[o];for(var p in d){var g=d[p];n[p]=n[p]||{d:""},n[p].d+=g.d||""}for(var m in h){var _=h[m].animation;_.indexOf(o)>=0&&(a=_)}}}),!!a){e.d=!1;var s=A2(n,r);return a.replace(o,s)}}function f1(t){return Q(t)?u1[t]?"cubic-bezier("+u1[t]+")":Bd(t)?t:"":""}function Kf(t,e,r,i){var n=t.animators,a=n.length,o=[];if(t instanceof zx){var s=W5(t,e,r);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var l={},u=0;u0}).length){var Ot=A2(w,r);return Ot+" "+_[0]+" both"}}for(var g in l){var s=p(l[g]);s&&o.push(s)}if(o.length){var m=r.zrId+"-cls-"+b2();r.cssNodes["."+m]={animation:o.join(",")},e.class=m}}function X5(t,e,r){if(!t.ignore)if(t.isSilent()){var i={"pointer-events":"none"};h1(i,e,r)}else{var n=t.states.emphasis&&t.states.emphasis.style?t.states.emphasis.style:{},a=n.fill;if(!a){var o=t.style&&t.style.fill,s=t.states.select&&t.states.select.style&&t.states.select.style.fill,l=t.currentStates.indexOf("select")>=0&&s||o;l&&(a=vv(l))}var u=n.lineWidth;if(u){var f=!n.strokeNoScale&&t.transform?t.transform[0]:1;u=u/f}var i={cursor:"pointer"};a&&(i.fill=a),n.stroke&&(i.stroke=n.stroke),u&&(i["stroke-width"]=u),h1(i,e,r)}}function h1(t,e,r,i){var n=JSON.stringify(t),a=r.cssStyleCache[n];a||(a=r.zrId+"-cls-"+b2(),r.cssStyleCache[n]=a,r.cssNodes["."+a+":hover"]=t),e.class=e.class?e.class+" "+a:a}var ks=Math.round;function E2(t){return t&&Q(t.src)}function M2(t){return t&&ct(t.toDataURL)}function Jp(t,e,r,i){N5(function(n,a){var o=n==="fill"||n==="stroke";o&&Z1(a)?D2(e,t,n,i):o&&Fd(a)?L2(r,t,n,i):o&&a==="none"?t[n]="transparent":t[n]=a},e,r,!1),Q5(r,t,i)}function tg(t,e){var r=EA(e);r&&(r.each(function(i,n){i!=null&&(t[(s1+n).toLowerCase()]=i+"")}),e.isSilent()&&(t[s1+"silent"]="true"))}function c1(t){return zi(t[0]-1)&&zi(t[1])&&zi(t[2])&&zi(t[3]-1)}function Y5(t){return zi(t[4])&&zi(t[5])}function eg(t,e,r){if(e&&!(Y5(e)&&c1(e))){var i=1e4;t.transform=c1(e)?"translate("+ks(e[4]*i)/i+" "+ks(e[5]*i)/i+")":qb(e)}}function v1(t,e,r){for(var i=t.points,n=[],a=0;a"u"){var g="Image width/height must been given explictly in svg-ssr renderer.";xr(v,g),xr(c,g)}else if(v==null||c==null){var m=function(M,E){if(M){var D=M.elm,R=v||E.width,P=c||E.height;M.tag==="pattern"&&(u?(P=1,R/=a.width):f&&(R=1,P/=a.height)),M.attrs.width=R,M.attrs.height=P,D&&(D.setAttribute("width",R),D.setAttribute("height",P))}},_=Wd(d,null,t,function(M){l||m(T,M),m(h,M)});_&&_.width&&_.height&&(v=v||_.width,c=c||_.height)}h=de("image","img",{href:d,width:v,height:c}),o.width=v,o.height=c}else n.svgElement&&(h=ut(n.svgElement),o.width=n.svgWidth,o.height=n.svgHeight);if(h){var y,x;l?y=x=1:u?(x=1,y=o.width/a.width):f?(y=1,x=o.height/a.height):o.patternUnits="userSpaceOnUse",y!=null&&!isNaN(y)&&(o.width=y),x!=null&&!isNaN(x)&&(o.height=x);var S=$1(n);S&&(o.patternTransform=S);var T=de("pattern","",o,[h]),w=Qp(T),b=i.patternCache,A=b[w];A||(A=i.zrId+"-p"+i.patternIdx++,b[w]=A,o.id=A,T=i.defs[A]=de("pattern",A,o,[h])),e[r]=vf(A)}}function J5(t,e,r){var i=r.clipPathCache,n=r.defs,a=i[t.id];if(!a){a=r.zrId+"-c"+r.clipPathIdx++;var o={id:a};i[t.id]=a,n[a]=de("clipPath",a,o,[C2(t,r)])}e["clip-path"]=vf(a)}function g1(t){return document.createTextNode(t)}function Nn(t,e,r){t.insertBefore(e,r)}function m1(t,e){t.removeChild(e)}function _1(t,e){t.appendChild(e)}function R2(t){return t.parentNode}function P2(t){return t.nextSibling}function ev(t,e){t.textContent=e}var y1=58,t4=120,e4=de("","");function Ed(t){return t===void 0}function $r(t){return t!==void 0}function r4(t,e,r){for(var i={},n=e;n<=r;++n){var a=t[n].key;a!==void 0&&(i[a]=n)}return i}function es(t,e){var r=t.key===e.key,i=t.tag===e.tag;return i&&r}function zs(t){var e,r=t.children,i=t.tag;if($r(i)){var n=t.elm=w2(i);if(rg(e4,t),j(r))for(e=0;ea?(d=r[l+1]==null?null:r[l+1].elm,I2(t,d,r,n,l)):lf(t,e,i,a))}function Ra(t,e){var r=e.elm=t.elm,i=t.children,n=e.children;t!==e&&(rg(t,e),Ed(e.text)?$r(i)&&$r(n)?i!==n&&i4(r,i,n):$r(n)?($r(t.text)&&ev(r,""),I2(r,null,n,0,n.length-1)):$r(i)?lf(r,i,0,i.length-1):$r(t.text)&&ev(r,""):t.text!==e.text&&($r(i)&&lf(r,i,0,i.length-1),ev(r,e.text)))}function n4(t,e){if(es(t,e))Ra(t,e);else{var r=t.elm,i=R2(r);zs(e),i!==null&&(Nn(i,e.elm,P2(r)),lf(i,[t],0,0))}return e}var a4=0,o4=function(){function t(e,r,i){if(this.type="svg",this.refreshHover=x1(),this.configLayer=x1(),this.storage=r,this._opts=i=Y({},i),this.root=e,this._id="zr"+a4++,this._oldVNode=l1(i.width,i.height),e&&!i.ssr){var n=this._viewport=document.createElement("div");n.style.cssText="position:relative;overflow:hidden";var a=this._svgDom=this._oldVNode.elm=w2("svg");rg(null,this._oldVNode),n.appendChild(a),e.appendChild(n)}this.resize(i.width,i.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style="position:absolute;left:0;top:0;user-select:none",n4(this._oldVNode,e),this._oldVNode=e}},t.prototype.renderOneToVNode=function(e){return p1(e,Ad(this._id))},t.prototype.renderToVNode=function(e){e=e||{};var r=this.storage.getDisplayList(!0),i=this._width,n=this._height,a=Ad(this._id);a.animation=e.animation,a.willUpdate=e.willUpdate,a.compress=e.compress,a.emphasis=e.emphasis;var o=[],s=this._bgVNode=s4(i,n,this._backgroundColor,a);s&&o.push(s);var l=e.compress?null:this._mainVNode=de("g","main",{},[]);this._paintList(r,a,l?l.children:o),l&&o.push(l);var u=tt(mt(a.defs),function(v){return a.defs[v]});if(u.length&&o.push(de("defs","defs",{},u)),e.animation){var f=z5(a.cssNodes,a.cssAnims,{newline:!0});if(f){var h=de("style","stl",{},[],f);o.push(h)}}return l1(i,n,o,e.useViewBox)},t.prototype.renderToString=function(e){return e=e||{},Qp(this.renderToVNode({animation:ft(e.cssAnimation,!0),emphasis:ft(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:ft(e.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(e){this._backgroundColor=e},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(e,r,i){for(var n=e.length,a=[],o=0,s,l,u=0,f=0;f=0&&!(v&&l&&v[p]===l[p]);p--);for(var g=d-1;g>p;g--)o--,s=a[o-1];for(var m=p+1;m