Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-canvas

Package Overview
Dependencies
Maintainers
64
Versions
352
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-canvas - npm Package Compare versions

Comparing version 1.11.27-next.10 to 1.11.27-next.11

2

dist/index.umd.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,(function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&i[3]>s[1])){o.label=s[1];break}if(6===s[0]&&i[1]>o.label){o.label=i[1],i=s;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function c(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;a>i;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var l="undefined"!=typeof Float32Array?Float32Array:Array;function h(){var e=new l(16);return l!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],v=t[12],y=t[13],g=t[14],m=t[15],E=n[0],x=n[1],M=n[2],b=n[3];return e[0]=E*r+x*s+M*u+b*v,e[1]=E*i+x*c+M*d+b*y,e[2]=E*a+x*l+M*p+b*g,e[3]=E*o+x*h+M*f+b*m,e[4]=(E=n[4])*r+(x=n[5])*s+(M=n[6])*u+(b=n[7])*v,e[5]=E*i+x*c+M*d+b*y,e[6]=E*a+x*l+M*p+b*g,e[7]=E*o+x*h+M*f+b*m,e[8]=(E=n[8])*r+(x=n[9])*s+(M=n[10])*u+(b=n[11])*v,e[9]=E*i+x*c+M*d+b*y,e[10]=E*a+x*l+M*p+b*g,e[11]=E*o+x*h+M*f+b*m,e[12]=(E=n[12])*r+(x=n[13])*s+(M=n[14])*u+(b=n[15])*v,e[13]=E*i+x*c+M*d+b*y,e[14]=E*a+x*l+M*p+b*g,e[15]=E*o+x*h+M*f+b*m,e}function p(){var e=new l(3);return l!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function f(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function v(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o=o||1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e}function y(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function g(e,t,n,r,i,a,o,s,c,l){var h,u,d,p,f,v=e,m=t,E=n,x=r,M=s,b=c,S=120*Math.PI/180,P=Math.PI/180*(+i||0),C=[];if(l)u=l[0],d=l[1],p=l[2],f=l[3];else{m=(h=y(v,m,-P)).y;var T=((v=h.x)-(M=(h=y(M,b,-P)).x))/2,A=(m-(b=h.y))/2,w=T*T/(E*E)+A*A/(x*x);w>1&&(E*=w=Math.sqrt(w),x*=w);var k=E*E,O=x*x,L=(a===o?-1:1)*Math.sqrt(Math.abs((k*O-k*A*A-O*T*T)/(k*A*A+O*T*T)));p=L*E*A/x+(v+M)/2,u=Math.asin(((m-(f=L*-x*T/E+(m+b)/2))/x*1e9>>0)/1e9),d=Math.asin(((b-f)/x*1e9>>0)/1e9),0>(u=p>v?Math.PI-u:u)&&(u=2*Math.PI+u),0>(d=p>M?Math.PI-d:d)&&(d=2*Math.PI+d),o&&u>d&&(u-=2*Math.PI),!o&&d>u&&(d-=2*Math.PI)}var R=d-u;if(Math.abs(R)>S){var I=d,N=M,B=b;C=g(M=p+E*Math.cos(d=u+S*(o&&d>u?1:-1)),b=f+x*Math.sin(d),E,x,i,0,o,N,B,[d,I,p,f])}R=d-u;var D=Math.cos(u),F=Math.sin(u),G=Math.cos(d),j=Math.sin(d),_=Math.tan(R/4),H=4/3*E*_,$=4/3*x*_,W=[v,m],U=[v+H*F,m-$*D],z=[M+H*j,b-$*G],Y=[M,b];if(U[0]=2*W[0]-U[0],U[1]=2*W[1]-U[1],l)return U.concat(z,Y,C);for(var q=[],Q=0,X=(C=U.concat(z,Y,C)).length;X>Q;Q+=1)q[Q]=Q%2?y(C[Q-1],C[Q],P).y:y(C[Q],C[Q+1],P).x;return q}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),p(),function(){var e,t=(e=new l(2),l!=Float32Array&&(e[0]=0,e[1]=0),e)}();var m=function(e){return null==e},E={}.toString,x=function(e,t){return E.call(e)==="[object "+t+"]"},M=function(e){return x(e,"String")},b=function(e,t,n){return t>e?t:e>n?n:e},S=function(e){return x(e,"Number")};function P(e,t){var n=t.cx,r=t.cy;e.arc(void 0===n?0:n,void 0===r?0:r,t.r,0,2*Math.PI,!1)}function C(e,t){var n=t.cx,r=void 0===n?0:n,i=t.cy,a=void 0===i?0:i,o=t.rx,s=t.ry;if(e.ellipse)e.ellipse(r,a,o,s,0,0,2*Math.PI,!1);else{var c=o>s?o:s,l=o>s?1:o/s,h=o>s?s/o:1;e.save(),e.scale(l,h),e.arc(r,a,c,0,2*Math.PI)}}function T(e,n){var r=n.x1,i=n.y1,a=n.x2,o=n.y2,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=0,d=0,p=0,f=0,v=0;s&&t.isDisplayObject(s)&&l&&(u=Math.cos(v=Math.atan2(o-i,a-r))*(l||0),d=Math.sin(v)*(l||0)),c&&t.isDisplayObject(c)&&h&&(p=Math.cos(v=Math.atan2(i-o,r-a))*(h||0),f=Math.sin(v)*(h||0)),e.moveTo(r+u,i+d),e.lineTo(a+p,o+f)}function A(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,c=n.path,l=c.absolutePath,h=c.segments,u=0,d=0,p=0,f=0,v=0;if(r&&t.isDisplayObject(r)&&a){var y=s(r.parentNode.getStartTangent(),2);u=Math.cos(v=Math.atan2((g=y[0])[1]-(m=y[1])[1],g[0]-m[0]))*(a||0),d=Math.sin(v)*(a||0)}if(i&&t.isDisplayObject(i)&&o){var g,m,E=s(i.parentNode.getEndTangent(),2);p=Math.cos(v=Math.atan2((g=E[0])[1]-(m=E[1])[1],g[0]-m[0]))*(o||0),f=Math.sin(v)*(o||0)}for(var x=0;l.length>x;x++){var M=l[x],b=l[x+1],S=0===x&&(0!==u||0!==d),P=(x===l.length-1||b&&("M"===b[0]||"Z"===b[0]))&&0!==p&&0!==f;switch(M[0]){case"M":S?(e.moveTo(M[1]+u,M[2]+d),e.lineTo(M[1],M[2])):e.moveTo(M[1],M[2]);break;case"L":P?e.lineTo(M[1]+p,M[2]+f):e.lineTo(M[1],M[2]);break;case"Q":e.quadraticCurveTo(M[1],M[2],M[3],M[4]),P&&e.lineTo(M[3]+p,M[4]+f);break;case"C":e.bezierCurveTo(M[1],M[2],M[3],M[4],M[5],M[6]),P&&e.lineTo(M[5]+p,M[6]+f);break;case"A":var C=h[x].arcParams,T=C.cx,A=C.cy,w=C.rx,k=C.ry,O=C.startAngle,L=C.endAngle,R=C.xRotation,I=C.sweepFlag;if(e.ellipse)e.ellipse(T,A,w,k,R,O,L,!!(1-I));else{var N=w>k?w:k,B=w>k?1:w/k,D=w>k?k/w:1;e.translate(T,A),e.rotate(R),e.scale(B,D),e.arc(0,0,N,O,L,!!(1-I)),e.scale(1/B,1/D),e.rotate(-R),e.translate(-T,-A)}P&&e.lineTo(M[6]+p,M[7]+f);break;case"Z":e.closePath()}}}function w(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-1][1]-s[0][1],s[c-1][0]-s[0][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+(p||v),h+(f||y));for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u,d)}function k(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-2][1]-s[c-1][1],s[c-2][0]-s[c-1][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+p,h+f);for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u+v,d+y)}function O(e,t){var n=t.x,r=void 0===n?0:n,i=t.y,a=void 0===i?0:i,o=t.radius,c=t.width,l=t.height,h=c,u=l;if(o&&o.some((function(e){return 0!==e}))){var d=c>0?1:-1,p=l>0?1:-1,f=d+p===0,v=s(o.map((function(e){return b(e,0,Math.min(Math.abs(h)/2,Math.abs(u)/2))})),4),y=v[0],g=v[1],m=v[2],E=v[3];e.moveTo(d*y+r,a),e.lineTo(h-d*g+r,a),0!==g&&e.arc(h-d*g+r,p*g+a,g,-p*Math.PI/2,d>0?0:Math.PI,f),e.lineTo(h+r,u-p*m+a),0!==m&&e.arc(h-d*m+r,u-p*m+a,m,d>0?0:Math.PI,p>0?Math.PI/2:1.5*Math.PI,f),e.lineTo(d*E+r,u+a),0!==E&&e.arc(d*E+r,u-p*E+a,E,p>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,f),e.lineTo(r,p*y+a),0!==y&&e.arc(d*y+r,p*y+a,y,d>0?Math.PI:0,p>0?1.5*Math.PI:Math.PI/2,f)}else e.rect(r,a,h,u)}var L=function(e){function n(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-path-generator",t}return r(n,e),n.prototype.init=function(){var e,n=((e={})[t.Shape.CIRCLE]=P,e[t.Shape.ELLIPSE]=C,e[t.Shape.RECT]=O,e[t.Shape.LINE]=T,e[t.Shape.POLYLINE]=k,e[t.Shape.POLYGON]=w,e[t.Shape.PATH]=A,e[t.Shape.TEXT]=void 0,e[t.Shape.GROUP]=void 0,e[t.Shape.IMAGE]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.pathGeneratorFactory=n},n.prototype.destroy=function(){delete this.context.pathGeneratorFactory},n}(t.AbstractRendererPlugin),R=Object.freeze({__proto__:null,Plugin:L});function I(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}var N=1e-4;function B(e,t,n,r,i,a){var o=-1,l=1/0,h=[n,r],u=20;a&&a>200&&(u=a/10);for(var d=1/u,p=d/10,f=0;u>=f;f++){var v=f*d,y=[i.apply(void 0,c([],s(e.concat([v])),!1)),i.apply(void 0,c([],s(t.concat([v])),!1))];l>(x=I(h[0],h[1],y[0],y[1]))&&(o=v,l=x)}if(0===o)return{x:e[0],y:t[0]};if(1===o){var g=e.length;return{x:e[g-1],y:t[g-1]}}l=1/0;for(f=0;32>f&&N<=p;f++){var m=o-p,E=o+p,x=(y=[i.apply(void 0,c([],s(e.concat([m])),!1)),i.apply(void 0,c([],s(t.concat([m])),!1))],I(h[0],h[1],y[0],y[1]));if(m>=0&&l>x)o=m,l=x;else{var M=[i.apply(void 0,c([],s(e.concat([E])),!1)),i.apply(void 0,c([],s(t.concat([E])),!1))],b=I(h[0],h[1],M[0],M[1]);1>=E&&l>b?(o=E,l=b):p*=.5}}return{x:i.apply(void 0,c([],s(e.concat([o])),!1)),y:i.apply(void 0,c([],s(t.concat([o])),!1))}}function D(e,t,n,r,i,a){var o=[n-e,r-t];if(function(e,t){return e[0]===t[0]&&e[1]===t[1]}(o,[0,0]))return Math.sqrt((i-e)*(i-e)+(a-t)*(a-t));var s=[-o[1],o[0]];return function(e,t){var n=t[0],r=t[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i}(s,s),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([i-e,a-t],s))}function F(e,t,n,r,i){var a=1-i;return a*a*a*e+3*t*i*a*a+3*n*i*i*a+r*i*i*i}function G(e,t,n,r,i,a,o,s,c,l,h){var u=function(e,t,n,r,i,a,o,s,c,l,h){return B([e,n,i,o],[t,r,a,s],c,l,F,h)}(e,t,n,r,i,a,o,s,c,l,h);return I(u.x,u.y,c,l)}function j(e,t,n,r){var i=1-r;return i*i*e+2*r*i*t+r*r*n}function _(e,t,n,r,i,a,o,s){var c=function(e,t,n,r,i,a,o,s){return B([e,n,i],[t,r,a],o,s,j)}(e,t,n,r,i,a,o,s);return I(c.x,c.y,o,s)}var H=p(),$=p(),W=p(),U=h(),z=function(){function e(){var e=this;this.isHit=function(n,r,i,a){var o,s,c,l,h,u,d,p,y,g,m,E,x,M,b,S,P,C,T,A,w,k,O,L,R,I,N,B,D,F,G,j=e.context.pointInPathPickerFactory[n.nodeName];if(j){var _=(o=U,(G=(T=(c=(s=i)[0])*(p=s[5])-(l=s[1])*(d=s[4]))*(F=(x=s[10])*(C=s[15])-(M=s[11])*(P=s[14]))-(A=c*(y=s[6])-(h=s[2])*d)*(D=(E=s[9])*C-M*(S=s[13]))+(w=c*(g=s[7])-(u=s[3])*d)*(B=E*P-x*S)+(k=l*y-h*p)*(N=(m=s[8])*C-M*(b=s[12]))-(O=l*g-u*p)*(I=m*P-x*b)+(L=h*g-u*y)*(R=m*S-E*b))?(o[0]=(p*F-y*D+g*B)*(G=1/G),o[1]=(h*D-l*F-u*B)*G,o[2]=(S*L-P*O+C*k)*G,o[3]=(x*O-E*L-M*k)*G,o[4]=(y*N-d*F-g*I)*G,o[5]=(c*F-h*N+u*I)*G,o[6]=(P*w-b*L-C*A)*G,o[7]=(m*L-x*w+M*A)*G,o[8]=(d*D-p*N+g*R)*G,o[9]=(l*N-c*D-u*R)*G,o[10]=(b*O-S*w+C*T)*G,o[11]=(E*w-m*O-M*T)*G,o[12]=(p*I-d*B-y*R)*G,o[13]=(c*B-l*I+h*R)*G,o[14]=(S*A-b*k-P*T)*G,o[15]=(m*k-E*A+x*T)*G,o):null),H=v($,f(W,r[0],r[1],0),_);if(j(n,new t.Point(H[0],H[1]),a,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,n){var r=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),i=e.context.pathGeneratorFactory[t.nodeName];return i&&(r.beginPath(),i(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return e.prototype.apply=function(t,n){var r,i=this,s=t.renderingService,c=t.renderingContext;this.context=t,this.runtime=n;var l=null===(r=c.root)||void 0===r?void 0:r.ownerDocument;s.hooks.pick.tapPromise(e.tag,(function(e){return a(i,void 0,void 0,(function(){return o(this,(function(t){return[2,this.pick(l,e)]}))}))})),s.hooks.pickSync.tap(e.tag,(function(e){return i.pick(l,e)}))},e.prototype.pick=function(e,n){var r,i,a=n.topmost,o=n.position,s=f(H,o.x,o.y,0),c=e.elementsFromBBox(s[0],s[1],s[0],s[1]),l=[];try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(c),u=h.next();!u.done;u=h.next()){var d=u.value,p=d.getWorldTransform();if(this.isHit(d,s,p,!1)){var v=t.findClosestClipPathTarget(d);if(v){var y=v.parsedStyle.clipPath;if(this.isHit(y,s,y.getWorldTransform(),!0)){if(a)return n.picked=[d],n;l.push(d)}}else{if(a)return n.picked=[d],n;l.push(d)}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return n.picked=l,n},e.tag="CanvasPicker",e}();function Y(e,n,r){var i=e.parsedStyle,a=i.cx,o=i.cy,c=i.r,l=i.fill,h=i.stroke,u=i.lineWidth,d=i.increasedLineWidthForHitTesting,p=i.pointerEvents,f=((void 0===u?0:u)+(void 0===d?0:d))/2,v=I(void 0===a?0:a,void 0===o?0:o,n.x,n.y),y=s(t.isFillOrStrokeAffected(p,l,h),2),g=y[0],m=y[1];return g&&m||r?c+f>=v:g?c>=v:!!m&&(v>=c-f&&c+f>=v)}function q(e,t,n,r){return e/(n*n)+t/(r*r)}function Q(e,n,r){var i=e.parsedStyle,a=i.cx,o=void 0===a?0:a,c=i.cy,l=void 0===c?0:c,h=i.rx,u=i.ry,d=i.lineWidth,p=void 0===d?0:d,f=i.increasedLineWidthForHitTesting,v=void 0===f?0:f,y=n.x,g=n.y,m=s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2),E=m[0],x=m[1],M=(p+v)/2,b=(y-o)*(y-o),S=(g-l)*(g-l);return E&&x||r?1>=q(b,S,h+M,u+M):E?1>=q(b,S,h,u):!!x&&(q(b,S,h-M,u-M)>=1&&1>=q(b,S,h+M,u+M))}function X(e,t,n,r,i,a){return!(e>i||i>e+n||t>a||a>t+r)}function V(e,t,n,r,i,a,o,s){var c=(Math.atan2(s-t,o-e)+2*Math.PI)%(2*Math.PI),l={x:e+n*Math.cos(c),y:t+n*Math.sin(c)};return I(l.x,l.y,o,s)<=a/2}function Z(e,t,n,r,i,a,o){var s=i/2;return!(Math.min(e,n)-s>a||a>Math.max(e,n)+s||Math.min(t,r)-s>o||o>Math.max(t,r)+s)&&D(e,t,n,r,a,o)<=i/2}function J(e,t,n,r,i){var a=e.length;if(2>a)return!1;for(var o=0;a-1>o;o++){if(Z(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,n,r))return!0}if(i){var s=e[0],c=e[a-1];if(Z(s[0],s[1],c[0],c[1],t,n,r))return!0}return!1}var K=1e-6;function ee(e){return K>Math.abs(e)?0:0>e?-1:1}function te(e,t,n){return!((n[0]-e[0])*(t[1]-e[1])!=(t[0]-e[0])*(n[1]-e[1])||Math.min(e[0],t[0])>n[0]||n[0]>Math.max(e[0],t[0])||Math.min(e[1],t[1])>n[1]||n[1]>Math.max(e[1],t[1]))}function ne(e,t,n){var r=!1,i=e.length;if(2>=i)return!1;for(var a=0;i>a;a++){var o=e[a],s=e[(a+1)%i];if(te(o,s,[t,n]))return!0;ee(o[1]-n)>0!=ee(s[1]-n)>0&&0>ee(t-(n-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])&&(r=!r)}return r}function re(e,t,n){for(var r=!1,i=0;e.length>i;i++){if(r=ne(e[i],t,n))break}return r}function ie(e,n,r){var i=e.parsedStyle,a=i.x1,o=i.y1,c=i.x2,l=i.y2,h=i.lineWidth,u=void 0===h?0:h,d=i.increasedLineWidthForHitTesting,p=void 0===d?0:d;return!(!s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2)[1]&&!r||!u)&&Z(a,o,c,l,u+p,n.x,n.y)}function ae(e,n,r,i,a,o){var c=e.parsedStyle,l=c.lineWidth,h=void 0===l?0:l,u=c.increasedLineWidthForHitTesting,d=void 0===u?0:u,p=c.path,f=p.segments,v=p.hasArc,y=p.polylines,m=p.polygons,E=s(t.isFillOrStrokeAffected(c.pointerEvents,(null==m?void 0:m.length)&&c.fill,c.stroke),2),x=E[0],M=E[1],b=t.getOrCalculatePathTotalLength(e),S=!1;return x||r?S=v?i(e,n):re(m,n.x,n.y)||re(y,n.x,n.y):((M||r)&&(S=function(e,t,n,r,i){for(var a=!1,o=t/2,s=0;e.length>s;s++){var c=e[s],l=c.currentPoint,h=c.params,u=c.prePoint,d=c.box;if(!d||X(d.x-o,d.y-o,d.width+t,d.height+t,n,r))switch(c.command){case"L":case"Z":if(a=Z(u[0],u[1],l[0],l[1],t,n,r))return!0;break;case"Q":if(a=t/2>=_(u[0],u[1],h[1],h[2],h[3],h[4],n,r))return!0;break;case"C":if(a=t/2>=G(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],n,r,i))return!0;break;case"A":c.cubicParams||(c.cubicParams=g(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],h[7],void 0));for(var p=c.cubicParams,f=u,v=0;p.length>v;v+=6){var y=G(f[0],f[1],p[v],p[v+1],p[v+2],p[v+3],p[v+4],p[v+5],n,r,i);if(f=[p[v+4],p[v+5]],a=t/2>=y)return!0}}}return a}(f,h+d,n.x,n.y,b)),S)}function oe(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?0:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2),d=u[0],p=!1;return(u[1]||r)&&(p=J(h.points,o+l,n.x,n.y,!0)),p||!d&&!r||(p=ne(h.points,n.x,n.y)),p}function se(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?0:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points;return!(!s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2)[1]&&!r||!o)&&J(h.points,o+l,n.x,n.y,!1)}function ce(e,n,r,i,a){var o=e.parsedStyle,c=o.radius,l=o.lineWidth,h=void 0===l?0:l,u=o.increasedLineWidthForHitTesting,d=void 0===u?0:u,p=o.x,f=void 0===p?0:p,v=o.y,y=void 0===v?0:v,g=o.width,m=o.height,E=s(t.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2),x=E[0],M=E[1],S=h+d;if(c&&c.some((function(e){return 0!==e}))){var P=!1;return(M||r)&&(P=function(e,t,n,r,i,a,o,c){var l=s(i,4),h=l[0],u=l[1],d=l[2],p=l[3];return Z(e+h,t,e+n-u,t,a,o,c)||Z(e+n,t+u,e+n,t+r-d,a,o,c)||Z(e+n-d,t+r,e+p,t+r,a,o,c)||Z(e,t+r-p,e,t+h,a,o,c)||V(e+n-u,t+u,u,0,0,a,o,c)||V(e+n-d,t+r-d,d,0,0,a,o,c)||V(e+p,t+r-p,p,0,0,a,o,c)||V(e+h,t+h,h,0,0,a,o,c)}(f,y,g,m,c.map((function(e){return b(e,0,Math.min(Math.abs(g)/2,Math.abs(m)/2))})),S,n.x,n.y)),P||!x&&!r||(P=i(e,n)),P}var C=S/2;return x&&M||r?X(f-C,y-C,g+C,m+C,n.x,n.y):x?X(f,y,g,m,n.x,n.y):!!M&&function(e,t,n,r,i,a,o){var s=i/2;return X(e-s,t-s,n,i,a,o)||X(e+n-s,t-s,i,r,a,o)||X(e+s,t+r-s,n,i,a,o)||X(e-s,t+s,i,r,a,o)}(f,y,g,m,S,n.x,n.y)}function le(e,n,r,a,o,s){var c=e.parsedStyle,l=c.x,h=void 0===l?0:l,u=c.y,d=void 0===u?0:u,p=c.width,f=c.height;if("non-transparent-pixel"===c.pointerEvents){var v=o.config.offscreenCanvas,y=s.offscreenCanvasCreator.getOrCreateCanvas(v),g=s.offscreenCanvasCreator.getOrCreateContext(v,{willReadFrequently:!0});return y.width=p,y.height=f,o.defaultStyleRendererFactory[t.Shape.IMAGE].render(g,i(i({},e.parsedStyle),{x:0,y:0}),e,void 0,void 0,void 0),g.getImageData(n.x-h,n.y-d,1,1).data.every((function(e){return 0!==e}))}return!0}var he=function(e){function n(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-picker",t}return r(n,e),n.prototype.init=function(){var e,n=((e={})[t.Shape.CIRCLE]=Y,e[t.Shape.ELLIPSE]=Q,e[t.Shape.RECT]=ce,e[t.Shape.LINE]=ie,e[t.Shape.POLYLINE]=se,e[t.Shape.POLYGON]=oe,e[t.Shape.PATH]=ae,e[t.Shape.TEXT]=function(){return!0},e[t.Shape.GROUP]=null,e[t.Shape.IMAGE]=le,e[t.Shape.HTML]=null,e[t.Shape.MESH]=null,e);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new z)},n.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},n}(t.AbstractRendererPlugin),ue=Object.freeze({__proto__:null,Plugin:he}),de=function(){function e(e){this.canvasRendererPluginOptions=e,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=h(),this.dprMatrix=h(),this.tmpMat4=h(),this.vec3a=p(),this.vec3b=p(),this.vec3c=p(),this.vec3d=p()}return e.prototype.apply=function(n,r){var i=this;this.context=n;var a=n.config,o=n.camera,l=n.renderingService,h=n.renderingContext,u=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=u;var p=n.contextService,f=h.root.ownerDocument.defaultView,y=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)},g=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)};l.hooks.init.tap(e.tag,(function(){f.addEventListener(t.ElementEvent.UNMOUNTED,y),f.addEventListener(t.ElementEvent.CULLED,g);var e=p.getDPR(),n=a.width,r=a.height,o=p.getContext();i.clearRect(o,0,0,n*e,r*e,a.background)})),l.hooks.destroy.tap(e.tag,(function(){f.removeEventListener(t.ElementEvent.UNMOUNTED,y),f.removeEventListener(t.ElementEvent.CULLED,g),i.renderQueue=[],i.removedRBushNodeAABBs=[],i.restoreStack=[]})),l.hooks.beginFrame.tap(e.tag,(function(){var e=p.getContext(),t=p.getDPR(),n=a.width,r=a.height,o=i.canvasRendererPluginOptions,s=o.dirtyObjectNumThreshold,c=o.dirtyObjectRatioThreshold,h=l.getStats(),u=h.rendered,d=u/h.total;i.clearFullScreen=l.disableDirtyRectangleRendering()||u>s&&d>c,e&&(e.resetTransform?e.resetTransform():e.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(e,0,0,n*t,r*t,a.background))}));var m=function(e,t){e.isVisible()&&!e.isCulled()&&(i.renderDisplayObject(e,t,i.context,i.restoreStack,r),i.saveDirtyAABB(e)),(e.sortable.sorted||e.childNodes).forEach((function(e){m(e,t)}))};l.hooks.endFrame.tap(e.tag,(function(){var e,n,l=p.getContext(),u=p.getDPR();if((e=i.dprMatrix)[0]=(n=[u,u,1])[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,d(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)m(h.root,l);else{var y=i.safeMergeAABB.apply(i,c([i.mergeDirtyAABBs(i.renderQueue)],s(i.removedRBushNodeAABBs.map((function(e){var n=e.minX,r=e.minY,i=e.maxX,a=e.maxY,o=new t.AABB;return o.setMinMax([n,r,0],[i,a,0]),o}))),!1));if(i.removedRBushNodeAABBs=[],t.AABB.isEmpty(y))return void(i.renderQueue=[]);var g=i.convertAABB2Rect(y),E=g.x,x=g.y,M=g.width,b=g.height,S=v(i.vec3a,[E,x,0],i.vpMatrix),P=v(i.vec3b,[E+M,x,0],i.vpMatrix),C=v(i.vec3c,[E,x+b,0],i.vpMatrix),T=v(i.vec3d,[E+M,x+b,0],i.vpMatrix),A=Math.min(S[0],P[0],T[0],C[0]),w=Math.min(S[1],P[1],T[1],C[1]),k=Math.max(S[0],P[0],T[0],C[0]),O=Math.max(S[1],P[1],T[1],C[1]),L=Math.floor(A),R=Math.floor(w),I=Math.ceil(k-A),N=Math.ceil(O-w);l.save(),i.clearRect(l,L,R,I,N,a.background),l.beginPath(),l.rect(L,R,I,N),l.clip(),l.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]),a.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:L,y:R,width:I,height:N}})),i.searchDirtyObjects(y).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,l,i.context,i.restoreStack,r)})),l.restore(),i.renderQueue.forEach((function(e){i.saveDirtyAABB(e)})),i.renderQueue=[]}i.restoreStack.forEach((function(){l.restore()})),i.restoreStack=[]})),l.hooks.render.tap(e.tag,(function(e){i.clearFullScreen||i.renderQueue.push(e)}))},e.prototype.clearRect=function(e,t,n,r,i,a){e.clearRect(t,n,r,i),a&&(e.fillStyle=a,e.fillRect(t,n,r,i))},e.prototype.renderDisplayObject=function(e,n,r,i,a){var o=e.nodeName,s=i[i.length-1];!s||e.compareDocumentPosition(s)&t.Node.DOCUMENT_POSITION_CONTAINS||(n.restore(),i.pop());var c=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(n.save(),i.push(e),n.beginPath(),u(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),l&&(n.beginPath(),l(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),c&&(c.render(n,e.parsedStyle,e,r,this,a),n.restore()),e.renderable.dirty=!1},e.prototype.convertAABB2Rect=function(e){var t=e.getMin(),n=e.getMax(),r=Math.floor(t[0]),i=Math.floor(t[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},e.prototype.mergeDirtyAABBs=function(e){var n=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();n.add(t);var r=e.renderable.dirtyRenderBounds;r&&n.add(r)})),n},e.prototype.searchDirtyObjects=function(e){var t=s(e.getMin(),2),n=t[0],r=t[1],i=s(e.getMax(),2);return this.rBush.search({minX:n,minY:r,maxX:i[0],maxY:i[1]}).map((function(e){return e.displayObject}))},e.prototype.saveDirtyAABB=function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new t.AABB);var r=e.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)},e.prototype.applyAttributesToContext=function(e,t){var n=t.parsedStyle,r=n.stroke,i=n.fill,a=n.opacity,o=n.lineDash,s=n.lineDashOffset;o&&e.setLineDash(o),m(s)||(e.lineDashOffset=s),m(a)||(e.globalAlpha*=a),m(r)||Array.isArray(r)||r.isNone||(e.strokeStyle=t.attributes.stroke),m(i)||Array.isArray(i)||i.isNone||(e.fillStyle=t.attributes.fill)},e.prototype.applyWorldTransform=function(e,t,n){n?(u(this.tmpMat4,t.getLocalTransform()),d(this.tmpMat4,n,this.tmpMat4),d(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(u(this.tmpMat4,t.getWorldTransform()),d(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},e.prototype.safeMergeAABB=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];var r=new t.AABB;return e.forEach((function(e){r.add(e)})),r},e.tag="CanvasRenderer",e}(),pe=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,n,r,i,a,o){var s=n.fill,c=n.fillRule,l=n.opacity,h=n.fillOpacity,u=n.stroke,d=n.strokeOpacity,p=n.lineWidth,f=n.lineCap,v=n.lineJoin,y=n.shadowType,g=n.shadowColor,E=n.shadowBlur,x=n.filter,M=n.miterLimit,b=!m(s)&&!s.isNone,S=!m(u)&&!u.isNone&&p>0,P=0===s.alpha,C=!(!x||!x.length),T=!m(g)&&E>0,A=r.nodeName,w="inner"===y,k=S&&T&&(A===t.Shape.PATH||A===t.Shape.LINE||A===t.Shape.POLYLINE||P||w);b&&(e.globalAlpha=l*h,k||fe(r,e,T),this.fill(e,r,s,c,i,a,o),k||this.clearShadowAndFilter(e,C,T)),S&&(e.globalAlpha=l*d,e.lineWidth=p,m(M)||(e.miterLimit=M),m(f)||(e.lineCap=f),m(v)||(e.lineJoin=v),k&&(w&&(e.globalCompositeOperation="source-atop"),fe(r,e,!0),w&&(this.stroke(e,r,u,i,a,o),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,C,!0))),this.stroke(e,r,u,i,a,o))},e.prototype.clearShadowAndFilter=function(e,t,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),t){var r=e.filter;!m(r)&&r.indexOf("drop-shadow")>-1&&(e.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},e.prototype.fill=function(e,n,r,i,a,o,s){var c=this;Array.isArray(r)?r.forEach((function(t){e.fillStyle=c.getColor(t,n,e),i?e.fill(i):e.fill()})):(t.isPattern(r)&&(e.fillStyle=this.getPattern(r,n,e,a,o,s)),i?e.fill(i):e.fill())},e.prototype.stroke=function(e,n,r,i,a,o){var s=this;Array.isArray(r)?r.forEach((function(t){e.strokeStyle=s.getColor(t,n,e),e.stroke()})):(t.isPattern(r)&&(e.strokeStyle=this.getPattern(r,n,e,i,a,o)),e.stroke())},e.prototype.getPattern=function(e,t,n,r,i,a){var o,s;if("rect"===e.image.nodeName){var c=e.image.parsedStyle,l=c.width,h=c.height;s=r.contextService.getDPR();var u=r.config.offscreenCanvas;(o=a.offscreenCanvasCreator.getOrCreateCanvas(u)).width=l*s,o.height=h*s;var d=a.offscreenCanvasCreator.getOrCreateContext(u),p=[];e.image.forEach((function(e){i.renderDisplayObject(e,d,r,p,a)})),p.forEach((function(){d.restore()}))}return this.imagePool.getOrCreatePatternSync(e,n,o,s,t.getGeometryBounds().min,(function(){t.renderable.dirty=!0,r.renderingService.dirtify()}))},e.prototype.getColor=function(e,n,r){var a;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var o=n.getGeometryBounds(),s=o&&2*o.halfExtents[0]||1,c=o&&2*o.halfExtents[1]||1,l=o&&o.min||[0,0];a=this.imagePool.getOrCreateGradient(i(i({type:e.type},e.value),{min:l,width:s,height:c}),r)}return a},e}();function fe(e,t,n){var r=e.parsedStyle,i=r.filter,a=r.shadowColor,o=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(t.filter=e.style.filter),n&&(t.shadowColor=""+a,t.shadowBlur=o||0,t.shadowOffsetX=s||0,t.shadowOffsetY=c||0)}var ve=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n){var r,i=t.x,a=void 0===i?0:i,o=t.y,s=void 0===o?0:o,c=t.img,l=t.shadowColor,h=t.shadowBlur,u=t.width,d=t.height;if(M(c)?r=this.imagePool.getImageSync(c):(u||(u=c.width),d||(d=c.height),r=c),r){fe(n,e,!m(l)&&h>0);try{e.drawImage(r,a,s,u,d)}catch(e){}}},e}(),ye=function(){function e(){}return e.prototype.render=function(e,t,n,r,i,a){var o=t.lineWidth,s=t.textAlign,c=t.textBaseline,l=t.lineJoin,h=t.miterLimit,u=t.letterSpacing,d=t.stroke,p=t.fill,f=t.fillOpacity,v=t.strokeOpacity,y=t.opacity,g=t.metrics,E=t.x,x=void 0===E?0:E,M=t.y,b=void 0===M?0:M,S=t.dx,P=t.dy,C=t.shadowColor,T=t.shadowBlur,A=g.lines,w=g.height,k=g.lineHeight,O=g.lineMetrics;e.font=g.font,e.lineWidth=o,e.textAlign="middle"===s?"center":s;var L=c;a.enableCSSParsing||"alphabetic"!==L||(L="bottom"),e.lineJoin=l,m(h)||(e.miterLimit=h);var R=b;"middle"===c?R+=-w/2-k/2:"bottom"===c||"alphabetic"===c||"ideographic"===c?R+=-w:"top"!==c&&"hanging"!==c||(R+=-k);var I=x+(S||0);R+=P||0,1===A.length&&("bottom"===L?(L="middle",R-=.5*w):"top"===L&&(L="middle",R+=.5*w)),e.textBaseline=L,fe(n,e,!m(C)&&T>0);for(var N=0;A.length>N;N++){var B=o/2+I;R+=k,m(d)||d.isNone||!o||this.drawLetterSpacing(e,A[N],O[N],s,B,R,u,f,v,y,!0),m(p)||this.drawLetterSpacing(e,A[N],O[N],s,B,R,u,f,v,y)}},e.prototype.drawLetterSpacing=function(e,t,n,r,i,a,o,s,c,l,h){if(void 0===h&&(h=!1),0!==o){var u=e.textAlign;e.textAlign="left";var d=i;"center"===r||"middle"===r?d=i-n.width/2:"right"!==r&&"end"!==r||(d=i-n.width);for(var p=Array.from(t),f=e.measureText(t).width,v=0,y=0;p.length>y;++y){var g=p[y];h?this.strokeText(e,g,d,a,c):this.fillText(e,g,d,a,s,l),d+=f-(v=e.measureText(t.substring(y+1)).width)+o,f=v}e.textAlign=u}else h?this.strokeText(e,t,i,a,c):this.fillText(e,t,i,a,s,l)},e.prototype.fillText=function(e,t,n,r,i,a){var o,s=!m(i)&&1!==i;s&&(o=e.globalAlpha,e.globalAlpha=i*a),e.fillText(t,n,r),s&&(e.globalAlpha=o)},e.prototype.strokeText=function(e,t,n,r,i){var a,o=!m(i)&&1!==i;o&&(a=e.globalAlpha,e.globalAlpha=i),e.strokeText(t,n,r),o&&(e.globalAlpha=a)},e}(),ge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Pe=function(e){function n(t){void 0===t&&(t={});var n=e.call(this)||this;return n.options=t,n.name="canvas-renderer",n}return r(n,e),n.prototype.init=function(){var e,n=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),r=this.context.imagePool,a=new pe(r),o=((e={})[t.Shape.CIRCLE]=a,e[t.Shape.ELLIPSE]=a,e[t.Shape.RECT]=a,e[t.Shape.IMAGE]=new ve(r),e[t.Shape.TEXT]=new ye,e[t.Shape.LINE]=a,e[t.Shape.POLYLINE]=a,e[t.Shape.POLYGON]=a,e[t.Shape.PATH]=a,e[t.Shape.GROUP]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new de(n))},n.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},n}(t.AbstractRendererPlugin),Ce=Object.freeze({__proto__:null,CircleRenderer:me,EllipseRenderer:Ee,ImageRenderer:ve,LineRenderer:xe,PathRenderer:Se,Plugin:Pe,PolygonRenderer:be,PolylineRenderer:Me,RectRenderer:ge,TextRenderer:ye}),Te=function(){function e(){}return e.prototype.apply=function(t,n){var r=this,i=t.renderingService,a=t.renderingContext,o=t.config;this.context=t;var s=a.root.ownerDocument.defaultView,c=function(e){i.hooks.pointerMove.call(e)},l=function(e){i.hooks.pointerUp.call(e)},h=function(e){i.hooks.pointerDown.call(e)},u=function(e){i.hooks.pointerOver.call(e)},d=function(e){i.hooks.pointerOut.call(e)},p=function(e){i.hooks.pointerCancel.call(e)},f=function(e){i.hooks.pointerWheel.call(e)},v=function(e){i.hooks.click.call(e)};i.hooks.init.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="none",e.style.msTouchAction="none"):s.supportsPointerEvents&&(e.style.touchAction="none"),s.supportsPointerEvents?function(e){n.globalThis.document.addEventListener("pointermove",c,!0),e.addEventListener("pointerdown",h,!0),e.addEventListener("pointerleave",d,!0),e.addEventListener("pointerover",u,!0),n.globalThis.addEventListener("pointerup",l,!0),n.globalThis.addEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.addEventListener("mousemove",c,!0),e.addEventListener("mousedown",h,!0),e.addEventListener("mouseout",d,!0),e.addEventListener("mouseover",u,!0),n.globalThis.addEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.addEventListener("touchstart",h,!0),e.addEventListener("touchend",l,!0),e.addEventListener("touchmove",c,!0),e.addEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.addEventListener("click",v,!0),e.addEventListener("wheel",f,{passive:!0,capture:!0})})),i.hooks.destroy.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):s.supportsPointerEvents&&(e.style.touchAction=""),s.supportsPointerEvents?function(e){n.globalThis.document.removeEventListener("pointermove",c,!0),e.removeEventListener("pointerdown",h,!0),e.removeEventListener("pointerleave",d,!0),e.removeEventListener("pointerover",u,!0),n.globalThis.removeEventListener("pointerup",l,!0)}(e):function(e){n.globalThis.document.removeEventListener("mousemove",c,!0),e.removeEventListener("mousedown",h,!0),e.removeEventListener("mouseout",d,!0),e.removeEventListener("mouseover",u,!0),n.globalThis.removeEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.removeEventListener("touchstart",h,!0),e.removeEventListener("touchend",l,!0),e.removeEventListener("touchmove",c,!0),e.removeEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.removeEventListener("click",v,!0),e.removeEventListener("wheel",f,!0)}))},e.tag="DOMInteraction",e}(),Ae=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="dom-interaction",t}return r(t,e),t.prototype.init=function(){this.addRenderingPlugin(new Te)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),we=Object.freeze({__proto__:null,Plugin:Ae}),ke=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e){return"matrix(".concat([e[0],e[1],e[4],e[5],e[12],e[13]].join(","),")")},e.prototype.apply=function(n,r){var i=this,a=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var c=o.root.ownerDocument.defaultView,l=c.context.eventService.nativeHTMLMap,h=function(e,t){t.style.transform=i.joinTransformMatrix(e.getWorldTransform())},u=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){i.$camera||(i.$camera=i.createCamera(a));var o=i.getOrCreateEl(n);if(i.$camera.appendChild(o),r.enableCSSParsing){var s=n.ownerDocument.documentElement.attributes;Object.keys(s).forEach((function(e){o.style[e]=s[e]}))}Object.keys(n.attributes).forEach((function(e){i.updateAttribute(e,n)})),h(n,o),l.set(o,n)}},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&i.$camera){var r=i.getOrCreateEl(n);r&&(r.remove(),l.delete(r))}},p=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&i.updateAttribute(e.attrName,n)},f=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var r=i.getOrCreateEl(n);h(n,r)}},v=function(){if(i.$camera){var e=i.context.config,t=e.height;i.$camera.style.width="".concat(e.width||0,"px"),i.$camera.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){c.addEventListener(t.CanvasEvent.RESIZE,v),c.addEventListener(t.ElementEvent.MOUNTED,u),c.addEventListener(t.ElementEvent.UNMOUNTED,d),c.addEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.addEventListener(t.ElementEvent.BOUNDS_CHANGED,f)})),s.hooks.endFrame.tap(e.tag,(function(){i.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){i.$camera&&i.$camera.remove(),c.removeEventListener(t.CanvasEvent.RESIZE,v),c.removeEventListener(t.ElementEvent.MOUNTED,u),c.removeEventListener(t.ElementEvent.UNMOUNTED,d),c.removeEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,f)}))},e.prototype.createCamera=function(e){var t=this.context.config,n=t.document,r=t.width,i=t.height,a=this.context.contextService.getDomElement(),o=a.parentNode;if(o){var s="g-canvas-camera",c=o.querySelector("#"+s);if(!c){var l=(n||document).createElement("div");c=l,l.id=s,l.style.position="absolute",l.style.left="".concat(a.offsetLeft||0,"px"),l.style.top="".concat(a.offsetTop||0,"px"),l.style.transformOrigin="left top",l.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),l.style.overflow="hidden",l.style.pointerEvents="none",l.style.width="".concat(r||0,"px"),l.style.height="".concat(i||0,"px"),o.appendChild(l)}return c}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,n=this.displayObjectHTMLElementMap.get(e);return n||(n=(t||document).createElement("div"),e.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(e,n),e.id&&(n.id=e.id),e.name&&n.setAttribute("name",e.name),e.className&&(n.className=e.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform())),n},e.prototype.updateAttribute=function(e,n){var r=this.getOrCreateEl(n);switch(e){case"innerHTML":var i=n.parsedStyle.innerHTML;M(i)?r.innerHTML=i:(r.innerHTML="",r.appendChild(i));break;case"x":r.style.left="".concat(n.parsedStyle.x,"px");break;case"y":r.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var a=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(a[0].value," ").concat(a[1].value);break;case"width":if(this.context.enableCSSParsing){var o=n.computedStyleMap().get("width");r.style.width=""+o}else{r.style.width=S(o=n.parsedStyle.width)?"".concat(o,"px"):""+o}break;case"height":if(this.context.enableCSSParsing){var s=n.computedStyleMap().get("height");r.style.height=""+s}else{r.style.height=S(s=n.parsedStyle.height)?"".concat(s,"px"):""+s}break;case"zIndex":r.style["z-index"]="".concat(n.parsedStyle.zIndex);break;case"visibility":r.style.visibility=n.parsedStyle.visibility;break;case"pointerEvents":r.style.pointerEvents=n.parsedStyle.pointerEvents;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var c=n.parsedStyle.fill,l="";t.isCSSRGB(c)?l=c.isNone?"transparent":n.getAttribute("fill"):Array.isArray(c)?l=n.getAttribute("fill"):t.isPattern(c),r.style.background=l;break;case"stroke":var h=n.parsedStyle.stroke,u="";t.isCSSRGB(h)?u=h.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(h)?u=n.getAttribute("stroke"):t.isPattern(h),r.style["border-color"]=u,r.style["border-style"]="solid";break;case"lineWidth":r.style["border-width"]="".concat(n.parsedStyle.lineWidth||0,"px");break;case"lineDash":r.style["border-style"]="dashed";break;case"filter":r.style.filter=n.style.filter;break;default:m(n.style[e])||""===n.style[e]||(r.style[e]=n.style[e])}},e.tag="HTMLRendering",e}(),Oe=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="html-renderer",t}return r(t,e),t.prototype.init=function(){this.addRenderingPlugin(new ke)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Le=Object.freeze({__proto__:null,Plugin:Oe}),Re=function(){function e(e){this.canvasConfig=e,this.imageCache={},this.gradientCache={},this.patternCache={}}return e.prototype.getImageSync=function(e,t){return this.imageCache[e]?t&&t(this.imageCache[e]):this.getOrCreateImage(e).then((function(e){t&&t(e)})),this.imageCache[e]},e.prototype.getOrCreateImage=function(e){var n=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var r=this.canvasConfig.createImage;return new Promise((function(i,a){var o;r?o=r(e):t.isBrowser&&(o=new window.Image),o&&(o.onload=function(){n.imageCache[e]=o,i(o)},o.onerror=function(e){a(e)},o.crossOrigin="Anonymous",o.src=e)}))},e.prototype.getOrCreatePatternSync=function(e,n,r,i,a,o){var s=this.generatePatternKey(e);if(s&&this.patternCache[s])return this.patternCache[s];var c,l=e.image,u=e.repetition,d=e.transform,p=!1;M(l)?c=this.getImageSync(l,o):r?(c=r,p=!0):c=l;var f,v=c&&n.createPattern(c,u);if(v){var y=void 0;d?y=t.parsedTransformToMat4(t.parseTransform(d),new t.DisplayObject({})):((f=h())[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,y=f),p&&function(e,t,n){var r=n[0],i=n[1],a=n[2];e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(y,y,[1/i,1/i,1]),v.setTransform({a:y[0],b:y[1],c:y[4],d:y[5],e:y[12]+a[0],f:y[13]+a[1]})}return s&&v&&(this.patternCache[s]=v),v},e.prototype.getOrCreateGradient=function(e,n){var r=this.generateGradientKey(e),i=e.type,a=e.steps,o=e.min,s=e.width,c=e.height,l=e.cx,h=e.cy,u=e.size;if(this.gradientCache[r])return this.gradientCache[r];var d=null;if(i===t.GradientType.LinearGradient){var p=t.computeLinearGradient(o,s,c,e.angle);d=n.createLinearGradient(p.x1,p.y1,p.x2,p.y2)}else if(i===t.GradientType.RadialGradient){var f=t.computeRadialGradient(o,s,c,l,h,u),v=f.x,y=f.y;d=n.createRadialGradient(v,y,0,v,y,f.r)}return d&&(a.forEach((function(e){var n=e.offset;n.unit===t.UnitType.kPercentage&&(null==d||d.addColorStop(n.value/100,""+e.color))})),this.gradientCache[r]=d),this.gradientCache[r]},e.prototype.generateGradientKey=function(e){var t=e.min,n=e.width,r=e.height,i=e.steps,a=e.angle,o=e.cx,s=e.cy,c=e.size;return"gradient-".concat(e.type,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat((null==c?void 0:""+c)||0,"-").concat(t[0],"-").concat(t[1],"-").concat(n,"-").concat(r,"-").concat(i.map((function(e){var t=e.color;return"".concat(e.offset).concat(t)})).join("-"))},e.prototype.generatePatternKey=function(e){var t=e.image,n=e.repetition;return M(t)?"pattern-".concat(t,"-").concat(n):"rect"===t.nodeName?"pattern-".concat(t.entity,"-").concat(n):void 0},e}(),Ie=function(){function e(){}return e.prototype.apply=function(n){var r=n.renderingService,i=n.imagePool,a=n.renderingContext.root.ownerDocument.defaultView,o=function(e,t,n){var r=e.parsedStyle,i=r.width,a=r.height;i&&!a?e.setAttribute("height",n/t*i):!i&&a&&e.setAttribute("width",t/n*a)},s=function(e){var n=e.target,a=n.attributes;if(n.nodeName===t.Shape.IMAGE){var s=a.img,c=a.keepAspectRatio;M(s)&&i.getImageSync(s,(function(e){c&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))}},c=function(e){var n=e.target,a=e.newValue;n.nodeName===t.Shape.IMAGE&&"img"===e.attrName&&M(a)&&i.getOrCreateImage(a).then((function(e){n.attributes.keepAspectRatio&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))};r.hooks.init.tap(e.tag,(function(){a.addEventListener(t.ElementEvent.MOUNTED,s),a.addEventListener(t.ElementEvent.ATTR_MODIFIED,c)})),r.hooks.destroy.tap(e.tag,(function(){a.removeEventListener(t.ElementEvent.MOUNTED,s),a.removeEventListener(t.ElementEvent.ATTR_MODIFIED,c)}))},e.tag="LoadImage",e}(),Ne=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="image-loader",t}return r(t,e),t.prototype.init=function(){this.context.imagePool=new Re(this.context.config),this.addRenderingPlugin(new Ie)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Be=Object.freeze({__proto__:null,ImagePool:Re,Plugin:Ne}),De=function(){function e(e){this.renderingContext=e.renderingContext,this.canvasConfig=e.config}return e.prototype.init=function(){var e=this.canvasConfig,t=e.container,n=e.canvas;if(n)this.$canvas=n,t&&n.parentElement!==t&&t.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(t&&(this.$container=M(t)?document.getElementById(t):t,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},e.prototype.getContext=function(){return this.context},e.prototype.getDomElement=function(){return this.$canvas},e.prototype.getDPR=function(){return this.dpr},e.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.prototype.resize=function(e,n){var r=this.canvasConfig.devicePixelRatio||t.isBrowser&&window.devicePixelRatio||1;this.dpr=r=1>r?1:Math.ceil(r),this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,t.setDOMSize(this.$canvas,e,n)),this.renderingContext.renderReasons.add(t.RenderReason.CAMERA_CHANGED)},e.prototype.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},e.prototype.toDataURL=function(e){return void 0===e&&(e={}),a(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.context.canvas.toDataURL(e.type,e.encoderOptions)]}))}))},e}(),Fe=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-context-register",t}return r(t,e),t.prototype.init=function(){this.context.ContextService=De},t.prototype.destroy=function(){delete this.context.ContextService},t}(t.AbstractRendererPlugin),Ge=function(e){function t(t){var n=e.call(this,t)||this;return n.registerPlugin(new Fe),n.registerPlugin(new Ne),n.registerPlugin(new L),n.registerPlugin(new Pe),n.registerPlugin(new Ae),n.registerPlugin(new he),n.registerPlugin(new Oe),n}return r(t,e),t}(t.AbstractRenderer);e.CanvasPathGenerator=R,e.CanvasPicker=ue,e.CanvasRenderer=Ce,e.DomInteraction=we,e.HTMLRenderer=Le,e.ImageLoader=Be,e.Renderer=Ge}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.Canvas2D={}),e.window.G)}(this,(function(e,t){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&i[3]>s[1])){o.label=s[1];break}if(6===s[0]&&i[1]>o.label){o.label=i[1],i=s;break}if(i&&i[2]>o.label){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function c(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;a>i;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var l="undefined"!=typeof Float32Array?Float32Array:Array;function h(){var e=new l(16);return l!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function d(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],v=t[12],y=t[13],g=t[14],m=t[15],E=n[0],x=n[1],M=n[2],b=n[3];return e[0]=E*r+x*s+M*u+b*v,e[1]=E*i+x*c+M*d+b*y,e[2]=E*a+x*l+M*p+b*g,e[3]=E*o+x*h+M*f+b*m,e[4]=(E=n[4])*r+(x=n[5])*s+(M=n[6])*u+(b=n[7])*v,e[5]=E*i+x*c+M*d+b*y,e[6]=E*a+x*l+M*p+b*g,e[7]=E*o+x*h+M*f+b*m,e[8]=(E=n[8])*r+(x=n[9])*s+(M=n[10])*u+(b=n[11])*v,e[9]=E*i+x*c+M*d+b*y,e[10]=E*a+x*l+M*p+b*g,e[11]=E*o+x*h+M*f+b*m,e[12]=(E=n[12])*r+(x=n[13])*s+(M=n[14])*u+(b=n[15])*v,e[13]=E*i+x*c+M*d+b*y,e[14]=E*a+x*l+M*p+b*g,e[15]=E*o+x*h+M*f+b*m,e}function p(){var e=new l(3);return l!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function f(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function v(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o=o||1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e}function y(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}}function g(e,t,n,r,i,a,o,s,c,l){var h,u,d,p,f,v=e,m=t,E=n,x=r,M=s,b=c,S=120*Math.PI/180,P=Math.PI/180*(+i||0),C=[];if(l)u=l[0],d=l[1],p=l[2],f=l[3];else{m=(h=y(v,m,-P)).y;var T=((v=h.x)-(M=(h=y(M,b,-P)).x))/2,A=(m-(b=h.y))/2,w=T*T/(E*E)+A*A/(x*x);w>1&&(E*=w=Math.sqrt(w),x*=w);var k=E*E,O=x*x,L=(a===o?-1:1)*Math.sqrt(Math.abs((k*O-k*A*A-O*T*T)/(k*A*A+O*T*T)));p=L*E*A/x+(v+M)/2,u=Math.asin(((m-(f=L*-x*T/E+(m+b)/2))/x*1e9>>0)/1e9),d=Math.asin(((b-f)/x*1e9>>0)/1e9),0>(u=p>v?Math.PI-u:u)&&(u=2*Math.PI+u),0>(d=p>M?Math.PI-d:d)&&(d=2*Math.PI+d),o&&u>d&&(u-=2*Math.PI),!o&&d>u&&(d-=2*Math.PI)}var R=d-u;if(Math.abs(R)>S){var I=d,N=M,B=b;C=g(M=p+E*Math.cos(d=u+S*(o&&d>u?1:-1)),b=f+x*Math.sin(d),E,x,i,0,o,N,B,[d,I,p,f])}R=d-u;var D=Math.cos(u),F=Math.sin(u),G=Math.cos(d),j=Math.sin(d),_=Math.tan(R/4),H=4/3*E*_,$=4/3*x*_,W=[v,m],U=[v+H*F,m-$*D],z=[M+H*j,b-$*G],Y=[M,b];if(U[0]=2*W[0]-U[0],U[1]=2*W[1]-U[1],l)return U.concat(z,Y,C);for(var q=[],Q=0,X=(C=U.concat(z,Y,C)).length;X>Q;Q+=1)q[Q]=Q%2?y(C[Q-1],C[Q],P).y:y(C[Q],C[Q+1],P).x;return q}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),p(),function(){var e,t=(e=new l(2),l!=Float32Array&&(e[0]=0,e[1]=0),e)}();var m=function(e){return null==e},E={}.toString,x=function(e,t){return E.call(e)==="[object "+t+"]"},M=function(e){return x(e,"String")},b=function(e,t,n){return t>e?t:e>n?n:e},S=function(e){return x(e,"Number")};function P(e,t){var n=t.cx,r=t.cy;e.arc(void 0===n?0:n,void 0===r?0:r,t.r,0,2*Math.PI,!1)}function C(e,t){var n=t.cx,r=void 0===n?0:n,i=t.cy,a=void 0===i?0:i,o=t.rx,s=t.ry;if(e.ellipse)e.ellipse(r,a,o,s,0,0,2*Math.PI,!1);else{var c=o>s?o:s,l=o>s?1:o/s,h=o>s?s/o:1;e.save(),e.scale(l,h),e.arc(r,a,c,0,2*Math.PI)}}function T(e,n){var r=n.x1,i=n.y1,a=n.x2,o=n.y2,s=n.markerStart,c=n.markerEnd,l=n.markerStartOffset,h=n.markerEndOffset,u=0,d=0,p=0,f=0,v=0;s&&t.isDisplayObject(s)&&l&&(u=Math.cos(v=Math.atan2(o-i,a-r))*(l||0),d=Math.sin(v)*(l||0)),c&&t.isDisplayObject(c)&&h&&(p=Math.cos(v=Math.atan2(i-o,r-a))*(h||0),f=Math.sin(v)*(h||0)),e.moveTo(r+u,i+d),e.lineTo(a+p,o+f)}function A(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,c=n.path,l=c.absolutePath,h=c.segments,u=0,d=0,p=0,f=0,v=0;if(r&&t.isDisplayObject(r)&&a){var y=s(r.parentNode.getStartTangent(),2);u=Math.cos(v=Math.atan2((g=y[0])[1]-(m=y[1])[1],g[0]-m[0]))*(a||0),d=Math.sin(v)*(a||0)}if(i&&t.isDisplayObject(i)&&o){var g,m,E=s(i.parentNode.getEndTangent(),2);p=Math.cos(v=Math.atan2((g=E[0])[1]-(m=E[1])[1],g[0]-m[0]))*(o||0),f=Math.sin(v)*(o||0)}for(var x=0;l.length>x;x++){var M=l[x],b=l[x+1],S=0===x&&(0!==u||0!==d),P=(x===l.length-1||b&&("M"===b[0]||"Z"===b[0]))&&0!==p&&0!==f;switch(M[0]){case"M":S?(e.moveTo(M[1]+u,M[2]+d),e.lineTo(M[1],M[2])):e.moveTo(M[1],M[2]);break;case"L":P?e.lineTo(M[1]+p,M[2]+f):e.lineTo(M[1],M[2]);break;case"Q":e.quadraticCurveTo(M[1],M[2],M[3],M[4]),P&&e.lineTo(M[3]+p,M[4]+f);break;case"C":e.bezierCurveTo(M[1],M[2],M[3],M[4],M[5],M[6]),P&&e.lineTo(M[5]+p,M[6]+f);break;case"A":var C=h[x].arcParams,T=C.cx,A=C.cy,w=C.rx,k=C.ry,O=C.startAngle,L=C.endAngle,R=C.xRotation,I=C.sweepFlag;if(e.ellipse)e.ellipse(T,A,w,k,R,O,L,!!(1-I));else{var N=w>k?w:k,B=w>k?1:w/k,D=w>k?k/w:1;e.translate(T,A),e.rotate(R),e.scale(B,D),e.arc(0,0,N,O,L,!!(1-I)),e.scale(1/B,1/D),e.rotate(-R),e.translate(-T,-A)}P&&e.lineTo(M[6]+p,M[7]+f);break;case"Z":e.closePath()}}}function w(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-1][1]-s[0][1],s[c-1][0]-s[0][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+(p||v),h+(f||y));for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u,d)}function k(e,n){var r=n.markerStart,i=n.markerEnd,a=n.markerStartOffset,o=n.markerEndOffset,s=n.points.points,c=s.length,l=s[0][0],h=s[0][1],u=s[c-1][0],d=s[c-1][1],p=0,f=0,v=0,y=0,g=0;r&&t.isDisplayObject(r)&&a&&(p=Math.cos(g=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(a||0),f=Math.sin(g)*(a||0)),i&&t.isDisplayObject(i)&&o&&(v=Math.cos(g=Math.atan2(s[c-2][1]-s[c-1][1],s[c-2][0]-s[c-1][0]))*(o||0),y=Math.sin(g)*(o||0)),e.moveTo(l+p,h+f);for(var m=1;c-1>m;m++){var E=s[m];e.lineTo(E[0],E[1])}e.lineTo(u+v,d+y)}function O(e,t){var n=t.x,r=void 0===n?0:n,i=t.y,a=void 0===i?0:i,o=t.radius,c=t.width,l=t.height,h=c,u=l;if(o&&o.some((function(e){return 0!==e}))){var d=c>0?1:-1,p=l>0?1:-1,f=d+p===0,v=s(o.map((function(e){return b(e,0,Math.min(Math.abs(h)/2,Math.abs(u)/2))})),4),y=v[0],g=v[1],m=v[2],E=v[3];e.moveTo(d*y+r,a),e.lineTo(h-d*g+r,a),0!==g&&e.arc(h-d*g+r,p*g+a,g,-p*Math.PI/2,d>0?0:Math.PI,f),e.lineTo(h+r,u-p*m+a),0!==m&&e.arc(h-d*m+r,u-p*m+a,m,d>0?0:Math.PI,p>0?Math.PI/2:1.5*Math.PI,f),e.lineTo(d*E+r,u+a),0!==E&&e.arc(d*E+r,u-p*E+a,E,p>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,f),e.lineTo(r,p*y+a),0!==y&&e.arc(d*y+r,p*y+a,y,d>0?Math.PI:0,p>0?1.5*Math.PI:Math.PI/2,f)}else e.rect(r,a,h,u)}var L=function(e){function n(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-path-generator",t}return r(n,e),n.prototype.init=function(){var e,n=((e={})[t.Shape.CIRCLE]=P,e[t.Shape.ELLIPSE]=C,e[t.Shape.RECT]=O,e[t.Shape.LINE]=T,e[t.Shape.POLYLINE]=k,e[t.Shape.POLYGON]=w,e[t.Shape.PATH]=A,e[t.Shape.TEXT]=void 0,e[t.Shape.GROUP]=void 0,e[t.Shape.IMAGE]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.pathGeneratorFactory=n},n.prototype.destroy=function(){delete this.context.pathGeneratorFactory},n}(t.AbstractRendererPlugin),R=Object.freeze({__proto__:null,Plugin:L});function I(e,t,n,r){var i=e-n,a=t-r;return Math.sqrt(i*i+a*a)}var N=1e-4;function B(e,t,n,r,i,a){var o=-1,l=1/0,h=[n,r],u=20;a&&a>200&&(u=a/10);for(var d=1/u,p=d/10,f=0;u>=f;f++){var v=f*d,y=[i.apply(void 0,c([],s(e.concat([v])),!1)),i.apply(void 0,c([],s(t.concat([v])),!1))];l>(x=I(h[0],h[1],y[0],y[1]))&&(o=v,l=x)}if(0===o)return{x:e[0],y:t[0]};if(1===o){var g=e.length;return{x:e[g-1],y:t[g-1]}}l=1/0;for(f=0;32>f&&N<=p;f++){var m=o-p,E=o+p,x=(y=[i.apply(void 0,c([],s(e.concat([m])),!1)),i.apply(void 0,c([],s(t.concat([m])),!1))],I(h[0],h[1],y[0],y[1]));if(m>=0&&l>x)o=m,l=x;else{var M=[i.apply(void 0,c([],s(e.concat([E])),!1)),i.apply(void 0,c([],s(t.concat([E])),!1))],b=I(h[0],h[1],M[0],M[1]);1>=E&&l>b?(o=E,l=b):p*=.5}}return{x:i.apply(void 0,c([],s(e.concat([o])),!1)),y:i.apply(void 0,c([],s(t.concat([o])),!1))}}function D(e,t,n,r,i,a){var o=[n-e,r-t];if(function(e,t){return e[0]===t[0]&&e[1]===t[1]}(o,[0,0]))return Math.sqrt((i-e)*(i-e)+(a-t)*(a-t));var s=[-o[1],o[0]];return function(e,t){var n=t[0],r=t[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i}(s,s),Math.abs(function(e,t){return e[0]*t[0]+e[1]*t[1]}([i-e,a-t],s))}function F(e,t,n,r,i){var a=1-i;return a*a*a*e+3*t*i*a*a+3*n*i*i*a+r*i*i*i}function G(e,t,n,r,i,a,o,s,c,l,h){var u=function(e,t,n,r,i,a,o,s,c,l,h){return B([e,n,i,o],[t,r,a,s],c,l,F,h)}(e,t,n,r,i,a,o,s,c,l,h);return I(u.x,u.y,c,l)}function j(e,t,n,r){var i=1-r;return i*i*e+2*r*i*t+r*r*n}function _(e,t,n,r,i,a,o,s){var c=function(e,t,n,r,i,a,o,s){return B([e,n,i],[t,r,a],o,s,j)}(e,t,n,r,i,a,o,s);return I(c.x,c.y,o,s)}var H=p(),$=p(),W=p(),U=h(),z=function(){function e(){var e=this;this.isHit=function(n,r,i,a){var o,s,c,l,h,u,d,p,y,g,m,E,x,M,b,S,P,C,T,A,w,k,O,L,R,I,N,B,D,F,G,j=e.context.pointInPathPickerFactory[n.nodeName];if(j){var _=(o=U,(G=(T=(c=(s=i)[0])*(p=s[5])-(l=s[1])*(d=s[4]))*(F=(x=s[10])*(C=s[15])-(M=s[11])*(P=s[14]))-(A=c*(y=s[6])-(h=s[2])*d)*(D=(E=s[9])*C-M*(S=s[13]))+(w=c*(g=s[7])-(u=s[3])*d)*(B=E*P-x*S)+(k=l*y-h*p)*(N=(m=s[8])*C-M*(b=s[12]))-(O=l*g-u*p)*(I=m*P-x*b)+(L=h*g-u*y)*(R=m*S-E*b))?(o[0]=(p*F-y*D+g*B)*(G=1/G),o[1]=(h*D-l*F-u*B)*G,o[2]=(S*L-P*O+C*k)*G,o[3]=(x*O-E*L-M*k)*G,o[4]=(y*N-d*F-g*I)*G,o[5]=(c*F-h*N+u*I)*G,o[6]=(P*w-b*L-C*A)*G,o[7]=(m*L-x*w+M*A)*G,o[8]=(d*D-p*N+g*R)*G,o[9]=(l*N-c*D-u*R)*G,o[10]=(b*O-S*w+C*T)*G,o[11]=(E*w-m*O-M*T)*G,o[12]=(p*I-d*B-y*R)*G,o[13]=(c*B-l*I+h*R)*G,o[14]=(S*A-b*k-P*T)*G,o[15]=(m*k-E*A+x*T)*G,o):null),H=v($,f(W,r[0],r[1],0),_);if(j(n,new t.Point(H[0],H[1]),a,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,n){var r=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),i=e.context.pathGeneratorFactory[t.nodeName];return i&&(r.beginPath(),i(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return e.prototype.apply=function(t,n){var r,i=this,s=t.renderingService,c=t.renderingContext;this.context=t,this.runtime=n;var l=null===(r=c.root)||void 0===r?void 0:r.ownerDocument;s.hooks.pick.tapPromise(e.tag,(function(e){return a(i,void 0,void 0,(function(){return o(this,(function(t){return[2,this.pick(l,e)]}))}))})),s.hooks.pickSync.tap(e.tag,(function(e){return i.pick(l,e)}))},e.prototype.pick=function(e,n){var r,i,a=n.topmost,o=n.position,s=f(H,o.x,o.y,0),c=e.elementsFromBBox(s[0],s[1],s[0],s[1]),l=[];try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(c),u=h.next();!u.done;u=h.next()){var d=u.value,p=d.getWorldTransform();if(this.isHit(d,s,p,!1)){var v=t.findClosestClipPathTarget(d);if(v){var y=v.parsedStyle.clipPath;if(this.isHit(y,s,y.getWorldTransform(),!0)){if(a)return n.picked=[d],n;l.push(d)}}else{if(a)return n.picked=[d],n;l.push(d)}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return n.picked=l,n},e.tag="CanvasPicker",e}();function Y(e,n,r){var i=e.parsedStyle,a=i.cx,o=i.cy,c=i.r,l=i.fill,h=i.stroke,u=i.lineWidth,d=i.increasedLineWidthForHitTesting,p=i.pointerEvents,f=((void 0===u?0:u)+(void 0===d?0:d))/2,v=I(void 0===a?0:a,void 0===o?0:o,n.x,n.y),y=s(t.isFillOrStrokeAffected(p,l,h),2),g=y[0],m=y[1];return g&&m||r?c+f>=v:g?c>=v:!!m&&(v>=c-f&&c+f>=v)}function q(e,t,n,r){return e/(n*n)+t/(r*r)}function Q(e,n,r){var i=e.parsedStyle,a=i.cx,o=void 0===a?0:a,c=i.cy,l=void 0===c?0:c,h=i.rx,u=i.ry,d=i.lineWidth,p=void 0===d?0:d,f=i.increasedLineWidthForHitTesting,v=void 0===f?0:f,y=n.x,g=n.y,m=s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2),E=m[0],x=m[1],M=(p+v)/2,b=(y-o)*(y-o),S=(g-l)*(g-l);return E&&x||r?1>=q(b,S,h+M,u+M):E?1>=q(b,S,h,u):!!x&&(q(b,S,h-M,u-M)>=1&&1>=q(b,S,h+M,u+M))}function X(e,t,n,r,i,a){return!(e>i||i>e+n||t>a||a>t+r)}function V(e,t,n,r,i,a,o,s){var c=(Math.atan2(s-t,o-e)+2*Math.PI)%(2*Math.PI),l={x:e+n*Math.cos(c),y:t+n*Math.sin(c)};return I(l.x,l.y,o,s)<=a/2}function Z(e,t,n,r,i,a,o){var s=i/2;return!(Math.min(e,n)-s>a||a>Math.max(e,n)+s||Math.min(t,r)-s>o||o>Math.max(t,r)+s)&&D(e,t,n,r,a,o)<=i/2}function J(e,t,n,r,i){var a=e.length;if(2>a)return!1;for(var o=0;a-1>o;o++){if(Z(e[o][0],e[o][1],e[o+1][0],e[o+1][1],t,n,r))return!0}if(i){var s=e[0],c=e[a-1];if(Z(s[0],s[1],c[0],c[1],t,n,r))return!0}return!1}var K=1e-6;function ee(e){return K>Math.abs(e)?0:0>e?-1:1}function te(e,t,n){return!((n[0]-e[0])*(t[1]-e[1])!=(t[0]-e[0])*(n[1]-e[1])||Math.min(e[0],t[0])>n[0]||n[0]>Math.max(e[0],t[0])||Math.min(e[1],t[1])>n[1]||n[1]>Math.max(e[1],t[1]))}function ne(e,t,n){var r=!1,i=e.length;if(2>=i)return!1;for(var a=0;i>a;a++){var o=e[a],s=e[(a+1)%i];if(te(o,s,[t,n]))return!0;ee(o[1]-n)>0!=ee(s[1]-n)>0&&0>ee(t-(n-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])&&(r=!r)}return r}function re(e,t,n){for(var r=!1,i=0;e.length>i;i++){if(r=ne(e[i],t,n))break}return r}function ie(e,n,r){var i=e.parsedStyle,a=i.x1,o=i.y1,c=i.x2,l=i.y2,h=i.lineWidth,u=void 0===h?0:h,d=i.increasedLineWidthForHitTesting,p=void 0===d?0:d;return!(!s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2)[1]&&!r||!u)&&Z(a,o,c,l,u+p,n.x,n.y)}function ae(e,n,r,i,a,o){var c=e.parsedStyle,l=c.lineWidth,h=void 0===l?0:l,u=c.increasedLineWidthForHitTesting,d=void 0===u?0:u,p=c.path,f=p.segments,v=p.hasArc,y=p.polylines,m=p.polygons,E=s(t.isFillOrStrokeAffected(c.pointerEvents,(null==m?void 0:m.length)&&c.fill,c.stroke),2),x=E[0],M=E[1],b=t.getOrCalculatePathTotalLength(e),S=!1;return x||r?S=v?i(e,n):re(m,n.x,n.y)||re(y,n.x,n.y):((M||r)&&(S=function(e,t,n,r,i){for(var a=!1,o=t/2,s=0;e.length>s;s++){var c=e[s],l=c.currentPoint,h=c.params,u=c.prePoint,d=c.box;if(!d||X(d.x-o,d.y-o,d.width+t,d.height+t,n,r))switch(c.command){case"L":case"Z":if(a=Z(u[0],u[1],l[0],l[1],t,n,r))return!0;break;case"Q":if(a=t/2>=_(u[0],u[1],h[1],h[2],h[3],h[4],n,r))return!0;break;case"C":if(a=t/2>=G(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],n,r,i))return!0;break;case"A":c.cubicParams||(c.cubicParams=g(u[0],u[1],h[1],h[2],h[3],h[4],h[5],h[6],h[7],void 0));for(var p=c.cubicParams,f=u,v=0;p.length>v;v+=6){var y=G(f[0],f[1],p[v],p[v+1],p[v+2],p[v+3],p[v+4],p[v+5],n,r,i);if(f=[p[v+4],p[v+5]],a=t/2>=y)return!0}}}return a}(f,h+d,n.x,n.y,b)),S)}function oe(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?0:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points,u=s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2),d=u[0],p=!1;return(u[1]||r)&&(p=J(h.points,o+l,n.x,n.y,!0)),p||!d&&!r||(p=ne(h.points,n.x,n.y)),p}function se(e,n,r){var i=e.parsedStyle,a=i.lineWidth,o=void 0===a?0:a,c=i.increasedLineWidthForHitTesting,l=void 0===c?0:c,h=i.points;return!(!s(t.isFillOrStrokeAffected(i.pointerEvents,i.fill,i.stroke),2)[1]&&!r||!o)&&J(h.points,o+l,n.x,n.y,!1)}function ce(e,n,r,i,a){var o=e.parsedStyle,c=o.radius,l=o.lineWidth,h=void 0===l?0:l,u=o.increasedLineWidthForHitTesting,d=void 0===u?0:u,p=o.x,f=void 0===p?0:p,v=o.y,y=void 0===v?0:v,g=o.width,m=o.height,E=s(t.isFillOrStrokeAffected(o.pointerEvents,o.fill,o.stroke),2),x=E[0],M=E[1],S=h+d;if(c&&c.some((function(e){return 0!==e}))){var P=!1;return(M||r)&&(P=function(e,t,n,r,i,a,o,c){var l=s(i,4),h=l[0],u=l[1],d=l[2],p=l[3];return Z(e+h,t,e+n-u,t,a,o,c)||Z(e+n,t+u,e+n,t+r-d,a,o,c)||Z(e+n-d,t+r,e+p,t+r,a,o,c)||Z(e,t+r-p,e,t+h,a,o,c)||V(e+n-u,t+u,u,0,0,a,o,c)||V(e+n-d,t+r-d,d,0,0,a,o,c)||V(e+p,t+r-p,p,0,0,a,o,c)||V(e+h,t+h,h,0,0,a,o,c)}(f,y,g,m,c.map((function(e){return b(e,0,Math.min(Math.abs(g)/2,Math.abs(m)/2))})),S,n.x,n.y)),P||!x&&!r||(P=i(e,n)),P}var C=S/2;return x&&M||r?X(f-C,y-C,g+C,m+C,n.x,n.y):x?X(f,y,g,m,n.x,n.y):!!M&&function(e,t,n,r,i,a,o){var s=i/2;return X(e-s,t-s,n,i,a,o)||X(e+n-s,t-s,i,r,a,o)||X(e+s,t+r-s,n,i,a,o)||X(e-s,t+s,i,r,a,o)}(f,y,g,m,S,n.x,n.y)}function le(e,n,r,a,o,s){var c=e.parsedStyle,l=c.x,h=void 0===l?0:l,u=c.y,d=void 0===u?0:u,p=c.width,f=c.height;if("non-transparent-pixel"===c.pointerEvents){var v=o.config.offscreenCanvas,y=s.offscreenCanvasCreator.getOrCreateCanvas(v),g=s.offscreenCanvasCreator.getOrCreateContext(v,{willReadFrequently:!0});return y.width=p,y.height=f,o.defaultStyleRendererFactory[t.Shape.IMAGE].render(g,i(i({},e.parsedStyle),{x:0,y:0}),e,void 0,void 0,void 0),g.getImageData(n.x-h,n.y-d,1,1).data.every((function(e){return 0!==e}))}return!0}var he=function(e){function n(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-picker",t}return r(n,e),n.prototype.init=function(){var e,n=((e={})[t.Shape.CIRCLE]=Y,e[t.Shape.ELLIPSE]=Q,e[t.Shape.RECT]=ce,e[t.Shape.LINE]=ie,e[t.Shape.POLYLINE]=se,e[t.Shape.POLYGON]=oe,e[t.Shape.PATH]=ae,e[t.Shape.TEXT]=function(){return!0},e[t.Shape.GROUP]=null,e[t.Shape.IMAGE]=le,e[t.Shape.HTML]=null,e[t.Shape.MESH]=null,e);this.context.pointInPathPickerFactory=n,this.addRenderingPlugin(new z)},n.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},n}(t.AbstractRendererPlugin),ue=Object.freeze({__proto__:null,Plugin:he}),de=function(){function e(e){this.canvasRendererPluginOptions=e,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=h(),this.dprMatrix=h(),this.tmpMat4=h(),this.vec3a=p(),this.vec3b=p(),this.vec3c=p(),this.vec3d=p()}return e.prototype.apply=function(n,r){var i=this;this.context=n;var a=n.config,o=n.camera,l=n.renderingService,h=n.renderingContext,u=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=u;var p=n.contextService,f=h.root.ownerDocument.defaultView,y=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)},g=function(e){var t=e.target.rBushNode;t.aabb&&i.removedRBushNodeAABBs.push(t.aabb)};l.hooks.init.tap(e.tag,(function(){f.addEventListener(t.ElementEvent.UNMOUNTED,y),f.addEventListener(t.ElementEvent.CULLED,g);var e=p.getDPR(),n=a.width,r=a.height,o=p.getContext();i.clearRect(o,0,0,n*e,r*e,a.background)})),l.hooks.destroy.tap(e.tag,(function(){f.removeEventListener(t.ElementEvent.UNMOUNTED,y),f.removeEventListener(t.ElementEvent.CULLED,g),i.renderQueue=[],i.removedRBushNodeAABBs=[],i.restoreStack=[]})),l.hooks.beginFrame.tap(e.tag,(function(){var e=p.getContext(),t=p.getDPR(),n=a.width,r=a.height,o=i.canvasRendererPluginOptions,s=o.dirtyObjectNumThreshold,c=o.dirtyObjectRatioThreshold,h=l.getStats(),u=h.rendered,d=u/h.total;i.clearFullScreen=i.clearFullScreenLastFrame||l.disableDirtyRectangleRendering()||u>s&&d>c,e&&(e.resetTransform?e.resetTransform():e.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(e,0,0,n*t,r*t,a.background))}));var m=function(e,t){e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,t,i.context,i.restoreStack,r),(e.sortable.sorted||e.childNodes).forEach((function(e){m(e,t)}))};l.hooks.endFrame.tap(e.tag,(function(){if(0!==h.root.childNodes.length){i.clearFullScreenLastFrame=!1;var e,n,l=p.getContext(),u=p.getDPR();if((e=i.dprMatrix)[0]=(n=[u,u,1])[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,d(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)m(h.root,l);else{var y=i.safeMergeAABB.apply(i,c([i.mergeDirtyAABBs(i.renderQueue)],s(i.removedRBushNodeAABBs.map((function(e){var n=e.minX,r=e.minY,i=e.maxX,a=e.maxY,o=new t.AABB;return o.setMinMax([n,r,0],[i,a,0]),o}))),!1));if(i.removedRBushNodeAABBs=[],t.AABB.isEmpty(y))return void(i.renderQueue=[]);var g=i.convertAABB2Rect(y),E=g.x,x=g.y,M=g.width,b=g.height,S=v(i.vec3a,[E,x,0],i.vpMatrix),P=v(i.vec3b,[E+M,x,0],i.vpMatrix),C=v(i.vec3c,[E,x+b,0],i.vpMatrix),T=v(i.vec3d,[E+M,x+b,0],i.vpMatrix),A=Math.min(S[0],P[0],T[0],C[0]),w=Math.min(S[1],P[1],T[1],C[1]),k=Math.max(S[0],P[0],T[0],C[0]),O=Math.max(S[1],P[1],T[1],C[1]),L=Math.floor(A),R=Math.floor(w),I=Math.ceil(k-A),N=Math.ceil(O-w);l.save(),i.clearRect(l,L,R,I,N,a.background),l.beginPath(),l.rect(L,R,I,N),l.clip(),l.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]),a.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:L,y:R,width:I,height:N}}));var B=i.searchDirtyObjects(y);console.log(B,y),B.sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&i.renderDisplayObject(e,l,i.context,i.restoreStack,r)})),l.restore(),i.renderQueue.forEach((function(e){i.saveDirtyAABB(e)})),i.renderQueue=[]}i.restoreStack.forEach((function(){l.restore()})),i.restoreStack=[]}else i.clearFullScreenLastFrame=!0})),l.hooks.render.tap(e.tag,(function(e){i.clearFullScreen||i.renderQueue.push(e)}))},e.prototype.clearRect=function(e,t,n,r,i,a){e.clearRect(t,n,r,i),a&&(e.fillStyle=a,e.fillRect(t,n,r,i))},e.prototype.renderDisplayObject=function(e,n,r,i,a){var o=e.nodeName,s=i[i.length-1];!s||e.compareDocumentPosition(s)&t.Node.DOCUMENT_POSITION_CONTAINS||(n.restore(),i.pop());var c=this.context.styleRendererFactory[o],l=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(n.save(),i.push(e),n.beginPath(),u(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),l&&(n.beginPath(),l(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),c&&(c.render(n,e.parsedStyle,e,r,this,a),n.restore()),e.renderable.dirty=!1},e.prototype.convertAABB2Rect=function(e){var t=e.getMin(),n=e.getMax(),r=Math.floor(t[0]),i=Math.floor(t[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},e.prototype.mergeDirtyAABBs=function(e){var n=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();n.add(t);var r=e.renderable.dirtyRenderBounds;r&&n.add(r)})),n},e.prototype.searchDirtyObjects=function(e){var t=s(e.getMin(),2),n=t[0],r=t[1],i=s(e.getMax(),2);return this.rBush.search({minX:n,minY:r,maxX:i[0],maxY:i[1]}).map((function(e){return e.displayObject}))},e.prototype.saveDirtyAABB=function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new t.AABB);var r=e.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)},e.prototype.applyAttributesToContext=function(e,t){var n=t.parsedStyle,r=n.stroke,i=n.fill,a=n.opacity,o=n.lineDash,s=n.lineDashOffset;o&&e.setLineDash(o),m(s)||(e.lineDashOffset=s),m(a)||(e.globalAlpha*=a),m(r)||Array.isArray(r)||r.isNone||(e.strokeStyle=t.attributes.stroke),m(i)||Array.isArray(i)||i.isNone||(e.fillStyle=t.attributes.fill)},e.prototype.applyWorldTransform=function(e,t,n){n?(u(this.tmpMat4,t.getLocalTransform()),d(this.tmpMat4,n,this.tmpMat4),d(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(u(this.tmpMat4,t.getWorldTransform()),d(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},e.prototype.safeMergeAABB=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];var r=new t.AABB;return e.forEach((function(e){r.add(e)})),r},e.tag="CanvasRenderer",e}(),pe=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,n,r,i,a,o){var s=n.fill,c=n.fillRule,l=n.opacity,h=n.fillOpacity,u=n.stroke,d=n.strokeOpacity,p=n.lineWidth,f=n.lineCap,v=n.lineJoin,y=n.shadowType,g=n.shadowColor,E=n.shadowBlur,x=n.filter,M=n.miterLimit,b=!m(s)&&!s.isNone,S=!m(u)&&!u.isNone&&p>0,P=0===(null==s?void 0:s.alpha),C=!(!x||!x.length),T=!m(g)&&E>0,A=r.nodeName,w="inner"===y,k=S&&T&&(A===t.Shape.PATH||A===t.Shape.LINE||A===t.Shape.POLYLINE||P||w);b&&(e.globalAlpha=l*h,k||fe(r,e,T),this.fill(e,r,s,c,i,a,o),k||this.clearShadowAndFilter(e,C,T)),S&&(e.globalAlpha=l*d,e.lineWidth=p,m(M)||(e.miterLimit=M),m(f)||(e.lineCap=f),m(v)||(e.lineJoin=v),k&&(w&&(e.globalCompositeOperation="source-atop"),fe(r,e,!0),w&&(this.stroke(e,r,u,i,a,o),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,C,!0))),this.stroke(e,r,u,i,a,o))},e.prototype.clearShadowAndFilter=function(e,t,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),t){var r=e.filter;!m(r)&&r.indexOf("drop-shadow")>-1&&(e.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},e.prototype.fill=function(e,n,r,i,a,o,s){var c=this;Array.isArray(r)?r.forEach((function(t){e.fillStyle=c.getColor(t,n,e),i?e.fill(i):e.fill()})):(t.isPattern(r)&&(e.fillStyle=this.getPattern(r,n,e,a,o,s)),i?e.fill(i):e.fill())},e.prototype.stroke=function(e,n,r,i,a,o){var s=this;Array.isArray(r)?r.forEach((function(t){e.strokeStyle=s.getColor(t,n,e),e.stroke()})):(t.isPattern(r)&&(e.strokeStyle=this.getPattern(r,n,e,i,a,o)),e.stroke())},e.prototype.getPattern=function(e,t,n,r,i,a){var o,s;if("rect"===e.image.nodeName){var c=e.image.parsedStyle,l=c.width,h=c.height;s=r.contextService.getDPR();var u=r.config.offscreenCanvas;(o=a.offscreenCanvasCreator.getOrCreateCanvas(u)).width=l*s,o.height=h*s;var d=a.offscreenCanvasCreator.getOrCreateContext(u),p=[];e.image.forEach((function(e){i.renderDisplayObject(e,d,r,p,a)})),p.forEach((function(){d.restore()}))}return this.imagePool.getOrCreatePatternSync(e,n,o,s,t.getGeometryBounds().min,(function(){t.renderable.dirty=!0,r.renderingService.dirtify()}))},e.prototype.getColor=function(e,n,r){var a;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var o=n.getGeometryBounds(),s=o&&2*o.halfExtents[0]||1,c=o&&2*o.halfExtents[1]||1,l=o&&o.min||[0,0];a=this.imagePool.getOrCreateGradient(i(i({type:e.type},e.value),{min:l,width:s,height:c}),r)}return a},e}();function fe(e,t,n){var r=e.parsedStyle,i=r.filter,a=r.shadowColor,o=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(t.filter=e.style.filter),n&&(t.shadowColor=""+a,t.shadowBlur=o||0,t.shadowOffsetX=s||0,t.shadowOffsetY=c||0)}var ve=function(){function e(e){this.imagePool=e}return e.prototype.render=function(e,t,n){var r,i=t.x,a=void 0===i?0:i,o=t.y,s=void 0===o?0:o,c=t.img,l=t.shadowColor,h=t.shadowBlur,u=t.width,d=t.height;if(M(c)?r=this.imagePool.getImageSync(c):(u||(u=c.width),d||(d=c.height),r=c),r){fe(n,e,!m(l)&&h>0);try{e.drawImage(r,a,s,u,d)}catch(e){}}},e}(),ye=function(){function e(){}return e.prototype.render=function(e,t,n,r,i,a){var o=t.lineWidth,s=t.textAlign,c=t.textBaseline,l=t.lineJoin,h=t.miterLimit,u=t.letterSpacing,d=t.stroke,p=t.fill,f=t.fillOpacity,v=t.strokeOpacity,y=t.opacity,g=t.metrics,E=t.x,x=void 0===E?0:E,M=t.y,b=void 0===M?0:M,S=t.dx,P=t.dy,C=t.shadowColor,T=t.shadowBlur,A=g.lines,w=g.height,k=g.lineHeight,O=g.lineMetrics;e.font=g.font,e.lineWidth=o,e.textAlign="middle"===s?"center":s;var L=c;a.enableCSSParsing||"alphabetic"!==L||(L="bottom"),e.lineJoin=l,m(h)||(e.miterLimit=h);var R=b;"middle"===c?R+=-w/2-k/2:"bottom"===c||"alphabetic"===c||"ideographic"===c?R+=-w:"top"!==c&&"hanging"!==c||(R+=-k);var I=x+(S||0);R+=P||0,1===A.length&&("bottom"===L?(L="middle",R-=.5*w):"top"===L&&(L="middle",R+=.5*w)),e.textBaseline=L,fe(n,e,!m(C)&&T>0);for(var N=0;A.length>N;N++){var B=o/2+I;R+=k,m(d)||d.isNone||!o||this.drawLetterSpacing(e,A[N],O[N],s,B,R,u,f,v,y,!0),m(p)||this.drawLetterSpacing(e,A[N],O[N],s,B,R,u,f,v,y)}},e.prototype.drawLetterSpacing=function(e,t,n,r,i,a,o,s,c,l,h){if(void 0===h&&(h=!1),0!==o){var u=e.textAlign;e.textAlign="left";var d=i;"center"===r||"middle"===r?d=i-n.width/2:"right"!==r&&"end"!==r||(d=i-n.width);for(var p=Array.from(t),f=e.measureText(t).width,v=0,y=0;p.length>y;++y){var g=p[y];h?this.strokeText(e,g,d,a,c):this.fillText(e,g,d,a,s,l),d+=f-(v=e.measureText(t.substring(y+1)).width)+o,f=v}e.textAlign=u}else h?this.strokeText(e,t,i,a,c):this.fillText(e,t,i,a,s,l)},e.prototype.fillText=function(e,t,n,r,i,a){var o,s=!m(i)&&1!==i;s&&(o=e.globalAlpha,e.globalAlpha=i*a),e.fillText(t,n,r),s&&(e.globalAlpha=o)},e.prototype.strokeText=function(e,t,n,r,i){var a,o=!m(i)&&1!==i;o&&(a=e.globalAlpha,e.globalAlpha=i),e.strokeText(t,n,r),o&&(e.globalAlpha=a)},e}(),ge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(pe),Pe=function(e){function n(t){void 0===t&&(t={});var n=e.call(this)||this;return n.options=t,n.name="canvas-renderer",n}return r(n,e),n.prototype.init=function(){var e,n=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),r=this.context.imagePool,a=new pe(r),o=((e={})[t.Shape.CIRCLE]=a,e[t.Shape.ELLIPSE]=a,e[t.Shape.RECT]=a,e[t.Shape.IMAGE]=new ve(r),e[t.Shape.TEXT]=new ye,e[t.Shape.LINE]=a,e[t.Shape.POLYLINE]=a,e[t.Shape.POLYGON]=a,e[t.Shape.PATH]=a,e[t.Shape.GROUP]=void 0,e[t.Shape.HTML]=void 0,e[t.Shape.MESH]=void 0,e);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new de(n))},n.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},n}(t.AbstractRendererPlugin),Ce=Object.freeze({__proto__:null,CircleRenderer:me,EllipseRenderer:Ee,ImageRenderer:ve,LineRenderer:xe,PathRenderer:Se,Plugin:Pe,PolygonRenderer:be,PolylineRenderer:Me,RectRenderer:ge,TextRenderer:ye}),Te=function(){function e(){}return e.prototype.apply=function(t,n){var r=this,i=t.renderingService,a=t.renderingContext,o=t.config;this.context=t;var s=a.root.ownerDocument.defaultView,c=function(e){i.hooks.pointerMove.call(e)},l=function(e){i.hooks.pointerUp.call(e)},h=function(e){i.hooks.pointerDown.call(e)},u=function(e){i.hooks.pointerOver.call(e)},d=function(e){i.hooks.pointerOut.call(e)},p=function(e){i.hooks.pointerCancel.call(e)},f=function(e){i.hooks.pointerWheel.call(e)},v=function(e){i.hooks.click.call(e)};i.hooks.init.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="none",e.style.msTouchAction="none"):s.supportsPointerEvents&&(e.style.touchAction="none"),s.supportsPointerEvents?function(e){n.globalThis.document.addEventListener("pointermove",c,!0),e.addEventListener("pointerdown",h,!0),e.addEventListener("pointerleave",d,!0),e.addEventListener("pointerover",u,!0),n.globalThis.addEventListener("pointerup",l,!0),n.globalThis.addEventListener("pointercancel",p,!0)}(e):function(e){n.globalThis.document.addEventListener("mousemove",c,!0),e.addEventListener("mousedown",h,!0),e.addEventListener("mouseout",d,!0),e.addEventListener("mouseover",u,!0),n.globalThis.addEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.addEventListener("touchstart",h,!0),e.addEventListener("touchend",l,!0),e.addEventListener("touchmove",c,!0),e.addEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.addEventListener("click",v,!0),e.addEventListener("wheel",f,{passive:!0,capture:!0})})),i.hooks.destroy.tap(e.tag,(function(){var e=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):s.supportsPointerEvents&&(e.style.touchAction=""),s.supportsPointerEvents?function(e){n.globalThis.document.removeEventListener("pointermove",c,!0),e.removeEventListener("pointerdown",h,!0),e.removeEventListener("pointerleave",d,!0),e.removeEventListener("pointerover",u,!0),n.globalThis.removeEventListener("pointerup",l,!0)}(e):function(e){n.globalThis.document.removeEventListener("mousemove",c,!0),e.removeEventListener("mousedown",h,!0),e.removeEventListener("mouseout",d,!0),e.removeEventListener("mouseover",u,!0),n.globalThis.removeEventListener("mouseup",l,!0)}(e),s.supportsTouchEvents&&function(e){e.removeEventListener("touchstart",h,!0),e.removeEventListener("touchend",l,!0),e.removeEventListener("touchmove",c,!0),e.removeEventListener("touchcancel",p,!0)}(e),o.useNativeClickEvent&&e.removeEventListener("click",v,!0),e.removeEventListener("wheel",f,!0)}))},e.tag="DOMInteraction",e}(),Ae=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="dom-interaction",t}return r(t,e),t.prototype.init=function(){this.addRenderingPlugin(new Te)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),we=Object.freeze({__proto__:null,Plugin:Ae}),ke=function(){function e(){this.displayObjectHTMLElementMap=new WeakMap}return e.prototype.joinTransformMatrix=function(e){return"matrix(".concat([e[0],e[1],e[4],e[5],e[12],e[13]].join(","),")")},e.prototype.apply=function(n,r){var i=this,a=n.camera,o=n.renderingContext,s=n.renderingService;this.context=n;var c=o.root.ownerDocument.defaultView,l=c.context.eventService.nativeHTMLMap,h=function(e,t){t.style.transform=i.joinTransformMatrix(e.getWorldTransform())},u=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){i.$camera||(i.$camera=i.createCamera(a));var o=i.getOrCreateEl(n);if(i.$camera.appendChild(o),r.enableCSSParsing){var s=n.ownerDocument.documentElement.attributes;Object.keys(s).forEach((function(e){o.style[e]=s[e]}))}Object.keys(n.attributes).forEach((function(e){i.updateAttribute(e,n)})),h(n,o),l.set(o,n)}},d=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML&&i.$camera){var r=i.getOrCreateEl(n);r&&(r.remove(),l.delete(r))}},p=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&i.updateAttribute(e.attrName,n)},f=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var r=i.getOrCreateEl(n);h(n,r)}},v=function(){if(i.$camera){var e=i.context.config,t=e.height;i.$camera.style.width="".concat(e.width||0,"px"),i.$camera.style.height="".concat(t||0,"px")}};s.hooks.init.tap(e.tag,(function(){c.addEventListener(t.CanvasEvent.RESIZE,v),c.addEventListener(t.ElementEvent.MOUNTED,u),c.addEventListener(t.ElementEvent.UNMOUNTED,d),c.addEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.addEventListener(t.ElementEvent.BOUNDS_CHANGED,f)})),s.hooks.endFrame.tap(e.tag,(function(){i.$camera&&o.renderReasons.has(t.RenderReason.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))})),s.hooks.destroy.tap(e.tag,(function(){i.$camera&&i.$camera.remove(),c.removeEventListener(t.CanvasEvent.RESIZE,v),c.removeEventListener(t.ElementEvent.MOUNTED,u),c.removeEventListener(t.ElementEvent.UNMOUNTED,d),c.removeEventListener(t.ElementEvent.ATTR_MODIFIED,p),c.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,f)}))},e.prototype.createCamera=function(e){var t=this.context.config,n=t.document,r=t.width,i=t.height,a=this.context.contextService.getDomElement(),o=a.parentNode;if(o){var s="g-canvas-camera",c=o.querySelector("#"+s);if(!c){var l=(n||document).createElement("div");c=l,l.id=s,l.style.position="absolute",l.style.left="".concat(a.offsetLeft||0,"px"),l.style.top="".concat(a.offsetTop||0,"px"),l.style.transformOrigin="left top",l.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),l.style.overflow="hidden",l.style.pointerEvents="none",l.style.width="".concat(r||0,"px"),l.style.height="".concat(i||0,"px"),o.appendChild(l)}return c}return null},e.prototype.getOrCreateEl=function(e){var t=this.context.config.document,n=this.displayObjectHTMLElementMap.get(e);return n||(n=(t||document).createElement("div"),e.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(e,n),e.id&&(n.id=e.id),e.name&&n.setAttribute("name",e.name),e.className&&(n.className=e.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(e.getWorldTransform())),n},e.prototype.updateAttribute=function(e,n){var r=this.getOrCreateEl(n);switch(e){case"innerHTML":var i=n.parsedStyle.innerHTML;M(i)?r.innerHTML=i:(r.innerHTML="",r.appendChild(i));break;case"x":r.style.left="".concat(n.parsedStyle.x,"px");break;case"y":r.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var a=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(a[0].value," ").concat(a[1].value);break;case"width":if(this.context.enableCSSParsing){var o=n.computedStyleMap().get("width");r.style.width=""+o}else{r.style.width=S(o=n.parsedStyle.width)?"".concat(o,"px"):""+o}break;case"height":if(this.context.enableCSSParsing){var s=n.computedStyleMap().get("height");r.style.height=""+s}else{r.style.height=S(s=n.parsedStyle.height)?"".concat(s,"px"):""+s}break;case"zIndex":r.style["z-index"]="".concat(n.parsedStyle.zIndex);break;case"visibility":r.style.visibility=n.parsedStyle.visibility;break;case"pointerEvents":r.style.pointerEvents=n.parsedStyle.pointerEvents;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity);break;case"fill":var c=n.parsedStyle.fill,l="";t.isCSSRGB(c)?l=c.isNone?"transparent":n.getAttribute("fill"):Array.isArray(c)?l=n.getAttribute("fill"):t.isPattern(c),r.style.background=l;break;case"stroke":var h=n.parsedStyle.stroke,u="";t.isCSSRGB(h)?u=h.isNone?"transparent":n.getAttribute("stroke"):Array.isArray(h)?u=n.getAttribute("stroke"):t.isPattern(h),r.style["border-color"]=u,r.style["border-style"]="solid";break;case"lineWidth":r.style["border-width"]="".concat(n.parsedStyle.lineWidth||0,"px");break;case"lineDash":r.style["border-style"]="dashed";break;case"filter":r.style.filter=n.style.filter;break;default:m(n.style[e])||""===n.style[e]||(r.style[e]=n.style[e])}},e.tag="HTMLRendering",e}(),Oe=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="html-renderer",t}return r(t,e),t.prototype.init=function(){this.addRenderingPlugin(new ke)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Le=Object.freeze({__proto__:null,Plugin:Oe}),Re=function(){function e(e){this.canvasConfig=e,this.imageCache={},this.gradientCache={},this.patternCache={}}return e.prototype.getImageSync=function(e,t){return this.imageCache[e]?t&&t(this.imageCache[e]):this.getOrCreateImage(e).then((function(e){t&&t(e)})),this.imageCache[e]},e.prototype.getOrCreateImage=function(e){var n=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var r=this.canvasConfig.createImage;return new Promise((function(i,a){var o;r?o=r(e):t.isBrowser&&(o=new window.Image),o&&(o.onload=function(){n.imageCache[e]=o,i(o)},o.onerror=function(e){a(e)},o.crossOrigin="Anonymous",o.src=e)}))},e.prototype.getOrCreatePatternSync=function(e,n,r,i,a,o){var s=this.generatePatternKey(e);if(s&&this.patternCache[s])return this.patternCache[s];var c,l=e.image,u=e.repetition,d=e.transform,p=!1;M(l)?c=this.getImageSync(l,o):r?(c=r,p=!0):c=l;var f,v=c&&n.createPattern(c,u);if(v){var y=void 0;d?y=t.parsedTransformToMat4(t.parseTransform(d),new t.DisplayObject({})):((f=h())[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,y=f),p&&function(e,t,n){var r=n[0],i=n[1],a=n[2];e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(y,y,[1/i,1/i,1]),v.setTransform({a:y[0],b:y[1],c:y[4],d:y[5],e:y[12]+a[0],f:y[13]+a[1]})}return s&&v&&(this.patternCache[s]=v),v},e.prototype.getOrCreateGradient=function(e,n){var r=this.generateGradientKey(e),i=e.type,a=e.steps,o=e.min,s=e.width,c=e.height,l=e.cx,h=e.cy,u=e.size;if(this.gradientCache[r])return this.gradientCache[r];var d=null;if(i===t.GradientType.LinearGradient){var p=t.computeLinearGradient(o,s,c,e.angle);d=n.createLinearGradient(p.x1,p.y1,p.x2,p.y2)}else if(i===t.GradientType.RadialGradient){var f=t.computeRadialGradient(o,s,c,l,h,u),v=f.x,y=f.y;d=n.createRadialGradient(v,y,0,v,y,f.r)}return d&&(a.forEach((function(e){var n=e.offset;n.unit===t.UnitType.kPercentage&&(null==d||d.addColorStop(n.value/100,""+e.color))})),this.gradientCache[r]=d),this.gradientCache[r]},e.prototype.generateGradientKey=function(e){var t=e.min,n=e.width,r=e.height,i=e.steps,a=e.angle,o=e.cx,s=e.cy,c=e.size;return"gradient-".concat(e.type,"-").concat((null==a?void 0:""+a)||0,"-").concat((null==o?void 0:""+o)||0,"-").concat((null==s?void 0:""+s)||0,"-").concat((null==c?void 0:""+c)||0,"-").concat(t[0],"-").concat(t[1],"-").concat(n,"-").concat(r,"-").concat(i.map((function(e){var t=e.color;return"".concat(e.offset).concat(t)})).join("-"))},e.prototype.generatePatternKey=function(e){var t=e.image,n=e.repetition;return M(t)?"pattern-".concat(t,"-").concat(n):"rect"===t.nodeName?"pattern-".concat(t.entity,"-").concat(n):void 0},e}(),Ie=function(){function e(){}return e.prototype.apply=function(n){var r=n.renderingService,i=n.imagePool,a=n.renderingContext.root.ownerDocument.defaultView,o=function(e,t,n){var r=e.parsedStyle,i=r.width,a=r.height;i&&!a?e.setAttribute("height",n/t*i):!i&&a&&e.setAttribute("width",t/n*a)},s=function(e){var n=e.target,a=n.attributes;if(n.nodeName===t.Shape.IMAGE){var s=a.img,c=a.keepAspectRatio;M(s)&&i.getImageSync(s,(function(e){c&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))}},c=function(e){var n=e.target,a=e.newValue;n.nodeName===t.Shape.IMAGE&&"img"===e.attrName&&M(a)&&i.getOrCreateImage(a).then((function(e){n.attributes.keepAspectRatio&&o(n,e.width,e.height),n.renderable.dirty=!0,r.dirtify()}))};r.hooks.init.tap(e.tag,(function(){a.addEventListener(t.ElementEvent.MOUNTED,s),a.addEventListener(t.ElementEvent.ATTR_MODIFIED,c)})),r.hooks.destroy.tap(e.tag,(function(){a.removeEventListener(t.ElementEvent.MOUNTED,s),a.removeEventListener(t.ElementEvent.ATTR_MODIFIED,c)}))},e.tag="LoadImage",e}(),Ne=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="image-loader",t}return r(t,e),t.prototype.init=function(){this.context.imagePool=new Re(this.context.config),this.addRenderingPlugin(new Ie)},t.prototype.destroy=function(){this.removeAllRenderingPlugins()},t}(t.AbstractRendererPlugin),Be=Object.freeze({__proto__:null,ImagePool:Re,Plugin:Ne}),De=function(){function e(e){this.renderingContext=e.renderingContext,this.canvasConfig=e.config}return e.prototype.init=function(){var e=this.canvasConfig,t=e.container,n=e.canvas;if(n)this.$canvas=n,t&&n.parentElement!==t&&t.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(t&&(this.$container=M(t)?document.getElementById(t):t,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},e.prototype.getContext=function(){return this.context},e.prototype.getDomElement=function(){return this.$canvas},e.prototype.getDPR=function(){return this.dpr},e.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},e.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},e.prototype.resize=function(e,n){var r=this.canvasConfig.devicePixelRatio||t.isBrowser&&window.devicePixelRatio||1;this.dpr=r=1>r?1:Math.ceil(r),this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,t.setDOMSize(this.$canvas,e,n)),this.renderingContext.renderReasons.add(t.RenderReason.CAMERA_CHANGED)},e.prototype.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},e.prototype.toDataURL=function(e){return void 0===e&&(e={}),a(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.context.canvas.toDataURL(e.type,e.encoderOptions)]}))}))},e}(),Fe=function(e){function t(){var t=e.apply(this,c([],s(arguments),!1))||this;return t.name="canvas-context-register",t}return r(t,e),t.prototype.init=function(){this.context.ContextService=De},t.prototype.destroy=function(){delete this.context.ContextService},t}(t.AbstractRendererPlugin),Ge=function(e){function t(t){var n=e.call(this,t)||this;return n.registerPlugin(new Fe),n.registerPlugin(new Ne),n.registerPlugin(new L),n.registerPlugin(new Pe),n.registerPlugin(new Ae),n.registerPlugin(new he),n.registerPlugin(new Oe),n}return r(t,e),t}(t.AbstractRenderer);e.CanvasPathGenerator=R,e.CanvasPicker=ue,e.CanvasRenderer=Ce,e.DomInteraction=we,e.HTMLRenderer=Le,e.ImageLoader=Be,e.Renderer=Ge}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "@antv/g-canvas",
"version": "1.11.27-next.10",
"version": "1.11.27-next.11",
"description": "A renderer implemented by Canvas 2D API",

@@ -40,9 +40,9 @@ "keywords": [

"tslib": "^2.5.3",
"@antv/g-plugin-canvas-renderer": "1.10.0-next.10",
"@antv/g-plugin-dom-interaction": "1.9.22-next.10",
"@antv/g-plugin-canvas-path-generator": "1.3.22-next.10",
"@antv/g-lite": "1.3.0-next.10",
"@antv/g-plugin-canvas-picker": "1.10.24-next.10",
"@antv/g-plugin-image-loader": "1.4.0-next.10",
"@antv/g-plugin-html-renderer": "1.9.25-next.10"
"@antv/g-lite": "1.3.0-next.11",
"@antv/g-plugin-canvas-path-generator": "1.3.22-next.11",
"@antv/g-plugin-canvas-picker": "1.10.24-next.11",
"@antv/g-plugin-image-loader": "1.4.0-next.11",
"@antv/g-plugin-canvas-renderer": "1.10.0-next.11",
"@antv/g-plugin-html-renderer": "1.9.25-next.11",
"@antv/g-plugin-dom-interaction": "1.9.22-next.11"
},

@@ -49,0 +49,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc