@antv/g-canvas 1.1.3 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g"),require("mana-syringe")):"function"==typeof define&&define.amd?define(["exports","@antv/g","mana-syringe"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Canvas2D={}),t.window.G,t.window.G.ManaSyringe)}(this,(function(t,e,n){"use strict";function r(t,e){return r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(t,e)}function i(t,e,n,r){var i,o=arguments.length,a=3>o?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(a=(3>o?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}function o(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function a(){
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g"),require("mana-syringe")):"function"==typeof define&&define.amd?define(["exports","@antv/g","mana-syringe"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Canvas2D={}),t.window.G,t.window.G.ManaSyringe)}(this,(function(t,e,n){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function s(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function h(t,e,n,r){var o,i=arguments.length,a=3>i?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(3>i?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function f(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function d(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
3
- a=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),o=new P(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return C()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=w(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=l(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,o),i}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function f(){}function d(){}function v(){}var p={};s(p,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&n.call(g,i)&&(p=g);var m=v.prototype=f.prototype=Object.create(p);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,o,a,c){var s=l(t[i],t,o);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=v,s(m,"constructor",v),s(v,"constructor",d),d.displayName=s(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},x(b.prototype),s(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new b(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(m),s(m,c,"Generator"),s(m,i,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var c=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===t||"continue"===t)&&e>=o.tryLoc&&o.finallyLoc>=e&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function c(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){c(o,r,i,a,s,"next",t)}function s(t){c(o,r,i,a,s,"throw",t)}a(void 0)}))}}var u,l,h=/mobile|tablet|ip(ad|hone|od)|android/i,f=(u=function(){function t(){this.contextService=void 0,this.renderingContext=void 0}return t.prototype.apply=function(t){var e=this,n=this.renderingContext.root.ownerDocument.defaultView,r=n.supportTouchEvent&&h.test(navigator.userAgent),i=function(e){t.hooks.pointerMove.call(e)},o=function(e){t.hooks.pointerUp.call(e)},c=function(e){t.hooks.pointerDown.call(e)},u=function(e){t.hooks.pointerOver.call(e)},f=function(e){t.hooks.pointerOut.call(e)},d=function(e){t.hooks.pointerCancel.call(e)},v=function(e){t.hooks.pointerWheel.call(e)},p=function(t){globalThis.document.addEventListener("pointermove",i,!0),t.addEventListener("pointerdown",c,!0),t.addEventListener("pointerleave",f,!0),t.addEventListener("pointerover",u,!0),globalThis.addEventListener("pointerup",o,!0)},y=function(t){t.addEventListener("touchstart",c,!0),t.addEventListener("touchend",o,!0),t.addEventListener("touchmove",i,!0),t.addEventListener("touchcancel",d,!0)},g=function(t){globalThis.document.addEventListener("mousemove",i,!0),t.addEventListener("mousedown",c,!0),t.addEventListener("mouseout",f,!0),t.addEventListener("mouseover",u,!0),globalThis.addEventListener("mouseup",o,!0)},m=function(t){t.removeEventListener("touchstart",c,!0),t.removeEventListener("touchend",o,!0),t.removeEventListener("touchmove",i,!0)},x=function(t){globalThis.document.removeEventListener("mousemove",i,!0),t.removeEventListener("mousedown",c,!0),t.removeEventListener("mouseout",f,!0),t.removeEventListener("mouseover",u,!0),globalThis.removeEventListener("mouseup",o,!0)};t.hooks.init.tapPromise(l.tag,s(a().mark((function t(){var i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=e.contextService.getDomElement(),n.supportPointerEvent&&p(i),r?y(i):n.supportTouchEvent?(y(i),n.supportPointerEvent||g(i)):n.supportPointerEvent||g(i),i.addEventListener("wheel",v,{passive:!0,capture:!0});case 4:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(l.tag,(function(){var t=e.contextService.getDomElement();n.supportPointerEvent&&function(t){globalThis.document.removeEventListener("pointermove",i,!0),t.removeEventListener("pointerdown",c,!0),t.removeEventListener("pointerleave",f,!0),t.removeEventListener("pointerover",u,!0),globalThis.removeEventListener("pointerup",o,!0)}(t),r?m(t):n.supportTouchEvent?(m(t),n.supportPointerEvent||x(t)):n.supportPointerEvent||x(t),t.removeEventListener("wheel",v,!0)}))},t}(),u.tag="DOMInteraction",l=u);i([n.inject(e.ContextService),o("design:type",Object)],f.prototype,"contextService",void 0),i([n.inject(e.RenderingContext),o("design:type",Object)],f.prototype,"renderingContext",void 0),f=l=i([n.singleton({contrib:e.RenderingPluginContribution})],f);var d=n.Module((function(t){t(f)})),v=function(){function t(){this.name="dom-interaction"}var e=t.prototype;return e.init=function(t){t.load(d,!0)},e.destroy=function(t){t.unload(d)},t}(),p=Object.freeze({__proto__:null,Plugin:v});function y(t,e,n,r,i){g(t,e,n||0,r||t.length-1,i||x)}function g(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,a=e-n+1,c=Math.log(o),s=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*s*(o-s)/o)*(0>a-o/2?-1:1);g(t,e,Math.max(n,Math.floor(e-a*s/o+u)),Math.min(r,Math.floor(e+(o-a)*s/o+u)),i)}var l=t[e],h=n,f=r;for(m(t,n,e),i(t[r],l)>0&&m(t,n,r);f>h;){for(m(t,h,f),h++,f--;0>i(t[h],l);)h++;for(;i(t[f],l)>0;)f--}0===i(t[n],l)?m(t,n,f):m(t,++f,r),f>e||(n=f+1),e>f||(r=f-1)}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function x(t,e){return e>t?-1:t>e?1:0}class b{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!N(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;e.children.length>o;o++){const a=e.children[o],c=e.leaf?r(a):a;N(t,c)&&(e.leaf?n.push(a):T(t,c)?this._all(a,n):i.push(a))}e=i.pop()}return n}collides(t){let e=this.data;if(!N(t,e))return!1;const n=[];for(;e;){for(let r=0;e.children.length>r;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(N(t,o)){if(e.leaf||T(t,o))return!0;n.push(i)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(this._minEntries>t.length){for(let e=0;t.length>e;e++)this.insert(t[e]);return this}let 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(e.height>this.data.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=j([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let a,c,s;for(;n||i.length;){if(n||(n=i.pop(),c=i[i.length-1],a=o.pop(),s=!0),n.leaf){const r=w(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}s||n.leaf||!T(n,r)?c?(a++,n=c.children[a],s=!1):n=null:(i.push(n),o.push(a),a=0,c=n,n=n.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,a=this._maxEntries;if(a>=i)return o=j(t.slice(e,n+1)),E(o,this.toBBox),o;r||(a=Math.ceil(i/Math.pow(a,(r=Math.ceil(Math.log(i)/Math.log(a)))-1))),o=j([]),o.leaf=!1,o.height=r;const c=Math.ceil(i/a),s=c*Math.ceil(Math.sqrt(a));_(t,e,n,s,this.compareMinX);for(let i=e;n>=i;i+=s){const e=Math.min(i+s-1,n);_(t,i,e,c,this.compareMinY);for(let n=i;e>=n;n+=c){o.children.push(this._build(t,n,Math.min(n+c-1,e),r-1))}}return E(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,a=1/0;for(let c=0;e.children.length>c;c++){const s=e.children[c],u=M(s),l=(Math.max((o=s).maxX,(i=t).maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-u;a>l?(a=l,r=r>u?u:r,n=s):l===a&&r>u&&(r=u,n=s)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),P(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),a=j(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,E(n,this.toBBox),E(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=j([t,e]),this.data.height=t.height+1,this.data.leaf=!1,E(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let a=e;n-e>=a;a++){const e=L(t,0,a,this.toBBox),c=L(t,a,n,this.toBBox),s=O(e,c),u=M(e)+M(c);i>s?(i=s,r=a,o=o>u?u:o):s===i&&o>u&&(o=u,r=a)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:S,i=t.leaf?this.compareMinY:C,o=this._allDistMargin(t,e,n,r);this._allDistMargin(t,e,n,i)>o&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=L(t,0,e,i),a=L(t,n-e,n,i);let c=k(o)+k(a);for(let r=e;n-e>r;r++){const e=t.children[r];P(o,t.leaf?i(e):e),c+=k(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];P(a,t.leaf?i(e):e),c+=k(a)}return c}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)P(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():E(t[n],this.toBBox)}}function w(t,e,n){if(!n)return e.indexOf(t);for(let r=0;e.length>r;r++)if(n(t,e[r]))return r;return-1}function E(t,e){L(t,0,t.children.length,e,t)}function L(t,e,n,r,i){i||(i=j(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;n>o;o++){const e=t.children[o];P(i,t.leaf?r(e):e)}return i}function P(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function S(t,e){return t.minX-e.minX}function C(t,e){return t.minY-e.minY}function M(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function k(t){return t.maxX-t.minX+(t.maxY-t.minY)}function O(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function T(t,e){return!(t.minX>e.minX||t.minY>e.minY||e.maxX>t.maxX||e.maxY>t.maxY)}function N(t,e){return!(e.minX>t.maxX||e.minY>t.maxY||t.minX>e.maxX||t.minY>e.maxY)}function j(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(t,e,n,r,i){const o=[e,n];for(;o.length;){if(r>=(n=o.pop())-(e=o.pop()))continue;const a=e+Math.ceil((n-e)/r/2)*r;y(t,a,e,n,i),o.push(e,a,a,n)}}var B=n.Syringe.defineToken("StyleRendererFactory"),R=n.Syringe.defineToken("CircleRenderer",{multiple:!1}),A=n.Syringe.defineToken("EllipseRenderer",{multiple:!1}),I=n.Syringe.defineToken("RectRenderer",{multiple:!1}),G=n.Syringe.defineToken("LineRenderer",{multiple:!1}),D=n.Syringe.defineToken("PolylineRenderer",{multiple:!1}),F=n.Syringe.defineToken("PolygonRenderer",{multiple:!1}),Y=n.Syringe.defineToken("PathRenderer",{multiple:!1}),X=n.Syringe.defineToken("TextRenderer",{multiple:!1}),H=n.Syringe.defineToken("ImageRenderer",{multiple:!1}),$=function(){function t(){this.imageCache={},this.patternCache={},this.canvasConfig=void 0}var n=t.prototype;return n.getImageSync=function(t){return this.imageCache[t]},n.getOrCreateImage=function(t){var n=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var r=this.canvasConfig.createImage;return new Promise((function(i,o){var a;r?a=r(t):e.isBrowser&&(a=new window.Image),a&&(a.onload=function(){i(a)},a.onerror=function(t){o(t)},a.crossOrigin="Anonymous",a.src=t,n.imageCache[t]=a)}))},n.getPatternSync=function(t){var e=this.generatePatternKey(t);if(this.patternCache[e])return this.patternCache[e]},n.createPattern=function(t,e){var n=this;return this.getOrCreateImage(t.src).then((function(r){var i=n.generatePatternKey(t),o=e.createPattern(r,t.repetition);return o&&(n.patternCache[i]=o),n.patternCache[i]}))},n.generatePatternKey=function(t){return"pattern-"+t.src+"-"+t.repetition},t}();i([n.inject(e.CanvasConfig),o("design:type",Object)],$.prototype,"canvasConfig",void 0),$=i([n.singleton()],$);var W=function(){function t(){this.imagePool=void 0}var n=t.prototype;return n.hash=function(t){return""},n.render=function(t,n){var r,i=n.img,o=n.width.value,a=n.height.value;if(e.isString(i)?r=this.imagePool.getImageSync(i):(o||(o=i.width),a||(a=i.height),r=i),r)try{t.drawImage(r,0,0,o,a)}catch(t){}},t}();i([n.inject($),o("design:type",$)],W.prototype,"imagePool",void 0),W=i([n.singleton({token:H})],W);var U=function(){function t(){}var n=t.prototype;return n.hash=function(t){return""},n.render=function(t,n,r){var i=n.lineWidth,o=n.textAlign,a=n.textBaseline,c=n.lineJoin,s=n.miterLimit,u=void 0===s?0:s,l=n.letterSpacing,h=void 0===l?0:l,f=n.stroke,d=n.fill,v=n.fillOpacity,p=n.strokeOpacity,y=n.opacity,g=n.metrics,m=n.dx,x=n.dy,b=g.lines,w=g.height,E=g.lineHeight,L=g.lineMetrics;t.font=g.font,t.lineWidth=i.value,t.textAlign=o.value,t.textBaseline=a.value,t.lineJoin=c.value,t.miterLimit=u;var P=0;"middle"===a.value?P=-w/2-E/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?P=-w:"top"!==a.value&&"hanging"!==a.value||(P=-E);var S=0;m&&m.unit===e.UnitType.kPixels&&(S+=m.value),x&&x.unit===e.UnitType.kPixels&&(P+=x.value);for(var C=0;b.length>C;C++){var M=i.value/2+S;P+=E,!e.isNil(f)&&i&&i.value&&this.drawLetterSpacing(t,b[C],L[C],o.value,M,P,h,v.value,p.value,y.value,!0),e.isNil(d)||this.drawLetterSpacing(t,b[C],L[C],o.value,M,P,h,v.value,p.value,y.value)}},n.drawLetterSpacing=function(t,e,n,r,i,o,a,c,s,u,l){if(void 0===l&&(l=!1),0!==a){var h=t.textAlign;t.textAlign="left";var f=i;"center"===r?f=i-n.width/2:"right"!==r&&"end"!==r||(f=i-n.width);for(var d=Array.from(e),v=t.measureText(e).width,p=0,y=0;d.length>y;++y){var g=d[y];l?this.strokeText(t,g,f,o,s):this.fillText(t,g,f,o,c,u),f+=v-(p=t.measureText(e.substring(y+1)).width)+a,v=p}t.textAlign=h}else l?this.strokeText(t,e,i,o,s):this.fillText(t,e,i,o,c,u)},n.fillText=function(t,n,r,i,o,a){var c,s=!e.isNil(o)&&1!==o;s&&(c=t.globalAlpha,t.globalAlpha=o*a),t.fillText(n,r,i),s&&(t.globalAlpha=c)},n.strokeText=function(t,n,r,i,o){var a,c=!e.isNil(o)&&1!==o;c&&(a=t.globalAlpha,t.globalAlpha=o),t.strokeText(n,r,i),c&&(t.globalAlpha=a)},t}();function q(){
3
+ d=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new S(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return O()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=E(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,i),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var h={};function f(){}function v(){}function p(){}var y={};u(y,i,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(L([])));m&&m!==e&&n.call(m,i)&&(y=m);var b=p.prototype=f.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function o(i,a,c,u){var s=l(t[i],t,a);if("throw"!==s.type){var h=s.arg,f=h.value;return f&&"object"==r(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(f).then((function(t){h.value=t,c(h)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,n){function r(){return new e((function(e,r){o(t,n,e,r)}))}return i=i?i.then(r,r):r()}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return v.prototype=p,u(b,"constructor",p),u(p,"constructor",v),v.displayName=u(p,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new w(s(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),u(b,c,"Generator"),u(b,i,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=L,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function v(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function p(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){v(i,r,o,a,c,"next",t)}function c(t){v(i,r,o,a,c,"throw",t)}a(void 0)}))}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e,n){return e&&g(t.prototype,e),n&&g(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var b,x,w=(b=function(){function t(){y(this,t),this.contextService=void 0,this.renderingContext=void 0}return m(t,[{key:"apply",value:function(t){var e=this,n=this.renderingContext.root.ownerDocument.defaultView,r=function(e){t.hooks.pointerMove.call(e)},o=function(e){t.hooks.pointerUp.call(e)},i=function(e){t.hooks.pointerDown.call(e)},a=function(e){t.hooks.pointerOver.call(e)},c=function(e){t.hooks.pointerOut.call(e)},u=function(e){t.hooks.pointerCancel.call(e)},s=function(e){t.hooks.pointerWheel.call(e)},l=function(t){globalThis.document.addEventListener("pointermove",r,!0),t.addEventListener("pointerdown",i,!0),t.addEventListener("pointerleave",c,!0),t.addEventListener("pointerover",a,!0),globalThis.addEventListener("pointerup",o,!0)},h=function(t){t.addEventListener("touchstart",i,!0),t.addEventListener("touchend",o,!0),t.addEventListener("touchmove",r,!0),t.addEventListener("touchcancel",u,!0)},f=function(t){globalThis.document.addEventListener("mousemove",r,!0),t.addEventListener("mousedown",i,!0),t.addEventListener("mouseout",c,!0),t.addEventListener("mouseover",a,!0),globalThis.addEventListener("mouseup",o,!0)};t.hooks.init.tapPromise(x.tag,p(d().mark((function t(){var r;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=e.contextService.getDomElement(),globalThis.navigator.msPointerEnabled?(r.style.msContentZooming="none",r.style.msTouchAction="none"):n.supportsPointerEvents&&(r.style.touchAction="none"),n.supportsPointerEvents?l(r):f(r),n.supportsTouchEvents&&h(r),r.addEventListener("wheel",s,{passive:!0,capture:!0});case 5:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(x.tag,(function(){var t=e.contextService.getDomElement();n.supportsPointerEvents?function(t){globalThis.document.removeEventListener("pointermove",r,!0),t.removeEventListener("pointerdown",i,!0),t.removeEventListener("pointerleave",c,!0),t.removeEventListener("pointerover",a,!0),globalThis.removeEventListener("pointerup",o,!0)}(t):function(t){globalThis.document.removeEventListener("mousemove",r,!0),t.removeEventListener("mousedown",i,!0),t.removeEventListener("mouseout",c,!0),t.removeEventListener("mouseover",a,!0),globalThis.removeEventListener("mouseup",o,!0)}(t),n.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",i,!0),t.removeEventListener("touchend",o,!0),t.removeEventListener("touchmove",r,!0)}(t),t.removeEventListener("wheel",s,!0)}))}}]),t}(),b.tag="DOMInteraction",x=b);h([n.inject(e.ContextService),f("design:type",Object)],w.prototype,"contextService",void 0),h([n.inject(e.RenderingContext),f("design:type",Object)],w.prototype,"renderingContext",void 0),w=x=h([n.singleton({contrib:e.RenderingPluginContribution})],w);var E=n.Module((function(t){t(w)})),k=function(){function t(){y(this,t),this.name="dom-interaction"}return m(t,[{key:"init",value:function(t){t.load(E,!0)}},{key:"destroy",value:function(t){t.unload(E)}}]),t}(),P=Object.freeze({__proto__:null,Plugin:k});function S(t,e,n,r,o){L(t,e,n||0,r||t.length-1,o||C)}function L(t,e,n,r,o){for(;r>n;){if(r-n>600){var i=r-n+1,a=e-n+1,c=Math.log(i),u=.5*Math.exp(2*c/3),s=.5*Math.sqrt(c*u*(i-u)/i)*(0>a-i/2?-1:1);L(t,e,Math.max(n,Math.floor(e-a*u/i+s)),Math.min(r,Math.floor(e+(i-a)*u/i+s)),o)}var l=t[e],h=n,f=r;for(O(t,n,e),o(t[r],l)>0&&O(t,n,r);f>h;){for(O(t,h,f),h++,f--;0>o(t[h],l);)h++;for(;o(t[f],l)>0;)f--}0===o(t[n],l)?O(t,n,f):O(t,++f,r),f>e||(n=f+1),e>f||(r=f-1)}}function O(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function C(t,e){return e>t?-1:t>e?1:0}class M{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!F(t,e))return n;const r=this.toBBox,o=[];for(;e;){for(let i=0;e.children.length>i;i++){const a=e.children[i],c=e.leaf?r(a):a;F(t,c)&&(e.leaf?n.push(a):D(t,c)?this._all(a,n):o.push(a))}e=o.pop()}return n}collides(t){let e=this.data;if(!F(t,e))return!1;const n=[];for(;e;){for(let r=0;e.children.length>r;r++){const o=e.children[r],i=e.leaf?this.toBBox(o):o;if(F(t,i)){if(e.leaf||D(t,i))return!0;n.push(o)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(this._minEntries>t.length){for(let e=0;t.length>e;e++)this.insert(t[e]);return this}let 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(e.height>this.data.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Y([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),o=[],i=[];let a,c,u;for(;n||o.length;){if(n||(n=o.pop(),c=o[o.length-1],a=i.pop(),u=!0),n.leaf){const r=T(t,n.children,e);if(-1!==r)return n.children.splice(r,1),o.push(n),this._condense(o),this}u||n.leaf||!D(n,r)?c?(a++,n=c.children[a],u=!1):n=null:(o.push(n),i.push(a),a=0,c=n,n=n.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const o=n-e+1;let i,a=this._maxEntries;if(a>=o)return i=Y(t.slice(e,n+1)),j(i,this.toBBox),i;r||(a=Math.ceil(o/Math.pow(a,(r=Math.ceil(Math.log(o)/Math.log(a)))-1))),i=Y([]),i.leaf=!1,i.height=r;const c=Math.ceil(o/a),u=c*Math.ceil(Math.sqrt(a));X(t,e,n,u,this.compareMinX);for(let o=e;n>=o;o+=u){const e=Math.min(o+u-1,n);X(t,o,e,c,this.compareMinY);for(let n=o;e>=n;n+=c){i.children.push(this._build(t,n,Math.min(n+c-1,e),r-1))}}return j(i,this.toBBox),i}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,a=1/0;for(let c=0;e.children.length>c;c++){const u=e.children[c],s=B(u),l=(Math.max((i=u).maxX,(o=t).maxX)-Math.min(i.minX,o.minX))*(Math.max(i.maxY,o.maxY)-Math.min(i.minY,o.minY))-s;a>l?(a=l,r=r>s?s:r,n=u):l===a&&r>s&&(r=s,n=u)}e=n||e.children[0]}var o,i;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),o=[],i=this._chooseSubtree(r,this.data,e,o);for(i.children.push(t),N(i,r);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(r,o,e)}_split(t,e){const n=t[e],r=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,r);const i=this._chooseSplitIndex(n,o,r),a=Y(n.children.splice(i,n.children.length-i));a.height=n.height,a.leaf=n.leaf,j(n,this.toBBox),j(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=Y([t,e]),this.data.height=t.height+1,this.data.leaf=!1,j(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,o=1/0,i=1/0;for(let a=e;n-e>=a;a++){const e=A(t,0,a,this.toBBox),c=A(t,a,n,this.toBBox),u=G(e,c),s=B(e)+B(c);o>u?(o=u,r=a,i=i>s?s:i):u===o&&i>s&&(i=s,r=a)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:R,o=t.leaf?this.compareMinY:_,i=this._allDistMargin(t,e,n,r);this._allDistMargin(t,e,n,o)>i&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const o=this.toBBox,i=A(t,0,e,o),a=A(t,n-e,n,o);let c=I(i)+I(a);for(let r=e;n-e>r;r++){const e=t.children[r];N(i,t.leaf?o(e):e),c+=I(i)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];N(a,t.leaf?o(e):e),c+=I(a)}return c}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)N(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():j(t[n],this.toBBox)}}function T(t,e,n){if(!n)return e.indexOf(t);for(let r=0;e.length>r;r++)if(n(t,e[r]))return r;return-1}function j(t,e){A(t,0,t.children.length,e,t)}function A(t,e,n,r,o){o||(o=Y(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let i=e;n>i;i++){const e=t.children[i];N(o,t.leaf?r(e):e)}return o}function N(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function R(t,e){return t.minX-e.minX}function _(t,e){return t.minY-e.minY}function B(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function I(t){return t.maxX-t.minX+(t.maxY-t.minY)}function G(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),o=Math.min(t.maxX,e.maxX),i=Math.min(t.maxY,e.maxY);return Math.max(0,o-n)*Math.max(0,i-r)}function D(t,e){return!(t.minX>e.minX||t.minY>e.minY||e.maxX>t.maxX||e.maxY>t.maxY)}function F(t,e){return!(e.minX>t.maxX||e.minY>t.maxY||t.minX>e.maxX||t.minY>e.maxY)}function Y(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X(t,e,n,r,o){const i=[e,n];for(;i.length;){if(r>=(n=i.pop())-(e=i.pop()))continue;const a=e+Math.ceil((n-e)/r/2)*r;S(t,a,e,n,o),i.push(e,a,a,n)}}function H(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function $(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?H(Object(n),!0).forEach((function(e){J(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function U(){
4
4
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
5
- q=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=Object.create((e&&e.prototype instanceof h?e:h).prototype),o=new L(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return S()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=b(a,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=u(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,o),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function h(){}function f(){}function d(){}var v={};c(v,i,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&n.call(y,i)&&(v=y);var g=d.prototype=h.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,o,a,c){var s=u(t[i],t,o);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=u(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function P(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=d,c(g,"constructor",d),c(d,"constructor",f),f.displayName=c(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(x.prototype),c(x.prototype,o,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new x(s(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var c=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===t||"continue"===t)&&e>=o.tryLoc&&o.finallyLoc>=e&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function V(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}function z(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){V(o,r,i,a,c,"next",t)}function c(t){V(o,r,i,a,c,"throw",t)}a(void 0)}))}}function Q(){return Q=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Q.apply(this,arguments)}function J(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,K(t,e)}function K(t,e){return K=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},K(t,e)}U=i([n.singleton({token:X})],U);var Z=function(){function t(){}var n=t.prototype;return n.hash=function(t){return""},n.render=function(t,n){var r=n.fill,i=n.opacity,o=n.fillOpacity,a=n.stroke,c=n.strokeOpacity,s=n.lineWidth,u=n.lineCap,l=n.lineJoin,h=n.shadowColor,f=n.filter,d=n.miterLimit,v=!e.isNil(r),p=!e.isNil(a),y=0===r.alpha;if(v&&(e.isNil(o)||1===o.value?t.fill():(t.globalAlpha=o.value,t.fill(),t.globalAlpha=i.value)),p&&s&&s.value>0){var g,m,x;!e.isNil(c)&&1!==c.value&&(t.globalAlpha=c.value),t.lineWidth=s.value,e.isNil(d)||(t.miterLimit=d),e.isNil(u)||(t.lineCap=u.value),e.isNil(l)||(t.lineJoin=l.value);var b=!e.isNil(h),w=!e.isNil(f);b&&(m=t.shadowColor,e.isNil(g=t.shadowBlur)||(t.shadowColor="transparent",t.shadowBlur=0)),w&&!e.isNil(x=t.filter)&&x.indexOf("drop-shadow")>-1&&(t.filter=x.replace(/drop-shadow\([^)]*\)/,"").trim()||"none");var E=v&&!y;E&&t.stroke(),b&&(t.shadowColor=m,t.shadowBlur=g),w&&(t.filter=x),E||t.stroke()}},t}(),tt=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e}(Z=i([n.singleton()],Z));tt=i([n.singleton({token:I})],tt);var et=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e}(Z);et=i([n.singleton({token:R})],et);var nt=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e}(Z);nt=i([n.singleton({token:A})],nt);var rt=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e}(Z);rt=i([n.singleton({token:G})],rt);var it=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e}(Z);it=i([n.singleton({token:D})],it);var ot=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e}(Z);ot=i([n.singleton({token:F})],ot);var at=function(t){function e(){return t.apply(this,arguments)||this}return J(e,t),e}(Z);at=i([n.singleton({token:Y})],at);var ct=function(){function t(){this.gradientCache={}}var n=t.prototype;return n.getOrCreateGradient=function(t,n){var r=this.generateCacheKey(t),i=t.type,o=t.x0,a=t.y0,c=t.x1,s=t.y1,u=t.steps,l=t.width,h=t.height;if(this.gradientCache[r])return this.gradientCache[r];var f=null;if(i===e.GradientPatternType.LinearGradient)f=n.createLinearGradient(o*l,a*h,c*l,s*h);else if(i===e.GradientPatternType.RadialGradient){f=n.createRadialGradient(o*l,a*h,0,c*l,s*h,t.r1*(Math.sqrt(l*l+h*h)/2))}return f&&(u.forEach((function(t){var e,n=t[1];null===(e=f)||void 0===e||e.addColorStop(Number(t[0]),n)})),this.gradientCache[r]=f),this.gradientCache[r]},n.generateCacheKey=function(t){return"gradient-"+t.type+"-"+t.x0+"-"+t.y0+"-"+t.x1+"-"+t.y1+"-"+(t.r1||0)+"-"+t.width+"-"+t.height+"-"+t.steps.map((function(t){return t.join("")})).join("-")},t}();ct=i([n.singleton()],ct);var st=n.Syringe.defineToken("PathGeneratorFactory"),ut=n.Syringe.defineToken("PathGenerator"),lt="undefined"!=typeof Float32Array?Float32Array:Array;function ht(t,e){var n=e[4],r=e[5],i=e[6],o=e[8],a=e[9],c=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(n,r,i),t[2]=Math.hypot(o,a,c),t}function ft(){var t=new lt(3);return lt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function dt(t,e,n){var r=new lt(3);return r[0]=t,r[1]=e,r[2]=n,r}function vt(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],c=n[1],s=n[2];return t[0]=i*s-o*c,t[1]=o*a-r*s,t[2]=r*c-i*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var pt,yt=function(t){return Math.hypot(t[0],t[1],t[2])};pt=ft();!function(){var t,e=(t=new lt(4),lt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function gt(){var t=new lt(4);return lt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function mt(t,e,n,r){var i,o,a,c,s,u=e[0],l=e[1],h=e[2],f=e[3],d=n[0],v=n[1],p=n[2],y=n[3];return 0>(o=u*d+l*v+h*p+f*y)&&(o=-o,d=-d,v=-v,p=-p,y=-y),1-o>1e-6?(a=Math.sin(i=Math.acos(o)),c=Math.sin((1-r)*i)/a,s=Math.sin(r*i)/a):(c=1-r,s=r),t[0]=c*u+s*d,t[1]=c*l+s*v,t[2]=c*h+s*p,t[3]=c*f+s*y,t}var xt,bt,wt,Et,Lt,Pt,St,Ct,Mt,kt=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t},Ot=(xt=ft(),bt=dt(1,0,0),wt=dt(0,1,0),Et=gt(),Lt=gt(),Pt=new lt(9),lt!=Float32Array&&(Pt[1]=0,Pt[2]=0,Pt[3]=0,Pt[5]=0,Pt[6]=0,Pt[7]=0),Pt[0]=1,Pt[4]=1,Pt[8]=1,St=Pt,function(){this.aabb=void 0});Ot.tag="c-canvas-rbush-node";var Tt,Nt,jt="RBushRoot",_t=(Ct=function(){function t(){this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.imagePool=void 0,this.gradientPool=void 0,this.pathGeneratorFactory=void 0,this.styleRendererFactory=void 0,this.displayObjectPool=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.enableBatch=!1,this.batchedStyleHash="",this.batchedDisplayObject=null,this.toSync=new Set}var n=t.prototype;return n.syncRTree=function(){var t=this,e=[];Array.from(this.toSync).filter((function(t){return t.isConnected})).forEach((function(n){var r=n.rBushNode;r&&t.rBush.remove(r.aabb);var i=n.getRenderBounds();if(i){var o=i.getMin(),a=o[0],c=o[1],s=i.getMax();r.aabb={id:n.entity,minX:a,minY:c,maxX:s[0],maxY:s[1]}}r.aabb&&e.push(r.aabb)})),this.rBush.load(e),this.toSync.clear()},n.pushToSync=function(t){var e=this;t.forEach((function(t){e.toSync.add(t)}))},n.apply=function(t){var n=this,r=function(t){t.target.rBushNode=new Ot,n.pushToSync(t.composedPath().slice(0,-2))},i=function(t){var e=t.target,r=e.rBushNode;r.aabb&&(n.rBush.remove(r.aabb),n.toSync.delete(e),n.removedRBushNodeAABBs.push(r.aabb))},o=function(t){var e,r=t.target;(null===(e=r.ownerDocument)||void 0===e?void 0:e.documentElement)===n.renderingContext.root&&(t.detail.affectChildren&&r.forEach((function(t){n.pushToSync([t])})),n.pushToSync(t.composedPath().slice(0,-2)))};t.hooks.init.tapPromise(Mt.tag,z(q().mark((function t(){var a,c,s,u;return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,i),n.renderingContext.root.addEventListener(e.ElementEvent.BOUNDS_CHANGED,o),c=(a=n.canvasConfig).width,s=a.height,u=n.contextService.getContext(),n.clearRect(u,0,0,c,s);case 6:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(Mt.tag,(function(){n.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,i),n.renderingContext.root.removeEventListener(e.ElementEvent.BOUNDS_CHANGED,o)})),t.hooks.beginFrame.tap(Mt.tag,(function(){var t=n.contextService.getContext(),r=n.canvasConfig,i=r.width,o=r.height,a=r.renderer.getConfig();n.clearFullScreen=!a.enableDirtyRectangleRendering||n.renderingContext.renderReasons.has(e.RenderReason.CAMERA_CHANGED),t&&(t.save(),n.clearFullScreen&&n.clearRect(t,0,0,i,o),n.applyTransform(t,n.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(Mt.tag,(function(){n.syncRTree();var r=n.canvasConfig.renderer.getConfig(),i=r.enableDirtyRectangleRendering,o=r.enableDirtyRectangleRenderingDebug,a=n.contextService.getContext(),c=n.renderQueue;if(i){if(!n.clearFullScreen){var s=n.safeMergeAABB.apply(n,[n.mergeDirtyAABBs(n.renderQueue)].concat(n.removedRBushNodeAABBs.map((function(t){var n=t.minX,r=t.minY,i=t.maxX,o=t.maxY,a=new e.AABB;return a.setMinMax(dt(n,r,0),dt(i,o,0)),a}))));if(n.removedRBushNodeAABBs=[],e.AABB.isEmpty(s))return void(n.renderQueue=[]);var u=n.convertAABB2Rect(s),l=u.x,h=u.y,f=u.width,d=u.height;n.clearRect(a,l,h,f,d),a.beginPath(),a.rect(l,h,f,d),a.clip(),o&&(a.lineWidth=4,a.strokeStyle="rgba("+255*Math.random()+", "+255*Math.random()+", "+255*Math.random()+", 1)",a.strokeRect(l,h,f,d)),c=n.searchDirtyObjects(s)}c.sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&n.renderDisplayObject(e,t)})),n.enableBatch&&n.batchedStyleHash&&n.flush(a,t),n.renderQueue.forEach((function(t){n.saveDirtyAABB(t)})),n.renderQueue=[]}n.restoreStack.forEach((function(t){a.restore()})),n.restoreStack=[],n.clearFullScreen=!1,a.restore()})),t.hooks.render.tap(Mt.tag,(function(e){n.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering?n.renderQueue.push(e):e.isVisible()&&!e.isCulled()&&n.renderDisplayObject(e,t)}))},n.clearRect=function(t,e,n,r,i){t.clearRect(e,n,r,i);var o=this.canvasConfig.background;o&&(t.fillStyle=o,t.fillRect(e,n,r,i))},n.flush=function(t,e){if(this.batchedDisplayObject){var n=this.styleRendererFactory(this.batchedDisplayObject.nodeName);n&&(this.applyAttributesToContext(t,this.batchedDisplayObject,e),t.closePath(),n.render(t,this.batchedDisplayObject.parsedStyle,this.batchedDisplayObject),t.restore()),this.batchedStyleHash="",this.batchedDisplayObject=null}},n.renderDisplayObject=function(t,n){for(var r=this,i=this.contextService.getContext(),o=this.restoreStack[this.restoreStack.length-1];o&&t.parentNode!==o;)i.restore(),this.restoreStack.pop(),o=this.restoreStack[this.restoreStack.length-1];var a=this.styleRendererFactory(t.nodeName),c=!1;if(this.enableBatch&&a){var s=a.hash(t.attributes);this.batchedStyleHash&&s!==this.batchedStyleHash&&this.flush(i,n),this.batchedStyleHash||(this.batchedStyleHash=s,this.batchedDisplayObject=t,c=!0)}i.save(),this.applyTransform(i,t.getLocalTransform());var u=t.style.clipPath;if(u){i.save(),this.applyTransform(i,u.getLocalTransform());var l=this.pathGeneratorFactory(u.nodeName);l&&this.useAnchor(i,u,(function(){i.beginPath(),l(i,u.parsedStyle),i.closePath()})),i.restore(),i.clip()}this.enableBatch||(i.save(),this.applyAttributesToContext(i,t,n)),this.useAnchor(i,t,(function(){var n=r.pathGeneratorFactory(t.nodeName);n&&(!c&&r.enableBatch||i.beginPath(),n(i,t.parsedStyle),r.enableBatch||t.nodeName===e.Shape.LINE||t.nodeName===e.Shape.PATH||t.nodeName===e.Shape.POLYLINE||i.closePath()),a&&!r.enableBatch&&a.render(i,t.parsedStyle,t)})),this.enableBatch||i.restore(),t.renderable.dirty=!1,this.restoreStack.push(t)},n.convertAABB2Rect=function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},n.mergeDirtyAABBs=function(t){var n=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();n.add(e);var r=t.renderable.dirtyRenderBounds;r&&n.add(r)})),n},n.searchDirtyObjects=function(t){var e=this,n=t.getMin(),r=n[0],i=n[1],o=t.getMax();return this.rBush.search({minX:r,minY:i,maxX:o[0],maxY:o[1]}).map((function(t){return e.displayObjectPool.getByEntity(t.id)}))},n.saveDirtyAABB=function(t){var n=t.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new e.AABB);var r=t.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)},n.applyTransform=function(t,n){var r=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}(ft(),n),i=r[0],o=r[1],a=ht(ft(),n),c=a[0],s=a[1],u=function(t,e){var n=new lt(3);ht(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,c=e[1]*i,s=e[2]*o,u=e[4]*r,l=e[5]*i,h=e[6]*o,f=e[8]*r,d=e[9]*i,v=e[10]*o,p=a+l+v,y=0;return p>0?(t[3]=.25*(y=2*Math.sqrt(p+1)),t[0]=(h-d)/y,t[1]=(f-s)/y,t[2]=(c-u)/y):a>l&&a>v?(t[3]=(h-d)/(y=2*Math.sqrt(1+a-l-v)),t[0]=.25*y,t[1]=(c+u)/y,t[2]=(f+s)/y):l>v?(t[3]=(f-s)/(y=2*Math.sqrt(1+l-a-v)),t[0]=(c+u)/y,t[1]=.25*y,t[2]=(h+d)/y):(t[3]=(c-u)/(y=2*Math.sqrt(1+v-a-l)),t[0]=(f+s)/y,t[1]=(h+d)/y,t[2]=.25*y),t}(gt(),n),l=e.getEuler(ft(),u),h=e.fromRotationTranslationScale(l[0]||l[2],i,o,c,s);t.transform(h[0],h[1],h[3],h[4],h[6],h[7])},n.getColor=function(t,n,r,i){var o;if(t instanceof e.CSSGradientValue){if(t.type===e.GradientPatternType.LinearGradient||t.type===e.GradientPatternType.RadialGradient){var a=n.getGeometryBounds();o=this.gradientPool.getOrCreateGradient(Q({type:t.type},t.value,{width:a&&2*a.halfExtents[0]||0,height:a&&2*a.halfExtents[1]||0}),r)}else if(t.type===e.GradientPatternType.Pattern){var c=this.imagePool.getPatternSync(t.value);c?o=c:this.imagePool.createPattern(t.value,r).then((function(){n.renderable.dirty=!0,i.dirtify()}))}}else o=""+t;return o},n.applyAttributesToContext=function(t,n,r){var i=n.parsedStyle,o=i.stroke,a=i.fill,c=i.opacity,s=i.lineDash,u=i.lineDashOffset,l=i.filter,h=i.shadowColor,f=i.shadowBlur,d=i.shadowOffsetX,v=i.shadowOffsetY;s&&Array.isArray(s)&&t.setLineDash(s.map((function(t){return t.value}))),e.isNil(u)||(t.lineDashOffset=u.value),e.isNil(c)||(t.globalAlpha*=c.value),e.isNil(o)||(t.strokeStyle=this.getColor(o,n,t,r)),e.isNil(a)||(t.fillStyle=this.getColor(a,n,t,r)),e.isNil(l)||(t.filter=n.style.filter),e.isNil(h)||(t.shadowColor=""+h,t.shadowBlur=f&&f.value||0,t.shadowOffsetX=d&&d.value||0,t.shadowOffsetY=v&&v.value||0)},n.useAnchor=function(t,e,n){var r=e.getGeometryBounds();if(r){var i=r.halfExtents,o=(e.parsedStyle||{}).anchor;t.translate(-(o&&o[0].value||0)*i[0]*2,-(o&&o[1].value||0)*i[1]*2),n()}else n()},n.safeMergeAABB=function(){for(var t=new e.AABB,n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];return r.forEach((function(e){t.add(e)})),t},t}(),Ct.tag="CanvasRenderer",Mt=Ct);i([n.inject(e.CanvasConfig),o("design:type",Object)],_t.prototype,"canvasConfig",void 0),i([n.inject(e.DefaultCamera),o("design:type",e.Camera)],_t.prototype,"camera",void 0),i([n.inject(e.ContextService),o("design:type",Object)],_t.prototype,"contextService",void 0),i([n.inject(e.RenderingContext),o("design:type",Object)],_t.prototype,"renderingContext",void 0),i([n.inject($),o("design:type",$)],_t.prototype,"imagePool",void 0),i([n.inject(ct),o("design:type",ct)],_t.prototype,"gradientPool",void 0),i([n.inject(st),o("design:type",Function)],_t.prototype,"pathGeneratorFactory",void 0),i([n.inject(B),o("design:type",Function)],_t.prototype,"styleRendererFactory",void 0),i([n.inject(e.DisplayObjectPool),o("design:type",e.DisplayObjectPool)],_t.prototype,"displayObjectPool",void 0),i([n.inject(jt),o("design:type",b)],_t.prototype,"rBush",void 0),_t=Mt=i([n.singleton({contrib:e.RenderingPluginContribution})],_t);var Bt=(Tt=function(){function t(){this.imagePool=void 0,this.renderingContext=void 0}return t.prototype.apply=function(t){var n=this,r=function(r){var i=r.target;if(i.nodeName===e.Shape.IMAGE){var o=i.attributes.img;e.isString(o)&&n.imagePool.getOrCreateImage(o).then((function(){i.renderable.dirty=!0,t.dirtify()}))}},i=function(r){var i=r.target,o=r.newValue;i.nodeName===e.Shape.IMAGE&&"img"===r.attrName&&e.isString(o)&&n.imagePool.getOrCreateImage(o).then((function(){i.renderable.dirty=!0,t.dirtify()}))};t.hooks.init.tapPromise(Nt.tag,z(q().mark((function t(){return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(e.ElementEvent.ATTR_MODIFIED,i);case 2:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(Nt.tag,(function(){n.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(e.ElementEvent.ATTR_MODIFIED,i)}))},t}(),Tt.tag="LoadImage",Nt=Tt);i([n.inject($),o("design:type",$)],Bt.prototype,"imagePool",void 0),i([n.inject(e.RenderingContext),o("design:type",Object)],Bt.prototype,"renderingContext",void 0),Bt=Nt=i([n.singleton({contrib:e.RenderingPluginContribution})],Bt),n.GlobalContainer.register({token:{token:ut,named:e.Shape.CIRCLE},useValue:function(t,e){var n=e.r;t.arc(n.value,n.value,n.value,0,2*Math.PI,!1)}}),n.GlobalContainer.register({token:{token:ut,named:e.Shape.ELLIPSE},useValue:function(t,e){var n=e.rx.value,r=e.ry.value;if(t.ellipse)t.ellipse(n,r,n,r,0,0,2*Math.PI,!1);else{var i=n>r?n:r,o=n>r?1:n/r,a=n>r?r/n:1;t.save(),t.scale(o,a),t.arc(0,0,i,0,2*Math.PI)}}}),n.GlobalContainer.register({token:{token:ut,named:e.Shape.RECT},useValue:function(t,e){var n=e.radius,r=e.width.value,i=e.height.value;if(n&&n.some((function(t){return 0!==t.value}))){var o=n.map((function(t){return t.value})),a=o[0],c=o[1],s=o[2],u=o[3];t.moveTo(a,0),t.lineTo(r-c,0),0!==c&&t.arc(r-c,c,c,-Math.PI/2,0),t.lineTo(r,i-s),0!==s&&t.arc(r-s,i-s,s,0,Math.PI/2),t.lineTo(u,i),0!==u&&t.arc(u,i-u,u,Math.PI/2,Math.PI),t.lineTo(0,a),0!==a&&t.arc(a,a,a,Math.PI,1.5*Math.PI)}else t.rect(0,0,r,i)}}),n.GlobalContainer.register({token:{token:ut,named:e.Shape.LINE},useValue:function(t,e){var n=e.x2,r=e.y2,i=e.defX,o=void 0===i?0:i,a=e.defY,c=void 0===a?0:a;t.moveTo(e.x1.value-o,e.y1.value-c),t.lineTo(n.value-o,r.value-c)}}),n.GlobalContainer.register({token:{token:ut,named:e.Shape.POLYLINE},useValue:function(t,e){var n=e.defX,r=void 0===n?0:n,i=e.defY,o=void 0===i?0:i,a=e.points.points,c=a.length,s=a[c-1][0]-r,u=a[c-1][1]-o;t.moveTo(a[0][0]-r,a[0][1]-o);for(var l=0;c-1>l;l++){var h=a[l];t.lineTo(h[0]-r,h[1]-o)}t.lineTo(s,u)}}),n.GlobalContainer.register({token:{token:ut,named:e.Shape.POLYGON},useValue:function(t,e){var n=e.defX,r=void 0===n?0:n,i=e.defY,o=void 0===i?0:i,a=e.points.points,c=a.length,s=a[c-1][0]-r,u=a[c-1][1]-o;t.moveTo(a[0][0]-r,a[0][1]-o);for(var l=0;c-1>l;l++){var h=a[l];t.lineTo(h[0]-r,h[1]-o)}t.lineTo(s,u)}}),n.GlobalContainer.register({token:{token:ut,named:e.Shape.PATH},useValue:function(t,e){var n=e.defX,r=void 0===n?0:n,i=e.defY,o=void 0===i?0:i,a=e.path,c=a.zCommandIndexes,s=[].concat(a.curve);c.forEach((function(t,e){s.splice(t+e,1,["Z"])}));for(var u=0;s.length>u;u++){var l=s[u];switch(l[0]){case"M":t.moveTo(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()}}}}),n.GlobalContainer.register({token:st,useFactory:function(t){var e={};return function(n){return e[n]||t.container.isBoundNamed(ut,n)&&(e[n]=t.container.getNamed(ut,n)),e[n]}}});var Rt=n.Module((function(t){var n;t($),t({token:jt,useValue:new b}),t(et),t(nt),t(tt),t(W),t(U),t(rt),t(it),t(ot),t(at);var r=((n={})[e.Shape.CIRCLE]=R,n[e.Shape.ELLIPSE]=A,n[e.Shape.RECT]=I,n[e.Shape.IMAGE]=H,n[e.Shape.TEXT]=X,n[e.Shape.LINE]=G,n[e.Shape.POLYLINE]=D,n[e.Shape.POLYGON]=F,n[e.Shape.PATH]=Y,n);t({token:B,useFactory:function(t){var e={};return function(n){var i=r[n];return i&&!e[n]&&t.container.isBound(i)&&(e[n]=t.container.get(i)),e[n]}}}),t(ct),t(_t),t(Bt)})),At=function(){function t(){this.name="canvas-renderer"}var e=t.prototype;return e.init=function(t){t.load(Rt,!0)},e.destroy=function(t){t.unload(Rt)},t}(),It=Object.freeze({__proto__:null,get CircleRenderer(){return et},CircleRendererContribution:R,get EllipseRenderer(){return nt},EllipseRendererContribution:A,get ImageRenderer(){return W},ImageRendererContribution:H,get LineRenderer(){return rt},LineRendererContribution:G,PathGenerator:ut,PathGeneratorFactory:st,get PathRenderer(){return at},PathRendererContribution:Y,Plugin:At,get PolygonRenderer(){return ot},PolygonRendererContribution:F,get PolylineRenderer(){return it},PolylineRendererContribution:D,RBushNode:Ot,RBushRoot:jt,get RectRenderer(){return tt},RectRendererContribution:I,StyleRendererFactory:B,get TextRenderer(){return U},TextRendererContribution:X,RBush:b});function Gt(){
5
+ U=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new P(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return L()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=w(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,i),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var h={};function f(){}function d(){}function v(){}var p={};u(p,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&n.call(g,i)&&(p=g);var m=v.prototype=f.prototype=Object.create(p);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(i,a,c,u){var s=l(t[i],t,a);if("throw"!==s.type){var h=s.arg,f=h.value;return f&&"object"==r(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(f).then((function(t){h.value=t,c(h)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,n){function r(){return new e((function(e,r){o(t,n,e,r)}))}return i=i?i.then(r,r):r()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return d.prototype=v,u(m,"constructor",v),u(v,"constructor",d),d.displayName=u(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new x(s(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function W(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function q(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){W(i,r,o,a,c,"next",t)}function c(t){W(i,r,o,a,c,"throw",t)}a(void 0)}))}}function V(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Q(t,e,n){return e&&z(t.prototype,e),n&&z(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function J(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function K(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&tt(t,e)}function Z(t){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Z(t)}function tt(t,e){return tt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},tt(t,e)}function et(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function nt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Z(t);if(e){var o=Z(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return et(this,n)}}function rt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,c=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(c)throw o}}return i}(t,e)||it(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ot(t){return function(t){if(Array.isArray(t))return at(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||it(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){if(t){if("string"==typeof t)return at(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(t,e):void 0}}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}var ct="undefined"!=typeof Float32Array?Float32Array:Array;function ut(t,e){var n=e[4],r=e[5],o=e[6],i=e[8],a=e[9],c=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(n,r,o),t[2]=Math.hypot(i,a,c),t}function st(){var t=new ct(3);return ct!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function lt(t,e,n){var r=new ct(3);return r[0]=t,r[1]=e,r[2]=n,r}function ht(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[0],c=n[1],u=n[2];return t[0]=o*u-i*c,t[1]=i*a-r*u,t[2]=r*c-o*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var ft,dt=function(t){return Math.hypot(t[0],t[1],t[2])};ft=st();!function(){var t,e=(t=new ct(4),ct!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function vt(){var t=new ct(4);return ct!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function pt(t,e,n,r){var o,i,a,c,u,s=e[0],l=e[1],h=e[2],f=e[3],d=n[0],v=n[1],p=n[2],y=n[3];return 0>(i=s*d+l*v+h*p+f*y)&&(i=-i,d=-d,v=-v,p=-p,y=-y),1-i>1e-6?(a=Math.sin(o=Math.acos(i)),c=Math.sin((1-r)*o)/a,u=Math.sin(r*o)/a):(c=1-r,u=r),t[0]=c*s+u*d,t[1]=c*l+u*v,t[2]=c*h+u*p,t[3]=c*f+u*y,t}var yt,gt,mt,bt,xt,wt,Et,kt=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n*n+r*r+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=o*a,t[3]=i*a,t},Pt=(yt=st(),gt=lt(1,0,0),mt=lt(0,1,0),bt=vt(),xt=vt(),wt=new ct(9),ct!=Float32Array&&(wt[1]=0,wt[2]=0,wt[3]=0,wt[5]=0,wt[6]=0,wt[7]=0),wt[0]=1,wt[4]=1,wt[8]=1,Et=wt,Q((function t(){V(this,t),this.aabb=void 0})));Pt.tag="c-canvas-rbush-node";var St=function(){function t(){V(this,t),this.gradientCache={}}return Q(t,[{key:"getOrCreateGradient",value:function(t,n){var r=this.generateCacheKey(t),o=t.type,i=t.x0,a=t.y0,c=t.x1,u=t.y1,s=t.steps,l=t.width,h=t.height;if(this.gradientCache[r])return this.gradientCache[r];var f=null;if(o===e.GradientPatternType.LinearGradient)f=n.createLinearGradient(i*l,a*h,c*l,u*h);else if(o===e.GradientPatternType.RadialGradient){f=n.createRadialGradient(i*l,a*h,0,c*l,u*h,t.r1*(Math.sqrt(l*l+h*h)/2))}return f&&(s.forEach((function(t){var e,n=rt(t,2),r=n[1];null===(e=f)||void 0===e||e.addColorStop(Number(n[0]),r)})),this.gradientCache[r]=f),this.gradientCache[r]}},{key:"generateCacheKey",value:function(t){var e=t.x0,n=t.y0,r=t.x1,o=t.y1,i=t.r1,a=t.steps,c=t.width,u=t.height;return"gradient-".concat(t.type,"-").concat(e,"-").concat(n,"-").concat(r,"-").concat(o,"-").concat(i||0,"-").concat(c,"-").concat(u,"-").concat(a.map((function(t){return t.join("")})).join("-"))}}]),t}();St=h([n.singleton()],St);var Lt=function(){function t(){V(this,t),this.imageCache={},this.patternCache={},this.canvasConfig=void 0}return Q(t,[{key:"getImageSync",value:function(t){return this.imageCache[t]}},{key:"getOrCreateImage",value:function(t){var n=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var r=this.canvasConfig.createImage;return new Promise((function(o,i){var a;r?a=r(t):e.isBrowser&&(a=new window.Image),a&&(a.onload=function(){o(a)},a.onerror=function(t){i(t)},a.crossOrigin="Anonymous",a.src=t,n.imageCache[t]=a)}))}},{key:"getPatternSync",value:function(t){var e=this.generatePatternKey(t);if(this.patternCache[e])return this.patternCache[e]}},{key:"createPattern",value:function(t,e){var n=this;return this.getOrCreateImage(t.src).then((function(r){var o=n.generatePatternKey(t),i=e.createPattern(r,t.repetition);return i&&(n.patternCache[o]=i),n.patternCache[o]}))}},{key:"generatePatternKey",value:function(t){var e=t.repetition;return"pattern-".concat(t.src,"-").concat(e)}}]),t}();h([n.inject(e.CanvasConfig),f("design:type",Object)],Lt.prototype,"canvasConfig",void 0),Lt=h([n.singleton()],Lt);var Ot=n.Syringe.defineToken("PathGeneratorFactory"),Ct=n.Syringe.defineToken("PathGenerator"),Mt=n.Syringe.defineToken("StyleRendererFactory"),Tt=n.Syringe.defineToken("CircleRenderer",{multiple:!1}),jt=n.Syringe.defineToken("EllipseRenderer",{multiple:!1}),At=n.Syringe.defineToken("RectRenderer",{multiple:!1}),Nt=n.Syringe.defineToken("LineRenderer",{multiple:!1}),Rt=n.Syringe.defineToken("PolylineRenderer",{multiple:!1}),_t=n.Syringe.defineToken("PolygonRenderer",{multiple:!1}),Bt=n.Syringe.defineToken("PathRenderer",{multiple:!1}),It=n.Syringe.defineToken("TextRenderer",{multiple:!1}),Gt=n.Syringe.defineToken("ImageRenderer",{multiple:!1}),Dt=function(){function t(){V(this,t),this.imagePool=void 0}return Q(t,[{key:"hash",value:function(t){return""}},{key:"render",value:function(t,n){var r,o=n.img,i=n.width.value,a=n.height.value;if(e.isString(o)?r=this.imagePool.getImageSync(o):(i||(i=o.width),a||(a=o.height),r=o),r)try{t.drawImage(r,0,0,i,a)}catch(t){}}}]),t}();h([n.inject(Lt),f("design:type",Lt)],Dt.prototype,"imagePool",void 0),Dt=h([n.singleton({token:Gt})],Dt);var Ft=function(){function t(){V(this,t)}return Q(t,[{key:"hash",value:function(t){return""}},{key:"render",value:function(t,n,r){var o=n.lineWidth,i=n.textAlign,a=n.textBaseline,c=n.lineJoin,u=n.miterLimit,s=void 0===u?0:u,l=n.letterSpacing,h=void 0===l?0:l,f=n.stroke,d=n.fill,v=n.fillOpacity,p=n.strokeOpacity,y=n.opacity,g=n.metrics,m=n.dx,b=n.dy,x=g.lines,w=g.height,E=g.lineHeight,k=g.lineMetrics;t.font=g.font,t.lineWidth=o.value,t.textAlign=i.value,t.textBaseline=a.value,t.lineJoin=c.value,t.miterLimit=s;var P=0;"middle"===a.value?P=-w/2-E/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?P=-w:"top"!==a.value&&"hanging"!==a.value||(P=-E);var S=0;m&&m.unit===e.UnitType.kPixels&&(S+=m.value),b&&b.unit===e.UnitType.kPixels&&(P+=b.value);for(var L=0;x.length>L;L++){var O=o.value/2+S;P+=E,!e.isNil(f)&&!f.isNone&&o&&o.value&&this.drawLetterSpacing(t,x[L],k[L],i.value,O,P,h,v.value,p.value,y.value,!0),e.isNil(d)||this.drawLetterSpacing(t,x[L],k[L],i.value,O,P,h,v.value,p.value,y.value)}}},{key:"drawLetterSpacing",value:function(t,e,n,r,o,i,a,c,u,s){var l=arguments.length>10&&void 0!==arguments[10]&&arguments[10];if(0!==a){var h=t.textAlign;t.textAlign="left";var f=o;"center"===r?f=o-n.width/2:"right"!==r&&"end"!==r||(f=o-n.width);for(var d=Array.from(e),v=t.measureText(e).width,p=0,y=0;d.length>y;++y){var g=d[y];l?this.strokeText(t,g,f,i,u):this.fillText(t,g,f,i,c,s),f+=v-(p=t.measureText(e.substring(y+1)).width)+a,v=p}t.textAlign=h}else l?this.strokeText(t,e,o,i,u):this.fillText(t,e,o,i,c,s)}},{key:"fillText",value:function(t,n,r,o,i,a){var c,u=!e.isNil(i)&&1!==i;u&&(c=t.globalAlpha,t.globalAlpha=i*a),t.fillText(n,r,o),u&&(t.globalAlpha=c)}},{key:"strokeText",value:function(t,n,r,o,i){var a,c=!e.isNil(i)&&1!==i;c&&(a=t.globalAlpha,t.globalAlpha=i),t.strokeText(n,r,o),c&&(t.globalAlpha=a)}}]),t}();Ft=h([n.singleton({token:It})],Ft);var Yt=function(){function t(){V(this,t)}return Q(t,[{key:"hash",value:function(t){return""}},{key:"render",value:function(t,n){var r=n.fill,o=n.opacity,i=n.fillOpacity,a=n.stroke,c=n.strokeOpacity,u=n.lineWidth,s=n.lineCap,l=n.lineJoin,h=n.shadowColor,f=n.filter,d=n.miterLimit,v=!e.isNil(r)&&!r.isNone,p=!e.isNil(a)&&!a.isNone,y=0===r.alpha;if(v&&(e.isNil(i)||1===i.value?t.fill():(t.globalAlpha=i.value,t.fill(),t.globalAlpha=o.value)),p&&u&&u.value>0){var g,m,b;!e.isNil(c)&&1!==c.value&&(t.globalAlpha=c.value),t.lineWidth=u.value,e.isNil(d)||(t.miterLimit=d),e.isNil(s)||(t.lineCap=s.value),e.isNil(l)||(t.lineJoin=l.value);var x=!e.isNil(h),w=!e.isNil(f);x&&(m=t.shadowColor,e.isNil(g=t.shadowBlur)||(t.shadowColor="transparent",t.shadowBlur=0)),w&&!e.isNil(b=t.filter)&&b.indexOf("drop-shadow")>-1&&(t.filter=b.replace(/drop-shadow\([^)]*\)/,"").trim()||"none");var E=v&&!y;E&&t.stroke(),x&&(t.shadowColor=m,t.shadowBlur=g),w&&(t.filter=b),E||t.stroke()}}}]),t}(),Xt=function(t){K(n,t);var e=nt(n);function n(){return V(this,n),e.apply(this,arguments)}return Q(n)}(Yt=h([n.singleton()],Yt));Xt=h([n.singleton({token:At})],Xt);var Ht=function(t){K(n,t);var e=nt(n);function n(){return V(this,n),e.apply(this,arguments)}return Q(n)}(Yt);Ht=h([n.singleton({token:Tt})],Ht);var $t=function(t){K(n,t);var e=nt(n);function n(){return V(this,n),e.apply(this,arguments)}return Q(n)}(Yt);$t=h([n.singleton({token:jt})],$t);var Ut=function(t){K(n,t);var e=nt(n);function n(){return V(this,n),e.apply(this,arguments)}return Q(n)}(Yt);Ut=h([n.singleton({token:Nt})],Ut);var Wt=function(t){K(n,t);var e=nt(n);function n(){return V(this,n),e.apply(this,arguments)}return Q(n)}(Yt);Wt=h([n.singleton({token:Rt})],Wt);var qt=function(t){K(n,t);var e=nt(n);function n(){return V(this,n),e.apply(this,arguments)}return Q(n)}(Yt);qt=h([n.singleton({token:_t})],qt);var Vt,zt,Qt=function(t){K(n,t);var e=nt(n);function n(){return V(this,n),e.apply(this,arguments)}return Q(n)}(Yt);Qt=h([n.singleton({token:Bt})],Qt);var Jt,Kt,Zt="RBushRoot",te=(Vt=function(){function t(){V(this,t),this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.imagePool=void 0,this.gradientPool=void 0,this.pathGeneratorFactory=void 0,this.styleRendererFactory=void 0,this.displayObjectPool=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.enableBatch=!1,this.batchedStyleHash="",this.batchedDisplayObject=null,this.toSync=new Set}return Q(t,[{key:"syncRTree",value:function(){var t=this,e=[];Array.from(this.toSync).filter((function(t){return t.isConnected})).forEach((function(n){var r=n.rBushNode;r&&t.rBush.remove(r.aabb);var o=n.getRenderBounds();if(o){var i=rt(o.getMin(),2),a=i[0],c=i[1],u=rt(o.getMax(),2);r.aabb={id:n.entity,minX:a,minY:c,maxX:u[0],maxY:u[1]}}r.aabb&&e.push(r.aabb)})),this.rBush.load(e),this.toSync.clear()}},{key:"pushToSync",value:function(t){var e=this;t.forEach((function(t){e.toSync.add(t)}))}},{key:"apply",value:function(t){var n=this,r=function(t){t.target.rBushNode=new Pt,n.pushToSync(t.composedPath().slice(0,-2))},o=function(t){var e=t.target,r=e.rBushNode;r.aabb&&(n.rBush.remove(r.aabb),n.toSync.delete(e),n.removedRBushNodeAABBs.push(r.aabb))},i=function(t){var e,r=t.target;(null===(e=r.ownerDocument)||void 0===e?void 0:e.documentElement)===n.renderingContext.root&&(t.detail.affectChildren&&r.forEach((function(t){n.pushToSync([t])})),n.pushToSync(t.composedPath().slice(0,-2)))};t.hooks.init.tapPromise(zt.tag,q(U().mark((function t(){var a,c,u,s;return U().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,o),n.renderingContext.root.addEventListener(e.ElementEvent.BOUNDS_CHANGED,i),c=(a=n.canvasConfig).width,u=a.height,s=n.contextService.getContext(),n.clearRect(s,0,0,c,u);case 6:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(zt.tag,(function(){n.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,o),n.renderingContext.root.removeEventListener(e.ElementEvent.BOUNDS_CHANGED,i)})),t.hooks.beginFrame.tap(zt.tag,(function(){var t=n.contextService.getContext(),r=n.canvasConfig,o=r.width,i=r.height,a=r.renderer.getConfig();n.clearFullScreen=!a.enableDirtyRectangleRendering||n.renderingContext.renderReasons.has(e.RenderReason.CAMERA_CHANGED),t&&(t.save(),n.clearFullScreen&&n.clearRect(t,0,0,o,i),n.applyTransform(t,n.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(zt.tag,(function(){n.syncRTree();var r=n.canvasConfig.renderer.getConfig(),o=r.enableDirtyRectangleRendering,i=r.enableDirtyRectangleRenderingDebug,a=n.contextService.getContext(),c=n.renderQueue;if(o){if(!n.clearFullScreen){var u=n.safeMergeAABB.apply(n,[n.mergeDirtyAABBs(n.renderQueue)].concat(ot(n.removedRBushNodeAABBs.map((function(t){var n=t.minX,r=t.minY,o=t.maxX,i=t.maxY,a=new e.AABB;return a.setMinMax(lt(n,r,0),lt(o,i,0)),a})))));if(n.removedRBushNodeAABBs=[],e.AABB.isEmpty(u))return void(n.renderQueue=[]);var s=n.convertAABB2Rect(u),l=s.x,h=s.y,f=s.width,d=s.height;n.clearRect(a,l,h,f,d),a.beginPath(),a.rect(l,h,f,d),a.clip(),i&&(a.lineWidth=4,a.strokeStyle="rgba(".concat(255*Math.random(),", ").concat(255*Math.random(),", ").concat(255*Math.random(),", 1)"),a.strokeRect(l,h,f,d)),c=n.searchDirtyObjects(u)}c.sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&n.renderDisplayObject(e,t)})),n.enableBatch&&n.batchedStyleHash&&n.flush(a,t),n.renderQueue.forEach((function(t){n.saveDirtyAABB(t)})),n.renderQueue=[]}n.restoreStack.forEach((function(t){a.restore()})),n.restoreStack=[],n.clearFullScreen=!1,a.restore()})),t.hooks.render.tap(zt.tag,(function(e){n.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering?n.renderQueue.push(e):e.isVisible()&&!e.isCulled()&&n.renderDisplayObject(e,t)}))}},{key:"clearRect",value:function(t,e,n,r,o){t.clearRect(e,n,r,o);var i=this.canvasConfig.background;i&&(t.fillStyle=i,t.fillRect(e,n,r,o))}},{key:"flush",value:function(t,e){if(this.batchedDisplayObject){var n=this.styleRendererFactory(this.batchedDisplayObject.nodeName);n&&(this.applyAttributesToContext(t,this.batchedDisplayObject,e),t.closePath(),n.render(t,this.batchedDisplayObject.parsedStyle,this.batchedDisplayObject),t.restore()),this.batchedStyleHash="",this.batchedDisplayObject=null}}},{key:"renderDisplayObject",value:function(t,n){for(var r=this,o=this.contextService.getContext(),i=this.restoreStack[this.restoreStack.length-1];i&&t.parentNode!==i;)o.restore(),this.restoreStack.pop(),i=this.restoreStack[this.restoreStack.length-1];var a=this.styleRendererFactory(t.nodeName),c=!1;if(this.enableBatch&&a){var u=a.hash(t.attributes);this.batchedStyleHash&&u!==this.batchedStyleHash&&this.flush(o,n),this.batchedStyleHash||(this.batchedStyleHash=u,this.batchedDisplayObject=t,c=!0)}o.save(),this.applyTransform(o,t.getLocalTransform());var s=t.style.clipPath;if(s){o.save(),this.applyTransform(o,s.getLocalTransform());var l=this.pathGeneratorFactory(s.nodeName);l&&this.useAnchor(o,s,(function(){o.beginPath(),l(o,s.parsedStyle),o.closePath()})),o.restore(),o.clip()}this.enableBatch||(o.save(),this.applyAttributesToContext(o,t,n)),this.useAnchor(o,t,(function(){var n=r.pathGeneratorFactory(t.nodeName);n&&(!c&&r.enableBatch||o.beginPath(),n(o,t.parsedStyle),r.enableBatch||t.nodeName===e.Shape.LINE||t.nodeName===e.Shape.PATH||t.nodeName===e.Shape.POLYLINE||o.closePath()),a&&!r.enableBatch&&a.render(o,t.parsedStyle,t)})),this.enableBatch||o.restore(),t.renderable.dirty=!1,this.restoreStack.push(t)}},{key:"convertAABB2Rect",value:function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),o=Math.floor(e[1]);return{x:r,y:o,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-o}}},{key:"mergeDirtyAABBs",value:function(t){var n=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();n.add(e);var r=t.renderable.dirtyRenderBounds;r&&n.add(r)})),n}},{key:"searchDirtyObjects",value:function(t){var e=this,n=rt(t.getMin(),2),r=n[0],o=n[1],i=rt(t.getMax(),2);return this.rBush.search({minX:r,minY:o,maxX:i[0],maxY:i[1]}).map((function(t){return e.displayObjectPool.getByEntity(t.id)}))}},{key:"saveDirtyAABB",value:function(t){var n=t.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new e.AABB);var r=t.getRenderBounds();r&&n.dirtyRenderBounds.update(r.center,r.halfExtents)}},{key:"applyTransform",value:function(t,n){var r=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}(st(),n),o=rt(r,2),i=o[0],a=o[1],c=rt(ut(st(),n),2),u=c[0],s=c[1],l=function(t,e){var n=new ct(3);ut(n,e);var r=1/n[0],o=1/n[1],i=1/n[2],a=e[0]*r,c=e[1]*o,u=e[2]*i,s=e[4]*r,l=e[5]*o,h=e[6]*i,f=e[8]*r,d=e[9]*o,v=e[10]*i,p=a+l+v,y=0;return p>0?(t[3]=.25*(y=2*Math.sqrt(p+1)),t[0]=(h-d)/y,t[1]=(f-u)/y,t[2]=(c-s)/y):a>l&&a>v?(t[3]=(h-d)/(y=2*Math.sqrt(1+a-l-v)),t[0]=.25*y,t[1]=(c+s)/y,t[2]=(f+u)/y):l>v?(t[3]=(f-u)/(y=2*Math.sqrt(1+l-a-v)),t[0]=(c+s)/y,t[1]=.25*y,t[2]=(h+d)/y):(t[3]=(c-s)/(y=2*Math.sqrt(1+v-a-l)),t[0]=(f+u)/y,t[1]=(h+d)/y,t[2]=.25*y),t}(vt(),n),h=rt(e.getEuler(st(),l),3),f=e.fromRotationTranslationScale(h[0]||h[2],i,a,u,s);t.transform(f[0],f[1],f[3],f[4],f[6],f[7])}},{key:"getColor",value:function(t,n,r,o){var i;if(t instanceof e.CSSGradientValue){if(t.type===e.GradientPatternType.LinearGradient||t.type===e.GradientPatternType.RadialGradient){var a=n.getGeometryBounds(),c=a&&2*a.halfExtents[0]||0,u=a&&2*a.halfExtents[1]||0;i=this.gradientPool.getOrCreateGradient($($({type:t.type},t.value),{},{width:c,height:u}),r)}else if(t.type===e.GradientPatternType.Pattern){var s=this.imagePool.getPatternSync(t.value);s?i=s:this.imagePool.createPattern(t.value,r).then((function(){n.renderable.dirty=!0,o.dirtify()}))}}else i=""+t;return i}},{key:"applyAttributesToContext",value:function(t,n,r){var o=n.parsedStyle,i=o.stroke,a=o.fill,c=o.opacity,u=o.lineDash,s=o.lineDashOffset,l=o.filter,h=o.shadowColor,f=o.shadowBlur,d=o.shadowOffsetX,v=o.shadowOffsetY;u&&Array.isArray(u)&&t.setLineDash(u.map((function(t){return t.value}))),e.isNil(s)||(t.lineDashOffset=s.value),e.isNil(c)||(t.globalAlpha*=c.value),e.isNil(i)||i.isNone||(t.strokeStyle=this.getColor(i,n,t,r)),e.isNil(a)||a.isNone||(t.fillStyle=this.getColor(a,n,t,r)),e.isNil(l)||(t.filter=n.style.filter),e.isNil(h)||(t.shadowColor=""+h,t.shadowBlur=f&&f.value||0,t.shadowOffsetX=d&&d.value||0,t.shadowOffsetY=v&&v.value||0)}},{key:"useAnchor",value:function(t,e,n){var r=e.getGeometryBounds();if(r){var o=r.halfExtents,i=(e.parsedStyle||{}).anchor;t.translate(-(i&&i[0].value||0)*o[0]*2,-(i&&i[1].value||0)*o[1]*2),n()}else n()}},{key:"safeMergeAABB",value:function(){for(var t=new e.AABB,n=arguments.length,r=Array(n),o=0;n>o;o++)r[o]=arguments[o];return r.forEach((function(e){t.add(e)})),t}}]),t}(),Vt.tag="CanvasRenderer",zt=Vt);h([n.inject(e.CanvasConfig),f("design:type",Object)],te.prototype,"canvasConfig",void 0),h([n.inject(e.DefaultCamera),f("design:type",e.Camera)],te.prototype,"camera",void 0),h([n.inject(e.ContextService),f("design:type",Object)],te.prototype,"contextService",void 0),h([n.inject(e.RenderingContext),f("design:type",Object)],te.prototype,"renderingContext",void 0),h([n.inject(Lt),f("design:type",Lt)],te.prototype,"imagePool",void 0),h([n.inject(St),f("design:type",St)],te.prototype,"gradientPool",void 0),h([n.inject(Ot),f("design:type",Function)],te.prototype,"pathGeneratorFactory",void 0),h([n.inject(Mt),f("design:type",Function)],te.prototype,"styleRendererFactory",void 0),h([n.inject(e.DisplayObjectPool),f("design:type",e.DisplayObjectPool)],te.prototype,"displayObjectPool",void 0),h([n.inject(Zt),f("design:type",M)],te.prototype,"rBush",void 0),te=zt=h([n.singleton({contrib:e.RenderingPluginContribution})],te);var ee=(Jt=function(){function t(){V(this,t),this.imagePool=void 0,this.renderingContext=void 0}return Q(t,[{key:"apply",value:function(t){var n=this,r=function(r){var o=r.target;if(o.nodeName===e.Shape.IMAGE){var i=o.attributes.img;e.isString(i)&&n.imagePool.getOrCreateImage(i).then((function(){o.renderable.dirty=!0,t.dirtify()}))}},o=function(r){var o=r.target,i=r.newValue;o.nodeName===e.Shape.IMAGE&&"img"===r.attrName&&e.isString(i)&&n.imagePool.getOrCreateImage(i).then((function(){o.renderable.dirty=!0,t.dirtify()}))};t.hooks.init.tapPromise(Kt.tag,q(U().mark((function t(){return U().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(e.ElementEvent.ATTR_MODIFIED,o);case 2:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(Kt.tag,(function(){n.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(e.ElementEvent.ATTR_MODIFIED,o)}))}}]),t}(),Jt.tag="LoadImage",Kt=Jt);h([n.inject(Lt),f("design:type",Lt)],ee.prototype,"imagePool",void 0),h([n.inject(e.RenderingContext),f("design:type",Object)],ee.prototype,"renderingContext",void 0),ee=Kt=h([n.singleton({contrib:e.RenderingPluginContribution})],ee),n.GlobalContainer.register({token:{token:Ct,named:e.Shape.CIRCLE},useValue:function(t,e){var n=e.r;t.arc(n.value,n.value,n.value,0,2*Math.PI,!1)}}),n.GlobalContainer.register({token:{token:Ct,named:e.Shape.ELLIPSE},useValue:function(t,e){var n=e.rx.value,r=e.ry.value;if(t.ellipse)t.ellipse(n,r,n,r,0,0,2*Math.PI,!1);else{var o=n>r?n:r,i=n>r?1:n/r,a=n>r?r/n:1;t.save(),t.scale(i,a),t.arc(0,0,o,0,2*Math.PI)}}}),n.GlobalContainer.register({token:{token:Ct,named:e.Shape.RECT},useValue:function(t,e){var n=e.radius,r=e.width.value,o=e.height.value;if(n&&n.some((function(t){return 0!==t.value}))){var i=rt(n.map((function(t){return t.value})),4),a=i[0],c=i[1],u=i[2],s=i[3];t.moveTo(a,0),t.lineTo(r-c,0),0!==c&&t.arc(r-c,c,c,-Math.PI/2,0),t.lineTo(r,o-u),0!==u&&t.arc(r-u,o-u,u,0,Math.PI/2),t.lineTo(s,o),0!==s&&t.arc(s,o-s,s,Math.PI/2,Math.PI),t.lineTo(0,a),0!==a&&t.arc(a,a,a,Math.PI,1.5*Math.PI)}else t.rect(0,0,r,o)}}),n.GlobalContainer.register({token:{token:Ct,named:e.Shape.LINE},useValue:function(t,e){var n=e.x2,r=e.y2,o=e.defX,i=void 0===o?0:o,a=e.defY,c=void 0===a?0:a;t.moveTo(e.x1.value-i,e.y1.value-c),t.lineTo(n.value-i,r.value-c)}}),n.GlobalContainer.register({token:{token:Ct,named:e.Shape.POLYLINE},useValue:function(t,e){var n=e.defX,r=void 0===n?0:n,o=e.defY,i=void 0===o?0:o,a=e.points.points,c=a.length,u=a[c-1][0]-r,s=a[c-1][1]-i;t.moveTo(a[0][0]-r,a[0][1]-i);for(var l=0;c-1>l;l++){var h=a[l];t.lineTo(h[0]-r,h[1]-i)}t.lineTo(u,s)}}),n.GlobalContainer.register({token:{token:Ct,named:e.Shape.POLYGON},useValue:function(t,e){var n=e.defX,r=void 0===n?0:n,o=e.defY,i=void 0===o?0:o,a=e.points.points,c=a.length,u=a[c-1][0]-r,s=a[c-1][1]-i;t.moveTo(a[0][0]-r,a[0][1]-i);for(var l=0;c-1>l;l++){var h=a[l];t.lineTo(h[0]-r,h[1]-i)}t.lineTo(u,s)}}),n.GlobalContainer.register({token:{token:Ct,named:e.Shape.PATH},useValue:function(t,e){var n=e.defX,r=void 0===n?0:n,o=e.defY,i=void 0===o?0:o,a=e.path,c=a.zCommandIndexes,u=ot(a.curve);c.forEach((function(t,e){u.splice(t+e,1,["Z"])}));for(var s=0;u.length>s;s++){var l=u[s];switch(l[0]){case"M":t.moveTo(l[1]-r,l[2]-i);break;case"C":t.bezierCurveTo(l[1]-r,l[2]-i,l[3]-r,l[4]-i,l[5]-r,l[6]-i);break;case"Z":t.closePath()}}}}),n.GlobalContainer.register({token:Ot,useFactory:function(t){var e={};return function(n){return e[n]||t.container.isBoundNamed(Ct,n)&&(e[n]=t.container.getNamed(Ct,n)),e[n]}}});var ne=n.Module((function(t){var n;t(Lt),t({token:Zt,useValue:new M}),t(Ht),t($t),t(Xt),t(Dt),t(Ft),t(Ut),t(Wt),t(qt),t(Qt);var r=(J(n={},e.Shape.CIRCLE,Tt),J(n,e.Shape.ELLIPSE,jt),J(n,e.Shape.RECT,At),J(n,e.Shape.IMAGE,Gt),J(n,e.Shape.TEXT,It),J(n,e.Shape.LINE,Nt),J(n,e.Shape.POLYLINE,Rt),J(n,e.Shape.POLYGON,_t),J(n,e.Shape.PATH,Bt),n);t({token:Mt,useFactory:function(t){var e={};return function(n){var o=r[n];return o&&!e[n]&&t.container.isBound(o)&&(e[n]=t.container.get(o)),e[n]}}}),t(St),t(te),t(ee)})),re=function(){function t(){V(this,t),this.name="canvas-renderer"}return Q(t,[{key:"init",value:function(t){t.load(ne,!0)}},{key:"destroy",value:function(t){t.unload(ne)}}]),t}(),oe=Object.freeze({__proto__:null,get CircleRenderer(){return Ht},CircleRendererContribution:Tt,get EllipseRenderer(){return $t},EllipseRendererContribution:jt,get ImageRenderer(){return Dt},ImageRendererContribution:Gt,get LineRenderer(){return Ut},LineRendererContribution:Nt,PathGenerator:Ct,PathGeneratorFactory:Ot,get PathRenderer(){return Qt},PathRendererContribution:Bt,Plugin:re,get PolygonRenderer(){return qt},PolygonRendererContribution:_t,get PolylineRenderer(){return Wt},PolylineRendererContribution:Rt,RBushNode:Pt,RBushRoot:Zt,get RectRenderer(){return Xt},RectRendererContribution:At,StyleRendererFactory:Mt,get TextRenderer(){return Ft},TextRendererContribution:It,RBush:M});function ie(){
6
6
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
7
- Gt=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=Object.create((e&&e.prototype instanceof h?e:h).prototype),o=new L(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return S()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=b(a,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=u(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,o),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function h(){}function f(){}function d(){}var v={};c(v,i,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&n.call(y,i)&&(v=y);var g=d.prototype=h.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,o,a,c){var s=u(t[i],t,o);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=u(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function P(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=d,c(g,"constructor",d),c(d,"constructor",f),f.displayName=c(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(x.prototype),c(x.prototype,o,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new x(s(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var c=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===t||"continue"===t)&&e>=o.tryLoc&&o.finallyLoc>=e&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function Dt(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}var Ft="undefined"!=typeof Float32Array?Float32Array:Array;function Yt(){var t=new Ft(9);return Ft!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Xt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],c=e[4],s=e[5],u=e[6],l=e[7],h=e[8],f=n[0],d=n[1],v=n[2],p=n[3],y=n[4],g=n[5],m=n[6],x=n[7],b=n[8];return t[0]=f*r+d*a+v*u,t[1]=f*i+d*c+v*l,t[2]=f*o+d*s+v*h,t[3]=p*r+y*a+g*u,t[4]=p*i+y*c+g*l,t[5]=p*o+y*s+g*h,t[6]=m*r+x*a+b*u,t[7]=m*i+x*c+b*l,t[8]=m*o+x*s+b*h,t}function Ht(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function $t(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Wt(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Ut(){var t=new Ft(16);return Ft!=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 qt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],c=e[4],s=e[5],u=e[6],l=e[7],h=e[8],f=e[9],d=e[10],v=e[11],p=e[12],y=e[13],g=e[14],m=e[15],x=n[0],b=n[1],w=n[2],E=n[3];return t[0]=x*r+b*c+w*h+E*p,t[1]=x*i+b*s+w*f+E*y,t[2]=x*o+b*u+w*d+E*g,t[3]=x*a+b*l+w*v+E*m,t[4]=(x=n[4])*r+(b=n[5])*c+(w=n[6])*h+(E=n[7])*p,t[5]=x*i+b*s+w*f+E*y,t[6]=x*o+b*u+w*d+E*g,t[7]=x*a+b*l+w*v+E*m,t[8]=(x=n[8])*r+(b=n[9])*c+(w=n[10])*h+(E=n[11])*p,t[9]=x*i+b*s+w*f+E*y,t[10]=x*o+b*u+w*d+E*g,t[11]=x*a+b*l+w*v+E*m,t[12]=(x=n[12])*r+(b=n[13])*c+(w=n[14])*h+(E=n[15])*p,t[13]=x*i+b*s+w*f+E*y,t[14]=x*o+b*u+w*d+E*g,t[15]=x*a+b*l+w*v+E*m,t}function Vt(){var t=new Ft(3);return Ft!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function zt(t,e,n){var r=new Ft(3);return r[0]=t,r[1]=e,r[2]=n,r}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});!function(){var t=Vt()}();function Qt(t,e){var n=new Ft(2);return n[0]=t,n[1]=e,n}function Jt(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}!function(){var t=function(){var t=new Ft(2);return Ft!=Float32Array&&(t[0]=0,t[1]=0),t}()}();var Kt,Zt,te=n.Syringe.defineToken("PointInPathPicker"),ee=(Kt=function(){function t(){var t=this;this.displayObjectPool=void 0,this.canvasConfig=void 0,this.offscreenCanvas=void 0,this.rBush=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isHit=function(n,r,i){var o=t.pointInPathPickerFactory(n.nodeName);if(o){var a=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],c=e[5],s=e[6],u=e[7],l=e[8],h=e[9],f=e[10],d=e[11],v=e[12],p=e[13],y=e[14],g=e[15],m=n*c-r*a,x=n*s-i*a,b=n*u-o*a,w=r*s-i*c,E=r*u-o*c,L=i*u-o*s,P=l*p-h*v,S=l*y-f*v,C=l*g-d*v,M=h*y-f*p,k=h*g-d*p,O=f*g-d*y,T=m*O-x*k+b*M+w*C-E*S+L*P;return T?(t[0]=(c*O-s*k+u*M)*(T=1/T),t[1]=(i*k-r*O-o*M)*T,t[2]=(p*L-y*E+g*w)*T,t[3]=(f*E-h*L-d*w)*T,t[4]=(s*C-a*O-u*S)*T,t[5]=(n*O-i*C+o*S)*T,t[6]=(y*b-v*L-g*x)*T,t[7]=(l*L-f*b+d*x)*T,t[8]=(a*k-c*C+u*P)*T,t[9]=(r*C-n*k-o*P)*T,t[10]=(v*E-p*b+g*m)*T,t[11]=(h*b-l*E-d*m)*T,t[12]=(c*S-a*M-s*P)*T,t[13]=(n*M-r*S+i*P)*T,t[14]=(p*x-v*w-y*m)*T,t[15]=(l*w-h*x+f*m)*T,t):null}(Ut(),i),c=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/(a=a||1),t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}(Vt(),zt(r[0],r[1],0),a),s=n.getGeometryBounds().halfExtents,u=n.parsedStyle.anchor;if(c[0]+=(u&&u[0].value||0)*s[0]*2,c[1]+=(u&&u[1].value||0)*s[1]*2,o(n,new e.Point(c[0],c[1]),t.isPointInPath))return!0}return!1},this.isPointInPath=function(e,n){var r=t.offscreenCanvas.getOrCreateContext(t.canvasConfig.offscreenCanvas),i=t.pathGeneratorFactory(e.nodeName);return i&&i(r,e.parsedStyle),r.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(t){var e=this;t.hooks.pick.tapPromise(Zt.tag,function(){var t,n=(t=Gt().mark((function t(n){var r,i,o,a,c,s,u,l,h,f,d,v,p;return Gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.topmost,o=zt((i=n.position).x,i.y,0),a=e.rBush.search({minX:o[0],minY:o[1],maxX:o[0],maxY:o[1]}),c=a.map((function(t){return t.id})),s=[],a.forEach((function(t){var n=e.displayObjectPool.getByEntity(t.id);if(n.isVisible()&&!n.isCulled()&&n.isInteractive()){if(n.parentNode&&-1===c.indexOf(n.parentNode.entity))return;s.push(n)}})),s.sort((function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder})),u=[],l=0,h=s;case 9:if(l>=h.length){t.next=25;break}if(v=(d=(f=h[l]).parsedStyle.clipPath)||f,p=f.getWorldTransform(),d&&(p=qt(Ut(),p,d.getLocalTransform())),!e.isHit(v,o,p)){t.next=22;break}if(!r){t.next=21;break}return n.picked=[f],t.abrupt("return",n);case 21:u.push(f);case 22:l++,t.next=9;break;case 25:return n.picked=u,t.abrupt("return",n);case 27:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){Dt(o,r,i,a,c,"next",t)}function c(t){Dt(o,r,i,a,c,"throw",t)}a(void 0)}))});return function(t){return n.apply(this,arguments)}}())},t}(),Kt.tag="CanvasPicker",Zt=Kt);function ne(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function re(t,e){return.001>Math.abs(t-e)}function ie(t,e){var n=Math.min.apply(Math,t),r=Math.min.apply(Math,e);return{x:n,y:r,width:Math.max.apply(Math,t)-n,height:Math.max.apply(Math,e)-r}}function oe(t){return(t+2*Math.PI)%(2*Math.PI)}i([n.inject(e.DisplayObjectPool),o("design:type",e.DisplayObjectPool)],ee.prototype,"displayObjectPool",void 0),i([n.inject(e.CanvasConfig),o("design:type",Object)],ee.prototype,"canvasConfig",void 0),i([n.inject(e.OffscreenCanvasCreator),o("design:type",e.OffscreenCanvasCreator)],ee.prototype,"offscreenCanvas",void 0),i([n.inject(jt),o("design:type",b)],ee.prototype,"rBush",void 0),i([n.inject(st),o("design:type",Function)],ee.prototype,"pathGeneratorFactory",void 0),i([n.inject(te),o("design:type",Function)],ee.prototype,"pointInPathPickerFactory",void 0),ee=Zt=i([n.singleton({contrib:e.RenderingPluginContribution})],ee);var ae=function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},ce=function(t,e,n,r,i,o){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var c=[-a[1],a[0]];return function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(c,c),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([i-t,o-e],c))};function se(t,e,n,r,i,o){var a=-1,c=1/0,s=[n,r],u=20;o&&o>200&&(u=o/10);for(var l=1/u,h=l/10,f=0;u>=f;f++){var d=f*l,v=[i.apply(void 0,t.concat([d])),i.apply(void 0,e.concat([d]))],p=ne(s[0],s[1],v[0],v[1]);c>p&&(a=d,c=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}c=1/0;for(var g=0;32>g&&1e-4<=h;g++){var m=a-h,x=a+h,b=[i.apply(void 0,t.concat([m])),i.apply(void 0,e.concat([m]))],w=ne(s[0],s[1],b[0],b[1]);if(m>=0&&c>w)a=m,c=w;else{var E=[i.apply(void 0,t.concat([x])),i.apply(void 0,e.concat([x]))],L=ne(s[0],s[1],E[0],E[1]);1>=x&&c>L?(a=x,c=L):h*=.5}}return{x:i.apply(void 0,t.concat([a])),y:i.apply(void 0,e.concat([a]))}}function ue(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function le(t,e,n){var r=t+n-2*e;if(re(r,0))return[.5];var i=(t-e)/r;return i>1||0>i?[]:[i]}function he(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function fe(t,e,n,r,i,o,a){var c=ue(t,n,i,a),s=ue(e,r,o,a),u=ae(t,e,n,r,a),l=ae(n,r,i,o,a);return[[t,e,u.x,u.y,c,s],[c,s,l.x,l.y,i,o]]}function de(t,e,n,r,i,o,a){if(0===a)return(ne(t,e,n,r)+ne(n,r,i,o)+ne(t,e,i,o))/2;var c=fe(t,e,n,r,i,o,.5),s=c[0],u=c[1];return s.push(a-1),u.push(a-1),de.apply(void 0,s)+de.apply(void 0,u)}var ve={box:function(t,e,n,r,i,o){var a=le(t,n,i)[0],c=le(e,r,o)[0],s=[t,i],u=[e,o];return void 0!==a&&s.push(ue(t,n,i,a)),void 0!==c&&u.push(ue(e,r,o,c)),ie(s,u)},length:function(t,e,n,r,i,o){return de(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,c){return se([t,n,i],[e,r,o],a,c,ue)},pointDistance:function(t,e,n,r,i,o,a,c){var s=this.nearestPoint(t,e,n,r,i,o,a,c);return ne(s.x,s.y,a,c)},interpolationAt:ue,pointAt:function(t,e,n,r,i,o,a){return{x:ue(t,n,i,a),y:ue(e,r,o,a)}},divide:function(t,e,n,r,i,o,a){return fe(t,e,n,r,i,o,a)},tangentAngle:function(t,e,n,r,i,o,a){var c=he(t,n,i,a),s=he(e,r,o,a);return oe(Math.atan2(s,c))}};function pe(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function ye(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function ge(t,e,n,r){var i,o,a,c=-3*t+9*e-9*n+3*r,s=6*t-12*e+6*n,u=3*e-3*t,l=[];if(re(c,0))re(s,0)||0>(i=-u/s)||i>1||l.push(i);else{var h=s*s-4*c*u;re(h,0)?l.push(-s/(2*c)):h>0&&(o=(-s-(a=Math.sqrt(h)))/(2*c),0>(i=(-s+a)/(2*c))||i>1||l.push(i),0>o||o>1||l.push(o))}return l}function me(t,e,n,r,i,o,a,c,s){var u=pe(t,n,i,a,s),l=pe(e,r,o,c,s),h=ae(t,e,n,r,s),f=ae(n,r,i,o,s),d=ae(i,o,a,c,s),v=ae(h.x,h.y,f.x,f.y,s),p=ae(f.x,f.y,d.x,d.y,s);return[[t,e,h.x,h.y,v.x,v.y,u,l],[u,l,p.x,p.y,d.x,d.y,a,c]]}function xe(t,e,n,r,i,o,a,c,s){if(0===s)return function(t,e){for(var n=0,r=t.length,i=0;r>i;i++)n+=ne(t[i],e[i],t[(i+1)%r],e[(i+1)%r]);return n/2}([t,n,i,a],[e,r,o,c]);var u=me(t,e,n,r,i,o,a,c,.5),l=[].concat(u[0],[s-1]),h=[].concat(u[1],[s-1]);return xe.apply(void 0,l)+xe.apply(void 0,h)}var be={extrema:ge,box:function(t,e,n,r,i,o,a,c){for(var s=[t,a],u=[e,c],l=ge(t,n,i,a),h=ge(e,r,o,c),f=0;l.length>f;f++)s.push(pe(t,n,i,a,l[f]));for(var d=0;h.length>d;d++)u.push(pe(e,r,o,c,h[d]));return ie(s,u)},length:function(t,e,n,r,i,o,a,c){return xe(t,e,n,r,i,o,a,c,3)},nearestPoint:function(t,e,n,r,i,o,a,c,s,u,l){return se([t,n,i,a],[e,r,o,c],s,u,pe,l)},pointDistance:function(t,e,n,r,i,o,a,c,s,u,l){var h=this.nearestPoint(t,e,n,r,i,o,a,c,s,u,l);return ne(h.x,h.y,s,u)},interpolationAt:pe,pointAt:function(t,e,n,r,i,o,a,c,s){return{x:pe(t,n,i,a,s),y:pe(e,r,o,c,s)}},divide:function(t,e,n,r,i,o,a,c,s){return me(t,e,n,r,i,o,a,c,s)},tangentAngle:function(t,e,n,r,i,o,a,c,s){var u=ye(t,n,i,a,s),l=ye(e,r,o,c,s);return oe(Math.atan2(l,u))}};function we(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function Ee(t,e,n,r,i,o){return!(t>i||i>t+n||e>o||o>e+r)}function Le(t,e,n,r,i,o,a,c){var s=(Math.atan2(c-e,a-t)+2*Math.PI)%(2*Math.PI);if(r>s||s>i)return!1;var u={x:t+n*Math.cos(s),y:e+n*Math.sin(s)};return we(u.x,u.y,a,c)<=o/2}function Pe(t,e,n,r,i,o,a){var c=i/2;return!(Math.min(t,n)-c>o||o>Math.max(t,n)+c||Math.min(e,r)-c>a||a>Math.max(e,r)+c)&&ce(t,e,n,r,o,a)<=i/2}function Se(t,e,n,r,i){var o=t.length;if(2>o)return!1;for(var a=0;o-1>a;a++){if(Pe(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(i){var c=t[0],s=t[o-1];if(Pe(c[0],c[1],s[0],s[1],e,n,r))return!0}return!1}function Ce(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function Me(t,e,n){return!((n[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(n[1]-t[1])||Math.min(t[0],e[0])>n[0]||n[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>n[1]||n[1]>Math.max(t[1],e[1]))}function ke(t,e,n){var r=!1,i=t.length;if(2>=i)return!1;for(var o=0;i>o;o++){var a=t[o],c=t[(o+1)%i];if(Me(a,c,[e,n]))return!0;Ce(a[1]-n)>0!=Ce(c[1]-n)>0&&0>Ce(e-(n-a[1])*(a[0]-c[0])/(a[1]-c[1])-a[0])&&(r=!r)}return r}function Oe(t,e,n){for(var r=!1,i=0;t.length>i;i++){if(r=ke(t[i],e,n))break}return r}function Te(t,e){var n=t.parsedStyle,r=n.fill,i=n.stroke,o=n.clipPathTargets,a=n.r.value,c=(n.lineWidth.value+n.increasedLineWidthForHitTesting.value)/2,s=we(a,a,e.x,e.y),u=r&&!r.isNone,l=i&&!i.isNone;return u&&l||!!(null==o?void 0:o.length)?a+c>=s:u?a>=s:!!l&&(s>=a-c&&a+c>=s)}function Ne(t,e,n,r){return t/(n*n)+e/(r*r)}function je(t,e){var n=e.x,r=e.y,i=t.parsedStyle,o=i.fill,a=i.stroke,c=i.clipPathTargets,s=o&&!o.isNone,u=a&&!a.isNone,l=i.rx.value,h=i.ry.value,f=(i.lineWidth.value+i.increasedLineWidthForHitTesting.value)/2,d=(n-l)*(n-l),v=(r-h)*(r-h);return s&&u||!!(null==c?void 0:c.length)?1>=Ne(d,v,l+f,h+f):s?1>=Ne(d,v,l,h):!!u&&(Ne(d,v,l-f,h-f)>=1&&1>=Ne(d,v,l+f,h+f))}function _e(t,e){var n=t.parsedStyle,r=n.defX,i=n.defY;return Pe(n.x1.value,n.y1.value,n.x2.value,n.y2.value,n.lineWidth.value+n.increasedLineWidthForHitTesting.value,e.x+(void 0===r?0:r),e.y+(void 0===i?0:i))}function Be(t,e){var n=t.parsedStyle,r=n.stroke,i=n.lineWidth,o=n.defX,a=n.defY,c=n.clipPathTargets;return!((!r||r.isNone)&&!(null==c?void 0:c.length)||!i)&&Se(n.points.points,i.value+n.increasedLineWidthForHitTesting.value,e.x+(void 0===o?0:o),e.y+(void 0===a?0:a),!1)}function Re(t,e,n){var r=t.parsedStyle,i=r.stroke,o=r.fill,a=r.defX,c=void 0===a?0:a,s=r.defY,u=void 0===s?0:s,l=r.clipPathTargets,h=r.path,f=o&&!o.isNone,d=h.hasArc,v=h.polylines,p=h.polygons,y=!!(null==l?void 0:l.length),g=!1;return(i&&!i.isNone||y)&&(g=function(t,e,n,r,i,o,a){for(var c=!1,s=e/2,u=0;t.length>u;u++){var l=t[u],h=l.currentPoint,f=l.params,d=l.prePoint,v=l.box;if(!v||Ee(v.x-s,v.y-s,v.width+e,v.height+e,n,r)){switch(l.command){case"L":case"Z":c=Pe(d[0],d[1],h[0],h[1],e,n,r);break;case"Q":c=e/2>=ve.pointDistance(d[0],d[1],f[1],f[2],f[3],f[4],n,r);break;case"C":c=e/2>=be.pointDistance(d[0],d[1],f[1],f[2],f[3],f[4],f[5],f[6],n,r,i);break;case"A":var p=l.arcParams,y=p.cx,g=p.cy,m=p.rx,x=p.ry,b=p.startAngle,w=p.endAngle,E=p.xRotation,L=m>x?m:x,P=m>x?1:m/x,S=m>x?x/m:1,C=Ht(Yt(),[-y,-g]);Xt(C,$t(Yt(),-E),C),Xt(C,Wt(Yt(),[1/P,1/S]),C);var M=Qt(n,r);c=Le(0,0,L,b,w,e,(M=Jt(M,M,C))[0],M[1])}if(c)break}}return c}(h.segments,r.lineWidth.value+r.increasedLineWidthForHitTesting.value,e.x+c,e.y+u,h.totalLength)),g||!f&&!y||(g=d?n(t,e):Oe(p,e.x+c,e.y+u)||Oe(v,e.x+c,e.y+u)),g}function Ae(t,n,r){var i=t.parsedStyle,o=i.radius,a=i.fill,c=i.stroke,s=i.lineWidth,u=i.increasedLineWidthForHitTesting,l=i.width,h=i.height,f=i.clipPathTargets,d=!!(null==f?void 0:f.length),v=a&&!a.isNone,p=c&&!c.isNone,y=o&&o.some((function(t){return 0!==t.value})),g=l.unit,m=h.unit,x=0,b=0;g!==e.UnitType.kNumber&&g!==e.UnitType.kPixels||(x=l.value),m!==e.UnitType.kNumber&&m!==e.UnitType.kPixels||(b=h.value);var w=s.value+u.value;if(y){var E=!1;return(p||d)&&(E=function(t,e,n,r,i,o,a,c){var s=i[0],u=i[1],l=i[2],h=i[3];return Pe(t+s,e,t+n-u,e,o,a,c)||Pe(t+n,e+u,t+n,e+r-l,o,a,c)||Pe(t+n-l,e+r,t+h,e+r,o,a,c)||Pe(t,e+r-h,t,e+s,o,a,c)||Le(t+n-u,e+u,u,1.5*Math.PI,2*Math.PI,o,a,c)||Le(t+n-l,e+r-l,l,0,.5*Math.PI,o,a,c)||Le(t+h,e+r-h,h,.5*Math.PI,Math.PI,o,a,c)||Le(t+s,e+s,s,Math.PI,1.5*Math.PI,o,a,c)}(0,0,x,b,o.map((function(t){return t.value})),w,n.x,n.y)),E||!v&&!d||(E=r(t,n)),E}var L=w/2;return v&&p||d?Ee(0-L,0-L,x+L,b+L,n.x,n.y):v?Ee(0,0,x,b,n.x,n.y):!!p&&function(t,e,n,r,i,o,a){var c=i/2;return Ee(t-c,e-c,n,i,o,a)||Ee(t+n-c,e-c,i,r,o,a)||Ee(t+c,e+r-c,n,i,o,a)||Ee(t-c,e+c,i,r,o,a)}(0,0,x,b,w,n.x,n.y)}function Ie(t,e){var n=t.parsedStyle,r=n.stroke,i=n.fill,o=n.points,a=n.defX,c=void 0===a?0:a,s=n.defY,u=void 0===s?0:s,l=n.clipPathTargets,h=!!(null==l?void 0:l.length),f=i&&!i.isNone,d=!1;return(r&&!r.isNone||h)&&(d=Se(o.points,n.lineWidth.value+n.increasedLineWidthForHitTesting.value,e.x+c,e.y+u,!0)),d||!f&&!h||(d=ke(o.points,e.x+c,e.y+u)),d}var Ge,De,Fe=n.Module((function(t){t({token:te,useFactory:function(t){return function(t){return t===e.Shape.CIRCLE?Te:t===e.Shape.ELLIPSE?je:t===e.Shape.RECT?Ae:t===e.Shape.LINE?_e:t===e.Shape.POLYLINE?Be:t===e.Shape.POLYGON?Ie:t===e.Shape.PATH?Re:t===e.Shape.IMAGE||t===e.Shape.TEXT?function(){return!0}:null}}}),t(ee)})),Ye=function(){function t(){this.name="canvas-picker"}var e=t.prototype;return e.init=function(t){t.load(Fe,!0)},e.destroy=function(t){t.unload(Fe)},t}(),Xe=Object.freeze({__proto__:null,Plugin:Ye});function He(){
7
+ ie=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new P(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return L()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=w(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,i),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var h={};function f(){}function d(){}function v(){}var p={};u(p,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&n.call(g,i)&&(p=g);var m=v.prototype=f.prototype=Object.create(p);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(i,a,c,u){var s=l(t[i],t,a);if("throw"!==s.type){var h=s.arg,f=h.value;return f&&"object"==r(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(f).then((function(t){h.value=t,c(h)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,n){function r(){return new e((function(e,r){o(t,n,e,r)}))}return i=i?i.then(r,r):r()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return d.prototype=v,u(m,"constructor",v),u(v,"constructor",d),d.displayName=u(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new x(s(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function ae(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function ce(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ue(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function se(t,e,n){return e&&ue(t.prototype,e),n&&ue(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function le(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,c=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(i.push(r.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==n.return||n.return()}finally{if(c)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return he(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}var fe="undefined"!=typeof Float32Array?Float32Array:Array;function de(){var t=new fe(9);return fe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function ve(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],c=e[4],u=e[5],s=e[6],l=e[7],h=e[8],f=n[0],d=n[1],v=n[2],p=n[3],y=n[4],g=n[5],m=n[6],b=n[7],x=n[8];return t[0]=f*r+d*a+v*s,t[1]=f*o+d*c+v*l,t[2]=f*i+d*u+v*h,t[3]=p*r+y*a+g*s,t[4]=p*o+y*c+g*l,t[5]=p*i+y*u+g*h,t[6]=m*r+b*a+x*s,t[7]=m*o+b*c+x*l,t[8]=m*i+b*u+x*h,t}function pe(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function ye(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function ge(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function me(){var t=new fe(16);return fe!=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 be(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],c=e[4],u=e[5],s=e[6],l=e[7],h=e[8],f=e[9],d=e[10],v=e[11],p=e[12],y=e[13],g=e[14],m=e[15],b=n[0],x=n[1],w=n[2],E=n[3];return t[0]=b*r+x*c+w*h+E*p,t[1]=b*o+x*u+w*f+E*y,t[2]=b*i+x*s+w*d+E*g,t[3]=b*a+x*l+w*v+E*m,t[4]=(b=n[4])*r+(x=n[5])*c+(w=n[6])*h+(E=n[7])*p,t[5]=b*o+x*u+w*f+E*y,t[6]=b*i+x*s+w*d+E*g,t[7]=b*a+x*l+w*v+E*m,t[8]=(b=n[8])*r+(x=n[9])*c+(w=n[10])*h+(E=n[11])*p,t[9]=b*o+x*u+w*f+E*y,t[10]=b*i+x*s+w*d+E*g,t[11]=b*a+x*l+w*v+E*m,t[12]=(b=n[12])*r+(x=n[13])*c+(w=n[14])*h+(E=n[15])*p,t[13]=b*o+x*u+w*f+E*y,t[14]=b*i+x*s+w*d+E*g,t[15]=b*a+x*l+w*v+E*m,t}function xe(){var t=new fe(3);return fe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function we(t,e,n){var r=new fe(3);return r[0]=t,r[1]=e,r[2]=n,r}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});!function(){var t=xe()}();function Ee(t,e){var n=new fe(2);return n[0]=t,n[1]=e,n}function ke(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[3]*o+n[6],t[1]=n[1]*r+n[4]*o+n[7],t}!function(){var t=function(){var t=new fe(2);return fe!=Float32Array&&(t[0]=0,t[1]=0),t}()}();var Pe,Se,Le=n.Syringe.defineToken("PointInPathPicker"),Oe=(Pe=function(){function t(){var n=this;ce(this,t),this.displayObjectPool=void 0,this.canvasConfig=void 0,this.offscreenCanvas=void 0,this.rBush=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isHit=function(t,r,o){var i=n.pointInPathPickerFactory(t.nodeName);if(i){var a=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],c=e[5],u=e[6],s=e[7],l=e[8],h=e[9],f=e[10],d=e[11],v=e[12],p=e[13],y=e[14],g=e[15],m=n*c-r*a,b=n*u-o*a,x=n*s-i*a,w=r*u-o*c,E=r*s-i*c,k=o*s-i*u,P=l*p-h*v,S=l*y-f*v,L=l*g-d*v,O=h*y-f*p,C=h*g-d*p,M=f*g-d*y,T=m*M-b*C+x*O+w*L-E*S+k*P;return T?(t[0]=(c*M-u*C+s*O)*(T=1/T),t[1]=(o*C-r*M-i*O)*T,t[2]=(p*k-y*E+g*w)*T,t[3]=(f*E-h*k-d*w)*T,t[4]=(u*L-a*M-s*S)*T,t[5]=(n*M-o*L+i*S)*T,t[6]=(y*x-v*k-g*b)*T,t[7]=(l*k-f*x+d*b)*T,t[8]=(a*C-c*L+s*P)*T,t[9]=(r*L-n*C-i*P)*T,t[10]=(v*E-p*x+g*m)*T,t[11]=(h*x-l*E-d*m)*T,t[12]=(c*S-a*O-u*P)*T,t[13]=(n*O-r*S+o*P)*T,t[14]=(p*b-v*w-y*m)*T,t[15]=(l*w-h*b+f*m)*T,t):null}(me(),o),c=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return t[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/(a=a||1),t[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,t[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,t}(xe(),we(r[0],r[1],0),a),u=t.getGeometryBounds().halfExtents,s=t.parsedStyle.anchor;if(c[0]+=(s&&s[0].value||0)*u[0]*2,c[1]+=(s&&s[1].value||0)*u[1]*2,i(t,new e.Point(c[0],c[1]),n.isPointInPath))return!0}return!1},this.isPointInPath=function(t,e){var r=n.offscreenCanvas.getOrCreateContext(n.canvasConfig.offscreenCanvas),o=n.pathGeneratorFactory(t.nodeName);return o&&o(r,t.parsedStyle),r.isPointInPath(e.x,e.y)}}return se(t,[{key:"apply",value:function(t){var e=this;t.hooks.pick.tapPromise(Se.tag,function(){var t,n=(t=ie().mark((function t(n){var r,o,i,a,c,u,s,l,h,f,d,v,p;return ie().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=n.topmost,i=we((o=n.position).x,o.y,0),a=e.rBush.search({minX:i[0],minY:i[1],maxX:i[0],maxY:i[1]}),c=a.map((function(t){return t.id})),u=[],a.forEach((function(t){var n=e.displayObjectPool.getByEntity(t.id);if(n.isVisible()&&!n.isCulled()&&n.isInteractive()){if(n.parentNode&&-1===c.indexOf(n.parentNode.entity))return;u.push(n)}})),u.sort((function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder})),s=[],l=0,h=u;case 9:if(l>=h.length){t.next=25;break}if(v=(d=(f=h[l]).parsedStyle.clipPath)||f,p=f.getWorldTransform(),d&&(p=be(me(),p,d.getLocalTransform())),!e.isHit(v,i,p)){t.next=22;break}if(!r){t.next=21;break}return n.picked=[f],t.abrupt("return",n);case 21:s.push(f);case 22:l++,t.next=9;break;case 25:return n.picked=s,t.abrupt("return",n);case 27:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){ae(i,r,o,a,c,"next",t)}function c(t){ae(i,r,o,a,c,"throw",t)}a(void 0)}))});return function(t){return n.apply(this,arguments)}}())}}]),t}(),Pe.tag="CanvasPicker",Se=Pe);function Ce(t){return function(t){if(Array.isArray(t))return Me(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Me(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Me(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Me(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}function Te(t,e,n,r){var o=t-n,i=e-r;return Math.sqrt(o*o+i*i)}function je(t,e){return.001>Math.abs(t-e)}function Ae(t,e){var n=Math.min.apply(Math,Ce(t)),r=Math.min.apply(Math,Ce(e));return{x:n,y:r,width:Math.max.apply(Math,Ce(t))-n,height:Math.max.apply(Math,Ce(e))-r}}function Ne(t){return(t+2*Math.PI)%(2*Math.PI)}h([n.inject(e.DisplayObjectPool),f("design:type",e.DisplayObjectPool)],Oe.prototype,"displayObjectPool",void 0),h([n.inject(e.CanvasConfig),f("design:type",Object)],Oe.prototype,"canvasConfig",void 0),h([n.inject(e.OffscreenCanvasCreator),f("design:type",e.OffscreenCanvasCreator)],Oe.prototype,"offscreenCanvas",void 0),h([n.inject(Zt),f("design:type",M)],Oe.prototype,"rBush",void 0),h([n.inject(Ot),f("design:type",Function)],Oe.prototype,"pathGeneratorFactory",void 0),h([n.inject(Le),f("design:type",Function)],Oe.prototype,"pointInPathPickerFactory",void 0),Oe=Se=h([n.singleton({contrib:e.RenderingPluginContribution})],Oe);var Re=function(t,e,n,r,o){return{x:(1-o)*t+o*n,y:(1-o)*e+o*r}},_e=function(t,e,n,r,o,i){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-e)*(i-e));var c=[-a[1],a[0]];return function(t,e){var n=e[0],r=e[1],o=n*n+r*r;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o}(c,c),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([o-t,i-e],c))};function Be(t,e,n,r,o,i){var a=-1,c=1/0,u=[n,r],s=20;i&&i>200&&(s=i/10);for(var l=1/s,h=l/10,f=0;s>=f;f++){var d=f*l,v=[o.apply(void 0,Ce(t.concat([d]))),o.apply(void 0,Ce(e.concat([d])))],p=Te(u[0],u[1],v[0],v[1]);c>p&&(a=d,c=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}c=1/0;for(var g=0;32>g&&1e-4<=h;g++){var m=a-h,b=a+h,x=[o.apply(void 0,Ce(t.concat([m]))),o.apply(void 0,Ce(e.concat([m])))],w=Te(u[0],u[1],x[0],x[1]);if(m>=0&&c>w)a=m,c=w;else{var E=[o.apply(void 0,Ce(t.concat([b]))),o.apply(void 0,Ce(e.concat([b])))],k=Te(u[0],u[1],E[0],E[1]);1>=b&&c>k?(a=b,c=k):h*=.5}}return{x:o.apply(void 0,Ce(t.concat([a]))),y:o.apply(void 0,Ce(e.concat([a])))}}function Ie(t,e,n,r){var o=1-r;return o*o*t+2*r*o*e+r*r*n}function Ge(t,e,n){var r=t+n-2*e;if(je(r,0))return[.5];var o=(t-e)/r;return o>1||0>o?[]:[o]}function De(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function Fe(t,e,n,r,o,i,a){var c=Ie(t,n,o,a),u=Ie(e,r,i,a),s=Re(t,e,n,r,a),l=Re(n,r,o,i,a);return[[t,e,s.x,s.y,c,u],[c,u,l.x,l.y,o,i]]}function Ye(t,e,n,r,o,i,a){if(0===a)return(Te(t,e,n,r)+Te(n,r,o,i)+Te(t,e,o,i))/2;var c=Fe(t,e,n,r,o,i,.5),u=c[0],s=c[1];return u.push(a-1),s.push(a-1),Ye.apply(void 0,Ce(u))+Ye.apply(void 0,Ce(s))}var Xe={box:function(t,e,n,r,o,i){var a=Ge(t,n,o)[0],c=Ge(e,r,i)[0],u=[t,o],s=[e,i];return void 0!==a&&u.push(Ie(t,n,o,a)),void 0!==c&&s.push(Ie(e,r,i,c)),Ae(u,s)},length:function(t,e,n,r,o,i){return Ye(t,e,n,r,o,i,3)},nearestPoint:function(t,e,n,r,o,i,a,c){return Be([t,n,o],[e,r,i],a,c,Ie)},pointDistance:function(t,e,n,r,o,i,a,c){var u=this.nearestPoint(t,e,n,r,o,i,a,c);return Te(u.x,u.y,a,c)},interpolationAt:Ie,pointAt:function(t,e,n,r,o,i,a){return{x:Ie(t,n,o,a),y:Ie(e,r,i,a)}},divide:function(t,e,n,r,o,i,a){return Fe(t,e,n,r,o,i,a)},tangentAngle:function(t,e,n,r,o,i,a){var c=De(t,n,o,a),u=De(e,r,i,a);return Ne(Math.atan2(u,c))}};function He(t,e,n,r,o){var i=1-o;return i*i*i*t+3*e*o*i*i+3*n*o*o*i+r*o*o*o}function $e(t,e,n,r,o){var i=1-o;return 3*(i*i*(e-t)+2*i*o*(n-e)+o*o*(r-n))}function Ue(t,e,n,r){var o,i,a,c=-3*t+9*e-9*n+3*r,u=6*t-12*e+6*n,s=3*e-3*t,l=[];if(je(c,0))je(u,0)||0>(o=-s/u)||o>1||l.push(o);else{var h=u*u-4*c*s;je(h,0)?l.push(-u/(2*c)):h>0&&(i=(-u-(a=Math.sqrt(h)))/(2*c),0>(o=(-u+a)/(2*c))||o>1||l.push(o),0>i||i>1||l.push(i))}return l}function We(t,e,n,r,o,i,a,c,u){var s=He(t,n,o,a,u),l=He(e,r,i,c,u),h=Re(t,e,n,r,u),f=Re(n,r,o,i,u),d=Re(o,i,a,c,u),v=Re(h.x,h.y,f.x,f.y,u),p=Re(f.x,f.y,d.x,d.y,u);return[[t,e,h.x,h.y,v.x,v.y,s,l],[s,l,p.x,p.y,d.x,d.y,a,c]]}function qe(t,e,n,r,o,i,a,c,u){if(0===u)return function(t,e){for(var n=0,r=t.length,o=0;r>o;o++)n+=Te(t[o],e[o],t[(o+1)%r],e[(o+1)%r]);return n/2}([t,n,o,a],[e,r,i,c]);var s=We(t,e,n,r,o,i,a,c,.5),l=[].concat(Ce(s[0]),[u-1]),h=[].concat(Ce(s[1]),[u-1]);return qe.apply(void 0,Ce(l))+qe.apply(void 0,Ce(h))}var Ve={extrema:Ue,box:function(t,e,n,r,o,i,a,c){for(var u=[t,a],s=[e,c],l=Ue(t,n,o,a),h=Ue(e,r,i,c),f=0;l.length>f;f++)u.push(He(t,n,o,a,l[f]));for(var d=0;h.length>d;d++)s.push(He(e,r,i,c,h[d]));return Ae(u,s)},length:function(t,e,n,r,o,i,a,c){return qe(t,e,n,r,o,i,a,c,3)},nearestPoint:function(t,e,n,r,o,i,a,c,u,s,l){return Be([t,n,o,a],[e,r,i,c],u,s,He,l)},pointDistance:function(t,e,n,r,o,i,a,c,u,s,l){var h=this.nearestPoint(t,e,n,r,o,i,a,c,u,s,l);return Te(h.x,h.y,u,s)},interpolationAt:He,pointAt:function(t,e,n,r,o,i,a,c,u){return{x:He(t,n,o,a,u),y:He(e,r,i,c,u)}},divide:function(t,e,n,r,o,i,a,c,u){return We(t,e,n,r,o,i,a,c,u)},tangentAngle:function(t,e,n,r,o,i,a,c,u){var s=$e(t,n,o,a,u),l=$e(e,r,i,c,u);return Ne(Math.atan2(l,s))}};function ze(t,e,n,r){var o=t-n,i=e-r;return Math.sqrt(o*o+i*i)}function Qe(t,e,n,r,o,i){return!(t>o||o>t+n||e>i||i>e+r)}function Je(t,e,n,r,o,i,a,c){var u=(Math.atan2(c-e,a-t)+2*Math.PI)%(2*Math.PI);if(r>u||u>o)return!1;var s={x:t+n*Math.cos(u),y:e+n*Math.sin(u)};return ze(s.x,s.y,a,c)<=i/2}function Ke(t,e,n,r,o,i,a){var c=o/2;return!(Math.min(t,n)-c>i||i>Math.max(t,n)+c||Math.min(e,r)-c>a||a>Math.max(e,r)+c)&&_e(t,e,n,r,i,a)<=o/2}function Ze(t,e,n,r,o){var i=t.length;if(2>i)return!1;for(var a=0;i-1>a;a++){if(Ke(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(o){var c=t[0],u=t[i-1];if(Ke(c[0],c[1],u[0],u[1],e,n,r))return!0}return!1}function tn(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function en(t,e,n){return!((n[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(n[1]-t[1])||Math.min(t[0],e[0])>n[0]||n[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>n[1]||n[1]>Math.max(t[1],e[1]))}function nn(t,e,n){var r=!1,o=t.length;if(2>=o)return!1;for(var i=0;o>i;i++){var a=t[i],c=t[(i+1)%o];if(en(a,c,[e,n]))return!0;tn(a[1]-n)>0!=tn(c[1]-n)>0&&0>tn(e-(n-a[1])*(a[0]-c[0])/(a[1]-c[1])-a[0])&&(r=!r)}return r}function rn(t,e,n){for(var r=!1,o=0;t.length>o;o++){if(r=nn(t[o],e,n))break}return r}function on(t,e){var n=t.parsedStyle,r=n.fill,o=n.stroke,i=n.lineWidth,a=n.clipPathTargets,c=n.r.value,u=(((null==i?void 0:i.value)||0)+n.increasedLineWidthForHitTesting.value)/2,s=ze(c,c,e.x,e.y),l=r&&!r.isNone,h=o&&!o.isNone;return l&&h||!!(null==a?void 0:a.length)?c+u>=s:l?c>=s:!!h&&(s>=c-u&&c+u>=s)}function an(t,e,n,r){return t/(n*n)+e/(r*r)}function cn(t,e){var n=e.x,r=e.y,o=t.parsedStyle,i=o.fill,a=o.stroke,c=o.lineWidth,u=o.clipPathTargets,s=i&&!i.isNone,l=a&&!a.isNone,h=o.rx.value,f=o.ry.value,d=(((null==c?void 0:c.value)||0)+o.increasedLineWidthForHitTesting.value)/2,v=(n-h)*(n-h),p=(r-f)*(r-f);return s&&l||!!(null==u?void 0:u.length)?1>=an(v,p,h+d,f+d):s?1>=an(v,p,h,f):!!l&&(an(v,p,h-d,f-d)>=1&&1>=an(v,p,h+d,f+d))}function un(t,e){var n=t.parsedStyle,r=n.defX,o=n.defY;return Ke(n.x1.value,n.y1.value,n.x2.value,n.y2.value,n.lineWidth.value+n.increasedLineWidthForHitTesting.value,e.x+(void 0===r?0:r),e.y+(void 0===o?0:o))}function sn(t,e){var n=t.parsedStyle,r=n.stroke,o=n.lineWidth,i=n.defX,a=n.defY,c=n.clipPathTargets;return!((!r||r.isNone)&&!(null==c?void 0:c.length)||!o)&&Ze(n.points.points,o.value+n.increasedLineWidthForHitTesting.value,e.x+(void 0===i?0:i),e.y+(void 0===a?0:a),!1)}function ln(t,e,n){var r=t.parsedStyle,o=r.stroke,i=r.fill,a=r.defX,c=void 0===a?0:a,u=r.defY,s=void 0===u?0:u,l=r.clipPathTargets,h=r.path,f=i&&!i.isNone,d=h.hasArc,v=h.polylines,p=h.polygons,y=!!(null==l?void 0:l.length),g=!1;return(o&&!o.isNone||y)&&(g=function(t,e,n,r,o,i,a){for(var c=!1,u=e/2,s=0;t.length>s;s++){var l=t[s],h=l.currentPoint,f=l.params,d=l.prePoint,v=l.box;if(!v||Qe(v.x-u,v.y-u,v.width+e,v.height+e,n,r)){switch(l.command){case"L":case"Z":c=Ke(d[0],d[1],h[0],h[1],e,n,r);break;case"Q":c=e/2>=Xe.pointDistance(d[0],d[1],f[1],f[2],f[3],f[4],n,r);break;case"C":c=e/2>=Ve.pointDistance(d[0],d[1],f[1],f[2],f[3],f[4],f[5],f[6],n,r,o);break;case"A":var p=l.arcParams,y=p.cx,g=p.cy,m=p.rx,b=p.ry,x=p.startAngle,w=p.endAngle,E=p.xRotation,k=m>b?m:b,P=m>b?1:m/b,S=m>b?b/m:1,L=pe(de(),[-y,-g]);ve(L,ye(de(),-E),L),ve(L,ge(de(),[1/P,1/S]),L);var O=Ee(n,r);c=Je(0,0,k,x,w,e,(O=ke(O,O,L))[0],O[1])}if(c)break}}return c}(h.segments,r.lineWidth.value+r.increasedLineWidthForHitTesting.value,e.x+c,e.y+s,h.totalLength)),g||!f&&!y||(g=d?n(t,e):rn(p,e.x+c,e.y+s)||rn(v,e.x+c,e.y+s)),g}function hn(t,n,r){var o=t.parsedStyle,i=o.radius,a=o.fill,c=o.stroke,u=o.lineWidth,s=o.increasedLineWidthForHitTesting,l=o.width,h=o.height,f=o.clipPathTargets,d=!!(null==f?void 0:f.length),v=a&&!a.isNone,p=c&&!c.isNone,y=i&&i.some((function(t){return 0!==t.value})),g=l.unit,m=h.unit,b=0,x=0;g!==e.UnitType.kNumber&&g!==e.UnitType.kPixels||(b=l.value),m!==e.UnitType.kNumber&&m!==e.UnitType.kPixels||(x=h.value);var w=u.value+s.value;if(y){var E=!1;return(p||d)&&(E=function(t,e,n,r,o,i,a,c){var u=le(o,4),s=u[0],l=u[1],h=u[2],f=u[3];return Ke(t+s,e,t+n-l,e,i,a,c)||Ke(t+n,e+l,t+n,e+r-h,i,a,c)||Ke(t+n-h,e+r,t+f,e+r,i,a,c)||Ke(t,e+r-f,t,e+s,i,a,c)||Je(t+n-l,e+l,l,1.5*Math.PI,2*Math.PI,i,a,c)||Je(t+n-h,e+r-h,h,0,.5*Math.PI,i,a,c)||Je(t+f,e+r-f,f,.5*Math.PI,Math.PI,i,a,c)||Je(t+s,e+s,s,Math.PI,1.5*Math.PI,i,a,c)}(0,0,b,x,i.map((function(t){return t.value})),w,n.x,n.y)),E||!v&&!d||(E=r(t,n)),E}var k=w/2;return v&&p||d?Qe(0-k,0-k,b+k,x+k,n.x,n.y):v?Qe(0,0,b,x,n.x,n.y):!!p&&function(t,e,n,r,o,i,a){var c=o/2;return Qe(t-c,e-c,n,o,i,a)||Qe(t+n-c,e-c,o,r,i,a)||Qe(t+c,e+r-c,n,o,i,a)||Qe(t-c,e+c,o,r,i,a)}(0,0,b,x,w,n.x,n.y)}function fn(t,e){var n=t.parsedStyle,r=n.stroke,o=n.fill,i=n.points,a=n.defX,c=void 0===a?0:a,u=n.defY,s=void 0===u?0:u,l=n.clipPathTargets,h=!!(null==l?void 0:l.length),f=o&&!o.isNone,d=!1;return(r&&!r.isNone||h)&&(d=Ze(i.points,n.lineWidth.value+n.increasedLineWidthForHitTesting.value,e.x+c,e.y+s,!0)),d||!f&&!h||(d=nn(i.points,e.x+c,e.y+s)),d}var dn,vn,pn=n.Module((function(t){t({token:Le,useFactory:function(t){return function(t){return t===e.Shape.CIRCLE?on:t===e.Shape.ELLIPSE?cn:t===e.Shape.RECT?hn:t===e.Shape.LINE?un:t===e.Shape.POLYLINE?sn:t===e.Shape.POLYGON?fn:t===e.Shape.PATH?ln:t===e.Shape.IMAGE||t===e.Shape.TEXT?function(){return!0}:null}}}),t(Oe)})),yn=function(){function t(){ce(this,t),this.name="canvas-picker"}return se(t,[{key:"init",value:function(t){t.load(pn,!0)}},{key:"destroy",value:function(t){t.unload(pn)}}]),t}(),gn=Object.freeze({__proto__:null,Plugin:yn});function mn(){
8
8
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
9
- He=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=Object.create((e&&e.prototype instanceof h?e:h).prototype),o=new L(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return S()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=b(a,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=u(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,o),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function h(){}function f(){}function d(){}var v={};c(v,i,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&n.call(y,i)&&(v=y);var g=d.prototype=h.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,o,a,c){var s=u(t[i],t,o);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=u(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function P(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=d,c(g,"constructor",d),c(d,"constructor",f),f.displayName=c(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(x.prototype),c(x.prototype,o,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new x(s(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var c=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===t||"continue"===t)&&e>=o.tryLoc&&o.finallyLoc>=e&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function $e(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}function We(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){$e(o,r,i,a,c,"next",t)}function c(t){$e(o,r,i,a,c,"throw",t)}a(void 0)}))}}var Ue=(Ge=function(){function t(){this.contextService=void 0,this.renderingContext=void 0,this.$camera=void 0}var n=t.prototype;return n.apply=function(t){var n=this,r=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){var i=n.getOrCreateEl(r),o=r.ownerDocument.documentElement.attributes;Object.keys(o).forEach((function(t){i.style[t]=o[t]})),Object.keys(r.attributes).forEach((function(t){n.updateAttribute(t,r)}))}},i=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){var i=n.getId(r),o=n.contextService.getDomElement().parentNode;if(o){var a=o.querySelector("#"+i);a&&o.removeChild(a)}}},o=function(t){var r=t.target;r.nodeName===e.Shape.HTML&&n.updateAttribute(t.attrName,r)};t.hooks.init.tapPromise(De.tag,We(He().mark((function t(){return He().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,i),n.renderingContext.root.addEventListener(e.ElementEvent.ATTR_MODIFIED,o);case 3:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(De.tag,(function(){n.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,i),n.renderingContext.root.removeEventListener(e.ElementEvent.ATTR_MODIFIED,o)}))},n.getId=function(t){return t.id||"g-html-"+t.entity},n.getOrCreateEl=function(t){var e=this.getId(t),n=this.contextService.getDomElement().parentNode;if(n){var r=n.querySelector("#"+e);if(!r){r=document.createElement("div"),t.parsedStyle.$el=r,r.id=e,t.name&&r.setAttribute("name",t.name),t.className&&(r.className=t.className),n.appendChild(r),r.style.position="absolute",r.style.left="0",r.style.top="0",r.style["will-change"]="transform";var i=t.getWorldTransform();r.style.transform="matrix("+[i[0],i[1],i[4],i[5],i[12],i[13]].join(",")+")"}return r}return null},n.updateAttribute=function(t,n){var r=this.getOrCreateEl(n);switch(t){case"innerHTML":var i=n.parsedStyle.innerHTML;e.isString(i)?r.innerHTML=i:(r.innerHTML="",r.appendChild(i));break;case"modelMatrix":case"transformOrigin":var o=n.parsedStyle.transformOrigin;r.style["transform-origin"]=o[0].value+" "+o[1].value;var a=n.getWorldTransform();r.style.transform="matrix("+[a[0],a[1],a[4],a[5],a[12],a[13]].join(",")+")";break;case"width":var c=n.computedStyleMap().get("width");r.style.width=""+c;break;case"height":var s=n.computedStyleMap().get("height");r.style.height=""+s;break;case"zIndex":r.style["z-index"]=""+n.parsedStyle.zIndex.value;break;case"visibility":r.style.visibility=n.parsedStyle.visibility.value;break;case"pointerEvents":r.style.pointerEvents=n.parsedStyle.pointerEvents.value;break;case"opacity":r.style.opacity=""+n.parsedStyle.opacity.value;break;case"fill":var u=n.parsedStyle.fill,l="";if(u instanceof e.CSSRGB)l=""+u;else if(u instanceof e.CSSGradientValue){if(u.type===e.GradientPatternType.LinearGradient)l="linear-gradient(to right, "+u.value.steps.map((function(t){return t[1]+" "+100*Number(t[0])+"%"})).join(",")+");"}r.style.background=l;break;case"stroke":r.style["border-color"]=""+n.parsedStyle.stroke,r.style["border-style"]="solid";break;case"lineWidth":r.style["border-width"]=(n.parsedStyle.lineWidth.value||0)+"px";break;case"lineDash":r.style["border-style"]="dashed";break;case"filter":r.style.filter=n.parsedStyle.filter}},t}(),Ge.tag="HTMLRendering",De=Ge);i([n.inject(e.ContextService),o("design:type",Object)],Ue.prototype,"contextService",void 0),i([n.inject(e.RenderingContext),o("design:type",Object)],Ue.prototype,"renderingContext",void 0),Ue=De=i([n.singleton({contrib:e.RenderingPluginContribution})],Ue);var qe=n.Module((function(t){t(Ue)})),Ve=function(){function t(){this.name="html-renderer"}var e=t.prototype;return e.init=function(t){t.load(qe,!0)},e.destroy=function(t){t.unload(qe)},t}(),ze=Object.freeze({__proto__:null,Plugin:Ve}),Qe=function(){function t(){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0}var n=t.prototype;return n.init=function(){var t=this.canvasConfig,n=t.container,r=t.canvas,i=t.devicePixelRatio;if(r)this.$canvas=r,n&&r.parentElement!==n&&n.appendChild(r),this.$container=r.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=e.isString(n)?document.getElementById(n):n,this.$container)){var o=document.createElement("canvas");this.$container.appendChild(o),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=o}this.context=this.$canvas.getContext("2d");var a=i||e.isBrowser&&window.devicePixelRatio||1;this.dpr=a=1>a?1:Math.ceil(a),this.resize(this.canvasConfig.width,this.canvasConfig.height)},n.getContext=function(){return this.context},n.getDomElement=function(){return this.$canvas},n.getDPR=function(){return this.dpr},n.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},n.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},n.resize=function(t,n){if(this.$canvas){this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*n,e.setDOMSize(this.$canvas,t,n);var r=this.getDPR();this.context.scale(r,r)}},n.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},t}();i([n.inject(e.CanvasConfig),o("design:type",Object)],Qe.prototype,"canvasConfig",void 0),Qe=i([n.singleton({token:e.ContextService})],Qe);var Je=n.Module((function(t){t(Qe)})),Ke=function(){function t(){this.name="canvas-context-register"}var e=t.prototype;return e.init=function(t){t.load(Je,!0)},e.destroy=function(t){t.unload(Je)},t}(),Ze=function(t){var e,n;function i(e){var n;return(n=t.call(this,e)||this).registerPlugin(new Ke),n.registerPlugin(new At),n.registerPlugin(new v),n.registerPlugin(new Ye),n.registerPlugin(new Ve),n}return(e=i).prototype=Object.create((n=t).prototype),e.prototype.constructor=e,r(e,n),i}(e.AbstractRenderer);t.CanvasPicker=Xe,t.CanvasRenderer=It,t.DomInteraction=p,t.HTMLRenderer=ze,t.Renderer=Ze,Object.defineProperty(t,"__esModule",{value:!0})}));
9
+ mn=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new P(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return L()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=w(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,i),o}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var h={};function f(){}function d(){}function v(){}var p={};u(p,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&n.call(g,i)&&(p=g);var m=v.prototype=f.prototype=Object.create(p);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(i,a,c,u){var s=l(t[i],t,a);if("throw"!==s.type){var h=s.arg,f=h.value;return f&&"object"==r(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,c,u)}),(function(t){o("throw",t,c,u)})):e.resolve(f).then((function(t){h.value=t,c(h)}),(function(t){return o("throw",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,n){function r(){return new e((function(e,r){o(t,n,e,r)}))}return i=i?i.then(r,r):r()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return d.prototype=v,u(m,"constructor",v),u(v,"constructor",d),d.displayName=u(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new x(s(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function bn(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function xn(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){bn(i,r,o,a,c,"next",t)}function c(t){bn(i,r,o,a,c,"throw",t)}a(void 0)}))}}function wn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function En(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function kn(t,e,n){return e&&En(t.prototype,e),n&&En(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}var Pn=(dn=function(){function t(){wn(this,t),this.contextService=void 0,this.renderingContext=void 0,this.$camera=void 0}return kn(t,[{key:"apply",value:function(t){var n=this,r=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){var o=n.getOrCreateEl(r),i=r.ownerDocument.documentElement.attributes;Object.keys(i).forEach((function(t){o.style[t]=i[t]})),Object.keys(r.attributes).forEach((function(t){n.updateAttribute(t,r)}))}},o=function(t){var r=t.target;if(r.nodeName===e.Shape.HTML){var o=n.getId(r),i=n.contextService.getDomElement().parentNode;if(i){var a=i.querySelector("#"+o);a&&i.removeChild(a)}}},i=function(t){var r=t.target;r.nodeName===e.Shape.HTML&&n.updateAttribute(t.attrName,r)};t.hooks.init.tapPromise(vn.tag,xn(mn().mark((function t(){return mn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,o),n.renderingContext.root.addEventListener(e.ElementEvent.ATTR_MODIFIED,i);case 3:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(vn.tag,(function(){n.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,r),n.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,o),n.renderingContext.root.removeEventListener(e.ElementEvent.ATTR_MODIFIED,i)}))}},{key:"getId",value:function(t){return t.id||"g-html-"+t.entity}},{key:"getOrCreateEl",value:function(t){var e=this.getId(t),n=this.contextService.getDomElement().parentNode;if(n){var r=n.querySelector("#"+e);if(!r){r=document.createElement("div"),t.parsedStyle.$el=r,r.id=e,t.name&&r.setAttribute("name",t.name),t.className&&(r.className=t.className),n.appendChild(r),r.style.position="absolute",r.style.left="0",r.style.top="0",r.style["will-change"]="transform";var o=t.getWorldTransform();r.style.transform="matrix(".concat([o[0],o[1],o[4],o[5],o[12],o[13]].join(","),")")}return r}return null}},{key:"updateAttribute",value:function(t,n){var r=this.getOrCreateEl(n);switch(t){case"innerHTML":var o=n.parsedStyle.innerHTML;e.isString(o)?r.innerHTML=o:(r.innerHTML="",r.appendChild(o));break;case"modelMatrix":case"transformOrigin":var i=n.parsedStyle.transformOrigin;r.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);var a=n.getWorldTransform();r.style.transform="matrix(".concat([a[0],a[1],a[4],a[5],a[12],a[13]].join(","),")");break;case"width":var c=n.computedStyleMap().get("width");r.style.width=""+c;break;case"height":var u=n.computedStyleMap().get("height");r.style.height=""+u;break;case"zIndex":r.style["z-index"]="".concat(n.parsedStyle.zIndex.value);break;case"visibility":r.style.visibility=n.parsedStyle.visibility.value;break;case"pointerEvents":r.style.pointerEvents=n.parsedStyle.pointerEvents.value;break;case"opacity":r.style.opacity="".concat(n.parsedStyle.opacity.value);break;case"fill":var s=n.parsedStyle.fill,l="";if(s instanceof e.CSSRGB)l=""+s;else if(s instanceof e.CSSGradientValue&&s.type===e.GradientPatternType.LinearGradient){var h=s.value.steps.map((function(t){return"".concat(t[1]," ").concat(100*Number(t[0]),"%")})).join(",");l="linear-gradient(to right, ".concat(h,");")}r.style.background=l;break;case"stroke":r.style["border-color"]=""+n.parsedStyle.stroke,r.style["border-style"]="solid";break;case"lineWidth":r.style["border-width"]="".concat(n.parsedStyle.lineWidth.value||0,"px");break;case"lineDash":r.style["border-style"]="dashed";break;case"filter":r.style.filter=n.parsedStyle.filter}}}]),t}(),dn.tag="HTMLRendering",vn=dn);h([n.inject(e.ContextService),f("design:type",Object)],Pn.prototype,"contextService",void 0),h([n.inject(e.RenderingContext),f("design:type",Object)],Pn.prototype,"renderingContext",void 0),Pn=vn=h([n.singleton({contrib:e.RenderingPluginContribution})],Pn);var Sn=n.Module((function(t){t(Pn)})),Ln=function(){function t(){wn(this,t),this.name="html-renderer"}return kn(t,[{key:"init",value:function(t){t.load(Sn,!0)}},{key:"destroy",value:function(t){t.unload(Sn)}}]),t}(),On=Object.freeze({__proto__:null,Plugin:Ln}),Cn=function(){function t(){o(this,t),this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0}return a(t,[{key:"init",value:function(){var t=this.canvasConfig,n=t.container,r=t.canvas,o=t.devicePixelRatio;if(r)this.$canvas=r,n&&r.parentElement!==n&&n.appendChild(r),this.$container=r.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=e.isString(n)?document.getElementById(n):n,this.$container)){var i=document.createElement("canvas");this.$container.appendChild(i),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=i}this.context=this.$canvas.getContext("2d");var a=o||e.isBrowser&&window.devicePixelRatio||1;this.dpr=a=1>a?1:Math.ceil(a),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(t,n){if(this.$canvas){this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*n,e.setDOMSize(this.$canvas,t,n);var r=this.getDPR();this.context.scale(r,r)}}},{key:"applyCursorStyle",value:function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)}}]),t}();h([n.inject(e.CanvasConfig),f("design:type",Object)],Cn.prototype,"canvasConfig",void 0),Cn=h([n.singleton({token:e.ContextService})],Cn);var Mn=n.Module((function(t){t(Cn)})),Tn=function(){function t(){o(this,t),this.name="canvas-context-register"}return a(t,[{key:"init",value:function(t){t.load(Mn,!0)}},{key:"destroy",value:function(t){t.unload(Mn)}}]),t}(),jn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}(n,t);var e=l(n);function n(t){var r;return o(this,n),(r=e.call(this,t)).registerPlugin(new Tn),r.registerPlugin(new re),r.registerPlugin(new k),r.registerPlugin(new yn),r.registerPlugin(new Ln),r}return a(n)}(e.AbstractRenderer);t.CanvasPicker=gn,t.CanvasRenderer=oe,t.DomInteraction=P,t.HTMLRenderer=On,t.Renderer=jn,Object.defineProperty(t,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g-canvas",
3
- "version": "1.1.3",
3
+ "version": "1.1.6",
4
4
  "description": "A renderer implemented by Canvas 2D API",
5
5
  "keywords": [
6
6
  "antv",
@@ -29,10 +29,10 @@
29
29
  "README.md"
30
30
  ],
31
31
  "dependencies": {
32
- "@antv/g-plugin-canvas-picker": "^1.1.3",
33
- "@antv/g-plugin-canvas-renderer": "^1.1.3",
34
- "@antv/g-plugin-dom-interaction": "^1.1.3",
35
- "@antv/g-plugin-html-renderer": "^1.1.3",
32
+ "@antv/g-plugin-canvas-picker": "^1.1.6",
33
+ "@antv/g-plugin-canvas-renderer": "^1.1.6",
34
+ "@antv/g-plugin-dom-interaction": "^1.1.6",
35
+ "@antv/g-plugin-html-renderer": "^1.1.6",
36
36
  "tslib": "^2.3.1"
37
37
  },
38
38
  "devDependencies": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "3a02a5b5f99a5bddbc52fabf6f3be6a38e3c746e"
49
+ "gitHead": "ee946c7c12c90946c37926b34ee5165bf0c35f25"
50
50
  }