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

@antv/g-plugin-canvas-renderer

Package Overview
Dependencies
Maintainers
56
Versions
260
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-plugin-canvas-renderer - npm Package Compare versions

Comparing version 1.0.0-alpha.37 to 1.0.0-alpha.38

2

dist/index.umd.js

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

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@antv/g"),require("mana-syringe")):"function"==typeof define&&define.amd?define(["@antv/g","mana-syringe"],n):"object"==typeof exports?exports.CanvasRenderer=n(require("@antv/g"),require("mana-syringe")):(t.G=t.G||{},t.G.CanvasRenderer=n(t.G,t.G.ManaSyringe))}(window,(function(t,n){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=7)}([function(n,e){n.exports=t},function(t,e){t.exports=n},function(t,n,e){t.exports=function(){"use strict";function t(t,r,o,a,i){!function t(e,r,o,a,i){for(;a>o;){if(a-o>600){var u=a-o+1,c=r-o+1,s=Math.log(u),h=.5*Math.exp(2*s/3),f=.5*Math.sqrt(s*h*(u-h)/u)*(c-u/2<0?-1:1);t(e,r,Math.max(o,Math.floor(r-c*h/u+f)),Math.min(a,Math.floor(r+(u-c)*h/u+f)),i)}var l=e[r],d=o,p=a;for(n(e,o,r),i(e[a],l)>0&&n(e,o,a);d<p;){for(n(e,d,p),d++,p--;i(e[d],l)<0;)d++;for(;i(e[p],l)>0;)p--}0===i(e[o],l)?n(e,o,p):n(e,++p,a),p<=r&&(o=p+1),r<=p&&(a=p-1)}}(t,r,o||0,a||t.length-1,i||e)}function n(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function e(t,n){return t<n?-1:t>n?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(t,n,e){if(!e)return n.indexOf(t);for(var r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function a(t,n){i(t,0,t.children.length,n,t)}function i(t,n,e,r,o){o||(o=p(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(var a=n;a<e;a++){var i=t.children[a];u(o,t.leaf?r(i):i)}return o}function u(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function c(t,n){return t.minX-n.minX}function s(t,n){return t.minY-n.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function f(t){return t.maxX-t.minX+(t.maxY-t.minY)}function l(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function d(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(n,e,r,o,a){for(var i=[e,r];i.length;)if(!((r=i.pop())-(e=i.pop())<=o)){var u=e+Math.ceil((r-e)/o/2)*o;t(n,u,e,r,a),i.push(e,u,u,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var n=this.data,e=[];if(!d(t,n))return e;for(var r=this.toBBox,o=[];n;){for(var a=0;a<n.children.length;a++){var i=n.children[a],u=n.leaf?r(i):i;d(t,u)&&(n.leaf?e.push(i):l(t,u)?this._all(i,e):o.push(i))}n=o.pop()}return e},r.prototype.collides=function(t){var n=this.data;if(!d(t,n))return!1;for(var e=[];n;){for(var r=0;r<n.children.length;r++){var o=n.children[r],a=n.leaf?this.toBBox(o):o;if(d(t,a)){if(n.leaf||l(t,a))return!0;e.push(o)}}n=e.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var n=0;n<t.length;n++)this.insert(t[n]);return this}var e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){var r=this.data;this.data=e,e=r}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=p([]),this},r.prototype.remove=function(t,n){if(!t)return this;for(var e,r,a,i=this.data,u=this.toBBox(t),c=[],s=[];i||c.length;){if(i||(i=c.pop(),r=c[c.length-1],e=s.pop(),a=!0),i.leaf){var h=o(t,i.children,n);if(-1!==h)return i.children.splice(h,1),c.push(i),this._condense(c),this}a||i.leaf||!l(i,u)?r?(e++,i=r.children[e],a=!1):i=null:(c.push(i),s.push(e),e=0,r=i,i=i.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,n){return t.minX-n.minX},r.prototype.compareMinY=function(t,n){return t.minY-n.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,n){for(var e=[];t;)t.leaf?n.push.apply(n,t.children):e.push.apply(e,t.children),t=e.pop();return n},r.prototype._build=function(t,n,e,r){var o,i=e-n+1,u=this._maxEntries;if(i<=u)return a(o=p(t.slice(n,e+1)),this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(u)),u=Math.ceil(i/Math.pow(u,r-1))),(o=p([])).leaf=!1,o.height=r;var c=Math.ceil(i/u),s=c*Math.ceil(Math.sqrt(u));v(t,n,e,s,this.compareMinX);for(var h=n;h<=e;h+=s){var f=Math.min(h+s-1,e);v(t,h,f,c,this.compareMinY);for(var l=h;l<=f;l+=c){var d=Math.min(l+c-1,f);o.children.push(this._build(t,l,d,r-1))}}return a(o,this.toBBox),o},r.prototype._chooseSubtree=function(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){for(var o=1/0,a=1/0,i=void 0,u=0;u<n.children.length;u++){var c=n.children[u],s=h(c),f=(l=t,d=c,(Math.max(d.maxX,l.maxX)-Math.min(d.minX,l.minX))*(Math.max(d.maxY,l.maxY)-Math.min(d.minY,l.minY))-s);f<a?(a=f,o=s<o?s:o,i=c):f===a&&s<o&&(o=s,i=c)}n=i||n.children[0]}var l,d;return n},r.prototype._insert=function(t,n,e){var r=e?t:this.toBBox(t),o=[],a=this._chooseSubtree(r,this.data,n,o);for(a.children.push(t),u(a,r);n>=0&&o[n].children.length>this._maxEntries;)this._split(o,n),n--;this._adjustParentBBoxes(r,o,n)},r.prototype._split=function(t,n){var e=t[n],r=e.children.length,o=this._minEntries;this._chooseSplitAxis(e,o,r);var i=this._chooseSplitIndex(e,o,r),u=p(e.children.splice(i,e.children.length-i));u.height=e.height,u.leaf=e.leaf,a(e,this.toBBox),a(u,this.toBBox),n?t[n-1].children.push(u):this._splitRoot(e,u)},r.prototype._splitRoot=function(t,n){this.data=p([t,n]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,n,e){for(var r,o,a,u,c,s,f,l=1/0,d=1/0,p=n;p<=e-n;p++){var v=i(t,0,p,this.toBBox),m=i(t,p,e,this.toBBox),g=(o=v,a=m,u=Math.max(o.minX,a.minX),c=Math.max(o.minY,a.minY),s=Math.min(o.maxX,a.maxX),f=Math.min(o.maxY,a.maxY),Math.max(0,s-u)*Math.max(0,f-c)),y=h(v)+h(m);g<l?(l=g,r=p,d=y<d?y:d):g===l&&y<d&&(d=y,r=p)}return r||e-n},r.prototype._chooseSplitAxis=function(t,n,e){var r=t.leaf?this.compareMinX:c,o=t.leaf?this.compareMinY:s;this._allDistMargin(t,n,e,r)<this._allDistMargin(t,n,e,o)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,n,e,r){t.children.sort(r);for(var o=this.toBBox,a=i(t,0,n,o),c=i(t,e-n,e,o),s=f(a)+f(c),h=n;h<e-n;h++){var l=t.children[h];u(a,t.leaf?o(l):l),s+=f(a)}for(var d=e-n-1;d>=n;d--){var p=t.children[d];u(c,t.leaf?o(p):p),s+=f(c)}return s},r.prototype._adjustParentBBoxes=function(t,n,e){for(var r=e;r>=0;r--)u(n[r],t)},r.prototype._condense=function(t){for(var n=t.length-1,e=void 0;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():a(t[n],this.toBBox)},r}()},,,,,function(t,n,e){"use strict";e.r(n),e.d(n,"PathGeneratorFactory",(function(){return _})),e.d(n,"PathGenerator",(function(){return Y})),e.d(n,"StyleRenderer",(function(){return f})),e.d(n,"RBushNode",(function(){return Se})),e.d(n,"RBushRoot",(function(){return Ae})),e.d(n,"RBush",(function(){return s.a})),e.d(n,"Plugin",(function(){return Te}));var r={};e.r(r),e.d(r,"create",(function(){return q})),e.d(r,"clone",(function(){return N})),e.d(r,"copy",(function(){return L})),e.d(r,"fromValues",(function(){return G})),e.d(r,"set",(function(){return F})),e.d(r,"identity",(function(){return H})),e.d(r,"transpose",(function(){return V})),e.d(r,"invert",(function(){return U})),e.d(r,"adjoint",(function(){return Z})),e.d(r,"determinant",(function(){return z})),e.d(r,"multiply",(function(){return Q})),e.d(r,"translate",(function(){return W})),e.d(r,"scale",(function(){return J})),e.d(r,"rotate",(function(){return K})),e.d(r,"rotateX",(function(){return $})),e.d(r,"rotateY",(function(){return tt})),e.d(r,"rotateZ",(function(){return nt})),e.d(r,"fromTranslation",(function(){return et})),e.d(r,"fromScaling",(function(){return rt})),e.d(r,"fromRotation",(function(){return ot})),e.d(r,"fromXRotation",(function(){return at})),e.d(r,"fromYRotation",(function(){return it})),e.d(r,"fromZRotation",(function(){return ut})),e.d(r,"fromRotationTranslation",(function(){return ct})),e.d(r,"fromQuat2",(function(){return st})),e.d(r,"getTranslation",(function(){return ht})),e.d(r,"getScaling",(function(){return ft})),e.d(r,"getRotation",(function(){return lt})),e.d(r,"fromRotationTranslationScale",(function(){return dt})),e.d(r,"fromRotationTranslationScaleOrigin",(function(){return pt})),e.d(r,"fromQuat",(function(){return vt})),e.d(r,"frustum",(function(){return mt})),e.d(r,"perspectiveNO",(function(){return gt})),e.d(r,"perspective",(function(){return yt})),e.d(r,"perspectiveZO",(function(){return Mt})),e.d(r,"perspectiveFromFieldOfView",(function(){return bt})),e.d(r,"orthoNO",(function(){return xt})),e.d(r,"ortho",(function(){return Pt})),e.d(r,"orthoZO",(function(){return Ot})),e.d(r,"lookAt",(function(){return Ct})),e.d(r,"targetTo",(function(){return Et})),e.d(r,"str",(function(){return St})),e.d(r,"frob",(function(){return At})),e.d(r,"add",(function(){return jt})),e.d(r,"subtract",(function(){return Rt})),e.d(r,"multiplyScalar",(function(){return Bt})),e.d(r,"multiplyScalarAndAdd",(function(){return wt})),e.d(r,"exactEquals",(function(){return Tt})),e.d(r,"equals",(function(){return kt})),e.d(r,"mul",(function(){return _t})),e.d(r,"sub",(function(){return Yt}));var o={};e.r(o),e.d(o,"create",(function(){return Dt})),e.d(o,"clone",(function(){return Xt})),e.d(o,"length",(function(){return It})),e.d(o,"fromValues",(function(){return qt})),e.d(o,"copy",(function(){return Nt})),e.d(o,"set",(function(){return Lt})),e.d(o,"add",(function(){return Gt})),e.d(o,"subtract",(function(){return Ft})),e.d(o,"multiply",(function(){return Ht})),e.d(o,"divide",(function(){return Vt})),e.d(o,"ceil",(function(){return Ut})),e.d(o,"floor",(function(){return Zt})),e.d(o,"min",(function(){return zt})),e.d(o,"max",(function(){return Qt})),e.d(o,"round",(function(){return Wt})),e.d(o,"scale",(function(){return Jt})),e.d(o,"scaleAndAdd",(function(){return Kt})),e.d(o,"distance",(function(){return $t})),e.d(o,"squaredDistance",(function(){return tn})),e.d(o,"squaredLength",(function(){return nn})),e.d(o,"negate",(function(){return en})),e.d(o,"inverse",(function(){return rn})),e.d(o,"normalize",(function(){return on})),e.d(o,"dot",(function(){return an})),e.d(o,"cross",(function(){return un})),e.d(o,"lerp",(function(){return cn})),e.d(o,"hermite",(function(){return sn})),e.d(o,"bezier",(function(){return hn})),e.d(o,"random",(function(){return fn})),e.d(o,"transformMat4",(function(){return ln})),e.d(o,"transformMat3",(function(){return dn})),e.d(o,"transformQuat",(function(){return pn})),e.d(o,"rotateX",(function(){return vn})),e.d(o,"rotateY",(function(){return mn})),e.d(o,"rotateZ",(function(){return gn})),e.d(o,"angle",(function(){return yn})),e.d(o,"zero",(function(){return Mn})),e.d(o,"str",(function(){return bn})),e.d(o,"exactEquals",(function(){return xn})),e.d(o,"equals",(function(){return Pn})),e.d(o,"sub",(function(){return Cn})),e.d(o,"mul",(function(){return En})),e.d(o,"div",(function(){return Sn})),e.d(o,"dist",(function(){return An})),e.d(o,"sqrDist",(function(){return jn})),e.d(o,"len",(function(){return Rn})),e.d(o,"sqrLen",(function(){return Bn})),e.d(o,"forEach",(function(){return wn}));var a={};e.r(a),e.d(a,"create",(function(){return _n})),e.d(a,"identity",(function(){return Yn})),e.d(a,"setAxisAngle",(function(){return Dn})),e.d(a,"getAxisAngle",(function(){return Xn})),e.d(a,"getAngle",(function(){return In})),e.d(a,"multiply",(function(){return qn})),e.d(a,"rotateX",(function(){return Nn})),e.d(a,"rotateY",(function(){return Ln})),e.d(a,"rotateZ",(function(){return Gn})),e.d(a,"calculateW",(function(){return Fn})),e.d(a,"exp",(function(){return Hn})),e.d(a,"ln",(function(){return Vn})),e.d(a,"pow",(function(){return Un})),e.d(a,"slerp",(function(){return Zn})),e.d(a,"random",(function(){return zn})),e.d(a,"invert",(function(){return Qn})),e.d(a,"conjugate",(function(){return Wn})),e.d(a,"fromMat3",(function(){return Jn})),e.d(a,"fromEuler",(function(){return Kn})),e.d(a,"str",(function(){return $n})),e.d(a,"clone",(function(){return ue})),e.d(a,"fromValues",(function(){return ce})),e.d(a,"copy",(function(){return se})),e.d(a,"set",(function(){return he})),e.d(a,"add",(function(){return fe})),e.d(a,"mul",(function(){return le})),e.d(a,"scale",(function(){return de})),e.d(a,"dot",(function(){return pe})),e.d(a,"lerp",(function(){return ve})),e.d(a,"length",(function(){return me})),e.d(a,"len",(function(){return ge})),e.d(a,"squaredLength",(function(){return ye})),e.d(a,"sqrLen",(function(){return Me})),e.d(a,"normalize",(function(){return be})),e.d(a,"exactEquals",(function(){return xe})),e.d(a,"equals",(function(){return Pe})),e.d(a,"rotationTo",(function(){return Oe})),e.d(a,"sqlerp",(function(){return Ce})),e.d(a,"setAxes",(function(){return Ee}));var i=e(0),u=e(1),c=e(2),s=e.n(c),h=u.Syringe.defineToken("StyleRendererFactory"),f=u.Syringe.defineToken("StyleRenderer"),l=function(t,n){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])})(t,n)};var d=function(){return(d=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};function p(t,n,e,r){var o,a=arguments.length,i=a<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,n,e,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(i=(a<3?o(i):a>3?o(n,e,i):o(n,e))||i);return a>3&&i&&Object.defineProperty(n,e,i),i}function v(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)}Object.create;function m(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,a=e.call(t),i=[];try{for(;(void 0===n||n-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return i}Object.create;var g={}.toString,y=function(t,n){return g.call(t)==="[object "+n+"]"},M=function(t){return y(t,"Function")},b=function(t){return null==t},x=function(t){return Array.isArray?Array.isArray(t):y(t,"Array")},P=function(t){var n=typeof t;return null!==t&&"object"===n||"function"===n};var O=function(t,n){if(t)if(x(t))for(var e=0,r=t.length;e<r&&!1!==n(t[e],e);e++);else if(P(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===n(t[o],o))break};Object.keys;var C=Array.prototype,E=(C.splice,C.indexOf,Array.prototype.splice,function(t){return y(t,"String")});Object.prototype.hasOwnProperty;var S=function(t){return y(t,"Number")};Number.isInteger&&Number.isInteger;Math.PI,parseInt,Math.PI;var A=Object.values?function(t){return Object.values(t)}:function(t){var n=[];return O(t,(function(e,r){M(t)&&"prototype"===r||n.push(e)})),n};Object.prototype;Object.prototype.hasOwnProperty;var j;Object.prototype.hasOwnProperty;(function(t,n){if(!M(t))throw new TypeError("Expected a function");var e=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var a=n?n.apply(this,r):r[0],i=e.cache;if(i.has(a))return i.get(a);var u=t.apply(this,r);return i.set(a,u),u};e.cache=new Map})((function(t,n){void 0===n&&(n={});var e=n.fontSize,r=n.fontFamily,o=n.fontWeight,a=n.fontStyle,i=n.fontVariant;return j||(j=document.createElement("canvas").getContext("2d")),j.font=[a,i,o,e+"px",r].join(" "),j.measureText(E(t)?t:"").width}),(function(t,n){return void 0===n&&(n={}),function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var r=Array(t),o=0;for(n=0;n<e;n++)for(var a=arguments[n],i=0,u=a.length;i<u;i++,o++)r[o]=a[i];return r}([t],A(n)).join("")})),function(){function t(){this.map={}}t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,n){var e=this.map[t];return void 0===e?n:e},t.prototype.set=function(t,n){this.map[t]=n},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length}}();var R=function(){function t(){}return t.prototype.render=function(t,n){var e=n.fill,r=n.opacity,o=n.fillOpacity,a=n.stroke,i=n.strokeOpacity,u=n.lineWidth,c=n.lineCap,s=n.lineJoin;if(b(e)||(b(o)||1===o?t.fill():(t.globalAlpha=o,t.fill(),t.globalAlpha=r)),!b(a)&&u&&u>0){!b(i)&&1!==i&&(t.globalAlpha=i),t.lineWidth=u,b(c)||(t.lineCap=c),b(s)||(t.lineJoin=s);var h=t.shadowBlur,f=t.shadowColor;b(h)||(t.shadowColor="transparent",t.shadowBlur=0);var l=t.filter;!b(l)&&l.indexOf("drop-shadow")>-1&&(t.filter=l.replace(/drop-shadow\([^)]*\)/,"").trim()||"none"),t.stroke(),b(h)||(t.shadowColor=f,t.shadowBlur=h),b(l)||(t.filter=l)}},t=p([Object(u.singleton)({token:[{token:f,named:i.SHAPE.Circle},{token:f,named:i.SHAPE.Ellipse},{token:f,named:i.SHAPE.Rect},{token:f,named:i.SHAPE.Line},{token:f,named:i.SHAPE.Polyline},{token:f,named:i.SHAPE.Polygon},{token:f,named:i.SHAPE.Path}]})],t)}(),B=function(){function t(){this.imageCache={},this.patternCache={}}return t.prototype.getImageSync=function(t){return this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var n=this;return this.imageCache[t]?Promise.resolve(this.imageCache[t]):new Promise((function(e,r){var o=new window.Image;o.onload=function(){e(o)},o.onerror=function(t){r(t)},o.crossOrigin="Anonymous",o.src=t,n.imageCache[t]=o}))},t.prototype.getPatternSync=function(t){var n=this.generatePatternKey(t);if(this.patternCache[n])return this.patternCache[n]},t.prototype.createPattern=function(t,n){var e=this;return this.getOrCreateImage(t.src).then((function(r){var o=e.generatePatternKey(t),a=n.createPattern(r,t.repetition);return a&&(e.patternCache[o]=a),e.patternCache[o]}))},t.prototype.generatePatternKey=function(t){return"pattern-"+t.src+"-"+t.repetition},t=p([Object(u.singleton)()],t)}(),w=function(){function t(){}return t.prototype.render=function(t,n){var e,r=n.width,o=void 0===r?0:r,a=n.height,i=void 0===a?0:a,u=n.img,c=o,s=i;E(u)?e=this.imagePool.getImageSync(u):(c||(c=u.width),s||(s=u.height),e=u),t.drawImage(e,0,0,c,s)},p([Object(u.inject)(B),v("design:type",B)],t.prototype,"imagePool",void 0),t=p([Object(u.singleton)({token:{token:f,named:i.SHAPE.Image}})],t)}(),T=function(){function t(){}return t.prototype.render=function(t,n){n.text;var e=n.lineWidth,r=void 0===e?0:e,o=(n.textAlign,n.textBaseline),a=n.lineJoin,i=n.miterLimit,u=void 0===i?0:i,c=n.padding,s=void 0===c?0:c,h=n.letterSpacing,f=void 0===h?0:h,l=n.stroke,d=n.fill,p=n.fillOpacity,v=n.strokeOpacity,m=n.opacity,g=n.metrics,y=g.font,M=g.lines,x=g.height,P=g.lineHeight;t.font=y,t.lineWidth=r,t.textBaseline=o,t.lineJoin=a,t.miterLimit=u;var O=0;"middle"===o?O=-x/2-P/2:"bottom"===o||"alphabetic"===o||"ideographic"===o?O=-x:"top"!==o&&"hanging"!==o||(O=-P);for(var C=0;C<M.length;C++){var E=r/2;O+=P,!b(l)&&r&&this.drawLetterSpacing(t,M[C],E+s,O+s,f,p,v,m,!0),b(d)||this.drawLetterSpacing(t,M[C],E+s,O+s,f,p,v,m)}},t.prototype.drawLetterSpacing=function(t,n,e,r,o,a,i,u,c){if(void 0===c&&(c=!1),0!==o)for(var s=e,h=Array.from(n),f=t.measureText(n).width,l=0,d=0;d<h.length;++d){var p=h[d];c?this.strokeText(t,p,s,r,i):this.fillText(t,p,s,r,a,u),s+=f-(l=t.measureText(n.substring(d+1)).width)+o,f=l}else c?this.strokeText(t,n,e,r,i):this.fillText(t,n,e,r,a,u)},t.prototype.fillText=function(t,n,e,r,o,a){var i=!b(o)&&1!==o;i&&(t.globalAlpha=o),t.fillText(n,e,r),i&&(t.globalAlpha=a)},t.prototype.strokeText=function(t,n,e,r,o){!b(o)&&1!==o&&(t.globalAlpha=o),t.strokeText(n,e,r)},p([Object(u.inject)(i.TextService),v("design:type",i.TextService)],t.prototype,"textService",void 0),t=p([Object(u.singleton)({token:{token:f,named:i.SHAPE.Text}})],t)}(),k=function(){function t(){this.gradientCache={}}return t.prototype.getOrCreateGradient=function(t,n){var e=this.generateCacheKey(t),r=t.type,o=t.x0,a=t.y0,u=t.x1,c=t.y1,s=t.steps,h=t.width,f=t.height;if(this.gradientCache[e])return this.gradientCache[e];var l=null;if(r===i.PARSED_COLOR_TYPE.LinearGradient)l=n.createLinearGradient(o*h,a*f,u*h,c*f);else if(r===i.PARSED_COLOR_TYPE.RadialGradient){var d=Math.sqrt(h*h+f*f)/2;l=n.createRadialGradient(o*h,a*f,0,u*h,c*f,t.r1*d)}return l&&(s.forEach((function(t){var n=m(t,2),e=n[0],r=n[1];null==l||l.addColorStop(Number(e),r)})),this.gradientCache[e]=l),this.gradientCache[e]},t.prototype.generateCacheKey=function(t){var n=t.type,e=t.x0,r=t.y0,o=t.x1,a=t.y1,i=t.r1,u=t.steps;return"gradient-"+n+"-"+e+"-"+r+"-"+o+"-"+a+"-"+(i||0)+"-"+t.width+"-"+t.height+"-"+u.map((function(t){return t.join("")})).join("-")},t=p([Object(u.singleton)()],t)}();var _="PathGeneratorFactory",Y="PathGenerator",D=1e-6,X="undefined"!=typeof Float32Array?Float32Array:Array,I=Math.random;Math.PI;function q(){var t=new X(16);return X!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function N(t){var n=new X(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function L(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function G(t,n,e,r,o,a,i,u,c,s,h,f,l,d,p,v){var m=new X(16);return m[0]=t,m[1]=n,m[2]=e,m[3]=r,m[4]=o,m[5]=a,m[6]=i,m[7]=u,m[8]=c,m[9]=s,m[10]=h,m[11]=f,m[12]=l,m[13]=d,m[14]=p,m[15]=v,m}function F(t,n,e,r,o,a,i,u,c,s,h,f,l,d,p,v,m){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t[4]=a,t[5]=i,t[6]=u,t[7]=c,t[8]=s,t[9]=h,t[10]=f,t[11]=l,t[12]=d,t[13]=p,t[14]=v,t[15]=m,t}function H(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function V(t,n){if(t===n){var e=n[1],r=n[2],o=n[3],a=n[6],i=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=a,t[11]=n[14],t[12]=o,t[13]=i,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t}function U(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],c=n[6],s=n[7],h=n[8],f=n[9],l=n[10],d=n[11],p=n[12],v=n[13],m=n[14],g=n[15],y=e*u-r*i,M=e*c-o*i,b=e*s-a*i,x=r*c-o*u,P=r*s-a*u,O=o*s-a*c,C=h*v-f*p,E=h*m-l*p,S=h*g-d*p,A=f*m-l*v,j=f*g-d*v,R=l*g-d*m,B=y*R-M*j+b*A+x*S-P*E+O*C;return B?(B=1/B,t[0]=(u*R-c*j+s*A)*B,t[1]=(o*j-r*R-a*A)*B,t[2]=(v*O-m*P+g*x)*B,t[3]=(l*P-f*O-d*x)*B,t[4]=(c*S-i*R-s*E)*B,t[5]=(e*R-o*S+a*E)*B,t[6]=(m*b-p*O-g*M)*B,t[7]=(h*O-l*b+d*M)*B,t[8]=(i*j-u*S+s*C)*B,t[9]=(r*S-e*j-a*C)*B,t[10]=(p*P-v*b+g*y)*B,t[11]=(f*b-h*P-d*y)*B,t[12]=(u*E-i*A-c*C)*B,t[13]=(e*A-r*E+o*C)*B,t[14]=(v*M-p*x-m*y)*B,t[15]=(h*x-f*M+l*y)*B,t):null}function Z(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],c=n[6],s=n[7],h=n[8],f=n[9],l=n[10],d=n[11],p=n[12],v=n[13],m=n[14],g=n[15];return t[0]=u*(l*g-d*m)-f*(c*g-s*m)+v*(c*d-s*l),t[1]=-(r*(l*g-d*m)-f*(o*g-a*m)+v*(o*d-a*l)),t[2]=r*(c*g-s*m)-u*(o*g-a*m)+v*(o*s-a*c),t[3]=-(r*(c*d-s*l)-u*(o*d-a*l)+f*(o*s-a*c)),t[4]=-(i*(l*g-d*m)-h*(c*g-s*m)+p*(c*d-s*l)),t[5]=e*(l*g-d*m)-h*(o*g-a*m)+p*(o*d-a*l),t[6]=-(e*(c*g-s*m)-i*(o*g-a*m)+p*(o*s-a*c)),t[7]=e*(c*d-s*l)-i*(o*d-a*l)+h*(o*s-a*c),t[8]=i*(f*g-d*v)-h*(u*g-s*v)+p*(u*d-s*f),t[9]=-(e*(f*g-d*v)-h*(r*g-a*v)+p*(r*d-a*f)),t[10]=e*(u*g-s*v)-i*(r*g-a*v)+p*(r*s-a*u),t[11]=-(e*(u*d-s*f)-i*(r*d-a*f)+h*(r*s-a*u)),t[12]=-(i*(f*m-l*v)-h*(u*m-c*v)+p*(u*l-c*f)),t[13]=e*(f*m-l*v)-h*(r*m-o*v)+p*(r*l-o*f),t[14]=-(e*(u*m-c*v)-i*(r*m-o*v)+p*(r*c-o*u)),t[15]=e*(u*l-c*f)-i*(r*l-o*f)+h*(r*c-o*u),t}function z(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],c=t[7],s=t[8],h=t[9],f=t[10],l=t[11],d=t[12],p=t[13],v=t[14],m=t[15];return(n*i-e*a)*(f*m-l*v)-(n*u-r*a)*(h*m-l*p)+(n*c-o*a)*(h*v-f*p)+(e*u-r*i)*(s*m-l*d)-(e*c-o*i)*(s*v-f*d)+(r*c-o*u)*(s*p-h*d)}function Q(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],c=n[5],s=n[6],h=n[7],f=n[8],l=n[9],d=n[10],p=n[11],v=n[12],m=n[13],g=n[14],y=n[15],M=e[0],b=e[1],x=e[2],P=e[3];return t[0]=M*r+b*u+x*f+P*v,t[1]=M*o+b*c+x*l+P*m,t[2]=M*a+b*s+x*d+P*g,t[3]=M*i+b*h+x*p+P*y,M=e[4],b=e[5],x=e[6],P=e[7],t[4]=M*r+b*u+x*f+P*v,t[5]=M*o+b*c+x*l+P*m,t[6]=M*a+b*s+x*d+P*g,t[7]=M*i+b*h+x*p+P*y,M=e[8],b=e[9],x=e[10],P=e[11],t[8]=M*r+b*u+x*f+P*v,t[9]=M*o+b*c+x*l+P*m,t[10]=M*a+b*s+x*d+P*g,t[11]=M*i+b*h+x*p+P*y,M=e[12],b=e[13],x=e[14],P=e[15],t[12]=M*r+b*u+x*f+P*v,t[13]=M*o+b*c+x*l+P*m,t[14]=M*a+b*s+x*d+P*g,t[15]=M*i+b*h+x*p+P*y,t}function W(t,n,e){var r,o,a,i,u,c,s,h,f,l,d,p,v=e[0],m=e[1],g=e[2];return n===t?(t[12]=n[0]*v+n[4]*m+n[8]*g+n[12],t[13]=n[1]*v+n[5]*m+n[9]*g+n[13],t[14]=n[2]*v+n[6]*m+n[10]*g+n[14],t[15]=n[3]*v+n[7]*m+n[11]*g+n[15]):(r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],c=n[5],s=n[6],h=n[7],f=n[8],l=n[9],d=n[10],p=n[11],t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=c,t[6]=s,t[7]=h,t[8]=f,t[9]=l,t[10]=d,t[11]=p,t[12]=r*v+u*m+f*g+n[12],t[13]=o*v+c*m+l*g+n[13],t[14]=a*v+s*m+d*g+n[14],t[15]=i*v+h*m+p*g+n[15]),t}function J(t,n,e){var r=e[0],o=e[1],a=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7]*o,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=n[11]*a,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function K(t,n,e,r){var o,a,i,u,c,s,h,f,l,d,p,v,m,g,y,M,b,x,P,O,C,E,S,A,j=r[0],R=r[1],B=r[2],w=Math.hypot(j,R,B);return w<D?null:(j*=w=1/w,R*=w,B*=w,o=Math.sin(e),i=1-(a=Math.cos(e)),u=n[0],c=n[1],s=n[2],h=n[3],f=n[4],l=n[5],d=n[6],p=n[7],v=n[8],m=n[9],g=n[10],y=n[11],M=j*j*i+a,b=R*j*i+B*o,x=B*j*i-R*o,P=j*R*i-B*o,O=R*R*i+a,C=B*R*i+j*o,E=j*B*i+R*o,S=R*B*i-j*o,A=B*B*i+a,t[0]=u*M+f*b+v*x,t[1]=c*M+l*b+m*x,t[2]=s*M+d*b+g*x,t[3]=h*M+p*b+y*x,t[4]=u*P+f*O+v*C,t[5]=c*P+l*O+m*C,t[6]=s*P+d*O+g*C,t[7]=h*P+p*O+y*C,t[8]=u*E+f*S+v*A,t[9]=c*E+l*S+m*A,t[10]=s*E+d*S+g*A,t[11]=h*E+p*S+y*A,n!==t&&(t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t)}function $(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[4],i=n[5],u=n[6],c=n[7],s=n[8],h=n[9],f=n[10],l=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=a*o+s*r,t[5]=i*o+h*r,t[6]=u*o+f*r,t[7]=c*o+l*r,t[8]=s*o-a*r,t[9]=h*o-i*r,t[10]=f*o-u*r,t[11]=l*o-c*r,t}function tt(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],c=n[3],s=n[8],h=n[9],f=n[10],l=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o-s*r,t[1]=i*o-h*r,t[2]=u*o-f*r,t[3]=c*o-l*r,t[8]=a*r+s*o,t[9]=i*r+h*o,t[10]=u*r+f*o,t[11]=c*r+l*o,t}function nt(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],c=n[3],s=n[4],h=n[5],f=n[6],l=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o+s*r,t[1]=i*o+h*r,t[2]=u*o+f*r,t[3]=c*o+l*r,t[4]=s*o-a*r,t[5]=h*o-i*r,t[6]=f*o-u*r,t[7]=l*o-c*r,t}function et(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function rt(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=n[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ot(t,n,e){var r,o,a,i=e[0],u=e[1],c=e[2],s=Math.hypot(i,u,c);return s<D?null:(i*=s=1/s,u*=s,c*=s,r=Math.sin(n),a=1-(o=Math.cos(n)),t[0]=i*i*a+o,t[1]=u*i*a+c*r,t[2]=c*i*a-u*r,t[3]=0,t[4]=i*u*a-c*r,t[5]=u*u*a+o,t[6]=c*u*a+i*r,t[7]=0,t[8]=i*c*a+u*r,t[9]=u*c*a-i*r,t[10]=c*c*a+o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function at(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=e,t[7]=0,t[8]=0,t[9]=-e,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function it(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=0,t[2]=-e,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=e,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ut(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=e,t[2]=0,t[3]=0,t[4]=-e,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ct(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=r+r,c=o+o,s=a+a,h=r*u,f=r*c,l=r*s,d=o*c,p=o*s,v=a*s,m=i*u,g=i*c,y=i*s;return t[0]=1-(d+v),t[1]=f+y,t[2]=l-g,t[3]=0,t[4]=f-y,t[5]=1-(h+v),t[6]=p+m,t[7]=0,t[8]=l+g,t[9]=p-m,t[10]=1-(h+d),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function st(t,n){var e=new X(3),r=-n[0],o=-n[1],a=-n[2],i=n[3],u=n[4],c=n[5],s=n[6],h=n[7],f=r*r+o*o+a*a+i*i;return f>0?(e[0]=2*(u*i+h*r+c*a-s*o)/f,e[1]=2*(c*i+h*o+s*r-u*a)/f,e[2]=2*(s*i+h*a+u*o-c*r)/f):(e[0]=2*(u*i+h*r+c*a-s*o),e[1]=2*(c*i+h*o+s*r-u*a),e[2]=2*(s*i+h*a+u*o-c*r)),ct(t,n,e),t}function ht(t,n){return t[0]=n[12],t[1]=n[13],t[2]=n[14],t}function ft(t,n){var e=n[0],r=n[1],o=n[2],a=n[4],i=n[5],u=n[6],c=n[8],s=n[9],h=n[10];return t[0]=Math.hypot(e,r,o),t[1]=Math.hypot(a,i,u),t[2]=Math.hypot(c,s,h),t}function lt(t,n){var e=new X(3);ft(e,n);var r=1/e[0],o=1/e[1],a=1/e[2],i=n[0]*r,u=n[1]*o,c=n[2]*a,s=n[4]*r,h=n[5]*o,f=n[6]*a,l=n[8]*r,d=n[9]*o,p=n[10]*a,v=i+h+p,m=0;return v>0?(m=2*Math.sqrt(v+1),t[3]=.25*m,t[0]=(f-d)/m,t[1]=(l-c)/m,t[2]=(u-s)/m):i>h&&i>p?(m=2*Math.sqrt(1+i-h-p),t[3]=(f-d)/m,t[0]=.25*m,t[1]=(u+s)/m,t[2]=(l+c)/m):h>p?(m=2*Math.sqrt(1+h-i-p),t[3]=(l-c)/m,t[0]=(u+s)/m,t[1]=.25*m,t[2]=(f+d)/m):(m=2*Math.sqrt(1+p-i-h),t[3]=(u-s)/m,t[0]=(l+c)/m,t[1]=(f+d)/m,t[2]=.25*m),t}function dt(t,n,e,r){var o=n[0],a=n[1],i=n[2],u=n[3],c=o+o,s=a+a,h=i+i,f=o*c,l=o*s,d=o*h,p=a*s,v=a*h,m=i*h,g=u*c,y=u*s,M=u*h,b=r[0],x=r[1],P=r[2];return t[0]=(1-(p+m))*b,t[1]=(l+M)*b,t[2]=(d-y)*b,t[3]=0,t[4]=(l-M)*x,t[5]=(1-(f+m))*x,t[6]=(v+g)*x,t[7]=0,t[8]=(d+y)*P,t[9]=(v-g)*P,t[10]=(1-(f+p))*P,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function pt(t,n,e,r,o){var a=n[0],i=n[1],u=n[2],c=n[3],s=a+a,h=i+i,f=u+u,l=a*s,d=a*h,p=a*f,v=i*h,m=i*f,g=u*f,y=c*s,M=c*h,b=c*f,x=r[0],P=r[1],O=r[2],C=o[0],E=o[1],S=o[2],A=(1-(v+g))*x,j=(d+b)*x,R=(p-M)*x,B=(d-b)*P,w=(1-(l+g))*P,T=(m+y)*P,k=(p+M)*O,_=(m-y)*O,Y=(1-(l+v))*O;return t[0]=A,t[1]=j,t[2]=R,t[3]=0,t[4]=B,t[5]=w,t[6]=T,t[7]=0,t[8]=k,t[9]=_,t[10]=Y,t[11]=0,t[12]=e[0]+C-(A*C+B*E+k*S),t[13]=e[1]+E-(j*C+w*E+_*S),t[14]=e[2]+S-(R*C+T*E+Y*S),t[15]=1,t}function vt(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,c=o+o,s=e*i,h=r*i,f=r*u,l=o*i,d=o*u,p=o*c,v=a*i,m=a*u,g=a*c;return t[0]=1-f-p,t[1]=h+g,t[2]=l-m,t[3]=0,t[4]=h-g,t[5]=1-s-p,t[6]=d+v,t[7]=0,t[8]=l+m,t[9]=d-v,t[10]=1-s-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function mt(t,n,e,r,o,a,i){var u=1/(e-n),c=1/(o-r),s=1/(a-i);return t[0]=2*a*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*c,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(o+r)*c,t[10]=(i+a)*s,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*a*2*s,t[15]=0,t}function gt(t,n,e,r,o){var a,i=1/Math.tan(n/2);return t[0]=i/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(a=1/(r-o),t[10]=(o+r)*a,t[14]=2*o*r*a):(t[10]=-1,t[14]=-2*r),t}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});var yt=gt;function Mt(t,n,e,r,o){var a,i=1/Math.tan(n/2);return t[0]=i/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(a=1/(r-o),t[10]=o*a,t[14]=o*r*a):(t[10]=-1,t[14]=-r),t}function bt(t,n,e,r){var o=Math.tan(n.upDegrees*Math.PI/180),a=Math.tan(n.downDegrees*Math.PI/180),i=Math.tan(n.leftDegrees*Math.PI/180),u=Math.tan(n.rightDegrees*Math.PI/180),c=2/(i+u),s=2/(o+a);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=-(i-u)*c*.5,t[9]=(o-a)*s*.5,t[10]=r/(e-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*e/(e-r),t[15]=0,t}function xt(t,n,e,r,o,a,i){var u=1/(n-e),c=1/(r-o),s=1/(a-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*s,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*c,t[14]=(i+a)*s,t[15]=1,t}var Pt=xt;function Ot(t,n,e,r,o,a,i){var u=1/(n-e),c=1/(r-o),s=1/(a-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=s,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*c,t[14]=a*s,t[15]=1,t}function Ct(t,n,e,r){var o,a,i,u,c,s,h,f,l,d,p=n[0],v=n[1],m=n[2],g=r[0],y=r[1],M=r[2],b=e[0],x=e[1],P=e[2];return Math.abs(p-b)<D&&Math.abs(v-x)<D&&Math.abs(m-P)<D?H(t):(h=p-b,f=v-x,l=m-P,o=y*(l*=d=1/Math.hypot(h,f,l))-M*(f*=d),a=M*(h*=d)-g*l,i=g*f-y*h,(d=Math.hypot(o,a,i))?(o*=d=1/d,a*=d,i*=d):(o=0,a=0,i=0),u=f*i-l*a,c=l*o-h*i,s=h*a-f*o,(d=Math.hypot(u,c,s))?(u*=d=1/d,c*=d,s*=d):(u=0,c=0,s=0),t[0]=o,t[1]=u,t[2]=h,t[3]=0,t[4]=a,t[5]=c,t[6]=f,t[7]=0,t[8]=i,t[9]=s,t[10]=l,t[11]=0,t[12]=-(o*p+a*v+i*m),t[13]=-(u*p+c*v+s*m),t[14]=-(h*p+f*v+l*m),t[15]=1,t)}function Et(t,n,e,r){var o=n[0],a=n[1],i=n[2],u=r[0],c=r[1],s=r[2],h=o-e[0],f=a-e[1],l=i-e[2],d=h*h+f*f+l*l;d>0&&(h*=d=1/Math.sqrt(d),f*=d,l*=d);var p=c*l-s*f,v=s*h-u*l,m=u*f-c*h;return(d=p*p+v*v+m*m)>0&&(p*=d=1/Math.sqrt(d),v*=d,m*=d),t[0]=p,t[1]=v,t[2]=m,t[3]=0,t[4]=f*m-l*v,t[5]=l*p-h*m,t[6]=h*v-f*p,t[7]=0,t[8]=h,t[9]=f,t[10]=l,t[11]=0,t[12]=o,t[13]=a,t[14]=i,t[15]=1,t}function St(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function At(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function jt(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t[9]=n[9]+e[9],t[10]=n[10]+e[10],t[11]=n[11]+e[11],t[12]=n[12]+e[12],t[13]=n[13]+e[13],t[14]=n[14]+e[14],t[15]=n[15]+e[15],t}function Rt(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t[9]=n[9]-e[9],t[10]=n[10]-e[10],t[11]=n[11]-e[11],t[12]=n[12]-e[12],t[13]=n[13]-e[13],t[14]=n[14]-e[14],t[15]=n[15]-e[15],t}function Bt(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,t[11]=n[11]*e,t[12]=n[12]*e,t[13]=n[13]*e,t[14]=n[14]*e,t[15]=n[15]*e,t}function wt(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t[4]=n[4]+e[4]*r,t[5]=n[5]+e[5]*r,t[6]=n[6]+e[6]*r,t[7]=n[7]+e[7]*r,t[8]=n[8]+e[8]*r,t[9]=n[9]+e[9]*r,t[10]=n[10]+e[10]*r,t[11]=n[11]+e[11]*r,t[12]=n[12]+e[12]*r,t[13]=n[13]+e[13]*r,t[14]=n[14]+e[14]*r,t[15]=n[15]+e[15]*r,t}function Tt(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]&&t[9]===n[9]&&t[10]===n[10]&&t[11]===n[11]&&t[12]===n[12]&&t[13]===n[13]&&t[14]===n[14]&&t[15]===n[15]}function kt(t,n){var e=t[0],r=t[1],o=t[2],a=t[3],i=t[4],u=t[5],c=t[6],s=t[7],h=t[8],f=t[9],l=t[10],d=t[11],p=t[12],v=t[13],m=t[14],g=t[15],y=n[0],M=n[1],b=n[2],x=n[3],P=n[4],O=n[5],C=n[6],E=n[7],S=n[8],A=n[9],j=n[10],R=n[11],B=n[12],w=n[13],T=n[14],k=n[15];return Math.abs(e-y)<=D*Math.max(1,Math.abs(e),Math.abs(y))&&Math.abs(r-M)<=D*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(o-b)<=D*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(a-x)<=D*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(i-P)<=D*Math.max(1,Math.abs(i),Math.abs(P))&&Math.abs(u-O)<=D*Math.max(1,Math.abs(u),Math.abs(O))&&Math.abs(c-C)<=D*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(s-E)<=D*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(h-S)<=D*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(f-A)<=D*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(l-j)<=D*Math.max(1,Math.abs(l),Math.abs(j))&&Math.abs(d-R)<=D*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-B)<=D*Math.max(1,Math.abs(p),Math.abs(B))&&Math.abs(v-w)<=D*Math.max(1,Math.abs(v),Math.abs(w))&&Math.abs(m-T)<=D*Math.max(1,Math.abs(m),Math.abs(T))&&Math.abs(g-k)<=D*Math.max(1,Math.abs(g),Math.abs(k))}var _t=Q,Yt=Rt;function Dt(){var t=new X(3);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Xt(t){var n=new X(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n}function It(t){var n=t[0],e=t[1],r=t[2];return Math.hypot(n,e,r)}function qt(t,n,e){var r=new X(3);return r[0]=t,r[1]=n,r[2]=e,r}function Nt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function Lt(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function Gt(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function Ft(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}function Ht(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t}function Vt(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t}function Ut(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t}function Zt(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t}function zt(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t}function Qt(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t}function Wt(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t}function Jt(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}function Kt(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t}function $t(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.hypot(e,r,o)}function tn(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o}function nn(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r}function en(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t}function rn(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t}function on(t,n){var e=n[0],r=n[1],o=n[2],a=e*e+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a,t}function an(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function un(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],c=e[2];return t[0]=o*c-a*u,t[1]=a*i-r*c,t[2]=r*u-o*i,t}function cn(t,n,e,r){var o=n[0],a=n[1],i=n[2];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t}function sn(t,n,e,r,o,a){var i=a*a,u=i*(2*a-3)+1,c=i*(a-2)+a,s=i*(a-1),h=i*(3-2*a);return t[0]=n[0]*u+e[0]*c+r[0]*s+o[0]*h,t[1]=n[1]*u+e[1]*c+r[1]*s+o[1]*h,t[2]=n[2]*u+e[2]*c+r[2]*s+o[2]*h,t}function hn(t,n,e,r,o,a){var i=1-a,u=i*i,c=a*a,s=u*i,h=3*a*u,f=3*c*i,l=c*a;return t[0]=n[0]*s+e[0]*h+r[0]*f+o[0]*l,t[1]=n[1]*s+e[1]*h+r[1]*f+o[1]*l,t[2]=n[2]*s+e[2]*h+r[2]*f+o[2]*l,t}function fn(t,n){n=n||1;var e=2*I()*Math.PI,r=2*I()-1,o=Math.sqrt(1-r*r)*n;return t[0]=Math.cos(e)*o,t[1]=Math.sin(e)*o,t[2]=r*n,t}function ln(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[3]*r+e[7]*o+e[11]*a+e[15];return i=i||1,t[0]=(e[0]*r+e[4]*o+e[8]*a+e[12])/i,t[1]=(e[1]*r+e[5]*o+e[9]*a+e[13])/i,t[2]=(e[2]*r+e[6]*o+e[10]*a+e[14])/i,t}function dn(t,n,e){var r=n[0],o=n[1],a=n[2];return t[0]=r*e[0]+o*e[3]+a*e[6],t[1]=r*e[1]+o*e[4]+a*e[7],t[2]=r*e[2]+o*e[5]+a*e[8],t}function pn(t,n,e){var r=e[0],o=e[1],a=e[2],i=e[3],u=n[0],c=n[1],s=n[2],h=o*s-a*c,f=a*u-r*s,l=r*c-o*u,d=o*l-a*f,p=a*h-r*l,v=r*f-o*h,m=2*i;return h*=m,f*=m,l*=m,d*=2,p*=2,v*=2,t[0]=u+h+d,t[1]=c+f+p,t[2]=s+l+v,t}function vn(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0],a[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),a[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t}function mn(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),a[1]=o[1],a[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t}function gn(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),a[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),a[2]=o[2],t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t}function yn(t,n){var e=t[0],r=t[1],o=t[2],a=n[0],i=n[1],u=n[2],c=Math.sqrt(e*e+r*r+o*o)*Math.sqrt(a*a+i*i+u*u),s=c&&an(t,n)/c;return Math.acos(Math.min(Math.max(s,-1),1))}function Mn(t){return t[0]=0,t[1]=0,t[2]=0,t}function bn(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function xn(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]}function Pn(t,n){var e=t[0],r=t[1],o=t[2],a=n[0],i=n[1],u=n[2];return Math.abs(e-a)<=D*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(r-i)<=D*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(o-u)<=D*Math.max(1,Math.abs(o),Math.abs(u))}var On,Cn=Ft,En=Ht,Sn=Vt,An=$t,jn=tn,Rn=It,Bn=nn,wn=(On=Dt(),function(t,n,e,r,o,a){var i,u;for(n||(n=3),e||(e=0),u=r?Math.min(r*n+e,t.length):t.length,i=e;i<u;i+=n)On[0]=t[i],On[1]=t[i+1],On[2]=t[i+2],o(On,On,a),t[i]=On[0],t[i+1]=On[1],t[i+2]=On[2];return t});function Tn(t){var n=t[0],e=t[1],r=t[2],o=t[3];return Math.hypot(n,e,r,o)}function kn(t){var n=t[0],e=t[1],r=t[2],o=t[3];return n*n+e*e+r*r+o*o}!function(){var t,n=(t=new X(4),X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function _n(){var t=new X(4);return X!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Yn(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Dn(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t}function Xn(t,n){var e=2*Math.acos(n[3]),r=Math.sin(e/2);return r>D?(t[0]=n[0]/r,t[1]=n[1]/r,t[2]=n[2]/r):(t[0]=1,t[1]=0,t[2]=0),e}function In(t,n){var e=pe(t,n);return Math.acos(2*e*e-1)}function qn(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],c=e[1],s=e[2],h=e[3];return t[0]=r*h+i*u+o*s-a*c,t[1]=o*h+i*c+a*u-r*s,t[2]=a*h+i*s+r*c-o*u,t[3]=i*h-r*u-o*c-a*s,t}function Nn(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+i*u,t[1]=o*c+a*u,t[2]=a*c-o*u,t[3]=i*c-r*u,t}function Ln(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c-a*u,t[1]=o*c+i*u,t[2]=a*c+r*u,t[3]=i*c-o*u,t}function Gn(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+o*u,t[1]=o*c-r*u,t[2]=a*c+i*u,t[3]=i*c-a*u,t}function Fn(t,n){var e=n[0],r=n[1],o=n[2];return t[0]=e,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-o*o)),t}function Hn(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=Math.sqrt(e*e+r*r+o*o),u=Math.exp(a),c=i>0?u*Math.sin(i)/i:0;return t[0]=e*c,t[1]=r*c,t[2]=o*c,t[3]=u*Math.cos(i),t}function Vn(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=Math.sqrt(e*e+r*r+o*o),u=i>0?Math.atan2(i,a)/i:0;return t[0]=e*u,t[1]=r*u,t[2]=o*u,t[3]=.5*Math.log(e*e+r*r+o*o+a*a),t}function Un(t,n,e){return Vn(t,n),de(t,t,e),Hn(t,t),t}function Zn(t,n,e,r){var o,a,i,u,c,s=n[0],h=n[1],f=n[2],l=n[3],d=e[0],p=e[1],v=e[2],m=e[3];return(a=s*d+h*p+f*v+l*m)<0&&(a=-a,d=-d,p=-p,v=-v,m=-m),1-a>D?(o=Math.acos(a),i=Math.sin(o),u=Math.sin((1-r)*o)/i,c=Math.sin(r*o)/i):(u=1-r,c=r),t[0]=u*s+c*d,t[1]=u*h+c*p,t[2]=u*f+c*v,t[3]=u*l+c*m,t}function zn(t){var n=I(),e=I(),r=I(),o=Math.sqrt(1-n),a=Math.sqrt(n);return t[0]=o*Math.sin(2*Math.PI*e),t[1]=o*Math.cos(2*Math.PI*e),t[2]=a*Math.sin(2*Math.PI*r),t[3]=a*Math.cos(2*Math.PI*r),t}function Qn(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a,u=i?1/i:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-o*u,t[3]=a*u,t}function Wn(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t}function Jn(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var o=0;n[4]>n[0]&&(o=1),n[8]>n[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;e=Math.sqrt(n[3*o+o]-n[3*a+a]-n[3*i+i]+1),t[o]=.5*e,e=.5/e,t[3]=(n[3*a+i]-n[3*i+a])*e,t[a]=(n[3*a+o]+n[3*o+a])*e,t[i]=(n[3*i+o]+n[3*o+i])*e}return t}function Kn(t,n,e,r){var o=.5*Math.PI/180;n*=o,e*=o,r*=o;var a=Math.sin(n),i=Math.cos(n),u=Math.sin(e),c=Math.cos(e),s=Math.sin(r),h=Math.cos(r);return t[0]=a*c*h-i*u*s,t[1]=i*u*h+a*c*s,t[2]=i*c*s-a*u*h,t[3]=i*c*h+a*u*s,t}function $n(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var te,ne,ee,re,oe,ae,ie,ue=function(t){var n=new X(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},ce=function(t,n,e,r){var o=new X(4);return o[0]=t,o[1]=n,o[2]=e,o[3]=r,o},se=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},he=function(t,n,e,r,o){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t},fe=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},le=qn,de=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},pe=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},ve=function(t,n,e,r){var o=n[0],a=n[1],i=n[2],u=n[3];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t[3]=u+r*(e[3]-u),t},me=Tn,ge=me,ye=kn,Me=ye,be=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i)),t[0]=e*i,t[1]=r*i,t[2]=o*i,t[3]=a*i,t},xe=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},Pe=function(t,n){var e=t[0],r=t[1],o=t[2],a=t[3],i=n[0],u=n[1],c=n[2],s=n[3];return Math.abs(e-i)<=D*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(r-u)<=D*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(o-c)<=D*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(a-s)<=D*Math.max(1,Math.abs(a),Math.abs(s))},Oe=(te=Dt(),ne=qt(1,0,0),ee=qt(0,1,0),function(t,n,e){var r=an(n,e);return r<-.999999?(un(te,ne,n),Rn(te)<1e-6&&un(te,ee,n),on(te,te),Dn(t,te,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(un(te,n,e),t[0]=te[0],t[1]=te[1],t[2]=te[2],t[3]=1+r,be(t,t))}),Ce=(re=_n(),oe=_n(),function(t,n,e,r,o,a){return Zn(re,n,o,a),Zn(oe,e,r,a),Zn(t,re,oe,2*a*(1-a)),t}),Ee=(ae=new X(9),X!=Float32Array&&(ae[1]=0,ae[2]=0,ae[3]=0,ae[5]=0,ae[6]=0,ae[7]=0),ae[0]=1,ae[4]=1,ae[8]=1,ie=ae,function(t,n,e,r){return ie[0]=e[0],ie[3]=e[1],ie[6]=e[2],ie[1]=r[0],ie[4]=r[1],ie[7]=r[2],ie[2]=-n[0],ie[5]=-n[1],ie[8]=-n[2],be(t,Jn(t,ie))}),Se=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}l(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.tag="c-canvas-rbush-node",n}(i.Component),Ae="RBushRoot",je={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"},Re=function(){function t(){this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(t){t.target.entity.addComponent(Se),a(t)},o=function(t){var n=t.target,r=n.entity.getComponent(Se);e.rBush.remove(r.aabb),n.entity.removeComponent(Se)},a=function(t){var n;(null===(n=t.target.ownerDocument)||void 0===n?void 0:n.documentElement)===e.renderingContext.root&&t.composedPath().slice(0,-2).forEach((function(t){e.insertRBushNode(t)}))};t.hooks.init.tap(n.tag,(function(){var t=e.contextService.getContext(),n=e.contextService.getDPR();t&&t.scale(n,n),e.renderingContext.root.addEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(i.ElementEvent.UNMOUNTED,o),e.renderingContext.root.addEventListener(i.ElementEvent.BOUNDS_CHANGED,a)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(i.ElementEvent.UNMOUNTED,o),e.renderingContext.root.removeEventListener(i.ElementEvent.BOUNDS_CHANGED,a)})),t.hooks.beginFrame.tap(n.tag,(function(){var t=e.contextService.getContext(),n=e.canvasConfig.renderer.getConfig(),r=n.enableDirtyRectangleRendering;n.enableDirtyRectangleRenderingDebug;e.clearFullScreen=!r||e.renderingContext.renderReasons.has(i.RENDER_REASON.CameraChanged),t&&(t.save(),e.clearFullScreen&&t.clearRect(0,0,e.canvasConfig.width,e.canvasConfig.height),e.applyTransform(t,e.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(n.tag,(function(){var n=e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering,r=e.contextService.getContext();if(n){var o=e.safeMergeAABB.apply(e,function(t,n,e){if(e||2===arguments.length)for(var r,o=0,a=n.length;o<a;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}([e.mergeDirtyAABBs(e.renderQueue)],m(e.renderingContext.removedRenderBoundsList),!1));if(e.renderingContext.removedRenderBoundsList=[],!o)return;var a=e.convertAABB2Rect(o),i=a.x,u=a.y,c=a.width,s=a.height;r.clearRect(i,u,c,s),r.beginPath(),r.rect(i,u,c,s),r.clip(),e.searchDirtyObjects(o).sort(e.sceneGraphService.sort).forEach((function(n){n.isVisible()&&e.renderDisplayObject(n,t)})),e.renderQueue.forEach((function(t){e.saveDirtyAABB(t)})),e.renderQueue=[]}e.restoreStack.forEach((function(t){r.restore()})),e.restoreStack=[],r.restore()})),t.hooks.render.tap(n.tag,(function(n){e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering?e.renderQueue.push(n):e.renderDisplayObject(n,t)}))},t.prototype.renderDisplayObject=function(t,n){for(var e=this,r=this.contextService.getContext(),o=this.restoreStack[this.restoreStack.length-1];o&&t.parentNode!==o;)r.restore(),this.restoreStack.pop(),o=this.restoreStack[this.restoreStack.length-1];var a=t.nodeName;r.save(),this.applyTransform(r,t.getLocalTransform());var u=t.style.clipPath;if(u){r.save(),this.applyTransform(r,u.getLocalTransform());var c=this.pathGeneratorFactory(u.nodeName);c&&this.useAnchor(r,u,(function(){c(r,u.parsedStyle)})),r.restore(),r.clip()}r.save(),this.applyAttributesToContext(r,t,n),this.useAnchor(r,t,(function(){var n=e.pathGeneratorFactory(t.nodeName);n&&n(r,t.parsedStyle);var o=e.styleRendererFactory(a);o&&o.render(r,t.parsedStyle,t)})),r.restore(),t.entity.getComponent(i.Renderable).dirty=!1,this.restoreStack.push(t)},t.prototype.convertAABB2Rect=function(t){var n=t.getMin(),e=t.getMax(),r=Math.floor(n[0]),o=Math.floor(n[1]);return{x:r,y:o,width:Math.ceil(e[0])-r,height:Math.ceil(e[1])-o}},t.prototype.insertRBushNode=function(t){var n=t.entity.getComponent(Se);if(n){this.rBush.remove(n.aabb);var e=t.getRenderBounds();if(e){var r=m(e.getMin(),2),o=r[0],a=r[1],i=m(e.getMax(),2),u=i[0],c=i[1];n.aabb={name:t.entity.getName(),minX:o,minY:a,maxX:u,maxY:c}}this.rBush.insert(n.aabb)}},t.prototype.mergeDirtyAABBs=function(t){var n;return t.forEach((function(t){var e=t.getRenderBounds();e&&(n?n.add(e):n=new i.AABB(e.center,e.halfExtents));var r=t.entity.getComponent(i.Renderable).dirtyRenderBounds;r&&(n?n.add(r):n=new i.AABB(r.center,r.halfExtents))})),n},t.prototype.searchDirtyObjects=function(t){var n=this,e=m(t.getMin(),2),r=e[0],o=e[1],a=m(t.getMax(),2),i=a[0],u=a[1];return this.rBush.search({minX:r,minY:o,maxX:i,maxY:u}).map((function(t){var e=t.name;return n.displayObjectPool.getByName(e)}))},t.prototype.saveDirtyAABB=function(t){var n=t.entity.getComponent(i.Renderable);n.dirtyRenderBounds||(n.dirtyRenderBounds=new i.AABB);var e=t.getRenderBounds();e&&n.dirtyRenderBounds.update(e.center,e.halfExtents)},t.prototype.drawDirtyRectangle=function(t,n){var e=n.x,r=n.y,o=n.width,a=n.height;t.beginPath(),t.rect(e+1,r+1,o-1,a-1),t.closePath(),t.lineWidth=1,t.stroke()},t.prototype.applyTransform=function(t,n){var e=m(r.getTranslation(o.create(),n),2),u=e[0],c=e[1],s=m(r.getScaling(o.create(),n),2),h=s[0],f=s[1],l=r.getRotation(a.create(),n),d=m(Object(i.getEuler)(o.create(),l),3),p=d[0],v=(d[1],d[2]),g=Object(i.fromRotationTranslationScale)(p||v,u,c,h,f);t.transform(g[0],g[1],g[3],g[4],g[6],g[7])},t.prototype.applyAttributesToContext=function(t,n,e){var r=n.attributes,o=n.parsedStyle;for(var a in r)if("transform"!==a){var u=r[a],c=je[a]?je[a]:a;if("lineDash"===c&&t.setLineDash)x(u)&&t.setLineDash(u);else{if("strokeStyle"===c||"fillStyle"===c){var s=o[a];if(s.type===i.PARSED_COLOR_TYPE.LinearGradient||s.type===i.PARSED_COLOR_TYPE.RadialGradient){var h=n.getGeometryBounds(),f=h&&2*h.halfExtents[0]||0,l=h&&2*h.halfExtents[1]||0;u=this.gradientPool.getOrCreateGradient(d(d({type:s.type},s.value),{width:f,height:l}),t)}else if(s.type===i.PARSED_COLOR_TYPE.Pattern){var p=this.imagePool.getPatternSync(s.value);p?u=p:this.imagePool.createPattern(s.value,t).then((function(){n.entity.getComponent(i.Renderable).dirty=!0,e.dirtify()}))}else u=s.formatted}else"globalAlpha"===c&&(u*=t.globalAlpha);t[c]=u}}},t.prototype.useAnchor=function(t,n,e){var r=n.getGeometryBounds();if(r){var o=r.halfExtents;t.save();var a=(n.parsedStyle||{}).anchor,i=void 0===a?[0,0]:a;t.translate(-i[0]*o[0]*2,-i[1]*o[1]*2),e(),t.restore()}else e()},t.prototype.safeMergeAABB=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.forEach((function(n){n&&(t?t.add(n):t=n)})),t},t.tag="CanvasRendererPlugin",p([Object(u.inject)(i.CanvasConfig),v("design:type",Object)],t.prototype,"canvasConfig",void 0),p([Object(u.inject)(i.DefaultCamera),v("design:type",i.Camera)],t.prototype,"camera",void 0),p([Object(u.inject)(i.ContextService),v("design:type",Object)],t.prototype,"contextService",void 0),p([Object(u.inject)(i.SceneGraphService),v("design:type",Object)],t.prototype,"sceneGraphService",void 0),p([Object(u.inject)(i.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),p([Object(u.inject)(B),v("design:type",B)],t.prototype,"imagePool",void 0),p([Object(u.inject)(k),v("design:type",k)],t.prototype,"gradientPool",void 0),p([Object(u.inject)(_),v("design:type",Function)],t.prototype,"pathGeneratorFactory",void 0),p([Object(u.inject)(h),v("design:type",Function)],t.prototype,"styleRendererFactory",void 0),p([Object(u.inject)(i.DisplayObjectPool),v("design:type",i.DisplayObjectPool)],t.prototype,"displayObjectPool",void 0),p([Object(u.inject)(Ae),v("design:type",s.a)],t.prototype,"rBush",void 0),t=n=p([Object(u.singleton)({contrib:i.RenderingPluginContribution})],t)}(),Be=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(n){var r=n.target,o=r.nodeName,a=r.attributes;if(o===i.SHAPE.Image){var u=a.img;E(u)&&e.imagePool.getOrCreateImage(u).then((function(){r.entity.getComponent(i.Renderable).dirty=!0,t.dirtify()}))}},o=function(n){var r=n.target,o=n.detail,a=o.attributeName,u=o.newValue;r.nodeName===i.SHAPE.Image&&"img"===a&&E(u)&&e.imagePool.getOrCreateImage(u).then((function(){r.entity.getComponent(i.Renderable).dirty=!0,t.dirtify()}))};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(i.ElementEvent.ATTRIBUTE_CHANGED,o)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(i.ElementEvent.ATTRIBUTE_CHANGED,o)}))},t.tag="LoadImagePlugin",p([Object(u.inject)(B),v("design:type",B)],t.prototype,"imagePool",void 0),p([Object(u.inject)(i.RenderingContext),v("design:type",Object)],t.prototype,"renderingContext",void 0),t=n=p([Object(u.singleton)({contrib:i.RenderingPluginContribution})],t)}();i.world.registerComponent(Se),i.globalContainer.register({token:{token:Y,named:i.SHAPE.Circle},useValue:function(t,n){t.beginPath();var e=n.r,r=void 0===e?0:e;t.arc(r,r,r,0,2*Math.PI,!1)}}),i.globalContainer.register({token:{token:Y,named:i.SHAPE.Ellipse},useValue:function(t,n){var e=n.rx,r=n.ry;if(t.beginPath(),t.ellipse)t.ellipse(e,r,e,r,0,0,2*Math.PI,!1);else{var o=e>r?e:r,a=e>r?1:e/r,i=e>r?r/e:1;t.save(),t.scale(a,i),t.arc(0,0,o,0,2*Math.PI),t.closePath(),t.restore()}}}),i.globalContainer.register({token:{token:Y,named:i.SHAPE.Rect},useValue:function(t,n){var e=n.radius,r=void 0===e?0:e,o=n.width,a=void 0===o?0:o,i=n.height,u=void 0===i?0:i;if(t.beginPath(),0===r)t.rect(0,0,a,u);else{var c=m(function(t){var n=0,e=0,r=0,o=0;return x(t)?1===t.length?n=e=r=o=t[0]:2===t.length?(n=r=t[0],e=o=t[1]):3===t.length?(n=t[0],e=o=t[1],r=t[2]):(n=t[0],e=t[1],r=t[2],o=t[3]):n=e=r=o=t,[n,e,r,o]}(r),4),s=c[0],h=c[1],f=c[2],l=c[3];t.moveTo(s,0),t.lineTo(a-h,0),0!==h&&t.arc(a-h,h,h,-Math.PI/2,0),t.lineTo(a,u-f),0!==f&&t.arc(a-f,u-f,f,0,Math.PI/2),t.lineTo(l,u),0!==l&&t.arc(l,u-l,l,Math.PI/2,Math.PI),t.lineTo(0,s),0!==s&&t.arc(s,s,s,Math.PI,1.5*Math.PI),t.closePath()}}}),i.globalContainer.register({token:{token:Y,named:i.SHAPE.Line},useValue:function(t,n){var e=n.x1,r=n.y1,o=n.x2,a=n.y2,i=n.defX,u=void 0===i?0:i,c=n.defY,s=void 0===c?0:c;t.beginPath(),t.moveTo(e-u,r-s),t.lineTo(o-u,a-s)}}),i.globalContainer.register({token:{token:Y,named:i.SHAPE.Polyline},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,a=void 0===o?0:o,i=n.points.points,u=i.length,c=i[0][0]-r,s=i[0][1]-a,h=i[u-1][0]-r,f=i[u-1][1]-a;t.beginPath(),t.moveTo(c,s);for(var l=0;l<u-1;l++){var d=i[l];t.lineTo(d[0]-r,d[1]-a)}t.lineTo(h,f)}}),i.globalContainer.register({token:{token:Y,named:i.SHAPE.Polygon},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,a=void 0===o?0:o,i=n.points.points,u=i.length,c=i[0][0]-r,s=i[0][1]-a,h=i[u-1][0]-r,f=i[u-1][1]-a;t.beginPath(),t.moveTo(c,s);for(var l=0;l<u-1;l++){var d=i[l];t.lineTo(d[0]-r,d[1]-a)}t.lineTo(h,f),t.closePath()}}),i.globalContainer.register({token:{token:Y,named:i.SHAPE.Path},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,o=n.defY,a=void 0===o?0:o,i=n.path,u=i.curve,c=i.zCommandIndexes,s=u;c.forEach((function(t,n){s.splice(t+n,0,["Z"])}));var h=[-r,-a];t.beginPath();for(var f=0;f<s.length;f++){var l=s[f],d=l[0];switch(d){case"M":t.moveTo(l[1]-r,l[2]-a),h=[l[1]-r,l[2]-a];break;case"C":t.bezierCurveTo(l[1]-r,l[2]-a,l[3]-r,l[4]-a,l[5]-r,l[6]-a);break;case"Z":t.closePath()}if("Z"===d)h;else{var p=l.length;[l[p-2]-r,l[p-1]-a]}}}}),i.globalContainer.register({token:_,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(Y,e)&&(n[e]=t.container.getNamed(Y,e)),n[e]}}});var we=Object(u.Module)((function(t){t(B),t({token:Ae,useValue:new s.a}),t(R),t(w),t(T),t({token:h,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(f,e)&&(n[e]=t.container.getNamed(f,e)),n[e]}}}),t(k),t(Re),t(Be)})),Te=function(){function t(){}return t.prototype.init=function(t){t.load(we,!0)},t.prototype.destroy=function(t){t.remove(B),t.remove(Ae),t.remove(R),t.remove(w),t.remove(T),t.remove(f),t.remove(h),t.remove(k),t.remove(Re),t.remove(Be)},t}()}])}));
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@antv/g"),require("mana-syringe")):"function"==typeof define&&define.amd?define(["@antv/g","mana-syringe"],n):"object"==typeof exports?exports.CanvasRenderer=n(require("@antv/g"),require("mana-syringe")):(t.G=t.G||{},t.G.CanvasRenderer=n(t.G,t.G.ManaSyringe))}(window,(function(t,n){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,e),a.l=!0,a.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var a in t)e.d(r,a,function(n){return t[n]}.bind(null,a));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=7)}([function(n,e){n.exports=t},function(t,e){t.exports=n},function(t,n,e){t.exports=function(){"use strict";function t(t,r,a,o,i){!function t(e,r,a,o,i){for(;o>a;){if(o-a>600){var u=o-a+1,c=r-a+1,h=Math.log(u),s=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*s*(u-s)/u)*(c-u/2<0?-1:1);t(e,r,Math.max(a,Math.floor(r-c*s/u+f)),Math.min(o,Math.floor(r+(u-c)*s/u+f)),i)}var l=e[r],d=a,p=o;for(n(e,a,r),i(e[o],l)>0&&n(e,a,o);d<p;){for(n(e,d,p),d++,p--;i(e[d],l)<0;)d++;for(;i(e[p],l)>0;)p--}0===i(e[a],l)?n(e,a,p):n(e,++p,o),p<=r&&(a=p+1),r<=p&&(o=p-1)}}(t,r,a||0,o||t.length-1,i||e)}function n(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function e(t,n){return t<n?-1:t>n?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(t,n,e){if(!e)return n.indexOf(t);for(var r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function o(t,n){i(t,0,t.children.length,n,t)}function i(t,n,e,r,a){a||(a=p(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var o=n;o<e;o++){var i=t.children[o];u(a,t.leaf?r(i):i)}return a}function u(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function c(t,n){return t.minX-n.minX}function h(t,n){return t.minY-n.minY}function s(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function f(t){return t.maxX-t.minX+(t.maxY-t.minY)}function l(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function d(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(n,e,r,a,o){for(var i=[e,r];i.length;)if(!((r=i.pop())-(e=i.pop())<=a)){var u=e+Math.ceil((r-e)/a/2)*a;t(n,u,e,r,o),i.push(e,u,u,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var n=this.data,e=[];if(!d(t,n))return e;for(var r=this.toBBox,a=[];n;){for(var o=0;o<n.children.length;o++){var i=n.children[o],u=n.leaf?r(i):i;d(t,u)&&(n.leaf?e.push(i):l(t,u)?this._all(i,e):a.push(i))}n=a.pop()}return e},r.prototype.collides=function(t){var n=this.data;if(!d(t,n))return!1;for(var e=[];n;){for(var r=0;r<n.children.length;r++){var a=n.children[r],o=n.leaf?this.toBBox(a):a;if(d(t,o)){if(n.leaf||l(t,o))return!0;e.push(a)}}n=e.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var n=0;n<t.length;n++)this.insert(t[n]);return this}var e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){var r=this.data;this.data=e,e=r}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=p([]),this},r.prototype.remove=function(t,n){if(!t)return this;for(var e,r,o,i=this.data,u=this.toBBox(t),c=[],h=[];i||c.length;){if(i||(i=c.pop(),r=c[c.length-1],e=h.pop(),o=!0),i.leaf){var s=a(t,i.children,n);if(-1!==s)return i.children.splice(s,1),c.push(i),this._condense(c),this}o||i.leaf||!l(i,u)?r?(e++,i=r.children[e],o=!1):i=null:(c.push(i),h.push(e),e=0,r=i,i=i.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,n){return t.minX-n.minX},r.prototype.compareMinY=function(t,n){return t.minY-n.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,n){for(var e=[];t;)t.leaf?n.push.apply(n,t.children):e.push.apply(e,t.children),t=e.pop();return n},r.prototype._build=function(t,n,e,r){var a,i=e-n+1,u=this._maxEntries;if(i<=u)return o(a=p(t.slice(n,e+1)),this.toBBox),a;r||(r=Math.ceil(Math.log(i)/Math.log(u)),u=Math.ceil(i/Math.pow(u,r-1))),(a=p([])).leaf=!1,a.height=r;var c=Math.ceil(i/u),h=c*Math.ceil(Math.sqrt(u));v(t,n,e,h,this.compareMinX);for(var s=n;s<=e;s+=h){var f=Math.min(s+h-1,e);v(t,s,f,c,this.compareMinY);for(var l=s;l<=f;l+=c){var d=Math.min(l+c-1,f);a.children.push(this._build(t,l,d,r-1))}}return o(a,this.toBBox),a},r.prototype._chooseSubtree=function(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){for(var a=1/0,o=1/0,i=void 0,u=0;u<n.children.length;u++){var c=n.children[u],h=s(c),f=(l=t,d=c,(Math.max(d.maxX,l.maxX)-Math.min(d.minX,l.minX))*(Math.max(d.maxY,l.maxY)-Math.min(d.minY,l.minY))-h);f<o?(o=f,a=h<a?h:a,i=c):f===o&&h<a&&(a=h,i=c)}n=i||n.children[0]}var l,d;return n},r.prototype._insert=function(t,n,e){var r=e?t:this.toBBox(t),a=[],o=this._chooseSubtree(r,this.data,n,a);for(o.children.push(t),u(o,r);n>=0&&a[n].children.length>this._maxEntries;)this._split(a,n),n--;this._adjustParentBBoxes(r,a,n)},r.prototype._split=function(t,n){var e=t[n],r=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,r);var i=this._chooseSplitIndex(e,a,r),u=p(e.children.splice(i,e.children.length-i));u.height=e.height,u.leaf=e.leaf,o(e,this.toBBox),o(u,this.toBBox),n?t[n-1].children.push(u):this._splitRoot(e,u)},r.prototype._splitRoot=function(t,n){this.data=p([t,n]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,n,e){for(var r,a,o,u,c,h,f,l=1/0,d=1/0,p=n;p<=e-n;p++){var v=i(t,0,p,this.toBBox),m=i(t,p,e,this.toBBox),g=(a=v,o=m,u=Math.max(a.minX,o.minX),c=Math.max(a.minY,o.minY),h=Math.min(a.maxX,o.maxX),f=Math.min(a.maxY,o.maxY),Math.max(0,h-u)*Math.max(0,f-c)),y=s(v)+s(m);g<l?(l=g,r=p,d=y<d?y:d):g===l&&y<d&&(d=y,r=p)}return r||e-n},r.prototype._chooseSplitAxis=function(t,n,e){var r=t.leaf?this.compareMinX:c,a=t.leaf?this.compareMinY:h;this._allDistMargin(t,n,e,r)<this._allDistMargin(t,n,e,a)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,n,e,r){t.children.sort(r);for(var a=this.toBBox,o=i(t,0,n,a),c=i(t,e-n,e,a),h=f(o)+f(c),s=n;s<e-n;s++){var l=t.children[s];u(o,t.leaf?a(l):l),h+=f(o)}for(var d=e-n-1;d>=n;d--){var p=t.children[d];u(c,t.leaf?a(p):p),h+=f(c)}return h},r.prototype._adjustParentBBoxes=function(t,n,e){for(var r=e;r>=0;r--)u(n[r],t)},r.prototype._condense=function(t){for(var n=t.length-1,e=void 0;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():o(t[n],this.toBBox)},r}()},,,,,function(t,n,e){"use strict";e.r(n),e.d(n,"PathGeneratorFactory",(function(){return k})),e.d(n,"PathGenerator",(function(){return D})),e.d(n,"StyleRenderer",(function(){return f})),e.d(n,"RBushNode",(function(){return Se})),e.d(n,"RBushRoot",(function(){return Be})),e.d(n,"RBush",(function(){return h.a})),e.d(n,"Plugin",(function(){return Re}));var r={};e.r(r),e.d(r,"create",(function(){return N})),e.d(r,"clone",(function(){return I})),e.d(r,"copy",(function(){return q})),e.d(r,"fromValues",(function(){return L})),e.d(r,"set",(function(){return H})),e.d(r,"identity",(function(){return F})),e.d(r,"transpose",(function(){return G})),e.d(r,"invert",(function(){return V})),e.d(r,"adjoint",(function(){return U})),e.d(r,"determinant",(function(){return Z})),e.d(r,"multiply",(function(){return z})),e.d(r,"translate",(function(){return Q})),e.d(r,"scale",(function(){return J})),e.d(r,"rotate",(function(){return W})),e.d(r,"rotateX",(function(){return K})),e.d(r,"rotateY",(function(){return $})),e.d(r,"rotateZ",(function(){return tt})),e.d(r,"fromTranslation",(function(){return nt})),e.d(r,"fromScaling",(function(){return et})),e.d(r,"fromRotation",(function(){return rt})),e.d(r,"fromXRotation",(function(){return at})),e.d(r,"fromYRotation",(function(){return ot})),e.d(r,"fromZRotation",(function(){return it})),e.d(r,"fromRotationTranslation",(function(){return ut})),e.d(r,"fromQuat2",(function(){return ct})),e.d(r,"getTranslation",(function(){return ht})),e.d(r,"getScaling",(function(){return st})),e.d(r,"getRotation",(function(){return ft})),e.d(r,"fromRotationTranslationScale",(function(){return lt})),e.d(r,"fromRotationTranslationScaleOrigin",(function(){return dt})),e.d(r,"fromQuat",(function(){return pt})),e.d(r,"frustum",(function(){return vt})),e.d(r,"perspectiveNO",(function(){return mt})),e.d(r,"perspective",(function(){return gt})),e.d(r,"perspectiveZO",(function(){return yt})),e.d(r,"perspectiveFromFieldOfView",(function(){return Mt})),e.d(r,"orthoNO",(function(){return bt})),e.d(r,"ortho",(function(){return xt})),e.d(r,"orthoZO",(function(){return Ot})),e.d(r,"lookAt",(function(){return Pt})),e.d(r,"targetTo",(function(){return Et})),e.d(r,"str",(function(){return St})),e.d(r,"frob",(function(){return Bt})),e.d(r,"add",(function(){return Ct})),e.d(r,"subtract",(function(){return At})),e.d(r,"multiplyScalar",(function(){return jt})),e.d(r,"multiplyScalarAndAdd",(function(){return Rt})),e.d(r,"exactEquals",(function(){return wt})),e.d(r,"equals",(function(){return Tt})),e.d(r,"mul",(function(){return kt})),e.d(r,"sub",(function(){return Dt}));var a={};e.r(a),e.d(a,"create",(function(){return Yt})),e.d(a,"clone",(function(){return _t})),e.d(a,"length",(function(){return Xt})),e.d(a,"fromValues",(function(){return Nt})),e.d(a,"copy",(function(){return It})),e.d(a,"set",(function(){return qt})),e.d(a,"add",(function(){return Lt})),e.d(a,"subtract",(function(){return Ht})),e.d(a,"multiply",(function(){return Ft})),e.d(a,"divide",(function(){return Gt})),e.d(a,"ceil",(function(){return Vt})),e.d(a,"floor",(function(){return Ut})),e.d(a,"min",(function(){return Zt})),e.d(a,"max",(function(){return zt})),e.d(a,"round",(function(){return Qt})),e.d(a,"scale",(function(){return Jt})),e.d(a,"scaleAndAdd",(function(){return Wt})),e.d(a,"distance",(function(){return Kt})),e.d(a,"squaredDistance",(function(){return $t})),e.d(a,"squaredLength",(function(){return tn})),e.d(a,"negate",(function(){return nn})),e.d(a,"inverse",(function(){return en})),e.d(a,"normalize",(function(){return rn})),e.d(a,"dot",(function(){return an})),e.d(a,"cross",(function(){return on})),e.d(a,"lerp",(function(){return un})),e.d(a,"hermite",(function(){return cn})),e.d(a,"bezier",(function(){return hn})),e.d(a,"random",(function(){return sn})),e.d(a,"transformMat4",(function(){return fn})),e.d(a,"transformMat3",(function(){return ln})),e.d(a,"transformQuat",(function(){return dn})),e.d(a,"rotateX",(function(){return pn})),e.d(a,"rotateY",(function(){return vn})),e.d(a,"rotateZ",(function(){return mn})),e.d(a,"angle",(function(){return gn})),e.d(a,"zero",(function(){return yn})),e.d(a,"str",(function(){return Mn})),e.d(a,"exactEquals",(function(){return bn})),e.d(a,"equals",(function(){return xn})),e.d(a,"sub",(function(){return Pn})),e.d(a,"mul",(function(){return En})),e.d(a,"div",(function(){return Sn})),e.d(a,"dist",(function(){return Bn})),e.d(a,"sqrDist",(function(){return Cn})),e.d(a,"len",(function(){return An})),e.d(a,"sqrLen",(function(){return jn})),e.d(a,"forEach",(function(){return Rn}));var o={};e.r(o),e.d(o,"create",(function(){return kn})),e.d(o,"identity",(function(){return Dn})),e.d(o,"setAxisAngle",(function(){return Yn})),e.d(o,"getAxisAngle",(function(){return _n})),e.d(o,"getAngle",(function(){return Xn})),e.d(o,"multiply",(function(){return Nn})),e.d(o,"rotateX",(function(){return In})),e.d(o,"rotateY",(function(){return qn})),e.d(o,"rotateZ",(function(){return Ln})),e.d(o,"calculateW",(function(){return Hn})),e.d(o,"exp",(function(){return Fn})),e.d(o,"ln",(function(){return Gn})),e.d(o,"pow",(function(){return Vn})),e.d(o,"slerp",(function(){return Un})),e.d(o,"random",(function(){return Zn})),e.d(o,"invert",(function(){return zn})),e.d(o,"conjugate",(function(){return Qn})),e.d(o,"fromMat3",(function(){return Jn})),e.d(o,"fromEuler",(function(){return Wn})),e.d(o,"str",(function(){return Kn})),e.d(o,"clone",(function(){return ie})),e.d(o,"fromValues",(function(){return ue})),e.d(o,"copy",(function(){return ce})),e.d(o,"set",(function(){return he})),e.d(o,"add",(function(){return se})),e.d(o,"mul",(function(){return fe})),e.d(o,"scale",(function(){return le})),e.d(o,"dot",(function(){return de})),e.d(o,"lerp",(function(){return pe})),e.d(o,"length",(function(){return ve})),e.d(o,"len",(function(){return me})),e.d(o,"squaredLength",(function(){return ge})),e.d(o,"sqrLen",(function(){return ye})),e.d(o,"normalize",(function(){return Me})),e.d(o,"exactEquals",(function(){return be})),e.d(o,"equals",(function(){return xe})),e.d(o,"rotationTo",(function(){return Oe})),e.d(o,"sqlerp",(function(){return Pe})),e.d(o,"setAxes",(function(){return Ee}));var i=e(0),u=e(1),c=e(2),h=e.n(c),s=u.Syringe.defineToken("StyleRendererFactory"),f=u.Syringe.defineToken("StyleRenderer");var l=function(){return(l=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var a in n=arguments[e])Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a]);return t}).apply(this,arguments)};function d(t,n,e,r){var a,o=arguments.length,i=o<3?n:null===r?r=Object.getOwnPropertyDescriptor(n,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,n,e,r);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(i=(o<3?a(i):o>3?a(n,e,i):a(n,e))||i);return o>3&&i&&Object.defineProperty(n,e,i),i}function p(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)}Object.create;function v(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,a,o=e.call(t),i=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(t){a={error:t}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i}Object.create;var m={}.toString,g=function(t,n){return m.call(t)==="[object "+n+"]"},y=function(t){return g(t,"Function")},M=function(t){return null==t},b=function(t){return Array.isArray?Array.isArray(t):g(t,"Array")},x=function(t){var n=typeof t;return null!==t&&"object"===n||"function"===n};var O=function(t,n){if(t)if(b(t))for(var e=0,r=t.length;e<r&&!1!==n(t[e],e);e++);else if(x(t))for(var a in t)if(t.hasOwnProperty(a)&&!1===n(t[a],a))break};Object.keys;var P=Array.prototype,E=(P.splice,P.indexOf,Array.prototype.splice,function(t){return g(t,"String")});Object.prototype.hasOwnProperty;var S=function(t){return g(t,"Number")};Number.isInteger&&Number.isInteger;Math.PI,parseInt,Math.PI;var B=Object.values?function(t){return Object.values(t)}:function(t){var n=[];return O(t,(function(e,r){y(t)&&"prototype"===r||n.push(e)})),n};Object.prototype;Object.prototype.hasOwnProperty;var C;Object.prototype.hasOwnProperty;(function(t,n){if(!y(t))throw new TypeError("Expected a function");var e=function(){for(var r=[],a=0;a<arguments.length;a++)r[a]=arguments[a];var o=n?n.apply(this,r):r[0],i=e.cache;if(i.has(o))return i.get(o);var u=t.apply(this,r);return i.set(o,u),u};e.cache=new Map})((function(t,n){void 0===n&&(n={});var e=n.fontSize,r=n.fontFamily,a=n.fontWeight,o=n.fontStyle,i=n.fontVariant;return C||(C=document.createElement("canvas").getContext("2d")),C.font=[o,i,a,e+"px",r].join(" "),C.measureText(E(t)?t:"").width}),(function(t,n){return void 0===n&&(n={}),function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var r=Array(t),a=0;for(n=0;n<e;n++)for(var o=arguments[n],i=0,u=o.length;i<u;i++,a++)r[a]=o[i];return r}([t],B(n)).join("")})),function(){function t(){this.map={}}t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,n){var e=this.map[t];return void 0===e?n:e},t.prototype.set=function(t,n){this.map[t]=n},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length}}();var A=function(){function t(){}return t.prototype.hash=function(t){t.fill,t.opacity,t.fillOpacity,t.stroke,t.strokeOpacity,t.lineWidth,t.lineCap,t.lineJoin;return""},t.prototype.render=function(t,n){var e=n.fill,r=n.opacity,a=n.fillOpacity,o=n.stroke,i=n.strokeOpacity,u=n.lineWidth,c=n.lineCap,h=n.lineJoin,s=n.shadowColor,f=n.filter;if(M(e)||(M(a)||1===a?t.fill():(t.globalAlpha=a,t.fill(),t.globalAlpha=r)),!M(o)&&u&&u>0){!M(i)&&1!==i&&(t.globalAlpha=i),t.lineWidth=u,M(c)||(t.lineCap=c),M(h)||(t.lineJoin=h);var l=void 0,d=void 0,p=void 0,v=!M(s),m=!M(f);v&&(l=t.shadowBlur,d=t.shadowColor,M(l)||(t.shadowColor="transparent",t.shadowBlur=0)),m&&(p=t.filter,!M(p)&&p.indexOf("drop-shadow")>-1&&(t.filter=p.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")),t.stroke(),v&&(t.shadowColor=d,t.shadowBlur=l),m&&(t.filter=p)}},t=d([Object(u.singleton)({token:[{token:f,named:i.SHAPE.Circle},{token:f,named:i.SHAPE.Ellipse},{token:f,named:i.SHAPE.Rect},{token:f,named:i.SHAPE.Line},{token:f,named:i.SHAPE.Polyline},{token:f,named:i.SHAPE.Polygon},{token:f,named:i.SHAPE.Path}]})],t)}(),j=function(){function t(){this.imageCache={},this.patternCache={}}return t.prototype.getImageSync=function(t){return this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var n=this;return this.imageCache[t]?Promise.resolve(this.imageCache[t]):new Promise((function(e,r){var a=new window.Image;a.onload=function(){e(a)},a.onerror=function(t){r(t)},a.crossOrigin="Anonymous",a.src=t,n.imageCache[t]=a}))},t.prototype.getPatternSync=function(t){var n=this.generatePatternKey(t);if(this.patternCache[n])return this.patternCache[n]},t.prototype.createPattern=function(t,n){var e=this;return this.getOrCreateImage(t.src).then((function(r){var a=e.generatePatternKey(t),o=n.createPattern(r,t.repetition);return o&&(e.patternCache[a]=o),e.patternCache[a]}))},t.prototype.generatePatternKey=function(t){return"pattern-"+t.src+"-"+t.repetition},t=d([Object(u.singleton)()],t)}(),R=function(){function t(){}return t.prototype.hash=function(t){return""},t.prototype.render=function(t,n){var e,r=n.width,a=void 0===r?0:r,o=n.height,i=void 0===o?0:o,u=n.img,c=a,h=i;E(u)?e=this.imagePool.getImageSync(u):(c||(c=u.width),h||(h=u.height),e=u),t.drawImage(e,0,0,c,h)},d([Object(u.inject)(j),p("design:type",j)],t.prototype,"imagePool",void 0),t=d([Object(u.singleton)({token:{token:f,named:i.SHAPE.Image}})],t)}(),w=function(){function t(){}return t.prototype.hash=function(t){return""},t.prototype.render=function(t,n){n.text;var e=n.lineWidth,r=void 0===e?0:e,a=n.textAlign,o=n.textBaseline,i=n.lineJoin,u=n.miterLimit,c=void 0===u?0:u,h=n.padding,s=void 0===h?0:h,f=n.letterSpacing,l=void 0===f?0:f,d=n.stroke,p=n.fill,v=n.fillOpacity,m=n.strokeOpacity,g=n.opacity,y=n.metrics,b=y.font,x=y.lines,O=y.height,P=y.lineHeight;t.font=b,t.lineWidth=r,t.textAlign=a,t.textBaseline=o,t.lineJoin=i,t.miterLimit=c;var E=0;"middle"===o?E=-O/2-P/2:"bottom"===o||"alphabetic"===o||"ideographic"===o?E=-O:"top"!==o&&"hanging"!==o||(E=-P);for(var S=0;S<x.length;S++){var B=r/2;E+=P,!M(d)&&r&&this.drawLetterSpacing(t,x[S],B+s,E+s,l,v,m,g,!0),M(p)||this.drawLetterSpacing(t,x[S],B+s,E+s,l,v,m,g)}},t.prototype.drawLetterSpacing=function(t,n,e,r,a,o,i,u,c){if(void 0===c&&(c=!1),0!==a)for(var h=e,s=Array.from(n),f=t.measureText(n).width,l=0,d=0;d<s.length;++d){var p=s[d];c?this.strokeText(t,p,h,r,i):this.fillText(t,p,h,r,o,u),h+=f-(l=t.measureText(n.substring(d+1)).width)+a,f=l}else c?this.strokeText(t,n,e,r,i):this.fillText(t,n,e,r,o,u)},t.prototype.fillText=function(t,n,e,r,a,o){var i=!M(a)&&1!==a;i&&(t.globalAlpha=a),t.fillText(n,e,r),i&&(t.globalAlpha=o)},t.prototype.strokeText=function(t,n,e,r,a){!M(a)&&1!==a&&(t.globalAlpha=a),t.strokeText(n,e,r)},d([Object(u.inject)(i.TextService),p("design:type",i.TextService)],t.prototype,"textService",void 0),t=d([Object(u.singleton)({token:{token:f,named:i.SHAPE.Text}})],t)}(),T=function(){function t(){this.gradientCache={}}return t.prototype.getOrCreateGradient=function(t,n){var e=this.generateCacheKey(t),r=t.type,a=t.x0,o=t.y0,u=t.x1,c=t.y1,h=t.steps,s=t.width,f=t.height;if(this.gradientCache[e])return this.gradientCache[e];var l=null;if(r===i.PARSED_COLOR_TYPE.LinearGradient)l=n.createLinearGradient(a*s,o*f,u*s,c*f);else if(r===i.PARSED_COLOR_TYPE.RadialGradient){var d=Math.sqrt(s*s+f*f)/2;l=n.createRadialGradient(a*s,o*f,0,u*s,c*f,t.r1*d)}return l&&(h.forEach((function(t){var n=v(t,2),e=n[0],r=n[1];null==l||l.addColorStop(Number(e),r)})),this.gradientCache[e]=l),this.gradientCache[e]},t.prototype.generateCacheKey=function(t){var n=t.type,e=t.x0,r=t.y0,a=t.x1,o=t.y1,i=t.r1,u=t.steps;return"gradient-"+n+"-"+e+"-"+r+"-"+a+"-"+o+"-"+(i||0)+"-"+t.width+"-"+t.height+"-"+u.map((function(t){return t.join("")})).join("-")},t=d([Object(u.singleton)()],t)}();var k="PathGeneratorFactory",D="PathGenerator",Y=1e-6,_="undefined"!=typeof Float32Array?Float32Array:Array,X=Math.random;Math.PI;function N(){var t=new _(16);return _!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function I(t){var n=new _(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function q(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function L(t,n,e,r,a,o,i,u,c,h,s,f,l,d,p,v){var m=new _(16);return m[0]=t,m[1]=n,m[2]=e,m[3]=r,m[4]=a,m[5]=o,m[6]=i,m[7]=u,m[8]=c,m[9]=h,m[10]=s,m[11]=f,m[12]=l,m[13]=d,m[14]=p,m[15]=v,m}function H(t,n,e,r,a,o,i,u,c,h,s,f,l,d,p,v,m){return t[0]=n,t[1]=e,t[2]=r,t[3]=a,t[4]=o,t[5]=i,t[6]=u,t[7]=c,t[8]=h,t[9]=s,t[10]=f,t[11]=l,t[12]=d,t[13]=p,t[14]=v,t[15]=m,t}function F(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function G(t,n){if(t===n){var e=n[1],r=n[2],a=n[3],o=n[6],i=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=o,t[11]=n[14],t[12]=a,t[13]=i,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t}function V(t,n){var e=n[0],r=n[1],a=n[2],o=n[3],i=n[4],u=n[5],c=n[6],h=n[7],s=n[8],f=n[9],l=n[10],d=n[11],p=n[12],v=n[13],m=n[14],g=n[15],y=e*u-r*i,M=e*c-a*i,b=e*h-o*i,x=r*c-a*u,O=r*h-o*u,P=a*h-o*c,E=s*v-f*p,S=s*m-l*p,B=s*g-d*p,C=f*m-l*v,A=f*g-d*v,j=l*g-d*m,R=y*j-M*A+b*C+x*B-O*S+P*E;return R?(R=1/R,t[0]=(u*j-c*A+h*C)*R,t[1]=(a*A-r*j-o*C)*R,t[2]=(v*P-m*O+g*x)*R,t[3]=(l*O-f*P-d*x)*R,t[4]=(c*B-i*j-h*S)*R,t[5]=(e*j-a*B+o*S)*R,t[6]=(m*b-p*P-g*M)*R,t[7]=(s*P-l*b+d*M)*R,t[8]=(i*A-u*B+h*E)*R,t[9]=(r*B-e*A-o*E)*R,t[10]=(p*O-v*b+g*y)*R,t[11]=(f*b-s*O-d*y)*R,t[12]=(u*S-i*C-c*E)*R,t[13]=(e*C-r*S+a*E)*R,t[14]=(v*M-p*x-m*y)*R,t[15]=(s*x-f*M+l*y)*R,t):null}function U(t,n){var e=n[0],r=n[1],a=n[2],o=n[3],i=n[4],u=n[5],c=n[6],h=n[7],s=n[8],f=n[9],l=n[10],d=n[11],p=n[12],v=n[13],m=n[14],g=n[15];return t[0]=u*(l*g-d*m)-f*(c*g-h*m)+v*(c*d-h*l),t[1]=-(r*(l*g-d*m)-f*(a*g-o*m)+v*(a*d-o*l)),t[2]=r*(c*g-h*m)-u*(a*g-o*m)+v*(a*h-o*c),t[3]=-(r*(c*d-h*l)-u*(a*d-o*l)+f*(a*h-o*c)),t[4]=-(i*(l*g-d*m)-s*(c*g-h*m)+p*(c*d-h*l)),t[5]=e*(l*g-d*m)-s*(a*g-o*m)+p*(a*d-o*l),t[6]=-(e*(c*g-h*m)-i*(a*g-o*m)+p*(a*h-o*c)),t[7]=e*(c*d-h*l)-i*(a*d-o*l)+s*(a*h-o*c),t[8]=i*(f*g-d*v)-s*(u*g-h*v)+p*(u*d-h*f),t[9]=-(e*(f*g-d*v)-s*(r*g-o*v)+p*(r*d-o*f)),t[10]=e*(u*g-h*v)-i*(r*g-o*v)+p*(r*h-o*u),t[11]=-(e*(u*d-h*f)-i*(r*d-o*f)+s*(r*h-o*u)),t[12]=-(i*(f*m-l*v)-s*(u*m-c*v)+p*(u*l-c*f)),t[13]=e*(f*m-l*v)-s*(r*m-a*v)+p*(r*l-a*f),t[14]=-(e*(u*m-c*v)-i*(r*m-a*v)+p*(r*c-a*u)),t[15]=e*(u*l-c*f)-i*(r*l-a*f)+s*(r*c-a*u),t}function Z(t){var n=t[0],e=t[1],r=t[2],a=t[3],o=t[4],i=t[5],u=t[6],c=t[7],h=t[8],s=t[9],f=t[10],l=t[11],d=t[12],p=t[13],v=t[14],m=t[15];return(n*i-e*o)*(f*m-l*v)-(n*u-r*o)*(s*m-l*p)+(n*c-a*o)*(s*v-f*p)+(e*u-r*i)*(h*m-l*d)-(e*c-a*i)*(h*v-f*d)+(r*c-a*u)*(h*p-s*d)}function z(t,n,e){var r=n[0],a=n[1],o=n[2],i=n[3],u=n[4],c=n[5],h=n[6],s=n[7],f=n[8],l=n[9],d=n[10],p=n[11],v=n[12],m=n[13],g=n[14],y=n[15],M=e[0],b=e[1],x=e[2],O=e[3];return t[0]=M*r+b*u+x*f+O*v,t[1]=M*a+b*c+x*l+O*m,t[2]=M*o+b*h+x*d+O*g,t[3]=M*i+b*s+x*p+O*y,M=e[4],b=e[5],x=e[6],O=e[7],t[4]=M*r+b*u+x*f+O*v,t[5]=M*a+b*c+x*l+O*m,t[6]=M*o+b*h+x*d+O*g,t[7]=M*i+b*s+x*p+O*y,M=e[8],b=e[9],x=e[10],O=e[11],t[8]=M*r+b*u+x*f+O*v,t[9]=M*a+b*c+x*l+O*m,t[10]=M*o+b*h+x*d+O*g,t[11]=M*i+b*s+x*p+O*y,M=e[12],b=e[13],x=e[14],O=e[15],t[12]=M*r+b*u+x*f+O*v,t[13]=M*a+b*c+x*l+O*m,t[14]=M*o+b*h+x*d+O*g,t[15]=M*i+b*s+x*p+O*y,t}function Q(t,n,e){var r,a,o,i,u,c,h,s,f,l,d,p,v=e[0],m=e[1],g=e[2];return n===t?(t[12]=n[0]*v+n[4]*m+n[8]*g+n[12],t[13]=n[1]*v+n[5]*m+n[9]*g+n[13],t[14]=n[2]*v+n[6]*m+n[10]*g+n[14],t[15]=n[3]*v+n[7]*m+n[11]*g+n[15]):(r=n[0],a=n[1],o=n[2],i=n[3],u=n[4],c=n[5],h=n[6],s=n[7],f=n[8],l=n[9],d=n[10],p=n[11],t[0]=r,t[1]=a,t[2]=o,t[3]=i,t[4]=u,t[5]=c,t[6]=h,t[7]=s,t[8]=f,t[9]=l,t[10]=d,t[11]=p,t[12]=r*v+u*m+f*g+n[12],t[13]=a*v+c*m+l*g+n[13],t[14]=o*v+h*m+d*g+n[14],t[15]=i*v+s*m+p*g+n[15]),t}function J(t,n,e){var r=e[0],a=e[1],o=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*a,t[5]=n[5]*a,t[6]=n[6]*a,t[7]=n[7]*a,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=n[11]*o,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function W(t,n,e,r){var a,o,i,u,c,h,s,f,l,d,p,v,m,g,y,M,b,x,O,P,E,S,B,C,A=r[0],j=r[1],R=r[2],w=Math.hypot(A,j,R);return w<Y?null:(A*=w=1/w,j*=w,R*=w,a=Math.sin(e),i=1-(o=Math.cos(e)),u=n[0],c=n[1],h=n[2],s=n[3],f=n[4],l=n[5],d=n[6],p=n[7],v=n[8],m=n[9],g=n[10],y=n[11],M=A*A*i+o,b=j*A*i+R*a,x=R*A*i-j*a,O=A*j*i-R*a,P=j*j*i+o,E=R*j*i+A*a,S=A*R*i+j*a,B=j*R*i-A*a,C=R*R*i+o,t[0]=u*M+f*b+v*x,t[1]=c*M+l*b+m*x,t[2]=h*M+d*b+g*x,t[3]=s*M+p*b+y*x,t[4]=u*O+f*P+v*E,t[5]=c*O+l*P+m*E,t[6]=h*O+d*P+g*E,t[7]=s*O+p*P+y*E,t[8]=u*S+f*B+v*C,t[9]=c*S+l*B+m*C,t[10]=h*S+d*B+g*C,t[11]=s*S+p*B+y*C,n!==t&&(t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t)}function K(t,n,e){var r=Math.sin(e),a=Math.cos(e),o=n[4],i=n[5],u=n[6],c=n[7],h=n[8],s=n[9],f=n[10],l=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=o*a+h*r,t[5]=i*a+s*r,t[6]=u*a+f*r,t[7]=c*a+l*r,t[8]=h*a-o*r,t[9]=s*a-i*r,t[10]=f*a-u*r,t[11]=l*a-c*r,t}function $(t,n,e){var r=Math.sin(e),a=Math.cos(e),o=n[0],i=n[1],u=n[2],c=n[3],h=n[8],s=n[9],f=n[10],l=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=o*a-h*r,t[1]=i*a-s*r,t[2]=u*a-f*r,t[3]=c*a-l*r,t[8]=o*r+h*a,t[9]=i*r+s*a,t[10]=u*r+f*a,t[11]=c*r+l*a,t}function tt(t,n,e){var r=Math.sin(e),a=Math.cos(e),o=n[0],i=n[1],u=n[2],c=n[3],h=n[4],s=n[5],f=n[6],l=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=o*a+h*r,t[1]=i*a+s*r,t[2]=u*a+f*r,t[3]=c*a+l*r,t[4]=h*a-o*r,t[5]=s*a-i*r,t[6]=f*a-u*r,t[7]=l*a-c*r,t}function nt(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function et(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=n[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function rt(t,n,e){var r,a,o,i=e[0],u=e[1],c=e[2],h=Math.hypot(i,u,c);return h<Y?null:(i*=h=1/h,u*=h,c*=h,r=Math.sin(n),o=1-(a=Math.cos(n)),t[0]=i*i*o+a,t[1]=u*i*o+c*r,t[2]=c*i*o-u*r,t[3]=0,t[4]=i*u*o-c*r,t[5]=u*u*o+a,t[6]=c*u*o+i*r,t[7]=0,t[8]=i*c*o+u*r,t[9]=u*c*o-i*r,t[10]=c*c*o+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function at(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=e,t[7]=0,t[8]=0,t[9]=-e,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ot(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=0,t[2]=-e,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=e,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function it(t,n){var e=Math.sin(n),r=Math.cos(n);return t[0]=r,t[1]=e,t[2]=0,t[3]=0,t[4]=-e,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ut(t,n,e){var r=n[0],a=n[1],o=n[2],i=n[3],u=r+r,c=a+a,h=o+o,s=r*u,f=r*c,l=r*h,d=a*c,p=a*h,v=o*h,m=i*u,g=i*c,y=i*h;return t[0]=1-(d+v),t[1]=f+y,t[2]=l-g,t[3]=0,t[4]=f-y,t[5]=1-(s+v),t[6]=p+m,t[7]=0,t[8]=l+g,t[9]=p-m,t[10]=1-(s+d),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function ct(t,n){var e=new _(3),r=-n[0],a=-n[1],o=-n[2],i=n[3],u=n[4],c=n[5],h=n[6],s=n[7],f=r*r+a*a+o*o+i*i;return f>0?(e[0]=2*(u*i+s*r+c*o-h*a)/f,e[1]=2*(c*i+s*a+h*r-u*o)/f,e[2]=2*(h*i+s*o+u*a-c*r)/f):(e[0]=2*(u*i+s*r+c*o-h*a),e[1]=2*(c*i+s*a+h*r-u*o),e[2]=2*(h*i+s*o+u*a-c*r)),ut(t,n,e),t}function ht(t,n){return t[0]=n[12],t[1]=n[13],t[2]=n[14],t}function st(t,n){var e=n[0],r=n[1],a=n[2],o=n[4],i=n[5],u=n[6],c=n[8],h=n[9],s=n[10];return t[0]=Math.hypot(e,r,a),t[1]=Math.hypot(o,i,u),t[2]=Math.hypot(c,h,s),t}function ft(t,n){var e=new _(3);st(e,n);var r=1/e[0],a=1/e[1],o=1/e[2],i=n[0]*r,u=n[1]*a,c=n[2]*o,h=n[4]*r,s=n[5]*a,f=n[6]*o,l=n[8]*r,d=n[9]*a,p=n[10]*o,v=i+s+p,m=0;return v>0?(m=2*Math.sqrt(v+1),t[3]=.25*m,t[0]=(f-d)/m,t[1]=(l-c)/m,t[2]=(u-h)/m):i>s&&i>p?(m=2*Math.sqrt(1+i-s-p),t[3]=(f-d)/m,t[0]=.25*m,t[1]=(u+h)/m,t[2]=(l+c)/m):s>p?(m=2*Math.sqrt(1+s-i-p),t[3]=(l-c)/m,t[0]=(u+h)/m,t[1]=.25*m,t[2]=(f+d)/m):(m=2*Math.sqrt(1+p-i-s),t[3]=(u-h)/m,t[0]=(l+c)/m,t[1]=(f+d)/m,t[2]=.25*m),t}function lt(t,n,e,r){var a=n[0],o=n[1],i=n[2],u=n[3],c=a+a,h=o+o,s=i+i,f=a*c,l=a*h,d=a*s,p=o*h,v=o*s,m=i*s,g=u*c,y=u*h,M=u*s,b=r[0],x=r[1],O=r[2];return t[0]=(1-(p+m))*b,t[1]=(l+M)*b,t[2]=(d-y)*b,t[3]=0,t[4]=(l-M)*x,t[5]=(1-(f+m))*x,t[6]=(v+g)*x,t[7]=0,t[8]=(d+y)*O,t[9]=(v-g)*O,t[10]=(1-(f+p))*O,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function dt(t,n,e,r,a){var o=n[0],i=n[1],u=n[2],c=n[3],h=o+o,s=i+i,f=u+u,l=o*h,d=o*s,p=o*f,v=i*s,m=i*f,g=u*f,y=c*h,M=c*s,b=c*f,x=r[0],O=r[1],P=r[2],E=a[0],S=a[1],B=a[2],C=(1-(v+g))*x,A=(d+b)*x,j=(p-M)*x,R=(d-b)*O,w=(1-(l+g))*O,T=(m+y)*O,k=(p+M)*P,D=(m-y)*P,Y=(1-(l+v))*P;return t[0]=C,t[1]=A,t[2]=j,t[3]=0,t[4]=R,t[5]=w,t[6]=T,t[7]=0,t[8]=k,t[9]=D,t[10]=Y,t[11]=0,t[12]=e[0]+E-(C*E+R*S+k*B),t[13]=e[1]+S-(A*E+w*S+D*B),t[14]=e[2]+B-(j*E+T*S+Y*B),t[15]=1,t}function pt(t,n){var e=n[0],r=n[1],a=n[2],o=n[3],i=e+e,u=r+r,c=a+a,h=e*i,s=r*i,f=r*u,l=a*i,d=a*u,p=a*c,v=o*i,m=o*u,g=o*c;return t[0]=1-f-p,t[1]=s+g,t[2]=l-m,t[3]=0,t[4]=s-g,t[5]=1-h-p,t[6]=d+v,t[7]=0,t[8]=l+m,t[9]=d-v,t[10]=1-h-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function vt(t,n,e,r,a,o,i){var u=1/(e-n),c=1/(a-r),h=1/(o-i);return t[0]=2*o*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*c,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(a+r)*c,t[10]=(i+o)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*o*2*h,t[15]=0,t}function mt(t,n,e,r,a){var o,i=1/Math.tan(n/2);return t[0]=i/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=a&&a!==1/0?(o=1/(r-a),t[10]=(a+r)*o,t[14]=2*a*r*o):(t[10]=-1,t[14]=-2*r),t}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});var gt=mt;function yt(t,n,e,r,a){var o,i=1/Math.tan(n/2);return t[0]=i/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=a&&a!==1/0?(o=1/(r-a),t[10]=a*o,t[14]=a*r*o):(t[10]=-1,t[14]=-r),t}function Mt(t,n,e,r){var a=Math.tan(n.upDegrees*Math.PI/180),o=Math.tan(n.downDegrees*Math.PI/180),i=Math.tan(n.leftDegrees*Math.PI/180),u=Math.tan(n.rightDegrees*Math.PI/180),c=2/(i+u),h=2/(a+o);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=-(i-u)*c*.5,t[9]=(a-o)*h*.5,t[10]=r/(e-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*e/(e-r),t[15]=0,t}function bt(t,n,e,r,a,o,i){var u=1/(n-e),c=1/(r-a),h=1/(o-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(n+e)*u,t[13]=(a+r)*c,t[14]=(i+o)*h,t[15]=1,t}var xt=bt;function Ot(t,n,e,r,a,o,i){var u=1/(n-e),c=1/(r-a),h=1/(o-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=h,t[11]=0,t[12]=(n+e)*u,t[13]=(a+r)*c,t[14]=o*h,t[15]=1,t}function Pt(t,n,e,r){var a,o,i,u,c,h,s,f,l,d,p=n[0],v=n[1],m=n[2],g=r[0],y=r[1],M=r[2],b=e[0],x=e[1],O=e[2];return Math.abs(p-b)<Y&&Math.abs(v-x)<Y&&Math.abs(m-O)<Y?F(t):(s=p-b,f=v-x,l=m-O,a=y*(l*=d=1/Math.hypot(s,f,l))-M*(f*=d),o=M*(s*=d)-g*l,i=g*f-y*s,(d=Math.hypot(a,o,i))?(a*=d=1/d,o*=d,i*=d):(a=0,o=0,i=0),u=f*i-l*o,c=l*a-s*i,h=s*o-f*a,(d=Math.hypot(u,c,h))?(u*=d=1/d,c*=d,h*=d):(u=0,c=0,h=0),t[0]=a,t[1]=u,t[2]=s,t[3]=0,t[4]=o,t[5]=c,t[6]=f,t[7]=0,t[8]=i,t[9]=h,t[10]=l,t[11]=0,t[12]=-(a*p+o*v+i*m),t[13]=-(u*p+c*v+h*m),t[14]=-(s*p+f*v+l*m),t[15]=1,t)}function Et(t,n,e,r){var a=n[0],o=n[1],i=n[2],u=r[0],c=r[1],h=r[2],s=a-e[0],f=o-e[1],l=i-e[2],d=s*s+f*f+l*l;d>0&&(s*=d=1/Math.sqrt(d),f*=d,l*=d);var p=c*l-h*f,v=h*s-u*l,m=u*f-c*s;return(d=p*p+v*v+m*m)>0&&(p*=d=1/Math.sqrt(d),v*=d,m*=d),t[0]=p,t[1]=v,t[2]=m,t[3]=0,t[4]=f*m-l*v,t[5]=l*p-s*m,t[6]=s*v-f*p,t[7]=0,t[8]=s,t[9]=f,t[10]=l,t[11]=0,t[12]=a,t[13]=o,t[14]=i,t[15]=1,t}function St(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function Bt(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function Ct(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t[9]=n[9]+e[9],t[10]=n[10]+e[10],t[11]=n[11]+e[11],t[12]=n[12]+e[12],t[13]=n[13]+e[13],t[14]=n[14]+e[14],t[15]=n[15]+e[15],t}function At(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t[9]=n[9]-e[9],t[10]=n[10]-e[10],t[11]=n[11]-e[11],t[12]=n[12]-e[12],t[13]=n[13]-e[13],t[14]=n[14]-e[14],t[15]=n[15]-e[15],t}function jt(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,t[11]=n[11]*e,t[12]=n[12]*e,t[13]=n[13]*e,t[14]=n[14]*e,t[15]=n[15]*e,t}function Rt(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t[4]=n[4]+e[4]*r,t[5]=n[5]+e[5]*r,t[6]=n[6]+e[6]*r,t[7]=n[7]+e[7]*r,t[8]=n[8]+e[8]*r,t[9]=n[9]+e[9]*r,t[10]=n[10]+e[10]*r,t[11]=n[11]+e[11]*r,t[12]=n[12]+e[12]*r,t[13]=n[13]+e[13]*r,t[14]=n[14]+e[14]*r,t[15]=n[15]+e[15]*r,t}function wt(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]&&t[9]===n[9]&&t[10]===n[10]&&t[11]===n[11]&&t[12]===n[12]&&t[13]===n[13]&&t[14]===n[14]&&t[15]===n[15]}function Tt(t,n){var e=t[0],r=t[1],a=t[2],o=t[3],i=t[4],u=t[5],c=t[6],h=t[7],s=t[8],f=t[9],l=t[10],d=t[11],p=t[12],v=t[13],m=t[14],g=t[15],y=n[0],M=n[1],b=n[2],x=n[3],O=n[4],P=n[5],E=n[6],S=n[7],B=n[8],C=n[9],A=n[10],j=n[11],R=n[12],w=n[13],T=n[14],k=n[15];return Math.abs(e-y)<=Y*Math.max(1,Math.abs(e),Math.abs(y))&&Math.abs(r-M)<=Y*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-b)<=Y*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(o-x)<=Y*Math.max(1,Math.abs(o),Math.abs(x))&&Math.abs(i-O)<=Y*Math.max(1,Math.abs(i),Math.abs(O))&&Math.abs(u-P)<=Y*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(c-E)<=Y*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(h-S)<=Y*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(s-B)<=Y*Math.max(1,Math.abs(s),Math.abs(B))&&Math.abs(f-C)<=Y*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(l-A)<=Y*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(d-j)<=Y*Math.max(1,Math.abs(d),Math.abs(j))&&Math.abs(p-R)<=Y*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(v-w)<=Y*Math.max(1,Math.abs(v),Math.abs(w))&&Math.abs(m-T)<=Y*Math.max(1,Math.abs(m),Math.abs(T))&&Math.abs(g-k)<=Y*Math.max(1,Math.abs(g),Math.abs(k))}var kt=z,Dt=At;function Yt(){var t=new _(3);return _!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function _t(t){var n=new _(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n}function Xt(t){var n=t[0],e=t[1],r=t[2];return Math.hypot(n,e,r)}function Nt(t,n,e){var r=new _(3);return r[0]=t,r[1]=n,r[2]=e,r}function It(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function qt(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function Lt(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function Ht(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}function Ft(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t}function Gt(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t}function Vt(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t}function Ut(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t}function Zt(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t}function zt(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t}function Qt(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t}function Jt(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}function Wt(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t}function Kt(t,n){var e=n[0]-t[0],r=n[1]-t[1],a=n[2]-t[2];return Math.hypot(e,r,a)}function $t(t,n){var e=n[0]-t[0],r=n[1]-t[1],a=n[2]-t[2];return e*e+r*r+a*a}function tn(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r}function nn(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t}function en(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t}function rn(t,n){var e=n[0],r=n[1],a=n[2],o=e*e+r*r+a*a;return o>0&&(o=1/Math.sqrt(o)),t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o,t}function an(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function on(t,n,e){var r=n[0],a=n[1],o=n[2],i=e[0],u=e[1],c=e[2];return t[0]=a*c-o*u,t[1]=o*i-r*c,t[2]=r*u-a*i,t}function un(t,n,e,r){var a=n[0],o=n[1],i=n[2];return t[0]=a+r*(e[0]-a),t[1]=o+r*(e[1]-o),t[2]=i+r*(e[2]-i),t}function cn(t,n,e,r,a,o){var i=o*o,u=i*(2*o-3)+1,c=i*(o-2)+o,h=i*(o-1),s=i*(3-2*o);return t[0]=n[0]*u+e[0]*c+r[0]*h+a[0]*s,t[1]=n[1]*u+e[1]*c+r[1]*h+a[1]*s,t[2]=n[2]*u+e[2]*c+r[2]*h+a[2]*s,t}function hn(t,n,e,r,a,o){var i=1-o,u=i*i,c=o*o,h=u*i,s=3*o*u,f=3*c*i,l=c*o;return t[0]=n[0]*h+e[0]*s+r[0]*f+a[0]*l,t[1]=n[1]*h+e[1]*s+r[1]*f+a[1]*l,t[2]=n[2]*h+e[2]*s+r[2]*f+a[2]*l,t}function sn(t,n){n=n||1;var e=2*X()*Math.PI,r=2*X()-1,a=Math.sqrt(1-r*r)*n;return t[0]=Math.cos(e)*a,t[1]=Math.sin(e)*a,t[2]=r*n,t}function fn(t,n,e){var r=n[0],a=n[1],o=n[2],i=e[3]*r+e[7]*a+e[11]*o+e[15];return i=i||1,t[0]=(e[0]*r+e[4]*a+e[8]*o+e[12])/i,t[1]=(e[1]*r+e[5]*a+e[9]*o+e[13])/i,t[2]=(e[2]*r+e[6]*a+e[10]*o+e[14])/i,t}function ln(t,n,e){var r=n[0],a=n[1],o=n[2];return t[0]=r*e[0]+a*e[3]+o*e[6],t[1]=r*e[1]+a*e[4]+o*e[7],t[2]=r*e[2]+a*e[5]+o*e[8],t}function dn(t,n,e){var r=e[0],a=e[1],o=e[2],i=e[3],u=n[0],c=n[1],h=n[2],s=a*h-o*c,f=o*u-r*h,l=r*c-a*u,d=a*l-o*f,p=o*s-r*l,v=r*f-a*s,m=2*i;return s*=m,f*=m,l*=m,d*=2,p*=2,v*=2,t[0]=u+s+d,t[1]=c+f+p,t[2]=h+l+v,t}function pn(t,n,e,r){var a=[],o=[];return a[0]=n[0]-e[0],a[1]=n[1]-e[1],a[2]=n[2]-e[2],o[0]=a[0],o[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),o[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),t[0]=o[0]+e[0],t[1]=o[1]+e[1],t[2]=o[2]+e[2],t}function vn(t,n,e,r){var a=[],o=[];return a[0]=n[0]-e[0],a[1]=n[1]-e[1],a[2]=n[2]-e[2],o[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),o[1]=a[1],o[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),t[0]=o[0]+e[0],t[1]=o[1]+e[1],t[2]=o[2]+e[2],t}function mn(t,n,e,r){var a=[],o=[];return a[0]=n[0]-e[0],a[1]=n[1]-e[1],a[2]=n[2]-e[2],o[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),o[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),o[2]=a[2],t[0]=o[0]+e[0],t[1]=o[1]+e[1],t[2]=o[2]+e[2],t}function gn(t,n){var e=t[0],r=t[1],a=t[2],o=n[0],i=n[1],u=n[2],c=Math.sqrt(e*e+r*r+a*a)*Math.sqrt(o*o+i*i+u*u),h=c&&an(t,n)/c;return Math.acos(Math.min(Math.max(h,-1),1))}function yn(t){return t[0]=0,t[1]=0,t[2]=0,t}function Mn(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function bn(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]}function xn(t,n){var e=t[0],r=t[1],a=t[2],o=n[0],i=n[1],u=n[2];return Math.abs(e-o)<=Y*Math.max(1,Math.abs(e),Math.abs(o))&&Math.abs(r-i)<=Y*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(a-u)<=Y*Math.max(1,Math.abs(a),Math.abs(u))}var On,Pn=Ht,En=Ft,Sn=Gt,Bn=Kt,Cn=$t,An=Xt,jn=tn,Rn=(On=Yt(),function(t,n,e,r,a,o){var i,u;for(n||(n=3),e||(e=0),u=r?Math.min(r*n+e,t.length):t.length,i=e;i<u;i+=n)On[0]=t[i],On[1]=t[i+1],On[2]=t[i+2],a(On,On,o),t[i]=On[0],t[i+1]=On[1],t[i+2]=On[2];return t});function wn(t){var n=t[0],e=t[1],r=t[2],a=t[3];return Math.hypot(n,e,r,a)}function Tn(t){var n=t[0],e=t[1],r=t[2],a=t[3];return n*n+e*e+r*r+a*a}!function(){var t,n=(t=new _(4),_!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function kn(){var t=new _(4);return _!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Dn(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Yn(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t}function _n(t,n){var e=2*Math.acos(n[3]),r=Math.sin(e/2);return r>Y?(t[0]=n[0]/r,t[1]=n[1]/r,t[2]=n[2]/r):(t[0]=1,t[1]=0,t[2]=0),e}function Xn(t,n){var e=de(t,n);return Math.acos(2*e*e-1)}function Nn(t,n,e){var r=n[0],a=n[1],o=n[2],i=n[3],u=e[0],c=e[1],h=e[2],s=e[3];return t[0]=r*s+i*u+a*h-o*c,t[1]=a*s+i*c+o*u-r*h,t[2]=o*s+i*h+r*c-a*u,t[3]=i*s-r*u-a*c-o*h,t}function In(t,n,e){e*=.5;var r=n[0],a=n[1],o=n[2],i=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+i*u,t[1]=a*c+o*u,t[2]=o*c-a*u,t[3]=i*c-r*u,t}function qn(t,n,e){e*=.5;var r=n[0],a=n[1],o=n[2],i=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c-o*u,t[1]=a*c+i*u,t[2]=o*c+r*u,t[3]=i*c-a*u,t}function Ln(t,n,e){e*=.5;var r=n[0],a=n[1],o=n[2],i=n[3],u=Math.sin(e),c=Math.cos(e);return t[0]=r*c+a*u,t[1]=a*c-r*u,t[2]=o*c+i*u,t[3]=i*c-o*u,t}function Hn(t,n){var e=n[0],r=n[1],a=n[2];return t[0]=e,t[1]=r,t[2]=a,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-a*a)),t}function Fn(t,n){var e=n[0],r=n[1],a=n[2],o=n[3],i=Math.sqrt(e*e+r*r+a*a),u=Math.exp(o),c=i>0?u*Math.sin(i)/i:0;return t[0]=e*c,t[1]=r*c,t[2]=a*c,t[3]=u*Math.cos(i),t}function Gn(t,n){var e=n[0],r=n[1],a=n[2],o=n[3],i=Math.sqrt(e*e+r*r+a*a),u=i>0?Math.atan2(i,o)/i:0;return t[0]=e*u,t[1]=r*u,t[2]=a*u,t[3]=.5*Math.log(e*e+r*r+a*a+o*o),t}function Vn(t,n,e){return Gn(t,n),le(t,t,e),Fn(t,t),t}function Un(t,n,e,r){var a,o,i,u,c,h=n[0],s=n[1],f=n[2],l=n[3],d=e[0],p=e[1],v=e[2],m=e[3];return(o=h*d+s*p+f*v+l*m)<0&&(o=-o,d=-d,p=-p,v=-v,m=-m),1-o>Y?(a=Math.acos(o),i=Math.sin(a),u=Math.sin((1-r)*a)/i,c=Math.sin(r*a)/i):(u=1-r,c=r),t[0]=u*h+c*d,t[1]=u*s+c*p,t[2]=u*f+c*v,t[3]=u*l+c*m,t}function Zn(t){var n=X(),e=X(),r=X(),a=Math.sqrt(1-n),o=Math.sqrt(n);return t[0]=a*Math.sin(2*Math.PI*e),t[1]=a*Math.cos(2*Math.PI*e),t[2]=o*Math.sin(2*Math.PI*r),t[3]=o*Math.cos(2*Math.PI*r),t}function zn(t,n){var e=n[0],r=n[1],a=n[2],o=n[3],i=e*e+r*r+a*a+o*o,u=i?1/i:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-a*u,t[3]=o*u,t}function Qn(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t}function Jn(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var a=0;n[4]>n[0]&&(a=1),n[8]>n[3*a+a]&&(a=2);var o=(a+1)%3,i=(a+2)%3;e=Math.sqrt(n[3*a+a]-n[3*o+o]-n[3*i+i]+1),t[a]=.5*e,e=.5/e,t[3]=(n[3*o+i]-n[3*i+o])*e,t[o]=(n[3*o+a]+n[3*a+o])*e,t[i]=(n[3*i+a]+n[3*a+i])*e}return t}function Wn(t,n,e,r){var a=.5*Math.PI/180;n*=a,e*=a,r*=a;var o=Math.sin(n),i=Math.cos(n),u=Math.sin(e),c=Math.cos(e),h=Math.sin(r),s=Math.cos(r);return t[0]=o*c*s-i*u*h,t[1]=i*u*s+o*c*h,t[2]=i*c*h-o*u*s,t[3]=i*c*s+o*u*h,t}function Kn(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var $n,te,ne,ee,re,ae,oe,ie=function(t){var n=new _(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},ue=function(t,n,e,r){var a=new _(4);return a[0]=t,a[1]=n,a[2]=e,a[3]=r,a},ce=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},he=function(t,n,e,r,a){return t[0]=n,t[1]=e,t[2]=r,t[3]=a,t},se=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},fe=Nn,le=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},de=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},pe=function(t,n,e,r){var a=n[0],o=n[1],i=n[2],u=n[3];return t[0]=a+r*(e[0]-a),t[1]=o+r*(e[1]-o),t[2]=i+r*(e[2]-i),t[3]=u+r*(e[3]-u),t},ve=wn,me=ve,ge=Tn,ye=ge,Me=function(t,n){var e=n[0],r=n[1],a=n[2],o=n[3],i=e*e+r*r+a*a+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=e*i,t[1]=r*i,t[2]=a*i,t[3]=o*i,t},be=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},xe=function(t,n){var e=t[0],r=t[1],a=t[2],o=t[3],i=n[0],u=n[1],c=n[2],h=n[3];return Math.abs(e-i)<=Y*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(r-u)<=Y*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(a-c)<=Y*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-h)<=Y*Math.max(1,Math.abs(o),Math.abs(h))},Oe=($n=Yt(),te=Nt(1,0,0),ne=Nt(0,1,0),function(t,n,e){var r=an(n,e);return r<-.999999?(on($n,te,n),An($n)<1e-6&&on($n,ne,n),rn($n,$n),Yn(t,$n,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(on($n,n,e),t[0]=$n[0],t[1]=$n[1],t[2]=$n[2],t[3]=1+r,Me(t,t))}),Pe=(ee=kn(),re=kn(),function(t,n,e,r,a,o){return Un(ee,n,a,o),Un(re,e,r,o),Un(t,ee,re,2*o*(1-o)),t}),Ee=(ae=new _(9),_!=Float32Array&&(ae[1]=0,ae[2]=0,ae[3]=0,ae[5]=0,ae[6]=0,ae[7]=0),ae[0]=1,ae[4]=1,ae[8]=1,oe=ae,function(t,n,e,r){return oe[0]=e[0],oe[3]=e[1],oe[6]=e[2],oe[1]=r[0],oe[4]=r[1],oe[7]=r[2],oe[2]=-n[0],oe[5]=-n[1],oe[8]=-n[2],Me(t,Jn(t,oe))}),Se=function(){function t(){}return t.tag="c-canvas-rbush-node",t}(),Be="RBushRoot",Ce=function(){function t(){this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.enableBatch=!1,this.batchedStyleHash="",this.batchedDisplayObject=null}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(t){t.target.rBushNode=new Se,t.composedPath().slice(0,-2).forEach((function(t){e.insertRBushNode(t)}))},a=function(t){var n=t.target.rBushNode;e.rBush.remove(n.aabb)},o=function(t){var n,r=t.target;if((null===(n=r.ownerDocument)||void 0===n?void 0:n.documentElement)===e.renderingContext.root){if(t.detail.affectChildren){var a=[];r.forEach((function(t){var n=t.rBushNode;n&&e.rBush.remove(n.aabb);var r=t.getRenderBounds();if(r){var o=v(r.getMin(),2),i=o[0],u=o[1],c=v(r.getMax(),2),h=c[0],s=c[1];n.aabb={id:t.entity,minX:i,minY:u,maxX:h,maxY:s}}a.push(n.aabb)})),e.rBush.load(a)}t.composedPath().slice(0,-2).forEach((function(t){e.insertRBushNode(t)}))}};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(i.ElementEvent.UNMOUNTED,a),e.renderingContext.root.addEventListener(i.ElementEvent.BOUNDS_CHANGED,o)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(i.ElementEvent.UNMOUNTED,a),e.renderingContext.root.removeEventListener(i.ElementEvent.BOUNDS_CHANGED,o)})),t.hooks.beginFrame.tap(n.tag,(function(){var t=e.contextService.getContext(),n=e.canvasConfig.renderer.getConfig(),r=n.enableDirtyRectangleRendering;n.enableDirtyRectangleRenderingDebug;e.clearFullScreen=!r||e.renderingContext.renderReasons.has(i.RENDER_REASON.CameraChanged),t&&(t.save(),e.clearFullScreen&&t.clearRect(0,0,e.canvasConfig.width,e.canvasConfig.height),e.applyTransform(t,e.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(n.tag,(function(){var n=e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering,r=e.contextService.getContext();if(n){var a=e.safeMergeAABB.apply(e,function(t,n,e){if(e||2===arguments.length)for(var r,a=0,o=n.length;a<o;a++)!r&&a in n||(r||(r=Array.prototype.slice.call(n,0,a)),r[a]=n[a]);return t.concat(r||Array.prototype.slice.call(n))}([e.mergeDirtyAABBs(e.renderQueue)],v(e.renderingContext.removedRenderBoundsList),!1));if(e.renderingContext.removedRenderBoundsList=[],!a)return;var o=e.convertAABB2Rect(a),i=o.x,u=o.y,c=o.width,h=o.height;r.clearRect(i,u,c,h),r.beginPath(),r.rect(i,u,c,h),r.clip(),e.searchDirtyObjects(a).sort(e.sceneGraphService.sort).forEach((function(n){n.isVisible()&&e.renderDisplayObject(n,t)})),e.enableBatch&&e.batchedStyleHash&&e.flush(r,t),e.renderQueue.forEach((function(t){e.saveDirtyAABB(t)})),e.renderQueue=[]}e.restoreStack.forEach((function(t){r.restore()})),e.restoreStack=[],r.restore()})),t.hooks.render.tap(n.tag,(function(n){e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering?e.renderQueue.push(n):e.renderDisplayObject(n,t)}))},t.prototype.flush=function(t,n){if(this.batchedDisplayObject){var e=this.styleRendererFactory(this.batchedDisplayObject.nodeName);e&&(this.applyAttributesToContext(t,this.batchedDisplayObject,n),t.closePath(),e.render(t,this.batchedDisplayObject.parsedStyle,this.batchedDisplayObject),t.restore()),this.batchedStyleHash="",this.batchedDisplayObject=null}},t.prototype.renderDisplayObject=function(t,n){for(var e=this,r=this.contextService.getContext(),a=this.restoreStack[this.restoreStack.length-1];a&&t.parentNode!==a;)r.restore(),this.restoreStack.pop(),a=this.restoreStack[this.restoreStack.length-1];var o=t.nodeName,u=this.styleRendererFactory(o),c=!1;if(this.enableBatch&&u){var h=u.hash(t.attributes);this.batchedStyleHash&&h!==this.batchedStyleHash&&this.flush(r,n),this.batchedStyleHash||(this.batchedStyleHash=h,this.batchedDisplayObject=t,c=!0)}r.save(),this.applyTransform(r,t.getLocalTransform());var s=t.style.clipPath;if(s){r.save(),this.applyTransform(r,s.getLocalTransform());var f=this.pathGeneratorFactory(s.nodeName);f&&this.useAnchor(r,s,(function(){r.beginPath(),f(r,s.parsedStyle),r.closePath()})),r.restore(),r.clip()}this.enableBatch||(r.save(),this.applyAttributesToContext(r,t,n)),this.useAnchor(r,t,(function(){var n=e.pathGeneratorFactory(t.nodeName);n&&(!c&&e.enableBatch||r.beginPath(),n(r,t.parsedStyle),e.enableBatch||t.nodeName===i.SHAPE.Line||t.nodeName===i.SHAPE.Path||t.nodeName===i.SHAPE.Polyline||r.closePath()),u&&!e.enableBatch&&u.render(r,t.parsedStyle,t)})),this.enableBatch||r.restore(),t.renderable.dirty=!1,this.restoreStack.push(t)},t.prototype.convertAABB2Rect=function(t){var n=t.getMin(),e=t.getMax(),r=Math.floor(n[0]),a=Math.floor(n[1]);return{x:r,y:a,width:Math.ceil(e[0])-r,height:Math.ceil(e[1])-a}},t.prototype.insertRBushNode=function(t){var n=t.rBushNode;if(n){this.rBush.remove(n.aabb);var e=t.getRenderBounds();if(e){var r=v(e.getMin(),2),a=r[0],o=r[1],i=v(e.getMax(),2),u=i[0],c=i[1];n.aabb={id:t.entity,minX:a,minY:o,maxX:u,maxY:c}}this.rBush.insert(n.aabb)}},t.prototype.mergeDirtyAABBs=function(t){var n;return t.forEach((function(t){var e=t.getRenderBounds();e&&(n?n.add(e):n=new i.AABB(e.center,e.halfExtents));var r=t.renderable.dirtyRenderBounds;r&&(n?n.add(r):n=new i.AABB(r.center,r.halfExtents))})),n},t.prototype.searchDirtyObjects=function(t){var n=this,e=v(t.getMin(),2),r=e[0],a=e[1],o=v(t.getMax(),2),i=o[0],u=o[1];return this.rBush.search({minX:r,minY:a,maxX:i,maxY:u}).map((function(t){var e=t.id;return n.displayObjectPool.getByEntity(e)}))},t.prototype.saveDirtyAABB=function(t){var n=t.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new i.AABB);var e=t.getRenderBounds();e&&n.dirtyRenderBounds.update(e.center,e.halfExtents)},t.prototype.applyTransform=function(t,n){var e=v(r.getTranslation(a.create(),n),2),u=e[0],c=e[1],h=v(r.getScaling(a.create(),n),2),s=h[0],f=h[1],l=r.getRotation(o.create(),n),d=v(Object(i.getEuler)(a.create(),l),3),p=d[0],m=(d[1],d[2]),g=Object(i.fromRotationTranslationScale)(p||m,u,c,s,f);t.transform(g[0],g[1],g[3],g[4],g[6],g[7])},t.prototype.getColor=function(t,n,e,r){var a;if(t.type===i.PARSED_COLOR_TYPE.LinearGradient||t.type===i.PARSED_COLOR_TYPE.RadialGradient){var o=n.getGeometryBounds(),u=o&&2*o.halfExtents[0]||0,c=o&&2*o.halfExtents[1]||0;a=this.gradientPool.getOrCreateGradient(l(l({type:t.type},t.value),{width:u,height:c}),e)}else if(t.type===i.PARSED_COLOR_TYPE.Pattern){var h=this.imagePool.getPatternSync(t.value);h?a=h:this.imagePool.createPattern(t.value,e).then((function(){n.renderable.dirty=!0,r.dirtify()}))}else a=t.formatted;return a},t.prototype.applyAttributesToContext=function(t,n,e){var r=n.parsedStyle,a=r.stroke,o=r.fill,i=r.opacity,u=r.lineDash,c=r.lineDashOffset,h=r.filter,s=r.shadowColor,f=r.shadowBlur,l=r.shadowOffsetX,d=r.shadowOffsetY;u&&b(u)&&t.setLineDash(u),M(c)||(t.lineDashOffset=c),M(i)||(t.globalAlpha*=i),M(a)||(t.strokeStyle=this.getColor(a,n,t,e)),M(o)||(t.fillStyle=this.getColor(o,n,t,e)),M(h)||(t.filter=n.style.filter),M(s)||(t.shadowColor=s.formatted,t.shadowBlur=f,t.shadowOffsetX=l,t.shadowOffsetY=d)},t.prototype.useAnchor=function(t,n,e){var r=n.getGeometryBounds();if(r){var a=r.halfExtents,o=(n.parsedStyle||{}).anchor,i=void 0===o?[0,0]:o;t.translate(-i[0]*a[0]*2,-i[1]*a[1]*2),e()}else e()},t.prototype.safeMergeAABB=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.forEach((function(n){n&&(t?t.add(n):t=n)})),t},t.tag="CanvasRendererPlugin",d([Object(u.inject)(i.CanvasConfig),p("design:type",Object)],t.prototype,"canvasConfig",void 0),d([Object(u.inject)(i.DefaultCamera),p("design:type",i.Camera)],t.prototype,"camera",void 0),d([Object(u.inject)(i.ContextService),p("design:type",Object)],t.prototype,"contextService",void 0),d([Object(u.inject)(i.SceneGraphService),p("design:type",Object)],t.prototype,"sceneGraphService",void 0),d([Object(u.inject)(i.RenderingContext),p("design:type",Object)],t.prototype,"renderingContext",void 0),d([Object(u.inject)(j),p("design:type",j)],t.prototype,"imagePool",void 0),d([Object(u.inject)(T),p("design:type",T)],t.prototype,"gradientPool",void 0),d([Object(u.inject)(k),p("design:type",Function)],t.prototype,"pathGeneratorFactory",void 0),d([Object(u.inject)(s),p("design:type",Function)],t.prototype,"styleRendererFactory",void 0),d([Object(u.inject)(i.DisplayObjectPool),p("design:type",i.DisplayObjectPool)],t.prototype,"displayObjectPool",void 0),d([Object(u.inject)(Be),p("design:type",h.a)],t.prototype,"rBush",void 0),t=n=d([Object(u.singleton)({contrib:i.RenderingPluginContribution})],t)}(),Ae=function(){function t(){}var n;return n=t,t.prototype.apply=function(t){var e=this,r=function(n){var r=n.target,a=r.nodeName,o=r.attributes;if(a===i.SHAPE.Image){var u=o.img;E(u)&&e.imagePool.getOrCreateImage(u).then((function(){r.renderable.dirty=!0,t.dirtify()}))}},a=function(n){var r=n.target,a=n.detail,o=a.attributeName,u=a.newValue;r.nodeName===i.SHAPE.Image&&"img"===o&&E(u)&&e.imagePool.getOrCreateImage(u).then((function(){r.renderable.dirty=!0,t.dirtify()}))};t.hooks.init.tap(n.tag,(function(){e.renderingContext.root.addEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.addEventListener(i.ElementEvent.ATTRIBUTE_CHANGED,a)})),t.hooks.destroy.tap(n.tag,(function(){e.renderingContext.root.removeEventListener(i.ElementEvent.MOUNTED,r),e.renderingContext.root.removeEventListener(i.ElementEvent.ATTRIBUTE_CHANGED,a)}))},t.tag="LoadImagePlugin",d([Object(u.inject)(j),p("design:type",j)],t.prototype,"imagePool",void 0),d([Object(u.inject)(i.RenderingContext),p("design:type",Object)],t.prototype,"renderingContext",void 0),t=n=d([Object(u.singleton)({contrib:i.RenderingPluginContribution})],t)}();i.globalContainer.register({token:{token:D,named:i.SHAPE.Circle},useValue:function(t,n){var e=n.r,r=void 0===e?0:e;t.arc(r,r,r,0,2*Math.PI,!1)}}),i.globalContainer.register({token:{token:D,named:i.SHAPE.Ellipse},useValue:function(t,n){var e=n.rx,r=n.ry;if(t.ellipse)t.ellipse(e,r,e,r,0,0,2*Math.PI,!1);else{var a=e>r?e:r,o=e>r?1:e/r,i=e>r?r/e:1;t.save(),t.scale(o,i),t.arc(0,0,a,0,2*Math.PI)}}}),i.globalContainer.register({token:{token:D,named:i.SHAPE.Rect},useValue:function(t,n){var e=n.radius,r=void 0===e?0:e,a=n.width,o=void 0===a?0:a,i=n.height,u=void 0===i?0:i;if(0===r)t.rect(0,0,o,u);else{var c=v(function(t){var n=0,e=0,r=0,a=0;return b(t)?1===t.length?n=e=r=a=t[0]:2===t.length?(n=r=t[0],e=a=t[1]):3===t.length?(n=t[0],e=a=t[1],r=t[2]):(n=t[0],e=t[1],r=t[2],a=t[3]):n=e=r=a=t,[n,e,r,a]}(r),4),h=c[0],s=c[1],f=c[2],l=c[3];t.moveTo(h,0),t.lineTo(o-s,0),0!==s&&t.arc(o-s,s,s,-Math.PI/2,0),t.lineTo(o,u-f),0!==f&&t.arc(o-f,u-f,f,0,Math.PI/2),t.lineTo(l,u),0!==l&&t.arc(l,u-l,l,Math.PI/2,Math.PI),t.lineTo(0,h),0!==h&&t.arc(h,h,h,Math.PI,1.5*Math.PI)}}}),i.globalContainer.register({token:{token:D,named:i.SHAPE.Line},useValue:function(t,n){var e=n.x1,r=n.y1,a=n.x2,o=n.y2,i=n.defX,u=void 0===i?0:i,c=n.defY,h=void 0===c?0:c;t.moveTo(e-u,r-h),t.lineTo(a-u,o-h)}}),i.globalContainer.register({token:{token:D,named:i.SHAPE.Polyline},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,a=n.defY,o=void 0===a?0:a,i=n.points.points,u=i.length,c=i[0][0]-r,h=i[0][1]-o,s=i[u-1][0]-r,f=i[u-1][1]-o;t.moveTo(c,h);for(var l=0;l<u-1;l++){var d=i[l];t.lineTo(d[0]-r,d[1]-o)}t.lineTo(s,f)}}),i.globalContainer.register({token:{token:D,named:i.SHAPE.Polygon},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,a=n.defY,o=void 0===a?0:a,i=n.points.points,u=i.length,c=i[0][0]-r,h=i[0][1]-o,s=i[u-1][0]-r,f=i[u-1][1]-o;t.moveTo(c,h);for(var l=0;l<u-1;l++){var d=i[l];t.lineTo(d[0]-r,d[1]-o)}t.lineTo(s,f)}}),i.globalContainer.register({token:{token:D,named:i.SHAPE.Path},useValue:function(t,n){var e=n.defX,r=void 0===e?0:e,a=n.defY,o=void 0===a?0:a,i=n.path,u=i.curve,c=i.zCommandIndexes,h=u;c.forEach((function(t,n){h.splice(t+n,0,["Z"])}));for(var s=[-r,-o],f=0;f<h.length;f++){var l=h[f],d=l[0];switch(d){case"M":t.moveTo(l[1]-r,l[2]-o),s=[l[1]-r,l[2]-o];break;case"C":t.bezierCurveTo(l[1]-r,l[2]-o,l[3]-r,l[4]-o,l[5]-r,l[6]-o);break;case"Z":t.closePath()}if("Z"===d)s;else{var p=l.length;[l[p-2]-r,l[p-1]-o]}}}}),i.globalContainer.register({token:k,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(D,e)&&(n[e]=t.container.getNamed(D,e)),n[e]}}});var je=Object(u.Module)((function(t){t(j),t({token:Be,useValue:new h.a}),t(A),t(R),t(w),t({token:s,useFactory:function(t){var n={};return function(e){return n[e]||t.container.isBoundNamed(f,e)&&(n[e]=t.container.getNamed(f,e)),n[e]}}}),t(T),t(Ce),t(Ae)})),Re=function(){function t(){}return t.prototype.init=function(t){t.load(je,!0)},t.prototype.destroy=function(t){t.remove(j),t.remove(Be),t.remove(A),t.remove(R),t.remove(w),t.remove(f),t.remove(s),t.remove(T),t.remove(Ce),t.remove(Ae)},t}()}])}));

@@ -27,7 +27,7 @@ import { RenderingService, RenderingPlugin } from '@antv/g';

private clearFullScreen;
/**
* save the last dirty rect in DEBUG mode
*/
private lastDirtyRectangle;
private enableBatch;
private batchedStyleHash;
private batchedDisplayObject;
apply(renderingService: RenderingService): void;
private flush;
private renderDisplayObject;

@@ -44,4 +44,4 @@ private convertAABB2Rect;

private saveDirtyAABB;
private drawDirtyRectangle;
private applyTransform;
private getColor;
private applyAttributesToContext;

@@ -48,0 +48,0 @@ private useAnchor;

import { __assign, __decorate, __metadata, __read, __spreadArray } from "tslib";
import { AABB, DisplayObjectPool, CanvasConfig, ContextService, SceneGraphService, Renderable, RenderingContext, RenderingPluginContribution, getEuler, fromRotationTranslationScale, Camera, DefaultCamera, PARSED_COLOR_TYPE, RENDER_REASON, ElementEvent } from '@antv/g';
import { isArray } from '@antv/util';
import { AABB, SHAPE, DisplayObjectPool, CanvasConfig, ContextService, SceneGraphService, RenderingContext, RenderingPluginContribution, getEuler, fromRotationTranslationScale, Camera, DefaultCamera, PARSED_COLOR_TYPE, RENDER_REASON, ElementEvent } from '@antv/g';
import { isArray, isNil } from '@antv/util';
import { inject, singleton } from 'mana-syringe';

@@ -13,7 +13,2 @@ import { vec3, mat4, quat } from 'gl-matrix';

export var RBushRoot = 'RBushRoot';
var SHAPE_ATTRS_MAP = {
fill: 'fillStyle',
stroke: 'strokeStyle',
opacity: 'globalAlpha'
};
/**

@@ -32,2 +27,5 @@ * support 2 modes in rendering:

this.clearFullScreen = false;
this.enableBatch = false;
this.batchedStyleHash = '';
this.batchedDisplayObject = null;
}

@@ -41,32 +39,23 @@

var handleMounted = function handleMounted(e) {
// const { enableDirtyRectangleRendering } = this.canvasConfig.renderer.getConfig();
// if (!enableDirtyRectangleRendering) {
// return;
// }
var object = e.target;
object.entity.addComponent(RBushNode);
handleBoundsChanged(e);
var object = e.target; // @ts-ignore
object.rBushNode = new RBushNode();
var path = e.composedPath().slice(0, -2);
path.forEach(function (node) {
_this.insertRBushNode(node);
});
};
var handleUnmounted = function handleUnmounted(e) {
// const { enableDirtyRectangleRendering } = this.canvasConfig.renderer.getConfig();
// if (!enableDirtyRectangleRendering) {
// return;
// }
var object = e.target; // remove r-bush node
// @ts-ignore
var rBushNode = object.entity.getComponent(RBushNode);
var rBushNode = object.rBushNode;
_this.rBush.remove(rBushNode.aabb); // this.rBush.remove(rBushNode.aabb, (a: RBushNodeAABB, b: RBushNodeAABB) => a.name === b.name);
// object.entity.removeComponent(RBushNode);
object.entity.removeComponent(RBushNode);
};
var handleBoundsChanged = function handleBoundsChanged(e) {
// const { enableDirtyRectangleRendering } = this.canvasConfig.renderer.getConfig();
// // don not use rbush when dirty-rectangle rendering disabled
// if (!enableDirtyRectangleRendering) {
// return;
// }
var _a;

@@ -78,5 +67,45 @@

return;
} // skip Document & Canvas
}
var affectChildren = e.detail.affectChildren;
if (affectChildren) {
// bounds changed, need re-inserting its children
var bulk_1 = [];
object.forEach(function (node) {
// @ts-ignore
var rBushNode = node.rBushNode; // clear dirty node
if (rBushNode) {
_this.rBush.remove(rBushNode.aabb);
}
var renderBounds = node.getRenderBounds();
if (renderBounds) {
var _a = __read(renderBounds.getMin(), 2),
minX = _a[0],
minY = _a[1];
var _b = __read(renderBounds.getMax(), 2),
maxX = _b[0],
maxY = _b[1];
rBushNode.aabb = {
id: node.entity,
minX: minX,
minY: minY,
maxX: maxX,
maxY: maxY
};
}
bulk_1.push(rBushNode.aabb);
}); // use bulk inserting, which is ~2-3 times faster
// @see https://github.com/mourner/rbush#bulk-inserting-data
_this.rBush.load(bulk_1);
} // inform parent, skip Document & Canvas
var path = e.composedPath().slice(0, -2);

@@ -89,10 +118,2 @@ path.forEach(function (node) {

renderingService.hooks.init.tap(CanvasRendererPlugin_1.tag, function () {
var context = _this.contextService.getContext();
var dpr = _this.contextService.getDPR(); // scale all drawing operations by the dpr
// @see https://www.html5rocks.com/en/tutorials/canvas/hidpi/
context && context.scale(dpr, dpr);
_this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);

@@ -176,4 +197,9 @@

}
}); // save dirty AABBs in last frame
});
if (_this.enableBatch && _this.batchedStyleHash) {
_this.flush(context, renderingService);
} // save dirty AABBs in last frame
_this.renderQueue.forEach(function (object) {

@@ -209,2 +235,20 @@ _this.saveDirtyAABB(object);

CanvasRendererPlugin.prototype.flush = function (context, renderingService) {
if (this.batchedDisplayObject) {
var styleRenderer = this.styleRendererFactory(this.batchedDisplayObject.nodeName);
if (styleRenderer) {
// apply attributes to context
this.applyAttributesToContext(context, this.batchedDisplayObject, renderingService); // close path first
context.closePath();
styleRenderer.render(context, this.batchedDisplayObject.parsedStyle, this.batchedDisplayObject);
context.restore();
}
this.batchedStyleHash = '';
this.batchedDisplayObject = null;
}
};
CanvasRendererPlugin.prototype.renderDisplayObject = function (object, renderingService) {

@@ -223,4 +267,21 @@ var _this = this;

var nodeName = object.nodeName; // reset transformation
var nodeName = object.nodeName;
var styleRenderer = this.styleRendererFactory(nodeName);
var startBatch = false;
if (this.enableBatch && styleRenderer) {
var hash = styleRenderer.hash(object.attributes);
if (this.batchedStyleHash && hash !== this.batchedStyleHash) {
this.flush(context, renderingService);
}
if (!this.batchedStyleHash) {
this.batchedStyleHash = hash;
this.batchedDisplayObject = object;
startBatch = true;
}
} // reset transformation
context.save(); // apply RTS transformation in world space

@@ -241,3 +302,5 @@

this.useAnchor(context, clipPathShape, function () {
context.beginPath();
generatePath_1(context, clipPathShape.parsedStyle);
context.closePath();
});

@@ -248,8 +311,12 @@ }

context.clip();
} // apply attributes to context
} // fill & stroke
context.save();
this.applyAttributesToContext(context, object, renderingService); // apply anchor in local space
if (!this.enableBatch) {
context.save(); // apply attributes to context
this.applyAttributesToContext(context, object, renderingService);
} // apply anchor in local space
this.useAnchor(context, object, function () {

@@ -260,9 +327,15 @@ // generate path in local space

if (generatePath) {
if (startBatch || !_this.enableBatch) {
context.beginPath();
}
generatePath(context, object.parsedStyle);
if (!_this.enableBatch && object.nodeName !== SHAPE.Line && object.nodeName !== SHAPE.Path && object.nodeName !== SHAPE.Polyline) {
context.closePath();
}
} // fill & stroke
var styleRenderer = _this.styleRendererFactory(nodeName);
if (styleRenderer) {
if (styleRenderer && !_this.enableBatch) {
styleRenderer.render(context, object.parsedStyle, object);

@@ -272,6 +345,8 @@ }

context.restore(); // finish rendering, clear dirty flag
if (!this.enableBatch) {
context.restore();
} // finish rendering, clear dirty flag
var renderable = object.entity.getComponent(Renderable);
renderable.dirty = false;
object.renderable.dirty = false;
this.restoreStack.push(object);

@@ -300,3 +375,4 @@ };

CanvasRendererPlugin.prototype.insertRBushNode = function (object) {
var rBushNode = object.entity.getComponent(RBushNode);
// @ts-ignore
var rBushNode = object.rBushNode;

@@ -319,3 +395,3 @@ if (rBushNode) {

rBushNode.aabb = {
name: object.entity.getName(),
id: object.entity,
minX: minX,

@@ -353,3 +429,3 @@ minY: minY,

var dirtyRenderBounds = object.entity.getComponent(Renderable).dirtyRenderBounds;
var dirtyRenderBounds = object.renderable.dirtyRenderBounds;

@@ -386,4 +462,4 @@ if (dirtyRenderBounds) {

return rBushNodes.map(function (_a) {
var name = _a.name;
return _this.displayObjectPool.getByName(name);
var id = _a.id;
return _this.displayObjectPool.getByEntity(id);
});

@@ -393,3 +469,3 @@ };

CanvasRendererPlugin.prototype.saveDirtyAABB = function (object) {
var renderable = object.entity.getComponent(Renderable);
var renderable = object.renderable;

@@ -408,14 +484,2 @@ if (!renderable.dirtyRenderBounds) {

CanvasRendererPlugin.prototype.drawDirtyRectangle = function (context, _a) {
var x = _a.x,
y = _a.y,
width = _a.width,
height = _a.height;
context.beginPath();
context.rect(x + 1, y + 1, width - 1, height - 1);
context.closePath();
context.lineWidth = 1;
context.stroke();
};
CanvasRendererPlugin.prototype.applyTransform = function (context, transform) {

@@ -443,57 +507,80 @@ var _a = __read(mat4.getTranslation(vec3.create(), transform), 2),

CanvasRendererPlugin.prototype.applyAttributesToContext = function (context, object, renderingService) {
var attributes = object.attributes,
parsedStyle = object.parsedStyle;
CanvasRendererPlugin.prototype.getColor = function (parsedColor, object, context, renderingService) {
var color;
for (var k in attributes) {
// reserved keywords in Canvas2DContext
if (k === 'transform') {
continue;
if (parsedColor.type === PARSED_COLOR_TYPE.LinearGradient || parsedColor.type === PARSED_COLOR_TYPE.RadialGradient) {
var bounds = object.getGeometryBounds();
var width = bounds && bounds.halfExtents[0] * 2 || 0;
var height = bounds && bounds.halfExtents[1] * 2 || 0;
color = this.gradientPool.getOrCreateGradient(__assign(__assign({
type: parsedColor.type
}, parsedColor.value), {
width: width,
height: height
}), context);
} else if (parsedColor.type === PARSED_COLOR_TYPE.Pattern) {
var pattern = this.imagePool.getPatternSync(parsedColor.value);
if (pattern) {
color = pattern;
} else {
this.imagePool.createPattern(parsedColor.value, context).then(function () {
// set dirty rectangle flag
object.renderable.dirty = true;
renderingService.dirtify();
});
}
} else {
// constant, eg. rgba(255,255,255,1)
color = parsedColor.formatted;
}
var v = attributes[k]; // 转换一下不与 canvas 兼容的属性名
return color;
};
var name_1 = SHAPE_ATTRS_MAP[k] ? SHAPE_ATTRS_MAP[k] : k;
CanvasRendererPlugin.prototype.applyAttributesToContext = function (context, object, renderingService) {
var _a = object.parsedStyle,
stroke = _a.stroke,
fill = _a.fill,
opacity = _a.opacity,
lineDash = _a.lineDash,
lineDashOffset = _a.lineDashOffset,
filter = _a.filter,
shadowColor = _a.shadowColor,
shadowBlur = _a.shadowBlur,
shadowOffsetX = _a.shadowOffsetX,
shadowOffsetY = _a.shadowOffsetY; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash
if (name_1 === 'lineDash' && context.setLineDash) {
isArray(v) && context.setLineDash(v);
} else {
if (name_1 === 'strokeStyle' || name_1 === 'fillStyle') {
var parsedColor = parsedStyle[k];
if (lineDash && isArray(lineDash)) {
context.setLineDash(lineDash);
} // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/lineDashOffset
if (parsedColor.type === PARSED_COLOR_TYPE.LinearGradient || parsedColor.type === PARSED_COLOR_TYPE.RadialGradient) {
var bounds = object.getGeometryBounds();
var width = bounds && bounds.halfExtents[0] * 2 || 0;
var height = bounds && bounds.halfExtents[1] * 2 || 0;
v = this.gradientPool.getOrCreateGradient(__assign(__assign({
type: parsedColor.type
}, parsedColor.value), {
width: width,
height: height
}), context);
} else if (parsedColor.type === PARSED_COLOR_TYPE.Pattern) {
var pattern = this.imagePool.getPatternSync(parsedColor.value);
if (pattern) {
v = pattern;
} else {
this.imagePool.createPattern(parsedColor.value, context).then(function () {
// set dirty rectangle flag
object.entity.getComponent(Renderable).dirty = true;
renderingService.dirtify();
});
}
} else {
// constant, eg. rgba(255,255,255,1)
v = parsedColor.formatted;
}
} else if (name_1 === 'globalAlpha') {
// opacity 效果可以叠加,子元素的 opacity 需要与父元素 opacity 相乘
v = v * context.globalAlpha;
} // @ts-ignore
if (!isNil(lineDashOffset)) {
context.lineDashOffset = lineDashOffset;
}
if (!isNil(opacity)) {
context.globalAlpha *= opacity;
}
context[name_1] = v;
}
if (!isNil(stroke)) {
context.strokeStyle = this.getColor(stroke, object, context, renderingService);
}
if (!isNil(fill)) {
context.fillStyle = this.getColor(fill, object, context, renderingService);
}
if (!isNil(filter)) {
// use raw filter string
context.filter = object.style.filter;
}
if (!isNil(shadowColor)) {
context.shadowColor = shadowColor.formatted;
context.shadowBlur = shadowBlur;
context.shadowOffsetX = shadowOffsetX;
context.shadowOffsetY = shadowOffsetY;
}
};

@@ -505,12 +592,9 @@

if (contentBounds) {
var halfExtents = contentBounds.halfExtents;
context.save(); // apply anchor, use true size, not include stroke,
var halfExtents = contentBounds.halfExtents; // apply anchor, use true size, not include stroke,
// eg. bounds = true size + half lineWidth
var _a = (object.parsedStyle || {}).anchor,
anchor = _a === void 0 ? [0, 0] : _a; // context.translate(-anchor[0] * width, -anchor[1] * height);
anchor = _a === void 0 ? [0, 0] : _a;
context.translate(-anchor[0] * halfExtents[0] * 2, -anchor[1] * halfExtents[1] * 2);
callback();
context.restore();
} else {

@@ -517,0 +601,0 @@ callback();

@@ -1,4 +0,3 @@

import { Component } from '@antv/g';
export interface RBushNodeAABB {
name: string;
id: number;
minX: number;

@@ -9,5 +8,5 @@ minY: number;

}
export declare class RBushNode extends Component {
export declare class RBushNode {
static tag: string;
aabb: RBushNodeAABB;
}

@@ -1,17 +0,10 @@

import { __extends } from "tslib";
import { Component } from '@antv/g';
var RBushNode =
/** @class */
function (_super) {
__extends(RBushNode, _super);
function () {
function RBushNode() {}
function RBushNode() {
return _super !== null && _super.apply(this, arguments) || this;
}
RBushNode.tag = 'c-canvas-rbush-node';
return RBushNode;
}(Component);
}();
export { RBushNode };

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

import { SHAPE, world, globalContainer } from '@antv/g';
import { SHAPE, globalContainer } from '@antv/g';
import { Module } from 'mana-syringe';

@@ -14,3 +14,2 @@ import RBush from 'rbush';

export { PathGeneratorFactory, PathGenerator, StyleRenderer, RBushNode, RBushRoot, RBush };
world.registerComponent(RBushNode);
/**

@@ -17,0 +16,0 @@ * register shape renderers

import { __decorate, __metadata } from "tslib";
import { inject, singleton } from 'mana-syringe';
import { SHAPE, RenderingPluginContribution, Renderable, RenderingContext, ElementEvent } from '@antv/g';
import { SHAPE, RenderingPluginContribution, RenderingContext, ElementEvent } from '@antv/g';
import { ImagePool } from './shapes/ImagePool';

@@ -28,3 +28,3 @@ import { isString } from '@antv/util';

// set dirty rectangle flag
object.entity.getComponent(Renderable).dirty = true;
object.renderable.dirty = true;
renderingService.dirtify();

@@ -47,3 +47,3 @@ });

// set dirty rectangle flag
object.entity.getComponent(Renderable).dirty = true;
object.renderable.dirty = true;
renderingService.dirtify();

@@ -50,0 +50,0 @@ });

export function generatePath(context, parsedStyle) {
context.beginPath();
var _a = parsedStyle.r,
r = _a === void 0 ? 0 : _a;
context.arc(r, r, r, 0, Math.PI * 2, false);
r = _a === void 0 ? 0 : _a; // context.save();
// context.moveTo(2 * r, r);
context.arc(r, r, r, 0, Math.PI * 2, false); // context.restore();
}
export function generatePath(context, attributes) {
var rx = attributes.rx,
ry = attributes.ry;
context.beginPath(); // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/ellipse
ry = attributes.ry; // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/ellipse

@@ -16,5 +15,3 @@ if (context.ellipse) {

context.arc(0, 0, r, 0, Math.PI * 2);
context.closePath();
context.restore();
}
}

@@ -10,5 +10,4 @@ export function generatePath(context, parsedStyle) {

defY = _b === void 0 ? 0 : _b;
context.beginPath();
context.moveTo(x1 - defX, y1 - defY);
context.lineTo(x2 - defX, y2 - defY);
}

@@ -17,4 +17,2 @@ export function generatePath(context, parsedStyle) {

context.beginPath();
for (var i = 0; i < path.length; i++) {

@@ -21,0 +19,0 @@ var params = path[i]; // eg. M 100 200

@@ -12,3 +12,2 @@ export function generatePath(context, parsedStyle) {

var y2 = points[length - 1][1] - y;
context.beginPath();
context.moveTo(x1, y1);

@@ -22,3 +21,2 @@

context.lineTo(x2, y2);
context.closePath();
}

@@ -12,3 +12,2 @@ export function generatePath(context, parsedStyle) {

var y2 = points[length - 1][1] - y;
context.beginPath();
context.moveTo(x1, y1);

@@ -15,0 +14,0 @@

@@ -10,3 +10,2 @@ import { __read } from "tslib";

height = _c === void 0 ? 0 : _c;
context.beginPath();

@@ -31,4 +30,3 @@ if (radius === 0) {

r1 !== 0 && context.arc(r1, r1, r1, Math.PI, Math.PI * 1.5);
context.closePath();
}
}
import { ParsedBaseStyleProps } from '@antv/g';
import { StyleRenderer } from './interfaces';
export declare class DefaultRenderer implements StyleRenderer {
hash(parsedStyle: ParsedBaseStyleProps): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedBaseStyleProps): void;
}

@@ -12,2 +12,15 @@ import { __decorate } from "tslib";

DefaultRenderer.prototype.hash = function (parsedStyle) {
var fill = parsedStyle.fill,
opacity = parsedStyle.opacity,
fillOpacity = parsedStyle.fillOpacity,
stroke = parsedStyle.stroke,
strokeOpacity = parsedStyle.strokeOpacity,
lineWidth = parsedStyle.lineWidth,
lineCap = parsedStyle.lineCap,
lineJoin = parsedStyle.lineJoin; // return fill + opacity + fillOpacity + stroke + strokeOpacity + lineWidth + lineCap + lineJoin;
return '';
};
DefaultRenderer.prototype.render = function (context, parsedStyle) {

@@ -21,3 +34,5 @@ var fill = parsedStyle.fill,

lineCap = parsedStyle.lineCap,
lineJoin = parsedStyle.lineJoin;
lineJoin = parsedStyle.lineJoin,
shadowColor = parsedStyle.shadowColor,
filter = parsedStyle.filter;

@@ -50,19 +65,29 @@ if (!isNil(fill)) {

context.lineJoin = lineJoin;
} // prevent inner shadow when drawing stroke, toggle shadowBlur & filter(drop-shadow)
// save shadow blur
}
var oldShadowBlur = void 0;
var oldShadowColor = void 0;
var oldFilter = void 0;
var hasShadowColor = !isNil(shadowColor);
var hasFilter = !isNil(filter);
var shadowBlur = context.shadowBlur;
var shadowColor = context.shadowColor;
if (hasShadowColor) {
// prevent inner shadow when drawing stroke, toggle shadowBlur & filter(drop-shadow)
// save shadow blur
oldShadowBlur = context.shadowBlur;
oldShadowColor = context.shadowColor;
if (!isNil(shadowBlur)) {
context.shadowColor = 'transparent';
context.shadowBlur = 0;
} // save drop-shadow filter
if (!isNil(oldShadowBlur)) {
context.shadowColor = 'transparent';
context.shadowBlur = 0;
}
}
if (hasFilter) {
// save drop-shadow filter
oldFilter = context.filter;
var filter = context.filter;
if (!isNil(filter) && filter.indexOf('drop-shadow') > -1) {
context.filter = filter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none';
if (!isNil(oldFilter) && oldFilter.indexOf('drop-shadow') > -1) {
context.filter = oldFilter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none';
}
}

@@ -72,10 +97,10 @@

if (!isNil(shadowBlur)) {
context.shadowColor = shadowColor;
context.shadowBlur = shadowBlur;
if (hasShadowColor) {
context.shadowColor = oldShadowColor;
context.shadowBlur = oldShadowBlur;
} // restore filters
if (!isNil(filter)) {
context.filter = filter;
if (hasFilter) {
context.filter = oldFilter;
}

@@ -82,0 +107,0 @@ }

@@ -5,3 +5,4 @@ import { ParsedImageStyleProps } from '@antv/g';

private imagePool;
hash(parsedStyle: ParsedImageStyleProps): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedImageStyleProps): void;
}

@@ -13,2 +13,6 @@ import { __decorate, __metadata } from "tslib";

ImageRenderer.prototype.hash = function (parsedStyle) {
return '';
};
ImageRenderer.prototype.render = function (context, parsedStyle) {

@@ -15,0 +19,0 @@ var _a = parsedStyle.width,

@@ -6,3 +6,4 @@ import type { ParsedBaseStyleProps, DisplayObject } from '@antv/g';

export interface StyleRenderer {
hash(parsedStyle: ParsedBaseStyleProps): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedBaseStyleProps, object: DisplayObject): void;
}

@@ -5,2 +5,3 @@ import { ParsedTextStyleProps } from '@antv/g';

private textService;
hash(parsedStyle: any): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedTextStyleProps): void;

@@ -7,0 +8,0 @@ private drawLetterSpacing;

@@ -12,2 +12,6 @@ import { __decorate, __metadata } from "tslib";

TextRenderer.prototype.hash = function (parsedStyle) {
return '';
};
TextRenderer.prototype.render = function (context, parsedStyle) {

@@ -39,2 +43,3 @@ var _a = parsedStyle.text,

context.lineWidth = lineWidth;
context.textAlign = textAlign;
context.textBaseline = textBaseline;

@@ -41,0 +46,0 @@ context.lineJoin = lineJoin;

@@ -27,7 +27,7 @@ import { RenderingService, RenderingPlugin } from '@antv/g';

private clearFullScreen;
/**
* save the last dirty rect in DEBUG mode
*/
private lastDirtyRectangle;
private enableBatch;
private batchedStyleHash;
private batchedDisplayObject;
apply(renderingService: RenderingService): void;
private flush;
private renderDisplayObject;

@@ -44,4 +44,4 @@ private convertAABB2Rect;

private saveDirtyAABB;
private drawDirtyRectangle;
private applyTransform;
private getColor;
private applyAttributesToContext;

@@ -48,0 +48,0 @@ private useAnchor;

@@ -33,8 +33,2 @@ "use strict";

var RBushRoot = 'RBushRoot';
exports.RBushRoot = RBushRoot;
var SHAPE_ATTRS_MAP = {
fill: 'fillStyle',
stroke: 'strokeStyle',
opacity: 'globalAlpha'
};
/**

@@ -46,2 +40,4 @@ * support 2 modes in rendering:

exports.RBushRoot = RBushRoot;
var CanvasRendererPlugin =

@@ -54,2 +50,5 @@ /** @class */

this.clearFullScreen = false;
this.enableBatch = false;
this.batchedStyleHash = '';
this.batchedDisplayObject = null;
}

@@ -63,32 +62,23 @@

var handleMounted = function handleMounted(e) {
// const { enableDirtyRectangleRendering } = this.canvasConfig.renderer.getConfig();
// if (!enableDirtyRectangleRendering) {
// return;
// }
var object = e.target;
object.entity.addComponent(_RBushNode.RBushNode);
handleBoundsChanged(e);
var object = e.target; // @ts-ignore
object.rBushNode = new _RBushNode.RBushNode();
var path = e.composedPath().slice(0, -2);
path.forEach(function (node) {
_this.insertRBushNode(node);
});
};
var handleUnmounted = function handleUnmounted(e) {
// const { enableDirtyRectangleRendering } = this.canvasConfig.renderer.getConfig();
// if (!enableDirtyRectangleRendering) {
// return;
// }
var object = e.target; // remove r-bush node
// @ts-ignore
var rBushNode = object.entity.getComponent(_RBushNode.RBushNode);
var rBushNode = object.rBushNode;
_this.rBush.remove(rBushNode.aabb); // this.rBush.remove(rBushNode.aabb, (a: RBushNodeAABB, b: RBushNodeAABB) => a.name === b.name);
// object.entity.removeComponent(RBushNode);
object.entity.removeComponent(_RBushNode.RBushNode);
};
var handleBoundsChanged = function handleBoundsChanged(e) {
// const { enableDirtyRectangleRendering } = this.canvasConfig.renderer.getConfig();
// // don not use rbush when dirty-rectangle rendering disabled
// if (!enableDirtyRectangleRendering) {
// return;
// }
var _a;

@@ -100,5 +90,45 @@

return;
} // skip Document & Canvas
}
var affectChildren = e.detail.affectChildren;
if (affectChildren) {
// bounds changed, need re-inserting its children
var bulk_1 = [];
object.forEach(function (node) {
// @ts-ignore
var rBushNode = node.rBushNode; // clear dirty node
if (rBushNode) {
_this.rBush.remove(rBushNode.aabb);
}
var renderBounds = node.getRenderBounds();
if (renderBounds) {
var _a = (0, _tslib.__read)(renderBounds.getMin(), 2),
minX = _a[0],
minY = _a[1];
var _b = (0, _tslib.__read)(renderBounds.getMax(), 2),
maxX = _b[0],
maxY = _b[1];
rBushNode.aabb = {
id: node.entity,
minX: minX,
minY: minY,
maxX: maxX,
maxY: maxY
};
}
bulk_1.push(rBushNode.aabb);
}); // use bulk inserting, which is ~2-3 times faster
// @see https://github.com/mourner/rbush#bulk-inserting-data
_this.rBush.load(bulk_1);
} // inform parent, skip Document & Canvas
var path = e.composedPath().slice(0, -2);

@@ -111,10 +141,2 @@ path.forEach(function (node) {

renderingService.hooks.init.tap(CanvasRendererPlugin_1.tag, function () {
var context = _this.contextService.getContext();
var dpr = _this.contextService.getDPR(); // scale all drawing operations by the dpr
// @see https://www.html5rocks.com/en/tutorials/canvas/hidpi/
context && context.scale(dpr, dpr);
_this.renderingContext.root.addEventListener(_g.ElementEvent.MOUNTED, handleMounted);

@@ -198,4 +220,9 @@

}
}); // save dirty AABBs in last frame
});
if (_this.enableBatch && _this.batchedStyleHash) {
_this.flush(context, renderingService);
} // save dirty AABBs in last frame
_this.renderQueue.forEach(function (object) {

@@ -231,2 +258,20 @@ _this.saveDirtyAABB(object);

CanvasRendererPlugin.prototype.flush = function (context, renderingService) {
if (this.batchedDisplayObject) {
var styleRenderer = this.styleRendererFactory(this.batchedDisplayObject.nodeName);
if (styleRenderer) {
// apply attributes to context
this.applyAttributesToContext(context, this.batchedDisplayObject, renderingService); // close path first
context.closePath();
styleRenderer.render(context, this.batchedDisplayObject.parsedStyle, this.batchedDisplayObject);
context.restore();
}
this.batchedStyleHash = '';
this.batchedDisplayObject = null;
}
};
CanvasRendererPlugin.prototype.renderDisplayObject = function (object, renderingService) {

@@ -245,4 +290,21 @@ var _this = this;

var nodeName = object.nodeName; // reset transformation
var nodeName = object.nodeName;
var styleRenderer = this.styleRendererFactory(nodeName);
var startBatch = false;
if (this.enableBatch && styleRenderer) {
var hash = styleRenderer.hash(object.attributes);
if (this.batchedStyleHash && hash !== this.batchedStyleHash) {
this.flush(context, renderingService);
}
if (!this.batchedStyleHash) {
this.batchedStyleHash = hash;
this.batchedDisplayObject = object;
startBatch = true;
}
} // reset transformation
context.save(); // apply RTS transformation in world space

@@ -263,3 +325,5 @@

this.useAnchor(context, clipPathShape, function () {
context.beginPath();
generatePath_1(context, clipPathShape.parsedStyle);
context.closePath();
});

@@ -270,8 +334,12 @@ }

context.clip();
} // apply attributes to context
} // fill & stroke
context.save();
this.applyAttributesToContext(context, object, renderingService); // apply anchor in local space
if (!this.enableBatch) {
context.save(); // apply attributes to context
this.applyAttributesToContext(context, object, renderingService);
} // apply anchor in local space
this.useAnchor(context, object, function () {

@@ -282,9 +350,15 @@ // generate path in local space

if (generatePath) {
if (startBatch || !_this.enableBatch) {
context.beginPath();
}
generatePath(context, object.parsedStyle);
if (!_this.enableBatch && object.nodeName !== _g.SHAPE.Line && object.nodeName !== _g.SHAPE.Path && object.nodeName !== _g.SHAPE.Polyline) {
context.closePath();
}
} // fill & stroke
var styleRenderer = _this.styleRendererFactory(nodeName);
if (styleRenderer) {
if (styleRenderer && !_this.enableBatch) {
styleRenderer.render(context, object.parsedStyle, object);

@@ -294,6 +368,8 @@ }

context.restore(); // finish rendering, clear dirty flag
if (!this.enableBatch) {
context.restore();
} // finish rendering, clear dirty flag
var renderable = object.entity.getComponent(_g.Renderable);
renderable.dirty = false;
object.renderable.dirty = false;
this.restoreStack.push(object);

@@ -322,3 +398,4 @@ };

CanvasRendererPlugin.prototype.insertRBushNode = function (object) {
var rBushNode = object.entity.getComponent(_RBushNode.RBushNode);
// @ts-ignore
var rBushNode = object.rBushNode;

@@ -341,3 +418,3 @@ if (rBushNode) {

rBushNode.aabb = {
name: object.entity.getName(),
id: object.entity,
minX: minX,

@@ -375,3 +452,3 @@ minY: minY,

var dirtyRenderBounds = object.entity.getComponent(_g.Renderable).dirtyRenderBounds;
var dirtyRenderBounds = object.renderable.dirtyRenderBounds;

@@ -408,4 +485,4 @@ if (dirtyRenderBounds) {

return rBushNodes.map(function (_a) {
var name = _a.name;
return _this.displayObjectPool.getByName(name);
var id = _a.id;
return _this.displayObjectPool.getByEntity(id);
});

@@ -415,3 +492,3 @@ };

CanvasRendererPlugin.prototype.saveDirtyAABB = function (object) {
var renderable = object.entity.getComponent(_g.Renderable);
var renderable = object.renderable;

@@ -430,14 +507,2 @@ if (!renderable.dirtyRenderBounds) {

CanvasRendererPlugin.prototype.drawDirtyRectangle = function (context, _a) {
var x = _a.x,
y = _a.y,
width = _a.width,
height = _a.height;
context.beginPath();
context.rect(x + 1, y + 1, width - 1, height - 1);
context.closePath();
context.lineWidth = 1;
context.stroke();
};
CanvasRendererPlugin.prototype.applyTransform = function (context, transform) {

@@ -465,57 +530,80 @@ var _a = (0, _tslib.__read)(_glMatrix.mat4.getTranslation(_glMatrix.vec3.create(), transform), 2),

CanvasRendererPlugin.prototype.applyAttributesToContext = function (context, object, renderingService) {
var attributes = object.attributes,
parsedStyle = object.parsedStyle;
CanvasRendererPlugin.prototype.getColor = function (parsedColor, object, context, renderingService) {
var color;
for (var k in attributes) {
// reserved keywords in Canvas2DContext
if (k === 'transform') {
continue;
if (parsedColor.type === _g.PARSED_COLOR_TYPE.LinearGradient || parsedColor.type === _g.PARSED_COLOR_TYPE.RadialGradient) {
var bounds = object.getGeometryBounds();
var width = bounds && bounds.halfExtents[0] * 2 || 0;
var height = bounds && bounds.halfExtents[1] * 2 || 0;
color = this.gradientPool.getOrCreateGradient((0, _tslib.__assign)((0, _tslib.__assign)({
type: parsedColor.type
}, parsedColor.value), {
width: width,
height: height
}), context);
} else if (parsedColor.type === _g.PARSED_COLOR_TYPE.Pattern) {
var pattern = this.imagePool.getPatternSync(parsedColor.value);
if (pattern) {
color = pattern;
} else {
this.imagePool.createPattern(parsedColor.value, context).then(function () {
// set dirty rectangle flag
object.renderable.dirty = true;
renderingService.dirtify();
});
}
} else {
// constant, eg. rgba(255,255,255,1)
color = parsedColor.formatted;
}
var v = attributes[k]; // 转换一下不与 canvas 兼容的属性名
return color;
};
var name_1 = SHAPE_ATTRS_MAP[k] ? SHAPE_ATTRS_MAP[k] : k;
CanvasRendererPlugin.prototype.applyAttributesToContext = function (context, object, renderingService) {
var _a = object.parsedStyle,
stroke = _a.stroke,
fill = _a.fill,
opacity = _a.opacity,
lineDash = _a.lineDash,
lineDashOffset = _a.lineDashOffset,
filter = _a.filter,
shadowColor = _a.shadowColor,
shadowBlur = _a.shadowBlur,
shadowOffsetX = _a.shadowOffsetX,
shadowOffsetY = _a.shadowOffsetY; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash
if (name_1 === 'lineDash' && context.setLineDash) {
(0, _util.isArray)(v) && context.setLineDash(v);
} else {
if (name_1 === 'strokeStyle' || name_1 === 'fillStyle') {
var parsedColor = parsedStyle[k];
if (lineDash && (0, _util.isArray)(lineDash)) {
context.setLineDash(lineDash);
} // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/lineDashOffset
if (parsedColor.type === _g.PARSED_COLOR_TYPE.LinearGradient || parsedColor.type === _g.PARSED_COLOR_TYPE.RadialGradient) {
var bounds = object.getGeometryBounds();
var width = bounds && bounds.halfExtents[0] * 2 || 0;
var height = bounds && bounds.halfExtents[1] * 2 || 0;
v = this.gradientPool.getOrCreateGradient((0, _tslib.__assign)((0, _tslib.__assign)({
type: parsedColor.type
}, parsedColor.value), {
width: width,
height: height
}), context);
} else if (parsedColor.type === _g.PARSED_COLOR_TYPE.Pattern) {
var pattern = this.imagePool.getPatternSync(parsedColor.value);
if (pattern) {
v = pattern;
} else {
this.imagePool.createPattern(parsedColor.value, context).then(function () {
// set dirty rectangle flag
object.entity.getComponent(_g.Renderable).dirty = true;
renderingService.dirtify();
});
}
} else {
// constant, eg. rgba(255,255,255,1)
v = parsedColor.formatted;
}
} else if (name_1 === 'globalAlpha') {
// opacity 效果可以叠加,子元素的 opacity 需要与父元素 opacity 相乘
v = v * context.globalAlpha;
} // @ts-ignore
if (!(0, _util.isNil)(lineDashOffset)) {
context.lineDashOffset = lineDashOffset;
}
if (!(0, _util.isNil)(opacity)) {
context.globalAlpha *= opacity;
}
context[name_1] = v;
}
if (!(0, _util.isNil)(stroke)) {
context.strokeStyle = this.getColor(stroke, object, context, renderingService);
}
if (!(0, _util.isNil)(fill)) {
context.fillStyle = this.getColor(fill, object, context, renderingService);
}
if (!(0, _util.isNil)(filter)) {
// use raw filter string
context.filter = object.style.filter;
}
if (!(0, _util.isNil)(shadowColor)) {
context.shadowColor = shadowColor.formatted;
context.shadowBlur = shadowBlur;
context.shadowOffsetX = shadowOffsetX;
context.shadowOffsetY = shadowOffsetY;
}
};

@@ -527,12 +615,9 @@

if (contentBounds) {
var halfExtents = contentBounds.halfExtents;
context.save(); // apply anchor, use true size, not include stroke,
var halfExtents = contentBounds.halfExtents; // apply anchor, use true size, not include stroke,
// eg. bounds = true size + half lineWidth
var _a = (object.parsedStyle || {}).anchor,
anchor = _a === void 0 ? [0, 0] : _a; // context.translate(-anchor[0] * width, -anchor[1] * height);
anchor = _a === void 0 ? [0, 0] : _a;
context.translate(-anchor[0] * halfExtents[0] * 2, -anchor[1] * halfExtents[1] * 2);
callback();
context.restore();
} else {

@@ -539,0 +624,0 @@ callback();

@@ -1,4 +0,3 @@

import { Component } from '@antv/g';
export interface RBushNodeAABB {
name: string;
id: number;
minX: number;

@@ -9,5 +8,5 @@ minY: number;

}
export declare class RBushNode extends Component {
export declare class RBushNode {
static tag: string;
aabb: RBushNodeAABB;
}

@@ -8,19 +8,11 @@ "use strict";

var _tslib = require("tslib");
var _g = require("@antv/g");
var RBushNode =
/** @class */
function (_super) {
(0, _tslib.__extends)(RBushNode, _super);
function () {
function RBushNode() {}
function RBushNode() {
return _super !== null && _super.apply(this, arguments) || this;
}
RBushNode.tag = 'c-canvas-rbush-node';
return RBushNode;
}(_g.Component);
}();
exports.RBushNode = RBushNode;

@@ -70,8 +70,5 @@ "use strict";

_g.world.registerComponent(_RBushNode.RBushNode);
/**
* register shape renderers
*/
_g.globalContainer.register({

@@ -78,0 +75,0 @@ token: {

@@ -39,3 +39,3 @@ "use strict";

// set dirty rectangle flag
object.entity.getComponent(_g.Renderable).dirty = true;
object.renderable.dirty = true;
renderingService.dirtify();

@@ -58,3 +58,3 @@ });

// set dirty rectangle flag
object.entity.getComponent(_g.Renderable).dirty = true;
object.renderable.dirty = true;
renderingService.dirtify();

@@ -61,0 +61,0 @@ });

@@ -9,6 +9,7 @@ "use strict";

function generatePath(context, parsedStyle) {
context.beginPath();
var _a = parsedStyle.r,
r = _a === void 0 ? 0 : _a;
context.arc(r, r, r, 0, Math.PI * 2, false);
r = _a === void 0 ? 0 : _a; // context.save();
// context.moveTo(2 * r, r);
context.arc(r, r, r, 0, Math.PI * 2, false); // context.restore();
}

@@ -10,4 +10,3 @@ "use strict";

var rx = attributes.rx,
ry = attributes.ry;
context.beginPath(); // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/ellipse
ry = attributes.ry; // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/ellipse

@@ -24,5 +23,3 @@ if (context.ellipse) {

context.arc(0, 0, r, 0, Math.PI * 2);
context.closePath();
context.restore();
}
}

@@ -17,5 +17,4 @@ "use strict";

defY = _b === void 0 ? 0 : _b;
context.beginPath();
context.moveTo(x1 - defX, y1 - defY);
context.lineTo(x2 - defX, y2 - defY);
}

@@ -24,4 +24,2 @@ "use strict";

context.beginPath();
for (var i = 0; i < path.length; i++) {

@@ -28,0 +26,0 @@ var params = path[i]; // eg. M 100 200

@@ -19,3 +19,2 @@ "use strict";

var y2 = points[length - 1][1] - y;
context.beginPath();
context.moveTo(x1, y1);

@@ -29,3 +28,2 @@

context.lineTo(x2, y2);
context.closePath();
}

@@ -19,3 +19,2 @@ "use strict";

var y2 = points[length - 1][1] - y;
context.beginPath();
context.moveTo(x1, y1);

@@ -22,0 +21,0 @@

@@ -19,3 +19,2 @@ "use strict";

height = _c === void 0 ? 0 : _c;
context.beginPath();

@@ -40,4 +39,3 @@ if (radius === 0) {

r1 !== 0 && context.arc(r1, r1, r1, Math.PI, Math.PI * 1.5);
context.closePath();
}
}
import { ParsedBaseStyleProps } from '@antv/g';
import { StyleRenderer } from './interfaces';
export declare class DefaultRenderer implements StyleRenderer {
hash(parsedStyle: ParsedBaseStyleProps): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedBaseStyleProps): void;
}

@@ -23,2 +23,15 @@ "use strict";

DefaultRenderer.prototype.hash = function (parsedStyle) {
var fill = parsedStyle.fill,
opacity = parsedStyle.opacity,
fillOpacity = parsedStyle.fillOpacity,
stroke = parsedStyle.stroke,
strokeOpacity = parsedStyle.strokeOpacity,
lineWidth = parsedStyle.lineWidth,
lineCap = parsedStyle.lineCap,
lineJoin = parsedStyle.lineJoin; // return fill + opacity + fillOpacity + stroke + strokeOpacity + lineWidth + lineCap + lineJoin;
return '';
};
DefaultRenderer.prototype.render = function (context, parsedStyle) {

@@ -32,3 +45,5 @@ var fill = parsedStyle.fill,

lineCap = parsedStyle.lineCap,
lineJoin = parsedStyle.lineJoin;
lineJoin = parsedStyle.lineJoin,
shadowColor = parsedStyle.shadowColor,
filter = parsedStyle.filter;

@@ -61,19 +76,29 @@ if (!(0, _util.isNil)(fill)) {

context.lineJoin = lineJoin;
} // prevent inner shadow when drawing stroke, toggle shadowBlur & filter(drop-shadow)
// save shadow blur
}
var oldShadowBlur = void 0;
var oldShadowColor = void 0;
var oldFilter = void 0;
var hasShadowColor = !(0, _util.isNil)(shadowColor);
var hasFilter = !(0, _util.isNil)(filter);
var shadowBlur = context.shadowBlur;
var shadowColor = context.shadowColor;
if (hasShadowColor) {
// prevent inner shadow when drawing stroke, toggle shadowBlur & filter(drop-shadow)
// save shadow blur
oldShadowBlur = context.shadowBlur;
oldShadowColor = context.shadowColor;
if (!(0, _util.isNil)(shadowBlur)) {
context.shadowColor = 'transparent';
context.shadowBlur = 0;
} // save drop-shadow filter
if (!(0, _util.isNil)(oldShadowBlur)) {
context.shadowColor = 'transparent';
context.shadowBlur = 0;
}
}
if (hasFilter) {
// save drop-shadow filter
oldFilter = context.filter;
var filter = context.filter;
if (!(0, _util.isNil)(filter) && filter.indexOf('drop-shadow') > -1) {
context.filter = filter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none';
if (!(0, _util.isNil)(oldFilter) && oldFilter.indexOf('drop-shadow') > -1) {
context.filter = oldFilter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none';
}
}

@@ -83,10 +108,10 @@

if (!(0, _util.isNil)(shadowBlur)) {
context.shadowColor = shadowColor;
context.shadowBlur = shadowBlur;
if (hasShadowColor) {
context.shadowColor = oldShadowColor;
context.shadowBlur = oldShadowBlur;
} // restore filters
if (!(0, _util.isNil)(filter)) {
context.filter = filter;
if (hasFilter) {
context.filter = oldFilter;
}

@@ -93,0 +118,0 @@ }

@@ -5,3 +5,4 @@ import { ParsedImageStyleProps } from '@antv/g';

private imagePool;
hash(parsedStyle: ParsedImageStyleProps): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedImageStyleProps): void;
}

@@ -25,2 +25,6 @@ "use strict";

ImageRenderer.prototype.hash = function (parsedStyle) {
return '';
};
ImageRenderer.prototype.render = function (context, parsedStyle) {

@@ -27,0 +31,0 @@ var _a = parsedStyle.width,

@@ -6,3 +6,4 @@ import type { ParsedBaseStyleProps, DisplayObject } from '@antv/g';

export interface StyleRenderer {
hash(parsedStyle: ParsedBaseStyleProps): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedBaseStyleProps, object: DisplayObject): void;
}

@@ -5,2 +5,3 @@ import { ParsedTextStyleProps } from '@antv/g';

private textService;
hash(parsedStyle: any): string;
render(context: CanvasRenderingContext2D, parsedStyle: ParsedTextStyleProps): void;

@@ -7,0 +8,0 @@ private drawLetterSpacing;

@@ -23,2 +23,6 @@ "use strict";

TextRenderer.prototype.hash = function (parsedStyle) {
return '';
};
TextRenderer.prototype.render = function (context, parsedStyle) {

@@ -50,2 +54,3 @@ var _a = parsedStyle.text,

context.lineWidth = lineWidth;
context.textAlign = textAlign;
context.textBaseline = textBaseline;

@@ -52,0 +57,0 @@ context.lineJoin = lineJoin;

{
"name": "@antv/g-plugin-canvas-renderer",
"version": "1.0.0-alpha.37",
"version": "1.0.0-alpha.38",
"description": "A G plugin of renderer implementation with Canvas2D API",

@@ -35,3 +35,3 @@ "main": "lib/index.js",

"dependencies": {
"@antv/g-math": "^1.0.0-alpha.11",
"@antv/g-math": "^1.0.0-alpha.12",
"@antv/path-util": "^2.0.14",

@@ -42,6 +42,3 @@ "rbush": "^3.0.1"

"@types/jest": "^25.0.0",
"@types/rbush": "^3.0.0",
"npm-run-all": "^4.1.5",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.7"
"@types/rbush": "^3.0.0"
},

@@ -56,3 +53,3 @@ "peerDependencies": {

"homepage": "https://github.com/antvis/g#readme",
"gitHead": "c0f918d5477e3099b9bfa3ecb077cc411c0b2e3a"
"gitHead": "d09726ac85b8738d53c97002a98848b4a450bfcd"
}
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