@antv/g-plugin-canvas-renderer
Advanced tools
Comparing version 1.6.4 to 1.7.0
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","@antv/g"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.CanvasRenderer={}),e.window.G)}(this,(function(e,t){"use strict";function r(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var i=Object.create((t&&t.prototype instanceof d?t:d).prototype),o=new C(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var h={};function d(){}function f(){}function p(){}var v={};s(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(P([])));g&&g!==t&&n.call(g,o)&&(v=g);var m=p.prototype=d.prototype=Object.create(v);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(i,o,a,c){var s=u(e[i],e,o);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,c)}))}c(s.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function R(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function P(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=p,s(m,"constructor",p),s(p,"constructor",f),f.displayName=s(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,c,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},w(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new x(l(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(m),s(m,c,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=P,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var c=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function n(e,t,r,n,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function c(e){n(a,i,o,c,s,"next",e)}function s(e){n(a,i,o,c,s,"throw",e)}c(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,c(e,t)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function s(e,t,r,n){var i,o=arguments.length,a=3>o?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(a=(3>o?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var u=t.Syringe.defineToken("PathGeneratorFactory"),h=t.Syringe.defineToken("PathGenerator");function d(e,t){var r=t.r;e.arc(r.value,r.value,r.value,0,2*Math.PI,!1)}function f(e,t){var r=t.rx.value,n=t.ry.value;if(e.ellipse)e.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var i=r>n?r:n,o=r>n?1:r/n,a=r>n?n/r:1;e.save(),e.scale(o,a),e.arc(0,0,i,0,2*Math.PI)}}function p(e,t){var r=t.x2,n=t.y2,i=t.defX,o=void 0===i?0:i,a=t.defY,c=void 0===a?0:a;e.moveTo(t.x1.value-o,t.y1.value-c),e.lineTo(r.value-o,n.value-c)}function v(e,t){var r=t.defX,n=void 0===r?0:r,i=t.defY,o=void 0===i?0:i,a=t.path,c=a.zCommandIndexes,s=[].concat(a.curve);c.forEach((function(e,t){s.splice(e+t,1,["Z"])}));for(var l=0;s.length>l;l++){var u=s[l];switch(u[0]){case"M":e.moveTo(u[1]-n,u[2]-o);break;case"C":e.bezierCurveTo(u[1]-n,u[2]-o,u[3]-n,u[4]-o,u[5]-n,u[6]-o);break;case"Z":e.closePath()}}}function y(e,t){var r=t.defX,n=void 0===r?0:r,i=t.defY,o=void 0===i?0:i,a=t.points.points,c=a.length,s=a[c-1][0]-n,l=a[c-1][1]-o;e.moveTo(a[0][0]-n,a[0][1]-o);for(var u=0;c-1>u;u++){var h=a[u];e.lineTo(h[0]-n,h[1]-o)}e.lineTo(s,l)}function g(e,t){var r=t.defX,n=void 0===r?0:r,i=t.defY,o=void 0===i?0:i,a=t.points.points,c=a.length,s=a[c-1][0]-n,l=a[c-1][1]-o;e.moveTo(a[0][0]-n,a[0][1]-o);for(var u=0;c-1>u;u++){var h=a[u];e.lineTo(h[0]-n,h[1]-o)}e.lineTo(s,l)}function m(e,r){var n=r.radius,i=r.width,o=r.height,a=i.value,c=o.value;if(n&&n.some((function(e){return 0!==e.value}))){var s=i.value>0?1:-1,l=o.value>0?1:-1,u=s+l===0,h=n.map((function(e){return t.clamp(e.value,0,Math.min(Math.abs(a)/2,Math.abs(c)/2))})),d=h[0],f=h[1],p=h[2],v=h[3];e.moveTo(s*d,0),e.lineTo(a-s*f,0),0!==f&&e.arc(a-s*f,l*f,f,-l*Math.PI/2,s>0?0:Math.PI,u),e.lineTo(a,c-l*p),0!==p&&e.arc(a-s*p,c-l*p,p,s>0?0:Math.PI,l>0?Math.PI/2:1.5*Math.PI,u),e.lineTo(s*v,c),0!==v&&e.arc(s*v,c-l*v,v,l>0?Math.PI/2:-Math.PI/2,s>0?Math.PI:0,u),e.lineTo(0,l*d),0!==d&&e.arc(s*d,l*d,d,s>0?Math.PI:0,l>0?1.5*Math.PI:Math.PI/2,u)}else e.rect(0,0,a,c)}t.Module((function(e){e({token:{token:h,named:t.Shape.CIRCLE},useValue:d}),e({token:{token:h,named:t.Shape.ELLIPSE},useValue:f}),e({token:{token:h,named:t.Shape.RECT},useValue:m}),e({token:{token:h,named:t.Shape.LINE},useValue:p}),e({token:{token:h,named:t.Shape.POLYLINE},useValue:g}),e({token:{token:h,named:t.Shape.POLYGON},useValue:y}),e({token:{token:h,named:t.Shape.PATH},useValue:v}),e({token:u,useFactory:function(e){return function(t){return e.container.isBoundNamed(h,t)?e.container.getNamed(h,t):null}}})}));var w="undefined"!=typeof Float32Array?Float32Array:Array;function x(){var e=new w(16);return w!=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 b(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 R(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],c=t[4],s=t[5],l=t[6],u=t[7],h=t[8],d=t[9],f=t[10],p=t[11],v=t[12],y=t[13],g=t[14],m=t[15],w=r[0],x=r[1],b=r[2],R=r[3];return e[0]=w*n+x*c+b*h+R*v,e[1]=w*i+x*s+b*d+R*y,e[2]=w*o+x*l+b*f+R*g,e[3]=w*a+x*u+b*p+R*m,e[4]=(w=r[4])*n+(x=r[5])*c+(b=r[6])*h+(R=r[7])*v,e[5]=w*i+x*s+b*d+R*y,e[6]=w*o+x*l+b*f+R*g,e[7]=w*a+x*u+b*p+R*m,e[8]=(w=r[8])*n+(x=r[9])*c+(b=r[10])*h+(R=r[11])*v,e[9]=w*i+x*s+b*d+R*y,e[10]=w*o+x*l+b*f+R*g,e[11]=w*a+x*u+b*p+R*m,e[12]=(w=r[12])*n+(x=r[13])*c+(b=r[14])*h+(R=r[15])*v,e[13]=w*i+x*s+b*d+R*y,e[14]=w*o+x*l+b*f+R*g,e[15]=w*a+x*u+b*p+R*m,e}function E(e,t,r){var n,i,o,a,c,s,l,u,h,d,f,p,v=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*v+t[4]*y+t[8]*g+t[12],e[13]=t[1]*v+t[5]*y+t[9]*g+t[13],e[14]=t[2]*v+t[6]*y+t[10]*g+t[14],e[15]=t[3]*v+t[7]*y+t[11]*g+t[15]):(i=t[1],o=t[2],a=t[3],c=t[4],s=t[5],l=t[6],u=t[7],h=t[8],d=t[9],f=t[10],p=t[11],e[0]=n=t[0],e[1]=i,e[2]=o,e[3]=a,e[4]=c,e[5]=s,e[6]=l,e[7]=u,e[8]=h,e[9]=d,e[10]=f,e[11]=p,e[12]=n*v+c*y+h*g+t[12],e[13]=i*v+s*y+d*g+t[13],e[14]=o*v+l*y+f*g+t[14],e[15]=a*v+u*y+p*g+t[15]),e}function C(){var e=new w(3);return w!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function P(e,t,r){var n=new w(3);return n[0]=e,n[1]=t,n[2]=r,n}function S(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/(a=a||1),e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});L=C();var L,O=t.Syringe.defineToken("StyleRendererFactory"),T=t.Syringe.defineToken("CircleRenderer",{multiple:!1}),k=t.Syringe.defineToken("EllipseRenderer",{multiple:!1}),A=t.Syringe.defineToken("RectRenderer",{multiple:!1}),M=t.Syringe.defineToken("LineRenderer",{multiple:!1}),N=t.Syringe.defineToken("PolylineRenderer",{multiple:!1}),j=t.Syringe.defineToken("PolygonRenderer",{multiple:!1}),B=t.Syringe.defineToken("PathRenderer",{multiple:!1}),I=t.Syringe.defineToken("TextRenderer",{multiple:!1}),G=t.Syringe.defineToken("ImageRenderer",{multiple:!1});function F(){ | ||
r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=Object.create((t&&t.prototype instanceof d?t:d).prototype),o=new S(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return P()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var l=b(a,r);if(l){if(l===h)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,o),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var h={};function d(){}function f(){}function p(){}var v={};c(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(C([])));g&&g!==t&&n.call(g,o)&&(v=g);var m=p.prototype=d.prototype=Object.create(v);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(i,o,a,l){var c=u(e[i],e,o);if("throw"!==c.type){var s=c.arg,h=s.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,a,l)}),(function(e){r("throw",e,a,l)})):t.resolve(h).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,l)}))}l(c.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:P}}function P(){return{value:void 0,done:!0}}return f.prototype=p,c(m,"constructor",p),c(p,"constructor",f),f.displayName=c(p,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,l,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},w(x.prototype),c(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new x(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(m),c(m,l,"Generator"),c(m,o,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(R),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var l=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(l&&c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(l){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function n(e,t,r,n,i,o,a){try{var l=e[o](a),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function l(e){n(a,i,o,l,c,"next",e)}function c(e){n(a,i,o,l,c,"throw",e)}l(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,l(e,t)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function c(e,t,r,n){var i,o=arguments.length,a=3>o?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(a=(3>o?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var u=t.Syringe.defineToken("PathGeneratorFactory"),h=t.Syringe.defineToken("PathGenerator");function d(e,t){var r=t.r;e.arc(r.value,r.value,r.value,0,2*Math.PI,!1)}function f(e,t){var r=t.rx.value,n=t.ry.value;if(e.ellipse)e.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var i=r>n?r:n,o=r>n?1:r/n,a=r>n?n/r:1;e.save(),e.scale(o,a),e.arc(0,0,i,0,2*Math.PI)}}function p(e,r){var n,i,o=r.x1,a=r.y1,l=r.x2,c=r.y2,s=r.defX,u=void 0===s?0:s,h=r.defY,d=void 0===h?0:h,f=r.markerStart,p=r.markerEnd,v=r.markerStartOffset,y=r.markerEndOffset,g=0,m=0,w=0,x=0,b=0;f&&f instanceof t.DisplayObject&&v&&(n=l.value-o.value,i=c.value-a.value,b=Math.atan2(i,n),g=Math.cos(b)*((null==v?void 0:v.value)||0),m=Math.sin(b)*((null==v?void 0:v.value)||0)),p&&p instanceof t.DisplayObject&&y&&(n=o.value-l.value,i=a.value-c.value,b=Math.atan2(i,n),w=Math.cos(b)*((null==y?void 0:y.value)||0),x=Math.sin(b)*((null==y?void 0:y.value)||0)),e.moveTo(o.value-u+g,a.value-d+m),e.lineTo(l.value-u+w,c.value-d+x)}function v(e,r){var n=r.defX,i=void 0===n?0:n,o=r.defY,a=void 0===o?0:o,l=r.markerStart,c=r.markerEnd,s=r.markerStartOffset,u=r.markerEndOffset,h=r.path,d=h.zCommandIndexes,f=[].concat(h.curve);d.forEach((function(e,t){f.splice(e+t,1,["Z"])}));var p,v,y="Z"===f[f.length-1][0],g=0,m=0,w=0,x=0,b=0;if(l&&l instanceof t.DisplayObject&&s){var E=l.parentNode.getStartTangent(),R=E[0],S=E[1];p=R[0]-S[0],v=R[1]-S[1],b=Math.atan2(v,p),g=Math.cos(b)*((null==s?void 0:s.value)||0),m=Math.sin(b)*((null==s?void 0:s.value)||0)}if(c&&c instanceof t.DisplayObject&&u){var C=c.parentNode.getEndTangent(),P=C[0],O=C[1];p=P[0]-O[0],v=P[1]-O[1],b=Math.atan2(v,p),w=Math.cos(b)*((null==u?void 0:u.value)||0),x=Math.sin(b)*((null==u?void 0:u.value)||0)}for(var k=0;f.length>k;k++){var M=f[k];switch(M[0]){case"M":e.moveTo(M[1]-i+g,M[2]-a+m);break;case"C":e.bezierCurveTo(M[1]-i,M[2]-a,M[3]-i,M[4]-a,M[5]-i+(k===f.length-(y?2:1)?w:0),M[6]-a+(k===f.length-(y?2:1)?x:0));break;case"Z":e.closePath()}}}function y(e,r){var n,i,o=r.defX,a=void 0===o?0:o,l=r.defY,c=void 0===l?0:l,s=r.markerStart,u=r.markerEnd,h=r.markerStartOffset,d=r.markerEndOffset,f=r.points.points,p=f.length,v=f[0][0]-a,y=f[0][1]-c,g=f[p-1][0]-a,m=f[p-1][1]-c,w=0,x=0,b=0,E=0,R=0;s&&s instanceof t.DisplayObject&&h&&(n=f[1][0]-f[0][0],i=f[1][1]-f[0][1],R=Math.atan2(i,n),w=Math.cos(R)*((null==h?void 0:h.value)||0),x=Math.sin(R)*((null==h?void 0:h.value)||0)),u&&u instanceof t.DisplayObject&&d&&(n=f[p-1][0]-f[0][0],i=f[p-1][1]-f[0][1],R=Math.atan2(i,n),b=Math.cos(R)*((null==d?void 0:d.value)||0),E=Math.sin(R)*((null==d?void 0:d.value)||0)),e.moveTo(v+(w||b),y+(x||E));for(var S=1;p-1>S;S++){var C=f[S];e.lineTo(C[0]-a,C[1]-c)}e.lineTo(g,m)}function g(e,r){var n,i,o=r.defX,a=void 0===o?0:o,l=r.defY,c=void 0===l?0:l,s=r.markerStart,u=r.markerEnd,h=r.markerStartOffset,d=r.markerEndOffset,f=r.points.points,p=f.length,v=f[0][0]-a,y=f[0][1]-c,g=f[p-1][0]-a,m=f[p-1][1]-c,w=0,x=0,b=0,E=0,R=0;s&&s instanceof t.DisplayObject&&h&&(n=f[1][0]-f[0][0],i=f[1][1]-f[0][1],R=Math.atan2(i,n),w=Math.cos(R)*((null==h?void 0:h.value)||0),x=Math.sin(R)*((null==h?void 0:h.value)||0)),u&&u instanceof t.DisplayObject&&d&&(n=f[p-2][0]-f[p-1][0],i=f[p-2][1]-f[p-1][1],R=Math.atan2(i,n),b=Math.cos(R)*((null==d?void 0:d.value)||0),E=Math.sin(R)*((null==d?void 0:d.value)||0)),e.moveTo(v+w,y+x);for(var S=1;p-1>S;S++){var C=f[S];e.lineTo(C[0]-a,C[1]-c)}e.lineTo(g+b,m+E)}function m(e,r){var n=r.radius,i=r.width,o=r.height,a=i.value,l=o.value;if(n&&n.some((function(e){return 0!==e.value}))){var c=i.value>0?1:-1,s=o.value>0?1:-1,u=c+s===0,h=n.map((function(e){return t.clamp(e.value,0,Math.min(Math.abs(a)/2,Math.abs(l)/2))})),d=h[0],f=h[1],p=h[2],v=h[3];e.moveTo(c*d,0),e.lineTo(a-c*f,0),0!==f&&e.arc(a-c*f,s*f,f,-s*Math.PI/2,c>0?0:Math.PI,u),e.lineTo(a,l-s*p),0!==p&&e.arc(a-c*p,l-s*p,p,c>0?0:Math.PI,s>0?Math.PI/2:1.5*Math.PI,u),e.lineTo(c*v,l),0!==v&&e.arc(c*v,l-s*v,v,s>0?Math.PI/2:-Math.PI/2,c>0?Math.PI:0,u),e.lineTo(0,s*d),0!==d&&e.arc(c*d,s*d,d,c>0?Math.PI:0,s>0?1.5*Math.PI:Math.PI/2,u)}else e.rect(0,0,a,l)}t.Module((function(e){e({token:{token:h,named:t.Shape.CIRCLE},useValue:d}),e({token:{token:h,named:t.Shape.ELLIPSE},useValue:f}),e({token:{token:h,named:t.Shape.RECT},useValue:m}),e({token:{token:h,named:t.Shape.LINE},useValue:p}),e({token:{token:h,named:t.Shape.POLYLINE},useValue:g}),e({token:{token:h,named:t.Shape.POLYGON},useValue:y}),e({token:{token:h,named:t.Shape.PATH},useValue:v}),e({token:u,useFactory:function(e){return function(t){return e.container.isBoundNamed(h,t)?e.container.getNamed(h,t):null}}})}));var w="undefined"!=typeof Float32Array?Float32Array:Array;function x(){var e=new w(16);return w!=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 b(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 E(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],l=t[4],c=t[5],s=t[6],u=t[7],h=t[8],d=t[9],f=t[10],p=t[11],v=t[12],y=t[13],g=t[14],m=t[15],w=r[0],x=r[1],b=r[2],E=r[3];return e[0]=w*n+x*l+b*h+E*v,e[1]=w*i+x*c+b*d+E*y,e[2]=w*o+x*s+b*f+E*g,e[3]=w*a+x*u+b*p+E*m,e[4]=(w=r[4])*n+(x=r[5])*l+(b=r[6])*h+(E=r[7])*v,e[5]=w*i+x*c+b*d+E*y,e[6]=w*o+x*s+b*f+E*g,e[7]=w*a+x*u+b*p+E*m,e[8]=(w=r[8])*n+(x=r[9])*l+(b=r[10])*h+(E=r[11])*v,e[9]=w*i+x*c+b*d+E*y,e[10]=w*o+x*s+b*f+E*g,e[11]=w*a+x*u+b*p+E*m,e[12]=(w=r[12])*n+(x=r[13])*l+(b=r[14])*h+(E=r[15])*v,e[13]=w*i+x*c+b*d+E*y,e[14]=w*o+x*s+b*f+E*g,e[15]=w*a+x*u+b*p+E*m,e}function R(e,t,r){var n,i,o,a,l,c,s,u,h,d,f,p,v=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*v+t[4]*y+t[8]*g+t[12],e[13]=t[1]*v+t[5]*y+t[9]*g+t[13],e[14]=t[2]*v+t[6]*y+t[10]*g+t[14],e[15]=t[3]*v+t[7]*y+t[11]*g+t[15]):(i=t[1],o=t[2],a=t[3],l=t[4],c=t[5],s=t[6],u=t[7],h=t[8],d=t[9],f=t[10],p=t[11],e[0]=n=t[0],e[1]=i,e[2]=o,e[3]=a,e[4]=l,e[5]=c,e[6]=s,e[7]=u,e[8]=h,e[9]=d,e[10]=f,e[11]=p,e[12]=n*v+l*y+h*g+t[12],e[13]=i*v+c*y+d*g+t[13],e[14]=o*v+s*y+f*g+t[14],e[15]=a*v+u*y+p*g+t[15]),e}function S(){var e=new w(3);return w!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function C(e,t,r){var n=new w(3);return n[0]=e,n[1]=t,n[2]=r,n}function P(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/(a=a||1),e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});O=S();var O,k=t.Syringe.defineToken("StyleRendererFactory"),M=t.Syringe.defineToken("CircleRenderer",{multiple:!1}),L=t.Syringe.defineToken("EllipseRenderer",{multiple:!1}),T=t.Syringe.defineToken("RectRenderer",{multiple:!1}),A=t.Syringe.defineToken("LineRenderer",{multiple:!1}),N=t.Syringe.defineToken("PolylineRenderer",{multiple:!1}),j=t.Syringe.defineToken("PolygonRenderer",{multiple:!1}),B=t.Syringe.defineToken("PathRenderer",{multiple:!1}),I=t.Syringe.defineToken("TextRenderer",{multiple:!1}),G=t.Syringe.defineToken("ImageRenderer",{multiple:!1});function F(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
F=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=Object.create((t&&t.prototype instanceof h?t:h).prototype),o=new E(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return P()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function h(){}function d(){}function f(){}var p={};c(p,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(C([])));y&&y!==t&&r.call(y,i)&&(p=y);var g=f.prototype=h.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function n(i,o,a,c){var s=l(e[i],e,o);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function x(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function C(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return d.prototype=f,c(g,"constructor",f),c(f,"constructor",d),d.displayName=c(f,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(w.prototype),c(w.prototype,o,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new w(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(R),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var c=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _(e,t,r,n,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,i)}function D(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){_(o,n,i,a,c,"next",e)}function c(e){_(o,n,i,a,c,"throw",e)}a(void 0)}))}}var V,Y,X=function(){function e(){this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=void 0}var r=e.prototype;return r.getImageSync=function(e,t){return this.imageCache[e]||this.getOrCreateImage(e).then((function(){t&&t()})),this.imageCache[e]},r.getOrCreateImage=function(e){var r=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var n=this.canvasConfig.createImage;return new Promise((function(i,o){var a;n?a=n(e):t.isBrowser&&(a=new window.Image),a&&(a.onload=function(){i(a)},a.onerror=function(e){o(e)},a.crossOrigin="Anonymous",a.src=e,r.imageCache[e]=a)}))},r.getOrCreatePatternSync=function(e,r,n){var i=this.generatePatternKey(e);if(i&&this.patternCache[i])return this.patternCache[i];var o,a=e.image,c=e.repetition,s=(o=t.isString(a)?this.getImageSync(a,n):a)&&r.createPattern(o,c);return i&&s&&(this.patternCache[i]=s),s},r.getOrCreateGradient=function(e,r){var n=this.generateGradientKey(e),i=e.type,o=e.steps,a=e.width,c=e.height,s=e.cx,l=e.cy;if(this.gradientCache[n])return this.gradientCache[n];var u=null;if(i===t.GradientType.LinearGradient){var h=t.computeLinearGradient(a,c,e.angle);u=r.createLinearGradient(h.x1,h.y1,h.x2,h.y2)}else if(i===t.GradientType.RadialGradient){var d=t.computeRadialGradient(a,c,s,l),f=d.x,p=d.y;u=r.createRadialGradient(f,p,0,f,p,d.r)}return u&&(o.forEach((function(e){var t;null===(t=u)||void 0===t||t.addColorStop(e[0],e[1])})),this.gradientCache[n]=u),this.gradientCache[n]},r.generateGradientKey=function(e){return"gradient-"+e.type+"-"+(e.angle||0)+"-"+(e.cx||0)+"-"+(e.cy||0)+"-"+e.width+"-"+e.height+"-"+e.steps.map((function(e){return e.join("")})).join("-")},r.generatePatternKey=function(e){var r=e.image,n=e.repetition;if(t.isString(r))return"pattern-"+r+"-"+n},e}();s([t.inject(t.CanvasConfig),l("design:type",Object)],X.prototype,"canvasConfig",void 0),X=s([t.singleton()],X);var U=(V=function(){function e(){this.imagePool=void 0,this.renderingContext=void 0}return e.prototype.apply=function(e){var r=this,n=function(n){var i=n.target;if(i.nodeName===t.Shape.IMAGE){var o=i.attributes.img;t.isString(o)&&r.imagePool.getImageSync(o,(function(){i.renderable.dirty=!0,e.dirtify()}))}},i=function(n){var i=n.target,o=n.newValue;i.nodeName===t.Shape.IMAGE&&"img"===n.attrName&&t.isString(o)&&r.imagePool.getOrCreateImage(o).then((function(){i.renderable.dirty=!0,e.dirtify()}))};e.hooks.init.tapPromise(Y.tag,D(F().mark((function e(){return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,i);case 2:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(Y.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,i)}))},e}(),V.tag="LoadImage",Y=V);s([t.inject(X),l("design:type",X)],U.prototype,"imagePool",void 0),s([t.inject(t.RenderingContext),l("design:type",Object)],U.prototype,"renderingContext",void 0),U=Y=s([t.singleton({contrib:t.RenderingPluginContribution})],U);t.Module((function(e){e(X),e(U)}));e.ImageRenderer=function(){function e(){this.imagePool=void 0}return e.prototype.render=function(e,r){var n,i=r.img,o=r.width.value,a=r.height.value;if(t.isString(i)?n=this.imagePool.getImageSync(i):(o||(o=i.width),a||(a=i.height),n=i),n)try{e.drawImage(n,0,0,o,a)}catch(e){}},e}(),s([t.inject(X),l("design:type",X)],e.ImageRenderer.prototype,"imagePool",void 0),e.ImageRenderer=s([t.singleton({token:G})],e.ImageRenderer),e.TextRenderer=function(){function e(){}var r=e.prototype;return r.render=function(e,r,n){var i=r.lineWidth,o=r.textAlign,a=r.textBaseline,c=r.lineJoin,s=r.miterLimit,l=r.letterSpacing,u=r.stroke,h=r.fill,d=r.fillOpacity,f=r.strokeOpacity,p=r.opacity,v=r.metrics,y=r.dx,g=r.dy,m=v.lines,w=v.height,x=v.lineHeight,b=v.lineMetrics;e.font=v.font,e.lineWidth=i.value,e.textAlign=o.value,e.textBaseline=a.value,e.lineJoin=c.value,t.isNil(s)||(e.miterLimit=s.value);var R=0;"middle"===a.value?R=-w/2-x/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?R=-w:"top"!==a.value&&"hanging"!==a.value||(R=-x);var E=0;y&&y.unit===t.UnitType.kPixels&&(E+=y.value),g&&g.unit===t.UnitType.kPixels&&(R+=g.value);for(var C=0;m.length>C;C++){var P=i.value/2+E;R+=x,!t.isNil(u)&&!u.isNone&&i&&i.value&&this.drawLetterSpacing(e,m[C],b[C],o.value,P,R,l.value,d.value,f.value,p.value,!0),t.isNil(h)||this.drawLetterSpacing(e,m[C],b[C],o.value,P,R,l.value,d.value,f.value,p.value)}},r.drawLetterSpacing=function(e,t,r,n,i,o,a,c,s,l,u){if(void 0===u&&(u=!1),0!==a){var h=e.textAlign;e.textAlign="left";var d=i;"center"===n?d=i-r.width/2:"right"!==n&&"end"!==n||(d=i-r.width);for(var f=Array.from(t),p=e.measureText(t).width,v=0,y=0;f.length>y;++y){var g=f[y];u?this.strokeText(e,g,d,o,s):this.fillText(e,g,d,o,c,l),d+=p-(v=e.measureText(t.substring(y+1)).width)+a,p=v}e.textAlign=h}else u?this.strokeText(e,t,i,o,s):this.fillText(e,t,i,o,c,l)},r.fillText=function(e,r,n,i,o,a){var c,s=!t.isNil(o)&&1!==o;s&&(c=e.globalAlpha,e.globalAlpha=o*a),e.fillText(r,n,i),s&&(e.globalAlpha=c)},r.strokeText=function(e,r,n,i,o){var a,c=!t.isNil(o)&&1!==o;c&&(a=e.globalAlpha,e.globalAlpha=o),e.strokeText(r,n,i),c&&(e.globalAlpha=a)},e}(),e.TextRenderer=s([t.singleton({token:I})],e.TextRenderer);var W=function(){function e(){this.imagePool=void 0}var r=e.prototype;return r.render=function(e,r,n,i){var o=r.fill,a=r.opacity,c=r.fillOpacity,s=r.stroke,l=r.strokeOpacity,u=r.lineWidth,h=r.lineCap,d=r.lineJoin,f=r.shadowType,p=r.shadowColor,v=r.shadowBlur,y=r.filter,g=r.miterLimit,m=!t.isNil(o)&&!o.isNone,w=!t.isNil(s)&&!s.isNone&&u&&u.value>0,x=0===o.alpha,b=!t.isNil(y),R=!t.isNil(p)&&(null==v?void 0:v.value)>0,E=n.nodeName,C="inner"===(null==f?void 0:f.value),P=w&&R&&(E===t.Shape.PATH||E===t.Shape.LINE||E===t.Shape.POLYLINE||x||C);m&&(e.globalAlpha=a.value*c.value,P||this.setShadowAndFilter(n,e,R),this.fill(e,n,o,i),P||this.clearShadowAndFilter(e,b,R)),w&&(e.globalAlpha=a.value*l.value,e.lineWidth=u.value,t.isNil(g)||(e.miterLimit=g.value),t.isNil(h)||(e.lineCap=h.value),t.isNil(d)||(e.lineJoin=d.value),P&&(C&&(e.globalCompositeOperation="source-atop"),this.setShadowAndFilter(n,e,!0),C&&(this.stroke(e,n,s,i),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,b,!0))),this.stroke(e,n,s,i))},r.clearShadowAndFilter=function(e,r,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),r){var i=e.filter;!t.isNil(i)&&i.indexOf("drop-shadow")>-1&&(e.filter=i.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},r.setShadowAndFilter=function(e,r,n){var i=e.parsedStyle,o=i.shadowColor,a=i.shadowBlur,c=i.shadowOffsetX,s=i.shadowOffsetY;t.isNil(i.filter)||(r.filter=e.style.filter),n&&(r.shadowColor=o.toString(),r.shadowBlur=a&&a.value||0,r.shadowOffsetX=c&&c.value||0,r.shadowOffsetY=s&&s.value||0)},r.fill=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.fillStyle=o.getColor(t,r,e),e.fill()})):(t.isPattern(n)&&(e.fillStyle=this.getPattern(n,r,e,i)),e.fill())},r.stroke=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.strokeStyle=o.getColor(t,r,e),e.stroke()})):(t.isPattern(n)&&(e.strokeStyle=this.getPattern(n,r,e,i)),e.stroke())},r.getPattern=function(e,t,r,n){return this.imagePool.getOrCreatePatternSync(e,r,(function(){t.renderable.dirty=!0,n.dirtify()}))},r.getColor=function(e,r,n){var i;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var a=r.getGeometryBounds();i=this.imagePool.getOrCreateGradient(o({type:e.type},e.value,{width:a&&2*a.halfExtents[0]||1,height:a&&2*a.halfExtents[1]||1}),n)}return i},e}();s([t.inject(X),l("design:type",X)],W.prototype,"imagePool",void 0),W=s([t.singleton()],W),e.RectRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.RectRenderer=s([t.singleton({token:A})],e.RectRenderer),e.CircleRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.CircleRenderer=s([t.singleton({token:T})],e.CircleRenderer),e.EllipseRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.EllipseRenderer=s([t.singleton({token:k})],e.EllipseRenderer),e.LineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.LineRenderer=s([t.singleton({token:M})],e.LineRenderer),e.PolylineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PolylineRenderer=s([t.singleton({token:N})],e.PolylineRenderer),e.PolygonRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PolygonRenderer=s([t.singleton({token:j})],e.PolygonRenderer),e.PathRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PathRenderer=s([t.singleton({token:B})],e.PathRenderer);var Q,H,J=t.Syringe.defineToken("CanvasRendererPluginOptions"),K=(Q=function(){function e(){this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.styleRendererFactory=void 0,this.styleRendererFactoryCache={},this.displayObjectPool=void 0,this.canvasRendererPluginOptions=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=x(),this.dprMatrix=x(),this.tmpMat4=x(),this.tmpVec3=C()}var n=e.prototype;return n.apply=function(e){var n=this,o=this.renderingContext.root.ownerDocument.defaultView,a=function(e){var t=e.target.rBushNode;t.aabb&&n.removedRBushNodeAABBs.push(t.aabb)},c=function(e){var t=e.target.rBushNode;t.aabb&&n.removedRBushNodeAABBs.push(t.aabb)};e.hooks.init.tapPromise(H.tag,i(r().mark((function e(){var i,o,s,l,u;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,a),n.renderingContext.root.addEventListener(t.ElementEvent.CULLED,c),i=n.contextService.getDPR(),s=(o=n.canvasConfig).width,l=o.height,u=n.contextService.getContext(),n.clearRect(u,0,0,s*i,l*i),r=n.dprMatrix,h=P(i,i,1),r[0]=h[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=h[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1;case 7:case"end":return e.stop()}var r,h}),e)})))),e.hooks.destroy.tap(H.tag,(function(){n.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,a),n.renderingContext.root.removeEventListener(t.ElementEvent.CULLED,c)})),e.hooks.beginFrame.tap(H.tag,(function(){var t=n.contextService.getContext(),r=n.contextService.getDPR(),i=n.canvasConfig,o=i.width,a=i.height,c=n.canvasRendererPluginOptions,s=c.dirtyObjectNumThreshold,l=c.dirtyObjectRatioThreshold,u=e.getStats(),h=u.rendered,d=h/u.total;n.clearFullScreen=e.disableDirtyRectangleRendering()||h>s&&d>l,t&&(t.resetTransform(),n.clearFullScreen&&n.clearRect(t,0,0,o*r,a*r))}));var s=function t(r){r.isVisible()&&!r.isCulled()&&(n.renderDisplayObject(r,e),n.saveDirtyAABB(r)),r.sortable.sorted&&r.sortable.sorted.length&&r.sortable.sorted.forEach((function(e){t(e)}))};e.hooks.endFrame.tap(H.tag,(function(){var r=n.contextService.getContext();if(R(n.vpMatrix,n.dprMatrix,n.camera.getOrthoMatrix()),n.clearFullScreen)s(n.renderingContext.root);else{var i=n.safeMergeAABB.apply(n,[n.mergeDirtyAABBs(n.renderQueue)].concat(n.removedRBushNodeAABBs.map((function(e){var r=e.minX,n=e.minY,i=e.maxX,o=e.maxY,a=new t.AABB;return a.setMinMax(P(r,n,0),P(i,o,0)),a}))));if(n.removedRBushNodeAABBs=[],t.AABB.isEmpty(i))return void(n.renderQueue=[]);var a=n.convertAABB2Rect(i),c=a.x,l=a.y,u=a.width,h=a.height,d=S(n.tmpVec3,P(c,l,0),n.vpMatrix),f=S(C(),P(c+u,l+h,0),n.vpMatrix),p=Math.floor(d[0]),v=Math.floor(d[1]),y=Math.ceil(f[0]-d[0]),g=Math.ceil(f[1]-d[1]);r.save(),n.clearRect(r,p,v,y,g),r.beginPath(),r.rect(p,v,y,g),r.clip(),r.setTransform(n.vpMatrix[0],n.vpMatrix[1],n.vpMatrix[4],n.vpMatrix[5],n.vpMatrix[12],n.vpMatrix[13]),n.canvasConfig.renderer.getConfig().enableDirtyRectangleRenderingDebug&&o.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:a})),n.searchDirtyObjects(i).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&n.renderDisplayObject(t,e)})),r.restore(),n.renderQueue.forEach((function(e){n.saveDirtyAABB(e)})),n.renderQueue=[]}n.restoreStack.forEach((function(){r.restore()})),n.restoreStack=[]})),e.hooks.render.tap(H.tag,(function(e){n.clearFullScreen||n.renderQueue.push(e)}))},n.clearRect=function(e,t,r,n,i){e.clearRect(t,r,n,i);var o=this.canvasConfig.background;o&&(e.fillStyle=o,e.fillRect(t,r,n,i))},n.renderDisplayObject=function(e,r){for(var n=this.contextService.getContext(),i=this.restoreStack[this.restoreStack.length-1];i&&e.parentNode!==i;)n.restore(),this.restoreStack.pop(),i=this.restoreStack[this.restoreStack.length-1];var o=e.nodeName;void 0===this.styleRendererFactoryCache[o]&&(this.styleRendererFactoryCache[o]=this.styleRendererFactory(o));var a=this.styleRendererFactoryCache[o];void 0===this.pathGeneratorFactoryCache[o]&&(this.pathGeneratorFactoryCache[o]=this.pathGeneratorFactory(o));var c=this.pathGeneratorFactoryCache[o],s=e.parsedStyle.clipPath;if(s){this.applyWorldTransform(n,s,e.getWorldTransform()),void 0===this.pathGeneratorFactoryCache[s.nodeName]&&(this.pathGeneratorFactoryCache[s.nodeName]=this.pathGeneratorFactory(s.nodeName));var l=this.pathGeneratorFactoryCache[s.nodeName];l&&(n.save(),this.restoreStack.push(e),n.beginPath(),l(n,s.parsedStyle),n.closePath(),n.clip())}a&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),a&&(a.render(n,e.parsedStyle,e,r),n.restore()),e.renderable.dirty=!1},n.convertAABB2Rect=function(e){var t=e.getMin(),r=e.getMax(),n=Math.floor(t[0]),i=Math.floor(t[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}},n.mergeDirtyAABBs=function(e){var r=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();r.add(t);var n=e.renderable.dirtyRenderBounds;n&&r.add(n)})),r},n.searchDirtyObjects=function(e){var t=this,r=e.getMin(),n=r[0],i=r[1],o=e.getMax();return this.rBush.search({minX:n,minY:i,maxX:o[0],maxY:o[1]}).map((function(e){return t.displayObjectPool.getByEntity(e.id)}))},n.saveDirtyAABB=function(e){var r=e.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new t.AABB);var n=e.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},n.applyAttributesToContext=function(e,r){var n=r.parsedStyle,i=n.stroke,o=n.fill,a=n.opacity,c=n.lineDash,s=n.lineDashOffset;c&&Array.isArray(c)&&e.setLineDash(c.map((function(e){return e.value}))),t.isNil(s)||(e.lineDashOffset=s.value),t.isNil(a)||(e.globalAlpha*=a.value),t.isNil(i)||Array.isArray(i)||i.isNone||(e.strokeStyle=r.attributes.stroke),t.isNil(o)||Array.isArray(o)||o.isNone||(e.fillStyle=r.attributes.fill)},n.applyWorldTransform=function(e,t,r){var n=0,i=0,o=(t.parsedStyle||{}).anchor,a=o&&o[0].value||0,c=o&&o[1].value||0;if(0!==a||0!==c){var s=t.getGeometryBounds();n=-a*(s&&2*s.halfExtents[0]||0),i=-c*(s&&2*s.halfExtents[1]||0)}r?(b(this.tmpMat4,t.getLocalTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,E(this.tmpMat4,this.tmpMat4,this.tmpVec3),R(this.tmpMat4,r,this.tmpMat4),R(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(b(this.tmpMat4,t.getWorldTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,E(this.tmpMat4,this.tmpMat4,this.tmpVec3),R(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])},n.safeMergeAABB=function(){for(var e=new t.AABB,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return n.forEach((function(t){e.add(t)})),e},e}(),Q.tag="CanvasRenderer",H=Q);s([t.inject(t.CanvasConfig),l("design:type",Object)],K.prototype,"canvasConfig",void 0),s([t.inject(t.DefaultCamera),l("design:type",t.Camera)],K.prototype,"camera",void 0),s([t.inject(t.ContextService),l("design:type",Object)],K.prototype,"contextService",void 0),s([t.inject(t.RenderingContext),l("design:type",Object)],K.prototype,"renderingContext",void 0),s([t.inject(u),l("design:type",Function)],K.prototype,"pathGeneratorFactory",void 0),s([t.inject(O),l("design:type",Function)],K.prototype,"styleRendererFactory",void 0),s([t.inject(t.DisplayObjectPool),l("design:type",t.DisplayObjectPool)],K.prototype,"displayObjectPool",void 0),s([t.inject(J),l("design:type",Object)],K.prototype,"canvasRendererPluginOptions",void 0),s([t.inject(t.RBushRoot),l("design:type",t.RBush)],K.prototype,"rBush",void 0),K=H=s([t.singleton({contrib:t.RenderingPluginContribution})],K);var q=t.Module((function(r){var n;r(e.CircleRenderer),r(e.EllipseRenderer),r(e.RectRenderer),r(e.ImageRenderer),r(e.TextRenderer),r(e.LineRenderer),r(e.PolylineRenderer),r(e.PolygonRenderer),r(e.PathRenderer);var i=((n={})[t.Shape.CIRCLE]=T,n[t.Shape.ELLIPSE]=k,n[t.Shape.RECT]=A,n[t.Shape.IMAGE]=G,n[t.Shape.TEXT]=I,n[t.Shape.LINE]=M,n[t.Shape.POLYLINE]=N,n[t.Shape.POLYGON]=j,n[t.Shape.PATH]=B,n);r({token:O,useFactory:function(e){return function(t){var r=i[t];return r&&e.container.isBound(r)?e.container.get(r):null}}}),r(K)})),z=function(e){function t(t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).options=void 0,r.name="canvas-renderer",r.options=t,r}a(t,e);var r=t.prototype;return r.init=function(){this.container.register(J,{useValue:o({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options)}),this.container.load(q,!0)},r.destroy=function(){this.container.unload(q),this.container.remove(J)},t}(t.AbstractRendererPlugin);e.CircleRendererContribution=T,e.EllipseRendererContribution=k,e.ImageRendererContribution=G,e.LineRendererContribution=M,e.PathRendererContribution=B,e.Plugin=z,e.PolygonRendererContribution=j,e.PolylineRendererContribution=N,e.RectRendererContribution=A,e.StyleRendererFactory=O,e.TextRendererContribution=I,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
F=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=Object.create((t&&t.prototype instanceof h?t:h).prototype),o=new R(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var l=x(a,r);if(l){if(l===u)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,o),i}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function h(){}function d(){}function f(){}var p={};l(p,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(S([])));y&&y!==t&&r.call(y,i)&&(p=y);var g=f.prototype=h.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function n(i,o,a,l){var c=s(e[i],e,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,l)}))}l(c.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function x(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=f,l(g,"constructor",f),l(f,"constructor",d),d.displayName=l(f,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(w.prototype),l(w.prototype,o,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new w(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),l(g,a,"Generator"),l(g,i,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var l=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(l&&c){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(l){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function D(e,t,r,n,i,o,a){try{var l=e[o](a),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,i)}function _(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){D(o,n,i,a,l,"next",e)}function l(e){D(o,n,i,a,l,"throw",e)}a(void 0)}))}}var V,Y,X=function(){function e(){this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=void 0}var r=e.prototype;return r.getImageSync=function(e,t){return this.imageCache[e]||this.getOrCreateImage(e).then((function(){t&&t()})),this.imageCache[e]},r.getOrCreateImage=function(e){var r=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var n=this.canvasConfig.createImage;return new Promise((function(i,o){var a;n?a=n(e):t.isBrowser&&(a=new window.Image),a&&(a.onload=function(){i(a)},a.onerror=function(e){o(e)},a.crossOrigin="Anonymous",a.src=e,r.imageCache[e]=a)}))},r.getOrCreatePatternSync=function(e,r,n){var i=this.generatePatternKey(e);if(i&&this.patternCache[i])return this.patternCache[i];var o,a=e.image,l=e.repetition,c=(o=t.isString(a)?this.getImageSync(a,n):a)&&r.createPattern(o,l);return i&&c&&(this.patternCache[i]=c),c},r.getOrCreateGradient=function(e,r){var n=this.generateGradientKey(e),i=e.type,o=e.steps,a=e.width,l=e.height,c=e.cx,s=e.cy;if(this.gradientCache[n])return this.gradientCache[n];var u=null;if(i===t.GradientType.LinearGradient){var h=t.computeLinearGradient(a,l,e.angle);u=r.createLinearGradient(h.x1,h.y1,h.x2,h.y2)}else if(i===t.GradientType.RadialGradient){var d=t.computeRadialGradient(a,l,c,s),f=d.x,p=d.y;u=r.createRadialGradient(f,p,0,f,p,d.r)}return u&&(o.forEach((function(e){var t;null===(t=u)||void 0===t||t.addColorStop(e[0],e[1])})),this.gradientCache[n]=u),this.gradientCache[n]},r.generateGradientKey=function(e){return"gradient-"+e.type+"-"+(e.angle||0)+"-"+(e.cx||0)+"-"+(e.cy||0)+"-"+e.width+"-"+e.height+"-"+e.steps.map((function(e){return e.join("")})).join("-")},r.generatePatternKey=function(e){var r=e.image,n=e.repetition;if(t.isString(r))return"pattern-"+r+"-"+n},e}();c([t.inject(t.CanvasConfig),s("design:type",Object)],X.prototype,"canvasConfig",void 0),X=c([t.singleton()],X);var U=(V=function(){function e(){this.imagePool=void 0,this.renderingContext=void 0}return e.prototype.apply=function(e){var r=this,n=function(n){var i=n.target;if(i.nodeName===t.Shape.IMAGE){var o=i.attributes.img;t.isString(o)&&r.imagePool.getImageSync(o,(function(){i.renderable.dirty=!0,e.dirtify()}))}},i=function(n){var i=n.target,o=n.newValue;i.nodeName===t.Shape.IMAGE&&"img"===n.attrName&&t.isString(o)&&r.imagePool.getOrCreateImage(o).then((function(){i.renderable.dirty=!0,e.dirtify()}))};e.hooks.init.tapPromise(Y.tag,_(F().mark((function e(){return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,i);case 2:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(Y.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,i)}))},e}(),V.tag="LoadImage",Y=V);c([t.inject(X),s("design:type",X)],U.prototype,"imagePool",void 0),c([t.inject(t.RenderingContext),s("design:type",Object)],U.prototype,"renderingContext",void 0),U=Y=c([t.singleton({contrib:t.RenderingPluginContribution})],U);t.Module((function(e){e(X),e(U)}));e.ImageRenderer=function(){function e(){this.imagePool=void 0}return e.prototype.render=function(e,r){var n,i=r.img,o=r.width.value,a=r.height.value;if(t.isString(i)?n=this.imagePool.getImageSync(i):(o||(o=i.width),a||(a=i.height),n=i),n)try{e.drawImage(n,0,0,o,a)}catch(e){}},e}(),c([t.inject(X),s("design:type",X)],e.ImageRenderer.prototype,"imagePool",void 0),e.ImageRenderer=c([t.singleton({token:G})],e.ImageRenderer),e.TextRenderer=function(){function e(){}var r=e.prototype;return r.render=function(e,r,n){var i=r.lineWidth,o=r.textAlign,a=r.textBaseline,l=r.lineJoin,c=r.miterLimit,s=r.letterSpacing,u=r.stroke,h=r.fill,d=r.fillOpacity,f=r.strokeOpacity,p=r.opacity,v=r.metrics,y=r.dx,g=r.dy,m=v.lines,w=v.height,x=v.lineHeight,b=v.lineMetrics;e.font=v.font,e.lineWidth=i.value,e.textAlign=o.value,e.textBaseline=a.value,e.lineJoin=l.value,t.isNil(c)||(e.miterLimit=c.value);var E=0;"middle"===a.value?E=-w/2-x/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?E=-w:"top"!==a.value&&"hanging"!==a.value||(E=-x);var R=0;y&&y.unit===t.UnitType.kPixels&&(R+=y.value),g&&g.unit===t.UnitType.kPixels&&(E+=g.value);for(var S=0;m.length>S;S++){var C=i.value/2+R;E+=x,!t.isNil(u)&&!u.isNone&&i&&i.value&&this.drawLetterSpacing(e,m[S],b[S],o.value,C,E,s.value,d.value,f.value,p.value,!0),t.isNil(h)||this.drawLetterSpacing(e,m[S],b[S],o.value,C,E,s.value,d.value,f.value,p.value)}},r.drawLetterSpacing=function(e,t,r,n,i,o,a,l,c,s,u){if(void 0===u&&(u=!1),0!==a){var h=e.textAlign;e.textAlign="left";var d=i;"center"===n?d=i-r.width/2:"right"!==n&&"end"!==n||(d=i-r.width);for(var f=Array.from(t),p=e.measureText(t).width,v=0,y=0;f.length>y;++y){var g=f[y];u?this.strokeText(e,g,d,o,c):this.fillText(e,g,d,o,l,s),d+=p-(v=e.measureText(t.substring(y+1)).width)+a,p=v}e.textAlign=h}else u?this.strokeText(e,t,i,o,c):this.fillText(e,t,i,o,l,s)},r.fillText=function(e,r,n,i,o,a){var l,c=!t.isNil(o)&&1!==o;c&&(l=e.globalAlpha,e.globalAlpha=o*a),e.fillText(r,n,i),c&&(e.globalAlpha=l)},r.strokeText=function(e,r,n,i,o){var a,l=!t.isNil(o)&&1!==o;l&&(a=e.globalAlpha,e.globalAlpha=o),e.strokeText(r,n,i),l&&(e.globalAlpha=a)},e}(),e.TextRenderer=c([t.singleton({token:I})],e.TextRenderer);var W=function(){function e(){this.imagePool=void 0}var r=e.prototype;return r.render=function(e,r,n,i){var o=r.fill,a=r.opacity,l=r.fillOpacity,c=r.stroke,s=r.strokeOpacity,u=r.lineWidth,h=r.lineCap,d=r.lineJoin,f=r.shadowType,p=r.shadowColor,v=r.shadowBlur,y=r.filter,g=r.miterLimit,m=!t.isNil(o)&&!o.isNone,w=!t.isNil(c)&&!c.isNone&&u&&u.value>0,x=0===o.alpha,b=!t.isNil(y),E=!t.isNil(p)&&(null==v?void 0:v.value)>0,R=n.nodeName,S="inner"===(null==f?void 0:f.value),C=w&&E&&(R===t.Shape.PATH||R===t.Shape.LINE||R===t.Shape.POLYLINE||x||S);m&&(e.globalAlpha=a.value*l.value,C||this.setShadowAndFilter(n,e,E),this.fill(e,n,o,i),C||this.clearShadowAndFilter(e,b,E)),w&&(e.globalAlpha=a.value*s.value,e.lineWidth=u.value,t.isNil(g)||(e.miterLimit=g.value),t.isNil(h)||(e.lineCap=h.value),t.isNil(d)||(e.lineJoin=d.value),C&&(S&&(e.globalCompositeOperation="source-atop"),this.setShadowAndFilter(n,e,!0),S&&(this.stroke(e,n,c,i),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,b,!0))),this.stroke(e,n,c,i))},r.clearShadowAndFilter=function(e,r,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),r){var i=e.filter;!t.isNil(i)&&i.indexOf("drop-shadow")>-1&&(e.filter=i.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},r.setShadowAndFilter=function(e,r,n){var i=e.parsedStyle,o=i.shadowColor,a=i.shadowBlur,l=i.shadowOffsetX,c=i.shadowOffsetY;t.isNil(i.filter)||(r.filter=e.style.filter),n&&(r.shadowColor=o.toString(),r.shadowBlur=a&&a.value||0,r.shadowOffsetX=l&&l.value||0,r.shadowOffsetY=c&&c.value||0)},r.fill=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.fillStyle=o.getColor(t,r,e),e.fill()})):(t.isPattern(n)&&(e.fillStyle=this.getPattern(n,r,e,i)),e.fill())},r.stroke=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.strokeStyle=o.getColor(t,r,e),e.stroke()})):(t.isPattern(n)&&(e.strokeStyle=this.getPattern(n,r,e,i)),e.stroke())},r.getPattern=function(e,t,r,n){return this.imagePool.getOrCreatePatternSync(e,r,(function(){t.renderable.dirty=!0,n.dirtify()}))},r.getColor=function(e,r,n){var i;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var a=r.getGeometryBounds();i=this.imagePool.getOrCreateGradient(o({type:e.type},e.value,{width:a&&2*a.halfExtents[0]||1,height:a&&2*a.halfExtents[1]||1}),n)}return i},e}();c([t.inject(X),s("design:type",X)],W.prototype,"imagePool",void 0),W=c([t.singleton()],W),e.RectRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.RectRenderer=c([t.singleton({token:T})],e.RectRenderer),e.CircleRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.CircleRenderer=c([t.singleton({token:M})],e.CircleRenderer),e.EllipseRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.EllipseRenderer=c([t.singleton({token:L})],e.EllipseRenderer),e.LineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.LineRenderer=c([t.singleton({token:A})],e.LineRenderer),e.PolylineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PolylineRenderer=c([t.singleton({token:N})],e.PolylineRenderer),e.PolygonRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PolygonRenderer=c([t.singleton({token:j})],e.PolygonRenderer),e.PathRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PathRenderer=c([t.singleton({token:B})],e.PathRenderer);var Q,H,J=t.Syringe.defineToken("CanvasRendererPluginOptions"),K=(Q=function(){function e(){this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.styleRendererFactory=void 0,this.styleRendererFactoryCache={},this.displayObjectPool=void 0,this.canvasRendererPluginOptions=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=x(),this.dprMatrix=x(),this.tmpMat4=x(),this.tmpVec3=S()}var n=e.prototype;return n.apply=function(e){var n=this,o=this.renderingContext.root.ownerDocument.defaultView,a=function(e){var t=e.target.rBushNode;t.aabb&&n.removedRBushNodeAABBs.push(t.aabb)},l=function(e){var t=e.target.rBushNode;t.aabb&&n.removedRBushNodeAABBs.push(t.aabb)};e.hooks.init.tapPromise(H.tag,i(r().mark((function e(){var i,o,c,s,u;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,a),n.renderingContext.root.addEventListener(t.ElementEvent.CULLED,l),i=n.contextService.getDPR(),c=(o=n.canvasConfig).width,s=o.height,u=n.contextService.getContext(),n.clearRect(u,0,0,c*i,s*i),r=n.dprMatrix,h=C(i,i,1),r[0]=h[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=h[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1;case 7:case"end":return e.stop()}var r,h}),e)})))),e.hooks.destroy.tap(H.tag,(function(){n.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,a),n.renderingContext.root.removeEventListener(t.ElementEvent.CULLED,l)})),e.hooks.beginFrame.tap(H.tag,(function(){var t=n.contextService.getContext(),r=n.contextService.getDPR(),i=n.canvasConfig,o=i.width,a=i.height,l=n.canvasRendererPluginOptions,c=l.dirtyObjectNumThreshold,s=l.dirtyObjectRatioThreshold,u=e.getStats(),h=u.rendered,d=h/u.total;n.clearFullScreen=e.disableDirtyRectangleRendering()||h>c&&d>s,t&&(t.resetTransform(),n.clearFullScreen&&n.clearRect(t,0,0,o*r,a*r))}));var c=function t(r){r.isVisible()&&!r.isCulled()&&(n.renderDisplayObject(r,e),n.saveDirtyAABB(r)),r.sortable.sorted&&r.sortable.sorted.length&&r.sortable.sorted.forEach((function(e){t(e)}))};e.hooks.endFrame.tap(H.tag,(function(){var r=n.contextService.getContext();if(E(n.vpMatrix,n.dprMatrix,n.camera.getOrthoMatrix()),n.clearFullScreen)c(n.renderingContext.root);else{var i=n.safeMergeAABB.apply(n,[n.mergeDirtyAABBs(n.renderQueue)].concat(n.removedRBushNodeAABBs.map((function(e){var r=e.minX,n=e.minY,i=e.maxX,o=e.maxY,a=new t.AABB;return a.setMinMax(C(r,n,0),C(i,o,0)),a}))));if(n.removedRBushNodeAABBs=[],t.AABB.isEmpty(i))return void(n.renderQueue=[]);var a=n.convertAABB2Rect(i),l=a.x,s=a.y,u=a.width,h=a.height,d=P(n.tmpVec3,C(l,s,0),n.vpMatrix),f=P(S(),C(l+u,s+h,0),n.vpMatrix),p=Math.floor(d[0]),v=Math.floor(d[1]),y=Math.ceil(f[0]-d[0]),g=Math.ceil(f[1]-d[1]);r.save(),n.clearRect(r,p,v,y,g),r.beginPath(),r.rect(p,v,y,g),r.clip(),r.setTransform(n.vpMatrix[0],n.vpMatrix[1],n.vpMatrix[4],n.vpMatrix[5],n.vpMatrix[12],n.vpMatrix[13]),n.canvasConfig.renderer.getConfig().enableDirtyRectangleRenderingDebug&&o.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:a})),n.searchDirtyObjects(i).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&n.renderDisplayObject(t,e)})),r.restore(),n.renderQueue.forEach((function(e){n.saveDirtyAABB(e)})),n.renderQueue=[]}n.restoreStack.forEach((function(){r.restore()})),n.restoreStack=[]})),e.hooks.render.tap(H.tag,(function(e){n.clearFullScreen||n.renderQueue.push(e)}))},n.clearRect=function(e,t,r,n,i){e.clearRect(t,r,n,i);var o=this.canvasConfig.background;o&&(e.fillStyle=o,e.fillRect(t,r,n,i))},n.renderDisplayObject=function(e,r){for(var n=this.contextService.getContext(),i=this.restoreStack[this.restoreStack.length-1];i&&e.parentNode!==i;)n.restore(),this.restoreStack.pop(),i=this.restoreStack[this.restoreStack.length-1];var o=e.nodeName;void 0===this.styleRendererFactoryCache[o]&&(this.styleRendererFactoryCache[o]=this.styleRendererFactory(o));var a=this.styleRendererFactoryCache[o];void 0===this.pathGeneratorFactoryCache[o]&&(this.pathGeneratorFactoryCache[o]=this.pathGeneratorFactory(o));var l=this.pathGeneratorFactoryCache[o],c=e.parsedStyle.clipPath;if(c){this.applyWorldTransform(n,c,e.getWorldTransform()),void 0===this.pathGeneratorFactoryCache[c.nodeName]&&(this.pathGeneratorFactoryCache[c.nodeName]=this.pathGeneratorFactory(c.nodeName));var s=this.pathGeneratorFactoryCache[c.nodeName];s&&(n.save(),this.restoreStack.push(e),n.beginPath(),s(n,c.parsedStyle),n.closePath(),n.clip())}a&&(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()),a&&(a.render(n,e.parsedStyle,e,r),n.restore()),e.renderable.dirty=!1},n.convertAABB2Rect=function(e){var t=e.getMin(),r=e.getMax(),n=Math.floor(t[0]),i=Math.floor(t[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}},n.mergeDirtyAABBs=function(e){var r=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();r.add(t);var n=e.renderable.dirtyRenderBounds;n&&r.add(n)})),r},n.searchDirtyObjects=function(e){var t=this,r=e.getMin(),n=r[0],i=r[1],o=e.getMax();return this.rBush.search({minX:n,minY:i,maxX:o[0],maxY:o[1]}).map((function(e){return t.displayObjectPool.getByEntity(e.id)}))},n.saveDirtyAABB=function(e){var r=e.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new t.AABB);var n=e.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},n.applyAttributesToContext=function(e,r){var n=r.parsedStyle,i=n.stroke,o=n.fill,a=n.opacity,l=n.lineDash,c=n.lineDashOffset;l&&Array.isArray(l)&&e.setLineDash(l.map((function(e){return e.value}))),t.isNil(c)||(e.lineDashOffset=c.value),t.isNil(a)||(e.globalAlpha*=a.value),t.isNil(i)||Array.isArray(i)||i.isNone||(e.strokeStyle=r.attributes.stroke),t.isNil(o)||Array.isArray(o)||o.isNone||(e.fillStyle=r.attributes.fill)},n.applyWorldTransform=function(e,t,r){var n=0,i=0,o=(t.parsedStyle||{}).anchor,a=o&&o[0].value||0,l=o&&o[1].value||0;if(0!==a||0!==l){var c=t.getGeometryBounds();n=-a*(c&&2*c.halfExtents[0]||0),i=-l*(c&&2*c.halfExtents[1]||0)}r?(b(this.tmpMat4,t.getLocalTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,R(this.tmpMat4,this.tmpMat4,this.tmpVec3),E(this.tmpMat4,r,this.tmpMat4),E(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(b(this.tmpMat4,t.getWorldTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,R(this.tmpMat4,this.tmpMat4,this.tmpVec3),E(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])},n.safeMergeAABB=function(){for(var e=new t.AABB,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return n.forEach((function(t){e.add(t)})),e},e}(),Q.tag="CanvasRenderer",H=Q);c([t.inject(t.CanvasConfig),s("design:type",Object)],K.prototype,"canvasConfig",void 0),c([t.inject(t.DefaultCamera),s("design:type",t.Camera)],K.prototype,"camera",void 0),c([t.inject(t.ContextService),s("design:type",Object)],K.prototype,"contextService",void 0),c([t.inject(t.RenderingContext),s("design:type",Object)],K.prototype,"renderingContext",void 0),c([t.inject(u),s("design:type",Function)],K.prototype,"pathGeneratorFactory",void 0),c([t.inject(k),s("design:type",Function)],K.prototype,"styleRendererFactory",void 0),c([t.inject(t.DisplayObjectPool),s("design:type",t.DisplayObjectPool)],K.prototype,"displayObjectPool",void 0),c([t.inject(J),s("design:type",Object)],K.prototype,"canvasRendererPluginOptions",void 0),c([t.inject(t.RBushRoot),s("design:type",t.RBush)],K.prototype,"rBush",void 0),K=H=c([t.singleton({contrib:t.RenderingPluginContribution})],K);var Z=t.Module((function(r){var n;r(e.CircleRenderer),r(e.EllipseRenderer),r(e.RectRenderer),r(e.ImageRenderer),r(e.TextRenderer),r(e.LineRenderer),r(e.PolylineRenderer),r(e.PolygonRenderer),r(e.PathRenderer);var i=((n={})[t.Shape.CIRCLE]=M,n[t.Shape.ELLIPSE]=L,n[t.Shape.RECT]=T,n[t.Shape.IMAGE]=G,n[t.Shape.TEXT]=I,n[t.Shape.LINE]=A,n[t.Shape.POLYLINE]=N,n[t.Shape.POLYGON]=j,n[t.Shape.PATH]=B,n);r({token:k,useFactory:function(e){return function(t){var r=i[t];return r&&e.container.isBound(r)?e.container.get(r):null}}}),r(K)})),q=function(e){function t(t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).options=void 0,r.name="canvas-renderer",r.options=t,r}a(t,e);var r=t.prototype;return r.init=function(){this.container.register(J,{useValue:o({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options)}),this.container.load(Z,!0)},r.destroy=function(){this.container.unload(Z),this.container.remove(J)},t}(t.AbstractRendererPlugin);e.CircleRendererContribution=M,e.EllipseRendererContribution=L,e.ImageRendererContribution=G,e.LineRendererContribution=A,e.PathRendererContribution=B,e.Plugin=q,e.PolygonRendererContribution=j,e.PolylineRendererContribution=N,e.RectRendererContribution=T,e.StyleRendererFactory=k,e.TextRendererContribution=I,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@antv/g-plugin-canvas-renderer", | ||
"version": "1.6.4", | ||
"version": "1.7.0", | ||
"description": "A G plugin of renderer implementation with Canvas2D API", | ||
@@ -30,5 +30,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@antv/g-math": "^1.6.3", | ||
"@antv/g-plugin-canvas-path-generator": "^1.0.4", | ||
"@antv/g-plugin-image-loader": "^1.0.4", | ||
"@antv/g-math": "^1.7.0", | ||
"@antv/g-plugin-canvas-path-generator": "^1.1.0", | ||
"@antv/g-plugin-image-loader": "^1.1.0", | ||
"tslib": "^2.3.1" | ||
@@ -45,3 +45,3 @@ }, | ||
}, | ||
"gitHead": "996b3f3fb678a624832af1966870d63fcdb896a3" | ||
"gitHead": "65f0f3f0c094569ae4dd752ff9708c7738f2613d" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
274829
5754