!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).S2={})}(this,(function(t){"use strict";var e=Object.freeze({__proto__:null,get Base(){return Ei},get Circle(){return bi},get Ellipse(){return Ii},get Image(){return Ai},get Line(){return Ni},get Marker(){return ki},get Path(){return Xi},get Polygon(){return Zi},get Polyline(){return Qi},get Rect(){return to},get Text(){return no}}),n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)}; /*! ***************************************************************************** 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. ***************************************************************************** */function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n2&&(n.push([i].concat(a.splice(0,2))),s="l",i="m"===i?"l":"L"),"o"===s&&1===a.length&&n.push([i,a[0]]),"r"===s)n.push([i].concat(a));else for(;a.length>=e[s]&&(n.push([i].concat(a.splice(0,e[s]))),e[s]););return t})),n},N=function(t,e){for(var n=[],r=0,i=t.length;i-2*!e>r;r+=2){var o=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4===r?o[3]={x:+t[0],y:+t[1]}:i-2===r&&(o[2]={x:+t[0],y:+t[1]},o[3]={x:+t[2],y:+t[3]}):o[0]={x:+t[i-2],y:+t[i-1]}:i-4===r?o[3]=o[2]:r||(o[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n},D=function(t,e,n,r,i){var o=[];if(null===i&&null===r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!==i){var a=Math.PI/180,s=t+n*Math.cos(-r*a),l=t+n*Math.cos(-i*a);o=[["M",s,e+n*Math.sin(-r*a)],["A",n,n,0,+(i-r>180),0,l,e+n*Math.sin(-i*a)]]}else o=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return o},P=function(t){if(!(t=B(t))||!t.length)return[["M",0,0]];var e,n,r=[],i=0,o=0,a=0,s=0,l=0;"M"===t[0][0]&&(a=i=+t[0][1],s=o=+t[0][2],l++,r[0]=["M",i,o]);for(var u=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase(),c=void 0,h=void 0,d=l,f=t.length;d1&&(n*=x=Math.sqrt(x),r*=x);var S=n*n,E=r*r,_=(o===a?-1:1)*Math.sqrt(Math.abs((S*E-S*w*w-E*C*C)/(S*w*w+E*C*C)));f=_*n*w/r+(t+s)/2,p=_*-r*C/n+(e+l)/2,h=Math.asin(((e-p)/r).toFixed(9)),d=Math.asin(((l-p)/r).toFixed(9)),h=td&&(h-=2*Math.PI),!a&&d>h&&(d-=2*Math.PI)}var b=d-h;if(Math.abs(b)>v){var T=d,L=s,I=l;d=h+v*(a&&d>h?1:-1),s=f+n*Math.cos(d),l=p+r*Math.sin(d),y=F(s,l,n,r,i,0,a,L,I,[d,T,f,p])}b=d-h;var O=Math.cos(h),R=Math.sin(h),A=Math.cos(d),M=Math.sin(d),B=Math.tan(b/4),N=4/3*n*B,D=4/3*r*B,P=[t,e],k=[t+N*R,e-D*O],z=[s+N*M,l-D*A],H=[s,l];if(k[0]=2*P[0]-k[0],k[1]=2*P[1]-k[1],u)return[k,z,H].concat(y);for(var W=[],G=0,U=(y=[k,z,H].concat(y).join().split(",")).length;G7){t[e].shift();for(var o=t[e];o.length;)s[e]="A",i&&(l[e]="A"),t.splice(e++,0,["C"].concat(o.splice(0,6)));t.splice(e,1),n=Math.max(r.length,i&&i.length||0)}},f=function(t,e,o,a,s){t&&e&&"M"===t[s][0]&&"M"!==e[s][0]&&(e.splice(s,0,["M",a.x,a.y]),o.bx=0,o.by=0,o.x=t[s][1],o.y=t[s][2],n=Math.max(r.length,i&&i.length||0))};n=Math.max(r.length,i&&i.length||0);for(var p=0;p1?1:l<0?0:l)/2,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,f=0;f<12;f++){var p=u*c[f]+u,v=U(p,t,n,i,a),g=U(p,e,r,o,s),y=v*v+g*g;d+=h[f]*Math.sqrt(y)}return u*d},j=function(t,e,n,r,i,o,a,s){for(var l,u,c,h,d=[],f=[[],[]],p=0;p<2;++p)if(0===p?(u=6*t-12*n+6*i,l=-3*t+9*n-9*i+3*a,c=3*n-3*t):(u=6*e-12*r+6*o,l=-3*e+9*r-9*o+3*s,c=3*r-3*e),Math.abs(l)<1e-12){if(Math.abs(u)<1e-12)continue;(h=-c/u)>0&&h<1&&d.push(h)}else{var v=u*u-4*c*l,g=Math.sqrt(v);if(!(v<0)){var y=(-u+g)/(2*l);y>0&&y<1&&d.push(y);var m=(-u-g)/(2*l);m>0&&m<1&&d.push(m)}}for(var C,w=d.length,x=w;w--;)C=1-(h=d[w]),f[0][w]=C*C*C*t+3*C*C*h*n+3*C*h*h*i+h*h*h*a,f[1][w]=C*C*C*e+3*C*C*h*r+3*C*h*h*o+h*h*h*s;return f[0][x]=t,f[1][x]=e,f[0][x+1]=a,f[1][x+1]=s,f[0].length=f[1].length=x+2,{min:{x:Math.min.apply(0,f[0]),y:Math.min.apply(0,f[1])},max:{x:Math.max.apply(0,f[0]),y:Math.max.apply(0,f[1])}}},V=function(t,e,n,r,i,o,a,s){if(!(Math.max(t,n)Math.max(i,a)||Math.max(e,r)Math.max(o,s))){var l=(t-n)*(o-s)-(e-r)*(i-a);if(l){var u=((t*r-e*n)*(i-a)-(t-n)*(i*s-o*a))/l,c=((t*r-e*n)*(o-s)-(e-r)*(i*s-o*a))/l,h=+u.toFixed(2),d=+c.toFixed(2);if(!(h<+Math.min(t,n).toFixed(2)||h>+Math.max(t,n).toFixed(2)||h<+Math.min(i,a).toFixed(2)||h>+Math.max(i,a).toFixed(2)||d<+Math.min(e,r).toFixed(2)||d>+Math.max(e,r).toFixed(2)||d<+Math.min(o,s).toFixed(2)||d>+Math.max(o,s).toFixed(2)))return{x:u,y:c}}}},X=function(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},K=function(t,e,n,r,i){if(i)return[["M",+t+ +i,e],["l",n-2*i,0],["a",i,i,0,0,1,i,i],["l",0,r-2*i],["a",i,i,0,0,1,-i,i],["l",2*i-n,0],["a",i,i,0,0,1,-i,-i],["l",0,2*i-r],["a",i,i,0,0,1,i,-i],["z"]];var o=[["M",t,e],["l",n,0],["l",0,r],["l",-n,0],["z"]];return o.parsePathArray=G,o},q=function(t,e,n,r){return null===t&&(t=e=n=r=0),null===e&&(e=t.y,n=t.width,r=t.height,t=t.x),{x:t,y:e,width:n,w:n,height:r,h:r,x2:t+n,y2:e+r,cx:t+n/2,cy:e+r/2,r1:Math.min(n,r)/2,r2:Math.max(n,r)/2,r0:Math.sqrt(n*n+r*r)/2,path:K(t,e,n,r),vb:[t,e,n,r].join(" ")}},Z=function(t,e,n,r,i,o,a,s){c(t)||(t=[t,e,n,r,i,o,a,s]);var l=j.apply(null,t);return q(l.min.x,l.min.y,l.max.x-l.min.x,l.max.y-l.min.y)},$=function(t,e,n,r,i,o,a,s,l){var u=1-l,c=Math.pow(u,3),h=Math.pow(u,2),d=l*l,f=d*l,p=t+2*l*(n-t)+d*(i-2*n+t),v=e+2*l*(r-e)+d*(o-2*r+e),g=n+2*l*(i-n)+d*(a-2*i+n),y=r+2*l*(o-r)+d*(s-2*o+r);return{x:c*t+3*h*l*n+3*u*l*l*i+f*a,y:c*e+3*h*l*r+3*u*l*l*o+f*s,m:{x:p,y:v},n:{x:g,y:y},start:{x:u*t+l*n,y:u*e+l*r},end:{x:u*i+l*a,y:u*o+l*s},alpha:90-180*Math.atan2(p-g,v-y)/Math.PI}},Q=function(t,e,n){if(!function(t,e){return t=q(t),e=q(e),X(e,t.x,t.y)||X(e,t.x2,t.y)||X(e,t.x,t.y2)||X(e,t.x2,t.y2)||X(t,e.x,e.y)||X(t,e.x2,e.y)||X(t,e.x,e.y2)||X(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)}(Z(t),Z(e)))return n?0:[];for(var r=~~(Y.apply(0,t)/8),i=~~(Y.apply(0,e)/8),o=[],a=[],s={},l=n?0:[],u=0;u=0&&C<=1&&w>=0&&w<=1&&(n?l+=1:l.push({x:m.x,y:m.y,t1:C,t2:w}))}}return l};function J(t,e){var n=[],r=[];return t.length&&function t(e,i){if(1===e.length)n.push(e[0]),r.push(e[0]);else{for(var o=[],a=0;a=3&&(3===t.length&&e.push("Q"),e=e.concat(t[1])),2===t.length&&e.push("L"),e.concat(t[t.length-1])}))}(t,e,n));else{var i=[].concat(t);"M"===i[0]&&(i[0]="L");for(var o=0;o<=n-1;o++)r.push(i)}return r},et=function(t,e){if(t.length!==e.length)return!1;var n=!0;return d(t,(function(t,r){if(t!==e[r])return n=!1,!1})),n};function nt(t,e,n){var r=null,i=n;return e=0;l--)a=o[l].index,"add"===o[l].type?t.splice(a,0,[].concat(t[a])):t.splice(a,1)}var h=i-(r=t.length);if(r0)){t[r]=e[r];break}n=it(n,t[r-1],1)}t[r]=["Q"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;case"T":t[r]=["T"].concat(n[0]);break;case"C":if(n.length<3){if(!(r>0)){t[r]=e[r];break}n=it(n,t[r-1],2)}t[r]=["C"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;case"S":if(n.length<2){if(!(r>0)){t[r]=e[r];break}n=it(n,t[r-1],1)}t[r]=["S"].concat(n.reduce((function(t,e){return t.concat(e)}),[]));break;default:t[r]=e[r]}return t},st=Object.freeze({__proto__:null,catmullRomToBezier:N,fillPath:function(t,e){if(1===t.length)return t;var n=t.length-1,r=e.length-1,i=n/r,o=[];if(1===t.length&&"M"===t[0][0]){for(var a=0;at.delay&&d(e.toAttrs,(function(e,n){o.call(t.toAttrs,n)&&(delete t.toAttrs[n],delete t.fromAttrs[n])}))})),t}var Vt=function(t){function e(e){var n=t.call(this,e)||this;n.attrs={};var r=n.getDefaultAttrs();return _(r,e.attrs),n.attrs=r,n.initAttrs(r),n.initAnimate(),n}return ct(e,t),e.prototype.getDefaultCfg=function(){return{visible:!0,capture:!0,zIndex:0}},e.prototype.getDefaultAttrs=function(){return{matrix:this.getDefaultMatrix(),opacity:1}},e.prototype.onCanvasChange=function(t){},e.prototype.initAttrs=function(t){},e.prototype.initAnimate=function(){this.set("animable",!0),this.set("animating",!1)},e.prototype.isGroup=function(){return!1},e.prototype.getParent=function(){return this.get("parent")},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.attr=function(){for(var t,e=[],n=0;n0?r=jt(r,x):n.addAnimator(this),r.push(x),this.set("animations",r),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var e=this;void 0===t&&(t=!0),d(this.get("animations"),(function(n){t&&(n.onFrame?e.attr(n.onFrame(1)):e.attr(n.toAttrs)),n.callback&&n.callback()})),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),e=this.get("animations"),n=t.getTime();return d(e,(function(t){t._paused=!0,t._pauseTime=n,t.pauseCallback&&t.pauseCallback()})),this.set("_pause",{isPaused:!0,pauseTime:n}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline").getTime(),e=this.get("animations"),n=this.get("_pause").pauseTime;return d(e,(function(e){e.startTime=e.startTime+(t-n),e._paused=!1,e._pauseTime=null,e.resumeCallback&&e.resumeCallback()})),this.set("_pause",{isPaused:!1}),this.set("animations",e),this},e.prototype.emitDelegation=function(t,e){var n,r=this,i=e.propagationPath;this.getEvents(),"mouseenter"===t?n=e.fromShape:"mouseleave"===t&&(n=e.toShape);for(var o=function(t){var o=i[t],s=o.get("name");if(s){if((o.isGroup()||o.isCanvas&&o.isCanvas())&&n&&pt(o,n))return"break";c(s)?d(s,(function(t){r.emitDelegateEvent(o,t,e)})):a.emitDelegateEvent(o,s,e)}},a=this,s=0;s0)}));return a.length>0?(d(a,(function(t){var e=t.getBBox();i.push(e.minX,e.maxX),o.push(e.minY,e.maxY)})),t=v(i),e=p(i),n=v(o),r=p(o)):(t=0,e=0,n=0,r=0),{x:t,y:n,minX:t,minY:n,maxX:e,maxY:r,width:e-t,height:r-n}},e.prototype.getCanvasBBox=function(){var t=1/0,e=-1/0,n=1/0,r=-1/0,i=[],o=[],a=this.getChildren().filter((function(t){return t.get("visible")&&(!t.isGroup()||t.isGroup()&&t.getChildren().length>0)}));return a.length>0?(d(a,(function(t){var e=t.getCanvasBBox();i.push(e.minX,e.maxX),o.push(e.minY,e.maxY)})),t=v(i),e=p(i),n=v(o),r=p(o)):(t=0,e=0,n=0,r=0),{x:t,y:n,minX:t,minY:n,maxX:e,maxY:r,width:e-t,height:r-n}},e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.children=[],e},e.prototype.onAttrChange=function(e,n,r){if(t.prototype.onAttrChange.call(this,e,n,r),"matrix"===e){var i=this.getTotalMatrix();this._applyChildrenMarix(i)}},e.prototype.applyMatrix=function(e){var n=this.getTotalMatrix();t.prototype.applyMatrix.call(this,e);var r=this.getTotalMatrix();r!==n&&this._applyChildrenMarix(r)},e.prototype._applyChildrenMarix=function(t){d(this.getChildren(),(function(e){e.applyMatrix(t)}))},e.prototype.addShape=function(){for(var t=[],e=0;e=0;o--){var a=t[o];if(vt(a)&&(a.isGroup()?i=a.getShape(e,n,r):a.isHit(e,n)&&(i=a)),i)break}return i},e.prototype.add=function(t){var e=this.getCanvas(),n=this.getChildren(),r=this.get("timeline"),i=t.getParent();i&&function(t,e,n){void 0===n&&(n=!0),n?e.destroy():(e.set("parent",null),e.set("canvas",null)),dt(t.getChildren(),e)}(i,t,!1),t.set("parent",this),e&&Kt(t,e),r&&qt(t,r),n.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var e=this.getTotalMatrix();e&&t.applyMatrix(e)},e.prototype.getChildren=function(){return this.get("children")},e.prototype.sort=function(){var t,e=this.getChildren();d(e,(function(t,e){return t._INDEX=e,t})),e.sort((t=function(t,e){return t.get("zIndex")-e.get("zIndex")},function(e,n){var r=t(e,n);return 0===r?e._INDEX-n._INDEX:r})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),e=t.length-1;e>=0;e--)t[e].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),t.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var t=this.getChildren();return this.getChildByIndex(t.length-1)},e.prototype.getChildByIndex=function(t){return this.getChildren()[t]},e.prototype.getCount=function(){return this.getChildren().length},e.prototype.contain=function(t){return this.getChildren().indexOf(t)>-1},e.prototype.removeChild=function(t,e){void 0===e&&(e=!0),this.contain(t)&&t.remove(e)},e.prototype.findAll=function(t){var e=[];return d(this.getChildren(),(function(n){t(n)&&e.push(n),n.isGroup()&&(e=e.concat(n.findAll(t)))})),e},e.prototype.find=function(t){var e=null;return d(this.getChildren(),(function(n){if(t(n)?e=n:n.isGroup()&&(e=n.find(t)),e)return!1})),e},e.prototype.findById=function(t){return this.find((function(e){return e.get("id")===t}))},e.prototype.findByClassName=function(t){return this.find((function(e){return e.get("className")===t}))},e.prototype.findAllByName=function(t){return this.findAll((function(e){return e.get("name")===t}))},e}(Vt),Jt=0,te=0,ee=0,ne=0,re=0,ie=0,oe="object"==typeof performance&&performance.now?performance:Date,ae="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function se(){return re||(ae(le),re=oe.now()+ie)}function le(){re=0}function ue(){this._call=this._time=this._next=null}function ce(t,e,n){var r=new ue;return r.restart(t,e,n),r}function he(){re=(ne=oe.now())+ie,Jt=te=0;try{!function(){se(),++Jt;for(var t,e=Zt;e;)(t=re-e._time)>=0&&e._call.call(null,t),e=e._next;--Jt}()}finally{Jt=0,function(){var t,e,n=Zt,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Zt=e);$t=t,fe(r)}(),re=0}}function de(){var t=oe.now(),e=t-ne;e>1e3&&(ie-=e,ne=t)}function fe(t){Jt||(te&&(te=clearTimeout(te)),t-re>24?(t<1/0&&(te=setTimeout(he,t-oe.now()-ie)),ee&&(ee=clearInterval(ee))):(ee||(ne=oe.now(),ee=setInterval(de,1e3)),Jt=1,ae(he)))}function pe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ve(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ge(){}ue.prototype=ce.prototype={constructor:ue,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?se():+n)+(null==e?0:+e),this._next||$t===this||($t?$t._next=this:Zt=this,$t=this),this._call=t,this._time=n,fe()},stop:function(){this._call&&(this._call=null,this._time=1/0,fe())}};var ye=.7,me=1/ye,Ce="\\s*([+-]?\\d+)\\s*",we="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",xe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Se=/^#([0-9a-f]{3,8})$/,Ee=new RegExp("^rgb\\("+[Ce,Ce,Ce]+"\\)$"),_e=new RegExp("^rgb\\("+[xe,xe,xe]+"\\)$"),be=new RegExp("^rgba\\("+[Ce,Ce,Ce,we]+"\\)$"),Te=new RegExp("^rgba\\("+[xe,xe,xe,we]+"\\)$"),Le=new RegExp("^hsl\\("+[we,xe,xe]+"\\)$"),Ie=new RegExp("^hsla\\("+[we,xe,xe,we]+"\\)$"),Oe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Re(){return this.rgb().formatHex()}function Ae(){return this.rgb().formatRgb()}function Me(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Se.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Be(e):3===n?new ke(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Ne(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Ne(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Ee.exec(t))?new ke(e[1],e[2],e[3],1):(e=_e.exec(t))?new ke(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=be.exec(t))?Ne(e[1],e[2],e[3],e[4]):(e=Te.exec(t))?Ne(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Le.exec(t))?We(e[1],e[2]/100,e[3]/100,1):(e=Ie.exec(t))?We(e[1],e[2]/100,e[3]/100,e[4]):Oe.hasOwnProperty(t)?Be(Oe[t]):"transparent"===t?new ke(NaN,NaN,NaN,0):null}function Be(t){return new ke(t>>16&255,t>>8&255,255&t,1)}function Ne(t,e,n,r){return r<=0&&(t=e=n=NaN),new ke(t,e,n,r)}function De(t){return t instanceof ge||(t=Me(t)),t?new ke((t=t.rgb()).r,t.g,t.b,t.opacity):new ke}function Pe(t,e,n,r){return 1===arguments.length?De(t):new ke(t,e,n,null==r?1:r)}function ke(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ze(){return"#"+He(this.r)+He(this.g)+He(this.b)}function Fe(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function He(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function We(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ue(t,e,n,r)}function Ge(t){if(t instanceof Ue)return new Ue(t.h,t.s,t.l,t.opacity);if(t instanceof ge||(t=Me(t)),!t)return new Ue;if(t instanceof Ue)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&l<1?0:a,new Ue(a,s,l,t.opacity)}function Ue(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ye(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function je(t){return function(){return t}}function Ve(t){return 1==(t=+t)?Xe:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):je(isNaN(e)?n:e)}}function Xe(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):je(isNaN(t)?e:t)}pe(ge,Me,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Re,formatHex:Re,formatHsl:function(){return Ge(this).formatHsl()},formatRgb:Ae,toString:Ae}),pe(ke,Pe,ve(ge,{brighter:function(t){return t=null==t?me:Math.pow(me,t),new ke(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?ye:Math.pow(ye,t),new ke(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ze,formatHex:ze,formatRgb:Fe,toString:Fe})),pe(Ue,(function(t,e,n,r){return 1===arguments.length?Ge(t):new Ue(t,e,n,null==r?1:r)}),ve(ge,{brighter:function(t){return t=null==t?me:Math.pow(me,t),new Ue(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ye:Math.pow(ye,t),new Ue(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new ke(Ye(t>=240?t-240:t+120,i,r),Ye(t,i,r),Ye(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Ke=function t(e){var n=Ve(e);function r(t,e){var r=n((t=Pe(t)).r,(e=Pe(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Xe(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function qe(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;no&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:tn(n,r)})),o=rn.lastIndex;return oh.length?(c=B(o[u]),h=B(i[u]),h=rt(h,c),h=at(h,c),e.fromAttrs.path=h,e.toAttrs.path=c):e.pathFormatted||(c=B(o[u]),h=B(i[u]),h=at(h,c),e.fromAttrs.path=h,e.toAttrs.path=c,e.pathFormatted=!0),r[u]=[];for(var d=0;d0){for(var o=r.animators.length-1;o>=0;o--)if((t=r.animators[o]).destroyed)r.removeAnimator(o);else{if(!t.isAnimatePaused())for(var a=(e=t.get("animations")).length-1;a>=0;a--)n=e[a],Bn(t,n,i)&&(e.splice(a,1),!1,n.callback&&n.callback());0===e.length&&r.removeAnimator(o)}r.canvas.get("autoDraw")||r.canvas.draw()}}))},t.prototype.addAnimator=function(t){this.animators.push(t)},t.prototype.removeAnimator=function(t){this.animators.splice(t,1)},t.prototype.isAnimating=function(){return!!this.animators.length},t.prototype.stop=function(){this.timer&&this.timer.stop()},t.prototype.stopAllAnimations=function(t){void 0===t&&(t=!0),this.animators.forEach((function(e){e.stopAnimate(t)})),this.animators=[],this.canvas.draw()},t.prototype.getTime=function(){return this.current},t}(),Dn=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function Pn(t,e,n){n.name=e,n.target=t,n.currentTarget=t,n.delegateTarget=t,t.emit(e,n)}function kn(t,e,n){if(n.bubbles){var r=void 0,i=!1;if("mouseenter"===e?(r=n.fromShape,i=!0):"mouseleave"===e&&(i=!0,r=n.toShape),t.isCanvas()&&i)return;if(r&&pt(t,r))return void(n.bubbles=!1);n.name=e,n.currentTarget=t,n.delegateTarget=t,t.emit(e,n)}}var zn,Fn=function(){function t(t){var e=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(t){var n=t.type;e._triggerEvent(n,t)},this._onDocumentMove=function(t){if(e.canvas.get("el")!==t.target&&(e.dragging||e.currentShape)){var n=e._getPointInfo(t);e.dragging&&e._emitEvent("drag",t,n,e.draggingShape)}},this._onDocumentMouseUp=function(t){if(e.canvas.get("el")!==t.target&&e.dragging){var n=e._getPointInfo(t);e.draggingShape&&e._emitEvent("drop",t,n,null),e._emitEvent("dragend",t,n,e.draggingShape),e._afterDrag(e.draggingShape,n,t)}},this.canvas=t.canvas}return t.prototype.init=function(){this._bindEvents()},t.prototype._bindEvents=function(){var t=this,e=this.canvas.get("el");d(Dn,(function(n){e.addEventListener(n,t._eventCallback)})),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._clearEvents=function(){var t=this,e=this.canvas.get("el");d(Dn,(function(n){e.removeEventListener(n,t._eventCallback)})),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._getEventObj=function(t,e,n,r,i,o){var a=new lt(t,e);return a.fromShape=i,a.toShape=o,a.x=n.x,a.y=n.y,a.clientX=n.clientX,a.clientY=n.clientY,a.propagationPath.push(r),a},t.prototype._getShape=function(t,e){return this.canvas.getShape(t.x,t.y,e)},t.prototype._getPointInfo=function(t){var e=this.canvas,n=e.getClientByEvent(t),r=e.getPointByEvent(t);return{x:r.x,y:r.y,clientX:n.x,clientY:n.y}},t.prototype._triggerEvent=function(t,e){var n=this._getPointInfo(e),r=this._getShape(n,e),i=this["_on"+t],o=!1;if(i)i.call(this,n,r,e);else{var a=this.currentShape;"mouseenter"===t||"dragenter"===t||"mouseover"===t?(this._emitEvent(t,e,n,null,null,r),r&&this._emitEvent(t,e,n,r,null,r),"mouseenter"===t&&this.draggingShape&&this._emitEvent("dragenter",e,n,null)):"mouseleave"===t||"dragleave"===t||"mouseout"===t?(o=!0,a&&this._emitEvent(t,e,n,a,a,null),this._emitEvent(t,e,n,null,a,null),"mouseleave"===t&&this.draggingShape&&this._emitEvent("dragleave",e,n,null)):this._emitEvent(t,e,n,r,null,null)}if(o||(this.currentShape=r),r&&!r.get("destroyed")){var s=this.canvas;s.get("el").style.cursor=r.attr("cursor")||s.get("cursor")}},t.prototype._onmousedown=function(t,e,n){0===n.button&&(this.mousedownShape=e,this.mousedownPoint=t,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,t,e,null,null)},t.prototype._emitMouseoverEvents=function(t,e,n,r){var i=this.canvas.get("el");n!==r&&(n&&(this._emitEvent("mouseout",t,e,n,n,r),this._emitEvent("mouseleave",t,e,n,n,r),r&&!r.get("destroyed")||(i.style.cursor=this.canvas.get("cursor"))),r&&(this._emitEvent("mouseover",t,e,r,n,r),this._emitEvent("mouseenter",t,e,r,n,r)))},t.prototype._emitDragoverEvents=function(t,e,n,r,i){r?(r!==n&&(n&&this._emitEvent("dragleave",t,e,n,n,r),this._emitEvent("dragenter",t,e,r,n,r)),i||this._emitEvent("dragover",t,e,r)):n&&this._emitEvent("dragleave",t,e,n,n,r),i&&this._emitEvent("dragover",t,e,r)},t.prototype._afterDrag=function(t,e,n){t&&(t.set("capture",!0),this.draggingShape=null),this.dragging=!1;var r=this._getShape(e,n);r!==t&&this._emitMouseoverEvents(n,e,t,r),this.currentShape=r},t.prototype._onmouseup=function(t,e,n){if(0===n.button){var r=this.draggingShape;this.dragging?(r&&this._emitEvent("drop",n,t,e),this._emitEvent("dragend",n,t,r),this._afterDrag(r,t,n)):(this._emitEvent("mouseup",n,t,e),e===this.mousedownShape&&this._emitEvent("click",n,t,e),this.mousedownShape=null,this.mousedownPoint=null)}},t.prototype._ondragover=function(t,e,n){n.preventDefault();var r=this.currentShape;this._emitDragoverEvents(n,t,r,e,!0)},t.prototype._onmousemove=function(t,e,n){var r=this.canvas,i=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,t,i,e,!1),this._emitEvent("drag",n,t,o);else{var a=this.mousedownPoint;if(a){var s=this.mousedownShape,l=n.timeStamp-this.mousedownTimeStamp,u=a.clientX-t.clientX,c=a.clientY-t.clientY;l>120||u*u+c*c>40?s&&s.get("draggable")?((o=this.mousedownShape).set("capture",!1),this.draggingShape=o,this.dragging=!0,this._emitEvent("dragstart",n,t,o),this.mousedownShape=null,this.mousedownPoint=null):!s&&r.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,t,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,t,i,e),this._emitEvent("mousemove",n,t,e)):(this._emitMouseoverEvents(n,t,i,e),this._emitEvent("mousemove",n,t,e))}else this._emitMouseoverEvents(n,t,i,e),this._emitEvent("mousemove",n,t,e)}},t.prototype._emitEvent=function(t,e,n,r,i,o){var a=this._getEventObj(t,e,n,r,i,o);if(r){a.shape=r,Pn(r,t,a);for(var s=r.getParent();s;)s.emitDelegation(t,a),a.propagationStopped||kn(s,t,a),a.propagationPath.push(s),s=s.getParent()}else{Pn(this.canvas,t,a)}},t.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},t}(),Hn=zn?Tt(zn):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new St:"undefined"!=typeof navigator?Tt(navigator.userAgent):"undefined"!=typeof process&&process.version?new Ct(process.version.slice(1)):null,Wn=Hn&&"firefox"===Hn.name,Gn=function(t){function e(e){var n=t.call(this,e)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return ct(e,t),e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.cursor="default",e.supportCSSTransform=!1,e},e.prototype.initContainer=function(){var t=this.get("container");g(t)&&(t=document.getElementById(t),this.set("container",t))},e.prototype.initDom=function(){var t=this.createDom();this.set("el",t),this.get("container").appendChild(t),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var t=new Fn({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new Nn(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,e){var n=this.get("el");ft&&(n.style.width=t+"px",n.style.height=e+"px")},e.prototype.changeSize=function(t,e){this.setDOMSize(t,e),this.set("width",t),this.set("height",e),this.onCanvasChange("changeSize")},e.prototype.getRenderer=function(){return this.get("renderer")},e.prototype.getCursor=function(){return this.get("cursor")},e.prototype.setCursor=function(t){this.set("cursor",t);var e=this.get("el");ft&&e&&(e.style.cursor=t)},e.prototype.getPointByEvent=function(t){if(this.get("supportCSSTransform")){if(Wn&&!u(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!u(t.offsetX))return{x:t.offsetX,y:t.offsetY}}var e=this.getClientByEvent(t),n=e.x,r=e.y;return this.getPointByClient(n,r)},e.prototype.getClientByEvent=function(t){var e=t;return t.touches&&(e="touchend"===t.type?t.changedTouches[0]:t.touches[0]),{x:e.clientX,y:e.clientY}},e.prototype.getPointByClient=function(t,e){var n=this.get("el").getBoundingClientRect();return{x:t-n.left,y:e-n.top}},e.prototype.getClientByPoint=function(t,e){var n=this.get("el").getBoundingClientRect();return{x:t+n.left,y:e+n.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.parentNode.removeChild(t)},e.prototype.clearEvents=function(){this.get("eventController").destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var e=this.get("timeline");this.get("destroyed")||(this.clear(),e&&e.stop(),this.clearEvents(),this.removeDom(),t.prototype.destroy.call(this))},e}(Qt),Un=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ct(e,t),e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=this.getChildren(),r=0;r=t&&n.minY<=e&&n.maxY>=e},e.prototype.afterAttrsChange=function(e){t.prototype.afterAttrsChange.call(this,e),this.clearCacheBBox()},e.prototype.getBBox=function(){var t=this.cfg.bbox;return t||(t=this.calculateBBox(),this.set("bbox",t)),t},e.prototype.getCanvasBBox=function(){var t=this.cfg.canvasBBox;return t||(t=this.calculateCanvasBBox(),this.set("canvasBBox",t)),t},e.prototype.applyMatrix=function(e){t.prototype.applyMatrix.call(this,e),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var t=this.getBBox(),e=this.getTotalMatrix(),n=t.minX,r=t.minY,i=t.maxX,o=t.maxY;if(e){var a=kt(e,[t.minX,t.minY]),s=kt(e,[t.maxX,t.minY]),l=kt(e,[t.minX,t.maxY]),u=kt(e,[t.maxX,t.maxY]);n=Math.min(a[0],s[0],l[0],u[0]),i=Math.max(a[0],s[0],l[0],u[0]),r=Math.min(a[1],s[1],l[1],u[1]),o=Math.max(a[1],s[1],l[1],u[1])}var c=this.attrs;if(c.shadowColor){var h=c.shadowBlur,d=void 0===h?0:h,f=c.shadowOffsetX,p=void 0===f?0:f,v=c.shadowOffsetY,g=void 0===v?0:v,y=n-d+p,m=i+d+p,C=r-d+g,w=o+d+g;n=Math.min(n,y),i=Math.max(i,m),r=Math.min(r,C),o=Math.max(o,w)}return{x:n,y:r,minX:n,minY:r,maxX:i,maxY:o,width:i-n,height:o-r}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(t,e){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(t,e){var n=this.get("startArrowShape"),r=this.get("endArrowShape"),i=[t,e,1],o=(i=this.invertFromMatrix(i))[0],a=i[1],s=this._isInBBox(o,a);if(this.isOnlyHitBox())return s;if(s&&!this.isClipped(o,a)){if(this.isInShape(o,a))return!0;if(n&&n.isHit(o,a))return!0;if(r&&r.isHit(o,a))return!0}return!1},e}(Vt),jn=new Map;function Vn(t,e){jn.set(t,e)}function Xn(t){var e=t.attr();return{x:e.x,y:e.y,width:e.width,height:e.height}}function Kn(t){var e=t.attr(),n=e.x,r=e.y,i=e.r;return{x:n-i,y:r-i,width:2*i,height:2*i}}function qn(t){return Math.min.apply(null,t)}function Zn(t){return Math.max.apply(null,t)}function $n(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function Qn(t,e){return Math.abs(t-e)<.001}function Jn(t,e){var n=qn(t),r=qn(e);return{x:n,y:r,width:Zn(t)-n,height:Zn(e)-r}}function tr(t){return(t+2*Math.PI)%(2*Math.PI)}var er={box:function(t,e,n,r){return Jn([t,n],[e,r])},length:function(t,e,n,r){return $n(t,e,n,r)},pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return a<0?$n(t,e,i,o):a>(n-t)*(n-t)+(r-e)*(r-e)?$n(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-a[1],a[0]];!function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(s,s);var l=[i-t,o-e];return Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}(l,s))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}};function nr(t,e,n,r,i,o){var a,s=1/0,l=[n,r],u=20;o&&o>200&&(u=o/10);for(var c=1/u,h=c/10,d=0;d<=u;d++){var f=d*c,p=[i.apply(null,t.concat([f])),i.apply(null,e.concat([f]))];(m=$n(l[0],l[1],p[0],p[1]))=0&&m=0?[i]:[]}function or(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function ar(t,e,n,r,i,o,a){var s=rr(t,n,i,a),l=rr(e,r,o,a),u=er.pointAt(t,e,n,r,a),c=er.pointAt(n,r,i,o,a);return[[t,e,u.x,u.y,s,l],[s,l,c.x,c.y,i,o]]}function sr(t,e,n,r,i,o,a){if(0===a)return($n(t,e,n,r)+$n(n,r,i,o)+$n(t,e,i,o))/2;var s=ar(t,e,n,r,i,o,.5),l=s[0],u=s[1];return l.push(a-1),u.push(a-1),sr.apply(null,l)+sr.apply(null,u)}var lr={box:function(t,e,n,r,i,o){var a=ir(t,n,i)[0],s=ir(e,r,o)[0],l=[t,i],u=[e,o];return void 0!==a&&l.push(rr(t,n,i,a)),void 0!==s&&u.push(rr(e,r,o,s)),Jn(l,u)},length:function(t,e,n,r,i,o){return sr(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return nr([t,n,i],[e,r,o],a,s,rr)},pointDistance:function(t,e,n,r,i,o,a,s){var l=this.nearestPoint(t,e,n,r,i,o,a,s);return $n(l.x,l.y,a,s)},interpolationAt:rr,pointAt:function(t,e,n,r,i,o,a){return{x:rr(t,n,i,a),y:rr(e,r,o,a)}},divide:function(t,e,n,r,i,o,a){return ar(t,e,n,r,i,o,a)},tangentAngle:function(t,e,n,r,i,o,a){var s=or(t,n,i,a),l=or(e,r,o,a);return tr(Math.atan2(l,s))}};function ur(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function cr(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function hr(t,e,n,r){var i,o,a,s=-3*t+9*e-9*n+3*r,l=6*t-12*e+6*n,u=3*e-3*t,c=[];if(Qn(s,0))Qn(l,0)||(i=-u/l)>=0&&i<=1&&c.push(i);else{var h=l*l-4*s*u;Qn(h,0)?c.push(-l/(2*s)):h>0&&(o=(-l-(a=Math.sqrt(h)))/(2*s),(i=(-l+a)/(2*s))>=0&&i<=1&&c.push(i),o>=0&&o<=1&&c.push(o))}return c}function dr(t,e,n,r,i,o,a,s,l){var u=ur(t,n,i,a,l),c=ur(e,r,o,s,l),h=er.pointAt(t,e,n,r,l),d=er.pointAt(n,r,i,o,l),f=er.pointAt(i,o,a,s,l),p=er.pointAt(h.x,h.y,d.x,d.y,l),v=er.pointAt(d.x,d.y,f.x,f.y,l);return[[t,e,h.x,h.y,p.x,p.y,u,c],[u,c,v.x,v.y,f.x,f.y,a,s]]}function fr(t,e,n,r,i,o,a,s,l){if(0===l)return function(t,e){for(var n=0,r=t.length,i=0;iu&&(u=f)}var p=function(t,e,n){return Math.atan(e/(t*Math.tan(n)))}(n,r,i),v=1/0,g=-1/0,y=[o,a];for(h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var m=p+h;og&&(g=C)}return{x:l,y:v,width:u-l,height:g-v}};var mr=function(t){return function(t){if(t.length<2)return 0;for(var e=0,n=0;n1){var i=function(t,e){return e?e-t:.14*t}(e,n);return e*r+i*(r-1)}return e}function _r(t){var e=t.fontSize,n=t.fontFamily,r=t.fontWeight;return[t.fontStyle,t.fontVariant,r,e+"px",n].join(" ").trim()}var br=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi,Tr=/[^\s\,]+/gi;var Lr="\t\n\v\f\r   ᠎              \u2028\u2029",Ir=new RegExp("([a-z])["+Lr+",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?["+Lr+"]*,?["+Lr+"]*)+)","ig"),Or=new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)["+Lr+"]*,?["+Lr+"]*","ig");var Rr=/[a-z]/;function Ar(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function Mr(t){var e=function(t){if(!t)return null;if(c(t))return t;var e={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},n=[];return String(t).replace(Ir,(function(t,r,i){var o=[],a=r.toLowerCase();if(i.replace(Or,(function(t,e){e&&o.push(+e)})),"m"===a&&o.length>2&&(n.push([r].concat(o.splice(0,2))),a="l",r="m"===r?"l":"L"),"o"===a&&1===o.length&&n.push([r,o[0]]),"r"===a)n.push([r].concat(o));else for(;o.length>=e[a]&&(n.push([r].concat(o.splice(0,e[a]))),e[a]););return""})),n}(t);if(!e||!e.length)return[["M",0,0]];for(var n=!1,r=0;r=0){n=!0;break}}if(!n)return e;var o=[],a=0,s=0,l=0,u=0,h=0,d=e[0];"M"!==d[0]&&"m"!==d[0]||(l=a=+d[1],u=s=+d[2],h++,o[0]=["M",a,s]);r=h;for(var f=e.length;r1&&(n*=Math.sqrt(f),r*=Math.sqrt(f));var p=n*n*(d*d)+r*r*(h*h),v=p?Math.sqrt((n*n*(r*r)-p)/p):1;o===a&&(v*=-1),isNaN(v)&&(v=0);var g=r?v*n*d/r:0,y=n?v*-r*h/n:0,C=(s+u)/2+Math.cos(i)*g-Math.sin(i)*y,x=(l+c)/2+Math.sin(i)*g+Math.cos(i)*y,S=[(h-g)/n,(d-y)/r],E=[(-1*h-g)/n,(-1*d-y)/r],_=Dr([1,0],S),b=Dr(S,E);return Nr(S,E)<=-1&&(b=Math.PI),Nr(S,E)>=1&&(b=0),0===a&&b>0&&(b-=2*Math.PI),1===a&&b<0&&(b+=2*Math.PI),{cx:C,cy:x,rx:Pr(t,[u,c])?0:n,ry:Pr(t,[u,c])?0:r,startAngle:_,endAngle:_+b,xRotation:i,arcFlag:o,sweepFlag:a}}function zr(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function Fr(t){t=function(t){var e=t||[];return c(e)?e:g(e)?(d(e=e.match(br),(function(t,n){if((t=t.match(Tr))[0].length>1){var r=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=r}d(t,(function(e,n){isNaN(e)||(t[n]=+e)})),e[n]=t})),e):void 0}(t);for(var e=[],n=null,r=null,i=null,o=0,a=t.length,s=0;sMath.PI/2?Math.PI-d:d,f=f>Math.PI/2?Math.PI-f:f,{xExtra:Math.cos(h/2-d)*(e/2*(1/Math.sin(h/2)))-e/2||0,yExtra:Math.cos(f-h/2)*(e/2*(1/Math.sin(h/2)))-e/2||0}}function Wr(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function Gr(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function Ur(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY=0&&a<.5*Math.PI?(r={x:l.minX,y:l.minY},i={x:l.maxX,y:l.maxY}):.5*Math.PI<=a&&a1&&(n*=Math.sqrt(f),r*=Math.sqrt(f));var p=n*n*(d*d)+r*r*(h*h),v=p?Math.sqrt((n*n*(r*r)-p)/p):1;o===a&&(v*=-1),isNaN(v)&&(v=0);var g=r?v*n*d/r:0,y=n?v*-r*h/n:0,C=(s+u)/2+Math.cos(i)*g-Math.sin(i)*y,x=(l+c)/2+Math.sin(i)*g+Math.cos(i)*y,S=[(h-g)/n,(d-y)/r],E=[(-1*h-g)/n,(-1*d-y)/r],_=Jr([1,0],S),b=Jr(S,E);return Qr(S,E)<=-1&&(b=Math.PI),Qr(S,E)>=1&&(b=0),0===a&&b>0&&(b-=2*Math.PI),1===a&&b<0&&(b+=2*Math.PI),{cx:C,cy:x,rx:Yr(t,[u,c])?0:n,ry:Yr(t,[u,c])?0:r,startAngle:_,endAngle:_+b,xRotation:i,arcFlag:o,sweepFlag:a}}var ei=Math.sin,ni=Math.cos,ri=Math.atan2,ii=Math.PI;function oi(t,e,n,r,i,o,a){var s=e.stroke,l=e.lineWidth,u=ri(r-o,n-i),c=new Xi({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*ni(ii/6)+","+10*ei(ii/6)+" L0,0 L"+10*ni(ii/6)+",-"+10*ei(ii/6),stroke:s,lineWidth:l}});c.translate(i,o),c.rotateAtPoint(i,o,u),t.set(a?"startArrowShape":"endArrowShape",c)}function ai(t,e,n,r,o,a,s){var l=e.startArrow,u=e.endArrow,c=e.stroke,h=e.lineWidth,d=s?l:u,f=d.d,p=d.fill,v=d.stroke,g=d.lineWidth,y=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);iw?C:w,T=C>w?1:C/w,L=C>w?w/C:1;e.translate(y,m),e.rotate(E),e.scale(T,L),e.arc(0,0,b,x,S,1-_),e.scale(1/T,1/L),e.rotate(-E),e.translate(-y,-m)}break;case"Z":e.closePath()}if("Z"===d)s=l;else{var I=h.length;s=[h[I-2],h[I-1]]}}}}function Ci(t,e){var n=t.get("canvas");n&&("remove"===e&&(t._cacheCanvasBBox=t.get("cacheCanvasBBox")),t.get("hasChanged")||(t.set("hasChanged",!0),t.cfg.parent&&t.cfg.parent.get("hasChanged")||(n.refreshElement(t,e,n),n.get("autoDraw")&&n.draw())))}function wi(t){var e,n,r;if(t.destroyed)e=t._cacheCanvasBBox;else{var i=t.get("cacheCanvasBBox"),o=i&&!(!i.width||!i.height),a=t.getCanvasBBox(),s=a&&!(!a.width||!a.height);o&&s?(r=a,e=(n=i)&&r?{minX:Math.min(n.minX,r.minX),minY:Math.min(n.minY,r.minY),maxX:Math.max(n.maxX,r.maxX),maxY:Math.max(n.maxY,r.maxY)}:n||r):o?e=i:s&&(e=a)}return e}var xi=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.onCanvasChange=function(t){Ci(this,t)},n.prototype.getShapeBase=function(){return e},n.prototype.getGroupBase=function(){return n},n.prototype._applyClip=function(t,e){e&&(t.save(),hi(t,e),e.createPath(t),t.restore(),t.clip(),e._afterDraw())},n.prototype.cacheCanvasBBox=function(){var t=this.cfg.children,e=[],n=[];d(t,(function(t){var r=t.cfg.cacheCanvasBBox;r&&t.cfg.isInView&&(e.push(r.minX,r.maxX),n.push(r.minY,r.maxY))}));var r=null;if(e.length){var i=v(e),o=p(e),a=v(n),s=p(n);r={minX:i,minY:a,x:i,y:a,maxX:o,maxY:s,width:o-i,height:s-a};var l=this.cfg.canvas;if(l){var u=l.getViewRange();this.set("isInView",Ur(r,u))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",r)},n.prototype.draw=function(t,e){var n=this.cfg.children,r=!e||this.cfg.refresh;n.length&&r&&(t.save(),hi(t,this),this._applyClip(t,this.getClip()),di(t,n,e),t.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},n.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},n}(Un),Si=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return i(i({},e),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},n.prototype.getShapeBase=function(){return e},n.prototype.getGroupBase=function(){return xi},n.prototype.onCanvasChange=function(t){Ci(this,t)},n.prototype.calculateBBox=function(){var t=this.get("type"),e=this.getHitLineWidth(),n=function(t){return jn.get(t)}(t),r=n(this),i=e/2,o=r.x-i,a=r.y-i,s=r.x+r.width+i,l=r.y+r.height+i;return{x:o,minX:o,y:a,minY:a,width:r.width+e,height:r.height+e,maxX:s,maxY:l}},n.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},n.prototype.isStroke=function(){return!!this.attrs.stroke},n.prototype._applyClip=function(t,e){e&&(t.save(),hi(t,e),e.createPath(t),t.restore(),t.clip(),e._afterDraw())},n.prototype.draw=function(t,e){var n=this.cfg.clipShape;if(e){if(!1===this.cfg.refresh)return void this.set("hasChanged",!1);if(!Ur(e,this.getCanvasBBox()))return this.set("hasChanged",!1),void(this.cfg.isInView&&this._afterDraw())}t.save(),hi(t,this),this._applyClip(t,n),this.drawPath(t),t.restore(),this._afterDraw()},n.prototype.getCanvasViewBox=function(){var t=this.cfg.canvas;return t?t.getViewRange():null},n.prototype.cacheCanvasBBox=function(){var t=this.getCanvasViewBox();if(t){var e=this.getCanvasBBox(),n=Ur(e,t);this.set("isInView",n),n?this.set("cacheCanvasBBox",e):this.set("cacheCanvasBBox",null)}},n.prototype._afterDraw=function(){this.cacheCanvasBBox(),this.set("hasChanged",!1),this.set("refresh",null)},n.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("isInView",null),this.set("hasChanged",!1)},n.prototype.drawPath=function(t){this.createPath(t),this.strokeAndFill(t),this.afterDrawPath(t)},n.prototype.fill=function(t){t.fill()},n.prototype.stroke=function(t){t.stroke()},n.prototype.strokeAndFill=function(t){var e=this.attrs,n=e.lineWidth,r=e.opacity,i=e.strokeOpacity,o=e.fillOpacity;this.isFill()&&(u(o)||1===o?this.fill(t):(t.globalAlpha=o,this.fill(t),t.globalAlpha=r)),this.isStroke()&&n>0&&(u(i)||1===i||(t.globalAlpha=i),this.stroke(t)),this.afterDrawPath(t)},n.prototype.createPath=function(t){},n.prototype.afterDrawPath=function(t){},n.prototype.isInShape=function(t,e){var n=this.isStroke(),r=this.isFill(),i=this.getHitLineWidth();return this.isInStrokeOrPath(t,e,n,r,i)},n.prototype.isInStrokeOrPath=function(t,e,n,r,i){return!1},n.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var t=this.attrs;return t.lineWidth+t.lineAppendWidth},n}(Yn),Ei=Si,_i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return i(i({},e),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){var o=this.attr(),a=o.x,s=o.y,l=o.r,u=i/2,c=Wr(a,s,t,e);return r&&n?c<=l+u:r?c<=l:!!n&&(c>=l-u&&c<=l+u)},e.prototype.createPath=function(t){var e=this.attr(),n=e.x,r=e.y,i=e.r;t.beginPath(),t.arc(n,r,i,0,2*Math.PI,!1),t.closePath()},e}(Ei),bi=_i;function Ti(t,e,n,r){return t/(n*n)+e/(r*r)}var Li=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return i(i({},e),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){var o=this.attr(),a=i/2,s=o.x,l=o.y,u=o.rx,c=o.ry,h=(t-s)*(t-s),d=(e-l)*(e-l);return r&&n?Ti(h,d,u+a,c+a)<=1:r?Ti(h,d,u,c)<=1:!!n&&(Ti(h,d,u-a,c-a)>=1&&Ti(h,d,u+a,c+a)<=1)},e.prototype.createPath=function(t){var e=this.attr(),n=e.x,r=e.y,i=e.rx,o=e.ry;if(t.beginPath(),t.ellipse)t.ellipse(n,r,i,o,0,0,2*Math.PI,!1);else{var a=i>o?i:o,s=i>o?1:i/o,l=i>o?o/i:1;t.save(),t.translate(n,r),t.scale(s,l),t.arc(0,0,a,0,2*Math.PI),t.restore(),t.closePath()}},e}(Ei),Ii=Li;function Oi(t){return t instanceof HTMLElement&&g(t.nodeName)&&"CANVAS"===t.nodeName.toUpperCase()}var Ri=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return i(i({},e),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(t){this._setImage(t.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(!0===this.get("toDraw")){var t=this.get("canvas");t?t.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(t){var e=this,n=this.attrs;if(g(t)){var r=new Image;r.onload=function(){if(e.destroyed)return!1;e.attr("img",r),e.set("loading",!1),e._afterLoading();var t=e.get("callback");t&&t.call(e)},r.crossOrigin="Anonymous",r.src=t,this.set("loading",!0)}else t instanceof Image?(n.width||(n.width=t.width),n.height||(n.height=t.height)):Oi(t)&&(n.width||(n.width=Number(t.getAttribute("width"))),n.height||(n.height,Number(t.getAttribute("height"))))},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),"img"===e&&this._setImage(n)},e.prototype.createPath=function(t){if(this.get("loading"))return this.set("toDraw",!0),void this.set("context",t);var e=this.attr(),n=e.x,r=e.y,i=e.width,o=e.height,a=e.sx,s=e.sy,l=e.swidth,c=e.sheight,h=e.img;(h instanceof Image||Oi(h))&&(u(a)||u(s)||u(l)||u(c)?t.drawImage(h,n,r,i,o):t.drawImage(h,a,s,l,c,n,r,i,o))},e}(Ei),Ai=Ri;function Mi(t,e,n,r,i,o,a){var s=Math.min(t,n),l=Math.max(t,n),u=Math.min(e,r),c=Math.max(e,r),h=i/2;return o>=s-h&&o<=l+h&&a>=u-h&&a<=c+h&&er.pointToLine(t,e,n,r,o,a)<=i/2}var Bi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return i(i({},e),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),this.setArrow()},e.prototype.setArrow=function(){var t=this.attr(),e=t.x1,n=t.y1,r=t.x2,i=t.y2,o=t.startArrow,a=t.endArrow;o&&li(this,t,r,i,e,n),a&&ui(this,t,e,n,r,i)},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){if(!n||!i)return!1;var o=this.attr();return Mi(o.x1,o.y1,o.x2,o.y2,i,t,e)},e.prototype.createPath=function(t){var e=this.attr(),n=e.x1,r=e.y1,i=e.x2,o=e.y2,a=e.startArrow,s=e.endArrow,l={dx:0,dy:0},u={dx:0,dy:0};a&&a.d&&(l=si(n,r,i,o,e.startArrow.d)),s&&s.d&&(u=si(n,r,i,o,e.endArrow.d)),t.beginPath(),t.moveTo(n+l.dx,r+l.dy),t.lineTo(i-u.dx,o-u.dy)},e.prototype.afterDrawPath=function(t){var e=this.get("startArrowShape"),n=this.get("endArrowShape");e&&e.draw(t),n&&n.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr(),e=t.x1,n=t.y1,r=t.x2,i=t.y2;return er.length(e,n,r,i)},e.prototype.getPoint=function(t){var e=this.attr(),n=e.x1,r=e.y1,i=e.x2,o=e.y2;return er.pointAt(n,r,i,o,t)},e}(Ei),Ni=Bi,Di={circle:function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e]]},square:function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]},diamond:function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]},triangle:function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]},"triangle-down":function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]}},Pi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.initAttrs=function(t){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),-1!==["symbol","x","y","r","radius"].indexOf(e)&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(t){return u(t.r)?t.radius:t.r},e.prototype._getPath=function(){var t,n,r=this.attr(),i=r.x,o=r.y,a=r.symbol||"circle",s=this._getR(r);if(l(a))n=Mr(n=(t=a)(i,o,s));else{if(!(t=e.Symbols[a]))return console.warn(a+" marker is not supported."),null;n=t(i,o,s)}return n},e.prototype.createPath=function(t){mi(this,t,{path:this._getPath()},this.get("paramsCache"))},e.Symbols=Di,e}(Ei),ki=Pi;function zi(t,e,n){var r=Sr();return t.createPath(r),r.isPointInPath(e,n)}function Fi(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function Hi(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function Wi(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o0!=Fi(s[1]-n)>0&&Fi(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}function Gi(t,e,n,r,i,o,a,s){var l=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI);if(li)return!1;var u={x:t+n*Math.cos(l),y:e+n*Math.sin(l)};return Wr(u.x,u.y,a,s)<=o/2}var Ui=Dt;var Yi=i({hasArc:function(t){for(var e=!1,n=t.length,r=0;r0&&r.push(i),{polygons:n,polylines:r}},isPointInStroke:function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;sy?g:y;Rt(x,x,Ui(null,[["t",-p,-v],["r",-w],["s",1/(g>y?1:g/y),1/(g>y?y/g:1)]])),o=Gi(0,0,S,m,C,e,x[0],x[1])}if(o)break}}return o}},st);function ji(t,e,n){for(var r=!1,i=0;i=r[0]&&t<=r[1]&&(e=(t-r[0])/(r[1]-r[0]),n=i)}));var o=i[n];if(u(o)||u(n))return null;var a=o.length,s=i[n+1];return pr.pointAt(o[a-2],o[a-1],s[1],s[2],s[3],s[4],s[5],s[6],e)},e.prototype._calculateCurve=function(){var t=this.attr().path;this.set("curve",Yi.pathToCurve(t))},e.prototype._setTcache=function(){var t,e,n,r,i=0,o=0,a=[],s=this.get("curve");s&&(d(s,(function(t,e){n=s[e+1],r=t.length,n&&(i+=pr.length(t[r-2],t[r-1],n[1],n[2],n[3],n[4],n[5],n[6])||0)})),this.set("totalLength",i),0!==i?(d(s,(function(l,u){n=s[u+1],r=l.length,n&&((t=[])[0]=o/i,e=pr.length(l[r-2],l[r-1],n[1],n[2],n[3],n[4],n[5],n[6]),o+=e||0,t[1]=o/i,a.push(t))})),this.set("tCache",a)):this.set("tCache",[]))},e.prototype.getStartTangent=function(){var t,e=this.getSegments();if(e.length>1){var n=e[0].currentPoint,r=e[1].currentPoint,i=e[1].startTangent;t=[],i?(t.push([n[0]-i[0],n[1]-i[1]]),t.push([n[0],n[1]])):(t.push([r[0],r[1]]),t.push([n[0],n[1]]))}return t},e.prototype.getEndTangent=function(){var t,e=this.getSegments(),n=e.length;if(n>1){var r=e[n-2].currentPoint,i=e[n-1].currentPoint,o=e[n-1].endTangent;t=[],o?(t.push([i[0]-o[0],i[1]-o[1]]),t.push([i[0],i[1]])):(t.push([r[0],r[1]]),t.push([i[0],i[1]]))}return t},e}(Ei),Xi=Vi;function Ki(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var a=0;a=r[0]&&t<=r[1]&&(e=(t-r[0])/(r[1]-r[0]),n=i)})),er.pointAt(r[n][0],r[n][1],r[n+1][0],r[n+1][1],e)},e.prototype._setTcache=function(){var t=this.attr().points;if(t&&0!==t.length){var e=this.getTotalLength();if(!(e<=0)){var n,r,i=0,o=[];d(t,(function(a,s){t[s+1]&&((n=[])[0]=i/e,r=er.length(a[0],a[1],t[s+1][0],t[s+1][1]),i+=r,n[1]=i/e,o.push(n))})),this.set("tCache",o)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.prototype.getEndTangent=function(){var t=this.attr().points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n},e}(Ei),Qi=$i;var Ji=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return i(i({},e),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(t,e,n,r,i){var o=this.attr(),a=o.x,s=o.y,l=o.width,u=o.height,c=o.radius;if(c){var h=!1;return n&&(h=function(t,e,n,r,i,o,a,s){return Mi(t+i,e,t+n-i,e,o,a,s)||Mi(t+n,e+i,t+n,e+r-i,o,a,s)||Mi(t+n-i,e+r,t+i,e+r,o,a,s)||Mi(t,e+r-i,t,e+i,o,a,s)||Gi(t+n-i,e+i,i,1.5*Math.PI,2*Math.PI,o,a,s)||Gi(t+n-i,e+r-i,i,0,.5*Math.PI,o,a,s)||Gi(t+i,e+r-i,i,.5*Math.PI,Math.PI,o,a,s)||Gi(t+i,e+i,i,Math.PI,1.5*Math.PI,o,a,s)}(a,s,l,u,c,i,t,e)),!h&&r&&(h=zi(this,t,e)),h}var d=i/2;return r&&n?Gr(a-d,s-d,l+d,u+d,t,e):r?Gr(a,s,l,u,t,e):n?function(t,e,n,r,i,o,a){var s=i/2;return Gr(t-s,e-s,n,i,o,a)||Gr(t+n-s,e-s,i,r,o,a)||Gr(t+s,e+r-s,n,i,o,a)||Gr(t-s,e+s,i,r,o,a)}(a,s,l,u,i,t,e):void 0},e.prototype.createPath=function(t){var e=this.attr(),n=e.x,r=e.y,i=e.width,o=e.height,a=e.radius;if(t.beginPath(),0===a)t.rect(n,r,i,o);else{var s=function(t){var e=0,n=0,r=0,i=0;return c(t)?1===t.length?e=n=r=i=t[0]:2===t.length?(e=r=t[0],n=i=t[1]):3===t.length?(e=t[0],n=i=t[1],r=t[2]):(e=t[0],n=t[1],r=t[2],i=t[3]):e=n=r=i=t,[e,n,r,i]}(a),l=s[0],u=s[1],h=s[2],d=s[3];t.moveTo(n+l,r),t.lineTo(n+i-u,r),0!==u&&t.arc(n+i-u,r+u,u,-Math.PI/2,0),t.lineTo(n+i,r+o-h),0!==h&&t.arc(n+i-h,r+o-h,h,0,Math.PI/2),t.lineTo(n+d,r+o),0!==d&&t.arc(n+d,r+o-d,d,Math.PI/2,Math.PI),t.lineTo(n,r+l),0!==l&&t.arc(n+l,r+l,l,Math.PI,1.5*Math.PI),t.closePath()}},e}(Ei),to=Ji,eo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return i(i({},e),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.isOnlyHitBox=function(){return!0},e.prototype.initAttrs=function(t){this._assembleFont(),t.text&&this._setText(t.text)},e.prototype._assembleFont=function(){var t=this.attrs;t.font=_r(t)},e.prototype._setText=function(t){var e=null;g(t)&&-1!==t.indexOf("\n")&&(e=t.split("\n")),this.set("textArr",e)},e.prototype.onAttrChange=function(e,n,r){t.prototype.onAttrChange.call(this,e,n,r),e.startsWith("font")&&this._assembleFont(),"text"===e&&this._setText(n)},e.prototype._getSpaceingY=function(){var t=this.attrs,e=t.lineHeight,n=1*t.fontSize;return e?e-n:.14*n},e.prototype._drawTextArr=function(t,e,n){var r,i=this.attrs,o=i.textBaseline,a=i.x,s=i.y,l=1*i.fontSize,c=this._getSpaceingY(),h=Er(i.text,i.fontSize,i.lineHeight);d(e,(function(e,i){r=s+i*(c+l)-h+l,"middle"===o&&(r+=h-l-(h-l)/2),"top"===o&&(r+=h-l),u(e)||(n?t.fillText(e,a,r):t.strokeText(e,a,r))}))},e.prototype._drawText=function(t,e){var n=this.attr(),r=n.x,i=n.y,o=this.get("textArr");if(o)this._drawTextArr(t,o,e);else{var a=n.text;u(a)||(e?t.fillText(a,r,i):t.strokeText(a,r,i))}},e.prototype.strokeAndFill=function(t){var e=this.attrs,n=e.lineWidth,r=e.opacity,i=e.strokeOpacity,o=e.fillOpacity;this.isStroke()&&n>0&&(u(i)||1===i||(t.globalAlpha=r),this.stroke(t)),this.isFill()&&(u(o)||1===o?this.fill(t):(t.globalAlpha=o,this.fill(t),t.globalAlpha=r)),this.afterDrawPath(t)},e.prototype.fill=function(t){this._drawText(t,!0)},e.prototype.stroke=function(t){this._drawText(t,!1)},e}(Ei),no=eo;function ro(t,e,n){var r,i,o=t.getTotalMatrix();if(o){var a=(r=[e,n,1],(i=o)?kt(zt(i),r):r);return[a[0],a[1]]}return[e,n]}function io(t,e,n){if(t.isCanvas&&t.isCanvas())return!0;if(!vt(t)||!1===t.cfg.isInView)return!1;if(t.cfg.clipShape){var r=ro(t,e,n),i=r[0],o=r[1];if(t.isClipped(i,o))return!1}var a=t.cfg.cacheCanvasBBox||t.getCanvasBBox();return e>=a.minX&&e<=a.maxX&&n>=a.minY&&n<=a.maxY}function oo(t,e,n){if(!io(t,e,n))return null;for(var r=null,i=t.getChildren(),o=i.length-1;o>=0;o--){var a=i[o];if(a.isGroup())r=oo(a,e,n);else if(io(a,e,n)){var s=a,l=ro(a,e,n),u=l[0],c=l[1];s.isInShape(u,c)&&(r=a)}if(r)break}return r}var ao,so,lo,uo=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.renderer="canvas",e.autoDraw=!0,e.localRefresh=!0,e.refreshElements=[],e.clipView=!0,e.quickHit=!1,e},n.prototype.onCanvasChange=function(t){"attr"!==t&&"sort"!==t&&"changeSize"!==t||(this.set("refreshElements",[this]),this.draw())},n.prototype.getShapeBase=function(){return e},n.prototype.getGroupBase=function(){return xi},n.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||(window?window.devicePixelRatio:1);return t>=1?Math.ceil(t):1},n.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},n.prototype.createDom=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return this.set("context",e),t},n.prototype.setDOMSize=function(e,n){t.prototype.setDOMSize.call(this,e,n);var r=this.get("context"),i=this.get("el"),o=this.getPixelRatio();i.width=o*e,i.height=o*n,o>1&&r.scale(o,o)},n.prototype.clear=function(){t.prototype.clear.call(this),this._clearFrame();var e=this.get("context"),n=this.get("el");e.clearRect(0,0,n.width,n.height)},n.prototype.getShape=function(e,n){return this.get("quickHit")?oo(this,e,n):t.prototype.getShape.call(this,e,n,null)},n.prototype._getRefreshRegion=function(){var t,e=this.get("refreshElements"),n=this.getViewRange();e.length&&e[0]===this?t=n:(t=function(t){if(!t.length)return null;var e=[],n=[],r=[],i=[];return d(t,(function(t){var o=wi(t);o&&(e.push(o.minX),n.push(o.minY),r.push(o.maxX),i.push(o.maxY))})),{minX:v(e),minY:v(n),maxX:p(r),maxY:p(i)}}(e),t&&(t.minX=Math.floor(t.minX),t.minY=Math.floor(t.minY),t.maxX=Math.ceil(t.maxX),t.maxY=Math.ceil(t.maxY),t.maxY+=1,this.get("clipView")&&(t=function(t,e){return t&&e&&Ur(t,e)?{minX:Math.max(t.minX,e.minX),minY:Math.max(t.minY,e.minY),maxX:Math.min(t.maxX,e.maxX),maxY:Math.min(t.maxY,e.maxY)}:null}(t,n))));return t},n.prototype.refreshElement=function(t){this.get("refreshElements").push(t)},n.prototype._clearFrame=function(){var t,e=this.get("drawFrame");e&&(t=e,(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(t),this.set("drawFrame",null),this.set("refreshElements",[]))},n.prototype.draw=function(){var t=this.get("drawFrame");this.get("autoDraw")&&t||this._startDraw()},n.prototype._drawAll=function(){var t=this.get("context"),e=this.get("el"),n=this.getChildren();t.clearRect(0,0,e.width,e.height),hi(t,this),di(t,n),this.set("refreshElements",[])},n.prototype._drawRegion=function(){var t=this.get("context"),e=this.get("refreshElements"),n=this.getChildren(),r=this._getRefreshRegion();r?(t.clearRect(r.minX,r.minY,r.maxX-r.minX,r.maxY-r.minY),t.save(),t.beginPath(),t.rect(r.minX,r.minY,r.maxX-r.minX,r.maxY-r.minY),t.clip(),hi(t,this),fi(this,n,r),di(t,n,r),t.restore()):e.length&&vi(e),d(e,(function(t){t.get("hasChanged")&&t.set("hasChanged",!1)})),this.set("refreshElements",[])},n.prototype._startDraw=function(){var t,e=this,n=this.get("drawFrame");n||(t=function(){e.get("localRefresh")?e._drawRegion():e._drawAll(),e.set("drawFrame",null)},n=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)})(t),this.set("drawFrame",n))},n.prototype.skipDraw=function(){},n.prototype.removeDom=function(){var t=this.get("el");t.width=0,t.height=0,t.parentNode.removeChild(t)},n}(Gn);t.InteractionEvent=void 0,(ao=t.InteractionEvent||(t.InteractionEvent={})).DATA_CELL_CLICK_EVENT="interaction:data-cell-click",ao.MERGED_CELLS_CLICK_EVENT="interaction:merged-cells-click",ao.CORNER_TEXT_CLICK_EVENT="interaction:corner-cell-text-click",ao.ROW_COLUMN_CLICK_EVENT="interaction:row-column-click",ao.ROW_TEXT_CLICK_EVENT="interaction:row-text-click",ao.HOVER_EVENT="interaction:hover",ao.TREND_ICON_CLICK="interaction:trend-icon-click",t.OriginEventType=void 0,(so=t.OriginEventType||(t.OriginEventType={})).MOUSE_DOWN="mousedown",so.MOUSE_MOVE="mousemove",so.MOUSE_OUT="mouseout",so.MOUSE_LEAVE="mouseleave",so.MOUSE_UP="mouseup",so.KEY_DOWN="keydown",so.KEY_UP="keyup",so.CLICK="click",so.HOVER="hover",so.DOUBLE_CLICK="dblclick",so.CONTEXT_MENU="contextmenu",t.S2Event=void 0,(lo=t.S2Event||(t.S2Event={})).ROW_CELL_HOVER="row-cell:hover",lo.ROW_CELL_CLICK="row-cell:click",lo.ROW_CELL_DOUBLE_CLICK="row-cell:double-click",lo.ROW_CELL_CONTEXT_MENU="row-cell:context-menu",lo.ROW_CELL_MOUSE_DOWN="row-cell:mouse-down",lo.ROW_CELL_MOUSE_UP="row-cell:mouse-up",lo.ROW_CELL_MOUSE_MOVE="row-cell:mouse-move",lo.ROW_CELL_COLLAPSE_TREE_ROWS="row-cell:collapsed-tree-rows",lo.ROW_CELL_SCROLL="row-cell:scroll",lo.ROW_CELL_BRUSH_SELECTION="row-cell:brush-selection",lo.COL_CELL_HOVER="col-cell:hover",lo.COL_CELL_CLICK="col-cell:click",lo.COL_CELL_DOUBLE_CLICK="col-cell:double-click",lo.COL_CELL_CONTEXT_MENU="col-cell:context-menu",lo.COL_CELL_MOUSE_DOWN="col-cell:mouse-down",lo.COL_CELL_MOUSE_UP="col-cell:mouse-up",lo.COL_CELL_MOUSE_MOVE="col-cell:mouse-move",lo.COL_CELL_BRUSH_SELECTION="col-cell:brush-selection",lo.DATA_CELL_HOVER="data-cell:hover",lo.DATA_CELL_CLICK="data-cell:click",lo.DATA_CELL_DOUBLE_CLICK="data-cell:double-click",lo.DATA_CELL_CONTEXT_MENU="data-cell:context-menu",lo.DATA_CELL_MOUSE_UP="data-cell:mouse-up",lo.DATA_CELL_MOUSE_DOWN="data-cell:mouse-down",lo.DATA_CELL_MOUSE_MOVE="data-cell:mouse-move",lo.DATA_CELL_TREND_ICON_CLICK="data-cell:trend-icon-click",lo.DATA_CELL_BRUSH_SELECTION="data-cell:brush-selection",lo.DATA_CELL_SELECT_MOVE="data-cell:select-move",lo.CORNER_CELL_HOVER="corner-cell:hover",lo.CORNER_CELL_CLICK="corner-cell:click",lo.CORNER_CELL_DOUBLE_CLICK="corner-cell:double-click",lo.CORNER_CELL_CONTEXT_MENU="corner-cell:context-menu",lo.CORNER_CELL_MOUSE_DOWN="corner-cell:mouse-down",lo.CORNER_CELL_MOUSE_UP="corner-cell:mouse-up",lo.CORNER_CELL_MOUSE_MOVE="corner-cell:mouse-move",lo.MERGED_CELLS_HOVER="merged-cells:hover",lo.MERGED_CELLS_CLICK="merged-cells:click",lo.MERGED_CELLS_DOUBLE_CLICK="merged-cells:double-click",lo.MERGED_CELLS_CONTEXT_MENU="merged-cell:context-menu",lo.MERGED_CELLS_MOUSE_DOWN="merged-cells:mouse-down",lo.MERGED_CELLS_MOUSE_UP="merged-cells:mouse-up",lo.MERGED_CELLS_MOUSE_MOVE="merged-cells:mouse-move",lo.RANGE_SORT="sort:range-sort",lo.RANGE_SORTED="sort:range-sorted",lo.RANGE_FILTER="filter:range-filter",lo.RANGE_FILTERED="filter:range-filtered",lo.LAYOUT_AFTER_HEADER_LAYOUT="layout:after-header-layout",lo.LAYOUT_CELL_SCROLL="layout:cell-scroll",lo.LAYOUT_PAGINATION="layout:pagination",lo.LAYOUT_COLLAPSE_ROWS="layout:collapsed-rows",lo.LAYOUT_AFTER_COLLAPSE_ROWS="layout:after-collapsed-rows",lo.LAYOUT_TREE_ROWS_COLLAPSE_ALL="layout:toggle-collapse-all",lo.LAYOUT_COLS_EXPANDED="layout:table-col-expanded",lo.LAYOUT_COLS_HIDDEN="layout:table-col-hidden",lo.LAYOUT_AFTER_RENDER="layout:after-render",lo.LAYOUT_BEFORE_RENDER="layout:before-render",lo.LAYOUT_DESTROY="layout:destroy",lo.LAYOUT_RESIZE="layout:resize",lo.LAYOUT_RESIZE_SERIES_WIDTH="layout:resize-series-width",lo.LAYOUT_RESIZE_ROW_WIDTH="layout:resize-row-width",lo.LAYOUT_RESIZE_ROW_HEIGHT="layout:resize-row-height",lo.LAYOUT_RESIZE_COL_WIDTH="layout:resize-column-width",lo.LAYOUT_RESIZE_COL_HEIGHT="layout:resize-column-height",lo.LAYOUT_RESIZE_TREE_WIDTH="layout:resize-tree-width",lo.LAYOUT_RESIZE_MOUSE_DOWN="layout:resize:mouse-down",lo.LAYOUT_RESIZE_MOUSE_MOVE="layout:resize:mouse-move",lo.LAYOUT_RESIZE_MOUSE_UP="layout:resize-mouse-up",lo.GLOBAL_KEYBOARD_DOWN="global:keyboard-down",lo.GLOBAL_KEYBOARD_UP="global:keyboard-up",lo.GLOBAL_COPIED="global:copied",lo.GLOBAL_MOUSE_UP="global:mouse-up",lo.GLOBAL_MOUSE_MOVE="global:mouse-move",lo.GLOBAL_ACTION_ICON_CLICK="global:action-icon-click",lo.GLOBAL_ACTION_ICON_HOVER="global:action-icon-hover",lo.GLOBAL_ACTION_ICON_HOVER_OFF="global:action-icon-hover-off",lo.GLOBAL_CONTEXT_MENU="global:context-menu",lo.GLOBAL_CLICK="global:click",lo.GLOBAL_DOUBLE_CLICK="global:double-click",lo.GLOBAL_SELECTED="global:selected",lo.GLOBAL_HOVER="global:hover",lo.GLOBAL_RESET="global:reset",lo.GLOBAL_LINK_FIELD_JUMP="global:link-field-jump",lo.GLOBAL_SCROLL="global:scroll";var co,ho="$$value$$",fo="$$extra$$",po="$$extra_column$$",vo="$$total$$",go="$$series_number$$",yo="backGroundGroup",mo="foreGroundGroup",Co="panelGroup",wo="panelScrollGroup",xo="mergedCellsGroup",So="frozenRowGroup",Eo="frozenColGroup",_o="frozenTrailingRowGroup",bo="frozenTrailingColGroup",To="frozenTopGroup",Lo="frozenBottomGroup",Io="rowResizeAreaGroup",Oo="rowFrozenResizeAreaGroup",Ro="frozenSplitLine",Ao="rowIndexResizeAreaGroup",Mo="cornerResizeAreaGroup",Bo="colResizeAreaGroup",No="colFrozenResizeAreaGroup",Do="colScrollGroup",Po="colFrozenGroup",ko="colFrozenTrailingGroup",zo="gridGroup",Fo="series-number-node",Ho="horizontal-resize-area-",Wo="root",Go="[&]",Uo="-",Yo=/^root\[&\]*/;t.MiniChartTypes=void 0,(co=t.MiniChartTypes||(t.MiniChartTypes={})).Line="line",co.Bar="bar",co.Bullet="bullet";var jo,Vo,Xo="square",Ko="antv-s2",qo="valueRanges",Zo={},$o={data:[],totalData:[],fields:{rows:[],columns:[],values:[],customTreeItems:[],valueInCols:!0},meta:[],sortParams:[],filterParams:[]};t.FrozenCellType=void 0,(Vo=t.FrozenCellType||(t.FrozenCellType={})).ROW="row",Vo.COL="col",Vo.TRAILING_ROW="trailingRow",Vo.TRAILING_COL="trailingCol",Vo.SCROLL="scroll",Vo.TOP="top",Vo.BOTTOM="bottom",t.FrozenGroup=void 0,function(t){t.FROZEN_COL="frozenCol",t.FROZEN_ROW="frozenRow",t.FROZEN_TRAILING_COL="frozenTrailingCol",t.FROZEN_TRAILING_ROW="frozenTrailingRow"}(t.FrozenGroup||(t.FrozenGroup={}));var Qo=((jo={})[t.FrozenCellType.ROW]="frozenRowGroup",jo[t.FrozenCellType.COL]="frozenColGroup",jo[t.FrozenCellType.TRAILING_COL]="frozenTrailingColGroup",jo[t.FrozenCellType.TRAILING_ROW]="frozenTrailingRowGroup",jo[t.FrozenCellType.SCROLL]="panelScrollGroup",jo[t.FrozenCellType.TOP]="frozenTopGroup",jo[t.FrozenCellType.BOTTOM]="frozenBottomGroup",jo),Jo="object"==typeof global&&global&&global.Object===Object&&global,ta="object"==typeof self&&self&&self.Object===Object&&self,ea=Jo||ta||Function("return this")(),na=ea.Symbol,ra=Object.prototype,ia=ra.hasOwnProperty,oa=ra.toString,aa=na?na.toStringTag:void 0;var sa=Object.prototype.toString;var la=na?na.toStringTag:void 0;function ua(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":la&&la in Object(t)?function(t){var e=ia.call(t,aa),n=t[aa];try{t[aa]=void 0;var r=!0}catch(t){}var i=oa.call(t);return r&&(e?t[aa]=n:delete t[aa]),i}(t):function(t){return sa.call(t)}(t)}function ca(t){return null!=t&&"object"==typeof t}function ha(t){return"symbol"==typeof t||ca(t)&&"[object Symbol]"==ua(t)}function da(t){return"number"==typeof t?t:ha(t)?NaN:+t}function fa(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var _s=Es($a),bs=/\{\n\/\* \[wrapped with (.+)\] \*/,Ts=/,? & /;var Ls=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Is(t){return function(){return t}}var Os=function(){try{var t=Xa(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Rs=Os,As=Rs?function(t,e){return Rs(t,"toString",{configurable:!0,enumerable:!1,value:Is(e),writable:!0})}:Ba,Ms=Es(As);function Bs(t,e){for(var n=-1,r=null==t?0:t.length;++n-1}var zs=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];function Fs(t,e,n){var r=e+"";return Ms(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Ls,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Bs(zs,(function(n){var r="_."+n[0];e&n[1]&&!ks(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(bs);return e?e[1].split(Ts):[]}(r),n)))}function Hs(t,e,n,r,i,o,a,s,l,u){var c=8&e;e|=c?32:64,4&(e&=~(c?64:32))||(e&=-4);var h=[t,e,i,c?o:void 0,c?a:void 0,c?void 0:o,c?void 0:a,s,l,u],d=n.apply(void 0,h);return xs(t)&&_s(d,h),d.placeholder=r,Fs(d,t,e)}function Ws(t){return t.placeholder}var Gs=/^(?:0|[1-9]\d*)$/;function Us(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Gs.test(t))&&t>-1&&t%1==0&&t1&&m.reverse(),c&&l-1&&t%1==0&&t<=9007199254740991}function cl(t){return null!=t&&ul(t.length)&&!Na(t)}function hl(t,e,n){if(!_a(n))return!1;var r=typeof e;return!!("number"==r?cl(n)&&Us(e,n.length):"string"==r&&e in n)&&nl(n[e],t)}function dl(t){return ll((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&hl(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++r-1},uu.prototype.set=function(t,e){var n=this.__data__,r=su(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var cu=Xa(ea,"Map");function hu(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function du(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e0&&n(s)?e>1?Lu(s,e-1,n,r,i):_u(i,s):r||(i[i.length]=s)}return i}function Iu(t){return(null==t?0:t.length)?Lu(t,1):[]}function Ou(t){return Ms(sl(t,void 0,Iu),t+"")}var Ru=Ou(Eu),Au=kl(Object.getPrototypeOf,Object),Mu=Function.prototype,Bu=Object.prototype,Nu=Mu.toString,Du=Bu.hasOwnProperty,Pu=Nu.call(Object);function ku(t){if(!ca(t)||"[object Object]"!=ua(t))return!1;var e=Au(t);if(null===e)return!0;var n=Du.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Nu.call(n)==Pu}function zu(t){if(!ca(t))return!1;var e=ua(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ku(t)}var Fu=ll((function(t,e){try{return ns(t,void 0,e)}catch(t){return zu(t)?t:new Error(t)}})),Hu=Fu;function Wu(t,e){var n;if("function"!=typeof e)throw new TypeError("Expected a function");return t=Ma(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var Gu=ll((function(t,e,n){var r=1;if(n.length){var i=Xs(n,Ws(Gu));r|=32}return Js(t,r,e,n,i)}));Gu.placeholder={};var Uu=Gu,Yu=Ou((function(t,e){return Bs(e,(function(e){e=wu(e),el(t,e,Uu(t[e],t))})),t})),ju=Yu,Vu=ll((function(t,e,n){var r=3;if(n.length){var i=Xs(n,Ws(Vu));r|=32}return Js(e,r,t,n,i)}));Vu.placeholder={};var Xu=Vu;function Ku(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=r?t:Ku(t,e,n)}var Zu=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function $u(t){return Zu.test(t)}var Qu="[\\ud800-\\udfff]",Ju="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",tc="\\ud83c[\\udffb-\\udfff]",ec="[^\\ud800-\\udfff]",nc="(?:\\ud83c[\\udde6-\\uddff]){2}",rc="[\\ud800-\\udbff][\\udc00-\\udfff]",ic="(?:"+Ju+"|"+tc+")"+"?",oc="[\\ufe0e\\ufe0f]?",ac=oc+ic+("(?:\\u200d(?:"+[ec,nc,rc].join("|")+")"+oc+ic+")*"),sc="(?:"+[ec+Ju+"?",Ju,nc,rc,Qu].join("|")+")",lc=RegExp(tc+"(?="+tc+")|"+sc+ac,"g");function uc(t){return $u(t)?function(t){return t.match(lc)||[]}(t):function(t){return t.split("")}(t)}function cc(t){return function(e){var n=$u(e=mu(e))?uc(e):void 0,r=n?n[0]:e.charAt(0),i=n?qu(n,1).join(""):e.slice(1);return r[t]()+i}}var hc=cc("toUpperCase");function dc(t){return hc(mu(t).toLowerCase())}function fc(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i=e?t:e)),t}function eh(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=Oa(n))==n?n:0),void 0!==e&&(e=(e=Oa(e))==e?e:0),th(Oa(t),e,n)}function nh(t){var e=this.__data__=new uu(t);this.size=e.size}function rh(t,e){return t&&ol(e,Wl(e),t)}nh.prototype.clear=function(){this.__data__=new uu,this.size=0},nh.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},nh.prototype.get=function(t){return this.__data__.get(t)},nh.prototype.has=function(t){return this.__data__.has(t)},nh.prototype.set=function(t,e){var n=this.__data__;if(n instanceof uu){var r=n.__data__;if(!cu||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new du(r)}return n.set(t,e),this.size=n.size,this};var ih="object"==typeof t&&t&&!t.nodeType&&t,oh=ih&&"object"==typeof module&&module&&!module.nodeType&&module,ah=oh&&oh.exports===ih?ea.Buffer:void 0,sh=ah?ah.allocUnsafe:void 0;function lh(t,e){if(e)return t.slice();var n=t.length,r=sh?sh(n):new t.constructor(n);return t.copy(r),r}function uh(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++ns))return!1;var u=o.get(t),c=o.get(e);if(u&&c)return u==e&&c==t;var h=-1,d=!0,f=2&n?new rd:void 0;for(o.set(t,e),o.set(e,t);++h=e||n<0||h&&t-u>=o}function g(){var t=jd();if(v(t))return y(t);s=setTimeout(g,function(t){var n=e-(t-l);return h?Xd(n,o-(t-u)):n}(t))}function y(t){return s=void 0,d&&r?f(t):(r=i=void 0,a)}function m(){var t=jd(),n=v(t);if(r=arguments,i=this,l=t,n){if(void 0===s)return p(l);if(h)return clearTimeout(s),s=setTimeout(g,e),f(l)}return void 0===s&&(s=setTimeout(g,e)),a}return e=Oa(e)||0,_a(n)&&(c=!!n.leading,o=(h="maxWait"in n)?Vd(Oa(n.maxWait)||0,e):o,d="trailing"in n?!!n.trailing:d),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?a:y(jd())},m}var qd=Object.prototype,Zd=qd.hasOwnProperty,$d=ll((function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&hl(e[0],e[1],i)&&(r=1);++n=200&&(o=od,a=!1,e=new rd(e));t:for(;++i=0&&t.slice(n,i)==e}function Bf(t){return function(e){var n=Nh(e);return"[object Map]"==n?sd(e):"[object Set]"==n?function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}(e):function(t,e){return fa(e,(function(e){return[e,t[e]]}))}(e,t(e))}}var Nf=Bf(Wl),Df=Bf(Xl),Pf=pc({"&":"&","<":"<",">":">",'"':""","'":"'"}),kf=/[&<>"']/g,zf=RegExp(kf.source);function Ff(t){return(t=mu(t))&&zf.test(t)?t.replace(kf,Pf):t}var Hf=/[\\^$.*+?()[\]{}|]/g,Wf=RegExp(Hf.source);function Gf(t,e){for(var n=-1,r=null==t?0:t.length;++n-1?i[o?e[a]:a]:void 0}}var qf=Math.max;function Zf(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:Ma(n);return i<0&&(i=qf(r+i,0)),Ns(t,Od(e),i)}var $f=Kf(Zf);function Qf(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}var Jf=Math.max,tp=Math.min;function ep(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=Ma(n),i=n<0?Jf(r+i,0):tp(i,r-1)),Ns(t,Od(e),i,!0)}var np=Kf(ep);function rp(t){return t&&t.length?t[0]:void 0}function ip(t,e){var n=-1,r=cl(t)?Array(t.length):[];return kd(t,(function(t,i,o){r[++n]=e(t,i,o)})),r}function op(t,e){return(pa(t)?fa:ip)(t,Od(e))}var ap=qc("floor");function sp(t){return Ou((function(e){var n=e.length,r=n,i=gs.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new TypeError("Expected a function");if(i&&!a&&"wrapper"==vs(o))var a=new gs([],!0)}for(r=a?r:n;++re}function gp(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=Oa(e),n=Oa(n)),t(e,n)}}var yp=gp(vp),mp=gp((function(t,e){return t>=e})),Cp=Object.prototype.hasOwnProperty;function wp(t,e){return null!=t&&Cp.call(t,e)}function xp(t,e){return null!=t&&_d(t,e,wp)}var Sp=Math.max,Ep=Math.min;function _p(t,e,n){return e=Aa(e),void 0===n?(n=e,e=0):n=Aa(n),function(t,e,n){return t>=Ep(e,n)&&t-1:!!i&&Ps(t,e,n)>-1}var Rp=Math.max;function Ap(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:Ma(n);return i<0&&(i=Rp(r+i,0)),Ps(t,e,i)}var Mp=Math.min;function Bp(t,e,n){for(var r=n?pf:ks,i=t[0].length,o=t.length,a=o,s=Array(o),l=1/0,u=[];a--;){var c=t[a];a&&e&&(c=fa(c,Il(e))),l=Mp(c.length,l),s[a]=!n&&(e||i>=120&&c.length>=120)?new rd(a&&c):void 0}c=t[0];var h=-1,d=s[0];t:for(;++h1),e})),ol(t,Ch(t),n),r&&(n=Qh(n,7,$v));for(var i=e.length;i--;)Zv(n,e[i]);return n})),Jv=Qv;function tg(t,e,n,r){if(!_a(t))return t;for(var i=-1,o=(e=Cu(e,t)).length,a=o-1,s=t;null!=s&&++ie||o&&a&&l&&!s&&!u||r&&a&&l||!n&&l||!i)return 1;if(!r&&!o&&!u&&t=s?l:l*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function og(t,e,n,r){return null==t?[]:(pa(e)||(e=null==e?[]:[e]),pa(n=r?void 0:n)||(n=null==n?[]:[n]),ig(t,e,n))}function ag(t){return Ou((function(e){return e=fa(e,Il(Od)),ll((function(n){var r=this;return t(e,(function(t){return ns(t,r,n)}))}))}))}var sg=ag(fa),lg=ll,ug=Math.min,cg=lg((function(t,e){var n=(e=1==e.length&&pa(e[0])?fa(e[0],Il(Od)):fa(Lu(e,1),Il(Od))).length;return ll((function(r){for(var i=-1,o=ug(r.length,n);++i9007199254740991)return n;do{e%2&&(n+=t),(e=pg(e/2))&&(t+=t)}while(e);return n}var gg=Ld("length"),yg="[\\ud800-\\udfff]",mg="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Cg="\\ud83c[\\udffb-\\udfff]",wg="[^\\ud800-\\udfff]",xg="(?:\\ud83c[\\udde6-\\uddff]){2}",Sg="[\\ud800-\\udbff][\\udc00-\\udfff]",Eg="(?:"+mg+"|"+Cg+")"+"?",_g="[\\ufe0e\\ufe0f]?",bg=_g+Eg+("(?:\\u200d(?:"+[wg,xg,Sg].join("|")+")"+_g+Eg+")*"),Tg="(?:"+[wg+mg+"?",mg,xg,Sg,yg].join("|")+")",Lg=RegExp(Cg+"(?="+Cg+")|"+Tg+bg,"g");function Ig(t){return $u(t)?function(t){for(var e=Lg.lastIndex=0;Lg.test(t);)++e;return e}(t):gg(t)}var Og=Math.ceil;function Rg(t,e){var n=(e=void 0===e?" ":ya(e)).length;if(n<2)return n?vg(e,t):e;var r=vg(e,Og(t/Ig(e)));return $u(e)?qu(uc(r),0,t).join(""):r.slice(0,t)}var Ag=Math.ceil,Mg=Math.floor;var Bg=/^\s+/,Ng=ea.parseInt;var Dg=ll((function(t,e){return Js(t,32,void 0,e,Xs(e,Ws(Dg)))}));Dg.placeholder={};var Pg=Dg,kg=ll((function(t,e){return Js(t,64,void 0,e,Xs(e,Ws(kg)))}));kg.placeholder={};var zg=kg,Fg=Fd((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),Hg=Fg;var Wg=Ou((function(t,e){return null==t?{}:function(t,e){return eg(t,e,(function(e,n){return bd(t,n)}))}(t,e)})),Gg=Wg;function Ug(t,e,n,r){for(var i=n-1,o=t.length;++i-1;)s!==t&&Yg.call(s,l,1),Yg.call(t,l,1);return t}function Vg(t,e){return t&&t.length&&e&&e.length?jg(t,e):t}var Xg=ll(Vg);var Kg=Array.prototype.splice;function qg(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;Us(i)?Kg.call(t,i,1):Zv(t,i)}}return t}var Zg=Ou((function(t,e){var n=null==t?0:t.length,r=Eu(t,e);return qg(t,fa(e,(function(t){return Us(t,n)?+t:t})).sort(rg)),r})),$g=Zg,Qg=Math.floor,Jg=Math.random;function ty(t,e){return t+Qg(Jg()*(e-t+1))}var ey=parseFloat,ny=Math.min,ry=Math.random;var iy=Math.ceil,oy=Math.max;function ay(t){return function(e,n,r){return r&&"number"!=typeof r&&hl(e,n,r)&&(n=r=void 0),e=Aa(e),void 0===n?(n=e,e=0):n=Aa(n),function(t,e,n,r){for(var i=-1,o=oy(iy((e-t)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=t,t+=n;return a}(e,n,r=void 0===r?e1&&hl(t,e[0],e[1])?e=[]:n>2&&hl(e[0],e[1],e[2])&&(e=[e[0]]),ig(t,Lu(e,1),[])})),Ay=Ry,My=Math.floor,By=Math.min;function Ny(t,e,n,r){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=n(e))!=e,s=null===e,l=ha(e),u=void 0===e;i>>1,a=t[o];null!==a&&!ha(a)&&(n?a<=e:a>>0)?(t=mu(t))&&("string"==typeof e||null!=e&&!pv(e))&&!(e=ya(e))&&$u(t)?qu(uc(t),0,n):t.split(e,n):[]}var zy=Math.max;var Fy=Yc((function(t,e,n){return t+(n?" ":"")+hc(e)})),Hy=Fy;function Wy(){return!0}var Gy=ma((function(t,e){return t-e}),0);var Uy=Object.prototype,Yy=Uy.hasOwnProperty;function jy(t,e,n,r){return void 0===t||nl(t,Uy[n])&&!Yy.call(r,n)?e:t}var Vy={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function Xy(t){return"\\"+Vy[t]}var Ky=/<%=([\s\S]+?)%>/g,qy={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:Ky,variable:"",imports:{_:{escape:Ff}}},Zy=/\b__p \+= '';/g,$y=/\b(__p \+=) '' \+/g,Qy=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Jy=/[()=,{}\[\]\/\s]/,tm=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,em=/($^)/,nm=/['\n\r\u2028\u2029\\]/g,rm=Object.prototype.hasOwnProperty;function im(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return _a(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Kd(t,e,{leading:r,maxWait:e,trailing:i})}function om(t,e){return e(t)}var am=4294967295,sm=Math.min;function lm(t,e){var n=t;return n instanceof us&&(n=n.value()),fc(e,(function(t,e){return e.func.apply(e.thisArg,_u([t],e.args))}),n)}function um(){return lm(this.__wrapped__,this.__actions__)}var cm=9007199254740991;function hm(t){return mu(t).toUpperCase()}function dm(t,e){for(var n=t.length;n--&&Ps(e,t[n],0)>-1;);return n}function fm(t,e){for(var n=-1,r=t.length;++n-1;);return n}function pm(t,e,n){if((t=mu(t))&&(n||void 0===e))return Ea(t);if(!t||!(e=ya(e)))return t;var r=uc(t),i=uc(e);return qu(r,fm(r,i),dm(r,i)+1).join("")}var vm=/^\s+/;var gm=/\w*$/;var ym=pc({"&":"&","<":"<",">":">",""":'"',"'":"'"}),mm=/&(?:amp|lt|gt|quot|#39);/g,Cm=RegExp(mm.source);var wm=Sh&&1/ld(new Sh([,-0]))[1]==1/0?function(t){return new Sh(t)}:cs,xm=wm;function Sm(t,e,n){var r=-1,i=ks,o=t.length,a=!0,s=[],l=s;if(n)a=!1,i=pf;else if(o>=200){var u=e?null:xm(t);if(u)return ld(u);a=!1,i=od,l=new rd}else l=e?[]:s;t:for(;++r1||this.__actions__.length)&&r instanceof us&&Us(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:om,args:[i],thisArg:void 0}),new gs(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)})),Fm=zm;function Hm(t,e,n){var r=t.length;if(r<2)return r?Sm(t[0]):[];for(var i=-1,o=Array(r);++i1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Mm(t,n)})),Km={chunk:function(t,e,n){e=(n?hl(t,e,n):void 0===e)?1:Jc(Ma(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var i=0,o=0,a=Array(Qc(r/e));ii?0:i+n),(r=void 0===r||r>i?i:Ma(r))<0&&(r+=i),r=n>r?0:jf(r);n=-9007199254740991&&t<=vv},isSet:Xh,isString:bp,isSymbol:ha,isTypedArray:Nl,isUndefined:gv,isWeakMap:function(t){return ca(t)&&"[object WeakMap]"==Nh(t)},isWeakSet:function(t){return ca(t)&&"[object WeakSet]"==ua(t)},lt:Iv,lte:Ov,toArray:Kv,toFinite:Aa,toInteger:Ma,toLength:jf,toNumber:Oa,toPlainObject:nf,toSafeInteger:function(t){return t?th(Ma(t),-9007199254740991,cm):0===t?t:0},toString:mu},Jm={add:Ca,ceil:Zc,divide:Ef,floor:ap,max:Bv,maxBy:Nv,mean:function(t){return Pv(t,Ba)},meanBy:function(t,e){return Pv(t,Od(e))},min:Uv,minBy:function(t,e){return t&&t.length?Mv(t,Od(e),Lv):void 0},multiply:jv,round:yy,subtract:Gy,sum:function(t){return t&&t.length?Dv(t,Ba):0},sumBy:function(t,e){return t&&t.length?Dv(t,Od(e)):0}},tC=eh,eC=_p,nC=function(t,e,n){if(n&&"boolean"!=typeof n&&hl(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=Aa(t),void 0===e?(e=t,t=0):e=Aa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=ry();return ny(t+i*(e-t+ey("1e-"+((i+"").length-1))),e)}return ty(t,e)},rC={assign:Yl,assignIn:ql,assignInWith:$l,assignWith:Jl,at:Ru,create:function(t,e){var n=ts(t);return null==e?n:rh(n,e)},defaults:Qd,defaultsDeep:lf,entries:Nf,entriesIn:Df,extend:ql,extendWith:$l,findKey:function(t,e){return Qf(t,Od(e),Dd)},findLastKey:function(t,e){return Qf(t,Od(e),Of)},forIn:cp,forInRight:function(t,e){return null==t?t:If(t,bf(e),Xl)},forOwn:function(t,e){return t&&Dd(t,bf(e))},forOwnRight:function(t,e){return t&&Of(t,bf(e))},functions:function(t){return null==t?[]:hp(t,Wl(t))},functionsIn:function(t){return null==t?[]:hp(t,Xl(t))},get:Su,has:xp,hasIn:bd,invert:Gp,invertBy:Xp,invoke:Zp,keys:Wl,keysIn:Xl,mapKeys:Rv,mapValues:function(t,e){var n={};return e=Od(e),Dd(t,(function(t,r,i){el(n,r,e(t,r,i))})),n},merge:zv,mergeWith:sf,omit:Jv,omitBy:function(t,e){return ng(t,Vv(Od(e)))},pick:Gg,pickBy:ng,result:function(t,e,n){var r=-1,i=(e=Cu(e,t)).length;for(i||(i=1,t=void 0);++r=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},plant:function(t){for(var e,n=this;n instanceof ls;){var r=ms(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},reverse:function(){var t=this.__wrapped__;if(t instanceof us){var e=t;return this.__actions__.length&&(e=new us(this)),(e=e.reverse()).__actions__.push({func:om,args:[gy],thisArg:void 0}),new gs(e,this.__chain__)}return this.thru(gy)},tap:function(t,e){return e(t),t},thru:om,toIterator:function(){return this},toJSON:um,value:um,valueOf:um,wrapperChain:function(){return $c(this)}},oC={camelCase:Vc,capitalize:dc,deburr:mc,endsWith:Mf,escape:Ff,escapeRegExp:function(t){return(t=mu(t))&&Wf.test(t)?t.replace(Hf,"\\$&"):t},kebabCase:Cv,lowerCase:bv,lowerFirst:Tv,pad:function(t,e,n){t=mu(t);var r=(e=Ma(e))?Ig(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Rg(Mg(i),n)+t+Rg(Ag(i),n)},padEnd:function(t,e,n){t=mu(t);var r=(e=Ma(e))?Ig(t):0;return e&&r=o)return t;var s=n-Ig(r);if(s<1)return r;var l=a?qu(a,0,s).join(""):t.slice(0,s);if(void 0===i)return l+r;if(a&&(s+=l.length-s),pv(i)){if(t.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,mu(gm.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var h=u.index;l=l.slice(0,void 0===h?s:h)}}else if(t.indexOf(ya(i),s)!=s){var d=l.lastIndexOf(i);d>-1&&(l=l.slice(0,d))}return l+r},unescape:function(t){return(t=mu(t))&&Cm.test(t)?t.replace(mm,ym):t},upperCase:Dm,upperFirst:hc,words:Gc},aC={attempt:Hu,bindAll:ju,cond:Rd,conforms:function(t){return function(t){var e=Wl(t);return function(n){return Ad(n,t,e)}}(Qh(t,1))},constant:Is,defaultTo:function(t,e){return null==t||t!=t?e:t},flow:lp,flowRight:up,identity:Ba,iteratee:function(t){return Od("function"==typeof t?t:Qh(t,1))},matches:Av,matchesProperty:function(t,e){return Td(t,Qh(e,1))},method:Hv,methodOf:Gv,mixin:Yv,noop:cs,nthArg:function(t){return t=Ma(t),ll((function(e){return qv(e,t)}))},over:sg,overEvery:dg,overSome:fg,property:Id,propertyOf:function(t){return function(e){return null==t?void 0:xu(t,e)}},range:sy,rangeRight:ly,stubArray:ch,stubFalse:Sl,stubObject:function(){return{}},stubString:function(){return""},stubTrue:Wy,times:function(t,e){if((t=Ma(t))<1||t>9007199254740991)return[];var n=am,r=sm(t,am);e=bf(e),t-=am;for(var i=vl(r,e);++n * Build: `lodash modularize exports="es" -o ./` * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var cC,hC,dC,fC,pC=4294967295,vC=Array.prototype,gC=Object.prototype.hasOwnProperty,yC=na?na.iterator:void 0,mC=Math.max,CC=Math.min,wC=function(t){return function(e,n,r){if(null==r){var i=_a(n),o=i&&Wl(n),a=o&&o.length&&hp(n,o);(a?a.length:i)||(r=n,n=e,e=this)}return t(e,n,r)}}(Yv);ws.after=$m.after,ws.ary=$m.ary,ws.assign=rC.assign,ws.assignIn=rC.assignIn,ws.assignInWith=rC.assignInWith,ws.assignWith=rC.assignWith,ws.at=rC.at,ws.before=$m.before,ws.bind=$m.bind,ws.bindAll=aC.bindAll,ws.bindKey=$m.bindKey,ws.castArray=Qm.castArray,ws.chain=iC.chain,ws.chunk=Km.chunk,ws.compact=Km.compact,ws.concat=Km.concat,ws.cond=aC.cond,ws.conforms=aC.conforms,ws.constant=aC.constant,ws.countBy=qm.countBy,ws.create=rC.create,ws.curry=$m.curry,ws.curryRight=$m.curryRight,ws.debounce=$m.debounce,ws.defaults=rC.defaults,ws.defaultsDeep=rC.defaultsDeep,ws.defer=$m.defer,ws.delay=$m.delay,ws.difference=Km.difference,ws.differenceBy=Km.differenceBy,ws.differenceWith=Km.differenceWith,ws.drop=Km.drop,ws.dropRight=Km.dropRight,ws.dropRightWhile=Km.dropRightWhile,ws.dropWhile=Km.dropWhile,ws.fill=Km.fill,ws.filter=qm.filter,ws.flatMap=qm.flatMap,ws.flatMapDeep=qm.flatMapDeep,ws.flatMapDepth=qm.flatMapDepth,ws.flatten=Km.flatten,ws.flattenDeep=Km.flattenDeep,ws.flattenDepth=Km.flattenDepth,ws.flip=$m.flip,ws.flow=aC.flow,ws.flowRight=aC.flowRight,ws.fromPairs=Km.fromPairs,ws.functions=rC.functions,ws.functionsIn=rC.functionsIn,ws.groupBy=qm.groupBy,ws.initial=Km.initial,ws.intersection=Km.intersection,ws.intersectionBy=Km.intersectionBy,ws.intersectionWith=Km.intersectionWith,ws.invert=rC.invert,ws.invertBy=rC.invertBy,ws.invokeMap=qm.invokeMap,ws.iteratee=aC.iteratee,ws.keyBy=qm.keyBy,ws.keys=Wl,ws.keysIn=rC.keysIn,ws.map=qm.map,ws.mapKeys=rC.mapKeys,ws.mapValues=rC.mapValues,ws.matches=aC.matches,ws.matchesProperty=aC.matchesProperty,ws.memoize=$m.memoize,ws.merge=rC.merge,ws.mergeWith=rC.mergeWith,ws.method=aC.method,ws.methodOf=aC.methodOf,ws.mixin=wC,ws.negate=Vv,ws.nthArg=aC.nthArg,ws.omit=rC.omit,ws.omitBy=rC.omitBy,ws.once=$m.once,ws.orderBy=qm.orderBy,ws.over=aC.over,ws.overArgs=$m.overArgs,ws.overEvery=aC.overEvery,ws.overSome=aC.overSome,ws.partial=$m.partial,ws.partialRight=$m.partialRight,ws.partition=qm.partition,ws.pick=rC.pick,ws.pickBy=rC.pickBy,ws.property=aC.property,ws.propertyOf=aC.propertyOf,ws.pull=Km.pull,ws.pullAll=Km.pullAll,ws.pullAllBy=Km.pullAllBy,ws.pullAllWith=Km.pullAllWith,ws.pullAt=Km.pullAt,ws.range=aC.range,ws.rangeRight=aC.rangeRight,ws.rearg=$m.rearg,ws.reject=qm.reject,ws.remove=Km.remove,ws.rest=$m.rest,ws.reverse=Km.reverse,ws.sampleSize=qm.sampleSize,ws.set=rC.set,ws.setWith=rC.setWith,ws.shuffle=qm.shuffle,ws.slice=Km.slice,ws.sortBy=qm.sortBy,ws.sortedUniq=Km.sortedUniq,ws.sortedUniqBy=Km.sortedUniqBy,ws.split=oC.split,ws.spread=$m.spread,ws.tail=Km.tail,ws.take=Km.take,ws.takeRight=Km.takeRight,ws.takeRightWhile=Km.takeRightWhile,ws.takeWhile=Km.takeWhile,ws.tap=iC.tap,ws.throttle=$m.throttle,ws.thru=om,ws.toArray=Qm.toArray,ws.toPairs=rC.toPairs,ws.toPairsIn=rC.toPairsIn,ws.toPath=aC.toPath,ws.toPlainObject=Qm.toPlainObject,ws.transform=rC.transform,ws.unary=$m.unary,ws.union=Km.union,ws.unionBy=Km.unionBy,ws.unionWith=Km.unionWith,ws.uniq=Km.uniq,ws.uniqBy=Km.uniqBy,ws.uniqWith=Km.uniqWith,ws.unset=rC.unset,ws.unzip=Km.unzip,ws.unzipWith=Km.unzipWith,ws.update=rC.update,ws.updateWith=rC.updateWith,ws.values=rC.values,ws.valuesIn=rC.valuesIn,ws.without=Km.without,ws.words=oC.words,ws.wrap=$m.wrap,ws.xor=Km.xor,ws.xorBy=Km.xorBy,ws.xorWith=Km.xorWith,ws.zip=Km.zip,ws.zipObject=Km.zipObject,ws.zipObjectDeep=Km.zipObjectDeep,ws.zipWith=Km.zipWith,ws.entries=rC.toPairs,ws.entriesIn=rC.toPairsIn,ws.extend=rC.assignIn,ws.extendWith=rC.assignInWith,wC(ws,ws),ws.add=Jm.add,ws.attempt=aC.attempt,ws.camelCase=oC.camelCase,ws.capitalize=oC.capitalize,ws.ceil=Jm.ceil,ws.clamp=tC,ws.clone=Qm.clone,ws.cloneDeep=Qm.cloneDeep,ws.cloneDeepWith=Qm.cloneDeepWith,ws.cloneWith=Qm.cloneWith,ws.conformsTo=Qm.conformsTo,ws.deburr=oC.deburr,ws.defaultTo=aC.defaultTo,ws.divide=Jm.divide,ws.endsWith=oC.endsWith,ws.eq=Qm.eq,ws.escape=oC.escape,ws.escapeRegExp=oC.escapeRegExp,ws.every=qm.every,ws.find=qm.find,ws.findIndex=Km.findIndex,ws.findKey=rC.findKey,ws.findLast=qm.findLast,ws.findLastIndex=Km.findLastIndex,ws.findLastKey=rC.findLastKey,ws.floor=Jm.floor,ws.forEach=qm.forEach,ws.forEachRight=qm.forEachRight,ws.forIn=rC.forIn,ws.forInRight=rC.forInRight,ws.forOwn=rC.forOwn,ws.forOwnRight=rC.forOwnRight,ws.get=rC.get,ws.gt=Qm.gt,ws.gte=Qm.gte,ws.has=rC.has,ws.hasIn=rC.hasIn,ws.head=Km.head,ws.identity=Ba,ws.includes=qm.includes,ws.indexOf=Km.indexOf,ws.inRange=eC,ws.invoke=rC.invoke,ws.isArguments=Qm.isArguments,ws.isArray=pa,ws.isArrayBuffer=Qm.isArrayBuffer,ws.isArrayLike=Qm.isArrayLike,ws.isArrayLikeObject=Qm.isArrayLikeObject,ws.isBoolean=Qm.isBoolean,ws.isBuffer=Qm.isBuffer,ws.isDate=Qm.isDate,ws.isElement=Qm.isElement,ws.isEmpty=Qm.isEmpty,ws.isEqual=Qm.isEqual,ws.isEqualWith=Qm.isEqualWith,ws.isError=Qm.isError,ws.isFinite=Qm.isFinite,ws.isFunction=Qm.isFunction,ws.isInteger=Qm.isInteger,ws.isLength=Qm.isLength,ws.isMap=Qm.isMap,ws.isMatch=Qm.isMatch,ws.isMatchWith=Qm.isMatchWith,ws.isNaN=Qm.isNaN,ws.isNative=Qm.isNative,ws.isNil=Qm.isNil,ws.isNull=Qm.isNull,ws.isNumber=Qm.isNumber,ws.isObject=_a,ws.isObjectLike=Qm.isObjectLike,ws.isPlainObject=Qm.isPlainObject,ws.isRegExp=Qm.isRegExp,ws.isSafeInteger=Qm.isSafeInteger,ws.isSet=Qm.isSet,ws.isString=Qm.isString,ws.isSymbol=Qm.isSymbol,ws.isTypedArray=Qm.isTypedArray,ws.isUndefined=Qm.isUndefined,ws.isWeakMap=Qm.isWeakMap,ws.isWeakSet=Qm.isWeakSet,ws.join=Km.join,ws.kebabCase=oC.kebabCase,ws.last=mf,ws.lastIndexOf=Km.lastIndexOf,ws.lowerCase=oC.lowerCase,ws.lowerFirst=oC.lowerFirst,ws.lt=Qm.lt,ws.lte=Qm.lte,ws.max=Jm.max,ws.maxBy=Jm.maxBy,ws.mean=Jm.mean,ws.meanBy=Jm.meanBy,ws.min=Jm.min,ws.minBy=Jm.minBy,ws.stubArray=aC.stubArray,ws.stubFalse=aC.stubFalse,ws.stubObject=aC.stubObject,ws.stubString=aC.stubString,ws.stubTrue=aC.stubTrue,ws.multiply=Jm.multiply,ws.nth=Km.nth,ws.noop=aC.noop,ws.now=Zm.now,ws.pad=oC.pad,ws.padEnd=oC.padEnd,ws.padStart=oC.padStart,ws.parseInt=oC.parseInt,ws.random=nC,ws.reduce=qm.reduce,ws.reduceRight=qm.reduceRight,ws.repeat=oC.repeat,ws.replace=oC.replace,ws.result=rC.result,ws.round=Jm.round,ws.sample=qm.sample,ws.size=qm.size,ws.snakeCase=oC.snakeCase,ws.some=qm.some,ws.sortedIndex=Km.sortedIndex,ws.sortedIndexBy=Km.sortedIndexBy,ws.sortedIndexOf=Km.sortedIndexOf,ws.sortedLastIndex=Km.sortedLastIndex,ws.sortedLastIndexBy=Km.sortedLastIndexBy,ws.sortedLastIndexOf=Km.sortedLastIndexOf,ws.startCase=oC.startCase,ws.startsWith=oC.startsWith,ws.subtract=Jm.subtract,ws.sum=Jm.sum,ws.sumBy=Jm.sumBy,ws.template=oC.template,ws.times=aC.times,ws.toFinite=Qm.toFinite,ws.toInteger=Ma,ws.toLength=Qm.toLength,ws.toLower=oC.toLower,ws.toNumber=Qm.toNumber,ws.toSafeInteger=Qm.toSafeInteger,ws.toString=Qm.toString,ws.toUpper=oC.toUpper,ws.trim=oC.trim,ws.trimEnd=oC.trimEnd,ws.trimStart=oC.trimStart,ws.truncate=oC.truncate,ws.unescape=oC.unescape,ws.uniqueId=aC.uniqueId,ws.upperCase=oC.upperCase,ws.upperFirst=oC.upperFirst,ws.each=qm.forEach,ws.eachRight=qm.forEachRight,ws.first=Km.head,wC(ws,(cC={},Dd(ws,(function(t,e){gC.call(ws.prototype,e)||(cC[e]=t)})),cC),{chain:!1}),ws.VERSION="4.17.21",(ws.templateSettings=oC.templateSettings).imports._=ws,Bs(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){ws[t].placeholder=ws})),Bs(["drop","take"],(function(t,e){us.prototype[t]=function(n){n=void 0===n?1:mC(Ma(n),0);var r=this.__filtered__&&!e?new us(this):this.clone();return r.__filtered__?r.__takeCount__=CC(n,r.__takeCount__):r.__views__.push({size:CC(n,pC),type:t+(r.__dir__<0?"Right":"")}),r},us.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Bs(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;us.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Od(t),type:n}),e.__filtered__=e.__filtered__||r,e}})),Bs(["head","last"],(function(t,e){var n="take"+(e?"Right":"");us.prototype[t]=function(){return this[n](1).value()[0]}})),Bs(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");us.prototype[t]=function(){return this.__filtered__?new us(this):this[n](1)}})),us.prototype.compact=function(){return this.filter(Ba)},us.prototype.find=function(t){return this.filter(t).head()},us.prototype.findLast=function(t){return this.reverse().find(t)},us.prototype.invokeMap=ll((function(t,e){return"function"==typeof t?new us(this):this.map((function(n){return qp(n,t,e)}))})),us.prototype.reject=function(t){return this.filter(Vv(Od(t)))},us.prototype.slice=function(t,e){t=Ma(t);var n=this;return n.__filtered__&&(t>0||e<0)?new us(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=Ma(e))<0?n.dropRight(-e):n.take(e-t)),n)},us.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},us.prototype.toArray=function(){return this.take(pC)},Dd(us.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=ws[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(ws.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,s=e instanceof us,l=a[0],u=s||pa(e),c=function(t){var e=i.apply(ws,_u([t],a));return r&&h?e[0]:e};u&&n&&"function"==typeof l&&1!=l.length&&(s=u=!1);var h=this.__chain__,d=!!this.__actions__.length,f=o&&!h,p=s&&!d;if(!o&&u){e=p?e:new us(this);var v=t.apply(e,a);return v.__actions__.push({func:om,args:[c],thisArg:void 0}),new gs(v,h)}return f&&p?t.apply(this,a):(v=this.thru(c),f?r?v.value()[0]:v.value():v)})})),Bs(["pop","push","shift","sort","splice","unshift"],(function(t){var e=vC[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);ws.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(pa(i)?i:[],t)}return this[n]((function(n){return e.apply(pa(n)?n:[],t)}))}})),Dd(us.prototype,(function(t,e){var n=ws[e];if(n){var r=n.name+"";gC.call(fs,r)||(fs[r]=[]),fs[r].push({name:e,func:n})}})),fs[Ks(void 0,2).name]=[{name:"wrapper",func:void 0}],us.prototype.clone=function(){var t=new us(this.__wrapped__);return t.__actions__=ys(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ys(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ys(this.__views__),t},us.prototype.reverse=function(){if(this.__filtered__){var t=new us(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},us.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=pa(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function VC(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function XC(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(t=R(t,360),e=R(e,100),n=R(n,100),0===e)r=i=o=n;else{var s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;r=a(l,s,t+1/3),i=a(l,s,t),o=a(l,s,t-1/3)}return{r:255*r,g:255*i,b:255*o}}(t.h,l,c),h=!0,d="hsl"),t.hasOwnProperty("a")&&(o=t.a));var f,p,v;return o=O(o),{ok:h,format:t.format||d,r:a(255,s(i.r,0)),g:a(255,s(i.g,0)),b:a(255,s(i.b,0)),a:o}}(t);this._originalInput=t,this._r=c.r,this._g=c.g,this._b=c.b,this._a=c.a,this._roundA=o(100*this._a)/100,this._format=l.format||c.format,this._gradientType=l.gradientType,this._r<1&&(this._r=o(this._r)),this._g<1&&(this._g=o(this._g)),this._b<1&&(this._b=o(this._b)),this._ok=c.ok,this._tc_id=i++}function c(t,e,n){t=R(t,255),e=R(e,255),n=R(n,255);var r,i,o=s(t,e,n),l=a(t,e,n),u=(o+l)/2;if(o==l)r=i=0;else{var c=o-l;switch(i=u>.5?c/(2-o-l):c/(o+l),o){case t:r=(e-n)/c+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,o.push(u(r));return o}function T(t,e){e=e||6;for(var n=u(t).toHsv(),r=n.h,i=n.s,o=n.v,a=[],s=1/e;e--;)a.push(u({h:r,s:i,v:o})),o=(o+s)%1;return a}u.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,i=this.toRgb();return t=i.r/255,n=i.g/255,r=i.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=O(t),this._roundA=o(100*this._a)/100,this},toHsv:function(){var t=h(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=h(this._r,this._g,this._b),e=o(360*t.h),n=o(100*t.s),r=o(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=c(this._r,this._g,this._b),e=o(360*t.h),n=o(100*t.s),r=o(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return d(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,n,r,i){var a=[B(o(t).toString(16)),B(o(e).toString(16)),B(o(n).toString(16)),B(D(r))];if(i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:o(this._r),g:o(this._g),b:o(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+o(this._r)+", "+o(this._g)+", "+o(this._b)+")":"rgba("+o(this._r)+", "+o(this._g)+", "+o(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:o(100*R(this._r,255))+"%",g:o(100*R(this._g,255))+"%",b:o(100*R(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+o(100*R(this._r,255))+"%, "+o(100*R(this._g,255))+"%, "+o(100*R(this._b,255))+"%)":"rgba("+o(100*R(this._r,255))+"%, "+o(100*R(this._g,255))+"%, "+o(100*R(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(I[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),n=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var i=u(t);n="#"+f(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return u(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(y,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(v,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(b,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(S,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},u.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]="a"===r?t[r]:N(t[r]));t=n}return u(t,e)},u.equals=function(t,e){return!(!t||!e)&&u(t).toRgbString()==u(e).toRgbString()},u.random=function(){return u.fromRatio({r:l(),g:l(),b:l()})},u.mix=function(t,e,n){n=0===n?0:n||50;var r=u(t).toRgb(),i=u(e).toRgb(),o=n/100;return u({r:(i.r-r.r)*o+r.r,g:(i.g-r.g)*o+r.g,b:(i.b-r.b)*o+r.b,a:(i.a-r.a)*o+r.a})},u.readability=function(t,n){var r=u(t),i=u(n);return(e.max(r.getLuminance(),i.getLuminance())+.05)/(e.min(r.getLuminance(),i.getLuminance())+.05)},u.isReadable=function(t,e,n){var r,i,o=u.readability(t,e);switch(i=!1,r=function(t){var e,n;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==n&&"large"!==n&&(n="small");return{level:e,size:n}}(n),r.level+r.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},u.mostReadable=function(t,e,n){var r,i,o,a,s=null,l=0;i=(n=n||{}).includeFallbackColors,o=n.level,a=n.size;for(var c=0;cl&&(l=r,s=u(e[c]));return u.isReadable(t,s,{level:o,size:a})||!i?s:(n.includeFallbackColors=!1,u.mostReadable(t,["#fff","#000"],n))};var L=u.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},I=u.hexNames=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(L);function O(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function R(t,n){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=a(n,s(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function A(t){return a(1,s(0,t))}function M(t){return parseInt(t,16)}function B(t){return 1==t.length?"0"+t:""+t}function N(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function P(t){return M(t)/255}var k,z,F,H=(z="[\\s|\\(]+("+(k="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?",F="[\\s|\\(]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?",{CSS_UNIT:new RegExp(k),rgb:new RegExp("rgb"+z),rgba:new RegExp("rgba"+F),hsl:new RegExp("hsl"+z),hsla:new RegExp("hsla"+F),hsv:new RegExp("hsv"+z),hsva:new RegExp("hsva"+F),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function W(t){return!!H.CSS_UNIT.exec(t)}t.exports?t.exports=u:window.tinycolor=u}(Math)}(KC);var qC,ZC=KC.exports,$C=[95,85,75,30,15,0,15,30,45,60,80],QC=[{fontColorIndex:0,bgColorIndex:3},{fontColorIndex:13,bgColorIndex:8},{fontColorIndex:14,bgColorIndex:1}],JC=function(t){for(var e=[],n=0;n<11;n++){var r=$C[n];e.push(0===r?t.toUpperCase():ZC.mix(t,n<5?"#FFFFFF":"#000000",r).toHexString().toUpperCase())}return e},tw=function(t){var e=Array.from(Array(15)).fill("#FFFFFF"),n=t.basicColorRelations,r=JC(t.brandColor);return n.forEach((function(t){e[t.basicColorIndex]=r[t.standardColorIndex]})),QC.forEach((function(t){var n=t.fontColorIndex,r=t.bgColorIndex;e[n]=ZC(e[r]).getBrightness()>220?"#000000":"#FFFFFF"})),UC(UC({},t),{basicColors:e})},ew=tw({brandColor:"#3471F9",semanticColors:{red:"#FF4D4F",green:"#29A294",yellow:"#FAAD14"},others:{highlight:"#87B5FF",results:"#F0F7FF"},basicColorRelations:[{basicColorIndex:1,standardColorIndex:0},{basicColorIndex:2,standardColorIndex:1},{basicColorIndex:3,standardColorIndex:5},{basicColorIndex:4,standardColorIndex:6},{basicColorIndex:5,standardColorIndex:6},{basicColorIndex:6,standardColorIndex:6},{basicColorIndex:7,standardColorIndex:5},{basicColorIndex:9,standardColorIndex:1},{basicColorIndex:10,standardColorIndex:4},{basicColorIndex:11,standardColorIndex:4},{basicColorIndex:12,standardColorIndex:5}]}),nw={default:tw({brandColor:"#326EF4",semanticColors:{red:"#FF4D4F",green:"#29A294",yellow:"#FAAD14"},others:{highlight:"#87B5FF",results:"#F0F7FF"},basicColorRelations:[{basicColorIndex:1,standardColorIndex:0},{basicColorIndex:2,standardColorIndex:1},{basicColorIndex:3,standardColorIndex:1},{basicColorIndex:4,standardColorIndex:2},{basicColorIndex:5,standardColorIndex:7},{basicColorIndex:6,standardColorIndex:5},{basicColorIndex:7,standardColorIndex:5},{basicColorIndex:9,standardColorIndex:1},{basicColorIndex:10,standardColorIndex:2},{basicColorIndex:11,standardColorIndex:5},{basicColorIndex:12,standardColorIndex:5}]}),colorful:ew,gray:tw({brandColor:"#9DA7B6",semanticColors:{red:"#FF4D4F",green:"#29A294",yellow:"#FAAD14"},others:{highlight:"#87B5FF",results:"#F0F7FF"},basicColorRelations:[{basicColorIndex:1,standardColorIndex:0},{basicColorIndex:2,standardColorIndex:1},{basicColorIndex:3,standardColorIndex:1},{basicColorIndex:4,standardColorIndex:2},{basicColorIndex:5,standardColorIndex:7},{basicColorIndex:6,standardColorIndex:8},{basicColorIndex:7,standardColorIndex:5},{basicColorIndex:9,standardColorIndex:1},{basicColorIndex:10,standardColorIndex:2},{basicColorIndex:11,standardColorIndex:3},{basicColorIndex:12,standardColorIndex:3}]})},rw="Roboto, PingFangSC, BlinkMacSystemFont, Microsoft YaHei, Arial, sans-serif",iw="zh_CN",ow=iw,aw={zh_CN:{"小计":"小计","总计":"总计","总和":"总和","项":"项","已选择":"已选择","序号":"序号","度量":"度量","数值":"数值","共计":"共计","条":"条","趋势":"趋势","隐藏":"隐藏","组内升序":"组内升序","升序":"升序","降序":"降序","组内降序":"组内降序","不排序":"不排序"},en_US:{"小计":"Total","总计":"Total","总和":"SUM","项":"items","已选择":"selected","序号":"Index","度量":"Measure","数值":"Measure","共计":"Total","条":"","隐藏":"Hide","趋势":"Trend","组内升序":"Group ASC","组内降序":"Group DESC","升序":"ASC","降序":"DESC","不排序":"No order"}},sw=function(){return ow},lw=function(t,e){return void 0===e&&(e=t),Su(aw,[ow,t],e)},uw="".concat(Ko,"-tooltip"),cw="".concat(uw,"-container"),hw="".concat(cw,"-show"),dw="".concat(cw,"-hide"),fw="".concat(uw,"-operation"),pw={x:15,y:10},vw=function(){return{key:"hiddenColumns",text:lw("隐藏"),icon:"EyeOutlined"}},gw=function(){return{key:"trend",text:lw("趋势"),icon:"Trend"}},yw=function(){return[{key:"asc",icon:"groupAsc",text:lw("组内升序")},{key:"desc",icon:"groupDesc",text:lw("组内降序")},{key:"none",text:lw("不排序")}]},mw=function(){return[{key:"asc",icon:"groupAsc",text:lw("升序")},{key:"desc",icon:"groupDesc",text:lw("降序")},{key:"none",text:lw("不排序")}]};t.CopyType=void 0,(qC=t.CopyType||(t.CopyType={}))[qC.ALL=0]="ALL",qC[qC.COL=1]="COL",qC[qC.ROW=2]="ROW";function Cw(t){return"mobile"===t||/(iPhone|iPad|SymbianOS|Windows Phone|iPod|iOS|Android)/i.test(navigator.userAgent)}function ww(){return/iPhone/gi.test(navigator.userAgent)&&812===window.screen.height&&375===window.screen.width}function xw(){return/windows/i.test(navigator.userAgent)}var Sw=function(t){return nw[(t||"default").toLowerCase()]},Ew=function(t){var e,n,r,i,o,a,s,l=(null==t?void 0:t.palette)||Sw(null==t?void 0:t.name),u=l.basicColors,c=l.semanticColors,h=l.others,d=null===(e=null==t?void 0:t.spreadsheet)||void 0===e?void 0:e.isTableMode();return{cornerCell:{bolderText:{fontFamily:rw,fontSize:12,fontWeight:xw()?"bold":500,fill:u[0],opacity:1,textAlign:d?"center":"left",textBaseline:"middle"},text:{fontFamily:rw,fontSize:12,fontWeight:xw()?"bold":500,fill:u[0],opacity:1,textAlign:"right",textBaseline:"middle"},cell:{backgroundColor:u[3],backgroundColorOpacity:1,horizontalBorderColor:u[10],horizontalBorderColorOpacity:1,verticalBorderColor:u[10],verticalBorderColorOpacity:1,horizontalBorderWidth:1,verticalBorderWidth:1,padding:{top:0,right:8,bottom:0,left:8}},icon:{fill:u[0],size:10,margin:{right:4,left:4}}},rowCell:{seriesText:{fontFamily:rw,fontSize:12,fontWeight:"normal",fill:u[14],linkTextFill:u[6],opacity:1,textBaseline:"middle",textAlign:"center"},measureText:{fontFamily:rw,fontSize:12,fontWeight:"normal",fill:u[14],linkTextFill:u[6],opacity:1,textAlign:d?"center":"left",textBaseline:"top"},bolderText:{fontFamily:rw,fontSize:12,fontWeight:xw()?"bold":500,fill:u[14],linkTextFill:u[6],opacity:1,textAlign:d?"center":"left",textBaseline:"top"},text:{fontFamily:rw,fontSize:12,fontWeight:"normal",fill:u[14],linkTextFill:u[6],opacity:1,textBaseline:"top",textAlign:d?"center":"left"},cell:{backgroundColor:u[1],backgroundColorOpacity:1,horizontalBorderColor:u[9],horizontalBorderColorOpacity:1,verticalBorderColor:u[9],verticalBorderColorOpacity:1,horizontalBorderWidth:1,verticalBorderWidth:1,padding:{top:0,right:8,bottom:0,left:8},interactionState:{hover:{backgroundColor:u[2],backgroundOpacity:.6},selected:{backgroundColor:u[2],backgroundOpacity:.6},unselected:{backgroundOpacity:.3,textOpacity:.3,opacity:.3},prepareSelect:{borderColor:u[14],borderOpacity:1,borderWidth:1},searchResult:{backgroundColor:null!==(n=null==h?void 0:h.results)&&void 0!==n?n:u[2],backgroundOpacity:1},highlight:{backgroundColor:null!==(r=null==h?void 0:h.highlight)&&void 0!==r?r:u[6],backgroundOpacity:1}}},icon:{fill:u[14],size:10,margin:{right:4,left:4}},seriesNumberWidth:80},colCell:{measureText:{fontFamily:rw,fontSize:12,fontWeight:"normal",fill:u[0],opacity:1,textAlign:"right",textBaseline:"middle"},bolderText:{fontFamily:rw,fontSize:12,fontWeight:xw()?"bold":500,fill:u[0],opacity:1,textAlign:"center",textBaseline:"middle"},text:{fontFamily:rw,fontSize:12,fontWeight:"normal",fill:u[0],opacity:1,textAlign:"center",textBaseline:"middle"},cell:{backgroundColor:u[3],backgroundColorOpacity:1,horizontalBorderColor:u[10],horizontalBorderColorOpacity:1,verticalBorderColor:u[10],verticalBorderColorOpacity:1,horizontalBorderWidth:1,verticalBorderWidth:1,padding:{top:0,right:8,bottom:0,left:8},interactionState:{hover:{backgroundColor:u[4],backgroundOpacity:.6},selected:{backgroundColor:u[4],backgroundOpacity:.6},unselected:{backgroundOpacity:.3,textOpacity:.3,opacity:.3},prepareSelect:{borderColor:u[14],borderOpacity:1,borderWidth:1},searchResult:{backgroundColor:null!==(i=null==h?void 0:h.results)&&void 0!==i?i:u[2],backgroundOpacity:1},highlight:{backgroundColor:null!==(o=null==h?void 0:h.highlight)&&void 0!==o?o:u[6],backgroundOpacity:1}}},icon:{fill:u[0],size:10,margin:{top:6,right:4,bottom:6,left:4}}},dataCell:{bolderText:{fontFamily:rw,fontSize:12,fontWeight:xw()?"bold":500,fill:u[13],opacity:1,textAlign:"right",textBaseline:"middle"},text:{fontFamily:rw,fontSize:12,fontWeight:"normal",fill:u[13],opacity:1,textAlign:"right",textBaseline:"middle"},cell:{crossBackgroundColor:u[1],backgroundColor:u[8],backgroundColorOpacity:1,horizontalBorderColor:u[9],horizontalBorderColorOpacity:1,verticalBorderColor:u[9],verticalBorderColorOpacity:1,horizontalBorderWidth:1,verticalBorderWidth:1,padding:{top:8,right:8,bottom:8,left:8},interactionState:{hover:{backgroundColor:u[2],backgroundOpacity:.6},hoverFocus:{backgroundColor:u[2],backgroundOpacity:.6,borderColor:u[14],borderWidth:1,borderOpacity:1},selected:{backgroundColor:u[2],backgroundOpacity:.6},unselected:{backgroundOpacity:.3,textOpacity:.3,opacity:.3},searchResult:{backgroundColor:null!==(a=null==h?void 0:h.results)&&void 0!==a?a:u[2],backgroundOpacity:1},highlight:{backgroundColor:null!==(s=null==h?void 0:h.highlight)&&void 0!==s?s:u[6],backgroundOpacity:1},prepareSelect:{borderColor:u[14],borderOpacity:1,borderWidth:1}}},miniChart:{line:{point:{size:2.2,fill:u[6],opacity:1},linkLine:{size:1.5,fill:u[6],opacity:.6}},bar:{intervalPadding:4,fill:u[6],opacity:1},bullet:{progressBar:{widthPercent:.6,height:10,innerHeight:6},comparativeMeasure:{width:1,height:12,fill:u[13],opacity:.25},rangeColors:{good:null==c?void 0:c.green,satisfactory:c.yellow,bad:c.red},backgroundColor:"#E9E9E9"},interval:{height:12,fill:u[7]}},icon:{fill:u[13],downIconColor:c.red,upIconColor:c.green,size:10,margin:{right:4,left:4}}},resizeArea:{size:3,background:u[7],backgroundOpacity:0,guideLineColor:u[7],guideLineDisableColor:"rgba(0,0,0,0.25)",guideLineDash:[3,3],interactionState:{hover:{backgroundColor:u[7],backgroundOpacity:1}}},scrollBar:{trackColor:"rgba(0,0,0,0.01)",thumbHoverColor:"rgba(0,0,0,0.25)",thumbColor:"rgba(0,0,0,0.15)",size:Cw()?3:6,hoverSize:Cw()?4:8,lineCap:"round"},splitLine:{horizontalBorderColor:u[12],horizontalBorderColorOpacity:.2,horizontalBorderWidth:2,verticalBorderColor:u[11],verticalBorderColorOpacity:.25,verticalBorderWidth:2,showShadow:!0,shadowWidth:8,shadowColors:{left:"rgba(0,0,0,0.1)",right:"rgba(0,0,0,0)"}},prepareSelectMask:{backgroundColor:u[5],backgroundOpacity:.3},background:{color:u[8],opacity:1}}},_w=function(){function t(t){this.x=0,this.y=0,this.width=0,this.height=0,this.colIndex=-1,this.level=0,this.isLeaf=!1,this.children=[],this.padding=0;var e=t.id,n=t.key,r=t.value,i=t.label,o=t.parent,a=t.level,s=t.rowIndex,l=t.isTotals,u=t.isGrandTotals,c=t.isSubTotals,h=t.isCollapsed,d=t.hierarchy,f=t.isPivotMode,p=t.seriesNumberWidth,v=t.field,g=t.spreadsheet,y=t.query,m=t.belongsCell,C=t.inCollapseNode,w=t.isTotalMeasure,x=t.isLeaf,S=t.extra;this.id=e,this.key=n,this.value=r,this.label=i||r,this.parent=o,this.level=a,this.rowIndex=s,this.isTotals=l,this.isCollapsed=h,this.hierarchy=d,this.isPivotMode=f,this.seriesNumberWidth=p,this.field=v,this.spreadsheet=g,this.query=y,this.belongsCell=m,this.inCollapseNode=C,this.isTotalMeasure=w,this.isLeaf=x,this.isGrandTotals=u,this.isSubTotals=c,this.config={x:0,y:0,width:0,height:0,colIndex:-1,children:[],padding:0,id:"",key:"",value:"",label:""},this.extra=S}return t.getFieldPath=function(t,e){if(t&&!t.isTotals||t&&e){for(var n=t.parent,r=[t.field];n&&n.id!==Wo;)r.push(n.field),n=n.parent;return r.reverse()}return[]},t.getAllLeaveNodes=function(t){var e=[];if(t.isLeaf)return[t];for(var n=XC([],VC(t.children),!1),r=n.shift();r;)r.isLeaf?e.push(r):n.unshift.apply(n,XC([],VC(r.children),!1)),r=n.shift();return e},t.getAllChildrenNodes=function(t){var e=[];if(t.isLeaf)return[t];for(var n=XC([],VC(t.children||[]),!1),r=n.shift();r;)e.push(r),n.unshift.apply(n,XC([],VC(r.children),!1)),r=n.shift();return e},t.getAllBranch=function(t){for(var e=[],n=this.getAllLeaveNodes(t),r=n.shift(),i=[];r;){i.unshift(r);for(var o=r.parent;o&&!av(o,t);)i.unshift(o),o=o.parent;e.push(i),r=n.shift(),i=[]}return e},t.blankNode=function(){return new t({id:"",key:"",value:""})},t.rootNode=function(){return new t({id:"root",key:"",value:""})},t.prototype.toJSON=function(){return Jv(this,["config","hierarchy","parent","spreadsheet"])},t}(),bw=function(){function t(){this.width=0,this.height=0,this.maxLevel=-1,this.sampleNodesForAllLevels=[],this.sampleNodeForLastLevel=null,this.allNodesWithoutRoot=[],this.indexNode=[]}return t.prototype.getLeaves=function(){return this.allNodesWithoutRoot.filter((function(t){return t.isLeaf}))},t.prototype.getNodes=function(t){return void 0!==t?this.allNodesWithoutRoot.filter((function(e){return e.level===t})):this.allNodesWithoutRoot},t.prototype.getNodesLessThanLevel=function(t){return this.allNodesWithoutRoot.filter((function(e){return e.level<=t}))},t.prototype.pushNode=function(t,e){void 0===e&&(e=-1),-1===e?this.allNodesWithoutRoot.push(t):this.allNodesWithoutRoot.splice(e,0,t)},t.prototype.pushIndexNode=function(t){this.indexNode.push(t)},t.prototype.getIndexNodes=function(){return this.indexNode},t}(),Tw=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1),this.label=t,this.isSubTotals=e,this.isGrandTotals=n};function Lw(t,e){for(var n={},r=t;r&&r.key;)r.isTotals&&!e||(n[r.key]=r.value),r=r.parent;return n}var Iw=function(t,e,n,r){return e.layoutArrange?e.layoutArrange(e.spreadsheet,n,r,t):t},Ow=function(t,e,n,r){var i=!0,o=function(t,n,i){void 0===n&&(n=-1),void 0===i&&(i=-1),-1===n?(e.children.push(t),r.pushNode(t)):(e.children.splice(n,0,t),r.pushNode(t,i))};if(t.layoutHierarchy){var a=t.layoutHierarchy(t.spreadsheet,n);if(a){var s=!!ev(null==a?void 0:a.delete)&&(null==a?void 0:a.delete);i=!s;var l=a.push,u=a.unshift,c=e.children.length,h=r.getNodes().length;ov(u)||(Tf(u,(function(t){o(t)})),c=e.children.length,h=r.getNodes().length),ov(l)||Tf(l,(function(t){o(t)})),s||o(n,c,h)}else o(n)}else o(n);return i},Rw=function(t,e,n){(null==t?void 0:t.layoutCoordinate)&&((null==e?void 0:e.isLeaf)||(null==n?void 0:n.isLeaf))&&(null==t||t.layoutCoordinate(t.spreadsheet,e,n))},Aw=function(t){this.label=t},Mw=function(t){var e,n=t.addTotalMeasureInTotal,r=t.addMeasureInTotalQuery,i=t.parentNode,o=t.currentField,a=t.fields,s=t.facetCfg,l=t.hierarchy,u=a.indexOf(o),c=s.dataSet,h=s.values,d=s.spreadsheet,f=[],p={};if(i.isTotals)n&&(p=Lw(i.parent,!0),f.push.apply(f,XC([],VC(h.map((function(t){return new Aw(t)}))),!1)));else{p=Lw(i,!0);var v=c.getDimensionValues(o,p),g=Iw(v,s,i,o);f.push.apply(f,XC([],VC(g||[]),!1));var y=c.getFieldName(o);ov(f)&&(o===fo?f.push.apply(f,XC([],VC(null===(e=c.fields)||void 0===e?void 0:e.values),!1)):f.push(y)),function(t,e,n){var r,i,o,a,s=null!==(a=null===(o=n.colCfg)||void 0===o?void 0:o.hideMeasureColumn)&&void 0!==a&&a,l=n.dataSet.fields.valueInCols;try{for(var u=jC(t),c=u.next();!c.done;c=u.next()){var h=c.value;s&&l&&e===fo&&t.splice(t.indexOf(h),1)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}(f,o,s),function(t){var e,n,r,i=t.isFirstField,o=t.currentField,a=t.fieldValues,s=t.spreadsheet,l=t.lastField,u=s.getTotalsConfig(i?o:l);i?(null==u?void 0:u.showGrandTotals)&&(n=u.reverseLayout?"unshift":"push",r=new Tw(u.label,!1,!0)):(null==u?void 0:u.showSubTotals)&&(ws.size(a)>1||!1!==ws.get(u,"showSubTotals.always"))&&o!==fo&&(n=u.reverseSubLayout?"unshift":"push",r=new Tw(u.subLabel,!0)),null===(e=a[n])||void 0===e||e.call(a,r)}({currentField:o,lastField:a[u-1],isFirstField:0===u,fieldValues:f,spreadsheet:d})}var m=d.store.get("hiddenColumnsDetail"),C=function(t){for(var e=t.getColumnLeafNodes(),n=new Set,r=0;r1)return!1;return 1===n.size}(d),w=f.filter((function(t){return!gv(t)&&(!!ov(m)||m.every((function(e){return e.hideColumnNodes.every((function(e){var n=e.field===fo,r=e.field===po;return n||r||C?e.parent.id!==i.id&&e.parent.value!==t:e.value!==t}))})))}));Nw({currentField:o,fields:a,fieldValues:w,facetCfg:s,hierarchy:l,parentNode:i,level:u,query:p,addMeasureInTotalQuery:r,addTotalMeasureInTotal:n})},Bw=function(t,e){return"".concat(t).concat(Go).concat(e)},Nw=function(t){var e,n,r,i,o,a,s,l,u,c=t.currentField,h=t.fields,d=t.fieldValues,f=t.facetCfg,p=t.hierarchy,v=t.parentNode,g=t.level,y=t.query,m=t.addMeasureInTotalQuery,C=t.addTotalMeasureInTotal,w=f.spreadsheet,x=f.collapsedCols,S=f.colCfg;try{for(var E=jC(d.entries()),_=E.next();!_.done;_=E.next()){var b=VC(_.value,2),T=b[0],L=b[1],I=L instanceof Tw,O=L instanceof Aw,R=void 0,A=void 0,M=!1,B=!1,N=!1,D=c;if(I){var P=L;B=P.isGrandTotals,N=P.isSubTotals,R=lw(L.label),m?(A=UC(UC({},y),((r={})[fo]=null===(s=null==w?void 0:w.dataSet)||void 0===s?void 0:s.fields.values[0],r)),M=!0):(A=y,C||(M=!0))}else if(O)R=lw(L.label),A=UC(UC({},y),((i={})[fo]=R,i)),D=fo,M=!0;else if(w.isTableMode())R=L,D=h[T],A=UC(UC({},y),((o={})[D]=R,o)),M=!0;else{R=L,A=UC(UC({},y),((a={})[c]=R,a));var k=null===(u=null===(l=w.dataCfg.fields)||void 0===l?void 0:l.valueInCols)||void 0===u||u,z=(null==S?void 0:S.hideMeasureColumn)&&k&&Op(h,fo)?2:1;M=g===h.length-z}var F=Bw(v.id,R);if(!F)return;var H=!!ev(null==x?void 0:x[F])&&(null==x?void 0:x[F]),W=new _w({id:F,key:D,value:R,level:g,field:D,parent:v,isTotals:I,isGrandTotals:B,isSubTotals:N,isTotalMeasure:O,isCollapsed:H,hierarchy:p,query:A,spreadsheet:w,isLeaf:M||H}),G=Ow(f,v,W,p);!(g>p.maxLevel)||B||v.isGrandTotals||v.isSubTotals||W.isSubTotals||(p.sampleNodesForAllLevels.push(W),p.sampleNodeForLastLevel=W,p.maxLevel=g),M||H||!G?(W.isLeaf=!0,p.pushIndexNode(W),W.rowIndex=p.getIndexNodes().length-1):Mw({addTotalMeasureInTotal:C,addMeasureInTotalQuery:m,parentNode:W,currentField:h[g+1],fields:h,facetCfg:f,hierarchy:p})}}catch(t){e={error:t}}finally{try{_&&!_.done&&(n=E.return)&&n.call(E)}finally{if(e)throw e.error}}},Dw=function(t){var e=t.facetCfg,n=t.hierarchy,r=t.parentNode,i=e.columns,o=e.spreadsheet,a=e.dataSet,s=o.store.get("hiddenColumnsDetail"),l=null==e?void 0:e.showSeriesNumber,u=i.filter((function(t){return!s||s.every((function(e){return e.hideColumnNodes.every((function(e){return e.field!==t}))}))})),c=XC([],VC(u),!1),h=op(u,(function(t){return a.getFieldName(t)}));l&&(c.unshift(go),h.unshift(lw("序号"))),Nw({currentField:c[0],fields:c,fieldValues:h,facetCfg:e,hierarchy:n,parentNode:r,level:0,query:{},addMeasureInTotalQuery:!1,addTotalMeasureInTotal:!1})},Pw="Transform Data",kw="Header Layout",zw="Data Cell Render",Fw=function(){function t(){var t=this;this.debug=!1,this.debugCallback=function(e,n){if(t.debug){var r=performance.now();n();var i=performance.now();console.log(e,"".concat(i-r," ms"))}else n()},this.logger=function(e){for(var n=[],r=1;r\n\n \n \n \n\n',ArrowUp:'\n\n \n \n \n\n\n',CellDown:'\n\n \x3c!-- Generator: Sketch 58 (84663) - https://sketch.com --\x3e\n down\n Created with Sketch.\n \n \n \n',CellUp:'\n\n \x3c!-- Generator: Sketch 58 (84663) - https://sketch.com --\x3e\n up\n Created with Sketch.\n \n \n \n ',GlobalAsc:'\n\n \n\n\n',GlobalDesc:'\n \n \n \n \n',GroupAsc:'\n \n \n \n \n',GroupDesc:'\n \n \n \n \n',GroupNone:'\n\n \n \n \n \n \n \n \n \n q\n\n',Minus:'\n\t\n\t\t\n\t\n\t\n\t\n\t\n\t\n',Plus:'\n\t\n\t\t\n\t\n\t\n\t\n\t\n\t\n',SortDown:'\n \n \n \n \n\n',SortUp:'\n \n \n \n \n\n',SortDownSelected:'\n \n \n \n \n\n',SortUpSelected:'\n\n\n\n\n\n',InfoCircle:'',ExpandColIcon:'\n\n 编组 8备份 3\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',Trend:'',DrillDownIcon:'\n',EyeOutlined:''}),Ww={},Gw=function(t,e){Ww[bv(t)]=e},Uw=function(t){return Ww[bv(t)]};Wl(Hw).forEach((function(t){Gw(t,Hw[t])}));var Yw,jw,Vw,Xw="/g,">")),s=s.replace(Xw,"".concat(Xw,' fill="').concat(n,'"')),a.src="data:image/svg+xml;utf-8,".concat(encodeURIComponent(s)))}))},e.prototype.render=function(){var t=this,n=this.cfg,r=n.name,i=n.fill,o=Jh(this.cfg),a=UC(UC({},Jv(o,"fill")),{type:e.type}),s=new Ai({attrs:a}),l="".concat(r,"-").concat(i),u=Kw[l];u?(s.attr("img",u),this.addShape("image",s)):this.getImage(r,l,i).then((function(e){s.attr("img",e),t.addShape("image",s)})).catch((function(t){console.warn("GuiIcon ".concat(r," load error"),t)})),this.iconImageShape=s},e.type="__GUI_ICON__",e}(xi);t.CellBorderPosition=void 0,(Yw=t.CellBorderPosition||(t.CellBorderPosition={})).TOP="TOP",Yw.BOTTOM="BOTTOM",Yw.LEFT="LEFT",Yw.RIGHT="RIGHT",t.Aggregation=void 0,(jw=t.Aggregation||(t.Aggregation={})).SUM="SUM",jw.MIN="MIN",jw.MAX="MAX",jw.AVG="AVG",t.CornerNodeType=void 0,(Vw=t.CornerNodeType||(t.CornerNodeType={})).Row="row",Vw.Col="col",Vw.Series="series";var Zw=function(){function t(){this.store=new Map}return t.prototype.set=function(t,e){return this.store.set(t,e)},t.prototype.get=function(t,e){var n;return null!==(n=this.store.get(t))&&void 0!==n?n:e},t.prototype.clear=function(){this.store.clear()},t.prototype.size=function(){return this.store.size},t}(),$w=function(t,e,n){return t.sort((function(t,r){n&&(t=n(t),r=n(r));var i=e.indexOf(t),o=e.indexOf(r);return-1===i&&-1===o?0:-1===i?1:-1===o?-1:i-o}))},Qw=function(t){return Xf(t,(function(t){return!gv(t)&&"undefined"!==t}))},Jw=function(t){var e;return null===(e=Wl(t))||void 0===e?void 0:e.reduce((function(e,n){var r=Su(t,n);return Array.isArray(r)?e=e.concat(Jw(r)):null==e||e.push(r),e}),[])},tx=function(t){var e=[];if(Array.isArray(t))for(var n=("undefined"in t),r=t.length+(n?1:0),i=0,o=function(){var n=i===t.length?t[void 0]:t[i];i++,n&&"undefined"in n?Wl(n).forEach((function(t){e.push(n[t])})):Array.isArray(n)?e.push.apply(e,XC([],VC(n),!1)):e.push(n)};i0})))return t;var r=UC({},t);r.frozenColCount>=e&&(r.frozenColCount=e);var i=e-r.frozenColCount;r.frozenTrailingColCount>i&&(r.frozenTrailingColCount=i),r.frozenRowCount>=n&&(r.frozenRowCount=n);var o=n-r.frozenRowCount;return r.frozenTrailingRowCount>o&&(r.frozenTrailingRowCount=o),r};function sx(t,e,n){var r;return null===(r=null==t?void 0:t.addShape)||void 0===r?void 0:r.call(t,"rect",UC({zIndex:1,attrs:e},n||{}))}function lx(t,e){var n;return null===(n=null==t?void 0:t.addShape)||void 0===n?void 0:n.call(t,"polygon",{attrs:e})}function ux(t,e){var n;return null===(n=null==t?void 0:t.addShape)||void 0===n?void 0:n.call(t,"polyline",{attrs:e})}function cx(t,e){var n;return null===(n=null==t?void 0:t.addShape)||void 0===n?void 0:n.call(t,"circle",{attrs:e})}function hx(t,e,n,r,i,o,a){var s;return!ov(e)&&t&&Tf(e,(function(e){t.contain(e)&&t.removeChild(e,!0)})),null===(s=null==t?void 0:t.addShape)||void 0===s?void 0:s.call(t,"text",{attrs:UC(UC({x:n,y:r,text:i},o),a)})}function dx(t,e,n){var r;return null===(r=null==t?void 0:t.addShape)||void 0===r?void 0:r.call(t,"line",{zIndex:100,attrs:UC(UC({},e),n)})}function fx(t,e,n){t&&Ey(t,"attrs.".concat(e),n)}function px(t,e){var n=new qw(e);return null==t||t.add(n),n}function vx(t,e,n,r,i){var o=new qw(UC(UC({name:r?"Plus":"Minus"},e),{fill:n}));return Na(i)&&o.on("click",i),null==t||t.add(o),o}var gx="s2-offscreen-canvas",yx=function(t){var e;return null!==(e=null==t?void 0:t.position)&&void 0!==e?e:"right"},mx=function(e,n){var r,i,o,a=e.data,s=e.encode,l=e.type,u=n.getMeta(),c=u.x,h=u.y,d=u.height,f=u.width,p=n.getStyle(t.CellTypes.DATA_CELL),v=p.cell,g=p.miniChart,y=[],m=op(a,(function(t){return y.push(null==t?void 0:t[s.y]),{x:t[s.x],y:t[s.y]}})),C=Bv(y),w=Uv(y),x=C-w,S=c+v.padding.left,E=c+f-v.padding.right,_=h+v.padding.top,b=h+d-v.padding.bottom,T=b-_,L=l===t.MiniChartTypes.Bar?(E-S-(y.length-1)*(null===(r=null==g?void 0:g.bar)||void 0===r?void 0:r.intervalPadding))/y.length+(null===(i=null==g?void 0:g.bar)||void 0===i?void 0:i.intervalPadding):null!==(o=(E-S)/(y.length-1))&&void 0!==o?o:0,I=[],O=op(m,(function(e,n){var r,i,o=S+n*L;if(i=0!==x?b-((null==e?void 0:e.y)-w)/x*T:w>0?_:b,l===t.MiniChartTypes.Bar){var a=void 0,s=void 0;w<0&&C>0&&0!==x?(a=b-(0-w)/x*T,s=Math.abs(i-a),(null==e?void 0:e.y)<0&&(i=a)):(a=w<0?_:b,s=0===(x=Bv([Math.abs(C),Math.abs(w)]))?T:Math.abs((null==e?void 0:e.y)-0)/x*T,i=a);var u=L-(null===(r=null==g?void 0:g.bar)||void 0===r?void 0:r.intervalPadding);I.push([u,s])}return[o,i]}));return{points:O,box:I}},Cx=function(e,n){if(!ov(null==e?void 0:e.data)&&!ov(n)){var r=n.getStyle(t.CellTypes.DATA_CELL).miniChart.line,i=r.point,o=r.linkLine,a=mx(e,n).points;ux(n,{points:a,stroke:o.fill,lineWidth:o.size,opacity:o.opacity});for(var s=0;s.1&&r<=.2?n.satisfactory:n.bad},Sx=function(t,e){var n,r;void 0===e&&(e={min:0,max:0});var i=Number(t);if(Number.isNaN(i))return t;var o=null!==(n=null==e?void 0:e.min)&&void 0!==n?n:e,a=null!==(r=null==e?void 0:e.max)&&void 0!==r?r:e;return new Intl.NumberFormat("en-US",{minimumFractionDigits:o,maximumFractionDigits:a,useGrouping:!1,style:"percent"}).format(i)},Ex=function(t){var e,n,r,i,o,a;if(!ov(t)){var s=t.getCellArea(),l=s.x,u=s.y,c=s.height,h=s.width,d=t.findFieldCondition(null===(e=t.cellConditions)||void 0===e?void 0:e.interval);if(d&&d.mapping){var f=t.mappingValue(d);if(!f)return;var p=f.isCompare?f:t.valueRangeByField,v=ox(p.minValue),g=ox(p.maxValue),y=ox(t.getMeta().fieldValue);if(yg)return;var m=null!==(r=null===(n=t.getStyle().miniChart.interval)||void 0===n?void 0:n.height)&&void 0!==r?r:t.getStyle().cell.miniBarChartHeight,C=null!==(o=null===(i=t.getStyle().miniChart.interval)||void 0===i?void 0:i.fill)&&void 0!==o?o:t.getStyle().cell.miniBarChartFillColor,w=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),t=ox(t),e=ox(e);var n=t>=0,r=e>=0&&t<=0,i=r?0:n?t:e,o=e-t;return function(e){var a=n?0:1;return{zeroScale:r?eh(Math.abs(0-t)/o,0,1):a,scale:eh((e-i)/o,-1,1)}}}(v,g),x=w(y);return sx(t,{x:l+h*x.zeroScale,y:u+c/2-m/2,width:h*x.scale,height:m,fill:null!==(a=f.fill)&&void 0!==a?a:C})}}},_x=function(e,n){var r;if(!ov(e)){var i=n.getStyle(t.CellTypes.DATA_CELL),o=i.miniChart.bullet,a=n.getMeta(),s=a.x,l=a.y,u=a.height,c=a.width,h=a.spreadsheet,d=o.progressBar,f=o.comparativeMeasure,p=o.rangeColors,v=o.backgroundColor,g=e.measure,y=e.target,m=Math.max(Number(g),0),C=Math.max(Number(y),0),w=Sx(g,2),x=(null==d?void 0:d.widthPercent)>1?(null==d?void 0:d.widthPercent)/100:null==d?void 0:d.widthPercent,S=i.cell.padding,E=c-S.left-S.right,_=x*E,b=E-_,T=s+c-S.right-_,L=l+u/2-d.height/2;sx(n,{x:T,y:L,width:_,height:d.height,fill:v,textBaseline:i.text.textBaseline});var I=Su(n.getMeta(),"spreadsheet.options.bullet.getRangeColor"),O=Math.max(Math.min(_*m,_),0);sx(n,{x:T,y:L+(d.height-d.innerHeight)/2,width:O,height:d.innerHeight,fill:null!==(r=null==I?void 0:I(m,C))&&void 0!==r?r:xx(m,C,p)});var R=T+_*C;dx(n,{x1:R,y1:l+(u-f.height)/2,x2:R,y2:l+(u-f.height)/2+f.height},{stroke:(null==f?void 0:f.fill)||(null==f?void 0:f.color),lineWidth:f.width,opacity:null==f?void 0:f.opacity}),hx(n,[],T-S.right,l+u/2,zx({measureTextWidth:h.measureTextWidth,text:w,maxWidth:b-S.right,fontParam:i.text}),i.text)}},bx=function(e,n){switch(null==n?void 0:n.type){case t.MiniChartTypes.Line:Cx(n,e);break;case t.MiniChartTypes.Bar:wx(n,e);break;default:_x(n,e)}},Tx=function(t,e){var n=t.x,r=t.y,i=t.width,o=t.height,a=i-(null==e?void 0:e.left)-(null==e?void 0:e.right),s=o-(null==e?void 0:e.top)-(null==e?void 0:e.bottom);return{x:n+(null==e?void 0:e.left),y:r+(null==e?void 0:e.top),width:a,height:s}},Lx=function(t){return zv({size:0,position:"right",margin:{left:0,right:0}},t)},Ix=function(t,e){return t-(e=Lx(e)).size-e.margin.right-e.margin.left},Ox=function(t,e,n){var r=t.y,i=t.height;void 0===n&&(n=0);var o=0;switch(e){case"top":o=r;break;case"middle":o=r+i/2-n/2;break;default:o=r+i-n}return o},Rx=function(t,e,n,r,i){void 0===n&&(n=0),void 0===i&&(i=1);var o,a,s=t.x,l=t.width,u=e.textAlign,c=e.textBaseline,h=Lx(r),d=h.size,f=h.margin,p=h.position,v=i*(d+f.left)+(i?f.right:0);switch(u){case"left":o=s+("left"===p?v:0),a=s+("left"===p?f.left:n+f.left);break;case"center":var g=s+l/2-(v-("left"===p?f.left:f.right)+n)/2;o=g+n/2+("left"===p?v-f.left:0),a=g+("left"===p?0:n+f.left);break;default:o=s+l-("right"===p?v:0),a=s+l-("right"===p?v-f.left:n+v-f.left)}return{text:{x:o,y:Ox(t,c,0)},icon:{x:a,y:Ox(t,c,d)}}},Ax=function(t,e){return Rx(t,e).text},Mx=function(t,e,n){var r,i,o=e.start+e.width,a=t.start+t.width;if(e.start<=t.start&&o>=a)r=t.start+t.width/2,i=t.width;else if(e.start<=t.start){r=(s=e.width-(t.start-e.start))=a){var s;r=(s=e.width-(o-a))0?t.width/2:i/2;return"left"===r?o-a:o+a-n},Px=fu((function(t,e){if(void 0===t&&(t=""),!e)return 0;var n,r=(n=document.getElementById(gx),n||((n=document.createElement("canvas")).id=gx,n.style.display="none",document.body.appendChild(n),n)).getContext("2d"),i=e,o=i.fontSize,a=i.fontFamily,s=i.fontWeight,l=i.fontStyle,u=i.fontVariant;return r.font=[l,u,s,"".concat(o,"px"),a].join(" ").trim(),r.measureText("".concat(t)).width}),(function(t,e){return XC([t],VC(Lp(e)),!1).join("")})),kx=function(t,e,n,r){var i,o=t("...",r);i=bp(e)?e:mu(e);var a,s,l=n,u=[];if(t(e,r)<=n)return e;for(var c=!0;c;){if((s=t(a=i.substr(0,16),r))+o>l&&s>l){c=!1;break}if(u.push(a),l-=s,!(i=i.substr(16)))return u.join("")}for(var h=!0;h;){if((s=t(a=i.substr(0,1),r))+o>l){h=!1;break}if(u.push(a),l-=s,!(i=i.substr(1)))return u.join("")}return"".concat(u.join(""),"...")},zx=function(t){var e=t.measureTextWidth,n=t.text,r=t.maxWidth,i=t.fontParam,o=t.priorityParam,a=t.placeholder,s={},l=null!=a?a:Uo,u=dv(n)||""===n?l:"".concat(n),c=o;if(i&&pa(i)?c=i:s=i||{},!c||!c.length)return kx(e,u,r,s);var h=[],d=[u];c.forEach((function(t){d.forEach((function(e,n){var r=-1,i=e.match(new RegExp(t));if(i){var o=i[0];r=i.index,h.push(o);var a=r+o.length,s=[e.slice(0,r),e.slice(a)].filter((function(t){return!!t}));d.splice.apply(d,XC([n,1],VC(s),!1))}}))})),d=h.concat(d);var f=u,p=e("...",s),v=r;return d.forEach((function(t){if(v<=0){var n=f.indexOf(t),r=f.slice(n-3,n);if(r&&"..."!==r){var i=e(t,s);f=f.replace(t,i>p?"...":t)}else f=f.replace(t,"");v-=p}else{i=e(t,s);if(vp){var o=kx(e,t,v,s);f=f.replace(t,o),v=0}else v-=i}})),f},Fx=function(t,e,n,r){void 0===r&&(r="left");var i=e.right,o=e.left,a=n||0;return"left"===r?t+i/2+a:"right"===r?t-i/2-a:t+o/2+a},Hx=function(t){var e=t.rowIndex,n=t.colIndex,r=t.meta,i=t.data,o=t.textStyle,a=t.textCondition,s=o.fill;return(null==a?void 0:a.mapping)&&(s=null==a?void 0:a.mapping(i,{rowIndex:e,colIndex:n,meta:r}).fill),UC(UC({},o),{fill:s})},Wx=function(t,e){return Na(e)?e(t):e},Gx=function(t,e,n){for(var r,i,o,a=t.x,s=t.y,l=t.width,u=t.height/Ty(e),c=[],h=0,d=op(n,(function(t){return t>1?t/100:t})),f=0;f'.concat((n=e,r="tr",n.map((function(t){return"<".concat(r,">").concat(function(t,e){return t.map((function(t){return"<".concat(e,">").concat(Ff(t),"")})).join("")}(t,"td"),"")})).join("")),"
")};var n,r},rS=function(t,e,n){var r,i,o,a,s,l,u=null!==(i=null===(r=t[0])||void 0===r?void 0:r.length)&&void 0!==i?i:0,c=null!==(o=null==e?void 0:e.length)&&void 0!==o?o:0,h=null!==(s=null===(a=n[0])||void 0===a?void 0:a.length)&&void 0!==s?s:0,d=null!==(l=n.length)&&void 0!==l?l:0,f=u+h,p=c+d,v=Array.from(Array(p),(function(){return new Array(f)}));return v=op(v,(function(r,i){return op(r,(function(r,o){return o>=0&&o=0&&i=u&&o<=f&&i>=0&&i=0&&o=c&&i=u&&o<=f&&i>=c&&i1)return i.push.apply(i,XC([],VC(n),!1)),i;if(r){var l=e.dataSet.getFieldFormatter(a);i.push(l(o,s))}else i.push(o)}else i.push.apply(i,XC([],VC(n),!1));return i.join(" ")},CS=function(t){var e=jx(t);return pa(e)?e:t},wS=function(t,e,n){var r=CS(e.label),i=pa(r)?r.length:1,o=n.options.placeholder,a=Na(o)?o(t):o;return Array(i).fill(a)},xS=function(t){var e,n,r,i,o=null===(r=null===(n=null===(e=t.spreadsheet)||void 0===e?void 0:e.dataSet)||void 0===n?void 0:n.getFieldFormatter)||void 0===r?void 0:r.call(n,t.field);return null!==(i=null==o?void 0:o(t.label))&&void 0!==i?i:t.label},SS=function(t){var e=[],n=function(t){if(t.id!==Wo){var r=xS(t);return e.unshift(r),(null==t?void 0:t.parent)?n(t.parent):void 0}};return n(t),e},ES=function(t,e,n){var r,i=t.split(Go);if(n)r=[t];else{r=[Bw(i[0],i[1])];for(var o=2;o0&&s.length0&&o.push(n)}));var a=e.getChildren(),s=GS(a),l=US(s,o),u=US(o,s);Tf(l,(function(t){var e=$f(a,(function(e){return av(e.getMeta().id,t.viewMeta.id)}));null==e||e.remove(!0)})),Tf(u,(function(n){var r=n.cells,i=n.viewMeta;e.add(new RS(t,r,i))}))}}},jS=function(t){return t.includes(Go)?"id":"field"},VS=function(t,e){void 0===e&&(e=[]);var n=t.getInitColumnLeafNodes();return ed(e.map((function(t){var e=jS(t);return n.find((function(n){return n[e]===t}))})))},XS=function(e,n,r){void 0===n&&(n=[]),void 0===r&&(r=!1);var i=function(t,n){void 0===t&&(t=[]),void 0===n&&(n=[]),e.setOptions({interaction:{hiddenColumnFields:t}}),e.interaction.reset(),e.store.set("hiddenColumnsDetail",n),e.render(!1,{reBuildHiddenColumnsDetail:!1})};if(ov(n)&&r)i();else{var o=e.store.get("hiddenColumnsDetail",[]),a=e.options.interaction.hiddenColumnFields;if(!av(n,a)||r){var s=Lm(XC(XC([],VC(n),!1),VC(a),!1)),l=function(t,e){if(void 0===e&&(e=[]),ov(e))return{prev:null,next:null};var n=t.getInitColumnLeafNodes(),r=VS(t,e).map((function(t){return null==t?void 0:t.colIndex})),i=Math.max.apply(Math,XC([],VC(r),!1)),o=Math.min.apply(Math,XC([],VC(r),!1)),a=n.find((function(t){return t.colIndex===i+1}));return{prev:n.find((function(t){return t.colIndex===o-1}))||null,next:a||null}}(e,n),u={hideColumnNodes:VS(e,n),displaySiblingNode:l},c=XC(XC([],VC(o),!1),[u],!1);e.emit(t.S2Event.LAYOUT_COLS_HIDDEN,u,c),i(s,c)}}},KS=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1),ov(e)&&n&&XS(t,e,!0);var r=function(t){var e=t.dataCfg.fields.columns,n=void 0===e?[]:e;return t.isTableMode()?n:t.getInitColumnLeafNodes().map((function(t){return t.id}))}(t),i=function(t,e){if(ov(e))return[];var n=Number.NEGATIVE_INFINITY;return t.reduce((function(t,r,i){if(!e.includes(r))return t;if(i===n+1)mf(t).push(r);else{var o=[r];t.push(o)}return n=i,t}),[])}(r,e);i.forEach((function(e){XS(t,e,n)}))},qS=function(t,e){return function(t){var e=function(t){return(null==t?void 0:t.next)||(null==t?void 0:t.prev)}(t);return null==e?void 0:e.id}(t)===e},ZS=function(e){var n=e.type,r=e.id,i=e.theme,o=e.width,a=e.height,s=YC(e,["type","id","theme","width","height"]),l=n===t.ResizeDirectionType.Horizontal?i.size:null,u=n===t.ResizeDirectionType.Vertical?i.size:null;return{fill:i.background,fillOpacity:i.backgroundOpacity,cursor:"".concat(n,"-resize"),width:l,height:u,appendInfo:UC(UC({},s),{isResizeArea:!0,type:n,id:r,width:o,height:a,size:i.size})}},$S=function(t,e){if(t.foregroundGroup)return t.foregroundGroup.findById(e)||t.foregroundGroup.addGroup({id:e,zIndex:5})},QS=function(t,e,n){var r=null!=n?n:{},i=r.scrollX,o=void 0===i?0:i,a=r.scrollY,s=void 0===a?0:a,l=!(t.x-o>e.x+e.width||t.x+t.width-oe.y+e.height||t.y+t.height-s0,rowFields:e,colFields:n});d.push(r),Ey(a,r,t)})),{paths:d,indexesData:a,rowPivotMeta:c,colPivotMeta:h,sortedDimensionValues:u}}function aE(t,e){if(t&&e){var n=e.split(Go),r=mf(n),i=t;Tf(n,(function(t,e){var n=i.get(t);return n?(t===r?(n.children=new Map,n.childField=void 0):i=n.children,!0):0===e&&t===Wo}))}}var sE=function(t){return"ASC"===hm(t)},lE=function(t){return"DESC"===hm(t)},uE=function(t){return!cv(Number(t))},cE=function(t,e,n){var r=sE(e)?1:-1,i=["-",void 0];return null==t?void 0:t.sort((function(t,e){var o=t,a=e;if(n){if(o=t[n],a=e[n],uE(o)&&uE(a))return(Number(o)-Number(a))*r;if(o&&(null==i?void 0:i.includes(null==o?void 0:o.toString())))return-r;if(Number(o)&&(null==i?void 0:i.includes(null==a?void 0:a.toString())))return r}return dv(o)||dv(a)?o?r:-r:o.toString().localeCompare(a.toString(),"zh")*r}))},hE=function(t,e,n){return n?function(t,e){var n;return null===(n=null==t?void 0:t.filter((function(t){return!(null==e?void 0:e.includes(t))})))||void 0===n?void 0:n.concat(e)}(e,Lm(t)):XC([],VC(new Set(XC(XC([],VC(t),!1),VC(e),!1))),!1)},dE=function(t){var e=t.sortByValues,n=t.originValues,r=n.filter((function(t){return e.find((function(e){return Mf(t,e)}))})).map((function(t){var e=t.split(Go);return e.length>1?[e.slice(0,e.length-1).join(Go),e[e.length-1]]:e})),i=Array.from(new Set(r.map((function(t){return t[0]}))));r.sort((function(t,n){var r=t.slice(0,t.length-1),o=n.slice(0,n.length-1);return r.join()!==o.join()?i.indexOf(r[0])-i.indexOf(o[0]):e.indexOf(t[t.length-1])-e.indexOf(n[n.length-1])}));var o=r.map((function(t){return t.join(Go)}));return $w(n,o)},fE=function(t){var e=t.originValues,n=t.measureValues,r=t.sortParam,i=t.dataSet,o=r.sortFunc,a=r.sortFieldId,s=r.sortMethod,l=o(UC({data:n},r));return(null==l?void 0:l.length)?(i.fields.rows.indexOf(a)>0||i.fields.columns.indexOf(a)>0)&&!Op(l[0],Go)?dE({sortByValues:l,originValues:e}):hE(l,e,sE(s)):e},pE=function(t){var e,n=t.sortParam,r=t.measureValues,i=t.originValues,o=t.dataSet,a=n.sortByMeasure,s=n.query,l=n.sortFieldId,u=n.sortMethod,c=o.fields,h=c.rows,d=c.columns,f=h.includes(l);a?e=function(t,e,n){var r,i=e.slice(0,e.indexOf(t)+1);return null===(r=n.map((function(t){return i.map((function(e){return t[e]})).join("".concat(Go))})))||void 0===r?void 0:r.filter((function(t){return t}))}(l,f?h:d,cE(r,u,a===vo?s[fo]:a)):e=op(cE(r,u));return hE(e,i,sE(u))},vE=function(t){var e=t.sortParam,n=t.originValues,r=t.measureValues,i=t.dataSet,o=e.sortFunc,a=e.sortMethod,s=e.sortBy,l=n,u={originValues:n,measureValues:r,sortParam:e,dataSet:i};return o?l=fE(u):s?l=dE({sortByValues:s,originValues:n}):(sE(a)||lE(a))&&(l=pE(u)),l},gE=function(t){return t.filter((function(t){return t!==fo}))},yE=function(t){var e=t.dataSet,n=t.sortParam,r=t.originValues,i=e.fields,o=n.sortByMeasure,a=n.query,s=n.sortFieldId,l=e.getMultiData(a);if(o!==vo){var u=nd(i.rows,i.columns);return l.filter((function(t){var e=new Set(Wl(t));return u.every((function(t){return e.has(t)}))}))}var c=Op(i.rows,s),h=gE(c?i.rows:i.columns),d=gE(c?i.columns:i.rows),f=h[h.indexOf(s)+1],p=Wl(a),v=d.filter((function(t){return!p.includes(t)})),g=l.filter((function(t){var e=new Set(Wl(t));return!!e.has(s)&&(!e.has(f)&&v.every((function(t){return!e.has(t)})))}));return ov(g)?ed(op(r,(function(t){var n=function(t,e,n){var r,i={};if(Op(t,Go))for(var o=ky(t,Go),a=(null===(r=null==e?void 0:e.rows)||void 0===r?void 0:r.includes(n))?e.rows:e.columns,s=0;s<=Ap(a,n);s++)i[a[s]]=o[s];else i[n]=t;return i}(t,i,s);return e.getTotalValue(UC(UC({},a),n))}))):g},mE=function(t){var e,n=t.dataSet,r=t.sortParam,i=t.originValues;return e=t.isSortByMeasure?yE(t):i,vE({sortParam:r,originValues:i,measureValues:e,dataSet:n})},CE=function(t,e){if(null==t?void 0:t.sortMethod){if(sE(null==t?void 0:t.sortMethod))return"groupAsc";if(lE(null==t?void 0:t.sortMethod))return"groupDesc"}if(e)return"SortDown"},wE=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return GC(n,e),n.prototype.handleRestOptions=function(){for(var t=[],e=0;e0?n.right:0)},n.prototype.getColResizeAreaKey=function(){return this.meta.key},n.prototype.getColResizeArea=function(){return $S(this.spreadsheet,Bo)},n.prototype.getHorizontalResizeAreaName=function(){return"".concat(Ho).concat(this.meta.key)},n.prototype.drawHorizontalResizeArea=function(){var e,n;if(!(0===(null===(n=null===(e=this.spreadsheet.options.style)||void 0===e?void 0:e.colCfg)||void 0===n?void 0:n.height))&&this.shouldDrawResizeAreaByType("colCellVertical",this)){var r=this.headerConfig,i=r.cornerWidth,o=r.viewportWidth,a=this.meta,s=a.y,l=a.height,u=this.getResizeAreaStyle(),c=this.getColResizeArea(),h=this.getHorizontalResizeAreaName();if(!c.find((function(t){return t.attrs.name===h}))){var d=i+o;c.addShape("rect",{attrs:UC(UC({},ZS({theme:u,type:t.ResizeDirectionType.Vertical,id:this.getColResizeAreaKey(),effect:t.ResizeAreaEffect.Field,offsetX:0,offsetY:s,width:d,height:l,meta:this.meta})),{name:h,x:0,y:s+l-u.size/2,width:d})})}}},n.prototype.shouldAddVerticalResizeArea=function(){var t=this.meta,e=t.x,n=t.y,r=t.width,i=t.height,o=this.headerConfig,a=o.scrollX,s=o.scrollY,l=o.scrollContainsRowHeader,u=o.cornerWidth,c=o.height,h=o.width,d=this.getResizeAreaStyle(),f={x:e+r-d.size/2,y:n,width:d.size,height:i};return QS(f,{x:l?-u:0,y:0,width:l?u+h:h,height:c},{scrollX:a,scrollY:s})},n.prototype.getVerticalResizeAreaOffset=function(){var t=this.meta,e=t.x,n=t.y,r=this.headerConfig,i=r.scrollX,o=r.position;return{x:o.x+e-i,y:o.y+n}},n.prototype.drawVerticalResizeArea=function(){if(this.meta.isLeaf&&this.shouldDrawResizeAreaByType("colCellHorizontal",this)){var e=this.meta,n=e.label,r=e.width,i=e.height,o=this.getResizeAreaStyle(),a=this.getColResizeArea();if(this.shouldAddVerticalResizeArea()){var s=this.getVerticalResizeAreaOffset(),l=s.x,u=s.y;a.addShape("rect",{attrs:UC(UC({},ZS({theme:o,type:t.ResizeDirectionType.Horizontal,effect:t.ResizeAreaEffect.Cell,id:n,offsetX:l,offsetY:u,width:r,height:i,meta:this.meta})),{x:l+r-o.size/2,y:u,height:i})})}}},n.prototype.drawResizeArea=function(){this.drawHorizontalResizeArea(),this.drawVerticalResizeArea()},n.prototype.drawHorizontalBorder=function(){var e=Bx(t.CellBorderPosition.TOP,this.meta,this.theme.colCell.cell);dx(this,e.position,e.style)},n.prototype.drawVerticalBorder=function(t){var e=Bx(t,this.meta,this.theme.colCell.cell);dx(this,e.position,e.style)},n.prototype.drawBorders=function(){var e=this.spreadsheet,n=e.options,r=e.isTableMode;0===this.meta.colIndex&&r()&&!n.showSeriesNumber&&this.drawVerticalBorder(t.CellBorderPosition.LEFT),this.drawHorizontalBorder(),this.drawVerticalBorder(t.CellBorderPosition.RIGHT)},n.prototype.hasHiddenColumnCell=function(){var t=this,e=this.spreadsheet.options,n=e.interaction.hiddenColumnFields,r=void 0===n?[]:n,i=e.tooltip.operation,o=this.spreadsheet.store.get("hiddenColumnsDetail",[]);return!(ov(o)||ov(r)||!i.hiddenColumns)&&!!o.find((function(e){return qS(null==e?void 0:e.displaySiblingNode,t.meta.id)}))},n.prototype.getExpandIconTheme=function(){return this.getStyle().icon},n.prototype.addExpandColumnSplitLine=function(){var t=this.meta,e=t.x,n=t.y,r=t.width,i=t.height,o=this.theme.splitLine,a=o.horizontalBorderColor,s=o.horizontalBorderWidth,l=o.horizontalBorderColorOpacity,u=this.isLastColumn()?e+r-s:e;dx(this,{x1:u,y1:n,x2:u,y2:n+i},{stroke:a,lineWidth:s,strokeOpacity:l})},n.prototype.addExpandColumnIconShapes=function(){this.hasHiddenColumnCell()&&(this.addExpandColumnSplitLine(),this.addExpandColumnIcon())},n.prototype.addExpandColumnIcon=function(){var e=this,n=this.getExpandColumnIconConfig();px(this,UC(UC({},n),{name:"ExpandColIcon",cursor:"pointer"})).on("click",(function(){e.spreadsheet.emit(t.S2Event.LAYOUT_COLS_EXPANDED,e.meta)}))},n.prototype.getExpandColumnIconConfig=function(){var t=this.getExpandIconTheme().size,e=this.getCellArea(),n=e.x,r=e.y,i=e.width,o=e.height,a=n-t;return{x:this.isLastColumn()?a+i:a,y:r+o/2-t/2,width:2*t,height:t}},n.prototype.isLastColumn=function(){return t=this.spreadsheet,e=this.meta.id,n=t.getColumnNodes(),r=t.getInitColumnLeafNodes(),i=jS(e),Su(mf(n),i)===e&&Su(mf(r),i)!==e;var t,e,n,r,i},n}(wE),SE=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.textShapes=[],t}return GC(n,e),Object.defineProperty(n.prototype,"cellType",{get:function(){return t.CellTypes.CORNER_CELL},enumerable:!1,configurable:!0}),n.prototype.update=function(){},n.prototype.initCell=function(){e.prototype.initCell.call(this),this.textShapes=[],this.drawBackgroundShape(),this.drawTreeIcon(),this.drawCellText(),this.drawActionIcons(),this.drawBorderShape(),this.drawResizeArea()},n.prototype.drawCellText=function(){var t=this.getContentArea().x,e=this.getCellArea(),n=e.y,r=e.height,i=this.getTextStyle(),o=this.getCornerText(),a=this.getMaxTextWidth(),s=Wx(this.meta,this.spreadsheet.options.placeholder),l=this.spreadsheet.measureTextWidth,u=zx({measureTextWidth:l,text:o,maxWidth:a,fontParam:i,placeholder:s});this.actualText=u;var c=u.indexOf("..."),h=u,d="";if(-1!==c&&this.spreadsheet.isHierarchyTreeType()){var f=c+(ww()?1:0);h=o.substr(0,f),d=o.slice(f),d=zx({measureTextWidth:l,text:d,maxWidth:a,fontParam:i})}var p=Ax({x:t+this.getTreeIconWidth(),y:n,width:a,height:r},i).x,v=n+(ov(d)?r/2:r/4);this.textShapes.push(hx(this,[this.textShapes[0]],p,v,h,i)),ov(d)||this.textShapes.push(hx(this,[this.textShapes[1]],p,n+.75*r,d,i)),this.actualTextWidth=Bv([l(h,i),l(d,i)])},n.prototype.drawTreeIcon=function(){var e=this;if(this.showTreeIcon()&&this.meta.cornerType!==t.CornerNodeType.Col){var n=this.headerConfig.hierarchyCollapse,r=this.getStyle().icon.size,i=this.getTextStyle(),o=i.textBaseline,a=i.fill,s=this.getContentArea();this.treeIcon=vx(this,{x:s.x,y:Ox(s,o,r),width:r,height:r},a,n,(function(){e.headerConfig.spreadsheet.store.set("scrollY",0),e.headerConfig.spreadsheet.emit(t.S2Event.LAYOUT_TREE_ROWS_COLLAPSE_ALL,n)}))}},n.prototype.drawBackgroundShape=function(){var t=this.getStyle().cell,e=t.backgroundColor,n=t.backgroundColorOpacity,r=UC(UC({},this.getCellArea()),{fill:e,fillOpacity:n});this.backgroundShape=sx(this,r)},n.prototype.drawBorderShape=function(){var e=this;[t.CellBorderPosition.TOP,t.CellBorderPosition.LEFT].forEach((function(t){var n=Bx(t,e.getCellArea(),e.getStyle().cell),r=n.position,i=n.style;dx(e,r,i)}))},n.prototype.isLastRowCornerCell=function(){var e=this.meta,n=e.cornerType,r=e.field,i=this.headerConfig.rows;return n===t.CornerNodeType.Row&&(this.spreadsheet.isHierarchyTreeType()||mf(i)===r)},n.prototype.getResizeAreaEffect=function(){return this.meta.cornerType===t.CornerNodeType.Series?t.ResizeAreaEffect.Series:this.isLastRowCornerCell()&&this.spreadsheet.isHierarchyTreeType()?t.ResizeAreaEffect.Tree:t.ResizeAreaEffect.Field},n.prototype.drawResizeArea=function(){if(this.shouldDrawResizeAreaByType("cornerCellHorizontal",this)){var e=this.getResizeAreaStyle(),n=$S(this.spreadsheet,Mo),r=this.headerConfig,i=r.position,o=r.scrollX,a=r.scrollY,s=r.width,l=r.height,u=this.meta,c=u.x,h=u.y,d=u.width,f=u.height,p=u.field,v=u.cornerType,g={x:c+d-e.size/2,y:h,width:e.size,height:f},y={x:0,y:0,width:s,height:l};if(v!==t.CornerNodeType.Col&&QS(g,y,{scrollX:o,scrollY:a})){var m=i.x+c-o,C=i.y+(this.isLastRowCornerCell()?0:h);n.addShape("rect",{attrs:UC(UC({},ZS({theme:e,id:p,type:t.ResizeDirectionType.Horizontal,effect:this.getResizeAreaEffect(),offsetX:m,offsetY:C,width:d,height:f,meta:this.meta})),{x:m+d-e.size/2,y:C,height:this.isLastRowCornerCell()?l:f})})}}},n.prototype.showTreeIcon=function(){var t;return this.headerConfig.spreadsheet.isHierarchyTreeType()&&0===(null===(t=this.meta)||void 0===t?void 0:t.x)},n.prototype.getIconPosition=function(){var t,e,n=null===(e=null===(t=this.textShapes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.cfg.attrs,r=this.getTextStyle(),i=r.textBaseline,o=r.textAlign,a=this.getStyle().icon,s=a.size,l=a.margin;return{x:(null==n?void 0:n.x)+Rd([[Av("center"),Is(this.actualTextWidth/2)],[Av("right"),Is(0)],[Wy,Is(this.actualTextWidth)]])(o)+l.left,y:Ox(this.getContentArea(),i,s)}},n.prototype.getTreeIconWidth=function(){var t=this.getStyle().icon,e=t.size,n=t.margin;return this.showTreeIcon()?e+n.right:0},n.prototype.getTextStyle=function(){var e=this.meta.cornerType,n=this.getStyle(),r=n.text,i=n.bolderText,o=e===t.CornerNodeType.Col?r:i;return UC(UC({},o),{textBaseline:"middle"})},n.prototype.getMaxTextWidth=function(){return this.getContentArea().width-this.getTreeIconWidth()-this.getActionIconsWidth()},n.prototype.getTextPosition=function(){return{x:0,y:0}},n.prototype.getFormattedFieldValue=function(){return tE(this.meta,this.spreadsheet.dataSet.getFieldName(this.meta.label))},n.prototype.getCornerText=function(){var t;return av(this.meta.label,fo)?(null===(t=this.spreadsheet.options)||void 0===t?void 0:t.cornerText)||lw("指标"):this.getFormattedFieldValue().formattedValue},n}(wE),EE=function(){function t(t){this.EVENT="gesture",this.gm=t}return t.prototype.do=function(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel(t);break;default:return}},t.prototype.emit=function(t){this.gm.emit(this.EVENT,t)},t}(),_E=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.EVENT="pan",e}return GC(e,t),e.prototype.onTouchCancel=function(t){},e.prototype.onTouchEnd=function(t){},e.prototype.onTouchMove=function(t){var e=t.x,n=t.y,r=e-this.preX,i=n-this.preY;this.preX=e,this.preY=n,this.emit({x:e,y:n,deltaX:r,deltaY:i,event:t})},e.prototype.onTouchStart=function(t){var e=t.x,n=t.y;this.preX=e,this.preY=n},e}(EE),bE="object"==typeof performance&&performance.now?performance:Date,TE=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.EVENT="press",e}return GC(e,t),e.prototype.onTouchCancel=function(t){this.clearTimeout()},e.prototype.onTouchEnd=function(t){this.clearTimeout()},e.prototype.onTouchMove=function(t){var e=t.x,n=t.y;(e-this.touchStartX>10||n-this.touchStartY>10)&&this.clearTimeout()},e.prototype.onTouchStart=function(t){var e=this;this.clearTimeout();var n=t.x,r=t.y;this.touchStartTime=bE.now(),this.touchStartX=n,this.touchStartY=r,this.pressTimeout=window.setTimeout((function(){e.emit({x:n,y:r,event:t})}),300)},e.prototype.clearTimeout=function(){window.clearTimeout(this.pressTimeout)},e}(EE),LE=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.EVENT="swipe",e.latestMoveTime=0,e.ms=0,e.speedX=0,e.speedY=0,e.preX=0,e.preY=0,e}return GC(e,t),e.prototype.onTouchCancel=function(t){},e.prototype.onTouchEnd=function(t){var e=this.speedX,n=this.speedY;if(bE.now()-this.latestMoveTime<100){var r=t.x,i=t.y;this.emit({x:r,y:i,speedX:e,speedY:n,event:t})}},e.prototype.onTouchMove=function(t){var e=t.x,n=t.y,r=bE.now(),i=e-this.preX,o=n-this.preY,a=r-this.ms;this.speedX=i/a,this.speedY=o/a,this.latestMoveTime=r},e.prototype.onTouchStart=function(t){var e=t.x,n=t.y;this.speedX=this.speedY=0,this.preX=e,this.preY=n,this.ms=bE.now()},e}(EE),IE=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.EVENT="tap",e}return GC(e,t),e.prototype.onTouchCancel=function(t){},e.prototype.onTouchEnd=function(t){var e=t.x,n=t.y;e-this.touchStartX<2&&n-this.touchStartY<2&&bE.now()-this.touchStartTime<300&&this.emit({x:e,y:n,event:t})},e.prototype.onTouchMove=function(t){},e.prototype.onTouchStart=function(t){var e=t.x,n=t.y;this.touchStartTime=bE.now(),this.touchStartX=e,this.touchStartY=n},e}(EE),OE={Pan:_E,Press:TE,Swipe:LE,Tap:IE},RE=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;return r.onTouchStart=function(t){r.preventEvent(t),r.element.on("touchmove",r.onTouchMove),r.element.on("touchend",r.onTouchEnd),r.element.on("touchcancel",r.onTouchCancel),r.emit("touchdown",t),r.doGestures(t)},r.onTouchMove=function(t){r.preventEvent(t),r.emit("touchmove",t),r.doGestures(t)},r.onTouchEnd=function(t){r.preventEvent(t),r.emit("touchend",t),r.element.off("touchmove",r.onTouchMove),r.element.off("touchend",r.onTouchEnd),r.element.off("touchcancel",r.onTouchCancel),r.doGestures(t)},r.onTouchCancel=function(t){r.preventEvent(t),r.emit("touchcancel",t),r.element.off("touchmove",r.onTouchMove),r.element.off("touchend",r.onTouchEnd),r.element.off("touchcancel",r.onTouchCancel),r.doGestures(t)},r.element=e,r.options=n,r.initialGestures(),r.bindTouchStart(),r}return GC(e,t),e.prototype.destroy=function(){this.element.off("touchstart",this.onTouchStart),this.off()},e.prototype.initialGestures=function(){var t=this,e=this.options.gestures||["Pan","Press","Swipe","Tap"];this.gestures=e.map((function(e){return new(0,OE[e])(t)}))},e.prototype.bindTouchStart=function(){this.element.on("touchstart",this.onTouchStart)},e.prototype.preventEvent=function(t){var e=t.type;(this.options.prevents||[]).includes(e)&&t.preventDefault()},e.prototype.doGestures=function(t){this.gestures.forEach((function(e){e.do(t)}))},e}(ht),AE=ln,ME="wheel",BE=function(t){function e(e){var n=t.call(this)||this;return n.rafMs=0,n.onPan=function(t){n.raf&&cancelAnimationFrame(n.raf);var e=t.deltaX,r=t.deltaY,i=n.getWrapperEvent(t,e,r);n.emit(ME,i)},n.onSwipe=function(t){var e=t.speedX,r=t.speedY;n.rafMs=bE.now(),n.ms=n.rafMs,0===e&&0===r||n.rafInertia(t)},n.element=e,n.gm=new RE(e,{gestures:["Pan","Swipe"]}),n.gm.on("swipe",n.onSwipe),n.gm.on("pan",n.onPan),n}return GC(e,t),e.prototype.destroy=function(){window.cancelAnimationFrame(this.raf),this.gm.destroy(),this.off()},e.prototype.rafInertia=function(t){var e=this,n=t.speedX,r=t.speedY;this.raf=window.requestAnimationFrame((function(){var i=bE.now(),o=(i-e.ms)/800;if(o<1){o=AE(1-o);var a=i-e.rafMs,s=n*o*a,l=r*o*a,u=e.getWrapperEvent(t,s,l);e.emit(ME,u),e.rafMs=i,e.rafInertia(t)}}))},e.prototype.getWrapperEvent=function(t,e,n){return UC(UC({},t),{deltaX:-e,deltaY:-n})},e}(ht),NE=function(t,e,n,r,i){var o=n+r;return t+i>=o?t:ot+(e-i)/2?t+e-n>i?n:t+e-i:t+(e-i)/2},DE=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return GC(n,e),Object.defineProperty(n.prototype,"cellType",{get:function(){return t.CellTypes.ROW_CELL},enumerable:!1,configurable:!0}),n.prototype.destroy=function(){var t;e.prototype.destroy.call(this),null===(t=this.gm)||void 0===t||t.destroy()},n.prototype.initCell=function(){e.prototype.initCell.call(this),this.drawBackgroundShape(),this.drawInteractiveBgShape(),this.drawInteractiveBorderShape(),this.drawTextShape(),this.drawTreeIcon(),this.drawTreeLeafNodeAlignDot(),this.drawRectBorder(),this.drawResizeAreaInLeaf(),this.drawActionIcons(),this.update()},n.prototype.drawBackgroundShape=function(){var t=this.getStyle().cell,e=t.backgroundColor,n=t.backgroundColorOpacity;this.backgroundShape=sx(this,UC(UC({},this.getCellArea()),{fill:e,fillOpacity:n}))},n.prototype.drawInteractiveBorderShape=function(){this.stateShapes.set("interactiveBorderShape",sx(this,this.getInteractiveBorderShapeStyle(2),{visible:!1}))},n.prototype.drawInteractiveBgShape=function(){this.stateShapes.set("interactiveBgShape",sx(this,UC({},this.getCellArea()),{visible:!1}))},n.prototype.showTreeIcon=function(){return this.spreadsheet.isHierarchyTreeType()&&!this.meta.isLeaf},n.prototype.showTreeLeafNodeAlignDot=function(){var t;return(null===(t=this.spreadsheet.options.style)||void 0===t?void 0:t.showTreeLeafNodeAlignDot)&&this.spreadsheet.isHierarchyTreeType()},n.prototype.getParentTreeIconCfg=function(){if(this.showTreeLeafNodeAlignDot()&&this.spreadsheet.isHierarchyTreeType()&&this.meta.isLeaf)return Su(this.meta,"parent.belongsCell.treeIcon.cfg")},n.prototype.drawTreeIcon=function(){var e=this;if(this.showTreeIcon()){var n=this.meta,r=n.isCollapsed,i=n.id,o=n.hierarchy,a=this.getContentArea().x,s=this.getTextStyle().fill,l=this.getStyle().icon.size,u=a+this.getContentIndent(),c=this.getIconYPosition();this.treeIcon=vx(this,{x:u,y:c,width:l,height:l},s,r,(function(){if(!Cw()){if(!r){var n=e.spreadsheet.store.get("scrollY"),a=e.spreadsheet.facet.panelBBox.viewportHeight||0,s=(c=e.meta,h=0,null==(d=c.children)||d.forEach((function(t){h+=t.height||0})),h),l=o.height-s;if(n>0&&n+a>l){var u=l-a;e.spreadsheet.store.set("scrollY",u>0?u:0)}}var c,h,d;e.spreadsheet.emit(t.S2Event.ROW_CELL_COLLAPSE_TREE_ROWS,{id:i,isCollapsed:!r,node:e.meta})}})),Cw()&&(this.gm=new RE(this,{gestures:["Tap"]}),this.gm.on("tap",(function(){e.spreadsheet.emit(t.S2Event.ROW_CELL_COLLAPSE_TREE_ROWS,{id:i,isCollapsed:!r,node:e.meta})})))}},n.prototype.drawTreeLeafNodeAlignDot=function(){var t=this.getParentTreeIconCfg();if(t){var e=this.getStyle().icon,n=e.size,r=e.margin,i=t.x+n+r.right,o=this.getTextPosition().y,a=this.getTextStyle(),s=a.fill,l=a.fontSize,u=n/5;this.treeLeafNodeAlignDot=cx(this,{x:i+n/2,y:o+(l-u)/2,r:u,fill:s,fillOpacity:.3})}},n.prototype.drawTextShape=function(){e.prototype.drawTextShape.call(this),this.drawLinkFieldShape()},n.prototype.drawLinkFieldShape=function(){var t=this.headerConfig.linkFields,n=void 0===t?[]:t,r=this.getTextStyle().linkTextFill;e.prototype.drawLinkFieldShape.call(this,n.includes(this.meta.key),r)},n.prototype.drawRectBorder=function(){var e=this,n=this.getCellArea().x,r=this.getContentIndent(),i=this.spreadsheet.isHierarchyTreeType()?n:n+r;[t.CellBorderPosition.BOTTOM,t.CellBorderPosition.LEFT].forEach((function(t){var n=Bx(t,UC(UC({},e.getCellArea()),{x:i}),e.getStyle().cell),r=n.position,o=n.style;dx(e,r,o)}))},n.prototype.drawResizeAreaInLeaf=function(){if(this.meta.isLeaf&&this.shouldDrawResizeAreaByType("rowCellVertical",this)){var e=this.getCellArea(),n=e.x,r=e.y,i=e.width,o=e.height,a=this.getResizeAreaStyle(),s=$S(this.spreadsheet,Io),l=this.headerConfig,u=l.position,c=l.seriesNumberWidth,h=l.width,d=l.viewportHeight,f=l.scrollX,p=l.scrollY,v={x:n,y:r+o-a.size/2,width:i,height:a.size};if(QS(v,{x:0,y:0,width:h,height:d},{scrollX:f,scrollY:p})){var g=u.x+n-f+c,y=u.y+r-p,m=this.spreadsheet.isFrozenRowHeader()?h-c-(n-f):i;s.addShape("rect",{attrs:UC(UC({},ZS({id:this.meta.id,theme:a,type:t.ResizeDirectionType.Vertical,effect:t.ResizeAreaEffect.Cell,offsetX:g,offsetY:y,width:i,height:o,meta:this.meta})),{x:g,y:y+o-a.size/2,width:m})})}}},n.prototype.getContentIndent=function(){if(!this.spreadsheet.isHierarchyTreeType())return 0;for(var t=this.getStyle(),e=t.icon,n=t.cell,r=e.size+e.margin.right,i=this.meta.parent,o=0;i;)0!==i.height&&(o+=r),i=i.parent;return this.showTreeLeafNodeAlignDot()&&(o+=this.isTreeLevel()?0:n.padding.right+e.margin.right),o},n.prototype.getTextIndent=function(){var t=this.getStyle().icon,e=t.size,n=t.margin;return this.getContentIndent()+(this.showTreeIcon()||this.isTreeLevel()&&this.showTreeLeafNodeAlignDot()?e+n.right:0)},n.prototype.isTreeLevel=function(){return $f(Su(this.meta,"parent.children"),(function(t){return!t.isLeaf}))},n.prototype.isBolderText=function(){var t=this.meta,e=t.isLeaf,n=t.isTotals,r=t.level;return!e&&0===r||n},n.prototype.getTextStyle=function(){var t,e=this.getStyle(),n=e.text,r=e.bolderText,i=e.measureText;return t=this.isMeasureField()?i||n:this.isBolderText()?r:n,UC(UC({},t),{textBaseline:"top"})},n.prototype.getIconPosition=function(){var t=this.textShape.cfg.attrs,e=t.x,n=t.y,r=t.textAlign,i=this.getStyle().icon.margin.left;return"left"===r?{x:e+this.actualTextWidth+i,y:n}:"right"===r?{x:e+i,y:n}:{x:e+this.actualTextWidth/2+i,y:n}},n.prototype.getMaxTextWidth=function(){return this.getContentArea().width-this.getTextIndent()-this.getActionIconsWidth()},n.prototype.getTextArea=function(){var t=this.getContentArea(),e=this.getTextIndent();return UC(UC({},t),{x:t.x+e,width:t.width-e})},n.prototype.getTextPosition=function(){var t=this.getTextArea(),e=this.headerConfig,n=e.scrollY,r=e.viewportHeight,i=this.getTextStyle().fontSize,o=NE(t.y,t.height,n,r,i);return{x:Rx(t,this.getTextStyle(),0,this.getIconStyle(),this.getActionIconsCount()).text.x,y:o}},n.prototype.getIconYPosition=function(){var t=this.getTextPosition().y,e=this.getStyle().icon.size;return t+(this.getTextStyle().fontSize-e)/2},n}(wE),PE=function(t,e){return e>0&&t0&&t>=n-e},zE=function(t,e,n){return n>0&&t0&&t>=e+1-n},HE=function(t,e,n,r,i,o){var a=Zf(n,(function(e,r){var a=t-(dv(o)?0:o)+i.x;return a>=e&&a=e&&o0?s.right:0)}(e,n,t.CellTypes.COL_CELL,Su(r,"icon"))+o.left+o.right},jE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return GC(e,t),e.prototype.handleRestOptions=function(){for(var t=[],e=0;e0){for(o+=a,e=1;en)throw Error(C_+t)}function D_(t,e,n,r){var i,o,a,s;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=7,i=0):(i=Math.ceil((e+1)/7),e%=7),o=__(10,7-e),s=t[i]%o|0,null==r?e<3?(0==e?s=s/100|0:1==e&&(s=s/10|0),a=n<4&&99999==s||n>3&&49999==s||5e4==s||0==s):a=(n<4&&s+1==o||n>3&&s+1==o/2)&&(t[i+1]/o/100|0)==__(10,e-2)-1||(s==o/2||0==s)&&0==(t[i+1]/o/100|0):e<4?(0==e?s=s/1e3|0:1==e?s=s/100|0:2==e&&(s=s/10|0),a=(r||n<4)&&9999==s||!r&&n>3&&4999==s):a=((r||n<4)&&s+1==o||!r&&n>3&&s+1==o/2)&&(t[i+1]/o/1e3|0)==__(10,e-3)-1,a}function P_(t,e,n){for(var r,i,o=[0],a=0,s=t.length;an-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}M_.absoluteValue=M_.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),z_(t)},M_.ceil=function(){return z_(new this.constructor(this),this.e+1,2)},M_.clampedTo=M_.clamp=function(t,e){var n=this,r=n.constructor;if(t=new r(t),e=new r(e),!t.s||!e.s)return new r(NaN);if(t.gt(e))throw Error(C_+e);return n.cmp(t)<0?t:n.cmp(e)>0?e:new r(n)},M_.comparedTo=M_.cmp=function(t){var e,n,r,i,o=this,a=o.d,s=(t=new o.constructor(t)).d,l=o.s,u=t.s;if(!a||!s)return l&&u?l!==u?l:a===s?0:!a^l<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?l:s[0]?-u:0;if(l!==u)return l;if(o.e!==t.e)return o.e>t.e^l<0?1:-1;for(e=0,n=(r=a.length)<(i=s.length)?r:i;es[e]^l<0?1:-1;return r===i?0:r>i^l<0?1:-1},M_.cosine=M_.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(t,e){var n,r,i;if(e.isZero())return e;(r=e.d.length)<32?i=(1/tb(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10");t.precision+=n,e=J_(t,1,e.times(i),new t(1));for(var o=n;o--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return t.precision-=n,e}(r,eb(r,n)),r.precision=t,r.rounding=e,z_(2==n_||3==n_?n.neg():n,t,e,!0)):new r(1):new r(NaN)},M_.cubeRoot=M_.cbrt=function(){var t,e,n,r,i,o,a,s,l,u,c=this,h=c.constructor;if(!c.isFinite()||c.isZero())return new h(c);for(y_=!1,(o=c.s*__(c.s*c,1/3))&&Math.abs(o)!=1/0?r=new h(o.toString()):(n=B_(c.d),(o=((t=c.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=__(n,1/3),t=E_((t+1)/3)-(t%3==(t<0?-1:2)),(r=new h(n=o==1/0?"5e"+t:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+t)).s=c.s),a=(t=h.precision)+3;;)if(u=(l=(s=r).times(s).times(s)).plus(c),r=k_(u.plus(c).times(s),u.plus(l),a+2,1),B_(s.d).slice(0,a)===(n=B_(r.d)).slice(0,a)){if("9999"!=(n=n.slice(a-3,a+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(z_(r,t+1,1),e=!r.times(r).times(r).eq(c));break}if(!i&&(z_(s,t+1,0),s.times(s).times(s).eq(c))){r=s;break}a+=4,i=1}return y_=!0,z_(r,t,h.rounding,e)},M_.decimalPlaces=M_.dp=function(){var t,e=this.d,n=NaN;if(e){if(n=7*((t=e.length-1)-E_(this.e/7)),t=e[t])for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},M_.dividedBy=M_.div=function(t){return k_(this,new this.constructor(t))},M_.dividedToIntegerBy=M_.divToInt=function(t){var e=this.constructor;return z_(k_(this,new e(t),0,1,1),e.precision,e.rounding)},M_.equals=M_.eq=function(t){return 0===this.cmp(t)},M_.floor=function(){return z_(new this.constructor(this),this.e+1,3)},M_.greaterThan=M_.gt=function(t){return this.cmp(t)>0},M_.greaterThanOrEqualTo=M_.gte=function(t){var e=this.cmp(t);return 1==e||0===e},M_.hyperbolicCosine=M_.cosh=function(){var t,e,n,r,i,o=this,a=o.constructor,s=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return s;n=a.precision,r=a.rounding,a.precision=n+Math.max(o.e,o.sd())+4,a.rounding=1,(i=o.d.length)<32?e=(1/tb(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),o=J_(a,1,o.times(e),new a(1),!0);for(var l,u=t,c=new a(8);u--;)l=o.times(o),o=s.minus(l.times(c.minus(l.times(c))));return z_(o,a.precision=n,a.rounding=r,!0)},M_.hyperbolicSine=M_.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=J_(o,2,i,i,!0);else{t=(t=1.4*Math.sqrt(r))>16?16:0|t,i=J_(o,2,i=i.times(1/tb(5,t)),i,!0);for(var a,s=new o(5),l=new o(16),u=new o(20);t--;)a=i.times(i),i=i.times(s.plus(a.times(l.times(a).plus(u))))}return o.precision=e,o.rounding=n,z_(i,e,n,!0)},M_.hyperbolicTangent=M_.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,k_(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},M_.inverseCosine=M_.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?e.isNeg()?G_(n,i,o):new n(0):new n(NaN):e.isZero()?G_(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=G_(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))},M_.inverseHyperbolicCosine=M_.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,y_=!1,n=n.times(n).minus(1).sqrt().plus(n),y_=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},M_.inverseHyperbolicSine=M_.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,y_=!1,n=n.times(n).plus(1).sqrt().plus(n),y_=!0,r.precision=t,r.rounding=e,n.ln())},M_.inverseHyperbolicTangent=M_.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?z_(new o(i),t,e,!0):(o.precision=n=r-i.e,i=k_(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},M_.inverseSine=M_.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==e?0===e?((t=G_(o,n+4,r).times(.5)).s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},M_.inverseTangent=M_.atan=function(){var t,e,n,r,i,o,a,s,l,u=this,c=u.constructor,h=c.precision,d=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&h+4<=A_)return(a=G_(c,h+4,d).times(.25)).s=u.s,a}else{if(!u.s)return new c(NaN);if(h+4<=A_)return(a=G_(c,h+4,d).times(.5)).s=u.s,a}for(c.precision=s=h+10,c.rounding=1,t=n=Math.min(28,s/7+2|0);t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(y_=!1,e=Math.ceil(s/7),r=1,l=u.times(u),a=new c(u),i=u;-1!==t;)if(i=i.times(l),o=a.minus(i.div(r+=2)),i=i.times(l),void 0!==(a=o.plus(i.div(r+=2))).d[e])for(t=e;a.d[t]===o.d[t]&&t--;);return n&&(a=a.times(2<this.d.length-2},M_.isNaN=function(){return!this.s},M_.isNegative=M_.isNeg=function(){return this.s<0},M_.isPositive=M_.isPos=function(){return this.s>0},M_.isZero=function(){return!!this.d&&0===this.d[0]},M_.lessThan=M_.lt=function(t){return this.cmp(t)<0},M_.lessThanOrEqualTo=M_.lte=function(t){return this.cmp(t)<1},M_.logarithm=M_.log=function(t){var e,n,r,i,o,a,s,l,u=this,c=u.constructor,h=c.precision,d=c.rounding;if(null==t)t=new c(10),e=!0;else{if(n=(t=new c(t)).d,t.s<0||!n||!n[0]||t.eq(1))return new c(NaN);e=t.eq(10)}if(n=u.d,u.s<0||!n||!n[0]||u.eq(1))return new c(n&&!n[0]?-1/0:1!=u.s?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(y_=!1,a=q_(u,s=h+5),r=e?W_(c,s+10):q_(t,s),D_((l=k_(a,r,s,1)).d,i=h,d))do{if(a=q_(u,s+=10),r=e?W_(c,s+10):q_(t,s),l=k_(a,r,s,1),!o){+B_(l.d).slice(i+1,i+15)+1==1e14&&(l=z_(l,h+1,0));break}}while(D_(l.d,i+=10,d));return y_=!0,z_(l,h,d)},M_.minus=M_.sub=function(t){var e,n,r,i,o,a,s,l,u,c,h,d,f=this,p=f.constructor;if(t=new p(t),!f.d||!t.d)return f.s&&t.s?f.d?t.s=-t.s:t=new p(t.d||f.s!==t.s?f:NaN):t=new p(NaN),t;if(f.s!=t.s)return t.s=-t.s,f.plus(t);if(u=f.d,d=t.d,s=p.precision,l=p.rounding,!u[0]||!d[0]){if(d[0])t.s=-t.s;else{if(!u[0])return new p(3===l?-0:0);t=new p(f)}return y_?z_(t,s,l):t}if(n=E_(t.e/7),c=E_(f.e/7),u=u.slice(),o=c-n){for((h=o<0)?(e=u,o=-o,a=d.length):(e=d,n=c,a=u.length),o>(r=Math.max(Math.ceil(s/7),a)+2)&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for((h=(r=u.length)<(a=d.length))&&(a=r),r=0;r0;--r)u[a++]=0;for(r=d.length;r>o;){if(u[--r](a=(o=Math.ceil(s/7))>a?o+1:a+1)&&(i=a,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((a=u.length)-(i=c.length)<0&&(i=a,n=c,c=u,u=n),e=0;i;)e=(u[--i]=u[i]+c[i]+e)/O_|0,u[i]%=O_;for(e&&(u.unshift(e),++r),a=u.length;0==u[--a];)u.pop();return t.d=u,t.e=H_(u,r),y_?z_(t,s,l):t},M_.precision=M_.sd=function(t){var e,n=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(C_+t);return n.d?(e=U_(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},M_.round=function(){var t=this,e=t.constructor;return z_(new e(t),t.e+1,e.rounding)},M_.sine=M_.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:J_(t,2,e,e);n=(n=1.4*Math.sqrt(r))>16?16:0|n,e=e.times(1/tb(5,n)),e=J_(t,2,e,e);for(var i,o=new t(5),a=new t(16),s=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(a.times(i).minus(s))));return e}(r,eb(r,n)),r.precision=t,r.rounding=e,z_(n_>2?n.neg():n,t,e,!0)):new r(NaN)},M_.squareRoot=M_.sqrt=function(){var t,e,n,r,i,o,a=this,s=a.d,l=a.e,u=a.s,c=a.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(y_=!1,0==(u=Math.sqrt(+a))||u==1/0?(((e=B_(s)).length+l)%2==0&&(e+="0"),u=Math.sqrt(e),l=E_((l+1)/2)-(l<0||l%2),r=new c(e=u==1/0?"5e"+l:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+l)):r=new c(u.toString()),n=(l=c.precision)+3;;)if(r=(o=r).plus(k_(a,o,n+2,1)).times(.5),B_(o.d).slice(0,n)===(e=B_(r.d)).slice(0,n)){if("9999"!=(e=e.slice(n-3,n+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(z_(r,l+1,1),t=!r.times(r).eq(a));break}if(!i&&(z_(o,l+1,0),o.times(o).eq(a))){r=o;break}n+=4,i=1}return y_=!0,z_(r,l,c.rounding,t)},M_.tangent=M_.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,(n=n.sin()).s=1,n=k_(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,z_(2==n_||4==n_?n.neg():n,t,e,!0)):new r(NaN)},M_.times=M_.mul=function(t){var e,n,r,i,o,a,s,l,u,c=this,h=c.constructor,d=c.d,f=(t=new h(t)).d;if(t.s*=c.s,!(d&&d[0]&&f&&f[0]))return new h(!t.s||d&&!d[0]&&!f||f&&!f[0]&&!d?NaN:d&&f?0*t.s:t.s/0);for(n=E_(c.e/7)+E_(t.e/7),(l=d.length)<(u=f.length)&&(o=d,d=f,f=o,a=l,l=u,u=a),o=[],r=a=l+u;r--;)o.push(0);for(r=u;--r>=0;){for(e=0,i=l+r;i>r;)s=o[i]+f[r]*d[i-r-1]+e,o[i--]=s%O_|0,e=s/O_|0;o[i]=(o[i]+e)%O_|0}for(;!o[--a];)o.pop();return e?++n:o.shift(),t.d=o,t.e=H_(o,n),y_?z_(t,h.precision,h.rounding):t},M_.toBinary=function(t,e){return nb(this,2,t,e)},M_.toDecimalPlaces=M_.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),void 0===t?n:(N_(t,0,d_),void 0===e?e=r.rounding:N_(e,0,8),z_(n,t+n.e+1,e))},M_.toExponential=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=F_(r,!0):(N_(t,0,d_),void 0===e?e=i.rounding:N_(e,0,8),n=F_(r=z_(new i(r),t+1,e),!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},M_.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return void 0===t?n=F_(i):(N_(t,0,d_),void 0===e?e=o.rounding:N_(e,0,8),n=F_(r=z_(new o(i),t+i.e+1,e),!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},M_.toFraction=function(t){var e,n,r,i,o,a,s,l,u,c,h,d,f=this,p=f.d,v=f.constructor;if(!p)return new v(f);if(u=n=new v(1),r=l=new v(0),a=(o=(e=new v(r)).e=U_(p)-f.e-1)%7,e.d[0]=__(10,a<0?7+a:a),null==t)t=o>0?e:u;else{if(!(s=new v(t)).isInt()||s.lt(u))throw Error(C_+s);t=s.gt(e)?o>0?e:u:s}for(y_=!1,s=new v(B_(p)),c=v.precision,v.precision=o=7*p.length*2;h=k_(s,e,0,1,1),1!=(i=n.plus(h.times(r))).cmp(t);)n=r,r=i,i=u,u=l.plus(h.times(i)),l=i,i=e,e=s.minus(h.times(i)),s=i;return i=k_(t.minus(n),r,0,1,1),l=l.plus(i.times(u)),n=n.plus(i.times(r)),l.s=u.s=f.s,d=k_(u,r,o,1).minus(f).abs().cmp(k_(l,n,o,1).minus(f).abs())<1?[u,r]:[l,n],v.precision=c,y_=!0,d},M_.toHexadecimal=M_.toHex=function(t,e){return nb(this,16,t,e)},M_.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),null==t){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),void 0===e?e=r.rounding:N_(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(y_=!1,n=k_(n,t,0,e,1).times(t),y_=!0,z_(n)):(t.s=n.s,n=t),n},M_.toNumber=function(){return+this},M_.toOctal=function(t,e){return nb(this,8,t,e)},M_.toPower=M_.pow=function(t){var e,n,r,i,o,a,s=this,l=s.constructor,u=+(t=new l(t));if(!(s.d&&t.d&&s.d[0]&&t.d[0]))return new l(__(+s,u));if((s=new l(s)).eq(1))return s;if(r=l.precision,o=l.rounding,t.eq(1))return z_(s,r,o);if((e=E_(t.e/7))>=t.d.length-1&&(n=u<0?-u:u)<=9007199254740991)return i=j_(l,s,n,r),t.s<0?new l(1).div(i):z_(i,r,o);if((a=s.s)<0){if(el.maxE+1||e0?a/0:0):(y_=!1,l.rounding=s.s=1,n=Math.min(12,(e+"").length),(i=K_(t.times(q_(s,r+n)),r)).d&&D_((i=z_(i,r+5,1)).d,r,o)&&(e=r+10,+B_((i=z_(K_(t.times(q_(s,e+n)),e),e+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=z_(i,r+1,0))),i.s=a,y_=!0,l.rounding=o,z_(i,r,o))},M_.toPrecision=function(t,e){var n,r=this,i=r.constructor;return void 0===t?n=F_(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(N_(t,1,d_),void 0===e?e=i.rounding:N_(e,0,8),n=F_(r=z_(new i(r),t,e),t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},M_.toSignificantDigits=M_.toSD=function(t,e){var n=this.constructor;return void 0===t?(t=n.precision,e=n.rounding):(N_(t,1,d_),void 0===e?e=n.rounding:N_(e,0,8)),z_(new n(this),t,e)},M_.toString=function(){var t=this,e=t.constructor,n=F_(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},M_.truncated=M_.trunc=function(){return z_(new this.constructor(this),this.e+1,1)},M_.valueOf=M_.toJSON=function(){var t=this,e=t.constructor,n=F_(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};var k_=function(){function t(t,e,n){var r,i=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+i,t[o]=r%n|0,i=r/n|0;return i&&t.unshift(i),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;ie[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;)t.shift()}return function(r,i,o,a,s,l){var u,c,h,d,f,p,v,g,y,m,C,w,x,S,E,_,b,T,L,I,O=r.constructor,R=r.s==i.s?1:-1,A=r.d,M=i.d;if(!(A&&A[0]&&M&&M[0]))return new O(r.s&&i.s&&(A?!M||A[0]!=M[0]:M)?A&&0==A[0]||!M?0*R:R/0:NaN);for(l?(f=1,c=r.e-i.e):(l=O_,f=7,c=E_(r.e/f)-E_(i.e/f)),L=M.length,b=A.length,m=(y=new O(R)).d=[],h=0;M[h]==(A[h]||0);h++);if(M[h]>(A[h]||0)&&c--,null==o?(S=o=O.precision,a=O.rounding):S=s?o+(r.e-i.e)+1:o,S<0)m.push(1),p=!0;else{if(S=S/f+2|0,h=0,1==L){for(d=0,M=M[0],S++;(h1&&(M=t(M,d,l),A=t(A,d,l),L=M.length,b=A.length),_=L,w=(C=A.slice(0,L)).length;w=l/2&&++T;do{d=0,(u=e(M,C,L,w))<0?(x=C[0],L!=w&&(x=x*l+(C[1]||0)),(d=x/T|0)>1?(d>=l&&(d=l-1),1==(u=e(v=t(M,d,l),C,g=v.length,w=C.length))&&(d--,n(v,L=10;d/=10)h++;y.e=h+c*f-1,z_(y,s?o+y.e+1:o,a,p)}return y}}();function z_(t,e,n,r){var i,o,a,s,l,u,c,h,d,f=t.constructor;t:if(null!=e){if(!(h=t.d))return t;for(i=1,s=h[0];s>=10;s/=10)i++;if((o=e-i)<0)o+=7,a=e,l=(c=h[d=0])/__(10,i-a-1)%10|0;else if((d=Math.ceil((o+1)/7))>=(s=h.length)){if(!r)break t;for(;s++<=d;)h.push(0);c=l=0,i=1,a=(o%=7)-7+1}else{for(c=s=h[d],i=1;s>=10;s/=10)i++;l=(a=(o%=7)-7+i)<0?0:c/__(10,i-a-1)%10|0}if(r=r||e<0||void 0!==h[d+1]||(a<0?c:c%__(10,i-a-1)),u=n<4?(l||r)&&(0==n||n==(t.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?a>0?c/__(10,i-a):0:h[d-1])%10&1||n==(t.s<0?8:7)),e<1||!h[0])return h.length=0,u?(e-=t.e+1,h[0]=__(10,(7-e%7)%7),t.e=-e||0):h[0]=t.e=0,t;if(0==o?(h.length=d,s=1,d--):(h.length=d+1,s=__(10,7-o),h[d]=a>0?(c/__(10,i-a)%__(10,a)|0)*s:0),u)for(;;){if(0==d){for(o=1,a=h[0];a>=10;a/=10)o++;for(a=h[0]+=s,s=1;a>=10;a/=10)s++;o!=s&&(t.e++,h[0]==O_&&(h[0]=1));break}if(h[d]+=s,h[d]!=O_)break;h[d--]=0,s=1}for(o=h.length;0===h[--o];)h.pop()}return y_&&(t.e>f.maxE?(t.d=null,t.e=NaN):t.e0?o=o.charAt(0)+"."+o.slice(1)+Y_(r):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+Y_(-i-1)+o,n&&(r=n-a)>0&&(o+=Y_(r))):i>=a?(o+=Y_(i+1-a),n&&(r=n-i-1)>0&&(o=o+"."+Y_(r))):((r=i+1)0&&(i+1===a&&(o+="."),o+=Y_(r))),o}function H_(t,e){var n=t[0];for(e*=7;n>=10;n/=10)e++;return e}function W_(t,e,n){if(e>R_)throw y_=!0,n&&(t.precision=n),Error(w_);return z_(new t(p_),e,1,!0)}function G_(t,e,n){if(e>A_)throw Error(w_);return z_(new t(v_),e,n,!0)}function U_(t){var e=t.length-1,n=7*e+1;if(e=t[e]){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function Y_(t){for(var e="";t--;)e+="0";return e}function j_(t,e,n,r){var i,o=new t(1),a=Math.ceil(r/7+4);for(y_=!1;;){if(n%2&&rb((o=o.times(e)).d,a)&&(i=!0),0===(n=E_(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}rb((e=e.times(e)).d,a)}return y_=!0,o}function V_(t){return 1&t.d[t.d.length-1]}function X_(t,e,n){for(var r,i=new t(e[0]),o=0;++o17)return new d(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(y_=!1,l=p):l=e,s=new d(.03125);t.e>-2;)t=t.times(s),h+=5;for(l+=r=Math.log(__(2,h))/Math.LN10*2+5|0,n=o=a=new d(1),d.precision=l;;){if(o=z_(o.times(t),l,1),n=n.times(++c),B_((s=a.plus(k_(o,n,l,1))).d).slice(0,l)===B_(a.d).slice(0,l)){for(i=h;i--;)a=z_(a.times(a),l,1);if(null!=e)return d.precision=p,a;if(!(u<3&&D_(a.d,l-r,f,u)))return z_(a,d.precision=p,f,y_=!0);d.precision=l+=10,n=o=s=new d(1),c=0,u++}a=s}}function q_(t,e){var n,r,i,o,a,s,l,u,c,h,d,f=1,p=t,v=p.d,g=p.constructor,y=g.rounding,m=g.precision;if(p.s<0||!v||!v[0]||!p.e&&1==v[0]&&1==v.length)return new g(v&&!v[0]?-1/0:1!=p.s?NaN:v?0:p);if(null==e?(y_=!1,c=m):c=e,g.precision=c+=10,r=(n=B_(v)).charAt(0),!(Math.abs(o=p.e)<15e14))return u=W_(g,c+2,m).times(o+""),p=q_(new g(r+"."+n.slice(1)),c-10).plus(u),g.precision=m,null==e?z_(p,m,y,y_=!0):p;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=B_((p=p.times(t)).d)).charAt(0),f++;for(o=p.e,r>1?(p=new g("0."+n),o++):p=new g(r+"."+n.slice(1)),h=p,l=a=p=k_(p.minus(1),p.plus(1),c,1),d=z_(p.times(p),c,1),i=3;;){if(a=z_(a.times(d),c,1),B_((u=l.plus(k_(a,new g(i),c,1))).d).slice(0,c)===B_(l.d).slice(0,c)){if(l=l.times(2),0!==o&&(l=l.plus(W_(g,c+2,m).times(o+""))),l=k_(l,new g(f),c,1),null!=e)return g.precision=m,l;if(!D_(l.d,c-10,y,s))return z_(l,g.precision=m,y,y_=!0);g.precision=c+=10,u=a=p=k_(h.minus(1),h.plus(1),c,1),d=z_(p.times(p),c,1),i=s=1}l=u,i+=2}}function Z_(t){return String(t.s*t.s/0)}function $_(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;48===e.charCodeAt(r);r++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(r,i)){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%7,n<0&&(r+=7),rt.constructor.maxE?(t.d=null,t.e=NaN):t.e-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),I_.test(e))return $_(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(T_.test(e))n=16,e=e.toLowerCase();else if(b_.test(e))n=2;else{if(!L_.test(e))throw Error(C_+e);n=8}for((o=e.search(/p/i))>0?(l=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),a=(o=e.indexOf("."))>=0,r=t.constructor,a&&(o=(s=(e=e.replace(".","")).length)-o,i=j_(r,new r(n),o,2*o)),o=c=(u=P_(e,n,O_)).length-1;0===u[o];--o)u.pop();return o<0?new r(0*t.s):(t.e=H_(u,c),t.d=u,y_=!1,a&&(t=k_(t,i,4*s)),l&&(t=t.times(Math.abs(l)<54?__(2,l):jb.pow(2,l))),y_=!0,t)}function J_(t,e,n,r,i){var o,a,s,l,u=t.precision,c=Math.ceil(u/7);for(y_=!1,l=n.times(n),s=new t(r);;){if(a=k_(s.times(l),new t(e++*e++),u,1),s=i?r.plus(a):r.minus(a),r=k_(a.times(l),new t(e++*e++),u,1),void 0!==(a=s.plus(r)).d[c]){for(o=c;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=r,r=a,a=o}return y_=!0,a.d.length=c+1,a}function tb(t,e){for(var n=t;--e;)n*=t;return n}function eb(t,e){var n,r=e.s<0,i=G_(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return n_=r?4:1,e;if((n=e.divToInt(i)).isZero())n_=r?3:2;else{if((e=e.minus(n.times(i))).lte(o))return n_=V_(n)?r?2:3:r?4:1,e;n_=V_(n)?r?1:4:r?3:2}return e.minus(i).abs()}function nb(t,e,n,r){var i,o,a,s,l,u,c,h,d,f=t.constructor,p=void 0!==n;if(p?(N_(n,1,d_),void 0===r?r=f.rounding:N_(r,0,8)):(n=f.precision,r=f.rounding),t.isFinite()){for(p?(i=2,16==e?n=4*n-3:8==e&&(n=3*n-2)):i=e,(a=(c=F_(t)).indexOf("."))>=0&&(c=c.replace(".",""),(d=new f(1)).e=c.length-a,d.d=P_(F_(d),10,i),d.e=d.d.length),o=l=(h=P_(c,10,i)).length;0==h[--l];)h.pop();if(h[0]){if(a<0?o--:((t=new f(t)).d=h,t.e=o,h=(t=k_(t,d,n,r,0,i)).d,o=t.e,u=e_),a=h[n],s=i/2,u=u||void 0!==h[n+1],u=r<4?(void 0!==a||u)&&(0===r||r===(t.s<0?3:2)):a>s||a===s&&(4===r||u||6===r&&1&h[n-1]||r===(t.s<0?8:7)),h.length=n,u)for(;++h[--n]>i-1;)h[n]=0,n||(++o,h.unshift(1));for(l=h.length;!h[l-1];--l);for(a=0,c="";a1)if(16==e||8==e){for(a=16==e?4:3,--l;l%a;l++)c+="0";for(l=(h=P_(c,i,e)).length;!h[l-1];--l);for(a=1,c="1.";al)for(o-=l;o--;)c+="0";else oe)return t.length=e,!0}function ib(t){return new this(t).abs()}function ob(t){return new this(t).acos()}function ab(t){return new this(t).acosh()}function sb(t,e){return new this(t).plus(e)}function lb(t){return new this(t).asin()}function ub(t){return new this(t).asinh()}function cb(t){return new this(t).atan()}function hb(t){return new this(t).atanh()}function db(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(n=e.s<0?G_(this,r,i):new this(0)).s=t.s:!t.d||e.isZero()?(n=G_(this,o,1).times(.5)).s=t.s:e.s<0?(this.precision=o,this.rounding=1,n=this.atan(k_(t,e,o,1)),e=G_(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(k_(t,e,o,1)):(n=G_(this,o,1).times(e.s>0?.25:.75)).s=t.s:n=new this(NaN),n}function fb(t){return new this(t).cbrt()}function pb(t){return z_(t=new this(t),t.e+1,2)}function vb(t,e,n){return new this(t).clamp(e,n)}function gb(t){if(!t||"object"!=typeof t)throw Error(m_+"Object expected");var e,n,r,i=!0===t.defaults,o=["precision",1,d_,"rounding",0,8,"toExpNeg",-h_,0,"toExpPos",0,h_,"maxE",0,h_,"minE",-h_,0,"modulo",0,9];for(e=0;e=o[e+1]&&r<=o[e+2]))throw Error(C_+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=g_[n]),void 0!==(r=t[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(C_+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(x_);this[n]=!0}else this[n]=!1}return this}function yb(t){return new this(t).cos()}function mb(t){return new this(t).cosh()}function Cb(t,e){return new this(t).div(e)}function wb(t){return new this(t).exp()}function xb(t){return z_(t=new this(t),t.e+1,3)}function Sb(){var t,e,n=new this(0);for(y_=!1,t=0;t=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(x_);for(e=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(e,o):(s.push(i%1e7),o+=4);o=r/4}else for(;o=10;i/=10)r++;r<7&&(n-=7-r)}return a.e=n,a.d=s,a}function Nb(t){return z_(t=new this(t),t.e+1,this.rounding)}function Db(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function Pb(t){return new this(t).sin()}function kb(t){return new this(t).sinh()}function zb(t){return new this(t).sqrt()}function Fb(t,e){return new this(t).sub(e)}function Hb(){var t=0,e=arguments,n=new this(e[t]);for(y_=!1;n.s&&++to.maxE?(i.e=NaN,i.d=null):t.e=10;n/=10)e++;return void(y_?e>o.maxE?(i.e=NaN,i.d=null):e=_&&(a=_-C),s+w>=b&&(s=b-w),{x:a,y:s}},Jb=function(t){return UC({operator:{onClick:cs,menus:[]},enterable:!0,enableFormat:!0},t)},tT=function(t){return UC(UC({},null==t?void 0:t.colQuery),null==t?void 0:t.rowQuery)},eT=function(t,e){var n;if(t){var r=e.style,i=e.className,o=void 0===i?[]:i,a=e.visible;if(r&&Object.assign(t.style,r),o.length){var s=o.filter(Boolean);(n=t.classList).add.apply(n,XC([],VC(s),!1))}t.classList.toggle(hw,a),t.classList.toggle(dw,!a)}},nT=function(t){var e=uv(t)&&Number.isNaN(t),n=""===t;return dv(t)||e||n?"-":t},rT=function(t,e){var n,r=null===(n=null==t?void 0:t.dataSet)||void 0===n?void 0:n.getFieldFormatter(e);return function(t,e){return nT(r(t,e))}},iT=function(t,e){var n,r=e.data,i=e.field,o=e.valueField,a=e.useCompleteDataForFormatter,s=void 0===a||a,l=null===(n=null==t?void 0:t.dataSet)||void 0===n?void 0:n.getFieldName(i),u=rT(t,i),c=_a(r[i])?JSON.stringify(r[i]):r[i];return{name:l,value:u(o||c,s?r:void 0)}},oT=function(t,e,n){return op(Xf(nd([],e),(function(t){return t!==fo&&n[t]})),(function(e){return iT(t,{data:n,field:e,useCompleteDataForFormatter:!1})}))},aT=function(t,e,n){var r,i,o,a,s=(n||{}).isTotals,l=[],u=[];if(e){var c=null===(i=null===(r=null==t?void 0:t.dataSet)||void 0===r?void 0:r.fields)||void 0===i?void 0:i.columns,h=null===(a=null===(o=null==t?void 0:t.dataSet)||void 0===o?void 0:o.fields)||void 0===a?void 0:a.rows;l=oT(t,c,e),u=oT(t,h,e)}return ov(l)&&ov(u)&&s&&(l=[{value:lw("总计")}]),{cols:l,rows:u}},sT=function(t,e,n){if(e){var r=n.isTotals,i=e[fo],o=e[i],a=[];if(r)a.push(iT(t,{data:e,field:i,valueField:Su(e,ho)}));else if(function(t){return _a(t)&&"values"in t}(o)&&t.getTooltipDataItemMappingCallback()){var s=TS(e,t.getTooltipDataItemMappingCallback());Tf(s,(function(e,n){a.push(iT(t,{data:s,field:n}))}))}else a.push(iT(t,{data:e,field:i}));return a}},lT=function(t,e,n){var r;if(n)return lw("总计");var i=null===(r=null==t?void 0:t.dataSet)||void 0===r?void 0:r.getFieldName(e);return i&&"undefined"!==i?i:""},uT=function(t,e,n){void 0===n&&(n=!0);var r=[];return Tf(e,(function(e,i){Tf(t,(function(t){n||-1===t.colIndex?n&&-1!==t.rowIndex&&r.push([t.rowIndex,i]):r.push([i,t.colIndex])}))})),r},cT=function(e,n){var r,i=n.rowLeafNodes,o=n.colLeafNodes,a=e.interaction.getState(),s=a.nodes,l=void 0===s?[]:s,u=a.cells,c=void 0===u?[]:u,h=null===(r=null==c?void 0:c[0])||void 0===r?void 0:r.type;return h===t.CellTypes.COL_CELL?uT(l,i,!1):h===t.CellTypes.ROW_CELL?uT(l,o):[]},hT=function(e,n,r){var i,o=null===(i=e.facet)||void 0===i?void 0:i.layoutResult,a=function(e){var r=null==n?void 0:n.getMeta(),i=null==r?void 0:r.isTotals,a=(null==n?void 0:n.cellType)===t.CellTypes.COL_CELL,s=(null==n?void 0:n.cellType)===t.CellTypes.ROW_CELL;if(!a&&!s)return!1;var l=o.colNodes.find((function(t){return t.colIndex===e.colIndex})),u=o.rowNodes.find((function(t){return t.rowIndex===e.rowIndex})),c=a?null==u?void 0:u.isTotals:null==l?void 0:l.isTotals;return!i&&(null==e?void 0:e.isTotals)||i&&c};return r?ed(op(cT(e,o),(function(t){var e=VC(t,2),n=e[0],r=e[1],i=o.getCellMeta(n,r);if(!a(i))return(null==i?void 0:i.data)||tT(i)}))):e.interaction.getActiveCells().filter((function(t){var e=null==t?void 0:t.getMeta();return!a(e)})).map((function(t){var e=null==t?void 0:t.getMeta();return(null==e?void 0:e.data)||tT(e)}))},dT=function(t){var e=t.spreadsheet,n=t.getShowValue,r=t.targetCell,i=t.options,o=void 0===i?{}:i,a=[],s={},l=e.isTableMode();return l&&(null==o?void 0:o.showSingleTips)?[{selectedData:e.dataSet.getMultiData({}),name:"",value:""}]:(Tf(hT(e,r,o.showSingleTips),(function(t){var e;s[null==t?void 0:t[fo]]?null===(e=s[null==t?void 0:t[fo]])||void 0===e||e.push(t):s[null==t?void 0:t[fo]]=[t]})),Rv(s,(function(t,r){var i,u=lT(e,r,null==o?void 0:o.isTotals),c=null==n?void 0:n(t,ho);if(l)c="";else if(Yf(t,(function(t){return Xb(Su(t,ho))}))){var h=e.options.placeholder;c=Wx(s,h)}else{var d=rT(e,r),f=qb(t,ho);c=null!==(i=null==d?void 0:d(f,t))&&void 0!==i?i:parseFloat(f.toPrecision(16))}a.push({selectedData:t,name:u,value:c})})),a)},fT=function(t){if(t){var e=t.getMeta();if(!e.isTotals){var n=$f(e.spreadsheet.dataCfg.meta,{field:e.field||e.value||e.valueField}),r=null==n?void 0:n.field;return e.spreadsheet.dataSet.getFieldDescription(r)}}},pT=function(t){var e=t.spreadsheet,n=t.cellInfos,r=void 0===n?[]:n,i=t.options,o=void 0===i?{}:i,a=t.getShowValue,s=t.targetCell,l=null,u=null,c=null,h=fT(s),d=r[0]||{};if(null==o?void 0:o.hideSummary)if(o.showSingleTips){var f=function(t){var n,r;return null===(r=$f(null===(n=e.dataCfg)||void 0===n?void 0:n.meta,(function(e){return(null==e?void 0:e.field)===t})))||void 0===r?void 0:r.name},p=rT(e,d.valueField)(d.value),v=o.enableFormat?f(d.value)||p:f(d.valueField);d.name=v||""}else u=aT(e,d,o),c=sT(e,d,o);else l=dT({spreadsheet:e,options:o,targetCell:s,getShowValue:a});var g=d||{};return{summaries:l,interpretation:g.interpretation,infos:g.infos,tips:g.tips,name:g.name,headInfo:u,details:c,description:h}},vT=function(t){return op(t,(function(t){var e=t.getMeta();return Yl({},e.query||{},Gg(e,["colIndex","rowIndex"]))}))},gT=function(t){var e=[];return t.interaction.isSelectedState()?(t.interaction.getActiveCells().forEach((function(n){var r=t.dataCfg.fields.valueInCols,i=n.getMeta(),o=tT(i);if(!ov(i)&&!ov(o)){var a=UC(UC({},o),{colIndex:r?i.colIndex:null,rowIndex:r?null:i.rowIndex});e.find((function(t){return av(a,t)}))||e.push(a)}})),e):[]},yT=function(e,n){void 0===e&&(e={});var r=function(t){return s_(e,t)},i=e.col,o=e.row,a=e.data,s=e.corner;return n===t.CellTypes.COL_CELL?r(i):n===t.CellTypes.ROW_CELL?r(o):n===t.CellTypes.DATA_CELL?r(a):n===t.CellTypes.CORNER_CELL?r(s):UC({},e)},mT=function(t,e){var n;if(e&&t){var r=null===(n=t.getCellType)||void 0===n?void 0:n.call(t,null==e?void 0:e.target);return yT(t.options.tooltip,r)}},CT=function(t,e){var n=e.defaultMenus,r=void 0===n?[]:n,i=e.cell,o=function(t){return void 0===t&&(t=[]),t.filter((function(t){var e;return Na(t.visible)?t.visible(i):null===(e=t.visible)||void 0===e||e})).map((function(t){return t.children&&(t.children=o(t.children)),t}))},a=o(t.menus);return{onClick:t.onClick,menus:ed(XC(XC([],VC(r),!1),VC(a),!1))}},wT=function(t,e){for(var n=!1,r=e;r&&r!==document.body;){if(t===r){n=!0;break}r=r.parentElement}return n},xT=function(){function t(t){var e=this;this.getFieldMeta=fu((function(t,n){return $f(e.meta||n,(function(e){return e.field===t}))})),this.spreadsheet=t}return t.prototype.getFieldName=function(t){return Su(this.getFieldMeta(t,this.meta),"name",t)},t.prototype.getFieldFormatter=function(t){return Su(this.getFieldMeta(t,this.meta),"formatter",Ba)},t.prototype.getFieldDescription=function(t){return Su(this.getFieldMeta(t,this.meta),"description")},t.prototype.setDataCfg=function(t){this.getFieldMeta.cache.clear();var e=this.processDataCfg(t),n=e.fields,r=e.meta,i=e.data,o=e.totalData,a=e.sortParams,s=e.filterParams;this.fields=n,this.meta=r,this.originData=i,this.totalData=o,this.sortParams=a,this.filterParams=s,this.displayData=this.originData,this.indexesData=[]},t.prototype.getDisplayDataSet=function(){return this.displayData},t.prototype.getValueRangeByField=function(t){var e,n,r,i=(n=this.spreadsheet,r=t,n.store.get(qo,Zo)[r]);if(i)return i;var o=ed(op(this.originData,(function(e){var n=e[t];return dv(n)?null:Number.parseFloat(n)}))),a={maxValue:Bv(o),minValue:Uv(o)};return function(t,e){var n=t.store.get(qo,Zo);t.store.set(qo,UC(UC({},n),e))}(this.spreadsheet,((e={})[t]=a,e)),a},t.prototype.moreThanOneValue=function(){var t,e;return(null===(e=null===(t=this.fields)||void 0===t?void 0:t.values)||void 0===e?void 0:e.length)>1},t}(),ST=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handleDimensionValuesSort=function(){Tf(e.sortParams,(function(t){var n=t.sortFieldId,r=t.sortByMeasure;if(n){var i=XC([],VC(e.sortedDimensionValues[n]||[]),!1),o=mE({dataSet:e,sortParam:t,originValues:i,isSortByMeasure:!ov(r)});e.sortedDimensionValues[n]=o}}))},e.getCustomData=function(t){for(var n,r=!1,i=e.indexesData,o=function(e){var o=t[e];r?i=gv(o)?tx(i):null===(n=Lp(i))||void 0===n?void 0:n.map((function(t){return t&&Su(t,o)})):gv(o)?r=!0:i=null==i?void 0:i[o]},a=0;a=t?(n.splice(t,0,fo),n):XC(XC([],VC(n),!1),[fo],!1)},e.prototype.isCustomMeasuresPosition=function(t){return uv(t)},e}(xT),ET=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handleDimensionValueFilter=function(){Tf(e.filterParams,(function(t){var n=t.filterKey,r=t.filteredValues,i=t.customFilter,o=function(t){return t[n]&&!Op(r,t[n])};e.displayData=XC(XC(XC([],VC(e.getStartRows()),!1),VC(Xf(e.getMovableRows(),(function(t){return i?i(t)&&o(t):o(t)}))),!1),VC(e.getEndRows()),!1)}))},e.handleDimensionValuesSort=function(){Tf(e.sortParams,(function(t){var n=t.sortFieldId,r=t.sortBy,i=t.sortFunc,o=t.sortMethod,a=t.query;if(n){var s=e.getMovableRows(),l=[];if(a){var u=[];s.forEach((function(t){for(var e=Object.keys(a),n=!0,r=0;rn.trackLen?e=n.trackLen-n.thumbLen:t+n.thumbLen=e})).map((function(t){return t[n]})).reduce((function(t,e){return t+e}),0)},LT=function(t,e,n){if(n<=0)return{start:0,end:0};var r=Zf(t,(function(n,r){return e>=n&&ee&&n<=t[r+1]}),r);return{start:r,end:i=Math.min(-1===i?1/0:i,t.length-2)}},IT=function(t,e){var n=e.width,r=e.originalWidth,i=Math.min(r-n,t);return i<0?0:i},OT=function(t,e,n){var r=Math.min(e-n,t);return r<0?0:r},RT=function(t,e){if(void 0===t&&(t=[]),ov(t))return[];var n=[];return t.forEach((function(t){(t instanceof e&&n.push(t),t instanceof xi)&&t.getChildren().forEach((function(t){t instanceof e&&n.push(t)}))})),n},AT=function(t,e,n){return n.slice(t,e+1).map((function(t){return t.x+t.width}))},MT=function(t,e,n){for(var r=[],i=t;i=i&&t<=o&&e>=a&&e<=s},NT=function(t){for(var e=VC(t,4),n=e[0],r=e[1],i=e[2],o=e[3],a=[],s=n;s<=r;s+=1)for(var l=i;l<=o;l+=1)a.push([s,l]);return a},DT=function(t,e){var n=[],r=[];return Object.keys(e).forEach((function(i){var o=function(t,e){var n=[],r=[];if(ov(t))return ov(e)?{add:n,remove:r}:{add:NT(e),remove:r};if(ov(e))return{add:n,remove:NT(t)};for(var i=VC(t,4),o=i[0],a=i[1],s=i[2],l=i[3],u=VC(e,4),c=u[0],h=u[1],d=u[2],f=u[3],p=o;p<=a;p++)for(var v=s;v<=l;v++)BT(p,v,e)||r.push([p,v]);for(p=c;p<=h;p+=1)for(v=d;v<=f;v+=1)BT(p,v,t)||n.push([p,v]);return{add:n,remove:r}}((null==t?void 0:t[i])||[],e[i]),a=o.add,s=o.remove;n.push.apply(n,XC([],VC(a),!1)),r.push.apply(r,XC([],VC(s),!1))})),{add:n,remove:r}},PT=function(t,e){void 0===e&&(e=!1),this.x=0,this.y=0,this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.width=0,this.height=0,this.originalWidth=0,this.originalHeight=0,this.viewportHeight=0,this.viewportWidth=0,this.facet=t,this.spreadsheet=t.spreadsheet,this.layoutResult=t.layoutResult,e&&this.calculateBBox()},kT=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return GC(e,t),e.prototype.calculateBBox=function(){var t=this.getCornerBBoxWidth(),e=this.getCornerBBoxHeight();this.width=t,this.height=e,this.maxX=t,this.maxY=e},e.prototype.getCornerBBoxHeight=function(){var t=this.layoutResult.colsHierarchy;return this.originalHeight=Math.floor(t.height),this.originalHeight},e.prototype.getCornerBBoxWidth=function(){var t=this.layoutResult.rowsHierarchy;return this.originalWidth=Math.floor(t.width+this.facet.getSeriesNumberWidth()),this.spreadsheet.isScrollContainsRowHeader()?this.originalWidth:this.adjustCornerBBoxWidth()},e.prototype.adjustCornerBBoxWidth=function(){var t=this.layoutResult.colsHierarchy,e=this.spreadsheet.options.width,n=.5*e,r=null==t?void 0:t.width,i=e-this.originalWidth;if(this.originalWidth<=n||r<=i)return this.originalWidth;var o=0;return o=r<=e-n?this.originalWidth-(r-i):n,Math.floor(o)},e}(PT),zT=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return GC(e,t),e.prototype.calculateBBox=function(){this.originalWidth=this.facet.getRealWidth(),this.originalHeight=this.facet.getRealHeight();var t=this.facet.cornerBBox,e={x:Math.floor(t.maxX),y:Math.floor(t.maxY)},n=this.spreadsheet.theme.scrollBar.size,r=this.spreadsheet.options,i=r.width,o=r.height,a=Math.max(0,i-e.x),s=Math.max(0,o-e.y-n);this.x=e.x,this.y=e.y,this.width=a,this.height=s,this.viewportHeight=Math.abs(Math.floor(Math.min(s,this.originalHeight))),this.viewportWidth=Math.abs(Math.floor(Math.min(a,this.originalWidth))),this.maxX=e.x+this.viewportWidth,this.maxY=e.y+this.viewportHeight,this.minX=e.x,this.minY=e.y;var l=this.spreadsheet.options,u=l.frozenTrailingColCount,c=l.frozenTrailingRowCount;u>0&&(this.viewportWidth=this.width,this.maxX=e.x+this.width),c>0&&(this.viewportHeight=this.height,this.maxY=e.y+this.height)},e}(PT),FT=function(t){function e(e){var n=t.call(this,e)||this;return n.isHeaderCellInViewport=function(t,e,n,r){return t+e>=n&&n+r>=t},n.headerConfig=e,n}return GC(e,t),e.prototype.clearResizeAreaGroup=function(t){var e=this.get("parent"),n=null==e?void 0:e.findById(t);null==n||n.clear()},e.prototype.render=function(t){this.clearResizeAreaGroup(t),this.clear(),this.layout(),this.offset(),this.clip()},e.prototype.onScrollXY=function(t,e,n){this.headerConfig.scrollX=t,this.headerConfig.scrollY=e,this.render(n)},e.prototype.onRowScrollX=function(t,e){this.headerConfig.scrollX=t,this.render(e)},e.prototype.clear=function(){t.prototype.clear.call(this)},e}(xi),HT=function(t){function e(e){var n=t.call(this,e)||this;return n.scrollGroup=n.addGroup({name:Do,zIndex:3}),n}return GC(e,t),e.prototype.onColScroll=function(t,e){this.headerConfig.scrollX!==t&&(this.headerConfig.scrollX=t,this.render(e))},e.prototype.clip=function(){var t=this.headerConfig,e=t.width,n=t.height,r=t.scrollX,i=t.spreadsheet.isFrozenRowHeader();this.scrollGroup.setClip({type:"rect",attrs:{x:i?r:0,y:0,width:i?e:e+r,height:n}})},e.prototype.clear=function(){var t,e;null===(t=this.scrollGroup)||void 0===t||t.clear(),null===(e=this.background)||void 0===e||e.remove(!0)},e.prototype.getCellInstance=function(t,e,n){return new xE(t,e,n)},e.prototype.getCellGroup=function(t){return this.scrollGroup},e.prototype.isColCellInRect=function(t){var e=this.headerConfig,n=e.spreadsheet,r=e.cornerWidth,i=e.width,o=e.scrollX;return i+o>t.x&&o-(n.isFrozenRowHeader()?0:r)0,this.cfg.showViewportRightShadow=Math.floor(t)t.y&&ut.x&&c-l=0;e--){var r=t[e];r instanceof xi?r.set("children",[]):t[e].remove()}n.foregroundGroup.set("children",[]),n.backgroundGroup.set("children",[])},this.scrollWithAnimation=function(t,e,r){var i,o;void 0===t&&(t={}),void 0===e&&(e=200);var a=n.getAdjustedScrollOffset({scrollX:(null===(i=t.offsetX)||void 0===i?void 0:i.value)||0,scrollY:(null===(o=t.offsetY)||void 0===o?void 0:o.value)||0}),s=a.scrollX,l=a.scrollY;n.timer&&n.timer.stop();var u=Object.values(n.getScrollOffset()),c=$e(u,[void 0===s?u[0]:s,void 0===l?u[1]:l]);n.timer=ce((function(t){var i=Math.min(t/e,1),o=VC(c(i),2),a=o[0],s=o[1];n.setScrollOffset({scrollX:a,scrollY:s}),n.startScroll(),t>e&&(n.timer.stop(),null==r||r())}))},this.scrollImmediately=function(t){var e,r;void 0===t&&(t={});var i=n.getAdjustedScrollOffset({scrollX:(null===(e=t.offsetX)||void 0===e?void 0:e.value)||0,scrollY:(null===(r=t.offsetY)||void 0===r?void 0:r.value)||0}),o=i.scrollX,a=i.scrollY;n.setScrollOffset({scrollX:o,scrollY:a}),n.startScroll()},this.startScroll=function(t){var e,r;void 0===t&&(t=!1);var i=n.getScrollOffset(),o=i.scrollX,a=i.scrollY;null===(e=n.hScrollBar)||void 0===e||e.onlyUpdateThumbOffset(n.getScrollBarOffset(o,n.hScrollBar)),null===(r=n.vScrollBar)||void 0===r||r.onlyUpdateThumbOffset(n.getScrollBarOffset(a,n.vScrollBar)),n.dynamicRenderCell(t)},this.getRendererHeight=function(){var t=n.getCellRange(),e=t.start,r=t.end;return n.viewCellHeights.getCellOffsetY(r+1)-n.viewCellHeights.getCellOffsetY(e)},this.getAdjustedScrollOffset=function(t){var e=t.scrollX,r=t.scrollY,i=t.hRowScrollX;return{scrollX:OT(e,n.layoutResult.colsHierarchy.width,n.panelBBox.width),scrollY:OT(r,n.getRendererHeight(),n.panelBBox.height),hRowScrollX:IT(i,n.cornerBBox)}},this.renderRowScrollBar=function(e){if(!n.cfg.spreadsheet.isScrollContainsRowHeader()&&n.cornerBBox.widthn.panelBBox.minX&&en.panelBBox.minY&&rn.cornerBBox.minX&&en.cornerBBox.minY&&r=n.cornerBBox.width,f=n.hRowScrollBar&&n.isScrollOverTheCornerArea({offsetX:u,offsetY:c})||(null===(a=n.hScrollBar)||void 0===a?void 0:a.thumbOffset)+(null===(s=n.hScrollBar)||void 0===s?void 0:s.thumbLen)>=h;return l>=0&&f&&d},this.isScrollToTop=function(t){var e;return!n.vScrollBar||t<=0&&(null===(e=n.vScrollBar)||void 0===e?void 0:e.thumbOffset)<=0},this.isScrollToBottom=function(t){var e,r,i;return!n.vScrollBar||t>=0&&(null===(e=n.vScrollBar)||void 0===e?void 0:e.thumbOffset)+(null===(r=n.vScrollBar)||void 0===r?void 0:r.thumbLen)>=(null===(i=n.panelBBox)||void 0===i?void 0:i.height)},this.isVerticalScrollOverTheViewport=function(t){return!n.isScrollToTop(t)&&!n.isScrollToBottom(t)},this.isHorizontalScrollOverTheViewport=function(t){return!n.isScrollToLeft(t)&&!n.isScrollToRight(t)},this.isScrollOverTheViewport=function(t){var e=t.deltaY,r=t.deltaX;return!(t.offsetY<=n.cornerBBox.maxY)&&(0!==e?n.isVerticalScrollOverTheViewport(e):0!==r&&n.isHorizontalScrollOverTheViewport(t))},this.cancelScrollFrame=function(){return(!Cw()||!n.scrollFrameId)&&(cancelAnimationFrame(n.scrollFrameId),!0)},this.clearScrollFrameIdOnMobile=function(){Cw()&&(n.scrollFrameId=null)},this.stopScrollChainingIfNeeded=function(t){"auto"!==n.spreadsheet.options.interaction.overscrollBehavior&&n.stopScrollChaining(t)},this.stopScrollChaining=function(t){var e,n,r;null===(e=null==t?void 0:t.preventDefault)||void 0===e||e.call(t),null===(r=null===(n=null==t?void 0:t.originalEvent)||void 0===n?void 0:n.preventDefault)||void 0===r||r.call(n)},this.onWheel=function(e){var r=n.spreadsheet.options.interaction,i=e.deltaX,o=e.deltaY,a=e.offsetX,s=e.offsetY,l=VC(function(t,e,n){var r=Math.abs(t/e),i=r>2?0:e;return[(r<=.5?0:t)*n.horizontal,i*n.vertical]}(i,o,r.scrollSpeedRatio),2),u=l[0],c=l[1];n.spreadsheet.hideTooltip(),n.spreadsheet.interaction.clearHoverTimer(),n.isScrollOverTheViewport({deltaX:u,deltaY:c,offsetX:a,offsetY:s})?(n.stopScrollChaining(e),n.spreadsheet.interaction.addIntercepts([t.InterceptType.HOVER]),n.cancelScrollFrame()&&(n.scrollFrameId=requestAnimationFrame((function(){var t,e=n.getScrollOffset(),r=e.scrollX,i=e.scrollY,o=e.hRowScrollX;0!==u&&(n.showHorizontalScrollBar(),n.updateHorizontalRowScrollOffset({offsetX:a,offsetY:s,offset:u+o}),n.updateHorizontalScrollOffset({offsetX:a,offsetY:s,offset:u+r})),0!==c&&(n.showVerticalScrollBar(),null===(t=n.vScrollBar)||void 0===t||t.emitScrollChange(c+i)),n.delayHideScrollbarOnMobile(),n.clearScrollFrameIdOnMobile()})))):n.stopScrollChainingIfNeeded(e)},this.addCell=function(t){var e=n.spreadsheet.panelScrollGroup;null==e||e.add(t)},this.realCellRender=function(t,e){var r=n.calculateXYIndexes(t,e);Fw.getInstance().logger("renderIndex:",n.preCellIndexes,r);var i=DT(n.preCellIndexes,r),o=i.add,a=i.remove;Fw.getInstance().debugCallback(zw,(function(){Tf(o,(function(t){var e=VC(t,2),r=e[0],i=e[1],o=n.layoutResult.getCellMeta(i,r);if(o){var a=n.cfg.dataCell(o);a.set("name","".concat(r,"-").concat(i)),n.addCell(a)}}));var t=RT(n.panelGroup.getChildren(),OS);Tf(a,(function(e){var n=VC(e,2),r=n[0],i=n[1],o=$f(t,(function(t){return t.get("name")==="".concat(r,"-").concat(i)}));null==o||o.remove(!0)})),Fw.getInstance().logger("Render Cell Panel: ".concat(null==t?void 0:t.length,", Add: ").concat(null==o?void 0:o.length,", Remove: ").concat(null==a?void 0:a.length))})),n.preCellIndexes=r},this.getGridInfo=function(){var t=VC(n.preCellIndexes.center,4),e=t[0],r=t[1],i=t[2],o=t[3];return{cols:AT(e,r,n.layoutResult.colLeafNodes),rows:MT(i,o,n.viewCellHeights)}},this.onAfterScroll=Kd((function(){n.spreadsheet.interaction.isSelectedState()||n.spreadsheet.interaction.removeIntercepts([t.InterceptType.HOVER])}),300),this.cfg=e,this.spreadsheet=e.spreadsheet,this.init()}return Object.defineProperty(e.prototype,"scrollBarTheme",{get:function(){return this.spreadsheet.theme.scrollBar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollBarSize",{get:function(){return this.scrollBarTheme.size},enumerable:!1,configurable:!0}),e.prototype.getCellCustomWidth=function(t,e){return Na(e)?null==e?void 0:e(t):e},e.prototype.getCellDraggedWidth=function(t){var e=this.cfg.colCfg;return Su(null==e?void 0:e.widthByFieldValue,"".concat(t.value),t.width)},e.prototype.render=function(){this.adjustScrollOffset(),this.renderHeaders(),this.renderScrollBars(),this.renderBackground(),this.dynamicRenderCell()},e.prototype.adjustScrollOffset=function(){var t=this.getAdjustedScrollOffset(this.getScrollOffset()),e=t.scrollX,n=t.scrollY,r=t.hRowScrollX;this.setScrollOffset({scrollX:e,scrollY:n,hRowScrollX:r})},e.prototype.getSeriesNumberWidth=function(){return this.cfg.showSeriesNumber?this.spreadsheet.theme.rowCell.seriesNumberWidth:0},e.prototype.getCanvasHW=function(){return{width:this.cfg.width,height:this.cfg.height}},e.prototype.getContentHeight=function(){var t=this.layoutResult,e=t.rowsHierarchy,n=t.colsHierarchy;return e.height+n.height},e.prototype.updateScrollOffset=function(t){var e,n,r,i;void 0===(null===(e=t.offsetX)||void 0===e?void 0:e.value)?void 0!==(null===(r=t.offsetY)||void 0===r?void 0:r.value)&&((null===(i=t.offsetY)||void 0===i?void 0:i.animate)?this.scrollWithAnimation(t):this.scrollImmediately(t)):(null===(n=t.offsetX)||void 0===n?void 0:n.animate)?this.scrollWithAnimation(t):this.scrollImmediately(t)},e.prototype.getPaginationScrollY=function(){var t=this.cfg.pagination;if(t){var e=t.current,n=void 0===e?1:e,r=t.pageSize,i=this.viewCellHeights,o=Math.max((n-1)*r,0);return i.getCellOffsetY(o)}return 0},e.prototype.destroy=function(){this.unbindEvents(),this.clearAllGroup(),this.preCellIndexes=null,cancelAnimationFrame(this.scrollFrameId)},e.prototype.calculateXYIndexes=function(t,e){var n=this.panelBBox,r=n.viewportHeight,i=n.viewportWidth;return{center:HE(t,e,this.viewCellWidths,this.viewCellHeights,{width:i,height:r,x:0,y:0},this.getRealScrollX(this.cornerBBox.width))}},e.prototype.calculateCornerBBox=function(){this.cornerBBox=new kT(this,!0)},e.prototype.getCellRange=function(){var t=this.cfg.pagination;return function(t,e){var n=t,r=0,i=n.getTotalLength()-1;if(e){var o=e.current,a=void 0===o?1:o,s=e.pageSize;r=Math.max((a-1)*s,0),i=Math.min(a*s-1,n.getTotalLength()-1)}return{start:r,end:i}}(this.viewCellHeights,t)},e.prototype.clip=function(t,e){var n,r=this.spreadsheet.isFrozenRowHeader();null===(n=this.spreadsheet.panelScrollGroup)||void 0===n||n.setClip({type:"rect",attrs:{x:r?t:0,y:e,width:this.panelBBox.width+(r?0:t),height:this.panelBBox.height}})},e.prototype.translateRelatedGroups=function(t,e,n){var r,i;WE(this.spreadsheet.panelScrollGroup,this.cornerBBox.width-t,this.cornerBBox.height-e),null===(r=this.rowHeader)||void 0===r||r.onScrollXY(this.getRealScrollX(t,n),e,Io),null===(i=this.rowIndexHeader)||void 0===i||i.onScrollXY(this.getRealScrollX(t,n),e,Ao),this.cornerHeader.onCorScroll(this.getRealScrollX(t,n),Mo),this.centerFrame.onChangeShadowVisibility(t,this.getRealWidth()-this.panelBBox.width),this.centerFrame.onBorderScroll(this.getRealScrollX(t)),this.columnHeader.onColScroll(t,Bo)},e.prototype.init=function(){var e=this;Fw.getInstance().debugCallback(kw,(function(){e.layoutResult=e.doLayout(),e.saveInitColumnLeafNodes(e.layoutResult.colLeafNodes),e.spreadsheet.emit(t.S2Event.LAYOUT_AFTER_HEADER_LAYOUT,e.layoutResult)})),this.calculateCellWidthHeight(),this.calculateCornerBBox(),this.calculatePanelBBox(),this.clipPanelGroup(),this.bindEvents()},e.prototype.renderBackground=function(){var t=this.getCanvasHW(),e=t.width,n=t.height,r=this.spreadsheet.theme.background,i=r.color,o=r.opacity;this.backgroundGroup.addShape("rect",{attrs:{fill:i,opacity:o,x:0,y:0,width:e,height:n}})},e.prototype.renderScrollBars=function(){var t=this.getScrollOffset(),e=t.scrollX,n=t.scrollY,r=t.hRowScrollX,i=this.panelBBox,o=i.width,a=i.height,s=this.layoutResult.colsHierarchy.width,l=this.getRealHeight();this.renderRowScrollBar(r),this.renderHScrollBar(o,s,e),this.renderVScrollBar(a,l,n)},e.prototype.renderHeaders=function(){var t=this.getSeriesNumberWidth();this.rowHeader=this.getRowHeader(),this.columnHeader=this.getColHeader(),t>0&&!this.rowIndexHeader&&(this.rowIndexHeader=this.getSeriesNumberHeader()),this.cornerHeader=this.getCornerHeader(),this.centerFrame=this.getCenterFrame(),this.rowIndexHeader&&this.foregroundGroup.add(this.rowIndexHeader),this.rowHeader&&this.foregroundGroup.add(this.rowHeader),this.foregroundGroup.add(this.columnHeader),this.foregroundGroup.add(this.cornerHeader),this.foregroundGroup.add(this.centerFrame)},e.prototype.getRowHeader=function(){var t,e,n;if(!this.rowHeader){var r=this.panelBBox,i=r.y,o=r.viewportHeight,a=r.viewportWidth,s=r.height,l=this.getSeriesNumberWidth();return new UT({width:this.cornerBBox.width,height:s,viewportWidth:a,viewportHeight:o,position:{x:0,y:i},data:this.layoutResult.rowNodes,hierarchyType:this.cfg.hierarchyType,linkFields:null!==(n=null===(e=null===(t=this.cfg.spreadsheet.options)||void 0===t?void 0:t.interaction)||void 0===e?void 0:e.linkFields)&&void 0!==n?n:[],seriesNumberWidth:l,spreadsheet:this.spreadsheet})}return this.rowHeader},e.prototype.getColHeader=function(){if(!this.columnHeader){var t=this.panelBBox,e=t.x,n=t.width,r=t.viewportHeight,i=t.viewportWidth;return new HT({width:n,cornerWidth:this.cornerBBox.width,height:this.cornerBBox.height,viewportWidth:i,viewportHeight:r,position:{x:e,y:0},data:this.layoutResult.colNodes,scrollContainsRowHeader:this.cfg.spreadsheet.isScrollContainsRowHeader(),sortParam:this.cfg.spreadsheet.store.get("sortParam"),spreadsheet:this.spreadsheet})}return this.columnHeader},e.prototype.getCornerHeader=function(){return this.cornerHeader?this.cornerHeader:WT.getCornerHeader(this.panelBBox,this.cornerBBox,this.getSeriesNumberWidth(),this.cfg,this.layoutResult,this.spreadsheet)},e.prototype.getSeriesNumberHeader=function(){return YT.getSeriesNumberHeader(this.panelBBox,this.getSeriesNumberWidth(),this.layoutResult.rowsHierarchy.getNodes(0),this.spreadsheet,this.cornerBBox.width)},e.prototype.getCenterFrame=function(){var t;if(!this.centerFrame){var e=this.panelBBox,n=e.viewportWidth,r=e.viewportHeight,i=this.cornerBBox.width,o=this.cornerBBox.height,a=null===(t=this.cfg)||void 0===t?void 0:t.frame,s={position:{x:this.cornerBBox.x,y:this.cornerBBox.y},width:i,height:o,viewportWidth:n,viewportHeight:r,showViewportLeftShadow:!1,showViewportRightShadow:!1,scrollContainsRowHeader:this.cfg.spreadsheet.isScrollContainsRowHeader(),isPivotMode:this.cfg.spreadsheet.isPivotMode(),spreadsheet:this.cfg.spreadsheet};return a?a(s):new GT(s)}return this.centerFrame},e.prototype.updatePanelScrollGroup=function(){this.gridInfo=this.getGridInfo(),this.spreadsheet.panelScrollGroup.update(this.gridInfo)},e.prototype.dynamicRenderCell=function(t){var e=this.getScrollOffset(),n=e.scrollX,r=e.scrollY,i=e.hRowScrollX,o=r+this.getPaginationScrollY(),a=OT(o,this.viewCellHeights.getTotalHeight(),this.panelBBox.viewportHeight);this.spreadsheet.hideTooltip(),this.spreadsheet.interaction.clearHoverTimer(),this.realCellRender(n,a),this.updatePanelScrollGroup(),this.translateRelatedGroups(n,a,i),this.clip(n,a),t||this.emitScrollEvent({scrollX:n,scrollY:a}),this.onAfterScroll()},e.prototype.emitScrollEvent=function(e){this.spreadsheet.emit(t.S2Event.LAYOUT_CELL_SCROLL,e),this.spreadsheet.emit(t.S2Event.GLOBAL_SCROLL,e)},e.prototype.saveInitColumnLeafNodes=function(t){void 0===t&&(t=[]);var e=this.spreadsheet,n=e.store,r=e.options.interaction.hiddenColumnFields;t.length+r.length!==n.get("initColumnLeafNodes",[]).length&&n.set("initColumnLeafNodes",t)},e}(),VT=function(t){var e,n,r,i=t.facetCfg,o=t.customTreeItems,a=void 0===o?[]:o,s=t.level,l=t.parentNode,u=t.hierarchy,c=i.spreadsheet,h=i.collapsedRows,d=i.hierarchyCollapse;try{for(var f=jC(a),p=f.next();!p.done;p=f.next()){var v=p.value,g=v.key,y=v.title,m=v.collapsed,C=v.children,w=YC(v,["key","title","collapsed","children"]),x=((r={})[fo]=g,r),S=Bw(l.id,y),E=null!=m&&m,_=Su(h,S),b=null!=_?_:d||E,T=new _w({id:S,key:g,label:y,value:y,level:s,parent:l,field:g,isTotals:!1,isCollapsed:b,hierarchy:u,query:x,spreadsheet:c,extra:w});s>u.maxLevel&&(u.maxLevel=s),ov(C)&&(T.isLeaf=!0);var L=Ow(i,l,T,u);ov(C)||b||!L||VT({facetCfg:i,parentNode:T,level:s+1,hierarchy:u,customTreeItems:C})}}catch(t){e={error:t}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(e)throw e.error}}},XT="root[&]".length,KT=function(t){var e,n,r,i,o,a,s,l=t.parentNode,u=t.currentField,c=t.level,h=t.facetCfg,d=t.hierarchy,f=t.pivotMeta,p=h.spreadsheet,v=h.dataSet,g=h.collapsedRows,y=h.hierarchyCollapse,m=h.rowExpandDepth,C=l.query,w=l.id,x=(null===(i=p.dataCfg.fields.rows)||void 0===i?void 0:i.length)<=c,S=(null===(o=null==v?void 0:v.sortedDimensionValues)||void 0===o?void 0:o[u])||[],E=Qw(Array.from(f.keys())),_=$w(E,S,(function(t){return Wo===w?t:Bw(w,t).slice(XT)})),b=Iw(_,h,l,u),T=p.store.get("drillItemsNum");x&&T>0&&(b=b.slice(0,T)),0===c&&function(t,e,n){var r=t.getTotalsConfig(e);r.showGrandTotals&&n[r.reverseLayout?"unshift":"push"](new Tw(r.label,!1,!0))}(p,u,b);try{for(var L=jC(b),I=L.next();!I.done;I=L.next()){var O=I.value,R=O instanceof Tw,A=R?null:f.get(O),M=void 0,B=C,N=!1,D=!1;if(R){var P=O;N=P.isGrandTotals,D=P.isSubTotals,M=lw(O.label),B=C}else M=O,B=UC(UC({},C),((r={})[u]=M,r));var k=Bw(w,M),z=null==g?void 0:g[k],F=uv(m)?c>m:null,H=null!==(a=null!=z?z:F)&&void 0!==a?a:y,W=new _w({id:k,key:u,label:M,value:M,level:c,parent:l,field:u,isTotals:R,isGrandTotals:N,isSubTotals:D,isCollapsed:H,hierarchy:d,query:B,spreadsheet:p});c>d.maxLevel&&(d.maxLevel=c);var G=!(null===(s=null==A?void 0:A.children)||void 0===s?void 0:s.size);(G||R)&&(W.isLeaf=!0),G||(W.isTotals=!0);var U=Ow(h,l,W,d);G||H||R||!U||KT({level:c+1,currentField:A.childField,pivotMeta:A.children,facetCfg:h,parentNode:W,hierarchy:d})}}catch(t){e={error:t}}finally{try{I&&!I.done&&(n=L.return)&&n.call(L)}finally{if(e)throw e.error}}},qT=function(t){var e,n,r=t.isValueInCols,i=t.moreThanOneValue,o=t.rootNode,a=t.facetCfg,s=t.hierarchy,l=t.fields;t.isRowHeader?(e=!r&&i,n=!r&&!i):(e=r&&i,n=r&&!i),Mw({addTotalMeasureInTotal:e,addMeasureInTotalQuery:n,parentNode:o,currentField:l[0],fields:l,facetCfg:a,hierarchy:s})},ZT=function(t){var e=t.facetCfg,n=t.rootNode,r=t.hierarchy,i=e.hierarchyType,o=e.rows,a=e.dataSet;"tree"===i?KT({level:0,currentField:o[0],pivotMeta:a.rowPivotMeta,facetCfg:e,parentNode:n,hierarchy:r}):function(t){var e=t.facetCfg,n=t.rootNode,r=t.hierarchy,i=e.dataSet.fields.customTreeItems;VT({customTreeItems:i,facetCfg:e,level:0,parentNode:n,hierarchy:r})}(t)},$T=function(t){var e=t.isRowHeader,n=t.facetCfg,r=n.spreadsheet,i=n.rows,o=void 0===i?[]:i,a=n.columns,s=void 0===a?[]:a,l=r.dataCfg.fields.valueInCols,u=r.isPivotMode(),c=n.dataSet.moreThanOneValue(),h=_w.rootNode(),d=new bw,f={isValueInCols:l,isPivotMode:u,moreThanOneValue:c,rootNode:h,hierarchy:d,spreadsheet:r,facetCfg:n,fields:e?o:s,isRowHeader:e};e?function(t){t.spreadsheet.isHierarchyTreeType()?ZT(t):qT(t)}(f):function(t){var e=t.isPivotMode,n=t.hierarchy,r=t.rootNode,i=t.facetCfg;e?qT(t):Dw({parentNode:r,hierarchy:n,facetCfg:i})}(f);return{hierarchy:d,leafNodes:e&&r.isHierarchyTreeType()?d.getNodes():d.getLeaves()}},QT=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return GC(n,e),Object.defineProperty(n.prototype,"rowCellTheme",{get:function(){return this.spreadsheet.theme.rowCell.cell},enumerable:!1,configurable:!0}),n.prototype.doLayout=function(){var t=$T({isRowHeader:!0,facetCfg:this.cfg}),e=t.leafNodes,n=t.hierarchy,r=$T({isRowHeader:!1,facetCfg:this.cfg}),i=r.leafNodes,o=r.hierarchy;this.calculateNodesCoordinate(e,n,i,o);var a=this.cfg,s=a.dataSet,l=a.spreadsheet,u={colNodes:o.getNodes(),colsHierarchy:o,rowNodes:n.getNodes(),rowsHierarchy:n,rowLeafNodes:e,colLeafNodes:i,getCellMeta:function(t,n){var r,o,a,u=t||0,c=n||0,h=e[u],d=i[c];if(!h||!d)return null;var f,p=h.query,v=d.query,g=h.isTotals||h.isTotalMeasure||d.isTotals||d.isTotalMeasure,y=l.options.hierarchyType,m=null!==(o=Su(l,"facet.cfg.colCfg.hideMeasureColumn"))&&void 0!==o&&o&&"customTree"!==y?((r={})[fo]=null===(a=s.fields.values)||void 0===a?void 0:a[0],r):{},C=zv({},p,v,m),w=s.getCellData({query:C,rowNode:h,isTotals:g}),x=null;return ov(w)?f=Su(C,[fo],""):(f=Su(w,[fo],""),x=Su(w,[ho],null),g&&(f=Su(C,[fo],""),x=Su(w,f,null))),{spreadsheet:l,x:d.x,y:h.y,width:d.width,height:h.height,data:w,rowIndex:u,colIndex:c,isTotals:g,valueField:f,fieldValue:x,rowQuery:p,colQuery:v,rowId:h.id,colId:d.id,id:IS(h.id,d.id)}},spreadsheet:l};return function(t,e){var n=null==t?void 0:t.layoutDataPosition;if(n){var r=e.getCellMeta,i=n(t.spreadsheet,r);return UC(UC({},e),{getCellMeta:i})}return e}(this.cfg,u)},n.prototype.calculateNodesCoordinate=function(t,e,n,r){this.calculateRowNodesCoordinate(t,e,n),this.calculateColNodesCoordinate(n,r,t,e.width)},n.prototype.calculateColNodesCoordinate=function(t,e,n,r){var i,o,a,s,l=this.cfg.spreadsheet,u=_w.blankNode(),c=e.getNodes();try{for(var h=jC(e.sampleNodesForAllLevels),d=h.next();!d.done;d=h.next()){var f=d.value;f.height=this.getColNodeHeight(f),e.height+=f.height}}catch(t){i={error:t}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}for(var p=0,v=function(i){var o=c[i];if(o.isLeaf&&(o.colIndex=p,p+=1,o.x=u.x+u.width,o.width=g.calculateColLeafNodesWidth(o,t,n,r),e.width+=o.width,u=o),0===o.level)o.y=0;else{var s=e.sampleNodesForAllLevels.find((function(t){return t.level===o.level-1}));o.y=null!==(a=(null==s?void 0:s.y)+(null==s?void 0:s.height))&&void 0!==a?a:0}o.height=g.getColNodeHeight(o),Rw(g.cfg,null,o)},g=this,y=0;yE&&(S=L,E=I)}}}var O=x>E,R=O?C:S,A=O?w:0;return Fw.getInstance().logger("Max Label In Col:",e.field,R),this.spreadsheet.measureTextWidth(R,v)+(null===(a=g.padding)||void 0===a?void 0:a.left)+(null===(s=g.padding)||void 0===s?void 0:s.right)+A}return this.spreadsheet.isHierarchyTreeType()?this.getAdaptTreeColWidth(e,n,r):this.getAdaptGridColWidth(n,i)},n.prototype.getColNodeHeight=function(t){var e=this.cfg.colCfg;return Su(e,"heightByField.".concat(t.key))||e.height},n.prototype.getExpectedCellIconWidth=function(t,e,n){var r,i=0;if(e)i=1;else{var o=JS(op(this.spreadsheet.options.headerActionIcons,(function(t){return UC(UC({},t),{displayCondition:function(){return!0}})})),null,t);i=null!==(r=null==o?void 0:o.iconNames.length)&&void 0!==r?r:0}return i?i*(n.size+n.margin.left)+n.margin.right:0},n.prototype.calculateRowNodesCoordinate=function(t,e,n){var r,i,o,a,s,l,u,c,h,d,f=this.cfg,p=f.cellCfg,v=f.spreadsheet,g=v.isHierarchyTreeType(),y=Su(v,"options.style.rowCfg.heightByField",{}),m=null!==(o=e.sampleNodesForAllLevels)&&void 0!==o?o:[];if(g)e.width=this.getTreeRowHeaderWidth();else try{for(var C=jC(e.sampleNodesForAllLevels),w=C.next();!w.done;w=C.next()){var x=w.value;x.width=this.calculateGridRowNodesWidth(x,n),e.width+=x.width;var S=null!==(a=m[x.level-1])&&void 0!==a?a:{x:0,width:0};x.x=(null==S?void 0:S.x)+(null==S?void 0:S.width)}}catch(t){r={error:t}}finally{try{w&&!w.done&&(i=C.return)&&i.call(C)}finally{if(r)throw r.error}}for(var E=_w.blankNode(),_=e.getNodes(),b=0;b<_.length;b++){var T=_[b];if((g||!g&&T.isLeaf)&&(null!==(s=T.rowIndex)&&void 0!==s||(T.rowIndex=b),null!==(l=T.colIndex)&&void 0!==l||(T.colIndex=b),T.y=E.y+E.height,T.height=(null!==(u=y[T.id])&&void 0!==u?u:p.height)+(null===(c=this.rowCellTheme.padding)||void 0===c?void 0:c.top)+(null===(h=this.rowCellTheme.padding)||void 0===h?void 0:h.bottom),E=T,e.height+=T.height),g||0===T.level)T.x=0;else{S=m[T.level-1];T.x=(null==S?void 0:S.x)+(null==S?void 0:S.width)}if(g)T.width=this.getTreeRowHeaderWidth();else{var L=m[T.level];T.width=null==L?void 0:L.width}Rw(this.cfg,T,null)}g||(this.autoCalculateRowNodeHeightAndY(t),ov(null===(d=v.options.totals)||void 0===d?void 0:d.row)||(this.adjustTotalNodesCoordinate(e,!0),this.adjustSubTotalNodesCoordinate(e,!0)))},n.prototype.autoCalculateRowNodeHeightAndY=function(t){for(var e=null,n=t.slice(0);n.length;){var r=n.shift().parent;e!==r&&r&&(n.push(r),r.y=r.children[0].y,r.height=r.children.map((function(t){return t.height})).reduce((function(t,e){return t+e}),0),e=r)}},n.prototype.adjustTotalNodesCoordinate=function(t,e){var n,r,i,o=this.cfg.dataSet.moreThanOneValue(),a=t.maxLevel,s=$f(t.getNodes(0),(function(t){return t.isGrandTotals}));if(s instanceof _w){var l=s.children;if(e)s.width=t.width,Tf(l,(function(e){e.x=t.getNodes(a)[0].x}));else if(a>1||a<=1&&!o){var u=null!==(r=null===(n=null==l?void 0:l[0])||void 0===n?void 0:n.height)&&void 0!==r?r:0;s.height=t.height-u;var c=null===(i=$f(t.getNodes(a),(function(t){return!t.isTotalMeasure})))||void 0===i?void 0:i.y;Tf(l,(function(t){t.y=c}))}}},n.prototype.adjustSubTotalNodesCoordinate=function(t,e){var n=t.getNodes().filter((function(t){return t.isSubTotals}));if(!ov(n)){var r=t.maxLevel;Tf(n,(function(n){var i,o,a,s=n.children;if(e)n.width=TT(t.sampleNodesForAllLevels,n.level,"width"),Tf(s,(function(e){e.x=t.getNodes(r)[0].x}));else{var l=TT(t.sampleNodesForAllLevels,n.level,"height"),u=null!==(o=null===(i=null==s?void 0:s[0])||void 0===i?void 0:i.height)&&void 0!==o?o:0;n.height=l-u,Tf(s,(function(e){e.y=t.getNodes(r)[0].y}));var c=null===(a=$f(t.getNodes(r),(function(t){return!t.isTotalMeasure})))||void 0===a?void 0:a.y;Tf(s,(function(t){t.y=c}))}}))}},n.prototype.calculateGridRowNodesWidth=function(e,n){var r=this.cfg,i=r.rowCfg,o=r.spreadsheet,a=Su(i,"widthByField.".concat(e.key));if(a)return a;var s=this.getCellCustomWidth(e,null==i?void 0:i.width);return dv(s)?o.getLayoutWidthType()!==t.LayoutWidthTypes.Adaptive?this.getCompactGridRowWidth(e):this.getAdaptGridColWidth(n):s},n.prototype.getAdaptTreeColWidth=function(t,e,n){var r=this.getCanvasHW().width,i=Math.min(r/2,this.getTreeRowHeaderWidth()),o=Math.max(1,e.length),a=this.cfg.cellCfg;return Math.max(Yx(a,this.getColLabelLength(t,n)),(r-i)/o)},n.prototype.getColLabelLength=function(t,e){var n,r=jx(null==t?void 0:t.value);if(pa(r))return r.length;for(var i=1,o=0;o<50;o++){var a=e[o];if(!a)return i;for(var s=this.cfg.dataSet.getCellData({query:UC(UC({},t.query),a.query),rowNode:a,isTotals:t.isTotals||t.isTotalMeasure||a.isTotals||a.isTotalMeasure}),l=Wl(s),u=0;ui&&(i=h)}}return i},n.prototype.getAdaptGridColWidth=function(t,e){var n=this.cfg,r=n.rows,i=n.cellCfg,o=r.length,a=t.length,s=this.getCanvasHW().width,l=Math.max(1,o+a);return e?Math.max(Yx(i),(s-e)/a):Math.max(Yx(i),s/l)},n.prototype.getTreeRowHeaderWidth=function(){var t,e,n,r,i=this.cfg,o=i.rows,a=i.dataSet,s=i.rowCfg,l=i.treeRowsWidth,u=null!=l?l:null==s?void 0:s.treeRowsWidth;if(u)return u;var c=this.getCellCustomWidth(null,null==s?void 0:s.width);if(c)return c;var h=o.map((function(t){return a.getFieldName(t)})).join("/"),d=this.spreadsheet.theme.cornerCell,f=d.bolderText,p=d.icon,v=this.spreadsheet.measureTextWidth(h,f)+2*p.size+(null===(t=p.margin)||void 0===t?void 0:t.left)+(null===(e=p.margin)||void 0===e?void 0:e.right)+(null===(n=this.rowCellTheme.padding)||void 0===n?void 0:n.left)+(null===(r=this.rowCellTheme.padding)||void 0===r?void 0:r.right);return Math.max(null!=u?u:120,v)},n.prototype.getCompactGridRowWidth=function(e){var n,r=this,i=this.cfg,o=i.dataSet,a=i.spreadsheet,s=a.theme.rowCell,l=s.bolderText,u=s.icon,c=s.cell,h=a.theme.cornerCell,d=h.bolderText,f=h.icon,p=h.cell,v=e.field,g=e.isLeaf,y=this.getExpectedCellIconWidth(t.CellTypes.ROW_CELL,!a.isValueInCols()&&g&&a.options.showDefaultHeaderActionIcon,u),m=null===(n=o.getDimensionValues(v))||void 0===n?void 0:n.slice(0,50).map((function(t){var e,n;return null!==(n=null===(e=r.spreadsheet.dataSet.getFieldFormatter(v))||void 0===e?void 0:e(t))&&void 0!==n?n:t})),C=Nv(m,(function(t){return"".concat(t).length})),w=a.measureTextWidth(C,l)+y+c.padding.left+c.padding.right,x=o.getFieldName(v),S=this.getExpectedCellIconWidth(t.CellTypes.CORNER_CELL,!1,f),E=a.measureTextWidth(x,d)+S+p.padding.left+p.padding.right;return Fw.getInstance().logger("Max Label In Row:",v,w>E?C:x),Math.max(w,E)},n.prototype.getViewCellHeights=function(t){var e=dy(t.rowLeafNodes,(function(t,e){return t.push(mf(t)+e.height),t}),[0]);return{getTotalHeight:function(){return mf(e)},getCellOffsetY:function(t){return e[t]},getTotalLength:function(){return e.length-1},getIndexRange:function(t,n){return LT(e,t,n)}}},n}(jT),JT=function(t){function e(e){var n,r=this;(r=t.call(this,e)||this).getScrollGroupClipBBox=function(){var t,e=r.headerConfig,n=e.width,i=e.height,o=e.scrollX,a=e.spreadsheet,s=a.options;if(!s.frozenColCount&&!s.frozenTrailingColCount)return{x:o,y:0,width:n,height:i};for(var l=null===(t=a.facet)||void 0===t?void 0:t.layoutResult.colLeafNodes,u=ax(a.options,l.length),c=u.frozenColCount,h=u.frozenTrailingColCount,d=0,f=0,p=0;p0&&(dx(_,{x1:x=c.reduce((function(t,e,n){return n0?a:l)},UC({},b)),E.showShadow&&t>0&&_.addShape("rect",{attrs:{x:x,y:u,width:E.shadowWidth,height:S,fill:i.getShadowFill(0)}}));if(p>0){var L=u+i.getTotalHeightForRange(h.start,h.start+p-1);dx(_,{x1:0,x2:I=g>0?o:s,y1:L,y2:L},UC({},T)),E.showShadow&&m>0&&_.addShape("rect",{attrs:{x:0,y:L,width:I,height:E.shadowWidth,fill:i.getShadowFill(90)}})}g>0&&(dx(_,{x1:x=o-(I=c.reduceRight((function(t,e,n){return n>=c.length-g?t+e.width:t}),0)),x2:x,y1:u,y2:u+(S=y?a:l)},UC({},b)),E.showShadow&&Math.floor(t)0){var I;L=i.panelBBox.maxY-i.getTotalHeightForRange(h.end-y+1,h.end);dx(_,{x1:0,x2:I=g>0?o:s,y1:L,y2:L},UC({},T)),E.showShadow&&m0)for(h=0;h0)for(h=0;h0)for(d=1;d<=a.length;d++){var p;(p=a[a.length-d]).colIndex>=t.length-c&&(p.colIndex===a.length-1?p.x=f-p.width:p.x=o.x-p.width,o=p)}},n.prototype.calculateColLeafNodesWidth=function(e,n){var r,i=this.cfg,o=i.colCfg,a=i.dataSet,s=i.spreadsheet,l=this.spreadsheet.getLayoutWidthType(),u=this.getCellDraggedWidth(e);if(u)return u;var c,h=this.getCellCustomWidth(e,null==o?void 0:o.width);if(!dv(h))return h;if(l===t.LayoutWidthTypes.Compact){var d=a.getDisplayDataSet(),f=e.label,p=(null===(r=null==d?void 0:d.map((function(t){return"".concat(t[e.key])})))||void 0===r?void 0:r.slice(0,50))||[];p.push(f);var v=Nv(p,(function(t){return s.measureTextWidthRoughly(t)})),g=s.theme.colCell.bolderText,y=s.theme.dataCell,m=y.text,C=y.cell;if(Fw.getInstance().logger("Max Label In Col:",e.field,v),f===v)c=s.measureTextWidth(v,g)+YE(this.spreadsheet,e,s.theme.colCell);else{c=s.measureTextWidth(v,m)+C.padding.left+C.padding.right+1}}else c=n;return e.field===go&&(c=this.getSeriesNumberWidth()),c},n.prototype.getDefaultCellHeight=function(){var t=this.cfg.cellCfg;return null==t?void 0:t.height},n.prototype.getCellHeight=function(t){if(this.rowOffsets){var e=Su(this.spreadsheet,"options.style.rowCfg.heightByField",{})[String(t)];if(e)return e}return this.getDefaultCellHeight()},n.prototype.initRowOffsets=function(){var t=this,e=this.cfg.dataSet,n=Su(this.spreadsheet,"options.style.rowCfg.heightByField",{});if(Object.keys(n).length){var r=e.getDisplayDataSet();this.rowOffsets=[0];var i=0;r.forEach((function(e,r){var o,a=null!==(o=n[String(r)])&&void 0!==o?o:t.getDefaultCellHeight(),s=i+a;t.rowOffsets.push(s),i=s}))}},n.prototype.getViewCellHeights=function(){var t=this,e=this.cfg.dataSet;this.initRowOffsets();var n=this.getDefaultCellHeight();return{getTotalHeight:function(){return t.rowOffsets?mf(t.rowOffsets):n*e.getDisplayDataSet().length},getCellOffsetY:function(e){if(e<=0)return 0;if(t.rowOffsets)return t.rowOffsets[e];for(var r=0,i=0;i0&&(u.width=o[e-1].x+o[e-1].width-0,u.range=[0,e-1]),n>0&&(h.height=a.getCellOffsetY(s.start+n)-a.getCellOffsetY(s.start),h.range=[s.start,s.start+n-1]),r>0&&(c.width=o[o.length-1].x-o[o.length-r].x+o[o.length-1].width,c.range=[o.length-r,o.length-1]),i>0&&(d.height=a.getCellOffsetY(s.end+1)-a.getCellOffsetY(s.end+1-i),d.range=[s.end-i+1,s.end])},n.prototype.getRowHeader=function(){return null},n.prototype.getSeriesNumberHeader=function(){return null},n.prototype.translateRelatedGroups=function(t,n,r){var i=this,o=this.spreadsheet,a=o.frozenColGroup,s=o.frozenTrailingColGroup;[o.frozenRowGroup,o.frozenTrailingRowGroup].forEach((function(e){GE(e,i.cornerBBox.width-t)})),[a,s].forEach((function(t){!function(t,e){var n,r=null==t?void 0:t.getMatrix(),i=null!==(n=null==r?void 0:r[7])&&void 0!==n?n:0;null==t||t.translate(0,e-i)}(t,i.cornerBBox.height-n)})),e.prototype.translateRelatedGroups.call(this,t,n,r),this.updateRowResizeArea(),this.renderFrozenGroupSplitLine(t,n)},n.prototype.calculateXYIndexes=function(t,e){var n=this.layoutResult.colLeafNodes.length,r=this.getCellRange(),i=this.panelBBox,o=i.viewportHeight,a=i.viewportWidth,s=this.getFrozenOptions(),l=s.frozenColCount,u=s.frozenRowCount,c=s.frozenTrailingColCount,h=s.frozenTrailingRowCount,d={width:a,height:o,x:0,y:0};if(c>0||l>0){var f=this.frozenGroupInfo,p=f.frozenTrailingCol,v=f.frozenCol;d.width-=p.width+v.width,d.x+=v.width}if(h>0||u>0){var g=this.frozenGroupInfo,y=g.frozenRow,m=g.frozenTrailingRow;d.height0||e.reset()}},this.onCanvasContextMenu=function(e){var r=n.spreadsheet;if(n.isResizeArea(e))r.emit(t.S2Event.LAYOUT_RESIZE_MOUSE_UP,e);else switch(r.emit(t.S2Event.GLOBAL_CONTEXT_MENU,e),n.spreadsheet.getCellType(e.target)){case t.CellTypes.DATA_CELL:n.spreadsheet.emit(t.S2Event.DATA_CELL_CONTEXT_MENU,e);break;case t.CellTypes.ROW_CELL:n.spreadsheet.emit(t.S2Event.ROW_CELL_CONTEXT_MENU,e);break;case t.CellTypes.COL_CELL:n.spreadsheet.emit(t.S2Event.COL_CELL_CONTEXT_MENU,e);break;case t.CellTypes.CORNER_CELL:n.spreadsheet.emit(t.S2Event.CORNER_CELL_CONTEXT_MENU,e);break;case t.CellTypes.MERGED_CELL:n.spreadsheet.emit(t.S2Event.MERGED_CELLS_CONTEXT_MENU,e)}},this.spreadsheet=e,this.bindEvents()}return Object.defineProperty(e.prototype,"canvasContainer",{get:function(){return this.spreadsheet.container},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAutoResetSheetStyle",{get:function(){return this.spreadsheet.options.interaction.autoResetSheetStyle},enumerable:!1,configurable:!0}),e.prototype.bindEvents=function(){var e=this;this.clearAllEvents(),this.addCanvasEvent(t.OriginEventType.CLICK,this.onCanvasClick),this.addCanvasEvent(t.OriginEventType.MOUSE_DOWN,this.onCanvasMousedown),this.addCanvasEvent(t.OriginEventType.MOUSE_MOVE,this.onCanvasMousemove),this.addCanvasEvent(t.OriginEventType.MOUSE_OUT,this.onCanvasMouseout),this.addCanvasEvent(t.OriginEventType.MOUSE_UP,this.onCanvasMouseup),this.addCanvasEvent(t.OriginEventType.DOUBLE_CLICK,this.onCanvasDoubleClick),this.addCanvasEvent(t.OriginEventType.CONTEXT_MENU,this.onCanvasContextMenu),this.addS2Event(t.S2Event.GLOBAL_ACTION_ICON_CLICK,(function(){e.spreadsheet.interaction.addIntercepts([t.InterceptType.HOVER]),e.spreadsheet.interaction.clearState()})),this.addDomEventListener(window,t.OriginEventType.CLICK,(function(t){e.resetSheetStyle(t),e.isCanvasEffect=e.isMouseOnTheCanvasContainer(t)})),this.addDomEventListener(window,t.OriginEventType.KEY_DOWN,(function(n){e.onKeyboardCopy(n),e.onKeyboardEsc(n),e.spreadsheet.emit(t.S2Event.GLOBAL_KEYBOARD_DOWN,n)})),this.addDomEventListener(window,t.OriginEventType.KEY_UP,(function(n){e.spreadsheet.emit(t.S2Event.GLOBAL_KEYBOARD_UP,n)})),this.addDomEventListener(window,t.OriginEventType.MOUSE_UP,(function(n){e.spreadsheet.emit(t.S2Event.GLOBAL_MOUSE_UP,n)})),this.addDomEventListener(window,t.OriginEventType.MOUSE_MOVE,(function(n){e.spreadsheet.emit(t.S2Event.GLOBAL_MOUSE_MOVE,n)}))},e.prototype.onKeyboardCopy=function(e){if(this.isCanvasEffect&&this.spreadsheet.options.interaction.enableCopy&&Vx(e.key,t.InteractionKeyboardKey.COPY)&&(e.metaKey||e.ctrlKey)){var n=dS(this.spreadsheet);dv(n)||this.spreadsheet.emit(t.S2Event.GLOBAL_COPIED,n)}},e.prototype.onKeyboardEsc=function(e){this.isCanvasEffect&&Vx(e.key,t.InteractionKeyboardKey.ESC)&&this.resetSheetStyle(e)},e.prototype.resetSheetStyle=function(e){if(this.isAutoResetSheetStyle&&this.spreadsheet){var n=this.spreadsheet.interaction;n.hasIntercepts([t.InterceptType.BRUSH_SELECTION,t.InterceptType.COL_BRUSH_SELECTION,t.InterceptType.ROW_BRUSH_SELECTION])?n.removeIntercepts([t.InterceptType.BRUSH_SELECTION,t.InterceptType.ROW_BRUSH_SELECTION,t.InterceptType.COL_BRUSH_SELECTION]):this.isMouseOnTheTooltip(e)||this.isMouseOnTheCanvasContainer(e)||(this.spreadsheet.emit(t.S2Event.GLOBAL_RESET,e),n.reset())}},e.prototype.isMouseOnTheCanvasContainer=function(t){if(t instanceof MouseEvent){var e=this.spreadsheet.getCanvasElement();if(!e)return!1;var n=e.getBoundingClientRect()||{},r=n.x,i=n.y,o=this.getContainerRect(),a=o.width,s=o.height;return e.contains(t.target)&&t.clientX<=r+a&&t.clientY<=i+s}return!1},e.prototype.getContainerRect=function(){var t,e=(null===(t=this.spreadsheet.facet)||void 0===t?void 0:t.panelBBox)||{},n=e.maxX,r=e.maxY,i=this.spreadsheet.options,o=i.width,a=i.height;return{width:Math.min(o,n),height:Math.min(a,r)}},e.prototype.isMouseOnTheTooltip=function(t){var e,n,r,i;if(!mT(this.spreadsheet,t).showTooltip)return!1;var o=(null===(r=null===(n=null===(e=this.spreadsheet.tooltip)||void 0===e?void 0:e.container)||void 0===n?void 0:n.getBoundingClientRect)||void 0===r?void 0:r.call(n))||{},a=o.x,s=o.y,l=o.width,u=o.height;return t.target instanceof Node&&this.spreadsheet.tooltip.visible?wT(null===(i=this.spreadsheet.tooltip)||void 0===i?void 0:i.container,t.target):t instanceof MouseEvent&&(t.clientX>=a&&t.clientX<=a+l&&t.clientY>=s&&t.clientY<=s+u)},e.prototype.isResizeArea=function(t){var e=Su(t.target,"attrs.appendInfo");return null==e?void 0:e.isResizeArea},e.prototype.activeResizeArea=function(t){this.resetResizeArea();var e=t.target;this.spreadsheet.store.set("activeResizeArea",e),e.attr(TC.backgroundOpacity,this.spreadsheet.theme.resizeArea.interactionState.hover.backgroundOpacity)},e.prototype.resetResizeArea=function(){var t=this.spreadsheet.store.get("activeResizeArea");ov(t)||t.attr(TC.backgroundOpacity,this.spreadsheet.theme.resizeArea.backgroundOpacity),this.spreadsheet.store.set("activeResizeArea",t)},e.prototype.hasBrushSelectionIntercepts=function(){return this.spreadsheet.interaction.hasIntercepts([t.InterceptType.HOVER,t.InterceptType.BRUSH_SELECTION,t.InterceptType.ROW_BRUSH_SELECTION,t.InterceptType.COL_BRUSH_SELECTION])},e.prototype.clear=function(){this.unbindEvents()},e.prototype.unbindEvents=function(){this.clearAllEvents()},e.prototype.addCanvasEvent=function(t,e){var n;null===(n=this.canvasContainer)||void 0===n||n.on(t,e),this.canvasEventHandlers.push({type:t,handler:e})},e.prototype.addS2Event=function(t,e){this.spreadsheet.on(t,e),this.s2EventHandlers.push({type:t,handler:e})},e.prototype.addDomEventListener=function(t,e,n){if(t.addEventListener){var r=this.spreadsheet.options.interaction.eventListenerOptions;t.addEventListener(e,n,r),this.domEventListeners.push({target:t,type:e,handler:n,options:r})}else console.error("Please make sure ".concat(t," has addEventListener function"))},e.prototype.clearAllEvents=function(){var t=this;Tf(this.canvasEventHandlers,(function(e){var n,r=e.type,i=e.handler;null===(n=t.canvasContainer)||void 0===n||n.off(r,i)})),Tf(this.s2EventHandlers,(function(e){var n=e.type,r=e.handler;t.spreadsheet.off(n,r)})),Tf(this.domEventListeners,(function(t){t.target.removeEventListener(t.type,t.handler,t.options)})),this.canvasEventHandlers=[],this.s2EventHandlers=[],this.domEventListeners=[]},e}(),hL=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.isRangeSelection=!1,n.handleColClick=function(e){e.stopPropagation();var r=n.spreadsheet.interaction,i=n.spreadsheet.getCell(e.target),o=null==i?void 0:i.getMeta();if(!dv(null==o?void 0:o.x)){r.addIntercepts([t.InterceptType.HOVER]);var a=[ZE(i)],s=n.spreadsheet.store.get("lastClickedCell");if(n.isRangeSelection&&s&&s.cellType===i.cellType&&s.getMeta().level===i.getMeta().level){var l=VC([n.spreadsheet.facet.layoutResult.rowsHierarchy.maxLevel,n.spreadsheet.facet.layoutResult.colsHierarchy.maxLevel],2),u=l[0],c=l[1],h=QE(s.getMeta(),i.getMeta()),d=h.start,f=h.end;i instanceof OS?a=n.handleSeriesNumberRowSelected(d.rowIndex,f.rowIndex,i):i.cellType===t.CellTypes.ROW_CELL&&i.getMeta().level===u?a=n.handleRowSelected(d.rowIndex,f.rowIndex,i):i.cellType===t.CellTypes.COL_CELL&&i.getMeta().level===c&&(a=n.handleColSelected(d.colIndex,f.colIndex,i)),r.changeState({cells:a,stateName:t.InteractionStateName.SELECTED})}else n.spreadsheet.store.set("lastClickedCell",i);var p=a.map((function(t){return t.id}));r.updateCells(r.getRowColActiveCells(p)),n.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,r.getActiveCells())}},n}return GC(n,e),n.prototype.bindEvents=function(){this.bindKeyboardDown(),this.bindDataCellClick(),this.bindColCellClick(),this.bindKeyboardUp()},n.prototype.reset=function(){this.isRangeSelection=!1,this.spreadsheet.interaction.removeIntercepts([t.InterceptType.CLICK])},n.prototype.bindKeyboardDown=function(){var e=this;this.spreadsheet.on(t.S2Event.GLOBAL_KEYBOARD_DOWN,(function(n){n.key===t.InteractionKeyboardKey.SHIFT&&(e.isRangeSelection=!0,e.spreadsheet.interaction.addIntercepts([t.InterceptType.CLICK]))}))},n.prototype.bindKeyboardUp=function(){var e=this;this.spreadsheet.on(t.S2Event.GLOBAL_KEYBOARD_UP,(function(n){n.key===t.InteractionKeyboardKey.SHIFT&&e.reset()}))},n.prototype.bindColCellClick=function(){var e=this;this.spreadsheet.isTableMode()&&this.spreadsheet.on(t.S2Event.ROW_CELL_CLICK,(function(t){e.handleColClick(t)})),this.spreadsheet.on(t.S2Event.COL_CELL_CLICK,(function(t){e.handleColClick(t)}))},n.prototype.bindDataCellClick=function(){var e=this;this.spreadsheet.on(t.S2Event.DATA_CELL_CLICK,(function(n){n.stopPropagation();var r=e.spreadsheet.getCell(n.target),i=r.getMeta(),o=e.spreadsheet.interaction;if(i){var a=e.spreadsheet.store.get("lastClickedCell");if(e.isRangeSelection&&(null==a?void 0:a.cellType)===r.cellType){var s=QE(a.getMeta(),r.getMeta()),l=s.start,u=s.end,c=sy(l.colIndex,u.colIndex+1).flatMap((function(t){var n=e.spreadsheet.facet.layoutResult.colLeafNodes[t].id;return sy(l.rowIndex,u.rowIndex+1).map((function(i){return{id:(e.spreadsheet.facet.getSeriesNumberWidth()||e.spreadsheet.isTableMode()?String(i):e.spreadsheet.facet.layoutResult.rowLeafNodes[i].id)+"-"+n,colIndex:t,rowIndex:i,type:r.cellType}}))}));o.addIntercepts([t.InterceptType.CLICK,t.InterceptType.HOVER]),o.changeState({cells:c,stateName:t.InteractionStateName.SELECTED}),e.spreadsheet.showTooltipWithInfo(n,gT(e.spreadsheet)),e.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,o.getActiveCells())}else e.spreadsheet.store.set("lastClickedCell",r)}}))},n.prototype.handleSeriesNumberRowSelected=function(t,e,n){var r=this.spreadsheet.facet.layoutResult.colLeafNodes[0].id;return sy(t,e+1).map((function(t){return{id:String(t)+"-"+r,colIndex:0,rowIndex:t,type:n.cellType}}))},n.prototype.handleRowSelected=function(t,e,n){return this.spreadsheet.facet.layoutResult.rowNodes.filter((function(n){return _p(n.rowIndex,t,e+1)})).map((function(t){return{id:t.id,colIndex:t.colIndex,rowIndex:t.rowIndex,type:n.cellType}}))},n.prototype.handleColSelected=function(t,e,n){return this.spreadsheet.facet.layoutResult.colLeafNodes.filter((function(n){return _p(n.colIndex,t,e+1)})).map((function(t){return{id:t.id,colIndex:t.colIndex,rowIndex:t.rowIndex,type:n.cellType}}))},n}(rL),dL=[t.InteractionKeyboardKey.ARROW_LEFT,t.InteractionKeyboardKey.ARROW_RIGHT,t.InteractionKeyboardKey.ARROW_UP,t.InteractionKeyboardKey.ARROW_DOWN],fL=function(e){function n(t){return e.call(this,t)||this}return GC(n,e),n.prototype.isCanvasEffect=function(){return this.spreadsheet.interaction.eventController.isCanvasEffect},n.prototype.bindEvents=function(){var e=this;this.spreadsheet.on(t.S2Event.GLOBAL_KEYBOARD_DOWN,(function(t){if(e.isCanvasEffect()){var n=t.shiftKey,r=t.metaKey,i=!1,o=!1,a=!1;dL.includes(t.key)&&(r&&n?(i=!1,o=!0,a=!1):r?(i=!0,o=!0,a=!0):n?(i=!1,o=!1,a=!1):(i=!0,o=!1,a=!0),e.handleMove({event:t,changeStartCell:i,isJumpMode:o,isSingleSelection:a}))}})),this.spreadsheet.on(t.S2Event.DATA_CELL_CLICK,(function(t){var n=e.spreadsheet.getCell(t.target).getMeta();n&&(e.startCell=e.getCellMetaFromViewMeta(n),e.endCell=e.startCell)}))},n.prototype.getCellMetaFromViewMeta=function(e){return{rowIndex:e.rowIndex,colIndex:e.colIndex,id:e.id,type:t.CellTypes.DATA_CELL}},n.prototype.handleMove=function(e){var n=e.event,r=e.changeStartCell,i=e.isJumpMode,o=e.isSingleSelection,a=this,s=a.spreadsheet,l=a.startCell,u=a.endCell,c=r?l:u,h=this.getMoveInfo(n.key,c,i);if(h){var d=VC([h.row,h.col],2),f=d[0],p=d[1];this.scrollToActiveCell(s,f,p);var v=this.generateCellMeta(s,f,p),g=o?[v]:this.getRangeCells(s,l,v);$E(s,g),r&&(this.startCell=v),this.endCell=v,this.spreadsheet.emit(t.S2Event.DATA_CELL_SELECT_MOVE,g)}},n.prototype.generateCellMeta=function(e,n,r){var i=e.isTableMode,o=e.facet.layoutResult,a=o.colLeafNodes,s=o.rowLeafNodes,l=i()?String(n):s[n].id,u=a[r].id;return{rowIndex:n,colIndex:r,id:IS(l,u),type:t.CellTypes.DATA_CELL}},n.prototype.getRangeCells=function(t,e,n){for(var r=QE(e,n),i=r.start,o=i.rowIndex,a=i.colIndex,s=r.end,l=s.rowIndex,u=s.colIndex,c=[],h=o;h<=l;h++)for(var d=a;d<=u;d++)c.push(this.generateCellMeta(t,h,d));return c},n.prototype.getMoveInfo=function(e,n,r){var i=this.spreadsheet,o=i.options,a=o.frozenColCount,s=void 0===a?0:a,l=o.frozenRowCount,u=void 0===l?0:l,c=o.frozenTrailingColCount,h=void 0===c?0:c,d=o.frozenTrailingRowCount,f=void 0===d?0:d,p=i.facet.layoutResult,v=p.rowLeafNodes,g=VC([0+s,p.colLeafNodes.length-h-1],2),y=g[0],m=g[1],C=VC([0+u,(i.isTableMode()?i.dataSet.getDisplayDataSet().length:v.length)-f-1],2),w=C[0],x=C[1];if(n)switch(e){case t.InteractionKeyboardKey.ARROW_RIGHT:if(n.colIndex+1>m)return;return{row:n.rowIndex,col:r?m:n.colIndex+1};case t.InteractionKeyboardKey.ARROW_LEFT:if(n.colIndex-1x)return;return{row:r?x:n.rowIndex+1,col:n.colIndex}}},n.prototype.calculateOffset=function(t,e,n){var r=t.options,i=r.frozenRowCount,o=void 0===i?0:i,a=r.frozenTrailingRowCount,s=void 0===a?0:a,l=t.facet,u=t.frozenColGroup,c=t.frozenTrailingColGroup,h=t.frozenRowGroup,d=t.frozenTrailingRowGroup,f=l.layoutResult.colLeafNodes,p=l.getScrollOffset(),v=p.scrollX,g=p.scrollY,y=l.panelBBox,m=y.viewportHeight,C=y.viewportWidth,w=Su(t,"theme.splitLine"),x=u?Math.floor(u.getBBox().width-w.verticalBorderWidth/2):0,S=c?Math.floor(c.getBBox().width):0,E=h?Math.floor(h.getBBox().height-w.horizontalBorderWidth/2):0,_=d?Math.floor(d.getBBox().height):0,b=HE(v,g,l.viewCellWidths,l.viewCellHeights,{width:C-x-S,height:m-E-_,x:x,y:E},l.getRealScrollX(l.cornerBBox.width)),T=-1,L=-1,I=f.find((function(t){return t.colIndex===n}));if(n<=b[0]?T=I.x-x:n>=b[1]&&n=b[3]){L=l.viewCellHeights.getCellOffsetY(e+1)+_-m}return{offsetX:T,offsetY:L}},n.prototype.scrollToActiveCell=function(t,e,n){var r=this.calculateOffset(t,e,n),i=r.offsetX,o=r.offsetY,a=t.facet,s=t.facet.getScrollOffset(),l=s.scrollX,u=s.scrollY;a.scrollWithAnimation({offsetX:{value:i>-1?i:l},offsetY:{value:o>-1?o:u}})},n}(rL),pL=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.displayedCells=[],n.brushRangeCells=[],n.brushSelectionStage=t.InteractionBrushSelectionStage.UN_DRAGGED,n.brushSelectionMinimumMoveDistance=5,n.scrollAnimationComplete=!0,n.mouseMoveDistanceFromCanvas=0,n.setMoveDistanceFromCanvas=function(t,e,r){var i=0;if(e&&(i=t.x),r){var o=t.y;i=e?Math.max(o,i):o}n.mouseMoveDistanceFromCanvas=i},n.formatBrushPointForScroll=function(t){var e,r,i,o,a=t.x,s=t.y,l=n.spreadsheet.facet,u=l.panelBBox,c=u.minX,h=u.minY,d=u.maxX,f=u.maxY,p=(null===(e=n.endBrushPoint)||void 0===e?void 0:e.x)+a,v=(null===(r=n.endBrushPoint)||void 0===r?void 0:r.y)+s,g=!0,y=!0,m=null===(o=null===(i=l.vScrollBar)||void 0===i?void 0:i.getBBox())||void 0===o?void 0:o.width;return p>d?p=d-m-2:pf?v=f-2:v<=h?v=h+2:y=!1,{x:{value:p,needScroll:g},y:{value:v,needScroll:y}}},n.autoScrollIntervalId=null,n.autoScrollConfig=td(AC),n.validateYIndex=function(t){var e,r,i=n.spreadsheet.facet,o=i.frozenGroupInfo,a=0,s=null===(e=null==o?void 0:o.frozenRow)||void 0===e?void 0:e.range;if(s&&(a=s[1]+1),tl?null:t},n.validateXIndex=function(t){var e,r,i=n.spreadsheet.facet,o=i.frozenGroupInfo,a=0,s=null===(e=null==o?void 0:o.frozenCol)||void 0===e?void 0:e.range;if(s&&(a=s[1]+1),tl?null:t},n.adjustNextColIndexWithFrozen=function(e,r){var i=n.spreadsheet,o=i.facet,a=i.dataSet,s=i.options,l=a.getDisplayDataSet().length,u=o.layoutResult.colLeafNodes.length,c=ax(s,u,l),h=c.frozenTrailingColCount,d=c.frozenColCount,f=o.panelScrollGroupIndexes;return h>0&&r===t.ScrollDirection.TRAILING&&kE(e,h,u)?f[1]:d>0&&r===t.ScrollDirection.LEADING&&PE(e,d)?f[0]:e},n.adjustNextRowIndexWithFrozen=function(e,r){var i=n.spreadsheet,o=i.facet,a=i.dataSet,s=i.options,l=a.getDisplayDataSet().length,u=o.layoutResult.colLeafNodes.length,c=o.getCellRange(),h=ax(s,u,l),d=h.frozenTrailingRowCount,f=h.frozenRowCount,p=o.panelScrollGroupIndexes;return d>0&&r===t.ScrollDirection.TRAILING&&FE(e,c.end,d)?p[3]:f>0&&r===t.ScrollDirection.LEADING&&zE(e,c.start,f)?p[2]:e},n.getNextScrollDelta=function(e){var r=n.spreadsheet.facet.getScrollOffset(),i=r.scrollX,o=r.scrollY,a=0,s=0;if(e.y.scroll){var l=e.y.value>0?t.ScrollDirection.TRAILING:t.ScrollDirection.LEADING,u=n.adjustNextRowIndexWithFrozen(n.endBrushPoint.rowIndex,l);s=dv(c=n.validateYIndex(u+(e.y.value>0?1:-1)))?0:a_(c,l,n.spreadsheet)-o}if(e.x.scroll){l=e.x.value>0?t.ScrollDirection.TRAILING:t.ScrollDirection.LEADING;var c,h=n.adjustNextColIndexWithFrozen(n.endBrushPoint.colIndex,l);a=dv(c=n.validateXIndex(h+(e.x.value>0?1:-1)))?0:o_(c,l,n.spreadsheet)-i}return{x:a,y:s}},n.onScrollAnimationComplete=function(){n.scrollAnimationComplete=!0,n.brushSelectionStage!==t.InteractionBrushSelectionStage.UN_DRAGGED&&n.renderPrepareSelected(n.endBrushPoint)},n.autoScroll=function(){if(n.brushSelectionStage!==t.InteractionBrushSelectionStage.UN_DRAGGED&&n.scrollAnimationComplete){var e=n.autoScrollConfig,r=n.spreadsheet.facet.getScrollOffset(),i={offsetX:{value:r.scrollX,animate:!0},offsetY:{value:r.scrollY,animate:!0}},o=n.getNextScrollDelta(e),a=o.x,s=o.y;if(0!==s||0!==a){e.y.scroll&&(i.offsetY.value+=s),e.x.scroll&&(i.offsetX.value+=a,i.offsetX.value<0&&(i.offsetX.value=0)),n.scrollAnimationComplete=!1;var l=3;e.x.scroll&&(l=1),n.spreadsheet.facet.scrollWithAnimation(i,Math.max(16,300-n.mouseMoveDistanceFromCanvas*l),n.onScrollAnimationComplete)}else n.clearAutoScroll()}},n.handleScroll=im((function(e,r){if(n.brushSelectionStage!==t.InteractionBrushSelectionStage.UN_DRAGGED){var i=n.formatBrushPointForScroll({x:e,y:r}),o=i.x,a=o.value,s=o.needScroll,l=i.y,u=l.value,c=l.needScroll,h=n.autoScrollConfig;c&&(h.y.value=r,h.y.scroll=!0),s&&(h.x.value=e,h.x.scroll=!0),n.setMoveDistanceFromCanvas({x:e,y:r},s,c),n.renderPrepareSelected({x:a,y:u}),(c||s)&&(n.clearAutoScroll(),n.autoScroll(),n.autoScrollIntervalId=setInterval(n.autoScroll,16))}}),30),n.clearAutoScroll=function(){n.autoScrollIntervalId&&(clearInterval(n.autoScrollIntervalId),n.autoScrollIntervalId=null,n.resetScrollDelta())},n.onUpdateCells=function(t,e){return e()},n.showPrepareSelectedCells=function(){n.brushRangeCells=n.getBrushRangeCells(),n.spreadsheet.interaction.changeState({cells:op(n.brushRangeCells,(function(t){return ZE(t)})),stateName:t.InteractionStateName.PREPARE_SELECT,force:!0,onUpdateCells:n.onUpdateCells})},n.renderPrepareSelected=function(e){var r=e.x,i=e.y,o=n.spreadsheet.container.getShape(r,i),a=n.spreadsheet.getCell(o);if(a&&(a instanceof OS||a instanceof DE||a instanceof xE)){var s=a.getMeta(),l=s.rowIndex,u=s.colIndex,c=s.x,h=s.y;n.endBrushPoint={x:r,y:i,rowIndex:l,colIndex:u,headerY:h,headerX:c};var d=n.spreadsheet.interaction;d.addIntercepts([t.InterceptType.HOVER]),d.clearStyleIndependent(),n.isValidBrushSelection()&&(n.showPrepareSelectedCells(),n.updatePrepareSelectMask())}},n.getSelectedCellMetas=function(t){},n}return GC(n,e),n.prototype.bindEvents=function(){this.bindMouseDown(),this.bindMouseMove(),this.bindMouseUp()},n.prototype.getPrepareSelectMaskTheme=function(){var t;return null===(t=this.spreadsheet.theme)||void 0===t?void 0:t.prepareSelectMask},n.prototype.initPrepareSelectMaskShape=function(){var t=this.spreadsheet.foregroundGroup;if(t){t.removeChild(this.prepareSelectMaskShape);var e=this.getPrepareSelectMaskTheme();this.prepareSelectMaskShape=t.addShape("rect",{visible:!1,attrs:{width:0,height:0,x:0,y:0,fill:null==e?void 0:e.backgroundColor,fillOpacity:null==e?void 0:e.backgroundOpacity,zIndex:5},capture:!1})}},n.prototype.setBrushSelectionStage=function(t){this.brushSelectionStage=t},n.prototype.isPointInCanvas=function(t){var e=this.spreadsheet.facet.getCanvasHW(),n=e.height,r=e.width,i=this.spreadsheet.facet.panelBBox,o=i.minX,a=i.minY;return t.x>o&&t.xa&&t.ythis.brushSelectionMinimumMoveDistance||n.y-e.y>this.brushSelectionMinimumMoveDistance},n.prototype.setDisplayedCells=function(){this.displayedCells=this.spreadsheet.interaction.getPanelGroupAllDataCells()},n.prototype.updatePrepareSelectMask=function(){var t=this.getBrushRange();this.prepareSelectMaskShape.attr({x:t.start.x,y:t.start.y,width:t.width,height:t.height}),this.prepareSelectMaskShape.show()},n.prototype.hidePrepareSelectMaskShape=function(){var t;null===(t=this.prepareSelectMaskShape)||void 0===t||t.hide()},n.prototype.resetScrollDelta=function(){this.autoScrollConfig=td(AC)},n.prototype.getBrushPoint=function(t){var e=this.spreadsheet.facet.getScrollOffset(),n=e.scrollY,r=e.scrollX,i={x:null==t?void 0:t.x,y:null==t?void 0:t.y},o=this.spreadsheet.getCell(t.target).getMeta(),a=o.colIndex,s=o.rowIndex;return UC(UC({},i),{rowIndex:s,colIndex:a,scrollY:n,scrollX:r})},n.prototype.getBrushRange=function(){var t,e,n,r,i,o,a,s,l,u,c,h,d,f,p,v,g=this.spreadsheet.facet.getScrollOffset(),y=g.scrollX,m=g.scrollY,C=Math.min(this.startBrushPoint.rowIndex,null===(t=this.endBrushPoint)||void 0===t?void 0:t.rowIndex),w=Math.max(this.startBrushPoint.rowIndex,null===(e=this.endBrushPoint)||void 0===e?void 0:e.rowIndex),x=Math.min(this.startBrushPoint.colIndex,null===(n=this.endBrushPoint)||void 0===n?void 0:n.colIndex),S=Math.max(this.startBrushPoint.colIndex,null===(r=this.endBrushPoint)||void 0===r?void 0:r.colIndex),E=this.startBrushPoint.x+this.startBrushPoint.scrollX-y,_=this.startBrushPoint.y+this.startBrushPoint.scrollY-m,b=Math.min(E,null===(i=this.endBrushPoint)||void 0===i?void 0:i.x),T=Math.max(E,null===(o=this.endBrushPoint)||void 0===o?void 0:o.x),L=Math.min(_,null===(a=this.endBrushPoint)||void 0===a?void 0:a.y),I=Math.max(_,null===(s=this.endBrushPoint)||void 0===s?void 0:s.y),O=Math.min(null===(l=this.startBrushPoint)||void 0===l?void 0:l.headerX,null===(u=this.endBrushPoint)||void 0===u?void 0:u.headerX),R=Math.max(null===(c=this.startBrushPoint)||void 0===c?void 0:c.headerX,null===(h=this.endBrushPoint)||void 0===h?void 0:h.headerX);return{start:{rowIndex:C,colIndex:x,x:b,y:L,headerX:O,headerY:Math.min(null===(d=this.startBrushPoint)||void 0===d?void 0:d.headerY,null===(f=this.endBrushPoint)||void 0===f?void 0:f.headerY)},end:{rowIndex:w,colIndex:S,x:T,y:I,headerX:R,headerY:Math.max(null===(p=this.startBrushPoint)||void 0===p?void 0:p.headerY,null===(v=this.endBrushPoint)||void 0===v?void 0:v.headerY)},width:T-b,height:I-L}},n.prototype.getBrushRangeCells=function(){var t=this;return this.setDisplayedCells(),this.displayedCells.filter((function(e){var n=e.getMeta();return t.isInBrushRange(n)}))},n.prototype.mouseDown=function(e){var n;null===(n=null==e?void 0:e.preventDefault)||void 0===n||n.call(e),this.spreadsheet.interaction.hasIntercepts([t.InterceptType.CLICK])||(this.setBrushSelectionStage(t.InteractionBrushSelectionStage.CLICK),this.initPrepareSelectMaskShape(),this.setDisplayedCells(),this.startBrushPoint=this.getBrushPoint(e))},n.prototype.addBrushIntercepts=function(){this.spreadsheet.interaction.addIntercepts([t.InterceptType.BRUSH_SELECTION])},n.prototype.bindMouseUp=function(e){var n=this;void 0===e&&(e=!1),this.spreadsheet.on(t.S2Event.GLOBAL_MOUSE_UP,(function(r){n.brushSelectionStage===t.InteractionBrushSelectionStage.DRAGGED?(e&&n.clearAutoScroll(),n.isValidBrushSelection()&&(n.addBrushIntercepts(),n.updateSelectedCells(),n.spreadsheet.showTooltipWithInfo(r,gT(n.spreadsheet))),n.spreadsheet.interaction.getCurrentStateName()===t.InteractionStateName.PREPARE_SELECT&&n.spreadsheet.interaction.reset(),n.resetDrag()):n.resetDrag()})),this.spreadsheet.on(t.S2Event.GLOBAL_CONTEXT_MENU,(function(){n.brushSelectionStage!==t.InteractionBrushSelectionStage.UN_DRAGGED&&(n.spreadsheet.interaction.removeIntercepts([t.InterceptType.HOVER]),n.resetDrag())}))},n.prototype.isInBrushRange=function(t){return!1},n.prototype.bindMouseDown=function(){},n.prototype.bindMouseMove=function(){},n.prototype.updateSelectedCells=function(){},n}(rL),vL=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.displayedCells=[],t.brushRangeCells=[],t.getSelectedCellMetas=function(e){for(var n,r=[],i=t.spreadsheet.facet.layoutResult.colLeafNodes,o=null!==(n=t.spreadsheet.facet.layoutResult.rowLeafNodes)&&void 0!==n?n:[],a=e.start.rowIndex;a=n.rowIndex&&i<=r.rowIndex&&o>=n.colIndex&&o<=r.colIndex},n.prototype.updateSelectedCells=function(){var e=this.spreadsheet,n=e.interaction,r=e.options,i=this.getBrushRange(),o=this.getSelectedCellMetas(i);n.changeState({cells:o,stateName:t.InteractionStateName.SELECTED}),r.interaction.selectedCellHighlight&&o.forEach((function(t){t_(t)})),this.spreadsheet.emit(t.S2Event.DATA_CELL_BRUSH_SELECTION,this.brushRangeCells),this.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,this.brushRangeCells),ov(this.brushRangeCells)&&n.removeIntercepts([t.InterceptType.HOVER])},n.prototype.bindMouseUp=function(){e.prototype.bindMouseUp.call(this,!0)},n}(pL),gL=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.displayedCells=[],t.brushRangeCells=[],t.isInBrushRange=function(e){var n=t.getBrushRange(),r=n.start,i=n.end,o=e.x,a=void 0===o?0:o,s=e.y,l=void 0===s?0:s;return a>=r.headerX&&a<=i.headerX&&l>=r.headerY&&l<=i.headerY},t.onUpdateCells=function(t){return t.updateCells(t.getAllColHeaderCells())},t}return GC(n,e),n.prototype.bindEvents=function(){this.bindMouseDown(),this.bindMouseMove(),this.bindMouseUp()},n.prototype.bindMouseDown=function(){var n=this;[t.S2Event.COL_CELL_MOUSE_DOWN].forEach((function(t){n.spreadsheet.on(t,(function(t){e.prototype.mouseDown.call(n,t)}))}))},n.prototype.isPointInCanvas=function(t){var e=this.spreadsheet.facet.getCanvasHW().width,n=this.spreadsheet.facet.cornerBBox,r=n.width,i=n.minY,o=n.maxY;return t.x>=r&&t.x<=e&&t.y>=i&&t.y<=o},n.prototype.bindMouseMove=function(){var e=this;this.spreadsheet.on(t.S2Event.COL_CELL_MOUSE_MOVE,(function(n){if(e.brushSelectionStage!==t.InteractionBrushSelectionStage.UN_DRAGGED){e.setBrushSelectionStage(t.InteractionBrushSelectionStage.DRAGGED);var r=e.spreadsheet.container.getPointByEvent(n.originalEvent);e.isPointInCanvas(r)&&e.renderPrepareSelected(r)}}))},n.prototype.setDisplayedCells=function(){this.displayedCells=this.spreadsheet.interaction.getAllColHeaderCells()},n.prototype.getBrushPoint=function(t){var n=this.spreadsheet.getCell(t.target).getMeta(),r=n.x,i=n.y;return UC(UC({},e.prototype.getBrushPoint.call(this,t)),{headerX:r,headerY:i})},n.prototype.updateSelectedCells=function(){var e=this.spreadsheet.interaction;e.changeState({cells:op(this.brushRangeCells,ZE),stateName:t.InteractionStateName.SELECTED,onUpdateCells:function(t){t.updateCells(t.getAllColHeaderCells())}}),this.spreadsheet.emit(t.S2Event.COL_CELL_BRUSH_SELECTION,this.brushRangeCells),this.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,this.brushRangeCells),ov(this.brushRangeCells)&&e.removeIntercepts([t.InterceptType.HOVER])},n.prototype.addBrushIntercepts=function(){this.spreadsheet.interaction.addIntercepts([t.InterceptType.COL_BRUSH_SELECTION])},n}(pL),yL=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.displayedCells=[],t.brushRangeCells=[],t.isInBrushRange=function(e){var n=t.getBrushRange(),r=n.start,i=n.end,o=e.x,a=void 0===o?0:o,s=e.y,l=void 0===s?0:s;return a>=r.headerX&&a<=i.headerX&&l>=r.headerY&&l<=i.headerY},t.onUpdateCells=function(t){return t.updateCells(t.getAllRowHeaderCells())},t}return GC(n,e),n.prototype.bindMouseDown=function(){var n=this;[t.S2Event.ROW_CELL_MOUSE_DOWN].forEach((function(t){n.spreadsheet.on(t,(function(t){e.prototype.mouseDown.call(n,t)}))}))},n.prototype.isPointInCanvas=function(t){var e=this.spreadsheet.facet.getCanvasHW().height,n=this.spreadsheet.facet.cornerBBox,r=n.minX,i=n.height,o=n.maxX;return t.x>=r&&t.x<=o&&t.y>=i&&t.y<=e},n.prototype.bindMouseMove=function(){var e=this;this.spreadsheet.on(t.S2Event.ROW_CELL_MOUSE_MOVE,(function(n){if(e.brushSelectionStage!==t.InteractionBrushSelectionStage.UN_DRAGGED){e.setBrushSelectionStage(t.InteractionBrushSelectionStage.DRAGGED);var r=e.spreadsheet.container.getPointByEvent(n.originalEvent);e.isPointInCanvas(r)&&e.renderPrepareSelected(r)}}))},n.prototype.setDisplayedCells=function(){this.displayedCells=this.spreadsheet.interaction.getAllRowHeaderCells()},n.prototype.getBrushPoint=function(t){var n=this.spreadsheet.getCell(t.target).getMeta(),r=n.x,i=n.y;return UC(UC({},e.prototype.getBrushPoint.call(this,t)),{headerX:r,headerY:i})},n.prototype.updateSelectedCells=function(){var e=this.spreadsheet.interaction;e.changeState({cells:op(this.brushRangeCells,ZE),stateName:t.InteractionStateName.SELECTED,onUpdateCells:function(t){t.updateCells(t.getAllRowHeaderCells())}}),this.spreadsheet.emit(t.S2Event.ROW_CELL_BRUSH_SELECTION,this.brushRangeCells),this.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,this.brushRangeCells),ov(this.brushRangeCells)&&e.removeIntercepts([t.InterceptType.HOVER])},n.prototype.addBrushIntercepts=function(){this.spreadsheet.interaction.addIntercepts([t.InterceptType.ROW_BRUSH_SELECTION])},n}(pL),mL=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.isMultiSelection=!1,t}return GC(n,e),n.prototype.bindEvents=function(){this.bindKeyboardDown(),this.bindDataCellClick(),this.bindKeyboardUp()},n.prototype.reset=function(){this.isMultiSelection=!1,this.spreadsheet.interaction.removeIntercepts([t.InterceptType.CLICK])},n.prototype.bindKeyboardDown=function(){var e=this;this.spreadsheet.on(t.S2Event.GLOBAL_KEYBOARD_DOWN,(function(n){qE(n)&&(e.isMultiSelection=!0,e.spreadsheet.interaction.addIntercepts([t.InterceptType.CLICK]))}))},n.prototype.bindKeyboardUp=function(){var e=this;this.spreadsheet.on(t.S2Event.GLOBAL_KEYBOARD_UP,(function(t){qE(t)&&e.reset()}))},n.prototype.getSelectedCells=function(e){var n=e.getMeta().id,r=this.spreadsheet.interaction,i=r.getCells();return r.getCurrentStateName()!==t.InteractionStateName.SELECTED&&(i=[]),i.find((function(t){return t.id===n}))?i.filter((function(t){return t.id!==n})):XC(XC([],VC(i),!1),[ZE(e)],!1)},n.prototype.bindDataCellClick=function(){var e=this;this.spreadsheet.on(t.S2Event.DATA_CELL_CLICK,(function(n){n.stopPropagation();var r=e.spreadsheet.getCell(n.target),i=r.getMeta(),o=e.spreadsheet.interaction;if(e.isMultiSelection&&i){var a=e.getSelectedCells(r);if(ov(a))return o.clearState(),void e.spreadsheet.hideTooltip();o.addIntercepts([t.InterceptType.CLICK,t.InterceptType.HOVER]),e.spreadsheet.hideTooltip(),o.changeState({cells:a,stateName:t.InteractionStateName.SELECTED}),e.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,o.getActiveCells()),e.spreadsheet.showTooltipWithInfo(n,gT(e.spreadsheet))}}))},n}(rL),CL=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.resizeStartPosition={},n.resizeMouseMove=function(e){var r,i;if(null===(r=n.resizeReferenceGroup)||void 0===r?void 0:r.get("visible")){null===(i=null==e?void 0:e.preventDefault)||void 0===i||i.call(e);var o=e.originalEvent,a=n.getResizeInfo(),s=n.resizeReferenceGroup.getChildren()||[];if(!ov(s)){var l=VC(s,2)[1],u=VC(Jh(l.attr("path")),2),c=u[0],h=u[1];a.type===t.ResizeDirectionType.Horizontal?n.updateHorizontalResizingEndGuideLinePosition(o,a,c,h):n.updateVerticalResizingEndGuideLinePosition(o,a,c,h),n.updateResizeGuideLineTheme(l),l.attr("path",[c,h])}}},n}return GC(n,e),n.prototype.bindEvents=function(){this.bindMouseDown(),this.bindMouseMove(),this.bindMouseUp()},n.prototype.initResizeGroup=function(){if(!this.resizeReferenceGroup){this.resizeReferenceGroup=this.spreadsheet.foregroundGroup.addGroup();var t=this.spreadsheet.options,e=t.width,n=t.height,r=this.getResizeAreaTheme(),i=r.guideLineColor,o={path:"",lineDash:r.guideLineDash,stroke:i,lineWidth:r.size};this.resizeReferenceGroup.addShape("path",{id:DC,attrs:o}),this.resizeReferenceGroup.addShape("path",{id:PC,attrs:o}),this.resizeReferenceGroup.addShape("rect",{id:kC,attrs:{appendInfo:{isResizeArea:!0},x:0,y:0,width:e,height:n,fill:"transparent"}})}},n.prototype.getResizeAreaTheme=function(){return this.spreadsheet.theme.resizeArea},n.prototype.setResizeTarget=function(t){this.resizeTarget=t},n.prototype.getGuideLineWidthAndHeight=function(){var t=this.spreadsheet.options,e=t.width,n=t.height,r=this.spreadsheet.facet.panelBBox,i=r.maxY,o=r.maxX;return{width:Math.min(o,e),height:Math.min(i,n)}},n.prototype.getResizeShapes=function(){var t;return(null===(t=this.resizeReferenceGroup)||void 0===t?void 0:t.get("children"))||[]},n.prototype.setResizeMaskCursor=function(t){var e=VC(this.getResizeShapes(),3)[2];null==e||e.attr("cursor",t)},n.prototype.updateResizeGuideLinePosition=function(e,n){var r=this.getResizeShapes();if(!ov(r)){var i=VC(r,2),o=i[0],a=i[1],s=n.type,l=n.offsetX,u=n.offsetY,c=n.width,h=n.height,d=this.getGuideLineWidthAndHeight(),f=d.width,p=d.height;if(this.setResizeMaskCursor("".concat(s,"-resize")),s===t.ResizeDirectionType.Horizontal)return o.attr("path",[["M",l,u],["L",l,p]]),a.attr("path",[["M",l+c,u],["L",l+c,p]]),void(this.resizeStartPosition.offsetX=e.offsetX);o.attr("path",[["M",l,u],["L",f,u]]),a.attr("path",[["M",l,u+h],["L",f,u+h]]),this.resizeStartPosition.offsetY=e.offsetY}},n.prototype.bindMouseDown=function(){var e=this;this.spreadsheet.on(t.S2Event.LAYOUT_RESIZE_MOUSE_DOWN,(function(n){var r=n.target,i=n.originalEvent,o=e.getCellAppendInfo(n.target);e.spreadsheet.store.set("resized",!1),(null==o?void 0:o.isResizeArea)&&(e.spreadsheet.interaction.reset(),e.spreadsheet.interaction.addIntercepts([t.InterceptType.RESIZE]),e.setResizeTarget(r),e.showResizeGroup(),e.updateResizeGuideLinePosition(i,o))}))},n.prototype.bindMouseMove=function(){var e=this;this.spreadsheet.on(t.S2Event.LAYOUT_RESIZE_MOUSE_MOVE,(function(t){im(e.resizeMouseMove,33)(t)}))},n.prototype.getResizeGuideLinePosition=function(){var t=VC(this.resizeReferenceGroup.getChildren()||[],2),e=t[0],n=t[1],r=(null==e?void 0:e.attr("path"))||[],i=(null==n?void 0:n.attr("path"))||[],o=VC(r[0]||[],3),a=o[1],s=void 0===a?0:a,l=o[2],u=void 0===l?0:l,c=VC(i[0]||[],3),h=c[1],d=void 0===h?0:h,f=c[2];return{start:{x:s,y:u},end:{x:d,y:void 0===f?0:f}}},n.prototype.getDisAllowResizeInfo=function(){var t,e=this.getResizeInfo(),n=this.spreadsheet.options.interaction.resize,r=e.width,i=e.height,o=e.resizedWidth,a=e.resizedHeight,s=null===(t=null==n?void 0:n.disable)||void 0===t?void 0:t.call(n,e);return{displayWidth:s?r:o,displayHeight:s?i:a,isDisabled:s}},n.prototype.getResizeWidthDetail=function(){var e,n,r=this.getResizeInfo(),i=this.getDisAllowResizeInfo().displayWidth;switch(r.effect){case t.ResizeAreaEffect.Field:return{eventType:t.S2Event.LAYOUT_RESIZE_ROW_WIDTH,style:{rowCfg:{widthByField:(e={},e[r.id]=i,e)}}};case t.ResizeAreaEffect.Tree:return{eventType:t.S2Event.LAYOUT_RESIZE_TREE_WIDTH,style:{treeRowsWidth:i,rowCfg:{treeRowsWidth:i}}};case t.ResizeAreaEffect.Cell:return{eventType:t.S2Event.LAYOUT_RESIZE_COL_WIDTH,style:{colCfg:{widthByFieldValue:(n={},n[r.id]=i,n)}}};case t.ResizeAreaEffect.Series:return{eventType:t.S2Event.LAYOUT_RESIZE_SERIES_WIDTH,seriesNumberWidth:i};default:return null}},n.prototype.getResizeHeightDetail=function(){var e,n,r,i=this.spreadsheet.options,o=i.interaction.resize,a=i.style.rowCfg.heightByField,s=this.spreadsheet.theme.rowCell.cell.padding,l=this.getResizeInfo(),u=this.getDisAllowResizeInfo().displayHeight,c=u-s.top-s.bottom;switch(l.effect){case t.ResizeAreaEffect.Field:return{eventType:t.S2Event.LAYOUT_RESIZE_COL_HEIGHT,style:{colCfg:{heightByField:(e={},e[l.id]=u,e)}}};case t.ResizeAreaEffect.Cell:return r=a[String(l.id)]||(null==o?void 0:o.rowResizeType)===t.ResizeType.CURRENT?{rowCfg:{heightByField:(n={},n[l.id]=c,n)}}:{cellCfg:{height:c}},{eventType:t.S2Event.LAYOUT_RESIZE_ROW_HEIGHT,style:r};default:return null}},n.prototype.getResizeDetail=function(){return this.getResizeInfo().type===t.ResizeDirectionType.Horizontal?this.getResizeWidthDetail():this.getResizeHeightDetail()},n.prototype.showResizeGroup=function(){this.initResizeGroup(),this.resizeReferenceGroup.set("visible",!0)},n.prototype.hideResizeGroup=function(){this.resizeReferenceGroup.set("visible",!1)},n.prototype.bindMouseUp=function(){var e=this;this.spreadsheet.on(t.S2Event.GLOBAL_MOUSE_UP,(function(){var t;e.setResizeMaskCursor("default"),e.resizeReferenceGroup&&!ov(null===(t=e.resizeReferenceGroup)||void 0===t?void 0:t.getChildren())&&(e.hideResizeGroup(),e.renderResizedResult())}))},n.prototype.updateResizeGuideLineTheme=function(t){var e=this.getResizeAreaTheme(),n=e.guideLineColor,r=e.guideLineDisableColor,i=this.getDisAllowResizeInfo().isDisabled;t.attr("stroke",i?r:n),this.setResizeMaskCursor(i?"no-drop":"default")},n.prototype.updateHorizontalResizingEndGuideLinePosition=function(t,e,n,r){var i=t.offsetX-this.resizeStartPosition.offsetX;e.width+i<28&&(i=-(e.width-28));var o=e.offsetX+e.width+i;n[1]=o,r[1]=o,this.resizeTarget.attr({x:o-e.size/2})},n.prototype.updateVerticalResizingEndGuideLinePosition=function(t,e,n,r){var i=t.offsetY-this.resizeStartPosition.offsetY;e.height+i<16&&(i=-(e.height-16));var o=e.offsetY+e.height+i;n[2]=o,r[2]=o,this.resizeTarget.attr({y:o-e.size/2})},n.prototype.renderResizedResult=function(){var e=this.getResizeInfo(),n=this.getResizeDetail()||{},r=n.style,i=n.seriesNumberWidth,o=n.eventType,a={info:e,style:r};this.spreadsheet.emit(t.S2Event.LAYOUT_RESIZE,a),this.spreadsheet.emit(o,a),r&&this.spreadsheet.setOptions({style:r}),i&&this.spreadsheet.setTheme({rowCell:{seriesNumberWidth:i}}),this.spreadsheet.store.set("resized",!0),this.render()},n.prototype.getResizeInfo=function(){var t=this.getCellAppendInfo(this.resizeTarget),e=this.getResizeGuideLinePosition(),n=e.start,r=e.end,i=Math.floor(r.x-n.x),o=Math.floor(r.y-n.y);return UC(UC({},t),{resizedWidth:i,resizedHeight:o})},n.prototype.render=function(){this.resizeStartPosition={},this.resizeTarget=null,this.resizeReferenceGroup=null,this.spreadsheet.render(!1)},n}(rL),wL=function(){function e(e){var n=this;this.interactions=new Map,this.intercepts=new Set,this.hoverTimer=null,this.defaultState={cells:[],force:!1},this.onTriggerInteractionsResetEffect=function(){n.interactions.forEach((function(t){t.reset()}))},this.selectAll=function(){n.changeState({stateName:t.InteractionStateName.ALL_SELECTED})},this.getCellChildrenNodes=function(e){var r,i=null===(r=null==e?void 0:e.getMeta)||void 0===r?void 0:r.call(e),o=(null==e?void 0:e.cellType)===t.CellTypes.ROW_CELL;return n.spreadsheet.isHierarchyTreeType()&&o?_w.getAllLeaveNodes(i).filter((function(t){return t.rowIndex===i.rowIndex})):_w.getAllChildrenNodes(i)},this.selectHeaderCell=function(e){var r;void 0===e&&(e={});var i=e.cell;if(!ov(i)){var o=null===(r=null==i?void 0:i.getMeta)||void 0===r?void 0:r.call(i);if(o&&!dv(null==o?void 0:o.x)){n.addIntercepts([t.InterceptType.HOVER]);var a=n.spreadsheet.isHierarchyTreeType(),s=(null==i?void 0:i.cellType)===t.CellTypes.COL_CELL,l=n.getState(),u=n.isSelectedCell(i),c=(null==e?void 0:e.isMultiSelection)&&n.isSelectedState(),h=u?[]:n.getCellChildrenNodes(i),d=u?[]:[ZE(i)];if(c&&(d=nd(null==l?void 0:l.cells,d),h=nd(null==l?void 0:l.nodes,h),u&&(d=d.filter((function(t){return t.id!==o.id})),h=h.filter((function(t){return!(null==t?void 0:t.id.includes(o.id))})))),ov(d))return n.reset(),void n.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,n.getActiveCells());var f=h.filter((function(t){return null==t?void 0:t.isLeaf}));n.changeState({cells:d,nodes:f,stateName:t.InteractionStateName.SELECTED});var p=d.map((function(t){return t.id}));return n.updateCells(n.getRowColActiveCells(p)),a&&!s||n.highlightNodes(h),n.spreadsheet.emit(t.S2Event.GLOBAL_SELECTED,n.getActiveCells()),!0}}},this.highlightNodes=function(e){void 0===e&&(e=[]),e.forEach((function(e){var n;null===(n=null==e?void 0:e.belongsCell)||void 0===n||n.updateByState(t.InteractionStateName.SELECTED,e.belongsCell)}))},this.mergeCells=function(t,e){FS(n.spreadsheet,t,e)},this.unmergeCell=function(t){WS(n.spreadsheet,t)},this.spreadsheet=e,this.registerEventController(),this.registerInteractions(),window.addEventListener("visibilitychange",this.onTriggerInteractionsResetEffect)}return e.prototype.destroy=function(){this.interactions.clear(),this.intercepts.clear(),this.eventController.clear(),this.clearHoverTimer(),this.resetState(),window.removeEventListener("visibilitychange",this.onTriggerInteractionsResetEffect)},e.prototype.reset=function(){this.clearState(),this.clearHoverTimer(),this.intercepts.clear(),this.spreadsheet.hideTooltip()},e.prototype.setState=function(t){i_(this.spreadsheet,t)},e.prototype.getState=function(){return this.spreadsheet.store.get(IC)||this.defaultState},e.prototype.setInteractedCells=function(t){var e=this.getInteractedCells().concat([t]),n=this.getState();n.interactedCells=e,this.setState(n)},e.prototype.getInteractedCells=function(){var t=this.getState();return(null==t?void 0:t.interactedCells)||[]},e.prototype.resetState=function(){this.spreadsheet.store.set(IC,this.defaultState)},e.prototype.getCurrentStateName=function(){return this.getState().stateName},e.prototype.isEqualStateName=function(t){return this.getCurrentStateName()===t},e.prototype.isStateOf=function(t){var e=this.getState();return(null==e?void 0:e.stateName)===t},e.prototype.isSelectedState=function(){return this.isStateOf(t.InteractionStateName.SELECTED)},e.prototype.isAllSelectedState=function(){return this.isStateOf(t.InteractionStateName.ALL_SELECTED)},e.prototype.isHoverFocusState=function(){return this.isStateOf(t.InteractionStateName.HOVER_FOCUS)},e.prototype.isHoverState=function(){return this.isStateOf(t.InteractionStateName.HOVER)},e.prototype.isActiveCell=function(t){return!!this.getCells().find((function(e){return t.getMeta().id===e.id}))},e.prototype.isSelectedCell=function(t){return this.isSelectedState()&&this.isActiveCell(t)},e.prototype.getCells=function(){var t=this.getState();return(null==t?void 0:t.cells)||[]},e.prototype.getActiveCells=function(){var t=this.getCells().map((function(t){return t.id})),e=this.getAllCells();return op(t,(function(t){return $f(e,(function(e){var n;return(null===(n=null==e?void 0:e.getMeta())||void 0===n?void 0:n.id)===t}))})).filter((function(t){return t}))},e.prototype.clearStyleIndependent=function(){(this.isSelectedState()||this.isHoverState()||this.isAllSelectedState())&&this.getPanelGroupAllDataCells().forEach((function(t){t.hideInteractionShape()}))},e.prototype.getPanelGroupAllUnSelectedDataCells=function(){var t=this;return this.getPanelGroupAllDataCells().filter((function(e){return!t.isActiveCell(e)}))},e.prototype.getPanelGroupAllDataCells=function(){var t;return RT(null===(t=this.spreadsheet.panelGroup)||void 0===t?void 0:t.getChildren(),OS)},e.prototype.getAllRowHeaderCells=function(){var e,n,r=((null===(e=this.spreadsheet.foregroundGroup)||void 0===e?void 0:e.getChildren())||[]).find((function(t){return t instanceof UT})),i=(null===(n=null==r?void 0:r.cfg)||void 0===n?void 0:n.children)||[];return RT(i,DE).filter((function(e){return e.cellType===t.CellTypes.ROW_CELL}))},e.prototype.getAllColHeaderCells=function(){var e,n,r=((null===(e=this.spreadsheet.foregroundGroup)||void 0===e?void 0:e.getChildren())||[]).find((function(t){return t instanceof HT})),i=(null===(n=null==r?void 0:r.cfg)||void 0===n?void 0:n.children)||[];return RT(i,xE).filter((function(e){return e.cellType===t.CellTypes.COL_CELL}))},e.prototype.getRowColActiveCells=function(t){return nd(this.getAllRowHeaderCells(),this.getAllColHeaderCells()).filter((function(e){return t.includes(e.getMeta().id)}))},e.prototype.getAllCells=function(){return nd(this.getPanelGroupAllDataCells(),this.getAllRowHeaderCells(),this.getAllColHeaderCells())},e.prototype.hideColumns=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!0),KS(this.spreadsheet,t,e)},e.prototype.getBrushSelectionInfo=function(t){var e,n,r;return ev(t)?{dataBrushSelection:t,rowBrushSelection:t,colBrushSelection:t}:{dataBrushSelection:null!==(e=null==t?void 0:t.data)&&void 0!==e&&e,rowBrushSelection:null!==(n=null==t?void 0:t.row)&&void 0!==n&&n,colBrushSelection:null!==(r=null==t?void 0:t.col)&&void 0!==r&&r}},e.prototype.getDefaultInteractions=function(){var e=this.spreadsheet.options.interaction,n=e.resize,r=e.brushSelection,i=e.multiSelection,o=e.rangeSelection,a=e.selectedCellMove,s=this.getBrushSelectionInfo(r),l=s.dataBrushSelection,u=s.rowBrushSelection,c=s.colBrushSelection;return[{key:t.InteractionName.CORNER_CELL_CLICK,interaction:lL},{key:t.InteractionName.DATA_CELL_CLICK,interaction:iL},{key:t.InteractionName.ROW_COLUMN_CLICK,interaction:aL},{key:t.InteractionName.ROW_TEXT_CLICK,interaction:sL},{key:t.InteractionName.MERGED_CELLS_CLICK,interaction:oL},{key:t.InteractionName.HOVER,interaction:uL,enable:!Cw()},{key:t.InteractionName.BRUSH_SELECTION,interaction:vL,enable:!Cw()&&l},{key:t.InteractionName.ROW_BRUSH_SELECTION,interaction:yL,enable:!Cw()&&u},{key:t.InteractionName.COL_BRUSH_SELECTION,interaction:gL,enable:!Cw()&&c},{key:t.InteractionName.COL_ROW_RESIZE,interaction:CL,enable:!Cw()&&n},{key:t.InteractionName.DATA_CELL_MULTI_SELECTION,interaction:mL,enable:!Cw()&&i},{key:t.InteractionName.RANGE_SELECTION,interaction:hL,enable:!Cw()&&o},{key:t.InteractionName.SELECTED_CELL_MOVE,interaction:fL,enable:!Cw()&&a}]},e.prototype.registerInteractions=function(){var t=this,e=this.spreadsheet.options.interaction.customInteractions;this.interactions.clear(),this.getDefaultInteractions().forEach((function(e){var n=e.key,r=e.interaction;!1!==e.enable&&t.interactions.set(n,new r(t.spreadsheet))})),ov(e)||Tf(e,(function(e){var n=e.interaction;t.interactions.set(e.key,new n(t.spreadsheet))}))},e.prototype.registerEventController=function(){this.eventController=new cL(this.spreadsheet)},e.prototype.draw=function(){this.spreadsheet.container.draw()},e.prototype.clearState=function(){r_(this.spreadsheet)&&this.draw()},e.prototype.changeState=function(e){var n=this,r=this.spreadsheet.interaction,i=e.cells,o=void 0===i?[]:i,a=e.force,s=e.stateName,l=e.onUpdateCells;ov(o)&&s===t.InteractionStateName.SELECTED?a&&r.changeState({cells:[],stateName:t.InteractionStateName.UNSELECTED}):(this.getCurrentStateName()===t.InteractionStateName.ALL_SELECTED&&this.clearStyleIndependent(),this.clearState(),this.setState(e),l?l(this,(function(){return n.updatePanelGroupAllDataCells()})):this.updatePanelGroupAllDataCells(),this.draw())},e.prototype.updatePanelGroupAllDataCells=function(){this.updateCells(this.getPanelGroupAllDataCells())},e.prototype.updateCells=function(t){void 0===t&&(t=[]),t.forEach((function(t){t.update()}))},e.prototype.addIntercepts=function(t){var e=this;void 0===t&&(t=[]),t.forEach((function(t){e.intercepts.add(t)}))},e.prototype.hasIntercepts=function(t){var e=this;return void 0===t&&(t=[]),t.some((function(t){return e.intercepts.has(t)}))},e.prototype.removeIntercepts=function(t){var e=this;void 0===t&&(t=[]),t.forEach((function(t){e.intercepts.delete(t)}))},e.prototype.clearHoverTimer=function(){clearTimeout(this.hoverTimer)},e.prototype.setHoverTimer=function(t){this.hoverTimer=t},e.prototype.getHoverTimer=function(){return this.hoverTimer},e}(),xL=function(){function t(t){var e=this;this.viewport=window,this.init=function(){e.initDevicePixelRatioListener(),e.initDeviceZoomListener()},this.destroy=function(){e.removeDevicePixelRatioListener(),e.removeDeviceZoomListener()},this.removeDevicePixelRatioListener=function(){var t;(null===(t=e.devicePixelRatioMedia)||void 0===t?void 0:t.removeEventListener)?e.devicePixelRatioMedia.removeEventListener("change",e.renderByDevicePixelRatioChanged):e.devicePixelRatioMedia.removeListener(e.renderByDevicePixelRatioChanged)},this.initDeviceZoomListener=function(){var t,n;Cw()||null===(n=null===(t=e.viewport)||void 0===t?void 0:t.visualViewport)||void 0===n||n.addEventListener("resize",e.renderByZoomScale)},this.removeDeviceZoomListener=function(){var t,n;Cw()||null===(n=null===(t=e.viewport)||void 0===t?void 0:t.visualViewport)||void 0===n||n.removeEventListener("resize",e.renderByZoomScale)},this.renderByDevicePixelRatioChanged=function(){e.renderByDevicePixelRatio()},this.renderByDevicePixelRatio=function(t){void 0===t&&(t=window.devicePixelRatio);var n=e.spreadsheet,r=n.container,i=n.options,o=i.width,a=i.height,s=i.devicePixelRatio,l=e.spreadsheet.getCanvasElement();if(r.get("pixelRatio")!==t&&l){var u=Math.max(t,s,1);r.set("pixelRatio",u),r.changeSize(o,a),e.spreadsheet.render(!1)}},this.renderByZoomScale=Kd((function(t){var n=Math.ceil(t.target.scale);n>=1&&e.renderByDevicePixelRatio(n)}),350),this.spreadsheet=t}return t.prototype.initDevicePixelRatioListener=function(){var t;this.devicePixelRatioMedia=window.matchMedia("(resolution: ".concat(window.devicePixelRatio,"dppx)")),(null===(t=this.devicePixelRatioMedia)||void 0===t?void 0:t.addEventListener)?this.devicePixelRatioMedia.addEventListener("change",this.renderByDevicePixelRatioChanged):this.devicePixelRatioMedia.addListener(this.renderByDevicePixelRatioChanged)},t}(),SL=function(){function t(t){this.visible=!1,this.position={x:0,y:0},this.spreadsheet=t}return t.prototype.show=function(t){var e,n,r,i=t.position,o=t.options,a=t.content,s=t.event,l=Jb(o).enterable,u=this.spreadsheet.options.tooltip||{},c=u.autoAdjustBoundary,h=u.adjustPosition;this.visible=!0,this.options=t;var d=this.getContainer();this.renderContent(a);var f=Qb({spreadsheet:this.spreadsheet,position:i,tooltipContainer:d,autoAdjustBoundary:c}),p=f.x,v=f.y;this.position=null!==(e=null==h?void 0:h({position:{x:p,y:v},event:s}))&&void 0!==e?e:{x:p,y:v},eT(d,{style:{left:"".concat(null===(n=this.position)||void 0===n?void 0:n.x,"px"),top:"".concat(null===(r=this.position)||void 0===r?void 0:r.y,"px"),pointerEvents:l?"all":"none"},visible:!0})},t.prototype.hide=function(){this.visible=!1,this.container&&(eT(this.container,{style:{pointerEvents:"none"},visible:!1}),this.resetPosition())},t.prototype.destroy=function(){var t,e;this.visible=!1,this.container&&(this.resetPosition(),null===(e=(t=this.container).remove)||void 0===e||e.call(t),this.container=null)},t.prototype.renderContent=function(t){if(this.container){this.clearContent();var e=(this.spreadsheet.options.tooltip||{}).content,n=null!=t?t:e;dv(n)||("string"!=typeof n?n instanceof Element&&this.container.appendChild(n):this.container.innerHTML=n)}},t.prototype.clearContent=function(){this.container&&(this.container.innerHTML="")},t.prototype.disablePointerEvent=function(){this.container&&"none"!==this.container.style.pointerEvents&&eT(this.container,{style:{pointerEvents:"none"}})},t.prototype.resetPosition=function(){this.position={x:0,y:0}},t.prototype.getContainer=function(){var t;if(!this.container){var e=this.spreadsheet.options.tooltip,n=(null===(t=e.getContainer)||void 0===t?void 0:t.call(e))||document.body,r=document.createElement("div");return eT(r,{style:e.style,className:[cw].concat(e.className)}),n.appendChild(r),this.container=r,this.container}return this.container},t}(),EL=function(e){function n(t,n,r){var i=e.call(this)||this;return i.store=new Zw,i.untypedOn=i.on,i.untypedEmit=i.emit,i.on=function(t,e){return i.untypedOn(t,e)},i.emit=function(t){for(var e=[],n=1;n=0&&c<=255?o:a}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return s},i.dataCfg=u_(n),i.options=c_(r),i.dataSet=i.getDataSet(i.options),i.setDebug(),i.initTooltip(),i.initGroups(t),i.bindEvents(),i.initInteraction(),i.initTheme(),i.initHdAdapter(),i.registerIcons(),i.setOverscrollBehavior(),i}return GC(n,e),n.prototype.setOverscrollBehavior=function(){var t=this.options.interaction.overscrollBehavior,e=window.getComputedStyle(document.body).getPropertyValue("overscroll-behavior");e&&"auto"!==e?this.store.set("initOverscrollBehavior",e):t&&(document.body.style.overscrollBehavior=t)},n.prototype.restoreOverscrollBehavior=function(){document.body.style.overscrollBehavior=this.store.get("initOverscrollBehavior")||""},n.prototype.setDebug=function(){Fw.getInstance().setDebug(this.options.debug)},n.prototype.initTheme=function(){this.setThemeCfg({name:"default"})},n.prototype.getMountContainer=function(t){var e=bp(t)?document.querySelector(t):t;if(!e)throw new Error("Target mount container is not a DOM element");return e},n.prototype.initHdAdapter=function(){this.options.hdAdapter&&(this.hdAdapter=new xL(this),this.hdAdapter.init())},n.prototype.initInteraction=function(){this.interaction=new wL(this)},n.prototype.initTooltip=function(){var t,e;this.tooltip=this.renderTooltip(),this.tooltip instanceof SL||console.warn("[Custom Tooltip]: ".concat(null===(e=null===(t=this.tooltip)||void 0===t?void 0:t.constructor)||void 0===e?void 0:e.toString()," should be extends from BaseTooltip"))},n.prototype.renderTooltip=function(){var t,e;return(null===(e=null===(t=this.options.tooltip)||void 0===t?void 0:t.renderTooltip)||void 0===e?void 0:e.call(t,this))||new SL(this)},n.prototype.showTooltip=function(t){var e,n,r=t.content,i=t.event,o=this.getCell(null==i?void 0:i.target),a=Na(r)?r(o,t):r;null===(n=(e=this.tooltip).show)||void 0===n||n.call(e,UC(UC({},t),{content:a}))},n.prototype.showTooltipWithInfo=function(t,e,n){var r=mT(this,t),i=r.showTooltip,o=r.content;if(i){var a=this.getCell(null==t?void 0:t.target),s=pT({spreadsheet:this,cellInfos:e,targetCell:a,options:UC({enableFormat:!0},n)});this.showTooltip({data:s,position:{x:t.clientX,y:t.clientY},options:UC({enterable:!0},n),event:t,content:o})}},n.prototype.hideTooltip=function(){var t,e;null===(e=(t=this.tooltip).hide)||void 0===e||e.call(t)},n.prototype.destroyTooltip=function(){var t,e;null===(e=(t=this.tooltip).destroy)||void 0===e||e.call(t)},n.prototype.registerIcons=function(){var t=this.options.customSVGIcons;ov(t)||Tf(t,(function(t){Gw(t.name,t.svg)}))},n.prototype.setDataCfg=function(t){this.store.set("originalDataCfg",t),this.dataCfg=u_(this.dataCfg,t),this.store.set(qo,Zo)},n.prototype.setOptions=function(t){this.hideTooltip(),this.options=s_(this.options,t),this.registerIcons()},n.prototype.render=function(e,n){if(void 0===e&&(e=!0),void 0===n&&(n={}),this.getCanvasElement()){var r=n.reBuildDataSet,i=void 0!==r&&r,o=n.reBuildHiddenColumnsDetail,a=void 0===o||o;this.emit(t.S2Event.LAYOUT_BEFORE_RENDER),i&&(this.dataSet=this.getDataSet(this.options)),e&&(this.clearDrillDownData("",!0),this.dataSet.setDataCfg(this.dataCfg)),this.buildFacet(),a&&this.initHiddenColumnsDetail(),this.emit(t.S2Event.LAYOUT_AFTER_RENDER)}},n.prototype.destroy=function(){var e,n,r,i,o;this.restoreOverscrollBehavior(),this.emit(t.S2Event.LAYOUT_DESTROY),null===(e=this.facet)||void 0===e||e.destroy(),null===(n=this.hdAdapter)||void 0===n||n.destroy(),null===(r=this.interaction)||void 0===r||r.destroy(),null===(i=this.store)||void 0===i||i.clear(),this.destroyTooltip(),this.clearCanvasEvent(),null===(o=this.container)||void 0===o||o.destroy(),function(){var t;null===(t=document.getElementById(gx))||void 0===t||t.remove()}()},n.prototype.setThemeCfg=function(t){void 0===t&&(t={});var e=(null==t?void 0:t.theme)||{},n=Ew(UC(UC({},t),{spreadsheet:this}));this.theme=s_(n,e)},n.prototype.setTheme=function(t){this.theme=s_(this.theme,t)},n.prototype.updatePagination=function(t){this.options=s_(this.options,{pagination:t}),this.store.set("scrollX",0),this.store.set("scrollY",0)},n.prototype.getContentHeight=function(){return this.facet.getContentHeight()},n.prototype.changeSize=function(t,e){void 0===t&&(t=this.options.width),void 0===e&&(e=this.options.height),this.changeSheetSize(t,e)},n.prototype.changeSheetSize=function(t,e){void 0===t&&(t=this.options.width),void 0===e&&(e=this.options.height);var n=this.getCanvasElement(),r=this.container.get("width"),i=this.container.get("height");(t!==r||e!==i)&&n&&(this.options=s_(this.options,{width:t,height:e}),this.container.changeSize(t,e))},n.prototype.getCanvasElement=function(){return this.container.get("el")},n.prototype.getLayoutWidthType=function(){return this.options.style.layoutWidthType},n.prototype.getRowNodes=function(t){return void 0===t&&(t=-1),-1===t?this.facet.layoutResult.rowNodes:this.facet.layoutResult.rowNodes.filter((function(e){return e.level===t}))},n.prototype.getRowLeafNodes=function(){var t;return(null===(t=this.facet)||void 0===t?void 0:t.layoutResult.rowLeafNodes)||[]},n.prototype.getColumnNodes=function(t){var e;void 0===t&&(t=-1);var n=(null===(e=this.facet)||void 0===e?void 0:e.layoutResult.colNodes)||[];return-1===t?n:n.filter((function(e){return e.level===t}))},n.prototype.getColumnLeafNodes=function(){var t;return(null===(t=this.facet)||void 0===t?void 0:t.layoutResult.colLeafNodes)||[]},n.prototype.updateScrollOffset=function(t){this.facet.updateScrollOffset(s_({offsetX:{value:void 0,animate:!1},offsetY:{value:void 0,animate:!1}},t))},n.prototype.getTooltipDataItemMappingCallback=function(){var t;return null===(t=this.options)||void 0===t?void 0:t.mappingDisplayDataItem},n.prototype.getCell=function(t){for(var e,n=t;n&&!(n instanceof uo);){if(n instanceof bS)return n;n=null===(e=n.get)||void 0===e?void 0:e.call(n,"parent")}return null},n.prototype.getCellType=function(t){var e=this.getCell(t);return null==e?void 0:e.cellType},n.prototype.getTotalsConfig=function(t){var e=Su(this.options.totals,Op(this.dataSet.fields.rows,t)?"row":"col",{});return{showSubTotals:!(!e.showSubTotals||!Op(e.subTotalsDimensions,t))&&e.showSubTotals,showGrandTotals:e.showGrandTotals,reverseLayout:e.reverseLayout,reverseSubLayout:e.reverseSubLayout,label:e.label||lw("总计"),subLabel:e.subLabel||lw("小计")}},n.prototype.initGroups=function(t){var e=this.options,n=e.width,r=e.height,i=e.supportCSSTransform,o=e.devicePixelRatio;this.container=new uo({container:this.getMountContainer(t),width:n,height:r,localRefresh:!1,supportCSSTransform:i,pixelRatio:Math.max(o,1)}),this.backgroundGroup=this.container.addGroup({name:yo,zIndex:0}),this.panelGroup=this.container.addGroup({name:Co,zIndex:1}),this.foregroundGroup=this.container.addGroup({name:mo,zIndex:3}),this.initPanelGroupChildren(),this.updateContainerStyle()},n.prototype.updateContainerStyle=function(){var t=this.getCanvasElement();t&&(t.style.display="block")},n.prototype.initPanelGroupChildren=function(){this.panelScrollGroup=new nL({name:wo,zIndex:1,s2:this}),this.panelGroup.add(this.panelScrollGroup)},n.prototype.getInitColumnLeafNodes=function(){return this.store.get("initColumnLeafNodes",[])},n.prototype.clearColumnLeafNodes=function(){this.store.set("initColumnLeafNodes",void 0)},n.prototype.clearCanvasEvent=function(){var t=this;cp(this.getEvents(),(function(e,n){t.off(n)}))},n.prototype.updateSortMethodMap=function(t,e,n){var r;void 0===n&&(n=!1);var i=n?null:this.store.get("sortMethodMap");this.store.set("sortMethodMap",UC(UC({},i),((r={})[t]=e,r)))},n.prototype.getMenuDefaultSelectedKeys=function(t){var e=Su(this.store.get("sortMethodMap"),t);return e?[e]:[]},n}(ht),_L=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return GC(n,e),n.prototype.getDataSet=function(t){var e=t.dataSet,n=t.hierarchyType;return e?e(this):"customTree"===n?new _T(this):new ST(this)},n.prototype.isPivotMode=function(){return!0},n.prototype.isTableMode=function(){return!1},n.prototype.isHierarchyTreeType=function(){var t=this.options.hierarchyType;return"tree"===t||"customTree"===t},n.prototype.isScrollContainsRowHeader=function(){return!this.isFrozenRowHeader()},n.prototype.isFrozenRowHeader=function(){var t;return null===(t=this.options)||void 0===t?void 0:t.frozenRowHeader},n.prototype.isValueInCols=function(){return this.dataSet.fields.valueInCols},n.prototype.clearDrillDownData=function(t,e){this.dataSet instanceof ST&&(this.dataSet.clearDrillDownData(t),e||(this.interaction.reset(),this.render(!1)))},n.prototype.getFacetCfgFromDataSetAndOptions=function(){var t=this,e=this.dataSet,n=e.fields,r=e.meta,i=this.options,o=i.style,a=i.dataCell;return UC(UC(UC(UC({},this.options),n),o),{meta:r,spreadsheet:this,dataSet:this.dataSet,dataCell:null!=a?a:function(e){return new OS(e,t)}})},n.prototype.buildFacet=function(){var t,e=this.getFacetCfgFromDataSetAndOptions();null===(t=this.facet)||void 0===t||t.destroy(),this.facet=new QT(e),this.facet.render()},n.prototype.bindEvents=function(){this.off(t.S2Event.ROW_CELL_COLLAPSE_TREE_ROWS),this.off(t.S2Event.LAYOUT_TREE_ROWS_COLLAPSE_ALL),this.on(t.S2Event.ROW_CELL_COLLAPSE_TREE_ROWS,this.handleRowCellCollapseTreeRows),this.on(t.S2Event.LAYOUT_TREE_ROWS_COLLAPSE_ALL,this.handleTreeRowsCollapseAll)},n.prototype.handleRowCellCollapseTreeRows=function(e){var n,r=e.id,i=e.isCollapsed,o={style:{collapsedRows:(n={},n[r]=i,n)}};this.emit(t.S2Event.LAYOUT_COLLAPSE_ROWS,{collapsedRows:o.style.collapsedRows,meta:null==e?void 0:e.node}),this.setOptions(o),this.render(!1),this.emit(t.S2Event.LAYOUT_AFTER_COLLAPSE_ROWS,{collapsedRows:o.style.collapsedRows,meta:null==e?void 0:e.node})},n.prototype.handleTreeRowsCollapseAll=function(t){var e={style:{hierarchyCollapse:!t,collapsedRows:null,rowExpandDepth:null}};this.setOptions(e),this.render(!1)},n.prototype.groupSortByMethod=function(e,n){var r=this.dataCfg.fields,i=r.rows,o=r.columns,a=this.options.style.colCfg.hideMeasureColumn,s=this.isValueInCols()?mf(i):mf(o),l=n.query,u=n.value,c=Jh(l),h=u;a&&this.isValueInCols()&&(h=this.dataSet.fields.values[0],c[fo]=h);var d={sortFieldId:s,sortMethod:e,sortByMeasure:h,query:c},f=this.dataCfg.sortParams.filter((function(t){return(null==t?void 0:t.sortFieldId)!==s}));this.updateSortMethodMap(n.id,e,!0);var p=XC(XC([],VC(f),!1),[d],!1);this.emit(t.S2Event.RANGE_SORT,p),this.setDataCfg(UC(UC({},this.dataCfg),{sortParams:p})),this.render()},n.prototype.handleGroupSort=function(e,n){var r=this;e.stopPropagation(),this.interaction.addIntercepts([t.InterceptType.HOVER]);var i=this.getMenuDefaultSelectedKeys(null==n?void 0:n.id),o={onClick:function(i){var o=i.key;r.groupSortByMethod(o,n),r.emit(t.S2Event.RANGE_SORTED,e)},menus:yw(),defaultSelectedKeys:i};this.showTooltipWithInfo(e,[],{operator:o,onlyMenu:!0})},n}(EL),bL=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return GC(e,t),e}(eL),TL=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.onSortTooltipClick=function(e,r){var i=e.key,o={sortFieldId:r.field,sortMethod:i};n.updateSortMethodMap(r.id,i),n.emit(t.S2Event.RANGE_SORT,[o])},n}return GC(n,e),n.prototype.getDataSet=function(t){var e=t.dataSet;return e?e(this):new ET(this)},n.prototype.isPivotMode=function(){return!1},n.prototype.isTableMode=function(){return!0},n.prototype.isHierarchyTreeType=function(){return!1},n.prototype.isScrollContainsRowHeader=function(){return!1},n.prototype.isFrozenRowHeader=function(){return!1},n.prototype.clearDrillDownData=function(){},n.prototype.isValueInCols=function(){return!1},n.prototype.bindEvents=function(){},n.prototype.initPanelGroupChildren=function(){var t,n=this;e.prototype.initPanelGroupChildren.call(this);var r={zIndex:2,s2:this};t=VC([So,Eo,_o,bo,To,Lo].map((function(t){var e=new bL(UC({name:t},r));return n.panelGroup.add(e),e})),6),this.frozenRowGroup=t[0],this.frozenColGroup=t[1],this.frozenTrailingRowGroup=t[2],this.frozenTrailingColGroup=t[3],this.frozenTopGroup=t[4],this.frozenBottomGroup=t[5]},n.prototype.getFacetCfgFromDataSetAndOptions=function(){var t=this,e=this.dataSet,n=e.fields,r=e.meta,i=this.options,o=i.style,a=i.dataCell;return UC(UC(UC(UC({},this.options),n),o),{meta:r,spreadsheet:this,dataSet:this.dataSet,dataCell:null!=a?a:function(e){return t.options.showSeriesNumber&&0===e.colIndex?new KE(e,t):new XE(e,t)}})},n.prototype.buildFacet=function(){var t,e=this.getFacetCfgFromDataSetAndOptions();null===(t=this.facet)||void 0===t||t.destroy(),this.facet=new tL(e),this.facet.render()},n.prototype.clearFrozenGroups=function(){this.frozenRowGroup.set("children",[]),this.frozenColGroup.set("children",[]),this.frozenTrailingRowGroup.set("children",[]),this.frozenTrailingColGroup.set("children",[]),this.frozenTopGroup.set("children",[]),this.frozenBottomGroup.set("children",[])},n.prototype.destroy=function(){e.prototype.destroy.call(this),this.clearFrozenGroups(),this.off(t.S2Event.RANGE_SORT),this.off(t.S2Event.RANGE_FILTER)},n.prototype.handleGroupSort=function(e,n){var r=this;e.stopPropagation(),this.interaction.addIntercepts([t.InterceptType.HOVER]);var i=this.getMenuDefaultSelectedKeys(null==n?void 0:n.id),o={onClick:function(t){var e=t.key;r.onSortTooltipClick({key:e},n)},menus:mw(),defaultSelectedKeys:i};this.showTooltipWithInfo(e,[],{operator:o,onlyMenu:!0})},n}(EL);t.BACK_GROUND_GROUP_CONTAINER_Z_INDEX=0,t.BRUSH_AUTO_SCROLL_INITIAL_CONFIG=AC,t.BaseBrushSelection=pL,t.BaseCell=bS,t.BaseDataSet=xT,t.BaseEvent=rL,t.BaseTooltip=SL,t.CORNER_MAX_WIDTH_RATIO=.5,t.ColBrushSelection=gL,t.ColCell=xE,t.ColHeader=HT,t.CornerCell=SE,t.CornerCellClick=lL,t.CornerHeader=WT,t.CustomTreePivotDataSet=_T,t.DEBUG_HEADER_LAYOUT=kw,t.DEBUG_TRANSFORM_DATA=Pw,t.DEBUG_VIEW_RENDER=zw,t.DEFAULT_DATA_CONFIG=$o,t.DEFAULT_OPTIONS=HC,t.DEFAULT_PAGE_INDEX=1,t.DEFAULT_STYLE=FC,t.DEFAULT_TREE_ROW_WIDTH=120,t.DEFAULT_VALUE_RANGES=Zo,t.DataCell=OS,t.DataCellBrushSelection=vL,t.DataCellClick=iL,t.DataCellMultiSelection=mL,t.DebuggerUtil=Fw,t.EMPTY_PLACEHOLDER=Uo,t.EXTRA_COLUMN_FIELD=po,t.EXTRA_FIELD=fo,t.EventController=cL,t.FONT_FAMILY=rw,t.FRONT_GROUND_GROUP_BRUSH_SELECTION_Z_INDEX=5,t.FRONT_GROUND_GROUP_COL_FROZEN_Z_INDEX=4,t.FRONT_GROUND_GROUP_COL_SCROLL_Z_INDEX=3,t.FRONT_GROUND_GROUP_CONTAINER_Z_INDEX=3,t.FRONT_GROUND_GROUP_RESIZE_AREA_Z_INDEX=5,t.Frame=GT,t.FrozenCellGroupMap=Qo,t.GEvent=lt,t.GuiIcon=qw,t.HORIZONTAL_RESIZE_AREA_KEY_PRE=Ho,t.HOVER_FOCUS_DURATION=bC,t.Hierarchy=bw,t.HoverEvent=uL,t.ID_SEPARATOR=Go,t.IMAGE="image",t.INTERACTION_STATE_INFO_KEY=IC,t.INTERVAL_BAR_HEIGHT=12,t.KEY_COL_REAL_WIDTH_INFO="col-real-width-info",t.KEY_GROUP_BACK_GROUND=yo,t.KEY_GROUP_COL_FROZEN=Po,t.KEY_GROUP_COL_FROZEN_TRAILING=ko,t.KEY_GROUP_COL_HORIZONTAL_RESIZE_AREA="colHorizontalResizeAreaGroup",t.KEY_GROUP_COL_RESIZE_AREA=Bo,t.KEY_GROUP_COL_SCROLL=Do,t.KEY_GROUP_CORNER_RESIZE_AREA=Mo,t.KEY_GROUP_FORE_GROUND=mo,t.KEY_GROUP_FROZEN_COL_RESIZE_AREA=No,t.KEY_GROUP_FROZEN_ROW_RESIZE_AREA=Oo,t.KEY_GROUP_FROZEN_SPLIT_LINE=Ro,t.KEY_GROUP_GRID_GROUP=zo,t.KEY_GROUP_MERGED_CELLS=xo,t.KEY_GROUP_PANEL_FROZEN_BOTTOM=Lo,t.KEY_GROUP_PANEL_FROZEN_COL=Eo,t.KEY_GROUP_PANEL_FROZEN_ROW=So,t.KEY_GROUP_PANEL_FROZEN_TOP=To,t.KEY_GROUP_PANEL_FROZEN_TRAILING_COL=bo,t.KEY_GROUP_PANEL_FROZEN_TRAILING_ROW=_o,t.KEY_GROUP_PANEL_GROUND=Co,t.KEY_GROUP_PANEL_SCROLL=wo,t.KEY_GROUP_ROW_INDEX_RESIZE_AREA=Ao,t.KEY_GROUP_ROW_RESIZE_AREA=Io,t.KEY_SERIES_NUMBER_NODE=Fo,t.LAYOUT_SAMPLE_COUNT=50,t.MIN_CELL_HEIGHT=16,t.MIN_CELL_WIDTH=28,t.MIN_DEVICE_PIXEL_RATIO=1,t.MIN_SCROLL_BAR_HEIGHT=32,t.MergedCell=RS,t.MergedCellClick=oL,t.MergedCellConvertTempMergedCells=GS,t.Node=_w,t.PADDING_DOWN=2,t.PADDING_LEFT=3,t.PADDING_RIGHT=1,t.PADDING_TOP=0,t.PALETTE_MAP=nw,t.PANEL_GROUP_FROZEN_GROUP_Z_INDEX=2,t.PANEL_GROUP_GROUP_CONTAINER_Z_INDEX=1,t.PANEL_GROUP_HOVER_BOX_GROUP_Z_INDEX=1,t.PANEL_GROUP_SCROLL_GROUP_Z_INDEX=1,t.PRECISION=16,t.PivotDataSet=ST,t.PivotSheet=_L,t.RESIZE_END_GUIDE_LINE_ID=PC,t.RESIZE_MASK_ID=kC,t.RESIZE_START_GUIDE_LINE_ID=DC,t.ROOT_BEGINNING_REGEX=Yo,t.ROOT_ID=Wo,t.RangeSelection=hL,t.RootInteraction=wL,t.RowBrushSelection=yL,t.RowCell=DE,t.RowColumnClick=aL,t.RowColumnResize=CL,t.RowHeader=UT,t.RowTextClick=sL,t.S2_PREFIX_CLS=Ko,t.SERIES_NUMBER_FIELD=go,t.SHAPE_ATTRS_MAP=LC,t.SHAPE_STYLE_MAP=TC,t.SQUARE_LINE_CAP=Xo,t.SelectedCellMove=fL,t.SeriesNumberHeader=YT,t.SpreadSheet=EL,t.Store=Zw,t.TABLE_COL_HORIZONTAL_RESIZE_AREA_KEY="table-col-horizontal-resize-area",t.TOOLTIP_CONTAINER_CLS=cw,t.TOOLTIP_CONTAINER_HIDE_CLS=dw,t.TOOLTIP_CONTAINER_SHOW_CLS=hw,t.TOOLTIP_OPERATION_PREFIX_CLS=fw,t.TOOLTIP_POSITION_OFFSET=pw,t.TOOLTIP_PREFIX_CLS=uw,t.TOTAL_VALUE=vo,t.TableColCell=jE,t.TableCornerCell=VE,t.TableDataCell=XE,t.TableDataSet=ET,t.TableSeriesCell=KE,t.TableSheet=TL,t.VALUE_FIELD=ho,t.VALUE_RANGES_KEY=qo,t.adjustColHeaderScrollingTextPosition=Dx,t.adjustColHeaderScrollingViewport=Nx,t.auto=function(t,e,n){if(void 0===e&&(e=2),void 0===n&&(n=ix[sw()]||ix.zh_CN),"number"!=typeof t||cv(t))return"";for(var r,i=t,o=VC(n,2),a=o[0],s=o[1],l=0,u=!0;u;)i>=(r=s[l])&&l=1e3?i.toLocaleString("en"):"".concat(i);return 0===l?c:"".concat(c," ").concat(a[l-1])},t.buildTableHierarchy=Dw,t.clearState=r_,t.convertString=Qx,t.copyData=function(e,n,r){var i,o,a,s,l,u=function(t){var e,n;return"object"==typeof t?{isFormatHeader:null!==(e=t.isFormatHeader)&&void 0!==e&&e,isFormatData:null!==(n=t.isFormatData)&&void 0!==n&&n}:{isFormatHeader:null!=t&&t,isFormatData:null!=t&&t}}(r),c=u.isFormatHeader,h=u.isFormatData,d=null===(l=null==e?void 0:e.facet)||void 0===l?void 0:l.layoutResult,f=d.rowsHierarchy,p=d.rowLeafNodes,v=d.colLeafNodes,g=d.getCellMeta,y=f.maxLevel,m=e.dataCfg.fields.valueInCols,C=f.sampleNodesForAllLevels.map((function(t){return e.dataSet.getFieldName(t.key)})),w=p.reduce((function(t,e){var n,r=(null!==(n=e.level)&&void 0!==n?n:0)+1;return r>t?r:t}),0),x=[],S=0;if(e.isPivotMode()){var E=p.filter((function(t){return 0!==t.height}));try{for(var _=jC(E),b=_.next();!b.done;b=_.next()){var T=b.value,L=[];if(c)L=SS(T);else T.label=pm(null==T?void 0:T.label),L=T.id.replace(Yo,"").split(Go);var I=y+1-L.length;I>0&&L.push.apply(L,XC([],VC(new Array(I)),!1));var O=e.dataSet.getFieldName(mf(L));L[L.length-1]=O;try{for(var R=(a=void 0,jC(v)),A=R.next();!A.done;A=R.next()){var M=A.value;if(m){var B=g(T.rowIndex,M.colIndex);L.push(yS(B,e,h))}else{B=g(T.rowIndex,M.colIndex);var N=wS(B,M,e),D=mS(B,e,N,h);pa(D)?L=L.concat.apply(L,XC([],VC(D),!1)):L.push(D)}}}catch(t){a={error:t}}finally{try{A&&!A.done&&(s=R.return)&&s.call(R)}finally{if(a)throw a.error}}S=Bv([L.length,S]);var P=L.map((function(t){return fS(t)})).join(n);x.push(P)}}catch(t){i={error:t}}finally{try{b&&!b.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.error}}}else x=function(t,e,n){var r,i,o,a=t.dataSet.getDisplayDataSet(),s=(null===(o=t.dataCfg)||void 0===o?void 0:o.fields).columns,l=[],u=function(r,i){var o=[];o=n?s.map((function(e){return fS(t.dataSet.getFieldFormatter(e)(i[e],i))})):s.map((function(t){return fS(i[t])})),t.options.showSeriesNumber&&(o=[fS(r+1)].concat(o)),l.push(o.join(e))};try{for(var c=jC(a.entries()),h=c.next();!h.done;h=c.next()){var d=VC(h.value,2);u(d[0],d[1])}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return l}(e,n,h);var k=[];if(ov(v)&&!e.isPivotMode())k=[C];else{var z=0,F=Jh(v).map((function(t){for(var n=t,r=[];void 0!==n.level;){var i=CS(n.label);pa(i)?z=Bv([z,Ty(i)]):i=c&&e.isPivotMode()?xS(n):i,r.push(i),n=n.parent}return r}));z>1&&(F=function(t){return t.map((function(t){return t.map((function(e){return pa(e)?e:XC([e],VC(new Array(t[0].length-1)),!1)}))}))}(F));for(var H=Bv(F.map((function(t){return t.length}))),W=[],G=function(t){var n=F.map((function(t){return t.length=0;U-=1)G(U);k=W.map((function(n,r){var i,o;if(e.isPivotMode()){var a=e.facet.cornerHeader.cfg,s=a.columns,l=a.rows,u=a.data.filter((function(e){return e.cornerType===t.CornerNodeType.Col}));if(r0&&t.unshift.apply(t,XC([],VC(new Array(e)),!1)),t.map((function(t){return fS(t)})).join(n)})).join("\r\n");return[Y].concat(x).join("\r\n")},t.copyToClipboard=gS,t.copyToClipboardByClipboard=vS,t.copyToClipboardByExecCommand=pS,t.customMerge=s_,t.differenceTempMergedCells=US,t.download=function(t,e){try{var n=document.createElement("a");n.download="".concat(e,".csv");var r=new Blob(["\ufeff".concat(t)],{type:"text/csv;charset=utf-8"});n.href=URL.createObjectURL(r),n.click(),URL.revokeObjectURL(n.href)}catch(t){console.error(t)}},t.drawBar=wx,t.drawBullet=_x,t.drawInterval=Ex,t.drawLine=Cx,t.drawObjectText=Ux,t.extendLocale=function(t){aw=zv({},aw,t)},t.generateId=Bw,t.generatePalette=tw,t.generateStandardColors=JC,t.getActiveCellsInfo=zS,t.getActiveCellsTooltipData=gT,t.getActiveHoverRowColCells=ES,t.getAutoAdjustPosition=Qb,t.getBaseCellData=function(t){var e,n,r,i,o,a,s=null===(r=null===(n=null===(e=t.target)||void 0===e?void 0:e.attrs)||void 0===n?void 0:n.appendInfo)||void 0===r?void 0:r.cellData,l=null===(o=(i=t.target).get)||void 0===o?void 0:o.call(i,"parent");return{target:l,viewMeta:(null===(a=null==l?void 0:l.getMeta)||void 0===a?void 0:a.call(l))||s,event:t}},t.getBorderPositionAndStyle=Bx,t.getBulletRangeColor=xx,t.getCellMeta=ZE,t.getCellWidth=Yx,t.getClassNameWithPrefix=function(){for(var t=[],e=0;e=0:!!t&&!pm(t).startsWith("-")},t.isWindows=xw,t.keyEqualTo=Vx,t.measureTextWidth=Px,t.measureTextWidthRoughly=function(t,e){var n,r;void 0===e&&(e={});var i=Px("a",e),o=Px("蚂",e),a=0;if(!t)return a;try{for(var s=jC(t),l=s.next();!l.done;l=s.next()){var u=l.value.charCodeAt(0);a+=u>=0&&u<=255?i:o}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a},t.mergeCell=FS,t.mergeCellInfo=vT,t.mergeTempMergedCell=function(t,e){var n={};return XC(XC([],VC(t),!1),VC(e),!1).forEach((function(t){n[t.viewMeta.id]=t})),Object.values(n)},t.processCopyData=iS,t.processSort=vE,t.registerIcon=Gw,t.removeUnmergedCellsInfo=HS,t.renderCircle=cx,t.renderIcon=px,t.renderLine=dx,t.renderMiniChart=bx,t.renderPolygon=lx,t.renderPolyline=ux,t.renderRect=sx,t.renderText=hx,t.renderTreeIcon=vx,t.safeJsonParse=jx,t.scale=mx,t.selectCells=$E,t.setLang=function(t){ow=t||iw},t.setState=i_,t.setTooltipContainerStyle=eT,t.sortAction=cE,t.sortByCustom=dE,t.sortByFunc=fE,t.sortByMethod=pE,t.splitTotal=rx,t.transformRatioToPercent=Sx,t.unique=MS,t.unmergeCell=WS,t.updateAllColHeaderCellState=_S,t.updateFillOpacity=function(t,e){fx(t,"fillOpacity",e)},t.updateMergedCells=YS,t.updateRowColCells=t_,t.updateShapeAttr=fx,t.updateStrokeOpacity=function(t,e){fx(t,"strokeOpacity",e)},t.verifyTheElementInTooltip=wT,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=index.min.js.map