@netless/appliance-plugin 1.1.43-beta.1 → 1.1.43-beta.3
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.
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/{bridge-CDqtVTPN.js → bridge-CjP_hVOP.js} +1 -1
- package/dist/{bridge-nmqVpnZ5.mjs → bridge-DDjnM21Q.mjs} +1 -1
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/core/mainEngine.d.ts +1 -0
- package/dist/core/mainThread/subLocalThread.d.ts +3 -1
- package/dist/core/worker/fullWorkerLocal.d.ts +2 -1
- package/dist/fullWorker.js +25 -25
- package/dist/{index-BJOPyRJn.js → index-0kVavCij.js} +1 -1
- package/dist/{index-DhCFlEfW.mjs → index-9PPheeLn.mjs} +9048 -9033
- package/dist/{index-B44o9ggV.mjs → index-BJ0z6a4a.mjs} +30 -15
- package/dist/{index-Cjaia8CY.mjs → index-CWYxJZvD.mjs} +58 -46
- package/dist/{index-DDd-30M7.js → index-CfY3_e4d.js} +1 -1
- package/dist/index-CnrGW2oH.js +1 -0
- package/dist/{index-BF310Wzc.mjs → index-D0sxmVc0.mjs} +1 -1
- package/dist/index-DvSdT6k5.js +1 -0
- package/dist/{index-DdbAM7Xi.mjs → index-DvrjPbBe.mjs} +58 -46
- package/dist/{index-mcBiJOLo.mjs → index-NA6eaAqy.mjs} +1 -1
- package/dist/index-S6ml0iJb.js +570 -0
- package/dist/{index-Cu0f4kha.js → index-bu6U96S2.js} +1 -1
- package/dist/subWorker.js +2 -2
- package/package.json +1 -1
- package/dist/index-BiqhUSZ0.js +0 -570
- package/dist/index-o1TaWHww.js +0 -1
- package/dist/index-puxStU6w.js +0 -1
package/dist/fullWorker.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var _Object$freeze,_jbt;var _excluded=["duration"],_excluded2=["toolsType"],_excluded3=["callback"],_excluded4=["render"],_excluded5=["render"];function _wrapNativeSuper(t){var r="function"==typeof Map?new Map():void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper);}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor);}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t);},_wrapNativeSuper(t);}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]");}catch(n){return"function"==typeof t;}}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o))();return r&&_setPrototypeOf(p,r.prototype),p;}function _regeneratorValues(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function next(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e};}};}throw new TypeError(_typeof(e)+" is not iterable");}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n5=0,F=function F(){};return{s:F,n:function n(){return _n5>=r.length?{done:!0}:{done:!1,value:r[_n5++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t.return||t.return();}finally{if(u)throw o;}}};}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a;}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0));}if(o||r>1)return a;throw y=!0,n;}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0);}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e;}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break;}catch(t){i=e,c=1,u=t;}finally{f=1;}}return{value:t,done:y};};}(r,o,i),!0),u;}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this;}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e;}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this;}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]";}),(_regenerator=function _regenerator(){return{w:i,m:f};})();}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{});}catch(e){i=0;}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e);});}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2));},_regeneratorDefine2(e,r,n,t);}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _objectDestructuringEmpty(t){if(null==t)throw new TypeError("Cannot destructure "+t);}function _extends(){return _extends=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r]);}return n;},_extends.apply(null,arguments);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(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 _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(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&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){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 _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){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 _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _asyncIterator(r){var n,t,o,e=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,o=Symbol.iterator);e--;){if(t&&null!=(n=r[t]))return n.call(r);if(o&&null!=(n=r[o]))return new AsyncFromSyncIterator(n.call(r));t="@@asyncIterator",o="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(r){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var n=r.done;return Promise.resolve(r.value).then(function(r){return{value:r,done:n};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(r){this.s=r,this.n=r.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},return:function _return(r){var n=this.s.return;return void 0===n?Promise.resolve({value:r,done:!0}):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));},throw:function _throw(r){var n=this.s.return;return void 0===n?Promise.reject(r):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));}},new AsyncFromSyncIterator(r);}var jE=Object.defineProperty;var XE=function XE(r,t,e){return t in r?jE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;};var ht=function ht(r,t,e){return XE(r,_typeof(t)!="symbol"?t+"":t,e);};var go=1e-6,Xa=(typeof Float32Array==="undefined"?"undefined":_typeof(Float32Array))<"u"?Float32Array:Array;function Me(r){Xa=r;}function HE(){var r=new Xa(6);return Xa!=Float32Array&&(r[1]=0,r[2]=0,r[4]=0,r[5]=0),r[0]=1,r[3]=1,r;}function VE(r){var t=new Xa(6);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t;}function ZE(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r;}function qE(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r;}function Os(r,t,e,n,i,s){var o=new Xa(6);return o[0]=r,o[1]=t,o[2]=e,o[3]=n,o[4]=i,o[5]=s,o;}function KE(r,t,e,n,i,s,o){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=s,r[5]=o,r;}function iu(r,t){var e=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],u=e*s-n*i;return u?(u=1/u,r[0]=s*u,r[1]=-n*u,r[2]=-i*u,r[3]=e*u,r[4]=(i*a-s*o)*u,r[5]=(n*o-e*a)*u,r):null;}function QE(r){return r[0]*r[3]-r[1]*r[2];}function _n(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=e[0],v=e[1],p=e[2],y=e[3],C=e[4],b=e[5];return r[0]=n*h+s*v,r[1]=i*h+o*v,r[2]=n*p+s*y,r[3]=i*p+o*y,r[4]=n*C+s*b+a,r[5]=i*C+o*b+u,r;}function J1(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=Math.sin(e),v=Math.cos(e);return r[0]=n*v+s*h,r[1]=i*v+o*h,r[2]=n*-h+s*v,r[3]=i*-h+o*v,r[4]=a,r[5]=u,r;}function JE(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=e[0],v=e[1];return r[0]=n*h,r[1]=i*h,r[2]=s*v,r[3]=o*v,r[4]=a,r[5]=u,r;}function Yd(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=e[0],v=e[1];return r[0]=n,r[1]=i,r[2]=s,r[3]=o,r[4]=n*h+s*v+a,r[5]=i*h+o*v+u,r;}function _E(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=-e,r[3]=n,r[4]=0,r[5]=0,r;}function tM(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=t[1],r[4]=0,r[5]=0,r;}function eM(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=t[0],r[5]=t[1],r;}function rM(r){return"mat2d("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+")";}function nM(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]+r[3]*r[3]+r[4]*r[4]+r[5]*r[5]+1);}function iM(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r;}function _1(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r;}function sM(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r;}function oM(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r;}function aM(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5];}function lM(r,t){var e=r[0],n=r[1],i=r[2],s=r[3],o=r[4],a=r[5],u=t[0],h=t[1],v=t[2],p=t[3],y=t[4],C=t[5];return Math.abs(e-u)<=go*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(n-h)<=go*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-v)<=go*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(s-p)<=go*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(o-y)<=go*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(a-C)<=go*Math.max(1,Math.abs(a),Math.abs(C));}var cM=_n,uM=_1;var tw=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,add:iM,clone:VE,copy:ZE,create:HE,determinant:QE,equals:lM,exactEquals:aM,frob:nM,fromRotation:_E,fromScaling:tM,fromTranslation:eM,fromValues:Os,identity:qE,invert:iu,mul:cM,multiply:_n,multiplyScalar:sM,multiplyScalarAndAdd:oM,rotate:J1,scale:JE,set:KE,str:rM,sub:uM,subtract:_1,translate:Yd},Symbol.toStringTag,{value:"Module"}));var Qe=(typeof globalThis==="undefined"?"undefined":_typeof(globalThis))<"u"?globalThis:(typeof window==="undefined"?"undefined":_typeof(window))<"u"?window:(typeof global==="undefined"?"undefined":_typeof(global))<"u"?global:(typeof self==="undefined"?"undefined":_typeof(self))<"u"?self:{};function $n(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;}var ew={exports:{}};(function(r,t){(function(n,i){r.exports=i();})(Qe,function(){return/******/function(e){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={/******/i:s,/******/l:!1,/******/exports:{}/******/};return e[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports;}return i.m=e,i.c=n,i.d=function(s,o,a){i.o(s,o)||Object.defineProperty(s,o,{enumerable:!0,get:a});},i.r=function(s){(typeof Symbol==="undefined"?"undefined":_typeof(Symbol))<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0});},i.t=function(s,o){if(o&1&&(s=i(s)),o&8||o&4&&_typeof(s)=="object"&&s&&s.__esModule)return s;var a=/* @__PURE__ */Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:s}),o&2&&typeof s!="string")for(var u in s)i.d(a,u,function(h){return s[h];}.bind(null,u));return a;},i.n=function(s){var o=s&&s.__esModule?(/******/function(){return s.default;}):(/******/function(){return s;});return i.d(o,"a",o),o;},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o);},i.p="/js/",i(i.s=0);}([/* 0 *//***/function(e,n,i){i.r(n);var s=i(12);i.d(n,"Renderer",function(){return s.default;});var o=i(56);i.d(n,"Figure2D",function(){return o.default;});var a=i(73);i.d(n,"Mesh2D",function(){return a.default;});var u=i(45);i.d(n,"MeshCloud",function(){return u.default;});var h=i(39);i.d(n,"parseFont",function(){return h.default;});var v=i(47);i.d(n,"parseColor",function(){return v.default;});var p=i(37);i.d(n,"ENV",function(){return p.default;}),i(1).glMatrix.setMatrixArrayType(Array);},/* 1 *//***/function(e,n,i){i.r(n);var s=i(2);i.d(n,"glMatrix",function(){return s;});var o=i(3);i.d(n,"mat2",function(){return o;});var a=i(4);i.d(n,"mat2d",function(){return a;});var u=i(5);i.d(n,"mat3",function(){return u;});var h=i(6);i.d(n,"mat4",function(){return h;});var v=i(7);i.d(n,"quat",function(){return v;});var p=i(10);i.d(n,"quat2",function(){return p;});var y=i(11);i.d(n,"vec2",function(){return y;});var C=i(8);i.d(n,"vec3",function(){return C;});var b=i(9);i.d(n,"vec4",function(){return b;});},/* 2 *//***/function(e,n,i){i.r(n),i.d(n,"EPSILON",function(){return s;}),i.d(n,"ARRAY_TYPE",function(){return o;}),i.d(n,"RANDOM",function(){return a;}),i.d(n,"setMatrixArrayType",function(){return u;}),i.d(n,"toRadian",function(){return v;}),i.d(n,"equals",function(){return p;});var s=1e-6,o=(typeof Float32Array==="undefined"?"undefined":_typeof(Float32Array))<"u"?Float32Array:Array,a=Math.random;function u(y){o=y;}var h=Math.PI/180;function v(y){return y*h;}function p(y,C){return Math.abs(y-C)<=s*Math.max(1,Math.abs(y),Math.abs(C));}Math.hypot||(Math.hypot=function(){for(var y=0,C=arguments.length;C--;)y+=arguments[C]*arguments[C];return Math.sqrt(y);});},/* 3 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"copy",function(){return u;}),i.d(n,"identity",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"transpose",function(){return y;}),i.d(n,"invert",function(){return C;}),i.d(n,"adjoint",function(){return b;}),i.d(n,"determinant",function(){return M;}),i.d(n,"multiply",function(){return L;}),i.d(n,"rotate",function(){return X;}),i.d(n,"scale",function(){return Y;}),i.d(n,"fromRotation",function(){return et;}),i.d(n,"fromScaling",function(){return A;}),i.d(n,"str",function(){return w;}),i.d(n,"frob",function(){return S;}),i.d(n,"LDU",function(){return x;}),i.d(n,"add",function(){return P;}),i.d(n,"subtract",function(){return z;}),i.d(n,"exactEquals",function(){return U;}),i.d(n,"equals",function(){return K;}),i.d(n,"multiplyScalar",function(){return j;}),i.d(n,"multiplyScalarAndAdd",function(){return nt;}),i.d(n,"mul",function(){return ct;}),i.d(n,"sub",function(){return B;});var s=i(2);function o(){var N=new s.ARRAY_TYPE(4);return s.ARRAY_TYPE!=Float32Array&&(N[1]=0,N[2]=0),N[0]=1,N[3]=1,N;}function a(N){var G=new s.ARRAY_TYPE(4);return G[0]=N[0],G[1]=N[1],G[2]=N[2],G[3]=N[3],G;}function u(N,G){return N[0]=G[0],N[1]=G[1],N[2]=G[2],N[3]=G[3],N;}function h(N){return N[0]=1,N[1]=0,N[2]=0,N[3]=1,N;}function v(N,G,q,at){var ut=new s.ARRAY_TYPE(4);return ut[0]=N,ut[1]=G,ut[2]=q,ut[3]=at,ut;}function p(N,G,q,at,ut){return N[0]=G,N[1]=q,N[2]=at,N[3]=ut,N;}function y(N,G){if(N===G){var q=G[1];N[1]=G[2],N[2]=q;}else N[0]=G[0],N[1]=G[2],N[2]=G[1],N[3]=G[3];return N;}function C(N,G){var q=G[0],at=G[1],ut=G[2],Ct=G[3],R=q*Ct-ut*at;return R?(R=1/R,N[0]=Ct*R,N[1]=-at*R,N[2]=-ut*R,N[3]=q*R,N):null;}function b(N,G){var q=G[0];return N[0]=G[3],N[1]=-G[1],N[2]=-G[2],N[3]=q,N;}function M(N){return N[0]*N[3]-N[2]*N[1];}function L(N,G,q){var at=G[0],ut=G[1],Ct=G[2],R=G[3],$=q[0],_=q[1],H=q[2],lt=q[3];return N[0]=at*$+Ct*_,N[1]=ut*$+R*_,N[2]=at*H+Ct*lt,N[3]=ut*H+R*lt,N;}function X(N,G,q){var at=G[0],ut=G[1],Ct=G[2],R=G[3],$=Math.sin(q),_=Math.cos(q);return N[0]=at*_+Ct*$,N[1]=ut*_+R*$,N[2]=at*-$+Ct*_,N[3]=ut*-$+R*_,N;}function Y(N,G,q){var at=G[0],ut=G[1],Ct=G[2],R=G[3],$=q[0],_=q[1];return N[0]=at*$,N[1]=ut*$,N[2]=Ct*_,N[3]=R*_,N;}function et(N,G){var q=Math.sin(G),at=Math.cos(G);return N[0]=at,N[1]=q,N[2]=-q,N[3]=at,N;}function A(N,G){return N[0]=G[0],N[1]=0,N[2]=0,N[3]=G[1],N;}function w(N){return"mat2("+N[0]+", "+N[1]+", "+N[2]+", "+N[3]+")";}function S(N){return Math.hypot(N[0],N[1],N[2],N[3]);}function x(N,G,q,at){return N[2]=at[2]/at[0],q[0]=at[0],q[1]=at[1],q[3]=at[3]-N[2]*q[1],[N,G,q];}function P(N,G,q){return N[0]=G[0]+q[0],N[1]=G[1]+q[1],N[2]=G[2]+q[2],N[3]=G[3]+q[3],N;}function z(N,G,q){return N[0]=G[0]-q[0],N[1]=G[1]-q[1],N[2]=G[2]-q[2],N[3]=G[3]-q[3],N;}function U(N,G){return N[0]===G[0]&&N[1]===G[1]&&N[2]===G[2]&&N[3]===G[3];}function K(N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=G[0],$=G[1],_=G[2],H=G[3];return Math.abs(q-R)<=s.EPSILON*Math.max(1,Math.abs(q),Math.abs(R))&&Math.abs(at-$)<=s.EPSILON*Math.max(1,Math.abs(at),Math.abs($))&&Math.abs(ut-_)<=s.EPSILON*Math.max(1,Math.abs(ut),Math.abs(_))&&Math.abs(Ct-H)<=s.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(H));}function j(N,G,q){return N[0]=G[0]*q,N[1]=G[1]*q,N[2]=G[2]*q,N[3]=G[3]*q,N;}function nt(N,G,q,at){return N[0]=G[0]+q[0]*at,N[1]=G[1]+q[1]*at,N[2]=G[2]+q[2]*at,N[3]=G[3]+q[3]*at,N;}var ct=L,B=z;},/* 4 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"copy",function(){return u;}),i.d(n,"identity",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"invert",function(){return y;}),i.d(n,"determinant",function(){return C;}),i.d(n,"multiply",function(){return b;}),i.d(n,"rotate",function(){return M;}),i.d(n,"scale",function(){return L;}),i.d(n,"translate",function(){return X;}),i.d(n,"fromRotation",function(){return Y;}),i.d(n,"fromScaling",function(){return et;}),i.d(n,"fromTranslation",function(){return A;}),i.d(n,"str",function(){return w;}),i.d(n,"frob",function(){return S;}),i.d(n,"add",function(){return x;}),i.d(n,"subtract",function(){return P;}),i.d(n,"multiplyScalar",function(){return z;}),i.d(n,"multiplyScalarAndAdd",function(){return U;}),i.d(n,"exactEquals",function(){return K;}),i.d(n,"equals",function(){return j;}),i.d(n,"mul",function(){return nt;}),i.d(n,"sub",function(){return ct;});var s=i(2);function o(){var B=new s.ARRAY_TYPE(6);return s.ARRAY_TYPE!=Float32Array&&(B[1]=0,B[2]=0,B[4]=0,B[5]=0),B[0]=1,B[3]=1,B;}function a(B){var N=new s.ARRAY_TYPE(6);return N[0]=B[0],N[1]=B[1],N[2]=B[2],N[3]=B[3],N[4]=B[4],N[5]=B[5],N;}function u(B,N){return B[0]=N[0],B[1]=N[1],B[2]=N[2],B[3]=N[3],B[4]=N[4],B[5]=N[5],B;}function h(B){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=0,B[5]=0,B;}function v(B,N,G,q,at,ut){var Ct=new s.ARRAY_TYPE(6);return Ct[0]=B,Ct[1]=N,Ct[2]=G,Ct[3]=q,Ct[4]=at,Ct[5]=ut,Ct;}function p(B,N,G,q,at,ut,Ct){return B[0]=N,B[1]=G,B[2]=q,B[3]=at,B[4]=ut,B[5]=Ct,B;}function y(B,N){var G=N[0],q=N[1],at=N[2],ut=N[3],Ct=N[4],R=N[5],$=G*ut-q*at;return $?($=1/$,B[0]=ut*$,B[1]=-q*$,B[2]=-at*$,B[3]=G*$,B[4]=(at*R-ut*Ct)*$,B[5]=(q*Ct-G*R)*$,B):null;}function C(B){return B[0]*B[3]-B[1]*B[2];}function b(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=G[0],H=G[1],lt=G[2],dt=G[3],wt=G[4],Et=G[5];return B[0]=q*_+ut*H,B[1]=at*_+Ct*H,B[2]=q*lt+ut*dt,B[3]=at*lt+Ct*dt,B[4]=q*wt+ut*Et+R,B[5]=at*wt+Ct*Et+$,B;}function M(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=Math.sin(G),H=Math.cos(G);return B[0]=q*H+ut*_,B[1]=at*H+Ct*_,B[2]=q*-_+ut*H,B[3]=at*-_+Ct*H,B[4]=R,B[5]=$,B;}function L(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=G[0],H=G[1];return B[0]=q*_,B[1]=at*_,B[2]=ut*H,B[3]=Ct*H,B[4]=R,B[5]=$,B;}function X(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=G[0],H=G[1];return B[0]=q,B[1]=at,B[2]=ut,B[3]=Ct,B[4]=q*_+ut*H+R,B[5]=at*_+Ct*H+$,B;}function Y(B,N){var G=Math.sin(N),q=Math.cos(N);return B[0]=q,B[1]=G,B[2]=-G,B[3]=q,B[4]=0,B[5]=0,B;}function et(B,N){return B[0]=N[0],B[1]=0,B[2]=0,B[3]=N[1],B[4]=0,B[5]=0,B;}function A(B,N){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=N[0],B[5]=N[1],B;}function w(B){return"mat2d("+B[0]+", "+B[1]+", "+B[2]+", "+B[3]+", "+B[4]+", "+B[5]+")";}function S(B){return Math.hypot(B[0],B[1],B[2],B[3],B[4],B[5],1);}function x(B,N,G){return B[0]=N[0]+G[0],B[1]=N[1]+G[1],B[2]=N[2]+G[2],B[3]=N[3]+G[3],B[4]=N[4]+G[4],B[5]=N[5]+G[5],B;}function P(B,N,G){return B[0]=N[0]-G[0],B[1]=N[1]-G[1],B[2]=N[2]-G[2],B[3]=N[3]-G[3],B[4]=N[4]-G[4],B[5]=N[5]-G[5],B;}function z(B,N,G){return B[0]=N[0]*G,B[1]=N[1]*G,B[2]=N[2]*G,B[3]=N[3]*G,B[4]=N[4]*G,B[5]=N[5]*G,B;}function U(B,N,G,q){return B[0]=N[0]+G[0]*q,B[1]=N[1]+G[1]*q,B[2]=N[2]+G[2]*q,B[3]=N[3]+G[3]*q,B[4]=N[4]+G[4]*q,B[5]=N[5]+G[5]*q,B;}function K(B,N){return B[0]===N[0]&&B[1]===N[1]&&B[2]===N[2]&&B[3]===N[3]&&B[4]===N[4]&&B[5]===N[5];}function j(B,N){var G=B[0],q=B[1],at=B[2],ut=B[3],Ct=B[4],R=B[5],$=N[0],_=N[1],H=N[2],lt=N[3],dt=N[4],wt=N[5];return Math.abs(G-$)<=s.EPSILON*Math.max(1,Math.abs(G),Math.abs($))&&Math.abs(q-_)<=s.EPSILON*Math.max(1,Math.abs(q),Math.abs(_))&&Math.abs(at-H)<=s.EPSILON*Math.max(1,Math.abs(at),Math.abs(H))&&Math.abs(ut-lt)<=s.EPSILON*Math.max(1,Math.abs(ut),Math.abs(lt))&&Math.abs(Ct-dt)<=s.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(dt))&&Math.abs(R-wt)<=s.EPSILON*Math.max(1,Math.abs(R),Math.abs(wt));}var nt=b,ct=P;},/* 5 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"fromMat4",function(){return a;}),i.d(n,"clone",function(){return u;}),i.d(n,"copy",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"identity",function(){return y;}),i.d(n,"transpose",function(){return C;}),i.d(n,"invert",function(){return b;}),i.d(n,"adjoint",function(){return M;}),i.d(n,"determinant",function(){return L;}),i.d(n,"multiply",function(){return X;}),i.d(n,"translate",function(){return Y;}),i.d(n,"rotate",function(){return et;}),i.d(n,"scale",function(){return A;}),i.d(n,"fromTranslation",function(){return w;}),i.d(n,"fromRotation",function(){return S;}),i.d(n,"fromScaling",function(){return x;}),i.d(n,"fromMat2d",function(){return P;}),i.d(n,"fromQuat",function(){return z;}),i.d(n,"normalFromMat4",function(){return U;}),i.d(n,"projection",function(){return K;}),i.d(n,"str",function(){return j;}),i.d(n,"frob",function(){return nt;}),i.d(n,"add",function(){return ct;}),i.d(n,"subtract",function(){return B;}),i.d(n,"multiplyScalar",function(){return N;}),i.d(n,"multiplyScalarAndAdd",function(){return G;}),i.d(n,"exactEquals",function(){return q;}),i.d(n,"equals",function(){return at;}),i.d(n,"mul",function(){return ut;}),i.d(n,"sub",function(){return Ct;});var s=i(2);function o(){var R=new s.ARRAY_TYPE(9);return s.ARRAY_TYPE!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R;}function a(R,$){return R[0]=$[0],R[1]=$[1],R[2]=$[2],R[3]=$[4],R[4]=$[5],R[5]=$[6],R[6]=$[8],R[7]=$[9],R[8]=$[10],R;}function u(R){var $=new s.ARRAY_TYPE(9);return $[0]=R[0],$[1]=R[1],$[2]=R[2],$[3]=R[3],$[4]=R[4],$[5]=R[5],$[6]=R[6],$[7]=R[7],$[8]=R[8],$;}function h(R,$){return R[0]=$[0],R[1]=$[1],R[2]=$[2],R[3]=$[3],R[4]=$[4],R[5]=$[5],R[6]=$[6],R[7]=$[7],R[8]=$[8],R;}function v(R,$,_,H,lt,dt,wt,Et,Ot){var O=new s.ARRAY_TYPE(9);return O[0]=R,O[1]=$,O[2]=_,O[3]=H,O[4]=lt,O[5]=dt,O[6]=wt,O[7]=Et,O[8]=Ot,O;}function p(R,$,_,H,lt,dt,wt,Et,Ot,O){return R[0]=$,R[1]=_,R[2]=H,R[3]=lt,R[4]=dt,R[5]=wt,R[6]=Et,R[7]=Ot,R[8]=O,R;}function y(R){return R[0]=1,R[1]=0,R[2]=0,R[3]=0,R[4]=1,R[5]=0,R[6]=0,R[7]=0,R[8]=1,R;}function C(R,$){if(R===$){var _=$[1],H=$[2],lt=$[5];R[1]=$[3],R[2]=$[6],R[3]=_,R[5]=$[7],R[6]=H,R[7]=lt;}else R[0]=$[0],R[1]=$[3],R[2]=$[6],R[3]=$[1],R[4]=$[4],R[5]=$[7],R[6]=$[2],R[7]=$[5],R[8]=$[8];return R;}function b(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=$[4],Et=$[5],Ot=$[6],O=$[7],D=$[8],J=D*wt-Et*O,Q=-D*dt+Et*Ot,V=O*dt-wt*Ot,tt=_*J+H*Q+lt*V;return tt?(tt=1/tt,R[0]=J*tt,R[1]=(-D*H+lt*O)*tt,R[2]=(Et*H-lt*wt)*tt,R[3]=Q*tt,R[4]=(D*_-lt*Ot)*tt,R[5]=(-Et*_+lt*dt)*tt,R[6]=V*tt,R[7]=(-O*_+H*Ot)*tt,R[8]=(wt*_-H*dt)*tt,R):null;}function M(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=$[4],Et=$[5],Ot=$[6],O=$[7],D=$[8];return R[0]=wt*D-Et*O,R[1]=lt*O-H*D,R[2]=H*Et-lt*wt,R[3]=Et*Ot-dt*D,R[4]=_*D-lt*Ot,R[5]=lt*dt-_*Et,R[6]=dt*O-wt*Ot,R[7]=H*Ot-_*O,R[8]=_*wt-H*dt,R;}function L(R){var $=R[0],_=R[1],H=R[2],lt=R[3],dt=R[4],wt=R[5],Et=R[6],Ot=R[7],O=R[8];return $*(O*dt-wt*Ot)+_*(-O*lt+wt*Et)+H*(Ot*lt-dt*Et);}function X(R,$,_){var H=$[0],lt=$[1],dt=$[2],wt=$[3],Et=$[4],Ot=$[5],O=$[6],D=$[7],J=$[8],Q=_[0],V=_[1],tt=_[2],g=_[3],T=_[4],k=_[5],Z=_[6],st=_[7],ft=_[8];return R[0]=Q*H+V*wt+tt*O,R[1]=Q*lt+V*Et+tt*D,R[2]=Q*dt+V*Ot+tt*J,R[3]=g*H+T*wt+k*O,R[4]=g*lt+T*Et+k*D,R[5]=g*dt+T*Ot+k*J,R[6]=Z*H+st*wt+ft*O,R[7]=Z*lt+st*Et+ft*D,R[8]=Z*dt+st*Ot+ft*J,R;}function Y(R,$,_){var H=$[0],lt=$[1],dt=$[2],wt=$[3],Et=$[4],Ot=$[5],O=$[6],D=$[7],J=$[8],Q=_[0],V=_[1];return R[0]=H,R[1]=lt,R[2]=dt,R[3]=wt,R[4]=Et,R[5]=Ot,R[6]=Q*H+V*wt+O,R[7]=Q*lt+V*Et+D,R[8]=Q*dt+V*Ot+J,R;}function et(R,$,_){var H=$[0],lt=$[1],dt=$[2],wt=$[3],Et=$[4],Ot=$[5],O=$[6],D=$[7],J=$[8],Q=Math.sin(_),V=Math.cos(_);return R[0]=V*H+Q*wt,R[1]=V*lt+Q*Et,R[2]=V*dt+Q*Ot,R[3]=V*wt-Q*H,R[4]=V*Et-Q*lt,R[5]=V*Ot-Q*dt,R[6]=O,R[7]=D,R[8]=J,R;}function A(R,$,_){var H=_[0],lt=_[1];return R[0]=H*$[0],R[1]=H*$[1],R[2]=H*$[2],R[3]=lt*$[3],R[4]=lt*$[4],R[5]=lt*$[5],R[6]=$[6],R[7]=$[7],R[8]=$[8],R;}function w(R,$){return R[0]=1,R[1]=0,R[2]=0,R[3]=0,R[4]=1,R[5]=0,R[6]=$[0],R[7]=$[1],R[8]=1,R;}function S(R,$){var _=Math.sin($),H=Math.cos($);return R[0]=H,R[1]=_,R[2]=0,R[3]=-_,R[4]=H,R[5]=0,R[6]=0,R[7]=0,R[8]=1,R;}function x(R,$){return R[0]=$[0],R[1]=0,R[2]=0,R[3]=0,R[4]=$[1],R[5]=0,R[6]=0,R[7]=0,R[8]=1,R;}function P(R,$){return R[0]=$[0],R[1]=$[1],R[2]=0,R[3]=$[2],R[4]=$[3],R[5]=0,R[6]=$[4],R[7]=$[5],R[8]=1,R;}function z(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=_+_,Et=H+H,Ot=lt+lt,O=_*wt,D=H*wt,J=H*Et,Q=lt*wt,V=lt*Et,tt=lt*Ot,g=dt*wt,T=dt*Et,k=dt*Ot;return R[0]=1-J-tt,R[3]=D-k,R[6]=Q+T,R[1]=D+k,R[4]=1-O-tt,R[7]=V-g,R[2]=Q-T,R[5]=V+g,R[8]=1-O-J,R;}function U(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=$[4],Et=$[5],Ot=$[6],O=$[7],D=$[8],J=$[9],Q=$[10],V=$[11],tt=$[12],g=$[13],T=$[14],k=$[15],Z=_*Et-H*wt,st=_*Ot-lt*wt,ft=_*O-dt*wt,pt=H*Ot-lt*Et,ot=H*O-dt*Et,mt=lt*O-dt*Ot,Tt=D*g-J*tt,Pt=D*T-Q*tt,Lt=D*k-V*tt,Dt=J*T-Q*g,Nt=J*k-V*g,Yt=Q*k-V*T,Ut=Z*Yt-st*Nt+ft*Dt+pt*Lt-ot*Pt+mt*Tt;return Ut?(Ut=1/Ut,R[0]=(Et*Yt-Ot*Nt+O*Dt)*Ut,R[1]=(Ot*Lt-wt*Yt-O*Pt)*Ut,R[2]=(wt*Nt-Et*Lt+O*Tt)*Ut,R[3]=(lt*Nt-H*Yt-dt*Dt)*Ut,R[4]=(_*Yt-lt*Lt+dt*Pt)*Ut,R[5]=(H*Lt-_*Nt-dt*Tt)*Ut,R[6]=(g*mt-T*ot+k*pt)*Ut,R[7]=(T*ft-tt*mt-k*st)*Ut,R[8]=(tt*ot-g*ft+k*Z)*Ut,R):null;}function K(R,$,_){return R[0]=2/$,R[1]=0,R[2]=0,R[3]=0,R[4]=-2/_,R[5]=0,R[6]=-1,R[7]=1,R[8]=1,R;}function j(R){return"mat3("+R[0]+", "+R[1]+", "+R[2]+", "+R[3]+", "+R[4]+", "+R[5]+", "+R[6]+", "+R[7]+", "+R[8]+")";}function nt(R){return Math.hypot(R[0],R[1],R[2],R[3],R[4],R[5],R[6],R[7],R[8]);}function ct(R,$,_){return R[0]=$[0]+_[0],R[1]=$[1]+_[1],R[2]=$[2]+_[2],R[3]=$[3]+_[3],R[4]=$[4]+_[4],R[5]=$[5]+_[5],R[6]=$[6]+_[6],R[7]=$[7]+_[7],R[8]=$[8]+_[8],R;}function B(R,$,_){return R[0]=$[0]-_[0],R[1]=$[1]-_[1],R[2]=$[2]-_[2],R[3]=$[3]-_[3],R[4]=$[4]-_[4],R[5]=$[5]-_[5],R[6]=$[6]-_[6],R[7]=$[7]-_[7],R[8]=$[8]-_[8],R;}function N(R,$,_){return R[0]=$[0]*_,R[1]=$[1]*_,R[2]=$[2]*_,R[3]=$[3]*_,R[4]=$[4]*_,R[5]=$[5]*_,R[6]=$[6]*_,R[7]=$[7]*_,R[8]=$[8]*_,R;}function G(R,$,_,H){return R[0]=$[0]+_[0]*H,R[1]=$[1]+_[1]*H,R[2]=$[2]+_[2]*H,R[3]=$[3]+_[3]*H,R[4]=$[4]+_[4]*H,R[5]=$[5]+_[5]*H,R[6]=$[6]+_[6]*H,R[7]=$[7]+_[7]*H,R[8]=$[8]+_[8]*H,R;}function q(R,$){return R[0]===$[0]&&R[1]===$[1]&&R[2]===$[2]&&R[3]===$[3]&&R[4]===$[4]&&R[5]===$[5]&&R[6]===$[6]&&R[7]===$[7]&&R[8]===$[8];}function at(R,$){var _=R[0],H=R[1],lt=R[2],dt=R[3],wt=R[4],Et=R[5],Ot=R[6],O=R[7],D=R[8],J=$[0],Q=$[1],V=$[2],tt=$[3],g=$[4],T=$[5],k=$[6],Z=$[7],st=$[8];return Math.abs(_-J)<=s.EPSILON*Math.max(1,Math.abs(_),Math.abs(J))&&Math.abs(H-Q)<=s.EPSILON*Math.max(1,Math.abs(H),Math.abs(Q))&&Math.abs(lt-V)<=s.EPSILON*Math.max(1,Math.abs(lt),Math.abs(V))&&Math.abs(dt-tt)<=s.EPSILON*Math.max(1,Math.abs(dt),Math.abs(tt))&&Math.abs(wt-g)<=s.EPSILON*Math.max(1,Math.abs(wt),Math.abs(g))&&Math.abs(Et-T)<=s.EPSILON*Math.max(1,Math.abs(Et),Math.abs(T))&&Math.abs(Ot-k)<=s.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(k))&&Math.abs(O-Z)<=s.EPSILON*Math.max(1,Math.abs(O),Math.abs(Z))&&Math.abs(D-st)<=s.EPSILON*Math.max(1,Math.abs(D),Math.abs(st));}var ut=X,Ct=B;},/* 6 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"copy",function(){return u;}),i.d(n,"fromValues",function(){return h;}),i.d(n,"set",function(){return v;}),i.d(n,"identity",function(){return p;}),i.d(n,"transpose",function(){return y;}),i.d(n,"invert",function(){return C;}),i.d(n,"adjoint",function(){return b;}),i.d(n,"determinant",function(){return M;}),i.d(n,"multiply",function(){return L;}),i.d(n,"translate",function(){return X;}),i.d(n,"scale",function(){return Y;}),i.d(n,"rotate",function(){return et;}),i.d(n,"rotateX",function(){return A;}),i.d(n,"rotateY",function(){return w;}),i.d(n,"rotateZ",function(){return S;}),i.d(n,"fromTranslation",function(){return x;}),i.d(n,"fromScaling",function(){return P;}),i.d(n,"fromRotation",function(){return z;}),i.d(n,"fromXRotation",function(){return U;}),i.d(n,"fromYRotation",function(){return K;}),i.d(n,"fromZRotation",function(){return j;}),i.d(n,"fromRotationTranslation",function(){return nt;}),i.d(n,"fromQuat2",function(){return ct;}),i.d(n,"getTranslation",function(){return B;}),i.d(n,"getScaling",function(){return N;}),i.d(n,"getRotation",function(){return G;}),i.d(n,"fromRotationTranslationScale",function(){return q;}),i.d(n,"fromRotationTranslationScaleOrigin",function(){return at;}),i.d(n,"fromQuat",function(){return ut;}),i.d(n,"frustum",function(){return Ct;}),i.d(n,"perspective",function(){return R;}),i.d(n,"perspectiveFromFieldOfView",function(){return $;}),i.d(n,"ortho",function(){return _;}),i.d(n,"lookAt",function(){return H;}),i.d(n,"targetTo",function(){return lt;}),i.d(n,"str",function(){return dt;}),i.d(n,"frob",function(){return wt;}),i.d(n,"add",function(){return Et;}),i.d(n,"subtract",function(){return Ot;}),i.d(n,"multiplyScalar",function(){return O;}),i.d(n,"multiplyScalarAndAdd",function(){return D;}),i.d(n,"exactEquals",function(){return J;}),i.d(n,"equals",function(){return Q;}),i.d(n,"mul",function(){return V;}),i.d(n,"sub",function(){return tt;});var s=i(2);function o(){var g=new s.ARRAY_TYPE(16);return s.ARRAY_TYPE!=Float32Array&&(g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=0,g[12]=0,g[13]=0,g[14]=0),g[0]=1,g[5]=1,g[10]=1,g[15]=1,g;}function a(g){var T=new s.ARRAY_TYPE(16);return T[0]=g[0],T[1]=g[1],T[2]=g[2],T[3]=g[3],T[4]=g[4],T[5]=g[5],T[6]=g[6],T[7]=g[7],T[8]=g[8],T[9]=g[9],T[10]=g[10],T[11]=g[11],T[12]=g[12],T[13]=g[13],T[14]=g[14],T[15]=g[15],T;}function u(g,T){return g[0]=T[0],g[1]=T[1],g[2]=T[2],g[3]=T[3],g[4]=T[4],g[5]=T[5],g[6]=T[6],g[7]=T[7],g[8]=T[8],g[9]=T[9],g[10]=T[10],g[11]=T[11],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15],g;}function h(g,T,k,Z,st,ft,pt,ot,mt,Tt,Pt,Lt,Dt,Nt,Yt,Ut){var Ft=new s.ARRAY_TYPE(16);return Ft[0]=g,Ft[1]=T,Ft[2]=k,Ft[3]=Z,Ft[4]=st,Ft[5]=ft,Ft[6]=pt,Ft[7]=ot,Ft[8]=mt,Ft[9]=Tt,Ft[10]=Pt,Ft[11]=Lt,Ft[12]=Dt,Ft[13]=Nt,Ft[14]=Yt,Ft[15]=Ut,Ft;}function v(g,T,k,Z,st,ft,pt,ot,mt,Tt,Pt,Lt,Dt,Nt,Yt,Ut,Ft){return g[0]=T,g[1]=k,g[2]=Z,g[3]=st,g[4]=ft,g[5]=pt,g[6]=ot,g[7]=mt,g[8]=Tt,g[9]=Pt,g[10]=Lt,g[11]=Dt,g[12]=Nt,g[13]=Yt,g[14]=Ut,g[15]=Ft,g;}function p(g){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function y(g,T){if(g===T){var k=T[1],Z=T[2],st=T[3],ft=T[6],pt=T[7],ot=T[11];g[1]=T[4],g[2]=T[8],g[3]=T[12],g[4]=k,g[6]=T[9],g[7]=T[13],g[8]=Z,g[9]=ft,g[11]=T[14],g[12]=st,g[13]=pt,g[14]=ot;}else g[0]=T[0],g[1]=T[4],g[2]=T[8],g[3]=T[12],g[4]=T[1],g[5]=T[5],g[6]=T[9],g[7]=T[13],g[8]=T[2],g[9]=T[6],g[10]=T[10],g[11]=T[14],g[12]=T[3],g[13]=T[7],g[14]=T[11],g[15]=T[15];return g;}function C(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[3],pt=T[4],ot=T[5],mt=T[6],Tt=T[7],Pt=T[8],Lt=T[9],Dt=T[10],Nt=T[11],Yt=T[12],Ut=T[13],Ft=T[14],Jt=T[15],ee=k*ot-Z*pt,re=k*mt-st*pt,se=k*Tt-ft*pt,oe=Z*mt-st*ot,le=Z*Tt-ft*ot,Re=st*Tt-ft*mt,Oe=Pt*Ut-Lt*Yt,ke=Pt*Ft-Dt*Yt,Be=Pt*Jt-Nt*Yt,Ge=Lt*Ft-Dt*Ut,He=Lt*Jt-Nt*Ut,je=Dt*Jt-Nt*Ft,ye=ee*je-re*He+se*Ge+oe*Be-le*ke+Re*Oe;return ye?(ye=1/ye,g[0]=(ot*je-mt*He+Tt*Ge)*ye,g[1]=(st*He-Z*je-ft*Ge)*ye,g[2]=(Ut*Re-Ft*le+Jt*oe)*ye,g[3]=(Dt*le-Lt*Re-Nt*oe)*ye,g[4]=(mt*Be-pt*je-Tt*ke)*ye,g[5]=(k*je-st*Be+ft*ke)*ye,g[6]=(Ft*se-Yt*Re-Jt*re)*ye,g[7]=(Pt*Re-Dt*se+Nt*re)*ye,g[8]=(pt*He-ot*Be+Tt*Oe)*ye,g[9]=(Z*Be-k*He-ft*Oe)*ye,g[10]=(Yt*le-Ut*se+Jt*ee)*ye,g[11]=(Lt*se-Pt*le-Nt*ee)*ye,g[12]=(ot*ke-pt*Ge-mt*Oe)*ye,g[13]=(k*Ge-Z*ke+st*Oe)*ye,g[14]=(Ut*re-Yt*oe-Ft*ee)*ye,g[15]=(Pt*oe-Lt*re+Dt*ee)*ye,g):null;}function b(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[3],pt=T[4],ot=T[5],mt=T[6],Tt=T[7],Pt=T[8],Lt=T[9],Dt=T[10],Nt=T[11],Yt=T[12],Ut=T[13],Ft=T[14],Jt=T[15];return g[0]=ot*(Dt*Jt-Nt*Ft)-Lt*(mt*Jt-Tt*Ft)+Ut*(mt*Nt-Tt*Dt),g[1]=-(Z*(Dt*Jt-Nt*Ft)-Lt*(st*Jt-ft*Ft)+Ut*(st*Nt-ft*Dt)),g[2]=Z*(mt*Jt-Tt*Ft)-ot*(st*Jt-ft*Ft)+Ut*(st*Tt-ft*mt),g[3]=-(Z*(mt*Nt-Tt*Dt)-ot*(st*Nt-ft*Dt)+Lt*(st*Tt-ft*mt)),g[4]=-(pt*(Dt*Jt-Nt*Ft)-Pt*(mt*Jt-Tt*Ft)+Yt*(mt*Nt-Tt*Dt)),g[5]=k*(Dt*Jt-Nt*Ft)-Pt*(st*Jt-ft*Ft)+Yt*(st*Nt-ft*Dt),g[6]=-(k*(mt*Jt-Tt*Ft)-pt*(st*Jt-ft*Ft)+Yt*(st*Tt-ft*mt)),g[7]=k*(mt*Nt-Tt*Dt)-pt*(st*Nt-ft*Dt)+Pt*(st*Tt-ft*mt),g[8]=pt*(Lt*Jt-Nt*Ut)-Pt*(ot*Jt-Tt*Ut)+Yt*(ot*Nt-Tt*Lt),g[9]=-(k*(Lt*Jt-Nt*Ut)-Pt*(Z*Jt-ft*Ut)+Yt*(Z*Nt-ft*Lt)),g[10]=k*(ot*Jt-Tt*Ut)-pt*(Z*Jt-ft*Ut)+Yt*(Z*Tt-ft*ot),g[11]=-(k*(ot*Nt-Tt*Lt)-pt*(Z*Nt-ft*Lt)+Pt*(Z*Tt-ft*ot)),g[12]=-(pt*(Lt*Ft-Dt*Ut)-Pt*(ot*Ft-mt*Ut)+Yt*(ot*Dt-mt*Lt)),g[13]=k*(Lt*Ft-Dt*Ut)-Pt*(Z*Ft-st*Ut)+Yt*(Z*Dt-st*Lt),g[14]=-(k*(ot*Ft-mt*Ut)-pt*(Z*Ft-st*Ut)+Yt*(Z*mt-st*ot)),g[15]=k*(ot*Dt-mt*Lt)-pt*(Z*Dt-st*Lt)+Pt*(Z*mt-st*ot),g;}function M(g){var T=g[0],k=g[1],Z=g[2],st=g[3],ft=g[4],pt=g[5],ot=g[6],mt=g[7],Tt=g[8],Pt=g[9],Lt=g[10],Dt=g[11],Nt=g[12],Yt=g[13],Ut=g[14],Ft=g[15],Jt=T*pt-k*ft,ee=T*ot-Z*ft,re=T*mt-st*ft,se=k*ot-Z*pt,oe=k*mt-st*pt,le=Z*mt-st*ot,Re=Tt*Yt-Pt*Nt,Oe=Tt*Ut-Lt*Nt,ke=Tt*Ft-Dt*Nt,Be=Pt*Ut-Lt*Yt,Ge=Pt*Ft-Dt*Yt,He=Lt*Ft-Dt*Ut;return Jt*He-ee*Ge+re*Be+se*ke-oe*Oe+le*Re;}function L(g,T,k){var Z=T[0],st=T[1],ft=T[2],pt=T[3],ot=T[4],mt=T[5],Tt=T[6],Pt=T[7],Lt=T[8],Dt=T[9],Nt=T[10],Yt=T[11],Ut=T[12],Ft=T[13],Jt=T[14],ee=T[15],re=k[0],se=k[1],oe=k[2],le=k[3];return g[0]=re*Z+se*ot+oe*Lt+le*Ut,g[1]=re*st+se*mt+oe*Dt+le*Ft,g[2]=re*ft+se*Tt+oe*Nt+le*Jt,g[3]=re*pt+se*Pt+oe*Yt+le*ee,re=k[4],se=k[5],oe=k[6],le=k[7],g[4]=re*Z+se*ot+oe*Lt+le*Ut,g[5]=re*st+se*mt+oe*Dt+le*Ft,g[6]=re*ft+se*Tt+oe*Nt+le*Jt,g[7]=re*pt+se*Pt+oe*Yt+le*ee,re=k[8],se=k[9],oe=k[10],le=k[11],g[8]=re*Z+se*ot+oe*Lt+le*Ut,g[9]=re*st+se*mt+oe*Dt+le*Ft,g[10]=re*ft+se*Tt+oe*Nt+le*Jt,g[11]=re*pt+se*Pt+oe*Yt+le*ee,re=k[12],se=k[13],oe=k[14],le=k[15],g[12]=re*Z+se*ot+oe*Lt+le*Ut,g[13]=re*st+se*mt+oe*Dt+le*Ft,g[14]=re*ft+se*Tt+oe*Nt+le*Jt,g[15]=re*pt+se*Pt+oe*Yt+le*ee,g;}function X(g,T,k){var Z=k[0],st=k[1],ft=k[2],pt,ot,mt,Tt,Pt,Lt,Dt,Nt,Yt,Ut,Ft,Jt;return T===g?(g[12]=T[0]*Z+T[4]*st+T[8]*ft+T[12],g[13]=T[1]*Z+T[5]*st+T[9]*ft+T[13],g[14]=T[2]*Z+T[6]*st+T[10]*ft+T[14],g[15]=T[3]*Z+T[7]*st+T[11]*ft+T[15]):(pt=T[0],ot=T[1],mt=T[2],Tt=T[3],Pt=T[4],Lt=T[5],Dt=T[6],Nt=T[7],Yt=T[8],Ut=T[9],Ft=T[10],Jt=T[11],g[0]=pt,g[1]=ot,g[2]=mt,g[3]=Tt,g[4]=Pt,g[5]=Lt,g[6]=Dt,g[7]=Nt,g[8]=Yt,g[9]=Ut,g[10]=Ft,g[11]=Jt,g[12]=pt*Z+Pt*st+Yt*ft+T[12],g[13]=ot*Z+Lt*st+Ut*ft+T[13],g[14]=mt*Z+Dt*st+Ft*ft+T[14],g[15]=Tt*Z+Nt*st+Jt*ft+T[15]),g;}function Y(g,T,k){var Z=k[0],st=k[1],ft=k[2];return g[0]=T[0]*Z,g[1]=T[1]*Z,g[2]=T[2]*Z,g[3]=T[3]*Z,g[4]=T[4]*st,g[5]=T[5]*st,g[6]=T[6]*st,g[7]=T[7]*st,g[8]=T[8]*ft,g[9]=T[9]*ft,g[10]=T[10]*ft,g[11]=T[11]*ft,g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15],g;}function et(g,T,k,Z){var st=Z[0],ft=Z[1],pt=Z[2],ot=Math.hypot(st,ft,pt),mt,Tt,Pt,Lt,Dt,Nt,Yt,Ut,Ft,Jt,ee,re,se,oe,le,Re,Oe,ke,Be,Ge,He,je,ye,lr;return ot<s.EPSILON?null:(ot=1/ot,st*=ot,ft*=ot,pt*=ot,mt=Math.sin(k),Tt=Math.cos(k),Pt=1-Tt,Lt=T[0],Dt=T[1],Nt=T[2],Yt=T[3],Ut=T[4],Ft=T[5],Jt=T[6],ee=T[7],re=T[8],se=T[9],oe=T[10],le=T[11],Re=st*st*Pt+Tt,Oe=ft*st*Pt+pt*mt,ke=pt*st*Pt-ft*mt,Be=st*ft*Pt-pt*mt,Ge=ft*ft*Pt+Tt,He=pt*ft*Pt+st*mt,je=st*pt*Pt+ft*mt,ye=ft*pt*Pt-st*mt,lr=pt*pt*Pt+Tt,g[0]=Lt*Re+Ut*Oe+re*ke,g[1]=Dt*Re+Ft*Oe+se*ke,g[2]=Nt*Re+Jt*Oe+oe*ke,g[3]=Yt*Re+ee*Oe+le*ke,g[4]=Lt*Be+Ut*Ge+re*He,g[5]=Dt*Be+Ft*Ge+se*He,g[6]=Nt*Be+Jt*Ge+oe*He,g[7]=Yt*Be+ee*Ge+le*He,g[8]=Lt*je+Ut*ye+re*lr,g[9]=Dt*je+Ft*ye+se*lr,g[10]=Nt*je+Jt*ye+oe*lr,g[11]=Yt*je+ee*ye+le*lr,T!==g&&(g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g);}function A(g,T,k){var Z=Math.sin(k),st=Math.cos(k),ft=T[4],pt=T[5],ot=T[6],mt=T[7],Tt=T[8],Pt=T[9],Lt=T[10],Dt=T[11];return T!==g&&(g[0]=T[0],g[1]=T[1],g[2]=T[2],g[3]=T[3],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g[4]=ft*st+Tt*Z,g[5]=pt*st+Pt*Z,g[6]=ot*st+Lt*Z,g[7]=mt*st+Dt*Z,g[8]=Tt*st-ft*Z,g[9]=Pt*st-pt*Z,g[10]=Lt*st-ot*Z,g[11]=Dt*st-mt*Z,g;}function w(g,T,k){var Z=Math.sin(k),st=Math.cos(k),ft=T[0],pt=T[1],ot=T[2],mt=T[3],Tt=T[8],Pt=T[9],Lt=T[10],Dt=T[11];return T!==g&&(g[4]=T[4],g[5]=T[5],g[6]=T[6],g[7]=T[7],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g[0]=ft*st-Tt*Z,g[1]=pt*st-Pt*Z,g[2]=ot*st-Lt*Z,g[3]=mt*st-Dt*Z,g[8]=ft*Z+Tt*st,g[9]=pt*Z+Pt*st,g[10]=ot*Z+Lt*st,g[11]=mt*Z+Dt*st,g;}function S(g,T,k){var Z=Math.sin(k),st=Math.cos(k),ft=T[0],pt=T[1],ot=T[2],mt=T[3],Tt=T[4],Pt=T[5],Lt=T[6],Dt=T[7];return T!==g&&(g[8]=T[8],g[9]=T[9],g[10]=T[10],g[11]=T[11],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g[0]=ft*st+Tt*Z,g[1]=pt*st+Pt*Z,g[2]=ot*st+Lt*Z,g[3]=mt*st+Dt*Z,g[4]=Tt*st-ft*Z,g[5]=Pt*st-pt*Z,g[6]=Lt*st-ot*Z,g[7]=Dt*st-mt*Z,g;}function x(g,T){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=T[0],g[13]=T[1],g[14]=T[2],g[15]=1,g;}function P(g,T){return g[0]=T[0],g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=T[1],g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=T[2],g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function z(g,T,k){var Z=k[0],st=k[1],ft=k[2],pt=Math.hypot(Z,st,ft),ot,mt,Tt;return pt<s.EPSILON?null:(pt=1/pt,Z*=pt,st*=pt,ft*=pt,ot=Math.sin(T),mt=Math.cos(T),Tt=1-mt,g[0]=Z*Z*Tt+mt,g[1]=st*Z*Tt+ft*ot,g[2]=ft*Z*Tt-st*ot,g[3]=0,g[4]=Z*st*Tt-ft*ot,g[5]=st*st*Tt+mt,g[6]=ft*st*Tt+Z*ot,g[7]=0,g[8]=Z*ft*Tt+st*ot,g[9]=st*ft*Tt-Z*ot,g[10]=ft*ft*Tt+mt,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g);}function U(g,T){var k=Math.sin(T),Z=Math.cos(T);return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=Z,g[6]=k,g[7]=0,g[8]=0,g[9]=-k,g[10]=Z,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function K(g,T){var k=Math.sin(T),Z=Math.cos(T);return g[0]=Z,g[1]=0,g[2]=-k,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=k,g[9]=0,g[10]=Z,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function j(g,T){var k=Math.sin(T),Z=Math.cos(T);return g[0]=Z,g[1]=k,g[2]=0,g[3]=0,g[4]=-k,g[5]=Z,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function nt(g,T,k){var Z=T[0],st=T[1],ft=T[2],pt=T[3],ot=Z+Z,mt=st+st,Tt=ft+ft,Pt=Z*ot,Lt=Z*mt,Dt=Z*Tt,Nt=st*mt,Yt=st*Tt,Ut=ft*Tt,Ft=pt*ot,Jt=pt*mt,ee=pt*Tt;return g[0]=1-(Nt+Ut),g[1]=Lt+ee,g[2]=Dt-Jt,g[3]=0,g[4]=Lt-ee,g[5]=1-(Pt+Ut),g[6]=Yt+Ft,g[7]=0,g[8]=Dt+Jt,g[9]=Yt-Ft,g[10]=1-(Pt+Nt),g[11]=0,g[12]=k[0],g[13]=k[1],g[14]=k[2],g[15]=1,g;}function ct(g,T){var k=new s.ARRAY_TYPE(3),Z=-T[0],st=-T[1],ft=-T[2],pt=T[3],ot=T[4],mt=T[5],Tt=T[6],Pt=T[7],Lt=Z*Z+st*st+ft*ft+pt*pt;return Lt>0?(k[0]=(ot*pt+Pt*Z+mt*ft-Tt*st)*2/Lt,k[1]=(mt*pt+Pt*st+Tt*Z-ot*ft)*2/Lt,k[2]=(Tt*pt+Pt*ft+ot*st-mt*Z)*2/Lt):(k[0]=(ot*pt+Pt*Z+mt*ft-Tt*st)*2,k[1]=(mt*pt+Pt*st+Tt*Z-ot*ft)*2,k[2]=(Tt*pt+Pt*ft+ot*st-mt*Z)*2),nt(g,T,k),g;}function B(g,T){return g[0]=T[12],g[1]=T[13],g[2]=T[14],g;}function N(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[4],pt=T[5],ot=T[6],mt=T[8],Tt=T[9],Pt=T[10];return g[0]=Math.hypot(k,Z,st),g[1]=Math.hypot(ft,pt,ot),g[2]=Math.hypot(mt,Tt,Pt),g;}function G(g,T){var k=new s.ARRAY_TYPE(3);N(k,T);var Z=1/k[0],st=1/k[1],ft=1/k[2],pt=T[0]*Z,ot=T[1]*st,mt=T[2]*ft,Tt=T[4]*Z,Pt=T[5]*st,Lt=T[6]*ft,Dt=T[8]*Z,Nt=T[9]*st,Yt=T[10]*ft,Ut=pt+Pt+Yt,Ft=0;return Ut>0?(Ft=Math.sqrt(Ut+1)*2,g[3]=0.25*Ft,g[0]=(Lt-Nt)/Ft,g[1]=(Dt-mt)/Ft,g[2]=(ot-Tt)/Ft):pt>Pt&&pt>Yt?(Ft=Math.sqrt(1+pt-Pt-Yt)*2,g[3]=(Lt-Nt)/Ft,g[0]=0.25*Ft,g[1]=(ot+Tt)/Ft,g[2]=(Dt+mt)/Ft):Pt>Yt?(Ft=Math.sqrt(1+Pt-pt-Yt)*2,g[3]=(Dt-mt)/Ft,g[0]=(ot+Tt)/Ft,g[1]=0.25*Ft,g[2]=(Lt+Nt)/Ft):(Ft=Math.sqrt(1+Yt-pt-Pt)*2,g[3]=(ot-Tt)/Ft,g[0]=(Dt+mt)/Ft,g[1]=(Lt+Nt)/Ft,g[2]=0.25*Ft),g;}function q(g,T,k,Z){var st=T[0],ft=T[1],pt=T[2],ot=T[3],mt=st+st,Tt=ft+ft,Pt=pt+pt,Lt=st*mt,Dt=st*Tt,Nt=st*Pt,Yt=ft*Tt,Ut=ft*Pt,Ft=pt*Pt,Jt=ot*mt,ee=ot*Tt,re=ot*Pt,se=Z[0],oe=Z[1],le=Z[2];return g[0]=(1-(Yt+Ft))*se,g[1]=(Dt+re)*se,g[2]=(Nt-ee)*se,g[3]=0,g[4]=(Dt-re)*oe,g[5]=(1-(Lt+Ft))*oe,g[6]=(Ut+Jt)*oe,g[7]=0,g[8]=(Nt+ee)*le,g[9]=(Ut-Jt)*le,g[10]=(1-(Lt+Yt))*le,g[11]=0,g[12]=k[0],g[13]=k[1],g[14]=k[2],g[15]=1,g;}function at(g,T,k,Z,st){var ft=T[0],pt=T[1],ot=T[2],mt=T[3],Tt=ft+ft,Pt=pt+pt,Lt=ot+ot,Dt=ft*Tt,Nt=ft*Pt,Yt=ft*Lt,Ut=pt*Pt,Ft=pt*Lt,Jt=ot*Lt,ee=mt*Tt,re=mt*Pt,se=mt*Lt,oe=Z[0],le=Z[1],Re=Z[2],Oe=st[0],ke=st[1],Be=st[2],Ge=(1-(Ut+Jt))*oe,He=(Nt+se)*oe,je=(Yt-re)*oe,ye=(Nt-se)*le,lr=(1-(Dt+Jt))*le,en=(Ft+ee)*le,rn=(Yt+re)*Re,Gn=(Ft-ee)*Re,jn=(1-(Dt+Ut))*Re;return g[0]=Ge,g[1]=He,g[2]=je,g[3]=0,g[4]=ye,g[5]=lr,g[6]=en,g[7]=0,g[8]=rn,g[9]=Gn,g[10]=jn,g[11]=0,g[12]=k[0]+Oe-(Ge*Oe+ye*ke+rn*Be),g[13]=k[1]+ke-(He*Oe+lr*ke+Gn*Be),g[14]=k[2]+Be-(je*Oe+en*ke+jn*Be),g[15]=1,g;}function ut(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[3],pt=k+k,ot=Z+Z,mt=st+st,Tt=k*pt,Pt=Z*pt,Lt=Z*ot,Dt=st*pt,Nt=st*ot,Yt=st*mt,Ut=ft*pt,Ft=ft*ot,Jt=ft*mt;return g[0]=1-Lt-Yt,g[1]=Pt+Jt,g[2]=Dt-Ft,g[3]=0,g[4]=Pt-Jt,g[5]=1-Tt-Yt,g[6]=Nt+Ut,g[7]=0,g[8]=Dt+Ft,g[9]=Nt-Ut,g[10]=1-Tt-Lt,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function Ct(g,T,k,Z,st,ft,pt){var ot=1/(k-T),mt=1/(st-Z),Tt=1/(ft-pt);return g[0]=ft*2*ot,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=ft*2*mt,g[6]=0,g[7]=0,g[8]=(k+T)*ot,g[9]=(st+Z)*mt,g[10]=(pt+ft)*Tt,g[11]=-1,g[12]=0,g[13]=0,g[14]=pt*ft*2*Tt,g[15]=0,g;}function R(g,T,k,Z,st){var ft=1/Math.tan(T/2),pt;return g[0]=ft/k,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=ft,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=-1,g[12]=0,g[13]=0,g[15]=0,st!=null&&st!==1/0?(pt=1/(Z-st),g[10]=(st+Z)*pt,g[14]=2*st*Z*pt):(g[10]=-1,g[14]=-2*Z),g;}function $(g,T,k,Z){var st=Math.tan(T.upDegrees*Math.PI/180),ft=Math.tan(T.downDegrees*Math.PI/180),pt=Math.tan(T.leftDegrees*Math.PI/180),ot=Math.tan(T.rightDegrees*Math.PI/180),mt=2/(pt+ot),Tt=2/(st+ft);return g[0]=mt,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=Tt,g[6]=0,g[7]=0,g[8]=-((pt-ot)*mt*0.5),g[9]=(st-ft)*Tt*0.5,g[10]=Z/(k-Z),g[11]=-1,g[12]=0,g[13]=0,g[14]=Z*k/(k-Z),g[15]=0,g;}function _(g,T,k,Z,st,ft,pt){var ot=1/(T-k),mt=1/(Z-st),Tt=1/(ft-pt);return g[0]=-2*ot,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=-2*mt,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=2*Tt,g[11]=0,g[12]=(T+k)*ot,g[13]=(st+Z)*mt,g[14]=(pt+ft)*Tt,g[15]=1,g;}function H(g,T,k,Z){var st,ft,pt,ot,mt,Tt,Pt,Lt,Dt,Nt,Yt=T[0],Ut=T[1],Ft=T[2],Jt=Z[0],ee=Z[1],re=Z[2],se=k[0],oe=k[1],le=k[2];return Math.abs(Yt-se)<s.EPSILON&&Math.abs(Ut-oe)<s.EPSILON&&Math.abs(Ft-le)<s.EPSILON?p(g):(Pt=Yt-se,Lt=Ut-oe,Dt=Ft-le,Nt=1/Math.hypot(Pt,Lt,Dt),Pt*=Nt,Lt*=Nt,Dt*=Nt,st=ee*Dt-re*Lt,ft=re*Pt-Jt*Dt,pt=Jt*Lt-ee*Pt,Nt=Math.hypot(st,ft,pt),Nt?(Nt=1/Nt,st*=Nt,ft*=Nt,pt*=Nt):(st=0,ft=0,pt=0),ot=Lt*pt-Dt*ft,mt=Dt*st-Pt*pt,Tt=Pt*ft-Lt*st,Nt=Math.hypot(ot,mt,Tt),Nt?(Nt=1/Nt,ot*=Nt,mt*=Nt,Tt*=Nt):(ot=0,mt=0,Tt=0),g[0]=st,g[1]=ot,g[2]=Pt,g[3]=0,g[4]=ft,g[5]=mt,g[6]=Lt,g[7]=0,g[8]=pt,g[9]=Tt,g[10]=Dt,g[11]=0,g[12]=-(st*Yt+ft*Ut+pt*Ft),g[13]=-(ot*Yt+mt*Ut+Tt*Ft),g[14]=-(Pt*Yt+Lt*Ut+Dt*Ft),g[15]=1,g);}function lt(g,T,k,Z){var st=T[0],ft=T[1],pt=T[2],ot=Z[0],mt=Z[1],Tt=Z[2],Pt=st-k[0],Lt=ft-k[1],Dt=pt-k[2],Nt=Pt*Pt+Lt*Lt+Dt*Dt;Nt>0&&(Nt=1/Math.sqrt(Nt),Pt*=Nt,Lt*=Nt,Dt*=Nt);var Yt=mt*Dt-Tt*Lt,Ut=Tt*Pt-ot*Dt,Ft=ot*Lt-mt*Pt;return Nt=Yt*Yt+Ut*Ut+Ft*Ft,Nt>0&&(Nt=1/Math.sqrt(Nt),Yt*=Nt,Ut*=Nt,Ft*=Nt),g[0]=Yt,g[1]=Ut,g[2]=Ft,g[3]=0,g[4]=Lt*Ft-Dt*Ut,g[5]=Dt*Yt-Pt*Ft,g[6]=Pt*Ut-Lt*Yt,g[7]=0,g[8]=Pt,g[9]=Lt,g[10]=Dt,g[11]=0,g[12]=st,g[13]=ft,g[14]=pt,g[15]=1,g;}function dt(g){return"mat4("+g[0]+", "+g[1]+", "+g[2]+", "+g[3]+", "+g[4]+", "+g[5]+", "+g[6]+", "+g[7]+", "+g[8]+", "+g[9]+", "+g[10]+", "+g[11]+", "+g[12]+", "+g[13]+", "+g[14]+", "+g[15]+")";}function wt(g){return Math.hypot(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]);}function Et(g,T,k){return g[0]=T[0]+k[0],g[1]=T[1]+k[1],g[2]=T[2]+k[2],g[3]=T[3]+k[3],g[4]=T[4]+k[4],g[5]=T[5]+k[5],g[6]=T[6]+k[6],g[7]=T[7]+k[7],g[8]=T[8]+k[8],g[9]=T[9]+k[9],g[10]=T[10]+k[10],g[11]=T[11]+k[11],g[12]=T[12]+k[12],g[13]=T[13]+k[13],g[14]=T[14]+k[14],g[15]=T[15]+k[15],g;}function Ot(g,T,k){return g[0]=T[0]-k[0],g[1]=T[1]-k[1],g[2]=T[2]-k[2],g[3]=T[3]-k[3],g[4]=T[4]-k[4],g[5]=T[5]-k[5],g[6]=T[6]-k[6],g[7]=T[7]-k[7],g[8]=T[8]-k[8],g[9]=T[9]-k[9],g[10]=T[10]-k[10],g[11]=T[11]-k[11],g[12]=T[12]-k[12],g[13]=T[13]-k[13],g[14]=T[14]-k[14],g[15]=T[15]-k[15],g;}function O(g,T,k){return g[0]=T[0]*k,g[1]=T[1]*k,g[2]=T[2]*k,g[3]=T[3]*k,g[4]=T[4]*k,g[5]=T[5]*k,g[6]=T[6]*k,g[7]=T[7]*k,g[8]=T[8]*k,g[9]=T[9]*k,g[10]=T[10]*k,g[11]=T[11]*k,g[12]=T[12]*k,g[13]=T[13]*k,g[14]=T[14]*k,g[15]=T[15]*k,g;}function D(g,T,k,Z){return g[0]=T[0]+k[0]*Z,g[1]=T[1]+k[1]*Z,g[2]=T[2]+k[2]*Z,g[3]=T[3]+k[3]*Z,g[4]=T[4]+k[4]*Z,g[5]=T[5]+k[5]*Z,g[6]=T[6]+k[6]*Z,g[7]=T[7]+k[7]*Z,g[8]=T[8]+k[8]*Z,g[9]=T[9]+k[9]*Z,g[10]=T[10]+k[10]*Z,g[11]=T[11]+k[11]*Z,g[12]=T[12]+k[12]*Z,g[13]=T[13]+k[13]*Z,g[14]=T[14]+k[14]*Z,g[15]=T[15]+k[15]*Z,g;}function J(g,T){return g[0]===T[0]&&g[1]===T[1]&&g[2]===T[2]&&g[3]===T[3]&&g[4]===T[4]&&g[5]===T[5]&&g[6]===T[6]&&g[7]===T[7]&&g[8]===T[8]&&g[9]===T[9]&&g[10]===T[10]&&g[11]===T[11]&&g[12]===T[12]&&g[13]===T[13]&&g[14]===T[14]&&g[15]===T[15];}function Q(g,T){var k=g[0],Z=g[1],st=g[2],ft=g[3],pt=g[4],ot=g[5],mt=g[6],Tt=g[7],Pt=g[8],Lt=g[9],Dt=g[10],Nt=g[11],Yt=g[12],Ut=g[13],Ft=g[14],Jt=g[15],ee=T[0],re=T[1],se=T[2],oe=T[3],le=T[4],Re=T[5],Oe=T[6],ke=T[7],Be=T[8],Ge=T[9],He=T[10],je=T[11],ye=T[12],lr=T[13],en=T[14],rn=T[15];return Math.abs(k-ee)<=s.EPSILON*Math.max(1,Math.abs(k),Math.abs(ee))&&Math.abs(Z-re)<=s.EPSILON*Math.max(1,Math.abs(Z),Math.abs(re))&&Math.abs(st-se)<=s.EPSILON*Math.max(1,Math.abs(st),Math.abs(se))&&Math.abs(ft-oe)<=s.EPSILON*Math.max(1,Math.abs(ft),Math.abs(oe))&&Math.abs(pt-le)<=s.EPSILON*Math.max(1,Math.abs(pt),Math.abs(le))&&Math.abs(ot-Re)<=s.EPSILON*Math.max(1,Math.abs(ot),Math.abs(Re))&&Math.abs(mt-Oe)<=s.EPSILON*Math.max(1,Math.abs(mt),Math.abs(Oe))&&Math.abs(Tt-ke)<=s.EPSILON*Math.max(1,Math.abs(Tt),Math.abs(ke))&&Math.abs(Pt-Be)<=s.EPSILON*Math.max(1,Math.abs(Pt),Math.abs(Be))&&Math.abs(Lt-Ge)<=s.EPSILON*Math.max(1,Math.abs(Lt),Math.abs(Ge))&&Math.abs(Dt-He)<=s.EPSILON*Math.max(1,Math.abs(Dt),Math.abs(He))&&Math.abs(Nt-je)<=s.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(je))&&Math.abs(Yt-ye)<=s.EPSILON*Math.max(1,Math.abs(Yt),Math.abs(ye))&&Math.abs(Ut-lr)<=s.EPSILON*Math.max(1,Math.abs(Ut),Math.abs(lr))&&Math.abs(Ft-en)<=s.EPSILON*Math.max(1,Math.abs(Ft),Math.abs(en))&&Math.abs(Jt-rn)<=s.EPSILON*Math.max(1,Math.abs(Jt),Math.abs(rn));}var V=L,tt=Ot;},/* 7 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return h;}),i.d(n,"identity",function(){return v;}),i.d(n,"setAxisAngle",function(){return p;}),i.d(n,"getAxisAngle",function(){return y;}),i.d(n,"getAngle",function(){return C;}),i.d(n,"multiply",function(){return b;}),i.d(n,"rotateX",function(){return M;}),i.d(n,"rotateY",function(){return L;}),i.d(n,"rotateZ",function(){return X;}),i.d(n,"calculateW",function(){return Y;}),i.d(n,"exp",function(){return et;}),i.d(n,"ln",function(){return A;}),i.d(n,"pow",function(){return w;}),i.d(n,"slerp",function(){return S;}),i.d(n,"random",function(){return x;}),i.d(n,"invert",function(){return P;}),i.d(n,"conjugate",function(){return z;}),i.d(n,"fromMat3",function(){return U;}),i.d(n,"fromEuler",function(){return K;}),i.d(n,"str",function(){return j;}),i.d(n,"clone",function(){return nt;}),i.d(n,"fromValues",function(){return ct;}),i.d(n,"copy",function(){return B;}),i.d(n,"set",function(){return N;}),i.d(n,"add",function(){return G;}),i.d(n,"mul",function(){return q;}),i.d(n,"scale",function(){return at;}),i.d(n,"dot",function(){return ut;}),i.d(n,"lerp",function(){return Ct;}),i.d(n,"length",function(){return R;}),i.d(n,"len",function(){return $;}),i.d(n,"squaredLength",function(){return _;}),i.d(n,"sqrLen",function(){return H;}),i.d(n,"normalize",function(){return lt;}),i.d(n,"exactEquals",function(){return dt;}),i.d(n,"equals",function(){return wt;}),i.d(n,"rotationTo",function(){return Et;}),i.d(n,"sqlerp",function(){return Ot;}),i.d(n,"setAxes",function(){return O;});var s=i(2),o=i(5),a=i(8),u=i(9);function h(){var D=new s.ARRAY_TYPE(4);return s.ARRAY_TYPE!=Float32Array&&(D[0]=0,D[1]=0,D[2]=0),D[3]=1,D;}function v(D){return D[0]=0,D[1]=0,D[2]=0,D[3]=1,D;}function p(D,J,Q){Q=Q*0.5;var V=Math.sin(Q);return D[0]=V*J[0],D[1]=V*J[1],D[2]=V*J[2],D[3]=Math.cos(Q),D;}function y(D,J){var Q=Math.acos(J[3])*2,V=Math.sin(Q/2);return V>s.EPSILON?(D[0]=J[0]/V,D[1]=J[1]/V,D[2]=J[2]/V):(D[0]=1,D[1]=0,D[2]=0),Q;}function C(D,J){var Q=ut(D,J);return Math.acos(2*Q*Q-1);}function b(D,J,Q){var V=J[0],tt=J[1],g=J[2],T=J[3],k=Q[0],Z=Q[1],st=Q[2],ft=Q[3];return D[0]=V*ft+T*k+tt*st-g*Z,D[1]=tt*ft+T*Z+g*k-V*st,D[2]=g*ft+T*st+V*Z-tt*k,D[3]=T*ft-V*k-tt*Z-g*st,D;}function M(D,J,Q){Q*=0.5;var V=J[0],tt=J[1],g=J[2],T=J[3],k=Math.sin(Q),Z=Math.cos(Q);return D[0]=V*Z+T*k,D[1]=tt*Z+g*k,D[2]=g*Z-tt*k,D[3]=T*Z-V*k,D;}function L(D,J,Q){Q*=0.5;var V=J[0],tt=J[1],g=J[2],T=J[3],k=Math.sin(Q),Z=Math.cos(Q);return D[0]=V*Z-g*k,D[1]=tt*Z+T*k,D[2]=g*Z+V*k,D[3]=T*Z-tt*k,D;}function X(D,J,Q){Q*=0.5;var V=J[0],tt=J[1],g=J[2],T=J[3],k=Math.sin(Q),Z=Math.cos(Q);return D[0]=V*Z+tt*k,D[1]=tt*Z-V*k,D[2]=g*Z+T*k,D[3]=T*Z-g*k,D;}function Y(D,J){var Q=J[0],V=J[1],tt=J[2];return D[0]=Q,D[1]=V,D[2]=tt,D[3]=Math.sqrt(Math.abs(1-Q*Q-V*V-tt*tt)),D;}function et(D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=Math.sqrt(Q*Q+V*V+tt*tt),k=Math.exp(g),Z=T>0?k*Math.sin(T)/T:0;return D[0]=Q*Z,D[1]=V*Z,D[2]=tt*Z,D[3]=k*Math.cos(T),D;}function A(D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=Math.sqrt(Q*Q+V*V+tt*tt),k=T>0?Math.atan2(T,g)/T:0;return D[0]=Q*k,D[1]=V*k,D[2]=tt*k,D[3]=0.5*Math.log(Q*Q+V*V+tt*tt+g*g),D;}function w(D,J,Q){return A(D,J),at(D,D,Q),et(D,D),D;}function S(D,J,Q,V){var tt=J[0],g=J[1],T=J[2],k=J[3],Z=Q[0],st=Q[1],ft=Q[2],pt=Q[3],ot,mt,Tt,Pt,Lt;return mt=tt*Z+g*st+T*ft+k*pt,mt<0&&(mt=-mt,Z=-Z,st=-st,ft=-ft,pt=-pt),1-mt>s.EPSILON?(ot=Math.acos(mt),Tt=Math.sin(ot),Pt=Math.sin((1-V)*ot)/Tt,Lt=Math.sin(V*ot)/Tt):(Pt=1-V,Lt=V),D[0]=Pt*tt+Lt*Z,D[1]=Pt*g+Lt*st,D[2]=Pt*T+Lt*ft,D[3]=Pt*k+Lt*pt,D;}function x(D){var J=s.RANDOM(),Q=s.RANDOM(),V=s.RANDOM(),tt=Math.sqrt(1-J),g=Math.sqrt(J);return D[0]=tt*Math.sin(2*Math.PI*Q),D[1]=tt*Math.cos(2*Math.PI*Q),D[2]=g*Math.sin(2*Math.PI*V),D[3]=g*Math.cos(2*Math.PI*V),D;}function P(D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=Q*Q+V*V+tt*tt+g*g,k=T?1/T:0;return D[0]=-Q*k,D[1]=-V*k,D[2]=-tt*k,D[3]=g*k,D;}function z(D,J){return D[0]=-J[0],D[1]=-J[1],D[2]=-J[2],D[3]=J[3],D;}function U(D,J){var Q=J[0]+J[4]+J[8],V;if(Q>0)V=Math.sqrt(Q+1),D[3]=0.5*V,V=0.5/V,D[0]=(J[5]-J[7])*V,D[1]=(J[6]-J[2])*V,D[2]=(J[1]-J[3])*V;else{var tt=0;J[4]>J[0]&&(tt=1),J[8]>J[tt*3+tt]&&(tt=2);var g=(tt+1)%3,T=(tt+2)%3;V=Math.sqrt(J[tt*3+tt]-J[g*3+g]-J[T*3+T]+1),D[tt]=0.5*V,V=0.5/V,D[3]=(J[g*3+T]-J[T*3+g])*V,D[g]=(J[g*3+tt]+J[tt*3+g])*V,D[T]=(J[T*3+tt]+J[tt*3+T])*V;}return D;}function K(D,J,Q,V){var tt=0.5*Math.PI/180;J*=tt,Q*=tt,V*=tt;var g=Math.sin(J),T=Math.cos(J),k=Math.sin(Q),Z=Math.cos(Q),st=Math.sin(V),ft=Math.cos(V);return D[0]=g*Z*ft-T*k*st,D[1]=T*k*ft+g*Z*st,D[2]=T*Z*st-g*k*ft,D[3]=T*Z*ft+g*k*st,D;}function j(D){return"quat("+D[0]+", "+D[1]+", "+D[2]+", "+D[3]+")";}var nt=u.clone,ct=u.fromValues,B=u.copy,N=u.set,G=u.add,q=b,at=u.scale,ut=u.dot,Ct=u.lerp,R=u.length,$=R,_=u.squaredLength,H=_,lt=u.normalize,dt=u.exactEquals,wt=u.equals,Et=function(){var D=a.create(),J=a.fromValues(1,0,0),Q=a.fromValues(0,1,0);return function(V,tt,g){var T=a.dot(tt,g);return T<-0.999999?(a.cross(D,J,tt),a.len(D)<1e-6&&a.cross(D,Q,tt),a.normalize(D,D),p(V,D,Math.PI),V):T>0.999999?(V[0]=0,V[1]=0,V[2]=0,V[3]=1,V):(a.cross(D,tt,g),V[0]=D[0],V[1]=D[1],V[2]=D[2],V[3]=1+T,lt(V,V));};}(),Ot=function(){var D=h(),J=h();return function(Q,V,tt,g,T,k){return S(D,V,T,k),S(J,tt,g,k),S(Q,D,J,2*k*(1-k)),Q;};}(),O=function(){var D=o.create();return function(J,Q,V,tt){return D[0]=V[0],D[3]=V[1],D[6]=V[2],D[1]=tt[0],D[4]=tt[1],D[7]=tt[2],D[2]=-Q[0],D[5]=-Q[1],D[8]=-Q[2],lt(J,U(J,D));};}();},/* 8 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"length",function(){return u;}),i.d(n,"fromValues",function(){return h;}),i.d(n,"copy",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"add",function(){return y;}),i.d(n,"subtract",function(){return C;}),i.d(n,"multiply",function(){return b;}),i.d(n,"divide",function(){return M;}),i.d(n,"ceil",function(){return L;}),i.d(n,"floor",function(){return X;}),i.d(n,"min",function(){return Y;}),i.d(n,"max",function(){return et;}),i.d(n,"round",function(){return A;}),i.d(n,"scale",function(){return w;}),i.d(n,"scaleAndAdd",function(){return S;}),i.d(n,"distance",function(){return x;}),i.d(n,"squaredDistance",function(){return P;}),i.d(n,"squaredLength",function(){return z;}),i.d(n,"negate",function(){return U;}),i.d(n,"inverse",function(){return K;}),i.d(n,"normalize",function(){return j;}),i.d(n,"dot",function(){return nt;}),i.d(n,"cross",function(){return ct;}),i.d(n,"lerp",function(){return B;}),i.d(n,"hermite",function(){return N;}),i.d(n,"bezier",function(){return G;}),i.d(n,"random",function(){return q;}),i.d(n,"transformMat4",function(){return at;}),i.d(n,"transformMat3",function(){return ut;}),i.d(n,"transformQuat",function(){return Ct;}),i.d(n,"rotateX",function(){return R;}),i.d(n,"rotateY",function(){return $;}),i.d(n,"rotateZ",function(){return _;}),i.d(n,"angle",function(){return H;}),i.d(n,"zero",function(){return lt;}),i.d(n,"str",function(){return dt;}),i.d(n,"exactEquals",function(){return wt;}),i.d(n,"equals",function(){return Et;}),i.d(n,"sub",function(){return Ot;}),i.d(n,"mul",function(){return O;}),i.d(n,"div",function(){return D;}),i.d(n,"dist",function(){return J;}),i.d(n,"sqrDist",function(){return Q;}),i.d(n,"len",function(){return V;}),i.d(n,"sqrLen",function(){return tt;}),i.d(n,"forEach",function(){return g;});var s=i(2);function o(){var T=new s.ARRAY_TYPE(3);return s.ARRAY_TYPE!=Float32Array&&(T[0]=0,T[1]=0,T[2]=0),T;}function a(T){var k=new s.ARRAY_TYPE(3);return k[0]=T[0],k[1]=T[1],k[2]=T[2],k;}function u(T){var k=T[0],Z=T[1],st=T[2];return Math.hypot(k,Z,st);}function h(T,k,Z){var st=new s.ARRAY_TYPE(3);return st[0]=T,st[1]=k,st[2]=Z,st;}function v(T,k){return T[0]=k[0],T[1]=k[1],T[2]=k[2],T;}function p(T,k,Z,st){return T[0]=k,T[1]=Z,T[2]=st,T;}function y(T,k,Z){return T[0]=k[0]+Z[0],T[1]=k[1]+Z[1],T[2]=k[2]+Z[2],T;}function C(T,k,Z){return T[0]=k[0]-Z[0],T[1]=k[1]-Z[1],T[2]=k[2]-Z[2],T;}function b(T,k,Z){return T[0]=k[0]*Z[0],T[1]=k[1]*Z[1],T[2]=k[2]*Z[2],T;}function M(T,k,Z){return T[0]=k[0]/Z[0],T[1]=k[1]/Z[1],T[2]=k[2]/Z[2],T;}function L(T,k){return T[0]=Math.ceil(k[0]),T[1]=Math.ceil(k[1]),T[2]=Math.ceil(k[2]),T;}function X(T,k){return T[0]=Math.floor(k[0]),T[1]=Math.floor(k[1]),T[2]=Math.floor(k[2]),T;}function Y(T,k,Z){return T[0]=Math.min(k[0],Z[0]),T[1]=Math.min(k[1],Z[1]),T[2]=Math.min(k[2],Z[2]),T;}function et(T,k,Z){return T[0]=Math.max(k[0],Z[0]),T[1]=Math.max(k[1],Z[1]),T[2]=Math.max(k[2],Z[2]),T;}function A(T,k){return T[0]=Math.round(k[0]),T[1]=Math.round(k[1]),T[2]=Math.round(k[2]),T;}function w(T,k,Z){return T[0]=k[0]*Z,T[1]=k[1]*Z,T[2]=k[2]*Z,T;}function S(T,k,Z,st){return T[0]=k[0]+Z[0]*st,T[1]=k[1]+Z[1]*st,T[2]=k[2]+Z[2]*st,T;}function x(T,k){var Z=k[0]-T[0],st=k[1]-T[1],ft=k[2]-T[2];return Math.hypot(Z,st,ft);}function P(T,k){var Z=k[0]-T[0],st=k[1]-T[1],ft=k[2]-T[2];return Z*Z+st*st+ft*ft;}function z(T){var k=T[0],Z=T[1],st=T[2];return k*k+Z*Z+st*st;}function U(T,k){return T[0]=-k[0],T[1]=-k[1],T[2]=-k[2],T;}function K(T,k){return T[0]=1/k[0],T[1]=1/k[1],T[2]=1/k[2],T;}function j(T,k){var Z=k[0],st=k[1],ft=k[2],pt=Z*Z+st*st+ft*ft;return pt>0&&(pt=1/Math.sqrt(pt)),T[0]=k[0]*pt,T[1]=k[1]*pt,T[2]=k[2]*pt,T;}function nt(T,k){return T[0]*k[0]+T[1]*k[1]+T[2]*k[2];}function ct(T,k,Z){var st=k[0],ft=k[1],pt=k[2],ot=Z[0],mt=Z[1],Tt=Z[2];return T[0]=ft*Tt-pt*mt,T[1]=pt*ot-st*Tt,T[2]=st*mt-ft*ot,T;}function B(T,k,Z,st){var ft=k[0],pt=k[1],ot=k[2];return T[0]=ft+st*(Z[0]-ft),T[1]=pt+st*(Z[1]-pt),T[2]=ot+st*(Z[2]-ot),T;}function N(T,k,Z,st,ft,pt){var ot=pt*pt,mt=ot*(2*pt-3)+1,Tt=ot*(pt-2)+pt,Pt=ot*(pt-1),Lt=ot*(3-2*pt);return T[0]=k[0]*mt+Z[0]*Tt+st[0]*Pt+ft[0]*Lt,T[1]=k[1]*mt+Z[1]*Tt+st[1]*Pt+ft[1]*Lt,T[2]=k[2]*mt+Z[2]*Tt+st[2]*Pt+ft[2]*Lt,T;}function G(T,k,Z,st,ft,pt){var ot=1-pt,mt=ot*ot,Tt=pt*pt,Pt=mt*ot,Lt=3*pt*mt,Dt=3*Tt*ot,Nt=Tt*pt;return T[0]=k[0]*Pt+Z[0]*Lt+st[0]*Dt+ft[0]*Nt,T[1]=k[1]*Pt+Z[1]*Lt+st[1]*Dt+ft[1]*Nt,T[2]=k[2]*Pt+Z[2]*Lt+st[2]*Dt+ft[2]*Nt,T;}function q(T,k){k=k||1;var Z=s.RANDOM()*2*Math.PI,st=s.RANDOM()*2-1,ft=Math.sqrt(1-st*st)*k;return T[0]=Math.cos(Z)*ft,T[1]=Math.sin(Z)*ft,T[2]=st*k,T;}function at(T,k,Z){var st=k[0],ft=k[1],pt=k[2],ot=Z[3]*st+Z[7]*ft+Z[11]*pt+Z[15];return ot=ot||1,T[0]=(Z[0]*st+Z[4]*ft+Z[8]*pt+Z[12])/ot,T[1]=(Z[1]*st+Z[5]*ft+Z[9]*pt+Z[13])/ot,T[2]=(Z[2]*st+Z[6]*ft+Z[10]*pt+Z[14])/ot,T;}function ut(T,k,Z){var st=k[0],ft=k[1],pt=k[2];return T[0]=st*Z[0]+ft*Z[3]+pt*Z[6],T[1]=st*Z[1]+ft*Z[4]+pt*Z[7],T[2]=st*Z[2]+ft*Z[5]+pt*Z[8],T;}function Ct(T,k,Z){var st=Z[0],ft=Z[1],pt=Z[2],ot=Z[3],mt=k[0],Tt=k[1],Pt=k[2],Lt=ft*Pt-pt*Tt,Dt=pt*mt-st*Pt,Nt=st*Tt-ft*mt,Yt=ft*Nt-pt*Dt,Ut=pt*Lt-st*Nt,Ft=st*Dt-ft*Lt,Jt=ot*2;return Lt*=Jt,Dt*=Jt,Nt*=Jt,Yt*=2,Ut*=2,Ft*=2,T[0]=mt+Lt+Yt,T[1]=Tt+Dt+Ut,T[2]=Pt+Nt+Ft,T;}function R(T,k,Z,st){var ft=[],pt=[];return ft[0]=k[0]-Z[0],ft[1]=k[1]-Z[1],ft[2]=k[2]-Z[2],pt[0]=ft[0],pt[1]=ft[1]*Math.cos(st)-ft[2]*Math.sin(st),pt[2]=ft[1]*Math.sin(st)+ft[2]*Math.cos(st),T[0]=pt[0]+Z[0],T[1]=pt[1]+Z[1],T[2]=pt[2]+Z[2],T;}function $(T,k,Z,st){var ft=[],pt=[];return ft[0]=k[0]-Z[0],ft[1]=k[1]-Z[1],ft[2]=k[2]-Z[2],pt[0]=ft[2]*Math.sin(st)+ft[0]*Math.cos(st),pt[1]=ft[1],pt[2]=ft[2]*Math.cos(st)-ft[0]*Math.sin(st),T[0]=pt[0]+Z[0],T[1]=pt[1]+Z[1],T[2]=pt[2]+Z[2],T;}function _(T,k,Z,st){var ft=[],pt=[];return ft[0]=k[0]-Z[0],ft[1]=k[1]-Z[1],ft[2]=k[2]-Z[2],pt[0]=ft[0]*Math.cos(st)-ft[1]*Math.sin(st),pt[1]=ft[0]*Math.sin(st)+ft[1]*Math.cos(st),pt[2]=ft[2],T[0]=pt[0]+Z[0],T[1]=pt[1]+Z[1],T[2]=pt[2]+Z[2],T;}function H(T,k){var Z=T[0],st=T[1],ft=T[2],pt=k[0],ot=k[1],mt=k[2],Tt=Math.sqrt(Z*Z+st*st+ft*ft),Pt=Math.sqrt(pt*pt+ot*ot+mt*mt),Lt=Tt*Pt,Dt=Lt&&nt(T,k)/Lt;return Math.acos(Math.min(Math.max(Dt,-1),1));}function lt(T){return T[0]=0,T[1]=0,T[2]=0,T;}function dt(T){return"vec3("+T[0]+", "+T[1]+", "+T[2]+")";}function wt(T,k){return T[0]===k[0]&&T[1]===k[1]&&T[2]===k[2];}function Et(T,k){var Z=T[0],st=T[1],ft=T[2],pt=k[0],ot=k[1],mt=k[2];return Math.abs(Z-pt)<=s.EPSILON*Math.max(1,Math.abs(Z),Math.abs(pt))&&Math.abs(st-ot)<=s.EPSILON*Math.max(1,Math.abs(st),Math.abs(ot))&&Math.abs(ft-mt)<=s.EPSILON*Math.max(1,Math.abs(ft),Math.abs(mt));}var Ot=C,O=b,D=M,J=x,Q=P,V=u,tt=z,g=function(){var T=o();return function(k,Z,st,ft,pt,ot){var mt,Tt;for(Z||(Z=3),st||(st=0),ft?Tt=Math.min(ft*Z+st,k.length):Tt=k.length,mt=st;mt<Tt;mt+=Z)T[0]=k[mt],T[1]=k[mt+1],T[2]=k[mt+2],pt(T,T,ot),k[mt]=T[0],k[mt+1]=T[1],k[mt+2]=T[2];return k;};}();},/* 9 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"fromValues",function(){return u;}),i.d(n,"copy",function(){return h;}),i.d(n,"set",function(){return v;}),i.d(n,"add",function(){return p;}),i.d(n,"subtract",function(){return y;}),i.d(n,"multiply",function(){return C;}),i.d(n,"divide",function(){return b;}),i.d(n,"ceil",function(){return M;}),i.d(n,"floor",function(){return L;}),i.d(n,"min",function(){return X;}),i.d(n,"max",function(){return Y;}),i.d(n,"round",function(){return et;}),i.d(n,"scale",function(){return A;}),i.d(n,"scaleAndAdd",function(){return w;}),i.d(n,"distance",function(){return S;}),i.d(n,"squaredDistance",function(){return x;}),i.d(n,"length",function(){return P;}),i.d(n,"squaredLength",function(){return z;}),i.d(n,"negate",function(){return U;}),i.d(n,"inverse",function(){return K;}),i.d(n,"normalize",function(){return j;}),i.d(n,"dot",function(){return nt;}),i.d(n,"cross",function(){return ct;}),i.d(n,"lerp",function(){return B;}),i.d(n,"random",function(){return N;}),i.d(n,"transformMat4",function(){return G;}),i.d(n,"transformQuat",function(){return q;}),i.d(n,"zero",function(){return at;}),i.d(n,"str",function(){return ut;}),i.d(n,"exactEquals",function(){return Ct;}),i.d(n,"equals",function(){return R;}),i.d(n,"sub",function(){return $;}),i.d(n,"mul",function(){return _;}),i.d(n,"div",function(){return H;}),i.d(n,"dist",function(){return lt;}),i.d(n,"sqrDist",function(){return dt;}),i.d(n,"len",function(){return wt;}),i.d(n,"sqrLen",function(){return Et;}),i.d(n,"forEach",function(){return Ot;});var s=i(2);function o(){var O=new s.ARRAY_TYPE(4);return s.ARRAY_TYPE!=Float32Array&&(O[0]=0,O[1]=0,O[2]=0,O[3]=0),O;}function a(O){var D=new s.ARRAY_TYPE(4);return D[0]=O[0],D[1]=O[1],D[2]=O[2],D[3]=O[3],D;}function u(O,D,J,Q){var V=new s.ARRAY_TYPE(4);return V[0]=O,V[1]=D,V[2]=J,V[3]=Q,V;}function h(O,D){return O[0]=D[0],O[1]=D[1],O[2]=D[2],O[3]=D[3],O;}function v(O,D,J,Q,V){return O[0]=D,O[1]=J,O[2]=Q,O[3]=V,O;}function p(O,D,J){return O[0]=D[0]+J[0],O[1]=D[1]+J[1],O[2]=D[2]+J[2],O[3]=D[3]+J[3],O;}function y(O,D,J){return O[0]=D[0]-J[0],O[1]=D[1]-J[1],O[2]=D[2]-J[2],O[3]=D[3]-J[3],O;}function C(O,D,J){return O[0]=D[0]*J[0],O[1]=D[1]*J[1],O[2]=D[2]*J[2],O[3]=D[3]*J[3],O;}function b(O,D,J){return O[0]=D[0]/J[0],O[1]=D[1]/J[1],O[2]=D[2]/J[2],O[3]=D[3]/J[3],O;}function M(O,D){return O[0]=Math.ceil(D[0]),O[1]=Math.ceil(D[1]),O[2]=Math.ceil(D[2]),O[3]=Math.ceil(D[3]),O;}function L(O,D){return O[0]=Math.floor(D[0]),O[1]=Math.floor(D[1]),O[2]=Math.floor(D[2]),O[3]=Math.floor(D[3]),O;}function X(O,D,J){return O[0]=Math.min(D[0],J[0]),O[1]=Math.min(D[1],J[1]),O[2]=Math.min(D[2],J[2]),O[3]=Math.min(D[3],J[3]),O;}function Y(O,D,J){return O[0]=Math.max(D[0],J[0]),O[1]=Math.max(D[1],J[1]),O[2]=Math.max(D[2],J[2]),O[3]=Math.max(D[3],J[3]),O;}function et(O,D){return O[0]=Math.round(D[0]),O[1]=Math.round(D[1]),O[2]=Math.round(D[2]),O[3]=Math.round(D[3]),O;}function A(O,D,J){return O[0]=D[0]*J,O[1]=D[1]*J,O[2]=D[2]*J,O[3]=D[3]*J,O;}function w(O,D,J,Q){return O[0]=D[0]+J[0]*Q,O[1]=D[1]+J[1]*Q,O[2]=D[2]+J[2]*Q,O[3]=D[3]+J[3]*Q,O;}function S(O,D){var J=D[0]-O[0],Q=D[1]-O[1],V=D[2]-O[2],tt=D[3]-O[3];return Math.hypot(J,Q,V,tt);}function x(O,D){var J=D[0]-O[0],Q=D[1]-O[1],V=D[2]-O[2],tt=D[3]-O[3];return J*J+Q*Q+V*V+tt*tt;}function P(O){var D=O[0],J=O[1],Q=O[2],V=O[3];return Math.hypot(D,J,Q,V);}function z(O){var D=O[0],J=O[1],Q=O[2],V=O[3];return D*D+J*J+Q*Q+V*V;}function U(O,D){return O[0]=-D[0],O[1]=-D[1],O[2]=-D[2],O[3]=-D[3],O;}function K(O,D){return O[0]=1/D[0],O[1]=1/D[1],O[2]=1/D[2],O[3]=1/D[3],O;}function j(O,D){var J=D[0],Q=D[1],V=D[2],tt=D[3],g=J*J+Q*Q+V*V+tt*tt;return g>0&&(g=1/Math.sqrt(g)),O[0]=J*g,O[1]=Q*g,O[2]=V*g,O[3]=tt*g,O;}function nt(O,D){return O[0]*D[0]+O[1]*D[1]+O[2]*D[2]+O[3]*D[3];}function ct(O,D,J,Q){var V=J[0]*Q[1]-J[1]*Q[0],tt=J[0]*Q[2]-J[2]*Q[0],g=J[0]*Q[3]-J[3]*Q[0],T=J[1]*Q[2]-J[2]*Q[1],k=J[1]*Q[3]-J[3]*Q[1],Z=J[2]*Q[3]-J[3]*Q[2],st=D[0],ft=D[1],pt=D[2],ot=D[3];return O[0]=ft*Z-pt*k+ot*T,O[1]=-(st*Z)+pt*g-ot*tt,O[2]=st*k-ft*g+ot*V,O[3]=-(st*T)+ft*tt-pt*V,O;}function B(O,D,J,Q){var V=D[0],tt=D[1],g=D[2],T=D[3];return O[0]=V+Q*(J[0]-V),O[1]=tt+Q*(J[1]-tt),O[2]=g+Q*(J[2]-g),O[3]=T+Q*(J[3]-T),O;}function N(O,D){D=D||1;var J,Q,V,tt,g,T;do J=s.RANDOM()*2-1,Q=s.RANDOM()*2-1,g=J*J+Q*Q;while(g>=1);do V=s.RANDOM()*2-1,tt=s.RANDOM()*2-1,T=V*V+tt*tt;while(T>=1);var k=Math.sqrt((1-g)/T);return O[0]=D*J,O[1]=D*Q,O[2]=D*V*k,O[3]=D*tt*k,O;}function G(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3];return O[0]=J[0]*Q+J[4]*V+J[8]*tt+J[12]*g,O[1]=J[1]*Q+J[5]*V+J[9]*tt+J[13]*g,O[2]=J[2]*Q+J[6]*V+J[10]*tt+J[14]*g,O[3]=J[3]*Q+J[7]*V+J[11]*tt+J[15]*g,O;}function q(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=J[0],T=J[1],k=J[2],Z=J[3],st=Z*Q+T*tt-k*V,ft=Z*V+k*Q-g*tt,pt=Z*tt+g*V-T*Q,ot=-g*Q-T*V-k*tt;return O[0]=st*Z+ot*-g+ft*-k-pt*-T,O[1]=ft*Z+ot*-T+pt*-g-st*-k,O[2]=pt*Z+ot*-k+st*-T-ft*-g,O[3]=D[3],O;}function at(O){return O[0]=0,O[1]=0,O[2]=0,O[3]=0,O;}function ut(O){return"vec4("+O[0]+", "+O[1]+", "+O[2]+", "+O[3]+")";}function Ct(O,D){return O[0]===D[0]&&O[1]===D[1]&&O[2]===D[2]&&O[3]===D[3];}function R(O,D){var J=O[0],Q=O[1],V=O[2],tt=O[3],g=D[0],T=D[1],k=D[2],Z=D[3];return Math.abs(J-g)<=s.EPSILON*Math.max(1,Math.abs(J),Math.abs(g))&&Math.abs(Q-T)<=s.EPSILON*Math.max(1,Math.abs(Q),Math.abs(T))&&Math.abs(V-k)<=s.EPSILON*Math.max(1,Math.abs(V),Math.abs(k))&&Math.abs(tt-Z)<=s.EPSILON*Math.max(1,Math.abs(tt),Math.abs(Z));}var $=y,_=C,H=b,lt=S,dt=x,wt=P,Et=z,Ot=function(){var O=o();return function(D,J,Q,V,tt,g){var T,k;for(J||(J=4),Q||(Q=0),V?k=Math.min(V*J+Q,D.length):k=D.length,T=Q;T<k;T+=J)O[0]=D[T],O[1]=D[T+1],O[2]=D[T+2],O[3]=D[T+3],tt(O,O,g),D[T]=O[0],D[T+1]=O[1],D[T+2]=O[2],D[T+3]=O[3];return D;};}();},/* 10 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return u;}),i.d(n,"clone",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"fromRotationTranslationValues",function(){return p;}),i.d(n,"fromRotationTranslation",function(){return y;}),i.d(n,"fromTranslation",function(){return C;}),i.d(n,"fromRotation",function(){return b;}),i.d(n,"fromMat4",function(){return M;}),i.d(n,"copy",function(){return L;}),i.d(n,"identity",function(){return X;}),i.d(n,"set",function(){return Y;}),i.d(n,"getReal",function(){return et;}),i.d(n,"getDual",function(){return A;}),i.d(n,"setReal",function(){return w;}),i.d(n,"setDual",function(){return S;}),i.d(n,"getTranslation",function(){return x;}),i.d(n,"translate",function(){return P;}),i.d(n,"rotateX",function(){return z;}),i.d(n,"rotateY",function(){return U;}),i.d(n,"rotateZ",function(){return K;}),i.d(n,"rotateByQuatAppend",function(){return j;}),i.d(n,"rotateByQuatPrepend",function(){return nt;}),i.d(n,"rotateAroundAxis",function(){return ct;}),i.d(n,"add",function(){return B;}),i.d(n,"multiply",function(){return N;}),i.d(n,"mul",function(){return G;}),i.d(n,"scale",function(){return q;}),i.d(n,"dot",function(){return at;}),i.d(n,"lerp",function(){return ut;}),i.d(n,"invert",function(){return Ct;}),i.d(n,"conjugate",function(){return R;}),i.d(n,"length",function(){return $;}),i.d(n,"len",function(){return _;}),i.d(n,"squaredLength",function(){return H;}),i.d(n,"sqrLen",function(){return lt;}),i.d(n,"normalize",function(){return dt;}),i.d(n,"str",function(){return wt;}),i.d(n,"exactEquals",function(){return Et;}),i.d(n,"equals",function(){return Ot;});var s=i(2),o=i(7),a=i(6);function u(){var O=new s.ARRAY_TYPE(8);return s.ARRAY_TYPE!=Float32Array&&(O[0]=0,O[1]=0,O[2]=0,O[4]=0,O[5]=0,O[6]=0,O[7]=0),O[3]=1,O;}function h(O){var D=new s.ARRAY_TYPE(8);return D[0]=O[0],D[1]=O[1],D[2]=O[2],D[3]=O[3],D[4]=O[4],D[5]=O[5],D[6]=O[6],D[7]=O[7],D;}function v(O,D,J,Q,V,tt,g,T){var k=new s.ARRAY_TYPE(8);return k[0]=O,k[1]=D,k[2]=J,k[3]=Q,k[4]=V,k[5]=tt,k[6]=g,k[7]=T,k;}function p(O,D,J,Q,V,tt,g){var T=new s.ARRAY_TYPE(8);T[0]=O,T[1]=D,T[2]=J,T[3]=Q;var k=V*0.5,Z=tt*0.5,st=g*0.5;return T[4]=k*Q+Z*J-st*D,T[5]=Z*Q+st*O-k*J,T[6]=st*Q+k*D-Z*O,T[7]=-k*O-Z*D-st*J,T;}function y(O,D,J){var Q=J[0]*0.5,V=J[1]*0.5,tt=J[2]*0.5,g=D[0],T=D[1],k=D[2],Z=D[3];return O[0]=g,O[1]=T,O[2]=k,O[3]=Z,O[4]=Q*Z+V*k-tt*T,O[5]=V*Z+tt*g-Q*k,O[6]=tt*Z+Q*T-V*g,O[7]=-Q*g-V*T-tt*k,O;}function C(O,D){return O[0]=0,O[1]=0,O[2]=0,O[3]=1,O[4]=D[0]*0.5,O[5]=D[1]*0.5,O[6]=D[2]*0.5,O[7]=0,O;}function b(O,D){return O[0]=D[0],O[1]=D[1],O[2]=D[2],O[3]=D[3],O[4]=0,O[5]=0,O[6]=0,O[7]=0,O;}function M(O,D){var J=o.create();a.getRotation(J,D);var Q=new s.ARRAY_TYPE(3);return a.getTranslation(Q,D),y(O,J,Q),O;}function L(O,D){return O[0]=D[0],O[1]=D[1],O[2]=D[2],O[3]=D[3],O[4]=D[4],O[5]=D[5],O[6]=D[6],O[7]=D[7],O;}function X(O){return O[0]=0,O[1]=0,O[2]=0,O[3]=1,O[4]=0,O[5]=0,O[6]=0,O[7]=0,O;}function Y(O,D,J,Q,V,tt,g,T,k){return O[0]=D,O[1]=J,O[2]=Q,O[3]=V,O[4]=tt,O[5]=g,O[6]=T,O[7]=k,O;}var et=o.copy;function A(O,D){return O[0]=D[4],O[1]=D[5],O[2]=D[6],O[3]=D[7],O;}var w=o.copy;function S(O,D){return O[4]=D[0],O[5]=D[1],O[6]=D[2],O[7]=D[3],O;}function x(O,D){var J=D[4],Q=D[5],V=D[6],tt=D[7],g=-D[0],T=-D[1],k=-D[2],Z=D[3];return O[0]=(J*Z+tt*g+Q*k-V*T)*2,O[1]=(Q*Z+tt*T+V*g-J*k)*2,O[2]=(V*Z+tt*k+J*T-Q*g)*2,O;}function P(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3],T=J[0]*0.5,k=J[1]*0.5,Z=J[2]*0.5,st=D[4],ft=D[5],pt=D[6],ot=D[7];return O[0]=Q,O[1]=V,O[2]=tt,O[3]=g,O[4]=g*T+V*Z-tt*k+st,O[5]=g*k+tt*T-Q*Z+ft,O[6]=g*Z+Q*k-V*T+pt,O[7]=-Q*T-V*k-tt*Z+ot,O;}function z(O,D,J){var Q=-D[0],V=-D[1],tt=-D[2],g=D[3],T=D[4],k=D[5],Z=D[6],st=D[7],ft=T*g+st*Q+k*tt-Z*V,pt=k*g+st*V+Z*Q-T*tt,ot=Z*g+st*tt+T*V-k*Q,mt=st*g-T*Q-k*V-Z*tt;return o.rotateX(O,D,J),Q=O[0],V=O[1],tt=O[2],g=O[3],O[4]=ft*g+mt*Q+pt*tt-ot*V,O[5]=pt*g+mt*V+ot*Q-ft*tt,O[6]=ot*g+mt*tt+ft*V-pt*Q,O[7]=mt*g-ft*Q-pt*V-ot*tt,O;}function U(O,D,J){var Q=-D[0],V=-D[1],tt=-D[2],g=D[3],T=D[4],k=D[5],Z=D[6],st=D[7],ft=T*g+st*Q+k*tt-Z*V,pt=k*g+st*V+Z*Q-T*tt,ot=Z*g+st*tt+T*V-k*Q,mt=st*g-T*Q-k*V-Z*tt;return o.rotateY(O,D,J),Q=O[0],V=O[1],tt=O[2],g=O[3],O[4]=ft*g+mt*Q+pt*tt-ot*V,O[5]=pt*g+mt*V+ot*Q-ft*tt,O[6]=ot*g+mt*tt+ft*V-pt*Q,O[7]=mt*g-ft*Q-pt*V-ot*tt,O;}function K(O,D,J){var Q=-D[0],V=-D[1],tt=-D[2],g=D[3],T=D[4],k=D[5],Z=D[6],st=D[7],ft=T*g+st*Q+k*tt-Z*V,pt=k*g+st*V+Z*Q-T*tt,ot=Z*g+st*tt+T*V-k*Q,mt=st*g-T*Q-k*V-Z*tt;return o.rotateZ(O,D,J),Q=O[0],V=O[1],tt=O[2],g=O[3],O[4]=ft*g+mt*Q+pt*tt-ot*V,O[5]=pt*g+mt*V+ot*Q-ft*tt,O[6]=ot*g+mt*tt+ft*V-pt*Q,O[7]=mt*g-ft*Q-pt*V-ot*tt,O;}function j(O,D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=D[0],k=D[1],Z=D[2],st=D[3];return O[0]=T*g+st*Q+k*tt-Z*V,O[1]=k*g+st*V+Z*Q-T*tt,O[2]=Z*g+st*tt+T*V-k*Q,O[3]=st*g-T*Q-k*V-Z*tt,T=D[4],k=D[5],Z=D[6],st=D[7],O[4]=T*g+st*Q+k*tt-Z*V,O[5]=k*g+st*V+Z*Q-T*tt,O[6]=Z*g+st*tt+T*V-k*Q,O[7]=st*g-T*Q-k*V-Z*tt,O;}function nt(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3],T=J[0],k=J[1],Z=J[2],st=J[3];return O[0]=Q*st+g*T+V*Z-tt*k,O[1]=V*st+g*k+tt*T-Q*Z,O[2]=tt*st+g*Z+Q*k-V*T,O[3]=g*st-Q*T-V*k-tt*Z,T=J[4],k=J[5],Z=J[6],st=J[7],O[4]=Q*st+g*T+V*Z-tt*k,O[5]=V*st+g*k+tt*T-Q*Z,O[6]=tt*st+g*Z+Q*k-V*T,O[7]=g*st-Q*T-V*k-tt*Z,O;}function ct(O,D,J,Q){if(Math.abs(Q)<s.EPSILON)return L(O,D);var V=Math.hypot(J[0],J[1],J[2]);Q=Q*0.5;var tt=Math.sin(Q),g=tt*J[0]/V,T=tt*J[1]/V,k=tt*J[2]/V,Z=Math.cos(Q),st=D[0],ft=D[1],pt=D[2],ot=D[3];O[0]=st*Z+ot*g+ft*k-pt*T,O[1]=ft*Z+ot*T+pt*g-st*k,O[2]=pt*Z+ot*k+st*T-ft*g,O[3]=ot*Z-st*g-ft*T-pt*k;var mt=D[4],Tt=D[5],Pt=D[6],Lt=D[7];return O[4]=mt*Z+Lt*g+Tt*k-Pt*T,O[5]=Tt*Z+Lt*T+Pt*g-mt*k,O[6]=Pt*Z+Lt*k+mt*T-Tt*g,O[7]=Lt*Z-mt*g-Tt*T-Pt*k,O;}function B(O,D,J){return O[0]=D[0]+J[0],O[1]=D[1]+J[1],O[2]=D[2]+J[2],O[3]=D[3]+J[3],O[4]=D[4]+J[4],O[5]=D[5]+J[5],O[6]=D[6]+J[6],O[7]=D[7]+J[7],O;}function N(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3],T=J[4],k=J[5],Z=J[6],st=J[7],ft=D[4],pt=D[5],ot=D[6],mt=D[7],Tt=J[0],Pt=J[1],Lt=J[2],Dt=J[3];return O[0]=Q*Dt+g*Tt+V*Lt-tt*Pt,O[1]=V*Dt+g*Pt+tt*Tt-Q*Lt,O[2]=tt*Dt+g*Lt+Q*Pt-V*Tt,O[3]=g*Dt-Q*Tt-V*Pt-tt*Lt,O[4]=Q*st+g*T+V*Z-tt*k+ft*Dt+mt*Tt+pt*Lt-ot*Pt,O[5]=V*st+g*k+tt*T-Q*Z+pt*Dt+mt*Pt+ot*Tt-ft*Lt,O[6]=tt*st+g*Z+Q*k-V*T+ot*Dt+mt*Lt+ft*Pt-pt*Tt,O[7]=g*st-Q*T-V*k-tt*Z+mt*Dt-ft*Tt-pt*Pt-ot*Lt,O;}var G=N;function q(O,D,J){return O[0]=D[0]*J,O[1]=D[1]*J,O[2]=D[2]*J,O[3]=D[3]*J,O[4]=D[4]*J,O[5]=D[5]*J,O[6]=D[6]*J,O[7]=D[7]*J,O;}var at=o.dot;function ut(O,D,J,Q){var V=1-Q;return at(D,J)<0&&(Q=-Q),O[0]=D[0]*V+J[0]*Q,O[1]=D[1]*V+J[1]*Q,O[2]=D[2]*V+J[2]*Q,O[3]=D[3]*V+J[3]*Q,O[4]=D[4]*V+J[4]*Q,O[5]=D[5]*V+J[5]*Q,O[6]=D[6]*V+J[6]*Q,O[7]=D[7]*V+J[7]*Q,O;}function Ct(O,D){var J=H(D);return O[0]=-D[0]/J,O[1]=-D[1]/J,O[2]=-D[2]/J,O[3]=D[3]/J,O[4]=-D[4]/J,O[5]=-D[5]/J,O[6]=-D[6]/J,O[7]=D[7]/J,O;}function R(O,D){return O[0]=-D[0],O[1]=-D[1],O[2]=-D[2],O[3]=D[3],O[4]=-D[4],O[5]=-D[5],O[6]=-D[6],O[7]=D[7],O;}var $=o.length,_=$,H=o.squaredLength,lt=H;function dt(O,D){var J=H(D);if(J>0){J=Math.sqrt(J);var Q=D[0]/J,V=D[1]/J,tt=D[2]/J,g=D[3]/J,T=D[4],k=D[5],Z=D[6],st=D[7],ft=Q*T+V*k+tt*Z+g*st;O[0]=Q,O[1]=V,O[2]=tt,O[3]=g,O[4]=(T-Q*ft)/J,O[5]=(k-V*ft)/J,O[6]=(Z-tt*ft)/J,O[7]=(st-g*ft)/J;}return O;}function wt(O){return"quat2("+O[0]+", "+O[1]+", "+O[2]+", "+O[3]+", "+O[4]+", "+O[5]+", "+O[6]+", "+O[7]+")";}function Et(O,D){return O[0]===D[0]&&O[1]===D[1]&&O[2]===D[2]&&O[3]===D[3]&&O[4]===D[4]&&O[5]===D[5]&&O[6]===D[6]&&O[7]===D[7];}function Ot(O,D){var J=O[0],Q=O[1],V=O[2],tt=O[3],g=O[4],T=O[5],k=O[6],Z=O[7],st=D[0],ft=D[1],pt=D[2],ot=D[3],mt=D[4],Tt=D[5],Pt=D[6],Lt=D[7];return Math.abs(J-st)<=s.EPSILON*Math.max(1,Math.abs(J),Math.abs(st))&&Math.abs(Q-ft)<=s.EPSILON*Math.max(1,Math.abs(Q),Math.abs(ft))&&Math.abs(V-pt)<=s.EPSILON*Math.max(1,Math.abs(V),Math.abs(pt))&&Math.abs(tt-ot)<=s.EPSILON*Math.max(1,Math.abs(tt),Math.abs(ot))&&Math.abs(g-mt)<=s.EPSILON*Math.max(1,Math.abs(g),Math.abs(mt))&&Math.abs(T-Tt)<=s.EPSILON*Math.max(1,Math.abs(T),Math.abs(Tt))&&Math.abs(k-Pt)<=s.EPSILON*Math.max(1,Math.abs(k),Math.abs(Pt))&&Math.abs(Z-Lt)<=s.EPSILON*Math.max(1,Math.abs(Z),Math.abs(Lt));}},/* 11 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"fromValues",function(){return u;}),i.d(n,"copy",function(){return h;}),i.d(n,"set",function(){return v;}),i.d(n,"add",function(){return p;}),i.d(n,"subtract",function(){return y;}),i.d(n,"multiply",function(){return C;}),i.d(n,"divide",function(){return b;}),i.d(n,"ceil",function(){return M;}),i.d(n,"floor",function(){return L;}),i.d(n,"min",function(){return X;}),i.d(n,"max",function(){return Y;}),i.d(n,"round",function(){return et;}),i.d(n,"scale",function(){return A;}),i.d(n,"scaleAndAdd",function(){return w;}),i.d(n,"distance",function(){return S;}),i.d(n,"squaredDistance",function(){return x;}),i.d(n,"length",function(){return P;}),i.d(n,"squaredLength",function(){return z;}),i.d(n,"negate",function(){return U;}),i.d(n,"inverse",function(){return K;}),i.d(n,"normalize",function(){return j;}),i.d(n,"dot",function(){return nt;}),i.d(n,"cross",function(){return ct;}),i.d(n,"lerp",function(){return B;}),i.d(n,"random",function(){return N;}),i.d(n,"transformMat2",function(){return G;}),i.d(n,"transformMat2d",function(){return q;}),i.d(n,"transformMat3",function(){return at;}),i.d(n,"transformMat4",function(){return ut;}),i.d(n,"rotate",function(){return Ct;}),i.d(n,"angle",function(){return R;}),i.d(n,"zero",function(){return $;}),i.d(n,"str",function(){return _;}),i.d(n,"exactEquals",function(){return H;}),i.d(n,"equals",function(){return lt;}),i.d(n,"len",function(){return dt;}),i.d(n,"sub",function(){return wt;}),i.d(n,"mul",function(){return Et;}),i.d(n,"div",function(){return Ot;}),i.d(n,"dist",function(){return O;}),i.d(n,"sqrDist",function(){return D;}),i.d(n,"sqrLen",function(){return J;}),i.d(n,"forEach",function(){return Q;});var s=i(2);function o(){var V=new s.ARRAY_TYPE(2);return s.ARRAY_TYPE!=Float32Array&&(V[0]=0,V[1]=0),V;}function a(V){var tt=new s.ARRAY_TYPE(2);return tt[0]=V[0],tt[1]=V[1],tt;}function u(V,tt){var g=new s.ARRAY_TYPE(2);return g[0]=V,g[1]=tt,g;}function h(V,tt){return V[0]=tt[0],V[1]=tt[1],V;}function v(V,tt,g){return V[0]=tt,V[1]=g,V;}function p(V,tt,g){return V[0]=tt[0]+g[0],V[1]=tt[1]+g[1],V;}function y(V,tt,g){return V[0]=tt[0]-g[0],V[1]=tt[1]-g[1],V;}function C(V,tt,g){return V[0]=tt[0]*g[0],V[1]=tt[1]*g[1],V;}function b(V,tt,g){return V[0]=tt[0]/g[0],V[1]=tt[1]/g[1],V;}function M(V,tt){return V[0]=Math.ceil(tt[0]),V[1]=Math.ceil(tt[1]),V;}function L(V,tt){return V[0]=Math.floor(tt[0]),V[1]=Math.floor(tt[1]),V;}function X(V,tt,g){return V[0]=Math.min(tt[0],g[0]),V[1]=Math.min(tt[1],g[1]),V;}function Y(V,tt,g){return V[0]=Math.max(tt[0],g[0]),V[1]=Math.max(tt[1],g[1]),V;}function et(V,tt){return V[0]=Math.round(tt[0]),V[1]=Math.round(tt[1]),V;}function A(V,tt,g){return V[0]=tt[0]*g,V[1]=tt[1]*g,V;}function w(V,tt,g,T){return V[0]=tt[0]+g[0]*T,V[1]=tt[1]+g[1]*T,V;}function S(V,tt){var g=tt[0]-V[0],T=tt[1]-V[1];return Math.hypot(g,T);}function x(V,tt){var g=tt[0]-V[0],T=tt[1]-V[1];return g*g+T*T;}function P(V){var tt=V[0],g=V[1];return Math.hypot(tt,g);}function z(V){var tt=V[0],g=V[1];return tt*tt+g*g;}function U(V,tt){return V[0]=-tt[0],V[1]=-tt[1],V;}function K(V,tt){return V[0]=1/tt[0],V[1]=1/tt[1],V;}function j(V,tt){var g=tt[0],T=tt[1],k=g*g+T*T;return k>0&&(k=1/Math.sqrt(k)),V[0]=tt[0]*k,V[1]=tt[1]*k,V;}function nt(V,tt){return V[0]*tt[0]+V[1]*tt[1];}function ct(V,tt,g){var T=tt[0]*g[1]-tt[1]*g[0];return V[0]=V[1]=0,V[2]=T,V;}function B(V,tt,g,T){var k=tt[0],Z=tt[1];return V[0]=k+T*(g[0]-k),V[1]=Z+T*(g[1]-Z),V;}function N(V,tt){tt=tt||1;var g=s.RANDOM()*2*Math.PI;return V[0]=Math.cos(g)*tt,V[1]=Math.sin(g)*tt,V;}function G(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[2]*k,V[1]=g[1]*T+g[3]*k,V;}function q(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[2]*k+g[4],V[1]=g[1]*T+g[3]*k+g[5],V;}function at(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[3]*k+g[6],V[1]=g[1]*T+g[4]*k+g[7],V;}function ut(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[4]*k+g[12],V[1]=g[1]*T+g[5]*k+g[13],V;}function Ct(V,tt,g,T){var k=tt[0]-g[0],Z=tt[1]-g[1],st=Math.sin(T),ft=Math.cos(T);return V[0]=k*ft-Z*st+g[0],V[1]=k*st+Z*ft+g[1],V;}function R(V,tt){var g=V[0],T=V[1],k=tt[0],Z=tt[1],st=Math.sqrt(g*g+T*T)*Math.sqrt(k*k+Z*Z),ft=st&&(g*k+T*Z)/st;return Math.acos(Math.min(Math.max(ft,-1),1));}function $(V){return V[0]=0,V[1]=0,V;}function _(V){return"vec2("+V[0]+", "+V[1]+")";}function H(V,tt){return V[0]===tt[0]&&V[1]===tt[1];}function lt(V,tt){var g=V[0],T=V[1],k=tt[0],Z=tt[1];return Math.abs(g-k)<=s.EPSILON*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(T-Z)<=s.EPSILON*Math.max(1,Math.abs(T),Math.abs(Z));}var dt=P,wt=y,Et=C,Ot=b,O=S,D=x,J=z,Q=function(){var V=o();return function(tt,g,T,k,Z,st){var ft,pt;for(g||(g=2),T||(T=0),k?pt=Math.min(k*g+T,tt.length):pt=tt.length,ft=T;ft<pt;ft+=g)V[0]=tt[ft],V[1]=tt[ft+1],Z(V,V,st),tt[ft]=V[0],tt[ft+1]=V[1];return tt;};}();},/* 12 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return R;});var s=i(13),o=/* @__PURE__ */i.n(s),a=i(19),u=/* @__PURE__ */i.n(a),h=i(23),v=/* @__PURE__ */i.n(h),p=i(24),y=/* @__PURE__ */i.n(p),C=i(25),b=i(1),M=i(36),L=i(43),X=i(41),Y=i(56),et=i(73),A=i(45),w=i(78),S=i(37),x=i(82);i(1).glMatrix.setMatrixArrayType(Array);function P($,_){var H;if((typeof Symbol==="undefined"?"undefined":_typeof(Symbol))>"u"||$[Symbol.iterator]==null){if(Array.isArray($)||(H=z($))||_){H&&($=H);var lt=0,dt=function dt(){};return{s:dt,n:function n(){return lt>=$.length?{done:!0}:{done:!1,value:$[lt++]};},e:function e(D){throw D;},f:dt};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var wt=!0,Et=!1,Ot;return{s:function s(){H=$[Symbol.iterator]();},n:function n(){var D=H.next();return wt=D.done,D;},e:function e(D){Et=!0,Ot=D;},f:function f(){try{!wt&&H.return!=null&&H.return();}finally{if(Et)throw Ot;}}};}function z($,_){if($){if(typeof $=="string")return U($,_);var H=Object.prototype.toString.call($).slice(8,-1);if(H==="Object"&&$.constructor&&(H=$.constructor.name),H==="Map"||H==="Set")return Array.from($);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return U($,_);}}function U($,_){(_==null||_>$.length)&&(_=$.length);for(var H=0,lt=new Array(_);H<_;H++)lt[H]=$[H];return lt;}var K={autoUpdate:!1,// premultipliedAlpha: true,
|
|
1
|
+
var _Object$freeze,_jbt;var _excluded=["duration"],_excluded2=["toolsType"],_excluded3=["callback"],_excluded4=["render"],_excluded5=["render"];function _wrapNativeSuper(t){var r="function"==typeof Map?new Map():void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper);}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor);}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t);},_wrapNativeSuper(t);}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]");}catch(n){return"function"==typeof t;}}function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o))();return r&&_setPrototypeOf(p,r.prototype),p;}function _regeneratorValues(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function next(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e};}};}throw new TypeError(_typeof(e)+" is not iterable");}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n5=0,F=function F(){};return{s:F,n:function n(){return _n5>=r.length?{done:!0}:{done:!1,value:r[_n5++]};},e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t.return||t.return();}finally{if(u)throw o;}}};}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a;}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0));}if(o||r>1)return a;throw y=!0,n;}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0);}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e;}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break;}catch(t){i=e,c=1,u=t;}finally{f=1;}}return{value:t,done:y};};}(r,o,i),!0),u;}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this;}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e;}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this;}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]";}),(_regenerator=function _regenerator(){return{w:i,m:f};})();}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{});}catch(e){i=0;}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e);});}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2));},_regeneratorDefine2(e,r,n,t);}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _objectDestructuringEmpty(t){if(null==t)throw new TypeError("Cannot destructure "+t);}function _extends(){return _extends=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r]);}return n;},_extends.apply(null,arguments);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(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 _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(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&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){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 _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){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 _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _asyncIterator(r){var n,t,o,e=2;for("undefined"!=typeof Symbol&&(t=Symbol.asyncIterator,o=Symbol.iterator);e--;){if(t&&null!=(n=r[t]))return n.call(r);if(o&&null!=(n=r[o]))return new AsyncFromSyncIterator(n.call(r));t="@@asyncIterator",o="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(r){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var n=r.done;return Promise.resolve(r.value).then(function(r){return{value:r,done:n};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(r){this.s=r,this.n=r.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},return:function _return(r){var n=this.s.return;return void 0===n?Promise.resolve({value:r,done:!0}):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));},throw:function _throw(r){var n=this.s.return;return void 0===n?Promise.reject(r):AsyncFromSyncIteratorContinuation(n.apply(this.s,arguments));}},new AsyncFromSyncIterator(r);}var jE=Object.defineProperty;var XE=function XE(r,t,e){return t in r?jE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;};var ht=function ht(r,t,e){return XE(r,_typeof(t)!="symbol"?t+"":t,e);};var go=1e-6,Xa=(typeof Float32Array==="undefined"?"undefined":_typeof(Float32Array))<"u"?Float32Array:Array;function Me(r){Xa=r;}function HE(){var r=new Xa(6);return Xa!=Float32Array&&(r[1]=0,r[2]=0,r[4]=0,r[5]=0),r[0]=1,r[3]=1,r;}function VE(r){var t=new Xa(6);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t;}function ZE(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r;}function qE(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r;}function Os(r,t,e,n,i,s){var o=new Xa(6);return o[0]=r,o[1]=t,o[2]=e,o[3]=n,o[4]=i,o[5]=s,o;}function KE(r,t,e,n,i,s,o){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=s,r[5]=o,r;}function iu(r,t){var e=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],u=e*s-n*i;return u?(u=1/u,r[0]=s*u,r[1]=-n*u,r[2]=-i*u,r[3]=e*u,r[4]=(i*a-s*o)*u,r[5]=(n*o-e*a)*u,r):null;}function QE(r){return r[0]*r[3]-r[1]*r[2];}function _n(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=e[0],v=e[1],p=e[2],y=e[3],C=e[4],b=e[5];return r[0]=n*h+s*v,r[1]=i*h+o*v,r[2]=n*p+s*y,r[3]=i*p+o*y,r[4]=n*C+s*b+a,r[5]=i*C+o*b+u,r;}function J1(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=Math.sin(e),v=Math.cos(e);return r[0]=n*v+s*h,r[1]=i*v+o*h,r[2]=n*-h+s*v,r[3]=i*-h+o*v,r[4]=a,r[5]=u,r;}function JE(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=e[0],v=e[1];return r[0]=n*h,r[1]=i*h,r[2]=s*v,r[3]=o*v,r[4]=a,r[5]=u,r;}function Yd(r,t,e){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],u=t[5],h=e[0],v=e[1];return r[0]=n,r[1]=i,r[2]=s,r[3]=o,r[4]=n*h+s*v+a,r[5]=i*h+o*v+u,r;}function _E(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=-e,r[3]=n,r[4]=0,r[5]=0,r;}function tM(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=t[1],r[4]=0,r[5]=0,r;}function eM(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=t[0],r[5]=t[1],r;}function rM(r){return"mat2d("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+")";}function nM(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]+r[3]*r[3]+r[4]*r[4]+r[5]*r[5]+1);}function iM(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r;}function _1(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r;}function sM(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r;}function oM(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r;}function aM(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5];}function lM(r,t){var e=r[0],n=r[1],i=r[2],s=r[3],o=r[4],a=r[5],u=t[0],h=t[1],v=t[2],p=t[3],y=t[4],C=t[5];return Math.abs(e-u)<=go*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(n-h)<=go*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-v)<=go*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(s-p)<=go*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(o-y)<=go*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(a-C)<=go*Math.max(1,Math.abs(a),Math.abs(C));}var cM=_n,uM=_1;var tw=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,add:iM,clone:VE,copy:ZE,create:HE,determinant:QE,equals:lM,exactEquals:aM,frob:nM,fromRotation:_E,fromScaling:tM,fromTranslation:eM,fromValues:Os,identity:qE,invert:iu,mul:cM,multiply:_n,multiplyScalar:sM,multiplyScalarAndAdd:oM,rotate:J1,scale:JE,set:KE,str:rM,sub:uM,subtract:_1,translate:Yd},Symbol.toStringTag,{value:"Module"}));var Qe=(typeof globalThis==="undefined"?"undefined":_typeof(globalThis))<"u"?globalThis:(typeof window==="undefined"?"undefined":_typeof(window))<"u"?window:(typeof global==="undefined"?"undefined":_typeof(global))<"u"?global:(typeof self==="undefined"?"undefined":_typeof(self))<"u"?self:{};function $n(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;}var ew={exports:{}};(function(r,t){(function(n,i){r.exports=i();})(Qe,function(){return/******/function(e){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={/******/i:s,/******/l:!1,/******/exports:{}/******/};return e[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports;}return i.m=e,i.c=n,i.d=function(s,o,a){i.o(s,o)||Object.defineProperty(s,o,{enumerable:!0,get:a});},i.r=function(s){(typeof Symbol==="undefined"?"undefined":_typeof(Symbol))<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0});},i.t=function(s,o){if(o&1&&(s=i(s)),o&8||o&4&&_typeof(s)=="object"&&s&&s.__esModule)return s;var a=/* @__PURE__ */Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:s}),o&2&&typeof s!="string")for(var u in s)i.d(a,u,function(h){return s[h];}.bind(null,u));return a;},i.n=function(s){var o=s&&s.__esModule?(/******/function(){return s.default;}):(/******/function(){return s;});return i.d(o,"a",o),o;},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o);},i.p="/js/",i(i.s=0);}([/* 0 *//***/function(e,n,i){i.r(n);var s=i(12);i.d(n,"Renderer",function(){return s.default;});var o=i(56);i.d(n,"Figure2D",function(){return o.default;});var a=i(73);i.d(n,"Mesh2D",function(){return a.default;});var u=i(45);i.d(n,"MeshCloud",function(){return u.default;});var h=i(39);i.d(n,"parseFont",function(){return h.default;});var v=i(47);i.d(n,"parseColor",function(){return v.default;});var p=i(37);i.d(n,"ENV",function(){return p.default;}),i(1).glMatrix.setMatrixArrayType(Array);},/* 1 *//***/function(e,n,i){i.r(n);var s=i(2);i.d(n,"glMatrix",function(){return s;});var o=i(3);i.d(n,"mat2",function(){return o;});var a=i(4);i.d(n,"mat2d",function(){return a;});var u=i(5);i.d(n,"mat3",function(){return u;});var h=i(6);i.d(n,"mat4",function(){return h;});var v=i(7);i.d(n,"quat",function(){return v;});var p=i(10);i.d(n,"quat2",function(){return p;});var y=i(11);i.d(n,"vec2",function(){return y;});var C=i(8);i.d(n,"vec3",function(){return C;});var b=i(9);i.d(n,"vec4",function(){return b;});},/* 2 *//***/function(e,n,i){i.r(n),i.d(n,"EPSILON",function(){return s;}),i.d(n,"ARRAY_TYPE",function(){return o;}),i.d(n,"RANDOM",function(){return a;}),i.d(n,"setMatrixArrayType",function(){return u;}),i.d(n,"toRadian",function(){return v;}),i.d(n,"equals",function(){return p;});var s=1e-6,o=(typeof Float32Array==="undefined"?"undefined":_typeof(Float32Array))<"u"?Float32Array:Array,a=Math.random;function u(y){o=y;}var h=Math.PI/180;function v(y){return y*h;}function p(y,C){return Math.abs(y-C)<=s*Math.max(1,Math.abs(y),Math.abs(C));}Math.hypot||(Math.hypot=function(){for(var y=0,C=arguments.length;C--;)y+=arguments[C]*arguments[C];return Math.sqrt(y);});},/* 3 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"copy",function(){return u;}),i.d(n,"identity",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"transpose",function(){return y;}),i.d(n,"invert",function(){return C;}),i.d(n,"adjoint",function(){return b;}),i.d(n,"determinant",function(){return M;}),i.d(n,"multiply",function(){return L;}),i.d(n,"rotate",function(){return X;}),i.d(n,"scale",function(){return Y;}),i.d(n,"fromRotation",function(){return et;}),i.d(n,"fromScaling",function(){return A;}),i.d(n,"str",function(){return w;}),i.d(n,"frob",function(){return S;}),i.d(n,"LDU",function(){return x;}),i.d(n,"add",function(){return P;}),i.d(n,"subtract",function(){return z;}),i.d(n,"exactEquals",function(){return U;}),i.d(n,"equals",function(){return K;}),i.d(n,"multiplyScalar",function(){return j;}),i.d(n,"multiplyScalarAndAdd",function(){return nt;}),i.d(n,"mul",function(){return ct;}),i.d(n,"sub",function(){return B;});var s=i(2);function o(){var N=new s.ARRAY_TYPE(4);return s.ARRAY_TYPE!=Float32Array&&(N[1]=0,N[2]=0),N[0]=1,N[3]=1,N;}function a(N){var G=new s.ARRAY_TYPE(4);return G[0]=N[0],G[1]=N[1],G[2]=N[2],G[3]=N[3],G;}function u(N,G){return N[0]=G[0],N[1]=G[1],N[2]=G[2],N[3]=G[3],N;}function h(N){return N[0]=1,N[1]=0,N[2]=0,N[3]=1,N;}function v(N,G,q,at){var ut=new s.ARRAY_TYPE(4);return ut[0]=N,ut[1]=G,ut[2]=q,ut[3]=at,ut;}function p(N,G,q,at,ut){return N[0]=G,N[1]=q,N[2]=at,N[3]=ut,N;}function y(N,G){if(N===G){var q=G[1];N[1]=G[2],N[2]=q;}else N[0]=G[0],N[1]=G[2],N[2]=G[1],N[3]=G[3];return N;}function C(N,G){var q=G[0],at=G[1],ut=G[2],Ct=G[3],R=q*Ct-ut*at;return R?(R=1/R,N[0]=Ct*R,N[1]=-at*R,N[2]=-ut*R,N[3]=q*R,N):null;}function b(N,G){var q=G[0];return N[0]=G[3],N[1]=-G[1],N[2]=-G[2],N[3]=q,N;}function M(N){return N[0]*N[3]-N[2]*N[1];}function L(N,G,q){var at=G[0],ut=G[1],Ct=G[2],R=G[3],$=q[0],_=q[1],H=q[2],lt=q[3];return N[0]=at*$+Ct*_,N[1]=ut*$+R*_,N[2]=at*H+Ct*lt,N[3]=ut*H+R*lt,N;}function X(N,G,q){var at=G[0],ut=G[1],Ct=G[2],R=G[3],$=Math.sin(q),_=Math.cos(q);return N[0]=at*_+Ct*$,N[1]=ut*_+R*$,N[2]=at*-$+Ct*_,N[3]=ut*-$+R*_,N;}function Y(N,G,q){var at=G[0],ut=G[1],Ct=G[2],R=G[3],$=q[0],_=q[1];return N[0]=at*$,N[1]=ut*$,N[2]=Ct*_,N[3]=R*_,N;}function et(N,G){var q=Math.sin(G),at=Math.cos(G);return N[0]=at,N[1]=q,N[2]=-q,N[3]=at,N;}function A(N,G){return N[0]=G[0],N[1]=0,N[2]=0,N[3]=G[1],N;}function w(N){return"mat2("+N[0]+", "+N[1]+", "+N[2]+", "+N[3]+")";}function S(N){return Math.hypot(N[0],N[1],N[2],N[3]);}function x(N,G,q,at){return N[2]=at[2]/at[0],q[0]=at[0],q[1]=at[1],q[3]=at[3]-N[2]*q[1],[N,G,q];}function P(N,G,q){return N[0]=G[0]+q[0],N[1]=G[1]+q[1],N[2]=G[2]+q[2],N[3]=G[3]+q[3],N;}function z(N,G,q){return N[0]=G[0]-q[0],N[1]=G[1]-q[1],N[2]=G[2]-q[2],N[3]=G[3]-q[3],N;}function U(N,G){return N[0]===G[0]&&N[1]===G[1]&&N[2]===G[2]&&N[3]===G[3];}function K(N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=G[0],$=G[1],_=G[2],H=G[3];return Math.abs(q-R)<=s.EPSILON*Math.max(1,Math.abs(q),Math.abs(R))&&Math.abs(at-$)<=s.EPSILON*Math.max(1,Math.abs(at),Math.abs($))&&Math.abs(ut-_)<=s.EPSILON*Math.max(1,Math.abs(ut),Math.abs(_))&&Math.abs(Ct-H)<=s.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(H));}function j(N,G,q){return N[0]=G[0]*q,N[1]=G[1]*q,N[2]=G[2]*q,N[3]=G[3]*q,N;}function nt(N,G,q,at){return N[0]=G[0]+q[0]*at,N[1]=G[1]+q[1]*at,N[2]=G[2]+q[2]*at,N[3]=G[3]+q[3]*at,N;}var ct=L,B=z;},/* 4 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"copy",function(){return u;}),i.d(n,"identity",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"invert",function(){return y;}),i.d(n,"determinant",function(){return C;}),i.d(n,"multiply",function(){return b;}),i.d(n,"rotate",function(){return M;}),i.d(n,"scale",function(){return L;}),i.d(n,"translate",function(){return X;}),i.d(n,"fromRotation",function(){return Y;}),i.d(n,"fromScaling",function(){return et;}),i.d(n,"fromTranslation",function(){return A;}),i.d(n,"str",function(){return w;}),i.d(n,"frob",function(){return S;}),i.d(n,"add",function(){return x;}),i.d(n,"subtract",function(){return P;}),i.d(n,"multiplyScalar",function(){return z;}),i.d(n,"multiplyScalarAndAdd",function(){return U;}),i.d(n,"exactEquals",function(){return K;}),i.d(n,"equals",function(){return j;}),i.d(n,"mul",function(){return nt;}),i.d(n,"sub",function(){return ct;});var s=i(2);function o(){var B=new s.ARRAY_TYPE(6);return s.ARRAY_TYPE!=Float32Array&&(B[1]=0,B[2]=0,B[4]=0,B[5]=0),B[0]=1,B[3]=1,B;}function a(B){var N=new s.ARRAY_TYPE(6);return N[0]=B[0],N[1]=B[1],N[2]=B[2],N[3]=B[3],N[4]=B[4],N[5]=B[5],N;}function u(B,N){return B[0]=N[0],B[1]=N[1],B[2]=N[2],B[3]=N[3],B[4]=N[4],B[5]=N[5],B;}function h(B){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=0,B[5]=0,B;}function v(B,N,G,q,at,ut){var Ct=new s.ARRAY_TYPE(6);return Ct[0]=B,Ct[1]=N,Ct[2]=G,Ct[3]=q,Ct[4]=at,Ct[5]=ut,Ct;}function p(B,N,G,q,at,ut,Ct){return B[0]=N,B[1]=G,B[2]=q,B[3]=at,B[4]=ut,B[5]=Ct,B;}function y(B,N){var G=N[0],q=N[1],at=N[2],ut=N[3],Ct=N[4],R=N[5],$=G*ut-q*at;return $?($=1/$,B[0]=ut*$,B[1]=-q*$,B[2]=-at*$,B[3]=G*$,B[4]=(at*R-ut*Ct)*$,B[5]=(q*Ct-G*R)*$,B):null;}function C(B){return B[0]*B[3]-B[1]*B[2];}function b(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=G[0],H=G[1],lt=G[2],dt=G[3],wt=G[4],Et=G[5];return B[0]=q*_+ut*H,B[1]=at*_+Ct*H,B[2]=q*lt+ut*dt,B[3]=at*lt+Ct*dt,B[4]=q*wt+ut*Et+R,B[5]=at*wt+Ct*Et+$,B;}function M(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=Math.sin(G),H=Math.cos(G);return B[0]=q*H+ut*_,B[1]=at*H+Ct*_,B[2]=q*-_+ut*H,B[3]=at*-_+Ct*H,B[4]=R,B[5]=$,B;}function L(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=G[0],H=G[1];return B[0]=q*_,B[1]=at*_,B[2]=ut*H,B[3]=Ct*H,B[4]=R,B[5]=$,B;}function X(B,N,G){var q=N[0],at=N[1],ut=N[2],Ct=N[3],R=N[4],$=N[5],_=G[0],H=G[1];return B[0]=q,B[1]=at,B[2]=ut,B[3]=Ct,B[4]=q*_+ut*H+R,B[5]=at*_+Ct*H+$,B;}function Y(B,N){var G=Math.sin(N),q=Math.cos(N);return B[0]=q,B[1]=G,B[2]=-G,B[3]=q,B[4]=0,B[5]=0,B;}function et(B,N){return B[0]=N[0],B[1]=0,B[2]=0,B[3]=N[1],B[4]=0,B[5]=0,B;}function A(B,N){return B[0]=1,B[1]=0,B[2]=0,B[3]=1,B[4]=N[0],B[5]=N[1],B;}function w(B){return"mat2d("+B[0]+", "+B[1]+", "+B[2]+", "+B[3]+", "+B[4]+", "+B[5]+")";}function S(B){return Math.hypot(B[0],B[1],B[2],B[3],B[4],B[5],1);}function x(B,N,G){return B[0]=N[0]+G[0],B[1]=N[1]+G[1],B[2]=N[2]+G[2],B[3]=N[3]+G[3],B[4]=N[4]+G[4],B[5]=N[5]+G[5],B;}function P(B,N,G){return B[0]=N[0]-G[0],B[1]=N[1]-G[1],B[2]=N[2]-G[2],B[3]=N[3]-G[3],B[4]=N[4]-G[4],B[5]=N[5]-G[5],B;}function z(B,N,G){return B[0]=N[0]*G,B[1]=N[1]*G,B[2]=N[2]*G,B[3]=N[3]*G,B[4]=N[4]*G,B[5]=N[5]*G,B;}function U(B,N,G,q){return B[0]=N[0]+G[0]*q,B[1]=N[1]+G[1]*q,B[2]=N[2]+G[2]*q,B[3]=N[3]+G[3]*q,B[4]=N[4]+G[4]*q,B[5]=N[5]+G[5]*q,B;}function K(B,N){return B[0]===N[0]&&B[1]===N[1]&&B[2]===N[2]&&B[3]===N[3]&&B[4]===N[4]&&B[5]===N[5];}function j(B,N){var G=B[0],q=B[1],at=B[2],ut=B[3],Ct=B[4],R=B[5],$=N[0],_=N[1],H=N[2],lt=N[3],dt=N[4],wt=N[5];return Math.abs(G-$)<=s.EPSILON*Math.max(1,Math.abs(G),Math.abs($))&&Math.abs(q-_)<=s.EPSILON*Math.max(1,Math.abs(q),Math.abs(_))&&Math.abs(at-H)<=s.EPSILON*Math.max(1,Math.abs(at),Math.abs(H))&&Math.abs(ut-lt)<=s.EPSILON*Math.max(1,Math.abs(ut),Math.abs(lt))&&Math.abs(Ct-dt)<=s.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(dt))&&Math.abs(R-wt)<=s.EPSILON*Math.max(1,Math.abs(R),Math.abs(wt));}var nt=b,ct=P;},/* 5 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"fromMat4",function(){return a;}),i.d(n,"clone",function(){return u;}),i.d(n,"copy",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"identity",function(){return y;}),i.d(n,"transpose",function(){return C;}),i.d(n,"invert",function(){return b;}),i.d(n,"adjoint",function(){return M;}),i.d(n,"determinant",function(){return L;}),i.d(n,"multiply",function(){return X;}),i.d(n,"translate",function(){return Y;}),i.d(n,"rotate",function(){return et;}),i.d(n,"scale",function(){return A;}),i.d(n,"fromTranslation",function(){return w;}),i.d(n,"fromRotation",function(){return S;}),i.d(n,"fromScaling",function(){return x;}),i.d(n,"fromMat2d",function(){return P;}),i.d(n,"fromQuat",function(){return z;}),i.d(n,"normalFromMat4",function(){return U;}),i.d(n,"projection",function(){return K;}),i.d(n,"str",function(){return j;}),i.d(n,"frob",function(){return nt;}),i.d(n,"add",function(){return ct;}),i.d(n,"subtract",function(){return B;}),i.d(n,"multiplyScalar",function(){return N;}),i.d(n,"multiplyScalarAndAdd",function(){return G;}),i.d(n,"exactEquals",function(){return q;}),i.d(n,"equals",function(){return at;}),i.d(n,"mul",function(){return ut;}),i.d(n,"sub",function(){return Ct;});var s=i(2);function o(){var R=new s.ARRAY_TYPE(9);return s.ARRAY_TYPE!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R;}function a(R,$){return R[0]=$[0],R[1]=$[1],R[2]=$[2],R[3]=$[4],R[4]=$[5],R[5]=$[6],R[6]=$[8],R[7]=$[9],R[8]=$[10],R;}function u(R){var $=new s.ARRAY_TYPE(9);return $[0]=R[0],$[1]=R[1],$[2]=R[2],$[3]=R[3],$[4]=R[4],$[5]=R[5],$[6]=R[6],$[7]=R[7],$[8]=R[8],$;}function h(R,$){return R[0]=$[0],R[1]=$[1],R[2]=$[2],R[3]=$[3],R[4]=$[4],R[5]=$[5],R[6]=$[6],R[7]=$[7],R[8]=$[8],R;}function v(R,$,_,H,lt,dt,wt,Et,Ot){var O=new s.ARRAY_TYPE(9);return O[0]=R,O[1]=$,O[2]=_,O[3]=H,O[4]=lt,O[5]=dt,O[6]=wt,O[7]=Et,O[8]=Ot,O;}function p(R,$,_,H,lt,dt,wt,Et,Ot,O){return R[0]=$,R[1]=_,R[2]=H,R[3]=lt,R[4]=dt,R[5]=wt,R[6]=Et,R[7]=Ot,R[8]=O,R;}function y(R){return R[0]=1,R[1]=0,R[2]=0,R[3]=0,R[4]=1,R[5]=0,R[6]=0,R[7]=0,R[8]=1,R;}function C(R,$){if(R===$){var _=$[1],H=$[2],lt=$[5];R[1]=$[3],R[2]=$[6],R[3]=_,R[5]=$[7],R[6]=H,R[7]=lt;}else R[0]=$[0],R[1]=$[3],R[2]=$[6],R[3]=$[1],R[4]=$[4],R[5]=$[7],R[6]=$[2],R[7]=$[5],R[8]=$[8];return R;}function b(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=$[4],Et=$[5],Ot=$[6],O=$[7],D=$[8],J=D*wt-Et*O,Q=-D*dt+Et*Ot,V=O*dt-wt*Ot,tt=_*J+H*Q+lt*V;return tt?(tt=1/tt,R[0]=J*tt,R[1]=(-D*H+lt*O)*tt,R[2]=(Et*H-lt*wt)*tt,R[3]=Q*tt,R[4]=(D*_-lt*Ot)*tt,R[5]=(-Et*_+lt*dt)*tt,R[6]=V*tt,R[7]=(-O*_+H*Ot)*tt,R[8]=(wt*_-H*dt)*tt,R):null;}function M(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=$[4],Et=$[5],Ot=$[6],O=$[7],D=$[8];return R[0]=wt*D-Et*O,R[1]=lt*O-H*D,R[2]=H*Et-lt*wt,R[3]=Et*Ot-dt*D,R[4]=_*D-lt*Ot,R[5]=lt*dt-_*Et,R[6]=dt*O-wt*Ot,R[7]=H*Ot-_*O,R[8]=_*wt-H*dt,R;}function L(R){var $=R[0],_=R[1],H=R[2],lt=R[3],dt=R[4],wt=R[5],Et=R[6],Ot=R[7],O=R[8];return $*(O*dt-wt*Ot)+_*(-O*lt+wt*Et)+H*(Ot*lt-dt*Et);}function X(R,$,_){var H=$[0],lt=$[1],dt=$[2],wt=$[3],Et=$[4],Ot=$[5],O=$[6],D=$[7],J=$[8],Q=_[0],V=_[1],tt=_[2],g=_[3],T=_[4],k=_[5],Z=_[6],st=_[7],ft=_[8];return R[0]=Q*H+V*wt+tt*O,R[1]=Q*lt+V*Et+tt*D,R[2]=Q*dt+V*Ot+tt*J,R[3]=g*H+T*wt+k*O,R[4]=g*lt+T*Et+k*D,R[5]=g*dt+T*Ot+k*J,R[6]=Z*H+st*wt+ft*O,R[7]=Z*lt+st*Et+ft*D,R[8]=Z*dt+st*Ot+ft*J,R;}function Y(R,$,_){var H=$[0],lt=$[1],dt=$[2],wt=$[3],Et=$[4],Ot=$[5],O=$[6],D=$[7],J=$[8],Q=_[0],V=_[1];return R[0]=H,R[1]=lt,R[2]=dt,R[3]=wt,R[4]=Et,R[5]=Ot,R[6]=Q*H+V*wt+O,R[7]=Q*lt+V*Et+D,R[8]=Q*dt+V*Ot+J,R;}function et(R,$,_){var H=$[0],lt=$[1],dt=$[2],wt=$[3],Et=$[4],Ot=$[5],O=$[6],D=$[7],J=$[8],Q=Math.sin(_),V=Math.cos(_);return R[0]=V*H+Q*wt,R[1]=V*lt+Q*Et,R[2]=V*dt+Q*Ot,R[3]=V*wt-Q*H,R[4]=V*Et-Q*lt,R[5]=V*Ot-Q*dt,R[6]=O,R[7]=D,R[8]=J,R;}function A(R,$,_){var H=_[0],lt=_[1];return R[0]=H*$[0],R[1]=H*$[1],R[2]=H*$[2],R[3]=lt*$[3],R[4]=lt*$[4],R[5]=lt*$[5],R[6]=$[6],R[7]=$[7],R[8]=$[8],R;}function w(R,$){return R[0]=1,R[1]=0,R[2]=0,R[3]=0,R[4]=1,R[5]=0,R[6]=$[0],R[7]=$[1],R[8]=1,R;}function S(R,$){var _=Math.sin($),H=Math.cos($);return R[0]=H,R[1]=_,R[2]=0,R[3]=-_,R[4]=H,R[5]=0,R[6]=0,R[7]=0,R[8]=1,R;}function x(R,$){return R[0]=$[0],R[1]=0,R[2]=0,R[3]=0,R[4]=$[1],R[5]=0,R[6]=0,R[7]=0,R[8]=1,R;}function P(R,$){return R[0]=$[0],R[1]=$[1],R[2]=0,R[3]=$[2],R[4]=$[3],R[5]=0,R[6]=$[4],R[7]=$[5],R[8]=1,R;}function z(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=_+_,Et=H+H,Ot=lt+lt,O=_*wt,D=H*wt,J=H*Et,Q=lt*wt,V=lt*Et,tt=lt*Ot,g=dt*wt,T=dt*Et,k=dt*Ot;return R[0]=1-J-tt,R[3]=D-k,R[6]=Q+T,R[1]=D+k,R[4]=1-O-tt,R[7]=V-g,R[2]=Q-T,R[5]=V+g,R[8]=1-O-J,R;}function U(R,$){var _=$[0],H=$[1],lt=$[2],dt=$[3],wt=$[4],Et=$[5],Ot=$[6],O=$[7],D=$[8],J=$[9],Q=$[10],V=$[11],tt=$[12],g=$[13],T=$[14],k=$[15],Z=_*Et-H*wt,st=_*Ot-lt*wt,ft=_*O-dt*wt,pt=H*Ot-lt*Et,ot=H*O-dt*Et,mt=lt*O-dt*Ot,It=D*g-J*tt,Pt=D*T-Q*tt,Lt=D*k-V*tt,Dt=J*T-Q*g,Nt=J*k-V*g,Yt=Q*k-V*T,Ut=Z*Yt-st*Nt+ft*Dt+pt*Lt-ot*Pt+mt*It;return Ut?(Ut=1/Ut,R[0]=(Et*Yt-Ot*Nt+O*Dt)*Ut,R[1]=(Ot*Lt-wt*Yt-O*Pt)*Ut,R[2]=(wt*Nt-Et*Lt+O*It)*Ut,R[3]=(lt*Nt-H*Yt-dt*Dt)*Ut,R[4]=(_*Yt-lt*Lt+dt*Pt)*Ut,R[5]=(H*Lt-_*Nt-dt*It)*Ut,R[6]=(g*mt-T*ot+k*pt)*Ut,R[7]=(T*ft-tt*mt-k*st)*Ut,R[8]=(tt*ot-g*ft+k*Z)*Ut,R):null;}function K(R,$,_){return R[0]=2/$,R[1]=0,R[2]=0,R[3]=0,R[4]=-2/_,R[5]=0,R[6]=-1,R[7]=1,R[8]=1,R;}function j(R){return"mat3("+R[0]+", "+R[1]+", "+R[2]+", "+R[3]+", "+R[4]+", "+R[5]+", "+R[6]+", "+R[7]+", "+R[8]+")";}function nt(R){return Math.hypot(R[0],R[1],R[2],R[3],R[4],R[5],R[6],R[7],R[8]);}function ct(R,$,_){return R[0]=$[0]+_[0],R[1]=$[1]+_[1],R[2]=$[2]+_[2],R[3]=$[3]+_[3],R[4]=$[4]+_[4],R[5]=$[5]+_[5],R[6]=$[6]+_[6],R[7]=$[7]+_[7],R[8]=$[8]+_[8],R;}function B(R,$,_){return R[0]=$[0]-_[0],R[1]=$[1]-_[1],R[2]=$[2]-_[2],R[3]=$[3]-_[3],R[4]=$[4]-_[4],R[5]=$[5]-_[5],R[6]=$[6]-_[6],R[7]=$[7]-_[7],R[8]=$[8]-_[8],R;}function N(R,$,_){return R[0]=$[0]*_,R[1]=$[1]*_,R[2]=$[2]*_,R[3]=$[3]*_,R[4]=$[4]*_,R[5]=$[5]*_,R[6]=$[6]*_,R[7]=$[7]*_,R[8]=$[8]*_,R;}function G(R,$,_,H){return R[0]=$[0]+_[0]*H,R[1]=$[1]+_[1]*H,R[2]=$[2]+_[2]*H,R[3]=$[3]+_[3]*H,R[4]=$[4]+_[4]*H,R[5]=$[5]+_[5]*H,R[6]=$[6]+_[6]*H,R[7]=$[7]+_[7]*H,R[8]=$[8]+_[8]*H,R;}function q(R,$){return R[0]===$[0]&&R[1]===$[1]&&R[2]===$[2]&&R[3]===$[3]&&R[4]===$[4]&&R[5]===$[5]&&R[6]===$[6]&&R[7]===$[7]&&R[8]===$[8];}function at(R,$){var _=R[0],H=R[1],lt=R[2],dt=R[3],wt=R[4],Et=R[5],Ot=R[6],O=R[7],D=R[8],J=$[0],Q=$[1],V=$[2],tt=$[3],g=$[4],T=$[5],k=$[6],Z=$[7],st=$[8];return Math.abs(_-J)<=s.EPSILON*Math.max(1,Math.abs(_),Math.abs(J))&&Math.abs(H-Q)<=s.EPSILON*Math.max(1,Math.abs(H),Math.abs(Q))&&Math.abs(lt-V)<=s.EPSILON*Math.max(1,Math.abs(lt),Math.abs(V))&&Math.abs(dt-tt)<=s.EPSILON*Math.max(1,Math.abs(dt),Math.abs(tt))&&Math.abs(wt-g)<=s.EPSILON*Math.max(1,Math.abs(wt),Math.abs(g))&&Math.abs(Et-T)<=s.EPSILON*Math.max(1,Math.abs(Et),Math.abs(T))&&Math.abs(Ot-k)<=s.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(k))&&Math.abs(O-Z)<=s.EPSILON*Math.max(1,Math.abs(O),Math.abs(Z))&&Math.abs(D-st)<=s.EPSILON*Math.max(1,Math.abs(D),Math.abs(st));}var ut=X,Ct=B;},/* 6 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"copy",function(){return u;}),i.d(n,"fromValues",function(){return h;}),i.d(n,"set",function(){return v;}),i.d(n,"identity",function(){return p;}),i.d(n,"transpose",function(){return y;}),i.d(n,"invert",function(){return C;}),i.d(n,"adjoint",function(){return b;}),i.d(n,"determinant",function(){return M;}),i.d(n,"multiply",function(){return L;}),i.d(n,"translate",function(){return X;}),i.d(n,"scale",function(){return Y;}),i.d(n,"rotate",function(){return et;}),i.d(n,"rotateX",function(){return A;}),i.d(n,"rotateY",function(){return w;}),i.d(n,"rotateZ",function(){return S;}),i.d(n,"fromTranslation",function(){return x;}),i.d(n,"fromScaling",function(){return P;}),i.d(n,"fromRotation",function(){return z;}),i.d(n,"fromXRotation",function(){return U;}),i.d(n,"fromYRotation",function(){return K;}),i.d(n,"fromZRotation",function(){return j;}),i.d(n,"fromRotationTranslation",function(){return nt;}),i.d(n,"fromQuat2",function(){return ct;}),i.d(n,"getTranslation",function(){return B;}),i.d(n,"getScaling",function(){return N;}),i.d(n,"getRotation",function(){return G;}),i.d(n,"fromRotationTranslationScale",function(){return q;}),i.d(n,"fromRotationTranslationScaleOrigin",function(){return at;}),i.d(n,"fromQuat",function(){return ut;}),i.d(n,"frustum",function(){return Ct;}),i.d(n,"perspective",function(){return R;}),i.d(n,"perspectiveFromFieldOfView",function(){return $;}),i.d(n,"ortho",function(){return _;}),i.d(n,"lookAt",function(){return H;}),i.d(n,"targetTo",function(){return lt;}),i.d(n,"str",function(){return dt;}),i.d(n,"frob",function(){return wt;}),i.d(n,"add",function(){return Et;}),i.d(n,"subtract",function(){return Ot;}),i.d(n,"multiplyScalar",function(){return O;}),i.d(n,"multiplyScalarAndAdd",function(){return D;}),i.d(n,"exactEquals",function(){return J;}),i.d(n,"equals",function(){return Q;}),i.d(n,"mul",function(){return V;}),i.d(n,"sub",function(){return tt;});var s=i(2);function o(){var g=new s.ARRAY_TYPE(16);return s.ARRAY_TYPE!=Float32Array&&(g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=0,g[12]=0,g[13]=0,g[14]=0),g[0]=1,g[5]=1,g[10]=1,g[15]=1,g;}function a(g){var T=new s.ARRAY_TYPE(16);return T[0]=g[0],T[1]=g[1],T[2]=g[2],T[3]=g[3],T[4]=g[4],T[5]=g[5],T[6]=g[6],T[7]=g[7],T[8]=g[8],T[9]=g[9],T[10]=g[10],T[11]=g[11],T[12]=g[12],T[13]=g[13],T[14]=g[14],T[15]=g[15],T;}function u(g,T){return g[0]=T[0],g[1]=T[1],g[2]=T[2],g[3]=T[3],g[4]=T[4],g[5]=T[5],g[6]=T[6],g[7]=T[7],g[8]=T[8],g[9]=T[9],g[10]=T[10],g[11]=T[11],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15],g;}function h(g,T,k,Z,st,ft,pt,ot,mt,It,Pt,Lt,Dt,Nt,Yt,Ut){var Ft=new s.ARRAY_TYPE(16);return Ft[0]=g,Ft[1]=T,Ft[2]=k,Ft[3]=Z,Ft[4]=st,Ft[5]=ft,Ft[6]=pt,Ft[7]=ot,Ft[8]=mt,Ft[9]=It,Ft[10]=Pt,Ft[11]=Lt,Ft[12]=Dt,Ft[13]=Nt,Ft[14]=Yt,Ft[15]=Ut,Ft;}function v(g,T,k,Z,st,ft,pt,ot,mt,It,Pt,Lt,Dt,Nt,Yt,Ut,Ft){return g[0]=T,g[1]=k,g[2]=Z,g[3]=st,g[4]=ft,g[5]=pt,g[6]=ot,g[7]=mt,g[8]=It,g[9]=Pt,g[10]=Lt,g[11]=Dt,g[12]=Nt,g[13]=Yt,g[14]=Ut,g[15]=Ft,g;}function p(g){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function y(g,T){if(g===T){var k=T[1],Z=T[2],st=T[3],ft=T[6],pt=T[7],ot=T[11];g[1]=T[4],g[2]=T[8],g[3]=T[12],g[4]=k,g[6]=T[9],g[7]=T[13],g[8]=Z,g[9]=ft,g[11]=T[14],g[12]=st,g[13]=pt,g[14]=ot;}else g[0]=T[0],g[1]=T[4],g[2]=T[8],g[3]=T[12],g[4]=T[1],g[5]=T[5],g[6]=T[9],g[7]=T[13],g[8]=T[2],g[9]=T[6],g[10]=T[10],g[11]=T[14],g[12]=T[3],g[13]=T[7],g[14]=T[11],g[15]=T[15];return g;}function C(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[3],pt=T[4],ot=T[5],mt=T[6],It=T[7],Pt=T[8],Lt=T[9],Dt=T[10],Nt=T[11],Yt=T[12],Ut=T[13],Ft=T[14],Jt=T[15],ee=k*ot-Z*pt,re=k*mt-st*pt,se=k*It-ft*pt,oe=Z*mt-st*ot,le=Z*It-ft*ot,Re=st*It-ft*mt,Oe=Pt*Ut-Lt*Yt,ke=Pt*Ft-Dt*Yt,Be=Pt*Jt-Nt*Yt,Ge=Lt*Ft-Dt*Ut,He=Lt*Jt-Nt*Ut,je=Dt*Jt-Nt*Ft,ye=ee*je-re*He+se*Ge+oe*Be-le*ke+Re*Oe;return ye?(ye=1/ye,g[0]=(ot*je-mt*He+It*Ge)*ye,g[1]=(st*He-Z*je-ft*Ge)*ye,g[2]=(Ut*Re-Ft*le+Jt*oe)*ye,g[3]=(Dt*le-Lt*Re-Nt*oe)*ye,g[4]=(mt*Be-pt*je-It*ke)*ye,g[5]=(k*je-st*Be+ft*ke)*ye,g[6]=(Ft*se-Yt*Re-Jt*re)*ye,g[7]=(Pt*Re-Dt*se+Nt*re)*ye,g[8]=(pt*He-ot*Be+It*Oe)*ye,g[9]=(Z*Be-k*He-ft*Oe)*ye,g[10]=(Yt*le-Ut*se+Jt*ee)*ye,g[11]=(Lt*se-Pt*le-Nt*ee)*ye,g[12]=(ot*ke-pt*Ge-mt*Oe)*ye,g[13]=(k*Ge-Z*ke+st*Oe)*ye,g[14]=(Ut*re-Yt*oe-Ft*ee)*ye,g[15]=(Pt*oe-Lt*re+Dt*ee)*ye,g):null;}function b(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[3],pt=T[4],ot=T[5],mt=T[6],It=T[7],Pt=T[8],Lt=T[9],Dt=T[10],Nt=T[11],Yt=T[12],Ut=T[13],Ft=T[14],Jt=T[15];return g[0]=ot*(Dt*Jt-Nt*Ft)-Lt*(mt*Jt-It*Ft)+Ut*(mt*Nt-It*Dt),g[1]=-(Z*(Dt*Jt-Nt*Ft)-Lt*(st*Jt-ft*Ft)+Ut*(st*Nt-ft*Dt)),g[2]=Z*(mt*Jt-It*Ft)-ot*(st*Jt-ft*Ft)+Ut*(st*It-ft*mt),g[3]=-(Z*(mt*Nt-It*Dt)-ot*(st*Nt-ft*Dt)+Lt*(st*It-ft*mt)),g[4]=-(pt*(Dt*Jt-Nt*Ft)-Pt*(mt*Jt-It*Ft)+Yt*(mt*Nt-It*Dt)),g[5]=k*(Dt*Jt-Nt*Ft)-Pt*(st*Jt-ft*Ft)+Yt*(st*Nt-ft*Dt),g[6]=-(k*(mt*Jt-It*Ft)-pt*(st*Jt-ft*Ft)+Yt*(st*It-ft*mt)),g[7]=k*(mt*Nt-It*Dt)-pt*(st*Nt-ft*Dt)+Pt*(st*It-ft*mt),g[8]=pt*(Lt*Jt-Nt*Ut)-Pt*(ot*Jt-It*Ut)+Yt*(ot*Nt-It*Lt),g[9]=-(k*(Lt*Jt-Nt*Ut)-Pt*(Z*Jt-ft*Ut)+Yt*(Z*Nt-ft*Lt)),g[10]=k*(ot*Jt-It*Ut)-pt*(Z*Jt-ft*Ut)+Yt*(Z*It-ft*ot),g[11]=-(k*(ot*Nt-It*Lt)-pt*(Z*Nt-ft*Lt)+Pt*(Z*It-ft*ot)),g[12]=-(pt*(Lt*Ft-Dt*Ut)-Pt*(ot*Ft-mt*Ut)+Yt*(ot*Dt-mt*Lt)),g[13]=k*(Lt*Ft-Dt*Ut)-Pt*(Z*Ft-st*Ut)+Yt*(Z*Dt-st*Lt),g[14]=-(k*(ot*Ft-mt*Ut)-pt*(Z*Ft-st*Ut)+Yt*(Z*mt-st*ot)),g[15]=k*(ot*Dt-mt*Lt)-pt*(Z*Dt-st*Lt)+Pt*(Z*mt-st*ot),g;}function M(g){var T=g[0],k=g[1],Z=g[2],st=g[3],ft=g[4],pt=g[5],ot=g[6],mt=g[7],It=g[8],Pt=g[9],Lt=g[10],Dt=g[11],Nt=g[12],Yt=g[13],Ut=g[14],Ft=g[15],Jt=T*pt-k*ft,ee=T*ot-Z*ft,re=T*mt-st*ft,se=k*ot-Z*pt,oe=k*mt-st*pt,le=Z*mt-st*ot,Re=It*Yt-Pt*Nt,Oe=It*Ut-Lt*Nt,ke=It*Ft-Dt*Nt,Be=Pt*Ut-Lt*Yt,Ge=Pt*Ft-Dt*Yt,He=Lt*Ft-Dt*Ut;return Jt*He-ee*Ge+re*Be+se*ke-oe*Oe+le*Re;}function L(g,T,k){var Z=T[0],st=T[1],ft=T[2],pt=T[3],ot=T[4],mt=T[5],It=T[6],Pt=T[7],Lt=T[8],Dt=T[9],Nt=T[10],Yt=T[11],Ut=T[12],Ft=T[13],Jt=T[14],ee=T[15],re=k[0],se=k[1],oe=k[2],le=k[3];return g[0]=re*Z+se*ot+oe*Lt+le*Ut,g[1]=re*st+se*mt+oe*Dt+le*Ft,g[2]=re*ft+se*It+oe*Nt+le*Jt,g[3]=re*pt+se*Pt+oe*Yt+le*ee,re=k[4],se=k[5],oe=k[6],le=k[7],g[4]=re*Z+se*ot+oe*Lt+le*Ut,g[5]=re*st+se*mt+oe*Dt+le*Ft,g[6]=re*ft+se*It+oe*Nt+le*Jt,g[7]=re*pt+se*Pt+oe*Yt+le*ee,re=k[8],se=k[9],oe=k[10],le=k[11],g[8]=re*Z+se*ot+oe*Lt+le*Ut,g[9]=re*st+se*mt+oe*Dt+le*Ft,g[10]=re*ft+se*It+oe*Nt+le*Jt,g[11]=re*pt+se*Pt+oe*Yt+le*ee,re=k[12],se=k[13],oe=k[14],le=k[15],g[12]=re*Z+se*ot+oe*Lt+le*Ut,g[13]=re*st+se*mt+oe*Dt+le*Ft,g[14]=re*ft+se*It+oe*Nt+le*Jt,g[15]=re*pt+se*Pt+oe*Yt+le*ee,g;}function X(g,T,k){var Z=k[0],st=k[1],ft=k[2],pt,ot,mt,It,Pt,Lt,Dt,Nt,Yt,Ut,Ft,Jt;return T===g?(g[12]=T[0]*Z+T[4]*st+T[8]*ft+T[12],g[13]=T[1]*Z+T[5]*st+T[9]*ft+T[13],g[14]=T[2]*Z+T[6]*st+T[10]*ft+T[14],g[15]=T[3]*Z+T[7]*st+T[11]*ft+T[15]):(pt=T[0],ot=T[1],mt=T[2],It=T[3],Pt=T[4],Lt=T[5],Dt=T[6],Nt=T[7],Yt=T[8],Ut=T[9],Ft=T[10],Jt=T[11],g[0]=pt,g[1]=ot,g[2]=mt,g[3]=It,g[4]=Pt,g[5]=Lt,g[6]=Dt,g[7]=Nt,g[8]=Yt,g[9]=Ut,g[10]=Ft,g[11]=Jt,g[12]=pt*Z+Pt*st+Yt*ft+T[12],g[13]=ot*Z+Lt*st+Ut*ft+T[13],g[14]=mt*Z+Dt*st+Ft*ft+T[14],g[15]=It*Z+Nt*st+Jt*ft+T[15]),g;}function Y(g,T,k){var Z=k[0],st=k[1],ft=k[2];return g[0]=T[0]*Z,g[1]=T[1]*Z,g[2]=T[2]*Z,g[3]=T[3]*Z,g[4]=T[4]*st,g[5]=T[5]*st,g[6]=T[6]*st,g[7]=T[7]*st,g[8]=T[8]*ft,g[9]=T[9]*ft,g[10]=T[10]*ft,g[11]=T[11]*ft,g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15],g;}function et(g,T,k,Z){var st=Z[0],ft=Z[1],pt=Z[2],ot=Math.hypot(st,ft,pt),mt,It,Pt,Lt,Dt,Nt,Yt,Ut,Ft,Jt,ee,re,se,oe,le,Re,Oe,ke,Be,Ge,He,je,ye,lr;return ot<s.EPSILON?null:(ot=1/ot,st*=ot,ft*=ot,pt*=ot,mt=Math.sin(k),It=Math.cos(k),Pt=1-It,Lt=T[0],Dt=T[1],Nt=T[2],Yt=T[3],Ut=T[4],Ft=T[5],Jt=T[6],ee=T[7],re=T[8],se=T[9],oe=T[10],le=T[11],Re=st*st*Pt+It,Oe=ft*st*Pt+pt*mt,ke=pt*st*Pt-ft*mt,Be=st*ft*Pt-pt*mt,Ge=ft*ft*Pt+It,He=pt*ft*Pt+st*mt,je=st*pt*Pt+ft*mt,ye=ft*pt*Pt-st*mt,lr=pt*pt*Pt+It,g[0]=Lt*Re+Ut*Oe+re*ke,g[1]=Dt*Re+Ft*Oe+se*ke,g[2]=Nt*Re+Jt*Oe+oe*ke,g[3]=Yt*Re+ee*Oe+le*ke,g[4]=Lt*Be+Ut*Ge+re*He,g[5]=Dt*Be+Ft*Ge+se*He,g[6]=Nt*Be+Jt*Ge+oe*He,g[7]=Yt*Be+ee*Ge+le*He,g[8]=Lt*je+Ut*ye+re*lr,g[9]=Dt*je+Ft*ye+se*lr,g[10]=Nt*je+Jt*ye+oe*lr,g[11]=Yt*je+ee*ye+le*lr,T!==g&&(g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g);}function A(g,T,k){var Z=Math.sin(k),st=Math.cos(k),ft=T[4],pt=T[5],ot=T[6],mt=T[7],It=T[8],Pt=T[9],Lt=T[10],Dt=T[11];return T!==g&&(g[0]=T[0],g[1]=T[1],g[2]=T[2],g[3]=T[3],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g[4]=ft*st+It*Z,g[5]=pt*st+Pt*Z,g[6]=ot*st+Lt*Z,g[7]=mt*st+Dt*Z,g[8]=It*st-ft*Z,g[9]=Pt*st-pt*Z,g[10]=Lt*st-ot*Z,g[11]=Dt*st-mt*Z,g;}function w(g,T,k){var Z=Math.sin(k),st=Math.cos(k),ft=T[0],pt=T[1],ot=T[2],mt=T[3],It=T[8],Pt=T[9],Lt=T[10],Dt=T[11];return T!==g&&(g[4]=T[4],g[5]=T[5],g[6]=T[6],g[7]=T[7],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g[0]=ft*st-It*Z,g[1]=pt*st-Pt*Z,g[2]=ot*st-Lt*Z,g[3]=mt*st-Dt*Z,g[8]=ft*Z+It*st,g[9]=pt*Z+Pt*st,g[10]=ot*Z+Lt*st,g[11]=mt*Z+Dt*st,g;}function S(g,T,k){var Z=Math.sin(k),st=Math.cos(k),ft=T[0],pt=T[1],ot=T[2],mt=T[3],It=T[4],Pt=T[5],Lt=T[6],Dt=T[7];return T!==g&&(g[8]=T[8],g[9]=T[9],g[10]=T[10],g[11]=T[11],g[12]=T[12],g[13]=T[13],g[14]=T[14],g[15]=T[15]),g[0]=ft*st+It*Z,g[1]=pt*st+Pt*Z,g[2]=ot*st+Lt*Z,g[3]=mt*st+Dt*Z,g[4]=It*st-ft*Z,g[5]=Pt*st-pt*Z,g[6]=Lt*st-ot*Z,g[7]=Dt*st-mt*Z,g;}function x(g,T){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=T[0],g[13]=T[1],g[14]=T[2],g[15]=1,g;}function P(g,T){return g[0]=T[0],g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=T[1],g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=T[2],g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function z(g,T,k){var Z=k[0],st=k[1],ft=k[2],pt=Math.hypot(Z,st,ft),ot,mt,It;return pt<s.EPSILON?null:(pt=1/pt,Z*=pt,st*=pt,ft*=pt,ot=Math.sin(T),mt=Math.cos(T),It=1-mt,g[0]=Z*Z*It+mt,g[1]=st*Z*It+ft*ot,g[2]=ft*Z*It-st*ot,g[3]=0,g[4]=Z*st*It-ft*ot,g[5]=st*st*It+mt,g[6]=ft*st*It+Z*ot,g[7]=0,g[8]=Z*ft*It+st*ot,g[9]=st*ft*It-Z*ot,g[10]=ft*ft*It+mt,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g);}function U(g,T){var k=Math.sin(T),Z=Math.cos(T);return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=Z,g[6]=k,g[7]=0,g[8]=0,g[9]=-k,g[10]=Z,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function K(g,T){var k=Math.sin(T),Z=Math.cos(T);return g[0]=Z,g[1]=0,g[2]=-k,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=k,g[9]=0,g[10]=Z,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function j(g,T){var k=Math.sin(T),Z=Math.cos(T);return g[0]=Z,g[1]=k,g[2]=0,g[3]=0,g[4]=-k,g[5]=Z,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function nt(g,T,k){var Z=T[0],st=T[1],ft=T[2],pt=T[3],ot=Z+Z,mt=st+st,It=ft+ft,Pt=Z*ot,Lt=Z*mt,Dt=Z*It,Nt=st*mt,Yt=st*It,Ut=ft*It,Ft=pt*ot,Jt=pt*mt,ee=pt*It;return g[0]=1-(Nt+Ut),g[1]=Lt+ee,g[2]=Dt-Jt,g[3]=0,g[4]=Lt-ee,g[5]=1-(Pt+Ut),g[6]=Yt+Ft,g[7]=0,g[8]=Dt+Jt,g[9]=Yt-Ft,g[10]=1-(Pt+Nt),g[11]=0,g[12]=k[0],g[13]=k[1],g[14]=k[2],g[15]=1,g;}function ct(g,T){var k=new s.ARRAY_TYPE(3),Z=-T[0],st=-T[1],ft=-T[2],pt=T[3],ot=T[4],mt=T[5],It=T[6],Pt=T[7],Lt=Z*Z+st*st+ft*ft+pt*pt;return Lt>0?(k[0]=(ot*pt+Pt*Z+mt*ft-It*st)*2/Lt,k[1]=(mt*pt+Pt*st+It*Z-ot*ft)*2/Lt,k[2]=(It*pt+Pt*ft+ot*st-mt*Z)*2/Lt):(k[0]=(ot*pt+Pt*Z+mt*ft-It*st)*2,k[1]=(mt*pt+Pt*st+It*Z-ot*ft)*2,k[2]=(It*pt+Pt*ft+ot*st-mt*Z)*2),nt(g,T,k),g;}function B(g,T){return g[0]=T[12],g[1]=T[13],g[2]=T[14],g;}function N(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[4],pt=T[5],ot=T[6],mt=T[8],It=T[9],Pt=T[10];return g[0]=Math.hypot(k,Z,st),g[1]=Math.hypot(ft,pt,ot),g[2]=Math.hypot(mt,It,Pt),g;}function G(g,T){var k=new s.ARRAY_TYPE(3);N(k,T);var Z=1/k[0],st=1/k[1],ft=1/k[2],pt=T[0]*Z,ot=T[1]*st,mt=T[2]*ft,It=T[4]*Z,Pt=T[5]*st,Lt=T[6]*ft,Dt=T[8]*Z,Nt=T[9]*st,Yt=T[10]*ft,Ut=pt+Pt+Yt,Ft=0;return Ut>0?(Ft=Math.sqrt(Ut+1)*2,g[3]=0.25*Ft,g[0]=(Lt-Nt)/Ft,g[1]=(Dt-mt)/Ft,g[2]=(ot-It)/Ft):pt>Pt&&pt>Yt?(Ft=Math.sqrt(1+pt-Pt-Yt)*2,g[3]=(Lt-Nt)/Ft,g[0]=0.25*Ft,g[1]=(ot+It)/Ft,g[2]=(Dt+mt)/Ft):Pt>Yt?(Ft=Math.sqrt(1+Pt-pt-Yt)*2,g[3]=(Dt-mt)/Ft,g[0]=(ot+It)/Ft,g[1]=0.25*Ft,g[2]=(Lt+Nt)/Ft):(Ft=Math.sqrt(1+Yt-pt-Pt)*2,g[3]=(ot-It)/Ft,g[0]=(Dt+mt)/Ft,g[1]=(Lt+Nt)/Ft,g[2]=0.25*Ft),g;}function q(g,T,k,Z){var st=T[0],ft=T[1],pt=T[2],ot=T[3],mt=st+st,It=ft+ft,Pt=pt+pt,Lt=st*mt,Dt=st*It,Nt=st*Pt,Yt=ft*It,Ut=ft*Pt,Ft=pt*Pt,Jt=ot*mt,ee=ot*It,re=ot*Pt,se=Z[0],oe=Z[1],le=Z[2];return g[0]=(1-(Yt+Ft))*se,g[1]=(Dt+re)*se,g[2]=(Nt-ee)*se,g[3]=0,g[4]=(Dt-re)*oe,g[5]=(1-(Lt+Ft))*oe,g[6]=(Ut+Jt)*oe,g[7]=0,g[8]=(Nt+ee)*le,g[9]=(Ut-Jt)*le,g[10]=(1-(Lt+Yt))*le,g[11]=0,g[12]=k[0],g[13]=k[1],g[14]=k[2],g[15]=1,g;}function at(g,T,k,Z,st){var ft=T[0],pt=T[1],ot=T[2],mt=T[3],It=ft+ft,Pt=pt+pt,Lt=ot+ot,Dt=ft*It,Nt=ft*Pt,Yt=ft*Lt,Ut=pt*Pt,Ft=pt*Lt,Jt=ot*Lt,ee=mt*It,re=mt*Pt,se=mt*Lt,oe=Z[0],le=Z[1],Re=Z[2],Oe=st[0],ke=st[1],Be=st[2],Ge=(1-(Ut+Jt))*oe,He=(Nt+se)*oe,je=(Yt-re)*oe,ye=(Nt-se)*le,lr=(1-(Dt+Jt))*le,en=(Ft+ee)*le,rn=(Yt+re)*Re,Gn=(Ft-ee)*Re,jn=(1-(Dt+Ut))*Re;return g[0]=Ge,g[1]=He,g[2]=je,g[3]=0,g[4]=ye,g[5]=lr,g[6]=en,g[7]=0,g[8]=rn,g[9]=Gn,g[10]=jn,g[11]=0,g[12]=k[0]+Oe-(Ge*Oe+ye*ke+rn*Be),g[13]=k[1]+ke-(He*Oe+lr*ke+Gn*Be),g[14]=k[2]+Be-(je*Oe+en*ke+jn*Be),g[15]=1,g;}function ut(g,T){var k=T[0],Z=T[1],st=T[2],ft=T[3],pt=k+k,ot=Z+Z,mt=st+st,It=k*pt,Pt=Z*pt,Lt=Z*ot,Dt=st*pt,Nt=st*ot,Yt=st*mt,Ut=ft*pt,Ft=ft*ot,Jt=ft*mt;return g[0]=1-Lt-Yt,g[1]=Pt+Jt,g[2]=Dt-Ft,g[3]=0,g[4]=Pt-Jt,g[5]=1-It-Yt,g[6]=Nt+Ut,g[7]=0,g[8]=Dt+Ft,g[9]=Nt-Ut,g[10]=1-It-Lt,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g;}function Ct(g,T,k,Z,st,ft,pt){var ot=1/(k-T),mt=1/(st-Z),It=1/(ft-pt);return g[0]=ft*2*ot,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=ft*2*mt,g[6]=0,g[7]=0,g[8]=(k+T)*ot,g[9]=(st+Z)*mt,g[10]=(pt+ft)*It,g[11]=-1,g[12]=0,g[13]=0,g[14]=pt*ft*2*It,g[15]=0,g;}function R(g,T,k,Z,st){var ft=1/Math.tan(T/2),pt;return g[0]=ft/k,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=ft,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=-1,g[12]=0,g[13]=0,g[15]=0,st!=null&&st!==1/0?(pt=1/(Z-st),g[10]=(st+Z)*pt,g[14]=2*st*Z*pt):(g[10]=-1,g[14]=-2*Z),g;}function $(g,T,k,Z){var st=Math.tan(T.upDegrees*Math.PI/180),ft=Math.tan(T.downDegrees*Math.PI/180),pt=Math.tan(T.leftDegrees*Math.PI/180),ot=Math.tan(T.rightDegrees*Math.PI/180),mt=2/(pt+ot),It=2/(st+ft);return g[0]=mt,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=It,g[6]=0,g[7]=0,g[8]=-((pt-ot)*mt*0.5),g[9]=(st-ft)*It*0.5,g[10]=Z/(k-Z),g[11]=-1,g[12]=0,g[13]=0,g[14]=Z*k/(k-Z),g[15]=0,g;}function _(g,T,k,Z,st,ft,pt){var ot=1/(T-k),mt=1/(Z-st),It=1/(ft-pt);return g[0]=-2*ot,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=-2*mt,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=2*It,g[11]=0,g[12]=(T+k)*ot,g[13]=(st+Z)*mt,g[14]=(pt+ft)*It,g[15]=1,g;}function H(g,T,k,Z){var st,ft,pt,ot,mt,It,Pt,Lt,Dt,Nt,Yt=T[0],Ut=T[1],Ft=T[2],Jt=Z[0],ee=Z[1],re=Z[2],se=k[0],oe=k[1],le=k[2];return Math.abs(Yt-se)<s.EPSILON&&Math.abs(Ut-oe)<s.EPSILON&&Math.abs(Ft-le)<s.EPSILON?p(g):(Pt=Yt-se,Lt=Ut-oe,Dt=Ft-le,Nt=1/Math.hypot(Pt,Lt,Dt),Pt*=Nt,Lt*=Nt,Dt*=Nt,st=ee*Dt-re*Lt,ft=re*Pt-Jt*Dt,pt=Jt*Lt-ee*Pt,Nt=Math.hypot(st,ft,pt),Nt?(Nt=1/Nt,st*=Nt,ft*=Nt,pt*=Nt):(st=0,ft=0,pt=0),ot=Lt*pt-Dt*ft,mt=Dt*st-Pt*pt,It=Pt*ft-Lt*st,Nt=Math.hypot(ot,mt,It),Nt?(Nt=1/Nt,ot*=Nt,mt*=Nt,It*=Nt):(ot=0,mt=0,It=0),g[0]=st,g[1]=ot,g[2]=Pt,g[3]=0,g[4]=ft,g[5]=mt,g[6]=Lt,g[7]=0,g[8]=pt,g[9]=It,g[10]=Dt,g[11]=0,g[12]=-(st*Yt+ft*Ut+pt*Ft),g[13]=-(ot*Yt+mt*Ut+It*Ft),g[14]=-(Pt*Yt+Lt*Ut+Dt*Ft),g[15]=1,g);}function lt(g,T,k,Z){var st=T[0],ft=T[1],pt=T[2],ot=Z[0],mt=Z[1],It=Z[2],Pt=st-k[0],Lt=ft-k[1],Dt=pt-k[2],Nt=Pt*Pt+Lt*Lt+Dt*Dt;Nt>0&&(Nt=1/Math.sqrt(Nt),Pt*=Nt,Lt*=Nt,Dt*=Nt);var Yt=mt*Dt-It*Lt,Ut=It*Pt-ot*Dt,Ft=ot*Lt-mt*Pt;return Nt=Yt*Yt+Ut*Ut+Ft*Ft,Nt>0&&(Nt=1/Math.sqrt(Nt),Yt*=Nt,Ut*=Nt,Ft*=Nt),g[0]=Yt,g[1]=Ut,g[2]=Ft,g[3]=0,g[4]=Lt*Ft-Dt*Ut,g[5]=Dt*Yt-Pt*Ft,g[6]=Pt*Ut-Lt*Yt,g[7]=0,g[8]=Pt,g[9]=Lt,g[10]=Dt,g[11]=0,g[12]=st,g[13]=ft,g[14]=pt,g[15]=1,g;}function dt(g){return"mat4("+g[0]+", "+g[1]+", "+g[2]+", "+g[3]+", "+g[4]+", "+g[5]+", "+g[6]+", "+g[7]+", "+g[8]+", "+g[9]+", "+g[10]+", "+g[11]+", "+g[12]+", "+g[13]+", "+g[14]+", "+g[15]+")";}function wt(g){return Math.hypot(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]);}function Et(g,T,k){return g[0]=T[0]+k[0],g[1]=T[1]+k[1],g[2]=T[2]+k[2],g[3]=T[3]+k[3],g[4]=T[4]+k[4],g[5]=T[5]+k[5],g[6]=T[6]+k[6],g[7]=T[7]+k[7],g[8]=T[8]+k[8],g[9]=T[9]+k[9],g[10]=T[10]+k[10],g[11]=T[11]+k[11],g[12]=T[12]+k[12],g[13]=T[13]+k[13],g[14]=T[14]+k[14],g[15]=T[15]+k[15],g;}function Ot(g,T,k){return g[0]=T[0]-k[0],g[1]=T[1]-k[1],g[2]=T[2]-k[2],g[3]=T[3]-k[3],g[4]=T[4]-k[4],g[5]=T[5]-k[5],g[6]=T[6]-k[6],g[7]=T[7]-k[7],g[8]=T[8]-k[8],g[9]=T[9]-k[9],g[10]=T[10]-k[10],g[11]=T[11]-k[11],g[12]=T[12]-k[12],g[13]=T[13]-k[13],g[14]=T[14]-k[14],g[15]=T[15]-k[15],g;}function O(g,T,k){return g[0]=T[0]*k,g[1]=T[1]*k,g[2]=T[2]*k,g[3]=T[3]*k,g[4]=T[4]*k,g[5]=T[5]*k,g[6]=T[6]*k,g[7]=T[7]*k,g[8]=T[8]*k,g[9]=T[9]*k,g[10]=T[10]*k,g[11]=T[11]*k,g[12]=T[12]*k,g[13]=T[13]*k,g[14]=T[14]*k,g[15]=T[15]*k,g;}function D(g,T,k,Z){return g[0]=T[0]+k[0]*Z,g[1]=T[1]+k[1]*Z,g[2]=T[2]+k[2]*Z,g[3]=T[3]+k[3]*Z,g[4]=T[4]+k[4]*Z,g[5]=T[5]+k[5]*Z,g[6]=T[6]+k[6]*Z,g[7]=T[7]+k[7]*Z,g[8]=T[8]+k[8]*Z,g[9]=T[9]+k[9]*Z,g[10]=T[10]+k[10]*Z,g[11]=T[11]+k[11]*Z,g[12]=T[12]+k[12]*Z,g[13]=T[13]+k[13]*Z,g[14]=T[14]+k[14]*Z,g[15]=T[15]+k[15]*Z,g;}function J(g,T){return g[0]===T[0]&&g[1]===T[1]&&g[2]===T[2]&&g[3]===T[3]&&g[4]===T[4]&&g[5]===T[5]&&g[6]===T[6]&&g[7]===T[7]&&g[8]===T[8]&&g[9]===T[9]&&g[10]===T[10]&&g[11]===T[11]&&g[12]===T[12]&&g[13]===T[13]&&g[14]===T[14]&&g[15]===T[15];}function Q(g,T){var k=g[0],Z=g[1],st=g[2],ft=g[3],pt=g[4],ot=g[5],mt=g[6],It=g[7],Pt=g[8],Lt=g[9],Dt=g[10],Nt=g[11],Yt=g[12],Ut=g[13],Ft=g[14],Jt=g[15],ee=T[0],re=T[1],se=T[2],oe=T[3],le=T[4],Re=T[5],Oe=T[6],ke=T[7],Be=T[8],Ge=T[9],He=T[10],je=T[11],ye=T[12],lr=T[13],en=T[14],rn=T[15];return Math.abs(k-ee)<=s.EPSILON*Math.max(1,Math.abs(k),Math.abs(ee))&&Math.abs(Z-re)<=s.EPSILON*Math.max(1,Math.abs(Z),Math.abs(re))&&Math.abs(st-se)<=s.EPSILON*Math.max(1,Math.abs(st),Math.abs(se))&&Math.abs(ft-oe)<=s.EPSILON*Math.max(1,Math.abs(ft),Math.abs(oe))&&Math.abs(pt-le)<=s.EPSILON*Math.max(1,Math.abs(pt),Math.abs(le))&&Math.abs(ot-Re)<=s.EPSILON*Math.max(1,Math.abs(ot),Math.abs(Re))&&Math.abs(mt-Oe)<=s.EPSILON*Math.max(1,Math.abs(mt),Math.abs(Oe))&&Math.abs(It-ke)<=s.EPSILON*Math.max(1,Math.abs(It),Math.abs(ke))&&Math.abs(Pt-Be)<=s.EPSILON*Math.max(1,Math.abs(Pt),Math.abs(Be))&&Math.abs(Lt-Ge)<=s.EPSILON*Math.max(1,Math.abs(Lt),Math.abs(Ge))&&Math.abs(Dt-He)<=s.EPSILON*Math.max(1,Math.abs(Dt),Math.abs(He))&&Math.abs(Nt-je)<=s.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(je))&&Math.abs(Yt-ye)<=s.EPSILON*Math.max(1,Math.abs(Yt),Math.abs(ye))&&Math.abs(Ut-lr)<=s.EPSILON*Math.max(1,Math.abs(Ut),Math.abs(lr))&&Math.abs(Ft-en)<=s.EPSILON*Math.max(1,Math.abs(Ft),Math.abs(en))&&Math.abs(Jt-rn)<=s.EPSILON*Math.max(1,Math.abs(Jt),Math.abs(rn));}var V=L,tt=Ot;},/* 7 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return h;}),i.d(n,"identity",function(){return v;}),i.d(n,"setAxisAngle",function(){return p;}),i.d(n,"getAxisAngle",function(){return y;}),i.d(n,"getAngle",function(){return C;}),i.d(n,"multiply",function(){return b;}),i.d(n,"rotateX",function(){return M;}),i.d(n,"rotateY",function(){return L;}),i.d(n,"rotateZ",function(){return X;}),i.d(n,"calculateW",function(){return Y;}),i.d(n,"exp",function(){return et;}),i.d(n,"ln",function(){return A;}),i.d(n,"pow",function(){return w;}),i.d(n,"slerp",function(){return S;}),i.d(n,"random",function(){return x;}),i.d(n,"invert",function(){return P;}),i.d(n,"conjugate",function(){return z;}),i.d(n,"fromMat3",function(){return U;}),i.d(n,"fromEuler",function(){return K;}),i.d(n,"str",function(){return j;}),i.d(n,"clone",function(){return nt;}),i.d(n,"fromValues",function(){return ct;}),i.d(n,"copy",function(){return B;}),i.d(n,"set",function(){return N;}),i.d(n,"add",function(){return G;}),i.d(n,"mul",function(){return q;}),i.d(n,"scale",function(){return at;}),i.d(n,"dot",function(){return ut;}),i.d(n,"lerp",function(){return Ct;}),i.d(n,"length",function(){return R;}),i.d(n,"len",function(){return $;}),i.d(n,"squaredLength",function(){return _;}),i.d(n,"sqrLen",function(){return H;}),i.d(n,"normalize",function(){return lt;}),i.d(n,"exactEquals",function(){return dt;}),i.d(n,"equals",function(){return wt;}),i.d(n,"rotationTo",function(){return Et;}),i.d(n,"sqlerp",function(){return Ot;}),i.d(n,"setAxes",function(){return O;});var s=i(2),o=i(5),a=i(8),u=i(9);function h(){var D=new s.ARRAY_TYPE(4);return s.ARRAY_TYPE!=Float32Array&&(D[0]=0,D[1]=0,D[2]=0),D[3]=1,D;}function v(D){return D[0]=0,D[1]=0,D[2]=0,D[3]=1,D;}function p(D,J,Q){Q=Q*0.5;var V=Math.sin(Q);return D[0]=V*J[0],D[1]=V*J[1],D[2]=V*J[2],D[3]=Math.cos(Q),D;}function y(D,J){var Q=Math.acos(J[3])*2,V=Math.sin(Q/2);return V>s.EPSILON?(D[0]=J[0]/V,D[1]=J[1]/V,D[2]=J[2]/V):(D[0]=1,D[1]=0,D[2]=0),Q;}function C(D,J){var Q=ut(D,J);return Math.acos(2*Q*Q-1);}function b(D,J,Q){var V=J[0],tt=J[1],g=J[2],T=J[3],k=Q[0],Z=Q[1],st=Q[2],ft=Q[3];return D[0]=V*ft+T*k+tt*st-g*Z,D[1]=tt*ft+T*Z+g*k-V*st,D[2]=g*ft+T*st+V*Z-tt*k,D[3]=T*ft-V*k-tt*Z-g*st,D;}function M(D,J,Q){Q*=0.5;var V=J[0],tt=J[1],g=J[2],T=J[3],k=Math.sin(Q),Z=Math.cos(Q);return D[0]=V*Z+T*k,D[1]=tt*Z+g*k,D[2]=g*Z-tt*k,D[3]=T*Z-V*k,D;}function L(D,J,Q){Q*=0.5;var V=J[0],tt=J[1],g=J[2],T=J[3],k=Math.sin(Q),Z=Math.cos(Q);return D[0]=V*Z-g*k,D[1]=tt*Z+T*k,D[2]=g*Z+V*k,D[3]=T*Z-tt*k,D;}function X(D,J,Q){Q*=0.5;var V=J[0],tt=J[1],g=J[2],T=J[3],k=Math.sin(Q),Z=Math.cos(Q);return D[0]=V*Z+tt*k,D[1]=tt*Z-V*k,D[2]=g*Z+T*k,D[3]=T*Z-g*k,D;}function Y(D,J){var Q=J[0],V=J[1],tt=J[2];return D[0]=Q,D[1]=V,D[2]=tt,D[3]=Math.sqrt(Math.abs(1-Q*Q-V*V-tt*tt)),D;}function et(D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=Math.sqrt(Q*Q+V*V+tt*tt),k=Math.exp(g),Z=T>0?k*Math.sin(T)/T:0;return D[0]=Q*Z,D[1]=V*Z,D[2]=tt*Z,D[3]=k*Math.cos(T),D;}function A(D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=Math.sqrt(Q*Q+V*V+tt*tt),k=T>0?Math.atan2(T,g)/T:0;return D[0]=Q*k,D[1]=V*k,D[2]=tt*k,D[3]=0.5*Math.log(Q*Q+V*V+tt*tt+g*g),D;}function w(D,J,Q){return A(D,J),at(D,D,Q),et(D,D),D;}function S(D,J,Q,V){var tt=J[0],g=J[1],T=J[2],k=J[3],Z=Q[0],st=Q[1],ft=Q[2],pt=Q[3],ot,mt,It,Pt,Lt;return mt=tt*Z+g*st+T*ft+k*pt,mt<0&&(mt=-mt,Z=-Z,st=-st,ft=-ft,pt=-pt),1-mt>s.EPSILON?(ot=Math.acos(mt),It=Math.sin(ot),Pt=Math.sin((1-V)*ot)/It,Lt=Math.sin(V*ot)/It):(Pt=1-V,Lt=V),D[0]=Pt*tt+Lt*Z,D[1]=Pt*g+Lt*st,D[2]=Pt*T+Lt*ft,D[3]=Pt*k+Lt*pt,D;}function x(D){var J=s.RANDOM(),Q=s.RANDOM(),V=s.RANDOM(),tt=Math.sqrt(1-J),g=Math.sqrt(J);return D[0]=tt*Math.sin(2*Math.PI*Q),D[1]=tt*Math.cos(2*Math.PI*Q),D[2]=g*Math.sin(2*Math.PI*V),D[3]=g*Math.cos(2*Math.PI*V),D;}function P(D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=Q*Q+V*V+tt*tt+g*g,k=T?1/T:0;return D[0]=-Q*k,D[1]=-V*k,D[2]=-tt*k,D[3]=g*k,D;}function z(D,J){return D[0]=-J[0],D[1]=-J[1],D[2]=-J[2],D[3]=J[3],D;}function U(D,J){var Q=J[0]+J[4]+J[8],V;if(Q>0)V=Math.sqrt(Q+1),D[3]=0.5*V,V=0.5/V,D[0]=(J[5]-J[7])*V,D[1]=(J[6]-J[2])*V,D[2]=(J[1]-J[3])*V;else{var tt=0;J[4]>J[0]&&(tt=1),J[8]>J[tt*3+tt]&&(tt=2);var g=(tt+1)%3,T=(tt+2)%3;V=Math.sqrt(J[tt*3+tt]-J[g*3+g]-J[T*3+T]+1),D[tt]=0.5*V,V=0.5/V,D[3]=(J[g*3+T]-J[T*3+g])*V,D[g]=(J[g*3+tt]+J[tt*3+g])*V,D[T]=(J[T*3+tt]+J[tt*3+T])*V;}return D;}function K(D,J,Q,V){var tt=0.5*Math.PI/180;J*=tt,Q*=tt,V*=tt;var g=Math.sin(J),T=Math.cos(J),k=Math.sin(Q),Z=Math.cos(Q),st=Math.sin(V),ft=Math.cos(V);return D[0]=g*Z*ft-T*k*st,D[1]=T*k*ft+g*Z*st,D[2]=T*Z*st-g*k*ft,D[3]=T*Z*ft+g*k*st,D;}function j(D){return"quat("+D[0]+", "+D[1]+", "+D[2]+", "+D[3]+")";}var nt=u.clone,ct=u.fromValues,B=u.copy,N=u.set,G=u.add,q=b,at=u.scale,ut=u.dot,Ct=u.lerp,R=u.length,$=R,_=u.squaredLength,H=_,lt=u.normalize,dt=u.exactEquals,wt=u.equals,Et=function(){var D=a.create(),J=a.fromValues(1,0,0),Q=a.fromValues(0,1,0);return function(V,tt,g){var T=a.dot(tt,g);return T<-0.999999?(a.cross(D,J,tt),a.len(D)<1e-6&&a.cross(D,Q,tt),a.normalize(D,D),p(V,D,Math.PI),V):T>0.999999?(V[0]=0,V[1]=0,V[2]=0,V[3]=1,V):(a.cross(D,tt,g),V[0]=D[0],V[1]=D[1],V[2]=D[2],V[3]=1+T,lt(V,V));};}(),Ot=function(){var D=h(),J=h();return function(Q,V,tt,g,T,k){return S(D,V,T,k),S(J,tt,g,k),S(Q,D,J,2*k*(1-k)),Q;};}(),O=function(){var D=o.create();return function(J,Q,V,tt){return D[0]=V[0],D[3]=V[1],D[6]=V[2],D[1]=tt[0],D[4]=tt[1],D[7]=tt[2],D[2]=-Q[0],D[5]=-Q[1],D[8]=-Q[2],lt(J,U(J,D));};}();},/* 8 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"length",function(){return u;}),i.d(n,"fromValues",function(){return h;}),i.d(n,"copy",function(){return v;}),i.d(n,"set",function(){return p;}),i.d(n,"add",function(){return y;}),i.d(n,"subtract",function(){return C;}),i.d(n,"multiply",function(){return b;}),i.d(n,"divide",function(){return M;}),i.d(n,"ceil",function(){return L;}),i.d(n,"floor",function(){return X;}),i.d(n,"min",function(){return Y;}),i.d(n,"max",function(){return et;}),i.d(n,"round",function(){return A;}),i.d(n,"scale",function(){return w;}),i.d(n,"scaleAndAdd",function(){return S;}),i.d(n,"distance",function(){return x;}),i.d(n,"squaredDistance",function(){return P;}),i.d(n,"squaredLength",function(){return z;}),i.d(n,"negate",function(){return U;}),i.d(n,"inverse",function(){return K;}),i.d(n,"normalize",function(){return j;}),i.d(n,"dot",function(){return nt;}),i.d(n,"cross",function(){return ct;}),i.d(n,"lerp",function(){return B;}),i.d(n,"hermite",function(){return N;}),i.d(n,"bezier",function(){return G;}),i.d(n,"random",function(){return q;}),i.d(n,"transformMat4",function(){return at;}),i.d(n,"transformMat3",function(){return ut;}),i.d(n,"transformQuat",function(){return Ct;}),i.d(n,"rotateX",function(){return R;}),i.d(n,"rotateY",function(){return $;}),i.d(n,"rotateZ",function(){return _;}),i.d(n,"angle",function(){return H;}),i.d(n,"zero",function(){return lt;}),i.d(n,"str",function(){return dt;}),i.d(n,"exactEquals",function(){return wt;}),i.d(n,"equals",function(){return Et;}),i.d(n,"sub",function(){return Ot;}),i.d(n,"mul",function(){return O;}),i.d(n,"div",function(){return D;}),i.d(n,"dist",function(){return J;}),i.d(n,"sqrDist",function(){return Q;}),i.d(n,"len",function(){return V;}),i.d(n,"sqrLen",function(){return tt;}),i.d(n,"forEach",function(){return g;});var s=i(2);function o(){var T=new s.ARRAY_TYPE(3);return s.ARRAY_TYPE!=Float32Array&&(T[0]=0,T[1]=0,T[2]=0),T;}function a(T){var k=new s.ARRAY_TYPE(3);return k[0]=T[0],k[1]=T[1],k[2]=T[2],k;}function u(T){var k=T[0],Z=T[1],st=T[2];return Math.hypot(k,Z,st);}function h(T,k,Z){var st=new s.ARRAY_TYPE(3);return st[0]=T,st[1]=k,st[2]=Z,st;}function v(T,k){return T[0]=k[0],T[1]=k[1],T[2]=k[2],T;}function p(T,k,Z,st){return T[0]=k,T[1]=Z,T[2]=st,T;}function y(T,k,Z){return T[0]=k[0]+Z[0],T[1]=k[1]+Z[1],T[2]=k[2]+Z[2],T;}function C(T,k,Z){return T[0]=k[0]-Z[0],T[1]=k[1]-Z[1],T[2]=k[2]-Z[2],T;}function b(T,k,Z){return T[0]=k[0]*Z[0],T[1]=k[1]*Z[1],T[2]=k[2]*Z[2],T;}function M(T,k,Z){return T[0]=k[0]/Z[0],T[1]=k[1]/Z[1],T[2]=k[2]/Z[2],T;}function L(T,k){return T[0]=Math.ceil(k[0]),T[1]=Math.ceil(k[1]),T[2]=Math.ceil(k[2]),T;}function X(T,k){return T[0]=Math.floor(k[0]),T[1]=Math.floor(k[1]),T[2]=Math.floor(k[2]),T;}function Y(T,k,Z){return T[0]=Math.min(k[0],Z[0]),T[1]=Math.min(k[1],Z[1]),T[2]=Math.min(k[2],Z[2]),T;}function et(T,k,Z){return T[0]=Math.max(k[0],Z[0]),T[1]=Math.max(k[1],Z[1]),T[2]=Math.max(k[2],Z[2]),T;}function A(T,k){return T[0]=Math.round(k[0]),T[1]=Math.round(k[1]),T[2]=Math.round(k[2]),T;}function w(T,k,Z){return T[0]=k[0]*Z,T[1]=k[1]*Z,T[2]=k[2]*Z,T;}function S(T,k,Z,st){return T[0]=k[0]+Z[0]*st,T[1]=k[1]+Z[1]*st,T[2]=k[2]+Z[2]*st,T;}function x(T,k){var Z=k[0]-T[0],st=k[1]-T[1],ft=k[2]-T[2];return Math.hypot(Z,st,ft);}function P(T,k){var Z=k[0]-T[0],st=k[1]-T[1],ft=k[2]-T[2];return Z*Z+st*st+ft*ft;}function z(T){var k=T[0],Z=T[1],st=T[2];return k*k+Z*Z+st*st;}function U(T,k){return T[0]=-k[0],T[1]=-k[1],T[2]=-k[2],T;}function K(T,k){return T[0]=1/k[0],T[1]=1/k[1],T[2]=1/k[2],T;}function j(T,k){var Z=k[0],st=k[1],ft=k[2],pt=Z*Z+st*st+ft*ft;return pt>0&&(pt=1/Math.sqrt(pt)),T[0]=k[0]*pt,T[1]=k[1]*pt,T[2]=k[2]*pt,T;}function nt(T,k){return T[0]*k[0]+T[1]*k[1]+T[2]*k[2];}function ct(T,k,Z){var st=k[0],ft=k[1],pt=k[2],ot=Z[0],mt=Z[1],It=Z[2];return T[0]=ft*It-pt*mt,T[1]=pt*ot-st*It,T[2]=st*mt-ft*ot,T;}function B(T,k,Z,st){var ft=k[0],pt=k[1],ot=k[2];return T[0]=ft+st*(Z[0]-ft),T[1]=pt+st*(Z[1]-pt),T[2]=ot+st*(Z[2]-ot),T;}function N(T,k,Z,st,ft,pt){var ot=pt*pt,mt=ot*(2*pt-3)+1,It=ot*(pt-2)+pt,Pt=ot*(pt-1),Lt=ot*(3-2*pt);return T[0]=k[0]*mt+Z[0]*It+st[0]*Pt+ft[0]*Lt,T[1]=k[1]*mt+Z[1]*It+st[1]*Pt+ft[1]*Lt,T[2]=k[2]*mt+Z[2]*It+st[2]*Pt+ft[2]*Lt,T;}function G(T,k,Z,st,ft,pt){var ot=1-pt,mt=ot*ot,It=pt*pt,Pt=mt*ot,Lt=3*pt*mt,Dt=3*It*ot,Nt=It*pt;return T[0]=k[0]*Pt+Z[0]*Lt+st[0]*Dt+ft[0]*Nt,T[1]=k[1]*Pt+Z[1]*Lt+st[1]*Dt+ft[1]*Nt,T[2]=k[2]*Pt+Z[2]*Lt+st[2]*Dt+ft[2]*Nt,T;}function q(T,k){k=k||1;var Z=s.RANDOM()*2*Math.PI,st=s.RANDOM()*2-1,ft=Math.sqrt(1-st*st)*k;return T[0]=Math.cos(Z)*ft,T[1]=Math.sin(Z)*ft,T[2]=st*k,T;}function at(T,k,Z){var st=k[0],ft=k[1],pt=k[2],ot=Z[3]*st+Z[7]*ft+Z[11]*pt+Z[15];return ot=ot||1,T[0]=(Z[0]*st+Z[4]*ft+Z[8]*pt+Z[12])/ot,T[1]=(Z[1]*st+Z[5]*ft+Z[9]*pt+Z[13])/ot,T[2]=(Z[2]*st+Z[6]*ft+Z[10]*pt+Z[14])/ot,T;}function ut(T,k,Z){var st=k[0],ft=k[1],pt=k[2];return T[0]=st*Z[0]+ft*Z[3]+pt*Z[6],T[1]=st*Z[1]+ft*Z[4]+pt*Z[7],T[2]=st*Z[2]+ft*Z[5]+pt*Z[8],T;}function Ct(T,k,Z){var st=Z[0],ft=Z[1],pt=Z[2],ot=Z[3],mt=k[0],It=k[1],Pt=k[2],Lt=ft*Pt-pt*It,Dt=pt*mt-st*Pt,Nt=st*It-ft*mt,Yt=ft*Nt-pt*Dt,Ut=pt*Lt-st*Nt,Ft=st*Dt-ft*Lt,Jt=ot*2;return Lt*=Jt,Dt*=Jt,Nt*=Jt,Yt*=2,Ut*=2,Ft*=2,T[0]=mt+Lt+Yt,T[1]=It+Dt+Ut,T[2]=Pt+Nt+Ft,T;}function R(T,k,Z,st){var ft=[],pt=[];return ft[0]=k[0]-Z[0],ft[1]=k[1]-Z[1],ft[2]=k[2]-Z[2],pt[0]=ft[0],pt[1]=ft[1]*Math.cos(st)-ft[2]*Math.sin(st),pt[2]=ft[1]*Math.sin(st)+ft[2]*Math.cos(st),T[0]=pt[0]+Z[0],T[1]=pt[1]+Z[1],T[2]=pt[2]+Z[2],T;}function $(T,k,Z,st){var ft=[],pt=[];return ft[0]=k[0]-Z[0],ft[1]=k[1]-Z[1],ft[2]=k[2]-Z[2],pt[0]=ft[2]*Math.sin(st)+ft[0]*Math.cos(st),pt[1]=ft[1],pt[2]=ft[2]*Math.cos(st)-ft[0]*Math.sin(st),T[0]=pt[0]+Z[0],T[1]=pt[1]+Z[1],T[2]=pt[2]+Z[2],T;}function _(T,k,Z,st){var ft=[],pt=[];return ft[0]=k[0]-Z[0],ft[1]=k[1]-Z[1],ft[2]=k[2]-Z[2],pt[0]=ft[0]*Math.cos(st)-ft[1]*Math.sin(st),pt[1]=ft[0]*Math.sin(st)+ft[1]*Math.cos(st),pt[2]=ft[2],T[0]=pt[0]+Z[0],T[1]=pt[1]+Z[1],T[2]=pt[2]+Z[2],T;}function H(T,k){var Z=T[0],st=T[1],ft=T[2],pt=k[0],ot=k[1],mt=k[2],It=Math.sqrt(Z*Z+st*st+ft*ft),Pt=Math.sqrt(pt*pt+ot*ot+mt*mt),Lt=It*Pt,Dt=Lt&&nt(T,k)/Lt;return Math.acos(Math.min(Math.max(Dt,-1),1));}function lt(T){return T[0]=0,T[1]=0,T[2]=0,T;}function dt(T){return"vec3("+T[0]+", "+T[1]+", "+T[2]+")";}function wt(T,k){return T[0]===k[0]&&T[1]===k[1]&&T[2]===k[2];}function Et(T,k){var Z=T[0],st=T[1],ft=T[2],pt=k[0],ot=k[1],mt=k[2];return Math.abs(Z-pt)<=s.EPSILON*Math.max(1,Math.abs(Z),Math.abs(pt))&&Math.abs(st-ot)<=s.EPSILON*Math.max(1,Math.abs(st),Math.abs(ot))&&Math.abs(ft-mt)<=s.EPSILON*Math.max(1,Math.abs(ft),Math.abs(mt));}var Ot=C,O=b,D=M,J=x,Q=P,V=u,tt=z,g=function(){var T=o();return function(k,Z,st,ft,pt,ot){var mt,It;for(Z||(Z=3),st||(st=0),ft?It=Math.min(ft*Z+st,k.length):It=k.length,mt=st;mt<It;mt+=Z)T[0]=k[mt],T[1]=k[mt+1],T[2]=k[mt+2],pt(T,T,ot),k[mt]=T[0],k[mt+1]=T[1],k[mt+2]=T[2];return k;};}();},/* 9 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"fromValues",function(){return u;}),i.d(n,"copy",function(){return h;}),i.d(n,"set",function(){return v;}),i.d(n,"add",function(){return p;}),i.d(n,"subtract",function(){return y;}),i.d(n,"multiply",function(){return C;}),i.d(n,"divide",function(){return b;}),i.d(n,"ceil",function(){return M;}),i.d(n,"floor",function(){return L;}),i.d(n,"min",function(){return X;}),i.d(n,"max",function(){return Y;}),i.d(n,"round",function(){return et;}),i.d(n,"scale",function(){return A;}),i.d(n,"scaleAndAdd",function(){return w;}),i.d(n,"distance",function(){return S;}),i.d(n,"squaredDistance",function(){return x;}),i.d(n,"length",function(){return P;}),i.d(n,"squaredLength",function(){return z;}),i.d(n,"negate",function(){return U;}),i.d(n,"inverse",function(){return K;}),i.d(n,"normalize",function(){return j;}),i.d(n,"dot",function(){return nt;}),i.d(n,"cross",function(){return ct;}),i.d(n,"lerp",function(){return B;}),i.d(n,"random",function(){return N;}),i.d(n,"transformMat4",function(){return G;}),i.d(n,"transformQuat",function(){return q;}),i.d(n,"zero",function(){return at;}),i.d(n,"str",function(){return ut;}),i.d(n,"exactEquals",function(){return Ct;}),i.d(n,"equals",function(){return R;}),i.d(n,"sub",function(){return $;}),i.d(n,"mul",function(){return _;}),i.d(n,"div",function(){return H;}),i.d(n,"dist",function(){return lt;}),i.d(n,"sqrDist",function(){return dt;}),i.d(n,"len",function(){return wt;}),i.d(n,"sqrLen",function(){return Et;}),i.d(n,"forEach",function(){return Ot;});var s=i(2);function o(){var O=new s.ARRAY_TYPE(4);return s.ARRAY_TYPE!=Float32Array&&(O[0]=0,O[1]=0,O[2]=0,O[3]=0),O;}function a(O){var D=new s.ARRAY_TYPE(4);return D[0]=O[0],D[1]=O[1],D[2]=O[2],D[3]=O[3],D;}function u(O,D,J,Q){var V=new s.ARRAY_TYPE(4);return V[0]=O,V[1]=D,V[2]=J,V[3]=Q,V;}function h(O,D){return O[0]=D[0],O[1]=D[1],O[2]=D[2],O[3]=D[3],O;}function v(O,D,J,Q,V){return O[0]=D,O[1]=J,O[2]=Q,O[3]=V,O;}function p(O,D,J){return O[0]=D[0]+J[0],O[1]=D[1]+J[1],O[2]=D[2]+J[2],O[3]=D[3]+J[3],O;}function y(O,D,J){return O[0]=D[0]-J[0],O[1]=D[1]-J[1],O[2]=D[2]-J[2],O[3]=D[3]-J[3],O;}function C(O,D,J){return O[0]=D[0]*J[0],O[1]=D[1]*J[1],O[2]=D[2]*J[2],O[3]=D[3]*J[3],O;}function b(O,D,J){return O[0]=D[0]/J[0],O[1]=D[1]/J[1],O[2]=D[2]/J[2],O[3]=D[3]/J[3],O;}function M(O,D){return O[0]=Math.ceil(D[0]),O[1]=Math.ceil(D[1]),O[2]=Math.ceil(D[2]),O[3]=Math.ceil(D[3]),O;}function L(O,D){return O[0]=Math.floor(D[0]),O[1]=Math.floor(D[1]),O[2]=Math.floor(D[2]),O[3]=Math.floor(D[3]),O;}function X(O,D,J){return O[0]=Math.min(D[0],J[0]),O[1]=Math.min(D[1],J[1]),O[2]=Math.min(D[2],J[2]),O[3]=Math.min(D[3],J[3]),O;}function Y(O,D,J){return O[0]=Math.max(D[0],J[0]),O[1]=Math.max(D[1],J[1]),O[2]=Math.max(D[2],J[2]),O[3]=Math.max(D[3],J[3]),O;}function et(O,D){return O[0]=Math.round(D[0]),O[1]=Math.round(D[1]),O[2]=Math.round(D[2]),O[3]=Math.round(D[3]),O;}function A(O,D,J){return O[0]=D[0]*J,O[1]=D[1]*J,O[2]=D[2]*J,O[3]=D[3]*J,O;}function w(O,D,J,Q){return O[0]=D[0]+J[0]*Q,O[1]=D[1]+J[1]*Q,O[2]=D[2]+J[2]*Q,O[3]=D[3]+J[3]*Q,O;}function S(O,D){var J=D[0]-O[0],Q=D[1]-O[1],V=D[2]-O[2],tt=D[3]-O[3];return Math.hypot(J,Q,V,tt);}function x(O,D){var J=D[0]-O[0],Q=D[1]-O[1],V=D[2]-O[2],tt=D[3]-O[3];return J*J+Q*Q+V*V+tt*tt;}function P(O){var D=O[0],J=O[1],Q=O[2],V=O[3];return Math.hypot(D,J,Q,V);}function z(O){var D=O[0],J=O[1],Q=O[2],V=O[3];return D*D+J*J+Q*Q+V*V;}function U(O,D){return O[0]=-D[0],O[1]=-D[1],O[2]=-D[2],O[3]=-D[3],O;}function K(O,D){return O[0]=1/D[0],O[1]=1/D[1],O[2]=1/D[2],O[3]=1/D[3],O;}function j(O,D){var J=D[0],Q=D[1],V=D[2],tt=D[3],g=J*J+Q*Q+V*V+tt*tt;return g>0&&(g=1/Math.sqrt(g)),O[0]=J*g,O[1]=Q*g,O[2]=V*g,O[3]=tt*g,O;}function nt(O,D){return O[0]*D[0]+O[1]*D[1]+O[2]*D[2]+O[3]*D[3];}function ct(O,D,J,Q){var V=J[0]*Q[1]-J[1]*Q[0],tt=J[0]*Q[2]-J[2]*Q[0],g=J[0]*Q[3]-J[3]*Q[0],T=J[1]*Q[2]-J[2]*Q[1],k=J[1]*Q[3]-J[3]*Q[1],Z=J[2]*Q[3]-J[3]*Q[2],st=D[0],ft=D[1],pt=D[2],ot=D[3];return O[0]=ft*Z-pt*k+ot*T,O[1]=-(st*Z)+pt*g-ot*tt,O[2]=st*k-ft*g+ot*V,O[3]=-(st*T)+ft*tt-pt*V,O;}function B(O,D,J,Q){var V=D[0],tt=D[1],g=D[2],T=D[3];return O[0]=V+Q*(J[0]-V),O[1]=tt+Q*(J[1]-tt),O[2]=g+Q*(J[2]-g),O[3]=T+Q*(J[3]-T),O;}function N(O,D){D=D||1;var J,Q,V,tt,g,T;do J=s.RANDOM()*2-1,Q=s.RANDOM()*2-1,g=J*J+Q*Q;while(g>=1);do V=s.RANDOM()*2-1,tt=s.RANDOM()*2-1,T=V*V+tt*tt;while(T>=1);var k=Math.sqrt((1-g)/T);return O[0]=D*J,O[1]=D*Q,O[2]=D*V*k,O[3]=D*tt*k,O;}function G(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3];return O[0]=J[0]*Q+J[4]*V+J[8]*tt+J[12]*g,O[1]=J[1]*Q+J[5]*V+J[9]*tt+J[13]*g,O[2]=J[2]*Q+J[6]*V+J[10]*tt+J[14]*g,O[3]=J[3]*Q+J[7]*V+J[11]*tt+J[15]*g,O;}function q(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=J[0],T=J[1],k=J[2],Z=J[3],st=Z*Q+T*tt-k*V,ft=Z*V+k*Q-g*tt,pt=Z*tt+g*V-T*Q,ot=-g*Q-T*V-k*tt;return O[0]=st*Z+ot*-g+ft*-k-pt*-T,O[1]=ft*Z+ot*-T+pt*-g-st*-k,O[2]=pt*Z+ot*-k+st*-T-ft*-g,O[3]=D[3],O;}function at(O){return O[0]=0,O[1]=0,O[2]=0,O[3]=0,O;}function ut(O){return"vec4("+O[0]+", "+O[1]+", "+O[2]+", "+O[3]+")";}function Ct(O,D){return O[0]===D[0]&&O[1]===D[1]&&O[2]===D[2]&&O[3]===D[3];}function R(O,D){var J=O[0],Q=O[1],V=O[2],tt=O[3],g=D[0],T=D[1],k=D[2],Z=D[3];return Math.abs(J-g)<=s.EPSILON*Math.max(1,Math.abs(J),Math.abs(g))&&Math.abs(Q-T)<=s.EPSILON*Math.max(1,Math.abs(Q),Math.abs(T))&&Math.abs(V-k)<=s.EPSILON*Math.max(1,Math.abs(V),Math.abs(k))&&Math.abs(tt-Z)<=s.EPSILON*Math.max(1,Math.abs(tt),Math.abs(Z));}var $=y,_=C,H=b,lt=S,dt=x,wt=P,Et=z,Ot=function(){var O=o();return function(D,J,Q,V,tt,g){var T,k;for(J||(J=4),Q||(Q=0),V?k=Math.min(V*J+Q,D.length):k=D.length,T=Q;T<k;T+=J)O[0]=D[T],O[1]=D[T+1],O[2]=D[T+2],O[3]=D[T+3],tt(O,O,g),D[T]=O[0],D[T+1]=O[1],D[T+2]=O[2],D[T+3]=O[3];return D;};}();},/* 10 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return u;}),i.d(n,"clone",function(){return h;}),i.d(n,"fromValues",function(){return v;}),i.d(n,"fromRotationTranslationValues",function(){return p;}),i.d(n,"fromRotationTranslation",function(){return y;}),i.d(n,"fromTranslation",function(){return C;}),i.d(n,"fromRotation",function(){return b;}),i.d(n,"fromMat4",function(){return M;}),i.d(n,"copy",function(){return L;}),i.d(n,"identity",function(){return X;}),i.d(n,"set",function(){return Y;}),i.d(n,"getReal",function(){return et;}),i.d(n,"getDual",function(){return A;}),i.d(n,"setReal",function(){return w;}),i.d(n,"setDual",function(){return S;}),i.d(n,"getTranslation",function(){return x;}),i.d(n,"translate",function(){return P;}),i.d(n,"rotateX",function(){return z;}),i.d(n,"rotateY",function(){return U;}),i.d(n,"rotateZ",function(){return K;}),i.d(n,"rotateByQuatAppend",function(){return j;}),i.d(n,"rotateByQuatPrepend",function(){return nt;}),i.d(n,"rotateAroundAxis",function(){return ct;}),i.d(n,"add",function(){return B;}),i.d(n,"multiply",function(){return N;}),i.d(n,"mul",function(){return G;}),i.d(n,"scale",function(){return q;}),i.d(n,"dot",function(){return at;}),i.d(n,"lerp",function(){return ut;}),i.d(n,"invert",function(){return Ct;}),i.d(n,"conjugate",function(){return R;}),i.d(n,"length",function(){return $;}),i.d(n,"len",function(){return _;}),i.d(n,"squaredLength",function(){return H;}),i.d(n,"sqrLen",function(){return lt;}),i.d(n,"normalize",function(){return dt;}),i.d(n,"str",function(){return wt;}),i.d(n,"exactEquals",function(){return Et;}),i.d(n,"equals",function(){return Ot;});var s=i(2),o=i(7),a=i(6);function u(){var O=new s.ARRAY_TYPE(8);return s.ARRAY_TYPE!=Float32Array&&(O[0]=0,O[1]=0,O[2]=0,O[4]=0,O[5]=0,O[6]=0,O[7]=0),O[3]=1,O;}function h(O){var D=new s.ARRAY_TYPE(8);return D[0]=O[0],D[1]=O[1],D[2]=O[2],D[3]=O[3],D[4]=O[4],D[5]=O[5],D[6]=O[6],D[7]=O[7],D;}function v(O,D,J,Q,V,tt,g,T){var k=new s.ARRAY_TYPE(8);return k[0]=O,k[1]=D,k[2]=J,k[3]=Q,k[4]=V,k[5]=tt,k[6]=g,k[7]=T,k;}function p(O,D,J,Q,V,tt,g){var T=new s.ARRAY_TYPE(8);T[0]=O,T[1]=D,T[2]=J,T[3]=Q;var k=V*0.5,Z=tt*0.5,st=g*0.5;return T[4]=k*Q+Z*J-st*D,T[5]=Z*Q+st*O-k*J,T[6]=st*Q+k*D-Z*O,T[7]=-k*O-Z*D-st*J,T;}function y(O,D,J){var Q=J[0]*0.5,V=J[1]*0.5,tt=J[2]*0.5,g=D[0],T=D[1],k=D[2],Z=D[3];return O[0]=g,O[1]=T,O[2]=k,O[3]=Z,O[4]=Q*Z+V*k-tt*T,O[5]=V*Z+tt*g-Q*k,O[6]=tt*Z+Q*T-V*g,O[7]=-Q*g-V*T-tt*k,O;}function C(O,D){return O[0]=0,O[1]=0,O[2]=0,O[3]=1,O[4]=D[0]*0.5,O[5]=D[1]*0.5,O[6]=D[2]*0.5,O[7]=0,O;}function b(O,D){return O[0]=D[0],O[1]=D[1],O[2]=D[2],O[3]=D[3],O[4]=0,O[5]=0,O[6]=0,O[7]=0,O;}function M(O,D){var J=o.create();a.getRotation(J,D);var Q=new s.ARRAY_TYPE(3);return a.getTranslation(Q,D),y(O,J,Q),O;}function L(O,D){return O[0]=D[0],O[1]=D[1],O[2]=D[2],O[3]=D[3],O[4]=D[4],O[5]=D[5],O[6]=D[6],O[7]=D[7],O;}function X(O){return O[0]=0,O[1]=0,O[2]=0,O[3]=1,O[4]=0,O[5]=0,O[6]=0,O[7]=0,O;}function Y(O,D,J,Q,V,tt,g,T,k){return O[0]=D,O[1]=J,O[2]=Q,O[3]=V,O[4]=tt,O[5]=g,O[6]=T,O[7]=k,O;}var et=o.copy;function A(O,D){return O[0]=D[4],O[1]=D[5],O[2]=D[6],O[3]=D[7],O;}var w=o.copy;function S(O,D){return O[4]=D[0],O[5]=D[1],O[6]=D[2],O[7]=D[3],O;}function x(O,D){var J=D[4],Q=D[5],V=D[6],tt=D[7],g=-D[0],T=-D[1],k=-D[2],Z=D[3];return O[0]=(J*Z+tt*g+Q*k-V*T)*2,O[1]=(Q*Z+tt*T+V*g-J*k)*2,O[2]=(V*Z+tt*k+J*T-Q*g)*2,O;}function P(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3],T=J[0]*0.5,k=J[1]*0.5,Z=J[2]*0.5,st=D[4],ft=D[5],pt=D[6],ot=D[7];return O[0]=Q,O[1]=V,O[2]=tt,O[3]=g,O[4]=g*T+V*Z-tt*k+st,O[5]=g*k+tt*T-Q*Z+ft,O[6]=g*Z+Q*k-V*T+pt,O[7]=-Q*T-V*k-tt*Z+ot,O;}function z(O,D,J){var Q=-D[0],V=-D[1],tt=-D[2],g=D[3],T=D[4],k=D[5],Z=D[6],st=D[7],ft=T*g+st*Q+k*tt-Z*V,pt=k*g+st*V+Z*Q-T*tt,ot=Z*g+st*tt+T*V-k*Q,mt=st*g-T*Q-k*V-Z*tt;return o.rotateX(O,D,J),Q=O[0],V=O[1],tt=O[2],g=O[3],O[4]=ft*g+mt*Q+pt*tt-ot*V,O[5]=pt*g+mt*V+ot*Q-ft*tt,O[6]=ot*g+mt*tt+ft*V-pt*Q,O[7]=mt*g-ft*Q-pt*V-ot*tt,O;}function U(O,D,J){var Q=-D[0],V=-D[1],tt=-D[2],g=D[3],T=D[4],k=D[5],Z=D[6],st=D[7],ft=T*g+st*Q+k*tt-Z*V,pt=k*g+st*V+Z*Q-T*tt,ot=Z*g+st*tt+T*V-k*Q,mt=st*g-T*Q-k*V-Z*tt;return o.rotateY(O,D,J),Q=O[0],V=O[1],tt=O[2],g=O[3],O[4]=ft*g+mt*Q+pt*tt-ot*V,O[5]=pt*g+mt*V+ot*Q-ft*tt,O[6]=ot*g+mt*tt+ft*V-pt*Q,O[7]=mt*g-ft*Q-pt*V-ot*tt,O;}function K(O,D,J){var Q=-D[0],V=-D[1],tt=-D[2],g=D[3],T=D[4],k=D[5],Z=D[6],st=D[7],ft=T*g+st*Q+k*tt-Z*V,pt=k*g+st*V+Z*Q-T*tt,ot=Z*g+st*tt+T*V-k*Q,mt=st*g-T*Q-k*V-Z*tt;return o.rotateZ(O,D,J),Q=O[0],V=O[1],tt=O[2],g=O[3],O[4]=ft*g+mt*Q+pt*tt-ot*V,O[5]=pt*g+mt*V+ot*Q-ft*tt,O[6]=ot*g+mt*tt+ft*V-pt*Q,O[7]=mt*g-ft*Q-pt*V-ot*tt,O;}function j(O,D,J){var Q=J[0],V=J[1],tt=J[2],g=J[3],T=D[0],k=D[1],Z=D[2],st=D[3];return O[0]=T*g+st*Q+k*tt-Z*V,O[1]=k*g+st*V+Z*Q-T*tt,O[2]=Z*g+st*tt+T*V-k*Q,O[3]=st*g-T*Q-k*V-Z*tt,T=D[4],k=D[5],Z=D[6],st=D[7],O[4]=T*g+st*Q+k*tt-Z*V,O[5]=k*g+st*V+Z*Q-T*tt,O[6]=Z*g+st*tt+T*V-k*Q,O[7]=st*g-T*Q-k*V-Z*tt,O;}function nt(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3],T=J[0],k=J[1],Z=J[2],st=J[3];return O[0]=Q*st+g*T+V*Z-tt*k,O[1]=V*st+g*k+tt*T-Q*Z,O[2]=tt*st+g*Z+Q*k-V*T,O[3]=g*st-Q*T-V*k-tt*Z,T=J[4],k=J[5],Z=J[6],st=J[7],O[4]=Q*st+g*T+V*Z-tt*k,O[5]=V*st+g*k+tt*T-Q*Z,O[6]=tt*st+g*Z+Q*k-V*T,O[7]=g*st-Q*T-V*k-tt*Z,O;}function ct(O,D,J,Q){if(Math.abs(Q)<s.EPSILON)return L(O,D);var V=Math.hypot(J[0],J[1],J[2]);Q=Q*0.5;var tt=Math.sin(Q),g=tt*J[0]/V,T=tt*J[1]/V,k=tt*J[2]/V,Z=Math.cos(Q),st=D[0],ft=D[1],pt=D[2],ot=D[3];O[0]=st*Z+ot*g+ft*k-pt*T,O[1]=ft*Z+ot*T+pt*g-st*k,O[2]=pt*Z+ot*k+st*T-ft*g,O[3]=ot*Z-st*g-ft*T-pt*k;var mt=D[4],It=D[5],Pt=D[6],Lt=D[7];return O[4]=mt*Z+Lt*g+It*k-Pt*T,O[5]=It*Z+Lt*T+Pt*g-mt*k,O[6]=Pt*Z+Lt*k+mt*T-It*g,O[7]=Lt*Z-mt*g-It*T-Pt*k,O;}function B(O,D,J){return O[0]=D[0]+J[0],O[1]=D[1]+J[1],O[2]=D[2]+J[2],O[3]=D[3]+J[3],O[4]=D[4]+J[4],O[5]=D[5]+J[5],O[6]=D[6]+J[6],O[7]=D[7]+J[7],O;}function N(O,D,J){var Q=D[0],V=D[1],tt=D[2],g=D[3],T=J[4],k=J[5],Z=J[6],st=J[7],ft=D[4],pt=D[5],ot=D[6],mt=D[7],It=J[0],Pt=J[1],Lt=J[2],Dt=J[3];return O[0]=Q*Dt+g*It+V*Lt-tt*Pt,O[1]=V*Dt+g*Pt+tt*It-Q*Lt,O[2]=tt*Dt+g*Lt+Q*Pt-V*It,O[3]=g*Dt-Q*It-V*Pt-tt*Lt,O[4]=Q*st+g*T+V*Z-tt*k+ft*Dt+mt*It+pt*Lt-ot*Pt,O[5]=V*st+g*k+tt*T-Q*Z+pt*Dt+mt*Pt+ot*It-ft*Lt,O[6]=tt*st+g*Z+Q*k-V*T+ot*Dt+mt*Lt+ft*Pt-pt*It,O[7]=g*st-Q*T-V*k-tt*Z+mt*Dt-ft*It-pt*Pt-ot*Lt,O;}var G=N;function q(O,D,J){return O[0]=D[0]*J,O[1]=D[1]*J,O[2]=D[2]*J,O[3]=D[3]*J,O[4]=D[4]*J,O[5]=D[5]*J,O[6]=D[6]*J,O[7]=D[7]*J,O;}var at=o.dot;function ut(O,D,J,Q){var V=1-Q;return at(D,J)<0&&(Q=-Q),O[0]=D[0]*V+J[0]*Q,O[1]=D[1]*V+J[1]*Q,O[2]=D[2]*V+J[2]*Q,O[3]=D[3]*V+J[3]*Q,O[4]=D[4]*V+J[4]*Q,O[5]=D[5]*V+J[5]*Q,O[6]=D[6]*V+J[6]*Q,O[7]=D[7]*V+J[7]*Q,O;}function Ct(O,D){var J=H(D);return O[0]=-D[0]/J,O[1]=-D[1]/J,O[2]=-D[2]/J,O[3]=D[3]/J,O[4]=-D[4]/J,O[5]=-D[5]/J,O[6]=-D[6]/J,O[7]=D[7]/J,O;}function R(O,D){return O[0]=-D[0],O[1]=-D[1],O[2]=-D[2],O[3]=D[3],O[4]=-D[4],O[5]=-D[5],O[6]=-D[6],O[7]=D[7],O;}var $=o.length,_=$,H=o.squaredLength,lt=H;function dt(O,D){var J=H(D);if(J>0){J=Math.sqrt(J);var Q=D[0]/J,V=D[1]/J,tt=D[2]/J,g=D[3]/J,T=D[4],k=D[5],Z=D[6],st=D[7],ft=Q*T+V*k+tt*Z+g*st;O[0]=Q,O[1]=V,O[2]=tt,O[3]=g,O[4]=(T-Q*ft)/J,O[5]=(k-V*ft)/J,O[6]=(Z-tt*ft)/J,O[7]=(st-g*ft)/J;}return O;}function wt(O){return"quat2("+O[0]+", "+O[1]+", "+O[2]+", "+O[3]+", "+O[4]+", "+O[5]+", "+O[6]+", "+O[7]+")";}function Et(O,D){return O[0]===D[0]&&O[1]===D[1]&&O[2]===D[2]&&O[3]===D[3]&&O[4]===D[4]&&O[5]===D[5]&&O[6]===D[6]&&O[7]===D[7];}function Ot(O,D){var J=O[0],Q=O[1],V=O[2],tt=O[3],g=O[4],T=O[5],k=O[6],Z=O[7],st=D[0],ft=D[1],pt=D[2],ot=D[3],mt=D[4],It=D[5],Pt=D[6],Lt=D[7];return Math.abs(J-st)<=s.EPSILON*Math.max(1,Math.abs(J),Math.abs(st))&&Math.abs(Q-ft)<=s.EPSILON*Math.max(1,Math.abs(Q),Math.abs(ft))&&Math.abs(V-pt)<=s.EPSILON*Math.max(1,Math.abs(V),Math.abs(pt))&&Math.abs(tt-ot)<=s.EPSILON*Math.max(1,Math.abs(tt),Math.abs(ot))&&Math.abs(g-mt)<=s.EPSILON*Math.max(1,Math.abs(g),Math.abs(mt))&&Math.abs(T-It)<=s.EPSILON*Math.max(1,Math.abs(T),Math.abs(It))&&Math.abs(k-Pt)<=s.EPSILON*Math.max(1,Math.abs(k),Math.abs(Pt))&&Math.abs(Z-Lt)<=s.EPSILON*Math.max(1,Math.abs(Z),Math.abs(Lt));}},/* 11 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return o;}),i.d(n,"clone",function(){return a;}),i.d(n,"fromValues",function(){return u;}),i.d(n,"copy",function(){return h;}),i.d(n,"set",function(){return v;}),i.d(n,"add",function(){return p;}),i.d(n,"subtract",function(){return y;}),i.d(n,"multiply",function(){return C;}),i.d(n,"divide",function(){return b;}),i.d(n,"ceil",function(){return M;}),i.d(n,"floor",function(){return L;}),i.d(n,"min",function(){return X;}),i.d(n,"max",function(){return Y;}),i.d(n,"round",function(){return et;}),i.d(n,"scale",function(){return A;}),i.d(n,"scaleAndAdd",function(){return w;}),i.d(n,"distance",function(){return S;}),i.d(n,"squaredDistance",function(){return x;}),i.d(n,"length",function(){return P;}),i.d(n,"squaredLength",function(){return z;}),i.d(n,"negate",function(){return U;}),i.d(n,"inverse",function(){return K;}),i.d(n,"normalize",function(){return j;}),i.d(n,"dot",function(){return nt;}),i.d(n,"cross",function(){return ct;}),i.d(n,"lerp",function(){return B;}),i.d(n,"random",function(){return N;}),i.d(n,"transformMat2",function(){return G;}),i.d(n,"transformMat2d",function(){return q;}),i.d(n,"transformMat3",function(){return at;}),i.d(n,"transformMat4",function(){return ut;}),i.d(n,"rotate",function(){return Ct;}),i.d(n,"angle",function(){return R;}),i.d(n,"zero",function(){return $;}),i.d(n,"str",function(){return _;}),i.d(n,"exactEquals",function(){return H;}),i.d(n,"equals",function(){return lt;}),i.d(n,"len",function(){return dt;}),i.d(n,"sub",function(){return wt;}),i.d(n,"mul",function(){return Et;}),i.d(n,"div",function(){return Ot;}),i.d(n,"dist",function(){return O;}),i.d(n,"sqrDist",function(){return D;}),i.d(n,"sqrLen",function(){return J;}),i.d(n,"forEach",function(){return Q;});var s=i(2);function o(){var V=new s.ARRAY_TYPE(2);return s.ARRAY_TYPE!=Float32Array&&(V[0]=0,V[1]=0),V;}function a(V){var tt=new s.ARRAY_TYPE(2);return tt[0]=V[0],tt[1]=V[1],tt;}function u(V,tt){var g=new s.ARRAY_TYPE(2);return g[0]=V,g[1]=tt,g;}function h(V,tt){return V[0]=tt[0],V[1]=tt[1],V;}function v(V,tt,g){return V[0]=tt,V[1]=g,V;}function p(V,tt,g){return V[0]=tt[0]+g[0],V[1]=tt[1]+g[1],V;}function y(V,tt,g){return V[0]=tt[0]-g[0],V[1]=tt[1]-g[1],V;}function C(V,tt,g){return V[0]=tt[0]*g[0],V[1]=tt[1]*g[1],V;}function b(V,tt,g){return V[0]=tt[0]/g[0],V[1]=tt[1]/g[1],V;}function M(V,tt){return V[0]=Math.ceil(tt[0]),V[1]=Math.ceil(tt[1]),V;}function L(V,tt){return V[0]=Math.floor(tt[0]),V[1]=Math.floor(tt[1]),V;}function X(V,tt,g){return V[0]=Math.min(tt[0],g[0]),V[1]=Math.min(tt[1],g[1]),V;}function Y(V,tt,g){return V[0]=Math.max(tt[0],g[0]),V[1]=Math.max(tt[1],g[1]),V;}function et(V,tt){return V[0]=Math.round(tt[0]),V[1]=Math.round(tt[1]),V;}function A(V,tt,g){return V[0]=tt[0]*g,V[1]=tt[1]*g,V;}function w(V,tt,g,T){return V[0]=tt[0]+g[0]*T,V[1]=tt[1]+g[1]*T,V;}function S(V,tt){var g=tt[0]-V[0],T=tt[1]-V[1];return Math.hypot(g,T);}function x(V,tt){var g=tt[0]-V[0],T=tt[1]-V[1];return g*g+T*T;}function P(V){var tt=V[0],g=V[1];return Math.hypot(tt,g);}function z(V){var tt=V[0],g=V[1];return tt*tt+g*g;}function U(V,tt){return V[0]=-tt[0],V[1]=-tt[1],V;}function K(V,tt){return V[0]=1/tt[0],V[1]=1/tt[1],V;}function j(V,tt){var g=tt[0],T=tt[1],k=g*g+T*T;return k>0&&(k=1/Math.sqrt(k)),V[0]=tt[0]*k,V[1]=tt[1]*k,V;}function nt(V,tt){return V[0]*tt[0]+V[1]*tt[1];}function ct(V,tt,g){var T=tt[0]*g[1]-tt[1]*g[0];return V[0]=V[1]=0,V[2]=T,V;}function B(V,tt,g,T){var k=tt[0],Z=tt[1];return V[0]=k+T*(g[0]-k),V[1]=Z+T*(g[1]-Z),V;}function N(V,tt){tt=tt||1;var g=s.RANDOM()*2*Math.PI;return V[0]=Math.cos(g)*tt,V[1]=Math.sin(g)*tt,V;}function G(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[2]*k,V[1]=g[1]*T+g[3]*k,V;}function q(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[2]*k+g[4],V[1]=g[1]*T+g[3]*k+g[5],V;}function at(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[3]*k+g[6],V[1]=g[1]*T+g[4]*k+g[7],V;}function ut(V,tt,g){var T=tt[0],k=tt[1];return V[0]=g[0]*T+g[4]*k+g[12],V[1]=g[1]*T+g[5]*k+g[13],V;}function Ct(V,tt,g,T){var k=tt[0]-g[0],Z=tt[1]-g[1],st=Math.sin(T),ft=Math.cos(T);return V[0]=k*ft-Z*st+g[0],V[1]=k*st+Z*ft+g[1],V;}function R(V,tt){var g=V[0],T=V[1],k=tt[0],Z=tt[1],st=Math.sqrt(g*g+T*T)*Math.sqrt(k*k+Z*Z),ft=st&&(g*k+T*Z)/st;return Math.acos(Math.min(Math.max(ft,-1),1));}function $(V){return V[0]=0,V[1]=0,V;}function _(V){return"vec2("+V[0]+", "+V[1]+")";}function H(V,tt){return V[0]===tt[0]&&V[1]===tt[1];}function lt(V,tt){var g=V[0],T=V[1],k=tt[0],Z=tt[1];return Math.abs(g-k)<=s.EPSILON*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(T-Z)<=s.EPSILON*Math.max(1,Math.abs(T),Math.abs(Z));}var dt=P,wt=y,Et=C,Ot=b,O=S,D=x,J=z,Q=function(){var V=o();return function(tt,g,T,k,Z,st){var ft,pt;for(g||(g=2),T||(T=0),k?pt=Math.min(k*g+T,tt.length):pt=tt.length,ft=T;ft<pt;ft+=g)V[0]=tt[ft],V[1]=tt[ft+1],Z(V,V,st),tt[ft]=V[0],tt[ft+1]=V[1];return tt;};}();},/* 12 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return R;});var s=i(13),o=/* @__PURE__ */i.n(s),a=i(19),u=/* @__PURE__ */i.n(a),h=i(23),v=/* @__PURE__ */i.n(h),p=i(24),y=/* @__PURE__ */i.n(p),C=i(25),b=i(1),M=i(36),L=i(43),X=i(41),Y=i(56),et=i(73),A=i(45),w=i(78),S=i(37),x=i(82);i(1).glMatrix.setMatrixArrayType(Array);function P($,_){var H;if((typeof Symbol==="undefined"?"undefined":_typeof(Symbol))>"u"||$[Symbol.iterator]==null){if(Array.isArray($)||(H=z($))||_){H&&($=H);var lt=0,dt=function dt(){};return{s:dt,n:function n(){return lt>=$.length?{done:!0}:{done:!1,value:$[lt++]};},e:function e(D){throw D;},f:dt};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var wt=!0,Et=!1,Ot;return{s:function s(){H=$[Symbol.iterator]();},n:function n(){var D=H.next();return wt=D.done,D;},e:function e(D){Et=!0,Ot=D;},f:function f(){try{!wt&&H.return!=null&&H.return();}finally{if(Et)throw Ot;}}};}function z($,_){if($){if(typeof $=="string")return U($,_);var H=Object.prototype.toString.call($).slice(8,-1);if(H==="Object"&&$.constructor&&(H=$.constructor.name),H==="Map"||H==="Set")return Array.from($);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return U($,_);}}function U($,_){(_==null||_>$.length)&&(_=$.length);for(var H=0,lt=new Array(_);H<_;H++)lt[H]=$[H];return lt;}var K={autoUpdate:!1,// premultipliedAlpha: true,
|
|
2
2
|
preserveDrawingBuffer:!1,// depth: false,
|
|
3
3
|
// antialias: false,
|
|
4
4
|
bufferSize:1500},j="attribute vec3 a_vertexPosition;\nattribute vec3 a_vertexTextureCoord;\nvarying vec3 vTextureCoord;\nuniform mat3 viewMatrix;\nuniform mat3 projectionMatrix;\n\nvoid main() {\n gl_PointSize = 1.0;\n vec3 pos = projectionMatrix * viewMatrix * vec3(a_vertexPosition.xy, 1.0);\n gl_Position = vec4(pos.xy, 1.0, 1.0); \n vTextureCoord = a_vertexTextureCoord; \n}\n",nt="precision mediump float;\nvarying vec3 vTextureCoord;\nuniform sampler2D u_texSampler;\nvoid main() {\n gl_FragColor = texture2D(u_texSampler, vTextureCoord.xy);\n}\n",ct=Symbol("glRenderer"),B=Symbol("canvasRenderer"),N=Symbol("options"),G=Symbol("globalTransform"),q=Symbol("applyGlobalTransform"),at=Symbol("canvas");function ut($){var _=$.gl,H=$.fbo;H&&_.bindFramebuffer(_.FRAMEBUFFER,H),$._draw(),H&&_.bindFramebuffer(_.FRAMEBUFFER,null);}function Ct($,_,H,lt){var dt=$.createTexture(_.canvas),wt=[[[0,0],[H,0],[H,lt],[0,lt],[0,0]]];wt.closed=!0;var Et=new et.default({contours:wt});Et.setTexture(dt),$.setMeshData([Et.meshData]),ut($),dt.delete(),_.clearRect(0,0,H,lt),delete _._filter;}var R=/* @__PURE__ */function(){function $(_){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v()(this,$);var lt=H.contextType;if(lt||(typeof WebGL2RenderingContext=="function"?lt="webgl2":typeof WebGLRenderingContext=="function"?lt="webgl":lt="2d"),!_.getContext){var dt=_;_={getContext:function getContext(){return dt;},width:H.width,height:H.height},dt.canvas=_,lt="2d";}if(this[at]=_,lt!=="webgl"&<!=="webgl2"&<!=="2d")throw new Error("Unknown context type ".concat(lt));if(H.contextType=lt,this[N]=Object.assign({},K,H),lt==="webgl"||lt==="webgl2"){lt==="webgl2"&&(this[N].webgl2=!0);var wt=new C.default(_,this[N]);lt==="webgl2"&&!wt.isWebGL2&&(H.contextType="webgl"),Object(x.createShaders)(wt),Object(x.applyShader)(wt),Object(x.createCloudShaders)(wt);var Et=wt.gl;Et.clearColor(0,0,0,0),Et.blendFuncSeparate(Et.SRC_ALPHA,Et.ONE_MINUS_SRC_ALPHA,Et.ONE,Et.ONE_MINUS_SRC_ALPHA),this[ct]=wt;}else this[B]=new M.default(_,this[N]);this[G]=[1,0,0,0,1,0,0,0,1],this.updateResolution();}return y()($,[{key:q,value:function value(){var H=this[ct]||this[B];if(this[ct]){var lt=this.canvas,dt=lt.width,wt=lt.height;H.uniforms.viewMatrix=this.viewMatrix,H.uniforms.projectionMatrix=this.projectionMatrix,H.uniforms.u_resolution=[dt,wt];}}},{key:"updateResolution",value:function value(){var H=this.canvas,lt=H.width,dt=H.height,wt=[// translation
|
|
5
5
|
1,0,0,0,1,0,-lt/2,-dt/2,1],Et=[// scale
|
|
6
|
-
2/lt,0,0,0,-2/dt,0,0,0,1],Ot=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),Et,wt);this.projectionMatrix=Ot,this[ct]&&this[ct].gl.viewport(0,0,lt,dt);}},{key:"createTexture",value:function value(H,lt){var dt=this[ct]||this[B];return dt.createTexture(H,lt);}/* async */},{key:"loadTexture",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=lt.useImageBitmap,wt=dt===void 0?!1:dt,Et=this[ct]||this[B];return Et.loadTexture(H,{useImageBitmap:wt});}},{key:"createText",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=lt.font,wt=dt===void 0?"16px arial":dt,Et=lt.fillColor,Ot=Et===void 0?null:Et,O=lt.strokeColor,D=O===void 0?null:O,J=lt.strokeWidth,Q=J===void 0?1:J;if(this[ct]){var V=S.default.createText(H,{font:wt,fillColor:Ot,strokeColor:D,strokeWidth:Q});return{image:this.createTexture(V.image),rect:V.rect};}return{_img:{font:wt,fillColor:Ot,strokeColor:D,strokeWidth:Q,text:H}};}},{key:"createProgram",value:function value(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},lt=H.vertex,dt=H.fragment,wt=H.options;if(this[ct]){var Et=this[ct].compileSync(dt,lt);return Et._attribOpts=wt,Et;}throw new Error("Context 2D cannot create webgl program.");}},{key:"createPassProgram",value:function value(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},lt=H.vertex,dt=lt===void 0?j:lt,wt=H.fragment,Et=wt===void 0?nt:wt,Ot=H.options;return this.createProgram({vertex:dt,fragment:Et,options:Ot});}},{key:"useProgram",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this[ct]){var dt=Object.assign({},H._attribOpts,lt);return this[ct].useProgram(H,dt);}throw new Error("Context 2D cannot use webgl program.");}},{key:"deleteTexture",value:function value(H){var lt=this[ct]||this[B];return lt.deleteTexture(H);}},{key:"clear",value:function value(){if(this[ct]){var H=this[ct].gl;H.clear(H.COLOR_BUFFER_BIT);}else{var lt;(lt=this[B]).clear.apply(lt,arguments);}}},{key:"drawMeshCloud",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=lt.clear,wt=dt===void 0?!1:dt,Et=lt.program,Ot=Et===void 0?null:Et,O=this[ct]||this[B],D=Ot||H.program;if(this[ct]){var J=O.gl;if(wt&&J.clear(J.COLOR_BUFFER_BIT),D)O.program!==D&&this.useProgram(D,{a_color:{type:"UNSIGNED_BYTE",normalize:!0},a_fillCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_strokeCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_frameIndex:{type:"UNSIGNED_BYTE",normalize:!1}});else{var Q=H.mesh.meshData,V=!!Q.uniforms.u_texSampler,tt=!!Q.uniforms.u_filterFlag,g=!!Q.uniforms.u_radialGradientVector,T=H.hasCloudColor,k=H.hasCloudFilter,Z=!!Q.uniforms.u_clipSampler;Object(x.applyCloudShader)(O,{hasTexture:V,hasFilter:tt,hasGradient:g,hasCloudColor:T,hasCloudFilter:k,hasClipPath:Z});}this[q](),O.setMeshData([H.meshData]),H.beforeRender&&H.beforeRender(J,H),ut(O),H.afterRender&&H.afterRender(J,H);}else O.setTransform(this.globalTransformMatrix),O.drawMeshCloud(H,{clear:wt,hook:!1});}},{key:"drawMeshes",value:function value(H){var lt=this,dt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},wt=dt.clear,Et=wt===void 0?!1:wt,Ot=dt.program,O=Ot===void 0?null:Ot,D=this[ct]||this[B];this[ct]?function(){var J=D.fbo,Q=Object(L.default)(lt,H,O==null),V=D.gl;Et&&V.clear(V.COLOR_BUFFER_BIT);var tt=!Object(w.isUnitTransform)(lt.globalTransformMatrix);lt._drawCalls=0;var g=P(Q),T;try{var k=function k(){var st=T.value;lt._drawCalls++;var ft=O||st.program;if(st instanceof A.default)lt.drawMeshCloud(st,{clear:Et,program:ft});else{var pt=lt.canvas,ot=pt.width,mt=pt.height;if(st.beforeRender&&st.beforeRender(V,st),st.pass.length&&((!lt.fbo||lt.fbo.width!==ot||lt.fbo.height!==mt)&&(lt.fbo={width:ot,height:mt,target:D.createFBO(),buffer:D.createFBO(),swap:function swap(){var oe=[this.buffer,this.target];this.target=oe[0],this.buffer=oe[1];}}),D.bindFBO(lt.fbo.target)),!ft&&st.filterCanvas){Object(x.applyShader)(D,{hasTexture:!0});var Tt=lt.filterContext;if(!Tt){var Pt=S.default.createCanvas(ot,mt);Tt=Pt.getContext("2d"),lt.filterContext=Tt;}var Lt=H[st.packIndex],Dt=Lt.filter,Nt=H[st.packIndex+1],Yt=H[st.packIndex-1];(!Yt||!Yt.filterCanvas||Yt.filter!==Dt)&&(!Nt||!Nt.filterCanvas||Nt.filter!==Dt)?(tt?(Tt.save(),Object(X.drawMesh2D)(Lt,Tt,!1),Tt.restore(),Object(X.applyFilter)(Tt,Dt)):Object(X.drawMesh2D)(Lt,Tt,!0),lt[q](),Ct(D,Tt,ot,mt)):(tt&&Tt.save(),Object(X.drawMesh2D)(Lt,Tt,!1),tt&&Tt.restore(),(!Nt||!Nt.filterCanvas||Lt.filter!==Nt.filter)&&(Object(X.applyFilter)(Tt,Dt),lt[q](),Ct(D,Tt,ot,mt)));}else{if(ft)D.program!==ft&<.useProgram(ft,{a_color:{type:"UNSIGNED_BYTE",normalize:!0}});else{var Ut=!!st.uniforms.u_texSampler,Ft=!!st.uniforms.u_filterFlag,Jt=!!st.uniforms.u_radialGradientVector,ee=!!st.uniforms.u_clipSampler;Object(x.applyShader)(D,{hasTexture:Ut,hasFilter:Ft,hasGradient:Jt,hasClipPath:ee});}st.filterCanvas&&console.warn("User program ignored some filter effects."),lt[q](),D.setMeshData([st]),ut(D);}if(st.pass.length){var re=st.pass.length;st.pass.forEach(function(se,oe){se.blend=st.enableBlend,se.setTexture(D.fbo.texture),oe===re-1?D.bindFBO(J):(lt.fbo.swap(),D.bindFBO(lt.fbo.target)),se.program?D.useProgram(se.program):(lt.defaultPassProgram=lt.defaultPassProgram||lt.createPassProgram(),D.useProgram(lt.defaultPassProgram)),D.setMeshData([se.meshData]),V.clear(V.COLOR_BUFFER_BIT),ut(D);});}st.afterRender&&st.afterRender(V,st);}};for(g.s();!(T=g.n()).done;)k();}catch(Z){g.e(Z);}finally{g.f();}}():(D.setTransform(this.globalTransformMatrix),D.drawMeshes(H,{clear:Et}));}},{key:"drawImage",value:function value(H){for(var lt=arguments.length,dt=new Array(lt>1?lt-1:0),wt=1;wt<lt;wt++)dt[wt-1]=arguments[wt];var Et=dt.length;if(Et<2)throw new TypeError("Failed to execute 'drawImage' on 'Renderer': 3 arguments required, but only ".concat(dt.length+1," present."));if(Et!==2&&Et!==4&&Et!==8)throw new TypeError("Failed to execute 'drawImage' on 'Renderer': Valid arities are: [3, 5, 9], but ".concat(dt.length+1," arguments provided."));var Ot=null,O=null;Et===2?Ot=[dt[0],dt[1],H.width,H.height]:Et===4?Ot=dt:Et===8&&(O=dt.slice(0,4),Ot=dt.slice(4));var D=this.createTexture(H),J=this.canvas,Q=J.width,V=J.height,tt=new Y.default();tt.rect(Ot[0],Ot[1],Q,V);var g=new et.default(tt,{width:Q,height:V});g.setTexture(D,{rect:Ot,srcRect:O}),this.drawMeshes([g]),this.deleteTexture(D);}},{key:"setGlobalTransform",value:function value(){return this[G]=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],0,arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],0,arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5],1],this;}},{key:"globalTransform",value:function value(){for(var H=this[G],lt=arguments.length,dt=new Array(lt),wt=0;wt<lt;wt++)dt[wt]=arguments[wt];return this[G]=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),H,dt),this;}},{key:"globalTranslate",value:function value(H,lt){var dt=b.mat3.create();return dt=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),dt,[H,lt]),this.globalTransform.apply(this,u()(dt));}},{key:"globalRotate",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0],dt=o()(lt,2),wt=dt[0],Et=dt[1],Ot=b.mat3.create();return Ot=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Ot,[wt,Et]),Ot=b.mat3.rotate(Array.of(0,0,0,0,0,0,0,0,0),Ot,H),Ot=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Ot,[-wt,-Et]),this.globalTransform.apply(this,u()(Ot));}},{key:"globalScale",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:H,dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],wt=o()(dt,2),Et=wt[0],Ot=wt[1],O=b.mat3.create();return O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[Et,Ot]),O=b.mat3.scale(Array.of(0,0,0,0,0,0,0,0,0),O,[H,lt]),O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[-Et,-Ot]),this.globalTransform.apply(this,u()(O));}},{key:"globalSkew",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:H,dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],wt=o()(dt,2),Et=wt[0],Ot=wt[1],O=b.mat3.create();return O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[Et,Ot]),O=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),O,b.mat3.fromValues(1,Math.tan(lt),Math.tan(H),1,0,0)),O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[-Et,-Ot]),this.globalTransform.apply(this,u()(O));}},{key:"transformPoint",value:function value(H,lt,dt){var wt=this.globalTransformMatrix;dt&&(wt=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),wt,dt));var Et=H*wt[0]+lt*wt[2]+wt[4],Ot=H*wt[1]+lt*wt[3]+wt[5];return[Et,Ot];}},{key:"canvas",get:function get(){return this[at];}},{key:"canvasRenderer",get:function get(){return this[B];}},{key:"glRenderer",get:function get(){return this[ct];}},{key:"isWebGL2",get:function get(){return this[ct]&&this[ct].isWebGL2;}},{key:"options",get:function get(){return this[N];}},{key:"globalTransformMatrix",get:function get(){var H=this[G];return[H[0],H[1],H[3],H[4],H[6],H[7]];}},{key:"viewMatrix",get:function get(){return this[G];}}]),$;}();},/* 13 *//***/function(e,n,i){var s=i(14),o=i(15),a=i(16),u=i(18);function h(v,p){return s(v)||o(v,p)||a(v,p)||u();}e.exports=h;},/* 14 *//***/function(e,n){function i(s){if(Array.isArray(s))return s;}e.exports=i;},/* 15 *//***/function(e,n){function i(s,o){if(!((typeof Symbol==="undefined"?"undefined":_typeof(Symbol))>"u"||!(Symbol.iterator in Object(s)))){var a=[],u=!0,h=!1,v=void 0;try{for(var p=s[Symbol.iterator](),y;!(u=(y=p.next()).done)&&(a.push(y.value),!(o&&a.length===o));u=!0);}catch(C){h=!0,v=C;}finally{try{!u&&p.return!=null&&p.return();}finally{if(h)throw v;}}return a;}}e.exports=i;},/* 16 *//***/function(e,n,i){var s=i(17);function o(a,u){if(a){if(typeof a=="string")return s(a,u);var h=Object.prototype.toString.call(a).slice(8,-1);if(h==="Object"&&a.constructor&&(h=a.constructor.name),h==="Map"||h==="Set")return Array.from(a);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return s(a,u);}}e.exports=o;},/* 17 *//***/function(e,n){function i(s,o){(o==null||o>s.length)&&(o=s.length);for(var a=0,u=new Array(o);a<o;a++)u[a]=s[a];return u;}e.exports=i;},/* 18 *//***/function(e,n){function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}e.exports=i;},/* 19 *//***/function(e,n,i){var s=i(20),o=i(21),a=i(16),u=i(22);function h(v){return s(v)||o(v)||a(v)||u();}e.exports=h;},/* 20 *//***/function(e,n,i){var s=i(17);function o(a){if(Array.isArray(a))return s(a);}e.exports=o;},/* 21 *//***/function(e,n){function i(s){if((typeof Symbol==="undefined"?"undefined":_typeof(Symbol))<"u"&&Symbol.iterator in Object(s))return Array.from(s);}e.exports=i;},/* 22 *//***/function(e,n){function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}e.exports=i;},/* 23 *//***/function(e,n){function i(s,o){if(!(s instanceof o))throw new TypeError("Cannot call a class as a function");}e.exports=i;},/* 24 *//***/function(e,n){function i(o,a){for(var u=0;u<a.length;u++){var h=a[u];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(o,h.key,h);}}function s(o,a,u){return a&&i(o.prototype,a),u&&i(o,u),o;}e.exports=s;},/* 25 *//***/function(e,n,i){i.r(n);var s=i(26);i(1).glMatrix.setMatrixArrayType(Array),n.default=s.default;},/* 26 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return j;});var s=i(27),o=/* @__PURE__ */i.n(s),a=i(29),u=/* @__PURE__ */i.n(a),h=i(13),v=/* @__PURE__ */i.n(h),p=i(19),y=/* @__PURE__ */i.n(p),C=i(23),b=/* @__PURE__ */i.n(C),M=i(24),L=/* @__PURE__ */i.n(M),X=i(30),Y=/* @__PURE__ */i.n(X),et=i(31),A=i(33),w=i(34),S=i(35);i(1).glMatrix.setMatrixArrayType(Array);var x={};function P(nt){for(var ct=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,B=[],N=nt.length,G=0;G<N;G++)G%ct<2&&B.push(0.5*(nt[G]+1));return B;}function z(nt,ct){var B=ct._buffers;Object.values(B).forEach(function(N){nt.deleteBuffer(N);}),ct._buffers={};}function U(nt,ct,B){return nt.activeTexture(nt.TEXTURE0+B),Array.isArray(ct._img)?nt.bindTexture(nt.TEXTURE_CUBE_MAP,ct):nt.bindTexture(nt.TEXTURE_2D,ct),ct;}var K={int:"1i",ivec2:"2i",ivec3:"3i",ivec4:"4i",float:"1f",vec2:"2f",vec3:"3f",vec4:"4f",mat2:"Matrix2fv",mat3:"Matrix3fv",mat4:"Matrix4fv",sampler1D:"sampler1D",sampler2D:"sampler2D",sampler3D:"sampler3D",samplerCube:"samplerCube",sampler1DShadow:"sampler1DShadow",sampler2DShadow:"sampler2DShadow",sampler2DRect:"sampler2DRect",sampler2DRectShadow:"sampler2DRectShadow"},j=/* @__PURE__ */function(){L()(nt,null,[{key:"addLibs",value:function value(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Object.assign(x,B);}},{key:"FLOAT",value:function value(B,N){return Object(et.pointsToBuffer)(B,Float32Array,N);}},{key:"UNSIGNED_BYTE",value:function value(B,N){return Object(et.pointsToBuffer)(B,Uint8Array,N);}},{key:"UNSIGNED_SHORT",value:function value(B,N){return Object(et.pointsToBuffer)(B,Uint16Array,N);}},{key:"BYTE",value:function value(B,N){return Object(et.pointsToBuffer)(B,Int8Array,N);}},{key:"SHORT",value:function value(B,N){return Object(et.pointsToBuffer)(B,Int16Array,N);}}]);function nt(ct){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b()(this,nt),this.options=Object.assign({},nt.defaultOptions,B),this.canvas=ct;var N;this.options.webgl2&&(N=ct.getContext("webgl2",this.options)),N==null&&(N=Object(et.setupWebGL)(ct,this.options),this.aia_ext=N.getExtension("ANGLE_instanced_arrays")),this.gl=N,N.viewport(0,0,ct.width,ct.height),N.clearColor(0,0,0,0),N.blendFuncSeparate(N.SRC_ALPHA,N.ONE_MINUS_SRC_ALPHA,N.ONE,N.ONE_MINUS_SRC_ALPHA),this.programs=[],this._events={};}return L()(nt,[{key:"_declareUniform",// WebGLRenderingContext.uniform[1234][fi][v]()
|
|
6
|
+
2/lt,0,0,0,-2/dt,0,0,0,1],Ot=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),Et,wt);this.projectionMatrix=Ot,this[ct]&&this[ct].gl.viewport(0,0,lt,dt);}},{key:"createTexture",value:function value(H,lt){var dt=this[ct]||this[B];return dt.createTexture(H,lt);}/* async */},{key:"loadTexture",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=lt.useImageBitmap,wt=dt===void 0?!1:dt,Et=this[ct]||this[B];return Et.loadTexture(H,{useImageBitmap:wt});}},{key:"createText",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=lt.font,wt=dt===void 0?"16px arial":dt,Et=lt.fillColor,Ot=Et===void 0?null:Et,O=lt.strokeColor,D=O===void 0?null:O,J=lt.strokeWidth,Q=J===void 0?1:J;if(this[ct]){var V=S.default.createText(H,{font:wt,fillColor:Ot,strokeColor:D,strokeWidth:Q});return{image:this.createTexture(V.image),rect:V.rect};}return{_img:{font:wt,fillColor:Ot,strokeColor:D,strokeWidth:Q,text:H}};}},{key:"createProgram",value:function value(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},lt=H.vertex,dt=H.fragment,wt=H.options;if(this[ct]){var Et=this[ct].compileSync(dt,lt);return Et._attribOpts=wt,Et;}throw new Error("Context 2D cannot create webgl program.");}},{key:"createPassProgram",value:function value(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},lt=H.vertex,dt=lt===void 0?j:lt,wt=H.fragment,Et=wt===void 0?nt:wt,Ot=H.options;return this.createProgram({vertex:dt,fragment:Et,options:Ot});}},{key:"useProgram",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this[ct]){var dt=Object.assign({},H._attribOpts,lt);return this[ct].useProgram(H,dt);}throw new Error("Context 2D cannot use webgl program.");}},{key:"deleteTexture",value:function value(H){var lt=this[ct]||this[B];return lt.deleteTexture(H);}},{key:"clear",value:function value(){if(this[ct]){var H=this[ct].gl;H.clear(H.COLOR_BUFFER_BIT);}else{var lt;(lt=this[B]).clear.apply(lt,arguments);}}},{key:"drawMeshCloud",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=lt.clear,wt=dt===void 0?!1:dt,Et=lt.program,Ot=Et===void 0?null:Et,O=this[ct]||this[B],D=Ot||H.program;if(this[ct]){var J=O.gl;if(wt&&J.clear(J.COLOR_BUFFER_BIT),D)O.program!==D&&this.useProgram(D,{a_color:{type:"UNSIGNED_BYTE",normalize:!0},a_fillCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_strokeCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_frameIndex:{type:"UNSIGNED_BYTE",normalize:!1}});else{var Q=H.mesh.meshData,V=!!Q.uniforms.u_texSampler,tt=!!Q.uniforms.u_filterFlag,g=!!Q.uniforms.u_radialGradientVector,T=H.hasCloudColor,k=H.hasCloudFilter,Z=!!Q.uniforms.u_clipSampler;Object(x.applyCloudShader)(O,{hasTexture:V,hasFilter:tt,hasGradient:g,hasCloudColor:T,hasCloudFilter:k,hasClipPath:Z});}this[q](),O.setMeshData([H.meshData]),H.beforeRender&&H.beforeRender(J,H),ut(O),H.afterRender&&H.afterRender(J,H);}else O.setTransform(this.globalTransformMatrix),O.drawMeshCloud(H,{clear:wt,hook:!1});}},{key:"drawMeshes",value:function value(H){var lt=this,dt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},wt=dt.clear,Et=wt===void 0?!1:wt,Ot=dt.program,O=Ot===void 0?null:Ot,D=this[ct]||this[B];this[ct]?function(){var J=D.fbo,Q=Object(L.default)(lt,H,O==null),V=D.gl;Et&&V.clear(V.COLOR_BUFFER_BIT);var tt=!Object(w.isUnitTransform)(lt.globalTransformMatrix);lt._drawCalls=0;var g=P(Q),T;try{var k=function k(){var st=T.value;lt._drawCalls++;var ft=O||st.program;if(st instanceof A.default)lt.drawMeshCloud(st,{clear:Et,program:ft});else{var pt=lt.canvas,ot=pt.width,mt=pt.height;if(st.beforeRender&&st.beforeRender(V,st),st.pass.length&&((!lt.fbo||lt.fbo.width!==ot||lt.fbo.height!==mt)&&(lt.fbo={width:ot,height:mt,target:D.createFBO(),buffer:D.createFBO(),swap:function swap(){var oe=[this.buffer,this.target];this.target=oe[0],this.buffer=oe[1];}}),D.bindFBO(lt.fbo.target)),!ft&&st.filterCanvas){Object(x.applyShader)(D,{hasTexture:!0});var It=lt.filterContext;if(!It){var Pt=S.default.createCanvas(ot,mt);It=Pt.getContext("2d"),lt.filterContext=It;}var Lt=H[st.packIndex],Dt=Lt.filter,Nt=H[st.packIndex+1],Yt=H[st.packIndex-1];(!Yt||!Yt.filterCanvas||Yt.filter!==Dt)&&(!Nt||!Nt.filterCanvas||Nt.filter!==Dt)?(tt?(It.save(),Object(X.drawMesh2D)(Lt,It,!1),It.restore(),Object(X.applyFilter)(It,Dt)):Object(X.drawMesh2D)(Lt,It,!0),lt[q](),Ct(D,It,ot,mt)):(tt&&It.save(),Object(X.drawMesh2D)(Lt,It,!1),tt&&It.restore(),(!Nt||!Nt.filterCanvas||Lt.filter!==Nt.filter)&&(Object(X.applyFilter)(It,Dt),lt[q](),Ct(D,It,ot,mt)));}else{if(ft)D.program!==ft&<.useProgram(ft,{a_color:{type:"UNSIGNED_BYTE",normalize:!0}});else{var Ut=!!st.uniforms.u_texSampler,Ft=!!st.uniforms.u_filterFlag,Jt=!!st.uniforms.u_radialGradientVector,ee=!!st.uniforms.u_clipSampler;Object(x.applyShader)(D,{hasTexture:Ut,hasFilter:Ft,hasGradient:Jt,hasClipPath:ee});}st.filterCanvas&&console.warn("User program ignored some filter effects."),lt[q](),D.setMeshData([st]),ut(D);}if(st.pass.length){var re=st.pass.length;st.pass.forEach(function(se,oe){se.blend=st.enableBlend,se.setTexture(D.fbo.texture),oe===re-1?D.bindFBO(J):(lt.fbo.swap(),D.bindFBO(lt.fbo.target)),se.program?D.useProgram(se.program):(lt.defaultPassProgram=lt.defaultPassProgram||lt.createPassProgram(),D.useProgram(lt.defaultPassProgram)),D.setMeshData([se.meshData]),V.clear(V.COLOR_BUFFER_BIT),ut(D);});}st.afterRender&&st.afterRender(V,st);}};for(g.s();!(T=g.n()).done;)k();}catch(Z){g.e(Z);}finally{g.f();}}():(D.setTransform(this.globalTransformMatrix),D.drawMeshes(H,{clear:Et}));}},{key:"drawImage",value:function value(H){for(var lt=arguments.length,dt=new Array(lt>1?lt-1:0),wt=1;wt<lt;wt++)dt[wt-1]=arguments[wt];var Et=dt.length;if(Et<2)throw new TypeError("Failed to execute 'drawImage' on 'Renderer': 3 arguments required, but only ".concat(dt.length+1," present."));if(Et!==2&&Et!==4&&Et!==8)throw new TypeError("Failed to execute 'drawImage' on 'Renderer': Valid arities are: [3, 5, 9], but ".concat(dt.length+1," arguments provided."));var Ot=null,O=null;Et===2?Ot=[dt[0],dt[1],H.width,H.height]:Et===4?Ot=dt:Et===8&&(O=dt.slice(0,4),Ot=dt.slice(4));var D=this.createTexture(H),J=this.canvas,Q=J.width,V=J.height,tt=new Y.default();tt.rect(Ot[0],Ot[1],Q,V);var g=new et.default(tt,{width:Q,height:V});g.setTexture(D,{rect:Ot,srcRect:O}),this.drawMeshes([g]),this.deleteTexture(D);}},{key:"setGlobalTransform",value:function value(){return this[G]=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],0,arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],0,arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5],1],this;}},{key:"globalTransform",value:function value(){for(var H=this[G],lt=arguments.length,dt=new Array(lt),wt=0;wt<lt;wt++)dt[wt]=arguments[wt];return this[G]=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),H,dt),this;}},{key:"globalTranslate",value:function value(H,lt){var dt=b.mat3.create();return dt=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),dt,[H,lt]),this.globalTransform.apply(this,u()(dt));}},{key:"globalRotate",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0],dt=o()(lt,2),wt=dt[0],Et=dt[1],Ot=b.mat3.create();return Ot=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Ot,[wt,Et]),Ot=b.mat3.rotate(Array.of(0,0,0,0,0,0,0,0,0),Ot,H),Ot=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),Ot,[-wt,-Et]),this.globalTransform.apply(this,u()(Ot));}},{key:"globalScale",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:H,dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],wt=o()(dt,2),Et=wt[0],Ot=wt[1],O=b.mat3.create();return O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[Et,Ot]),O=b.mat3.scale(Array.of(0,0,0,0,0,0,0,0,0),O,[H,lt]),O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[-Et,-Ot]),this.globalTransform.apply(this,u()(O));}},{key:"globalSkew",value:function value(H){var lt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:H,dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],wt=o()(dt,2),Et=wt[0],Ot=wt[1],O=b.mat3.create();return O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[Et,Ot]),O=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),O,b.mat3.fromValues(1,Math.tan(lt),Math.tan(H),1,0,0)),O=b.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),O,[-Et,-Ot]),this.globalTransform.apply(this,u()(O));}},{key:"transformPoint",value:function value(H,lt,dt){var wt=this.globalTransformMatrix;dt&&(wt=b.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),wt,dt));var Et=H*wt[0]+lt*wt[2]+wt[4],Ot=H*wt[1]+lt*wt[3]+wt[5];return[Et,Ot];}},{key:"canvas",get:function get(){return this[at];}},{key:"canvasRenderer",get:function get(){return this[B];}},{key:"glRenderer",get:function get(){return this[ct];}},{key:"isWebGL2",get:function get(){return this[ct]&&this[ct].isWebGL2;}},{key:"options",get:function get(){return this[N];}},{key:"globalTransformMatrix",get:function get(){var H=this[G];return[H[0],H[1],H[3],H[4],H[6],H[7]];}},{key:"viewMatrix",get:function get(){return this[G];}}]),$;}();},/* 13 *//***/function(e,n,i){var s=i(14),o=i(15),a=i(16),u=i(18);function h(v,p){return s(v)||o(v,p)||a(v,p)||u();}e.exports=h;},/* 14 *//***/function(e,n){function i(s){if(Array.isArray(s))return s;}e.exports=i;},/* 15 *//***/function(e,n){function i(s,o){if(!((typeof Symbol==="undefined"?"undefined":_typeof(Symbol))>"u"||!(Symbol.iterator in Object(s)))){var a=[],u=!0,h=!1,v=void 0;try{for(var p=s[Symbol.iterator](),y;!(u=(y=p.next()).done)&&(a.push(y.value),!(o&&a.length===o));u=!0);}catch(C){h=!0,v=C;}finally{try{!u&&p.return!=null&&p.return();}finally{if(h)throw v;}}return a;}}e.exports=i;},/* 16 *//***/function(e,n,i){var s=i(17);function o(a,u){if(a){if(typeof a=="string")return s(a,u);var h=Object.prototype.toString.call(a).slice(8,-1);if(h==="Object"&&a.constructor&&(h=a.constructor.name),h==="Map"||h==="Set")return Array.from(a);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return s(a,u);}}e.exports=o;},/* 17 *//***/function(e,n){function i(s,o){(o==null||o>s.length)&&(o=s.length);for(var a=0,u=new Array(o);a<o;a++)u[a]=s[a];return u;}e.exports=i;},/* 18 *//***/function(e,n){function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}e.exports=i;},/* 19 *//***/function(e,n,i){var s=i(20),o=i(21),a=i(16),u=i(22);function h(v){return s(v)||o(v)||a(v)||u();}e.exports=h;},/* 20 *//***/function(e,n,i){var s=i(17);function o(a){if(Array.isArray(a))return s(a);}e.exports=o;},/* 21 *//***/function(e,n){function i(s){if((typeof Symbol==="undefined"?"undefined":_typeof(Symbol))<"u"&&Symbol.iterator in Object(s))return Array.from(s);}e.exports=i;},/* 22 *//***/function(e,n){function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}e.exports=i;},/* 23 *//***/function(e,n){function i(s,o){if(!(s instanceof o))throw new TypeError("Cannot call a class as a function");}e.exports=i;},/* 24 *//***/function(e,n){function i(o,a){for(var u=0;u<a.length;u++){var h=a[u];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(o,h.key,h);}}function s(o,a,u){return a&&i(o.prototype,a),u&&i(o,u),o;}e.exports=s;},/* 25 *//***/function(e,n,i){i.r(n);var s=i(26);i(1).glMatrix.setMatrixArrayType(Array),n.default=s.default;},/* 26 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return j;});var s=i(27),o=/* @__PURE__ */i.n(s),a=i(29),u=/* @__PURE__ */i.n(a),h=i(13),v=/* @__PURE__ */i.n(h),p=i(19),y=/* @__PURE__ */i.n(p),C=i(23),b=/* @__PURE__ */i.n(C),M=i(24),L=/* @__PURE__ */i.n(M),X=i(30),Y=/* @__PURE__ */i.n(X),et=i(31),A=i(33),w=i(34),S=i(35);i(1).glMatrix.setMatrixArrayType(Array);var x={};function P(nt){for(var ct=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,B=[],N=nt.length,G=0;G<N;G++)G%ct<2&&B.push(0.5*(nt[G]+1));return B;}function z(nt,ct){var B=ct._buffers;Object.values(B).forEach(function(N){nt.deleteBuffer(N);}),ct._buffers={};}function U(nt,ct,B){return nt.activeTexture(nt.TEXTURE0+B),Array.isArray(ct._img)?nt.bindTexture(nt.TEXTURE_CUBE_MAP,ct):nt.bindTexture(nt.TEXTURE_2D,ct),ct;}var K={int:"1i",ivec2:"2i",ivec3:"3i",ivec4:"4i",float:"1f",vec2:"2f",vec3:"3f",vec4:"4f",mat2:"Matrix2fv",mat3:"Matrix3fv",mat4:"Matrix4fv",sampler1D:"sampler1D",sampler2D:"sampler2D",sampler3D:"sampler3D",samplerCube:"samplerCube",sampler1DShadow:"sampler1DShadow",sampler2DShadow:"sampler2DShadow",sampler2DRect:"sampler2DRect",sampler2DRectShadow:"sampler2DRectShadow"},j=/* @__PURE__ */function(){L()(nt,null,[{key:"addLibs",value:function value(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Object.assign(x,B);}},{key:"FLOAT",value:function value(B,N){return Object(et.pointsToBuffer)(B,Float32Array,N);}},{key:"UNSIGNED_BYTE",value:function value(B,N){return Object(et.pointsToBuffer)(B,Uint8Array,N);}},{key:"UNSIGNED_SHORT",value:function value(B,N){return Object(et.pointsToBuffer)(B,Uint16Array,N);}},{key:"BYTE",value:function value(B,N){return Object(et.pointsToBuffer)(B,Int8Array,N);}},{key:"SHORT",value:function value(B,N){return Object(et.pointsToBuffer)(B,Int16Array,N);}}]);function nt(ct){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b()(this,nt),this.options=Object.assign({},nt.defaultOptions,B),this.canvas=ct;var N;this.options.webgl2&&(N=ct.getContext("webgl2",this.options)),N==null&&(N=Object(et.setupWebGL)(ct,this.options),this.aia_ext=N.getExtension("ANGLE_instanced_arrays")),this.gl=N,N.viewport(0,0,ct.width,ct.height),N.clearColor(0,0,0,0),N.blendFuncSeparate(N.SRC_ALPHA,N.ONE_MINUS_SRC_ALPHA,N.ONE,N.ONE_MINUS_SRC_ALPHA),this.programs=[],this._events={};}return L()(nt,[{key:"_declareUniform",// WebGLRenderingContext.uniform[1234][fi][v]()
|
|
7
7
|
// WebGLRenderingContext.uniformMatrix[234]fv()
|
|
8
8
|
value:function value(B,N){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"1f",q=this.gl,at=q.getUniformLocation(B,N),ut,Ct=this;if(/^sampler/.test(G)){var R=B._samplerMap,$=B._bindTextures;Object.defineProperty(B.uniforms,N,{get:function get(){return ut;},set:function set(wt){ut=wt;var Et=R[N]!=null?R[N]:$.length;$[Et]=wt,U(q,wt,Et),R[N]||(R[N]=Et,q.uniform1i(at,Et)),Ct.options.autoUpdate&&Ct.update();},configurable:!1,enumerable:!0});}else{var _=G.indexOf("Matrix")===0,H=!_&&/v$/.test(G),lt=q["uniform".concat(G)].bind(q);Object.defineProperty(B.uniforms,N,{get:function get(){return ut;},set:function set(wt){ut=wt,typeof wt=="number"&&(wt=[wt]),_?lt(at,!1,wt):H?lt(at,wt):lt.apply(void 0,[at].concat(y()(wt))),Ct.options.autoUpdate&&Ct.update();},configurable:!1,enumerable:!0});}}},{key:"_draw",value:function value(){var B=this,N=this.program;N.meshData.forEach(function(G,q){var at=G.positions,ut=G.cells,Ct=G.instanceCount,R=G.cellsCount,$=G.attributes,_=G.uniforms,H=G.textureCoord,lt=G.enableBlend,dt=B.gl,wt=G.mode!=null?G.mode:dt.TRIANGLES;typeof wt=="string"&&(wt=dt[wt]),lt?dt.enable(dt.BLEND):dt.disable(dt.BLEND),dt.bindBuffer(dt.ARRAY_BUFFER,N._buffers.verticesBuffer),dt.bufferData(dt.ARRAY_BUFFER,at,dt.STATIC_DRAW),ut&&(dt.bindBuffer(dt.ELEMENT_ARRAY_BUFFER,N._buffers.cellsBuffer),dt.bufferData(dt.ELEMENT_ARRAY_BUFFER,ut,dt.STATIC_DRAW));var Et=[];$&&Object.values($).forEach(function(J){var Q=J.name,V=J.data,tt=J.divisor;if(dt.bindBuffer(dt.ARRAY_BUFFER,N._buffers[Q]),dt.bufferData(dt.ARRAY_BUFFER,V,dt.STATIC_DRAW),tt!=null){var g=dt.getAttribLocation(N,Q);g>=0&&(dt.enableVertexAttribArray(g),Et.push(g),dt.vertexAttribDivisor?dt.vertexAttribDivisor(g,tt):B.aia_ext&&B.aia_ext.vertexAttribDivisorANGLE(g,tt));}}),_&&Object.entries(_).forEach(function(J){var Q=v()(J,2),V=Q[0],tt=Q[1];B.uniforms[V]=tt;});var Ot;if(!ut){var O=N._dimension;Ot=at.length/O;}if(N._enableTextures&&N._buffers.texCoordBuffer){var D=H||P(at,N._dimension);dt.bindBuffer(dt.ARRAY_BUFFER,N._buffers.texCoordBuffer),dt.bufferData(dt.ARRAY_BUFFER,nt.FLOAT(D),dt.STATIC_DRAW);}Ct!=null?(ut?dt.drawElementsInstanced?dt.drawElementsInstanced(wt,R,dt.UNSIGNED_SHORT,0,Ct):B.aia_ext&&B.aia_ext.drawElementsInstancedANGLE(wt,R,dt.UNSIGNED_SHORT,0,Ct):dt.drawArraysInstanced?dt.drawArraysInstanced(wt,0,Ot,Ct):B.aia_ext.drawArraysInstancedANGLE(wt,0,Ot,Ct),Et.forEach(function(J){dt.vertexAttribDivisor?dt.vertexAttribDivisor(J,null):B.aia_ext&&B.aia_ext.vertexAttribDivisorANGLE(J,null);})):ut?dt.drawElements(wt,R,dt.UNSIGNED_SHORT,0):dt.drawArrays(wt,0,Ot);});}},{key:"deleteProgram",value:function value(B){var N=this.gl;this.program===B&&(this.startRender=!1,this._renderFrameID&&(cancelAnimationFrame(this._renderFrameID),delete this._renderFrameID),N.useProgram(null));var G=this.programs.indexOf(B);G>=0&&this.programs.splice(G,1),z(N,B),N.deleteProgram(B);}/**
|
|
9
9
|
[{
|
|
@@ -33,12 +33,12 @@ Et):Et();}this._invoke=lt;}nt(ct.prototype),ct.prototype[y]=function(){return th
|
|
|
33
33
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
34
34
|
// object. Either way, the resulting object will be used to initialize
|
|
35
35
|
// the regeneratorRuntime variable at the top of this file.
|
|
36
|
-
e.exports);try{regeneratorRuntime=s;}catch(_unused2){Function("r","regeneratorRuntime = r")(s);}},/* 29 *//***/function(e,n){function i(o,a,u,h,v,p,y){try{var C=o[p](y),b=C.value;}catch(M){u(M);return;}C.done?a(b):Promise.resolve(b).then(h,v);}function s(o){return function(){var a=this,u=arguments;return new Promise(function(h,v){var p=o.apply(a,u);function y(b){i(p,h,v,y,C,"next",b);}function C(b){i(p,h,v,y,C,"throw",b);}y(void 0);});};}e.exports=s;},/* 30 *//***/function(e,n){function i(s,o,a){return o in s?Object.defineProperty(s,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[o]=a,s;}e.exports=i;},/* 31 *//***/function(e,n,i){i.r(n),i.d(n,"setupWebGL",function(){return y;}),i.d(n,"createProgram",function(){return C;}),i.d(n,"pointsToBuffer",function(){return b;}),i.d(n,"loadImage",function(){return L;}),i.d(n,"fetchShader",function(){return Y;});var s=i(27),o=/* @__PURE__ */i.n(s),a=i(29),u=/* @__PURE__ */i.n(a),h=i(32),v=/* @__PURE__ */i.n(h);i(1).glMatrix.setMatrixArrayType(Array);function p(A,w){for(var S=["webgl","experimental-webgl","webkit-3d","moz-webgl"],x=null,P=0;P<S.length;++P){try{x=A.getContext(S[P],w);}catch(_unused3){}if(x)break;}return x;}function y(A,w){var S=p(A,w);if(!S)throw new Error("Sorry, your browser doesn't support WebGL.");return S;}function C(A,w,S){var x=A.createShader(A.VERTEX_SHADER);if(A.shaderSource(x,w),A.compileShader(x),!A.getShaderParameter(x,A.COMPILE_STATUS)){var P="Vertex shader failed to compile. The error log is:".concat(A.getShaderInfoLog(x));throw new Error(P);}var z=A.createShader(A.FRAGMENT_SHADER);if(A.shaderSource(z,S),A.compileShader(z),!A.getShaderParameter(z,A.COMPILE_STATUS)){var U="Fragment shader failed to compile. The error log is:".concat(A.getShaderInfoLog(z));throw new Error(U);}var K=A.createProgram();if(A.attachShader(K,x),A.attachShader(K,z),A.linkProgram(K),!A.getProgramParameter(K,A.LINK_STATUS)){var j="Shader program failed to link. The error log is:".concat(A.getProgramInfoLog(K));throw new Error(j);}return A.deleteShader(x),A.deleteShader(z),K;}function b(A){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Float32Array,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(S&&!(S instanceof w))throw new TypeError("Wrong buffer type.");if(A==null||A instanceof w)return A;if(A[0]==null||A[0].length==null)return S?(S.set(A,0),S):new w(A);var x=A[0].length,P=A.length;S||(S=new w(x*P));for(var z=0,U=0;U<P;U++)for(var K=0;K<x;K++)S[z++]=A[U][K];return S;}var M={};function L(A){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=w.useImageBitmap,x=S===void 0?!0:S,P=w.alias,z=P===void 0?null:P;if(!M[A]){if(typeof Image=="function"){var U=new Image();typeof A=="string"&&!(((typeof location==="undefined"?"undefined":_typeof(location))>"u"?"undefined":v()(location))==="object"&&/^file:/.test(location.href))&&!/^data:/.test(A)&&(U.crossOrigin="anonymous"),M[A]=new Promise(function(K){U.onload=function(){x&&typeof createImageBitmap=="function"?createImageBitmap(U,{imageOrientation:"flipY"}).then(function(j){M[A]=j,z&&(M[z]=j),K(j);}):(M[A]=U,z&&(M[z]=U),K(U));},U.src=A;}),z&&(M[z]=M[A]);}else if(typeof fetch=="function")return fetch(A,{method:"GET",mode:"cors",cache:"default"}).then(function(K){return K.blob();}).then(function(K){return createImageBitmap(K,{imageOrientation:"flipY"}).then(function(j){return M[A]=j,z&&(M[z]=j),j;});});}return M[A];}var X={};function Y(A){return et.apply(this,arguments);}function et(){return et=u()(/* @__PURE__ */o.a.mark(function A(w){var S,x;return o.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:if(!X[w]){z.next=2;break;}return z.abrupt("return",X[w]);case 2:return z.next=4,fetch(w);case 4:if(S=z.sent,!(S.status>=200&&S.status<300)){z.next=11;break;}return z.next=8,S.text();case 8:return x=z.sent,X[w]=x,z.abrupt("return",x);case 11:throw new Error("Shader loaded error.");case 12:case"end":return z.stop();}},A);})),et.apply(this,arguments);}},/* 32 *//***/function(e,n){function i(s){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?e.exports=i=function i(a){return typeof a;}:e.exports=i=function i(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a;},i(s);}e.exports=i;},/* 33 *//***/function(e,n,i){i.r(n),n.default="attribute vec3 a_vertexPosition;\n\nvoid main() {\n gl_PointSize = 1.0;\n gl_Position = vec4(a_vertexPosition, 1);\n}";},/* 34 *//***/function(e,n,i){i.r(n),n.default="#ifdef GL_ES\nprecision mediump float;\n#endif\n\nvoid main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.1);\n}";},/* 35 *//***/function(e,n,i){i.r(n),n.default="attribute vec4 a_vertexPosition;\nattribute vec2 a_vertexTextureCoord;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n gl_PointSize = 1.0;\n gl_Position = a_vertexPosition;\n vTextureCoord = a_vertexTextureCoord;\n}";},/* 36 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return A;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(13),u=/* @__PURE__ */i.n(a),h=i(27),v=/* @__PURE__ */i.n(h),p=i(29),y=/* @__PURE__ */i.n(p),C=i(23),b=/* @__PURE__ */i.n(C),M=i(24),L=/* @__PURE__ */i.n(M),X=i(37),Y=i(41);i(1).glMatrix.setMatrixArrayType(Array);var et=Symbol("transform"),A=/* @__PURE__ */function(){function w(S,x){b()(this,w),this.context=S.getContext("2d"),this.options=x,this[et]=[1,0,0,1,0,0];}return L()(w,[{key:"createTexture",value:function value(x){var P={_img:x};return P;}},{key:"loadTexture",value:function(){var S=y()(/* @__PURE__ */v.a.mark(function P(z){var U;return v.a.wrap(function(j){for(;;)switch(j.prev=j.next){case 0:return j.next=2,X.default.loadImage(z,{useImageBitmap:!1});case 2:return U=j.sent,j.abrupt("return",this.createTexture(U));case 4:case"end":return j.stop();}},P,this);}));function x(P){return S.apply(this,arguments);}return x;}()},{key:"deleteTexture",value:function value(x){return x;}},{key:"clear",value:function value(x,P,z,U){var K=this.context;x=x||0,P=P||0,z=z||K.canvas.width-x,U=U||K.canvas.height-P,K.clearRect(x,P,z,U);}},{key:"drawMeshCloud",value:function value(x){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=P.clear,U=z===void 0?!1:z,K=[],j=0;j<x.amount;j++){var nt=x.getTransform(j),ct=x.getTextureFrame(j);ct&&(ct=ct._img);var B=x.getFilter(j),N=x.getCloudRGBA(j),G=N.fill,q=N.stroke;K.push({mesh:x.mesh,_cloudOptions:[G,q,ct,nt,B]});}x.beforeRender&&x.beforeRender(this.context,x),this.drawMeshes(K,{clear:U,hook:!1}),x.afterRender&&x.afterRender(this.context,x);}},{key:"drawMeshes",value:function value(x){var P=this,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=z.clear,K=U===void 0?!1:U,j=z.hook,nt=j===void 0?!0:j,ct=this.context;K&&ct.clearRect(0,0,ct.canvas.width,ct.canvas.height);var B=null,N=ct.canvas,G=N.width,q=N.height,at=x.length;x.forEach(function(ut,Ct){var R,$,_,H,lt;if(nt&&ut.beforeRender&&ut.beforeRender(ct,ut),ut._cloudOptions){var dt=u()(ut._cloudOptions,5);R=dt[0],$=dt[1],_=dt[2],H=dt[3],lt=dt[4],ut=ut.mesh;}var wt=ut.filter;if(lt&&(wt=wt?"".concat(wt," ").concat(lt):lt),wt&&!P.filterBuffer&&P.filterBuffer!==!1){var Et=X.default.createCanvas(G,q);Et?P.filterBuffer=Et.getContext("2d"):P.filterBuffer=!1;}if(B&&B!==wt&&(Object(Y.applyFilter)(P.filterBuffer,B),ct.drawImage(P.filterBuffer.canvas,0,0,G,q),P.filterBuffer.clearRect(0,0,G,q),B=null),wt&&P.filterBuffer){var Ot;P.filterBuffer.save(),(Ot=P.filterBuffer).transform.apply(Ot,o()(P[et])),Object(Y.drawMesh2D)(ut,P.filterBuffer,!1,R,$,_,H),P.filterBuffer.restore(),Ct===at-1?(Object(Y.applyFilter)(P.filterBuffer,wt),ct.drawImage(P.filterBuffer.canvas,0,0,G,q),P.filterBuffer.clearRect(0,0,G,q)):B=wt;}else ct.save(),ct.transform.apply(ct,o()(P[et])),Object(Y.drawMesh2D)(ut,ct,!1,R,$,_,H),ct.restore();nt&&ut.afterRender&&ut.afterRender(ct,ut);});}},{key:"setTransform",value:function value(x){this[et]=x;}}]),w;}();},/* 37 *//***/function(e,n,i){i.r(n),function(s){var o=i(32),a=/* @__PURE__ */i.n(o),u=i(19),h=/* @__PURE__ */i.n(u),v=i(25),p=i(39),y=i(40);i(1).glMatrix.setMatrixArrayType(Array);var C={};function b(A,w){var S=A.style,x=A.variant,P=A.weight,z=A.stretch,U=A.size,K=A.pxLineHeight,j=A.family;return z==="normal"?"".concat(S," ").concat(x," ").concat(P," ").concat(U*w,"px/").concat(K*w,"px ").concat(j):"".concat(S," ").concat(x," ").concat(P," ").concat(z," ").concat(U*w,"px/").concat(K*w,"px ").concat(j);}function M(A,w){var S=w.font,x=w.fillColor,P=w.strokeColor,z=w.strokeWidth,U=w.ratio,K=U===void 0?1:U,j=w.textCanvas,nt=w.cachable,ct=nt===void 0?!1:nt,B;if(ct){B=[A,S,String(x),String(P),String(z)].join("###");var N=C[B];if(N)return N;}j||(j=Y(1,1));var G=j.getContext("2d");G.save(),G.font=S;var q=G.measureText(A),at=q.width;G.restore();var ut=Object(p.default)(S),Ct=Math.max(ut.pxLineHeight,ut.pxHeight*1.13);/italic|oblique/.test(S)&&(at+=Ct*Math.tan(15*Math.PI/180)),!x&&!P&&(x="#000");var R=G.canvas,$=Math.ceil(at),_=Math.ceil(Ct);R.width=Math.round($*K),R.height=Math.round(_*K),G.save(),G.font=b(ut,K),G.textAlign="center",G.textBaseline="middle";var H=R.height*0.5+ut.pxHeight*0.05*K,lt=R.width*0.5;if(x){if(Array.isArray(x))x=Object(y.default)(x);else if(x.vector){var dt,wt=x,Et=wt.vector,Ot=wt.colors;Et.length===6?dt=G.createRadialGradient.apply(G,h()(Et)):dt=G.createLinearGradient.apply(G,h()(Et)),Ot.forEach(function(tt){var g=tt.offset,T=tt.color;dt.addColorStop(g,T);}),x=dt;}G.fillStyle=x,G.fillText(A,lt,H);}if(P){if(G.lineWidth=z*K,Array.isArray(P))P=Object(y.default)(P);else if(P.vector){var O,D=P,J=D.vector,Q=D.colors;J.length===6?O=G.createRadialGradient.apply(G,h()(J)):O=G.createLinearGradient.apply(G,h()(J)),Q.forEach(function(tt){var g=tt.offset,T=tt.color;O.addColorStop(g,T);}),P=O;}G.strokeStyle=P,G.strokeText(A,lt,H);}G.restore();var V={image:j,rect:[0,0,$,_]};return ct&&(C[B]=V),V;}var L=!1;if(((typeof navigator==="undefined"?"undefined":_typeof(navigator))>"u"?"undefined":a()(navigator))==="object"&&typeof navigator.userAgent=="string"){var X=navigator.userAgent.toLowerCase().match(/chrome\/(\d+)/);X&&(L=Number(X[1])<70);}function Y(A,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=S.offscreen||!L&&S.offscreen!==!1,P;return _typeof(s)<"u"&&typeof s.createCanvas=="function"?P=s.createCanvas(A,w,S):x&&typeof OffscreenCanvas=="function"?P=new OffscreenCanvas(A,w):(P=document.createElement("canvas"),P.width=A,P.height=w),P;}var et={createCanvas:Y,createText:M,loadImage:v.default.loadImage};n.default=et;}.call(this,i(38));},/* 38 *//***/function(e,n){var i;i=/* @__PURE__ */function(){return this;}();try{i=i||new Function("return this")();}catch(_unused4){(typeof window==="undefined"?"undefined":_typeof(window))=="object"&&(i=window);}e.exports=i;},/* 39 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return X;}),i(1).glMatrix.setMatrixArrayType(Array);function s(Y,et){if(typeof Y=="string"){var A=Y.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%)$/);A?Y={size:parseFloat(A[1]),unit:A[2]}:Y={size:parseInt(Y,10),unit:"px"};}var w=Y,S=w.size,x=w.unit;if(x==="pt")S/=0.75;else if(x==="pc")S*=16;else if(x==="in")S*=96;else if(x==="cm")S*=96/2.54;else if(x==="mm")S*=96/25.4;else if(x==="em"||x==="rem"||x==="ex"){if(!et&&typeof getComputedStyle=="function"&&(typeof document==="undefined"?"undefined":_typeof(document))<"u"){var P=getComputedStyle(document.documentElement).fontSize;et=s(P,16);}S*=et,x==="ex"&&(S/=2);}else if(x==="q")S*=96/25.4/4;else if(x==="vw"||x==="vh"){if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){var z=x==="vw"?document.documentElement.clientWidth:document.documentElement.clientHeight;S*=z/100;}}else if((x==="vmax"||x==="vmin")&&(typeof document==="undefined"?"undefined":_typeof(document))<"u"){var U=document.documentElement.clientWidth,K=document.documentElement.clientHeight;x==="vmax"?S*=Math.max(U,K)/100:S*=Math.min(U,K)/100;}return S;}var o="bold|bolder|lighter|[1-9]00",a="italic|oblique",u="small-caps",h="ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",v="px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%",p="'([^']+)'|\"([^\"]+)\"|([\\w-]|[\u4E00-\u9FA5])+",y=new RegExp("(".concat(o,") +"),"i"),C=new RegExp("(".concat(a,") +"),"i"),b=new RegExp("(".concat(u,") +"),"i"),M=new RegExp("(".concat(h,") +"),"i"),L=new RegExp("([\\d\\.]+)("+v+")(?:\\/([\\d\\.]+)("+v+"))? *((?:"+p+")( *, *(?:"+p+"))*)");function X(Y,et){var A=L.exec(Y);if(A){var w=parseFloat(A[3]),S={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(A[1]),unit:A[2],lineHeight:Number.isFinite(w)?w:void 0,lineHeightUnit:A[4],family:A[5].replace(/ *, */g,",")},x=Y.substring(0,A.index),P=y.exec(x),z=C.exec(x),U=b.exec(x),K=M.exec(x);return P&&(S.weight=P[1]),z&&(S.style=z[1]),U&&(S.variant=U[1]),K&&(S.stretch=K[1]),S.pxHeight=s({size:S.size,unit:S.unit},et),S.pxLineHeight=s({size:S.lineHeight||S.size,unit:S.lineHeightUnit||S.unit},et),S;}}},/* 40 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return s;}),i(1).glMatrix.setMatrixArrayType(Array);function s(o){return"rgba(".concat(o.map(function(a,u){return u<3?Math.round(a*255):a;}).join(),")");}},/* 41 *//***/function(e,n,i){i.r(n),i.d(n,"applyFilter",function(){return p;}),i.d(n,"drawMesh2D",function(){return C;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(1),u=i(40),h=i(39),v=i(42);i(1).glMatrix.setMatrixArrayType(Array);function p(b,M){var L=b.canvas;b.save(),b.filter=M,b.drawImage(L,0,0,L.width,L.height),b.restore();}function y(b,M){var L=/rgba\((\d+),(\d+),(\d+),(\d+)\)/;b=b.match(L).slice(1,5).map(Number),M=M.match(L).slice(1,5).map(Number);for(var X=[],Y=M[3],et=0;et<4;et++)X[et]=Object(v.mix)(b[et],M[et],Y);return"rgba(".concat(X.join(),")");}function C(b,M){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,X=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,Y=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,et=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,A=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null;M.save();var w=!1,S=!1;if(M.globalAlpha=b.getOpacity(),b._updateMatrix){var x=b.transformScale/b.contours.scale;x>1.5&&b.accurate(b.transformScale);}if(b.lineWidth){var P=b.gradient&&b.gradient.stroke;if(P){var z=P,U=z.vector,K=z.colors;if(U.length===6)P=M.createRadialGradient.apply(M,o()(U));else if(U.length===4)P=M.createLinearGradient.apply(M,o()(U));else if(U.length===3)P=M.createCircularGradient.apply(M,o()(U));else throw new TypeError("Invalid vector dimension.");K.forEach(function(ut){var Ct=ut.offset,R=ut.color,$=Object(u.default)(R);Y&&($=y($,Y)),P.addColorStop(Ct,$);}),M.strokeStyle=P,w=!0;}else b.strokeStyle&&(Y?M.strokeStyle=y(b.strokeStyle,Y):M.strokeStyle=b.strokeStyle,w=!0);}w&&(M.lineWidth=b.lineWidth,M.lineJoin=b.lineJoin,M.lineCap=b.lineCap,M.miterLimit=b.miterLimit,b.lineDash&&(M.setLineDash(b.lineDash),b.lineDashOffset&&(M.lineDashOffset=b.lineDashOffset)));var j=b.gradient&&b.gradient.fill;if(j){var nt=j,ct=nt.vector,B=nt.colors;if(ct.length===6)j=M.createRadialGradient.apply(M,o()(ct));else if(ct.length===4)j=M.createLinearGradient.apply(M,o()(ct));else if(ct.length===3)j=M.createCircularGradient.apply(M,o()(ct));else throw new TypeError("Invalid vector dimension.");B.forEach(function(ut){var Ct=ut.offset,R=ut.color,$=Object(u.default)(R);Y&&($=y($,Y)),j.addColorStop(Ct,$);}),M.fillStyle=j,S=!0;}else b.fillStyle&&(X?M.fillStyle=y(b.fillStyle,X):M.fillStyle=b.fillStyle,S=!0);if(A&&M.transform.apply(M,o()(A)),M.transform.apply(M,o()(b.transformMatrix)),b.clipPath){var N=b.clipPath,G=new Path2D(N);M.clip(G);}var q=b.contours.length;if(b.contours.forEach(function(ut,Ct){var R=ut.length,$=R>1&&a.vec2.equals(ut[0],ut[R-1]),_=Ct===q-1&&b.texture;if(ut&&R>0){if(S||w||_){M.beginPath(),M.moveTo.apply(M,o()(ut[0]));for(var H=1;H<R;H++)H===R-1&&$?M.closePath():M.lineTo.apply(M,o()(ut[H]));}if(S&&M.fill(b.fillRule),_){M.save(),M.clip();var lt=b.texture,dt=lt.image,wt=lt.options;if(et&&(dt=et),wt.repeat&&console.warn("Context 2D not supported image repeat yet."),dt.font){wt.scale&&console.warn("Context 2D not supported text scale yet."),wt.srcRect&&console.warn("Context 2D not supported text srcRect yet.");var Et=dt,Ot=Et.font,O=Et.fillColor,D=Et.strokeColor,J=Et.strokeWidth,Q=Et.text;!O&&!D&&(O="#000"),Array.isArray(O)&&(O=Object(u.default)(O)),Array.isArray(D)&&(D=Object(u.default)(D)),M.font=Ot;var V=M.measureText(Q),tt=V.width,g=Object(h.default)(Ot),T=Math.max(g.pxLineHeight,g.pxHeight*1.13);M.textAlign="center",M.textBaseline="middle";var k=wt.rect,Z=k[0]+T*0.5+g.pxHeight*0.06,st=k[1]+tt*0.5;k[2]!=null&&M.scale(k[2]/tt,k[3]/T),O&&(M.fillStyle=O,M.fillText(Q,st,Z)),D&&(M.lineWidth=J,M.strokeStyle=D,M.strokeText(Q,st,Z));}else{var ft=wt.rect,pt=wt.srcRect;wt.scale&&(ft=[0,0,M.canvas.width,M.canvas.height]),wt.rotated&&ft&&(ft=[-ft[1],ft[0],ft[3],ft[2]]),pt&&(ft=ft||[0,0,pt[2],pt[3]]),wt.rotated&&(M.translate(0,ft?ft[2]:dt.width),M.rotate(-0.5*Math.PI)),pt?M.drawImage.apply(M,[dt].concat(o()(pt),o()(ft))):ft?M.drawImage.apply(M,[dt].concat(o()(ft))):M.drawImage(dt,0,0);}M.restore();}w&&M.stroke();}}),M.restore(),L){var at=b.filter;at&&p(M,at);}}},/* 42 *//***/function(e,n,i){i.r(n),i.d(n,"clamp",function(){return a;}),i.d(n,"mix",function(){return u;}),i.d(n,"transformPoint",function(){return h;});var s=i(13),o=/* @__PURE__ */i.n(s);i(1).glMatrix.setMatrixArrayType(Array);function a(v,p,y){if(p>y){var C=[y,p];p=C[0],y=C[1];}return v<p?p:v>y?y:v;}function u(v,p,y){return v*(1-y)+p*y;}function h(v,p){var y=o()(v,2),C=y[0],b=y[1];return[C*p[0]+b*p[2]+p[4],C*p[1]+b*p[3]+p[5]];}},/* 43 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return C;});var s=i(27),o=/* @__PURE__ */i.n(s),a=i(44),u=i(45);i(1).glMatrix.setMatrixArrayType(Array);var h=/* @__PURE__ */o.a.mark(C);function v(b,M,L){var X=b.uniforms||{},Y=M.uniforms||{};if(X.u_texSampler&&Y.u_texSampler&&X.u_texSampler!==Y.u_texSampler)return!1;var et=Object.keys(X),A=Object.keys(Y),w=et.indexOf("u_texSampler"),S=A.indexOf("u_texSampler");if(w>=0&&et.splice(w,1),S>=0&&A.splice(S,1),et.length!==A.length)return!1;var x=et.every(function(z){var U=X[z],K=Y[z];if(U===K)return!0;if(U.length&&K.length&&U.length===K.length){for(var j=0;j<U.length;j++)if(U[j]!==K[j])return!1;return!0;}return!1;});if(x){if(X.u_texSampler&&!Y.u_texSampler)M.setTexture(X.u_texSampler,{hidden:!0});else if(!X.u_texSampler&&Y.u_texSampler)for(var P=0;P<L.length;P++)L[P].setTexture(Y.u_texSampler,{hidden:!0});}return x;}var p={};function y(b,M){if(b.length){var L=Object(a.default)(b,p);return L.enableBlend=M,b[0].filterCanvas&&(L.filterCanvas=!0),L.packIndex=b[0].packIndex,L.packLength=b.length,L.beforeRender=b[0].beforeRender,L.pass=b[0].pass,L.afterRender=b[b.length-1].afterRender,b.length=0,L;}}function C(b,M){var L,X,Y,et,A,w,S,x,P,z,U,K,j=arguments;return o.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:L=j.length>2&&j[2]!==void 0?j[2]:!1,X=[],Y=b.options.bufferSize,et=0,A=!1,w=0;case 6:if(!(w<M.length)){ct.next=50;break;}if(S=M[w],!(S instanceof u.default)){ct.next=18;break;}if(!X.length){ct.next=12;break;}return ct.next=12,y(X,A);case 12:return et=0,A=!1,ct.next=16,S;case 16:ct.next=47;break;case 18:if(x=S.meshData,x.clipPath&&!x.uniforms.u_clipSampler&&(P=b.createTexture(x.clipPath),x.uniforms.u_clipSampler=P),z=0,!((!L||!S.canIgnore())&&x&&x.positions.length)){ct.next=43;break;}if(S.packIndex=w,U=S.filterCanvas,z=x.positions.length,!(U||et+z>Y)){ct.next=33;break;}if(!X.length){ct.next=29;break;}return ct.next=29,y(X,A);case 29:et=0,A=!1,ct.next=40;break;case 33:if(!et){ct.next=40;break;}if(K=X[X.length-1],!(K&&(K.filterCanvas||K.afterRender||S.beforeRender||K.pass.length||S.pass.length||K.program!==S.program||!v(K,S,X)))){ct.next=40;break;}return ct.next=38,y(X,A);case 38:et=0,A=!1;case 40:X.push(S),A=A||S.enableBlend,et+=z;case 43:if(w!==M.length-1){ct.next=47;break;}if(!X.length){ct.next=47;break;}return ct.next=47,y(X,A);case 47:w++,ct.next=6;break;case 50:case"end":return ct.stop();}},h);}},/* 44 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return p;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(13),u=/* @__PURE__ */i.n(a);i(1).glMatrix.setMatrixArrayType(Array);var h={UNSIGNED_BYTE:Uint8Array,UNSIGNED_SHORT:Uint16Array,BYTE:Int8Array,SHORT:Int16Array,FLOAT:Float32Array};function v(y,C){for(var b=0,M=0,L=0,X=0,Y=0,et=0,A=0,w=y[0].program,S=0;S<y.length;S++){var x=y[S].meshData;if(x){A+=x.positions.length;var P=x.positions[0].length;b+=x.positions.length*P,M+=x.cells.length*3,et+=x.attributes.a_color.length*4;var z=x.textureCoord;z&&(L+=z.length*z[0].length);var U=x.attributes.a_sourceRect;U&&(X+=U.length*4);var K=x.attributes.a_clipUV;K&&(Y+=K.length*2);}}if((!C.positions||C.positions.length<b)&&(C.positions=new Float32Array(b)),(!C.cells||C.cells.length<M)&&(C.cells=new Uint16Array(M)),L&&(!C.textureCoord||C.textureCoord.length<L)&&(C.textureCoord=new Float32Array(L)),(!C.a_color||C.a_color.length<et)&&(C.a_color=new Uint8Array(et)),X&&(!C.a_sourceRect||C.a_sourceRect.length<X)&&(C.a_sourceRect=new Float32Array(X)),Y&&(!C.a_clipUV||C.a_clipUV.length<Y)&&(C.a_clipUV=new Float32Array(Y)),w)for(var j=Object.entries(w._attribute),nt=w._attribOpts||{},ct=0;ct<j.length;ct++){var B=u()(j[ct],2),N=B[0],G=B[1];if(N!=="a_color"&&N!=="a_sourceRect"&&G!=="ignored"){var q=nt[N]?nt[N].type:"FLOAT",at=h[q],ut=G.size*A;(!C[N]||C[N].length<ut)&&(C[N]=new at(ut));}}return C;}function p(y,C){var b=[],M=[],L=[],X=[],Y=[],et=[],A=0,w=0,S=y[0]?y[0].uniforms||{}:{},x=y[0]?y[0].program:null;C&&(v(y,C),M=C.cells,b=C.positions,L=C.textureCoord,X=C.a_color,Y=C.a_sourceRect,et=C.a_clipUV);for(var P=!1,z=!1,U={},K=0;K<y.length;K++){var j=y[K];if(j){if(j.meshData&&(j=j.meshData),C)for(var nt=j.positions,ct=0;ct<nt.length;ct++)for(var B=nt[ct],N=3*(A+ct),G=0;G<B.length;G++)b[N+G]=B[G];else{var q;(q=b).push.apply(q,o()(j.positions));}for(var at=j.cells,ut=0;ut<at.length;ut++){var Ct=at[ut];if(C){var R=3*(w+ut);M[R]=Ct[0]+A,M[R+1]=Ct[1]+A,M[R+2]=Ct[2]+A;}else M.push([Ct[0]+A,Ct[1]+A,Ct[2]+A]);}if(C)for(var $=j.attributes.a_color,_=0;_<$.length;_++){var H=$[_],lt=4*(A+_);X[lt]=H[0],X[lt+1]=H[1],X[lt+2]=H[2],X[lt+3]=H[3];}else{var dt;(dt=X).push.apply(dt,o()(j.attributes.a_color));}if(j.attributes.a_sourceRect)if(P=!0,C)for(var wt=j.attributes.a_sourceRect,Et=0;Et<wt.length;Et++){var Ot=wt[Et],O=4*(A+Et);Y[O]=Ot[0],Y[O+1]=Ot[1],Y[O+2]=Ot[2],Y[O+3]=Ot[3];}else{var D;(D=Y).push.apply(D,o()(j.attributes.a_sourceRect));}if(j.attributes.a_clipUV)if(z=!0,C)for(var J=j.attributes.a_clipUV,Q=0;Q<J.length;Q++){var V=J[Q],tt=2*(A+Q);et[tt]=V[0],et[tt+1]=V[1];}else{var g;(g=et).push.apply(g,o()(j.attributes.a_clipUV));}if(j.textureCoord)if(C)for(var T=j.textureCoord,k=0;k<T.length;k++)for(var Z=T[k],st=3*(A+k),ft=0;ft<Z.length;ft++)L[st+ft]=Z[ft];else{var pt;(pt=L).push.apply(pt,o()(j.textureCoord));}if(x)for(var ot=Object.entries(x._attribute),mt=0;mt<ot.length;mt++){var Tt=u()(ot[mt],2),Pt=Tt[0],Lt=Tt[1];if(Pt!=="a_color"&&Pt!=="a_sourceRect"&&Lt!=="ignored")if(U[Pt]=[],C){U[Pt]=C[Pt];for(var Dt=j.attributes[Pt],Nt=Dt[0].length,Yt=0;Yt<Dt.length;Yt++)for(var Ut=Dt[Yt],Ft=Nt*(A+Yt),Jt=0;Jt<Ut.length;Jt++)U[Pt][Ft+Jt]=Ut[Jt];}else{var ee;(ee=U[Pt]).push.apply(ee,o()(j.attributes[Pt]));}}A+=j.positions.length,w+=j.cells.length;}}U.a_color=X,P&&Y&&Y.length>0&&(U.a_sourceRect=Y);var re={positions:b,cells:M,attributes:U,uniforms:S,cellsCount:w*3,program:x};return L&&L.length&&(re.textureCoord=L),z&&et.length>0&&(U.a_clipUV=et),re;}},/* 45 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return B;});var s=i(30),o=/* @__PURE__ */i.n(s),a=i(19),u=/* @__PURE__ */i.n(a),h=i(13),v=/* @__PURE__ */i.n(h),p=i(23),y=/* @__PURE__ */i.n(p),C=i(24),b=/* @__PURE__ */i.n(C),M=i(1),L=i(46),X=i(42),Y=i(47);i(1).glMatrix.setMatrixArrayType(Array);function et(N,G){var q=Object.keys(N);if(Object.getOwnPropertySymbols){var at=Object.getOwnPropertySymbols(N);G&&(at=at.filter(function(ut){return Object.getOwnPropertyDescriptor(N,ut).enumerable;})),q.push.apply(q,at);}return q;}function A(N){for(var G=1;G<arguments.length;G++){var q=arguments[G]!=null?arguments[G]:{};G%2?et(Object(q),!0).forEach(function(at){o()(N,at,q[at]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(N,Object.getOwnPropertyDescriptors(q)):et(Object(q)).forEach(function(at){Object.defineProperty(N,at,Object.getOwnPropertyDescriptor(q,at));});}return N;}var w=Symbol("mesh"),S=Symbol("count"),x=Symbol("blend"),P=Symbol("filter"),z=Symbol("textures"),U=Symbol("textureOptions"),K=Symbol("cloudColor"),j=Symbol("cloudFilter"),nt=Symbol("buffer");function ct(N){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,q=new Float32Array(3*N),at=new Float32Array(3*N),ut=new Float32Array(4*N),Ct=new Float32Array(4*N),R=new Float32Array(4*N),$=new Float32Array(4*N),_=new Float32Array(4*N),H=new Uint8Array(N),lt=new Uint8Array(4*N),dt=new Uint8Array(4*N);return G&&(q.set(G.transform0,0),at.set(G.transform1,0),ut.set(G.color0,0),Ct.set(G.color1,0),R.set(G.color2,0),$.set(G.color3,0),_.set(G.color4,0),H.set(G.frameIndex,0),lt.set(G.fillColor,0),dt.set(G.strokeColor,0)),{bufferSize:N,transform0:q,transform1:at,color0:ut,color1:Ct,color2:R,color3:$,color4:_,frameIndex:H,fillColor:lt,strokeColor:dt};}var B=/* @__PURE__ */function(){function N(G){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,at=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ut=at.buffer,Ct=ut===void 0?1e3:ut;y()(this,N),Ct=Math.max(Ct,q),this[S]=q,this[w]=G,this[nt]=ct(Ct),this[z]=[],this[P]=[],this[K]=!1,this[j]=!1,this[x]=!1,this.initBuffer();}return b()(N,[{key:"initBuffer",value:function value(){for(var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,at=this[S],ut=q;ut<at;ut++)this[nt].transform0.set([1,0,0],ut*3),this[nt].transform1.set([0,1,0],ut*3),this[nt].frameIndex.set([-1],ut),this[nt].fillColor.set([0,0,0,0],ut*4),this[nt].strokeColor.set([0,0,0,0],ut*4),this.setColorTransform(ut,null);}},{key:"_getFilter",value:function value(q){return this[P][q]=this[P][q]||[],this[P][q];}},{key:"getFilter",value:function value(q){return this._getFilter(q).join(" ");}},{key:"canIgnore",value:function value(){return this[w].canIgnore();}},{key:"delete",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");var at=this[nt],ut=at.transform0,Ct=at.transform1,R=at.color0,$=at.color1,_=at.color2,H=at.color3,lt=at.color4,dt=at.frameIndex,wt=at.fillColor,Et=at.strokeColor;ut.set(ut.subarray(3*(q+1)),3*q),Ct.set(Ct.subarray(3*(q+1)),3*q),R.set(R.subarray(4*(q+1)),4*q),$.set($.subarray(4*(q+1)),4*q),_.set(_.subarray(4*(q+1)),4*q),H.set(H.subarray(4*(q+1)),4*q),lt.set(lt.subarray(4*(q+1)),4*q),dt.set(dt.subarray(q+1),q),wt.set(wt.subarray(4*(q+1)),4*q),Et.set(Et.subarray(4*(q+1)),4*q);for(var Ot in this[P])Ot===q?delete this[P][Ot]:Ot>q&&(this[P][Ot-1]=this[P][Ot],delete this[P][Ot]);this[S]--;}},{key:"setColorTransform",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=4;var ut=this[nt],Ct=ut.color0,R=ut.color1,$=ut.color2,_=ut.color3,H=ut.color4;return at!=null?(Ct.set([at[0],at[5],at[10],at[15]],q),R.set([at[1],at[6],at[11],at[16]],q),$.set([at[2],at[7],at[12],at[17]],q),_.set([at[3],at[8],at[13],at[18]],q),H.set([at[4],at[9],at[14],at[19]],q),this[x]=this[x]||at[18]<1,this[j]=!0):(Ct.set([1,0,0,0],q),R.set([0,1,0,0],q),$.set([0,0,1,0],q),_.set([0,0,0,1],q),H.set([0,0,0,0],q)),this;}},{key:"getColorTransform",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=4;var at=this[nt],ut=at.color0,Ct=at.color1,R=at.color2,$=at.color3,_=at.color4;return[ut[q],Ct[q],R[q],$[q],_[q],ut[q+1],Ct[q+1],R[q+1],$[q+1],_[q+1],ut[q+2],Ct[q+2],R[q+2],$[q+2],_[q+2],ut[q+3],Ct[q+3],R[q+3],$[q+3],_[q+3]];}},{key:"transformColor",value:function value(q,at){var ut=this.getColorTransform(q);return ut=Object(L.multiply)(ut,at),this.setColorTransform(q,ut),this;}},{key:"setFillColor",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");typeof at=="string"&&(at=Object(Y.default)(at)),at[3]>0&&(this[K]=!0),this[nt].fillColor.set(at.map(function(ut){return Math.round(255*ut);}),4*q);}},{key:"setStrokeColor",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");typeof at=="string"&&(at=Object(Y.default)(at)),at[3]>0&&(this[K]=!0),this[nt].strokeColor.set(at.map(function(ut){return Math.round(255*ut);}),4*q);}},{key:"getCloudRGBA",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=4;var at=this[nt],ut=at.fillColor,Ct=at.strokeColor,R=[ut[q],ut[q+1],ut[q+2],ut[q+3]],$=[Ct[q],Ct[q+1],Ct[q+2],Ct[q+3]];return R[3]/=255,$[3]/=255,{fill:"rgba(".concat(R.join(),")"),stroke:"rgba(".concat($.join(),")")};}},{key:"grayscale",value:function value(q,at){this.transformColor(q,Object(L.grayscale)(at)),this._getFilter(q).push("grayscale(".concat(100*at,"%)"));}},{key:"brightness",value:function value(q,at){this.transformColor(q,Object(L.brightness)(at)),this._getFilter(q).push("brightness(".concat(100*at,"%)"));}},{key:"saturate",value:function value(q,at){this.transformColor(q,Object(L.saturate)(at)),this._getFilter(q).push("saturate(".concat(100*at,"%)"));}},{key:"contrast",value:function value(q,at){this.transformColor(q,Object(L.contrast)(at)),this._getFilter(q).push("contrast(".concat(100*at,"%)"));}},{key:"invert",value:function value(q,at){this.transformColor(q,Object(L.invert)(at)),this._getFilter(q).push("invert(".concat(100*at,"%)"));}},{key:"sepia",value:function value(q,at){this.transformColor(q,Object(L.sepia)(at)),this._getFilter(q).push("sepia(".concat(100*at,"%)"));}},{key:"opacity",value:function value(q,at){this.transformColor(q,Object(L.opacity)(at)),this._getFilter(q).push("opacity(".concat(100*at,"%)"));}},{key:"hueRotate",value:function value(q,at){this.transformColor(q,Object(L.hueRotate)(at)),this._getFilter(q).push("hue-rotate(".concat(at,"deg)"));}},{key:"setTransform",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=3,at==null&&(at=[1,0,0,1,0,0]);var ut=this[nt],Ct=ut.transform0,R=ut.transform1;return Ct.set([at[0],at[2],at[4]],q),R.set([at[1],at[3],at[5]],q),this;}},{key:"getTransform",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=3;var at=this[nt],ut=at.transform0,Ct=at.transform1,R=[ut[q],Ct[q],ut[q+1],Ct[q+1],ut[q+2],Ct[q+2]];return R;}},{key:"getTextureFrame",value:function value(q){return this[z][this[nt].frameIndex[q]];}},{key:"setTextureFrames",value:function value(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],at=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(q.length>12)throw new Error("Max frames exceed. Allow 12 frames.");if(q.length){var ut=this[w];ut.setTexture(q[0],at);}this[z]=q,this[U]=at;}},{key:"setFrameIndex",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");var ut=this[z].length;if(ut<=0)throw new Error("No frames");this[nt].frameIndex[q]=at%ut;}},{key:"setProgram",value:function value(q){this[w].setProgram(q);}},{key:"transform",value:function value(q,at){var ut=this.getTransform(q);return at=M.mat2d.multiply(Array.of(0,0,0,0,0,0),ut,at),this.setTransform(q,at),this;}},{key:"translate",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1],$=M.mat2d.create();return $=M.mat2d.translate(Array.of(0,0,0,0,0,0),$,[Ct,R]),this.transform(q,$);}},{key:"rotate",value:function value(q,at){var ut=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],Ct=v()(ut,2),R=Ct[0],$=Ct[1],_=M.mat2d.create();return _=M.mat2d.translate(Array.of(0,0,0,0,0,0),_,[R,$]),_=M.mat2d.rotate(Array.of(0,0,0,0,0,0),_,at),_=M.mat2d.translate(Array.of(0,0,0,0,0,0),_,[-R,-$]),this.transform(q,_);}},{key:"scale",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1],$=R===void 0?Ct:R,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],H=v()(_,2),lt=H[0],dt=H[1],wt=M.mat2d.create();return wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[lt,dt]),wt=M.mat2d.scale(Array.of(0,0,0,0,0,0),wt,[Ct,$]),wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[-lt,-dt]),this.transform(q,wt);}},{key:"skew",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1],$=R===void 0?Ct:R,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],H=v()(_,2),lt=H[0],dt=H[1],wt=M.mat2d.create();return wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[lt,dt]),wt=M.mat2d.multiply(Array.of(0,0,0,0,0,0),wt,M.mat2d.fromValues(1,Math.tan($),Math.tan(Ct),1,0,0)),wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[-lt,-dt]),this.transform(q,wt);}},{key:"isPointCollision",value:function value(q,at){var ut,Ct=v()(at,2),R=Ct[0],$=Ct[1],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"both",H=this.getTransform(q),lt=Object(X.transformPoint)([R,$],M.mat2d.invert(Array.of(0,0,0,0,0,0),H));return(ut=this[w]).isPointCollision.apply(ut,u()(lt).concat([_]));}},{key:"isPointInFill",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1];return this.isPointCollision(q,[Ct,R],"fill");}},{key:"isPointInStroke",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1];return this.isPointCollision(q,[Ct,R],"stroke");}},{key:"bufferSize",get:function get(){return this[nt].bufferSize;}},{key:"mesh",get:function get(){return this[w];},set:function set(q){this[w]=q,this[z]&&this.setTextureFrames(this[z],this[U]);}},{key:"hasCloudColor",get:function get(){return this[K];}},{key:"hasCloudFilter",get:function get(){return this[j];}},{key:"enableBlend",get:function get(){return this[w].enableBlend||this[x];}},{key:"amount",get:function get(){return this[S];},set:function set(q){var at=this[S];q!==at&&(q>this[nt].bufferSize&&(this[nt]=ct(Math.max(q,this[nt].bufferSize+1e3),this[nt])),this[S]=q,q>at&&this.initBuffer(at));}},{key:"meshData",get:function get(){var q=this[w].meshData,at=q.attributes,ut=q.cells,Ct=q.positions,R=q.textureCoord,$=q.uniforms,_=this[z],H={attributes:A({},at),cells:ut,positions:Ct,textureCoord:R,uniforms:A({},$),instanceCount:this[S],enableBlend:this.enableBlend};_.length&&_.forEach(function(g,T){H.uniforms["u_texFrame".concat(T)]=g;});var lt=this[nt],dt=lt.transform0,wt=lt.transform1,Et=lt.color0,Ot=lt.color1,O=lt.color2,D=lt.color3,J=lt.color4,Q=lt.fillColor,V=lt.strokeColor,tt=lt.frameIndex;return this[w].uniforms.u_texSampler&&(H.attributes.a_frameIndex={data:tt,divisor:1}),H.attributes.a_transform0={data:dt,divisor:1},H.attributes.a_transform1={data:wt,divisor:1},H.attributes.a_colorCloud0={data:Et,divisor:1},H.attributes.a_colorCloud1={data:Ot,divisor:1},H.attributes.a_colorCloud2={data:O,divisor:1},H.attributes.a_colorCloud3={data:D,divisor:1},H.attributes.a_colorCloud4={data:J,divisor:1},this.hasCloudColor&&(H.attributes.a_fillCloudColor={data:Q,divisor:1},H.attributes.a_strokeCloudColor={data:V,divisor:1}),H;}},{key:"program",get:function get(){return this[w].program;}}]),N;}();},/* 46 *//***/function(e,n,i){i.r(n),i.d(n,"multiply",function(){return o;}),i.d(n,"grayscale",function(){return a;}),i.d(n,"brightness",function(){return u;}),i.d(n,"saturate",function(){return h;}),i.d(n,"contrast",function(){return v;}),i.d(n,"invert",function(){return p;}),i.d(n,"sepia",function(){return y;}),i.d(n,"opacity",function(){return C;}),i.d(n,"hueRotate",function(){return b;});var s=i(42);i(1).glMatrix.setMatrixArrayType(Array);function o(M,L){var X=[],Y=M[0],et=M[1],A=M[2],w=M[3],S=M[4],x=M[5],P=M[6],z=M[7],U=M[8],K=M[9],j=M[10],nt=M[11],ct=M[12],B=M[13],N=M[14],G=M[15],q=M[16],at=M[17],ut=M[18],Ct=M[19],R=L[0],$=L[1],_=L[2],H=L[3],lt=L[4];return X[0]=R*Y+$*x+_*j+H*G,X[1]=R*et+$*P+_*nt+H*q,X[2]=R*A+$*z+_*ct+H*at,X[3]=R*w+$*U+_*B+H*ut,X[4]=R*S+$*K+_*N+H*Ct+lt,R=L[5],$=L[6],_=L[7],H=L[8],lt=L[9],X[5]=R*Y+$*x+_*j+H*G,X[6]=R*et+$*P+_*nt+H*q,X[7]=R*A+$*z+_*ct+H*at,X[8]=R*w+$*U+_*B+H*ut,X[9]=R*S+$*K+_*N+H*Ct+lt,R=L[10],$=L[11],_=L[12],H=L[13],lt=L[14],X[10]=R*Y+$*x+_*j+H*G,X[11]=R*et+$*P+_*nt+H*q,X[12]=R*A+$*z+_*ct+H*at,X[13]=R*w+$*U+_*B+H*ut,X[14]=R*S+$*K+_*N+H*Ct+lt,R=L[15],$=L[16],_=L[17],H=L[18],lt=L[19],X[15]=R*Y+$*x+_*j+H*G,X[16]=R*et+$*P+_*nt+H*q,X[17]=R*A+$*z+_*ct+H*at,X[18]=R*w+$*U+_*B+H*ut,X[19]=R*S+$*K+_*N+H*Ct+lt,X;}function a(M){M=Object(s.clamp)(0,1,M);var L=0.2126*M,X=0.7152*M,Y=0.0722*M;return[L+1-M,X,Y,0,0,L,X+1-M,Y,0,0,L,X,Y+1-M,0,0,0,0,0,1,0];}function u(M){return[M,0,0,0,0,0,M,0,0,0,0,0,M,0,0,0,0,0,1,0];}function h(M){var L=0.2126*(1-M),X=0.7152*(1-M),Y=0.0722*(1-M);return[L+M,X,Y,0,0,L,X+M,Y,0,0,L,X,Y+M,0,0,0,0,0,1,0];}function v(M){var L=0.5*(1-M);return[M,0,0,0,L,0,M,0,0,L,0,0,M,0,L,0,0,0,1,0];}function p(M){var L=1-2*M;return[L,0,0,0,M,0,L,0,0,M,0,0,L,0,M,0,0,0,1,0];}function y(M){return[1-0.607*M,0.769*M,0.189*M,0,0,0.349*M,1-0.314*M,0.168*M,0,0,0.272*M,0.534*M,1-0.869*M,0,0,0,0,0,1,0];}function C(M){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,M,0];}function b(M){var L=M/180*Math.PI,X=Math.cos(L),Y=Math.sin(L),et=0.2126,A=0.7152,w=0.0722;return[et+X*(1-et)+Y*-et,A+X*-A+Y*-A,w+X*-w+Y*(1-w),0,0,et+X*-et+Y*0.143,A+X*(1-A)+Y*0.14,w+X*-w+Y*-0.283,0,0,et+X*-et+Y*-0.7874,A+X*-A+Y*A,w+X*(1-w)+Y*w,0,0,0,0,0,1,0];}},/* 47 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return a;});var s=i(48),o=/* @__PURE__ */i.n(s);i(1).glMatrix.setMatrixArrayType(Array);function a(u){var h=o()(u);if(!h||!h.length)throw new TypeError("Invalid color value.");return[h[0]/255,h[1]/255,h[2]/255,h[3]];}},/* 48 *//***/function(e,n,i){var s=i(49),o=i(53),a=i(55);e.exports=function(h){var v,p=s(h);return p.space?(v=Array(3),v[0]=a(p.values[0],0,255),v[1]=a(p.values[1],0,255),v[2]=a(p.values[2],0,255),p.space[0]==="h"&&(v=o.rgb(v)),v.push(a(p.alpha,0,1)),v):[];};},/* 49 *//***/function(e,n,i){(function(s){var o=i(50),a=i(51),u=i(52);e.exports=v;var h={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function v(p){var y,C=[],b=1,M;if(typeof p=="string"){if(o[p])C=o[p].slice(),M="rgb";else if(p==="transparent")b=0,M="rgb",C=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(p)){var L=p.slice(1),X=L.length,Y=X<=4;b=1,Y?(C=[parseInt(L[0]+L[0],16),parseInt(L[1]+L[1],16),parseInt(L[2]+L[2],16)],X===4&&(b=parseInt(L[3]+L[3],16)/255)):(C=[parseInt(L[0]+L[1],16),parseInt(L[2]+L[3],16),parseInt(L[4]+L[5],16)],X===8&&(b=parseInt(L[6]+L[7],16)/255)),C[0]||(C[0]=0),C[1]||(C[1]=0),C[2]||(C[2]=0),M="rgb";}else if(y=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(p)){var et=y[1],A=et==="rgb",L=et.replace(/a$/,"");M=L;var X=L==="cmyk"?4:L==="gray"?1:3;C=y[2].trim().split(/\s*,\s*/).map(function(P,z){if(/%$/.test(P))return z===X?parseFloat(P)/100:L==="rgb"?parseFloat(P)*255/100:parseFloat(P);if(L[z]==="h"){if(/deg$/.test(P))return parseFloat(P);if(h[P]!==void 0)return h[P];}return parseFloat(P);}),et===L&&C.push(1),b=A||C[X]===void 0?1:C[X],C=C.slice(0,X);}else p.length>10&&/[0-9](?:\s|\/)/.test(p)&&(C=p.match(/([0-9]+)/g).map(function(S){return parseFloat(S);}),M=p.match(/([a-z])/ig).join("").toLowerCase());}else if(!isNaN(p))M="rgb",C=[p>>>16,(p&65280)>>>8,p&255];else if(a(p)){var w=u(p.r,p.red,p.R,null);w!==null?(M="rgb",C=[w,u(p.g,p.green,p.G),u(p.b,p.blue,p.B)]):(M="hsl",C=[u(p.h,p.hue,p.H),u(p.s,p.saturation,p.S),u(p.l,p.lightness,p.L,p.b,p.brightness)]),b=u(p.a,p.alpha,p.opacity,1),p.opacity!=null&&(b/=100);}else(Array.isArray(p)||s.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(p))&&(C=[p[0],p[1],p[2]],M="rgb",b=p.length===4?p[3]:1);return{space:M,values:C,alpha:b};}}).call(this,i(38));},/* 50 *//***/function(e,n,i){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};},/* 51 *//***/function(e,n,i){var s=Object.prototype.toString;e.exports=function(o){var a;return s.call(o)==="[object Object]"&&(a=Object.getPrototypeOf(o),a===null||a===Object.getPrototypeOf({}));};},/* 52 *//***/function(e,n){e.exports=function(){for(var i=0;i<arguments.length;i++)if(arguments[i]!==void 0)return arguments[i];};},/* 53 *//***/function(e,n,i){var s=i(54);e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function rgb(o){var a=o[0]/360,u=o[1]/100,h=o[2]/100,v,p,y,C,b;if(u===0)return b=h*255,[b,b,b];h<0.5?p=h*(1+u):p=h+u-h*u,v=2*h-p,C=[0,0,0];for(var M=0;M<3;M++)y=a+1/3*-(M-1),y<0?y++:y>1&&y--,6*y<1?b=v+(p-v)*6*y:2*y<1?b=p:3*y<2?b=v+(p-v)*(2/3-y)*6:b=v,C[M]=b*255;return C;}},s.hsl=function(o){var a=o[0]/255,u=o[1]/255,h=o[2]/255,v=Math.min(a,u,h),p=Math.max(a,u,h),y=p-v,C,b,M;return p===v?C=0:a===p?C=(u-h)/y:u===p?C=2+(h-a)/y:h===p&&(C=4+(a-u)/y),C=Math.min(C*60,360),C<0&&(C+=360),M=(v+p)/2,p===v?b=0:M<=0.5?b=y/(p+v):b=y/(2-p-v),[C,b*100,M*100];};},/* 54 *//***/function(e,n,i){e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};},/* 55 *//***/function(e,n){e.exports=i;function i(s,o,a){return o<a?s<o?o:s>a?a:s:s<a?a:s>o?o:s;}},/* 56 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return nt;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(57),u=/* @__PURE__ */i.n(a),h=i(23),v=/* @__PURE__ */i.n(h),p=i(24),y=/* @__PURE__ */i.n(p),C=i(58),b=/* @__PURE__ */i.n(C),M=i(59),L=/* @__PURE__ */i.n(M),X=i(60),Y=/* @__PURE__ */i.n(X),et=i(61),A=i(63),w=/* @__PURE__ */i.n(A),S=i(70),x=i(72);i(1).glMatrix.setMatrixArrayType(Array);var P=Symbol("contours"),z=Symbol("path"),U=Symbol("simplify"),K=Symbol("scale"),j=2*Math.PI,nt=/* @__PURE__ */function(){function ct(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};v()(this,ct),typeof B=="string"&&(B={path:B}),B.path?this[z]=b()(B.path):this[z]=[],this[P]=null,this[U]=B.simplify!=null?B.simplify:0,this[K]=B.scale!=null?B.scale:2;}return y()(ct,[{key:"normalize",value:function value(){var N,G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,at=Object(et.default)(Y()(this[z])).map(function(ut){for(var Ct=u()(ut),R=Ct[0],$=Ct.slice(1),_=[R],H=0;H<$.length;H+=2){var lt=$[H]-G,dt=$[H+1]-q;_.push(lt,dt);}return _;});return this.beginPath(),(N=this[z]).push.apply(N,o()(at)),this;}},{key:"getPointAtLength",value:function value(N){return this.contours?Object(S.getPointAtLength)(this[P],N):null;}},{key:"getTotalLength",value:function value(){return this.contours?Object(S.getTotalLength)(this[P]):0;}},{key:"addPath",value:function value(N){var G;this[P]=null,typeof N=="string"&&(N=b()(N)),(G=this[z]).push.apply(G,o()(N));}},{key:"beginPath",value:function value(){this[z]=[],this[P]=null;}},{key:"clear",value:function value(){this.beginPath();}},{key:"ellipse",value:function value(N,G,q,at,ut,Ct,R){var $=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0;if(Ct+=ut,R+=ut,!(q<=0||at<=0||R===Ct)){R<Ct&&(R=Ct+j+(R-Ct)%j),R-Ct>j&&(R=Ct+j);var _=R-Ct;_>=j&&(R-=1e-3);var H=this[z].length>0&&_<j?"L":"M",lt=Object(x.getPoint)(N,G,q,at,Ct),dt=Object(x.getPoint)(N,G,q,at,R),wt=+!$,Et=_>Math.PI?1:0;$&&(Et=1-Et),H+=lt.join(" "),H+="A".concat(q," ").concat(at," 0 ").concat(Et," ").concat(wt," ").concat(dt.join(" ")),_>=j&&(H+="Z"),this.addPath(H);}}},{key:"arc",value:function value(N,G,q,at,ut){var Ct=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;return this.ellipse(N,G,q,q,0,at,ut,Ct);}},{key:"arcTo",value:function value(N,G,q,at,ut,Ct,R){this[P]=null,this[z].push(["A",N,G,q,at,ut,Ct,R]);}},{key:"moveTo",value:function value(N,G){this[P]=null,this[z].push(["M",N,G]);}},{key:"lineTo",value:function value(N,G){this[P]=null,this[z].push(["L",N,G]);}},{key:"bezierCurveTo",value:function value(N,G,q,at,ut,Ct){this[P]=null,this[z].push(["C",N,G,q,at,ut,Ct]);}},{key:"quadraticCurveTo",value:function value(N,G,q,at){this[P]=null,this[z].push(["Q",N,G,q,at]);}},{key:"rect",value:function value(N,G,q,at){var ut="M".concat(N," ").concat(G,"L").concat(N+q," ").concat(G,"L").concat(N+q," ").concat(G+at,"L").concat(N," ").concat(G+at,"Z");this.addPath(ut);}},{key:"closePath",value:function value(){this[P]=null;var N=[],G=this[z].length;G>0&&(N=this[z][G-1]),N[0]!=="Z"&&N[0]!=="z"&&this[z].push(["Z"]);}},{key:"contours",get:function get(){var N=null;if(!this[P]&&this[z]){var G=Object(et.default)(Y()(this[z]));this[P]=w()(G,this[K],this[U]),this[P].path=G,this[P].simplify=this[U],this[P].scale=this[K];}return this[P]&&(N=this[P].map(function(q){return o()(q);}),N.path=this[P].path,N.simplify=this[P].simplify,N.scale=this[P].scale),N;}},{key:"path",get:function get(){return this[z];}},{key:"simplify",get:function get(){return this[U];}},{key:"boundingBox",get:function get(){var N=this.contours;if(N&&N.length){var G=N.reduce(function(q,at){return[].concat(o()(q),o()(at));});return L()(G);}return[[0,0],[0,0]];}},{key:"boundingCenter",get:function get(){var N=this.boundingBox;return N?[0.5*(N[0][0]+N[1][0]),0.5*(N[0][1]+N[1][1])]:[0,0];}}]),ct;}();},/* 57 *//***/function(e,n,i){var s=i(14),o=i(21),a=i(16),u=i(18);function h(v){return s(v)||o(v)||a(v)||u();}e.exports=h;},/* 58 *//***/function(e,n){e.exports=o;var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},s=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function o(h){var v=[];return h.replace(s,function(p,y,C){var b=y.toLowerCase();for(C=u(C),b=="m"&&C.length>2&&(v.push([y].concat(C.splice(0,2))),b="l",y=y=="m"?"l":"L");;){if(C.length==i[b])return C.unshift(y),v.push(C);if(C.length<i[b])throw new Error("malformed path data");v.push([y].concat(C.splice(0,i[b])));}}),v;}var a=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function u(h){var v=h.match(a);return v?v.map(Number):[];}},/* 59 *//***/function(e,n,i){e.exports=s;function s(o){var a=o.length;if(a===0)return[[],[]];for(var u=o[0].length,h=o[0].slice(),v=o[0].slice(),p=1;p<a;++p)for(var y=o[p],C=0;C<u;++C){var b=y[C];h[C]=Math.min(h[C],b),v[C]=Math.max(v[C],b);}return[h,v];}},/* 60 *//***/function(e,n){e.exports=i;function i(s){var o=0,a=0,u=0,h=0;return s.map(function(v){v=v.slice();var p=v[0],y=p.toUpperCase();if(p!=y)switch(v[0]=y,p){case"a":v[6]+=u,v[7]+=h;break;case"v":v[1]+=h;break;case"h":v[1]+=u;break;default:for(var C=1;C<v.length;)v[C++]+=u,v[C++]+=h;}switch(y){case"Z":u=o,h=a;break;case"H":u=v[1];break;case"V":h=v[1];break;case"M":u=o=v[1],h=a=v[2];break;default:u=v[v.length-2],h=v[v.length-1];}return v;});}},/* 61 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return u;});var s=i(13),o=/* @__PURE__ */i.n(s),a=i(62);i(1).glMatrix.setMatrixArrayType(Array);function u(p){for(var y,C=[],b=0,M=0,L=0,X=0,Y=null,et=null,A=0,w=0,S=0,x=p.length;S<x;S++){var P=p[S],z=P[0];switch(z){case"M":L=P[1],X=P[2];break;case"A":var U=Object(a.default)(A,w,P[6],P[7],P[4],P[5],P[1],P[2],P[3]);if(!U.length)continue;U=U.map(function(B){var N=o()(B,8);N[0],N[1];var G=N[2],q=N[3],at=N[4],ut=N[5],Ct=N[6],R=N[7];return{x1:G,y1:q,x2:at,y2:ut,x:Ct,y:R};});for(var K=0,j;K<U.length;K++)j=U[K],P=["C",j.x1,j.y1,j.x2,j.y2,j.x,j.y],K<U.length-1&&C.push(P);break;case"S":var nt=A,ct=w;(y=="C"||y=="S")&&(nt+=nt-b,ct+=ct-M),P=["C",nt,ct,P[1],P[2],P[3],P[4]];break;case"T":y=="Q"||y=="T"?(Y=A*2-Y,et=w*2-et):(Y=A,et=w),P=v(A,w,Y,et,P[1],P[2]);break;case"Q":Y=P[1],et=P[2],P=v(A,w,P[1],P[2],P[3],P[4]);break;case"L":P=h(A,w,P[1],P[2]);break;case"H":P=h(A,w,P[1],w);break;case"V":P=h(A,w,A,P[1]);break;case"Z":P=h(A,w,L,X);break;}y=z,A=P[P.length-2],w=P[P.length-1],P.length>4?(b=P[P.length-4],M=P[P.length-3]):(b=A,M=w),C.push(P);}return C;}function h(p,y,C,b){return["C",p,y,C,b,C,b];}function v(p,y,C,b,M,L){return["C",p/3+2/3*C,y/3+2/3*b,M/3+2/3*C,L/3+2/3*b,M,L];}},/* 62 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return h;}),i(1).glMatrix.setMatrixArrayType(Array);var s=Math.PI*2;function o(v,p,y,C){var b=v*C-p*y<0?-1:1,M=v*y+p*C;return M>1&&(M=1),M<-1&&(M=-1),b*Math.acos(M);}function a(v,p,y,C,b,M,L,X,Y,et){var A=et*(v-y)/2+Y*(p-C)/2,w=-Y*(v-y)/2+et*(p-C)/2,S=L*L,x=X*X,P=A*A,z=w*w,U=S*x-S*z-x*P;U<0&&(U=0),U/=S*z+x*P,U=Math.sqrt(U)*(b===M?-1:1);var K=U*L/X*w,j=U*-X/L*A,nt=et*K-Y*j+(v+y)/2,ct=Y*K+et*j+(p+C)/2,B=(A-K)/L,N=(w-j)/X,G=(-A-K)/L,q=(-w-j)/X,at=o(1,0,B,N),ut=o(B,N,G,q);return M===0&&ut>0&&(ut-=s),M===1&&ut<0&&(ut+=s),[nt,ct,at,ut];}function u(v,p){var y=1.3333333333333333*Math.tan(p/4),C=Math.cos(v),b=Math.sin(v),M=Math.cos(v+p),L=Math.sin(v+p);return[C,b,C-b*y,b+C*y,M+L*y,L-M*y,M,L];}function h(v,p,y,C,b,M,L,X,Y){var et=Math.sin(Y*s/360),A=Math.cos(Y*s/360),w=A*(v-y)/2+et*(p-C)/2,S=-et*(v-y)/2+A*(p-C)/2;if(w===0&&S===0)return[];if(L===0||X===0)return[];L=Math.abs(L),X=Math.abs(X);var x=w*w/(L*L)+S*S/(X*X);x>1&&(L*=Math.sqrt(x),X*=Math.sqrt(x));var P=a(v,p,y,C,b,M,L,X,et,A),z=[],U=P[2],K=P[3],j=Math.max(Math.ceil(Math.abs(K)/(s/4)),1);K/=j;for(var nt=0;nt<j;nt++)z.push(u(U,K)),U+=K;return z.map(function(ct){for(var B=0;B<ct.length;B+=2){var N=ct[B+0],G=ct[B+1];N*=L,G*=X;var q=A*N-et*G,at=et*N+A*G;ct[B+0]=q+P[0],ct[B+1]=at+P[1];}return ct;});}},/* 63 *//***/function(e,n,i){i(1).glMatrix.setMatrixArrayType(Array);var s=i(64),o=i(66),a=o.copy,u=i(67);function h(b,M,L){return b[0]=M,b[1]=L,b;}var v=[0,0],p=[0,0],y=[0,0];function C(b,M,L,X){s(L,h(v,X[1],X[2]),h(p,X[3],X[4]),h(y,X[5],X[6]),M,b);}e.exports=function(M,L,X){var Y=[],et=[],A=[0,0];return M.forEach(function(w,S,x){if(w[0]==="M")a(A,w.slice(1)),et.length>0&&(Y.push(et),et=[]);else if(w[0]==="C")C(et,L,A,w),h(A,w[5],w[6]);else throw new Error("illegal type in SVG: "+w[0]);}),et.length>0&&Y.push(et),Y.map(function(w){return u(w,X||0);});};},/* 64 *//***/function(e,n,i){e.exports=i(65)();},/* 65 *//***/function(e,n){function i(o){return[o[0],o[1]];}function s(o,a){return[o,a];}e.exports=function(a){a=a||{};var u=typeof a.recursion=="number"?a.recursion:8,h=typeof a.epsilon=="number"?a.epsilon:11920929e-14,v=typeof a.pathEpsilon=="number"?a.pathEpsilon:1,p=typeof a.angleEpsilon=="number"?a.angleEpsilon:0.01,y=a.angleTolerance||0,C=a.cuspLimit||0;return function(X,Y,et,A,w,S){S||(S=[]),w=typeof w=="number"?w:1;var x=v/w;return x*=x,b(X,Y,et,A,S,x),S;};function b(L,X,Y,et,A,w){A.push(i(L));var S=L[0],x=L[1],P=X[0],z=X[1],U=Y[0],K=Y[1],j=et[0],nt=et[1];M(S,x,P,z,U,K,j,nt,A,w,0),A.push(i(et));}function M(L,X,Y,et,A,w,S,x,P,z,U){if(!(U>u)){var K=Math.PI,j=(L+Y)/2,nt=(X+et)/2,ct=(Y+A)/2,B=(et+w)/2,N=(A+S)/2,G=(w+x)/2,q=(j+ct)/2,at=(nt+B)/2,ut=(ct+N)/2,Ct=(B+G)/2,R=(q+ut)/2,$=(at+Ct)/2;if(U>0){var _=S-L,H=x-X,lt=Math.abs((Y-S)*H-(et-x)*_),dt=Math.abs((A-S)*H-(w-x)*_),wt,Et;if(lt>h&&dt>h){if((lt+dt)*(lt+dt)<=z*(_*_+H*H)){if(y<p){P.push(s(R,$));return;}var Ot=Math.atan2(w-et,A-Y);if(wt=Math.abs(Ot-Math.atan2(et-X,Y-L)),Et=Math.abs(Math.atan2(x-w,S-A)-Ot),wt>=K&&(wt=2*K-wt),Et>=K&&(Et=2*K-Et),wt+Et<y){P.push(s(R,$));return;}if(C!==0){if(wt>C){P.push(s(Y,et));return;}if(Et>C){P.push(s(A,w));return;}}}}else if(lt>h){if(lt*lt<=z*(_*_+H*H)){if(y<p){P.push(s(R,$));return;}if(wt=Math.abs(Math.atan2(w-et,A-Y)-Math.atan2(et-X,Y-L)),wt>=K&&(wt=2*K-wt),wt<y){P.push(s(Y,et)),P.push(s(A,w));return;}if(C!==0&&wt>C){P.push(s(Y,et));return;}}}else if(dt>h){if(dt*dt<=z*(_*_+H*H)){if(y<p){P.push(s(R,$));return;}if(wt=Math.abs(Math.atan2(x-w,S-A)-Math.atan2(w-et,A-Y)),wt>=K&&(wt=2*K-wt),wt<y){P.push(s(Y,et)),P.push(s(A,w));return;}if(C!==0&&wt>C){P.push(s(A,w));return;}}}else if(_=R-(L+S)/2,H=$-(X+x)/2,_*_+H*H<=z){P.push(s(R,$));return;}}M(L,X,j,nt,q,at,R,$,P,z,U+1),M(R,$,ut,Ct,N,G,S,x,P,z,U+1);}}};},/* 66 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return a;}),i.d(n,"clone",function(){return o;}),i.d(n,"copy",function(){return u;}),i.d(n,"scaleAndAdd",function(){return h;}),i.d(n,"dot",function(){return v;}),i.d(n,"rotate",function(){return p;}),i.d(n,"cross",function(){return y;}),i.d(n,"sub",function(){return C;}),i.d(n,"add",function(){return b;}),i.d(n,"computeMiter",function(){return Y;}),i.d(n,"normal",function(){return et;}),i.d(n,"direction",function(){return A;});var s=i(1);i(1).glMatrix.setMatrixArrayType(Array);function o(w){return[w[0],w[1]];}function a(){return[0,0];}var u=s.vec2.copy,h=s.vec2.scaleAndAdd,v=s.vec2.dot,p=s.vec2.rotate,y=s.vec2.cross,C=s.vec2.sub,b=s.vec2.add,M=s.vec2.normalize,L=s.vec2.set,X=a();function Y(w,S,x,P,z){b(w,x,P),M(w,w),L(S,-w[1],w[0]),L(X,-x[1],x[0]);var U=z/v(S,X);return Math.abs(U);}function et(w,S){return L(w,-S[1],S[0]),w;}function A(w,S,x){return C(w,S,x),M(w,w),w;}},/* 67 *//***/function(e,n,i){var s=i(68),o=i(69);e.exports=function(u,h){return u=s(u,h),u=o(u,h),u;},e.exports.radialDistance=s,e.exports.douglasPeucker=o;},/* 68 *//***/function(e,n){function i(s,o){var a=s[0]-o[0],u=s[1]-o[1];return a*a+u*u;}e.exports=function(o,a){if(o.length<=1)return o;a=typeof a=="number"?a:1;for(var u=a*a,h=o[0],v=[h],p,y=1,C=o.length;y<C;y++)p=o[y],i(p,h)>u&&(v.push(p),h=p);return h!==p&&v.push(p),v;};},/* 69 *//***/function(e,n){function i(o,a,u){var h=a[0],v=a[1],p=u[0]-h,y=u[1]-v;if(p!==0||y!==0){var C=((o[0]-h)*p+(o[1]-v)*y)/(p*p+y*y);C>1?(h=u[0],v=u[1]):C>0&&(h+=p*C,v+=y*C);}return p=o[0]-h,y=o[1]-v,p*p+y*y;}function s(o,a,u,h,v){for(var p=h,y,C=a+1;C<u;C++){var b=i(o[C],o[a],o[u]);b>p&&(y=C,p=b);}p>h&&(y-a>1&&s(o,a,y,h,v),v.push(o[y]),u-y>1&&s(o,y,u,h,v));}e.exports=function(a,u){if(a.length<=1)return a;u=typeof u=="number"?u:1;var h=u*u,v=a.length-1,p=[a[0]];return s(a,0,v,h,p),p.push(a[v]),p;};},/* 70 *//***/function(e,n,i){i.r(n),i.d(n,"getTotalLength",function(){return u;}),i.d(n,"getPointAtLength",function(){return v;}),i.d(n,"getDashContours",function(){return p;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(71);i(1).glMatrix.setMatrixArrayType(Array);function u(y){if(y.totalLength!=null)return y.totalLength;var C=0;return y.forEach(function(b){for(var M=b[0],L=1;L<b.length;L++){var X=b[L];C+=Object(a.distance)(M,X),M=X;}}),y.totalLength=C,C;}function h(y,C){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(C=Number(C),!Number.isFinite(C))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(C<=0)throw new TypeError("Length must > 0");var M=u(y);if(C>=M){var L=y[y.length-1],X=L[L.length-2],Y=L[L.length-1],et=Math.atan2(Y[1]-X[1],Y[0]-X[0]);return{current:y.map(function(N){return o()(N);}),point:{x:Y[0],y:Y[1],angle:et}};}for(var A=[],w=0;w<y.length;w++){A[w]=[];for(var S=y[w],x=S[0],P=1;P<S.length;P++){var z=S[P],U=Object(a.distance)(x,z);if(C<U){var K=C/U,j=Math.atan2(z[1]-x[1],z[0]-x[0]),nt={x:x[0]*(1-K)+z[0]*K,y:x[1]*(1-K)+z[1]*K,angle:j};if(A[w].push(x),C>0&&A[w].push([nt.x,nt.y]),!b)return{current:A,point:nt};for(var ct=[],B=w;w<y.length;w++){for(ct[w-B]=[],w===B&&ct[0].push([nt.x,nt.y]);P<S.length;P++)ct[w-B].push(S[P]);P=0;}return{current:A,point:nt,rest:ct};}C-=U,A[w].push(x),x=z;}}}function v(y,C){if(C=Number(C),!Number.isFinite(C))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(y.length<=0)return{x:0,y:0,angle:0};if(C<=0){var b=y[0][0],M=y[0][1],L=Math.atan2(M[1]-b[1],M[0]-b[0]);return{x:b[0],y:b[1],angle:L};}return h(y,C,!1).point;}function p(y,C,b){var M=0,L=C[0],X=y,Y=[],et=C.length;if(b>0){do b-=C[M%et],M++;while(b>0);b<0&&(L=-b,M--);}else if(b<0){M=-1;do b+=C[M%et+et-1],M--;while(b<0);b>=0&&(M++,L=C[M%et+et-1]-b);}do{var A=h(X,L);X=A.rest,++M%2&&Y.push.apply(Y,o()(A.current));var w=M%et;w<0&&(w+=et),L=C[w];}while(X);return Y;}},/* 71 *//***/function(e,n,i){i.r(n),i.d(n,"normalize",function(){return a;}),i.d(n,"distance",function(){return u;});var s=i(13),o=/* @__PURE__ */i.n(s);i(1).glMatrix.setMatrixArrayType(Array);function a(h,v,p,y){var C=o()(h,3),b=C[0],M=C[1],L=C[2];return b=b*2/v-1,M=1-M*2/p,Number.isFinite(y)?(L=L*2/y-1,[b,M,L]):[b,M];}function u(h,v){var p=o()(h,3),y=p[0],C=p[1],b=p[2],M=b===void 0?0:b,L=o()(v,3),X=L[0],Y=L[1],et=L[2],A=et===void 0?0:et;return Math.hypot(X-y,Y-C,A-M);}},/* 72 *//***/function(e,n,i){i.r(n),i.d(n,"getPoint",function(){return o;}),i(1).glMatrix.setMatrixArrayType(Array);var s=Math.PI*2;function o(a,u,h,v,p){p%=s,p<0&&(p+=s);var y=Math.tan(p);if(Math.abs(y)<1e5){var C=u-y*a,b=1/Math.pow(h,2)+Math.pow(y,2)/Math.pow(v,2),M=-1;(p<=Math.PI/2||p>3*Math.PI/2)&&(M=1);var L=M*Math.sqrt(1/b)+a,X=y*L+C;return[L,X];}return p<Math.PI?[a,u+v]:[a,u-v];}},/* 73 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return st;});var s=i(74),o=/* @__PURE__ */i.n(s),a=i(19),u=/* @__PURE__ */i.n(a),h=i(23),v=/* @__PURE__ */i.n(h),p=i(24),y=/* @__PURE__ */i.n(p),C=i(13),b=/* @__PURE__ */i.n(C),M=i(1),L=i(59),X=/* @__PURE__ */i.n(L),Y=i(76),et=i(44),A=i(40),w=i(46),S=i(78),x=i(70),P=i(79),z=/* @__PURE__ */i.n(P),U=i(63),K=/* @__PURE__ */i.n(U),j=i(47),nt=i(56),ct=i(37);i(1).glMatrix.setMatrixArrayType(Array);var B=Symbol("mesh"),N=Symbol("contours"),G=Symbol("stroke"),q=Symbol("fill"),at=Symbol("strokeColor"),ut=Symbol("fillColor"),Ct=Symbol("transform"),R=Symbol("invertTransform"),$=Symbol("uniforms"),_=Symbol("texOptions"),H=Symbol("blend"),lt=Symbol("applyTexture"),dt=Symbol("applyTransform"),wt=Symbol("applyGradientTransform"),Et=Symbol("applyProgram"),Ot=Symbol("gradient"),O=Symbol("filter"),D=Symbol("opacity"),J=Symbol("program"),Q=Symbol("attributes"),V=Symbol("pass"),tt=Symbol("clipContext"),g=Symbol("applyClipPath");function T(ft,pt){for(var ot=ft[1][0]-ft[0][0],mt=ft[1][1]-ft[0][1],Tt=[],Pt=0;Pt<pt.length;Pt++){var Lt=pt[Pt],Dt=[(Lt[0]-ft[0][0])/ot,1-(Lt[1]-ft[0][1])/mt];Tt.push(Dt);}return Tt;}function k(ft,pt,ot){var mt=b()(ft,2),Tt=mt[0],Pt=mt[1],Lt=b()(pt,4),Dt=Lt[0],Nt=Lt[1],Yt=Lt[2],Ut=Lt[3],Ft=ot.scale;return Ft||(Tt/=Yt,Pt=1-Pt/Ut,Tt-=Dt,Pt+=Nt),[Tt,Pt,0];}function Z(ft,pt,ot){var mt=K()(ft,pt,ot);return mt.path=ft,mt.simplify=ot,mt.scale=pt,mt;}var st=/* @__PURE__ */function(){function ft(pt){v()(this,ft),this[G]=null,this[q]=null,this[Ct]=[1,0,0,1,0,0],this[D]=1,this[$]={},this[O]=[],this[H]=null,this[_]={},this.contours=pt.contours,this[J]=null,this[Q]={},this[V]=[];}return y()(ft,[{key:"setProgram",value:function value(ot){this[J]=ot,this[B]&&this[Et](ot);}},{key:"setAttribute",value:function value(ot,mt){mt==null?delete this[Q][ot]:this[Q][ot]=mt;}},{key:"getOpacity",value:function value(){return this[D];}},{key:"setOpacity",value:function value(ot){if(ot<0||ot>1)throw new TypeError("Invalid opacity value.");this[B]&&this[B].positions.forEach(function(mt){mt[2]=1/mt[2]>0?ot:-ot;}),this[D]=ot;}},{key:"setClipPath",value:function value(ot){this.clipPath=ot,this[$].u_clipSampler&&this[$].u_clipSampler.delete(),this.setUniforms({u_clipSampler:null}),this[B]&&delete this[B].attributes.a_clipUV,ot&&this[B]&&this[g]();}},{key:g,value:function value(){if(this.clipPath){this[tt]||(this[tt]=ct.default.createCanvas(1,1));var ot=b()(this.boundingBox,2),mt=b()(ot[0],2),Tt=mt[0],Pt=mt[1],Lt=b()(ot[1],2),Dt=Lt[0],Nt=Lt[1];Dt&&Nt&&(this[tt].width=Dt-Tt,this[tt].height=Nt-Pt);var Yt=this[tt].getContext("2d"),Ut=new Path2D(this.clipPath);Yt.clearRect(0,0,this[tt].width,this[tt].height),Yt.save(),Yt.translate(-Tt,-Pt),Yt.fillStyle="white",Yt.fill(Ut),Yt.restore(),this[B].clipPath=this[tt];var Ft=T(this.boundingBox,this[B].position0);this[B].attributes.a_clipUV=Ft;}}},{key:"getPointAtLength",value:function value(ot){return Object(x.getPointAtLength)(this[N],ot);}},{key:"getTotalLength",value:function value(){return Object(x.getTotalLength)(this[N]);}},{key:Et,value:function value(ot){for(var mt=this[Q],Tt=this[B].position0,Pt=Object.entries(ot._attribute),Lt=0;Lt<Pt.length;Lt++){var Dt=b()(Pt[Lt],2),Nt=Dt[0],Yt=Dt[1];if(Nt!=="a_color"&&Nt!=="a_sourceRect"&&Yt!=="ignored"){var Ut=mt[Nt];if(Nt==="uv"&&!Ut){var Ft=this[B].boundingBox||X()(Tt);this[B].attributes[Nt]=T(Ft,Tt);}else{this[B].attributes[Nt]=[];for(var Jt=0;Jt<Tt.length;Jt++){var ee=Tt[Jt];this[B].attributes[Nt].push(Ut?Ut(ee,Lt,Tt):Array(Yt.size).fill(0));}}}}}// {stroke, fill}
|
|
37
|
-
},{key:dt,value:function value(ot,mt){for(var
|
|
36
|
+
e.exports);try{regeneratorRuntime=s;}catch(_unused2){Function("r","regeneratorRuntime = r")(s);}},/* 29 *//***/function(e,n){function i(o,a,u,h,v,p,y){try{var C=o[p](y),b=C.value;}catch(M){u(M);return;}C.done?a(b):Promise.resolve(b).then(h,v);}function s(o){return function(){var a=this,u=arguments;return new Promise(function(h,v){var p=o.apply(a,u);function y(b){i(p,h,v,y,C,"next",b);}function C(b){i(p,h,v,y,C,"throw",b);}y(void 0);});};}e.exports=s;},/* 30 *//***/function(e,n){function i(s,o,a){return o in s?Object.defineProperty(s,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[o]=a,s;}e.exports=i;},/* 31 *//***/function(e,n,i){i.r(n),i.d(n,"setupWebGL",function(){return y;}),i.d(n,"createProgram",function(){return C;}),i.d(n,"pointsToBuffer",function(){return b;}),i.d(n,"loadImage",function(){return L;}),i.d(n,"fetchShader",function(){return Y;});var s=i(27),o=/* @__PURE__ */i.n(s),a=i(29),u=/* @__PURE__ */i.n(a),h=i(32),v=/* @__PURE__ */i.n(h);i(1).glMatrix.setMatrixArrayType(Array);function p(A,w){for(var S=["webgl","experimental-webgl","webkit-3d","moz-webgl"],x=null,P=0;P<S.length;++P){try{x=A.getContext(S[P],w);}catch(_unused3){}if(x)break;}return x;}function y(A,w){var S=p(A,w);if(!S)throw new Error("Sorry, your browser doesn't support WebGL.");return S;}function C(A,w,S){var x=A.createShader(A.VERTEX_SHADER);if(A.shaderSource(x,w),A.compileShader(x),!A.getShaderParameter(x,A.COMPILE_STATUS)){var P="Vertex shader failed to compile. The error log is:".concat(A.getShaderInfoLog(x));throw new Error(P);}var z=A.createShader(A.FRAGMENT_SHADER);if(A.shaderSource(z,S),A.compileShader(z),!A.getShaderParameter(z,A.COMPILE_STATUS)){var U="Fragment shader failed to compile. The error log is:".concat(A.getShaderInfoLog(z));throw new Error(U);}var K=A.createProgram();if(A.attachShader(K,x),A.attachShader(K,z),A.linkProgram(K),!A.getProgramParameter(K,A.LINK_STATUS)){var j="Shader program failed to link. The error log is:".concat(A.getProgramInfoLog(K));throw new Error(j);}return A.deleteShader(x),A.deleteShader(z),K;}function b(A){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Float32Array,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(S&&!(S instanceof w))throw new TypeError("Wrong buffer type.");if(A==null||A instanceof w)return A;if(A[0]==null||A[0].length==null)return S?(S.set(A,0),S):new w(A);var x=A[0].length,P=A.length;S||(S=new w(x*P));for(var z=0,U=0;U<P;U++)for(var K=0;K<x;K++)S[z++]=A[U][K];return S;}var M={};function L(A){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=w.useImageBitmap,x=S===void 0?!0:S,P=w.alias,z=P===void 0?null:P;if(!M[A]){if(typeof Image=="function"){var U=new Image();typeof A=="string"&&!(((typeof location==="undefined"?"undefined":_typeof(location))>"u"?"undefined":v()(location))==="object"&&/^file:/.test(location.href))&&!/^data:/.test(A)&&(U.crossOrigin="anonymous"),M[A]=new Promise(function(K){U.onload=function(){x&&typeof createImageBitmap=="function"?createImageBitmap(U,{imageOrientation:"flipY"}).then(function(j){M[A]=j,z&&(M[z]=j),K(j);}):(M[A]=U,z&&(M[z]=U),K(U));},U.src=A;}),z&&(M[z]=M[A]);}else if(typeof fetch=="function")return fetch(A,{method:"GET",mode:"cors",cache:"default"}).then(function(K){return K.blob();}).then(function(K){return createImageBitmap(K,{imageOrientation:"flipY"}).then(function(j){return M[A]=j,z&&(M[z]=j),j;});});}return M[A];}var X={};function Y(A){return et.apply(this,arguments);}function et(){return et=u()(/* @__PURE__ */o.a.mark(function A(w){var S,x;return o.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:if(!X[w]){z.next=2;break;}return z.abrupt("return",X[w]);case 2:return z.next=4,fetch(w);case 4:if(S=z.sent,!(S.status>=200&&S.status<300)){z.next=11;break;}return z.next=8,S.text();case 8:return x=z.sent,X[w]=x,z.abrupt("return",x);case 11:throw new Error("Shader loaded error.");case 12:case"end":return z.stop();}},A);})),et.apply(this,arguments);}},/* 32 *//***/function(e,n){function i(s){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?e.exports=i=function i(a){return typeof a;}:e.exports=i=function i(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a;},i(s);}e.exports=i;},/* 33 *//***/function(e,n,i){i.r(n),n.default="attribute vec3 a_vertexPosition;\n\nvoid main() {\n gl_PointSize = 1.0;\n gl_Position = vec4(a_vertexPosition, 1);\n}";},/* 34 *//***/function(e,n,i){i.r(n),n.default="#ifdef GL_ES\nprecision mediump float;\n#endif\n\nvoid main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.1);\n}";},/* 35 *//***/function(e,n,i){i.r(n),n.default="attribute vec4 a_vertexPosition;\nattribute vec2 a_vertexTextureCoord;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n gl_PointSize = 1.0;\n gl_Position = a_vertexPosition;\n vTextureCoord = a_vertexTextureCoord;\n}";},/* 36 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return A;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(13),u=/* @__PURE__ */i.n(a),h=i(27),v=/* @__PURE__ */i.n(h),p=i(29),y=/* @__PURE__ */i.n(p),C=i(23),b=/* @__PURE__ */i.n(C),M=i(24),L=/* @__PURE__ */i.n(M),X=i(37),Y=i(41);i(1).glMatrix.setMatrixArrayType(Array);var et=Symbol("transform"),A=/* @__PURE__ */function(){function w(S,x){b()(this,w),this.context=S.getContext("2d"),this.options=x,this[et]=[1,0,0,1,0,0];}return L()(w,[{key:"createTexture",value:function value(x){var P={_img:x};return P;}},{key:"loadTexture",value:function(){var S=y()(/* @__PURE__ */v.a.mark(function P(z){var U;return v.a.wrap(function(j){for(;;)switch(j.prev=j.next){case 0:return j.next=2,X.default.loadImage(z,{useImageBitmap:!1});case 2:return U=j.sent,j.abrupt("return",this.createTexture(U));case 4:case"end":return j.stop();}},P,this);}));function x(P){return S.apply(this,arguments);}return x;}()},{key:"deleteTexture",value:function value(x){return x;}},{key:"clear",value:function value(x,P,z,U){var K=this.context;x=x||0,P=P||0,z=z||K.canvas.width-x,U=U||K.canvas.height-P,K.clearRect(x,P,z,U);}},{key:"drawMeshCloud",value:function value(x){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=P.clear,U=z===void 0?!1:z,K=[],j=0;j<x.amount;j++){var nt=x.getTransform(j),ct=x.getTextureFrame(j);ct&&(ct=ct._img);var B=x.getFilter(j),N=x.getCloudRGBA(j),G=N.fill,q=N.stroke;K.push({mesh:x.mesh,_cloudOptions:[G,q,ct,nt,B]});}x.beforeRender&&x.beforeRender(this.context,x),this.drawMeshes(K,{clear:U,hook:!1}),x.afterRender&&x.afterRender(this.context,x);}},{key:"drawMeshes",value:function value(x){var P=this,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=z.clear,K=U===void 0?!1:U,j=z.hook,nt=j===void 0?!0:j,ct=this.context;K&&ct.clearRect(0,0,ct.canvas.width,ct.canvas.height);var B=null,N=ct.canvas,G=N.width,q=N.height,at=x.length;x.forEach(function(ut,Ct){var R,$,_,H,lt;if(nt&&ut.beforeRender&&ut.beforeRender(ct,ut),ut._cloudOptions){var dt=u()(ut._cloudOptions,5);R=dt[0],$=dt[1],_=dt[2],H=dt[3],lt=dt[4],ut=ut.mesh;}var wt=ut.filter;if(lt&&(wt=wt?"".concat(wt," ").concat(lt):lt),wt&&!P.filterBuffer&&P.filterBuffer!==!1){var Et=X.default.createCanvas(G,q);Et?P.filterBuffer=Et.getContext("2d"):P.filterBuffer=!1;}if(B&&B!==wt&&(Object(Y.applyFilter)(P.filterBuffer,B),ct.drawImage(P.filterBuffer.canvas,0,0,G,q),P.filterBuffer.clearRect(0,0,G,q),B=null),wt&&P.filterBuffer){var Ot;P.filterBuffer.save(),(Ot=P.filterBuffer).transform.apply(Ot,o()(P[et])),Object(Y.drawMesh2D)(ut,P.filterBuffer,!1,R,$,_,H),P.filterBuffer.restore(),Ct===at-1?(Object(Y.applyFilter)(P.filterBuffer,wt),ct.drawImage(P.filterBuffer.canvas,0,0,G,q),P.filterBuffer.clearRect(0,0,G,q)):B=wt;}else ct.save(),ct.transform.apply(ct,o()(P[et])),Object(Y.drawMesh2D)(ut,ct,!1,R,$,_,H),ct.restore();nt&&ut.afterRender&&ut.afterRender(ct,ut);});}},{key:"setTransform",value:function value(x){this[et]=x;}}]),w;}();},/* 37 *//***/function(e,n,i){i.r(n),function(s){var o=i(32),a=/* @__PURE__ */i.n(o),u=i(19),h=/* @__PURE__ */i.n(u),v=i(25),p=i(39),y=i(40);i(1).glMatrix.setMatrixArrayType(Array);var C={};function b(A,w){var S=A.style,x=A.variant,P=A.weight,z=A.stretch,U=A.size,K=A.pxLineHeight,j=A.family;return z==="normal"?"".concat(S," ").concat(x," ").concat(P," ").concat(U*w,"px/").concat(K*w,"px ").concat(j):"".concat(S," ").concat(x," ").concat(P," ").concat(z," ").concat(U*w,"px/").concat(K*w,"px ").concat(j);}function M(A,w){var S=w.font,x=w.fillColor,P=w.strokeColor,z=w.strokeWidth,U=w.ratio,K=U===void 0?1:U,j=w.textCanvas,nt=w.cachable,ct=nt===void 0?!1:nt,B;if(ct){B=[A,S,String(x),String(P),String(z)].join("###");var N=C[B];if(N)return N;}j||(j=Y(1,1));var G=j.getContext("2d");G.save(),G.font=S;var q=G.measureText(A),at=q.width;G.restore();var ut=Object(p.default)(S),Ct=Math.max(ut.pxLineHeight,ut.pxHeight*1.13);/italic|oblique/.test(S)&&(at+=Ct*Math.tan(15*Math.PI/180)),!x&&!P&&(x="#000");var R=G.canvas,$=Math.ceil(at),_=Math.ceil(Ct);R.width=Math.round($*K),R.height=Math.round(_*K),G.save(),G.font=b(ut,K),G.textAlign="center",G.textBaseline="middle";var H=R.height*0.5+ut.pxHeight*0.05*K,lt=R.width*0.5;if(x){if(Array.isArray(x))x=Object(y.default)(x);else if(x.vector){var dt,wt=x,Et=wt.vector,Ot=wt.colors;Et.length===6?dt=G.createRadialGradient.apply(G,h()(Et)):dt=G.createLinearGradient.apply(G,h()(Et)),Ot.forEach(function(tt){var g=tt.offset,T=tt.color;dt.addColorStop(g,T);}),x=dt;}G.fillStyle=x,G.fillText(A,lt,H);}if(P){if(G.lineWidth=z*K,Array.isArray(P))P=Object(y.default)(P);else if(P.vector){var O,D=P,J=D.vector,Q=D.colors;J.length===6?O=G.createRadialGradient.apply(G,h()(J)):O=G.createLinearGradient.apply(G,h()(J)),Q.forEach(function(tt){var g=tt.offset,T=tt.color;O.addColorStop(g,T);}),P=O;}G.strokeStyle=P,G.strokeText(A,lt,H);}G.restore();var V={image:j,rect:[0,0,$,_]};return ct&&(C[B]=V),V;}var L=!1;if(((typeof navigator==="undefined"?"undefined":_typeof(navigator))>"u"?"undefined":a()(navigator))==="object"&&typeof navigator.userAgent=="string"){var X=navigator.userAgent.toLowerCase().match(/chrome\/(\d+)/);X&&(L=Number(X[1])<70);}function Y(A,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=S.offscreen||!L&&S.offscreen!==!1,P;return _typeof(s)<"u"&&typeof s.createCanvas=="function"?P=s.createCanvas(A,w,S):x&&typeof OffscreenCanvas=="function"?P=new OffscreenCanvas(A,w):(P=document.createElement("canvas"),P.width=A,P.height=w),P;}var et={createCanvas:Y,createText:M,loadImage:v.default.loadImage};n.default=et;}.call(this,i(38));},/* 38 *//***/function(e,n){var i;i=/* @__PURE__ */function(){return this;}();try{i=i||new Function("return this")();}catch(_unused4){(typeof window==="undefined"?"undefined":_typeof(window))=="object"&&(i=window);}e.exports=i;},/* 39 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return X;}),i(1).glMatrix.setMatrixArrayType(Array);function s(Y,et){if(typeof Y=="string"){var A=Y.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%)$/);A?Y={size:parseFloat(A[1]),unit:A[2]}:Y={size:parseInt(Y,10),unit:"px"};}var w=Y,S=w.size,x=w.unit;if(x==="pt")S/=0.75;else if(x==="pc")S*=16;else if(x==="in")S*=96;else if(x==="cm")S*=96/2.54;else if(x==="mm")S*=96/25.4;else if(x==="em"||x==="rem"||x==="ex"){if(!et&&typeof getComputedStyle=="function"&&(typeof document==="undefined"?"undefined":_typeof(document))<"u"){var P=getComputedStyle(document.documentElement).fontSize;et=s(P,16);}S*=et,x==="ex"&&(S/=2);}else if(x==="q")S*=96/25.4/4;else if(x==="vw"||x==="vh"){if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){var z=x==="vw"?document.documentElement.clientWidth:document.documentElement.clientHeight;S*=z/100;}}else if((x==="vmax"||x==="vmin")&&(typeof document==="undefined"?"undefined":_typeof(document))<"u"){var U=document.documentElement.clientWidth,K=document.documentElement.clientHeight;x==="vmax"?S*=Math.max(U,K)/100:S*=Math.min(U,K)/100;}return S;}var o="bold|bolder|lighter|[1-9]00",a="italic|oblique",u="small-caps",h="ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",v="px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%",p="'([^']+)'|\"([^\"]+)\"|([\\w-]|[\u4E00-\u9FA5])+",y=new RegExp("(".concat(o,") +"),"i"),C=new RegExp("(".concat(a,") +"),"i"),b=new RegExp("(".concat(u,") +"),"i"),M=new RegExp("(".concat(h,") +"),"i"),L=new RegExp("([\\d\\.]+)("+v+")(?:\\/([\\d\\.]+)("+v+"))? *((?:"+p+")( *, *(?:"+p+"))*)");function X(Y,et){var A=L.exec(Y);if(A){var w=parseFloat(A[3]),S={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(A[1]),unit:A[2],lineHeight:Number.isFinite(w)?w:void 0,lineHeightUnit:A[4],family:A[5].replace(/ *, */g,",")},x=Y.substring(0,A.index),P=y.exec(x),z=C.exec(x),U=b.exec(x),K=M.exec(x);return P&&(S.weight=P[1]),z&&(S.style=z[1]),U&&(S.variant=U[1]),K&&(S.stretch=K[1]),S.pxHeight=s({size:S.size,unit:S.unit},et),S.pxLineHeight=s({size:S.lineHeight||S.size,unit:S.lineHeightUnit||S.unit},et),S;}}},/* 40 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return s;}),i(1).glMatrix.setMatrixArrayType(Array);function s(o){return"rgba(".concat(o.map(function(a,u){return u<3?Math.round(a*255):a;}).join(),")");}},/* 41 *//***/function(e,n,i){i.r(n),i.d(n,"applyFilter",function(){return p;}),i.d(n,"drawMesh2D",function(){return C;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(1),u=i(40),h=i(39),v=i(42);i(1).glMatrix.setMatrixArrayType(Array);function p(b,M){var L=b.canvas;b.save(),b.filter=M,b.drawImage(L,0,0,L.width,L.height),b.restore();}function y(b,M){var L=/rgba\((\d+),(\d+),(\d+),(\d+)\)/;b=b.match(L).slice(1,5).map(Number),M=M.match(L).slice(1,5).map(Number);for(var X=[],Y=M[3],et=0;et<4;et++)X[et]=Object(v.mix)(b[et],M[et],Y);return"rgba(".concat(X.join(),")");}function C(b,M){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,X=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,Y=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,et=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,A=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null;M.save();var w=!1,S=!1;if(M.globalAlpha=b.getOpacity(),b._updateMatrix){var x=b.transformScale/b.contours.scale;x>1.5&&b.accurate(b.transformScale);}if(b.lineWidth){var P=b.gradient&&b.gradient.stroke;if(P){var z=P,U=z.vector,K=z.colors;if(U.length===6)P=M.createRadialGradient.apply(M,o()(U));else if(U.length===4)P=M.createLinearGradient.apply(M,o()(U));else if(U.length===3)P=M.createCircularGradient.apply(M,o()(U));else throw new TypeError("Invalid vector dimension.");K.forEach(function(ut){var Ct=ut.offset,R=ut.color,$=Object(u.default)(R);Y&&($=y($,Y)),P.addColorStop(Ct,$);}),M.strokeStyle=P,w=!0;}else b.strokeStyle&&(Y?M.strokeStyle=y(b.strokeStyle,Y):M.strokeStyle=b.strokeStyle,w=!0);}w&&(M.lineWidth=b.lineWidth,M.lineJoin=b.lineJoin,M.lineCap=b.lineCap,M.miterLimit=b.miterLimit,b.lineDash&&(M.setLineDash(b.lineDash),b.lineDashOffset&&(M.lineDashOffset=b.lineDashOffset)));var j=b.gradient&&b.gradient.fill;if(j){var nt=j,ct=nt.vector,B=nt.colors;if(ct.length===6)j=M.createRadialGradient.apply(M,o()(ct));else if(ct.length===4)j=M.createLinearGradient.apply(M,o()(ct));else if(ct.length===3)j=M.createCircularGradient.apply(M,o()(ct));else throw new TypeError("Invalid vector dimension.");B.forEach(function(ut){var Ct=ut.offset,R=ut.color,$=Object(u.default)(R);Y&&($=y($,Y)),j.addColorStop(Ct,$);}),M.fillStyle=j,S=!0;}else b.fillStyle&&(X?M.fillStyle=y(b.fillStyle,X):M.fillStyle=b.fillStyle,S=!0);if(A&&M.transform.apply(M,o()(A)),M.transform.apply(M,o()(b.transformMatrix)),b.clipPath){var N=b.clipPath,G=new Path2D(N);M.clip(G);}var q=b.contours.length;if(b.contours.forEach(function(ut,Ct){var R=ut.length,$=R>1&&a.vec2.equals(ut[0],ut[R-1]),_=Ct===q-1&&b.texture;if(ut&&R>0){if(S||w||_){M.beginPath(),M.moveTo.apply(M,o()(ut[0]));for(var H=1;H<R;H++)H===R-1&&$?M.closePath():M.lineTo.apply(M,o()(ut[H]));}if(S&&M.fill(b.fillRule),_){M.save(),M.clip();var lt=b.texture,dt=lt.image,wt=lt.options;if(et&&(dt=et),wt.repeat&&console.warn("Context 2D not supported image repeat yet."),dt.font){wt.scale&&console.warn("Context 2D not supported text scale yet."),wt.srcRect&&console.warn("Context 2D not supported text srcRect yet.");var Et=dt,Ot=Et.font,O=Et.fillColor,D=Et.strokeColor,J=Et.strokeWidth,Q=Et.text;!O&&!D&&(O="#000"),Array.isArray(O)&&(O=Object(u.default)(O)),Array.isArray(D)&&(D=Object(u.default)(D)),M.font=Ot;var V=M.measureText(Q),tt=V.width,g=Object(h.default)(Ot),T=Math.max(g.pxLineHeight,g.pxHeight*1.13);M.textAlign="center",M.textBaseline="middle";var k=wt.rect,Z=k[0]+T*0.5+g.pxHeight*0.06,st=k[1]+tt*0.5;k[2]!=null&&M.scale(k[2]/tt,k[3]/T),O&&(M.fillStyle=O,M.fillText(Q,st,Z)),D&&(M.lineWidth=J,M.strokeStyle=D,M.strokeText(Q,st,Z));}else{var ft=wt.rect,pt=wt.srcRect;wt.scale&&(ft=[0,0,M.canvas.width,M.canvas.height]),wt.rotated&&ft&&(ft=[-ft[1],ft[0],ft[3],ft[2]]),pt&&(ft=ft||[0,0,pt[2],pt[3]]),wt.rotated&&(M.translate(0,ft?ft[2]:dt.width),M.rotate(-0.5*Math.PI)),pt?M.drawImage.apply(M,[dt].concat(o()(pt),o()(ft))):ft?M.drawImage.apply(M,[dt].concat(o()(ft))):M.drawImage(dt,0,0);}M.restore();}w&&M.stroke();}}),M.restore(),L){var at=b.filter;at&&p(M,at);}}},/* 42 *//***/function(e,n,i){i.r(n),i.d(n,"clamp",function(){return a;}),i.d(n,"mix",function(){return u;}),i.d(n,"transformPoint",function(){return h;});var s=i(13),o=/* @__PURE__ */i.n(s);i(1).glMatrix.setMatrixArrayType(Array);function a(v,p,y){if(p>y){var C=[y,p];p=C[0],y=C[1];}return v<p?p:v>y?y:v;}function u(v,p,y){return v*(1-y)+p*y;}function h(v,p){var y=o()(v,2),C=y[0],b=y[1];return[C*p[0]+b*p[2]+p[4],C*p[1]+b*p[3]+p[5]];}},/* 43 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return C;});var s=i(27),o=/* @__PURE__ */i.n(s),a=i(44),u=i(45);i(1).glMatrix.setMatrixArrayType(Array);var h=/* @__PURE__ */o.a.mark(C);function v(b,M,L){var X=b.uniforms||{},Y=M.uniforms||{};if(X.u_texSampler&&Y.u_texSampler&&X.u_texSampler!==Y.u_texSampler)return!1;var et=Object.keys(X),A=Object.keys(Y),w=et.indexOf("u_texSampler"),S=A.indexOf("u_texSampler");if(w>=0&&et.splice(w,1),S>=0&&A.splice(S,1),et.length!==A.length)return!1;var x=et.every(function(z){var U=X[z],K=Y[z];if(U===K)return!0;if(U.length&&K.length&&U.length===K.length){for(var j=0;j<U.length;j++)if(U[j]!==K[j])return!1;return!0;}return!1;});if(x){if(X.u_texSampler&&!Y.u_texSampler)M.setTexture(X.u_texSampler,{hidden:!0});else if(!X.u_texSampler&&Y.u_texSampler)for(var P=0;P<L.length;P++)L[P].setTexture(Y.u_texSampler,{hidden:!0});}return x;}var p={};function y(b,M){if(b.length){var L=Object(a.default)(b,p);return L.enableBlend=M,b[0].filterCanvas&&(L.filterCanvas=!0),L.packIndex=b[0].packIndex,L.packLength=b.length,L.beforeRender=b[0].beforeRender,L.pass=b[0].pass,L.afterRender=b[b.length-1].afterRender,b.length=0,L;}}function C(b,M){var L,X,Y,et,A,w,S,x,P,z,U,K,j=arguments;return o.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:L=j.length>2&&j[2]!==void 0?j[2]:!1,X=[],Y=b.options.bufferSize,et=0,A=!1,w=0;case 6:if(!(w<M.length)){ct.next=50;break;}if(S=M[w],!(S instanceof u.default)){ct.next=18;break;}if(!X.length){ct.next=12;break;}return ct.next=12,y(X,A);case 12:return et=0,A=!1,ct.next=16,S;case 16:ct.next=47;break;case 18:if(x=S.meshData,x.clipPath&&!x.uniforms.u_clipSampler&&(P=b.createTexture(x.clipPath),x.uniforms.u_clipSampler=P),z=0,!((!L||!S.canIgnore())&&x&&x.positions.length)){ct.next=43;break;}if(S.packIndex=w,U=S.filterCanvas,z=x.positions.length,!(U||et+z>Y)){ct.next=33;break;}if(!X.length){ct.next=29;break;}return ct.next=29,y(X,A);case 29:et=0,A=!1,ct.next=40;break;case 33:if(!et){ct.next=40;break;}if(K=X[X.length-1],!(K&&(K.filterCanvas||K.afterRender||S.beforeRender||K.pass.length||S.pass.length||K.program!==S.program||!v(K,S,X)))){ct.next=40;break;}return ct.next=38,y(X,A);case 38:et=0,A=!1;case 40:X.push(S),A=A||S.enableBlend,et+=z;case 43:if(w!==M.length-1){ct.next=47;break;}if(!X.length){ct.next=47;break;}return ct.next=47,y(X,A);case 47:w++,ct.next=6;break;case 50:case"end":return ct.stop();}},h);}},/* 44 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return p;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(13),u=/* @__PURE__ */i.n(a);i(1).glMatrix.setMatrixArrayType(Array);var h={UNSIGNED_BYTE:Uint8Array,UNSIGNED_SHORT:Uint16Array,BYTE:Int8Array,SHORT:Int16Array,FLOAT:Float32Array};function v(y,C){for(var b=0,M=0,L=0,X=0,Y=0,et=0,A=0,w=y[0].program,S=0;S<y.length;S++){var x=y[S].meshData;if(x){A+=x.positions.length;var P=x.positions[0].length;b+=x.positions.length*P,M+=x.cells.length*3,et+=x.attributes.a_color.length*4;var z=x.textureCoord;z&&(L+=z.length*z[0].length);var U=x.attributes.a_sourceRect;U&&(X+=U.length*4);var K=x.attributes.a_clipUV;K&&(Y+=K.length*2);}}if((!C.positions||C.positions.length<b)&&(C.positions=new Float32Array(b)),(!C.cells||C.cells.length<M)&&(C.cells=new Uint16Array(M)),L&&(!C.textureCoord||C.textureCoord.length<L)&&(C.textureCoord=new Float32Array(L)),(!C.a_color||C.a_color.length<et)&&(C.a_color=new Uint8Array(et)),X&&(!C.a_sourceRect||C.a_sourceRect.length<X)&&(C.a_sourceRect=new Float32Array(X)),Y&&(!C.a_clipUV||C.a_clipUV.length<Y)&&(C.a_clipUV=new Float32Array(Y)),w)for(var j=Object.entries(w._attribute),nt=w._attribOpts||{},ct=0;ct<j.length;ct++){var B=u()(j[ct],2),N=B[0],G=B[1];if(N!=="a_color"&&N!=="a_sourceRect"&&G!=="ignored"){var q=nt[N]?nt[N].type:"FLOAT",at=h[q],ut=G.size*A;(!C[N]||C[N].length<ut)&&(C[N]=new at(ut));}}return C;}function p(y,C){var b=[],M=[],L=[],X=[],Y=[],et=[],A=0,w=0,S=y[0]?y[0].uniforms||{}:{},x=y[0]?y[0].program:null;C&&(v(y,C),M=C.cells,b=C.positions,L=C.textureCoord,X=C.a_color,Y=C.a_sourceRect,et=C.a_clipUV);for(var P=!1,z=!1,U={},K=0;K<y.length;K++){var j=y[K];if(j){if(j.meshData&&(j=j.meshData),C)for(var nt=j.positions,ct=0;ct<nt.length;ct++)for(var B=nt[ct],N=3*(A+ct),G=0;G<B.length;G++)b[N+G]=B[G];else{var q;(q=b).push.apply(q,o()(j.positions));}for(var at=j.cells,ut=0;ut<at.length;ut++){var Ct=at[ut];if(C){var R=3*(w+ut);M[R]=Ct[0]+A,M[R+1]=Ct[1]+A,M[R+2]=Ct[2]+A;}else M.push([Ct[0]+A,Ct[1]+A,Ct[2]+A]);}if(C)for(var $=j.attributes.a_color,_=0;_<$.length;_++){var H=$[_],lt=4*(A+_);X[lt]=H[0],X[lt+1]=H[1],X[lt+2]=H[2],X[lt+3]=H[3];}else{var dt;(dt=X).push.apply(dt,o()(j.attributes.a_color));}if(j.attributes.a_sourceRect)if(P=!0,C)for(var wt=j.attributes.a_sourceRect,Et=0;Et<wt.length;Et++){var Ot=wt[Et],O=4*(A+Et);Y[O]=Ot[0],Y[O+1]=Ot[1],Y[O+2]=Ot[2],Y[O+3]=Ot[3];}else{var D;(D=Y).push.apply(D,o()(j.attributes.a_sourceRect));}if(j.attributes.a_clipUV)if(z=!0,C)for(var J=j.attributes.a_clipUV,Q=0;Q<J.length;Q++){var V=J[Q],tt=2*(A+Q);et[tt]=V[0],et[tt+1]=V[1];}else{var g;(g=et).push.apply(g,o()(j.attributes.a_clipUV));}if(j.textureCoord)if(C)for(var T=j.textureCoord,k=0;k<T.length;k++)for(var Z=T[k],st=3*(A+k),ft=0;ft<Z.length;ft++)L[st+ft]=Z[ft];else{var pt;(pt=L).push.apply(pt,o()(j.textureCoord));}if(x)for(var ot=Object.entries(x._attribute),mt=0;mt<ot.length;mt++){var It=u()(ot[mt],2),Pt=It[0],Lt=It[1];if(Pt!=="a_color"&&Pt!=="a_sourceRect"&&Lt!=="ignored")if(U[Pt]=[],C){U[Pt]=C[Pt];for(var Dt=j.attributes[Pt],Nt=Dt[0].length,Yt=0;Yt<Dt.length;Yt++)for(var Ut=Dt[Yt],Ft=Nt*(A+Yt),Jt=0;Jt<Ut.length;Jt++)U[Pt][Ft+Jt]=Ut[Jt];}else{var ee;(ee=U[Pt]).push.apply(ee,o()(j.attributes[Pt]));}}A+=j.positions.length,w+=j.cells.length;}}U.a_color=X,P&&Y&&Y.length>0&&(U.a_sourceRect=Y);var re={positions:b,cells:M,attributes:U,uniforms:S,cellsCount:w*3,program:x};return L&&L.length&&(re.textureCoord=L),z&&et.length>0&&(U.a_clipUV=et),re;}},/* 45 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return B;});var s=i(30),o=/* @__PURE__ */i.n(s),a=i(19),u=/* @__PURE__ */i.n(a),h=i(13),v=/* @__PURE__ */i.n(h),p=i(23),y=/* @__PURE__ */i.n(p),C=i(24),b=/* @__PURE__ */i.n(C),M=i(1),L=i(46),X=i(42),Y=i(47);i(1).glMatrix.setMatrixArrayType(Array);function et(N,G){var q=Object.keys(N);if(Object.getOwnPropertySymbols){var at=Object.getOwnPropertySymbols(N);G&&(at=at.filter(function(ut){return Object.getOwnPropertyDescriptor(N,ut).enumerable;})),q.push.apply(q,at);}return q;}function A(N){for(var G=1;G<arguments.length;G++){var q=arguments[G]!=null?arguments[G]:{};G%2?et(Object(q),!0).forEach(function(at){o()(N,at,q[at]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(N,Object.getOwnPropertyDescriptors(q)):et(Object(q)).forEach(function(at){Object.defineProperty(N,at,Object.getOwnPropertyDescriptor(q,at));});}return N;}var w=Symbol("mesh"),S=Symbol("count"),x=Symbol("blend"),P=Symbol("filter"),z=Symbol("textures"),U=Symbol("textureOptions"),K=Symbol("cloudColor"),j=Symbol("cloudFilter"),nt=Symbol("buffer");function ct(N){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,q=new Float32Array(3*N),at=new Float32Array(3*N),ut=new Float32Array(4*N),Ct=new Float32Array(4*N),R=new Float32Array(4*N),$=new Float32Array(4*N),_=new Float32Array(4*N),H=new Uint8Array(N),lt=new Uint8Array(4*N),dt=new Uint8Array(4*N);return G&&(q.set(G.transform0,0),at.set(G.transform1,0),ut.set(G.color0,0),Ct.set(G.color1,0),R.set(G.color2,0),$.set(G.color3,0),_.set(G.color4,0),H.set(G.frameIndex,0),lt.set(G.fillColor,0),dt.set(G.strokeColor,0)),{bufferSize:N,transform0:q,transform1:at,color0:ut,color1:Ct,color2:R,color3:$,color4:_,frameIndex:H,fillColor:lt,strokeColor:dt};}var B=/* @__PURE__ */function(){function N(G){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,at=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ut=at.buffer,Ct=ut===void 0?1e3:ut;y()(this,N),Ct=Math.max(Ct,q),this[S]=q,this[w]=G,this[nt]=ct(Ct),this[z]=[],this[P]=[],this[K]=!1,this[j]=!1,this[x]=!1,this.initBuffer();}return b()(N,[{key:"initBuffer",value:function value(){for(var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,at=this[S],ut=q;ut<at;ut++)this[nt].transform0.set([1,0,0],ut*3),this[nt].transform1.set([0,1,0],ut*3),this[nt].frameIndex.set([-1],ut),this[nt].fillColor.set([0,0,0,0],ut*4),this[nt].strokeColor.set([0,0,0,0],ut*4),this.setColorTransform(ut,null);}},{key:"_getFilter",value:function value(q){return this[P][q]=this[P][q]||[],this[P][q];}},{key:"getFilter",value:function value(q){return this._getFilter(q).join(" ");}},{key:"canIgnore",value:function value(){return this[w].canIgnore();}},{key:"delete",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");var at=this[nt],ut=at.transform0,Ct=at.transform1,R=at.color0,$=at.color1,_=at.color2,H=at.color3,lt=at.color4,dt=at.frameIndex,wt=at.fillColor,Et=at.strokeColor;ut.set(ut.subarray(3*(q+1)),3*q),Ct.set(Ct.subarray(3*(q+1)),3*q),R.set(R.subarray(4*(q+1)),4*q),$.set($.subarray(4*(q+1)),4*q),_.set(_.subarray(4*(q+1)),4*q),H.set(H.subarray(4*(q+1)),4*q),lt.set(lt.subarray(4*(q+1)),4*q),dt.set(dt.subarray(q+1),q),wt.set(wt.subarray(4*(q+1)),4*q),Et.set(Et.subarray(4*(q+1)),4*q);for(var Ot in this[P])Ot===q?delete this[P][Ot]:Ot>q&&(this[P][Ot-1]=this[P][Ot],delete this[P][Ot]);this[S]--;}},{key:"setColorTransform",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=4;var ut=this[nt],Ct=ut.color0,R=ut.color1,$=ut.color2,_=ut.color3,H=ut.color4;return at!=null?(Ct.set([at[0],at[5],at[10],at[15]],q),R.set([at[1],at[6],at[11],at[16]],q),$.set([at[2],at[7],at[12],at[17]],q),_.set([at[3],at[8],at[13],at[18]],q),H.set([at[4],at[9],at[14],at[19]],q),this[x]=this[x]||at[18]<1,this[j]=!0):(Ct.set([1,0,0,0],q),R.set([0,1,0,0],q),$.set([0,0,1,0],q),_.set([0,0,0,1],q),H.set([0,0,0,0],q)),this;}},{key:"getColorTransform",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=4;var at=this[nt],ut=at.color0,Ct=at.color1,R=at.color2,$=at.color3,_=at.color4;return[ut[q],Ct[q],R[q],$[q],_[q],ut[q+1],Ct[q+1],R[q+1],$[q+1],_[q+1],ut[q+2],Ct[q+2],R[q+2],$[q+2],_[q+2],ut[q+3],Ct[q+3],R[q+3],$[q+3],_[q+3]];}},{key:"transformColor",value:function value(q,at){var ut=this.getColorTransform(q);return ut=Object(L.multiply)(ut,at),this.setColorTransform(q,ut),this;}},{key:"setFillColor",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");typeof at=="string"&&(at=Object(Y.default)(at)),at[3]>0&&(this[K]=!0),this[nt].fillColor.set(at.map(function(ut){return Math.round(255*ut);}),4*q);}},{key:"setStrokeColor",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");typeof at=="string"&&(at=Object(Y.default)(at)),at[3]>0&&(this[K]=!0),this[nt].strokeColor.set(at.map(function(ut){return Math.round(255*ut);}),4*q);}},{key:"getCloudRGBA",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=4;var at=this[nt],ut=at.fillColor,Ct=at.strokeColor,R=[ut[q],ut[q+1],ut[q+2],ut[q+3]],$=[Ct[q],Ct[q+1],Ct[q+2],Ct[q+3]];return R[3]/=255,$[3]/=255,{fill:"rgba(".concat(R.join(),")"),stroke:"rgba(".concat($.join(),")")};}},{key:"grayscale",value:function value(q,at){this.transformColor(q,Object(L.grayscale)(at)),this._getFilter(q).push("grayscale(".concat(100*at,"%)"));}},{key:"brightness",value:function value(q,at){this.transformColor(q,Object(L.brightness)(at)),this._getFilter(q).push("brightness(".concat(100*at,"%)"));}},{key:"saturate",value:function value(q,at){this.transformColor(q,Object(L.saturate)(at)),this._getFilter(q).push("saturate(".concat(100*at,"%)"));}},{key:"contrast",value:function value(q,at){this.transformColor(q,Object(L.contrast)(at)),this._getFilter(q).push("contrast(".concat(100*at,"%)"));}},{key:"invert",value:function value(q,at){this.transformColor(q,Object(L.invert)(at)),this._getFilter(q).push("invert(".concat(100*at,"%)"));}},{key:"sepia",value:function value(q,at){this.transformColor(q,Object(L.sepia)(at)),this._getFilter(q).push("sepia(".concat(100*at,"%)"));}},{key:"opacity",value:function value(q,at){this.transformColor(q,Object(L.opacity)(at)),this._getFilter(q).push("opacity(".concat(100*at,"%)"));}},{key:"hueRotate",value:function value(q,at){this.transformColor(q,Object(L.hueRotate)(at)),this._getFilter(q).push("hue-rotate(".concat(at,"deg)"));}},{key:"setTransform",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=3,at==null&&(at=[1,0,0,1,0,0]);var ut=this[nt],Ct=ut.transform0,R=ut.transform1;return Ct.set([at[0],at[2],at[4]],q),R.set([at[1],at[3],at[5]],q),this;}},{key:"getTransform",value:function value(q){if(q>=this[S]||q<0)throw new Error("Out of range.");q*=3;var at=this[nt],ut=at.transform0,Ct=at.transform1,R=[ut[q],Ct[q],ut[q+1],Ct[q+1],ut[q+2],Ct[q+2]];return R;}},{key:"getTextureFrame",value:function value(q){return this[z][this[nt].frameIndex[q]];}},{key:"setTextureFrames",value:function value(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],at=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(q.length>12)throw new Error("Max frames exceed. Allow 12 frames.");if(q.length){var ut=this[w];ut.setTexture(q[0],at);}this[z]=q,this[U]=at;}},{key:"setFrameIndex",value:function value(q,at){if(q>=this[S]||q<0)throw new Error("Out of range.");var ut=this[z].length;if(ut<=0)throw new Error("No frames");this[nt].frameIndex[q]=at%ut;}},{key:"setProgram",value:function value(q){this[w].setProgram(q);}},{key:"transform",value:function value(q,at){var ut=this.getTransform(q);return at=M.mat2d.multiply(Array.of(0,0,0,0,0,0),ut,at),this.setTransform(q,at),this;}},{key:"translate",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1],$=M.mat2d.create();return $=M.mat2d.translate(Array.of(0,0,0,0,0,0),$,[Ct,R]),this.transform(q,$);}},{key:"rotate",value:function value(q,at){var ut=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],Ct=v()(ut,2),R=Ct[0],$=Ct[1],_=M.mat2d.create();return _=M.mat2d.translate(Array.of(0,0,0,0,0,0),_,[R,$]),_=M.mat2d.rotate(Array.of(0,0,0,0,0,0),_,at),_=M.mat2d.translate(Array.of(0,0,0,0,0,0),_,[-R,-$]),this.transform(q,_);}},{key:"scale",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1],$=R===void 0?Ct:R,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],H=v()(_,2),lt=H[0],dt=H[1],wt=M.mat2d.create();return wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[lt,dt]),wt=M.mat2d.scale(Array.of(0,0,0,0,0,0),wt,[Ct,$]),wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[-lt,-dt]),this.transform(q,wt);}},{key:"skew",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1],$=R===void 0?Ct:R,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],H=v()(_,2),lt=H[0],dt=H[1],wt=M.mat2d.create();return wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[lt,dt]),wt=M.mat2d.multiply(Array.of(0,0,0,0,0,0),wt,M.mat2d.fromValues(1,Math.tan($),Math.tan(Ct),1,0,0)),wt=M.mat2d.translate(Array.of(0,0,0,0,0,0),wt,[-lt,-dt]),this.transform(q,wt);}},{key:"isPointCollision",value:function value(q,at){var ut,Ct=v()(at,2),R=Ct[0],$=Ct[1],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"both",H=this.getTransform(q),lt=Object(X.transformPoint)([R,$],M.mat2d.invert(Array.of(0,0,0,0,0,0),H));return(ut=this[w]).isPointCollision.apply(ut,u()(lt).concat([_]));}},{key:"isPointInFill",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1];return this.isPointCollision(q,[Ct,R],"fill");}},{key:"isPointInStroke",value:function value(q,at){var ut=v()(at,2),Ct=ut[0],R=ut[1];return this.isPointCollision(q,[Ct,R],"stroke");}},{key:"bufferSize",get:function get(){return this[nt].bufferSize;}},{key:"mesh",get:function get(){return this[w];},set:function set(q){this[w]=q,this[z]&&this.setTextureFrames(this[z],this[U]);}},{key:"hasCloudColor",get:function get(){return this[K];}},{key:"hasCloudFilter",get:function get(){return this[j];}},{key:"enableBlend",get:function get(){return this[w].enableBlend||this[x];}},{key:"amount",get:function get(){return this[S];},set:function set(q){var at=this[S];q!==at&&(q>this[nt].bufferSize&&(this[nt]=ct(Math.max(q,this[nt].bufferSize+1e3),this[nt])),this[S]=q,q>at&&this.initBuffer(at));}},{key:"meshData",get:function get(){var q=this[w].meshData,at=q.attributes,ut=q.cells,Ct=q.positions,R=q.textureCoord,$=q.uniforms,_=this[z],H={attributes:A({},at),cells:ut,positions:Ct,textureCoord:R,uniforms:A({},$),instanceCount:this[S],enableBlend:this.enableBlend};_.length&&_.forEach(function(g,T){H.uniforms["u_texFrame".concat(T)]=g;});var lt=this[nt],dt=lt.transform0,wt=lt.transform1,Et=lt.color0,Ot=lt.color1,O=lt.color2,D=lt.color3,J=lt.color4,Q=lt.fillColor,V=lt.strokeColor,tt=lt.frameIndex;return this[w].uniforms.u_texSampler&&(H.attributes.a_frameIndex={data:tt,divisor:1}),H.attributes.a_transform0={data:dt,divisor:1},H.attributes.a_transform1={data:wt,divisor:1},H.attributes.a_colorCloud0={data:Et,divisor:1},H.attributes.a_colorCloud1={data:Ot,divisor:1},H.attributes.a_colorCloud2={data:O,divisor:1},H.attributes.a_colorCloud3={data:D,divisor:1},H.attributes.a_colorCloud4={data:J,divisor:1},this.hasCloudColor&&(H.attributes.a_fillCloudColor={data:Q,divisor:1},H.attributes.a_strokeCloudColor={data:V,divisor:1}),H;}},{key:"program",get:function get(){return this[w].program;}}]),N;}();},/* 46 *//***/function(e,n,i){i.r(n),i.d(n,"multiply",function(){return o;}),i.d(n,"grayscale",function(){return a;}),i.d(n,"brightness",function(){return u;}),i.d(n,"saturate",function(){return h;}),i.d(n,"contrast",function(){return v;}),i.d(n,"invert",function(){return p;}),i.d(n,"sepia",function(){return y;}),i.d(n,"opacity",function(){return C;}),i.d(n,"hueRotate",function(){return b;});var s=i(42);i(1).glMatrix.setMatrixArrayType(Array);function o(M,L){var X=[],Y=M[0],et=M[1],A=M[2],w=M[3],S=M[4],x=M[5],P=M[6],z=M[7],U=M[8],K=M[9],j=M[10],nt=M[11],ct=M[12],B=M[13],N=M[14],G=M[15],q=M[16],at=M[17],ut=M[18],Ct=M[19],R=L[0],$=L[1],_=L[2],H=L[3],lt=L[4];return X[0]=R*Y+$*x+_*j+H*G,X[1]=R*et+$*P+_*nt+H*q,X[2]=R*A+$*z+_*ct+H*at,X[3]=R*w+$*U+_*B+H*ut,X[4]=R*S+$*K+_*N+H*Ct+lt,R=L[5],$=L[6],_=L[7],H=L[8],lt=L[9],X[5]=R*Y+$*x+_*j+H*G,X[6]=R*et+$*P+_*nt+H*q,X[7]=R*A+$*z+_*ct+H*at,X[8]=R*w+$*U+_*B+H*ut,X[9]=R*S+$*K+_*N+H*Ct+lt,R=L[10],$=L[11],_=L[12],H=L[13],lt=L[14],X[10]=R*Y+$*x+_*j+H*G,X[11]=R*et+$*P+_*nt+H*q,X[12]=R*A+$*z+_*ct+H*at,X[13]=R*w+$*U+_*B+H*ut,X[14]=R*S+$*K+_*N+H*Ct+lt,R=L[15],$=L[16],_=L[17],H=L[18],lt=L[19],X[15]=R*Y+$*x+_*j+H*G,X[16]=R*et+$*P+_*nt+H*q,X[17]=R*A+$*z+_*ct+H*at,X[18]=R*w+$*U+_*B+H*ut,X[19]=R*S+$*K+_*N+H*Ct+lt,X;}function a(M){M=Object(s.clamp)(0,1,M);var L=0.2126*M,X=0.7152*M,Y=0.0722*M;return[L+1-M,X,Y,0,0,L,X+1-M,Y,0,0,L,X,Y+1-M,0,0,0,0,0,1,0];}function u(M){return[M,0,0,0,0,0,M,0,0,0,0,0,M,0,0,0,0,0,1,0];}function h(M){var L=0.2126*(1-M),X=0.7152*(1-M),Y=0.0722*(1-M);return[L+M,X,Y,0,0,L,X+M,Y,0,0,L,X,Y+M,0,0,0,0,0,1,0];}function v(M){var L=0.5*(1-M);return[M,0,0,0,L,0,M,0,0,L,0,0,M,0,L,0,0,0,1,0];}function p(M){var L=1-2*M;return[L,0,0,0,M,0,L,0,0,M,0,0,L,0,M,0,0,0,1,0];}function y(M){return[1-0.607*M,0.769*M,0.189*M,0,0,0.349*M,1-0.314*M,0.168*M,0,0,0.272*M,0.534*M,1-0.869*M,0,0,0,0,0,1,0];}function C(M){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,M,0];}function b(M){var L=M/180*Math.PI,X=Math.cos(L),Y=Math.sin(L),et=0.2126,A=0.7152,w=0.0722;return[et+X*(1-et)+Y*-et,A+X*-A+Y*-A,w+X*-w+Y*(1-w),0,0,et+X*-et+Y*0.143,A+X*(1-A)+Y*0.14,w+X*-w+Y*-0.283,0,0,et+X*-et+Y*-0.7874,A+X*-A+Y*A,w+X*(1-w)+Y*w,0,0,0,0,0,1,0];}},/* 47 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return a;});var s=i(48),o=/* @__PURE__ */i.n(s);i(1).glMatrix.setMatrixArrayType(Array);function a(u){var h=o()(u);if(!h||!h.length)throw new TypeError("Invalid color value.");return[h[0]/255,h[1]/255,h[2]/255,h[3]];}},/* 48 *//***/function(e,n,i){var s=i(49),o=i(53),a=i(55);e.exports=function(h){var v,p=s(h);return p.space?(v=Array(3),v[0]=a(p.values[0],0,255),v[1]=a(p.values[1],0,255),v[2]=a(p.values[2],0,255),p.space[0]==="h"&&(v=o.rgb(v)),v.push(a(p.alpha,0,1)),v):[];};},/* 49 *//***/function(e,n,i){(function(s){var o=i(50),a=i(51),u=i(52);e.exports=v;var h={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function v(p){var y,C=[],b=1,M;if(typeof p=="string"){if(o[p])C=o[p].slice(),M="rgb";else if(p==="transparent")b=0,M="rgb",C=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(p)){var L=p.slice(1),X=L.length,Y=X<=4;b=1,Y?(C=[parseInt(L[0]+L[0],16),parseInt(L[1]+L[1],16),parseInt(L[2]+L[2],16)],X===4&&(b=parseInt(L[3]+L[3],16)/255)):(C=[parseInt(L[0]+L[1],16),parseInt(L[2]+L[3],16),parseInt(L[4]+L[5],16)],X===8&&(b=parseInt(L[6]+L[7],16)/255)),C[0]||(C[0]=0),C[1]||(C[1]=0),C[2]||(C[2]=0),M="rgb";}else if(y=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(p)){var et=y[1],A=et==="rgb",L=et.replace(/a$/,"");M=L;var X=L==="cmyk"?4:L==="gray"?1:3;C=y[2].trim().split(/\s*,\s*/).map(function(P,z){if(/%$/.test(P))return z===X?parseFloat(P)/100:L==="rgb"?parseFloat(P)*255/100:parseFloat(P);if(L[z]==="h"){if(/deg$/.test(P))return parseFloat(P);if(h[P]!==void 0)return h[P];}return parseFloat(P);}),et===L&&C.push(1),b=A||C[X]===void 0?1:C[X],C=C.slice(0,X);}else p.length>10&&/[0-9](?:\s|\/)/.test(p)&&(C=p.match(/([0-9]+)/g).map(function(S){return parseFloat(S);}),M=p.match(/([a-z])/ig).join("").toLowerCase());}else if(!isNaN(p))M="rgb",C=[p>>>16,(p&65280)>>>8,p&255];else if(a(p)){var w=u(p.r,p.red,p.R,null);w!==null?(M="rgb",C=[w,u(p.g,p.green,p.G),u(p.b,p.blue,p.B)]):(M="hsl",C=[u(p.h,p.hue,p.H),u(p.s,p.saturation,p.S),u(p.l,p.lightness,p.L,p.b,p.brightness)]),b=u(p.a,p.alpha,p.opacity,1),p.opacity!=null&&(b/=100);}else(Array.isArray(p)||s.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(p))&&(C=[p[0],p[1],p[2]],M="rgb",b=p.length===4?p[3]:1);return{space:M,values:C,alpha:b};}}).call(this,i(38));},/* 50 *//***/function(e,n,i){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};},/* 51 *//***/function(e,n,i){var s=Object.prototype.toString;e.exports=function(o){var a;return s.call(o)==="[object Object]"&&(a=Object.getPrototypeOf(o),a===null||a===Object.getPrototypeOf({}));};},/* 52 *//***/function(e,n){e.exports=function(){for(var i=0;i<arguments.length;i++)if(arguments[i]!==void 0)return arguments[i];};},/* 53 *//***/function(e,n,i){var s=i(54);e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function rgb(o){var a=o[0]/360,u=o[1]/100,h=o[2]/100,v,p,y,C,b;if(u===0)return b=h*255,[b,b,b];h<0.5?p=h*(1+u):p=h+u-h*u,v=2*h-p,C=[0,0,0];for(var M=0;M<3;M++)y=a+1/3*-(M-1),y<0?y++:y>1&&y--,6*y<1?b=v+(p-v)*6*y:2*y<1?b=p:3*y<2?b=v+(p-v)*(2/3-y)*6:b=v,C[M]=b*255;return C;}},s.hsl=function(o){var a=o[0]/255,u=o[1]/255,h=o[2]/255,v=Math.min(a,u,h),p=Math.max(a,u,h),y=p-v,C,b,M;return p===v?C=0:a===p?C=(u-h)/y:u===p?C=2+(h-a)/y:h===p&&(C=4+(a-u)/y),C=Math.min(C*60,360),C<0&&(C+=360),M=(v+p)/2,p===v?b=0:M<=0.5?b=y/(p+v):b=y/(2-p-v),[C,b*100,M*100];};},/* 54 *//***/function(e,n,i){e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};},/* 55 *//***/function(e,n){e.exports=i;function i(s,o,a){return o<a?s<o?o:s>a?a:s:s<a?a:s>o?o:s;}},/* 56 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return nt;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(57),u=/* @__PURE__ */i.n(a),h=i(23),v=/* @__PURE__ */i.n(h),p=i(24),y=/* @__PURE__ */i.n(p),C=i(58),b=/* @__PURE__ */i.n(C),M=i(59),L=/* @__PURE__ */i.n(M),X=i(60),Y=/* @__PURE__ */i.n(X),et=i(61),A=i(63),w=/* @__PURE__ */i.n(A),S=i(70),x=i(72);i(1).glMatrix.setMatrixArrayType(Array);var P=Symbol("contours"),z=Symbol("path"),U=Symbol("simplify"),K=Symbol("scale"),j=2*Math.PI,nt=/* @__PURE__ */function(){function ct(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};v()(this,ct),typeof B=="string"&&(B={path:B}),B.path?this[z]=b()(B.path):this[z]=[],this[P]=null,this[U]=B.simplify!=null?B.simplify:0,this[K]=B.scale!=null?B.scale:2;}return y()(ct,[{key:"normalize",value:function value(){var N,G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,at=Object(et.default)(Y()(this[z])).map(function(ut){for(var Ct=u()(ut),R=Ct[0],$=Ct.slice(1),_=[R],H=0;H<$.length;H+=2){var lt=$[H]-G,dt=$[H+1]-q;_.push(lt,dt);}return _;});return this.beginPath(),(N=this[z]).push.apply(N,o()(at)),this;}},{key:"getPointAtLength",value:function value(N){return this.contours?Object(S.getPointAtLength)(this[P],N):null;}},{key:"getTotalLength",value:function value(){return this.contours?Object(S.getTotalLength)(this[P]):0;}},{key:"addPath",value:function value(N){var G;this[P]=null,typeof N=="string"&&(N=b()(N)),(G=this[z]).push.apply(G,o()(N));}},{key:"beginPath",value:function value(){this[z]=[],this[P]=null;}},{key:"clear",value:function value(){this.beginPath();}},{key:"ellipse",value:function value(N,G,q,at,ut,Ct,R){var $=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0;if(Ct+=ut,R+=ut,!(q<=0||at<=0||R===Ct)){R<Ct&&(R=Ct+j+(R-Ct)%j),R-Ct>j&&(R=Ct+j);var _=R-Ct;_>=j&&(R-=1e-3);var H=this[z].length>0&&_<j?"L":"M",lt=Object(x.getPoint)(N,G,q,at,Ct),dt=Object(x.getPoint)(N,G,q,at,R),wt=+!$,Et=_>Math.PI?1:0;$&&(Et=1-Et),H+=lt.join(" "),H+="A".concat(q," ").concat(at," 0 ").concat(Et," ").concat(wt," ").concat(dt.join(" ")),_>=j&&(H+="Z"),this.addPath(H);}}},{key:"arc",value:function value(N,G,q,at,ut){var Ct=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;return this.ellipse(N,G,q,q,0,at,ut,Ct);}},{key:"arcTo",value:function value(N,G,q,at,ut,Ct,R){this[P]=null,this[z].push(["A",N,G,q,at,ut,Ct,R]);}},{key:"moveTo",value:function value(N,G){this[P]=null,this[z].push(["M",N,G]);}},{key:"lineTo",value:function value(N,G){this[P]=null,this[z].push(["L",N,G]);}},{key:"bezierCurveTo",value:function value(N,G,q,at,ut,Ct){this[P]=null,this[z].push(["C",N,G,q,at,ut,Ct]);}},{key:"quadraticCurveTo",value:function value(N,G,q,at){this[P]=null,this[z].push(["Q",N,G,q,at]);}},{key:"rect",value:function value(N,G,q,at){var ut="M".concat(N," ").concat(G,"L").concat(N+q," ").concat(G,"L").concat(N+q," ").concat(G+at,"L").concat(N," ").concat(G+at,"Z");this.addPath(ut);}},{key:"closePath",value:function value(){this[P]=null;var N=[],G=this[z].length;G>0&&(N=this[z][G-1]),N[0]!=="Z"&&N[0]!=="z"&&this[z].push(["Z"]);}},{key:"contours",get:function get(){var N=null;if(!this[P]&&this[z]){var G=Object(et.default)(Y()(this[z]));this[P]=w()(G,this[K],this[U]),this[P].path=G,this[P].simplify=this[U],this[P].scale=this[K];}return this[P]&&(N=this[P].map(function(q){return o()(q);}),N.path=this[P].path,N.simplify=this[P].simplify,N.scale=this[P].scale),N;}},{key:"path",get:function get(){return this[z];}},{key:"simplify",get:function get(){return this[U];}},{key:"boundingBox",get:function get(){var N=this.contours;if(N&&N.length){var G=N.reduce(function(q,at){return[].concat(o()(q),o()(at));});return L()(G);}return[[0,0],[0,0]];}},{key:"boundingCenter",get:function get(){var N=this.boundingBox;return N?[0.5*(N[0][0]+N[1][0]),0.5*(N[0][1]+N[1][1])]:[0,0];}}]),ct;}();},/* 57 *//***/function(e,n,i){var s=i(14),o=i(21),a=i(16),u=i(18);function h(v){return s(v)||o(v)||a(v)||u();}e.exports=h;},/* 58 *//***/function(e,n){e.exports=o;var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},s=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function o(h){var v=[];return h.replace(s,function(p,y,C){var b=y.toLowerCase();for(C=u(C),b=="m"&&C.length>2&&(v.push([y].concat(C.splice(0,2))),b="l",y=y=="m"?"l":"L");;){if(C.length==i[b])return C.unshift(y),v.push(C);if(C.length<i[b])throw new Error("malformed path data");v.push([y].concat(C.splice(0,i[b])));}}),v;}var a=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function u(h){var v=h.match(a);return v?v.map(Number):[];}},/* 59 *//***/function(e,n,i){e.exports=s;function s(o){var a=o.length;if(a===0)return[[],[]];for(var u=o[0].length,h=o[0].slice(),v=o[0].slice(),p=1;p<a;++p)for(var y=o[p],C=0;C<u;++C){var b=y[C];h[C]=Math.min(h[C],b),v[C]=Math.max(v[C],b);}return[h,v];}},/* 60 *//***/function(e,n){e.exports=i;function i(s){var o=0,a=0,u=0,h=0;return s.map(function(v){v=v.slice();var p=v[0],y=p.toUpperCase();if(p!=y)switch(v[0]=y,p){case"a":v[6]+=u,v[7]+=h;break;case"v":v[1]+=h;break;case"h":v[1]+=u;break;default:for(var C=1;C<v.length;)v[C++]+=u,v[C++]+=h;}switch(y){case"Z":u=o,h=a;break;case"H":u=v[1];break;case"V":h=v[1];break;case"M":u=o=v[1],h=a=v[2];break;default:u=v[v.length-2],h=v[v.length-1];}return v;});}},/* 61 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return u;});var s=i(13),o=/* @__PURE__ */i.n(s),a=i(62);i(1).glMatrix.setMatrixArrayType(Array);function u(p){for(var y,C=[],b=0,M=0,L=0,X=0,Y=null,et=null,A=0,w=0,S=0,x=p.length;S<x;S++){var P=p[S],z=P[0];switch(z){case"M":L=P[1],X=P[2];break;case"A":var U=Object(a.default)(A,w,P[6],P[7],P[4],P[5],P[1],P[2],P[3]);if(!U.length)continue;U=U.map(function(B){var N=o()(B,8);N[0],N[1];var G=N[2],q=N[3],at=N[4],ut=N[5],Ct=N[6],R=N[7];return{x1:G,y1:q,x2:at,y2:ut,x:Ct,y:R};});for(var K=0,j;K<U.length;K++)j=U[K],P=["C",j.x1,j.y1,j.x2,j.y2,j.x,j.y],K<U.length-1&&C.push(P);break;case"S":var nt=A,ct=w;(y=="C"||y=="S")&&(nt+=nt-b,ct+=ct-M),P=["C",nt,ct,P[1],P[2],P[3],P[4]];break;case"T":y=="Q"||y=="T"?(Y=A*2-Y,et=w*2-et):(Y=A,et=w),P=v(A,w,Y,et,P[1],P[2]);break;case"Q":Y=P[1],et=P[2],P=v(A,w,P[1],P[2],P[3],P[4]);break;case"L":P=h(A,w,P[1],P[2]);break;case"H":P=h(A,w,P[1],w);break;case"V":P=h(A,w,A,P[1]);break;case"Z":P=h(A,w,L,X);break;}y=z,A=P[P.length-2],w=P[P.length-1],P.length>4?(b=P[P.length-4],M=P[P.length-3]):(b=A,M=w),C.push(P);}return C;}function h(p,y,C,b){return["C",p,y,C,b,C,b];}function v(p,y,C,b,M,L){return["C",p/3+2/3*C,y/3+2/3*b,M/3+2/3*C,L/3+2/3*b,M,L];}},/* 62 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return h;}),i(1).glMatrix.setMatrixArrayType(Array);var s=Math.PI*2;function o(v,p,y,C){var b=v*C-p*y<0?-1:1,M=v*y+p*C;return M>1&&(M=1),M<-1&&(M=-1),b*Math.acos(M);}function a(v,p,y,C,b,M,L,X,Y,et){var A=et*(v-y)/2+Y*(p-C)/2,w=-Y*(v-y)/2+et*(p-C)/2,S=L*L,x=X*X,P=A*A,z=w*w,U=S*x-S*z-x*P;U<0&&(U=0),U/=S*z+x*P,U=Math.sqrt(U)*(b===M?-1:1);var K=U*L/X*w,j=U*-X/L*A,nt=et*K-Y*j+(v+y)/2,ct=Y*K+et*j+(p+C)/2,B=(A-K)/L,N=(w-j)/X,G=(-A-K)/L,q=(-w-j)/X,at=o(1,0,B,N),ut=o(B,N,G,q);return M===0&&ut>0&&(ut-=s),M===1&&ut<0&&(ut+=s),[nt,ct,at,ut];}function u(v,p){var y=1.3333333333333333*Math.tan(p/4),C=Math.cos(v),b=Math.sin(v),M=Math.cos(v+p),L=Math.sin(v+p);return[C,b,C-b*y,b+C*y,M+L*y,L-M*y,M,L];}function h(v,p,y,C,b,M,L,X,Y){var et=Math.sin(Y*s/360),A=Math.cos(Y*s/360),w=A*(v-y)/2+et*(p-C)/2,S=-et*(v-y)/2+A*(p-C)/2;if(w===0&&S===0)return[];if(L===0||X===0)return[];L=Math.abs(L),X=Math.abs(X);var x=w*w/(L*L)+S*S/(X*X);x>1&&(L*=Math.sqrt(x),X*=Math.sqrt(x));var P=a(v,p,y,C,b,M,L,X,et,A),z=[],U=P[2],K=P[3],j=Math.max(Math.ceil(Math.abs(K)/(s/4)),1);K/=j;for(var nt=0;nt<j;nt++)z.push(u(U,K)),U+=K;return z.map(function(ct){for(var B=0;B<ct.length;B+=2){var N=ct[B+0],G=ct[B+1];N*=L,G*=X;var q=A*N-et*G,at=et*N+A*G;ct[B+0]=q+P[0],ct[B+1]=at+P[1];}return ct;});}},/* 63 *//***/function(e,n,i){i(1).glMatrix.setMatrixArrayType(Array);var s=i(64),o=i(66),a=o.copy,u=i(67);function h(b,M,L){return b[0]=M,b[1]=L,b;}var v=[0,0],p=[0,0],y=[0,0];function C(b,M,L,X){s(L,h(v,X[1],X[2]),h(p,X[3],X[4]),h(y,X[5],X[6]),M,b);}e.exports=function(M,L,X){var Y=[],et=[],A=[0,0];return M.forEach(function(w,S,x){if(w[0]==="M")a(A,w.slice(1)),et.length>0&&(Y.push(et),et=[]);else if(w[0]==="C")C(et,L,A,w),h(A,w[5],w[6]);else throw new Error("illegal type in SVG: "+w[0]);}),et.length>0&&Y.push(et),Y.map(function(w){return u(w,X||0);});};},/* 64 *//***/function(e,n,i){e.exports=i(65)();},/* 65 *//***/function(e,n){function i(o){return[o[0],o[1]];}function s(o,a){return[o,a];}e.exports=function(a){a=a||{};var u=typeof a.recursion=="number"?a.recursion:8,h=typeof a.epsilon=="number"?a.epsilon:11920929e-14,v=typeof a.pathEpsilon=="number"?a.pathEpsilon:1,p=typeof a.angleEpsilon=="number"?a.angleEpsilon:0.01,y=a.angleTolerance||0,C=a.cuspLimit||0;return function(X,Y,et,A,w,S){S||(S=[]),w=typeof w=="number"?w:1;var x=v/w;return x*=x,b(X,Y,et,A,S,x),S;};function b(L,X,Y,et,A,w){A.push(i(L));var S=L[0],x=L[1],P=X[0],z=X[1],U=Y[0],K=Y[1],j=et[0],nt=et[1];M(S,x,P,z,U,K,j,nt,A,w,0),A.push(i(et));}function M(L,X,Y,et,A,w,S,x,P,z,U){if(!(U>u)){var K=Math.PI,j=(L+Y)/2,nt=(X+et)/2,ct=(Y+A)/2,B=(et+w)/2,N=(A+S)/2,G=(w+x)/2,q=(j+ct)/2,at=(nt+B)/2,ut=(ct+N)/2,Ct=(B+G)/2,R=(q+ut)/2,$=(at+Ct)/2;if(U>0){var _=S-L,H=x-X,lt=Math.abs((Y-S)*H-(et-x)*_),dt=Math.abs((A-S)*H-(w-x)*_),wt,Et;if(lt>h&&dt>h){if((lt+dt)*(lt+dt)<=z*(_*_+H*H)){if(y<p){P.push(s(R,$));return;}var Ot=Math.atan2(w-et,A-Y);if(wt=Math.abs(Ot-Math.atan2(et-X,Y-L)),Et=Math.abs(Math.atan2(x-w,S-A)-Ot),wt>=K&&(wt=2*K-wt),Et>=K&&(Et=2*K-Et),wt+Et<y){P.push(s(R,$));return;}if(C!==0){if(wt>C){P.push(s(Y,et));return;}if(Et>C){P.push(s(A,w));return;}}}}else if(lt>h){if(lt*lt<=z*(_*_+H*H)){if(y<p){P.push(s(R,$));return;}if(wt=Math.abs(Math.atan2(w-et,A-Y)-Math.atan2(et-X,Y-L)),wt>=K&&(wt=2*K-wt),wt<y){P.push(s(Y,et)),P.push(s(A,w));return;}if(C!==0&&wt>C){P.push(s(Y,et));return;}}}else if(dt>h){if(dt*dt<=z*(_*_+H*H)){if(y<p){P.push(s(R,$));return;}if(wt=Math.abs(Math.atan2(x-w,S-A)-Math.atan2(w-et,A-Y)),wt>=K&&(wt=2*K-wt),wt<y){P.push(s(Y,et)),P.push(s(A,w));return;}if(C!==0&&wt>C){P.push(s(A,w));return;}}}else if(_=R-(L+S)/2,H=$-(X+x)/2,_*_+H*H<=z){P.push(s(R,$));return;}}M(L,X,j,nt,q,at,R,$,P,z,U+1),M(R,$,ut,Ct,N,G,S,x,P,z,U+1);}}};},/* 66 *//***/function(e,n,i){i.r(n),i.d(n,"create",function(){return a;}),i.d(n,"clone",function(){return o;}),i.d(n,"copy",function(){return u;}),i.d(n,"scaleAndAdd",function(){return h;}),i.d(n,"dot",function(){return v;}),i.d(n,"rotate",function(){return p;}),i.d(n,"cross",function(){return y;}),i.d(n,"sub",function(){return C;}),i.d(n,"add",function(){return b;}),i.d(n,"computeMiter",function(){return Y;}),i.d(n,"normal",function(){return et;}),i.d(n,"direction",function(){return A;});var s=i(1);i(1).glMatrix.setMatrixArrayType(Array);function o(w){return[w[0],w[1]];}function a(){return[0,0];}var u=s.vec2.copy,h=s.vec2.scaleAndAdd,v=s.vec2.dot,p=s.vec2.rotate,y=s.vec2.cross,C=s.vec2.sub,b=s.vec2.add,M=s.vec2.normalize,L=s.vec2.set,X=a();function Y(w,S,x,P,z){b(w,x,P),M(w,w),L(S,-w[1],w[0]),L(X,-x[1],x[0]);var U=z/v(S,X);return Math.abs(U);}function et(w,S){return L(w,-S[1],S[0]),w;}function A(w,S,x){return C(w,S,x),M(w,w),w;}},/* 67 *//***/function(e,n,i){var s=i(68),o=i(69);e.exports=function(u,h){return u=s(u,h),u=o(u,h),u;},e.exports.radialDistance=s,e.exports.douglasPeucker=o;},/* 68 *//***/function(e,n){function i(s,o){var a=s[0]-o[0],u=s[1]-o[1];return a*a+u*u;}e.exports=function(o,a){if(o.length<=1)return o;a=typeof a=="number"?a:1;for(var u=a*a,h=o[0],v=[h],p,y=1,C=o.length;y<C;y++)p=o[y],i(p,h)>u&&(v.push(p),h=p);return h!==p&&v.push(p),v;};},/* 69 *//***/function(e,n){function i(o,a,u){var h=a[0],v=a[1],p=u[0]-h,y=u[1]-v;if(p!==0||y!==0){var C=((o[0]-h)*p+(o[1]-v)*y)/(p*p+y*y);C>1?(h=u[0],v=u[1]):C>0&&(h+=p*C,v+=y*C);}return p=o[0]-h,y=o[1]-v,p*p+y*y;}function s(o,a,u,h,v){for(var p=h,y,C=a+1;C<u;C++){var b=i(o[C],o[a],o[u]);b>p&&(y=C,p=b);}p>h&&(y-a>1&&s(o,a,y,h,v),v.push(o[y]),u-y>1&&s(o,y,u,h,v));}e.exports=function(a,u){if(a.length<=1)return a;u=typeof u=="number"?u:1;var h=u*u,v=a.length-1,p=[a[0]];return s(a,0,v,h,p),p.push(a[v]),p;};},/* 70 *//***/function(e,n,i){i.r(n),i.d(n,"getTotalLength",function(){return u;}),i.d(n,"getPointAtLength",function(){return v;}),i.d(n,"getDashContours",function(){return p;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(71);i(1).glMatrix.setMatrixArrayType(Array);function u(y){if(y.totalLength!=null)return y.totalLength;var C=0;return y.forEach(function(b){for(var M=b[0],L=1;L<b.length;L++){var X=b[L];C+=Object(a.distance)(M,X),M=X;}}),y.totalLength=C,C;}function h(y,C){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(C=Number(C),!Number.isFinite(C))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(C<=0)throw new TypeError("Length must > 0");var M=u(y);if(C>=M){var L=y[y.length-1],X=L[L.length-2],Y=L[L.length-1],et=Math.atan2(Y[1]-X[1],Y[0]-X[0]);return{current:y.map(function(N){return o()(N);}),point:{x:Y[0],y:Y[1],angle:et}};}for(var A=[],w=0;w<y.length;w++){A[w]=[];for(var S=y[w],x=S[0],P=1;P<S.length;P++){var z=S[P],U=Object(a.distance)(x,z);if(C<U){var K=C/U,j=Math.atan2(z[1]-x[1],z[0]-x[0]),nt={x:x[0]*(1-K)+z[0]*K,y:x[1]*(1-K)+z[1]*K,angle:j};if(A[w].push(x),C>0&&A[w].push([nt.x,nt.y]),!b)return{current:A,point:nt};for(var ct=[],B=w;w<y.length;w++){for(ct[w-B]=[],w===B&&ct[0].push([nt.x,nt.y]);P<S.length;P++)ct[w-B].push(S[P]);P=0;}return{current:A,point:nt,rest:ct};}C-=U,A[w].push(x),x=z;}}}function v(y,C){if(C=Number(C),!Number.isFinite(C))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(y.length<=0)return{x:0,y:0,angle:0};if(C<=0){var b=y[0][0],M=y[0][1],L=Math.atan2(M[1]-b[1],M[0]-b[0]);return{x:b[0],y:b[1],angle:L};}return h(y,C,!1).point;}function p(y,C,b){var M=0,L=C[0],X=y,Y=[],et=C.length;if(b>0){do b-=C[M%et],M++;while(b>0);b<0&&(L=-b,M--);}else if(b<0){M=-1;do b+=C[M%et+et-1],M--;while(b<0);b>=0&&(M++,L=C[M%et+et-1]-b);}do{var A=h(X,L);X=A.rest,++M%2&&Y.push.apply(Y,o()(A.current));var w=M%et;w<0&&(w+=et),L=C[w];}while(X);return Y;}},/* 71 *//***/function(e,n,i){i.r(n),i.d(n,"normalize",function(){return a;}),i.d(n,"distance",function(){return u;});var s=i(13),o=/* @__PURE__ */i.n(s);i(1).glMatrix.setMatrixArrayType(Array);function a(h,v,p,y){var C=o()(h,3),b=C[0],M=C[1],L=C[2];return b=b*2/v-1,M=1-M*2/p,Number.isFinite(y)?(L=L*2/y-1,[b,M,L]):[b,M];}function u(h,v){var p=o()(h,3),y=p[0],C=p[1],b=p[2],M=b===void 0?0:b,L=o()(v,3),X=L[0],Y=L[1],et=L[2],A=et===void 0?0:et;return Math.hypot(X-y,Y-C,A-M);}},/* 72 *//***/function(e,n,i){i.r(n),i.d(n,"getPoint",function(){return o;}),i(1).glMatrix.setMatrixArrayType(Array);var s=Math.PI*2;function o(a,u,h,v,p){p%=s,p<0&&(p+=s);var y=Math.tan(p);if(Math.abs(y)<1e5){var C=u-y*a,b=1/Math.pow(h,2)+Math.pow(y,2)/Math.pow(v,2),M=-1;(p<=Math.PI/2||p>3*Math.PI/2)&&(M=1);var L=M*Math.sqrt(1/b)+a,X=y*L+C;return[L,X];}return p<Math.PI?[a,u+v]:[a,u-v];}},/* 73 *//***/function(e,n,i){i.r(n),i.d(n,"default",function(){return st;});var s=i(74),o=/* @__PURE__ */i.n(s),a=i(19),u=/* @__PURE__ */i.n(a),h=i(23),v=/* @__PURE__ */i.n(h),p=i(24),y=/* @__PURE__ */i.n(p),C=i(13),b=/* @__PURE__ */i.n(C),M=i(1),L=i(59),X=/* @__PURE__ */i.n(L),Y=i(76),et=i(44),A=i(40),w=i(46),S=i(78),x=i(70),P=i(79),z=/* @__PURE__ */i.n(P),U=i(63),K=/* @__PURE__ */i.n(U),j=i(47),nt=i(56),ct=i(37);i(1).glMatrix.setMatrixArrayType(Array);var B=Symbol("mesh"),N=Symbol("contours"),G=Symbol("stroke"),q=Symbol("fill"),at=Symbol("strokeColor"),ut=Symbol("fillColor"),Ct=Symbol("transform"),R=Symbol("invertTransform"),$=Symbol("uniforms"),_=Symbol("texOptions"),H=Symbol("blend"),lt=Symbol("applyTexture"),dt=Symbol("applyTransform"),wt=Symbol("applyGradientTransform"),Et=Symbol("applyProgram"),Ot=Symbol("gradient"),O=Symbol("filter"),D=Symbol("opacity"),J=Symbol("program"),Q=Symbol("attributes"),V=Symbol("pass"),tt=Symbol("clipContext"),g=Symbol("applyClipPath");function T(ft,pt){for(var ot=ft[1][0]-ft[0][0],mt=ft[1][1]-ft[0][1],It=[],Pt=0;Pt<pt.length;Pt++){var Lt=pt[Pt],Dt=[(Lt[0]-ft[0][0])/ot,1-(Lt[1]-ft[0][1])/mt];It.push(Dt);}return It;}function k(ft,pt,ot){var mt=b()(ft,2),It=mt[0],Pt=mt[1],Lt=b()(pt,4),Dt=Lt[0],Nt=Lt[1],Yt=Lt[2],Ut=Lt[3],Ft=ot.scale;return Ft||(It/=Yt,Pt=1-Pt/Ut,It-=Dt,Pt+=Nt),[It,Pt,0];}function Z(ft,pt,ot){var mt=K()(ft,pt,ot);return mt.path=ft,mt.simplify=ot,mt.scale=pt,mt;}var st=/* @__PURE__ */function(){function ft(pt){v()(this,ft),this[G]=null,this[q]=null,this[Ct]=[1,0,0,1,0,0],this[D]=1,this[$]={},this[O]=[],this[H]=null,this[_]={},this.contours=pt.contours,this[J]=null,this[Q]={},this[V]=[];}return y()(ft,[{key:"setProgram",value:function value(ot){this[J]=ot,this[B]&&this[Et](ot);}},{key:"setAttribute",value:function value(ot,mt){mt==null?delete this[Q][ot]:this[Q][ot]=mt;}},{key:"getOpacity",value:function value(){return this[D];}},{key:"setOpacity",value:function value(ot){if(ot<0||ot>1)throw new TypeError("Invalid opacity value.");this[B]&&this[B].positions.forEach(function(mt){mt[2]=1/mt[2]>0?ot:-ot;}),this[D]=ot;}},{key:"setClipPath",value:function value(ot){this.clipPath=ot,this[$].u_clipSampler&&this[$].u_clipSampler.delete(),this.setUniforms({u_clipSampler:null}),this[B]&&delete this[B].attributes.a_clipUV,ot&&this[B]&&this[g]();}},{key:g,value:function value(){if(this.clipPath){this[tt]||(this[tt]=ct.default.createCanvas(1,1));var ot=b()(this.boundingBox,2),mt=b()(ot[0],2),It=mt[0],Pt=mt[1],Lt=b()(ot[1],2),Dt=Lt[0],Nt=Lt[1];Dt&&Nt&&(this[tt].width=Dt-It,this[tt].height=Nt-Pt);var Yt=this[tt].getContext("2d"),Ut=new Path2D(this.clipPath);Yt.clearRect(0,0,this[tt].width,this[tt].height),Yt.save(),Yt.translate(-It,-Pt),Yt.fillStyle="white",Yt.fill(Ut),Yt.restore(),this[B].clipPath=this[tt];var Ft=T(this.boundingBox,this[B].position0);this[B].attributes.a_clipUV=Ft;}}},{key:"getPointAtLength",value:function value(ot){return Object(x.getPointAtLength)(this[N],ot);}},{key:"getTotalLength",value:function value(){return Object(x.getTotalLength)(this[N]);}},{key:Et,value:function value(ot){for(var mt=this[Q],It=this[B].position0,Pt=Object.entries(ot._attribute),Lt=0;Lt<Pt.length;Lt++){var Dt=b()(Pt[Lt],2),Nt=Dt[0],Yt=Dt[1];if(Nt!=="a_color"&&Nt!=="a_sourceRect"&&Yt!=="ignored"){var Ut=mt[Nt];if(Nt==="uv"&&!Ut){var Ft=this[B].boundingBox||X()(It);this[B].attributes[Nt]=T(Ft,It);}else{this[B].attributes[Nt]=[];for(var Jt=0;Jt<It.length;Jt++){var ee=It[Jt];this[B].attributes[Nt].push(Ut?Ut(ee,Lt,It):Array(Yt.size).fill(0));}}}}}// {stroke, fill}
|
|
37
|
+
},{key:dt,value:function value(ot,mt){for(var It=ot.positions,Pt=ot.position0,Lt=0;Lt<It.length;Lt++){var Dt=b()(Pt[Lt],2),Nt=Dt[0],Yt=Dt[1],Ut=It[Lt];Ut[0]=Nt*mt[0]+Yt*mt[2]+mt[4],Ut[1]=Nt*mt[1]+Yt*mt[3]+mt[5];}this._updateMatrix=!1;}},{key:wt,value:function value(){var ot=this[Ct],mt=u()(this._radialGradientVector);if(mt){var It=b()(mt,5),Pt=It[0],Lt=It[1],Dt=It[3],Nt=It[4];mt[0]=Pt*ot[0]+Lt*ot[2]+ot[4],mt[1]=Pt*ot[1]+Lt*ot[3]+ot[5],mt[3]=Dt*ot[0]+Nt*ot[2]+ot[4],mt[4]=Dt*ot[1]+Nt*ot[3]+ot[5],this[$].u_radialGradientVector=mt;}}},{key:lt,value:function value(ot,mt){function It(ee,re){return ee==null&&re==null?!0:ee==null||re==null?!1:ee[0]===re[0]&&ee[1]===re[1]&&ee[2]===re[2]&&ee[3]===re[3];}var Pt=this[$].u_texSampler;if(Pt){var Lt=Pt._img,Dt=Lt.width,Nt=Lt.height,Yt=mt.srcRect,Ut=mt.rect||[0,0];if(mt.rotated&&(Ut=[-Ut[1],Ut[0],Ut[3],Ut[2]]),Ut[2]==null&&(Ut[2]=Yt?Yt[2]:Dt),Ut[3]==null&&(Ut[3]=Yt?Yt[3]:Nt),mt.hidden)ot.textureCoord=ot.positions.map(function(){return[-1,-1,-1];});else if(!ot.textureCoord||!It(this[_].rect,mt.rect)||this[_].hidden!==mt.hidden||this[_].rotated!==mt.rotated){var Ft=null;mt.rotated&&(Ft=M.mat2d.rotate(Array.of(0,0,0,0,0,0),M.mat2d.fromValues(1,0,0,1,0,0),0.5*Math.PI),Ft=M.mat2d.translate(Array.of(0,0,0,0,0,0),Ft,[0,-Ut[2]])),ot.textureCoord=ot.position0.map(function(ee){var re=b()(ee,3),se=re[0],oe=re[1],le=re[2];if(1/le>0){if(mt.rotated){var Re=se*Ft[0]+oe*Ft[2]+Ft[4],Oe=se*Ft[1]+oe*Ft[3]+Ft[5];se=Re,oe=Oe;}var ke=k([se,oe],[Ut[0]/Ut[2],Ut[1]/Ut[3],Ut[2],Ut[3]],mt);return mt.repeat&&(ke[2]=1),ke;}return[-1,-1,-1];});}if(Yt){var Jt=[Yt[0]/Dt,Yt[1]/Nt,Yt[2]/Dt,Yt[3]/Nt];ot.attributes.a_sourceRect=ot.positions.map(function(){return[].concat(Jt);});}else ot.attributes.a_sourceRect=ot.positions.map(function(){return[0,0,0,0];});}}},{key:"accurate",value:function value(ot){if(this.contours){var mt=this.contours.path;if(mt){var It=this.contours.simplify,Pt=Z(this.contours.path,2*ot,It);this[B]=null,this[N]=Pt;}}}},{key:"canIgnore",value:function value(){var ot=this[G]==null||this[G].lineWidth===0||this[at][3]===0,mt=this[q]==null||this[ut][3]===0,It=this[$].u_radialGradientVector==null,Pt=this[$].u_texSampler==null;return this[D]===0||this[J]==null&&ot&&mt&&It&&Pt&&!this.beforeRender&&!this.afterRender;}// join: 'miter' or 'bevel'
|
|
38
38
|
// cap: 'butt' or 'square'
|
|
39
39
|
// lineDash: null
|
|
40
40
|
// lineDashOffset: 0
|
|
41
|
-
},{key:"setStroke",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.thickness,
|
|
41
|
+
},{key:"setStroke",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.thickness,It=mt===void 0?1:mt,Pt=ot.cap,Lt=Pt===void 0?"butt":Pt,Dt=ot.join,Nt=Dt===void 0?"miter":Dt,Yt=ot.miterLimit,Ut=Yt===void 0?10:Yt,Ft=ot.color,Jt=Ft===void 0?[0,0,0,0]:Ft,ee=ot.lineDash,re=ee===void 0?null:ee,se=ot.lineDashOffset,oe=se===void 0?0:se,le=ot.roundSegments,Re=le===void 0?20:le;return this[B]=null,this[G]=new Y.default({lineWidth:It,lineCap:Lt,lineJoin:Nt,miterLimit:Ut,roundSegments:Re}),typeof Jt=="string"&&(Jt=Object(j.default)(Jt)),this[at]=Jt,this[G].lineDash=re,this[G].lineDashOffset=oe,this;}},{key:"setFill",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.rule,It=mt===void 0?this.fillRule:mt,Pt=ot.color,Lt=Pt===void 0?[0,0,0,0]:Pt;return this[B]=null,this[q]={rule:It},typeof Lt=="string"&&(Lt=Object(j.default)(Lt)),this[ut]=Lt,this;}/**
|
|
42
42
|
options: {
|
|
43
43
|
scale: false,
|
|
44
44
|
repeat: false,
|
|
@@ -47,13 +47,13 @@ e.exports);try{regeneratorRuntime=s;}catch(_unused2){Function("r","regeneratorRu
|
|
|
47
47
|
srcRect: [...],
|
|
48
48
|
hidden: false,
|
|
49
49
|
}
|
|
50
|
-
*/},{key:"setTexture",value:function value(ot){var mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ot&&ot.image){var
|
|
50
|
+
*/},{key:"setTexture",value:function value(ot){var mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ot&&ot.image){var It=ot,Pt=It.image,Lt=It.rect;if(ot=Pt,mt.rect)for(var Dt=0;Dt<mt.rect.length;Dt++)Lt[Dt]=mt.rect[Dt];mt.rect=Lt;}return this[q]||this.setFill(),this.setUniforms({u_texSampler:ot}),this[B]&&this[lt](this[B],mt),this[_]=mt,this;}},{key:"setCircularGradient",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.vector,It=ot.colors,Pt=ot.type,Lt=Pt===void 0?"fill":Pt;if(mt.length!==3)throw new TypeError("Invalid linearGradient.");this.setGradient({vector:mt,colors:It,type:Lt});}},{key:"setLinearGradient",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.vector,It=ot.colors,Pt=ot.type,Lt=Pt===void 0?"fill":Pt;if(mt.length!==4)throw new TypeError("Invalid linearGradient.");this.setGradient({vector:mt,colors:It,type:Lt});}},{key:"setRadialGradient",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.vector,It=ot.colors,Pt=ot.type,Lt=Pt===void 0?"fill":Pt;if(mt.length!==6)throw new TypeError("Invalid radialGradient.");this.setGradient({vector:mt,colors:It,type:Lt});}/**
|
|
51
51
|
vector: [x0, y0, r0, x1, y1, r1],
|
|
52
52
|
colors: [{offset:0, color}, {offset:1, color}, ...],
|
|
53
|
-
*/},{key:"setGradient",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.vector,
|
|
54
|
-
},{key:"transformColor",value:function value(){for(var ot=this.uniforms.u_colorMatrix,mt=arguments.length,
|
|
55
|
-
},{key:"hueRotate",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this[O].push("hue-rotate(".concat(ot,"deg)")),this.transformColor.apply(this,u()(Object(w.hueRotate)(ot)));}},{key:"invert",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("invert(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.invert)(ot)));}},{key:"opacity",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("opacity(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.opacity)(ot)));}},{key:"saturate",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("saturate(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.saturate)(ot)));}},{key:"sepia",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("sepia(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.sepia)(ot)));}},{key:"url",value:function value(ot){return this[O].push("url(".concat(ot,")")),this;}},{key:"isPointCollision",value:function value(ot,mt){var
|
|
56
|
-
},Pt.fill=Lt;}catch(_unused5){}if(this[G]){var Dt=this[G].lineDash,Nt=
|
|
53
|
+
*/},{key:"setGradient",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},mt=ot.vector,It=ot.colors,Pt=ot.type,Lt=Pt===void 0?"fill":Pt;It=It.map(function(Yt){var Ut=Yt.offset,Ft=Yt.color;return typeof Ft=="string"&&(Ft=Object(j.default)(Ft)),{offset:Ut,color:Ft};}),this[Ot]=this[Ot]||{},this[Ot][Lt]={vector:mt,colors:It},It.sort(function(Yt,Ut){return Yt.offset-Ut.offset;});var Dt=[];It.forEach(function(Yt){var Ut=Yt.offset,Ft=Yt.color;Dt.push.apply(Dt,[Ut].concat(u()(Ft)));});var Nt;if(mt.length===4?Nt=[mt[0],mt[1],0,mt[2],mt[3],0]:Nt=u()(mt),Dt.length<40&&Dt.push(-1),Dt.length>40)throw new Error("Too many colors, should be less than 8 colors");return this._radialGradientVector=Nt,this[$].u_colorSteps=Dt,Lt==="fill"?this[$].u_gradientType=1:this[$].u_gradientType=0,this[wt](),this;}},{key:"setUniforms",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.assign(this[$],ot),this;}},{key:"setTransform",value:function value(){for(var ot=this[Ct],mt=arguments.length,It=new Array(mt),Pt=0;Pt<mt;Pt++)It[Pt]=arguments[Pt];return M.mat2d.equals(It,ot)||(this[Ct]=It,delete this[R],this._updateMatrix=!0),this;}},{key:"transform",value:function value(){for(var ot=this[Ct],mt=arguments.length,It=new Array(mt),Pt=0;Pt<mt;Pt++)It[Pt]=arguments[Pt];return this[Ct]=M.mat2d.multiply(Array.of(0,0,0,0,0,0),ot,It),delete this[R],this._updateMatrix=!0,this;}},{key:"translate",value:function value(ot,mt){var It=M.mat2d.create();return It=M.mat2d.translate(Array.of(0,0,0,0,0,0),It,[ot,mt]),this.transform.apply(this,u()(It));}},{key:"rotate",value:function value(ot){var mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0],It=b()(mt,2),Pt=It[0],Lt=It[1],Dt=M.mat2d.create();return Dt=M.mat2d.translate(Array.of(0,0,0,0,0,0),Dt,[Pt,Lt]),Dt=M.mat2d.rotate(Array.of(0,0,0,0,0,0),Dt,ot),Dt=M.mat2d.translate(Array.of(0,0,0,0,0,0),Dt,[-Pt,-Lt]),this.transform.apply(this,u()(Dt));}},{key:"scale",value:function value(ot){var mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ot,It=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],Pt=b()(It,2),Lt=Pt[0],Dt=Pt[1],Nt=M.mat2d.create();return Nt=M.mat2d.translate(Array.of(0,0,0,0,0,0),Nt,[Lt,Dt]),Nt=M.mat2d.scale(Array.of(0,0,0,0,0,0),Nt,[ot,mt]),Nt=M.mat2d.translate(Array.of(0,0,0,0,0,0),Nt,[-Lt,-Dt]),this.transform.apply(this,u()(Nt));}},{key:"skew",value:function value(ot){var mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ot,It=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[0,0],Pt=b()(It,2),Lt=Pt[0],Dt=Pt[1],Nt=M.mat2d.create();return Nt=M.mat2d.translate(Array.of(0,0,0,0,0,0),Nt,[Lt,Dt]),Nt=M.mat2d.multiply(Array.of(0,0,0,0,0,0),Nt,M.mat2d.fromValues(1,Math.tan(mt),Math.tan(ot),1,0,0)),Nt=M.mat2d.translate(Array.of(0,0,0,0,0,0),Nt,[-Lt,-Dt]),this.transform.apply(this,u()(Nt));}},{key:"clearFilter",value:function value(){return this.setColorTransform(null),this[O].length=0,this;}},{key:"setColorTransform",value:function value(){for(var ot=arguments.length,mt=new Array(ot),It=0;It<ot;It++)mt[It]=arguments[It];return mt[0]===null?this.setUniforms({u_filterFlag:0,u_colorMatrix:0}):this.setUniforms({u_filterFlag:1,u_colorMatrix:mt}),this;}// apply linear color transform
|
|
54
|
+
},{key:"transformColor",value:function value(){for(var ot=this.uniforms.u_colorMatrix,mt=arguments.length,It=new Array(mt),Pt=0;Pt<mt;Pt++)It[Pt]=arguments[Pt];return ot?ot=Object(w.multiply)(ot,It):ot=It,this.setColorTransform.apply(this,u()(ot)),this;}},{key:"blur",value:function value(ot){return this[O].push("blur(".concat(ot,"px)")),this;}},{key:"brightness",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("brightness(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.brightness)(ot)));}},{key:"contrast",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("contrast(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.contrast)(ot)));}},{key:"dropShadow",value:function value(ot,mt){var It=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,Pt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[0,0,0,1];return Array.isArray(Pt)&&(Pt=Object(A.default)(Pt)),this[O].push("drop-shadow(".concat(ot,"px ").concat(mt,"px ").concat(It,"px ").concat(Pt,")")),this;}},{key:"grayscale",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("grayscale(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.grayscale)(ot)));}// https://github.com/phoboslab/WebGLImageFilter/blob/master/webgl-image-filter.js#L371
|
|
55
|
+
},{key:"hueRotate",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this[O].push("hue-rotate(".concat(ot,"deg)")),this.transformColor.apply(this,u()(Object(w.hueRotate)(ot)));}},{key:"invert",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("invert(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.invert)(ot)));}},{key:"opacity",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("opacity(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.opacity)(ot)));}},{key:"saturate",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("saturate(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.saturate)(ot)));}},{key:"sepia",value:function value(){var ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this[O].push("sepia(".concat(100*ot,"%)")),this.transformColor.apply(this,u()(Object(w.sepia)(ot)));}},{key:"url",value:function value(ot){return this[O].push("url(".concat(ot,")")),this;}},{key:"isPointCollision",value:function value(ot,mt){var It=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"both",Pt=this.meshData,Lt=Pt.positions,Dt=Pt.cells,Nt=this.invertMatrix,Yt=Nt[0]*ot+Nt[2]*mt+Nt[4],Ut=Nt[1]*ot+Nt[3]*mt+Nt[5],Ft=this.boundingBox;if(Yt<Ft[0][0]||Yt>Ft[1][0]||Ut<Ft[0][1]||Ut>Ft[1][1])return!1;function Jt(Gn,jn,Qo){var Li=b()(Gn,2),Jo=Li[0],_o=Li[1],Ks=b()(jn,2),Qs=Ks[0],Js=Ks[1],cs=b()(Qo,2),ta=cs[0],ea=cs[1],An=ta-Qs,us=ea-Js,_s=((Jo-Qs)*An+(_o-Js)*us)/(Math.pow(An,2)+Math.pow(us,2));return _s>=0&&_s<=1;}for(var ee=0;ee<Dt.length;ee++){var re=Dt[ee];if(It==="fill"&&re[0]>=Pt.fillPointCount)break;if(!(It==="stroke"&&re[0]<Pt.fillPointCount)){var se=re.map(function(Gn){return Lt[Gn];}),oe=b()(se,3),le=b()(oe[0],2),Re=le[0],Oe=le[1],ke=b()(oe[1],2),Be=ke[0],Ge=ke[1],He=b()(oe[2],2),je=He[0],ye=He[1],lr=Math.sign((ot-Re)*(Ge-Oe)-(Be-Re)*(mt-Oe));if(lr===0&&Jt([ot,mt],[Re,Oe],[Be,Ge]))return!0;var en=Math.sign((ot-Be)*(ye-Ge)-(je-Be)*(mt-Ge));if(en===0&&Jt([ot,mt],[Be,Ge],[je,ye]))return!0;var rn=Math.sign((ot-je)*(Oe-ye)-(Re-je)*(mt-ye));if(rn===0&&Jt([ot,mt],[je,ye],[Re,Oe])||lr===1&&en===1&&rn===1||lr===-1&&en===-1&&rn===-1)return!0;}}return!1;}},{key:"isPointInFill",value:function value(ot,mt){return this.isPointCollision(ot,mt,"fill");}},{key:"isPointInStroke",value:function value(ot,mt){return this.isPointCollision(ot,mt,"stroke");}},{key:"addPass",value:function value(ot){var mt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},It=mt.width,Pt=mt.height,Lt=o()(mt,["width","height"]),Dt=new nt.default();Dt.rect(0,0,It,Pt);var Nt=new ft(Dt);Nt.setUniforms(Lt),Nt.setProgram(ot),this[V].push(Nt);}},{key:"contours",get:function get(){return this[N];},set:function set(ot){this[B]=null,this[N]=ot;var mt=ot.scale,It=this.transformScale/mt;It>1.5&&this.accurate(this.transformScale);}},{key:"program",get:function get(){return this[J];}},{key:"blend",get:function get(){return this[H]==null?"auto":this[H];},set:function set(ot){this[H]=ot,this[B]&&(this[B].enableBlend=this.enableBlend);}},{key:"boundingBox",get:function get(){if(this[B]&&this[B].boundingBox)return this[B].boundingBox;var ot=this.meshData;if(ot){var mt=ot.position0;if(mt.length)ot.boundingBox=X()(mt);else return[[0,0],[0,0]];return ot.boundingBox;}return[[0,0],[0,0]];}},{key:"boundingCenter",get:function get(){var ot=this.boundingBox;return ot?[0.5*(ot[0][0]+ot[1][0]),0.5*(ot[0][1]+ot[1][1])]:[0,0];}},{key:"fillRule",get:function get(){return this[q]?this[q].rule:"nonzero";}},{key:"lineWidth",get:function get(){return this[G]?this[G].lineWidth:0;}},{key:"lineCap",get:function get(){return this[G]?this[G].lineCap:"";}},{key:"lineJoin",get:function get(){return this[G]?this[G].lineJoin:"";}},{key:"miterLimit",get:function get(){return this[G]?this[G].miterLimit:0;}},{key:"strokeStyle",get:function get(){return this[at]&&this[at][3]!==0?Object(A.default)(this[at]):"";}},{key:"lineDash",get:function get(){return this[G]?this[G].lineDash:null;}},{key:"lineDashOffset",get:function get(){return this[G]?this[G].lineDashOffset:0;}},{key:"fillStyle",get:function get(){return this[ut]&&this[ut][3]!==0?Object(A.default)(this[ut]):"";}},{key:"gradient",get:function get(){return this[Ot];}},{key:"texture",get:function get(){return this[$].u_texSampler?{image:this[$].u_texSampler._img,options:this[_]}:null;}},{key:"enableBlend",get:function get(){return this[H]===!0||this[H]===!1?this[H]:this[D]<1||this[at]!=null&&this[at][3]<1||this[ut]!=null&&this[ut][3]<1||this[$].u_colorMatrix!=null&&this[$].u_colorMatrix[18]<1||this[$].u_radialGradientVector!=null||this.beforeRender||this.afterRender;}},{key:"filterCanvas",get:function get(){return /blur|drop-shadow|url/.test(this.filter);}},{key:"filter",get:function get(){return this[O].join(" ");}},{key:"transformMatrix",get:function get(){return this[Ct];}},{key:"invertMatrix",get:function get(){if(!this[R]){var ot=M.mat2d.invert(Array.of(0,0,0,0,0,0),this[Ct]);this[R]=ot;}return this[R];}},{key:"transformScale",get:function get(){var ot=this[Ct];return Math.max(Math.hypot(ot[0],ot[1]),Math.hypot(ot[2],ot[3]));}},{key:"uniforms",get:function get(){return this[$];}},{key:"pass",get:function get(){return this[V];}},{key:"meshData",get:function get(){var ot=this;if(this._updateMatrix){var mt=this.transformScale/this.contours.scale;mt>1.5&&this.accurate(this.transformScale);}if(!this[B]){!this[q]&&!this[G]&&this.setFill();var It=this[N],Pt={};if(It&&It.length){if(this[q])try{var Lt=z()(It,this[q]);Lt.positions=Lt.positions.map(function(ee){return ee.push(ot[D]),ee;}),Lt.attributes={a_color:Array.from({length:Lt.positions.length}).map(function(){return ot[ut].map(function(ee){return Math.round(255*ee);});})// a_sourceRect: Array.from({length: mesh.positions.length}).map(() => [0, 0, 0, 0]),
|
|
56
|
+
},Pt.fill=Lt;}catch(_unused5){}if(this[G]){var Dt=this[G].lineDash,Nt=It;if(Dt){var Yt=this[G].lineDashOffset;Nt=Object(x.getDashContours)(It,Dt,Yt);}var Ut=Nt.map(function(ee,re){var se=ee.length>1&&M.vec2.equals(ee[0],ee[ee.length-1]),oe=ot[G].build(ee,se);return z()([oe]);});Ut.forEach(function(ee){ee.positions=ee.positions.map(function(re){return re.push(-ot[D]),re;}),ee.attributes={a_color:Array.from({length:ee.positions.length}).map(function(){return ot[at].map(function(re){return Math.round(255*re);});})};}),Pt.stroke=Object(et.default)(Ut);}}var Ft=Object(et.default)([Pt.fill,Pt.stroke]);Ft.fillPointCount=Pt.fill?Pt.fill.positions.length:0,Ft.enableBlend=this.enableBlend,Ft.position0=Ft.positions.map(function(ee){var re=b()(ee,3),se=re[0],oe=re[1],le=re[2];return[se,oe,le];}),Ft.uniforms=this[$],this[B]=Ft,this[$].u_texSampler&&this[lt](Ft,this[_]);var Jt=this[Ct];Object(S.isUnitTransform)(Jt)||(this[dt](Ft,Jt),this[$].u_radialGradientVector&&this[wt]()),this.clipPath&&this[g](),this[J]&&this[Et](this[J]);}return this._updateMatrix&&(this[B].matrix=this[Ct],this[dt](this[B],this[Ct]),this[$].u_radialGradientVector&&this[wt]()),this[B];}}]),ft;}();},/* 74 *//***/function(e,n,i){var s=i(75);function o(a,u){if(a==null)return{};var h=s(a,u),v,p;if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(a);for(p=0;p<y.length;p++)v=y[p],!(u.indexOf(v)>=0)&&Object.prototype.propertyIsEnumerable.call(a,v)&&(h[v]=a[v]);}return h;}e.exports=o;},/* 75 *//***/function(e,n){function i(s,o){if(s==null)return{};var a={},u=Object.keys(s),h,v;for(v=0;v<u.length;v++)h=u[v],!(o.indexOf(h)>=0)&&(a[h]=s[h]);return a;}e.exports=i;},/* 76 *//***/function(e,n,i){i.r(n);var s=i(77);i(1).glMatrix.setMatrixArrayType(Array),n.default=s.Stroke;},/* 77 *//***/function(e,n,i){i.r(n),i.d(n,"Stroke",function(){return Y;});var s=i(19),o=/* @__PURE__ */i.n(s),a=i(23),u=/* @__PURE__ */i.n(a),h=i(24),v=/* @__PURE__ */i.n(h),p=i(66);i(1).glMatrix.setMatrixArrayType(Array);var y=Object(p.create)(),C=Object(p.create)(),b=Object(p.create)(),M=Object(p.create)(),L=Object(p.create)(),X=1e20,Y=/* @__PURE__ */function(){function S(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},P=x.lineWidth,z=P===void 0?1:P,U=x.lineJoin,K=U===void 0?"miter":U,j=x.miterLimit,nt=j===void 0?10:j,ct=x.lineCap,B=ct===void 0?"butt":ct,N=x.roundSegments,G=N===void 0?20:N;u()(this,S),this.lineWidth=z,this.lineJoin=K,this.miterLimit=nt,this.lineCap=B,this.roundSegments=G,this._normal=null;}return v()(S,[{key:"build",value:function value(P){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,U=P.length;if(P=o()(P),U<2)return P;z&&((P[0][0]!==P[U-1][0]||P[0][1]!==P[U-1][1])&&P.push(o()(P[0])),P.push(o()(P[1]))),U=P.length,this._normal=null;var K={left:[],right:[]},j=this.lineWidth/2,nt=this.lineCap;if(!z&&nt==="square"){Object(p.direction)(C,P[0],P[1]),Object(p.scaleAndAdd)(P[0],P[0],C,j);var ct=P.length-1;Object(p.direction)(C,P[ct],P[ct-1]),Object(p.scaleAndAdd)(P[ct],P[ct],C,j);}for(var B=1;B<U;B++){var N=P[B-1],G=P[B],q=P[B+1];this._seg(K,N,G,q,j,z);}!z&&nt==="round"&&w(K,this.roundSegments);var at=[].concat(o()(K.left),o()(K.right.reverse()));return at;}},{key:"_seg",value:function value(P,z,U,K,j,nt){var ct=this.lineJoin==="bevel",B=this.lineJoin==="round";if(Object(p.direction)(C,U,z),this._normal||(this._normal=Object(p.create)(),Object(p.normal)(this._normal,C)),P.left.length||A(P,z,this._normal,j),!K)Object(p.normal)(this._normal,C),nt?A(P,z,this._normal,j):A(P,U,this._normal,j);else{Object(p.direction)(b,K,U);var N=Object(p.computeMiter)(M,L,C,b,j);N=Math.min(N,X);var G=Object(p.dot)(M,this._normal)<0?-1:1,q=ct||B;if(!q&&this.lineJoin==="miter"){var at=N/j;at>this.miterLimit&&(q=!0);}if(q){Object(p.scaleAndAdd)(y,U,this._normal,-j*G),et(P,y,G);var ut=1/0;z&&(ut=Math.min(ut,Math.hypot(U[0]-z[0],U[1]-z[1]))),K&&(ut=Math.min(ut,Math.hypot(K[0]-U[0],K[1]-U[1])));var Ct=Math.max(j,Math.min(N,ut));if(Object(p.scaleAndAdd)(y,U,L,Ct*G),et(P,y,-G),K)if(Object(p.normal)(y,b),Object(p.copy)(this._normal,y),Object(p.scaleAndAdd)(y,U,y,-j*G),B){for(var R=Object(p.clone)(y),$=G>0?P.left[P.left.length-1]:P.right[P.right.length-1],_=Object(p.clone)(U),H=Object(p.sub)(Object(p.create)(),$,_),lt=Object(p.sub)(Object(p.create)(),R,_),dt=Math.PI/this.roundSegments,wt=0;wt<this.roundSegments&&(Object(p.rotate)(H,H,[0,0],G*dt),Math.sign(Object(p.cross)(y,H,lt)[2])===G);wt++)Object(p.add)(y,H,_),et(P,y,G);et(P,R,G);}else et(P,y,G);}else A(P,U,L,N),Object(p.copy)(this._normal,L);}}}]),S;}();function et(S,x,P){P>0?S.left.push(Object(p.clone)(x)):S.right.push(Object(p.clone)(x));}function A(S,x,P,z){var U=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;Object(p.scaleAndAdd)(y,x,P,-z),et(S,y,-U),Object(p.scaleAndAdd)(y,x,P,z),et(S,y,U);}function w(S,x){var P=S.left,z=S.right,U=Object(p.create)(),K=Object(p.create)(),j=P[0],nt=z[0],ct=[0.5*(j[0]+nt[0]),0.5*(j[1]+nt[1])];Object(p.sub)(K,j,ct);for(var B=1;B<=x;B++){var N=-1*Math.PI*B/x;Object(p.rotate)(U,K,[0,0],N),Object(p.add)(y,ct,U),P.unshift(Object(p.clone)(y));}j=z[z.length-1],nt=P[P.length-1],ct=[0.5*(j[0]+nt[0]),0.5*(j[1]+nt[1])],Object(p.sub)(K,j,ct);for(var G=1;G<=x;G++){var q=-1*Math.PI*G/x;Object(p.rotate)(U,K,[0,0],q),Object(p.add)(y,ct,U),z.push(Object(p.clone)(y));}}},/* 78 *//***/function(e,n,i){i.r(n),i.d(n,"isUnitTransform",function(){return s;}),i(1).glMatrix.setMatrixArrayType(Array);function s(o){return o[0]===1&&o[1]===0&&o[2]===0&&o[3]===1&&o[4]===0&&o[5]===0;}},/* 79 *//***/function(e,n,i){i(1).glMatrix.setMatrixArrayType(Array);var s=i(80),o=i(81);e.exports=function(a,u){if(u=u||{},a=a.filter(function(Y){return Y.length>2;}),a.length===0)return{positions:[],cells:[]};typeof u.vertexSize!="number"&&(u.vertexSize=a[0][0].length),a=a.map(function(Y){return Y.reduce(function(et,A){return et.concat(A);});});for(var h=u.rule==="evenodd"?s.WINDING_ODD:s.WINDING_NONZERO,v=s.tesselate(o({contours:a,windingRule:h,elementType:s.POLYGONS,polySize:3,vertexSize:2},u)),p=[],y=0;y<v.vertices.length;y+=u.vertexSize){var C=v.vertices.slice(y,y+u.vertexSize);p.push(C);}var b=[];for(y=0;y<v.elements.length;y+=3){var M=v.elements[y],L=v.elements[y+1],X=v.elements[y+2];b.push([M,L,X]);}return{positions:p,cells:b};};},/* 80 *//***/function(e,n,i){i(1).glMatrix.setMatrixArrayType(Array);var s={},o={};e.exports=s,s.WINDING_ODD=0,s.WINDING_NONZERO=1,s.WINDING_POSITIVE=2,s.WINDING_NEGATIVE=3,s.WINDING_ABS_GEQ_TWO=4,s.POLYGONS=0,s.CONNECTED_POLYGONS=1,s.BOUNDARY_CONTOURS=2,s.tesselate=function(A){for(var w=A.debug||!1,S=new et(),x=0;x<A.contours.length;x++)S.addContour(A.vertexSize||2,A.contours[x]);return S.tesselate(A.windingRule||s.WINDING_ODD,A.elementType||s.POLYGONS,A.polySize||3,A.vertexSize||2,A.normal||[0,0,1]),{vertices:S.vertices,vertexIndices:S.vertexIndices,vertexCount:S.vertexCount,elements:S.elements,elementCount:S.elementCount,mesh:w?S.mesh:void 0};};var a=function a(w){if(!w)throw"Assertion Failed!";};function u(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0;}function h(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1;}function v(A){this.next=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Org=null,this.Lface=null,this.activeRegion=null,this.winding=0,this.side=A;}v.prototype={get Rface(){return this.Sym.Lface;},set Rface(A){this.Sym.Lface=A;},get Dst(){return this.Sym.Org;},set Dst(A){this.Sym.Org=A;},get Oprev(){return this.Sym.Lnext;},set Oprev(A){this.Sym.Lnext=A;},get Lprev(){return this.Onext.Sym;},set Lprev(A){this.Onext.Sym=A;},get Dprev(){return this.Lnext.Sym;},set Dprev(A){this.Lnext.Sym=A;},get Rprev(){return this.Sym.Onext;},set Rprev(A){this.Sym.Onext=A;},get Dnext(){return/*this.Rprev*/this.Sym.Onext.Sym;},/* 3 pointers */set Dnext(A){this.Sym.Onext.Sym=A;},/* 3 pointers */get Rnext(){return/*this.Oprev*/this.Sym.Lnext.Sym;},/* 3 pointers */set Rnext(A){this.Sym.Lnext.Sym=A;}/* 3 pointers */};function p(){var A=new u(),w=new h(),S=new v(0),x=new v(1);A.next=A.prev=A,A.anEdge=null,w.next=w.prev=w,w.anEdge=null,w.trail=null,w.marked=!1,w.inside=!1,S.next=S,S.Sym=x,S.Onext=null,S.Lnext=null,S.Org=null,S.Lface=null,S.winding=0,S.activeRegion=null,x.next=x,x.Sym=S,x.Onext=null,x.Lnext=null,x.Org=null,x.Lface=null,x.winding=0,x.activeRegion=null,this.vHead=A,this.fHead=w,this.eHead=S,this.eHeadSym=x;}p.prototype={/* MakeEdge creates a new pair of half-edges which form their own loop.
|
|
57
57
|
* No vertex or face structures are allocated, but these must be assigned
|
|
58
58
|
* before the current edge operation is completed.
|
|
59
59
|
*///static TESShalfEdge *MakeEdge( TESSmesh* mesh, TESShalfEdge *eNext )
|
|
@@ -348,7 +348,7 @@ descendant:function descendant(r,t,e){var n=(typeof WeakSet==="undefined"?"undef
|
|
|
348
348
|
* tick(handler, {originTime = 0, playbackRate = 1.0, duration = Infinity})
|
|
349
349
|
* @param {*} handler
|
|
350
350
|
* @param {*} options
|
|
351
|
-
*/},{key:"tick",value:function tick(){var _this14=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var _ref38=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref38$duration=_ref38.duration,e=_ref38$duration===void 0?1/0:_ref38$duration,n=_objectWithoutProperties(_ref38,_excluded);if(this[Ps])return;var i=this.timeline.fork(n),s=this;this[xs]=this[xs]||[],this[xs].push({handler:t,duration:e});var _o5=function o(){var a=null,u=null;var h=function h(){var v=_this14[xs].map(function(_ref39){var p=_ref39.handler,y=_ref39.duration;var C=Math.min(1,i.currentTime/y);return{value:p?p(i.currentTime,C):null,p:C};});s[bd]||(s[bd]=Promise.resolve().then(function(){if(delete s[bd],!s[Ps]){s[ba]&&s.render();for(var p=v.length-1;p>=0;p--){var _v$p=v[p],y=_v$p.value,C=_v$p.p;(y===!1||C>=1)&&_this14[xs].splice(p,1);}_this14[xs].length>0&&_o5();}}));};if(_this14[br]&&_this14[br]._type!=="ticker"&&(Ns(_this14[br]._requestID),delete _this14[br]),!_this14[br]){var v=new Promise(function(p){a=p,u=Ci(h);});v._resolve=a,v._requestID=u,v._type="ticker",_this14[br]=v;}};_o5();}},{key:"toGlobalPos",value:function toGlobalPos(t,e){if(this.layerTransformInvert){var u=this.transformMatrix;t=u[0]*t+u[2]*e+u[4],e=u[1]*t+u[3]*e+u[5];}var _this$getResolution7=this.getResolution(),n=_this$getResolution7.width,i=_this$getResolution7.height,s=this.renderOffset,o=[this.canvas.clientWidth,this.canvas.clientHeight];t=t*o[0]/n+s[0],e=e*o[1]/i+s[1];var a=this.displayRatio;return t*=a,e*=a,[t,e];}},{key:"toLocalPos",value:function toLocalPos(t,e){var _this$getResolution8=this.getResolution(),n=_this$getResolution8.width,i=_this$getResolution8.height,s=this.renderOffset,o=[this.canvas.clientWidth,this.canvas.clientHeight];t=t*n/o[0]-s[0],e=e*i/o[1]-s[1];var a=this.displayRatio;t/=a,e/=a;var u=this.layerTransformInvert;return u&&(t=u[0]*t+u[2]*e+u[4],e=u[1]*t+u[3]*e+u[5]),[t,e];}}]);}(nr);Gr.registerNode(xi,"layer");Me(Array);var bs=Symbol("offscreenLayerCount");function Dy(r,t){var _r$renderOffset=_slicedToArray(r.renderOffset,2),e=_r$renderOffset[0],n=_r$renderOffset[1],_r$getResolution=r.getResolution(),i=_r$getResolution.width,s=_r$getResolution.height,o=r.displayRatio;r.renderer.drawImage(t.canvas,-e/o,-n/o,i/o,s/o);}var sf=/*#__PURE__*/function(_nr2){function sf(){var _this15;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,sf);if(_this15=_callSuper(this,sf),!t.container)if(typeof ar.ENV.Container=="function")t.container=new ar.ENV.Container(t.width||300,t.height||150);else throw new Error("No container specified.");_this15.container=t.container,_this15.options=t,t.displayRatio=t.displayRatio||1,t.mode=t.mode||"static",t.left=0,t.top=0,t.autoResize=!1,_this15[bs]=0,_this15.setResolution(t);return _this15;}_inherits(sf,_nr2);return _createClass(sf,[{key:"hasOffscreenCanvas",get:function get(){return this[bs]>0;}},{key:"displayRatio",get:function get(){return this.options.displayRatio;},set:function set(t){this.options.displayRatio!==t&&(this.options.displayRatio=t,this.resize());}},{key:"height",get:function get(){return this.options.height;},set:function set(t){this.options.height!==t&&(this.options.height=t,this.resize());}},{key:"mode",get:function get(){return this.options.mode;},set:function set(t){this.options.mode=t;}},{key:"width",get:function get(){return this.options.width;},set:function set(t){this.options.width!==t&&(this.options.width=t,this.resize());}},{key:"appendChild",value:function appendChild(t){if(!(t instanceof xi))throw new TypeError("WorkerScene only accepts Layer instances.");var e=_superPropGet(sf,"appendChild",this,3)([t]);return t.offscreen&&this[bs]++,t.setResolution(this.getResolution()),e;}},{key:"forceUpdate",value:function forceUpdate(){var _this16=this;this.hasOffscreenCanvas&&!this._requestID&&(this._requestID=Ci(function(){delete _this16._requestID,_this16.render();}));}},{key:"insertBefore",value:function insertBefore(t,e){if(!(t instanceof xi))throw new TypeError("WorkerScene only accepts Layer instances.");var n=_superPropGet(sf,"insertBefore",this,3)([t,e]);return t.offscreen&&this[bs]++,t.setResolution(this.getResolution()),n;}},{key:"layer",value:function layer(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"default";var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};e=Object.assign({},this.options,e,{id:t}),delete e.worker;var n=this.orderedChildren;for(var s=0;s<n.length;s++)if(n[s].id===t)return n[s];var i=new xi(e);return this.appendChild(i),i;}},{key:"removeChild",value:function removeChild(t){var e=_superPropGet(sf,"removeChild",this,3)([t]);return e&&(t._prepareRenderFinished&&t._prepareRenderFinished(),t.offscreen&&this[bs]--),e;}},{key:"render",value:function render(){var t=this.orderedChildren;var e=null;var n=[];for(var i=0;i<t.length;i++){var s=t[i],o=n.length>0;if(s.offscreen)e?(s.prepareRender&&s.render(),Dy(e,s)):n.push(s);else if(!s.autoRender)o&&(n.length=0);else if(e=s,o){s.renderer.clear();for(var a=0;a<n.length;a++){var u=n[a];u.render(),Dy(s,u);}n.length=0,s.render({clear:!1});}else s.prepareRender&&s.render();}}},{key:"replaceChild",value:function replaceChild(t,e){if(!(t instanceof xi))throw new TypeError("WorkerScene only accepts Layer instances.");var n=e.offscreen,i=_superPropGet(sf,"replaceChild",this,3)([t,e]);return n&&this[bs]--,t.offscreen&&this[bs]++,t.setResolution(this.getResolution()),i;}},{key:"resize",value:function resize(){this.setResolution(this.options),this.dispatchEvent({type:"resize"});}},{key:"setResolution",value:function setResolution(){var _ref40=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},t=_ref40.width,e=_ref40.height;var n=this.container;t==null&&(t=n.width||300),e==null&&(e=n.height||150),this.options.width=t,this.options.height=e;var i=this.options.displayRatio||1;_superPropGet(sf,"setResolution",this,3)([{width:t*i,height:e*i}]);}},{key:"snapshot",value:function snapshot(){var _ref41=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref41$offscreen=_ref41.offscreen,t=_ref41$offscreen===void 0?!0:_ref41$offscreen,e=_ref41.layers;var n=t?"snapshotOffScreenCanvas":"snapshotCanvas",_this$getResolution9=this.getResolution(),i=_this$getResolution9.width,s=_this$getResolution9.height;this[n]=this[n]||ar.ENV.createCanvas(i,s,{offscreen:t});var o=this[n].getContext("2d");e=e||this.orderedChildren,this[n].width=i,this[n].height=s;for(var a=0;a<e.length;a++){var u=e[a];u.options.ignoreSnapshot||(u.render&&u.render(),u.canvas&&u.canvas!==u&&o.drawImage(u.canvas,0,0,i,s));}return this[n];}}]);}(nr);Gr.registerNode(sf,"scene");var s2={exports:{}};(function(r,t){(function(e,n){r.exports=n();})(Qe,function(){var e=/* @__PURE__ */function(){function U(K,j){var nt=[],ct=!0,B=!1,N=void 0;try{for(var G=K[Symbol.iterator](),q;!(ct=(q=G.next()).done)&&(nt.push(q.value),!(j&&nt.length===j));ct=!0);}catch(at){B=!0,N=at;}finally{try{!ct&&G.return&&G.return();}finally{if(B)throw N;}}return nt;}return function(K,j){if(Array.isArray(K))return K;if(Symbol.iterator in Object(K))return U(K,j);throw new TypeError("Invalid attempt to destructure non-iterable instance");};}(),n=Math.PI*2,i=function i(K,j,nt,ct,B,N,G){var q=K.x,at=K.y;q*=j,at*=nt;var ut=ct*q-B*at,Ct=B*q+ct*at;return{x:ut+N,y:Ct+G};},s=function s(K,j){var nt=1.3333333333333333*Math.tan(j/4),ct=Math.cos(K),B=Math.sin(K),N=Math.cos(K+j),G=Math.sin(K+j);return[{x:ct-B*nt,y:B+ct*nt},{x:N+G*nt,y:G-N*nt},{x:N,y:G}];},o=function o(K,j,nt,ct){var B=K*ct-j*nt<0?-1:1,N=Math.sqrt(K*K+j*j),G=Math.sqrt(K*K+j*j),q=K*nt+j*ct,at=q/(N*G);return at>1&&(at=1),at<-1&&(at=-1),B*Math.acos(at);},a=function a(K,j,nt,ct,B,N,G,q,at,ut,Ct,R){var $=Math.pow(B,2),_=Math.pow(N,2),H=Math.pow(Ct,2),lt=Math.pow(R,2),dt=$*_-$*lt-_*H;dt<0&&(dt=0),dt/=$*lt+_*H,dt=Math.sqrt(dt)*(G===q?-1:1);var wt=dt*B/N*R,Et=dt*-N/B*Ct,Ot=ut*wt-at*Et+(K+nt)/2,O=at*wt+ut*Et+(j+ct)/2,D=(Ct-wt)/B,J=(R-Et)/N,Q=(-Ct-wt)/B,V=(-R-Et)/N,tt=o(1,0,D,J),g=o(D,J,Q,V);return q===0&&g>0&&(g-=n),q===1&&g<0&&(g+=n),[Ot,O,tt,g];},u=function u(K){var j=K.px,nt=K.py,ct=K.cx,B=K.cy,N=K.rx,G=K.ry,q=K.xAxisRotation,at=q===void 0?0:q,ut=K.largeArcFlag,Ct=ut===void 0?0:ut,R=K.sweepFlag,$=R===void 0?0:R,_=[];if(N===0||G===0)return[];var H=Math.sin(at*n/360),lt=Math.cos(at*n/360),dt=lt*(j-ct)/2+H*(nt-B)/2,wt=-H*(j-ct)/2+lt*(nt-B)/2;if(dt===0&&wt===0)return[];N=Math.abs(N),G=Math.abs(G);var Et=Math.pow(dt,2)/Math.pow(N,2)+Math.pow(wt,2)/Math.pow(G,2);Et>1&&(N*=Math.sqrt(Et),G*=Math.sqrt(Et));var Ot=a(j,nt,ct,B,N,G,Ct,$,H,lt,dt,wt),O=e(Ot,4),D=O[0],J=O[1],Q=O[2],V=O[3],tt=Math.max(Math.ceil(Math.abs(V)/(n/4)),1);V/=tt;for(var g=0;g<tt;g++)_.push(s(Q,V)),Q+=V;return _.map(function(T){var k=i(T[0],N,G,lt,H,D,J),Z=k.x,st=k.y,ft=i(T[1],N,G,lt,H,D,J),pt=ft.x,ot=ft.y,mt=i(T[2],N,G,lt,H,D,J),
|
|
351
|
+
*/},{key:"tick",value:function tick(){var _this14=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var _ref38=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref38$duration=_ref38.duration,e=_ref38$duration===void 0?1/0:_ref38$duration,n=_objectWithoutProperties(_ref38,_excluded);if(this[Ps])return;var i=this.timeline.fork(n),s=this;this[xs]=this[xs]||[],this[xs].push({handler:t,duration:e});var _o5=function o(){var a=null,u=null;var h=function h(){var v=_this14[xs].map(function(_ref39){var p=_ref39.handler,y=_ref39.duration;var C=Math.min(1,i.currentTime/y);return{value:p?p(i.currentTime,C):null,p:C};});s[bd]||(s[bd]=Promise.resolve().then(function(){if(delete s[bd],!s[Ps]){s[ba]&&s.render();for(var p=v.length-1;p>=0;p--){var _v$p=v[p],y=_v$p.value,C=_v$p.p;(y===!1||C>=1)&&_this14[xs].splice(p,1);}_this14[xs].length>0&&_o5();}}));};if(_this14[br]&&_this14[br]._type!=="ticker"&&(Ns(_this14[br]._requestID),delete _this14[br]),!_this14[br]){var v=new Promise(function(p){a=p,u=Ci(h);});v._resolve=a,v._requestID=u,v._type="ticker",_this14[br]=v;}};_o5();}},{key:"toGlobalPos",value:function toGlobalPos(t,e){if(this.layerTransformInvert){var u=this.transformMatrix;t=u[0]*t+u[2]*e+u[4],e=u[1]*t+u[3]*e+u[5];}var _this$getResolution7=this.getResolution(),n=_this$getResolution7.width,i=_this$getResolution7.height,s=this.renderOffset,o=[this.canvas.clientWidth,this.canvas.clientHeight];t=t*o[0]/n+s[0],e=e*o[1]/i+s[1];var a=this.displayRatio;return t*=a,e*=a,[t,e];}},{key:"toLocalPos",value:function toLocalPos(t,e){var _this$getResolution8=this.getResolution(),n=_this$getResolution8.width,i=_this$getResolution8.height,s=this.renderOffset,o=[this.canvas.clientWidth,this.canvas.clientHeight];t=t*n/o[0]-s[0],e=e*i/o[1]-s[1];var a=this.displayRatio;t/=a,e/=a;var u=this.layerTransformInvert;return u&&(t=u[0]*t+u[2]*e+u[4],e=u[1]*t+u[3]*e+u[5]),[t,e];}}]);}(nr);Gr.registerNode(xi,"layer");Me(Array);var bs=Symbol("offscreenLayerCount");function Dy(r,t){var _r$renderOffset=_slicedToArray(r.renderOffset,2),e=_r$renderOffset[0],n=_r$renderOffset[1],_r$getResolution=r.getResolution(),i=_r$getResolution.width,s=_r$getResolution.height,o=r.displayRatio;r.renderer.drawImage(t.canvas,-e/o,-n/o,i/o,s/o);}var sf=/*#__PURE__*/function(_nr2){function sf(){var _this15;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,sf);if(_this15=_callSuper(this,sf),!t.container)if(typeof ar.ENV.Container=="function")t.container=new ar.ENV.Container(t.width||300,t.height||150);else throw new Error("No container specified.");_this15.container=t.container,_this15.options=t,t.displayRatio=t.displayRatio||1,t.mode=t.mode||"static",t.left=0,t.top=0,t.autoResize=!1,_this15[bs]=0,_this15.setResolution(t);return _this15;}_inherits(sf,_nr2);return _createClass(sf,[{key:"hasOffscreenCanvas",get:function get(){return this[bs]>0;}},{key:"displayRatio",get:function get(){return this.options.displayRatio;},set:function set(t){this.options.displayRatio!==t&&(this.options.displayRatio=t,this.resize());}},{key:"height",get:function get(){return this.options.height;},set:function set(t){this.options.height!==t&&(this.options.height=t,this.resize());}},{key:"mode",get:function get(){return this.options.mode;},set:function set(t){this.options.mode=t;}},{key:"width",get:function get(){return this.options.width;},set:function set(t){this.options.width!==t&&(this.options.width=t,this.resize());}},{key:"appendChild",value:function appendChild(t){if(!(t instanceof xi))throw new TypeError("WorkerScene only accepts Layer instances.");var e=_superPropGet(sf,"appendChild",this,3)([t]);return t.offscreen&&this[bs]++,t.setResolution(this.getResolution()),e;}},{key:"forceUpdate",value:function forceUpdate(){var _this16=this;this.hasOffscreenCanvas&&!this._requestID&&(this._requestID=Ci(function(){delete _this16._requestID,_this16.render();}));}},{key:"insertBefore",value:function insertBefore(t,e){if(!(t instanceof xi))throw new TypeError("WorkerScene only accepts Layer instances.");var n=_superPropGet(sf,"insertBefore",this,3)([t,e]);return t.offscreen&&this[bs]++,t.setResolution(this.getResolution()),n;}},{key:"layer",value:function layer(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"default";var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};e=Object.assign({},this.options,e,{id:t}),delete e.worker;var n=this.orderedChildren;for(var s=0;s<n.length;s++)if(n[s].id===t)return n[s];var i=new xi(e);return this.appendChild(i),i;}},{key:"removeChild",value:function removeChild(t){var e=_superPropGet(sf,"removeChild",this,3)([t]);return e&&(t._prepareRenderFinished&&t._prepareRenderFinished(),t.offscreen&&this[bs]--),e;}},{key:"render",value:function render(){var t=this.orderedChildren;var e=null;var n=[];for(var i=0;i<t.length;i++){var s=t[i],o=n.length>0;if(s.offscreen)e?(s.prepareRender&&s.render(),Dy(e,s)):n.push(s);else if(!s.autoRender)o&&(n.length=0);else if(e=s,o){s.renderer.clear();for(var a=0;a<n.length;a++){var u=n[a];u.render(),Dy(s,u);}n.length=0,s.render({clear:!1});}else s.prepareRender&&s.render();}}},{key:"replaceChild",value:function replaceChild(t,e){if(!(t instanceof xi))throw new TypeError("WorkerScene only accepts Layer instances.");var n=e.offscreen,i=_superPropGet(sf,"replaceChild",this,3)([t,e]);return n&&this[bs]--,t.offscreen&&this[bs]++,t.setResolution(this.getResolution()),i;}},{key:"resize",value:function resize(){this.setResolution(this.options),this.dispatchEvent({type:"resize"});}},{key:"setResolution",value:function setResolution(){var _ref40=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},t=_ref40.width,e=_ref40.height;var n=this.container;t==null&&(t=n.width||300),e==null&&(e=n.height||150),this.options.width=t,this.options.height=e;var i=this.options.displayRatio||1;_superPropGet(sf,"setResolution",this,3)([{width:t*i,height:e*i}]);}},{key:"snapshot",value:function snapshot(){var _ref41=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref41$offscreen=_ref41.offscreen,t=_ref41$offscreen===void 0?!0:_ref41$offscreen,e=_ref41.layers;var n=t?"snapshotOffScreenCanvas":"snapshotCanvas",_this$getResolution9=this.getResolution(),i=_this$getResolution9.width,s=_this$getResolution9.height;this[n]=this[n]||ar.ENV.createCanvas(i,s,{offscreen:t});var o=this[n].getContext("2d");e=e||this.orderedChildren,this[n].width=i,this[n].height=s;for(var a=0;a<e.length;a++){var u=e[a];u.options.ignoreSnapshot||(u.render&&u.render(),u.canvas&&u.canvas!==u&&o.drawImage(u.canvas,0,0,i,s));}return this[n];}}]);}(nr);Gr.registerNode(sf,"scene");var s2={exports:{}};(function(r,t){(function(e,n){r.exports=n();})(Qe,function(){var e=/* @__PURE__ */function(){function U(K,j){var nt=[],ct=!0,B=!1,N=void 0;try{for(var G=K[Symbol.iterator](),q;!(ct=(q=G.next()).done)&&(nt.push(q.value),!(j&&nt.length===j));ct=!0);}catch(at){B=!0,N=at;}finally{try{!ct&&G.return&&G.return();}finally{if(B)throw N;}}return nt;}return function(K,j){if(Array.isArray(K))return K;if(Symbol.iterator in Object(K))return U(K,j);throw new TypeError("Invalid attempt to destructure non-iterable instance");};}(),n=Math.PI*2,i=function i(K,j,nt,ct,B,N,G){var q=K.x,at=K.y;q*=j,at*=nt;var ut=ct*q-B*at,Ct=B*q+ct*at;return{x:ut+N,y:Ct+G};},s=function s(K,j){var nt=1.3333333333333333*Math.tan(j/4),ct=Math.cos(K),B=Math.sin(K),N=Math.cos(K+j),G=Math.sin(K+j);return[{x:ct-B*nt,y:B+ct*nt},{x:N+G*nt,y:G-N*nt},{x:N,y:G}];},o=function o(K,j,nt,ct){var B=K*ct-j*nt<0?-1:1,N=Math.sqrt(K*K+j*j),G=Math.sqrt(K*K+j*j),q=K*nt+j*ct,at=q/(N*G);return at>1&&(at=1),at<-1&&(at=-1),B*Math.acos(at);},a=function a(K,j,nt,ct,B,N,G,q,at,ut,Ct,R){var $=Math.pow(B,2),_=Math.pow(N,2),H=Math.pow(Ct,2),lt=Math.pow(R,2),dt=$*_-$*lt-_*H;dt<0&&(dt=0),dt/=$*lt+_*H,dt=Math.sqrt(dt)*(G===q?-1:1);var wt=dt*B/N*R,Et=dt*-N/B*Ct,Ot=ut*wt-at*Et+(K+nt)/2,O=at*wt+ut*Et+(j+ct)/2,D=(Ct-wt)/B,J=(R-Et)/N,Q=(-Ct-wt)/B,V=(-R-Et)/N,tt=o(1,0,D,J),g=o(D,J,Q,V);return q===0&&g>0&&(g-=n),q===1&&g<0&&(g+=n),[Ot,O,tt,g];},u=function u(K){var j=K.px,nt=K.py,ct=K.cx,B=K.cy,N=K.rx,G=K.ry,q=K.xAxisRotation,at=q===void 0?0:q,ut=K.largeArcFlag,Ct=ut===void 0?0:ut,R=K.sweepFlag,$=R===void 0?0:R,_=[];if(N===0||G===0)return[];var H=Math.sin(at*n/360),lt=Math.cos(at*n/360),dt=lt*(j-ct)/2+H*(nt-B)/2,wt=-H*(j-ct)/2+lt*(nt-B)/2;if(dt===0&&wt===0)return[];N=Math.abs(N),G=Math.abs(G);var Et=Math.pow(dt,2)/Math.pow(N,2)+Math.pow(wt,2)/Math.pow(G,2);Et>1&&(N*=Math.sqrt(Et),G*=Math.sqrt(Et));var Ot=a(j,nt,ct,B,N,G,Ct,$,H,lt,dt,wt),O=e(Ot,4),D=O[0],J=O[1],Q=O[2],V=O[3],tt=Math.max(Math.ceil(Math.abs(V)/(n/4)),1);V/=tt;for(var g=0;g<tt;g++)_.push(s(Q,V)),Q+=V;return _.map(function(T){var k=i(T[0],N,G,lt,H,D,J),Z=k.x,st=k.y,ft=i(T[1],N,G,lt,H,D,J),pt=ft.x,ot=ft.y,mt=i(T[2],N,G,lt,H,D,J),It=mt.x,Pt=mt.y;return{x1:Z,y1:st,x2:pt,y2:ot,x:It,y:Pt};});},h={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0/**
|
|
352
352
|
* segment pattern
|
|
353
353
|
* @type {RegExp}
|
|
354
354
|
*/},v=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function p(U){var K=[];return U.replace(v,function(j,nt,ct){var B=nt.toLowerCase();for(ct=C(ct),B=="m"&&ct.length>2&&(K.push([nt].concat(ct.splice(0,2))),B="l",nt=nt=="m"?"l":"L");;){if(ct.length==h[B])return ct.unshift(nt),K.push(ct);if(ct.length<h[B])throw new Error("malformed path data");K.push([nt].concat(ct.splice(0,h[B])));}}),K;}var y=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function C(U){var K=U.match(y);return K?K.map(Number):[];}function b(U){var K=U[0][0],j=U[0][1],nt=K,ct=j;return U.forEach(function(B){var N=B[0],G=B[2],q=B[4],at=B[6],ut=B[1],Ct=B[3],R=B[5],$=B[7];K=Math.min(K,N,G,q,at),j=Math.min(j,ut,Ct,R,$),nt=Math.max(nt,N,G,q,at),ct=Math.max(ct,ut,Ct,R,$);}),[K,j,nt,ct];}function M(U,K){return Math.sqrt(Math.pow(U[0]-K[0],2)+Math.pow(U[1]-K[1],2))+Math.sqrt(Math.pow(U[2]-K[2],2)+Math.pow(U[3]-K[3],2));}function L(U,K){var j=U[0],nt=U[2],ct=U[4],B=U[6],N=U[1],G=U[3],q=U[5],at=U[7],ut=K[0],Ct=K[2],R=K[4],$=K[6],_=K[1],H=K[3],lt=K[5],dt=K[7];return Math.sqrt(Math.pow(ut-j,2)+Math.pow(_-N,2))+Math.sqrt(Math.pow(Ct-nt,2)+Math.pow(H-G,2))+Math.sqrt(Math.pow(R-ct,2)+Math.pow(lt-q,2))+Math.sqrt(Math.pow($-B,2)+Math.pow(dt-at,2));}function X(U,K){var j=et(U.length),nt=[];j.forEach(function(B){var N=0,G=0;B.forEach(function(q){N+=L(U[q],K[G++]);}),nt.push({index:B,distance:N});}),nt.sort(function(B,N){return B.distance-N.distance;});var ct=[];return nt[0].index.forEach(function(B){ct.push(U[B]);}),ct;}function Y(U,K){var j=A(U.length),nt=[];j.forEach(function(B){var N=0;B.forEach(function(G){N+=M(b(U[G]),b(K[G]));}),nt.push({index:B,distance:N});}),nt.sort(function(B,N){return B.distance-N.distance;});var ct=[];return nt[0].index.forEach(function(B){ct.push(U[B]);}),ct;}function et(U){for(var K=[],j=0;j<U;j++){for(var nt=[],ct=0;ct<U;ct++){var B=ct+j;B>U-1&&(B-=U),nt[B]=ct;}K.push(nt);}return K;}function A(U){for(var K=[],j=0;j<U;j++)K.push(j);return w(K);}function w(U){var K=[],j=[];function nt(ct){var B,N;for(B=0;B<ct.length;B++)N=ct.splice(B,1)[0],j.push(N),ct.length==0&&K.push(j.slice()),nt(ct),ct.splice(B,0,N),j.pop();return K;}return nt(U);}var S={};S.parser=p,S.lerpCurve=function(U,K,j){return S.lerpPoints(U[0],U[1],K[0],K[1],j).concat(S.lerpPoints(U[2],U[3],K[2],K[3],j)).concat(S.lerpPoints(U[4],U[5],K[4],K[5],j)).concat(S.lerpPoints(U[6],U[7],K[6],K[7],j));},S.lerpPoints=function(U,K,j,nt,ct){return[U+(j-U)*ct,K+(nt-K)*ct];},S.q2b=function(U,K,j,nt,ct,B){return[U,K,(U+2*j)/3,(K+2*nt)/3,(ct+2*j)/3,(B+2*nt)/3,ct,B];},S.path2shapes=function(U){for(var K=S.parser(U),j=0,nt=0,ct=0,B=K.length,N=[],G=null,q=void 0,at=void 0,ut=void 0,Ct=void 0,R=void 0,$=void 0,_=void 0;ct<B;ct++){var H=K[ct],lt=H[0],dt=K[ct-1];switch(lt){case"m":R=N.length,N[R]=[],G=N[R],j=j+H[1],nt=nt+H[2];break;case"M":R=N.length,N[R]=[],G=N[R],j=H[1],nt=H[2];break;case"l":G.push([j,nt,j,nt,j,nt,j+H[1],nt+H[2]]),j+=H[1],nt+=H[2];break;case"L":G.push([j,nt,H[1],H[2],H[1],H[2],H[1],H[2]]),j=H[1],nt=H[2];break;case"h":G.push([j,nt,j,nt,j,nt,j+H[1],nt]),j+=H[1];break;case"H":G.push([j,nt,H[1],nt,H[1],nt,H[1],nt]),j=H[1];break;case"v":G.push([j,nt,j,nt,j,nt,j,nt+H[1]]),nt+=H[1];break;case"V":G.push([j,nt,j,H[1],j,H[1],j,H[1]]),nt=H[1];break;case"C":G.push([j,nt,H[1],H[2],H[3],H[4],H[5],H[6]]),j=H[5],nt=H[6];break;case"S":dt[0]==="C"||dt[0]==="c"?G.push([j,nt,j+dt[5]-dt[3],nt+dt[6]-dt[4],H[1],H[2],H[3],H[4]]):(dt[0]==="S"||dt[0]==="s")&&G.push([j,nt,j+dt[3]-dt[1],nt+dt[4]-dt[2],H[1],H[2],H[3],H[4]]),j=H[3],nt=H[4];break;case"c":G.push([j,nt,j+H[1],nt+H[2],j+H[3],nt+H[4],j+H[5],nt+H[6]]),j=j+H[5],nt=nt+H[6];break;case"s":dt[0]==="C"||dt[0]==="c"?G.push([j,nt,j+dt[5]-dt[3],nt+dt[6]-dt[4],j+H[1],nt+H[2],j+H[3],nt+H[4]]):(dt[0]==="S"||dt[0]==="s")&&G.push([j,nt,j+dt[3]-dt[1],nt+dt[4]-dt[2],j+H[1],nt+H[2],j+H[3],nt+H[4]]),j=j+H[3],nt=nt+H[4];break;case"a":$=u({rx:H[1],ry:H[2],px:j,py:nt,xAxisRotation:H[3],largeArcFlag:H[4],sweepFlag:H[5],cx:j+H[6],cy:nt+H[7]}),_=$[$.length-1],$.forEach(function(wt,Et){Et===0?G.push([j,nt,wt.x1,wt.y1,wt.x2,wt.y2,wt.x,wt.y]):G.push([$[Et-1].x,$[Et-1].y,wt.x1,wt.y1,wt.x2,wt.y2,wt.x,wt.y]);}),j=_.x,nt=_.y;break;case"A":$=u({rx:H[1],ry:H[2],px:j,py:nt,xAxisRotation:H[3],largeArcFlag:H[4],sweepFlag:H[5],cx:H[6],cy:H[7]}),_=$[$.length-1],$.forEach(function(wt,Et){Et===0?G.push([j,nt,wt.x1,wt.y1,wt.x2,wt.y2,wt.x,wt.y]):G.push([$[Et-1].x,$[Et-1].y,wt.x1,wt.y1,wt.x2,wt.y2,wt.x,wt.y]);}),j=_.x,nt=_.y;break;case"Q":G.push(S.q2b(j,nt,H[1],H[2],H[3],H[4])),j=H[3],nt=H[4];break;case"q":G.push(S.q2b(j,nt,j+H[1],nt+H[2],H[3]+j,H[4]+nt)),j+=H[3],nt+=H[4];break;case"T":dt[0]==="Q"||dt[0]==="q"?(ut=j+dt[3]-dt[1],Ct=nt+dt[4]-dt[2],G.push(S.q2b(j,nt,ut,Ct,H[1],H[2]))):(dt[0]==="T"||dt[0]==="t")&&(G.push(S.q2b(j,nt,j+j-ut,nt+nt-Ct,H[1],H[2])),ut=j+j-ut,Ct=nt+nt-Ct),j=H[1],nt=H[2];break;case"t":dt[0]==="Q"||dt[0]==="q"?(ut=j+dt[3]-dt[1],Ct=nt+dt[4]-dt[2],G.push(S.q2b(j,nt,ut,Ct,j+H[1],nt+H[2]))):(dt[0]==="T"||dt[0]==="t")&&(G.push(S.q2b(j,nt,j+j-ut,nt+nt-Ct,j+H[1],nt+H[2])),ut=j+j-ut,Ct=nt+nt-Ct),j+=H[1],nt+=H[2];break;case"Z":q=G[0][0],at=G[0][1],G.push([j,nt,q,at,q,at,q,at]);break;case"z":q=G[0][0],at=G[0][1],G.push([j,nt,q,at,q,at,q,at]);break;}}return N;},S._upCurves=function(U,K){for(var j=0,nt=0,ct=U.length;j<K;j++)U.push(U[nt].slice(0)),nt++,nt>ct-1&&(nt-=ct);};function x(U,K,j,nt,ct,B,N,G,q){return{left:P(U,K,j,nt,ct,B,N,G,q),right:P(N,G,ct,B,j,nt,U,K,1-q,!0)};}function P(U,K,j,nt,ct,B,N,G,q,at){var ut=(j-U)*q+U,Ct=(nt-K)*q+K,R=(ct-j)*q+j,$=(B-nt)*q+nt,_=(N-ct)*q+ct,H=(G-B)*q+B,lt=(R-ut)*q+ut,dt=($-Ct)*q+Ct,wt=(_-R)*q+R,Et=(H-$)*q+$,Ot=(wt-lt)*q+lt,O=(Et-dt)*q+dt;return at?[Ot,O,lt,dt,ut,Ct,U,K]:[U,K,ut,Ct,lt,dt,Ot,O];}S._splitCurves=function(U,K){for(var j=0,nt=0;j<K;j++){var ct=U[nt],B=x(ct[0],ct[1],ct[2],ct[3],ct[4],ct[5],ct[6],ct[7],0.5);U.splice(nt,1),U.splice(nt,0,B.left,B.right),nt+=2,nt>=U.length-1&&(nt=0);}};function z(U,K){for(var j=function j(B){var N=U[U.length-1],G=[];N.forEach(function(q){G.push(q.slice(0));}),U.push(G);},nt=0;nt<K;nt++)j();}return S.lerp=function(U,K,j){return S._lerp(S.path2shapes(U),S.path2shapes(K),j);},S.MIM_CURVES_COUNT=100,S._preprocessing=function(U,K){var j=U.length,nt=K.length,ct=JSON.parse(JSON.stringify(U)),B=JSON.parse(JSON.stringify(K));return j>nt?z(B,j-nt):j<nt&&z(ct,nt-j),ct=Y(ct,B),ct.forEach(function(N,G){var q=N.length,at=B[G].length;q>at?q<S.MIM_CURVES_COUNT?(S._splitCurves(N,S.MIM_CURVES_COUNT-q),S._splitCurves(B[G],S.MIM_CURVES_COUNT-at)):S._splitCurves(B[G],q-at):q<at&&(at<S.MIM_CURVES_COUNT?(S._splitCurves(N,S.MIM_CURVES_COUNT-q),S._splitCurves(B[G],S.MIM_CURVES_COUNT-at)):S._splitCurves(N,at-q));}),ct.forEach(function(N,G){ct[G]=X(N,B[G]);}),[ct,B];},S._lerp=function(U,K,j){var nt=[];return U.forEach(function(ct,B){var N=[];ct.forEach(function(G,q){N.push(S.lerpCurve(G,K[B][q],j));}),nt.push(N);}),nt;},S.animate=function(U){var K=S.path2shapes(U.from),j=S.path2shapes(U.to),nt=S._preprocessing(K,j),ct=/* @__PURE__ */new Date(),B=U.end||function(){},N=U.progress||function(){},G=U.begin||function(){},q=U.easing||function($){return $;},at=null,ut=null,Ct=U.time;G(K);var R=function $(){var _=/* @__PURE__ */new Date()-ct;if(_>=Ct){ut=j,N(ut,1),B(ut),cancelAnimationFrame(at);return;}var H=q(_/Ct);ut=S._lerp(nt[0],nt[1],H),N(ut,H),at=requestAnimationFrame($);};R();},S;});})(s2);var U0t=s2.exports;var Bc=/* @__PURE__ */$n(U0t);Me(Array);var z0t=Symbol.for("spritejs_setAttributeDefault"),Ar=Symbol.for("spritejs_setAttribute"),Er=Symbol.for("spritejs_getAttribute");var of=/*#__PURE__*/function(_bp2){function of(t){var _this17;_classCallCheck(this,of);_this17=_callSuper(this,of,[t]),_this17[z0t]({d:"",normalize:!1,fillColor:void 0,fillRule:"nonzero",strokeColor:void 0,lineWidth:1,lineJoin:"miter",// 'miter' or 'bevel' or 'round'
|
|
@@ -365,7 +365,7 @@ closeType:"none"// none | sector | normal
|
|
|
365
365
|
_inherits(K0t,_of3);return _createClass(K0t,[{key:"d",get:function get(){return this[As]("d");},set:function set(t){}// eslint-disable-line no-empty-function
|
|
366
366
|
},{key:"radiusX",get:function get(){return this[As]("radiusX");},set:function set(t){if(t=Pe(t),this[Nn]("radiusX",t)){var e=Ma(this);this[Nn]("d",e);}}},{key:"radiusY",get:function get(){return this[As]("radiusY");},set:function set(t){if(t=Pe(t),this[Nn]("radiusY",t)){var e=Ma(this);this[Nn]("d",e);}}},{key:"radius",get:function get(){return[this.radiusX,this.radiusY];},set:function set(t){t=ur(t,!0),Array.isArray(t)||(t=[t,t]),this.radiusX=t[0],this.radiusY=t[1];}},{key:"angle",get:function get(){return[this.startAngle,this.endAngle];},set:function set(t){t=ur(t),Array.isArray(t)||(t=[t,t]),this.startAngle=t[0],this.endAngle=t[1];}},{key:"direction",get:function get(){return this[As]("direction");},set:function set(t){if(t!=null&&t!=="clockwise"&&t!=="anticlockwise")throw new TypeError("Invalid direction type.");this[Nn]("direction",t);}},{key:"startAngle",get:function get(){return this[As]("startAngle");},set:function set(t){if(t=Pe(t),this[Nn]("startAngle",t)){var e=Ma(this);this[Nn]("d",e);}}},{key:"endAngle",get:function get(){return this[As]("endAngle");},set:function set(t){if(t=Pe(t),this[Nn]("endAngle",t)){var e=Ma(this);this[Nn]("d",e);}}},{key:"closeType",get:function get(){return this[As]("closeType");},set:function set(t){if(t!=null&&t!=="none"&&t!=="sector"&&t!=="normal")throw new TypeError("Invalid closeType type.");if(this[Nn]("closeType",t)){var e=Ma(this);this[Nn]("d",e);}}}]);}(of);Me(Array);var dv=/*#__PURE__*/function(_$r3){function dv(){_classCallCheck(this,dv);return _callSuper(this,dv,arguments);}_inherits(dv,_$r3);return _createClass(dv,[{key:"isVisible",get:/* override */function get(){var _this$attributes13=this.attributes,t=_this$attributes13.radiusX,e=_this$attributes13.radiusY,n=_this$attributes13.startAngle,i=_this$attributes13.endAngle;return t>0&&e>0&&n!==i&&_superPropGet(dv,"isVisible",this,1);}}]);}($r);ht(dv,"Attr",K0t);Gr.registerNode(dv,"ellipse");Me(Array);var Q0t=Symbol.for("spritejs_setAttributeDefault"),Uc=Symbol.for("spritejs_setAttribute"),zc=Symbol.for("spritejs_getAttribute");var J0t=/*#__PURE__*/function(_Qu2){function J0t(t){var _this22;_classCallCheck(this,J0t);_this22=_callSuper(this,J0t,[t]),_this22[Q0t]({texture:void 0,textureRect:void 0,textureRepeat:!1,sourceRect:void 0});return _this22;}_inherits(J0t,_Qu2);return _createClass(J0t,[{key:"texture",get:function get(){return this[zc]("texture");},set:function set(t){this[Uc]("texture",t);}},{key:"textureRect",get:function get(){return this[zc]("textureRect");},set:function set(t){this[Uc]("textureRect",t);}},{key:"sourceRect",get:function get(){return this[zc]("sourceRect");},set:function set(t){this[Uc]("sourceRect",t);}},{key:"textureRepeat",get:function get(){return this[zc]("textureRepeat");},set:function set(t){this[Uc]("textureRepeat",!!t);}}]);}(Qu);Me(Array);var ky=Symbol("textureTask");var af=/*#__PURE__*/function(_fl2){function af(){var _this23;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,af);typeof t=="string"&&(t={texture:t}),_this23=_callSuper(this,af,[t]);return _this23;}/* override */_inherits(af,_fl2);return _createClass(af,[{key:"contentSize",get:function get(){var _superPropGet2=_superPropGet(af,"contentSize",this,1),_superPropGet3=_slicedToArray(_superPropGet2,2),t=_superPropGet3[0],e=_superPropGet3[1];var _this$attributes14=this.attributes,n=_this$attributes14.width,i=_this$attributes14.height;if(n==null||i==null){var s=this.textureImage,o=this.attributes.textureRect,a=this.attributes.sourceRect;if(o)n==null&&(t=o[0]+o[2]),i==null&&(e=o[1]+o[3]);else if(a){var u=this.layer?this.layer.displayRatio:1;n==null&&(t=a[2]/u),i==null&&(e=a[3]/u);}else if(s){var _u2=this.layer?this.layer.displayRatio:1;n==null&&(t=s.width/_u2),i==null&&(e=s.height/_u2);}}return[t,e];}},{key:"textureImageReady",get:function get(){return this[ky]||Promise.resolve();}/* override */},{key:"draw",value:function draw(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];_superPropGet(af,"draw",this,3)([t]);var e=this.mesh;return e&&i2(this,e),t;}/* override */},{key:"onPropertyChange",value:function onPropertyChange(t,e,n){if(_superPropGet(af,"onPropertyChange",this,3)([t,e,n]),t==="texture"&&(this[ky]=e2(this,e,!0)),t==="textureRect"){var _this$attributes15=this.attributes,i=_this$attributes15.width,s=_this$attributes15.height;(i==null||s==null)&&this.updateContours();}}}]);}(fl);ht(af,"Attr",J0t);Gr.registerNode(af,"sprite");Me(Array);var _0t=Symbol.for("spritejs_setAttributeDefault"),hn=Symbol.for("spritejs_setAttribute"),dn=Symbol.for("spritejs_getAttribute"),tmt=Symbol.for("spritejs_declareAlias");var emt=/*#__PURE__*/function(_Qu3){function emt(t){var _this24;_classCallCheck(this,emt);_this24=_callSuper(this,emt,[t]),_this24[_0t]({text:"",fontSize:16,fontFamily:"Helvetica,Arial,sans-serif",fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",fontStretch:"normal",lineHeight:"",/* font */textAlign:"left",strokeColor:void 0,strokeWidth:1,fillColor:void 0,verticalAlign:"middle"}),_this24[tmt]("font");return _this24;}_inherits(emt,_Qu3);return _createClass(emt,[{key:"text",get:function get(){return this[dn]("text")||" ";},set:function set(t){this[hn]("text",t);}},{key:"fontSize",get:function get(){return this[dn]("fontSize");},set:function set(t){this[hn]("fontSize",Pe(t));}},{key:"fontFamily",get:function get(){return this[dn]("fontFamily");},set:function set(t){this[hn]("fontFamily",t);}},{key:"fontStyle",get:function get(){return this[dn]("fontStyle");},set:function set(t){this[hn]("fontStyle",t);}},{key:"fontVariant",get:function get(){return this[dn]("fontVariant");},set:function set(t){this[hn]("fontVariant",t);}},{key:"fontWeight",get:function get(){return this[dn]("fontWeight");},set:function set(t){this[hn]("fontWeight",t);}},{key:"fontStretch",get:function get(){return this[dn]("fontStretch");},set:function set(t){this[hn]("fontStretch",t);}},{key:"lineHeight",get:function get(){return this[dn]("lineHeight")||this.fontSize;},set:function set(t){this[hn]("lineHeight",Pe(t));}},{key:"textAlign",get:function get(){return this[dn]("textAlign");},set:function set(t){this[hn]("textAlign",t);}},{key:"strokeColor",get:function get(){return this[dn]("strokeColor");},set:function set(t){this[hn]("strokeColor",ns(t));}},{key:"strokeWidth",get:function get(){return this[dn]("strokeWidth");},set:function set(t){this[hn]("strokeWidth",Pe(t));}},{key:"verticalAlign",get:function get(){return this[dn]("verticalAlign");},set:function set(t){this[hn]("verticalAlign",t);}},{key:"fillColor",get:function get(){return this[dn]("fillColor");},set:function set(t){this[hn]("fillColor",ns(t));}},{key:"font",get:function get(){var t=this.fontStyle,e=this.fontVariant,n=this.fontWeight,i=this.fontStretch,s=this.fontSize,o=this.lineHeight,a=this.fontFamily;return"".concat(t," ").concat(e," ").concat(n," ").concat(i," ").concat(s,"px/").concat(o,"px ").concat(a);},set:function set(t){if(t==null)this.fontStyle=null,this.fontVariant=null,this.fontWeight=null,this.fontStretch=null,this.fontSize=null,this.lineHeight=null,this.fontFamily=null;else{var e=ar.parseFont(t);this.fontStyle=e.style,this.fontVariant=e.variant,this.fontWeight=e.weight,this.fontStretch=e.stretch,this.fontSize=Pe("".concat(e.size).concat(e.unit)),e.lineHeight&&(this.lineHeight=e.pxLineHeight),this.fontFamily=e.family;}}}]);}(Qu);Me(Array);var To=Symbol("textImage"),$c=Symbol("textImageTask"),Ed=Symbol("textureContext"),La=Symbol("updateTextureRect"),Md=Symbol("textCanvas");var pv=/*#__PURE__*/function(_fl3){function pv(){var _this25;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,pv);typeof t=="string"&&(t={text:t}),_this25=_callSuper(this,pv,[t]);return _this25;}/* override */_inherits(pv,_fl3);return _createClass(pv,[{key:"contentSize",get:function get(){var _superPropGet4=_superPropGet(pv,"contentSize",this,1),_superPropGet5=_slicedToArray(_superPropGet4,2),t=_superPropGet5[0],e=_superPropGet5[1];var _this$attributes16=this.attributes,n=_this$attributes16.width,i=_this$attributes16.height;if(n==null||i==null){var s=this[To];s&&(n==null&&(t=s.rect[2]),i==null&&(e=s.rect[3]));}return[t,e];}},{key:"text",get:function get(){return this.attributes.text;},set:function set(t){this.attributes.text=t;}},{key:"textContent",get:function get(){return this.attributes.text;},set:function set(t){this.attributes.text=t;}},{key:"textImage",get:function get(){return this[To]||{};}},{key:"textImageReady",get:function get(){return this[$c]||Promise.resolve();}/* override */},{key:"draw",value:function draw(t){_superPropGet(pv,"draw",this,3)([t]);var e=this.mesh;if(e){var n=this[To];if(n){var i=e.texture;if(!i||this[Ed]&&this[Ed]!==this.renderer||n.needsUpdate?(n.needsUpdate=!1,n2(n.image,this.renderer),i=r2(n.image,this.renderer),this[La]=!0):i=e.uniforms.u_texSampler,this[La]){var _n$rect$slice=n.rect.slice(2),_n$rect$slice2=_slicedToArray(_n$rect$slice,2),s=_n$rect$slice2[0],o=_n$rect$slice2[1],_this$contentSize4=_slicedToArray(this.contentSize,2),a=_this$contentSize4[0],u=_this$contentSize4[1],h=this.attributes.textAlign,v=this.attributes.verticalAlign;var p=0;h==="center"?p=(a-s)/2:(h==="right"||h==="end")&&(p=a-s);var y=this.attributes.fontSize,C=this.attributes.lineHeight;var b=0;v==="top"?b=(y-C)/2:v==="bottom"&&(b=(C-y)/2);var _this$attributes17=this.attributes,M=_this$attributes17.paddingLeft,L=_this$attributes17.paddingTop,X=this.attributes.borderWidth;p+=M+X,b+=L+X;var _this$attributes18=this.attributes,Y=_this$attributes18.anchorX,et=_this$attributes18.anchorY;p-=this.offsetSize[0]*Y,b-=this.offsetSize[1]*et,e.setTexture(i,{rect:[p,b,s,o]}),this[La]=!1,this[Ed]=this.renderer;}}}return t;}/* override */},{key:"onPropertyChange",value:function onPropertyChange(t,e,n){t==="text"||t==="fontSize"||t==="fontFamily"||t==="fontStyle"||t==="fontVariant"||t==="fontWeight"||t==="fontStretch"||t==="lineHeight"||t==="strokeColor"||t==="fillColor"||t==="strokeWidth"?this.updateText():((t==="textAlign"||t==="verticalAlign")&&(this[La]=!0),_superPropGet(pv,"onPropertyChange",this,3)([t,e,n]));}/* override */},{key:"updateContours",value:function updateContours(){_superPropGet(pv,"updateContours",this,3)([]),this[La]=!0;}},{key:"updateText",value:function updateText(){var _this26=this;this[$c]||(this[$c]=Promise.resolve().then(function(){_this26[$c]=null;var _this26$attributes=_this26.attributes,t=_this26$attributes.text,e=_this26$attributes.font,n=_this26$attributes.fillColor,i=_this26$attributes.strokeColor,s=_this26$attributes.strokeWidth,o=_this26.layer?_this26.layer.displayRatio:1;return _this26[Md]=_this26[Md]||ar.ENV.createCanvas(1,1),_this26[To]=ar.ENV.createText(t,{font:e,fillColor:n,strokeColor:i,strokeWidth:s,parseFont:ar.parseFont,ratio:o,textCanvas:_this26[Md]}),_this26[To].needsUpdate=!0,_this26.updateContours(),_this26.forceUpdate(),_this26[To];}));}}]);}(fl);ht(pv,"Attr",emt);Gr.registerNode(pv,"label");Me(Array);function rmt(r,t){if(!r)return t&&_toConsumableArray(t);if(!t)return r;var e=Math.min(r[0],t[0]),n=Math.min(r[1],t[1]);return[e,n,Math.max(r[0]+r[2],t[0]+t[2])-e,Math.max(r[1]+r[3],t[1]+t[3])-n];}var nmt=/*#__PURE__*/function(){function nmt(t){var _ref44=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},e=_ref44.rect,_ref44$revision=_ref44.revision,n=_ref44$revision===void 0?0:_ref44$revision,_ref44$singleChannelT=_ref44.singleChannelTexture,i=_ref44$singleChannelT===void 0?!0:_ref44$singleChannelT,_ref44$textureSubImag=_ref44.textureSubImage2D,s=_ref44$textureSubImag===void 0?!0:_ref44$textureSubImag;_classCallCheck(this,nmt);if(!t||!e||e.length!==4)throw new TypeError("MaskHandle requires a source and [x, y, width, height] rect.");this.source=t,this.rect=_toConsumableArray(e),this.revision=n,this.textureSubImage2D=s,this.singleChannelTexture=i,this._textures=/* @__PURE__ */new Map(),this._dirtyRect=null,this._stagingCanvas=null;}return _createClass(nmt,[{key:"update",value:function update(){var _ref45=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},t=_ref45.rect,e=_ref45.dirtyRect;return t&&(this.rect=_toConsumableArray(t)),this._dirtyRect=rmt(this._dirtyRect,e),this.revision++,this;}},{key:"getTexture",value:function getTexture(t){var _this27=this;if(!t||!t.glRenderer)return null;var e=this._textures.get(t);return e?e.revision!==this.revision&&(this._upload(t.glRenderer.gl,e,this._dirtyRect),e.revision=this.revision):(e=_objectSpread({revision:this.revision},this._createTexture(t)),this._textures.set(t,e)),_toConsumableArray(this._textures.values()).every(function(n){return n.revision===_this27.revision;})&&(this._dirtyRect=null),e.texture;}},{key:"destroy",value:function destroy(t){if(t){var e=this._textures.get(t);e&&(t.deleteTexture(e.texture),this._textures.delete(t));return;}this._textures.forEach(function(e,n){n.deleteTexture(e.texture);}),this._textures.clear();}},{key:"_createTexture",value:function _createTexture(t){var e=t.glRenderer.gl;if(!(this.singleChannelTexture&&t.isWebGL2&&e.R8!=null))return{texture:t.createTexture(this.source),singleChannel:!1};var i=e.createTexture();try{if(e.bindTexture(e.TEXTURE_2D,i),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.R8,e.RED,e.UNSIGNED_BYTE,this.source),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.getError()!==e.NO_ERROR)throw new Error("R8 texture upload failed.");return i._img=this.source,i.delete=function(){return e.deleteTexture(i);},{texture:i,singleChannel:!0};}catch(_unused12){return e.deleteTexture(i),this.singleChannelTexture=!1,{texture:t.createTexture(this.source),singleChannel:!1};}finally{e.bindTexture(e.TEXTURE_2D,null);}}},{key:"_upload",value:function _upload(t,e,n){var i=e.texture,s=e.singleChannel,o=t.getParameter(t.ACTIVE_TEXTURE),a=t.getParameter(t.TEXTURE_BINDING_2D),u=t.getParameter(t.UNPACK_FLIP_Y_WEBGL);t.bindTexture(t.TEXTURE_2D,i),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),this._uploadDirtyRect(t,n,s)||(s?t.texImage2D(t.TEXTURE_2D,0,t.R8,t.RED,t.UNSIGNED_BYTE,this.source):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.source)),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,u),t.bindTexture(t.TEXTURE_2D,a),t.activeTexture(o);}},{key:"_uploadDirtyRect",value:function _uploadDirtyRect(t,e,n){if(!this.textureSubImage2D||!e)return!1;var _this$rect=_slicedToArray(this.rect,4),i=_this$rect[0],s=_this$rect[1],o=_this$rect[2],a=_this$rect[3],u=Math.max(0,Math.floor((e[0]-i)/o*this.source.width)),h=Math.max(0,Math.floor((e[1]-s)/a*this.source.height)),v=Math.min(this.source.width,Math.ceil((e[0]+e[2]-i)/o*this.source.width)),p=Math.min(this.source.height,Math.ceil((e[1]+e[3]-s)/a*this.source.height)),y=v-u,C=p-h;if(y<=0||C<=0)return!0;var b=this._stagingCanvas;(!b||b.width!==y||b.height!==C)&&(b=ar.ENV.createCanvas(y,C,{offscreen:!0}),this._stagingCanvas=b);var M=b&&b.getContext("2d");if(!M)return!1;M.clearRect(0,0,y,C),M.drawImage(this.source,u,h,y,C,0,0,y,C);try{return t.texSubImage2D(t.TEXTURE_2D,0,u,this.source.height-p,n?t.RED:t.RGBA,t.UNSIGNED_BYTE,b),!0;}catch(_unused13){return this.textureSubImage2D=!1,!1;}}}]);}();Me(Array);var By=8,imt={x:1,y:1,width:3,height:2},o2=[255,0,0,255],a2=[0,0,0,0],smt=512,pp=/* @__PURE__ */new WeakMap();function l2(r){return r instanceof Error?r.message:String(r);}function omt(r){return r?r.slice(0,smt):void 0;}function amt(r,t){if(!r||t==="2d"||typeof r.getContext!="function")return;var e=t==="webgl2"?["webgl2","webgl"]:[t];for(var n=0;n<e.length;n++)try{var i=r.getContext(e[n]),s=i&&i.getExtension("WEBGL_lose_context");if(s){s.loseContext();return;}}catch(_unused14){}}function lmt(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;return e?r[3]<=5:r[3]>=16&&r[0]>=r[3]-5&&r[1]<=5&&r[2]<=5;}function Fy(r,t,e,n){var _t3=_slicedToArray(t,2),i=_t3[0],s=_t3[1],o=r(i,s),a=lmt(o,e,!n);return{x:i,y:s,expected:e,actual:o,inside:n,ok:a};}function Io(r,t,e){return Math.min(e,Math.max(t,r));}function cmt(r){var t=By,e=By;return{width:t,height:e,finalWidth:t,finalHeight:e,displayRatio:1,testRect:_objectSpread({},imt),initialCanvasSize:{width:Number(r&&r.width)||0,height:Number(r&&r.height)||0}};}function qn(r,t){return Math.floor(r*t);}function umt(r,t){var e=Math.max(1,Math.floor(Number(r&&r.width))||qn(t.width,t.displayRatio)),n=Math.max(1,Math.floor(Number(r&&r.height))||qn(t.height,t.displayRatio)),i=t.testRect,s=t.displayRatio,o=i.y+Math.min(0.5,i.height*0.25),a={x:Io(qn(i.x,s),0,e-1),y:Io(qn(i.y,s),0,n-1),width:Math.max(1,qn(i.width,s)||1),height:Math.max(1,qn(i.height,s)||1)};a.width=Math.min(a.width,e-a.x),a.height=Math.min(a.height,n-a.y);var u=[[Io(qn(i.x+i.width*0.25,s),0,e-1),Io(qn(o,s),0,n-1)],[Io(qn(i.x+i.width*0.75,s),0,e-1),Io(qn(o,s),0,n-1)]],h=u.map(function(_ref46){var _ref47=_slicedToArray(_ref46,2),C=_ref47[0],b=_ref47[1];return[C,n-1-b];}).concat([[0,0],[e-1,n-1]]),v=new Set(u.map(function(C){return C.join(":");})),p=/* @__PURE__ */new Set(),y=h.filter(function(C){var b=C.join(":");return v.has(b)||p.has(b)?!1:(p.add(b),!0);});return _objectSpread(_objectSpread({},t),{},{canvasSize:{width:e,height:n},imageBitmapRect:a,insidePoints:u,outsidePoints:y});}function ts(r){return r?{canvasSize:r.canvasSize,logicalSize:{width:r.width,height:r.height},initialLogicalSize:{width:r.initialWidth,height:r.initialHeight},displayRatio:r.displayRatio,testRect:r.testRect,imageBitmapRect:r.imageBitmapRect}:{};}function c2(r,t){var e=t.insidePoints.map(function(n){return Fy(r,n,o2,!0);}).concat(t.outsidePoints.map(function(n){return Fy(r,n,a2,!1);}));return{passed:e.every(function(_ref48){var n=_ref48.ok;return n;}),checks:e};}function fmt(r){return r.insidePoints.map(function(_ref49){var _ref50=_slicedToArray(_ref49,2),t=_ref50[0],e=_ref50[1];return{x:t,y:e,expected:o2,inside:!0};}).concat(r.outsidePoints.map(function(_ref51){var _ref52=_slicedToArray(_ref51,2),t=_ref52[0],e=_ref52[1];return{x:t,y:e,expected:a2,inside:!1};}));}function hu(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};return _objectSpread({contextType:r,passed:!1,stage:t,error:e?l2(e):void 0},n);}function Nr(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var n=new Error(l2(t));throw n.renderingProbe={stage:r,details:e},n;}function hmt(r,t,e){t.stage="read-pixels";var n=r.getContext("2d");return n||Nr(t.stage,"2d-context-unavailable"),c2(function(i,s){return Array.from(n.getImageData(i,s,1,1).data.slice(0,4));},e);}function dmt(r,t,e){t.stage="context";var n=r.gl;n||Nr(t.stage,"webgl-context-unavailable");var i=n.isContextLost?n.isContextLost():!1;i&&Nr(t.stage,"context-lost",{contextLost:i}),t.stage="current-program";var s=n.getParameter(n.CURRENT_PROGRAM);if(s||Nr(t.stage,"current-program-missing"),t.stage="link",!n.getProgramParameter(s,n.LINK_STATUS)){var h=n.getProgramInfoLog?omt(n.getProgramInfoLog(s)):void 0;Nr(t.stage,"program-link-failed",{programInfoLog:h});}t.stage="program-metadata",s.uniforms||Nr(t.stage,"current-program-metadata-missing"),t.stage="draw";var o=n.getError();o!==n.NO_ERROR&&Nr(t.stage,"webgl-error",{glError:o}),t.stage="read-pixels";var a=c2(function(h,v){var p=new Uint8Array(4),y=e.canvasSize.height-1-v;return n.readPixels(h,y,1,1,n.RGBA,n.UNSIGNED_BYTE,p),Array.from(p);},e),u=n.getError();return u!==n.NO_ERROR&&Nr(t.stage,"webgl-read-pixels-error",{glError:u}),a;}function pmt(r,t){return r==="webgl2"?t==="webgl2"||t==="webgl":r===t;}function vmt(r,t,e,n){if(typeof e.createSceneContainer=="function"){var i=e.createSceneContainer(t.width,t.height);if(i)return i;}if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(t.width,t.height);Nr(n.stage,"scene-container-unavailable",{initialCanvasSize:t.initialCanvasSize});}function u2(r,t,e,n){var i=cmt(r),s=_objectSpread({},t),o=s.Scene;delete s.Scene,delete s.captureImageBitmap,delete s.createSceneContainer,delete s.width,delete s.height,delete s.displayRatio,delete s.bufferSize,delete s.testRect,delete s.finalWidth,delete s.finalHeight,delete s.cameraOpt,typeof o!="function"&&Nr(n.stage,"scene-constructor-unavailable");var a=vmt(r,i,t,n),u=new o(_objectSpread(_objectSpread({},s),{},{// Match the appliance Worker topology: the Scene owns an inert container,
|
|
367
367
|
// while the Layer owns the canvas whose framebuffer is captured.
|
|
368
|
-
container:a,width:i.width,height:i.height,displayRatio:i.displayRatio,autoResize:!1,contextType:e}));var h;try{var C=_objectSpread(_objectSpread({},s),{},{width:i.width,height:i.height,contextType:e,autoRender:!1});r&&(C.canvas=r),h=u.layer("render-probe",C);}catch(C){throw n.scene=u,n.profile=i,C;}var v=h.canvas||r;v||(n.scene=u,n.layer=h,Nr(n.stage,"layer-canvas-unavailable"));var p=_objectSpread(_objectSpread({},i),{},{initialWidth:i.width,initialHeight:i.height}),y=umt(v,p);return n.scene=u,n.layer=h,n.canvas=v,n.layout=y,{scene:u,layer:h,layout:y,canvas:v};}function f2(r,t,e,n){var i=r.renderer.options.contextType;pmt(t,i)||Nr(e.stage,"context-type-mismatch",{actualContextType:i});var _n$testRect=n.testRect,s=_n$testRect.x,o=_n$testRect.y,a=_n$testRect.width,u=_n$testRect.height;return r.append(new Bo({pos:[s,o],size:[a,u],fillColor:"rgba(255, 0, 0, 1)"})),e.stage="render",r.render(),i;}function gmt(r,t,e,n){var i=r.renderer.options.contextType==="2d"?hmt(t,e,n):dmt(r,e,n);return i.passed||Nr(e.stage,"pixel-check-failed",_objectSpread(_objectSpread({},ts(n)),{},{pixelChecks:i.checks})),i;}function mmt(r,t,e,n){if(!t)return;n.stage="capture-image-bitmap",(!r||typeof r.transferToImageBitmap!="function")&&Nr(n.stage,"transfer-to-image-bitmap-unavailable",{pixelChecks:e});var i=r.transferToImageBitmap();return i||Nr(n.stage,"transfer-to-image-bitmap-empty",{pixelChecks:e}),i;}function Wy(r){if(r.imageBitmap)try{r.imageBitmap.close();}catch(_unused15){}}function vv(r,t,e,n){var i=r.layer;if(!i)return amt(t,e),_objectSpread(_objectSpread({},n),{},{destroyed:!0});try{var s=i.destroy()!==!1;return!s&&n.passed?(Wy(n),hu(e,"destroy","layer-already-destroyed",_objectSpread(_objectSpread({},ts(r.layout)),{},{destroyed:!1}))):_objectSpread(_objectSpread({},n),{},{destroyed:s});}catch(s){return n.passed?(Wy(n),hu(e,"destroy",s,_objectSpread(_objectSpread({},ts(r.layout)),{},{destroyed:!1}))):_objectSpread(_objectSpread({},n),{},{destroyed:!1});}}function h2(r,t,e,n){var i=_objectSpread(_objectSpread({},n),{},{destroyed:!1});return pp.set(i,{state:r,canvas:t,contextType:e}),i;}function ymt(r){if(!r||_typeof(r)!="object")return!1;var t=pp.get(r);if(!t)return r.destroyed===!0;pp.delete(r);var e=vv(t.state,t.canvas,t.contextType,r);return Object.assign(r,e),r.destroyed===!0;}function wmt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var e=t.contextType||"webgl2",n=t.captureImageBitmap===!0,i={stage:"layer-init"};var s;try{var _u3=u2(r,t,e,i),o=_u3.layer,a=_u3.layout,u=_u3.canvas,h=f2(o,e,i,a),v=gmt(o,u,i,a),p=mmt(u,n,v.checks,i);s=_objectSpread(_objectSpread({contextType:e,actualContextType:h,passed:!0},ts(a)),{},{pixelChecks:v.checks,imageBitmap:p});}catch(o){var _a5=o&&o.renderingProbe;s=hu(e,_a5?_a5.stage:i.stage,o,_objectSpread(_objectSpread({},ts(i.layout)),_a5?_a5.details:void 0));}return s.passed?h2(i,i.canvas||r,e,s):vv(i,i.canvas||r,e,s);}function Smt(_x5){return _Smt.apply(this,arguments);}function _Smt(){_Smt=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee118(r){var t,e,n,i,s,_u9,o,a,u,h,v,_a1,_args126=arguments;return _regenerator().w(function(_context126){while(1)switch(_context126.n){case 0:t=_args126.length>1&&_args126[1]!==undefined?_args126[1]:{};e=t.contextType||"webgl2",n={stage:"layer-init"};try{_u9=u2(r,t,e,n),o=_u9.layer,a=_u9.layout,u=_u9.canvas,h=f2(o,e,n,a),v=fmt(a);n.expectedPixelChecks=v,n.stage="capture-image-bitmap",s=o.transferToImageBitmap(),s||Nr(n.stage,"transfer-to-image-bitmap-empty",ts(a)),i=_objectSpread(_objectSpread({contextType:e,actualContextType:h,passed:!0},ts(a)),{},{imageBitmapRect:{x:0,y:0,width:a.canvasSize.width,height:a.canvasSize.height},expectedPixelChecks:v,imageBitmap:s});}catch(o){if(s){try{s.close();}catch(_unused47){}s=void 0;}_a1=o&&o.renderingProbe;i=hu(e,_a1?_a1.stage:n.stage,o,_objectSpread(_objectSpread({},ts(n.layout)),{},{expectedPixelChecks:n.expectedPixelChecks},_a1?_a1.details:void 0));}return _context126.a(2,i.passed&&i.imageBitmap?h2(n,n.canvas||r,e,i):vv(n,n.canvas||r,e,i));}},_callee118);}));return _Smt.apply(this,arguments);}Me(Array);var _e=/* @__PURE__ */function(r){return r.selector="selector",r.clicker="clicker",r.laserPointer="laserPointer",r.pencil="pencil",r.rectangle="rectangle",r.ellipse="ellipse",r.shape="shape",r.eraser="eraser",r.pencilEraser="pencilEraser",r.text="text",r.straight="straight",r.arrow="arrow",r.hand="hand",r.laserPen="laserPen",r;}(_e||{}),d2=/* @__PURE__ */function(r){return r[r.OffscreenTransfer=1]="OffscreenTransfer",r[r.ImageBitmap=2]="ImageBitmap",r[r.MainThread=3]="MainThread",r;}(d2||{}),p2=/* @__PURE__ */function(r){return r[r.RefreshTextRender=1]="RefreshTextRender",r;}(p2||{}),Ne=/* @__PURE__ */function(r){return r.Normal="Normal",r.Stroke="Stroke",r.Dotted="Dotted",r.LongDotted="LongDotted",r;}(Ne||{});var Qi={star:"star",polygon:"polygon",speechBalloon:"speechBalloon",bitMapEraser:"bitMapEraser"};var ve=/* @__PURE__ */function(r){return r.None="None",r.ShowFloatBar="ShowFloatBar",r.ZIndexFloatBar="ZIndexFloatBar",r.DeleteNode="DeleteNode",r.CopyNode="CopyNode",r.ZIndexNode="ZIndexNode",r.ZIndexBackgroundSVG="ZIndexBackgroundSVG",r.RotateNode="RotateNode",r.SetColorNode="SetColorNode",r.TranslateNode="TranslateNode",r.ScaleNode="ScaleNode",r.OriginalEvent="OriginalEvent",r.CreateScene="CreateScene",r.ActiveCursor="ActiveCursor",r.MoveCursor="MoveCursor",r.CommandEditor="CommandEditor",r.SetEditorData="SetEditorData",r.SetFontStyle="SetFontStyle",r.SetPoint="SetPoint",r.SetLock="SetLock",r.SetShapeOpt="SetShapeOpt",r.CameraChange="CameraChange",r.ActiveMethod="ActiveMethod",r.HidFloatBarBtn="HidFloatBarBtn",r.SelectMethod="SelectMethod",r;}(ve||{}),St=/* @__PURE__ */function(r){return r[r.Pencil=1]="Pencil",r[r.Eraser=2]="Eraser",r[r.PencilEraser=3]="PencilEraser",r[r.BitMapEraser=4]="BitMapEraser",r[r.Selector=5]="Selector",r[r.Clicker=6]="Clicker",r[r.Arrow=7]="Arrow",r[r.Hand=8]="Hand",r[r.LaserPen=9]="LaserPen",r[r.Text=10]="Text",r[r.Straight=11]="Straight",r[r.Rectangle=12]="Rectangle",r[r.Ellipse=13]="Ellipse",r[r.Star=14]="Star",r[r.Triangle=15]="Triangle",r[r.Rhombus=16]="Rhombus",r[r.Polygon=17]="Polygon",r[r.SpeechBalloon=18]="SpeechBalloon",r[r.Image=19]="Image",r[r.BackgroundSVG=20]="BackgroundSVG",r;}(St||{}),Qt=/* @__PURE__ */function(r){return r[r.Local=1]="Local",r[r.Service=2]="Service",r[r.Worker=3]="Worker",r;}(Qt||{}),te=/* @__PURE__ */function(r){return r[r.Pending=0]="Pending",r[r.Start=1]="Start",r[r.Doing=2]="Doing",r[r.Done=3]="Done",r[r.Unwritable=4]="Unwritable",r;}(te||{}),It=/* @__PURE__ */function(r){return r[r.None=0]="None",r[r.Init=1]="Init",r[r.UpdateCamera=2]="UpdateCamera",r[r.UpdateTools=3]="UpdateTools",r[r.CreateWork=4]="CreateWork",r[r.DrawWork=5]="DrawWork",r[r.FullWork=6]="FullWork",r[r.UpdateNode=7]="UpdateNode",r[r.RemoveNode=8]="RemoveNode",r[r.Clear=9]="Clear",r[r.Select=10]="Select",r[r.Destroy=11]="Destroy",r[r.Snapshot=12]="Snapshot",r[r.BoundingBox=13]="BoundingBox",r[r.Cursor=14]="Cursor",r[r.TextUpdate=15]="TextUpdate",r[r.GetTextActive=16]="GetTextActive",r[r.TasksQueue=17]="TasksQueue",r[r.CursorHover=18]="CursorHover",r[r.CursorBlur=19]="CursorBlur",r[r.Console=20]="Console",r[r.GetImageBitMap=23]="GetImageBitMap",r[r.AuthWriter=24]="AuthWriter",r[r.AuthReader=25]="AuthReader",r[r.AuthClear=26]="AuthClear",r[r.AuthPage=27]="AuthPage",r[r.GetVNodeInfo=28]="GetVNodeInfo",r[r.UpdateDpr=29]="UpdateDpr",r[r.SetFontFace=30]="SetFontFace",r[r.ReportError=31]="ReportError",r[r.ReportLog=32]="ReportLog",r[r.BackgroundSVGUpdate=33]="BackgroundSVGUpdate",r[r.BackgroundSVGDelete=34]="BackgroundSVGDelete",r[r.SelectorTransform=35]="SelectorTransform",r[r.CheckFontFace=36]="CheckFontFace",r[r.RefreshTextRender=37]="RefreshTextRender",r[r.ProbeRenderCapabilities=38]="ProbeRenderCapabilities",r[r.ServiceSyncCommit=39]="ServiceSyncCommit",r[r.CancelFontFace=40]="CancelFontFace",r[r.CancelBitmapEraser=41]="CancelBitmapEraser",r;}(It||{}),$t=/* @__PURE__ */function(r){return r[r.None=0]="None",r[r.Bg=1]="Bg",r[r.ServiceFloat=2]="ServiceFloat",r[r.Float=3]="Float",r[r.TopFloat=4]="TopFloat",r;}($t||{}),Ae=/* @__PURE__ */function(r){return r[r.none=1]="none",r[r.all=2]="all",r[r.both=3]="both",r[r.proportional=4]="proportional",r;}(Ae||{}),es=/* @__PURE__ */function(r){return r[r.inside=0]="inside",r[r.outside=1]="outside",r[r.intersect=2]="intersect",r;}(es||{}),lf=/* @__PURE__ */function(r){return r.Image="image",r.Iconify="iconify",r;}(lf||{});var ei=/*#__PURE__*/function(){function ei(){_classCallCheck(this,ei);ht(this,"localWork");ht(this,"serviceWork");ht(this,"threadEngine");}return _createClass(ei,[{key:"registerForWorker",value:function registerForWorker(t){return this.threadEngine=t,this.localWork=t.localWork,this.serviceWork=t.serviceWork,this;}}]);}();var Tmt=/*#__PURE__*/function(_ei){function Tmt(){var _this28;_classCallCheck(this,Tmt);_this28=_callSuper(this,Tmt,arguments);ht(_this28,"emitEventType",ve.CopyNode);return _this28;}_inherits(Tmt,_ei);return _createClass(Tmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.FullWork&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(e){var i,n,_t4;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:n=e.workId;_t4=n;if(!_t4){_context.n=1;break;}_context.n=1;return(i=this.localWork)==null?void 0:i.consumeFull(e);case 1:return _context.a(2);}},_callee,this);}));function consumeForLocalWorker(_x6){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Fo="++",De="selector",Uy="all";var Imt=/*#__PURE__*/function(_ei2){function Imt(){var _this29;_classCallCheck(this,Imt);_this29=_callSuper(this,Imt,arguments);ht(_this29,"emitEventType",ve.SetColorNode);return _this29;}_inherits(Imt,_ei2);return _createClass(Imt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e){var p,n,i,s,o,a,u,h,v,_t5;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.needUndoTicker,v=e.requestId;_t5=n===De&&i;if(!_t5){_context2.n=1;break;}_context2.n=1;return(p=this.localWork)==null?void 0:p.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:v,textUpdateForWoker:u,callback:this.updateSelectorCallback,needUndoTicker:h});case 1:return _context2.a(2);}},_callee2,this);}));function consumeForLocalWorker(_x7){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=n.willSyncService,a=n.isSync,u=n.textUpdateForWoker,h=n.needUndoTicker,v=n.requestId,p=n.emitEventType,y=i.render||[],C=i.sp||[];if(o){var _iterator2=_createForOfIteratorHelper(s.entries()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _step2$value=_slicedToArray(_step2.value,2),b=_step2$value[0],M=_step2$value[1];u&&M.toolsType===St.Text?C.push(_objectSpread(_objectSpread({},M),{},{workId:b,type:It.TextUpdate,dataType:Qt.Local,willSyncService:!0,emitEventType:p,requestId:v,needUndoTicker:h})):C.push(_objectSpread(_objectSpread({},M),{},{workId:b,type:It.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:a,emitEventType:p,requestId:v,needUndoTicker:h}));}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return h&&C.push({type:It.None,needUndoTicker:h}),{render:y,sp:C};}}]);}(ei);var Cmt=/*#__PURE__*/function(_ei3){function Cmt(){var _this30;_classCallCheck(this,Cmt);_this30=_callSuper(this,Cmt,arguments);ht(_this30,"emitEventType",ve.ZIndexNode);return _this30;}_inherits(Cmt,_ei3);return _createClass(Cmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(e){var v,n,i,s,o,a,u,h,_t6;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.needUndoTicker,h=e.requestId;_t6=n===De&&i;if(!_t6){_context3.n=1;break;}_context3.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,callback:this.updateSelectorCallback,needUndoTicker:u});case 1:return _context3.a(2);}},_callee3,this);}));function consumeForLocalWorker(_x8){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=n.willSyncService,a=n.isSync,u=n.needUndoTicker,h=n.requestId,v=n.emitEventType,p=i.render||[],y=i.sp||[];if(o&&y){var _iterator3=_createForOfIteratorHelper(s.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),C=_step3$value[0],b=_step3$value[1];b.toolsType===St.BackgroundSVG&&y.push(_objectSpread(_objectSpread({},b),{},{workId:C,type:It.BackgroundSVGUpdate,dataType:Qt.Local,updateNodeOpt:{useAnimation:!1},needUndoTicker:u,emitEventType:v,requestId:h})),y.push(_objectSpread(_objectSpread({},b),{},{workId:C,type:It.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:a,emitEventType:v,requestId:h,needUndoTicker:u}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return u&&y.push({type:It.None,needUndoTicker:u}),{render:p,sp:y};}}]);}(ei);var v2={exports:{}};(function(r){(function(){var t={};t.version="6.4.2.2",t.use_lines=!0,t.use_xyz=!1;var e=!1;r.exports?(r.exports=t,e=!0):(typeof document==="undefined"?"undefined":_typeof(document))<"u"?window.ClipperLib=t:self.ClipperLib=t;var n;if(e){var i="chrome";n="Netscape";}else{var i=navigator.userAgent.toString().toLowerCase();n=navigator.appName;}var s={};i.indexOf("chrome")!=-1&&i.indexOf("chromium")==-1?s.chrome=1:s.chrome=0,i.indexOf("chromium")!=-1?s.chromium=1:s.chromium=0,i.indexOf("safari")!=-1&&i.indexOf("chrome")==-1&&i.indexOf("chromium")==-1?s.safari=1:s.safari=0,i.indexOf("firefox")!=-1?s.firefox=1:s.firefox=0,i.indexOf("firefox/17")!=-1?s.firefox17=1:s.firefox17=0,i.indexOf("firefox/15")!=-1?s.firefox15=1:s.firefox15=0,i.indexOf("firefox/3")!=-1?s.firefox3=1:s.firefox3=0,i.indexOf("opera")!=-1?s.opera=1:s.opera=0,i.indexOf("msie 10")!=-1?s.msie10=1:s.msie10=0,i.indexOf("msie 9")!=-1?s.msie9=1:s.msie9=0,i.indexOf("msie 8")!=-1?s.msie8=1:s.msie8=0,i.indexOf("msie 7")!=-1?s.msie7=1:s.msie7=0,i.indexOf("msie ")!=-1?s.msie=1:s.msie=0,t.biginteger_used=null;var o;function a(c,d,m){t.biginteger_used=1,c!=null&&(typeof c=="number"&&_typeof(d)>"u"?this.fromInt(c):typeof c=="number"?this.fromNumber(c,d,m):d==null&&typeof c!="string"?this.fromString(c,256):this.fromString(c,d));}function u(){return new a(null,void 0,void 0);}function h(c,d,m,E,F,rt){for(;--rt>=0;){var vt=d*this[c++]+m[E]+F;F=Math.floor(vt/67108864),m[E++]=vt&67108863;}return F;}function v(c,d,m,E,F,rt){for(var vt=d&32767,At=d>>15;--rt>=0;){var Mt=this[c]&32767,Wt=this[c++]>>15,Zt=At*Mt+Wt*vt;Mt=vt*Mt+((Zt&32767)<<15)+m[E]+(F&1073741823),F=(Mt>>>30)+(Zt>>>15)+At*Wt+(F>>>30),m[E++]=Mt&1073741823;}return F;}function p(c,d,m,E,F,rt){for(var vt=d&16383,At=d>>14;--rt>=0;){var Mt=this[c]&16383,Wt=this[c++]>>14,Zt=At*Mt+Wt*vt;Mt=vt*Mt+((Zt&16383)<<14)+m[E]+F,F=(Mt>>28)+(Zt>>14)+At*Wt,m[E++]=Mt&268435455;}return F;}n=="Microsoft Internet Explorer"?(a.prototype.am=v,o=30):n!="Netscape"?(a.prototype.am=h,o=26):(a.prototype.am=p,o=28),a.prototype.DB=o,a.prototype.DM=(1<<o)-1,a.prototype.DV=1<<o;var y=52;a.prototype.FV=Math.pow(2,y),a.prototype.F1=y-o,a.prototype.F2=2*o-y;var C="0123456789abcdefghijklmnopqrstuvwxyz",b=new Array(),M,L;for(M=48,L=0;L<=9;++L)b[M++]=L;for(M=97,L=10;L<36;++L)b[M++]=L;for(M=65,L=10;L<36;++L)b[M++]=L;function X(c){return C.charAt(c);}function Y(c,d){var m=b[c.charCodeAt(d)];return m!==null&&m!==void 0?m:-1;}function et(c){for(var d=this.t-1;d>=0;--d)c[d]=this[d];c.t=this.t,c.s=this.s;}function A(c){this.t=1,this.s=c<0?-1:0,c>0?this[0]=c:c<-1?this[0]=c+this.DV:this.t=0;}function w(c){var d=u();return d.fromInt(c),d;}function S(c,d){var m;if(d==16)m=4;else if(d==8)m=3;else if(d==256)m=8;else if(d==2)m=1;else if(d==32)m=5;else if(d==4)m=2;else{this.fromRadix(c,d);return;}this.t=0,this.s=0;for(var E=c.length,F=!1,rt=0;--E>=0;){var vt=m==8?c[E]&255:Y(c,E);if(vt<0){c.charAt(E)=="-"&&(F=!0);continue;}F=!1,rt==0?this[this.t++]=vt:rt+m>this.DB?(this[this.t-1]|=(vt&(1<<this.DB-rt)-1)<<rt,this[this.t++]=vt>>this.DB-rt):this[this.t-1]|=vt<<rt,rt+=m,rt>=this.DB&&(rt-=this.DB);}m==8&&c[0]&128&&(this.s=-1,rt>0&&(this[this.t-1]|=(1<<this.DB-rt)-1<<rt)),this.clamp(),F&&a.ZERO.subTo(this,this);}function x(){for(var c=this.s&this.DM;this.t>0&&this[this.t-1]==c;)--this.t;}function P(c){if(this.s<0)return"-"+this.negate().toString(c);var d;if(c==16)d=4;else if(c==8)d=3;else if(c==2)d=1;else if(c==32)d=5;else if(c==4)d=2;else return this.toRadix(c);var m=(1<<d)-1,E,F=!1,rt="",vt=this.t,At=this.DB-vt*this.DB%d;if(vt-->0)for(At<this.DB&&(E=this[vt]>>At)>0&&(F=!0,rt=X(E));vt>=0;)At<d?(E=(this[vt]&(1<<At)-1)<<d-At,E|=this[--vt]>>(At+=this.DB-d)):(E=this[vt]>>(At-=d)&m,At<=0&&(At+=this.DB,--vt)),E>0&&(F=!0),F&&(rt+=X(E));return F?rt:"0";}function z(){var c=u();return a.ZERO.subTo(this,c),c;}function U(){return this.s<0?this.negate():this;}function K(c){var d=this.s-c.s;if(d!=0)return d;var m=this.t;if(d=m-c.t,d!=0)return this.s<0?-d:d;for(;--m>=0;)if((d=this[m]-c[m])!=0)return d;return 0;}function j(c){var d=1,m;return(m=c>>>16)!=0&&(c=m,d+=16),(m=c>>8)!=0&&(c=m,d+=8),(m=c>>4)!=0&&(c=m,d+=4),(m=c>>2)!=0&&(c=m,d+=2),(m=c>>1)!=0&&(c=m,d+=1),d;}function nt(){return this.t<=0?0:this.DB*(this.t-1)+j(this[this.t-1]^this.s&this.DM);}function ct(c,d){var m;for(m=this.t-1;m>=0;--m)d[m+c]=this[m];for(m=c-1;m>=0;--m)d[m]=0;d.t=this.t+c,d.s=this.s;}function B(c,d){for(var m=c;m<this.t;++m)d[m-c]=this[m];d.t=Math.max(this.t-c,0),d.s=this.s;}function N(c,d){var m=c%this.DB,E=this.DB-m,F=(1<<E)-1,rt=Math.floor(c/this.DB),vt=this.s<<m&this.DM,At;for(At=this.t-1;At>=0;--At)d[At+rt+1]=this[At]>>E|vt,vt=(this[At]&F)<<m;for(At=rt-1;At>=0;--At)d[At]=0;d[rt]=vt,d.t=this.t+rt+1,d.s=this.s,d.clamp();}function G(c,d){d.s=this.s;var m=Math.floor(c/this.DB);if(m>=this.t){d.t=0;return;}var E=c%this.DB,F=this.DB-E,rt=(1<<E)-1;d[0]=this[m]>>E;for(var vt=m+1;vt<this.t;++vt)d[vt-m-1]|=(this[vt]&rt)<<F,d[vt-m]=this[vt]>>E;E>0&&(d[this.t-m-1]|=(this.s&rt)<<F),d.t=this.t-m,d.clamp();}function q(c,d){for(var m=0,E=0,F=Math.min(c.t,this.t);m<F;)E+=this[m]-c[m],d[m++]=E&this.DM,E>>=this.DB;if(c.t<this.t){for(E-=c.s;m<this.t;)E+=this[m],d[m++]=E&this.DM,E>>=this.DB;E+=this.s;}else{for(E+=this.s;m<c.t;)E-=c[m],d[m++]=E&this.DM,E>>=this.DB;E-=c.s;}d.s=E<0?-1:0,E<-1?d[m++]=this.DV+E:E>0&&(d[m++]=E),d.t=m,d.clamp();}function at(c,d){var m=this.abs(),E=c.abs(),F=m.t;for(d.t=F+E.t;--F>=0;)d[F]=0;for(F=0;F<E.t;++F)d[F+m.t]=m.am(0,E[F],d,F,0,m.t);d.s=0,d.clamp(),this.s!=c.s&&a.ZERO.subTo(d,d);}function ut(c){for(var d=this.abs(),m=c.t=2*d.t;--m>=0;)c[m]=0;for(m=0;m<d.t-1;++m){var E=d.am(m,d[m],c,2*m,0,1);(c[m+d.t]+=d.am(m+1,2*d[m],c,2*m+1,E,d.t-m-1))>=d.DV&&(c[m+d.t]-=d.DV,c[m+d.t+1]=1);}c.t>0&&(c[c.t-1]+=d.am(m,d[m],c,2*m,0,1)),c.s=0,c.clamp();}function Ct(c,d,m){var E=c.abs();if(!(E.t<=0)){var F=this.abs();if(F.t<E.t){d!=null&&d.fromInt(0),m!=null&&this.copyTo(m);return;}m==null&&(m=u());var rt=u(),vt=this.s,At=c.s,Mt=this.DB-j(E[E.t-1]);Mt>0?(E.lShiftTo(Mt,rt),F.lShiftTo(Mt,m)):(E.copyTo(rt),F.copyTo(m));var Wt=rt.t,Zt=rt[Wt-1];if(Zt!=0){var Xt=Zt*(1<<this.F1)+(Wt>1?rt[Wt-2]>>this.F2:0),ne=this.FV/Xt,ue=(1<<this.F1)/Xt,Se=1<<this.F2,Ie=m.t,We=Ie-Wt,Mr=d!==null&&d!==void 0?d:u();for(rt.dlShiftTo(We,Mr),m.compareTo(Mr)>=0&&(m[m.t++]=1,m.subTo(Mr,m)),a.ONE.dlShiftTo(Wt,Mr),Mr.subTo(rt,rt);rt.t<Wt;)rt[rt.t++]=0;for(;--We>=0;){var gn=m[--Ie]==Zt?this.DM:Math.floor(m[Ie]*ne+(m[Ie-1]+Se)*ue);if((m[Ie]+=rt.am(0,gn,m,We,0,Wt))<gn)for(rt.dlShiftTo(We,Mr),m.subTo(Mr,m);m[Ie]<--gn;)m.subTo(Mr,m);}d!=null&&(m.drShiftTo(Wt,d),vt!=At&&a.ZERO.subTo(d,d)),m.t=Wt,m.clamp(),Mt>0&&m.rShiftTo(Mt,m),vt<0&&a.ZERO.subTo(m,m);}}}function R(c){var d=u();return this.abs().divRemTo(c,null,d),this.s<0&&d.compareTo(a.ZERO)>0&&c.subTo(d,d),d;}function $(c){this.m=c;}function _(c){return c.s<0||c.compareTo(this.m)>=0?c.mod(this.m):c;}function H(c){return c;}function lt(c){c.divRemTo(this.m,null,c);}function dt(c,d,m){c.multiplyTo(d,m),this.reduce(m);}function wt(c,d){c.squareTo(d),this.reduce(d);}$.prototype.convert=_,$.prototype.revert=H,$.prototype.reduce=lt,$.prototype.mulTo=dt,$.prototype.sqrTo=wt;function Et(){if(this.t<1)return 0;var c=this[0];if(!(c&1))return 0;var d=c&3;return d=d*(2-(c&15)*d)&15,d=d*(2-(c&255)*d)&255,d=d*(2-((c&65535)*d&65535))&65535,d=d*(2-c*d%this.DV)%this.DV,d>0?this.DV-d:-d;}function Ot(c){this.m=c,this.mp=c.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<c.DB-15)-1,this.mt2=2*c.t;}function O(c){var d=u();return c.abs().dlShiftTo(this.m.t,d),d.divRemTo(this.m,null,d),c.s<0&&d.compareTo(a.ZERO)>0&&this.m.subTo(d,d),d;}function D(c){var d=u();return c.copyTo(d),this.reduce(d),d;}function J(c){for(;c.t<=this.mt2;)c[c.t++]=0;for(var d=0;d<this.m.t;++d){var m=c[d]&32767,E=m*this.mpl+((m*this.mph+(c[d]>>15)*this.mpl&this.um)<<15)&c.DM;for(m=d+this.m.t,c[m]+=this.m.am(0,E,c,d,0,this.m.t);c[m]>=c.DV;)c[m]-=c.DV,c[++m]++;}c.clamp(),c.drShiftTo(this.m.t,c),c.compareTo(this.m)>=0&&c.subTo(this.m,c);}function Q(c,d){c.squareTo(d),this.reduce(d);}function V(c,d,m){c.multiplyTo(d,m),this.reduce(m);}Ot.prototype.convert=O,Ot.prototype.revert=D,Ot.prototype.reduce=J,Ot.prototype.mulTo=V,Ot.prototype.sqrTo=Q;function tt(){return(this.t>0?this[0]&1:this.s)==0;}function g(c,d){if(c>4294967295||c<1)return a.ONE;var m=u(),E=u(),F=d.convert(this),rt=j(c)-1;for(F.copyTo(m);--rt>=0;)if(d.sqrTo(m,E),(c&1<<rt)>0)d.mulTo(E,F,m);else{var vt=m;m=E,E=vt;}return d.revert(m);}function T(c,d){var m;return c<256||d.isEven()?m=new $(d):m=new Ot(d),this.exp(c,m);}a.prototype.copyTo=et,a.prototype.fromInt=A,a.prototype.fromString=S,a.prototype.clamp=x,a.prototype.dlShiftTo=ct,a.prototype.drShiftTo=B,a.prototype.lShiftTo=N,a.prototype.rShiftTo=G,a.prototype.subTo=q,a.prototype.multiplyTo=at,a.prototype.squareTo=ut,a.prototype.divRemTo=Ct,a.prototype.invDigit=Et,a.prototype.isEven=tt,a.prototype.exp=g,a.prototype.toString=P,a.prototype.negate=z,a.prototype.abs=U,a.prototype.compareTo=K,a.prototype.bitLength=nt,a.prototype.mod=R,a.prototype.modPowInt=T,a.ZERO=w(0),a.ONE=w(1);function k(){var c=u();return this.copyTo(c),c;}function Z(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1;}else{if(this.t==1)return this[0];if(this.t==0)return 0;}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0];}function st(){return this.t==0?this.s:this[0]<<24>>24;}function ft(){return this.t==0?this.s:this[0]<<16>>16;}function pt(c){return Math.floor(Math.LN2*this.DB/Math.log(c));}function ot(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1;}function mt(c){if(c==null&&(c=10),this.signum()==0||c<2||c>36)return"0";var d=this.chunkSize(c),m=Math.pow(c,d),E=w(m),F=u(),rt=u(),vt="";for(this.divRemTo(E,F,rt);F.signum()>0;)vt=(m+rt.intValue()).toString(c).substr(1)+vt,F.divRemTo(E,F,rt);return rt.intValue().toString(c)+vt;}function Tt(c,d){this.fromInt(0),d==null&&(d=10);for(var m=this.chunkSize(d),E=Math.pow(d,m),F=!1,rt=0,vt=0,At=0;At<c.length;++At){var Mt=Y(c,At);if(Mt<0){c.charAt(At)=="-"&&this.signum()==0&&(F=!0);continue;}vt=d*vt+Mt,++rt>=m&&(this.dMultiply(E),this.dAddOffset(vt,0),rt=0,vt=0);}rt>0&&(this.dMultiply(Math.pow(d,rt)),this.dAddOffset(vt,0)),F&&a.ZERO.subTo(this,this);}function Pt(c,d,m){if(typeof d=="number"){if(c<2)this.fromInt(1);else for(this.fromNumber(c,m),this.testBit(c-1)||this.bitwiseTo(a.ONE.shiftLeft(c-1),ee,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(d);)this.dAddOffset(2,0),this.bitLength()>c&&this.subTo(a.ONE.shiftLeft(c-1),this);}else{var E=new Array(),F=c&7;E.length=(c>>3)+1,d.nextBytes(E),F>0?E[0]&=(1<<F)-1:E[0]=0,this.fromString(E,256);}}function Lt(){var c=this.t,d=new Array();d[0]=this.s;var m=this.DB-c*this.DB%8,E,F=0;if(c-->0)for(m<this.DB&&(E=this[c]>>m)!=(this.s&this.DM)>>m&&(d[F++]=E|this.s<<this.DB-m);c>=0;)m<8?(E=(this[c]&(1<<m)-1)<<8-m,E|=this[--c]>>(m+=this.DB-8)):(E=this[c]>>(m-=8)&255,m<=0&&(m+=this.DB,--c)),E&128&&(E|=-256),F==0&&(this.s&128)!=(E&128)&&++F,(F>0||E!=this.s)&&(d[F++]=E);return d;}function Dt(c){return this.compareTo(c)==0;}function Nt(c){return this.compareTo(c)<0?this:c;}function Yt(c){return this.compareTo(c)>0?this:c;}function Ut(c,d,m){var E,F,rt=Math.min(c.t,this.t);for(E=0;E<rt;++E)m[E]=d(this[E],c[E]);if(c.t<this.t){for(F=c.s&this.DM,E=rt;E<this.t;++E)m[E]=d(this[E],F);m.t=this.t;}else{for(F=this.s&this.DM,E=rt;E<c.t;++E)m[E]=d(F,c[E]);m.t=c.t;}m.s=d(this.s,c.s),m.clamp();}function Ft(c,d){return c&d;}function Jt(c){var d=u();return this.bitwiseTo(c,Ft,d),d;}function ee(c,d){return c|d;}function re(c){var d=u();return this.bitwiseTo(c,ee,d),d;}function se(c,d){return c^d;}function oe(c){var d=u();return this.bitwiseTo(c,se,d),d;}function le(c,d){return c&~d;}function Re(c){var d=u();return this.bitwiseTo(c,le,d),d;}function Oe(){for(var c=u(),d=0;d<this.t;++d)c[d]=this.DM&~this[d];return c.t=this.t,c.s=~this.s,c;}function ke(c){var d=u();return c<0?this.rShiftTo(-c,d):this.lShiftTo(c,d),d;}function Be(c){var d=u();return c<0?this.lShiftTo(-c,d):this.rShiftTo(c,d),d;}function Ge(c){if(c==0)return-1;var d=0;return c&65535||(c>>=16,d+=16),c&255||(c>>=8,d+=8),c&15||(c>>=4,d+=4),c&3||(c>>=2,d+=2),c&1||++d,d;}function He(){for(var c=0;c<this.t;++c)if(this[c]!=0)return c*this.DB+Ge(this[c]);return this.s<0?this.t*this.DB:-1;}function je(c){for(var d=0;c!=0;)c&=c-1,++d;return d;}function ye(){for(var c=0,d=this.s&this.DM,m=0;m<this.t;++m)c+=je(this[m]^d);return c;}function lr(c){var d=Math.floor(c/this.DB);return d>=this.t?this.s!=0:(this[d]&1<<c%this.DB)!=0;}function en(c,d){var m=a.ONE.shiftLeft(c);return this.bitwiseTo(m,d,m),m;}function rn(c){return this.changeBit(c,ee);}function Gn(c){return this.changeBit(c,le);}function jn(c){return this.changeBit(c,se);}function Qo(c,d){for(var m=0,E=0,F=Math.min(c.t,this.t);m<F;)E+=this[m]+c[m],d[m++]=E&this.DM,E>>=this.DB;if(c.t<this.t){for(E+=c.s;m<this.t;)E+=this[m],d[m++]=E&this.DM,E>>=this.DB;E+=this.s;}else{for(E+=this.s;m<c.t;)E+=c[m],d[m++]=E&this.DM,E>>=this.DB;E+=c.s;}d.s=E<0?-1:0,E>0?d[m++]=E:E<-1&&(d[m++]=this.DV+E),d.t=m,d.clamp();}function Li(c){var d=u();return this.addTo(c,d),d;}function Jo(c){var d=u();return this.subTo(c,d),d;}function _o(c){var d=u();return this.multiplyTo(c,d),d;}function Ks(){var c=u();return this.squareTo(c),c;}function Qs(c){var d=u();return this.divRemTo(c,d,null),d;}function Js(c){var d=u();return this.divRemTo(c,null,d),d;}function cs(c){var d=u(),m=u();return this.divRemTo(c,d,m),new Array(d,m);}function ta(c){this[this.t]=this.am(0,c-1,this,0,0,this.t),++this.t,this.clamp();}function ea(c,d){if(c!=0){for(;this.t<=d;)this[this.t++]=0;for(this[d]+=c;this[d]>=this.DV;)this[d]-=this.DV,++d>=this.t&&(this[this.t++]=0),++this[d];}}function An(){}function us(c){return c;}function _s(c,d,m){c.multiplyTo(d,m);}function Sf(c,d){c.squareTo(d);}An.prototype.convert=us,An.prototype.revert=us,An.prototype.mulTo=_s,An.prototype.sqrTo=Sf;function Tf(c){return this.exp(c,new An());}function If(c,d,m){var E=Math.min(this.t+c.t,d);for(m.s=0,m.t=E;E>0;)m[--E]=0;var F;for(F=m.t-this.t;E<F;++E)m[E+this.t]=this.am(0,c[E],m,E,0,this.t);for(F=Math.min(c.t,d);E<F;++E)this.am(0,c[E],m,E,0,d-E);m.clamp();}function Cf(c,d,m){--d;var E=m.t=this.t+c.t-d;for(m.s=0;--E>=0;)m[E]=0;for(E=Math.max(d-this.t,0);E<c.t;++E)m[this.t+E-d]=this.am(d-E,c[E],m,0,0,this.t+E-d);m.clamp(),m.drShiftTo(1,m);}function En(c){this.r2=u(),this.q3=u(),a.ONE.dlShiftTo(2*c.t,this.r2),this.mu=this.r2.divide(c),this.m=c;}function xf(c){if(c.s<0||c.t>2*this.m.t)return c.mod(this.m);if(c.compareTo(this.m)<0)return c;var d=u();return c.copyTo(d),this.reduce(d),d;}function to(c){return c;}function Pf(c){for(c.drShiftTo(this.m.t-1,this.r2),c.t>this.m.t+1&&(c.t=this.m.t+1,c.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);c.compareTo(this.r2)<0;)c.dAddOffset(1,this.m.t+1);for(c.subTo(this.r2,c);c.compareTo(this.m)>=0;)c.subTo(this.m,c);}function bf(c,d){c.squareTo(d),this.reduce(d);}function Af(c,d,m){c.multiplyTo(d,m),this.reduce(m);}En.prototype.convert=xf,En.prototype.revert=to,En.prototype.reduce=Pf,En.prototype.mulTo=Af,En.prototype.sqrTo=bf;function yl(c,d){var m=c.bitLength(),E,F=w(1),rt;if(m<=0)return F;m<18?E=1:m<48?E=3:m<144?E=4:m<768?E=5:E=6,m<8?rt=new $(d):d.isEven()?rt=new En(d):rt=new Ot(d);var vt=new Array(),At=3,Mt=E-1,Wt=(1<<E)-1;if(vt[1]=rt.convert(this),E>1){var Zt=u();for(rt.sqrTo(vt[1],Zt);At<=Wt;)vt[At]=u(),rt.mulTo(Zt,vt[At-2],vt[At]),At+=2;}var Xt=c.t-1,ne,ue=!0,Se=u(),Ie;for(m=j(c[Xt])-1;Xt>=0;){for(m>=Mt?ne=c[Xt]>>m-Mt&Wt:(ne=(c[Xt]&(1<<m+1)-1)<<Mt-m,Xt>0&&(ne|=c[Xt-1]>>this.DB+m-Mt)),At=E;!(ne&1);)ne>>=1,--At;if((m-=At)<0&&(m+=this.DB,--Xt),ue)vt[ne].copyTo(F),ue=!1;else{for(;At>1;)rt.sqrTo(F,Se),rt.sqrTo(Se,F),At-=2;At>0?rt.sqrTo(F,Se):(Ie=F,F=Se,Se=Ie),rt.mulTo(Se,vt[ne],F);}for(;Xt>=0&&!(c[Xt]&1<<m);)rt.sqrTo(F,Se),Ie=F,F=Se,Se=Ie,--m<0&&(m=this.DB-1,--Xt);}return rt.revert(F);}function wl(c){var d=this.s<0?this.negate():this.clone(),m=c.s<0?c.negate():c.clone();if(d.compareTo(m)<0){var E=d;d=m,m=E;}var F=d.getLowestSetBit(),rt=m.getLowestSetBit();if(rt<0)return d;for(F<rt&&(rt=F),rt>0&&(d.rShiftTo(rt,d),m.rShiftTo(rt,m));d.signum()>0;)(F=d.getLowestSetBit())>0&&d.rShiftTo(F,d),(F=m.getLowestSetBit())>0&&m.rShiftTo(F,m),d.compareTo(m)>=0?(d.subTo(m,d),d.rShiftTo(1,d)):(m.subTo(d,m),m.rShiftTo(1,m));return rt>0&&m.lShiftTo(rt,m),m;}function Sl(c){if(c<=0)return 0;var d=this.DV%c,m=this.s<0?c-1:0;if(this.t>0)if(d==0)m=this[0]%c;else for(var E=this.t-1;E>=0;--E)m=(d*m+this[E])%c;return m;}function Ef(c){var d=c.isEven();if(this.isEven()&&d||c.signum()==0)return a.ZERO;for(var m=c.clone(),E=this.clone(),F=w(1),rt=w(0),vt=w(0),At=w(1);m.signum()!=0;){for(;m.isEven();)m.rShiftTo(1,m),d?((!F.isEven()||!rt.isEven())&&(F.addTo(this,F),rt.subTo(c,rt)),F.rShiftTo(1,F)):rt.isEven()||rt.subTo(c,rt),rt.rShiftTo(1,rt);for(;E.isEven();)E.rShiftTo(1,E),d?((!vt.isEven()||!At.isEven())&&(vt.addTo(this,vt),At.subTo(c,At)),vt.rShiftTo(1,vt)):At.isEven()||At.subTo(c,At),At.rShiftTo(1,At);m.compareTo(E)>=0?(m.subTo(E,m),d&&F.subTo(vt,F),rt.subTo(At,rt)):(E.subTo(m,E),d&&vt.subTo(F,vt),At.subTo(rt,At));}if(E.compareTo(a.ONE)!=0)return a.ZERO;if(At.compareTo(c)>=0)return At.subtract(c);if(At.signum()<0)At.addTo(c,At);else return At;return At.signum()<0?At.add(c):At;}var Tr=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Mf=(1<<26)/Tr[Tr.length-1];function Lf(c){var d,m=this.abs();if(m.t==1&&m[0]<=Tr[Tr.length-1]){for(d=0;d<Tr.length;++d)if(m[0]==Tr[d])return!0;return!1;}if(m.isEven())return!1;for(d=1;d<Tr.length;){for(var E=Tr[d],F=d+1;F<Tr.length&&E<Mf;)E*=Tr[F++];for(E=m.modInt(E);d<F;)if(E%Tr[d++]==0)return!1;}return m.millerRabin(c);}function Tl(c){var d=this.subtract(a.ONE),m=d.getLowestSetBit();if(m<=0)return!1;var E=d.shiftRight(m);c=c+1>>1,c>Tr.length&&(c=Tr.length);for(var F=u(),rt=0;rt<c;++rt){F.fromInt(Tr[Math.floor(Math.random()*Tr.length)]);var vt=F.modPow(E,this);if(vt.compareTo(a.ONE)!=0&&vt.compareTo(d)!=0){for(var At=1;At++<m&&vt.compareTo(d)!=0;)if(vt=vt.modPowInt(2,this),vt.compareTo(a.ONE)==0)return!1;if(vt.compareTo(d)!=0)return!1;}}return!0;}a.prototype.chunkSize=pt,a.prototype.toRadix=mt,a.prototype.fromRadix=Tt,a.prototype.fromNumber=Pt,a.prototype.bitwiseTo=Ut,a.prototype.changeBit=en,a.prototype.addTo=Qo,a.prototype.dMultiply=ta,a.prototype.dAddOffset=ea,a.prototype.multiplyLowerTo=If,a.prototype.multiplyUpperTo=Cf,a.prototype.modInt=Sl,a.prototype.millerRabin=Tl,a.prototype.clone=k,a.prototype.intValue=Z,a.prototype.byteValue=st,a.prototype.shortValue=ft,a.prototype.signum=ot,a.prototype.toByteArray=Lt,a.prototype.equals=Dt,a.prototype.min=Nt,a.prototype.max=Yt,a.prototype.and=Jt,a.prototype.or=re,a.prototype.xor=oe,a.prototype.andNot=Re,a.prototype.not=Oe,a.prototype.shiftLeft=ke,a.prototype.shiftRight=Be,a.prototype.getLowestSetBit=He,a.prototype.bitCount=ye,a.prototype.testBit=lr,a.prototype.setBit=rn,a.prototype.clearBit=Gn,a.prototype.flipBit=jn,a.prototype.add=Li,a.prototype.subtract=Jo,a.prototype.multiply=_o,a.prototype.divide=Qs,a.prototype.remainder=Js,a.prototype.divideAndRemainder=cs,a.prototype.modPow=yl,a.prototype.modInverse=Ef,a.prototype.pow=Tf,a.prototype.gcd=wl,a.prototype.isProbablePrime=Lf,a.prototype.square=Ks;var we=a;we.prototype.IsNegative=function(){return this.compareTo(we.ZERO)==-1;},we.op_Equality=function(c,d){return c.compareTo(d)==0;},we.op_Inequality=function(c,d){return c.compareTo(d)!=0;},we.op_GreaterThan=function(c,d){return c.compareTo(d)>0;},we.op_LessThan=function(c,d){return c.compareTo(d)<0;},we.op_Addition=function(c,d){return new we(c,void 0,void 0).add(new we(d,void 0,void 0));},we.op_Subtraction=function(c,d){return new we(c,void 0,void 0).subtract(new we(d,void 0,void 0));},we.Int128Mul=function(c,d){return new we(c,void 0,void 0).multiply(new we(d,void 0,void 0));},we.op_Division=function(c,d){return c.divide(d);},we.prototype.ToDouble=function(){return parseFloat(this.toString());};var ra=function ra(c,d){var m;if(_typeof(Object.getOwnPropertyNames)>"u"){for(m in d.prototype)(_typeof(c.prototype[m])>"u"||c.prototype[m]===Object.prototype[m])&&(c.prototype[m]=d.prototype[m]);for(m in d)_typeof(c[m])>"u"&&(c[m]=d[m]);c.$baseCtor=d;}else{for(var E=Object.getOwnPropertyNames(d.prototype),F=0;F<E.length;F++)_typeof(Object.getOwnPropertyDescriptor(c.prototype,E[F]))>"u"&&Object.defineProperty(c.prototype,E[F],Object.getOwnPropertyDescriptor(d.prototype,E[F]));for(m in d)_typeof(c[m])>"u"&&(c[m]=d[m]);c.$baseCtor=d;}};t.Path=function(){return[];},t.Path.prototype.push=Array.prototype.push,t.Paths=function(){return[];},t.Paths.prototype.push=Array.prototype.push,t.DoublePoint=function(){var c=arguments;this.X=0,this.Y=0,c.length===1?(this.X=c[0].X,this.Y=c[0].Y):c.length===2&&(this.X=c[0],this.Y=c[1]);},t.DoublePoint0=function(){this.X=0,this.Y=0;},t.DoublePoint0.prototype=t.DoublePoint.prototype,t.DoublePoint1=function(c){this.X=c.X,this.Y=c.Y;},t.DoublePoint1.prototype=t.DoublePoint.prototype,t.DoublePoint2=function(c,d){this.X=c,this.Y=d;},t.DoublePoint2.prototype=t.DoublePoint.prototype,t.PolyNode=function(){this.m_Parent=null,this.m_polygon=new t.Path(),this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1;},t.PolyNode.prototype.IsHoleNode=function(){for(var c=!0,d=this.m_Parent;d!==null;)c=!c,d=d.m_Parent;return c;},t.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length;},t.PolyNode.prototype.Contour=function(){return this.m_polygon;},t.PolyNode.prototype.AddChild=function(c){var d=this.m_Childs.length;this.m_Childs.push(c),c.m_Parent=this,c.m_Index=d;},t.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp();},t.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1];},t.PolyNode.prototype.Childs=function(){return this.m_Childs;},t.PolyNode.prototype.Parent=function(){return this.m_Parent;},t.PolyNode.prototype.IsHole=function(){return this.IsHoleNode();},t.PolyTree=function(){this.m_AllPolys=[],t.PolyNode.call(this);},t.PolyTree.prototype.Clear=function(){for(var c=0,d=this.m_AllPolys.length;c<d;c++)this.m_AllPolys[c]=null;this.m_AllPolys.length=0,this.m_Childs.length=0;},t.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null;},t.PolyTree.prototype.Total=function(){var c=this.m_AllPolys.length;return c>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&c--,c;},ra(t.PolyTree,t.PolyNode),t.Math_Abs_Int64=t.Math_Abs_Int32=t.Math_Abs_Double=function(c){return Math.abs(c);},t.Math_Max_Int32_Int32=function(c,d){return Math.max(c,d);},s.msie||s.opera||s.safari?t.Cast_Int32=function(c){return c|0;}:t.Cast_Int32=function(c){return~~c;},_typeof(Number.toInteger)>"u"&&(Number.toInteger=null),s.chrome?t.Cast_Int64=function(c){return c<-2147483648||c>2147483647?c<0?Math.ceil(c):Math.floor(c):~~c;}:s.firefox&&typeof Number.toInteger=="function"?t.Cast_Int64=function(c){return Number.toInteger(c);}:s.msie7||s.msie8?t.Cast_Int64=function(c){return parseInt(c,10);}:s.msie?t.Cast_Int64=function(c){return c<-2147483648||c>2147483647?c<0?Math.ceil(c):Math.floor(c):c|0;}:t.Cast_Int64=function(c){return c<0?Math.ceil(c):Math.floor(c);},t.Clear=function(c){c.length=0;},t.PI=3.141592653589793,t.PI2=2*3.141592653589793,t.IntPoint=function(){var c=arguments,d=c.length;if(this.X=0,this.Y=0,t.use_xyz){if(this.Z=0,d===3)this.X=c[0],this.Y=c[1],this.Z=c[2];else if(d===2)this.X=c[0],this.Y=c[1],this.Z=0;else if(d===1){if(c[0]instanceof t.DoublePoint){var m=c[0];this.X=t.Clipper.Round(m.X),this.Y=t.Clipper.Round(m.Y),this.Z=0;}else{var E=c[0];_typeof(E.Z)>"u"&&(E.Z=0),this.X=E.X,this.Y=E.Y,this.Z=E.Z;}}else this.X=0,this.Y=0,this.Z=0;}else if(d===2)this.X=c[0],this.Y=c[1];else if(d===1){if(c[0]instanceof t.DoublePoint){var m=c[0];this.X=t.Clipper.Round(m.X),this.Y=t.Clipper.Round(m.Y);}else{var E=c[0];this.X=E.X,this.Y=E.Y;}}else this.X=0,this.Y=0;},t.IntPoint.op_Equality=function(c,d){return c.X===d.X&&c.Y===d.Y;},t.IntPoint.op_Inequality=function(c,d){return c.X!==d.X||c.Y!==d.Y;},t.IntPoint0=function(){this.X=0,this.Y=0,t.use_xyz&&(this.Z=0);},t.IntPoint0.prototype=t.IntPoint.prototype,t.IntPoint1=function(c){this.X=c.X,this.Y=c.Y,t.use_xyz&&(_typeof(c.Z)>"u"?this.Z=0:this.Z=c.Z);},t.IntPoint1.prototype=t.IntPoint.prototype,t.IntPoint1dp=function(c){this.X=t.Clipper.Round(c.X),this.Y=t.Clipper.Round(c.Y),t.use_xyz&&(this.Z=0);},t.IntPoint1dp.prototype=t.IntPoint.prototype,t.IntPoint2=function(c,d,m){this.X=c,this.Y=d,t.use_xyz&&(_typeof(m)>"u"?this.Z=0:this.Z=m);},t.IntPoint2.prototype=t.IntPoint.prototype,t.IntRect=function(){var c=arguments,d=c.length;if(d===4)this.left=c[0],this.top=c[1],this.right=c[2],this.bottom=c[3];else if(d===1){var m=c[0];this.left=m.left,this.top=m.top,this.right=m.right,this.bottom=m.bottom;}else this.left=0,this.top=0,this.right=0,this.bottom=0;},t.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0;},t.IntRect0.prototype=t.IntRect.prototype,t.IntRect1=function(c){this.left=c.left,this.top=c.top,this.right=c.right,this.bottom=c.bottom;},t.IntRect1.prototype=t.IntRect.prototype,t.IntRect4=function(c,d,m,E){this.left=c,this.top=d,this.right=m,this.bottom=E;},t.IntRect4.prototype=t.IntRect.prototype,t.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},t.PolyType={ptSubject:0,ptClip:1},t.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},t.JoinType={jtSquare:0,jtRound:1,jtMiter:2},t.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},t.EdgeSide={esLeft:0,esRight:1},t.Direction={dRightToLeft:0,dLeftToRight:1},t.TEdge=function(){this.Bot=new t.IntPoint0(),this.Curr=new t.IntPoint0(),this.Top=new t.IntPoint0(),this.Delta=new t.IntPoint0(),this.Dx=0,this.PolyTyp=t.PolyType.ptSubject,this.Side=t.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null;},t.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new t.IntPoint0();},t.MyIntersectNodeSort=function(){},t.MyIntersectNodeSort.Compare=function(c,d){var m=d.Pt.Y-c.Pt.Y;return m>0?1:m<0?-1:0;},t.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null;},t.Scanbeam=function(){this.Y=0,this.Next=null;},t.Maxima=function(){this.X=0,this.Next=null,this.Prev=null;},t.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null;},t.OutPt=function(){this.Idx=0,this.Pt=new t.IntPoint0(),this.Next=null,this.Prev=null;},t.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new t.IntPoint0();},t.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array(),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null;},t.ClipperBase.horizontal=-9007199254740992,t.ClipperBase.Skip=-2,t.ClipperBase.Unassigned=-1,t.ClipperBase.tolerance=1e-20,t.ClipperBase.loRange=47453132,t.ClipperBase.hiRange=4503599627370495,t.ClipperBase.near_zero=function(c){return c>-t.ClipperBase.tolerance&&c<t.ClipperBase.tolerance;},t.ClipperBase.IsHorizontal=function(c){return c.Delta.Y===0;},t.ClipperBase.prototype.PointIsVertex=function(c,d){var m=d;do{if(t.IntPoint.op_Equality(m.Pt,c))return!0;m=m.Next;}while(m!==d);return!1;},t.ClipperBase.prototype.PointOnLineSegment=function(c,d,m,E){return E?c.X===d.X&&c.Y===d.Y||c.X===m.X&&c.Y===m.Y||c.X>d.X==c.X<m.X&&c.Y>d.Y==c.Y<m.Y&&we.op_Equality(we.Int128Mul(c.X-d.X,m.Y-d.Y),we.Int128Mul(m.X-d.X,c.Y-d.Y)):c.X===d.X&&c.Y===d.Y||c.X===m.X&&c.Y===m.Y||c.X>d.X==c.X<m.X&&c.Y>d.Y==c.Y<m.Y&&(c.X-d.X)*(m.Y-d.Y)===(m.X-d.X)*(c.Y-d.Y);},t.ClipperBase.prototype.PointOnPolygon=function(c,d,m){for(var E=d;;){if(this.PointOnLineSegment(c,E.Pt,E.Next.Pt,m))return!0;if(E=E.Next,E===d)break;}return!1;},t.ClipperBase.prototype.SlopesEqual=t.ClipperBase.SlopesEqual=function(){var c=arguments,d=c.length,m,E,F,rt,vt,At,Mt;return d===3?(m=c[0],E=c[1],Mt=c[2],Mt?we.op_Equality(we.Int128Mul(m.Delta.Y,E.Delta.X),we.Int128Mul(m.Delta.X,E.Delta.Y)):t.Cast_Int64(m.Delta.Y*E.Delta.X)===t.Cast_Int64(m.Delta.X*E.Delta.Y)):d===4?(F=c[0],rt=c[1],vt=c[2],Mt=c[3],Mt?we.op_Equality(we.Int128Mul(F.Y-rt.Y,rt.X-vt.X),we.Int128Mul(F.X-rt.X,rt.Y-vt.Y)):t.Cast_Int64((F.Y-rt.Y)*(rt.X-vt.X))-t.Cast_Int64((F.X-rt.X)*(rt.Y-vt.Y))===0):(F=c[0],rt=c[1],vt=c[2],At=c[3],Mt=c[4],Mt?we.op_Equality(we.Int128Mul(F.Y-rt.Y,vt.X-At.X),we.Int128Mul(F.X-rt.X,vt.Y-At.Y)):t.Cast_Int64((F.Y-rt.Y)*(vt.X-At.X))-t.Cast_Int64((F.X-rt.X)*(vt.Y-At.Y))===0);},t.ClipperBase.SlopesEqual3=function(c,d,m){return m?we.op_Equality(we.Int128Mul(c.Delta.Y,d.Delta.X),we.Int128Mul(c.Delta.X,d.Delta.Y)):t.Cast_Int64(c.Delta.Y*d.Delta.X)===t.Cast_Int64(c.Delta.X*d.Delta.Y);},t.ClipperBase.SlopesEqual4=function(c,d,m,E){return E?we.op_Equality(we.Int128Mul(c.Y-d.Y,d.X-m.X),we.Int128Mul(c.X-d.X,d.Y-m.Y)):t.Cast_Int64((c.Y-d.Y)*(d.X-m.X))-t.Cast_Int64((c.X-d.X)*(d.Y-m.Y))===0;},t.ClipperBase.SlopesEqual5=function(c,d,m,E,F){return F?we.op_Equality(we.Int128Mul(c.Y-d.Y,m.X-E.X),we.Int128Mul(c.X-d.X,m.Y-E.Y)):t.Cast_Int64((c.Y-d.Y)*(m.X-E.X))-t.Cast_Int64((c.X-d.X)*(m.Y-E.Y))===0;},t.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var c=0,d=this.m_edges.length;c<d;++c){for(var m=0,E=this.m_edges[c].length;m<E;++m)this.m_edges[c][m]=null;t.Clear(this.m_edges[c]);}t.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1;},t.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var c=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=c;}this.m_CurrentLM=null;},t.ClipperBase.prototype.RangeTest=function(c,d){d.Value?(c.X>t.ClipperBase.hiRange||c.Y>t.ClipperBase.hiRange||-c.X>t.ClipperBase.hiRange||-c.Y>t.ClipperBase.hiRange)&&t.Error("Coordinate outside allowed range in RangeTest()."):(c.X>t.ClipperBase.loRange||c.Y>t.ClipperBase.loRange||-c.X>t.ClipperBase.loRange||-c.Y>t.ClipperBase.loRange)&&(d.Value=!0,this.RangeTest(c,d));},t.ClipperBase.prototype.InitEdge=function(c,d,m,E){c.Next=d,c.Prev=m,c.Curr.X=E.X,c.Curr.Y=E.Y,t.use_xyz&&(c.Curr.Z=E.Z),c.OutIdx=-1;},t.ClipperBase.prototype.InitEdge2=function(c,d){c.Curr.Y>=c.Next.Curr.Y?(c.Bot.X=c.Curr.X,c.Bot.Y=c.Curr.Y,t.use_xyz&&(c.Bot.Z=c.Curr.Z),c.Top.X=c.Next.Curr.X,c.Top.Y=c.Next.Curr.Y,t.use_xyz&&(c.Top.Z=c.Next.Curr.Z)):(c.Top.X=c.Curr.X,c.Top.Y=c.Curr.Y,t.use_xyz&&(c.Top.Z=c.Curr.Z),c.Bot.X=c.Next.Curr.X,c.Bot.Y=c.Next.Curr.Y,t.use_xyz&&(c.Bot.Z=c.Next.Curr.Z)),this.SetDx(c),c.PolyTyp=d;},t.ClipperBase.prototype.FindNextLocMin=function(c){for(var d;;){for(;t.IntPoint.op_Inequality(c.Bot,c.Prev.Bot)||t.IntPoint.op_Equality(c.Curr,c.Top);)c=c.Next;if(c.Dx!==t.ClipperBase.horizontal&&c.Prev.Dx!==t.ClipperBase.horizontal)break;for(;c.Prev.Dx===t.ClipperBase.horizontal;)c=c.Prev;for(d=c;c.Dx===t.ClipperBase.horizontal;)c=c.Next;if(c.Top.Y!==c.Prev.Bot.Y){d.Prev.Bot.X<c.Bot.X&&(c=d);break;}}return c;},t.ClipperBase.prototype.ProcessBound=function(c,d){var m,E=c,F;if(E.OutIdx===t.ClipperBase.Skip){if(c=E,d){for(;c.Top.Y===c.Next.Bot.Y;)c=c.Next;for(;c!==E&&c.Dx===t.ClipperBase.horizontal;)c=c.Prev;}else{for(;c.Top.Y===c.Prev.Bot.Y;)c=c.Prev;for(;c!==E&&c.Dx===t.ClipperBase.horizontal;)c=c.Next;}if(c===E)d?E=c.Next:E=c.Prev;else{d?c=E.Next:c=E.Prev;var rt=new t.LocalMinima();rt.Next=null,rt.Y=c.Bot.Y,rt.LeftBound=null,rt.RightBound=c,c.WindDelta=0,E=this.ProcessBound(c,d),this.InsertLocalMinima(rt);}return E;}if(c.Dx===t.ClipperBase.horizontal&&(d?m=c.Prev:m=c.Next,m.Dx===t.ClipperBase.horizontal?m.Bot.X!==c.Bot.X&&m.Top.X!==c.Bot.X&&this.ReverseHorizontal(c):m.Bot.X!==c.Bot.X&&this.ReverseHorizontal(c)),m=c,d){for(;E.Top.Y===E.Next.Bot.Y&&E.Next.OutIdx!==t.ClipperBase.Skip;)E=E.Next;if(E.Dx===t.ClipperBase.horizontal&&E.Next.OutIdx!==t.ClipperBase.Skip){for(F=E;F.Prev.Dx===t.ClipperBase.horizontal;)F=F.Prev;F.Prev.Top.X>E.Next.Top.X&&(E=F.Prev);}for(;c!==E;)c.NextInLML=c.Next,c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Prev.Top.X&&this.ReverseHorizontal(c),c=c.Next;c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Prev.Top.X&&this.ReverseHorizontal(c),E=E.Next;}else{for(;E.Top.Y===E.Prev.Bot.Y&&E.Prev.OutIdx!==t.ClipperBase.Skip;)E=E.Prev;if(E.Dx===t.ClipperBase.horizontal&&E.Prev.OutIdx!==t.ClipperBase.Skip){for(F=E;F.Next.Dx===t.ClipperBase.horizontal;)F=F.Next;(F.Next.Top.X===E.Prev.Top.X||F.Next.Top.X>E.Prev.Top.X)&&(E=F.Next);}for(;c!==E;)c.NextInLML=c.Prev,c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Next.Top.X&&this.ReverseHorizontal(c),c=c.Prev;c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Next.Top.X&&this.ReverseHorizontal(c),E=E.Prev;}return E;},t.ClipperBase.prototype.AddPath=function(c,d,m){t.use_lines?!m&&d===t.PolyType.ptClip&&t.Error("AddPath: Open paths must be subject."):m||t.Error("AddPath: Open paths have been disabled.");var E=c.length-1;if(m)for(;E>0&&t.IntPoint.op_Equality(c[E],c[0]);)--E;for(;E>0&&t.IntPoint.op_Equality(c[E],c[E-1]);)--E;if(m&&E<2||!m&&E<1)return!1;for(var F=new Array(),rt=0;rt<=E;rt++)F.push(new t.TEdge());var vt=!0;F[1].Curr.X=c[1].X,F[1].Curr.Y=c[1].Y,t.use_xyz&&(F[1].Curr.Z=c[1].Z);var At={Value:this.m_UseFullRange};this.RangeTest(c[0],At),this.m_UseFullRange=At.Value,At.Value=this.m_UseFullRange,this.RangeTest(c[E],At),this.m_UseFullRange=At.Value,this.InitEdge(F[0],F[1],F[E],c[0]),this.InitEdge(F[E],F[0],F[E-1],c[E]);for(var rt=E-1;rt>=1;--rt)At.Value=this.m_UseFullRange,this.RangeTest(c[rt],At),this.m_UseFullRange=At.Value,this.InitEdge(F[rt],F[rt+1],F[rt-1],c[rt]);for(var Mt=F[0],Wt=Mt,Zt=Mt;;){if(Wt.Curr===Wt.Next.Curr&&(m||Wt.Next!==Mt)){if(Wt===Wt.Next)break;Wt===Mt&&(Mt=Wt.Next),Wt=this.RemoveEdge(Wt),Zt=Wt;continue;}if(Wt.Prev===Wt.Next)break;if(m&&t.ClipperBase.SlopesEqual4(Wt.Prev.Curr,Wt.Curr,Wt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(Wt.Prev.Curr,Wt.Curr,Wt.Next.Curr))){Wt===Mt&&(Mt=Wt.Next),Wt=this.RemoveEdge(Wt),Wt=Wt.Prev,Zt=Wt;continue;}if(Wt=Wt.Next,Wt===Zt||!m&&Wt.Next===Mt)break;}if(!m&&Wt===Wt.Next||m&&Wt.Prev===Wt.Next)return!1;m||(this.m_HasOpenPaths=!0,Mt.Prev.OutIdx=t.ClipperBase.Skip),Wt=Mt;do this.InitEdge2(Wt,d),Wt=Wt.Next,vt&&Wt.Curr.Y!==Mt.Curr.Y&&(vt=!1);while(Wt!==Mt);if(vt){if(m)return!1;Wt.Prev.OutIdx=t.ClipperBase.Skip;var Xt=new t.LocalMinima();for(Xt.Next=null,Xt.Y=Wt.Bot.Y,Xt.LeftBound=null,Xt.RightBound=Wt,Xt.RightBound.Side=t.EdgeSide.esRight,Xt.RightBound.WindDelta=0;Wt.Bot.X!==Wt.Prev.Top.X&&this.ReverseHorizontal(Wt),Wt.Next.OutIdx!==t.ClipperBase.Skip;)Wt.NextInLML=Wt.Next,Wt=Wt.Next;return this.InsertLocalMinima(Xt),this.m_edges.push(F),!0;}this.m_edges.push(F);var ne,ue=null;for(t.IntPoint.op_Equality(Wt.Prev.Bot,Wt.Prev.Top)&&(Wt=Wt.Next);Wt=this.FindNextLocMin(Wt),Wt!==ue;){ue===null&&(ue=Wt);var Xt=new t.LocalMinima();Xt.Next=null,Xt.Y=Wt.Bot.Y,Wt.Dx<Wt.Prev.Dx?(Xt.LeftBound=Wt.Prev,Xt.RightBound=Wt,ne=!1):(Xt.LeftBound=Wt,Xt.RightBound=Wt.Prev,ne=!0),Xt.LeftBound.Side=t.EdgeSide.esLeft,Xt.RightBound.Side=t.EdgeSide.esRight,m?Xt.LeftBound.Next===Xt.RightBound?Xt.LeftBound.WindDelta=-1:Xt.LeftBound.WindDelta=1:Xt.LeftBound.WindDelta=0,Xt.RightBound.WindDelta=-Xt.LeftBound.WindDelta,Wt=this.ProcessBound(Xt.LeftBound,ne),Wt.OutIdx===t.ClipperBase.Skip&&(Wt=this.ProcessBound(Wt,ne));var Se=this.ProcessBound(Xt.RightBound,!ne);Se.OutIdx===t.ClipperBase.Skip&&(Se=this.ProcessBound(Se,!ne)),Xt.LeftBound.OutIdx===t.ClipperBase.Skip?Xt.LeftBound=null:Xt.RightBound.OutIdx===t.ClipperBase.Skip&&(Xt.RightBound=null),this.InsertLocalMinima(Xt),ne||(Wt=Se);}return!0;},t.ClipperBase.prototype.AddPaths=function(c,d,m){for(var E=!1,F=0,rt=c.length;F<rt;++F)this.AddPath(c[F],d,m)&&(E=!0);return E;},t.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(c,d,m){return t.IntPoint.op_Equality(c,m)||t.IntPoint.op_Equality(c,d)||t.IntPoint.op_Equality(m,d)?!1:c.X!==m.X?d.X>c.X==d.X<m.X:d.Y>c.Y==d.Y<m.Y;},t.ClipperBase.prototype.RemoveEdge=function(c){c.Prev.Next=c.Next,c.Next.Prev=c.Prev;var d=c.Next;return c.Prev=null,d;},t.ClipperBase.prototype.SetDx=function(c){c.Delta.X=c.Top.X-c.Bot.X,c.Delta.Y=c.Top.Y-c.Bot.Y,c.Delta.Y===0?c.Dx=t.ClipperBase.horizontal:c.Dx=c.Delta.X/c.Delta.Y;},t.ClipperBase.prototype.InsertLocalMinima=function(c){if(this.m_MinimaList===null)this.m_MinimaList=c;else if(c.Y>=this.m_MinimaList.Y)c.Next=this.m_MinimaList,this.m_MinimaList=c;else{for(var d=this.m_MinimaList;d.Next!==null&&c.Y<d.Next.Y;)d=d.Next;c.Next=d.Next,d.Next=c;}},t.ClipperBase.prototype.PopLocalMinima=function(c,d){return d.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===c?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1;},t.ClipperBase.prototype.ReverseHorizontal=function(c){var d=c.Top.X;c.Top.X=c.Bot.X,c.Bot.X=d,t.use_xyz&&(d=c.Top.Z,c.Top.Z=c.Bot.Z,c.Bot.Z=d);},t.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var c=this.m_MinimaList;c!==null;){this.InsertScanbeam(c.Y);var d=c.LeftBound;d!==null&&(d.Curr.X=d.Bot.X,d.Curr.Y=d.Bot.Y,t.use_xyz&&(d.Curr.Z=d.Bot.Z),d.OutIdx=t.ClipperBase.Unassigned),d=c.RightBound,d!==null&&(d.Curr.X=d.Bot.X,d.Curr.Y=d.Bot.Y,t.use_xyz&&(d.Curr.Z=d.Bot.Z),d.OutIdx=t.ClipperBase.Unassigned),c=c.Next;}this.m_ActiveEdges=null;}},t.ClipperBase.prototype.InsertScanbeam=function(c){if(this.m_Scanbeam===null)this.m_Scanbeam=new t.Scanbeam(),this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=c;else if(c>this.m_Scanbeam.Y){var d=new t.Scanbeam();d.Y=c,d.Next=this.m_Scanbeam,this.m_Scanbeam=d;}else{for(var m=this.m_Scanbeam;m.Next!==null&&c<=m.Next.Y;)m=m.Next;if(c===m.Y)return;var E=new t.Scanbeam();E.Y=c,E.Next=m.Next,m.Next=E;}},t.ClipperBase.prototype.PopScanbeam=function(c){return this.m_Scanbeam===null?(c.v=0,!1):(c.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0);},t.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null;},t.ClipperBase.prototype.CreateOutRec=function(){var c=new t.OutRec();return c.Idx=t.ClipperBase.Unassigned,c.IsHole=!1,c.IsOpen=!1,c.FirstLeft=null,c.Pts=null,c.BottomPt=null,c.PolyNode=null,this.m_PolyOuts.push(c),c.Idx=this.m_PolyOuts.length-1,c;},t.ClipperBase.prototype.DisposeOutRec=function(c){var d=this.m_PolyOuts[c];d.Pts=null,d=null,this.m_PolyOuts[c]=null;},t.ClipperBase.prototype.UpdateEdgeIntoAEL=function(c){c.NextInLML===null&&t.Error("UpdateEdgeIntoAEL: invalid call");var d=c.PrevInAEL,m=c.NextInAEL;return c.NextInLML.OutIdx=c.OutIdx,d!==null?d.NextInAEL=c.NextInLML:this.m_ActiveEdges=c.NextInLML,m!==null&&(m.PrevInAEL=c.NextInLML),c.NextInLML.Side=c.Side,c.NextInLML.WindDelta=c.WindDelta,c.NextInLML.WindCnt=c.WindCnt,c.NextInLML.WindCnt2=c.WindCnt2,c=c.NextInLML,c.Curr.X=c.Bot.X,c.Curr.Y=c.Bot.Y,c.PrevInAEL=d,c.NextInAEL=m,t.ClipperBase.IsHorizontal(c)||this.InsertScanbeam(c.Top.Y),c;},t.ClipperBase.prototype.SwapPositionsInAEL=function(c,d){if(!(c.NextInAEL===c.PrevInAEL||d.NextInAEL===d.PrevInAEL)){if(c.NextInAEL===d){var m=d.NextInAEL;m!==null&&(m.PrevInAEL=c);var E=c.PrevInAEL;E!==null&&(E.NextInAEL=d),d.PrevInAEL=E,d.NextInAEL=c,c.PrevInAEL=d,c.NextInAEL=m;}else if(d.NextInAEL===c){var F=c.NextInAEL;F!==null&&(F.PrevInAEL=d);var rt=d.PrevInAEL;rt!==null&&(rt.NextInAEL=c),c.PrevInAEL=rt,c.NextInAEL=d,d.PrevInAEL=c,d.NextInAEL=F;}else{var vt=c.NextInAEL,At=c.PrevInAEL;c.NextInAEL=d.NextInAEL,c.NextInAEL!==null&&(c.NextInAEL.PrevInAEL=c),c.PrevInAEL=d.PrevInAEL,c.PrevInAEL!==null&&(c.PrevInAEL.NextInAEL=c),d.NextInAEL=vt,d.NextInAEL!==null&&(d.NextInAEL.PrevInAEL=d),d.PrevInAEL=At,d.PrevInAEL!==null&&(d.PrevInAEL.NextInAEL=d);}c.PrevInAEL===null?this.m_ActiveEdges=c:d.PrevInAEL===null&&(this.m_ActiveEdges=d);}},t.ClipperBase.prototype.DeleteFromAEL=function(c){var d=c.PrevInAEL,m=c.NextInAEL;d===null&&m===null&&c!==this.m_ActiveEdges||(d!==null?d.NextInAEL=m:this.m_ActiveEdges=m,m!==null&&(m.PrevInAEL=d),c.NextInAEL=null,c.PrevInAEL=null);},t.Clipper=function(c){_typeof(c)>"u"&&(c=0),this.m_PolyOuts=null,this.m_ClipType=t.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=t.PolyFillType.pftEvenOdd,this.m_SubjFillType=t.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,t.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array(),this.m_IntersectNodeComparer=t.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array(),this.m_Joins=new Array(),this.m_GhostJoins=new Array(),this.ReverseSolution=(1&c)!==0,this.StrictlySimple=(2&c)!==0,this.PreserveCollinear=(4&c)!==0,t.use_xyz&&(this.ZFillFunction=null);},t.Clipper.ioReverseSolution=1,t.Clipper.ioStrictlySimple=2,t.Clipper.ioPreserveCollinear=4,t.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),t.ClipperBase.prototype.Clear.call(this));},t.Clipper.prototype.InsertMaxima=function(c){var d=new t.Maxima();if(d.X=c,this.m_Maxima===null)this.m_Maxima=d,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(c<this.m_Maxima.X)d.Next=this.m_Maxima,d.Prev=null,this.m_Maxima=d;else{for(var m=this.m_Maxima;m.Next!==null&&c>=m.Next.X;)m=m.Next;if(c===m.X)return;d.Next=m.Next,d.Prev=m,m.Next!==null&&(m.Next.Prev=d),m.Next=d;}},t.Clipper.prototype.Execute=function(){var c=arguments,d=c.length,m=c[1]instanceof t.PolyTree;if(d===4&&!m){var E=c[0],F=c[1],rt=c[2],vt=c[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&t.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,t.Clear(F),this.m_SubjFillType=rt,this.m_ClipFillType=vt,this.m_ClipType=E,this.m_UsingPolyTree=!1;try{var At=this.ExecuteInternal();At&&this.BuildResult(F);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return At;}else if(d===4&&m){var E=c[0],Mt=c[1],rt=c[2],vt=c[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=rt,this.m_ClipFillType=vt,this.m_ClipType=E,this.m_UsingPolyTree=!0;try{var At=this.ExecuteInternal();At&&this.BuildResult2(Mt);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return At;}else if(d===2&&!m){var E=c[0],F=c[1];return this.Execute(E,F,t.PolyFillType.pftEvenOdd,t.PolyFillType.pftEvenOdd);}else if(d===2&&m){var E=c[0],Mt=c[1];return this.Execute(E,Mt,t.PolyFillType.pftEvenOdd,t.PolyFillType.pftEvenOdd);}},t.Clipper.prototype.FixHoleLinkage=function(c){if(!(c.FirstLeft===null||c.IsHole!==c.FirstLeft.IsHole&&c.FirstLeft.Pts!==null)){for(var d=c.FirstLeft;d!==null&&(d.IsHole===c.IsHole||d.Pts===null);)d=d.FirstLeft;c.FirstLeft=d;}},t.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var c={},d={};if(!this.PopScanbeam(c))return!1;for(this.InsertLocalMinimaIntoAEL(c.v);this.PopScanbeam(d)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(d.v))return!1;this.ProcessEdgesAtTopOfScanbeam(d.v),c.v=d.v,this.InsertLocalMinimaIntoAEL(c.v);}var m,E,F;for(E=0,F=this.m_PolyOuts.length;E<F;E++)m=this.m_PolyOuts[E],!(m.Pts===null||m.IsOpen)&&(m.IsHole^this.ReverseSolution)==this.Area$1(m)>0&&this.ReversePolyPtLinks(m.Pts);for(this.JoinCommonEdges(),E=0,F=this.m_PolyOuts.length;E<F;E++)m=this.m_PolyOuts[E],m.Pts!==null&&(m.IsOpen?this.FixupOutPolyline(m):this.FixupOutPolygon(m));return this.StrictlySimple&&this.DoSimplePolygons(),!0;}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0;}},t.Clipper.prototype.DisposeAllPolyPts=function(){for(var c=0,d=this.m_PolyOuts.length;c<d;++c)this.DisposeOutRec(c);t.Clear(this.m_PolyOuts);},t.Clipper.prototype.AddJoin=function(c,d,m){var E=new t.Join();E.OutPt1=c,E.OutPt2=d,E.OffPt.X=m.X,E.OffPt.Y=m.Y,t.use_xyz&&(E.OffPt.Z=m.Z),this.m_Joins.push(E);},t.Clipper.prototype.AddGhostJoin=function(c,d){var m=new t.Join();m.OutPt1=c,m.OffPt.X=d.X,m.OffPt.Y=d.Y,t.use_xyz&&(m.OffPt.Z=d.Z),this.m_GhostJoins.push(m);},t.Clipper.prototype.SetZ=function(c,d,m){if(this.ZFillFunction!==null){if(c.Z!==0||this.ZFillFunction===null)return;t.IntPoint.op_Equality(c,d.Bot)?c.Z=d.Bot.Z:t.IntPoint.op_Equality(c,d.Top)?c.Z=d.Top.Z:t.IntPoint.op_Equality(c,m.Bot)?c.Z=m.Bot.Z:t.IntPoint.op_Equality(c,m.Top)?c.Z=m.Top.Z:this.ZFillFunction(d.Bot,d.Top,m.Bot,m.Top,c);}},t.Clipper.prototype.InsertLocalMinimaIntoAEL=function(c){for(var d={},m,E;this.PopLocalMinima(c,d);){m=d.v.LeftBound,E=d.v.RightBound;var F=null;if(m===null?(this.InsertEdgeIntoAEL(E,null),this.SetWindingCount(E),this.IsContributing(E)&&(F=this.AddOutPt(E,E.Bot))):E===null?(this.InsertEdgeIntoAEL(m,null),this.SetWindingCount(m),this.IsContributing(m)&&(F=this.AddOutPt(m,m.Bot)),this.InsertScanbeam(m.Top.Y)):(this.InsertEdgeIntoAEL(m,null),this.InsertEdgeIntoAEL(E,m),this.SetWindingCount(m),E.WindCnt=m.WindCnt,E.WindCnt2=m.WindCnt2,this.IsContributing(m)&&(F=this.AddLocalMinPoly(m,E,m.Bot)),this.InsertScanbeam(m.Top.Y)),E!==null&&(t.ClipperBase.IsHorizontal(E)?(E.NextInLML!==null&&this.InsertScanbeam(E.NextInLML.Top.Y),this.AddEdgeToSEL(E)):this.InsertScanbeam(E.Top.Y)),!(m===null||E===null)){if(F!==null&&t.ClipperBase.IsHorizontal(E)&&this.m_GhostJoins.length>0&&E.WindDelta!==0)for(var rt=0,vt=this.m_GhostJoins.length;rt<vt;rt++){var At=this.m_GhostJoins[rt];this.HorzSegmentsOverlap(At.OutPt1.Pt.X,At.OffPt.X,E.Bot.X,E.Top.X)&&this.AddJoin(At.OutPt1,F,At.OffPt);}if(m.OutIdx>=0&&m.PrevInAEL!==null&&m.PrevInAEL.Curr.X===m.Bot.X&&m.PrevInAEL.OutIdx>=0&&t.ClipperBase.SlopesEqual5(m.PrevInAEL.Curr,m.PrevInAEL.Top,m.Curr,m.Top,this.m_UseFullRange)&&m.WindDelta!==0&&m.PrevInAEL.WindDelta!==0){var Mt=this.AddOutPt(m.PrevInAEL,m.Bot);this.AddJoin(F,Mt,m.Top);}if(m.NextInAEL!==E){if(E.OutIdx>=0&&E.PrevInAEL.OutIdx>=0&&t.ClipperBase.SlopesEqual5(E.PrevInAEL.Curr,E.PrevInAEL.Top,E.Curr,E.Top,this.m_UseFullRange)&&E.WindDelta!==0&&E.PrevInAEL.WindDelta!==0){var Mt=this.AddOutPt(E.PrevInAEL,E.Bot);this.AddJoin(F,Mt,E.Top);}var Wt=m.NextInAEL;if(Wt!==null)for(;Wt!==E;)this.IntersectEdges(E,Wt,m.Curr),Wt=Wt.NextInAEL;}}}},t.Clipper.prototype.InsertEdgeIntoAEL=function(c,d){if(this.m_ActiveEdges===null)c.PrevInAEL=null,c.NextInAEL=null,this.m_ActiveEdges=c;else if(d===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,c))c.PrevInAEL=null,c.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=c,this.m_ActiveEdges=c;else{for(d===null&&(d=this.m_ActiveEdges);d.NextInAEL!==null&&!this.E2InsertsBeforeE1(d.NextInAEL,c);)d=d.NextInAEL;c.NextInAEL=d.NextInAEL,d.NextInAEL!==null&&(d.NextInAEL.PrevInAEL=c),c.PrevInAEL=d,d.NextInAEL=c;}},t.Clipper.prototype.E2InsertsBeforeE1=function(c,d){return d.Curr.X===c.Curr.X?d.Top.Y>c.Top.Y?d.Top.X<t.Clipper.TopX(c,d.Top.Y):c.Top.X>t.Clipper.TopX(d,c.Top.Y):d.Curr.X<c.Curr.X;},t.Clipper.prototype.IsEvenOddFillType=function(c){return c.PolyTyp===t.PolyType.ptSubject?this.m_SubjFillType===t.PolyFillType.pftEvenOdd:this.m_ClipFillType===t.PolyFillType.pftEvenOdd;},t.Clipper.prototype.IsEvenOddAltFillType=function(c){return c.PolyTyp===t.PolyType.ptSubject?this.m_ClipFillType===t.PolyFillType.pftEvenOdd:this.m_SubjFillType===t.PolyFillType.pftEvenOdd;},t.Clipper.prototype.IsContributing=function(c){var d,m;switch(c.PolyTyp===t.PolyType.ptSubject?(d=this.m_SubjFillType,m=this.m_ClipFillType):(d=this.m_ClipFillType,m=this.m_SubjFillType),d){case t.PolyFillType.pftEvenOdd:if(c.WindDelta===0&&c.WindCnt!==1)return!1;break;case t.PolyFillType.pftNonZero:if(Math.abs(c.WindCnt)!==1)return!1;break;case t.PolyFillType.pftPositive:if(c.WindCnt!==1)return!1;break;default:if(c.WindCnt!==-1)return!1;break;}switch(this.m_ClipType){case t.ClipType.ctIntersection:switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2!==0;case t.PolyFillType.pftPositive:return c.WindCnt2>0;default:return c.WindCnt2<0;}case t.ClipType.ctUnion:switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2===0;case t.PolyFillType.pftPositive:return c.WindCnt2<=0;default:return c.WindCnt2>=0;}case t.ClipType.ctDifference:if(c.PolyTyp===t.PolyType.ptSubject)switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2===0;case t.PolyFillType.pftPositive:return c.WindCnt2<=0;default:return c.WindCnt2>=0;}else switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2!==0;case t.PolyFillType.pftPositive:return c.WindCnt2>0;default:return c.WindCnt2<0;}case t.ClipType.ctXor:if(c.WindDelta===0)switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2===0;case t.PolyFillType.pftPositive:return c.WindCnt2<=0;default:return c.WindCnt2>=0;}else return!0;}return!0;},t.Clipper.prototype.SetWindingCount=function(c){for(var d=c.PrevInAEL;d!==null&&(d.PolyTyp!==c.PolyTyp||d.WindDelta===0);)d=d.PrevInAEL;if(d===null){var m=c.PolyTyp===t.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;c.WindDelta===0?c.WindCnt=m===t.PolyFillType.pftNegative?-1:1:c.WindCnt=c.WindDelta,c.WindCnt2=0,d=this.m_ActiveEdges;}else if(c.WindDelta===0&&this.m_ClipType!==t.ClipType.ctUnion)c.WindCnt=1,c.WindCnt2=d.WindCnt2,d=d.NextInAEL;else if(this.IsEvenOddFillType(c)){if(c.WindDelta===0){for(var E=!0,F=d.PrevInAEL;F!==null;)F.PolyTyp===d.PolyTyp&&F.WindDelta!==0&&(E=!E),F=F.PrevInAEL;c.WindCnt=E?0:1;}else c.WindCnt=c.WindDelta;c.WindCnt2=d.WindCnt2,d=d.NextInAEL;}else d.WindCnt*d.WindDelta<0?Math.abs(d.WindCnt)>1?d.WindDelta*c.WindDelta<0?c.WindCnt=d.WindCnt:c.WindCnt=d.WindCnt+c.WindDelta:c.WindCnt=c.WindDelta===0?1:c.WindDelta:c.WindDelta===0?c.WindCnt=d.WindCnt<0?d.WindCnt-1:d.WindCnt+1:d.WindDelta*c.WindDelta<0?c.WindCnt=d.WindCnt:c.WindCnt=d.WindCnt+c.WindDelta,c.WindCnt2=d.WindCnt2,d=d.NextInAEL;if(this.IsEvenOddAltFillType(c))for(;d!==c;)d.WindDelta!==0&&(c.WindCnt2=c.WindCnt2===0?1:0),d=d.NextInAEL;else for(;d!==c;)c.WindCnt2+=d.WindDelta,d=d.NextInAEL;},t.Clipper.prototype.AddEdgeToSEL=function(c){this.m_SortedEdges===null?(this.m_SortedEdges=c,c.PrevInSEL=null,c.NextInSEL=null):(c.NextInSEL=this.m_SortedEdges,c.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=c,this.m_SortedEdges=c);},t.Clipper.prototype.PopEdgeFromSEL=function(c){if(c.v=this.m_SortedEdges,c.v===null)return!1;var d=c.v;return this.m_SortedEdges=c.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),d.NextInSEL=null,d.PrevInSEL=null,!0;},t.Clipper.prototype.CopyAELToSEL=function(){var c=this.m_ActiveEdges;for(this.m_SortedEdges=c;c!==null;)c.PrevInSEL=c.PrevInAEL,c.NextInSEL=c.NextInAEL,c=c.NextInAEL;},t.Clipper.prototype.SwapPositionsInSEL=function(c,d){if(!(c.NextInSEL===null&&c.PrevInSEL===null)&&!(d.NextInSEL===null&&d.PrevInSEL===null)){if(c.NextInSEL===d){var m=d.NextInSEL;m!==null&&(m.PrevInSEL=c);var E=c.PrevInSEL;E!==null&&(E.NextInSEL=d),d.PrevInSEL=E,d.NextInSEL=c,c.PrevInSEL=d,c.NextInSEL=m;}else if(d.NextInSEL===c){var m=c.NextInSEL;m!==null&&(m.PrevInSEL=d);var E=d.PrevInSEL;E!==null&&(E.NextInSEL=c),c.PrevInSEL=E,c.NextInSEL=d,d.PrevInSEL=c,d.NextInSEL=m;}else{var m=c.NextInSEL,E=c.PrevInSEL;c.NextInSEL=d.NextInSEL,c.NextInSEL!==null&&(c.NextInSEL.PrevInSEL=c),c.PrevInSEL=d.PrevInSEL,c.PrevInSEL!==null&&(c.PrevInSEL.NextInSEL=c),d.NextInSEL=m,d.NextInSEL!==null&&(d.NextInSEL.PrevInSEL=d),d.PrevInSEL=E,d.PrevInSEL!==null&&(d.PrevInSEL.NextInSEL=d);}c.PrevInSEL===null?this.m_SortedEdges=c:d.PrevInSEL===null&&(this.m_SortedEdges=d);}},t.Clipper.prototype.AddLocalMaxPoly=function(c,d,m){this.AddOutPt(c,m),d.WindDelta===0&&this.AddOutPt(d,m),c.OutIdx===d.OutIdx?(c.OutIdx=-1,d.OutIdx=-1):c.OutIdx<d.OutIdx?this.AppendPolygon(c,d):this.AppendPolygon(d,c);},t.Clipper.prototype.AddLocalMinPoly=function(c,d,m){var E,F,rt;if(t.ClipperBase.IsHorizontal(d)||c.Dx>d.Dx?(E=this.AddOutPt(c,m),d.OutIdx=c.OutIdx,c.Side=t.EdgeSide.esLeft,d.Side=t.EdgeSide.esRight,F=c,F.PrevInAEL===d?rt=d.PrevInAEL:rt=F.PrevInAEL):(E=this.AddOutPt(d,m),c.OutIdx=d.OutIdx,c.Side=t.EdgeSide.esRight,d.Side=t.EdgeSide.esLeft,F=d,F.PrevInAEL===c?rt=c.PrevInAEL:rt=F.PrevInAEL),rt!==null&&rt.OutIdx>=0&&rt.Top.Y<m.Y&&F.Top.Y<m.Y){var vt=t.Clipper.TopX(rt,m.Y),At=t.Clipper.TopX(F,m.Y);if(vt===At&&F.WindDelta!==0&&rt.WindDelta!==0&&t.ClipperBase.SlopesEqual5(new t.IntPoint2(vt,m.Y),rt.Top,new t.IntPoint2(At,m.Y),F.Top,this.m_UseFullRange)){var Mt=this.AddOutPt(rt,m);this.AddJoin(E,Mt,F.Top);}}return E;},t.Clipper.prototype.AddOutPt=function(c,d){if(c.OutIdx<0){var m=this.CreateOutRec();m.IsOpen=c.WindDelta===0;var E=new t.OutPt();return m.Pts=E,E.Idx=m.Idx,E.Pt.X=d.X,E.Pt.Y=d.Y,t.use_xyz&&(E.Pt.Z=d.Z),E.Next=E,E.Prev=E,m.IsOpen||this.SetHoleState(c,m),c.OutIdx=m.Idx,E;}else{var m=this.m_PolyOuts[c.OutIdx],F=m.Pts,rt=c.Side===t.EdgeSide.esLeft;if(rt&&t.IntPoint.op_Equality(d,F.Pt))return F;if(!rt&&t.IntPoint.op_Equality(d,F.Prev.Pt))return F.Prev;var E=new t.OutPt();return E.Idx=m.Idx,E.Pt.X=d.X,E.Pt.Y=d.Y,t.use_xyz&&(E.Pt.Z=d.Z),E.Next=F,E.Prev=F.Prev,E.Prev.Next=E,F.Prev=E,rt&&(m.Pts=E),E;}},t.Clipper.prototype.GetLastOutPt=function(c){var d=this.m_PolyOuts[c.OutIdx];return c.Side===t.EdgeSide.esLeft?d.Pts:d.Pts.Prev;},t.Clipper.prototype.SwapPoints=function(c,d){var m=new t.IntPoint1(c.Value);c.Value.X=d.Value.X,c.Value.Y=d.Value.Y,t.use_xyz&&(c.Value.Z=d.Value.Z),d.Value.X=m.X,d.Value.Y=m.Y,t.use_xyz&&(d.Value.Z=m.Z);},t.Clipper.prototype.HorzSegmentsOverlap=function(c,d,m,E){var F;return c>d&&(F=c,c=d,d=F),m>E&&(F=m,m=E,E=F),c<E&&m<d;},t.Clipper.prototype.SetHoleState=function(c,d){for(var m=c.PrevInAEL,E=null;m!==null;)m.OutIdx>=0&&m.WindDelta!==0&&(E===null?E=m:E.OutIdx===m.OutIdx&&(E=null)),m=m.PrevInAEL;E===null?(d.FirstLeft=null,d.IsHole=!1):(d.FirstLeft=this.m_PolyOuts[E.OutIdx],d.IsHole=!d.FirstLeft.IsHole);},t.Clipper.prototype.GetDx=function(c,d){return c.Y===d.Y?t.ClipperBase.horizontal:(d.X-c.X)/(d.Y-c.Y);},t.Clipper.prototype.FirstIsBottomPt=function(c,d){for(var m=c.Prev;t.IntPoint.op_Equality(m.Pt,c.Pt)&&m!==c;)m=m.Prev;var E=Math.abs(this.GetDx(c.Pt,m.Pt));for(m=c.Next;t.IntPoint.op_Equality(m.Pt,c.Pt)&&m!==c;)m=m.Next;var F=Math.abs(this.GetDx(c.Pt,m.Pt));for(m=d.Prev;t.IntPoint.op_Equality(m.Pt,d.Pt)&&m!==d;)m=m.Prev;var rt=Math.abs(this.GetDx(d.Pt,m.Pt));for(m=d.Next;t.IntPoint.op_Equality(m.Pt,d.Pt)&&m!==d;)m=m.Next;var vt=Math.abs(this.GetDx(d.Pt,m.Pt));return Math.max(E,F)===Math.max(rt,vt)&&Math.min(E,F)===Math.min(rt,vt)?this.Area(c)>0:E>=rt&&E>=vt||F>=rt&&F>=vt;},t.Clipper.prototype.GetBottomPt=function(c){for(var d=null,m=c.Next;m!==c;)m.Pt.Y>c.Pt.Y?(c=m,d=null):m.Pt.Y===c.Pt.Y&&m.Pt.X<=c.Pt.X&&(m.Pt.X<c.Pt.X?(d=null,c=m):m.Next!==c&&m.Prev!==c&&(d=m)),m=m.Next;if(d!==null)for(;d!==m;)for(this.FirstIsBottomPt(m,d)||(c=d),d=d.Next;t.IntPoint.op_Inequality(d.Pt,c.Pt);)d=d.Next;return c;},t.Clipper.prototype.GetLowermostRec=function(c,d){c.BottomPt===null&&(c.BottomPt=this.GetBottomPt(c.Pts)),d.BottomPt===null&&(d.BottomPt=this.GetBottomPt(d.Pts));var m=c.BottomPt,E=d.BottomPt;return m.Pt.Y>E.Pt.Y?c:m.Pt.Y<E.Pt.Y?d:m.Pt.X<E.Pt.X?c:m.Pt.X>E.Pt.X||m.Next===m?d:E.Next===E||this.FirstIsBottomPt(m,E)?c:d;},t.Clipper.prototype.OutRec1RightOfOutRec2=function(c,d){do if(c=c.FirstLeft,c===d)return!0;while(c!==null);return!1;},t.Clipper.prototype.GetOutRec=function(c){for(var d=this.m_PolyOuts[c];d!==this.m_PolyOuts[d.Idx];)d=this.m_PolyOuts[d.Idx];return d;},t.Clipper.prototype.AppendPolygon=function(c,d){var m=this.m_PolyOuts[c.OutIdx],E=this.m_PolyOuts[d.OutIdx],F;this.OutRec1RightOfOutRec2(m,E)?F=E:this.OutRec1RightOfOutRec2(E,m)?F=m:F=this.GetLowermostRec(m,E);var rt=m.Pts,vt=rt.Prev,At=E.Pts,Mt=At.Prev;c.Side===t.EdgeSide.esLeft?d.Side===t.EdgeSide.esLeft?(this.ReversePolyPtLinks(At),At.Next=rt,rt.Prev=At,vt.Next=Mt,Mt.Prev=vt,m.Pts=Mt):(Mt.Next=rt,rt.Prev=Mt,At.Prev=vt,vt.Next=At,m.Pts=At):d.Side===t.EdgeSide.esRight?(this.ReversePolyPtLinks(At),vt.Next=Mt,Mt.Prev=vt,At.Next=rt,rt.Prev=At):(vt.Next=At,At.Prev=vt,rt.Prev=Mt,Mt.Next=rt),m.BottomPt=null,F===E&&(E.FirstLeft!==m&&(m.FirstLeft=E.FirstLeft),m.IsHole=E.IsHole),E.Pts=null,E.BottomPt=null,E.FirstLeft=m;var Wt=c.OutIdx,Zt=d.OutIdx;c.OutIdx=-1,d.OutIdx=-1;for(var Xt=this.m_ActiveEdges;Xt!==null;){if(Xt.OutIdx===Zt){Xt.OutIdx=Wt,Xt.Side=c.Side;break;}Xt=Xt.NextInAEL;}E.Idx=m.Idx;},t.Clipper.prototype.ReversePolyPtLinks=function(c){if(c!==null){var d,m;d=c;do m=d.Next,d.Next=d.Prev,d.Prev=m,d=m;while(d!==c);}},t.Clipper.SwapSides=function(c,d){var m=c.Side;c.Side=d.Side,d.Side=m;},t.Clipper.SwapPolyIndexes=function(c,d){var m=c.OutIdx;c.OutIdx=d.OutIdx,d.OutIdx=m;},t.Clipper.prototype.IntersectEdges=function(c,d,m){var E=c.OutIdx>=0,F=d.OutIdx>=0;if(t.use_xyz&&this.SetZ(m,c,d),t.use_lines&&(c.WindDelta===0||d.WindDelta===0)){if(c.WindDelta===0&&d.WindDelta===0)return;c.PolyTyp===d.PolyTyp&&c.WindDelta!==d.WindDelta&&this.m_ClipType===t.ClipType.ctUnion?c.WindDelta===0?F&&(this.AddOutPt(c,m),E&&(c.OutIdx=-1)):E&&(this.AddOutPt(d,m),F&&(d.OutIdx=-1)):c.PolyTyp!==d.PolyTyp&&(c.WindDelta===0&&Math.abs(d.WindCnt)===1&&(this.m_ClipType!==t.ClipType.ctUnion||d.WindCnt2===0)?(this.AddOutPt(c,m),E&&(c.OutIdx=-1)):d.WindDelta===0&&Math.abs(c.WindCnt)===1&&(this.m_ClipType!==t.ClipType.ctUnion||c.WindCnt2===0)&&(this.AddOutPt(d,m),F&&(d.OutIdx=-1)));return;}if(c.PolyTyp===d.PolyTyp){if(this.IsEvenOddFillType(c)){var rt=c.WindCnt;c.WindCnt=d.WindCnt,d.WindCnt=rt;}else c.WindCnt+d.WindDelta===0?c.WindCnt=-c.WindCnt:c.WindCnt+=d.WindDelta,d.WindCnt-c.WindDelta===0?d.WindCnt=-d.WindCnt:d.WindCnt-=c.WindDelta;}else this.IsEvenOddFillType(d)?c.WindCnt2=c.WindCnt2===0?1:0:c.WindCnt2+=d.WindDelta,this.IsEvenOddFillType(c)?d.WindCnt2=d.WindCnt2===0?1:0:d.WindCnt2-=c.WindDelta;var vt,At,Mt,Wt;c.PolyTyp===t.PolyType.ptSubject?(vt=this.m_SubjFillType,Mt=this.m_ClipFillType):(vt=this.m_ClipFillType,Mt=this.m_SubjFillType),d.PolyTyp===t.PolyType.ptSubject?(At=this.m_SubjFillType,Wt=this.m_ClipFillType):(At=this.m_ClipFillType,Wt=this.m_SubjFillType);var Zt,Xt;switch(vt){case t.PolyFillType.pftPositive:Zt=c.WindCnt;break;case t.PolyFillType.pftNegative:Zt=-c.WindCnt;break;default:Zt=Math.abs(c.WindCnt);break;}switch(At){case t.PolyFillType.pftPositive:Xt=d.WindCnt;break;case t.PolyFillType.pftNegative:Xt=-d.WindCnt;break;default:Xt=Math.abs(d.WindCnt);break;}if(E&&F)Zt!==0&&Zt!==1||Xt!==0&&Xt!==1||c.PolyTyp!==d.PolyTyp&&this.m_ClipType!==t.ClipType.ctXor?this.AddLocalMaxPoly(c,d,m):(this.AddOutPt(c,m),this.AddOutPt(d,m),t.Clipper.SwapSides(c,d),t.Clipper.SwapPolyIndexes(c,d));else if(E)(Xt===0||Xt===1)&&(this.AddOutPt(c,m),t.Clipper.SwapSides(c,d),t.Clipper.SwapPolyIndexes(c,d));else if(F)(Zt===0||Zt===1)&&(this.AddOutPt(d,m),t.Clipper.SwapSides(c,d),t.Clipper.SwapPolyIndexes(c,d));else if((Zt===0||Zt===1)&&(Xt===0||Xt===1)){var ne,ue;switch(Mt){case t.PolyFillType.pftPositive:ne=c.WindCnt2;break;case t.PolyFillType.pftNegative:ne=-c.WindCnt2;break;default:ne=Math.abs(c.WindCnt2);break;}switch(Wt){case t.PolyFillType.pftPositive:ue=d.WindCnt2;break;case t.PolyFillType.pftNegative:ue=-d.WindCnt2;break;default:ue=Math.abs(d.WindCnt2);break;}if(c.PolyTyp!==d.PolyTyp)this.AddLocalMinPoly(c,d,m);else if(Zt===1&&Xt===1)switch(this.m_ClipType){case t.ClipType.ctIntersection:ne>0&&ue>0&&this.AddLocalMinPoly(c,d,m);break;case t.ClipType.ctUnion:ne<=0&&ue<=0&&this.AddLocalMinPoly(c,d,m);break;case t.ClipType.ctDifference:(c.PolyTyp===t.PolyType.ptClip&&ne>0&&ue>0||c.PolyTyp===t.PolyType.ptSubject&&ne<=0&&ue<=0)&&this.AddLocalMinPoly(c,d,m);break;case t.ClipType.ctXor:this.AddLocalMinPoly(c,d,m);break;}else t.Clipper.SwapSides(c,d);}},t.Clipper.prototype.DeleteFromSEL=function(c){var d=c.PrevInSEL,m=c.NextInSEL;d===null&&m===null&&c!==this.m_SortedEdges||(d!==null?d.NextInSEL=m:this.m_SortedEdges=m,m!==null&&(m.PrevInSEL=d),c.NextInSEL=null,c.PrevInSEL=null);},t.Clipper.prototype.ProcessHorizontals=function(){for(var c={};this.PopEdgeFromSEL(c);)this.ProcessHorizontal(c.v);},t.Clipper.prototype.GetHorzDirection=function(c,d){c.Bot.X<c.Top.X?(d.Left=c.Bot.X,d.Right=c.Top.X,d.Dir=t.Direction.dLeftToRight):(d.Left=c.Top.X,d.Right=c.Bot.X,d.Dir=t.Direction.dRightToLeft);},t.Clipper.prototype.ProcessHorizontal=function(c){var d={Dir:null,Left:null,Right:null};this.GetHorzDirection(c,d);for(var m=d.Dir,E=d.Left,F=d.Right,rt=c.WindDelta===0,vt=c,At=null;vt.NextInLML!==null&&t.ClipperBase.IsHorizontal(vt.NextInLML);)vt=vt.NextInLML;vt.NextInLML===null&&(At=this.GetMaximaPair(vt));var Mt=this.m_Maxima;if(Mt!==null)if(m===t.Direction.dLeftToRight){for(;Mt!==null&&Mt.X<=c.Bot.X;)Mt=Mt.Next;Mt!==null&&Mt.X>=vt.Top.X&&(Mt=null);}else{for(;Mt.Next!==null&&Mt.Next.X<c.Bot.X;)Mt=Mt.Next;Mt.X<=vt.Top.X&&(Mt=null);}for(var Wt=null;;){for(var Zt=c===vt,Xt=this.GetNextInAEL(c,m);Xt!==null;){if(Mt!==null)if(m===t.Direction.dLeftToRight)for(;Mt!==null&&Mt.X<Xt.Curr.X;)c.OutIdx>=0&&!rt&&this.AddOutPt(c,new t.IntPoint2(Mt.X,c.Bot.Y)),Mt=Mt.Next;else for(;Mt!==null&&Mt.X>Xt.Curr.X;)c.OutIdx>=0&&!rt&&this.AddOutPt(c,new t.IntPoint2(Mt.X,c.Bot.Y)),Mt=Mt.Prev;if(m===t.Direction.dLeftToRight&&Xt.Curr.X>F||m===t.Direction.dRightToLeft&&Xt.Curr.X<E||Xt.Curr.X===c.Top.X&&c.NextInLML!==null&&Xt.Dx<c.NextInLML.Dx)break;if(c.OutIdx>=0&&!rt){t.use_xyz&&(m===t.Direction.dLeftToRight?this.SetZ(Xt.Curr,c,Xt):this.SetZ(Xt.Curr,Xt,c)),Wt=this.AddOutPt(c,Xt.Curr);for(var ne=this.m_SortedEdges;ne!==null;){if(ne.OutIdx>=0&&this.HorzSegmentsOverlap(c.Bot.X,c.Top.X,ne.Bot.X,ne.Top.X)){var ue=this.GetLastOutPt(ne);this.AddJoin(ue,Wt,ne.Top);}ne=ne.NextInSEL;}this.AddGhostJoin(Wt,c.Bot);}if(Xt===At&&Zt){c.OutIdx>=0&&this.AddLocalMaxPoly(c,At,c.Top),this.DeleteFromAEL(c),this.DeleteFromAEL(At);return;}if(m===t.Direction.dLeftToRight){var Se=new t.IntPoint2(Xt.Curr.X,c.Curr.Y);this.IntersectEdges(c,Xt,Se);}else{var Se=new t.IntPoint2(Xt.Curr.X,c.Curr.Y);this.IntersectEdges(Xt,c,Se);}var Ie=this.GetNextInAEL(Xt,m);this.SwapPositionsInAEL(c,Xt),Xt=Ie;}if(c.NextInLML===null||!t.ClipperBase.IsHorizontal(c.NextInLML))break;c=this.UpdateEdgeIntoAEL(c),c.OutIdx>=0&&this.AddOutPt(c,c.Bot),d={Dir:m,Left:E,Right:F},this.GetHorzDirection(c,d),m=d.Dir,E=d.Left,F=d.Right;}if(c.OutIdx>=0&&Wt===null){Wt=this.GetLastOutPt(c);for(var ne=this.m_SortedEdges;ne!==null;){if(ne.OutIdx>=0&&this.HorzSegmentsOverlap(c.Bot.X,c.Top.X,ne.Bot.X,ne.Top.X)){var ue=this.GetLastOutPt(ne);this.AddJoin(ue,Wt,ne.Top);}ne=ne.NextInSEL;}this.AddGhostJoin(Wt,c.Top);}if(c.NextInLML!==null){if(c.OutIdx>=0){if(Wt=this.AddOutPt(c,c.Top),c=this.UpdateEdgeIntoAEL(c),c.WindDelta===0)return;var We=c.PrevInAEL,Ie=c.NextInAEL;if(We!==null&&We.Curr.X===c.Bot.X&&We.Curr.Y===c.Bot.Y&&We.WindDelta===0&&We.OutIdx>=0&&We.Curr.Y>We.Top.Y&&t.ClipperBase.SlopesEqual3(c,We,this.m_UseFullRange)){var ue=this.AddOutPt(We,c.Bot);this.AddJoin(Wt,ue,c.Top);}else if(Ie!==null&&Ie.Curr.X===c.Bot.X&&Ie.Curr.Y===c.Bot.Y&&Ie.WindDelta!==0&&Ie.OutIdx>=0&&Ie.Curr.Y>Ie.Top.Y&&t.ClipperBase.SlopesEqual3(c,Ie,this.m_UseFullRange)){var ue=this.AddOutPt(Ie,c.Bot);this.AddJoin(Wt,ue,c.Top);}}else c=this.UpdateEdgeIntoAEL(c);}else c.OutIdx>=0&&this.AddOutPt(c,c.Top),this.DeleteFromAEL(c);},t.Clipper.prototype.GetNextInAEL=function(c,d){return d===t.Direction.dLeftToRight?c.NextInAEL:c.PrevInAEL;},t.Clipper.prototype.IsMinima=function(c){return c!==null&&c.Prev.NextInLML!==c&&c.Next.NextInLML!==c;},t.Clipper.prototype.IsMaxima=function(c,d){return c!==null&&c.Top.Y===d&&c.NextInLML===null;},t.Clipper.prototype.IsIntermediate=function(c,d){return c.Top.Y===d&&c.NextInLML!==null;},t.Clipper.prototype.GetMaximaPair=function(c){return t.IntPoint.op_Equality(c.Next.Top,c.Top)&&c.Next.NextInLML===null?c.Next:t.IntPoint.op_Equality(c.Prev.Top,c.Top)&&c.Prev.NextInLML===null?c.Prev:null;},t.Clipper.prototype.GetMaximaPairEx=function(c){var d=this.GetMaximaPair(c);return d===null||d.OutIdx===t.ClipperBase.Skip||d.NextInAEL===d.PrevInAEL&&!t.ClipperBase.IsHorizontal(d)?null:d;},t.Clipper.prototype.ProcessIntersections=function(c){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(c),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1;}catch(_unused16){this.m_SortedEdges=null,this.m_IntersectList.length=0,t.Error("ProcessIntersections error");}return this.m_SortedEdges=null,!0;},t.Clipper.prototype.BuildIntersectList=function(c){if(this.m_ActiveEdges!==null){var d=this.m_ActiveEdges;for(this.m_SortedEdges=d;d!==null;)d.PrevInSEL=d.PrevInAEL,d.NextInSEL=d.NextInAEL,d.Curr.X=t.Clipper.TopX(d,c),d=d.NextInAEL;for(var m=!0;m&&this.m_SortedEdges!==null;){for(m=!1,d=this.m_SortedEdges;d.NextInSEL!==null;){var E=d.NextInSEL,F=new t.IntPoint0();if(d.Curr.X>E.Curr.X){this.IntersectPoint(d,E,F),F.Y<c&&(F=new t.IntPoint2(t.Clipper.TopX(d,c),c));var rt=new t.IntersectNode();rt.Edge1=d,rt.Edge2=E,rt.Pt.X=F.X,rt.Pt.Y=F.Y,t.use_xyz&&(rt.Pt.Z=F.Z),this.m_IntersectList.push(rt),this.SwapPositionsInSEL(d,E),m=!0;}else d=E;}if(d.PrevInSEL!==null)d.PrevInSEL.NextInSEL=null;else break;}this.m_SortedEdges=null;}},t.Clipper.prototype.EdgesAdjacent=function(c){return c.Edge1.NextInSEL===c.Edge2||c.Edge1.PrevInSEL===c.Edge2;},t.Clipper.IntersectNodeSort=function(c,d){return d.Pt.Y-c.Pt.Y;},t.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var c=this.m_IntersectList.length,d=0;d<c;d++){if(!this.EdgesAdjacent(this.m_IntersectList[d])){for(var m=d+1;m<c&&!this.EdgesAdjacent(this.m_IntersectList[m]);)m++;if(m===c)return!1;var E=this.m_IntersectList[d];this.m_IntersectList[d]=this.m_IntersectList[m],this.m_IntersectList[m]=E;}this.SwapPositionsInSEL(this.m_IntersectList[d].Edge1,this.m_IntersectList[d].Edge2);}return!0;},t.Clipper.prototype.ProcessIntersectList=function(){for(var c=0,d=this.m_IntersectList.length;c<d;c++){var m=this.m_IntersectList[c];this.IntersectEdges(m.Edge1,m.Edge2,m.Pt),this.SwapPositionsInAEL(m.Edge1,m.Edge2);}this.m_IntersectList.length=0;};var na=function na(c){return c<0?Math.ceil(c-0.5):Math.round(c);},Rf=function Rf(c){return c<0?Math.ceil(c-0.5):Math.floor(c+0.5);},Il=function Il(c){return c<0?-Math.round(Math.abs(c)):Math.round(c);},eo=function eo(c){return c<0?(c-=0.5,c<-2147483648?Math.ceil(c):c|0):(c+=0.5,c>2147483647?Math.floor(c):c|0);};s.msie?t.Clipper.Round=na:s.chromium?t.Clipper.Round=Il:s.safari?t.Clipper.Round=eo:t.Clipper.Round=Rf,t.Clipper.TopX=function(c,d){return d===c.Top.Y?c.Top.X:c.Bot.X+t.Clipper.Round(c.Dx*(d-c.Bot.Y));},t.Clipper.prototype.IntersectPoint=function(c,d,m){m.X=0,m.Y=0;var E,F;if(c.Dx===d.Dx){m.Y=c.Curr.Y,m.X=t.Clipper.TopX(c,m.Y);return;}if(c.Delta.X===0)m.X=c.Bot.X,t.ClipperBase.IsHorizontal(d)?m.Y=d.Bot.Y:(F=d.Bot.Y-d.Bot.X/d.Dx,m.Y=t.Clipper.Round(m.X/d.Dx+F));else if(d.Delta.X===0)m.X=d.Bot.X,t.ClipperBase.IsHorizontal(c)?m.Y=c.Bot.Y:(E=c.Bot.Y-c.Bot.X/c.Dx,m.Y=t.Clipper.Round(m.X/c.Dx+E));else{E=c.Bot.X-c.Bot.Y*c.Dx,F=d.Bot.X-d.Bot.Y*d.Dx;var rt=(F-E)/(c.Dx-d.Dx);m.Y=t.Clipper.Round(rt),Math.abs(c.Dx)<Math.abs(d.Dx)?m.X=t.Clipper.Round(c.Dx*rt+E):m.X=t.Clipper.Round(d.Dx*rt+F);}if(m.Y<c.Top.Y||m.Y<d.Top.Y){if(c.Top.Y>d.Top.Y)return m.Y=c.Top.Y,m.X=t.Clipper.TopX(d,c.Top.Y),m.X<c.Top.X;m.Y=d.Top.Y,Math.abs(c.Dx)<Math.abs(d.Dx)?m.X=t.Clipper.TopX(c,m.Y):m.X=t.Clipper.TopX(d,m.Y);}m.Y>c.Curr.Y&&(m.Y=c.Curr.Y,Math.abs(c.Dx)>Math.abs(d.Dx)?m.X=t.Clipper.TopX(d,m.Y):m.X=t.Clipper.TopX(c,m.Y));},t.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(c){for(var d=this.m_ActiveEdges;d!==null;){var m=this.IsMaxima(d,c);if(m){var E=this.GetMaximaPairEx(d);m=E===null||!t.ClipperBase.IsHorizontal(E);}if(m){this.StrictlySimple&&this.InsertMaxima(d.Top.X);var F=d.PrevInAEL;this.DoMaxima(d),F===null?d=this.m_ActiveEdges:d=F.NextInAEL;}else{if(this.IsIntermediate(d,c)&&t.ClipperBase.IsHorizontal(d.NextInLML)?(d=this.UpdateEdgeIntoAEL(d),d.OutIdx>=0&&this.AddOutPt(d,d.Bot),this.AddEdgeToSEL(d)):(d.Curr.X=t.Clipper.TopX(d,c),d.Curr.Y=c),t.use_xyz&&(d.Top.Y===c?d.Curr.Z=d.Top.Z:d.Bot.Y===c?d.Curr.Z=d.Bot.Z:d.Curr.Z=0),this.StrictlySimple){var F=d.PrevInAEL;if(d.OutIdx>=0&&d.WindDelta!==0&&F!==null&&F.OutIdx>=0&&F.Curr.X===d.Curr.X&&F.WindDelta!==0){var rt=new t.IntPoint1(d.Curr);t.use_xyz&&this.SetZ(rt,F,d);var vt=this.AddOutPt(F,rt),At=this.AddOutPt(d,rt);this.AddJoin(vt,At,rt);}}d=d.NextInAEL;}}for(this.ProcessHorizontals(),this.m_Maxima=null,d=this.m_ActiveEdges;d!==null;){if(this.IsIntermediate(d,c)){var vt=null;d.OutIdx>=0&&(vt=this.AddOutPt(d,d.Top)),d=this.UpdateEdgeIntoAEL(d);var F=d.PrevInAEL,Mt=d.NextInAEL;if(F!==null&&F.Curr.X===d.Bot.X&&F.Curr.Y===d.Bot.Y&&vt!==null&&F.OutIdx>=0&&F.Curr.Y===F.Top.Y&&t.ClipperBase.SlopesEqual5(d.Curr,d.Top,F.Curr,F.Top,this.m_UseFullRange)&&d.WindDelta!==0&&F.WindDelta!==0){var At=this.AddOutPt(ePrev2,d.Bot);this.AddJoin(vt,At,d.Top);}else if(Mt!==null&&Mt.Curr.X===d.Bot.X&&Mt.Curr.Y===d.Bot.Y&&vt!==null&&Mt.OutIdx>=0&&Mt.Curr.Y===Mt.Top.Y&&t.ClipperBase.SlopesEqual5(d.Curr,d.Top,Mt.Curr,Mt.Top,this.m_UseFullRange)&&d.WindDelta!==0&&Mt.WindDelta!==0){var At=this.AddOutPt(Mt,d.Bot);this.AddJoin(vt,At,d.Top);}}d=d.NextInAEL;}},t.Clipper.prototype.DoMaxima=function(c){var d=this.GetMaximaPairEx(c);if(d===null){c.OutIdx>=0&&this.AddOutPt(c,c.Top),this.DeleteFromAEL(c);return;}for(var m=c.NextInAEL;m!==null&&m!==d;)this.IntersectEdges(c,m,c.Top),this.SwapPositionsInAEL(c,m),m=c.NextInAEL;c.OutIdx===-1&&d.OutIdx===-1?(this.DeleteFromAEL(c),this.DeleteFromAEL(d)):c.OutIdx>=0&&d.OutIdx>=0?(c.OutIdx>=0&&this.AddLocalMaxPoly(c,d,c.Top),this.DeleteFromAEL(c),this.DeleteFromAEL(d)):t.use_lines&&c.WindDelta===0?(c.OutIdx>=0&&(this.AddOutPt(c,c.Top),c.OutIdx=t.ClipperBase.Unassigned),this.DeleteFromAEL(c),d.OutIdx>=0&&(this.AddOutPt(d,c.Top),d.OutIdx=t.ClipperBase.Unassigned),this.DeleteFromAEL(d)):t.Error("DoMaxima error");},t.Clipper.ReversePaths=function(c){for(var d=0,m=c.length;d<m;d++)c[d].reverse();},t.Clipper.Orientation=function(c){return t.Clipper.Area(c)>=0;},t.Clipper.prototype.PointCount=function(c){if(c===null)return 0;var d=0,m=c;do d++,m=m.Next;while(m!==c);return d;},t.Clipper.prototype.BuildResult=function(c){t.Clear(c);for(var d=0,m=this.m_PolyOuts.length;d<m;d++){var E=this.m_PolyOuts[d];if(E.Pts!==null){var F=E.Pts.Prev,rt=this.PointCount(F);if(!(rt<2)){for(var vt=new Array(rt),At=0;At<rt;At++)vt[At]=F.Pt,F=F.Prev;c.push(vt);}}}},t.Clipper.prototype.BuildResult2=function(c){c.Clear();for(var d=0,m=this.m_PolyOuts.length;d<m;d++){var E=this.m_PolyOuts[d],F=this.PointCount(E.Pts);if(!(E.IsOpen&&F<2||!E.IsOpen&&F<3)){this.FixHoleLinkage(E);var rt=new t.PolyNode();c.m_AllPolys.push(rt),E.PolyNode=rt,rt.m_polygon.length=F;for(var vt=E.Pts.Prev,At=0;At<F;At++)rt.m_polygon[At]=vt.Pt,vt=vt.Prev;}}for(var d=0,m=this.m_PolyOuts.length;d<m;d++){var E=this.m_PolyOuts[d];E.PolyNode!==null&&(E.IsOpen?(E.PolyNode.IsOpen=!0,c.AddChild(E.PolyNode)):E.FirstLeft!==null&&E.FirstLeft.PolyNode!==null?E.FirstLeft.PolyNode.AddChild(E.PolyNode):c.AddChild(E.PolyNode));}},t.Clipper.prototype.FixupOutPolyline=function(c){for(var d=c.Pts,m=d.Prev;d!==m;)if(d=d.Next,t.IntPoint.op_Equality(d.Pt,d.Prev.Pt)){d===m&&(m=d.Prev);var E=d.Prev;E.Next=d.Next,d.Next.Prev=E,d=E;}d===d.Prev&&(c.Pts=null);},t.Clipper.prototype.FixupOutPolygon=function(c){var d=null;c.BottomPt=null;for(var m=c.Pts,E=this.PreserveCollinear||this.StrictlySimple;;){if(m.Prev===m||m.Prev===m.Next){c.Pts=null;return;}if(t.IntPoint.op_Equality(m.Pt,m.Next.Pt)||t.IntPoint.op_Equality(m.Pt,m.Prev.Pt)||t.ClipperBase.SlopesEqual4(m.Prev.Pt,m.Pt,m.Next.Pt,this.m_UseFullRange)&&(!E||!this.Pt2IsBetweenPt1AndPt3(m.Prev.Pt,m.Pt,m.Next.Pt)))d=null,m.Prev.Next=m.Next,m.Next.Prev=m.Prev,m=m.Prev;else{if(m===d)break;d===null&&(d=m),m=m.Next;}}c.Pts=m;},t.Clipper.prototype.DupOutPt=function(c,d){var m=new t.OutPt();return m.Pt.X=c.Pt.X,m.Pt.Y=c.Pt.Y,t.use_xyz&&(m.Pt.Z=c.Pt.Z),m.Idx=c.Idx,d?(m.Next=c.Next,m.Prev=c,c.Next.Prev=m,c.Next=m):(m.Prev=c.Prev,m.Next=c,c.Prev.Next=m,c.Prev=m),m;},t.Clipper.prototype.GetOverlap=function(c,d,m,E,F){return c<d?m<E?(F.Left=Math.max(c,m),F.Right=Math.min(d,E)):(F.Left=Math.max(c,E),F.Right=Math.min(d,m)):m<E?(F.Left=Math.max(d,m),F.Right=Math.min(c,E)):(F.Left=Math.max(d,E),F.Right=Math.min(c,m)),F.Left<F.Right;},t.Clipper.prototype.JoinHorz=function(c,d,m,E,F,rt){var vt=c.Pt.X>d.Pt.X?t.Direction.dRightToLeft:t.Direction.dLeftToRight,At=m.Pt.X>E.Pt.X?t.Direction.dRightToLeft:t.Direction.dLeftToRight;if(vt===At)return!1;if(vt===t.Direction.dLeftToRight){for(;c.Next.Pt.X<=F.X&&c.Next.Pt.X>=c.Pt.X&&c.Next.Pt.Y===F.Y;)c=c.Next;rt&&c.Pt.X!==F.X&&(c=c.Next),d=this.DupOutPt(c,!rt),t.IntPoint.op_Inequality(d.Pt,F)&&(c=d,c.Pt.X=F.X,c.Pt.Y=F.Y,t.use_xyz&&(c.Pt.Z=F.Z),d=this.DupOutPt(c,!rt));}else{for(;c.Next.Pt.X>=F.X&&c.Next.Pt.X<=c.Pt.X&&c.Next.Pt.Y===F.Y;)c=c.Next;!rt&&c.Pt.X!==F.X&&(c=c.Next),d=this.DupOutPt(c,rt),t.IntPoint.op_Inequality(d.Pt,F)&&(c=d,c.Pt.X=F.X,c.Pt.Y=F.Y,t.use_xyz&&(c.Pt.Z=F.Z),d=this.DupOutPt(c,rt));}if(At===t.Direction.dLeftToRight){for(;m.Next.Pt.X<=F.X&&m.Next.Pt.X>=m.Pt.X&&m.Next.Pt.Y===F.Y;)m=m.Next;rt&&m.Pt.X!==F.X&&(m=m.Next),E=this.DupOutPt(m,!rt),t.IntPoint.op_Inequality(E.Pt,F)&&(m=E,m.Pt.X=F.X,m.Pt.Y=F.Y,t.use_xyz&&(m.Pt.Z=F.Z),E=this.DupOutPt(m,!rt));}else{for(;m.Next.Pt.X>=F.X&&m.Next.Pt.X<=m.Pt.X&&m.Next.Pt.Y===F.Y;)m=m.Next;!rt&&m.Pt.X!==F.X&&(m=m.Next),E=this.DupOutPt(m,rt),t.IntPoint.op_Inequality(E.Pt,F)&&(m=E,m.Pt.X=F.X,m.Pt.Y=F.Y,t.use_xyz&&(m.Pt.Z=F.Z),E=this.DupOutPt(m,rt));}return vt===t.Direction.dLeftToRight===rt?(c.Prev=m,m.Next=c,d.Next=E,E.Prev=d):(c.Next=m,m.Prev=c,d.Prev=E,E.Next=d),!0;},t.Clipper.prototype.JoinPoints=function(c,d,m){var E=c.OutPt1,F=new t.OutPt(),rt=c.OutPt2,vt=new t.OutPt(),At=c.OutPt1.Pt.Y===c.OffPt.Y;if(At&&t.IntPoint.op_Equality(c.OffPt,c.OutPt1.Pt)&&t.IntPoint.op_Equality(c.OffPt,c.OutPt2.Pt)){if(d!==m)return!1;for(F=c.OutPt1.Next;F!==E&&t.IntPoint.op_Equality(F.Pt,c.OffPt);)F=F.Next;var Mt=F.Pt.Y>c.OffPt.Y;for(vt=c.OutPt2.Next;vt!==rt&&t.IntPoint.op_Equality(vt.Pt,c.OffPt);)vt=vt.Next;var Wt=vt.Pt.Y>c.OffPt.Y;return Mt===Wt?!1:Mt?(F=this.DupOutPt(E,!1),vt=this.DupOutPt(rt,!0),E.Prev=rt,rt.Next=E,F.Next=vt,vt.Prev=F,c.OutPt1=E,c.OutPt2=F,!0):(F=this.DupOutPt(E,!0),vt=this.DupOutPt(rt,!1),E.Next=rt,rt.Prev=E,F.Prev=vt,vt.Next=F,c.OutPt1=E,c.OutPt2=F,!0);}else if(At){for(F=E;E.Prev.Pt.Y===E.Pt.Y&&E.Prev!==F&&E.Prev!==rt;)E=E.Prev;for(;F.Next.Pt.Y===F.Pt.Y&&F.Next!==E&&F.Next!==rt;)F=F.Next;if(F.Next===E||F.Next===rt)return!1;for(vt=rt;rt.Prev.Pt.Y===rt.Pt.Y&&rt.Prev!==vt&&rt.Prev!==F;)rt=rt.Prev;for(;vt.Next.Pt.Y===vt.Pt.Y&&vt.Next!==rt&&vt.Next!==E;)vt=vt.Next;if(vt.Next===rt||vt.Next===E)return!1;var Zt={Left:null,Right:null};if(!this.GetOverlap(E.Pt.X,F.Pt.X,rt.Pt.X,vt.Pt.X,Zt))return!1;var Xt=Zt.Left,ne=Zt.Right,ue=new t.IntPoint0(),Se;return E.Pt.X>=Xt&&E.Pt.X<=ne?(ue.X=E.Pt.X,ue.Y=E.Pt.Y,t.use_xyz&&(ue.Z=E.Pt.Z),Se=E.Pt.X>F.Pt.X):rt.Pt.X>=Xt&&rt.Pt.X<=ne?(ue.X=rt.Pt.X,ue.Y=rt.Pt.Y,t.use_xyz&&(ue.Z=rt.Pt.Z),Se=rt.Pt.X>vt.Pt.X):F.Pt.X>=Xt&&F.Pt.X<=ne?(ue.X=F.Pt.X,ue.Y=F.Pt.Y,t.use_xyz&&(ue.Z=F.Pt.Z),Se=F.Pt.X>E.Pt.X):(ue.X=vt.Pt.X,ue.Y=vt.Pt.Y,t.use_xyz&&(ue.Z=vt.Pt.Z),Se=vt.Pt.X>rt.Pt.X),c.OutPt1=E,c.OutPt2=rt,this.JoinHorz(E,F,rt,vt,ue,Se);}else{for(F=E.Next;t.IntPoint.op_Equality(F.Pt,E.Pt)&&F!==E;)F=F.Next;var Ie=F.Pt.Y>E.Pt.Y||!t.ClipperBase.SlopesEqual4(E.Pt,F.Pt,c.OffPt,this.m_UseFullRange);if(Ie){for(F=E.Prev;t.IntPoint.op_Equality(F.Pt,E.Pt)&&F!==E;)F=F.Prev;if(F.Pt.Y>E.Pt.Y||!t.ClipperBase.SlopesEqual4(E.Pt,F.Pt,c.OffPt,this.m_UseFullRange))return!1;}for(vt=rt.Next;t.IntPoint.op_Equality(vt.Pt,rt.Pt)&&vt!==rt;)vt=vt.Next;var We=vt.Pt.Y>rt.Pt.Y||!t.ClipperBase.SlopesEqual4(rt.Pt,vt.Pt,c.OffPt,this.m_UseFullRange);if(We){for(vt=rt.Prev;t.IntPoint.op_Equality(vt.Pt,rt.Pt)&&vt!==rt;)vt=vt.Prev;if(vt.Pt.Y>rt.Pt.Y||!t.ClipperBase.SlopesEqual4(rt.Pt,vt.Pt,c.OffPt,this.m_UseFullRange))return!1;}return F===E||vt===rt||F===vt||d===m&&Ie===We?!1:Ie?(F=this.DupOutPt(E,!1),vt=this.DupOutPt(rt,!0),E.Prev=rt,rt.Next=E,F.Next=vt,vt.Prev=F,c.OutPt1=E,c.OutPt2=F,!0):(F=this.DupOutPt(E,!0),vt=this.DupOutPt(rt,!1),E.Next=rt,rt.Prev=E,F.Prev=vt,vt.Next=F,c.OutPt1=E,c.OutPt2=F,!0);}},t.Clipper.GetBounds=function(c){for(var d=0,m=c.length;d<m&&c[d].length===0;)d++;if(d===m)return new t.IntRect(0,0,0,0);var E=new t.IntRect();for(E.left=c[d][0].X,E.right=E.left,E.top=c[d][0].Y,E.bottom=E.top;d<m;d++)for(var F=0,rt=c[d].length;F<rt;F++)c[d][F].X<E.left?E.left=c[d][F].X:c[d][F].X>E.right&&(E.right=c[d][F].X),c[d][F].Y<E.top?E.top=c[d][F].Y:c[d][F].Y>E.bottom&&(E.bottom=c[d][F].Y);return E;},t.Clipper.prototype.GetBounds2=function(c){var d=c,m=new t.IntRect();for(m.left=c.Pt.X,m.right=c.Pt.X,m.top=c.Pt.Y,m.bottom=c.Pt.Y,c=c.Next;c!==d;)c.Pt.X<m.left&&(m.left=c.Pt.X),c.Pt.X>m.right&&(m.right=c.Pt.X),c.Pt.Y<m.top&&(m.top=c.Pt.Y),c.Pt.Y>m.bottom&&(m.bottom=c.Pt.Y),c=c.Next;return m;},t.Clipper.PointInPolygon=function(c,d){var m=0,E=d.length;if(E<3)return 0;for(var F=d[0],rt=1;rt<=E;++rt){var vt=rt===E?d[0]:d[rt];if(vt.Y===c.Y&&(vt.X===c.X||F.Y===c.Y&&vt.X>c.X==F.X<c.X))return-1;if(F.Y<c.Y!=vt.Y<c.Y){if(F.X>=c.X){if(vt.X>c.X)m=1-m;else{var At=(F.X-c.X)*(vt.Y-c.Y)-(vt.X-c.X)*(F.Y-c.Y);if(At===0)return-1;At>0==vt.Y>F.Y&&(m=1-m);}}else if(vt.X>c.X){var At=(F.X-c.X)*(vt.Y-c.Y)-(vt.X-c.X)*(F.Y-c.Y);if(At===0)return-1;At>0==vt.Y>F.Y&&(m=1-m);}}F=vt;}return m;},t.Clipper.prototype.PointInPolygon=function(c,d){var m=0,E=d,F=c.X,rt=c.Y,vt=d.Pt.X,At=d.Pt.Y;do{d=d.Next;var Mt=d.Pt.X,Wt=d.Pt.Y;if(Wt===rt&&(Mt===F||At===rt&&Mt>F==vt<F))return-1;if(At<rt!=Wt<rt){if(vt>=F){if(Mt>F)m=1-m;else{var Zt=(vt-F)*(Wt-rt)-(Mt-F)*(At-rt);if(Zt===0)return-1;Zt>0==Wt>At&&(m=1-m);}}else if(Mt>F){var Zt=(vt-F)*(Wt-rt)-(Mt-F)*(At-rt);if(Zt===0)return-1;Zt>0==Wt>At&&(m=1-m);}}vt=Mt,At=Wt;}while(E!==d);return m;},t.Clipper.prototype.Poly2ContainsPoly1=function(c,d){var m=c;do{var E=this.PointInPolygon(m.Pt,d);if(E>=0)return E>0;m=m.Next;}while(m!==c);return!0;},t.Clipper.prototype.FixupFirstLefts1=function(c,d){for(var m,E,F=0,rt=this.m_PolyOuts.length;F<rt;F++)m=this.m_PolyOuts[F],E=t.Clipper.ParseFirstLeft(m.FirstLeft),m.Pts!==null&&E===c&&this.Poly2ContainsPoly1(m.Pts,d.Pts)&&(m.FirstLeft=d);},t.Clipper.prototype.FixupFirstLefts2=function(c,d){for(var m=d.FirstLeft,E,F,rt=0,vt=this.m_PolyOuts.length;rt<vt;rt++)E=this.m_PolyOuts[rt],!(E.Pts===null||E===d||E===c)&&(F=t.Clipper.ParseFirstLeft(E.FirstLeft),!(F!==m&&F!==c&&F!==d)&&(this.Poly2ContainsPoly1(E.Pts,c.Pts)?E.FirstLeft=c:this.Poly2ContainsPoly1(E.Pts,d.Pts)?E.FirstLeft=d:(E.FirstLeft===c||E.FirstLeft===d)&&(E.FirstLeft=m)));},t.Clipper.prototype.FixupFirstLefts3=function(c,d){for(var m,E,F=0,rt=this.m_PolyOuts.length;F<rt;F++)m=this.m_PolyOuts[F],E=t.Clipper.ParseFirstLeft(m.FirstLeft),m.Pts!==null&&E===c&&(m.FirstLeft=d);},t.Clipper.ParseFirstLeft=function(c){for(;c!==null&&c.Pts===null;)c=c.FirstLeft;return c;},t.Clipper.prototype.JoinCommonEdges=function(){for(var c=0,d=this.m_Joins.length;c<d;c++){var m=this.m_Joins[c],E=this.GetOutRec(m.OutPt1.Idx),F=this.GetOutRec(m.OutPt2.Idx);if(!(E.Pts===null||F.Pts===null)&&!(E.IsOpen||F.IsOpen)){var rt;E===F?rt=E:this.OutRec1RightOfOutRec2(E,F)?rt=F:this.OutRec1RightOfOutRec2(F,E)?rt=E:rt=this.GetLowermostRec(E,F),this.JoinPoints(m,E,F)&&(E===F?(E.Pts=m.OutPt1,E.BottomPt=null,F=this.CreateOutRec(),F.Pts=m.OutPt2,this.UpdateOutPtIdxs(F),this.Poly2ContainsPoly1(F.Pts,E.Pts)?(F.IsHole=!E.IsHole,F.FirstLeft=E,this.m_UsingPolyTree&&this.FixupFirstLefts2(F,E),(F.IsHole^this.ReverseSolution)==this.Area$1(F)>0&&this.ReversePolyPtLinks(F.Pts)):this.Poly2ContainsPoly1(E.Pts,F.Pts)?(F.IsHole=E.IsHole,E.IsHole=!F.IsHole,F.FirstLeft=E.FirstLeft,E.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts2(E,F),(E.IsHole^this.ReverseSolution)==this.Area$1(E)>0&&this.ReversePolyPtLinks(E.Pts)):(F.IsHole=E.IsHole,F.FirstLeft=E.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(E,F))):(F.Pts=null,F.BottomPt=null,F.Idx=E.Idx,E.IsHole=rt.IsHole,rt===F&&(E.FirstLeft=F.FirstLeft),F.FirstLeft=E,this.m_UsingPolyTree&&this.FixupFirstLefts3(F,E)));}}},t.Clipper.prototype.UpdateOutPtIdxs=function(c){var d=c.Pts;do d.Idx=c.Idx,d=d.Prev;while(d!==c.Pts);},t.Clipper.prototype.DoSimplePolygons=function(){for(var c=0;c<this.m_PolyOuts.length;){var d=this.m_PolyOuts[c++],m=d.Pts;if(!(m===null||d.IsOpen))do{for(var E=m.Next;E!==d.Pts;){if(t.IntPoint.op_Equality(m.Pt,E.Pt)&&E.Next!==m&&E.Prev!==m){var F=m.Prev,rt=E.Prev;m.Prev=rt,rt.Next=m,E.Prev=F,F.Next=E,d.Pts=m;var vt=this.CreateOutRec();vt.Pts=E,this.UpdateOutPtIdxs(vt),this.Poly2ContainsPoly1(vt.Pts,d.Pts)?(vt.IsHole=!d.IsHole,vt.FirstLeft=d,this.m_UsingPolyTree&&this.FixupFirstLefts2(vt,d)):this.Poly2ContainsPoly1(d.Pts,vt.Pts)?(vt.IsHole=d.IsHole,d.IsHole=!vt.IsHole,vt.FirstLeft=d.FirstLeft,d.FirstLeft=vt,this.m_UsingPolyTree&&this.FixupFirstLefts2(d,vt)):(vt.IsHole=d.IsHole,vt.FirstLeft=d.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(d,vt)),E=m;}E=E.Next;}m=m.Next;}while(m!==d.Pts);}},t.Clipper.Area=function(c){if(!Array.isArray(c))return 0;var d=c.length;if(d<3)return 0;for(var m=0,E=0,F=d-1;E<d;++E)m+=(c[F].X+c[E].X)*(c[F].Y-c[E].Y),F=E;return-m*0.5;},t.Clipper.prototype.Area=function(c){var d=c;if(c===null)return 0;var m=0;do m=m+(c.Prev.Pt.X+c.Pt.X)*(c.Prev.Pt.Y-c.Pt.Y),c=c.Next;while(c!==d);return m*0.5;},t.Clipper.prototype.Area$1=function(c){return this.Area(c.Pts);},t.Clipper.SimplifyPolygon=function(c,d){var m=new Array(),E=new t.Clipper(0);return E.StrictlySimple=!0,E.AddPath(c,t.PolyType.ptSubject,!0),E.Execute(t.ClipType.ctUnion,m,d,d),m;},t.Clipper.SimplifyPolygons=function(c,d){_typeof(d)>"u"&&(d=t.PolyFillType.pftEvenOdd);var m=new Array(),E=new t.Clipper(0);return E.StrictlySimple=!0,E.AddPaths(c,t.PolyType.ptSubject,!0),E.Execute(t.ClipType.ctUnion,m,d,d),m;},t.Clipper.DistanceSqrd=function(c,d){var m=c.X-d.X,E=c.Y-d.Y;return m*m+E*E;},t.Clipper.DistanceFromLineSqrd=function(c,d,m){var E=d.Y-m.Y,F=m.X-d.X,rt=E*d.X+F*d.Y;return rt=E*c.X+F*c.Y-rt,rt*rt/(E*E+F*F);},t.Clipper.SlopesNearCollinear=function(c,d,m,E){return Math.abs(c.X-d.X)>Math.abs(c.Y-d.Y)?c.X>d.X==c.X<m.X?t.Clipper.DistanceFromLineSqrd(c,d,m)<E:d.X>c.X==d.X<m.X?t.Clipper.DistanceFromLineSqrd(d,c,m)<E:t.Clipper.DistanceFromLineSqrd(m,c,d)<E:c.Y>d.Y==c.Y<m.Y?t.Clipper.DistanceFromLineSqrd(c,d,m)<E:d.Y>c.Y==d.Y<m.Y?t.Clipper.DistanceFromLineSqrd(d,c,m)<E:t.Clipper.DistanceFromLineSqrd(m,c,d)<E;},t.Clipper.PointsAreClose=function(c,d,m){var E=c.X-d.X,F=c.Y-d.Y;return E*E+F*F<=m;},t.Clipper.ExcludeOp=function(c){var d=c.Prev;return d.Next=c.Next,c.Next.Prev=d,d.Idx=0,d;},t.Clipper.CleanPolygon=function(c,d){_typeof(d)>"u"&&(d=1.415);var m=c.length;if(m===0)return new Array();for(var E=new Array(m),F=0;F<m;++F)E[F]=new t.OutPt();for(var F=0;F<m;++F)E[F].Pt=c[F],E[F].Next=E[(F+1)%m],E[F].Next.Prev=E[F],E[F].Idx=0;for(var rt=d*d,vt=E[0];vt.Idx===0&&vt.Next!==vt.Prev;)t.Clipper.PointsAreClose(vt.Pt,vt.Prev.Pt,rt)?(vt=t.Clipper.ExcludeOp(vt),m--):t.Clipper.PointsAreClose(vt.Prev.Pt,vt.Next.Pt,rt)?(t.Clipper.ExcludeOp(vt.Next),vt=t.Clipper.ExcludeOp(vt),m-=2):t.Clipper.SlopesNearCollinear(vt.Prev.Pt,vt.Pt,vt.Next.Pt,rt)?(vt=t.Clipper.ExcludeOp(vt),m--):(vt.Idx=1,vt=vt.Next);m<3&&(m=0);for(var At=new Array(m),F=0;F<m;++F)At[F]=new t.IntPoint1(vt.Pt),vt=vt.Next;return E=null,At;},t.Clipper.CleanPolygons=function(c,d){for(var m=new Array(c.length),E=0,F=c.length;E<F;E++)m[E]=t.Clipper.CleanPolygon(c[E],d);return m;},t.Clipper.Minkowski=function(c,d,m,E){var F=E?1:0,rt=c.length,vt=d.length,At=new Array();if(m)for(var Mt=0;Mt<vt;Mt++){for(var Wt=new Array(rt),Zt=0,Xt=c.length,ne=c[Zt];Zt<Xt;Zt++,ne=c[Zt])Wt[Zt]=new t.IntPoint2(d[Mt].X+ne.X,d[Mt].Y+ne.Y);At.push(Wt);}else for(var Mt=0;Mt<vt;Mt++){for(var Wt=new Array(rt),Zt=0,Xt=c.length,ne=c[Zt];Zt<Xt;Zt++,ne=c[Zt])Wt[Zt]=new t.IntPoint2(d[Mt].X-ne.X,d[Mt].Y-ne.Y);At.push(Wt);}for(var ue=new Array(),Mt=0;Mt<vt-1+F;Mt++)for(var Zt=0;Zt<rt;Zt++){var Se=new Array();Se.push(At[Mt%vt][Zt%rt]),Se.push(At[(Mt+1)%vt][Zt%rt]),Se.push(At[(Mt+1)%vt][(Zt+1)%rt]),Se.push(At[Mt%vt][(Zt+1)%rt]),t.Clipper.Orientation(Se)||Se.reverse(),ue.push(Se);}return ue;},t.Clipper.MinkowskiSum=function(c,d,m){if(d[0]instanceof Array){for(var F=d,vt=new t.Paths(),rt=new t.Clipper(),At=0;At<F.length;++At){var Mt=t.Clipper.Minkowski(c,F[At],!0,m);if(rt.AddPaths(Mt,t.PolyType.ptSubject,!0),m){var E=t.Clipper.TranslatePath(F[At],c[0]);rt.AddPath(E,t.PolyType.ptClip,!0);}}return rt.Execute(t.ClipType.ctUnion,vt,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),vt;}else{var E=d,F=t.Clipper.Minkowski(c,E,!0,m),rt=new t.Clipper();return rt.AddPaths(F,t.PolyType.ptSubject,!0),rt.Execute(t.ClipType.ctUnion,F,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),F;}},t.Clipper.TranslatePath=function(c,d){for(var m=new t.Path(),E=0;E<c.length;E++)m.push(new t.IntPoint2(c[E].X+d.X,c[E].Y+d.Y));return m;},t.Clipper.MinkowskiDiff=function(c,d){var m=t.Clipper.Minkowski(c,d,!1,!0),E=new t.Clipper();return E.AddPaths(m,t.PolyType.ptSubject,!0),E.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),m;},t.Clipper.PolyTreeToPaths=function(c){var d=new Array();return t.Clipper.AddPolyNodeToPaths(c,t.Clipper.NodeType.ntAny,d),d;},t.Clipper.AddPolyNodeToPaths=function(c,d,m){var E=!0;switch(d){case t.Clipper.NodeType.ntOpen:return;case t.Clipper.NodeType.ntClosed:E=!c.IsOpen;break;}c.m_polygon.length>0&&E&&m.push(c.m_polygon);for(var F=0,rt=c.Childs(),vt=rt.length,At=rt[F];F<vt;F++,At=rt[F])t.Clipper.AddPolyNodeToPaths(At,d,m);},t.Clipper.OpenPathsFromPolyTree=function(c){for(var d=new t.Paths(),m=0,E=c.ChildCount();m<E;m++)c.Childs()[m].IsOpen&&d.push(c.Childs()[m].m_polygon);return d;},t.Clipper.ClosedPathsFromPolyTree=function(c){var d=new t.Paths();return t.Clipper.AddPolyNodeToPaths(c,t.Clipper.NodeType.ntClosed,d),d;},ra(t.Clipper,t.ClipperBase),t.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},t.ClipperOffset=function(c,d){_typeof(c)>"u"&&(c=2),_typeof(d)>"u"&&(d=t.ClipperOffset.def_arc_tolerance),this.m_destPolys=new t.Paths(),this.m_srcPoly=new t.Path(),this.m_destPoly=new t.Path(),this.m_normals=new Array(),this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new t.IntPoint0(),this.m_polyNodes=new t.PolyNode(),this.MiterLimit=c,this.ArcTolerance=d,this.m_lowest.X=-1;},t.ClipperOffset.two_pi=6.28318530717959,t.ClipperOffset.def_arc_tolerance=0.25,t.ClipperOffset.prototype.Clear=function(){t.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1;},t.ClipperOffset.Round=t.Clipper.Round,t.ClipperOffset.prototype.AddPath=function(c,d,m){var E=c.length-1;if(!(E<0)){var F=new t.PolyNode();if(F.m_jointype=d,F.m_endtype=m,m===t.EndType.etClosedLine||m===t.EndType.etClosedPolygon)for(;E>0&&t.IntPoint.op_Equality(c[0],c[E]);)E--;F.m_polygon.push(c[0]);for(var rt=0,vt=0,At=1;At<=E;At++)t.IntPoint.op_Inequality(F.m_polygon[rt],c[At])&&(rt++,F.m_polygon.push(c[At]),(c[At].Y>F.m_polygon[vt].Y||c[At].Y===F.m_polygon[vt].Y&&c[At].X<F.m_polygon[vt].X)&&(vt=rt));if(!(m===t.EndType.etClosedPolygon&&rt<2)&&(this.m_polyNodes.AddChild(F),m===t.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new t.IntPoint2(this.m_polyNodes.ChildCount()-1,vt);else{var Mt=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(F.m_polygon[vt].Y>Mt.Y||F.m_polygon[vt].Y===Mt.Y&&F.m_polygon[vt].X<Mt.X)&&(this.m_lowest=new t.IntPoint2(this.m_polyNodes.ChildCount()-1,vt));}}},t.ClipperOffset.prototype.AddPaths=function(c,d,m){for(var E=0,F=c.length;E<F;E++)this.AddPath(c[E],d,m);},t.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!t.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var c=0;c<this.m_polyNodes.ChildCount();c++){var d=this.m_polyNodes.Childs()[c];(d.m_endtype===t.EndType.etClosedPolygon||d.m_endtype===t.EndType.etClosedLine&&t.Clipper.Orientation(d.m_polygon))&&d.m_polygon.reverse();}else for(var c=0;c<this.m_polyNodes.ChildCount();c++){var d=this.m_polyNodes.Childs()[c];d.m_endtype===t.EndType.etClosedLine&&!t.Clipper.Orientation(d.m_polygon)&&d.m_polygon.reverse();}},t.ClipperOffset.GetUnitNormal=function(c,d){var m=d.X-c.X,E=d.Y-c.Y;if(m===0&&E===0)return new t.DoublePoint2(0,0);var F=1/Math.sqrt(m*m+E*E);return m*=F,E*=F,new t.DoublePoint2(E,-m);},t.ClipperOffset.prototype.DoOffset=function(c){if(this.m_destPolys=new Array(),this.m_delta=c,t.ClipperBase.near_zero(c)){for(var d=0;d<this.m_polyNodes.ChildCount();d++){var m=this.m_polyNodes.Childs()[d];m.m_endtype===t.EndType.etClosedPolygon&&this.m_destPolys.push(m.m_polygon);}return;}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=0.5;var E;this.ArcTolerance<=0?E=t.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(c)*t.ClipperOffset.def_arc_tolerance?E=Math.abs(c)*t.ClipperOffset.def_arc_tolerance:E=this.ArcTolerance;var F=3.14159265358979/Math.acos(1-E/Math.abs(c));this.m_sin=Math.sin(t.ClipperOffset.two_pi/F),this.m_cos=Math.cos(t.ClipperOffset.two_pi/F),this.m_StepsPerRad=F/t.ClipperOffset.two_pi,c<0&&(this.m_sin=-this.m_sin);for(var d=0;d<this.m_polyNodes.ChildCount();d++){var m=this.m_polyNodes.Childs()[d];this.m_srcPoly=m.m_polygon;var rt=this.m_srcPoly.length;if(!(rt===0||c<=0&&(rt<3||m.m_endtype!==t.EndType.etClosedPolygon))){if(this.m_destPoly=new Array(),rt===1){if(m.m_jointype===t.JoinType.jtRound)for(var vt=1,At=0,Mt=1;Mt<=F;Mt++){this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+vt*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y+At*c)));var Wt=vt;vt=vt*this.m_cos-this.m_sin*At,At=Wt*this.m_sin+At*this.m_cos;}else for(var vt=-1,At=-1,Mt=0;Mt<4;++Mt)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+vt*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y+At*c))),vt<0?vt=1:At<0?At=1:vt=-1;this.m_destPolys.push(this.m_destPoly);continue;}this.m_normals.length=0;for(var Mt=0;Mt<rt-1;Mt++)this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[Mt],this.m_srcPoly[Mt+1]));if(m.m_endtype===t.EndType.etClosedLine||m.m_endtype===t.EndType.etClosedPolygon?this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[rt-1],this.m_srcPoly[0])):this.m_normals.push(new t.DoublePoint1(this.m_normals[rt-2])),m.m_endtype===t.EndType.etClosedPolygon){for(var Zt=rt-1,Mt=0;Mt<rt;Mt++)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);this.m_destPolys.push(this.m_destPoly);}else if(m.m_endtype===t.EndType.etClosedLine){for(var Zt=rt-1,Mt=0;Mt<rt;Mt++)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array();for(var Xt=this.m_normals[rt-1],Mt=rt-1;Mt>0;Mt--)this.m_normals[Mt]=new t.DoublePoint2(-this.m_normals[Mt-1].X,-this.m_normals[Mt-1].Y);this.m_normals[0]=new t.DoublePoint2(-Xt.X,-Xt.Y),Zt=0;for(var Mt=rt-1;Mt>=0;Mt--)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);this.m_destPolys.push(this.m_destPoly);}else{for(var Zt=0,Mt=1;Mt<rt-1;++Mt)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);var ne;if(m.m_endtype===t.EndType.etOpenButt){var Mt=rt-1;ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[Mt].X+this.m_normals[Mt].X*c),t.ClipperOffset.Round(this.m_srcPoly[Mt].Y+this.m_normals[Mt].Y*c)),this.m_destPoly.push(ne),ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[Mt].X-this.m_normals[Mt].X*c),t.ClipperOffset.Round(this.m_srcPoly[Mt].Y-this.m_normals[Mt].Y*c)),this.m_destPoly.push(ne);}else{var Mt=rt-1;Zt=rt-2,this.m_sinA=0,this.m_normals[Mt]=new t.DoublePoint2(-this.m_normals[Mt].X,-this.m_normals[Mt].Y),m.m_endtype===t.EndType.etOpenSquare?this.DoSquare(Mt,Zt):this.DoRound(Mt,Zt);}for(var Mt=rt-1;Mt>0;Mt--)this.m_normals[Mt]=new t.DoublePoint2(-this.m_normals[Mt-1].X,-this.m_normals[Mt-1].Y);this.m_normals[0]=new t.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),Zt=rt-1;for(var Mt=Zt-1;Mt>0;--Mt)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);m.m_endtype===t.EndType.etOpenButt?(ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*c)),this.m_destPoly.push(ne),ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*c)),this.m_destPoly.push(ne)):(Zt=1,this.m_sinA=0,m.m_endtype===t.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly);}}}},t.ClipperOffset.prototype.Execute=function(){var c=arguments,d=c[0]instanceof t.PolyTree;if(d){var m=c[0],E=c[1];m.Clear(),this.FixOrientations(),this.DoOffset(E);var F=new t.Clipper(0);if(F.AddPaths(this.m_destPolys,t.PolyType.ptSubject,!0),E>0)F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftPositive,t.PolyFillType.pftPositive);else{var rt=t.Clipper.GetBounds(this.m_destPolys),vt=new t.Path();if(vt.push(new t.IntPoint2(rt.left-10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.top-10)),vt.push(new t.IntPoint2(rt.left-10,rt.top-10)),F.AddPath(vt,t.PolyType.ptSubject,!0),F.ReverseSolution=!0,F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftNegative,t.PolyFillType.pftNegative),m.ChildCount()===1&&m.Childs()[0].ChildCount()>0){var At=m.Childs()[0];m.Childs()[0]=At.Childs()[0],m.Childs()[0].m_Parent=m;for(var Mt=1;Mt<At.ChildCount();Mt++)m.AddChild(At.Childs()[Mt]);}else m.Clear();}}else{var m=c[0],E=c[1];t.Clear(m),this.FixOrientations(),this.DoOffset(E);var F=new t.Clipper(0);if(F.AddPaths(this.m_destPolys,t.PolyType.ptSubject,!0),E>0)F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftPositive,t.PolyFillType.pftPositive);else{var rt=t.Clipper.GetBounds(this.m_destPolys),vt=new t.Path();vt.push(new t.IntPoint2(rt.left-10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.top-10)),vt.push(new t.IntPoint2(rt.left-10,rt.top-10)),F.AddPath(vt,t.PolyType.ptSubject,!0),F.ReverseSolution=!0,F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftNegative,t.PolyFillType.pftNegative),m.length>0&&m.splice(0,1);}}},t.ClipperOffset.prototype.OffsetPoint=function(c,d,m){if(this.m_sinA=this.m_normals[d].X*this.m_normals[c].Y-this.m_normals[c].X*this.m_normals[d].Y,Math.abs(this.m_sinA*this.m_delta)<1){var E=this.m_normals[d].X*this.m_normals[c].X+this.m_normals[c].Y*this.m_normals[d].Y;if(E>0)return this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[d].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[d].Y*this.m_delta))),d;}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[d].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[d].Y*this.m_delta))),this.m_destPoly.push(new t.IntPoint1(this.m_srcPoly[c])),this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[c].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[c].Y*this.m_delta)));else switch(m){case t.JoinType.jtMiter:{var F=1+(this.m_normals[c].X*this.m_normals[d].X+this.m_normals[c].Y*this.m_normals[d].Y);F>=this.m_miterLim?this.DoMiter(c,d,F):this.DoSquare(c,d);break;}case t.JoinType.jtSquare:this.DoSquare(c,d);break;case t.JoinType.jtRound:this.DoRound(c,d);break;}return d=c,d;},t.ClipperOffset.prototype.DoSquare=function(c,d){var m=Math.tan(Math.atan2(this.m_sinA,this.m_normals[d].X*this.m_normals[c].X+this.m_normals[d].Y*this.m_normals[c].Y)/4);this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_delta*(this.m_normals[d].X-this.m_normals[d].Y*m)),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_delta*(this.m_normals[d].Y+this.m_normals[d].X*m)))),this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_delta*(this.m_normals[c].X+this.m_normals[c].Y*m)),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_delta*(this.m_normals[c].Y-this.m_normals[c].X*m))));},t.ClipperOffset.prototype.DoMiter=function(c,d,m){var E=this.m_delta/m;this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+(this.m_normals[d].X+this.m_normals[c].X)*E),t.ClipperOffset.Round(this.m_srcPoly[c].Y+(this.m_normals[d].Y+this.m_normals[c].Y)*E)));},t.ClipperOffset.prototype.DoRound=function(c,d){for(var m=Math.atan2(this.m_sinA,this.m_normals[d].X*this.m_normals[c].X+this.m_normals[d].Y*this.m_normals[c].Y),E=Math.max(t.Cast_Int32(t.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(m))),1),F=this.m_normals[d].X,rt=this.m_normals[d].Y,vt,At=0;At<E;++At)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+F*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+rt*this.m_delta))),vt=F,F=F*this.m_cos-this.m_sin*rt,rt=vt*this.m_sin+rt*this.m_cos;this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[c].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[c].Y*this.m_delta)));},t.Error=function(c){try{throw new Error(c);}catch(d){alert(d.message);}},t.JS={},t.JS.AreaOfPolygon=function(c,d){return d||(d=1),t.Clipper.Area(c)/(d*d);},t.JS.AreaOfPolygons=function(c,d){d||(d=1);for(var m=0,E=0;E<c.length;E++)m+=t.Clipper.Area(c[E]);return m/(d*d);},t.JS.BoundsOfPath=function(c,d){return t.JS.BoundsOfPaths([c],d);},t.JS.BoundsOfPaths=function(c,d){d||(d=1);var m=t.Clipper.GetBounds(c);return m.left/=d,m.bottom/=d,m.right/=d,m.top/=d,m;},t.JS.Clean=function(E,d){if(!(E instanceof Array))return[];var m=E[0]instanceof Array,E=t.JS.Clone(E);if(typeof d!="number"||d===null)return t.Error("Delta is not a number in Clean()."),E;if(E.length===0||E.length===1&&E[0].length===0||d<0)return E;m||(E=[E]);for(var F=E.length,rt,vt,At,Mt,Wt,Zt,Xt,ne=[],ue=0;ue<F;ue++)if(vt=E[ue],rt=vt.length,rt!==0){if(rt<3){At=vt,ne.push(At);continue;}for(At=vt,Mt=d*d,Wt=vt[0],Zt=1,Xt=1;Xt<rt;Xt++)(vt[Xt].X-Wt.X)*(vt[Xt].X-Wt.X)+(vt[Xt].Y-Wt.Y)*(vt[Xt].Y-Wt.Y)<=Mt||(At[Zt]=vt[Xt],Wt=vt[Xt],Zt++);Wt=vt[Zt-1],(vt[0].X-Wt.X)*(vt[0].X-Wt.X)+(vt[0].Y-Wt.Y)*(vt[0].Y-Wt.Y)<=Mt&&Zt--,Zt<rt&&At.splice(Zt,rt-Zt),At.length&&ne.push(At);}return!m&&ne.length?ne=ne[0]:!m&&ne.length===0?ne=[]:m&&ne.length===0&&(ne=[[]]),ne;},t.JS.Clone=function(c){if(!(c instanceof Array))return[];if(c.length===0)return[];if(c.length===1&&c[0].length===0)return[[]];var d=c[0]instanceof Array;d||(c=[c]);var m=c.length,E,F,rt,vt,At=new Array(m);for(F=0;F<m;F++){for(E=c[F].length,vt=new Array(E),rt=0;rt<E;rt++)vt[rt]={X:c[F][rt].X,Y:c[F][rt].Y};At[F]=vt;}return d||(At=At[0]),At;},t.JS.Lighten=function(c,d){if(!(c instanceof Array))return[];if(typeof d!="number"||d===null)return t.Error("Tolerance is not a number in Lighten()."),t.JS.Clone(c);if(c.length===0||c.length===1&&c[0].length===0||d<0)return t.JS.Clone(c);var m=c[0]instanceof Array;m||(c=[c]);var E,F,rt,vt,At,Mt,Wt,Zt,Xt,ne,ue,Se,Ie,We,Mr,gn,Ri,Cl=c.length,Of=d*d,Oi=[];for(E=0;E<Cl;E++)if(rt=c[E],Mt=rt.length,Mt!==0){for(vt=0;vt<1e6;vt++){for(At=[],Mt=rt.length,rt[Mt-1].X!==rt[0].X||rt[Mt-1].Y!==rt[0].Y?(Se=1,rt.push({X:rt[0].X,Y:rt[0].Y}),Mt=rt.length):Se=0,ue=[],F=0;F<Mt-2;F++)Wt=rt[F],Xt=rt[F+1],Zt=rt[F+2],gn=Wt.X,Ri=Wt.Y,Ie=Zt.X-gn,We=Zt.Y-Ri,(Ie!==0||We!==0)&&(Mr=((Xt.X-gn)*Ie+(Xt.Y-Ri)*We)/(Ie*Ie+We*We),Mr>1?(gn=Zt.X,Ri=Zt.Y):Mr>0&&(gn+=Ie*Mr,Ri+=We*Mr)),Ie=Xt.X-gn,We=Xt.Y-Ri,ne=Ie*Ie+We*We,ne<=Of&&(ue[F+1]=1,F++);for(At.push({X:rt[0].X,Y:rt[0].Y}),F=1;F<Mt-1;F++)ue[F]||At.push({X:rt[F].X,Y:rt[F].Y});if(At.push({X:rt[Mt-1].X,Y:rt[Mt-1].Y}),Se&&rt.pop(),ue.length)rt=At;else break;}Mt=At.length,At[Mt-1].X===At[0].X&&At[Mt-1].Y===At[0].Y&&At.pop(),At.length>2&&Oi.push(At);}return m||(Oi=Oi[0]),_typeof(Oi)>"u"&&(Oi=[]),Oi;},t.JS.PerimeterOfPath=function(c,d,m){if(_typeof(c)>"u")return 0;var E=Math.sqrt,F=0,rt,vt,At=0,Mt=0,Wt=0,Zt=0,Xt=c.length;if(Xt<2)return 0;for(d&&(c[Xt]=c[0],Xt++);--Xt;)rt=c[Xt],At=rt.X,Mt=rt.Y,vt=c[Xt-1],Wt=vt.X,Zt=vt.Y,F+=E((At-Wt)*(At-Wt)+(Mt-Zt)*(Mt-Zt));return d&&c.pop(),F/m;},t.JS.PerimeterOfPaths=function(c,d,m){m||(m=1);for(var E=0,F=0;F<c.length;F++)E+=t.JS.PerimeterOfPath(c[F],d,m);return E;},t.JS.ScaleDownPath=function(c,d){var m,E;for(d||(d=1),m=c.length;m--;)E=c[m],E.X=E.X/d,E.Y=E.Y/d;},t.JS.ScaleDownPaths=function(c,d){var m,E,F;for(d||(d=1),m=c.length;m--;)for(E=c[m].length;E--;)F=c[m][E],F.X=F.X/d,F.Y=F.Y/d;},t.JS.ScaleUpPath=function(c,d){var m,E,F=Math.round;for(d||(d=1),m=c.length;m--;)E=c[m],E.X=F(E.X*d),E.Y=F(E.Y*d);},t.JS.ScaleUpPaths=function(c,d){var m,E,F,rt=Math.round;for(d||(d=1),m=c.length;m--;)for(E=c[m].length;E--;)F=c[m][E],F.X=rt(F.X*d),F.Y=rt(F.Y*d);},t.ExPolygons=function(){return[];},t.ExPolygon=function(){this.outer=null,this.holes=null;},t.JS.AddOuterPolyNodeToExPolygons=function(c,d){var m=new t.ExPolygon();m.outer=c.Contour();var E=c.Childs(),F=E.length;m.holes=new Array(F);var rt,vt,At,Mt,Wt,Zt;for(At=0;At<F;At++)for(rt=E[At],m.holes[At]=rt.Contour(),Mt=0,Wt=rt.Childs(),Zt=Wt.length;Mt<Zt;Mt++)vt=Wt[Mt],t.JS.AddOuterPolyNodeToExPolygons(vt,d);d.push(m);},t.JS.ExPolygonsToPaths=function(c){var d,m,E,F,rt=new t.Paths();for(d=0,E=c.length;d<E;d++)for(rt.push(c[d].outer),m=0,F=c[d].holes.length;m<F;m++)rt.push(c[d].holes[m]);return rt;},t.JS.PolyTreeToExPolygons=function(c){var d=new t.ExPolygons(),m,E,F,rt;for(E=0,F=c.Childs(),rt=F.length;E<rt;E++)m=F[E],t.JS.AddOuterPolyNodeToExPolygons(m,d);return d;};})();})(v2);var xmt=v2.exports;var vr=/* @__PURE__ */$n(xmt),g2=/* @__PURE__ */new WeakMap(),Pmt=/* @__PURE__ */new WeakMap(),du=/* @__PURE__ */new WeakMap(),zy=/* @__PURE__ */new WeakMap(),$y=/* @__PURE__ */new WeakMap();function bmt(r,t,e,n){var i=du.get(r);i||(i=/* @__PURE__ */new Map(),du.set(r,i)),i.set(t,_objectSpread(_objectSpread({},e),{},{gestureOwner:n}));}function gv(r,t){if(!r)return;var e=du.get(r),n=e==null?void 0:e.get(t);if(!n)return;if(e==null||e.delete(t),e!=null&&e.size||du.delete(r),!n.gestureOwner)return n;var i=zy.get(n.gestureOwner),s=m2(n.matrix,i==null?void 0:i.matrix);if(zy.set(n.gestureOwner,{matrix:n.matrix,toDigest:n.toDigest}),!!s)return{matrix:s,fromDigest:(i==null?void 0:i.toDigest)||n.fromDigest,toDigest:n.toDigest};}function Amt(r,t,e,n){var i=e?m2(n,$y.get(e)):n;return e&&$y.set(e,n),i?(mv(r,t,i),!0):(vp(r,t),!1);}function m2(r,t){if(!t)return _toConsumableArray(r);var e=Mmt(t);return e?Emt(r,e):void 0;}function Emt(r,t){return[r[0]*t[0]+r[2]*t[1],r[1]*t[0]+r[3]*t[1],r[0]*t[2]+r[2]*t[3],r[1]*t[2]+r[3]*t[3],r[0]*t[4]+r[2]*t[5]+r[4],r[1]*t[4]+r[3]*t[5]+r[5]];}function Mmt(r){var _r4=_slicedToArray(r,6),t=_r4[0],e=_r4[1],n=_r4[2],i=_r4[3],s=_r4[4],o=_r4[5],a=t*i-e*n;if(!(!Number.isFinite(a)||Math.abs(a)<=Number.EPSILON))return[i/a,-e/a,-n/a,t/a,(n*o-i*s)/a,(e*s-t*o)/a];}function mv(r,t,e){var n;var _iterator4=_createForOfIteratorHelper(((n=g2.get(r))==null?void 0:n.get(t))||[]),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var i=_step4.value;i(e);}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}function Lmt(r,t){var e,n;return!!((n=(e=g2.get(r))==null?void 0:e.get(t))!=null&&n.size);}function vp(r,t){var e;var _iterator5=_createForOfIteratorHelper(((e=Pmt.get(r))==null?void 0:e.get(t))||[]),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var n=_step5.value;n();}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}var yv=16,Rmt=1;function No(r){return Object.prototype.hasOwnProperty.call(r,"eraserFaces");}function Yy(r,t){var _r$eraserFaces;var e=_objectSpread({},t);return No(t)?delete e.eraserlines:r&&No(r)&&(e.eraserFaces=(_r$eraserFaces=r.eraserFaces)!==null&&_r$eraserFaces!==void 0?_r$eraserFaces:null,delete e.eraserlines),e;}function gp(r){var t=_objectSpread({},r);return delete t.doingLines,t;}function Omt(r,t,e){var n=No(r)?r.eraserFaces?pu(r.eraserFaces):[]:Gy(r.eraserlines||[]);return{eraserFaces:y2(jy(n,jy([],Gy(t))))};}function y2(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:yv;if(!Number.isSafeInteger(t)||t<=0)throw new Error("eraserFaces scale must be a positive safe integer");var e=[];Ga(e,r.length);var _iterator6=_createForOfIteratorHelper(r),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var n=_step6.value;Ga(e,n.rings.length);var _iterator7=_createForOfIteratorHelper(n.rings),_step7;try{var _loop=function _loop(){var i=_step7.value;Ga(e,i.length);var s=0,o=0;i.forEach(function(_ref53,h){var _ref54=_slicedToArray(_ref53,2),a=_ref54[0],u=_ref54[1];var v=Hy(a,t),p=Hy(u,t);Vy(e,h===0?v:v-s),Vy(e,h===0?p:p-o),s=v,o=p;});};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}return{v:1,s:t,e:1,d:T2(e)};}function pu(r){if(r.v!==1||r.e!==1||r.s<=0)throw new Error("unsupported eraserFaces payload");var t=new kmt(Bmt(r.d)),e=[],n=t.readUVarint();for(var i=0;i<n;i++){var s=[],o=t.readUVarint();for(var a=0;a<o;a++){var u=[],h=t.readUVarint();var v=0,p=0;for(var y=0;y<h;y++){var C=t.readSVarint(),b=t.readSVarint();v=y===0?C:v+C,p=y===0?b:p+b,u.push([v/r.s,p/r.s]);}s.push(u);}e.push({rings:s});}if(!t.done)throw new Error("trailing eraserFaces bytes");return e;}function Gy(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:yv;var e=[];var _iterator8=_createForOfIteratorHelper(r),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var n=_step8.value;var i=new vr.ClipperOffset();i.ArcTolerance=Math.max(0.25,t*0.05);var _iterator9=_createForOfIteratorHelper(n.op),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var s=_step9.value;var o=[];for(var a=0;a<s.length;a+=2)o.push({X:Math.round(s[a]*t),Y:Math.round(s[a+1]*t)});o.length===1&&o.push(_objectSpread({},o[0])),o.length>=2&&i.AddPath(o,vr.JoinType.jtRound,vr.EndType.etOpenRound);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}i.Execute(e,n.thickness*t/2);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}return S2(e,t);}function jy(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:yv;var n=[].concat(_toConsumableArray(r),_toConsumableArray(t)).flatMap(function(i){return i.rings.map(function(s){return s.map(function(_ref55){var _ref56=_slicedToArray(_ref55,2),o=_ref56[0],a=_ref56[1];return{X:Math.round(o*e),Y:Math.round(a*e)};});});});return S2(n,e);}function Wo(r,t){var e=[Rmt];return Zy(e,r),Zy(e,t),T2(Array.from(Nmt(Uint8Array.from(e)).slice(0,16)));}function w2(r,t,e){return r.matrix.length===6&&r.matrix.every(Number.isFinite)&&r.fromDigest===Wo(t,e)&&/^[A-Za-z0-9_-]{22}$/.test(r.toDigest);}function Dmt(r,t,e,n,i){return!w2(e,n.op,n.centerPos)||e.toDigest!==Wo(i.op,i.centerPos)?!1:(mv(r,t,e.matrix),!0);}function Ld(r,t){if(!r)return null;var e=pu(r);var _iterator0=_createForOfIteratorHelper(e),_step0;try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){var n=_step0.value;var _iterator1=_createForOfIteratorHelper(n.rings),_step1;try{var _loop2=function _loop2(){var i=_step1.value;var s=i.flat();t(s),n.rings[n.rings.indexOf(i)]=Array.from({length:s.length/2},function(o,a){return[s[a*2],s[a*2+1]];});};for(_iterator1.s();!(_step1=_iterator1.n()).done;){_loop2();}}catch(err){_iterator1.e(err);}finally{_iterator1.f();}}}catch(err){_iterator0.e(err);}finally{_iterator0.f();}return y2(e,r.s);}function S2(r,t){if(!r.length)return[];var e=new vr.Clipper();e.AddPaths(r,vr.PolyType.ptSubject,!0);var n=new vr.PolyTree();e.Execute(vr.ClipType.ctUnion,n,vr.PolyFillType.pftNonZero,vr.PolyFillType.pftNonZero);var i=[],_s9=function s(o){var _iterator10=_createForOfIteratorHelper(o.Childs()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var a=_step10.value;if(!a.IsHole()){var u=[Xy(a.Contour(),t)];var _iterator11=_createForOfIteratorHelper(a.Childs()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var h=_step11.value;h.IsHole()&&u.push(Xy(h.Contour(),t));}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}i.push({rings:u});}_s9(a);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}};return _s9(n),i;}function Xy(r,t){return r.map(function(_ref57){var e=_ref57.X,n=_ref57.Y;return[e/t,n/t];});}function Hy(r,t){if(!Number.isFinite(r))throw new Error("eraserFaces coordinate must be finite");var e=Math.round(r*t);if(!Number.isSafeInteger(e))throw new Error("eraserFaces coordinate is out of range");return Object.is(e,-0)?0:e;}function Ga(r,t){if(!Number.isSafeInteger(t)||t<0)throw new Error("invalid unsigned varint");do{var e=t%128;t=Math.floor(t/128),t&&(e|=128),r.push(e);}while(t);}function Vy(r,t){var e=t>=0?t*2:-t*2-1;Ga(r,e);}function Zy(r,t){Ga(r,t.length);var e=new ArrayBuffer(8),n=new DataView(e);var _iterator12=_createForOfIteratorHelper(t),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var i=_step12.value;if(!Number.isFinite(i))throw new Error("geometry digest values must be finite");var s=Object.is(i,-0)?0:i;n.setFloat64(0,s,!0);for(var o=0;o<8;o++)r.push(n.getUint8(o));}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}function Nmt(r){var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e=r.length*8,n=Math.ceil((r.length+9)/64)*64,i=new Uint8Array(n);i.set(r),i[r.length]=128;var s=new DataView(i.buffer);s.setUint32(n-8,Math.floor(e/4294967296),!1),s.setUint32(n-4,e>>>0,!1);var o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),u=function u(p,y){return p>>>y|p<<32-y;};for(var p=0;p<n;p+=64){for(var A=0;A<16;A++)a[A]=s.getUint32(p+A*4,!1);for(var _A2=16;_A2<64;_A2++){var w=a[_A2-15],S=a[_A2-2],x=u(w,7)^u(w,18)^w>>>3,P=u(S,17)^u(S,19)^S>>>10;a[_A2]=a[_A2-16]+x+a[_A2-7]+P>>>0;}var _o6=_slicedToArray(o,8),y=_o6[0],C=_o6[1],b=_o6[2],M=_o6[3],L=_o6[4],X=_o6[5],Y=_o6[6],et=_o6[7];for(var _A3=0;_A3<64;_A3++){var _w2=u(L,6)^u(L,11)^u(L,25),_S2=L&X^~L&Y,_x9=et+_w2+_S2+t[_A3]+a[_A3]>>>0,_P2=u(y,2)^u(y,13)^u(y,22),z=y&C^y&b^C&b,U=_P2+z>>>0;et=Y,Y=X,X=L,L=M+_x9>>>0,M=b,b=C,C=y,y=_x9+U>>>0;}o[0]=o[0]+y>>>0,o[1]=o[1]+C>>>0,o[2]=o[2]+b>>>0,o[3]=o[3]+M>>>0,o[4]=o[4]+L>>>0,o[5]=o[5]+X>>>0,o[6]=o[6]+Y>>>0,o[7]=o[7]+et>>>0;}var h=new Uint8Array(32),v=new DataView(h.buffer);return o.forEach(function(p,y){return v.setUint32(y*4,p,!1);}),h;}var kmt=/*#__PURE__*/function(){function kmt(t){_classCallCheck(this,kmt);ht(this,"index",0);this.bytes=t;}return _createClass(kmt,[{key:"done",get:function get(){return this.index===this.bytes.length;}},{key:"readUVarint",value:function readUVarint(){var t=0,e=1;for(var n=0;n<8;n++){var i=this.bytes[this.index++];if(i===void 0)throw new Error("truncated eraserFaces payload");if(t+=(i&127)*e,!(i&128))return t;e*=128;}throw new Error("eraserFaces varint is too long");}},{key:"readSVarint",value:function readSVarint(){var t=this.readUVarint();return t%2===0?t/2:-(t+1)/2;}}]);}();function T2(r){var t="";for(var e=0;e<r.length;e+=32768)t+=String.fromCharCode.apply(String,_toConsumableArray(r.slice(e,e+32768)));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");}function Bmt(r){var t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(r.length/4)*4,"="),e=atob(t);return Uint8Array.from(e,function(n){return n.charCodeAt(0);});}var Fmt=/*#__PURE__*/function(_ei4){function Fmt(){var _this31;_classCallCheck(this,Fmt);_this31=_callSuper(this,Fmt,arguments);ht(_this31,"emitEventType",ve.TranslateNode);ht(_this31,"updateSelectorCallback",function(e){var Y;var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=e.smoothSync,h=n.willSyncService,v=n.isSync,p=n.updateSelectorOpt,y=n.textUpdateForWoker,C=n.needUndoTicker,b=p.workState,M=i.render||[],L=i.sp||[];if(b===te.Start)return{sp:[{type:It.SelectorTransform,emitEventType:_this31.emitEventType,workState:b}],render:[]};var X=a==null?void 0:a.selectRect;if(h){var et=b===te.Done?C:void 0;L.push({type:It.Select,selectIds:o.selectIds,selectRect:X,willSyncService:b===te.Done?!0:u,isSync:!0,points:b===te.Done&&o.getChildrenPoints()||void 0,textOpt:o.textOpt,needUndoTicker:et,emitEventType:_this31.emitEventType});var A={workState:b,useAnimation:p.useAnimation||!1};p.uid&&(A.uid=p.uid);var _iterator13=_createForOfIteratorHelper(s.entries()),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var _step13$value=_slicedToArray(_step13.value,2),w=_step13$value[0],S=_step13$value[1];S.toolsType===St.BackgroundSVG&&L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:It.BackgroundSVGUpdate,dataType:Qt.Local,willSyncService:b===te.Done?!0:u,updateNodeOpt:A,needUndoTicker:et,emitEventType:_this31.emitEventType})),y&&S.toolsType===St.Text?L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:It.TextUpdate,dataType:Qt.Local,willSyncService:b===te.Done?!0:u,updateNodeOpt:A,needUndoTicker:et,emitEventType:_this31.emitEventType})):(u||b===te.Done)&&L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:It.UpdateNode,updateNodeOpt:_objectSpread(_objectSpread({},A),{},{eraserGeometryDelta:gv((Y=_this31.localWork)==null?void 0:Y.vNodes,w)}),isSync:v,needUndoTicker:et,emitEventType:_this31.emitEventType}));}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}return C&&L.push({type:It.None,needUndoTicker:C}),L.push({type:It.SelectorTransform,emitEventType:_this31.emitEventType,workState:b}),{render:M,sp:L};});return _this31;}_inherits(Fmt,_ei4);return _createClass(Fmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(e){var y,C,n,i,s,o,a,u,h,v,p,_t7;return _regenerator().w(function(_context4){while(1)switch(_context4.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.emitEventType,v=e.smoothSync,p=e.needUndoTicker;_t7=n===De&&i;if(!_t7){_context4.n=3;break;}if(!(i.workState===te.Done&&i!=null&&i.translate&&(i.translate[0]||i.translate[1])||i.workState!==te.Done)){_context4.n=2;break;}_context4.n=1;return(y=this.localWork)==null?void 0:y.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,isSync:!0,textUpdateForWoker:u,emitEventType:h,callback:this.updateSelectorCallback,smoothSync:v,needUndoTicker:p});case 1:_context4.n=3;break;case 2:i.workState===te.Done&&((C=this.localWork)==null||C.vNodes.deleteLastTarget());case 3:return _context4.a(2);}},_callee4,this);}));function consumeForLocalWorker(_x0){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Wmt=/*#__PURE__*/function(_ei5){function Wmt(){var _this32;_classCallCheck(this,Wmt);_this32=_callSuper(this,Wmt,arguments);ht(_this32,"emitEventType",ve.ScaleNode);ht(_this32,"updateSelectorCallback",function(e){var X;var n=e.param,i=e.postData,s=e.workShapeNode,o=e.res,a=e.newServiceStore,u=e.smoothSync,h=n.updateSelectorOpt,v=n.willSyncService,p=n.needUndoTicker,y=h.workState,C=i.render||[],b=i.sp||[],M=o==null?void 0:o.selectRect,L=y===te.Done?p:void 0;if(y===te.Start)return{sp:[{type:It.SelectorTransform,emitEventType:_this32.emitEventType,workState:y}],render:[]};if(v){b.push({type:It.Select,selectIds:s.selectIds,selectRect:M,willSyncService:y===te.Done?!0:u,isSync:!0,points:y===te.Done&&s.getChildrenPoints()||void 0,textOpt:s.textOpt});var Y={useAnimation:h.useAnimation||!1};h.uid&&(Y.uid=h.uid);var _iterator14=_createForOfIteratorHelper(a.entries()),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var _step14$value=_slicedToArray(_step14.value,2),et=_step14$value[0],A=_step14$value[1];A.toolsType===St.BackgroundSVG&&b.push(_objectSpread(_objectSpread({},A),{},{workId:et,type:It.BackgroundSVGUpdate,dataType:Qt.Local,willSyncService:y===te.Done?!0:u,updateNodeOpt:Y,needUndoTicker:L,emitEventType:_this32.emitEventType})),A.toolsType===St.Text?b.push(_objectSpread(_objectSpread({},A),{},{workId:et,type:It.TextUpdate,dataType:Qt.Local,willSyncService:y===te.Done?!0:u,updateNodeOpt:Y,needUndoTicker:L,emitEventType:_this32.emitEventType})):(u||y===te.Done)&&b.push(_objectSpread(_objectSpread({},A),{},{workId:et,type:It.UpdateNode,updateNodeOpt:_objectSpread(_objectSpread({},Y),{},{eraserGeometryDelta:gv((X=_this32.localWork)==null?void 0:X.vNodes,et)}),isSync:!0,needUndoTicker:L,emitEventType:_this32.emitEventType}));}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}return p&&b.push({type:It.None,needUndoTicker:p}),b.push({type:It.SelectorTransform,emitEventType:_this32.emitEventType,workState:y}),{render:C,sp:b};});return _this32;}_inherits(Wmt,_ei5);return _createClass(Wmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(e){var h,n,i,s,o,a,u,_t8;return _regenerator().w(function(_context5){while(1)switch(_context5.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willSyncService,o=e.willSerializeData,a=e.smoothSync,u=e.needUndoTicker;_t8=n===De&&i;if(!_t8){_context5.n=1;break;}_context5.n=1;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:i,willSyncService:s,willSerializeData:o,isSync:!0,callback:this.updateSelectorCallback.bind(this),smoothSync:a,needUndoTicker:u});case 1:return _context5.a(2);}},_callee5,this);}));function consumeForLocalWorker(_x1){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Umt=/*#__PURE__*/function(_ei6){function Umt(){var _this33;_classCallCheck(this,Umt);_this33=_callSuper(this,Umt,arguments);ht(_this33,"emitEventType",ve.RotateNode);ht(_this33,"updateSelectorCallback",function(e){var et;var n=e.param,i=e.postData,s=e.workShapeNode,o=e.res,a=e.newServiceStore,u=e.smoothSync,h=n.updateSelectorOpt,v=n.willSyncService,p=n.willSerializeData,y=n.isSync,C=n.needUndoTicker,b=h.workState,M=i.render||[],L=i.sp||[],X=o==null?void 0:o.selectRect,Y=b===te.Done?C:void 0;if(v){p&&b===te.Done&&L.push({type:It.Select,selectIds:s.selectIds,selectRect:X,willSyncService:!0,isSync:y,points:s.getChildrenPoints(),textOpt:s.textOpt,selectorColor:s.selectorColor,strokeColor:s.strokeColor,fillColor:s.fillColor,canTextEdit:s.canTextEdit,canRotate:s.canRotate,scaleType:s.scaleType,opt:s.getWorkOptions()||void 0,canLock:s.canLock,isLocked:s.isLocked,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt,thickness:s.thickness,useStroke:s.useStroke,strokeType:s.strokeType});var A={useAnimation:h.useAnimation||!1};if(h.uid&&(A.uid=h.uid),u||b===te.Done){var _iterator15=_createForOfIteratorHelper(a.entries()),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var _step15$value=_slicedToArray(_step15.value,2),w=_step15$value[0],S=_step15$value[1];L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:It.UpdateNode,updateNodeOpt:_objectSpread(_objectSpread({},A),{},{eraserGeometryDelta:gv((et=_this33.localWork)==null?void 0:et.vNodes,w)}),isSync:y,needUndoTicker:Y,emitEventType:_this33.emitEventType}));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}}return C&&L.push({type:It.None,needUndoTicker:C}),L.push({type:It.SelectorTransform,emitEventType:_this33.emitEventType,workState:b}),{render:M,sp:L};});return _this33;}_inherits(Umt,_ei6);return _createClass(Umt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(e){var p,n,i,s,o,a,u,h,v,_t9;return _regenerator().w(function(_context6){while(1)switch(_context6.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.emitEventType,h=e.smoothSync,v=e.needUndoTicker;_t9=n===De&&i;if(!_t9){_context6.n=1;break;}_context6.n=1;return(p=this.localWork)==null?void 0:p.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:u,isSync:!0,callback:this.updateSelectorCallback,smoothSync:h,needUndoTicker:v});case 1:return _context6.a(2);}},_callee6,this);}));function consumeForLocalWorker(_x10){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var zmt=/*#__PURE__*/function(_ei7){function zmt(){var _this34;_classCallCheck(this,zmt);_this34=_callSuper(this,zmt,arguments);ht(_this34,"emitEventType",ve.SetFontStyle);return _this34;}_inherits(zmt,_ei7);return _createClass(zmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(e){var v,n,i,s,o,a,u,h,_t0;return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.requestId;_t0=n===De&&i;if(!_t0){_context7.n=1;break;}_context7.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,textUpdateForWoker:u,callback:this.updateSelectorCallback});case 1:return _context7.a(2);}},_callee7,this);}));function consumeForLocalWorker(_x11){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=n.willSyncService,h=n.isSync,v=n.updateSelectorOpt,p=n.textUpdateForWoker,y=n.requestId,C=n.emitEventType,b=i.render||[],M=i.sp||[],L=a==null?void 0:a.selectRect;if(u&&M){v.fontSize&&M.push({type:It.Select,selectIds:o.selectIds,selectRect:L,willSyncService:u,isSync:h,points:o.getChildrenPoints()});var _iterator16=_createForOfIteratorHelper(s.entries()),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _step16$value=_slicedToArray(_step16.value,2),X=_step16$value[0],Y=_step16$value[1];p&&Y.toolsType===St.Text?M.push(_objectSpread(_objectSpread({},Y),{},{workId:X,type:It.TextUpdate,dataType:Qt.Local,willSyncService:!0,emitEventType:C,requestId:y})):M.push(_objectSpread(_objectSpread({},Y),{},{workId:X,type:It.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h,emitEventType:C,requestId:y}));}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}}return{render:b,sp:M};}}]);}(ei);var $mt=/*#__PURE__*/function(_ei8){function $mt(){var _this35;_classCallCheck(this,$mt);_this35=_callSuper(this,$mt,arguments);ht(_this35,"emitEventType",ve.SetPoint);ht(_this35,"updateSelectorCallback",function(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=n.willSyncService,h=n.isSync,v=n.needUndoTicker,p=i.render||[],y=i.sp||[],C=a==null?void 0:a.selectRect;if(u&&y){var _iterator17=_createForOfIteratorHelper(s.entries()),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var _step17$value=_slicedToArray(_step17.value,2),b=_step17$value[0],M=_step17$value[1];y.push(_objectSpread(_objectSpread({},M),{},{workId:b,type:It.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h,needUndoTicker:v,emitEventType:_this35.emitEventType}));}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}y.push({type:It.Select,selectIds:o.selectIds,selectRect:C,willSyncService:u,isSync:h,points:o.getChildrenPoints()});}return v&&y.push({type:It.None,needUndoTicker:v}),y.push({type:It.SelectorTransform,emitEventType:_this35.emitEventType,workState:n.updateSelectorOpt.workState}),{render:p,sp:y};});return _this35;}_inherits($mt,_ei8);return _createClass($mt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(e){var v,n,i,s,o,a,u,h,_t1;return _regenerator().w(function(_context8){while(1)switch(_context8.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.needUndoTicker;_t1=n===De&&i;if(!_t1){_context8.n=1;break;}_context8.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,emitEventType:this.emitEventType,willSerializeData:a,isSync:!0,textUpdateForWoker:u,callback:this.updateSelectorCallback,needUndoTicker:h});case 1:return _context8.a(2);}},_callee8,this);}));function consumeForLocalWorker(_x12){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Ymt=/*#__PURE__*/function(_ei9){function Ymt(){var _this36;_classCallCheck(this,Ymt);_this36=_callSuper(this,Ymt,arguments);ht(_this36,"emitEventType",ve.SetLock);return _this36;}_inherits(Ymt,_ei9);return _createClass(Ymt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(e){var v,n,i,s,o,a,u,h,_t10;return _regenerator().w(function(_context9){while(1)switch(_context9.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.needUndoTicker,h=e.requestId;_t10=n===De&&i;if(!_t10){_context9.n=1;break;}_context9.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,callback:this.updateSelectorCallback,needUndoTicker:u});case 1:return _context9.a(2);}},_callee9,this);}));function consumeForLocalWorker(_x13){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=n.willSyncService,h=n.isSync,v=n.updateSelectorOpt,p=n.needUndoTicker,y=n.requestId,C=n.emitEventType,b=i.render||[],M=i.sp||[],L=a==null?void 0:a.selectRect;if(u&&M){var _iterator18=_createForOfIteratorHelper(s.entries()),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var _step18$value=_slicedToArray(_step18.value,2),X=_step18$value[0],Y=_step18$value[1];M.push(_objectSpread(_objectSpread({},Y),{},{workId:X,type:It.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h,emitEventType:C,requestId:y}));}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}M.push({isLocked:v.isLocked,selectorColor:o.selectorColor,scaleType:o.scaleType,canRotate:o.canRotate,type:It.Select,selectIds:o.selectIds,selectRect:L,willSyncService:u,isSync:h});}return p&&M.push({type:It.None,needUndoTicker:p}),{render:b,sp:M};}}]);}(ei);var Gmt=/*#__PURE__*/function(_ei0){function Gmt(){var _this37;_classCallCheck(this,Gmt);_this37=_callSuper(this,Gmt,arguments);ht(_this37,"emitEventType",ve.SetShapeOpt);return _this37;}_inherits(Gmt,_ei0);return _createClass(Gmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===It.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker0=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(e){var v,n,i,s,o,a,u,h,_t11;return _regenerator().w(function(_context0){while(1)switch(_context0.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.needUndoTicker,h=e.requestId;_t11=n===De&&i;if(!_t11){_context0.n=1;break;}_context0.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,callback:this.updateSelectorCallback,needUndoTicker:u});case 1:return _context0.a(2);}},_callee0,this);}));function consumeForLocalWorker(_x14){return _consumeForLocalWorker0.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=n.willSyncService,a=n.isSync,u=n.needUndoTicker,h=n.requestId,v=n.emitEventType,p=i.render||[],y=i.sp||[];if(o&&y){var _iterator19=_createForOfIteratorHelper(s.entries()),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var _step19$value=_slicedToArray(_step19.value,2),C=_step19$value[0],b=_step19$value[1];y.push(_objectSpread(_objectSpread({},b),{},{workId:C,type:It.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:a,emitEventType:v,requestId:h}));}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}}return u&&y.push({type:It.None,needUndoTicker:u}),{render:p,sp:y};}}]);}(ei);var I2=/*#__PURE__*/function(){function I2(t){var _this38=this;_classCallCheck(this,I2);ht(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(t.map(function(e){return[e,_this38.build(e)];}));}return _createClass(I2,[{key:"build",value:function build(t){switch(t){case ve.TranslateNode:return new Fmt();case ve.ZIndexNode:return new Cmt();case ve.CopyNode:return new Tmt();case ve.SetColorNode:return new Imt();case ve.ScaleNode:return new Wmt();case ve.RotateNode:return new Umt();case ve.SetFontStyle:return new zmt();case ve.SetPoint:return new $mt();case ve.SetLock:return new Ymt();case ve.SetShapeOpt:return new Gmt();}}},{key:"registerForWorker",value:function registerForWorker(t){return this.builders.forEach(function(e){e&&e.registerForWorker(t);}),this;}},{key:"consumeForWorker",value:function(){var _consumeForWorker=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(t){var _iterator20,_step20,e,n,_t12,_t13,_t14;return _regenerator().w(function(_context1){while(1)switch(_context1.p=_context1.n){case 0:_iterator20=_createForOfIteratorHelper(this.builders.values());_context1.p=1;_iterator20.s();case 2:if((_step20=_iterator20.n()).done){_context1.n=7;break;}e=_step20.value;n=e==null?void 0:e.consume(t);_t12=n;if(!_t12){_context1.n=5;break;}_t13=n===!0;if(_t13){_context1.n=4;break;}_context1.n=3;return n;case 3:_t13=_context1.v;case 4:_t12=_t13;case 5:if(!_t12){_context1.n=6;break;}return _context1.a(2,!0);case 6:_context1.n=2;break;case 7:_context1.n=9;break;case 8:_context1.p=8;_t14=_context1.v;_iterator20.e(_t14);case 9:_context1.p=9;_iterator20.f();return _context1.f(9);case 10:return _context1.a(2,!1);}},_callee1,this,[[1,8,9,10]]);}));function consumeForWorker(_x15){return _consumeForWorker.apply(this,arguments);}return consumeForWorker;}()}]);}();var jmt={linear:function linear(r){return r;},easeInQuad:function easeInQuad(r){return r*r;},easeOutQuad:function easeOutQuad(r){return r*(2-r);},easeInOutQuad:function easeInOutQuad(r){return r<0.5?2*r*r:-1+(4-2*r)*r;},easeInCubic:function easeInCubic(r){return r*r*r;},easeOutCubic:function easeOutCubic(r){return--r*r*r+1;},easeInOutCubic:function easeInOutCubic(r){return r<0.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1;},easeInQuart:function easeInQuart(r){return r*r*r*r;},easeOutQuart:function easeOutQuart(r){return 1- --r*r*r*r;},easeInOutQuart:function easeInOutQuart(r){return r<0.5?8*r*r*r*r:1-8*--r*r*r*r;},easeInQuint:function easeInQuint(r){return r*r*r*r*r;},easeOutQuint:function easeOutQuint(r){return 1+--r*r*r*r*r;},easeInOutQuint:function easeInOutQuint(r){return r<0.5?16*r*r*r*r*r:1+16*--r*r*r*r*r;},easeInSine:function easeInSine(r){return 1-Math.cos(r*Math.PI/2);},easeOutSine:function easeOutSine(r){return Math.sin(r*Math.PI/2);},easeInOutSine:function easeInOutSine(r){return-(Math.cos(Math.PI*r)-1)/2;},easeInExpo:function easeInExpo(r){return r<=0?0:Math.pow(2,10*r-10);},easeOutExpo:function easeOutExpo(r){return r>=1?1:1-Math.pow(2,-10*r);},easeInOutExpo:function easeInOutExpo(r){return r<=0?0:r>=1?1:r<0.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2;}};var xt=/*#__PURE__*/function(){function xt(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,xt);this.x=t,this.y=e,this.z=n;}return _createClass(xt,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(t){return this.z=t,this;}},{key:"setXY",value:function setXY(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;return this.x=t,this.y=e,this;}},{key:"set",value:function set(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=t,this.y=e,this.z=n,this;}},{key:"setTo",value:function setTo(_ref58){var _ref58$x=_ref58.x,t=_ref58$x===void 0?0:_ref58$x,_ref58$y=_ref58.y,e=_ref58$y===void 0?0:_ref58$y,_ref58$z=_ref58.z,n=_ref58$z===void 0?1:_ref58$z;return this.x=t,this.y=e,this.z=n,this;}},{key:"rot",value:function rot(t){if(t===0)return this;var e=this.x,n=this.y,i=Math.sin(t),s=Math.cos(t);return this.x=e*s-n*i,this.y=e*i+n*s,this;}},{key:"rotWith",value:function rotWith(t,e){if(e===0)return this;var n=this.x-t.x,i=this.y-t.y,s=Math.sin(e),o=Math.cos(e);return this.x=t.x+(n*o-i*s),this.y=t.y+(n*s+i*o),this;}},{key:"clone",value:function clone(){var t=this.x,e=this.y,n=this.z;return new xt(t,e,n);}},{key:"sub",value:function sub(t){return this.x-=t.x,this.y-=t.y,this;}},{key:"subXY",value:function subXY(t,e){return this.x-=t,this.y-=e,this;}},{key:"subScalar",value:function subScalar(t){return this.x-=t,this.y-=t,this;}},{key:"add",value:function add(t){return this.x+=t.x,this.y+=t.y,this;}},{key:"addXY",value:function addXY(t,e){return this.x+=t,this.y+=e,this;}},{key:"addScalar",value:function addScalar(t){return this.x+=t,this.y+=t,this;}},{key:"clamp",value:function clamp(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),e!==void 0&&(this.x=Math.min(this.x,e),this.y=Math.min(this.y,e)),this;}},{key:"div",value:function div(t){return this.x/=t,this.y/=t,this;}},{key:"divV",value:function divV(t){return this.x/=t.x,this.y/=t.y,this;}},{key:"mul",value:function mul(t){return this.x*=t,this.y*=t,this;}},{key:"mulV",value:function mulV(t){return this.x*=t.x,this.y*=t.y,this;}},{key:"abs",value:function abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this;}},{key:"nudge",value:function nudge(t,e){var n=xt.Tan(t,this);return this.add(n.mul(e));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(t){return this.x=this.y*t.z-this.z*t.y,this.y=this.z*t.x-this.x*t.z,this;}},{key:"dpr",value:function dpr(t){return xt.Dpr(this,t);}},{key:"cpr",value:function cpr(t){return xt.Cpr(this,t);}},{key:"len2",value:function len2(){return xt.Len2(this);}},{key:"len",value:function len(){return xt.Len(this);}},{key:"pry",value:function pry(t){return xt.Pry(this,t);}},{key:"per",value:function per(){var t=this.x,e=this.y;return this.x=e,this.y=-t,this;}},{key:"uni",value:function uni(){return xt.Uni(this);}},{key:"tan",value:function tan(t){return xt.Tan(this,t);}},{key:"dist",value:function dist(t){return xt.Dist(this,t);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(t,e){return xt.DistanceToLineSegment(t,e,this);}},{key:"slope",value:function slope(t){return xt.Slope(this,t);}},{key:"snapToGrid",value:function snapToGrid(t){return this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this;}},{key:"angle",value:function angle(t){return xt.Angle(this,t);}},{key:"toAngle",value:function toAngle(){return xt.ToAngle(this);}},{key:"lrp",value:function lrp(t,e){return this.x=this.x+(t.x-this.x)*e,this.y=this.y+(t.y-this.y)*e,this;}},{key:"equals",value:function equals(t,e){return xt.Equals(this,t,e);}},{key:"equalsXY",value:function equalsXY(t,e){return xt.EqualsXY(this,t,e);}},{key:"norm",value:function norm(){var t=this.len();return this.x=t===0?0:this.x/t,this.y=t===0?0:this.y/t,this;}},{key:"toFixed",value:function toFixed(){return xt.ToFixed(this);}},{key:"toString",value:function toString(){return xt.ToString(xt.ToFixed(this));}},{key:"toJson",value:function toJson(){return xt.ToJson(this);}},{key:"toArray",value:function toArray(){return xt.ToArray(this);}}],[{key:"Add",value:function Add(t,e){return new xt(t.x+e.x,t.y+e.y);}},{key:"AddXY",value:function AddXY(t,e,n){return new xt(t.x+e,t.y+n);}},{key:"Sub",value:function Sub(t,e){return new xt(t.x-e.x,t.y-e.y);}},{key:"SubXY",value:function SubXY(t,e,n){return new xt(t.x-e,t.y-n);}},{key:"AddScalar",value:function AddScalar(t,e){return new xt(t.x+e,t.y+e);}},{key:"SubScalar",value:function SubScalar(t,e){return new xt(t.x-e,t.y-e);}},{key:"Div",value:function Div(t,e){return new xt(t.x/e,t.y/e);}},{key:"Mul",value:function Mul(t,e){return new xt(t.x*e,t.y*e);}},{key:"DivV",value:function DivV(t,e){return new xt(t.x/e.x,t.y/e.y);}},{key:"MulV",value:function MulV(t,e){return new xt(t.x*e.x,t.y*e.y);}},{key:"Neg",value:function Neg(t){return new xt(-t.x,-t.y);}},{key:"Per",value:function Per(t){return new xt(t.y,-t.x);}},{key:"Dist2",value:function Dist2(t,e){return xt.Sub(t,e).len2();}},{key:"Abs",value:function Abs(t){return new xt(Math.abs(t.x),Math.abs(t.y));}},{key:"Dist",value:function Dist(t,e){return Math.hypot(t.y-e.y,t.x-e.x);}},{key:"Dpr",value:function Dpr(t,e){return t.x*e.x+t.y*e.y;}},{key:"Cross",value:function Cross(t,e){return new xt(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z// A.z = A.x * V.y - A.y * V.x
|
|
368
|
+
container:a,width:i.width,height:i.height,displayRatio:i.displayRatio,autoResize:!1,contextType:e}));var h;try{var C=_objectSpread(_objectSpread({},s),{},{width:i.width,height:i.height,contextType:e,autoRender:!1});r&&(C.canvas=r),h=u.layer("render-probe",C);}catch(C){throw n.scene=u,n.profile=i,C;}var v=h.canvas||r;v||(n.scene=u,n.layer=h,Nr(n.stage,"layer-canvas-unavailable"));var p=_objectSpread(_objectSpread({},i),{},{initialWidth:i.width,initialHeight:i.height}),y=umt(v,p);return n.scene=u,n.layer=h,n.canvas=v,n.layout=y,{scene:u,layer:h,layout:y,canvas:v};}function f2(r,t,e,n){var i=r.renderer.options.contextType;pmt(t,i)||Nr(e.stage,"context-type-mismatch",{actualContextType:i});var _n$testRect=n.testRect,s=_n$testRect.x,o=_n$testRect.y,a=_n$testRect.width,u=_n$testRect.height;return r.append(new Bo({pos:[s,o],size:[a,u],fillColor:"rgba(255, 0, 0, 1)"})),e.stage="render",r.render(),i;}function gmt(r,t,e,n){var i=r.renderer.options.contextType==="2d"?hmt(t,e,n):dmt(r,e,n);return i.passed||Nr(e.stage,"pixel-check-failed",_objectSpread(_objectSpread({},ts(n)),{},{pixelChecks:i.checks})),i;}function mmt(r,t,e,n){if(!t)return;n.stage="capture-image-bitmap",(!r||typeof r.transferToImageBitmap!="function")&&Nr(n.stage,"transfer-to-image-bitmap-unavailable",{pixelChecks:e});var i=r.transferToImageBitmap();return i||Nr(n.stage,"transfer-to-image-bitmap-empty",{pixelChecks:e}),i;}function Wy(r){if(r.imageBitmap)try{r.imageBitmap.close();}catch(_unused15){}}function vv(r,t,e,n){var i=r.layer;if(!i)return amt(t,e),_objectSpread(_objectSpread({},n),{},{destroyed:!0});try{var s=i.destroy()!==!1;return!s&&n.passed?(Wy(n),hu(e,"destroy","layer-already-destroyed",_objectSpread(_objectSpread({},ts(r.layout)),{},{destroyed:!1}))):_objectSpread(_objectSpread({},n),{},{destroyed:s});}catch(s){return n.passed?(Wy(n),hu(e,"destroy",s,_objectSpread(_objectSpread({},ts(r.layout)),{},{destroyed:!1}))):_objectSpread(_objectSpread({},n),{},{destroyed:!1});}}function h2(r,t,e,n){var i=_objectSpread(_objectSpread({},n),{},{destroyed:!1});return pp.set(i,{state:r,canvas:t,contextType:e}),i;}function ymt(r){if(!r||_typeof(r)!="object")return!1;var t=pp.get(r);if(!t)return r.destroyed===!0;pp.delete(r);var e=vv(t.state,t.canvas,t.contextType,r);return Object.assign(r,e),r.destroyed===!0;}function wmt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var e=t.contextType||"webgl2",n=t.captureImageBitmap===!0,i={stage:"layer-init"};var s;try{var _u3=u2(r,t,e,i),o=_u3.layer,a=_u3.layout,u=_u3.canvas,h=f2(o,e,i,a),v=gmt(o,u,i,a),p=mmt(u,n,v.checks,i);s=_objectSpread(_objectSpread({contextType:e,actualContextType:h,passed:!0},ts(a)),{},{pixelChecks:v.checks,imageBitmap:p});}catch(o){var _a5=o&&o.renderingProbe;s=hu(e,_a5?_a5.stage:i.stage,o,_objectSpread(_objectSpread({},ts(i.layout)),_a5?_a5.details:void 0));}return s.passed?h2(i,i.canvas||r,e,s):vv(i,i.canvas||r,e,s);}function Smt(_x5){return _Smt.apply(this,arguments);}function _Smt(){_Smt=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee118(r){var t,e,n,i,s,_u9,o,a,u,h,v,_a1,_args126=arguments;return _regenerator().w(function(_context126){while(1)switch(_context126.n){case 0:t=_args126.length>1&&_args126[1]!==undefined?_args126[1]:{};e=t.contextType||"webgl2",n={stage:"layer-init"};try{_u9=u2(r,t,e,n),o=_u9.layer,a=_u9.layout,u=_u9.canvas,h=f2(o,e,n,a),v=fmt(a);n.expectedPixelChecks=v,n.stage="capture-image-bitmap",s=o.transferToImageBitmap(),s||Nr(n.stage,"transfer-to-image-bitmap-empty",ts(a)),i=_objectSpread(_objectSpread({contextType:e,actualContextType:h,passed:!0},ts(a)),{},{imageBitmapRect:{x:0,y:0,width:a.canvasSize.width,height:a.canvasSize.height},expectedPixelChecks:v,imageBitmap:s});}catch(o){if(s){try{s.close();}catch(_unused47){}s=void 0;}_a1=o&&o.renderingProbe;i=hu(e,_a1?_a1.stage:n.stage,o,_objectSpread(_objectSpread({},ts(n.layout)),{},{expectedPixelChecks:n.expectedPixelChecks},_a1?_a1.details:void 0));}return _context126.a(2,i.passed&&i.imageBitmap?h2(n,n.canvas||r,e,i):vv(n,n.canvas||r,e,i));}},_callee118);}));return _Smt.apply(this,arguments);}Me(Array);var _e=/* @__PURE__ */function(r){return r.selector="selector",r.clicker="clicker",r.laserPointer="laserPointer",r.pencil="pencil",r.rectangle="rectangle",r.ellipse="ellipse",r.shape="shape",r.eraser="eraser",r.pencilEraser="pencilEraser",r.text="text",r.straight="straight",r.arrow="arrow",r.hand="hand",r.laserPen="laserPen",r;}(_e||{}),d2=/* @__PURE__ */function(r){return r[r.OffscreenTransfer=1]="OffscreenTransfer",r[r.ImageBitmap=2]="ImageBitmap",r[r.MainThread=3]="MainThread",r;}(d2||{}),p2=/* @__PURE__ */function(r){return r[r.RefreshTextRender=1]="RefreshTextRender",r;}(p2||{}),Ne=/* @__PURE__ */function(r){return r.Normal="Normal",r.Stroke="Stroke",r.Dotted="Dotted",r.LongDotted="LongDotted",r;}(Ne||{});var Qi={star:"star",polygon:"polygon",speechBalloon:"speechBalloon",bitMapEraser:"bitMapEraser"};var ve=/* @__PURE__ */function(r){return r.None="None",r.ShowFloatBar="ShowFloatBar",r.ZIndexFloatBar="ZIndexFloatBar",r.DeleteNode="DeleteNode",r.CopyNode="CopyNode",r.ZIndexNode="ZIndexNode",r.ZIndexBackgroundSVG="ZIndexBackgroundSVG",r.RotateNode="RotateNode",r.SetColorNode="SetColorNode",r.TranslateNode="TranslateNode",r.ScaleNode="ScaleNode",r.OriginalEvent="OriginalEvent",r.CreateScene="CreateScene",r.ActiveCursor="ActiveCursor",r.MoveCursor="MoveCursor",r.CommandEditor="CommandEditor",r.SetEditorData="SetEditorData",r.SetFontStyle="SetFontStyle",r.SetPoint="SetPoint",r.SetLock="SetLock",r.SetShapeOpt="SetShapeOpt",r.CameraChange="CameraChange",r.ActiveMethod="ActiveMethod",r.HidFloatBarBtn="HidFloatBarBtn",r.SelectMethod="SelectMethod",r;}(ve||{}),St=/* @__PURE__ */function(r){return r[r.Pencil=1]="Pencil",r[r.Eraser=2]="Eraser",r[r.PencilEraser=3]="PencilEraser",r[r.BitMapEraser=4]="BitMapEraser",r[r.Selector=5]="Selector",r[r.Clicker=6]="Clicker",r[r.Arrow=7]="Arrow",r[r.Hand=8]="Hand",r[r.LaserPen=9]="LaserPen",r[r.Text=10]="Text",r[r.Straight=11]="Straight",r[r.Rectangle=12]="Rectangle",r[r.Ellipse=13]="Ellipse",r[r.Star=14]="Star",r[r.Triangle=15]="Triangle",r[r.Rhombus=16]="Rhombus",r[r.Polygon=17]="Polygon",r[r.SpeechBalloon=18]="SpeechBalloon",r[r.Image=19]="Image",r[r.BackgroundSVG=20]="BackgroundSVG",r;}(St||{}),Qt=/* @__PURE__ */function(r){return r[r.Local=1]="Local",r[r.Service=2]="Service",r[r.Worker=3]="Worker",r;}(Qt||{}),te=/* @__PURE__ */function(r){return r[r.Pending=0]="Pending",r[r.Start=1]="Start",r[r.Doing=2]="Doing",r[r.Done=3]="Done",r[r.Unwritable=4]="Unwritable",r;}(te||{}),Tt=/* @__PURE__ */function(r){return r[r.None=0]="None",r[r.Init=1]="Init",r[r.UpdateCamera=2]="UpdateCamera",r[r.UpdateTools=3]="UpdateTools",r[r.CreateWork=4]="CreateWork",r[r.DrawWork=5]="DrawWork",r[r.FullWork=6]="FullWork",r[r.UpdateNode=7]="UpdateNode",r[r.RemoveNode=8]="RemoveNode",r[r.Clear=9]="Clear",r[r.Select=10]="Select",r[r.Destroy=11]="Destroy",r[r.Snapshot=12]="Snapshot",r[r.BoundingBox=13]="BoundingBox",r[r.Cursor=14]="Cursor",r[r.TextUpdate=15]="TextUpdate",r[r.GetTextActive=16]="GetTextActive",r[r.TasksQueue=17]="TasksQueue",r[r.CursorHover=18]="CursorHover",r[r.CursorBlur=19]="CursorBlur",r[r.Console=20]="Console",r[r.GetImageBitMap=23]="GetImageBitMap",r[r.AuthWriter=24]="AuthWriter",r[r.AuthReader=25]="AuthReader",r[r.AuthClear=26]="AuthClear",r[r.AuthPage=27]="AuthPage",r[r.GetVNodeInfo=28]="GetVNodeInfo",r[r.UpdateDpr=29]="UpdateDpr",r[r.SetFontFace=30]="SetFontFace",r[r.ReportError=31]="ReportError",r[r.ReportLog=32]="ReportLog",r[r.BackgroundSVGUpdate=33]="BackgroundSVGUpdate",r[r.BackgroundSVGDelete=34]="BackgroundSVGDelete",r[r.SelectorTransform=35]="SelectorTransform",r[r.CheckFontFace=36]="CheckFontFace",r[r.RefreshTextRender=37]="RefreshTextRender",r[r.ProbeRenderCapabilities=38]="ProbeRenderCapabilities",r[r.ServiceSyncCommit=39]="ServiceSyncCommit",r[r.CancelFontFace=40]="CancelFontFace",r[r.CancelBitmapEraser=41]="CancelBitmapEraser",r;}(Tt||{}),$t=/* @__PURE__ */function(r){return r[r.None=0]="None",r[r.Bg=1]="Bg",r[r.ServiceFloat=2]="ServiceFloat",r[r.Float=3]="Float",r[r.TopFloat=4]="TopFloat",r;}($t||{}),Ae=/* @__PURE__ */function(r){return r[r.none=1]="none",r[r.all=2]="all",r[r.both=3]="both",r[r.proportional=4]="proportional",r;}(Ae||{}),es=/* @__PURE__ */function(r){return r[r.inside=0]="inside",r[r.outside=1]="outside",r[r.intersect=2]="intersect",r;}(es||{}),lf=/* @__PURE__ */function(r){return r.Image="image",r.Iconify="iconify",r;}(lf||{});var ei=/*#__PURE__*/function(){function ei(){_classCallCheck(this,ei);ht(this,"localWork");ht(this,"serviceWork");ht(this,"threadEngine");}return _createClass(ei,[{key:"registerForWorker",value:function registerForWorker(t){return this.threadEngine=t,this.localWork=t.localWork,this.serviceWork=t.serviceWork,this;}}]);}();var Tmt=/*#__PURE__*/function(_ei){function Tmt(){var _this28;_classCallCheck(this,Tmt);_this28=_callSuper(this,Tmt,arguments);ht(_this28,"emitEventType",ve.CopyNode);return _this28;}_inherits(Tmt,_ei);return _createClass(Tmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.FullWork&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(e){var i,n,_t4;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:n=e.workId;_t4=n;if(!_t4){_context.n=1;break;}_context.n=1;return(i=this.localWork)==null?void 0:i.consumeFull(e);case 1:return _context.a(2);}},_callee,this);}));function consumeForLocalWorker(_x6){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Fo="++",De="selector",Uy="all";var Imt=/*#__PURE__*/function(_ei2){function Imt(){var _this29;_classCallCheck(this,Imt);_this29=_callSuper(this,Imt,arguments);ht(_this29,"emitEventType",ve.SetColorNode);return _this29;}_inherits(Imt,_ei2);return _createClass(Imt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e){var p,n,i,s,o,a,u,h,v,_t5;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.needUndoTicker,v=e.requestId;_t5=n===De&&i;if(!_t5){_context2.n=1;break;}_context2.n=1;return(p=this.localWork)==null?void 0:p.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:v,textUpdateForWoker:u,callback:this.updateSelectorCallback,needUndoTicker:h});case 1:return _context2.a(2);}},_callee2,this);}));function consumeForLocalWorker(_x7){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=n.willSyncService,a=n.isSync,u=n.textUpdateForWoker,h=n.needUndoTicker,v=n.requestId,p=n.emitEventType,y=i.render||[],C=i.sp||[];if(o){var _iterator2=_createForOfIteratorHelper(s.entries()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _step2$value=_slicedToArray(_step2.value,2),b=_step2$value[0],M=_step2$value[1];u&&M.toolsType===St.Text?C.push(_objectSpread(_objectSpread({},M),{},{workId:b,type:Tt.TextUpdate,dataType:Qt.Local,willSyncService:!0,emitEventType:p,requestId:v,needUndoTicker:h})):C.push(_objectSpread(_objectSpread({},M),{},{workId:b,type:Tt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:a,emitEventType:p,requestId:v,needUndoTicker:h}));}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return h&&C.push({type:Tt.None,needUndoTicker:h}),{render:y,sp:C};}}]);}(ei);var Cmt=/*#__PURE__*/function(_ei3){function Cmt(){var _this30;_classCallCheck(this,Cmt);_this30=_callSuper(this,Cmt,arguments);ht(_this30,"emitEventType",ve.ZIndexNode);return _this30;}_inherits(Cmt,_ei3);return _createClass(Cmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(e){var v,n,i,s,o,a,u,h,_t6;return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.needUndoTicker,h=e.requestId;_t6=n===De&&i;if(!_t6){_context3.n=1;break;}_context3.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,callback:this.updateSelectorCallback,needUndoTicker:u});case 1:return _context3.a(2);}},_callee3,this);}));function consumeForLocalWorker(_x8){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=n.willSyncService,a=n.isSync,u=n.needUndoTicker,h=n.requestId,v=n.emitEventType,p=i.render||[],y=i.sp||[];if(o&&y){var _iterator3=_createForOfIteratorHelper(s.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),C=_step3$value[0],b=_step3$value[1];b.toolsType===St.BackgroundSVG&&y.push(_objectSpread(_objectSpread({},b),{},{workId:C,type:Tt.BackgroundSVGUpdate,dataType:Qt.Local,updateNodeOpt:{useAnimation:!1},needUndoTicker:u,emitEventType:v,requestId:h})),y.push(_objectSpread(_objectSpread({},b),{},{workId:C,type:Tt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:a,emitEventType:v,requestId:h,needUndoTicker:u}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return u&&y.push({type:Tt.None,needUndoTicker:u}),{render:p,sp:y};}}]);}(ei);var v2={exports:{}};(function(r){(function(){var t={};t.version="6.4.2.2",t.use_lines=!0,t.use_xyz=!1;var e=!1;r.exports?(r.exports=t,e=!0):(typeof document==="undefined"?"undefined":_typeof(document))<"u"?window.ClipperLib=t:self.ClipperLib=t;var n;if(e){var i="chrome";n="Netscape";}else{var i=navigator.userAgent.toString().toLowerCase();n=navigator.appName;}var s={};i.indexOf("chrome")!=-1&&i.indexOf("chromium")==-1?s.chrome=1:s.chrome=0,i.indexOf("chromium")!=-1?s.chromium=1:s.chromium=0,i.indexOf("safari")!=-1&&i.indexOf("chrome")==-1&&i.indexOf("chromium")==-1?s.safari=1:s.safari=0,i.indexOf("firefox")!=-1?s.firefox=1:s.firefox=0,i.indexOf("firefox/17")!=-1?s.firefox17=1:s.firefox17=0,i.indexOf("firefox/15")!=-1?s.firefox15=1:s.firefox15=0,i.indexOf("firefox/3")!=-1?s.firefox3=1:s.firefox3=0,i.indexOf("opera")!=-1?s.opera=1:s.opera=0,i.indexOf("msie 10")!=-1?s.msie10=1:s.msie10=0,i.indexOf("msie 9")!=-1?s.msie9=1:s.msie9=0,i.indexOf("msie 8")!=-1?s.msie8=1:s.msie8=0,i.indexOf("msie 7")!=-1?s.msie7=1:s.msie7=0,i.indexOf("msie ")!=-1?s.msie=1:s.msie=0,t.biginteger_used=null;var o;function a(c,d,m){t.biginteger_used=1,c!=null&&(typeof c=="number"&&_typeof(d)>"u"?this.fromInt(c):typeof c=="number"?this.fromNumber(c,d,m):d==null&&typeof c!="string"?this.fromString(c,256):this.fromString(c,d));}function u(){return new a(null,void 0,void 0);}function h(c,d,m,E,F,rt){for(;--rt>=0;){var vt=d*this[c++]+m[E]+F;F=Math.floor(vt/67108864),m[E++]=vt&67108863;}return F;}function v(c,d,m,E,F,rt){for(var vt=d&32767,At=d>>15;--rt>=0;){var Mt=this[c]&32767,Wt=this[c++]>>15,Zt=At*Mt+Wt*vt;Mt=vt*Mt+((Zt&32767)<<15)+m[E]+(F&1073741823),F=(Mt>>>30)+(Zt>>>15)+At*Wt+(F>>>30),m[E++]=Mt&1073741823;}return F;}function p(c,d,m,E,F,rt){for(var vt=d&16383,At=d>>14;--rt>=0;){var Mt=this[c]&16383,Wt=this[c++]>>14,Zt=At*Mt+Wt*vt;Mt=vt*Mt+((Zt&16383)<<14)+m[E]+F,F=(Mt>>28)+(Zt>>14)+At*Wt,m[E++]=Mt&268435455;}return F;}n=="Microsoft Internet Explorer"?(a.prototype.am=v,o=30):n!="Netscape"?(a.prototype.am=h,o=26):(a.prototype.am=p,o=28),a.prototype.DB=o,a.prototype.DM=(1<<o)-1,a.prototype.DV=1<<o;var y=52;a.prototype.FV=Math.pow(2,y),a.prototype.F1=y-o,a.prototype.F2=2*o-y;var C="0123456789abcdefghijklmnopqrstuvwxyz",b=new Array(),M,L;for(M=48,L=0;L<=9;++L)b[M++]=L;for(M=97,L=10;L<36;++L)b[M++]=L;for(M=65,L=10;L<36;++L)b[M++]=L;function X(c){return C.charAt(c);}function Y(c,d){var m=b[c.charCodeAt(d)];return m!==null&&m!==void 0?m:-1;}function et(c){for(var d=this.t-1;d>=0;--d)c[d]=this[d];c.t=this.t,c.s=this.s;}function A(c){this.t=1,this.s=c<0?-1:0,c>0?this[0]=c:c<-1?this[0]=c+this.DV:this.t=0;}function w(c){var d=u();return d.fromInt(c),d;}function S(c,d){var m;if(d==16)m=4;else if(d==8)m=3;else if(d==256)m=8;else if(d==2)m=1;else if(d==32)m=5;else if(d==4)m=2;else{this.fromRadix(c,d);return;}this.t=0,this.s=0;for(var E=c.length,F=!1,rt=0;--E>=0;){var vt=m==8?c[E]&255:Y(c,E);if(vt<0){c.charAt(E)=="-"&&(F=!0);continue;}F=!1,rt==0?this[this.t++]=vt:rt+m>this.DB?(this[this.t-1]|=(vt&(1<<this.DB-rt)-1)<<rt,this[this.t++]=vt>>this.DB-rt):this[this.t-1]|=vt<<rt,rt+=m,rt>=this.DB&&(rt-=this.DB);}m==8&&c[0]&128&&(this.s=-1,rt>0&&(this[this.t-1]|=(1<<this.DB-rt)-1<<rt)),this.clamp(),F&&a.ZERO.subTo(this,this);}function x(){for(var c=this.s&this.DM;this.t>0&&this[this.t-1]==c;)--this.t;}function P(c){if(this.s<0)return"-"+this.negate().toString(c);var d;if(c==16)d=4;else if(c==8)d=3;else if(c==2)d=1;else if(c==32)d=5;else if(c==4)d=2;else return this.toRadix(c);var m=(1<<d)-1,E,F=!1,rt="",vt=this.t,At=this.DB-vt*this.DB%d;if(vt-->0)for(At<this.DB&&(E=this[vt]>>At)>0&&(F=!0,rt=X(E));vt>=0;)At<d?(E=(this[vt]&(1<<At)-1)<<d-At,E|=this[--vt]>>(At+=this.DB-d)):(E=this[vt]>>(At-=d)&m,At<=0&&(At+=this.DB,--vt)),E>0&&(F=!0),F&&(rt+=X(E));return F?rt:"0";}function z(){var c=u();return a.ZERO.subTo(this,c),c;}function U(){return this.s<0?this.negate():this;}function K(c){var d=this.s-c.s;if(d!=0)return d;var m=this.t;if(d=m-c.t,d!=0)return this.s<0?-d:d;for(;--m>=0;)if((d=this[m]-c[m])!=0)return d;return 0;}function j(c){var d=1,m;return(m=c>>>16)!=0&&(c=m,d+=16),(m=c>>8)!=0&&(c=m,d+=8),(m=c>>4)!=0&&(c=m,d+=4),(m=c>>2)!=0&&(c=m,d+=2),(m=c>>1)!=0&&(c=m,d+=1),d;}function nt(){return this.t<=0?0:this.DB*(this.t-1)+j(this[this.t-1]^this.s&this.DM);}function ct(c,d){var m;for(m=this.t-1;m>=0;--m)d[m+c]=this[m];for(m=c-1;m>=0;--m)d[m]=0;d.t=this.t+c,d.s=this.s;}function B(c,d){for(var m=c;m<this.t;++m)d[m-c]=this[m];d.t=Math.max(this.t-c,0),d.s=this.s;}function N(c,d){var m=c%this.DB,E=this.DB-m,F=(1<<E)-1,rt=Math.floor(c/this.DB),vt=this.s<<m&this.DM,At;for(At=this.t-1;At>=0;--At)d[At+rt+1]=this[At]>>E|vt,vt=(this[At]&F)<<m;for(At=rt-1;At>=0;--At)d[At]=0;d[rt]=vt,d.t=this.t+rt+1,d.s=this.s,d.clamp();}function G(c,d){d.s=this.s;var m=Math.floor(c/this.DB);if(m>=this.t){d.t=0;return;}var E=c%this.DB,F=this.DB-E,rt=(1<<E)-1;d[0]=this[m]>>E;for(var vt=m+1;vt<this.t;++vt)d[vt-m-1]|=(this[vt]&rt)<<F,d[vt-m]=this[vt]>>E;E>0&&(d[this.t-m-1]|=(this.s&rt)<<F),d.t=this.t-m,d.clamp();}function q(c,d){for(var m=0,E=0,F=Math.min(c.t,this.t);m<F;)E+=this[m]-c[m],d[m++]=E&this.DM,E>>=this.DB;if(c.t<this.t){for(E-=c.s;m<this.t;)E+=this[m],d[m++]=E&this.DM,E>>=this.DB;E+=this.s;}else{for(E+=this.s;m<c.t;)E-=c[m],d[m++]=E&this.DM,E>>=this.DB;E-=c.s;}d.s=E<0?-1:0,E<-1?d[m++]=this.DV+E:E>0&&(d[m++]=E),d.t=m,d.clamp();}function at(c,d){var m=this.abs(),E=c.abs(),F=m.t;for(d.t=F+E.t;--F>=0;)d[F]=0;for(F=0;F<E.t;++F)d[F+m.t]=m.am(0,E[F],d,F,0,m.t);d.s=0,d.clamp(),this.s!=c.s&&a.ZERO.subTo(d,d);}function ut(c){for(var d=this.abs(),m=c.t=2*d.t;--m>=0;)c[m]=0;for(m=0;m<d.t-1;++m){var E=d.am(m,d[m],c,2*m,0,1);(c[m+d.t]+=d.am(m+1,2*d[m],c,2*m+1,E,d.t-m-1))>=d.DV&&(c[m+d.t]-=d.DV,c[m+d.t+1]=1);}c.t>0&&(c[c.t-1]+=d.am(m,d[m],c,2*m,0,1)),c.s=0,c.clamp();}function Ct(c,d,m){var E=c.abs();if(!(E.t<=0)){var F=this.abs();if(F.t<E.t){d!=null&&d.fromInt(0),m!=null&&this.copyTo(m);return;}m==null&&(m=u());var rt=u(),vt=this.s,At=c.s,Mt=this.DB-j(E[E.t-1]);Mt>0?(E.lShiftTo(Mt,rt),F.lShiftTo(Mt,m)):(E.copyTo(rt),F.copyTo(m));var Wt=rt.t,Zt=rt[Wt-1];if(Zt!=0){var Xt=Zt*(1<<this.F1)+(Wt>1?rt[Wt-2]>>this.F2:0),ne=this.FV/Xt,ue=(1<<this.F1)/Xt,Se=1<<this.F2,Ie=m.t,We=Ie-Wt,Mr=d!==null&&d!==void 0?d:u();for(rt.dlShiftTo(We,Mr),m.compareTo(Mr)>=0&&(m[m.t++]=1,m.subTo(Mr,m)),a.ONE.dlShiftTo(Wt,Mr),Mr.subTo(rt,rt);rt.t<Wt;)rt[rt.t++]=0;for(;--We>=0;){var gn=m[--Ie]==Zt?this.DM:Math.floor(m[Ie]*ne+(m[Ie-1]+Se)*ue);if((m[Ie]+=rt.am(0,gn,m,We,0,Wt))<gn)for(rt.dlShiftTo(We,Mr),m.subTo(Mr,m);m[Ie]<--gn;)m.subTo(Mr,m);}d!=null&&(m.drShiftTo(Wt,d),vt!=At&&a.ZERO.subTo(d,d)),m.t=Wt,m.clamp(),Mt>0&&m.rShiftTo(Mt,m),vt<0&&a.ZERO.subTo(m,m);}}}function R(c){var d=u();return this.abs().divRemTo(c,null,d),this.s<0&&d.compareTo(a.ZERO)>0&&c.subTo(d,d),d;}function $(c){this.m=c;}function _(c){return c.s<0||c.compareTo(this.m)>=0?c.mod(this.m):c;}function H(c){return c;}function lt(c){c.divRemTo(this.m,null,c);}function dt(c,d,m){c.multiplyTo(d,m),this.reduce(m);}function wt(c,d){c.squareTo(d),this.reduce(d);}$.prototype.convert=_,$.prototype.revert=H,$.prototype.reduce=lt,$.prototype.mulTo=dt,$.prototype.sqrTo=wt;function Et(){if(this.t<1)return 0;var c=this[0];if(!(c&1))return 0;var d=c&3;return d=d*(2-(c&15)*d)&15,d=d*(2-(c&255)*d)&255,d=d*(2-((c&65535)*d&65535))&65535,d=d*(2-c*d%this.DV)%this.DV,d>0?this.DV-d:-d;}function Ot(c){this.m=c,this.mp=c.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<c.DB-15)-1,this.mt2=2*c.t;}function O(c){var d=u();return c.abs().dlShiftTo(this.m.t,d),d.divRemTo(this.m,null,d),c.s<0&&d.compareTo(a.ZERO)>0&&this.m.subTo(d,d),d;}function D(c){var d=u();return c.copyTo(d),this.reduce(d),d;}function J(c){for(;c.t<=this.mt2;)c[c.t++]=0;for(var d=0;d<this.m.t;++d){var m=c[d]&32767,E=m*this.mpl+((m*this.mph+(c[d]>>15)*this.mpl&this.um)<<15)&c.DM;for(m=d+this.m.t,c[m]+=this.m.am(0,E,c,d,0,this.m.t);c[m]>=c.DV;)c[m]-=c.DV,c[++m]++;}c.clamp(),c.drShiftTo(this.m.t,c),c.compareTo(this.m)>=0&&c.subTo(this.m,c);}function Q(c,d){c.squareTo(d),this.reduce(d);}function V(c,d,m){c.multiplyTo(d,m),this.reduce(m);}Ot.prototype.convert=O,Ot.prototype.revert=D,Ot.prototype.reduce=J,Ot.prototype.mulTo=V,Ot.prototype.sqrTo=Q;function tt(){return(this.t>0?this[0]&1:this.s)==0;}function g(c,d){if(c>4294967295||c<1)return a.ONE;var m=u(),E=u(),F=d.convert(this),rt=j(c)-1;for(F.copyTo(m);--rt>=0;)if(d.sqrTo(m,E),(c&1<<rt)>0)d.mulTo(E,F,m);else{var vt=m;m=E,E=vt;}return d.revert(m);}function T(c,d){var m;return c<256||d.isEven()?m=new $(d):m=new Ot(d),this.exp(c,m);}a.prototype.copyTo=et,a.prototype.fromInt=A,a.prototype.fromString=S,a.prototype.clamp=x,a.prototype.dlShiftTo=ct,a.prototype.drShiftTo=B,a.prototype.lShiftTo=N,a.prototype.rShiftTo=G,a.prototype.subTo=q,a.prototype.multiplyTo=at,a.prototype.squareTo=ut,a.prototype.divRemTo=Ct,a.prototype.invDigit=Et,a.prototype.isEven=tt,a.prototype.exp=g,a.prototype.toString=P,a.prototype.negate=z,a.prototype.abs=U,a.prototype.compareTo=K,a.prototype.bitLength=nt,a.prototype.mod=R,a.prototype.modPowInt=T,a.ZERO=w(0),a.ONE=w(1);function k(){var c=u();return this.copyTo(c),c;}function Z(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1;}else{if(this.t==1)return this[0];if(this.t==0)return 0;}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0];}function st(){return this.t==0?this.s:this[0]<<24>>24;}function ft(){return this.t==0?this.s:this[0]<<16>>16;}function pt(c){return Math.floor(Math.LN2*this.DB/Math.log(c));}function ot(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1;}function mt(c){if(c==null&&(c=10),this.signum()==0||c<2||c>36)return"0";var d=this.chunkSize(c),m=Math.pow(c,d),E=w(m),F=u(),rt=u(),vt="";for(this.divRemTo(E,F,rt);F.signum()>0;)vt=(m+rt.intValue()).toString(c).substr(1)+vt,F.divRemTo(E,F,rt);return rt.intValue().toString(c)+vt;}function It(c,d){this.fromInt(0),d==null&&(d=10);for(var m=this.chunkSize(d),E=Math.pow(d,m),F=!1,rt=0,vt=0,At=0;At<c.length;++At){var Mt=Y(c,At);if(Mt<0){c.charAt(At)=="-"&&this.signum()==0&&(F=!0);continue;}vt=d*vt+Mt,++rt>=m&&(this.dMultiply(E),this.dAddOffset(vt,0),rt=0,vt=0);}rt>0&&(this.dMultiply(Math.pow(d,rt)),this.dAddOffset(vt,0)),F&&a.ZERO.subTo(this,this);}function Pt(c,d,m){if(typeof d=="number"){if(c<2)this.fromInt(1);else for(this.fromNumber(c,m),this.testBit(c-1)||this.bitwiseTo(a.ONE.shiftLeft(c-1),ee,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(d);)this.dAddOffset(2,0),this.bitLength()>c&&this.subTo(a.ONE.shiftLeft(c-1),this);}else{var E=new Array(),F=c&7;E.length=(c>>3)+1,d.nextBytes(E),F>0?E[0]&=(1<<F)-1:E[0]=0,this.fromString(E,256);}}function Lt(){var c=this.t,d=new Array();d[0]=this.s;var m=this.DB-c*this.DB%8,E,F=0;if(c-->0)for(m<this.DB&&(E=this[c]>>m)!=(this.s&this.DM)>>m&&(d[F++]=E|this.s<<this.DB-m);c>=0;)m<8?(E=(this[c]&(1<<m)-1)<<8-m,E|=this[--c]>>(m+=this.DB-8)):(E=this[c]>>(m-=8)&255,m<=0&&(m+=this.DB,--c)),E&128&&(E|=-256),F==0&&(this.s&128)!=(E&128)&&++F,(F>0||E!=this.s)&&(d[F++]=E);return d;}function Dt(c){return this.compareTo(c)==0;}function Nt(c){return this.compareTo(c)<0?this:c;}function Yt(c){return this.compareTo(c)>0?this:c;}function Ut(c,d,m){var E,F,rt=Math.min(c.t,this.t);for(E=0;E<rt;++E)m[E]=d(this[E],c[E]);if(c.t<this.t){for(F=c.s&this.DM,E=rt;E<this.t;++E)m[E]=d(this[E],F);m.t=this.t;}else{for(F=this.s&this.DM,E=rt;E<c.t;++E)m[E]=d(F,c[E]);m.t=c.t;}m.s=d(this.s,c.s),m.clamp();}function Ft(c,d){return c&d;}function Jt(c){var d=u();return this.bitwiseTo(c,Ft,d),d;}function ee(c,d){return c|d;}function re(c){var d=u();return this.bitwiseTo(c,ee,d),d;}function se(c,d){return c^d;}function oe(c){var d=u();return this.bitwiseTo(c,se,d),d;}function le(c,d){return c&~d;}function Re(c){var d=u();return this.bitwiseTo(c,le,d),d;}function Oe(){for(var c=u(),d=0;d<this.t;++d)c[d]=this.DM&~this[d];return c.t=this.t,c.s=~this.s,c;}function ke(c){var d=u();return c<0?this.rShiftTo(-c,d):this.lShiftTo(c,d),d;}function Be(c){var d=u();return c<0?this.lShiftTo(-c,d):this.rShiftTo(c,d),d;}function Ge(c){if(c==0)return-1;var d=0;return c&65535||(c>>=16,d+=16),c&255||(c>>=8,d+=8),c&15||(c>>=4,d+=4),c&3||(c>>=2,d+=2),c&1||++d,d;}function He(){for(var c=0;c<this.t;++c)if(this[c]!=0)return c*this.DB+Ge(this[c]);return this.s<0?this.t*this.DB:-1;}function je(c){for(var d=0;c!=0;)c&=c-1,++d;return d;}function ye(){for(var c=0,d=this.s&this.DM,m=0;m<this.t;++m)c+=je(this[m]^d);return c;}function lr(c){var d=Math.floor(c/this.DB);return d>=this.t?this.s!=0:(this[d]&1<<c%this.DB)!=0;}function en(c,d){var m=a.ONE.shiftLeft(c);return this.bitwiseTo(m,d,m),m;}function rn(c){return this.changeBit(c,ee);}function Gn(c){return this.changeBit(c,le);}function jn(c){return this.changeBit(c,se);}function Qo(c,d){for(var m=0,E=0,F=Math.min(c.t,this.t);m<F;)E+=this[m]+c[m],d[m++]=E&this.DM,E>>=this.DB;if(c.t<this.t){for(E+=c.s;m<this.t;)E+=this[m],d[m++]=E&this.DM,E>>=this.DB;E+=this.s;}else{for(E+=this.s;m<c.t;)E+=c[m],d[m++]=E&this.DM,E>>=this.DB;E+=c.s;}d.s=E<0?-1:0,E>0?d[m++]=E:E<-1&&(d[m++]=this.DV+E),d.t=m,d.clamp();}function Li(c){var d=u();return this.addTo(c,d),d;}function Jo(c){var d=u();return this.subTo(c,d),d;}function _o(c){var d=u();return this.multiplyTo(c,d),d;}function Ks(){var c=u();return this.squareTo(c),c;}function Qs(c){var d=u();return this.divRemTo(c,d,null),d;}function Js(c){var d=u();return this.divRemTo(c,null,d),d;}function cs(c){var d=u(),m=u();return this.divRemTo(c,d,m),new Array(d,m);}function ta(c){this[this.t]=this.am(0,c-1,this,0,0,this.t),++this.t,this.clamp();}function ea(c,d){if(c!=0){for(;this.t<=d;)this[this.t++]=0;for(this[d]+=c;this[d]>=this.DV;)this[d]-=this.DV,++d>=this.t&&(this[this.t++]=0),++this[d];}}function An(){}function us(c){return c;}function _s(c,d,m){c.multiplyTo(d,m);}function Sf(c,d){c.squareTo(d);}An.prototype.convert=us,An.prototype.revert=us,An.prototype.mulTo=_s,An.prototype.sqrTo=Sf;function Tf(c){return this.exp(c,new An());}function If(c,d,m){var E=Math.min(this.t+c.t,d);for(m.s=0,m.t=E;E>0;)m[--E]=0;var F;for(F=m.t-this.t;E<F;++E)m[E+this.t]=this.am(0,c[E],m,E,0,this.t);for(F=Math.min(c.t,d);E<F;++E)this.am(0,c[E],m,E,0,d-E);m.clamp();}function Cf(c,d,m){--d;var E=m.t=this.t+c.t-d;for(m.s=0;--E>=0;)m[E]=0;for(E=Math.max(d-this.t,0);E<c.t;++E)m[this.t+E-d]=this.am(d-E,c[E],m,0,0,this.t+E-d);m.clamp(),m.drShiftTo(1,m);}function En(c){this.r2=u(),this.q3=u(),a.ONE.dlShiftTo(2*c.t,this.r2),this.mu=this.r2.divide(c),this.m=c;}function xf(c){if(c.s<0||c.t>2*this.m.t)return c.mod(this.m);if(c.compareTo(this.m)<0)return c;var d=u();return c.copyTo(d),this.reduce(d),d;}function to(c){return c;}function Pf(c){for(c.drShiftTo(this.m.t-1,this.r2),c.t>this.m.t+1&&(c.t=this.m.t+1,c.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);c.compareTo(this.r2)<0;)c.dAddOffset(1,this.m.t+1);for(c.subTo(this.r2,c);c.compareTo(this.m)>=0;)c.subTo(this.m,c);}function bf(c,d){c.squareTo(d),this.reduce(d);}function Af(c,d,m){c.multiplyTo(d,m),this.reduce(m);}En.prototype.convert=xf,En.prototype.revert=to,En.prototype.reduce=Pf,En.prototype.mulTo=Af,En.prototype.sqrTo=bf;function yl(c,d){var m=c.bitLength(),E,F=w(1),rt;if(m<=0)return F;m<18?E=1:m<48?E=3:m<144?E=4:m<768?E=5:E=6,m<8?rt=new $(d):d.isEven()?rt=new En(d):rt=new Ot(d);var vt=new Array(),At=3,Mt=E-1,Wt=(1<<E)-1;if(vt[1]=rt.convert(this),E>1){var Zt=u();for(rt.sqrTo(vt[1],Zt);At<=Wt;)vt[At]=u(),rt.mulTo(Zt,vt[At-2],vt[At]),At+=2;}var Xt=c.t-1,ne,ue=!0,Se=u(),Ie;for(m=j(c[Xt])-1;Xt>=0;){for(m>=Mt?ne=c[Xt]>>m-Mt&Wt:(ne=(c[Xt]&(1<<m+1)-1)<<Mt-m,Xt>0&&(ne|=c[Xt-1]>>this.DB+m-Mt)),At=E;!(ne&1);)ne>>=1,--At;if((m-=At)<0&&(m+=this.DB,--Xt),ue)vt[ne].copyTo(F),ue=!1;else{for(;At>1;)rt.sqrTo(F,Se),rt.sqrTo(Se,F),At-=2;At>0?rt.sqrTo(F,Se):(Ie=F,F=Se,Se=Ie),rt.mulTo(Se,vt[ne],F);}for(;Xt>=0&&!(c[Xt]&1<<m);)rt.sqrTo(F,Se),Ie=F,F=Se,Se=Ie,--m<0&&(m=this.DB-1,--Xt);}return rt.revert(F);}function wl(c){var d=this.s<0?this.negate():this.clone(),m=c.s<0?c.negate():c.clone();if(d.compareTo(m)<0){var E=d;d=m,m=E;}var F=d.getLowestSetBit(),rt=m.getLowestSetBit();if(rt<0)return d;for(F<rt&&(rt=F),rt>0&&(d.rShiftTo(rt,d),m.rShiftTo(rt,m));d.signum()>0;)(F=d.getLowestSetBit())>0&&d.rShiftTo(F,d),(F=m.getLowestSetBit())>0&&m.rShiftTo(F,m),d.compareTo(m)>=0?(d.subTo(m,d),d.rShiftTo(1,d)):(m.subTo(d,m),m.rShiftTo(1,m));return rt>0&&m.lShiftTo(rt,m),m;}function Sl(c){if(c<=0)return 0;var d=this.DV%c,m=this.s<0?c-1:0;if(this.t>0)if(d==0)m=this[0]%c;else for(var E=this.t-1;E>=0;--E)m=(d*m+this[E])%c;return m;}function Ef(c){var d=c.isEven();if(this.isEven()&&d||c.signum()==0)return a.ZERO;for(var m=c.clone(),E=this.clone(),F=w(1),rt=w(0),vt=w(0),At=w(1);m.signum()!=0;){for(;m.isEven();)m.rShiftTo(1,m),d?((!F.isEven()||!rt.isEven())&&(F.addTo(this,F),rt.subTo(c,rt)),F.rShiftTo(1,F)):rt.isEven()||rt.subTo(c,rt),rt.rShiftTo(1,rt);for(;E.isEven();)E.rShiftTo(1,E),d?((!vt.isEven()||!At.isEven())&&(vt.addTo(this,vt),At.subTo(c,At)),vt.rShiftTo(1,vt)):At.isEven()||At.subTo(c,At),At.rShiftTo(1,At);m.compareTo(E)>=0?(m.subTo(E,m),d&&F.subTo(vt,F),rt.subTo(At,rt)):(E.subTo(m,E),d&&vt.subTo(F,vt),At.subTo(rt,At));}if(E.compareTo(a.ONE)!=0)return a.ZERO;if(At.compareTo(c)>=0)return At.subtract(c);if(At.signum()<0)At.addTo(c,At);else return At;return At.signum()<0?At.add(c):At;}var Tr=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Mf=(1<<26)/Tr[Tr.length-1];function Lf(c){var d,m=this.abs();if(m.t==1&&m[0]<=Tr[Tr.length-1]){for(d=0;d<Tr.length;++d)if(m[0]==Tr[d])return!0;return!1;}if(m.isEven())return!1;for(d=1;d<Tr.length;){for(var E=Tr[d],F=d+1;F<Tr.length&&E<Mf;)E*=Tr[F++];for(E=m.modInt(E);d<F;)if(E%Tr[d++]==0)return!1;}return m.millerRabin(c);}function Tl(c){var d=this.subtract(a.ONE),m=d.getLowestSetBit();if(m<=0)return!1;var E=d.shiftRight(m);c=c+1>>1,c>Tr.length&&(c=Tr.length);for(var F=u(),rt=0;rt<c;++rt){F.fromInt(Tr[Math.floor(Math.random()*Tr.length)]);var vt=F.modPow(E,this);if(vt.compareTo(a.ONE)!=0&&vt.compareTo(d)!=0){for(var At=1;At++<m&&vt.compareTo(d)!=0;)if(vt=vt.modPowInt(2,this),vt.compareTo(a.ONE)==0)return!1;if(vt.compareTo(d)!=0)return!1;}}return!0;}a.prototype.chunkSize=pt,a.prototype.toRadix=mt,a.prototype.fromRadix=It,a.prototype.fromNumber=Pt,a.prototype.bitwiseTo=Ut,a.prototype.changeBit=en,a.prototype.addTo=Qo,a.prototype.dMultiply=ta,a.prototype.dAddOffset=ea,a.prototype.multiplyLowerTo=If,a.prototype.multiplyUpperTo=Cf,a.prototype.modInt=Sl,a.prototype.millerRabin=Tl,a.prototype.clone=k,a.prototype.intValue=Z,a.prototype.byteValue=st,a.prototype.shortValue=ft,a.prototype.signum=ot,a.prototype.toByteArray=Lt,a.prototype.equals=Dt,a.prototype.min=Nt,a.prototype.max=Yt,a.prototype.and=Jt,a.prototype.or=re,a.prototype.xor=oe,a.prototype.andNot=Re,a.prototype.not=Oe,a.prototype.shiftLeft=ke,a.prototype.shiftRight=Be,a.prototype.getLowestSetBit=He,a.prototype.bitCount=ye,a.prototype.testBit=lr,a.prototype.setBit=rn,a.prototype.clearBit=Gn,a.prototype.flipBit=jn,a.prototype.add=Li,a.prototype.subtract=Jo,a.prototype.multiply=_o,a.prototype.divide=Qs,a.prototype.remainder=Js,a.prototype.divideAndRemainder=cs,a.prototype.modPow=yl,a.prototype.modInverse=Ef,a.prototype.pow=Tf,a.prototype.gcd=wl,a.prototype.isProbablePrime=Lf,a.prototype.square=Ks;var we=a;we.prototype.IsNegative=function(){return this.compareTo(we.ZERO)==-1;},we.op_Equality=function(c,d){return c.compareTo(d)==0;},we.op_Inequality=function(c,d){return c.compareTo(d)!=0;},we.op_GreaterThan=function(c,d){return c.compareTo(d)>0;},we.op_LessThan=function(c,d){return c.compareTo(d)<0;},we.op_Addition=function(c,d){return new we(c,void 0,void 0).add(new we(d,void 0,void 0));},we.op_Subtraction=function(c,d){return new we(c,void 0,void 0).subtract(new we(d,void 0,void 0));},we.Int128Mul=function(c,d){return new we(c,void 0,void 0).multiply(new we(d,void 0,void 0));},we.op_Division=function(c,d){return c.divide(d);},we.prototype.ToDouble=function(){return parseFloat(this.toString());};var ra=function ra(c,d){var m;if(_typeof(Object.getOwnPropertyNames)>"u"){for(m in d.prototype)(_typeof(c.prototype[m])>"u"||c.prototype[m]===Object.prototype[m])&&(c.prototype[m]=d.prototype[m]);for(m in d)_typeof(c[m])>"u"&&(c[m]=d[m]);c.$baseCtor=d;}else{for(var E=Object.getOwnPropertyNames(d.prototype),F=0;F<E.length;F++)_typeof(Object.getOwnPropertyDescriptor(c.prototype,E[F]))>"u"&&Object.defineProperty(c.prototype,E[F],Object.getOwnPropertyDescriptor(d.prototype,E[F]));for(m in d)_typeof(c[m])>"u"&&(c[m]=d[m]);c.$baseCtor=d;}};t.Path=function(){return[];},t.Path.prototype.push=Array.prototype.push,t.Paths=function(){return[];},t.Paths.prototype.push=Array.prototype.push,t.DoublePoint=function(){var c=arguments;this.X=0,this.Y=0,c.length===1?(this.X=c[0].X,this.Y=c[0].Y):c.length===2&&(this.X=c[0],this.Y=c[1]);},t.DoublePoint0=function(){this.X=0,this.Y=0;},t.DoublePoint0.prototype=t.DoublePoint.prototype,t.DoublePoint1=function(c){this.X=c.X,this.Y=c.Y;},t.DoublePoint1.prototype=t.DoublePoint.prototype,t.DoublePoint2=function(c,d){this.X=c,this.Y=d;},t.DoublePoint2.prototype=t.DoublePoint.prototype,t.PolyNode=function(){this.m_Parent=null,this.m_polygon=new t.Path(),this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1;},t.PolyNode.prototype.IsHoleNode=function(){for(var c=!0,d=this.m_Parent;d!==null;)c=!c,d=d.m_Parent;return c;},t.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length;},t.PolyNode.prototype.Contour=function(){return this.m_polygon;},t.PolyNode.prototype.AddChild=function(c){var d=this.m_Childs.length;this.m_Childs.push(c),c.m_Parent=this,c.m_Index=d;},t.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp();},t.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1];},t.PolyNode.prototype.Childs=function(){return this.m_Childs;},t.PolyNode.prototype.Parent=function(){return this.m_Parent;},t.PolyNode.prototype.IsHole=function(){return this.IsHoleNode();},t.PolyTree=function(){this.m_AllPolys=[],t.PolyNode.call(this);},t.PolyTree.prototype.Clear=function(){for(var c=0,d=this.m_AllPolys.length;c<d;c++)this.m_AllPolys[c]=null;this.m_AllPolys.length=0,this.m_Childs.length=0;},t.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null;},t.PolyTree.prototype.Total=function(){var c=this.m_AllPolys.length;return c>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&c--,c;},ra(t.PolyTree,t.PolyNode),t.Math_Abs_Int64=t.Math_Abs_Int32=t.Math_Abs_Double=function(c){return Math.abs(c);},t.Math_Max_Int32_Int32=function(c,d){return Math.max(c,d);},s.msie||s.opera||s.safari?t.Cast_Int32=function(c){return c|0;}:t.Cast_Int32=function(c){return~~c;},_typeof(Number.toInteger)>"u"&&(Number.toInteger=null),s.chrome?t.Cast_Int64=function(c){return c<-2147483648||c>2147483647?c<0?Math.ceil(c):Math.floor(c):~~c;}:s.firefox&&typeof Number.toInteger=="function"?t.Cast_Int64=function(c){return Number.toInteger(c);}:s.msie7||s.msie8?t.Cast_Int64=function(c){return parseInt(c,10);}:s.msie?t.Cast_Int64=function(c){return c<-2147483648||c>2147483647?c<0?Math.ceil(c):Math.floor(c):c|0;}:t.Cast_Int64=function(c){return c<0?Math.ceil(c):Math.floor(c);},t.Clear=function(c){c.length=0;},t.PI=3.141592653589793,t.PI2=2*3.141592653589793,t.IntPoint=function(){var c=arguments,d=c.length;if(this.X=0,this.Y=0,t.use_xyz){if(this.Z=0,d===3)this.X=c[0],this.Y=c[1],this.Z=c[2];else if(d===2)this.X=c[0],this.Y=c[1],this.Z=0;else if(d===1){if(c[0]instanceof t.DoublePoint){var m=c[0];this.X=t.Clipper.Round(m.X),this.Y=t.Clipper.Round(m.Y),this.Z=0;}else{var E=c[0];_typeof(E.Z)>"u"&&(E.Z=0),this.X=E.X,this.Y=E.Y,this.Z=E.Z;}}else this.X=0,this.Y=0,this.Z=0;}else if(d===2)this.X=c[0],this.Y=c[1];else if(d===1){if(c[0]instanceof t.DoublePoint){var m=c[0];this.X=t.Clipper.Round(m.X),this.Y=t.Clipper.Round(m.Y);}else{var E=c[0];this.X=E.X,this.Y=E.Y;}}else this.X=0,this.Y=0;},t.IntPoint.op_Equality=function(c,d){return c.X===d.X&&c.Y===d.Y;},t.IntPoint.op_Inequality=function(c,d){return c.X!==d.X||c.Y!==d.Y;},t.IntPoint0=function(){this.X=0,this.Y=0,t.use_xyz&&(this.Z=0);},t.IntPoint0.prototype=t.IntPoint.prototype,t.IntPoint1=function(c){this.X=c.X,this.Y=c.Y,t.use_xyz&&(_typeof(c.Z)>"u"?this.Z=0:this.Z=c.Z);},t.IntPoint1.prototype=t.IntPoint.prototype,t.IntPoint1dp=function(c){this.X=t.Clipper.Round(c.X),this.Y=t.Clipper.Round(c.Y),t.use_xyz&&(this.Z=0);},t.IntPoint1dp.prototype=t.IntPoint.prototype,t.IntPoint2=function(c,d,m){this.X=c,this.Y=d,t.use_xyz&&(_typeof(m)>"u"?this.Z=0:this.Z=m);},t.IntPoint2.prototype=t.IntPoint.prototype,t.IntRect=function(){var c=arguments,d=c.length;if(d===4)this.left=c[0],this.top=c[1],this.right=c[2],this.bottom=c[3];else if(d===1){var m=c[0];this.left=m.left,this.top=m.top,this.right=m.right,this.bottom=m.bottom;}else this.left=0,this.top=0,this.right=0,this.bottom=0;},t.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0;},t.IntRect0.prototype=t.IntRect.prototype,t.IntRect1=function(c){this.left=c.left,this.top=c.top,this.right=c.right,this.bottom=c.bottom;},t.IntRect1.prototype=t.IntRect.prototype,t.IntRect4=function(c,d,m,E){this.left=c,this.top=d,this.right=m,this.bottom=E;},t.IntRect4.prototype=t.IntRect.prototype,t.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},t.PolyType={ptSubject:0,ptClip:1},t.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},t.JoinType={jtSquare:0,jtRound:1,jtMiter:2},t.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},t.EdgeSide={esLeft:0,esRight:1},t.Direction={dRightToLeft:0,dLeftToRight:1},t.TEdge=function(){this.Bot=new t.IntPoint0(),this.Curr=new t.IntPoint0(),this.Top=new t.IntPoint0(),this.Delta=new t.IntPoint0(),this.Dx=0,this.PolyTyp=t.PolyType.ptSubject,this.Side=t.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null;},t.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new t.IntPoint0();},t.MyIntersectNodeSort=function(){},t.MyIntersectNodeSort.Compare=function(c,d){var m=d.Pt.Y-c.Pt.Y;return m>0?1:m<0?-1:0;},t.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null;},t.Scanbeam=function(){this.Y=0,this.Next=null;},t.Maxima=function(){this.X=0,this.Next=null,this.Prev=null;},t.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null;},t.OutPt=function(){this.Idx=0,this.Pt=new t.IntPoint0(),this.Next=null,this.Prev=null;},t.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new t.IntPoint0();},t.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array(),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null;},t.ClipperBase.horizontal=-9007199254740992,t.ClipperBase.Skip=-2,t.ClipperBase.Unassigned=-1,t.ClipperBase.tolerance=1e-20,t.ClipperBase.loRange=47453132,t.ClipperBase.hiRange=4503599627370495,t.ClipperBase.near_zero=function(c){return c>-t.ClipperBase.tolerance&&c<t.ClipperBase.tolerance;},t.ClipperBase.IsHorizontal=function(c){return c.Delta.Y===0;},t.ClipperBase.prototype.PointIsVertex=function(c,d){var m=d;do{if(t.IntPoint.op_Equality(m.Pt,c))return!0;m=m.Next;}while(m!==d);return!1;},t.ClipperBase.prototype.PointOnLineSegment=function(c,d,m,E){return E?c.X===d.X&&c.Y===d.Y||c.X===m.X&&c.Y===m.Y||c.X>d.X==c.X<m.X&&c.Y>d.Y==c.Y<m.Y&&we.op_Equality(we.Int128Mul(c.X-d.X,m.Y-d.Y),we.Int128Mul(m.X-d.X,c.Y-d.Y)):c.X===d.X&&c.Y===d.Y||c.X===m.X&&c.Y===m.Y||c.X>d.X==c.X<m.X&&c.Y>d.Y==c.Y<m.Y&&(c.X-d.X)*(m.Y-d.Y)===(m.X-d.X)*(c.Y-d.Y);},t.ClipperBase.prototype.PointOnPolygon=function(c,d,m){for(var E=d;;){if(this.PointOnLineSegment(c,E.Pt,E.Next.Pt,m))return!0;if(E=E.Next,E===d)break;}return!1;},t.ClipperBase.prototype.SlopesEqual=t.ClipperBase.SlopesEqual=function(){var c=arguments,d=c.length,m,E,F,rt,vt,At,Mt;return d===3?(m=c[0],E=c[1],Mt=c[2],Mt?we.op_Equality(we.Int128Mul(m.Delta.Y,E.Delta.X),we.Int128Mul(m.Delta.X,E.Delta.Y)):t.Cast_Int64(m.Delta.Y*E.Delta.X)===t.Cast_Int64(m.Delta.X*E.Delta.Y)):d===4?(F=c[0],rt=c[1],vt=c[2],Mt=c[3],Mt?we.op_Equality(we.Int128Mul(F.Y-rt.Y,rt.X-vt.X),we.Int128Mul(F.X-rt.X,rt.Y-vt.Y)):t.Cast_Int64((F.Y-rt.Y)*(rt.X-vt.X))-t.Cast_Int64((F.X-rt.X)*(rt.Y-vt.Y))===0):(F=c[0],rt=c[1],vt=c[2],At=c[3],Mt=c[4],Mt?we.op_Equality(we.Int128Mul(F.Y-rt.Y,vt.X-At.X),we.Int128Mul(F.X-rt.X,vt.Y-At.Y)):t.Cast_Int64((F.Y-rt.Y)*(vt.X-At.X))-t.Cast_Int64((F.X-rt.X)*(vt.Y-At.Y))===0);},t.ClipperBase.SlopesEqual3=function(c,d,m){return m?we.op_Equality(we.Int128Mul(c.Delta.Y,d.Delta.X),we.Int128Mul(c.Delta.X,d.Delta.Y)):t.Cast_Int64(c.Delta.Y*d.Delta.X)===t.Cast_Int64(c.Delta.X*d.Delta.Y);},t.ClipperBase.SlopesEqual4=function(c,d,m,E){return E?we.op_Equality(we.Int128Mul(c.Y-d.Y,d.X-m.X),we.Int128Mul(c.X-d.X,d.Y-m.Y)):t.Cast_Int64((c.Y-d.Y)*(d.X-m.X))-t.Cast_Int64((c.X-d.X)*(d.Y-m.Y))===0;},t.ClipperBase.SlopesEqual5=function(c,d,m,E,F){return F?we.op_Equality(we.Int128Mul(c.Y-d.Y,m.X-E.X),we.Int128Mul(c.X-d.X,m.Y-E.Y)):t.Cast_Int64((c.Y-d.Y)*(m.X-E.X))-t.Cast_Int64((c.X-d.X)*(m.Y-E.Y))===0;},t.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var c=0,d=this.m_edges.length;c<d;++c){for(var m=0,E=this.m_edges[c].length;m<E;++m)this.m_edges[c][m]=null;t.Clear(this.m_edges[c]);}t.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1;},t.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var c=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=c;}this.m_CurrentLM=null;},t.ClipperBase.prototype.RangeTest=function(c,d){d.Value?(c.X>t.ClipperBase.hiRange||c.Y>t.ClipperBase.hiRange||-c.X>t.ClipperBase.hiRange||-c.Y>t.ClipperBase.hiRange)&&t.Error("Coordinate outside allowed range in RangeTest()."):(c.X>t.ClipperBase.loRange||c.Y>t.ClipperBase.loRange||-c.X>t.ClipperBase.loRange||-c.Y>t.ClipperBase.loRange)&&(d.Value=!0,this.RangeTest(c,d));},t.ClipperBase.prototype.InitEdge=function(c,d,m,E){c.Next=d,c.Prev=m,c.Curr.X=E.X,c.Curr.Y=E.Y,t.use_xyz&&(c.Curr.Z=E.Z),c.OutIdx=-1;},t.ClipperBase.prototype.InitEdge2=function(c,d){c.Curr.Y>=c.Next.Curr.Y?(c.Bot.X=c.Curr.X,c.Bot.Y=c.Curr.Y,t.use_xyz&&(c.Bot.Z=c.Curr.Z),c.Top.X=c.Next.Curr.X,c.Top.Y=c.Next.Curr.Y,t.use_xyz&&(c.Top.Z=c.Next.Curr.Z)):(c.Top.X=c.Curr.X,c.Top.Y=c.Curr.Y,t.use_xyz&&(c.Top.Z=c.Curr.Z),c.Bot.X=c.Next.Curr.X,c.Bot.Y=c.Next.Curr.Y,t.use_xyz&&(c.Bot.Z=c.Next.Curr.Z)),this.SetDx(c),c.PolyTyp=d;},t.ClipperBase.prototype.FindNextLocMin=function(c){for(var d;;){for(;t.IntPoint.op_Inequality(c.Bot,c.Prev.Bot)||t.IntPoint.op_Equality(c.Curr,c.Top);)c=c.Next;if(c.Dx!==t.ClipperBase.horizontal&&c.Prev.Dx!==t.ClipperBase.horizontal)break;for(;c.Prev.Dx===t.ClipperBase.horizontal;)c=c.Prev;for(d=c;c.Dx===t.ClipperBase.horizontal;)c=c.Next;if(c.Top.Y!==c.Prev.Bot.Y){d.Prev.Bot.X<c.Bot.X&&(c=d);break;}}return c;},t.ClipperBase.prototype.ProcessBound=function(c,d){var m,E=c,F;if(E.OutIdx===t.ClipperBase.Skip){if(c=E,d){for(;c.Top.Y===c.Next.Bot.Y;)c=c.Next;for(;c!==E&&c.Dx===t.ClipperBase.horizontal;)c=c.Prev;}else{for(;c.Top.Y===c.Prev.Bot.Y;)c=c.Prev;for(;c!==E&&c.Dx===t.ClipperBase.horizontal;)c=c.Next;}if(c===E)d?E=c.Next:E=c.Prev;else{d?c=E.Next:c=E.Prev;var rt=new t.LocalMinima();rt.Next=null,rt.Y=c.Bot.Y,rt.LeftBound=null,rt.RightBound=c,c.WindDelta=0,E=this.ProcessBound(c,d),this.InsertLocalMinima(rt);}return E;}if(c.Dx===t.ClipperBase.horizontal&&(d?m=c.Prev:m=c.Next,m.Dx===t.ClipperBase.horizontal?m.Bot.X!==c.Bot.X&&m.Top.X!==c.Bot.X&&this.ReverseHorizontal(c):m.Bot.X!==c.Bot.X&&this.ReverseHorizontal(c)),m=c,d){for(;E.Top.Y===E.Next.Bot.Y&&E.Next.OutIdx!==t.ClipperBase.Skip;)E=E.Next;if(E.Dx===t.ClipperBase.horizontal&&E.Next.OutIdx!==t.ClipperBase.Skip){for(F=E;F.Prev.Dx===t.ClipperBase.horizontal;)F=F.Prev;F.Prev.Top.X>E.Next.Top.X&&(E=F.Prev);}for(;c!==E;)c.NextInLML=c.Next,c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Prev.Top.X&&this.ReverseHorizontal(c),c=c.Next;c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Prev.Top.X&&this.ReverseHorizontal(c),E=E.Next;}else{for(;E.Top.Y===E.Prev.Bot.Y&&E.Prev.OutIdx!==t.ClipperBase.Skip;)E=E.Prev;if(E.Dx===t.ClipperBase.horizontal&&E.Prev.OutIdx!==t.ClipperBase.Skip){for(F=E;F.Next.Dx===t.ClipperBase.horizontal;)F=F.Next;(F.Next.Top.X===E.Prev.Top.X||F.Next.Top.X>E.Prev.Top.X)&&(E=F.Next);}for(;c!==E;)c.NextInLML=c.Prev,c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Next.Top.X&&this.ReverseHorizontal(c),c=c.Prev;c.Dx===t.ClipperBase.horizontal&&c!==m&&c.Bot.X!==c.Next.Top.X&&this.ReverseHorizontal(c),E=E.Prev;}return E;},t.ClipperBase.prototype.AddPath=function(c,d,m){t.use_lines?!m&&d===t.PolyType.ptClip&&t.Error("AddPath: Open paths must be subject."):m||t.Error("AddPath: Open paths have been disabled.");var E=c.length-1;if(m)for(;E>0&&t.IntPoint.op_Equality(c[E],c[0]);)--E;for(;E>0&&t.IntPoint.op_Equality(c[E],c[E-1]);)--E;if(m&&E<2||!m&&E<1)return!1;for(var F=new Array(),rt=0;rt<=E;rt++)F.push(new t.TEdge());var vt=!0;F[1].Curr.X=c[1].X,F[1].Curr.Y=c[1].Y,t.use_xyz&&(F[1].Curr.Z=c[1].Z);var At={Value:this.m_UseFullRange};this.RangeTest(c[0],At),this.m_UseFullRange=At.Value,At.Value=this.m_UseFullRange,this.RangeTest(c[E],At),this.m_UseFullRange=At.Value,this.InitEdge(F[0],F[1],F[E],c[0]),this.InitEdge(F[E],F[0],F[E-1],c[E]);for(var rt=E-1;rt>=1;--rt)At.Value=this.m_UseFullRange,this.RangeTest(c[rt],At),this.m_UseFullRange=At.Value,this.InitEdge(F[rt],F[rt+1],F[rt-1],c[rt]);for(var Mt=F[0],Wt=Mt,Zt=Mt;;){if(Wt.Curr===Wt.Next.Curr&&(m||Wt.Next!==Mt)){if(Wt===Wt.Next)break;Wt===Mt&&(Mt=Wt.Next),Wt=this.RemoveEdge(Wt),Zt=Wt;continue;}if(Wt.Prev===Wt.Next)break;if(m&&t.ClipperBase.SlopesEqual4(Wt.Prev.Curr,Wt.Curr,Wt.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(Wt.Prev.Curr,Wt.Curr,Wt.Next.Curr))){Wt===Mt&&(Mt=Wt.Next),Wt=this.RemoveEdge(Wt),Wt=Wt.Prev,Zt=Wt;continue;}if(Wt=Wt.Next,Wt===Zt||!m&&Wt.Next===Mt)break;}if(!m&&Wt===Wt.Next||m&&Wt.Prev===Wt.Next)return!1;m||(this.m_HasOpenPaths=!0,Mt.Prev.OutIdx=t.ClipperBase.Skip),Wt=Mt;do this.InitEdge2(Wt,d),Wt=Wt.Next,vt&&Wt.Curr.Y!==Mt.Curr.Y&&(vt=!1);while(Wt!==Mt);if(vt){if(m)return!1;Wt.Prev.OutIdx=t.ClipperBase.Skip;var Xt=new t.LocalMinima();for(Xt.Next=null,Xt.Y=Wt.Bot.Y,Xt.LeftBound=null,Xt.RightBound=Wt,Xt.RightBound.Side=t.EdgeSide.esRight,Xt.RightBound.WindDelta=0;Wt.Bot.X!==Wt.Prev.Top.X&&this.ReverseHorizontal(Wt),Wt.Next.OutIdx!==t.ClipperBase.Skip;)Wt.NextInLML=Wt.Next,Wt=Wt.Next;return this.InsertLocalMinima(Xt),this.m_edges.push(F),!0;}this.m_edges.push(F);var ne,ue=null;for(t.IntPoint.op_Equality(Wt.Prev.Bot,Wt.Prev.Top)&&(Wt=Wt.Next);Wt=this.FindNextLocMin(Wt),Wt!==ue;){ue===null&&(ue=Wt);var Xt=new t.LocalMinima();Xt.Next=null,Xt.Y=Wt.Bot.Y,Wt.Dx<Wt.Prev.Dx?(Xt.LeftBound=Wt.Prev,Xt.RightBound=Wt,ne=!1):(Xt.LeftBound=Wt,Xt.RightBound=Wt.Prev,ne=!0),Xt.LeftBound.Side=t.EdgeSide.esLeft,Xt.RightBound.Side=t.EdgeSide.esRight,m?Xt.LeftBound.Next===Xt.RightBound?Xt.LeftBound.WindDelta=-1:Xt.LeftBound.WindDelta=1:Xt.LeftBound.WindDelta=0,Xt.RightBound.WindDelta=-Xt.LeftBound.WindDelta,Wt=this.ProcessBound(Xt.LeftBound,ne),Wt.OutIdx===t.ClipperBase.Skip&&(Wt=this.ProcessBound(Wt,ne));var Se=this.ProcessBound(Xt.RightBound,!ne);Se.OutIdx===t.ClipperBase.Skip&&(Se=this.ProcessBound(Se,!ne)),Xt.LeftBound.OutIdx===t.ClipperBase.Skip?Xt.LeftBound=null:Xt.RightBound.OutIdx===t.ClipperBase.Skip&&(Xt.RightBound=null),this.InsertLocalMinima(Xt),ne||(Wt=Se);}return!0;},t.ClipperBase.prototype.AddPaths=function(c,d,m){for(var E=!1,F=0,rt=c.length;F<rt;++F)this.AddPath(c[F],d,m)&&(E=!0);return E;},t.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(c,d,m){return t.IntPoint.op_Equality(c,m)||t.IntPoint.op_Equality(c,d)||t.IntPoint.op_Equality(m,d)?!1:c.X!==m.X?d.X>c.X==d.X<m.X:d.Y>c.Y==d.Y<m.Y;},t.ClipperBase.prototype.RemoveEdge=function(c){c.Prev.Next=c.Next,c.Next.Prev=c.Prev;var d=c.Next;return c.Prev=null,d;},t.ClipperBase.prototype.SetDx=function(c){c.Delta.X=c.Top.X-c.Bot.X,c.Delta.Y=c.Top.Y-c.Bot.Y,c.Delta.Y===0?c.Dx=t.ClipperBase.horizontal:c.Dx=c.Delta.X/c.Delta.Y;},t.ClipperBase.prototype.InsertLocalMinima=function(c){if(this.m_MinimaList===null)this.m_MinimaList=c;else if(c.Y>=this.m_MinimaList.Y)c.Next=this.m_MinimaList,this.m_MinimaList=c;else{for(var d=this.m_MinimaList;d.Next!==null&&c.Y<d.Next.Y;)d=d.Next;c.Next=d.Next,d.Next=c;}},t.ClipperBase.prototype.PopLocalMinima=function(c,d){return d.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===c?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1;},t.ClipperBase.prototype.ReverseHorizontal=function(c){var d=c.Top.X;c.Top.X=c.Bot.X,c.Bot.X=d,t.use_xyz&&(d=c.Top.Z,c.Top.Z=c.Bot.Z,c.Bot.Z=d);},t.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var c=this.m_MinimaList;c!==null;){this.InsertScanbeam(c.Y);var d=c.LeftBound;d!==null&&(d.Curr.X=d.Bot.X,d.Curr.Y=d.Bot.Y,t.use_xyz&&(d.Curr.Z=d.Bot.Z),d.OutIdx=t.ClipperBase.Unassigned),d=c.RightBound,d!==null&&(d.Curr.X=d.Bot.X,d.Curr.Y=d.Bot.Y,t.use_xyz&&(d.Curr.Z=d.Bot.Z),d.OutIdx=t.ClipperBase.Unassigned),c=c.Next;}this.m_ActiveEdges=null;}},t.ClipperBase.prototype.InsertScanbeam=function(c){if(this.m_Scanbeam===null)this.m_Scanbeam=new t.Scanbeam(),this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=c;else if(c>this.m_Scanbeam.Y){var d=new t.Scanbeam();d.Y=c,d.Next=this.m_Scanbeam,this.m_Scanbeam=d;}else{for(var m=this.m_Scanbeam;m.Next!==null&&c<=m.Next.Y;)m=m.Next;if(c===m.Y)return;var E=new t.Scanbeam();E.Y=c,E.Next=m.Next,m.Next=E;}},t.ClipperBase.prototype.PopScanbeam=function(c){return this.m_Scanbeam===null?(c.v=0,!1):(c.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0);},t.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null;},t.ClipperBase.prototype.CreateOutRec=function(){var c=new t.OutRec();return c.Idx=t.ClipperBase.Unassigned,c.IsHole=!1,c.IsOpen=!1,c.FirstLeft=null,c.Pts=null,c.BottomPt=null,c.PolyNode=null,this.m_PolyOuts.push(c),c.Idx=this.m_PolyOuts.length-1,c;},t.ClipperBase.prototype.DisposeOutRec=function(c){var d=this.m_PolyOuts[c];d.Pts=null,d=null,this.m_PolyOuts[c]=null;},t.ClipperBase.prototype.UpdateEdgeIntoAEL=function(c){c.NextInLML===null&&t.Error("UpdateEdgeIntoAEL: invalid call");var d=c.PrevInAEL,m=c.NextInAEL;return c.NextInLML.OutIdx=c.OutIdx,d!==null?d.NextInAEL=c.NextInLML:this.m_ActiveEdges=c.NextInLML,m!==null&&(m.PrevInAEL=c.NextInLML),c.NextInLML.Side=c.Side,c.NextInLML.WindDelta=c.WindDelta,c.NextInLML.WindCnt=c.WindCnt,c.NextInLML.WindCnt2=c.WindCnt2,c=c.NextInLML,c.Curr.X=c.Bot.X,c.Curr.Y=c.Bot.Y,c.PrevInAEL=d,c.NextInAEL=m,t.ClipperBase.IsHorizontal(c)||this.InsertScanbeam(c.Top.Y),c;},t.ClipperBase.prototype.SwapPositionsInAEL=function(c,d){if(!(c.NextInAEL===c.PrevInAEL||d.NextInAEL===d.PrevInAEL)){if(c.NextInAEL===d){var m=d.NextInAEL;m!==null&&(m.PrevInAEL=c);var E=c.PrevInAEL;E!==null&&(E.NextInAEL=d),d.PrevInAEL=E,d.NextInAEL=c,c.PrevInAEL=d,c.NextInAEL=m;}else if(d.NextInAEL===c){var F=c.NextInAEL;F!==null&&(F.PrevInAEL=d);var rt=d.PrevInAEL;rt!==null&&(rt.NextInAEL=c),c.PrevInAEL=rt,c.NextInAEL=d,d.PrevInAEL=c,d.NextInAEL=F;}else{var vt=c.NextInAEL,At=c.PrevInAEL;c.NextInAEL=d.NextInAEL,c.NextInAEL!==null&&(c.NextInAEL.PrevInAEL=c),c.PrevInAEL=d.PrevInAEL,c.PrevInAEL!==null&&(c.PrevInAEL.NextInAEL=c),d.NextInAEL=vt,d.NextInAEL!==null&&(d.NextInAEL.PrevInAEL=d),d.PrevInAEL=At,d.PrevInAEL!==null&&(d.PrevInAEL.NextInAEL=d);}c.PrevInAEL===null?this.m_ActiveEdges=c:d.PrevInAEL===null&&(this.m_ActiveEdges=d);}},t.ClipperBase.prototype.DeleteFromAEL=function(c){var d=c.PrevInAEL,m=c.NextInAEL;d===null&&m===null&&c!==this.m_ActiveEdges||(d!==null?d.NextInAEL=m:this.m_ActiveEdges=m,m!==null&&(m.PrevInAEL=d),c.NextInAEL=null,c.PrevInAEL=null);},t.Clipper=function(c){_typeof(c)>"u"&&(c=0),this.m_PolyOuts=null,this.m_ClipType=t.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=t.PolyFillType.pftEvenOdd,this.m_SubjFillType=t.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,t.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array(),this.m_IntersectNodeComparer=t.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array(),this.m_Joins=new Array(),this.m_GhostJoins=new Array(),this.ReverseSolution=(1&c)!==0,this.StrictlySimple=(2&c)!==0,this.PreserveCollinear=(4&c)!==0,t.use_xyz&&(this.ZFillFunction=null);},t.Clipper.ioReverseSolution=1,t.Clipper.ioStrictlySimple=2,t.Clipper.ioPreserveCollinear=4,t.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),t.ClipperBase.prototype.Clear.call(this));},t.Clipper.prototype.InsertMaxima=function(c){var d=new t.Maxima();if(d.X=c,this.m_Maxima===null)this.m_Maxima=d,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(c<this.m_Maxima.X)d.Next=this.m_Maxima,d.Prev=null,this.m_Maxima=d;else{for(var m=this.m_Maxima;m.Next!==null&&c>=m.Next.X;)m=m.Next;if(c===m.X)return;d.Next=m.Next,d.Prev=m,m.Next!==null&&(m.Next.Prev=d),m.Next=d;}},t.Clipper.prototype.Execute=function(){var c=arguments,d=c.length,m=c[1]instanceof t.PolyTree;if(d===4&&!m){var E=c[0],F=c[1],rt=c[2],vt=c[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&t.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,t.Clear(F),this.m_SubjFillType=rt,this.m_ClipFillType=vt,this.m_ClipType=E,this.m_UsingPolyTree=!1;try{var At=this.ExecuteInternal();At&&this.BuildResult(F);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return At;}else if(d===4&&m){var E=c[0],Mt=c[1],rt=c[2],vt=c[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=rt,this.m_ClipFillType=vt,this.m_ClipType=E,this.m_UsingPolyTree=!0;try{var At=this.ExecuteInternal();At&&this.BuildResult2(Mt);}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1;}return At;}else if(d===2&&!m){var E=c[0],F=c[1];return this.Execute(E,F,t.PolyFillType.pftEvenOdd,t.PolyFillType.pftEvenOdd);}else if(d===2&&m){var E=c[0],Mt=c[1];return this.Execute(E,Mt,t.PolyFillType.pftEvenOdd,t.PolyFillType.pftEvenOdd);}},t.Clipper.prototype.FixHoleLinkage=function(c){if(!(c.FirstLeft===null||c.IsHole!==c.FirstLeft.IsHole&&c.FirstLeft.Pts!==null)){for(var d=c.FirstLeft;d!==null&&(d.IsHole===c.IsHole||d.Pts===null);)d=d.FirstLeft;c.FirstLeft=d;}},t.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var c={},d={};if(!this.PopScanbeam(c))return!1;for(this.InsertLocalMinimaIntoAEL(c.v);this.PopScanbeam(d)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(d.v))return!1;this.ProcessEdgesAtTopOfScanbeam(d.v),c.v=d.v,this.InsertLocalMinimaIntoAEL(c.v);}var m,E,F;for(E=0,F=this.m_PolyOuts.length;E<F;E++)m=this.m_PolyOuts[E],!(m.Pts===null||m.IsOpen)&&(m.IsHole^this.ReverseSolution)==this.Area$1(m)>0&&this.ReversePolyPtLinks(m.Pts);for(this.JoinCommonEdges(),E=0,F=this.m_PolyOuts.length;E<F;E++)m=this.m_PolyOuts[E],m.Pts!==null&&(m.IsOpen?this.FixupOutPolyline(m):this.FixupOutPolygon(m));return this.StrictlySimple&&this.DoSimplePolygons(),!0;}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0;}},t.Clipper.prototype.DisposeAllPolyPts=function(){for(var c=0,d=this.m_PolyOuts.length;c<d;++c)this.DisposeOutRec(c);t.Clear(this.m_PolyOuts);},t.Clipper.prototype.AddJoin=function(c,d,m){var E=new t.Join();E.OutPt1=c,E.OutPt2=d,E.OffPt.X=m.X,E.OffPt.Y=m.Y,t.use_xyz&&(E.OffPt.Z=m.Z),this.m_Joins.push(E);},t.Clipper.prototype.AddGhostJoin=function(c,d){var m=new t.Join();m.OutPt1=c,m.OffPt.X=d.X,m.OffPt.Y=d.Y,t.use_xyz&&(m.OffPt.Z=d.Z),this.m_GhostJoins.push(m);},t.Clipper.prototype.SetZ=function(c,d,m){if(this.ZFillFunction!==null){if(c.Z!==0||this.ZFillFunction===null)return;t.IntPoint.op_Equality(c,d.Bot)?c.Z=d.Bot.Z:t.IntPoint.op_Equality(c,d.Top)?c.Z=d.Top.Z:t.IntPoint.op_Equality(c,m.Bot)?c.Z=m.Bot.Z:t.IntPoint.op_Equality(c,m.Top)?c.Z=m.Top.Z:this.ZFillFunction(d.Bot,d.Top,m.Bot,m.Top,c);}},t.Clipper.prototype.InsertLocalMinimaIntoAEL=function(c){for(var d={},m,E;this.PopLocalMinima(c,d);){m=d.v.LeftBound,E=d.v.RightBound;var F=null;if(m===null?(this.InsertEdgeIntoAEL(E,null),this.SetWindingCount(E),this.IsContributing(E)&&(F=this.AddOutPt(E,E.Bot))):E===null?(this.InsertEdgeIntoAEL(m,null),this.SetWindingCount(m),this.IsContributing(m)&&(F=this.AddOutPt(m,m.Bot)),this.InsertScanbeam(m.Top.Y)):(this.InsertEdgeIntoAEL(m,null),this.InsertEdgeIntoAEL(E,m),this.SetWindingCount(m),E.WindCnt=m.WindCnt,E.WindCnt2=m.WindCnt2,this.IsContributing(m)&&(F=this.AddLocalMinPoly(m,E,m.Bot)),this.InsertScanbeam(m.Top.Y)),E!==null&&(t.ClipperBase.IsHorizontal(E)?(E.NextInLML!==null&&this.InsertScanbeam(E.NextInLML.Top.Y),this.AddEdgeToSEL(E)):this.InsertScanbeam(E.Top.Y)),!(m===null||E===null)){if(F!==null&&t.ClipperBase.IsHorizontal(E)&&this.m_GhostJoins.length>0&&E.WindDelta!==0)for(var rt=0,vt=this.m_GhostJoins.length;rt<vt;rt++){var At=this.m_GhostJoins[rt];this.HorzSegmentsOverlap(At.OutPt1.Pt.X,At.OffPt.X,E.Bot.X,E.Top.X)&&this.AddJoin(At.OutPt1,F,At.OffPt);}if(m.OutIdx>=0&&m.PrevInAEL!==null&&m.PrevInAEL.Curr.X===m.Bot.X&&m.PrevInAEL.OutIdx>=0&&t.ClipperBase.SlopesEqual5(m.PrevInAEL.Curr,m.PrevInAEL.Top,m.Curr,m.Top,this.m_UseFullRange)&&m.WindDelta!==0&&m.PrevInAEL.WindDelta!==0){var Mt=this.AddOutPt(m.PrevInAEL,m.Bot);this.AddJoin(F,Mt,m.Top);}if(m.NextInAEL!==E){if(E.OutIdx>=0&&E.PrevInAEL.OutIdx>=0&&t.ClipperBase.SlopesEqual5(E.PrevInAEL.Curr,E.PrevInAEL.Top,E.Curr,E.Top,this.m_UseFullRange)&&E.WindDelta!==0&&E.PrevInAEL.WindDelta!==0){var Mt=this.AddOutPt(E.PrevInAEL,E.Bot);this.AddJoin(F,Mt,E.Top);}var Wt=m.NextInAEL;if(Wt!==null)for(;Wt!==E;)this.IntersectEdges(E,Wt,m.Curr),Wt=Wt.NextInAEL;}}}},t.Clipper.prototype.InsertEdgeIntoAEL=function(c,d){if(this.m_ActiveEdges===null)c.PrevInAEL=null,c.NextInAEL=null,this.m_ActiveEdges=c;else if(d===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,c))c.PrevInAEL=null,c.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=c,this.m_ActiveEdges=c;else{for(d===null&&(d=this.m_ActiveEdges);d.NextInAEL!==null&&!this.E2InsertsBeforeE1(d.NextInAEL,c);)d=d.NextInAEL;c.NextInAEL=d.NextInAEL,d.NextInAEL!==null&&(d.NextInAEL.PrevInAEL=c),c.PrevInAEL=d,d.NextInAEL=c;}},t.Clipper.prototype.E2InsertsBeforeE1=function(c,d){return d.Curr.X===c.Curr.X?d.Top.Y>c.Top.Y?d.Top.X<t.Clipper.TopX(c,d.Top.Y):c.Top.X>t.Clipper.TopX(d,c.Top.Y):d.Curr.X<c.Curr.X;},t.Clipper.prototype.IsEvenOddFillType=function(c){return c.PolyTyp===t.PolyType.ptSubject?this.m_SubjFillType===t.PolyFillType.pftEvenOdd:this.m_ClipFillType===t.PolyFillType.pftEvenOdd;},t.Clipper.prototype.IsEvenOddAltFillType=function(c){return c.PolyTyp===t.PolyType.ptSubject?this.m_ClipFillType===t.PolyFillType.pftEvenOdd:this.m_SubjFillType===t.PolyFillType.pftEvenOdd;},t.Clipper.prototype.IsContributing=function(c){var d,m;switch(c.PolyTyp===t.PolyType.ptSubject?(d=this.m_SubjFillType,m=this.m_ClipFillType):(d=this.m_ClipFillType,m=this.m_SubjFillType),d){case t.PolyFillType.pftEvenOdd:if(c.WindDelta===0&&c.WindCnt!==1)return!1;break;case t.PolyFillType.pftNonZero:if(Math.abs(c.WindCnt)!==1)return!1;break;case t.PolyFillType.pftPositive:if(c.WindCnt!==1)return!1;break;default:if(c.WindCnt!==-1)return!1;break;}switch(this.m_ClipType){case t.ClipType.ctIntersection:switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2!==0;case t.PolyFillType.pftPositive:return c.WindCnt2>0;default:return c.WindCnt2<0;}case t.ClipType.ctUnion:switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2===0;case t.PolyFillType.pftPositive:return c.WindCnt2<=0;default:return c.WindCnt2>=0;}case t.ClipType.ctDifference:if(c.PolyTyp===t.PolyType.ptSubject)switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2===0;case t.PolyFillType.pftPositive:return c.WindCnt2<=0;default:return c.WindCnt2>=0;}else switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2!==0;case t.PolyFillType.pftPositive:return c.WindCnt2>0;default:return c.WindCnt2<0;}case t.ClipType.ctXor:if(c.WindDelta===0)switch(m){case t.PolyFillType.pftEvenOdd:case t.PolyFillType.pftNonZero:return c.WindCnt2===0;case t.PolyFillType.pftPositive:return c.WindCnt2<=0;default:return c.WindCnt2>=0;}else return!0;}return!0;},t.Clipper.prototype.SetWindingCount=function(c){for(var d=c.PrevInAEL;d!==null&&(d.PolyTyp!==c.PolyTyp||d.WindDelta===0);)d=d.PrevInAEL;if(d===null){var m=c.PolyTyp===t.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;c.WindDelta===0?c.WindCnt=m===t.PolyFillType.pftNegative?-1:1:c.WindCnt=c.WindDelta,c.WindCnt2=0,d=this.m_ActiveEdges;}else if(c.WindDelta===0&&this.m_ClipType!==t.ClipType.ctUnion)c.WindCnt=1,c.WindCnt2=d.WindCnt2,d=d.NextInAEL;else if(this.IsEvenOddFillType(c)){if(c.WindDelta===0){for(var E=!0,F=d.PrevInAEL;F!==null;)F.PolyTyp===d.PolyTyp&&F.WindDelta!==0&&(E=!E),F=F.PrevInAEL;c.WindCnt=E?0:1;}else c.WindCnt=c.WindDelta;c.WindCnt2=d.WindCnt2,d=d.NextInAEL;}else d.WindCnt*d.WindDelta<0?Math.abs(d.WindCnt)>1?d.WindDelta*c.WindDelta<0?c.WindCnt=d.WindCnt:c.WindCnt=d.WindCnt+c.WindDelta:c.WindCnt=c.WindDelta===0?1:c.WindDelta:c.WindDelta===0?c.WindCnt=d.WindCnt<0?d.WindCnt-1:d.WindCnt+1:d.WindDelta*c.WindDelta<0?c.WindCnt=d.WindCnt:c.WindCnt=d.WindCnt+c.WindDelta,c.WindCnt2=d.WindCnt2,d=d.NextInAEL;if(this.IsEvenOddAltFillType(c))for(;d!==c;)d.WindDelta!==0&&(c.WindCnt2=c.WindCnt2===0?1:0),d=d.NextInAEL;else for(;d!==c;)c.WindCnt2+=d.WindDelta,d=d.NextInAEL;},t.Clipper.prototype.AddEdgeToSEL=function(c){this.m_SortedEdges===null?(this.m_SortedEdges=c,c.PrevInSEL=null,c.NextInSEL=null):(c.NextInSEL=this.m_SortedEdges,c.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=c,this.m_SortedEdges=c);},t.Clipper.prototype.PopEdgeFromSEL=function(c){if(c.v=this.m_SortedEdges,c.v===null)return!1;var d=c.v;return this.m_SortedEdges=c.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),d.NextInSEL=null,d.PrevInSEL=null,!0;},t.Clipper.prototype.CopyAELToSEL=function(){var c=this.m_ActiveEdges;for(this.m_SortedEdges=c;c!==null;)c.PrevInSEL=c.PrevInAEL,c.NextInSEL=c.NextInAEL,c=c.NextInAEL;},t.Clipper.prototype.SwapPositionsInSEL=function(c,d){if(!(c.NextInSEL===null&&c.PrevInSEL===null)&&!(d.NextInSEL===null&&d.PrevInSEL===null)){if(c.NextInSEL===d){var m=d.NextInSEL;m!==null&&(m.PrevInSEL=c);var E=c.PrevInSEL;E!==null&&(E.NextInSEL=d),d.PrevInSEL=E,d.NextInSEL=c,c.PrevInSEL=d,c.NextInSEL=m;}else if(d.NextInSEL===c){var m=c.NextInSEL;m!==null&&(m.PrevInSEL=d);var E=d.PrevInSEL;E!==null&&(E.NextInSEL=c),c.PrevInSEL=E,c.NextInSEL=d,d.PrevInSEL=c,d.NextInSEL=m;}else{var m=c.NextInSEL,E=c.PrevInSEL;c.NextInSEL=d.NextInSEL,c.NextInSEL!==null&&(c.NextInSEL.PrevInSEL=c),c.PrevInSEL=d.PrevInSEL,c.PrevInSEL!==null&&(c.PrevInSEL.NextInSEL=c),d.NextInSEL=m,d.NextInSEL!==null&&(d.NextInSEL.PrevInSEL=d),d.PrevInSEL=E,d.PrevInSEL!==null&&(d.PrevInSEL.NextInSEL=d);}c.PrevInSEL===null?this.m_SortedEdges=c:d.PrevInSEL===null&&(this.m_SortedEdges=d);}},t.Clipper.prototype.AddLocalMaxPoly=function(c,d,m){this.AddOutPt(c,m),d.WindDelta===0&&this.AddOutPt(d,m),c.OutIdx===d.OutIdx?(c.OutIdx=-1,d.OutIdx=-1):c.OutIdx<d.OutIdx?this.AppendPolygon(c,d):this.AppendPolygon(d,c);},t.Clipper.prototype.AddLocalMinPoly=function(c,d,m){var E,F,rt;if(t.ClipperBase.IsHorizontal(d)||c.Dx>d.Dx?(E=this.AddOutPt(c,m),d.OutIdx=c.OutIdx,c.Side=t.EdgeSide.esLeft,d.Side=t.EdgeSide.esRight,F=c,F.PrevInAEL===d?rt=d.PrevInAEL:rt=F.PrevInAEL):(E=this.AddOutPt(d,m),c.OutIdx=d.OutIdx,c.Side=t.EdgeSide.esRight,d.Side=t.EdgeSide.esLeft,F=d,F.PrevInAEL===c?rt=c.PrevInAEL:rt=F.PrevInAEL),rt!==null&&rt.OutIdx>=0&&rt.Top.Y<m.Y&&F.Top.Y<m.Y){var vt=t.Clipper.TopX(rt,m.Y),At=t.Clipper.TopX(F,m.Y);if(vt===At&&F.WindDelta!==0&&rt.WindDelta!==0&&t.ClipperBase.SlopesEqual5(new t.IntPoint2(vt,m.Y),rt.Top,new t.IntPoint2(At,m.Y),F.Top,this.m_UseFullRange)){var Mt=this.AddOutPt(rt,m);this.AddJoin(E,Mt,F.Top);}}return E;},t.Clipper.prototype.AddOutPt=function(c,d){if(c.OutIdx<0){var m=this.CreateOutRec();m.IsOpen=c.WindDelta===0;var E=new t.OutPt();return m.Pts=E,E.Idx=m.Idx,E.Pt.X=d.X,E.Pt.Y=d.Y,t.use_xyz&&(E.Pt.Z=d.Z),E.Next=E,E.Prev=E,m.IsOpen||this.SetHoleState(c,m),c.OutIdx=m.Idx,E;}else{var m=this.m_PolyOuts[c.OutIdx],F=m.Pts,rt=c.Side===t.EdgeSide.esLeft;if(rt&&t.IntPoint.op_Equality(d,F.Pt))return F;if(!rt&&t.IntPoint.op_Equality(d,F.Prev.Pt))return F.Prev;var E=new t.OutPt();return E.Idx=m.Idx,E.Pt.X=d.X,E.Pt.Y=d.Y,t.use_xyz&&(E.Pt.Z=d.Z),E.Next=F,E.Prev=F.Prev,E.Prev.Next=E,F.Prev=E,rt&&(m.Pts=E),E;}},t.Clipper.prototype.GetLastOutPt=function(c){var d=this.m_PolyOuts[c.OutIdx];return c.Side===t.EdgeSide.esLeft?d.Pts:d.Pts.Prev;},t.Clipper.prototype.SwapPoints=function(c,d){var m=new t.IntPoint1(c.Value);c.Value.X=d.Value.X,c.Value.Y=d.Value.Y,t.use_xyz&&(c.Value.Z=d.Value.Z),d.Value.X=m.X,d.Value.Y=m.Y,t.use_xyz&&(d.Value.Z=m.Z);},t.Clipper.prototype.HorzSegmentsOverlap=function(c,d,m,E){var F;return c>d&&(F=c,c=d,d=F),m>E&&(F=m,m=E,E=F),c<E&&m<d;},t.Clipper.prototype.SetHoleState=function(c,d){for(var m=c.PrevInAEL,E=null;m!==null;)m.OutIdx>=0&&m.WindDelta!==0&&(E===null?E=m:E.OutIdx===m.OutIdx&&(E=null)),m=m.PrevInAEL;E===null?(d.FirstLeft=null,d.IsHole=!1):(d.FirstLeft=this.m_PolyOuts[E.OutIdx],d.IsHole=!d.FirstLeft.IsHole);},t.Clipper.prototype.GetDx=function(c,d){return c.Y===d.Y?t.ClipperBase.horizontal:(d.X-c.X)/(d.Y-c.Y);},t.Clipper.prototype.FirstIsBottomPt=function(c,d){for(var m=c.Prev;t.IntPoint.op_Equality(m.Pt,c.Pt)&&m!==c;)m=m.Prev;var E=Math.abs(this.GetDx(c.Pt,m.Pt));for(m=c.Next;t.IntPoint.op_Equality(m.Pt,c.Pt)&&m!==c;)m=m.Next;var F=Math.abs(this.GetDx(c.Pt,m.Pt));for(m=d.Prev;t.IntPoint.op_Equality(m.Pt,d.Pt)&&m!==d;)m=m.Prev;var rt=Math.abs(this.GetDx(d.Pt,m.Pt));for(m=d.Next;t.IntPoint.op_Equality(m.Pt,d.Pt)&&m!==d;)m=m.Next;var vt=Math.abs(this.GetDx(d.Pt,m.Pt));return Math.max(E,F)===Math.max(rt,vt)&&Math.min(E,F)===Math.min(rt,vt)?this.Area(c)>0:E>=rt&&E>=vt||F>=rt&&F>=vt;},t.Clipper.prototype.GetBottomPt=function(c){for(var d=null,m=c.Next;m!==c;)m.Pt.Y>c.Pt.Y?(c=m,d=null):m.Pt.Y===c.Pt.Y&&m.Pt.X<=c.Pt.X&&(m.Pt.X<c.Pt.X?(d=null,c=m):m.Next!==c&&m.Prev!==c&&(d=m)),m=m.Next;if(d!==null)for(;d!==m;)for(this.FirstIsBottomPt(m,d)||(c=d),d=d.Next;t.IntPoint.op_Inequality(d.Pt,c.Pt);)d=d.Next;return c;},t.Clipper.prototype.GetLowermostRec=function(c,d){c.BottomPt===null&&(c.BottomPt=this.GetBottomPt(c.Pts)),d.BottomPt===null&&(d.BottomPt=this.GetBottomPt(d.Pts));var m=c.BottomPt,E=d.BottomPt;return m.Pt.Y>E.Pt.Y?c:m.Pt.Y<E.Pt.Y?d:m.Pt.X<E.Pt.X?c:m.Pt.X>E.Pt.X||m.Next===m?d:E.Next===E||this.FirstIsBottomPt(m,E)?c:d;},t.Clipper.prototype.OutRec1RightOfOutRec2=function(c,d){do if(c=c.FirstLeft,c===d)return!0;while(c!==null);return!1;},t.Clipper.prototype.GetOutRec=function(c){for(var d=this.m_PolyOuts[c];d!==this.m_PolyOuts[d.Idx];)d=this.m_PolyOuts[d.Idx];return d;},t.Clipper.prototype.AppendPolygon=function(c,d){var m=this.m_PolyOuts[c.OutIdx],E=this.m_PolyOuts[d.OutIdx],F;this.OutRec1RightOfOutRec2(m,E)?F=E:this.OutRec1RightOfOutRec2(E,m)?F=m:F=this.GetLowermostRec(m,E);var rt=m.Pts,vt=rt.Prev,At=E.Pts,Mt=At.Prev;c.Side===t.EdgeSide.esLeft?d.Side===t.EdgeSide.esLeft?(this.ReversePolyPtLinks(At),At.Next=rt,rt.Prev=At,vt.Next=Mt,Mt.Prev=vt,m.Pts=Mt):(Mt.Next=rt,rt.Prev=Mt,At.Prev=vt,vt.Next=At,m.Pts=At):d.Side===t.EdgeSide.esRight?(this.ReversePolyPtLinks(At),vt.Next=Mt,Mt.Prev=vt,At.Next=rt,rt.Prev=At):(vt.Next=At,At.Prev=vt,rt.Prev=Mt,Mt.Next=rt),m.BottomPt=null,F===E&&(E.FirstLeft!==m&&(m.FirstLeft=E.FirstLeft),m.IsHole=E.IsHole),E.Pts=null,E.BottomPt=null,E.FirstLeft=m;var Wt=c.OutIdx,Zt=d.OutIdx;c.OutIdx=-1,d.OutIdx=-1;for(var Xt=this.m_ActiveEdges;Xt!==null;){if(Xt.OutIdx===Zt){Xt.OutIdx=Wt,Xt.Side=c.Side;break;}Xt=Xt.NextInAEL;}E.Idx=m.Idx;},t.Clipper.prototype.ReversePolyPtLinks=function(c){if(c!==null){var d,m;d=c;do m=d.Next,d.Next=d.Prev,d.Prev=m,d=m;while(d!==c);}},t.Clipper.SwapSides=function(c,d){var m=c.Side;c.Side=d.Side,d.Side=m;},t.Clipper.SwapPolyIndexes=function(c,d){var m=c.OutIdx;c.OutIdx=d.OutIdx,d.OutIdx=m;},t.Clipper.prototype.IntersectEdges=function(c,d,m){var E=c.OutIdx>=0,F=d.OutIdx>=0;if(t.use_xyz&&this.SetZ(m,c,d),t.use_lines&&(c.WindDelta===0||d.WindDelta===0)){if(c.WindDelta===0&&d.WindDelta===0)return;c.PolyTyp===d.PolyTyp&&c.WindDelta!==d.WindDelta&&this.m_ClipType===t.ClipType.ctUnion?c.WindDelta===0?F&&(this.AddOutPt(c,m),E&&(c.OutIdx=-1)):E&&(this.AddOutPt(d,m),F&&(d.OutIdx=-1)):c.PolyTyp!==d.PolyTyp&&(c.WindDelta===0&&Math.abs(d.WindCnt)===1&&(this.m_ClipType!==t.ClipType.ctUnion||d.WindCnt2===0)?(this.AddOutPt(c,m),E&&(c.OutIdx=-1)):d.WindDelta===0&&Math.abs(c.WindCnt)===1&&(this.m_ClipType!==t.ClipType.ctUnion||c.WindCnt2===0)&&(this.AddOutPt(d,m),F&&(d.OutIdx=-1)));return;}if(c.PolyTyp===d.PolyTyp){if(this.IsEvenOddFillType(c)){var rt=c.WindCnt;c.WindCnt=d.WindCnt,d.WindCnt=rt;}else c.WindCnt+d.WindDelta===0?c.WindCnt=-c.WindCnt:c.WindCnt+=d.WindDelta,d.WindCnt-c.WindDelta===0?d.WindCnt=-d.WindCnt:d.WindCnt-=c.WindDelta;}else this.IsEvenOddFillType(d)?c.WindCnt2=c.WindCnt2===0?1:0:c.WindCnt2+=d.WindDelta,this.IsEvenOddFillType(c)?d.WindCnt2=d.WindCnt2===0?1:0:d.WindCnt2-=c.WindDelta;var vt,At,Mt,Wt;c.PolyTyp===t.PolyType.ptSubject?(vt=this.m_SubjFillType,Mt=this.m_ClipFillType):(vt=this.m_ClipFillType,Mt=this.m_SubjFillType),d.PolyTyp===t.PolyType.ptSubject?(At=this.m_SubjFillType,Wt=this.m_ClipFillType):(At=this.m_ClipFillType,Wt=this.m_SubjFillType);var Zt,Xt;switch(vt){case t.PolyFillType.pftPositive:Zt=c.WindCnt;break;case t.PolyFillType.pftNegative:Zt=-c.WindCnt;break;default:Zt=Math.abs(c.WindCnt);break;}switch(At){case t.PolyFillType.pftPositive:Xt=d.WindCnt;break;case t.PolyFillType.pftNegative:Xt=-d.WindCnt;break;default:Xt=Math.abs(d.WindCnt);break;}if(E&&F)Zt!==0&&Zt!==1||Xt!==0&&Xt!==1||c.PolyTyp!==d.PolyTyp&&this.m_ClipType!==t.ClipType.ctXor?this.AddLocalMaxPoly(c,d,m):(this.AddOutPt(c,m),this.AddOutPt(d,m),t.Clipper.SwapSides(c,d),t.Clipper.SwapPolyIndexes(c,d));else if(E)(Xt===0||Xt===1)&&(this.AddOutPt(c,m),t.Clipper.SwapSides(c,d),t.Clipper.SwapPolyIndexes(c,d));else if(F)(Zt===0||Zt===1)&&(this.AddOutPt(d,m),t.Clipper.SwapSides(c,d),t.Clipper.SwapPolyIndexes(c,d));else if((Zt===0||Zt===1)&&(Xt===0||Xt===1)){var ne,ue;switch(Mt){case t.PolyFillType.pftPositive:ne=c.WindCnt2;break;case t.PolyFillType.pftNegative:ne=-c.WindCnt2;break;default:ne=Math.abs(c.WindCnt2);break;}switch(Wt){case t.PolyFillType.pftPositive:ue=d.WindCnt2;break;case t.PolyFillType.pftNegative:ue=-d.WindCnt2;break;default:ue=Math.abs(d.WindCnt2);break;}if(c.PolyTyp!==d.PolyTyp)this.AddLocalMinPoly(c,d,m);else if(Zt===1&&Xt===1)switch(this.m_ClipType){case t.ClipType.ctIntersection:ne>0&&ue>0&&this.AddLocalMinPoly(c,d,m);break;case t.ClipType.ctUnion:ne<=0&&ue<=0&&this.AddLocalMinPoly(c,d,m);break;case t.ClipType.ctDifference:(c.PolyTyp===t.PolyType.ptClip&&ne>0&&ue>0||c.PolyTyp===t.PolyType.ptSubject&&ne<=0&&ue<=0)&&this.AddLocalMinPoly(c,d,m);break;case t.ClipType.ctXor:this.AddLocalMinPoly(c,d,m);break;}else t.Clipper.SwapSides(c,d);}},t.Clipper.prototype.DeleteFromSEL=function(c){var d=c.PrevInSEL,m=c.NextInSEL;d===null&&m===null&&c!==this.m_SortedEdges||(d!==null?d.NextInSEL=m:this.m_SortedEdges=m,m!==null&&(m.PrevInSEL=d),c.NextInSEL=null,c.PrevInSEL=null);},t.Clipper.prototype.ProcessHorizontals=function(){for(var c={};this.PopEdgeFromSEL(c);)this.ProcessHorizontal(c.v);},t.Clipper.prototype.GetHorzDirection=function(c,d){c.Bot.X<c.Top.X?(d.Left=c.Bot.X,d.Right=c.Top.X,d.Dir=t.Direction.dLeftToRight):(d.Left=c.Top.X,d.Right=c.Bot.X,d.Dir=t.Direction.dRightToLeft);},t.Clipper.prototype.ProcessHorizontal=function(c){var d={Dir:null,Left:null,Right:null};this.GetHorzDirection(c,d);for(var m=d.Dir,E=d.Left,F=d.Right,rt=c.WindDelta===0,vt=c,At=null;vt.NextInLML!==null&&t.ClipperBase.IsHorizontal(vt.NextInLML);)vt=vt.NextInLML;vt.NextInLML===null&&(At=this.GetMaximaPair(vt));var Mt=this.m_Maxima;if(Mt!==null)if(m===t.Direction.dLeftToRight){for(;Mt!==null&&Mt.X<=c.Bot.X;)Mt=Mt.Next;Mt!==null&&Mt.X>=vt.Top.X&&(Mt=null);}else{for(;Mt.Next!==null&&Mt.Next.X<c.Bot.X;)Mt=Mt.Next;Mt.X<=vt.Top.X&&(Mt=null);}for(var Wt=null;;){for(var Zt=c===vt,Xt=this.GetNextInAEL(c,m);Xt!==null;){if(Mt!==null)if(m===t.Direction.dLeftToRight)for(;Mt!==null&&Mt.X<Xt.Curr.X;)c.OutIdx>=0&&!rt&&this.AddOutPt(c,new t.IntPoint2(Mt.X,c.Bot.Y)),Mt=Mt.Next;else for(;Mt!==null&&Mt.X>Xt.Curr.X;)c.OutIdx>=0&&!rt&&this.AddOutPt(c,new t.IntPoint2(Mt.X,c.Bot.Y)),Mt=Mt.Prev;if(m===t.Direction.dLeftToRight&&Xt.Curr.X>F||m===t.Direction.dRightToLeft&&Xt.Curr.X<E||Xt.Curr.X===c.Top.X&&c.NextInLML!==null&&Xt.Dx<c.NextInLML.Dx)break;if(c.OutIdx>=0&&!rt){t.use_xyz&&(m===t.Direction.dLeftToRight?this.SetZ(Xt.Curr,c,Xt):this.SetZ(Xt.Curr,Xt,c)),Wt=this.AddOutPt(c,Xt.Curr);for(var ne=this.m_SortedEdges;ne!==null;){if(ne.OutIdx>=0&&this.HorzSegmentsOverlap(c.Bot.X,c.Top.X,ne.Bot.X,ne.Top.X)){var ue=this.GetLastOutPt(ne);this.AddJoin(ue,Wt,ne.Top);}ne=ne.NextInSEL;}this.AddGhostJoin(Wt,c.Bot);}if(Xt===At&&Zt){c.OutIdx>=0&&this.AddLocalMaxPoly(c,At,c.Top),this.DeleteFromAEL(c),this.DeleteFromAEL(At);return;}if(m===t.Direction.dLeftToRight){var Se=new t.IntPoint2(Xt.Curr.X,c.Curr.Y);this.IntersectEdges(c,Xt,Se);}else{var Se=new t.IntPoint2(Xt.Curr.X,c.Curr.Y);this.IntersectEdges(Xt,c,Se);}var Ie=this.GetNextInAEL(Xt,m);this.SwapPositionsInAEL(c,Xt),Xt=Ie;}if(c.NextInLML===null||!t.ClipperBase.IsHorizontal(c.NextInLML))break;c=this.UpdateEdgeIntoAEL(c),c.OutIdx>=0&&this.AddOutPt(c,c.Bot),d={Dir:m,Left:E,Right:F},this.GetHorzDirection(c,d),m=d.Dir,E=d.Left,F=d.Right;}if(c.OutIdx>=0&&Wt===null){Wt=this.GetLastOutPt(c);for(var ne=this.m_SortedEdges;ne!==null;){if(ne.OutIdx>=0&&this.HorzSegmentsOverlap(c.Bot.X,c.Top.X,ne.Bot.X,ne.Top.X)){var ue=this.GetLastOutPt(ne);this.AddJoin(ue,Wt,ne.Top);}ne=ne.NextInSEL;}this.AddGhostJoin(Wt,c.Top);}if(c.NextInLML!==null){if(c.OutIdx>=0){if(Wt=this.AddOutPt(c,c.Top),c=this.UpdateEdgeIntoAEL(c),c.WindDelta===0)return;var We=c.PrevInAEL,Ie=c.NextInAEL;if(We!==null&&We.Curr.X===c.Bot.X&&We.Curr.Y===c.Bot.Y&&We.WindDelta===0&&We.OutIdx>=0&&We.Curr.Y>We.Top.Y&&t.ClipperBase.SlopesEqual3(c,We,this.m_UseFullRange)){var ue=this.AddOutPt(We,c.Bot);this.AddJoin(Wt,ue,c.Top);}else if(Ie!==null&&Ie.Curr.X===c.Bot.X&&Ie.Curr.Y===c.Bot.Y&&Ie.WindDelta!==0&&Ie.OutIdx>=0&&Ie.Curr.Y>Ie.Top.Y&&t.ClipperBase.SlopesEqual3(c,Ie,this.m_UseFullRange)){var ue=this.AddOutPt(Ie,c.Bot);this.AddJoin(Wt,ue,c.Top);}}else c=this.UpdateEdgeIntoAEL(c);}else c.OutIdx>=0&&this.AddOutPt(c,c.Top),this.DeleteFromAEL(c);},t.Clipper.prototype.GetNextInAEL=function(c,d){return d===t.Direction.dLeftToRight?c.NextInAEL:c.PrevInAEL;},t.Clipper.prototype.IsMinima=function(c){return c!==null&&c.Prev.NextInLML!==c&&c.Next.NextInLML!==c;},t.Clipper.prototype.IsMaxima=function(c,d){return c!==null&&c.Top.Y===d&&c.NextInLML===null;},t.Clipper.prototype.IsIntermediate=function(c,d){return c.Top.Y===d&&c.NextInLML!==null;},t.Clipper.prototype.GetMaximaPair=function(c){return t.IntPoint.op_Equality(c.Next.Top,c.Top)&&c.Next.NextInLML===null?c.Next:t.IntPoint.op_Equality(c.Prev.Top,c.Top)&&c.Prev.NextInLML===null?c.Prev:null;},t.Clipper.prototype.GetMaximaPairEx=function(c){var d=this.GetMaximaPair(c);return d===null||d.OutIdx===t.ClipperBase.Skip||d.NextInAEL===d.PrevInAEL&&!t.ClipperBase.IsHorizontal(d)?null:d;},t.Clipper.prototype.ProcessIntersections=function(c){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(c),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1;}catch(_unused16){this.m_SortedEdges=null,this.m_IntersectList.length=0,t.Error("ProcessIntersections error");}return this.m_SortedEdges=null,!0;},t.Clipper.prototype.BuildIntersectList=function(c){if(this.m_ActiveEdges!==null){var d=this.m_ActiveEdges;for(this.m_SortedEdges=d;d!==null;)d.PrevInSEL=d.PrevInAEL,d.NextInSEL=d.NextInAEL,d.Curr.X=t.Clipper.TopX(d,c),d=d.NextInAEL;for(var m=!0;m&&this.m_SortedEdges!==null;){for(m=!1,d=this.m_SortedEdges;d.NextInSEL!==null;){var E=d.NextInSEL,F=new t.IntPoint0();if(d.Curr.X>E.Curr.X){this.IntersectPoint(d,E,F),F.Y<c&&(F=new t.IntPoint2(t.Clipper.TopX(d,c),c));var rt=new t.IntersectNode();rt.Edge1=d,rt.Edge2=E,rt.Pt.X=F.X,rt.Pt.Y=F.Y,t.use_xyz&&(rt.Pt.Z=F.Z),this.m_IntersectList.push(rt),this.SwapPositionsInSEL(d,E),m=!0;}else d=E;}if(d.PrevInSEL!==null)d.PrevInSEL.NextInSEL=null;else break;}this.m_SortedEdges=null;}},t.Clipper.prototype.EdgesAdjacent=function(c){return c.Edge1.NextInSEL===c.Edge2||c.Edge1.PrevInSEL===c.Edge2;},t.Clipper.IntersectNodeSort=function(c,d){return d.Pt.Y-c.Pt.Y;},t.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var c=this.m_IntersectList.length,d=0;d<c;d++){if(!this.EdgesAdjacent(this.m_IntersectList[d])){for(var m=d+1;m<c&&!this.EdgesAdjacent(this.m_IntersectList[m]);)m++;if(m===c)return!1;var E=this.m_IntersectList[d];this.m_IntersectList[d]=this.m_IntersectList[m],this.m_IntersectList[m]=E;}this.SwapPositionsInSEL(this.m_IntersectList[d].Edge1,this.m_IntersectList[d].Edge2);}return!0;},t.Clipper.prototype.ProcessIntersectList=function(){for(var c=0,d=this.m_IntersectList.length;c<d;c++){var m=this.m_IntersectList[c];this.IntersectEdges(m.Edge1,m.Edge2,m.Pt),this.SwapPositionsInAEL(m.Edge1,m.Edge2);}this.m_IntersectList.length=0;};var na=function na(c){return c<0?Math.ceil(c-0.5):Math.round(c);},Rf=function Rf(c){return c<0?Math.ceil(c-0.5):Math.floor(c+0.5);},Il=function Il(c){return c<0?-Math.round(Math.abs(c)):Math.round(c);},eo=function eo(c){return c<0?(c-=0.5,c<-2147483648?Math.ceil(c):c|0):(c+=0.5,c>2147483647?Math.floor(c):c|0);};s.msie?t.Clipper.Round=na:s.chromium?t.Clipper.Round=Il:s.safari?t.Clipper.Round=eo:t.Clipper.Round=Rf,t.Clipper.TopX=function(c,d){return d===c.Top.Y?c.Top.X:c.Bot.X+t.Clipper.Round(c.Dx*(d-c.Bot.Y));},t.Clipper.prototype.IntersectPoint=function(c,d,m){m.X=0,m.Y=0;var E,F;if(c.Dx===d.Dx){m.Y=c.Curr.Y,m.X=t.Clipper.TopX(c,m.Y);return;}if(c.Delta.X===0)m.X=c.Bot.X,t.ClipperBase.IsHorizontal(d)?m.Y=d.Bot.Y:(F=d.Bot.Y-d.Bot.X/d.Dx,m.Y=t.Clipper.Round(m.X/d.Dx+F));else if(d.Delta.X===0)m.X=d.Bot.X,t.ClipperBase.IsHorizontal(c)?m.Y=c.Bot.Y:(E=c.Bot.Y-c.Bot.X/c.Dx,m.Y=t.Clipper.Round(m.X/c.Dx+E));else{E=c.Bot.X-c.Bot.Y*c.Dx,F=d.Bot.X-d.Bot.Y*d.Dx;var rt=(F-E)/(c.Dx-d.Dx);m.Y=t.Clipper.Round(rt),Math.abs(c.Dx)<Math.abs(d.Dx)?m.X=t.Clipper.Round(c.Dx*rt+E):m.X=t.Clipper.Round(d.Dx*rt+F);}if(m.Y<c.Top.Y||m.Y<d.Top.Y){if(c.Top.Y>d.Top.Y)return m.Y=c.Top.Y,m.X=t.Clipper.TopX(d,c.Top.Y),m.X<c.Top.X;m.Y=d.Top.Y,Math.abs(c.Dx)<Math.abs(d.Dx)?m.X=t.Clipper.TopX(c,m.Y):m.X=t.Clipper.TopX(d,m.Y);}m.Y>c.Curr.Y&&(m.Y=c.Curr.Y,Math.abs(c.Dx)>Math.abs(d.Dx)?m.X=t.Clipper.TopX(d,m.Y):m.X=t.Clipper.TopX(c,m.Y));},t.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(c){for(var d=this.m_ActiveEdges;d!==null;){var m=this.IsMaxima(d,c);if(m){var E=this.GetMaximaPairEx(d);m=E===null||!t.ClipperBase.IsHorizontal(E);}if(m){this.StrictlySimple&&this.InsertMaxima(d.Top.X);var F=d.PrevInAEL;this.DoMaxima(d),F===null?d=this.m_ActiveEdges:d=F.NextInAEL;}else{if(this.IsIntermediate(d,c)&&t.ClipperBase.IsHorizontal(d.NextInLML)?(d=this.UpdateEdgeIntoAEL(d),d.OutIdx>=0&&this.AddOutPt(d,d.Bot),this.AddEdgeToSEL(d)):(d.Curr.X=t.Clipper.TopX(d,c),d.Curr.Y=c),t.use_xyz&&(d.Top.Y===c?d.Curr.Z=d.Top.Z:d.Bot.Y===c?d.Curr.Z=d.Bot.Z:d.Curr.Z=0),this.StrictlySimple){var F=d.PrevInAEL;if(d.OutIdx>=0&&d.WindDelta!==0&&F!==null&&F.OutIdx>=0&&F.Curr.X===d.Curr.X&&F.WindDelta!==0){var rt=new t.IntPoint1(d.Curr);t.use_xyz&&this.SetZ(rt,F,d);var vt=this.AddOutPt(F,rt),At=this.AddOutPt(d,rt);this.AddJoin(vt,At,rt);}}d=d.NextInAEL;}}for(this.ProcessHorizontals(),this.m_Maxima=null,d=this.m_ActiveEdges;d!==null;){if(this.IsIntermediate(d,c)){var vt=null;d.OutIdx>=0&&(vt=this.AddOutPt(d,d.Top)),d=this.UpdateEdgeIntoAEL(d);var F=d.PrevInAEL,Mt=d.NextInAEL;if(F!==null&&F.Curr.X===d.Bot.X&&F.Curr.Y===d.Bot.Y&&vt!==null&&F.OutIdx>=0&&F.Curr.Y===F.Top.Y&&t.ClipperBase.SlopesEqual5(d.Curr,d.Top,F.Curr,F.Top,this.m_UseFullRange)&&d.WindDelta!==0&&F.WindDelta!==0){var At=this.AddOutPt(ePrev2,d.Bot);this.AddJoin(vt,At,d.Top);}else if(Mt!==null&&Mt.Curr.X===d.Bot.X&&Mt.Curr.Y===d.Bot.Y&&vt!==null&&Mt.OutIdx>=0&&Mt.Curr.Y===Mt.Top.Y&&t.ClipperBase.SlopesEqual5(d.Curr,d.Top,Mt.Curr,Mt.Top,this.m_UseFullRange)&&d.WindDelta!==0&&Mt.WindDelta!==0){var At=this.AddOutPt(Mt,d.Bot);this.AddJoin(vt,At,d.Top);}}d=d.NextInAEL;}},t.Clipper.prototype.DoMaxima=function(c){var d=this.GetMaximaPairEx(c);if(d===null){c.OutIdx>=0&&this.AddOutPt(c,c.Top),this.DeleteFromAEL(c);return;}for(var m=c.NextInAEL;m!==null&&m!==d;)this.IntersectEdges(c,m,c.Top),this.SwapPositionsInAEL(c,m),m=c.NextInAEL;c.OutIdx===-1&&d.OutIdx===-1?(this.DeleteFromAEL(c),this.DeleteFromAEL(d)):c.OutIdx>=0&&d.OutIdx>=0?(c.OutIdx>=0&&this.AddLocalMaxPoly(c,d,c.Top),this.DeleteFromAEL(c),this.DeleteFromAEL(d)):t.use_lines&&c.WindDelta===0?(c.OutIdx>=0&&(this.AddOutPt(c,c.Top),c.OutIdx=t.ClipperBase.Unassigned),this.DeleteFromAEL(c),d.OutIdx>=0&&(this.AddOutPt(d,c.Top),d.OutIdx=t.ClipperBase.Unassigned),this.DeleteFromAEL(d)):t.Error("DoMaxima error");},t.Clipper.ReversePaths=function(c){for(var d=0,m=c.length;d<m;d++)c[d].reverse();},t.Clipper.Orientation=function(c){return t.Clipper.Area(c)>=0;},t.Clipper.prototype.PointCount=function(c){if(c===null)return 0;var d=0,m=c;do d++,m=m.Next;while(m!==c);return d;},t.Clipper.prototype.BuildResult=function(c){t.Clear(c);for(var d=0,m=this.m_PolyOuts.length;d<m;d++){var E=this.m_PolyOuts[d];if(E.Pts!==null){var F=E.Pts.Prev,rt=this.PointCount(F);if(!(rt<2)){for(var vt=new Array(rt),At=0;At<rt;At++)vt[At]=F.Pt,F=F.Prev;c.push(vt);}}}},t.Clipper.prototype.BuildResult2=function(c){c.Clear();for(var d=0,m=this.m_PolyOuts.length;d<m;d++){var E=this.m_PolyOuts[d],F=this.PointCount(E.Pts);if(!(E.IsOpen&&F<2||!E.IsOpen&&F<3)){this.FixHoleLinkage(E);var rt=new t.PolyNode();c.m_AllPolys.push(rt),E.PolyNode=rt,rt.m_polygon.length=F;for(var vt=E.Pts.Prev,At=0;At<F;At++)rt.m_polygon[At]=vt.Pt,vt=vt.Prev;}}for(var d=0,m=this.m_PolyOuts.length;d<m;d++){var E=this.m_PolyOuts[d];E.PolyNode!==null&&(E.IsOpen?(E.PolyNode.IsOpen=!0,c.AddChild(E.PolyNode)):E.FirstLeft!==null&&E.FirstLeft.PolyNode!==null?E.FirstLeft.PolyNode.AddChild(E.PolyNode):c.AddChild(E.PolyNode));}},t.Clipper.prototype.FixupOutPolyline=function(c){for(var d=c.Pts,m=d.Prev;d!==m;)if(d=d.Next,t.IntPoint.op_Equality(d.Pt,d.Prev.Pt)){d===m&&(m=d.Prev);var E=d.Prev;E.Next=d.Next,d.Next.Prev=E,d=E;}d===d.Prev&&(c.Pts=null);},t.Clipper.prototype.FixupOutPolygon=function(c){var d=null;c.BottomPt=null;for(var m=c.Pts,E=this.PreserveCollinear||this.StrictlySimple;;){if(m.Prev===m||m.Prev===m.Next){c.Pts=null;return;}if(t.IntPoint.op_Equality(m.Pt,m.Next.Pt)||t.IntPoint.op_Equality(m.Pt,m.Prev.Pt)||t.ClipperBase.SlopesEqual4(m.Prev.Pt,m.Pt,m.Next.Pt,this.m_UseFullRange)&&(!E||!this.Pt2IsBetweenPt1AndPt3(m.Prev.Pt,m.Pt,m.Next.Pt)))d=null,m.Prev.Next=m.Next,m.Next.Prev=m.Prev,m=m.Prev;else{if(m===d)break;d===null&&(d=m),m=m.Next;}}c.Pts=m;},t.Clipper.prototype.DupOutPt=function(c,d){var m=new t.OutPt();return m.Pt.X=c.Pt.X,m.Pt.Y=c.Pt.Y,t.use_xyz&&(m.Pt.Z=c.Pt.Z),m.Idx=c.Idx,d?(m.Next=c.Next,m.Prev=c,c.Next.Prev=m,c.Next=m):(m.Prev=c.Prev,m.Next=c,c.Prev.Next=m,c.Prev=m),m;},t.Clipper.prototype.GetOverlap=function(c,d,m,E,F){return c<d?m<E?(F.Left=Math.max(c,m),F.Right=Math.min(d,E)):(F.Left=Math.max(c,E),F.Right=Math.min(d,m)):m<E?(F.Left=Math.max(d,m),F.Right=Math.min(c,E)):(F.Left=Math.max(d,E),F.Right=Math.min(c,m)),F.Left<F.Right;},t.Clipper.prototype.JoinHorz=function(c,d,m,E,F,rt){var vt=c.Pt.X>d.Pt.X?t.Direction.dRightToLeft:t.Direction.dLeftToRight,At=m.Pt.X>E.Pt.X?t.Direction.dRightToLeft:t.Direction.dLeftToRight;if(vt===At)return!1;if(vt===t.Direction.dLeftToRight){for(;c.Next.Pt.X<=F.X&&c.Next.Pt.X>=c.Pt.X&&c.Next.Pt.Y===F.Y;)c=c.Next;rt&&c.Pt.X!==F.X&&(c=c.Next),d=this.DupOutPt(c,!rt),t.IntPoint.op_Inequality(d.Pt,F)&&(c=d,c.Pt.X=F.X,c.Pt.Y=F.Y,t.use_xyz&&(c.Pt.Z=F.Z),d=this.DupOutPt(c,!rt));}else{for(;c.Next.Pt.X>=F.X&&c.Next.Pt.X<=c.Pt.X&&c.Next.Pt.Y===F.Y;)c=c.Next;!rt&&c.Pt.X!==F.X&&(c=c.Next),d=this.DupOutPt(c,rt),t.IntPoint.op_Inequality(d.Pt,F)&&(c=d,c.Pt.X=F.X,c.Pt.Y=F.Y,t.use_xyz&&(c.Pt.Z=F.Z),d=this.DupOutPt(c,rt));}if(At===t.Direction.dLeftToRight){for(;m.Next.Pt.X<=F.X&&m.Next.Pt.X>=m.Pt.X&&m.Next.Pt.Y===F.Y;)m=m.Next;rt&&m.Pt.X!==F.X&&(m=m.Next),E=this.DupOutPt(m,!rt),t.IntPoint.op_Inequality(E.Pt,F)&&(m=E,m.Pt.X=F.X,m.Pt.Y=F.Y,t.use_xyz&&(m.Pt.Z=F.Z),E=this.DupOutPt(m,!rt));}else{for(;m.Next.Pt.X>=F.X&&m.Next.Pt.X<=m.Pt.X&&m.Next.Pt.Y===F.Y;)m=m.Next;!rt&&m.Pt.X!==F.X&&(m=m.Next),E=this.DupOutPt(m,rt),t.IntPoint.op_Inequality(E.Pt,F)&&(m=E,m.Pt.X=F.X,m.Pt.Y=F.Y,t.use_xyz&&(m.Pt.Z=F.Z),E=this.DupOutPt(m,rt));}return vt===t.Direction.dLeftToRight===rt?(c.Prev=m,m.Next=c,d.Next=E,E.Prev=d):(c.Next=m,m.Prev=c,d.Prev=E,E.Next=d),!0;},t.Clipper.prototype.JoinPoints=function(c,d,m){var E=c.OutPt1,F=new t.OutPt(),rt=c.OutPt2,vt=new t.OutPt(),At=c.OutPt1.Pt.Y===c.OffPt.Y;if(At&&t.IntPoint.op_Equality(c.OffPt,c.OutPt1.Pt)&&t.IntPoint.op_Equality(c.OffPt,c.OutPt2.Pt)){if(d!==m)return!1;for(F=c.OutPt1.Next;F!==E&&t.IntPoint.op_Equality(F.Pt,c.OffPt);)F=F.Next;var Mt=F.Pt.Y>c.OffPt.Y;for(vt=c.OutPt2.Next;vt!==rt&&t.IntPoint.op_Equality(vt.Pt,c.OffPt);)vt=vt.Next;var Wt=vt.Pt.Y>c.OffPt.Y;return Mt===Wt?!1:Mt?(F=this.DupOutPt(E,!1),vt=this.DupOutPt(rt,!0),E.Prev=rt,rt.Next=E,F.Next=vt,vt.Prev=F,c.OutPt1=E,c.OutPt2=F,!0):(F=this.DupOutPt(E,!0),vt=this.DupOutPt(rt,!1),E.Next=rt,rt.Prev=E,F.Prev=vt,vt.Next=F,c.OutPt1=E,c.OutPt2=F,!0);}else if(At){for(F=E;E.Prev.Pt.Y===E.Pt.Y&&E.Prev!==F&&E.Prev!==rt;)E=E.Prev;for(;F.Next.Pt.Y===F.Pt.Y&&F.Next!==E&&F.Next!==rt;)F=F.Next;if(F.Next===E||F.Next===rt)return!1;for(vt=rt;rt.Prev.Pt.Y===rt.Pt.Y&&rt.Prev!==vt&&rt.Prev!==F;)rt=rt.Prev;for(;vt.Next.Pt.Y===vt.Pt.Y&&vt.Next!==rt&&vt.Next!==E;)vt=vt.Next;if(vt.Next===rt||vt.Next===E)return!1;var Zt={Left:null,Right:null};if(!this.GetOverlap(E.Pt.X,F.Pt.X,rt.Pt.X,vt.Pt.X,Zt))return!1;var Xt=Zt.Left,ne=Zt.Right,ue=new t.IntPoint0(),Se;return E.Pt.X>=Xt&&E.Pt.X<=ne?(ue.X=E.Pt.X,ue.Y=E.Pt.Y,t.use_xyz&&(ue.Z=E.Pt.Z),Se=E.Pt.X>F.Pt.X):rt.Pt.X>=Xt&&rt.Pt.X<=ne?(ue.X=rt.Pt.X,ue.Y=rt.Pt.Y,t.use_xyz&&(ue.Z=rt.Pt.Z),Se=rt.Pt.X>vt.Pt.X):F.Pt.X>=Xt&&F.Pt.X<=ne?(ue.X=F.Pt.X,ue.Y=F.Pt.Y,t.use_xyz&&(ue.Z=F.Pt.Z),Se=F.Pt.X>E.Pt.X):(ue.X=vt.Pt.X,ue.Y=vt.Pt.Y,t.use_xyz&&(ue.Z=vt.Pt.Z),Se=vt.Pt.X>rt.Pt.X),c.OutPt1=E,c.OutPt2=rt,this.JoinHorz(E,F,rt,vt,ue,Se);}else{for(F=E.Next;t.IntPoint.op_Equality(F.Pt,E.Pt)&&F!==E;)F=F.Next;var Ie=F.Pt.Y>E.Pt.Y||!t.ClipperBase.SlopesEqual4(E.Pt,F.Pt,c.OffPt,this.m_UseFullRange);if(Ie){for(F=E.Prev;t.IntPoint.op_Equality(F.Pt,E.Pt)&&F!==E;)F=F.Prev;if(F.Pt.Y>E.Pt.Y||!t.ClipperBase.SlopesEqual4(E.Pt,F.Pt,c.OffPt,this.m_UseFullRange))return!1;}for(vt=rt.Next;t.IntPoint.op_Equality(vt.Pt,rt.Pt)&&vt!==rt;)vt=vt.Next;var We=vt.Pt.Y>rt.Pt.Y||!t.ClipperBase.SlopesEqual4(rt.Pt,vt.Pt,c.OffPt,this.m_UseFullRange);if(We){for(vt=rt.Prev;t.IntPoint.op_Equality(vt.Pt,rt.Pt)&&vt!==rt;)vt=vt.Prev;if(vt.Pt.Y>rt.Pt.Y||!t.ClipperBase.SlopesEqual4(rt.Pt,vt.Pt,c.OffPt,this.m_UseFullRange))return!1;}return F===E||vt===rt||F===vt||d===m&&Ie===We?!1:Ie?(F=this.DupOutPt(E,!1),vt=this.DupOutPt(rt,!0),E.Prev=rt,rt.Next=E,F.Next=vt,vt.Prev=F,c.OutPt1=E,c.OutPt2=F,!0):(F=this.DupOutPt(E,!0),vt=this.DupOutPt(rt,!1),E.Next=rt,rt.Prev=E,F.Prev=vt,vt.Next=F,c.OutPt1=E,c.OutPt2=F,!0);}},t.Clipper.GetBounds=function(c){for(var d=0,m=c.length;d<m&&c[d].length===0;)d++;if(d===m)return new t.IntRect(0,0,0,0);var E=new t.IntRect();for(E.left=c[d][0].X,E.right=E.left,E.top=c[d][0].Y,E.bottom=E.top;d<m;d++)for(var F=0,rt=c[d].length;F<rt;F++)c[d][F].X<E.left?E.left=c[d][F].X:c[d][F].X>E.right&&(E.right=c[d][F].X),c[d][F].Y<E.top?E.top=c[d][F].Y:c[d][F].Y>E.bottom&&(E.bottom=c[d][F].Y);return E;},t.Clipper.prototype.GetBounds2=function(c){var d=c,m=new t.IntRect();for(m.left=c.Pt.X,m.right=c.Pt.X,m.top=c.Pt.Y,m.bottom=c.Pt.Y,c=c.Next;c!==d;)c.Pt.X<m.left&&(m.left=c.Pt.X),c.Pt.X>m.right&&(m.right=c.Pt.X),c.Pt.Y<m.top&&(m.top=c.Pt.Y),c.Pt.Y>m.bottom&&(m.bottom=c.Pt.Y),c=c.Next;return m;},t.Clipper.PointInPolygon=function(c,d){var m=0,E=d.length;if(E<3)return 0;for(var F=d[0],rt=1;rt<=E;++rt){var vt=rt===E?d[0]:d[rt];if(vt.Y===c.Y&&(vt.X===c.X||F.Y===c.Y&&vt.X>c.X==F.X<c.X))return-1;if(F.Y<c.Y!=vt.Y<c.Y){if(F.X>=c.X){if(vt.X>c.X)m=1-m;else{var At=(F.X-c.X)*(vt.Y-c.Y)-(vt.X-c.X)*(F.Y-c.Y);if(At===0)return-1;At>0==vt.Y>F.Y&&(m=1-m);}}else if(vt.X>c.X){var At=(F.X-c.X)*(vt.Y-c.Y)-(vt.X-c.X)*(F.Y-c.Y);if(At===0)return-1;At>0==vt.Y>F.Y&&(m=1-m);}}F=vt;}return m;},t.Clipper.prototype.PointInPolygon=function(c,d){var m=0,E=d,F=c.X,rt=c.Y,vt=d.Pt.X,At=d.Pt.Y;do{d=d.Next;var Mt=d.Pt.X,Wt=d.Pt.Y;if(Wt===rt&&(Mt===F||At===rt&&Mt>F==vt<F))return-1;if(At<rt!=Wt<rt){if(vt>=F){if(Mt>F)m=1-m;else{var Zt=(vt-F)*(Wt-rt)-(Mt-F)*(At-rt);if(Zt===0)return-1;Zt>0==Wt>At&&(m=1-m);}}else if(Mt>F){var Zt=(vt-F)*(Wt-rt)-(Mt-F)*(At-rt);if(Zt===0)return-1;Zt>0==Wt>At&&(m=1-m);}}vt=Mt,At=Wt;}while(E!==d);return m;},t.Clipper.prototype.Poly2ContainsPoly1=function(c,d){var m=c;do{var E=this.PointInPolygon(m.Pt,d);if(E>=0)return E>0;m=m.Next;}while(m!==c);return!0;},t.Clipper.prototype.FixupFirstLefts1=function(c,d){for(var m,E,F=0,rt=this.m_PolyOuts.length;F<rt;F++)m=this.m_PolyOuts[F],E=t.Clipper.ParseFirstLeft(m.FirstLeft),m.Pts!==null&&E===c&&this.Poly2ContainsPoly1(m.Pts,d.Pts)&&(m.FirstLeft=d);},t.Clipper.prototype.FixupFirstLefts2=function(c,d){for(var m=d.FirstLeft,E,F,rt=0,vt=this.m_PolyOuts.length;rt<vt;rt++)E=this.m_PolyOuts[rt],!(E.Pts===null||E===d||E===c)&&(F=t.Clipper.ParseFirstLeft(E.FirstLeft),!(F!==m&&F!==c&&F!==d)&&(this.Poly2ContainsPoly1(E.Pts,c.Pts)?E.FirstLeft=c:this.Poly2ContainsPoly1(E.Pts,d.Pts)?E.FirstLeft=d:(E.FirstLeft===c||E.FirstLeft===d)&&(E.FirstLeft=m)));},t.Clipper.prototype.FixupFirstLefts3=function(c,d){for(var m,E,F=0,rt=this.m_PolyOuts.length;F<rt;F++)m=this.m_PolyOuts[F],E=t.Clipper.ParseFirstLeft(m.FirstLeft),m.Pts!==null&&E===c&&(m.FirstLeft=d);},t.Clipper.ParseFirstLeft=function(c){for(;c!==null&&c.Pts===null;)c=c.FirstLeft;return c;},t.Clipper.prototype.JoinCommonEdges=function(){for(var c=0,d=this.m_Joins.length;c<d;c++){var m=this.m_Joins[c],E=this.GetOutRec(m.OutPt1.Idx),F=this.GetOutRec(m.OutPt2.Idx);if(!(E.Pts===null||F.Pts===null)&&!(E.IsOpen||F.IsOpen)){var rt;E===F?rt=E:this.OutRec1RightOfOutRec2(E,F)?rt=F:this.OutRec1RightOfOutRec2(F,E)?rt=E:rt=this.GetLowermostRec(E,F),this.JoinPoints(m,E,F)&&(E===F?(E.Pts=m.OutPt1,E.BottomPt=null,F=this.CreateOutRec(),F.Pts=m.OutPt2,this.UpdateOutPtIdxs(F),this.Poly2ContainsPoly1(F.Pts,E.Pts)?(F.IsHole=!E.IsHole,F.FirstLeft=E,this.m_UsingPolyTree&&this.FixupFirstLefts2(F,E),(F.IsHole^this.ReverseSolution)==this.Area$1(F)>0&&this.ReversePolyPtLinks(F.Pts)):this.Poly2ContainsPoly1(E.Pts,F.Pts)?(F.IsHole=E.IsHole,E.IsHole=!F.IsHole,F.FirstLeft=E.FirstLeft,E.FirstLeft=F,this.m_UsingPolyTree&&this.FixupFirstLefts2(E,F),(E.IsHole^this.ReverseSolution)==this.Area$1(E)>0&&this.ReversePolyPtLinks(E.Pts)):(F.IsHole=E.IsHole,F.FirstLeft=E.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(E,F))):(F.Pts=null,F.BottomPt=null,F.Idx=E.Idx,E.IsHole=rt.IsHole,rt===F&&(E.FirstLeft=F.FirstLeft),F.FirstLeft=E,this.m_UsingPolyTree&&this.FixupFirstLefts3(F,E)));}}},t.Clipper.prototype.UpdateOutPtIdxs=function(c){var d=c.Pts;do d.Idx=c.Idx,d=d.Prev;while(d!==c.Pts);},t.Clipper.prototype.DoSimplePolygons=function(){for(var c=0;c<this.m_PolyOuts.length;){var d=this.m_PolyOuts[c++],m=d.Pts;if(!(m===null||d.IsOpen))do{for(var E=m.Next;E!==d.Pts;){if(t.IntPoint.op_Equality(m.Pt,E.Pt)&&E.Next!==m&&E.Prev!==m){var F=m.Prev,rt=E.Prev;m.Prev=rt,rt.Next=m,E.Prev=F,F.Next=E,d.Pts=m;var vt=this.CreateOutRec();vt.Pts=E,this.UpdateOutPtIdxs(vt),this.Poly2ContainsPoly1(vt.Pts,d.Pts)?(vt.IsHole=!d.IsHole,vt.FirstLeft=d,this.m_UsingPolyTree&&this.FixupFirstLefts2(vt,d)):this.Poly2ContainsPoly1(d.Pts,vt.Pts)?(vt.IsHole=d.IsHole,d.IsHole=!vt.IsHole,vt.FirstLeft=d.FirstLeft,d.FirstLeft=vt,this.m_UsingPolyTree&&this.FixupFirstLefts2(d,vt)):(vt.IsHole=d.IsHole,vt.FirstLeft=d.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(d,vt)),E=m;}E=E.Next;}m=m.Next;}while(m!==d.Pts);}},t.Clipper.Area=function(c){if(!Array.isArray(c))return 0;var d=c.length;if(d<3)return 0;for(var m=0,E=0,F=d-1;E<d;++E)m+=(c[F].X+c[E].X)*(c[F].Y-c[E].Y),F=E;return-m*0.5;},t.Clipper.prototype.Area=function(c){var d=c;if(c===null)return 0;var m=0;do m=m+(c.Prev.Pt.X+c.Pt.X)*(c.Prev.Pt.Y-c.Pt.Y),c=c.Next;while(c!==d);return m*0.5;},t.Clipper.prototype.Area$1=function(c){return this.Area(c.Pts);},t.Clipper.SimplifyPolygon=function(c,d){var m=new Array(),E=new t.Clipper(0);return E.StrictlySimple=!0,E.AddPath(c,t.PolyType.ptSubject,!0),E.Execute(t.ClipType.ctUnion,m,d,d),m;},t.Clipper.SimplifyPolygons=function(c,d){_typeof(d)>"u"&&(d=t.PolyFillType.pftEvenOdd);var m=new Array(),E=new t.Clipper(0);return E.StrictlySimple=!0,E.AddPaths(c,t.PolyType.ptSubject,!0),E.Execute(t.ClipType.ctUnion,m,d,d),m;},t.Clipper.DistanceSqrd=function(c,d){var m=c.X-d.X,E=c.Y-d.Y;return m*m+E*E;},t.Clipper.DistanceFromLineSqrd=function(c,d,m){var E=d.Y-m.Y,F=m.X-d.X,rt=E*d.X+F*d.Y;return rt=E*c.X+F*c.Y-rt,rt*rt/(E*E+F*F);},t.Clipper.SlopesNearCollinear=function(c,d,m,E){return Math.abs(c.X-d.X)>Math.abs(c.Y-d.Y)?c.X>d.X==c.X<m.X?t.Clipper.DistanceFromLineSqrd(c,d,m)<E:d.X>c.X==d.X<m.X?t.Clipper.DistanceFromLineSqrd(d,c,m)<E:t.Clipper.DistanceFromLineSqrd(m,c,d)<E:c.Y>d.Y==c.Y<m.Y?t.Clipper.DistanceFromLineSqrd(c,d,m)<E:d.Y>c.Y==d.Y<m.Y?t.Clipper.DistanceFromLineSqrd(d,c,m)<E:t.Clipper.DistanceFromLineSqrd(m,c,d)<E;},t.Clipper.PointsAreClose=function(c,d,m){var E=c.X-d.X,F=c.Y-d.Y;return E*E+F*F<=m;},t.Clipper.ExcludeOp=function(c){var d=c.Prev;return d.Next=c.Next,c.Next.Prev=d,d.Idx=0,d;},t.Clipper.CleanPolygon=function(c,d){_typeof(d)>"u"&&(d=1.415);var m=c.length;if(m===0)return new Array();for(var E=new Array(m),F=0;F<m;++F)E[F]=new t.OutPt();for(var F=0;F<m;++F)E[F].Pt=c[F],E[F].Next=E[(F+1)%m],E[F].Next.Prev=E[F],E[F].Idx=0;for(var rt=d*d,vt=E[0];vt.Idx===0&&vt.Next!==vt.Prev;)t.Clipper.PointsAreClose(vt.Pt,vt.Prev.Pt,rt)?(vt=t.Clipper.ExcludeOp(vt),m--):t.Clipper.PointsAreClose(vt.Prev.Pt,vt.Next.Pt,rt)?(t.Clipper.ExcludeOp(vt.Next),vt=t.Clipper.ExcludeOp(vt),m-=2):t.Clipper.SlopesNearCollinear(vt.Prev.Pt,vt.Pt,vt.Next.Pt,rt)?(vt=t.Clipper.ExcludeOp(vt),m--):(vt.Idx=1,vt=vt.Next);m<3&&(m=0);for(var At=new Array(m),F=0;F<m;++F)At[F]=new t.IntPoint1(vt.Pt),vt=vt.Next;return E=null,At;},t.Clipper.CleanPolygons=function(c,d){for(var m=new Array(c.length),E=0,F=c.length;E<F;E++)m[E]=t.Clipper.CleanPolygon(c[E],d);return m;},t.Clipper.Minkowski=function(c,d,m,E){var F=E?1:0,rt=c.length,vt=d.length,At=new Array();if(m)for(var Mt=0;Mt<vt;Mt++){for(var Wt=new Array(rt),Zt=0,Xt=c.length,ne=c[Zt];Zt<Xt;Zt++,ne=c[Zt])Wt[Zt]=new t.IntPoint2(d[Mt].X+ne.X,d[Mt].Y+ne.Y);At.push(Wt);}else for(var Mt=0;Mt<vt;Mt++){for(var Wt=new Array(rt),Zt=0,Xt=c.length,ne=c[Zt];Zt<Xt;Zt++,ne=c[Zt])Wt[Zt]=new t.IntPoint2(d[Mt].X-ne.X,d[Mt].Y-ne.Y);At.push(Wt);}for(var ue=new Array(),Mt=0;Mt<vt-1+F;Mt++)for(var Zt=0;Zt<rt;Zt++){var Se=new Array();Se.push(At[Mt%vt][Zt%rt]),Se.push(At[(Mt+1)%vt][Zt%rt]),Se.push(At[(Mt+1)%vt][(Zt+1)%rt]),Se.push(At[Mt%vt][(Zt+1)%rt]),t.Clipper.Orientation(Se)||Se.reverse(),ue.push(Se);}return ue;},t.Clipper.MinkowskiSum=function(c,d,m){if(d[0]instanceof Array){for(var F=d,vt=new t.Paths(),rt=new t.Clipper(),At=0;At<F.length;++At){var Mt=t.Clipper.Minkowski(c,F[At],!0,m);if(rt.AddPaths(Mt,t.PolyType.ptSubject,!0),m){var E=t.Clipper.TranslatePath(F[At],c[0]);rt.AddPath(E,t.PolyType.ptClip,!0);}}return rt.Execute(t.ClipType.ctUnion,vt,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),vt;}else{var E=d,F=t.Clipper.Minkowski(c,E,!0,m),rt=new t.Clipper();return rt.AddPaths(F,t.PolyType.ptSubject,!0),rt.Execute(t.ClipType.ctUnion,F,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),F;}},t.Clipper.TranslatePath=function(c,d){for(var m=new t.Path(),E=0;E<c.length;E++)m.push(new t.IntPoint2(c[E].X+d.X,c[E].Y+d.Y));return m;},t.Clipper.MinkowskiDiff=function(c,d){var m=t.Clipper.Minkowski(c,d,!1,!0),E=new t.Clipper();return E.AddPaths(m,t.PolyType.ptSubject,!0),E.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftNonZero,t.PolyFillType.pftNonZero),m;},t.Clipper.PolyTreeToPaths=function(c){var d=new Array();return t.Clipper.AddPolyNodeToPaths(c,t.Clipper.NodeType.ntAny,d),d;},t.Clipper.AddPolyNodeToPaths=function(c,d,m){var E=!0;switch(d){case t.Clipper.NodeType.ntOpen:return;case t.Clipper.NodeType.ntClosed:E=!c.IsOpen;break;}c.m_polygon.length>0&&E&&m.push(c.m_polygon);for(var F=0,rt=c.Childs(),vt=rt.length,At=rt[F];F<vt;F++,At=rt[F])t.Clipper.AddPolyNodeToPaths(At,d,m);},t.Clipper.OpenPathsFromPolyTree=function(c){for(var d=new t.Paths(),m=0,E=c.ChildCount();m<E;m++)c.Childs()[m].IsOpen&&d.push(c.Childs()[m].m_polygon);return d;},t.Clipper.ClosedPathsFromPolyTree=function(c){var d=new t.Paths();return t.Clipper.AddPolyNodeToPaths(c,t.Clipper.NodeType.ntClosed,d),d;},ra(t.Clipper,t.ClipperBase),t.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},t.ClipperOffset=function(c,d){_typeof(c)>"u"&&(c=2),_typeof(d)>"u"&&(d=t.ClipperOffset.def_arc_tolerance),this.m_destPolys=new t.Paths(),this.m_srcPoly=new t.Path(),this.m_destPoly=new t.Path(),this.m_normals=new Array(),this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new t.IntPoint0(),this.m_polyNodes=new t.PolyNode(),this.MiterLimit=c,this.ArcTolerance=d,this.m_lowest.X=-1;},t.ClipperOffset.two_pi=6.28318530717959,t.ClipperOffset.def_arc_tolerance=0.25,t.ClipperOffset.prototype.Clear=function(){t.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1;},t.ClipperOffset.Round=t.Clipper.Round,t.ClipperOffset.prototype.AddPath=function(c,d,m){var E=c.length-1;if(!(E<0)){var F=new t.PolyNode();if(F.m_jointype=d,F.m_endtype=m,m===t.EndType.etClosedLine||m===t.EndType.etClosedPolygon)for(;E>0&&t.IntPoint.op_Equality(c[0],c[E]);)E--;F.m_polygon.push(c[0]);for(var rt=0,vt=0,At=1;At<=E;At++)t.IntPoint.op_Inequality(F.m_polygon[rt],c[At])&&(rt++,F.m_polygon.push(c[At]),(c[At].Y>F.m_polygon[vt].Y||c[At].Y===F.m_polygon[vt].Y&&c[At].X<F.m_polygon[vt].X)&&(vt=rt));if(!(m===t.EndType.etClosedPolygon&&rt<2)&&(this.m_polyNodes.AddChild(F),m===t.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new t.IntPoint2(this.m_polyNodes.ChildCount()-1,vt);else{var Mt=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(F.m_polygon[vt].Y>Mt.Y||F.m_polygon[vt].Y===Mt.Y&&F.m_polygon[vt].X<Mt.X)&&(this.m_lowest=new t.IntPoint2(this.m_polyNodes.ChildCount()-1,vt));}}},t.ClipperOffset.prototype.AddPaths=function(c,d,m){for(var E=0,F=c.length;E<F;E++)this.AddPath(c[E],d,m);},t.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!t.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var c=0;c<this.m_polyNodes.ChildCount();c++){var d=this.m_polyNodes.Childs()[c];(d.m_endtype===t.EndType.etClosedPolygon||d.m_endtype===t.EndType.etClosedLine&&t.Clipper.Orientation(d.m_polygon))&&d.m_polygon.reverse();}else for(var c=0;c<this.m_polyNodes.ChildCount();c++){var d=this.m_polyNodes.Childs()[c];d.m_endtype===t.EndType.etClosedLine&&!t.Clipper.Orientation(d.m_polygon)&&d.m_polygon.reverse();}},t.ClipperOffset.GetUnitNormal=function(c,d){var m=d.X-c.X,E=d.Y-c.Y;if(m===0&&E===0)return new t.DoublePoint2(0,0);var F=1/Math.sqrt(m*m+E*E);return m*=F,E*=F,new t.DoublePoint2(E,-m);},t.ClipperOffset.prototype.DoOffset=function(c){if(this.m_destPolys=new Array(),this.m_delta=c,t.ClipperBase.near_zero(c)){for(var d=0;d<this.m_polyNodes.ChildCount();d++){var m=this.m_polyNodes.Childs()[d];m.m_endtype===t.EndType.etClosedPolygon&&this.m_destPolys.push(m.m_polygon);}return;}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=0.5;var E;this.ArcTolerance<=0?E=t.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(c)*t.ClipperOffset.def_arc_tolerance?E=Math.abs(c)*t.ClipperOffset.def_arc_tolerance:E=this.ArcTolerance;var F=3.14159265358979/Math.acos(1-E/Math.abs(c));this.m_sin=Math.sin(t.ClipperOffset.two_pi/F),this.m_cos=Math.cos(t.ClipperOffset.two_pi/F),this.m_StepsPerRad=F/t.ClipperOffset.two_pi,c<0&&(this.m_sin=-this.m_sin);for(var d=0;d<this.m_polyNodes.ChildCount();d++){var m=this.m_polyNodes.Childs()[d];this.m_srcPoly=m.m_polygon;var rt=this.m_srcPoly.length;if(!(rt===0||c<=0&&(rt<3||m.m_endtype!==t.EndType.etClosedPolygon))){if(this.m_destPoly=new Array(),rt===1){if(m.m_jointype===t.JoinType.jtRound)for(var vt=1,At=0,Mt=1;Mt<=F;Mt++){this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+vt*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y+At*c)));var Wt=vt;vt=vt*this.m_cos-this.m_sin*At,At=Wt*this.m_sin+At*this.m_cos;}else for(var vt=-1,At=-1,Mt=0;Mt<4;++Mt)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+vt*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y+At*c))),vt<0?vt=1:At<0?At=1:vt=-1;this.m_destPolys.push(this.m_destPoly);continue;}this.m_normals.length=0;for(var Mt=0;Mt<rt-1;Mt++)this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[Mt],this.m_srcPoly[Mt+1]));if(m.m_endtype===t.EndType.etClosedLine||m.m_endtype===t.EndType.etClosedPolygon?this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[rt-1],this.m_srcPoly[0])):this.m_normals.push(new t.DoublePoint1(this.m_normals[rt-2])),m.m_endtype===t.EndType.etClosedPolygon){for(var Zt=rt-1,Mt=0;Mt<rt;Mt++)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);this.m_destPolys.push(this.m_destPoly);}else if(m.m_endtype===t.EndType.etClosedLine){for(var Zt=rt-1,Mt=0;Mt<rt;Mt++)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array();for(var Xt=this.m_normals[rt-1],Mt=rt-1;Mt>0;Mt--)this.m_normals[Mt]=new t.DoublePoint2(-this.m_normals[Mt-1].X,-this.m_normals[Mt-1].Y);this.m_normals[0]=new t.DoublePoint2(-Xt.X,-Xt.Y),Zt=0;for(var Mt=rt-1;Mt>=0;Mt--)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);this.m_destPolys.push(this.m_destPoly);}else{for(var Zt=0,Mt=1;Mt<rt-1;++Mt)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);var ne;if(m.m_endtype===t.EndType.etOpenButt){var Mt=rt-1;ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[Mt].X+this.m_normals[Mt].X*c),t.ClipperOffset.Round(this.m_srcPoly[Mt].Y+this.m_normals[Mt].Y*c)),this.m_destPoly.push(ne),ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[Mt].X-this.m_normals[Mt].X*c),t.ClipperOffset.Round(this.m_srcPoly[Mt].Y-this.m_normals[Mt].Y*c)),this.m_destPoly.push(ne);}else{var Mt=rt-1;Zt=rt-2,this.m_sinA=0,this.m_normals[Mt]=new t.DoublePoint2(-this.m_normals[Mt].X,-this.m_normals[Mt].Y),m.m_endtype===t.EndType.etOpenSquare?this.DoSquare(Mt,Zt):this.DoRound(Mt,Zt);}for(var Mt=rt-1;Mt>0;Mt--)this.m_normals[Mt]=new t.DoublePoint2(-this.m_normals[Mt-1].X,-this.m_normals[Mt-1].Y);this.m_normals[0]=new t.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),Zt=rt-1;for(var Mt=Zt-1;Mt>0;--Mt)Zt=this.OffsetPoint(Mt,Zt,m.m_jointype);m.m_endtype===t.EndType.etOpenButt?(ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*c)),this.m_destPoly.push(ne),ne=new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*c),t.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*c)),this.m_destPoly.push(ne)):(Zt=1,this.m_sinA=0,m.m_endtype===t.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly);}}}},t.ClipperOffset.prototype.Execute=function(){var c=arguments,d=c[0]instanceof t.PolyTree;if(d){var m=c[0],E=c[1];m.Clear(),this.FixOrientations(),this.DoOffset(E);var F=new t.Clipper(0);if(F.AddPaths(this.m_destPolys,t.PolyType.ptSubject,!0),E>0)F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftPositive,t.PolyFillType.pftPositive);else{var rt=t.Clipper.GetBounds(this.m_destPolys),vt=new t.Path();if(vt.push(new t.IntPoint2(rt.left-10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.top-10)),vt.push(new t.IntPoint2(rt.left-10,rt.top-10)),F.AddPath(vt,t.PolyType.ptSubject,!0),F.ReverseSolution=!0,F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftNegative,t.PolyFillType.pftNegative),m.ChildCount()===1&&m.Childs()[0].ChildCount()>0){var At=m.Childs()[0];m.Childs()[0]=At.Childs()[0],m.Childs()[0].m_Parent=m;for(var Mt=1;Mt<At.ChildCount();Mt++)m.AddChild(At.Childs()[Mt]);}else m.Clear();}}else{var m=c[0],E=c[1];t.Clear(m),this.FixOrientations(),this.DoOffset(E);var F=new t.Clipper(0);if(F.AddPaths(this.m_destPolys,t.PolyType.ptSubject,!0),E>0)F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftPositive,t.PolyFillType.pftPositive);else{var rt=t.Clipper.GetBounds(this.m_destPolys),vt=new t.Path();vt.push(new t.IntPoint2(rt.left-10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.bottom+10)),vt.push(new t.IntPoint2(rt.right+10,rt.top-10)),vt.push(new t.IntPoint2(rt.left-10,rt.top-10)),F.AddPath(vt,t.PolyType.ptSubject,!0),F.ReverseSolution=!0,F.Execute(t.ClipType.ctUnion,m,t.PolyFillType.pftNegative,t.PolyFillType.pftNegative),m.length>0&&m.splice(0,1);}}},t.ClipperOffset.prototype.OffsetPoint=function(c,d,m){if(this.m_sinA=this.m_normals[d].X*this.m_normals[c].Y-this.m_normals[c].X*this.m_normals[d].Y,Math.abs(this.m_sinA*this.m_delta)<1){var E=this.m_normals[d].X*this.m_normals[c].X+this.m_normals[c].Y*this.m_normals[d].Y;if(E>0)return this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[d].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[d].Y*this.m_delta))),d;}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[d].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[d].Y*this.m_delta))),this.m_destPoly.push(new t.IntPoint1(this.m_srcPoly[c])),this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[c].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[c].Y*this.m_delta)));else switch(m){case t.JoinType.jtMiter:{var F=1+(this.m_normals[c].X*this.m_normals[d].X+this.m_normals[c].Y*this.m_normals[d].Y);F>=this.m_miterLim?this.DoMiter(c,d,F):this.DoSquare(c,d);break;}case t.JoinType.jtSquare:this.DoSquare(c,d);break;case t.JoinType.jtRound:this.DoRound(c,d);break;}return d=c,d;},t.ClipperOffset.prototype.DoSquare=function(c,d){var m=Math.tan(Math.atan2(this.m_sinA,this.m_normals[d].X*this.m_normals[c].X+this.m_normals[d].Y*this.m_normals[c].Y)/4);this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_delta*(this.m_normals[d].X-this.m_normals[d].Y*m)),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_delta*(this.m_normals[d].Y+this.m_normals[d].X*m)))),this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_delta*(this.m_normals[c].X+this.m_normals[c].Y*m)),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_delta*(this.m_normals[c].Y-this.m_normals[c].X*m))));},t.ClipperOffset.prototype.DoMiter=function(c,d,m){var E=this.m_delta/m;this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+(this.m_normals[d].X+this.m_normals[c].X)*E),t.ClipperOffset.Round(this.m_srcPoly[c].Y+(this.m_normals[d].Y+this.m_normals[c].Y)*E)));},t.ClipperOffset.prototype.DoRound=function(c,d){for(var m=Math.atan2(this.m_sinA,this.m_normals[d].X*this.m_normals[c].X+this.m_normals[d].Y*this.m_normals[c].Y),E=Math.max(t.Cast_Int32(t.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(m))),1),F=this.m_normals[d].X,rt=this.m_normals[d].Y,vt,At=0;At<E;++At)this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+F*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+rt*this.m_delta))),vt=F,F=F*this.m_cos-this.m_sin*rt,rt=vt*this.m_sin+rt*this.m_cos;this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[c].X+this.m_normals[c].X*this.m_delta),t.ClipperOffset.Round(this.m_srcPoly[c].Y+this.m_normals[c].Y*this.m_delta)));},t.Error=function(c){try{throw new Error(c);}catch(d){alert(d.message);}},t.JS={},t.JS.AreaOfPolygon=function(c,d){return d||(d=1),t.Clipper.Area(c)/(d*d);},t.JS.AreaOfPolygons=function(c,d){d||(d=1);for(var m=0,E=0;E<c.length;E++)m+=t.Clipper.Area(c[E]);return m/(d*d);},t.JS.BoundsOfPath=function(c,d){return t.JS.BoundsOfPaths([c],d);},t.JS.BoundsOfPaths=function(c,d){d||(d=1);var m=t.Clipper.GetBounds(c);return m.left/=d,m.bottom/=d,m.right/=d,m.top/=d,m;},t.JS.Clean=function(E,d){if(!(E instanceof Array))return[];var m=E[0]instanceof Array,E=t.JS.Clone(E);if(typeof d!="number"||d===null)return t.Error("Delta is not a number in Clean()."),E;if(E.length===0||E.length===1&&E[0].length===0||d<0)return E;m||(E=[E]);for(var F=E.length,rt,vt,At,Mt,Wt,Zt,Xt,ne=[],ue=0;ue<F;ue++)if(vt=E[ue],rt=vt.length,rt!==0){if(rt<3){At=vt,ne.push(At);continue;}for(At=vt,Mt=d*d,Wt=vt[0],Zt=1,Xt=1;Xt<rt;Xt++)(vt[Xt].X-Wt.X)*(vt[Xt].X-Wt.X)+(vt[Xt].Y-Wt.Y)*(vt[Xt].Y-Wt.Y)<=Mt||(At[Zt]=vt[Xt],Wt=vt[Xt],Zt++);Wt=vt[Zt-1],(vt[0].X-Wt.X)*(vt[0].X-Wt.X)+(vt[0].Y-Wt.Y)*(vt[0].Y-Wt.Y)<=Mt&&Zt--,Zt<rt&&At.splice(Zt,rt-Zt),At.length&&ne.push(At);}return!m&&ne.length?ne=ne[0]:!m&&ne.length===0?ne=[]:m&&ne.length===0&&(ne=[[]]),ne;},t.JS.Clone=function(c){if(!(c instanceof Array))return[];if(c.length===0)return[];if(c.length===1&&c[0].length===0)return[[]];var d=c[0]instanceof Array;d||(c=[c]);var m=c.length,E,F,rt,vt,At=new Array(m);for(F=0;F<m;F++){for(E=c[F].length,vt=new Array(E),rt=0;rt<E;rt++)vt[rt]={X:c[F][rt].X,Y:c[F][rt].Y};At[F]=vt;}return d||(At=At[0]),At;},t.JS.Lighten=function(c,d){if(!(c instanceof Array))return[];if(typeof d!="number"||d===null)return t.Error("Tolerance is not a number in Lighten()."),t.JS.Clone(c);if(c.length===0||c.length===1&&c[0].length===0||d<0)return t.JS.Clone(c);var m=c[0]instanceof Array;m||(c=[c]);var E,F,rt,vt,At,Mt,Wt,Zt,Xt,ne,ue,Se,Ie,We,Mr,gn,Ri,Cl=c.length,Of=d*d,Oi=[];for(E=0;E<Cl;E++)if(rt=c[E],Mt=rt.length,Mt!==0){for(vt=0;vt<1e6;vt++){for(At=[],Mt=rt.length,rt[Mt-1].X!==rt[0].X||rt[Mt-1].Y!==rt[0].Y?(Se=1,rt.push({X:rt[0].X,Y:rt[0].Y}),Mt=rt.length):Se=0,ue=[],F=0;F<Mt-2;F++)Wt=rt[F],Xt=rt[F+1],Zt=rt[F+2],gn=Wt.X,Ri=Wt.Y,Ie=Zt.X-gn,We=Zt.Y-Ri,(Ie!==0||We!==0)&&(Mr=((Xt.X-gn)*Ie+(Xt.Y-Ri)*We)/(Ie*Ie+We*We),Mr>1?(gn=Zt.X,Ri=Zt.Y):Mr>0&&(gn+=Ie*Mr,Ri+=We*Mr)),Ie=Xt.X-gn,We=Xt.Y-Ri,ne=Ie*Ie+We*We,ne<=Of&&(ue[F+1]=1,F++);for(At.push({X:rt[0].X,Y:rt[0].Y}),F=1;F<Mt-1;F++)ue[F]||At.push({X:rt[F].X,Y:rt[F].Y});if(At.push({X:rt[Mt-1].X,Y:rt[Mt-1].Y}),Se&&rt.pop(),ue.length)rt=At;else break;}Mt=At.length,At[Mt-1].X===At[0].X&&At[Mt-1].Y===At[0].Y&&At.pop(),At.length>2&&Oi.push(At);}return m||(Oi=Oi[0]),_typeof(Oi)>"u"&&(Oi=[]),Oi;},t.JS.PerimeterOfPath=function(c,d,m){if(_typeof(c)>"u")return 0;var E=Math.sqrt,F=0,rt,vt,At=0,Mt=0,Wt=0,Zt=0,Xt=c.length;if(Xt<2)return 0;for(d&&(c[Xt]=c[0],Xt++);--Xt;)rt=c[Xt],At=rt.X,Mt=rt.Y,vt=c[Xt-1],Wt=vt.X,Zt=vt.Y,F+=E((At-Wt)*(At-Wt)+(Mt-Zt)*(Mt-Zt));return d&&c.pop(),F/m;},t.JS.PerimeterOfPaths=function(c,d,m){m||(m=1);for(var E=0,F=0;F<c.length;F++)E+=t.JS.PerimeterOfPath(c[F],d,m);return E;},t.JS.ScaleDownPath=function(c,d){var m,E;for(d||(d=1),m=c.length;m--;)E=c[m],E.X=E.X/d,E.Y=E.Y/d;},t.JS.ScaleDownPaths=function(c,d){var m,E,F;for(d||(d=1),m=c.length;m--;)for(E=c[m].length;E--;)F=c[m][E],F.X=F.X/d,F.Y=F.Y/d;},t.JS.ScaleUpPath=function(c,d){var m,E,F=Math.round;for(d||(d=1),m=c.length;m--;)E=c[m],E.X=F(E.X*d),E.Y=F(E.Y*d);},t.JS.ScaleUpPaths=function(c,d){var m,E,F,rt=Math.round;for(d||(d=1),m=c.length;m--;)for(E=c[m].length;E--;)F=c[m][E],F.X=rt(F.X*d),F.Y=rt(F.Y*d);},t.ExPolygons=function(){return[];},t.ExPolygon=function(){this.outer=null,this.holes=null;},t.JS.AddOuterPolyNodeToExPolygons=function(c,d){var m=new t.ExPolygon();m.outer=c.Contour();var E=c.Childs(),F=E.length;m.holes=new Array(F);var rt,vt,At,Mt,Wt,Zt;for(At=0;At<F;At++)for(rt=E[At],m.holes[At]=rt.Contour(),Mt=0,Wt=rt.Childs(),Zt=Wt.length;Mt<Zt;Mt++)vt=Wt[Mt],t.JS.AddOuterPolyNodeToExPolygons(vt,d);d.push(m);},t.JS.ExPolygonsToPaths=function(c){var d,m,E,F,rt=new t.Paths();for(d=0,E=c.length;d<E;d++)for(rt.push(c[d].outer),m=0,F=c[d].holes.length;m<F;m++)rt.push(c[d].holes[m]);return rt;},t.JS.PolyTreeToExPolygons=function(c){var d=new t.ExPolygons(),m,E,F,rt;for(E=0,F=c.Childs(),rt=F.length;E<rt;E++)m=F[E],t.JS.AddOuterPolyNodeToExPolygons(m,d);return d;};})();})(v2);var xmt=v2.exports;var vr=/* @__PURE__ */$n(xmt),g2=/* @__PURE__ */new WeakMap(),Pmt=/* @__PURE__ */new WeakMap(),du=/* @__PURE__ */new WeakMap(),zy=/* @__PURE__ */new WeakMap(),$y=/* @__PURE__ */new WeakMap();function bmt(r,t,e,n){var i=du.get(r);i||(i=/* @__PURE__ */new Map(),du.set(r,i)),i.set(t,_objectSpread(_objectSpread({},e),{},{gestureOwner:n}));}function gv(r,t){if(!r)return;var e=du.get(r),n=e==null?void 0:e.get(t);if(!n)return;if(e==null||e.delete(t),e!=null&&e.size||du.delete(r),!n.gestureOwner)return n;var i=zy.get(n.gestureOwner),s=m2(n.matrix,i==null?void 0:i.matrix);if(zy.set(n.gestureOwner,{matrix:n.matrix,toDigest:n.toDigest}),!!s)return{matrix:s,fromDigest:(i==null?void 0:i.toDigest)||n.fromDigest,toDigest:n.toDigest};}function Amt(r,t,e,n){var i=e?m2(n,$y.get(e)):n;return e&&$y.set(e,n),i?(mv(r,t,i),!0):(vp(r,t),!1);}function m2(r,t){if(!t)return _toConsumableArray(r);var e=Mmt(t);return e?Emt(r,e):void 0;}function Emt(r,t){return[r[0]*t[0]+r[2]*t[1],r[1]*t[0]+r[3]*t[1],r[0]*t[2]+r[2]*t[3],r[1]*t[2]+r[3]*t[3],r[0]*t[4]+r[2]*t[5]+r[4],r[1]*t[4]+r[3]*t[5]+r[5]];}function Mmt(r){var _r4=_slicedToArray(r,6),t=_r4[0],e=_r4[1],n=_r4[2],i=_r4[3],s=_r4[4],o=_r4[5],a=t*i-e*n;if(!(!Number.isFinite(a)||Math.abs(a)<=Number.EPSILON))return[i/a,-e/a,-n/a,t/a,(n*o-i*s)/a,(e*s-t*o)/a];}function mv(r,t,e){var n;var _iterator4=_createForOfIteratorHelper(((n=g2.get(r))==null?void 0:n.get(t))||[]),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var i=_step4.value;i(e);}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}function Lmt(r,t){var e,n;return!!((n=(e=g2.get(r))==null?void 0:e.get(t))!=null&&n.size);}function vp(r,t){var e;var _iterator5=_createForOfIteratorHelper(((e=Pmt.get(r))==null?void 0:e.get(t))||[]),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var n=_step5.value;n();}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}var yv=16,Rmt=1;function No(r){return Object.prototype.hasOwnProperty.call(r,"eraserFaces");}function Yy(r,t){var _r$eraserFaces;var e=_objectSpread({},t);return No(t)?delete e.eraserlines:r&&No(r)&&(e.eraserFaces=(_r$eraserFaces=r.eraserFaces)!==null&&_r$eraserFaces!==void 0?_r$eraserFaces:null,delete e.eraserlines),e;}function gp(r){var t=_objectSpread({},r);return delete t.doingLines,t;}function Omt(r,t,e){var n=No(r)?r.eraserFaces?pu(r.eraserFaces):[]:Gy(r.eraserlines||[]);return{eraserFaces:y2(jy(n,jy([],Gy(t))))};}function y2(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:yv;if(!Number.isSafeInteger(t)||t<=0)throw new Error("eraserFaces scale must be a positive safe integer");var e=[];Ga(e,r.length);var _iterator6=_createForOfIteratorHelper(r),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var n=_step6.value;Ga(e,n.rings.length);var _iterator7=_createForOfIteratorHelper(n.rings),_step7;try{var _loop=function _loop(){var i=_step7.value;Ga(e,i.length);var s=0,o=0;i.forEach(function(_ref53,h){var _ref54=_slicedToArray(_ref53,2),a=_ref54[0],u=_ref54[1];var v=Hy(a,t),p=Hy(u,t);Vy(e,h===0?v:v-s),Vy(e,h===0?p:p-o),s=v,o=p;});};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}return{v:1,s:t,e:1,d:T2(e)};}function pu(r){if(r.v!==1||r.e!==1||r.s<=0)throw new Error("unsupported eraserFaces payload");var t=new kmt(Bmt(r.d)),e=[],n=t.readUVarint();for(var i=0;i<n;i++){var s=[],o=t.readUVarint();for(var a=0;a<o;a++){var u=[],h=t.readUVarint();var v=0,p=0;for(var y=0;y<h;y++){var C=t.readSVarint(),b=t.readSVarint();v=y===0?C:v+C,p=y===0?b:p+b,u.push([v/r.s,p/r.s]);}s.push(u);}e.push({rings:s});}if(!t.done)throw new Error("trailing eraserFaces bytes");return e;}function Gy(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:yv;var e=[];var _iterator8=_createForOfIteratorHelper(r),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var n=_step8.value;var i=new vr.ClipperOffset();i.ArcTolerance=Math.max(0.25,t*0.05);var _iterator9=_createForOfIteratorHelper(n.op),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var s=_step9.value;var o=[];for(var a=0;a<s.length;a+=2)o.push({X:Math.round(s[a]*t),Y:Math.round(s[a+1]*t)});o.length===1&&o.push(_objectSpread({},o[0])),o.length>=2&&i.AddPath(o,vr.JoinType.jtRound,vr.EndType.etOpenRound);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}i.Execute(e,n.thickness*t/2);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}return S2(e,t);}function jy(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:yv;var n=[].concat(_toConsumableArray(r),_toConsumableArray(t)).flatMap(function(i){return i.rings.map(function(s){return s.map(function(_ref55){var _ref56=_slicedToArray(_ref55,2),o=_ref56[0],a=_ref56[1];return{X:Math.round(o*e),Y:Math.round(a*e)};});});});return S2(n,e);}function Wo(r,t){var e=[Rmt];return Zy(e,r),Zy(e,t),T2(Array.from(Nmt(Uint8Array.from(e)).slice(0,16)));}function w2(r,t,e){return r.matrix.length===6&&r.matrix.every(Number.isFinite)&&r.fromDigest===Wo(t,e)&&/^[A-Za-z0-9_-]{22}$/.test(r.toDigest);}function Dmt(r,t,e,n,i){return!w2(e,n.op,n.centerPos)||e.toDigest!==Wo(i.op,i.centerPos)?!1:(mv(r,t,e.matrix),!0);}function Ld(r,t){if(!r)return null;var e=pu(r);var _iterator0=_createForOfIteratorHelper(e),_step0;try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){var n=_step0.value;var _iterator1=_createForOfIteratorHelper(n.rings),_step1;try{var _loop2=function _loop2(){var i=_step1.value;var s=i.flat();t(s),n.rings[n.rings.indexOf(i)]=Array.from({length:s.length/2},function(o,a){return[s[a*2],s[a*2+1]];});};for(_iterator1.s();!(_step1=_iterator1.n()).done;){_loop2();}}catch(err){_iterator1.e(err);}finally{_iterator1.f();}}}catch(err){_iterator0.e(err);}finally{_iterator0.f();}return y2(e,r.s);}function S2(r,t){if(!r.length)return[];var e=new vr.Clipper();e.AddPaths(r,vr.PolyType.ptSubject,!0);var n=new vr.PolyTree();e.Execute(vr.ClipType.ctUnion,n,vr.PolyFillType.pftNonZero,vr.PolyFillType.pftNonZero);var i=[],_s9=function s(o){var _iterator10=_createForOfIteratorHelper(o.Childs()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var a=_step10.value;if(!a.IsHole()){var u=[Xy(a.Contour(),t)];var _iterator11=_createForOfIteratorHelper(a.Childs()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var h=_step11.value;h.IsHole()&&u.push(Xy(h.Contour(),t));}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}i.push({rings:u});}_s9(a);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}};return _s9(n),i;}function Xy(r,t){return r.map(function(_ref57){var e=_ref57.X,n=_ref57.Y;return[e/t,n/t];});}function Hy(r,t){if(!Number.isFinite(r))throw new Error("eraserFaces coordinate must be finite");var e=Math.round(r*t);if(!Number.isSafeInteger(e))throw new Error("eraserFaces coordinate is out of range");return Object.is(e,-0)?0:e;}function Ga(r,t){if(!Number.isSafeInteger(t)||t<0)throw new Error("invalid unsigned varint");do{var e=t%128;t=Math.floor(t/128),t&&(e|=128),r.push(e);}while(t);}function Vy(r,t){var e=t>=0?t*2:-t*2-1;Ga(r,e);}function Zy(r,t){Ga(r,t.length);var e=new ArrayBuffer(8),n=new DataView(e);var _iterator12=_createForOfIteratorHelper(t),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var i=_step12.value;if(!Number.isFinite(i))throw new Error("geometry digest values must be finite");var s=Object.is(i,-0)?0:i;n.setFloat64(0,s,!0);for(var o=0;o<8;o++)r.push(n.getUint8(o));}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}function Nmt(r){var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e=r.length*8,n=Math.ceil((r.length+9)/64)*64,i=new Uint8Array(n);i.set(r),i[r.length]=128;var s=new DataView(i.buffer);s.setUint32(n-8,Math.floor(e/4294967296),!1),s.setUint32(n-4,e>>>0,!1);var o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),u=function u(p,y){return p>>>y|p<<32-y;};for(var p=0;p<n;p+=64){for(var A=0;A<16;A++)a[A]=s.getUint32(p+A*4,!1);for(var _A2=16;_A2<64;_A2++){var w=a[_A2-15],S=a[_A2-2],x=u(w,7)^u(w,18)^w>>>3,P=u(S,17)^u(S,19)^S>>>10;a[_A2]=a[_A2-16]+x+a[_A2-7]+P>>>0;}var _o6=_slicedToArray(o,8),y=_o6[0],C=_o6[1],b=_o6[2],M=_o6[3],L=_o6[4],X=_o6[5],Y=_o6[6],et=_o6[7];for(var _A3=0;_A3<64;_A3++){var _w2=u(L,6)^u(L,11)^u(L,25),_S2=L&X^~L&Y,_x9=et+_w2+_S2+t[_A3]+a[_A3]>>>0,_P2=u(y,2)^u(y,13)^u(y,22),z=y&C^y&b^C&b,U=_P2+z>>>0;et=Y,Y=X,X=L,L=M+_x9>>>0,M=b,b=C,C=y,y=_x9+U>>>0;}o[0]=o[0]+y>>>0,o[1]=o[1]+C>>>0,o[2]=o[2]+b>>>0,o[3]=o[3]+M>>>0,o[4]=o[4]+L>>>0,o[5]=o[5]+X>>>0,o[6]=o[6]+Y>>>0,o[7]=o[7]+et>>>0;}var h=new Uint8Array(32),v=new DataView(h.buffer);return o.forEach(function(p,y){return v.setUint32(y*4,p,!1);}),h;}var kmt=/*#__PURE__*/function(){function kmt(t){_classCallCheck(this,kmt);ht(this,"index",0);this.bytes=t;}return _createClass(kmt,[{key:"done",get:function get(){return this.index===this.bytes.length;}},{key:"readUVarint",value:function readUVarint(){var t=0,e=1;for(var n=0;n<8;n++){var i=this.bytes[this.index++];if(i===void 0)throw new Error("truncated eraserFaces payload");if(t+=(i&127)*e,!(i&128))return t;e*=128;}throw new Error("eraserFaces varint is too long");}},{key:"readSVarint",value:function readSVarint(){var t=this.readUVarint();return t%2===0?t/2:-(t+1)/2;}}]);}();function T2(r){var t="";for(var e=0;e<r.length;e+=32768)t+=String.fromCharCode.apply(String,_toConsumableArray(r.slice(e,e+32768)));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");}function Bmt(r){var t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(r.length/4)*4,"="),e=atob(t);return Uint8Array.from(e,function(n){return n.charCodeAt(0);});}var Fmt=/*#__PURE__*/function(_ei4){function Fmt(){var _this31;_classCallCheck(this,Fmt);_this31=_callSuper(this,Fmt,arguments);ht(_this31,"emitEventType",ve.TranslateNode);ht(_this31,"updateSelectorCallback",function(e){var Y;var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=e.smoothSync,h=n.willSyncService,v=n.isSync,p=n.updateSelectorOpt,y=n.textUpdateForWoker,C=n.needUndoTicker,b=p.workState,M=i.render||[],L=i.sp||[];if(b===te.Start)return{sp:[{type:Tt.SelectorTransform,emitEventType:_this31.emitEventType,workState:b}],render:[]};var X=a==null?void 0:a.selectRect;if(h){var et=b===te.Done?C:void 0;L.push({type:Tt.Select,selectIds:o.selectIds,selectRect:X,willSyncService:b===te.Done?!0:u,isSync:!0,points:b===te.Done&&o.getChildrenPoints()||void 0,textOpt:o.textOpt,needUndoTicker:et,emitEventType:_this31.emitEventType});var A={workState:b,useAnimation:p.useAnimation||!1};p.uid&&(A.uid=p.uid);var _iterator13=_createForOfIteratorHelper(s.entries()),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var _step13$value=_slicedToArray(_step13.value,2),w=_step13$value[0],S=_step13$value[1];S.toolsType===St.BackgroundSVG&&L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:Tt.BackgroundSVGUpdate,dataType:Qt.Local,willSyncService:b===te.Done?!0:u,updateNodeOpt:A,needUndoTicker:et,emitEventType:_this31.emitEventType})),y&&S.toolsType===St.Text?L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:Tt.TextUpdate,dataType:Qt.Local,willSyncService:b===te.Done?!0:u,updateNodeOpt:A,needUndoTicker:et,emitEventType:_this31.emitEventType})):(u||b===te.Done)&&L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:Tt.UpdateNode,updateNodeOpt:_objectSpread(_objectSpread({},A),{},{eraserGeometryDelta:gv((Y=_this31.localWork)==null?void 0:Y.vNodes,w)}),isSync:v,needUndoTicker:et,emitEventType:_this31.emitEventType}));}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}return C&&L.push({type:Tt.None,needUndoTicker:C}),L.push({type:Tt.SelectorTransform,emitEventType:_this31.emitEventType,workState:b}),{render:M,sp:L};});return _this31;}_inherits(Fmt,_ei4);return _createClass(Fmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(e){var y,C,n,i,s,o,a,u,h,v,p,_t7;return _regenerator().w(function(_context4){while(1)switch(_context4.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.emitEventType,v=e.smoothSync,p=e.needUndoTicker;_t7=n===De&&i;if(!_t7){_context4.n=3;break;}if(!(i.workState===te.Done&&i!=null&&i.translate&&(i.translate[0]||i.translate[1])||i.workState!==te.Done)){_context4.n=2;break;}_context4.n=1;return(y=this.localWork)==null?void 0:y.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,isSync:!0,textUpdateForWoker:u,emitEventType:h,callback:this.updateSelectorCallback,smoothSync:v,needUndoTicker:p});case 1:_context4.n=3;break;case 2:i.workState===te.Done&&((C=this.localWork)==null||C.vNodes.deleteLastTarget());case 3:return _context4.a(2);}},_callee4,this);}));function consumeForLocalWorker(_x0){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Wmt=/*#__PURE__*/function(_ei5){function Wmt(){var _this32;_classCallCheck(this,Wmt);_this32=_callSuper(this,Wmt,arguments);ht(_this32,"emitEventType",ve.ScaleNode);ht(_this32,"updateSelectorCallback",function(e){var X;var n=e.param,i=e.postData,s=e.workShapeNode,o=e.res,a=e.newServiceStore,u=e.smoothSync,h=n.updateSelectorOpt,v=n.willSyncService,p=n.needUndoTicker,y=h.workState,C=i.render||[],b=i.sp||[],M=o==null?void 0:o.selectRect,L=y===te.Done?p:void 0;if(y===te.Start)return{sp:[{type:Tt.SelectorTransform,emitEventType:_this32.emitEventType,workState:y}],render:[]};if(v){b.push({type:Tt.Select,selectIds:s.selectIds,selectRect:M,willSyncService:y===te.Done?!0:u,isSync:!0,points:y===te.Done&&s.getChildrenPoints()||void 0,textOpt:s.textOpt});var Y={useAnimation:h.useAnimation||!1};h.uid&&(Y.uid=h.uid);var _iterator14=_createForOfIteratorHelper(a.entries()),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var _step14$value=_slicedToArray(_step14.value,2),et=_step14$value[0],A=_step14$value[1];A.toolsType===St.BackgroundSVG&&b.push(_objectSpread(_objectSpread({},A),{},{workId:et,type:Tt.BackgroundSVGUpdate,dataType:Qt.Local,willSyncService:y===te.Done?!0:u,updateNodeOpt:Y,needUndoTicker:L,emitEventType:_this32.emitEventType})),A.toolsType===St.Text?b.push(_objectSpread(_objectSpread({},A),{},{workId:et,type:Tt.TextUpdate,dataType:Qt.Local,willSyncService:y===te.Done?!0:u,updateNodeOpt:Y,needUndoTicker:L,emitEventType:_this32.emitEventType})):(u||y===te.Done)&&b.push(_objectSpread(_objectSpread({},A),{},{workId:et,type:Tt.UpdateNode,updateNodeOpt:_objectSpread(_objectSpread({},Y),{},{eraserGeometryDelta:gv((X=_this32.localWork)==null?void 0:X.vNodes,et)}),isSync:!0,needUndoTicker:L,emitEventType:_this32.emitEventType}));}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}return p&&b.push({type:Tt.None,needUndoTicker:p}),b.push({type:Tt.SelectorTransform,emitEventType:_this32.emitEventType,workState:y}),{render:C,sp:b};});return _this32;}_inherits(Wmt,_ei5);return _createClass(Wmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(e){var h,n,i,s,o,a,u,_t8;return _regenerator().w(function(_context5){while(1)switch(_context5.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willSyncService,o=e.willSerializeData,a=e.smoothSync,u=e.needUndoTicker;_t8=n===De&&i;if(!_t8){_context5.n=1;break;}_context5.n=1;return(h=this.localWork)==null?void 0:h.updateSelector({updateSelectorOpt:i,willSyncService:s,willSerializeData:o,isSync:!0,callback:this.updateSelectorCallback.bind(this),smoothSync:a,needUndoTicker:u});case 1:return _context5.a(2);}},_callee5,this);}));function consumeForLocalWorker(_x1){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Umt=/*#__PURE__*/function(_ei6){function Umt(){var _this33;_classCallCheck(this,Umt);_this33=_callSuper(this,Umt,arguments);ht(_this33,"emitEventType",ve.RotateNode);ht(_this33,"updateSelectorCallback",function(e){var et;var n=e.param,i=e.postData,s=e.workShapeNode,o=e.res,a=e.newServiceStore,u=e.smoothSync,h=n.updateSelectorOpt,v=n.willSyncService,p=n.willSerializeData,y=n.isSync,C=n.needUndoTicker,b=h.workState,M=i.render||[],L=i.sp||[],X=o==null?void 0:o.selectRect,Y=b===te.Done?C:void 0;if(v){p&&b===te.Done&&L.push({type:Tt.Select,selectIds:s.selectIds,selectRect:X,willSyncService:!0,isSync:y,points:s.getChildrenPoints(),textOpt:s.textOpt,selectorColor:s.selectorColor,strokeColor:s.strokeColor,fillColor:s.fillColor,canTextEdit:s.canTextEdit,canRotate:s.canRotate,scaleType:s.scaleType,opt:s.getWorkOptions()||void 0,canLock:s.canLock,isLocked:s.isLocked,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt,thickness:s.thickness,useStroke:s.useStroke,strokeType:s.strokeType});var A={useAnimation:h.useAnimation||!1};if(h.uid&&(A.uid=h.uid),u||b===te.Done){var _iterator15=_createForOfIteratorHelper(a.entries()),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var _step15$value=_slicedToArray(_step15.value,2),w=_step15$value[0],S=_step15$value[1];L.push(_objectSpread(_objectSpread({},S),{},{workId:w,type:Tt.UpdateNode,updateNodeOpt:_objectSpread(_objectSpread({},A),{},{eraserGeometryDelta:gv((et=_this33.localWork)==null?void 0:et.vNodes,w)}),isSync:y,needUndoTicker:Y,emitEventType:_this33.emitEventType}));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}}return C&&L.push({type:Tt.None,needUndoTicker:C}),L.push({type:Tt.SelectorTransform,emitEventType:_this33.emitEventType,workState:b}),{render:M,sp:L};});return _this33;}_inherits(Umt,_ei6);return _createClass(Umt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(e){var p,n,i,s,o,a,u,h,v,_t9;return _regenerator().w(function(_context6){while(1)switch(_context6.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.emitEventType,h=e.smoothSync,v=e.needUndoTicker;_t9=n===De&&i;if(!_t9){_context6.n=1;break;}_context6.n=1;return(p=this.localWork)==null?void 0:p.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:u,isSync:!0,callback:this.updateSelectorCallback,smoothSync:h,needUndoTicker:v});case 1:return _context6.a(2);}},_callee6,this);}));function consumeForLocalWorker(_x10){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var zmt=/*#__PURE__*/function(_ei7){function zmt(){var _this34;_classCallCheck(this,zmt);_this34=_callSuper(this,zmt,arguments);ht(_this34,"emitEventType",ve.SetFontStyle);return _this34;}_inherits(zmt,_ei7);return _createClass(zmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(e){var v,n,i,s,o,a,u,h,_t0;return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.requestId;_t0=n===De&&i;if(!_t0){_context7.n=1;break;}_context7.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,textUpdateForWoker:u,callback:this.updateSelectorCallback});case 1:return _context7.a(2);}},_callee7,this);}));function consumeForLocalWorker(_x11){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=n.willSyncService,h=n.isSync,v=n.updateSelectorOpt,p=n.textUpdateForWoker,y=n.requestId,C=n.emitEventType,b=i.render||[],M=i.sp||[],L=a==null?void 0:a.selectRect;if(u&&M){v.fontSize&&M.push({type:Tt.Select,selectIds:o.selectIds,selectRect:L,willSyncService:u,isSync:h,points:o.getChildrenPoints()});var _iterator16=_createForOfIteratorHelper(s.entries()),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _step16$value=_slicedToArray(_step16.value,2),X=_step16$value[0],Y=_step16$value[1];p&&Y.toolsType===St.Text?M.push(_objectSpread(_objectSpread({},Y),{},{workId:X,type:Tt.TextUpdate,dataType:Qt.Local,willSyncService:!0,emitEventType:C,requestId:y})):M.push(_objectSpread(_objectSpread({},Y),{},{workId:X,type:Tt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h,emitEventType:C,requestId:y}));}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}}return{render:b,sp:M};}}]);}(ei);var $mt=/*#__PURE__*/function(_ei8){function $mt(){var _this35;_classCallCheck(this,$mt);_this35=_callSuper(this,$mt,arguments);ht(_this35,"emitEventType",ve.SetPoint);ht(_this35,"updateSelectorCallback",function(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=n.willSyncService,h=n.isSync,v=n.needUndoTicker,p=i.render||[],y=i.sp||[],C=a==null?void 0:a.selectRect;if(u&&y){var _iterator17=_createForOfIteratorHelper(s.entries()),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var _step17$value=_slicedToArray(_step17.value,2),b=_step17$value[0],M=_step17$value[1];y.push(_objectSpread(_objectSpread({},M),{},{workId:b,type:Tt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h,needUndoTicker:v,emitEventType:_this35.emitEventType}));}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}y.push({type:Tt.Select,selectIds:o.selectIds,selectRect:C,willSyncService:u,isSync:h,points:o.getChildrenPoints()});}return v&&y.push({type:Tt.None,needUndoTicker:v}),y.push({type:Tt.SelectorTransform,emitEventType:_this35.emitEventType,workState:n.updateSelectorOpt.workState}),{render:p,sp:y};});return _this35;}_inherits($mt,_ei8);return _createClass($mt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(e){var v,n,i,s,o,a,u,h,_t1;return _regenerator().w(function(_context8){while(1)switch(_context8.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.textUpdateForWoker,h=e.needUndoTicker;_t1=n===De&&i;if(!_t1){_context8.n=1;break;}_context8.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,emitEventType:this.emitEventType,willSerializeData:a,isSync:!0,textUpdateForWoker:u,callback:this.updateSelectorCallback,needUndoTicker:h});case 1:return _context8.a(2);}},_callee8,this);}));function consumeForLocalWorker(_x12){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(ei);var Ymt=/*#__PURE__*/function(_ei9){function Ymt(){var _this36;_classCallCheck(this,Ymt);_this36=_callSuper(this,Ymt,arguments);ht(_this36,"emitEventType",ve.SetLock);return _this36;}_inherits(Ymt,_ei9);return _createClass(Ymt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(e){var v,n,i,s,o,a,u,h,_t10;return _regenerator().w(function(_context9){while(1)switch(_context9.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.needUndoTicker,h=e.requestId;_t10=n===De&&i;if(!_t10){_context9.n=1;break;}_context9.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,callback:this.updateSelectorCallback,needUndoTicker:u});case 1:return _context9.a(2);}},_callee9,this);}));function consumeForLocalWorker(_x13){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=e.workShapeNode,a=e.res,u=n.willSyncService,h=n.isSync,v=n.updateSelectorOpt,p=n.needUndoTicker,y=n.requestId,C=n.emitEventType,b=i.render||[],M=i.sp||[],L=a==null?void 0:a.selectRect;if(u&&M){var _iterator18=_createForOfIteratorHelper(s.entries()),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var _step18$value=_slicedToArray(_step18.value,2),X=_step18$value[0],Y=_step18$value[1];M.push(_objectSpread(_objectSpread({},Y),{},{workId:X,type:Tt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:h,emitEventType:C,requestId:y}));}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}M.push({isLocked:v.isLocked,selectorColor:o.selectorColor,scaleType:o.scaleType,canRotate:o.canRotate,type:Tt.Select,selectIds:o.selectIds,selectRect:L,willSyncService:u,isSync:h});}return p&&M.push({type:Tt.None,needUndoTicker:p}),{render:b,sp:M};}}]);}(ei);var Gmt=/*#__PURE__*/function(_ei0){function Gmt(){var _this37;_classCallCheck(this,Gmt);_this37=_callSuper(this,Gmt,arguments);ht(_this37,"emitEventType",ve.SetShapeOpt);return _this37;}_inherits(Gmt,_ei0);return _createClass(Gmt,[{key:"consume",value:function consume(e){var n=e.msgType,i=e.dataType,s=e.emitEventType;if(n===Tt.UpdateNode&&i===Qt.Local&&s===this.emitEventType)return this.consumeForLocalWorker(e).then(function(){return!0;});}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker0=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(e){var v,n,i,s,o,a,u,h,_t11;return _regenerator().w(function(_context0){while(1)switch(_context0.n){case 0:n=e.workId,i=e.updateNodeOpt,s=e.willRefreshSelector,o=e.willSyncService,a=e.willSerializeData,u=e.needUndoTicker,h=e.requestId;_t11=n===De&&i;if(!_t11){_context0.n=1;break;}_context0.n=1;return(v=this.localWork)==null?void 0:v.updateSelector({updateSelectorOpt:i,willRefreshSelector:s,willSyncService:o,willSerializeData:a,emitEventType:this.emitEventType,requestId:h,callback:this.updateSelectorCallback,needUndoTicker:u});case 1:return _context0.a(2);}},_callee0,this);}));function consumeForLocalWorker(_x14){return _consumeForLocalWorker0.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(e){var n=e.param,i=e.postData,s=e.newServiceStore,o=n.willSyncService,a=n.isSync,u=n.needUndoTicker,h=n.requestId,v=n.emitEventType,p=i.render||[],y=i.sp||[];if(o&&y){var _iterator19=_createForOfIteratorHelper(s.entries()),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var _step19$value=_slicedToArray(_step19.value,2),C=_step19$value[0],b=_step19$value[1];y.push(_objectSpread(_objectSpread({},b),{},{workId:C,type:Tt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:a,emitEventType:v,requestId:h}));}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}}return u&&y.push({type:Tt.None,needUndoTicker:u}),{render:p,sp:y};}}]);}(ei);var I2=/*#__PURE__*/function(){function I2(t){var _this38=this;_classCallCheck(this,I2);ht(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(t.map(function(e){return[e,_this38.build(e)];}));}return _createClass(I2,[{key:"build",value:function build(t){switch(t){case ve.TranslateNode:return new Fmt();case ve.ZIndexNode:return new Cmt();case ve.CopyNode:return new Tmt();case ve.SetColorNode:return new Imt();case ve.ScaleNode:return new Wmt();case ve.RotateNode:return new Umt();case ve.SetFontStyle:return new zmt();case ve.SetPoint:return new $mt();case ve.SetLock:return new Ymt();case ve.SetShapeOpt:return new Gmt();}}},{key:"registerForWorker",value:function registerForWorker(t){return this.builders.forEach(function(e){e&&e.registerForWorker(t);}),this;}},{key:"consumeForWorker",value:function(){var _consumeForWorker=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(t){var _iterator20,_step20,e,n,_t12,_t13,_t14;return _regenerator().w(function(_context1){while(1)switch(_context1.p=_context1.n){case 0:_iterator20=_createForOfIteratorHelper(this.builders.values());_context1.p=1;_iterator20.s();case 2:if((_step20=_iterator20.n()).done){_context1.n=7;break;}e=_step20.value;n=e==null?void 0:e.consume(t);_t12=n;if(!_t12){_context1.n=5;break;}_t13=n===!0;if(_t13){_context1.n=4;break;}_context1.n=3;return n;case 3:_t13=_context1.v;case 4:_t12=_t13;case 5:if(!_t12){_context1.n=6;break;}return _context1.a(2,!0);case 6:_context1.n=2;break;case 7:_context1.n=9;break;case 8:_context1.p=8;_t14=_context1.v;_iterator20.e(_t14);case 9:_context1.p=9;_iterator20.f();return _context1.f(9);case 10:return _context1.a(2,!1);}},_callee1,this,[[1,8,9,10]]);}));function consumeForWorker(_x15){return _consumeForWorker.apply(this,arguments);}return consumeForWorker;}()}]);}();var jmt={linear:function linear(r){return r;},easeInQuad:function easeInQuad(r){return r*r;},easeOutQuad:function easeOutQuad(r){return r*(2-r);},easeInOutQuad:function easeInOutQuad(r){return r<0.5?2*r*r:-1+(4-2*r)*r;},easeInCubic:function easeInCubic(r){return r*r*r;},easeOutCubic:function easeOutCubic(r){return--r*r*r+1;},easeInOutCubic:function easeInOutCubic(r){return r<0.5?4*r*r*r:(r-1)*(2*r-2)*(2*r-2)+1;},easeInQuart:function easeInQuart(r){return r*r*r*r;},easeOutQuart:function easeOutQuart(r){return 1- --r*r*r*r;},easeInOutQuart:function easeInOutQuart(r){return r<0.5?8*r*r*r*r:1-8*--r*r*r*r;},easeInQuint:function easeInQuint(r){return r*r*r*r*r;},easeOutQuint:function easeOutQuint(r){return 1+--r*r*r*r*r;},easeInOutQuint:function easeInOutQuint(r){return r<0.5?16*r*r*r*r*r:1+16*--r*r*r*r*r;},easeInSine:function easeInSine(r){return 1-Math.cos(r*Math.PI/2);},easeOutSine:function easeOutSine(r){return Math.sin(r*Math.PI/2);},easeInOutSine:function easeInOutSine(r){return-(Math.cos(Math.PI*r)-1)/2;},easeInExpo:function easeInExpo(r){return r<=0?0:Math.pow(2,10*r-10);},easeOutExpo:function easeOutExpo(r){return r>=1?1:1-Math.pow(2,-10*r);},easeInOutExpo:function easeInOutExpo(r){return r<=0?0:r>=1?1:r<0.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2;}};var xt=/*#__PURE__*/function(){function xt(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,xt);this.x=t,this.y=e,this.z=n;}return _createClass(xt,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(t){return this.z=t,this;}},{key:"setXY",value:function setXY(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;return this.x=t,this.y=e,this;}},{key:"set",value:function set(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=t,this.y=e,this.z=n,this;}},{key:"setTo",value:function setTo(_ref58){var _ref58$x=_ref58.x,t=_ref58$x===void 0?0:_ref58$x,_ref58$y=_ref58.y,e=_ref58$y===void 0?0:_ref58$y,_ref58$z=_ref58.z,n=_ref58$z===void 0?1:_ref58$z;return this.x=t,this.y=e,this.z=n,this;}},{key:"rot",value:function rot(t){if(t===0)return this;var e=this.x,n=this.y,i=Math.sin(t),s=Math.cos(t);return this.x=e*s-n*i,this.y=e*i+n*s,this;}},{key:"rotWith",value:function rotWith(t,e){if(e===0)return this;var n=this.x-t.x,i=this.y-t.y,s=Math.sin(e),o=Math.cos(e);return this.x=t.x+(n*o-i*s),this.y=t.y+(n*s+i*o),this;}},{key:"clone",value:function clone(){var t=this.x,e=this.y,n=this.z;return new xt(t,e,n);}},{key:"sub",value:function sub(t){return this.x-=t.x,this.y-=t.y,this;}},{key:"subXY",value:function subXY(t,e){return this.x-=t,this.y-=e,this;}},{key:"subScalar",value:function subScalar(t){return this.x-=t,this.y-=t,this;}},{key:"add",value:function add(t){return this.x+=t.x,this.y+=t.y,this;}},{key:"addXY",value:function addXY(t,e){return this.x+=t,this.y+=e,this;}},{key:"addScalar",value:function addScalar(t){return this.x+=t,this.y+=t,this;}},{key:"clamp",value:function clamp(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),e!==void 0&&(this.x=Math.min(this.x,e),this.y=Math.min(this.y,e)),this;}},{key:"div",value:function div(t){return this.x/=t,this.y/=t,this;}},{key:"divV",value:function divV(t){return this.x/=t.x,this.y/=t.y,this;}},{key:"mul",value:function mul(t){return this.x*=t,this.y*=t,this;}},{key:"mulV",value:function mulV(t){return this.x*=t.x,this.y*=t.y,this;}},{key:"abs",value:function abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this;}},{key:"nudge",value:function nudge(t,e){var n=xt.Tan(t,this);return this.add(n.mul(e));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(t){return this.x=this.y*t.z-this.z*t.y,this.y=this.z*t.x-this.x*t.z,this;}},{key:"dpr",value:function dpr(t){return xt.Dpr(this,t);}},{key:"cpr",value:function cpr(t){return xt.Cpr(this,t);}},{key:"len2",value:function len2(){return xt.Len2(this);}},{key:"len",value:function len(){return xt.Len(this);}},{key:"pry",value:function pry(t){return xt.Pry(this,t);}},{key:"per",value:function per(){var t=this.x,e=this.y;return this.x=e,this.y=-t,this;}},{key:"uni",value:function uni(){return xt.Uni(this);}},{key:"tan",value:function tan(t){return xt.Tan(this,t);}},{key:"dist",value:function dist(t){return xt.Dist(this,t);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(t,e){return xt.DistanceToLineSegment(t,e,this);}},{key:"slope",value:function slope(t){return xt.Slope(this,t);}},{key:"snapToGrid",value:function snapToGrid(t){return this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this;}},{key:"angle",value:function angle(t){return xt.Angle(this,t);}},{key:"toAngle",value:function toAngle(){return xt.ToAngle(this);}},{key:"lrp",value:function lrp(t,e){return this.x=this.x+(t.x-this.x)*e,this.y=this.y+(t.y-this.y)*e,this;}},{key:"equals",value:function equals(t,e){return xt.Equals(this,t,e);}},{key:"equalsXY",value:function equalsXY(t,e){return xt.EqualsXY(this,t,e);}},{key:"norm",value:function norm(){var t=this.len();return this.x=t===0?0:this.x/t,this.y=t===0?0:this.y/t,this;}},{key:"toFixed",value:function toFixed(){return xt.ToFixed(this);}},{key:"toString",value:function toString(){return xt.ToString(xt.ToFixed(this));}},{key:"toJson",value:function toJson(){return xt.ToJson(this);}},{key:"toArray",value:function toArray(){return xt.ToArray(this);}}],[{key:"Add",value:function Add(t,e){return new xt(t.x+e.x,t.y+e.y);}},{key:"AddXY",value:function AddXY(t,e,n){return new xt(t.x+e,t.y+n);}},{key:"Sub",value:function Sub(t,e){return new xt(t.x-e.x,t.y-e.y);}},{key:"SubXY",value:function SubXY(t,e,n){return new xt(t.x-e,t.y-n);}},{key:"AddScalar",value:function AddScalar(t,e){return new xt(t.x+e,t.y+e);}},{key:"SubScalar",value:function SubScalar(t,e){return new xt(t.x-e,t.y-e);}},{key:"Div",value:function Div(t,e){return new xt(t.x/e,t.y/e);}},{key:"Mul",value:function Mul(t,e){return new xt(t.x*e,t.y*e);}},{key:"DivV",value:function DivV(t,e){return new xt(t.x/e.x,t.y/e.y);}},{key:"MulV",value:function MulV(t,e){return new xt(t.x*e.x,t.y*e.y);}},{key:"Neg",value:function Neg(t){return new xt(-t.x,-t.y);}},{key:"Per",value:function Per(t){return new xt(t.y,-t.x);}},{key:"Dist2",value:function Dist2(t,e){return xt.Sub(t,e).len2();}},{key:"Abs",value:function Abs(t){return new xt(Math.abs(t.x),Math.abs(t.y));}},{key:"Dist",value:function Dist(t,e){return Math.hypot(t.y-e.y,t.x-e.x);}},{key:"Dpr",value:function Dpr(t,e){return t.x*e.x+t.y*e.y;}},{key:"Cross",value:function Cross(t,e){return new xt(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z// A.z = A.x * V.y - A.y * V.x
|
|
369
369
|
);}},{key:"Cpr",value:function Cpr(t,e){return t.x*e.y-e.x*t.y;}},{key:"Len2",value:function Len2(t){return t.x*t.x+t.y*t.y;}},{key:"Len",value:function Len(t){return Math.hypot(t.x,t.y);}},{key:"Pry",value:function Pry(t,e){return xt.Dpr(t,e)/xt.Len(e);}},{key:"Uni",value:function Uni(t){return xt.Div(t,xt.Len(t));}},{key:"Tan",value:function Tan(t,e){return xt.Uni(xt.Sub(t,e));}},{key:"Min",value:function Min(t,e){return new xt(Math.min(t.x,e.x),Math.min(t.y,e.y));}},{key:"Max",value:function Max(t,e){return new xt(Math.max(t.x,e.x),Math.max(t.y,e.y));}},{key:"From",value:function From(t){return new xt().add(t);}},{key:"FromArray",value:function FromArray(t){return new xt(t[0],t[1]);}},{key:"Rot",value:function Rot(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=Math.sin(e),i=Math.cos(e);return new xt(t.x*i-t.y*n,t.x*n+t.y*i);}},{key:"RotWith",value:function RotWith(t,e,n){var i=t.x-e.x,s=t.y-e.y,o=Math.sin(n),a=Math.cos(n);return new xt(e.x+(i*a-s*o),e.y+(i*o+s*a));}/**
|
|
370
370
|
* Get the nearest point on a line with a known unit vector that passes through point A
|
|
371
371
|
*
|
|
@@ -399,16 +399,16 @@ container:a,width:i.width,height:i.height,displayRatio:i.displayRatio,autoResize
|
|
|
399
399
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
400
400
|
i&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
401
401
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
402
|
-
s2t(h,u)))&&a.push(h);return a;}var B2=c2t,u2t=Object.prototype;function f2t(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||u2t;return r===e;}var Cv=f2t;function h2t(r,t){return function(e){return r(t(e));};}var F2=h2t,d2t=F2,p2t=d2t(Object.keys,Object),v2t=p2t,g2t=Cv,m2t=v2t,y2t=Object.prototype,w2t=y2t.hasOwnProperty;function S2t(r){if(!g2t(r))return m2t(r);var t=[];for(var e in Object(r))w2t.call(r,e)&&e!="constructor"&&t.push(e);return t;}var T2t=S2t,I2t=P2,C2t=N2;function x2t(r){return r!=null&&C2t(r.length)&&!I2t(r);}var xv=x2t,P2t=B2,b2t=T2t,A2t=xv;function E2t(r){return A2t(r)?P2t(r):b2t(r);}var Pv=E2t,M2t=df,L2t=Pv;function R2t(r,t){return r&&M2t(t,L2t(t),r);}var O2t=R2t;function D2t(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t;}var N2t=D2t,k2t=gl,B2t=Cv,F2t=N2t,W2t=Object.prototype,U2t=W2t.hasOwnProperty;function z2t(r){if(!k2t(r))return F2t(r);var t=B2t(r),e=[];for(var n in r)n=="constructor"&&(t||!U2t.call(r,n))||e.push(n);return e;}var $2t=z2t,Y2t=B2,G2t=$2t,j2t=xv;function X2t(r){return j2t(r)?Y2t(r,!0):G2t(r);}var bv=X2t,H2t=df,V2t=bv;function Z2t(r,t){return r&&H2t(t,V2t(t),r);}var q2t=Z2t,mu={exports:{}};mu.exports;(function(r,t){var e=ri,n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,s=i&&i.exports===n,o=s?e.Buffer:void 0,a=o?o.allocUnsafe:void 0;function u(h,v){if(v)return h.slice();var p=h.length,y=a?a(p):new h.constructor(p);return h.copy(y),y;}r.exports=u;})(mu,mu.exports);var K2t=mu.exports;function Q2t(r,t){var e=-1,n=r.length;for(t||(t=Array(n));++e<n;)t[e]=r[e];return t;}var J2t=Q2t;function _2t(r,t){for(var e=-1,n=r==null?0:r.length,i=0,s=[];++e<n;){var o=r[e];t(o,e,r)&&(s[i++]=o);}return s;}var W2=_2t;function tTt(){return[];}var U2=tTt,eTt=W2,rTt=U2,nTt=Object.prototype,iTt=nTt.propertyIsEnumerable,s1=Object.getOwnPropertySymbols,sTt=s1?function(r){return r==null?[]:(r=Object(r),eTt(s1(r),function(t){return iTt.call(r,t);}));}:rTt,Av=sTt,oTt=df,aTt=Av;function lTt(r,t){return oTt(r,aTt(r),t);}var cTt=lTt;function uTt(r,t){for(var e=-1,n=t.length,i=r.length;++e<n;)r[i+e]=t[e];return r;}var Ev=uTt,fTt=F2,hTt=fTt(Object.getPrototypeOf,Object),z2=hTt,dTt=Ev,pTt=z2,vTt=Av,gTt=U2,mTt=Object.getOwnPropertySymbols,yTt=mTt?function(r){for(var t=[];r;)dTt(t,vTt(r)),r=pTt(r);return t;}:gTt,$2=yTt,wTt=df,STt=$2;function TTt(r,t){return wTt(r,STt(r),t);}var ITt=TTt,CTt=Ev,xTt=ml;function PTt(r,t,e){var n=t(r);return xTt(r)?n:CTt(n,e(r));}var Y2=PTt,bTt=Y2,ATt=Av,ETt=Pv;function MTt(r){return bTt(r,ETt,ATt);}var G2=MTt,LTt=Y2,RTt=$2,OTt=bv;function DTt(r){return LTt(r,OTt,RTt);}var NTt=DTt,kTt=Zs,BTt=ri,FTt=kTt(BTt,"DataView"),WTt=FTt,UTt=Zs,zTt=ri,$Tt=UTt(zTt,"Promise"),YTt=$Tt,GTt=Zs,jTt=ri,XTt=GTt(jTt,"Set"),j2=XTt,HTt=Zs,VTt=ri,ZTt=HTt(VTt,"WeakMap"),qTt=ZTt,mp=WTt,yp=Sv,wp=YTt,Sp=j2,Tp=qTt,X2=Xo,Ko=b2,o1="[object Map]",KTt="[object Object]",a1="[object Promise]",l1="[object Set]",c1="[object WeakMap]",u1="[object DataView]",QTt=Ko(mp),JTt=Ko(yp),_Tt=Ko(wp),tIt=Ko(Sp),eIt=Ko(Tp),Es=X2;(mp&&Es(new mp(new ArrayBuffer(1)))!=u1||yp&&Es(new yp())!=o1||wp&&Es(wp.resolve())!=a1||Sp&&Es(new Sp())!=l1||Tp&&Es(new Tp())!=c1)&&(Es=function Es(r){var t=X2(r),e=t==KTt?r.constructor:void 0,n=e?Ko(e):"";if(n)switch(n){case QTt:return u1;case JTt:return o1;case _Tt:return a1;case tIt:return l1;case eIt:return c1;}return t;});var vf=Es,rIt=Object.prototype,nIt=rIt.hasOwnProperty;function iIt(r){var t=r.length,e=new r.constructor(t);return t&&typeof r[0]=="string"&&nIt.call(r,"index")&&(e.index=r.index,e.input=r.input),e;}var sIt=iIt,oIt=ri,aIt=oIt.Uint8Array,H2=aIt,f1=H2;function lIt(r){var t=new r.constructor(r.byteLength);return new f1(t).set(new f1(r)),t;}var Mv=lIt,cIt=Mv;function uIt(r,t){var e=t?cIt(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.byteLength);}var fIt=uIt,hIt=/\w*$/;function dIt(r){var t=new r.constructor(r.source,hIt.exec(r));return t.lastIndex=r.lastIndex,t;}var pIt=dIt,h1=vl,d1=h1?h1.prototype:void 0,p1=d1?d1.valueOf:void 0;function vIt(r){return p1?Object(p1.call(r)):{};}var gIt=vIt,mIt=Mv;function yIt(r,t){var e=t?mIt(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length);}var wIt=yIt,SIt=Mv,TIt=fIt,IIt=pIt,CIt=gIt,xIt=wIt,PIt="[object Boolean]",bIt="[object Date]",AIt="[object Map]",EIt="[object Number]",MIt="[object RegExp]",LIt="[object Set]",RIt="[object String]",OIt="[object Symbol]",DIt="[object ArrayBuffer]",NIt="[object DataView]",kIt="[object Float32Array]",BIt="[object Float64Array]",FIt="[object Int8Array]",WIt="[object Int16Array]",UIt="[object Int32Array]",zIt="[object Uint8Array]",$It="[object Uint8ClampedArray]",YIt="[object Uint16Array]",GIt="[object Uint32Array]";function jIt(r,t,e){var n=r.constructor;switch(t){case DIt:return SIt(r);case PIt:case bIt:return new n(+r);case NIt:return TIt(r,e);case kIt:case BIt:case FIt:case WIt:case UIt:case zIt:case $It:case YIt:case GIt:return xIt(r,e);case AIt:return new n();case EIt:case RIt:return new n(r);case MIt:return IIt(r);case LIt:return new n();case OIt:return CIt(r);}}var XIt=jIt,HIt=gl,v1=Object.create,VIt=/* @__PURE__ */function(){function r(){}return function(t){if(!HIt(t))return{};if(v1)return v1(t);r.prototype=t;var e=new r();return r.prototype=void 0,e;};}(),ZIt=VIt,qIt=ZIt,KIt=z2,QIt=Cv;function JIt(r){return typeof r.constructor=="function"&&!QIt(r)?qIt(KIt(r)):{};}var _It=JIt,tCt=vf,eCt=Mi,rCt="[object Map]";function nCt(r){return eCt(r)&&tCt(r)==rCt;}var iCt=nCt,sCt=iCt,oCt=pf,g1=Iv,m1=g1&&g1.isMap,aCt=m1?oCt(m1):sCt,lCt=aCt,cCt=vf,uCt=Mi,fCt="[object Set]";function hCt(r){return uCt(r)&&cCt(r)==fCt;}var dCt=hCt,pCt=dCt,vCt=pf,y1=Iv,w1=y1&&y1.isSet,gCt=w1?vCt(w1):pCt,V2=gCt;var mCt=/* @__PURE__ */$n(V2);var yCt=E2,wCt=jwt,SCt=R2,TCt=O2t,ICt=q2t,CCt=K2t,xCt=J2t,PCt=cTt,bCt=ITt,ACt=G2,ECt=NTt,MCt=vf,LCt=sIt,RCt=XIt,OCt=_It,DCt=ml,NCt=Tv,kCt=lCt,BCt=gl,FCt=V2,WCt=Pv,UCt=bv,zCt=1,$Ct=2,YCt=4,Z2="[object Arguments]",GCt="[object Array]",jCt="[object Boolean]",XCt="[object Date]",HCt="[object Error]",q2="[object Function]",VCt="[object GeneratorFunction]",ZCt="[object Map]",qCt="[object Number]",K2="[object Object]",KCt="[object RegExp]",QCt="[object Set]",JCt="[object String]",_Ct="[object Symbol]",txt="[object WeakMap]",ext="[object ArrayBuffer]",rxt="[object DataView]",nxt="[object Float32Array]",ixt="[object Float64Array]",sxt="[object Int8Array]",oxt="[object Int16Array]",axt="[object Int32Array]",lxt="[object Uint8Array]",cxt="[object Uint8ClampedArray]",uxt="[object Uint16Array]",fxt="[object Uint32Array]",Ze={};Ze[Z2]=Ze[GCt]=Ze[ext]=Ze[rxt]=Ze[jCt]=Ze[XCt]=Ze[nxt]=Ze[ixt]=Ze[sxt]=Ze[oxt]=Ze[axt]=Ze[ZCt]=Ze[qCt]=Ze[K2]=Ze[KCt]=Ze[QCt]=Ze[JCt]=Ze[_Ct]=Ze[lxt]=Ze[cxt]=Ze[uxt]=Ze[fxt]=!0;Ze[HCt]=Ze[q2]=Ze[txt]=!1;function ru(r,t,e,n,i,s){var o,a=t&zCt,u=t&$Ct,h=t&YCt;if(e&&(o=i?e(r,n,i,s):e(r)),o!==void 0)return o;if(!BCt(r))return r;var v=DCt(r);if(v){if(o=LCt(r),!a)return xCt(r,o);}else{var p=MCt(r),y=p==q2||p==VCt;if(NCt(r))return CCt(r,a);if(p==K2||p==Z2||y&&!i){if(o=u||y?{}:OCt(r),!a)return u?bCt(r,ICt(o,r)):PCt(r,TCt(o,r));}else{if(!Ze[p])return i?r:{};o=RCt(r,p,a);}}s||(s=new yCt());var C=s.get(r);if(C)return C;s.set(r,o),FCt(r)?r.forEach(function(L){o.add(ru(L,t,e,L,r,s));}):kCt(r)&&r.forEach(function(L,X){o.set(X,ru(L,t,e,X,r,s));});var b=h?u?ECt:ACt:u?UCt:WCt,M=v?void 0:b(r);return wCt(M||r,function(L,X){M&&(X=L,L=r[X]),SCt(o,X,ru(L,t,e,X,r,s));}),o;}var hxt=ru,dxt=hxt,pxt=1,vxt=4;function gxt(r){return dxt(r,pxt|vxt);}var mxt=gxt;var gr=/* @__PURE__ */$n(mxt),yxt={maxRetries:3,timeoutMs:15e3,retryIntervalMs:1e3};function wxt(r){var t=_objectSpread(_objectSpread({},yxt),r);if(t.maxRetries!==-1&&(!Number.isInteger(t.maxRetries)||t.maxRetries<0||t.maxRetries>10))throw new RangeError("backgroundImageLoadOptions.maxRetries must be -1 (infinite retry) or an integer from 0 to 10");if(t.maxRetries===-1&&(t.maxRetries=Number.POSITIVE_INFINITY),!Number.isFinite(t.timeoutMs)||t.timeoutMs<1e3||t.timeoutMs>12e4)throw new RangeError("backgroundImageLoadOptions.timeoutMs must be from 1000 to 120000");if(!Number.isFinite(t.retryIntervalMs)||t.retryIntervalMs<0||t.retryIntervalMs>3e4)throw new RangeError("backgroundImageLoadOptions.retryIntervalMs must be from 0 to 30000");return t;}var Sxt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ6e/v/xwttmsHqqmpKXbdycnJCxy7ABLh3FEgVZ6hZJhnFZoFFMF0d3c/w7v+dyookXBnZ2c/xvHfhriVcvXfdBRItsxjnOhYqjwjoAimq6vrCysoGofk+Ph4Esd/F/UdiFtJAGUd2DygTpp5dmBUUJ2dnc9VUALm8PDwJY7/BPU9VD8k3M4RC6kskxZMKigKIMLN9vf3p3H8DyWgfEhEOwOQD9IXOTz7EObbwsLC4YWFBRgeHrY9ECXYo6MjaGlpKWlsbPxkYGDgRW1tbSEWquVlZWXBzc3Nl1VVVa8hXiXc6ioqBqGaPDk7AACJTRZ3NS9lcUp86cJwoSQ7Pj4Op6enfxUXF3/V0NCQv7q6GsCvwrqGUG/01xAD4+VQTOxaSF43d5bBOisrGBJRCtXX17+/trb268rKSgASFgmz97KFkmo6OztWuVyPweiWGc4WRkhFRQVEIpHg8vJyQAIQVlLBROVxvBYQHsXnO8tk62ZcyN0wecLBwcEvYHSzEPscBqOLCRhLC4n9uqaA8UAWAcAKhtbQ3t7eTHl5+Y9gtAp3twhT056CDMQ7MRzIFTeTYKb1yYYVQFH9VdzsqNmYKpfTJBDX3Ixgdnd3XyHMT2AMALJlBBSPaMpNngrIsTyTCgaj288YDGakictrxizvKFNOjgSSBLS+vv6UYHDb7DgMVgsChjTEgCIKGG4ZU+EWkgNBzN1qamq+pAMTExPgFMzW1tZrhHkFyWE5KxgSszx0527RaDRmOSpRshEOU11dPQPG8CwHARHJlMnTSrwSRFIlfXt7m3V5ngJGuJtqzaQtZkFBVNJezN5ZAdmwjKo2k9tVtrcI3OXk4tPgcg7ChCDZ1URgMOu72Xa5VFHOkymQhWVU60YVmjN6wiC7k6p+S1syCACOwJBYFaexV+yhBekNPsMBO6KAEeE4BMaCU67RsoYhSbXgaT//ht709vZCaWmp6YkEbLFmVJWzas04+iBL7EKpm0J7duqu0B7+CTUpNJuyvb1NCfMj1CqI9wLKUOlOUMeG+gGFkHii4HizUF4z/KFUrPsJ8WbEIyx7nnZ0dDynME6BAuce09iFHo+GrnmGltltb2//E4wVAN82y7vOjKOZXSBhJdHNiT3TYWD8OY2PTUJkdd7MkJMnT5wZVQF2RFX6yBMUdzPMvvfqxz3sXHF+GNT9ANXit/10O1sgHkZvdQAOKvs9B5L7ARELGAAXLSTvM8QExTE+YbHe+HURhZp1aRyF4CJXClbbWwGketgkW9VsY+YaiBCVhfgE+XvxRwgZSM4jUVCDZFQ9pytmXR8hUTB2gnidx4XffVWydN0yQjwmx/jkAZJBrIBI5J7ZvQGZWUgVSuU/EqmOAzicKNMVu816DdRWUV1/7xAP8n+SfwF3Du3NF2sYhwAAAABJRU5ErkJggg==",Txt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAgrSURBVHgB7ZprTBRXFIDP7gIt8lQppTwE5V0KaAn6o1pqNGkDDTEmTUhsgKRp+gNJw68CFkLbVC2QkDS+gD8KJdWmARvbFBNNWpuIRGPFWBXQRMPDqIki+KLATs+ZnTvcvXtnX8w2beJJToaduTP3fHPOPffcOwC8kP+2WCDwIvahGFxTuN8KmNSZmULPNjLeqF9F8rdPkIEGEn+r+vjx46LQ0NA8/Dsader58+e/h4WFDWntFO7ot6fMFAt3JLWi2lCDpqamCux2+2+KROj82NhYGrXT2lu5Z/DP/deFByElA4Pv3LlTiHY/nJ6eVnbv3q1s2bJFyc7OVrZu3arU1dUp4+PjxPUQoT+g9tp9PkMFgpo9kxljHRoaWp2Xl3duYmIiurKyEvDoclNCQgIcPnxYPc7MzHwcGRnZhaft4Ag7O9fUbRhaITCie4lgcnNzT7qDIaHz27dvh+vXr0NEREQneqoCHKFnAR+8ZCaQGGq2CxcurCGYycnJZHcwTNAzUFFRoUJFRUV1IFQ5OKBsXB9uxSwgl0TQ3d29Yt26dccwoyVXV1d7hGEiQmGi2AzOUHx/hob4K2yuYS9G987s7OwPISEh7xPM6dOnwVfBsIMjR45AZmbmo5s3b76Xnp7+J55egMVxBSAZT0v1ED+76yn66dOnLQSzd+9ev2BIyFP0MjBco1JTU/sxfFeDazp3cYgZHmKqdoaGNISHh9fv378fSJcqlPV6e3sBJ+I/goOD34VFL0k95Y+HxPHCYGxmw5DQ2NuzZw8EBQVtunXr1jvgwUP+hhz/QDXMMCNVE8zx48dNg2FCz6QQjI2N/RA8VBFmANnu3btXihnpG8pM9fX1EAi5du0aeWkVOAMBCF7yN+R0z4yOjq6NiYlpp9CgdBtIwXpPH6vgDKWLt0CygtM6MDCwBuUYZSKaOCksAiVY9wFOBePgDOOytPAGSKzNVCCC2bBhw69YdK7ypgpYimzbtk2dl7CM+hFcveOUHDylbTFO1YdhFbByx44dA1QFUP0VSJj4+Hjo6+sDq9U6iEmHKvFZTedQ50GYbN15SITVlwNlZWUnLRZL8s6dOwMOQ9UCTtKTra2ttdppt9V2kMF5cbmsjxuM43bMNrmUzc6fP6+GQiDGDoOJi4ubwb4qm5ubafyIE6nLxGqTPEsGo1cBOGNX0TyDYafC0CyOaxcVziyh53Z2dkJycvLMvn37PmpoaBgFR4jxYSbWdVIgI89Iq4CjR48CZjlYv369+tssqI6ODsjPz4f+/v668vLycxrEHHfkYdwC8SB6mGEV8Cl64cuuri5oa2tTG+EyGjZu3AiXLl1qefDgwV8lJSUFZkDV1tZCcXExXLx4sbWoqKgPFj0zx8GI9ZwO5W4M6ekZYeqpaqbqmaSqqkpNpcPDw4dwzfM9nrLduHEjEs+X0XV/Sx96LnqE1kLtBQUF3eDwCO8dGQyzV5rl+JyuegfXI29jRotiRlKnpFghHMzKyjqotVXS0tLacKPjF3bdHxjSq1evduAkepAD+ZsDYlC8V5w8ZBVg+PPq2MGMlkInqE4joTf45MmT4YyMjAPcA+ltLSQlJX2BafxnX6HI29QeK44TOTk57mCYZ0QoJ8OBM4yB6dkNkwGlSygsLFQvYtYB3BTMxFL+M+0eFgZqp4mJiU2+QKGX1fGIk/QIrn0aYXGsyDxjmAyMhO2jhaCGoUbX1NSkLSwsPMJqV8Fspu6lIZS6OYhjiOLwdU7fQM1HfRPD7wS1obZ0j0xpb4726Z49ezaJf2/S7s9ATUGNR41BjdJseRnke3WGwhrRTS9pD1mOGoeG15BxOOfoxuCkp0Ih6NeaEaSZGlieJyiCoc1FgsGldokGk8nBvAKOrWIGQ5uPsm0tt0BWDiicAaGuGhkZ+YqMw9StGzU4OKhCnT179hNsswY1FTXdE5QEJhc1S3tGogazXLOBwQSBl3tzIhQPtAL1VQJCTcNx8y1vHIUghSKFZE9PT7H2dlM1b+Wgrr1y5Uq77J75+fnplpaWMg2ch4nlYEI5z7hdensDpI4hrYNErcMMXJ32koG4ztf3pultz83NjWG99Ra2WQ0OL2VjZjwgeufUqVOqV8+cOdPIwdBLSNJeHg8TAh5WqJ6EfSmgt7IMNRJ1JThiOlnrOAMHshprmMKdoGSCpb9s3B3SYLIFGIqICJB7xisYi+RvfiypXw40DWGdlJaWRmMd141hk8V2OWm7ieYTXhBc3+BgaZyqAISjOYxSMVvXsBTNlzdiNQDgRao2AtK3pjggpmrqbGpqSsLPIN/dv38/gaBwUjTshMHcvn27JyUlpRmc5xpPMD599LIYnLNyUKKndKjGxsakXbt2deMCLIE8IVvs0YRM1fjdu3d/wrXN5+BcnzEgvor2uN3rjzAYMp5lPEoQlE5fA0fWo8GfhlCbKVFQ1pKNIfzcOHH58mWqaimVUwJI0+6n59D4pIlzmdZPMPiZzXjDjX47Le5g0Uu8x2zgPqWyKpjVe7x3+AUbq9NYjQbgp2dsBud5o8TP7d5kHAWcQchQfoEmLgn8HjOiBIF7o5hI1x6CEbLNP3bdqYAF44JzyWLzcN1i8DcT/o3awbm8Fz3DAy2A62INwPV/E3wWdx5inmBHuwChCBD6R2JwHge80TIQRQLjt7e8DTkGZgfX8cUMZTDAteFDkveaIlzjX9ySQs8X18r2t2VHUURPKoICmDR+eCO9aSdmOIub3/w9RgpgUpiJhvraXpa6jZKHGEqyusw0GLFzX+5RhN/8kYnMSNMMfyH/V/kHST6OYVElTPAAAAAASUVORK5CYII=",Ixt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxCAYAAABznEEcAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAZoSURBVHgB7VlLSCRXFL3ljNEhEXTGhMQJmOjCz8ZNVLKICz9xIYhCNi7UgINkGEk2En8hW5cBUQNxo05GAoKikuCAmvGzGMdPcCUGjDPxD/4Vv/3JvWW97luvq7ur+hMZ8MKlqrteNfe8e965970GuLVbC5kpJr53+hjHx9yY3TUxJgLMAQG4ITARfp5T4Mri4uL9q6urnxwOxz/oY5eXl1/Pzs7e195X2FX4jZsIhAK7gx5ps9m6nGj9/f3OtbU1pzAE0318fPwVjYHrrN7R3AjU/wpOBwA9Cmf/9ejoqDMtLU31iooKGdA+ATo4OMiXAEWAHhBAGEApXj4rPAik0vPt7e0vCgoKPH4gMzMTSktLIS8vD2JiYgABvcHMTZyennbHxsaOg3udOJmLzwqEYB0ZgRCZENm4u7e39yQuLq65srISZmZmvP5Ybm4u5OfnQ0lJyXWUCAgzNLS+vt6SnJz8WgvYwV5xSlcRgyVg3ha2Dkxzc3MvfZmVlQW+bGxsDBobGyE7O1u94uJPjIqKqklKSvrbbrfPnp+ff7e8vJwMnlSTKWfJjDKhywJo6wLp0YcZ+dyIUr7s4cOHLsrRlQwBTSBFuzc2NiZYhjjVAIyzZBqEwgCQv0OOM/gNzuiP/ijlDxBRjgClpqa6AF1cXDydmpoaLCws3JcAGYHyC4JMzoKaibKysvienp6FtrY2IA/WCFB5ebkqCHSvARo8Ozt7igIxwIJ2gJ+seFMnDoIyEUV+dHT0G3qWVUr5M043DdAB0m2IKZwAYpgZX+qkywR6NFbuR0iDxmAoZRUQKRxSLTMnJ8eIaqqSeVMnIYUOdu+sq6vrp4f+VCoYo8khZaNs01VRlERUu2/BrWAA7sl2Anink1Ao18JGjyY/PDx8hq1GZqgp5c2mp6chMjLy2b179x7hRzvoqeUUwXIzqq4O5nZsNUaEbIbLqPLTou/s7FTvT05OpsA9sXJG1AVsZDwjutqBIN6gUlWjxod8XRBNKXgsrqpqYZfwEqX9h8TExD7wbFm8LmzxHQ0QHSlXKZVSqFC/hkqlaKapTaGgCQTK7PHW1lb/wsLC86KiokkccoV+qV1tcE0pO7AWxmhTxBszDzqRr66ujqanp2cRpQLNBgUsCh8BwQ54bn5+/s+mpqa+4eHhfS1gb52vwuP0trPjhSZCBtLQ0NA3MDDQQIFYAUHBYhuvzjpVbJr1lZWVP3p7e19UVVXNgHumXYrI4uBx6Yqevz02b0FcRQ8CoBQF3dXVpQLZ3d39C7n+ora29vfJyclDYFnWgFyxK3cxhss/+KoT/N6DVkQpKypFGUCp3Ozo6HgSHx//GLW/BwHsg57zl5pzADajwLn52mPL1ZHPloMoRYPMFL6EhAR18e7s7MxVV1fPsAAp4Avteq7dC/c1+wKI4g+EfGzDM+EYHBw8RDrNiA2QL6upqVGvKJ2/gHu2L1nA5wwEB2YDfSYMO1x/px0cgEc2zBY+eo67u6H29vZ/wU2VC8l58JxKNjDOgojNEp08aFVfX++3l6JMEdDx8fEB0FNIBsDXBc8ArwuW1EkeI1RKdLWmCx+1DhkZGRvR0dFfSsHKxYtnW0iqvJAN9xNm6MR/QO5sfapUSkqKmqW5ubmfwVgyZdpw/vPZl2kUEAinBMSUStG+gwra0NDQSynQKyloIxnlewafjDFLJzLRBJqiFMnqyMgIbG5uDuD996Dnv8iAPOMAPmbcm5lVJwA/vZRMKZGZlpaWVtAvUL4GZMqE1fjRJrUd76LHoX+InlhcXPwZnWW2tra6jjrpiBM3UK/weQr6J+gfodMh9HtwncG7YLA3CMSsLmxx5WuDCt8B7vZeicInTjCWlpb6wc15mfey7oc9E8LElpVmMgb9AXoC+qcTExOPKRu4NlTHs6Q10GfhgfYOvRsJQZ76BWMKuDtaolQs+gfoH6Mn436gDg+e+5BKXUQx/C5Je/a+NpbeiQJPKgUdlNXx/BCBKxVdxW5Q0I3XBqFKRhU4KLtjYawi3csuTKdc4FnIXNvKUJkVEGRG20QZAAUpA5DbaYAQLmQzfzxyk/ffdnCD4NWVnGdE7kQBQvQHC5lVEDxgMaM29lkxGCNLKrDnIbFAMkFmBIaDkHstU41coGZ1TZD5UjReCGUAYbNgdNqoXZB/T67yYbFAMiGML3BhYeH8rb0t9h/zgcTBcTNGiQAAAABJRU5ErkJggg==",Cxt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%202.5V19L8.5%2014.5L11.5%2021L14.5%2019.5L11.5%2013H18L4%202.5Z'%20fill='%23212324'%20stroke='white'%20stroke-width='1.5'%20stroke-linejoin='round'/%3e%3c/svg%3e",xxt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='26px'%20height='26px'%20viewBox='7%207%2026%2026'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2060.1%20(88133)%20-%20https://sketch.com%20--%3e%3ctitle%3eshape-cursor%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpath%20d='M20,21.5%20C20.2454599,21.5%2020.4496084,21.6768752%2020.4919443,21.9101244%20L20.5,22%20L20.5,27%20C20.5,27.2761424%2020.2761424,27.5%2020,27.5%20C19.7545401,27.5%2019.5503916,27.3231248%2019.5080557,27.0898756%20L19.5,27%20L19.5,22%20C19.5,21.7238576%2019.7238576,21.5%2020,21.5%20Z%20M27,19.5%20C27.2761424,19.5%2027.5,19.7238576%2027.5,20%20C27.5,20.2454599%2027.3231248,20.4496084%2027.0898756,20.4919443%20L27,20.5%20L22,20.5%20C21.7238576,20.5%2021.5,20.2761424%2021.5,20%20C21.5,19.7545401%2021.6768752,19.5503916%2021.9101244,19.5080557%20L22,19.5%20L27,19.5%20Z%20M18,19.5%20C18.2761424,19.5%2018.5,19.7238576%2018.5,20%20C18.5,20.2454599%2018.3231248,20.4496084%2018.0898756,20.4919443%20L18,20.5%20L13,20.5%20C12.7238576,20.5%2012.5,20.2761424%2012.5,20%20C12.5,19.7545401%2012.6768752,19.5503916%2012.9101244,19.5080557%20L13,19.5%20L18,19.5%20Z%20M20,12.5%20C20.2454599,12.5%2020.4496084,12.6768752%2020.4919443,12.9101244%20L20.5,13%20L20.5,18%20C20.5,18.2761424%2020.2761424,18.5%2020,18.5%20C19.7545401,18.5%2019.5503916,18.3231248%2019.5080557,18.0898756%20L19.5,18%20L19.5,13%20C19.5,12.7238576%2019.7238576,12.5%2020,12.5%20Z'%20id='path-1'%3e%3c/path%3e%3cfilter%20x='-64.6%25'%20y='-59.5%25'%20width='229.3%25'%20height='246.1%25'%20filterUnits='objectBoundingBox'%20id='filter-2'%3e%3cfeMorphology%20radius='1'%20operator='dilate'%20in='SourceAlpha'%20result='shadowSpreadOuter1'%3e%3c/feMorphology%3e%3cfeOffset%20dx='0'%20dy='2'%20in='shadowSpreadOuter1'%20result='shadowOffsetOuter1'%3e%3c/feOffset%3e%3cfeGaussianBlur%20stdDeviation='3'%20in='shadowOffsetOuter1'%20result='shadowBlurOuter1'%3e%3c/feGaussianBlur%3e%3cfeComposite%20in='shadowBlurOuter1'%20in2='SourceAlpha'%20operator='out'%20result='shadowBlurOuter1'%3e%3c/feComposite%3e%3cfeColorMatrix%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.16%200'%20type='matrix'%20in='shadowBlurOuter1'%3e%3c/feColorMatrix%3e%3c/filter%3e%3c/defs%3e%3cg%20id='页面-4'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Whiteboard-Guidelines'%20transform='translate(-344.000000,%20-751.000000)'%3e%3cg%20id='shape-cursor'%20transform='translate(344.000000,%20751.000000)'%3e%3crect%20id='矩形备份-44'%20fill='%23FFFFFF'%20opacity='0.01'%20x='0'%20y='0'%20width='40'%20height='40'%20rx='2'%3e%3c/rect%3e%3cg%20id='形状结合'%20fill-rule='nonzero'%3e%3cuse%20fill='black'%20fill-opacity='1'%20filter='url(%23filter-2)'%20xlink:href='%23path-1'%3e%3c/use%3e%3cpath%20stroke='%23FFFFFF'%20stroke-width='1'%20d='M20,21%20C20.4854103,21%2020.898085,21.3479993%2020.9899479,21.8654877%20L21,22%20L21,27%20C21,27.5522847%2020.5522847,28%2020,28%20C19.5145897,28%2019.101915,27.6520007%2019.0100521,27.1345123%20L19,27%20L19,22%20C19,21.4477153%2019.4477153,21%2020,21%20Z%20M27,19%20C27.5522847,19%2028,19.4477153%2028,20%20C28,20.4854103%2027.6520007,20.898085%2027.1345123,20.9899479%20L27,21%20L22,21%20C21.4477153,21%2021,20.5522847%2021,20%20C21,19.5145897%2021.3479993,19.101915%2021.8654877,19.0100521%20L22,19%20L27,19%20Z%20M18,19%20C18.5522847,19%2019,19.4477153%2019,20%20C19,20.4854103%2018.6520007,20.898085%2018.1345123,20.9899479%20L18,21%20L13,21%20C12.4477153,21%2012,20.5522847%2012,20%20C12,19.5145897%2012.3479993,19.101915%2012.8654877,19.0100521%20L13,19%20L18,19%20Z%20M20,12%20C20.4854103,12%2020.898085,12.3479993%2020.9899479,12.8654877%20L21,13%20L21,18%20C21,18.5522847%2020.5522847,19%2020,19%20C19.5145897,19%2019.101915,18.6520007%2019.0100521,18.1345123%20L19,18%20L19,13%20C19,12.4477153%2019.4477153,12%2020,12%20Z'%20fill='%23212324'%20fill-rule='evenodd'%3e%3c/path%3e%3c/g%3e%3crect%20id='矩形'%20fill='%23FFFFFF'%20x='18.5'%20y='17'%20width='3'%20height='6'%3e%3c/rect%3e%3crect%20id='矩形'%20fill='%23FFFFFF'%20x='17'%20y='18.5'%20width='6'%20height='3'%3e%3c/rect%3e%3cpath%20d='M20,21.5%20C20.2454599,21.5%2020.4496084,21.6768752%2020.4919443,21.9101244%20L20.5,22%20L20.5,27%20C20.5,27.2761424%2020.2761424,27.5%2020,27.5%20C19.7545401,27.5%2019.5503916,27.3231248%2019.5080557,27.0898756%20L19.5,27%20L19.5,22%20C19.5,21.7238576%2019.7238576,21.5%2020,21.5%20Z%20M27,19.5%20C27.2761424,19.5%2027.5,19.7238576%2027.5,20%20C27.5,20.2454599%2027.3231248,20.4496084%2027.0898756,20.4919443%20L27,20.5%20L22,20.5%20C21.7238576,20.5%2021.5,20.2761424%2021.5,20%20C21.5,19.7545401%2021.6768752,19.5503916%2021.9101244,19.5080557%20L22,19.5%20L27,19.5%20Z%20M18,19.5%20C18.2761424,19.5%2018.5,19.7238576%2018.5,20%20C18.5,20.2454599%2018.3231248,20.4496084%2018.0898756,20.4919443%20L18,20.5%20L13,20.5%20C12.7238576,20.5%2012.5,20.2761424%2012.5,20%20C12.5,19.7545401%2012.6768752,19.5503916%2012.9101244,19.5080557%20L13,19.5%20L18,19.5%20Z%20M20,12.5%20C20.2454599,12.5%2020.4496084,12.6768752%2020.4919443,12.9101244%20L20.5,13%20L20.5,18%20C20.5,18.2761424%2020.2761424,18.5%2020,18.5%20C19.7545401,18.5%2019.5503916,18.3231248%2019.5080557,18.0898756%20L19.5,18%20L19.5,13%20C19.5,12.7238576%2019.7238576,12.5%2020,12.5%20Z'%20id='形状结合'%20fill='%23212324'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Pxt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='26px'%20height='26px'%20viewBox='7%207%2026%2026'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2060.1%20(88133)%20-%20https://sketch.com%20--%3e%3ctitle%3etext-cursor%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpath%20d='M16,26.5%20C15.7238576,26.5%2015.5,26.2761424%2015.5,26%20C15.5,25.7545401%2015.6768752,25.5503916%2015.9101244,25.5080557%20L16,25.5%20L19.5,25.5%20L19.5,14.5%20L16,14.5%20C15.7238576,14.5%2015.5,14.2761424%2015.5,14%20C15.5,13.7545401%2015.6768752,13.5503916%2015.9101244,13.5080557%20L16,13.5%20L24,13.5%20C24.2761424,13.5%2024.5,13.7238576%2024.5,14%20C24.5,14.2454599%2024.3231248,14.4496084%2024.0898756,14.4919443%20L24,14.5%20L20.5,14.5%20L20.5,25.5%20L24,25.5%20C24.2761424,25.5%2024.5,25.7238576%2024.5,26%20C24.5,26.2454599%2024.3231248,26.4496084%2024.0898756,26.4919443%20L24,26.5%20L16,26.5%20Z'%20id='path-1'%3e%3c/path%3e%3cfilter%20x='-284.0%25'%20y='-81.5%25'%20width='668.1%25'%20height='293.9%25'%20filterUnits='objectBoundingBox'%20id='filter-2'%3e%3cfeMorphology%20radius='1'%20operator='dilate'%20in='SourceAlpha'%20result='shadowSpreadOuter1'%3e%3c/feMorphology%3e%3cfeOffset%20dx='0'%20dy='2'%20in='shadowSpreadOuter1'%20result='shadowOffsetOuter1'%3e%3c/feOffset%3e%3cfeGaussianBlur%20stdDeviation='3'%20in='shadowOffsetOuter1'%20result='shadowBlurOuter1'%3e%3c/feGaussianBlur%3e%3cfeComposite%20in='shadowBlurOuter1'%20in2='SourceAlpha'%20operator='out'%20result='shadowBlurOuter1'%3e%3c/feComposite%3e%3cfeColorMatrix%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.16%200'%20type='matrix'%20in='shadowBlurOuter1'%3e%3c/feColorMatrix%3e%3c/filter%3e%3c/defs%3e%3cg%20id='页面-4'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Whiteboard-Guidelines'%20transform='translate(-388.000000,%20-672.000000)'%3e%3cg%20id='text-cursor'%20transform='translate(392.000000,%20672.000000)'%3e%3crect%20id='矩形备份-40'%20fill='%23FFFFFF'%20opacity='0.01'%20x='0'%20y='0'%20width='40'%20height='40'%20rx='2'%3e%3c/rect%3e%3cg%20id='形状结合'%20fill-rule='nonzero'%3e%3cuse%20fill='black'%20fill-opacity='1'%20filter='url(%23filter-2)'%20xlink:href='%23path-1'%3e%3c/use%3e%3cpath%20stroke='%23FFFFFF'%20stroke-width='1'%20d='M19,25%20L19,15%20L16,15%20C15.4477153,15%2015,14.5522847%2015,14%20C15,13.5145897%2015.3479993,13.101915%2015.8654877,13.0100521%20L16,13%20L24,13%20C24.5522847,13%2025,13.4477153%2025,14%20C25,14.4854103%2024.6520007,14.898085%2024.1345123,14.9899479%20L24,15%20L21,15%20L21,25%20L24,25%20C24.5522847,25%2025,25.4477153%2025,26%20C25,26.4854103%2024.6520007,26.898085%2024.1345123,26.9899479%20L24,27%20L16,27%20C15.4477153,27%2015,26.5522847%2015,26%20C15,25.5145897%2015.3479993,25.101915%2015.8654877,25.0100521%20L16,25%20L19,25%20Z'%20fill='%23212324'%20fill-rule='evenodd'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Oa=/* @__PURE__ */new Map([["selector","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKeSURBVHgB3VTLi1JhFD86zlQ4ysxSXAy1GWYZzMxmYAhHagRB/QN8FLqPFq4FIQhXkS6kTQ4t2ilIKEWgSS0SmVpIm0BdaBJSaOP78XU+PXey6+saburAD+73uL/feX0H4H81GQdj7D7ilrCGFRonk3c6nXvhcJiFQiGWy+Xy/X7/WbPZ1K1KkBOsl0qlO36/n+3t7Q1hs9kYF+WC3W73MTpxc1lBmej7KuJaoVDInZ6eqsWXDw4OwGKxwPHx8Se1Wn1Wr9cjW1tbOTxi9D9bJCJHXEFslsvlR263+246nYZZptPpQK/Xg8lkSvZ6vbNGo5EgQRCLiSPhIqpoNHobo3keCARgkalUKjg5ORlGuL+/n8T6PVAqlefjYmKRdYQSsZ3P5z8aDAYVLGFarRbi8fhbhUKhx2VPEJGP3eEbfTrs4MUwr4EU49FYrVbweDy1SqXyipy95FaI7g8QXS6SyWReHx4e2ubVBc+HtTk6OjqvVqtvvF7vi0gkUiSByyyJ21BGwpswJ2Vmsxlw/0Kj0bxMJBJJl8vFPWkhGogLQoeyMhEJo2jGUzYRjcPh+Op0Oq2pVOoHkXE0SahF/w+E+3KYNEaX2pSyiSiKxeJTFPiGyyriO6FKEUgSESLp4ht4bzQaf4pFYrHYO/ysEXGNyJtjKRqM/zNNhFuf0B7vst3dXdjZ2Yn4fL4vRFwn8jaMGqYPU179LBEGf3bZcNNutwPOtScwKnCLPJ9KLMWEh7mNuIFdVsNXzbBNP+D6Ou1vwAqm8hqMWlmbzWYf4mz6HAwGzbjWwGgqrEklmucJT+UGCfG3wiPjueeNwGvB0zkAid7OMmF8CyOck/I6NJcR4KZYcM6J2vCbUGhvyQIA0gonzCEZkQud9Fcd9W/bL57cJu3lkjuNAAAAAElFTkSuQmCC"],["pencil","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ2SURBVHgB7ZXPqxJRFMfvjI4F+cqkTcrjge9B+B+0LJQ27lq4ijZprly6DaF1COKPjYRrVy0CF/aof6Baa6ChOPkLFcdMm1+dM93RafzxZuptgnfgC3ecO+dzz497JOTKNsZMp9OAoihvZFku4xp/I5dsbL/fP221Wl/D4bCKwnWn0znDd+SSDE/N6ZBgMKjJBNuKzC4dHTgQ5PF4bququn7R7XZJPB4/kSTpHcBOiQlmJ6cMpCvAcdz5ZDJhF4tF1u12v4jFYkc8z683+f1+Uq1W38K+x/AogVQ7ETF4SnB+Ho1GTxKJxDFC2u32q1KpJPh8vvVGjHK5XM4xahv+tYgRcranJrNarfay2WwKoVBIRTUajW42m70P390EOYmFrOEGdhfECEMIwur1Og+p5VOp1CP47piCOB3EXBBJAIuLRcZi7zKsSaVSEbxe70N4FEEL0AyE6VuBZEJD2wmyAkHDmoxGIwGW36ljBP2gUEXf5/wXCDZBsVjky+XyUwpCyBL0k0ai7gNp3WUVUigUvgHoWSaTaRoi2YJojk1r52q1eh2JRJ5YgUB3Pc/n83WyXRPV/A1rWrtgSAZsQL6Q3ynTI1F2QdCMqXNQEGsDMqMgrMt6ChwCaXcGYdBFjA3InELkQxBCtkcEI4riHyPFCMnlcnEKMbYzQhRi0TCKa6A76XT6wWAweD8ejz8Oh8PPcEc+9Xq9D8lkMgLv74Hugo5ALmJzlumG4+IG6BZ1dJ06wtPqN14gmza2FYljD1SljrCTsAaYpjnZFP7CmpADEel/ai4qffLiqSUKFSlEP8xfgYwwlmzyr1KYHoUtgBU4Y9D/Y78AxCeE/aWoyrkAAAAASUVORK5CYII="],["eraser","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANKSURBVHgB1VTdS5NhFD/7iuXa8KNw7SK/IjBYo13soqvEITENtj9AwZiCOCTvQrNWF9rFFPGLrC1iF10Oiy68mBSUF2KB4YabhKKyTfFCc+3Lzb2ds72LsfbxCkZ04Mf7Puc5z/k95+M5AP+R8OAvCW9nZ6cyHo8/SSaTc4RQKKQ+S0JyxFtbW6va39//ZjKZmMbGRkar1TJOp5MhYtwXwBkQkgMROnyXIcmGw+FgYrHY00JkQm4cqYPCaDQ6ZrFY7i4sLPxhMDg4SJ8hTOOWRCJ5jf8npyUiEgE6eGy1Wk12u72gIZHJZDLr4eHhVnl5+YdsslL5pH1+JBIx22y2h9PT01BKpFIpLC4ufhKJRFpcxhEM6fmlSMLh8P35+XlOJCTBYBC2t7dr8fdctv+iRHjI4HK5LAMDA8BVFAoFyOVyH/6KIKsxCtVIgC188+Dg4CV2GJxGpqamYHR09AHklEWQY5d6K/gg67HD3huNRrlKpYLNzU3gIsPDw8Dn84fa29s/4zIK6Rol8xIhSUMikXB2dXXV4AHo6en5KhaLFcvLy0VJent7QaPRzKrV6le4DCEi2UTCnGgE1dXVj3Q6XY1er08drKiosK2urnbjnrFQQxBJU1PTC3y4kyxJGHEMWe2dTUSNIcLZVXl0dAStra3BiYmJOTqgVCqfu91uull3LhlFjbZv6urqiCTIElHaEsC2dq4QqXRlZeUePsrUDFtfX/eZzebbqL+GuIFks1js32OHRtHu7u5H3FMiahFViPNQYuZRO8oQVzY2NibJocFgYAKBgLuzs/M66hsQKuzELx0dHak9rKe3paXlFurrERdZEiGUGARkcAFxmSJAJ/aRkRGGnOKwdPn9/rG9vT0HXaC5uZnxer3+vr4+HdpeRVxClBWLJFuZqhF7gAjL0PGz8fFxvcfjSY0WevVUv5mZmQDWyog1/I52PyBdlxgUqUu+qMSQznVtW1ubBlP3dmlpicnA5/N5+vv770C6bhS9lEu6eHnWFP45NioJS5xxRLdNsrenKH5CusNOWH1BEeTRMTnI6MgZpYYeYhhOmS5eEX0mMhELPktGoBd/zCWSUkTAOs4QZqZ8JsokS8Kp8KWICtlwdv5P5BchBHaEIRURoQAAAABJRU5ErkJggg=="],["text","data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="],["shape","data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"]]),Lv=/* @__PURE__ */new Map([["selector",{key:"selector",standardResolution:Oa.get("selector"),highResolution:Ixt}],["shapeSynced",{key:"shape",standardResolution:xxt}],["textSynced",{key:"text",standardResolution:Pxt}],["pencil",{key:"pencil",standardResolution:Oa.get("pencil"),highResolution:Sxt}],["eraser",{key:"eraser",standardResolution:Oa.get("eraser"),highResolution:Txt}],["text",{key:"text",standardResolution:Oa.get("text")}],["shape",{key:"shape",standardResolution:Oa.get("shape")}],["clicker",{key:"clicker",standardResolution:Cxt}]]),Q2="1.1.43-beta.1",bxt="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var r=window.__netlessUA||"";r+=" ".concat(bxt,"@").concat(Q2),window.__netlessUA=r;}var Jr={workerRenderModeBlacklist:{androidWebView:{67:d2.MainThread}},fontFaceFallbackBlacklist:{iosWebView:{12:p2.RefreshTextRender}},syncOpt:{interval:300},bufferSize:{full:4e3,sub:600},bezier:{combineUnitTime:300},pencilEraser:{maxImageWidth:1920,maxImageHeight:1920},backgroundImageLoadOptions:wxt()},ls=function ls(r,t,e){return{images:Lv.get(r),size:{width:26,height:26},offset:{x:0,y:0},local:{size:t,offset:e},synced:{}};},S1=_objectSpread(_objectSpread({},ls("pencil",{width:26,height:26},{x:-2,y:4})),{},{synced:{offset:{x:0,y:9}}}),Axt=_objectSpread(_objectSpread({},ls("selector",{width:25,height:25},{x:-5,y:21})),{},{synced:{offset:{x:0,y:26}}}),Ext=_objectSpread(_objectSpread({},ls("eraser",{width:26,height:26},{x:-8,y:8})),{},{synced:{offset:{x:-5,y:13}}}),Mxt=_objectSpread(_objectSpread({},ls("eraser",{width:26,height:26},{x:-8,y:8})),{},{synced:{offset:{x:-5,y:13}}}),Lxt=ls("eraser",{width:26,height:26},{x:-8,y:8}),Rxt=_objectSpread(_objectSpread({},ls("text",{width:47,height:40},{x:-20,y:20})),{},{synced:{images:Lv.get("textSynced"),offset:{x:-13,y:16}}}),Hi=_objectSpread(_objectSpread({},ls("shape",{width:40,height:40},{x:-20,y:20})),{},{synced:{images:Lv.get("shapeSynced"),offset:{x:-9,y:16}}}),Oxt=_objectSpread(_objectSpread({},ls("clicker",{width:24,height:24},{x:-4,y:21})),{},{synced:{offset:{x:0,y:26}}});Object.freeze((_Object$freeze={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$freeze,_e.selector,Axt),_e.clicker,Oxt),_e.pencil,S1),_e.rectangle,Hi),_e.ellipse,Hi),_e.shape,Hi),_e.eraser,Ext),_e.pencilEraser,Mxt),_e.text,Rxt),_e.straight,Hi),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$freeze,_e.arrow,Hi),_e.laserPen,S1),Qi.star,Hi),Qi.polygon,Hi),Qi.speechBalloon,Hi),Qi.bitMapEraser,Lxt)));function Jn(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var e=r.length;if(e<2)return"";var n=r[0],i=r[1];if(e===2)return"M".concat(Co(n),"L").concat(Co(i));var s="";for(var o=2,a=e-1;o<a;o++)n=r[o],i=r[o+1],s+=xo(n,i);return t?"M".concat(xo(r[0],r[1]),"Q").concat(Co(r[1])).concat(xo(r[1],r[2]),"T").concat(s).concat(xo(r[e-1],r[0])).concat(xo(r[0],r[1]),"Z"):"M".concat(Co(r[0]),"Q").concat(Co(r[1])).concat(xo(r[1],r[2])).concat(r.length>3?"T":"").concat(s,"L").concat(Co(r[e-1]));}function Dxt(r,t){var e=t>0?t:1,n=Math.floor(r.x*e),i=Math.floor(r.y*e),s=Math.ceil((r.x+r.w)*e),o=Math.ceil((r.y+r.h)*e);return{x:n,y:i,w:Math.max(1,s-n),h:Math.max(1,o-i)};}function Nxt(r,t){var n=1/(t>0?t:1);return{x:r.x-n,y:r.y-n,w:r.w+n*2,h:r.h+n*2};}function kxt(r,t,e){var n=Math.abs(e[0])||1,i=Math.abs(e[1])||1;return{size:[t.w/n,t.h/i],textureRect:[(r.x-t.x)/n,(r.y-t.y)/i,r.w/n,r.h/i]};}var J2={exports:{}};(function(r){var t=function(){var e=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function o(u,h){if(!s[u]){s[u]={};for(var v=0;v<u.length;v++)s[u][u.charAt(v)]=v;}return s[u][h];}var a={compressToBase64:function compressToBase64(u){if(u==null)return"";var h=a._compress(u,6,function(v){return n.charAt(v);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(u){return u==null?"":u==""?null:a._decompress(u.length,32,function(h){return o(n,u.charAt(h));});},compressToUTF16:function compressToUTF16(u){return u==null?"":a._compress(u,15,function(h){return e(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(u){return u==null?"":u==""?null:a._decompress(u.length,16384,function(h){return u.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
402
|
+
s2t(h,u)))&&a.push(h);return a;}var B2=c2t,u2t=Object.prototype;function f2t(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||u2t;return r===e;}var Cv=f2t;function h2t(r,t){return function(e){return r(t(e));};}var F2=h2t,d2t=F2,p2t=d2t(Object.keys,Object),v2t=p2t,g2t=Cv,m2t=v2t,y2t=Object.prototype,w2t=y2t.hasOwnProperty;function S2t(r){if(!g2t(r))return m2t(r);var t=[];for(var e in Object(r))w2t.call(r,e)&&e!="constructor"&&t.push(e);return t;}var T2t=S2t,I2t=P2,C2t=N2;function x2t(r){return r!=null&&C2t(r.length)&&!I2t(r);}var xv=x2t,P2t=B2,b2t=T2t,A2t=xv;function E2t(r){return A2t(r)?P2t(r):b2t(r);}var Pv=E2t,M2t=df,L2t=Pv;function R2t(r,t){return r&&M2t(t,L2t(t),r);}var O2t=R2t;function D2t(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t;}var N2t=D2t,k2t=gl,B2t=Cv,F2t=N2t,W2t=Object.prototype,U2t=W2t.hasOwnProperty;function z2t(r){if(!k2t(r))return F2t(r);var t=B2t(r),e=[];for(var n in r)n=="constructor"&&(t||!U2t.call(r,n))||e.push(n);return e;}var $2t=z2t,Y2t=B2,G2t=$2t,j2t=xv;function X2t(r){return j2t(r)?Y2t(r,!0):G2t(r);}var bv=X2t,H2t=df,V2t=bv;function Z2t(r,t){return r&&H2t(t,V2t(t),r);}var q2t=Z2t,mu={exports:{}};mu.exports;(function(r,t){var e=ri,n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,s=i&&i.exports===n,o=s?e.Buffer:void 0,a=o?o.allocUnsafe:void 0;function u(h,v){if(v)return h.slice();var p=h.length,y=a?a(p):new h.constructor(p);return h.copy(y),y;}r.exports=u;})(mu,mu.exports);var K2t=mu.exports;function Q2t(r,t){var e=-1,n=r.length;for(t||(t=Array(n));++e<n;)t[e]=r[e];return t;}var J2t=Q2t;function _2t(r,t){for(var e=-1,n=r==null?0:r.length,i=0,s=[];++e<n;){var o=r[e];t(o,e,r)&&(s[i++]=o);}return s;}var W2=_2t;function tTt(){return[];}var U2=tTt,eTt=W2,rTt=U2,nTt=Object.prototype,iTt=nTt.propertyIsEnumerable,s1=Object.getOwnPropertySymbols,sTt=s1?function(r){return r==null?[]:(r=Object(r),eTt(s1(r),function(t){return iTt.call(r,t);}));}:rTt,Av=sTt,oTt=df,aTt=Av;function lTt(r,t){return oTt(r,aTt(r),t);}var cTt=lTt;function uTt(r,t){for(var e=-1,n=t.length,i=r.length;++e<n;)r[i+e]=t[e];return r;}var Ev=uTt,fTt=F2,hTt=fTt(Object.getPrototypeOf,Object),z2=hTt,dTt=Ev,pTt=z2,vTt=Av,gTt=U2,mTt=Object.getOwnPropertySymbols,yTt=mTt?function(r){for(var t=[];r;)dTt(t,vTt(r)),r=pTt(r);return t;}:gTt,$2=yTt,wTt=df,STt=$2;function TTt(r,t){return wTt(r,STt(r),t);}var ITt=TTt,CTt=Ev,xTt=ml;function PTt(r,t,e){var n=t(r);return xTt(r)?n:CTt(n,e(r));}var Y2=PTt,bTt=Y2,ATt=Av,ETt=Pv;function MTt(r){return bTt(r,ETt,ATt);}var G2=MTt,LTt=Y2,RTt=$2,OTt=bv;function DTt(r){return LTt(r,OTt,RTt);}var NTt=DTt,kTt=Zs,BTt=ri,FTt=kTt(BTt,"DataView"),WTt=FTt,UTt=Zs,zTt=ri,$Tt=UTt(zTt,"Promise"),YTt=$Tt,GTt=Zs,jTt=ri,XTt=GTt(jTt,"Set"),j2=XTt,HTt=Zs,VTt=ri,ZTt=HTt(VTt,"WeakMap"),qTt=ZTt,mp=WTt,yp=Sv,wp=YTt,Sp=j2,Tp=qTt,X2=Xo,Ko=b2,o1="[object Map]",KTt="[object Object]",a1="[object Promise]",l1="[object Set]",c1="[object WeakMap]",u1="[object DataView]",QTt=Ko(mp),JTt=Ko(yp),_Tt=Ko(wp),tIt=Ko(Sp),eIt=Ko(Tp),Es=X2;(mp&&Es(new mp(new ArrayBuffer(1)))!=u1||yp&&Es(new yp())!=o1||wp&&Es(wp.resolve())!=a1||Sp&&Es(new Sp())!=l1||Tp&&Es(new Tp())!=c1)&&(Es=function Es(r){var t=X2(r),e=t==KTt?r.constructor:void 0,n=e?Ko(e):"";if(n)switch(n){case QTt:return u1;case JTt:return o1;case _Tt:return a1;case tIt:return l1;case eIt:return c1;}return t;});var vf=Es,rIt=Object.prototype,nIt=rIt.hasOwnProperty;function iIt(r){var t=r.length,e=new r.constructor(t);return t&&typeof r[0]=="string"&&nIt.call(r,"index")&&(e.index=r.index,e.input=r.input),e;}var sIt=iIt,oIt=ri,aIt=oIt.Uint8Array,H2=aIt,f1=H2;function lIt(r){var t=new r.constructor(r.byteLength);return new f1(t).set(new f1(r)),t;}var Mv=lIt,cIt=Mv;function uIt(r,t){var e=t?cIt(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.byteLength);}var fIt=uIt,hIt=/\w*$/;function dIt(r){var t=new r.constructor(r.source,hIt.exec(r));return t.lastIndex=r.lastIndex,t;}var pIt=dIt,h1=vl,d1=h1?h1.prototype:void 0,p1=d1?d1.valueOf:void 0;function vIt(r){return p1?Object(p1.call(r)):{};}var gIt=vIt,mIt=Mv;function yIt(r,t){var e=t?mIt(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length);}var wIt=yIt,SIt=Mv,TIt=fIt,IIt=pIt,CIt=gIt,xIt=wIt,PIt="[object Boolean]",bIt="[object Date]",AIt="[object Map]",EIt="[object Number]",MIt="[object RegExp]",LIt="[object Set]",RIt="[object String]",OIt="[object Symbol]",DIt="[object ArrayBuffer]",NIt="[object DataView]",kIt="[object Float32Array]",BIt="[object Float64Array]",FIt="[object Int8Array]",WIt="[object Int16Array]",UIt="[object Int32Array]",zIt="[object Uint8Array]",$It="[object Uint8ClampedArray]",YIt="[object Uint16Array]",GIt="[object Uint32Array]";function jIt(r,t,e){var n=r.constructor;switch(t){case DIt:return SIt(r);case PIt:case bIt:return new n(+r);case NIt:return TIt(r,e);case kIt:case BIt:case FIt:case WIt:case UIt:case zIt:case $It:case YIt:case GIt:return xIt(r,e);case AIt:return new n();case EIt:case RIt:return new n(r);case MIt:return IIt(r);case LIt:return new n();case OIt:return CIt(r);}}var XIt=jIt,HIt=gl,v1=Object.create,VIt=/* @__PURE__ */function(){function r(){}return function(t){if(!HIt(t))return{};if(v1)return v1(t);r.prototype=t;var e=new r();return r.prototype=void 0,e;};}(),ZIt=VIt,qIt=ZIt,KIt=z2,QIt=Cv;function JIt(r){return typeof r.constructor=="function"&&!QIt(r)?qIt(KIt(r)):{};}var _It=JIt,tCt=vf,eCt=Mi,rCt="[object Map]";function nCt(r){return eCt(r)&&tCt(r)==rCt;}var iCt=nCt,sCt=iCt,oCt=pf,g1=Iv,m1=g1&&g1.isMap,aCt=m1?oCt(m1):sCt,lCt=aCt,cCt=vf,uCt=Mi,fCt="[object Set]";function hCt(r){return uCt(r)&&cCt(r)==fCt;}var dCt=hCt,pCt=dCt,vCt=pf,y1=Iv,w1=y1&&y1.isSet,gCt=w1?vCt(w1):pCt,V2=gCt;var mCt=/* @__PURE__ */$n(V2);var yCt=E2,wCt=jwt,SCt=R2,TCt=O2t,ICt=q2t,CCt=K2t,xCt=J2t,PCt=cTt,bCt=ITt,ACt=G2,ECt=NTt,MCt=vf,LCt=sIt,RCt=XIt,OCt=_It,DCt=ml,NCt=Tv,kCt=lCt,BCt=gl,FCt=V2,WCt=Pv,UCt=bv,zCt=1,$Ct=2,YCt=4,Z2="[object Arguments]",GCt="[object Array]",jCt="[object Boolean]",XCt="[object Date]",HCt="[object Error]",q2="[object Function]",VCt="[object GeneratorFunction]",ZCt="[object Map]",qCt="[object Number]",K2="[object Object]",KCt="[object RegExp]",QCt="[object Set]",JCt="[object String]",_Ct="[object Symbol]",txt="[object WeakMap]",ext="[object ArrayBuffer]",rxt="[object DataView]",nxt="[object Float32Array]",ixt="[object Float64Array]",sxt="[object Int8Array]",oxt="[object Int16Array]",axt="[object Int32Array]",lxt="[object Uint8Array]",cxt="[object Uint8ClampedArray]",uxt="[object Uint16Array]",fxt="[object Uint32Array]",Ze={};Ze[Z2]=Ze[GCt]=Ze[ext]=Ze[rxt]=Ze[jCt]=Ze[XCt]=Ze[nxt]=Ze[ixt]=Ze[sxt]=Ze[oxt]=Ze[axt]=Ze[ZCt]=Ze[qCt]=Ze[K2]=Ze[KCt]=Ze[QCt]=Ze[JCt]=Ze[_Ct]=Ze[lxt]=Ze[cxt]=Ze[uxt]=Ze[fxt]=!0;Ze[HCt]=Ze[q2]=Ze[txt]=!1;function ru(r,t,e,n,i,s){var o,a=t&zCt,u=t&$Ct,h=t&YCt;if(e&&(o=i?e(r,n,i,s):e(r)),o!==void 0)return o;if(!BCt(r))return r;var v=DCt(r);if(v){if(o=LCt(r),!a)return xCt(r,o);}else{var p=MCt(r),y=p==q2||p==VCt;if(NCt(r))return CCt(r,a);if(p==K2||p==Z2||y&&!i){if(o=u||y?{}:OCt(r),!a)return u?bCt(r,ICt(o,r)):PCt(r,TCt(o,r));}else{if(!Ze[p])return i?r:{};o=RCt(r,p,a);}}s||(s=new yCt());var C=s.get(r);if(C)return C;s.set(r,o),FCt(r)?r.forEach(function(L){o.add(ru(L,t,e,L,r,s));}):kCt(r)&&r.forEach(function(L,X){o.set(X,ru(L,t,e,X,r,s));});var b=h?u?ECt:ACt:u?UCt:WCt,M=v?void 0:b(r);return wCt(M||r,function(L,X){M&&(X=L,L=r[X]),SCt(o,X,ru(L,t,e,X,r,s));}),o;}var hxt=ru,dxt=hxt,pxt=1,vxt=4;function gxt(r){return dxt(r,pxt|vxt);}var mxt=gxt;var gr=/* @__PURE__ */$n(mxt),yxt={maxRetries:3,timeoutMs:15e3,retryIntervalMs:1e3};function wxt(r){var t=_objectSpread(_objectSpread({},yxt),r);if(t.maxRetries!==-1&&(!Number.isInteger(t.maxRetries)||t.maxRetries<0||t.maxRetries>10))throw new RangeError("backgroundImageLoadOptions.maxRetries must be -1 (infinite retry) or an integer from 0 to 10");if(t.maxRetries===-1&&(t.maxRetries=Number.POSITIVE_INFINITY),!Number.isFinite(t.timeoutMs)||t.timeoutMs<1e3||t.timeoutMs>12e4)throw new RangeError("backgroundImageLoadOptions.timeoutMs must be from 1000 to 120000");if(!Number.isFinite(t.retryIntervalMs)||t.retryIntervalMs<0||t.retryIntervalMs>3e4)throw new RangeError("backgroundImageLoadOptions.retryIntervalMs must be from 0 to 30000");return t;}var Sxt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ6e/v/xwttmsHqqmpKXbdycnJCxy7ABLh3FEgVZ6hZJhnFZoFFMF0d3c/w7v+dyookXBnZ2c/xvHfhriVcvXfdBRItsxjnOhYqjwjoAimq6vrCysoGofk+Ph4Esd/F/UdiFtJAGUd2DygTpp5dmBUUJ2dnc9VUALm8PDwJY7/BPU9VD8k3M4RC6kskxZMKigKIMLN9vf3p3H8DyWgfEhEOwOQD9IXOTz7EObbwsLC4YWFBRgeHrY9ECXYo6MjaGlpKWlsbPxkYGDgRW1tbSEWquVlZWXBzc3Nl1VVVa8hXiXc6ioqBqGaPDk7AACJTRZ3NS9lcUp86cJwoSQ7Pj4Op6enfxUXF3/V0NCQv7q6GsCvwrqGUG/01xAD4+VQTOxaSF43d5bBOisrGBJRCtXX17+/trb268rKSgASFgmz97KFkmo6OztWuVyPweiWGc4WRkhFRQVEIpHg8vJyQAIQVlLBROVxvBYQHsXnO8tk62ZcyN0wecLBwcEvYHSzEPscBqOLCRhLC4n9uqaA8UAWAcAKhtbQ3t7eTHl5+Y9gtAp3twhT056CDMQ7MRzIFTeTYKb1yYYVQFH9VdzsqNmYKpfTJBDX3Ixgdnd3XyHMT2AMALJlBBSPaMpNngrIsTyTCgaj288YDGakictrxizvKFNOjgSSBLS+vv6UYHDb7DgMVgsChjTEgCIKGG4ZU+EWkgNBzN1qamq+pAMTExPgFMzW1tZrhHkFyWE5KxgSszx0527RaDRmOSpRshEOU11dPQPG8CwHARHJlMnTSrwSRFIlfXt7m3V5ngJGuJtqzaQtZkFBVNJezN5ZAdmwjKo2k9tVtrcI3OXk4tPgcg7ChCDZ1URgMOu72Xa5VFHOkymQhWVU60YVmjN6wiC7k6p+S1syCACOwJBYFaexV+yhBekNPsMBO6KAEeE4BMaCU67RsoYhSbXgaT//ht709vZCaWmp6YkEbLFmVJWzas04+iBL7EKpm0J7duqu0B7+CTUpNJuyvb1NCfMj1CqI9wLKUOlOUMeG+gGFkHii4HizUF4z/KFUrPsJ8WbEIyx7nnZ0dDynME6BAuce09iFHo+GrnmGltltb2//E4wVAN82y7vOjKOZXSBhJdHNiT3TYWD8OY2PTUJkdd7MkJMnT5wZVQF2RFX6yBMUdzPMvvfqxz3sXHF+GNT9ANXit/10O1sgHkZvdQAOKvs9B5L7ARELGAAXLSTvM8QExTE+YbHe+HURhZp1aRyF4CJXClbbWwGketgkW9VsY+YaiBCVhfgE+XvxRwgZSM4jUVCDZFQ9pytmXR8hUTB2gnidx4XffVWydN0yQjwmx/jkAZJBrIBI5J7ZvQGZWUgVSuU/EqmOAzicKNMVu816DdRWUV1/7xAP8n+SfwF3Du3NF2sYhwAAAABJRU5ErkJggg==",Txt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAgrSURBVHgB7ZprTBRXFIDP7gIt8lQppTwE5V0KaAn6o1pqNGkDDTEmTUhsgKRp+gNJw68CFkLbVC2QkDS+gD8KJdWmARvbFBNNWpuIRGPFWBXQRMPDqIki+KLATs+ZnTvcvXtnX8w2beJJToaduTP3fHPOPffcOwC8kP+2WCDwIvahGFxTuN8KmNSZmULPNjLeqF9F8rdPkIEGEn+r+vjx46LQ0NA8/Dsader58+e/h4WFDWntFO7ot6fMFAt3JLWi2lCDpqamCux2+2+KROj82NhYGrXT2lu5Z/DP/deFByElA4Pv3LlTiHY/nJ6eVnbv3q1s2bJFyc7OVrZu3arU1dUp4+PjxPUQoT+g9tp9PkMFgpo9kxljHRoaWp2Xl3duYmIiurKyEvDoclNCQgIcPnxYPc7MzHwcGRnZhaft4Ag7O9fUbRhaITCie4lgcnNzT7qDIaHz27dvh+vXr0NEREQneqoCHKFnAR+8ZCaQGGq2CxcurCGYycnJZHcwTNAzUFFRoUJFRUV1IFQ5OKBsXB9uxSwgl0TQ3d29Yt26dccwoyVXV1d7hGEiQmGi2AzOUHx/hob4K2yuYS9G987s7OwPISEh7xPM6dOnwVfBsIMjR45AZmbmo5s3b76Xnp7+J55egMVxBSAZT0v1ED+76yn66dOnLQSzd+9ev2BIyFP0MjBco1JTU/sxfFeDazp3cYgZHmKqdoaGNISHh9fv378fSJcqlPV6e3sBJ+I/goOD34VFL0k95Y+HxPHCYGxmw5DQ2NuzZw8EBQVtunXr1jvgwUP+hhz/QDXMMCNVE8zx48dNg2FCz6QQjI2N/RA8VBFmANnu3btXihnpG8pM9fX1EAi5du0aeWkVOAMBCF7yN+R0z4yOjq6NiYlpp9CgdBtIwXpPH6vgDKWLt0CygtM6MDCwBuUYZSKaOCksAiVY9wFOBePgDOOytPAGSKzNVCCC2bBhw69YdK7ypgpYimzbtk2dl7CM+hFcveOUHDylbTFO1YdhFbByx44dA1QFUP0VSJj4+Hjo6+sDq9U6iEmHKvFZTedQ50GYbN15SITVlwNlZWUnLRZL8s6dOwMOQ9UCTtKTra2ttdppt9V2kMF5cbmsjxuM43bMNrmUzc6fP6+GQiDGDoOJi4ubwb4qm5ubafyIE6nLxGqTPEsGo1cBOGNX0TyDYafC0CyOaxcVziyh53Z2dkJycvLMvn37PmpoaBgFR4jxYSbWdVIgI89Iq4CjR48CZjlYv369+tssqI6ODsjPz4f+/v668vLycxrEHHfkYdwC8SB6mGEV8Cl64cuuri5oa2tTG+EyGjZu3AiXLl1qefDgwV8lJSUFZkDV1tZCcXExXLx4sbWoqKgPFj0zx8GI9ZwO5W4M6ekZYeqpaqbqmaSqqkpNpcPDw4dwzfM9nrLduHEjEs+X0XV/Sx96LnqE1kLtBQUF3eDwCO8dGQyzV5rl+JyuegfXI29jRotiRlKnpFghHMzKyjqotVXS0tLacKPjF3bdHxjSq1evduAkepAD+ZsDYlC8V5w8ZBVg+PPq2MGMlkInqE4joTf45MmT4YyMjAPcA+ltLSQlJX2BafxnX6HI29QeK44TOTk57mCYZ0QoJ8OBM4yB6dkNkwGlSygsLFQvYtYB3BTMxFL+M+0eFgZqp4mJiU2+QKGX1fGIk/QIrn0aYXGsyDxjmAyMhO2jhaCGoUbX1NSkLSwsPMJqV8Fspu6lIZS6OYhjiOLwdU7fQM1HfRPD7wS1obZ0j0xpb4726Z49ezaJf2/S7s9ATUGNR41BjdJseRnke3WGwhrRTS9pD1mOGoeG15BxOOfoxuCkp0Ih6NeaEaSZGlieJyiCoc1FgsGldokGk8nBvAKOrWIGQ5uPsm0tt0BWDiicAaGuGhkZ+YqMw9StGzU4OKhCnT179hNsswY1FTXdE5QEJhc1S3tGogazXLOBwQSBl3tzIhQPtAL1VQJCTcNx8y1vHIUghSKFZE9PT7H2dlM1b+Wgrr1y5Uq77J75+fnplpaWMg2ch4nlYEI5z7hdensDpI4hrYNErcMMXJ32koG4ztf3pultz83NjWG99Ra2WQ0OL2VjZjwgeufUqVOqV8+cOdPIwdBLSNJeHg8TAh5WqJ6EfSmgt7IMNRJ1JThiOlnrOAMHshprmMKdoGSCpb9s3B3SYLIFGIqICJB7xisYi+RvfiypXw40DWGdlJaWRmMd141hk8V2OWm7ieYTXhBc3+BgaZyqAISjOYxSMVvXsBTNlzdiNQDgRao2AtK3pjggpmrqbGpqSsLPIN/dv38/gaBwUjTshMHcvn27JyUlpRmc5xpPMD599LIYnLNyUKKndKjGxsakXbt2deMCLIE8IVvs0YRM1fjdu3d/wrXN5+BcnzEgvor2uN3rjzAYMp5lPEoQlE5fA0fWo8GfhlCbKVFQ1pKNIfzcOHH58mWqaimVUwJI0+6n59D4pIlzmdZPMPiZzXjDjX47Le5g0Uu8x2zgPqWyKpjVe7x3+AUbq9NYjQbgp2dsBud5o8TP7d5kHAWcQchQfoEmLgn8HjOiBIF7o5hI1x6CEbLNP3bdqYAF44JzyWLzcN1i8DcT/o3awbm8Fz3DAy2A62INwPV/E3wWdx5inmBHuwChCBD6R2JwHge80TIQRQLjt7e8DTkGZgfX8cUMZTDAteFDkveaIlzjX9ySQs8X18r2t2VHUURPKoICmDR+eCO9aSdmOIub3/w9RgpgUpiJhvraXpa6jZKHGEqyusw0GLFzX+5RhN/8kYnMSNMMfyH/V/kHST6OYVElTPAAAAAASUVORK5CYII=",Ixt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAxCAYAAABznEEcAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAZoSURBVHgB7VlLSCRXFL3ljNEhEXTGhMQJmOjCz8ZNVLKICz9xIYhCNi7UgINkGEk2En8hW5cBUQNxo05GAoKikuCAmvGzGMdPcCUGjDPxD/4Vv/3JvWW97luvq7ur+hMZ8MKlqrteNfe8e965970GuLVbC5kpJr53+hjHx9yY3TUxJgLMAQG4ITARfp5T4Mri4uL9q6urnxwOxz/oY5eXl1/Pzs7e195X2FX4jZsIhAK7gx5ps9m6nGj9/f3OtbU1pzAE0318fPwVjYHrrN7R3AjU/wpOBwA9Cmf/9ejoqDMtLU31iooKGdA+ATo4OMiXAEWAHhBAGEApXj4rPAik0vPt7e0vCgoKPH4gMzMTSktLIS8vD2JiYgABvcHMTZyennbHxsaOg3udOJmLzwqEYB0ZgRCZENm4u7e39yQuLq65srISZmZmvP5Ybm4u5OfnQ0lJyXWUCAgzNLS+vt6SnJz8WgvYwV5xSlcRgyVg3ha2Dkxzc3MvfZmVlQW+bGxsDBobGyE7O1u94uJPjIqKqklKSvrbbrfPnp+ff7e8vJwMnlSTKWfJjDKhywJo6wLp0YcZ+dyIUr7s4cOHLsrRlQwBTSBFuzc2NiZYhjjVAIyzZBqEwgCQv0OOM/gNzuiP/ijlDxBRjgClpqa6AF1cXDydmpoaLCws3JcAGYHyC4JMzoKaibKysvienp6FtrY2IA/WCFB5ebkqCHSvARo8Ozt7igIxwIJ2gJ+seFMnDoIyEUV+dHT0G3qWVUr5M043DdAB0m2IKZwAYpgZX+qkywR6NFbuR0iDxmAoZRUQKRxSLTMnJ8eIaqqSeVMnIYUOdu+sq6vrp4f+VCoYo8khZaNs01VRlERUu2/BrWAA7sl2Anink1Ao18JGjyY/PDx8hq1GZqgp5c2mp6chMjLy2b179x7hRzvoqeUUwXIzqq4O5nZsNUaEbIbLqPLTou/s7FTvT05OpsA9sXJG1AVsZDwjutqBIN6gUlWjxod8XRBNKXgsrqpqYZfwEqX9h8TExD7wbFm8LmzxHQ0QHSlXKZVSqFC/hkqlaKapTaGgCQTK7PHW1lb/wsLC86KiokkccoV+qV1tcE0pO7AWxmhTxBszDzqRr66ujqanp2cRpQLNBgUsCh8BwQ54bn5+/s+mpqa+4eHhfS1gb52vwuP0trPjhSZCBtLQ0NA3MDDQQIFYAUHBYhuvzjpVbJr1lZWVP3p7e19UVVXNgHumXYrI4uBx6Yqevz02b0FcRQ8CoBQF3dXVpQLZ3d39C7n+ora29vfJyclDYFnWgFyxK3cxhss/+KoT/N6DVkQpKypFGUCp3Ozo6HgSHx//GLW/BwHsg57zl5pzADajwLn52mPL1ZHPloMoRYPMFL6EhAR18e7s7MxVV1fPsAAp4Avteq7dC/c1+wKI4g+EfGzDM+EYHBw8RDrNiA2QL6upqVGvKJ2/gHu2L1nA5wwEB2YDfSYMO1x/px0cgEc2zBY+eo67u6H29vZ/wU2VC8l58JxKNjDOgojNEp08aFVfX++3l6JMEdDx8fEB0FNIBsDXBc8ArwuW1EkeI1RKdLWmCx+1DhkZGRvR0dFfSsHKxYtnW0iqvJAN9xNm6MR/QO5sfapUSkqKmqW5ubmfwVgyZdpw/vPZl2kUEAinBMSUStG+gwra0NDQSynQKyloIxnlewafjDFLJzLRBJqiFMnqyMgIbG5uDuD996Dnv8iAPOMAPmbcm5lVJwA/vZRMKZGZlpaWVtAvUL4GZMqE1fjRJrUd76LHoX+InlhcXPwZnWW2tra6jjrpiBM3UK/weQr6J+gfodMh9HtwncG7YLA3CMSsLmxx5WuDCt8B7vZeicInTjCWlpb6wc15mfey7oc9E8LElpVmMgb9AXoC+qcTExOPKRu4NlTHs6Q10GfhgfYOvRsJQZ76BWMKuDtaolQs+gfoH6Mn436gDg+e+5BKXUQx/C5Je/a+NpbeiQJPKgUdlNXx/BCBKxVdxW5Q0I3XBqFKRhU4KLtjYawi3csuTKdc4FnIXNvKUJkVEGRG20QZAAUpA5DbaYAQLmQzfzxyk/ffdnCD4NWVnGdE7kQBQvQHC5lVEDxgMaM29lkxGCNLKrDnIbFAMkFmBIaDkHstU41coGZ1TZD5UjReCGUAYbNgdNqoXZB/T67yYbFAMiGML3BhYeH8rb0t9h/zgcTBcTNGiQAAAABJRU5ErkJggg==",Cxt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%202.5V19L8.5%2014.5L11.5%2021L14.5%2019.5L11.5%2013H18L4%202.5Z'%20fill='%23212324'%20stroke='white'%20stroke-width='1.5'%20stroke-linejoin='round'/%3e%3c/svg%3e",xxt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='26px'%20height='26px'%20viewBox='7%207%2026%2026'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2060.1%20(88133)%20-%20https://sketch.com%20--%3e%3ctitle%3eshape-cursor%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpath%20d='M20,21.5%20C20.2454599,21.5%2020.4496084,21.6768752%2020.4919443,21.9101244%20L20.5,22%20L20.5,27%20C20.5,27.2761424%2020.2761424,27.5%2020,27.5%20C19.7545401,27.5%2019.5503916,27.3231248%2019.5080557,27.0898756%20L19.5,27%20L19.5,22%20C19.5,21.7238576%2019.7238576,21.5%2020,21.5%20Z%20M27,19.5%20C27.2761424,19.5%2027.5,19.7238576%2027.5,20%20C27.5,20.2454599%2027.3231248,20.4496084%2027.0898756,20.4919443%20L27,20.5%20L22,20.5%20C21.7238576,20.5%2021.5,20.2761424%2021.5,20%20C21.5,19.7545401%2021.6768752,19.5503916%2021.9101244,19.5080557%20L22,19.5%20L27,19.5%20Z%20M18,19.5%20C18.2761424,19.5%2018.5,19.7238576%2018.5,20%20C18.5,20.2454599%2018.3231248,20.4496084%2018.0898756,20.4919443%20L18,20.5%20L13,20.5%20C12.7238576,20.5%2012.5,20.2761424%2012.5,20%20C12.5,19.7545401%2012.6768752,19.5503916%2012.9101244,19.5080557%20L13,19.5%20L18,19.5%20Z%20M20,12.5%20C20.2454599,12.5%2020.4496084,12.6768752%2020.4919443,12.9101244%20L20.5,13%20L20.5,18%20C20.5,18.2761424%2020.2761424,18.5%2020,18.5%20C19.7545401,18.5%2019.5503916,18.3231248%2019.5080557,18.0898756%20L19.5,18%20L19.5,13%20C19.5,12.7238576%2019.7238576,12.5%2020,12.5%20Z'%20id='path-1'%3e%3c/path%3e%3cfilter%20x='-64.6%25'%20y='-59.5%25'%20width='229.3%25'%20height='246.1%25'%20filterUnits='objectBoundingBox'%20id='filter-2'%3e%3cfeMorphology%20radius='1'%20operator='dilate'%20in='SourceAlpha'%20result='shadowSpreadOuter1'%3e%3c/feMorphology%3e%3cfeOffset%20dx='0'%20dy='2'%20in='shadowSpreadOuter1'%20result='shadowOffsetOuter1'%3e%3c/feOffset%3e%3cfeGaussianBlur%20stdDeviation='3'%20in='shadowOffsetOuter1'%20result='shadowBlurOuter1'%3e%3c/feGaussianBlur%3e%3cfeComposite%20in='shadowBlurOuter1'%20in2='SourceAlpha'%20operator='out'%20result='shadowBlurOuter1'%3e%3c/feComposite%3e%3cfeColorMatrix%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.16%200'%20type='matrix'%20in='shadowBlurOuter1'%3e%3c/feColorMatrix%3e%3c/filter%3e%3c/defs%3e%3cg%20id='页面-4'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Whiteboard-Guidelines'%20transform='translate(-344.000000,%20-751.000000)'%3e%3cg%20id='shape-cursor'%20transform='translate(344.000000,%20751.000000)'%3e%3crect%20id='矩形备份-44'%20fill='%23FFFFFF'%20opacity='0.01'%20x='0'%20y='0'%20width='40'%20height='40'%20rx='2'%3e%3c/rect%3e%3cg%20id='形状结合'%20fill-rule='nonzero'%3e%3cuse%20fill='black'%20fill-opacity='1'%20filter='url(%23filter-2)'%20xlink:href='%23path-1'%3e%3c/use%3e%3cpath%20stroke='%23FFFFFF'%20stroke-width='1'%20d='M20,21%20C20.4854103,21%2020.898085,21.3479993%2020.9899479,21.8654877%20L21,22%20L21,27%20C21,27.5522847%2020.5522847,28%2020,28%20C19.5145897,28%2019.101915,27.6520007%2019.0100521,27.1345123%20L19,27%20L19,22%20C19,21.4477153%2019.4477153,21%2020,21%20Z%20M27,19%20C27.5522847,19%2028,19.4477153%2028,20%20C28,20.4854103%2027.6520007,20.898085%2027.1345123,20.9899479%20L27,21%20L22,21%20C21.4477153,21%2021,20.5522847%2021,20%20C21,19.5145897%2021.3479993,19.101915%2021.8654877,19.0100521%20L22,19%20L27,19%20Z%20M18,19%20C18.5522847,19%2019,19.4477153%2019,20%20C19,20.4854103%2018.6520007,20.898085%2018.1345123,20.9899479%20L18,21%20L13,21%20C12.4477153,21%2012,20.5522847%2012,20%20C12,19.5145897%2012.3479993,19.101915%2012.8654877,19.0100521%20L13,19%20L18,19%20Z%20M20,12%20C20.4854103,12%2020.898085,12.3479993%2020.9899479,12.8654877%20L21,13%20L21,18%20C21,18.5522847%2020.5522847,19%2020,19%20C19.5145897,19%2019.101915,18.6520007%2019.0100521,18.1345123%20L19,18%20L19,13%20C19,12.4477153%2019.4477153,12%2020,12%20Z'%20fill='%23212324'%20fill-rule='evenodd'%3e%3c/path%3e%3c/g%3e%3crect%20id='矩形'%20fill='%23FFFFFF'%20x='18.5'%20y='17'%20width='3'%20height='6'%3e%3c/rect%3e%3crect%20id='矩形'%20fill='%23FFFFFF'%20x='17'%20y='18.5'%20width='6'%20height='3'%3e%3c/rect%3e%3cpath%20d='M20,21.5%20C20.2454599,21.5%2020.4496084,21.6768752%2020.4919443,21.9101244%20L20.5,22%20L20.5,27%20C20.5,27.2761424%2020.2761424,27.5%2020,27.5%20C19.7545401,27.5%2019.5503916,27.3231248%2019.5080557,27.0898756%20L19.5,27%20L19.5,22%20C19.5,21.7238576%2019.7238576,21.5%2020,21.5%20Z%20M27,19.5%20C27.2761424,19.5%2027.5,19.7238576%2027.5,20%20C27.5,20.2454599%2027.3231248,20.4496084%2027.0898756,20.4919443%20L27,20.5%20L22,20.5%20C21.7238576,20.5%2021.5,20.2761424%2021.5,20%20C21.5,19.7545401%2021.6768752,19.5503916%2021.9101244,19.5080557%20L22,19.5%20L27,19.5%20Z%20M18,19.5%20C18.2761424,19.5%2018.5,19.7238576%2018.5,20%20C18.5,20.2454599%2018.3231248,20.4496084%2018.0898756,20.4919443%20L18,20.5%20L13,20.5%20C12.7238576,20.5%2012.5,20.2761424%2012.5,20%20C12.5,19.7545401%2012.6768752,19.5503916%2012.9101244,19.5080557%20L13,19.5%20L18,19.5%20Z%20M20,12.5%20C20.2454599,12.5%2020.4496084,12.6768752%2020.4919443,12.9101244%20L20.5,13%20L20.5,18%20C20.5,18.2761424%2020.2761424,18.5%2020,18.5%20C19.7545401,18.5%2019.5503916,18.3231248%2019.5080557,18.0898756%20L19.5,18%20L19.5,13%20C19.5,12.7238576%2019.7238576,12.5%2020,12.5%20Z'%20id='形状结合'%20fill='%23212324'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Pxt="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='26px'%20height='26px'%20viewBox='7%207%2026%2026'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2060.1%20(88133)%20-%20https://sketch.com%20--%3e%3ctitle%3etext-cursor%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpath%20d='M16,26.5%20C15.7238576,26.5%2015.5,26.2761424%2015.5,26%20C15.5,25.7545401%2015.6768752,25.5503916%2015.9101244,25.5080557%20L16,25.5%20L19.5,25.5%20L19.5,14.5%20L16,14.5%20C15.7238576,14.5%2015.5,14.2761424%2015.5,14%20C15.5,13.7545401%2015.6768752,13.5503916%2015.9101244,13.5080557%20L16,13.5%20L24,13.5%20C24.2761424,13.5%2024.5,13.7238576%2024.5,14%20C24.5,14.2454599%2024.3231248,14.4496084%2024.0898756,14.4919443%20L24,14.5%20L20.5,14.5%20L20.5,25.5%20L24,25.5%20C24.2761424,25.5%2024.5,25.7238576%2024.5,26%20C24.5,26.2454599%2024.3231248,26.4496084%2024.0898756,26.4919443%20L24,26.5%20L16,26.5%20Z'%20id='path-1'%3e%3c/path%3e%3cfilter%20x='-284.0%25'%20y='-81.5%25'%20width='668.1%25'%20height='293.9%25'%20filterUnits='objectBoundingBox'%20id='filter-2'%3e%3cfeMorphology%20radius='1'%20operator='dilate'%20in='SourceAlpha'%20result='shadowSpreadOuter1'%3e%3c/feMorphology%3e%3cfeOffset%20dx='0'%20dy='2'%20in='shadowSpreadOuter1'%20result='shadowOffsetOuter1'%3e%3c/feOffset%3e%3cfeGaussianBlur%20stdDeviation='3'%20in='shadowOffsetOuter1'%20result='shadowBlurOuter1'%3e%3c/feGaussianBlur%3e%3cfeComposite%20in='shadowBlurOuter1'%20in2='SourceAlpha'%20operator='out'%20result='shadowBlurOuter1'%3e%3c/feComposite%3e%3cfeColorMatrix%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.16%200'%20type='matrix'%20in='shadowBlurOuter1'%3e%3c/feColorMatrix%3e%3c/filter%3e%3c/defs%3e%3cg%20id='页面-4'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Whiteboard-Guidelines'%20transform='translate(-388.000000,%20-672.000000)'%3e%3cg%20id='text-cursor'%20transform='translate(392.000000,%20672.000000)'%3e%3crect%20id='矩形备份-40'%20fill='%23FFFFFF'%20opacity='0.01'%20x='0'%20y='0'%20width='40'%20height='40'%20rx='2'%3e%3c/rect%3e%3cg%20id='形状结合'%20fill-rule='nonzero'%3e%3cuse%20fill='black'%20fill-opacity='1'%20filter='url(%23filter-2)'%20xlink:href='%23path-1'%3e%3c/use%3e%3cpath%20stroke='%23FFFFFF'%20stroke-width='1'%20d='M19,25%20L19,15%20L16,15%20C15.4477153,15%2015,14.5522847%2015,14%20C15,13.5145897%2015.3479993,13.101915%2015.8654877,13.0100521%20L16,13%20L24,13%20C24.5522847,13%2025,13.4477153%2025,14%20C25,14.4854103%2024.6520007,14.898085%2024.1345123,14.9899479%20L24,15%20L21,15%20L21,25%20L24,25%20C24.5522847,25%2025,25.4477153%2025,26%20C25,26.4854103%2024.6520007,26.898085%2024.1345123,26.9899479%20L24,27%20L16,27%20C15.4477153,27%2015,26.5522847%2015,26%20C15,25.5145897%2015.3479993,25.101915%2015.8654877,25.0100521%20L16,25%20L19,25%20Z'%20fill='%23212324'%20fill-rule='evenodd'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Oa=/* @__PURE__ */new Map([["selector","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKeSURBVHgB3VTLi1JhFD86zlQ4ysxSXAy1GWYZzMxmYAhHagRB/QN8FLqPFq4FIQhXkS6kTQ4t2ilIKEWgSS0SmVpIm0BdaBJSaOP78XU+PXey6+saburAD+73uL/feX0H4H81GQdj7D7ilrCGFRonk3c6nXvhcJiFQiGWy+Xy/X7/WbPZ1K1KkBOsl0qlO36/n+3t7Q1hs9kYF+WC3W73MTpxc1lBmej7KuJaoVDInZ6eqsWXDw4OwGKxwPHx8Se1Wn1Wr9cjW1tbOTxi9D9bJCJHXEFslsvlR263+246nYZZptPpQK/Xg8lkSvZ6vbNGo5EgQRCLiSPhIqpoNHobo3keCARgkalUKjg5ORlGuL+/n8T6PVAqlefjYmKRdYQSsZ3P5z8aDAYVLGFarRbi8fhbhUKhx2VPEJGP3eEbfTrs4MUwr4EU49FYrVbweDy1SqXyipy95FaI7g8QXS6SyWReHx4e2ubVBc+HtTk6OjqvVqtvvF7vi0gkUiSByyyJ21BGwpswJ2Vmsxlw/0Kj0bxMJBJJl8vFPWkhGogLQoeyMhEJo2jGUzYRjcPh+Op0Oq2pVOoHkXE0SahF/w+E+3KYNEaX2pSyiSiKxeJTFPiGyyriO6FKEUgSESLp4ht4bzQaf4pFYrHYO/ysEXGNyJtjKRqM/zNNhFuf0B7vst3dXdjZ2Yn4fL4vRFwn8jaMGqYPU179LBEGf3bZcNNutwPOtScwKnCLPJ9KLMWEh7mNuIFdVsNXzbBNP+D6Ou1vwAqm8hqMWlmbzWYf4mz6HAwGzbjWwGgqrEklmucJT+UGCfG3wiPjueeNwGvB0zkAid7OMmF8CyOck/I6NJcR4KZYcM6J2vCbUGhvyQIA0gonzCEZkQud9Fcd9W/bL57cJu3lkjuNAAAAAElFTkSuQmCC"],["pencil","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ2SURBVHgB7ZXPqxJRFMfvjI4F+cqkTcrjge9B+B+0LJQ27lq4ijZprly6DaF1COKPjYRrVy0CF/aof6Baa6ChOPkLFcdMm1+dM93RafzxZuptgnfgC3ecO+dzz497JOTKNsZMp9OAoihvZFku4xp/I5dsbL/fP221Wl/D4bCKwnWn0znDd+SSDE/N6ZBgMKjJBNuKzC4dHTgQ5PF4bququn7R7XZJPB4/kSTpHcBOiQlmJ6cMpCvAcdz5ZDJhF4tF1u12v4jFYkc8z683+f1+Uq1W38K+x/AogVQ7ETF4SnB+Ho1GTxKJxDFC2u32q1KpJPh8vvVGjHK5XM4xahv+tYgRcranJrNarfay2WwKoVBIRTUajW42m70P390EOYmFrOEGdhfECEMIwur1Og+p5VOp1CP47piCOB3EXBBJAIuLRcZi7zKsSaVSEbxe70N4FEEL0AyE6VuBZEJD2wmyAkHDmoxGIwGW36ljBP2gUEXf5/wXCDZBsVjky+XyUwpCyBL0k0ai7gNp3WUVUigUvgHoWSaTaRoi2YJojk1r52q1eh2JRJ5YgUB3Pc/n83WyXRPV/A1rWrtgSAZsQL6Q3ynTI1F2QdCMqXNQEGsDMqMgrMt6ChwCaXcGYdBFjA3InELkQxBCtkcEI4riHyPFCMnlcnEKMbYzQhRi0TCKa6A76XT6wWAweD8ejz8Oh8PPcEc+9Xq9D8lkMgLv74Hugo5ALmJzlumG4+IG6BZ1dJ06wtPqN14gmza2FYljD1SljrCTsAaYpjnZFP7CmpADEel/ai4qffLiqSUKFSlEP8xfgYwwlmzyr1KYHoUtgBU4Y9D/Y78AxCeE/aWoyrkAAAAASUVORK5CYII="],["eraser","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANKSURBVHgB1VTdS5NhFD/7iuXa8KNw7SK/IjBYo13soqvEITENtj9AwZiCOCTvQrNWF9rFFPGLrC1iF10Oiy68mBSUF2KB4YabhKKyTfFCc+3Lzb2ds72LsfbxCkZ04Mf7Puc5z/k95+M5AP+R8OAvCW9nZ6cyHo8/SSaTc4RQKKQ+S0JyxFtbW6va39//ZjKZmMbGRkar1TJOp5MhYtwXwBkQkgMROnyXIcmGw+FgYrHY00JkQm4cqYPCaDQ6ZrFY7i4sLPxhMDg4SJ8hTOOWRCJ5jf8npyUiEgE6eGy1Wk12u72gIZHJZDLr4eHhVnl5+YdsslL5pH1+JBIx22y2h9PT01BKpFIpLC4ufhKJRFpcxhEM6fmlSMLh8P35+XlOJCTBYBC2t7dr8fdctv+iRHjI4HK5LAMDA8BVFAoFyOVyH/6KIKsxCtVIgC188+Dg4CV2GJxGpqamYHR09AHklEWQY5d6K/gg67HD3huNRrlKpYLNzU3gIsPDw8Dn84fa29s/4zIK6Rol8xIhSUMikXB2dXXV4AHo6en5KhaLFcvLy0VJent7QaPRzKrV6le4DCEi2UTCnGgE1dXVj3Q6XY1er08drKiosK2urnbjnrFQQxBJU1PTC3y4kyxJGHEMWe2dTUSNIcLZVXl0dAStra3BiYmJOTqgVCqfu91uull3LhlFjbZv6urqiCTIElHaEsC2dq4QqXRlZeUePsrUDFtfX/eZzebbqL+GuIFks1js32OHRtHu7u5H3FMiahFViPNQYuZRO8oQVzY2NibJocFgYAKBgLuzs/M66hsQKuzELx0dHak9rKe3paXlFurrERdZEiGUGARkcAFxmSJAJ/aRkRGGnOKwdPn9/rG9vT0HXaC5uZnxer3+vr4+HdpeRVxClBWLJFuZqhF7gAjL0PGz8fFxvcfjSY0WevVUv5mZmQDWyog1/I52PyBdlxgUqUu+qMSQznVtW1ubBlP3dmlpicnA5/N5+vv770C6bhS9lEu6eHnWFP45NioJS5xxRLdNsrenKH5CusNOWH1BEeTRMTnI6MgZpYYeYhhOmS5eEX0mMhELPktGoBd/zCWSUkTAOs4QZqZ8JsokS8Kp8KWICtlwdv5P5BchBHaEIRURoQAAAABJRU5ErkJggg=="],["text","data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDcgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT50ZXh0LWN1cnNvcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGQ9Ik0xNiwyNi41IEMxNS43MjM4NTc2LDI2LjUgMTUuNSwyNi4yNzYxNDI0IDE1LjUsMjYgQzE1LjUsMjUuNzU0NTQwMSAxNS42NzY4NzUyLDI1LjU1MDM5MTYgMTUuOTEwMTI0NCwyNS41MDgwNTU3IEwxNiwyNS41IEwxOS41LDI1LjUgTDE5LjUsMTQuNSBMMTYsMTQuNSBDMTUuNzIzODU3NiwxNC41IDE1LjUsMTQuMjc2MTQyNCAxNS41LDE0IEMxNS41LDEzLjc1NDU0MDEgMTUuNjc2ODc1MiwxMy41NTAzOTE2IDE1LjkxMDEyNDQsMTMuNTA4MDU1NyBMMTYsMTMuNSBMMjQsMTMuNSBDMjQuMjc2MTQyNCwxMy41IDI0LjUsMTMuNzIzODU3NiAyNC41LDE0IEMyNC41LDE0LjI0NTQ1OTkgMjQuMzIzMTI0OCwxNC40NDk2MDg0IDI0LjA4OTg3NTYsMTQuNDkxOTQ0MyBMMjQsMTQuNSBMMjAuNSwxNC41IEwyMC41LDI1LjUgTDI0LDI1LjUgQzI0LjI3NjE0MjQsMjUuNSAyNC41LDI1LjcyMzg1NzYgMjQuNSwyNiBDMjQuNSwyNi4yNDU0NTk5IDI0LjMyMzEyNDgsMjYuNDQ5NjA4NCAyNC4wODk4NzU2LDI2LjQ5MTk0NDMgTDI0LDI2LjUgTDE2LDI2LjUgWiIgaWQ9InBhdGgtMSI+PC9wYXRoPgogICAgICAgIDxmaWx0ZXIgeD0iLTI4NC4wJSIgeT0iLTgxLjUlIiB3aWR0aD0iNjY4LjElIiBoZWlnaHQ9IjI5My45JSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0iZmlsdGVyLTIiPgogICAgICAgICAgICA8ZmVNb3JwaG9sb2d5IHJhZGl1cz0iMSIgb3BlcmF0b3I9ImRpbGF0ZSIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSI+PC9mZU1vcnBob2xvZ3k+CiAgICAgICAgICAgIDxmZU9mZnNldCBkeD0iMCIgZHk9IjIiIGluPSJzaGFkb3dTcHJlYWRPdXRlcjEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0PgogICAgICAgICAgICA8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIzIiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVHYXVzc2lhbkJsdXI+CiAgICAgICAgICAgIDxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29tcG9zaXRlPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4xNiAwIiB0eXBlPSJtYXRyaXgiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlQ29sb3JNYXRyaXg+CiAgICAgICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0i6aG16Z2iLTQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJXaGl0ZWJvYXJkLUd1aWRlbGluZXMiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zODguMDAwMDAwLCAtNjcyLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyBpZD0idGV4dC1jdXJzb3IiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM5Mi4wMDAwMDAsIDY3Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaLlpIfku70tNDAiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuMDEiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcng9IjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMSIgZD0iTTE5LDI1IEwxOSwxNSBMMTYsMTUgQzE1LjQ0NzcxNTMsMTUgMTUsMTQuNTUyMjg0NyAxNSwxNCBDMTUsMTMuNTE0NTg5NyAxNS4zNDc5OTkzLDEzLjEwMTkxNSAxNS44NjU0ODc3LDEzLjAxMDA1MjEgTDE2LDEzIEwyNCwxMyBDMjQuNTUyMjg0NywxMyAyNSwxMy40NDc3MTUzIDI1LDE0IEMyNSwxNC40ODU0MTAzIDI0LjY1MjAwMDcsMTQuODk4MDg1IDI0LjEzNDUxMjMsMTQuOTg5OTQ3OSBMMjQsMTUgTDIxLDE1IEwyMSwyNSBMMjQsMjUgQzI0LjU1MjI4NDcsMjUgMjUsMjUuNDQ3NzE1MyAyNSwyNiBDMjUsMjYuNDg1NDEwMyAyNC42NTIwMDA3LDI2Ljg5ODA4NSAyNC4xMzQ1MTIzLDI2Ljk4OTk0NzkgTDI0LDI3IEwxNiwyNyBDMTUuNDQ3NzE1MywyNyAxNSwyNi41NTIyODQ3IDE1LDI2IEMxNSwyNS41MTQ1ODk3IDE1LjM0Nzk5OTMsMjUuMTAxOTE1IDE1Ljg2NTQ4NzcsMjUuMDEwMDUyMSBMMTYsMjUgTDE5LDI1IFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="],["shape","data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYwLjEgKDg4MTMzKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5zaGFwZS1jdXJzb3I8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0icGF0aC0xIj48L3BhdGg+CiAgICAgICAgPGZpbHRlciB4PSItNjQuNiUiIHk9Ii01OS41JSIgd2lkdGg9IjIyOS4zJSIgaGVpZ2h0PSIyNDYuMSUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlTW9ycGhvbG9neSByYWRpdXM9IjEiIG9wZXJhdG9yPSJkaWxhdGUiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dTcHJlYWRPdXRlcjEiPjwvZmVNb3JwaG9sb2d5PgogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIyIiBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMyIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbXBvc2l0ZT4KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMTYgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9Iumhtemdoi00IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iV2hpdGVib2FyZC1HdWlkZWxpbmVzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ0LjAwMDAwMCwgLTc1MS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9InNoYXBlLWN1cnNvciIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzQ0LjAwMDAwMCwgNzUxLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9ouWkh+S7vS00NCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiByeD0iMiI+PC9yZWN0PgogICAgICAgICAgICAgICAgPGcgaWQ9IuW9oueKtue7k+WQiCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgICAgICA8dXNlIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjEiIGZpbHRlcj0idXJsKCNmaWx0ZXItMikiIHhsaW5rOmhyZWY9IiNwYXRoLTEiPjwvdXNlPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIxIiBkPSJNMjAsMjEgQzIwLjQ4NTQxMDMsMjEgMjAuODk4MDg1LDIxLjM0Nzk5OTMgMjAuOTg5OTQ3OSwyMS44NjU0ODc3IEwyMSwyMiBMMjEsMjcgQzIxLDI3LjU1MjI4NDcgMjAuNTUyMjg0NywyOCAyMCwyOCBDMTkuNTE0NTg5NywyOCAxOS4xMDE5MTUsMjcuNjUyMDAwNyAxOS4wMTAwNTIxLDI3LjEzNDUxMjMgTDE5LDI3IEwxOSwyMiBDMTksMjEuNDQ3NzE1MyAxOS40NDc3MTUzLDIxIDIwLDIxIFogTTI3LDE5IEMyNy41NTIyODQ3LDE5IDI4LDE5LjQ0NzcxNTMgMjgsMjAgQzI4LDIwLjQ4NTQxMDMgMjcuNjUyMDAwNywyMC44OTgwODUgMjcuMTM0NTEyMywyMC45ODk5NDc5IEwyNywyMSBMMjIsMjEgQzIxLjQ0NzcxNTMsMjEgMjEsMjAuNTUyMjg0NyAyMSwyMCBDMjEsMTkuNTE0NTg5NyAyMS4zNDc5OTkzLDE5LjEwMTkxNSAyMS44NjU0ODc3LDE5LjAxMDA1MjEgTDIyLDE5IEwyNywxOSBaIE0xOCwxOSBDMTguNTUyMjg0NywxOSAxOSwxOS40NDc3MTUzIDE5LDIwIEMxOSwyMC40ODU0MTAzIDE4LjY1MjAwMDcsMjAuODk4MDg1IDE4LjEzNDUxMjMsMjAuOTg5OTQ3OSBMMTgsMjEgTDEzLDIxIEMxMi40NDc3MTUzLDIxIDEyLDIwLjU1MjI4NDcgMTIsMjAgQzEyLDE5LjUxNDU4OTcgMTIuMzQ3OTk5MywxOS4xMDE5MTUgMTIuODY1NDg3NywxOS4wMTAwNTIxIEwxMywxOSBMMTgsMTkgWiBNMjAsMTIgQzIwLjQ4NTQxMDMsMTIgMjAuODk4MDg1LDEyLjM0Nzk5OTMgMjAuOTg5OTQ3OSwxMi44NjU0ODc3IEwyMSwxMyBMMjEsMTggQzIxLDE4LjU1MjI4NDcgMjAuNTUyMjg0NywxOSAyMCwxOSBDMTkuNTE0NTg5NywxOSAxOS4xMDE5MTUsMTguNjUyMDAwNyAxOS4wMTAwNTIxLDE4LjEzNDUxMjMgTDE5LDE4IEwxOSwxMyBDMTksMTIuNDQ3NzE1MyAxOS40NDc3MTUzLDEyIDIwLDEyIFoiIGZpbGw9IiMyMTIzMjQiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgZmlsbD0iI0ZGRkZGRiIgeD0iMTguNSIgeT0iMTciIHdpZHRoPSIzIiBoZWlnaHQ9IjYiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSLnn6nlvaIiIGZpbGw9IiNGRkZGRkYiIHg9IjE3IiB5PSIxOC41IiB3aWR0aD0iNiIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjAsMjEuNSBDMjAuMjQ1NDU5OSwyMS41IDIwLjQ0OTYwODQsMjEuNjc2ODc1MiAyMC40OTE5NDQzLDIxLjkxMDEyNDQgTDIwLjUsMjIgTDIwLjUsMjcgQzIwLjUsMjcuMjc2MTQyNCAyMC4yNzYxNDI0LDI3LjUgMjAsMjcuNSBDMTkuNzU0NTQwMSwyNy41IDE5LjU1MDM5MTYsMjcuMzIzMTI0OCAxOS41MDgwNTU3LDI3LjA4OTg3NTYgTDE5LjUsMjcgTDE5LjUsMjIgQzE5LjUsMjEuNzIzODU3NiAxOS43MjM4NTc2LDIxLjUgMjAsMjEuNSBaIE0yNywxOS41IEMyNy4yNzYxNDI0LDE5LjUgMjcuNSwxOS43MjM4NTc2IDI3LjUsMjAgQzI3LjUsMjAuMjQ1NDU5OSAyNy4zMjMxMjQ4LDIwLjQ0OTYwODQgMjcuMDg5ODc1NiwyMC40OTE5NDQzIEwyNywyMC41IEwyMiwyMC41IEMyMS43MjM4NTc2LDIwLjUgMjEuNSwyMC4yNzYxNDI0IDIxLjUsMjAgQzIxLjUsMTkuNzU0NTQwMSAyMS42NzY4NzUyLDE5LjU1MDM5MTYgMjEuOTEwMTI0NCwxOS41MDgwNTU3IEwyMiwxOS41IEwyNywxOS41IFogTTE4LDE5LjUgQzE4LjI3NjE0MjQsMTkuNSAxOC41LDE5LjcyMzg1NzYgMTguNSwyMCBDMTguNSwyMC4yNDU0NTk5IDE4LjMyMzEyNDgsMjAuNDQ5NjA4NCAxOC4wODk4NzU2LDIwLjQ5MTk0NDMgTDE4LDIwLjUgTDEzLDIwLjUgQzEyLjcyMzg1NzYsMjAuNSAxMi41LDIwLjI3NjE0MjQgMTIuNSwyMCBDMTIuNSwxOS43NTQ1NDAxIDEyLjY3Njg3NTIsMTkuNTUwMzkxNiAxMi45MTAxMjQ0LDE5LjUwODA1NTcgTDEzLDE5LjUgTDE4LDE5LjUgWiBNMjAsMTIuNSBDMjAuMjQ1NDU5OSwxMi41IDIwLjQ0OTYwODQsMTIuNjc2ODc1MiAyMC40OTE5NDQzLDEyLjkxMDEyNDQgTDIwLjUsMTMgTDIwLjUsMTggQzIwLjUsMTguMjc2MTQyNCAyMC4yNzYxNDI0LDE4LjUgMjAsMTguNSBDMTkuNzU0NTQwMSwxOC41IDE5LjU1MDM5MTYsMTguMzIzMTI0OCAxOS41MDgwNTU3LDE4LjA4OTg3NTYgTDE5LjUsMTggTDE5LjUsMTMgQzE5LjUsMTIuNzIzODU3NiAxOS43MjM4NTc2LDEyLjUgMjAsMTIuNSBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjMjEyMzI0IiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"]]),Lv=/* @__PURE__ */new Map([["selector",{key:"selector",standardResolution:Oa.get("selector"),highResolution:Ixt}],["shapeSynced",{key:"shape",standardResolution:xxt}],["textSynced",{key:"text",standardResolution:Pxt}],["pencil",{key:"pencil",standardResolution:Oa.get("pencil"),highResolution:Sxt}],["eraser",{key:"eraser",standardResolution:Oa.get("eraser"),highResolution:Txt}],["text",{key:"text",standardResolution:Oa.get("text")}],["shape",{key:"shape",standardResolution:Oa.get("shape")}],["clicker",{key:"clicker",standardResolution:Cxt}]]),Q2="1.1.43-beta.3",bxt="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var r=window.__netlessUA||"";r+=" ".concat(bxt,"@").concat(Q2),window.__netlessUA=r;}var Jr={workerRenderModeBlacklist:{androidWebView:{67:d2.MainThread}},fontFaceFallbackBlacklist:{iosWebView:{12:p2.RefreshTextRender}},syncOpt:{interval:300},bufferSize:{full:4e3,sub:600},bezier:{combineUnitTime:300},pencilEraser:{maxImageWidth:1920,maxImageHeight:1920},backgroundImageLoadOptions:wxt()},ls=function ls(r,t,e){return{images:Lv.get(r),size:{width:26,height:26},offset:{x:0,y:0},local:{size:t,offset:e},synced:{}};},S1=_objectSpread(_objectSpread({},ls("pencil",{width:26,height:26},{x:-2,y:4})),{},{synced:{offset:{x:0,y:9}}}),Axt=_objectSpread(_objectSpread({},ls("selector",{width:25,height:25},{x:-5,y:21})),{},{synced:{offset:{x:0,y:26}}}),Ext=_objectSpread(_objectSpread({},ls("eraser",{width:26,height:26},{x:-8,y:8})),{},{synced:{offset:{x:-5,y:13}}}),Mxt=_objectSpread(_objectSpread({},ls("eraser",{width:26,height:26},{x:-8,y:8})),{},{synced:{offset:{x:-5,y:13}}}),Lxt=ls("eraser",{width:26,height:26},{x:-8,y:8}),Rxt=_objectSpread(_objectSpread({},ls("text",{width:47,height:40},{x:-20,y:20})),{},{synced:{images:Lv.get("textSynced"),offset:{x:-13,y:16}}}),Hi=_objectSpread(_objectSpread({},ls("shape",{width:40,height:40},{x:-20,y:20})),{},{synced:{images:Lv.get("shapeSynced"),offset:{x:-9,y:16}}}),Oxt=_objectSpread(_objectSpread({},ls("clicker",{width:24,height:24},{x:-4,y:21})),{},{synced:{offset:{x:0,y:26}}});Object.freeze((_Object$freeze={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$freeze,_e.selector,Axt),_e.clicker,Oxt),_e.pencil,S1),_e.rectangle,Hi),_e.ellipse,Hi),_e.shape,Hi),_e.eraser,Ext),_e.pencilEraser,Mxt),_e.text,Rxt),_e.straight,Hi),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$freeze,_e.arrow,Hi),_e.laserPen,S1),Qi.star,Hi),Qi.polygon,Hi),Qi.speechBalloon,Hi),Qi.bitMapEraser,Lxt)));function Jn(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var e=r.length;if(e<2)return"";var n=r[0],i=r[1];if(e===2)return"M".concat(Co(n),"L").concat(Co(i));var s="";for(var o=2,a=e-1;o<a;o++)n=r[o],i=r[o+1],s+=xo(n,i);return t?"M".concat(xo(r[0],r[1]),"Q").concat(Co(r[1])).concat(xo(r[1],r[2]),"T").concat(s).concat(xo(r[e-1],r[0])).concat(xo(r[0],r[1]),"Z"):"M".concat(Co(r[0]),"Q").concat(Co(r[1])).concat(xo(r[1],r[2])).concat(r.length>3?"T":"").concat(s,"L").concat(Co(r[e-1]));}function Dxt(r,t){var e=t>0?t:1,n=Math.floor(r.x*e),i=Math.floor(r.y*e),s=Math.ceil((r.x+r.w)*e),o=Math.ceil((r.y+r.h)*e);return{x:n,y:i,w:Math.max(1,s-n),h:Math.max(1,o-i)};}function Nxt(r,t){var n=1/(t>0?t:1);return{x:r.x-n,y:r.y-n,w:r.w+n*2,h:r.h+n*2};}function kxt(r,t,e){var n=Math.abs(e[0])||1,i=Math.abs(e[1])||1;return{size:[t.w/n,t.h/i],textureRect:[(r.x-t.x)/n,(r.y-t.y)/i,r.w/n,r.h/i]};}var J2={exports:{}};(function(r){var t=function(){var e=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function o(u,h){if(!s[u]){s[u]={};for(var v=0;v<u.length;v++)s[u][u.charAt(v)]=v;}return s[u][h];}var a={compressToBase64:function compressToBase64(u){if(u==null)return"";var h=a._compress(u,6,function(v){return n.charAt(v);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(u){return u==null?"":u==""?null:a._decompress(u.length,32,function(h){return o(n,u.charAt(h));});},compressToUTF16:function compressToUTF16(u){return u==null?"":a._compress(u,15,function(h){return e(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(u){return u==null?"":u==""?null:a._decompress(u.length,16384,function(h){return u.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
403
403
|
compressToUint8Array:function compressToUint8Array(u){for(var h=a.compress(u),v=new Uint8Array(h.length*2),p=0,y=h.length;p<y;p++){var C=h.charCodeAt(p);v[p*2]=C>>>8,v[p*2+1]=C%256;}return v;},//decompress from uint8array (UCS-2 big endian format)
|
|
404
404
|
decompressFromUint8Array:function decompressFromUint8Array(u){if(u==null)return a.decompress(u);for(var h=new Array(u.length/2),v=0,p=h.length;v<p;v++)h[v]=u[v*2]*256+u[v*2+1];var y=[];return h.forEach(function(C){y.push(e(C));}),a.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
405
405
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(u){return u==null?"":a._compress(u,6,function(h){return i.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
|
406
|
-
decompressFromEncodedURIComponent:function decompressFromEncodedURIComponent(u){return u==null?"":u==""?null:(u=u.replace(/ /g,"+"),a._decompress(u.length,32,function(h){return o(i,u.charAt(h));}));},compress:function compress(u){return a._compress(u,16,function(h){return e(h);});},_compress:function _compress(u,h,v){if(u==null)return"";var p,y,C={},b={},M="",L="",X="",Y=2,et=3,A=2,w=[],S=0,x=0,P;for(P=0;P<u.length;P+=1)if(M=u.charAt(P),Object.prototype.hasOwnProperty.call(C,M)||(C[M]=et++,b[M]=!0),L=X+M,Object.prototype.hasOwnProperty.call(C,L))X=L;else{if(Object.prototype.hasOwnProperty.call(b,X)){if(X.charCodeAt(0)<256){for(p=0;p<A;p++)S=S<<1,x==h-1?(x=0,w.push(v(S)),S=0):x++;for(y=X.charCodeAt(0),p=0;p<8;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}else{for(y=1,p=0;p<A;p++)S=S<<1|y,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=0;for(y=X.charCodeAt(0),p=0;p<16;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}Y--,Y==0&&(Y=Math.pow(2,A),A++),delete b[X];}else for(y=C[X],p=0;p<A;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;Y--,Y==0&&(Y=Math.pow(2,A),A++),C[L]=et++,X=String(M);}if(X!==""){if(Object.prototype.hasOwnProperty.call(b,X)){if(X.charCodeAt(0)<256){for(p=0;p<A;p++)S=S<<1,x==h-1?(x=0,w.push(v(S)),S=0):x++;for(y=X.charCodeAt(0),p=0;p<8;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}else{for(y=1,p=0;p<A;p++)S=S<<1|y,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=0;for(y=X.charCodeAt(0),p=0;p<16;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}Y--,Y==0&&(Y=Math.pow(2,A),A++),delete b[X];}else for(y=C[X],p=0;p<A;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;Y--,Y==0&&(Y=Math.pow(2,A),A++);}for(y=2,p=0;p<A;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;for(;;)if(S=S<<1,x==h-1){w.push(v(S));break;}else x++;return w.join("");},decompress:function decompress(u){return u==null?"":u==""?null:a._decompress(u.length,32768,function(h){return u.charCodeAt(h);});},_decompress:function _decompress(u,h,v){var p=[],y=4,C=4,b=3,M="",L=[],X,Y,et,A,w,S,x,P={val:v(0),position:h,index:1};for(X=0;X<3;X+=1)p[X]=X;for(et=0,w=Math.pow(2,2),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;switch(et){case 0:for(et=0,w=Math.pow(2,8),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;x=e(et);break;case 1:for(et=0,w=Math.pow(2,16),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;x=e(et);break;case 2:return"";}for(p[3]=x,Y=x,L.push(x);;){if(P.index>u)return"";for(et=0,w=Math.pow(2,b),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;switch(x=et){case 0:for(et=0,w=Math.pow(2,8),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;p[C++]=e(et),x=C-1,y--;break;case 1:for(et=0,w=Math.pow(2,16),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;p[C++]=e(et),x=C-1,y--;break;case 2:return L.join("");}if(y==0&&(y=Math.pow(2,b),b++),p[x])M=p[x];else if(x===C)M=Y+Y.charAt(0);else return null;L.push(M),p[C++]=Y+M.charAt(0),y--,Y=M,y==0&&(y=Math.pow(2,b),b++);}}};return a;}();r!=null?r.exports=t:(typeof angular==="undefined"?"undefined":_typeof(angular))<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return t;});})(J2);var _2=J2.exports;function ks(r){return JSON.parse(_2.decompress(r));}function Br(r){return _2.compress(JSON.stringify(r));}var T1=/* @__PURE__ */new WeakMap(),Zr=/*#__PURE__*/function(){function Zr(t){_classCallCheck(this,Zr);ht(this,"maxImageWidth",Jr.pencilEraser.maxImageWidth);ht(this,"maxImageHeight",Jr.pencilEraser.maxImageHeight);ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"vNodes");ht(this,"drawLayer");ht(this,"fullLayer");ht(this,"workId");ht(this,"confirmEraserDeletion",!1);ht(this,"isDelete",!1);var e=t.vNodes,n=t.fullLayer,i=t.drawLayer,s=t.workId,o=t.toolsOpt;this.vNodes=e,this.fullLayer=n,this.drawLayer=i,this.workId=s,this.syncUnitTime=o.syncUnitTime||this.syncUnitTime;}return _createClass(Zr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return t.reduce(function(n,i){var s=n[n.length-1];return(i&&!s||i&&s&&!i.isNear(s,e))&&n.push(i),n;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(t){this.workId=t;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}},{key:"setEraserDeleteConfirmation",value:function setEraserDeleteConfirmation(t){this.confirmEraserDeletion=t;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(t){var s,o,a;var e=Yy(this.workOptions,t);this.workOptions=e,this.syncUnitTime=t.syncUnitTime||this.syncUnitTime;var n=(s=this.workId)==null?void 0:s.toString(),i=n&&((o=this.vNodes)==null?void 0:o.get(n))||void 0;n&&i&&(i.opt=gp(e),(a=this.vNodes)==null||a.setInfo(n,i));}},{key:"getRenderableEraserLines",value:function getRenderableEraserLines(t){return[].concat(_toConsumableArray(t.eraserlines||[]),_toConsumableArray(t.doingLines||[]));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(t){var i,s;var e;var n=(i=this.workId)==null?void 0:i.toString();if(n&&t){var o=this.fullLayer.getElementsByName(n)||this.drawLayer&&this.drawLayer.getElementsByName(n)||[];if(o.length!==1)return;var a=o[0],u=t.pos,h=t.zIndex,v=t.scale,p=t.angle,y=t.translate,C={};$e(h)&&(C.zIndex=h),u&&(C.pos=[u[0],u[1]]),v&&(C.scale=v),p&&(C.rotate=p),y&&(C.translate=y),a.attr(C);var b=a==null?void 0:a.getBoundingClientRect();return b&&(e=Kt(e,{x:Math.floor(b.x-Zr.SafeBorderPadding),y:Math.floor(b.y-Zr.SafeBorderPadding),w:Math.floor(b.width+Zr.SafeBorderPadding*2),h:Math.floor(b.height+Zr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(n,{rect:e,centerPos:u}),e;}}},{key:"drawEraserlines",value:function drawEraserlines(t,e){var n=t.group,_t$eraserlines=t.eraserlines,i=_t$eraserlines===void 0?[]:_t$eraserlines,s=t.eraserFaces,o=t.pos,a=t.layer,u=a.parent;if(e)try{var v=(a.renderer.glRenderer||a.renderer.canvasRenderer).options.displayRatio,p=n.getBoundingClientRect(),y=p.width*v*a.worldScaling[0],C=p.height*v*a.worldScaling[1];var b=1;if((y>this.maxImageWidth||C>this.maxImageHeight)&&(b=Math.min(this.maxImageWidth/y,this.maxImageHeight/C)),u.renderer.glRenderer&&!this.confirmEraserDeletion&&this.drawEraserMask({group:n,eraserlines:i,eraserFaces:s,pos:o,layer:a,targetScale:b}))return;var M=a.getAttribute("scale");M=[M[0]*b,M[1]*b];var L=a.parent.parent,X=a.getAttribute("translate"),Y=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),L,{offscreen:u.offscreen,width:u.width,height:u.height,contextType:"2d",autoRender:!1,bufferSize:500},M,X),et=n.cloneNode(!0);if(!i.length&&!s)return;s&&this.addEraserFaces(et,s,o,!1),this.addEraserlines(et,i,o,!1),Y.appendChild(et);var A=Y.parent;A.render();var w=Y.renderer.canvasRenderer,S=w.context;if(!S)return;var x=w.options.displayRatio,P=et.getBoundingClientRect(),z={x:P.x,y:P.y,w:P.width,h:P.height},U={x:0,y:0,w:L.width,h:L.height};if(el(z,U)===es.outside){Kr(et,A),L.removeChild(A),this.isDelete=!0;return;}var j=Nxt(z,x),nt=gr(j);nt.x=Math.floor(Math.max(j.x,0)),nt.y=Math.floor(Math.max(j.y,0)),nt.w=Math.min(j.x+j.w,L.width)-nt.x,nt.h=Math.min(j.y+j.h,L.height)-nt.y;var ct=this.getGroupRect(nt,x),B=ct.x,N=ct.y,G=ct.w,q=ct.h;var at=S.getImageData(B,N,G,q);if(this.confirmEraserDeletion&&this.isTransparentRectByCanvas(at)){Kr(et,A),L.removeChild(A),this.isDelete=!0,at=null;return;}if(this.confirmEraserDeletion&&u.renderer.glRenderer&&this.drawEraserMask({group:n,eraserlines:i,eraserFaces:s,pos:o,layer:a,targetScale:b})){Kr(et,A),L.removeChild(A),at=null;return;}Kr(n,u);var ut=this.createSpriteNode({imageData:at,safariRect:nt,originRect:j,worldScaling:Y.worldScaling});ut&&n.append(ut),Kr(et,A),L.removeChild(A),u.deleteTexture(at),at=null;}catch(h){console.error("[BaseShapeTool] drawEraserlines error:",h);return;}}},{key:"drawEraserMask",value:function drawEraserMask(t){var S,x;var e=t.group,n=t.eraserlines,i=t.eraserFaces,s=t.pos,o=t.layer,a=t.targetScale;if(!n.length&&!i||e.getAttribute("clipPath"))return!1;var u=Number(e.getAttribute("width")),h=Number(e.getAttribute("height"));if(!(u>0)||!(h>0))return!1;var v=o.parent.renderer;if(!v.glRenderer)return!1;var p=v.options.displayRatio||1,y=Math.max(1,Math.ceil(u*p*o.worldScaling[0]*a)),C=Math.max(1,Math.ceil(h*p*o.worldScaling[1]*a)),b=[-u/2,-h/2,u,h];var M=T1.get(o);M||(M=/* @__PURE__ */new Map(),T1.set(o,M)),this.pruneEraserMaskCaches(o,M,v);var L=M.get(this.workId),X=!L||L.pixelWidth!==y||L.pixelHeight!==C||L.facesKey!==(i==null?void 0:i.d);if(L&&!X&&(X=this.isEraserMaskPrefixChanged(L,n)),X){if(L==null||L.handle.destroy(v),L=this.createEraserMaskCache(y,C,b),!L)return!1;M.set(this.workId,L);}if(!L)return!1;var Y=y/u,et=C/h;L.context.setTransform(Y,0,0,et,y/2,C/2),X&&i&&(this.appendEraserMaskFaces(L.context,i,s),L.facesKey=i.d);var A=X,w;var _iterator21=_createForOfIteratorHelper(n),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var P=_step21.value;var z=L.commands.get(P.workId),U=X?0:(z==null?void 0:z.count)||0;for(var K=U;K<P.op.length;K++)A=!0,w=Kt(w,this.appendEraserMaskStroke(L.context,P.op[K],P.thickness,s));L.commands.set(P.workId,{count:P.op.length,thickness:P.thickness,first:(S=P.op[0])==null?void 0:S.slice(0,2),last:(x=P.op[P.op.length-1])==null?void 0:x.slice(-2)});}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}return A&&L.handle.update({rect:b,dirtyRect:X||!w?void 0:[w.x,w.y,w.w,w.h]}),e.setMask(L.handle,{rect:b}),!0;}},{key:"pruneEraserMaskCaches",value:function pruneEraserMaskCaches(t,e,n){var _iterator22=_createForOfIteratorHelper(e),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _step22$value=_slicedToArray(_step22.value,2),i=_step22$value[0],s=_step22$value[1];i!==this.workId&&t.getElementsByName(i).length===0&&(s.handle.destroy(n),e.delete(i));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}},{key:"createEraserMaskCache",value:function createEraserMaskCache(t,e,n){var o,a;var i;typeof OffscreenCanvas=="function"?i=new OffscreenCanvas(t,e):(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&(i=document.createElement("canvas"),i.width=t,i.height=e);var s=i==null?void 0:i.getContext("2d");if(!(!i||!s))return s.save(),s.setTransform(1,0,0,1,0,0),s.fillStyle="#fff",s.fillRect(0,0,t,e),s.restore(),{canvas:i,context:s,handle:new nmt(i,{rect:n,singleChannelTexture:((o=this.fullLayer.parent.renderer.options.bitmapEraserMaskOptions)==null?void 0:o.singleChannelTexture)!==!1,textureSubImage2D:((a=this.fullLayer.parent.renderer.options.bitmapEraserMaskOptions)==null?void 0:a.textureSubImage2D)!==!1}),rect:n,pixelWidth:t,pixelHeight:e,commands:/* @__PURE__ */new Map()};}},{key:"appendEraserMaskStroke",value:function appendEraserMaskStroke(t,e,n,i){if(e.length<2)return;t.save(),t.fillStyle="#000",t.strokeStyle="#000",t.lineCap="round",t.lineJoin="round",t.lineWidth=n;var s=e[0]-i[0],o=e[1]-i[1];if(e.length===2)t.beginPath(),t.arc(s,o,n/2,0,Math.PI*2),t.fill();else{t.beginPath(),t.moveTo(s,o);for(var b=2;b<e.length;b+=2)t.lineTo(e[b]-i[0],e[b+1]-i[1]);t.stroke();}t.restore();var a=[],u=[];for(var _b2=0;_b2<e.length;_b2+=2)a.push(e[_b2]-i[0]),u.push(e[_b2+1]-i[1]);var h=n/2+1,v=Math.min.apply(Math,a),p=Math.min.apply(Math,u),y=Math.max.apply(Math,a),C=Math.max.apply(Math,u);return{x:v-h,y:p-h,w:y-v+h*2,h:C-p+h*2};}},{key:"appendEraserMaskFaces",value:function appendEraserMaskFaces(t,e,n){t.save(),t.fillStyle="#000",t.beginPath();var _iterator23=_createForOfIteratorHelper(pu(e)),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var i=_step23.value;var _iterator24=_createForOfIteratorHelper(i.rings),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var s=_step24.value;s.forEach(function(_ref59,u){var _ref60=_slicedToArray(_ref59,2),o=_ref60[0],a=_ref60[1];var h=o-n[0],v=a-n[1];u===0?t.moveTo(h,v):t.lineTo(h,v);}),t.closePath();}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}t.fill("evenodd"),t.restore();}},{key:"isEraserMaskPrefixChanged",value:function isEraserMaskPrefixChanged(t,e){var n,i;if(t.commands.size>e.length)return!0;var _iterator25=_createForOfIteratorHelper(e),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var s=_step25.value;var o=t.commands.get(s.workId);if(o&&(s.op.length<o.count||s.thickness!==o.thickness||!this.isSamePoint(o.first,(n=s.op[0])==null?void 0:n.slice(0,2))||!this.isSamePoint(o.last,(i=s.op[o.count-1])==null?void 0:i.slice(-2))))return!0;}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}return!1;}},{key:"isSamePoint",value:function isSamePoint(t,e){return!t||!e?t===e:t[0]===e[0]&&t[1]===e[1];}},{key:"createVmRenderNode",value:function createVmRenderNode(t,e,n,i,s){var o=n.width,a=n.height,u="bitMap-".concat(t),h=e.layer(u,n),v=new nr({anchor:[0.5,0.5],pos:[o*0.5,a*0.5],size:[o,a],name:"viewport",id:t});return v.setAttribute("scale",i),v.setAttribute("translate",s),h.append(v),v;}},{key:"getGroupRect",value:function getGroupRect(t,e){return Dxt(t,e);}},{key:"addEraserlines",value:function addEraserlines(t,e,n){var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator26=_createForOfIteratorHelper(e),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var s=_step26.value;var o=s.thickness,a=s.op;var _iterator27=_createForOfIteratorHelper(a),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var u=_step27.value;var h=u.map(function(b,M){return M%2?b-n[1]:b-n[0];}),v=this.computEraserPoints(h,o),p=Jn(v,!0),y={pos:[0,0],d:p,fillColor:"rgba(0,0,0,1)"},C=new $r(y);C.addEventListener("beforerender",function(_ref61){var b=_ref61.detail;var M=b.context;i?M.blendFuncSeparate(M.ZERO,M.ZERO,M.ZERO,M.ZERO):M.globalCompositeOperation="destination-out";}),C.addEventListener("afterrender",function(_ref62){var b=_ref62.detail;var M=b.context;i?M.blendFuncSeparate(M.SRC_ALPHA,M.ONE_MINUS_SRC_ALPHA,M.ONE,M.ONE_MINUS_SRC_ALPHA):M.globalCompositeOperation="source-over";}),t.append(C);}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}}},{key:"addEraserFaces",value:function addEraserFaces(t,e,n){var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var s=pu(e).flatMap(function(a){return a.rings.map(function(u){return Jn(u.map(function(_ref63){var _ref64=_slicedToArray(_ref63,2),h=_ref64[0],v=_ref64[1];return new _t(h-n[0],v-n[1]);}),!0);});}).join(" ");if(!s)return;var o=new $r({pos:[0,0],d:s,fillColor:"rgba(0,0,0,1)",fillRule:"evenodd"});o.addEventListener("beforerender",function(_ref65){var a=_ref65.detail;var u=a.context;i?u.blendFuncSeparate(u.ZERO,u.ZERO,u.ZERO,u.ZERO):u.globalCompositeOperation="destination-out";}),o.addEventListener("afterrender",function(_ref66){var a=_ref66.detail;var u=a.context;i?u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA):u.globalCompositeOperation="source-over";}),t.append(o);}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(t){var e=!0;for(var n=0;n<t.data.length;n+=4)if(t.data[n+3]!==0){e=!1;break;}return e;}},{key:"createSpriteNode",value:function createSpriteNode(t){var e=t.imageData,n=t.worldScaling,i=t.safariRect,s=t.originRect;var o;if(typeof OffscreenCanvas=="function"){o=new OffscreenCanvas(e.width,e.height);var y=o.getContext("2d");y&&y.putImageData(e,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){o=document.createElement("canvas"),o.width=e.width,o.height=e.height;var _y2=o.getContext("2d");_y2&&_y2.putImageData(e,0,0);}if(!o)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var _kxt=kxt(i,s,n),a=_kxt.size,u=_kxt.textureRect,h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:a,texture:o,textureRect:u},v=new af(h);var p=!0;return v.addEventListener("beforerender",function(_ref67){var y=_ref67.detail;var C=y.context;typeof C.imageSmoothingEnabled=="boolean"&&(p=C.imageSmoothingEnabled,C.imageSmoothingEnabled=!1);}),v.addEventListener("afterrender",function(_ref68){var y=_ref68.detail;var C=y.context;typeof C.imageSmoothingEnabled=="boolean"&&(C.imageSmoothingEnabled=p);}),v;}},{key:"computEraserPoints",value:function computEraserPoints(t,e){var n=Math.ceil(e/2);return t.length===2?this.computDot(t,n):this.computLine(t,n);}},{key:"computDot",value:function computDot(t,e){var n=new _t(t[0],t[1]);return _t.GetDotStroke(n,e,8);}},{key:"computLine",value:function computLine(t,e){var n=[],i=[];var s,o;for(var a=0;a<t.length;a+=2){var u=new _t(t[a],t[a+1]);var h=void 0;if(a==t.length-2){var v=new _t(t[a-2],t[a-1]);h=xt.Sub(u,v).uni(),s=u;}else{a===0&&(o=u);var _v2=new _t(t[a+2],t[a+3]);h=xt.Sub(_v2,u).uni();}if(h){var _v3=xt.Per(h).mul(e);n.push(_t.Sub(u,_v3)),i.push(_t.Add(u,_v3));}}if(s&&o){var _a6=_t.GetSemicircleStroke(s,n[n.length-1],-1,8),_u4=_t.GetSemicircleStroke(o,i[0],-1,8);return n.concat(_a6,i.reverse(),_u4);}return[];}},{key:"replace",value:function replace(t,e,n){var _this40=this;var s;if(!e){n&&t.append(n);return;}var i=t.getElementsByName(e);if(i.length){var _iterator28=_createForOfIteratorHelper(i),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var o=_step28.value;n?aAt(n,o,t):(o.remove(),_zr(o,t.parent));}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}}else n&&t.append(n);this.fullLayer!==this.drawLayer&&(this.fullLayer===t?(s=this.drawLayer)==null||s.getElementsByName(e).forEach(function(a){var u;a.remove(),_zr(a,(u=_this40.drawLayer)==null?void 0:u.parent);}):this.fullLayer.getElementsByName(e).forEach(function(a){a.remove(),_zr(a,_this40.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(t,e){var n=[];t.getElementsByName(this.workId).forEach(function(i){i.id&&e&&Number(i.id)<e&&n.push(i);});for(var _i3=0,_n3=n;_i3<_n3.length;_i3++){var i=_n3[_i3];i.remove(),_zr(i,t.parent);}}}],[{key:"normalizeStorageData",value:function(){var _normalizeStorageData=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(t){return _regenerator().w(function(_context10){while(1)switch(_context10.n){case 0:return _context10.a(2,this.normalizeStorageDataSync(t));}},_callee10,this);}));function normalizeStorageData(_x16){return _normalizeStorageData.apply(this,arguments);}return normalizeStorageData;}()},{key:"normalizeStorageDataSync",value:function normalizeStorageDataSync(t){var e=gr(t),n=JSON.stringify(t);if(e.opt){var i=gp(e.opt);e.opt=Yy(void 0,i);}return e.updateNodeOpt=_objectSpread(_objectSpread({},e.updateNodeOpt),{},{useAnimation:!1}),{status:JSON.stringify(e)===n?"already-stable":"stable",value:e};}},{key:"normalizeDrawableStorageData",value:function(){var _normalizeDrawableStorageData=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(t){return _regenerator().w(function(_context11){while(1)switch(_context11.n){case 0:return _context11.a(2,this.normalizeDrawableStorageDataSync(t));}},_callee11,this);}));function normalizeDrawableStorageData(_x17){return _normalizeDrawableStorageData.apply(this,arguments);}return normalizeDrawableStorageData;}()},{key:"normalizeDrawableStorageDataSync",value:function normalizeDrawableStorageDataSync(t){var e=Zr.normalizeStorageDataSync(t);if(e.status==="unrecoverable")return e;var n=e.value;return n.type===It.DrawWork&&!n.ops&&Array.isArray(n.op)&&n.op.length?(n.type=It.FullWork,n.ops=Br(n.op),{status:"stable",value:n}):e;}},{key:"updateNodeOpt",value:function updateNodeOpt(t){var S;var e=t.node,n=t.opt,i=t.vNodes,s=t.willSerializeData,o=t.targetNode,a=n.zIndex,u=n.translate,h=n.angle,v=n.originPoint,p=n.scenePoint,y=n.scale,C=n.pointMap,b=n.thickness;var M;var L=o&&gr(o)||i.get(e.name);if(!L)return;var X=n.eraserGeometryDelta,et=!!X||!!v&&!!y&&!!o||!!s&&(!!u||$e(h))?Wo(L.op,L.centerPos):void 0;if(X&&(!et||!w2(X,L.op,L.centerPos)))return;X&&mv(i,e.name,X.matrix);var A;$e(a)&&(e.setAttribute("zIndex",a),L.opt.zIndex=a);var w=e.parent;if(w){if(v&&y&&o){var _L$opt$eraserFaces;if(A=[y[0],0,0,y[1],p[0]*(1-y[0])+((u==null?void 0:u[0])||0),p[1]*(1-y[1])+((u==null?void 0:u[1])||0)],yf(L.op,p,y,u),ja(L.centerPos,p,y,u),L.opt.translate=void 0,L.opt.scale=void 0,L.opt.eraserlines)for(var x=0;x<L.opt.eraserlines.length;x++){var _L$opt$eraserlines$x=L.opt.eraserlines[x],P=_L$opt$eraserlines$x.op,z=_L$opt$eraserlines$x.thickness;L.opt.eraserlines[x].thickness=Math.round(z*Math.max(Math.abs(y[0]),Math.abs(y[1])));for(var U=0;U<P.length;U++)ja(P[U],p,y,u);}No(L.opt)&&(L.opt.eraserFaces=Ld((_L$opt$eraserFaces=L.opt.eraserFaces)!==null&&_L$opt$eraserFaces!==void 0?_L$opt$eraserFaces:null,function(x){return ja(x,p,y,u);}),delete L.opt.eraserlines);}else if(u){if(e.setAttribute("translate",u),L.opt.translate=u,o){var _x18=[u[0]*w.worldScaling[0],u[1]*w.worldScaling[1]];M=tl(L.rect,_x18),L.rect=M;}else{var _x19=Zr.getRectFromLayer(w,e.name);L.rect=_x19||L.rect;}}else if($e(h))if(e.setAttribute("rotate",h),L.opt.rotate=h,o)M=Uv(L.rect,h),L.rect=M;else{var _x20=Zr.getRectFromLayer(w,e.name);L.rect=_x20||L.rect;}if(C){var _x21=C.get(e.name);if(_x21)for(var _P3=0,_z2=0;_P3<L.op.length;_P3+=3,_z2++)L.op[_P3]=_x21[_z2][0],L.op[_P3+1]=_x21[_z2][1];}if(b&&(S=L==null?void 0:L.opt)!=null&&S.thickness&&(L.opt.thickness=b),s&&!(v&&y&&o)){if(u){var _L$opt$eraserFaces2;A=[1,0,0,1,u[0],u[1]];var _x22=L.op.map(function(P,z){var U=z%3;return U===0?P+u[0]:U===1?P+u[1]:P;});if(L.op=_x22,L.centerPos=[L.centerPos[0]+u[0],L.centerPos[1]+u[1]],L!=null&&L.opt&&(L.opt.translate=void 0),L.opt.eraserlines)for(var _P4=0;_P4<L.opt.eraserlines.length;_P4++){var _z3=L.opt.eraserlines[_P4].op;for(var _U2=0;_U2<_z3.length;_U2++){var K=_z3[_U2].map(function(j,nt){return nt%2?j+u[1]:j+u[0];});L.opt.eraserlines[_P4].op[_U2]=K;}}No(L.opt)&&(L.opt.eraserFaces=Ld((_L$opt$eraserFaces2=L.opt.eraserFaces)!==null&&_L$opt$eraserFaces2!==void 0?_L$opt$eraserFaces2:null,function(P){for(var _z4=0;_z4<P.length;_z4+=2)P[_z4]+=u[0],P[_z4+1]+=u[1];}),delete L.opt.eraserlines);}else if($e(h)){var _L$opt$eraserFaces3;var _x23=Math.PI*h/180,_P5=Math.cos(_x23),_z5=Math.sin(_x23),_L$centerPos=_slicedToArray(L.centerPos,2),_U3=_L$centerPos[0],_K2=_L$centerPos[1];A=[_P5,_z5,-_z5,_P5,_U3-_P5*_U3+_z5*_K2,_K2-_z5*_U3-_P5*_K2];var j=L.op;if(tAt(j,L.centerPos,h),L.op=j,L!=null&&L.opt&&(L.opt.rotate=void 0),L.opt.eraserlines)for(var nt=0;nt<L.opt.eraserlines.length;nt++){var ct=L.opt.eraserlines[nt].op;for(var B=0;B<ct.length;B++)$1(ct[B],L.centerPos,h);}No(L.opt)&&(L.opt.eraserFaces=Ld((_L$opt$eraserFaces3=L.opt.eraserFaces)!==null&&_L$opt$eraserFaces3!==void 0?_L$opt$eraserFaces3:null,function(nt){return $1(nt,L.centerPos,h);}),delete L.opt.eraserlines);}}if(et&&A){var _x24=Wo(L.op,L.centerPos);if(X&&X.toDigest!==_x24)return;X||(Amt(i,e.name,o,A),bmt(i,e.name,{matrix:A,fromDigest:et,toDigest:_x24},o));}L&&i.setInfo(e.name,L);}}},{key:"getCenterPos",value:function getCenterPos(t,e){var n=e.worldPosition,i=e.worldScaling;return[(t.x+t.w/2-n[0])/i[0],(t.y+t.h/2-n[1])/i[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(t,e){var n=t.getElementsByName(e)[0];if(n){var i=n.getBoundingClientRect();return{x:Math.floor(i.x-Zr.SafeBorderPadding),y:Math.floor(i.y-Zr.SafeBorderPadding),w:Math.floor(i.width+Zr.SafeBorderPadding*2),h:Math.floor(i.height+Zr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(t){var e=t.toolsType,n=t.opt,i=t.node,s=t.updateOpt,o=t.willSerializeData;return!!(o&&(s.angle||s.translate)||s.thickness&&n.thickness&&n.thickness!==s.thickness||s.strokeType&&n.strokeType&&n.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(i.name)||e===St.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(i.name))||e===St.BackgroundSVG&&(s.translate||s.scale)||e===St.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&n.type===lf.Iconify)||e===s.toolsType&&s.willRefresh||n.eraserlines&&n.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();ht(Zr,"SafeBorderPadding",10);var Gt=Zr;var Rv=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);function tT(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;return Math.abs(r[0]-t[0])<e&&Math.abs(r[1]-t[1])<e;}function Bxt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(r.length===0)return[];var e=[[r[0][0],r[0][1]]];for(var n=1;n<r.length;n++)tT([r[n][0],r[n][1]],e[e.length-1],t)||e.push([r[n][0],r[n][1]]);return e;}function Fxt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(r.length<=2)return r;var e=r[0],n=r[r.length-1];return tT(e,n,t)?r.slice(0,-1):r;}function Wxt(r){var t=r.reduce(function(n,i){return n+i[0];},0)/r.length,e=r.reduce(function(n,i){return n+i[1];},0)/r.length;return[t,e];}function I1(r,t){return Math.atan2(t[1]-r[1],t[0]-r[0]);}function Uxt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(r.length<=2)return r;var e=[];var _iterator29=_createForOfIteratorHelper(r),_step29;try{var _loop3=function _loop3(){var i=_step29.value;e.some(function(o){return Math.abs(o[0]-i[0])<t&&Math.abs(o[1]-i[1])<t;})||e.push([i[0],i[1]]);};for(_iterator29.s();!(_step29=_iterator29.n()).done;){_loop3();}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}var n=Wxt(e);return e.sort(function(i,s){var o=I1(n,i),a=I1(n,s);return o-a;});}function zxt(r,t){var e=t[0].x<t[t.length-1].x;return r.map(function(i){var o=i.map(function(a){var u=-1,h=1/0,v=0;for(var p=0;p<t.length;p++){var y=t[p],C=Math.sqrt(Math.pow(y.x-a[0],2)+Math.pow(y.y-a[1],2));C<h&&(h=C,u=p,v=y.z);}return{point:a,index:u,bestZ:v};}).sort(function(a,u){return a.index-u.index;}).map(function(a){return[].concat(_toConsumableArray(a.point),[a.bestZ]);});return e&&o[0][0]>o[o.length-1][0]||!e&&o[0][0]<o[o.length-1][0]?o.reverse():o;}).sort(function(i,s){var o=i[0][0],a=s[0][0];return e?o-a:a-o;});}function $xt(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;var i=r.map(function(p){return[p.x,p.y];}),s=function s(p,y){return p.map(function(_ref69){var _ref70=_slicedToArray(_ref69,2),C=_ref70[0],b=_ref70[1];return{X:Math.round(C*y),Y:Math.round(b*y)};});},o=new vr.ClipperOffset();o.AddPath(s(i,1e3),vr.JoinType.jtRound,vr.EndType.etOpenButt);var a=[];o.Execute(a,1);var u=new vr.Clipper();u.AddPaths(a,vr.PolyType.ptSubject,!0),t.forEach(function(p){u.AddPath(s(p,1e3),vr.PolyType.ptClip,!0);});var h=new vr.Paths();u.Execute(vr.ClipType.ctDifference,h,vr.PolyFillType.pftNonZero,vr.PolyFillType.pftNonZero);var v=h.map(function(p){return Fxt(Uxt(Bxt(p.map(function(y){return[y.X/1e3,y.Y/1e3];}),e),e),e);}).filter(function(p){return p.length>=2;});return zxt(v,r);}var eT=/*#__PURE__*/function(_Gt){function eT(e){var _this41;_classCallCheck(this,eT);_this41=_callSuper(this,eT,[e]);ht(_this41,"canRotate",!0);ht(_this41,"scaleType",Ae.all);ht(_this41,"toolsType",St.Pencil);ht(_this41,"syncTimestamp");ht(_this41,"syncIndex",0);ht(_this41,"tmpPoints",[]);ht(_this41,"MAX_REPEAR",10);/** 合并原始点的灵敏度 */ht(_this41,"uniThickness");ht(_this41,"workOptions");ht(_this41,"centerPos",[0,0]);_this41.workOptions=e.toolsOpt,_this41.uniThickness=_this41.MAX_REPEAR/_this41.workOptions.thickness/10,_this41.syncTimestamp=0;return _this41;}_inherits(eT,_Gt);return _createClass(eT,[{key:"setPointVector",value:function setPointVector(e,n){if(!n)return!1;var i=e.x-n.x,s=e.y-n.y;if(i===0&&s===0)return!1;var o=xt.Sub(e,n).uni();return!Number.isFinite(o.x)||!Number.isFinite(o.y)?!1:(e.setv(o),!0);}/** 批量合并消费本地数据,返回绘制结果 */},{key:"combineConsume",value:function combineConsume(){var a;var e=(a=this.workId)==null?void 0:a.toString();if(this.tmpPoints.length<2)return{type:It.None};var n=this.transformDataAll(!0),i={name:e};var s;var o=this.drawLayer||this.fullLayer;return n.length&&(s=this.draw({attrs:i,tasks:n,replaceId:e,layer:o})),{rect:s,type:It.DrawWork,dataType:Qt.Local};}},{key:"setWorkOptions",value:function setWorkOptions(e){_superPropGet(eT,"setWorkOptions",this,3)([e]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(e){var _this42=this;var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.drawCount,u=e.removeDrawCount,h=e.isSimpleWorker,v=n.workId,p=n.syncUnitTime;p&&(this.syncUnitTime=p);var _this$transformData=this.transformData(n,!1),y=_this$transformData.tasks,C=_this$transformData.effects,b=_this$transformData.consumeIndex;this.syncIndex=Math.min(this.syncIndex,b,Math.max(0,this.tmpPoints.length-2));var M={name:v,id:$e(a)&&a.toString()||void 0};var L,X=!1;var Y=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),y.length&&(y[0].taskId-this.syncTimestamp>this.syncUnitTime&&(X=!0,this.syncTimestamp=y[0].taskId,this.syncIndex=this.tmpPoints.length),s||o||h)){var w=i?this.fullLayer:this.drawLayer||this.fullLayer;L=this.draw({attrs:M,tasks:y,effects:C,layer:w,removeDrawCount:u});}if(h){var _w3=[];this.tmpPoints.slice(Y).forEach(function(x){_w3.push(x.x,x.y,_this42.computRadius(x.z,_this42.workOptions.thickness));});var S=!this.workOptions.previewLocalOnly&&X;return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:It.DrawWork,dataType:Qt.Local,op:S?_w3:void 0,index:S?Y*3:void 0,rect:L,updateNodeOpt:{useAnimation:!0}});}if(s)return b>10&&this.tmpPoints.splice(0,b-10),{rect:L,type:It.DrawWork,dataType:Qt.Local};var et=[];this.tmpPoints.slice(Y).forEach(function(w){et.push(w.x,w.y,_this42.computRadius(w.z,_this42.workOptions.thickness));});var A=!this.workOptions.previewLocalOnly&&X;return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:It.DrawWork,dataType:Qt.Local,rect:L,op:A?et:void 0,index:A?Y*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"consumeAll",value:function consumeAll(e){var v;var n=this.workId;if(e.data){var _e$data=e.data,p=_e$data.op,y=_e$data.workState;p!=null&&p.length&&y===te.Done&&this.workOptions.strokeType===Ne.Stroke&&this.updateTempPointsWithPressureWhenDone(p);}var i=this.fullLayer;if(this.tmpPoints.length<2)return this.replace(i,n),{type:It.RemoveNode,removeIds:[n]};var s=this.transformDataAll(!0),o={name:n};var a;s.length&&(a=this.draw({attrs:o,tasks:s,replaceId:n,layer:i}));var u=[];this.tmpPoints.map(function(p){u.push(p.x,p.y,p.z);}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;var h=Br(u);return(v=this.vNodes)==null||v.setInfo(n,{rect:a,op:u,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:a&&Gt.getCenterPos(a,i)}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{rect:a,type:It.FullWork,dataType:Qt.Local,ops:h,updateNodeOpt:{pos:this.centerPos,useAnimation:!0}});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(e){var p,y;var n=e.op,i=e.isFullWork,s=e.replaceId,_e$workState=e.workState,o=_e$workState===void 0?te.Done:_e$workState;this.tmpPoints.length=0;for(var C=0;C<n.length;C+=3){var b=new _t(n[C],n[C+1],n[C+2]);if(this.tmpPoints.length>0){var M=this.tmpPoints[this.tmpPoints.length-1];if(!this.setPointVector(b,M))continue;}this.tmpPoints.push(b);}if(this.tmpPoints.length<2)return;var a=this.transformDataAll(!0),u=(p=this.workId)==null?void 0:p.toString(),h={name:u};var v;if(u&&a.length){var _C2=i?this.fullLayer:this.drawLayer||this.fullLayer;v=this.draw({attrs:h,tasks:a,replaceId:s,layer:_C2,isDrawEraserlines:o===te.Done}),(y=this.vNodes)==null||y.setInfo(u,{rect:v,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Gt.getCenterPos(v,_C2)});}return v;}},{key:"computPencilPoints",value:function computPencilPoints(e){var _this43=this;var n=[],i=e.op,s=e.eraserPolylines,o=e.eraserThickness;this.tmpPoints.length=0;for(var u=0;u<i.length;u+=3){var h=new _t(i[u],i[u+1],i[u+2]);if(this.tmpPoints.length>0){var v=this.tmpPoints[this.tmpPoints.length-1];if(!this.setPointVector(h,v))continue;}this.tmpPoints.push(h);}if(this.tmpPoints.length<2)return;var a=this.transformDataAll(!0);if(a.length){var _loop4=function _loop4(){var _a$_u=a[_u5],h=_a$_u.pos,v=_a$_u.points,p=v.map(function(b){return b.point.addXY(h[0],h[1]);}),y=[];var _iterator30=_createForOfIteratorHelper(s),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var b=_step30.value;var M=[];for(var X=0;X<b.length;X+=2){var Y=new _t(b[X],b[X+1]);if(M.length>0){var et=M[M.length-1].point;if(!_this43.setPointVector(Y,et))continue;}M.push({point:Y,radius:o});}var _this43$computStroke=_this43.computStroke(M,!1),L=_this43$computStroke.ps;y.push(L.map(function(X){return X.XY;}));}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}$xt(p,y,0.01).forEach(function(b){n.push(b.map(function(M){return[M[0],M[1],M[2]];}).flat(1));});};for(var _u5=0;_u5<a.length;_u5++){_loop4();}}return n;}},{key:"transformDataAll",value:function transformDataAll(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.getTaskPoints(this.tmpPoints,e&&this.workOptions.thickness||void 0);}},{key:"draw",value:function draw(e){var _this44=this;var n=e.attrs,i=e.tasks,s=e.replaceId,o=e.effects,a=e.layer,u=e.removeDrawCount,_e$isDrawEraserlines=e.isDrawEraserlines,h=_e$isDrawEraserlines===void 0?!0:_e$isDrawEraserlines,_this$workOptions=this.workOptions,v=_this$workOptions.strokeColor,p=_this$workOptions.strokeType,y=_this$workOptions.thickness,C=_this$workOptions.zIndex,b=_this$workOptions.scale,M=_this$workOptions.rotate,L=_this$workOptions.translate,X=_this$workOptions.eraserlines,Y=_this$workOptions.eraserFaces,et=_this$workOptions.doingLines,A=_this$workOptions.lineCap,w=_this$workOptions.lineDash;o!=null&&o.size&&(o.forEach(function(K){var j;(j=a.getElementById(K+""))==null||j.remove();}),o.clear()),u&&this.removeDrawCountNodes(a,u);var S;var x=[],P=a.worldPosition,z=a.worldScaling;for(var K=0;K<i.length;K++){var _i$K=i[K],j=_i$K.pos,nt=_i$K.points,_this$computDrawPoint=this.computDrawPoints(nt),ct=_this$computDrawPoint.ps,B=_this$computDrawPoint.rect;var N=void 0;var G=nt.length===1;p===Ne.Stroke||G?N=Jn(ct,!0):N=Jn(ct,!1);var q={pos:j,d:N,fillColor:p===Ne.Stroke||G?v:void 0,lineDash:G?void 0:p===Ne.Dotted?[w&&w[0]||1,(w&&w[1]||2)*y]:p===Ne.LongDotted?[(w&&w[0]||1)*y,(w&&w[1]||2)*y]:void 0,strokeColor:v,lineCap:G?void 0:A,lineWidth:p===Ne.Stroke||G?0:y};S=Kt(S,{x:Math.floor((B.x+j[0])*z[0]+P[0]-Gt.SafeBorderPadding),y:Math.floor((B.y+j[1])*z[1]+P[1]-Gt.SafeBorderPadding),w:Math.floor(B.w*z[0]+2*Gt.SafeBorderPadding),h:Math.floor(B.h*z[1]+2*Gt.SafeBorderPadding)}),x.push(q);}b&&(n.scale=b),M&&(n.rotate=M),L&&(n.translate=L);var U=new nr();if(S){this.centerPos=Gt.getCenterPos(S,a);var _K3=p===Ne.Stroke&&!X&&!Y&&!et;U.attr(_objectSpread(_objectSpread({},n),{},{normalize:!0,anchor:[0.5,0.5],bgcolor:_K3?v:void 0,pos:this.centerPos,size:[(S.w-2*Gt.SafeBorderPadding)/z[0],(S.h-2*Gt.SafeBorderPadding)/z[1]],zIndex:C}));var _j2=x.map(function(nt){return nt.pos=[nt.pos[0]-_this44.centerPos[0],nt.pos[1]-_this44.centerPos[1]],new $r(nt);});U.append.apply(U,_toConsumableArray(_j2)),_K3&&U.seal(),(X||Y||et)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:U,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:Y,pos:this.centerPos,layer:a},h)),this.replace(a,s,U);}if(b||M||L){var _K4=U==null?void 0:U.getBoundingClientRect();_K4&&(S={x:Math.floor(_K4.x-Gt.SafeBorderPadding),y:Math.floor(_K4.y-Gt.SafeBorderPadding),w:Math.floor(_K4.width+Gt.SafeBorderPadding*2),h:Math.floor(_K4.height+Gt.SafeBorderPadding*2)});}return this.isDelete&&U.setAttribute("opacity",0),S;}},{key:"computDrawPoints",value:function computDrawPoints(e){return this.workOptions.strokeType===Ne.Stroke||e.length===1?this.computStroke(e):this.computNomal(e);}},{key:"computNomal",value:function computNomal(e){var n=this.workOptions.thickness;var i=e.map(function(s){return n=Math.max(n,s.radius),s.point;});return{ps:i,rect:Ye(i,n)};}},{key:"computStroke",value:function computStroke(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return e.length===1?this.computDotStroke(e[0]):this.computLineStroke(e,n);}},{key:"computLineStroke",value:function computLineStroke(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var i=[],s=[];for(var u=0;u<e.length;u++){var _e$u=e[u],h=_e$u.point,v=_e$u.radius;var p=h.v;u===0&&e.length>1&&(p=e[u+1].point.v);var y=xt.Per(p).mul(v);i.push(_t.Sub(h,y)),s.push(_t.Add(h,y));}var o=e[e.length-1];if(n){var _u6=_t.GetSemicircleStroke(o.point,i[i.length-1],-1,8),_h3=_t.GetSemicircleStroke(e[0].point,s[0],-1,8),_v4=i.concat(_u6,s.reverse(),_h3);return{ps:_v4,rect:Ye(_v4)};}var a=i.concat(s.reverse());return{ps:a,rect:Ye(a)};}},{key:"computDotStroke",value:function computDotStroke(e){var n=e.point,i=e.radius,s={x:n.x-i,y:n.y-i,w:i*2,h:i*2};return{ps:_t.GetDotStroke(n,i,8),rect:s};}},{key:"transformData",value:function transformData(e,n){var i=e.op,s=e.workState;var o=this.tmpPoints.length-1,a=[];if(i!=null&&i.length&&s){var _this$workOptions2=this.workOptions,u=_this$workOptions2.strokeType,h=_this$workOptions2.thickness,v=/* @__PURE__ */new Set(),p=Math.max(0,this.tmpPoints.length-1);u===Ne.Stroke?this.updateTempPointsWithPressure(i,h,v):this.updateTempPoints(i,h,v),o=p;var y=n?this.tmpPoints:this.tmpPoints.slice(o);return a=this.getTaskPoints(y,h),{tasks:a,effects:v,consumeIndex:o};}return{tasks:a,consumeIndex:o};}/** 压力渐变公式 */},{key:"computRadius",value:function computRadius(e,n){return e*0.03*n+n*0.5;}},{key:"getMinZ",value:function getMinZ(e,n){return((n||Math.max(1,Math.floor(e*0.3)))-e*0.5)*100/e/3;}},{key:"getTaskPoints",value:function getTaskPoints(e,n){var p;var i=[];if(e.length===0)return[];var s=0,o=e[0].x,a=e[0].y,u=[o,a],h=[],v=e[0].t;for(;s<e.length;){var y=e[s],C=y.x-o,b=y.y-a,M=y.z,L=n?this.computRadius(M,n):M;if(h.push({point:new _t(C,b,M,e[s].v),radius:L}),s>0&&s<e.length-1){var X=e[s].getAngleByPoints(e[s-1],e[s+1]);if(X<60||X>300){var Y=(p=h.pop())==null?void 0:p.point.clone();Y&&i.push({taskId:v,pos:u,points:[].concat(_toConsumableArray(h),[{point:Y,radius:L}])}),o=e[s].x,a=e[s].y,u=[o,a];var et=y.x-o,A=y.y-a;h=[{point:new _t(et,A,M),radius:L}],v=Date.now();}}s++;}return i.push({taskId:v,pos:u,points:h}),i;}},{key:"updateTempPointsWithPressure",value:function updateTempPointsWithPressure(e,n,i){var s=Date.now(),o=this.tmpPoints.length;var a=o;for(var h=0;h<e.length;h+=2){a=Math.min(a,o);var v=this.tmpPoints.length,p=new _t(e[h],e[h+1]);if(v===0){this.tmpPoints.push(p);continue;}var y=v-1,C=this.tmpPoints[y];if(p.x===C.x&&p.y===C.y){C.z<this.MAX_REPEAR&&C.setz(Math.min(C.z+1,this.MAX_REPEAR));continue;}var b=xt.Sub(p,C).uni();if(p.isNear(C,n)){var X=C.z;if(C.z<this.MAX_REPEAR&&(X=Math.min(C.z+1,this.MAX_REPEAR),v>1)){var A=v-1;for(;A>0;){var w=this.tmpPoints[A].distance(this.tmpPoints[A-1]),S=Math.max(this.tmpPoints[A].z-this.uniThickness*w,0);if(this.tmpPoints[A-1].z>=S)break;this.tmpPoints[A-1].setz(S),a=Math.min(a,A-1),A--;}}if(a=Math.min(a,y),C.t){p.setz(X),p.setv(b),this.tmpPoints.push(p);continue;}var Y=this.tmpPoints[y-1],et=Y?xt.Sub(p,Y).uni():C.v;C.set(p.x,p.y,X,et);continue;}p.setv(b);var M=p.distance(C),L=Math.max(C.z-this.uniThickness*M,0);v>1&&xt.Equals(b,C.v,0.01)&&(L>0||C.z<=0)&&(C.t||this.tmpPoints.pop(),a=Math.min(y,a)),p.setz(L),this.tmpPoints.push(p);}if(a===1/0)return this.tmpPoints.length;var u=o;if(a===o){u=Math.max(u-1,0);var _h4=this.tmpPoints[u].t;_h4&&(i==null||i.add(_h4));}else{var _h5=o-1;for(u=a;_h5>=0;){var _v5=this.tmpPoints[_h5].t;if(_v5&&(i==null||i.add(_v5),_h5<=a)){u=_h5,_h5=-1;break;}_h5--;}}return this.tmpPoints[this.tmpPoints.length-1].setT(s),u;}},{key:"updateTempPoints",value:function updateTempPoints(e,n,i){var h;var s=Date.now(),o=this.tmpPoints.length;var a=o;for(var v=0;v<e.length;v+=2){var p=this.tmpPoints.length,y=new _t(e[v],e[v+1]);if(p===0){this.tmpPoints.push(y);continue;}var C=p-1,b=this.tmpPoints[C];if(y.x===b.x&&y.y===b.y)continue;var M=xt.Sub(y,b).uni();if(y.isNear(b,n/2)){if(b.t){y.setz(b.z),y.setv(M),this.tmpPoints.push(y),a=Math.min(C,a);continue;}var L=this.tmpPoints[C-1],X=L?xt.Sub(y,L).uni():b.v;b.set(y.x,y.y,b.z,X),a=Math.min(C,a);continue;}xt.Equals(M,b.v,0.01)&&(b.t||this.tmpPoints.pop(),a=Math.min(C,a)),y.setv(M),this.tmpPoints.push(y);}var u=o;if(a===o){u=Math.max(u-1,0);var _v6=this.tmpPoints[u].t;_v6&&(i==null||i.add(_v6));}else{var _v7=Math.min(o-1,a);for(u=a;_v7>=0;){var _p2=(h=this.tmpPoints[_v7])==null?void 0:h.t;if(_p2&&(i==null||i.add(_p2),_v7<=a)){u=_v7,_v7=-1;break;}_v7--;}}return this.tmpPoints[this.tmpPoints.length-1].setT(s),u;}},{key:"updateTempPointsWithPressureWhenDone",value:function updateTempPointsWithPressureWhenDone(e){var n=this.workOptions.thickness,i=e.length,s=this.getMinZ(n);for(var o=0;o<i;o+=2){var a=this.tmpPoints.length,u=new _t(e[o],e[o+1]);if(a===0){this.tmpPoints.push(u);continue;}var h=a-1,v=this.tmpPoints[h];if(u.x===v.x&&u.y===v.y){v.z<this.MAX_REPEAR&&v.setz(Math.min(v.z+1,this.MAX_REPEAR));continue;}var p=xt.Sub(u,v).uni(),y=u.distance(v);if(a>1&&v.z===s)break;if(u.isNear(v,n/2)){var b=v.z;if(i<3&&v.z<this.MAX_REPEAR&&(b=Math.min(v.z+1,this.MAX_REPEAR),a>1)){var X=a-1;for(;X>0;){var Y=this.tmpPoints[X].distance(this.tmpPoints[X-1]),et=Math.max(this.tmpPoints[X].z-this.uniThickness*Y,-n/4);if(this.tmpPoints[X-1].z>=et)break;this.tmpPoints[X-1].setz(et),X--;}}if(v.t){u.setz(b),u.setv(p),this.tmpPoints.push(u);continue;}var M=this.tmpPoints[h-1],L=M?xt.Sub(u,M).uni():v.v;v.set(u.x,u.y,b,L);continue;}u.setv(p);var C=Math.max(v.z-this.uniThickness*y,s);a>1&&xt.Equals(p,v.v,0.01)&&v.z<=0&&(v.t||this.tmpPoints.pop()),u.setz(C),this.tmpPoints.push(u);}}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var p,y;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.strokeType,u=i.lineCap,h=i.lineDash,v=s.get(n.name);return o&&(n.tagName==="GROUP"?oAt(n)?n.setAttribute("bgcolor",o):n.children.forEach(function(C){C.setAttribute("strokeColor",o),C.getAttribute("fillColor")&&C.setAttribute("fillColor",o);}):(n.setAttribute("strokeColor",o),n.setAttribute("fillColor",o)),(p=v==null?void 0:v.opt)!=null&&p.strokeColor&&(v.opt.strokeColor=o)),a&&v!=null&&v.opt&&(y=v.opt)!=null&&y.strokeType&&(v.opt.strokeType=a),u&&v!=null&&v.opt&&(v.opt.lineCap=u),h&&v!=null&&v.opt&&(v.opt.lineDash=h),v&&s.setInfo(n.name,v),Gt.updateNodeOpt(e);}}]);}(Gt);var rT=/*#__PURE__*/function(_Gt2){function rT(e){var _this45;_classCallCheck(this,rT);_this45=_callSuper(this,rT,[e]);ht(_this45,"toolsType",St.LaserPen);ht(_this45,"canRotate",!1);ht(_this45,"scaleType",Ae.none);ht(_this45,"syncTimestamp");ht(_this45,"syncIndex",0);ht(_this45,"tmpPoints",[]);ht(_this45,"workOptions");ht(_this45,"consumeIndex",0);_this45.workOptions=e.toolsOpt,_this45.syncTimestamp=0;return _this45;}_inherits(rT,_Gt2);return _createClass(rT,[{key:"combineConsume",value:function combineConsume(){}},{key:"setWorkOptions",value:function setWorkOptions(e){_superPropGet(rT,"setWorkOptions",this,3)([e]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(e){var n=e.data,i=e.isSubWorker,s=n.workId,o=n.op,a=n.syncUnitTime;if((o==null?void 0:o.length)===0)return{type:It.None};if(a&&(this.syncUnitTime=a),this.updateTempPoints(o||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:It.None};var _this$workOptions3=this.workOptions,u=_this$workOptions3.strokeColor,h=_this$workOptions3.thickness,v=_this$workOptions3.strokeType,p=_this$workOptions3.lineDash,y=_this$workOptions3.lineCap,C=Ye(this.tmpPoints,h);var b=!1;var M=this.syncIndex,L=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var X={name:s==null?void 0:s.toString(),opacity:1,lineDash:v===Ne.Dotted?[p&&p[0]||1,(p&&p[1]||2)*h]:v===Ne.LongDotted?[(p&&p[0]||1)*h,(p&&p[1]||2)*h]:void 0,strokeColor:u,lineCap:y,lineWidth:h,anchor:[0.5,0.5]},Y=this.getTaskPoints(L);if(Y.length){var A=Date.now();A-this.syncTimestamp>this.syncUnitTime&&(b=!0,this.syncTimestamp=A,this.syncIndex=this.tmpPoints.length),i&&this.draw({attrs:X,tasks:Y,isDot:!1,layer:this.drawLayer||this.fullLayer});}var et=[];return this.tmpPoints.slice(M).forEach(function(A){et.push(A.x,A.y);}),_objectSpread({rect:{x:C.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:C.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:C.w*this.fullLayer.worldScaling[0],h:C.h*this.fullLayer.worldScaling[1]},type:It.DrawWork,dataType:Qt.Local,op:b?et:void 0,index:b?M*2:void 0},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var e=(o=this.workId)==null?void 0:o.toString();var n;if(this.tmpPoints.length-1>this.consumeIndex){var a=this.tmpPoints.slice(this.consumeIndex);var u=a.length===1,_this$workOptions4=this.workOptions,h=_this$workOptions4.strokeColor,v=_this$workOptions4.thickness,p=_this$workOptions4.strokeType;if(u){var b=this.computDotStroke({point:a[0],radius:v/2});a=b.ps,n=b.rect;}else n=Ye(this.tmpPoints,v);var y={name:e==null?void 0:e.toString(),fillColor:u?h:void 0,opacity:1,lineDash:p===Ne.Dotted&&!u?[1,v*2]:p===Ne.LongDotted&&!u?[v,v*2]:void 0,strokeColor:h,lineCap:u?void 0:"round",lineWidth:u?0:v,anchor:[0.5,0.5]},C=this.getTaskPoints(a);C.length&&this.draw({attrs:y,tasks:C,isDot:u,layer:this.drawLayer||this.fullLayer});}var i=[];this.tmpPoints.forEach(function(a){i.push(a.x,a.y);});var s=Br(i);return _objectSpread({rect:n&&{x:n.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:n.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:n.w*this.fullLayer.worldScaling[0],h:n.h*this.fullLayer.worldScaling[1]},type:It.FullWork,dataType:Qt.Local,ops:s,index:this.syncIndex*2},this.baseConsumeResult);}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(e){var M;var n=e.op,i=e.replaceId,s=e.isFullWork,_this$workOptions5=this.workOptions,o=_this$workOptions5.strokeColor,a=_this$workOptions5.thickness,u=_this$workOptions5.strokeType;if(!n.length){var L=Ye(this.tmpPoints,a);return{x:L.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:L.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:L.w*this.fullLayer.worldScaling[0],h:L.h*this.fullLayer.worldScaling[1]};}var h=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(n||[]);var v,p=this.tmpPoints.slice(h);var y=p.length===1;if(y){var _L2=this.computDotStroke({point:p[0],radius:a/2});p=_L2.ps,v=_L2.rect;}else v=Ye(this.tmpPoints,a);var C={name:(M=this.workId)==null?void 0:M.toString(),fillColor:y?o:void 0,opacity:1,lineDash:u===Ne.Dotted&&!y?[1,a*2]:u===Ne.LongDotted&&!y?[a,a*2]:void 0,strokeColor:o,lineCap:y?void 0:"round",lineWidth:y?0:a,anchor:[0.5,0.5]},b=this.getTaskPoints(p);if(b.length){var _L3=s?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:C,tasks:b,isDot:y,replaceId:i,layer:_L3});}return{x:v.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:v.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:v.w*this.fullLayer.worldScaling[0],h:v.h*this.fullLayer.worldScaling[1]};}},{key:"computDotStroke",value:function computDotStroke(e){var n=e.point,i=e.radius,s={x:n.x-i,y:n.y-i,w:i*2,h:i*2};return{ps:_t.GetDotStroke(n,i,8),rect:s};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=this.tmpPoints.length;for(var i=0;i<e.length;i+=2){if(n){var s=this.tmpPoints.slice(-1)[0];s&&s.x===e[i]&&s.y===e[i+1]&&this.tmpPoints.pop();}this.tmpPoints.push(new _t(e[i],e[i+1]));}}},{key:"draw",value:function(){var _draw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(e){var n,i,s,o,a,_iterator31,_step31,_loop5,_t15;return _regenerator().w(function(_context13){while(1)switch(_context13.p=_context13.n){case 0:n=e.attrs,i=e.tasks,s=e.isDot,o=e.layer,a=this.workOptions.duration;_iterator31=_createForOfIteratorHelper(i);_context13.p=1;_loop5=/*#__PURE__*/_regenerator().m(function _loop5(){var u,h,v,p,y;return _regenerator().w(function(_context12){while(1)switch(_context12.n){case 0:u=_step31.value;h=new $r(),v=u.pos,p=u.points;s?y=Jn(p,!0):y=Jn(p,!1),h.attr(_objectSpread(_objectSpread({},n),{},{pos:v,d:y})),o.appendChild(h),h.transition(a).attr({scale:s?[0.1,0.1]:[1,1],lineWidth:s?0:1}).then(function(){h.remove();});case 1:return _context12.a(2);}},_loop5);});_iterator31.s();case 2:if((_step31=_iterator31.n()).done){_context13.n=4;break;}return _context13.d(_regeneratorValues(_loop5()),3);case 3:_context13.n=2;break;case 4:_context13.n=6;break;case 5:_context13.p=5;_t15=_context13.v;_iterator31.e(_t15);case 6:_context13.p=6;_iterator31.f();return _context13.f(6);case 7:return _context13.a(2);}},_callee12,this,[[1,5,6,7]]);}));function draw(_x25){return _draw.apply(this,arguments);}return draw;}()},{key:"getTaskPoints",value:function getTaskPoints(e){var h;var n=[];if(e.length===0)return[];var i=0,s=e[0].x,o=e[0].y,a=[s,o],u=[];for(;i<e.length;){var v=e[i],p=v.x-s,y=v.y-o;if(u.push(new _t(p,y)),i>0&&i<e.length-1){var C=e[i].getAngleByPoints(e[i-1],e[i+1]);if(C<60||C>300){var b=(h=u.pop())==null?void 0:h.clone();b&&n.push({pos:a,points:[].concat(_toConsumableArray(u),[b])}),s=e[i].x,o=e[i].y,a=[s,o];var M=v.x-s,L=v.y-o;u=[new _t(M,L)];}}i++;}return n.push({pos:a,points:u}),n;}},{key:"removeLocal",value:function removeLocal(){}},{key:"removeService",value:function removeService(e){var n;var i=[];return this.fullLayer.getElementsByName(e).forEach(function(s){if(s.name===e){var o=s.getBoundingClientRect();n=Kt(n,{x:o.x,y:o.y,w:o.width,h:o.height}),i.push(s);}}),i.length&&i.forEach(function(s){return s.remove();}),n;}}]);}(Gt);var Yxt=yu;yu.polyline=yu;yu.polygon=Gxt;function yu(r,t,e){var n=r.length,i=Mo(r[0],t),s=[],o,a,u,h,v;for(e||(e=[]),o=1;o<n;o++){for(a=r[o-1],u=r[o],h=v=Mo(u,t);;)if(i|h){if(i&h)break;i?(a=Ip(a,u,i,t),i=Mo(a,t)):(u=Ip(a,u,h,t),h=Mo(u,t));}else{s.push(a),h!==v?(s.push(u),o<n-1&&(e.push(s),s=[])):o===n-1&&s.push(u);break;}i=v;}return s.length&&e.push(s),e;}function Gxt(r,t){var e,n,i,s,o,a,u;for(n=1;n<=8;n*=2){for(e=[],i=r[r.length-1],s=!(Mo(i,t)&n),o=0;o<r.length;o++)a=r[o],u=!(Mo(a,t)&n),u!==s&&e.push(Ip(i,a,n,t)),u&&e.push(a),i=a,s=u;if(r=e,!r.length)break;}return e;}function Ip(r,t,e,n){return e&8?[r[0]+(t[0]-r[0])*(n[3]-r[1])/(t[1]-r[1]),n[3]]:// top
|
|
406
|
+
decompressFromEncodedURIComponent:function decompressFromEncodedURIComponent(u){return u==null?"":u==""?null:(u=u.replace(/ /g,"+"),a._decompress(u.length,32,function(h){return o(i,u.charAt(h));}));},compress:function compress(u){return a._compress(u,16,function(h){return e(h);});},_compress:function _compress(u,h,v){if(u==null)return"";var p,y,C={},b={},M="",L="",X="",Y=2,et=3,A=2,w=[],S=0,x=0,P;for(P=0;P<u.length;P+=1)if(M=u.charAt(P),Object.prototype.hasOwnProperty.call(C,M)||(C[M]=et++,b[M]=!0),L=X+M,Object.prototype.hasOwnProperty.call(C,L))X=L;else{if(Object.prototype.hasOwnProperty.call(b,X)){if(X.charCodeAt(0)<256){for(p=0;p<A;p++)S=S<<1,x==h-1?(x=0,w.push(v(S)),S=0):x++;for(y=X.charCodeAt(0),p=0;p<8;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}else{for(y=1,p=0;p<A;p++)S=S<<1|y,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=0;for(y=X.charCodeAt(0),p=0;p<16;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}Y--,Y==0&&(Y=Math.pow(2,A),A++),delete b[X];}else for(y=C[X],p=0;p<A;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;Y--,Y==0&&(Y=Math.pow(2,A),A++),C[L]=et++,X=String(M);}if(X!==""){if(Object.prototype.hasOwnProperty.call(b,X)){if(X.charCodeAt(0)<256){for(p=0;p<A;p++)S=S<<1,x==h-1?(x=0,w.push(v(S)),S=0):x++;for(y=X.charCodeAt(0),p=0;p<8;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}else{for(y=1,p=0;p<A;p++)S=S<<1|y,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=0;for(y=X.charCodeAt(0),p=0;p<16;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;}Y--,Y==0&&(Y=Math.pow(2,A),A++),delete b[X];}else for(y=C[X],p=0;p<A;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;Y--,Y==0&&(Y=Math.pow(2,A),A++);}for(y=2,p=0;p<A;p++)S=S<<1|y&1,x==h-1?(x=0,w.push(v(S)),S=0):x++,y=y>>1;for(;;)if(S=S<<1,x==h-1){w.push(v(S));break;}else x++;return w.join("");},decompress:function decompress(u){return u==null?"":u==""?null:a._decompress(u.length,32768,function(h){return u.charCodeAt(h);});},_decompress:function _decompress(u,h,v){var p=[],y=4,C=4,b=3,M="",L=[],X,Y,et,A,w,S,x,P={val:v(0),position:h,index:1};for(X=0;X<3;X+=1)p[X]=X;for(et=0,w=Math.pow(2,2),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;switch(et){case 0:for(et=0,w=Math.pow(2,8),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;x=e(et);break;case 1:for(et=0,w=Math.pow(2,16),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;x=e(et);break;case 2:return"";}for(p[3]=x,Y=x,L.push(x);;){if(P.index>u)return"";for(et=0,w=Math.pow(2,b),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;switch(x=et){case 0:for(et=0,w=Math.pow(2,8),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;p[C++]=e(et),x=C-1,y--;break;case 1:for(et=0,w=Math.pow(2,16),S=1;S!=w;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=h,P.val=v(P.index++)),et|=(A>0?1:0)*S,S<<=1;p[C++]=e(et),x=C-1,y--;break;case 2:return L.join("");}if(y==0&&(y=Math.pow(2,b),b++),p[x])M=p[x];else if(x===C)M=Y+Y.charAt(0);else return null;L.push(M),p[C++]=Y+M.charAt(0),y--,Y=M,y==0&&(y=Math.pow(2,b),b++);}}};return a;}();r!=null?r.exports=t:(typeof angular==="undefined"?"undefined":_typeof(angular))<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return t;});})(J2);var _2=J2.exports;function ks(r){return JSON.parse(_2.decompress(r));}function Br(r){return _2.compress(JSON.stringify(r));}var T1=/* @__PURE__ */new WeakMap(),Zr=/*#__PURE__*/function(){function Zr(t){_classCallCheck(this,Zr);ht(this,"maxImageWidth",Jr.pencilEraser.maxImageWidth);ht(this,"maxImageHeight",Jr.pencilEraser.maxImageHeight);ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"vNodes");ht(this,"drawLayer");ht(this,"fullLayer");ht(this,"workId");ht(this,"confirmEraserDeletion",!1);ht(this,"isDelete",!1);var e=t.vNodes,n=t.fullLayer,i=t.drawLayer,s=t.workId,o=t.toolsOpt;this.vNodes=e,this.fullLayer=n,this.drawLayer=i,this.workId=s,this.syncUnitTime=o.syncUnitTime||this.syncUnitTime;}return _createClass(Zr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return t.reduce(function(n,i){var s=n[n.length-1];return(i&&!s||i&&s&&!i.isNear(s,e))&&n.push(i),n;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(t){this.workId=t;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}},{key:"setEraserDeleteConfirmation",value:function setEraserDeleteConfirmation(t){this.confirmEraserDeletion=t;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(t){var s,o,a;var e=Yy(this.workOptions,t);this.workOptions=e,this.syncUnitTime=t.syncUnitTime||this.syncUnitTime;var n=(s=this.workId)==null?void 0:s.toString(),i=n&&((o=this.vNodes)==null?void 0:o.get(n))||void 0;n&&i&&(i.opt=gp(e),(a=this.vNodes)==null||a.setInfo(n,i));}},{key:"getRenderableEraserLines",value:function getRenderableEraserLines(t){return[].concat(_toConsumableArray(t.eraserlines||[]),_toConsumableArray(t.doingLines||[]));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(t){var i,s;var e;var n=(i=this.workId)==null?void 0:i.toString();if(n&&t){var o=this.fullLayer.getElementsByName(n)||this.drawLayer&&this.drawLayer.getElementsByName(n)||[];if(o.length!==1)return;var a=o[0],u=t.pos,h=t.zIndex,v=t.scale,p=t.angle,y=t.translate,C={};$e(h)&&(C.zIndex=h),u&&(C.pos=[u[0],u[1]]),v&&(C.scale=v),p&&(C.rotate=p),y&&(C.translate=y),a.attr(C);var b=a==null?void 0:a.getBoundingClientRect();return b&&(e=Kt(e,{x:Math.floor(b.x-Zr.SafeBorderPadding),y:Math.floor(b.y-Zr.SafeBorderPadding),w:Math.floor(b.width+Zr.SafeBorderPadding*2),h:Math.floor(b.height+Zr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(n,{rect:e,centerPos:u}),e;}}},{key:"drawEraserlines",value:function drawEraserlines(t,e){var n=t.group,_t$eraserlines=t.eraserlines,i=_t$eraserlines===void 0?[]:_t$eraserlines,s=t.eraserFaces,o=t.pos,a=t.layer,u=a.parent;if(e)try{var v=(a.renderer.glRenderer||a.renderer.canvasRenderer).options.displayRatio,p=n.getBoundingClientRect(),y=p.width*v*a.worldScaling[0],C=p.height*v*a.worldScaling[1];var b=1;if((y>this.maxImageWidth||C>this.maxImageHeight)&&(b=Math.min(this.maxImageWidth/y,this.maxImageHeight/C)),u.renderer.glRenderer&&!this.confirmEraserDeletion&&this.drawEraserMask({group:n,eraserlines:i,eraserFaces:s,pos:o,layer:a,targetScale:b}))return;var M=a.getAttribute("scale");M=[M[0]*b,M[1]*b];var L=a.parent.parent,X=a.getAttribute("translate"),Y=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),L,{offscreen:u.offscreen,width:u.width,height:u.height,contextType:"2d",autoRender:!1,bufferSize:500},M,X),et=n.cloneNode(!0);if(!i.length&&!s)return;s&&this.addEraserFaces(et,s,o,!1),this.addEraserlines(et,i,o,!1),Y.appendChild(et);var A=Y.parent;A.render();var w=Y.renderer.canvasRenderer,S=w.context;if(!S)return;var x=w.options.displayRatio,P=et.getBoundingClientRect(),z={x:P.x,y:P.y,w:P.width,h:P.height},U={x:0,y:0,w:L.width,h:L.height};if(el(z,U)===es.outside){Kr(et,A),L.removeChild(A),this.isDelete=!0;return;}var j=Nxt(z,x),nt=gr(j);nt.x=Math.floor(Math.max(j.x,0)),nt.y=Math.floor(Math.max(j.y,0)),nt.w=Math.min(j.x+j.w,L.width)-nt.x,nt.h=Math.min(j.y+j.h,L.height)-nt.y;var ct=this.getGroupRect(nt,x),B=ct.x,N=ct.y,G=ct.w,q=ct.h;var at=S.getImageData(B,N,G,q);if(this.confirmEraserDeletion&&this.isTransparentRectByCanvas(at)){Kr(et,A),L.removeChild(A),this.isDelete=!0,at=null;return;}if(this.confirmEraserDeletion&&u.renderer.glRenderer&&this.drawEraserMask({group:n,eraserlines:i,eraserFaces:s,pos:o,layer:a,targetScale:b})){Kr(et,A),L.removeChild(A),at=null;return;}Kr(n,u);var ut=this.createSpriteNode({imageData:at,safariRect:nt,originRect:j,worldScaling:Y.worldScaling});ut&&n.append(ut),Kr(et,A),L.removeChild(A),u.deleteTexture(at),at=null;}catch(h){console.error("[BaseShapeTool] drawEraserlines error:",h);return;}}},{key:"drawEraserMask",value:function drawEraserMask(t){var S,x;var e=t.group,n=t.eraserlines,i=t.eraserFaces,s=t.pos,o=t.layer,a=t.targetScale;if(!n.length&&!i||e.getAttribute("clipPath"))return!1;var u=Number(e.getAttribute("width")),h=Number(e.getAttribute("height"));if(!(u>0)||!(h>0))return!1;var v=o.parent.renderer;if(!v.glRenderer)return!1;var p=v.options.displayRatio||1,y=Math.max(1,Math.ceil(u*p*o.worldScaling[0]*a)),C=Math.max(1,Math.ceil(h*p*o.worldScaling[1]*a)),b=[-u/2,-h/2,u,h];var M=T1.get(o);M||(M=/* @__PURE__ */new Map(),T1.set(o,M)),this.pruneEraserMaskCaches(o,M,v);var L=M.get(this.workId),X=!L||L.pixelWidth!==y||L.pixelHeight!==C||L.facesKey!==(i==null?void 0:i.d);if(L&&!X&&(X=this.isEraserMaskPrefixChanged(L,n)),X){if(L==null||L.handle.destroy(v),L=this.createEraserMaskCache(y,C,b),!L)return!1;M.set(this.workId,L);}if(!L)return!1;var Y=y/u,et=C/h;L.context.setTransform(Y,0,0,et,y/2,C/2),X&&i&&(this.appendEraserMaskFaces(L.context,i,s),L.facesKey=i.d);var A=X,w;var _iterator21=_createForOfIteratorHelper(n),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var P=_step21.value;var z=L.commands.get(P.workId),U=X?0:(z==null?void 0:z.count)||0;for(var K=U;K<P.op.length;K++)A=!0,w=Kt(w,this.appendEraserMaskStroke(L.context,P.op[K],P.thickness,s));L.commands.set(P.workId,{count:P.op.length,thickness:P.thickness,first:(S=P.op[0])==null?void 0:S.slice(0,2),last:(x=P.op[P.op.length-1])==null?void 0:x.slice(-2)});}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}return A&&L.handle.update({rect:b,dirtyRect:X||!w?void 0:[w.x,w.y,w.w,w.h]}),e.setMask(L.handle,{rect:b}),!0;}},{key:"pruneEraserMaskCaches",value:function pruneEraserMaskCaches(t,e,n){var _iterator22=_createForOfIteratorHelper(e),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _step22$value=_slicedToArray(_step22.value,2),i=_step22$value[0],s=_step22$value[1];i!==this.workId&&t.getElementsByName(i).length===0&&(s.handle.destroy(n),e.delete(i));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}},{key:"createEraserMaskCache",value:function createEraserMaskCache(t,e,n){var o,a;var i;typeof OffscreenCanvas=="function"?i=new OffscreenCanvas(t,e):(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&(i=document.createElement("canvas"),i.width=t,i.height=e);var s=i==null?void 0:i.getContext("2d");if(!(!i||!s))return s.save(),s.setTransform(1,0,0,1,0,0),s.fillStyle="#fff",s.fillRect(0,0,t,e),s.restore(),{canvas:i,context:s,handle:new nmt(i,{rect:n,singleChannelTexture:((o=this.fullLayer.parent.renderer.options.bitmapEraserMaskOptions)==null?void 0:o.singleChannelTexture)!==!1,textureSubImage2D:((a=this.fullLayer.parent.renderer.options.bitmapEraserMaskOptions)==null?void 0:a.textureSubImage2D)!==!1}),rect:n,pixelWidth:t,pixelHeight:e,commands:/* @__PURE__ */new Map()};}},{key:"appendEraserMaskStroke",value:function appendEraserMaskStroke(t,e,n,i){if(e.length<2)return;t.save(),t.fillStyle="#000",t.strokeStyle="#000",t.lineCap="round",t.lineJoin="round",t.lineWidth=n;var s=e[0]-i[0],o=e[1]-i[1];if(e.length===2)t.beginPath(),t.arc(s,o,n/2,0,Math.PI*2),t.fill();else{t.beginPath(),t.moveTo(s,o);for(var b=2;b<e.length;b+=2)t.lineTo(e[b]-i[0],e[b+1]-i[1]);t.stroke();}t.restore();var a=[],u=[];for(var _b2=0;_b2<e.length;_b2+=2)a.push(e[_b2]-i[0]),u.push(e[_b2+1]-i[1]);var h=n/2+1,v=Math.min.apply(Math,a),p=Math.min.apply(Math,u),y=Math.max.apply(Math,a),C=Math.max.apply(Math,u);return{x:v-h,y:p-h,w:y-v+h*2,h:C-p+h*2};}},{key:"appendEraserMaskFaces",value:function appendEraserMaskFaces(t,e,n){t.save(),t.fillStyle="#000",t.beginPath();var _iterator23=_createForOfIteratorHelper(pu(e)),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var i=_step23.value;var _iterator24=_createForOfIteratorHelper(i.rings),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var s=_step24.value;s.forEach(function(_ref59,u){var _ref60=_slicedToArray(_ref59,2),o=_ref60[0],a=_ref60[1];var h=o-n[0],v=a-n[1];u===0?t.moveTo(h,v):t.lineTo(h,v);}),t.closePath();}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}t.fill("evenodd"),t.restore();}},{key:"isEraserMaskPrefixChanged",value:function isEraserMaskPrefixChanged(t,e){var n,i;if(t.commands.size>e.length)return!0;var _iterator25=_createForOfIteratorHelper(e),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var s=_step25.value;var o=t.commands.get(s.workId);if(o&&(s.op.length<o.count||s.thickness!==o.thickness||!this.isSamePoint(o.first,(n=s.op[0])==null?void 0:n.slice(0,2))||!this.isSamePoint(o.last,(i=s.op[o.count-1])==null?void 0:i.slice(-2))))return!0;}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}return!1;}},{key:"isSamePoint",value:function isSamePoint(t,e){return!t||!e?t===e:t[0]===e[0]&&t[1]===e[1];}},{key:"createVmRenderNode",value:function createVmRenderNode(t,e,n,i,s){var o=n.width,a=n.height,u="bitMap-".concat(t),h=e.layer(u,n),v=new nr({anchor:[0.5,0.5],pos:[o*0.5,a*0.5],size:[o,a],name:"viewport",id:t});return v.setAttribute("scale",i),v.setAttribute("translate",s),h.append(v),v;}},{key:"getGroupRect",value:function getGroupRect(t,e){return Dxt(t,e);}},{key:"addEraserlines",value:function addEraserlines(t,e,n){var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator26=_createForOfIteratorHelper(e),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var s=_step26.value;var o=s.thickness,a=s.op;var _iterator27=_createForOfIteratorHelper(a),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var u=_step27.value;var h=u.map(function(b,M){return M%2?b-n[1]:b-n[0];}),v=this.computEraserPoints(h,o),p=Jn(v,!0),y={pos:[0,0],d:p,fillColor:"rgba(0,0,0,1)"},C=new $r(y);C.addEventListener("beforerender",function(_ref61){var b=_ref61.detail;var M=b.context;i?M.blendFuncSeparate(M.ZERO,M.ZERO,M.ZERO,M.ZERO):M.globalCompositeOperation="destination-out";}),C.addEventListener("afterrender",function(_ref62){var b=_ref62.detail;var M=b.context;i?M.blendFuncSeparate(M.SRC_ALPHA,M.ONE_MINUS_SRC_ALPHA,M.ONE,M.ONE_MINUS_SRC_ALPHA):M.globalCompositeOperation="source-over";}),t.append(C);}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}}},{key:"addEraserFaces",value:function addEraserFaces(t,e,n){var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var s=pu(e).flatMap(function(a){return a.rings.map(function(u){return Jn(u.map(function(_ref63){var _ref64=_slicedToArray(_ref63,2),h=_ref64[0],v=_ref64[1];return new _t(h-n[0],v-n[1]);}),!0);});}).join(" ");if(!s)return;var o=new $r({pos:[0,0],d:s,fillColor:"rgba(0,0,0,1)",fillRule:"evenodd"});o.addEventListener("beforerender",function(_ref65){var a=_ref65.detail;var u=a.context;i?u.blendFuncSeparate(u.ZERO,u.ZERO,u.ZERO,u.ZERO):u.globalCompositeOperation="destination-out";}),o.addEventListener("afterrender",function(_ref66){var a=_ref66.detail;var u=a.context;i?u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA):u.globalCompositeOperation="source-over";}),t.append(o);}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(t){var e=!0;for(var n=0;n<t.data.length;n+=4)if(t.data[n+3]!==0){e=!1;break;}return e;}},{key:"createSpriteNode",value:function createSpriteNode(t){var e=t.imageData,n=t.worldScaling,i=t.safariRect,s=t.originRect;var o;if(typeof OffscreenCanvas=="function"){o=new OffscreenCanvas(e.width,e.height);var y=o.getContext("2d");y&&y.putImageData(e,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){o=document.createElement("canvas"),o.width=e.width,o.height=e.height;var _y2=o.getContext("2d");_y2&&_y2.putImageData(e,0,0);}if(!o)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var _kxt=kxt(i,s,n),a=_kxt.size,u=_kxt.textureRect,h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:a,texture:o,textureRect:u},v=new af(h);var p=!0;return v.addEventListener("beforerender",function(_ref67){var y=_ref67.detail;var C=y.context;typeof C.imageSmoothingEnabled=="boolean"&&(p=C.imageSmoothingEnabled,C.imageSmoothingEnabled=!1);}),v.addEventListener("afterrender",function(_ref68){var y=_ref68.detail;var C=y.context;typeof C.imageSmoothingEnabled=="boolean"&&(C.imageSmoothingEnabled=p);}),v;}},{key:"computEraserPoints",value:function computEraserPoints(t,e){var n=Math.ceil(e/2);return t.length===2?this.computDot(t,n):this.computLine(t,n);}},{key:"computDot",value:function computDot(t,e){var n=new _t(t[0],t[1]);return _t.GetDotStroke(n,e,8);}},{key:"computLine",value:function computLine(t,e){var n=[],i=[];var s,o;for(var a=0;a<t.length;a+=2){var u=new _t(t[a],t[a+1]);var h=void 0;if(a==t.length-2){var v=new _t(t[a-2],t[a-1]);h=xt.Sub(u,v).uni(),s=u;}else{a===0&&(o=u);var _v2=new _t(t[a+2],t[a+3]);h=xt.Sub(_v2,u).uni();}if(h){var _v3=xt.Per(h).mul(e);n.push(_t.Sub(u,_v3)),i.push(_t.Add(u,_v3));}}if(s&&o){var _a6=_t.GetSemicircleStroke(s,n[n.length-1],-1,8),_u4=_t.GetSemicircleStroke(o,i[0],-1,8);return n.concat(_a6,i.reverse(),_u4);}return[];}},{key:"replace",value:function replace(t,e,n){var _this40=this;var s;if(!e){n&&t.append(n);return;}var i=t.getElementsByName(e);if(i.length){var _iterator28=_createForOfIteratorHelper(i),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var o=_step28.value;n?aAt(n,o,t):(o.remove(),_zr(o,t.parent));}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}}else n&&t.append(n);this.fullLayer!==this.drawLayer&&(this.fullLayer===t?(s=this.drawLayer)==null||s.getElementsByName(e).forEach(function(a){var u;a.remove(),_zr(a,(u=_this40.drawLayer)==null?void 0:u.parent);}):this.fullLayer.getElementsByName(e).forEach(function(a){a.remove(),_zr(a,_this40.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(t,e){var n=[];t.getElementsByName(this.workId).forEach(function(i){i.id&&e&&Number(i.id)<e&&n.push(i);});for(var _i3=0,_n3=n;_i3<_n3.length;_i3++){var i=_n3[_i3];i.remove(),_zr(i,t.parent);}}}],[{key:"normalizeStorageData",value:function(){var _normalizeStorageData=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(t){return _regenerator().w(function(_context10){while(1)switch(_context10.n){case 0:return _context10.a(2,this.normalizeStorageDataSync(t));}},_callee10,this);}));function normalizeStorageData(_x16){return _normalizeStorageData.apply(this,arguments);}return normalizeStorageData;}()},{key:"normalizeStorageDataSync",value:function normalizeStorageDataSync(t){var e=gr(t),n=JSON.stringify(t);if(e.opt){var i=gp(e.opt);e.opt=Yy(void 0,i);}return e.updateNodeOpt=_objectSpread(_objectSpread({},e.updateNodeOpt),{},{useAnimation:!1}),{status:JSON.stringify(e)===n?"already-stable":"stable",value:e};}},{key:"normalizeDrawableStorageData",value:function(){var _normalizeDrawableStorageData=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(t){return _regenerator().w(function(_context11){while(1)switch(_context11.n){case 0:return _context11.a(2,this.normalizeDrawableStorageDataSync(t));}},_callee11,this);}));function normalizeDrawableStorageData(_x17){return _normalizeDrawableStorageData.apply(this,arguments);}return normalizeDrawableStorageData;}()},{key:"normalizeDrawableStorageDataSync",value:function normalizeDrawableStorageDataSync(t){var e=Zr.normalizeStorageDataSync(t);if(e.status==="unrecoverable")return e;var n=e.value;return n.type===Tt.DrawWork&&!n.ops&&Array.isArray(n.op)&&n.op.length?(n.type=Tt.FullWork,n.ops=Br(n.op),{status:"stable",value:n}):e;}},{key:"updateNodeOpt",value:function updateNodeOpt(t){var S;var e=t.node,n=t.opt,i=t.vNodes,s=t.willSerializeData,o=t.targetNode,a=n.zIndex,u=n.translate,h=n.angle,v=n.originPoint,p=n.scenePoint,y=n.scale,C=n.pointMap,b=n.thickness;var M;var L=o&&gr(o)||i.get(e.name);if(!L)return;var X=n.eraserGeometryDelta,et=!!X||!!v&&!!y&&!!o||!!s&&(!!u||$e(h))?Wo(L.op,L.centerPos):void 0;if(X&&(!et||!w2(X,L.op,L.centerPos)))return;X&&mv(i,e.name,X.matrix);var A;$e(a)&&(e.setAttribute("zIndex",a),L.opt.zIndex=a);var w=e.parent;if(w){if(v&&y&&o){var _L$opt$eraserFaces;if(A=[y[0],0,0,y[1],p[0]*(1-y[0])+((u==null?void 0:u[0])||0),p[1]*(1-y[1])+((u==null?void 0:u[1])||0)],yf(L.op,p,y,u),ja(L.centerPos,p,y,u),L.opt.translate=void 0,L.opt.scale=void 0,L.opt.eraserlines)for(var x=0;x<L.opt.eraserlines.length;x++){var _L$opt$eraserlines$x=L.opt.eraserlines[x],P=_L$opt$eraserlines$x.op,z=_L$opt$eraserlines$x.thickness;L.opt.eraserlines[x].thickness=Math.round(z*Math.max(Math.abs(y[0]),Math.abs(y[1])));for(var U=0;U<P.length;U++)ja(P[U],p,y,u);}No(L.opt)&&(L.opt.eraserFaces=Ld((_L$opt$eraserFaces=L.opt.eraserFaces)!==null&&_L$opt$eraserFaces!==void 0?_L$opt$eraserFaces:null,function(x){return ja(x,p,y,u);}),delete L.opt.eraserlines);}else if(u){if(e.setAttribute("translate",u),L.opt.translate=u,o){var _x18=[u[0]*w.worldScaling[0],u[1]*w.worldScaling[1]];M=tl(L.rect,_x18),L.rect=M;}else{var _x19=Zr.getRectFromLayer(w,e.name);L.rect=_x19||L.rect;}}else if($e(h))if(e.setAttribute("rotate",h),L.opt.rotate=h,o)M=Uv(L.rect,h),L.rect=M;else{var _x20=Zr.getRectFromLayer(w,e.name);L.rect=_x20||L.rect;}if(C){var _x21=C.get(e.name);if(_x21)for(var _P3=0,_z2=0;_P3<L.op.length;_P3+=3,_z2++)L.op[_P3]=_x21[_z2][0],L.op[_P3+1]=_x21[_z2][1];}if(b&&(S=L==null?void 0:L.opt)!=null&&S.thickness&&(L.opt.thickness=b),s&&!(v&&y&&o)){if(u){var _L$opt$eraserFaces2;A=[1,0,0,1,u[0],u[1]];var _x22=L.op.map(function(P,z){var U=z%3;return U===0?P+u[0]:U===1?P+u[1]:P;});if(L.op=_x22,L.centerPos=[L.centerPos[0]+u[0],L.centerPos[1]+u[1]],L!=null&&L.opt&&(L.opt.translate=void 0),L.opt.eraserlines)for(var _P4=0;_P4<L.opt.eraserlines.length;_P4++){var _z3=L.opt.eraserlines[_P4].op;for(var _U2=0;_U2<_z3.length;_U2++){var K=_z3[_U2].map(function(j,nt){return nt%2?j+u[1]:j+u[0];});L.opt.eraserlines[_P4].op[_U2]=K;}}No(L.opt)&&(L.opt.eraserFaces=Ld((_L$opt$eraserFaces2=L.opt.eraserFaces)!==null&&_L$opt$eraserFaces2!==void 0?_L$opt$eraserFaces2:null,function(P){for(var _z4=0;_z4<P.length;_z4+=2)P[_z4]+=u[0],P[_z4+1]+=u[1];}),delete L.opt.eraserlines);}else if($e(h)){var _L$opt$eraserFaces3;var _x23=Math.PI*h/180,_P5=Math.cos(_x23),_z5=Math.sin(_x23),_L$centerPos=_slicedToArray(L.centerPos,2),_U3=_L$centerPos[0],_K2=_L$centerPos[1];A=[_P5,_z5,-_z5,_P5,_U3-_P5*_U3+_z5*_K2,_K2-_z5*_U3-_P5*_K2];var j=L.op;if(tAt(j,L.centerPos,h),L.op=j,L!=null&&L.opt&&(L.opt.rotate=void 0),L.opt.eraserlines)for(var nt=0;nt<L.opt.eraserlines.length;nt++){var ct=L.opt.eraserlines[nt].op;for(var B=0;B<ct.length;B++)$1(ct[B],L.centerPos,h);}No(L.opt)&&(L.opt.eraserFaces=Ld((_L$opt$eraserFaces3=L.opt.eraserFaces)!==null&&_L$opt$eraserFaces3!==void 0?_L$opt$eraserFaces3:null,function(nt){return $1(nt,L.centerPos,h);}),delete L.opt.eraserlines);}}if(et&&A){var _x24=Wo(L.op,L.centerPos);if(X&&X.toDigest!==_x24)return;X||(Amt(i,e.name,o,A),bmt(i,e.name,{matrix:A,fromDigest:et,toDigest:_x24},o));}L&&i.setInfo(e.name,L);}}},{key:"getCenterPos",value:function getCenterPos(t,e){var n=e.worldPosition,i=e.worldScaling;return[(t.x+t.w/2-n[0])/i[0],(t.y+t.h/2-n[1])/i[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(t,e){var n=t.getElementsByName(e)[0];if(n){var i=n.getBoundingClientRect();return{x:Math.floor(i.x-Zr.SafeBorderPadding),y:Math.floor(i.y-Zr.SafeBorderPadding),w:Math.floor(i.width+Zr.SafeBorderPadding*2),h:Math.floor(i.height+Zr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(t){var e=t.toolsType,n=t.opt,i=t.node,s=t.updateOpt,o=t.willSerializeData;return!!(o&&(s.angle||s.translate)||s.thickness&&n.thickness&&n.thickness!==s.thickness||s.strokeType&&n.strokeType&&n.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(i.name)||e===St.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(i.name))||e===St.BackgroundSVG&&(s.translate||s.scale)||e===St.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&n.type===lf.Iconify)||e===s.toolsType&&s.willRefresh||n.eraserlines&&n.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();ht(Zr,"SafeBorderPadding",10);var Gt=Zr;var Rv=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);function tT(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;return Math.abs(r[0]-t[0])<e&&Math.abs(r[1]-t[1])<e;}function Bxt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(r.length===0)return[];var e=[[r[0][0],r[0][1]]];for(var n=1;n<r.length;n++)tT([r[n][0],r[n][1]],e[e.length-1],t)||e.push([r[n][0],r[n][1]]);return e;}function Fxt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(r.length<=2)return r;var e=r[0],n=r[r.length-1];return tT(e,n,t)?r.slice(0,-1):r;}function Wxt(r){var t=r.reduce(function(n,i){return n+i[0];},0)/r.length,e=r.reduce(function(n,i){return n+i[1];},0)/r.length;return[t,e];}function I1(r,t){return Math.atan2(t[1]-r[1],t[0]-r[0]);}function Uxt(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;if(r.length<=2)return r;var e=[];var _iterator29=_createForOfIteratorHelper(r),_step29;try{var _loop3=function _loop3(){var i=_step29.value;e.some(function(o){return Math.abs(o[0]-i[0])<t&&Math.abs(o[1]-i[1])<t;})||e.push([i[0],i[1]]);};for(_iterator29.s();!(_step29=_iterator29.n()).done;){_loop3();}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}var n=Wxt(e);return e.sort(function(i,s){var o=I1(n,i),a=I1(n,s);return o-a;});}function zxt(r,t){var e=t[0].x<t[t.length-1].x;return r.map(function(i){var o=i.map(function(a){var u=-1,h=1/0,v=0;for(var p=0;p<t.length;p++){var y=t[p],C=Math.sqrt(Math.pow(y.x-a[0],2)+Math.pow(y.y-a[1],2));C<h&&(h=C,u=p,v=y.z);}return{point:a,index:u,bestZ:v};}).sort(function(a,u){return a.index-u.index;}).map(function(a){return[].concat(_toConsumableArray(a.point),[a.bestZ]);});return e&&o[0][0]>o[o.length-1][0]||!e&&o[0][0]<o[o.length-1][0]?o.reverse():o;}).sort(function(i,s){var o=i[0][0],a=s[0][0];return e?o-a:a-o;});}function $xt(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0.01;var i=r.map(function(p){return[p.x,p.y];}),s=function s(p,y){return p.map(function(_ref69){var _ref70=_slicedToArray(_ref69,2),C=_ref70[0],b=_ref70[1];return{X:Math.round(C*y),Y:Math.round(b*y)};});},o=new vr.ClipperOffset();o.AddPath(s(i,1e3),vr.JoinType.jtRound,vr.EndType.etOpenButt);var a=[];o.Execute(a,1);var u=new vr.Clipper();u.AddPaths(a,vr.PolyType.ptSubject,!0),t.forEach(function(p){u.AddPath(s(p,1e3),vr.PolyType.ptClip,!0);});var h=new vr.Paths();u.Execute(vr.ClipType.ctDifference,h,vr.PolyFillType.pftNonZero,vr.PolyFillType.pftNonZero);var v=h.map(function(p){return Fxt(Uxt(Bxt(p.map(function(y){return[y.X/1e3,y.Y/1e3];}),e),e),e);}).filter(function(p){return p.length>=2;});return zxt(v,r);}var eT=/*#__PURE__*/function(_Gt){function eT(e){var _this41;_classCallCheck(this,eT);_this41=_callSuper(this,eT,[e]);ht(_this41,"canRotate",!0);ht(_this41,"scaleType",Ae.all);ht(_this41,"toolsType",St.Pencil);ht(_this41,"syncTimestamp");ht(_this41,"syncIndex",0);ht(_this41,"tmpPoints",[]);ht(_this41,"MAX_REPEAR",10);/** 合并原始点的灵敏度 */ht(_this41,"uniThickness");ht(_this41,"workOptions");ht(_this41,"centerPos",[0,0]);_this41.workOptions=e.toolsOpt,_this41.uniThickness=_this41.MAX_REPEAR/_this41.workOptions.thickness/10,_this41.syncTimestamp=0;return _this41;}_inherits(eT,_Gt);return _createClass(eT,[{key:"setPointVector",value:function setPointVector(e,n){if(!n)return!1;var i=e.x-n.x,s=e.y-n.y;if(i===0&&s===0)return!1;var o=xt.Sub(e,n).uni();return!Number.isFinite(o.x)||!Number.isFinite(o.y)?!1:(e.setv(o),!0);}/** 批量合并消费本地数据,返回绘制结果 */},{key:"combineConsume",value:function combineConsume(){var a;var e=(a=this.workId)==null?void 0:a.toString();if(this.tmpPoints.length<2)return{type:Tt.None};var n=this.transformDataAll(!0),i={name:e};var s;var o=this.drawLayer||this.fullLayer;return n.length&&(s=this.draw({attrs:i,tasks:n,replaceId:e,layer:o})),{rect:s,type:Tt.DrawWork,dataType:Qt.Local};}},{key:"setWorkOptions",value:function setWorkOptions(e){_superPropGet(eT,"setWorkOptions",this,3)([e]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(e){var _this42=this;var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.drawCount,u=e.removeDrawCount,h=e.isSimpleWorker,v=n.workId,p=n.syncUnitTime;p&&(this.syncUnitTime=p);var _this$transformData=this.transformData(n,!1),y=_this$transformData.tasks,C=_this$transformData.effects,b=_this$transformData.consumeIndex;this.syncIndex=Math.min(this.syncIndex,b,Math.max(0,this.tmpPoints.length-2));var M={name:v,id:$e(a)&&a.toString()||void 0};var L,X=!1;var Y=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),y.length&&(y[0].taskId-this.syncTimestamp>this.syncUnitTime&&(X=!0,this.syncTimestamp=y[0].taskId,this.syncIndex=this.tmpPoints.length),s||o||h)){var w=i?this.fullLayer:this.drawLayer||this.fullLayer;L=this.draw({attrs:M,tasks:y,effects:C,layer:w,removeDrawCount:u});}if(h){var _w3=[];this.tmpPoints.slice(Y).forEach(function(x){_w3.push(x.x,x.y,_this42.computRadius(x.z,_this42.workOptions.thickness));});var S=!this.workOptions.previewLocalOnly&&X;return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:Tt.DrawWork,dataType:Qt.Local,op:S?_w3:void 0,index:S?Y*3:void 0,rect:L,updateNodeOpt:{useAnimation:!0}});}if(s)return b>10&&this.tmpPoints.splice(0,b-10),{rect:L,type:Tt.DrawWork,dataType:Qt.Local};var et=[];this.tmpPoints.slice(Y).forEach(function(w){et.push(w.x,w.y,_this42.computRadius(w.z,_this42.workOptions.thickness));});var A=!this.workOptions.previewLocalOnly&&X;return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:Tt.DrawWork,dataType:Qt.Local,rect:L,op:A?et:void 0,index:A?Y*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"consumeAll",value:function consumeAll(e){var v;var n=this.workId;if(e.data){var _e$data=e.data,p=_e$data.op,y=_e$data.workState;p!=null&&p.length&&y===te.Done&&this.workOptions.strokeType===Ne.Stroke&&this.updateTempPointsWithPressureWhenDone(p);}var i=this.fullLayer;if(this.tmpPoints.length<2)return this.replace(i,n),{type:Tt.RemoveNode,removeIds:[n]};var s=this.transformDataAll(!0),o={name:n};var a;s.length&&(a=this.draw({attrs:o,tasks:s,replaceId:n,layer:i}));var u=[];this.tmpPoints.map(function(p){u.push(p.x,p.y,p.z);}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;var h=Br(u);return(v=this.vNodes)==null||v.setInfo(n,{rect:a,op:u,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:a&&Gt.getCenterPos(a,i)}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{rect:a,type:Tt.FullWork,dataType:Qt.Local,ops:h,updateNodeOpt:{pos:this.centerPos,useAnimation:!0}});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(e){var p,y;var n=e.op,i=e.isFullWork,s=e.replaceId,_e$workState=e.workState,o=_e$workState===void 0?te.Done:_e$workState;this.tmpPoints.length=0;for(var C=0;C<n.length;C+=3){var b=new _t(n[C],n[C+1],n[C+2]);if(this.tmpPoints.length>0){var M=this.tmpPoints[this.tmpPoints.length-1];if(!this.setPointVector(b,M))continue;}this.tmpPoints.push(b);}if(this.tmpPoints.length<2)return;var a=this.transformDataAll(!0),u=(p=this.workId)==null?void 0:p.toString(),h={name:u};var v;if(u&&a.length){var _C2=i?this.fullLayer:this.drawLayer||this.fullLayer;v=this.draw({attrs:h,tasks:a,replaceId:s,layer:_C2,isDrawEraserlines:o===te.Done}),(y=this.vNodes)==null||y.setInfo(u,{rect:v,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Gt.getCenterPos(v,_C2)});}return v;}},{key:"computPencilPoints",value:function computPencilPoints(e){var _this43=this;var n=[],i=e.op,s=e.eraserPolylines,o=e.eraserThickness;this.tmpPoints.length=0;for(var u=0;u<i.length;u+=3){var h=new _t(i[u],i[u+1],i[u+2]);if(this.tmpPoints.length>0){var v=this.tmpPoints[this.tmpPoints.length-1];if(!this.setPointVector(h,v))continue;}this.tmpPoints.push(h);}if(this.tmpPoints.length<2)return;var a=this.transformDataAll(!0);if(a.length){var _loop4=function _loop4(){var _a$_u=a[_u5],h=_a$_u.pos,v=_a$_u.points,p=v.map(function(b){return b.point.addXY(h[0],h[1]);}),y=[];var _iterator30=_createForOfIteratorHelper(s),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var b=_step30.value;var M=[];for(var X=0;X<b.length;X+=2){var Y=new _t(b[X],b[X+1]);if(M.length>0){var et=M[M.length-1].point;if(!_this43.setPointVector(Y,et))continue;}M.push({point:Y,radius:o});}var _this43$computStroke=_this43.computStroke(M,!1),L=_this43$computStroke.ps;y.push(L.map(function(X){return X.XY;}));}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}$xt(p,y,0.01).forEach(function(b){n.push(b.map(function(M){return[M[0],M[1],M[2]];}).flat(1));});};for(var _u5=0;_u5<a.length;_u5++){_loop4();}}return n;}},{key:"transformDataAll",value:function transformDataAll(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.getTaskPoints(this.tmpPoints,e&&this.workOptions.thickness||void 0);}},{key:"draw",value:function draw(e){var _this44=this;var n=e.attrs,i=e.tasks,s=e.replaceId,o=e.effects,a=e.layer,u=e.removeDrawCount,_e$isDrawEraserlines=e.isDrawEraserlines,h=_e$isDrawEraserlines===void 0?!0:_e$isDrawEraserlines,_this$workOptions=this.workOptions,v=_this$workOptions.strokeColor,p=_this$workOptions.strokeType,y=_this$workOptions.thickness,C=_this$workOptions.zIndex,b=_this$workOptions.scale,M=_this$workOptions.rotate,L=_this$workOptions.translate,X=_this$workOptions.eraserlines,Y=_this$workOptions.eraserFaces,et=_this$workOptions.doingLines,A=_this$workOptions.lineCap,w=_this$workOptions.lineDash;o!=null&&o.size&&(o.forEach(function(K){var j;(j=a.getElementById(K+""))==null||j.remove();}),o.clear()),u&&this.removeDrawCountNodes(a,u);var S;var x=[],P=a.worldPosition,z=a.worldScaling;for(var K=0;K<i.length;K++){var _i$K=i[K],j=_i$K.pos,nt=_i$K.points,_this$computDrawPoint=this.computDrawPoints(nt),ct=_this$computDrawPoint.ps,B=_this$computDrawPoint.rect;var N=void 0;var G=nt.length===1;p===Ne.Stroke||G?N=Jn(ct,!0):N=Jn(ct,!1);var q={pos:j,d:N,fillColor:p===Ne.Stroke||G?v:void 0,lineDash:G?void 0:p===Ne.Dotted?[w&&w[0]||1,(w&&w[1]||2)*y]:p===Ne.LongDotted?[(w&&w[0]||1)*y,(w&&w[1]||2)*y]:void 0,strokeColor:v,lineCap:G?void 0:A,lineWidth:p===Ne.Stroke||G?0:y};S=Kt(S,{x:Math.floor((B.x+j[0])*z[0]+P[0]-Gt.SafeBorderPadding),y:Math.floor((B.y+j[1])*z[1]+P[1]-Gt.SafeBorderPadding),w:Math.floor(B.w*z[0]+2*Gt.SafeBorderPadding),h:Math.floor(B.h*z[1]+2*Gt.SafeBorderPadding)}),x.push(q);}b&&(n.scale=b),M&&(n.rotate=M),L&&(n.translate=L);var U=new nr();if(S){this.centerPos=Gt.getCenterPos(S,a);var _K3=p===Ne.Stroke&&!X&&!Y&&!et;U.attr(_objectSpread(_objectSpread({},n),{},{normalize:!0,anchor:[0.5,0.5],bgcolor:_K3?v:void 0,pos:this.centerPos,size:[(S.w-2*Gt.SafeBorderPadding)/z[0],(S.h-2*Gt.SafeBorderPadding)/z[1]],zIndex:C}));var _j2=x.map(function(nt){return nt.pos=[nt.pos[0]-_this44.centerPos[0],nt.pos[1]-_this44.centerPos[1]],new $r(nt);});U.append.apply(U,_toConsumableArray(_j2)),_K3&&U.seal(),(X||Y||et)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:U,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:Y,pos:this.centerPos,layer:a},h)),this.replace(a,s,U);}if(b||M||L){var _K4=U==null?void 0:U.getBoundingClientRect();_K4&&(S={x:Math.floor(_K4.x-Gt.SafeBorderPadding),y:Math.floor(_K4.y-Gt.SafeBorderPadding),w:Math.floor(_K4.width+Gt.SafeBorderPadding*2),h:Math.floor(_K4.height+Gt.SafeBorderPadding*2)});}return this.isDelete&&U.setAttribute("opacity",0),S;}},{key:"computDrawPoints",value:function computDrawPoints(e){return this.workOptions.strokeType===Ne.Stroke||e.length===1?this.computStroke(e):this.computNomal(e);}},{key:"computNomal",value:function computNomal(e){var n=this.workOptions.thickness;var i=e.map(function(s){return n=Math.max(n,s.radius),s.point;});return{ps:i,rect:Ye(i,n)};}},{key:"computStroke",value:function computStroke(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return e.length===1?this.computDotStroke(e[0]):this.computLineStroke(e,n);}},{key:"computLineStroke",value:function computLineStroke(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var i=[],s=[];for(var u=0;u<e.length;u++){var _e$u=e[u],h=_e$u.point,v=_e$u.radius;var p=h.v;u===0&&e.length>1&&(p=e[u+1].point.v);var y=xt.Per(p).mul(v);i.push(_t.Sub(h,y)),s.push(_t.Add(h,y));}var o=e[e.length-1];if(n){var _u6=_t.GetSemicircleStroke(o.point,i[i.length-1],-1,8),_h3=_t.GetSemicircleStroke(e[0].point,s[0],-1,8),_v4=i.concat(_u6,s.reverse(),_h3);return{ps:_v4,rect:Ye(_v4)};}var a=i.concat(s.reverse());return{ps:a,rect:Ye(a)};}},{key:"computDotStroke",value:function computDotStroke(e){var n=e.point,i=e.radius,s={x:n.x-i,y:n.y-i,w:i*2,h:i*2};return{ps:_t.GetDotStroke(n,i,8),rect:s};}},{key:"transformData",value:function transformData(e,n){var i=e.op,s=e.workState;var o=this.tmpPoints.length-1,a=[];if(i!=null&&i.length&&s){var _this$workOptions2=this.workOptions,u=_this$workOptions2.strokeType,h=_this$workOptions2.thickness,v=/* @__PURE__ */new Set(),p=Math.max(0,this.tmpPoints.length-1);u===Ne.Stroke?this.updateTempPointsWithPressure(i,h,v):this.updateTempPoints(i,h,v),o=p;var y=n?this.tmpPoints:this.tmpPoints.slice(o);return a=this.getTaskPoints(y,h),{tasks:a,effects:v,consumeIndex:o};}return{tasks:a,consumeIndex:o};}/** 压力渐变公式 */},{key:"computRadius",value:function computRadius(e,n){return e*0.03*n+n*0.5;}},{key:"getMinZ",value:function getMinZ(e,n){return((n||Math.max(1,Math.floor(e*0.3)))-e*0.5)*100/e/3;}},{key:"getTaskPoints",value:function getTaskPoints(e,n){var p;var i=[];if(e.length===0)return[];var s=0,o=e[0].x,a=e[0].y,u=[o,a],h=[],v=e[0].t;for(;s<e.length;){var y=e[s],C=y.x-o,b=y.y-a,M=y.z,L=n?this.computRadius(M,n):M;if(h.push({point:new _t(C,b,M,e[s].v),radius:L}),s>0&&s<e.length-1){var X=e[s].getAngleByPoints(e[s-1],e[s+1]);if(X<60||X>300){var Y=(p=h.pop())==null?void 0:p.point.clone();Y&&i.push({taskId:v,pos:u,points:[].concat(_toConsumableArray(h),[{point:Y,radius:L}])}),o=e[s].x,a=e[s].y,u=[o,a];var et=y.x-o,A=y.y-a;h=[{point:new _t(et,A,M),radius:L}],v=Date.now();}}s++;}return i.push({taskId:v,pos:u,points:h}),i;}},{key:"updateTempPointsWithPressure",value:function updateTempPointsWithPressure(e,n,i){var s=Date.now(),o=this.tmpPoints.length;var a=o;for(var h=0;h<e.length;h+=2){a=Math.min(a,o);var v=this.tmpPoints.length,p=new _t(e[h],e[h+1]);if(v===0){this.tmpPoints.push(p);continue;}var y=v-1,C=this.tmpPoints[y];if(p.x===C.x&&p.y===C.y){C.z<this.MAX_REPEAR&&C.setz(Math.min(C.z+1,this.MAX_REPEAR));continue;}var b=xt.Sub(p,C).uni();if(p.isNear(C,n)){var X=C.z;if(C.z<this.MAX_REPEAR&&(X=Math.min(C.z+1,this.MAX_REPEAR),v>1)){var A=v-1;for(;A>0;){var w=this.tmpPoints[A].distance(this.tmpPoints[A-1]),S=Math.max(this.tmpPoints[A].z-this.uniThickness*w,0);if(this.tmpPoints[A-1].z>=S)break;this.tmpPoints[A-1].setz(S),a=Math.min(a,A-1),A--;}}if(a=Math.min(a,y),C.t){p.setz(X),p.setv(b),this.tmpPoints.push(p);continue;}var Y=this.tmpPoints[y-1],et=Y?xt.Sub(p,Y).uni():C.v;C.set(p.x,p.y,X,et);continue;}p.setv(b);var M=p.distance(C),L=Math.max(C.z-this.uniThickness*M,0);v>1&&xt.Equals(b,C.v,0.01)&&(L>0||C.z<=0)&&(C.t||this.tmpPoints.pop(),a=Math.min(y,a)),p.setz(L),this.tmpPoints.push(p);}if(a===1/0)return this.tmpPoints.length;var u=o;if(a===o){u=Math.max(u-1,0);var _h4=this.tmpPoints[u].t;_h4&&(i==null||i.add(_h4));}else{var _h5=o-1;for(u=a;_h5>=0;){var _v5=this.tmpPoints[_h5].t;if(_v5&&(i==null||i.add(_v5),_h5<=a)){u=_h5,_h5=-1;break;}_h5--;}}return this.tmpPoints[this.tmpPoints.length-1].setT(s),u;}},{key:"updateTempPoints",value:function updateTempPoints(e,n,i){var h;var s=Date.now(),o=this.tmpPoints.length;var a=o;for(var v=0;v<e.length;v+=2){var p=this.tmpPoints.length,y=new _t(e[v],e[v+1]);if(p===0){this.tmpPoints.push(y);continue;}var C=p-1,b=this.tmpPoints[C];if(y.x===b.x&&y.y===b.y)continue;var M=xt.Sub(y,b).uni();if(y.isNear(b,n/2)){if(b.t){y.setz(b.z),y.setv(M),this.tmpPoints.push(y),a=Math.min(C,a);continue;}var L=this.tmpPoints[C-1],X=L?xt.Sub(y,L).uni():b.v;b.set(y.x,y.y,b.z,X),a=Math.min(C,a);continue;}xt.Equals(M,b.v,0.01)&&(b.t||this.tmpPoints.pop(),a=Math.min(C,a)),y.setv(M),this.tmpPoints.push(y);}var u=o;if(a===o){u=Math.max(u-1,0);var _v6=this.tmpPoints[u].t;_v6&&(i==null||i.add(_v6));}else{var _v7=Math.min(o-1,a);for(u=a;_v7>=0;){var _p2=(h=this.tmpPoints[_v7])==null?void 0:h.t;if(_p2&&(i==null||i.add(_p2),_v7<=a)){u=_v7,_v7=-1;break;}_v7--;}}return this.tmpPoints[this.tmpPoints.length-1].setT(s),u;}},{key:"updateTempPointsWithPressureWhenDone",value:function updateTempPointsWithPressureWhenDone(e){var n=this.workOptions.thickness,i=e.length,s=this.getMinZ(n);for(var o=0;o<i;o+=2){var a=this.tmpPoints.length,u=new _t(e[o],e[o+1]);if(a===0){this.tmpPoints.push(u);continue;}var h=a-1,v=this.tmpPoints[h];if(u.x===v.x&&u.y===v.y){v.z<this.MAX_REPEAR&&v.setz(Math.min(v.z+1,this.MAX_REPEAR));continue;}var p=xt.Sub(u,v).uni(),y=u.distance(v);if(a>1&&v.z===s)break;if(u.isNear(v,n/2)){var b=v.z;if(i<3&&v.z<this.MAX_REPEAR&&(b=Math.min(v.z+1,this.MAX_REPEAR),a>1)){var X=a-1;for(;X>0;){var Y=this.tmpPoints[X].distance(this.tmpPoints[X-1]),et=Math.max(this.tmpPoints[X].z-this.uniThickness*Y,-n/4);if(this.tmpPoints[X-1].z>=et)break;this.tmpPoints[X-1].setz(et),X--;}}if(v.t){u.setz(b),u.setv(p),this.tmpPoints.push(u);continue;}var M=this.tmpPoints[h-1],L=M?xt.Sub(u,M).uni():v.v;v.set(u.x,u.y,b,L);continue;}u.setv(p);var C=Math.max(v.z-this.uniThickness*y,s);a>1&&xt.Equals(p,v.v,0.01)&&v.z<=0&&(v.t||this.tmpPoints.pop()),u.setz(C),this.tmpPoints.push(u);}}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var p,y;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.strokeType,u=i.lineCap,h=i.lineDash,v=s.get(n.name);return o&&(n.tagName==="GROUP"?oAt(n)?n.setAttribute("bgcolor",o):n.children.forEach(function(C){C.setAttribute("strokeColor",o),C.getAttribute("fillColor")&&C.setAttribute("fillColor",o);}):(n.setAttribute("strokeColor",o),n.setAttribute("fillColor",o)),(p=v==null?void 0:v.opt)!=null&&p.strokeColor&&(v.opt.strokeColor=o)),a&&v!=null&&v.opt&&(y=v.opt)!=null&&y.strokeType&&(v.opt.strokeType=a),u&&v!=null&&v.opt&&(v.opt.lineCap=u),h&&v!=null&&v.opt&&(v.opt.lineDash=h),v&&s.setInfo(n.name,v),Gt.updateNodeOpt(e);}}]);}(Gt);var rT=/*#__PURE__*/function(_Gt2){function rT(e){var _this45;_classCallCheck(this,rT);_this45=_callSuper(this,rT,[e]);ht(_this45,"toolsType",St.LaserPen);ht(_this45,"canRotate",!1);ht(_this45,"scaleType",Ae.none);ht(_this45,"syncTimestamp");ht(_this45,"syncIndex",0);ht(_this45,"tmpPoints",[]);ht(_this45,"workOptions");ht(_this45,"consumeIndex",0);_this45.workOptions=e.toolsOpt,_this45.syncTimestamp=0;return _this45;}_inherits(rT,_Gt2);return _createClass(rT,[{key:"combineConsume",value:function combineConsume(){}},{key:"setWorkOptions",value:function setWorkOptions(e){_superPropGet(rT,"setWorkOptions",this,3)([e]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(e){var n=e.data,i=e.isSubWorker,s=n.workId,o=n.op,a=n.syncUnitTime;if((o==null?void 0:o.length)===0)return{type:Tt.None};if(a&&(this.syncUnitTime=a),this.updateTempPoints(o||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:Tt.None};var _this$workOptions3=this.workOptions,u=_this$workOptions3.strokeColor,h=_this$workOptions3.thickness,v=_this$workOptions3.strokeType,p=_this$workOptions3.lineDash,y=_this$workOptions3.lineCap,C=Ye(this.tmpPoints,h);var b=!1;var M=this.syncIndex,L=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var X={name:s==null?void 0:s.toString(),opacity:1,lineDash:v===Ne.Dotted?[p&&p[0]||1,(p&&p[1]||2)*h]:v===Ne.LongDotted?[(p&&p[0]||1)*h,(p&&p[1]||2)*h]:void 0,strokeColor:u,lineCap:y,lineWidth:h,anchor:[0.5,0.5]},Y=this.getTaskPoints(L);if(Y.length){var A=Date.now();A-this.syncTimestamp>this.syncUnitTime&&(b=!0,this.syncTimestamp=A,this.syncIndex=this.tmpPoints.length),i&&this.draw({attrs:X,tasks:Y,isDot:!1,layer:this.drawLayer||this.fullLayer});}var et=[];return this.tmpPoints.slice(M).forEach(function(A){et.push(A.x,A.y);}),_objectSpread({rect:{x:C.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:C.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:C.w*this.fullLayer.worldScaling[0],h:C.h*this.fullLayer.worldScaling[1]},type:Tt.DrawWork,dataType:Qt.Local,op:b?et:void 0,index:b?M*2:void 0},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var e=(o=this.workId)==null?void 0:o.toString();var n;if(this.tmpPoints.length-1>this.consumeIndex){var a=this.tmpPoints.slice(this.consumeIndex);var u=a.length===1,_this$workOptions4=this.workOptions,h=_this$workOptions4.strokeColor,v=_this$workOptions4.thickness,p=_this$workOptions4.strokeType;if(u){var b=this.computDotStroke({point:a[0],radius:v/2});a=b.ps,n=b.rect;}else n=Ye(this.tmpPoints,v);var y={name:e==null?void 0:e.toString(),fillColor:u?h:void 0,opacity:1,lineDash:p===Ne.Dotted&&!u?[1,v*2]:p===Ne.LongDotted&&!u?[v,v*2]:void 0,strokeColor:h,lineCap:u?void 0:"round",lineWidth:u?0:v,anchor:[0.5,0.5]},C=this.getTaskPoints(a);C.length&&this.draw({attrs:y,tasks:C,isDot:u,layer:this.drawLayer||this.fullLayer});}var i=[];this.tmpPoints.forEach(function(a){i.push(a.x,a.y);});var s=Br(i);return _objectSpread({rect:n&&{x:n.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:n.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:n.w*this.fullLayer.worldScaling[0],h:n.h*this.fullLayer.worldScaling[1]},type:Tt.FullWork,dataType:Qt.Local,ops:s,index:this.syncIndex*2},this.baseConsumeResult);}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.syncTimestamp=0,this.syncIndex=0;}},{key:"consumeService",value:function consumeService(e){var M;var n=e.op,i=e.replaceId,s=e.isFullWork,_this$workOptions5=this.workOptions,o=_this$workOptions5.strokeColor,a=_this$workOptions5.thickness,u=_this$workOptions5.strokeType;if(!n.length){var L=Ye(this.tmpPoints,a);return{x:L.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:L.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:L.w*this.fullLayer.worldScaling[0],h:L.h*this.fullLayer.worldScaling[1]};}var h=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(n||[]);var v,p=this.tmpPoints.slice(h);var y=p.length===1;if(y){var _L2=this.computDotStroke({point:p[0],radius:a/2});p=_L2.ps,v=_L2.rect;}else v=Ye(this.tmpPoints,a);var C={name:(M=this.workId)==null?void 0:M.toString(),fillColor:y?o:void 0,opacity:1,lineDash:u===Ne.Dotted&&!y?[1,a*2]:u===Ne.LongDotted&&!y?[a,a*2]:void 0,strokeColor:o,lineCap:y?void 0:"round",lineWidth:y?0:a,anchor:[0.5,0.5]},b=this.getTaskPoints(p);if(b.length){var _L3=s?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:C,tasks:b,isDot:y,replaceId:i,layer:_L3});}return{x:v.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:v.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:v.w*this.fullLayer.worldScaling[0],h:v.h*this.fullLayer.worldScaling[1]};}},{key:"computDotStroke",value:function computDotStroke(e){var n=e.point,i=e.radius,s={x:n.x-i,y:n.y-i,w:i*2,h:i*2};return{ps:_t.GetDotStroke(n,i,8),rect:s};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=this.tmpPoints.length;for(var i=0;i<e.length;i+=2){if(n){var s=this.tmpPoints.slice(-1)[0];s&&s.x===e[i]&&s.y===e[i+1]&&this.tmpPoints.pop();}this.tmpPoints.push(new _t(e[i],e[i+1]));}}},{key:"draw",value:function(){var _draw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(e){var n,i,s,o,a,_iterator31,_step31,_loop5,_t15;return _regenerator().w(function(_context13){while(1)switch(_context13.p=_context13.n){case 0:n=e.attrs,i=e.tasks,s=e.isDot,o=e.layer,a=this.workOptions.duration;_iterator31=_createForOfIteratorHelper(i);_context13.p=1;_loop5=/*#__PURE__*/_regenerator().m(function _loop5(){var u,h,v,p,y;return _regenerator().w(function(_context12){while(1)switch(_context12.n){case 0:u=_step31.value;h=new $r(),v=u.pos,p=u.points;s?y=Jn(p,!0):y=Jn(p,!1),h.attr(_objectSpread(_objectSpread({},n),{},{pos:v,d:y})),o.appendChild(h),h.transition(a).attr({scale:s?[0.1,0.1]:[1,1],lineWidth:s?0:1}).then(function(){h.remove();});case 1:return _context12.a(2);}},_loop5);});_iterator31.s();case 2:if((_step31=_iterator31.n()).done){_context13.n=4;break;}return _context13.d(_regeneratorValues(_loop5()),3);case 3:_context13.n=2;break;case 4:_context13.n=6;break;case 5:_context13.p=5;_t15=_context13.v;_iterator31.e(_t15);case 6:_context13.p=6;_iterator31.f();return _context13.f(6);case 7:return _context13.a(2);}},_callee12,this,[[1,5,6,7]]);}));function draw(_x25){return _draw.apply(this,arguments);}return draw;}()},{key:"getTaskPoints",value:function getTaskPoints(e){var h;var n=[];if(e.length===0)return[];var i=0,s=e[0].x,o=e[0].y,a=[s,o],u=[];for(;i<e.length;){var v=e[i],p=v.x-s,y=v.y-o;if(u.push(new _t(p,y)),i>0&&i<e.length-1){var C=e[i].getAngleByPoints(e[i-1],e[i+1]);if(C<60||C>300){var b=(h=u.pop())==null?void 0:h.clone();b&&n.push({pos:a,points:[].concat(_toConsumableArray(u),[b])}),s=e[i].x,o=e[i].y,a=[s,o];var M=v.x-s,L=v.y-o;u=[new _t(M,L)];}}i++;}return n.push({pos:a,points:u}),n;}},{key:"removeLocal",value:function removeLocal(){}},{key:"removeService",value:function removeService(e){var n;var i=[];return this.fullLayer.getElementsByName(e).forEach(function(s){if(s.name===e){var o=s.getBoundingClientRect();n=Kt(n,{x:o.x,y:o.y,w:o.width,h:o.height}),i.push(s);}}),i.length&&i.forEach(function(s){return s.remove();}),n;}}]);}(Gt);var Yxt=yu;yu.polyline=yu;yu.polygon=Gxt;function yu(r,t,e){var n=r.length,i=Mo(r[0],t),s=[],o,a,u,h,v;for(e||(e=[]),o=1;o<n;o++){for(a=r[o-1],u=r[o],h=v=Mo(u,t);;)if(i|h){if(i&h)break;i?(a=Ip(a,u,i,t),i=Mo(a,t)):(u=Ip(a,u,h,t),h=Mo(u,t));}else{s.push(a),h!==v?(s.push(u),o<n-1&&(e.push(s),s=[])):o===n-1&&s.push(u);break;}i=v;}return s.length&&e.push(s),e;}function Gxt(r,t){var e,n,i,s,o,a,u;for(n=1;n<=8;n*=2){for(e=[],i=r[r.length-1],s=!(Mo(i,t)&n),o=0;o<r.length;o++)a=r[o],u=!(Mo(a,t)&n),u!==s&&e.push(Ip(i,a,n,t)),u&&e.push(a),i=a,s=u;if(r=e,!r.length)break;}return e;}function Ip(r,t,e,n){return e&8?[r[0]+(t[0]-r[0])*(n[3]-r[1])/(t[1]-r[1]),n[3]]:// top
|
|
407
407
|
e&4?[r[0]+(t[0]-r[0])*(n[1]-r[1])/(t[1]-r[1]),n[1]]:// bottom
|
|
408
408
|
e&2?[n[2],r[1]+(t[1]-r[1])*(n[2]-r[0])/(t[0]-r[0])]:// right
|
|
409
409
|
e&1?[n[0],r[1]+(t[1]-r[1])*(n[0]-r[0])/(t[0]-r[0])]:// left
|
|
410
|
-
null;}function Mo(r,t){var e=0;return r[0]<t[0]?e|=1:r[0]>t[2]&&(e|=2),r[1]<t[1]?e|=4:r[1]>t[3]&&(e|=8),e;}var Ov=/* @__PURE__ */$n(Yxt),Ro=/*#__PURE__*/function(_Gt3){function Ro(e,n){var _this46;_classCallCheck(this,Ro);_this46=_callSuper(this,Ro,[e]);ht(_this46,"canRotate",!1);ht(_this46,"scaleType",Ae.none);ht(_this46,"toolsType",St.Eraser);ht(_this46,"serviceWork");ht(_this46,"tmpPoints",[]);ht(_this46,"workOptions");ht(_this46,"worldPosition");ht(_this46,"worldScaling");ht(_this46,"eraserRect");ht(_this46,"eraserPolyline");_this46.serviceWork=n,_this46.workOptions=e.toolsOpt,_this46.worldPosition=_this46.fullLayer.worldPosition,_this46.worldScaling=_this46.fullLayer.worldScaling;return _this46;}_inherits(Ro,_Gt3);return _createClass(Ro,[{key:"combineConsume",value:function combineConsume(){}},{key:"consumeService",value:function consumeService(){}},{key:"setWorkOptions",value:function setWorkOptions(e){_superPropGet(Ro,"setWorkOptions",this,3)([e]);}},{key:"createEraserRect",value:function createEraserRect(e){var n=e[0]*this.worldScaling[0]+this.worldPosition[0],i=e[1]*this.worldScaling[1]+this.worldPosition[1],_Ro$eraserSizes$this$=Ro.eraserSizes[this.workOptions.thickness],s=_Ro$eraserSizes$this$.width,o=_Ro$eraserSizes$this$.height;this.eraserRect={x:n-s*0.5,y:i-o*0.5,w:s,h:o},this.eraserPolyline=[this.eraserRect.x,this.eraserRect.y,this.eraserRect.x+this.eraserRect.w,this.eraserRect.y+this.eraserRect.h];}},{key:"computRectCenterPoints",value:function computRectCenterPoints(){var e=this.tmpPoints.slice(-2);if(this.tmpPoints.length===4){var n=new xt(this.tmpPoints[0],this.tmpPoints[1]),i=new xt(this.tmpPoints[2],this.tmpPoints[3]),s=xt.Sub(i,n).uni(),o=xt.Dist(n,i),_Ro$eraserSizes$this$2=Ro.eraserSizes[this.workOptions.thickness],a=_Ro$eraserSizes$this$2.width,u=_Ro$eraserSizes$this$2.height,h=Math.min(a,u),v=Math.round(o/h);if(v>1){var p=[];for(var y=0;y<v;y++){var C=xt.Mul(s,y*h);p.push(this.tmpPoints[0]+C.x,this.tmpPoints[1]+C.y);}return p.concat(e);}}return e;}},{key:"isNear",value:function isNear(e,n){var i=new xt(e[0],e[1]),s=new xt(n[0],n[1]),_Ro$eraserSizes$this$3=Ro.eraserSizes[this.workOptions.thickness],o=_Ro$eraserSizes$this$3.width,a=_Ro$eraserSizes$this$3.height;return xt.Dist(i,s)<Math.hypot(o,a)*0.5;}},{key:"remove",value:function remove(e){var _this47=this;var n=e.curNodeMap,i=e.removeIds;var s;var _iterator32=_createForOfIteratorHelper(n.values()),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var o=_step32.value;if(o.rect&&this.eraserRect&&this.eraserPolyline&&Pu(this.eraserRect,o.rect)){var a=o.op,u=[],h=[];for(var p=0;p<a.length;p+=3){var y=new xt(a[p]*this.worldScaling[0]+this.worldPosition[0],a[p+1]*this.worldScaling[1]+this.worldPosition[1],a[p+2]);h.push(y),u.push(new _t(y.x,y.y));}var v=u.length&&Ye(u)||o.rect;Pu(v,this.eraserRect)&&(h.length>1?Ov.polyline(h.map(function(y){return y.XY;}),this.eraserPolyline).length&&i.add(o.name):i.add(o.name),s=Kt(s,o.rect||v));}}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}return i.forEach(function(o){var u;var a=_this47.fullLayer.getElementsByName(o);a[0]&&(a[0].remove(),_zr(a[0],_this47.fullLayer.parent),(u=_this47.vNodes)==null||u.delete(o));}),s&&(s.x-=Gt.SafeBorderPadding,s.y-=Gt.SafeBorderPadding,s.w+=Gt.SafeBorderPadding*2,s.h+=Gt.SafeBorderPadding*2),s;}},{key:"consume",value:function consume(e){var _e$data2=e.data,n=_e$data2.op,i=_e$data2.disableEraseImage,s=_e$data2.disableEraseText;if(!n||n.length===0)return _objectSpread({type:
|
|
411
|
-
ht(Ro,"eraserSizes",Rv);var wu=Ro;var jxt="__lodash_hash_undefined__";function Xxt(r){return this.__data__.set(r,jxt),this;}var Hxt=Xxt;function Vxt(r){return this.__data__.has(r);}var Zxt=Vxt,qxt=A2,Kxt=Hxt,Qxt=Zxt;function Su(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new qxt();++t<e;)this.add(r[t]);}Su.prototype.add=Su.prototype.push=Kxt;Su.prototype.has=Qxt;var Dv=Su;function Jxt(r,t){for(var e=-1,n=r==null?0:r.length;++e<n;)if(t(r[e],e,r))return!0;return!1;}var _xt=Jxt;function tPt(r,t){return r.has(t);}var Nv=tPt,ePt=Dv,rPt=_xt,nPt=Nv,iPt=1,sPt=2;function oPt(r,t,e,n,i,s){var o=e&iPt,a=r.length,u=t.length;if(a!=u&&!(o&&u>a))return!1;var h=s.get(r),v=s.get(t);if(h&&v)return h==t&&v==r;var p=-1,y=!0,C=e&sPt?new ePt():void 0;for(s.set(r,t),s.set(t,r);++p<a;){var b=r[p],M=t[p];if(n)var L=o?n(M,b,p,t,r,s):n(b,M,p,r,t,s);if(L!==void 0){if(L)continue;y=!1;break;}if(C){if(!rPt(t,function(X,Y){if(!nPt(C,Y)&&(b===X||i(b,X,e,n,s)))return C.push(Y);})){y=!1;break;}}else if(!(b===M||i(b,M,e,n,s))){y=!1;break;}}return s.delete(r),s.delete(t),y;}var nT=oPt;function aPt(r){var t=-1,e=Array(r.size);return r.forEach(function(n,i){e[++t]=[i,n];}),e;}var lPt=aPt;function cPt(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=n;}),e;}var kv=cPt,C1=vl,x1=H2,uPt=wv,fPt=nT,hPt=lPt,dPt=kv,pPt=1,vPt=2,gPt="[object Boolean]",mPt="[object Date]",yPt="[object Error]",wPt="[object Map]",SPt="[object Number]",TPt="[object RegExp]",IPt="[object Set]",CPt="[object String]",xPt="[object Symbol]",PPt="[object ArrayBuffer]",bPt="[object DataView]",P1=C1?C1.prototype:void 0,Od=P1?P1.valueOf:void 0;function APt(r,t,e,n,i,s,o){switch(e){case bPt:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case PPt:return!(r.byteLength!=t.byteLength||!s(new x1(r),new x1(t)));case gPt:case mPt:case SPt:return uPt(+r,+t);case yPt:return r.name==t.name&&r.message==t.message;case TPt:case CPt:return r==t+"";case wPt:var a=hPt;case IPt:var u=n&pPt;if(a||(a=dPt),r.size!=t.size&&!u)return!1;var h=o.get(r);if(h)return h==t;n|=vPt,o.set(r,t);var v=fPt(a(r),a(t),n,i,s,o);return o.delete(r),v;case xPt:if(Od)return Od.call(r)==Od.call(t);}return!1;}var EPt=APt,b1=G2,MPt=1,LPt=Object.prototype,RPt=LPt.hasOwnProperty;function OPt(r,t,e,n,i,s){var o=e&MPt,a=b1(r),u=a.length,h=b1(t),v=h.length;if(u!=v&&!o)return!1;for(var p=u;p--;){var y=a[p];if(!(o?y in t:RPt.call(t,y)))return!1;}var C=s.get(r),b=s.get(t);if(C&&b)return C==t&&b==r;var M=!0;s.set(r,t),s.set(t,r);for(var L=o;++p<u;){y=a[p];var X=r[y],Y=t[y];if(n)var et=o?n(Y,X,y,t,r,s):n(X,Y,y,r,t,s);if(!(et===void 0?X===Y||i(X,Y,e,n,s):et)){M=!1;break;}L||(L=y=="constructor");}if(M&&!L){var A=r.constructor,w=t.constructor;A!=w&&"constructor"in r&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof w=="function"&&w instanceof w)&&(M=!1);}return s.delete(r),s.delete(t),M;}var DPt=OPt,Dd=E2,NPt=nT,kPt=EPt,BPt=DPt,A1=vf,E1=ml,M1=Tv,FPt=k2,WPt=1,L1="[object Arguments]",R1="[object Array]",Yc="[object Object]",UPt=Object.prototype,O1=UPt.hasOwnProperty;function zPt(r,t,e,n,i,s){var o=E1(r),a=E1(t),u=o?R1:A1(r),h=a?R1:A1(t);u=u==L1?Yc:u,h=h==L1?Yc:h;var v=u==Yc,p=h==Yc,y=u==h;if(y&&M1(r)){if(!M1(t))return!1;o=!0,v=!1;}if(y&&!v)return s||(s=new Dd()),o||FPt(r)?NPt(r,t,e,n,i,s):kPt(r,t,u,e,n,i,s);if(!(e&WPt)){var C=v&&O1.call(r,"__wrapped__"),b=p&&O1.call(t,"__wrapped__");if(C||b){var M=C?r.value():r,L=b?t.value():t;return s||(s=new Dd()),i(M,L,e,n,s);}}return y?(s||(s=new Dd()),BPt(r,t,e,n,i,s)):!1;}var $Pt=zPt,YPt=$Pt,D1=Mi;function iT(r,t,e,n,i){return r===t?!0:r==null||t==null||!D1(r)&&!D1(t)?r!==r&&t!==t:YPt(r,t,e,n,iT,i);}var GPt=iT,jPt=GPt;function XPt(r,t){return jPt(r,t);}var HPt=XPt;var Qn=/* @__PURE__ */$n(HPt);function N1(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")");}function VPt(r){var t=r.split(","),e=parseInt(t[0].split("(")[1]),n=parseInt(t[1]),i=parseInt(t[2]),s=Number(t[3].split(")")[0]);return[e,n,i,s];}var Nd="rgb(177,177,177)",Lu=/*#__PURE__*/function(_Gt4){function Lu(e){var _this48;_classCallCheck(this,Lu);var n;_this48=_callSuper(this,Lu,[e]);ht(_this48,"toolsType",St.Selector);ht(_this48,"tmpPoints",[]);ht(_this48,"subTmpPoints",[]);ht(_this48,"workOptions");ht(_this48,"vNodes");ht(_this48,"selectIds");ht(_this48,"selectorColor");ht(_this48,"strokeColor");ht(_this48,"fillColor");ht(_this48,"oldSelectRect");ht(_this48,"oldSubSelectRect");ht(_this48,"canRotate",!1);ht(_this48,"canTextEdit",!1);ht(_this48,"canLock",!1);ht(_this48,"scaleType",Ae.all);ht(_this48,"toolsTypes");ht(_this48,"shapeOpt");ht(_this48,"textOpt");ht(_this48,"isLocked");ht(_this48,"thickness");ht(_this48,"strokeType");ht(_this48,"useStroke");_this48.workOptions=_objectSpread(_objectSpread({},e.toolsOpt),{},{strokeColor:((n=e.toolsOpt)==null?void 0:n.strokeColor)||Nd}),_this48.vNodes=e.vNodes;return _this48;}_inherits(Lu,_Gt4);return _createClass(Lu,[{key:"computSelector",value:function computSelector(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var n=Ye(this.tmpPoints);if(n.w===0||n.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:/* @__PURE__ */new Map()};var _this$vNodes$getRectI=this.vNodes.getRectIntersectRange(n,e),i=_this$vNodes$getRectI.rectRange,s=_this$vNodes$getRectI.nodeRange;return{selectIds:_toConsumableArray(s.keys()),intersectRect:i,subNodeMap:s};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=this.tmpPoints.length,i=e.length;if(i>1){var s=new _t(e[i-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],e[i-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);n===2?this.tmpPoints.splice(1,1,s):this.tmpPoints.push(s);}}},{key:"drawSelector",value:function drawSelector(e){var _this49=this;var n=e.drawRect,i=e.subNodeMap,s=e.selectorId,o=e.layer,a=e.isService,u=new nr({pos:[n.x,n.y],anchor:[0,0],size:[n.w,n.h],id:s,name:s,zIndex:9999}),h=[];if(a){var v=new Bo({normalize:!0,pos:[n.w/2,n.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor||Nd,width:n.w,height:n.h,name:Lu.selectorBorderId});h.push(v);}i.forEach(function(v,p){var y=[v.rect.x+v.rect.w/2-n.x,v.rect.y+v.rect.h/2-n.y],C=new Bo({normalize:!0,pos:y,lineWidth:1,strokeColor:i.size>1?_this49.selectorColor||_this49.workOptions.strokeColor||Nd:void 0,width:v.rect.w,height:v.rect.h,id:"selector-".concat(p),name:"selector-".concat(p)});h.push(C);}),h&&u.append.apply(u,h),(o==null?void 0:o.parent).appendChild(u);}},{key:"draw",value:function draw(e,n,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var u,h;var o=i.intersectRect,a=i.subNodeMap;(h=(u=n.parent)==null?void 0:u.getElementById(e))==null||h.remove(),o&&this.drawSelector({drawRect:o,subNodeMap:a,selectorId:e,layer:n,isService:s});}},{key:"getSelecteorInfo",value:function getSelecteorInfo(e){this.scaleType=Ae.all,this.canRotate=!1,this.textOpt=void 0,this.strokeColor=void 0,this.fillColor=void 0,this.canTextEdit=!1,this.canLock=!1,this.isLocked=!1,this.toolsTypes=void 0,this.shapeOpt=void 0,this.thickness=void 0,this.strokeType=void 0,this.useStroke=!1;var n=/* @__PURE__ */new Set();var i,s=!0;var _iterator36=_createForOfIteratorHelper(e.values()),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var o=_step36.value;var a=o.opt,u=o.canRotate,h=o.scaleType,v=o.toolsType;this.selectorColor=this.workOptions.strokeColor,a.strokeColor&&(this.strokeColor=a.strokeColor),a.fillColor&&(this.fillColor=a.fillColor),a.textOpt&&(this.textOpt=a.textOpt),a.thickness&&(this.thickness=a.thickness),v!==St.Pencil&&(s=!1),a.strokeType&&(this.strokeType=a.strokeType),v===St.SpeechBalloon&&(n.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=a.placement),v===St.Polygon&&(n.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=a.vertices),v===St.Star&&(n.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=a.vertices,this.shapeOpt.innerRatio=a.innerRatio,this.shapeOpt.innerVerticeStep=a.innerVerticeStep),v===St.Text&&(this.textOpt=a),e.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=u,this.scaleType=h),(v===St.Image||v===St.BackgroundSVG)&&(i=o),(h===Ae.proportional&&this.scaleType!==Ae.none||h===Ae.none)&&(this.scaleType=h);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}s&&(this.useStroke=!0),n.size&&(this.toolsTypes=_toConsumableArray(n)),i&&(e.size===1?(this.canLock=!0,(i.toolsType===St.BackgroundSVG?i.opt.locked!==!1:i.opt.locked)&&(this.isLocked=!0,this.scaleType=Ae.none,this.canRotate=!1,this.textOpt=void 0,this.fillColor=void 0,this.selectorColor="rgb(177,177,177)",this.strokeColor=void 0,this.canTextEdit=!1,this.thickness=void 0,this.strokeType=void 0,this.useStroke=void 0)):e.size>1&&!i.opt.locked&&(this.canLock=!1,this.canRotate=!1));}},{key:"getChildrenPoints",value:function getChildrenPoints(){var e,n;if(this.scaleType===Ae.both&&((e=this.selectIds)==null?void 0:e.length)===1){var i=this.selectIds[0],s=(n=this.vNodes.get(i))==null?void 0:n.op;if(s){var o=[];for(var a=0;a<s.length;a+=3)o.push([s[a],s[a+1]]);return o;}}}},{key:"consume",value:function consume(e){if(e.isSubWorker)return this.subWorkerConsume(e);var n=_objectSpread({type:It.Select,dataType:Qt.Local},this.baseConsumeResult);if(e.isSimpleWorker){var v=this.subWorkerConsume(e);n.subRect=v.rect;}var _e$data3=e.data,i=_e$data3.op,s=_e$data3.workState;var o=this.oldSelectRect;if(s===te.Start&&(o=this.unSelectedAllIds()),!(i!=null&&i.length)||!this.vNodes.curNodeMap.size)return e.isSimpleWorker?n:{type:It.None};this.updateTempPoints(i);var a=this.computSelector();if(this.selectIds&&Qn(this.selectIds,a.selectIds))return e.isSimpleWorker?n:{type:It.None};this.selectIds=a.selectIds;var u=a.intersectRect;this.getSelecteorInfo(a.subNodeMap),this.draw(De,this.fullLayer,a),this.oldSelectRect=u;var h=this.getChildrenPoints();return n=_objectSpread(_objectSpread({},n),{},{rect:Kt(u,o),selectIds:a.selectIds,selectRect:u,selectorColor:this.selectorColor,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:h,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType}),n;}},{key:"consumeAll",value:function consumeAll(){var o,a;var e=this.oldSelectRect;var n=this.tmpPoints[0],i=this.tmpPoints[this.tmpPoints.length-1],s=n&&(!i||n.isNear(i,1));if(!((o=this.selectIds)!=null&&o.length)&&n&&s&&this.selectSingleTool(this.tmpPoints[0].XY,De,!1),(a=this.selectIds)!=null&&a.length&&(e=this.selectedByIds(this.selectIds)),e){var u=this.getChildrenPoints();return _objectSpread({type:It.Select,dataType:Qt.Local,rect:this.oldSelectRect,selectIds:this.selectIds,selectorColor:this.selectorColor,selectRect:this.oldSelectRect,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:u,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}return _objectSpread({type:It.Select,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeService",value:function consumeService(){}},{key:"updateTempPointsForSubWorker",value:function updateTempPointsForSubWorker(e){var n=e.slice(-2),i=new _t(n[0],n[1]);if(this.subTmpPoints[0].isNear(i,1))return!1;if(this.subTmpPoints.length===2){if(i.isNear(this.subTmpPoints[1],1))return!1;this.subTmpPoints[1]=i;}else this.subTmpPoints.push(i);return!0;}},{key:"computDrawPoints",value:function computDrawPoints(e){var n=this.workOptions.thickness,i=[];var _iterator37=_createForOfIteratorHelper(e),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var a=_step37.value;i.push(_construct(xt,_toConsumableArray(a)));}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}var s=Ye(i,n),o=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:o,points:i.map(function(a){return a.XY;}).flat(1)};}},{key:"drawForSubWorker",value:function drawForSubWorker(e){var n=e.workId,i=e.layer,s=e.ps,_this$workOptions6=this.workOptions,o=_this$workOptions6.strokeColor,a=_this$workOptions6.scale,u=_this$workOptions6.rotate,h=_this$workOptions6.translate,v=i.worldPosition,p=i.worldScaling,_this$computDrawPoint2=this.computDrawPoints(s),y=_this$computDrawPoint2.points,C=_this$computDrawPoint2.rect,b=_this$computDrawPoint2.pos,M=1/i.worldScaling[0],L=o&&VPt(o)||[0,0,0,0],X={close:!0,normalize:!0,points:y,lineWidth:M,fillColor:N1(L[0],L[1],L[2],0.1),strokeColor:N1(L[0],L[1],L[2],1),lineJoin:"round",lineCap:"round"};var Y={x:Math.floor(C.x*p[0]+v[0]-Gt.SafeBorderPadding),y:Math.floor(C.y*p[1]+v[1]-Gt.SafeBorderPadding),w:Math.floor(C.w*p[0]+2*Gt.SafeBorderPadding),h:Math.floor(C.h*p[0]+2*Gt.SafeBorderPadding)};var et=new nr({name:n,id:n,pos:b,anchor:[0.5,0.5],size:[C.w,C.h],scale:a,rotate:u,translate:h}),A=new zn(_objectSpread(_objectSpread({},X),{},{pos:[0,0]}));if(et.appendChild(A),this.replace(i,n,et),a||u||h){var w=et.getBoundingClientRect();Y={x:Math.floor(w.x-Gt.SafeBorderPadding),y:Math.floor(w.y-Gt.SafeBorderPadding),w:Math.floor(w.width+2*Gt.SafeBorderPadding),h:Math.floor(w.height+2*Gt.SafeBorderPadding)};}return Y;}},{key:"transformData",value:function transformData(e){var n=Ye(e);return[[n.x,n.y,0],[n.x+n.w,n.y,0],[n.x+n.w,n.y+n.h,0],[n.x,n.y+n.h,0]];}},{key:"subWorkerConsume",value:function subWorkerConsume(e){var n=e.data,i=e.isFullWork,s=n.op,o=n.syncUnitTime;o&&(this.syncUnitTime=o);var a=s==null?void 0:s.length;if(!a||a<2)return{type:It.None,rect:void 0};var u;if(this.subTmpPoints.length===0?(this.subTmpPoints=[new _t(s[0],s[1])],u=!1):u=this.updateTempPointsForSubWorker(s),!u)return{type:It.None,rect:void 0};var h=this.transformData(this.subTmpPoints),v=i?this.fullLayer:this.drawLayer||this.fullLayer,p=this.drawForSubWorker({ps:h,workId:this.workId,layer:v}),y=Kt(p,this.oldSubSelectRect);return this.oldSubSelectRect=p,_objectSpread({rect:y,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"subWorkerConsumeAll",value:function subWorkerConsumeAll(e){var n=e.isFullWork,i=n?this.fullLayer:this.drawLayer||this.fullLayer;return this.replace(i,this.workId),_objectSpread({rect:this.oldSelectRect,type:It.FullWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"clearSubTmpPoints",value:function clearSubTmpPoints(){this.subTmpPoints.length=0;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.clearSubTmpPoints();}},{key:"clearSubSelectData",value:function clearSubSelectData(){this.oldSubSelectRect=void 0;}},{key:"clearSelectData",value:function clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0,this.clearSubSelectData();}},{key:"selectSingleTool",value:function selectSingleTool(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:De;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(e.length===2){var s=e[0],o=e[1];var a;var _this$vNodes$getRectI2=this.vNodes.getRectIntersectRange({x:s,y:o,w:0,h:0},!1),u=_this$vNodes$getRectI2.nodeRange,h=_toConsumableArray(u.values()).sort(function(v,p){return(p.opt.zIndex||0)-(v.opt.zIndex||0);});var _iterator38=_createForOfIteratorHelper(h),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _v8=_step38.value;var _p3=this.fullLayer.getElementsByName(_v8.name);if(MT(_p3).find(function(C){return C.isPointCollision(s,o);})){a=_v8;break;}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}if(a){var v=a.name;if(!Qn(this.oldSelectRect,a.rect)){var p=/* @__PURE__ */new Map([[v,a]]);this.getSelecteorInfo(p),this.draw(n,this.fullLayer,{intersectRect:a.rect,subNodeMap:p,selectIds:this.selectIds||[]},i);}this.selectIds=[v],this.oldSelectRect=a.rect;}}}},{key:"unSelectedAllIds",value:function unSelectedAllIds(){var e;var _iterator39=_createForOfIteratorHelper(this.vNodes.curNodeMap.entries()),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _step39$value=_slicedToArray(_step39.value,2),n=_step39$value[0],i=_step39$value[1];i.isSelected&&(e=Kt(e,i.rect),this.vNodes.unSelected(n));}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}return e;}},{key:"unSelectedByIds",value:function unSelectedByIds(e){var n;var _iterator40=_createForOfIteratorHelper(e),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var i=_step40.value;var s=this.vNodes.get(i);s&&s.isSelected&&(n=Kt(n,s.rect),this.vNodes.unSelected(i));}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}return n;}},{key:"selectedByIds",value:function selectedByIds(e){var n;var _iterator41=_createForOfIteratorHelper(e),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var i=_step41.value;var s=this.vNodes.get(i);s&&(n=Kt(n,s.rect),this.vNodes.selected(i));}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return n;}},{key:"getSelectorRect",value:function getSelectorRect(e,n){var a;var i;var s=(a=e.parent)==null?void 0:a.getElementById(n),o=s==null?void 0:s.getBoundingClientRect();return o&&(i=Kt(i,{x:Math.floor(o.x),y:Math.floor(o.y),w:Math.floor(o.width+1),h:Math.floor(o.height+1)})),i;}},{key:"isCanFillColor",value:function isCanFillColor(e){return e===St.Ellipse||e===St.Triangle||e===St.Rectangle||e===St.Polygon||e===St.Star||e===St.SpeechBalloon;}},{key:"updateSelector",value:function(){var _updateSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(e){var n,i,s,o,a,u,h,v,p,y,C,b,M,L,X,Y,_iterator42,_step42,w,S,x,P,z,U,K,j,nt,ct,B,N,et,_w4,_S3,_x27,A,_t16,_t17,_t18;return _regenerator().w(function(_context14){while(1)switch(_context14.p=_context14.n){case 0:n=e.updateSelectorOpt,i=e.selectIds,s=e.vNodes,o=e.willSerializeData,a=e.worker,u=e.offset,h=this.fullLayer;if(h){_context14.n=1;break;}return _context14.a(2);case 1:p=/* @__PURE__ */new Map(),y=n.originPoint,C=n.workState,b=n.angle,M=n.translate,L=n.dir,X=n.scale;u&&(M?n.translate=[M[0]+u[0],M[1]+u[1]]:n.translate=u);if(!(y||M||$e(b))){_context14.n=3;break;}if(!(C===te.Start&&i)){_context14.n=2;break;}return _context14.a(2,(s.setTargetAssignKeys(i),{type:It.Select,dataType:Qt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect}));case 2:if(!(Y=s.getLastTarget(),!Y)){_context14.n=3;break;}return _context14.a(2);case 3:if(!i){_context14.n=18;break;}_iterator42=_createForOfIteratorHelper(i);_context14.p=4;_iterator42.s();case 5:if((_step42=_iterator42.n()).done){_context14.n=15;break;}w=_step42.value;S=s.get(w);if(!S){_context14.n=14;break;}x=S.toolsType,P=S.opt,z=(h==null?void 0:h.getElementsByName(w))[0];if(!z){_context14.n=14;break;}U=_objectSpread({},n);K=void 0;j=Gt.isWillRefresh({toolsType:x,opt:P,updateOpt:U,vNodes:s,node:z,willSerializeData:o});if(!x){_context14.n=14;break;}K=Y==null?void 0:Y.get(w);nt=ET(x);nt==null||nt.updateNodeOpt({node:z,opt:U,vNodes:s,willSerializeData:o,targetNode:K});ct=s.get(w)||S;if(!(ct&&a&&j)){_context14.n=13;break;}B=a.createWorkShapeNode({workId:w,toolsType:x,toolsOpt:ct.opt});B==null||B.setWorkId(w);N=void 0;if(!(x===St.BackgroundSVG)){_context14.n=6;break;}N=B.consumeService({isFullWork:!0,replaceId:w});_context14.n=12;break;case 6:if(!(x===St.Image)){_context14.n=8;break;}_context14.n=7;return B.consumeServiceAsync({isFullWork:!0,replaceId:w,worker:a});case 7:N=_context14.v;_context14.n=12;break;case 8:if(!(x===St.Text)){_context14.n=10;break;}_context14.n=9;return B.consumeServiceAsync({isFullWork:!0,replaceId:w,isDrawLabel:!0});case 9:N=_context14.v;_context14.n=12;break;case 10:_context14.p=10;N=B==null?void 0:B.consumeService({op:ct.op,isFullWork:!0,replaceId:w,workState:C});_context14.n=12;break;case 11:_context14.p=11;_t16=_context14.v;console.error("consumeService error",_t16);return _context14.a(3,14);case 12:N&&(ct.rect=N);case 13:ct&&(p.set(w,ct),v=Kt(v,ct.rect));case 14:_context14.n=5;break;case 15:_context14.n=17;break;case 16:_context14.p=16;_t17=_context14.v;_iterator42.e(_t17);case 17:_context14.p=17;_iterator42.f();return _context14.f(17);case 18:Y&&C===te.Done&&(s.deleteLastTarget(),Y=void 0);et=v;if(!(y&&M&&X&&L&&et&&!u)){_context14.n=25;break;}_w4=[[et.x,et.y],[et.x+et.w,et.y],[et.x+et.w,et.y+et.h],[et.x,et.y+et.h]];_t18=L;_context14.n=_t18==="top"?19:_t18==="topLeft"?19:_t18==="left"?19:_t18==="topRight"?20:_t18==="right"?21:_t18==="bottomRight"?21:_t18==="bottom"?21:_t18==="bottomLeft"?22:23;break;case 19:M[0]>0&&M[1]>0?_S3=_w4[0]:M[0]>0?_S3=_w4[3]:M[1]>0?_S3=_w4[1]:_S3=_w4[2];return _context14.a(3,23);case 20:M[0]<0&&M[1]>0?_S3=_w4[1]:M[0]<0?_S3=_w4[2]:M[1]>0?_S3=_w4[0]:_S3=_w4[3];return _context14.a(3,23);case 21:M[0]<0&&M[1]<0?_S3=_w4[2]:M[0]<0?_S3=_w4[1]:M[1]<0?_S3=_w4[3]:_S3=_w4[0];return _context14.a(3,23);case 22:M[0]>0&&M[1]<0?_S3=_w4[3]:M[0]>0?_S3=_w4[0]:M[1]<0?_S3=_w4[2]:_S3=_w4[1];return _context14.a(3,23);case 23:_x27=_S3&&[y[0]-_S3[0],y[1]-_S3[1]]||[0,0];if(Qn(_x27,[0,0])){_context14.n=25;break;}_context14.n=24;return this.updateSelector(_objectSpread(_objectSpread({},e),{},{updateSelectorOpt:{workState:C},offset:_x27}));case 24:return _context14.a(2,_context14.v);case 25:this.getSelecteorInfo(p),this.draw(De,h,{selectIds:i||[],subNodeMap:p,intersectRect:et});A=Kt(this.oldSelectRect,et);return _context14.a(2,(this.oldSelectRect=et,{type:It.Select,dataType:Qt.Local,selectRect:et,renderRect:v,rect:Kt(A,et),selectIds:i}));}},_callee13,this,[[10,11],[4,16,17,18]]);}));function updateSelector(_x26){return _updateSelector.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function blurSelector(){var e=this.unSelectedAllIds();return{type:It.Select,dataType:Qt.Local,rect:e,selectIds:[],willSyncService:!0};}},{key:"getRightServiceId",value:function getRightServiceId(e){return e.replace(Fo,"-");}},{key:"selectServiceNode",value:function selectServiceNode(e,n,i){var _this50=this;var s=n.selectIds,o=this.getRightServiceId(e),a=this.getSelectorRect(this.fullLayer,o);var u;var h=/* @__PURE__ */new Map();return s==null||s.forEach(function(v){var p=_this50.vNodes.get(v);p&&(u=Kt(u,p.rect),h.set(v,p));}),this.getSelecteorInfo(h),this.draw(o,this.fullLayer,{intersectRect:u,selectIds:s||[],subNodeMap:h},i),Kt(u,a);}},{key:"reRenderSelector",value:function reRenderSelector(){var _this51=this;var i;var e;var n=/* @__PURE__ */new Map();return(i=this.selectIds)==null||i.forEach(function(s){var o=_this51.vNodes.get(s);o&&(e=Kt(e,o.rect),n.set(s,o));},this),this.getSelecteorInfo(n),this.draw(De,this.fullLayer,{intersectRect:e,subNodeMap:n,selectIds:this.selectIds||[]}),this.oldSelectRect=e,e;}},{key:"updateSelectIds",value:function updateSelectIds(e){var o;var n;var i=(o=this.selectIds)==null?void 0:o.filter(function(a){return!e.includes(a);});if(i!=null&&i.length&&(n=this.unSelectedByIds(i)),e.length){var a=this.selectedByIds(e);n=Kt(n,a);}this.selectIds=e;var s=this.reRenderSelector();return{bgRect:n,selectRect:s};}},{key:"cursorHover",value:function cursorHover(e){var o,a;var n=this.oldSelectRect;this.selectIds=[];var i=(o=this.workId)==null?void 0:o.toString(),s=[e[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],e[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(s,i,!0),this.oldSelectRect&&!Qn(n,this.oldSelectRect))return{type:It.CursorHover,dataType:Qt.Local,rect:Kt(n,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((a=this.selectIds)!=null&&a.length||(this.oldSelectRect=void 0),n&&!this.oldSelectRect)return this.cursorBlur(),{type:It.CursorHover,dataType:Qt.Local,rect:n,selectorColor:this.selectorColor,willSyncService:!1};}},{key:"cursorBlur",value:function cursorBlur(){var n,i;this.selectIds=[];var e=(n=this.workId)==null?void 0:n.toString();((i=this.fullLayer)==null?void 0:i.parent).children.forEach(function(s){s.name===e&&s.remove();});}}]);}(Gt);ht(Lu,"selectorBorderId","selector-border");var Ka=Lu;var sT=/*#__PURE__*/function(_Gt5){function sT(e){var _this52;_classCallCheck(this,sT);_this52=_callSuper(this,sT,[e]);ht(_this52,"canRotate",!1);ht(_this52,"scaleType",Ae.both);ht(_this52,"toolsType",St.Arrow);ht(_this52,"tmpPoints",[]);ht(_this52,"workOptions");ht(_this52,"oldRect");ht(_this52,"arrowTipWidth");ht(_this52,"syncTimestamp");_this52.workOptions=e.toolsOpt,_this52.arrowTipWidth=_this52.workOptions.thickness*4,_this52.syncTimestamp=0,_this52.syncUnitTime=50;return _this52;}_inherits(sT,_Gt5);return _createClass(sT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime;p&&(this.syncUnitTime=p);var y=v==null?void 0:v.length;if(!y||y<2)return{type:It.None};var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:It.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:L});}if(u){var _L4=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L4,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L5=Date.now();return _L5-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L5,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:It.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:It.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread(_objectSpread({rect:M},this.baseConsumeResult),{},{type:It.DrawWork,dataType:Qt.Local});}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:It.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i},this.baseConsumeResult),{},{type:It.FullWork,dataType:Qt.Local,ops:o,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawEraserlines,_this$workOptions7=this.workOptions,o=_this$workOptions7.strokeColor,a=_this$workOptions7.thickness,u=_this$workOptions7.zIndex,h=_this$workOptions7.scale,v=_this$workOptions7.rotate,p=_this$workOptions7.translate,y=_this$workOptions7.strokeType,C=_this$workOptions7.eraserlines,b=_this$workOptions7.eraserFaces,M=_this$workOptions7.doingLines,L=_this$workOptions7.lineDash,X=_this$workOptions7.lineCap,Y=i.worldPosition,et=i.worldScaling,_this$computDrawPoint3=this.computDrawPoints(a),A=_this$computDrawPoint3.points,w=_this$computDrawPoint3.pos,S=_this$computDrawPoint3.rect,x=_this$computDrawPoint3.isTriangle,P=_this$computDrawPoint3.trianglePoints,z=_this$computDrawPoint3.trianglePos,U=[S.x+S.w/2,S.y+S.h/2],K={pos:U,name:n,id:n,zIndex:u,anchor:[0.5,0.5],size:[S.w,S.h]};h&&(K.scale=h),v&&(K.rotate=v),p&&(K.translate=p);var j=new nr(K),nt={points:P,pos:[z[0]-U[0],z[1]-U[1]],fillColor:o,strokeColor:o,lineWidth:0,normalize:!1},ct=new zn(nt);if(j.append(ct),!x&&A&&w){var N={points:A,pos:[w[0]-U[0],w[1]-U[1]],fillColor:o,strokeColor:o,lineDash:y===Ne.Dotted?[L&&L[0]||1,(L&&L[1]||2)*a]:y===Ne.LongDotted?[(L&&L[0]||1)*a,(L&&L[1]||2)*a]:void 0,lineCap:y===Ne.Normal?void 0:X,lineWidth:a,normalize:!1},G=new zn(N);j.append(G);}(C||b||M)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:j,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:b,pos:U,layer:i},s)),this.replace(i,n,j);var B={x:Math.floor(S.x*et[0]+Y[0]-Gt.SafeBorderPadding),y:Math.floor(S.y*et[1]+Y[1]-Gt.SafeBorderPadding),w:Math.floor(S.w*et[0]+2*Gt.SafeBorderPadding),h:Math.floor(S.h*et[1]+2*Gt.SafeBorderPadding)};if(h||v||p){var _N2=j.getBoundingClientRect();B={x:Math.floor(_N2.x-Gt.SafeBorderPadding),y:Math.floor(_N2.y-Gt.SafeBorderPadding),w:Math.floor(_N2.width+Gt.SafeBorderPadding*2),h:Math.floor(_N2.height+Gt.SafeBorderPadding*2)};}return this.isDelete&&j.setAttribute("opacity",0),B;}},{key:"computDrawPoints",value:function computDrawPoints(e){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.arrowTipWidth?this.computFullArrowPoints(e):this.computTrianglePoints();}},{key:"computFullArrowPoints",value:function computFullArrowPoints(e){var _this53=this;var n=xt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),i=xt.Per(n).mul(e/2),s=_t.Sub(this.tmpPoints[0],i),o=_t.Add(this.tmpPoints[0],i),a=xt.Mul(n,this.arrowTipWidth),u=xt.Sub(this.tmpPoints[1],a),h=_t.Sub(u,i),v=_t.Add(u,i),p=xt.Per(n).mul(e*1.5),y=_t.Sub(u,p),C=_t.Add(u,p),b=[this.tmpPoints[0],u],M=[y,this.tmpPoints[1],C],L=[s,o].concat(M,[h,v]);return{trianglePoints:M.map(function(X){return _t.Sub(X,_this53.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,points:b.map(function(X){return _t.Sub(X,_this53.tmpPoints[0]).XY;}).flat(1),rect:Ye(L),isTriangle:!1,pos:this.tmpPoints[0].XY};}},{key:"computTrianglePoints",value:function computTrianglePoints(){var _this54=this;var e=xt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=this.tmpPoints[1].distance(this.tmpPoints[0]),i=xt.Per(e).mul(Math.floor(n*3/8)),s=_t.Sub(this.tmpPoints[0],i),o=_t.Add(this.tmpPoints[0],i),a=[s,this.tmpPoints[1],o];return{trianglePoints:a.map(function(u){return _t.Sub(u,_this54.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Ye(a),isTriangle:!0};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState2=e.workState,s=_e$workState2===void 0?te.Done:_e$workState2,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var h,v;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.strokeType,u=s.get(n.name);return o&&(n.tagName==="GROUP"?n.children.forEach(function(p){p.setAttribute("strokeColor",o),p.getAttribute("fillColor")&&p.setAttribute("fillColor",o);}):(n.setAttribute("strokeColor",o),n.setAttribute("fillColor",o)),(h=u==null?void 0:u.opt)!=null&&h.strokeColor&&(u.opt.strokeColor=o)),a&&u!=null&&u.opt&&(v=u.opt)!=null&&v.strokeType&&(u.opt.strokeType=a),u&&s.setInfo(n.name,u),Gt.updateNodeOpt(e);}}]);}(Gt);var oT=/*#__PURE__*/function(_Gt6){function oT(e){var _this55;_classCallCheck(this,oT);_this55=_callSuper(this,oT,[e]);ht(_this55,"canRotate",!1);ht(_this55,"scaleType",Ae.all);ht(_this55,"toolsType",St.Ellipse);ht(_this55,"tmpPoints",[]);ht(_this55,"workOptions");ht(_this55,"oldRect");ht(_this55,"syncTimestamp");_this55.workOptions=e.toolsOpt,_this55.syncTimestamp=0,_this55.syncUnitTime=50;return _this55;}_inherits(oT,_Gt6);return _createClass(oT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime;p&&(this.syncUnitTime=p);var y=v==null?void 0:v.length;if(!y||y<2)return{type:It.None};var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:It.None};var b;if(s||o||u){var M=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:M,isDrawing:!0});var L=M.parent.parent,X={x:0,y:0,w:Math.floor(L.width),h:Math.floor(L.height)},Y=_objectSpread({type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(el(b,X)!==es.outside){var A=Kt(b,this.oldRect);if(this.oldRect=b,Y.rect=A,!u)return Y;}if(u){var _A4=Date.now();return _A4-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_A4,Y.op=this.tmpPoints.map(function(w){return[].concat(_toConsumableArray(w.XY),[0]);}).flat(1),Y.index=0,Y.isSync=!0),Y;}return{type:It.None};}if(!s&&!o&&!u&&a){var _M2=Date.now();return _M2-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_M2,_objectSpread(_objectSpread({type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult),{},{op:this.tmpPoints.map(function(L){return[].concat(_toConsumableArray(L.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:It.None};}return{type:It.None};}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:It.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:It.FullWork,dataType:Qt.Local},this.baseConsumeResult),{},{ops:o,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,o=e.isDrawEraserlines,_this$workOptions8=this.workOptions,a=_this$workOptions8.strokeColor,u=_this$workOptions8.fillColor,h=_this$workOptions8.thickness,v=_this$workOptions8.zIndex,p=_this$workOptions8.scale,y=_this$workOptions8.rotate,C=_this$workOptions8.translate,b=_this$workOptions8.strokeType,M=_this$workOptions8.eraserlines,L=_this$workOptions8.eraserFaces,X=_this$workOptions8.doingLines,Y=_this$workOptions8.lineDash,et=_this$workOptions8.lineCap,A=i.worldScaling,_this$computDrawPoint4=this.computDrawPoints(h),w=_this$computDrawPoint4.radius,S=_this$computDrawPoint4.rect,x=_this$computDrawPoint4.pos,P={closeType:"normal",radius:w,lineWidth:h,fillColor:u!=="transparent"&&u||void 0,strokeColor:a,normalize:!0,lineCap:et,lineDash:b===Ne.Dotted?[Y&&Y[0]||1,(Y&&Y[1]||2)*h]:b===Ne.LongDotted?[(Y&&Y[0]||1)*h,(Y&&Y[1]||2)*h]:void 0},z={name:n,id:n,zIndex:v,pos:x,anchor:[0.5,0.5],size:[S.w,S.h]};p&&(z.scale=p),y&&(z.rotate=y),C&&(z.translate=C);var U=new nr(z);if(s){var nt=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/A[0],1/A[1]]});U.append(nt);}var K=new dv(_objectSpread(_objectSpread({},P),{},{pos:[0,0]}));U.append(K),(M||L||X)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:U,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:L,pos:x,layer:i},o)),this.replace(i,n,U);var j=U.getBoundingClientRect();return this.isDelete&&U.setAttribute("opacity",0),{x:Math.floor(j.x-Gt.SafeBorderPadding),y:Math.floor(j.y-Gt.SafeBorderPadding),w:Math.floor(j.width+Gt.SafeBorderPadding*2),h:Math.floor(j.height+Gt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(e){var n=Ye(this.tmpPoints),i=Ye(this.tmpPoints,e),s=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)];return{rect:i,pos:s,radius:[Math.floor(n.w/2),Math.floor(n.h/2)]};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState3=e.workState,s=_e$workState3===void 0?te.Done:_e$workState3,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var p,y,C;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.strokeType,h=s.get(n.name);var v=n;return n.tagName==="GROUP"&&(v=n.children[0]),o&&(v.setAttribute("strokeColor",o),(p=h==null?void 0:h.opt)!=null&&p.strokeColor&&(h.opt.strokeColor=o)),a&&(a==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",a),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=a)),u&&h!=null&&h.opt&&(C=h.opt)!=null&&C.strokeType&&(h.opt.strokeType=u),h&&s.setInfo(n.name,h),Gt.updateNodeOpt(e);}}]);}(Gt);var aT=/*#__PURE__*/function(_Gt7){function aT(e){var _this56;_classCallCheck(this,aT);_this56=_callSuper(this,aT,[e]);ht(_this56,"canRotate",!0);ht(_this56,"scaleType",Ae.all);ht(_this56,"toolsType",St.Rectangle);ht(_this56,"tmpPoints",[]);ht(_this56,"workOptions");ht(_this56,"oldRect");ht(_this56,"syncTimestamp");_this56.workOptions=e.toolsOpt,_this56.syncTimestamp=0,_this56.syncUnitTime=50;return _this56;}_inherits(aT,_Gt7);return _createClass(aT,[{key:"transformData",value:function transformData(){var e=Ye(this.tmpPoints);return[[e.x,e.y,0],[e.x+e.w,e.y,0],[e.x+e.w,e.y+e.h,0],[e.x,e.y+e.h,0]];}},{key:"computDrawPoints",value:function computDrawPoints(e){var n=this.workOptions.thickness,i=[];var _iterator43=_createForOfIteratorHelper(e),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var a=_step43.value;i.push(_construct(xt,_toConsumableArray(a)));}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}var s=Ye(i,n),o=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:o,points:i.map(function(a){return a.XY;}).flat(1)};}},{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=v==null?void 0:v.length;if(!p||p<2)return{type:It.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:It.None};var C=this.transformData();var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({ps:C,workId:h,layer:L,isDrawing:!0});}if(u){var _L6=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L6,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=C.flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L7=Date.now();return _L7-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L7,_objectSpread({type:It.DrawWork,dataType:Qt.Local,op:C.flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:It.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var u;var e=this.workId;if(this.tmpPoints.length<2)return{type:It.RemoveNode,removeIds:[e]};var n=this.transformData(),i=this.fullLayer,s=this.draw({ps:n,workId:e,layer:i,isDrawing:!1});this.oldRect=s;var o=n.flat(1),a=Br(o);return(u=this.vNodes)==null||u.setInfo(e,{rect:s,op:o,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&Gt.getCenterPos(s,i)}),_objectSpread(_objectSpread({rect:s,type:It.FullWork,dataType:Qt.Local,ops:a,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,o=e.ps,a=e.replaceId,_e$isDrawEraserlines2=e.isDrawEraserlines,u=_e$isDrawEraserlines2===void 0?!0:_e$isDrawEraserlines2,_this$workOptions9=this.workOptions,h=_this$workOptions9.strokeColor,v=_this$workOptions9.fillColor,p=_this$workOptions9.thickness,y=_this$workOptions9.zIndex,C=_this$workOptions9.scale,b=_this$workOptions9.rotate,M=_this$workOptions9.translate,L=_this$workOptions9.strokeType,X=_this$workOptions9.eraserlines,Y=_this$workOptions9.eraserFaces,et=_this$workOptions9.doingLines,A=_this$workOptions9.lineCap,w=_this$workOptions9.lineDash,S=i.worldPosition,x=i.worldScaling,_this$computDrawPoint5=this.computDrawPoints(o),P=_this$computDrawPoint5.points,z=_this$computDrawPoint5.rect,U=_this$computDrawPoint5.pos,K={close:!0,normalize:!0,points:P,lineWidth:p,fillColor:v!=="transparent"&&v||void 0,strokeColor:h,lineCap:A,lineDash:L===Ne.Dotted?[w&&w[0]||1,(w&&w[1]||2)*p]:L===Ne.LongDotted?[(w&&w[0]||1)*p,(w&&w[1]||2)*p]:void 0};var j={x:Math.floor(z.x*x[0]+S[0]-Gt.SafeBorderPadding),y:Math.floor(z.y*x[1]+S[1]-Gt.SafeBorderPadding),w:Math.floor(z.w*x[0]+2*Gt.SafeBorderPadding),h:Math.floor(z.h*x[0]+2*Gt.SafeBorderPadding)};var nt=new nr({name:n,id:n,zIndex:y,pos:U,anchor:[0.5,0.5],size:[z.w,z.h],scale:C,rotate:b,translate:M}),ct=new zn(_objectSpread(_objectSpread({},K),{},{pos:[0,0]}));if(nt.appendChild(ct),s){var B=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:h,lineWidth:1,scale:[1/x[0],1/x[1]]});nt.appendChild(B);}if((X||Y||et)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:nt,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:Y,pos:U,layer:i},u)),this.replace(i,a||n,nt),C||b||M){var _B2=nt.getBoundingClientRect();j={x:Math.floor(_B2.x-Gt.SafeBorderPadding),y:Math.floor(_B2.y-Gt.SafeBorderPadding),w:Math.floor(_B2.width+2*Gt.SafeBorderPadding),h:Math.floor(_B2.height+2*Gt.SafeBorderPadding)};}return this.isDelete&&nt.setAttribute("opacity",0),j;}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var p,y;var n=e.op,i=e.isFullWork,s=e.replaceId,_e$workState4=e.workState,o=_e$workState4===void 0?te.Done:_e$workState4,a=(p=this.workId)==null?void 0:p.toString();if(!a)return;var u=[];for(var C=0;C<n.length;C+=3)u.push([n[C],n[C+1],n[C+2]]);var h=i?this.fullLayer:this.drawLayer||this.fullLayer,v=this.draw({ps:u,workId:a,layer:h,isDrawing:!1,replaceId:s,isDrawEraserlines:o===te.Done});return this.oldRect=v,(y=this.vNodes)==null||y.setInfo(a,{rect:v,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Gt.getCenterPos(v,h)}),v;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var p,y,C;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.strokeType,h=s.get(n.name);var v=n;return n.tagName==="GROUP"&&(v=n.children[0]),o&&(v.setAttribute("strokeColor",o),(p=h==null?void 0:h.opt)!=null&&p.strokeColor&&(h.opt.strokeColor=o)),a&&(a==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",a),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=a)),u&&h!=null&&h.opt&&(C=h.opt)!=null&&C.strokeType&&(h.opt.strokeType=u),h&&s.setInfo(n.name,h),Gt.updateNodeOpt(e);}}]);}(Gt);var lT=/*#__PURE__*/function(_Gt8){function lT(e){var _this57;_classCallCheck(this,lT);_this57=_callSuper(this,lT,[e]);ht(_this57,"canRotate",!1);ht(_this57,"scaleType",Ae.all);ht(_this57,"toolsType",St.Star);ht(_this57,"tmpPoints",[]);ht(_this57,"workOptions");ht(_this57,"oldRect");ht(_this57,"syncTimestamp");_this57.workOptions=e.toolsOpt,_this57.syncTimestamp=0,_this57.syncUnitTime=50;return _this57;}_inherits(lT,_Gt8);return _createClass(lT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime,y=v==null?void 0:v.length;if(!y||y<2)return{type:It.None};p&&(this.syncUnitTime=p);var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:It.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:L,isDrawing:!0});}if(u){var _L8=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L8,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L9=Date.now();return _L9-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L9,_objectSpread({type:It.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:It.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:It.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:It.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,_e$isDrawEraserlines3=e.isDrawEraserlines,o=_e$isDrawEraserlines3===void 0?!0:_e$isDrawEraserlines3,_this$workOptions0=this.workOptions,a=_this$workOptions0.strokeColor,u=_this$workOptions0.fillColor,h=_this$workOptions0.thickness,v=_this$workOptions0.zIndex,p=_this$workOptions0.vertices,y=_this$workOptions0.innerVerticeStep,C=_this$workOptions0.innerRatio,b=_this$workOptions0.scale,M=_this$workOptions0.rotate,L=_this$workOptions0.translate,X=_this$workOptions0.strokeType,Y=_this$workOptions0.eraserlines,et=_this$workOptions0.eraserFaces,A=_this$workOptions0.doingLines,w=_this$workOptions0.lineDash,S=_this$workOptions0.lineCap,x=i.worldScaling,_this$computDrawPoint6=this.computDrawPoints(h,p,y,C),P=_this$computDrawPoint6.rect,z=_this$computDrawPoint6.pos,U=_this$computDrawPoint6.points,K={close:!0,points:U,lineWidth:h,fillColor:u!=="transparent"&&u||void 0,strokeColor:a,normalize:!0,lineCap:S,lineDash:X===Ne.Dotted?[w&&w[0]||1,(w&&w[1]||2)*h]:X===Ne.LongDotted?[(w&&w[0]||1)*h,(w&&w[1]||2)*h]:void 0},j={name:n,id:n,zIndex:v,pos:z,anchor:[0.5,0.5],size:[P.w,P.h]};b&&(j.scale=b),M&&(j.rotate=M),L&&(j.translate=L);var nt=new nr(j);if(s){var N=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/x[0],1/x[1]]});nt.append(N);}var ct=new zn(_objectSpread(_objectSpread({},K),{},{pos:[0,0]}));nt.append(ct),(Y||et||A)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:nt,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:et,pos:z,layer:i},o)),this.replace(i,n,nt);var B=nt.getBoundingClientRect();return this.isDelete&&nt.setAttribute("opacity",0),{x:Math.floor(B.x-Gt.SafeBorderPadding),y:Math.floor(B.y-Gt.SafeBorderPadding),w:Math.floor(B.width+Gt.SafeBorderPadding*2),h:Math.floor(B.height+Gt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(e,n,i,s){var o=Ye(this.tmpPoints),a=[Math.floor(o.x+o.w/2),Math.floor(o.y+o.h/2)],u=RT(o.w,o.h),h=Math.floor(Math.min(o.w,o.h)/2),v=s*h,p=[],y=2*Math.PI/n;for(var b=0;b<n;b++){var M=b*y-0.5*Math.PI;var L=void 0,X=void 0;b%i===1?(L=v*u[0]*Math.cos(M),X=v*u[1]*Math.sin(M)):(L=h*u[0]*Math.cos(M),X=h*u[1]*Math.sin(M),p.push(L,X)),p.push(L,X);}return{rect:Ye(this.tmpPoints,e),pos:a,points:p};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o)||_t.Sub(s,i).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState5=e.workState,s=_e$workState5===void 0?te.Done:_e$workState5,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var L;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.toolsType,h=i.vertices,v=i.innerVerticeStep,p=i.innerRatio,y=i.strokeType,C=s.get(n.name),b=C==null?void 0:C.opt;var M=n;return n.tagName==="GROUP"&&(M=n.children[0]),o&&(M.setAttribute("strokeColor",o),b!=null&&b.strokeColor&&(b.strokeColor=o)),a&&(a==="transparent"?M.setAttribute("fillColor","rgba(0,0,0,0)"):M.setAttribute("fillColor",a),b!=null&&b.fillColor&&(b.fillColor=a)),u===St.Star&&(h&&(b.vertices=h),v&&(b.innerVerticeStep=v),p&&(b.innerRatio=p)),y&&C!=null&&C.opt&&(L=C.opt)!=null&&L.strokeType&&(C.opt.strokeType=y),C&&s.setInfo(n.name,_objectSpread(_objectSpread({},C),{},{opt:b})),Gt.updateNodeOpt(e);}}]);}(Gt);var cT=/*#__PURE__*/function(_Gt9){function cT(e){var _this58;_classCallCheck(this,cT);_this58=_callSuper(this,cT,[e]);ht(_this58,"canRotate",!1);ht(_this58,"scaleType",Ae.all);ht(_this58,"toolsType",St.Polygon);ht(_this58,"tmpPoints",[]);ht(_this58,"workOptions");ht(_this58,"oldRect");ht(_this58,"syncTimestamp");_this58.workOptions=e.toolsOpt,_this58.syncTimestamp=0,_this58.syncUnitTime=50;return _this58;}_inherits(cT,_Gt9);return _createClass(cT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=n.op,v=n.syncUnitTime;v&&(this.syncUnitTime=v);var p=this.workId,y=h==null?void 0:h.length;if(!y||y<2)return{type:It.None};var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(h[0],h[1])],C=!1):C=this.updateTempPoints(h),!C)return{type:It.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:p,layer:L,isDrawing:!0});}if(u){var _L0=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({type:It.DrawWork,rect:_L0,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L1=Date.now();return _L1-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L1,_objectSpread({type:It.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:It.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:It.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:It.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,_e$isDrawEraserlines4=e.isDrawEraserlines,o=_e$isDrawEraserlines4===void 0?!0:_e$isDrawEraserlines4,_this$workOptions1=this.workOptions,a=_this$workOptions1.strokeColor,u=_this$workOptions1.fillColor,h=_this$workOptions1.thickness,v=_this$workOptions1.zIndex,p=_this$workOptions1.vertices,y=_this$workOptions1.scale,C=_this$workOptions1.rotate,b=_this$workOptions1.translate,M=_this$workOptions1.strokeType,L=_this$workOptions1.eraserlines,X=_this$workOptions1.eraserFaces,Y=_this$workOptions1.doingLines,et=_this$workOptions1.lineCap,A=_this$workOptions1.lineDash,w=i.worldScaling,_this$computDrawPoint7=this.computDrawPoints(h,p),S=_this$computDrawPoint7.rect,x=_this$computDrawPoint7.pos,P=_this$computDrawPoint7.points,z={close:!0,points:P,lineWidth:h,fillColor:u!=="transparent"&&u||void 0,strokeColor:a,normalize:!0,lineCap:et,lineDash:M===Ne.Dotted?[A&&A[0]||1,(A&&A[1]||2)*h]:M===Ne.LongDotted?[(A&&A[0]||1)*h,(A&&A[1]||2)*h]:void 0},U={name:n,id:n,zIndex:v,pos:x,anchor:[0.5,0.5],size:[S.w,S.h]};y&&(U.scale=y),C&&(U.rotate=C),b&&(U.translate=b);var K=new nr(U);if(s){var ct=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/w[0],1/w[1]]});K.append(ct);}var j=new zn(_objectSpread(_objectSpread({},z),{},{pos:[0,0]}));K.append(j),(L||X||Y)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:K,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:X,pos:x,layer:i},o)),this.replace(i,n,K);var nt=K.getBoundingClientRect();return this.isDelete&&K.setAttribute("opacity",0),{x:Math.floor(nt.x-Gt.SafeBorderPadding),y:Math.floor(nt.y-Gt.SafeBorderPadding),w:Math.floor(nt.width+Gt.SafeBorderPadding*2),h:Math.floor(nt.height+Gt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(e,n){var i=Ye(this.tmpPoints),s=[Math.floor(i.x+i.w/2),Math.floor(i.y+i.h/2)],o=RT(i.w,i.h),a=Math.floor(Math.min(i.w,i.h)/2),u=[],h=2*Math.PI/n;for(var p=0;p<n;p++){var y=p*h-0.5*Math.PI,C=a*o[0]*Math.cos(y),b=a*o[1]*Math.sin(y);u.push(C,b);}return{rect:Ye(this.tmpPoints,e),pos:s,points:u};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o)||_t.Sub(s,i).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState6=e.workState,s=_e$workState6===void 0?te.Done:_e$workState6,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var b;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.toolsType,h=i.vertices,v=i.strokeType,p=s.get(n.name),y=p==null?void 0:p.opt;var C=n;return n.tagName==="GROUP"&&(C=n.children[0]),o&&(C.setAttribute("strokeColor",o),y!=null&&y.strokeColor&&(y.strokeColor=o)),a&&(a==="transparent"?C.setAttribute("fillColor","rgba(0,0,0,0)"):C.setAttribute("fillColor",a),y!=null&&y.fillColor&&(y.fillColor=a)),u===St.Polygon&&h&&(y.vertices=h),v&&p!=null&&p.opt&&(b=p.opt)!=null&&b.strokeType&&(p.opt.strokeType=v),p&&s.setInfo(n.name,_objectSpread(_objectSpread({},p),{},{opt:y})),Gt.updateNodeOpt(e);}}]);}(Gt);var kn=/*#__PURE__*/function(){function kn(){_classCallCheck(this,kn);}return _createClass(kn,null,[{key:"bezier",value:function bezier(t,e){var n=[];for(var i=0;i<e.length;i+=4){var s=e[i],o=e[i+1],a=e[i+2],u=e[i+3];s&&o&&a&&u?n.push.apply(n,_toConsumableArray(kn.getBezierPoints(t,s,o,a,u))):s&&o&&a?n.push.apply(n,_toConsumableArray(kn.getBezierPoints(t,s,o,a))):s&&o?n.push.apply(n,_toConsumableArray(kn.getBezierPoints(t,s,o))):s&&n.push(s);}return n;}/**
|
|
410
|
+
null;}function Mo(r,t){var e=0;return r[0]<t[0]?e|=1:r[0]>t[2]&&(e|=2),r[1]<t[1]?e|=4:r[1]>t[3]&&(e|=8),e;}var Ov=/* @__PURE__ */$n(Yxt),Ro=/*#__PURE__*/function(_Gt3){function Ro(e,n){var _this46;_classCallCheck(this,Ro);_this46=_callSuper(this,Ro,[e]);ht(_this46,"canRotate",!1);ht(_this46,"scaleType",Ae.none);ht(_this46,"toolsType",St.Eraser);ht(_this46,"serviceWork");ht(_this46,"tmpPoints",[]);ht(_this46,"workOptions");ht(_this46,"worldPosition");ht(_this46,"worldScaling");ht(_this46,"eraserRect");ht(_this46,"eraserPolyline");_this46.serviceWork=n,_this46.workOptions=e.toolsOpt,_this46.worldPosition=_this46.fullLayer.worldPosition,_this46.worldScaling=_this46.fullLayer.worldScaling;return _this46;}_inherits(Ro,_Gt3);return _createClass(Ro,[{key:"combineConsume",value:function combineConsume(){}},{key:"consumeService",value:function consumeService(){}},{key:"setWorkOptions",value:function setWorkOptions(e){_superPropGet(Ro,"setWorkOptions",this,3)([e]);}},{key:"createEraserRect",value:function createEraserRect(e){var n=e[0]*this.worldScaling[0]+this.worldPosition[0],i=e[1]*this.worldScaling[1]+this.worldPosition[1],_Ro$eraserSizes$this$=Ro.eraserSizes[this.workOptions.thickness],s=_Ro$eraserSizes$this$.width,o=_Ro$eraserSizes$this$.height;this.eraserRect={x:n-s*0.5,y:i-o*0.5,w:s,h:o},this.eraserPolyline=[this.eraserRect.x,this.eraserRect.y,this.eraserRect.x+this.eraserRect.w,this.eraserRect.y+this.eraserRect.h];}},{key:"computRectCenterPoints",value:function computRectCenterPoints(){var e=this.tmpPoints.slice(-2);if(this.tmpPoints.length===4){var n=new xt(this.tmpPoints[0],this.tmpPoints[1]),i=new xt(this.tmpPoints[2],this.tmpPoints[3]),s=xt.Sub(i,n).uni(),o=xt.Dist(n,i),_Ro$eraserSizes$this$2=Ro.eraserSizes[this.workOptions.thickness],a=_Ro$eraserSizes$this$2.width,u=_Ro$eraserSizes$this$2.height,h=Math.min(a,u),v=Math.round(o/h);if(v>1){var p=[];for(var y=0;y<v;y++){var C=xt.Mul(s,y*h);p.push(this.tmpPoints[0]+C.x,this.tmpPoints[1]+C.y);}return p.concat(e);}}return e;}},{key:"isNear",value:function isNear(e,n){var i=new xt(e[0],e[1]),s=new xt(n[0],n[1]),_Ro$eraserSizes$this$3=Ro.eraserSizes[this.workOptions.thickness],o=_Ro$eraserSizes$this$3.width,a=_Ro$eraserSizes$this$3.height;return xt.Dist(i,s)<Math.hypot(o,a)*0.5;}},{key:"remove",value:function remove(e){var _this47=this;var n=e.curNodeMap,i=e.removeIds;var s;var _iterator32=_createForOfIteratorHelper(n.values()),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var o=_step32.value;if(o.rect&&this.eraserRect&&this.eraserPolyline&&Pu(this.eraserRect,o.rect)){var a=o.op,u=[],h=[];for(var p=0;p<a.length;p+=3){var y=new xt(a[p]*this.worldScaling[0]+this.worldPosition[0],a[p+1]*this.worldScaling[1]+this.worldPosition[1],a[p+2]);h.push(y),u.push(new _t(y.x,y.y));}var v=u.length&&Ye(u)||o.rect;Pu(v,this.eraserRect)&&(h.length>1?Ov.polyline(h.map(function(y){return y.XY;}),this.eraserPolyline).length&&i.add(o.name):i.add(o.name),s=Kt(s,o.rect||v));}}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}return i.forEach(function(o){var u;var a=_this47.fullLayer.getElementsByName(o);a[0]&&(a[0].remove(),_zr(a[0],_this47.fullLayer.parent),(u=_this47.vNodes)==null||u.delete(o));}),s&&(s.x-=Gt.SafeBorderPadding,s.y-=Gt.SafeBorderPadding,s.w+=Gt.SafeBorderPadding*2,s.h+=Gt.SafeBorderPadding*2),s;}},{key:"consume",value:function consume(e){var _e$data2=e.data,n=_e$data2.op,i=_e$data2.disableEraseImage,s=_e$data2.disableEraseText;if(!n||n.length===0)return _objectSpread({type:Tt.None},this.baseConsumeResult);var o=this.tmpPoints.length;if(o>1&&this.isNear([n[0],n[1]],[this.tmpPoints[o-2],this.tmpPoints[o-1]]))return _objectSpread({type:Tt.None},this.baseConsumeResult);o<3?this.tmpPoints.push(n[0],n[1]):this.tmpPoints.splice(2,2,n[0],n[1]);var a=this.computRectCenterPoints();var u;var h=/* @__PURE__ */new Set();if(!this.vNodes)return _objectSpread({type:Tt.None},this.baseConsumeResult);var v=this.getCanEraserNodeMap(this.vNodes.getCanEraserNodes(this.vNodes.curNodeMap,{disableEraseImage:i,disableEraseText:s}));for(var p=0;p<a.length-1;p+=2){this.createEraserRect(a.slice(p,p+2));var y=this.remove({curNodeMap:v,removeIds:h});u=Kt(u,y);}return u&&h.size?{type:Tt.RemoveNode,rect:u,removeIds:_toConsumableArray(h)}:_objectSpread({type:Tt.None},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(e){return this.consume(e);}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}},{key:"getCanEraserNodeMap",value:function getCanEraserNodeMap(e){var n;if(this.serviceWork){var i=new Map(e),s=this.serviceWork.selectorWorkShapes,o=this.serviceWork.workShapes;var _iterator33=_createForOfIteratorHelper(s.values()),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var a=_step33.value;if((n=a.selectIds)!=null&&n.length){var _iterator35=_createForOfIteratorHelper(a.selectIds),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var u=_step35.value;i.delete(u);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var _iterator34=_createForOfIteratorHelper(o.keys()),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _a7=_step34.value;i.delete(_a7);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}return i;}return e;}}]);}(Gt);// 来源于white-sdk
|
|
411
|
+
ht(Ro,"eraserSizes",Rv);var wu=Ro;var jxt="__lodash_hash_undefined__";function Xxt(r){return this.__data__.set(r,jxt),this;}var Hxt=Xxt;function Vxt(r){return this.__data__.has(r);}var Zxt=Vxt,qxt=A2,Kxt=Hxt,Qxt=Zxt;function Su(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new qxt();++t<e;)this.add(r[t]);}Su.prototype.add=Su.prototype.push=Kxt;Su.prototype.has=Qxt;var Dv=Su;function Jxt(r,t){for(var e=-1,n=r==null?0:r.length;++e<n;)if(t(r[e],e,r))return!0;return!1;}var _xt=Jxt;function tPt(r,t){return r.has(t);}var Nv=tPt,ePt=Dv,rPt=_xt,nPt=Nv,iPt=1,sPt=2;function oPt(r,t,e,n,i,s){var o=e&iPt,a=r.length,u=t.length;if(a!=u&&!(o&&u>a))return!1;var h=s.get(r),v=s.get(t);if(h&&v)return h==t&&v==r;var p=-1,y=!0,C=e&sPt?new ePt():void 0;for(s.set(r,t),s.set(t,r);++p<a;){var b=r[p],M=t[p];if(n)var L=o?n(M,b,p,t,r,s):n(b,M,p,r,t,s);if(L!==void 0){if(L)continue;y=!1;break;}if(C){if(!rPt(t,function(X,Y){if(!nPt(C,Y)&&(b===X||i(b,X,e,n,s)))return C.push(Y);})){y=!1;break;}}else if(!(b===M||i(b,M,e,n,s))){y=!1;break;}}return s.delete(r),s.delete(t),y;}var nT=oPt;function aPt(r){var t=-1,e=Array(r.size);return r.forEach(function(n,i){e[++t]=[i,n];}),e;}var lPt=aPt;function cPt(r){var t=-1,e=Array(r.size);return r.forEach(function(n){e[++t]=n;}),e;}var kv=cPt,C1=vl,x1=H2,uPt=wv,fPt=nT,hPt=lPt,dPt=kv,pPt=1,vPt=2,gPt="[object Boolean]",mPt="[object Date]",yPt="[object Error]",wPt="[object Map]",SPt="[object Number]",TPt="[object RegExp]",IPt="[object Set]",CPt="[object String]",xPt="[object Symbol]",PPt="[object ArrayBuffer]",bPt="[object DataView]",P1=C1?C1.prototype:void 0,Od=P1?P1.valueOf:void 0;function APt(r,t,e,n,i,s,o){switch(e){case bPt:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case PPt:return!(r.byteLength!=t.byteLength||!s(new x1(r),new x1(t)));case gPt:case mPt:case SPt:return uPt(+r,+t);case yPt:return r.name==t.name&&r.message==t.message;case TPt:case CPt:return r==t+"";case wPt:var a=hPt;case IPt:var u=n&pPt;if(a||(a=dPt),r.size!=t.size&&!u)return!1;var h=o.get(r);if(h)return h==t;n|=vPt,o.set(r,t);var v=fPt(a(r),a(t),n,i,s,o);return o.delete(r),v;case xPt:if(Od)return Od.call(r)==Od.call(t);}return!1;}var EPt=APt,b1=G2,MPt=1,LPt=Object.prototype,RPt=LPt.hasOwnProperty;function OPt(r,t,e,n,i,s){var o=e&MPt,a=b1(r),u=a.length,h=b1(t),v=h.length;if(u!=v&&!o)return!1;for(var p=u;p--;){var y=a[p];if(!(o?y in t:RPt.call(t,y)))return!1;}var C=s.get(r),b=s.get(t);if(C&&b)return C==t&&b==r;var M=!0;s.set(r,t),s.set(t,r);for(var L=o;++p<u;){y=a[p];var X=r[y],Y=t[y];if(n)var et=o?n(Y,X,y,t,r,s):n(X,Y,y,r,t,s);if(!(et===void 0?X===Y||i(X,Y,e,n,s):et)){M=!1;break;}L||(L=y=="constructor");}if(M&&!L){var A=r.constructor,w=t.constructor;A!=w&&"constructor"in r&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof w=="function"&&w instanceof w)&&(M=!1);}return s.delete(r),s.delete(t),M;}var DPt=OPt,Dd=E2,NPt=nT,kPt=EPt,BPt=DPt,A1=vf,E1=ml,M1=Tv,FPt=k2,WPt=1,L1="[object Arguments]",R1="[object Array]",Yc="[object Object]",UPt=Object.prototype,O1=UPt.hasOwnProperty;function zPt(r,t,e,n,i,s){var o=E1(r),a=E1(t),u=o?R1:A1(r),h=a?R1:A1(t);u=u==L1?Yc:u,h=h==L1?Yc:h;var v=u==Yc,p=h==Yc,y=u==h;if(y&&M1(r)){if(!M1(t))return!1;o=!0,v=!1;}if(y&&!v)return s||(s=new Dd()),o||FPt(r)?NPt(r,t,e,n,i,s):kPt(r,t,u,e,n,i,s);if(!(e&WPt)){var C=v&&O1.call(r,"__wrapped__"),b=p&&O1.call(t,"__wrapped__");if(C||b){var M=C?r.value():r,L=b?t.value():t;return s||(s=new Dd()),i(M,L,e,n,s);}}return y?(s||(s=new Dd()),BPt(r,t,e,n,i,s)):!1;}var $Pt=zPt,YPt=$Pt,D1=Mi;function iT(r,t,e,n,i){return r===t?!0:r==null||t==null||!D1(r)&&!D1(t)?r!==r&&t!==t:YPt(r,t,e,n,iT,i);}var GPt=iT,jPt=GPt;function XPt(r,t){return jPt(r,t);}var HPt=XPt;var Qn=/* @__PURE__ */$n(HPt);function N1(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")");}function VPt(r){var t=r.split(","),e=parseInt(t[0].split("(")[1]),n=parseInt(t[1]),i=parseInt(t[2]),s=Number(t[3].split(")")[0]);return[e,n,i,s];}var Nd="rgb(177,177,177)",Lu=/*#__PURE__*/function(_Gt4){function Lu(e){var _this48;_classCallCheck(this,Lu);var n;_this48=_callSuper(this,Lu,[e]);ht(_this48,"toolsType",St.Selector);ht(_this48,"tmpPoints",[]);ht(_this48,"subTmpPoints",[]);ht(_this48,"workOptions");ht(_this48,"vNodes");ht(_this48,"selectIds");ht(_this48,"selectorColor");ht(_this48,"strokeColor");ht(_this48,"fillColor");ht(_this48,"oldSelectRect");ht(_this48,"oldSubSelectRect");ht(_this48,"canRotate",!1);ht(_this48,"canTextEdit",!1);ht(_this48,"canLock",!1);ht(_this48,"scaleType",Ae.all);ht(_this48,"toolsTypes");ht(_this48,"shapeOpt");ht(_this48,"textOpt");ht(_this48,"isLocked");ht(_this48,"thickness");ht(_this48,"strokeType");ht(_this48,"useStroke");_this48.workOptions=_objectSpread(_objectSpread({},e.toolsOpt),{},{strokeColor:((n=e.toolsOpt)==null?void 0:n.strokeColor)||Nd}),_this48.vNodes=e.vNodes;return _this48;}_inherits(Lu,_Gt4);return _createClass(Lu,[{key:"computSelector",value:function computSelector(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var n=Ye(this.tmpPoints);if(n.w===0||n.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:/* @__PURE__ */new Map()};var _this$vNodes$getRectI=this.vNodes.getRectIntersectRange(n,e),i=_this$vNodes$getRectI.rectRange,s=_this$vNodes$getRectI.nodeRange;return{selectIds:_toConsumableArray(s.keys()),intersectRect:i,subNodeMap:s};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=this.tmpPoints.length,i=e.length;if(i>1){var s=new _t(e[i-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],e[i-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);n===2?this.tmpPoints.splice(1,1,s):this.tmpPoints.push(s);}}},{key:"drawSelector",value:function drawSelector(e){var _this49=this;var n=e.drawRect,i=e.subNodeMap,s=e.selectorId,o=e.layer,a=e.isService,u=new nr({pos:[n.x,n.y],anchor:[0,0],size:[n.w,n.h],id:s,name:s,zIndex:9999}),h=[];if(a){var v=new Bo({normalize:!0,pos:[n.w/2,n.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor||Nd,width:n.w,height:n.h,name:Lu.selectorBorderId});h.push(v);}i.forEach(function(v,p){var y=[v.rect.x+v.rect.w/2-n.x,v.rect.y+v.rect.h/2-n.y],C=new Bo({normalize:!0,pos:y,lineWidth:1,strokeColor:i.size>1?_this49.selectorColor||_this49.workOptions.strokeColor||Nd:void 0,width:v.rect.w,height:v.rect.h,id:"selector-".concat(p),name:"selector-".concat(p)});h.push(C);}),h&&u.append.apply(u,h),(o==null?void 0:o.parent).appendChild(u);}},{key:"draw",value:function draw(e,n,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var u,h;var o=i.intersectRect,a=i.subNodeMap;(h=(u=n.parent)==null?void 0:u.getElementById(e))==null||h.remove(),o&&this.drawSelector({drawRect:o,subNodeMap:a,selectorId:e,layer:n,isService:s});}},{key:"getSelecteorInfo",value:function getSelecteorInfo(e){this.scaleType=Ae.all,this.canRotate=!1,this.textOpt=void 0,this.strokeColor=void 0,this.fillColor=void 0,this.canTextEdit=!1,this.canLock=!1,this.isLocked=!1,this.toolsTypes=void 0,this.shapeOpt=void 0,this.thickness=void 0,this.strokeType=void 0,this.useStroke=!1;var n=/* @__PURE__ */new Set();var i,s=!0;var _iterator36=_createForOfIteratorHelper(e.values()),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var o=_step36.value;var a=o.opt,u=o.canRotate,h=o.scaleType,v=o.toolsType;this.selectorColor=this.workOptions.strokeColor,a.strokeColor&&(this.strokeColor=a.strokeColor),a.fillColor&&(this.fillColor=a.fillColor),a.textOpt&&(this.textOpt=a.textOpt),a.thickness&&(this.thickness=a.thickness),v!==St.Pencil&&(s=!1),a.strokeType&&(this.strokeType=a.strokeType),v===St.SpeechBalloon&&(n.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=a.placement),v===St.Polygon&&(n.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=a.vertices),v===St.Star&&(n.add(v),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=a.vertices,this.shapeOpt.innerRatio=a.innerRatio,this.shapeOpt.innerVerticeStep=a.innerVerticeStep),v===St.Text&&(this.textOpt=a),e.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=u,this.scaleType=h),(v===St.Image||v===St.BackgroundSVG)&&(i=o),(h===Ae.proportional&&this.scaleType!==Ae.none||h===Ae.none)&&(this.scaleType=h);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}s&&(this.useStroke=!0),n.size&&(this.toolsTypes=_toConsumableArray(n)),i&&(e.size===1?(this.canLock=!0,(i.toolsType===St.BackgroundSVG?i.opt.locked!==!1:i.opt.locked)&&(this.isLocked=!0,this.scaleType=Ae.none,this.canRotate=!1,this.textOpt=void 0,this.fillColor=void 0,this.selectorColor="rgb(177,177,177)",this.strokeColor=void 0,this.canTextEdit=!1,this.thickness=void 0,this.strokeType=void 0,this.useStroke=void 0)):e.size>1&&!i.opt.locked&&(this.canLock=!1,this.canRotate=!1));}},{key:"getChildrenPoints",value:function getChildrenPoints(){var e,n;if(this.scaleType===Ae.both&&((e=this.selectIds)==null?void 0:e.length)===1){var i=this.selectIds[0],s=(n=this.vNodes.get(i))==null?void 0:n.op;if(s){var o=[];for(var a=0;a<s.length;a+=3)o.push([s[a],s[a+1]]);return o;}}}},{key:"consume",value:function consume(e){if(e.isSubWorker)return this.subWorkerConsume(e);var n=_objectSpread({type:Tt.Select,dataType:Qt.Local},this.baseConsumeResult);if(e.isSimpleWorker){var v=this.subWorkerConsume(e);n.subRect=v.rect;}var _e$data3=e.data,i=_e$data3.op,s=_e$data3.workState;var o=this.oldSelectRect;if(s===te.Start&&(o=this.unSelectedAllIds()),!(i!=null&&i.length)||!this.vNodes.curNodeMap.size)return e.isSimpleWorker?n:{type:Tt.None};this.updateTempPoints(i);var a=this.computSelector();if(this.selectIds&&Qn(this.selectIds,a.selectIds))return e.isSimpleWorker?n:{type:Tt.None};this.selectIds=a.selectIds;var u=a.intersectRect;this.getSelecteorInfo(a.subNodeMap),this.draw(De,this.fullLayer,a),this.oldSelectRect=u;var h=this.getChildrenPoints();return n=_objectSpread(_objectSpread({},n),{},{rect:Kt(u,o),selectIds:a.selectIds,selectRect:u,selectorColor:this.selectorColor,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:h,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType}),n;}},{key:"consumeAll",value:function consumeAll(){var o,a;var e=this.oldSelectRect;var n=this.tmpPoints[0],i=this.tmpPoints[this.tmpPoints.length-1],s=n&&(!i||n.isNear(i,1));if(!((o=this.selectIds)!=null&&o.length)&&n&&s&&this.selectSingleTool(this.tmpPoints[0].XY,De,!1),(a=this.selectIds)!=null&&a.length&&(e=this.selectedByIds(this.selectIds)),e){var u=this.getChildrenPoints();return _objectSpread({type:Tt.Select,dataType:Qt.Local,rect:this.oldSelectRect,selectIds:this.selectIds,selectorColor:this.selectorColor,selectRect:this.oldSelectRect,strokeColor:this.strokeColor,fillColor:this.fillColor,textOpt:this.textOpt,canTextEdit:this.canTextEdit,canRotate:this.canRotate,canLock:this.canLock,scaleType:this.scaleType,willSyncService:!0,points:u,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}return _objectSpread({type:Tt.Select,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeService",value:function consumeService(){}},{key:"updateTempPointsForSubWorker",value:function updateTempPointsForSubWorker(e){var n=e.slice(-2),i=new _t(n[0],n[1]);if(this.subTmpPoints[0].isNear(i,1))return!1;if(this.subTmpPoints.length===2){if(i.isNear(this.subTmpPoints[1],1))return!1;this.subTmpPoints[1]=i;}else this.subTmpPoints.push(i);return!0;}},{key:"computDrawPoints",value:function computDrawPoints(e){var n=this.workOptions.thickness,i=[];var _iterator37=_createForOfIteratorHelper(e),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var a=_step37.value;i.push(_construct(xt,_toConsumableArray(a)));}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}var s=Ye(i,n),o=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:o,points:i.map(function(a){return a.XY;}).flat(1)};}},{key:"drawForSubWorker",value:function drawForSubWorker(e){var n=e.workId,i=e.layer,s=e.ps,_this$workOptions6=this.workOptions,o=_this$workOptions6.strokeColor,a=_this$workOptions6.scale,u=_this$workOptions6.rotate,h=_this$workOptions6.translate,v=i.worldPosition,p=i.worldScaling,_this$computDrawPoint2=this.computDrawPoints(s),y=_this$computDrawPoint2.points,C=_this$computDrawPoint2.rect,b=_this$computDrawPoint2.pos,M=1/i.worldScaling[0],L=o&&VPt(o)||[0,0,0,0],X={close:!0,normalize:!0,points:y,lineWidth:M,fillColor:N1(L[0],L[1],L[2],0.1),strokeColor:N1(L[0],L[1],L[2],1),lineJoin:"round",lineCap:"round"};var Y={x:Math.floor(C.x*p[0]+v[0]-Gt.SafeBorderPadding),y:Math.floor(C.y*p[1]+v[1]-Gt.SafeBorderPadding),w:Math.floor(C.w*p[0]+2*Gt.SafeBorderPadding),h:Math.floor(C.h*p[0]+2*Gt.SafeBorderPadding)};var et=new nr({name:n,id:n,pos:b,anchor:[0.5,0.5],size:[C.w,C.h],scale:a,rotate:u,translate:h}),A=new zn(_objectSpread(_objectSpread({},X),{},{pos:[0,0]}));if(et.appendChild(A),this.replace(i,n,et),a||u||h){var w=et.getBoundingClientRect();Y={x:Math.floor(w.x-Gt.SafeBorderPadding),y:Math.floor(w.y-Gt.SafeBorderPadding),w:Math.floor(w.width+2*Gt.SafeBorderPadding),h:Math.floor(w.height+2*Gt.SafeBorderPadding)};}return Y;}},{key:"transformData",value:function transformData(e){var n=Ye(e);return[[n.x,n.y,0],[n.x+n.w,n.y,0],[n.x+n.w,n.y+n.h,0],[n.x,n.y+n.h,0]];}},{key:"subWorkerConsume",value:function subWorkerConsume(e){var n=e.data,i=e.isFullWork,s=n.op,o=n.syncUnitTime;o&&(this.syncUnitTime=o);var a=s==null?void 0:s.length;if(!a||a<2)return{type:Tt.None,rect:void 0};var u;if(this.subTmpPoints.length===0?(this.subTmpPoints=[new _t(s[0],s[1])],u=!1):u=this.updateTempPointsForSubWorker(s),!u)return{type:Tt.None,rect:void 0};var h=this.transformData(this.subTmpPoints),v=i?this.fullLayer:this.drawLayer||this.fullLayer,p=this.drawForSubWorker({ps:h,workId:this.workId,layer:v}),y=Kt(p,this.oldSubSelectRect);return this.oldSubSelectRect=p,_objectSpread({rect:y,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"subWorkerConsumeAll",value:function subWorkerConsumeAll(e){var n=e.isFullWork,i=n?this.fullLayer:this.drawLayer||this.fullLayer;return this.replace(i,this.workId),_objectSpread({rect:this.oldSelectRect,type:Tt.FullWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"clearSubTmpPoints",value:function clearSubTmpPoints(){this.subTmpPoints.length=0;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0,this.clearSubTmpPoints();}},{key:"clearSubSelectData",value:function clearSubSelectData(){this.oldSubSelectRect=void 0;}},{key:"clearSelectData",value:function clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0,this.clearSubSelectData();}},{key:"selectSingleTool",value:function selectSingleTool(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:De;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(e.length===2){var s=e[0],o=e[1];var a;var _this$vNodes$getRectI2=this.vNodes.getRectIntersectRange({x:s,y:o,w:0,h:0},!1),u=_this$vNodes$getRectI2.nodeRange,h=_toConsumableArray(u.values()).sort(function(v,p){return(p.opt.zIndex||0)-(v.opt.zIndex||0);});var _iterator38=_createForOfIteratorHelper(h),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _v8=_step38.value;var _p3=this.fullLayer.getElementsByName(_v8.name);if(MT(_p3).find(function(C){return C.isPointCollision(s,o);})){a=_v8;break;}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}if(a){var v=a.name;if(!Qn(this.oldSelectRect,a.rect)){var p=/* @__PURE__ */new Map([[v,a]]);this.getSelecteorInfo(p),this.draw(n,this.fullLayer,{intersectRect:a.rect,subNodeMap:p,selectIds:this.selectIds||[]},i);}this.selectIds=[v],this.oldSelectRect=a.rect;}}}},{key:"unSelectedAllIds",value:function unSelectedAllIds(){var e;var _iterator39=_createForOfIteratorHelper(this.vNodes.curNodeMap.entries()),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _step39$value=_slicedToArray(_step39.value,2),n=_step39$value[0],i=_step39$value[1];i.isSelected&&(e=Kt(e,i.rect),this.vNodes.unSelected(n));}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}return e;}},{key:"unSelectedByIds",value:function unSelectedByIds(e){var n;var _iterator40=_createForOfIteratorHelper(e),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var i=_step40.value;var s=this.vNodes.get(i);s&&s.isSelected&&(n=Kt(n,s.rect),this.vNodes.unSelected(i));}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}return n;}},{key:"selectedByIds",value:function selectedByIds(e){var n;var _iterator41=_createForOfIteratorHelper(e),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var i=_step41.value;var s=this.vNodes.get(i);s&&(n=Kt(n,s.rect),this.vNodes.selected(i));}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return n;}},{key:"getSelectorRect",value:function getSelectorRect(e,n){var a;var i;var s=(a=e.parent)==null?void 0:a.getElementById(n),o=s==null?void 0:s.getBoundingClientRect();return o&&(i=Kt(i,{x:Math.floor(o.x),y:Math.floor(o.y),w:Math.floor(o.width+1),h:Math.floor(o.height+1)})),i;}},{key:"isCanFillColor",value:function isCanFillColor(e){return e===St.Ellipse||e===St.Triangle||e===St.Rectangle||e===St.Polygon||e===St.Star||e===St.SpeechBalloon;}},{key:"updateSelector",value:function(){var _updateSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(e){var n,i,s,o,a,u,h,v,p,y,C,b,M,L,X,Y,_iterator42,_step42,w,S,x,P,z,U,K,j,nt,ct,B,N,et,_w4,_S3,_x27,A,_t16,_t17,_t18;return _regenerator().w(function(_context14){while(1)switch(_context14.p=_context14.n){case 0:n=e.updateSelectorOpt,i=e.selectIds,s=e.vNodes,o=e.willSerializeData,a=e.worker,u=e.offset,h=this.fullLayer;if(h){_context14.n=1;break;}return _context14.a(2);case 1:p=/* @__PURE__ */new Map(),y=n.originPoint,C=n.workState,b=n.angle,M=n.translate,L=n.dir,X=n.scale;u&&(M?n.translate=[M[0]+u[0],M[1]+u[1]]:n.translate=u);if(!(y||M||$e(b))){_context14.n=3;break;}if(!(C===te.Start&&i)){_context14.n=2;break;}return _context14.a(2,(s.setTargetAssignKeys(i),{type:Tt.Select,dataType:Qt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect}));case 2:if(!(Y=s.getLastTarget(),!Y)){_context14.n=3;break;}return _context14.a(2);case 3:if(!i){_context14.n=18;break;}_iterator42=_createForOfIteratorHelper(i);_context14.p=4;_iterator42.s();case 5:if((_step42=_iterator42.n()).done){_context14.n=15;break;}w=_step42.value;S=s.get(w);if(!S){_context14.n=14;break;}x=S.toolsType,P=S.opt,z=(h==null?void 0:h.getElementsByName(w))[0];if(!z){_context14.n=14;break;}U=_objectSpread({},n);K=void 0;j=Gt.isWillRefresh({toolsType:x,opt:P,updateOpt:U,vNodes:s,node:z,willSerializeData:o});if(!x){_context14.n=14;break;}K=Y==null?void 0:Y.get(w);nt=ET(x);nt==null||nt.updateNodeOpt({node:z,opt:U,vNodes:s,willSerializeData:o,targetNode:K});ct=s.get(w)||S;if(!(ct&&a&&j)){_context14.n=13;break;}B=a.createWorkShapeNode({workId:w,toolsType:x,toolsOpt:ct.opt});B==null||B.setWorkId(w);N=void 0;if(!(x===St.BackgroundSVG)){_context14.n=6;break;}N=B.consumeService({isFullWork:!0,replaceId:w});_context14.n=12;break;case 6:if(!(x===St.Image)){_context14.n=8;break;}_context14.n=7;return B.consumeServiceAsync({isFullWork:!0,replaceId:w,worker:a});case 7:N=_context14.v;_context14.n=12;break;case 8:if(!(x===St.Text)){_context14.n=10;break;}_context14.n=9;return B.consumeServiceAsync({isFullWork:!0,replaceId:w,isDrawLabel:!0});case 9:N=_context14.v;_context14.n=12;break;case 10:_context14.p=10;N=B==null?void 0:B.consumeService({op:ct.op,isFullWork:!0,replaceId:w,workState:C});_context14.n=12;break;case 11:_context14.p=11;_t16=_context14.v;console.error("consumeService error",_t16);return _context14.a(3,14);case 12:N&&(ct.rect=N);case 13:ct&&(p.set(w,ct),v=Kt(v,ct.rect));case 14:_context14.n=5;break;case 15:_context14.n=17;break;case 16:_context14.p=16;_t17=_context14.v;_iterator42.e(_t17);case 17:_context14.p=17;_iterator42.f();return _context14.f(17);case 18:Y&&C===te.Done&&(s.deleteLastTarget(),Y=void 0);et=v;if(!(y&&M&&X&&L&&et&&!u)){_context14.n=25;break;}_w4=[[et.x,et.y],[et.x+et.w,et.y],[et.x+et.w,et.y+et.h],[et.x,et.y+et.h]];_t18=L;_context14.n=_t18==="top"?19:_t18==="topLeft"?19:_t18==="left"?19:_t18==="topRight"?20:_t18==="right"?21:_t18==="bottomRight"?21:_t18==="bottom"?21:_t18==="bottomLeft"?22:23;break;case 19:M[0]>0&&M[1]>0?_S3=_w4[0]:M[0]>0?_S3=_w4[3]:M[1]>0?_S3=_w4[1]:_S3=_w4[2];return _context14.a(3,23);case 20:M[0]<0&&M[1]>0?_S3=_w4[1]:M[0]<0?_S3=_w4[2]:M[1]>0?_S3=_w4[0]:_S3=_w4[3];return _context14.a(3,23);case 21:M[0]<0&&M[1]<0?_S3=_w4[2]:M[0]<0?_S3=_w4[1]:M[1]<0?_S3=_w4[3]:_S3=_w4[0];return _context14.a(3,23);case 22:M[0]>0&&M[1]<0?_S3=_w4[3]:M[0]>0?_S3=_w4[0]:M[1]<0?_S3=_w4[2]:_S3=_w4[1];return _context14.a(3,23);case 23:_x27=_S3&&[y[0]-_S3[0],y[1]-_S3[1]]||[0,0];if(Qn(_x27,[0,0])){_context14.n=25;break;}_context14.n=24;return this.updateSelector(_objectSpread(_objectSpread({},e),{},{updateSelectorOpt:{workState:C},offset:_x27}));case 24:return _context14.a(2,_context14.v);case 25:this.getSelecteorInfo(p),this.draw(De,h,{selectIds:i||[],subNodeMap:p,intersectRect:et});A=Kt(this.oldSelectRect,et);return _context14.a(2,(this.oldSelectRect=et,{type:Tt.Select,dataType:Qt.Local,selectRect:et,renderRect:v,rect:Kt(A,et),selectIds:i}));}},_callee13,this,[[10,11],[4,16,17,18]]);}));function updateSelector(_x26){return _updateSelector.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function blurSelector(){var e=this.unSelectedAllIds();return{type:Tt.Select,dataType:Qt.Local,rect:e,selectIds:[],willSyncService:!0};}},{key:"getRightServiceId",value:function getRightServiceId(e){return e.replace(Fo,"-");}},{key:"selectServiceNode",value:function selectServiceNode(e,n,i){var _this50=this;var s=n.selectIds,o=this.getRightServiceId(e),a=this.getSelectorRect(this.fullLayer,o);var u;var h=/* @__PURE__ */new Map();return s==null||s.forEach(function(v){var p=_this50.vNodes.get(v);p&&(u=Kt(u,p.rect),h.set(v,p));}),this.getSelecteorInfo(h),this.draw(o,this.fullLayer,{intersectRect:u,selectIds:s||[],subNodeMap:h},i),Kt(u,a);}},{key:"reRenderSelector",value:function reRenderSelector(){var _this51=this;var i;var e;var n=/* @__PURE__ */new Map();return(i=this.selectIds)==null||i.forEach(function(s){var o=_this51.vNodes.get(s);o&&(e=Kt(e,o.rect),n.set(s,o));},this),this.getSelecteorInfo(n),this.draw(De,this.fullLayer,{intersectRect:e,subNodeMap:n,selectIds:this.selectIds||[]}),this.oldSelectRect=e,e;}},{key:"updateSelectIds",value:function updateSelectIds(e){var o;var n;var i=(o=this.selectIds)==null?void 0:o.filter(function(a){return!e.includes(a);});if(i!=null&&i.length&&(n=this.unSelectedByIds(i)),e.length){var a=this.selectedByIds(e);n=Kt(n,a);}this.selectIds=e;var s=this.reRenderSelector();return{bgRect:n,selectRect:s};}},{key:"cursorHover",value:function cursorHover(e){var o,a;var n=this.oldSelectRect;this.selectIds=[];var i=(o=this.workId)==null?void 0:o.toString(),s=[e[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],e[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(s,i,!0),this.oldSelectRect&&!Qn(n,this.oldSelectRect))return{type:Tt.CursorHover,dataType:Qt.Local,rect:Kt(n,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((a=this.selectIds)!=null&&a.length||(this.oldSelectRect=void 0),n&&!this.oldSelectRect)return this.cursorBlur(),{type:Tt.CursorHover,dataType:Qt.Local,rect:n,selectorColor:this.selectorColor,willSyncService:!1};}},{key:"cursorBlur",value:function cursorBlur(){var n,i;this.selectIds=[];var e=(n=this.workId)==null?void 0:n.toString();((i=this.fullLayer)==null?void 0:i.parent).children.forEach(function(s){s.name===e&&s.remove();});}}]);}(Gt);ht(Lu,"selectorBorderId","selector-border");var Ka=Lu;var sT=/*#__PURE__*/function(_Gt5){function sT(e){var _this52;_classCallCheck(this,sT);_this52=_callSuper(this,sT,[e]);ht(_this52,"canRotate",!1);ht(_this52,"scaleType",Ae.both);ht(_this52,"toolsType",St.Arrow);ht(_this52,"tmpPoints",[]);ht(_this52,"workOptions");ht(_this52,"oldRect");ht(_this52,"arrowTipWidth");ht(_this52,"syncTimestamp");_this52.workOptions=e.toolsOpt,_this52.arrowTipWidth=_this52.workOptions.thickness*4,_this52.syncTimestamp=0,_this52.syncUnitTime=50;return _this52;}_inherits(sT,_Gt5);return _createClass(sT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime;p&&(this.syncUnitTime=p);var y=v==null?void 0:v.length;if(!y||y<2)return{type:Tt.None};var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:Tt.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:L});}if(u){var _L4=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L4,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L5=Date.now();return _L5-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L5,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:Tt.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:Tt.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread(_objectSpread({rect:M},this.baseConsumeResult),{},{type:Tt.DrawWork,dataType:Qt.Local});}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:Tt.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i},this.baseConsumeResult),{},{type:Tt.FullWork,dataType:Qt.Local,ops:o,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawEraserlines,_this$workOptions7=this.workOptions,o=_this$workOptions7.strokeColor,a=_this$workOptions7.thickness,u=_this$workOptions7.zIndex,h=_this$workOptions7.scale,v=_this$workOptions7.rotate,p=_this$workOptions7.translate,y=_this$workOptions7.strokeType,C=_this$workOptions7.eraserlines,b=_this$workOptions7.eraserFaces,M=_this$workOptions7.doingLines,L=_this$workOptions7.lineDash,X=_this$workOptions7.lineCap,Y=i.worldPosition,et=i.worldScaling,_this$computDrawPoint3=this.computDrawPoints(a),A=_this$computDrawPoint3.points,w=_this$computDrawPoint3.pos,S=_this$computDrawPoint3.rect,x=_this$computDrawPoint3.isTriangle,P=_this$computDrawPoint3.trianglePoints,z=_this$computDrawPoint3.trianglePos,U=[S.x+S.w/2,S.y+S.h/2],K={pos:U,name:n,id:n,zIndex:u,anchor:[0.5,0.5],size:[S.w,S.h]};h&&(K.scale=h),v&&(K.rotate=v),p&&(K.translate=p);var j=new nr(K),nt={points:P,pos:[z[0]-U[0],z[1]-U[1]],fillColor:o,strokeColor:o,lineWidth:0,normalize:!1},ct=new zn(nt);if(j.append(ct),!x&&A&&w){var N={points:A,pos:[w[0]-U[0],w[1]-U[1]],fillColor:o,strokeColor:o,lineDash:y===Ne.Dotted?[L&&L[0]||1,(L&&L[1]||2)*a]:y===Ne.LongDotted?[(L&&L[0]||1)*a,(L&&L[1]||2)*a]:void 0,lineCap:y===Ne.Normal?void 0:X,lineWidth:a,normalize:!1},G=new zn(N);j.append(G);}(C||b||M)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:j,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:b,pos:U,layer:i},s)),this.replace(i,n,j);var B={x:Math.floor(S.x*et[0]+Y[0]-Gt.SafeBorderPadding),y:Math.floor(S.y*et[1]+Y[1]-Gt.SafeBorderPadding),w:Math.floor(S.w*et[0]+2*Gt.SafeBorderPadding),h:Math.floor(S.h*et[1]+2*Gt.SafeBorderPadding)};if(h||v||p){var _N2=j.getBoundingClientRect();B={x:Math.floor(_N2.x-Gt.SafeBorderPadding),y:Math.floor(_N2.y-Gt.SafeBorderPadding),w:Math.floor(_N2.width+Gt.SafeBorderPadding*2),h:Math.floor(_N2.height+Gt.SafeBorderPadding*2)};}return this.isDelete&&j.setAttribute("opacity",0),B;}},{key:"computDrawPoints",value:function computDrawPoints(e){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.arrowTipWidth?this.computFullArrowPoints(e):this.computTrianglePoints();}},{key:"computFullArrowPoints",value:function computFullArrowPoints(e){var _this53=this;var n=xt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),i=xt.Per(n).mul(e/2),s=_t.Sub(this.tmpPoints[0],i),o=_t.Add(this.tmpPoints[0],i),a=xt.Mul(n,this.arrowTipWidth),u=xt.Sub(this.tmpPoints[1],a),h=_t.Sub(u,i),v=_t.Add(u,i),p=xt.Per(n).mul(e*1.5),y=_t.Sub(u,p),C=_t.Add(u,p),b=[this.tmpPoints[0],u],M=[y,this.tmpPoints[1],C],L=[s,o].concat(M,[h,v]);return{trianglePoints:M.map(function(X){return _t.Sub(X,_this53.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,points:b.map(function(X){return _t.Sub(X,_this53.tmpPoints[0]).XY;}).flat(1),rect:Ye(L),isTriangle:!1,pos:this.tmpPoints[0].XY};}},{key:"computTrianglePoints",value:function computTrianglePoints(){var _this54=this;var e=xt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=this.tmpPoints[1].distance(this.tmpPoints[0]),i=xt.Per(e).mul(Math.floor(n*3/8)),s=_t.Sub(this.tmpPoints[0],i),o=_t.Add(this.tmpPoints[0],i),a=[s,this.tmpPoints[1],o];return{trianglePoints:a.map(function(u){return _t.Sub(u,_this54.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Ye(a),isTriangle:!0};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState2=e.workState,s=_e$workState2===void 0?te.Done:_e$workState2,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var h,v;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.strokeType,u=s.get(n.name);return o&&(n.tagName==="GROUP"?n.children.forEach(function(p){p.setAttribute("strokeColor",o),p.getAttribute("fillColor")&&p.setAttribute("fillColor",o);}):(n.setAttribute("strokeColor",o),n.setAttribute("fillColor",o)),(h=u==null?void 0:u.opt)!=null&&h.strokeColor&&(u.opt.strokeColor=o)),a&&u!=null&&u.opt&&(v=u.opt)!=null&&v.strokeType&&(u.opt.strokeType=a),u&&s.setInfo(n.name,u),Gt.updateNodeOpt(e);}}]);}(Gt);var oT=/*#__PURE__*/function(_Gt6){function oT(e){var _this55;_classCallCheck(this,oT);_this55=_callSuper(this,oT,[e]);ht(_this55,"canRotate",!1);ht(_this55,"scaleType",Ae.all);ht(_this55,"toolsType",St.Ellipse);ht(_this55,"tmpPoints",[]);ht(_this55,"workOptions");ht(_this55,"oldRect");ht(_this55,"syncTimestamp");_this55.workOptions=e.toolsOpt,_this55.syncTimestamp=0,_this55.syncUnitTime=50;return _this55;}_inherits(oT,_Gt6);return _createClass(oT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime;p&&(this.syncUnitTime=p);var y=v==null?void 0:v.length;if(!y||y<2)return{type:Tt.None};var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:Tt.None};var b;if(s||o||u){var M=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:M,isDrawing:!0});var L=M.parent.parent,X={x:0,y:0,w:Math.floor(L.width),h:Math.floor(L.height)},Y=_objectSpread({type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(el(b,X)!==es.outside){var A=Kt(b,this.oldRect);if(this.oldRect=b,Y.rect=A,!u)return Y;}if(u){var _A4=Date.now();return _A4-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=_A4,Y.op=this.tmpPoints.map(function(w){return[].concat(_toConsumableArray(w.XY),[0]);}).flat(1),Y.index=0,Y.isSync=!0),Y;}return{type:Tt.None};}if(!s&&!o&&!u&&a){var _M2=Date.now();return _M2-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_M2,_objectSpread(_objectSpread({type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult),{},{op:this.tmpPoints.map(function(L){return[].concat(_toConsumableArray(L.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:Tt.None};}return{type:Tt.None};}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:Tt.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:Tt.FullWork,dataType:Qt.Local},this.baseConsumeResult),{},{ops:o,isSync:!0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,o=e.isDrawEraserlines,_this$workOptions8=this.workOptions,a=_this$workOptions8.strokeColor,u=_this$workOptions8.fillColor,h=_this$workOptions8.thickness,v=_this$workOptions8.zIndex,p=_this$workOptions8.scale,y=_this$workOptions8.rotate,C=_this$workOptions8.translate,b=_this$workOptions8.strokeType,M=_this$workOptions8.eraserlines,L=_this$workOptions8.eraserFaces,X=_this$workOptions8.doingLines,Y=_this$workOptions8.lineDash,et=_this$workOptions8.lineCap,A=i.worldScaling,_this$computDrawPoint4=this.computDrawPoints(h),w=_this$computDrawPoint4.radius,S=_this$computDrawPoint4.rect,x=_this$computDrawPoint4.pos,P={closeType:"normal",radius:w,lineWidth:h,fillColor:u!=="transparent"&&u||void 0,strokeColor:a,normalize:!0,lineCap:et,lineDash:b===Ne.Dotted?[Y&&Y[0]||1,(Y&&Y[1]||2)*h]:b===Ne.LongDotted?[(Y&&Y[0]||1)*h,(Y&&Y[1]||2)*h]:void 0},z={name:n,id:n,zIndex:v,pos:x,anchor:[0.5,0.5],size:[S.w,S.h]};p&&(z.scale=p),y&&(z.rotate=y),C&&(z.translate=C);var U=new nr(z);if(s){var nt=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/A[0],1/A[1]]});U.append(nt);}var K=new dv(_objectSpread(_objectSpread({},P),{},{pos:[0,0]}));U.append(K),(M||L||X)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:U,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:L,pos:x,layer:i},o)),this.replace(i,n,U);var j=U.getBoundingClientRect();return this.isDelete&&U.setAttribute("opacity",0),{x:Math.floor(j.x-Gt.SafeBorderPadding),y:Math.floor(j.y-Gt.SafeBorderPadding),w:Math.floor(j.width+Gt.SafeBorderPadding*2),h:Math.floor(j.height+Gt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(e){var n=Ye(this.tmpPoints),i=Ye(this.tmpPoints,e),s=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)];return{rect:i,pos:s,radius:[Math.floor(n.w/2),Math.floor(n.h/2)]};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState3=e.workState,s=_e$workState3===void 0?te.Done:_e$workState3,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var p,y,C;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.strokeType,h=s.get(n.name);var v=n;return n.tagName==="GROUP"&&(v=n.children[0]),o&&(v.setAttribute("strokeColor",o),(p=h==null?void 0:h.opt)!=null&&p.strokeColor&&(h.opt.strokeColor=o)),a&&(a==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",a),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=a)),u&&h!=null&&h.opt&&(C=h.opt)!=null&&C.strokeType&&(h.opt.strokeType=u),h&&s.setInfo(n.name,h),Gt.updateNodeOpt(e);}}]);}(Gt);var aT=/*#__PURE__*/function(_Gt7){function aT(e){var _this56;_classCallCheck(this,aT);_this56=_callSuper(this,aT,[e]);ht(_this56,"canRotate",!0);ht(_this56,"scaleType",Ae.all);ht(_this56,"toolsType",St.Rectangle);ht(_this56,"tmpPoints",[]);ht(_this56,"workOptions");ht(_this56,"oldRect");ht(_this56,"syncTimestamp");_this56.workOptions=e.toolsOpt,_this56.syncTimestamp=0,_this56.syncUnitTime=50;return _this56;}_inherits(aT,_Gt7);return _createClass(aT,[{key:"transformData",value:function transformData(){var e=Ye(this.tmpPoints);return[[e.x,e.y,0],[e.x+e.w,e.y,0],[e.x+e.w,e.y+e.h,0],[e.x,e.y+e.h,0]];}},{key:"computDrawPoints",value:function computDrawPoints(e){var n=this.workOptions.thickness,i=[];var _iterator43=_createForOfIteratorHelper(e),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var a=_step43.value;i.push(_construct(xt,_toConsumableArray(a)));}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}var s=Ye(i,n),o=[s.x+s.w/2,s.y+s.h/2];return{rect:s,pos:o,points:i.map(function(a){return a.XY;}).flat(1)};}},{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=v==null?void 0:v.length;if(!p||p<2)return{type:Tt.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:Tt.None};var C=this.transformData();var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({ps:C,workId:h,layer:L,isDrawing:!0});}if(u){var _L6=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L6,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=C.flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L7=Date.now();return _L7-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L7,_objectSpread({type:Tt.DrawWork,dataType:Qt.Local,op:C.flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:Tt.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var u;var e=this.workId;if(this.tmpPoints.length<2)return{type:Tt.RemoveNode,removeIds:[e]};var n=this.transformData(),i=this.fullLayer,s=this.draw({ps:n,workId:e,layer:i,isDrawing:!1});this.oldRect=s;var o=n.flat(1),a=Br(o);return(u=this.vNodes)==null||u.setInfo(e,{rect:s,op:o,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&Gt.getCenterPos(s,i)}),_objectSpread(_objectSpread({rect:s,type:Tt.FullWork,dataType:Qt.Local,ops:a,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,o=e.ps,a=e.replaceId,_e$isDrawEraserlines2=e.isDrawEraserlines,u=_e$isDrawEraserlines2===void 0?!0:_e$isDrawEraserlines2,_this$workOptions9=this.workOptions,h=_this$workOptions9.strokeColor,v=_this$workOptions9.fillColor,p=_this$workOptions9.thickness,y=_this$workOptions9.zIndex,C=_this$workOptions9.scale,b=_this$workOptions9.rotate,M=_this$workOptions9.translate,L=_this$workOptions9.strokeType,X=_this$workOptions9.eraserlines,Y=_this$workOptions9.eraserFaces,et=_this$workOptions9.doingLines,A=_this$workOptions9.lineCap,w=_this$workOptions9.lineDash,S=i.worldPosition,x=i.worldScaling,_this$computDrawPoint5=this.computDrawPoints(o),P=_this$computDrawPoint5.points,z=_this$computDrawPoint5.rect,U=_this$computDrawPoint5.pos,K={close:!0,normalize:!0,points:P,lineWidth:p,fillColor:v!=="transparent"&&v||void 0,strokeColor:h,lineCap:A,lineDash:L===Ne.Dotted?[w&&w[0]||1,(w&&w[1]||2)*p]:L===Ne.LongDotted?[(w&&w[0]||1)*p,(w&&w[1]||2)*p]:void 0};var j={x:Math.floor(z.x*x[0]+S[0]-Gt.SafeBorderPadding),y:Math.floor(z.y*x[1]+S[1]-Gt.SafeBorderPadding),w:Math.floor(z.w*x[0]+2*Gt.SafeBorderPadding),h:Math.floor(z.h*x[0]+2*Gt.SafeBorderPadding)};var nt=new nr({name:n,id:n,zIndex:y,pos:U,anchor:[0.5,0.5],size:[z.w,z.h],scale:C,rotate:b,translate:M}),ct=new zn(_objectSpread(_objectSpread({},K),{},{pos:[0,0]}));if(nt.appendChild(ct),s){var B=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:h,lineWidth:1,scale:[1/x[0],1/x[1]]});nt.appendChild(B);}if((X||Y||et)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:nt,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:Y,pos:U,layer:i},u)),this.replace(i,a||n,nt),C||b||M){var _B2=nt.getBoundingClientRect();j={x:Math.floor(_B2.x-Gt.SafeBorderPadding),y:Math.floor(_B2.y-Gt.SafeBorderPadding),w:Math.floor(_B2.width+2*Gt.SafeBorderPadding),h:Math.floor(_B2.height+2*Gt.SafeBorderPadding)};}return this.isDelete&&nt.setAttribute("opacity",0),j;}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var p,y;var n=e.op,i=e.isFullWork,s=e.replaceId,_e$workState4=e.workState,o=_e$workState4===void 0?te.Done:_e$workState4,a=(p=this.workId)==null?void 0:p.toString();if(!a)return;var u=[];for(var C=0;C<n.length;C+=3)u.push([n[C],n[C+1],n[C+2]]);var h=i?this.fullLayer:this.drawLayer||this.fullLayer,v=this.draw({ps:u,workId:a,layer:h,isDrawing:!1,replaceId:s,isDrawEraserlines:o===te.Done});return this.oldRect=v,(y=this.vNodes)==null||y.setInfo(a,{rect:v,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Gt.getCenterPos(v,h)}),v;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var p,y,C;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.strokeType,h=s.get(n.name);var v=n;return n.tagName==="GROUP"&&(v=n.children[0]),o&&(v.setAttribute("strokeColor",o),(p=h==null?void 0:h.opt)!=null&&p.strokeColor&&(h.opt.strokeColor=o)),a&&(a==="transparent"?v.setAttribute("fillColor","rgba(0,0,0,0)"):v.setAttribute("fillColor",a),(y=h==null?void 0:h.opt)!=null&&y.fillColor&&(h.opt.fillColor=a)),u&&h!=null&&h.opt&&(C=h.opt)!=null&&C.strokeType&&(h.opt.strokeType=u),h&&s.setInfo(n.name,h),Gt.updateNodeOpt(e);}}]);}(Gt);var lT=/*#__PURE__*/function(_Gt8){function lT(e){var _this57;_classCallCheck(this,lT);_this57=_callSuper(this,lT,[e]);ht(_this57,"canRotate",!1);ht(_this57,"scaleType",Ae.all);ht(_this57,"toolsType",St.Star);ht(_this57,"tmpPoints",[]);ht(_this57,"workOptions");ht(_this57,"oldRect");ht(_this57,"syncTimestamp");_this57.workOptions=e.toolsOpt,_this57.syncTimestamp=0,_this57.syncUnitTime=50;return _this57;}_inherits(lT,_Gt8);return _createClass(lT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime,y=v==null?void 0:v.length;if(!y||y<2)return{type:Tt.None};p&&(this.syncUnitTime=p);var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:Tt.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:L,isDrawing:!0});}if(u){var _L8=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L8,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L9=Date.now();return _L9-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L9,_objectSpread({type:Tt.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:Tt.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:Tt.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:Tt.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,_e$isDrawEraserlines3=e.isDrawEraserlines,o=_e$isDrawEraserlines3===void 0?!0:_e$isDrawEraserlines3,_this$workOptions0=this.workOptions,a=_this$workOptions0.strokeColor,u=_this$workOptions0.fillColor,h=_this$workOptions0.thickness,v=_this$workOptions0.zIndex,p=_this$workOptions0.vertices,y=_this$workOptions0.innerVerticeStep,C=_this$workOptions0.innerRatio,b=_this$workOptions0.scale,M=_this$workOptions0.rotate,L=_this$workOptions0.translate,X=_this$workOptions0.strokeType,Y=_this$workOptions0.eraserlines,et=_this$workOptions0.eraserFaces,A=_this$workOptions0.doingLines,w=_this$workOptions0.lineDash,S=_this$workOptions0.lineCap,x=i.worldScaling,_this$computDrawPoint6=this.computDrawPoints(h,p,y,C),P=_this$computDrawPoint6.rect,z=_this$computDrawPoint6.pos,U=_this$computDrawPoint6.points,K={close:!0,points:U,lineWidth:h,fillColor:u!=="transparent"&&u||void 0,strokeColor:a,normalize:!0,lineCap:S,lineDash:X===Ne.Dotted?[w&&w[0]||1,(w&&w[1]||2)*h]:X===Ne.LongDotted?[(w&&w[0]||1)*h,(w&&w[1]||2)*h]:void 0},j={name:n,id:n,zIndex:v,pos:z,anchor:[0.5,0.5],size:[P.w,P.h]};b&&(j.scale=b),M&&(j.rotate=M),L&&(j.translate=L);var nt=new nr(j);if(s){var N=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/x[0],1/x[1]]});nt.append(N);}var ct=new zn(_objectSpread(_objectSpread({},K),{},{pos:[0,0]}));nt.append(ct),(Y||et||A)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:nt,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:et,pos:z,layer:i},o)),this.replace(i,n,nt);var B=nt.getBoundingClientRect();return this.isDelete&&nt.setAttribute("opacity",0),{x:Math.floor(B.x-Gt.SafeBorderPadding),y:Math.floor(B.y-Gt.SafeBorderPadding),w:Math.floor(B.width+Gt.SafeBorderPadding*2),h:Math.floor(B.height+Gt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(e,n,i,s){var o=Ye(this.tmpPoints),a=[Math.floor(o.x+o.w/2),Math.floor(o.y+o.h/2)],u=RT(o.w,o.h),h=Math.floor(Math.min(o.w,o.h)/2),v=s*h,p=[],y=2*Math.PI/n;for(var b=0;b<n;b++){var M=b*y-0.5*Math.PI;var L=void 0,X=void 0;b%i===1?(L=v*u[0]*Math.cos(M),X=v*u[1]*Math.sin(M)):(L=h*u[0]*Math.cos(M),X=h*u[1]*Math.sin(M),p.push(L,X)),p.push(L,X);}return{rect:Ye(this.tmpPoints,e),pos:a,points:p};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o)||_t.Sub(s,i).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState5=e.workState,s=_e$workState5===void 0?te.Done:_e$workState5,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var L;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.toolsType,h=i.vertices,v=i.innerVerticeStep,p=i.innerRatio,y=i.strokeType,C=s.get(n.name),b=C==null?void 0:C.opt;var M=n;return n.tagName==="GROUP"&&(M=n.children[0]),o&&(M.setAttribute("strokeColor",o),b!=null&&b.strokeColor&&(b.strokeColor=o)),a&&(a==="transparent"?M.setAttribute("fillColor","rgba(0,0,0,0)"):M.setAttribute("fillColor",a),b!=null&&b.fillColor&&(b.fillColor=a)),u===St.Star&&(h&&(b.vertices=h),v&&(b.innerVerticeStep=v),p&&(b.innerRatio=p)),y&&C!=null&&C.opt&&(L=C.opt)!=null&&L.strokeType&&(C.opt.strokeType=y),C&&s.setInfo(n.name,_objectSpread(_objectSpread({},C),{},{opt:b})),Gt.updateNodeOpt(e);}}]);}(Gt);var cT=/*#__PURE__*/function(_Gt9){function cT(e){var _this58;_classCallCheck(this,cT);_this58=_callSuper(this,cT,[e]);ht(_this58,"canRotate",!1);ht(_this58,"scaleType",Ae.all);ht(_this58,"toolsType",St.Polygon);ht(_this58,"tmpPoints",[]);ht(_this58,"workOptions");ht(_this58,"oldRect");ht(_this58,"syncTimestamp");_this58.workOptions=e.toolsOpt,_this58.syncTimestamp=0,_this58.syncUnitTime=50;return _this58;}_inherits(cT,_Gt9);return _createClass(cT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=n.op,v=n.syncUnitTime;v&&(this.syncUnitTime=v);var p=this.workId,y=h==null?void 0:h.length;if(!y||y<2)return{type:Tt.None};var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(h[0],h[1])],C=!1):C=this.updateTempPoints(h),!C)return{type:Tt.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:p,layer:L,isDrawing:!0});}if(u){var _L0=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({type:Tt.DrawWork,rect:_L0,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L1=Date.now();return _L1-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L1,_objectSpread({type:Tt.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:Tt.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:Tt.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:Tt.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,s=e.isDrawing,_e$isDrawEraserlines4=e.isDrawEraserlines,o=_e$isDrawEraserlines4===void 0?!0:_e$isDrawEraserlines4,_this$workOptions1=this.workOptions,a=_this$workOptions1.strokeColor,u=_this$workOptions1.fillColor,h=_this$workOptions1.thickness,v=_this$workOptions1.zIndex,p=_this$workOptions1.vertices,y=_this$workOptions1.scale,C=_this$workOptions1.rotate,b=_this$workOptions1.translate,M=_this$workOptions1.strokeType,L=_this$workOptions1.eraserlines,X=_this$workOptions1.eraserFaces,Y=_this$workOptions1.doingLines,et=_this$workOptions1.lineCap,A=_this$workOptions1.lineDash,w=i.worldScaling,_this$computDrawPoint7=this.computDrawPoints(h,p),S=_this$computDrawPoint7.rect,x=_this$computDrawPoint7.pos,P=_this$computDrawPoint7.points,z={close:!0,points:P,lineWidth:h,fillColor:u!=="transparent"&&u||void 0,strokeColor:a,normalize:!0,lineCap:et,lineDash:M===Ne.Dotted?[A&&A[0]||1,(A&&A[1]||2)*h]:M===Ne.LongDotted?[(A&&A[0]||1)*h,(A&&A[1]||2)*h]:void 0},U={name:n,id:n,zIndex:v,pos:x,anchor:[0.5,0.5],size:[S.w,S.h]};y&&(U.scale=y),C&&(U.rotate=C),b&&(U.translate=b);var K=new nr(U);if(s){var ct=new $r({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/w[0],1/w[1]]});K.append(ct);}var j=new zn(_objectSpread(_objectSpread({},z),{},{pos:[0,0]}));K.append(j),(L||X||Y)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:K,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:X,pos:x,layer:i},o)),this.replace(i,n,K);var nt=K.getBoundingClientRect();return this.isDelete&&K.setAttribute("opacity",0),{x:Math.floor(nt.x-Gt.SafeBorderPadding),y:Math.floor(nt.y-Gt.SafeBorderPadding),w:Math.floor(nt.width+Gt.SafeBorderPadding*2),h:Math.floor(nt.height+Gt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(e,n){var i=Ye(this.tmpPoints),s=[Math.floor(i.x+i.w/2),Math.floor(i.y+i.h/2)],o=RT(i.w,i.h),a=Math.floor(Math.min(i.w,i.h)/2),u=[],h=2*Math.PI/n;for(var p=0;p<n;p++){var y=p*h-0.5*Math.PI,C=a*o[0]*Math.cos(y),b=a*o[1]*Math.sin(y);u.push(C,b);}return{rect:Ye(this.tmpPoints,e),pos:s,points:u};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o)||_t.Sub(s,i).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState6=e.workState,s=_e$workState6===void 0?te.Done:_e$workState6,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var b;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.toolsType,h=i.vertices,v=i.strokeType,p=s.get(n.name),y=p==null?void 0:p.opt;var C=n;return n.tagName==="GROUP"&&(C=n.children[0]),o&&(C.setAttribute("strokeColor",o),y!=null&&y.strokeColor&&(y.strokeColor=o)),a&&(a==="transparent"?C.setAttribute("fillColor","rgba(0,0,0,0)"):C.setAttribute("fillColor",a),y!=null&&y.fillColor&&(y.fillColor=a)),u===St.Polygon&&h&&(y.vertices=h),v&&p!=null&&p.opt&&(b=p.opt)!=null&&b.strokeType&&(p.opt.strokeType=v),p&&s.setInfo(n.name,_objectSpread(_objectSpread({},p),{},{opt:y})),Gt.updateNodeOpt(e);}}]);}(Gt);var kn=/*#__PURE__*/function(){function kn(){_classCallCheck(this,kn);}return _createClass(kn,null,[{key:"bezier",value:function bezier(t,e){var n=[];for(var i=0;i<e.length;i+=4){var s=e[i],o=e[i+1],a=e[i+2],u=e[i+3];s&&o&&a&&u?n.push.apply(n,_toConsumableArray(kn.getBezierPoints(t,s,o,a,u))):s&&o&&a?n.push.apply(n,_toConsumableArray(kn.getBezierPoints(t,s,o,a))):s&&o?n.push.apply(n,_toConsumableArray(kn.getBezierPoints(t,s,o))):s&&n.push(s);}return n;}/**
|
|
412
412
|
* @desc 获取点,这里可以设置点的个数
|
|
413
413
|
* @param {number} num 点个数
|
|
414
414
|
* @param {Vec2d} p1 点坐标
|
|
@@ -436,14 +436,14 @@ ht(Ro,"eraserSizes",Rv);var wu=Ro;var jxt="__lodash_hash_undefined__";function X
|
|
|
436
436
|
* @param {Array} p2 终点坐标
|
|
437
437
|
* @param {Array} cp1 控制点1
|
|
438
438
|
* @param {Array} cp2 控制点2
|
|
439
|
-
*/},{key:"threeBezier",value:function threeBezier(t,e,n,i,s){var o=e.x*(1-t)*(1-t)*(1-t)+3*n.x*t*(1-t)*(1-t)+3*i.x*t*t*(1-t)+s.x*t*t*t,a=e.y*(1-t)*(1-t)*(1-t)+3*n.y*t*(1-t)*(1-t)+3*i.y*t*t*(1-t)+s.y*t*t*t;return new xt(o,a);}}]);}();var uT=/*#__PURE__*/function(_Gt0){function uT(e){var _this59;_classCallCheck(this,uT);_this59=_callSuper(this,uT,[e]);ht(_this59,"canRotate",!1);ht(_this59,"scaleType",Ae.all);ht(_this59,"toolsType",St.SpeechBalloon);ht(_this59,"ratio",0.8);ht(_this59,"tmpPoints",[]);ht(_this59,"workOptions");ht(_this59,"oldRect");ht(_this59,"syncTimestamp");_this59.workOptions=e.toolsOpt,_this59.syncTimestamp=0,_this59.syncUnitTime=50;return _this59;}_inherits(uT,_Gt0);return _createClass(uT,[{key:"consume",value:function consume(e){var M;var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=(M=n==null?void 0:n.workId)==null?void 0:M.toString();if(!h)return{type:It.None};var v=n.op,p=v==null?void 0:v.length;if(!p||p<2)return{type:It.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:It.None};var C;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;C=this.draw({workId:h,layer:L,isDrawing:!0});}if(u){var _L10=Kt(C,this.oldRect);this.oldRect=C;var X=_objectSpread({rect:_L10,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L11=Date.now();return _L11-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L11,_objectSpread({type:It.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:It.None};}var b=Kt(C,this.oldRect);return this.oldRect=C,_objectSpread({rect:b,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:It.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:It.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,_e$isDrawEraserlines5=e.isDrawEraserlines,s=_e$isDrawEraserlines5===void 0?!0:_e$isDrawEraserlines5,_this$workOptions10=this.workOptions,o=_this$workOptions10.strokeColor,a=_this$workOptions10.fillColor,u=_this$workOptions10.thickness,h=_this$workOptions10.zIndex,v=_this$workOptions10.placement,p=_this$workOptions10.scale,y=_this$workOptions10.rotate,C=_this$workOptions10.translate,b=_this$workOptions10.strokeType,M=_this$workOptions10.eraserlines,L=_this$workOptions10.eraserFaces,X=_this$workOptions10.doingLines,Y=_this$workOptions10.lineDash,et=_this$workOptions10.lineCap,_this$computDrawPoint8=this.computDrawPoints(u,v),A=_this$computDrawPoint8.rect,w=_this$computDrawPoint8.pos,S=_this$computDrawPoint8.points,x={points:S.map(function(j){return j.XY;}),lineWidth:u,fillColor:a!=="transparent"&&a||void 0,strokeColor:o,normalize:!0,className:"".concat(w[0],",").concat(w[1]),close:!0,lineCap:et,lineDash:b===Ne.Dotted?[Y&&Y[0]||1,(Y&&Y[1]||2)*u]:b===Ne.LongDotted?[(Y&&Y[0]||1)*u,(Y&&Y[1]||2)*u]:void 0},P={name:n,id:n,zIndex:h,pos:w,anchor:[0.5,0.5],size:[A.w,A.h]};p&&(P.scale=p),y&&(P.rotate=y),C&&(P.translate=C);var z=new nr(P),U=new zn(_objectSpread(_objectSpread({},x),{},{pos:[0,0]}));z.append(U),(M||L||X)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:z,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:L,pos:w,layer:i},s)),this.replace(i,n,z);var K=z.getBoundingClientRect();return this.isDelete&&z.setAttribute("opacity",0),{x:Math.floor(K.x-Gt.SafeBorderPadding),y:Math.floor(K.y-Gt.SafeBorderPadding),w:Math.floor(K.width+Gt.SafeBorderPadding*2),h:Math.floor(K.height+Gt.SafeBorderPadding*2)};}},{key:"transformControlPoints",value:function transformControlPoints(e){var n=Ye(this.tmpPoints);switch(e){case"bottom":case"bottomLeft":case"bottomRight":{var i=n.y+n.h*this.ratio;return[new xt(n.x,n.y,0),new xt(n.x+n.w,n.y,0),new xt(n.x+n.w,i,0),new xt(n.x,i,0)];}case"top":case"topLeft":case"topRight":{var _i4=n.y+n.h*(1-this.ratio);return[new xt(n.x,_i4,0),new xt(n.x+n.w,_i4,0),new xt(n.x+n.w,n.y+n.h,0),new xt(n.x,n.y+n.h,0)];}case"left":case"leftBottom":case"leftTop":{var _i5=n.x+n.w*(1-this.ratio);return[new xt(_i5,n.y,0),new xt(n.x+n.w,n.y,0),new xt(n.x+n.w,n.y+n.h,0),new xt(_i5,n.y+n.h,0)];}case"right":case"rightBottom":case"rightTop":{var _i6=n.x+n.w*this.ratio;return[new xt(n.x,n.y,0),new xt(_i6,n.y,0),new xt(_i6,n.y+n.h,0),new xt(n.x,n.y+n.h,0)];}}}},{key:"computDrawPoints",value:function computDrawPoints(e,n){var i=Ye(this.tmpPoints),s=this.transformControlPoints(n),o=Math.floor(i.w*0.1),a=Math.floor(i.h*0.1),u=[],h=xt.Add(s[0],new xt(0,a,0)),v=xt.Add(s[0],new xt(o,0,0)),p=kn.getBezierPoints(10,h,s[0],v),y=xt.Sub(s[1],new xt(o,0,0)),C=xt.Add(s[1],new xt(0,a,0)),b=kn.getBezierPoints(10,y,s[1],C),M=xt.Sub(s[2],new xt(0,a,0)),L=xt.Sub(s[2],new xt(o,0,0)),X=kn.getBezierPoints(10,M,s[2],L),Y=xt.Add(s[3],new xt(o,0,0)),et=xt.Sub(s[3],new xt(0,a,0)),A=kn.getBezierPoints(10,Y,s[3],et),w=o*(1-this.ratio)*10,S=a*(1-this.ratio)*10;switch(n){case"bottom":{var z=xt.Sub(s[2],new xt(o*5-w/2,0,0)),U=xt.Sub(s[2],new xt(o*5,-S,0)),K=xt.Sub(s[2],new xt(o*5+w/2,0,0));u.push.apply(u,[U,K].concat(_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),[z]));break;}case"bottomRight":{var _z6=xt.Sub(s[2],new xt(o*1.1,0,0)),_U4=xt.Sub(s[2],new xt(o*1.1+w/2,-S,0)),_K5=xt.Sub(s[2],new xt(o*1.1+w,0,0));u.push.apply(u,[_U4,_K5].concat(_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),[_z6]));break;}case"bottomLeft":{var _z7=xt.Add(s[3],new xt(o*1.1+w,0,0)),_U5=xt.Add(s[3],new xt(o*1.1+w/2,S,0)),_K6=xt.Add(s[3],new xt(o*1.1,0,0));u.push.apply(u,[_U5,_K6].concat(_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),[_z7]));break;}case"top":{var _z8=xt.Sub(s[1],new xt(o*5-w/2,0,0)),_U6=xt.Sub(s[1],new xt(o*5,S,0)),_K7=xt.Sub(s[1],new xt(o*5+w/2,0,0));u.push.apply(u,[_U6,_z8].concat(_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),[_K7]));break;}case"topRight":{var _z9=xt.Sub(s[1],new xt(o*1.1,0,0)),_U7=xt.Sub(s[1],new xt(o*1.1+w/2,S,0)),_K8=xt.Sub(s[1],new xt(o*1.1+w,0,0));u.push.apply(u,[_U7,_z9].concat(_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),[_K8]));break;}case"topLeft":{var _z0=xt.Add(s[0],new xt(o*1.1+w,0,0)),_U8=xt.Add(s[0],new xt(o*1.1+w/2,-S,0)),_K9=xt.Add(s[0],new xt(o*1.1,0,0));u.push.apply(u,[_U8,_z0].concat(_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),[_K9]));break;}case"left":{var _z1=xt.Add(s[0],new xt(0,a*5-S/2,0)),_U9=xt.Add(s[0],new xt(-w,a*5,0)),_K0=xt.Add(s[0],new xt(0,a*5+S/2,0));u.push.apply(u,[_U9,_z1].concat(_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),[_K0]));break;}case"leftTop":{var _z10=xt.Add(s[0],new xt(0,a*1.1,0)),_U0=xt.Add(s[0],new xt(-w,a*1.1+S/2,0)),_K1=xt.Add(s[0],new xt(0,a*1.1+S,0));u.push.apply(u,[_U0,_z10].concat(_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),[_K1]));break;}case"leftBottom":{var _z11=xt.Sub(s[3],new xt(0,a*1.1+S,0)),_U1=xt.Sub(s[3],new xt(w,a*1.1+S/2,0)),_K10=xt.Sub(s[3],new xt(0,a*1.1,0));u.push.apply(u,[_U1,_z11].concat(_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),[_K10]));break;}case"right":{var _z12=xt.Add(s[1],new xt(0,a*5-S/2,0)),_U10=xt.Add(s[1],new xt(w,a*5,0)),_K11=xt.Add(s[1],new xt(0,a*5+S/2,0));u.push.apply(u,[_U10,_K11].concat(_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),[_z12]));break;}case"rightTop":{var _z13=xt.Add(s[1],new xt(0,a*1.1,0)),_U11=xt.Add(s[1],new xt(w,a*1.1+S/2,0)),_K12=xt.Add(s[1],new xt(0,a*1.1+S,0));u.push.apply(u,[_U11,_K12].concat(_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),[_z13]));break;}case"rightBottom":{var _z14=xt.Sub(s[2],new xt(0,a*1.1+S,0)),_U12=xt.Sub(s[2],new xt(-w,a*1.1+S/2,0)),_K13=xt.Sub(s[2],new xt(0,a*1.1,0));u.push.apply(u,[_U12,_K13].concat(_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),[_z14]));break;}}var x=Ye(this.tmpPoints,e),P=[Math.floor(x.x+x.w/2),Math.floor(x.y+x.h/2)];return{rect:x,pos:P,points:u};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o)||_t.Sub(s,i).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState7=e.workState,s=_e$workState7===void 0?te.Done:_e$workState7,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var b;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.toolsType,h=i.placement,v=i.strokeType,p=s.get(n.name),y=p==null?void 0:p.opt;var C=n;return n.tagName==="GROUP"&&(C=n.children[0]),o&&(C.setAttribute("strokeColor",o),y!=null&&y.strokeColor&&(y.strokeColor=o)),a&&(a==="transparent"?C.setAttribute("fillColor","rgba(0,0,0,0)"):C.setAttribute("fillColor",a),y!=null&&y.fillColor&&(y.fillColor=a)),u===St.SpeechBalloon&&h&&(y.placement=h),v&&p!=null&&p.opt&&(b=p.opt)!=null&&b.strokeType&&(p.opt.strokeType=v),p&&s.setInfo(n.name,_objectSpread(_objectSpread({},p),{},{opt:y})),Gt.updateNodeOpt(e);}}]);}(Gt);var ZPt=Xo,qPt=Mi,KPt="[object Boolean]";function QPt(r){return r===!0||r===!1||qPt(r)&&ZPt(r)==KPt;}var JPt=QPt;var Rs=/* @__PURE__ */$n(JPt);var Qa=/*#__PURE__*/function(_Gt1){function Qa(e){var _this60;_classCallCheck(this,Qa);_this60=_callSuper(this,Qa,[e]);ht(_this60,"canRotate",!0);ht(_this60,"scaleType",Ae.all);ht(_this60,"toolsType",St.Image);ht(_this60,"tmpPoints",[]);ht(_this60,"workOptions");ht(_this60,"oldRect");_this60.workOptions=e.toolsOpt,_this60.scaleType=Qa.getScaleType(_this60.workOptions);return _this60;}_inherits(Qa,_Gt1);return _createClass(Qa,[{key:"consume",value:function consume(){return{type:It.None};}},{key:"consumeAll",value:function consumeAll(){return{type:It.None};}},{key:"draw",value:function draw(e){var n=e.layer,i=e.workId,s=e.replaceId,o=e.imageBitmap,_this$workOptions11=this.workOptions,a=_this$workOptions11.centerX,u=_this$workOptions11.centerY,h=_this$workOptions11.width,v=_this$workOptions11.height,p=_this$workOptions11.rotate,y=_this$workOptions11.zIndex,C=_this$workOptions11.eraserlines,b=_this$workOptions11.eraserFaces,M=_this$workOptions11.doingLines,L=new nr({anchor:[0.5,0.5],pos:[a,u],name:i,size:[h,v],zIndex:y,rotate:p}),X={anchor:[0.5,0.5],pos:[0,0],size:[h,v],texture:o};o||(X.bgcolor="rgba(0,0,0,0.3)");var Y=new af(X);L.append(Y),(C||b||M)&&this.drawEraserlines({group:L,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:b,pos:[a,u],layer:n}),this.replace(n,s||i,L);var et=L.getBoundingClientRect();if(et)return{x:Math.floor(et.x-Gt.SafeBorderPadding),y:Math.floor(et.y-Gt.SafeBorderPadding),w:Math.floor(et.width+Gt.SafeBorderPadding*2),h:Math.floor(et.height+Gt.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(){}},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(e){var p,y,C,b,n,i,s,o,_this$workOptions12,a,u,h,v,M,L;return _regenerator().w(function(_context15){while(1)switch(_context15.n){case 0:n=e.isFullWork,i=e.replaceId,s=e.worker,o=e.requestId,_this$workOptions12=this.workOptions,a=_this$workOptions12.src,u=_this$workOptions12.uuid,h=((p=this.workId)==null?void 0:p.toString())||u,v=n?this.fullLayer:this.drawLayer||this.fullLayer;if(!a){_context15.n=2;break;}_context15.n=1;return s.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:h,requestId:o,isSubWorker:s instanceof TMt});case 1:M=_context15.v;if(!M){_context15.n=2;break;}L=this.draw({workId:h,layer:v,replaceId:i,imageBitmap:M});return _context15.a(2,(this.oldRect=h&&((C=(y=this.vNodes)==null?void 0:y.get(h))==null?void 0:C.rect)||void 0,(b=this.vNodes)==null||b.setInfo(h,{rect:L,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:L&&Gt.getCenterPos(L,v)}),L));case 2:return _context15.a(2);}},_callee14,this);}));function consumeServiceAsync(_x28){return _consumeServiceAsync.apply(this,arguments);}return consumeServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return Gt.normalizeStorageData(e);}},{key:"getScaleType",value:function getScaleType(e){var n=e.uniformScale,i=e.rotate;return n!==!1||i&&Math.abs(i)%90>0?Ae.proportional:Ae.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var n=e.node,i=e.opt,s=e.vNodes,o=e.targetNode,a=i.translate,u=i.originPoint,h=i.scenePoint,v=i.scale,p=i.angle,y=i.isLocked,C=i.zIndex,b=i.strokeColor,M=o&&gr(o)||s.get(n.name);if(!M)return;var L=n.parent;if(L){if(b&&(M.opt.strokeColor=b),$e(C)&&(n.setAttribute("zIndex",C),M.opt.zIndex=C),Rs(y)&&(M.opt.locked=y),u&&h&&v&&a){var _M$opt=M.opt,X=_M$opt.centerX,Y=_M$opt.centerY,et=_M$opt.width,A=_M$opt.height,w=_M$opt.uniformScale,S=w!==!1?[v[0],v[0]]:v,x=[X,Y],P=[X,Y];yf(P,h,S,a);var z=[P[0]-x[0],P[1]-x[1]];if(M.centerPos=[M.centerPos[0]+z[0],M.centerPos[1]+z[1]],M.opt.width=Math.round(et*S[0]),M.opt.height=Math.round(A*S[1]),M.opt.centerX=P[0],M.opt.centerY=P[1],M.opt.eraserlines){var _iterator44=_createForOfIteratorHelper(M.opt.eraserlines),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var U=_step44.value;var K=U.op,j=U.thickness;U.thickness=Math.round(j*Math.max(v[0],v[1]));for(var nt=0;nt<K.length;nt++)ja(K[nt],h,v,a);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}}else if(a){if(M.opt.centerX=M.opt.centerX+a[0],M.opt.centerY=M.opt.centerY+a[1],M.centerPos=[M.centerPos[0]+a[0],M.centerPos[1]+a[1]],M.opt.eraserlines){var _iterator45=_createForOfIteratorHelper(M.opt.eraserlines),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _X2=_step45.value;var _Y2=_X2.op;for(var _et2=0;_et2<_Y2.length;_et2++){var _A5=_Y2[_et2].map(function(w,S){return S%2?w+a[1]:w+a[0];});_X2.op[_et2]=_A5;}}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}}}else if($e(p))if(M.opt.rotate=p,M.scaleType=Qa.getScaleType(M.opt),o){var _X3=Uv(M.rect,p);M.rect=_X3;}else{var _X4=Gt.getRectFromLayer(L,n.name);M.rect=_X4||M.rect;}return M&&s.setInfo(n.name,M),M==null?void 0:M.rect;}}}]);}(Gt);var fT=/*#__PURE__*/function(_Gt10){function fT(e){var _this61;_classCallCheck(this,fT);_this61=_callSuper(this,fT,[e]);ht(_this61,"canRotate",!1);ht(_this61,"scaleType",Ae.both);ht(_this61,"toolsType",St.Straight);ht(_this61,"tmpPoints",[]);ht(_this61,"workOptions");ht(_this61,"oldRect");ht(_this61,"straightTipWidth");ht(_this61,"syncTimestamp");_this61.workOptions=e.toolsOpt,_this61.straightTipWidth=_this61.workOptions.thickness/2,_this61.syncTimestamp=0,_this61.syncUnitTime=50;return _this61;}_inherits(fT,_Gt10);return _createClass(fT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime,y=v==null?void 0:v.length;if(!y||y<2)return{type:It.None};p&&(this.syncUnitTime=p);var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:It.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:L});}if(u){var _L12=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L12,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L13=Date.now();return _L13-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L13,_objectSpread({type:It.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:It.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:It.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:It.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:It.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,_e$isDrawEraserlines6=e.isDrawEraserlines,s=_e$isDrawEraserlines6===void 0?!0:_e$isDrawEraserlines6,_this$workOptions13=this.workOptions,o=_this$workOptions13.strokeColor,a=_this$workOptions13.thickness,u=_this$workOptions13.zIndex,h=_this$workOptions13.scale,v=_this$workOptions13.rotate,p=_this$workOptions13.translate,y=_this$workOptions13.strokeType,C=_this$workOptions13.eraserlines,b=_this$workOptions13.eraserFaces,M=_this$workOptions13.doingLines,L=_this$workOptions13.lineCap,X=_this$workOptions13.lineDash,Y=i.worldPosition,et=i.worldScaling,_this$computDrawPoint9=this.computDrawPoints(a,y),A=_this$computDrawPoint9.d,w=_this$computDrawPoint9.rect,S=_this$computDrawPoint9.isDot,x=[w.x+w.w/2,w.y+w.h/2],P=new nr({pos:x,anchor:[0.5,0.5],size:[w.w,w.h],name:n,id:n,normalize:!0,zIndex:u}),z={pos:[0,0],normalize:!0,d:A,fillColor:o,strokeColor:o,lineDash:S?void 0:y===Ne.Dotted?[X&&X[0]||1,(X&&X[1]||2)*a]:y===Ne.LongDotted?[(X&&X[0]||1)*a,(X&&X[1]||2)*a]:void 0,lineCap:S?void 0:L,lineWidth:y===Ne.Normal||S?0:a};h&&(z.scale=h),v&&(z.rotate=v),p&&(z.translate=p);var U=new $r(z);P.append(U),(C||b||M)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:P,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:b,pos:x,layer:i},s)),this.replace(i,n,P);var K={x:Math.floor(w.x*et[0]+Y[0]-Gt.SafeBorderPadding),y:Math.floor(w.y*et[1]+Y[1]-Gt.SafeBorderPadding),w:Math.floor(w.w*et[0]+2*Gt.SafeBorderPadding),h:Math.floor(w.h*et[1]+2*Gt.SafeBorderPadding)};if(v||h||p){var j=U.getBoundingClientRect();K={x:Math.floor(j.x-Gt.SafeBorderPadding),y:Math.floor(j.y-Gt.SafeBorderPadding),w:Math.floor(j.width+Gt.SafeBorderPadding*2),h:Math.floor(j.height+Gt.SafeBorderPadding*2)};}return this.isDelete&&P.setAttribute("opacity",0),K;}},{key:"computDrawPoints",value:function computDrawPoints(e,n){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(e,n):this.computDotPoints(e);}},{key:"computFullPoints",value:function computFullPoints(e,n){var i=xt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),s=xt.Per(i).mul(e/2),o=_t.Sub(this.tmpPoints[0],s),a=_t.Add(this.tmpPoints[0],s),u=_t.Sub(this.tmpPoints[1],s),h=_t.Add(this.tmpPoints[1],s),v=_t.GetSemicircleStroke(this.tmpPoints[1],u,-1,8),p=_t.GetSemicircleStroke(this.tmpPoints[0],a,-1,8),y=[o,u].concat(_toConsumableArray(v),[h,a],_toConsumableArray(p));var C;return n!==Ne.Normal?C=Jn(this.tmpPoints,!1):C=Jn(y,!0),{d:C,rect:Ye(y),isDot:!1,pos:this.tmpPoints[0].XY};}},{key:"computDotPoints",value:function computDotPoints(e){var n=_t.GetDotStroke(this.tmpPoints[0],e/2,8);return{d:Jn(n,!0),rect:Ye(n),isDot:!0,pos:this.tmpPoints[0].XY};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState8=e.workState,s=_e$workState8===void 0?te.Done:_e$workState8,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var h,v;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.strokeType,u=s.get(n.name);return o&&(n.tagName==="GROUP"?n.children.forEach(function(p){p.setAttribute("strokeColor",o),p.getAttribute("fillColor")&&p.setAttribute("fillColor",o);}):(n.setAttribute("strokeColor",o),n.setAttribute("fillColor",o)),(h=u==null?void 0:u.opt)!=null&&h.strokeColor&&(u.opt.strokeColor=o)),a&&u!=null&&u.opt&&(v=u.opt)!=null&&v.strokeType&&(u.opt.strokeType=a),u&&s.setInfo(n.name,u),Gt.updateNodeOpt(e);}}]);}(Gt);var Lo="cursorhover",k1=20,Bs="mainView",Bv=500,_Pt=Bv;var B1={exports:{}},tr={},Cp={exports:{}},qs={};function hT(){var r={};return r["align-content"]=!1,r["align-items"]=!1,r["align-self"]=!1,r["alignment-adjust"]=!1,r["alignment-baseline"]=!1,r.all=!1,r["anchor-point"]=!1,r.animation=!1,r["animation-delay"]=!1,r["animation-direction"]=!1,r["animation-duration"]=!1,r["animation-fill-mode"]=!1,r["animation-iteration-count"]=!1,r["animation-name"]=!1,r["animation-play-state"]=!1,r["animation-timing-function"]=!1,r.azimuth=!1,r["backface-visibility"]=!1,r.background=!0,r["background-attachment"]=!0,r["background-clip"]=!0,r["background-color"]=!0,r["background-image"]=!0,r["background-origin"]=!0,r["background-position"]=!0,r["background-repeat"]=!0,r["background-size"]=!0,r["baseline-shift"]=!1,r.binding=!1,r.bleed=!1,r["bookmark-label"]=!1,r["bookmark-level"]=!1,r["bookmark-state"]=!1,r.border=!0,r["border-bottom"]=!0,r["border-bottom-color"]=!0,r["border-bottom-left-radius"]=!0,r["border-bottom-right-radius"]=!0,r["border-bottom-style"]=!0,r["border-bottom-width"]=!0,r["border-collapse"]=!0,r["border-color"]=!0,r["border-image"]=!0,r["border-image-outset"]=!0,r["border-image-repeat"]=!0,r["border-image-slice"]=!0,r["border-image-source"]=!0,r["border-image-width"]=!0,r["border-left"]=!0,r["border-left-color"]=!0,r["border-left-style"]=!0,r["border-left-width"]=!0,r["border-radius"]=!0,r["border-right"]=!0,r["border-right-color"]=!0,r["border-right-style"]=!0,r["border-right-width"]=!0,r["border-spacing"]=!0,r["border-style"]=!0,r["border-top"]=!0,r["border-top-color"]=!0,r["border-top-left-radius"]=!0,r["border-top-right-radius"]=!0,r["border-top-style"]=!0,r["border-top-width"]=!0,r["border-width"]=!0,r.bottom=!1,r["box-decoration-break"]=!0,r["box-shadow"]=!0,r["box-sizing"]=!0,r["box-snap"]=!0,r["box-suppress"]=!0,r["break-after"]=!0,r["break-before"]=!0,r["break-inside"]=!0,r["caption-side"]=!1,r.chains=!1,r.clear=!0,r.clip=!1,r["clip-path"]=!1,r["clip-rule"]=!1,r.color=!0,r["color-interpolation-filters"]=!0,r["column-count"]=!1,r["column-fill"]=!1,r["column-gap"]=!1,r["column-rule"]=!1,r["column-rule-color"]=!1,r["column-rule-style"]=!1,r["column-rule-width"]=!1,r["column-span"]=!1,r["column-width"]=!1,r.columns=!1,r.contain=!1,r.content=!1,r["counter-increment"]=!1,r["counter-reset"]=!1,r["counter-set"]=!1,r.crop=!1,r.cue=!1,r["cue-after"]=!1,r["cue-before"]=!1,r.cursor=!1,r.direction=!1,r.display=!0,r["display-inside"]=!0,r["display-list"]=!0,r["display-outside"]=!0,r["dominant-baseline"]=!1,r.elevation=!1,r["empty-cells"]=!1,r.filter=!1,r.flex=!1,r["flex-basis"]=!1,r["flex-direction"]=!1,r["flex-flow"]=!1,r["flex-grow"]=!1,r["flex-shrink"]=!1,r["flex-wrap"]=!1,r.float=!1,r["float-offset"]=!1,r["flood-color"]=!1,r["flood-opacity"]=!1,r["flow-from"]=!1,r["flow-into"]=!1,r.font=!0,r["font-family"]=!0,r["font-feature-settings"]=!0,r["font-kerning"]=!0,r["font-language-override"]=!0,r["font-size"]=!0,r["font-size-adjust"]=!0,r["font-stretch"]=!0,r["font-style"]=!0,r["font-synthesis"]=!0,r["font-variant"]=!0,r["font-variant-alternates"]=!0,r["font-variant-caps"]=!0,r["font-variant-east-asian"]=!0,r["font-variant-ligatures"]=!0,r["font-variant-numeric"]=!0,r["font-variant-position"]=!0,r["font-weight"]=!0,r.grid=!1,r["grid-area"]=!1,r["grid-auto-columns"]=!1,r["grid-auto-flow"]=!1,r["grid-auto-rows"]=!1,r["grid-column"]=!1,r["grid-column-end"]=!1,r["grid-column-start"]=!1,r["grid-row"]=!1,r["grid-row-end"]=!1,r["grid-row-start"]=!1,r["grid-template"]=!1,r["grid-template-areas"]=!1,r["grid-template-columns"]=!1,r["grid-template-rows"]=!1,r["hanging-punctuation"]=!1,r.height=!0,r.hyphens=!1,r.icon=!1,r["image-orientation"]=!1,r["image-resolution"]=!1,r["ime-mode"]=!1,r["initial-letters"]=!1,r["inline-box-align"]=!1,r["justify-content"]=!1,r["justify-items"]=!1,r["justify-self"]=!1,r.left=!1,r["letter-spacing"]=!0,r["lighting-color"]=!0,r["line-box-contain"]=!1,r["line-break"]=!1,r["line-grid"]=!1,r["line-height"]=!1,r["line-snap"]=!1,r["line-stacking"]=!1,r["line-stacking-ruby"]=!1,r["line-stacking-shift"]=!1,r["line-stacking-strategy"]=!1,r["list-style"]=!0,r["list-style-image"]=!0,r["list-style-position"]=!0,r["list-style-type"]=!0,r.margin=!0,r["margin-bottom"]=!0,r["margin-left"]=!0,r["margin-right"]=!0,r["margin-top"]=!0,r["marker-offset"]=!1,r["marker-side"]=!1,r.marks=!1,r.mask=!1,r["mask-box"]=!1,r["mask-box-outset"]=!1,r["mask-box-repeat"]=!1,r["mask-box-slice"]=!1,r["mask-box-source"]=!1,r["mask-box-width"]=!1,r["mask-clip"]=!1,r["mask-image"]=!1,r["mask-origin"]=!1,r["mask-position"]=!1,r["mask-repeat"]=!1,r["mask-size"]=!1,r["mask-source-type"]=!1,r["mask-type"]=!1,r["max-height"]=!0,r["max-lines"]=!1,r["max-width"]=!0,r["min-height"]=!0,r["min-width"]=!0,r["move-to"]=!1,r["nav-down"]=!1,r["nav-index"]=!1,r["nav-left"]=!1,r["nav-right"]=!1,r["nav-up"]=!1,r["object-fit"]=!1,r["object-position"]=!1,r.opacity=!1,r.order=!1,r.orphans=!1,r.outline=!1,r["outline-color"]=!1,r["outline-offset"]=!1,r["outline-style"]=!1,r["outline-width"]=!1,r.overflow=!1,r["overflow-wrap"]=!1,r["overflow-x"]=!1,r["overflow-y"]=!1,r.padding=!0,r["padding-bottom"]=!0,r["padding-left"]=!0,r["padding-right"]=!0,r["padding-top"]=!0,r.page=!1,r["page-break-after"]=!1,r["page-break-before"]=!1,r["page-break-inside"]=!1,r["page-policy"]=!1,r.pause=!1,r["pause-after"]=!1,r["pause-before"]=!1,r.perspective=!1,r["perspective-origin"]=!1,r.pitch=!1,r["pitch-range"]=!1,r["play-during"]=!1,r.position=!1,r["presentation-level"]=!1,r.quotes=!1,r["region-fragment"]=!1,r.resize=!1,r.rest=!1,r["rest-after"]=!1,r["rest-before"]=!1,r.richness=!1,r.right=!1,r.rotation=!1,r["rotation-point"]=!1,r["ruby-align"]=!1,r["ruby-merge"]=!1,r["ruby-position"]=!1,r["shape-image-threshold"]=!1,r["shape-outside"]=!1,r["shape-margin"]=!1,r.size=!1,r.speak=!1,r["speak-as"]=!1,r["speak-header"]=!1,r["speak-numeral"]=!1,r["speak-punctuation"]=!1,r["speech-rate"]=!1,r.stress=!1,r["string-set"]=!1,r["tab-size"]=!1,r["table-layout"]=!1,r["text-align"]=!0,r["text-align-last"]=!0,r["text-combine-upright"]=!0,r["text-decoration"]=!0,r["text-decoration-color"]=!0,r["text-decoration-line"]=!0,r["text-decoration-skip"]=!0,r["text-decoration-style"]=!0,r["text-emphasis"]=!0,r["text-emphasis-color"]=!0,r["text-emphasis-position"]=!0,r["text-emphasis-style"]=!0,r["text-height"]=!0,r["text-indent"]=!0,r["text-justify"]=!0,r["text-orientation"]=!0,r["text-overflow"]=!0,r["text-shadow"]=!0,r["text-space-collapse"]=!0,r["text-transform"]=!0,r["text-underline-position"]=!0,r["text-wrap"]=!0,r.top=!1,r.transform=!1,r["transform-origin"]=!1,r["transform-style"]=!1,r.transition=!1,r["transition-delay"]=!1,r["transition-duration"]=!1,r["transition-property"]=!1,r["transition-timing-function"]=!1,r["unicode-bidi"]=!1,r["vertical-align"]=!1,r.visibility=!1,r["voice-balance"]=!1,r["voice-duration"]=!1,r["voice-family"]=!1,r["voice-pitch"]=!1,r["voice-range"]=!1,r["voice-rate"]=!1,r["voice-stress"]=!1,r["voice-volume"]=!1,r.volume=!1,r["white-space"]=!1,r.widows=!1,r.width=!0,r["will-change"]=!1,r["word-break"]=!0,r["word-spacing"]=!0,r["word-wrap"]=!0,r["wrap-flow"]=!1,r["wrap-through"]=!1,r["writing-mode"]=!1,r["z-index"]=!1,r;}function tbt(r,t,e){}function ebt(r,t,e){}var rbt=/javascript\s*\:/img;function nbt(r,t){return rbt.test(t)?"":t;}qs.whiteList=hT();qs.getDefaultWhiteList=hT;qs.onAttr=tbt;qs.onIgnoreAttr=ebt;qs.safeAttrValue=nbt;var ibt={indexOf:function indexOf(r,t){var e,n;if(Array.prototype.indexOf)return r.indexOf(t);for(e=0,n=r.length;e<n;e++)if(r[e]===t)return e;return-1;},forEach:function forEach(r,t,e){var n,i;if(Array.prototype.forEach)return r.forEach(t,e);for(n=0,i=r.length;n<i;n++)t.call(e,r[n],n,r);},trim:function trim(r){return String.prototype.trim?r.trim():r.replace(/(^\s*)|(\s*$)/g,"");},trimRight:function trimRight(r){return String.prototype.trimRight?r.trimRight():r.replace(/(\s*$)/g,"");}},Da=ibt;function sbt(r,t){r=Da.trimRight(r),r[r.length-1]!==";"&&(r+=";");var e=r.length,n=!1,i=0,s=0,o="";function a(){if(!n){var v=Da.trim(r.slice(i,s)),p=v.indexOf(":");if(p!==-1){var y=Da.trim(v.slice(0,p)),C=Da.trim(v.slice(p+1));if(y){var b=t(i,o.length,y,C,v);b&&(o+=b+"; ");}}}i=s+1;}for(;s<e;s++){var u=r[s];if(u==="/"&&r[s+1]==="*"){var h=r.indexOf("*/",s+2);if(h===-1)break;s=h+1,i=s+1,n=!1;}else u==="("?n=!0:u===")"?n=!1:u===";"?n||a():u==="\n"&&a();}return Da.trim(o);}var obt=sbt,Gc=qs,abt=obt;function F1(r){return r==null;}function lbt(r){var t={};for(var e in r)t[e]=r[e];return t;}function dT(r){r=lbt(r||{}),r.whiteList=r.whiteList||Gc.whiteList,r.onAttr=r.onAttr||Gc.onAttr,r.onIgnoreAttr=r.onIgnoreAttr||Gc.onIgnoreAttr,r.safeAttrValue=r.safeAttrValue||Gc.safeAttrValue,this.options=r;}dT.prototype.process=function(r){if(r=r||"",r=r.toString(),!r)return"";var t=this,e=t.options,n=e.whiteList,i=e.onAttr,s=e.onIgnoreAttr,o=e.safeAttrValue,a=abt(r,function(u,h,v,p,y){var C=n[v],b=!1;if(C===!0?b=C:typeof C=="function"?b=C(p):C instanceof RegExp&&(b=C.test(p)),b!==!0&&(b=!1),p=o(v,p),!!p){var M={position:h,sourcePosition:u,source:y,isWhite:b};if(b){var L=i(v,p,M);return F1(L)?v+":"+p:L;}else{var L=s(v,p,M);if(!F1(L))return L;}}});return a;};var cbt=dT;(function(r,t){var e=qs,n=cbt;function i(o,a){var u=new n(a);return u.process(o);}t=r.exports=i,t.FilterCSS=n;for(var s in e)t[s]=e[s];(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterCSS=r.exports);})(Cp,Cp.exports);var Fv=Cp.exports,Wv={indexOf:function indexOf(r,t){var e,n;if(Array.prototype.indexOf)return r.indexOf(t);for(e=0,n=r.length;e<n;e++)if(r[e]===t)return e;return-1;},forEach:function forEach(r,t,e){var n,i;if(Array.prototype.forEach)return r.forEach(t,e);for(n=0,i=r.length;n<i;n++)t.call(e,r[n],n,r);},trim:function trim(r){return String.prototype.trim?r.trim():r.replace(/(^\s*)|(\s*$)/g,"");},spaceIndex:function spaceIndex(r){var t=/\s|\n|\t/,e=t.exec(r);return e?e.index:-1;}},ubt=Fv.FilterCSS,fbt=Fv.getDefaultWhiteList,Tu=Wv;function pT(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]};}var vT=new ubt();function hbt(r,t,e){}function dbt(r,t,e){}function pbt(r,t,e){}function vbt(r,t,e){}function gT(r){return r.replace(mbt,"<").replace(ybt,">");}function gbt(r,t,e,n){if(e=IT(e),t==="href"||t==="src"){if(e=Tu.trim(e),e==="#")return"#";if(!(e.substr(0,7)==="http://"||e.substr(0,8)==="https://"||e.substr(0,7)==="mailto:"||e.substr(0,4)==="tel:"||e.substr(0,11)==="data:image/"||e.substr(0,6)==="ftp://"||e.substr(0,2)==="./"||e.substr(0,3)==="../"||e[0]==="#"||e[0]==="/"))return"";}else if(t==="background"){if(jc.lastIndex=0,jc.test(e))return"";}else if(t==="style"){if(W1.lastIndex=0,W1.test(e)||(U1.lastIndex=0,U1.test(e)&&(jc.lastIndex=0,jc.test(e))))return"";n!==!1&&(n=n||vT,e=n.process(e));}return e=CT(e),e;}var mbt=/</g,ybt=/>/g,wbt=/"/g,Sbt=/"/g,Tbt=/&#([a-zA-Z0-9]*);?/gim,Ibt=/:?/gim,Cbt=/&newline;?/gim,jc=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,W1=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,U1=/u\s*r\s*l\s*\(.*/gi;function mT(r){return r.replace(wbt,""");}function yT(r){return r.replace(Sbt,'"');}function wT(r){return r.replace(Tbt,function(e,n){return n[0]==="x"||n[0]==="X"?String.fromCharCode(parseInt(n.substr(1),16)):String.fromCharCode(parseInt(n,10));});}function ST(r){return r.replace(Ibt,":").replace(Cbt," ");}function TT(r){for(var t="",e=0,n=r.length;e<n;e++)t+=r.charCodeAt(e)<32?" ":r.charAt(e);return Tu.trim(t);}function IT(r){return r=yT(r),r=wT(r),r=ST(r),r=TT(r),r;}function CT(r){return r=mT(r),r=gT(r),r;}function xbt(){return"";}function Pbt(r,t){typeof t!="function"&&(t=function t(){});var e=!Array.isArray(r);function n(o){return e?!0:Tu.indexOf(r,o)!==-1;}var i=[],s=!1;return{onIgnoreTag:function onIgnoreTag(o,a,u){if(n(o)){if(u.isClosing){var h="[/removed]",v=u.position+h.length;return i.push([s!==!1?s:u.position,v]),s=!1,h;}else return s||(s=u.position),"[removed]";}else return t(o,a,u);},remove:function remove(o){var a="",u=0;return Tu.forEach(i,function(h){a+=o.slice(u,h[0]),u=h[1];}),a+=o.slice(u),a;}};}function bbt(r){for(var t="",e=0;e<r.length;){var n=r.indexOf("<!--",e);if(n===-1){t+=r.slice(e);break;}t+=r.slice(e,n);var i=r.indexOf("-->",n);if(i===-1)break;e=i+3;}return t;}function Abt(r){var t=r.split("");return t=t.filter(function(e){var n=e.charCodeAt(0);return n===127?!1:n<=31?n===10||n===13:!0;}),t.join("");}tr.whiteList=pT();tr.getDefaultWhiteList=pT;tr.onTag=hbt;tr.onIgnoreTag=dbt;tr.onTagAttr=pbt;tr.onIgnoreTagAttr=vbt;tr.safeAttrValue=gbt;tr.escapeHtml=gT;tr.escapeQuote=mT;tr.unescapeQuote=yT;tr.escapeHtmlEntities=wT;tr.escapeDangerHtml5Entities=ST;tr.clearNonPrintableCharacter=TT;tr.friendlyAttrValue=IT;tr.escapeAttrValue=CT;tr.onIgnoreTagStripAll=xbt;tr.StripTagBody=Pbt;tr.stripCommentTag=bbt;tr.stripBlankChar=Abt;tr.attributeWrapSign='"';tr.cssFilter=vT;tr.getDefaultCSSWhiteList=fbt;var gf={},qi=Wv;function Ebt(r){var t=qi.spaceIndex(r),e;return t===-1?e=r.slice(1,-1):e=r.slice(1,t+1),e=qi.trim(e).toLowerCase(),e.slice(0,1)==="/"&&(e=e.slice(1)),e.slice(-1)==="/"&&(e=e.slice(0,-1)),e;}function Mbt(r){return r.slice(0,2)==="</";}function Lbt(r,t,e){var n="",i=0,s=!1,o=!1,a=0,u=r.length,h="",v="";t:for(a=0;a<u;a++){var p=r.charAt(a);if(s===!1){if(p==="<"){s=a;continue;}}else if(o===!1){if(p==="<"){n+=e(r.slice(i,a)),s=a,i=a;continue;}if(p===">"||a===u-1){n+=e(r.slice(i,s)),v=r.slice(s,a+1),h=Ebt(v),n+=t(s,n.length,h,v,Mbt(v)),i=a+1,s=!1;continue;}if(p==='"'||p==="'")for(var y=1,C=r.charAt(a-y);C.trim()===""||C==="=";){if(C==="="){o=p;continue t;}C=r.charAt(a-++y);}}else if(p===o){o=!1;continue;}}return i<u&&(n+=e(r.substr(i))),n;}var Rbt=/[^a-zA-Z0-9\\_:.-]/gim;function Obt(r,t){var e=0,n=0,i=[],s=!1,o=r.length;function a(y,C){if(y=qi.trim(y),y=y.replace(Rbt,"").toLowerCase(),!(y.length<1)){var b=t(y,C||"");b&&i.push(b);}}for(var u=0;u<o;u++){var h=r.charAt(u),v,p;if(s===!1&&h==="="){s=r.slice(e,u),e=u+1,n=r.charAt(e)==='"'||r.charAt(e)==="'"?e:Nbt(r,u+1);continue;}if(s!==!1&&u===n){if(p=r.indexOf(h,u+1),p===-1)break;v=qi.trim(r.slice(n+1,p)),a(s,v),s=!1,u=p,e=u+1;continue;}if(/\s|\n|\t/.test(h))if(r=r.replace(/\s|\n|\t/g," "),s===!1){if(p=Dbt(r,u),p===-1){v=qi.trim(r.slice(e,u)),a(v),s=!1,e=u+1;continue;}else{u=p-1;continue;}}else if(p=kbt(r,u-1),p===-1){v=qi.trim(r.slice(e,u)),v=z1(v),a(s,v),s=!1,e=u+1;continue;}else continue;}return e<r.length&&(s===!1?a(r.slice(e)):a(s,z1(qi.trim(r.slice(e))))),qi.trim(i.join(" "));}function Dbt(r,t){for(;t<r.length;t++){var e=r[t];if(e!==" ")return e==="="?t:-1;}}function Nbt(r,t){for(;t<r.length;t++){var e=r[t];if(e!==" ")return e==="'"||e==='"'?t:-1;}}function kbt(r,t){for(;t>0;t--){var e=r[t];if(e!==" ")return e==="="?t:-1;}}function Bbt(r){return r[0]==='"'&&r[r.length-1]==='"'||r[0]==="'"&&r[r.length-1]==="'";}function z1(r){return Bbt(r)?r.substr(1,r.length-2):r;}gf.parseTag=Lbt;gf.parseAttr=Obt;var Fbt=Fv.FilterCSS,xn=tr,xT=gf,Wbt=xT.parseTag,Ubt=xT.parseAttr,nu=Wv;function Xc(r){return r==null;}function zbt(r){var t=nu.spaceIndex(r);if(t===-1)return{html:"",closing:r[r.length-2]==="/"};r=nu.trim(r.slice(t+1,-1));var e=r[r.length-1]==="/";return e&&(r=nu.trim(r.slice(0,-1))),{html:r,closing:e};}function $bt(r){var t={};for(var e in r)t[e]=r[e];return t;}function Ybt(r){var t={};for(var e in r)Array.isArray(r[e])?t[e.toLowerCase()]=r[e].map(function(n){return n.toLowerCase();}):t[e.toLowerCase()]=r[e];return t;}function PT(r){r=$bt(r||{}),r.stripIgnoreTag&&(r.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),r.onIgnoreTag=xn.onIgnoreTagStripAll),r.whiteList||r.allowList?r.whiteList=Ybt(r.whiteList||r.allowList):r.whiteList=xn.whiteList,this.attributeWrapSign=r.singleQuotedAttributeValue===!0?"'":xn.attributeWrapSign,r.onTag=r.onTag||xn.onTag,r.onTagAttr=r.onTagAttr||xn.onTagAttr,r.onIgnoreTag=r.onIgnoreTag||xn.onIgnoreTag,r.onIgnoreTagAttr=r.onIgnoreTagAttr||xn.onIgnoreTagAttr,r.safeAttrValue=r.safeAttrValue||xn.safeAttrValue,r.escapeHtml=r.escapeHtml||xn.escapeHtml,this.options=r,r.css===!1?this.cssFilter=!1:(r.css=r.css||{},this.cssFilter=new Fbt(r.css));}PT.prototype.process=function(r){if(r=r||"",r=r.toString(),!r)return"";var t=this,e=t.options,n=e.whiteList,i=e.onTag,s=e.onIgnoreTag,o=e.onTagAttr,a=e.onIgnoreTagAttr,u=e.safeAttrValue,h=e.escapeHtml,v=t.attributeWrapSign,p=t.cssFilter;e.stripBlankChar&&(r=xn.stripBlankChar(r)),e.allowCommentTag||(r=xn.stripCommentTag(r));var y=!1;e.stripIgnoreTagBody&&(y=xn.StripTagBody(e.stripIgnoreTagBody,s),s=y.onIgnoreTag);var C=Wbt(r,function(b,M,L,X,Y){var et={sourcePosition:b,position:M,isClosing:Y,isWhite:Object.prototype.hasOwnProperty.call(n,L)},A=i(L,X,et);if(!Xc(A))return A;if(et.isWhite){if(et.isClosing)return"</"+L+">";var w=zbt(X),S=n[L],x=Ubt(w.html,function(P,z){var U=nu.indexOf(S,P)!==-1,K=o(L,P,z,U);return Xc(K)?U?(z=u(L,P,z,p),z?P+"="+v+z+v:P):(K=a(L,P,z,U),Xc(K)?void 0:K):K;});return X="<"+L,x&&(X+=" "+x),w.closing&&(X+=" /"),X+=">",X;}else return A=s(L,X,et),Xc(A)?h(X):A;},h);return y&&(C=y.remove(C)),C;};var Gbt=PT;(function(r,t){var e=tr,n=gf,i=Gbt;function s(a,u){var h=new i(u);return h.process(a);}t=r.exports=s,t.filterXSS=s,t.FilterXSS=i,function(){for(var a in e)t[a]=e[a];for(var u in n)t[u]=n[u];}(),(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterXSS=r.exports);function o(){return(typeof self==="undefined"?"undefined":_typeof(self))<"u"&&(typeof DedicatedWorkerGlobalScope==="undefined"?"undefined":_typeof(DedicatedWorkerGlobalScope))<"u"&&self instanceof DedicatedWorkerGlobalScope;}o()&&(self.filterXSS=r.exports);})(B1,B1.exports);var Iu={exports:{}};/**
|
|
439
|
+
*/},{key:"threeBezier",value:function threeBezier(t,e,n,i,s){var o=e.x*(1-t)*(1-t)*(1-t)+3*n.x*t*(1-t)*(1-t)+3*i.x*t*t*(1-t)+s.x*t*t*t,a=e.y*(1-t)*(1-t)*(1-t)+3*n.y*t*(1-t)*(1-t)+3*i.y*t*t*(1-t)+s.y*t*t*t;return new xt(o,a);}}]);}();var uT=/*#__PURE__*/function(_Gt0){function uT(e){var _this59;_classCallCheck(this,uT);_this59=_callSuper(this,uT,[e]);ht(_this59,"canRotate",!1);ht(_this59,"scaleType",Ae.all);ht(_this59,"toolsType",St.SpeechBalloon);ht(_this59,"ratio",0.8);ht(_this59,"tmpPoints",[]);ht(_this59,"workOptions");ht(_this59,"oldRect");ht(_this59,"syncTimestamp");_this59.workOptions=e.toolsOpt,_this59.syncTimestamp=0,_this59.syncUnitTime=50;return _this59;}_inherits(uT,_Gt0);return _createClass(uT,[{key:"consume",value:function consume(e){var M;var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=(M=n==null?void 0:n.workId)==null?void 0:M.toString();if(!h)return{type:Tt.None};var v=n.op,p=v==null?void 0:v.length;if(!p||p<2)return{type:Tt.None};var y;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],y=!1):y=this.updateTempPoints(v),!y)return{type:Tt.None};var C;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;C=this.draw({workId:h,layer:L,isDrawing:!0});}if(u){var _L10=Kt(C,this.oldRect);this.oldRect=C;var X=_objectSpread({rect:_L10,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L11=Date.now();return _L11-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L11,_objectSpread({type:Tt.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:Tt.None};}var b=Kt(C,this.oldRect);return this.oldRect=C,_objectSpread({rect:b,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:Tt.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n,isDrawing:!1});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:Tt.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,_e$isDrawEraserlines5=e.isDrawEraserlines,s=_e$isDrawEraserlines5===void 0?!0:_e$isDrawEraserlines5,_this$workOptions10=this.workOptions,o=_this$workOptions10.strokeColor,a=_this$workOptions10.fillColor,u=_this$workOptions10.thickness,h=_this$workOptions10.zIndex,v=_this$workOptions10.placement,p=_this$workOptions10.scale,y=_this$workOptions10.rotate,C=_this$workOptions10.translate,b=_this$workOptions10.strokeType,M=_this$workOptions10.eraserlines,L=_this$workOptions10.eraserFaces,X=_this$workOptions10.doingLines,Y=_this$workOptions10.lineDash,et=_this$workOptions10.lineCap,_this$computDrawPoint8=this.computDrawPoints(u,v),A=_this$computDrawPoint8.rect,w=_this$computDrawPoint8.pos,S=_this$computDrawPoint8.points,x={points:S.map(function(j){return j.XY;}),lineWidth:u,fillColor:a!=="transparent"&&a||void 0,strokeColor:o,normalize:!0,className:"".concat(w[0],",").concat(w[1]),close:!0,lineCap:et,lineDash:b===Ne.Dotted?[Y&&Y[0]||1,(Y&&Y[1]||2)*u]:b===Ne.LongDotted?[(Y&&Y[0]||1)*u,(Y&&Y[1]||2)*u]:void 0},P={name:n,id:n,zIndex:h,pos:w,anchor:[0.5,0.5],size:[A.w,A.h]};p&&(P.scale=p),y&&(P.rotate=y),C&&(P.translate=C);var z=new nr(P),U=new zn(_objectSpread(_objectSpread({},x),{},{pos:[0,0]}));z.append(U),(M||L||X)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:z,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:L,pos:w,layer:i},s)),this.replace(i,n,z);var K=z.getBoundingClientRect();return this.isDelete&&z.setAttribute("opacity",0),{x:Math.floor(K.x-Gt.SafeBorderPadding),y:Math.floor(K.y-Gt.SafeBorderPadding),w:Math.floor(K.width+Gt.SafeBorderPadding*2),h:Math.floor(K.height+Gt.SafeBorderPadding*2)};}},{key:"transformControlPoints",value:function transformControlPoints(e){var n=Ye(this.tmpPoints);switch(e){case"bottom":case"bottomLeft":case"bottomRight":{var i=n.y+n.h*this.ratio;return[new xt(n.x,n.y,0),new xt(n.x+n.w,n.y,0),new xt(n.x+n.w,i,0),new xt(n.x,i,0)];}case"top":case"topLeft":case"topRight":{var _i4=n.y+n.h*(1-this.ratio);return[new xt(n.x,_i4,0),new xt(n.x+n.w,_i4,0),new xt(n.x+n.w,n.y+n.h,0),new xt(n.x,n.y+n.h,0)];}case"left":case"leftBottom":case"leftTop":{var _i5=n.x+n.w*(1-this.ratio);return[new xt(_i5,n.y,0),new xt(n.x+n.w,n.y,0),new xt(n.x+n.w,n.y+n.h,0),new xt(_i5,n.y+n.h,0)];}case"right":case"rightBottom":case"rightTop":{var _i6=n.x+n.w*this.ratio;return[new xt(n.x,n.y,0),new xt(_i6,n.y,0),new xt(_i6,n.y+n.h,0),new xt(n.x,n.y+n.h,0)];}}}},{key:"computDrawPoints",value:function computDrawPoints(e,n){var i=Ye(this.tmpPoints),s=this.transformControlPoints(n),o=Math.floor(i.w*0.1),a=Math.floor(i.h*0.1),u=[],h=xt.Add(s[0],new xt(0,a,0)),v=xt.Add(s[0],new xt(o,0,0)),p=kn.getBezierPoints(10,h,s[0],v),y=xt.Sub(s[1],new xt(o,0,0)),C=xt.Add(s[1],new xt(0,a,0)),b=kn.getBezierPoints(10,y,s[1],C),M=xt.Sub(s[2],new xt(0,a,0)),L=xt.Sub(s[2],new xt(o,0,0)),X=kn.getBezierPoints(10,M,s[2],L),Y=xt.Add(s[3],new xt(o,0,0)),et=xt.Sub(s[3],new xt(0,a,0)),A=kn.getBezierPoints(10,Y,s[3],et),w=o*(1-this.ratio)*10,S=a*(1-this.ratio)*10;switch(n){case"bottom":{var z=xt.Sub(s[2],new xt(o*5-w/2,0,0)),U=xt.Sub(s[2],new xt(o*5,-S,0)),K=xt.Sub(s[2],new xt(o*5+w/2,0,0));u.push.apply(u,[U,K].concat(_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),[z]));break;}case"bottomRight":{var _z6=xt.Sub(s[2],new xt(o*1.1,0,0)),_U4=xt.Sub(s[2],new xt(o*1.1+w/2,-S,0)),_K5=xt.Sub(s[2],new xt(o*1.1+w,0,0));u.push.apply(u,[_U4,_K5].concat(_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),[_z6]));break;}case"bottomLeft":{var _z7=xt.Add(s[3],new xt(o*1.1+w,0,0)),_U5=xt.Add(s[3],new xt(o*1.1+w/2,S,0)),_K6=xt.Add(s[3],new xt(o*1.1,0,0));u.push.apply(u,[_U5,_K6].concat(_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),[_z7]));break;}case"top":{var _z8=xt.Sub(s[1],new xt(o*5-w/2,0,0)),_U6=xt.Sub(s[1],new xt(o*5,S,0)),_K7=xt.Sub(s[1],new xt(o*5+w/2,0,0));u.push.apply(u,[_U6,_z8].concat(_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),[_K7]));break;}case"topRight":{var _z9=xt.Sub(s[1],new xt(o*1.1,0,0)),_U7=xt.Sub(s[1],new xt(o*1.1+w/2,S,0)),_K8=xt.Sub(s[1],new xt(o*1.1+w,0,0));u.push.apply(u,[_U7,_z9].concat(_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),[_K8]));break;}case"topLeft":{var _z0=xt.Add(s[0],new xt(o*1.1+w,0,0)),_U8=xt.Add(s[0],new xt(o*1.1+w/2,-S,0)),_K9=xt.Add(s[0],new xt(o*1.1,0,0));u.push.apply(u,[_U8,_z0].concat(_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),[_K9]));break;}case"left":{var _z1=xt.Add(s[0],new xt(0,a*5-S/2,0)),_U9=xt.Add(s[0],new xt(-w,a*5,0)),_K0=xt.Add(s[0],new xt(0,a*5+S/2,0));u.push.apply(u,[_U9,_z1].concat(_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),[_K0]));break;}case"leftTop":{var _z10=xt.Add(s[0],new xt(0,a*1.1,0)),_U0=xt.Add(s[0],new xt(-w,a*1.1+S/2,0)),_K1=xt.Add(s[0],new xt(0,a*1.1+S,0));u.push.apply(u,[_U0,_z10].concat(_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),[_K1]));break;}case"leftBottom":{var _z11=xt.Sub(s[3],new xt(0,a*1.1+S,0)),_U1=xt.Sub(s[3],new xt(w,a*1.1+S/2,0)),_K10=xt.Sub(s[3],new xt(0,a*1.1,0));u.push.apply(u,[_U1,_z11].concat(_toConsumableArray(p),_toConsumableArray(b),_toConsumableArray(X),_toConsumableArray(A),[_K10]));break;}case"right":{var _z12=xt.Add(s[1],new xt(0,a*5-S/2,0)),_U10=xt.Add(s[1],new xt(w,a*5,0)),_K11=xt.Add(s[1],new xt(0,a*5+S/2,0));u.push.apply(u,[_U10,_K11].concat(_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),[_z12]));break;}case"rightTop":{var _z13=xt.Add(s[1],new xt(0,a*1.1,0)),_U11=xt.Add(s[1],new xt(w,a*1.1+S/2,0)),_K12=xt.Add(s[1],new xt(0,a*1.1+S,0));u.push.apply(u,[_U11,_K12].concat(_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),[_z13]));break;}case"rightBottom":{var _z14=xt.Sub(s[2],new xt(0,a*1.1+S,0)),_U12=xt.Sub(s[2],new xt(-w,a*1.1+S/2,0)),_K13=xt.Sub(s[2],new xt(0,a*1.1,0));u.push.apply(u,[_U12,_K13].concat(_toConsumableArray(X),_toConsumableArray(A),_toConsumableArray(p),_toConsumableArray(b),[_z14]));break;}}var x=Ye(this.tmpPoints,e),P=[Math.floor(x.x+x.w/2),Math.floor(x.y+x.h/2)];return{rect:x,pos:P,points:u};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o)||_t.Sub(s,i).XY.includes(0))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState7=e.workState,s=_e$workState7===void 0?te.Done:_e$workState7,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawing:!1,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var b;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.fillColor,u=i.toolsType,h=i.placement,v=i.strokeType,p=s.get(n.name),y=p==null?void 0:p.opt;var C=n;return n.tagName==="GROUP"&&(C=n.children[0]),o&&(C.setAttribute("strokeColor",o),y!=null&&y.strokeColor&&(y.strokeColor=o)),a&&(a==="transparent"?C.setAttribute("fillColor","rgba(0,0,0,0)"):C.setAttribute("fillColor",a),y!=null&&y.fillColor&&(y.fillColor=a)),u===St.SpeechBalloon&&h&&(y.placement=h),v&&p!=null&&p.opt&&(b=p.opt)!=null&&b.strokeType&&(p.opt.strokeType=v),p&&s.setInfo(n.name,_objectSpread(_objectSpread({},p),{},{opt:y})),Gt.updateNodeOpt(e);}}]);}(Gt);var ZPt=Xo,qPt=Mi,KPt="[object Boolean]";function QPt(r){return r===!0||r===!1||qPt(r)&&ZPt(r)==KPt;}var JPt=QPt;var Rs=/* @__PURE__ */$n(JPt);var Qa=/*#__PURE__*/function(_Gt1){function Qa(e){var _this60;_classCallCheck(this,Qa);_this60=_callSuper(this,Qa,[e]);ht(_this60,"canRotate",!0);ht(_this60,"scaleType",Ae.all);ht(_this60,"toolsType",St.Image);ht(_this60,"tmpPoints",[]);ht(_this60,"workOptions");ht(_this60,"oldRect");_this60.workOptions=e.toolsOpt,_this60.scaleType=Qa.getScaleType(_this60.workOptions);return _this60;}_inherits(Qa,_Gt1);return _createClass(Qa,[{key:"consume",value:function consume(){return{type:Tt.None};}},{key:"consumeAll",value:function consumeAll(){return{type:Tt.None};}},{key:"draw",value:function draw(e){var n=e.layer,i=e.workId,s=e.replaceId,o=e.imageBitmap,_this$workOptions11=this.workOptions,a=_this$workOptions11.centerX,u=_this$workOptions11.centerY,h=_this$workOptions11.width,v=_this$workOptions11.height,p=_this$workOptions11.rotate,y=_this$workOptions11.zIndex,C=_this$workOptions11.eraserlines,b=_this$workOptions11.eraserFaces,M=_this$workOptions11.doingLines,L=new nr({anchor:[0.5,0.5],pos:[a,u],name:i,size:[h,v],zIndex:y,rotate:p}),X={anchor:[0.5,0.5],pos:[0,0],size:[h,v],texture:o};o||(X.bgcolor="rgba(0,0,0,0.3)");var Y=new af(X);L.append(Y),(C||b||M)&&this.drawEraserlines({group:L,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:b,pos:[a,u],layer:n}),this.replace(n,s||i,L);var et=L.getBoundingClientRect();if(et)return{x:Math.floor(et.x-Gt.SafeBorderPadding),y:Math.floor(et.y-Gt.SafeBorderPadding),w:Math.floor(et.width+Gt.SafeBorderPadding*2),h:Math.floor(et.height+Gt.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(){}},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(e){var p,y,C,b,n,i,s,o,_this$workOptions12,a,u,h,v,M,L;return _regenerator().w(function(_context15){while(1)switch(_context15.n){case 0:n=e.isFullWork,i=e.replaceId,s=e.worker,o=e.requestId,_this$workOptions12=this.workOptions,a=_this$workOptions12.src,u=_this$workOptions12.uuid,h=((p=this.workId)==null?void 0:p.toString())||u,v=n?this.fullLayer:this.drawLayer||this.fullLayer;if(!a){_context15.n=2;break;}_context15.n=1;return s.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:h,requestId:o,isSubWorker:s instanceof TMt});case 1:M=_context15.v;if(!M){_context15.n=2;break;}L=this.draw({workId:h,layer:v,replaceId:i,imageBitmap:M});return _context15.a(2,(this.oldRect=h&&((C=(y=this.vNodes)==null?void 0:y.get(h))==null?void 0:C.rect)||void 0,(b=this.vNodes)==null||b.setInfo(h,{rect:L,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:L&&Gt.getCenterPos(L,v)}),L));case 2:return _context15.a(2);}},_callee14,this);}));function consumeServiceAsync(_x28){return _consumeServiceAsync.apply(this,arguments);}return consumeServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return Gt.normalizeStorageData(e);}},{key:"getScaleType",value:function getScaleType(e){var n=e.uniformScale,i=e.rotate;return n!==!1||i&&Math.abs(i)%90>0?Ae.proportional:Ae.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var n=e.node,i=e.opt,s=e.vNodes,o=e.targetNode,a=i.translate,u=i.originPoint,h=i.scenePoint,v=i.scale,p=i.angle,y=i.isLocked,C=i.zIndex,b=i.strokeColor,M=o&&gr(o)||s.get(n.name);if(!M)return;var L=n.parent;if(L){if(b&&(M.opt.strokeColor=b),$e(C)&&(n.setAttribute("zIndex",C),M.opt.zIndex=C),Rs(y)&&(M.opt.locked=y),u&&h&&v&&a){var _M$opt=M.opt,X=_M$opt.centerX,Y=_M$opt.centerY,et=_M$opt.width,A=_M$opt.height,w=_M$opt.uniformScale,S=w!==!1?[v[0],v[0]]:v,x=[X,Y],P=[X,Y];yf(P,h,S,a);var z=[P[0]-x[0],P[1]-x[1]];if(M.centerPos=[M.centerPos[0]+z[0],M.centerPos[1]+z[1]],M.opt.width=Math.round(et*S[0]),M.opt.height=Math.round(A*S[1]),M.opt.centerX=P[0],M.opt.centerY=P[1],M.opt.eraserlines){var _iterator44=_createForOfIteratorHelper(M.opt.eraserlines),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var U=_step44.value;var K=U.op,j=U.thickness;U.thickness=Math.round(j*Math.max(v[0],v[1]));for(var nt=0;nt<K.length;nt++)ja(K[nt],h,v,a);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}}else if(a){if(M.opt.centerX=M.opt.centerX+a[0],M.opt.centerY=M.opt.centerY+a[1],M.centerPos=[M.centerPos[0]+a[0],M.centerPos[1]+a[1]],M.opt.eraserlines){var _iterator45=_createForOfIteratorHelper(M.opt.eraserlines),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _X2=_step45.value;var _Y2=_X2.op;for(var _et2=0;_et2<_Y2.length;_et2++){var _A5=_Y2[_et2].map(function(w,S){return S%2?w+a[1]:w+a[0];});_X2.op[_et2]=_A5;}}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}}}else if($e(p))if(M.opt.rotate=p,M.scaleType=Qa.getScaleType(M.opt),o){var _X3=Uv(M.rect,p);M.rect=_X3;}else{var _X4=Gt.getRectFromLayer(L,n.name);M.rect=_X4||M.rect;}return M&&s.setInfo(n.name,M),M==null?void 0:M.rect;}}}]);}(Gt);var fT=/*#__PURE__*/function(_Gt10){function fT(e){var _this61;_classCallCheck(this,fT);_this61=_callSuper(this,fT,[e]);ht(_this61,"canRotate",!1);ht(_this61,"scaleType",Ae.both);ht(_this61,"toolsType",St.Straight);ht(_this61,"tmpPoints",[]);ht(_this61,"workOptions");ht(_this61,"oldRect");ht(_this61,"straightTipWidth");ht(_this61,"syncTimestamp");_this61.workOptions=e.toolsOpt,_this61.straightTipWidth=_this61.workOptions.thickness/2,_this61.syncTimestamp=0,_this61.syncUnitTime=50;return _this61;}_inherits(fT,_Gt10);return _createClass(fT,[{key:"consume",value:function consume(e){var n=e.data,i=e.isFullWork,s=e.isSubWorker,o=e.isMainThread,a=e.smoothSync,u=e.isSimpleWorker,h=this.workId,v=n.op,p=n.syncUnitTime,y=v==null?void 0:v.length;if(!y||y<2)return{type:Tt.None};p&&(this.syncUnitTime=p);var C;if(this.tmpPoints.length===0?(this.tmpPoints=[new _t(v[0],v[1])],C=!1):C=this.updateTempPoints(v),!C)return{type:Tt.None};var b;if(s||o||u){var L=i?this.fullLayer:this.drawLayer||this.fullLayer;b=this.draw({workId:h,layer:L});}if(u){var _L12=Kt(b,this.oldRect);this.oldRect=b;var X=_objectSpread({rect:_L12,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);if(a){var Y=Date.now();Y-this.syncTimestamp>this.syncUnitTime&&(this.syncTimestamp=Y,X.op=this.tmpPoints.map(function(et){return[].concat(_toConsumableArray(et.XY),[0]);}).flat(1),X.index=0,X.isSync=!0);}return X;}if(!s&&a){var _L13=Date.now();return _L13-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_L13,_objectSpread({type:Tt.DrawWork,dataType:Qt.Local,op:this.tmpPoints.map(function(X){return[].concat(_toConsumableArray(X.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:Tt.None};}var M=Kt(b,this.oldRect);return this.oldRect=b,_objectSpread({rect:M,type:Tt.DrawWork,dataType:Qt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var e=this.workId;if(this.tmpPoints.length<2)return{type:Tt.RemoveNode,removeIds:[e]};var n=this.fullLayer,i=this.draw({workId:e,layer:n});this.oldRect=i;var s=this.tmpPoints.map(function(u){return[].concat(_toConsumableArray(u.XY),[0]);}).flat(1),o=Br(s);return(a=this.vNodes)==null||a.setInfo(e,{rect:i,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&Gt.getCenterPos(i,n)}),_objectSpread(_objectSpread({rect:i,type:Tt.FullWork,dataType:Qt.Local,ops:o,isSync:!0},this.baseConsumeResult),{},{updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(e){var n=e.workId,i=e.layer,_e$isDrawEraserlines6=e.isDrawEraserlines,s=_e$isDrawEraserlines6===void 0?!0:_e$isDrawEraserlines6,_this$workOptions13=this.workOptions,o=_this$workOptions13.strokeColor,a=_this$workOptions13.thickness,u=_this$workOptions13.zIndex,h=_this$workOptions13.scale,v=_this$workOptions13.rotate,p=_this$workOptions13.translate,y=_this$workOptions13.strokeType,C=_this$workOptions13.eraserlines,b=_this$workOptions13.eraserFaces,M=_this$workOptions13.doingLines,L=_this$workOptions13.lineCap,X=_this$workOptions13.lineDash,Y=i.worldPosition,et=i.worldScaling,_this$computDrawPoint9=this.computDrawPoints(a,y),A=_this$computDrawPoint9.d,w=_this$computDrawPoint9.rect,S=_this$computDrawPoint9.isDot,x=[w.x+w.w/2,w.y+w.h/2],P=new nr({pos:x,anchor:[0.5,0.5],size:[w.w,w.h],name:n,id:n,normalize:!0,zIndex:u}),z={pos:[0,0],normalize:!0,d:A,fillColor:o,strokeColor:o,lineDash:S?void 0:y===Ne.Dotted?[X&&X[0]||1,(X&&X[1]||2)*a]:y===Ne.LongDotted?[(X&&X[0]||1)*a,(X&&X[1]||2)*a]:void 0,lineCap:S?void 0:L,lineWidth:y===Ne.Normal||S?0:a};h&&(z.scale=h),v&&(z.rotate=v),p&&(z.translate=p);var U=new $r(z);P.append(U),(C||b||M)&&(this.scaleType=Ae.proportional,this.drawEraserlines({group:P,eraserlines:this.getRenderableEraserLines(this.workOptions),eraserFaces:b,pos:x,layer:i},s)),this.replace(i,n,P);var K={x:Math.floor(w.x*et[0]+Y[0]-Gt.SafeBorderPadding),y:Math.floor(w.y*et[1]+Y[1]-Gt.SafeBorderPadding),w:Math.floor(w.w*et[0]+2*Gt.SafeBorderPadding),h:Math.floor(w.h*et[1]+2*Gt.SafeBorderPadding)};if(v||h||p){var j=U.getBoundingClientRect();K={x:Math.floor(j.x-Gt.SafeBorderPadding),y:Math.floor(j.y-Gt.SafeBorderPadding),w:Math.floor(j.width+Gt.SafeBorderPadding*2),h:Math.floor(j.height+Gt.SafeBorderPadding*2)};}return this.isDelete&&P.setAttribute("opacity",0),K;}},{key:"computDrawPoints",value:function computDrawPoints(e,n){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(e,n):this.computDotPoints(e);}},{key:"computFullPoints",value:function computFullPoints(e,n){var i=xt.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),s=xt.Per(i).mul(e/2),o=_t.Sub(this.tmpPoints[0],s),a=_t.Add(this.tmpPoints[0],s),u=_t.Sub(this.tmpPoints[1],s),h=_t.Add(this.tmpPoints[1],s),v=_t.GetSemicircleStroke(this.tmpPoints[1],u,-1,8),p=_t.GetSemicircleStroke(this.tmpPoints[0],a,-1,8),y=[o,u].concat(_toConsumableArray(v),[h,a],_toConsumableArray(p));var C;return n!==Ne.Normal?C=Jn(this.tmpPoints,!1):C=Jn(y,!0),{d:C,rect:Ye(y),isDot:!1,pos:this.tmpPoints[0].XY};}},{key:"computDotPoints",value:function computDotPoints(e){var n=_t.GetDotStroke(this.tmpPoints[0],e/2,8);return{d:Jn(n,!0),rect:Ye(n),isDot:!0,pos:this.tmpPoints[0].XY};}},{key:"updateTempPoints",value:function updateTempPoints(e){var n=e.slice(-2),i=new _t(n[0],n[1]),s=this.tmpPoints[0],o=this.workOptions.thickness;if(s.isNear(i,o))return!1;if(this.tmpPoints.length===2){if(i.isNear(this.tmpPoints[1],1))return!1;this.tmpPoints[1]=i;}else this.tmpPoints.push(i);return!0;}},{key:"consumeService",value:function consumeService(e){var h,v;var n=e.op,i=e.isFullWork,_e$workState8=e.workState,s=_e$workState8===void 0?te.Done:_e$workState8,o=(h=this.workId)==null?void 0:h.toString();if(!o)return;this.tmpPoints.length=0;for(var p=0;p<n.length;p+=3)this.tmpPoints.push(new _t(n[p],n[p+1],n[p+2]));var a=i?this.fullLayer:this.drawLayer||this.fullLayer,u=this.draw({workId:o,layer:a,isDrawEraserlines:s===te.Done});return this.oldRect=u,(v=this.vNodes)==null||v.setInfo(o,{rect:u,op:n,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:u&&Gt.getCenterPos(u,a)}),u;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return this.normalizeDrawableStorageData(e);}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var h,v;var n=e.node,i=e.opt,s=e.vNodes,o=i.strokeColor,a=i.strokeType,u=s.get(n.name);return o&&(n.tagName==="GROUP"?n.children.forEach(function(p){p.setAttribute("strokeColor",o),p.getAttribute("fillColor")&&p.setAttribute("fillColor",o);}):(n.setAttribute("strokeColor",o),n.setAttribute("fillColor",o)),(h=u==null?void 0:u.opt)!=null&&h.strokeColor&&(u.opt.strokeColor=o)),a&&u!=null&&u.opt&&(v=u.opt)!=null&&v.strokeType&&(u.opt.strokeType=a),u&&s.setInfo(n.name,u),Gt.updateNodeOpt(e);}}]);}(Gt);var Lo="cursorhover",k1=20,Bs="mainView",Bv=500,_Pt=Bv;var B1={exports:{}},tr={},Cp={exports:{}},qs={};function hT(){var r={};return r["align-content"]=!1,r["align-items"]=!1,r["align-self"]=!1,r["alignment-adjust"]=!1,r["alignment-baseline"]=!1,r.all=!1,r["anchor-point"]=!1,r.animation=!1,r["animation-delay"]=!1,r["animation-direction"]=!1,r["animation-duration"]=!1,r["animation-fill-mode"]=!1,r["animation-iteration-count"]=!1,r["animation-name"]=!1,r["animation-play-state"]=!1,r["animation-timing-function"]=!1,r.azimuth=!1,r["backface-visibility"]=!1,r.background=!0,r["background-attachment"]=!0,r["background-clip"]=!0,r["background-color"]=!0,r["background-image"]=!0,r["background-origin"]=!0,r["background-position"]=!0,r["background-repeat"]=!0,r["background-size"]=!0,r["baseline-shift"]=!1,r.binding=!1,r.bleed=!1,r["bookmark-label"]=!1,r["bookmark-level"]=!1,r["bookmark-state"]=!1,r.border=!0,r["border-bottom"]=!0,r["border-bottom-color"]=!0,r["border-bottom-left-radius"]=!0,r["border-bottom-right-radius"]=!0,r["border-bottom-style"]=!0,r["border-bottom-width"]=!0,r["border-collapse"]=!0,r["border-color"]=!0,r["border-image"]=!0,r["border-image-outset"]=!0,r["border-image-repeat"]=!0,r["border-image-slice"]=!0,r["border-image-source"]=!0,r["border-image-width"]=!0,r["border-left"]=!0,r["border-left-color"]=!0,r["border-left-style"]=!0,r["border-left-width"]=!0,r["border-radius"]=!0,r["border-right"]=!0,r["border-right-color"]=!0,r["border-right-style"]=!0,r["border-right-width"]=!0,r["border-spacing"]=!0,r["border-style"]=!0,r["border-top"]=!0,r["border-top-color"]=!0,r["border-top-left-radius"]=!0,r["border-top-right-radius"]=!0,r["border-top-style"]=!0,r["border-top-width"]=!0,r["border-width"]=!0,r.bottom=!1,r["box-decoration-break"]=!0,r["box-shadow"]=!0,r["box-sizing"]=!0,r["box-snap"]=!0,r["box-suppress"]=!0,r["break-after"]=!0,r["break-before"]=!0,r["break-inside"]=!0,r["caption-side"]=!1,r.chains=!1,r.clear=!0,r.clip=!1,r["clip-path"]=!1,r["clip-rule"]=!1,r.color=!0,r["color-interpolation-filters"]=!0,r["column-count"]=!1,r["column-fill"]=!1,r["column-gap"]=!1,r["column-rule"]=!1,r["column-rule-color"]=!1,r["column-rule-style"]=!1,r["column-rule-width"]=!1,r["column-span"]=!1,r["column-width"]=!1,r.columns=!1,r.contain=!1,r.content=!1,r["counter-increment"]=!1,r["counter-reset"]=!1,r["counter-set"]=!1,r.crop=!1,r.cue=!1,r["cue-after"]=!1,r["cue-before"]=!1,r.cursor=!1,r.direction=!1,r.display=!0,r["display-inside"]=!0,r["display-list"]=!0,r["display-outside"]=!0,r["dominant-baseline"]=!1,r.elevation=!1,r["empty-cells"]=!1,r.filter=!1,r.flex=!1,r["flex-basis"]=!1,r["flex-direction"]=!1,r["flex-flow"]=!1,r["flex-grow"]=!1,r["flex-shrink"]=!1,r["flex-wrap"]=!1,r.float=!1,r["float-offset"]=!1,r["flood-color"]=!1,r["flood-opacity"]=!1,r["flow-from"]=!1,r["flow-into"]=!1,r.font=!0,r["font-family"]=!0,r["font-feature-settings"]=!0,r["font-kerning"]=!0,r["font-language-override"]=!0,r["font-size"]=!0,r["font-size-adjust"]=!0,r["font-stretch"]=!0,r["font-style"]=!0,r["font-synthesis"]=!0,r["font-variant"]=!0,r["font-variant-alternates"]=!0,r["font-variant-caps"]=!0,r["font-variant-east-asian"]=!0,r["font-variant-ligatures"]=!0,r["font-variant-numeric"]=!0,r["font-variant-position"]=!0,r["font-weight"]=!0,r.grid=!1,r["grid-area"]=!1,r["grid-auto-columns"]=!1,r["grid-auto-flow"]=!1,r["grid-auto-rows"]=!1,r["grid-column"]=!1,r["grid-column-end"]=!1,r["grid-column-start"]=!1,r["grid-row"]=!1,r["grid-row-end"]=!1,r["grid-row-start"]=!1,r["grid-template"]=!1,r["grid-template-areas"]=!1,r["grid-template-columns"]=!1,r["grid-template-rows"]=!1,r["hanging-punctuation"]=!1,r.height=!0,r.hyphens=!1,r.icon=!1,r["image-orientation"]=!1,r["image-resolution"]=!1,r["ime-mode"]=!1,r["initial-letters"]=!1,r["inline-box-align"]=!1,r["justify-content"]=!1,r["justify-items"]=!1,r["justify-self"]=!1,r.left=!1,r["letter-spacing"]=!0,r["lighting-color"]=!0,r["line-box-contain"]=!1,r["line-break"]=!1,r["line-grid"]=!1,r["line-height"]=!1,r["line-snap"]=!1,r["line-stacking"]=!1,r["line-stacking-ruby"]=!1,r["line-stacking-shift"]=!1,r["line-stacking-strategy"]=!1,r["list-style"]=!0,r["list-style-image"]=!0,r["list-style-position"]=!0,r["list-style-type"]=!0,r.margin=!0,r["margin-bottom"]=!0,r["margin-left"]=!0,r["margin-right"]=!0,r["margin-top"]=!0,r["marker-offset"]=!1,r["marker-side"]=!1,r.marks=!1,r.mask=!1,r["mask-box"]=!1,r["mask-box-outset"]=!1,r["mask-box-repeat"]=!1,r["mask-box-slice"]=!1,r["mask-box-source"]=!1,r["mask-box-width"]=!1,r["mask-clip"]=!1,r["mask-image"]=!1,r["mask-origin"]=!1,r["mask-position"]=!1,r["mask-repeat"]=!1,r["mask-size"]=!1,r["mask-source-type"]=!1,r["mask-type"]=!1,r["max-height"]=!0,r["max-lines"]=!1,r["max-width"]=!0,r["min-height"]=!0,r["min-width"]=!0,r["move-to"]=!1,r["nav-down"]=!1,r["nav-index"]=!1,r["nav-left"]=!1,r["nav-right"]=!1,r["nav-up"]=!1,r["object-fit"]=!1,r["object-position"]=!1,r.opacity=!1,r.order=!1,r.orphans=!1,r.outline=!1,r["outline-color"]=!1,r["outline-offset"]=!1,r["outline-style"]=!1,r["outline-width"]=!1,r.overflow=!1,r["overflow-wrap"]=!1,r["overflow-x"]=!1,r["overflow-y"]=!1,r.padding=!0,r["padding-bottom"]=!0,r["padding-left"]=!0,r["padding-right"]=!0,r["padding-top"]=!0,r.page=!1,r["page-break-after"]=!1,r["page-break-before"]=!1,r["page-break-inside"]=!1,r["page-policy"]=!1,r.pause=!1,r["pause-after"]=!1,r["pause-before"]=!1,r.perspective=!1,r["perspective-origin"]=!1,r.pitch=!1,r["pitch-range"]=!1,r["play-during"]=!1,r.position=!1,r["presentation-level"]=!1,r.quotes=!1,r["region-fragment"]=!1,r.resize=!1,r.rest=!1,r["rest-after"]=!1,r["rest-before"]=!1,r.richness=!1,r.right=!1,r.rotation=!1,r["rotation-point"]=!1,r["ruby-align"]=!1,r["ruby-merge"]=!1,r["ruby-position"]=!1,r["shape-image-threshold"]=!1,r["shape-outside"]=!1,r["shape-margin"]=!1,r.size=!1,r.speak=!1,r["speak-as"]=!1,r["speak-header"]=!1,r["speak-numeral"]=!1,r["speak-punctuation"]=!1,r["speech-rate"]=!1,r.stress=!1,r["string-set"]=!1,r["tab-size"]=!1,r["table-layout"]=!1,r["text-align"]=!0,r["text-align-last"]=!0,r["text-combine-upright"]=!0,r["text-decoration"]=!0,r["text-decoration-color"]=!0,r["text-decoration-line"]=!0,r["text-decoration-skip"]=!0,r["text-decoration-style"]=!0,r["text-emphasis"]=!0,r["text-emphasis-color"]=!0,r["text-emphasis-position"]=!0,r["text-emphasis-style"]=!0,r["text-height"]=!0,r["text-indent"]=!0,r["text-justify"]=!0,r["text-orientation"]=!0,r["text-overflow"]=!0,r["text-shadow"]=!0,r["text-space-collapse"]=!0,r["text-transform"]=!0,r["text-underline-position"]=!0,r["text-wrap"]=!0,r.top=!1,r.transform=!1,r["transform-origin"]=!1,r["transform-style"]=!1,r.transition=!1,r["transition-delay"]=!1,r["transition-duration"]=!1,r["transition-property"]=!1,r["transition-timing-function"]=!1,r["unicode-bidi"]=!1,r["vertical-align"]=!1,r.visibility=!1,r["voice-balance"]=!1,r["voice-duration"]=!1,r["voice-family"]=!1,r["voice-pitch"]=!1,r["voice-range"]=!1,r["voice-rate"]=!1,r["voice-stress"]=!1,r["voice-volume"]=!1,r.volume=!1,r["white-space"]=!1,r.widows=!1,r.width=!0,r["will-change"]=!1,r["word-break"]=!0,r["word-spacing"]=!0,r["word-wrap"]=!0,r["wrap-flow"]=!1,r["wrap-through"]=!1,r["writing-mode"]=!1,r["z-index"]=!1,r;}function tbt(r,t,e){}function ebt(r,t,e){}var rbt=/javascript\s*\:/img;function nbt(r,t){return rbt.test(t)?"":t;}qs.whiteList=hT();qs.getDefaultWhiteList=hT;qs.onAttr=tbt;qs.onIgnoreAttr=ebt;qs.safeAttrValue=nbt;var ibt={indexOf:function indexOf(r,t){var e,n;if(Array.prototype.indexOf)return r.indexOf(t);for(e=0,n=r.length;e<n;e++)if(r[e]===t)return e;return-1;},forEach:function forEach(r,t,e){var n,i;if(Array.prototype.forEach)return r.forEach(t,e);for(n=0,i=r.length;n<i;n++)t.call(e,r[n],n,r);},trim:function trim(r){return String.prototype.trim?r.trim():r.replace(/(^\s*)|(\s*$)/g,"");},trimRight:function trimRight(r){return String.prototype.trimRight?r.trimRight():r.replace(/(\s*$)/g,"");}},Da=ibt;function sbt(r,t){r=Da.trimRight(r),r[r.length-1]!==";"&&(r+=";");var e=r.length,n=!1,i=0,s=0,o="";function a(){if(!n){var v=Da.trim(r.slice(i,s)),p=v.indexOf(":");if(p!==-1){var y=Da.trim(v.slice(0,p)),C=Da.trim(v.slice(p+1));if(y){var b=t(i,o.length,y,C,v);b&&(o+=b+"; ");}}}i=s+1;}for(;s<e;s++){var u=r[s];if(u==="/"&&r[s+1]==="*"){var h=r.indexOf("*/",s+2);if(h===-1)break;s=h+1,i=s+1,n=!1;}else u==="("?n=!0:u===")"?n=!1:u===";"?n||a():u==="\n"&&a();}return Da.trim(o);}var obt=sbt,Gc=qs,abt=obt;function F1(r){return r==null;}function lbt(r){var t={};for(var e in r)t[e]=r[e];return t;}function dT(r){r=lbt(r||{}),r.whiteList=r.whiteList||Gc.whiteList,r.onAttr=r.onAttr||Gc.onAttr,r.onIgnoreAttr=r.onIgnoreAttr||Gc.onIgnoreAttr,r.safeAttrValue=r.safeAttrValue||Gc.safeAttrValue,this.options=r;}dT.prototype.process=function(r){if(r=r||"",r=r.toString(),!r)return"";var t=this,e=t.options,n=e.whiteList,i=e.onAttr,s=e.onIgnoreAttr,o=e.safeAttrValue,a=abt(r,function(u,h,v,p,y){var C=n[v],b=!1;if(C===!0?b=C:typeof C=="function"?b=C(p):C instanceof RegExp&&(b=C.test(p)),b!==!0&&(b=!1),p=o(v,p),!!p){var M={position:h,sourcePosition:u,source:y,isWhite:b};if(b){var L=i(v,p,M);return F1(L)?v+":"+p:L;}else{var L=s(v,p,M);if(!F1(L))return L;}}});return a;};var cbt=dT;(function(r,t){var e=qs,n=cbt;function i(o,a){var u=new n(a);return u.process(o);}t=r.exports=i,t.FilterCSS=n;for(var s in e)t[s]=e[s];(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterCSS=r.exports);})(Cp,Cp.exports);var Fv=Cp.exports,Wv={indexOf:function indexOf(r,t){var e,n;if(Array.prototype.indexOf)return r.indexOf(t);for(e=0,n=r.length;e<n;e++)if(r[e]===t)return e;return-1;},forEach:function forEach(r,t,e){var n,i;if(Array.prototype.forEach)return r.forEach(t,e);for(n=0,i=r.length;n<i;n++)t.call(e,r[n],n,r);},trim:function trim(r){return String.prototype.trim?r.trim():r.replace(/(^\s*)|(\s*$)/g,"");},spaceIndex:function spaceIndex(r){var t=/\s|\n|\t/,e=t.exec(r);return e?e.index:-1;}},ubt=Fv.FilterCSS,fbt=Fv.getDefaultWhiteList,Tu=Wv;function pT(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]};}var vT=new ubt();function hbt(r,t,e){}function dbt(r,t,e){}function pbt(r,t,e){}function vbt(r,t,e){}function gT(r){return r.replace(mbt,"<").replace(ybt,">");}function gbt(r,t,e,n){if(e=IT(e),t==="href"||t==="src"){if(e=Tu.trim(e),e==="#")return"#";if(!(e.substr(0,7)==="http://"||e.substr(0,8)==="https://"||e.substr(0,7)==="mailto:"||e.substr(0,4)==="tel:"||e.substr(0,11)==="data:image/"||e.substr(0,6)==="ftp://"||e.substr(0,2)==="./"||e.substr(0,3)==="../"||e[0]==="#"||e[0]==="/"))return"";}else if(t==="background"){if(jc.lastIndex=0,jc.test(e))return"";}else if(t==="style"){if(W1.lastIndex=0,W1.test(e)||(U1.lastIndex=0,U1.test(e)&&(jc.lastIndex=0,jc.test(e))))return"";n!==!1&&(n=n||vT,e=n.process(e));}return e=CT(e),e;}var mbt=/</g,ybt=/>/g,wbt=/"/g,Sbt=/"/g,Tbt=/&#([a-zA-Z0-9]*);?/gim,Ibt=/:?/gim,Cbt=/&newline;?/gim,jc=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,W1=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,U1=/u\s*r\s*l\s*\(.*/gi;function mT(r){return r.replace(wbt,""");}function yT(r){return r.replace(Sbt,'"');}function wT(r){return r.replace(Tbt,function(e,n){return n[0]==="x"||n[0]==="X"?String.fromCharCode(parseInt(n.substr(1),16)):String.fromCharCode(parseInt(n,10));});}function ST(r){return r.replace(Ibt,":").replace(Cbt," ");}function TT(r){for(var t="",e=0,n=r.length;e<n;e++)t+=r.charCodeAt(e)<32?" ":r.charAt(e);return Tu.trim(t);}function IT(r){return r=yT(r),r=wT(r),r=ST(r),r=TT(r),r;}function CT(r){return r=mT(r),r=gT(r),r;}function xbt(){return"";}function Pbt(r,t){typeof t!="function"&&(t=function t(){});var e=!Array.isArray(r);function n(o){return e?!0:Tu.indexOf(r,o)!==-1;}var i=[],s=!1;return{onIgnoreTag:function onIgnoreTag(o,a,u){if(n(o)){if(u.isClosing){var h="[/removed]",v=u.position+h.length;return i.push([s!==!1?s:u.position,v]),s=!1,h;}else return s||(s=u.position),"[removed]";}else return t(o,a,u);},remove:function remove(o){var a="",u=0;return Tu.forEach(i,function(h){a+=o.slice(u,h[0]),u=h[1];}),a+=o.slice(u),a;}};}function bbt(r){for(var t="",e=0;e<r.length;){var n=r.indexOf("<!--",e);if(n===-1){t+=r.slice(e);break;}t+=r.slice(e,n);var i=r.indexOf("-->",n);if(i===-1)break;e=i+3;}return t;}function Abt(r){var t=r.split("");return t=t.filter(function(e){var n=e.charCodeAt(0);return n===127?!1:n<=31?n===10||n===13:!0;}),t.join("");}tr.whiteList=pT();tr.getDefaultWhiteList=pT;tr.onTag=hbt;tr.onIgnoreTag=dbt;tr.onTagAttr=pbt;tr.onIgnoreTagAttr=vbt;tr.safeAttrValue=gbt;tr.escapeHtml=gT;tr.escapeQuote=mT;tr.unescapeQuote=yT;tr.escapeHtmlEntities=wT;tr.escapeDangerHtml5Entities=ST;tr.clearNonPrintableCharacter=TT;tr.friendlyAttrValue=IT;tr.escapeAttrValue=CT;tr.onIgnoreTagStripAll=xbt;tr.StripTagBody=Pbt;tr.stripCommentTag=bbt;tr.stripBlankChar=Abt;tr.attributeWrapSign='"';tr.cssFilter=vT;tr.getDefaultCSSWhiteList=fbt;var gf={},qi=Wv;function Ebt(r){var t=qi.spaceIndex(r),e;return t===-1?e=r.slice(1,-1):e=r.slice(1,t+1),e=qi.trim(e).toLowerCase(),e.slice(0,1)==="/"&&(e=e.slice(1)),e.slice(-1)==="/"&&(e=e.slice(0,-1)),e;}function Mbt(r){return r.slice(0,2)==="</";}function Lbt(r,t,e){var n="",i=0,s=!1,o=!1,a=0,u=r.length,h="",v="";t:for(a=0;a<u;a++){var p=r.charAt(a);if(s===!1){if(p==="<"){s=a;continue;}}else if(o===!1){if(p==="<"){n+=e(r.slice(i,a)),s=a,i=a;continue;}if(p===">"||a===u-1){n+=e(r.slice(i,s)),v=r.slice(s,a+1),h=Ebt(v),n+=t(s,n.length,h,v,Mbt(v)),i=a+1,s=!1;continue;}if(p==='"'||p==="'")for(var y=1,C=r.charAt(a-y);C.trim()===""||C==="=";){if(C==="="){o=p;continue t;}C=r.charAt(a-++y);}}else if(p===o){o=!1;continue;}}return i<u&&(n+=e(r.substr(i))),n;}var Rbt=/[^a-zA-Z0-9\\_:.-]/gim;function Obt(r,t){var e=0,n=0,i=[],s=!1,o=r.length;function a(y,C){if(y=qi.trim(y),y=y.replace(Rbt,"").toLowerCase(),!(y.length<1)){var b=t(y,C||"");b&&i.push(b);}}for(var u=0;u<o;u++){var h=r.charAt(u),v,p;if(s===!1&&h==="="){s=r.slice(e,u),e=u+1,n=r.charAt(e)==='"'||r.charAt(e)==="'"?e:Nbt(r,u+1);continue;}if(s!==!1&&u===n){if(p=r.indexOf(h,u+1),p===-1)break;v=qi.trim(r.slice(n+1,p)),a(s,v),s=!1,u=p,e=u+1;continue;}if(/\s|\n|\t/.test(h))if(r=r.replace(/\s|\n|\t/g," "),s===!1){if(p=Dbt(r,u),p===-1){v=qi.trim(r.slice(e,u)),a(v),s=!1,e=u+1;continue;}else{u=p-1;continue;}}else if(p=kbt(r,u-1),p===-1){v=qi.trim(r.slice(e,u)),v=z1(v),a(s,v),s=!1,e=u+1;continue;}else continue;}return e<r.length&&(s===!1?a(r.slice(e)):a(s,z1(qi.trim(r.slice(e))))),qi.trim(i.join(" "));}function Dbt(r,t){for(;t<r.length;t++){var e=r[t];if(e!==" ")return e==="="?t:-1;}}function Nbt(r,t){for(;t<r.length;t++){var e=r[t];if(e!==" ")return e==="'"||e==='"'?t:-1;}}function kbt(r,t){for(;t>0;t--){var e=r[t];if(e!==" ")return e==="="?t:-1;}}function Bbt(r){return r[0]==='"'&&r[r.length-1]==='"'||r[0]==="'"&&r[r.length-1]==="'";}function z1(r){return Bbt(r)?r.substr(1,r.length-2):r;}gf.parseTag=Lbt;gf.parseAttr=Obt;var Fbt=Fv.FilterCSS,xn=tr,xT=gf,Wbt=xT.parseTag,Ubt=xT.parseAttr,nu=Wv;function Xc(r){return r==null;}function zbt(r){var t=nu.spaceIndex(r);if(t===-1)return{html:"",closing:r[r.length-2]==="/"};r=nu.trim(r.slice(t+1,-1));var e=r[r.length-1]==="/";return e&&(r=nu.trim(r.slice(0,-1))),{html:r,closing:e};}function $bt(r){var t={};for(var e in r)t[e]=r[e];return t;}function Ybt(r){var t={};for(var e in r)Array.isArray(r[e])?t[e.toLowerCase()]=r[e].map(function(n){return n.toLowerCase();}):t[e.toLowerCase()]=r[e];return t;}function PT(r){r=$bt(r||{}),r.stripIgnoreTag&&(r.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),r.onIgnoreTag=xn.onIgnoreTagStripAll),r.whiteList||r.allowList?r.whiteList=Ybt(r.whiteList||r.allowList):r.whiteList=xn.whiteList,this.attributeWrapSign=r.singleQuotedAttributeValue===!0?"'":xn.attributeWrapSign,r.onTag=r.onTag||xn.onTag,r.onTagAttr=r.onTagAttr||xn.onTagAttr,r.onIgnoreTag=r.onIgnoreTag||xn.onIgnoreTag,r.onIgnoreTagAttr=r.onIgnoreTagAttr||xn.onIgnoreTagAttr,r.safeAttrValue=r.safeAttrValue||xn.safeAttrValue,r.escapeHtml=r.escapeHtml||xn.escapeHtml,this.options=r,r.css===!1?this.cssFilter=!1:(r.css=r.css||{},this.cssFilter=new Fbt(r.css));}PT.prototype.process=function(r){if(r=r||"",r=r.toString(),!r)return"";var t=this,e=t.options,n=e.whiteList,i=e.onTag,s=e.onIgnoreTag,o=e.onTagAttr,a=e.onIgnoreTagAttr,u=e.safeAttrValue,h=e.escapeHtml,v=t.attributeWrapSign,p=t.cssFilter;e.stripBlankChar&&(r=xn.stripBlankChar(r)),e.allowCommentTag||(r=xn.stripCommentTag(r));var y=!1;e.stripIgnoreTagBody&&(y=xn.StripTagBody(e.stripIgnoreTagBody,s),s=y.onIgnoreTag);var C=Wbt(r,function(b,M,L,X,Y){var et={sourcePosition:b,position:M,isClosing:Y,isWhite:Object.prototype.hasOwnProperty.call(n,L)},A=i(L,X,et);if(!Xc(A))return A;if(et.isWhite){if(et.isClosing)return"</"+L+">";var w=zbt(X),S=n[L],x=Ubt(w.html,function(P,z){var U=nu.indexOf(S,P)!==-1,K=o(L,P,z,U);return Xc(K)?U?(z=u(L,P,z,p),z?P+"="+v+z+v:P):(K=a(L,P,z,U),Xc(K)?void 0:K):K;});return X="<"+L,x&&(X+=" "+x),w.closing&&(X+=" /"),X+=">",X;}else return A=s(L,X,et),Xc(A)?h(X):A;},h);return y&&(C=y.remove(C)),C;};var Gbt=PT;(function(r,t){var e=tr,n=gf,i=Gbt;function s(a,u){var h=new i(u);return h.process(a);}t=r.exports=s,t.filterXSS=s,t.FilterXSS=i,function(){for(var a in e)t[a]=e[a];for(var u in n)t[u]=n[u];}(),(typeof window==="undefined"?"undefined":_typeof(window))<"u"&&(window.filterXSS=r.exports);function o(){return(typeof self==="undefined"?"undefined":_typeof(self))<"u"&&(typeof DedicatedWorkerGlobalScope==="undefined"?"undefined":_typeof(DedicatedWorkerGlobalScope))<"u"&&self instanceof DedicatedWorkerGlobalScope;}o()&&(self.filterXSS=r.exports);})(B1,B1.exports);var Iu={exports:{}};/**
|
|
440
440
|
* @license
|
|
441
441
|
* Lodash <https://lodash.com/>
|
|
442
442
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
443
443
|
* Released under MIT license <https://lodash.com/license>
|
|
444
444
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
445
445
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
446
|
-
*/Iu.exports;(function(r,t){(function(){var e,n="4.18.1",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="Invalid `imports` option passed into `_.template`",h="__lodash_hash_undefined__",v=500,p="__lodash_placeholder__",y=1,C=2,b=4,M=1,L=2,X=1,Y=2,et=4,A=8,w=16,S=32,x=64,P=128,z=256,U=512,K=30,j="...",nt=800,ct=16,B=1,N=2,G=3,q=1/0,at=9007199254740991,ut=17976931348623157e292,Ct=NaN,R=4294967295,$=R-1,_=R>>>1,H=[["ary",P],["bind",X],["bindKey",Y],["curry",A],["curryRight",w],["flip",U],["partial",S],["partialRight",x],["rearg",z]],lt="[object Arguments]",dt="[object Array]",wt="[object AsyncFunction]",Et="[object Boolean]",Ot="[object Date]",O="[object DOMException]",D="[object Error]",J="[object Function]",Q="[object GeneratorFunction]",V="[object Map]",tt="[object Number]",g="[object Null]",T="[object Object]",k="[object Promise]",Z="[object Proxy]",st="[object RegExp]",ft="[object Set]",pt="[object String]",ot="[object Symbol]",mt="[object Undefined]",
|
|
446
|
+
*/Iu.exports;(function(r,t){(function(){var e,n="4.18.1",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",u="Invalid `imports` option passed into `_.template`",h="__lodash_hash_undefined__",v=500,p="__lodash_placeholder__",y=1,C=2,b=4,M=1,L=2,X=1,Y=2,et=4,A=8,w=16,S=32,x=64,P=128,z=256,U=512,K=30,j="...",nt=800,ct=16,B=1,N=2,G=3,q=1/0,at=9007199254740991,ut=17976931348623157e292,Ct=NaN,R=4294967295,$=R-1,_=R>>>1,H=[["ary",P],["bind",X],["bindKey",Y],["curry",A],["curryRight",w],["flip",U],["partial",S],["partialRight",x],["rearg",z]],lt="[object Arguments]",dt="[object Array]",wt="[object AsyncFunction]",Et="[object Boolean]",Ot="[object Date]",O="[object DOMException]",D="[object Error]",J="[object Function]",Q="[object GeneratorFunction]",V="[object Map]",tt="[object Number]",g="[object Null]",T="[object Object]",k="[object Promise]",Z="[object Proxy]",st="[object RegExp]",ft="[object Set]",pt="[object String]",ot="[object Symbol]",mt="[object Undefined]",It="[object WeakMap]",Pt="[object WeakSet]",Lt="[object ArrayBuffer]",Dt="[object DataView]",Nt="[object Float32Array]",Yt="[object Float64Array]",Ut="[object Int8Array]",Ft="[object Int16Array]",Jt="[object Int32Array]",ee="[object Uint8Array]",re="[object Uint8ClampedArray]",se="[object Uint16Array]",oe="[object Uint32Array]",le=/\b__p \+= '';/g,Re=/\b(__p \+=) '' \+/g,Oe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ke=/&(?:amp|lt|gt|quot|#39);/g,Be=/[&<>"']/g,Ge=RegExp(ke.source),He=RegExp(Be.source),je=/<%-([\s\S]+?)%>/g,ye=/<%([\s\S]+?)%>/g,lr=/<%=([\s\S]+?)%>/g,en=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rn=/^\w*$/,Gn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jn=/[\\^$.*+?()[\]{}|]/g,Qo=RegExp(jn.source),Li=/^\s+/,Jo=/\s/,_o=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ks=/\{\n\/\* \[wrapped with (.+)\] \*/,Qs=/,? & /,Js=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,cs=/[()=,{}\[\]\/\s]/,ta=/\\(\\)?/g,ea=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,An=/\w*$/,us=/^[-+]0x[0-9a-f]+$/i,_s=/^0b[01]+$/i,Sf=/^\[object .+?Constructor\]$/,Tf=/^0o[0-7]+$/i,If=/^(?:0|[1-9]\d*)$/,Cf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,En=/($^)/,xf=/['\n\r\u2028\u2029\\]/g,to="\\ud800-\\udfff",Pf="\\u0300-\\u036f",bf="\\ufe20-\\ufe2f",Af="\\u20d0-\\u20ff",yl=Pf+bf+Af,wl="\\u2700-\\u27bf",Sl="a-z\\xdf-\\xf6\\xf8-\\xff",Ef="\\xac\\xb1\\xd7\\xf7",Tr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Mf="\\u2000-\\u206f",Lf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Tl="A-Z\\xc0-\\xd6\\xd8-\\xde",we="\\ufe0e\\ufe0f",ra=Ef+Tr+Mf+Lf,na="['’]",Rf="["+to+"]",Il="["+ra+"]",eo="["+yl+"]",c="\\d+",d="["+wl+"]",m="["+Sl+"]",E="[^"+to+ra+c+wl+Sl+Tl+"]",F="\\ud83c[\\udffb-\\udfff]",rt="(?:"+eo+"|"+F+")",vt="[^"+to+"]",At="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+Tl+"]",Zt="\\u200d",Xt="(?:"+m+"|"+E+")",ne="(?:"+Wt+"|"+E+")",ue="(?:"+na+"(?:d|ll|m|re|s|t|ve))?",Se="(?:"+na+"(?:D|LL|M|RE|S|T|VE))?",Ie=rt+"?",We="["+we+"]?",Mr="(?:"+Zt+"(?:"+[vt,At,Mt].join("|")+")"+We+Ie+")*",gn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ri="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Cl=We+Ie+Mr,Of="(?:"+[d,At,Mt].join("|")+")"+Cl,Oi="(?:"+[vt+eo+"?",eo,At,Mt,Rf].join("|")+")",tI=RegExp(na,"g"),eI=RegExp(eo,"g"),Df=RegExp(F+"(?="+F+")|"+Oi+Cl,"g"),rI=RegExp([Wt+"?"+m+"+"+ue+"(?="+[Il,Wt,"$"].join("|")+")",ne+"+"+Se+"(?="+[Il,Wt+Xt,"$"].join("|")+")",Wt+"?"+Xt+"+"+ue,Wt+"+"+Se,Ri,gn,c,Of].join("|"),"g"),nI=RegExp("["+Zt+to+yl+we+"]"),iI=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,sI=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],oI=-1,qe={};qe[Nt]=qe[Yt]=qe[Ut]=qe[Ft]=qe[Jt]=qe[ee]=qe[re]=qe[se]=qe[oe]=!0,qe[lt]=qe[dt]=qe[Lt]=qe[Et]=qe[Dt]=qe[Ot]=qe[D]=qe[J]=qe[V]=qe[tt]=qe[T]=qe[st]=qe[ft]=qe[pt]=qe[It]=!1;var Ve={};Ve[lt]=Ve[dt]=Ve[Lt]=Ve[Dt]=Ve[Et]=Ve[Ot]=Ve[Nt]=Ve[Yt]=Ve[Ut]=Ve[Ft]=Ve[Jt]=Ve[V]=Ve[tt]=Ve[T]=Ve[st]=Ve[ft]=Ve[pt]=Ve[ot]=Ve[ee]=Ve[re]=Ve[se]=Ve[oe]=!0,Ve[D]=Ve[J]=Ve[It]=!1;var aI={// Latin-1 Supplement block.
|
|
447
447
|
À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",// Latin Extended-A block.
|
|
448
448
|
Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},lI={"&":"&","<":"<",">":">",'"':""","'":"'"},cI={"&":"&","<":"<",">":">",""":'"',"'":"'"},uI={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},fI=parseFloat,hI=parseInt,$v=_typeof(Qe)=="object"&&Qe&&Qe.Object===Object&&Qe,dI=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,Ir=$v||dI||Function("return this")(),Nf=t&&!t.nodeType&&t,fs=Nf&&!0&&r&&!r.nodeType&&r,Yv=fs&&fs.exports===Nf,kf=Yv&&$v.process,mn=function(){try{var kt=fs&&fs.require&&fs.require("util").types;return kt||kf&&kf.binding&&kf.binding("util");}catch(_unused22){}}(),Gv=mn&&mn.isArrayBuffer,jv=mn&&mn.isDate,Xv=mn&&mn.isMap,Hv=mn&&mn.isRegExp,Vv=mn&&mn.isSet,Zv=mn&&mn.isTypedArray;function nn(kt,jt,zt){switch(zt.length){case 0:return kt.call(jt);case 1:return kt.call(jt,zt[0]);case 2:return kt.call(jt,zt[0],zt[1]);case 3:return kt.call(jt,zt[0],zt[1],zt[2]);}return kt.apply(jt,zt);}function pI(kt,jt,zt,ae){for(var pe=-1,Fe=kt==null?0:kt.length;++pe<Fe;){var fr=kt[pe];jt(ae,fr,zt(fr),kt);}return ae;}function sn(kt,jt){for(var zt=-1,ae=kt==null?0:kt.length;++zt<ae&&jt(kt[zt],zt,kt)!==!1;);return kt;}function vI(kt,jt){for(var zt=kt==null?0:kt.length;zt--&&jt(kt[zt],zt,kt)!==!1;);return kt;}function qv(kt,jt){for(var zt=-1,ae=kt==null?0:kt.length;++zt<ae;)if(!jt(kt[zt],zt,kt))return!1;return!0;}function Di(kt,jt){for(var zt=-1,ae=kt==null?0:kt.length,pe=0,Fe=[];++zt<ae;){var fr=kt[zt];jt(fr,zt,kt)&&(Fe[pe++]=fr);}return Fe;}function xl(kt,jt){var zt=kt==null?0:kt.length;return!!zt&&ro(kt,jt,0)>-1;}function Bf(kt,jt,zt){for(var ae=-1,pe=kt==null?0:kt.length;++ae<pe;)if(zt(jt,kt[ae]))return!0;return!1;}function Je(kt,jt){for(var zt=-1,ae=kt==null?0:kt.length,pe=Array(ae);++zt<ae;)pe[zt]=jt(kt[zt],zt,kt);return pe;}function Ni(kt,jt){for(var zt=-1,ae=jt.length,pe=kt.length;++zt<ae;)kt[pe+zt]=jt[zt];return kt;}function Ff(kt,jt,zt,ae){var pe=-1,Fe=kt==null?0:kt.length;for(ae&&Fe&&(zt=kt[++pe]);++pe<Fe;)zt=jt(zt,kt[pe],pe,kt);return zt;}function gI(kt,jt,zt,ae){var pe=kt==null?0:kt.length;for(ae&&pe&&(zt=kt[--pe]);pe--;)zt=jt(zt,kt[pe],pe,kt);return zt;}function Wf(kt,jt){for(var zt=-1,ae=kt==null?0:kt.length;++zt<ae;)if(jt(kt[zt],zt,kt))return!0;return!1;}var mI=Uf("length");function yI(kt){return kt.split("");}function wI(kt){return kt.match(Js)||[];}function Kv(kt,jt,zt){var ae;return zt(kt,function(pe,Fe,fr){if(jt(pe,Fe,fr))return ae=Fe,!1;}),ae;}function Pl(kt,jt,zt,ae){for(var pe=kt.length,Fe=zt+(ae?1:-1);ae?Fe--:++Fe<pe;)if(jt(kt[Fe],Fe,kt))return Fe;return-1;}function ro(kt,jt,zt){return jt===jt?RI(kt,jt,zt):Pl(kt,Qv,zt);}function SI(kt,jt,zt,ae){for(var pe=zt-1,Fe=kt.length;++pe<Fe;)if(ae(kt[pe],jt))return pe;return-1;}function Qv(kt){return kt!==kt;}function Jv(kt,jt){var zt=kt==null?0:kt.length;return zt?$f(kt,jt)/zt:Ct;}function Uf(kt){return function(jt){return jt==null?e:jt[kt];};}function zf(kt){return function(jt){return kt==null?e:kt[jt];};}function _v(kt,jt,zt,ae,pe){return pe(kt,function(Fe,fr,Xe){zt=ae?(ae=!1,Fe):jt(zt,Fe,fr,Xe);}),zt;}function TI(kt,jt){var zt=kt.length;for(kt.sort(jt);zt--;)kt[zt]=kt[zt].value;return kt;}function $f(kt,jt){for(var zt,ae=-1,pe=kt.length;++ae<pe;){var Fe=jt(kt[ae]);Fe!==e&&(zt=zt===e?Fe:zt+Fe);}return zt;}function Yf(kt,jt){for(var zt=-1,ae=Array(kt);++zt<kt;)ae[zt]=jt(zt);return ae;}function II(kt,jt){return Je(jt,function(zt){return[zt,kt[zt]];});}function tg(kt){return kt&&kt.slice(0,ig(kt)+1).replace(Li,"");}function on(kt){return function(jt){return kt(jt);};}function Gf(kt,jt){return Je(jt,function(zt){return kt[zt];});}function ia(kt,jt){return kt.has(jt);}function eg(kt,jt){for(var zt=-1,ae=kt.length;++zt<ae&&ro(jt,kt[zt],0)>-1;);return zt;}function rg(kt,jt){for(var zt=kt.length;zt--&&ro(jt,kt[zt],0)>-1;);return zt;}function CI(kt,jt){for(var zt=kt.length,ae=0;zt--;)kt[zt]===jt&&++ae;return ae;}var xI=zf(aI),PI=zf(lI);function bI(kt){return"\\"+uI[kt];}function AI(kt,jt){return kt==null?e:kt[jt];}function no(kt){return nI.test(kt);}function EI(kt){return iI.test(kt);}function MI(kt){for(var jt,zt=[];!(jt=kt.next()).done;)zt.push(jt.value);return zt;}function jf(kt){var jt=-1,zt=Array(kt.size);return kt.forEach(function(ae,pe){zt[++jt]=[pe,ae];}),zt;}function ng(kt,jt){return function(zt){return kt(jt(zt));};}function ki(kt,jt){for(var zt=-1,ae=kt.length,pe=0,Fe=[];++zt<ae;){var fr=kt[zt];(fr===jt||fr===p)&&(kt[zt]=p,Fe[pe++]=zt);}return Fe;}function bl(kt){var jt=-1,zt=Array(kt.size);return kt.forEach(function(ae){zt[++jt]=ae;}),zt;}function LI(kt){var jt=-1,zt=Array(kt.size);return kt.forEach(function(ae){zt[++jt]=[ae,ae];}),zt;}function RI(kt,jt,zt){for(var ae=zt-1,pe=kt.length;++ae<pe;)if(kt[ae]===jt)return ae;return-1;}function OI(kt,jt,zt){for(var ae=zt+1;ae--;)if(kt[ae]===jt)return ae;return ae;}function io(kt){return no(kt)?NI(kt):mI(kt);}function Mn(kt){return no(kt)?kI(kt):yI(kt);}function ig(kt){for(var jt=kt.length;jt--&&Jo.test(kt.charAt(jt)););return jt;}var DI=zf(cI);function NI(kt){for(var jt=Df.lastIndex=0;Df.test(kt);)++jt;return jt;}function kI(kt){return kt.match(Df)||[];}function BI(kt){return kt.match(rI)||[];}var FI=function kt(jt){jt=jt==null?Ir:so.defaults(Ir.Object(),jt,so.pick(Ir,sI));var zt=jt.Array,ae=jt.Date,pe=jt.Error,Fe=jt.Function,fr=jt.Math,Xe=jt.Object,Xf=jt.RegExp,WI=jt.String,yn=jt.TypeError,Al=zt.prototype,UI=Fe.prototype,oo=Xe.prototype,El=jt["__core-js_shared__"],Ml=UI.toString,Ue=oo.hasOwnProperty,zI=0,sg=function(){var l=/[^.]+$/.exec(El&&El.keys&&El.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:"";}(),Ll=oo.toString,$I=Ml.call(Xe),YI=Ir._,GI=Xf("^"+Ml.call(Ue).replace(jn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rl=Yv?jt.Buffer:e,Bi=jt.Symbol,Ol=jt.Uint8Array,og=Rl?Rl.allocUnsafe:e,Dl=ng(Xe.getPrototypeOf,Xe),ag=Xe.create,lg=oo.propertyIsEnumerable,Nl=Al.splice,cg=Bi?Bi.isConcatSpreadable:e,sa=Bi?Bi.iterator:e,hs=Bi?Bi.toStringTag:e,kl=function(){try{var l=ms(Xe,"defineProperty");return l({},"",{}),l;}catch(_unused23){}}(),jI=jt.clearTimeout!==Ir.clearTimeout&&jt.clearTimeout,XI=ae&&ae.now!==Ir.Date.now&&ae.now,HI=jt.setTimeout!==Ir.setTimeout&&jt.setTimeout,Bl=fr.ceil,Fl=fr.floor,Hf=Xe.getOwnPropertySymbols,VI=Rl?Rl.isBuffer:e,ug=jt.isFinite,ZI=Al.join,qI=ng(Xe.keys,Xe),hr=fr.max,Lr=fr.min,KI=ae.now,QI=jt.parseInt,fg=fr.random,JI=Al.reverse,Vf=ms(jt,"DataView"),oa=ms(jt,"Map"),Zf=ms(jt,"Promise"),ao=ms(jt,"Set"),aa=ms(jt,"WeakMap"),la=ms(Xe,"create"),Wl=aa&&new aa(),lo={},_I=ys(Vf),tC=ys(oa),eC=ys(Zf),rC=ys(ao),nC=ys(aa),Ul=Bi?Bi.prototype:e,ca=Ul?Ul.valueOf:e,hg=Ul?Ul.toString:e;function gt(l){if(rr(l)&&!ge(l)&&!(l instanceof Ee)){if(l instanceof wn)return l;if(Ue.call(l,"__wrapped__"))return d0(l);}return new wn(l);}var co=/* @__PURE__ */function(){function l(){}return function(f){if(!er(f))return{};if(ag)return ag(f);l.prototype=f;var I=new l();return l.prototype=e,I;};}();function zl(){}function wn(l,f){this.__wrapped__=l,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=e;}gt.templateSettings={/**
|
|
449
449
|
* Used to detect `data` property values to be HTML-escaped.
|
|
@@ -479,13 +479,13 @@ ht(Ro,"eraserSizes",Rv);var wu=Ro;var jxt="__lodash_hash_undefined__";function X
|
|
|
479
479
|
Ht=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
480
480
|
it&&(Ht=="offset"||Ht=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
481
481
|
yt&&(Ht=="buffer"||Ht=="byteLength"||Ht=="byteOffset")||// Skip index properties.
|
|
482
|
-
ai(Ht,Bt)))&&Rt.push(Ht);return Rt;}function pg(l){var f=l.length;return f?l[sh(0,f-1)]:e;}function MC(l,f){return tc(jr(l),vs(f,0,l.length));}function LC(l){return tc(jr(l));}function qf(l,f,I){(I!==e&&!On(l[f],I)||I===e&&!(f in l))&&Xn(l,f,I);}function ua(l,f,I){var W=l[f];(!(Ue.call(l,f)&&On(W,I))||I===e&&!(f in l))&&Xn(l,f,I);}function $l(l,f){for(var I=l.length;I--;)if(On(l[I][0],f))return I;return-1;}function RC(l,f,I,W){return Fi(l,function(it,yt,bt){f(W,it,I(it),bt);}),W;}function vg(l,f){return l&&Vn(f,mr(f),l);}function OC(l,f){return l&&Vn(f,Hr(f),l);}function Xn(l,f,I){f=="__proto__"&&kl?kl(l,f,{configurable:!0,enumerable:!0,value:I,writable:!0}):l[f]=I;}function Kf(l,f){for(var I=-1,W=f.length,it=zt(W),yt=l==null;++I<W;)it[I]=yt?e:Rh(l,f[I]);return it;}function vs(l,f,I){return l===l&&(I!==e&&(l=l<=I?l:I),f!==e&&(l=l>=f?l:f)),l;}function Sn(l,f,I,W,it,yt){var bt,Rt=f&y,Bt=f&C,Ht=f&b;if(I&&(bt=it?I(l,W,it,yt):I(l)),bt!==e)return bt;if(!er(l))return l;var Vt=ge(l);if(Vt){if(bt=Sx(l),!Rt)return jr(l,bt);}else{var qt=Rr(l),ie=qt==J||qt==Q;if($i(l))return Ug(l,Rt);if(qt==T||qt==lt||ie&&!it){if(bt=Bt||ie?{}:i0(l),!Rt)return Bt?cx(l,OC(bt,l)):lx(l,vg(bt,l));}else{if(!Ve[qt])return it?l:{};bt=Tx(l,qt,Rt);}}yt||(yt=new Ln());var ce=yt.get(l);if(ce)return ce;yt.set(l,bt),D0(l)?l.forEach(function(fe){bt.add(Sn(fe,f,I,fe,l,yt));}):R0(l)&&l.forEach(function(fe,be){bt.set(be,Sn(fe,f,I,be,l,yt));});var de=Ht?Bt?gh:vh:Bt?Hr:mr,Ce=Vt?e:de(l);return sn(Ce||l,function(fe,be){Ce&&(be=fe,fe=l[be]),ua(bt,be,Sn(fe,f,I,be,l,yt));}),bt;}function DC(l){var f=mr(l);return function(I){return gg(I,l,f);};}function gg(l,f,I){var W=I.length;if(l==null)return!W;for(l=Xe(l);W--;){var it=I[W],yt=f[it],bt=l[it];if(bt===e&&!(it in l)||!yt(bt))return!1;}return!0;}function mg(l,f,I){if(typeof l!="function")throw new yn(o);return ma(function(){l.apply(e,I);},f);}function fa(l,f,I,W){var it=-1,yt=xl,bt=!0,Rt=l.length,Bt=[],Ht=f.length;if(!Rt)return Bt;I&&(f=Je(f,on(I))),W?(yt=Bf,bt=!1):f.length>=i&&(yt=ia,bt=!1,f=new ps(f));t:for(;++it<Rt;){var Vt=l[it],qt=I==null?Vt:I(Vt);if(Vt=W||Vt!==0?Vt:0,bt&&qt===qt){for(var ie=Ht;ie--;)if(f[ie]===qt)continue t;Bt.push(Vt);}else yt(f,qt,W)||Bt.push(Vt);}return Bt;}var Fi=jg(Hn),yg=jg(Jf,!0);function NC(l,f){var I=!0;return Fi(l,function(W,it,yt){return I=!!f(W,it,yt),I;}),I;}function Yl(l,f,I){for(var W=-1,it=l.length;++W<it;){var yt=l[W],bt=f(yt);if(bt!=null&&(Rt===e?bt===bt&&!ln(bt):I(bt,Rt)))var Rt=bt,Bt=yt;}return Bt;}function kC(l,f,I,W){var it=l.length;for(I=Te(I),I<0&&(I=-I>it?0:it+I),W=W===e||W>it?it:Te(W),W<0&&(W+=it),W=I>W?0:k0(W);I<W;)l[I++]=f;return l;}function wg(l,f){var I=[];return Fi(l,function(W,it,yt){f(W,it,yt)&&I.push(W);}),I;}function Cr(l,f,I,W,it){var yt=-1,bt=l.length;for(I||(I=Cx),it||(it=[]);++yt<bt;){var Rt=l[yt];f>0&&I(Rt)?f>1?Cr(Rt,f-1,I,W,it):Ni(it,Rt):W||(it[it.length]=Rt);}return it;}var Qf=Xg(),Sg=Xg(!0);function Hn(l,f){return l&&Qf(l,f,mr);}function Jf(l,f){return l&&Sg(l,f,mr);}function Gl(l,f){return Di(f,function(I){return li(l[I]);});}function gs(l,f){f=Ui(f,l);for(var I=0,W=f.length;l!=null&&I<W;)l=l[Rn(f[I++])];return I&&I==W?l:e;}function Tg(l,f,I){var W=f(l);return ge(l)?W:Ni(W,I(l));}function Fr(l){return l==null?l===e?mt:g:hs&&hs in Xe(l)?mx(l):Lx(l);}function _f(l,f){return l>f;}function BC(l,f){return l!=null&&Ue.call(l,f);}function FC(l,f){return l!=null&&f in Xe(l);}function WC(l,f,I){return l>=Lr(f,I)&&l<hr(f,I);}function th(l,f,I){for(var W=I?Bf:xl,it=l[0].length,yt=l.length,bt=yt,Rt=zt(yt),Bt=1/0,Ht=[];bt--;){var Vt=l[bt];bt&&f&&(Vt=Je(Vt,on(f))),Bt=Lr(Vt.length,Bt),Rt[bt]=!I&&(f||it>=120&&Vt.length>=120)?new ps(bt&&Vt):e;}Vt=l[0];var qt=-1,ie=Rt[0];t:for(;++qt<it&&Ht.length<Bt;){var ce=Vt[qt],de=f?f(ce):ce;if(ce=I||ce!==0?ce:0,!(ie?ia(ie,de):W(Ht,de,I))){for(bt=yt;--bt;){var Ce=Rt[bt];if(!(Ce?ia(Ce,de):W(l[bt],de,I)))continue t;}ie&&ie.push(de),Ht.push(ce);}}return Ht;}function UC(l,f,I,W){return Hn(l,function(it,yt,bt){f(W,I(it),yt,bt);}),W;}function ha(l,f,I){f=Ui(f,l),l=l0(l,f);var W=l==null?l:l[Rn(In(f))];return W==null?e:nn(W,l,I);}function Ig(l){return rr(l)&&Fr(l)==lt;}function zC(l){return rr(l)&&Fr(l)==Lt;}function $C(l){return rr(l)&&Fr(l)==Ot;}function da(l,f,I,W,it){return l===f?!0:l==null||f==null||!rr(l)&&!rr(f)?l!==l&&f!==f:YC(l,f,I,W,da,it);}function YC(l,f,I,W,it,yt){var bt=ge(l),Rt=ge(f),Bt=bt?dt:Rr(l),Ht=Rt?dt:Rr(f);Bt=Bt==lt?T:Bt,Ht=Ht==lt?T:Ht;var Vt=Bt==T,qt=Ht==T,ie=Bt==Ht;if(ie&&$i(l)){if(!$i(f))return!1;bt=!0,Vt=!1;}if(ie&&!Vt)return yt||(yt=new Ln()),bt||po(l)?e0(l,f,I,W,it,yt):vx(l,f,Bt,I,W,it,yt);if(!(I&M)){var ce=Vt&&Ue.call(l,"__wrapped__"),de=qt&&Ue.call(f,"__wrapped__");if(ce||de){var Ce=ce?l.value():l,fe=de?f.value():f;return yt||(yt=new Ln()),it(Ce,fe,I,W,yt);}}return ie?(yt||(yt=new Ln()),gx(l,f,I,W,it,yt)):!1;}function GC(l){return rr(l)&&Rr(l)==V;}function eh(l,f,I,W){var it=I.length,yt=it,bt=!W;if(l==null)return!yt;for(l=Xe(l);it--;){var Rt=I[it];if(bt&&Rt[2]?Rt[1]!==l[Rt[0]]:!(Rt[0]in l))return!1;}for(;++it<yt;){Rt=I[it];var Bt=Rt[0],Ht=l[Bt],Vt=Rt[1];if(bt&&Rt[2]){if(Ht===e&&!(Bt in l))return!1;}else{var qt=new Ln();if(W)var ie=W(Ht,Vt,Bt,l,f,qt);if(!(ie===e?da(Vt,Ht,M|L,W,qt):ie))return!1;}}return!0;}function Cg(l){if(!er(l)||Px(l))return!1;var f=li(l)?GI:Sf;return f.test(ys(l));}function jC(l){return rr(l)&&Fr(l)==st;}function XC(l){return rr(l)&&Rr(l)==ft;}function HC(l){return rr(l)&&oc(l.length)&&!!qe[Fr(l)];}function xg(l){return typeof l=="function"?l:l==null?Vr:_typeof(l)=="object"?ge(l)?Ag(l[0],l[1]):bg(l):V0(l);}function rh(l){if(!ga(l))return qI(l);var f=[];for(var I in Xe(l))Ue.call(l,I)&&I!="constructor"&&f.push(I);return f;}function VC(l){if(!er(l))return Mx(l);var f=ga(l),I=[];for(var W in l)W=="constructor"&&(f||!Ue.call(l,W))||I.push(W);return I;}function nh(l,f){return l<f;}function Pg(l,f){var I=-1,W=Xr(l)?zt(l.length):[];return Fi(l,function(it,yt,bt){W[++I]=f(it,yt,bt);}),W;}function bg(l){var f=yh(l);return f.length==1&&f[0][2]?o0(f[0][0],f[0][1]):function(I){return I===l||eh(I,l,f);};}function Ag(l,f){return Sh(l)&&s0(f)?o0(Rn(l),f):function(I){var W=Rh(I,l);return W===e&&W===f?Oh(I,l):da(f,W,M|L);};}function jl(l,f,I,W,it){l!==f&&Qf(f,function(yt,bt){if(it||(it=new Ln()),er(yt))ZC(l,f,bt,I,jl,W,it);else{var Rt=W?W(Ih(l,bt),yt,bt+"",l,f,it):e;Rt===e&&(Rt=yt),qf(l,bt,Rt);}},Hr);}function ZC(l,f,I,W,it,yt,bt){var Rt=Ih(l,I),Bt=Ih(f,I),Ht=bt.get(Bt);if(Ht){qf(l,I,Ht);return;}var Vt=yt?yt(Rt,Bt,I+"",l,f,bt):e,qt=Vt===e;if(qt){var ie=ge(Bt),ce=!ie&&$i(Bt),de=!ie&&!ce&&po(Bt);Vt=Bt,ie||ce||de?ge(Rt)?Vt=Rt:ir(Rt)?Vt=jr(Rt):ce?(qt=!1,Vt=Ug(Bt,!0)):de?(qt=!1,Vt=zg(Bt,!0)):Vt=[]:ya(Bt)||ws(Bt)?(Vt=Rt,ws(Rt)?Vt=B0(Rt):(!er(Rt)||li(Rt))&&(Vt=i0(Bt))):qt=!1;}qt&&(bt.set(Bt,Vt),it(Vt,Bt,W,yt,bt),bt.delete(Bt)),qf(l,I,Vt);}function Eg(l,f){var I=l.length;if(I)return f+=f<0?I:0,ai(f,I)?l[f]:e;}function Mg(l,f,I){f.length?f=Je(f,function(yt){return ge(yt)?function(bt){return gs(bt,yt.length===1?yt[0]:yt);}:yt;}):f=[Vr];var W=-1;f=Je(f,on(he()));var it=Pg(l,function(yt,bt,Rt){var Bt=Je(f,function(Ht){return Ht(yt);});return{criteria:Bt,index:++W,value:yt};});return TI(it,function(yt,bt){return ax(yt,bt,I);});}function qC(l,f){return Lg(l,f,function(I,W){return Oh(l,W);});}function Lg(l,f,I){for(var W=-1,it=f.length,yt={};++W<it;){var bt=f[W],Rt=gs(l,bt);I(Rt,bt)&&pa(yt,Ui(bt,l),Rt);}return yt;}function KC(l){return function(f){return gs(f,l);};}function ih(l,f,I,W){var it=W?SI:ro,yt=-1,bt=f.length,Rt=l;for(l===f&&(f=jr(f)),I&&(Rt=Je(l,on(I)));++yt<bt;)for(var Bt=0,Ht=f[yt],Vt=I?I(Ht):Ht;(Bt=it(Rt,Vt,Bt,W))>-1;)Rt!==l&&Nl.call(Rt,Bt,1),Nl.call(l,Bt,1);return l;}function Rg(l,f){for(var I=l?f.length:0,W=I-1;I--;){var it=f[I];if(I==W||it!==yt){var yt=it;ai(it)?Nl.call(l,it,1):lh(l,it);}}return l;}function sh(l,f){return l+Fl(fg()*(f-l+1));}function QC(l,f,I,W){for(var it=-1,yt=hr(Bl((f-l)/(I||1)),0),bt=zt(yt);yt--;)bt[W?yt:++it]=l,l+=I;return bt;}function oh(l,f){var I="";if(!l||f<1||f>at)return I;do f%2&&(I+=l),f=Fl(f/2),f&&(l+=l);while(f);return I;}function xe(l,f){return Ch(a0(l,f,Vr),l+"");}function JC(l){return pg(vo(l));}function _C(l,f){var I=vo(l);return tc(I,vs(f,0,I.length));}function pa(l,f,I,W){if(!er(l))return l;f=Ui(f,l);for(var it=-1,yt=f.length,bt=yt-1,Rt=l;Rt!=null&&++it<yt;){var Bt=Rn(f[it]),Ht=I;if(Bt==="__proto__"||Bt==="constructor"||Bt==="prototype")return l;if(it!=bt){var Vt=Rt[Bt];Ht=W?W(Vt,Bt,Rt):e,Ht===e&&(Ht=er(Vt)?Vt:ai(f[it+1])?[]:{});}ua(Rt,Bt,Ht),Rt=Rt[Bt];}return l;}var Og=Wl?function(l,f){return Wl.set(l,f),l;}:Vr,tx=kl?function(l,f){return kl(l,"toString",{configurable:!0,enumerable:!1,value:Nh(f),writable:!0});}:Vr;function ex(l){return tc(vo(l));}function Tn(l,f,I){var W=-1,it=l.length;f<0&&(f=-f>it?0:it+f),I=I>it?it:I,I<0&&(I+=it),it=f>I?0:I-f>>>0,f>>>=0;for(var yt=zt(it);++W<it;)yt[W]=l[W+f];return yt;}function rx(l,f){var I;return Fi(l,function(W,it,yt){return I=f(W,it,yt),!I;}),!!I;}function Xl(l,f,I){var W=0,it=l==null?W:l.length;if(typeof f=="number"&&f===f&&it<=_){for(;W<it;){var yt=W+it>>>1,bt=l[yt];bt!==null&&!ln(bt)&&(I?bt<=f:bt<f)?W=yt+1:it=yt;}return it;}return ah(l,f,Vr,I);}function ah(l,f,I,W){var it=0,yt=l==null?0:l.length;if(yt===0)return 0;f=I(f);for(var bt=f!==f,Rt=f===null,Bt=ln(f),Ht=f===e;it<yt;){var Vt=Fl((it+yt)/2),qt=I(l[Vt]),ie=qt!==e,ce=qt===null,de=qt===qt,Ce=ln(qt);if(bt)var fe=W||de;else Ht?fe=de&&(W||ie):Rt?fe=de&&ie&&(W||!ce):Bt?fe=de&&ie&&!ce&&(W||!Ce):ce||Ce?fe=!1:fe=W?qt<=f:qt<f;fe?it=Vt+1:yt=Vt;}return Lr(yt,$);}function Dg(l,f){for(var I=-1,W=l.length,it=0,yt=[];++I<W;){var bt=l[I],Rt=f?f(bt):bt;if(!I||!On(Rt,Bt)){var Bt=Rt;yt[it++]=bt===0?0:bt;}}return yt;}function Ng(l){return typeof l=="number"?l:ln(l)?Ct:+l;}function an(l){if(typeof l=="string")return l;if(ge(l))return Je(l,an)+"";if(ln(l))return hg?hg.call(l):"";var f=l+"";return f=="0"&&1/l==-q?"-0":f;}function Wi(l,f,I){var W=-1,it=xl,yt=l.length,bt=!0,Rt=[],Bt=Rt;if(I)bt=!1,it=Bf;else if(yt>=i){var Ht=f?null:dx(l);if(Ht)return bl(Ht);bt=!1,it=ia,Bt=new ps();}else Bt=f?[]:Rt;t:for(;++W<yt;){var Vt=l[W],qt=f?f(Vt):Vt;if(Vt=I||Vt!==0?Vt:0,bt&&qt===qt){for(var ie=Bt.length;ie--;)if(Bt[ie]===qt)continue t;f&&Bt.push(qt),Rt.push(Vt);}else it(Bt,qt,I)||(Bt!==Rt&&Bt.push(qt),Rt.push(Vt));}return Rt;}function lh(l,f){f=Ui(f,l);var I=-1,W=f.length;if(!W)return!0;for(;++I<W;){var it=Rn(f[I]);if(it==="__proto__"&&!Ue.call(l,"__proto__")||(it==="constructor"||it==="prototype")&&I<W-1)return!1;}var yt=l0(l,f);return yt==null||delete yt[Rn(In(f))];}function kg(l,f,I,W){return pa(l,f,I(gs(l,f)),W);}function Hl(l,f,I,W){for(var it=l.length,yt=W?it:-1;(W?yt--:++yt<it)&&f(l[yt],yt,l););return I?Tn(l,W?0:yt,W?yt+1:it):Tn(l,W?yt+1:0,W?it:yt);}function Bg(l,f){var I=l;return I instanceof Ee&&(I=I.value()),Ff(f,function(W,it){return it.func.apply(it.thisArg,Ni([W],it.args));},I);}function ch(l,f,I){var W=l.length;if(W<2)return W?Wi(l[0]):[];for(var it=-1,yt=zt(W);++it<W;)for(var bt=l[it],Rt=-1;++Rt<W;)Rt!=it&&(yt[it]=fa(yt[it]||bt,l[Rt],f,I));return Wi(Cr(yt,1),f,I);}function Fg(l,f,I){for(var W=-1,it=l.length,yt=f.length,bt={};++W<it;){var Rt=W<yt?f[W]:e;I(bt,l[W],Rt);}return bt;}function uh(l){return ir(l)?l:[];}function fh(l){return typeof l=="function"?l:Vr;}function Ui(l,f){return ge(l)?l:Sh(l,f)?[l]:h0(ze(l));}var nx=xe;function zi(l,f,I){var W=l.length;return I=I===e?W:I,!f&&I>=W?l:Tn(l,f,I);}var Wg=jI||function(l){return Ir.clearTimeout(l);};function Ug(l,f){if(f)return l.slice();var I=l.length,W=og?og(I):new l.constructor(I);return l.copy(W),W;}function hh(l){var f=new l.constructor(l.byteLength);return new Ol(f).set(new Ol(l)),f;}function ix(l,f){var I=f?hh(l.buffer):l.buffer;return new l.constructor(I,l.byteOffset,l.byteLength);}function sx(l){var f=new l.constructor(l.source,An.exec(l));return f.lastIndex=l.lastIndex,f;}function ox(l){return ca?Xe(ca.call(l)):{};}function zg(l,f){var I=f?hh(l.buffer):l.buffer;return new l.constructor(I,l.byteOffset,l.length);}function $g(l,f){if(l!==f){var I=l!==e,W=l===null,it=l===l,yt=ln(l),bt=f!==e,Rt=f===null,Bt=f===f,Ht=ln(f);if(!Rt&&!Ht&&!yt&&l>f||yt&&bt&&Bt&&!Rt&&!Ht||W&&bt&&Bt||!I&&Bt||!it)return 1;if(!W&&!yt&&!Ht&&l<f||Ht&&I&&it&&!W&&!yt||Rt&&I&&it||!bt&&it||!Bt)return-1;}return 0;}function ax(l,f,I){for(var W=-1,it=l.criteria,yt=f.criteria,bt=it.length,Rt=I.length;++W<bt;){var Bt=$g(it[W],yt[W]);if(Bt){if(W>=Rt)return Bt;var Ht=I[W];return Bt*(Ht=="desc"?-1:1);}}return l.index-f.index;}function Yg(l,f,I,W){for(var it=-1,yt=l.length,bt=I.length,Rt=-1,Bt=f.length,Ht=hr(yt-bt,0),Vt=zt(Bt+Ht),qt=!W;++Rt<Bt;)Vt[Rt]=f[Rt];for(;++it<bt;)(qt||it<yt)&&(Vt[I[it]]=l[it]);for(;Ht--;)Vt[Rt++]=l[it++];return Vt;}function Gg(l,f,I,W){for(var it=-1,yt=l.length,bt=-1,Rt=I.length,Bt=-1,Ht=f.length,Vt=hr(yt-Rt,0),qt=zt(Vt+Ht),ie=!W;++it<Vt;)qt[it]=l[it];for(var ce=it;++Bt<Ht;)qt[ce+Bt]=f[Bt];for(;++bt<Rt;)(ie||it<yt)&&(qt[ce+I[bt]]=l[it++]);return qt;}function jr(l,f){var I=-1,W=l.length;for(f||(f=zt(W));++I<W;)f[I]=l[I];return f;}function Vn(l,f,I,W){var it=!I;I||(I={});for(var yt=-1,bt=f.length;++yt<bt;){var Rt=f[yt],Bt=W?W(I[Rt],l[Rt],Rt,I,l):e;Bt===e&&(Bt=l[Rt]),it?Xn(I,Rt,Bt):ua(I,Rt,Bt);}return I;}function lx(l,f){return Vn(l,wh(l),f);}function cx(l,f){return Vn(l,r0(l),f);}function Vl(l,f){return function(I,W){var it=ge(I)?pI:RC,yt=f?f():{};return it(I,l,he(W,2),yt);};}function uo(l){return xe(function(f,I){var W=-1,it=I.length,yt=it>1?I[it-1]:e,bt=it>2?I[2]:e;for(yt=l.length>3&&typeof yt=="function"?(it--,yt):e,bt&&Wr(I[0],I[1],bt)&&(yt=it<3?e:yt,it=1),f=Xe(f);++W<it;){var Rt=I[W];Rt&&l(f,Rt,W,yt);}return f;});}function jg(l,f){return function(I,W){if(I==null)return I;if(!Xr(I))return l(I,W);for(var it=I.length,yt=f?it:-1,bt=Xe(I);(f?yt--:++yt<it)&&W(bt[yt],yt,bt)!==!1;);return I;};}function Xg(l){return function(f,I,W){for(var it=-1,yt=Xe(f),bt=W(f),Rt=bt.length;Rt--;){var Bt=bt[l?Rt:++it];if(I(yt[Bt],Bt,yt)===!1)break;}return f;};}function ux(l,f,I){var W=f&X,it=va(l);function yt(){var bt=this&&this!==Ir&&this instanceof yt?it:l;return bt.apply(W?I:this,arguments);}return yt;}function Hg(l){return function(f){f=ze(f);var I=no(f)?Mn(f):e,W=I?I[0]:f.charAt(0),it=I?zi(I,1).join(""):f.slice(1);return W[l]()+it;};}function fo(l){return function(f){return Ff(X0(j0(f).replace(tI,"")),l,"");};}function va(l){return function(){var f=arguments;switch(f.length){case 0:return new l();case 1:return new l(f[0]);case 2:return new l(f[0],f[1]);case 3:return new l(f[0],f[1],f[2]);case 4:return new l(f[0],f[1],f[2],f[3]);case 5:return new l(f[0],f[1],f[2],f[3],f[4]);case 6:return new l(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return new l(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);}var I=co(l.prototype),W=l.apply(I,f);return er(W)?W:I;};}function fx(l,f,I){var W=va(l);function it(){for(var yt=arguments.length,bt=zt(yt),Rt=yt,Bt=ho(it);Rt--;)bt[Rt]=arguments[Rt];var Ht=yt<3&&bt[0]!==Bt&&bt[yt-1]!==Bt?[]:ki(bt,Bt);if(yt-=Ht.length,yt<I)return Qg(l,f,Zl,it.placeholder,e,bt,Ht,e,e,I-yt);var Vt=this&&this!==Ir&&this instanceof it?W:l;return nn(Vt,this,bt);}return it;}function Vg(l){return function(f,I,W){var it=Xe(f);if(!Xr(f)){var yt=he(I,3);f=mr(f),I=function I(Rt){return yt(it[Rt],Rt,it);};}var bt=l(f,I,W);return bt>-1?it[yt?f[bt]:bt]:e;};}function Zg(l){return oi(function(f){var I=f.length,W=I,it=wn.prototype.thru;for(l&&f.reverse();W--;){var yt=f[W];if(typeof yt!="function")throw new yn(o);if(it&&!bt&&Jl(yt)=="wrapper")var bt=new wn([],!0);}for(W=bt?W:I;++W<I;){yt=f[W];var Rt=Jl(yt),Bt=Rt=="wrapper"?mh(yt):e;Bt&&Th(Bt[0])&&Bt[1]==(P|A|S|z)&&!Bt[4].length&&Bt[9]==1?bt=bt[Jl(Bt[0])].apply(bt,Bt[3]):bt=yt.length==1&&Th(yt)?bt[Rt]():bt.thru(yt);}return function(){var Ht=arguments,Vt=Ht[0];if(bt&&Ht.length==1&&ge(Vt))return bt.plant(Vt).value();for(var qt=0,ie=I?f[qt].apply(this,Ht):Vt;++qt<I;)ie=f[qt].call(this,ie);return ie;};});}function Zl(l,f,I,W,it,yt,bt,Rt,Bt,Ht){var Vt=f&P,qt=f&X,ie=f&Y,ce=f&(A|w),de=f&U,Ce=ie?e:va(l);function fe(){for(var be=arguments.length,Le=zt(be),cn=be;cn--;)Le[cn]=arguments[cn];if(ce)var Ur=ho(fe),un=CI(Le,Ur);if(W&&(Le=Yg(Le,W,it,ce)),yt&&(Le=Gg(Le,yt,bt,ce)),be-=un,ce&&be<Ht){var sr=ki(Le,Ur);return Qg(l,f,Zl,fe.placeholder,I,Le,sr,Rt,Bt,Ht-be);}var Dn=qt?I:this,ui=ie?Dn[l]:l;return be=Le.length,Rt?Le=Rx(Le,Rt):de&&be>1&&Le.reverse(),Vt&&Bt<be&&(Le.length=Bt),this&&this!==Ir&&this instanceof fe&&(ui=Ce||va(ui)),ui.apply(Dn,Le);}return fe;}function qg(l,f){return function(I,W){return UC(I,l,f(W),{});};}function ql(l,f){return function(I,W){var it;if(I===e&&W===e)return f;if(I!==e&&(it=I),W!==e){if(it===e)return W;typeof I=="string"||typeof W=="string"?(I=an(I),W=an(W)):(I=Ng(I),W=Ng(W)),it=l(I,W);}return it;};}function dh(l){return oi(function(f){return f=Je(f,on(he())),xe(function(I){var W=this;return l(f,function(it){return nn(it,W,I);});});});}function Kl(l,f){f=f===e?" ":an(f);var I=f.length;if(I<2)return I?oh(f,l):f;var W=oh(f,Bl(l/io(f)));return no(f)?zi(Mn(W),0,l).join(""):W.slice(0,l);}function hx(l,f,I,W){var it=f&X,yt=va(l);function bt(){for(var Rt=-1,Bt=arguments.length,Ht=-1,Vt=W.length,qt=zt(Vt+Bt),ie=this&&this!==Ir&&this instanceof bt?yt:l;++Ht<Vt;)qt[Ht]=W[Ht];for(;Bt--;)qt[Ht++]=arguments[++Rt];return nn(ie,it?I:this,qt);}return bt;}function Kg(l){return function(f,I,W){return W&&typeof W!="number"&&Wr(f,I,W)&&(I=W=e),f=ci(f),I===e?(I=f,f=0):I=ci(I),W=W===e?f<I?1:-1:ci(W),QC(f,I,W,l);};}function Ql(l){return function(f,I){return typeof f=="string"&&typeof I=="string"||(f=Cn(f),I=Cn(I)),l(f,I);};}function Qg(l,f,I,W,it,yt,bt,Rt,Bt,Ht){var Vt=f&A,qt=Vt?bt:e,ie=Vt?e:bt,ce=Vt?yt:e,de=Vt?e:yt;f|=Vt?S:x,f&=~(Vt?x:S),f&et||(f&=-4);var Ce=[l,f,it,ce,qt,de,ie,Rt,Bt,Ht],fe=I.apply(e,Ce);return Th(l)&&c0(fe,Ce),fe.placeholder=W,u0(fe,l,f);}function ph(l){var f=fr[l];return function(I,W){if(I=Cn(I),W=W==null?0:Lr(Te(W),292),W&&ug(I)){var it=(ze(I)+"e").split("e"),yt=f(it[0]+"e"+(+it[1]+W));return it=(ze(yt)+"e").split("e"),+(it[0]+"e"+(+it[1]-W));}return f(I);};}var dx=ao&&1/bl(new ao([,-0]))[1]==q?function(l){return new ao(l);}:Fh;function Jg(l){return function(f){var I=Rr(f);return I==V?jf(f):I==ft?LI(f):II(f,l(f));};}function si(l,f,I,W,it,yt,bt,Rt){var Bt=f&Y;if(!Bt&&typeof l!="function")throw new yn(o);var Ht=W?W.length:0;if(Ht||(f&=-97,W=it=e),bt=bt===e?bt:hr(Te(bt),0),Rt=Rt===e?Rt:Te(Rt),Ht-=it?it.length:0,f&x){var Vt=W,qt=it;W=it=e;}var ie=Bt?e:mh(l),ce=[l,f,I,W,it,Vt,qt,yt,bt,Rt];if(ie&&Ex(ce,ie),l=ce[0],f=ce[1],I=ce[2],W=ce[3],it=ce[4],Rt=ce[9]=ce[9]===e?Bt?0:l.length:hr(ce[9]-Ht,0),!Rt&&f&(A|w)&&(f&=-25),!f||f==X)var de=ux(l,f,I);else f==A||f==w?de=fx(l,f,Rt):(f==S||f==(X|S))&&!it.length?de=hx(l,f,I,W):de=Zl.apply(e,ce);var Ce=ie?Og:c0;return u0(Ce(de,ce),l,f);}function _g(l,f,I,W){return l===e||On(l,oo[I])&&!Ue.call(W,I)?f:l;}function t0(l,f,I,W,it,yt){return er(l)&&er(f)&&(yt.set(f,l),jl(l,f,e,t0,yt),yt.delete(f)),l;}function px(l){return ya(l)?e:l;}function e0(l,f,I,W,it,yt){var bt=I&M,Rt=l.length,Bt=f.length;if(Rt!=Bt&&!(bt&&Bt>Rt))return!1;var Ht=yt.get(l),Vt=yt.get(f);if(Ht&&Vt)return Ht==f&&Vt==l;var qt=-1,ie=!0,ce=I&L?new ps():e;for(yt.set(l,f),yt.set(f,l);++qt<Rt;){var de=l[qt],Ce=f[qt];if(W)var fe=bt?W(Ce,de,qt,f,l,yt):W(de,Ce,qt,l,f,yt);if(fe!==e){if(fe)continue;ie=!1;break;}if(ce){if(!Wf(f,function(be,Le){if(!ia(ce,Le)&&(de===be||it(de,be,I,W,yt)))return ce.push(Le);})){ie=!1;break;}}else if(!(de===Ce||it(de,Ce,I,W,yt))){ie=!1;break;}}return yt.delete(l),yt.delete(f),ie;}function vx(l,f,I,W,it,yt,bt){switch(I){case Dt:if(l.byteLength!=f.byteLength||l.byteOffset!=f.byteOffset)return!1;l=l.buffer,f=f.buffer;case Lt:return!(l.byteLength!=f.byteLength||!yt(new Ol(l),new Ol(f)));case Et:case Ot:case tt:return On(+l,+f);case D:return l.name==f.name&&l.message==f.message;case st:case pt:return l==f+"";case V:var Rt=jf;case ft:var Bt=W&M;if(Rt||(Rt=bl),l.size!=f.size&&!Bt)return!1;var Ht=bt.get(l);if(Ht)return Ht==f;W|=L,bt.set(l,f);var Vt=e0(Rt(l),Rt(f),W,it,yt,bt);return bt.delete(l),Vt;case ot:if(ca)return ca.call(l)==ca.call(f);}return!1;}function gx(l,f,I,W,it,yt){var bt=I&M,Rt=vh(l),Bt=Rt.length,Ht=vh(f),Vt=Ht.length;if(Bt!=Vt&&!bt)return!1;for(var qt=Bt;qt--;){var ie=Rt[qt];if(!(bt?ie in f:Ue.call(f,ie)))return!1;}var ce=yt.get(l),de=yt.get(f);if(ce&&de)return ce==f&&de==l;var Ce=!0;yt.set(l,f),yt.set(f,l);for(var fe=bt;++qt<Bt;){ie=Rt[qt];var be=l[ie],Le=f[ie];if(W)var cn=bt?W(Le,be,ie,f,l,yt):W(be,Le,ie,l,f,yt);if(!(cn===e?be===Le||it(be,Le,I,W,yt):cn)){Ce=!1;break;}fe||(fe=ie=="constructor");}if(Ce&&!fe){var Ur=l.constructor,un=f.constructor;Ur!=un&&"constructor"in l&&"constructor"in f&&!(typeof Ur=="function"&&Ur instanceof Ur&&typeof un=="function"&&un instanceof un)&&(Ce=!1);}return yt.delete(l),yt.delete(f),Ce;}function oi(l){return Ch(a0(l,e,g0),l+"");}function vh(l){return Tg(l,mr,wh);}function gh(l){return Tg(l,Hr,r0);}var mh=Wl?function(l){return Wl.get(l);}:Fh;function Jl(l){for(var f=l.name+"",I=lo[f],W=Ue.call(lo,f)?I.length:0;W--;){var it=I[W],yt=it.func;if(yt==null||yt==l)return it.name;}return f;}function ho(l){var f=Ue.call(gt,"placeholder")?gt:l;return f.placeholder;}function he(){var l=gt.iteratee||kh;return l=l===kh?xg:l,arguments.length?l(arguments[0],arguments[1]):l;}function _l(l,f){var I=l.__data__;return xx(f)?I[typeof f=="string"?"string":"hash"]:I.map;}function yh(l){for(var f=mr(l),I=f.length;I--;){var W=f[I],it=l[W];f[I]=[W,it,s0(it)];}return f;}function ms(l,f){var I=AI(l,f);return Cg(I)?I:e;}function mx(l){var f=Ue.call(l,hs),I=l[hs];try{l[hs]=e;var W=!0;}catch(_unused24){}var it=Ll.call(l);return W&&(f?l[hs]=I:delete l[hs]),it;}var wh=Hf?function(l){return l==null?[]:(l=Xe(l),Di(Hf(l),function(f){return lg.call(l,f);}));}:Wh,r0=Hf?function(l){for(var f=[];l;)Ni(f,wh(l)),l=Dl(l);return f;}:Wh,Rr=Fr;(Vf&&Rr(new Vf(new ArrayBuffer(1)))!=Dt||oa&&Rr(new oa())!=V||Zf&&Rr(Zf.resolve())!=k||ao&&Rr(new ao())!=ft||aa&&Rr(new aa())!=Tt)&&(Rr=function Rr(l){var f=Fr(l),I=f==T?l.constructor:e,W=I?ys(I):"";if(W)switch(W){case _I:return Dt;case tC:return V;case eC:return k;case rC:return ft;case nC:return Tt;}return f;});function yx(l,f,I){for(var W=-1,it=I.length;++W<it;){var yt=I[W],bt=yt.size;switch(yt.type){case"drop":l+=bt;break;case"dropRight":f-=bt;break;case"take":f=Lr(f,l+bt);break;case"takeRight":l=hr(l,f-bt);break;}}return{start:l,end:f};}function wx(l){var f=l.match(Ks);return f?f[1].split(Qs):[];}function n0(l,f,I){f=Ui(f,l);for(var W=-1,it=f.length,yt=!1;++W<it;){var bt=Rn(f[W]);if(!(yt=l!=null&&I(l,bt)))break;l=l[bt];}return yt||++W!=it?yt:(it=l==null?0:l.length,!!it&&oc(it)&&ai(bt,it)&&(ge(l)||ws(l)));}function Sx(l){var f=l.length,I=new l.constructor(f);return f&&typeof l[0]=="string"&&Ue.call(l,"index")&&(I.index=l.index,I.input=l.input),I;}function i0(l){return typeof l.constructor=="function"&&!ga(l)?co(Dl(l)):{};}function Tx(l,f,I){var W=l.constructor;switch(f){case Lt:return hh(l);case Et:case Ot:return new W(+l);case Dt:return ix(l,I);case Nt:case Yt:case Ut:case Ft:case Jt:case ee:case re:case se:case oe:return zg(l,I);case V:return new W();case tt:case pt:return new W(l);case st:return sx(l);case ft:return new W();case ot:return ox(l);}}function Ix(l,f){var I=f.length;if(!I)return l;var W=I-1;return f[W]=(I>1?"& ":"")+f[W],f=f.join(I>2?", ":" "),l.replace(_o,"{\n/* [wrapped with "+f+"] */\n");}function Cx(l){return ge(l)||ws(l)||!!(cg&&l&&l[cg]);}function ai(l,f){var I=_typeof(l);return f=f!==null&&f!==void 0?f:at,!!f&&(I=="number"||I!="symbol"&&If.test(l))&&l>-1&&l%1==0&&l<f;}function Wr(l,f,I){if(!er(I))return!1;var W=_typeof(f);return(W=="number"?Xr(I)&&ai(f,I.length):W=="string"&&f in I)?On(I[f],l):!1;}function Sh(l,f){if(ge(l))return!1;var I=_typeof(l);return I=="number"||I=="symbol"||I=="boolean"||l==null||ln(l)?!0:rn.test(l)||!en.test(l)||f!=null&&l in Xe(f);}function xx(l){var f=_typeof(l);return f=="string"||f=="number"||f=="symbol"||f=="boolean"?l!=="__proto__":l===null;}function Th(l){var f=Jl(l),I=gt[f];if(typeof I!="function"||!(f in Ee.prototype))return!1;if(l===I)return!0;var W=mh(I);return!!W&&l===W[0];}function Px(l){return!!sg&&sg in l;}var bx=El?li:Uh;function ga(l){var f=l&&l.constructor,I=typeof f=="function"&&f.prototype||oo;return l===I;}function s0(l){return l===l&&!er(l);}function o0(l,f){return function(I){return I==null?!1:I[l]===f&&(f!==e||l in Xe(I));};}function Ax(l){var f=ic(l,function(W){return I.size===v&&I.clear(),W;}),I=f.cache;return f;}function Ex(l,f){var I=l[1],W=f[1],it=I|W,yt=it<(X|Y|P),bt=W==P&&I==A||W==P&&I==z&&l[7].length<=f[8]||W==(P|z)&&f[7].length<=f[8]&&I==A;if(!(yt||bt))return l;W&X&&(l[2]=f[2],it|=I&X?0:et);var Rt=f[3];if(Rt){var Bt=l[3];l[3]=Bt?Yg(Bt,Rt,f[4]):Rt,l[4]=Bt?ki(l[3],p):f[4];}return Rt=f[5],Rt&&(Bt=l[5],l[5]=Bt?Gg(Bt,Rt,f[6]):Rt,l[6]=Bt?ki(l[5],p):f[6]),Rt=f[7],Rt&&(l[7]=Rt),W&P&&(l[8]=l[8]==null?f[8]:Lr(l[8],f[8])),l[9]==null&&(l[9]=f[9]),l[0]=f[0],l[1]=it,l;}function Mx(l){var f=[];if(l!=null)for(var I in Xe(l))f.push(I);return f;}function Lx(l){return Ll.call(l);}function a0(l,f,I){return f=hr(f===e?l.length-1:f,0),function(){for(var W=arguments,it=-1,yt=hr(W.length-f,0),bt=zt(yt);++it<yt;)bt[it]=W[f+it];it=-1;for(var Rt=zt(f+1);++it<f;)Rt[it]=W[it];return Rt[f]=I(bt),nn(l,this,Rt);};}function l0(l,f){return f.length<2?l:gs(l,Tn(f,0,-1));}function Rx(l,f){for(var I=l.length,W=Lr(f.length,I),it=jr(l);W--;){var yt=f[W];l[W]=ai(yt,I)?it[yt]:e;}return l;}function Ih(l,f){if(!(f==="constructor"&&typeof l[f]=="function")&&f!="__proto__")return l[f];}var c0=f0(Og),ma=HI||function(l,f){return Ir.setTimeout(l,f);},Ch=f0(tx);function u0(l,f,I){var W=f+"";return Ch(l,Ix(W,Ox(wx(W),I)));}function f0(l){var f=0,I=0;return function(){var W=KI(),it=ct-(W-I);if(I=W,it>0){if(++f>=nt)return arguments[0];}else f=0;return l.apply(e,arguments);};}function tc(l,f){var I=-1,W=l.length,it=W-1;for(f=f===e?W:f;++I<f;){var yt=sh(I,it),bt=l[yt];l[yt]=l[I],l[I]=bt;}return l.length=f,l;}var h0=Ax(function(l){var f=[];return l.charCodeAt(0)===46&&f.push(""),l.replace(Gn,function(I,W,it,yt){f.push(it?yt.replace(ta,"$1"):W||I);}),f;});function Rn(l){if(typeof l=="string"||ln(l))return l;var f=l+"";return f=="0"&&1/l==-q?"-0":f;}function ys(l){if(l!=null){try{return Ml.call(l);}catch(_unused25){}try{return l+"";}catch(_unused26){}}return"";}function Ox(l,f){return sn(H,function(I){var W="_."+I[0];f&I[1]&&!xl(l,W)&&l.push(W);}),l.sort();}function d0(l){if(l instanceof Ee)return l.clone();var f=new wn(l.__wrapped__,l.__chain__);return f.__actions__=jr(l.__actions__),f.__index__=l.__index__,f.__values__=l.__values__,f;}function Dx(l,f,I){(I?Wr(l,f,I):f===e)?f=1:f=hr(Te(f),0);var W=l==null?0:l.length;if(!W||f<1)return[];for(var it=0,yt=0,bt=zt(Bl(W/f));it<W;)bt[yt++]=Tn(l,it,it+=f);return bt;}function Nx(l){for(var f=-1,I=l==null?0:l.length,W=0,it=[];++f<I;){var yt=l[f];yt&&(it[W++]=yt);}return it;}function kx(){var l=arguments.length;if(!l)return[];for(var f=zt(l-1),I=arguments[0],W=l;W--;)f[W-1]=arguments[W];return Ni(ge(I)?jr(I):[I],Cr(f,1));}var Bx=xe(function(l,f){return ir(l)?fa(l,Cr(f,1,ir,!0)):[];}),Fx=xe(function(l,f){var I=In(f);return ir(I)&&(I=e),ir(l)?fa(l,Cr(f,1,ir,!0),he(I,2)):[];}),Wx=xe(function(l,f){var I=In(f);return ir(I)&&(I=e),ir(l)?fa(l,Cr(f,1,ir,!0),e,I):[];});function Ux(l,f,I){var W=l==null?0:l.length;return W?(f=I||f===e?1:Te(f),Tn(l,f<0?0:f,W)):[];}function zx(l,f,I){var W=l==null?0:l.length;return W?(f=I||f===e?1:Te(f),f=W-f,Tn(l,0,f<0?0:f)):[];}function $x(l,f){return l&&l.length?Hl(l,he(f,3),!0,!0):[];}function Yx(l,f){return l&&l.length?Hl(l,he(f,3),!0):[];}function Gx(l,f,I,W){var it=l==null?0:l.length;return it?(I&&typeof I!="number"&&Wr(l,f,I)&&(I=0,W=it),kC(l,f,I,W)):[];}function p0(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=I==null?0:Te(I);return it<0&&(it=hr(W+it,0)),Pl(l,he(f,3),it);}function v0(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=W-1;return I!==e&&(it=Te(I),it=I<0?hr(W+it,0):Lr(it,W-1)),Pl(l,he(f,3),it,!0);}function g0(l){var f=l==null?0:l.length;return f?Cr(l,1):[];}function jx(l){var f=l==null?0:l.length;return f?Cr(l,q):[];}function Xx(l,f){var I=l==null?0:l.length;return I?(f=f===e?1:Te(f),Cr(l,f)):[];}function Hx(l){for(var f=-1,I=l==null?0:l.length,W={};++f<I;){var it=l[f];Xn(W,it[0],it[1]);}return W;}function m0(l){return l&&l.length?l[0]:e;}function Vx(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=I==null?0:Te(I);return it<0&&(it=hr(W+it,0)),ro(l,f,it);}function Zx(l){var f=l==null?0:l.length;return f?Tn(l,0,-1):[];}var qx=xe(function(l){var f=Je(l,uh);return f.length&&f[0]===l[0]?th(f):[];}),Kx=xe(function(l){var f=In(l),I=Je(l,uh);return f===In(I)?f=e:I.pop(),I.length&&I[0]===l[0]?th(I,he(f,2)):[];}),Qx=xe(function(l){var f=In(l),I=Je(l,uh);return f=typeof f=="function"?f:e,f&&I.pop(),I.length&&I[0]===l[0]?th(I,e,f):[];});function Jx(l,f){return l==null?"":ZI.call(l,f);}function In(l){var f=l==null?0:l.length;return f?l[f-1]:e;}function _x(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=W;return I!==e&&(it=Te(I),it=it<0?hr(W+it,0):Lr(it,W-1)),f===f?OI(l,f,it):Pl(l,Qv,it,!0);}function tP(l,f){return l&&l.length?Eg(l,Te(f)):e;}var eP=xe(y0);function y0(l,f){return l&&l.length&&f&&f.length?ih(l,f):l;}function rP(l,f,I){return l&&l.length&&f&&f.length?ih(l,f,he(I,2)):l;}function nP(l,f,I){return l&&l.length&&f&&f.length?ih(l,f,e,I):l;}var iP=oi(function(l,f){var I=l==null?0:l.length,W=Kf(l,f);return Rg(l,Je(f,function(it){return ai(it,I)?+it:it;}).sort($g)),W;});function sP(l,f){var I=[];if(!(l&&l.length))return I;var W=-1,it=[],yt=l.length;for(f=he(f,3);++W<yt;){var bt=l[W];f(bt,W,l)&&(I.push(bt),it.push(W));}return Rg(l,it),I;}function xh(l){return l==null?l:JI.call(l);}function oP(l,f,I){var W=l==null?0:l.length;return W?(I&&typeof I!="number"&&Wr(l,f,I)?(f=0,I=W):(f=f==null?0:Te(f),I=I===e?W:Te(I)),Tn(l,f,I)):[];}function aP(l,f){return Xl(l,f);}function lP(l,f,I){return ah(l,f,he(I,2));}function cP(l,f){var I=l==null?0:l.length;if(I){var W=Xl(l,f);if(W<I&&On(l[W],f))return W;}return-1;}function uP(l,f){return Xl(l,f,!0);}function fP(l,f,I){return ah(l,f,he(I,2),!0);}function hP(l,f){var I=l==null?0:l.length;if(I){var W=Xl(l,f,!0)-1;if(On(l[W],f))return W;}return-1;}function dP(l){return l&&l.length?Dg(l):[];}function pP(l,f){return l&&l.length?Dg(l,he(f,2)):[];}function vP(l){var f=l==null?0:l.length;return f?Tn(l,1,f):[];}function gP(l,f,I){return l&&l.length?(f=I||f===e?1:Te(f),Tn(l,0,f<0?0:f)):[];}function mP(l,f,I){var W=l==null?0:l.length;return W?(f=I||f===e?1:Te(f),f=W-f,Tn(l,f<0?0:f,W)):[];}function yP(l,f){return l&&l.length?Hl(l,he(f,3),!1,!0):[];}function wP(l,f){return l&&l.length?Hl(l,he(f,3)):[];}var SP=xe(function(l){return Wi(Cr(l,1,ir,!0));}),TP=xe(function(l){var f=In(l);return ir(f)&&(f=e),Wi(Cr(l,1,ir,!0),he(f,2));}),IP=xe(function(l){var f=In(l);return f=typeof f=="function"?f:e,Wi(Cr(l,1,ir,!0),e,f);});function CP(l){return l&&l.length?Wi(l):[];}function xP(l,f){return l&&l.length?Wi(l,he(f,2)):[];}function PP(l,f){return f=typeof f=="function"?f:e,l&&l.length?Wi(l,e,f):[];}function Ph(l){if(!(l&&l.length))return[];var f=0;return l=Di(l,function(I){if(ir(I))return f=hr(I.length,f),!0;}),Yf(f,function(I){return Je(l,Uf(I));});}function w0(l,f){if(!(l&&l.length))return[];var I=Ph(l);return f==null?I:Je(I,function(W){return nn(f,e,W);});}var bP=xe(function(l,f){return ir(l)?fa(l,f):[];}),AP=xe(function(l){return ch(Di(l,ir));}),EP=xe(function(l){var f=In(l);return ir(f)&&(f=e),ch(Di(l,ir),he(f,2));}),MP=xe(function(l){var f=In(l);return f=typeof f=="function"?f:e,ch(Di(l,ir),e,f);}),LP=xe(Ph);function RP(l,f){return Fg(l||[],f||[],ua);}function OP(l,f){return Fg(l||[],f||[],pa);}var DP=xe(function(l){var f=l.length,I=f>1?l[f-1]:e;return I=typeof I=="function"?(l.pop(),I):e,w0(l,I);});function S0(l){var f=gt(l);return f.__chain__=!0,f;}function NP(l,f){return f(l),l;}function ec(l,f){return f(l);}var kP=oi(function(l){var f=l.length,I=f?l[0]:0,W=this.__wrapped__,it=function it(yt){return Kf(yt,l);};return f>1||this.__actions__.length||!(W instanceof Ee)||!ai(I)?this.thru(it):(W=W.slice(I,+I+(f?1:0)),W.__actions__.push({func:ec,args:[it],thisArg:e}),new wn(W,this.__chain__).thru(function(yt){return f&&!yt.length&&yt.push(e),yt;}));});function BP(){return S0(this);}function FP(){return new wn(this.value(),this.__chain__);}function WP(){this.__values__===e&&(this.__values__=N0(this.value()));var l=this.__index__>=this.__values__.length,f=l?e:this.__values__[this.__index__++];return{done:l,value:f};}function UP(){return this;}function zP(l){for(var f,I=this;I instanceof zl;){var W=d0(I);W.__index__=0,W.__values__=e,f?it.__wrapped__=W:f=W;var it=W;I=I.__wrapped__;}return it.__wrapped__=l,f;}function $P(){var l=this.__wrapped__;if(l instanceof Ee){var f=l;return this.__actions__.length&&(f=new Ee(this)),f=f.reverse(),f.__actions__.push({func:ec,args:[xh],thisArg:e}),new wn(f,this.__chain__);}return this.thru(xh);}function YP(){return Bg(this.__wrapped__,this.__actions__);}var GP=Vl(function(l,f,I){Ue.call(l,I)?++l[I]:Xn(l,I,1);});function jP(l,f,I){var W=ge(l)?qv:NC;return I&&Wr(l,f,I)&&(f=e),W(l,he(f,3));}function XP(l,f){var I=ge(l)?Di:wg;return I(l,he(f,3));}var HP=Vg(p0),VP=Vg(v0);function ZP(l,f){return Cr(rc(l,f),1);}function qP(l,f){return Cr(rc(l,f),q);}function KP(l,f,I){return I=I===e?1:Te(I),Cr(rc(l,f),I);}function T0(l,f){var I=ge(l)?sn:Fi;return I(l,he(f,3));}function I0(l,f){var I=ge(l)?vI:yg;return I(l,he(f,3));}var QP=Vl(function(l,f,I){Ue.call(l,I)?l[I].push(f):Xn(l,I,[f]);});function JP(l,f,I,W){l=Xr(l)?l:vo(l),I=I&&!W?Te(I):0;var it=l.length;return I<0&&(I=hr(it+I,0)),ac(l)?I<=it&&l.indexOf(f,I)>-1:!!it&&ro(l,f,I)>-1;}var _P=xe(function(l,f,I){var W=-1,it=typeof f=="function",yt=Xr(l)?zt(l.length):[];return Fi(l,function(bt){yt[++W]=it?nn(f,bt,I):ha(bt,f,I);}),yt;}),tb=Vl(function(l,f,I){Xn(l,I,f);});function rc(l,f){var I=ge(l)?Je:Pg;return I(l,he(f,3));}function eb(l,f,I,W){return l==null?[]:(ge(f)||(f=f==null?[]:[f]),I=W?e:I,ge(I)||(I=I==null?[]:[I]),Mg(l,f,I));}var rb=Vl(function(l,f,I){l[I?0:1].push(f);},function(){return[[],[]];});function nb(l,f,I){var W=ge(l)?Ff:_v,it=arguments.length<3;return W(l,he(f,4),I,it,Fi);}function ib(l,f,I){var W=ge(l)?gI:_v,it=arguments.length<3;return W(l,he(f,4),I,it,yg);}function sb(l,f){var I=ge(l)?Di:wg;return I(l,sc(he(f,3)));}function ob(l){var f=ge(l)?pg:JC;return f(l);}function ab(l,f,I){(I?Wr(l,f,I):f===e)?f=1:f=Te(f);var W=ge(l)?MC:_C;return W(l,f);}function lb(l){var f=ge(l)?LC:ex;return f(l);}function cb(l){if(l==null)return 0;if(Xr(l))return ac(l)?io(l):l.length;var f=Rr(l);return f==V||f==ft?l.size:rh(l).length;}function ub(l,f,I){var W=ge(l)?Wf:rx;return I&&Wr(l,f,I)&&(f=e),W(l,he(f,3));}var fb=xe(function(l,f){if(l==null)return[];var I=f.length;return I>1&&Wr(l,f[0],f[1])?f=[]:I>2&&Wr(f[0],f[1],f[2])&&(f=[f[0]]),Mg(l,Cr(f,1),[]);}),nc=XI||function(){return Ir.Date.now();};function hb(l,f){if(typeof f!="function")throw new yn(o);return l=Te(l),function(){if(--l<1)return f.apply(this,arguments);};}function C0(l,f,I){return f=I?e:f,f=l&&f==null?l.length:f,si(l,P,e,e,e,e,f);}function x0(l,f){var I;if(typeof f!="function")throw new yn(o);return l=Te(l),function(){return--l>0&&(I=f.apply(this,arguments)),l<=1&&(f=e),I;};}var bh=xe(function(l,f,I){var W=X;if(I.length){var it=ki(I,ho(bh));W|=S;}return si(l,W,f,I,it);}),P0=xe(function(l,f,I){var W=X|Y;if(I.length){var it=ki(I,ho(P0));W|=S;}return si(f,W,l,I,it);});function b0(l,f,I){f=I?e:f;var W=si(l,A,e,e,e,e,e,f);return W.placeholder=b0.placeholder,W;}function A0(l,f,I){f=I?e:f;var W=si(l,w,e,e,e,e,e,f);return W.placeholder=A0.placeholder,W;}function E0(l,f,I){var W,it,yt,bt,Rt,Bt,Ht=0,Vt=!1,qt=!1,ie=!0;if(typeof l!="function")throw new yn(o);f=Cn(f)||0,er(I)&&(Vt=!!I.leading,qt="maxWait"in I,yt=qt?hr(Cn(I.maxWait)||0,f):yt,ie="trailing"in I?!!I.trailing:ie);function ce(sr){var Dn=W,ui=it;return W=it=e,Ht=sr,bt=l.apply(ui,Dn),bt;}function de(sr){return Ht=sr,Rt=ma(be,f),Vt?ce(sr):bt;}function Ce(sr){var Dn=sr-Bt,ui=sr-Ht,Z0=f-Dn;return qt?Lr(Z0,yt-ui):Z0;}function fe(sr){var Dn=sr-Bt,ui=sr-Ht;return Bt===e||Dn>=f||Dn<0||qt&&ui>=yt;}function be(){var sr=nc();if(fe(sr))return Le(sr);Rt=ma(be,Ce(sr));}function Le(sr){return Rt=e,ie&&W?ce(sr):(W=it=e,bt);}function cn(){Rt!==e&&Wg(Rt),Ht=0,W=Bt=it=Rt=e;}function Ur(){return Rt===e?bt:Le(nc());}function un(){var sr=nc(),Dn=fe(sr);if(W=arguments,it=this,Bt=sr,Dn){if(Rt===e)return de(Bt);if(qt)return Wg(Rt),Rt=ma(be,f),ce(Bt);}return Rt===e&&(Rt=ma(be,f)),bt;}return un.cancel=cn,un.flush=Ur,un;}var db=xe(function(l,f){return mg(l,1,f);}),pb=xe(function(l,f,I){return mg(l,Cn(f)||0,I);});function vb(l){return si(l,U);}function ic(l,f){if(typeof l!="function"||f!=null&&typeof f!="function")throw new yn(o);var _I2=function I(){var W=arguments,it=f?f.apply(this,W):W[0],yt=_I2.cache;if(yt.has(it))return yt.get(it);var bt=l.apply(this,W);return _I2.cache=yt.set(it,bt)||yt,bt;};return _I2.cache=new(ic.Cache||ii)(),_I2;}ic.Cache=ii;function sc(l){if(typeof l!="function")throw new yn(o);return function(){var f=arguments;switch(f.length){case 0:return!l.call(this);case 1:return!l.call(this,f[0]);case 2:return!l.call(this,f[0],f[1]);case 3:return!l.call(this,f[0],f[1],f[2]);}return!l.apply(this,f);};}function gb(l){return x0(2,l);}var mb=nx(function(l,f){f=f.length==1&&ge(f[0])?Je(f[0],on(he())):Je(Cr(f,1),on(he()));var I=f.length;return xe(function(W){for(var it=-1,yt=Lr(W.length,I);++it<yt;)W[it]=f[it].call(this,W[it]);return nn(l,this,W);});}),Ah=xe(function(l,f){var I=ki(f,ho(Ah));return si(l,S,e,f,I);}),M0=xe(function(l,f){var I=ki(f,ho(M0));return si(l,x,e,f,I);}),yb=oi(function(l,f){return si(l,z,e,e,e,f);});function wb(l,f){if(typeof l!="function")throw new yn(o);return f=f===e?f:Te(f),xe(l,f);}function Sb(l,f){if(typeof l!="function")throw new yn(o);return f=f==null?0:hr(Te(f),0),xe(function(I){var W=I[f],it=zi(I,0,f);return W&&Ni(it,W),nn(l,this,it);});}function Tb(l,f,I){var W=!0,it=!0;if(typeof l!="function")throw new yn(o);return er(I)&&(W="leading"in I?!!I.leading:W,it="trailing"in I?!!I.trailing:it),E0(l,f,{leading:W,maxWait:f,trailing:it});}function Ib(l){return C0(l,1);}function Cb(l,f){return Ah(fh(f),l);}function xb(){if(!arguments.length)return[];var l=arguments[0];return ge(l)?l:[l];}function Pb(l){return Sn(l,b);}function bb(l,f){return f=typeof f=="function"?f:e,Sn(l,b,f);}function Ab(l){return Sn(l,y|b);}function Eb(l,f){return f=typeof f=="function"?f:e,Sn(l,y|b,f);}function Mb(l,f){return f==null||gg(l,f,mr(f));}function On(l,f){return l===f||l!==l&&f!==f;}var Lb=Ql(_f),Rb=Ql(function(l,f){return l>=f;}),ws=Ig(/* @__PURE__ */function(){return arguments;}())?Ig:function(l){return rr(l)&&Ue.call(l,"callee")&&!lg.call(l,"callee");},ge=zt.isArray,Ob=Gv?on(Gv):zC;function Xr(l){return l!=null&&oc(l.length)&&!li(l);}function ir(l){return rr(l)&&Xr(l);}function Db(l){return l===!0||l===!1||rr(l)&&Fr(l)==Et;}var $i=VI||Uh,Nb=jv?on(jv):$C;function kb(l){return rr(l)&&l.nodeType===1&&!ya(l);}function Bb(l){if(l==null)return!0;if(Xr(l)&&(ge(l)||typeof l=="string"||typeof l.splice=="function"||$i(l)||po(l)||ws(l)))return!l.length;var f=Rr(l);if(f==V||f==ft)return!l.size;if(ga(l))return!rh(l).length;for(var I in l)if(Ue.call(l,I))return!1;return!0;}function Fb(l,f){return da(l,f);}function Wb(l,f,I){I=typeof I=="function"?I:e;var W=I?I(l,f):e;return W===e?da(l,f,e,I):!!W;}function Eh(l){if(!rr(l))return!1;var f=Fr(l);return f==D||f==O||typeof l.message=="string"&&typeof l.name=="string"&&!ya(l);}function Ub(l){return typeof l=="number"&&ug(l);}function li(l){if(!er(l))return!1;var f=Fr(l);return f==J||f==Q||f==wt||f==Z;}function L0(l){return typeof l=="number"&&l==Te(l);}function oc(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=at;}function er(l){var f=_typeof(l);return l!=null&&(f=="object"||f=="function");}function rr(l){return l!=null&&_typeof(l)=="object";}var R0=Xv?on(Xv):GC;function zb(l,f){return l===f||eh(l,f,yh(f));}function $b(l,f,I){return I=typeof I=="function"?I:e,eh(l,f,yh(f),I);}function Yb(l){return O0(l)&&l!=+l;}function Gb(l){if(bx(l))throw new pe(s);return Cg(l);}function jb(l){return l===null;}function Xb(l){return l==null;}function O0(l){return typeof l=="number"||rr(l)&&Fr(l)==tt;}function ya(l){if(!rr(l)||Fr(l)!=T)return!1;var f=Dl(l);if(f===null)return!0;var I=Ue.call(f,"constructor")&&f.constructor;return typeof I=="function"&&I instanceof I&&Ml.call(I)==$I;}var Mh=Hv?on(Hv):jC;function Hb(l){return L0(l)&&l>=-at&&l<=at;}var D0=Vv?on(Vv):XC;function ac(l){return typeof l=="string"||!ge(l)&&rr(l)&&Fr(l)==pt;}function ln(l){return _typeof(l)=="symbol"||rr(l)&&Fr(l)==ot;}var po=Zv?on(Zv):HC;function Vb(l){return l===e;}function Zb(l){return rr(l)&&Rr(l)==Tt;}function qb(l){return rr(l)&&Fr(l)==Pt;}var Kb=Ql(nh),Qb=Ql(function(l,f){return l<=f;});function N0(l){if(!l)return[];if(Xr(l))return ac(l)?Mn(l):jr(l);if(sa&&l[sa])return MI(l[sa]());var f=Rr(l),I=f==V?jf:f==ft?bl:vo;return I(l);}function ci(l){if(!l)return l===0?l:0;if(l=Cn(l),l===q||l===-q){var f=l<0?-1:1;return f*ut;}return l===l?l:0;}function Te(l){var f=ci(l),I=f%1;return f===f?I?f-I:f:0;}function k0(l){return l?vs(Te(l),0,R):0;}function Cn(l){if(typeof l=="number")return l;if(ln(l))return Ct;if(er(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=er(f)?f+"":f;}if(typeof l!="string")return l===0?l:+l;l=tg(l);var I=_s.test(l);return I||Tf.test(l)?hI(l.slice(2),I?2:8):us.test(l)?Ct:+l;}function B0(l){return Vn(l,Hr(l));}function Jb(l){return l?vs(Te(l),-at,at):l===0?l:0;}function ze(l){return l==null?"":an(l);}var _b=uo(function(l,f){if(ga(f)||Xr(f)){Vn(f,mr(f),l);return;}for(var I in f)Ue.call(f,I)&&ua(l,I,f[I]);}),F0=uo(function(l,f){Vn(f,Hr(f),l);}),W0=uo(function(l,f,I,W){Vn(f,Hr(f),l,W);}),Lh=uo(function(l,f,I,W){Vn(f,mr(f),l,W);}),tA=oi(Kf);function eA(l,f){var I=co(l);return f==null?I:vg(I,f);}var rA=xe(function(l,f){l=Xe(l);var I=-1,W=f.length,it=W>2?f[2]:e;for(it&&Wr(f[0],f[1],it)&&(W=1);++I<W;)for(var yt=f[I],bt=Hr(yt),Rt=-1,Bt=bt.length;++Rt<Bt;){var Ht=bt[Rt],Vt=l[Ht];(Vt===e||On(Vt,oo[Ht])&&!Ue.call(l,Ht))&&(l[Ht]=yt[Ht]);}return l;}),nA=xe(function(l){return l.push(e,t0),nn(U0,e,l);});function iA(l,f){return Kv(l,he(f,3),Hn);}function sA(l,f){return Kv(l,he(f,3),Jf);}function oA(l,f){return l==null?l:Qf(l,he(f,3),Hr);}function aA(l,f){return l==null?l:Sg(l,he(f,3),Hr);}function lA(l,f){return l&&Hn(l,he(f,3));}function cA(l,f){return l&&Jf(l,he(f,3));}function uA(l){return l==null?[]:Gl(l,mr(l));}function fA(l){return l==null?[]:Gl(l,Hr(l));}function Rh(l,f,I){var W=l==null?e:gs(l,f);return W===e?I:W;}function hA(l,f){return l!=null&&n0(l,f,BC);}function Oh(l,f){return l!=null&&n0(l,f,FC);}var dA=qg(function(l,f,I){f!=null&&typeof f.toString!="function"&&(f=Ll.call(f)),l[f]=I;},Nh(Vr)),pA=qg(function(l,f,I){f!=null&&typeof f.toString!="function"&&(f=Ll.call(f)),Ue.call(l,f)?l[f].push(I):l[f]=[I];},he),vA=xe(ha);function mr(l){return Xr(l)?dg(l):rh(l);}function Hr(l){return Xr(l)?dg(l,!0):VC(l);}function gA(l,f){var I={};return f=he(f,3),Hn(l,function(W,it,yt){Xn(I,f(W,it,yt),W);}),I;}function mA(l,f){var I={};return f=he(f,3),Hn(l,function(W,it,yt){Xn(I,it,f(W,it,yt));}),I;}var yA=uo(function(l,f,I){jl(l,f,I);}),U0=uo(function(l,f,I,W){jl(l,f,I,W);}),wA=oi(function(l,f){var I={};if(l==null)return I;var W=!1;f=Je(f,function(yt){return yt=Ui(yt,l),W||(W=yt.length>1),yt;}),Vn(l,gh(l),I),W&&(I=Sn(I,y|C|b,px));for(var it=f.length;it--;)lh(I,f[it]);return I;});function SA(l,f){return z0(l,sc(he(f)));}var TA=oi(function(l,f){return l==null?{}:qC(l,f);});function z0(l,f){if(l==null)return{};var I=Je(gh(l),function(W){return[W];});return f=he(f),Lg(l,I,function(W,it){return f(W,it[0]);});}function IA(l,f,I){f=Ui(f,l);var W=-1,it=f.length;for(it||(it=1,l=e);++W<it;){var yt=l==null?e:l[Rn(f[W])];yt===e&&(W=it,yt=I),l=li(yt)?yt.call(l):yt;}return l;}function CA(l,f,I){return l==null?l:pa(l,f,I);}function xA(l,f,I,W){return W=typeof W=="function"?W:e,l==null?l:pa(l,f,I,W);}var $0=Jg(mr),Y0=Jg(Hr);function PA(l,f,I){var W=ge(l),it=W||$i(l)||po(l);if(f=he(f,4),I==null){var yt=l&&l.constructor;it?I=W?new yt():[]:er(l)?I=li(yt)?co(Dl(l)):{}:I={};}return(it?sn:Hn)(l,function(bt,Rt,Bt){return f(I,bt,Rt,Bt);}),I;}function bA(l,f){return l==null?!0:lh(l,f);}function AA(l,f,I){return l==null?l:kg(l,f,fh(I));}function EA(l,f,I,W){return W=typeof W=="function"?W:e,l==null?l:kg(l,f,fh(I),W);}function vo(l){return l==null?[]:Gf(l,mr(l));}function MA(l){return l==null?[]:Gf(l,Hr(l));}function LA(l,f,I){return I===e&&(I=f,f=e),I!==e&&(I=Cn(I),I=I===I?I:0),f!==e&&(f=Cn(f),f=f===f?f:0),vs(Cn(l),f,I);}function RA(l,f,I){return f=ci(f),I===e?(I=f,f=0):I=ci(I),l=Cn(l),WC(l,f,I);}function OA(l,f,I){if(I&&typeof I!="boolean"&&Wr(l,f,I)&&(f=I=e),I===e&&(typeof f=="boolean"?(I=f,f=e):typeof l=="boolean"&&(I=l,l=e)),l===e&&f===e?(l=0,f=1):(l=ci(l),f===e?(f=l,l=0):f=ci(f)),l>f){var W=l;l=f,f=W;}if(I||l%1||f%1){var it=fg();return Lr(l+it*(f-l+fI("1e-"+((it+"").length-1))),f);}return sh(l,f);}var DA=fo(function(l,f,I){return f=f.toLowerCase(),l+(I?G0(f):f);});function G0(l){return Dh(ze(l).toLowerCase());}function j0(l){return l=ze(l),l&&l.replace(Cf,xI).replace(eI,"");}function NA(l,f,I){l=ze(l),f=an(f);var W=l.length;I=I===e?W:vs(Te(I),0,W);var it=I;return I-=f.length,I>=0&&l.slice(I,it)==f;}function kA(l){return l=ze(l),l&&He.test(l)?l.replace(Be,PI):l;}function BA(l){return l=ze(l),l&&Qo.test(l)?l.replace(jn,"\\$&"):l;}var FA=fo(function(l,f,I){return l+(I?"-":"")+f.toLowerCase();}),WA=fo(function(l,f,I){return l+(I?" ":"")+f.toLowerCase();}),UA=Hg("toLowerCase");function zA(l,f,I){l=ze(l),f=Te(f);var W=f?io(l):0;if(!f||W>=f)return l;var it=(f-W)/2;return Kl(Fl(it),I)+l+Kl(Bl(it),I);}function $A(l,f,I){l=ze(l),f=Te(f);var W=f?io(l):0;return f&&W<f?l+Kl(f-W,I):l;}function YA(l,f,I){l=ze(l),f=Te(f);var W=f?io(l):0;return f&&W<f?Kl(f-W,I)+l:l;}function GA(l,f,I){return I||f==null?f=0:f&&(f=+f),QI(ze(l).replace(Li,""),f||0);}function jA(l,f,I){return(I?Wr(l,f,I):f===e)?f=1:f=Te(f),oh(ze(l),f);}function XA(){var l=arguments,f=ze(l[0]);return l.length<3?f:f.replace(l[1],l[2]);}var HA=fo(function(l,f,I){return l+(I?"_":"")+f.toLowerCase();});function VA(l,f,I){return I&&typeof I!="number"&&Wr(l,f,I)&&(f=I=e),I=I===e?R:I>>>0,I?(l=ze(l),l&&(typeof f=="string"||f!=null&&!Mh(f))&&(f=an(f),!f&&no(l))?zi(Mn(l),0,I):l.split(f,I)):[];}var ZA=fo(function(l,f,I){return l+(I?" ":"")+Dh(f);});function qA(l,f,I){return l=ze(l),I=I==null?0:vs(Te(I),0,l.length),f=an(f),l.slice(I,I+f.length)==f;}function KA(l,f,I){var W=gt.templateSettings;I&&Wr(l,f,I)&&(f=e),l=ze(l),f=Lh({},f,W,_g);var it=Lh({},f.imports,W.imports,_g),yt=mr(it),bt=Gf(it,yt);sn(yt,function(fe){if(cs.test(fe))throw new pe(u);});var Rt,Bt,Ht=0,Vt=f.interpolate||En,qt="__p += '",ie=Xf((f.escape||En).source+"|"+Vt.source+"|"+(Vt===lr?ea:En).source+"|"+(f.evaluate||En).source+"|$","g"),ce="//# sourceURL="+(Ue.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++oI+"]")+"\n";l.replace(ie,function(fe,be,Le,cn,Ur,un){return Le||(Le=cn),qt+=l.slice(Ht,un).replace(xf,bI),be&&(Rt=!0,qt+="' +\n__e("+be+") +\n'"),Ur&&(Bt=!0,qt+="';\n"+Ur+";\n__p += '"),Le&&(qt+="' +\n((__t = ("+Le+")) == null ? '' : __t) +\n'"),Ht=un+fe.length,fe;}),qt+="';\n";var de=Ue.call(f,"variable")&&f.variable;if(!de)qt="with (obj) {\n"+qt+"\n}\n";else if(cs.test(de))throw new pe(a);qt=(Bt?qt.replace(le,""):qt).replace(Re,"$1").replace(Oe,"$1;"),qt="function("+(de||"obj")+") {\n"+(de?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(Rt?", __e = _.escape":"")+(Bt?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+qt+"return __p\n}";var Ce=H0(function(){return Fe(yt,ce+"return "+qt).apply(e,bt);});if(Ce.source=qt,Eh(Ce))throw Ce;return Ce;}function QA(l){return ze(l).toLowerCase();}function JA(l){return ze(l).toUpperCase();}function _A(l,f,I){if(l=ze(l),l&&(I||f===e))return tg(l);if(!l||!(f=an(f)))return l;var W=Mn(l),it=Mn(f),yt=eg(W,it),bt=rg(W,it)+1;return zi(W,yt,bt).join("");}function tE(l,f,I){if(l=ze(l),l&&(I||f===e))return l.slice(0,ig(l)+1);if(!l||!(f=an(f)))return l;var W=Mn(l),it=rg(W,Mn(f))+1;return zi(W,0,it).join("");}function eE(l,f,I){if(l=ze(l),l&&(I||f===e))return l.replace(Li,"");if(!l||!(f=an(f)))return l;var W=Mn(l),it=eg(W,Mn(f));return zi(W,it).join("");}function rE(l,f){var I=K,W=j;if(er(f)){var it="separator"in f?f.separator:it;I="length"in f?Te(f.length):I,W="omission"in f?an(f.omission):W;}l=ze(l);var yt=l.length;if(no(l)){var bt=Mn(l);yt=bt.length;}if(I>=yt)return l;var Rt=I-io(W);if(Rt<1)return W;var Bt=bt?zi(bt,0,Rt).join(""):l.slice(0,Rt);if(it===e)return Bt+W;if(bt&&(Rt+=Bt.length-Rt),Mh(it)){if(l.slice(Rt).search(it)){var Ht,Vt=Bt;for(it.global||(it=Xf(it.source,ze(An.exec(it))+"g")),it.lastIndex=0;Ht=it.exec(Vt);)var qt=Ht.index;Bt=Bt.slice(0,qt===e?Rt:qt);}}else if(l.indexOf(an(it),Rt)!=Rt){var ie=Bt.lastIndexOf(it);ie>-1&&(Bt=Bt.slice(0,ie));}return Bt+W;}function nE(l){return l=ze(l),l&&Ge.test(l)?l.replace(ke,DI):l;}var iE=fo(function(l,f,I){return l+(I?" ":"")+f.toUpperCase();}),Dh=Hg("toUpperCase");function X0(l,f,I){return l=ze(l),f=I?e:f,f===e?EI(l)?BI(l):wI(l):l.match(f)||[];}var H0=xe(function(l,f){try{return nn(l,e,f);}catch(I){return Eh(I)?I:new pe(I);}}),sE=oi(function(l,f){return sn(f,function(I){I=Rn(I),Xn(l,I,bh(l[I],l));}),l;});function oE(l){var f=l==null?0:l.length,I=he();return l=f?Je(l,function(W){if(typeof W[1]!="function")throw new yn(o);return[I(W[0]),W[1]];}):[],xe(function(W){for(var it=-1;++it<f;){var yt=l[it];if(nn(yt[0],this,W))return nn(yt[1],this,W);}});}function aE(l){return DC(Sn(l,y));}function Nh(l){return function(){return l;};}function lE(l,f){return l==null||l!==l?f:l;}var cE=Zg(),uE=Zg(!0);function Vr(l){return l;}function kh(l){return xg(typeof l=="function"?l:Sn(l,y));}function fE(l){return bg(Sn(l,y));}function hE(l,f){return Ag(l,Sn(f,y));}var dE=xe(function(l,f){return function(I){return ha(I,l,f);};}),pE=xe(function(l,f){return function(I){return ha(l,I,f);};});function Bh(l,f,I){var W=mr(f),it=Gl(f,W);I==null&&!(er(f)&&(it.length||!W.length))&&(I=f,f=l,l=this,it=Gl(f,mr(f)));var yt=!(er(I)&&"chain"in I)||!!I.chain,bt=li(l);return sn(it,function(Rt){var Bt=f[Rt];l[Rt]=Bt,bt&&(l.prototype[Rt]=function(){var Ht=this.__chain__;if(yt||Ht){var Vt=l(this.__wrapped__),qt=Vt.__actions__=jr(this.__actions__);return qt.push({func:Bt,args:arguments,thisArg:l}),Vt.__chain__=Ht,Vt;}return Bt.apply(l,Ni([this.value()],arguments));});}),l;}function vE(){return Ir._===this&&(Ir._=YI),this;}function Fh(){}function gE(l){return l=Te(l),xe(function(f){return Eg(f,l);});}var mE=dh(Je),yE=dh(qv),wE=dh(Wf);function V0(l){return Sh(l)?Uf(Rn(l)):KC(l);}function SE(l){return function(f){return l==null?e:gs(l,f);};}var TE=Kg(),IE=Kg(!0);function Wh(){return[];}function Uh(){return!1;}function CE(){return{};}function xE(){return"";}function PE(){return!0;}function bE(l,f){if(l=Te(l),l<1||l>at)return[];var I=R,W=Lr(l,R);f=he(f),l-=R;for(var it=Yf(W,f);++I<l;)f(I);return it;}function AE(l){return ge(l)?Je(l,Rn):ln(l)?[l]:jr(h0(ze(l)));}function EE(l){var f=++zI;return ze(l)+f;}var ME=ql(function(l,f){return l+f;},0),LE=ph("ceil"),RE=ql(function(l,f){return l/f;},1),OE=ph("floor");function DE(l){return l&&l.length?Yl(l,Vr,_f):e;}function NE(l,f){return l&&l.length?Yl(l,he(f,2),_f):e;}function kE(l){return Jv(l,Vr);}function BE(l,f){return Jv(l,he(f,2));}function FE(l){return l&&l.length?Yl(l,Vr,nh):e;}function WE(l,f){return l&&l.length?Yl(l,he(f,2),nh):e;}var UE=ql(function(l,f){return l*f;},1),zE=ph("round"),$E=ql(function(l,f){return l-f;},0);function YE(l){return l&&l.length?$f(l,Vr):0;}function GE(l,f){return l&&l.length?$f(l,he(f,2)):0;}return gt.after=hb,gt.ary=C0,gt.assign=_b,gt.assignIn=F0,gt.assignInWith=W0,gt.assignWith=Lh,gt.at=tA,gt.before=x0,gt.bind=bh,gt.bindAll=sE,gt.bindKey=P0,gt.castArray=xb,gt.chain=S0,gt.chunk=Dx,gt.compact=Nx,gt.concat=kx,gt.cond=oE,gt.conforms=aE,gt.constant=Nh,gt.countBy=GP,gt.create=eA,gt.curry=b0,gt.curryRight=A0,gt.debounce=E0,gt.defaults=rA,gt.defaultsDeep=nA,gt.defer=db,gt.delay=pb,gt.difference=Bx,gt.differenceBy=Fx,gt.differenceWith=Wx,gt.drop=Ux,gt.dropRight=zx,gt.dropRightWhile=$x,gt.dropWhile=Yx,gt.fill=Gx,gt.filter=XP,gt.flatMap=ZP,gt.flatMapDeep=qP,gt.flatMapDepth=KP,gt.flatten=g0,gt.flattenDeep=jx,gt.flattenDepth=Xx,gt.flip=vb,gt.flow=cE,gt.flowRight=uE,gt.fromPairs=Hx,gt.functions=uA,gt.functionsIn=fA,gt.groupBy=QP,gt.initial=Zx,gt.intersection=qx,gt.intersectionBy=Kx,gt.intersectionWith=Qx,gt.invert=dA,gt.invertBy=pA,gt.invokeMap=_P,gt.iteratee=kh,gt.keyBy=tb,gt.keys=mr,gt.keysIn=Hr,gt.map=rc,gt.mapKeys=gA,gt.mapValues=mA,gt.matches=fE,gt.matchesProperty=hE,gt.memoize=ic,gt.merge=yA,gt.mergeWith=U0,gt.method=dE,gt.methodOf=pE,gt.mixin=Bh,gt.negate=sc,gt.nthArg=gE,gt.omit=wA,gt.omitBy=SA,gt.once=gb,gt.orderBy=eb,gt.over=mE,gt.overArgs=mb,gt.overEvery=yE,gt.overSome=wE,gt.partial=Ah,gt.partialRight=M0,gt.partition=rb,gt.pick=TA,gt.pickBy=z0,gt.property=V0,gt.propertyOf=SE,gt.pull=eP,gt.pullAll=y0,gt.pullAllBy=rP,gt.pullAllWith=nP,gt.pullAt=iP,gt.range=TE,gt.rangeRight=IE,gt.rearg=yb,gt.reject=sb,gt.remove=sP,gt.rest=wb,gt.reverse=xh,gt.sampleSize=ab,gt.set=CA,gt.setWith=xA,gt.shuffle=lb,gt.slice=oP,gt.sortBy=fb,gt.sortedUniq=dP,gt.sortedUniqBy=pP,gt.split=VA,gt.spread=Sb,gt.tail=vP,gt.take=gP,gt.takeRight=mP,gt.takeRightWhile=yP,gt.takeWhile=wP,gt.tap=NP,gt.throttle=Tb,gt.thru=ec,gt.toArray=N0,gt.toPairs=$0,gt.toPairsIn=Y0,gt.toPath=AE,gt.toPlainObject=B0,gt.transform=PA,gt.unary=Ib,gt.union=SP,gt.unionBy=TP,gt.unionWith=IP,gt.uniq=CP,gt.uniqBy=xP,gt.uniqWith=PP,gt.unset=bA,gt.unzip=Ph,gt.unzipWith=w0,gt.update=AA,gt.updateWith=EA,gt.values=vo,gt.valuesIn=MA,gt.without=bP,gt.words=X0,gt.wrap=Cb,gt.xor=AP,gt.xorBy=EP,gt.xorWith=MP,gt.zip=LP,gt.zipObject=RP,gt.zipObjectDeep=OP,gt.zipWith=DP,gt.entries=$0,gt.entriesIn=Y0,gt.extend=F0,gt.extendWith=W0,Bh(gt,gt),gt.add=ME,gt.attempt=H0,gt.camelCase=DA,gt.capitalize=G0,gt.ceil=LE,gt.clamp=LA,gt.clone=Pb,gt.cloneDeep=Ab,gt.cloneDeepWith=Eb,gt.cloneWith=bb,gt.conformsTo=Mb,gt.deburr=j0,gt.defaultTo=lE,gt.divide=RE,gt.endsWith=NA,gt.eq=On,gt.escape=kA,gt.escapeRegExp=BA,gt.every=jP,gt.find=HP,gt.findIndex=p0,gt.findKey=iA,gt.findLast=VP,gt.findLastIndex=v0,gt.findLastKey=sA,gt.floor=OE,gt.forEach=T0,gt.forEachRight=I0,gt.forIn=oA,gt.forInRight=aA,gt.forOwn=lA,gt.forOwnRight=cA,gt.get=Rh,gt.gt=Lb,gt.gte=Rb,gt.has=hA,gt.hasIn=Oh,gt.head=m0,gt.identity=Vr,gt.includes=JP,gt.indexOf=Vx,gt.inRange=RA,gt.invoke=vA,gt.isArguments=ws,gt.isArray=ge,gt.isArrayBuffer=Ob,gt.isArrayLike=Xr,gt.isArrayLikeObject=ir,gt.isBoolean=Db,gt.isBuffer=$i,gt.isDate=Nb,gt.isElement=kb,gt.isEmpty=Bb,gt.isEqual=Fb,gt.isEqualWith=Wb,gt.isError=Eh,gt.isFinite=Ub,gt.isFunction=li,gt.isInteger=L0,gt.isLength=oc,gt.isMap=R0,gt.isMatch=zb,gt.isMatchWith=$b,gt.isNaN=Yb,gt.isNative=Gb,gt.isNil=Xb,gt.isNull=jb,gt.isNumber=O0,gt.isObject=er,gt.isObjectLike=rr,gt.isPlainObject=ya,gt.isRegExp=Mh,gt.isSafeInteger=Hb,gt.isSet=D0,gt.isString=ac,gt.isSymbol=ln,gt.isTypedArray=po,gt.isUndefined=Vb,gt.isWeakMap=Zb,gt.isWeakSet=qb,gt.join=Jx,gt.kebabCase=FA,gt.last=In,gt.lastIndexOf=_x,gt.lowerCase=WA,gt.lowerFirst=UA,gt.lt=Kb,gt.lte=Qb,gt.max=DE,gt.maxBy=NE,gt.mean=kE,gt.meanBy=BE,gt.min=FE,gt.minBy=WE,gt.stubArray=Wh,gt.stubFalse=Uh,gt.stubObject=CE,gt.stubString=xE,gt.stubTrue=PE,gt.multiply=UE,gt.nth=tP,gt.noConflict=vE,gt.noop=Fh,gt.now=nc,gt.pad=zA,gt.padEnd=$A,gt.padStart=YA,gt.parseInt=GA,gt.random=OA,gt.reduce=nb,gt.reduceRight=ib,gt.repeat=jA,gt.replace=XA,gt.result=IA,gt.round=zE,gt.runInContext=kt,gt.sample=ob,gt.size=cb,gt.snakeCase=HA,gt.some=ub,gt.sortedIndex=aP,gt.sortedIndexBy=lP,gt.sortedIndexOf=cP,gt.sortedLastIndex=uP,gt.sortedLastIndexBy=fP,gt.sortedLastIndexOf=hP,gt.startCase=ZA,gt.startsWith=qA,gt.subtract=$E,gt.sum=YE,gt.sumBy=GE,gt.template=KA,gt.times=bE,gt.toFinite=ci,gt.toInteger=Te,gt.toLength=k0,gt.toLower=QA,gt.toNumber=Cn,gt.toSafeInteger=Jb,gt.toString=ze,gt.toUpper=JA,gt.trim=_A,gt.trimEnd=tE,gt.trimStart=eE,gt.truncate=rE,gt.unescape=nE,gt.uniqueId=EE,gt.upperCase=iE,gt.upperFirst=Dh,gt.each=T0,gt.eachRight=I0,gt.first=m0,Bh(gt,function(){var l={};return Hn(gt,function(f,I){Ue.call(gt.prototype,I)||(l[I]=f);}),l;}(),{chain:!1}),gt.VERSION=n,sn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){gt[l].placeholder=gt;}),sn(["drop","take"],function(l,f){Ee.prototype[l]=function(I){I=I===e?1:hr(Te(I),0);var W=this.__filtered__&&!f?new Ee(this):this.clone();return W.__filtered__?W.__takeCount__=Lr(I,W.__takeCount__):W.__views__.push({size:Lr(I,R),type:l+(W.__dir__<0?"Right":"")}),W;},Ee.prototype[l+"Right"]=function(I){return this.reverse()[l](I).reverse();};}),sn(["filter","map","takeWhile"],function(l,f){var I=f+1,W=I==B||I==G;Ee.prototype[l]=function(it){var yt=this.clone();return yt.__iteratees__.push({iteratee:he(it,3),type:I}),yt.__filtered__=yt.__filtered__||W,yt;};}),sn(["head","last"],function(l,f){var I="take"+(f?"Right":"");Ee.prototype[l]=function(){return this[I](1).value()[0];};}),sn(["initial","tail"],function(l,f){var I="drop"+(f?"":"Right");Ee.prototype[l]=function(){return this.__filtered__?new Ee(this):this[I](1);};}),Ee.prototype.compact=function(){return this.filter(Vr);},Ee.prototype.find=function(l){return this.filter(l).head();},Ee.prototype.findLast=function(l){return this.reverse().find(l);},Ee.prototype.invokeMap=xe(function(l,f){return typeof l=="function"?new Ee(this):this.map(function(I){return ha(I,l,f);});}),Ee.prototype.reject=function(l){return this.filter(sc(he(l)));},Ee.prototype.slice=function(l,f){l=Te(l);var I=this;return I.__filtered__&&(l>0||f<0)?new Ee(I):(l<0?I=I.takeRight(-l):l&&(I=I.drop(l)),f!==e&&(f=Te(f),I=f<0?I.dropRight(-f):I.take(f-l)),I);},Ee.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse();},Ee.prototype.toArray=function(){return this.take(R);},Hn(Ee.prototype,function(l,f){var I=/^(?:filter|find|map|reject)|While$/.test(f),W=/^(?:head|last)$/.test(f),it=gt[W?"take"+(f=="last"?"Right":""):f],yt=W||/^find/.test(f);it&&(gt.prototype[f]=function(){var bt=this.__wrapped__,Rt=W?[1]:arguments,Bt=bt instanceof Ee,Ht=Rt[0],Vt=Bt||ge(bt),qt=function qt(be){var Le=it.apply(gt,Ni([be],Rt));return W&&ie?Le[0]:Le;};Vt&&I&&typeof Ht=="function"&&Ht.length!=1&&(Bt=Vt=!1);var ie=this.__chain__,ce=!!this.__actions__.length,de=yt&&!ie,Ce=Bt&&!ce;if(!yt&&Vt){bt=Ce?bt:new Ee(this);var fe=l.apply(bt,Rt);return fe.__actions__.push({func:ec,args:[qt],thisArg:e}),new wn(fe,ie);}return de&&Ce?l.apply(this,Rt):(fe=this.thru(qt),de?W?fe.value()[0]:fe.value():fe);});}),sn(["pop","push","shift","sort","splice","unshift"],function(l){var f=Al[l],I=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",W=/^(?:pop|shift)$/.test(l);gt.prototype[l]=function(){var it=arguments;if(W&&!this.__chain__){var yt=this.value();return f.apply(ge(yt)?yt:[],it);}return this[I](function(bt){return f.apply(ge(bt)?bt:[],it);});};}),Hn(Ee.prototype,function(l,f){var I=gt[f];if(I){var W=I.name+"";Ue.call(lo,W)||(lo[W]=[]),lo[W].push({name:f,func:I});}}),lo[Zl(e,Y).name]=[{name:"wrapper",func:e}],Ee.prototype.clone=iC,Ee.prototype.reverse=sC,Ee.prototype.value=oC,gt.prototype.at=kP,gt.prototype.chain=BP,gt.prototype.commit=FP,gt.prototype.next=WP,gt.prototype.plant=zP,gt.prototype.reverse=$P,gt.prototype.toJSON=gt.prototype.valueOf=gt.prototype.value=YP,gt.prototype.first=gt.prototype.head,sa&&(gt.prototype[sa]=UP),gt;},so=FI();fs?((fs.exports=so)._=so,Nf._=so):Ir._=so;}).call(Qe);})(Iu,Iu.exports);Iu.exports;var jbt=(_jbt={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_jbt,St.Selector,_e.selector),St.Clicker,_e.clicker),St.Text,_e.text),St.Pencil,_e.pencil),St.LaserPen,_e.laserPen),St.Arrow,_e.arrow),St.Straight,_e.straight),St.Rectangle,_e.rectangle),St.Ellipse,_e.ellipse),St.Star,Qi.star),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_jbt,St.Polygon,Qi.polygon),St.SpeechBalloon,Qi.speechBalloon),St.Eraser,_e.eraser),St.PencilEraser,_e.pencilEraser),St.BitMapEraser,Qi.bitMapEraser));function Xbt(r){return r===void 0?void 0:jbt[r];}function Fn(r){return Xbt(r);}var Hc=5,Ki=/*#__PURE__*/function(_Gt11){function Ki(e){var _this62;_classCallCheck(this,Ki);_this62=_callSuper(this,Ki,[e]);ht(_this62,"canRotate",!1);ht(_this62,"scaleType",Ae.proportional);ht(_this62,"toolsType",St.Text);ht(_this62,"tmpPoints",[]);ht(_this62,"workOptions");ht(_this62,"oldRect");_this62.workOptions=e.toolsOpt;return _this62;}_inherits(Ki,_Gt11);return _createClass(Ki,[{key:"consume",value:function consume(){return{type:It.None};}},{key:"consumeAll",value:function consumeAll(){return{type:It.None};}},{key:"consumeService",value:function consumeService(){}},{key:"draw",value:function(){var _draw2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(e){var n,i,s,o,a,_this$workOptions14,u,h,v,p,y,C,b,M,L,X,Y,et,A;return _regenerator().w(function(_context16){while(1)switch(_context16.n){case 0:n=e.workId,i=e.layer,s=e.isDrawLabel,o=e.boxRect,a=e.isActive;if(!(a&&!a())){_context16.n=1;break;}return _context16.a(2);case 1:_this$workOptions14=this.workOptions,u=_this$workOptions14.boxSize,h=_this$workOptions14.boxPoint,v=_this$workOptions14.zIndex,p=i.worldPosition,y=i.worldScaling;if(!(!h||!u)){_context16.n=2;break;}return _context16.a(2);case 2:C={name:n,id:n,pos:[h[0]-Hc,h[1]-Hc],anchor:[0,0],size:u,zIndex:v},b=new nr(C),M={x:h[0]-Hc,y:h[1]-Hc,w:u[0],h:u[1]},L={x:Math.floor(M.x*y[0]+p[0]),y:Math.floor(M.y*y[1]+p[1]),w:Math.floor(M.w*y[0])+2,h:Math.floor(M.h*y[1])+2};if(!(o&&(X=el(L,o)),(s||o&&X!==es.outside)&&i&&this.workOptions.text)){_context16.n=5;break;}_context16.n=3;return Ki.createLabels(this.workOptions,i,L,a);case 3:Y=_context16.v;et=Y.labels;A=Y.maxWidth;if(!(a&&!a())){_context16.n=4;break;}return _context16.a(2,(et.forEach(function(w){return w.disconnect();}),L));case 4:b.append.apply(b,_toConsumableArray(et)),L.w=Math.ceil(Math.max(A*i.worldScaling[0],L.w));case 5:return _context16.a(2,a&&!a()?(b.removeAllChildren(),b.disconnect(),L):(this.replace(i,n,b),L));}},_callee15,this);}));function draw(_x29){return _draw2.apply(this,arguments);}return draw;}()},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(e){var p,y,C,b,n,i,s,o,a,u,h,v;return _regenerator().w(function(_context17){while(1)switch(_context17.n){case 0:n=(p=this.workId)==null?void 0:p.toString();if(n){_context17.n=1;break;}return _context17.a(2);case 1:i=e.isFullWork,s=e.replaceId,o=e.isDrawLabel,a=e.boxRect,u=e.isActive;this.oldRect=s&&((C=(y=this.vNodes)==null?void 0:y.get(s))==null?void 0:C.rect)||void 0;h=i?this.fullLayer:this.drawLayer||this.fullLayer;_context17.n=2;return this.draw({workId:n,layer:h,isDrawLabel:_typeof(o)>"u"&&this.workOptions.workState===te.Done||o,boxRect:a,isActive:u});case 2:v=_context17.v;return _context17.a(2,(u&&!u()||(b=this.vNodes)==null||b.setInfo(n,{rect:v,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Gt.getCenterPos(v,h)}),v));}},_callee16,this);}));function consumeServiceAsync(_x30){return _consumeServiceAsync2.apply(this,arguments);}return consumeServiceAsync;}()},{key:"updataOptService",value:function updataOptService(){}},{key:"updataOptServiceAsync",value:function(){var _updataOptServiceAsync=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(e,n,i){var M,L,s,o,a,u,h,v,p,y,C,b;return _regenerator().w(function(_context18){while(1)switch(_context18.n){case 0:if(this.workId){_context18.n=1;break;}return _context18.a(2);case 1:s=this.workId.toString(),o=e.fontColor,a=e.fontBgColor,u=e.bold,h=e.italic,v=e.lineThrough,p=e.underline,y=e.zIndex,C=(M=this.vNodes)==null?void 0:M.get(s);if(C){_context18.n=2;break;}return _context18.a(2);case 2:o&&(C.opt.fontColor=o),a&&(C.opt.fontBgColor=a),u&&(C.opt.bold=u),h&&(C.opt.italic=h),Rs(v)&&(C.opt.lineThrough=v),Rs(p)&&(C.opt.underline=p),$e(y)&&(C.opt.zIndex=y),this.oldRect=C.rect;_context18.n=3;return this.draw({workId:s,layer:this.fullLayer,isDrawLabel:_typeof(n)>"u"&&this.workOptions.workState===te.Done||n,boxRect:i});case 3:b=_context18.v;return _context18.a(2,((L=this.vNodes)==null||L.setInfo(s,{rect:b,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:b&&Gt.getCenterPos(b,this.fullLayer)}),b));}},_callee17,this);}));function updataOptServiceAsync(_x31,_x32,_x33){return _updataOptServiceAsync.apply(this,arguments);}return updataOptServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function(){var _normalizeStorageData2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(e){return _regenerator().w(function(_context19){while(1)switch(_context19.n){case 0:return _context19.a(2,this.normalizeStorageDataSync(e));}},_callee18,this);}));function normalizeStorageData(_x34){return _normalizeStorageData2.apply(this,arguments);}return normalizeStorageData;}()},{key:"normalizeStorageDataSync",value:function normalizeStorageDataSync(e){var n=Gt.normalizeStorageDataSync(e);if(n.status==="unrecoverable")return n;var i=n.value,s=i.opt;return s&&s.workState!==te.Done?(i.type=It.FullWork,i.opt=_objectSpread(_objectSpread({},s),{},{workState:te.Done}),{status:"stable",value:i}):n;}},{key:"getSafetySnippetRatio",value:function getSafetySnippetRatio(e){var n=(e==null?void 0:e.parent).displayRatio||1,i=Math.ceil(e.worldScaling[0]*10)/10;var s=i;return i<=2?s=i*n*2:i>2&&i<=3?s=i*n*1.6:i>3&&i<=4?s=i*n*1.2:i>4&&(s=i*n),Math.floor(s*1e3)/1e3;}},{key:"getSafetySnippetFontLength",value:function getSafetySnippetFontLength(e){return Math.floor(Ki.textImageSnippetSize*3/4/e)||1;}},{key:"createLabels",value:function(){var _createLabels=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(e,n,i,s){var j,o,a,u,_ref71,h,v,p,y,C,b,M,L,X,Y,et,A,w,S,x,P,z,U,K,nt,ct,B,N,G,q,at,ut,Ct,R,$,H,lt,dt,wt,Et,Ot,O,D,J,_,_dt2,_wt2,_Et2,_dt3,_wt3,_H2,_lt2;return _regenerator().w(function(_context20){while(1)switch(_context20.n){case 0:o=[],a=i.x,u=i.y,_ref71=(j=n.parent)==null?void 0:j.parent,h=_ref71.width,v=_ref71.height,p=ks(e.text),y=p.length,C=e.fontSize,b=e.lineHeight,M=e.bold,L=e.textAlign,X=e.italic,Y=e.fontFamily,et=e.verticalAlign,A=e.fontColor,w=e.fontBgColor,S=e.underline,x=e.lineThrough,P=Ki.getSafetySnippetRatio(n)||1,z=Math.floor(C*P),U=Ki.getSafetySnippetFontLength(z);K=0;nt=0;case 1:if(!(nt<y)){_context20.n=9;break;}ct=p[nt],B=b||z*1.5;if(!ct){_context20.n=8;break;}N=cAt(ct),G=[0,0],q=[0,C*1.2];et==="middle"&&(G[1]=Math.floor(nt*C*1.2+6+C*(1.1-1)));at=[0,Math.floor(-C*0.15)];G[0]=6;ut=Math.sin(Math.PI/180*20);Ct=0;R=[];$=0;case 2:if(!($<N)){_context20.n=7;break;}if(!(s&&!s())){_context20.n=3;break;}return _context20.a(2,(R.forEach(function(Ot){return Ot.disconnect();}),o.forEach(function(Ot){return Ot.disconnect();}),{labels:[],maxWidth:K}));case 3:L==="left"&&(at[0]=Ct),$===0&&X==="italic"&&(at[0]=at[0]-ut/2*C);H=ct.slice($,$+U);lt={anchor:[0,0],pos:at,text:H,fontFamily:Y,fontSize:z,lineHeight:B,strokeColor:A,fontWeight:M,fillColor:A,textAlign:L,fontStyle:X,scale:[1/P,1/P]};dt=new pv(lt);_context20.n=4;return dt.textImageReady;case 4:wt=_context20.v;if(!(s&&!s())){_context20.n=5;break;}return _context20.a(2,(dt.disconnect(),R.forEach(function(Ot){return Ot.disconnect();}),o.forEach(function(Ot){return Ot.disconnect();}),{labels:[],maxWidth:K}));case 5:Et=!0;if(wt){Ot=wt.rect&&wt.rect[2],O=wt.rect&&wt.rect[3];if(Ot&&O){D=Ot/P,J=O/P;Ct=D+Ct,X==="italic"&&(M==="bold"?Ct=Ct-ut*C*1.2:Ct=Ct-ut*C),((at[0]+G[0]+D)*n.worldScaling[0]+a<=0||(at[0]+G[0])*n.worldScaling[0]+a>=h||(at[1]+G[1]+J)*n.worldScaling[1]+u<=0||(at[1]+G[1])*n.worldScaling[1]+u>=v)&&(dt.disconnect(),Et=!1),Et&&R.push(dt);}}$+=U;case 6:_context20.n=2;break;case 7:q[0]=Ct,X==="italic"&&(q[0]=q[0]+ut*C),K=Math.max(K,q[0]);_=!0;if(((G[0]+q[0])*n.worldScaling[0]+a<=0||G[0]*n.worldScaling[0]+a>=h||(G[1]+q[1])*n.worldScaling[0]+u<=0||G[1]*n.worldScaling[1]+u>=v)&&(_=!1),_){if(S){_dt2=Math.floor(C/10),_wt2={normalize:!1,pos:[0,C*1.1+_dt2/2],lineWidth:_dt2,points:[0,0,Math.ceil(q[0]),0],strokeColor:A,className:"underline"},_Et2=new zn(_wt2);R.push(_Et2);}if(x){_dt3={normalize:!1,pos:[0,C*1.2/2],lineWidth:Math.floor(C/10),points:[0,0,Math.ceil(q[0]),0],strokeColor:A,className:"lineThrough"},_wt3=new zn(_dt3);R.push(_wt3);}_H2={pos:G,anchor:[0,0],size:q,bgcolor:w},_lt2=new nr(_H2);_lt2.append.apply(_lt2,R),o.push(_lt2);}case 8:nt++;_context20.n=1;break;case 9:return _context20.a(2,{labels:o,maxWidth:K});}},_callee19);}));function createLabels(_x35,_x36,_x37,_x38){return _createLabels.apply(this,arguments);}return createLabels;}()},{key:"updateNodeOpt",value:function updateNodeOpt(e){var n=e.node,i=e.opt,s=e.vNodes,o=e.targetNode,a=i.fontBgColor,u=i.fontColor,h=i.translate,v=i.originPoint,p=i.scenePoint,y=i.scale,C=i.bold,b=i.italic,M=i.lineThrough,L=i.underline,X=i.fontSize,Y=i.textInfos,et=i.zIndex,A=o&&gr(o)||s.get(n.name);if(!A||!n.parent)return;var S=A.opt;if($e(et)&&(n.setAttribute("zIndex",et),A.opt.zIndex=et),u&&S.fontColor&&(S.fontColor=u,n.children.forEach(function(x){x.tagName==="GROUP"&&x.children.forEach(function(P){P.tagName==="LABEL"?(P.setAttribute("fillColor",u),P.setAttribute("strokeColor",u)):P.tagName==="POLYLINE"&&P.setAttribute("strokeColor",u);});})),a&&S.fontBgColor&&(S.fontBgColor=a,n.children.forEach(function(x){x.tagName==="GROUP"&&x.setAttribute("bgcolor",a);})),C&&(S.bold=C),b&&(S.italic=b),Rs(M)&&(S.lineThrough=M),Rs(L)&&(S.underline=L),X&&(S.fontSize=X),v&&p&&y&&o&&S.boxPoint){var x=Y==null?void 0:Y.get(n.name);if(x){var K=x.fontSize,j=x.boxSize;S.boxSize=j||S.boxSize,S.fontSize=K||S.fontSize;}var P=[S.boxPoint[0],S.boxPoint[1]];yf(S.boxPoint,p,y,h);var z=[A.op[0],A.op[1]],U=[z[0]-P[0],z[1]-P[1]];if(A.centerPos=[A.centerPos[0]+U[0],A.centerPos[1]+U[1]],A.opt.eraserlines){var _iterator46=_createForOfIteratorHelper(A.opt.eraserlines),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _K14=_step46.value;var _j3=_K14.op,nt=_K14.thickness;_K14.thickness=Math.round(nt*Math.max(y[0],y[1]));for(var ct=0;ct<_j3.length;ct++)ja(_j3[ct],p,y,h);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}}}else if(h&&S.boxPoint&&(S.boxPoint=[Math.round(S.boxPoint[0]+h[0]),Math.round(S.boxPoint[1]+h[1])],A.centerPos=[A.centerPos[0]+h[0],A.centerPos[1]+h[1]],A.opt.eraserlines)){var _iterator47=_createForOfIteratorHelper(A.opt.eraserlines),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _x39=_step47.value;var _P6=_x39.op;for(var _z15=0;_z15<_P6.length;_z15++){var _U13=_P6[_z15].map(function(K,j){return j%2?K+h[1]:K+h[0];});_x39.op[_z15]=_U13;}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}}return A&&s.setInfo(n.name,A),A==null?void 0:A.rect;}},{key:"getRectFromLayer",value:function getRectFromLayer(e,n){var i=e.getElementsByName(n)[0];if(i){var s=i.getBoundingClientRect();var o={x:Math.floor(s.x),y:Math.floor(s.y),w:Math.floor(s.width+2),h:Math.floor(s.height+2)};return i.children.forEach(function(a){if(a.tagName==="GROUP"){var u=i.getBoundingClientRect();o=Kt(o,{x:Math.floor(u.x),y:Math.floor(u.y),w:Math.floor(u.width+2),h:Math.floor(u.height+2)});}}),o;}}}]);}(Gt);// 4k
|
|
483
|
-
ht(Ki,"textImageSnippetSize",1024*4),ht(Ki,"SafeBorderPadding",30);var Ja=Ki;var Hbt=0.01;function bT(r,t){var _e$protectedIndex,_e$timestamp;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var n=r.length-1;var i=(_e$protectedIndex=e.protectedIndex)!==null&&_e$protectedIndex!==void 0?_e$protectedIndex:-1,s=(_e$timestamp=e.timestamp)!==null&&_e$timestamp!==void 0?_e$timestamp:Date.now();for(var o=0;o<t.length;o+=2){var a=new _t(t[o],t[o+1]),u=r[r.length-1];if(!u){a.setT(s),r.push(a);continue;}if(a.x===u.x&&a.y===u.y){u.setT(s);continue;}var h=r.length-1;if(r.length>1&&h>i){var p=r[h-1],y=xt.Sub(u,p).uni(),C=xt.Sub(a,u).uni();Number.isFinite(y.x)&&Number.isFinite(y.y)&&Number.isFinite(C.x)&&Number.isFinite(C.y)&&xt.Equals(y,C,Hbt)&&(r.pop(),n--);}var v=r[r.length-1];a.setv(xt.Sub(a,v).uni()),a.setT(s),r.push(a);}return Math.max(n,0);}var Oo=/*#__PURE__*/function(_Gt12){function Oo(e){var _this63;_classCallCheck(this,Oo);_this63=_callSuper(this,Oo,[e]);ht(_this63,"canRotate",!1);ht(_this63,"scaleType",Ae.none);ht(_this63,"toolsType",St.PencilEraser);ht(_this63,"tmpPoints",[]);ht(_this63,"workOptions");ht(_this63,"worldPosition");ht(_this63,"worldScaling");ht(_this63,"eraserRect");ht(_this63,"eraserPolyline");_this63.workOptions=e.toolsOpt,_this63.worldPosition=_this63.fullLayer.worldPosition,_this63.worldScaling=_this63.fullLayer.worldScaling;return _this63;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(Oo,_Gt12);return _createClass(Oo,[{key:"combineConsume",value:function combineConsume(e){var n=e.workerEngine;if(this.tmpPoints.length===0)return{type:
|
|
484
|
-
ht(Oo,"eraserSizes",Rv);var Cu=Oo;St.Image,St.BackgroundSVG;St.Polygon,St.Star,St.Star,St.Star,St.SpeechBalloon;St.Pencil,St.LaserPen,St.Arrow,St.Straight;St.Rectangle,St.Ellipse,St.Triangle,St.Rhombus,St.Polygon,St.Star,St.SpeechBalloon;var Vbt=/* @__PURE__ */new Set([St.Pencil,St.Arrow,St.Straight,St.Rectangle,St.Ellipse,St.Star,St.Triangle,St.Rhombus,St.Polygon,St.SpeechBalloon]);function AT(r){return r!==void 0&&Vbt.has(r);}St.Pencil;St.LaserPen,St.Arrow,St.Straight,St.Rectangle,St.Ellipse,St.Star,St.Polygon,St.SpeechBalloon;function Zbt(r,t,e){var n=r-(e?1:2);if(!(n<1||n<=t))return{start:Math.max(t,0),end:n,committedIndex:n};}function kd(r){return r.toolsType===St.Image||r.toolsType===St.Text?"delete-on-done":r.isSelected?"blocked":AT(r.toolsType)?"vector":"blocked";}function qbt(r,t,e){return r.map(function(_ref72){var n=_ref72.x,i=_ref72.y;return[n*e[0]+t[0],i*e[1]+t[1]];});}function Bd(r,t,e){if(!r.length)return!1;if(r.length===1)return xp(r[0],e)<=t*t;for(var n=1;n<r.length;n++)if(Kbt(r[n-1],r[n],e)<=t*t)return!0;return!1;}function xp(r,t){var e=Math.max(t.x-r[0],0,r[0]-(t.x+t.w)),n=Math.max(t.y-r[1],0,r[1]-(t.y+t.h));return e*e+n*n;}function Kbt(r,t,e){if(Qbt(r,t,e))return 0;var n=e.x,i=e.y,s=e.x+e.w,o=e.y+e.h,a=[[[n,i],[s,i]],[[s,i],[s,o]],[[s,o],[n,o]],[[n,o],[n,i]]];var u=Math.min(xp(r,e),xp(t,e));for(var _i7=0,_a8=a;_i7<_a8.length;_i7++){var _a8$_i=_slicedToArray(_a8[_i7],2),h=_a8$_i[0],v=_a8$_i[1];u=Math.min(u,Jbt(r,t,h,v));}return u;}function Qbt(r,t,e){var n=0,i=1;var s=t[0]-r[0],o=t[1]-r[1],a=[[-s,r[0]-e.x],[s,e.x+e.w-r[0]],[-o,r[1]-e.y],[o,e.y+e.h-r[1]]];for(var _i8=0,_a9=a;_i8<_a9.length;_i8++){var _a9$_i=_slicedToArray(_a9[_i8],2),u=_a9$_i[0],h=_a9$_i[1];if(u===0){if(h<0)return!1;continue;}var v=h/u;if(u<0?n=Math.max(n,v):i=Math.min(i,v),n>i)return!1;}return!0;}function Jbt(r,t,e,n){var i=t[0]-r[0],s=t[1]-r[1],o=n[0]-e[0],a=n[1]-e[1],u=r[0]-e[0],h=r[1]-e[1],v=i*i+s*s,p=i*o+s*a,y=o*o+a*a,C=i*u+s*h,b=o*u+a*h,M=v*y-p*p;var L=M,X=M,Y=M,et=M;M<Number.EPSILON?(L=0,Y=1,X=b,et=y):(L=p*b-y*C,X=v*b-p*C,L<0?(L=0,X=b,et=y):L>Y&&(L=Y,X=b+p,et=y)),X<0?(X=0,-C<0?L=0:-C>v?L=Y:(L=-C,Y=v)):X>et&&(X=et,-C+p<0?L=0:-C+p>v?L=Y:(L=-C+p,Y=v));var A=Math.abs(L)<Number.EPSILON?0:L/Y,w=Math.abs(X)<Number.EPSILON?0:X/et,S=u+A*i-w*o,x=h+A*s-w*a;return S*S+x*x;}var Ru=/*#__PURE__*/function(_Gt13){function Ru(e){var _this64;_classCallCheck(this,Ru);_this64=_callSuper(this,Ru,[e]);ht(_this64,"canRotate",!1);ht(_this64,"scaleType",Ae.none);ht(_this64,"toolsType",St.BitMapEraser);ht(_this64,"tmpPoints",[]);ht(_this64,"workOptions");ht(_this64,"worldPosition");ht(_this64,"worldScaling");ht(_this64,"eraserRect");ht(_this64,"eraserPolyline");ht(_this64,"oldRect");ht(_this64,"committedPointIndex",-1);ht(_this64,"candidateWorkIds",/* @__PURE__ */new Set());ht(_this64,"doingPointBatches",[]);ht(_this64,"doingLines",/* @__PURE__ */new Map());ht(_this64,"changedNodes",/* @__PURE__ */new Map());ht(_this64,"deletedNodes",/* @__PURE__ */new Set());ht(_this64,"changedRect");ht(_this64,"lastSceneRevision",-1);ht(_this64,"pendingDeleteIds",/* @__PURE__ */new Set());ht(_this64,"hiddenRenderNodes",/* @__PURE__ */new Map());ht(_this64,"fullLayerPreviewGroup");ht(_this64,"disposeVNodeObserver");/** Transaction-scoped before-images survive until the Done ACK is applied. */ht(_this64,"beforeImages",/* @__PURE__ */new Map());_this64.workOptions=e.toolsOpt,_this64.worldPosition=_this64.fullLayer.worldPosition,_this64.worldScaling=_this64.fullLayer.worldScaling,_this64.startVNodeObservation();return _this64;}/** Consume exactly one accepted input batch and publish one FullLayer preview. */_inherits(Ru,_Gt13);return _createClass(Ru,[{key:"combineConsume",value:function combineConsume(e){var _ref73;var h;this.syncWorldTransform(),this.startVNodeObservation();var n=this.getDeltaPoints(!0),i=(_ref73=(h=this.vNodes)==null?void 0:h.getRevision())!==null&&_ref73!==void 0?_ref73:0,s=i!==this.lastSceneRevision;var o=this.restoreNoLongerClearablePendingDeletes();var a=s?this.tmpPoints:n==null?void 0:n.points;if(a!=null&&a.length){var v=this.getEraserThickness();o=Kt(o,this.hideDeleteCandidatesForPoints(a,v)),this.collectVectorCandidateWorkIds(a,v);}if(this.lastSceneRevision=i,!n)return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:o?It.DrawWork:It.None,rect:o});var u=this.getEraserThickness();return this.recordDoingPointBatch(n.points),o=Kt(o,this.appendFullLayerPreview(n.points,u)),this.committedPointIndex=n.committedIndex,this.changedRect=Kt(this.changedRect,o),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:o?It.DrawWork:It.None,rect:o});}},{key:"consumeService",value:function consumeService(){}},{key:"consume",value:function consume(e){var n=e.data.op;return n!=null&&n.length?(this.syncWorldTransform(),this.updateTempPoints(n),_objectSpread({type:It.None},this.baseConsumeResult)):_objectSpread({type:It.None},this.baseConsumeResult);}},{key:"consumeAll",value:function(){var _consumeAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(e){var n,i,s,_iterator51,_step51,_step51$value,v,p,o,a,u,h,_iterator52,_step52,_v9,_a0,_u7,_t19,_t20;return _regenerator().w(function(_context21){while(1)switch(_context21.p=_context21.n){case 0:n=e.workerEngine;if(!(this.syncWorldTransform(),this.clearFullLayerPreview(!1),!this.tmpPoints.length)){_context21.n=1;break;}return _context21.a(2,(this.clearFullLayerPreview(!0),_objectSpread({type:It.None},this.baseConsumeResult)));case 1:i=this.getEraserThickness(),s=new Map(this.beforeImages);_context21.p=2;this.recordFinalPointBatch(),this.getCandidateWorkIds().clear(),this.collectVectorCandidateWorkIds(this.tmpPoints,i),this.collectDeleteCandidatesForDone(this.tmpPoints,i);_iterator51=_createForOfIteratorHelper(this.snapshotDoneCandidates());try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){_step51$value=_slicedToArray(_step51.value,2),v=_step51$value[0],p=_step51$value[1];s.set(v,p);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}this.collectDoneVectorChanges(i),this.commitDoingFaces(),this.renderChangedNodes(n,this.workOptions.removeOnDone!==!1),this.commitPendingDeletions(n);o=new Set(this.deletedNodes),a=new Map(this.changedNodes),u=this.changedRect;if(!(o.size===0&&a.size===0)){_context21.n=3;break;}return _context21.a(2,_objectSpread(_objectSpread({type:It.FullWork},this.baseConsumeResult),{},{rect:u,eraseTxnBeforeImages:new Map(s),eraseTxnCommitStatus:"applied"}));case 3:h=[];_iterator52=_createForOfIteratorHelper(this.tmpPoints);try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){_v9=_step52.value;h.push(_v9.x,_v9.y,i/2);}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}return _context21.a(2,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:It.FullWork,dataType:Qt.Local,rect:u,ops:Br(h),willUpdateNodes:a,willDeleteNodes:o,eraseTxnBeforeImages:new Map(s),eraseTxnCommitStatus:"applied"}));case 4:_context21.p=4;_t19=_context21.v;_a0=!0;_context21.p=5;_context21.n=6;return this.restoreFailedDoneCandidates(s,n);case 6:_a0=!_context21.v;_context21.n=8;break;case 7:_context21.p=7;_t20=_context21.v;console.warn("[BitMapEraser] Done recovery threw after commit error:",_t20);case 8:_u7=this.changedRect;try{this.clearFullLayerPreview(!0);}catch(h){console.warn("[BitMapEraser] Done preview cleanup failed:",h);}return _context21.a(2,(this.changedNodes.clear(),this.getCandidateWorkIds().clear(),this.getDoingPointBatches().length=0,this.getDoingLines().clear(),this.deletedNodes.clear(),this.pendingDeleteIds.clear(),console.warn("[BitMapEraser] Done commit aborted:",_t19),_objectSpread(_objectSpread({type:It.FullWork},this.baseConsumeResult),{},{rect:_u7,willUpdateNodes:/* @__PURE__ */new Map(),willDeleteNodes:/* @__PURE__ */new Set(),eraseTxnBeforeImages:new Map(s),eraseTxnRecoveryRequired:_a0,eraseTxnCommitStatus:"failed"})));}},_callee20,this,[[5,7],[2,4]]);}));function consumeAll(_x40){return _consumeAll.apply(this,arguments);}return consumeAll;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.clearFullLayerPreview(!0),this.stopVNodeObservation(),this.tmpPoints.length=0,this.committedPointIndex=-1,this.changedNodes.clear(),this.getCandidateWorkIds().clear(),this.getDoingPointBatches().length=0,this.getDoingLines().clear(),this.deletedNodes.clear(),this.pendingDeleteIds.clear(),this.changedRect=void 0,this.lastSceneRevision=-1;}},{key:"shouldRevalidateVNodeRevision",value:function shouldRevalidateVNodeRevision(){return this.tmpPoints.length>0;}},{key:"syncWorldTransform",value:function syncWorldTransform(){this.worldPosition=this.fullLayer.worldPosition,this.worldScaling=this.fullLayer.worldScaling;}},{key:"getEraserThickness",value:function getEraserThickness(){var e=this.workOptions.thickness,_Ru$eraserSizes$e=Ru.eraserSizes[e],n=_Ru$eraserSizes$e.width,i=_Ru$eraserSizes$e.height;return Math.round(Math.max(n,i)/this.worldScaling[0]);}},{key:"updateTempPoints",value:function updateTempPoints(e){bT(this.tmpPoints,e,{protectedIndex:this.committedPointIndex});}},{key:"getDeltaPoints",value:function getDeltaPoints(e){var n=Zbt(this.tmpPoints.length,this.committedPointIndex,e);if(n)return{points:this.tmpPoints.slice(n.start,n.end+1),committedIndex:n.committedIndex};}},{key:"recordFinalPointBatch",value:function recordFinalPointBatch(){var e=this.getDeltaPoints(!0);if(e){this.recordDoingPointBatch(e.points),this.committedPointIndex=e.committedIndex;return;}!this.getDoingPointBatches().length&&this.tmpPoints.length&&(this.recordDoingPointBatch(this.tmpPoints),this.committedPointIndex=this.tmpPoints.length-1);}},{key:"recordDoingPointBatch",value:function recordDoingPointBatch(e){e.length&&this.getDoingPointBatches().push(e.map(function(n){return new _t(n.x,n.y,n.z);}));}},{key:"getDoingPointBatches",value:function getDoingPointBatches(){return this.doingPointBatches||(this.doingPointBatches=[]),this.doingPointBatches;}},{key:"getDoingLines",value:function getDoingLines(){return this.doingLines||(this.doingLines=/* @__PURE__ */new Map()),this.doingLines;}},{key:"getCandidateWorkIds",value:function getCandidateWorkIds(){return this.candidateWorkIds||(this.candidateWorkIds=/* @__PURE__ */new Set()),this.candidateWorkIds;}},{key:"appendFullLayerPreview",value:function appendFullLayerPreview(e,n){var _this65=this;if(!e.length)return;var i=this.computEraserPointLines(e).map(function(u){var h=u.flatMap(function(_ref74){var _ref75=_slicedToArray(_ref74,2),v=_ref75[0],p=_ref75[1];return[v,p];});return Jn(_this65.computEraserPoints(h,n),!0);}).filter(Boolean);if(!i.length)return;var s=new $r({pos:[0,0],d:i.join(" "),fillColor:"rgba(0,0,0,1)",fillRule:"evenodd"});var o=!1;s.addEventListener("beforerender",function(_ref76){var u=_ref76.detail;var h=u.context;typeof h.blendFuncSeparate=="function"?h.blendFuncSeparate(h.ZERO,h.ZERO,h.ZERO,h.ZERO):(h.save(),o=!0,h.globalCompositeOperation="destination-out");}),s.addEventListener("afterrender",function(_ref77){var u=_ref77.detail;var h=u.context;typeof h.blendFuncSeparate=="function"?h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA):o&&(o=!1,h.restore());}),this.getFullLayerPreviewGroup().append(s);var a=Ye(e,n);return a=tl(a,this.worldPosition),LT(a,this.worldScaling,this.worldPosition);}},{key:"getFullLayerPreviewGroup",value:function getFullLayerPreviewGroup(){if(this.fullLayerPreviewGroup)return this.fullLayerPreviewGroup;var e=new nr({name:this.workId,pos:[0,0],zIndex:9999});return this.fullLayer.append(e),this.fullLayerPreviewGroup=e,e;}},{key:"getTrackRect",value:function getTrackRect(e,n){var i=e[0][0],s=e[0][1],o=i,a=s;for(var u=1;u<e.length;u++){var _e$u2=_slicedToArray(e[u],2),h=_e$u2[0],v=_e$u2[1];i=Math.min(i,h),s=Math.min(s,v),o=Math.max(o,h),a=Math.max(a,v);}return{x:i-n,y:s-n,w:o-i+n*2,h:a-s+n*2};}},{key:"getScreenTrack",value:function getScreenTrack(e,n){var i=qbt(e,this.worldPosition,this.worldScaling),s=n*Math.max(Math.abs(this.worldScaling[0]),Math.abs(this.worldScaling[1]))/2;return{screenPoints:i,radius:s,rect:this.getTrackRect(i,s+1)};}},{key:"collectVectorCandidateWorkIds",value:function collectVectorCandidateWorkIds(e,n){if(!this.vNodes||!e.length)return;var i=this.getScreenTrack(e,n),_this$vNodes$getRectI4=this.vNodes.getRectIntersectRange(i.rect,!1,!1),s=_this$vNodes$getRectI4.nodeRange;var _iterator53=_createForOfIteratorHelper(s),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var _step53$value=_slicedToArray(_step53.value,2),o=_step53$value[0],a=_step53$value[1];!this.vNodes.isCanClearWorkId(o)||kd(a)!=="vector"||!Bd(i.screenPoints,i.radius,a.rect)||this.getCandidateWorkIds().add(o);}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}}},{key:"hideDeleteCandidatesForPoints",value:function hideDeleteCandidatesForPoints(e,n){if(!this.vNodes||!e.length)return;var i=this.getScreenTrack(e,n);var s;var _this$vNodes$getRectI5=this.vNodes.getRectIntersectRange(i.rect,!1,!1),o=_this$vNodes$getRectI5.nodeRange;var _iterator54=_createForOfIteratorHelper(o),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var _step54$value=_slicedToArray(_step54.value,2),a=_step54$value[0],u=_step54$value[1];this.pendingDeleteIds.has(a)||!this.vNodes.isCanClearWorkId(a)||kd(u)!=="delete-on-done"||!Bd(i.screenPoints,i.radius,u.rect)||(this.pendingDeleteIds.add(a),this.hideRenderNodesForId(a),s=Kt(s,u.rect),this.changedRect=Kt(this.changedRect,u.rect));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}return s;}},{key:"collectDeleteCandidatesForDone",value:function collectDeleteCandidatesForDone(e,n){if(!this.vNodes||!e.length)return;var i=this.getScreenTrack(e,n),_this$vNodes$getRectI6=this.vNodes.getRectIntersectRange(i.rect,!1,!1),s=_this$vNodes$getRectI6.nodeRange;var _iterator55=_createForOfIteratorHelper(s),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _step55$value=_slicedToArray(_step55.value,2),o=_step55$value[0],a=_step55$value[1];this.vNodes.isCanClearWorkId(o)&&kd(a)==="delete-on-done"&&Bd(i.screenPoints,i.radius,a.rect)&&(this.pendingDeleteIds.add(o),this.changedRect=Kt(this.changedRect,a.rect));}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}}},{key:"hideRenderNodesForId",value:function hideRenderNodesForId(e){this.captureBeforeImage(e);var n=this.hiddenRenderNodes.get(e)||[],i=new Set(n.map(function(_ref78){var s=_ref78.node;return s;}));var _iterator56=_createForOfIteratorHelper(this.fullLayer.getElementsByName(e)),_step56;try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var s=_step56.value;i.has(s)||n.push({node:s,display:s.getAttribute("display")}),s.setAttribute("display","none");}}catch(err){_iterator56.e(err);}finally{_iterator56.f();}this.hiddenRenderNodes.set(e,n);}},{key:"restoreNoLongerClearablePendingDeletes",value:function restoreNoLongerClearablePendingDeletes(){var n,i,s;var e;for(var _i9=0,_arr=_toConsumableArray(this.pendingDeleteIds);_i9<_arr.length;_i9++){var o=_arr[_i9];if(!((n=this.vNodes)!=null&&n.isCanClearWorkId(o))){var _iterator57=_createForOfIteratorHelper(this.hiddenRenderNodes.get(o)||[]),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _step57$value=_step57.value,a=_step57$value.node,u=_step57$value.display;a.setAttribute("display",u);}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}e=Kt(e,(s=(i=this.vNodes)==null?void 0:i.get(o))==null?void 0:s.rect),this.hiddenRenderNodes.delete(o),this.pendingDeleteIds.delete(o);}}return e;}},{key:"snapshotDoneCandidates",value:function snapshotDoneCandidates(){var n;var e=/* @__PURE__ */new Map();for(var _i0=0,_arr2=[].concat(_toConsumableArray(this.getCandidateWorkIds()),_toConsumableArray(this.pendingDeleteIds));_i0<_arr2.length;_i0++){var i=_arr2[_i0];if(e.has(i)||!((n=this.vNodes)!=null&&n.isCanClearWorkId(i)))continue;var s=this.vNodes.get(i);if(s){var o=gr(s);e.set(i,o),this.beforeImages.has(i)||this.beforeImages.set(i,o);}}return e;}},{key:"captureBeforeImage",value:function captureBeforeImage(e){var i;if(this.beforeImages.has(e)||!((i=this.vNodes)!=null&&i.isCanClearWorkId(e)))return;var n=this.vNodes.get(e);n&&this.beforeImages.set(e,gr(n));}},{key:"collectDoneVectorChanges",value:function collectDoneVectorChanges(e){if(!this.vNodes)return;var n=this.worldPosition;var _iterator58=_createForOfIteratorHelper(this.getCandidateWorkIds()),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var i=_step58.value;if(!this.vNodes.isCanClearWorkId(i))continue;var s=this.vNodes.get(i);if(!(s!=null&&s.opt)||!AT(s.toolsType))continue;var o=tl(s.rect,[-n[0],-n[1]]);o={x:o.x/this.worldScaling[0],y:o.y/this.worldScaling[1],w:o.w/this.worldScaling[0],h:o.h/this.worldScaling[1]};var a=[o.x,o.y,o.x+o.w,o.y+o.h],u=[];var _iterator59=_createForOfIteratorHelper(this.getDoingPointBatches()),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var h=_step59.value;var _iterator60=_createForOfIteratorHelper(this.computEraserPointLines(h,120)),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var v=_step60.value;var p=[];Ov.polyline(v,a,p);for(var _i1=0,_p4=p;_i1<_p4.length;_i1++){var y=_p4[_i1];var C=this.normalizeClippedLine(y);C.length&&u.push(C);}}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}u.length&&(this.getDoingLines().set(i,[{workId:this.workId,op:u,thickness:e}]),this.changedNodes.set(i,s),this.changedRect=Kt(this.changedRect,s.rect));}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}}},{key:"normalizeClippedLine",value:function normalizeClippedLine(e){var n=[];for(var i=0;i<e.length&&!(isNaN(e[i][0])||isNaN(e[i][1]));i++){var s=e[i].map(function(o){return Math.round(o*100)/100;});if(i>0){var o=e[i-1].map(function(a){return Math.round(a*100)/100;});if(Qn(s,o))continue;}n.push.apply(n,_toConsumableArray(s));}return n;}},{key:"commitDoingFaces",value:function commitDoingFaces(){var e;var _iterator61=_createForOfIteratorHelper(this.getDoingLines()),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var _step61$value=_slicedToArray(_step61.value,2),n=_step61$value[0],i=_step61$value[1];if(!((e=this.vNodes)!=null&&e.isCanClearWorkId(n))){this.changedNodes.delete(n);continue;}var s=this.vNodes.get(n);if(!(s!=null&&s.opt)||!i.length){this.changedNodes.delete(n);continue;}var o=Omt(s.opt,i),a=gp(_objectSpread(_objectSpread({},s.opt),o));delete a.eraserlines,s.opt=a,this.changedNodes.set(n,s),this.vNodes.setInfo(n,{opt:a});}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}}},{key:"renderChangedNodes",value:function renderChangedNodes(e,n){if(e)for(var _i10=0,_arr3=_toConsumableArray(this.changedNodes);_i10<_arr3.length;_i10++){var _arr3$_i=_slicedToArray(_arr3[_i10],2),i=_arr3$_i[0],s=_arr3$_i[1];var o=e.createWorkShapeNode({workId:i,toolsType:s.toolsType,toolsOpt:s.opt});o==null||o.setWorkId(i),o==null||o.setEraserDeleteConfirmation(n);var a=o==null?void 0:o.consumeService({op:s.op,isFullWork:!0,replaceId:i});this.changedRect=Kt(this.changedRect,a),n&&o!=null&&o.isDelete&&(e.removeNode(i),this.deletedNodes.add(i),this.changedNodes.delete(i));}}},{key:"commitPendingDeletions",value:function commitPendingDeletions(e){var n;var _iterator62=_createForOfIteratorHelper(this.pendingDeleteIds),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var i=_step62.value;if(!((n=this.vNodes)!=null&&n.isCanClearWorkId(i))){var _iterator63=_createForOfIteratorHelper(this.hiddenRenderNodes.get(i)||[]),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var _step63$value=_step63.value,o=_step63$value.node,a=_step63$value.display;o.setAttribute("display",a);}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}continue;}var s=this.vNodes.get(i);s&&(this.changedRect=Kt(this.changedRect,s.rect)),e==null||e.removeNode(i),this.deletedNodes.add(i),this.changedNodes.delete(i);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}this.pendingDeleteIds.clear(),this.hiddenRenderNodes.clear(),this.stopVNodeObservation();}},{key:"clearFullLayerPreview",value:function clearFullLayerPreview(e){var n;if((n=this.fullLayerPreviewGroup)==null||n.remove(),this.fullLayerPreviewGroup=void 0,!!e){var _iterator64=_createForOfIteratorHelper(this.hiddenRenderNodes.values()),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var i=_step64.value;var _iterator65=_createForOfIteratorHelper(i),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var _step65$value=_step65.value,s=_step65$value.node,o=_step65$value.display;s.setAttribute("display",o);}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}this.hiddenRenderNodes.clear(),this.pendingDeleteIds.clear();}}},{key:"startVNodeObservation",value:function startVNodeObservation(){var _this66=this;!this.vNodes||this.disposeVNodeObserver||typeof this.vNodes.observeRevision!="function"||(this.disposeVNodeObserver=this.vNodes.observeRevision(function(e,n,i){i&&(e==="add"||e==="update")&&_this66.pendingDeleteIds.has(i)&&_this66.hideRenderNodesForId(i);}));}},{key:"stopVNodeObservation",value:function stopVNodeObservation(){var e;(e=this.disposeVNodeObserver)==null||e.call(this),this.disposeVNodeObserver=void 0;}},{key:"restoreFailedDoneCandidates",value:function(){var _restoreFailedDoneCandidates=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(e,n){var s,i,_iterator66,_step66,_step66$value,o,a,u,h,_t21,_t22,_t23,_t24;return _regenerator().w(function(_context22){while(1)switch(_context22.p=_context22.n){case 0:i=!0;_iterator66=_createForOfIteratorHelper(e);_context22.p=1;_iterator66.s();case 2:if((_step66=_iterator66.n()).done){_context22.n=15;break;}_step66$value=_slicedToArray(_step66.value,2),o=_step66$value[0],a=_step66$value[1];_context22.p=3;u=gr(a);if(!((s=this.vNodes)==null||s.setInfo(o,u),!n)){_context22.n=4;break;}return _context22.a(3,14);case 4:h=n.createWorkShapeNode({workId:o,toolsType:u.toolsType,toolsOpt:u.opt});if(h){_context22.n=5;break;}i=!1;return _context22.a(3,14);case 5:h.setWorkId(o);if(!(u.toolsType===St.Image)){_context22.n=8;break;}_context22.n=6;return h.consumeServiceAsync({isFullWork:!0,replaceId:o,worker:n});case 6:_t21=_context22.v;if(_t21){_context22.n=7;break;}i=!1;case 7:_context22.n=12;break;case 8:if(!(u.toolsType===St.Text)){_context22.n=11;break;}_context22.n=9;return h.consumeServiceAsync({isFullWork:!0,replaceId:o,boxRect:n.thread.getSceneRect()});case 9:_t22=_context22.v;if(_t22){_context22.n=10;break;}i=!1;case 10:_context22.n=12;break;case 11:h.consumeService({op:u.op,isFullWork:!0,replaceId:o});case 12:_context22.n=14;break;case 13:_context22.p=13;_t23=_context22.v;i=!1,console.warn("[BitMapEraser] Failed to restore ".concat(o," after Done error:"),_t23);case 14:_context22.n=2;break;case 15:_context22.n=17;break;case 16:_context22.p=16;_t24=_context22.v;_iterator66.e(_t24);case 17:_context22.p=17;_iterator66.f();return _context22.f(17);case 18:return _context22.a(2,i);}},_callee21,this,[[3,13],[1,16,17,18]]);}));function restoreFailedDoneCandidates(_x41,_x42){return _restoreFailedDoneCandidates.apply(this,arguments);}return restoreFailedDoneCandidates;}()},{key:"computEraserPointLines",value:function computEraserPointLines(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:60;var i=[];var s=0;var o=360-n;for(var a=1;a<e.length;a++){var u=e[a-1],h=e[a];if(a===1&&s===0&&(i[s]=[u.XY]),i[s].push(h.XY),a<e.length-1){var v=h.getAngleByPoints(u,e[a+1]);(v<n||v>o)&&(s++,i[s]=[h.XY]);}}return e.length===1&&i.push([e[0].XY,e[0].XY]),i;}}]);}(Gt);ht(Ru,"eraserSizes",Rv);var xu=Ru;var _a=/*#__PURE__*/function(_Gt14){function _a(e){var _this67;_classCallCheck(this,_a);_this67=_callSuper(this,_a,[e]);ht(_this67,"canRotate",!1);ht(_this67,"scaleType",Ae.all);ht(_this67,"toolsType",St.BackgroundSVG);ht(_this67,"tmpPoints",[]);ht(_this67,"workOptions");ht(_this67,"oldRect");_this67.workOptions=e.toolsOpt,_this67.scaleType=_a.getScaleType(_this67.workOptions);return _this67;}_inherits(_a,_Gt14);return _createClass(_a,[{key:"consume",value:function consume(){return{type:It.None};}},{key:"consumeAll",value:function consumeAll(){return{type:It.None};}},{key:"draw",value:function draw(e){var n=e.layer,i=e.workId,s=e.replaceId,_this$workOptions15=this.workOptions,o=_this$workOptions15.centerX,a=_this$workOptions15.centerY,u=_this$workOptions15.width,h=_this$workOptions15.height,v=_this$workOptions15.rotate,p=_this$workOptions15.zIndex,y=(p||0)-100,C=new nr({anchor:[0.5,0.5],pos:[o,a],name:i,size:[u,h],zIndex:y,rotate:v}),b=new Bo({normalize:!0,pos:[0,0],width:u,height:h});C.appendChild(b),this.replace(n,s||i,C);var M=C.getBoundingClientRect();if(M)return{x:Math.floor(M.x-Gt.SafeBorderPadding),y:Math.floor(M.y-Gt.SafeBorderPadding),w:Math.floor(M.width+Gt.SafeBorderPadding*2),h:Math.floor(M.height+Gt.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(e){var o;var n=e.replaceId,i=this.workId,s=this.draw({workId:i,layer:this.fullLayer,replaceId:n});return(o=this.vNodes)==null||o.setInfo(i,{rect:s,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&Gt.getCenterPos(s,this.fullLayer)}),s;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return Gt.normalizeStorageData(e);}},{key:"getScaleType",value:function getScaleType(e){var n=e.uniformScale,i=e.rotate;return n!==!1||i&&Math.abs(i)%90>0?Ae.proportional:Ae.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var n=e.node,i=e.opt,s=e.vNodes,o=e.targetNode,a=i.translate,u=i.originPoint,h=i.scenePoint,v=i.scale,p=i.angle,y=i.isLocked,C=i.zIndexForBackgroundSVG,b=o&&gr(o)||s.get(n.name);if(!b)return;var M=n.parent;if(M){if($e(C)){var L=(C||0)-100;n.setAttribute("zIndex",L),b.opt.zIndex=C;}if(Rs(y)&&(b.opt.locked=y),u&&h&&v&&a){var _b$opt=b.opt,_L14=_b$opt.centerX,X=_b$opt.centerY,Y=_b$opt.width,et=_b$opt.height,A=_b$opt.uniformScale,w=A!==!1?[v[0],v[0]]:v,S=[_L14,X],x=[_L14,X];yf(x,h,w,a);var P=[x[0]-S[0],x[1]-S[1]];b.centerPos=[b.centerPos[0]+P[0],b.centerPos[1]+P[1]],b.opt.width=Math.round(Y*w[0]),b.opt.height=Math.round(et*w[1]),b.opt.centerX=x[0],b.opt.centerY=x[1];}else if(a)b.opt.centerX=b.opt.centerX+a[0],b.opt.centerY=b.opt.centerY+a[1],b.centerPos=[b.centerPos[0]+a[0],b.centerPos[1]+a[1]];else if($e(p))if(b.opt.rotate=p,b.scaleType=_a.getScaleType(b.opt),o){var _L15=Uv(b.rect,p);b.rect=_L15;}else{var _L16=Gt.getRectFromLayer(M,n.name);b.rect=_L16||b.rect;}return b&&s.setInfo(n.name,b),b==null?void 0:b.rect;}}}]);}(Gt);function ET(r){switch(r){case St.Arrow:return sT;case St.Pencil:return eT;case St.Straight:return fT;case St.Ellipse:return oT;case St.Polygon:case St.Triangle:return cT;case St.Star:case St.Rhombus:return lT;case St.Rectangle:return aT;case St.SpeechBalloon:return uT;case St.Text:return Ja;case St.LaserPen:return rT;case St.Eraser:return wu;case St.PencilEraser:return Cu;case St.BitMapEraser:return xu;case St.Selector:return Ka;case St.Image:return Qa;case St.BackgroundSVG:return _a;}}function mf(r,t){var e=r.toolsType,n=_objectWithoutProperties(r,_excluded2);switch(e){case St.Arrow:return new sT(n);case St.Pencil:return new eT(n);case St.Straight:return new fT(n);case St.Ellipse:return new oT(n);case St.Polygon:case St.Triangle:return new cT(n);case St.Star:case St.Rhombus:return new lT(n);case St.Rectangle:return new aT(n);case St.SpeechBalloon:return new uT(n);case St.Text:return new Ja(n);case St.LaserPen:return new rT(n);case St.Eraser:return new wu(n,t);case St.BitMapEraser:return new xu(n);case St.PencilEraser:return new Cu(n);case St.Selector:return n.vNodes?new Ka(_objectSpread(_objectSpread({},n),{},{vNodes:n.vNodes,drawLayer:n.fullLayer})):void 0;case St.Image:return new Qa(n);case St.BackgroundSVG:return new _a(_objectSpread(_objectSpread({},n),{},{toolsOpt:n.toolsOpt}));default:return;}}function MT(r){var t=[],e=["PATH","SPRITE","POLYLINE","RECT","ELLIPSE","LABEL","SPRITESVG"];var _iterator67=_createForOfIteratorHelper(r),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var n=_step67.value;if(n.tagName==="GROUP"&&n.children.length){var i=MT(n.children);t.push.apply(t,_toConsumableArray(i));}n.tagName&&e.includes(n.tagName)&&t.push(n);}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}return t;}function Kt(r,t){if(r&&t){var e=Math.min(r.x,t.x),n=Math.min(r.y,t.y),i=Math.max(r.x+r.w,t.x+t.w),s=Math.max(r.y+r.h,t.y+t.h),o=i-e,a=s-n;return{x:e,y:n,w:o,h:a};}return t||r;}function Ye(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e={x:0,y:0,w:0,h:0};var n=1/0,i=1/0,s=-1/0,o=-1/0;return r.forEach(function(a){var _a$XY=_slicedToArray(a.XY,2),u=_a$XY[0],h=_a$XY[1];n=Math.min(n,u-t),i=Math.min(i,h-t),s=Math.max(s,u+t),o=Math.max(o,h+t);}),e.x=n,e.y=i,e.w=s-n,e.h=o-i,e;}function Pu(r,t){return!(r.x+r.w<t.x||r.x>t.x+t.w||r.y+r.h<t.y||r.y>t.y+t.h);}function me(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:10;return{x:Math.floor(r.x-t),y:Math.floor(r.y-t),w:Math.ceil(r.w+t*2),h:Math.ceil(r.h+t*2)};}function tl(r,t){return{x:r.x+t[0],y:r.y+t[1],w:r.w,h:r.h};}function _bt(r,t){var e=new xt(r.x,r.y),n=new xt(r.x+r.w,r.y),i=new xt(r.x+r.w,r.y+r.h),s=new xt(r.x,r.y+r.h),o=new xt(r.x+r.w/2,r.y+r.h/2),a=Math.PI*t/180,u=xt.RotWith(e,o,a),h=xt.RotWith(n,o,a),v=xt.RotWith(i,o,a),p=xt.RotWith(s,o,a);return[u,h,v,p];}function Uv(r,t){var e=_bt(r,t);return Ye(e);}function LT(r,t,e){var n=new xt(r.x,r.y),i=new xt(r.x+r.w,r.y),s=new xt(r.x+r.w,r.y+r.h),o=new xt(r.x,r.y+r.h),a=new xt(e[0],e[1]),u=new xt(t[0],t[1]),h=xt.ScaleWOrigin(n,u,a),v=xt.ScaleWOrigin(i,u,a),p=xt.ScaleWOrigin(s,u,a),y=xt.ScaleWOrigin(o,u,a);return Ye([h,v,p,y]);}function tAt(r,t,e){var n=new xt(t[0],t[1]);for(var i=0;i<r.length;i+=3){var s=new xt(r[i],r[i+1]),o=Math.PI*e/180,a=xt.RotWith(s,n,o);r[i]=a.x,r[i+1]=a.y;}}function $1(r,t,e){var n=new xt(t[0],t[1]);for(var i=0;i<r.length;i+=2){var s=new xt(r[i],r[i+1]),o=Math.PI*e/180,a=xt.RotWith(s,n,o);r[i]=a.x,r[i+1]=a.y;}}function yf(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var i=new xt(t[0],t[1]);for(var s=0;s<r.length;s+=3){var o=new xt(r[s],r[s+1]),a=new xt(e[0],e[1]),u=xt.ScaleWOrigin(o,a,i);r[s]=u.x+n[0],r[s+1]=u.y+n[1];}}function ja(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var i=new xt(t[0],t[1]);for(var s=0;s<r.length;s+=2){var o=new xt(r[s],r[s+1]),a=new xt(e[0],e[1]),u=xt.ScaleWOrigin(o,a,i);r[s]=u.x+n[0],r[s+1]=u.y+n[1];}}function eAt(r,t){return r[0]>=t.x&&r[0]<=t.x+t.w&&r[1]>=t.y&&r[1]<=t.y+t.h;}function RT(r,t){var e=r<=t?1:r/t,n=t<=r?1:t/r;return[e,n];}function rAt(r){var _iterator68=_createForOfIteratorHelper(r),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var t=_step68.value;if(isNaN(t)||t===1/0||t===-1/0)return!1;}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}return!0;}function nAt(r){return r!==Math.floor(r);}function iAt(r){var t=r.toString();return t.indexOf(".")!==-1?t.split(".")[1].length:0;}function sAt(r,t){for(;t!==0;){var _ref79=[t,r%t];r=_ref79[0];t=_ref79[1];}return r;}var oAt=function oAt(r){if(r.tagName==="GROUP"){var t=Object.getOwnPropertySymbols(r).find(function(e){return e.toString()==="Symbol(sealed)";});if(t&&r[t])return!0;}return!1;},_zr=function zr(r,t){if(r.mesh&&r.mesh.texture&&r.name==="eraserTexture"){var e=r.mesh.texture.image;t.deleteTexture(e);}else if(r.tagName==="GROUP"&&r&&r.children){var _iterator69=_createForOfIteratorHelper(r.children),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _e9=_step69.value;_zr(_e9,t);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}},Kr=function Kr(r,t){_zr(r,t),r.removeAllChildren();},aAt=function aAt(r,t,e){var n=e.parent;if(t){var i=t.children;if(i){var _iterator70=_createForOfIteratorHelper(i),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var s=_step70.value;if(_zr(s,n),s.tagName==="GROUP"){var _iterator71=_createForOfIteratorHelper(s.children),_step71;try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){var o=_step71.value;_zr(o,n);}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}}}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}}}t.parent.replaceChild(r,t);},lAt=function lAt(r,t,e){if(r.w+r.x<=0||r.h+r.y<=0||r.w<=0||r.h<=0)return;var n=t.width,i=t.height,s={x:Math.floor(Math.max(0,r.x)),y:Math.floor(Math.max(0,r.y)),w:Math.floor(Math.min(n,r.w)),h:Math.floor(Math.min(i,r.h))};if(s.x+s.w>n&&(s.w=Math.floor(n-s.x)),s.y+s.h>i&&(s.h=Math.floor(i-s.y)),nAt(e)){var o=iAt(e),a=Math.pow(10,o),u=sAt(a,e*a),h=s.x%u,v=s.x-h;v>=0?(s.x=v,s.w=s.w+h):(s.x=0,s.w=s.w+h-v);var p=s.y%u,y=s.y-p;y>=0?(s.y=y,s.h=s.h+p):(s.y=0,s.h=s.h+p-y);}return s;};function Co(r){return"".concat(bu(r.x),",").concat(bu(r.y)," ");}function xo(r,t){return"".concat(bu((r.x+t.x)/2),",").concat(bu((r.y+t.y)/2)," ");}function bu(r){return+r.toFixed(4);}var el=function el(r,t){return r.x+r.w<t.x||r.x>t.x+t.w||r.y+r.h<t.y||r.y>t.y+t.h?es.outside:r.x>=t.x&&r.y>=t.y&&r.x+r.w<=t.x+t.w&&r.y+r.h<=t.y+t.h?es.inside:es.intersect;};function cAt(r){var t=0;for(var e=0;e<r.length;e++){var n=r.charCodeAt(e);n>=1&&n<=126||65376<=n&&n<=65439?t++:t+=2;}return t;}var Y1=/*#__PURE__*/function(){function Y1(t){_classCallCheck(this,Y1);ht(this,"_map");ht(this,"_observers",/* @__PURE__ */new Set());this._map=new Map(t);}return _createClass(Y1,[{key:"notifyObservers",value:function notifyObservers(t,e,n){var _iterator72=_createForOfIteratorHelper(this._observers),_step72;try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){var i=_step72.value;i(t,e,n);}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}},{key:"observe",value:function observe(t){this._observers.add(t);}},{key:"unobserve",value:function unobserve(t){this._observers.delete(t);}},{key:"get",value:function get(t){return this._map.get(t);}},{key:"set",value:function set(t,e){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var i=this._map.has(t)?"update":"add";return this._map.set(t,e),n&&this.notifyObservers(i,t,e),this;}},{key:"has",value:function has(t){return this._map.has(t);}},{key:"delete",value:function _delete(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var n=this._map.get(t),i=this._map.delete(t);return e&&n&&this.notifyObservers("delete",t,n),i;}},{key:"clear",value:function clear(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var e=this._map.keys();if(this._map.clear(),t){var _iterator73=_createForOfIteratorHelper(e),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var n=_step73.value;this.notifyObservers("clear",n,void 0);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}}}},{key:"size",get:function get(){return this._map.size;}},{key:"keys",value:function keys(){return this._map.keys();}},{key:"values",value:function values(){return this._map.values();}},{key:"entries",value:function entries(){return this._map.entries();}},{key:"forEach",value:function forEach(t,e){this._map.forEach(t,e);}}]);}();function OT(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:r.length-1;var i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:uAt;for(;n>e;){if(n-e>600){var u=n-e+1,h=t-e+1,v=Math.log(u),p=0.5*Math.exp(2*v/3),y=0.5*Math.sqrt(v*p*(u-p)/u)*(h-u/2<0?-1:1),C=Math.max(e,Math.floor(t-h*p/u+y)),b=Math.min(n,Math.floor(t+(u-h)*p/u+y));OT(r,t,C,b,i);}var s=r[t];var o=e,a=n;for(Na(r,e,t),i(r[n],s)>0&&Na(r,e,n);o<a;){for(Na(r,o,a),o++,a--;i(r[o],s)<0;)o++;for(;i(r[a],s)>0;)a--;}i(r[e],s)===0?Na(r,e,a):(a++,Na(r,a,n)),a<=t&&(e=a+1),t<=a&&(n=a-1);}}function Na(r,t,e){var n=r[t];r[t]=r[e],r[e]=n;}function uAt(r,t){return r<t?-1:r>t?1:0;}var fAt=/*#__PURE__*/function(){function fAt(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:9;_classCallCheck(this,fAt);this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*0.4)),this.clear();}return _createClass(fAt,[{key:"all",value:function all(){return this._all(this.data,[]);}},{key:"search",value:function search(t){var e=this.data;var n=[];if(!Zc(t,e))return n;var i=this.toBBox,s=[];for(;e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],u=e.leaf?i(a):a;Zc(t,u)&&(e.leaf?n.push(a):Wd(t,u)?this._all(a,n):s.push(a));}e=s.pop();}return n;}},{key:"collides",value:function collides(t){var e=this.data;if(!Zc(t,e))return!1;var n=[];for(;e;){for(var i=0;i<e.children.length;i++){var s=e.children[i],o=e.leaf?this.toBBox(s):s;if(Zc(t,o)){if(e.leaf||Wd(t,o))return!0;n.push(s);}}e=n.pop();}return!1;}},{key:"load",value:function load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(var n=0;n<t.length;n++)this.insert(t[n]);return this;}var e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){var _n4=this.data;this.data=e,e=_n4;}this._insert(e,this.data.height-e.height-1,!0);}return this;}},{key:"insert",value:function insert(t){return t&&this._insert(t,this.data.height-1),this;}},{key:"clear",value:function clear(){return this.data=bo([]),this;}},{key:"remove",value:function remove(t,e){if(!t)return this;var n=this.data;var i=this.toBBox(t),s=[],o=[];var a,u,h;for(;n||s.length;){if(n||(n=s.pop(),u=s[s.length-1],a=o.pop(),h=!0),n.leaf){var v=hAt(t,n.children,e);if(v!==-1)return n.children.splice(v,1),s.push(n),this._condense(s),this;}!h&&!n.leaf&&Wd(n,i)?(s.push(n),o.push(a),a=0,u=n,n=n.children[0]):u?(a++,n=u.children[a],h=!1):n=null;}return this;}},{key:"toBBox",value:function toBBox(t){return t;}},{key:"compareMinX",value:function compareMinX(t,e){return t.minX-e.minX;}},{key:"compareMinY",value:function compareMinY(t,e){return t.minY-e.minY;}},{key:"toJSON",value:function toJSON(){return this.data;}},{key:"fromJSON",value:function fromJSON(t){return this.data=t,this;}},{key:"_all",value:function _all(t,e){var n=[];for(;t;)t.leaf?e.push.apply(e,_toConsumableArray(t.children)):n.push.apply(n,_toConsumableArray(t.children)),t=n.pop();return e;}},{key:"_build",value:function _build(t,e,n,i){var s=n-e+1;var o=this._maxEntries,a;if(s<=o)return a=bo(t.slice(e,n+1)),Po(a,this.toBBox),a;i||(i=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,i-1))),a=bo([]),a.leaf=!1,a.height=i;var u=Math.ceil(s/o),h=u*Math.ceil(Math.sqrt(o));G1(t,e,n,h,this.compareMinX);for(var v=e;v<=n;v+=h){var p=Math.min(v+h-1,n);G1(t,v,p,u,this.compareMinY);for(var y=v;y<=p;y+=u){var C=Math.min(y+u-1,p);a.children.push(this._build(t,y,C,i-1));}}return Po(a,this.toBBox),a;}},{key:"_chooseSubtree",value:function _chooseSubtree(t,e,n,i){for(;i.push(e),!(e.leaf||i.length-1===n);){var s=1/0,o=1/0,a=void 0;for(var u=0;u<e.children.length;u++){var h=e.children[u],v=Fd(h),p=vAt(t,h)-v;p<o?(o=p,s=v<s?v:s,a=h):p===o&&v<s&&(s=v,a=h);}e=a||e.children[0];}return e;}},{key:"_insert",value:function _insert(t,e,n){var i=n?t:this.toBBox(t),s=[],o=this._chooseSubtree(i,this.data,e,s);for(o.children.push(t),Ua(o,i);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(i,s,e);}// split overflowed node into two
|
|
482
|
+
ai(Ht,Bt)))&&Rt.push(Ht);return Rt;}function pg(l){var f=l.length;return f?l[sh(0,f-1)]:e;}function MC(l,f){return tc(jr(l),vs(f,0,l.length));}function LC(l){return tc(jr(l));}function qf(l,f,I){(I!==e&&!On(l[f],I)||I===e&&!(f in l))&&Xn(l,f,I);}function ua(l,f,I){var W=l[f];(!(Ue.call(l,f)&&On(W,I))||I===e&&!(f in l))&&Xn(l,f,I);}function $l(l,f){for(var I=l.length;I--;)if(On(l[I][0],f))return I;return-1;}function RC(l,f,I,W){return Fi(l,function(it,yt,bt){f(W,it,I(it),bt);}),W;}function vg(l,f){return l&&Vn(f,mr(f),l);}function OC(l,f){return l&&Vn(f,Hr(f),l);}function Xn(l,f,I){f=="__proto__"&&kl?kl(l,f,{configurable:!0,enumerable:!0,value:I,writable:!0}):l[f]=I;}function Kf(l,f){for(var I=-1,W=f.length,it=zt(W),yt=l==null;++I<W;)it[I]=yt?e:Rh(l,f[I]);return it;}function vs(l,f,I){return l===l&&(I!==e&&(l=l<=I?l:I),f!==e&&(l=l>=f?l:f)),l;}function Sn(l,f,I,W,it,yt){var bt,Rt=f&y,Bt=f&C,Ht=f&b;if(I&&(bt=it?I(l,W,it,yt):I(l)),bt!==e)return bt;if(!er(l))return l;var Vt=ge(l);if(Vt){if(bt=Sx(l),!Rt)return jr(l,bt);}else{var qt=Rr(l),ie=qt==J||qt==Q;if($i(l))return Ug(l,Rt);if(qt==T||qt==lt||ie&&!it){if(bt=Bt||ie?{}:i0(l),!Rt)return Bt?cx(l,OC(bt,l)):lx(l,vg(bt,l));}else{if(!Ve[qt])return it?l:{};bt=Tx(l,qt,Rt);}}yt||(yt=new Ln());var ce=yt.get(l);if(ce)return ce;yt.set(l,bt),D0(l)?l.forEach(function(fe){bt.add(Sn(fe,f,I,fe,l,yt));}):R0(l)&&l.forEach(function(fe,be){bt.set(be,Sn(fe,f,I,be,l,yt));});var de=Ht?Bt?gh:vh:Bt?Hr:mr,Ce=Vt?e:de(l);return sn(Ce||l,function(fe,be){Ce&&(be=fe,fe=l[be]),ua(bt,be,Sn(fe,f,I,be,l,yt));}),bt;}function DC(l){var f=mr(l);return function(I){return gg(I,l,f);};}function gg(l,f,I){var W=I.length;if(l==null)return!W;for(l=Xe(l);W--;){var it=I[W],yt=f[it],bt=l[it];if(bt===e&&!(it in l)||!yt(bt))return!1;}return!0;}function mg(l,f,I){if(typeof l!="function")throw new yn(o);return ma(function(){l.apply(e,I);},f);}function fa(l,f,I,W){var it=-1,yt=xl,bt=!0,Rt=l.length,Bt=[],Ht=f.length;if(!Rt)return Bt;I&&(f=Je(f,on(I))),W?(yt=Bf,bt=!1):f.length>=i&&(yt=ia,bt=!1,f=new ps(f));t:for(;++it<Rt;){var Vt=l[it],qt=I==null?Vt:I(Vt);if(Vt=W||Vt!==0?Vt:0,bt&&qt===qt){for(var ie=Ht;ie--;)if(f[ie]===qt)continue t;Bt.push(Vt);}else yt(f,qt,W)||Bt.push(Vt);}return Bt;}var Fi=jg(Hn),yg=jg(Jf,!0);function NC(l,f){var I=!0;return Fi(l,function(W,it,yt){return I=!!f(W,it,yt),I;}),I;}function Yl(l,f,I){for(var W=-1,it=l.length;++W<it;){var yt=l[W],bt=f(yt);if(bt!=null&&(Rt===e?bt===bt&&!ln(bt):I(bt,Rt)))var Rt=bt,Bt=yt;}return Bt;}function kC(l,f,I,W){var it=l.length;for(I=Te(I),I<0&&(I=-I>it?0:it+I),W=W===e||W>it?it:Te(W),W<0&&(W+=it),W=I>W?0:k0(W);I<W;)l[I++]=f;return l;}function wg(l,f){var I=[];return Fi(l,function(W,it,yt){f(W,it,yt)&&I.push(W);}),I;}function Cr(l,f,I,W,it){var yt=-1,bt=l.length;for(I||(I=Cx),it||(it=[]);++yt<bt;){var Rt=l[yt];f>0&&I(Rt)?f>1?Cr(Rt,f-1,I,W,it):Ni(it,Rt):W||(it[it.length]=Rt);}return it;}var Qf=Xg(),Sg=Xg(!0);function Hn(l,f){return l&&Qf(l,f,mr);}function Jf(l,f){return l&&Sg(l,f,mr);}function Gl(l,f){return Di(f,function(I){return li(l[I]);});}function gs(l,f){f=Ui(f,l);for(var I=0,W=f.length;l!=null&&I<W;)l=l[Rn(f[I++])];return I&&I==W?l:e;}function Tg(l,f,I){var W=f(l);return ge(l)?W:Ni(W,I(l));}function Fr(l){return l==null?l===e?mt:g:hs&&hs in Xe(l)?mx(l):Lx(l);}function _f(l,f){return l>f;}function BC(l,f){return l!=null&&Ue.call(l,f);}function FC(l,f){return l!=null&&f in Xe(l);}function WC(l,f,I){return l>=Lr(f,I)&&l<hr(f,I);}function th(l,f,I){for(var W=I?Bf:xl,it=l[0].length,yt=l.length,bt=yt,Rt=zt(yt),Bt=1/0,Ht=[];bt--;){var Vt=l[bt];bt&&f&&(Vt=Je(Vt,on(f))),Bt=Lr(Vt.length,Bt),Rt[bt]=!I&&(f||it>=120&&Vt.length>=120)?new ps(bt&&Vt):e;}Vt=l[0];var qt=-1,ie=Rt[0];t:for(;++qt<it&&Ht.length<Bt;){var ce=Vt[qt],de=f?f(ce):ce;if(ce=I||ce!==0?ce:0,!(ie?ia(ie,de):W(Ht,de,I))){for(bt=yt;--bt;){var Ce=Rt[bt];if(!(Ce?ia(Ce,de):W(l[bt],de,I)))continue t;}ie&&ie.push(de),Ht.push(ce);}}return Ht;}function UC(l,f,I,W){return Hn(l,function(it,yt,bt){f(W,I(it),yt,bt);}),W;}function ha(l,f,I){f=Ui(f,l),l=l0(l,f);var W=l==null?l:l[Rn(In(f))];return W==null?e:nn(W,l,I);}function Ig(l){return rr(l)&&Fr(l)==lt;}function zC(l){return rr(l)&&Fr(l)==Lt;}function $C(l){return rr(l)&&Fr(l)==Ot;}function da(l,f,I,W,it){return l===f?!0:l==null||f==null||!rr(l)&&!rr(f)?l!==l&&f!==f:YC(l,f,I,W,da,it);}function YC(l,f,I,W,it,yt){var bt=ge(l),Rt=ge(f),Bt=bt?dt:Rr(l),Ht=Rt?dt:Rr(f);Bt=Bt==lt?T:Bt,Ht=Ht==lt?T:Ht;var Vt=Bt==T,qt=Ht==T,ie=Bt==Ht;if(ie&&$i(l)){if(!$i(f))return!1;bt=!0,Vt=!1;}if(ie&&!Vt)return yt||(yt=new Ln()),bt||po(l)?e0(l,f,I,W,it,yt):vx(l,f,Bt,I,W,it,yt);if(!(I&M)){var ce=Vt&&Ue.call(l,"__wrapped__"),de=qt&&Ue.call(f,"__wrapped__");if(ce||de){var Ce=ce?l.value():l,fe=de?f.value():f;return yt||(yt=new Ln()),it(Ce,fe,I,W,yt);}}return ie?(yt||(yt=new Ln()),gx(l,f,I,W,it,yt)):!1;}function GC(l){return rr(l)&&Rr(l)==V;}function eh(l,f,I,W){var it=I.length,yt=it,bt=!W;if(l==null)return!yt;for(l=Xe(l);it--;){var Rt=I[it];if(bt&&Rt[2]?Rt[1]!==l[Rt[0]]:!(Rt[0]in l))return!1;}for(;++it<yt;){Rt=I[it];var Bt=Rt[0],Ht=l[Bt],Vt=Rt[1];if(bt&&Rt[2]){if(Ht===e&&!(Bt in l))return!1;}else{var qt=new Ln();if(W)var ie=W(Ht,Vt,Bt,l,f,qt);if(!(ie===e?da(Vt,Ht,M|L,W,qt):ie))return!1;}}return!0;}function Cg(l){if(!er(l)||Px(l))return!1;var f=li(l)?GI:Sf;return f.test(ys(l));}function jC(l){return rr(l)&&Fr(l)==st;}function XC(l){return rr(l)&&Rr(l)==ft;}function HC(l){return rr(l)&&oc(l.length)&&!!qe[Fr(l)];}function xg(l){return typeof l=="function"?l:l==null?Vr:_typeof(l)=="object"?ge(l)?Ag(l[0],l[1]):bg(l):V0(l);}function rh(l){if(!ga(l))return qI(l);var f=[];for(var I in Xe(l))Ue.call(l,I)&&I!="constructor"&&f.push(I);return f;}function VC(l){if(!er(l))return Mx(l);var f=ga(l),I=[];for(var W in l)W=="constructor"&&(f||!Ue.call(l,W))||I.push(W);return I;}function nh(l,f){return l<f;}function Pg(l,f){var I=-1,W=Xr(l)?zt(l.length):[];return Fi(l,function(it,yt,bt){W[++I]=f(it,yt,bt);}),W;}function bg(l){var f=yh(l);return f.length==1&&f[0][2]?o0(f[0][0],f[0][1]):function(I){return I===l||eh(I,l,f);};}function Ag(l,f){return Sh(l)&&s0(f)?o0(Rn(l),f):function(I){var W=Rh(I,l);return W===e&&W===f?Oh(I,l):da(f,W,M|L);};}function jl(l,f,I,W,it){l!==f&&Qf(f,function(yt,bt){if(it||(it=new Ln()),er(yt))ZC(l,f,bt,I,jl,W,it);else{var Rt=W?W(Ih(l,bt),yt,bt+"",l,f,it):e;Rt===e&&(Rt=yt),qf(l,bt,Rt);}},Hr);}function ZC(l,f,I,W,it,yt,bt){var Rt=Ih(l,I),Bt=Ih(f,I),Ht=bt.get(Bt);if(Ht){qf(l,I,Ht);return;}var Vt=yt?yt(Rt,Bt,I+"",l,f,bt):e,qt=Vt===e;if(qt){var ie=ge(Bt),ce=!ie&&$i(Bt),de=!ie&&!ce&&po(Bt);Vt=Bt,ie||ce||de?ge(Rt)?Vt=Rt:ir(Rt)?Vt=jr(Rt):ce?(qt=!1,Vt=Ug(Bt,!0)):de?(qt=!1,Vt=zg(Bt,!0)):Vt=[]:ya(Bt)||ws(Bt)?(Vt=Rt,ws(Rt)?Vt=B0(Rt):(!er(Rt)||li(Rt))&&(Vt=i0(Bt))):qt=!1;}qt&&(bt.set(Bt,Vt),it(Vt,Bt,W,yt,bt),bt.delete(Bt)),qf(l,I,Vt);}function Eg(l,f){var I=l.length;if(I)return f+=f<0?I:0,ai(f,I)?l[f]:e;}function Mg(l,f,I){f.length?f=Je(f,function(yt){return ge(yt)?function(bt){return gs(bt,yt.length===1?yt[0]:yt);}:yt;}):f=[Vr];var W=-1;f=Je(f,on(he()));var it=Pg(l,function(yt,bt,Rt){var Bt=Je(f,function(Ht){return Ht(yt);});return{criteria:Bt,index:++W,value:yt};});return TI(it,function(yt,bt){return ax(yt,bt,I);});}function qC(l,f){return Lg(l,f,function(I,W){return Oh(l,W);});}function Lg(l,f,I){for(var W=-1,it=f.length,yt={};++W<it;){var bt=f[W],Rt=gs(l,bt);I(Rt,bt)&&pa(yt,Ui(bt,l),Rt);}return yt;}function KC(l){return function(f){return gs(f,l);};}function ih(l,f,I,W){var it=W?SI:ro,yt=-1,bt=f.length,Rt=l;for(l===f&&(f=jr(f)),I&&(Rt=Je(l,on(I)));++yt<bt;)for(var Bt=0,Ht=f[yt],Vt=I?I(Ht):Ht;(Bt=it(Rt,Vt,Bt,W))>-1;)Rt!==l&&Nl.call(Rt,Bt,1),Nl.call(l,Bt,1);return l;}function Rg(l,f){for(var I=l?f.length:0,W=I-1;I--;){var it=f[I];if(I==W||it!==yt){var yt=it;ai(it)?Nl.call(l,it,1):lh(l,it);}}return l;}function sh(l,f){return l+Fl(fg()*(f-l+1));}function QC(l,f,I,W){for(var it=-1,yt=hr(Bl((f-l)/(I||1)),0),bt=zt(yt);yt--;)bt[W?yt:++it]=l,l+=I;return bt;}function oh(l,f){var I="";if(!l||f<1||f>at)return I;do f%2&&(I+=l),f=Fl(f/2),f&&(l+=l);while(f);return I;}function xe(l,f){return Ch(a0(l,f,Vr),l+"");}function JC(l){return pg(vo(l));}function _C(l,f){var I=vo(l);return tc(I,vs(f,0,I.length));}function pa(l,f,I,W){if(!er(l))return l;f=Ui(f,l);for(var it=-1,yt=f.length,bt=yt-1,Rt=l;Rt!=null&&++it<yt;){var Bt=Rn(f[it]),Ht=I;if(Bt==="__proto__"||Bt==="constructor"||Bt==="prototype")return l;if(it!=bt){var Vt=Rt[Bt];Ht=W?W(Vt,Bt,Rt):e,Ht===e&&(Ht=er(Vt)?Vt:ai(f[it+1])?[]:{});}ua(Rt,Bt,Ht),Rt=Rt[Bt];}return l;}var Og=Wl?function(l,f){return Wl.set(l,f),l;}:Vr,tx=kl?function(l,f){return kl(l,"toString",{configurable:!0,enumerable:!1,value:Nh(f),writable:!0});}:Vr;function ex(l){return tc(vo(l));}function Tn(l,f,I){var W=-1,it=l.length;f<0&&(f=-f>it?0:it+f),I=I>it?it:I,I<0&&(I+=it),it=f>I?0:I-f>>>0,f>>>=0;for(var yt=zt(it);++W<it;)yt[W]=l[W+f];return yt;}function rx(l,f){var I;return Fi(l,function(W,it,yt){return I=f(W,it,yt),!I;}),!!I;}function Xl(l,f,I){var W=0,it=l==null?W:l.length;if(typeof f=="number"&&f===f&&it<=_){for(;W<it;){var yt=W+it>>>1,bt=l[yt];bt!==null&&!ln(bt)&&(I?bt<=f:bt<f)?W=yt+1:it=yt;}return it;}return ah(l,f,Vr,I);}function ah(l,f,I,W){var it=0,yt=l==null?0:l.length;if(yt===0)return 0;f=I(f);for(var bt=f!==f,Rt=f===null,Bt=ln(f),Ht=f===e;it<yt;){var Vt=Fl((it+yt)/2),qt=I(l[Vt]),ie=qt!==e,ce=qt===null,de=qt===qt,Ce=ln(qt);if(bt)var fe=W||de;else Ht?fe=de&&(W||ie):Rt?fe=de&&ie&&(W||!ce):Bt?fe=de&&ie&&!ce&&(W||!Ce):ce||Ce?fe=!1:fe=W?qt<=f:qt<f;fe?it=Vt+1:yt=Vt;}return Lr(yt,$);}function Dg(l,f){for(var I=-1,W=l.length,it=0,yt=[];++I<W;){var bt=l[I],Rt=f?f(bt):bt;if(!I||!On(Rt,Bt)){var Bt=Rt;yt[it++]=bt===0?0:bt;}}return yt;}function Ng(l){return typeof l=="number"?l:ln(l)?Ct:+l;}function an(l){if(typeof l=="string")return l;if(ge(l))return Je(l,an)+"";if(ln(l))return hg?hg.call(l):"";var f=l+"";return f=="0"&&1/l==-q?"-0":f;}function Wi(l,f,I){var W=-1,it=xl,yt=l.length,bt=!0,Rt=[],Bt=Rt;if(I)bt=!1,it=Bf;else if(yt>=i){var Ht=f?null:dx(l);if(Ht)return bl(Ht);bt=!1,it=ia,Bt=new ps();}else Bt=f?[]:Rt;t:for(;++W<yt;){var Vt=l[W],qt=f?f(Vt):Vt;if(Vt=I||Vt!==0?Vt:0,bt&&qt===qt){for(var ie=Bt.length;ie--;)if(Bt[ie]===qt)continue t;f&&Bt.push(qt),Rt.push(Vt);}else it(Bt,qt,I)||(Bt!==Rt&&Bt.push(qt),Rt.push(Vt));}return Rt;}function lh(l,f){f=Ui(f,l);var I=-1,W=f.length;if(!W)return!0;for(;++I<W;){var it=Rn(f[I]);if(it==="__proto__"&&!Ue.call(l,"__proto__")||(it==="constructor"||it==="prototype")&&I<W-1)return!1;}var yt=l0(l,f);return yt==null||delete yt[Rn(In(f))];}function kg(l,f,I,W){return pa(l,f,I(gs(l,f)),W);}function Hl(l,f,I,W){for(var it=l.length,yt=W?it:-1;(W?yt--:++yt<it)&&f(l[yt],yt,l););return I?Tn(l,W?0:yt,W?yt+1:it):Tn(l,W?yt+1:0,W?it:yt);}function Bg(l,f){var I=l;return I instanceof Ee&&(I=I.value()),Ff(f,function(W,it){return it.func.apply(it.thisArg,Ni([W],it.args));},I);}function ch(l,f,I){var W=l.length;if(W<2)return W?Wi(l[0]):[];for(var it=-1,yt=zt(W);++it<W;)for(var bt=l[it],Rt=-1;++Rt<W;)Rt!=it&&(yt[it]=fa(yt[it]||bt,l[Rt],f,I));return Wi(Cr(yt,1),f,I);}function Fg(l,f,I){for(var W=-1,it=l.length,yt=f.length,bt={};++W<it;){var Rt=W<yt?f[W]:e;I(bt,l[W],Rt);}return bt;}function uh(l){return ir(l)?l:[];}function fh(l){return typeof l=="function"?l:Vr;}function Ui(l,f){return ge(l)?l:Sh(l,f)?[l]:h0(ze(l));}var nx=xe;function zi(l,f,I){var W=l.length;return I=I===e?W:I,!f&&I>=W?l:Tn(l,f,I);}var Wg=jI||function(l){return Ir.clearTimeout(l);};function Ug(l,f){if(f)return l.slice();var I=l.length,W=og?og(I):new l.constructor(I);return l.copy(W),W;}function hh(l){var f=new l.constructor(l.byteLength);return new Ol(f).set(new Ol(l)),f;}function ix(l,f){var I=f?hh(l.buffer):l.buffer;return new l.constructor(I,l.byteOffset,l.byteLength);}function sx(l){var f=new l.constructor(l.source,An.exec(l));return f.lastIndex=l.lastIndex,f;}function ox(l){return ca?Xe(ca.call(l)):{};}function zg(l,f){var I=f?hh(l.buffer):l.buffer;return new l.constructor(I,l.byteOffset,l.length);}function $g(l,f){if(l!==f){var I=l!==e,W=l===null,it=l===l,yt=ln(l),bt=f!==e,Rt=f===null,Bt=f===f,Ht=ln(f);if(!Rt&&!Ht&&!yt&&l>f||yt&&bt&&Bt&&!Rt&&!Ht||W&&bt&&Bt||!I&&Bt||!it)return 1;if(!W&&!yt&&!Ht&&l<f||Ht&&I&&it&&!W&&!yt||Rt&&I&&it||!bt&&it||!Bt)return-1;}return 0;}function ax(l,f,I){for(var W=-1,it=l.criteria,yt=f.criteria,bt=it.length,Rt=I.length;++W<bt;){var Bt=$g(it[W],yt[W]);if(Bt){if(W>=Rt)return Bt;var Ht=I[W];return Bt*(Ht=="desc"?-1:1);}}return l.index-f.index;}function Yg(l,f,I,W){for(var it=-1,yt=l.length,bt=I.length,Rt=-1,Bt=f.length,Ht=hr(yt-bt,0),Vt=zt(Bt+Ht),qt=!W;++Rt<Bt;)Vt[Rt]=f[Rt];for(;++it<bt;)(qt||it<yt)&&(Vt[I[it]]=l[it]);for(;Ht--;)Vt[Rt++]=l[it++];return Vt;}function Gg(l,f,I,W){for(var it=-1,yt=l.length,bt=-1,Rt=I.length,Bt=-1,Ht=f.length,Vt=hr(yt-Rt,0),qt=zt(Vt+Ht),ie=!W;++it<Vt;)qt[it]=l[it];for(var ce=it;++Bt<Ht;)qt[ce+Bt]=f[Bt];for(;++bt<Rt;)(ie||it<yt)&&(qt[ce+I[bt]]=l[it++]);return qt;}function jr(l,f){var I=-1,W=l.length;for(f||(f=zt(W));++I<W;)f[I]=l[I];return f;}function Vn(l,f,I,W){var it=!I;I||(I={});for(var yt=-1,bt=f.length;++yt<bt;){var Rt=f[yt],Bt=W?W(I[Rt],l[Rt],Rt,I,l):e;Bt===e&&(Bt=l[Rt]),it?Xn(I,Rt,Bt):ua(I,Rt,Bt);}return I;}function lx(l,f){return Vn(l,wh(l),f);}function cx(l,f){return Vn(l,r0(l),f);}function Vl(l,f){return function(I,W){var it=ge(I)?pI:RC,yt=f?f():{};return it(I,l,he(W,2),yt);};}function uo(l){return xe(function(f,I){var W=-1,it=I.length,yt=it>1?I[it-1]:e,bt=it>2?I[2]:e;for(yt=l.length>3&&typeof yt=="function"?(it--,yt):e,bt&&Wr(I[0],I[1],bt)&&(yt=it<3?e:yt,it=1),f=Xe(f);++W<it;){var Rt=I[W];Rt&&l(f,Rt,W,yt);}return f;});}function jg(l,f){return function(I,W){if(I==null)return I;if(!Xr(I))return l(I,W);for(var it=I.length,yt=f?it:-1,bt=Xe(I);(f?yt--:++yt<it)&&W(bt[yt],yt,bt)!==!1;);return I;};}function Xg(l){return function(f,I,W){for(var it=-1,yt=Xe(f),bt=W(f),Rt=bt.length;Rt--;){var Bt=bt[l?Rt:++it];if(I(yt[Bt],Bt,yt)===!1)break;}return f;};}function ux(l,f,I){var W=f&X,it=va(l);function yt(){var bt=this&&this!==Ir&&this instanceof yt?it:l;return bt.apply(W?I:this,arguments);}return yt;}function Hg(l){return function(f){f=ze(f);var I=no(f)?Mn(f):e,W=I?I[0]:f.charAt(0),it=I?zi(I,1).join(""):f.slice(1);return W[l]()+it;};}function fo(l){return function(f){return Ff(X0(j0(f).replace(tI,"")),l,"");};}function va(l){return function(){var f=arguments;switch(f.length){case 0:return new l();case 1:return new l(f[0]);case 2:return new l(f[0],f[1]);case 3:return new l(f[0],f[1],f[2]);case 4:return new l(f[0],f[1],f[2],f[3]);case 5:return new l(f[0],f[1],f[2],f[3],f[4]);case 6:return new l(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return new l(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);}var I=co(l.prototype),W=l.apply(I,f);return er(W)?W:I;};}function fx(l,f,I){var W=va(l);function it(){for(var yt=arguments.length,bt=zt(yt),Rt=yt,Bt=ho(it);Rt--;)bt[Rt]=arguments[Rt];var Ht=yt<3&&bt[0]!==Bt&&bt[yt-1]!==Bt?[]:ki(bt,Bt);if(yt-=Ht.length,yt<I)return Qg(l,f,Zl,it.placeholder,e,bt,Ht,e,e,I-yt);var Vt=this&&this!==Ir&&this instanceof it?W:l;return nn(Vt,this,bt);}return it;}function Vg(l){return function(f,I,W){var it=Xe(f);if(!Xr(f)){var yt=he(I,3);f=mr(f),I=function I(Rt){return yt(it[Rt],Rt,it);};}var bt=l(f,I,W);return bt>-1?it[yt?f[bt]:bt]:e;};}function Zg(l){return oi(function(f){var I=f.length,W=I,it=wn.prototype.thru;for(l&&f.reverse();W--;){var yt=f[W];if(typeof yt!="function")throw new yn(o);if(it&&!bt&&Jl(yt)=="wrapper")var bt=new wn([],!0);}for(W=bt?W:I;++W<I;){yt=f[W];var Rt=Jl(yt),Bt=Rt=="wrapper"?mh(yt):e;Bt&&Th(Bt[0])&&Bt[1]==(P|A|S|z)&&!Bt[4].length&&Bt[9]==1?bt=bt[Jl(Bt[0])].apply(bt,Bt[3]):bt=yt.length==1&&Th(yt)?bt[Rt]():bt.thru(yt);}return function(){var Ht=arguments,Vt=Ht[0];if(bt&&Ht.length==1&&ge(Vt))return bt.plant(Vt).value();for(var qt=0,ie=I?f[qt].apply(this,Ht):Vt;++qt<I;)ie=f[qt].call(this,ie);return ie;};});}function Zl(l,f,I,W,it,yt,bt,Rt,Bt,Ht){var Vt=f&P,qt=f&X,ie=f&Y,ce=f&(A|w),de=f&U,Ce=ie?e:va(l);function fe(){for(var be=arguments.length,Le=zt(be),cn=be;cn--;)Le[cn]=arguments[cn];if(ce)var Ur=ho(fe),un=CI(Le,Ur);if(W&&(Le=Yg(Le,W,it,ce)),yt&&(Le=Gg(Le,yt,bt,ce)),be-=un,ce&&be<Ht){var sr=ki(Le,Ur);return Qg(l,f,Zl,fe.placeholder,I,Le,sr,Rt,Bt,Ht-be);}var Dn=qt?I:this,ui=ie?Dn[l]:l;return be=Le.length,Rt?Le=Rx(Le,Rt):de&&be>1&&Le.reverse(),Vt&&Bt<be&&(Le.length=Bt),this&&this!==Ir&&this instanceof fe&&(ui=Ce||va(ui)),ui.apply(Dn,Le);}return fe;}function qg(l,f){return function(I,W){return UC(I,l,f(W),{});};}function ql(l,f){return function(I,W){var it;if(I===e&&W===e)return f;if(I!==e&&(it=I),W!==e){if(it===e)return W;typeof I=="string"||typeof W=="string"?(I=an(I),W=an(W)):(I=Ng(I),W=Ng(W)),it=l(I,W);}return it;};}function dh(l){return oi(function(f){return f=Je(f,on(he())),xe(function(I){var W=this;return l(f,function(it){return nn(it,W,I);});});});}function Kl(l,f){f=f===e?" ":an(f);var I=f.length;if(I<2)return I?oh(f,l):f;var W=oh(f,Bl(l/io(f)));return no(f)?zi(Mn(W),0,l).join(""):W.slice(0,l);}function hx(l,f,I,W){var it=f&X,yt=va(l);function bt(){for(var Rt=-1,Bt=arguments.length,Ht=-1,Vt=W.length,qt=zt(Vt+Bt),ie=this&&this!==Ir&&this instanceof bt?yt:l;++Ht<Vt;)qt[Ht]=W[Ht];for(;Bt--;)qt[Ht++]=arguments[++Rt];return nn(ie,it?I:this,qt);}return bt;}function Kg(l){return function(f,I,W){return W&&typeof W!="number"&&Wr(f,I,W)&&(I=W=e),f=ci(f),I===e?(I=f,f=0):I=ci(I),W=W===e?f<I?1:-1:ci(W),QC(f,I,W,l);};}function Ql(l){return function(f,I){return typeof f=="string"&&typeof I=="string"||(f=Cn(f),I=Cn(I)),l(f,I);};}function Qg(l,f,I,W,it,yt,bt,Rt,Bt,Ht){var Vt=f&A,qt=Vt?bt:e,ie=Vt?e:bt,ce=Vt?yt:e,de=Vt?e:yt;f|=Vt?S:x,f&=~(Vt?x:S),f&et||(f&=-4);var Ce=[l,f,it,ce,qt,de,ie,Rt,Bt,Ht],fe=I.apply(e,Ce);return Th(l)&&c0(fe,Ce),fe.placeholder=W,u0(fe,l,f);}function ph(l){var f=fr[l];return function(I,W){if(I=Cn(I),W=W==null?0:Lr(Te(W),292),W&&ug(I)){var it=(ze(I)+"e").split("e"),yt=f(it[0]+"e"+(+it[1]+W));return it=(ze(yt)+"e").split("e"),+(it[0]+"e"+(+it[1]-W));}return f(I);};}var dx=ao&&1/bl(new ao([,-0]))[1]==q?function(l){return new ao(l);}:Fh;function Jg(l){return function(f){var I=Rr(f);return I==V?jf(f):I==ft?LI(f):II(f,l(f));};}function si(l,f,I,W,it,yt,bt,Rt){var Bt=f&Y;if(!Bt&&typeof l!="function")throw new yn(o);var Ht=W?W.length:0;if(Ht||(f&=-97,W=it=e),bt=bt===e?bt:hr(Te(bt),0),Rt=Rt===e?Rt:Te(Rt),Ht-=it?it.length:0,f&x){var Vt=W,qt=it;W=it=e;}var ie=Bt?e:mh(l),ce=[l,f,I,W,it,Vt,qt,yt,bt,Rt];if(ie&&Ex(ce,ie),l=ce[0],f=ce[1],I=ce[2],W=ce[3],it=ce[4],Rt=ce[9]=ce[9]===e?Bt?0:l.length:hr(ce[9]-Ht,0),!Rt&&f&(A|w)&&(f&=-25),!f||f==X)var de=ux(l,f,I);else f==A||f==w?de=fx(l,f,Rt):(f==S||f==(X|S))&&!it.length?de=hx(l,f,I,W):de=Zl.apply(e,ce);var Ce=ie?Og:c0;return u0(Ce(de,ce),l,f);}function _g(l,f,I,W){return l===e||On(l,oo[I])&&!Ue.call(W,I)?f:l;}function t0(l,f,I,W,it,yt){return er(l)&&er(f)&&(yt.set(f,l),jl(l,f,e,t0,yt),yt.delete(f)),l;}function px(l){return ya(l)?e:l;}function e0(l,f,I,W,it,yt){var bt=I&M,Rt=l.length,Bt=f.length;if(Rt!=Bt&&!(bt&&Bt>Rt))return!1;var Ht=yt.get(l),Vt=yt.get(f);if(Ht&&Vt)return Ht==f&&Vt==l;var qt=-1,ie=!0,ce=I&L?new ps():e;for(yt.set(l,f),yt.set(f,l);++qt<Rt;){var de=l[qt],Ce=f[qt];if(W)var fe=bt?W(Ce,de,qt,f,l,yt):W(de,Ce,qt,l,f,yt);if(fe!==e){if(fe)continue;ie=!1;break;}if(ce){if(!Wf(f,function(be,Le){if(!ia(ce,Le)&&(de===be||it(de,be,I,W,yt)))return ce.push(Le);})){ie=!1;break;}}else if(!(de===Ce||it(de,Ce,I,W,yt))){ie=!1;break;}}return yt.delete(l),yt.delete(f),ie;}function vx(l,f,I,W,it,yt,bt){switch(I){case Dt:if(l.byteLength!=f.byteLength||l.byteOffset!=f.byteOffset)return!1;l=l.buffer,f=f.buffer;case Lt:return!(l.byteLength!=f.byteLength||!yt(new Ol(l),new Ol(f)));case Et:case Ot:case tt:return On(+l,+f);case D:return l.name==f.name&&l.message==f.message;case st:case pt:return l==f+"";case V:var Rt=jf;case ft:var Bt=W&M;if(Rt||(Rt=bl),l.size!=f.size&&!Bt)return!1;var Ht=bt.get(l);if(Ht)return Ht==f;W|=L,bt.set(l,f);var Vt=e0(Rt(l),Rt(f),W,it,yt,bt);return bt.delete(l),Vt;case ot:if(ca)return ca.call(l)==ca.call(f);}return!1;}function gx(l,f,I,W,it,yt){var bt=I&M,Rt=vh(l),Bt=Rt.length,Ht=vh(f),Vt=Ht.length;if(Bt!=Vt&&!bt)return!1;for(var qt=Bt;qt--;){var ie=Rt[qt];if(!(bt?ie in f:Ue.call(f,ie)))return!1;}var ce=yt.get(l),de=yt.get(f);if(ce&&de)return ce==f&&de==l;var Ce=!0;yt.set(l,f),yt.set(f,l);for(var fe=bt;++qt<Bt;){ie=Rt[qt];var be=l[ie],Le=f[ie];if(W)var cn=bt?W(Le,be,ie,f,l,yt):W(be,Le,ie,l,f,yt);if(!(cn===e?be===Le||it(be,Le,I,W,yt):cn)){Ce=!1;break;}fe||(fe=ie=="constructor");}if(Ce&&!fe){var Ur=l.constructor,un=f.constructor;Ur!=un&&"constructor"in l&&"constructor"in f&&!(typeof Ur=="function"&&Ur instanceof Ur&&typeof un=="function"&&un instanceof un)&&(Ce=!1);}return yt.delete(l),yt.delete(f),Ce;}function oi(l){return Ch(a0(l,e,g0),l+"");}function vh(l){return Tg(l,mr,wh);}function gh(l){return Tg(l,Hr,r0);}var mh=Wl?function(l){return Wl.get(l);}:Fh;function Jl(l){for(var f=l.name+"",I=lo[f],W=Ue.call(lo,f)?I.length:0;W--;){var it=I[W],yt=it.func;if(yt==null||yt==l)return it.name;}return f;}function ho(l){var f=Ue.call(gt,"placeholder")?gt:l;return f.placeholder;}function he(){var l=gt.iteratee||kh;return l=l===kh?xg:l,arguments.length?l(arguments[0],arguments[1]):l;}function _l(l,f){var I=l.__data__;return xx(f)?I[typeof f=="string"?"string":"hash"]:I.map;}function yh(l){for(var f=mr(l),I=f.length;I--;){var W=f[I],it=l[W];f[I]=[W,it,s0(it)];}return f;}function ms(l,f){var I=AI(l,f);return Cg(I)?I:e;}function mx(l){var f=Ue.call(l,hs),I=l[hs];try{l[hs]=e;var W=!0;}catch(_unused24){}var it=Ll.call(l);return W&&(f?l[hs]=I:delete l[hs]),it;}var wh=Hf?function(l){return l==null?[]:(l=Xe(l),Di(Hf(l),function(f){return lg.call(l,f);}));}:Wh,r0=Hf?function(l){for(var f=[];l;)Ni(f,wh(l)),l=Dl(l);return f;}:Wh,Rr=Fr;(Vf&&Rr(new Vf(new ArrayBuffer(1)))!=Dt||oa&&Rr(new oa())!=V||Zf&&Rr(Zf.resolve())!=k||ao&&Rr(new ao())!=ft||aa&&Rr(new aa())!=It)&&(Rr=function Rr(l){var f=Fr(l),I=f==T?l.constructor:e,W=I?ys(I):"";if(W)switch(W){case _I:return Dt;case tC:return V;case eC:return k;case rC:return ft;case nC:return It;}return f;});function yx(l,f,I){for(var W=-1,it=I.length;++W<it;){var yt=I[W],bt=yt.size;switch(yt.type){case"drop":l+=bt;break;case"dropRight":f-=bt;break;case"take":f=Lr(f,l+bt);break;case"takeRight":l=hr(l,f-bt);break;}}return{start:l,end:f};}function wx(l){var f=l.match(Ks);return f?f[1].split(Qs):[];}function n0(l,f,I){f=Ui(f,l);for(var W=-1,it=f.length,yt=!1;++W<it;){var bt=Rn(f[W]);if(!(yt=l!=null&&I(l,bt)))break;l=l[bt];}return yt||++W!=it?yt:(it=l==null?0:l.length,!!it&&oc(it)&&ai(bt,it)&&(ge(l)||ws(l)));}function Sx(l){var f=l.length,I=new l.constructor(f);return f&&typeof l[0]=="string"&&Ue.call(l,"index")&&(I.index=l.index,I.input=l.input),I;}function i0(l){return typeof l.constructor=="function"&&!ga(l)?co(Dl(l)):{};}function Tx(l,f,I){var W=l.constructor;switch(f){case Lt:return hh(l);case Et:case Ot:return new W(+l);case Dt:return ix(l,I);case Nt:case Yt:case Ut:case Ft:case Jt:case ee:case re:case se:case oe:return zg(l,I);case V:return new W();case tt:case pt:return new W(l);case st:return sx(l);case ft:return new W();case ot:return ox(l);}}function Ix(l,f){var I=f.length;if(!I)return l;var W=I-1;return f[W]=(I>1?"& ":"")+f[W],f=f.join(I>2?", ":" "),l.replace(_o,"{\n/* [wrapped with "+f+"] */\n");}function Cx(l){return ge(l)||ws(l)||!!(cg&&l&&l[cg]);}function ai(l,f){var I=_typeof(l);return f=f!==null&&f!==void 0?f:at,!!f&&(I=="number"||I!="symbol"&&If.test(l))&&l>-1&&l%1==0&&l<f;}function Wr(l,f,I){if(!er(I))return!1;var W=_typeof(f);return(W=="number"?Xr(I)&&ai(f,I.length):W=="string"&&f in I)?On(I[f],l):!1;}function Sh(l,f){if(ge(l))return!1;var I=_typeof(l);return I=="number"||I=="symbol"||I=="boolean"||l==null||ln(l)?!0:rn.test(l)||!en.test(l)||f!=null&&l in Xe(f);}function xx(l){var f=_typeof(l);return f=="string"||f=="number"||f=="symbol"||f=="boolean"?l!=="__proto__":l===null;}function Th(l){var f=Jl(l),I=gt[f];if(typeof I!="function"||!(f in Ee.prototype))return!1;if(l===I)return!0;var W=mh(I);return!!W&&l===W[0];}function Px(l){return!!sg&&sg in l;}var bx=El?li:Uh;function ga(l){var f=l&&l.constructor,I=typeof f=="function"&&f.prototype||oo;return l===I;}function s0(l){return l===l&&!er(l);}function o0(l,f){return function(I){return I==null?!1:I[l]===f&&(f!==e||l in Xe(I));};}function Ax(l){var f=ic(l,function(W){return I.size===v&&I.clear(),W;}),I=f.cache;return f;}function Ex(l,f){var I=l[1],W=f[1],it=I|W,yt=it<(X|Y|P),bt=W==P&&I==A||W==P&&I==z&&l[7].length<=f[8]||W==(P|z)&&f[7].length<=f[8]&&I==A;if(!(yt||bt))return l;W&X&&(l[2]=f[2],it|=I&X?0:et);var Rt=f[3];if(Rt){var Bt=l[3];l[3]=Bt?Yg(Bt,Rt,f[4]):Rt,l[4]=Bt?ki(l[3],p):f[4];}return Rt=f[5],Rt&&(Bt=l[5],l[5]=Bt?Gg(Bt,Rt,f[6]):Rt,l[6]=Bt?ki(l[5],p):f[6]),Rt=f[7],Rt&&(l[7]=Rt),W&P&&(l[8]=l[8]==null?f[8]:Lr(l[8],f[8])),l[9]==null&&(l[9]=f[9]),l[0]=f[0],l[1]=it,l;}function Mx(l){var f=[];if(l!=null)for(var I in Xe(l))f.push(I);return f;}function Lx(l){return Ll.call(l);}function a0(l,f,I){return f=hr(f===e?l.length-1:f,0),function(){for(var W=arguments,it=-1,yt=hr(W.length-f,0),bt=zt(yt);++it<yt;)bt[it]=W[f+it];it=-1;for(var Rt=zt(f+1);++it<f;)Rt[it]=W[it];return Rt[f]=I(bt),nn(l,this,Rt);};}function l0(l,f){return f.length<2?l:gs(l,Tn(f,0,-1));}function Rx(l,f){for(var I=l.length,W=Lr(f.length,I),it=jr(l);W--;){var yt=f[W];l[W]=ai(yt,I)?it[yt]:e;}return l;}function Ih(l,f){if(!(f==="constructor"&&typeof l[f]=="function")&&f!="__proto__")return l[f];}var c0=f0(Og),ma=HI||function(l,f){return Ir.setTimeout(l,f);},Ch=f0(tx);function u0(l,f,I){var W=f+"";return Ch(l,Ix(W,Ox(wx(W),I)));}function f0(l){var f=0,I=0;return function(){var W=KI(),it=ct-(W-I);if(I=W,it>0){if(++f>=nt)return arguments[0];}else f=0;return l.apply(e,arguments);};}function tc(l,f){var I=-1,W=l.length,it=W-1;for(f=f===e?W:f;++I<f;){var yt=sh(I,it),bt=l[yt];l[yt]=l[I],l[I]=bt;}return l.length=f,l;}var h0=Ax(function(l){var f=[];return l.charCodeAt(0)===46&&f.push(""),l.replace(Gn,function(I,W,it,yt){f.push(it?yt.replace(ta,"$1"):W||I);}),f;});function Rn(l){if(typeof l=="string"||ln(l))return l;var f=l+"";return f=="0"&&1/l==-q?"-0":f;}function ys(l){if(l!=null){try{return Ml.call(l);}catch(_unused25){}try{return l+"";}catch(_unused26){}}return"";}function Ox(l,f){return sn(H,function(I){var W="_."+I[0];f&I[1]&&!xl(l,W)&&l.push(W);}),l.sort();}function d0(l){if(l instanceof Ee)return l.clone();var f=new wn(l.__wrapped__,l.__chain__);return f.__actions__=jr(l.__actions__),f.__index__=l.__index__,f.__values__=l.__values__,f;}function Dx(l,f,I){(I?Wr(l,f,I):f===e)?f=1:f=hr(Te(f),0);var W=l==null?0:l.length;if(!W||f<1)return[];for(var it=0,yt=0,bt=zt(Bl(W/f));it<W;)bt[yt++]=Tn(l,it,it+=f);return bt;}function Nx(l){for(var f=-1,I=l==null?0:l.length,W=0,it=[];++f<I;){var yt=l[f];yt&&(it[W++]=yt);}return it;}function kx(){var l=arguments.length;if(!l)return[];for(var f=zt(l-1),I=arguments[0],W=l;W--;)f[W-1]=arguments[W];return Ni(ge(I)?jr(I):[I],Cr(f,1));}var Bx=xe(function(l,f){return ir(l)?fa(l,Cr(f,1,ir,!0)):[];}),Fx=xe(function(l,f){var I=In(f);return ir(I)&&(I=e),ir(l)?fa(l,Cr(f,1,ir,!0),he(I,2)):[];}),Wx=xe(function(l,f){var I=In(f);return ir(I)&&(I=e),ir(l)?fa(l,Cr(f,1,ir,!0),e,I):[];});function Ux(l,f,I){var W=l==null?0:l.length;return W?(f=I||f===e?1:Te(f),Tn(l,f<0?0:f,W)):[];}function zx(l,f,I){var W=l==null?0:l.length;return W?(f=I||f===e?1:Te(f),f=W-f,Tn(l,0,f<0?0:f)):[];}function $x(l,f){return l&&l.length?Hl(l,he(f,3),!0,!0):[];}function Yx(l,f){return l&&l.length?Hl(l,he(f,3),!0):[];}function Gx(l,f,I,W){var it=l==null?0:l.length;return it?(I&&typeof I!="number"&&Wr(l,f,I)&&(I=0,W=it),kC(l,f,I,W)):[];}function p0(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=I==null?0:Te(I);return it<0&&(it=hr(W+it,0)),Pl(l,he(f,3),it);}function v0(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=W-1;return I!==e&&(it=Te(I),it=I<0?hr(W+it,0):Lr(it,W-1)),Pl(l,he(f,3),it,!0);}function g0(l){var f=l==null?0:l.length;return f?Cr(l,1):[];}function jx(l){var f=l==null?0:l.length;return f?Cr(l,q):[];}function Xx(l,f){var I=l==null?0:l.length;return I?(f=f===e?1:Te(f),Cr(l,f)):[];}function Hx(l){for(var f=-1,I=l==null?0:l.length,W={};++f<I;){var it=l[f];Xn(W,it[0],it[1]);}return W;}function m0(l){return l&&l.length?l[0]:e;}function Vx(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=I==null?0:Te(I);return it<0&&(it=hr(W+it,0)),ro(l,f,it);}function Zx(l){var f=l==null?0:l.length;return f?Tn(l,0,-1):[];}var qx=xe(function(l){var f=Je(l,uh);return f.length&&f[0]===l[0]?th(f):[];}),Kx=xe(function(l){var f=In(l),I=Je(l,uh);return f===In(I)?f=e:I.pop(),I.length&&I[0]===l[0]?th(I,he(f,2)):[];}),Qx=xe(function(l){var f=In(l),I=Je(l,uh);return f=typeof f=="function"?f:e,f&&I.pop(),I.length&&I[0]===l[0]?th(I,e,f):[];});function Jx(l,f){return l==null?"":ZI.call(l,f);}function In(l){var f=l==null?0:l.length;return f?l[f-1]:e;}function _x(l,f,I){var W=l==null?0:l.length;if(!W)return-1;var it=W;return I!==e&&(it=Te(I),it=it<0?hr(W+it,0):Lr(it,W-1)),f===f?OI(l,f,it):Pl(l,Qv,it,!0);}function tP(l,f){return l&&l.length?Eg(l,Te(f)):e;}var eP=xe(y0);function y0(l,f){return l&&l.length&&f&&f.length?ih(l,f):l;}function rP(l,f,I){return l&&l.length&&f&&f.length?ih(l,f,he(I,2)):l;}function nP(l,f,I){return l&&l.length&&f&&f.length?ih(l,f,e,I):l;}var iP=oi(function(l,f){var I=l==null?0:l.length,W=Kf(l,f);return Rg(l,Je(f,function(it){return ai(it,I)?+it:it;}).sort($g)),W;});function sP(l,f){var I=[];if(!(l&&l.length))return I;var W=-1,it=[],yt=l.length;for(f=he(f,3);++W<yt;){var bt=l[W];f(bt,W,l)&&(I.push(bt),it.push(W));}return Rg(l,it),I;}function xh(l){return l==null?l:JI.call(l);}function oP(l,f,I){var W=l==null?0:l.length;return W?(I&&typeof I!="number"&&Wr(l,f,I)?(f=0,I=W):(f=f==null?0:Te(f),I=I===e?W:Te(I)),Tn(l,f,I)):[];}function aP(l,f){return Xl(l,f);}function lP(l,f,I){return ah(l,f,he(I,2));}function cP(l,f){var I=l==null?0:l.length;if(I){var W=Xl(l,f);if(W<I&&On(l[W],f))return W;}return-1;}function uP(l,f){return Xl(l,f,!0);}function fP(l,f,I){return ah(l,f,he(I,2),!0);}function hP(l,f){var I=l==null?0:l.length;if(I){var W=Xl(l,f,!0)-1;if(On(l[W],f))return W;}return-1;}function dP(l){return l&&l.length?Dg(l):[];}function pP(l,f){return l&&l.length?Dg(l,he(f,2)):[];}function vP(l){var f=l==null?0:l.length;return f?Tn(l,1,f):[];}function gP(l,f,I){return l&&l.length?(f=I||f===e?1:Te(f),Tn(l,0,f<0?0:f)):[];}function mP(l,f,I){var W=l==null?0:l.length;return W?(f=I||f===e?1:Te(f),f=W-f,Tn(l,f<0?0:f,W)):[];}function yP(l,f){return l&&l.length?Hl(l,he(f,3),!1,!0):[];}function wP(l,f){return l&&l.length?Hl(l,he(f,3)):[];}var SP=xe(function(l){return Wi(Cr(l,1,ir,!0));}),TP=xe(function(l){var f=In(l);return ir(f)&&(f=e),Wi(Cr(l,1,ir,!0),he(f,2));}),IP=xe(function(l){var f=In(l);return f=typeof f=="function"?f:e,Wi(Cr(l,1,ir,!0),e,f);});function CP(l){return l&&l.length?Wi(l):[];}function xP(l,f){return l&&l.length?Wi(l,he(f,2)):[];}function PP(l,f){return f=typeof f=="function"?f:e,l&&l.length?Wi(l,e,f):[];}function Ph(l){if(!(l&&l.length))return[];var f=0;return l=Di(l,function(I){if(ir(I))return f=hr(I.length,f),!0;}),Yf(f,function(I){return Je(l,Uf(I));});}function w0(l,f){if(!(l&&l.length))return[];var I=Ph(l);return f==null?I:Je(I,function(W){return nn(f,e,W);});}var bP=xe(function(l,f){return ir(l)?fa(l,f):[];}),AP=xe(function(l){return ch(Di(l,ir));}),EP=xe(function(l){var f=In(l);return ir(f)&&(f=e),ch(Di(l,ir),he(f,2));}),MP=xe(function(l){var f=In(l);return f=typeof f=="function"?f:e,ch(Di(l,ir),e,f);}),LP=xe(Ph);function RP(l,f){return Fg(l||[],f||[],ua);}function OP(l,f){return Fg(l||[],f||[],pa);}var DP=xe(function(l){var f=l.length,I=f>1?l[f-1]:e;return I=typeof I=="function"?(l.pop(),I):e,w0(l,I);});function S0(l){var f=gt(l);return f.__chain__=!0,f;}function NP(l,f){return f(l),l;}function ec(l,f){return f(l);}var kP=oi(function(l){var f=l.length,I=f?l[0]:0,W=this.__wrapped__,it=function it(yt){return Kf(yt,l);};return f>1||this.__actions__.length||!(W instanceof Ee)||!ai(I)?this.thru(it):(W=W.slice(I,+I+(f?1:0)),W.__actions__.push({func:ec,args:[it],thisArg:e}),new wn(W,this.__chain__).thru(function(yt){return f&&!yt.length&&yt.push(e),yt;}));});function BP(){return S0(this);}function FP(){return new wn(this.value(),this.__chain__);}function WP(){this.__values__===e&&(this.__values__=N0(this.value()));var l=this.__index__>=this.__values__.length,f=l?e:this.__values__[this.__index__++];return{done:l,value:f};}function UP(){return this;}function zP(l){for(var f,I=this;I instanceof zl;){var W=d0(I);W.__index__=0,W.__values__=e,f?it.__wrapped__=W:f=W;var it=W;I=I.__wrapped__;}return it.__wrapped__=l,f;}function $P(){var l=this.__wrapped__;if(l instanceof Ee){var f=l;return this.__actions__.length&&(f=new Ee(this)),f=f.reverse(),f.__actions__.push({func:ec,args:[xh],thisArg:e}),new wn(f,this.__chain__);}return this.thru(xh);}function YP(){return Bg(this.__wrapped__,this.__actions__);}var GP=Vl(function(l,f,I){Ue.call(l,I)?++l[I]:Xn(l,I,1);});function jP(l,f,I){var W=ge(l)?qv:NC;return I&&Wr(l,f,I)&&(f=e),W(l,he(f,3));}function XP(l,f){var I=ge(l)?Di:wg;return I(l,he(f,3));}var HP=Vg(p0),VP=Vg(v0);function ZP(l,f){return Cr(rc(l,f),1);}function qP(l,f){return Cr(rc(l,f),q);}function KP(l,f,I){return I=I===e?1:Te(I),Cr(rc(l,f),I);}function T0(l,f){var I=ge(l)?sn:Fi;return I(l,he(f,3));}function I0(l,f){var I=ge(l)?vI:yg;return I(l,he(f,3));}var QP=Vl(function(l,f,I){Ue.call(l,I)?l[I].push(f):Xn(l,I,[f]);});function JP(l,f,I,W){l=Xr(l)?l:vo(l),I=I&&!W?Te(I):0;var it=l.length;return I<0&&(I=hr(it+I,0)),ac(l)?I<=it&&l.indexOf(f,I)>-1:!!it&&ro(l,f,I)>-1;}var _P=xe(function(l,f,I){var W=-1,it=typeof f=="function",yt=Xr(l)?zt(l.length):[];return Fi(l,function(bt){yt[++W]=it?nn(f,bt,I):ha(bt,f,I);}),yt;}),tb=Vl(function(l,f,I){Xn(l,I,f);});function rc(l,f){var I=ge(l)?Je:Pg;return I(l,he(f,3));}function eb(l,f,I,W){return l==null?[]:(ge(f)||(f=f==null?[]:[f]),I=W?e:I,ge(I)||(I=I==null?[]:[I]),Mg(l,f,I));}var rb=Vl(function(l,f,I){l[I?0:1].push(f);},function(){return[[],[]];});function nb(l,f,I){var W=ge(l)?Ff:_v,it=arguments.length<3;return W(l,he(f,4),I,it,Fi);}function ib(l,f,I){var W=ge(l)?gI:_v,it=arguments.length<3;return W(l,he(f,4),I,it,yg);}function sb(l,f){var I=ge(l)?Di:wg;return I(l,sc(he(f,3)));}function ob(l){var f=ge(l)?pg:JC;return f(l);}function ab(l,f,I){(I?Wr(l,f,I):f===e)?f=1:f=Te(f);var W=ge(l)?MC:_C;return W(l,f);}function lb(l){var f=ge(l)?LC:ex;return f(l);}function cb(l){if(l==null)return 0;if(Xr(l))return ac(l)?io(l):l.length;var f=Rr(l);return f==V||f==ft?l.size:rh(l).length;}function ub(l,f,I){var W=ge(l)?Wf:rx;return I&&Wr(l,f,I)&&(f=e),W(l,he(f,3));}var fb=xe(function(l,f){if(l==null)return[];var I=f.length;return I>1&&Wr(l,f[0],f[1])?f=[]:I>2&&Wr(f[0],f[1],f[2])&&(f=[f[0]]),Mg(l,Cr(f,1),[]);}),nc=XI||function(){return Ir.Date.now();};function hb(l,f){if(typeof f!="function")throw new yn(o);return l=Te(l),function(){if(--l<1)return f.apply(this,arguments);};}function C0(l,f,I){return f=I?e:f,f=l&&f==null?l.length:f,si(l,P,e,e,e,e,f);}function x0(l,f){var I;if(typeof f!="function")throw new yn(o);return l=Te(l),function(){return--l>0&&(I=f.apply(this,arguments)),l<=1&&(f=e),I;};}var bh=xe(function(l,f,I){var W=X;if(I.length){var it=ki(I,ho(bh));W|=S;}return si(l,W,f,I,it);}),P0=xe(function(l,f,I){var W=X|Y;if(I.length){var it=ki(I,ho(P0));W|=S;}return si(f,W,l,I,it);});function b0(l,f,I){f=I?e:f;var W=si(l,A,e,e,e,e,e,f);return W.placeholder=b0.placeholder,W;}function A0(l,f,I){f=I?e:f;var W=si(l,w,e,e,e,e,e,f);return W.placeholder=A0.placeholder,W;}function E0(l,f,I){var W,it,yt,bt,Rt,Bt,Ht=0,Vt=!1,qt=!1,ie=!0;if(typeof l!="function")throw new yn(o);f=Cn(f)||0,er(I)&&(Vt=!!I.leading,qt="maxWait"in I,yt=qt?hr(Cn(I.maxWait)||0,f):yt,ie="trailing"in I?!!I.trailing:ie);function ce(sr){var Dn=W,ui=it;return W=it=e,Ht=sr,bt=l.apply(ui,Dn),bt;}function de(sr){return Ht=sr,Rt=ma(be,f),Vt?ce(sr):bt;}function Ce(sr){var Dn=sr-Bt,ui=sr-Ht,Z0=f-Dn;return qt?Lr(Z0,yt-ui):Z0;}function fe(sr){var Dn=sr-Bt,ui=sr-Ht;return Bt===e||Dn>=f||Dn<0||qt&&ui>=yt;}function be(){var sr=nc();if(fe(sr))return Le(sr);Rt=ma(be,Ce(sr));}function Le(sr){return Rt=e,ie&&W?ce(sr):(W=it=e,bt);}function cn(){Rt!==e&&Wg(Rt),Ht=0,W=Bt=it=Rt=e;}function Ur(){return Rt===e?bt:Le(nc());}function un(){var sr=nc(),Dn=fe(sr);if(W=arguments,it=this,Bt=sr,Dn){if(Rt===e)return de(Bt);if(qt)return Wg(Rt),Rt=ma(be,f),ce(Bt);}return Rt===e&&(Rt=ma(be,f)),bt;}return un.cancel=cn,un.flush=Ur,un;}var db=xe(function(l,f){return mg(l,1,f);}),pb=xe(function(l,f,I){return mg(l,Cn(f)||0,I);});function vb(l){return si(l,U);}function ic(l,f){if(typeof l!="function"||f!=null&&typeof f!="function")throw new yn(o);var _I2=function I(){var W=arguments,it=f?f.apply(this,W):W[0],yt=_I2.cache;if(yt.has(it))return yt.get(it);var bt=l.apply(this,W);return _I2.cache=yt.set(it,bt)||yt,bt;};return _I2.cache=new(ic.Cache||ii)(),_I2;}ic.Cache=ii;function sc(l){if(typeof l!="function")throw new yn(o);return function(){var f=arguments;switch(f.length){case 0:return!l.call(this);case 1:return!l.call(this,f[0]);case 2:return!l.call(this,f[0],f[1]);case 3:return!l.call(this,f[0],f[1],f[2]);}return!l.apply(this,f);};}function gb(l){return x0(2,l);}var mb=nx(function(l,f){f=f.length==1&&ge(f[0])?Je(f[0],on(he())):Je(Cr(f,1),on(he()));var I=f.length;return xe(function(W){for(var it=-1,yt=Lr(W.length,I);++it<yt;)W[it]=f[it].call(this,W[it]);return nn(l,this,W);});}),Ah=xe(function(l,f){var I=ki(f,ho(Ah));return si(l,S,e,f,I);}),M0=xe(function(l,f){var I=ki(f,ho(M0));return si(l,x,e,f,I);}),yb=oi(function(l,f){return si(l,z,e,e,e,f);});function wb(l,f){if(typeof l!="function")throw new yn(o);return f=f===e?f:Te(f),xe(l,f);}function Sb(l,f){if(typeof l!="function")throw new yn(o);return f=f==null?0:hr(Te(f),0),xe(function(I){var W=I[f],it=zi(I,0,f);return W&&Ni(it,W),nn(l,this,it);});}function Tb(l,f,I){var W=!0,it=!0;if(typeof l!="function")throw new yn(o);return er(I)&&(W="leading"in I?!!I.leading:W,it="trailing"in I?!!I.trailing:it),E0(l,f,{leading:W,maxWait:f,trailing:it});}function Ib(l){return C0(l,1);}function Cb(l,f){return Ah(fh(f),l);}function xb(){if(!arguments.length)return[];var l=arguments[0];return ge(l)?l:[l];}function Pb(l){return Sn(l,b);}function bb(l,f){return f=typeof f=="function"?f:e,Sn(l,b,f);}function Ab(l){return Sn(l,y|b);}function Eb(l,f){return f=typeof f=="function"?f:e,Sn(l,y|b,f);}function Mb(l,f){return f==null||gg(l,f,mr(f));}function On(l,f){return l===f||l!==l&&f!==f;}var Lb=Ql(_f),Rb=Ql(function(l,f){return l>=f;}),ws=Ig(/* @__PURE__ */function(){return arguments;}())?Ig:function(l){return rr(l)&&Ue.call(l,"callee")&&!lg.call(l,"callee");},ge=zt.isArray,Ob=Gv?on(Gv):zC;function Xr(l){return l!=null&&oc(l.length)&&!li(l);}function ir(l){return rr(l)&&Xr(l);}function Db(l){return l===!0||l===!1||rr(l)&&Fr(l)==Et;}var $i=VI||Uh,Nb=jv?on(jv):$C;function kb(l){return rr(l)&&l.nodeType===1&&!ya(l);}function Bb(l){if(l==null)return!0;if(Xr(l)&&(ge(l)||typeof l=="string"||typeof l.splice=="function"||$i(l)||po(l)||ws(l)))return!l.length;var f=Rr(l);if(f==V||f==ft)return!l.size;if(ga(l))return!rh(l).length;for(var I in l)if(Ue.call(l,I))return!1;return!0;}function Fb(l,f){return da(l,f);}function Wb(l,f,I){I=typeof I=="function"?I:e;var W=I?I(l,f):e;return W===e?da(l,f,e,I):!!W;}function Eh(l){if(!rr(l))return!1;var f=Fr(l);return f==D||f==O||typeof l.message=="string"&&typeof l.name=="string"&&!ya(l);}function Ub(l){return typeof l=="number"&&ug(l);}function li(l){if(!er(l))return!1;var f=Fr(l);return f==J||f==Q||f==wt||f==Z;}function L0(l){return typeof l=="number"&&l==Te(l);}function oc(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=at;}function er(l){var f=_typeof(l);return l!=null&&(f=="object"||f=="function");}function rr(l){return l!=null&&_typeof(l)=="object";}var R0=Xv?on(Xv):GC;function zb(l,f){return l===f||eh(l,f,yh(f));}function $b(l,f,I){return I=typeof I=="function"?I:e,eh(l,f,yh(f),I);}function Yb(l){return O0(l)&&l!=+l;}function Gb(l){if(bx(l))throw new pe(s);return Cg(l);}function jb(l){return l===null;}function Xb(l){return l==null;}function O0(l){return typeof l=="number"||rr(l)&&Fr(l)==tt;}function ya(l){if(!rr(l)||Fr(l)!=T)return!1;var f=Dl(l);if(f===null)return!0;var I=Ue.call(f,"constructor")&&f.constructor;return typeof I=="function"&&I instanceof I&&Ml.call(I)==$I;}var Mh=Hv?on(Hv):jC;function Hb(l){return L0(l)&&l>=-at&&l<=at;}var D0=Vv?on(Vv):XC;function ac(l){return typeof l=="string"||!ge(l)&&rr(l)&&Fr(l)==pt;}function ln(l){return _typeof(l)=="symbol"||rr(l)&&Fr(l)==ot;}var po=Zv?on(Zv):HC;function Vb(l){return l===e;}function Zb(l){return rr(l)&&Rr(l)==It;}function qb(l){return rr(l)&&Fr(l)==Pt;}var Kb=Ql(nh),Qb=Ql(function(l,f){return l<=f;});function N0(l){if(!l)return[];if(Xr(l))return ac(l)?Mn(l):jr(l);if(sa&&l[sa])return MI(l[sa]());var f=Rr(l),I=f==V?jf:f==ft?bl:vo;return I(l);}function ci(l){if(!l)return l===0?l:0;if(l=Cn(l),l===q||l===-q){var f=l<0?-1:1;return f*ut;}return l===l?l:0;}function Te(l){var f=ci(l),I=f%1;return f===f?I?f-I:f:0;}function k0(l){return l?vs(Te(l),0,R):0;}function Cn(l){if(typeof l=="number")return l;if(ln(l))return Ct;if(er(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=er(f)?f+"":f;}if(typeof l!="string")return l===0?l:+l;l=tg(l);var I=_s.test(l);return I||Tf.test(l)?hI(l.slice(2),I?2:8):us.test(l)?Ct:+l;}function B0(l){return Vn(l,Hr(l));}function Jb(l){return l?vs(Te(l),-at,at):l===0?l:0;}function ze(l){return l==null?"":an(l);}var _b=uo(function(l,f){if(ga(f)||Xr(f)){Vn(f,mr(f),l);return;}for(var I in f)Ue.call(f,I)&&ua(l,I,f[I]);}),F0=uo(function(l,f){Vn(f,Hr(f),l);}),W0=uo(function(l,f,I,W){Vn(f,Hr(f),l,W);}),Lh=uo(function(l,f,I,W){Vn(f,mr(f),l,W);}),tA=oi(Kf);function eA(l,f){var I=co(l);return f==null?I:vg(I,f);}var rA=xe(function(l,f){l=Xe(l);var I=-1,W=f.length,it=W>2?f[2]:e;for(it&&Wr(f[0],f[1],it)&&(W=1);++I<W;)for(var yt=f[I],bt=Hr(yt),Rt=-1,Bt=bt.length;++Rt<Bt;){var Ht=bt[Rt],Vt=l[Ht];(Vt===e||On(Vt,oo[Ht])&&!Ue.call(l,Ht))&&(l[Ht]=yt[Ht]);}return l;}),nA=xe(function(l){return l.push(e,t0),nn(U0,e,l);});function iA(l,f){return Kv(l,he(f,3),Hn);}function sA(l,f){return Kv(l,he(f,3),Jf);}function oA(l,f){return l==null?l:Qf(l,he(f,3),Hr);}function aA(l,f){return l==null?l:Sg(l,he(f,3),Hr);}function lA(l,f){return l&&Hn(l,he(f,3));}function cA(l,f){return l&&Jf(l,he(f,3));}function uA(l){return l==null?[]:Gl(l,mr(l));}function fA(l){return l==null?[]:Gl(l,Hr(l));}function Rh(l,f,I){var W=l==null?e:gs(l,f);return W===e?I:W;}function hA(l,f){return l!=null&&n0(l,f,BC);}function Oh(l,f){return l!=null&&n0(l,f,FC);}var dA=qg(function(l,f,I){f!=null&&typeof f.toString!="function"&&(f=Ll.call(f)),l[f]=I;},Nh(Vr)),pA=qg(function(l,f,I){f!=null&&typeof f.toString!="function"&&(f=Ll.call(f)),Ue.call(l,f)?l[f].push(I):l[f]=[I];},he),vA=xe(ha);function mr(l){return Xr(l)?dg(l):rh(l);}function Hr(l){return Xr(l)?dg(l,!0):VC(l);}function gA(l,f){var I={};return f=he(f,3),Hn(l,function(W,it,yt){Xn(I,f(W,it,yt),W);}),I;}function mA(l,f){var I={};return f=he(f,3),Hn(l,function(W,it,yt){Xn(I,it,f(W,it,yt));}),I;}var yA=uo(function(l,f,I){jl(l,f,I);}),U0=uo(function(l,f,I,W){jl(l,f,I,W);}),wA=oi(function(l,f){var I={};if(l==null)return I;var W=!1;f=Je(f,function(yt){return yt=Ui(yt,l),W||(W=yt.length>1),yt;}),Vn(l,gh(l),I),W&&(I=Sn(I,y|C|b,px));for(var it=f.length;it--;)lh(I,f[it]);return I;});function SA(l,f){return z0(l,sc(he(f)));}var TA=oi(function(l,f){return l==null?{}:qC(l,f);});function z0(l,f){if(l==null)return{};var I=Je(gh(l),function(W){return[W];});return f=he(f),Lg(l,I,function(W,it){return f(W,it[0]);});}function IA(l,f,I){f=Ui(f,l);var W=-1,it=f.length;for(it||(it=1,l=e);++W<it;){var yt=l==null?e:l[Rn(f[W])];yt===e&&(W=it,yt=I),l=li(yt)?yt.call(l):yt;}return l;}function CA(l,f,I){return l==null?l:pa(l,f,I);}function xA(l,f,I,W){return W=typeof W=="function"?W:e,l==null?l:pa(l,f,I,W);}var $0=Jg(mr),Y0=Jg(Hr);function PA(l,f,I){var W=ge(l),it=W||$i(l)||po(l);if(f=he(f,4),I==null){var yt=l&&l.constructor;it?I=W?new yt():[]:er(l)?I=li(yt)?co(Dl(l)):{}:I={};}return(it?sn:Hn)(l,function(bt,Rt,Bt){return f(I,bt,Rt,Bt);}),I;}function bA(l,f){return l==null?!0:lh(l,f);}function AA(l,f,I){return l==null?l:kg(l,f,fh(I));}function EA(l,f,I,W){return W=typeof W=="function"?W:e,l==null?l:kg(l,f,fh(I),W);}function vo(l){return l==null?[]:Gf(l,mr(l));}function MA(l){return l==null?[]:Gf(l,Hr(l));}function LA(l,f,I){return I===e&&(I=f,f=e),I!==e&&(I=Cn(I),I=I===I?I:0),f!==e&&(f=Cn(f),f=f===f?f:0),vs(Cn(l),f,I);}function RA(l,f,I){return f=ci(f),I===e?(I=f,f=0):I=ci(I),l=Cn(l),WC(l,f,I);}function OA(l,f,I){if(I&&typeof I!="boolean"&&Wr(l,f,I)&&(f=I=e),I===e&&(typeof f=="boolean"?(I=f,f=e):typeof l=="boolean"&&(I=l,l=e)),l===e&&f===e?(l=0,f=1):(l=ci(l),f===e?(f=l,l=0):f=ci(f)),l>f){var W=l;l=f,f=W;}if(I||l%1||f%1){var it=fg();return Lr(l+it*(f-l+fI("1e-"+((it+"").length-1))),f);}return sh(l,f);}var DA=fo(function(l,f,I){return f=f.toLowerCase(),l+(I?G0(f):f);});function G0(l){return Dh(ze(l).toLowerCase());}function j0(l){return l=ze(l),l&&l.replace(Cf,xI).replace(eI,"");}function NA(l,f,I){l=ze(l),f=an(f);var W=l.length;I=I===e?W:vs(Te(I),0,W);var it=I;return I-=f.length,I>=0&&l.slice(I,it)==f;}function kA(l){return l=ze(l),l&&He.test(l)?l.replace(Be,PI):l;}function BA(l){return l=ze(l),l&&Qo.test(l)?l.replace(jn,"\\$&"):l;}var FA=fo(function(l,f,I){return l+(I?"-":"")+f.toLowerCase();}),WA=fo(function(l,f,I){return l+(I?" ":"")+f.toLowerCase();}),UA=Hg("toLowerCase");function zA(l,f,I){l=ze(l),f=Te(f);var W=f?io(l):0;if(!f||W>=f)return l;var it=(f-W)/2;return Kl(Fl(it),I)+l+Kl(Bl(it),I);}function $A(l,f,I){l=ze(l),f=Te(f);var W=f?io(l):0;return f&&W<f?l+Kl(f-W,I):l;}function YA(l,f,I){l=ze(l),f=Te(f);var W=f?io(l):0;return f&&W<f?Kl(f-W,I)+l:l;}function GA(l,f,I){return I||f==null?f=0:f&&(f=+f),QI(ze(l).replace(Li,""),f||0);}function jA(l,f,I){return(I?Wr(l,f,I):f===e)?f=1:f=Te(f),oh(ze(l),f);}function XA(){var l=arguments,f=ze(l[0]);return l.length<3?f:f.replace(l[1],l[2]);}var HA=fo(function(l,f,I){return l+(I?"_":"")+f.toLowerCase();});function VA(l,f,I){return I&&typeof I!="number"&&Wr(l,f,I)&&(f=I=e),I=I===e?R:I>>>0,I?(l=ze(l),l&&(typeof f=="string"||f!=null&&!Mh(f))&&(f=an(f),!f&&no(l))?zi(Mn(l),0,I):l.split(f,I)):[];}var ZA=fo(function(l,f,I){return l+(I?" ":"")+Dh(f);});function qA(l,f,I){return l=ze(l),I=I==null?0:vs(Te(I),0,l.length),f=an(f),l.slice(I,I+f.length)==f;}function KA(l,f,I){var W=gt.templateSettings;I&&Wr(l,f,I)&&(f=e),l=ze(l),f=Lh({},f,W,_g);var it=Lh({},f.imports,W.imports,_g),yt=mr(it),bt=Gf(it,yt);sn(yt,function(fe){if(cs.test(fe))throw new pe(u);});var Rt,Bt,Ht=0,Vt=f.interpolate||En,qt="__p += '",ie=Xf((f.escape||En).source+"|"+Vt.source+"|"+(Vt===lr?ea:En).source+"|"+(f.evaluate||En).source+"|$","g"),ce="//# sourceURL="+(Ue.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++oI+"]")+"\n";l.replace(ie,function(fe,be,Le,cn,Ur,un){return Le||(Le=cn),qt+=l.slice(Ht,un).replace(xf,bI),be&&(Rt=!0,qt+="' +\n__e("+be+") +\n'"),Ur&&(Bt=!0,qt+="';\n"+Ur+";\n__p += '"),Le&&(qt+="' +\n((__t = ("+Le+")) == null ? '' : __t) +\n'"),Ht=un+fe.length,fe;}),qt+="';\n";var de=Ue.call(f,"variable")&&f.variable;if(!de)qt="with (obj) {\n"+qt+"\n}\n";else if(cs.test(de))throw new pe(a);qt=(Bt?qt.replace(le,""):qt).replace(Re,"$1").replace(Oe,"$1;"),qt="function("+(de||"obj")+") {\n"+(de?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(Rt?", __e = _.escape":"")+(Bt?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+qt+"return __p\n}";var Ce=H0(function(){return Fe(yt,ce+"return "+qt).apply(e,bt);});if(Ce.source=qt,Eh(Ce))throw Ce;return Ce;}function QA(l){return ze(l).toLowerCase();}function JA(l){return ze(l).toUpperCase();}function _A(l,f,I){if(l=ze(l),l&&(I||f===e))return tg(l);if(!l||!(f=an(f)))return l;var W=Mn(l),it=Mn(f),yt=eg(W,it),bt=rg(W,it)+1;return zi(W,yt,bt).join("");}function tE(l,f,I){if(l=ze(l),l&&(I||f===e))return l.slice(0,ig(l)+1);if(!l||!(f=an(f)))return l;var W=Mn(l),it=rg(W,Mn(f))+1;return zi(W,0,it).join("");}function eE(l,f,I){if(l=ze(l),l&&(I||f===e))return l.replace(Li,"");if(!l||!(f=an(f)))return l;var W=Mn(l),it=eg(W,Mn(f));return zi(W,it).join("");}function rE(l,f){var I=K,W=j;if(er(f)){var it="separator"in f?f.separator:it;I="length"in f?Te(f.length):I,W="omission"in f?an(f.omission):W;}l=ze(l);var yt=l.length;if(no(l)){var bt=Mn(l);yt=bt.length;}if(I>=yt)return l;var Rt=I-io(W);if(Rt<1)return W;var Bt=bt?zi(bt,0,Rt).join(""):l.slice(0,Rt);if(it===e)return Bt+W;if(bt&&(Rt+=Bt.length-Rt),Mh(it)){if(l.slice(Rt).search(it)){var Ht,Vt=Bt;for(it.global||(it=Xf(it.source,ze(An.exec(it))+"g")),it.lastIndex=0;Ht=it.exec(Vt);)var qt=Ht.index;Bt=Bt.slice(0,qt===e?Rt:qt);}}else if(l.indexOf(an(it),Rt)!=Rt){var ie=Bt.lastIndexOf(it);ie>-1&&(Bt=Bt.slice(0,ie));}return Bt+W;}function nE(l){return l=ze(l),l&&Ge.test(l)?l.replace(ke,DI):l;}var iE=fo(function(l,f,I){return l+(I?" ":"")+f.toUpperCase();}),Dh=Hg("toUpperCase");function X0(l,f,I){return l=ze(l),f=I?e:f,f===e?EI(l)?BI(l):wI(l):l.match(f)||[];}var H0=xe(function(l,f){try{return nn(l,e,f);}catch(I){return Eh(I)?I:new pe(I);}}),sE=oi(function(l,f){return sn(f,function(I){I=Rn(I),Xn(l,I,bh(l[I],l));}),l;});function oE(l){var f=l==null?0:l.length,I=he();return l=f?Je(l,function(W){if(typeof W[1]!="function")throw new yn(o);return[I(W[0]),W[1]];}):[],xe(function(W){for(var it=-1;++it<f;){var yt=l[it];if(nn(yt[0],this,W))return nn(yt[1],this,W);}});}function aE(l){return DC(Sn(l,y));}function Nh(l){return function(){return l;};}function lE(l,f){return l==null||l!==l?f:l;}var cE=Zg(),uE=Zg(!0);function Vr(l){return l;}function kh(l){return xg(typeof l=="function"?l:Sn(l,y));}function fE(l){return bg(Sn(l,y));}function hE(l,f){return Ag(l,Sn(f,y));}var dE=xe(function(l,f){return function(I){return ha(I,l,f);};}),pE=xe(function(l,f){return function(I){return ha(l,I,f);};});function Bh(l,f,I){var W=mr(f),it=Gl(f,W);I==null&&!(er(f)&&(it.length||!W.length))&&(I=f,f=l,l=this,it=Gl(f,mr(f)));var yt=!(er(I)&&"chain"in I)||!!I.chain,bt=li(l);return sn(it,function(Rt){var Bt=f[Rt];l[Rt]=Bt,bt&&(l.prototype[Rt]=function(){var Ht=this.__chain__;if(yt||Ht){var Vt=l(this.__wrapped__),qt=Vt.__actions__=jr(this.__actions__);return qt.push({func:Bt,args:arguments,thisArg:l}),Vt.__chain__=Ht,Vt;}return Bt.apply(l,Ni([this.value()],arguments));});}),l;}function vE(){return Ir._===this&&(Ir._=YI),this;}function Fh(){}function gE(l){return l=Te(l),xe(function(f){return Eg(f,l);});}var mE=dh(Je),yE=dh(qv),wE=dh(Wf);function V0(l){return Sh(l)?Uf(Rn(l)):KC(l);}function SE(l){return function(f){return l==null?e:gs(l,f);};}var TE=Kg(),IE=Kg(!0);function Wh(){return[];}function Uh(){return!1;}function CE(){return{};}function xE(){return"";}function PE(){return!0;}function bE(l,f){if(l=Te(l),l<1||l>at)return[];var I=R,W=Lr(l,R);f=he(f),l-=R;for(var it=Yf(W,f);++I<l;)f(I);return it;}function AE(l){return ge(l)?Je(l,Rn):ln(l)?[l]:jr(h0(ze(l)));}function EE(l){var f=++zI;return ze(l)+f;}var ME=ql(function(l,f){return l+f;},0),LE=ph("ceil"),RE=ql(function(l,f){return l/f;},1),OE=ph("floor");function DE(l){return l&&l.length?Yl(l,Vr,_f):e;}function NE(l,f){return l&&l.length?Yl(l,he(f,2),_f):e;}function kE(l){return Jv(l,Vr);}function BE(l,f){return Jv(l,he(f,2));}function FE(l){return l&&l.length?Yl(l,Vr,nh):e;}function WE(l,f){return l&&l.length?Yl(l,he(f,2),nh):e;}var UE=ql(function(l,f){return l*f;},1),zE=ph("round"),$E=ql(function(l,f){return l-f;},0);function YE(l){return l&&l.length?$f(l,Vr):0;}function GE(l,f){return l&&l.length?$f(l,he(f,2)):0;}return gt.after=hb,gt.ary=C0,gt.assign=_b,gt.assignIn=F0,gt.assignInWith=W0,gt.assignWith=Lh,gt.at=tA,gt.before=x0,gt.bind=bh,gt.bindAll=sE,gt.bindKey=P0,gt.castArray=xb,gt.chain=S0,gt.chunk=Dx,gt.compact=Nx,gt.concat=kx,gt.cond=oE,gt.conforms=aE,gt.constant=Nh,gt.countBy=GP,gt.create=eA,gt.curry=b0,gt.curryRight=A0,gt.debounce=E0,gt.defaults=rA,gt.defaultsDeep=nA,gt.defer=db,gt.delay=pb,gt.difference=Bx,gt.differenceBy=Fx,gt.differenceWith=Wx,gt.drop=Ux,gt.dropRight=zx,gt.dropRightWhile=$x,gt.dropWhile=Yx,gt.fill=Gx,gt.filter=XP,gt.flatMap=ZP,gt.flatMapDeep=qP,gt.flatMapDepth=KP,gt.flatten=g0,gt.flattenDeep=jx,gt.flattenDepth=Xx,gt.flip=vb,gt.flow=cE,gt.flowRight=uE,gt.fromPairs=Hx,gt.functions=uA,gt.functionsIn=fA,gt.groupBy=QP,gt.initial=Zx,gt.intersection=qx,gt.intersectionBy=Kx,gt.intersectionWith=Qx,gt.invert=dA,gt.invertBy=pA,gt.invokeMap=_P,gt.iteratee=kh,gt.keyBy=tb,gt.keys=mr,gt.keysIn=Hr,gt.map=rc,gt.mapKeys=gA,gt.mapValues=mA,gt.matches=fE,gt.matchesProperty=hE,gt.memoize=ic,gt.merge=yA,gt.mergeWith=U0,gt.method=dE,gt.methodOf=pE,gt.mixin=Bh,gt.negate=sc,gt.nthArg=gE,gt.omit=wA,gt.omitBy=SA,gt.once=gb,gt.orderBy=eb,gt.over=mE,gt.overArgs=mb,gt.overEvery=yE,gt.overSome=wE,gt.partial=Ah,gt.partialRight=M0,gt.partition=rb,gt.pick=TA,gt.pickBy=z0,gt.property=V0,gt.propertyOf=SE,gt.pull=eP,gt.pullAll=y0,gt.pullAllBy=rP,gt.pullAllWith=nP,gt.pullAt=iP,gt.range=TE,gt.rangeRight=IE,gt.rearg=yb,gt.reject=sb,gt.remove=sP,gt.rest=wb,gt.reverse=xh,gt.sampleSize=ab,gt.set=CA,gt.setWith=xA,gt.shuffle=lb,gt.slice=oP,gt.sortBy=fb,gt.sortedUniq=dP,gt.sortedUniqBy=pP,gt.split=VA,gt.spread=Sb,gt.tail=vP,gt.take=gP,gt.takeRight=mP,gt.takeRightWhile=yP,gt.takeWhile=wP,gt.tap=NP,gt.throttle=Tb,gt.thru=ec,gt.toArray=N0,gt.toPairs=$0,gt.toPairsIn=Y0,gt.toPath=AE,gt.toPlainObject=B0,gt.transform=PA,gt.unary=Ib,gt.union=SP,gt.unionBy=TP,gt.unionWith=IP,gt.uniq=CP,gt.uniqBy=xP,gt.uniqWith=PP,gt.unset=bA,gt.unzip=Ph,gt.unzipWith=w0,gt.update=AA,gt.updateWith=EA,gt.values=vo,gt.valuesIn=MA,gt.without=bP,gt.words=X0,gt.wrap=Cb,gt.xor=AP,gt.xorBy=EP,gt.xorWith=MP,gt.zip=LP,gt.zipObject=RP,gt.zipObjectDeep=OP,gt.zipWith=DP,gt.entries=$0,gt.entriesIn=Y0,gt.extend=F0,gt.extendWith=W0,Bh(gt,gt),gt.add=ME,gt.attempt=H0,gt.camelCase=DA,gt.capitalize=G0,gt.ceil=LE,gt.clamp=LA,gt.clone=Pb,gt.cloneDeep=Ab,gt.cloneDeepWith=Eb,gt.cloneWith=bb,gt.conformsTo=Mb,gt.deburr=j0,gt.defaultTo=lE,gt.divide=RE,gt.endsWith=NA,gt.eq=On,gt.escape=kA,gt.escapeRegExp=BA,gt.every=jP,gt.find=HP,gt.findIndex=p0,gt.findKey=iA,gt.findLast=VP,gt.findLastIndex=v0,gt.findLastKey=sA,gt.floor=OE,gt.forEach=T0,gt.forEachRight=I0,gt.forIn=oA,gt.forInRight=aA,gt.forOwn=lA,gt.forOwnRight=cA,gt.get=Rh,gt.gt=Lb,gt.gte=Rb,gt.has=hA,gt.hasIn=Oh,gt.head=m0,gt.identity=Vr,gt.includes=JP,gt.indexOf=Vx,gt.inRange=RA,gt.invoke=vA,gt.isArguments=ws,gt.isArray=ge,gt.isArrayBuffer=Ob,gt.isArrayLike=Xr,gt.isArrayLikeObject=ir,gt.isBoolean=Db,gt.isBuffer=$i,gt.isDate=Nb,gt.isElement=kb,gt.isEmpty=Bb,gt.isEqual=Fb,gt.isEqualWith=Wb,gt.isError=Eh,gt.isFinite=Ub,gt.isFunction=li,gt.isInteger=L0,gt.isLength=oc,gt.isMap=R0,gt.isMatch=zb,gt.isMatchWith=$b,gt.isNaN=Yb,gt.isNative=Gb,gt.isNil=Xb,gt.isNull=jb,gt.isNumber=O0,gt.isObject=er,gt.isObjectLike=rr,gt.isPlainObject=ya,gt.isRegExp=Mh,gt.isSafeInteger=Hb,gt.isSet=D0,gt.isString=ac,gt.isSymbol=ln,gt.isTypedArray=po,gt.isUndefined=Vb,gt.isWeakMap=Zb,gt.isWeakSet=qb,gt.join=Jx,gt.kebabCase=FA,gt.last=In,gt.lastIndexOf=_x,gt.lowerCase=WA,gt.lowerFirst=UA,gt.lt=Kb,gt.lte=Qb,gt.max=DE,gt.maxBy=NE,gt.mean=kE,gt.meanBy=BE,gt.min=FE,gt.minBy=WE,gt.stubArray=Wh,gt.stubFalse=Uh,gt.stubObject=CE,gt.stubString=xE,gt.stubTrue=PE,gt.multiply=UE,gt.nth=tP,gt.noConflict=vE,gt.noop=Fh,gt.now=nc,gt.pad=zA,gt.padEnd=$A,gt.padStart=YA,gt.parseInt=GA,gt.random=OA,gt.reduce=nb,gt.reduceRight=ib,gt.repeat=jA,gt.replace=XA,gt.result=IA,gt.round=zE,gt.runInContext=kt,gt.sample=ob,gt.size=cb,gt.snakeCase=HA,gt.some=ub,gt.sortedIndex=aP,gt.sortedIndexBy=lP,gt.sortedIndexOf=cP,gt.sortedLastIndex=uP,gt.sortedLastIndexBy=fP,gt.sortedLastIndexOf=hP,gt.startCase=ZA,gt.startsWith=qA,gt.subtract=$E,gt.sum=YE,gt.sumBy=GE,gt.template=KA,gt.times=bE,gt.toFinite=ci,gt.toInteger=Te,gt.toLength=k0,gt.toLower=QA,gt.toNumber=Cn,gt.toSafeInteger=Jb,gt.toString=ze,gt.toUpper=JA,gt.trim=_A,gt.trimEnd=tE,gt.trimStart=eE,gt.truncate=rE,gt.unescape=nE,gt.uniqueId=EE,gt.upperCase=iE,gt.upperFirst=Dh,gt.each=T0,gt.eachRight=I0,gt.first=m0,Bh(gt,function(){var l={};return Hn(gt,function(f,I){Ue.call(gt.prototype,I)||(l[I]=f);}),l;}(),{chain:!1}),gt.VERSION=n,sn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){gt[l].placeholder=gt;}),sn(["drop","take"],function(l,f){Ee.prototype[l]=function(I){I=I===e?1:hr(Te(I),0);var W=this.__filtered__&&!f?new Ee(this):this.clone();return W.__filtered__?W.__takeCount__=Lr(I,W.__takeCount__):W.__views__.push({size:Lr(I,R),type:l+(W.__dir__<0?"Right":"")}),W;},Ee.prototype[l+"Right"]=function(I){return this.reverse()[l](I).reverse();};}),sn(["filter","map","takeWhile"],function(l,f){var I=f+1,W=I==B||I==G;Ee.prototype[l]=function(it){var yt=this.clone();return yt.__iteratees__.push({iteratee:he(it,3),type:I}),yt.__filtered__=yt.__filtered__||W,yt;};}),sn(["head","last"],function(l,f){var I="take"+(f?"Right":"");Ee.prototype[l]=function(){return this[I](1).value()[0];};}),sn(["initial","tail"],function(l,f){var I="drop"+(f?"":"Right");Ee.prototype[l]=function(){return this.__filtered__?new Ee(this):this[I](1);};}),Ee.prototype.compact=function(){return this.filter(Vr);},Ee.prototype.find=function(l){return this.filter(l).head();},Ee.prototype.findLast=function(l){return this.reverse().find(l);},Ee.prototype.invokeMap=xe(function(l,f){return typeof l=="function"?new Ee(this):this.map(function(I){return ha(I,l,f);});}),Ee.prototype.reject=function(l){return this.filter(sc(he(l)));},Ee.prototype.slice=function(l,f){l=Te(l);var I=this;return I.__filtered__&&(l>0||f<0)?new Ee(I):(l<0?I=I.takeRight(-l):l&&(I=I.drop(l)),f!==e&&(f=Te(f),I=f<0?I.dropRight(-f):I.take(f-l)),I);},Ee.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse();},Ee.prototype.toArray=function(){return this.take(R);},Hn(Ee.prototype,function(l,f){var I=/^(?:filter|find|map|reject)|While$/.test(f),W=/^(?:head|last)$/.test(f),it=gt[W?"take"+(f=="last"?"Right":""):f],yt=W||/^find/.test(f);it&&(gt.prototype[f]=function(){var bt=this.__wrapped__,Rt=W?[1]:arguments,Bt=bt instanceof Ee,Ht=Rt[0],Vt=Bt||ge(bt),qt=function qt(be){var Le=it.apply(gt,Ni([be],Rt));return W&&ie?Le[0]:Le;};Vt&&I&&typeof Ht=="function"&&Ht.length!=1&&(Bt=Vt=!1);var ie=this.__chain__,ce=!!this.__actions__.length,de=yt&&!ie,Ce=Bt&&!ce;if(!yt&&Vt){bt=Ce?bt:new Ee(this);var fe=l.apply(bt,Rt);return fe.__actions__.push({func:ec,args:[qt],thisArg:e}),new wn(fe,ie);}return de&&Ce?l.apply(this,Rt):(fe=this.thru(qt),de?W?fe.value()[0]:fe.value():fe);});}),sn(["pop","push","shift","sort","splice","unshift"],function(l){var f=Al[l],I=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",W=/^(?:pop|shift)$/.test(l);gt.prototype[l]=function(){var it=arguments;if(W&&!this.__chain__){var yt=this.value();return f.apply(ge(yt)?yt:[],it);}return this[I](function(bt){return f.apply(ge(bt)?bt:[],it);});};}),Hn(Ee.prototype,function(l,f){var I=gt[f];if(I){var W=I.name+"";Ue.call(lo,W)||(lo[W]=[]),lo[W].push({name:f,func:I});}}),lo[Zl(e,Y).name]=[{name:"wrapper",func:e}],Ee.prototype.clone=iC,Ee.prototype.reverse=sC,Ee.prototype.value=oC,gt.prototype.at=kP,gt.prototype.chain=BP,gt.prototype.commit=FP,gt.prototype.next=WP,gt.prototype.plant=zP,gt.prototype.reverse=$P,gt.prototype.toJSON=gt.prototype.valueOf=gt.prototype.value=YP,gt.prototype.first=gt.prototype.head,sa&&(gt.prototype[sa]=UP),gt;},so=FI();fs?((fs.exports=so)._=so,Nf._=so):Ir._=so;}).call(Qe);})(Iu,Iu.exports);Iu.exports;var jbt=(_jbt={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_jbt,St.Selector,_e.selector),St.Clicker,_e.clicker),St.Text,_e.text),St.Pencil,_e.pencil),St.LaserPen,_e.laserPen),St.Arrow,_e.arrow),St.Straight,_e.straight),St.Rectangle,_e.rectangle),St.Ellipse,_e.ellipse),St.Star,Qi.star),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_jbt,St.Polygon,Qi.polygon),St.SpeechBalloon,Qi.speechBalloon),St.Eraser,_e.eraser),St.PencilEraser,_e.pencilEraser),St.BitMapEraser,Qi.bitMapEraser));function Xbt(r){return r===void 0?void 0:jbt[r];}function Fn(r){return Xbt(r);}var Hc=5,Ki=/*#__PURE__*/function(_Gt11){function Ki(e){var _this62;_classCallCheck(this,Ki);_this62=_callSuper(this,Ki,[e]);ht(_this62,"canRotate",!1);ht(_this62,"scaleType",Ae.proportional);ht(_this62,"toolsType",St.Text);ht(_this62,"tmpPoints",[]);ht(_this62,"workOptions");ht(_this62,"oldRect");_this62.workOptions=e.toolsOpt;return _this62;}_inherits(Ki,_Gt11);return _createClass(Ki,[{key:"consume",value:function consume(){return{type:Tt.None};}},{key:"consumeAll",value:function consumeAll(){return{type:Tt.None};}},{key:"consumeService",value:function consumeService(){}},{key:"draw",value:function(){var _draw2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(e){var n,i,s,o,a,_this$workOptions14,u,h,v,p,y,C,b,M,L,X,Y,et,A;return _regenerator().w(function(_context16){while(1)switch(_context16.n){case 0:n=e.workId,i=e.layer,s=e.isDrawLabel,o=e.boxRect,a=e.isActive;if(!(a&&!a())){_context16.n=1;break;}return _context16.a(2);case 1:_this$workOptions14=this.workOptions,u=_this$workOptions14.boxSize,h=_this$workOptions14.boxPoint,v=_this$workOptions14.zIndex,p=i.worldPosition,y=i.worldScaling;if(!(!h||!u)){_context16.n=2;break;}return _context16.a(2);case 2:C={name:n,id:n,pos:[h[0]-Hc,h[1]-Hc],anchor:[0,0],size:u,zIndex:v},b=new nr(C),M={x:h[0]-Hc,y:h[1]-Hc,w:u[0],h:u[1]},L={x:Math.floor(M.x*y[0]+p[0]),y:Math.floor(M.y*y[1]+p[1]),w:Math.floor(M.w*y[0])+2,h:Math.floor(M.h*y[1])+2};if(!(o&&(X=el(L,o)),(s||o&&X!==es.outside)&&i&&this.workOptions.text)){_context16.n=5;break;}_context16.n=3;return Ki.createLabels(this.workOptions,i,L,a);case 3:Y=_context16.v;et=Y.labels;A=Y.maxWidth;if(!(a&&!a())){_context16.n=4;break;}return _context16.a(2,(et.forEach(function(w){return w.disconnect();}),L));case 4:b.append.apply(b,_toConsumableArray(et)),L.w=Math.ceil(Math.max(A*i.worldScaling[0],L.w));case 5:return _context16.a(2,a&&!a()?(b.removeAllChildren(),b.disconnect(),L):(this.replace(i,n,b),L));}},_callee15,this);}));function draw(_x29){return _draw2.apply(this,arguments);}return draw;}()},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(e){var p,y,C,b,n,i,s,o,a,u,h,v;return _regenerator().w(function(_context17){while(1)switch(_context17.n){case 0:n=(p=this.workId)==null?void 0:p.toString();if(n){_context17.n=1;break;}return _context17.a(2);case 1:i=e.isFullWork,s=e.replaceId,o=e.isDrawLabel,a=e.boxRect,u=e.isActive;this.oldRect=s&&((C=(y=this.vNodes)==null?void 0:y.get(s))==null?void 0:C.rect)||void 0;h=i?this.fullLayer:this.drawLayer||this.fullLayer;_context17.n=2;return this.draw({workId:n,layer:h,isDrawLabel:_typeof(o)>"u"&&this.workOptions.workState===te.Done||o,boxRect:a,isActive:u});case 2:v=_context17.v;return _context17.a(2,(u&&!u()||(b=this.vNodes)==null||b.setInfo(n,{rect:v,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:v&&Gt.getCenterPos(v,h)}),v));}},_callee16,this);}));function consumeServiceAsync(_x30){return _consumeServiceAsync2.apply(this,arguments);}return consumeServiceAsync;}()},{key:"updataOptService",value:function updataOptService(){}},{key:"updataOptServiceAsync",value:function(){var _updataOptServiceAsync=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(e,n,i){var M,L,s,o,a,u,h,v,p,y,C,b;return _regenerator().w(function(_context18){while(1)switch(_context18.n){case 0:if(this.workId){_context18.n=1;break;}return _context18.a(2);case 1:s=this.workId.toString(),o=e.fontColor,a=e.fontBgColor,u=e.bold,h=e.italic,v=e.lineThrough,p=e.underline,y=e.zIndex,C=(M=this.vNodes)==null?void 0:M.get(s);if(C){_context18.n=2;break;}return _context18.a(2);case 2:o&&(C.opt.fontColor=o),a&&(C.opt.fontBgColor=a),u&&(C.opt.bold=u),h&&(C.opt.italic=h),Rs(v)&&(C.opt.lineThrough=v),Rs(p)&&(C.opt.underline=p),$e(y)&&(C.opt.zIndex=y),this.oldRect=C.rect;_context18.n=3;return this.draw({workId:s,layer:this.fullLayer,isDrawLabel:_typeof(n)>"u"&&this.workOptions.workState===te.Done||n,boxRect:i});case 3:b=_context18.v;return _context18.a(2,((L=this.vNodes)==null||L.setInfo(s,{rect:b,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:b&&Gt.getCenterPos(b,this.fullLayer)}),b));}},_callee17,this);}));function updataOptServiceAsync(_x31,_x32,_x33){return _updataOptServiceAsync.apply(this,arguments);}return updataOptServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function(){var _normalizeStorageData2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(e){return _regenerator().w(function(_context19){while(1)switch(_context19.n){case 0:return _context19.a(2,this.normalizeStorageDataSync(e));}},_callee18,this);}));function normalizeStorageData(_x34){return _normalizeStorageData2.apply(this,arguments);}return normalizeStorageData;}()},{key:"normalizeStorageDataSync",value:function normalizeStorageDataSync(e){var n=Gt.normalizeStorageDataSync(e);if(n.status==="unrecoverable")return n;var i=n.value,s=i.opt;return s&&s.workState!==te.Done?(i.type=Tt.FullWork,i.opt=_objectSpread(_objectSpread({},s),{},{workState:te.Done}),{status:"stable",value:i}):n;}},{key:"getSafetySnippetRatio",value:function getSafetySnippetRatio(e){var n=(e==null?void 0:e.parent).displayRatio||1,i=Math.ceil(e.worldScaling[0]*10)/10;var s=i;return i<=2?s=i*n*2:i>2&&i<=3?s=i*n*1.6:i>3&&i<=4?s=i*n*1.2:i>4&&(s=i*n),Math.floor(s*1e3)/1e3;}},{key:"getSafetySnippetFontLength",value:function getSafetySnippetFontLength(e){return Math.floor(Ki.textImageSnippetSize*3/4/e)||1;}},{key:"createLabels",value:function(){var _createLabels=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(e,n,i,s){var j,o,a,u,_ref71,h,v,p,y,C,b,M,L,X,Y,et,A,w,S,x,P,z,U,K,nt,ct,B,N,G,q,at,ut,Ct,R,$,H,lt,dt,wt,Et,Ot,O,D,J,_,_dt2,_wt2,_Et2,_dt3,_wt3,_H2,_lt2;return _regenerator().w(function(_context20){while(1)switch(_context20.n){case 0:o=[],a=i.x,u=i.y,_ref71=(j=n.parent)==null?void 0:j.parent,h=_ref71.width,v=_ref71.height,p=ks(e.text),y=p.length,C=e.fontSize,b=e.lineHeight,M=e.bold,L=e.textAlign,X=e.italic,Y=e.fontFamily,et=e.verticalAlign,A=e.fontColor,w=e.fontBgColor,S=e.underline,x=e.lineThrough,P=Ki.getSafetySnippetRatio(n)||1,z=Math.floor(C*P),U=Ki.getSafetySnippetFontLength(z);K=0;nt=0;case 1:if(!(nt<y)){_context20.n=9;break;}ct=p[nt],B=b||z*1.5;if(!ct){_context20.n=8;break;}N=cAt(ct),G=[0,0],q=[0,C*1.2];et==="middle"&&(G[1]=Math.floor(nt*C*1.2+6+C*(1.1-1)));at=[0,Math.floor(-C*0.15)];G[0]=6;ut=Math.sin(Math.PI/180*20);Ct=0;R=[];$=0;case 2:if(!($<N)){_context20.n=7;break;}if(!(s&&!s())){_context20.n=3;break;}return _context20.a(2,(R.forEach(function(Ot){return Ot.disconnect();}),o.forEach(function(Ot){return Ot.disconnect();}),{labels:[],maxWidth:K}));case 3:L==="left"&&(at[0]=Ct),$===0&&X==="italic"&&(at[0]=at[0]-ut/2*C);H=ct.slice($,$+U);lt={anchor:[0,0],pos:at,text:H,fontFamily:Y,fontSize:z,lineHeight:B,strokeColor:A,fontWeight:M,fillColor:A,textAlign:L,fontStyle:X,scale:[1/P,1/P]};dt=new pv(lt);_context20.n=4;return dt.textImageReady;case 4:wt=_context20.v;if(!(s&&!s())){_context20.n=5;break;}return _context20.a(2,(dt.disconnect(),R.forEach(function(Ot){return Ot.disconnect();}),o.forEach(function(Ot){return Ot.disconnect();}),{labels:[],maxWidth:K}));case 5:Et=!0;if(wt){Ot=wt.rect&&wt.rect[2],O=wt.rect&&wt.rect[3];if(Ot&&O){D=Ot/P,J=O/P;Ct=D+Ct,X==="italic"&&(M==="bold"?Ct=Ct-ut*C*1.2:Ct=Ct-ut*C),((at[0]+G[0]+D)*n.worldScaling[0]+a<=0||(at[0]+G[0])*n.worldScaling[0]+a>=h||(at[1]+G[1]+J)*n.worldScaling[1]+u<=0||(at[1]+G[1])*n.worldScaling[1]+u>=v)&&(dt.disconnect(),Et=!1),Et&&R.push(dt);}}$+=U;case 6:_context20.n=2;break;case 7:q[0]=Ct,X==="italic"&&(q[0]=q[0]+ut*C),K=Math.max(K,q[0]);_=!0;if(((G[0]+q[0])*n.worldScaling[0]+a<=0||G[0]*n.worldScaling[0]+a>=h||(G[1]+q[1])*n.worldScaling[0]+u<=0||G[1]*n.worldScaling[1]+u>=v)&&(_=!1),_){if(S){_dt2=Math.floor(C/10),_wt2={normalize:!1,pos:[0,C*1.1+_dt2/2],lineWidth:_dt2,points:[0,0,Math.ceil(q[0]),0],strokeColor:A,className:"underline"},_Et2=new zn(_wt2);R.push(_Et2);}if(x){_dt3={normalize:!1,pos:[0,C*1.2/2],lineWidth:Math.floor(C/10),points:[0,0,Math.ceil(q[0]),0],strokeColor:A,className:"lineThrough"},_wt3=new zn(_dt3);R.push(_wt3);}_H2={pos:G,anchor:[0,0],size:q,bgcolor:w},_lt2=new nr(_H2);_lt2.append.apply(_lt2,R),o.push(_lt2);}case 8:nt++;_context20.n=1;break;case 9:return _context20.a(2,{labels:o,maxWidth:K});}},_callee19);}));function createLabels(_x35,_x36,_x37,_x38){return _createLabels.apply(this,arguments);}return createLabels;}()},{key:"updateNodeOpt",value:function updateNodeOpt(e){var n=e.node,i=e.opt,s=e.vNodes,o=e.targetNode,a=i.fontBgColor,u=i.fontColor,h=i.translate,v=i.originPoint,p=i.scenePoint,y=i.scale,C=i.bold,b=i.italic,M=i.lineThrough,L=i.underline,X=i.fontSize,Y=i.textInfos,et=i.zIndex,A=o&&gr(o)||s.get(n.name);if(!A||!n.parent)return;var S=A.opt;if($e(et)&&(n.setAttribute("zIndex",et),A.opt.zIndex=et),u&&S.fontColor&&(S.fontColor=u,n.children.forEach(function(x){x.tagName==="GROUP"&&x.children.forEach(function(P){P.tagName==="LABEL"?(P.setAttribute("fillColor",u),P.setAttribute("strokeColor",u)):P.tagName==="POLYLINE"&&P.setAttribute("strokeColor",u);});})),a&&S.fontBgColor&&(S.fontBgColor=a,n.children.forEach(function(x){x.tagName==="GROUP"&&x.setAttribute("bgcolor",a);})),C&&(S.bold=C),b&&(S.italic=b),Rs(M)&&(S.lineThrough=M),Rs(L)&&(S.underline=L),X&&(S.fontSize=X),v&&p&&y&&o&&S.boxPoint){var x=Y==null?void 0:Y.get(n.name);if(x){var K=x.fontSize,j=x.boxSize;S.boxSize=j||S.boxSize,S.fontSize=K||S.fontSize;}var P=[S.boxPoint[0],S.boxPoint[1]];yf(S.boxPoint,p,y,h);var z=[A.op[0],A.op[1]],U=[z[0]-P[0],z[1]-P[1]];if(A.centerPos=[A.centerPos[0]+U[0],A.centerPos[1]+U[1]],A.opt.eraserlines){var _iterator46=_createForOfIteratorHelper(A.opt.eraserlines),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _K14=_step46.value;var _j3=_K14.op,nt=_K14.thickness;_K14.thickness=Math.round(nt*Math.max(y[0],y[1]));for(var ct=0;ct<_j3.length;ct++)ja(_j3[ct],p,y,h);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}}}else if(h&&S.boxPoint&&(S.boxPoint=[Math.round(S.boxPoint[0]+h[0]),Math.round(S.boxPoint[1]+h[1])],A.centerPos=[A.centerPos[0]+h[0],A.centerPos[1]+h[1]],A.opt.eraserlines)){var _iterator47=_createForOfIteratorHelper(A.opt.eraserlines),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _x39=_step47.value;var _P6=_x39.op;for(var _z15=0;_z15<_P6.length;_z15++){var _U13=_P6[_z15].map(function(K,j){return j%2?K+h[1]:K+h[0];});_x39.op[_z15]=_U13;}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}}return A&&s.setInfo(n.name,A),A==null?void 0:A.rect;}},{key:"getRectFromLayer",value:function getRectFromLayer(e,n){var i=e.getElementsByName(n)[0];if(i){var s=i.getBoundingClientRect();var o={x:Math.floor(s.x),y:Math.floor(s.y),w:Math.floor(s.width+2),h:Math.floor(s.height+2)};return i.children.forEach(function(a){if(a.tagName==="GROUP"){var u=i.getBoundingClientRect();o=Kt(o,{x:Math.floor(u.x),y:Math.floor(u.y),w:Math.floor(u.width+2),h:Math.floor(u.height+2)});}}),o;}}}]);}(Gt);// 4k
|
|
483
|
+
ht(Ki,"textImageSnippetSize",1024*4),ht(Ki,"SafeBorderPadding",30);var Ja=Ki;var Hbt=0.01;function bT(r,t){var _e$protectedIndex,_e$timestamp;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var n=r.length-1;var i=(_e$protectedIndex=e.protectedIndex)!==null&&_e$protectedIndex!==void 0?_e$protectedIndex:-1,s=(_e$timestamp=e.timestamp)!==null&&_e$timestamp!==void 0?_e$timestamp:Date.now();for(var o=0;o<t.length;o+=2){var a=new _t(t[o],t[o+1]),u=r[r.length-1];if(!u){a.setT(s),r.push(a);continue;}if(a.x===u.x&&a.y===u.y){u.setT(s);continue;}var h=r.length-1;if(r.length>1&&h>i){var p=r[h-1],y=xt.Sub(u,p).uni(),C=xt.Sub(a,u).uni();Number.isFinite(y.x)&&Number.isFinite(y.y)&&Number.isFinite(C.x)&&Number.isFinite(C.y)&&xt.Equals(y,C,Hbt)&&(r.pop(),n--);}var v=r[r.length-1];a.setv(xt.Sub(a,v).uni()),a.setT(s),r.push(a);}return Math.max(n,0);}var Oo=/*#__PURE__*/function(_Gt12){function Oo(e){var _this63;_classCallCheck(this,Oo);_this63=_callSuper(this,Oo,[e]);ht(_this63,"canRotate",!1);ht(_this63,"scaleType",Ae.none);ht(_this63,"toolsType",St.PencilEraser);ht(_this63,"tmpPoints",[]);ht(_this63,"workOptions");ht(_this63,"worldPosition");ht(_this63,"worldScaling");ht(_this63,"eraserRect");ht(_this63,"eraserPolyline");_this63.workOptions=e.toolsOpt,_this63.worldPosition=_this63.fullLayer.worldPosition,_this63.worldScaling=_this63.fullLayer.worldScaling;return _this63;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(Oo,_Gt12);return _createClass(Oo,[{key:"combineConsume",value:function combineConsume(e){var n=e.workerEngine;if(this.tmpPoints.length===0)return{type:Tt.None};var i=this.workOptions.thickness,_Oo$eraserSizes$i=Oo.eraserSizes[i],s=_Oo$eraserSizes$i.width,o=_Oo$eraserSizes$i.height,a=Math.round(Math.max(s,o)/this.worldScaling[0]),_this$getChangeNodes=this.getChangeNodes(a,n),u=_this$getChangeNodes.rect,h=_this$getChangeNodes.willNewNodes,v=_this$getChangeNodes.willDeleteNodes;return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:Tt.DrawWork,rect:u,willNewNodes:h,willDeleteNodes:v});}},{key:"consumeService",value:function consumeService(){}},{key:"updateTempPoints",value:function updateTempPoints(e,n){return bT(this.tmpPoints,e);}},{key:"getChangeNodes",value:function getChangeNodes(e,n){var i=/* @__PURE__ */new Map(),s=/* @__PURE__ */new Set();var o;if(!this.vNodes)return{willDeleteNodes:s,willNewNodes:i,rect:o};var a=this.worldPosition;var u=Ye(this.tmpPoints,e);u=tl(u,a),u=LT(u,this.worldScaling,a);var _this$vNodes$getRectI3=this.vNodes.getRectIntersectRange(u),h=_this$vNodes$getRectI3.nodeRange;if(!h.size)return{willDeleteNodes:s,willNewNodes:i,rect:o};var v=this.computEraserPointLines(this.tmpPoints,90);var _iterator48=_createForOfIteratorHelper(h.entries()),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var _step48$value=_slicedToArray(_step48.value,2),p=_step48$value[0],y=_step48$value[1];if(y.toolsType!==St.Pencil)continue;var C=tl(y.rect,[-a[0],-a[1]]);C={x:C.x/this.worldScaling[0],y:C.y/this.worldScaling[1],w:C.w/this.worldScaling[0],h:C.h/this.worldScaling[1]};var b=[C.x,C.y,C.x+C.w,C.y+C.h],M=[],L=[];var _iterator49=_createForOfIteratorHelper(v),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _X6=_step49.value;Ov.polyline(_X6,b,M);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}if(M.length&&y.opt){var _iterator50=_createForOfIteratorHelper(M),_step50;try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var X=_step50.value;var Y=[];for(var et=0;et<X.length;et++)et!==0&&Qn(X[et],X[et-1])||Y.push.apply(Y,_toConsumableArray(X[et]));L.push(Y);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}}if(L.length&&n){var _X5=n.createWorkShapeNode({workId:p,toolsType:St.Pencil,toolsOpt:y.opt});_X5.setWorkId(p);var _Y3=_X5==null?void 0:_X5.computPencilPoints({op:y.op,eraserPolylines:L,eraserThickness:e});if(o=Kt(o,y.rect),s.add(p),n.removeNode(p),_Y3.length)for(var _et3=0;_et3<_Y3.length;_et3++){var A="".concat(p,"_").concat(Date.now(),"_").concat(_et3),w=A,x=n.setFullWork({workId:w,opt:y.opt,toolsType:St.Pencil}).consumeService({op:_Y3[_et3],isFullWork:!0,replaceId:w});n.clearWorkShapeNodeCache(w),o=Kt(o,x),i.set(A,_objectSpread(_objectSpread({},y),{},{toolsType:St.Pencil,rect:x!==null&&x!==void 0?x:y.rect,name:A,op:_Y3[_et3]}));}}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}return{willNewNodes:i,willDeleteNodes:s,rect:o};}},{key:"consume",value:function consume(e){var n=e.data,i=n.op;if(!i||i.length===0)return _objectSpread({type:Tt.None},this.baseConsumeResult);var s=this.workOptions.thickness,_Oo$eraserSizes$s=Oo.eraserSizes[s],o=_Oo$eraserSizes$s.width,a=_Oo$eraserSizes$s.height,u=Math.max(o,a)/this.worldScaling[0];return this.updateTempPoints(i,u),_objectSpread({type:Tt.None},this.baseConsumeResult);}},{key:"computEraserPointLines",value:function computEraserPointLines(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:60;var i=[];var s=0;var o=360-n;for(var a=1;a<e.length;a++){var u=e[a-1],h=e[a];if(a===1&&s===0&&(i[s]=[u.XY]),i[s].push(h.XY),a<e.length-1){var v=h.getAngleByPoints(u,e[a+1]);(v<n||v>o)&&(s++,i[s]=[h.XY]);}}return e.length===1&&i.length===0&&i.push([e[0].XY,e[0].XY]),i;}},{key:"consumeAll",value:function consumeAll(e){var n=e.workerEngine;if(this.replace(this.fullLayer,this.workId),!this.tmpPoints.length)return _objectSpread({type:Tt.None},this.baseConsumeResult);var i=this.workOptions.thickness,_Oo$eraserSizes$i2=Oo.eraserSizes[i],s=_Oo$eraserSizes$i2.width,o=_Oo$eraserSizes$i2.height,a=Math.max(s,o)/this.worldScaling[0],_this$getChangeNodes2=this.getChangeNodes(a,n),u=_this$getChangeNodes2.willDeleteNodes,h=_this$getChangeNodes2.willNewNodes,v=_this$getChangeNodes2.rect;if(u.size===0&&h.size===0)return _objectSpread(_objectSpread({type:Tt.FullWork},this.baseConsumeResult),{},{rect:v});var p=[];this.tmpPoints.map(function(C){p.push(C.x,C.y,a/2);});var y=Br(p);return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:Tt.FullWork,dataType:Qt.Local,rect:v,ops:y,willNewNodes:h,willDeleteNodes:u});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}]);}(Gt);// 来源于white-sdk
|
|
484
|
+
ht(Oo,"eraserSizes",Rv);var Cu=Oo;St.Image,St.BackgroundSVG;St.Polygon,St.Star,St.Star,St.Star,St.SpeechBalloon;St.Pencil,St.LaserPen,St.Arrow,St.Straight;St.Rectangle,St.Ellipse,St.Triangle,St.Rhombus,St.Polygon,St.Star,St.SpeechBalloon;var Vbt=/* @__PURE__ */new Set([St.Pencil,St.Arrow,St.Straight,St.Rectangle,St.Ellipse,St.Star,St.Triangle,St.Rhombus,St.Polygon,St.SpeechBalloon]);function AT(r){return r!==void 0&&Vbt.has(r);}St.Pencil;St.LaserPen,St.Arrow,St.Straight,St.Rectangle,St.Ellipse,St.Star,St.Polygon,St.SpeechBalloon;function Zbt(r,t,e){var n=r-(e?1:2);if(!(n<1||n<=t))return{start:Math.max(t,0),end:n,committedIndex:n};}function kd(r){return r.toolsType===St.Image||r.toolsType===St.Text?"delete-on-done":r.isSelected?"blocked":AT(r.toolsType)?"vector":"blocked";}function qbt(r,t,e){return r.map(function(_ref72){var n=_ref72.x,i=_ref72.y;return[n*e[0]+t[0],i*e[1]+t[1]];});}function Bd(r,t,e){if(!r.length)return!1;if(r.length===1)return xp(r[0],e)<=t*t;for(var n=1;n<r.length;n++)if(Kbt(r[n-1],r[n],e)<=t*t)return!0;return!1;}function xp(r,t){var e=Math.max(t.x-r[0],0,r[0]-(t.x+t.w)),n=Math.max(t.y-r[1],0,r[1]-(t.y+t.h));return e*e+n*n;}function Kbt(r,t,e){if(Qbt(r,t,e))return 0;var n=e.x,i=e.y,s=e.x+e.w,o=e.y+e.h,a=[[[n,i],[s,i]],[[s,i],[s,o]],[[s,o],[n,o]],[[n,o],[n,i]]];var u=Math.min(xp(r,e),xp(t,e));for(var _i7=0,_a8=a;_i7<_a8.length;_i7++){var _a8$_i=_slicedToArray(_a8[_i7],2),h=_a8$_i[0],v=_a8$_i[1];u=Math.min(u,Jbt(r,t,h,v));}return u;}function Qbt(r,t,e){var n=0,i=1;var s=t[0]-r[0],o=t[1]-r[1],a=[[-s,r[0]-e.x],[s,e.x+e.w-r[0]],[-o,r[1]-e.y],[o,e.y+e.h-r[1]]];for(var _i8=0,_a9=a;_i8<_a9.length;_i8++){var _a9$_i=_slicedToArray(_a9[_i8],2),u=_a9$_i[0],h=_a9$_i[1];if(u===0){if(h<0)return!1;continue;}var v=h/u;if(u<0?n=Math.max(n,v):i=Math.min(i,v),n>i)return!1;}return!0;}function Jbt(r,t,e,n){var i=t[0]-r[0],s=t[1]-r[1],o=n[0]-e[0],a=n[1]-e[1],u=r[0]-e[0],h=r[1]-e[1],v=i*i+s*s,p=i*o+s*a,y=o*o+a*a,C=i*u+s*h,b=o*u+a*h,M=v*y-p*p;var L=M,X=M,Y=M,et=M;M<Number.EPSILON?(L=0,Y=1,X=b,et=y):(L=p*b-y*C,X=v*b-p*C,L<0?(L=0,X=b,et=y):L>Y&&(L=Y,X=b+p,et=y)),X<0?(X=0,-C<0?L=0:-C>v?L=Y:(L=-C,Y=v)):X>et&&(X=et,-C+p<0?L=0:-C+p>v?L=Y:(L=-C+p,Y=v));var A=Math.abs(L)<Number.EPSILON?0:L/Y,w=Math.abs(X)<Number.EPSILON?0:X/et,S=u+A*i-w*o,x=h+A*s-w*a;return S*S+x*x;}var Ru=/*#__PURE__*/function(_Gt13){function Ru(e){var _this64;_classCallCheck(this,Ru);_this64=_callSuper(this,Ru,[e]);ht(_this64,"canRotate",!1);ht(_this64,"scaleType",Ae.none);ht(_this64,"toolsType",St.BitMapEraser);ht(_this64,"tmpPoints",[]);ht(_this64,"workOptions");ht(_this64,"worldPosition");ht(_this64,"worldScaling");ht(_this64,"eraserRect");ht(_this64,"eraserPolyline");ht(_this64,"oldRect");ht(_this64,"committedPointIndex",-1);ht(_this64,"candidateWorkIds",/* @__PURE__ */new Set());ht(_this64,"doingPointBatches",[]);ht(_this64,"doingLines",/* @__PURE__ */new Map());ht(_this64,"changedNodes",/* @__PURE__ */new Map());ht(_this64,"deletedNodes",/* @__PURE__ */new Set());ht(_this64,"changedRect");ht(_this64,"lastSceneRevision",-1);ht(_this64,"pendingDeleteIds",/* @__PURE__ */new Set());ht(_this64,"hiddenRenderNodes",/* @__PURE__ */new Map());ht(_this64,"fullLayerPreviewGroup");ht(_this64,"disposeVNodeObserver");/** Transaction-scoped before-images survive until the Done ACK is applied. */ht(_this64,"beforeImages",/* @__PURE__ */new Map());_this64.workOptions=e.toolsOpt,_this64.worldPosition=_this64.fullLayer.worldPosition,_this64.worldScaling=_this64.fullLayer.worldScaling,_this64.startVNodeObservation();return _this64;}/** Consume exactly one accepted input batch and publish one FullLayer preview. */_inherits(Ru,_Gt13);return _createClass(Ru,[{key:"combineConsume",value:function combineConsume(e){var _ref73;var h;this.syncWorldTransform(),this.startVNodeObservation();var n=this.getDeltaPoints(!0),i=(_ref73=(h=this.vNodes)==null?void 0:h.getRevision())!==null&&_ref73!==void 0?_ref73:0,s=i!==this.lastSceneRevision;var o=this.restoreNoLongerClearablePendingDeletes();var a=s?this.tmpPoints:n==null?void 0:n.points;if(a!=null&&a.length){var v=this.getEraserThickness();o=Kt(o,this.hideDeleteCandidatesForPoints(a,v)),this.collectVectorCandidateWorkIds(a,v);}if(this.lastSceneRevision=i,!n)return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:o?Tt.DrawWork:Tt.None,rect:o});var u=this.getEraserThickness();return this.recordDoingPointBatch(n.points),o=Kt(o,this.appendFullLayerPreview(n.points,u)),this.committedPointIndex=n.committedIndex,this.changedRect=Kt(this.changedRect,o),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:o?Tt.DrawWork:Tt.None,rect:o});}},{key:"consumeService",value:function consumeService(){}},{key:"consume",value:function consume(e){var n=e.data.op;return n!=null&&n.length?(this.syncWorldTransform(),this.updateTempPoints(n),_objectSpread({type:Tt.None},this.baseConsumeResult)):_objectSpread({type:Tt.None},this.baseConsumeResult);}},{key:"consumeAll",value:function(){var _consumeAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(e){var n,i,s,_iterator51,_step51,_step51$value,v,p,o,a,u,h,_iterator52,_step52,_v9,_a0,_u7,_t19,_t20;return _regenerator().w(function(_context21){while(1)switch(_context21.p=_context21.n){case 0:n=e.workerEngine;if(!(this.syncWorldTransform(),this.clearFullLayerPreview(!1),!this.tmpPoints.length)){_context21.n=1;break;}return _context21.a(2,(this.clearFullLayerPreview(!0),_objectSpread({type:Tt.None},this.baseConsumeResult)));case 1:i=this.getEraserThickness(),s=new Map(this.beforeImages);_context21.p=2;this.recordFinalPointBatch(),this.getCandidateWorkIds().clear(),this.collectVectorCandidateWorkIds(this.tmpPoints,i),this.collectDeleteCandidatesForDone(this.tmpPoints,i);_iterator51=_createForOfIteratorHelper(this.snapshotDoneCandidates());try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){_step51$value=_slicedToArray(_step51.value,2),v=_step51$value[0],p=_step51$value[1];s.set(v,p);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}n&&typeof n.publishBitmapEraserBeforeImages=="function"&&n.publishBitmapEraserBeforeImages(this.workId,s),this.collectDoneVectorChanges(i),this.commitDoingFaces(),this.renderChangedNodes(n,this.workOptions.removeOnDone!==!1),this.commitPendingDeletions(n);o=new Set(this.deletedNodes),a=new Map(this.changedNodes),u=this.changedRect;if(!(o.size===0&&a.size===0)){_context21.n=3;break;}return _context21.a(2,_objectSpread(_objectSpread({type:Tt.FullWork},this.baseConsumeResult),{},{rect:u,eraseTxnBeforeImages:new Map(s),eraseTxnCommitStatus:"applied"}));case 3:h=[];_iterator52=_createForOfIteratorHelper(this.tmpPoints);try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){_v9=_step52.value;h.push(_v9.x,_v9.y,i/2);}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}return _context21.a(2,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:Tt.FullWork,dataType:Qt.Local,rect:u,ops:Br(h),willUpdateNodes:a,willDeleteNodes:o,eraseTxnBeforeImages:new Map(s),eraseTxnCommitStatus:"applied"}));case 4:_context21.p=4;_t19=_context21.v;_a0=!0;_context21.p=5;_context21.n=6;return this.restoreFailedDoneCandidates(s,n);case 6:_a0=!_context21.v;_context21.n=8;break;case 7:_context21.p=7;_t20=_context21.v;console.warn("[BitMapEraser] Done recovery threw after commit error:",_t20);case 8:_u7=this.changedRect;try{this.clearFullLayerPreview(!0);}catch(h){console.warn("[BitMapEraser] Done preview cleanup failed:",h);}return _context21.a(2,(this.changedNodes.clear(),this.getCandidateWorkIds().clear(),this.getDoingPointBatches().length=0,this.getDoingLines().clear(),this.deletedNodes.clear(),this.pendingDeleteIds.clear(),console.warn("[BitMapEraser] Done commit aborted:",_t19),_objectSpread(_objectSpread({type:Tt.FullWork},this.baseConsumeResult),{},{rect:_u7,willUpdateNodes:/* @__PURE__ */new Map(),willDeleteNodes:/* @__PURE__ */new Set(),eraseTxnBeforeImages:new Map(s),eraseTxnRecoveryRequired:_a0,eraseTxnCommitStatus:"failed"})));}},_callee20,this,[[5,7],[2,4]]);}));function consumeAll(_x40){return _consumeAll.apply(this,arguments);}return consumeAll;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.clearFullLayerPreview(!0),this.stopVNodeObservation(),this.tmpPoints.length=0,this.committedPointIndex=-1,this.changedNodes.clear(),this.getCandidateWorkIds().clear(),this.getDoingPointBatches().length=0,this.getDoingLines().clear(),this.deletedNodes.clear(),this.pendingDeleteIds.clear(),this.changedRect=void 0,this.lastSceneRevision=-1;}},{key:"shouldRevalidateVNodeRevision",value:function shouldRevalidateVNodeRevision(){return this.tmpPoints.length>0;}},{key:"syncWorldTransform",value:function syncWorldTransform(){this.worldPosition=this.fullLayer.worldPosition,this.worldScaling=this.fullLayer.worldScaling;}},{key:"getEraserThickness",value:function getEraserThickness(){var e=this.workOptions.thickness,_Ru$eraserSizes$e=Ru.eraserSizes[e],n=_Ru$eraserSizes$e.width,i=_Ru$eraserSizes$e.height;return Math.round(Math.max(n,i)/this.worldScaling[0]);}},{key:"updateTempPoints",value:function updateTempPoints(e){bT(this.tmpPoints,e,{protectedIndex:this.committedPointIndex});}},{key:"getDeltaPoints",value:function getDeltaPoints(e){var n=Zbt(this.tmpPoints.length,this.committedPointIndex,e);if(n)return{points:this.tmpPoints.slice(n.start,n.end+1),committedIndex:n.committedIndex};}},{key:"recordFinalPointBatch",value:function recordFinalPointBatch(){var e=this.getDeltaPoints(!0);if(e){this.recordDoingPointBatch(e.points),this.committedPointIndex=e.committedIndex;return;}!this.getDoingPointBatches().length&&this.tmpPoints.length&&(this.recordDoingPointBatch(this.tmpPoints),this.committedPointIndex=this.tmpPoints.length-1);}},{key:"recordDoingPointBatch",value:function recordDoingPointBatch(e){e.length&&this.getDoingPointBatches().push(e.map(function(n){return new _t(n.x,n.y,n.z);}));}},{key:"getDoingPointBatches",value:function getDoingPointBatches(){return this.doingPointBatches||(this.doingPointBatches=[]),this.doingPointBatches;}},{key:"getDoingLines",value:function getDoingLines(){return this.doingLines||(this.doingLines=/* @__PURE__ */new Map()),this.doingLines;}},{key:"getCandidateWorkIds",value:function getCandidateWorkIds(){return this.candidateWorkIds||(this.candidateWorkIds=/* @__PURE__ */new Set()),this.candidateWorkIds;}},{key:"appendFullLayerPreview",value:function appendFullLayerPreview(e,n){var _this65=this;if(!e.length)return;var i=this.computEraserPointLines(e).map(function(u){var h=u.flatMap(function(_ref74){var _ref75=_slicedToArray(_ref74,2),v=_ref75[0],p=_ref75[1];return[v,p];});return Jn(_this65.computEraserPoints(h,n),!0);}).filter(Boolean);if(!i.length)return;var s=new $r({pos:[0,0],d:i.join(" "),fillColor:"rgba(0,0,0,1)",fillRule:"evenodd"});var o=!1;s.addEventListener("beforerender",function(_ref76){var u=_ref76.detail;var h=u.context;typeof h.blendFuncSeparate=="function"?h.blendFuncSeparate(h.ZERO,h.ZERO,h.ZERO,h.ZERO):(h.save(),o=!0,h.globalCompositeOperation="destination-out");}),s.addEventListener("afterrender",function(_ref77){var u=_ref77.detail;var h=u.context;typeof h.blendFuncSeparate=="function"?h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA):o&&(o=!1,h.restore());}),this.getFullLayerPreviewGroup().append(s);var a=Ye(e,n);return a=tl(a,this.worldPosition),LT(a,this.worldScaling,this.worldPosition);}},{key:"getFullLayerPreviewGroup",value:function getFullLayerPreviewGroup(){if(this.fullLayerPreviewGroup)return this.fullLayerPreviewGroup;var e=new nr({name:this.workId,pos:[0,0],zIndex:9999});return this.fullLayer.append(e),this.fullLayerPreviewGroup=e,e;}},{key:"getTrackRect",value:function getTrackRect(e,n){var i=e[0][0],s=e[0][1],o=i,a=s;for(var u=1;u<e.length;u++){var _e$u2=_slicedToArray(e[u],2),h=_e$u2[0],v=_e$u2[1];i=Math.min(i,h),s=Math.min(s,v),o=Math.max(o,h),a=Math.max(a,v);}return{x:i-n,y:s-n,w:o-i+n*2,h:a-s+n*2};}},{key:"getScreenTrack",value:function getScreenTrack(e,n){var i=qbt(e,this.worldPosition,this.worldScaling),s=n*Math.max(Math.abs(this.worldScaling[0]),Math.abs(this.worldScaling[1]))/2;return{screenPoints:i,radius:s,rect:this.getTrackRect(i,s+1)};}},{key:"collectVectorCandidateWorkIds",value:function collectVectorCandidateWorkIds(e,n){if(!this.vNodes||!e.length)return;var i=this.getScreenTrack(e,n),_this$vNodes$getRectI4=this.vNodes.getRectIntersectRange(i.rect,!1,!1),s=_this$vNodes$getRectI4.nodeRange;var _iterator53=_createForOfIteratorHelper(s),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var _step53$value=_slicedToArray(_step53.value,2),o=_step53$value[0],a=_step53$value[1];!this.vNodes.isCanClearWorkId(o)||kd(a)!=="vector"||!Bd(i.screenPoints,i.radius,a.rect)||this.getCandidateWorkIds().add(o);}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}}},{key:"hideDeleteCandidatesForPoints",value:function hideDeleteCandidatesForPoints(e,n){if(!this.vNodes||!e.length)return;var i=this.getScreenTrack(e,n);var s;var _this$vNodes$getRectI5=this.vNodes.getRectIntersectRange(i.rect,!1,!1),o=_this$vNodes$getRectI5.nodeRange;var _iterator54=_createForOfIteratorHelper(o),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var _step54$value=_slicedToArray(_step54.value,2),a=_step54$value[0],u=_step54$value[1];this.pendingDeleteIds.has(a)||!this.vNodes.isCanClearWorkId(a)||kd(u)!=="delete-on-done"||!Bd(i.screenPoints,i.radius,u.rect)||(this.pendingDeleteIds.add(a),this.hideRenderNodesForId(a),s=Kt(s,u.rect),this.changedRect=Kt(this.changedRect,u.rect));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}return s;}},{key:"collectDeleteCandidatesForDone",value:function collectDeleteCandidatesForDone(e,n){if(!this.vNodes||!e.length)return;var i=this.getScreenTrack(e,n),_this$vNodes$getRectI6=this.vNodes.getRectIntersectRange(i.rect,!1,!1),s=_this$vNodes$getRectI6.nodeRange;var _iterator55=_createForOfIteratorHelper(s),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _step55$value=_slicedToArray(_step55.value,2),o=_step55$value[0],a=_step55$value[1];this.vNodes.isCanClearWorkId(o)&&kd(a)==="delete-on-done"&&Bd(i.screenPoints,i.radius,a.rect)&&(this.pendingDeleteIds.add(o),this.changedRect=Kt(this.changedRect,a.rect));}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}}},{key:"hideRenderNodesForId",value:function hideRenderNodesForId(e){this.captureBeforeImage(e);var n=this.hiddenRenderNodes.get(e)||[],i=new Set(n.map(function(_ref78){var s=_ref78.node;return s;}));var _iterator56=_createForOfIteratorHelper(this.fullLayer.getElementsByName(e)),_step56;try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var s=_step56.value;i.has(s)||n.push({node:s,display:s.getAttribute("display")}),s.setAttribute("display","none");}}catch(err){_iterator56.e(err);}finally{_iterator56.f();}this.hiddenRenderNodes.set(e,n);}},{key:"restoreNoLongerClearablePendingDeletes",value:function restoreNoLongerClearablePendingDeletes(){var n,i,s;var e;for(var _i9=0,_arr=_toConsumableArray(this.pendingDeleteIds);_i9<_arr.length;_i9++){var o=_arr[_i9];if(!((n=this.vNodes)!=null&&n.isCanClearWorkId(o))){var _iterator57=_createForOfIteratorHelper(this.hiddenRenderNodes.get(o)||[]),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _step57$value=_step57.value,a=_step57$value.node,u=_step57$value.display;a.setAttribute("display",u);}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}e=Kt(e,(s=(i=this.vNodes)==null?void 0:i.get(o))==null?void 0:s.rect),this.hiddenRenderNodes.delete(o),this.pendingDeleteIds.delete(o);}}return e;}},{key:"snapshotDoneCandidates",value:function snapshotDoneCandidates(){var n;var e=/* @__PURE__ */new Map();for(var _i0=0,_arr2=[].concat(_toConsumableArray(this.getCandidateWorkIds()),_toConsumableArray(this.pendingDeleteIds));_i0<_arr2.length;_i0++){var i=_arr2[_i0];if(e.has(i)||!((n=this.vNodes)!=null&&n.isCanClearWorkId(i)))continue;var s=this.vNodes.get(i);if(s){var o=gr(s);e.set(i,o),this.beforeImages.has(i)||this.beforeImages.set(i,o);}}return e;}},{key:"captureBeforeImage",value:function captureBeforeImage(e){var i;if(this.beforeImages.has(e)||!((i=this.vNodes)!=null&&i.isCanClearWorkId(e)))return;var n=this.vNodes.get(e);n&&this.beforeImages.set(e,gr(n));}},{key:"collectDoneVectorChanges",value:function collectDoneVectorChanges(e){if(!this.vNodes)return;var n=this.worldPosition;var _iterator58=_createForOfIteratorHelper(this.getCandidateWorkIds()),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var i=_step58.value;if(!this.vNodes.isCanClearWorkId(i))continue;var s=this.vNodes.get(i);if(!(s!=null&&s.opt)||!AT(s.toolsType))continue;var o=tl(s.rect,[-n[0],-n[1]]);o={x:o.x/this.worldScaling[0],y:o.y/this.worldScaling[1],w:o.w/this.worldScaling[0],h:o.h/this.worldScaling[1]};var a=[o.x,o.y,o.x+o.w,o.y+o.h],u=[];var _iterator59=_createForOfIteratorHelper(this.getDoingPointBatches()),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var h=_step59.value;var _iterator60=_createForOfIteratorHelper(this.computEraserPointLines(h,120)),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var v=_step60.value;var p=[];Ov.polyline(v,a,p);for(var _i1=0,_p4=p;_i1<_p4.length;_i1++){var y=_p4[_i1];var C=this.normalizeClippedLine(y);C.length&&u.push(C);}}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}u.length&&(this.getDoingLines().set(i,[{workId:this.workId,op:u,thickness:e}]),this.changedNodes.set(i,s),this.changedRect=Kt(this.changedRect,s.rect));}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}}},{key:"normalizeClippedLine",value:function normalizeClippedLine(e){var n=[];for(var i=0;i<e.length&&!(isNaN(e[i][0])||isNaN(e[i][1]));i++){var s=e[i].map(function(o){return Math.round(o*100)/100;});if(i>0){var o=e[i-1].map(function(a){return Math.round(a*100)/100;});if(Qn(s,o))continue;}n.push.apply(n,_toConsumableArray(s));}return n;}},{key:"commitDoingFaces",value:function commitDoingFaces(){var e;var _iterator61=_createForOfIteratorHelper(this.getDoingLines()),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var _step61$value=_slicedToArray(_step61.value,2),n=_step61$value[0],i=_step61$value[1];if(!((e=this.vNodes)!=null&&e.isCanClearWorkId(n))){this.changedNodes.delete(n);continue;}var s=this.vNodes.get(n);if(!(s!=null&&s.opt)||!i.length){this.changedNodes.delete(n);continue;}var o=Omt(s.opt,i),a=gp(_objectSpread(_objectSpread({},s.opt),o));delete a.eraserlines,s.opt=a,this.changedNodes.set(n,s),this.vNodes.setInfo(n,{opt:a});}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}}},{key:"renderChangedNodes",value:function renderChangedNodes(e,n){if(e)for(var _i10=0,_arr3=_toConsumableArray(this.changedNodes);_i10<_arr3.length;_i10++){var _arr3$_i=_slicedToArray(_arr3[_i10],2),i=_arr3$_i[0],s=_arr3$_i[1];var o=e.createWorkShapeNode({workId:i,toolsType:s.toolsType,toolsOpt:s.opt});o==null||o.setWorkId(i),o==null||o.setEraserDeleteConfirmation(n);var a=o==null?void 0:o.consumeService({op:s.op,isFullWork:!0,replaceId:i});this.changedRect=Kt(this.changedRect,a),n&&o!=null&&o.isDelete&&(e.removeNode(i),this.deletedNodes.add(i),this.changedNodes.delete(i));}}},{key:"commitPendingDeletions",value:function commitPendingDeletions(e){var n;var _iterator62=_createForOfIteratorHelper(this.pendingDeleteIds),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var i=_step62.value;if(!((n=this.vNodes)!=null&&n.isCanClearWorkId(i))){var _iterator63=_createForOfIteratorHelper(this.hiddenRenderNodes.get(i)||[]),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var _step63$value=_step63.value,o=_step63$value.node,a=_step63$value.display;o.setAttribute("display",a);}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}continue;}var s=this.vNodes.get(i);s&&(this.changedRect=Kt(this.changedRect,s.rect)),e==null||e.removeNode(i),this.deletedNodes.add(i),this.changedNodes.delete(i);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}this.pendingDeleteIds.clear(),this.hiddenRenderNodes.clear(),this.stopVNodeObservation();}},{key:"clearFullLayerPreview",value:function clearFullLayerPreview(e){var n;if((n=this.fullLayerPreviewGroup)==null||n.remove(),this.fullLayerPreviewGroup=void 0,!!e){var _iterator64=_createForOfIteratorHelper(this.hiddenRenderNodes.values()),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var i=_step64.value;var _iterator65=_createForOfIteratorHelper(i),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var _step65$value=_step65.value,s=_step65$value.node,o=_step65$value.display;s.setAttribute("display",o);}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}this.hiddenRenderNodes.clear(),this.pendingDeleteIds.clear();}}},{key:"startVNodeObservation",value:function startVNodeObservation(){var _this66=this;!this.vNodes||this.disposeVNodeObserver||typeof this.vNodes.observeRevision!="function"||(this.disposeVNodeObserver=this.vNodes.observeRevision(function(e,n,i){i&&(e==="add"||e==="update")&&_this66.pendingDeleteIds.has(i)&&_this66.hideRenderNodesForId(i);}));}},{key:"stopVNodeObservation",value:function stopVNodeObservation(){var e;(e=this.disposeVNodeObserver)==null||e.call(this),this.disposeVNodeObserver=void 0;}},{key:"restoreFailedDoneCandidates",value:function(){var _restoreFailedDoneCandidates=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(e,n){var s,i,_iterator66,_step66,_step66$value,o,a,u,h,_t21,_t22,_t23,_t24;return _regenerator().w(function(_context22){while(1)switch(_context22.p=_context22.n){case 0:i=!0;_iterator66=_createForOfIteratorHelper(e);_context22.p=1;_iterator66.s();case 2:if((_step66=_iterator66.n()).done){_context22.n=15;break;}_step66$value=_slicedToArray(_step66.value,2),o=_step66$value[0],a=_step66$value[1];_context22.p=3;u=gr(a);if(!((s=this.vNodes)==null||s.setInfo(o,u),!n)){_context22.n=4;break;}return _context22.a(3,14);case 4:h=n.createWorkShapeNode({workId:o,toolsType:u.toolsType,toolsOpt:u.opt});if(h){_context22.n=5;break;}i=!1;return _context22.a(3,14);case 5:h.setWorkId(o);if(!(u.toolsType===St.Image)){_context22.n=8;break;}_context22.n=6;return h.consumeServiceAsync({isFullWork:!0,replaceId:o,worker:n});case 6:_t21=_context22.v;if(_t21){_context22.n=7;break;}i=!1;case 7:_context22.n=12;break;case 8:if(!(u.toolsType===St.Text)){_context22.n=11;break;}_context22.n=9;return h.consumeServiceAsync({isFullWork:!0,replaceId:o,boxRect:n.thread.getSceneRect()});case 9:_t22=_context22.v;if(_t22){_context22.n=10;break;}i=!1;case 10:_context22.n=12;break;case 11:h.consumeService({op:u.op,isFullWork:!0,replaceId:o});case 12:_context22.n=14;break;case 13:_context22.p=13;_t23=_context22.v;i=!1,console.warn("[BitMapEraser] Failed to restore ".concat(o," after Done error:"),_t23);case 14:_context22.n=2;break;case 15:_context22.n=17;break;case 16:_context22.p=16;_t24=_context22.v;_iterator66.e(_t24);case 17:_context22.p=17;_iterator66.f();return _context22.f(17);case 18:return _context22.a(2,i);}},_callee21,this,[[3,13],[1,16,17,18]]);}));function restoreFailedDoneCandidates(_x41,_x42){return _restoreFailedDoneCandidates.apply(this,arguments);}return restoreFailedDoneCandidates;}()},{key:"computEraserPointLines",value:function computEraserPointLines(e){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:60;var i=[];var s=0;var o=360-n;for(var a=1;a<e.length;a++){var u=e[a-1],h=e[a];if(a===1&&s===0&&(i[s]=[u.XY]),i[s].push(h.XY),a<e.length-1){var v=h.getAngleByPoints(u,e[a+1]);(v<n||v>o)&&(s++,i[s]=[h.XY]);}}return e.length===1&&i.push([e[0].XY,e[0].XY]),i;}}]);}(Gt);ht(Ru,"eraserSizes",Rv);var xu=Ru;var _a=/*#__PURE__*/function(_Gt14){function _a(e){var _this67;_classCallCheck(this,_a);_this67=_callSuper(this,_a,[e]);ht(_this67,"canRotate",!1);ht(_this67,"scaleType",Ae.all);ht(_this67,"toolsType",St.BackgroundSVG);ht(_this67,"tmpPoints",[]);ht(_this67,"workOptions");ht(_this67,"oldRect");_this67.workOptions=e.toolsOpt,_this67.scaleType=_a.getScaleType(_this67.workOptions);return _this67;}_inherits(_a,_Gt14);return _createClass(_a,[{key:"consume",value:function consume(){return{type:Tt.None};}},{key:"consumeAll",value:function consumeAll(){return{type:Tt.None};}},{key:"draw",value:function draw(e){var n=e.layer,i=e.workId,s=e.replaceId,_this$workOptions15=this.workOptions,o=_this$workOptions15.centerX,a=_this$workOptions15.centerY,u=_this$workOptions15.width,h=_this$workOptions15.height,v=_this$workOptions15.rotate,p=_this$workOptions15.zIndex,y=(p||0)-100,C=new nr({anchor:[0.5,0.5],pos:[o,a],name:i,size:[u,h],zIndex:y,rotate:v}),b=new Bo({normalize:!0,pos:[0,0],width:u,height:h});C.appendChild(b),this.replace(n,s||i,C);var M=C.getBoundingClientRect();if(M)return{x:Math.floor(M.x-Gt.SafeBorderPadding),y:Math.floor(M.y-Gt.SafeBorderPadding),w:Math.floor(M.width+Gt.SafeBorderPadding*2),h:Math.floor(M.height+Gt.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(e){var o;var n=e.replaceId,i=this.workId,s=this.draw({workId:i,layer:this.fullLayer,replaceId:n});return(o=this.vNodes)==null||o.setInfo(i,{rect:s,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&Gt.getCenterPos(s,this.fullLayer)}),s;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"normalizeStorageData",value:function normalizeStorageData(e){return Gt.normalizeStorageData(e);}},{key:"getScaleType",value:function getScaleType(e){var n=e.uniformScale,i=e.rotate;return n!==!1||i&&Math.abs(i)%90>0?Ae.proportional:Ae.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(e){var n=e.node,i=e.opt,s=e.vNodes,o=e.targetNode,a=i.translate,u=i.originPoint,h=i.scenePoint,v=i.scale,p=i.angle,y=i.isLocked,C=i.zIndexForBackgroundSVG,b=o&&gr(o)||s.get(n.name);if(!b)return;var M=n.parent;if(M){if($e(C)){var L=(C||0)-100;n.setAttribute("zIndex",L),b.opt.zIndex=C;}if(Rs(y)&&(b.opt.locked=y),u&&h&&v&&a){var _b$opt=b.opt,_L14=_b$opt.centerX,X=_b$opt.centerY,Y=_b$opt.width,et=_b$opt.height,A=_b$opt.uniformScale,w=A!==!1?[v[0],v[0]]:v,S=[_L14,X],x=[_L14,X];yf(x,h,w,a);var P=[x[0]-S[0],x[1]-S[1]];b.centerPos=[b.centerPos[0]+P[0],b.centerPos[1]+P[1]],b.opt.width=Math.round(Y*w[0]),b.opt.height=Math.round(et*w[1]),b.opt.centerX=x[0],b.opt.centerY=x[1];}else if(a)b.opt.centerX=b.opt.centerX+a[0],b.opt.centerY=b.opt.centerY+a[1],b.centerPos=[b.centerPos[0]+a[0],b.centerPos[1]+a[1]];else if($e(p))if(b.opt.rotate=p,b.scaleType=_a.getScaleType(b.opt),o){var _L15=Uv(b.rect,p);b.rect=_L15;}else{var _L16=Gt.getRectFromLayer(M,n.name);b.rect=_L16||b.rect;}return b&&s.setInfo(n.name,b),b==null?void 0:b.rect;}}}]);}(Gt);function ET(r){switch(r){case St.Arrow:return sT;case St.Pencil:return eT;case St.Straight:return fT;case St.Ellipse:return oT;case St.Polygon:case St.Triangle:return cT;case St.Star:case St.Rhombus:return lT;case St.Rectangle:return aT;case St.SpeechBalloon:return uT;case St.Text:return Ja;case St.LaserPen:return rT;case St.Eraser:return wu;case St.PencilEraser:return Cu;case St.BitMapEraser:return xu;case St.Selector:return Ka;case St.Image:return Qa;case St.BackgroundSVG:return _a;}}function mf(r,t){var e=r.toolsType,n=_objectWithoutProperties(r,_excluded2);switch(e){case St.Arrow:return new sT(n);case St.Pencil:return new eT(n);case St.Straight:return new fT(n);case St.Ellipse:return new oT(n);case St.Polygon:case St.Triangle:return new cT(n);case St.Star:case St.Rhombus:return new lT(n);case St.Rectangle:return new aT(n);case St.SpeechBalloon:return new uT(n);case St.Text:return new Ja(n);case St.LaserPen:return new rT(n);case St.Eraser:return new wu(n,t);case St.BitMapEraser:return new xu(n);case St.PencilEraser:return new Cu(n);case St.Selector:return n.vNodes?new Ka(_objectSpread(_objectSpread({},n),{},{vNodes:n.vNodes,drawLayer:n.fullLayer})):void 0;case St.Image:return new Qa(n);case St.BackgroundSVG:return new _a(_objectSpread(_objectSpread({},n),{},{toolsOpt:n.toolsOpt}));default:return;}}function MT(r){var t=[],e=["PATH","SPRITE","POLYLINE","RECT","ELLIPSE","LABEL","SPRITESVG"];var _iterator67=_createForOfIteratorHelper(r),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var n=_step67.value;if(n.tagName==="GROUP"&&n.children.length){var i=MT(n.children);t.push.apply(t,_toConsumableArray(i));}n.tagName&&e.includes(n.tagName)&&t.push(n);}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}return t;}function Kt(r,t){if(r&&t){var e=Math.min(r.x,t.x),n=Math.min(r.y,t.y),i=Math.max(r.x+r.w,t.x+t.w),s=Math.max(r.y+r.h,t.y+t.h),o=i-e,a=s-n;return{x:e,y:n,w:o,h:a};}return t||r;}function Ye(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e={x:0,y:0,w:0,h:0};var n=1/0,i=1/0,s=-1/0,o=-1/0;return r.forEach(function(a){var _a$XY=_slicedToArray(a.XY,2),u=_a$XY[0],h=_a$XY[1];n=Math.min(n,u-t),i=Math.min(i,h-t),s=Math.max(s,u+t),o=Math.max(o,h+t);}),e.x=n,e.y=i,e.w=s-n,e.h=o-i,e;}function Pu(r,t){return!(r.x+r.w<t.x||r.x>t.x+t.w||r.y+r.h<t.y||r.y>t.y+t.h);}function me(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:10;return{x:Math.floor(r.x-t),y:Math.floor(r.y-t),w:Math.ceil(r.w+t*2),h:Math.ceil(r.h+t*2)};}function tl(r,t){return{x:r.x+t[0],y:r.y+t[1],w:r.w,h:r.h};}function _bt(r,t){var e=new xt(r.x,r.y),n=new xt(r.x+r.w,r.y),i=new xt(r.x+r.w,r.y+r.h),s=new xt(r.x,r.y+r.h),o=new xt(r.x+r.w/2,r.y+r.h/2),a=Math.PI*t/180,u=xt.RotWith(e,o,a),h=xt.RotWith(n,o,a),v=xt.RotWith(i,o,a),p=xt.RotWith(s,o,a);return[u,h,v,p];}function Uv(r,t){var e=_bt(r,t);return Ye(e);}function LT(r,t,e){var n=new xt(r.x,r.y),i=new xt(r.x+r.w,r.y),s=new xt(r.x+r.w,r.y+r.h),o=new xt(r.x,r.y+r.h),a=new xt(e[0],e[1]),u=new xt(t[0],t[1]),h=xt.ScaleWOrigin(n,u,a),v=xt.ScaleWOrigin(i,u,a),p=xt.ScaleWOrigin(s,u,a),y=xt.ScaleWOrigin(o,u,a);return Ye([h,v,p,y]);}function tAt(r,t,e){var n=new xt(t[0],t[1]);for(var i=0;i<r.length;i+=3){var s=new xt(r[i],r[i+1]),o=Math.PI*e/180,a=xt.RotWith(s,n,o);r[i]=a.x,r[i+1]=a.y;}}function $1(r,t,e){var n=new xt(t[0],t[1]);for(var i=0;i<r.length;i+=2){var s=new xt(r[i],r[i+1]),o=Math.PI*e/180,a=xt.RotWith(s,n,o);r[i]=a.x,r[i+1]=a.y;}}function yf(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var i=new xt(t[0],t[1]);for(var s=0;s<r.length;s+=3){var o=new xt(r[s],r[s+1]),a=new xt(e[0],e[1]),u=xt.ScaleWOrigin(o,a,i);r[s]=u.x+n[0],r[s+1]=u.y+n[1];}}function ja(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var i=new xt(t[0],t[1]);for(var s=0;s<r.length;s+=2){var o=new xt(r[s],r[s+1]),a=new xt(e[0],e[1]),u=xt.ScaleWOrigin(o,a,i);r[s]=u.x+n[0],r[s+1]=u.y+n[1];}}function eAt(r,t){return r[0]>=t.x&&r[0]<=t.x+t.w&&r[1]>=t.y&&r[1]<=t.y+t.h;}function RT(r,t){var e=r<=t?1:r/t,n=t<=r?1:t/r;return[e,n];}function rAt(r){var _iterator68=_createForOfIteratorHelper(r),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var t=_step68.value;if(isNaN(t)||t===1/0||t===-1/0)return!1;}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}return!0;}function nAt(r){return r!==Math.floor(r);}function iAt(r){var t=r.toString();return t.indexOf(".")!==-1?t.split(".")[1].length:0;}function sAt(r,t){for(;t!==0;){var _ref79=[t,r%t];r=_ref79[0];t=_ref79[1];}return r;}var oAt=function oAt(r){if(r.tagName==="GROUP"){var t=Object.getOwnPropertySymbols(r).find(function(e){return e.toString()==="Symbol(sealed)";});if(t&&r[t])return!0;}return!1;},_zr=function zr(r,t){if(r.mesh&&r.mesh.texture&&r.name==="eraserTexture"){var e=r.mesh.texture.image;t.deleteTexture(e);}else if(r.tagName==="GROUP"&&r&&r.children){var _iterator69=_createForOfIteratorHelper(r.children),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _e9=_step69.value;_zr(_e9,t);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}},Kr=function Kr(r,t){_zr(r,t),r.removeAllChildren();},aAt=function aAt(r,t,e){var n=e.parent;if(t){var i=t.children;if(i){var _iterator70=_createForOfIteratorHelper(i),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var s=_step70.value;if(_zr(s,n),s.tagName==="GROUP"){var _iterator71=_createForOfIteratorHelper(s.children),_step71;try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){var o=_step71.value;_zr(o,n);}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}}}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}}}t.parent.replaceChild(r,t);},lAt=function lAt(r,t,e){if(r.w+r.x<=0||r.h+r.y<=0||r.w<=0||r.h<=0)return;var n=t.width,i=t.height,s={x:Math.floor(Math.max(0,r.x)),y:Math.floor(Math.max(0,r.y)),w:Math.floor(Math.min(n,r.w)),h:Math.floor(Math.min(i,r.h))};if(s.x+s.w>n&&(s.w=Math.floor(n-s.x)),s.y+s.h>i&&(s.h=Math.floor(i-s.y)),nAt(e)){var o=iAt(e),a=Math.pow(10,o),u=sAt(a,e*a),h=s.x%u,v=s.x-h;v>=0?(s.x=v,s.w=s.w+h):(s.x=0,s.w=s.w+h-v);var p=s.y%u,y=s.y-p;y>=0?(s.y=y,s.h=s.h+p):(s.y=0,s.h=s.h+p-y);}return s;};function Co(r){return"".concat(bu(r.x),",").concat(bu(r.y)," ");}function xo(r,t){return"".concat(bu((r.x+t.x)/2),",").concat(bu((r.y+t.y)/2)," ");}function bu(r){return+r.toFixed(4);}var el=function el(r,t){return r.x+r.w<t.x||r.x>t.x+t.w||r.y+r.h<t.y||r.y>t.y+t.h?es.outside:r.x>=t.x&&r.y>=t.y&&r.x+r.w<=t.x+t.w&&r.y+r.h<=t.y+t.h?es.inside:es.intersect;};function cAt(r){var t=0;for(var e=0;e<r.length;e++){var n=r.charCodeAt(e);n>=1&&n<=126||65376<=n&&n<=65439?t++:t+=2;}return t;}var Y1=/*#__PURE__*/function(){function Y1(t){_classCallCheck(this,Y1);ht(this,"_map");ht(this,"_observers",/* @__PURE__ */new Set());this._map=new Map(t);}return _createClass(Y1,[{key:"notifyObservers",value:function notifyObservers(t,e,n){var _iterator72=_createForOfIteratorHelper(this._observers),_step72;try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){var i=_step72.value;i(t,e,n);}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}},{key:"observe",value:function observe(t){this._observers.add(t);}},{key:"unobserve",value:function unobserve(t){this._observers.delete(t);}},{key:"get",value:function get(t){return this._map.get(t);}},{key:"set",value:function set(t,e){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var i=this._map.has(t)?"update":"add";return this._map.set(t,e),n&&this.notifyObservers(i,t,e),this;}},{key:"has",value:function has(t){return this._map.has(t);}},{key:"delete",value:function _delete(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var n=this._map.get(t),i=this._map.delete(t);return e&&n&&this.notifyObservers("delete",t,n),i;}},{key:"clear",value:function clear(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var e=this._map.keys();if(this._map.clear(),t){var _iterator73=_createForOfIteratorHelper(e),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var n=_step73.value;this.notifyObservers("clear",n,void 0);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}}}},{key:"size",get:function get(){return this._map.size;}},{key:"keys",value:function keys(){return this._map.keys();}},{key:"values",value:function values(){return this._map.values();}},{key:"entries",value:function entries(){return this._map.entries();}},{key:"forEach",value:function forEach(t,e){this._map.forEach(t,e);}}]);}();function OT(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:r.length-1;var i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:uAt;for(;n>e;){if(n-e>600){var u=n-e+1,h=t-e+1,v=Math.log(u),p=0.5*Math.exp(2*v/3),y=0.5*Math.sqrt(v*p*(u-p)/u)*(h-u/2<0?-1:1),C=Math.max(e,Math.floor(t-h*p/u+y)),b=Math.min(n,Math.floor(t+(u-h)*p/u+y));OT(r,t,C,b,i);}var s=r[t];var o=e,a=n;for(Na(r,e,t),i(r[n],s)>0&&Na(r,e,n);o<a;){for(Na(r,o,a),o++,a--;i(r[o],s)<0;)o++;for(;i(r[a],s)>0;)a--;}i(r[e],s)===0?Na(r,e,a):(a++,Na(r,a,n)),a<=t&&(e=a+1),t<=a&&(n=a-1);}}function Na(r,t,e){var n=r[t];r[t]=r[e],r[e]=n;}function uAt(r,t){return r<t?-1:r>t?1:0;}var fAt=/*#__PURE__*/function(){function fAt(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:9;_classCallCheck(this,fAt);this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*0.4)),this.clear();}return _createClass(fAt,[{key:"all",value:function all(){return this._all(this.data,[]);}},{key:"search",value:function search(t){var e=this.data;var n=[];if(!Zc(t,e))return n;var i=this.toBBox,s=[];for(;e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],u=e.leaf?i(a):a;Zc(t,u)&&(e.leaf?n.push(a):Wd(t,u)?this._all(a,n):s.push(a));}e=s.pop();}return n;}},{key:"collides",value:function collides(t){var e=this.data;if(!Zc(t,e))return!1;var n=[];for(;e;){for(var i=0;i<e.children.length;i++){var s=e.children[i],o=e.leaf?this.toBBox(s):s;if(Zc(t,o)){if(e.leaf||Wd(t,o))return!0;n.push(s);}}e=n.pop();}return!1;}},{key:"load",value:function load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(var n=0;n<t.length;n++)this.insert(t[n]);return this;}var e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){var _n4=this.data;this.data=e,e=_n4;}this._insert(e,this.data.height-e.height-1,!0);}return this;}},{key:"insert",value:function insert(t){return t&&this._insert(t,this.data.height-1),this;}},{key:"clear",value:function clear(){return this.data=bo([]),this;}},{key:"remove",value:function remove(t,e){if(!t)return this;var n=this.data;var i=this.toBBox(t),s=[],o=[];var a,u,h;for(;n||s.length;){if(n||(n=s.pop(),u=s[s.length-1],a=o.pop(),h=!0),n.leaf){var v=hAt(t,n.children,e);if(v!==-1)return n.children.splice(v,1),s.push(n),this._condense(s),this;}!h&&!n.leaf&&Wd(n,i)?(s.push(n),o.push(a),a=0,u=n,n=n.children[0]):u?(a++,n=u.children[a],h=!1):n=null;}return this;}},{key:"toBBox",value:function toBBox(t){return t;}},{key:"compareMinX",value:function compareMinX(t,e){return t.minX-e.minX;}},{key:"compareMinY",value:function compareMinY(t,e){return t.minY-e.minY;}},{key:"toJSON",value:function toJSON(){return this.data;}},{key:"fromJSON",value:function fromJSON(t){return this.data=t,this;}},{key:"_all",value:function _all(t,e){var n=[];for(;t;)t.leaf?e.push.apply(e,_toConsumableArray(t.children)):n.push.apply(n,_toConsumableArray(t.children)),t=n.pop();return e;}},{key:"_build",value:function _build(t,e,n,i){var s=n-e+1;var o=this._maxEntries,a;if(s<=o)return a=bo(t.slice(e,n+1)),Po(a,this.toBBox),a;i||(i=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,i-1))),a=bo([]),a.leaf=!1,a.height=i;var u=Math.ceil(s/o),h=u*Math.ceil(Math.sqrt(o));G1(t,e,n,h,this.compareMinX);for(var v=e;v<=n;v+=h){var p=Math.min(v+h-1,n);G1(t,v,p,u,this.compareMinY);for(var y=v;y<=p;y+=u){var C=Math.min(y+u-1,p);a.children.push(this._build(t,y,C,i-1));}}return Po(a,this.toBBox),a;}},{key:"_chooseSubtree",value:function _chooseSubtree(t,e,n,i){for(;i.push(e),!(e.leaf||i.length-1===n);){var s=1/0,o=1/0,a=void 0;for(var u=0;u<e.children.length;u++){var h=e.children[u],v=Fd(h),p=vAt(t,h)-v;p<o?(o=p,s=v<s?v:s,a=h):p===o&&v<s&&(s=v,a=h);}e=a||e.children[0];}return e;}},{key:"_insert",value:function _insert(t,e,n){var i=n?t:this.toBBox(t),s=[],o=this._chooseSubtree(i,this.data,e,s);for(o.children.push(t),Ua(o,i);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(i,s,e);}// split overflowed node into two
|
|
485
485
|
},{key:"_split",value:function _split(t,e){var n=t[e],i=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,i);var o=this._chooseSplitIndex(n,s,i),a=bo(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Po(n,this.toBBox),Po(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a);}},{key:"_splitRoot",value:function _splitRoot(t,e){this.data=bo([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Po(this.data,this.toBBox);}},{key:"_chooseSplitIndex",value:function _chooseSplitIndex(t,e,n){var i,s=1/0,o=1/0;for(var a=e;a<=n-e;a++){var u=Wa(t,0,a,this.toBBox),h=Wa(t,a,n,this.toBBox),v=gAt(u,h),p=Fd(u)+Fd(h);v<s?(s=v,i=a,o=p<o?p:o):v===s&&p<o&&(o=p,i=a);}return i||n-e;}// sorts node children by the best axis for split
|
|
486
486
|
},{key:"_chooseSplitAxis",value:function _chooseSplitAxis(t,e,n){var i=t.leaf?this.compareMinX:dAt,s=t.leaf?this.compareMinY:pAt,o=this._allDistMargin(t,e,n,i),a=this._allDistMargin(t,e,n,s);o<a&&t.children.sort(i);}// total margin of all possible split distributions where each node is at least m full
|
|
487
487
|
},{key:"_allDistMargin",value:function _allDistMargin(t,e,n,i){t.children.sort(i);var s=this.toBBox,o=Wa(t,0,e,s),a=Wa(t,n-e,n,s);var u=Vc(o)+Vc(a);for(var h=e;h<n-e;h++){var v=t.children[h];Ua(o,t.leaf?s(v):v),u+=Vc(o);}for(var _h6=n-e-1;_h6>=e;_h6--){var _v0=t.children[_h6];Ua(a,t.leaf?s(_v0):_v0),u+=Vc(a);}return u;}},{key:"_adjustParentBBoxes",value:function _adjustParentBBoxes(t,e,n){for(var i=n;i>=0;i--)Ua(e[i],t);}},{key:"_condense",value:function _condense(t){for(var e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():Po(t[e],this.toBBox);}}]);}();function hAt(r,t,e){if(!e)return t.indexOf(r);for(var n=0;n<t.length;n++)if(e(r,t[n]))return n;return-1;}function Po(r,t){Wa(r,0,r.children.length,t,r);}function Wa(r,t,e,n,i){i||(i=bo(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var s=t;s<e;s++){var o=r.children[s];Ua(i,r.leaf?n(o):o);}return i;}function Ua(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r;}function dAt(r,t){return r.minX-t.minX;}function pAt(r,t){return r.minY-t.minY;}function Fd(r){return(r.maxX-r.minX)*(r.maxY-r.minY);}function Vc(r){return r.maxX-r.minX+(r.maxY-r.minY);}function vAt(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY));}function gAt(r,t){var e=Math.max(r.minX,t.minX),n=Math.max(r.minY,t.minY),i=Math.min(r.maxX,t.maxX),s=Math.min(r.maxY,t.maxY);return Math.max(0,i-e)*Math.max(0,s-n);}function Wd(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY;}function Zc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY;}function bo(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};}function G1(r,t,e,n,i){var s=[t,e];for(;s.length;){if(e=s.pop(),t=s.pop(),e-t<=n)continue;var o=t+Math.ceil((e-t)/n/2)*n;OT(r,o,t,e,i),s.push(t,o,o,e);}}var mAt=/*#__PURE__*/function(){function mAt(t,e){_classCallCheck(this,mAt);ht(this,"viewId");ht(this,"scene");ht(this,"fullLayer");ht(this,"curNodeMap");ht(this,"targetNodeMap",[]);ht(this,"highLevelIds");ht(this,"canClearUids");ht(this,"localUid");ht(this,"spatialIndex",new fAt());ht(this,"spatialEntries",/* @__PURE__ */new Map());ht(this,"verifySpatialIndex",!1);ht(this,"revision",0);ht(this,"revisionObservers",/* @__PURE__ */new Set());this.viewId=t,this.scene=e,this.curNodeMap=new Y1();}return _createClass(mAt,[{key:"init",value:function init(t){this.fullLayer=t;}},{key:"get",value:function get(t){return this.curNodeMap.get(t);}},{key:"getRevision",value:function getRevision(){return this.revision;}},{key:"observeRevision",value:function observeRevision(t){var _this68=this;return this.revisionObservers.add(t),function(){return _this68.revisionObservers.delete(t);};}},{key:"setLocalUid",value:function setLocalUid(t){this.localUid=t;}},{key:"getLocalUid",value:function getLocalUid(){return this.localUid;}},{key:"setSpatialIndexVerification",value:function setSpatialIndexVerification(t){this.verifySpatialIndex=t;}},{key:"setCanClearUids",value:function setCanClearUids(t){this.canClearUids=t,this.revision++,this.notifyRevisionObservers("permission");}},{key:"getCanClearUids",value:function getCanClearUids(){return this.canClearUids;}},{key:"getCanEraserNodes",value:function getCanEraserNodes(t,e){var n=/* @__PURE__ */new Map();var _iterator74=_createForOfIteratorHelper(t.entries()),_step74;try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){var _step74$value=_slicedToArray(_step74.value,2),i=_step74$value[0],s=_step74$value[1];s.toolsType!==St.BackgroundSVG&&(s.toolsType===St.Image&&s.opt.type===lf.Image&&(s.opt.locked||e&&e.disableEraseImage)||s.toolsType===St.Text&&(s.opt.workState===te.Doing||s.opt.workState===te.Start||e&&e.disableEraseText)||this.isCanClearWorkId(i)&&n.set(i,s));}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}return n;}},{key:"getNodesByType",value:function getNodesByType(t){var e=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(n,i){n.toolsType===t&&e.set(i,n);}),e;}},{key:"gethasEraserNodes",value:function gethasEraserNodes(){var t=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(e,n){var i;((i=e.opt.eraserlines)!=null&&i.length||e.opt.eraserFaces)&&t.set(n,e);}),t;}},{key:"hasRenderNodes",value:function hasRenderNodes(){return this.curNodeMap.size>0;}},{key:"has",value:function has(t){return this.curNodeMap.has(t);}},{key:"setInfo",value:function setInfo(t,e){var n=this.curNodeMap.has(t)?"update":"add",i=this.curNodeMap.get(t)||{name:t,rect:e.rect};e.rect&&(i.rect=gr(e.rect)),e.op&&rAt(e.op)&&(i.op=gr(e.op)),e.canRotate&&(i.canRotate=e.canRotate),e.scaleType&&(i.scaleType=e.scaleType),e.opt&&(i.opt=gr(e.opt)),e.toolsType&&(i.toolsType=e.toolsType),e.centerPos&&(i.centerPos=gr(e.centerPos)),Rs(e.isSelected)&&(i.isSelected=e.isSelected),i.rect?(this.curNodeMap.set(t,i),this.updateSpatialEntry(t,i.rect),this.revision++,this.notifyRevisionObservers(n,t)):this.delete(t);}},{key:"selected",value:function selected(t){this.setInfo(t,{isSelected:!0});}},{key:"unSelected",value:function unSelected(t){this.setInfo(t,{isSelected:!1});}},{key:"delete",value:function _delete(t){var e=this.curNodeMap.delete(t),n=this.spatialEntries.get(t);n&&(this.spatialIndex.remove(n),this.spatialEntries.delete(t)),e&&(this.revision++,this.notifyRevisionObservers("delete",t));}},{key:"clear",value:function clear(){var t=this.curNodeMap.size>0;this.curNodeMap.clear(),this.spatialIndex.clear(),this.spatialEntries.clear(),this.targetNodeMap.length=0,t&&(this.revision++,this.notifyRevisionObservers("clear"));}},{key:"notifyRevisionObservers",value:function notifyRevisionObservers(t,e){var _iterator75=_createForOfIteratorHelper(this.revisionObservers),_step75;try{for(_iterator75.s();!(_step75=_iterator75.n()).done;){var n=_step75.value;n(t,this.revision,e);}}catch(err){_iterator75.e(err);}finally{_iterator75.f();}}},{key:"getRectIntersectRange",value:function getRectIntersectRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var i=this.spatialIndex.search(this.toSpatialBox(t)).map(function(u){return u.key;});var s=i;if(this.verifySpatialIndex){var u=this.getLinearIntersectKeys(t),h=new Set(i);(u.length!==i.length||u.some(function(v){return!h.has(v);}))&&(console.warn("[VNodeManager] spatial index mismatch in ".concat(this.viewId,"; using linear result")),s=u);}var o;var a=/* @__PURE__ */new Map();var _iterator76=_createForOfIteratorHelper(s),_step76;try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){var _u8=_step76.value;var _h7=this.curNodeMap.get(_u8);!_h7||!Pu(t,_h7.rect)||e&&(_h7.toolsType===St.Image&&_h7.opt.locked||_h7.toolsType===St.BackgroundSVG&&_h7.opt.locked!==!1)||n&&_h7.toolsType===St.Text&&(_h7.opt.workState===te.Doing||_h7.opt.workState===te.Start)||(o=Kt(o,_h7.rect),a.set(_u8,_h7));}}catch(err){_iterator76.e(err);}finally{_iterator76.f();}return{rectRange:o,nodeRange:a};}},{key:"getNodeRectFormShape",value:function getNodeRectFormShape(t,e){var n=ET(e.toolsType);return this.fullLayer&&(n==null?void 0:n.getRectFromLayer(this.fullLayer,t));}},{key:"updateNodeRect",value:function updateNodeRect(t){var e=this.curNodeMap.get(t);if(e){var n=this.getNodeRectFormShape(t,e);if(!n){this.delete(t);return;}e.rect=n,this.curNodeMap.set(t,e),this.updateSpatialEntry(t,n);}}},{key:"updateHighLevelNodesRect",value:function updateHighLevelNodesRect(t){this.highLevelIds=t;var _iterator77=_createForOfIteratorHelper(this.highLevelIds.keys()),_step77;try{for(_iterator77.s();!(_step77=_iterator77.n()).done;){var e=_step77.value;this.updateNodeRect(e);}}catch(err){_iterator77.e(err);}finally{_iterator77.f();}}},{key:"updateLowLevelNodesRect",value:function updateLowLevelNodesRect(){var t;var _iterator78=_createForOfIteratorHelper(this.curNodeMap.keys()),_step78;try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){var e=_step78.value;(t=this.highLevelIds)!=null&&t.has(e)||this.updateNodeRect(e);}}catch(err){_iterator78.e(err);}finally{_iterator78.f();}}},{key:"clearHighLevelIds",value:function clearHighLevelIds(){this.highLevelIds=void 0;}},{key:"updateSpatialEntry",value:function updateSpatialEntry(t,e){var n=this.spatialEntries.get(t);n&&this.spatialIndex.remove(n);var i=_objectSpread({key:t},this.toSpatialBox(e));this.spatialEntries.set(t,i),this.spatialIndex.insert(i);}},{key:"toSpatialBox",value:function toSpatialBox(t){return{minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};}},{key:"getLinearIntersectKeys",value:function getLinearIntersectKeys(t){var e=[];var _iterator79=_createForOfIteratorHelper(this.curNodeMap.entries()),_step79;try{for(_iterator79.s();!(_step79=_iterator79.n()).done;){var _step79$value=_slicedToArray(_step79.value,2),n=_step79$value[0],i=_step79$value[1];Pu(t,i.rect)&&e.push(n);}}catch(err){_iterator79.e(err);}finally{_iterator79.f();}return e;}},{key:"setTargetAssignKeys",value:function setTargetAssignKeys(t){var e=new Y1();var _iterator80=_createForOfIteratorHelper(t),_step80;try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){var n=_step80.value;var i=this.curNodeMap.get(n);i&&e.set(n,gr(i));}}catch(err){_iterator80.e(err);}finally{_iterator80.f();}return this.targetNodeMap.push(gr(e)),this.targetNodeMap.length-1;}},{key:"setTarget",value:function setTarget(){var t=this.curNodeMap.keys();return this.setTargetAssignKeys(Array.from(t));}},{key:"getLastTarget",value:function getLastTarget(){return this.targetNodeMap[this.targetNodeMap.length-1];}},{key:"deleteLastTarget",value:function deleteLastTarget(){this.targetNodeMap.length&&(this.targetNodeMap.length=this.targetNodeMap.length-1);}},{key:"getTarget",value:function getTarget(t){return this.targetNodeMap[t];}},{key:"deleteTarget",value:function deleteTarget(t){this.targetNodeMap.length=t;}},{key:"clearTarget",value:function clearTarget(){this.targetNodeMap.length=0;}},{key:"isLocalWorkId",value:function isLocalWorkId(t){return t.split(Fo).length===1;}},{key:"isCanClearWorkId",value:function isCanClearWorkId(t){if(this.canClearUids===void 0||this.canClearUids===!0)return!0;if(mCt(this.canClearUids)){var e=t.split(Fo);if(e.length===1)return this.canClearUids.has("localSelf")||this.localUid&&this.canClearUids.has(this.localUid);if(e.length===2)return this.canClearUids.has(e[0]);}return!1;}}]);}();var yAt=function yAt(r,t,e,n){var i=new URL(r);return i.searchParams.set("width",t.toString()),i.searchParams.set("height",e.toString()),n&&i.searchParams.set("color",n),i.toString();};var DT=/*#__PURE__*/function(_Error){function DT(e,n){var _this69;_classCallCheck(this,DT);_this69=_callSuper(this,DT,["updateCamera timed out after ".concat(n,"ms")]);ht(_this69,"code","RENDERER_BUSINESS_TIMEOUT");ht(_this69,"business","updateCamera");ht(_this69,"cameraTaskId");ht(_this69,"elapsedMs");ht(_this69,"stage");ht(_this69,"blockingWorks");_this69.name="CameraUpdateTimeoutError",_this69.cameraTaskId=e.cameraTaskId,_this69.elapsedMs=n,_this69.stage=e.stage,_this69.blockingWorks=e.blockingWorks?_toConsumableArray(e.blockingWorks):void 0;return _this69;}_inherits(DT,_Error);return _createClass(DT);}(/*#__PURE__*/_wrapNativeSuper(Error));var wAt=/*#__PURE__*/function(_Error2){function wAt(e){var _this70;_classCallCheck(this,wAt);_this70=_callSuper(this,wAt,["updateCamera aborted because the owning renderer was destroyed"]);ht(_this70,"code","RENDERER_BUSINESS_ABORTED");ht(_this70,"business","updateCamera");ht(_this70,"cameraTaskId");ht(_this70,"stage");ht(_this70,"blockingWorks");_this70.name="CameraUpdateAbortedError",_this70.cameraTaskId=e.cameraTaskId,_this70.stage=e.stage,_this70.blockingWorks=e.blockingWorks?_toConsumableArray(e.blockingWorks):void 0;return _this70;}_inherits(wAt,_Error2);return _createClass(wAt);}(/*#__PURE__*/_wrapNativeSuper(Error));function SAt(_x43,_x44){return _SAt.apply(this,arguments);}function _SAt(){_SAt=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee119(r,t){var e,n,i,s,o,a,u,h,v,p,y,C,_args127=arguments,_t142;return _regenerator().w(function(_context127){while(1)switch(_context127.p=_context127.n){case 0:e=_args127.length>2&&_args127[2]!==undefined?_args127[2]:_Pt;n=Date.now();o=new Promise(function(b){i=b;}),a={cameraTaskId:r,startedAt:n,deadlineAt:n+e,abortPromise:o,aborted:!1,stage:"update-camera"},u=function u(){a.aborted||(a.aborted=!0,i==null||i(),s==null||s(h||new wAt(a)));};a.abort=u;p=Promise.resolve().then(function(){return t(a);});p.catch(function(){});y=new Promise(function(b,M){v=setTimeout(function(){h=new DT(a,e),u(),M(h);},e);}),C=new Promise(function(b,M){s=M;});_context127.p=1;_context127.n=2;return Promise.race([p,y,C]);case 2:_context127.n=4;break;case 3:_context127.p=3;_t142=_context127.v;throw u(),h||_t142;case 4:_context127.p=4;v!==void 0&&clearTimeout(v);return _context127.f(4);case 5:return _context127.a(2);}},_callee119,null,[[1,3,4,5]]);}));return _SAt.apply(this,arguments);}function NT(_x45,_x46,_x47){return _NT.apply(this,arguments);}function _NT(){_NT=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee120(r,t,e){return _regenerator().w(function(_context128){while(1)switch(_context128.n){case 0:r.stage=e;_context128.n=1;return Promise.race([t,r.abortPromise]);case 1:return _context128.a(2,!r.aborted);}},_callee120);}));return _NT.apply(this,arguments);}function TAt(r){return r instanceof DT||r instanceof Error&&r.code==="RENDERER_BUSINESS_TIMEOUT";}function kT(r){if(r instanceof Error||r&&_typeof(r)=="object"&&"message"in r&&typeof r.message=="string")return r.message;if(typeof r=="string")return r;try{var t=JSON.stringify(r);if(t!==void 0)return t;}catch(_unused27){}return String(r);}var BT=/*#__PURE__*/function(_Error3){function BT(e){var _e$timeoutMs;var _this71;_classCallCheck(this,BT);var n=(_e$timeoutMs=e.timeoutMs)!==null&&_e$timeoutMs!==void 0?_e$timeoutMs:Bv;_this71=_callSuper(this,BT,["".concat(e.business," timed out at ").concat(e.stage," after ").concat(n,"ms")]);ht(_this71,"code","RENDERER_BUSINESS_TIMEOUT");ht(_this71,"business");ht(_this71,"stage");ht(_this71,"elapsedMs");ht(_this71,"reported",!1);_this71.name="RendererBusinessTimeoutError",_this71.business=e.business,_this71.stage=e.stage,_this71.elapsedMs=n;return _this71;}_inherits(BT,_Error3);return _createClass(BT);}(/*#__PURE__*/_wrapNativeSuper(Error));var wf=/*#__PURE__*/function(_Error4){function wf(e,n){var _this72;_classCallCheck(this,wf);_this72=_callSuper(this,wf,[kT(e)]);ht(_this72,"code","RENDERER_BUSINESS_ERROR");ht(_this72,"business");ht(_this72,"stage");ht(_this72,"cause");ht(_this72,"reported",!1);_this72.name="RendererBusinessError",_this72.business=n.business,_this72.stage=n.stage,_this72.cause=e;return _this72;}_inherits(wf,_Error4);return _createClass(wf);}(/*#__PURE__*/_wrapNativeSuper(Error));function j1(_x48,_x49){return _j4.apply(this,arguments);}function _j4(){_j4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee121(r,t){var _t$timeoutMs;var e,n,i;return _regenerator().w(function(_context129){while(1)switch(_context129.p=_context129.n){case 0:e=(_t$timeoutMs=t.timeoutMs)!==null&&_t$timeoutMs!==void 0?_t$timeoutMs:Bv;i=new Promise(function(s,o){n=setTimeout(function(){o(new BT(_objectSpread(_objectSpread({},t),{},{timeoutMs:e})));},e);});_context129.p=1;_context129.n=2;return Promise.race([Promise.resolve(r),i]);case 2:return _context129.a(2,_context129.v);case 3:_context129.p=3;n!==void 0&&clearTimeout(n);return _context129.f(3);case 4:return _context129.a(2);}},_callee121,null,[[1,,3,4]]);}));return _j4.apply(this,arguments);}function FT(r){return r instanceof BT||r instanceof Error&&r.code==="RENDERER_BUSINESS_TIMEOUT";}function Ws(r){return FT(r)||r instanceof wf||r instanceof Error&&r.code==="RENDERER_BUSINESS_ERROR";}function Au(r,t){return Ws(r)?r:new wf(r,t);}function WT(r,t,e){var n=FT(r),i=Ws(r),s=i?r.business:t.business,o=i?r.stage:t.stage,a=n?r.elapsedMs:0,u=kT(r);return"[rendererBusiness] ".concat(n?"timeout":"failed"," viewId=").concat(e.viewId," renderer=").concat(e.renderer," business=").concat(s," stage=").concat(o," elapsedMs=").concat(a," error=").concat(u);}var IAt=/*#__PURE__*/function(){function IAt(){_classCallCheck(this,IAt);ht(this,"timer");}return _createClass(IAt,[{key:"pending",get:function get(){return this.timer!==void 0;}},{key:"schedule",value:function schedule(t,e){var _this73=this;this.timer===void 0&&(this.timer=setTimeout(function(){_this73.timer=void 0,t();},Math.max(0,e)));}},{key:"cancel",value:function cancel(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0);}}]);}();var CAt=30,UT=1e3/CAt;function xAt(r){return Math.min(Math.max(0,r),UT);}var Ud=function Ud(){return(typeof performance==="undefined"?"undefined":_typeof(performance))<"u"&&typeof performance.now=="function"?performance.now():Date.now();};var PAt=/*#__PURE__*/function(){function PAt(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1e3/30;_classCallCheck(this,PAt);ht(this,"timer");ht(this,"pending");ht(this,"resolvePending");ht(this,"activeWorkId");ht(this,"generation",0);ht(this,"lastReleaseTime",0);this.interval=t;}return _createClass(PAt,[{key:"wait",value:function wait(t){var _this74=this;if(this.activeWorkId!==t&&(this.finish(),this.activeWorkId=t),this.pending)return this.pending;var e=this.generation,n=Math.max(0,this.lastReleaseTime+this.interval-Ud());return n===0?(this.lastReleaseTime=Ud(),Promise.resolve(!0)):(this.pending=new Promise(function(i){_this74.resolvePending=i,_this74.timer=setTimeout(function(){if(_this74.timer=void 0,_this74.pending=void 0,_this74.resolvePending=void 0,e!==_this74.generation||_this74.activeWorkId!==t){i(!1);return;}_this74.lastReleaseTime=Ud(),i(!0);},n);}),this.pending);}},{key:"finish",value:function finish(t){if(t!==void 0&&this.activeWorkId!==t)return;this.generation++,this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.pending=void 0;var e=this.resolvePending;this.resolvePending=void 0,this.activeWorkId=void 0,this.lastReleaseTime=0,e==null||e(!1);}},{key:"cancel",value:function cancel(){this.finish();}}]);}();function zT(){try{return typeof OffscreenCanvas=="function"&&!!new OffscreenCanvas(1,1).getContext("2d");}catch(_unused28){return!1;}}function bAt(r){return{width:Math.max(1,Math.floor(r.width*r.dpr)),height:Math.max(1,Math.floor(r.height*r.dpr))};}function $T(r){return{Scene:sf,contextType:r,offscreen:!0,autoRender:!1,depth:!1,handleEvent:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0};}function AAt(r,t){return r?t||"webgl2":"2d";}function YT(r){var n;if(!r)return{};var t={};try{t.contextLost=((n=r.isContextLost)==null?void 0:n.call(r))||!1;}catch(_unused29){}var e;try{e=r.getParameter(r.CURRENT_PROGRAM),t.currentProgram=!!e;}catch(_unused30){}if(e){try{t.programLinked=!!r.getProgramParameter(e,r.LINK_STATUS);}catch(_unused31){}try{t.programHasUniforms=!!e.uniforms;}catch(_unused32){}}try{var i=r.getError();i!==r.NO_ERROR&&(t.glError=i);}catch(_unused33){}return t;}function EAt(r){var t,e;if(r)return r.gl||(t=r.renderer)!=null&&t.glRenderer?(e=r.renderer)!=null&&e.isWebGL2?"webgl2":"webgl":"2d";}function MAt(r,t){var e=r==null?void 0:r.canvas;if(!(r!=null&&r.gl)||!(e!=null&&e.addEventListener))return function(){};var n=!0;var i=function i(s){var o;n&&(n=!1,(o=s.preventDefault)==null||o.call(s),t(YT(r.gl),s));};return e.addEventListener("webglcontextlost",i),e.addEventListener("contextlost",i),function(){n=!1,e.removeEventListener("webglcontextlost",i),e.removeEventListener("contextlost",i);};}function LAt(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:wmt;var i=typeof OffscreenCanvas=="function",s=zT();var o;if(r&&i&&e){var h=bAt(e),v=t||new OffscreenCanvas(h.width,h.height);o=n(v,$T(r));}var a=(o==null?void 0:o.passed)===!0,u=o==null?void 0:o.actualContextType;return{offscreenCanvas:i,offscreen2d:s,webgl2:u==="webgl2"&&a,webgl:u==="webgl"&&a,contextSupported:a,programProbe:o};}function RAt(_x50,_x51){return _RAt.apply(this,arguments);}function _RAt(){_RAt=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee122(r,t){var e,n,i,s,o,a,_args130=arguments,_t143;return _regenerator().w(function(_context130){while(1)switch(_context130.n){case 0:e=_args130.length>2&&_args130[2]!==undefined?_args130[2]:Smt;n=typeof OffscreenCanvas=="function",i=zT();_t143=r&&n&&t;if(!_t143){_context130.n=2;break;}_context130.n=1;return e(void 0,$T(r));case 1:s=_context130.v;case 2:o=(s==null?void 0:s.passed)===!0,a=s==null?void 0:s.actualContextType;return _context130.a(2,{offscreenCanvas:n,offscreen2d:i,webgl2:a==="webgl2"&&o,webgl:a==="webgl"&&o,contextSupported:o,programProbe:s});}},_callee122);}));return _RAt.apply(this,arguments);}function zd(r){return r!=null&&r.programProbe?ymt(r.programProbe):!1;}function OAt(_x52,_x53){return _OAt.apply(this,arguments);}function _OAt(){_OAt=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee123(r,t){return _regenerator().w(function(_context131){while(1)switch(_context131.n){case 0:_context131.n=1;return r==null?void 0:r.flush();case 1:_context131.n=2;return Promise.all(t.map(function(e){return e.prepareRender;}));case 2:return _context131.a(2);}},_callee123);}));return _OAt.apply(this,arguments);}var X1=/*#__PURE__*/function(){function X1(t){_classCallCheck(this,X1);ht(this,"scheduledHandle");ht(this,"activeTask");ht(this,"flushTask");ht(this,"pending",!1);ht(this,"destroyed",!1);ht(this,"failure");this.options=t;}return _createClass(X1,[{key:"request",value:function request(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;if(!this.destroyed){if(this.pending=!0,t){this.cancelScheduledTask(),!this.activeTask&&!this.flushTask&&this.startTask();return;}!this.activeTask&&!this.flushTask&&this.scheduleTask();}}},{key:"flush",value:function flush(){var _this75=this;if(this.destroyed)return Promise.reject(new Error("Cannot flush a destroyed service render scheduler"));if(!this.flushTask){var t=this.flushPending();this.flushTask=t;var e=function e(){_this75.flushTask===t&&(_this75.flushTask=void 0,_this75.pending&&!_this75.destroyed&&_this75.failure===void 0&&_this75.scheduleTask());};t.then(e,e);}return this.flushTask;}},{key:"destroy",value:function destroy(){this.destroyed||(this.destroyed=!0,this.pending=!1,this.failure=void 0,this.cancelScheduledTask());}},{key:"scheduleTask",value:function scheduleTask(){var _this76=this;this.destroyed||this.scheduledHandle!==void 0||this.activeTask||this.flushTask||!this.pending||(this.scheduledHandle=this.options.schedule(function(){_this76.scheduledHandle=void 0,_this76.startTask();}));}},{key:"cancelScheduledTask",value:function cancelScheduledTask(){this.scheduledHandle!==void 0&&(this.options.cancel(this.scheduledHandle),this.scheduledHandle=void 0);}},{key:"startTask",value:function startTask(){var _this77=this;if(this.destroyed||this.activeTask||!this.pending)return this.activeTask;this.pending=!1;var t=Promise.resolve().then(function(){return _this77.options.run();}).catch(function(e){var n,i;if(!_this77.destroyed){_this77.failure===void 0&&(_this77.failure=e);try{(i=(n=_this77.options).onError)==null||i.call(n,e);}catch(_unused34){}}}).then(function(){_this77.activeTask===t&&(_this77.activeTask=void 0,_this77.pending&&!_this77.destroyed&&!_this77.flushTask&&_this77.failure===void 0&&_this77.scheduleTask());});return this.activeTask=t,t;}},{key:"flushPending",value:function(){var _flushPending=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(){var t,_t25,_t26;return _regenerator().w(function(_context23){while(1)switch(_context23.n){case 0:this.cancelScheduledTask();case 1:if(this.destroyed){_context23.n=6;break;}_t25=this.activeTask;if(!_t25){_context23.n=2;break;}_context23.n=2;return this.activeTask;case 2:if(!(this.failure!==void 0)){_context23.n=3;break;}throw this.failure;case 3:if(this.pending){_context23.n=4;break;}return _context23.a(2);case 4:t=this.startTask();_t26=t;if(!_t26){_context23.n=5;break;}_context23.n=5;return t;case 5:_context23.n=1;break;case 6:return _context23.a(2);}},_callee22,this);}));function flushPending(){return _flushPending.apply(this,arguments);}return flushPending;}()}]);}();var GT=/*#__PURE__*/function(){function GT(t,e,n){_classCallCheck(this,GT);ht(this,"viewId");ht(this,"viewGeneration");ht(this,"type");ht(this,"scene");ht(this,"fullLayer");ht(this,"vNodes");ht(this,"dpr");ht(this,"contextType");ht(this,"opt");ht(this,"cameraOpt");ht(this,"isSafari",!1);ht(this,"combinePostMsg",/* @__PURE__ */new Set());ht(this,"workerTaskId");ht(this,"protectedTask");// protected hasPriorityDraw: boolean = true;
|
|
488
|
-
ht(this,"delayPostDoneWaiter");ht(this,"activePostDoneWaiter");ht(this,"isCombiningPost",!1);ht(this,"combinePostTaskSequence",0);ht(this,"activeCombinePostTaskId");ht(this,"combinePostTransfersByTask",/* @__PURE__ */new Map());ht(this,"cacheImages",/* @__PURE__ */new Map());ht(this,"imageResolveMap",/* @__PURE__ */new Map());ht(this,"taskUpdateCameraId");ht(this,"taskUpdateCameraResolve");ht(this,"debounceUpdateCameraId");ht(this,"activeCameraSettledRender");ht(this,"activeCameraTaskContext");ht(this,"destroyed",!1);ht(this,"contextLossCleanup");var i,s;if(this.viewId=t,this.viewGeneration=e.viewGeneration,this.type=n,this.opt=e,this.dpr=e.dpr,this.contextType=this.getSupportContextType(n,(i=e==null?void 0:e.offscreenCanvasOpt)==null?void 0:i.contextType),!this.contextType)throw new Error("Sorry, your browser doesn't support canvas context type 2d or webgl");try{this.scene=this.createScene(e),this.createRenderLayer(this.scene,e);}catch(o){if(this.contextType!=="2d")this.contextType="2d",(s=this.scene)==null||s.disconnect(),this.scene=this.createScene(e),this.createRenderLayer(this.scene,e);else throw o;}this.registerContextLossListener(),this.vNodes=new mAt(t,this.scene);}return _createClass(GT,[{key:"getActualContextType",value:function getActualContextType(){var t;return EAt((t=this.fullLayer)==null?void 0:t.parent);}},{key:"registerContextLossListener",value:function registerContextLossListener(){var _this78=this;var e;var t=(e=this.fullLayer)==null?void 0:e.parent;this.contextLossCleanup=MAt(t,function(n){var _this78$viewGeneratio;if(_this78.destroyed)return;var i=_this78.getActualContextType(),s="[WorkThreadEngine] WebGL context lost; viewId=".concat(_this78.viewId,"; generation=").concat((_this78$viewGeneratio=_this78.viewGeneration)!==null&&_this78$viewGeneratio!==void 0?_this78$viewGeneratio:"unknown","; context=").concat(i||"unknown");try{_this78._post({sp:[{type:It.ReportError,viewId:_this78.viewId,viewGeneration:_this78.viewGeneration,reportString:s,reportError:"WebGL context lost",reportErrorCode:"RENDERER_RUNTIME_ERROR",reportStage:"context-lost",reportContextType:i,reportContextLost:!0,reportGlError:n.glError,reportCurrentProgram:n.currentProgram,reportProgramLinked:n.programLinked,reportProgramHasUniforms:n.programHasUniforms}]});}catch(o){console.error(s,o);}});}},{key:"removeContextLossListener",value:function removeContextLossListener(){var t;(t=this.contextLossCleanup)==null||t.call(this),this.contextLossCleanup=void 0;}},{key:"createRenderLayer",value:function createRenderLayer(t,e){var n=Jr.bufferSize.full,i=Jr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",t,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:this.viewId===Bs?n:i*2}));}},{key:"updateDpr",value:function(){var _updateDpr=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(t){return _regenerator().w(function(_context24){while(1)switch(_context24.n){case 0:this.dpr=t,this.scene.displayRatio=t;case 1:return _context24.a(2);}},_callee23,this);}));function updateDpr(_x54){return _updateDpr.apply(this,arguments);}return updateDpr;}()},{key:"getCachedImages",value:function getCachedImages(t){var e;return(e=this.cacheImages.get(t))==null?void 0:e.imageBitmap;}},{key:"getCachedImagesByWorkId",value:function getCachedImagesByWorkId(t){var _iterator81=_createForOfIteratorHelper(this.cacheImages.entries()),_step81;try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){var _step81$value=_slicedToArray(_step81.value,2),e=_step81$value[0],n=_step81$value[1];if(e===t&&n.imageBitmap)return n.imageBitmap;}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}}},{key:"deleteCachedImagesByWorkId",value:function deleteCachedImagesByWorkId(t,e){var _iterator82=_createForOfIteratorHelper(this.cacheImages.entries()),_step82;try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){var _step82$value=_slicedToArray(_step82.value,2),n=_step82$value[0],i=_step82$value[1];e&&n===e||i.workId===t&&(this.closeImageBitmap(i.imageBitmap),this.cacheImages.delete(n));}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}}},{key:"clearCacheImages",value:function clearCacheImages(){var _this79=this;this.cacheImages.forEach(function(t){return _this79.closeImageBitmap(t.imageBitmap);}),this.cacheImages.clear();}},{key:"closeImageBitmap",value:function closeImageBitmap(t){if(t)try{t.close();}catch(_unused35){}}},{key:"clearImageResolveMap",value:function clearImageResolveMap(){this.imageResolveMap.forEach(function(_ref80,n){var t=_ref80.timer,e=_ref80.resolve;t&&clearTimeout(t),e==null||e(n);}),this.imageResolveMap.clear();}},{key:"setIsSafari",value:function setIsSafari(t){this.isSafari=t;}},{key:"on",value:function(){var _on=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(t){var _this80=this;var v,p,y,C,e,n,i,s,o,a,u,h,b,_b3,M,X,_b4,_b5,_M3,L,_X7,_t27,_t28,_t29,_t30;return _regenerator().w(function(_context27){while(1)switch(_context27.p=_context27.n){case 0:if(!this.destroyed){_context27.n=1;break;}try{(v=t.imageBitmap)==null||v.close();}catch(_unused36){}return _context27.a(2);case 1:e=t.msgType,n=t.toolsType,i=t.opt,s=t.imageSrc,o=t.imageBitmap,a=t.workId,u=t.dpr,h=t.requestId;_t27=e;_context27.n=_t27===It.UpdateDpr?2:_t27===It.UpdateCamera?4:_t27===It.Destroy?8:_t27===It.CancelBitmapEraser?9:_t27===It.Clear?10:_t27===It.ServiceSyncCommit?12:_t27===It.UpdateTools?19:_t27===It.GetImageBitMap?20:23;break;case 2:_t28=$e(u);if(!_t28){_context27.n=3;break;}_context27.n=3;return this.updateDpr(u);case 3:return _context27.a(3,23);case 4:_context27.p=4;_context27.n=5;return SAt(t.cameraTaskId,/*#__PURE__*/function(){var _ref81=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(b){return _regenerator().w(function(_context25){while(1)switch(_context25.p=_context25.n){case 0:_this80.activeCameraTaskContext=b;_context25.p=1;_context25.n=2;return _this80.updateCamera(t,b);case 2:_context25.p=2;_this80.activeCameraTaskContext===b&&(_this80.activeCameraTaskContext=void 0);return _context25.f(2);case 3:return _context25.a(2);}},_callee24,null,[[1,,2,3]]);}));return function(_x56){return _ref81.apply(this,arguments);};}());case 5:_context27.n=7;break;case 6:_context27.p=6;_t29=_context27.v;throw this.cameraOpt=void 0,this.cancelCameraSettledRender(),_t29;case 7:return _context27.a(3,23);case 8:this.destroy();return _context27.a(3,23);case 9:b=(p=t.workId)==null?void 0:p.toString();b&&"abortBitmapEraser"in this.localWork&&this.localWork.abortBitmapEraser(b);return _context27.a(3,23);case 10:_context27.n=11;return this.clearAll();case 11:return _context27.a(3,23);case 12:_b3=this,M=[(y=this.fullLayer)==null?void 0:y.parent,(C=_b3.topLayer)==null?void 0:C.parent].filter(Boolean);_context27.p=13;_context27.n=14;return j1(_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(){return _regenerator().w(function(_context26){while(1)switch(_context26.n){case 0:_context26.n=1;return OAt(_this80.serviceWork,M);case 1:return _context26.a(2);}},_callee25);}))(),{business:"service-sync-commit",stage:"flush-and-prepare-render",timeoutMs:5e3});case 14:_context27.n=16;break;case 15:_context27.p=15;_t30=_context27.v;X=Au(_t30,{business:"service-sync-commit",stage:"flush-and-prepare-render"});throw this.reportRendererBusinessError(X,{business:"service-sync-commit",stage:"flush-and-prepare-render"}),X;case 16:if(!this.destroyed){_context27.n=17;break;}return _context27.a(3,23);case 17:_context27.n=18;return this.post({sp:[{type:It.ServiceSyncCommit,viewId:this.viewId,viewGeneration:this.viewGeneration,scenePath:t.scenePath,serviceSyncId:t.serviceSyncId,serviceRevision:t.serviceRevision}]});case 18:return _context27.a(3,23);case 19:if(n&&i){_b4={toolsType:n,toolsOpt:i,combineUnitTime:t.combineUnitTime,maxCombineEraserTime:t.maxCombineEraserTime};this.localWork.setToolsOpt(_b4);}return _context27.a(3,23);case 20:if(!(s&&o&&a)){_context27.n=22;break;}_b5=a.toString(),_M3=this.imageResolveMap.get(s);if(!(!_M3||_M3.requestId!==h)){_context27.n=21;break;}this.closeImageBitmap(o);return _context27.a(3,23);case 21:this.cacheImages.set(s,{imageBitmap:o,workId:_b5});L=_M3.resolve,_X7=_M3.timer;_X7&&clearTimeout(_X7),L&&L(s),this.deleteCachedImagesByWorkId(_b5,s);case 22:return _context27.a(3,23);case 23:return _context27.a(2);}},_callee26,this,[[13,15],[4,6]]);}));function on(_x55){return _on.apply(this,arguments);}return on;}()},{key:"getIconSize",value:function getIconSize(t,e,n){var i=t*n,s=e*n;return i<=50||s<=50?[50,50]:i<=100||s<=100?[100,100]:i<=200||s<=200?[200,200]:i<=400||s<=400?[400,400]:i<=800||s<=800?[800,800]:[1600,1600];}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(t){var _this81=this;var e,n,i,s,o,a,u,h,v,p,y,C,_this$getIconSize,_this$getIconSize2,et,A,_et4,M,L,X,Y;return _regenerator().w(function(_context28){while(1)switch(_context28.n){case 0:e=t.toolsType,n=t.opt,i=t.workId,s=t.isSubWorker,o=t.requestId;if(!(e===St.Image&&n&&i)){_context28.n=6;break;}a=i.toString(),u=n.src,h=n.type,v=n.width,p=n.height,y=n.strokeColor;if(!(!u||!h||!v||!p)){_context28.n=1;break;}return _context28.a(2);case 1:C=u;if(h===lf.Iconify){_this$getIconSize=this.getIconSize(v,p,this.dpr),_this$getIconSize2=_slicedToArray(_this$getIconSize,2),et=_this$getIconSize2[0],A=_this$getIconSize2[1];C=yAt(u,et,A,y);}if(!this.cacheImages.has(C)){_context28.n=2;break;}_et4=this.getCachedImages(C);if(!_et4){_context28.n=2;break;}return _context28.a(2,_et4);case 2:M=this.imageResolveMap.get(C);if(!M){_context28.n=4;break;}_context28.n=3;return M.promise;case 3:return _context28.a(2,this.getCachedImages(C));case 4:X=new Promise(function(et){L=et;}),Y={resolve:L,timer:void 0,requestId:o,promise:X};Y.timer=setTimeout(function(){_this81.imageResolveMap.get(C)===Y&&L(C);},5e3);this.imageResolveMap.set(C,Y);this._post({sp:[{imageSrc:C,workId:a,viewId:this.viewId,isgl:!!this.fullLayer.parent.gl,isSubWorker:s,requestId:o,type:It.GetImageBitMap}]});_context28.n=5;return X;case 5:this.imageResolveMap.get(C)===Y&&this.imageResolveMap.delete(C);return _context28.a(2,this.getCachedImages(C));case 6:return _context28.a(2);}},_callee27,this);}));function loadImageBitMap(_x57){return _loadImageBitMap.apply(this,arguments);}return loadImageBitMap;}()},{key:"createLocalWork",value:function createLocalWork(t){var e=t.workId,n=t.opt,i=t.toolsType;e&&n&&(!this.localWork.getToolsOpt()&&i&&this.setToolsOpt({toolsType:i,toolsOpt:n}),this.setWorkOpt({workId:e,toolsOpt:n}));}},{key:"updateScene",value:function updateScene(t,e,n){t.attr(_objectSpread({},e));var i=e.width,s=e.height;t.container.width=i,t.container.height=s,t.width=i,t.height=s,this.updateLayer({width:i,height:s},n);}},{key:"updateLayer",value:function updateLayer(t,e){var n=t.width,i=t.height,s=e||this.fullLayer;s&&(s.parent.setAttribute("width",n),s.parent.setAttribute("height",i),s.setAttribute("size",[n,i]),s.setAttribute("pos",[n*0.5,i*0.5]));}},{key:"getSupportContextType",value:function getSupportContextType(t,e){return AAt(t===Eu.Full&&this.viewId===Bs,e);}},{key:"createScene",value:function createScene(t){var e=t.offscreenCanvasOpt,n=e.width,i=e.height,s=new OffscreenCanvas(n,i);e.contextType&&delete e.contextType;var o=new sf(_objectSpread(_objectSpread({container:s,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},e),{},{contextType:this.contextType,id:this.viewId}));return o.setAttribute("id",this.viewId),o;}},{key:"createLayer",value:function createLayer(t,e,n,i){var s="offscreen-".concat(t),o=n.width,a=n.height;i&&(n.offscreen=!0,n.canvas=i);var u=e.layer(s,n),h=new nr({anchor:[0.5,0.5],pos:[o*0.5,a*0.5],size:[o,a],name:"viewport",id:t});return u.append(h),h;}},{key:"clearAll",value:function(){var _clearAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(){var t;return _regenerator().w(function(_context29){while(1)switch(_context29.n){case 0:this.fullLayer&&(this.fullLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.fullLayer,this.fullLayer.parent)),this.cancelCameraBlockingWait(),this.cancelCameraSettledRender(),this.clearCacheImages(),this.clearImageResolveMap(),this.localWork.destroy(),(t=this.serviceWork)==null||t.clearAll();case 1:return _context29.a(2);}},_callee28,this);}));function clearAll(){return _clearAll.apply(this,arguments);}return clearAll;}()},{key:"setToolsOpt",value:function setToolsOpt(t){this.localWork.setToolsOpt(t);}},{key:"setWorkOpt",value:function setWorkOpt(t){var e=t.workId,n=t.toolsOpt;e&&n&&this.localWork.setWorkOptions(e.toString(),n);}},{key:"destroy",value:function destroy(){var _this82=this;var n,i;if(this.destroyed)return;this.destroyed=!0,(i=(n=this.activeCameraTaskContext)==null?void 0:n.abort)==null||i.call(n),this.activeCameraTaskContext=void 0;var t=[],e=function e(s,o){try{o();}catch(a){t.push("".concat(s,": ").concat(a instanceof Error?a.message:String(a)));}};e("context-loss-listener",function(){return _this82.removeContextLossListener();}),e("camera-blocking-wait",function(){return _this82.cancelCameraBlockingWait();}),e("camera-render",function(){return _this82.cancelCameraSettledRender();}),e("worker-task",function(){_this82.workerTaskId!==void 0&&(clearTimeout(_this82.workerTaskId),_this82.workerTaskId=void 0);}),e("post-waiters",function(){var s,o;(s=_this82.delayPostDoneWaiter)==null||s.resolve(),(o=_this82.activePostDoneWaiter)==null||o.resolve(),_this82.delayPostDoneWaiter=void 0,_this82.activePostDoneWaiter=void 0;}),e("post-transfers",function(){_this82.activeCombinePostTaskId=void 0,_this82.combinePostTaskSequence++;for(var _i11=0,_arr4=_toConsumableArray(_this82.combinePostTransfersByTask.keys());_i11<_arr4.length;_i11++){var s=_arr4[_i11];_this82.releaseCombinePostTransfers(s);}_this82.combinePostMsg.clear();}),e("v-nodes",function(){return _this82.vNodes.clear();}),e("full-layer",function(){var s=_this82.fullLayer.parent;s&&_zr(_this82.fullLayer,s),_this82.fullLayer.remove();}),e("image-cache",function(){return _this82.clearCacheImages();}),e("image-waiters",function(){return _this82.clearImageResolveMap();}),e("scene",function(){return _this82.scene.remove();}),e("local-work",function(){return _this82.localWork.destroy();}),e("service-work",function(){var s;return(s=_this82.serviceWork)==null?void 0:s.destroy();}),t.length&&console.error("[WorkThreadEngine]: destroy completed with cleanup errors viewId=".concat(this.viewId,": ").concat(t.join("; ")));}},{key:"cancelCameraSettledRender",value:function cancelCameraSettledRender(){var e;this.debounceUpdateCameraId!==void 0&&(clearTimeout(this.debounceUpdateCameraId),this.debounceUpdateCameraId=void 0);var t=this.activeCameraSettledRender;t&&(t.cancelled=!0,(e=t.renderLayers)==null||e.forEach(function(n){return n.cancelPendingRender();}),this.activeCameraSettledRender=void 0);}},{key:"retargetCameraSettledRender",value:function retargetCameraSettledRender(t){var n;if(!$e(t))return!1;var e=this.activeCameraSettledRender;return!e||e.cancelled||(n=e.context)!=null&&n.aborted?!1:(e.cameraTaskId=t,!0);}},{key:"hasCameraSettledRender",value:function hasCameraSettledRender(){return!!this.activeCameraSettledRender;}},{key:"cancelCameraBlockingWait",value:function cancelCameraBlockingWait(){this.taskUpdateCameraId!==void 0&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0);var t=this.taskUpdateCameraResolve;this.taskUpdateCameraResolve=void 0,t==null||t(!1);}},{key:"startCameraSettledRender",value:function startCameraSettledRender(t,e){var _this83=this;var n={cancelled:!1,cameraTaskId:t,context:e};return this.activeCameraSettledRender=n,{isActive:function isActive(){return!_this83.destroyed&&!n.cancelled&&_this83.activeCameraSettledRender===n&&!(e!=null&&e.aborted);},getCameraTaskId:function getCameraTaskId(){return n.cameraTaskId;},setRenderLayers:function setRenderLayers(i){n.renderLayers=i;},finish:function finish(){n.renderLayers=void 0,_this83.activeCameraSettledRender===n&&(_this83.activeCameraSettledRender=void 0);}};}},{key:"post",value:function post(t){var _this84=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i;if(this.destroyed)return(i=t.render)==null||i.forEach(function(s){return _this84.closeImageBitmap(s.imageBitmap);}),Promise.resolve();this.combinePostMsg.add(t);var n=this.type===Eu.Full?this.getOrCreatePostDoneWaiter(e.reportFailureAtRendererBoundary!==!1):void 0;return this.runBatchPostData(),n?(n.promise.catch(function(){}),n.promise):Promise.resolve();}},{key:"getOrCreatePostDoneWaiter",value:function getOrCreatePostDoneWaiter(t){if(this.delayPostDoneWaiter)t||(this.delayPostDoneWaiter.reportFailureAtRendererBoundary=!1);else{var e,n;var i=new Promise(function(s,o){e=s,n=o;});this.delayPostDoneWaiter={promise:i,resolve:e,reject:n,reportFailureAtRendererBoundary:t};}return this.delayPostDoneWaiter;}},{key:"runBatchPostData",value:function runBatchPostData(){var _this85=this;this.destroyed||!this.workerTaskId&&!this.isCombiningPost&&(this.workerTaskId=setTimeout(function(){_this85.workerTaskId=void 0;var t=_this85.delayPostDoneWaiter;_this85.delayPostDoneWaiter=void 0,_this85.activePostDoneWaiter=t,_this85.isCombiningPost=!0;var e=++_this85.combinePostTaskSequence;_this85.activeCombinePostTaskId=e,_this85.combinePostTransfersByTask.set(e,/* @__PURE__ */new Set()),_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(){var n,i,o,_t31;return _regenerator().w(function(_context30){while(1)switch(_context30.p=_context30.n){case 0:n=!1;_context30.p=1;_context30.n=2;return _this85.waitForRendererBusiness(_this85.combinePost(e),{business:"combine-post",stage:"flush"});case 2:_context30.n=4;break;case 3:_context30.p=3;_t31=_context30.v;n=!0;o=Au(_t31,{business:"combine-post",stage:"flush"});i=o,(t==null?void 0:t.reportFailureAtRendererBoundary)!==!1&&_this85.reportRendererBusinessError(o,{business:"combine-post",stage:"flush"});case 4:_context30.p=4;_this85.releaseCombinePostTransfers(e),_this85.activePostDoneWaiter===t&&(_this85.activePostDoneWaiter=void 0),_this85.activeCombinePostTaskId===e&&(_this85.activeCombinePostTaskId=void 0),_this85.isCombiningPost=!1,_this85.combinePostMsg.size&&_this85.runBatchPostData();return _context30.f(4);case 5:n?t==null||t.reject(i):t==null||t.resolve();case 6:return _context30.a(2);}},_callee29,null,[[1,3,4,5]]);}))();},16));}},{key:"waitForRendererBusiness",value:function waitForRendererBusiness(t,e){return j1(t,e);}},{key:"reportRendererBusinessError",value:function reportRendererBusinessError(t,e){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(Ws(t)&&t.reported)return;var i=WT(t,e,{viewId:this.viewId,renderer:this.type});Ws(t)&&(t.reported=!0);try{this._post({sp:[{type:It.ReportError,viewId:this.viewId,viewGeneration:this.viewGeneration,reportString:i,reportErrorCode:n?"RENDERER_RUNTIME_ERROR":void 0,reportStage:e.stage,reportError:t instanceof Error?t.message:String(t)}]});}catch(s){console.error(i,s);}}},{key:"isCombinePostTaskActive",value:function isCombinePostTaskActive(t){return this.activeCombinePostTaskId===t;}},{key:"trackCombinePostTransfer",value:function trackCombinePostTransfer(t,e){var n=this.combinePostTransfersByTask.get(t);return!n||!this.isCombinePostTaskActive(t)?(this.closeCombinePostTransfers([e]),!1):(n.add(e),!0);}},{key:"commitCombinePostTransfers",value:function commitCombinePostTransfers(t){this.combinePostTransfersByTask.delete(t);}},{key:"releaseCombinePostTransfers",value:function releaseCombinePostTransfers(t){var e=this.combinePostTransfersByTask.get(t);e&&(this.combinePostTransfersByTask.delete(t),this.closeCombinePostTransfers(_toConsumableArray(e)));}},{key:"closeCombinePostTransfers",value:function closeCombinePostTransfers(t){var _iterator83=_createForOfIteratorHelper(t||[]),_step83;try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){var e=_step83.value;var n=e.close;if(typeof n=="function")try{n.call(e);}catch(_unused37){}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}}},{key:"transferLayerToImageBitmap",value:function transferLayerToImageBitmap(t){var e=this.getLayer(t),n=e==null?void 0:e.parent;if(!(n instanceof xi))throw new Error("render Layer is unavailable: ".concat(String(t)));return n.transferToImageBitmap();}},{key:"combinePostData",value:function combinePostData(){var h,v;var t=this.combinePostMsg;this.combinePostMsg=/* @__PURE__ */new Set();var e=[],n=[];var i,s,o,a;var u=/* @__PURE__ */new Set();var _iterator84=_createForOfIteratorHelper(t.values()),_step84;try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){var p=_step84.value;if((h=p.render)!=null&&h.length){var _iterator85=_createForOfIteratorHelper(p.render),_step85;try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){var y=_step85.value;var C=!1;if(y.workId&&u.add(y.workId),y.viewId||(y.viewId=this.viewId),y.viewGeneration===void 0&&(y.viewGeneration=this.viewGeneration),y.isClearAll&&(y.rect=this.getSceneRect(),y.isClear=!0,delete y.isClearAll),y.drawCanvas){var b=this.getLayer(y.drawCanvas);if(!b||!(b.parent instanceof xi))continue;if(b.parent.render(),y.isDrawAll){var M=this.getSceneRect();y.rect=M,delete y.isDrawAll;}}var _iterator86=_createForOfIteratorHelper(e),_step86;try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){var _b6=_step86.value;if(y.viewId===_b6.viewId&&y.eraseTxnId===_b6.eraseTxnId){y.isClear&&_b6.clearCanvas&&_b6.isClear&&_b6.clearCanvas===y.clearCanvas&&(_b6.rect=Kt(_b6.rect,y.rect),C=!0),_b6.drawCanvas&&_b6.drawCanvas===y.drawCanvas&&(_b6.rect=Kt(_b6.rect,y.rect),C=!0);continue;}}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}C||(y.isClear&&!y.drawCanvas?e.unshift(y):e.push(y));}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}}if((v=p.sp)!=null&&v.length){var _iterator87=_createForOfIteratorHelper(p.sp),_step87;try{for(_iterator87.s();!(_step87=_iterator87.n()).done;){var _y3$viewGeneration;var _y3=_step87.value;var _C3=_objectSpread(_objectSpread({},_y3),{},{viewId:_y3.viewId||this.viewId,viewGeneration:(_y3$viewGeneration=_y3.viewGeneration)!==null&&_y3$viewGeneration!==void 0?_y3$viewGeneration:this.viewGeneration});var _b7=!1;var _iterator88=_createForOfIteratorHelper(n),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var _M4=_step88.value;if(Qn(_C3,_M4)){_b7=!0;break;}}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}_b7||n.push(_C3);}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}}$e(p.fullWorkerDrawCount)&&(i=p.fullWorkerDrawCount),$e(p.subWorkerDrawCount)&&(s=p.subWorkerDrawCount),$e(p.consumeCount)&&(o=p.consumeCount,a=p.consumeWorkId);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}return{render:e,sp:n,fullWorkerDrawCount:i,subWorkerDrawCount:s,consumeCount:o,consumeWorkId:a,workIds:u,viewId:this.viewId,viewGeneration:this.viewGeneration};}},{key:"getSceneRect",value:function getSceneRect(){var _this$scene=this.scene,t=_this$scene.width,e=_this$scene.height;return{x:0,y:0,w:Math.floor(t),h:Math.floor(e)};}}]);}();var zv=/*#__PURE__*/function(){function zv(t){_classCallCheck(this,zv);ht(this,"viewId");ht(this,"vNodes");ht(this,"thread");ht(this,"fullLayer");ht(this,"drawLayer");ht(this,"_post");ht(this,"tmpOpt");ht(this,"workShapes",/* @__PURE__ */new Map());ht(this,"drawCount",0);ht(this,"consumeCount",0);ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"combineUnitTime",Jr.bezier.combineUnitTime);ht(this,"maxCombineEraserTime",UT);ht(this,"eraserBatchScheduler",new IAt());ht(this,"drawAckBackpressure",new PAt());this.thread=t.thread,this.viewId=t.viewId,this.vNodes=t.vNodes,this.fullLayer=t.fullLayer,this.drawLayer=t.drawLayer,this._post=this.thread.post.bind(t.thread);}return _createClass(zv,[{key:"eraserBatchDelay",get:function get(){return xAt(this.maxCombineEraserTime);}},{key:"setmaxCombineEraserTime",value:function setmaxCombineEraserTime(t){this.maxCombineEraserTime=t;}},{key:"setCombineUnitTime",value:function setCombineUnitTime(t){this.combineUnitTime=t;}},{key:"setSyncUnitTime",value:function setSyncUnitTime(t){this.syncUnitTime=t;}},{key:"destroy",value:function destroy(){this.eraserBatchScheduler.cancel(),this.drawAckBackpressure.cancel(),this.workShapes.forEach(function(t){return t.clearTmpPoints();}),this.workShapes.clear();}},{key:"getWorkShapes",value:function getWorkShapes(){return this.workShapes;}},{key:"getWorkShape",value:function getWorkShape(t){return this.workShapes.get(t);}},{key:"createWorkShape",value:function createWorkShape(t,e){if(t&&this.tmpOpt){var n={toolsType:this.tmpOpt.toolsType,toolsOpt:e||this.tmpOpt.toolsOpt},i=this.createWorkShapeNode(_objectSpread(_objectSpread({},n),{},{workId:t}));i&&this.workShapes.set(t,i);}}},{key:"setWorkOptions",value:function setWorkOptions(t,e){var n=this.getWorkShape(t);n||this.createWorkShape(t,e),n==null||n.setWorkOptions(e);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(t){var e;return mf(_objectSpread(_objectSpread({},t),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(e=this.thread)==null?void 0:e.serviceWork);}},{key:"setToolsOpt",value:function setToolsOpt(t){var e,n,i;((e=this.tmpOpt)==null?void 0:e.toolsType)!==t.toolsType&&(n=this.tmpOpt)!=null&&n.toolsType&&this.clearAllWorkShapesCache(),this.tmpOpt=t,(i=t.toolsOpt)!=null&&i.syncUnitTime&&(this.syncUnitTime=t.toolsOpt.syncUnitTime),t.combineUnitTime&&(this.combineUnitTime=t.combineUnitTime),t.maxCombineEraserTime&&(this.maxCombineEraserTime=t.maxCombineEraserTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"clearWorkShapeNodeCache",value:function clearWorkShapeNodeCache(t){var e;(e=this.getWorkShape(t))==null||e.clearTmpPoints(),this.workShapes.delete(t);}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.eraserBatchScheduler.cancel(),this.drawAckBackpressure.cancel();var _iterator89=_createForOfIteratorHelper(this.workShapes),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var _step89$value=_slicedToArray(_step89.value,2),t=_step89$value[0],e=_step89$value[1];t!==De&&(e.clearTmpPoints(),this.workShapes.delete(t));}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}},{key:"setFullWork",value:function setFullWork(t){var e=t.workId,n=t.opt,i=t.toolsType;if(e&&n&&i){var s=e.toString();var o;return e&&this.workShapes.has(s)?(o=this.workShapes.get(s),(o==null?void 0:o.toolsType)!==i?(o==null||o.clearTmpPoints(),this.workShapes.delete(s),o=void 0):o==null||o.setWorkOptions(n)):o=this.createWorkShapeNode({toolsOpt:n,toolsType:i,workId:s}),o||(o=this.createWorkShapeNode({toolsOpt:n,toolsType:i,workId:s})),o?(this.workShapes.set(s,o),o):void 0;}}}]);}();function DAt(r){return r;}var jT=DAt;function NAt(r,t,e){switch(e.length){case 0:return r.call(t);case 1:return r.call(t,e[0]);case 2:return r.call(t,e[0],e[1]);case 3:return r.call(t,e[0],e[1],e[2]);}return r.apply(t,e);}var kAt=NAt,BAt=kAt,H1=Math.max;function FAt(r,t,e){return t=H1(t===void 0?r.length-1:t,0),function(){for(var n=arguments,i=-1,s=H1(n.length-t,0),o=Array(s);++i<s;)o[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=e(o),BAt(r,this,a);};}var WAt=FAt;function UAt(r){return function(){return r;};}var zAt=UAt,$At=zAt,V1=M2,YAt=jT,GAt=V1?function(r,t){return V1(r,"toString",{configurable:!0,enumerable:!1,value:$At(t),writable:!0});}:YAt,jAt=GAt,XAt=800,HAt=16,VAt=Date.now;function ZAt(r){var t=0,e=0;return function(){var n=VAt(),i=HAt-(n-e);if(e=n,i>0){if(++t>=XAt)return arguments[0];}else t=0;return r.apply(void 0,arguments);};}var qAt=ZAt,KAt=jAt,QAt=qAt,JAt=QAt(KAt),_At=JAt,tEt=jT,eEt=WAt,rEt=_At;function nEt(r,t){return rEt(eEt(r,t,tEt),r+"");}var iEt=nEt;function sEt(r,t,e,n){for(var i=r.length,s=e+(n?1:-1);n?s--:++s<i;)if(t(r[s],s,r))return s;return-1;}var oEt=sEt;function aEt(r){return r!==r;}var lEt=aEt;function cEt(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1;}var uEt=cEt,fEt=oEt,hEt=lEt,dEt=uEt;function pEt(r,t,e){return t===t?dEt(r,t,e):fEt(r,hEt,e);}var vEt=pEt,gEt=vEt;function mEt(r,t){var e=r==null?0:r.length;return!!e&&gEt(r,t,0)>-1;}var XT=mEt;function yEt(r,t,e){for(var n=-1,i=r==null?0:r.length;++n<i;)if(e(t,r[n]))return!0;return!1;}var HT=yEt;function wEt(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++e<n;)i[e]=t(r[e],e,r);return i;}var SEt=wEt,TEt=Dv,IEt=XT,CEt=HT,xEt=SEt,PEt=pf,bEt=Nv,AEt=200;function EEt(r,t,e,n){var i=-1,s=IEt,o=!0,a=r.length,u=[],h=t.length;if(!a)return u;e&&(t=xEt(t,PEt(e))),n?(s=CEt,o=!1):t.length>=AEt&&(s=bEt,o=!1,t=new TEt(t));t:for(;++i<a;){var v=r[i],p=e==null?v:e(v);if(v=n||v!==0?v:0,o&&p===p){for(var y=h;y--;)if(t[y]===p)continue t;u.push(v);}else s(t,p,n)||u.push(v);}return u;}var MEt=EEt,Z1=vl,LEt=D2,REt=ml,q1=Z1?Z1.isConcatSpreadable:void 0;function OEt(r){return REt(r)||LEt(r)||!!(q1&&r&&r[q1]);}var DEt=OEt,NEt=Ev,kEt=DEt;function VT(r,t,e,n,i){var s=-1,o=r.length;for(e||(e=kEt),i||(i=[]);++s<o;){var a=r[s];t>0&&e(a)?t>1?VT(a,t-1,e,n,i):NEt(i,a):n||(i[i.length]=a);}return i;}var BEt=VT;function FEt(){}var WEt=FEt,$d=j2,UEt=WEt,zEt=kv,$Et=1/0,YEt=$d&&1/zEt(new $d([,-0]))[1]==$Et?function(r){return new $d(r);}:UEt,GEt=YEt,jEt=Dv,XEt=XT,HEt=HT,VEt=Nv,ZEt=GEt,qEt=kv,KEt=200;function QEt(r,t,e){var n=-1,i=XEt,s=r.length,o=!0,a=[],u=a;if(e)o=!1,i=HEt;else if(s>=KEt){var h=t?null:ZEt(r);if(h)return qEt(h);o=!1,i=VEt,u=new jEt();}else u=t?[]:a;t:for(;++n<s;){var v=r[n],p=t?t(v):v;if(v=e||v!==0?v:0,o&&p===p){for(var y=u.length;y--;)if(u[y]===p)continue t;t&&u.push(p),a.push(v);}else i(u,p,e)||(u!==a&&u.push(p),a.push(v));}return a;}var JEt=QEt,_Et=MEt,tMt=BEt,K1=JEt;function eMt(r,t,e){var n=r.length;if(n<2)return n?K1(r[0]):[];for(var i=-1,s=Array(n);++i<n;)for(var o=r[i],a=-1;++a<n;)a!=i&&(s[i]=_Et(s[i]||o,r[a],t,e));return K1(tMt(s,1),t,e);}var rMt=eMt,nMt=xv,iMt=Mi;function sMt(r){return iMt(r)&&nMt(r);}var oMt=sMt,aMt=W2,lMt=iEt,cMt=rMt,uMt=oMt,fMt=lMt(function(r){return cMt(aMt(r,uMt));}),hMt=fMt;var dMt=/* @__PURE__ */$n(hMt);var ZT=/*#__PURE__*/function(_zv){function ZT(e){var _this86;_classCallCheck(this,ZT);_this86=_callSuper(this,ZT,[e]);ht(_this86,"_type","full");ht(_this86,"combineTimerId");ht(_this86,"combineDrawResolve");ht(_this86,"combineDrawActiveId");ht(_this86,"disposeVNodeRevisionObserver");ht(_this86,"bitmapEraserRenderQueue",Promise.resolve());ht(_this86,"bitmapEraserRevalidationQueued",!1);ht(_this86,"drawWorkActiveId");ht(_this86,"effectSelectNodeData",/* @__PURE__ */new Set());_this86.disposeVNodeRevisionObserver=_this86.vNodes.observeRevision(function(){_this86.scheduleActiveBitmapEraserRevalidation();});return _this86;}/** Stop queued Bitmap Eraser work and restore Doing-time hidden nodes. */_inherits(ZT,_zv);return _createClass(ZT,[{key:"abortBitmapEraser",value:function abortBitmapEraser(e){var n=this.workShapes.get(e);(n==null?void 0:n.toolsType)===St.BitMapEraser&&(n.clearTmpPoints(),this.workShapes.delete(e),this.combineDrawActiveId===e&&(this.combineDrawActiveId=void 0),this.drawWorkActiveId===e&&(this.drawWorkActiveId=void 0),this.bitmapEraserRenderQueue=Promise.resolve());}},{key:"scheduleActiveBitmapEraserRevalidation",value:function scheduleActiveBitmapEraserRevalidation(){var _this87=this;var e=this.combineDrawActiveId;if(!e)return;var n=this.getWorkShape(e);(n==null?void 0:n.toolsType)!==St.BitMapEraser||!n.shouldRevalidateVNodeRevision()||this.bitmapEraserRevalidationQueued||(this.bitmapEraserRevalidationQueued=!0,this.enqueueBitmapEraserRender(e).catch(function(i){_this87.thread.reportRendererBusinessError(i,{business:"bitmap-eraser",stage:"revision-revalidation:".concat(e)});}).finally(function(){_this87.bitmapEraserRevalidationQueued=!1;}));}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(e){return _regenerator().w(function(_context31){while(1)switch(_context31.n){case 0:_context31.n=1;return this.thread.loadImageBitMap(e);case 1:return _context31.a(2,_context31.v);}},_callee30,this);}));function loadImageBitMap(_x58){return _loadImageBitMap2.apply(this,arguments);}return loadImageBitMap;}()},{key:"consumeDraw",value:function(){var _consumeDraw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(e,n){var _this88=this;var i,s,o,a,u,h,v,p,C,y,_t32,_t33,_t34,_t35,_t36;return _regenerator().w(function(_context32){while(1)switch(_context32.n){case 0:i=e.op,s=e.workId,o=e.scenePath,a=e.postCount,u=e.smoothSync;if(!(i!=null&&i.length&&s)){_context32.n=17;break;}h=s.toString(),v=this.getWorkShape(h);if(v){_context32.n=1;break;}return _context32.a(2);case 1:p=v.toolsType;if(!(p===St.LaserPen)){_context32.n=2;break;}return _context32.a(2);case 2:if(!(this.combineDrawActiveId&&this.combineDrawActiveId!==h)){_context32.n=3;break;}C=this.combineDrawActiveId;this.eraserBatchScheduler.cancel();this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);_context32.n=3;return this.consumeDrawAll({workId:C,scenePath:o,viewId:this.viewId,msgType:It.DrawWork,dataType:Qt.Local},n);case 3:_t32=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_t32){_context32.n=5;break;}_context32.n=4;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:o,viewId:this.viewId,msgType:It.DrawWork,dataType:Qt.Local},n);case 4:this.drawWorkActiveId=void 0;case 5:!this.drawWorkActiveId&&h!==De&&(this.drawWorkActiveId=h);$e(a)&&(this.consumeCount=a);y=v.consume({data:e,isFullWork:!0,smoothSync:u});_t33=p;_context32.n=_t33===St.Selector?6:_t33===St.PencilEraser?8:_t33===St.BitMapEraser?9:_t33===St.Eraser?11:_t33===St.Arrow?13:_t33===St.Straight?13:_t33===St.Ellipse?13:_t33===St.Rectangle?13:_t33===St.Star?13:_t33===St.Polygon?13:_t33===St.SpeechBalloon?13:_t33===St.Pencil?15:17;break;case 6:_t34=y.type===It.Select;if(!_t34){_context32.n=7;break;}y.selectIds&&n.runReverseSelectWork(y.selectIds);_context32.n=7;return this.drawSelector(_objectSpread(_objectSpread({},y),{},{scenePath:o,isSelecting:!0}),e.workState||te.Doing);case 7:return _context32.a(3,17);case 8:this.drawCount++,this.combineDrawActiveId=h,this.eraserBatchScheduler.schedule(function(){_this88.drawPencilEraserCombine(h,_this88.drawCount,e.needUndoTicker,e.collectUndoTicker);},this.eraserBatchDelay);return _context32.a(3,17);case 9:this.drawCount++;this.combineDrawActiveId=h;_context32.n=10;return this.enqueueBitmapEraserRender(h,this.drawCount,e.needUndoTicker,e.collectUndoTicker,{consumeCount:this.consumeCount,consumeWorkId:h});case 10:return _context32.a(3,17);case 11:_context32.n=12;return this.drawEraser(y,void 0,e.needUndoTicker,e.collectUndoTicker);case 12:return _context32.a(3,17);case 13:_t35=y;if(!_t35){_context32.n=14;break;}this.drawCount++;_context32.n=14;return this.drawShape(y);case 14:return _context32.a(3,17);case 15:this.drawCount++;!this.combineTimerId&&this.combineUnitTime!==1/0&&new Promise(function(C){_this88.combineDrawActiveId=h,_this88.combineDrawResolve=C,_this88.combineTimerId=setTimeout(function(){_this88.combineTimerId=void 0,_this88.combineDrawResolve&&_this88.combineDrawResolve(!0);},_this88.combineUnitTime);}).then(function(C){C&&_this88.drawPencilCombine(h,_this88.drawCount),_this88.combineDrawResolve=void 0;});_t36=y;if(!_t36){_context32.n=16;break;}_context32.n=16;return this.drawPencil(y);case 16:return _context32.a(3,17);case 17:return _context32.a(2);}},_callee31,this);}));function consumeDraw(_x59,_x60){return _consumeDraw.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(e,n){var a,u,h,i,s,o,v,p,y,C,b,M,_t37,_t38;return _regenerator().w(function(_context33){while(1)switch(_context33.p=_context33.n){case 0:this.eraserBatchScheduler.cancel(),this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);i=e.workId,s=e.scenePath,o=e.isLockSentEventCursor;if(!i){_context33.n=16;break;}v=i.toString();this.combineDrawActiveId===v&&(this.combineDrawActiveId=void 0),this.drawWorkActiveId===v&&(this.drawWorkActiveId=void 0);p=this.workShapes.get(v);if(p){_context33.n=1;break;}return _context33.a(2);case 1:y=p.toolsType;if(!(y===St.LaserPen)){_context33.n=2;break;}return _context33.a(2);case 2:_t37=y===St.BitMapEraser;if(!_t37){_context33.n=3;break;}_context33.n=3;return this.bitmapEraserRenderQueue;case 3:C=this.workShapes.get(Lo);b=(a=C==null?void 0:C.selectIds)==null?void 0:a[0];_context33.n=4;return p.consumeAll({data:e,workerEngine:this});case 4:M=_context33.v;_t38=y;_context33.n=_t38===St.Selector?5:_t38===St.PencilEraser?7:_t38===St.BitMapEraser?7:_t38===St.Eraser?10:_t38===St.Arrow?12:_t38===St.Straight?12:_t38===St.Ellipse?12:_t38===St.Rectangle?12:_t38===St.Star?12:_t38===St.Polygon?12:_t38===St.SpeechBalloon?12:_t38===St.Pencil?14:16;break;case 5:M.selectIds&&b&&(u=M.selectIds)!=null&&u.includes(b)&&C.cursorBlur();M.selectIds&&n.runReverseSelectWork(M.selectIds);_context33.n=6;return this.drawSelector(_objectSpread(_objectSpread({},M),{},{scenePath:s,isSelecting:!1}),te.Done,o);case 6:(h=p.selectIds)!=null&&h.length?p.clearTmpPoints():this.clearWorkShapeNodeCache(v);return _context33.a(3,16);case 7:_context33.p=7;_context33.n=8;return this.drawEraserFull(p,_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker);case 8:_context33.p=8;this.drawCount=0,this.clearWorkShapeNodeCache(v);return _context33.f(8);case 9:return _context33.a(3,16);case 10:_context33.n=11;return this.drawEraser(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker,e.collectUndoTicker);case 11:p.clearTmpPoints();return _context33.a(3,16);case 12:_context33.n=13;return this.drawPencilFull(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker,y);case 13:this.drawCount=0;this.clearWorkShapeNodeCache(v);return _context33.a(3,16);case 14:_context33.n=15;return this.drawPencilFull(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker);case 15:this.drawCount=0;this.clearWorkShapeNodeCache(v);return _context33.a(3,16);case 16:return _context33.a(2);}},_callee32,this,[[7,,8,9]]);}));function consumeDrawAll(_x61,_x62){return _consumeDrawAll.apply(this,arguments);}return consumeDrawAll;}()},{key:"workShapesDone",value:function(){var _workShapesDone=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(e,n){var _iterator90,_step90,i,_t39;return _regenerator().w(function(_context34){while(1)switch(_context34.p=_context34.n){case 0:_iterator90=_createForOfIteratorHelper(this.workShapes.keys());_context34.p=1;_iterator90.s();case 2:if((_step90=_iterator90.n()).done){_context34.n=4;break;}i=_step90.value;_context34.n=3;return this.consumeDrawAll({workId:i,scenePath:e,viewId:this.viewId,msgType:It.DrawWork,dataType:Qt.Local},n);case 3:_context34.n=2;break;case 4:_context34.n=6;break;case 5:_context34.p=5;_t39=_context34.v;_iterator90.e(_t39);case 6:_context34.p=6;_iterator90.f();return _context34.f(6);case 7:return _context34.a(2);}},_callee33,this,[[1,5,6,7]]);}));function workShapesDone(_x63,_x64){return _workShapesDone.apply(this,arguments);}return workShapesDone;}()},{key:"consumeFull",value:function(){var _consumeFull=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(e){var a,u,h,n,i,v,p,s,o,_v1,_p5,y,C,b,M;return _regenerator().w(function(_context35){while(1)switch(_context35.n){case 0:n=(a=e.workId)==null?void 0:a.toString(),i=(u=e.updateNodeOpt)==null?void 0:u.eraserGeometryDelta;if(!n){_context35.n=3;break;}v=this.vNodes.get(n),p=e.ops&&ks(e.ops)||e.op||[];if(!i){_context35.n=2;break;}if(!(!v||!e.centerPos||!Dmt(this.vNodes,n,i,v,{op:p,centerPos:e.centerPos}))){_context35.n=1;break;}vp(this.vNodes,n);return _context35.a(2);case 1:_context35.n=3;break;case 2:v&&e.centerPos&&Lmt(this.vNodes,n)&&Wo(v.op,v.centerPos)!==Wo(p,e.centerPos)&&vp(this.vNodes,n);case 3:s=this.setFullWork(e),o=e.ops&&ks(e.ops)||e.op;if(!s){_context35.n=11;break;}if(n){_context35.n=4;break;}return _context35.a(2);case 4:_v1=(h=this.vNodes.get(n))==null?void 0:h.rect;if(!(s.toolsType===St.BackgroundSVG)){_context35.n=5;break;}_p5=s.consumeService({isFullWork:!0,replaceId:n});_context35.n=10;break;case 5:if(!(s.toolsType===St.Image)){_context35.n=7;break;}_context35.n=6;return s.consumeServiceAsync({isFullWork:!0,replaceId:n,worker:this});case 6:_p5=_context35.v;y=(e==null?void 0:e.updateNodeOpt)&&s.updataOptService(e.updateNodeOpt);_context35.n=10;break;case 7:if(!(s.toolsType===St.Text)){_context35.n=9;break;}_context35.n=8;return s.consumeServiceAsync({isFullWork:!0,replaceId:n,boxRect:this.thread.getSceneRect()});case 8:_p5=_context35.v;_context35.n=10;break;case 9:_p5=s.consumeService({op:o,isFullWork:!0,replaceId:n}),y=(e==null?void 0:e.updateNodeOpt)&&s.updataOptService(e.updateNodeOpt);case 10:_p5=Kt(_p5,y);C=[],b=[];if(!(e.workId&&this.workShapes.delete(e.workId.toString()),e.clearPreviewLocalWork&&C.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}),_p5&&e.willRefresh&&(_v1&&(C.push({rect:me(_v1),isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId}),_p5=Kt(_p5,_v1)),C.push({rect:me(_p5),drawCanvas:$t.Bg,viewId:this.viewId})),e.willSyncService&&b.push({opt:e.opt,toolsType:e.toolsType,type:It.FullWork,workId:e.workId,ops:e.ops,updateNodeOpt:e.updateNodeOpt,viewId:this.viewId,needUndoTicker:e.needUndoTicker,requestId:e.requestId,emitEventType:e.emitEventType,scenePath:e.scenePath}),e.isLockSentEventCursor&&b.push({type:It.None,isLockSentEventCursor:!0,scenePath:e.scenePath}),e.needUndoTicker&&b.push({type:It.None,needUndoTicker:e.needUndoTicker,emitEventType:e.emitEventType,requestId:e.requestId,scenePath:e.scenePath}),C.length||b.length)){_context35.n=11;break;}M={render:C,sp:b};_context35.n=11;return this._post(M);case 11:return _context35.a(2);}},_callee34,this);}));function consumeFull(_x65){return _consumeFull.apply(this,arguments);}return consumeFull;}()},{key:"removeSelector",value:function(){var _removeSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(e,n){var i,s,o,a,u,h,v,_iterator91,_step91,p,y,C,_t40,_t41,_t42;return _regenerator().w(function(_context36){while(1)switch(_context36.p=_context36.n){case 0:i=e.willSyncService,s=e.needUndoTicker,o=[],a=[],u=[],h=this.workShapes.get(De);if(h){_context36.n=1;break;}return _context36.a(2);case 1:v=h.selectIds&&_toConsumableArray(h.selectIds)||[];_iterator91=_createForOfIteratorHelper(v);_context36.p=2;_iterator91.s();case 3:if((_step91=_iterator91.n()).done){_context36.n=8;break;}p=_step91.value;y=this.vNodes.get(p);if(!y){_context36.n=6;break;}_t40=y.toolsType;_context36.n=_t40===St.Text?4:_t40===St.BackgroundSVG?5:6;break;case 4:o.push({type:It.TextUpdate,toolsType:St.Text,workId:p,dataType:Qt.Local});return _context36.a(3,6);case 5:o.push({type:It.BackgroundSVGDelete,toolsType:St.BackgroundSVG,workId:p,dataType:Qt.Local,viewId:this.viewId});return _context36.a(3,6);case 6:C=this._removeWork(p);C.length&&a.push.apply(a,_toConsumableArray(C)),n==null||n.deleteCachedImagesByWorkId(p),u.push(p);case 7:_context36.n=3;break;case 8:_context36.n=10;break;case 9:_context36.p=9;_t41=_context36.v;_iterator91.e(_t41);case 10:_context36.p=10;_iterator91.f();return _context36.f(10);case 11:u.length&&o.push({type:It.RemoveNode,removeIds:u,needUndoTicker:s,emitEventType:e.emitEventType,requestId:e.requestId});o.push({type:It.Select,selectIds:[],willSyncService:i});_context36.n=12;return this.blurSelector();case 12:s&&o.push({type:It.None,needUndoTicker:s});_t42=a.length||o.length;if(!_t42){_context36.n=13;break;}_context36.n=13;return this._post({render:a,sp:o});case 13:return _context36.a(2);}},_callee35,this,[[2,9,10,11]]);}));function removeSelector(_x66,_x67){return _removeSelector.apply(this,arguments);}return removeSelector;}()},{key:"removeWork",value:function(){var _removeWork2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(e){var n,i,s,_t43;return _regenerator().w(function(_context37){while(1)switch(_context37.n){case 0:n=e.workId,i=n==null?void 0:n.toString();if(!i){_context37.n=1;break;}s=this._removeWork(i);_t43=s.length;if(!_t43){_context37.n=1;break;}_context37.n=1;return this._post({render:s});case 1:return _context37.a(2);}},_callee36,this);}));function removeWork(_x68){return _removeWork2.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(e){var _this89=this;var o,a;var n=this.vNodes.get(e);n&&(n.toolsType===St.BackgroundSVG&&this._post({sp:[{type:It.BackgroundSVGDelete,toolsType:St.BackgroundSVG,workId:e,dataType:Qt.Local,viewId:this.viewId}]}),(o=this.fullLayer)==null||o.getElementsByName(e).forEach(function(u){u.remove(),_zr(u,_this89.fullLayer.parent);}),this.vNodes.delete(e));var i=((a=this.drawLayer)==null?void 0:a.getElementsByName(e))||[];var s;return i.forEach(function(u){var h=u.getBoundingClientRect();s=Kt(s,{x:Math.floor(h.x-Gt.SafeBorderPadding),y:Math.floor(h.y-Gt.SafeBorderPadding),w:Math.floor(h.width+Gt.SafeBorderPadding*2),h:Math.floor(h.height+Gt.SafeBorderPadding*2)});}),s&&i.forEach(function(u){var h;u.remove(),_zr(u,(h=_this89.drawLayer)==null?void 0:h.parent);}),this.getWorkShape(e)&&this.clearWorkShapeNodeCache(e),{fullRect:n==null?void 0:n.rect,drawRect:s};}},{key:"_removeWork",value:function _removeWork(e){var _this$removeNode=this.removeNode(e),n=_this$removeNode.fullRect,i=_this$removeNode.drawRect,s=[];return n&&s.push({rect:me(n),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId,workId:e},{rect:me(n),drawCanvas:$t.Bg,viewId:this.viewId,workId:e}),i&&s.push({rect:me(i),clearCanvas:$t.Float,isClear:!0,viewId:this.viewId,workId:e},{rect:me(i),drawCanvas:$t.Float,viewId:this.viewId,workId:e}),s;}},{key:"checkTextActive",value:function(){var _checkTextActive=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(e){var n,i,s,o,a,u,h,_iterator92,_step92,_v10,p,y,C,b,v,_t44,_t45;return _regenerator().w(function(_context38){while(1)switch(_context38.p=_context38.n){case 0:n=e.op,i=e.viewId,s=e.dataType;if(!(n!=null&&n.length)){_context38.n=11;break;}u=n[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],h=n[1]*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1];_iterator92=_createForOfIteratorHelper(this.vNodes.curNodeMap.values());_context38.p=1;_iterator92.s();case 2:if((_step92=_iterator92.n()).done){_context38.n=4;break;}_v10=_step92.value;p=_v10.rect,y=_v10.name,C=_v10.toolsType,b=_v10.opt;if(!(C===St.Text&&b.workState===te.Done&&eAt([u,h],p))){_context38.n=3;break;}o=y,a=this.setFullWork({workId:y,toolsType:C,opt:b});return _context38.a(3,4);case 3:_context38.n=2;break;case 4:_context38.n=6;break;case 5:_context38.p=5;_t44=_context38.v;_iterator92.e(_t44);case 6:_context38.p=6;_iterator92.f();return _context38.f(6);case 7:if(!o){_context38.n=11;break;}_t45=a;if(!_t45){_context38.n=9;break;}_context38.n=8;return a.consumeServiceAsync({isFullWork:!0,replaceId:a.getWorkId(),boxRect:this.thread.getSceneRect()});case 8:v=_context38.v;case 9:_context38.n=10;return this.blurSelector({viewId:i,msgType:It.Select,dataType:s,isSync:!0});case 10:_context38.n=11;return this._post({render:v&&[{rect:me(v),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(v),drawCanvas:$t.Bg,viewId:this.viewId}],sp:[{type:It.GetTextActive,toolsType:St.Text,workId:o}]});case 11:return _context38.a(2);}},_callee37,this,[[1,5,6,7]]);}));function checkTextActive(_x69){return _checkTextActive.apply(this,arguments);}return checkTextActive;}()},{key:"colloctEffectSelectWork",value:function(){var _colloctEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(e){var n,i,s;return _regenerator().w(function(_context39){while(1)switch(_context39.n){case 0:n=this.workShapes.get(De),i=e.workId,s=e.msgType;if(!(n&&i&&n.selectIds&&n.selectIds.includes(i.toString()))){_context39.n=2;break;}s===It.RemoveNode?n.selectIds=n.selectIds.filter(function(o){return o!==i.toString();}):this.effectSelectNodeData.add(e);_context39.n=1;return this.runEffectSelectWork(!0);case 1:return _context39.a(2);case 2:return _context39.a(2,e);}},_callee38,this);}));function colloctEffectSelectWork(_x70){return _colloctEffectSelectWork.apply(this,arguments);}return colloctEffectSelectWork;}()},{key:"updateSelector",value:function(){var _updateSelector2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39(e){var _this90=this;var M,n,i,s,o,a,u,h,v,p,y,C,b,_t46;return _regenerator().w(function(_context40){while(1)switch(_context40.n){case 0:n=this.workShapes.get(De);if((M=n==null?void 0:n.selectIds)!=null&&M.length){_context40.n=1;break;}return _context40.a(2);case 1:i=e.callback;s=_objectWithoutProperties(e,_excluded3);o=s.updateSelectorOpt;a=s.willSerializeData;u=s.smoothSync;_context40.n=2;return n==null?void 0:n.updateSelector({updateSelectorOpt:o,selectIds:gr(n.selectIds),vNodes:this.vNodes,willSerializeData:a,worker:this});case 2:h=_context40.v;v=/* @__PURE__ */new Map();h!=null&&h.selectIds&&(p=dMt(n.selectIds,h.selectIds),h.selectIds.forEach(function(L){var X=_this90.vNodes.get(L);if(X){var Y=X.toolsType,et=X.op,A=X.opt;v.set(L,{opt:A,toolsType:Y,ops:(et==null?void 0:et.length)&&Br(et)||void 0});}}),n.selectIds=h.selectIds);y=[],C=[];h!=null&&h.rect&&y.push({rect:me(h.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(h.rect),drawCanvas:$t.Bg,viewId:this.viewId});b=i&&i({res:h,workShapeNode:n,param:s,postData:{render:y,sp:C},newServiceStore:v,smoothSync:u})||{render:y,sp:C};p&&b.sp.push({type:It.RemoveNode,removeIds:p,viewId:this.viewId});_t46=b.render.length||b.sp.length;if(!_t46){_context40.n=3;break;}_context40.n=3;return this._post(b);case 3:return _context40.a(2);}},_callee39,this);}));function updateSelector(_x71){return _updateSelector2.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function(){var _blurSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40(e){var s,n,i,o;return _regenerator().w(function(_context41){while(1)switch(_context41.n){case 0:n=this.workShapes.get(De),i=n==null?void 0:n.blurSelector();if(!(this.clearWorkShapeNodeCache(De),((s=this.fullLayer)==null?void 0:s.parent).children.forEach(function(o){o.name===De&&o.remove();}),i)){_context41.n=1;break;}o=[];o.push(_objectSpread(_objectSpread({},i),{},{isSync:e==null?void 0:e.isSync,scenePath:e==null?void 0:e.scenePath}));_context41.n=1;return this._post({render:(i==null?void 0:i.rect)&&[{rect:me(i.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(i.rect),drawCanvas:$t.Bg,viewId:this.viewId}],sp:o});case 1:return _context41.a(2);}},_callee40,this);}));function blurSelector(_x72){return _blurSelector.apply(this,arguments);}return blurSelector;}()},{key:"hasSelector",value:function hasSelector(){return this.workShapes.has(De);}},{key:"getSelector",value:function getSelector(){return this.workShapes.get(De);}},{key:"reRenderSelector",value:function(){var _reRenderSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41(){var e,o,n,i,s,a,_args42=arguments;return _regenerator().w(function(_context42){while(1)switch(_context42.n){case 0:e=_args42.length>0&&_args42[0]!==undefined?_args42[0]:!1;n=this.workShapes.get(De);if(n){_context42.n=1;break;}return _context42.a(2);case 1:if(!(n&&!((o=n.selectIds)!=null&&o.length))){_context42.n=3;break;}_context42.n=2;return this.blurSelector();case 2:return _context42.a(2);case 3:i=n.oldSelectRect,s=n.reRenderSelector();if(!s){_context42.n=4;break;}a=Kt(i,s)||s;_context42.n=4;return this._post({render:[{rect:me(a),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(a),drawCanvas:$t.Bg,viewId:this.viewId}],sp:[{type:It.Select,selectIds:n.selectIds,selectRect:s,willSyncService:e,viewId:this.viewId,points:n.getChildrenPoints(),textOpt:n.textOpt,selectorColor:n.selectorColor,strokeColor:n.strokeColor,fillColor:n.fillColor,canTextEdit:n.canTextEdit,canRotate:n.canRotate,scaleType:n.scaleType,opt:n.getWorkOptions()||void 0,canLock:n.canLock,isLocked:n.isLocked,toolsTypes:n.toolsTypes,shapeOpt:n.shapeOpt,thickness:n.thickness,useStroke:n.useStroke,strokeType:n.strokeType}]});case 4:return _context42.a(2);}},_callee41,this);}));function reRenderSelector(){return _reRenderSelector.apply(this,arguments);}return reRenderSelector;}()},{key:"updateFullSelectWork",value:function(){var _updateFullSelectWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42(e){var s,o,a,u,h,v,p,n,i,_n$updateSelectIds,y,C,b,_t47;return _regenerator().w(function(_context43){while(1)switch(_context43.n){case 0:n=this.workShapes.get(De),i=e.selectIds;if(i!=null&&i.length){_context43.n=2;break;}_context43.n=1;return this.blurSelector(e);case 1:return _context43.a(2);case 2:if(n){_context43.n=4;break;}_t47=this.setFullWork({workId:De,toolsType:St.Selector,opt:e.opt||(((s=this.tmpOpt)==null?void 0:s.toolsType)===St.Selector?this.tmpOpt.toolsOpt:{})});if(!_t47){_context43.n=3;break;}_context43.n=3;return this.updateFullSelectWork(e);case 3:return _context43.a(2);case 4:if(!(n&&i!=null&&i.length)){_context43.n=5;break;}_n$updateSelectIds=n.updateSelectIds(i),y=_n$updateSelectIds.bgRect,C=_n$updateSelectIds.selectRect,b={render:[],sp:[]};y&&((o=b.render)==null||o.push({rect:me(y),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(y),drawCanvas:$t.Bg,viewId:this.viewId}));(p=b.sp)==null||p.push({selectorColor:((a=e.opt)==null?void 0:a.strokeColor)||n.selectorColor,strokeColor:((u=e.opt)==null?void 0:u.strokeColor)||n.strokeColor,fillColor:((h=e.opt)==null?void 0:h.fillColor)||n.fillColor,textOpt:((v=e.opt)==null?void 0:v.textOpt)||n.textOpt,canTextEdit:n.canTextEdit,canRotate:n.canRotate,scaleType:n.scaleType,type:It.Select,viewId:this.viewId,dataType:Qt.Local,selectIds:e.selectIds,selectRect:C,points:n.getChildrenPoints(),willSyncService:(e==null?void 0:e.willSyncService)||!1,opt:(e==null?void 0:e.willSyncService)&&n.getWorkOptions()||void 0,canLock:n.canLock,isLocked:n.isLocked,toolsTypes:n.toolsTypes,shapeOpt:n.shapeOpt,thickness:n.thickness,useStroke:n.useStroke,strokeType:n.strokeType});_context43.n=5;return this._post(b);case 5:return _context43.a(2);}},_callee42,this);}));function updateFullSelectWork(_x73){return _updateFullSelectWork.apply(this,arguments);}return updateFullSelectWork;}()},{key:"destroy",value:function destroy(){var e;(e=this.disposeVNodeRevisionObserver)==null||e.call(this),this.disposeVNodeRevisionObserver=void 0,this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1)),_superPropGet(ZT,"destroy",this,3)([]),this.effectSelectNodeData.clear();}},{key:"enqueueBitmapEraserRender",value:function enqueueBitmapEraserRender(e){var _this91=this;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.drawCount;var i=arguments.length>2?arguments[2]:undefined;var s=arguments.length>3?arguments[3]:undefined;var o=arguments.length>4?arguments[4]:undefined;var a=this.bitmapEraserRenderQueue.then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43(){var _t48;return _regenerator().w(function(_context44){while(1)switch(_context44.n){case 0:_t48=_this91.combineDrawActiveId!==e||!_this91.getWorkShape(e);if(_t48){_context44.n=1;break;}_context44.n=1;return _this91.postEraserBatch(e,n,i,s,o);case 1:return _context44.a(2);}},_callee43);})));return this.bitmapEraserRenderQueue=a.catch(function(){}),a;}},{key:"drawPencilEraserCombine",value:function(){var _drawPencilEraserCombine=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44(e,n,i,s){return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:_context45.n=1;return this.postEraserBatch(e,n,i,s);case 1:return _context45.a(2);}},_callee44,this);}));function drawPencilEraserCombine(_x74,_x75,_x76,_x77){return _drawPencilEraserCombine.apply(this,arguments);}return drawPencilEraserCombine;}()},{key:"postEraserBatch",value:function(){var _postEraserBatch=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(e,n,i,s,o){var u,h,v,p,y,C,a,b,M,L,X,Y,_iterator93,_step93,_step93$value,_Y4,et;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:a=(u=this.workShapes.get(e))==null?void 0:u.combineConsume({workerEngine:this});if(!(a||o)){_context46.n=1;break;}b=a==null?void 0:a.willDeleteNodes,M=a==null?void 0:a.willNewNodes,L=_toConsumableArray(b?Array.from(b):[]),X=_objectSpread({render:[],fullWorkerDrawCount:n,sp:[]},o);if(a!=null&&a.rect){Y=me(a.rect);(h=X.render)==null||h.push({rect:Y,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e},{rect:Y,drawCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e});}if(s&&L.length&&((v=this.getWorkShape(e))==null?void 0:v.toolsType)===St.BitMapEraser&&((p=X.sp)==null||p.push({type:It.None,collectUndoTicker:s,undoScopeIds:L,undoScopePhase:"collect"})),b!=null&&b.size&&((y=X.sp)==null||y.push({type:It.RemoveNode,removeIds:_toConsumableArray(b),viewId:this.thread.viewId,needUndoTicker:i,collectUndoTicker:s})),M!=null&&M.size){_iterator93=_createForOfIteratorHelper(M);try{for(_iterator93.s();!(_step93=_iterator93.n()).done;){_step93$value=_slicedToArray(_step93.value,2),_Y4=_step93$value[0],et=_step93$value[1];(C=X.sp)==null||C.push({type:It.FullWork,dataType:Qt.Local,toolsType:St.Pencil,ops:Br(et.op),opt:et.opt,workId:_Y4,updateNodeOpt:{useAnimation:!1},needUndoTicker:i,collectUndoTicker:s});}}catch(err){_iterator93.e(err);}finally{_iterator93.f();}}_context46.n=1;return this._post(X);case 1:return _context46.a(2);}},_callee45,this);}));function postEraserBatch(_x78,_x79,_x80,_x81,_x82){return _postEraserBatch.apply(this,arguments);}return postEraserBatch;}()},{key:"drawPencilCombine",value:function(){var _drawPencilCombine=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(e,n){var s,o,a,i,u,h;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:i=(s=this.workShapes.get(e))==null?void 0:s.combineConsume();if(!i){_context47.n=1;break;}u={render:[],fullWorkerDrawCount:n};if(i!=null&&i.rect){h=me(i.rect);(o=u.render)==null||o.push({rect:h,isClear:!0,clearCanvas:$t.Float,viewId:this.viewId,workId:e}),(a=u.render)==null||a.push({rect:h,drawCanvas:$t.Float,viewId:this.viewId,workId:e});}_context47.n=1;return this._post(u);case 1:return _context47.a(2);}},_callee46,this);}));function drawPencilCombine(_x83,_x84){return _drawPencilCombine.apply(this,arguments);}return drawPencilCombine;}()},{key:"drawSelector",value:function(){var _drawSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(e,n,i){var o,a,u,s;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:s={render:[],sp:[e]};(o=s.sp)==null||o.push({type:It.SelectorTransform,emitEventType:ve.SelectMethod,workState:n,scenePath:e.scenePath});i&&((a=s.sp)==null||a.push({type:It.None,isLockSentEventCursor:i}));e.rect&&((u=s.render)==null||u.push({rect:me(e.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(e.rect),drawCanvas:$t.Bg,viewId:this.viewId}));_context48.n=1;return this._post(s);case 1:return _context48.a(2);}},_callee47,this);}));function drawSelector(_x85,_x86,_x87){return _drawSelector.apply(this,arguments);}return drawSelector;}()},{key:"drawPencilFull",value:function(){var _drawPencilFull=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(e,n,i,s){var h,v,p,y,a,u;return _regenerator().w(function(_context49){while(1)switch(_context49.n){case 0:a=s===St.Pencil&&e.type===It.RemoveNode,u={fullWorkerDrawCount:1/0,render:[],sp:a?[]:[_objectSpread(_objectSpread({},e),{},{needUndoTicker:i,undoScopeIds:e.undoScopeIds||(e.workId!==void 0?[e.workId.toString()]:void 0),undoScopePhase:e.undoScopePhase||"finalize"})]};n&&((h=u.sp)==null||h.push({type:It.None,isLockSentEventCursor:n}));a?(v=u.render)==null||v.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}):e!=null&&e.rect&&((p=u.render)==null||p.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:e.rect,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId},{rect:e.rect,drawCanvas:$t.Bg,viewId:this.viewId}));i&&((y=u.sp)==null||y.push({type:It.None,needUndoTicker:i,undoScopeIds:a?[]:void 0,undoScopePhase:a?"finalize":void 0}));_context49.n=1;return this._post(u);case 1:return _context49.a(2);}},_callee48,this);}));function drawPencilFull(_x88,_x89,_x90,_x91){return _drawPencilFull.apply(this,arguments);}return drawPencilFull;}()},{key:"drawEraserFull",value:function(){var _drawEraserFull=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49(e,n,i,s){var o,a,u,h,v,p,y,C,b,_iterator94,_step94,_step94$value,L,X,_iterator95,_step95,_step95$value,_L17,_X8,M;return _regenerator().w(function(_context50){while(1)switch(_context50.n){case 0:o=n.rect,a=n.willUpdateNodes,u=n.willDeleteNodes,h=n.willNewNodes,v=n.eraseTxnRecoveryRequired,p=n.eraseTxnBeforeImages,y=e.getWorkId(),C=[].concat(_toConsumableArray(a?Array.from(a.keys()).map(function(L){return String(L);}):[]),_toConsumableArray(u?Array.from(u):[]),_toConsumableArray(h?Array.from(h.keys()).map(function(L){return String(L);}):[])),b=[];if(s&&b.push({type:It.None,needUndoTicker:s,undoScopeIds:C,undoScopePhase:"finalize",eraseTxnId:y,eraseTxnRecoveryRequired:v,eraseTxnBeforeImages:p}),b.push({type:It.RemoveNode,removeIds:[y],eraseTxnId:y,viewId:this.viewId,needUndoTicker:s,eraseTxnRecoveryRequired:v,eraseTxnBeforeImages:p}),i&&b.push({type:It.None,isLockSentEventCursor:i}),a!=null&&a.size||u!=null&&u.size||h!=null&&h.size){if(a!=null&&a.size){_iterator94=_createForOfIteratorHelper(a);try{for(_iterator94.s();!(_step94=_iterator94.n()).done;){_step94$value=_slicedToArray(_step94.value,2),L=_step94$value[0],X=_step94$value[1];b.push({type:It.UpdateNode,dataType:Qt.Local,opt:X.opt,workId:L,updateNodeOpt:{useAnimation:!1},eraseTxnId:y,needUndoTicker:s});}}catch(err){_iterator94.e(err);}finally{_iterator94.f();}}if(u!=null&&u.size&&b.push({type:It.RemoveNode,removeIds:_toConsumableArray(u),eraseTxnId:y,viewId:this.thread.viewId,needUndoTicker:s}),h!=null&&h.size){_iterator95=_createForOfIteratorHelper(h);try{for(_iterator95.s();!(_step95=_iterator95.n()).done;){_step95$value=_slicedToArray(_step95.value,2),_L17=_step95$value[0],_X8=_step95$value[1];b.push({type:It.FullWork,dataType:Qt.Local,toolsType:_X8.toolsType,ops:Br(_X8.op),opt:_X8.opt,workId:_L17,updateNodeOpt:{useAnimation:!1},needUndoTicker:s,eraseTxnId:y});}}catch(err){_iterator95.e(err);}finally{_iterator95.f();}}}e.toolsType===St.BitMapEraser&&b.push({type:It.None,viewId:this.viewId,eraseTxnId:y,eraseTxnPhase:n.eraseTxnCommitStatus==="failed"||v?"failed":"applied",eraseTxnRecoveryRequired:v,eraseTxnBeforeImages:p});M=[{isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId,eraseTxnId:y}];o&&M.push({rect:o,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:y},{rect:o,drawCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:y});_context50.n=1;return this._post({sp:b,render:M,fullWorkerDrawCount:1/0});case 1:return _context50.a(2);}},_callee49,this);}));function drawEraserFull(_x92,_x93,_x94,_x95){return _drawEraserFull.apply(this,arguments);}return drawEraserFull;}()},{key:"drawEraser",value:function(){var _drawEraser=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50(e,n,i,s){var o,a,u;return _regenerator().w(function(_context51){while(1)switch(_context51.n){case 0:o=[],a=[],u=e.removeIds||[];s&&u.length&&o.push({type:It.None,collectUndoTicker:s,undoScopeIds:u,undoScopePhase:"collect"});n&&o.push({type:It.None,isLockSentEventCursor:n});e.removeIds&&o.push(_objectSpread(_objectSpread({},e),{},{needUndoTicker:i,collectUndoTicker:s}));e.rect&&a.push({rect:e.rect,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId},{rect:e.rect,drawCanvas:$t.Bg,viewId:this.viewId});i&&o.push({type:It.None,needUndoTicker:i,undoScopePhase:"finalize"});_context51.n=1;return this._post({sp:o,render:a,consumeCount:this.consumeCount});case 1:return _context51.a(2);}},_callee50,this);}));function drawEraser(_x96,_x97,_x98,_x99){return _drawEraser.apply(this,arguments);}return drawEraser;}()},{key:"drawShape",value:function(){var _drawShape=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(e){return _regenerator().w(function(_context52){while(1)switch(_context52.n){case 0:_context52.n=1;return this._post({fullWorkerDrawCount:this.drawCount,sp:(e==null?void 0:e.op)&&[e]});case 1:return _context52.a(2);}},_callee51,this);}));function drawShape(_x100){return _drawShape.apply(this,arguments);}return drawShape;}()},{key:"drawPencil",value:function(){var _drawPencil=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52(e){return _regenerator().w(function(_context53){while(1)switch(_context53.n){case 0:_context53.n=1;return this._post({sp:(e==null?void 0:e.op)&&[e]});case 1:return _context53.a(2);}},_callee52,this);}));function drawPencil(_x101){return _drawPencil.apply(this,arguments);}return drawPencil;}()},{key:"runEffectSelectWork",value:function(){var _runEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(e){var n,_iterator96,_step96,i,s,o,a,_t49;return _regenerator().w(function(_context54){while(1)switch(_context54.p=_context54.n){case 0:_iterator96=_createForOfIteratorHelper(this.effectSelectNodeData.values());_context54.p=1;_iterator96.s();case 2:if((_step96=_iterator96.n()).done){_context54.n=11;break;}i=_step96.value;s=this.setFullWork(i);if(!s){_context54.n=9;break;}o=(n=s.getWorkId())==null?void 0:n.toString();if(!(s.toolsType===St.BackgroundSVG)){_context54.n=3;break;}s.consumeService({isFullWork:!0,replaceId:o});_context54.n=8;break;case 3:if(!(s.toolsType===St.Image)){_context54.n=5;break;}_context54.n=4;return s.consumeServiceAsync({isFullWork:!0,replaceId:o,worker:this});case 4:_context54.n=8;break;case 5:if(!(s.toolsType===St.Text)){_context54.n=7;break;}_context54.n=6;return s.consumeServiceAsync({isFullWork:!0,replaceId:o,boxRect:this.thread.getSceneRect()});case 6:_context54.n=8;break;case 7:a=i.ops&&ks(i.ops);s.consumeService({op:a,isFullWork:!0,replaceId:o}),i!=null&&i.updateNodeOpt&&s.updataOptService(i.updateNodeOpt);case 8:i.workId&&this.workShapes.delete(i.workId.toString());case 9:this.effectSelectNodeData.delete(i);case 10:_context54.n=2;break;case 11:_context54.n=13;break;case 12:_context54.p=12;_t49=_context54.v;_iterator96.e(_t49);case 13:_context54.p=13;_iterator96.f();return _context54.f(13);case 14:_context54.n=15;return this.reRenderSelector(e);case 15:return _context54.a(2);}},_callee53,this,[[1,12,13,14]]);}));function runEffectSelectWork(_x102){return _runEffectSelectWork.apply(this,arguments);}return runEffectSelectWork;}()},{key:"cursorHover",value:function(){var _cursorHover=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee54(e){var a,n,i,s,o,u,h,_t50;return _regenerator().w(function(_context55){while(1)switch(_context55.n){case 0:n=e.opt,i=e.toolsType,s=e.point,o=this.setFullWork({workId:Lo,toolsType:i,opt:n});if(!(o&&s)){_context55.n=1;break;}u=o.cursorHover(s),h={render:[]};_t50=u&&u.type===It.CursorHover&&u.rect;if(!_t50){_context55.n=1;break;}(a=h.render)==null||a.push({rect:me(u.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(u.rect),drawCanvas:$t.Bg,viewId:this.viewId});_context55.n=1;return this._post(h);case 1:return _context55.a(2);}},_callee54,this);}));function cursorHover(_x103){return _cursorHover.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee55(){var i,e,n,_t51,_t52;return _regenerator().w(function(_context56){while(1)switch(_context56.n){case 0:e=this.getWorkShape(Lo);_t51=e&&(i=e.selectIds)!=null&&i.length;if(!_t51){_context56.n=1;break;}n=e.oldSelectRect;e.cursorBlur();this.clearWorkShapeNodeCache(Lo);_t52=n;if(!_t52){_context56.n=1;break;}_context56.n=1;return this._post({render:[{rect:me(n),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(n),drawCanvas:$t.Bg,viewId:this.viewId}]});case 1:this.fullLayer.parent.children.forEach(function(s){s.name==="Cursor_Hover_Id"&&s.remove();});case 2:return _context56.a(2);}},_callee55,this);}));function cursorBlur(){return _cursorBlur.apply(this,arguments);}return cursorBlur;}()}]);}(zv);var qT=/*#__PURE__*/function(){function qT(t){var _this92=this;_classCallCheck(this,qT);ht(this,"viewId");ht(this,"vNodes");ht(this,"fullLayer");ht(this,"drawLayer");ht(this,"workShapes",/* @__PURE__ */new Map());ht(this,"selectorWorkShapes",/* @__PURE__ */new Map());ht(this,"thread");ht(this,"willRunEffectSelectorIds",/* @__PURE__ */new Set());ht(this,"noAnimationRect");ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"post");ht(this,"animationScheduler");ht(this,"effectScheduler");this.viewId=t.viewId,this.vNodes=t.vNodes,this.fullLayer=t.fullLayer,this.drawLayer=t.drawLayer,this.thread=t.thread,this.post=t.thread.post.bind(t.thread),this.animationScheduler=new X1({run:function(){var _run=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee56(){var _t53;return _regenerator().w(function(_context57){while(1)switch(_context57.p=_context57.n){case 0:_context57.p=0;_context57.n=1;return _this92.animationDraw();case 1:_context57.n=3;break;case 2:_context57.p=2;_t53=_context57.v;throw Au(_t53,{business:"service-render",stage:"animation-draw"});case 3:return _context57.a(2);}},_callee56,null,[[0,2]]);}));function run(){return _run.apply(this,arguments);}return run;}(),schedule:function schedule(e){return setTimeout(e,16);},cancel:function cancel(e){return clearTimeout(e);},onError:function onError(e){return _this92.thread.reportRendererBusinessError(e,{business:"service-render",stage:"animation-draw"},!0);}}),this.effectScheduler=new X1({run:function(){var _run2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee57(){var _t54;return _regenerator().w(function(_context58){while(1)switch(_context58.p=_context58.n){case 0:_context58.p=0;_context58.n=1;return _this92.effectRunSelector();case 1:_context58.n=3;break;case 2:_context58.p=2;_t54=_context58.v;throw Au(_t54,{business:"service-render",stage:"selector-effect"});case 3:return _context58.a(2);}},_callee57,null,[[0,2]]);}));function run(){return _run2.apply(this,arguments);}return run;}(),schedule:function schedule(e){return setTimeout(e,0);},cancel:function cancel(e){return clearTimeout(e);},onError:function onError(e){return _this92.thread.reportRendererBusinessError(e,{business:"service-render",stage:"selector-effect"},!0);}});}return _createClass(qT,[{key:"destroy",value:function destroy(){this.animationScheduler.destroy(),this.effectScheduler.destroy(),this.clearAll();}},{key:"clearAll",value:function clearAll(){this.workShapes.clear(),this.selectorWorkShapes.clear(),this.willRunEffectSelectorIds.clear(),this.noAnimationRect=void 0;}},{key:"consumeDraw",value:function(){var _consumeDraw2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee58(t){return _regenerator().w(function(_context59){while(1)switch(_context59.n){case 0:this.activeWorkShape(t),this.runAnimation();case 1:return _context59.a(2);}},_callee58,this);}));function consumeDraw(_x104){return _consumeDraw2.apply(this,arguments);}return consumeDraw;}()},{key:"consumeFull",value:function consumeFull(t){if(this.activeWorkShape(t),t.refreshTextRender){this.runAnimation(!0);return;}this.runAnimation();}},{key:"runSelectWork",value:function runSelectWork(t){this.activeSelectorShape(t);var e=t.workId,n=e==null?void 0:e.toString();n&&this.willRunEffectSelectorIds.add(n),this.runEffect();}},{key:"setNodeKey",value:function setNodeKey(t,e,n,i){return e.toolsType=n,e.node=mf({workId:t,toolsType:n,toolsOpt:i,vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer},this),e;}},{key:"runReverseSelectWork",value:function runReverseSelectWork(t){var _this93=this;t.forEach(function(e){_this93.selectorWorkShapes.forEach(function(n,i){var s;if((s=n.selectIds)!=null&&s.length){var o=n.selectIds.indexOf(e);o>-1&&(n.selectIds.splice(o,1),_this93.willRunEffectSelectorIds.add(i));}});}),this.willRunEffectSelectorIds.size&&this.runEffect();}},{key:"removeWork",value:function(){var _removeWork3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee59(t){var e,n,i;return _regenerator().w(function(_context60){while(1)switch(_context60.n){case 0:e=t.workId,n=e==null?void 0:e.toString();if(!n){_context60.n=3;break;}i=this.workShapes.get(n);if(!i){_context60.n=2;break;}this.workShapes.delete(n);_context60.n=1;return this.removeNode(n,t,i==null?void 0:i.totalRect,!1);case 1:return _context60.a(2);case 2:_context60.n=3;return this.removeNode(n,t);case 3:return _context60.a(2);}},_callee59,this);}));function removeWork(_x105){return _removeWork3.apply(this,arguments);}return removeWork;}()},{key:"removeSelectWork",value:function removeSelectWork(t){var e=t.workId,n=e==null?void 0:e.toString();n&&(this.activeSelectorShape(t),this.willRunEffectSelectorIds.add(n)),this.runEffect();}},{key:"removeNode",value:function(){var _removeNode=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee60(t,e,n){var _this94=this;var i,v,s,o,a,u,h,_args61=arguments,_t55;return _regenerator().w(function(_context61){while(1)switch(_context61.n){case 0:i=_args61.length>3&&_args61[3]!==undefined?_args61[3]:!0;t.indexOf(De)>-1&&this.removeSelectWork(e);s=n;o=(v=this.vNodes.get(t))==null?void 0:v.rect;o&&(s=Kt(o,s));a=this.fullLayer&&Gt.getRectFromLayer(this.fullLayer,t);s=Kt(s,a);u=this.drawLayer&&Gt.getRectFromLayer(this.drawLayer,t);s=Kt(s,u),this.fullLayer.getElementsByName(t).forEach(function(p){p.remove(),_zr(p,_this94.fullLayer.parent);}),this.drawLayer.getElementsByName(t).forEach(function(p){p.remove(),_zr(p,_this94.drawLayer.parent);});h=this.vNodes.get(t);h&&h.toolsType===St.BackgroundSVG&&this.post({sp:[{type:It.BackgroundSVGDelete,toolsType:St.BackgroundSVG,workId:t,dataType:Qt.Service,viewId:this.viewId}]});this.vNodes.delete(t);_t55=s;if(!_t55){_context61.n=1;break;}_context61.n=1;return this.post({render:[{rect:me(s),isClear:!0,clearCanvas:i?$t.Bg:$t.ServiceFloat,workerType:i?void 0:Qt.Service,viewId:this.viewId},{rect:me(s),drawCanvas:i?$t.Bg:$t.ServiceFloat,workerType:i?void 0:Qt.Service,viewId:this.viewId}]});case 1:return _context61.a(2);}},_callee60,this);}));function removeNode(_x106,_x107,_x108){return _removeNode.apply(this,arguments);}return removeNode;}()},{key:"activeWorkShape",value:function activeWorkShape(t){var L,X,Y,et;var e=t.workId,n=t.opt,i=t.toolsType,s=t.type,o=t.updateNodeOpt,a=t.ops,u=t.op,h=t.useAnimation,v=t.isEnableCursor,p=t.requestId,y=t.refreshTextRender;if(!e)return;var C=e.toString(),b=(L=this.vNodes.get(C))==null?void 0:L.rect;if(!((X=this.workShapes)!=null&&X.has(C))){var A={toolsType:i,animationWorkData:u||[],animationIndex:0,type:s,updateNodeOpt:o,ops:a,useAnimation:_typeof(h)<"u"?h:_typeof(o==null?void 0:o.useAnimation)<"u"?o==null?void 0:o.useAnimation:!0,oldRect:b,isDiff:!1,isEnableCursor:v};i&&n&&(A=this.setNodeKey(C,A,i,n)),(Y=this.workShapes)==null||Y.set(C,A);}var M=(et=this.workShapes)==null?void 0:et.get(C);M.isEnableCursor=v,M.requestId=p,M.refreshTextRender=!!y,s&&(M.type=s),a&&(M.animationWorkData=ks(a),M.ops=a),o&&(M.updateNodeOpt=o),u&&(M.isDiff=this.hasDiffData(M.animationWorkData||[],u,M.toolsType),M.toolsType,St.Pencil,M.animationWorkData=u),M.node&&M.node.getWorkId()!==C&&M.node.setWorkId(C),b&&(M.oldRect=b),i&&n?(n.syncUnitTime&&(this.syncUnitTime=n.syncUnitTime),M.toolsType!==i&&i&&n&&this.setNodeKey(C,M,i,n),M.node&&M.node.setWorkOptions(n)):i&&(M.toolsType=i);}},{key:"hasDiffData",value:function hasDiffData(t,e,n){var i=t.length;if(e.length<i)return!0;switch(n){case St.Pencil:{for(var s=0;s<i;s+=3)if(e[s]!==t[s]||e[s+1]!==t[s+1])return!0;break;}case St.LaserPen:{for(var _s0=0;_s0<i;_s0+=2)if(e[_s0]!==t[_s0]||e[_s0+1]!==t[_s0+1])return!0;break;}}return!1;}},{key:"animationDraw",value:function(){var _animationDraw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee61(){var _this95=this;var i,s,o,a,u,h,v,p,y,C,b,M,L,X,Y,et,A,w,S,x,P,z,U,K,j,nt,ct,B,N,G,q,at,ut,Ct,R,$,_,H,lt,dt,wt,Et,Ot,O,D,t,e,n,_iterator97,_step97,_loop6,_t57,_t58;return _regenerator().w(function(_context63){while(1)switch(_context63.p=_context63.n){case 0:t=!1;e={render:[]},n=/* @__PURE__ */new Map();_iterator97=_createForOfIteratorHelper(this.workShapes.entries());_context63.p=1;_loop6=/*#__PURE__*/_regenerator().m(function _loop6(){var _step97$value,J,Q,V,tt,_V2,_tt2,_V3,_tt3,_V4,_tt4,g,T,_V5,_tt5,_g2,_T2,k,Z,st,_Z2,_V6,_tt6,_g3,_T3,_t56;return _regenerator().w(function(_context62){while(1)switch(_context62.n){case 0:_step97$value=_slicedToArray(_step97.value,2),J=_step97$value[0],Q=_step97$value[1];_t56=Q.toolsType;_context62.n=_t56===St.BackgroundSVG?1:_t56===St.Image?2:_t56===St.Text?4:_t56===St.Arrow?7:_t56===St.Straight?7:_t56===St.Rectangle?7:_t56===St.Ellipse?7:_t56===St.Star?7:_t56===St.Polygon?7:_t56===St.SpeechBalloon?7:_t56===St.Pencil?8:13;break;case 1:V=Q.oldRect;V&&((i=e.render)==null||i.push({rect:V,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(s=e.render)==null||s.push({rect:V,drawCanvas:$t.Bg,viewId:_this95.viewId}));tt=(o=Q.node)==null?void 0:o.consumeService({isFullWork:!0,replaceId:J});_this95.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this95.willRunEffectSelectorIds.add(T),_this95.noAnimationRect=Kt(_this95.noAnimationRect,V),_this95.noAnimationRect=Kt(_this95.noAnimationRect,tt),_this95.runEffect());}),_this95.workShapes.delete(J),(a=e.render)==null||a.push({rect:tt,drawCanvas:$t.Bg,viewId:_this95.viewId});return _context62.a(3,13);case 2:_V2=Q.oldRect;_V2&&((u=e.render)==null||u.push({rect:_V2,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(h=e.render)==null||h.push({rect:_V2,drawCanvas:$t.Bg,viewId:_this95.viewId}));_context62.n=3;return(v=Q.node)==null?void 0:v.consumeServiceAsync({isFullWork:!0,worker:_this95.thread});case 3:_tt2=_context62.v;_this95.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this95.willRunEffectSelectorIds.add(T),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_V2),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt2),_this95.runEffect());}),_this95.workShapes.delete(J),(p=e.render)==null||p.push({rect:_tt2,drawCanvas:$t.Bg,viewId:_this95.viewId});return _context62.a(3,13);case 4:if(!Q.node){_context62.n=6;break;}_V3=Q.oldRect;_V3&&((y=e.render)==null||y.push({rect:_V3,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(C=e.render)==null||C.push({rect:_V3,drawCanvas:$t.Bg,viewId:_this95.viewId}));_context62.n=5;return Q.node.consumeServiceAsync({isFullWork:!0,replaceId:J,boxRect:_this95.thread.getSceneRect()});case 5:_tt3=_context62.v;_this95.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this95.willRunEffectSelectorIds.add(T),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_V3),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt3),_this95.runEffect());}),Q.refreshTextRender&&Q.requestId&&(e.sp=e.sp||[],e.sp.push({type:It.RefreshTextRender,requestId:Q.requestId,workId:J,viewId:_this95.viewId})),(b=Q.node)==null||b.clearTmpPoints(),_this95.workShapes.delete(J),(M=e.render)==null||M.push({rect:_tt3,drawCanvas:$t.Bg,viewId:_this95.viewId});case 6:return _context62.a(3,13);case 7:_V4=!!Q.ops;if((L=Q.animationWorkData)!=null&&L.length){_tt4=Q.oldRect,g=Q.node.oldRect;_tt4&&((X=e.render)==null||X.push({rect:_tt4,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(Y=e.render)==null||Y.push({rect:_tt4,drawCanvas:$t.Bg,viewId:_this95.viewId})),g&&((et=e.render)==null||et.push({rect:g,isClear:!0,clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}));T=(A=Q.node)==null?void 0:A.consumeService({op:Q.animationWorkData,isFullWork:_V4});Q.isEnableCursor?n.set(J,{cursorTool:Fn(Q.toolsType),workState:_tt4?Q.ops?te.Done:te.Doing:te.Start,op:Q.animationWorkData.slice(-3,-1)}):_V4&&!Q.useAnimation&&(w=Q.updateNodeOpt)!=null&&w.useAnimation&&n.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:Q.animationWorkData.slice(-3,-1),uid:(S=Q.updateNodeOpt)==null?void 0:S.uid}),_V4?(_this95.selectorWorkShapes.forEach(function(k,Z){var st;(st=k.selectIds)!=null&&st.includes(J)&&(_this95.willRunEffectSelectorIds.add(Z),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt4),_this95.noAnimationRect=Kt(_this95.noAnimationRect,g),_this95.noAnimationRect=Kt(_this95.noAnimationRect,T),_this95.runEffect());}),(x=Q.node)==null||x.clearTmpPoints(),_this95.workShapes.delete(J),(P=e.render)==null||P.push({rect:T,drawCanvas:$t.Bg,viewId:_this95.viewId})):(z=e.render)==null||z.push({rect:T,drawCanvas:$t.ServiceFloat,workerType:_V4?void 0:Qt.Service,viewId:_this95.viewId}),Q.animationWorkData.length=0;}return _context62.a(3,13);case 8:if(!Q.useAnimation){_context62.n=11;break;}if(!Q.useAnimation){_context62.n=10;break;}if(!Q.isDel){_context62.n=9;break;}(R=Q.node)==null||R.clearTmpPoints(),_this95.workShapes.delete(J);return _context62.a(3,13);case 9:_V5=3,_tt5=_this95.computNextAnimationIndex(Q,_V5),_g2=Q.isDiff?0:Math.max(0,(Q.animationIndex||0)-_V5),_T2=(Q.animationWorkData||[]).slice(0,_tt5),k=(_=($=Q.node)==null?void 0:$.getWorkId())==null?void 0:_.toString();if((Q.animationIndex||0)<_tt5||Q.isDiff){Z=(H=Q.node)==null?void 0:H.consumeService({op:_T2,isFullWork:!1,replaceId:k});if((lt=e.render)==null||lt.push({isClear:!0,rect:Z,clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}),(dt=e.render)==null||dt.push({rect:Z,drawCanvas:$t.ServiceFloat,viewId:_this95.viewId}),Q.animationIndex=_tt5,Q.isDiff&&(Q.isDiff=!1),_T2.length&&Q.isEnableCursor){st=_T2.slice(-3,-1);n.set(J,{cursorTool:Fn(Q.toolsType),workState:_g2===0?te.Start:_tt5===((wt=Q.animationWorkData)==null?void 0:wt.length)?te.Done:te.Doing,op:st});}}else if(Q.ops){_Z2=(Et=Q.node)==null?void 0:Et.consumeService({op:Q.animationWorkData||[],isFullWork:!0,replaceId:k});Q.isDel=!0,(Ot=e.render)==null||Ot.push({isClear:!0,rect:_Z2,clearCanvas:$t.ServiceFloat,viewId:_this95.viewId},{rect:_Z2,drawCanvas:$t.ServiceFloat,viewId:_this95.viewId},{isClear:!0,rect:_Z2,clearCanvas:$t.Bg,viewId:_this95.viewId},{rect:_Z2,drawCanvas:$t.Bg,viewId:_this95.viewId}),Q.isEnableCursor&&n.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T2.slice(-3,-1)});}t=!0;return _context62.a(3,13);case 10:_context62.n=12;break;case 11:_V6=!!Q.ops;_tt6=(U=Q.node)==null?void 0:U.consumeService({op:Q.animationWorkData||[],isFullWork:_V6,replaceId:J});_g3=(K=Q.node)==null?void 0:K.updataOptService(Q.updateNodeOpt);if(_V6){if(_tt6=Kt(_tt6,_g3),(j=e.render)==null||j.push({isClear:!0,rect:Kt(Q.oldRect,_tt6),clearCanvas:$t.Bg,viewId:_this95.viewId}),(nt=e.render)==null||nt.push({rect:Kt(Q.oldRect,_tt6),drawCanvas:$t.Bg,viewId:_this95.viewId}),(ct=Q.updateNodeOpt)!=null&&ct.useAnimation&&((B=e.render)==null||B.push({isClear:!0,rect:Kt(Q.oldRect,_tt6),clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}),(N=e.render)==null||N.push({rect:Kt(Q.oldRect,_tt6),drawCanvas:$t.ServiceFloat,viewId:_this95.viewId}),!Q.isEnableCursor&&(G=Q.animationWorkData)!=null&&G.length)){_T3=Q.animationWorkData.slice(-3,-1);n.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T3,uid:(q=Q.updateNodeOpt)==null?void 0:q.uid});}_this95.selectorWorkShapes.forEach(function(T,k){var Z;(Z=T.selectIds)!=null&&Z.includes(J)&&(_this95.willRunEffectSelectorIds.add(k),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt6),_this95.runEffect());}),(at=Q.node)==null||at.clearTmpPoints(),_this95.workShapes.delete(J);}else _tt6=Kt(_tt6,_g3),(ut=e.render)==null||ut.push({isClear:!0,rect:Kt(Q.oldRect,_tt6),clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}),(Ct=e.render)==null||Ct.push({rect:Kt(Q.oldRect,_tt6),drawCanvas:$t.ServiceFloat,viewId:_this95.viewId});case 12:return _context62.a(3,13);case 13:return _context62.a(2);}},_loop6);});_iterator97.s();case 2:if((_step97=_iterator97.n()).done){_context63.n=4;break;}return _context63.d(_regeneratorValues(_loop6()),3);case 3:_context63.n=2;break;case 4:_context63.n=6;break;case 5:_context63.p=5;_t57=_context63.v;_iterator97.e(_t57);case 6:_context63.p=6;_iterator97.f();return _context63.f(6);case 7:t&&this.runAnimation();n.size&&(e.sp=e.sp||[],n.forEach(function(J,Q){var V;(V=e.sp)==null||V.push({type:It.Cursor,uid:J.uid||Q.split(Fo)[0],op:J.op,workState:J.workState,cursorTool:J.cursorTool,viewId:_this95.viewId});}));_t58=(O=e.render)!=null&&O.length||(D=e.sp)!=null&&D.length;if(!_t58){_context63.n=8;break;}_context63.n=8;return this.post(e);case 8:return _context63.a(2);}},_callee61,this,[[1,5,6,7]]);}));function animationDraw(){return _animationDraw.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;this.animationScheduler.request(t);}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(t,e){var n=Math.floor((t.animationWorkData||[]).slice(t.animationIndex).length*48/e/this.syncUnitTime)*e;return Math.min((t.animationIndex||0)+(n||e),(t.animationWorkData||[]).length);}},{key:"runEffect",value:function runEffect(){this.effectScheduler.request();}},{key:"effectRunSelector",value:function(){var _effectRunSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee62(){var _this96=this;var t,_t59;return _regenerator().w(function(_context64){while(1)switch(_context64.n){case 0:t=this.noAnimationRect;this.willRunEffectSelectorIds.forEach(function(e){var s,o;var n=_this96.selectorWorkShapes.get(e),i=n&&n.selectIds&&((s=n.node)==null?void 0:s.selectServiceNode(e,n,!0));t=Kt(t,i),(o=n==null?void 0:n.selectIds)!=null&&o.length||_this96.selectorWorkShapes.delete(e);});_t59=t;if(!_t59){_context64.n=1;break;}_context64.n=1;return this.post({render:[{rect:me(t),isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId},{rect:me(t),drawCanvas:$t.Bg,viewId:this.viewId}]});case 1:this.willRunEffectSelectorIds.clear();this.noAnimationRect=void 0;case 2:return _context64.a(2);}},_callee62,this);}));function effectRunSelector(){return _effectRunSelector.apply(this,arguments);}return effectRunSelector;}()},{key:"flush",value:function(){var _flush=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee63(){return _regenerator().w(function(_context65){while(1)switch(_context65.n){case 0:_context65.n=1;return this.animationScheduler.flush();case 1:_context65.n=2;return this.effectScheduler.flush();case 2:return _context65.a(2);}},_callee63,this);}));function flush(){return _flush.apply(this,arguments);}return flush;}()},{key:"activeSelectorShape",value:function activeSelectorShape(t){var v,p,y;var e=t.workId,n=t.opt,i=t.toolsType,s=t.type,o=t.selectIds,a=t.imageBitmap;if(!e)return;var u=e.toString();if(!((v=this.selectorWorkShapes)!=null&&v.has(u))){var C={toolsType:i,selectIds:o,type:s,opt:n,imageBitmap:a};i&&n&&(C=this.setNodeKey(u,C,i,n)),(p=this.selectorWorkShapes)==null||p.set(u,C);}var h=(y=this.selectorWorkShapes)==null?void 0:y.get(u);s&&(h.type=s),h.node&&h.node.getWorkId()!==u&&h.node.setWorkId(u),a&&(h.imageBitmap=a),h.selectIds=o||[];}}]);}();var pMt=/*#__PURE__*/function(_zv2){function pMt(e){var _this97;_classCallCheck(this,pMt);_this97=_callSuper(this,pMt,[e]);ht(_this97,"drawWorkActiveId");return _this97;}_inherits(pMt,_zv2);return _createClass(pMt,[{key:"runSelectWork",value:function runSelectWork(e){var i;var n=this.setFullWork(e);n&&(i=e.selectIds)!=null&&i.length&&e.workId&&n.selectServiceNode(e.workId.toString(),{selectIds:e.selectIds},!1);}},{key:"workShapesDone",value:function workShapesDone(){var _iterator98=_createForOfIteratorHelper(this.workShapes.keys()),_step98;try{for(_iterator98.s();!(_step98=_iterator98.n()).done;){var e=_step98.value;this.clearWorkShapeNodeCache(e);}}catch(err){_iterator98.e(err);}finally{_iterator98.f();}Kr(this.fullLayer,this.fullLayer.parent);}},{key:"consumeDraw",value:function(){var _consumeDraw3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee64(e){var n,i,s,o,a,u,h,_t60,_t61,_t62,_t63,_t64,_t65,_t66,_t67,_t68;return _regenerator().w(function(_context66){while(1)switch(_context66.n){case 0:n=e.workId,i=e.fullWorkerDrawCount,s=e.postCount,o=n==null?void 0:n.toString(),a=o&&this.workShapes.get(o);if(a){_context66.n=4;break;}_t60=o&&$e(s);if(!_t60){_context66.n=2;break;}_context66.n=1;return this.drawAckBackpressure.wait(o);case 1:_t60=_context66.v;case 2:_t61=_t60;if(!_t61){_context66.n=3;break;}_context66.n=3;return this._post({consumeCount:s,consumeWorkId:o});case 3:return _context66.a(2);case 4:_t62=this.drawWorkActiveId&&this.drawWorkActiveId!==o;if(!_t62){_context66.n=6;break;}_context66.n=5;return this.consumeDrawAll({workId:this.drawWorkActiveId,viewId:this.viewId,msgType:It.DrawWork,dataType:Qt.Local});case 5:this.drawWorkActiveId=void 0;case 6:!this.drawWorkActiveId&&o!==De&&(this.drawWorkActiveId=o);u=a.toolsType;$e(s)&&(this.consumeCount=s);h=a.consume({data:e,drawCount:this.drawCount,isFullWork:!0,isSubWorker:!0,removeDrawCount:i});_t63=u;_context66.n=_t63===St.Selector?7:_t63===St.Ellipse?9:_t63===St.Arrow?9:_t63===St.Straight?9:_t63===St.Rectangle?9:_t63===St.Star?9:_t63===St.Polygon?9:_t63===St.SpeechBalloon?9:_t63===St.Pencil?11:_t63===St.PencilEraser?13:_t63===St.BitMapEraser?16:17;break;case 7:_t64=h;if(!_t64){_context66.n=8;break;}this.drawCount++;_context66.n=8;return this.drawSelector(h);case 8:return _context66.a(3,17);case 9:_t65=h;if(!_t65){_context66.n=10;break;}this.drawCount++;_context66.n=10;return this.drawShape(h);case 10:return _context66.a(3,17);case 11:_t66=h;if(!_t66){_context66.n=12;break;}this.drawCount++;_context66.n=12;return this.drawPencil(h,n==null?void 0:n.toString());case 12:return _context66.a(3,17);case 13:_t67=h;if(!_t67){_context66.n=15;break;}this.drawCount++;_context66.n=14;return this.drawAckBackpressure.wait(o);case 14:_t68=_context66.v;if(!_t68){_context66.n=15;break;}_context66.n=15;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,consumeWorkId:o});case 15:return _context66.a(3,17);case 16:h&&this.drawCount++;return _context66.a(3,17);case 17:return _context66.a(2);}},_callee64,this);}));function consumeDraw(_x109){return _consumeDraw3.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee65(e){var n,i,s,_t69;return _regenerator().w(function(_context67){while(1)switch(_context67.n){case 0:n=e.workId;if(!n){_context67.n=4;break;}i=n.toString();this.drawAckBackpressure.finish(i),this.drawWorkActiveId===i&&(this.drawWorkActiveId=void 0);s=this.workShapes.get(i);if(s){_context67.n=1;break;}return _context67.a(2);case 1:_t69=s.toolsType;_context67.n=_t69===St.Selector?2:_t69===St.Arrow?3:_t69===St.Straight?3:_t69===St.Ellipse?3:_t69===St.Pencil?3:_t69===St.Rectangle?3:_t69===St.Star?3:_t69===St.Polygon?3:_t69===St.SpeechBalloon?3:_t69===St.BitMapEraser?3:_t69===St.PencilEraser?3:4;break;case 2:this.drawCount=0,Kr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(i),this._post({render:[{isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}]});return _context67.a(3,4);case 3:this.drawCount=0,Kr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(i);return _context67.a(3,4);case 4:return _context67.a(2);}},_callee65,this);}));function consumeDrawAll(_x110){return _consumeDrawAll2.apply(this,arguments);}return consumeDrawAll;}()},{key:"removeWork",value:function(){var _removeWork4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee66(e){var n,i,s,o;return _regenerator().w(function(_context68){while(1)switch(_context68.n){case 0:n=e.workId,i=n==null?void 0:n.toString();if(!i){_context68.n=1;break;}s=this.removeNode(i);if(!s){_context68.n=1;break;}o=[];o.push({rect:me(s),clearCanvas:$t.Float,isClear:!0,viewId:this.viewId},{rect:me(s),drawCanvas:$t.Float,viewId:this.viewId});_context68.n=1;return this._post({render:o});case 1:return _context68.a(2);}},_callee66,this);}));function removeWork(_x111){return _removeWork4.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(e){var _this98=this;var n=this.workShapes.has(e);var i;return n&&(this.fullLayer.getElementsByName(e).forEach(function(s){var o=s.getBoundingClientRect();i=Kt(i,{x:o.x-Gt.SafeBorderPadding,y:o.y-Gt.SafeBorderPadding,w:o.width+Gt.SafeBorderPadding*2,h:o.height+Gt.SafeBorderPadding*2}),s.remove(),_zr(s,_this98.fullLayer.parent);}),i&&this.clearWorkShapeNodeCache(e)),i;}},{key:"drawPencil",value:function(){var _drawPencil2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee67(e,n){var _t70,_t71;return _regenerator().w(function(_context69){while(1)switch(_context69.n){case 0:_t70=!n;if(_t70){_context69.n=2;break;}_context69.n=1;return this.drawAckBackpressure.wait(n);case 1:_t70=!_context69.v;case 2:_t71=_t70;if(_t71){_context69.n=3;break;}_context69.n=3;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,consumeWorkId:n,render:[{rect:e==null?void 0:e.rect,workId:n,drawCanvas:$t.Float,viewId:this.viewId}],sp:(e==null?void 0:e.op)&&[e]});case 3:return _context69.a(2);}},_callee67,this);}));function drawPencil(_x112,_x113){return _drawPencil2.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee68(e){return _regenerator().w(function(_context70){while(1)switch(_context70.n){case 0:_context70.n=1;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(e==null?void 0:e.rect)&&me(e.rect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:(e==null?void 0:e.rect)&&me(e.rect),drawCanvas:$t.Float,viewId:this.viewId}]});case 1:return _context70.a(2);}},_callee68,this);}));function drawShape(_x114){return _drawShape2.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee69(e){return _regenerator().w(function(_context71){while(1)switch(_context71.n){case 0:_context71.n=1;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(e==null?void 0:e.rect)&&me(e.rect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:(e==null?void 0:e.rect)&&me(e.rect),drawCanvas:$t.Float,viewId:this.viewId}]});case 1:return _context71.a(2);}},_callee69,this);}));function drawSelector(_x115){return _drawSelector2.apply(this,arguments);}return drawSelector;}()}]);}(zv);var vMt=/*#__PURE__*/function(){function vMt(t){_classCallCheck(this,vMt);ht(this,"viewId");ht(this,"vNodes");ht(this,"topLayer");ht(this,"thread");ht(this,"post");ht(this,"serviceWorkShapes",/* @__PURE__ */new Map());ht(this,"localWorkShapes",/* @__PURE__ */new Map());ht(this,"tmpOpt");ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"animationId");this.viewId=t.viewId,this.vNodes=t.vNodes,this.topLayer=t.topLayer,this.thread=t.thread,this.post=t.thread.post.bind(t.thread);}return _createClass(vMt,[{key:"canUseTopLayer",value:function canUseTopLayer(t){return t===St.LaserPen;}},{key:"getWorkShape",value:function getWorkShape(t){return this.localWorkShapes.get(t);}},{key:"createWorkShape",value:function createWorkShape(t,e){if(t&&this.tmpOpt){var n={toolsType:this.tmpOpt.toolsType,toolsOpt:e||this.tmpOpt.toolsOpt},i=this.createWorkShapeNode(_objectSpread(_objectSpread({},n),{},{workId:t}));return i&&this.localWorkShapes.set(t,{node:i,toolsType:i.toolsType,workState:te.Start}),i;}}},{key:"setWorkOptions",value:function setWorkOptions(t,e){var i;var n=(i=this.localWorkShapes.get(t))==null?void 0:i.node;n||this.createWorkShape(t,e),n==null||n.setWorkOptions(e);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(t){var e=t.toolsType;if(e===St.LaserPen)return mf(_objectSpread(_objectSpread({},t),{},{vNodes:this.vNodes,fullLayer:this.topLayer,drawLayer:this.topLayer}));}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.localWorkShapes.forEach(function(t){var e;return(e=t.node)==null?void 0:e.clearTmpPoints();}),this.localWorkShapes.clear();}},{key:"setToolsOpt",value:function setToolsOpt(t){var e;this.tmpOpt=t,(e=t.toolsOpt)!=null&&e.syncUnitTime&&(this.syncUnitTime=t.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"consumeDraw",value:function consumeDraw(t){var e=t.workId,n=t.dataType;if(n===Qt.Service)this.activeServiceWorkShape(t);else{var i=e==null?void 0:e.toString(),s=i&&this.localWorkShapes.get(i);if(!s)return;var o=s.node.consume({data:t,isFullWork:!1,isSubWorker:!0});o.rect&&(s.totalRect=Kt(o.rect,s.totalRect),s.result=o,s.workState=te.Doing,i&&this.localWorkShapes.set(i,s));}this.runAnimation();}},{key:"consumeDrawAll",value:function consumeDrawAll(t){var e=t.workId,n=t.dataType;if(n===Qt.Service)this.activeServiceWorkShape(t);else{var i=e==null?void 0:e.toString(),s=i&&this.localWorkShapes.get(i);if(!s)return;var o=s.node.consumeAll({data:t});s.totalRect=Kt(o.rect,s.totalRect),s.result=o,s.workState=te.Done,i&&this.localWorkShapes.set(i,s);}this.runAnimation();}},{key:"destroy",value:function destroy(){this.serviceWorkShapes.clear(),this.localWorkShapes.clear();}},{key:"setNodeKey",value:function setNodeKey(t,e,n,i){return e.toolsType=n,e.node=this.createWorkShapeNode({workId:t,toolsType:n,toolsOpt:i}),e;}},{key:"activeServiceWorkShape",value:function activeServiceWorkShape(t){var y,C;var e=t.workId,n=t.opt,i=t.toolsType,s=t.type,o=t.updateNodeOpt,a=t.ops,u=t.op;if(!e)return;var h=e.toString(),v=(y=this.vNodes.get(h))==null?void 0:y.rect;if(!((C=this.serviceWorkShapes)!=null&&C.has(h))){var b={toolsType:i,animationWorkData:u||[],animationIndex:0,type:s,updateNodeOpt:o,ops:a,oldRect:v};i&&n&&(b=this.setNodeKey(h,b,i,n)),this.serviceWorkShapes.set(h,b);}var p=this.serviceWorkShapes.get(h);s&&(p.type=s),a&&(p.animationWorkData=ks(a),p.ops=a),o&&(p.updateNodeOpt=o),u&&(p.animationWorkData=u),p.node&&p.node.getWorkId()!==h&&p.node.setWorkId(h),v&&(p.oldRect=v),i&&n?(p.toolsType!==i&&i&&n&&this.setNodeKey(h,p,i,n),p.node&&p.node.setWorkOptions(n)):i&&(p.toolsType=i);}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(t,e){var n=Math.floor((t.animationWorkData||[]).slice(t.animationIndex).length*32/e/this.syncUnitTime)*e;return Math.min((t.animationIndex||0)+(n||e),(t.animationWorkData||[]).length);}},{key:"animationDraw",value:function(){var _animationDraw2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee70(){var _this99=this;var o,a,u,h,t,e,n,i,s,_iterator99,_step99,_step99$value,v,p,C,b,M,L,_iterator100,_step100,_step100$value,_v11,_p6,y,_C4,_b8,_M5,_L18,_t72,_t73,_t74,_t75;return _regenerator().w(function(_context72){while(1)switch(_context72.p=_context72.n){case 0:this.animationId=void 0;t=!1;e=/* @__PURE__ */new Map(),n=[],i=[],s=[];_iterator99=_createForOfIteratorHelper(this.serviceWorkShapes.entries());_context72.p=1;_iterator99.s();case 2:if((_step99=_iterator99.n()).done){_context72.n=6;break;}_step99$value=_slicedToArray(_step99.value,2),v=_step99$value[0],p=_step99$value[1];_t72=p.toolsType;_context72.n=_t72===St.LaserPen?3:5;break;case 3:C=this.computNextAnimationIndex(p,8),b=Math.max(0,p.animationIndex||0),M=(p.animationWorkData||[]).slice(b,C);if((p.animationIndex||0)<C){L=(o=p.node)==null?void 0:o.consumeService({op:M,isFullWork:!1});p.totalRect=Kt(p.totalRect,L),p.animationIndex=C,M.length&&e.set(v,{cursorTool:Fn(p.toolsType),workState:b===0?te.Start:C===((a=p.animationWorkData)==null?void 0:a.length)?te.Done:te.Doing,op:M.slice(-2)});}if(!(i.push({isClear:!0,rect:p.totalRect,clearCanvas:$t.TopFloat,viewId:this.viewId}),n.push({rect:p.totalRect,drawCanvas:$t.TopFloat,viewId:this.viewId}),p.isDel)){_context72.n=4;break;}(u=p.node)==null||u.clearTmpPoints(),this.serviceWorkShapes.delete(v);return _context72.a(3,5);case 4:p.ops&&p.animationIndex===((h=p.animationWorkData)==null?void 0:h.length)&&!p.isDel&&(this.topLayer.getElementsByName(v.toString())[0]||(p.isDel=!0,this.serviceWorkShapes.set(v,p))),t=!0;return _context72.a(3,5);case 5:_context72.n=2;break;case 6:_context72.n=8;break;case 7:_context72.p=7;_t73=_context72.v;_iterator99.e(_t73);case 8:_context72.p=8;_iterator99.f();return _context72.f(8);case 9:_iterator100=_createForOfIteratorHelper(this.localWorkShapes.entries());_context72.p=10;_iterator100.s();case 11:if((_step100=_iterator100.n()).done){_context72.n=15;break;}_step100$value=_slicedToArray(_step100.value,2),_v11=_step100$value[0],_p6=_step100$value[1];y=_p6.result,_C4=_p6.toolsType,_b8=_p6.totalRect,_M5=_p6.isDel,_L18=_p6.workState;_t74=_C4;_context72.n=_t74===St.LaserPen?12:14;break;case 12:if(!(_b8&&(i.push({isClear:!0,rect:_b8,clearCanvas:$t.TopFloat,viewId:this.viewId}),n.push({rect:_b8,drawCanvas:$t.TopFloat,viewId:this.viewId})),_M5)){_context72.n=13;break;}_p6.node.clearTmpPoints(),this.localWorkShapes.delete(_v11),s.push({removeIds:[_v11.toString()],viewId:this.viewId,type:It.RemoveNode});return _context72.a(3,14);case 13:y&&((y.op||y.ops)&&s.push(y),_p6.result=void 0),!this.topLayer.getElementsByName(_v11.toString())[0]&&_L18===te.Done&&(_p6.isDel=!0,this.localWorkShapes.set(_v11,_p6)),t=!0;return _context72.a(3,14);case 14:_context72.n=11;break;case 15:_context72.n=17;break;case 16:_context72.p=16;_t75=_context72.v;_iterator100.e(_t75);case 17:_context72.p=17;_iterator100.f();return _context72.f(17);case 18:t&&this.runAnimation(),e.size&&e.forEach(function(v,p){s.push({type:It.Cursor,uid:p.split(Fo)[0],op:v.op,workState:v.workState,cursorTool:v.cursorTool,viewId:_this99.viewId});}),(n.length||i.length||s.length)&&this.post({render:[].concat(i,n),sp:s});case 19:return _context72.a(2);}},_callee70,this,[[10,16,17,18],[1,7,8,9]]);}));function animationDraw(){return _animationDraw2.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this100=this;this.animationId||(this.animationId=setTimeout(function(){_this100.animationId=void 0,_this100.animationDraw();},16));}}]);}();var gMt=/*#__PURE__*/function(_ZT){function gMt(e){var _this101;_classCallCheck(this,gMt);_this101=_callSuper(this,gMt,[e]);ht(_this101,"_type","simple");return _this101;}_inherits(gMt,_ZT);return _createClass(gMt,[{key:"createWorkShapeNode",value:function createWorkShapeNode(e){var i;var n=e.toolsType;return n===St.Selector?this.vNodes?new Ka(_objectSpread(_objectSpread({},e),{},{fullLayer:this.fullLayer,vNodes:this.vNodes,drawLayer:this.drawLayer})):void 0:mf(_objectSpread(_objectSpread({},e),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(i=this.thread)==null?void 0:i.serviceWork);}},{key:"drawPencil",value:function(){var _drawPencil3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee71(e,n){var _t76,_t77;return _regenerator().w(function(_context73){while(1)switch(_context73.n){case 0:_t76=!n;if(_t76){_context73.n=2;break;}_context73.n=1;return this.drawAckBackpressure.wait(n);case 1:_t76=!_context73.v;case 2:_t77=_t76;if(_t77){_context73.n=3;break;}_context73.n=3;return this._post({consumeCount:this.consumeCount,consumeWorkId:n,render:[{rect:e==null?void 0:e.rect,workId:n,drawCanvas:$t.Float,viewId:this.viewId}],sp:(e==null?void 0:e.op)&&[e]});case 3:return _context73.a(2);}},_callee71,this);}));function drawPencil(_x116,_x117){return _drawPencil3.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee72(e){return _regenerator().w(function(_context74){while(1)switch(_context74.n){case 0:_context74.n=1;return this._post({consumeCount:this.consumeCount,sp:(e==null?void 0:e.op)&&[e],render:[{rect:(e==null?void 0:e.rect)&&me(e.rect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:(e==null?void 0:e.rect)&&me(e.rect),drawCanvas:$t.Float,viewId:this.viewId}]});case 1:return _context74.a(2);}},_callee72,this);}));function drawShape(_x118){return _drawShape3.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee73(e,n,i){var s,a,u,h,v,o,_args75=arguments;return _regenerator().w(function(_context75){while(1)switch(_context75.n){case 0:s=_args75.length>3&&_args75[3]!==undefined?_args75[3]:[];o={render:s,sp:[e],consumeCount:this.consumeCount};(a=o.sp)==null||a.push({type:It.SelectorTransform,emitEventType:ve.SelectMethod,workState:n});i&&((u=o.sp)==null||u.push({type:It.None,isLockSentEventCursor:i}));e.subRect&&((h=o.render)==null||h.push({rect:me(e.subRect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:me(e.subRect),drawCanvas:$t.Float,viewId:this.viewId}));e.rect&&((v=o.render)==null||v.push({rect:me(e.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(e.rect),drawCanvas:$t.Bg,viewId:this.viewId}));_context75.n=1;return this._post(o);case 1:return _context75.a(2);}},_callee73,this);}));function drawSelector(_x119,_x120,_x121){return _drawSelector3.apply(this,arguments);}return drawSelector;}()},{key:"postEraserBatch",value:function(){var _postEraserBatch2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee74(e,n,i,s,o){var u,h,v,p,a,y,C,b,M,_iterator101,_step101,_step101$value,_M6,L;return _regenerator().w(function(_context76){while(1)switch(_context76.n){case 0:a=(u=this.workShapes.get(e))==null?void 0:u.combineConsume({workerEngine:this});if(!(a||o)){_context76.n=1;break;}y=a==null?void 0:a.willDeleteNodes,C=a==null?void 0:a.willNewNodes,b=_objectSpread({render:[],sp:[]},o);if(a!=null&&a.rect){M=me(a.rect);(h=b.render)==null||h.push({rect:M,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e},{rect:M,drawCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e});}if(y!=null&&y.size&&((v=b.sp)==null||v.push({type:It.RemoveNode,removeIds:_toConsumableArray(y),viewId:this.thread.viewId})),C!=null&&C.size){_iterator101=_createForOfIteratorHelper(C);try{for(_iterator101.s();!(_step101=_iterator101.n()).done;){_step101$value=_slicedToArray(_step101.value,2),_M6=_step101$value[0],L=_step101$value[1];(p=b.sp)==null||p.push({type:It.FullWork,dataType:Qt.Local,toolsType:St.Pencil,ops:Br(L.op),opt:L.opt,workId:_M6,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator101.e(err);}finally{_iterator101.f();}}_context76.n=1;return this._post(b);case 1:return _context76.a(2);}},_callee74,this);}));function postEraserBatch(_x122,_x123,_x124,_x125,_x126){return _postEraserBatch2.apply(this,arguments);}return postEraserBatch;}()},{key:"consumeDraw",value:function(){var _consumeDraw4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee75(e,n){var _this102=this;var i,s,o,a,u,h,v,p,y,_t78,_t79,_t80,_t81;return _regenerator().w(function(_context77){while(1)switch(_context77.n){case 0:i=e.op,s=e.workId,o=e.scenePath,a=e.postCount,u=e.smoothSync;if(!(i!=null&&i.length&&s)){_context77.n=18;break;}h=s.toString(),v=this.getWorkShape(h);if(v){_context77.n=1;break;}return _context77.a(2);case 1:p=v.toolsType;if(!(p===St.LaserPen)){_context77.n=2;break;}return _context77.a(2);case 2:_t78=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_t78){_context77.n=4;break;}_context77.n=3;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:o,viewId:this.viewId,msgType:It.DrawWork,dataType:Qt.Local},n);case 3:this.drawWorkActiveId=void 0;case 4:!this.drawWorkActiveId&&h!==De&&(this.drawWorkActiveId=h);$e(a)&&(this.consumeCount=a);y=v.consume({data:e,isSimpleWorker:!0,smoothSync:u});_t79=p;_context77.n=_t79===St.Selector?5:_t79===St.PencilEraser?7:_t79===St.BitMapEraser?10:_t79===St.Eraser?12:_t79===St.Arrow?14:_t79===St.Straight?14:_t79===St.Ellipse?14:_t79===St.Rectangle?14:_t79===St.Star?14:_t79===St.Polygon?14:_t79===St.SpeechBalloon?14:_t79===St.Pencil?16:18;break;case 5:this.drawCount++;y.type===It.Select&&y.selectIds&&n.runReverseSelectWork(y.selectIds);_context77.n=6;return this.drawSelector(_objectSpread(_objectSpread({},y),{},{isSelecting:!0}),e.workState||te.Doing);case 6:return _context77.a(3,18);case 7:this.drawCount++;this.combineDrawActiveId=h;this.eraserBatchScheduler.schedule(function(){_this102.drawPencilEraserCombine(h,_this102.drawCount);},this.eraserBatchDelay);_context77.n=8;return this.drawAckBackpressure.wait(h);case 8:_t80=_context77.v;if(!_t80){_context77.n=9;break;}_context77.n=9;return this._post({consumeCount:this.consumeCount,consumeWorkId:h});case 9:return _context77.a(3,18);case 10:this.drawCount++;this.combineDrawActiveId=h;_context77.n=11;return this.enqueueBitmapEraserRender(h,this.drawCount,void 0,void 0,{consumeCount:this.consumeCount,consumeWorkId:h});case 11:return _context77.a(3,18);case 12:_context77.n=13;return this.drawEraser(y);case 13:return _context77.a(3,18);case 14:_t81=y;if(!_t81){_context77.n=15;break;}this.drawCount++;_context77.n=15;return this.drawShape(y);case 15:return _context77.a(3,18);case 16:this.drawCount++;_context77.n=17;return this.drawPencil(y,h);case 17:return _context77.a(3,18);case 18:return _context77.a(2);}},_callee75,this);}));function consumeDraw(_x127,_x128){return _consumeDraw4.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee76(e,n){var a,u,h,i,s,o,v,p,y,C,b,M,L,_t82;return _regenerator().w(function(_context78){while(1)switch(_context78.p=_context78.n){case 0:this.eraserBatchScheduler.cancel(),this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);i=e.workId,s=e.scenePath,o=e.isLockSentEventCursor;if(!i){_context78.n=12;break;}v=i.toString();this.drawAckBackpressure.finish(v),this.combineDrawActiveId===v&&(this.combineDrawActiveId=void 0),this.drawWorkActiveId===v&&(this.drawWorkActiveId=void 0);p=this.workShapes.get(v);if(p){_context78.n=1;break;}return _context78.a(2);case 1:y=p.toolsType;if(!(y===St.LaserPen)){_context78.n=2;break;}return _context78.a(2);case 2:C=this.workShapes.get(Lo);b=(a=C==null?void 0:C.selectIds)==null?void 0:a[0];_context78.n=3;return p.consumeAll({data:e,workerEngine:this});case 3:M=_context78.v;_t82=y;_context78.n=_t82===St.Selector?4:_t82===St.PencilEraser?6:_t82===St.BitMapEraser?6:_t82===St.Eraser?9:_t82===St.Arrow?10:_t82===St.Straight?10:_t82===St.Ellipse?10:_t82===St.Rectangle?10:_t82===St.Star?10:_t82===St.Polygon?10:_t82===St.SpeechBalloon?10:_t82===St.Pencil?10:12;break;case 4:L=[];this.drawLayer&&(this.drawCount=0,Kr(this.drawLayer,this.drawLayer.parent),this.getWorkShape(v).clearSubTmpPoints(),L.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}));M.selectIds&&b&&(u=M.selectIds)!=null&&u.includes(b)&&C.cursorBlur();M.selectIds&&n.runReverseSelectWork(M.selectIds);_context78.n=5;return this.drawSelector(_objectSpread(_objectSpread({},M),{},{scenePath:s,isSelecting:!1}),te.Done,o,L);case 5:(h=p.selectIds)!=null&&h.length?p.clearTmpPoints():this.clearWorkShapeNodeCache(v);return _context78.a(3,12);case 6:_context78.p=6;_context78.n=7;return this.drawEraserFull(p,_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker);case 7:_context78.p=7;this.drawCount=0,this.clearWorkShapeNodeCache(v);return _context78.f(7);case 8:return _context78.a(3,12);case 9:this.drawEraser(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker),p.clearTmpPoints();return _context78.a(3,12);case 10:_context78.n=11;return this.drawPencilFull(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker,y);case 11:this.drawCount=0;this.clearWorkShapeNodeCache(v);return _context78.a(3,12);case 12:return _context78.a(2);}},_callee76,this,[[6,,7,8]]);}));function consumeDrawAll(_x129,_x130){return _consumeDrawAll3.apply(this,arguments);}return consumeDrawAll;}()}]);}(ZT);var mMt=/*#__PURE__*/function(_qT){function mMt(e){var _this103;_classCallCheck(this,mMt);_this103=_callSuper(this,mMt,[e]);ht(_this103,"_type","simple");return _this103;}_inherits(mMt,_qT);return _createClass(mMt,[{key:"animationDraw",value:function(){var _animationDraw3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee77(){var _this104=this;var s,o,a,u,h,v,p,y,C,b,M,L,X,Y,et,A,w,S,x,P,z,U,K,j,nt,ct,B,N,G,q,at,ut,Ct,R,$,_,H,lt,dt,wt,Et,Ot,O,D,e,n,i,_iterator102,_step102,_loop7,_t84,_t85;return _regenerator().w(function(_context80){while(1)switch(_context80.p=_context80.n){case 0:e=!1;n={render:[]},i=/* @__PURE__ */new Map();_iterator102=_createForOfIteratorHelper(this.workShapes.entries());_context80.p=1;_loop7=/*#__PURE__*/_regenerator().m(function _loop7(){var _step102$value,J,Q,V,tt,_V7,_tt7,_V8,_tt8,_V9,_tt9,g,T,_V0,_tt0,_g4,_T4,k,Z,st,_Z3,_V1,_tt1,_g5,_T5,_t83;return _regenerator().w(function(_context79){while(1)switch(_context79.n){case 0:_step102$value=_slicedToArray(_step102.value,2),J=_step102$value[0],Q=_step102$value[1];_t83=Q.toolsType;_context79.n=_t83===St.BackgroundSVG?1:_t83===St.Image?2:_t83===St.Text?4:_t83===St.Arrow?7:_t83===St.Straight?7:_t83===St.Rectangle?7:_t83===St.Ellipse?7:_t83===St.Star?7:_t83===St.Polygon?7:_t83===St.SpeechBalloon?7:_t83===St.Pencil?8:13;break;case 1:V=Q.oldRect;V&&((s=n.render)==null||s.push({rect:V,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(o=n.render)==null||o.push({rect:V,drawCanvas:$t.Bg,viewId:_this104.viewId}));tt=Q.node.consumeService({isFullWork:!0,replaceId:J});_this104.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this104.willRunEffectSelectorIds.add(T),_this104.noAnimationRect=Kt(_this104.noAnimationRect,V),_this104.noAnimationRect=Kt(_this104.noAnimationRect,tt),_this104.runEffect());}),_this104.workShapes.delete(J),(a=n.render)==null||a.push({rect:tt,drawCanvas:$t.Bg,viewId:_this104.viewId});return _context79.a(3,13);case 2:_V7=Q.oldRect;_V7&&((u=n.render)==null||u.push({rect:_V7,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(h=n.render)==null||h.push({rect:_V7,drawCanvas:$t.Bg,viewId:_this104.viewId}));_context79.n=3;return(v=Q.node)==null?void 0:v.consumeServiceAsync({isFullWork:!0,worker:_this104.thread});case 3:_tt7=_context79.v;_this104.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this104.willRunEffectSelectorIds.add(T),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_V7),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt7),_this104.runEffect());}),_this104.workShapes.delete(J),(p=n.render)==null||p.push({rect:_tt7,drawCanvas:$t.Bg,viewId:_this104.viewId});return _context79.a(3,13);case 4:if(!Q.node){_context79.n=6;break;}_V8=Q.oldRect;_V8&&((y=n.render)==null||y.push({rect:_V8,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(C=n.render)==null||C.push({rect:_V8,drawCanvas:$t.Bg,viewId:_this104.viewId}));_context79.n=5;return Q.node.consumeServiceAsync({isFullWork:!0,replaceId:J,boxRect:_this104.thread.getSceneRect()});case 5:_tt8=_context79.v;_this104.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this104.willRunEffectSelectorIds.add(T),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_V8),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt8),_this104.runEffect());}),Q.refreshTextRender&&Q.requestId&&(n.sp=n.sp||[],n.sp.push({type:It.RefreshTextRender,requestId:Q.requestId,workId:J,viewId:_this104.viewId})),(b=Q.node)==null||b.clearTmpPoints(),_this104.workShapes.delete(J),(M=n.render)==null||M.push({rect:_tt8,drawCanvas:$t.Bg,viewId:_this104.viewId});case 6:return _context79.a(3,13);case 7:_V9=!!Q.ops;if((L=Q.animationWorkData)!=null&&L.length){_tt9=Q.oldRect,g=Q.node.oldRect;_tt9&&((X=n.render)==null||X.push({rect:_tt9,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(Y=n.render)==null||Y.push({rect:_tt9,drawCanvas:$t.Bg,viewId:_this104.viewId})),g&&((et=n.render)==null||et.push({rect:g,isClear:!0,clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}));T=(A=Q.node)==null?void 0:A.consumeService({op:Q.animationWorkData,isFullWork:_V9});Q.isEnableCursor?i.set(J,{cursorTool:Fn(Q.toolsType),workState:_tt9?Q.ops?te.Done:te.Doing:te.Start,op:Q.animationWorkData.slice(-3,-1)}):_V9&&!Q.useAnimation&&(w=Q.updateNodeOpt)!=null&&w.useAnimation&&i.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:Q.animationWorkData.slice(-3,-1),uid:(S=Q.updateNodeOpt)==null?void 0:S.uid}),_V9?(_this104.selectorWorkShapes.forEach(function(k,Z){var st;(st=k.selectIds)!=null&&st.includes(J)&&(_this104.willRunEffectSelectorIds.add(Z),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt9),_this104.noAnimationRect=Kt(_this104.noAnimationRect,g),_this104.noAnimationRect=Kt(_this104.noAnimationRect,T),_this104.runEffect());}),(x=Q.node)==null||x.clearTmpPoints(),_this104.workShapes.delete(J),(P=n.render)==null||P.push({rect:T,drawCanvas:$t.Bg,viewId:_this104.viewId})):(z=n.render)==null||z.push({rect:T,drawCanvas:$t.ServiceFloat,workerType:_V9?void 0:Qt.Service,viewId:_this104.viewId}),Q.animationWorkData.length=0;}return _context79.a(3,13);case 8:if(!Q.useAnimation){_context79.n=11;break;}if(!Q.useAnimation){_context79.n=10;break;}if(!Q.isDel){_context79.n=9;break;}(R=Q.node)==null||R.clearTmpPoints(),_this104.workShapes.delete(J);return _context79.a(3,13);case 9:_V0=3,_tt0=_this104.computNextAnimationIndex(Q,_V0),_g4=Q.isDiff?0:Math.max(0,(Q.animationIndex||0)-_V0),_T4=(Q.animationWorkData||[]).slice(0,_tt0),k=(_=($=Q.node)==null?void 0:$.getWorkId())==null?void 0:_.toString();if((Q.animationIndex||0)<_tt0||Q.isDiff){Z=(H=Q.node)==null?void 0:H.consumeService({op:_T4,isFullWork:!1,replaceId:k});if((lt=n.render)==null||lt.push({isClear:!0,rect:Z,clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}),(dt=n.render)==null||dt.push({rect:Z,drawCanvas:$t.ServiceFloat,viewId:_this104.viewId}),Q.animationIndex=_tt0,Q.isDiff&&(Q.isDiff=!1),_T4.length&&Q.isEnableCursor){st=_T4.slice(-3,-1);i.set(J,{cursorTool:Fn(Q.toolsType),workState:_g4===0?te.Start:_tt0===((wt=Q.animationWorkData)==null?void 0:wt.length)?te.Done:te.Doing,op:st});}}else if(Q.ops){_Z3=(Et=Q.node)==null?void 0:Et.consumeService({op:Q.animationWorkData||[],isFullWork:!0,replaceId:k});Q.isDel=!0,(Ot=n.render)==null||Ot.push({isClear:!0,rect:_Z3,clearCanvas:$t.ServiceFloat,viewId:_this104.viewId},{rect:_Z3,drawCanvas:$t.ServiceFloat,viewId:_this104.viewId},{isClear:!0,rect:_Z3,clearCanvas:$t.Bg,viewId:_this104.viewId},{rect:_Z3,drawCanvas:$t.Bg,viewId:_this104.viewId}),Q.isEnableCursor&&i.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T4.slice(-3,-1)});}e=!0;return _context79.a(3,13);case 10:_context79.n=12;break;case 11:_V1=!!Q.ops;_tt1=(U=Q.node)==null?void 0:U.consumeService({op:Q.animationWorkData||[],isFullWork:_V1,replaceId:J});_g5=(K=Q.node)==null?void 0:K.updataOptService(Q.updateNodeOpt);if(_V1){if(_tt1=Kt(_tt1,_g5),(j=n.render)==null||j.push({isClear:!0,rect:Kt(Q.oldRect,_tt1),clearCanvas:$t.Bg,viewId:_this104.viewId}),(nt=n.render)==null||nt.push({rect:Kt(Q.oldRect,_tt1),drawCanvas:$t.Bg,viewId:_this104.viewId}),(ct=Q.updateNodeOpt)!=null&&ct.useAnimation&&((B=n.render)==null||B.push({isClear:!0,rect:Kt(Q.oldRect,_tt1),clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}),(N=n.render)==null||N.push({rect:Kt(Q.oldRect,_tt1),drawCanvas:$t.ServiceFloat,viewId:_this104.viewId}),!Q.isEnableCursor&&(G=Q.animationWorkData)!=null&&G.length)){_T5=Q.animationWorkData.slice(-3,-1);i.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T5,uid:(q=Q.updateNodeOpt)==null?void 0:q.uid});}_this104.selectorWorkShapes.forEach(function(T,k){var Z;(Z=T.selectIds)!=null&&Z.includes(J)&&(_this104.willRunEffectSelectorIds.add(k),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt1),_this104.runEffect());}),(at=Q.node)==null||at.clearTmpPoints(),_this104.workShapes.delete(J);}else _tt1=Kt(_tt1,_g5),(ut=n.render)==null||ut.push({isClear:!0,rect:Kt(Q.oldRect,_tt1),clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}),(Ct=n.render)==null||Ct.push({rect:Kt(Q.oldRect,_tt1),drawCanvas:$t.ServiceFloat,viewId:_this104.viewId});case 12:return _context79.a(3,13);case 13:return _context79.a(2);}},_loop7);});_iterator102.s();case 2:if((_step102=_iterator102.n()).done){_context80.n=4;break;}return _context80.d(_regeneratorValues(_loop7()),3);case 3:_context80.n=2;break;case 4:_context80.n=6;break;case 5:_context80.p=5;_t84=_context80.v;_iterator102.e(_t84);case 6:_context80.p=6;_iterator102.f();return _context80.f(6);case 7:e&&this.runAnimation();i.size&&(n.sp=n.sp||[],i.forEach(function(J,Q){var V;(V=n.sp)==null||V.push({type:It.Cursor,uid:J.uid||Q.split(Fo)[0],op:J.op,workState:J.workState,cursorTool:J.cursorTool,viewId:_this104.viewId});}));_t85=(O=n.render)!=null&&O.length||(D=n.sp)!=null&&D.length;if(!_t85){_context80.n=8;break;}_context80.n=8;return this.post(n);case 8:return _context80.a(2);}},_callee77,this,[[1,5,6,7]]);}));function animationDraw(){return _animationDraw3.apply(this,arguments);}return animationDraw;}()}]);}(qT);var KT=/*#__PURE__*/function(_zv3){function KT(e){var _this105;_classCallCheck(this,KT);_this105=_callSuper(this,KT,[e]);ht(_this105,"opt");ht(_this105,"scene");ht(_this105,"cameraOpt");ht(_this105,"vNodes");_this105.opt=e,_this105.vNodes=void 0;return _this105;}_inherits(KT,_zv3);return _createClass(KT,[{key:"reportRequestFailure",value:function reportRequestFailure(e,n,i,s){var o=i instanceof Error?i.message:String(i);try{this.thread._post({sp:[{type:It.ReportError,viewId:this.viewId,viewGeneration:this.thread.viewGeneration,scenePath:n.scenePath,requestId:n.requestId,reportBusiness:e,reportStage:s,reportError:o,reportString:"[SnapshotWork] ".concat(e," failed; stage=").concat(s,"; requestId=").concat(n.requestId||"unknown","; error=").concat(o)}]});}catch(a){console.error("[SnapshotWork] ".concat(e," failure report failed"),a);}}},{key:"createSnapshotFullLayer",value:function createSnapshotFullLayer(e,n){this.scene=this.opt.createScene(e),this.fullLayer=this.opt.createLayer("snapshotFullLayer",this.scene,n);}},{key:"destroySnapshotFullLayer",value:function destroySnapshotFullLayer(){var e,n,i;Kr(this.fullLayer,this.fullLayer.parent),(e=this.fullLayer)==null||e.disconnect(),(n=this.fullLayer)==null||n.remove(),(i=this.scene)==null||i.remove(),this.scene=void 0;}},{key:"updateScene",value:function updateScene(e){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");this.scene.attr(_objectSpread({},e));var n=e.width,i=e.height;this.scene.width=n,this.scene.height=i,this.updateLayer({width:n,height:i});}},{key:"updateLayer",value:function updateLayer(e){if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");var n=e.width,i=e.height;this.fullLayer.parent.setAttribute("width",n),this.fullLayer.parent.setAttribute("height",i),this.fullLayer.setAttribute("size",[n,i]),this.fullLayer.setAttribute("pos",[n*0.5,i*0.5]);}},{key:"setCameraOpt",value:function setCameraOpt(e){this.cameraOpt=e;var n=e.scale,i=e.centerX,s=e.centerY,o=e.width,a=e.height;if(!this.scene)throw new Error("SnapshotWork scene is not initialized");if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");(o!==this.scene.width||a!==this.scene.height)&&this.updateScene({width:o,height:a}),this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-i,-s]);}},{key:"getOffscreen",value:function getOffscreen(){var n;return((n=this.fullLayer)==null?void 0:n.parent).canvas;}},{key:"getRectImageBitmap",value:function getRectImageBitmap(e,n){var i=e.rect,s=this.thread.dpr,o=Math.floor(i.x*s),a=Math.floor(i.y*s),u=Math.floor(i.w*s),h=Math.floor(i.h*s);return createImageBitmap(this.getOffscreen(),o,a,u,h,n);}},{key:"getSnapshot",value:function(){var _getSnapshot=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee78(e){var n,i,s,o,a,u,_i12,_Object$entries,_Object$entries$_i,v,p,y,C,h,_t86,_t87;return _regenerator().w(function(_context81){while(1)switch(_context81.p=_context81.n){case 0:n=e.scenePath,i=e.scenes,s=e.cameraOpt,o=e.w,a=e.h,u=e.requestId;_context81.p=1;if(n&&i&&s&&this.fullLayer){_context81.n=2;break;}throw new Error("snapshot input is incomplete");case 2:this.setCameraOpt(s);_i12=0,_Object$entries=Object.entries(i);case 3:if(!(_i12<_Object$entries.length)){_context81.n=8;break;}_Object$entries$_i=_slicedToArray(_Object$entries[_i12],2),v=_Object$entries$_i[0],p=_Object$entries$_i[1];if(!(p!=null&&p.type)){_context81.n=7;break;}_t86=p==null?void 0:p.type;_context81.n=_t86===It.UpdateNode?4:_t86===It.FullWork?4:6;break;case 4:y=p.opt,C=_objectSpread(_objectSpread({},p),{},{opt:y,workId:v,msgType:It.FullWork,dataType:Qt.Service,viewId:this.viewId,requestId:u});_context81.n=5;return this.runFullWork(C);case 5:return _context81.a(3,7);case 6:return _context81.a(3,7);case 7:_i12++;_context81.n=3;break;case 8:o&&a&&(h={resizeWidth:o,resizeHeight:a});_context81.n=9;return this.getSnapshotRender({scenePath:n,options:h,requestId:u});case 9:_context81.n=11;break;case 10:_context81.p=10;_t87=_context81.v;this.reportRequestFailure("snapshot",e,_t87,"render");case 11:return _context81.a(2);}},_callee78,this,[[1,10]]);}));function getSnapshot(_x131){return _getSnapshot.apply(this,arguments);}return getSnapshot;}()},{key:"runFullWork",value:function(){var _runFullWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee79(e){var s,n,i,o,a,u;return _regenerator().w(function(_context82){while(1)switch(_context82.n){case 0:n=this.setFullWork(e),i=e.ops&&ks(e.ops);if(!n){_context82.n=7;break;}u=(s=n.getWorkId())==null?void 0:s.toString();if(!(n.toolsType===St.BackgroundSVG)){_context82.n=1;break;}o=n.consumeService({isFullWork:!0,replaceId:u});_context82.n=6;break;case 1:if(!(n.toolsType===St.Image)){_context82.n=3;break;}_context82.n=2;return n.consumeServiceAsync({isFullWork:!0,worker:this.thread,requestId:e.requestId});case 2:o=_context82.v;_context82.n=6;break;case 3:if(!(n.toolsType===St.Text)){_context82.n=5;break;}_context82.n=4;return n.consumeServiceAsync({isFullWork:!0,replaceId:u,isDrawLabel:!0});case 4:o=_context82.v;_context82.n=6;break;case 5:o=n.consumeService({op:i,isFullWork:!0,replaceId:u}),a=(e==null?void 0:e.updateNodeOpt)&&n.updataOptService(e.updateNodeOpt);case 6:e.workId&&this.workShapes.delete(e.workId.toString());return _context82.a(2,Kt(o,a));case 7:return _context82.a(2);}},_callee79,this);}));function runFullWork(_x132){return _runFullWork.apply(this,arguments);}return runFullWork;}()},{key:"getSceneRect",value:function getSceneRect(){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");var _this$scene2=this.scene,e=_this$scene2.width,n=_this$scene2.height;return{x:0,y:0,w:Math.floor(e),h:Math.floor(n)};}},{key:"getSnapshotRender",value:function(){var _getSnapshotRender=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee80(e){var a,n,i,s,o;return _regenerator().w(function(_context83){while(1)switch(_context83.n){case 0:n=e.scenePath,i=e.options,s=e.requestId;((a=this.fullLayer)==null?void 0:a.parent).render();_context83.n=1;return this.getRectImageBitmap({rect:this.getSceneRect(),drawCanvas:$t.None},i);case 1:o=_context83.v;o&&(this.thread._post({sp:[{type:It.Snapshot,scenePath:n,imageBitmap:o,viewId:this.viewId,index:0,requestId:s}]},[o]),o.close());case 2:return _context83.a(2);}},_callee80,this);}));function getSnapshotRender(_x133){return _getSnapshotRender.apply(this,arguments);}return getSnapshotRender;}()},{key:"getBoundingRect",value:function(){var _getBoundingRect=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee81(e){var n,i,s,o,a,_i13,_Object$entries2,_Object$entries2$_i,u,h,v,_t88,_t89;return _regenerator().w(function(_context84){while(1)switch(_context84.p=_context84.n){case 0:n=e.scenePath,i=e.scenes,s=e.cameraOpt,o=e.requestId;_context84.p=1;if(n&&i&&s&&this.fullLayer){_context84.n=2;break;}throw new Error("bounding-box input is incomplete");case 2:this.setCameraOpt(s);_i13=0,_Object$entries2=Object.entries(i);case 3:if(!(_i13<_Object$entries2.length)){_context84.n=8;break;}_Object$entries2$_i=_slicedToArray(_Object$entries2[_i13],2),u=_Object$entries2$_i[0],h=_Object$entries2$_i[1];if(!(h!=null&&h.type)){_context84.n=7;break;}_t88=h==null?void 0:h.type;_context84.n=_t88===It.UpdateNode?4:_t88===It.FullWork?4:6;break;case 4:_context84.n=5;return this.runFullWork(_objectSpread(_objectSpread({},h),{},{workId:u,msgType:It.FullWork,dataType:Qt.Service,viewId:this.viewId,requestId:o}));case 5:v=_context84.v;a=Kt(a,v);return _context84.a(3,7);case 6:return _context84.a(3,7);case 7:_i13++;_context84.n=3;break;case 8:a?this.thread._post({sp:[{type:It.BoundingBox,scenePath:n,rect:a,viewId:this.viewId,requestId:o}]}):this.thread._post({sp:[{type:It.BoundingBox,scenePath:n,rect:{x:0,y:0,w:0,h:0},viewId:this.viewId,viewGeneration:this.thread.viewGeneration,requestId:o}]});_context84.n=10;break;case 9:_context84.p=9;_t89=_context84.v;this.reportRequestFailure("bounding-box",e,_t89,"compute");case 10:return _context84.a(2);}},_callee81,this,[[1,9]]);}));function getBoundingRect(_x134){return _getBoundingRect.apply(this,arguments);}return getBoundingRect;}()}]);}(zv);var yMt="WEBGL_PROGRAM_UNAVAILABLE";function wMt(r){return typeof r=="string"&&r.includes("No avaliable program");}var Eu=/* @__PURE__ */function(r){return r.Full="full",r.Sub="sub",r;}(Eu||{});function QT(r,t){var e=r==null?void 0:r.canvas,n=t.width,i=t.height,s=e==null?void 0:e.width,o=e==null?void 0:e.height;if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||typeof s!="number"||typeof o!="number"||!Number.isFinite(s)||!Number.isFinite(o)||s<=0||o<=0||n!==s||i!==o){try{t.close();}catch(_unused38){}throw new Error("FullLayer ImageBitmap size mismatch: bitmap=".concat(n,"x").concat(i,"; layer=").concat(s!==null&&s!==void 0?s:"unavailable","x").concat(o!==null&&o!==void 0?o:"unavailable"));}}function JT(r,t,e){var n=[],i=/* @__PURE__ */new Map();var _iterator103=_createForOfIteratorHelper(r),_step103;try{for(_iterator103.s();!(_step103=_iterator103.n()).done;){var s=_step103.value;if(!s.rect)continue;var o=lAt(gr(s.rect),t,e);if(!o)continue;s.rect=o;var a=n.push(s)-1;if(s.drawCanvas!==$t.Bg||o.w<=0||o.h<=0)continue;var h=i.get(s.drawCanvas)||{rect:o,lastIndex:a,workIds:/* @__PURE__ */new Set(),eraseTxnIds:/* @__PURE__ */new Set()};h.rect=Kt(h.rect,o),h.lastIndex=a;var _iterator104=_createForOfIteratorHelper(s.renderWorkIds||[]),_step104;try{for(_iterator104.s();!(_step104=_iterator104.n()).done;){var v=_step104.value;h.workIds.add(v);}}catch(err){_iterator104.e(err);}finally{_iterator104.f();}s.workId!==void 0&&h.workIds.add(s.workId.toString());var _iterator105=_createForOfIteratorHelper(s.renderEraseTxnIds||[]),_step105;try{for(_iterator105.s();!(_step105=_iterator105.n()).done;){var _v12=_step105.value;h.eraseTxnIds.add(_v12);}}catch(err){_iterator105.e(err);}finally{_iterator105.f();}s.eraseTxnId!==void 0&&h.eraseTxnIds.add(s.eraseTxnId),i.set(s.drawCanvas,h);}}catch(err){_iterator103.e(err);}finally{_iterator103.f();}return n.filter(function(s,o){if(s.drawCanvas!==$t.Bg)return!0;var a=i.get(s.drawCanvas);return!a||a.lastIndex!==o?!1:(s.rect=a.rect,s.renderWorkIds=a.workIds.size?_toConsumableArray(a.workIds):void 0,s.renderEraseTxnIds=a.eraseTxnIds.size?_toConsumableArray(a.eraseTxnIds):void 0,!0);});}var SMt=/*#__PURE__*/function(){function SMt(t,e,n){var _this106=this;_classCallCheck(this,SMt);ht(this,"_self");ht(this,"version",Q2);ht(this,"type");ht(this,"createEngine");// protected hasPriorityDraw: boolean = true;
|
|
489
|
-
ht(this,"workThreadMap",/* @__PURE__ */new Map());ht(this,"cameraRenderQueueByView",/* @__PURE__ */new Map());ht(this,"viewGenerationById",/* @__PURE__ */new Map());ht(this,"retainedOffscreenProbeCapabilities");ht(this,"cancelledFontFaceRequests",/* @__PURE__ */new Map());ht(this,"fontFaceRequestCancelers",/* @__PURE__ */new Map());ht(this,"post",function(t,e){t.viewId&&t.viewGeneration===void 0&&(t.viewGeneration=_this106.viewGenerationById.get(t.viewId)),e?_this106._self.postMessage(t,e):_this106._self.postMessage(t);});this._self=t,this.type=e,this.createEngine=n,this.register();}return _createClass(SMt,[{key:"consumeRendererBusinessFailure",value:function consumeRendererBusinessFailure(t,e){return Ws(e)?(e.reported||(e.reported=!0,this.post({sp:[{type:
|
|
490
|
-
},{key:"isFontAvailable",value:function(){var _isFontAvailable=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee85(t,e){var n,i,s,_iterator108,_step108,o,_t96,_t97,_t98,_t99,_t100;return _regenerator().w(function(_context88){while(1)switch(_context88.p=_context88.n){case 0:_context88.p=0;if(!this.isFontFaceRequestCancelled(e)){_context88.n=1;break;}return _context88.a(2,!1);case 1:n=this._self.fonts;if(n){_context88.n=2;break;}return _context88.a(2,!1);case 2:i=!1,s=null;_iterator108=_createForOfIteratorHelper(n);_context88.p=3;_iterator108.s();case 4:if((_step108=_iterator108.n()).done){_context88.n=6;break;}o=_step108.value;if(!(o.family===t)){_context88.n=5;break;}i=!0,s=o;return _context88.a(3,6);case 5:_context88.n=4;break;case 6:_context88.n=8;break;case 7:_context88.p=7;_t96=_context88.v;_iterator108.e(_t96);case 8:_context88.p=8;_iterator108.f();return _context88.f(8);case 9:if(!(!i||!s)){_context88.n=10;break;}return _context88.a(2,!1);case 10:if(!(s.status==="loaded")){_context88.n=11;break;}return _context88.a(2,!0);case 11:_context88.p=11;_context88.n=12;return this.waitForFontFacePromise(s.loaded,e);case 12:return _context88.a(2,!0);case 13:_context88.p=13;_t97=_context88.v;if(!this.isFontFaceRequestCancelled(e)){_context88.n=14;break;}return _context88.a(2,!1);case 14:if(!(n&&typeof n.load=="function")){_context88.n=18;break;}_context88.p=15;_context88.n=16;return this.waitForFontFacePromise(n.load(this.getFontFaceCssValue(t)),e,5e3,"Font load timeout for ".concat(t));case 16:_t98=_context88.v.length;return _context88.a(2,_t98>0);case 17:_context88.p=17;_t99=_context88.v;return _context88.a(2,!1);case 18:return _context88.a(2,!0);case 19:_context88.n=21;break;case 20:_context88.p=20;_t100=_context88.v;return _context88.a(2,!1);case 21:return _context88.a(2);}},_callee85,this,[[15,17],[11,13],[3,7,8,9],[0,20]]);}));function isFontAvailable(_x138,_x139){return _isFontAvailable.apply(this,arguments);}return isFontAvailable;}()},{key:"areFontFacesAvailable",value:function(){var _areFontFacesAvailable=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee86(){var t,e,_iterator109,_step109,n,_args89=arguments,_t101,_t102;return _regenerator().w(function(_context89){while(1)switch(_context89.p=_context89.n){case 0:t=_args89.length>0&&_args89[0]!==undefined?_args89[0]:[];e=_args89.length>1?_args89[1]:undefined;_iterator109=_createForOfIteratorHelper(t);_context89.p=1;_iterator109.s();case 2:if((_step109=_iterator109.n()).done){_context89.n=6;break;}n=_step109.value;_t101=this.isFontFaceRequestCancelled(e);if(_t101){_context89.n=4;break;}_context89.n=3;return this.isFontAvailable(n.fontFamily,e);case 3:_t101=!_context89.v;case 4:if(!_t101){_context89.n=5;break;}return _context89.a(2,!1);case 5:_context89.n=2;break;case 6:_context89.n=8;break;case 7:_context89.p=7;_t102=_context89.v;_iterator109.e(_t102);case 8:_context89.p=8;_iterator109.f();return _context89.f(8);case 9:return _context89.a(2,!0);}},_callee86,this,[[1,7,8,9]]);}));function areFontFacesAvailable(){return _areFontFacesAvailable.apply(this,arguments);}return areFontFacesAvailable;}()},{key:"register",value:function register(){var _this110=this;this._self.onmessage=/*#__PURE__*/function(){var _ref86=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee91(t){var n,i,s,o,a,e,u,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_loop8,_ret,_iterator,_step,_t110;return _regenerator().w(function(_context96){while(1)switch(_context96.p=_context96.n){case 0:e=t.data;if(!e){_context96.n=14;break;}u=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context96.p=1;_loop8=/*#__PURE__*/_regenerator().m(function _loop8(){var h,v,p,y,C,b,M,L,X,A,_A6,w,S,x,P,_A7,_A8,_w5,_A9,_w6,_S4,_x141,z,U,_x141$elapsedMs,_A0,_iterator110,_step110,_loop9,_A1,Y,et,_t106,_t107,_t108,_t109;return _regenerator().w(function(_context95){while(1)switch(_context95.p=_context95.n){case 0:h=_step.value;v=h.msgType,p=h.viewId,y=h.tasksqueue,C=h.mainTasksqueueCount,b=h.cameraTaskId,M=h.fontBuffers,L=h.fontFaces,X=h.requestId;if(!_this110.isStaleViewMessage(h)){_context95.n=1;break;}try{(n=h.imageBitmap)==null||n.close();}catch(_unused44){}return _context95.a(2,0);case 1:if(!(v===It.CancelFontFace)){_context95.n=2;break;}_this110.cancelFontFaceRequest(X);return _context95.a(2,0);case 2:if(!(v===It.CheckFontFace)){_context95.n=5;break;}_context95.n=3;return _this110.areFontFacesAvailable(L,X);case 3:A=_context95.v;if(!_this110.isFontFaceRequestCancelled(X)){_context95.n=4;break;}_this110.clearFontFaceRequestCancellation(X);return _context95.a(2,0);case 4:_this110.post({sp:[{type:It.CheckFontFace,requestId:X,fontFaceCheckResult:A}]}),_this110.clearFontFaceRequestCancellation(X);return _context95.a(2,0);case 5:if(!(v===It.ProbeRenderCapabilities)){_context95.n=9;break;}_this110.retainedOffscreenProbeCapabilities&&(zd(_this110.retainedOffscreenProbeCapabilities),_this110.retainedOffscreenProbeCapabilities=void 0);_A6=h.requestedContextType;w=h.probeTransport==="worker-image-bitmap";if(!w){_context95.n=7;break;}_context95.n=6;return RAt(_A6,h.probeProfile);case 6:_t106=_context95.v;_context95.n=8;break;case 7:_t106=LAt(_A6,h.probeCanvas,h.probeProfile);case 8:S=_t106;x=(i=S.programProbe)==null?void 0:i.imageBitmap;P={type:It.ProbeRenderCapabilities,workerCapabilities:S,requestId:X};try{try{_this110._self.postMessage(P,x?[x]:[]);}catch(z){try{x==null||x.close();}catch(_unused45){}_this110._self.postMessage({type:It.ProbeRenderCapabilities,requestId:X,workerCapabilities:_objectSpread(_objectSpread({},S),{},{contextSupported:!1,programProbe:_objectSpread(_objectSpread({},S.programProbe),{},{passed:!1,stage:"transfer-image-bitmap",error:z instanceof Error?z.message:String(z),imageBitmap:void 0})})});}}finally{w?zd(S):(s=S.programProbe)!=null&&s.passed?_this110.retainedOffscreenProbeCapabilities=S:zd(S);}return _context95.a(2,0);case 9:if(!M){_context95.n=10;break;}_this110.setFontFaces(M,X);return _context95.a(2,0);case 10:if(!(v===It.Console)){_context95.n=11;break;}console.log(_this110);return _context95.a(2,0);case 11:if(!(v===It.Init)){_context95.n=13;break;}_context95.n=12;return _this110.init(h);case 12:_A7=(o=_this110.workThreadMap.get(p))==null?void 0:o.getActualContextType();_this110.type==="full"&&_this110.post({sp:[{type:It.Init,viewId:p,viewGeneration:h.viewGeneration,reportContextType:_A7}]});return _context95.a(2,0);case 13:if(!(v===It.GetImageBitMap)){_context95.n=18;break;}_A8=_this110.workThreadMap.get(p),_w5=_this110.viewGenerationById.get(p);if(!(!_A8||h.viewGeneration!==void 0&&h.viewGeneration!==_w5||_this110.workThreadMap.get(p)!==_A8)){_context95.n=14;break;}try{(a=h.imageBitmap)==null||a.close();}catch(_unused46){}return _context95.a(2,0);case 14:_context95.p=14;_context95.n=15;return _A8.on(h);case 15:_context95.n=17;break;case 16:_context95.p=16;_t107=_context95.v;if(_this110.consumeRendererBusinessFailure(p,_t107)){_context95.n=17;break;}throw _t107;case 17:return _context95.a(2,0);case 18:if(!(v===It.UpdateTools||It.CreateWork,v===It.TasksQueue&&y!=null&&y.size)){_context95.n=26;break;}_A9=y.get(p),_w6=_this110.workThreadMap.get(p),_S4=_this110.viewGenerationById.get(p);if(!(_A9&&_w6)){_context95.n=24;break;}_context95.p=19;_context95.n=20;return _this110.enqueueViewTask(p,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee87(){var _t103;return _regenerator().w(function(_context90){while(1)switch(_context90.n){case 0:_t103=_this110.viewGenerationById.get(p)!==_S4||_this110.workThreadMap.get(p)!==_w6;if(_t103){_context90.n=1;break;}_context90.n=1;return _w6.on(_A9);case 1:return _context90.a(2);}},_callee87);})));case 20:_context95.n=24;break;case 21:_context95.p=21;_t108=_context95.v;if(!(_A9.msgType!==It.UpdateCamera)){_context95.n=23;break;}if(!_this110.consumeRendererBusinessFailure(p,_t108)){_context95.n=22;break;}return _context95.a(2,0);case 22:throw _t108;case 23:z=TAt(_t108),U=Ws(_t108)?_t108:void 0;_x141={code:z?"RENDERER_BUSINESS_TIMEOUT":"RENDERER_BUSINESS_ERROR",business:"updateCamera",message:_t108 instanceof Error?_t108.message:String(_t108),elapsedMs:z?_t108.elapsedMs:void 0,stage:z?_t108.stage:(U==null?void 0:U.stage)||"update-camera",blockingWorks:z?_t108.blockingWorks:void 0,workerType:_this110.type};case 24:if(!(_x141&&$e(b))){_context95.n=25;break;}_this110.type==="full"?_this110.post({viewId:p,viewGeneration:_S4,cameraTaskId:b,cameraTaskStatus:_x141.code==="RENDERER_BUSINESS_TIMEOUT"?"timeout":"failed",cameraTaskError:_x141}):_this110.post({sp:[{type:It.ReportError,viewId:p,reportString:"[updateCamera] ".concat(_x141.code," viewId=").concat(p," taskId=").concat(b," stage=").concat(_x141.stage," elapsedMs=").concat((_x141$elapsedMs=_x141.elapsedMs)!==null&&_x141$elapsedMs!==void 0?_x141$elapsedMs:0," error=").concat(_x141.message)}]});return _context95.a(2,0);case 25:_this110.type==="full"&&$e(C)&&$e(b)&&_this110.post({workerTasksqueueCount:C,cameraTaskId:b,viewId:p,viewGeneration:_S4});return _context95.a(2,0);case 26:if(!(p===Uy)){_context95.n=34;break;}_A0=_toConsumableArray(_this110.workThreadMap.entries());_iterator110=_createForOfIteratorHelper(_A0);_context95.p=27;_loop9=/*#__PURE__*/_regenerator().m(function _loop9(){var _step110$value,w,S,x;return _regenerator().w(function(_context92){while(1)switch(_context92.n){case 0:_step110$value=_slicedToArray(_step110.value,2),w=_step110$value[0],S=_step110$value[1];x=_this110.enqueueViewTask(w,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee88(){var _t104;return _regenerator().w(function(_context91){while(1)switch(_context91.p=_context91.n){case 0:if(!(v===It.Destroy)){_context91.n=1;break;}_this110.workThreadMap.get(w)===S&&(S.destroy(),_this110.workThreadMap.delete(w),_this110.viewGenerationById.set(w,(_this110.viewGenerationById.get(w)||0)+1));return _context91.a(2);case 1:if(!(_this110.workThreadMap.get(w)===S)){_context91.n=5;break;}_context91.p=2;_context91.n=3;return S.on(h);case 3:_context91.n=5;break;case 4:_context91.p=4;_t104=_context91.v;if(_this110.consumeRendererBusinessFailure(w,_t104)){_context91.n=5;break;}throw _t104;case 5:return _context91.a(2);}},_callee88,null,[[2,4]]);})));_context92.n=1;return x;case 1:_this110.cameraRenderQueueByView.get(w)===x&&_this110.cameraRenderQueueByView.delete(w);case 2:return _context92.a(2);}},_loop9);});_iterator110.s();case 28:if((_step110=_iterator110.n()).done){_context95.n=30;break;}return _context95.d(_regeneratorValues(_loop9()),29);case 29:_context95.n=28;break;case 30:_context95.n=32;break;case 31:_context95.p=31;_t109=_context95.v;_iterator110.e(_t109);case 32:_context95.p=32;_iterator110.f();return _context95.f(32);case 33:return _context95.a(2,0);case 34:if(!(v===It.Destroy)){_context95.n=36;break;}_A1=_this110.enqueueViewTask(p,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee89(){var _h$viewGeneration;var w;return _regenerator().w(function(_context93){while(1)switch(_context93.n){case 0:w=_this110.workThreadMap.get(p);w==null||w.destroy(),_this110.workThreadMap.delete(p),_this110.viewGenerationById.set(p,(_h$viewGeneration=h.viewGeneration)!==null&&_h$viewGeneration!==void 0?_h$viewGeneration:(_this110.viewGenerationById.get(p)||0)+1);case 1:return _context93.a(2);}},_callee89);})));_context95.n=35;return _A1;case 35:_this110.cameraRenderQueueByView.get(p)===_A1&&_this110.cameraRenderQueueByView.delete(p);return _context95.a(2,0);case 36:Y=_this110.workThreadMap.get(p);if(Y){_context95.n=37;break;}return _context95.a(2,0);case 37:et=_this110.viewGenerationById.get(p);u.push(_this110.enqueueViewTask(p,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee90(){var _t105;return _regenerator().w(function(_context94){while(1)switch(_context94.p=_context94.n){case 0:if(_this110.viewGenerationById.get(p)!==et||_this110.workThreadMap.get(p)!==Y){_context94.n=4;break;}_context94.p=1;_context94.n=2;return Y.on(h);case 2:_context94.n=4;break;case 3:_context94.p=3;_t105=_context94.v;if(_this110.consumeRendererBusinessFailure(p,_t105)){_context94.n=4;break;}throw _t105;case 4:return _context94.a(2);}},_callee90,null,[[1,3]]);}))));case 38:return _context95.a(2);}},_loop8,null,[[27,31,32,33],[19,21],[14,16]]);});_iterator=_asyncIterator(e.values());case 2:_context96.n=3;return _iterator.next();case 3:if(!(_iteratorAbruptCompletion=!(_step=_context96.v).done)){_context96.n=6;break;}return _context96.d(_regeneratorValues(_loop8()),4);case 4:_ret=_context96.v;if(!(_ret===0)){_context96.n=5;break;}return _context96.a(3,5);case 5:_iteratorAbruptCompletion=false;_context96.n=2;break;case 6:_context96.n=8;break;case 7:_context96.p=7;_t110=_context96.v;_didIteratorError=true;_iteratorError=_t110;case 8:_context96.p=8;_context96.p=9;if(!(_iteratorAbruptCompletion&&_iterator.return!=null)){_context96.n=10;break;}_context96.n=10;return _iterator.return();case 10:_context96.p=10;if(!_didIteratorError){_context96.n=11;break;}throw _iteratorError;case 11:return _context96.f(10);case 12:return _context96.f(8);case 13:_context96.n=14;return Promise.all(u);case 14:return _context96.a(2);}},_callee91,null,[[9,,10,12],[1,7,8,13]]);}));return function(_x140){return _ref86.apply(this,arguments);};}();}}]);}();var TMt=/*#__PURE__*/function(_GT){function TMt(e,n,i){var _this111;_classCallCheck(this,TMt);_this111=_callSuper(this,TMt,[e,n,"sub"/* Sub */]);ht(_this111,"type","sub");ht(_this111,"_post");ht(_this111,"topLayer");ht(_this111,"serviceWork");ht(_this111,"localWork");ht(_this111,"topLayerWork");ht(_this111,"snapshotWork");ht(_this111,"fullLayerFrameSequence",0);_this111._post=i;var s=Jr.bufferSize.sub;_this111.topLayer=n.isUseSimple?void 0:_this111.createLayer("topLayer",_this111.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:s,contextType:"2d"}));var o={thread:_this111,viewId:_this111.viewId,vNodes:_this111.vNodes,fullLayer:_this111.fullLayer,topLayer:_this111.topLayer,isUseSimple:n.isUseSimple};_this111.localWork=new pMt(o),n.isUseSimple||(_this111.topLayerWork=new vMt(o)),_this111.snapshotWork=new KT(_objectSpread(_objectSpread({},o),{},{createScene:_this111.createScene.bind(_this111),createLayer:_this111.createLayer.bind(_this111)})),_this111.vNodes.init(_this111.fullLayer);return _this111;}_inherits(TMt,_GT);return _createClass(TMt,[{key:"combinePost",value:function(){var _combinePost=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee92(e){var _this112=this;var a,u,h,_this$combinePostData,n,i,s,v,_iterator111,_step111,p,y,C,b,o,_t111,_t112,_t113;return _regenerator().w(function(_context97){while(1)switch(_context97.p=_context97.n){case 0:_this$combinePostData=this.combinePostData(),n=_this$combinePostData.render,i=_objectWithoutProperties(_this$combinePostData,_excluded4);if(!(n!=null&&n.length)){_context97.n=15;break;}v=[];_iterator111=_createForOfIteratorHelper(JT(n,this.scene,this.dpr));_context97.p=1;_iterator111.s();case 2:if((_step111=_iterator111.n()).done){_context97.n=11;break;}p=_step111.value;if(!p.rect){_context97.n=10;break;}if(!(p.drawCanvas&&p.rect&&p.rect.w>0&&p.rect.h>0)){_context97.n=9;break;}_context97.p=3;y=p.drawCanvas===$t.Bg;C=y?(a=this.getLayer(p.drawCanvas))==null?void 0:a.parent:void 0;if(!y){_context97.n=4;break;}_t111=this.transferLayerToImageBitmap(p.drawCanvas);_context97.n=6;break;case 4:_context97.n=5;return this.getRectImageBitmap(p);case 5:_t111=_context97.v;case 6:b=_t111;if(!(y&&QT(C,b),!this.trackCombinePostTransfer(e,b))){_context97.n=7;break;}return _context97.a(2);case 7:p.imageBitmap=b,y&&(p.isFullFrameImageBitmap=!0,p.viewGeneration=this.viewGeneration,p.frameSequence=++this.fullLayerFrameSequence,p.taskId=e,p.rect=this.getSceneRect()),s||(s=[]),s.push(b);_context97.n=9;break;case 8:_context97.p=8;_t112=_context97.v;throw new wf(_t112,{business:"combine-post",stage:"transfer-layer-image-bitmap"});case 9:v.push(p);case 10:_context97.n=2;break;case 11:_context97.n=13;break;case 12:_context97.p=12;_t113=_context97.v;_iterator111.e(_t113);case 13:_context97.p=13;_iterator111.f();return _context97.f(13);case 14:i.render=v;case 15:o=(u=i.sp)==null?void 0:u.filter(function(v){return v.type!==It.None||v.isLockSentEventCursor||v.needUndoTicker||v.collectUndoTicker||v.eraseTxnPhase;});o!=null&&o.length?i.sp=o.map(function(v){var _v$viewGeneration;return _objectSpread(_objectSpread({},v),{},{viewId:v.viewId||_this112.viewId,viewGeneration:(_v$viewGeneration=v.viewGeneration)!==null&&_v$viewGeneration!==void 0?_v$viewGeneration:_this112.viewGeneration});}):delete i.sp,i.consumeCount===void 0&&delete i.consumeCount,i.subWorkerDrawCount===void 0&&delete i.subWorkerDrawCount,this.isCombinePostTaskActive(e)&&(o!=null&&o.length||i.consumeCount||i.subWorkerDrawCount||(h=i==null?void 0:i.render)!=null&&h.length)&&(this._post(i,s),this.commitCombinePostTransfers(e));case 16:return _context97.a(2);}},_callee92,this,[[3,8],[1,12,13,14]]);}));function combinePost(_x142){return _combinePost.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee93(e){var h,v,n,i,s,o,a,u,p,_t114,_t115;return _regenerator().w(function(_context98){while(1)switch(_context98.n){case 0:n=e.msgType,i=e.toolsType,s=e.opt,o=e.dataType,a=e.workState,u=e.isLockSentEventCursor;_t114=n;_context98.n=_t114===It.UpdateTools?1:_t114===It.CreateWork?3:_t114===It.DrawWork?4:_t114===It.RemoveNode?8:_t114===It.FullWork?10:_t114===It.Snapshot?14:_t114===It.BoundingBox?16:18;break;case 1:if(!(i&&(h=this.topLayerWork)!=null&&h.canUseTopLayer(i)&&s)){_context98.n=2;break;}p={toolsType:i,toolsOpt:s};this.topLayerWork.setToolsOpt(p);return _context98.a(2);case 2:return _context98.a(3,18);case 3:this.createLocalWork(e);return _context98.a(2);case 4:if(!(a===te.Done&&o===Qt.Local)){_context98.n=6;break;}_context98.n=5;return this.consumeDrawAll(o,e);case 5:i===St.LaserPen&&u&&this.post({sp:[{type:It.None,isLockSentEventCursor:u}]});_context98.n=7;break;case 6:_context98.n=7;return this.consumeDraw(o,e);case 7:return _context98.a(2);case 8:_context98.n=9;return this.removeNode(e);case 9:return _context98.a(2);case 10:if(!(i&&(v=this.topLayerWork)!=null&&v.canUseTopLayer(i))){_context98.n=12;break;}_context98.n=11;return this.consumeDrawAll(o,e);case 11:_context98.n=13;break;case 12:_t115=o===Qt.Local&&e.clearPreviewLocalWork&&e.workId;if(!_t115){_context98.n=13;break;}_context98.n=13;return this.localWork.consumeDrawAll(_objectSpread(_objectSpread({},e),{},{msgType:It.DrawWork,workState:te.Done}));case 13:return _context98.a(2);case 14:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context98.n=15;return this.snapshotWork.getSnapshot(e);case 15:this.snapshotWork.destroySnapshotFullLayer();return _context98.a(2);case 16:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context98.n=17;return this.snapshotWork.getBoundingRect(e);case 17:this.snapshotWork.destroySnapshotFullLayer();return _context98.a(2);case 18:_context98.n=19;return _superPropGet(TMt,"on",this,3)([e]);case 19:return _context98.a(2);}},_callee93,this);}));function on(_x143){return _on2.apply(this,arguments);}return on;}()},{key:"createLocalWork",value:function createLocalWork(e){var o;var n=e.workId,i=e.toolsType,s=e.opt;if(i&&(o=this.topLayerWork)!=null&&o.canUseTopLayer(i)&&n&&s){this.topLayerWork.getToolsOpt()||this.topLayerWork.setToolsOpt({toolsType:i,toolsOpt:s}),this.topLayerWork.setWorkOptions(n.toString(),s);return;}i&&_superPropGet(TMt,"createLocalWork",this,3)([e]);}},{key:"removeNode",value:function(){var _removeNode2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee94(e){var n,_t116;return _regenerator().w(function(_context99){while(1)switch(_context99.n){case 0:n=e.dataType;_t116=n===Qt.Local;if(!_t116){_context99.n=1;break;}_context99.n=1;return this.localWork.removeWork(e);case 1:return _context99.a(2);}},_callee94,this);}));function removeNode(_x144){return _removeNode2.apply(this,arguments);}return removeNode;}()},{key:"getLayer",value:function getLayer(e){switch(e){case $t.TopFloat:return this.topLayer||this.fullLayer;default:return this.fullLayer;}}},{key:"getOffscreen",value:function getOffscreen(e){var i;return((i=this.getLayer(e))==null?void 0:i.parent).canvas;}},{key:"consumeDraw",value:function(){var _consumeDraw5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee95(e,n){var o,i,s,_t117;return _regenerator().w(function(_context100){while(1)switch(_context100.n){case 0:i=n.workId,s=n.toolsType;if(!i){_context100.n=3;break;}if(!(s&&(o=this.topLayerWork)!=null&&o.canUseTopLayer(s))){_context100.n=1;break;}e===Qt.Local&&(this.topLayerWork.getWorkShape(i.toString())||this.createLocalWork(n)),this.topLayerWork.consumeDraw(n);return _context100.a(2);case 1:_t117=s;if(!_t117){_context100.n=2;break;}this.localWork.getWorkShape(i.toString())||this.createLocalWork(n);_context100.n=2;return this.localWork.consumeDraw(n);case 2:return _context100.a(2);case 3:return _context100.a(2);}},_callee95,this);}));function consumeDraw(_x145,_x146){return _consumeDraw5.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee96(e,n){var a,i,s,o,u,_t118;return _regenerator().w(function(_context101){while(1)switch(_context101.n){case 0:i=n.workId,s=n.toolsType,o=n.dataType;if(!i){_context101.n=3;break;}u=i.toString();if(!(s&&(a=this.topLayerWork)!=null&&a.canUseTopLayer(s))){_context101.n=1;break;}o===Qt.Local&&(this.topLayerWork.getWorkShape(u)||this.createLocalWork(n)),this.topLayerWork.consumeDrawAll(n);return _context101.a(2);case 1:_t118=s;if(!_t118){_context101.n=2;break;}this.localWork.getWorkShape(u)||_superPropGet(TMt,"createLocalWork",this,3)([n]);_context101.n=2;return this.localWork.consumeDrawAll(n);case 2:return _context101.a(2);case 3:return _context101.a(2);}},_callee96,this);}));function consumeDrawAll(_x147,_x148){return _consumeDrawAll4.apply(this,arguments);}return consumeDrawAll;}()},{key:"clearAll",value:function(){var _clearAll2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee97(){return _regenerator().w(function(_context102){while(1)switch(_context102.n){case 0:this.vNodes.clear();_superPropGet(TMt,"clearAll",this,3)([]);this.topLayer&&(this.topLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.topLayer,this.topLayer.parent));_context102.n=1;return this.post({render:[{isClearAll:!0,clearCanvas:$t.TopFloat,viewId:this.viewId}],sp:[{type:It.Clear}]});case 1:return _context102.a(2);}},_callee97,this);}));function clearAll(){return _clearAll2.apply(this,arguments);}return clearAll;}()},{key:"getRectImageBitmap",value:function(){var _getRectImageBitmap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee98(e,n){var i,s,o,a,u,h;return _regenerator().w(function(_context103){while(1)switch(_context103.n){case 0:i=e.rect,s=e.drawCanvas,o=Math.floor(i.x*this.dpr),a=Math.floor(i.y*this.dpr),u=Math.max(1,Math.floor(i.w*this.dpr)),h=Math.max(1,Math.floor(i.h*this.dpr));_context103.n=1;return createImageBitmap(this.getOffscreen(s),o,a,u,h,n);case 1:return _context103.a(2,_context103.v);}},_callee98,this);}));function getRectImageBitmap(_x149,_x150){return _getRectImageBitmap.apply(this,arguments);}return getRectImageBitmap;}()},{key:"updateLayer",value:function updateLayer(e){var n=e.width,i=e.height;_superPropGet(TMt,"updateLayer",this,3)([e]),this.topLayer&&(this.topLayer.parent.setAttribute("width",n),this.topLayer.parent.setAttribute("height",i),this.topLayer.setAttribute("size",[n,i]),this.topLayer.setAttribute("pos",[n*0.5,i*0.5]));}},{key:"updateDpr",value:function(){var _updateDpr2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee99(e){var n,i,s,_t119;return _regenerator().w(function(_context104){while(1)switch(_context104.n){case 0:_superPropGet(TMt,"updateDpr",this,3)([e]);n=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,i=!!this.localWork.getWorkShapes().size,s=[];i&&s.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId});n&&s.push({isClearAll:!0,clearCanvas:$t.TopFloat,viewId:this.viewId});_t119=s.length;if(!_t119){_context104.n=1;break;}_context104.n=1;return this.post({render:s});case 1:return _context104.a(2);}},_callee99,this);}));function updateDpr(_x151){return _updateDpr2.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee100(e,n){var _this113=this;var o,i,s,a,u,_iterator112,_step112,_loop0,h,_t120,_t121,_t122;return _regenerator().w(function(_context106){while(1)switch(_context106.p=_context106.n){case 0:if(!(n!=null&&n.aborted)){_context106.n=1;break;}return _context106.a(2);case 1:i=[],s=e.cameraOpt;if(!(s&&!Qn(this.cameraOpt,s))){_context106.n=13;break;}a=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,u=!!this.localWork.getWorkShapes().size;if(!(u&&this.localWork.workShapesDone(),this.setCameraOpt(s),u&&i.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}),a&&this.topLayerWork)){_context106.n=8;break;}i.push({isClearAll:!0,clearCanvas:$t.TopFloat,viewId:this.viewId});_iterator112=_createForOfIteratorHelper(this.topLayerWork.localWorkShapes.entries()||[]);_context106.p=2;_loop0=/*#__PURE__*/_regenerator().m(function _loop0(){var _step112$value,h,v,p;return _regenerator().w(function(_context105){while(1)switch(_context105.n){case 0:_step112$value=_slicedToArray(_step112.value,2),h=_step112$value[0],v=_step112$value[1];if(v.totalRect){(o=_this113.topLayer)==null||o.getElementsByName(h.toString()).forEach(function(y){var C=y.getBoundingClientRect(),b=me({x:C.x,y:C.y,w:C.width,h:C.height});p=Kt(p,b);}),v.totalRect=p,_this113.topLayerWork.localWorkShapes.set(h,v);}case 1:return _context105.a(2);}},_loop0);});_iterator112.s();case 3:if((_step112=_iterator112.n()).done){_context106.n=5;break;}return _context106.d(_regeneratorValues(_loop0()),4);case 4:_context106.n=3;break;case 5:_context106.n=7;break;case 6:_context106.p=6;_t120=_context106.v;_iterator112.e(_t120);case 7:_context106.p=7;_iterator112.f();return _context106.f(7);case 8:if(!i.length){_context106.n=12;break;}h=this.post({render:i});_t121=n;if(!_t121){_context106.n=10;break;}_context106.n=9;return NT(n,h,"update-camera");case 9:_t121=!_context106.v;case 10:if(!_t121){_context106.n=11;break;}return _context106.a(2);case 11:_t122=n;if(_t122){_context106.n=12;break;}_context106.n=12;return h;case 12:if(!(n!=null&&n.aborted)){_context106.n=13;break;}return _context106.a(2);case 13:return _context106.a(2);}},_callee100,this,[[2,6,7,8]]);}));function updateCamera(_x152,_x153){return _updateCamera.apply(this,arguments);}return updateCamera;}()},{key:"setCameraOpt",value:function setCameraOpt(e,n){var h,v;this.cameraOpt=e;var i=e.scale,s=e.centerX,o=e.centerY,a=e.width,u=e.height;(a!==this.scene.width||u!==this.scene.height)&&this.updateScene(this.scene,{width:a,height:u}),n?(n.setAttribute("scale",[i,i]),n.setAttribute("translate",[-s,-o])):(this.fullLayer.setAttribute("scale",[i,i]),this.fullLayer.setAttribute("translate",[-s,-o]),(h=this.topLayer)==null||h.setAttribute("scale",[i,i]),(v=this.topLayer)==null||v.setAttribute("translate",[-s,-o]));}}]);}(GT);var _T=/*#__PURE__*/function(_GT2){function _T(e,n,i){var _this114;_classCallCheck(this,_T);_this114=_callSuper(this,_T,[e,n,"full"/* Full */]);ht(_this114,"serviceDrawLayer");ht(_this114,"localDrawLayer");ht(_this114,"snapshotFullLayer");ht(_this114,"methodBuilder");ht(_this114,"localWork");ht(_this114,"serviceWork");ht(_this114,"_post");ht(_this114,"debounceUpdateCache",/* @__PURE__ */new Set());ht(_this114,"fullLayerFrameSequence",0);_this114._post=i;var s=Jr.bufferSize.sub;_this114.serviceDrawLayer=_this114.createLayer("serviceDrawLayer",_this114.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:s,contextType:"2d"})),_this114.localDrawLayer=_this114.createLayer("localDrawLayer",_this114.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:s,contextType:"2d"}));var o={thread:_this114,viewId:_this114.viewId,vNodes:_this114.vNodes,fullLayer:_this114.fullLayer};_this114.localWork=new ZT(_objectSpread(_objectSpread({},o),{},{drawLayer:_this114.localDrawLayer})),n.combineUnitTime&&_this114.localWork.setCombineUnitTime(n.combineUnitTime),n.maxCombineEraserTime&&_this114.localWork.setmaxCombineEraserTime(n.maxCombineEraserTime),n.syncUnitTime&&_this114.localWork.setSyncUnitTime(n.syncUnitTime),_this114.serviceWork=new qT(_objectSpread(_objectSpread({},o),{},{drawLayer:_this114.serviceDrawLayer})),_this114.methodBuilder=new I2([ve.CopyNode,ve.SetColorNode,ve.DeleteNode,ve.RotateNode,ve.ScaleNode,ve.TranslateNode,ve.ZIndexNode,ve.SetFontStyle,ve.SetPoint,ve.SetLock,ve.SetShapeOpt]).registerForWorker(_this114),_this114.vNodes.init(_this114.fullLayer);return _this114;}_inherits(_T,_GT2);return _createClass(_T,[{key:"combinePost",value:function(){var _combinePost2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee101(e){var _this115=this;var a,u,h,_this$combinePostData2,n,i,s,v,_iterator113,_step113,p,y,C,b,o,_t123,_t124,_t125;return _regenerator().w(function(_context107){while(1)switch(_context107.p=_context107.n){case 0:_this$combinePostData2=this.combinePostData(),n=_this$combinePostData2.render,i=_objectWithoutProperties(_this$combinePostData2,_excluded5);if(!(n!=null&&n.length)){_context107.n=15;break;}v=[];_iterator113=_createForOfIteratorHelper(JT(n,this.scene,this.dpr));_context107.p=1;_iterator113.s();case 2:if((_step113=_iterator113.n()).done){_context107.n=11;break;}p=_step113.value;if(!p.rect){_context107.n=10;break;}if(!(p.drawCanvas&&p.rect&&p.rect.w>0&&p.rect.h>0)){_context107.n=9;break;}_context107.p=3;y=p.drawCanvas===$t.Bg;C=y?(a=this.getLayer(p.drawCanvas))==null?void 0:a.parent:void 0;if(!y){_context107.n=4;break;}_t123=this.transferLayerToImageBitmap(p.drawCanvas);_context107.n=6;break;case 4:_context107.n=5;return this.getRectImageBitmap(p);case 5:_t123=_context107.v;case 6:b=_t123;if(!(y&&QT(C,b),!this.trackCombinePostTransfer(e,b))){_context107.n=7;break;}return _context107.a(2);case 7:p.imageBitmap=b,y&&(p.isFullFrameImageBitmap=!0,p.viewGeneration=this.viewGeneration,p.frameSequence=++this.fullLayerFrameSequence,p.taskId=e,p.rect=this.getSceneRect()),s||(s=[]),s.push(b);_context107.n=9;break;case 8:_context107.p=8;_t124=_context107.v;throw new wf(_t124,{business:"combine-post",stage:"transfer-layer-image-bitmap"});case 9:v.push(p);case 10:_context107.n=2;break;case 11:_context107.n=13;break;case 12:_context107.p=12;_t125=_context107.v;_iterator113.e(_t125);case 13:_context107.p=13;_iterator113.f();return _context107.f(13);case 14:i.render=v;case 15:o=(u=i.sp)==null?void 0:u.filter(function(v){return v.type!==It.None||v.isLockSentEventCursor||v.needUndoTicker||v.collectUndoTicker||v.eraseTxnPhase;});o!=null&&o.length?i.sp=o.map(function(v){var _v$viewGeneration2;return _objectSpread(_objectSpread({},v),{},{viewId:v.viewId||_this115.viewId,viewGeneration:(_v$viewGeneration2=v.viewGeneration)!==null&&_v$viewGeneration2!==void 0?_v$viewGeneration2:_this115.viewGeneration});}):delete i.sp,i.fullWorkerDrawCount===void 0&&delete i.fullWorkerDrawCount,i.consumeCount===void 0&&delete i.consumeCount,this.isCombinePostTaskActive(e)&&(i!=null&&i.fullWorkerDrawCount||i.consumeCount||o!=null&&o.length||(h=i.render)!=null&&h.length)&&(this._post(i,s),this.commitCombinePostTransfers(e));case 16:return _context107.a(2);}},_callee101,this,[[3,8],[1,12,13,14]]);}));function combinePost(_x154){return _combinePost2.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee102(e){var _this116=this;var n,i,s,o,a,u,h,v,_h8,_t126,_t127;return _regenerator().w(function(_context108){while(1)switch(_context108.n){case 0:_context108.n=1;return this.methodBuilder.consumeForWorker(e);case 1:if(!_context108.v){_context108.n=2;break;}return _context108.a(2);case 2:n=e.msgType,i=e.dataType,s=e.workId,o=e.toolsType,a=e.workState,u=e.workIds;_t126=n;_context108.n=_t126===It.AuthClear?3:_t126===It.CreateWork?4:_t126===It.DrawWork?5:_t126===It.Select?9:_t126===It.UpdateNode?13:_t126===It.FullWork?13:_t126===It.RemoveNode?15:_t126===It.GetTextActive?17:_t126===It.CursorHover?19:_t126===It.CursorBlur?21:_t126===It.GetVNodeInfo?23:24;break;case 3:h=e.clearUids,v=e.localUid;this.vNodes.setCanClearUids(h),this.vNodes.setLocalUid(v);return _context108.a(3,24);case 4:o!==St.LaserPen&&this.createLocalWork(e);return _context108.a(3,24);case 5:_t127=o!==St.LaserPen;if(!_t127){_context108.n=8;break;}if(!(a===te.Done&&i===Qt.Local)){_context108.n=7;break;}_context108.n=6;return this.consumeDrawAll(i,e);case 6:_context108.n=8;break;case 7:_context108.n=8;return this.consumeDraw(i,e);case 8:return _context108.a(3,24);case 9:if(!(i===Qt.Local||s===De)){_context108.n=11;break;}_context108.n=10;return this.localWork.updateFullSelectWork(e);case 10:_context108.n=12;break;case 11:this.serviceWork.runSelectWork(e);case 12:return _context108.a(2);case 13:_context108.n=14;return this.consumeFull(i,e);case 14:return _context108.a(2);case 15:_context108.n=16;return this.removeNode(e);case 16:return _context108.a(2);case 17:_context108.n=18;return this.checkTextActive(e);case 18:return _context108.a(2);case 19:_context108.n=20;return this.cursorHover(e);case 20:return _context108.a(2);case 21:_context108.n=22;return this.cursorBlur();case 22:return _context108.a(2);case 23:if(s&&u){_h8=u.map(function(v){return _this116.vNodes.get(v);});this.post({sp:[{type:It.GetVNodeInfo,dataType:Qt.Worker,workId:s,vInfo:_h8}]});}return _context108.a(3,24);case 24:_context108.n=25;return _superPropGet(_T,"on",this,3)([e]);case 25:return _context108.a(2);}},_callee102,this);}));function on(_x155){return _on3.apply(this,arguments);}return on;}()},{key:"removeNode",value:function(){var _removeNode3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee103(e){var _this117=this;var n,i,s,o,a,_iterator114,_step114,_loop1,_t128;return _regenerator().w(function(_context110){while(1)switch(_context110.p=_context110.n){case 0:n=e.dataType,i=e.workId,s=e.removeIds,o=[],a=s||[];if(!(i&&a.push(i.toString()),a.length)){_context110.n=8;break;}_iterator114=_createForOfIteratorHelper(a);_context110.p=1;_loop1=/*#__PURE__*/_regenerator().m(function _loop1(){var u;return _regenerator().w(function(_context109){while(1)switch(_context109.n){case 0:u=_step114.value;u===De?o.push(_this117.localWork.removeSelector(e,_this117)):n===Qt.Local?o.push(_this117.localWork.removeWork(e).then(function(){_this117.localWork.colloctEffectSelectWork(e),_this117.deleteCachedImagesByWorkId(u);})):n===Qt.Service&&o.push(_this117.serviceWork.removeWork(e).then(function(){_this117.localWork.colloctEffectSelectWork(e),_this117.deleteCachedImagesByWorkId(u);}));case 1:return _context109.a(2);}},_loop1);});_iterator114.s();case 2:if((_step114=_iterator114.n()).done){_context110.n=4;break;}return _context110.d(_regeneratorValues(_loop1()),3);case 3:_context110.n=2;break;case 4:_context110.n=6;break;case 5:_context110.p=5;_t128=_context110.v;_iterator114.e(_t128);case 6:_context110.p=6;_iterator114.f();return _context110.f(6);case 7:_context110.n=8;return Promise.all(o);case 8:return _context110.a(2);}},_callee103,null,[[1,5,6,7]]);}));function removeNode(_x156){return _removeNode3.apply(this,arguments);}return removeNode;}()},{key:"checkTextActive",value:function(){var _checkTextActive2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee104(e){var n,_t129;return _regenerator().w(function(_context111){while(1)switch(_context111.n){case 0:n=e.dataType;_t129=n===Qt.Local;if(!_t129){_context111.n=1;break;}_context111.n=1;return this.localWork.checkTextActive(e);case 1:return _context111.a(2);}},_callee104,this);}));function checkTextActive(_x157){return _checkTextActive2.apply(this,arguments);}return checkTextActive;}()},{key:"clearAll",value:function(){var _clearAll3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee105(){return _regenerator().w(function(_context112){while(1)switch(_context112.n){case 0:this.vNodes.clear();this.debounceUpdateCache.clear();_superPropGet(_T,"clearAll",this,3)([]);this.localDrawLayer&&(this.localDrawLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.localDrawLayer,this.localDrawLayer.parent));this.serviceDrawLayer&&(this.serviceDrawLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.serviceDrawLayer,this.serviceDrawLayer.parent));_context112.n=1;return this.post({render:[{isClearAll:!0,clearCanvas:$t.Bg,viewId:this.viewId},{isClearAll:!0,clearCanvas:$t.ServiceFloat,viewId:this.viewId},{isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}],sp:[{type:It.Clear}]});case 1:return _context112.a(2);}},_callee105,this);}));function clearAll(){return _clearAll3.apply(this,arguments);}return clearAll;}()},{key:"updateLayer",value:function updateLayer(e){var n=e.width,i=e.height;_superPropGet(_T,"updateLayer",this,3)([e]),this.localDrawLayer&&(this.localDrawLayer.parent.setAttribute("width",n),this.localDrawLayer.parent.setAttribute("height",i),this.localDrawLayer.setAttribute("size",[n,i]),this.localDrawLayer.setAttribute("pos",[n*0.5,i*0.5])),this.serviceDrawLayer&&(this.serviceDrawLayer.parent.setAttribute("width",n),this.serviceDrawLayer.parent.setAttribute("height",i),this.serviceDrawLayer.setAttribute("size",[n,i]),this.serviceDrawLayer.setAttribute("pos",[n*0.5,i*0.5]));}},{key:"setCameraOpt",value:function setCameraOpt(e){this.cameraOpt=e;var n=e.scale,i=e.centerX,s=e.centerY,o=e.width,a=e.height;(o!==this.scene.width||a!==this.scene.height)&&this.updateScene(this.scene,{width:o,height:a}),this.fullLayer&&(this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-i,-s])),this.localDrawLayer&&(this.localDrawLayer.setAttribute("scale",[n,n]),this.localDrawLayer.setAttribute("translate",[-i,-s])),this.serviceDrawLayer&&(this.serviceDrawLayer.setAttribute("scale",[n,n]),this.serviceDrawLayer.setAttribute("translate",[-i,-s]));}},{key:"getLayer",value:function getLayer(e){switch(e){case $t.Bg:return this.fullLayer;case $t.ServiceFloat:return this.serviceDrawLayer;case $t.Float:return this.localDrawLayer;}}},{key:"getOffscreen",value:function getOffscreen(e){return this.getLayer(e).parent.canvas;}},{key:"consumeFull",value:function(){var _consumeFull2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee106(e,n){var i,_t130;return _regenerator().w(function(_context113){while(1)switch(_context113.n){case 0:_context113.n=1;return this.localWork.colloctEffectSelectWork(n);case 1:i=_context113.v;_t130=i&&e===Qt.Local;if(!_t130){_context113.n=2;break;}_context113.n=2;return this.localWork.consumeFull(i);case 2:i&&e===Qt.Service&&this.serviceWork.consumeFull(i);case 3:return _context113.a(2);}},_callee106,this);}));function consumeFull(_x158,_x159){return _consumeFull2.apply(this,arguments);}return consumeFull;}()},{key:"consumeDraw",value:function(){var _consumeDraw6=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee107(e,n){var i,_t131;return _regenerator().w(function(_context114){while(1)switch(_context114.n){case 0:i=n.workId;_t131=e===Qt.Local&&i;if(!_t131){_context114.n=1;break;}this.localWork.getWorkShape(i.toString())||this.createLocalWork(n);_context114.n=1;return this.localWork.consumeDraw(n,this.serviceWork);case 1:e===Qt.Service&&this.serviceWork.consumeDraw(n);case 2:return _context114.a(2);}},_callee107,this);}));function consumeDraw(_x160,_x161){return _consumeDraw6.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee108(e,n){var i,_t132;return _regenerator().w(function(_context115){while(1)switch(_context115.n){case 0:i=n.workId;_t132=e===Qt.Local&&i;if(!_t132){_context115.n=1;break;}this.localWork.getWorkShape(i.toString())||this.createLocalWork(n);_context115.n=1;return this.localWork.consumeDrawAll(n,this.serviceWork);case 1:return _context115.a(2);}},_callee108,this);}));function consumeDrawAll(_x162,_x163){return _consumeDrawAll5.apply(this,arguments);}return consumeDrawAll;}()},{key:"updateDpr",value:function(){var _updateDpr3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee109(e){var n;return _regenerator().w(function(_context116){while(1)switch(_context116.n){case 0:_superPropGet(_T,"updateDpr",this,3)([e]);n=[{isClearAll:!0,clearCanvas:$t.Bg,viewId:this.viewId}];this.vNodes.hasRenderNodes()&&n.push({isDrawAll:!0,drawCanvas:$t.Bg,viewId:this.viewId});_context116.n=1;return this.post({render:n});case 1:return _context116.a(2);}},_callee109,this);}));function updateDpr(_x164){return _updateDpr3.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee111(e,n){var _this118=this;var y,C,b,M,i,s,o,a,u,h,v,p,L,_L19,X,S,_iterator115,_step115,_step115$value,P,z,Y,_iterator116,_step116,_step116$value,_S9,_x169,_P1,_iterator117,_step117,_step117$value,_S0,_x170,_P10,et,A,_S5,_iterator118,_step118,x,w,_iterator119,_step119,_S6,_x167,_iterator120,_step120,_P7,_iterator121,_step121,_step121$value,_P0,_z18,U,K,j,nt,ct,B,N,G,q,_iterator122,_step122,_step122$value,_x168,_P8,_S7,_S8,_t135,_t136,_t137,_t138,_t139;return _regenerator().w(function(_context119){while(1)switch(_context119.p=_context119.n){case 0:i=[],s=e.cameraOpt,o=e.scenePath,a=e.cameraTaskId;u=!1;h=this.cameraOpt,v=!!(s&&Qn(h,s));p=!1;if(!(s&&v)){_context119.n=3;break;}L=this.hasCameraSettledRender();if(!this.retargetCameraSettledRender(a)){_context119.n=1;break;}return _context119.a(2);case 1:if(L){_context119.n=2;break;}$e(a)&&this._post({viewId:this.viewId,viewGeneration:this.viewGeneration,cameraSettledTaskId:a});return _context119.a(2);case 2:p=!0;case 3:if(!(s&&(!v||p))){_context119.n=26;break;}this.cancelCameraSettledRender();_L19=!h||h.scale!==s.scale||h.centerX!==s.centerX||h.centerY!==s.centerY||h.width!==s.width||h.height!==s.height;this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0,(y=this.taskUpdateCameraResolve)==null||y.call(this,!1),this.taskUpdateCameraResolve=void 0);X=!!this.serviceDrawLayer.children.length;if(!o){_context119.n=19;break;}case 4:S=[];_iterator115=_createForOfIteratorHelper(this.localWork.getWorkShapes().entries());_context119.p=5;_iterator115.s();case 6:if((_step115=_iterator115.n()).done){_context119.n=10;break;}_step115$value=_slicedToArray(_step115.value,2),P=_step115$value[0],z=_step115$value[1];_t135=z.toolsType;_context119.n=_t135===St.Text?7:_t135===St.PencilEraser?7:_t135===St.Eraser?7:_t135===St.Selector?7:_t135===St.LaserPen?7:8;break;case 7:return _context119.a(3,9);case 8:P!==Lo&&P!==De&&S.push("".concat(P,":").concat(z.toolsType));return _context119.a(3,9);case 9:_context119.n=6;break;case 10:_context119.n=12;break;case 11:_context119.p=11;_t136=_context119.v;_iterator115.e(_t136);case 12:_context119.p=12;_iterator115.f();return _context119.f(12);case 13:if(!(n&&(n.stage="blocking-works",n.blockingWorks=S),!S.length)){_context119.n=14;break;}return _context119.a(3,18);case 14:_context119.n=15;return new Promise(function(P){_this118.taskUpdateCameraResolve=P,_this118.taskUpdateCameraId=setTimeout(function(){_this118.taskUpdateCameraId=void 0,_this118.taskUpdateCameraResolve=void 0,P(!0);},k1);});case 15:_t137=!_context119.v;if(_t137){_context119.n=16;break;}_t137=n!=null&&n.aborted;case 16:if(!_t137){_context119.n=17;break;}return _context119.a(2);case 17:if(S.length){_context119.n=4;break;}case 18:n&&(n.stage="update-camera",n.blockingWorks=void 0);case 19:if(!(n!=null&&n.aborted)){_context119.n=20;break;}return _context119.a(2);case 20:Y=/* @__PURE__ */new Map();_iterator116=_createForOfIteratorHelper(this.vNodes.getNodesByType(St.Text).entries());try{for(_iterator116.s();!(_step116=_iterator116.n()).done;){_step116$value=_slicedToArray(_step116.value,2),_S9=_step116$value[0],_x169=_step116$value[1];_P1=_x169.rect;Y.set(_S9,{rect:gr(_P1),scale:(C=this.cameraOpt)==null?void 0:C.scale});}}catch(err){_iterator116.e(err);}finally{_iterator116.f();}_iterator117=_createForOfIteratorHelper(this.vNodes.gethasEraserNodes().entries());try{for(_iterator117.s();!(_step117=_iterator117.n()).done;){_step117$value=_slicedToArray(_step117.value,2),_S0=_step117$value[0],_x170=_step117$value[1];_P10=_x170.rect;Y.set(_S0,{rect:gr(_P10),scale:(b=this.cameraOpt)==null?void 0:b.scale});}}catch(err){_iterator117.e(err);}finally{_iterator117.f();}et=new Set(Y.keys());A=!1;if(this.localWork.hasSelector()){_S5=(M=this.localWork.getSelector())==null?void 0:M.selectIds;if(_S5){A=!0;_iterator118=_createForOfIteratorHelper(_S5);try{for(_iterator118.s();!(_step118=_iterator118.n()).done;){x=_step118.value;et.add(x);}}catch(err){_iterator118.e(err);}finally{_iterator118.f();}}}w=!1;if(this.serviceWork.selectorWorkShapes.size){_iterator119=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.values());try{for(_iterator119.s();!(_step119=_iterator119.n()).done;){_S6=_step119.value;_x167=_S6.selectIds;if(_x167){w=!0;_iterator120=_createForOfIteratorHelper(_x167);try{for(_iterator120.s();!(_step120=_iterator120.n()).done;){_P7=_step120.value;et.add(_P7);}}catch(err){_iterator120.e(err);}finally{_iterator120.f();}}}}catch(err){_iterator119.e(err);}finally{_iterator119.f();}}if(this.setCameraOpt(s),this.vNodes.curNodeMap.size){this.vNodes.clearTarget(),this.vNodes.updateHighLevelNodesRect(et);_iterator121=_createForOfIteratorHelper(Y.entries());try{for(_iterator121.s();!(_step121=_iterator121.n()).done;){_step121$value=_slicedToArray(_step121.value,2),x=_step121$value[0],_P0=_step121$value[1].rect;_z18=this.vNodes.get(x);if(_z18){U=_P0,K=_z18.rect,j=this.getSceneRect(),nt=el(U,j),ct=el(K,j),B=_z18.toolsType,N=_z18.opt;G=p;(nt!==ct||U.w!==K.w||U.h!==K.h||ct===es.intersect)&&(G=!0),B===St.Text&&// (opt as TextOptions).workState === EventWorkState.Done &&
|
|
491
|
-
G&&this.debounceUpdateCache.add(x);q=_L19||p;(N.eraserlines&&N.eraserlines.length||N.eraserFaces)&&q&&!this.debounceUpdateCache.has(x)&&this.debounceUpdateCache.add(x);}}}catch(err){_iterator121.e(err);}finally{_iterator121.f();}if(A&&this.localWork.reRenderSelector(),w){_iterator122=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.entries());try{for(_iterator122.s();!(_step122=_iterator122.n()).done;){_step122$value=_slicedToArray(_step122.value,2),_x168=_step122$value[0],_P8=_step122$value[1];this.serviceWork.runSelectWork({workId:_x168,selectIds:_P8.selectIds,msgType:It.Select,dataType:Qt.Service,viewId:this.viewId});}}catch(err){_iterator122.e(err);}finally{_iterator122.f();}}u=!0;_S7=this.startCameraSettledRender(a,n);this.debounceUpdateCameraId=setTimeout(function(){_this118.debounceUpdateCameraId=void 0,_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee110(){var x,_P9,_iterator123,_step123,_loop10,U,K,_z16,_z17,_t133,_t134;return _regenerator().w(function(_context118){while(1)switch(_context118.p=_context118.n){case 0:_context118.p=0;if(_S7.isActive()){_context118.n=1;break;}return _context118.a(2);case 1:_P9=[];_iterator123=_createForOfIteratorHelper(_this118.debounceUpdateCache.values());_context118.p=2;_loop10=/*#__PURE__*/_regenerator().m(function _loop10(){var U,K,j,nt,ct,B;return _regenerator().w(function(_context117){while(1)switch(_context117.n){case 0:U=_step123.value;K=_this118.vNodes.get(U);if(K){j=K.toolsType,nt=K.opt,ct=K.op,B=_this118.localWork.setFullWork({toolsType:j,opt:nt,workId:U});B&&(j===St.Text?(x=_this118.fullLayer)!=null&&x.getElementsByName(U)[0]&&B instanceof Ja&&_P9.push(B.consumeServiceAsync({isFullWork:!0,replaceId:U,boxRect:_this118.getSceneRect(),isActive:_S7.isActive})):(nt.eraserlines&&nt.eraserlines.length||nt.eraserFaces)&&_P9.push(new Promise(function(N){var G=B.consumeService({op:ct,isFullWork:!0,replaceId:U,workState:te.Done});_this118.localWork.clearWorkShapeNodeCache(U),N(G);})));}_this118.debounceUpdateCache.delete(U);case 1:return _context117.a(2);}},_loop10);});_iterator123.s();case 3:if((_step123=_iterator123.n()).done){_context118.n=5;break;}return _context118.d(_regeneratorValues(_loop10()),4);case 4:_context118.n=3;break;case 5:_context118.n=7;break;case 6:_context118.p=6;_t133=_context118.v;_iterator123.e(_t133);case 7:_context118.p=7;_iterator123.f();return _context118.f(7);case 8:_context118.n=9;return Promise.all(_P9);case 9:if(_S7.isActive()){_context118.n=10;break;}return _context118.a(2);case 10:if(!(_this118.vNodes.updateLowLevelNodesRect(),_this118.vNodes.clearHighLevelIds(),_P9.length)){_context118.n=14;break;}U=[];U.push({isClearAll:!0,clearCanvas:$t.Bg,viewId:_this118.viewId},{isDrawAll:!0,drawCanvas:$t.Bg,viewId:_this118.viewId});_context118.n=11;return _this118.post({render:U});case 11:if(_S7.isActive()){_context118.n=12;break;}return _context118.a(2);case 12:K=_this118.fullLayer.parent;_S7.setRenderLayers([K]);_context118.n=13;return K.prepareRender;case 13:_S7.setRenderLayers();if(_S7.isActive()){_context118.n=14;break;}return _context118.a(2);case 14:_z16=_S7.getCameraTaskId();$e(_z16)&&_this118._post({viewId:_this118.viewId,viewGeneration:_this118.viewGeneration,cameraSettledTaskId:_z16});_context118.n=17;break;case 15:_context118.p=15;_t134=_context118.v;if(_S7.isActive()){_context118.n=16;break;}return _context118.a(2);case 16:_z17=Ws(_t134)?_t134:void 0,U={code:"RENDERER_BUSINESS_ERROR",business:"updateCamera",message:_t134 instanceof Error?_t134.message:String(_t134),stage:(_z17==null?void 0:_z17.stage)||"camera-settled-render",workerType:_this118.type},K=_S7.getCameraTaskId();if($e(K))try{_this118._post({viewId:_this118.viewId,viewGeneration:_this118.viewGeneration,cameraTaskId:K,cameraTaskStatus:"failed",cameraTaskError:U});}catch(j){console.error("[cameraSettledRender] failed ACK post failed viewId=".concat(_this118.viewId," taskId=").concat(K),j);}case 17:_context118.p=17;_S7.finish();return _context118.f(17);case 18:return _context118.a(2);}},_callee110,null,[[2,6,7,8],[0,15,17,18]]);}))();},k1*5);}if(!(X&&i.push({isClearAll:!0,clearCanvas:$t.ServiceFloat,viewId:this.viewId}),this.vNodes.hasRenderNodes()&&i.push({isClearAll:!0,clearCanvas:$t.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:$t.Bg,viewId:this.viewId}),i.length)){_context119.n=24;break;}_S8=this.post({render:i},{reportFailureAtRendererBoundary:!1});_t138=n;if(!_t138){_context119.n=22;break;}_context119.n=21;return NT(n,_S8,"update-camera");case 21:_t138=!_context119.v;case 22:if(!_t138){_context119.n=23;break;}return _context119.a(2);case 23:_t139=n;if(_t139){_context119.n=24;break;}_context119.n=24;return _S8;case 24:if(!(n!=null&&n.aborted)){_context119.n=25;break;}return _context119.a(2);case 25:!u&&$e(a)&&this._post({viewId:this.viewId,viewGeneration:this.viewGeneration,cameraSettledTaskId:a});case 26:return _context119.a(2);}},_callee111,this,[[5,11,12,13]]);}));function updateCamera(_x165,_x166){return _updateCamera2.apply(this,arguments);}return updateCamera;}()},{key:"getRectImageBitmap",value:function(){var _getRectImageBitmap2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee112(e){var n,i,s,o,a,u;return _regenerator().w(function(_context120){while(1)switch(_context120.n){case 0:n=e.rect,i=e.drawCanvas,s=Math.floor(n.x*this.dpr),o=Math.floor(n.y*this.dpr),a=Math.max(1,Math.floor(n.w*this.dpr)),u=Math.max(1,Math.floor(n.h*this.dpr));_context120.n=1;return createImageBitmap(this.getOffscreen(i),s,o,a,u,{resizeQuality:"low"});case 1:return _context120.a(2,_context120.v);}},_callee112,this);}));function getRectImageBitmap(_x171){return _getRectImageBitmap2.apply(this,arguments);}return getRectImageBitmap;}()},{key:"cursorHover",value:function(){var _cursorHover2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee113(e){return _regenerator().w(function(_context121){while(1)switch(_context121.n){case 0:_context121.n=1;return this.localWork.cursorHover(e);case 1:return _context121.a(2);}},_callee113,this);}));function cursorHover(_x172){return _cursorHover2.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee114(){return _regenerator().w(function(_context122){while(1)switch(_context122.n){case 0:_context122.n=1;return this.localWork.cursorBlur();case 1:return _context122.a(2);}},_callee114,this);}));function cursorBlur(){return _cursorBlur2.apply(this,arguments);}return cursorBlur;}()},{key:"destroy",value:function destroy(){this.debounceUpdateCache.clear(),_superPropGet(_T,"destroy",this,3)([]);}}]);}(GT);var IMt=/*#__PURE__*/function(_T6){function IMt(e,n,i){var _this119;_classCallCheck(this,IMt);var o,a,u,h;_this119=_callSuper(this,IMt,[e,n,i]);ht(_this119,"snapshotWork");ht(_this119,"localDrawScene");ht(_this119,"serviceDrawScene");ht(_this119,"offscreenCanvas");ht(_this119,"localWork");ht(_this119,"serviceWork");if(_this119._post=i,n.offscreenCanvas){_this119.offscreenCanvas=n.offscreenCanvas,_this119.localDrawScene=_this119.createScene(n,(o=_this119.offscreenCanvas)==null?void 0:o.localCanvas),_this119.serviceDrawScene=_this119.createScene(n,(a=_this119.offscreenCanvas)==null?void 0:a.serviceCanvas);var v=Jr.bufferSize.sub;_this119.serviceDrawLayer=_this119.createLayer("serviceDrawLayer",_this119.serviceDrawScene||_this119.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:v,contextType:"2d"}),(u=_this119.offscreenCanvas)==null?void 0:u.serviceCanvas),_this119.localDrawLayer=_this119.createLayer("localDrawLayer",_this119.localDrawScene||_this119.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:v,contextType:"2d"}),(h=_this119.offscreenCanvas)==null?void 0:h.localCanvas);}var s={thread:_this119,viewId:_this119.viewId,vNodes:_this119.vNodes,fullLayer:_this119.fullLayer};_this119.localWork=new gMt(_objectSpread(_objectSpread({},s),{},{drawLayer:_this119.localDrawLayer})),n.combineUnitTime&&_this119.localWork.setCombineUnitTime(n.combineUnitTime),n.maxCombineEraserTime&&_this119.localWork.setmaxCombineEraserTime(n.maxCombineEraserTime),n.syncUnitTime&&_this119.localWork.setSyncUnitTime(n.syncUnitTime),_this119.serviceWork=new mMt(_objectSpread(_objectSpread({},s),{},{drawLayer:_this119.serviceDrawLayer})),_this119.snapshotWork=new KT(_objectSpread(_objectSpread({},s),{},{createScene:_this119.createScene.bind(_this119),createLayer:_this119.createLayer.bind(_this119)})),_this119.methodBuilder=new I2([ve.CopyNode,ve.SetColorNode,ve.DeleteNode,ve.RotateNode,ve.ScaleNode,ve.TranslateNode,ve.ZIndexNode,ve.SetFontStyle,ve.SetPoint,ve.SetLock,ve.SetShapeOpt]).registerForWorker(_this119);return _this119;}_inherits(IMt,_T6);return _createClass(IMt,[{key:"createRenderLayer",value:function createRenderLayer(e,n,i){var a;var s=Jr.bufferSize.full,o=Jr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",e,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:this.viewId===Bs?s:o*2}),i||((a=n.offscreenCanvas)==null?void 0:a.bgCanvas));}},{key:"createScene",value:function createScene(e,n){var i=e.offscreenCanvas,s=e.offscreenCanvasOpt,o=s.width,a=s.height,u=n||(i==null?void 0:i.bgCanvas)||new OffscreenCanvas(o,a);s.contextType&&delete s.contextType;var h=new sf(_objectSpread(_objectSpread({container:u,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},s),{},{contextType:this.contextType,id:this.viewId}));return h.setAttribute("id",this.viewId),h;}},{key:"combinePostData",value:function combinePostData(){var u,h;var e=this.combinePostMsg;this.combinePostMsg=/* @__PURE__ */new Set();var n=[],i=[];var s,o;var a=/* @__PURE__ */new Set();var _iterator124=_createForOfIteratorHelper(e.values()),_step124;try{for(_iterator124.s();!(_step124=_iterator124.n()).done;){var v=_step124.value;if((u=v.render)!=null&&u.length){var p=void 0;try{if(this.offscreenCanvas){var _iterator125=_createForOfIteratorHelper(v.render),_step125;try{for(_iterator125.s();!(_step125=_iterator125.n()).done;){var y=_step125.value;y.workId&&a.add(y.workId);var C=y.drawCanvas||y.clearCanvas;if(C){var b=this.getLayer(C);if(!b||!(b.parent instanceof xi))continue;p=b.parent,p.render();}}}catch(err){_iterator125.e(err);}finally{_iterator125.f();}}else{var _iterator126=_createForOfIteratorHelper(v.render),_step126;try{for(_iterator126.s();!(_step126=_iterator126.n()).done;){var _y4=_step126.value;var _C5=!1;if(_y4.workId&&a.add(_y4.workId),_y4.isClearAll&&(_y4.rect=this.getSceneRect(),_y4.isClear=!0,delete _y4.isClearAll),_y4.drawCanvas){var _b9=this.getLayer(_y4.drawCanvas);if(!_b9||!(_b9.parent instanceof xi))continue;if(p=_b9.parent,p.render(),_y4.isDrawAll){var M=this.getSceneRect();_y4.rect=M,delete _y4.isDrawAll;}}var _iterator127=_createForOfIteratorHelper(n),_step127;try{for(_iterator127.s();!(_step127=_iterator127.n()).done;){var _b0=_step127.value;if(_y4.viewId===_b0.viewId&&_y4.eraseTxnId===_b0.eraseTxnId){_y4.isClear&&_b0.clearCanvas&&_b0.isClear&&_b0.clearCanvas===_y4.clearCanvas&&(_b0.rect=Kt(_b0.rect,_y4.rect),_C5=!0),_b0.drawCanvas&&_b0.drawCanvas===_y4.drawCanvas&&(_b0.rect=Kt(_b0.rect,_y4.rect),_C5=!0);continue;}}}catch(err){_iterator127.e(err);}finally{_iterator127.f();}_C5||(_y4.isClear&&!_y4.drawCanvas?n.unshift(_y4):n.push(_y4));}}catch(err){_iterator126.e(err);}finally{_iterator126.f();}}}catch(y){var _C6=y&&y instanceof Error?y.message:y==null?void 0:y.toString(),_b1=wMt(_C6),_M7=_b1?YT(p==null?void 0:p.gl):void 0;console.error("[WorkThreadEngineForSimpleWorker] combinePostData error",_C6),i.push({type:It.ReportError,viewId:this.viewId,viewGeneration:this.viewGeneration,reportString:"[WorkThreadEngineForSimpleWorker] combinePostData error: ".concat(_C6),reportError:_C6,reportErrorCode:_b1?yMt:void 0,reportStage:p?"layer-render":"combine-post-data",reportContextType:this.getActualContextType(),reportContextLost:_M7==null?void 0:_M7.contextLost,reportGlError:_M7==null?void 0:_M7.glError,reportCurrentProgram:_M7==null?void 0:_M7.currentProgram,reportProgramLinked:_M7==null?void 0:_M7.programLinked,reportProgramHasUniforms:_M7==null?void 0:_M7.programHasUniforms});}}if((h=v.sp)!=null&&h.length){var _iterator128=_createForOfIteratorHelper(v.sp),_step128;try{for(_iterator128.s();!(_step128=_iterator128.n()).done;){var _p7$viewGeneration;var _p7=_step128.value;var _y5=_objectSpread(_objectSpread({},_p7),{},{viewId:_p7.viewId||this.viewId,viewGeneration:(_p7$viewGeneration=_p7.viewGeneration)!==null&&_p7$viewGeneration!==void 0?_p7$viewGeneration:this.viewGeneration});var _C7=!1;var _iterator129=_createForOfIteratorHelper(i),_step129;try{for(_iterator129.s();!(_step129=_iterator129.n()).done;){var _b10=_step129.value;if(Qn(_y5,_b10)){_C7=!0;break;}}}catch(err){_iterator129.e(err);}finally{_iterator129.f();}_C7||i.push(_y5);}}catch(err){_iterator128.e(err);}finally{_iterator128.f();}}$e(v.consumeCount)&&(s=v.consumeCount,o=v.consumeWorkId);}}catch(err){_iterator124.e(err);}finally{_iterator124.f();}return{render:n,sp:i,consumeCount:s,consumeWorkId:o,workIds:a,viewId:this.viewId,viewGeneration:this.viewGeneration};}},{key:"on",value:function(){var _on4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee115(e){var n,_t140;return _regenerator().w(function(_context123){while(1)switch(_context123.n){case 0:_context123.n=1;return this.methodBuilder.consumeForWorker(e);case 1:if(!_context123.v){_context123.n=2;break;}return _context123.a(2);case 2:n=e.msgType;_t140=n;_context123.n=_t140===It.Snapshot?3:_t140===It.BoundingBox?5:7;break;case 3:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context123.n=4;return this.snapshotWork.getSnapshot(e);case 4:this.snapshotWork.destroySnapshotFullLayer();return _context123.a(2);case 5:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context123.n=6;return this.snapshotWork.getBoundingRect(e);case 6:this.snapshotWork.destroySnapshotFullLayer();return _context123.a(2);case 7:_context123.n=8;return _superPropGet(IMt,"on",this,3)([e]);case 8:return _context123.a(2);}},_callee115,this);}));function on(_x173){return _on4.apply(this,arguments);}return on;}()},{key:"setCameraOpt",value:function setCameraOpt(e){if(this.localDrawScene&&this.serviceDrawScene){var n=e.width,i=e.height;(n!==this.localDrawScene.width||i!==this.localDrawScene.height)&&this.updateScene(this.localDrawScene,{width:n,height:i},this.localDrawLayer),(n!==this.serviceDrawScene.width||i!==this.serviceDrawScene.height)&&this.updateScene(this.serviceDrawScene,{width:n,height:i},this.serviceDrawLayer);}_superPropGet(IMt,"setCameraOpt",this,3)([e]);}},{key:"updateDpr",value:function(){var _updateDpr4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee116(e){return _regenerator().w(function(_context124){while(1)switch(_context124.n){case 0:this.localDrawScene&&this.serviceDrawScene&&(this.localDrawScene.displayRatio=e,this.serviceDrawScene.displayRatio=e),_superPropGet(IMt,"updateDpr",this,3)([e]);case 1:return _context124.a(2);}},_callee116,this);}));function updateDpr(_x174){return _updateDpr4.apply(this,arguments);}return updateDpr;}()}]);}(_T);var Q1=self;Q1.full=new SMt(Q1,Eu.Full,function(r,t){var e=r.viewId,n=r.dpr,i=r.offscreenCanvasOpt,s=r.layerOpt,o=r.combineUnitTime,a=r.syncUnitTime,u=r.maxCombineEraserTime,h=r.offscreenCanvas,v=r.isUseSimple,p=r.bitmapEraserMaskOptions,y=r.viewGeneration;if(!e||!n||!i||!s)return;var C={dpr:n,offscreenCanvasOpt:i,layerOpt:s,combineUnitTime:o,syncUnitTime:a,maxCombineEraserTime:u,bitmapEraserMaskOptions:p,viewGeneration:y};return v?new IMt(e,_objectSpread(_objectSpread({},C),{},{offscreenCanvas:h}),t):new _T(e,C,t);});
|
|
488
|
+
ht(this,"delayPostDoneWaiter");ht(this,"activePostDoneWaiter");ht(this,"isCombiningPost",!1);ht(this,"combinePostTaskSequence",0);ht(this,"activeCombinePostTaskId");ht(this,"combinePostTransfersByTask",/* @__PURE__ */new Map());ht(this,"cacheImages",/* @__PURE__ */new Map());ht(this,"imageResolveMap",/* @__PURE__ */new Map());ht(this,"taskUpdateCameraId");ht(this,"taskUpdateCameraResolve");ht(this,"debounceUpdateCameraId");ht(this,"activeCameraSettledRender");ht(this,"activeCameraTaskContext");ht(this,"destroyed",!1);ht(this,"contextLossCleanup");var i,s;if(this.viewId=t,this.viewGeneration=e.viewGeneration,this.type=n,this.opt=e,this.dpr=e.dpr,this.contextType=this.getSupportContextType(n,(i=e==null?void 0:e.offscreenCanvasOpt)==null?void 0:i.contextType),!this.contextType)throw new Error("Sorry, your browser doesn't support canvas context type 2d or webgl");try{this.scene=this.createScene(e),this.createRenderLayer(this.scene,e);}catch(o){if(this.contextType!=="2d")this.contextType="2d",(s=this.scene)==null||s.disconnect(),this.scene=this.createScene(e),this.createRenderLayer(this.scene,e);else throw o;}this.registerContextLossListener(),this.vNodes=new mAt(t,this.scene);}return _createClass(GT,[{key:"getActualContextType",value:function getActualContextType(){var t;return EAt((t=this.fullLayer)==null?void 0:t.parent);}},{key:"registerContextLossListener",value:function registerContextLossListener(){var _this78=this;var e;var t=(e=this.fullLayer)==null?void 0:e.parent;this.contextLossCleanup=MAt(t,function(n){var _this78$viewGeneratio;if(_this78.destroyed)return;var i=_this78.getActualContextType(),s="[WorkThreadEngine] WebGL context lost; viewId=".concat(_this78.viewId,"; generation=").concat((_this78$viewGeneratio=_this78.viewGeneration)!==null&&_this78$viewGeneratio!==void 0?_this78$viewGeneratio:"unknown","; context=").concat(i||"unknown");try{_this78._post({sp:[{type:Tt.ReportError,viewId:_this78.viewId,viewGeneration:_this78.viewGeneration,reportString:s,reportError:"WebGL context lost",reportErrorCode:"RENDERER_RUNTIME_ERROR",reportStage:"context-lost",reportContextType:i,reportContextLost:!0,reportGlError:n.glError,reportCurrentProgram:n.currentProgram,reportProgramLinked:n.programLinked,reportProgramHasUniforms:n.programHasUniforms}]});}catch(o){console.error(s,o);}});}},{key:"removeContextLossListener",value:function removeContextLossListener(){var t;(t=this.contextLossCleanup)==null||t.call(this),this.contextLossCleanup=void 0;}},{key:"createRenderLayer",value:function createRenderLayer(t,e){var n=Jr.bufferSize.full,i=Jr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",t,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:this.viewId===Bs?n:i*2}));}},{key:"updateDpr",value:function(){var _updateDpr=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(t){return _regenerator().w(function(_context24){while(1)switch(_context24.n){case 0:this.dpr=t,this.scene.displayRatio=t;case 1:return _context24.a(2);}},_callee23,this);}));function updateDpr(_x54){return _updateDpr.apply(this,arguments);}return updateDpr;}()},{key:"getCachedImages",value:function getCachedImages(t){var e;return(e=this.cacheImages.get(t))==null?void 0:e.imageBitmap;}},{key:"getCachedImagesByWorkId",value:function getCachedImagesByWorkId(t){var _iterator81=_createForOfIteratorHelper(this.cacheImages.entries()),_step81;try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){var _step81$value=_slicedToArray(_step81.value,2),e=_step81$value[0],n=_step81$value[1];if(e===t&&n.imageBitmap)return n.imageBitmap;}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}}},{key:"deleteCachedImagesByWorkId",value:function deleteCachedImagesByWorkId(t,e){var _iterator82=_createForOfIteratorHelper(this.cacheImages.entries()),_step82;try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){var _step82$value=_slicedToArray(_step82.value,2),n=_step82$value[0],i=_step82$value[1];e&&n===e||i.workId===t&&(this.closeImageBitmap(i.imageBitmap),this.cacheImages.delete(n));}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}}},{key:"clearCacheImages",value:function clearCacheImages(){var _this79=this;this.cacheImages.forEach(function(t){return _this79.closeImageBitmap(t.imageBitmap);}),this.cacheImages.clear();}},{key:"closeImageBitmap",value:function closeImageBitmap(t){if(t)try{t.close();}catch(_unused35){}}},{key:"clearImageResolveMap",value:function clearImageResolveMap(){this.imageResolveMap.forEach(function(_ref80,n){var t=_ref80.timer,e=_ref80.resolve;t&&clearTimeout(t),e==null||e(n);}),this.imageResolveMap.clear();}},{key:"setIsSafari",value:function setIsSafari(t){this.isSafari=t;}},{key:"on",value:function(){var _on=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(t){var _this80=this;var v,p,y,C,e,n,i,s,o,a,u,h,b,_b3,M,X,_b4,_b5,_M3,L,_X7,_t27,_t28,_t29,_t30;return _regenerator().w(function(_context27){while(1)switch(_context27.p=_context27.n){case 0:if(!this.destroyed){_context27.n=1;break;}try{(v=t.imageBitmap)==null||v.close();}catch(_unused36){}return _context27.a(2);case 1:e=t.msgType,n=t.toolsType,i=t.opt,s=t.imageSrc,o=t.imageBitmap,a=t.workId,u=t.dpr,h=t.requestId;_t27=e;_context27.n=_t27===Tt.UpdateDpr?2:_t27===Tt.UpdateCamera?4:_t27===Tt.Destroy?8:_t27===Tt.CancelBitmapEraser?9:_t27===Tt.Clear?10:_t27===Tt.ServiceSyncCommit?12:_t27===Tt.UpdateTools?19:_t27===Tt.GetImageBitMap?20:23;break;case 2:_t28=$e(u);if(!_t28){_context27.n=3;break;}_context27.n=3;return this.updateDpr(u);case 3:return _context27.a(3,23);case 4:_context27.p=4;_context27.n=5;return SAt(t.cameraTaskId,/*#__PURE__*/function(){var _ref81=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(b){return _regenerator().w(function(_context25){while(1)switch(_context25.p=_context25.n){case 0:_this80.activeCameraTaskContext=b;_context25.p=1;_context25.n=2;return _this80.updateCamera(t,b);case 2:_context25.p=2;_this80.activeCameraTaskContext===b&&(_this80.activeCameraTaskContext=void 0);return _context25.f(2);case 3:return _context25.a(2);}},_callee24,null,[[1,,2,3]]);}));return function(_x56){return _ref81.apply(this,arguments);};}());case 5:_context27.n=7;break;case 6:_context27.p=6;_t29=_context27.v;throw this.cameraOpt=void 0,this.cancelCameraSettledRender(),_t29;case 7:return _context27.a(3,23);case 8:this.destroy();return _context27.a(3,23);case 9:b=(p=t.workId)==null?void 0:p.toString();b&&"abortBitmapEraser"in this.localWork&&this.localWork.abortBitmapEraser(b);return _context27.a(3,23);case 10:_context27.n=11;return this.clearAll();case 11:return _context27.a(3,23);case 12:_b3=this,M=[(y=this.fullLayer)==null?void 0:y.parent,(C=_b3.topLayer)==null?void 0:C.parent].filter(Boolean);_context27.p=13;_context27.n=14;return j1(_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(){return _regenerator().w(function(_context26){while(1)switch(_context26.n){case 0:_context26.n=1;return OAt(_this80.serviceWork,M);case 1:return _context26.a(2);}},_callee25);}))(),{business:"service-sync-commit",stage:"flush-and-prepare-render",timeoutMs:5e3});case 14:_context27.n=16;break;case 15:_context27.p=15;_t30=_context27.v;X=Au(_t30,{business:"service-sync-commit",stage:"flush-and-prepare-render"});throw this.reportRendererBusinessError(X,{business:"service-sync-commit",stage:"flush-and-prepare-render"}),X;case 16:if(!this.destroyed){_context27.n=17;break;}return _context27.a(3,23);case 17:_context27.n=18;return this.post({sp:[{type:Tt.ServiceSyncCommit,viewId:this.viewId,viewGeneration:this.viewGeneration,scenePath:t.scenePath,serviceSyncId:t.serviceSyncId,serviceRevision:t.serviceRevision}]});case 18:return _context27.a(3,23);case 19:if(n&&i){_b4={toolsType:n,toolsOpt:i,combineUnitTime:t.combineUnitTime,maxCombineEraserTime:t.maxCombineEraserTime};this.localWork.setToolsOpt(_b4);}return _context27.a(3,23);case 20:if(!(s&&o&&a)){_context27.n=22;break;}_b5=a.toString(),_M3=this.imageResolveMap.get(s);if(!(!_M3||_M3.requestId!==h)){_context27.n=21;break;}this.closeImageBitmap(o);return _context27.a(3,23);case 21:this.cacheImages.set(s,{imageBitmap:o,workId:_b5});L=_M3.resolve,_X7=_M3.timer;_X7&&clearTimeout(_X7),L&&L(s),this.deleteCachedImagesByWorkId(_b5,s);case 22:return _context27.a(3,23);case 23:return _context27.a(2);}},_callee26,this,[[13,15],[4,6]]);}));function on(_x55){return _on.apply(this,arguments);}return on;}()},{key:"getIconSize",value:function getIconSize(t,e,n){var i=t*n,s=e*n;return i<=50||s<=50?[50,50]:i<=100||s<=100?[100,100]:i<=200||s<=200?[200,200]:i<=400||s<=400?[400,400]:i<=800||s<=800?[800,800]:[1600,1600];}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(t){var _this81=this;var e,n,i,s,o,a,u,h,v,p,y,C,_this$getIconSize,_this$getIconSize2,et,A,_et4,M,L,X,Y;return _regenerator().w(function(_context28){while(1)switch(_context28.n){case 0:e=t.toolsType,n=t.opt,i=t.workId,s=t.isSubWorker,o=t.requestId;if(!(e===St.Image&&n&&i)){_context28.n=6;break;}a=i.toString(),u=n.src,h=n.type,v=n.width,p=n.height,y=n.strokeColor;if(!(!u||!h||!v||!p)){_context28.n=1;break;}return _context28.a(2);case 1:C=u;if(h===lf.Iconify){_this$getIconSize=this.getIconSize(v,p,this.dpr),_this$getIconSize2=_slicedToArray(_this$getIconSize,2),et=_this$getIconSize2[0],A=_this$getIconSize2[1];C=yAt(u,et,A,y);}if(!this.cacheImages.has(C)){_context28.n=2;break;}_et4=this.getCachedImages(C);if(!_et4){_context28.n=2;break;}return _context28.a(2,_et4);case 2:M=this.imageResolveMap.get(C);if(!M){_context28.n=4;break;}_context28.n=3;return M.promise;case 3:return _context28.a(2,this.getCachedImages(C));case 4:X=new Promise(function(et){L=et;}),Y={resolve:L,timer:void 0,requestId:o,promise:X};Y.timer=setTimeout(function(){_this81.imageResolveMap.get(C)===Y&&L(C);},5e3);this.imageResolveMap.set(C,Y);this._post({sp:[{imageSrc:C,workId:a,viewId:this.viewId,isgl:!!this.fullLayer.parent.gl,isSubWorker:s,requestId:o,type:Tt.GetImageBitMap}]});_context28.n=5;return X;case 5:this.imageResolveMap.get(C)===Y&&this.imageResolveMap.delete(C);return _context28.a(2,this.getCachedImages(C));case 6:return _context28.a(2);}},_callee27,this);}));function loadImageBitMap(_x57){return _loadImageBitMap.apply(this,arguments);}return loadImageBitMap;}()},{key:"createLocalWork",value:function createLocalWork(t){var e=t.workId,n=t.opt,i=t.toolsType;e&&n&&(!this.localWork.getToolsOpt()&&i&&this.setToolsOpt({toolsType:i,toolsOpt:n}),this.setWorkOpt({workId:e,toolsOpt:n}));}},{key:"updateScene",value:function updateScene(t,e,n){t.attr(_objectSpread({},e));var i=e.width,s=e.height;t.container.width=i,t.container.height=s,t.width=i,t.height=s,this.updateLayer({width:i,height:s},n);}},{key:"updateLayer",value:function updateLayer(t,e){var n=t.width,i=t.height,s=e||this.fullLayer;s&&(s.parent.setAttribute("width",n),s.parent.setAttribute("height",i),s.setAttribute("size",[n,i]),s.setAttribute("pos",[n*0.5,i*0.5]));}},{key:"getSupportContextType",value:function getSupportContextType(t,e){return AAt(t===Eu.Full&&this.viewId===Bs,e);}},{key:"createScene",value:function createScene(t){var e=t.offscreenCanvasOpt,n=e.width,i=e.height,s=new OffscreenCanvas(n,i);e.contextType&&delete e.contextType;var o=new sf(_objectSpread(_objectSpread({container:s,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},e),{},{contextType:this.contextType,id:this.viewId}));return o.setAttribute("id",this.viewId),o;}},{key:"createLayer",value:function createLayer(t,e,n,i){var s="offscreen-".concat(t),o=n.width,a=n.height;i&&(n.offscreen=!0,n.canvas=i);var u=e.layer(s,n),h=new nr({anchor:[0.5,0.5],pos:[o*0.5,a*0.5],size:[o,a],name:"viewport",id:t});return u.append(h),h;}},{key:"clearAll",value:function(){var _clearAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(){var t;return _regenerator().w(function(_context29){while(1)switch(_context29.n){case 0:this.fullLayer&&(this.fullLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.fullLayer,this.fullLayer.parent)),this.cancelCameraBlockingWait(),this.cancelCameraSettledRender(),this.clearCacheImages(),this.clearImageResolveMap(),this.localWork.destroy(),(t=this.serviceWork)==null||t.clearAll();case 1:return _context29.a(2);}},_callee28,this);}));function clearAll(){return _clearAll.apply(this,arguments);}return clearAll;}()},{key:"setToolsOpt",value:function setToolsOpt(t){this.localWork.setToolsOpt(t);}},{key:"setWorkOpt",value:function setWorkOpt(t){var e=t.workId,n=t.toolsOpt;e&&n&&this.localWork.setWorkOptions(e.toString(),n);}},{key:"destroy",value:function destroy(){var _this82=this;var n,i;if(this.destroyed)return;this.destroyed=!0,(i=(n=this.activeCameraTaskContext)==null?void 0:n.abort)==null||i.call(n),this.activeCameraTaskContext=void 0;var t=[],e=function e(s,o){try{o();}catch(a){t.push("".concat(s,": ").concat(a instanceof Error?a.message:String(a)));}};e("context-loss-listener",function(){return _this82.removeContextLossListener();}),e("camera-blocking-wait",function(){return _this82.cancelCameraBlockingWait();}),e("camera-render",function(){return _this82.cancelCameraSettledRender();}),e("worker-task",function(){_this82.workerTaskId!==void 0&&(clearTimeout(_this82.workerTaskId),_this82.workerTaskId=void 0);}),e("post-waiters",function(){var s,o;(s=_this82.delayPostDoneWaiter)==null||s.resolve(),(o=_this82.activePostDoneWaiter)==null||o.resolve(),_this82.delayPostDoneWaiter=void 0,_this82.activePostDoneWaiter=void 0;}),e("post-transfers",function(){_this82.activeCombinePostTaskId=void 0,_this82.combinePostTaskSequence++;for(var _i11=0,_arr4=_toConsumableArray(_this82.combinePostTransfersByTask.keys());_i11<_arr4.length;_i11++){var s=_arr4[_i11];_this82.releaseCombinePostTransfers(s);}_this82.combinePostMsg.clear();}),e("v-nodes",function(){return _this82.vNodes.clear();}),e("full-layer",function(){var s=_this82.fullLayer.parent;s&&_zr(_this82.fullLayer,s),_this82.fullLayer.remove();}),e("image-cache",function(){return _this82.clearCacheImages();}),e("image-waiters",function(){return _this82.clearImageResolveMap();}),e("scene",function(){return _this82.scene.remove();}),e("local-work",function(){return _this82.localWork.destroy();}),e("service-work",function(){var s;return(s=_this82.serviceWork)==null?void 0:s.destroy();}),t.length&&console.error("[WorkThreadEngine]: destroy completed with cleanup errors viewId=".concat(this.viewId,": ").concat(t.join("; ")));}},{key:"cancelCameraSettledRender",value:function cancelCameraSettledRender(){var e;this.debounceUpdateCameraId!==void 0&&(clearTimeout(this.debounceUpdateCameraId),this.debounceUpdateCameraId=void 0);var t=this.activeCameraSettledRender;t&&(t.cancelled=!0,(e=t.renderLayers)==null||e.forEach(function(n){return n.cancelPendingRender();}),this.activeCameraSettledRender=void 0);}},{key:"retargetCameraSettledRender",value:function retargetCameraSettledRender(t){var n;if(!$e(t))return!1;var e=this.activeCameraSettledRender;return!e||e.cancelled||(n=e.context)!=null&&n.aborted?!1:(e.cameraTaskId=t,!0);}},{key:"hasCameraSettledRender",value:function hasCameraSettledRender(){return!!this.activeCameraSettledRender;}},{key:"cancelCameraBlockingWait",value:function cancelCameraBlockingWait(){this.taskUpdateCameraId!==void 0&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0);var t=this.taskUpdateCameraResolve;this.taskUpdateCameraResolve=void 0,t==null||t(!1);}},{key:"startCameraSettledRender",value:function startCameraSettledRender(t,e){var _this83=this;var n={cancelled:!1,cameraTaskId:t,context:e};return this.activeCameraSettledRender=n,{isActive:function isActive(){return!_this83.destroyed&&!n.cancelled&&_this83.activeCameraSettledRender===n&&!(e!=null&&e.aborted);},getCameraTaskId:function getCameraTaskId(){return n.cameraTaskId;},setRenderLayers:function setRenderLayers(i){n.renderLayers=i;},finish:function finish(){n.renderLayers=void 0,_this83.activeCameraSettledRender===n&&(_this83.activeCameraSettledRender=void 0);}};}},{key:"post",value:function post(t){var _this84=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i;if(this.destroyed)return(i=t.render)==null||i.forEach(function(s){return _this84.closeImageBitmap(s.imageBitmap);}),Promise.resolve();this.combinePostMsg.add(t);var n=this.type===Eu.Full?this.getOrCreatePostDoneWaiter(e.reportFailureAtRendererBoundary!==!1):void 0;return this.runBatchPostData(),n?(n.promise.catch(function(){}),n.promise):Promise.resolve();}},{key:"getOrCreatePostDoneWaiter",value:function getOrCreatePostDoneWaiter(t){if(this.delayPostDoneWaiter)t||(this.delayPostDoneWaiter.reportFailureAtRendererBoundary=!1);else{var e,n;var i=new Promise(function(s,o){e=s,n=o;});this.delayPostDoneWaiter={promise:i,resolve:e,reject:n,reportFailureAtRendererBoundary:t};}return this.delayPostDoneWaiter;}},{key:"runBatchPostData",value:function runBatchPostData(){var _this85=this;this.destroyed||!this.workerTaskId&&!this.isCombiningPost&&(this.workerTaskId=setTimeout(function(){_this85.workerTaskId=void 0;var t=_this85.delayPostDoneWaiter;_this85.delayPostDoneWaiter=void 0,_this85.activePostDoneWaiter=t,_this85.isCombiningPost=!0;var e=++_this85.combinePostTaskSequence;_this85.activeCombinePostTaskId=e,_this85.combinePostTransfersByTask.set(e,/* @__PURE__ */new Set()),_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(){var n,i,o,_t31;return _regenerator().w(function(_context30){while(1)switch(_context30.p=_context30.n){case 0:n=!1;_context30.p=1;_context30.n=2;return _this85.waitForRendererBusiness(_this85.combinePost(e),{business:"combine-post",stage:"flush"});case 2:_context30.n=4;break;case 3:_context30.p=3;_t31=_context30.v;n=!0;o=Au(_t31,{business:"combine-post",stage:"flush"});i=o,(t==null?void 0:t.reportFailureAtRendererBoundary)!==!1&&_this85.reportRendererBusinessError(o,{business:"combine-post",stage:"flush"});case 4:_context30.p=4;_this85.releaseCombinePostTransfers(e),_this85.activePostDoneWaiter===t&&(_this85.activePostDoneWaiter=void 0),_this85.activeCombinePostTaskId===e&&(_this85.activeCombinePostTaskId=void 0),_this85.isCombiningPost=!1,_this85.combinePostMsg.size&&_this85.runBatchPostData();return _context30.f(4);case 5:n?t==null||t.reject(i):t==null||t.resolve();case 6:return _context30.a(2);}},_callee29,null,[[1,3,4,5]]);}))();},16));}},{key:"waitForRendererBusiness",value:function waitForRendererBusiness(t,e){return j1(t,e);}},{key:"reportRendererBusinessError",value:function reportRendererBusinessError(t,e){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(Ws(t)&&t.reported)return;var i=WT(t,e,{viewId:this.viewId,renderer:this.type});Ws(t)&&(t.reported=!0);try{this._post({sp:[{type:Tt.ReportError,viewId:this.viewId,viewGeneration:this.viewGeneration,reportString:i,reportErrorCode:n?"RENDERER_RUNTIME_ERROR":void 0,reportStage:e.stage,reportError:t instanceof Error?t.message:String(t)}]});}catch(s){console.error(i,s);}}},{key:"isCombinePostTaskActive",value:function isCombinePostTaskActive(t){return this.activeCombinePostTaskId===t;}},{key:"trackCombinePostTransfer",value:function trackCombinePostTransfer(t,e){var n=this.combinePostTransfersByTask.get(t);return!n||!this.isCombinePostTaskActive(t)?(this.closeCombinePostTransfers([e]),!1):(n.add(e),!0);}},{key:"commitCombinePostTransfers",value:function commitCombinePostTransfers(t){this.combinePostTransfersByTask.delete(t);}},{key:"releaseCombinePostTransfers",value:function releaseCombinePostTransfers(t){var e=this.combinePostTransfersByTask.get(t);e&&(this.combinePostTransfersByTask.delete(t),this.closeCombinePostTransfers(_toConsumableArray(e)));}},{key:"closeCombinePostTransfers",value:function closeCombinePostTransfers(t){var _iterator83=_createForOfIteratorHelper(t||[]),_step83;try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){var e=_step83.value;var n=e.close;if(typeof n=="function")try{n.call(e);}catch(_unused37){}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}}},{key:"transferLayerToImageBitmap",value:function transferLayerToImageBitmap(t){var e=this.getLayer(t),n=e==null?void 0:e.parent;if(!(n instanceof xi))throw new Error("render Layer is unavailable: ".concat(String(t)));return n.transferToImageBitmap();}},{key:"combinePostData",value:function combinePostData(){var h,v;var t=this.combinePostMsg;this.combinePostMsg=/* @__PURE__ */new Set();var e=[],n=[];var i,s,o,a;var u=/* @__PURE__ */new Set();var _iterator84=_createForOfIteratorHelper(t.values()),_step84;try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){var p=_step84.value;if((h=p.render)!=null&&h.length){var _iterator85=_createForOfIteratorHelper(p.render),_step85;try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){var y=_step85.value;var C=!1;if(y.workId&&u.add(y.workId),y.viewId||(y.viewId=this.viewId),y.viewGeneration===void 0&&(y.viewGeneration=this.viewGeneration),y.isClearAll&&(y.rect=this.getSceneRect(),y.isClear=!0,delete y.isClearAll),y.drawCanvas){var b=this.getLayer(y.drawCanvas);if(!b||!(b.parent instanceof xi))continue;if(b.parent.render(),y.isDrawAll){var M=this.getSceneRect();y.rect=M,delete y.isDrawAll;}}var _iterator86=_createForOfIteratorHelper(e),_step86;try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){var _b6=_step86.value;if(y.viewId===_b6.viewId&&y.eraseTxnId===_b6.eraseTxnId){y.isClear&&_b6.clearCanvas&&_b6.isClear&&_b6.clearCanvas===y.clearCanvas&&(_b6.rect=Kt(_b6.rect,y.rect),C=!0),_b6.drawCanvas&&_b6.drawCanvas===y.drawCanvas&&(_b6.rect=Kt(_b6.rect,y.rect),C=!0);continue;}}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}C||(y.isClear&&!y.drawCanvas?e.unshift(y):e.push(y));}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}}if((v=p.sp)!=null&&v.length){var _iterator87=_createForOfIteratorHelper(p.sp),_step87;try{for(_iterator87.s();!(_step87=_iterator87.n()).done;){var _y3$viewGeneration;var _y3=_step87.value;var _C3=_objectSpread(_objectSpread({},_y3),{},{viewId:_y3.viewId||this.viewId,viewGeneration:(_y3$viewGeneration=_y3.viewGeneration)!==null&&_y3$viewGeneration!==void 0?_y3$viewGeneration:this.viewGeneration});var _b7=!1;var _iterator88=_createForOfIteratorHelper(n),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var _M4=_step88.value;if(Qn(_C3,_M4)){_b7=!0;break;}}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}_b7||n.push(_C3);}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}}$e(p.fullWorkerDrawCount)&&(i=p.fullWorkerDrawCount),$e(p.subWorkerDrawCount)&&(s=p.subWorkerDrawCount),$e(p.consumeCount)&&(o=p.consumeCount,a=p.consumeWorkId);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}return{render:e,sp:n,fullWorkerDrawCount:i,subWorkerDrawCount:s,consumeCount:o,consumeWorkId:a,workIds:u,viewId:this.viewId,viewGeneration:this.viewGeneration};}},{key:"getSceneRect",value:function getSceneRect(){var _this$scene=this.scene,t=_this$scene.width,e=_this$scene.height;return{x:0,y:0,w:Math.floor(t),h:Math.floor(e)};}}]);}();var zv=/*#__PURE__*/function(){function zv(t){_classCallCheck(this,zv);ht(this,"viewId");ht(this,"vNodes");ht(this,"thread");ht(this,"fullLayer");ht(this,"drawLayer");ht(this,"_post");ht(this,"tmpOpt");ht(this,"workShapes",/* @__PURE__ */new Map());ht(this,"drawCount",0);ht(this,"consumeCount",0);ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"combineUnitTime",Jr.bezier.combineUnitTime);ht(this,"maxCombineEraserTime",UT);ht(this,"eraserBatchScheduler",new IAt());ht(this,"drawAckBackpressure",new PAt());this.thread=t.thread,this.viewId=t.viewId,this.vNodes=t.vNodes,this.fullLayer=t.fullLayer,this.drawLayer=t.drawLayer,this._post=this.thread.post.bind(t.thread);}return _createClass(zv,[{key:"eraserBatchDelay",get:function get(){return xAt(this.maxCombineEraserTime);}},{key:"setmaxCombineEraserTime",value:function setmaxCombineEraserTime(t){this.maxCombineEraserTime=t;}},{key:"setCombineUnitTime",value:function setCombineUnitTime(t){this.combineUnitTime=t;}},{key:"setSyncUnitTime",value:function setSyncUnitTime(t){this.syncUnitTime=t;}},{key:"destroy",value:function destroy(){this.eraserBatchScheduler.cancel(),this.drawAckBackpressure.cancel(),this.workShapes.forEach(function(t){return t.clearTmpPoints();}),this.workShapes.clear();}},{key:"getWorkShapes",value:function getWorkShapes(){return this.workShapes;}},{key:"getWorkShape",value:function getWorkShape(t){return this.workShapes.get(t);}},{key:"createWorkShape",value:function createWorkShape(t,e){if(t&&this.tmpOpt){var n={toolsType:this.tmpOpt.toolsType,toolsOpt:e||this.tmpOpt.toolsOpt},i=this.createWorkShapeNode(_objectSpread(_objectSpread({},n),{},{workId:t}));i&&this.workShapes.set(t,i);}}},{key:"setWorkOptions",value:function setWorkOptions(t,e){var n=this.getWorkShape(t);n||this.createWorkShape(t,e),n==null||n.setWorkOptions(e);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(t){var e;return mf(_objectSpread(_objectSpread({},t),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(e=this.thread)==null?void 0:e.serviceWork);}},{key:"setToolsOpt",value:function setToolsOpt(t){var e,n,i;((e=this.tmpOpt)==null?void 0:e.toolsType)!==t.toolsType&&(n=this.tmpOpt)!=null&&n.toolsType&&this.clearAllWorkShapesCache(),this.tmpOpt=t,(i=t.toolsOpt)!=null&&i.syncUnitTime&&(this.syncUnitTime=t.toolsOpt.syncUnitTime),t.combineUnitTime&&(this.combineUnitTime=t.combineUnitTime),t.maxCombineEraserTime&&(this.maxCombineEraserTime=t.maxCombineEraserTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"clearWorkShapeNodeCache",value:function clearWorkShapeNodeCache(t){var e;(e=this.getWorkShape(t))==null||e.clearTmpPoints(),this.workShapes.delete(t);}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.eraserBatchScheduler.cancel(),this.drawAckBackpressure.cancel();var _iterator89=_createForOfIteratorHelper(this.workShapes),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var _step89$value=_slicedToArray(_step89.value,2),t=_step89$value[0],e=_step89$value[1];t!==De&&(e.clearTmpPoints(),this.workShapes.delete(t));}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}},{key:"setFullWork",value:function setFullWork(t){var e=t.workId,n=t.opt,i=t.toolsType;if(e&&n&&i){var s=e.toString();var o;return e&&this.workShapes.has(s)?(o=this.workShapes.get(s),(o==null?void 0:o.toolsType)!==i?(o==null||o.clearTmpPoints(),this.workShapes.delete(s),o=void 0):o==null||o.setWorkOptions(n)):o=this.createWorkShapeNode({toolsOpt:n,toolsType:i,workId:s}),o||(o=this.createWorkShapeNode({toolsOpt:n,toolsType:i,workId:s})),o?(this.workShapes.set(s,o),o):void 0;}}}]);}();function DAt(r){return r;}var jT=DAt;function NAt(r,t,e){switch(e.length){case 0:return r.call(t);case 1:return r.call(t,e[0]);case 2:return r.call(t,e[0],e[1]);case 3:return r.call(t,e[0],e[1],e[2]);}return r.apply(t,e);}var kAt=NAt,BAt=kAt,H1=Math.max;function FAt(r,t,e){return t=H1(t===void 0?r.length-1:t,0),function(){for(var n=arguments,i=-1,s=H1(n.length-t,0),o=Array(s);++i<s;)o[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=e(o),BAt(r,this,a);};}var WAt=FAt;function UAt(r){return function(){return r;};}var zAt=UAt,$At=zAt,V1=M2,YAt=jT,GAt=V1?function(r,t){return V1(r,"toString",{configurable:!0,enumerable:!1,value:$At(t),writable:!0});}:YAt,jAt=GAt,XAt=800,HAt=16,VAt=Date.now;function ZAt(r){var t=0,e=0;return function(){var n=VAt(),i=HAt-(n-e);if(e=n,i>0){if(++t>=XAt)return arguments[0];}else t=0;return r.apply(void 0,arguments);};}var qAt=ZAt,KAt=jAt,QAt=qAt,JAt=QAt(KAt),_At=JAt,tEt=jT,eEt=WAt,rEt=_At;function nEt(r,t){return rEt(eEt(r,t,tEt),r+"");}var iEt=nEt;function sEt(r,t,e,n){for(var i=r.length,s=e+(n?1:-1);n?s--:++s<i;)if(t(r[s],s,r))return s;return-1;}var oEt=sEt;function aEt(r){return r!==r;}var lEt=aEt;function cEt(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1;}var uEt=cEt,fEt=oEt,hEt=lEt,dEt=uEt;function pEt(r,t,e){return t===t?dEt(r,t,e):fEt(r,hEt,e);}var vEt=pEt,gEt=vEt;function mEt(r,t){var e=r==null?0:r.length;return!!e&&gEt(r,t,0)>-1;}var XT=mEt;function yEt(r,t,e){for(var n=-1,i=r==null?0:r.length;++n<i;)if(e(t,r[n]))return!0;return!1;}var HT=yEt;function wEt(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++e<n;)i[e]=t(r[e],e,r);return i;}var SEt=wEt,TEt=Dv,IEt=XT,CEt=HT,xEt=SEt,PEt=pf,bEt=Nv,AEt=200;function EEt(r,t,e,n){var i=-1,s=IEt,o=!0,a=r.length,u=[],h=t.length;if(!a)return u;e&&(t=xEt(t,PEt(e))),n?(s=CEt,o=!1):t.length>=AEt&&(s=bEt,o=!1,t=new TEt(t));t:for(;++i<a;){var v=r[i],p=e==null?v:e(v);if(v=n||v!==0?v:0,o&&p===p){for(var y=h;y--;)if(t[y]===p)continue t;u.push(v);}else s(t,p,n)||u.push(v);}return u;}var MEt=EEt,Z1=vl,LEt=D2,REt=ml,q1=Z1?Z1.isConcatSpreadable:void 0;function OEt(r){return REt(r)||LEt(r)||!!(q1&&r&&r[q1]);}var DEt=OEt,NEt=Ev,kEt=DEt;function VT(r,t,e,n,i){var s=-1,o=r.length;for(e||(e=kEt),i||(i=[]);++s<o;){var a=r[s];t>0&&e(a)?t>1?VT(a,t-1,e,n,i):NEt(i,a):n||(i[i.length]=a);}return i;}var BEt=VT;function FEt(){}var WEt=FEt,$d=j2,UEt=WEt,zEt=kv,$Et=1/0,YEt=$d&&1/zEt(new $d([,-0]))[1]==$Et?function(r){return new $d(r);}:UEt,GEt=YEt,jEt=Dv,XEt=XT,HEt=HT,VEt=Nv,ZEt=GEt,qEt=kv,KEt=200;function QEt(r,t,e){var n=-1,i=XEt,s=r.length,o=!0,a=[],u=a;if(e)o=!1,i=HEt;else if(s>=KEt){var h=t?null:ZEt(r);if(h)return qEt(h);o=!1,i=VEt,u=new jEt();}else u=t?[]:a;t:for(;++n<s;){var v=r[n],p=t?t(v):v;if(v=e||v!==0?v:0,o&&p===p){for(var y=u.length;y--;)if(u[y]===p)continue t;t&&u.push(p),a.push(v);}else i(u,p,e)||(u!==a&&u.push(p),a.push(v));}return a;}var JEt=QEt,_Et=MEt,tMt=BEt,K1=JEt;function eMt(r,t,e){var n=r.length;if(n<2)return n?K1(r[0]):[];for(var i=-1,s=Array(n);++i<n;)for(var o=r[i],a=-1;++a<n;)a!=i&&(s[i]=_Et(s[i]||o,r[a],t,e));return K1(tMt(s,1),t,e);}var rMt=eMt,nMt=xv,iMt=Mi;function sMt(r){return iMt(r)&&nMt(r);}var oMt=sMt,aMt=W2,lMt=iEt,cMt=rMt,uMt=oMt,fMt=lMt(function(r){return cMt(aMt(r,uMt));}),hMt=fMt;var dMt=/* @__PURE__ */$n(hMt);var ZT=/*#__PURE__*/function(_zv){function ZT(e){var _this86;_classCallCheck(this,ZT);_this86=_callSuper(this,ZT,[e]);ht(_this86,"_type","full");ht(_this86,"combineTimerId");ht(_this86,"combineDrawResolve");ht(_this86,"combineDrawActiveId");ht(_this86,"disposeVNodeRevisionObserver");ht(_this86,"bitmapEraserRenderQueue",Promise.resolve());ht(_this86,"bitmapEraserRevalidationQueued",!1);ht(_this86,"drawWorkActiveId");ht(_this86,"effectSelectNodeData",/* @__PURE__ */new Set());_this86.disposeVNodeRevisionObserver=_this86.vNodes.observeRevision(function(){_this86.scheduleActiveBitmapEraserRevalidation();});return _this86;}/** Stop queued Bitmap Eraser work and restore Doing-time hidden nodes. */_inherits(ZT,_zv);return _createClass(ZT,[{key:"abortBitmapEraser",value:function abortBitmapEraser(e){var n=this.workShapes.get(e);(n==null?void 0:n.toolsType)===St.BitMapEraser&&(n.clearTmpPoints(),this.workShapes.delete(e),this.combineDrawActiveId===e&&(this.combineDrawActiveId=void 0),this.drawWorkActiveId===e&&(this.drawWorkActiveId=void 0),this.bitmapEraserRenderQueue=Promise.resolve());}},{key:"publishBitmapEraserBeforeImages",value:function publishBitmapEraserBeforeImages(e,n){n.size&&this.thread.post({sp:[{type:Tt.None,viewId:this.viewId,eraseTxnId:e,eraseTxnBeforeImages:new Map(n)}]});}},{key:"scheduleActiveBitmapEraserRevalidation",value:function scheduleActiveBitmapEraserRevalidation(){var _this87=this;var e=this.combineDrawActiveId;if(!e)return;var n=this.getWorkShape(e);(n==null?void 0:n.toolsType)!==St.BitMapEraser||!n.shouldRevalidateVNodeRevision()||this.bitmapEraserRevalidationQueued||(this.bitmapEraserRevalidationQueued=!0,this.enqueueBitmapEraserRender(e).catch(function(i){_this87.thread.reportRendererBusinessError(i,{business:"bitmap-eraser",stage:"revision-revalidation:".concat(e)});}).finally(function(){_this87.bitmapEraserRevalidationQueued=!1;}));}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(e){return _regenerator().w(function(_context31){while(1)switch(_context31.n){case 0:_context31.n=1;return this.thread.loadImageBitMap(e);case 1:return _context31.a(2,_context31.v);}},_callee30,this);}));function loadImageBitMap(_x58){return _loadImageBitMap2.apply(this,arguments);}return loadImageBitMap;}()},{key:"consumeDraw",value:function(){var _consumeDraw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(e,n){var _this88=this;var i,s,o,a,u,h,v,p,C,y,_t32,_t33,_t34,_t35,_t36;return _regenerator().w(function(_context32){while(1)switch(_context32.n){case 0:i=e.op,s=e.workId,o=e.scenePath,a=e.postCount,u=e.smoothSync;if(!(i!=null&&i.length&&s)){_context32.n=17;break;}h=s.toString(),v=this.getWorkShape(h);if(v){_context32.n=1;break;}return _context32.a(2);case 1:p=v.toolsType;if(!(p===St.LaserPen)){_context32.n=2;break;}return _context32.a(2);case 2:if(!(this.combineDrawActiveId&&this.combineDrawActiveId!==h)){_context32.n=3;break;}C=this.combineDrawActiveId;this.eraserBatchScheduler.cancel();this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);_context32.n=3;return this.consumeDrawAll({workId:C,scenePath:o,viewId:this.viewId,msgType:Tt.DrawWork,dataType:Qt.Local},n);case 3:_t32=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_t32){_context32.n=5;break;}_context32.n=4;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:o,viewId:this.viewId,msgType:Tt.DrawWork,dataType:Qt.Local},n);case 4:this.drawWorkActiveId=void 0;case 5:!this.drawWorkActiveId&&h!==De&&(this.drawWorkActiveId=h);$e(a)&&(this.consumeCount=a);y=v.consume({data:e,isFullWork:!0,smoothSync:u});_t33=p;_context32.n=_t33===St.Selector?6:_t33===St.PencilEraser?8:_t33===St.BitMapEraser?9:_t33===St.Eraser?11:_t33===St.Arrow?13:_t33===St.Straight?13:_t33===St.Ellipse?13:_t33===St.Rectangle?13:_t33===St.Star?13:_t33===St.Polygon?13:_t33===St.SpeechBalloon?13:_t33===St.Pencil?15:17;break;case 6:_t34=y.type===Tt.Select;if(!_t34){_context32.n=7;break;}y.selectIds&&n.runReverseSelectWork(y.selectIds);_context32.n=7;return this.drawSelector(_objectSpread(_objectSpread({},y),{},{scenePath:o,isSelecting:!0}),e.workState||te.Doing);case 7:return _context32.a(3,17);case 8:this.drawCount++,this.combineDrawActiveId=h,this.eraserBatchScheduler.schedule(function(){_this88.drawPencilEraserCombine(h,_this88.drawCount,e.needUndoTicker,e.collectUndoTicker);},this.eraserBatchDelay);return _context32.a(3,17);case 9:this.drawCount++;this.combineDrawActiveId=h;_context32.n=10;return this.enqueueBitmapEraserRender(h,this.drawCount,e.needUndoTicker,e.collectUndoTicker,{consumeCount:this.consumeCount,consumeWorkId:h});case 10:return _context32.a(3,17);case 11:_context32.n=12;return this.drawEraser(y,void 0,e.needUndoTicker,e.collectUndoTicker);case 12:return _context32.a(3,17);case 13:_t35=y;if(!_t35){_context32.n=14;break;}this.drawCount++;_context32.n=14;return this.drawShape(y);case 14:return _context32.a(3,17);case 15:this.drawCount++;!this.combineTimerId&&this.combineUnitTime!==1/0&&new Promise(function(C){_this88.combineDrawActiveId=h,_this88.combineDrawResolve=C,_this88.combineTimerId=setTimeout(function(){_this88.combineTimerId=void 0,_this88.combineDrawResolve&&_this88.combineDrawResolve(!0);},_this88.combineUnitTime);}).then(function(C){C&&_this88.drawPencilCombine(h,_this88.drawCount),_this88.combineDrawResolve=void 0;});_t36=y;if(!_t36){_context32.n=16;break;}_context32.n=16;return this.drawPencil(y);case 16:return _context32.a(3,17);case 17:return _context32.a(2);}},_callee31,this);}));function consumeDraw(_x59,_x60){return _consumeDraw.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(e,n){var a,u,h,i,s,o,v,p,y,C,b,M,_t37,_t38;return _regenerator().w(function(_context33){while(1)switch(_context33.p=_context33.n){case 0:this.eraserBatchScheduler.cancel(),this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);i=e.workId,s=e.scenePath,o=e.isLockSentEventCursor;if(!i){_context33.n=16;break;}v=i.toString();this.combineDrawActiveId===v&&(this.combineDrawActiveId=void 0),this.drawWorkActiveId===v&&(this.drawWorkActiveId=void 0);p=this.workShapes.get(v);if(p){_context33.n=1;break;}return _context33.a(2);case 1:y=p.toolsType;if(!(y===St.LaserPen)){_context33.n=2;break;}return _context33.a(2);case 2:_t37=y===St.BitMapEraser;if(!_t37){_context33.n=3;break;}_context33.n=3;return this.bitmapEraserRenderQueue;case 3:C=this.workShapes.get(Lo);b=(a=C==null?void 0:C.selectIds)==null?void 0:a[0];_context33.n=4;return p.consumeAll({data:e,workerEngine:this});case 4:M=_context33.v;_t38=y;_context33.n=_t38===St.Selector?5:_t38===St.PencilEraser?7:_t38===St.BitMapEraser?7:_t38===St.Eraser?10:_t38===St.Arrow?12:_t38===St.Straight?12:_t38===St.Ellipse?12:_t38===St.Rectangle?12:_t38===St.Star?12:_t38===St.Polygon?12:_t38===St.SpeechBalloon?12:_t38===St.Pencil?14:16;break;case 5:M.selectIds&&b&&(u=M.selectIds)!=null&&u.includes(b)&&C.cursorBlur();M.selectIds&&n.runReverseSelectWork(M.selectIds);_context33.n=6;return this.drawSelector(_objectSpread(_objectSpread({},M),{},{scenePath:s,isSelecting:!1}),te.Done,o);case 6:(h=p.selectIds)!=null&&h.length?p.clearTmpPoints():this.clearWorkShapeNodeCache(v);return _context33.a(3,16);case 7:_context33.p=7;_context33.n=8;return this.drawEraserFull(p,_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker);case 8:_context33.p=8;this.drawCount=0,this.clearWorkShapeNodeCache(v);return _context33.f(8);case 9:return _context33.a(3,16);case 10:_context33.n=11;return this.drawEraser(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker,e.collectUndoTicker);case 11:p.clearTmpPoints();return _context33.a(3,16);case 12:_context33.n=13;return this.drawPencilFull(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker,y);case 13:this.drawCount=0;this.clearWorkShapeNodeCache(v);return _context33.a(3,16);case 14:_context33.n=15;return this.drawPencilFull(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker);case 15:this.drawCount=0;this.clearWorkShapeNodeCache(v);return _context33.a(3,16);case 16:return _context33.a(2);}},_callee32,this,[[7,,8,9]]);}));function consumeDrawAll(_x61,_x62){return _consumeDrawAll.apply(this,arguments);}return consumeDrawAll;}()},{key:"workShapesDone",value:function(){var _workShapesDone=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(e,n){var _iterator90,_step90,i,_t39;return _regenerator().w(function(_context34){while(1)switch(_context34.p=_context34.n){case 0:_iterator90=_createForOfIteratorHelper(this.workShapes.keys());_context34.p=1;_iterator90.s();case 2:if((_step90=_iterator90.n()).done){_context34.n=4;break;}i=_step90.value;_context34.n=3;return this.consumeDrawAll({workId:i,scenePath:e,viewId:this.viewId,msgType:Tt.DrawWork,dataType:Qt.Local},n);case 3:_context34.n=2;break;case 4:_context34.n=6;break;case 5:_context34.p=5;_t39=_context34.v;_iterator90.e(_t39);case 6:_context34.p=6;_iterator90.f();return _context34.f(6);case 7:return _context34.a(2);}},_callee33,this,[[1,5,6,7]]);}));function workShapesDone(_x63,_x64){return _workShapesDone.apply(this,arguments);}return workShapesDone;}()},{key:"consumeFull",value:function(){var _consumeFull=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(e){var a,u,h,n,i,v,p,s,o,_v1,_p5,y,C,b,M;return _regenerator().w(function(_context35){while(1)switch(_context35.n){case 0:n=(a=e.workId)==null?void 0:a.toString(),i=(u=e.updateNodeOpt)==null?void 0:u.eraserGeometryDelta;if(!n){_context35.n=3;break;}v=this.vNodes.get(n),p=e.ops&&ks(e.ops)||e.op||[];if(!i){_context35.n=2;break;}if(!(!v||!e.centerPos||!Dmt(this.vNodes,n,i,v,{op:p,centerPos:e.centerPos}))){_context35.n=1;break;}vp(this.vNodes,n);return _context35.a(2);case 1:_context35.n=3;break;case 2:v&&e.centerPos&&Lmt(this.vNodes,n)&&Wo(v.op,v.centerPos)!==Wo(p,e.centerPos)&&vp(this.vNodes,n);case 3:s=this.setFullWork(e),o=e.ops&&ks(e.ops)||e.op;if(!s){_context35.n=11;break;}if(n){_context35.n=4;break;}return _context35.a(2);case 4:_v1=(h=this.vNodes.get(n))==null?void 0:h.rect;if(!(s.toolsType===St.BackgroundSVG)){_context35.n=5;break;}_p5=s.consumeService({isFullWork:!0,replaceId:n});_context35.n=10;break;case 5:if(!(s.toolsType===St.Image)){_context35.n=7;break;}_context35.n=6;return s.consumeServiceAsync({isFullWork:!0,replaceId:n,worker:this});case 6:_p5=_context35.v;y=(e==null?void 0:e.updateNodeOpt)&&s.updataOptService(e.updateNodeOpt);_context35.n=10;break;case 7:if(!(s.toolsType===St.Text)){_context35.n=9;break;}_context35.n=8;return s.consumeServiceAsync({isFullWork:!0,replaceId:n,boxRect:this.thread.getSceneRect()});case 8:_p5=_context35.v;_context35.n=10;break;case 9:_p5=s.consumeService({op:o,isFullWork:!0,replaceId:n}),y=(e==null?void 0:e.updateNodeOpt)&&s.updataOptService(e.updateNodeOpt);case 10:_p5=Kt(_p5,y);C=[],b=[];if(!(e.workId&&this.workShapes.delete(e.workId.toString()),e.clearPreviewLocalWork&&C.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}),_p5&&e.willRefresh&&(_v1&&(C.push({rect:me(_v1),isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId}),_p5=Kt(_p5,_v1)),C.push({rect:me(_p5),drawCanvas:$t.Bg,viewId:this.viewId})),e.willSyncService&&b.push({opt:e.opt,toolsType:e.toolsType,type:Tt.FullWork,workId:e.workId,ops:e.ops,updateNodeOpt:e.updateNodeOpt,viewId:this.viewId,needUndoTicker:e.needUndoTicker,requestId:e.requestId,emitEventType:e.emitEventType,scenePath:e.scenePath}),e.isLockSentEventCursor&&b.push({type:Tt.None,isLockSentEventCursor:!0,scenePath:e.scenePath}),e.needUndoTicker&&b.push({type:Tt.None,needUndoTicker:e.needUndoTicker,emitEventType:e.emitEventType,requestId:e.requestId,scenePath:e.scenePath}),C.length||b.length)){_context35.n=11;break;}M={render:C,sp:b};_context35.n=11;return this._post(M);case 11:return _context35.a(2);}},_callee34,this);}));function consumeFull(_x65){return _consumeFull.apply(this,arguments);}return consumeFull;}()},{key:"removeSelector",value:function(){var _removeSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(e,n){var i,s,o,a,u,h,v,_iterator91,_step91,p,y,C,_t40,_t41,_t42;return _regenerator().w(function(_context36){while(1)switch(_context36.p=_context36.n){case 0:i=e.willSyncService,s=e.needUndoTicker,o=[],a=[],u=[],h=this.workShapes.get(De);if(h){_context36.n=1;break;}return _context36.a(2);case 1:v=h.selectIds&&_toConsumableArray(h.selectIds)||[];_iterator91=_createForOfIteratorHelper(v);_context36.p=2;_iterator91.s();case 3:if((_step91=_iterator91.n()).done){_context36.n=8;break;}p=_step91.value;y=this.vNodes.get(p);if(!y){_context36.n=6;break;}_t40=y.toolsType;_context36.n=_t40===St.Text?4:_t40===St.BackgroundSVG?5:6;break;case 4:o.push({type:Tt.TextUpdate,toolsType:St.Text,workId:p,dataType:Qt.Local});return _context36.a(3,6);case 5:o.push({type:Tt.BackgroundSVGDelete,toolsType:St.BackgroundSVG,workId:p,dataType:Qt.Local,viewId:this.viewId});return _context36.a(3,6);case 6:C=this._removeWork(p);C.length&&a.push.apply(a,_toConsumableArray(C)),n==null||n.deleteCachedImagesByWorkId(p),u.push(p);case 7:_context36.n=3;break;case 8:_context36.n=10;break;case 9:_context36.p=9;_t41=_context36.v;_iterator91.e(_t41);case 10:_context36.p=10;_iterator91.f();return _context36.f(10);case 11:u.length&&o.push({type:Tt.RemoveNode,removeIds:u,needUndoTicker:s,emitEventType:e.emitEventType,requestId:e.requestId});o.push({type:Tt.Select,selectIds:[],willSyncService:i});_context36.n=12;return this.blurSelector();case 12:s&&o.push({type:Tt.None,needUndoTicker:s});_t42=a.length||o.length;if(!_t42){_context36.n=13;break;}_context36.n=13;return this._post({render:a,sp:o});case 13:return _context36.a(2);}},_callee35,this,[[2,9,10,11]]);}));function removeSelector(_x66,_x67){return _removeSelector.apply(this,arguments);}return removeSelector;}()},{key:"removeWork",value:function(){var _removeWork2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(e){var n,i,s,_t43;return _regenerator().w(function(_context37){while(1)switch(_context37.n){case 0:n=e.workId,i=n==null?void 0:n.toString();if(!i){_context37.n=1;break;}s=this._removeWork(i);_t43=s.length;if(!_t43){_context37.n=1;break;}_context37.n=1;return this._post({render:s});case 1:return _context37.a(2);}},_callee36,this);}));function removeWork(_x68){return _removeWork2.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(e){var _this89=this;var o,a;var n=this.vNodes.get(e);n&&(n.toolsType===St.BackgroundSVG&&this._post({sp:[{type:Tt.BackgroundSVGDelete,toolsType:St.BackgroundSVG,workId:e,dataType:Qt.Local,viewId:this.viewId}]}),(o=this.fullLayer)==null||o.getElementsByName(e).forEach(function(u){u.remove(),_zr(u,_this89.fullLayer.parent);}),this.vNodes.delete(e));var i=((a=this.drawLayer)==null?void 0:a.getElementsByName(e))||[];var s;return i.forEach(function(u){var h=u.getBoundingClientRect();s=Kt(s,{x:Math.floor(h.x-Gt.SafeBorderPadding),y:Math.floor(h.y-Gt.SafeBorderPadding),w:Math.floor(h.width+Gt.SafeBorderPadding*2),h:Math.floor(h.height+Gt.SafeBorderPadding*2)});}),s&&i.forEach(function(u){var h;u.remove(),_zr(u,(h=_this89.drawLayer)==null?void 0:h.parent);}),this.getWorkShape(e)&&this.clearWorkShapeNodeCache(e),{fullRect:n==null?void 0:n.rect,drawRect:s};}},{key:"_removeWork",value:function _removeWork(e){var _this$removeNode=this.removeNode(e),n=_this$removeNode.fullRect,i=_this$removeNode.drawRect,s=[];return n&&s.push({rect:me(n),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId,workId:e},{rect:me(n),drawCanvas:$t.Bg,viewId:this.viewId,workId:e}),i&&s.push({rect:me(i),clearCanvas:$t.Float,isClear:!0,viewId:this.viewId,workId:e},{rect:me(i),drawCanvas:$t.Float,viewId:this.viewId,workId:e}),s;}},{key:"checkTextActive",value:function(){var _checkTextActive=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(e){var n,i,s,o,a,u,h,_iterator92,_step92,_v10,p,y,C,b,v,_t44,_t45;return _regenerator().w(function(_context38){while(1)switch(_context38.p=_context38.n){case 0:n=e.op,i=e.viewId,s=e.dataType;if(!(n!=null&&n.length)){_context38.n=11;break;}u=n[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],h=n[1]*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1];_iterator92=_createForOfIteratorHelper(this.vNodes.curNodeMap.values());_context38.p=1;_iterator92.s();case 2:if((_step92=_iterator92.n()).done){_context38.n=4;break;}_v10=_step92.value;p=_v10.rect,y=_v10.name,C=_v10.toolsType,b=_v10.opt;if(!(C===St.Text&&b.workState===te.Done&&eAt([u,h],p))){_context38.n=3;break;}o=y,a=this.setFullWork({workId:y,toolsType:C,opt:b});return _context38.a(3,4);case 3:_context38.n=2;break;case 4:_context38.n=6;break;case 5:_context38.p=5;_t44=_context38.v;_iterator92.e(_t44);case 6:_context38.p=6;_iterator92.f();return _context38.f(6);case 7:if(!o){_context38.n=11;break;}_t45=a;if(!_t45){_context38.n=9;break;}_context38.n=8;return a.consumeServiceAsync({isFullWork:!0,replaceId:a.getWorkId(),boxRect:this.thread.getSceneRect()});case 8:v=_context38.v;case 9:_context38.n=10;return this.blurSelector({viewId:i,msgType:Tt.Select,dataType:s,isSync:!0});case 10:_context38.n=11;return this._post({render:v&&[{rect:me(v),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(v),drawCanvas:$t.Bg,viewId:this.viewId}],sp:[{type:Tt.GetTextActive,toolsType:St.Text,workId:o}]});case 11:return _context38.a(2);}},_callee37,this,[[1,5,6,7]]);}));function checkTextActive(_x69){return _checkTextActive.apply(this,arguments);}return checkTextActive;}()},{key:"colloctEffectSelectWork",value:function(){var _colloctEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(e){var n,i,s;return _regenerator().w(function(_context39){while(1)switch(_context39.n){case 0:n=this.workShapes.get(De),i=e.workId,s=e.msgType;if(!(n&&i&&n.selectIds&&n.selectIds.includes(i.toString()))){_context39.n=2;break;}s===Tt.RemoveNode?n.selectIds=n.selectIds.filter(function(o){return o!==i.toString();}):this.effectSelectNodeData.add(e);_context39.n=1;return this.runEffectSelectWork(!0);case 1:return _context39.a(2);case 2:return _context39.a(2,e);}},_callee38,this);}));function colloctEffectSelectWork(_x70){return _colloctEffectSelectWork.apply(this,arguments);}return colloctEffectSelectWork;}()},{key:"updateSelector",value:function(){var _updateSelector2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39(e){var _this90=this;var M,n,i,s,o,a,u,h,v,p,y,C,b,_t46;return _regenerator().w(function(_context40){while(1)switch(_context40.n){case 0:n=this.workShapes.get(De);if((M=n==null?void 0:n.selectIds)!=null&&M.length){_context40.n=1;break;}return _context40.a(2);case 1:i=e.callback;s=_objectWithoutProperties(e,_excluded3);o=s.updateSelectorOpt;a=s.willSerializeData;u=s.smoothSync;_context40.n=2;return n==null?void 0:n.updateSelector({updateSelectorOpt:o,selectIds:gr(n.selectIds),vNodes:this.vNodes,willSerializeData:a,worker:this});case 2:h=_context40.v;v=/* @__PURE__ */new Map();h!=null&&h.selectIds&&(p=dMt(n.selectIds,h.selectIds),h.selectIds.forEach(function(L){var X=_this90.vNodes.get(L);if(X){var Y=X.toolsType,et=X.op,A=X.opt;v.set(L,{opt:A,toolsType:Y,ops:(et==null?void 0:et.length)&&Br(et)||void 0});}}),n.selectIds=h.selectIds);y=[],C=[];h!=null&&h.rect&&y.push({rect:me(h.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(h.rect),drawCanvas:$t.Bg,viewId:this.viewId});b=i&&i({res:h,workShapeNode:n,param:s,postData:{render:y,sp:C},newServiceStore:v,smoothSync:u})||{render:y,sp:C};p&&b.sp.push({type:Tt.RemoveNode,removeIds:p,viewId:this.viewId});_t46=b.render.length||b.sp.length;if(!_t46){_context40.n=3;break;}_context40.n=3;return this._post(b);case 3:return _context40.a(2);}},_callee39,this);}));function updateSelector(_x71){return _updateSelector2.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function(){var _blurSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40(e){var s,n,i,o;return _regenerator().w(function(_context41){while(1)switch(_context41.n){case 0:n=this.workShapes.get(De),i=n==null?void 0:n.blurSelector();if(!(this.clearWorkShapeNodeCache(De),((s=this.fullLayer)==null?void 0:s.parent).children.forEach(function(o){o.name===De&&o.remove();}),i)){_context41.n=1;break;}o=[];o.push(_objectSpread(_objectSpread({},i),{},{isSync:e==null?void 0:e.isSync,scenePath:e==null?void 0:e.scenePath}));_context41.n=1;return this._post({render:(i==null?void 0:i.rect)&&[{rect:me(i.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(i.rect),drawCanvas:$t.Bg,viewId:this.viewId}],sp:o});case 1:return _context41.a(2);}},_callee40,this);}));function blurSelector(_x72){return _blurSelector.apply(this,arguments);}return blurSelector;}()},{key:"hasSelector",value:function hasSelector(){return this.workShapes.has(De);}},{key:"getSelector",value:function getSelector(){return this.workShapes.get(De);}},{key:"reRenderSelector",value:function(){var _reRenderSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41(){var e,o,n,i,s,a,_args42=arguments;return _regenerator().w(function(_context42){while(1)switch(_context42.n){case 0:e=_args42.length>0&&_args42[0]!==undefined?_args42[0]:!1;n=this.workShapes.get(De);if(n){_context42.n=1;break;}return _context42.a(2);case 1:if(!(n&&!((o=n.selectIds)!=null&&o.length))){_context42.n=3;break;}_context42.n=2;return this.blurSelector();case 2:return _context42.a(2);case 3:i=n.oldSelectRect,s=n.reRenderSelector();if(!s){_context42.n=4;break;}a=Kt(i,s)||s;_context42.n=4;return this._post({render:[{rect:me(a),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(a),drawCanvas:$t.Bg,viewId:this.viewId}],sp:[{type:Tt.Select,selectIds:n.selectIds,selectRect:s,willSyncService:e,viewId:this.viewId,points:n.getChildrenPoints(),textOpt:n.textOpt,selectorColor:n.selectorColor,strokeColor:n.strokeColor,fillColor:n.fillColor,canTextEdit:n.canTextEdit,canRotate:n.canRotate,scaleType:n.scaleType,opt:n.getWorkOptions()||void 0,canLock:n.canLock,isLocked:n.isLocked,toolsTypes:n.toolsTypes,shapeOpt:n.shapeOpt,thickness:n.thickness,useStroke:n.useStroke,strokeType:n.strokeType}]});case 4:return _context42.a(2);}},_callee41,this);}));function reRenderSelector(){return _reRenderSelector.apply(this,arguments);}return reRenderSelector;}()},{key:"updateFullSelectWork",value:function(){var _updateFullSelectWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42(e){var s,o,a,u,h,v,p,n,i,_n$updateSelectIds,y,C,b,_t47;return _regenerator().w(function(_context43){while(1)switch(_context43.n){case 0:n=this.workShapes.get(De),i=e.selectIds;if(i!=null&&i.length){_context43.n=2;break;}_context43.n=1;return this.blurSelector(e);case 1:return _context43.a(2);case 2:if(n){_context43.n=4;break;}_t47=this.setFullWork({workId:De,toolsType:St.Selector,opt:e.opt||(((s=this.tmpOpt)==null?void 0:s.toolsType)===St.Selector?this.tmpOpt.toolsOpt:{})});if(!_t47){_context43.n=3;break;}_context43.n=3;return this.updateFullSelectWork(e);case 3:return _context43.a(2);case 4:if(!(n&&i!=null&&i.length)){_context43.n=5;break;}_n$updateSelectIds=n.updateSelectIds(i),y=_n$updateSelectIds.bgRect,C=_n$updateSelectIds.selectRect,b={render:[],sp:[]};y&&((o=b.render)==null||o.push({rect:me(y),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(y),drawCanvas:$t.Bg,viewId:this.viewId}));(p=b.sp)==null||p.push({selectorColor:((a=e.opt)==null?void 0:a.strokeColor)||n.selectorColor,strokeColor:((u=e.opt)==null?void 0:u.strokeColor)||n.strokeColor,fillColor:((h=e.opt)==null?void 0:h.fillColor)||n.fillColor,textOpt:((v=e.opt)==null?void 0:v.textOpt)||n.textOpt,canTextEdit:n.canTextEdit,canRotate:n.canRotate,scaleType:n.scaleType,type:Tt.Select,viewId:this.viewId,dataType:Qt.Local,selectIds:e.selectIds,selectRect:C,points:n.getChildrenPoints(),willSyncService:(e==null?void 0:e.willSyncService)||!1,opt:(e==null?void 0:e.willSyncService)&&n.getWorkOptions()||void 0,canLock:n.canLock,isLocked:n.isLocked,toolsTypes:n.toolsTypes,shapeOpt:n.shapeOpt,thickness:n.thickness,useStroke:n.useStroke,strokeType:n.strokeType});_context43.n=5;return this._post(b);case 5:return _context43.a(2);}},_callee42,this);}));function updateFullSelectWork(_x73){return _updateFullSelectWork.apply(this,arguments);}return updateFullSelectWork;}()},{key:"destroy",value:function destroy(){var e;(e=this.disposeVNodeRevisionObserver)==null||e.call(this),this.disposeVNodeRevisionObserver=void 0,this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1)),_superPropGet(ZT,"destroy",this,3)([]),this.effectSelectNodeData.clear();}},{key:"enqueueBitmapEraserRender",value:function enqueueBitmapEraserRender(e){var _this91=this;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.drawCount;var i=arguments.length>2?arguments[2]:undefined;var s=arguments.length>3?arguments[3]:undefined;var o=arguments.length>4?arguments[4]:undefined;var a=this.bitmapEraserRenderQueue.then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43(){var _t48;return _regenerator().w(function(_context44){while(1)switch(_context44.n){case 0:_t48=_this91.combineDrawActiveId!==e||!_this91.getWorkShape(e);if(_t48){_context44.n=1;break;}_context44.n=1;return _this91.postEraserBatch(e,n,i,s,o);case 1:return _context44.a(2);}},_callee43);})));return this.bitmapEraserRenderQueue=a.catch(function(){}),a;}},{key:"drawPencilEraserCombine",value:function(){var _drawPencilEraserCombine=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44(e,n,i,s){return _regenerator().w(function(_context45){while(1)switch(_context45.n){case 0:_context45.n=1;return this.postEraserBatch(e,n,i,s);case 1:return _context45.a(2);}},_callee44,this);}));function drawPencilEraserCombine(_x74,_x75,_x76,_x77){return _drawPencilEraserCombine.apply(this,arguments);}return drawPencilEraserCombine;}()},{key:"postEraserBatch",value:function(){var _postEraserBatch=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45(e,n,i,s,o){var u,h,v,p,y,C,a,b,M,L,X,Y,_iterator93,_step93,_step93$value,_Y4,et;return _regenerator().w(function(_context46){while(1)switch(_context46.n){case 0:a=(u=this.workShapes.get(e))==null?void 0:u.combineConsume({workerEngine:this});if(!(a||o)){_context46.n=1;break;}b=a==null?void 0:a.willDeleteNodes,M=a==null?void 0:a.willNewNodes,L=_toConsumableArray(b?Array.from(b):[]),X=_objectSpread({render:[],fullWorkerDrawCount:n,sp:[]},o);if(a!=null&&a.rect){Y=me(a.rect);(h=X.render)==null||h.push({rect:Y,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e},{rect:Y,drawCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e});}if(s&&L.length&&((v=this.getWorkShape(e))==null?void 0:v.toolsType)===St.BitMapEraser&&((p=X.sp)==null||p.push({type:Tt.None,collectUndoTicker:s,undoScopeIds:L,undoScopePhase:"collect"})),b!=null&&b.size&&((y=X.sp)==null||y.push({type:Tt.RemoveNode,removeIds:_toConsumableArray(b),viewId:this.thread.viewId,needUndoTicker:i,collectUndoTicker:s})),M!=null&&M.size){_iterator93=_createForOfIteratorHelper(M);try{for(_iterator93.s();!(_step93=_iterator93.n()).done;){_step93$value=_slicedToArray(_step93.value,2),_Y4=_step93$value[0],et=_step93$value[1];(C=X.sp)==null||C.push({type:Tt.FullWork,dataType:Qt.Local,toolsType:St.Pencil,ops:Br(et.op),opt:et.opt,workId:_Y4,updateNodeOpt:{useAnimation:!1},needUndoTicker:i,collectUndoTicker:s});}}catch(err){_iterator93.e(err);}finally{_iterator93.f();}}_context46.n=1;return this._post(X);case 1:return _context46.a(2);}},_callee45,this);}));function postEraserBatch(_x78,_x79,_x80,_x81,_x82){return _postEraserBatch.apply(this,arguments);}return postEraserBatch;}()},{key:"drawPencilCombine",value:function(){var _drawPencilCombine=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(e,n){var s,o,a,i,u,h;return _regenerator().w(function(_context47){while(1)switch(_context47.n){case 0:i=(s=this.workShapes.get(e))==null?void 0:s.combineConsume();if(!i){_context47.n=1;break;}u={render:[],fullWorkerDrawCount:n};if(i!=null&&i.rect){h=me(i.rect);(o=u.render)==null||o.push({rect:h,isClear:!0,clearCanvas:$t.Float,viewId:this.viewId,workId:e}),(a=u.render)==null||a.push({rect:h,drawCanvas:$t.Float,viewId:this.viewId,workId:e});}_context47.n=1;return this._post(u);case 1:return _context47.a(2);}},_callee46,this);}));function drawPencilCombine(_x83,_x84){return _drawPencilCombine.apply(this,arguments);}return drawPencilCombine;}()},{key:"drawSelector",value:function(){var _drawSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(e,n,i){var o,a,u,s;return _regenerator().w(function(_context48){while(1)switch(_context48.n){case 0:s={render:[],sp:[e]};(o=s.sp)==null||o.push({type:Tt.SelectorTransform,emitEventType:ve.SelectMethod,workState:n,scenePath:e.scenePath});i&&((a=s.sp)==null||a.push({type:Tt.None,isLockSentEventCursor:i}));e.rect&&((u=s.render)==null||u.push({rect:me(e.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(e.rect),drawCanvas:$t.Bg,viewId:this.viewId}));_context48.n=1;return this._post(s);case 1:return _context48.a(2);}},_callee47,this);}));function drawSelector(_x85,_x86,_x87){return _drawSelector.apply(this,arguments);}return drawSelector;}()},{key:"drawPencilFull",value:function(){var _drawPencilFull=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(e,n,i,s){var h,v,p,y,a,u;return _regenerator().w(function(_context49){while(1)switch(_context49.n){case 0:a=s===St.Pencil&&e.type===Tt.RemoveNode,u={fullWorkerDrawCount:1/0,render:[],sp:a?[]:[_objectSpread(_objectSpread({},e),{},{needUndoTicker:i,undoScopeIds:e.undoScopeIds||(e.workId!==void 0?[e.workId.toString()]:void 0),undoScopePhase:e.undoScopePhase||"finalize"})]};n&&((h=u.sp)==null||h.push({type:Tt.None,isLockSentEventCursor:n}));a?(v=u.render)==null||v.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}):e!=null&&e.rect&&((p=u.render)==null||p.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:e.rect,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId},{rect:e.rect,drawCanvas:$t.Bg,viewId:this.viewId}));i&&((y=u.sp)==null||y.push({type:Tt.None,needUndoTicker:i,undoScopeIds:a?[]:void 0,undoScopePhase:a?"finalize":void 0}));_context49.n=1;return this._post(u);case 1:return _context49.a(2);}},_callee48,this);}));function drawPencilFull(_x88,_x89,_x90,_x91){return _drawPencilFull.apply(this,arguments);}return drawPencilFull;}()},{key:"drawEraserFull",value:function(){var _drawEraserFull=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49(e,n,i,s){var o,a,u,h,v,p,y,C,b,_iterator94,_step94,_step94$value,L,X,_iterator95,_step95,_step95$value,_L17,_X8,M;return _regenerator().w(function(_context50){while(1)switch(_context50.n){case 0:o=n.rect,a=n.willUpdateNodes,u=n.willDeleteNodes,h=n.willNewNodes,v=n.eraseTxnRecoveryRequired,p=n.eraseTxnBeforeImages,y=e.getWorkId(),C=[].concat(_toConsumableArray(a?Array.from(a.keys()).map(function(L){return String(L);}):[]),_toConsumableArray(u?Array.from(u):[]),_toConsumableArray(h?Array.from(h.keys()).map(function(L){return String(L);}):[])),b=[];if(s&&b.push({type:Tt.None,needUndoTicker:s,undoScopeIds:C,undoScopePhase:"finalize",eraseTxnId:y,eraseTxnRecoveryRequired:v,eraseTxnBeforeImages:p}),b.push({type:Tt.RemoveNode,removeIds:[y],eraseTxnId:y,viewId:this.viewId,needUndoTicker:s,eraseTxnRecoveryRequired:v,eraseTxnBeforeImages:p}),i&&b.push({type:Tt.None,isLockSentEventCursor:i}),a!=null&&a.size||u!=null&&u.size||h!=null&&h.size){if(a!=null&&a.size){_iterator94=_createForOfIteratorHelper(a);try{for(_iterator94.s();!(_step94=_iterator94.n()).done;){_step94$value=_slicedToArray(_step94.value,2),L=_step94$value[0],X=_step94$value[1];b.push({type:Tt.UpdateNode,dataType:Qt.Local,opt:X.opt,workId:L,updateNodeOpt:{useAnimation:!1},eraseTxnId:y,needUndoTicker:s});}}catch(err){_iterator94.e(err);}finally{_iterator94.f();}}if(u!=null&&u.size&&b.push({type:Tt.RemoveNode,removeIds:_toConsumableArray(u),eraseTxnId:y,viewId:this.thread.viewId,needUndoTicker:s}),h!=null&&h.size){_iterator95=_createForOfIteratorHelper(h);try{for(_iterator95.s();!(_step95=_iterator95.n()).done;){_step95$value=_slicedToArray(_step95.value,2),_L17=_step95$value[0],_X8=_step95$value[1];b.push({type:Tt.FullWork,dataType:Qt.Local,toolsType:_X8.toolsType,ops:Br(_X8.op),opt:_X8.opt,workId:_L17,updateNodeOpt:{useAnimation:!1},needUndoTicker:s,eraseTxnId:y});}}catch(err){_iterator95.e(err);}finally{_iterator95.f();}}}e.toolsType===St.BitMapEraser&&b.push({type:Tt.None,viewId:this.viewId,eraseTxnId:y,eraseTxnPhase:n.eraseTxnCommitStatus==="failed"||v?"failed":"applied",eraseTxnRecoveryRequired:v,eraseTxnBeforeImages:p});M=[{isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId,eraseTxnId:y}];o&&M.push({rect:o,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:y},{rect:o,drawCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:y});_context50.n=1;return this._post({sp:b,render:M,fullWorkerDrawCount:1/0});case 1:return _context50.a(2);}},_callee49,this);}));function drawEraserFull(_x92,_x93,_x94,_x95){return _drawEraserFull.apply(this,arguments);}return drawEraserFull;}()},{key:"drawEraser",value:function(){var _drawEraser=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50(e,n,i,s){var o,a,u;return _regenerator().w(function(_context51){while(1)switch(_context51.n){case 0:o=[],a=[],u=e.removeIds||[];s&&u.length&&o.push({type:Tt.None,collectUndoTicker:s,undoScopeIds:u,undoScopePhase:"collect"});n&&o.push({type:Tt.None,isLockSentEventCursor:n});e.removeIds&&o.push(_objectSpread(_objectSpread({},e),{},{needUndoTicker:i,collectUndoTicker:s}));e.rect&&a.push({rect:e.rect,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId},{rect:e.rect,drawCanvas:$t.Bg,viewId:this.viewId});i&&o.push({type:Tt.None,needUndoTicker:i,undoScopePhase:"finalize"});_context51.n=1;return this._post({sp:o,render:a,consumeCount:this.consumeCount});case 1:return _context51.a(2);}},_callee50,this);}));function drawEraser(_x96,_x97,_x98,_x99){return _drawEraser.apply(this,arguments);}return drawEraser;}()},{key:"drawShape",value:function(){var _drawShape=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(e){return _regenerator().w(function(_context52){while(1)switch(_context52.n){case 0:_context52.n=1;return this._post({fullWorkerDrawCount:this.drawCount,sp:(e==null?void 0:e.op)&&[e]});case 1:return _context52.a(2);}},_callee51,this);}));function drawShape(_x100){return _drawShape.apply(this,arguments);}return drawShape;}()},{key:"drawPencil",value:function(){var _drawPencil=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52(e){return _regenerator().w(function(_context53){while(1)switch(_context53.n){case 0:_context53.n=1;return this._post({sp:(e==null?void 0:e.op)&&[e]});case 1:return _context53.a(2);}},_callee52,this);}));function drawPencil(_x101){return _drawPencil.apply(this,arguments);}return drawPencil;}()},{key:"runEffectSelectWork",value:function(){var _runEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(e){var n,_iterator96,_step96,i,s,o,a,_t49;return _regenerator().w(function(_context54){while(1)switch(_context54.p=_context54.n){case 0:_iterator96=_createForOfIteratorHelper(this.effectSelectNodeData.values());_context54.p=1;_iterator96.s();case 2:if((_step96=_iterator96.n()).done){_context54.n=11;break;}i=_step96.value;s=this.setFullWork(i);if(!s){_context54.n=9;break;}o=(n=s.getWorkId())==null?void 0:n.toString();if(!(s.toolsType===St.BackgroundSVG)){_context54.n=3;break;}s.consumeService({isFullWork:!0,replaceId:o});_context54.n=8;break;case 3:if(!(s.toolsType===St.Image)){_context54.n=5;break;}_context54.n=4;return s.consumeServiceAsync({isFullWork:!0,replaceId:o,worker:this});case 4:_context54.n=8;break;case 5:if(!(s.toolsType===St.Text)){_context54.n=7;break;}_context54.n=6;return s.consumeServiceAsync({isFullWork:!0,replaceId:o,boxRect:this.thread.getSceneRect()});case 6:_context54.n=8;break;case 7:a=i.ops&&ks(i.ops);s.consumeService({op:a,isFullWork:!0,replaceId:o}),i!=null&&i.updateNodeOpt&&s.updataOptService(i.updateNodeOpt);case 8:i.workId&&this.workShapes.delete(i.workId.toString());case 9:this.effectSelectNodeData.delete(i);case 10:_context54.n=2;break;case 11:_context54.n=13;break;case 12:_context54.p=12;_t49=_context54.v;_iterator96.e(_t49);case 13:_context54.p=13;_iterator96.f();return _context54.f(13);case 14:_context54.n=15;return this.reRenderSelector(e);case 15:return _context54.a(2);}},_callee53,this,[[1,12,13,14]]);}));function runEffectSelectWork(_x102){return _runEffectSelectWork.apply(this,arguments);}return runEffectSelectWork;}()},{key:"cursorHover",value:function(){var _cursorHover=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee54(e){var a,n,i,s,o,u,h,_t50;return _regenerator().w(function(_context55){while(1)switch(_context55.n){case 0:n=e.opt,i=e.toolsType,s=e.point,o=this.setFullWork({workId:Lo,toolsType:i,opt:n});if(!(o&&s)){_context55.n=1;break;}u=o.cursorHover(s),h={render:[]};_t50=u&&u.type===Tt.CursorHover&&u.rect;if(!_t50){_context55.n=1;break;}(a=h.render)==null||a.push({rect:me(u.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(u.rect),drawCanvas:$t.Bg,viewId:this.viewId});_context55.n=1;return this._post(h);case 1:return _context55.a(2);}},_callee54,this);}));function cursorHover(_x103){return _cursorHover.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee55(){var i,e,n,_t51,_t52;return _regenerator().w(function(_context56){while(1)switch(_context56.n){case 0:e=this.getWorkShape(Lo);_t51=e&&(i=e.selectIds)!=null&&i.length;if(!_t51){_context56.n=1;break;}n=e.oldSelectRect;e.cursorBlur();this.clearWorkShapeNodeCache(Lo);_t52=n;if(!_t52){_context56.n=1;break;}_context56.n=1;return this._post({render:[{rect:me(n),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(n),drawCanvas:$t.Bg,viewId:this.viewId}]});case 1:this.fullLayer.parent.children.forEach(function(s){s.name==="Cursor_Hover_Id"&&s.remove();});case 2:return _context56.a(2);}},_callee55,this);}));function cursorBlur(){return _cursorBlur.apply(this,arguments);}return cursorBlur;}()}]);}(zv);var qT=/*#__PURE__*/function(){function qT(t){var _this92=this;_classCallCheck(this,qT);ht(this,"viewId");ht(this,"vNodes");ht(this,"fullLayer");ht(this,"drawLayer");ht(this,"workShapes",/* @__PURE__ */new Map());ht(this,"selectorWorkShapes",/* @__PURE__ */new Map());ht(this,"thread");ht(this,"willRunEffectSelectorIds",/* @__PURE__ */new Set());ht(this,"noAnimationRect");ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"post");ht(this,"animationScheduler");ht(this,"effectScheduler");this.viewId=t.viewId,this.vNodes=t.vNodes,this.fullLayer=t.fullLayer,this.drawLayer=t.drawLayer,this.thread=t.thread,this.post=t.thread.post.bind(t.thread),this.animationScheduler=new X1({run:function(){var _run=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee56(){var _t53;return _regenerator().w(function(_context57){while(1)switch(_context57.p=_context57.n){case 0:_context57.p=0;_context57.n=1;return _this92.animationDraw();case 1:_context57.n=3;break;case 2:_context57.p=2;_t53=_context57.v;throw Au(_t53,{business:"service-render",stage:"animation-draw"});case 3:return _context57.a(2);}},_callee56,null,[[0,2]]);}));function run(){return _run.apply(this,arguments);}return run;}(),schedule:function schedule(e){return setTimeout(e,16);},cancel:function cancel(e){return clearTimeout(e);},onError:function onError(e){return _this92.thread.reportRendererBusinessError(e,{business:"service-render",stage:"animation-draw"},!0);}}),this.effectScheduler=new X1({run:function(){var _run2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee57(){var _t54;return _regenerator().w(function(_context58){while(1)switch(_context58.p=_context58.n){case 0:_context58.p=0;_context58.n=1;return _this92.effectRunSelector();case 1:_context58.n=3;break;case 2:_context58.p=2;_t54=_context58.v;throw Au(_t54,{business:"service-render",stage:"selector-effect"});case 3:return _context58.a(2);}},_callee57,null,[[0,2]]);}));function run(){return _run2.apply(this,arguments);}return run;}(),schedule:function schedule(e){return setTimeout(e,0);},cancel:function cancel(e){return clearTimeout(e);},onError:function onError(e){return _this92.thread.reportRendererBusinessError(e,{business:"service-render",stage:"selector-effect"},!0);}});}return _createClass(qT,[{key:"destroy",value:function destroy(){this.animationScheduler.destroy(),this.effectScheduler.destroy(),this.clearAll();}},{key:"clearAll",value:function clearAll(){this.workShapes.clear(),this.selectorWorkShapes.clear(),this.willRunEffectSelectorIds.clear(),this.noAnimationRect=void 0;}},{key:"consumeDraw",value:function(){var _consumeDraw2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee58(t){return _regenerator().w(function(_context59){while(1)switch(_context59.n){case 0:this.activeWorkShape(t),this.runAnimation();case 1:return _context59.a(2);}},_callee58,this);}));function consumeDraw(_x104){return _consumeDraw2.apply(this,arguments);}return consumeDraw;}()},{key:"consumeFull",value:function consumeFull(t){if(this.activeWorkShape(t),t.refreshTextRender){this.runAnimation(!0);return;}this.runAnimation();}},{key:"runSelectWork",value:function runSelectWork(t){this.activeSelectorShape(t);var e=t.workId,n=e==null?void 0:e.toString();n&&this.willRunEffectSelectorIds.add(n),this.runEffect();}},{key:"setNodeKey",value:function setNodeKey(t,e,n,i){return e.toolsType=n,e.node=mf({workId:t,toolsType:n,toolsOpt:i,vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer},this),e;}},{key:"runReverseSelectWork",value:function runReverseSelectWork(t){var _this93=this;t.forEach(function(e){_this93.selectorWorkShapes.forEach(function(n,i){var s;if((s=n.selectIds)!=null&&s.length){var o=n.selectIds.indexOf(e);o>-1&&(n.selectIds.splice(o,1),_this93.willRunEffectSelectorIds.add(i));}});}),this.willRunEffectSelectorIds.size&&this.runEffect();}},{key:"removeWork",value:function(){var _removeWork3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee59(t){var e,n,i;return _regenerator().w(function(_context60){while(1)switch(_context60.n){case 0:e=t.workId,n=e==null?void 0:e.toString();if(!n){_context60.n=3;break;}i=this.workShapes.get(n);if(!i){_context60.n=2;break;}this.workShapes.delete(n);_context60.n=1;return this.removeNode(n,t,i==null?void 0:i.totalRect,!1);case 1:return _context60.a(2);case 2:_context60.n=3;return this.removeNode(n,t);case 3:return _context60.a(2);}},_callee59,this);}));function removeWork(_x105){return _removeWork3.apply(this,arguments);}return removeWork;}()},{key:"removeSelectWork",value:function removeSelectWork(t){var e=t.workId,n=e==null?void 0:e.toString();n&&(this.activeSelectorShape(t),this.willRunEffectSelectorIds.add(n)),this.runEffect();}},{key:"removeNode",value:function(){var _removeNode=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee60(t,e,n){var _this94=this;var i,v,s,o,a,u,h,_args61=arguments,_t55;return _regenerator().w(function(_context61){while(1)switch(_context61.n){case 0:i=_args61.length>3&&_args61[3]!==undefined?_args61[3]:!0;t.indexOf(De)>-1&&this.removeSelectWork(e);s=n;o=(v=this.vNodes.get(t))==null?void 0:v.rect;o&&(s=Kt(o,s));a=this.fullLayer&&Gt.getRectFromLayer(this.fullLayer,t);s=Kt(s,a);u=this.drawLayer&&Gt.getRectFromLayer(this.drawLayer,t);s=Kt(s,u),this.fullLayer.getElementsByName(t).forEach(function(p){p.remove(),_zr(p,_this94.fullLayer.parent);}),this.drawLayer.getElementsByName(t).forEach(function(p){p.remove(),_zr(p,_this94.drawLayer.parent);});h=this.vNodes.get(t);h&&h.toolsType===St.BackgroundSVG&&this.post({sp:[{type:Tt.BackgroundSVGDelete,toolsType:St.BackgroundSVG,workId:t,dataType:Qt.Service,viewId:this.viewId}]});this.vNodes.delete(t);_t55=s;if(!_t55){_context61.n=1;break;}_context61.n=1;return this.post({render:[{rect:me(s),isClear:!0,clearCanvas:i?$t.Bg:$t.ServiceFloat,workerType:i?void 0:Qt.Service,viewId:this.viewId},{rect:me(s),drawCanvas:i?$t.Bg:$t.ServiceFloat,workerType:i?void 0:Qt.Service,viewId:this.viewId}]});case 1:return _context61.a(2);}},_callee60,this);}));function removeNode(_x106,_x107,_x108){return _removeNode.apply(this,arguments);}return removeNode;}()},{key:"activeWorkShape",value:function activeWorkShape(t){var L,X,Y,et;var e=t.workId,n=t.opt,i=t.toolsType,s=t.type,o=t.updateNodeOpt,a=t.ops,u=t.op,h=t.useAnimation,v=t.isEnableCursor,p=t.requestId,y=t.refreshTextRender;if(!e)return;var C=e.toString(),b=(L=this.vNodes.get(C))==null?void 0:L.rect;if(!((X=this.workShapes)!=null&&X.has(C))){var A={toolsType:i,animationWorkData:u||[],animationIndex:0,type:s,updateNodeOpt:o,ops:a,useAnimation:_typeof(h)<"u"?h:_typeof(o==null?void 0:o.useAnimation)<"u"?o==null?void 0:o.useAnimation:!0,oldRect:b,isDiff:!1,isEnableCursor:v};i&&n&&(A=this.setNodeKey(C,A,i,n)),(Y=this.workShapes)==null||Y.set(C,A);}var M=(et=this.workShapes)==null?void 0:et.get(C);M.isEnableCursor=v,M.requestId=p,M.refreshTextRender=!!y,s&&(M.type=s),a&&(M.animationWorkData=ks(a),M.ops=a),o&&(M.updateNodeOpt=o),u&&(M.isDiff=this.hasDiffData(M.animationWorkData||[],u,M.toolsType),M.toolsType,St.Pencil,M.animationWorkData=u),M.node&&M.node.getWorkId()!==C&&M.node.setWorkId(C),b&&(M.oldRect=b),i&&n?(n.syncUnitTime&&(this.syncUnitTime=n.syncUnitTime),M.toolsType!==i&&i&&n&&this.setNodeKey(C,M,i,n),M.node&&M.node.setWorkOptions(n)):i&&(M.toolsType=i);}},{key:"hasDiffData",value:function hasDiffData(t,e,n){var i=t.length;if(e.length<i)return!0;switch(n){case St.Pencil:{for(var s=0;s<i;s+=3)if(e[s]!==t[s]||e[s+1]!==t[s+1])return!0;break;}case St.LaserPen:{for(var _s0=0;_s0<i;_s0+=2)if(e[_s0]!==t[_s0]||e[_s0+1]!==t[_s0+1])return!0;break;}}return!1;}},{key:"animationDraw",value:function(){var _animationDraw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee61(){var _this95=this;var i,s,o,a,u,h,v,p,y,C,b,M,L,X,Y,et,A,w,S,x,P,z,U,K,j,nt,ct,B,N,G,q,at,ut,Ct,R,$,_,H,lt,dt,wt,Et,Ot,O,D,t,e,n,_iterator97,_step97,_loop6,_t57,_t58;return _regenerator().w(function(_context63){while(1)switch(_context63.p=_context63.n){case 0:t=!1;e={render:[]},n=/* @__PURE__ */new Map();_iterator97=_createForOfIteratorHelper(this.workShapes.entries());_context63.p=1;_loop6=/*#__PURE__*/_regenerator().m(function _loop6(){var _step97$value,J,Q,V,tt,_V2,_tt2,_V3,_tt3,_V4,_tt4,g,T,_V5,_tt5,_g2,_T2,k,Z,st,_Z2,_V6,_tt6,_g3,_T3,_t56;return _regenerator().w(function(_context62){while(1)switch(_context62.n){case 0:_step97$value=_slicedToArray(_step97.value,2),J=_step97$value[0],Q=_step97$value[1];_t56=Q.toolsType;_context62.n=_t56===St.BackgroundSVG?1:_t56===St.Image?2:_t56===St.Text?4:_t56===St.Arrow?7:_t56===St.Straight?7:_t56===St.Rectangle?7:_t56===St.Ellipse?7:_t56===St.Star?7:_t56===St.Polygon?7:_t56===St.SpeechBalloon?7:_t56===St.Pencil?8:13;break;case 1:V=Q.oldRect;V&&((i=e.render)==null||i.push({rect:V,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(s=e.render)==null||s.push({rect:V,drawCanvas:$t.Bg,viewId:_this95.viewId}));tt=(o=Q.node)==null?void 0:o.consumeService({isFullWork:!0,replaceId:J});_this95.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this95.willRunEffectSelectorIds.add(T),_this95.noAnimationRect=Kt(_this95.noAnimationRect,V),_this95.noAnimationRect=Kt(_this95.noAnimationRect,tt),_this95.runEffect());}),_this95.workShapes.delete(J),(a=e.render)==null||a.push({rect:tt,drawCanvas:$t.Bg,viewId:_this95.viewId});return _context62.a(3,13);case 2:_V2=Q.oldRect;_V2&&((u=e.render)==null||u.push({rect:_V2,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(h=e.render)==null||h.push({rect:_V2,drawCanvas:$t.Bg,viewId:_this95.viewId}));_context62.n=3;return(v=Q.node)==null?void 0:v.consumeServiceAsync({isFullWork:!0,worker:_this95.thread});case 3:_tt2=_context62.v;_this95.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this95.willRunEffectSelectorIds.add(T),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_V2),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt2),_this95.runEffect());}),_this95.workShapes.delete(J),(p=e.render)==null||p.push({rect:_tt2,drawCanvas:$t.Bg,viewId:_this95.viewId});return _context62.a(3,13);case 4:if(!Q.node){_context62.n=6;break;}_V3=Q.oldRect;_V3&&((y=e.render)==null||y.push({rect:_V3,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(C=e.render)==null||C.push({rect:_V3,drawCanvas:$t.Bg,viewId:_this95.viewId}));_context62.n=5;return Q.node.consumeServiceAsync({isFullWork:!0,replaceId:J,boxRect:_this95.thread.getSceneRect()});case 5:_tt3=_context62.v;_this95.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this95.willRunEffectSelectorIds.add(T),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_V3),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt3),_this95.runEffect());}),Q.refreshTextRender&&Q.requestId&&(e.sp=e.sp||[],e.sp.push({type:Tt.RefreshTextRender,requestId:Q.requestId,workId:J,viewId:_this95.viewId})),(b=Q.node)==null||b.clearTmpPoints(),_this95.workShapes.delete(J),(M=e.render)==null||M.push({rect:_tt3,drawCanvas:$t.Bg,viewId:_this95.viewId});case 6:return _context62.a(3,13);case 7:_V4=!!Q.ops;if((L=Q.animationWorkData)!=null&&L.length){_tt4=Q.oldRect,g=Q.node.oldRect;_tt4&&((X=e.render)==null||X.push({rect:_tt4,isClear:!0,clearCanvas:$t.Bg,viewId:_this95.viewId}),(Y=e.render)==null||Y.push({rect:_tt4,drawCanvas:$t.Bg,viewId:_this95.viewId})),g&&((et=e.render)==null||et.push({rect:g,isClear:!0,clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}));T=(A=Q.node)==null?void 0:A.consumeService({op:Q.animationWorkData,isFullWork:_V4});Q.isEnableCursor?n.set(J,{cursorTool:Fn(Q.toolsType),workState:_tt4?Q.ops?te.Done:te.Doing:te.Start,op:Q.animationWorkData.slice(-3,-1)}):_V4&&!Q.useAnimation&&(w=Q.updateNodeOpt)!=null&&w.useAnimation&&n.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:Q.animationWorkData.slice(-3,-1),uid:(S=Q.updateNodeOpt)==null?void 0:S.uid}),_V4?(_this95.selectorWorkShapes.forEach(function(k,Z){var st;(st=k.selectIds)!=null&&st.includes(J)&&(_this95.willRunEffectSelectorIds.add(Z),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt4),_this95.noAnimationRect=Kt(_this95.noAnimationRect,g),_this95.noAnimationRect=Kt(_this95.noAnimationRect,T),_this95.runEffect());}),(x=Q.node)==null||x.clearTmpPoints(),_this95.workShapes.delete(J),(P=e.render)==null||P.push({rect:T,drawCanvas:$t.Bg,viewId:_this95.viewId})):(z=e.render)==null||z.push({rect:T,drawCanvas:$t.ServiceFloat,workerType:_V4?void 0:Qt.Service,viewId:_this95.viewId}),Q.animationWorkData.length=0;}return _context62.a(3,13);case 8:if(!Q.useAnimation){_context62.n=11;break;}if(!Q.useAnimation){_context62.n=10;break;}if(!Q.isDel){_context62.n=9;break;}(R=Q.node)==null||R.clearTmpPoints(),_this95.workShapes.delete(J);return _context62.a(3,13);case 9:_V5=3,_tt5=_this95.computNextAnimationIndex(Q,_V5),_g2=Q.isDiff?0:Math.max(0,(Q.animationIndex||0)-_V5),_T2=(Q.animationWorkData||[]).slice(0,_tt5),k=(_=($=Q.node)==null?void 0:$.getWorkId())==null?void 0:_.toString();if((Q.animationIndex||0)<_tt5||Q.isDiff){Z=(H=Q.node)==null?void 0:H.consumeService({op:_T2,isFullWork:!1,replaceId:k});if((lt=e.render)==null||lt.push({isClear:!0,rect:Z,clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}),(dt=e.render)==null||dt.push({rect:Z,drawCanvas:$t.ServiceFloat,viewId:_this95.viewId}),Q.animationIndex=_tt5,Q.isDiff&&(Q.isDiff=!1),_T2.length&&Q.isEnableCursor){st=_T2.slice(-3,-1);n.set(J,{cursorTool:Fn(Q.toolsType),workState:_g2===0?te.Start:_tt5===((wt=Q.animationWorkData)==null?void 0:wt.length)?te.Done:te.Doing,op:st});}}else if(Q.ops){_Z2=(Et=Q.node)==null?void 0:Et.consumeService({op:Q.animationWorkData||[],isFullWork:!0,replaceId:k});Q.isDel=!0,(Ot=e.render)==null||Ot.push({isClear:!0,rect:_Z2,clearCanvas:$t.ServiceFloat,viewId:_this95.viewId},{rect:_Z2,drawCanvas:$t.ServiceFloat,viewId:_this95.viewId},{isClear:!0,rect:_Z2,clearCanvas:$t.Bg,viewId:_this95.viewId},{rect:_Z2,drawCanvas:$t.Bg,viewId:_this95.viewId}),Q.isEnableCursor&&n.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T2.slice(-3,-1)});}t=!0;return _context62.a(3,13);case 10:_context62.n=12;break;case 11:_V6=!!Q.ops;_tt6=(U=Q.node)==null?void 0:U.consumeService({op:Q.animationWorkData||[],isFullWork:_V6,replaceId:J});_g3=(K=Q.node)==null?void 0:K.updataOptService(Q.updateNodeOpt);if(_V6){if(_tt6=Kt(_tt6,_g3),(j=e.render)==null||j.push({isClear:!0,rect:Kt(Q.oldRect,_tt6),clearCanvas:$t.Bg,viewId:_this95.viewId}),(nt=e.render)==null||nt.push({rect:Kt(Q.oldRect,_tt6),drawCanvas:$t.Bg,viewId:_this95.viewId}),(ct=Q.updateNodeOpt)!=null&&ct.useAnimation&&((B=e.render)==null||B.push({isClear:!0,rect:Kt(Q.oldRect,_tt6),clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}),(N=e.render)==null||N.push({rect:Kt(Q.oldRect,_tt6),drawCanvas:$t.ServiceFloat,viewId:_this95.viewId}),!Q.isEnableCursor&&(G=Q.animationWorkData)!=null&&G.length)){_T3=Q.animationWorkData.slice(-3,-1);n.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T3,uid:(q=Q.updateNodeOpt)==null?void 0:q.uid});}_this95.selectorWorkShapes.forEach(function(T,k){var Z;(Z=T.selectIds)!=null&&Z.includes(J)&&(_this95.willRunEffectSelectorIds.add(k),_this95.noAnimationRect=Kt(_this95.noAnimationRect,_tt6),_this95.runEffect());}),(at=Q.node)==null||at.clearTmpPoints(),_this95.workShapes.delete(J);}else _tt6=Kt(_tt6,_g3),(ut=e.render)==null||ut.push({isClear:!0,rect:Kt(Q.oldRect,_tt6),clearCanvas:$t.ServiceFloat,viewId:_this95.viewId}),(Ct=e.render)==null||Ct.push({rect:Kt(Q.oldRect,_tt6),drawCanvas:$t.ServiceFloat,viewId:_this95.viewId});case 12:return _context62.a(3,13);case 13:return _context62.a(2);}},_loop6);});_iterator97.s();case 2:if((_step97=_iterator97.n()).done){_context63.n=4;break;}return _context63.d(_regeneratorValues(_loop6()),3);case 3:_context63.n=2;break;case 4:_context63.n=6;break;case 5:_context63.p=5;_t57=_context63.v;_iterator97.e(_t57);case 6:_context63.p=6;_iterator97.f();return _context63.f(6);case 7:t&&this.runAnimation();n.size&&(e.sp=e.sp||[],n.forEach(function(J,Q){var V;(V=e.sp)==null||V.push({type:Tt.Cursor,uid:J.uid||Q.split(Fo)[0],op:J.op,workState:J.workState,cursorTool:J.cursorTool,viewId:_this95.viewId});}));_t58=(O=e.render)!=null&&O.length||(D=e.sp)!=null&&D.length;if(!_t58){_context63.n=8;break;}_context63.n=8;return this.post(e);case 8:return _context63.a(2);}},_callee61,this,[[1,5,6,7]]);}));function animationDraw(){return _animationDraw.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;this.animationScheduler.request(t);}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(t,e){var n=Math.floor((t.animationWorkData||[]).slice(t.animationIndex).length*48/e/this.syncUnitTime)*e;return Math.min((t.animationIndex||0)+(n||e),(t.animationWorkData||[]).length);}},{key:"runEffect",value:function runEffect(){this.effectScheduler.request();}},{key:"effectRunSelector",value:function(){var _effectRunSelector=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee62(){var _this96=this;var t,_t59;return _regenerator().w(function(_context64){while(1)switch(_context64.n){case 0:t=this.noAnimationRect;this.willRunEffectSelectorIds.forEach(function(e){var s,o;var n=_this96.selectorWorkShapes.get(e),i=n&&n.selectIds&&((s=n.node)==null?void 0:s.selectServiceNode(e,n,!0));t=Kt(t,i),(o=n==null?void 0:n.selectIds)!=null&&o.length||_this96.selectorWorkShapes.delete(e);});_t59=t;if(!_t59){_context64.n=1;break;}_context64.n=1;return this.post({render:[{rect:me(t),isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId},{rect:me(t),drawCanvas:$t.Bg,viewId:this.viewId}]});case 1:this.willRunEffectSelectorIds.clear();this.noAnimationRect=void 0;case 2:return _context64.a(2);}},_callee62,this);}));function effectRunSelector(){return _effectRunSelector.apply(this,arguments);}return effectRunSelector;}()},{key:"flush",value:function(){var _flush=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee63(){return _regenerator().w(function(_context65){while(1)switch(_context65.n){case 0:_context65.n=1;return this.animationScheduler.flush();case 1:_context65.n=2;return this.effectScheduler.flush();case 2:return _context65.a(2);}},_callee63,this);}));function flush(){return _flush.apply(this,arguments);}return flush;}()},{key:"activeSelectorShape",value:function activeSelectorShape(t){var v,p,y;var e=t.workId,n=t.opt,i=t.toolsType,s=t.type,o=t.selectIds,a=t.imageBitmap;if(!e)return;var u=e.toString();if(!((v=this.selectorWorkShapes)!=null&&v.has(u))){var C={toolsType:i,selectIds:o,type:s,opt:n,imageBitmap:a};i&&n&&(C=this.setNodeKey(u,C,i,n)),(p=this.selectorWorkShapes)==null||p.set(u,C);}var h=(y=this.selectorWorkShapes)==null?void 0:y.get(u);s&&(h.type=s),h.node&&h.node.getWorkId()!==u&&h.node.setWorkId(u),a&&(h.imageBitmap=a),h.selectIds=o||[];}}]);}();var pMt=/*#__PURE__*/function(_zv2){function pMt(e){var _this97;_classCallCheck(this,pMt);_this97=_callSuper(this,pMt,[e]);ht(_this97,"drawWorkActiveId");return _this97;}_inherits(pMt,_zv2);return _createClass(pMt,[{key:"runSelectWork",value:function runSelectWork(e){var i;var n=this.setFullWork(e);n&&(i=e.selectIds)!=null&&i.length&&e.workId&&n.selectServiceNode(e.workId.toString(),{selectIds:e.selectIds},!1);}},{key:"workShapesDone",value:function workShapesDone(){var _iterator98=_createForOfIteratorHelper(this.workShapes.keys()),_step98;try{for(_iterator98.s();!(_step98=_iterator98.n()).done;){var e=_step98.value;this.clearWorkShapeNodeCache(e);}}catch(err){_iterator98.e(err);}finally{_iterator98.f();}Kr(this.fullLayer,this.fullLayer.parent);}},{key:"consumeDraw",value:function(){var _consumeDraw3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee64(e){var n,i,s,o,a,u,h,_t60,_t61,_t62,_t63,_t64,_t65,_t66,_t67,_t68;return _regenerator().w(function(_context66){while(1)switch(_context66.n){case 0:n=e.workId,i=e.fullWorkerDrawCount,s=e.postCount,o=n==null?void 0:n.toString(),a=o&&this.workShapes.get(o);if(a){_context66.n=4;break;}_t60=o&&$e(s);if(!_t60){_context66.n=2;break;}_context66.n=1;return this.drawAckBackpressure.wait(o);case 1:_t60=_context66.v;case 2:_t61=_t60;if(!_t61){_context66.n=3;break;}_context66.n=3;return this._post({consumeCount:s,consumeWorkId:o});case 3:return _context66.a(2);case 4:_t62=this.drawWorkActiveId&&this.drawWorkActiveId!==o;if(!_t62){_context66.n=6;break;}_context66.n=5;return this.consumeDrawAll({workId:this.drawWorkActiveId,viewId:this.viewId,msgType:Tt.DrawWork,dataType:Qt.Local});case 5:this.drawWorkActiveId=void 0;case 6:!this.drawWorkActiveId&&o!==De&&(this.drawWorkActiveId=o);u=a.toolsType;$e(s)&&(this.consumeCount=s);h=a.consume({data:e,drawCount:this.drawCount,isFullWork:!0,isSubWorker:!0,removeDrawCount:i});_t63=u;_context66.n=_t63===St.Selector?7:_t63===St.Ellipse?9:_t63===St.Arrow?9:_t63===St.Straight?9:_t63===St.Rectangle?9:_t63===St.Star?9:_t63===St.Polygon?9:_t63===St.SpeechBalloon?9:_t63===St.Pencil?11:_t63===St.PencilEraser?13:_t63===St.BitMapEraser?16:17;break;case 7:_t64=h;if(!_t64){_context66.n=8;break;}this.drawCount++;_context66.n=8;return this.drawSelector(h);case 8:return _context66.a(3,17);case 9:_t65=h;if(!_t65){_context66.n=10;break;}this.drawCount++;_context66.n=10;return this.drawShape(h);case 10:return _context66.a(3,17);case 11:_t66=h;if(!_t66){_context66.n=12;break;}this.drawCount++;_context66.n=12;return this.drawPencil(h,n==null?void 0:n.toString());case 12:return _context66.a(3,17);case 13:_t67=h;if(!_t67){_context66.n=15;break;}this.drawCount++;_context66.n=14;return this.drawAckBackpressure.wait(o);case 14:_t68=_context66.v;if(!_t68){_context66.n=15;break;}_context66.n=15;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,consumeWorkId:o});case 15:return _context66.a(3,17);case 16:h&&this.drawCount++;return _context66.a(3,17);case 17:return _context66.a(2);}},_callee64,this);}));function consumeDraw(_x109){return _consumeDraw3.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee65(e){var n,i,s,_t69;return _regenerator().w(function(_context67){while(1)switch(_context67.n){case 0:n=e.workId;if(!n){_context67.n=4;break;}i=n.toString();this.drawAckBackpressure.finish(i),this.drawWorkActiveId===i&&(this.drawWorkActiveId=void 0);s=this.workShapes.get(i);if(s){_context67.n=1;break;}return _context67.a(2);case 1:_t69=s.toolsType;_context67.n=_t69===St.Selector?2:_t69===St.Arrow?3:_t69===St.Straight?3:_t69===St.Ellipse?3:_t69===St.Pencil?3:_t69===St.Rectangle?3:_t69===St.Star?3:_t69===St.Polygon?3:_t69===St.SpeechBalloon?3:_t69===St.BitMapEraser?3:_t69===St.PencilEraser?3:4;break;case 2:this.drawCount=0,Kr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(i),this._post({render:[{isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}]});return _context67.a(3,4);case 3:this.drawCount=0,Kr(this.fullLayer,this.fullLayer.parent),this.clearWorkShapeNodeCache(i);return _context67.a(3,4);case 4:return _context67.a(2);}},_callee65,this);}));function consumeDrawAll(_x110){return _consumeDrawAll2.apply(this,arguments);}return consumeDrawAll;}()},{key:"removeWork",value:function(){var _removeWork4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee66(e){var n,i,s,o;return _regenerator().w(function(_context68){while(1)switch(_context68.n){case 0:n=e.workId,i=n==null?void 0:n.toString();if(!i){_context68.n=1;break;}s=this.removeNode(i);if(!s){_context68.n=1;break;}o=[];o.push({rect:me(s),clearCanvas:$t.Float,isClear:!0,viewId:this.viewId},{rect:me(s),drawCanvas:$t.Float,viewId:this.viewId});_context68.n=1;return this._post({render:o});case 1:return _context68.a(2);}},_callee66,this);}));function removeWork(_x111){return _removeWork4.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(e){var _this98=this;var n=this.workShapes.has(e);var i;return n&&(this.fullLayer.getElementsByName(e).forEach(function(s){var o=s.getBoundingClientRect();i=Kt(i,{x:o.x-Gt.SafeBorderPadding,y:o.y-Gt.SafeBorderPadding,w:o.width+Gt.SafeBorderPadding*2,h:o.height+Gt.SafeBorderPadding*2}),s.remove(),_zr(s,_this98.fullLayer.parent);}),i&&this.clearWorkShapeNodeCache(e)),i;}},{key:"drawPencil",value:function(){var _drawPencil2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee67(e,n){var _t70,_t71;return _regenerator().w(function(_context69){while(1)switch(_context69.n){case 0:_t70=!n;if(_t70){_context69.n=2;break;}_context69.n=1;return this.drawAckBackpressure.wait(n);case 1:_t70=!_context69.v;case 2:_t71=_t70;if(_t71){_context69.n=3;break;}_context69.n=3;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,consumeWorkId:n,render:[{rect:e==null?void 0:e.rect,workId:n,drawCanvas:$t.Float,viewId:this.viewId}],sp:(e==null?void 0:e.op)&&[e]});case 3:return _context69.a(2);}},_callee67,this);}));function drawPencil(_x112,_x113){return _drawPencil2.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee68(e){return _regenerator().w(function(_context70){while(1)switch(_context70.n){case 0:_context70.n=1;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(e==null?void 0:e.rect)&&me(e.rect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:(e==null?void 0:e.rect)&&me(e.rect),drawCanvas:$t.Float,viewId:this.viewId}]});case 1:return _context70.a(2);}},_callee68,this);}));function drawShape(_x114){return _drawShape2.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee69(e){return _regenerator().w(function(_context71){while(1)switch(_context71.n){case 0:_context71.n=1;return this._post({subWorkerDrawCount:this.drawCount,consumeCount:this.consumeCount,render:[{rect:(e==null?void 0:e.rect)&&me(e.rect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:(e==null?void 0:e.rect)&&me(e.rect),drawCanvas:$t.Float,viewId:this.viewId}]});case 1:return _context71.a(2);}},_callee69,this);}));function drawSelector(_x115){return _drawSelector2.apply(this,arguments);}return drawSelector;}()}]);}(zv);var vMt=/*#__PURE__*/function(){function vMt(t){_classCallCheck(this,vMt);ht(this,"viewId");ht(this,"vNodes");ht(this,"topLayer");ht(this,"thread");ht(this,"post");ht(this,"serviceWorkShapes",/* @__PURE__ */new Map());ht(this,"localWorkShapes",/* @__PURE__ */new Map());ht(this,"tmpOpt");ht(this,"syncUnitTime",Jr.syncOpt.interval);ht(this,"animationId");this.viewId=t.viewId,this.vNodes=t.vNodes,this.topLayer=t.topLayer,this.thread=t.thread,this.post=t.thread.post.bind(t.thread);}return _createClass(vMt,[{key:"canUseTopLayer",value:function canUseTopLayer(t){return t===St.LaserPen;}},{key:"getWorkShape",value:function getWorkShape(t){return this.localWorkShapes.get(t);}},{key:"createWorkShape",value:function createWorkShape(t,e){if(t&&this.tmpOpt){var n={toolsType:this.tmpOpt.toolsType,toolsOpt:e||this.tmpOpt.toolsOpt},i=this.createWorkShapeNode(_objectSpread(_objectSpread({},n),{},{workId:t}));return i&&this.localWorkShapes.set(t,{node:i,toolsType:i.toolsType,workState:te.Start}),i;}}},{key:"setWorkOptions",value:function setWorkOptions(t,e){var i;var n=(i=this.localWorkShapes.get(t))==null?void 0:i.node;n||this.createWorkShape(t,e),n==null||n.setWorkOptions(e);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(t){var e=t.toolsType;if(e===St.LaserPen)return mf(_objectSpread(_objectSpread({},t),{},{vNodes:this.vNodes,fullLayer:this.topLayer,drawLayer:this.topLayer}));}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.localWorkShapes.forEach(function(t){var e;return(e=t.node)==null?void 0:e.clearTmpPoints();}),this.localWorkShapes.clear();}},{key:"setToolsOpt",value:function setToolsOpt(t){var e;this.tmpOpt=t,(e=t.toolsOpt)!=null&&e.syncUnitTime&&(this.syncUnitTime=t.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"consumeDraw",value:function consumeDraw(t){var e=t.workId,n=t.dataType;if(n===Qt.Service)this.activeServiceWorkShape(t);else{var i=e==null?void 0:e.toString(),s=i&&this.localWorkShapes.get(i);if(!s)return;var o=s.node.consume({data:t,isFullWork:!1,isSubWorker:!0});o.rect&&(s.totalRect=Kt(o.rect,s.totalRect),s.result=o,s.workState=te.Doing,i&&this.localWorkShapes.set(i,s));}this.runAnimation();}},{key:"consumeDrawAll",value:function consumeDrawAll(t){var e=t.workId,n=t.dataType;if(n===Qt.Service)this.activeServiceWorkShape(t);else{var i=e==null?void 0:e.toString(),s=i&&this.localWorkShapes.get(i);if(!s)return;var o=s.node.consumeAll({data:t});s.totalRect=Kt(o.rect,s.totalRect),s.result=o,s.workState=te.Done,i&&this.localWorkShapes.set(i,s);}this.runAnimation();}},{key:"destroy",value:function destroy(){this.serviceWorkShapes.clear(),this.localWorkShapes.clear();}},{key:"setNodeKey",value:function setNodeKey(t,e,n,i){return e.toolsType=n,e.node=this.createWorkShapeNode({workId:t,toolsType:n,toolsOpt:i}),e;}},{key:"activeServiceWorkShape",value:function activeServiceWorkShape(t){var y,C;var e=t.workId,n=t.opt,i=t.toolsType,s=t.type,o=t.updateNodeOpt,a=t.ops,u=t.op;if(!e)return;var h=e.toString(),v=(y=this.vNodes.get(h))==null?void 0:y.rect;if(!((C=this.serviceWorkShapes)!=null&&C.has(h))){var b={toolsType:i,animationWorkData:u||[],animationIndex:0,type:s,updateNodeOpt:o,ops:a,oldRect:v};i&&n&&(b=this.setNodeKey(h,b,i,n)),this.serviceWorkShapes.set(h,b);}var p=this.serviceWorkShapes.get(h);s&&(p.type=s),a&&(p.animationWorkData=ks(a),p.ops=a),o&&(p.updateNodeOpt=o),u&&(p.animationWorkData=u),p.node&&p.node.getWorkId()!==h&&p.node.setWorkId(h),v&&(p.oldRect=v),i&&n?(p.toolsType!==i&&i&&n&&this.setNodeKey(h,p,i,n),p.node&&p.node.setWorkOptions(n)):i&&(p.toolsType=i);}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(t,e){var n=Math.floor((t.animationWorkData||[]).slice(t.animationIndex).length*32/e/this.syncUnitTime)*e;return Math.min((t.animationIndex||0)+(n||e),(t.animationWorkData||[]).length);}},{key:"animationDraw",value:function(){var _animationDraw2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee70(){var _this99=this;var o,a,u,h,t,e,n,i,s,_iterator99,_step99,_step99$value,v,p,C,b,M,L,_iterator100,_step100,_step100$value,_v11,_p6,y,_C4,_b8,_M5,_L18,_t72,_t73,_t74,_t75;return _regenerator().w(function(_context72){while(1)switch(_context72.p=_context72.n){case 0:this.animationId=void 0;t=!1;e=/* @__PURE__ */new Map(),n=[],i=[],s=[];_iterator99=_createForOfIteratorHelper(this.serviceWorkShapes.entries());_context72.p=1;_iterator99.s();case 2:if((_step99=_iterator99.n()).done){_context72.n=6;break;}_step99$value=_slicedToArray(_step99.value,2),v=_step99$value[0],p=_step99$value[1];_t72=p.toolsType;_context72.n=_t72===St.LaserPen?3:5;break;case 3:C=this.computNextAnimationIndex(p,8),b=Math.max(0,p.animationIndex||0),M=(p.animationWorkData||[]).slice(b,C);if((p.animationIndex||0)<C){L=(o=p.node)==null?void 0:o.consumeService({op:M,isFullWork:!1});p.totalRect=Kt(p.totalRect,L),p.animationIndex=C,M.length&&e.set(v,{cursorTool:Fn(p.toolsType),workState:b===0?te.Start:C===((a=p.animationWorkData)==null?void 0:a.length)?te.Done:te.Doing,op:M.slice(-2)});}if(!(i.push({isClear:!0,rect:p.totalRect,clearCanvas:$t.TopFloat,viewId:this.viewId}),n.push({rect:p.totalRect,drawCanvas:$t.TopFloat,viewId:this.viewId}),p.isDel)){_context72.n=4;break;}(u=p.node)==null||u.clearTmpPoints(),this.serviceWorkShapes.delete(v);return _context72.a(3,5);case 4:p.ops&&p.animationIndex===((h=p.animationWorkData)==null?void 0:h.length)&&!p.isDel&&(this.topLayer.getElementsByName(v.toString())[0]||(p.isDel=!0,this.serviceWorkShapes.set(v,p))),t=!0;return _context72.a(3,5);case 5:_context72.n=2;break;case 6:_context72.n=8;break;case 7:_context72.p=7;_t73=_context72.v;_iterator99.e(_t73);case 8:_context72.p=8;_iterator99.f();return _context72.f(8);case 9:_iterator100=_createForOfIteratorHelper(this.localWorkShapes.entries());_context72.p=10;_iterator100.s();case 11:if((_step100=_iterator100.n()).done){_context72.n=15;break;}_step100$value=_slicedToArray(_step100.value,2),_v11=_step100$value[0],_p6=_step100$value[1];y=_p6.result,_C4=_p6.toolsType,_b8=_p6.totalRect,_M5=_p6.isDel,_L18=_p6.workState;_t74=_C4;_context72.n=_t74===St.LaserPen?12:14;break;case 12:if(!(_b8&&(i.push({isClear:!0,rect:_b8,clearCanvas:$t.TopFloat,viewId:this.viewId}),n.push({rect:_b8,drawCanvas:$t.TopFloat,viewId:this.viewId})),_M5)){_context72.n=13;break;}_p6.node.clearTmpPoints(),this.localWorkShapes.delete(_v11),s.push({removeIds:[_v11.toString()],viewId:this.viewId,type:Tt.RemoveNode});return _context72.a(3,14);case 13:y&&((y.op||y.ops)&&s.push(y),_p6.result=void 0),!this.topLayer.getElementsByName(_v11.toString())[0]&&_L18===te.Done&&(_p6.isDel=!0,this.localWorkShapes.set(_v11,_p6)),t=!0;return _context72.a(3,14);case 14:_context72.n=11;break;case 15:_context72.n=17;break;case 16:_context72.p=16;_t75=_context72.v;_iterator100.e(_t75);case 17:_context72.p=17;_iterator100.f();return _context72.f(17);case 18:t&&this.runAnimation(),e.size&&e.forEach(function(v,p){s.push({type:Tt.Cursor,uid:p.split(Fo)[0],op:v.op,workState:v.workState,cursorTool:v.cursorTool,viewId:_this99.viewId});}),(n.length||i.length||s.length)&&this.post({render:[].concat(i,n),sp:s});case 19:return _context72.a(2);}},_callee70,this,[[10,16,17,18],[1,7,8,9]]);}));function animationDraw(){return _animationDraw2.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this100=this;this.animationId||(this.animationId=setTimeout(function(){_this100.animationId=void 0,_this100.animationDraw();},16));}}]);}();var gMt=/*#__PURE__*/function(_ZT){function gMt(e){var _this101;_classCallCheck(this,gMt);_this101=_callSuper(this,gMt,[e]);ht(_this101,"_type","simple");return _this101;}_inherits(gMt,_ZT);return _createClass(gMt,[{key:"createWorkShapeNode",value:function createWorkShapeNode(e){var i;var n=e.toolsType;return n===St.Selector?this.vNodes?new Ka(_objectSpread(_objectSpread({},e),{},{fullLayer:this.fullLayer,vNodes:this.vNodes,drawLayer:this.drawLayer})):void 0:mf(_objectSpread(_objectSpread({},e),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(i=this.thread)==null?void 0:i.serviceWork);}},{key:"drawPencil",value:function(){var _drawPencil3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee71(e,n){var _t76,_t77;return _regenerator().w(function(_context73){while(1)switch(_context73.n){case 0:_t76=!n;if(_t76){_context73.n=2;break;}_context73.n=1;return this.drawAckBackpressure.wait(n);case 1:_t76=!_context73.v;case 2:_t77=_t76;if(_t77){_context73.n=3;break;}_context73.n=3;return this._post({consumeCount:this.consumeCount,consumeWorkId:n,render:[{rect:e==null?void 0:e.rect,workId:n,drawCanvas:$t.Float,viewId:this.viewId}],sp:(e==null?void 0:e.op)&&[e]});case 3:return _context73.a(2);}},_callee71,this);}));function drawPencil(_x116,_x117){return _drawPencil3.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee72(e){return _regenerator().w(function(_context74){while(1)switch(_context74.n){case 0:_context74.n=1;return this._post({consumeCount:this.consumeCount,sp:(e==null?void 0:e.op)&&[e],render:[{rect:(e==null?void 0:e.rect)&&me(e.rect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:(e==null?void 0:e.rect)&&me(e.rect),drawCanvas:$t.Float,viewId:this.viewId}]});case 1:return _context74.a(2);}},_callee72,this);}));function drawShape(_x118){return _drawShape3.apply(this,arguments);}return drawShape;}()},{key:"drawSelector",value:function(){var _drawSelector3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee73(e,n,i){var s,a,u,h,v,o,_args75=arguments;return _regenerator().w(function(_context75){while(1)switch(_context75.n){case 0:s=_args75.length>3&&_args75[3]!==undefined?_args75[3]:[];o={render:s,sp:[e],consumeCount:this.consumeCount};(a=o.sp)==null||a.push({type:Tt.SelectorTransform,emitEventType:ve.SelectMethod,workState:n});i&&((u=o.sp)==null||u.push({type:Tt.None,isLockSentEventCursor:i}));e.subRect&&((h=o.render)==null||h.push({rect:me(e.subRect),isClear:!0,clearCanvas:$t.Float,viewId:this.viewId},{rect:me(e.subRect),drawCanvas:$t.Float,viewId:this.viewId}));e.rect&&((v=o.render)==null||v.push({rect:me(e.rect),clearCanvas:$t.Bg,isClear:!0,viewId:this.viewId},{rect:me(e.rect),drawCanvas:$t.Bg,viewId:this.viewId}));_context75.n=1;return this._post(o);case 1:return _context75.a(2);}},_callee73,this);}));function drawSelector(_x119,_x120,_x121){return _drawSelector3.apply(this,arguments);}return drawSelector;}()},{key:"postEraserBatch",value:function(){var _postEraserBatch2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee74(e,n,i,s,o){var u,h,v,p,a,y,C,b,M,_iterator101,_step101,_step101$value,_M6,L;return _regenerator().w(function(_context76){while(1)switch(_context76.n){case 0:a=(u=this.workShapes.get(e))==null?void 0:u.combineConsume({workerEngine:this});if(!(a||o)){_context76.n=1;break;}y=a==null?void 0:a.willDeleteNodes,C=a==null?void 0:a.willNewNodes,b=_objectSpread({render:[],sp:[]},o);if(a!=null&&a.rect){M=me(a.rect);(h=b.render)==null||h.push({rect:M,isClear:!0,clearCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e},{rect:M,drawCanvas:$t.Bg,viewId:this.viewId,eraseTxnId:e});}if(y!=null&&y.size&&((v=b.sp)==null||v.push({type:Tt.RemoveNode,removeIds:_toConsumableArray(y),viewId:this.thread.viewId})),C!=null&&C.size){_iterator101=_createForOfIteratorHelper(C);try{for(_iterator101.s();!(_step101=_iterator101.n()).done;){_step101$value=_slicedToArray(_step101.value,2),_M6=_step101$value[0],L=_step101$value[1];(p=b.sp)==null||p.push({type:Tt.FullWork,dataType:Qt.Local,toolsType:St.Pencil,ops:Br(L.op),opt:L.opt,workId:_M6,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator101.e(err);}finally{_iterator101.f();}}_context76.n=1;return this._post(b);case 1:return _context76.a(2);}},_callee74,this);}));function postEraserBatch(_x122,_x123,_x124,_x125,_x126){return _postEraserBatch2.apply(this,arguments);}return postEraserBatch;}()},{key:"consumeDraw",value:function(){var _consumeDraw4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee75(e,n){var _this102=this;var i,s,o,a,u,h,v,p,y,_t78,_t79,_t80,_t81;return _regenerator().w(function(_context77){while(1)switch(_context77.n){case 0:i=e.op,s=e.workId,o=e.scenePath,a=e.postCount,u=e.smoothSync;if(!(i!=null&&i.length&&s)){_context77.n=18;break;}h=s.toString(),v=this.getWorkShape(h);if(v){_context77.n=1;break;}return _context77.a(2);case 1:p=v.toolsType;if(!(p===St.LaserPen)){_context77.n=2;break;}return _context77.a(2);case 2:_t78=this.drawWorkActiveId&&this.drawWorkActiveId!==h;if(!_t78){_context77.n=4;break;}_context77.n=3;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:o,viewId:this.viewId,msgType:Tt.DrawWork,dataType:Qt.Local},n);case 3:this.drawWorkActiveId=void 0;case 4:!this.drawWorkActiveId&&h!==De&&(this.drawWorkActiveId=h);$e(a)&&(this.consumeCount=a);y=v.consume({data:e,isSimpleWorker:!0,smoothSync:u});_t79=p;_context77.n=_t79===St.Selector?5:_t79===St.PencilEraser?7:_t79===St.BitMapEraser?10:_t79===St.Eraser?12:_t79===St.Arrow?14:_t79===St.Straight?14:_t79===St.Ellipse?14:_t79===St.Rectangle?14:_t79===St.Star?14:_t79===St.Polygon?14:_t79===St.SpeechBalloon?14:_t79===St.Pencil?16:18;break;case 5:this.drawCount++;y.type===Tt.Select&&y.selectIds&&n.runReverseSelectWork(y.selectIds);_context77.n=6;return this.drawSelector(_objectSpread(_objectSpread({},y),{},{isSelecting:!0}),e.workState||te.Doing);case 6:return _context77.a(3,18);case 7:this.drawCount++;this.combineDrawActiveId=h;this.eraserBatchScheduler.schedule(function(){_this102.drawPencilEraserCombine(h,_this102.drawCount);},this.eraserBatchDelay);_context77.n=8;return this.drawAckBackpressure.wait(h);case 8:_t80=_context77.v;if(!_t80){_context77.n=9;break;}_context77.n=9;return this._post({consumeCount:this.consumeCount,consumeWorkId:h});case 9:return _context77.a(3,18);case 10:this.drawCount++;this.combineDrawActiveId=h;_context77.n=11;return this.enqueueBitmapEraserRender(h,this.drawCount,void 0,void 0,{consumeCount:this.consumeCount,consumeWorkId:h});case 11:return _context77.a(3,18);case 12:_context77.n=13;return this.drawEraser(y);case 13:return _context77.a(3,18);case 14:_t81=y;if(!_t81){_context77.n=15;break;}this.drawCount++;_context77.n=15;return this.drawShape(y);case 15:return _context77.a(3,18);case 16:this.drawCount++;_context77.n=17;return this.drawPencil(y,h);case 17:return _context77.a(3,18);case 18:return _context77.a(2);}},_callee75,this);}));function consumeDraw(_x127,_x128){return _consumeDraw4.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee76(e,n){var a,u,h,i,s,o,v,p,y,C,b,M,L,_t82;return _regenerator().w(function(_context78){while(1)switch(_context78.p=_context78.n){case 0:this.eraserBatchScheduler.cancel(),this.combineTimerId&&(clearTimeout(this.combineTimerId),this.combineTimerId=void 0,this.combineDrawResolve&&this.combineDrawResolve(!1),this.combineDrawActiveId=void 0);i=e.workId,s=e.scenePath,o=e.isLockSentEventCursor;if(!i){_context78.n=12;break;}v=i.toString();this.drawAckBackpressure.finish(v),this.combineDrawActiveId===v&&(this.combineDrawActiveId=void 0),this.drawWorkActiveId===v&&(this.drawWorkActiveId=void 0);p=this.workShapes.get(v);if(p){_context78.n=1;break;}return _context78.a(2);case 1:y=p.toolsType;if(!(y===St.LaserPen)){_context78.n=2;break;}return _context78.a(2);case 2:C=this.workShapes.get(Lo);b=(a=C==null?void 0:C.selectIds)==null?void 0:a[0];_context78.n=3;return p.consumeAll({data:e,workerEngine:this});case 3:M=_context78.v;_t82=y;_context78.n=_t82===St.Selector?4:_t82===St.PencilEraser?6:_t82===St.BitMapEraser?6:_t82===St.Eraser?9:_t82===St.Arrow?10:_t82===St.Straight?10:_t82===St.Ellipse?10:_t82===St.Rectangle?10:_t82===St.Star?10:_t82===St.Polygon?10:_t82===St.SpeechBalloon?10:_t82===St.Pencil?10:12;break;case 4:L=[];this.drawLayer&&(this.drawCount=0,Kr(this.drawLayer,this.drawLayer.parent),this.getWorkShape(v).clearSubTmpPoints(),L.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}));M.selectIds&&b&&(u=M.selectIds)!=null&&u.includes(b)&&C.cursorBlur();M.selectIds&&n.runReverseSelectWork(M.selectIds);_context78.n=5;return this.drawSelector(_objectSpread(_objectSpread({},M),{},{scenePath:s,isSelecting:!1}),te.Done,o,L);case 5:(h=p.selectIds)!=null&&h.length?p.clearTmpPoints():this.clearWorkShapeNodeCache(v);return _context78.a(3,12);case 6:_context78.p=6;_context78.n=7;return this.drawEraserFull(p,_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker);case 7:_context78.p=7;this.drawCount=0,this.clearWorkShapeNodeCache(v);return _context78.f(7);case 8:return _context78.a(3,12);case 9:this.drawEraser(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker),p.clearTmpPoints();return _context78.a(3,12);case 10:_context78.n=11;return this.drawPencilFull(_objectSpread(_objectSpread({},M),{},{scenePath:s}),o,e.needUndoTicker,y);case 11:this.drawCount=0;this.clearWorkShapeNodeCache(v);return _context78.a(3,12);case 12:return _context78.a(2);}},_callee76,this,[[6,,7,8]]);}));function consumeDrawAll(_x129,_x130){return _consumeDrawAll3.apply(this,arguments);}return consumeDrawAll;}()}]);}(ZT);var mMt=/*#__PURE__*/function(_qT){function mMt(e){var _this103;_classCallCheck(this,mMt);_this103=_callSuper(this,mMt,[e]);ht(_this103,"_type","simple");return _this103;}_inherits(mMt,_qT);return _createClass(mMt,[{key:"animationDraw",value:function(){var _animationDraw3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee77(){var _this104=this;var s,o,a,u,h,v,p,y,C,b,M,L,X,Y,et,A,w,S,x,P,z,U,K,j,nt,ct,B,N,G,q,at,ut,Ct,R,$,_,H,lt,dt,wt,Et,Ot,O,D,e,n,i,_iterator102,_step102,_loop7,_t84,_t85;return _regenerator().w(function(_context80){while(1)switch(_context80.p=_context80.n){case 0:e=!1;n={render:[]},i=/* @__PURE__ */new Map();_iterator102=_createForOfIteratorHelper(this.workShapes.entries());_context80.p=1;_loop7=/*#__PURE__*/_regenerator().m(function _loop7(){var _step102$value,J,Q,V,tt,_V7,_tt7,_V8,_tt8,_V9,_tt9,g,T,_V0,_tt0,_g4,_T4,k,Z,st,_Z3,_V1,_tt1,_g5,_T5,_t83;return _regenerator().w(function(_context79){while(1)switch(_context79.n){case 0:_step102$value=_slicedToArray(_step102.value,2),J=_step102$value[0],Q=_step102$value[1];_t83=Q.toolsType;_context79.n=_t83===St.BackgroundSVG?1:_t83===St.Image?2:_t83===St.Text?4:_t83===St.Arrow?7:_t83===St.Straight?7:_t83===St.Rectangle?7:_t83===St.Ellipse?7:_t83===St.Star?7:_t83===St.Polygon?7:_t83===St.SpeechBalloon?7:_t83===St.Pencil?8:13;break;case 1:V=Q.oldRect;V&&((s=n.render)==null||s.push({rect:V,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(o=n.render)==null||o.push({rect:V,drawCanvas:$t.Bg,viewId:_this104.viewId}));tt=Q.node.consumeService({isFullWork:!0,replaceId:J});_this104.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this104.willRunEffectSelectorIds.add(T),_this104.noAnimationRect=Kt(_this104.noAnimationRect,V),_this104.noAnimationRect=Kt(_this104.noAnimationRect,tt),_this104.runEffect());}),_this104.workShapes.delete(J),(a=n.render)==null||a.push({rect:tt,drawCanvas:$t.Bg,viewId:_this104.viewId});return _context79.a(3,13);case 2:_V7=Q.oldRect;_V7&&((u=n.render)==null||u.push({rect:_V7,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(h=n.render)==null||h.push({rect:_V7,drawCanvas:$t.Bg,viewId:_this104.viewId}));_context79.n=3;return(v=Q.node)==null?void 0:v.consumeServiceAsync({isFullWork:!0,worker:_this104.thread});case 3:_tt7=_context79.v;_this104.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this104.willRunEffectSelectorIds.add(T),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_V7),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt7),_this104.runEffect());}),_this104.workShapes.delete(J),(p=n.render)==null||p.push({rect:_tt7,drawCanvas:$t.Bg,viewId:_this104.viewId});return _context79.a(3,13);case 4:if(!Q.node){_context79.n=6;break;}_V8=Q.oldRect;_V8&&((y=n.render)==null||y.push({rect:_V8,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(C=n.render)==null||C.push({rect:_V8,drawCanvas:$t.Bg,viewId:_this104.viewId}));_context79.n=5;return Q.node.consumeServiceAsync({isFullWork:!0,replaceId:J,boxRect:_this104.thread.getSceneRect()});case 5:_tt8=_context79.v;_this104.selectorWorkShapes.forEach(function(g,T){var k;(k=g.selectIds)!=null&&k.includes(J)&&(_this104.willRunEffectSelectorIds.add(T),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_V8),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt8),_this104.runEffect());}),Q.refreshTextRender&&Q.requestId&&(n.sp=n.sp||[],n.sp.push({type:Tt.RefreshTextRender,requestId:Q.requestId,workId:J,viewId:_this104.viewId})),(b=Q.node)==null||b.clearTmpPoints(),_this104.workShapes.delete(J),(M=n.render)==null||M.push({rect:_tt8,drawCanvas:$t.Bg,viewId:_this104.viewId});case 6:return _context79.a(3,13);case 7:_V9=!!Q.ops;if((L=Q.animationWorkData)!=null&&L.length){_tt9=Q.oldRect,g=Q.node.oldRect;_tt9&&((X=n.render)==null||X.push({rect:_tt9,isClear:!0,clearCanvas:$t.Bg,viewId:_this104.viewId}),(Y=n.render)==null||Y.push({rect:_tt9,drawCanvas:$t.Bg,viewId:_this104.viewId})),g&&((et=n.render)==null||et.push({rect:g,isClear:!0,clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}));T=(A=Q.node)==null?void 0:A.consumeService({op:Q.animationWorkData,isFullWork:_V9});Q.isEnableCursor?i.set(J,{cursorTool:Fn(Q.toolsType),workState:_tt9?Q.ops?te.Done:te.Doing:te.Start,op:Q.animationWorkData.slice(-3,-1)}):_V9&&!Q.useAnimation&&(w=Q.updateNodeOpt)!=null&&w.useAnimation&&i.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:Q.animationWorkData.slice(-3,-1),uid:(S=Q.updateNodeOpt)==null?void 0:S.uid}),_V9?(_this104.selectorWorkShapes.forEach(function(k,Z){var st;(st=k.selectIds)!=null&&st.includes(J)&&(_this104.willRunEffectSelectorIds.add(Z),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt9),_this104.noAnimationRect=Kt(_this104.noAnimationRect,g),_this104.noAnimationRect=Kt(_this104.noAnimationRect,T),_this104.runEffect());}),(x=Q.node)==null||x.clearTmpPoints(),_this104.workShapes.delete(J),(P=n.render)==null||P.push({rect:T,drawCanvas:$t.Bg,viewId:_this104.viewId})):(z=n.render)==null||z.push({rect:T,drawCanvas:$t.ServiceFloat,workerType:_V9?void 0:Qt.Service,viewId:_this104.viewId}),Q.animationWorkData.length=0;}return _context79.a(3,13);case 8:if(!Q.useAnimation){_context79.n=11;break;}if(!Q.useAnimation){_context79.n=10;break;}if(!Q.isDel){_context79.n=9;break;}(R=Q.node)==null||R.clearTmpPoints(),_this104.workShapes.delete(J);return _context79.a(3,13);case 9:_V0=3,_tt0=_this104.computNextAnimationIndex(Q,_V0),_g4=Q.isDiff?0:Math.max(0,(Q.animationIndex||0)-_V0),_T4=(Q.animationWorkData||[]).slice(0,_tt0),k=(_=($=Q.node)==null?void 0:$.getWorkId())==null?void 0:_.toString();if((Q.animationIndex||0)<_tt0||Q.isDiff){Z=(H=Q.node)==null?void 0:H.consumeService({op:_T4,isFullWork:!1,replaceId:k});if((lt=n.render)==null||lt.push({isClear:!0,rect:Z,clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}),(dt=n.render)==null||dt.push({rect:Z,drawCanvas:$t.ServiceFloat,viewId:_this104.viewId}),Q.animationIndex=_tt0,Q.isDiff&&(Q.isDiff=!1),_T4.length&&Q.isEnableCursor){st=_T4.slice(-3,-1);i.set(J,{cursorTool:Fn(Q.toolsType),workState:_g4===0?te.Start:_tt0===((wt=Q.animationWorkData)==null?void 0:wt.length)?te.Done:te.Doing,op:st});}}else if(Q.ops){_Z3=(Et=Q.node)==null?void 0:Et.consumeService({op:Q.animationWorkData||[],isFullWork:!0,replaceId:k});Q.isDel=!0,(Ot=n.render)==null||Ot.push({isClear:!0,rect:_Z3,clearCanvas:$t.ServiceFloat,viewId:_this104.viewId},{rect:_Z3,drawCanvas:$t.ServiceFloat,viewId:_this104.viewId},{isClear:!0,rect:_Z3,clearCanvas:$t.Bg,viewId:_this104.viewId},{rect:_Z3,drawCanvas:$t.Bg,viewId:_this104.viewId}),Q.isEnableCursor&&i.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T4.slice(-3,-1)});}e=!0;return _context79.a(3,13);case 10:_context79.n=12;break;case 11:_V1=!!Q.ops;_tt1=(U=Q.node)==null?void 0:U.consumeService({op:Q.animationWorkData||[],isFullWork:_V1,replaceId:J});_g5=(K=Q.node)==null?void 0:K.updataOptService(Q.updateNodeOpt);if(_V1){if(_tt1=Kt(_tt1,_g5),(j=n.render)==null||j.push({isClear:!0,rect:Kt(Q.oldRect,_tt1),clearCanvas:$t.Bg,viewId:_this104.viewId}),(nt=n.render)==null||nt.push({rect:Kt(Q.oldRect,_tt1),drawCanvas:$t.Bg,viewId:_this104.viewId}),(ct=Q.updateNodeOpt)!=null&&ct.useAnimation&&((B=n.render)==null||B.push({isClear:!0,rect:Kt(Q.oldRect,_tt1),clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}),(N=n.render)==null||N.push({rect:Kt(Q.oldRect,_tt1),drawCanvas:$t.ServiceFloat,viewId:_this104.viewId}),!Q.isEnableCursor&&(G=Q.animationWorkData)!=null&&G.length)){_T5=Q.animationWorkData.slice(-3,-1);i.set(J,{cursorTool:Fn(Q.toolsType),workState:te.Done,op:_T5,uid:(q=Q.updateNodeOpt)==null?void 0:q.uid});}_this104.selectorWorkShapes.forEach(function(T,k){var Z;(Z=T.selectIds)!=null&&Z.includes(J)&&(_this104.willRunEffectSelectorIds.add(k),_this104.noAnimationRect=Kt(_this104.noAnimationRect,_tt1),_this104.runEffect());}),(at=Q.node)==null||at.clearTmpPoints(),_this104.workShapes.delete(J);}else _tt1=Kt(_tt1,_g5),(ut=n.render)==null||ut.push({isClear:!0,rect:Kt(Q.oldRect,_tt1),clearCanvas:$t.ServiceFloat,viewId:_this104.viewId}),(Ct=n.render)==null||Ct.push({rect:Kt(Q.oldRect,_tt1),drawCanvas:$t.ServiceFloat,viewId:_this104.viewId});case 12:return _context79.a(3,13);case 13:return _context79.a(2);}},_loop7);});_iterator102.s();case 2:if((_step102=_iterator102.n()).done){_context80.n=4;break;}return _context80.d(_regeneratorValues(_loop7()),3);case 3:_context80.n=2;break;case 4:_context80.n=6;break;case 5:_context80.p=5;_t84=_context80.v;_iterator102.e(_t84);case 6:_context80.p=6;_iterator102.f();return _context80.f(6);case 7:e&&this.runAnimation();i.size&&(n.sp=n.sp||[],i.forEach(function(J,Q){var V;(V=n.sp)==null||V.push({type:Tt.Cursor,uid:J.uid||Q.split(Fo)[0],op:J.op,workState:J.workState,cursorTool:J.cursorTool,viewId:_this104.viewId});}));_t85=(O=n.render)!=null&&O.length||(D=n.sp)!=null&&D.length;if(!_t85){_context80.n=8;break;}_context80.n=8;return this.post(n);case 8:return _context80.a(2);}},_callee77,this,[[1,5,6,7]]);}));function animationDraw(){return _animationDraw3.apply(this,arguments);}return animationDraw;}()}]);}(qT);var KT=/*#__PURE__*/function(_zv3){function KT(e){var _this105;_classCallCheck(this,KT);_this105=_callSuper(this,KT,[e]);ht(_this105,"opt");ht(_this105,"scene");ht(_this105,"cameraOpt");ht(_this105,"vNodes");_this105.opt=e,_this105.vNodes=void 0;return _this105;}_inherits(KT,_zv3);return _createClass(KT,[{key:"reportRequestFailure",value:function reportRequestFailure(e,n,i,s){var o=i instanceof Error?i.message:String(i);try{this.thread._post({sp:[{type:Tt.ReportError,viewId:this.viewId,viewGeneration:this.thread.viewGeneration,scenePath:n.scenePath,requestId:n.requestId,reportBusiness:e,reportStage:s,reportError:o,reportString:"[SnapshotWork] ".concat(e," failed; stage=").concat(s,"; requestId=").concat(n.requestId||"unknown","; error=").concat(o)}]});}catch(a){console.error("[SnapshotWork] ".concat(e," failure report failed"),a);}}},{key:"createSnapshotFullLayer",value:function createSnapshotFullLayer(e,n){this.scene=this.opt.createScene(e),this.fullLayer=this.opt.createLayer("snapshotFullLayer",this.scene,n);}},{key:"destroySnapshotFullLayer",value:function destroySnapshotFullLayer(){var e,n,i;Kr(this.fullLayer,this.fullLayer.parent),(e=this.fullLayer)==null||e.disconnect(),(n=this.fullLayer)==null||n.remove(),(i=this.scene)==null||i.remove(),this.scene=void 0;}},{key:"updateScene",value:function updateScene(e){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");this.scene.attr(_objectSpread({},e));var n=e.width,i=e.height;this.scene.width=n,this.scene.height=i,this.updateLayer({width:n,height:i});}},{key:"updateLayer",value:function updateLayer(e){if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");var n=e.width,i=e.height;this.fullLayer.parent.setAttribute("width",n),this.fullLayer.parent.setAttribute("height",i),this.fullLayer.setAttribute("size",[n,i]),this.fullLayer.setAttribute("pos",[n*0.5,i*0.5]);}},{key:"setCameraOpt",value:function setCameraOpt(e){this.cameraOpt=e;var n=e.scale,i=e.centerX,s=e.centerY,o=e.width,a=e.height;if(!this.scene)throw new Error("SnapshotWork scene is not initialized");if(!this.fullLayer)throw new Error("SnapshotWork snapshotFullLayer is not initialized");(o!==this.scene.width||a!==this.scene.height)&&this.updateScene({width:o,height:a}),this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-i,-s]);}},{key:"getOffscreen",value:function getOffscreen(){var n;return((n=this.fullLayer)==null?void 0:n.parent).canvas;}},{key:"getRectImageBitmap",value:function getRectImageBitmap(e,n){var i=e.rect,s=this.thread.dpr,o=Math.floor(i.x*s),a=Math.floor(i.y*s),u=Math.floor(i.w*s),h=Math.floor(i.h*s);return createImageBitmap(this.getOffscreen(),o,a,u,h,n);}},{key:"getSnapshot",value:function(){var _getSnapshot=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee78(e){var n,i,s,o,a,u,_i12,_Object$entries,_Object$entries$_i,v,p,y,C,h,_t86,_t87;return _regenerator().w(function(_context81){while(1)switch(_context81.p=_context81.n){case 0:n=e.scenePath,i=e.scenes,s=e.cameraOpt,o=e.w,a=e.h,u=e.requestId;_context81.p=1;if(n&&i&&s&&this.fullLayer){_context81.n=2;break;}throw new Error("snapshot input is incomplete");case 2:this.setCameraOpt(s);_i12=0,_Object$entries=Object.entries(i);case 3:if(!(_i12<_Object$entries.length)){_context81.n=8;break;}_Object$entries$_i=_slicedToArray(_Object$entries[_i12],2),v=_Object$entries$_i[0],p=_Object$entries$_i[1];if(!(p!=null&&p.type)){_context81.n=7;break;}_t86=p==null?void 0:p.type;_context81.n=_t86===Tt.UpdateNode?4:_t86===Tt.FullWork?4:6;break;case 4:y=p.opt,C=_objectSpread(_objectSpread({},p),{},{opt:y,workId:v,msgType:Tt.FullWork,dataType:Qt.Service,viewId:this.viewId,requestId:u});_context81.n=5;return this.runFullWork(C);case 5:return _context81.a(3,7);case 6:return _context81.a(3,7);case 7:_i12++;_context81.n=3;break;case 8:o&&a&&(h={resizeWidth:o,resizeHeight:a});_context81.n=9;return this.getSnapshotRender({scenePath:n,options:h,requestId:u});case 9:_context81.n=11;break;case 10:_context81.p=10;_t87=_context81.v;this.reportRequestFailure("snapshot",e,_t87,"render");case 11:return _context81.a(2);}},_callee78,this,[[1,10]]);}));function getSnapshot(_x131){return _getSnapshot.apply(this,arguments);}return getSnapshot;}()},{key:"runFullWork",value:function(){var _runFullWork=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee79(e){var s,n,i,o,a,u;return _regenerator().w(function(_context82){while(1)switch(_context82.n){case 0:n=this.setFullWork(e),i=e.ops&&ks(e.ops);if(!n){_context82.n=7;break;}u=(s=n.getWorkId())==null?void 0:s.toString();if(!(n.toolsType===St.BackgroundSVG)){_context82.n=1;break;}o=n.consumeService({isFullWork:!0,replaceId:u});_context82.n=6;break;case 1:if(!(n.toolsType===St.Image)){_context82.n=3;break;}_context82.n=2;return n.consumeServiceAsync({isFullWork:!0,worker:this.thread,requestId:e.requestId});case 2:o=_context82.v;_context82.n=6;break;case 3:if(!(n.toolsType===St.Text)){_context82.n=5;break;}_context82.n=4;return n.consumeServiceAsync({isFullWork:!0,replaceId:u,isDrawLabel:!0});case 4:o=_context82.v;_context82.n=6;break;case 5:o=n.consumeService({op:i,isFullWork:!0,replaceId:u}),a=(e==null?void 0:e.updateNodeOpt)&&n.updataOptService(e.updateNodeOpt);case 6:e.workId&&this.workShapes.delete(e.workId.toString());return _context82.a(2,Kt(o,a));case 7:return _context82.a(2);}},_callee79,this);}));function runFullWork(_x132){return _runFullWork.apply(this,arguments);}return runFullWork;}()},{key:"getSceneRect",value:function getSceneRect(){if(!this.scene)throw new Error("SnapshotWork scene is not initialized");var _this$scene2=this.scene,e=_this$scene2.width,n=_this$scene2.height;return{x:0,y:0,w:Math.floor(e),h:Math.floor(n)};}},{key:"getSnapshotRender",value:function(){var _getSnapshotRender=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee80(e){var a,n,i,s,o;return _regenerator().w(function(_context83){while(1)switch(_context83.n){case 0:n=e.scenePath,i=e.options,s=e.requestId;((a=this.fullLayer)==null?void 0:a.parent).render();_context83.n=1;return this.getRectImageBitmap({rect:this.getSceneRect(),drawCanvas:$t.None},i);case 1:o=_context83.v;o&&(this.thread._post({sp:[{type:Tt.Snapshot,scenePath:n,imageBitmap:o,viewId:this.viewId,index:0,requestId:s}]},[o]),o.close());case 2:return _context83.a(2);}},_callee80,this);}));function getSnapshotRender(_x133){return _getSnapshotRender.apply(this,arguments);}return getSnapshotRender;}()},{key:"getBoundingRect",value:function(){var _getBoundingRect=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee81(e){var n,i,s,o,a,_i13,_Object$entries2,_Object$entries2$_i,u,h,v,_t88,_t89;return _regenerator().w(function(_context84){while(1)switch(_context84.p=_context84.n){case 0:n=e.scenePath,i=e.scenes,s=e.cameraOpt,o=e.requestId;_context84.p=1;if(n&&i&&s&&this.fullLayer){_context84.n=2;break;}throw new Error("bounding-box input is incomplete");case 2:this.setCameraOpt(s);_i13=0,_Object$entries2=Object.entries(i);case 3:if(!(_i13<_Object$entries2.length)){_context84.n=8;break;}_Object$entries2$_i=_slicedToArray(_Object$entries2[_i13],2),u=_Object$entries2$_i[0],h=_Object$entries2$_i[1];if(!(h!=null&&h.type)){_context84.n=7;break;}_t88=h==null?void 0:h.type;_context84.n=_t88===Tt.UpdateNode?4:_t88===Tt.FullWork?4:6;break;case 4:_context84.n=5;return this.runFullWork(_objectSpread(_objectSpread({},h),{},{workId:u,msgType:Tt.FullWork,dataType:Qt.Service,viewId:this.viewId,requestId:o}));case 5:v=_context84.v;a=Kt(a,v);return _context84.a(3,7);case 6:return _context84.a(3,7);case 7:_i13++;_context84.n=3;break;case 8:a?this.thread._post({sp:[{type:Tt.BoundingBox,scenePath:n,rect:a,viewId:this.viewId,requestId:o}]}):this.thread._post({sp:[{type:Tt.BoundingBox,scenePath:n,rect:{x:0,y:0,w:0,h:0},viewId:this.viewId,viewGeneration:this.thread.viewGeneration,requestId:o}]});_context84.n=10;break;case 9:_context84.p=9;_t89=_context84.v;this.reportRequestFailure("bounding-box",e,_t89,"compute");case 10:return _context84.a(2);}},_callee81,this,[[1,9]]);}));function getBoundingRect(_x134){return _getBoundingRect.apply(this,arguments);}return getBoundingRect;}()}]);}(zv);var yMt="WEBGL_PROGRAM_UNAVAILABLE";function wMt(r){return typeof r=="string"&&r.includes("No avaliable program");}var Eu=/* @__PURE__ */function(r){return r.Full="full",r.Sub="sub",r;}(Eu||{});function QT(r,t){var e=r==null?void 0:r.canvas,n=t.width,i=t.height,s=e==null?void 0:e.width,o=e==null?void 0:e.height;if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||typeof s!="number"||typeof o!="number"||!Number.isFinite(s)||!Number.isFinite(o)||s<=0||o<=0||n!==s||i!==o){try{t.close();}catch(_unused38){}throw new Error("FullLayer ImageBitmap size mismatch: bitmap=".concat(n,"x").concat(i,"; layer=").concat(s!==null&&s!==void 0?s:"unavailable","x").concat(o!==null&&o!==void 0?o:"unavailable"));}}function JT(r,t,e){var n=[],i=/* @__PURE__ */new Map();var _iterator103=_createForOfIteratorHelper(r),_step103;try{for(_iterator103.s();!(_step103=_iterator103.n()).done;){var s=_step103.value;if(!s.rect)continue;var o=lAt(gr(s.rect),t,e);if(!o)continue;s.rect=o;var a=n.push(s)-1;if(s.drawCanvas!==$t.Bg||o.w<=0||o.h<=0)continue;var h=i.get(s.drawCanvas)||{rect:o,lastIndex:a,workIds:/* @__PURE__ */new Set(),eraseTxnIds:/* @__PURE__ */new Set()};h.rect=Kt(h.rect,o),h.lastIndex=a;var _iterator104=_createForOfIteratorHelper(s.renderWorkIds||[]),_step104;try{for(_iterator104.s();!(_step104=_iterator104.n()).done;){var v=_step104.value;h.workIds.add(v);}}catch(err){_iterator104.e(err);}finally{_iterator104.f();}s.workId!==void 0&&h.workIds.add(s.workId.toString());var _iterator105=_createForOfIteratorHelper(s.renderEraseTxnIds||[]),_step105;try{for(_iterator105.s();!(_step105=_iterator105.n()).done;){var _v12=_step105.value;h.eraseTxnIds.add(_v12);}}catch(err){_iterator105.e(err);}finally{_iterator105.f();}s.eraseTxnId!==void 0&&h.eraseTxnIds.add(s.eraseTxnId),i.set(s.drawCanvas,h);}}catch(err){_iterator103.e(err);}finally{_iterator103.f();}return n.filter(function(s,o){if(s.drawCanvas!==$t.Bg)return!0;var a=i.get(s.drawCanvas);return!a||a.lastIndex!==o?!1:(s.rect=a.rect,s.renderWorkIds=a.workIds.size?_toConsumableArray(a.workIds):void 0,s.renderEraseTxnIds=a.eraseTxnIds.size?_toConsumableArray(a.eraseTxnIds):void 0,!0);});}var SMt=/*#__PURE__*/function(){function SMt(t,e,n){var _this106=this;_classCallCheck(this,SMt);ht(this,"_self");ht(this,"version",Q2);ht(this,"type");ht(this,"createEngine");// protected hasPriorityDraw: boolean = true;
|
|
489
|
+
ht(this,"workThreadMap",/* @__PURE__ */new Map());ht(this,"cameraRenderQueueByView",/* @__PURE__ */new Map());ht(this,"viewGenerationById",/* @__PURE__ */new Map());ht(this,"retainedOffscreenProbeCapabilities");ht(this,"cancelledFontFaceRequests",/* @__PURE__ */new Map());ht(this,"fontFaceRequestCancelers",/* @__PURE__ */new Map());ht(this,"post",function(t,e){t.viewId&&t.viewGeneration===void 0&&(t.viewGeneration=_this106.viewGenerationById.get(t.viewId)),e?_this106._self.postMessage(t,e):_this106._self.postMessage(t);});this._self=t,this.type=e,this.createEngine=n,this.register();}return _createClass(SMt,[{key:"consumeRendererBusinessFailure",value:function consumeRendererBusinessFailure(t,e){return Ws(e)?(e.reported||(e.reported=!0,this.post({sp:[{type:Tt.ReportError,viewId:t,reportString:WT(e,{business:"renderer-task",stage:"worker"},{viewId:t,renderer:this.type})}]})),!0):!1;}},{key:"enqueueViewTask",value:function enqueueViewTask(t,e){var i=(this.cameraRenderQueueByView.get(t)||Promise.resolve()).catch(function(){}).then(e);return this.cameraRenderQueueByView.set(t,i),i;}},{key:"isStaleViewMessage",value:function isStaleViewMessage(t){if(!t.viewId||t.viewId===Uy||t.viewGeneration===void 0)return!1;var e=this.viewGenerationById.get(t.viewId);return e!==void 0&&t.viewGeneration<e;}},{key:"init",value:function(){var _init=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee83(t){var _this107=this;var e,n,i,s,o,_t90;return _regenerator().w(function(_context86){while(1)switch(_context86.n){case 0:e=t.viewId,n=t.dpr,i=t.offscreenCanvasOpt,s=t.layerOpt,o=t.isSafari;_t90=!n||!i||!s;if(_t90){_context86.n=1;break;}_context86.n=1;return this.enqueueViewTask(e,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee82(){var _t$viewGeneration;var a,u,h,v;return _regenerator().w(function(_context85){while(1)switch(_context85.n){case 0:a=(_t$viewGeneration=t.viewGeneration)!==null&&_t$viewGeneration!==void 0?_t$viewGeneration:(_this107.viewGenerationById.get(e)||0)+1,u=_this107.viewGenerationById.get(e);if(!(u!==void 0&&a<u)){_context85.n=1;break;}return _context85.a(2);case 1:_this107.viewGenerationById.set(e,a);h=_this107.createEngine(t,_this107.post);h&&o&&h.setIsSafari(o),h&&t.cameraOpt&&h.setCameraOpt(t.cameraOpt);v=_this107.workThreadMap.get(e);v==null||v.destroy(),h&&_this107.workThreadMap.set(e,h);case 2:return _context85.a(2);}},_callee82);})));case 1:return _context86.a(2);}},_callee83,this);}));function init(_x135){return _init.apply(this,arguments);}return init;}()},{key:"getFontFaceCssValue",value:function getFontFaceCssValue(t){return"12px \"".concat(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),"\"");}},{key:"isFontFaceRequestCancelled",value:function isFontFaceRequestCancelled(t){return!!t&&this.cancelledFontFaceRequests.has(t);}},{key:"cancelFontFaceRequest",value:function cancelFontFaceRequest(t){var _this108=this;if(!t)return;var e=this.cancelledFontFaceRequests.get(t);e&&clearTimeout(e);var n=setTimeout(function(){_this108.cancelledFontFaceRequests.get(t)===n&&_this108.cancelledFontFaceRequests.delete(t);},6e4);this.cancelledFontFaceRequests.set(t,n);var _iterator106=_createForOfIteratorHelper(this.fontFaceRequestCancelers.get(t)||[]),_step106;try{for(_iterator106.s();!(_step106=_iterator106.n()).done;){var i=_step106.value;i();}}catch(err){_iterator106.e(err);}finally{_iterator106.f();}}},{key:"clearFontFaceRequestCancellation",value:function clearFontFaceRequestCancellation(t){if(!t)return;var e=this.cancelledFontFaceRequests.get(t);e&&clearTimeout(e),this.cancelledFontFaceRequests.delete(t),this.fontFaceRequestCancelers.delete(t);}},{key:"waitForFontFacePromise",value:function waitForFontFacePromise(t,e,n,i){var _this109=this;return new Promise(function(s,o){var a=!1,u;var h=function h(){return v(o,new Error("Font face request cancelled"));},v=function v(p,y){if(a)return;a=!0,u&&clearTimeout(u);var C=e?_this109.fontFaceRequestCancelers.get(e):void 0;C==null||C.delete(h),C&&C.size===0&&e&&_this109.fontFaceRequestCancelers.delete(e),p(y);};if(e&&_this109.isFontFaceRequestCancelled(e)){h();return;}if(e){var p=_this109.fontFaceRequestCancelers.get(e);p||(p=/* @__PURE__ */new Set(),_this109.fontFaceRequestCancelers.set(e,p)),p.add(h);}n!==void 0&&(u=setTimeout(function(){return v(o,new Error(i||"Font face load timeout"));},n)),Promise.resolve(t).then(function(p){return v(s,p);},function(p){return v(o,p);});});}},{key:"setFontFaces",value:function(){var _setFontFaces=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee84(t,e){var i,s,n,_iterator107,_step107,o,a,u,h,v,y,p,_t91,_t92,_t93,_t94,_t95;return _regenerator().w(function(_context87){while(1)switch(_context87.p=_context87.n){case 0:n=[];_context87.p=1;_iterator107=_createForOfIteratorHelper(t);_context87.p=2;_iterator107.s();case 3:if((_step107=_iterator107.n()).done){_context87.n=28;break;}o=_step107.value;a=o.fontFamily,u=o.buffer;h=void 0,v=!1;_context87.p=4;if(!this.isFontFaceRequestCancelled(e)){_context87.n=5;break;}return _context87.a(2);case 5:if(!(!u||u.byteLength===0)){_context87.n=6;break;}throw new Error("Invalid font data for ".concat(a,": empty buffer"));case 6:try{h=new FontFace(a,u);}catch(_unused39){y=new Uint8Array(u);h=new FontFace(a,y);}p=this._self.fonts;if(p){_context87.n=7;break;}throw new Error("Worker FontFaceSet is unavailable");case 7:_context87.n=8;return this.waitForFontFacePromise(h.load(),e);case 8:if(!this.isFontFaceRequestCancelled(e)){_context87.n=9;break;}return _context87.a(2);case 9:p.add(h),v=!0;_context87.p=10;_context87.n=11;return this.waitForFontFacePromise(h.loaded,e);case 11:_context87.n=23;break;case 12:_context87.p=12;_t91=_context87.v;if(!this.isFontFaceRequestCancelled(e)){_context87.n=13;break;}return _context87.a(2);case 13:if(!(typeof p.load=="function")){_context87.n=21;break;}_context87.p=14;_context87.n=15;return this.waitForFontFacePromise(p.load(this.getFontFaceCssValue(a)),e,5e3,"Font load timeout for ".concat(a));case 15:_t92=_context87.v.length;if(!(_t92===0)){_context87.n=16;break;}throw new Error("Font ".concat(a," load returned empty result"));case 16:_context87.n=20;break;case 17:_context87.p=17;_t93=_context87.v;if(!this.isFontFaceRequestCancelled(e)){_context87.n=18;break;}return _context87.a(2);case 18:_context87.n=19;return this.isFontAvailable(a,e);case 19:if(_context87.v){_context87.n=20;break;}throw _t93;case 20:_context87.n=23;break;case 21:_context87.n=22;return this.isFontAvailable(a,e);case 22:if(_context87.v){_context87.n=23;break;}throw _t91;case 23:_context87.n=26;break;case 24:_context87.p=24;_t94=_context87.v;if(!this.isFontFaceRequestCancelled(e)){_context87.n=25;break;}return _context87.a(2);case 25:console.error("Font ".concat(a," load error: ").concat(_t94)),n.push(a);case 26:_context87.p=26;if(this.isFontFaceRequestCancelled(e)&&v&&h)try{(s=(i=this._self.fonts)==null?void 0:i.delete)==null||s.call(i,h);}catch(_unused40){}return _context87.f(26);case 27:_context87.n=3;break;case 28:_context87.n=30;break;case 29:_context87.p=29;_t95=_context87.v;_iterator107.e(_t95);case 30:_context87.p=30;_iterator107.f();return _context87.f(30);case 31:if(!this.isFontFaceRequestCancelled(e)){_context87.n=32;break;}return _context87.a(2);case 32:this.post({sp:[{type:Tt.SetFontFace,requestId:e,setFontFaceResult:n.length===0,failedFonts:n.length>0?n:void 0}]});case 33:_context87.p=33;this.clearFontFaceRequestCancellation(e);return _context87.f(33);case 34:return _context87.a(2);}},_callee84,this,[[14,17],[10,12],[4,24,26,27],[2,29,30,31],[1,,33,34]]);}));function setFontFaces(_x136,_x137){return _setFontFaces.apply(this,arguments);}return setFontFaces;}()// 检查字体是否可用
|
|
490
|
+
},{key:"isFontAvailable",value:function(){var _isFontAvailable=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee85(t,e){var n,i,s,_iterator108,_step108,o,_t96,_t97,_t98,_t99,_t100;return _regenerator().w(function(_context88){while(1)switch(_context88.p=_context88.n){case 0:_context88.p=0;if(!this.isFontFaceRequestCancelled(e)){_context88.n=1;break;}return _context88.a(2,!1);case 1:n=this._self.fonts;if(n){_context88.n=2;break;}return _context88.a(2,!1);case 2:i=!1,s=null;_iterator108=_createForOfIteratorHelper(n);_context88.p=3;_iterator108.s();case 4:if((_step108=_iterator108.n()).done){_context88.n=6;break;}o=_step108.value;if(!(o.family===t)){_context88.n=5;break;}i=!0,s=o;return _context88.a(3,6);case 5:_context88.n=4;break;case 6:_context88.n=8;break;case 7:_context88.p=7;_t96=_context88.v;_iterator108.e(_t96);case 8:_context88.p=8;_iterator108.f();return _context88.f(8);case 9:if(!(!i||!s)){_context88.n=10;break;}return _context88.a(2,!1);case 10:if(!(s.status==="loaded")){_context88.n=11;break;}return _context88.a(2,!0);case 11:_context88.p=11;_context88.n=12;return this.waitForFontFacePromise(s.loaded,e);case 12:return _context88.a(2,!0);case 13:_context88.p=13;_t97=_context88.v;if(!this.isFontFaceRequestCancelled(e)){_context88.n=14;break;}return _context88.a(2,!1);case 14:if(!(n&&typeof n.load=="function")){_context88.n=18;break;}_context88.p=15;_context88.n=16;return this.waitForFontFacePromise(n.load(this.getFontFaceCssValue(t)),e,5e3,"Font load timeout for ".concat(t));case 16:_t98=_context88.v.length;return _context88.a(2,_t98>0);case 17:_context88.p=17;_t99=_context88.v;return _context88.a(2,!1);case 18:return _context88.a(2,!0);case 19:_context88.n=21;break;case 20:_context88.p=20;_t100=_context88.v;return _context88.a(2,!1);case 21:return _context88.a(2);}},_callee85,this,[[15,17],[11,13],[3,7,8,9],[0,20]]);}));function isFontAvailable(_x138,_x139){return _isFontAvailable.apply(this,arguments);}return isFontAvailable;}()},{key:"areFontFacesAvailable",value:function(){var _areFontFacesAvailable=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee86(){var t,e,_iterator109,_step109,n,_args89=arguments,_t101,_t102;return _regenerator().w(function(_context89){while(1)switch(_context89.p=_context89.n){case 0:t=_args89.length>0&&_args89[0]!==undefined?_args89[0]:[];e=_args89.length>1?_args89[1]:undefined;_iterator109=_createForOfIteratorHelper(t);_context89.p=1;_iterator109.s();case 2:if((_step109=_iterator109.n()).done){_context89.n=6;break;}n=_step109.value;_t101=this.isFontFaceRequestCancelled(e);if(_t101){_context89.n=4;break;}_context89.n=3;return this.isFontAvailable(n.fontFamily,e);case 3:_t101=!_context89.v;case 4:if(!_t101){_context89.n=5;break;}return _context89.a(2,!1);case 5:_context89.n=2;break;case 6:_context89.n=8;break;case 7:_context89.p=7;_t102=_context89.v;_iterator109.e(_t102);case 8:_context89.p=8;_iterator109.f();return _context89.f(8);case 9:return _context89.a(2,!0);}},_callee86,this,[[1,7,8,9]]);}));function areFontFacesAvailable(){return _areFontFacesAvailable.apply(this,arguments);}return areFontFacesAvailable;}()},{key:"register",value:function register(){var _this110=this;this._self.onmessage=/*#__PURE__*/function(){var _ref86=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee91(t){var n,i,s,o,a,e,u,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_loop8,_ret,_iterator,_step,_t110;return _regenerator().w(function(_context96){while(1)switch(_context96.p=_context96.n){case 0:e=t.data;if(!e){_context96.n=14;break;}u=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context96.p=1;_loop8=/*#__PURE__*/_regenerator().m(function _loop8(){var h,v,p,y,C,b,M,L,X,A,_A6,w,S,x,P,_A7,_A8,_w5,_A9,_w6,_S4,_x141,z,U,_x141$elapsedMs,_A0,_iterator110,_step110,_loop9,_A1,Y,et,_t106,_t107,_t108,_t109;return _regenerator().w(function(_context95){while(1)switch(_context95.p=_context95.n){case 0:h=_step.value;v=h.msgType,p=h.viewId,y=h.tasksqueue,C=h.mainTasksqueueCount,b=h.cameraTaskId,M=h.fontBuffers,L=h.fontFaces,X=h.requestId;if(!_this110.isStaleViewMessage(h)){_context95.n=1;break;}try{(n=h.imageBitmap)==null||n.close();}catch(_unused44){}return _context95.a(2,0);case 1:if(!(v===Tt.CancelFontFace)){_context95.n=2;break;}_this110.cancelFontFaceRequest(X);return _context95.a(2,0);case 2:if(!(v===Tt.CheckFontFace)){_context95.n=5;break;}_context95.n=3;return _this110.areFontFacesAvailable(L,X);case 3:A=_context95.v;if(!_this110.isFontFaceRequestCancelled(X)){_context95.n=4;break;}_this110.clearFontFaceRequestCancellation(X);return _context95.a(2,0);case 4:_this110.post({sp:[{type:Tt.CheckFontFace,requestId:X,fontFaceCheckResult:A}]}),_this110.clearFontFaceRequestCancellation(X);return _context95.a(2,0);case 5:if(!(v===Tt.ProbeRenderCapabilities)){_context95.n=9;break;}_this110.retainedOffscreenProbeCapabilities&&(zd(_this110.retainedOffscreenProbeCapabilities),_this110.retainedOffscreenProbeCapabilities=void 0);_A6=h.requestedContextType;w=h.probeTransport==="worker-image-bitmap";if(!w){_context95.n=7;break;}_context95.n=6;return RAt(_A6,h.probeProfile);case 6:_t106=_context95.v;_context95.n=8;break;case 7:_t106=LAt(_A6,h.probeCanvas,h.probeProfile);case 8:S=_t106;x=(i=S.programProbe)==null?void 0:i.imageBitmap;P={type:Tt.ProbeRenderCapabilities,workerCapabilities:S,requestId:X};try{try{_this110._self.postMessage(P,x?[x]:[]);}catch(z){try{x==null||x.close();}catch(_unused45){}_this110._self.postMessage({type:Tt.ProbeRenderCapabilities,requestId:X,workerCapabilities:_objectSpread(_objectSpread({},S),{},{contextSupported:!1,programProbe:_objectSpread(_objectSpread({},S.programProbe),{},{passed:!1,stage:"transfer-image-bitmap",error:z instanceof Error?z.message:String(z),imageBitmap:void 0})})});}}finally{w?zd(S):(s=S.programProbe)!=null&&s.passed?_this110.retainedOffscreenProbeCapabilities=S:zd(S);}return _context95.a(2,0);case 9:if(!M){_context95.n=10;break;}_this110.setFontFaces(M,X);return _context95.a(2,0);case 10:if(!(v===Tt.Console)){_context95.n=11;break;}console.log(_this110);return _context95.a(2,0);case 11:if(!(v===Tt.Init)){_context95.n=13;break;}_context95.n=12;return _this110.init(h);case 12:_A7=(o=_this110.workThreadMap.get(p))==null?void 0:o.getActualContextType();_this110.type==="full"&&_this110.post({sp:[{type:Tt.Init,viewId:p,viewGeneration:h.viewGeneration,reportContextType:_A7}]});return _context95.a(2,0);case 13:if(!(v===Tt.GetImageBitMap)){_context95.n=18;break;}_A8=_this110.workThreadMap.get(p),_w5=_this110.viewGenerationById.get(p);if(!(!_A8||h.viewGeneration!==void 0&&h.viewGeneration!==_w5||_this110.workThreadMap.get(p)!==_A8)){_context95.n=14;break;}try{(a=h.imageBitmap)==null||a.close();}catch(_unused46){}return _context95.a(2,0);case 14:_context95.p=14;_context95.n=15;return _A8.on(h);case 15:_context95.n=17;break;case 16:_context95.p=16;_t107=_context95.v;if(_this110.consumeRendererBusinessFailure(p,_t107)){_context95.n=17;break;}throw _t107;case 17:return _context95.a(2,0);case 18:if(!(v===Tt.UpdateTools||Tt.CreateWork,v===Tt.TasksQueue&&y!=null&&y.size)){_context95.n=26;break;}_A9=y.get(p),_w6=_this110.workThreadMap.get(p),_S4=_this110.viewGenerationById.get(p);if(!(_A9&&_w6)){_context95.n=24;break;}_context95.p=19;_context95.n=20;return _this110.enqueueViewTask(p,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee87(){var _t103;return _regenerator().w(function(_context90){while(1)switch(_context90.n){case 0:_t103=_this110.viewGenerationById.get(p)!==_S4||_this110.workThreadMap.get(p)!==_w6;if(_t103){_context90.n=1;break;}_context90.n=1;return _w6.on(_A9);case 1:return _context90.a(2);}},_callee87);})));case 20:_context95.n=24;break;case 21:_context95.p=21;_t108=_context95.v;if(!(_A9.msgType!==Tt.UpdateCamera)){_context95.n=23;break;}if(!_this110.consumeRendererBusinessFailure(p,_t108)){_context95.n=22;break;}return _context95.a(2,0);case 22:throw _t108;case 23:z=TAt(_t108),U=Ws(_t108)?_t108:void 0;_x141={code:z?"RENDERER_BUSINESS_TIMEOUT":"RENDERER_BUSINESS_ERROR",business:"updateCamera",message:_t108 instanceof Error?_t108.message:String(_t108),elapsedMs:z?_t108.elapsedMs:void 0,stage:z?_t108.stage:(U==null?void 0:U.stage)||"update-camera",blockingWorks:z?_t108.blockingWorks:void 0,workerType:_this110.type};case 24:if(!(_x141&&$e(b))){_context95.n=25;break;}_this110.type==="full"?_this110.post({viewId:p,viewGeneration:_S4,cameraTaskId:b,cameraTaskStatus:_x141.code==="RENDERER_BUSINESS_TIMEOUT"?"timeout":"failed",cameraTaskError:_x141}):_this110.post({sp:[{type:Tt.ReportError,viewId:p,reportString:"[updateCamera] ".concat(_x141.code," viewId=").concat(p," taskId=").concat(b," stage=").concat(_x141.stage," elapsedMs=").concat((_x141$elapsedMs=_x141.elapsedMs)!==null&&_x141$elapsedMs!==void 0?_x141$elapsedMs:0," error=").concat(_x141.message)}]});return _context95.a(2,0);case 25:_this110.type==="full"&&$e(C)&&$e(b)&&_this110.post({workerTasksqueueCount:C,cameraTaskId:b,viewId:p,viewGeneration:_S4});return _context95.a(2,0);case 26:if(!(p===Uy)){_context95.n=34;break;}_A0=_toConsumableArray(_this110.workThreadMap.entries());_iterator110=_createForOfIteratorHelper(_A0);_context95.p=27;_loop9=/*#__PURE__*/_regenerator().m(function _loop9(){var _step110$value,w,S,x;return _regenerator().w(function(_context92){while(1)switch(_context92.n){case 0:_step110$value=_slicedToArray(_step110.value,2),w=_step110$value[0],S=_step110$value[1];x=_this110.enqueueViewTask(w,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee88(){var _t104;return _regenerator().w(function(_context91){while(1)switch(_context91.p=_context91.n){case 0:if(!(v===Tt.Destroy)){_context91.n=1;break;}_this110.workThreadMap.get(w)===S&&(S.destroy(),_this110.workThreadMap.delete(w),_this110.viewGenerationById.set(w,(_this110.viewGenerationById.get(w)||0)+1));return _context91.a(2);case 1:if(!(_this110.workThreadMap.get(w)===S)){_context91.n=5;break;}_context91.p=2;_context91.n=3;return S.on(h);case 3:_context91.n=5;break;case 4:_context91.p=4;_t104=_context91.v;if(_this110.consumeRendererBusinessFailure(w,_t104)){_context91.n=5;break;}throw _t104;case 5:return _context91.a(2);}},_callee88,null,[[2,4]]);})));_context92.n=1;return x;case 1:_this110.cameraRenderQueueByView.get(w)===x&&_this110.cameraRenderQueueByView.delete(w);case 2:return _context92.a(2);}},_loop9);});_iterator110.s();case 28:if((_step110=_iterator110.n()).done){_context95.n=30;break;}return _context95.d(_regeneratorValues(_loop9()),29);case 29:_context95.n=28;break;case 30:_context95.n=32;break;case 31:_context95.p=31;_t109=_context95.v;_iterator110.e(_t109);case 32:_context95.p=32;_iterator110.f();return _context95.f(32);case 33:return _context95.a(2,0);case 34:if(!(v===Tt.Destroy)){_context95.n=36;break;}_A1=_this110.enqueueViewTask(p,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee89(){var _h$viewGeneration;var w;return _regenerator().w(function(_context93){while(1)switch(_context93.n){case 0:w=_this110.workThreadMap.get(p);w==null||w.destroy(),_this110.workThreadMap.delete(p),_this110.viewGenerationById.set(p,(_h$viewGeneration=h.viewGeneration)!==null&&_h$viewGeneration!==void 0?_h$viewGeneration:(_this110.viewGenerationById.get(p)||0)+1);case 1:return _context93.a(2);}},_callee89);})));_context95.n=35;return _A1;case 35:_this110.cameraRenderQueueByView.get(p)===_A1&&_this110.cameraRenderQueueByView.delete(p);return _context95.a(2,0);case 36:Y=_this110.workThreadMap.get(p);if(Y){_context95.n=37;break;}return _context95.a(2,0);case 37:et=_this110.viewGenerationById.get(p);u.push(_this110.enqueueViewTask(p,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee90(){var _t105;return _regenerator().w(function(_context94){while(1)switch(_context94.p=_context94.n){case 0:if(_this110.viewGenerationById.get(p)!==et||_this110.workThreadMap.get(p)!==Y){_context94.n=4;break;}_context94.p=1;_context94.n=2;return Y.on(h);case 2:_context94.n=4;break;case 3:_context94.p=3;_t105=_context94.v;if(_this110.consumeRendererBusinessFailure(p,_t105)){_context94.n=4;break;}throw _t105;case 4:return _context94.a(2);}},_callee90,null,[[1,3]]);}))));case 38:return _context95.a(2);}},_loop8,null,[[27,31,32,33],[19,21],[14,16]]);});_iterator=_asyncIterator(e.values());case 2:_context96.n=3;return _iterator.next();case 3:if(!(_iteratorAbruptCompletion=!(_step=_context96.v).done)){_context96.n=6;break;}return _context96.d(_regeneratorValues(_loop8()),4);case 4:_ret=_context96.v;if(!(_ret===0)){_context96.n=5;break;}return _context96.a(3,5);case 5:_iteratorAbruptCompletion=false;_context96.n=2;break;case 6:_context96.n=8;break;case 7:_context96.p=7;_t110=_context96.v;_didIteratorError=true;_iteratorError=_t110;case 8:_context96.p=8;_context96.p=9;if(!(_iteratorAbruptCompletion&&_iterator.return!=null)){_context96.n=10;break;}_context96.n=10;return _iterator.return();case 10:_context96.p=10;if(!_didIteratorError){_context96.n=11;break;}throw _iteratorError;case 11:return _context96.f(10);case 12:return _context96.f(8);case 13:_context96.n=14;return Promise.all(u);case 14:return _context96.a(2);}},_callee91,null,[[9,,10,12],[1,7,8,13]]);}));return function(_x140){return _ref86.apply(this,arguments);};}();}}]);}();var TMt=/*#__PURE__*/function(_GT){function TMt(e,n,i){var _this111;_classCallCheck(this,TMt);_this111=_callSuper(this,TMt,[e,n,"sub"/* Sub */]);ht(_this111,"type","sub");ht(_this111,"_post");ht(_this111,"topLayer");ht(_this111,"serviceWork");ht(_this111,"localWork");ht(_this111,"topLayerWork");ht(_this111,"snapshotWork");ht(_this111,"fullLayerFrameSequence",0);_this111._post=i;var s=Jr.bufferSize.sub;_this111.topLayer=n.isUseSimple?void 0:_this111.createLayer("topLayer",_this111.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:s,contextType:"2d"}));var o={thread:_this111,viewId:_this111.viewId,vNodes:_this111.vNodes,fullLayer:_this111.fullLayer,topLayer:_this111.topLayer,isUseSimple:n.isUseSimple};_this111.localWork=new pMt(o),n.isUseSimple||(_this111.topLayerWork=new vMt(o)),_this111.snapshotWork=new KT(_objectSpread(_objectSpread({},o),{},{createScene:_this111.createScene.bind(_this111),createLayer:_this111.createLayer.bind(_this111)})),_this111.vNodes.init(_this111.fullLayer);return _this111;}_inherits(TMt,_GT);return _createClass(TMt,[{key:"combinePost",value:function(){var _combinePost=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee92(e){var _this112=this;var a,u,h,_this$combinePostData,n,i,s,v,_iterator111,_step111,p,y,C,b,o,_t111,_t112,_t113;return _regenerator().w(function(_context97){while(1)switch(_context97.p=_context97.n){case 0:_this$combinePostData=this.combinePostData(),n=_this$combinePostData.render,i=_objectWithoutProperties(_this$combinePostData,_excluded4);if(!(n!=null&&n.length)){_context97.n=15;break;}v=[];_iterator111=_createForOfIteratorHelper(JT(n,this.scene,this.dpr));_context97.p=1;_iterator111.s();case 2:if((_step111=_iterator111.n()).done){_context97.n=11;break;}p=_step111.value;if(!p.rect){_context97.n=10;break;}if(!(p.drawCanvas&&p.rect&&p.rect.w>0&&p.rect.h>0)){_context97.n=9;break;}_context97.p=3;y=p.drawCanvas===$t.Bg;C=y?(a=this.getLayer(p.drawCanvas))==null?void 0:a.parent:void 0;if(!y){_context97.n=4;break;}_t111=this.transferLayerToImageBitmap(p.drawCanvas);_context97.n=6;break;case 4:_context97.n=5;return this.getRectImageBitmap(p);case 5:_t111=_context97.v;case 6:b=_t111;if(!(y&&QT(C,b),!this.trackCombinePostTransfer(e,b))){_context97.n=7;break;}return _context97.a(2);case 7:p.imageBitmap=b,y&&(p.isFullFrameImageBitmap=!0,p.viewGeneration=this.viewGeneration,p.frameSequence=++this.fullLayerFrameSequence,p.taskId=e,p.rect=this.getSceneRect()),s||(s=[]),s.push(b);_context97.n=9;break;case 8:_context97.p=8;_t112=_context97.v;throw new wf(_t112,{business:"combine-post",stage:"transfer-layer-image-bitmap"});case 9:v.push(p);case 10:_context97.n=2;break;case 11:_context97.n=13;break;case 12:_context97.p=12;_t113=_context97.v;_iterator111.e(_t113);case 13:_context97.p=13;_iterator111.f();return _context97.f(13);case 14:i.render=v;case 15:o=(u=i.sp)==null?void 0:u.filter(function(v){return v.type!==Tt.None||v.isLockSentEventCursor||v.needUndoTicker||v.collectUndoTicker||v.eraseTxnPhase;});o!=null&&o.length?i.sp=o.map(function(v){var _v$viewGeneration;return _objectSpread(_objectSpread({},v),{},{viewId:v.viewId||_this112.viewId,viewGeneration:(_v$viewGeneration=v.viewGeneration)!==null&&_v$viewGeneration!==void 0?_v$viewGeneration:_this112.viewGeneration});}):delete i.sp,i.consumeCount===void 0&&delete i.consumeCount,i.subWorkerDrawCount===void 0&&delete i.subWorkerDrawCount,this.isCombinePostTaskActive(e)&&(o!=null&&o.length||i.consumeCount||i.subWorkerDrawCount||(h=i==null?void 0:i.render)!=null&&h.length)&&(this._post(i,s),this.commitCombinePostTransfers(e));case 16:return _context97.a(2);}},_callee92,this,[[3,8],[1,12,13,14]]);}));function combinePost(_x142){return _combinePost.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee93(e){var h,v,n,i,s,o,a,u,p,_t114,_t115;return _regenerator().w(function(_context98){while(1)switch(_context98.n){case 0:n=e.msgType,i=e.toolsType,s=e.opt,o=e.dataType,a=e.workState,u=e.isLockSentEventCursor;_t114=n;_context98.n=_t114===Tt.UpdateTools?1:_t114===Tt.CreateWork?3:_t114===Tt.DrawWork?4:_t114===Tt.RemoveNode?8:_t114===Tt.FullWork?10:_t114===Tt.Snapshot?14:_t114===Tt.BoundingBox?16:18;break;case 1:if(!(i&&(h=this.topLayerWork)!=null&&h.canUseTopLayer(i)&&s)){_context98.n=2;break;}p={toolsType:i,toolsOpt:s};this.topLayerWork.setToolsOpt(p);return _context98.a(2);case 2:return _context98.a(3,18);case 3:this.createLocalWork(e);return _context98.a(2);case 4:if(!(a===te.Done&&o===Qt.Local)){_context98.n=6;break;}_context98.n=5;return this.consumeDrawAll(o,e);case 5:i===St.LaserPen&&u&&this.post({sp:[{type:Tt.None,isLockSentEventCursor:u}]});_context98.n=7;break;case 6:_context98.n=7;return this.consumeDraw(o,e);case 7:return _context98.a(2);case 8:_context98.n=9;return this.removeNode(e);case 9:return _context98.a(2);case 10:if(!(i&&(v=this.topLayerWork)!=null&&v.canUseTopLayer(i))){_context98.n=12;break;}_context98.n=11;return this.consumeDrawAll(o,e);case 11:_context98.n=13;break;case 12:_t115=o===Qt.Local&&e.clearPreviewLocalWork&&e.workId;if(!_t115){_context98.n=13;break;}_context98.n=13;return this.localWork.consumeDrawAll(_objectSpread(_objectSpread({},e),{},{msgType:Tt.DrawWork,workState:te.Done}));case 13:return _context98.a(2);case 14:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context98.n=15;return this.snapshotWork.getSnapshot(e);case 15:this.snapshotWork.destroySnapshotFullLayer();return _context98.a(2);case 16:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context98.n=17;return this.snapshotWork.getBoundingRect(e);case 17:this.snapshotWork.destroySnapshotFullLayer();return _context98.a(2);case 18:_context98.n=19;return _superPropGet(TMt,"on",this,3)([e]);case 19:return _context98.a(2);}},_callee93,this);}));function on(_x143){return _on2.apply(this,arguments);}return on;}()},{key:"createLocalWork",value:function createLocalWork(e){var o;var n=e.workId,i=e.toolsType,s=e.opt;if(i&&(o=this.topLayerWork)!=null&&o.canUseTopLayer(i)&&n&&s){this.topLayerWork.getToolsOpt()||this.topLayerWork.setToolsOpt({toolsType:i,toolsOpt:s}),this.topLayerWork.setWorkOptions(n.toString(),s);return;}i&&_superPropGet(TMt,"createLocalWork",this,3)([e]);}},{key:"removeNode",value:function(){var _removeNode2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee94(e){var n,_t116;return _regenerator().w(function(_context99){while(1)switch(_context99.n){case 0:n=e.dataType;_t116=n===Qt.Local;if(!_t116){_context99.n=1;break;}_context99.n=1;return this.localWork.removeWork(e);case 1:return _context99.a(2);}},_callee94,this);}));function removeNode(_x144){return _removeNode2.apply(this,arguments);}return removeNode;}()},{key:"getLayer",value:function getLayer(e){switch(e){case $t.TopFloat:return this.topLayer||this.fullLayer;default:return this.fullLayer;}}},{key:"getOffscreen",value:function getOffscreen(e){var i;return((i=this.getLayer(e))==null?void 0:i.parent).canvas;}},{key:"consumeDraw",value:function(){var _consumeDraw5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee95(e,n){var o,i,s,_t117;return _regenerator().w(function(_context100){while(1)switch(_context100.n){case 0:i=n.workId,s=n.toolsType;if(!i){_context100.n=3;break;}if(!(s&&(o=this.topLayerWork)!=null&&o.canUseTopLayer(s))){_context100.n=1;break;}e===Qt.Local&&(this.topLayerWork.getWorkShape(i.toString())||this.createLocalWork(n)),this.topLayerWork.consumeDraw(n);return _context100.a(2);case 1:_t117=s;if(!_t117){_context100.n=2;break;}this.localWork.getWorkShape(i.toString())||this.createLocalWork(n);_context100.n=2;return this.localWork.consumeDraw(n);case 2:return _context100.a(2);case 3:return _context100.a(2);}},_callee95,this);}));function consumeDraw(_x145,_x146){return _consumeDraw5.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee96(e,n){var a,i,s,o,u,_t118;return _regenerator().w(function(_context101){while(1)switch(_context101.n){case 0:i=n.workId,s=n.toolsType,o=n.dataType;if(!i){_context101.n=3;break;}u=i.toString();if(!(s&&(a=this.topLayerWork)!=null&&a.canUseTopLayer(s))){_context101.n=1;break;}o===Qt.Local&&(this.topLayerWork.getWorkShape(u)||this.createLocalWork(n)),this.topLayerWork.consumeDrawAll(n);return _context101.a(2);case 1:_t118=s;if(!_t118){_context101.n=2;break;}this.localWork.getWorkShape(u)||_superPropGet(TMt,"createLocalWork",this,3)([n]);_context101.n=2;return this.localWork.consumeDrawAll(n);case 2:return _context101.a(2);case 3:return _context101.a(2);}},_callee96,this);}));function consumeDrawAll(_x147,_x148){return _consumeDrawAll4.apply(this,arguments);}return consumeDrawAll;}()},{key:"clearAll",value:function(){var _clearAll2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee97(){return _regenerator().w(function(_context102){while(1)switch(_context102.n){case 0:this.vNodes.clear();_superPropGet(TMt,"clearAll",this,3)([]);this.topLayer&&(this.topLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.topLayer,this.topLayer.parent));_context102.n=1;return this.post({render:[{isClearAll:!0,clearCanvas:$t.TopFloat,viewId:this.viewId}],sp:[{type:Tt.Clear}]});case 1:return _context102.a(2);}},_callee97,this);}));function clearAll(){return _clearAll2.apply(this,arguments);}return clearAll;}()},{key:"getRectImageBitmap",value:function(){var _getRectImageBitmap=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee98(e,n){var i,s,o,a,u,h;return _regenerator().w(function(_context103){while(1)switch(_context103.n){case 0:i=e.rect,s=e.drawCanvas,o=Math.floor(i.x*this.dpr),a=Math.floor(i.y*this.dpr),u=Math.max(1,Math.floor(i.w*this.dpr)),h=Math.max(1,Math.floor(i.h*this.dpr));_context103.n=1;return createImageBitmap(this.getOffscreen(s),o,a,u,h,n);case 1:return _context103.a(2,_context103.v);}},_callee98,this);}));function getRectImageBitmap(_x149,_x150){return _getRectImageBitmap.apply(this,arguments);}return getRectImageBitmap;}()},{key:"updateLayer",value:function updateLayer(e){var n=e.width,i=e.height;_superPropGet(TMt,"updateLayer",this,3)([e]),this.topLayer&&(this.topLayer.parent.setAttribute("width",n),this.topLayer.parent.setAttribute("height",i),this.topLayer.setAttribute("size",[n,i]),this.topLayer.setAttribute("pos",[n*0.5,i*0.5]));}},{key:"updateDpr",value:function(){var _updateDpr2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee99(e){var n,i,s,_t119;return _regenerator().w(function(_context104){while(1)switch(_context104.n){case 0:_superPropGet(TMt,"updateDpr",this,3)([e]);n=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,i=!!this.localWork.getWorkShapes().size,s=[];i&&s.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId});n&&s.push({isClearAll:!0,clearCanvas:$t.TopFloat,viewId:this.viewId});_t119=s.length;if(!_t119){_context104.n=1;break;}_context104.n=1;return this.post({render:s});case 1:return _context104.a(2);}},_callee99,this);}));function updateDpr(_x151){return _updateDpr2.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee100(e,n){var _this113=this;var o,i,s,a,u,_iterator112,_step112,_loop0,h,_t120,_t121,_t122;return _regenerator().w(function(_context106){while(1)switch(_context106.p=_context106.n){case 0:if(!(n!=null&&n.aborted)){_context106.n=1;break;}return _context106.a(2);case 1:i=[],s=e.cameraOpt;if(!(s&&!Qn(this.cameraOpt,s))){_context106.n=13;break;}a=this.topLayerWork&&!!this.topLayerWork.localWorkShapes.size||!1,u=!!this.localWork.getWorkShapes().size;if(!(u&&this.localWork.workShapesDone(),this.setCameraOpt(s),u&&i.push({isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}),a&&this.topLayerWork)){_context106.n=8;break;}i.push({isClearAll:!0,clearCanvas:$t.TopFloat,viewId:this.viewId});_iterator112=_createForOfIteratorHelper(this.topLayerWork.localWorkShapes.entries()||[]);_context106.p=2;_loop0=/*#__PURE__*/_regenerator().m(function _loop0(){var _step112$value,h,v,p;return _regenerator().w(function(_context105){while(1)switch(_context105.n){case 0:_step112$value=_slicedToArray(_step112.value,2),h=_step112$value[0],v=_step112$value[1];if(v.totalRect){(o=_this113.topLayer)==null||o.getElementsByName(h.toString()).forEach(function(y){var C=y.getBoundingClientRect(),b=me({x:C.x,y:C.y,w:C.width,h:C.height});p=Kt(p,b);}),v.totalRect=p,_this113.topLayerWork.localWorkShapes.set(h,v);}case 1:return _context105.a(2);}},_loop0);});_iterator112.s();case 3:if((_step112=_iterator112.n()).done){_context106.n=5;break;}return _context106.d(_regeneratorValues(_loop0()),4);case 4:_context106.n=3;break;case 5:_context106.n=7;break;case 6:_context106.p=6;_t120=_context106.v;_iterator112.e(_t120);case 7:_context106.p=7;_iterator112.f();return _context106.f(7);case 8:if(!i.length){_context106.n=12;break;}h=this.post({render:i});_t121=n;if(!_t121){_context106.n=10;break;}_context106.n=9;return NT(n,h,"update-camera");case 9:_t121=!_context106.v;case 10:if(!_t121){_context106.n=11;break;}return _context106.a(2);case 11:_t122=n;if(_t122){_context106.n=12;break;}_context106.n=12;return h;case 12:if(!(n!=null&&n.aborted)){_context106.n=13;break;}return _context106.a(2);case 13:return _context106.a(2);}},_callee100,this,[[2,6,7,8]]);}));function updateCamera(_x152,_x153){return _updateCamera.apply(this,arguments);}return updateCamera;}()},{key:"setCameraOpt",value:function setCameraOpt(e,n){var h,v;this.cameraOpt=e;var i=e.scale,s=e.centerX,o=e.centerY,a=e.width,u=e.height;(a!==this.scene.width||u!==this.scene.height)&&this.updateScene(this.scene,{width:a,height:u}),n?(n.setAttribute("scale",[i,i]),n.setAttribute("translate",[-s,-o])):(this.fullLayer.setAttribute("scale",[i,i]),this.fullLayer.setAttribute("translate",[-s,-o]),(h=this.topLayer)==null||h.setAttribute("scale",[i,i]),(v=this.topLayer)==null||v.setAttribute("translate",[-s,-o]));}}]);}(GT);var _T=/*#__PURE__*/function(_GT2){function _T(e,n,i){var _this114;_classCallCheck(this,_T);_this114=_callSuper(this,_T,[e,n,"full"/* Full */]);ht(_this114,"serviceDrawLayer");ht(_this114,"localDrawLayer");ht(_this114,"snapshotFullLayer");ht(_this114,"methodBuilder");ht(_this114,"localWork");ht(_this114,"serviceWork");ht(_this114,"_post");ht(_this114,"debounceUpdateCache",/* @__PURE__ */new Set());ht(_this114,"fullLayerFrameSequence",0);_this114._post=i;var s=Jr.bufferSize.sub;_this114.serviceDrawLayer=_this114.createLayer("serviceDrawLayer",_this114.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:s,contextType:"2d"})),_this114.localDrawLayer=_this114.createLayer("localDrawLayer",_this114.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:s,contextType:"2d"}));var o={thread:_this114,viewId:_this114.viewId,vNodes:_this114.vNodes,fullLayer:_this114.fullLayer};_this114.localWork=new ZT(_objectSpread(_objectSpread({},o),{},{drawLayer:_this114.localDrawLayer})),n.combineUnitTime&&_this114.localWork.setCombineUnitTime(n.combineUnitTime),n.maxCombineEraserTime&&_this114.localWork.setmaxCombineEraserTime(n.maxCombineEraserTime),n.syncUnitTime&&_this114.localWork.setSyncUnitTime(n.syncUnitTime),_this114.serviceWork=new qT(_objectSpread(_objectSpread({},o),{},{drawLayer:_this114.serviceDrawLayer})),_this114.methodBuilder=new I2([ve.CopyNode,ve.SetColorNode,ve.DeleteNode,ve.RotateNode,ve.ScaleNode,ve.TranslateNode,ve.ZIndexNode,ve.SetFontStyle,ve.SetPoint,ve.SetLock,ve.SetShapeOpt]).registerForWorker(_this114),_this114.vNodes.init(_this114.fullLayer);return _this114;}_inherits(_T,_GT2);return _createClass(_T,[{key:"combinePost",value:function(){var _combinePost2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee101(e){var _this115=this;var a,u,h,_this$combinePostData2,n,i,s,v,_iterator113,_step113,p,y,C,b,o,_t123,_t124,_t125;return _regenerator().w(function(_context107){while(1)switch(_context107.p=_context107.n){case 0:_this$combinePostData2=this.combinePostData(),n=_this$combinePostData2.render,i=_objectWithoutProperties(_this$combinePostData2,_excluded5);if(!(n!=null&&n.length)){_context107.n=15;break;}v=[];_iterator113=_createForOfIteratorHelper(JT(n,this.scene,this.dpr));_context107.p=1;_iterator113.s();case 2:if((_step113=_iterator113.n()).done){_context107.n=11;break;}p=_step113.value;if(!p.rect){_context107.n=10;break;}if(!(p.drawCanvas&&p.rect&&p.rect.w>0&&p.rect.h>0)){_context107.n=9;break;}_context107.p=3;y=p.drawCanvas===$t.Bg;C=y?(a=this.getLayer(p.drawCanvas))==null?void 0:a.parent:void 0;if(!y){_context107.n=4;break;}_t123=this.transferLayerToImageBitmap(p.drawCanvas);_context107.n=6;break;case 4:_context107.n=5;return this.getRectImageBitmap(p);case 5:_t123=_context107.v;case 6:b=_t123;if(!(y&&QT(C,b),!this.trackCombinePostTransfer(e,b))){_context107.n=7;break;}return _context107.a(2);case 7:p.imageBitmap=b,y&&(p.isFullFrameImageBitmap=!0,p.viewGeneration=this.viewGeneration,p.frameSequence=++this.fullLayerFrameSequence,p.taskId=e,p.rect=this.getSceneRect()),s||(s=[]),s.push(b);_context107.n=9;break;case 8:_context107.p=8;_t124=_context107.v;throw new wf(_t124,{business:"combine-post",stage:"transfer-layer-image-bitmap"});case 9:v.push(p);case 10:_context107.n=2;break;case 11:_context107.n=13;break;case 12:_context107.p=12;_t125=_context107.v;_iterator113.e(_t125);case 13:_context107.p=13;_iterator113.f();return _context107.f(13);case 14:i.render=v;case 15:o=(u=i.sp)==null?void 0:u.filter(function(v){return v.type!==Tt.None||v.isLockSentEventCursor||v.needUndoTicker||v.collectUndoTicker||v.eraseTxnPhase;});o!=null&&o.length?i.sp=o.map(function(v){var _v$viewGeneration2;return _objectSpread(_objectSpread({},v),{},{viewId:v.viewId||_this115.viewId,viewGeneration:(_v$viewGeneration2=v.viewGeneration)!==null&&_v$viewGeneration2!==void 0?_v$viewGeneration2:_this115.viewGeneration});}):delete i.sp,i.fullWorkerDrawCount===void 0&&delete i.fullWorkerDrawCount,i.consumeCount===void 0&&delete i.consumeCount,this.isCombinePostTaskActive(e)&&(i!=null&&i.fullWorkerDrawCount||i.consumeCount||o!=null&&o.length||(h=i.render)!=null&&h.length)&&(this._post(i,s),this.commitCombinePostTransfers(e));case 16:return _context107.a(2);}},_callee101,this,[[3,8],[1,12,13,14]]);}));function combinePost(_x154){return _combinePost2.apply(this,arguments);}return combinePost;}()},{key:"on",value:function(){var _on3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee102(e){var _this116=this;var n,i,s,o,a,u,h,v,_h8,_t126,_t127;return _regenerator().w(function(_context108){while(1)switch(_context108.n){case 0:_context108.n=1;return this.methodBuilder.consumeForWorker(e);case 1:if(!_context108.v){_context108.n=2;break;}return _context108.a(2);case 2:n=e.msgType,i=e.dataType,s=e.workId,o=e.toolsType,a=e.workState,u=e.workIds;_t126=n;_context108.n=_t126===Tt.AuthClear?3:_t126===Tt.CreateWork?4:_t126===Tt.DrawWork?5:_t126===Tt.Select?9:_t126===Tt.UpdateNode?13:_t126===Tt.FullWork?13:_t126===Tt.RemoveNode?15:_t126===Tt.GetTextActive?17:_t126===Tt.CursorHover?19:_t126===Tt.CursorBlur?21:_t126===Tt.GetVNodeInfo?23:24;break;case 3:h=e.clearUids,v=e.localUid;this.vNodes.setCanClearUids(h),this.vNodes.setLocalUid(v);return _context108.a(3,24);case 4:o!==St.LaserPen&&this.createLocalWork(e);return _context108.a(3,24);case 5:_t127=o!==St.LaserPen;if(!_t127){_context108.n=8;break;}if(!(a===te.Done&&i===Qt.Local)){_context108.n=7;break;}_context108.n=6;return this.consumeDrawAll(i,e);case 6:_context108.n=8;break;case 7:_context108.n=8;return this.consumeDraw(i,e);case 8:return _context108.a(3,24);case 9:if(!(i===Qt.Local||s===De)){_context108.n=11;break;}_context108.n=10;return this.localWork.updateFullSelectWork(e);case 10:_context108.n=12;break;case 11:this.serviceWork.runSelectWork(e);case 12:return _context108.a(2);case 13:_context108.n=14;return this.consumeFull(i,e);case 14:return _context108.a(2);case 15:_context108.n=16;return this.removeNode(e);case 16:return _context108.a(2);case 17:_context108.n=18;return this.checkTextActive(e);case 18:return _context108.a(2);case 19:_context108.n=20;return this.cursorHover(e);case 20:return _context108.a(2);case 21:_context108.n=22;return this.cursorBlur();case 22:return _context108.a(2);case 23:if(s&&u){_h8=u.map(function(v){return _this116.vNodes.get(v);});this.post({sp:[{type:Tt.GetVNodeInfo,dataType:Qt.Worker,workId:s,vInfo:_h8}]});}return _context108.a(3,24);case 24:_context108.n=25;return _superPropGet(_T,"on",this,3)([e]);case 25:return _context108.a(2);}},_callee102,this);}));function on(_x155){return _on3.apply(this,arguments);}return on;}()},{key:"removeNode",value:function(){var _removeNode3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee103(e){var _this117=this;var n,i,s,o,a,_iterator114,_step114,_loop1,_t128;return _regenerator().w(function(_context110){while(1)switch(_context110.p=_context110.n){case 0:n=e.dataType,i=e.workId,s=e.removeIds,o=[],a=s||[];if(!(i&&a.push(i.toString()),a.length)){_context110.n=8;break;}_iterator114=_createForOfIteratorHelper(a);_context110.p=1;_loop1=/*#__PURE__*/_regenerator().m(function _loop1(){var u;return _regenerator().w(function(_context109){while(1)switch(_context109.n){case 0:u=_step114.value;u===De?o.push(_this117.localWork.removeSelector(e,_this117)):n===Qt.Local?o.push(_this117.localWork.removeWork(e).then(function(){_this117.localWork.colloctEffectSelectWork(e),_this117.deleteCachedImagesByWorkId(u);})):n===Qt.Service&&o.push(_this117.serviceWork.removeWork(e).then(function(){_this117.localWork.colloctEffectSelectWork(e),_this117.deleteCachedImagesByWorkId(u);}));case 1:return _context109.a(2);}},_loop1);});_iterator114.s();case 2:if((_step114=_iterator114.n()).done){_context110.n=4;break;}return _context110.d(_regeneratorValues(_loop1()),3);case 3:_context110.n=2;break;case 4:_context110.n=6;break;case 5:_context110.p=5;_t128=_context110.v;_iterator114.e(_t128);case 6:_context110.p=6;_iterator114.f();return _context110.f(6);case 7:_context110.n=8;return Promise.all(o);case 8:return _context110.a(2);}},_callee103,null,[[1,5,6,7]]);}));function removeNode(_x156){return _removeNode3.apply(this,arguments);}return removeNode;}()},{key:"checkTextActive",value:function(){var _checkTextActive2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee104(e){var n,_t129;return _regenerator().w(function(_context111){while(1)switch(_context111.n){case 0:n=e.dataType;_t129=n===Qt.Local;if(!_t129){_context111.n=1;break;}_context111.n=1;return this.localWork.checkTextActive(e);case 1:return _context111.a(2);}},_callee104,this);}));function checkTextActive(_x157){return _checkTextActive2.apply(this,arguments);}return checkTextActive;}()},{key:"clearAll",value:function(){var _clearAll3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee105(){return _regenerator().w(function(_context112){while(1)switch(_context112.n){case 0:this.vNodes.clear();this.debounceUpdateCache.clear();_superPropGet(_T,"clearAll",this,3)([]);this.localDrawLayer&&(this.localDrawLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.localDrawLayer,this.localDrawLayer.parent));this.serviceDrawLayer&&(this.serviceDrawLayer.parent.children.forEach(function(e){e.name!=="viewport"&&e.remove();}),Kr(this.serviceDrawLayer,this.serviceDrawLayer.parent));_context112.n=1;return this.post({render:[{isClearAll:!0,clearCanvas:$t.Bg,viewId:this.viewId},{isClearAll:!0,clearCanvas:$t.ServiceFloat,viewId:this.viewId},{isClearAll:!0,clearCanvas:$t.Float,viewId:this.viewId}],sp:[{type:Tt.Clear}]});case 1:return _context112.a(2);}},_callee105,this);}));function clearAll(){return _clearAll3.apply(this,arguments);}return clearAll;}()},{key:"updateLayer",value:function updateLayer(e){var n=e.width,i=e.height;_superPropGet(_T,"updateLayer",this,3)([e]),this.localDrawLayer&&(this.localDrawLayer.parent.setAttribute("width",n),this.localDrawLayer.parent.setAttribute("height",i),this.localDrawLayer.setAttribute("size",[n,i]),this.localDrawLayer.setAttribute("pos",[n*0.5,i*0.5])),this.serviceDrawLayer&&(this.serviceDrawLayer.parent.setAttribute("width",n),this.serviceDrawLayer.parent.setAttribute("height",i),this.serviceDrawLayer.setAttribute("size",[n,i]),this.serviceDrawLayer.setAttribute("pos",[n*0.5,i*0.5]));}},{key:"setCameraOpt",value:function setCameraOpt(e){this.cameraOpt=e;var n=e.scale,i=e.centerX,s=e.centerY,o=e.width,a=e.height;(o!==this.scene.width||a!==this.scene.height)&&this.updateScene(this.scene,{width:o,height:a}),this.fullLayer&&(this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-i,-s])),this.localDrawLayer&&(this.localDrawLayer.setAttribute("scale",[n,n]),this.localDrawLayer.setAttribute("translate",[-i,-s])),this.serviceDrawLayer&&(this.serviceDrawLayer.setAttribute("scale",[n,n]),this.serviceDrawLayer.setAttribute("translate",[-i,-s]));}},{key:"getLayer",value:function getLayer(e){switch(e){case $t.Bg:return this.fullLayer;case $t.ServiceFloat:return this.serviceDrawLayer;case $t.Float:return this.localDrawLayer;}}},{key:"getOffscreen",value:function getOffscreen(e){return this.getLayer(e).parent.canvas;}},{key:"consumeFull",value:function(){var _consumeFull2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee106(e,n){var i,_t130;return _regenerator().w(function(_context113){while(1)switch(_context113.n){case 0:_context113.n=1;return this.localWork.colloctEffectSelectWork(n);case 1:i=_context113.v;_t130=i&&e===Qt.Local;if(!_t130){_context113.n=2;break;}_context113.n=2;return this.localWork.consumeFull(i);case 2:i&&e===Qt.Service&&this.serviceWork.consumeFull(i);case 3:return _context113.a(2);}},_callee106,this);}));function consumeFull(_x158,_x159){return _consumeFull2.apply(this,arguments);}return consumeFull;}()},{key:"consumeDraw",value:function(){var _consumeDraw6=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee107(e,n){var i,_t131;return _regenerator().w(function(_context114){while(1)switch(_context114.n){case 0:i=n.workId;_t131=e===Qt.Local&&i;if(!_t131){_context114.n=1;break;}this.localWork.getWorkShape(i.toString())||this.createLocalWork(n);_context114.n=1;return this.localWork.consumeDraw(n,this.serviceWork);case 1:e===Qt.Service&&this.serviceWork.consumeDraw(n);case 2:return _context114.a(2);}},_callee107,this);}));function consumeDraw(_x160,_x161){return _consumeDraw6.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll5=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee108(e,n){var i,_t132;return _regenerator().w(function(_context115){while(1)switch(_context115.n){case 0:i=n.workId;_t132=e===Qt.Local&&i;if(!_t132){_context115.n=1;break;}this.localWork.getWorkShape(i.toString())||this.createLocalWork(n);_context115.n=1;return this.localWork.consumeDrawAll(n,this.serviceWork);case 1:return _context115.a(2);}},_callee108,this);}));function consumeDrawAll(_x162,_x163){return _consumeDrawAll5.apply(this,arguments);}return consumeDrawAll;}()},{key:"updateDpr",value:function(){var _updateDpr3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee109(e){var n;return _regenerator().w(function(_context116){while(1)switch(_context116.n){case 0:_superPropGet(_T,"updateDpr",this,3)([e]);n=[{isClearAll:!0,clearCanvas:$t.Bg,viewId:this.viewId}];this.vNodes.hasRenderNodes()&&n.push({isDrawAll:!0,drawCanvas:$t.Bg,viewId:this.viewId});_context116.n=1;return this.post({render:n});case 1:return _context116.a(2);}},_callee109,this);}));function updateDpr(_x164){return _updateDpr3.apply(this,arguments);}return updateDpr;}()},{key:"updateCamera",value:function(){var _updateCamera2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee111(e,n){var _this118=this;var y,C,b,M,i,s,o,a,u,h,v,p,L,_L19,X,S,_iterator115,_step115,_step115$value,P,z,Y,_iterator116,_step116,_step116$value,_S9,_x169,_P1,_iterator117,_step117,_step117$value,_S0,_x170,_P10,et,A,_S5,_iterator118,_step118,x,w,_iterator119,_step119,_S6,_x167,_iterator120,_step120,_P7,_iterator121,_step121,_step121$value,_P0,_z18,U,K,j,nt,ct,B,N,G,q,_iterator122,_step122,_step122$value,_x168,_P8,_S7,_S8,_t135,_t136,_t137,_t138,_t139;return _regenerator().w(function(_context119){while(1)switch(_context119.p=_context119.n){case 0:i=[],s=e.cameraOpt,o=e.scenePath,a=e.cameraTaskId;u=!1;h=this.cameraOpt,v=!!(s&&Qn(h,s));p=!1;if(!(s&&v)){_context119.n=3;break;}L=this.hasCameraSettledRender();if(!this.retargetCameraSettledRender(a)){_context119.n=1;break;}return _context119.a(2);case 1:if(L){_context119.n=2;break;}$e(a)&&this._post({viewId:this.viewId,viewGeneration:this.viewGeneration,cameraSettledTaskId:a});return _context119.a(2);case 2:p=!0;case 3:if(!(s&&(!v||p))){_context119.n=26;break;}this.cancelCameraSettledRender();_L19=!h||h.scale!==s.scale||h.centerX!==s.centerX||h.centerY!==s.centerY||h.width!==s.width||h.height!==s.height;this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0,(y=this.taskUpdateCameraResolve)==null||y.call(this,!1),this.taskUpdateCameraResolve=void 0);X=!!this.serviceDrawLayer.children.length;if(!o){_context119.n=19;break;}case 4:S=[];_iterator115=_createForOfIteratorHelper(this.localWork.getWorkShapes().entries());_context119.p=5;_iterator115.s();case 6:if((_step115=_iterator115.n()).done){_context119.n=10;break;}_step115$value=_slicedToArray(_step115.value,2),P=_step115$value[0],z=_step115$value[1];_t135=z.toolsType;_context119.n=_t135===St.Text?7:_t135===St.PencilEraser?7:_t135===St.Eraser?7:_t135===St.Selector?7:_t135===St.LaserPen?7:8;break;case 7:return _context119.a(3,9);case 8:P!==Lo&&P!==De&&S.push("".concat(P,":").concat(z.toolsType));return _context119.a(3,9);case 9:_context119.n=6;break;case 10:_context119.n=12;break;case 11:_context119.p=11;_t136=_context119.v;_iterator115.e(_t136);case 12:_context119.p=12;_iterator115.f();return _context119.f(12);case 13:if(!(n&&(n.stage="blocking-works",n.blockingWorks=S),!S.length)){_context119.n=14;break;}return _context119.a(3,18);case 14:_context119.n=15;return new Promise(function(P){_this118.taskUpdateCameraResolve=P,_this118.taskUpdateCameraId=setTimeout(function(){_this118.taskUpdateCameraId=void 0,_this118.taskUpdateCameraResolve=void 0,P(!0);},k1);});case 15:_t137=!_context119.v;if(_t137){_context119.n=16;break;}_t137=n!=null&&n.aborted;case 16:if(!_t137){_context119.n=17;break;}return _context119.a(2);case 17:if(S.length){_context119.n=4;break;}case 18:n&&(n.stage="update-camera",n.blockingWorks=void 0);case 19:if(!(n!=null&&n.aborted)){_context119.n=20;break;}return _context119.a(2);case 20:Y=/* @__PURE__ */new Map();_iterator116=_createForOfIteratorHelper(this.vNodes.getNodesByType(St.Text).entries());try{for(_iterator116.s();!(_step116=_iterator116.n()).done;){_step116$value=_slicedToArray(_step116.value,2),_S9=_step116$value[0],_x169=_step116$value[1];_P1=_x169.rect;Y.set(_S9,{rect:gr(_P1),scale:(C=this.cameraOpt)==null?void 0:C.scale});}}catch(err){_iterator116.e(err);}finally{_iterator116.f();}_iterator117=_createForOfIteratorHelper(this.vNodes.gethasEraserNodes().entries());try{for(_iterator117.s();!(_step117=_iterator117.n()).done;){_step117$value=_slicedToArray(_step117.value,2),_S0=_step117$value[0],_x170=_step117$value[1];_P10=_x170.rect;Y.set(_S0,{rect:gr(_P10),scale:(b=this.cameraOpt)==null?void 0:b.scale});}}catch(err){_iterator117.e(err);}finally{_iterator117.f();}et=new Set(Y.keys());A=!1;if(this.localWork.hasSelector()){_S5=(M=this.localWork.getSelector())==null?void 0:M.selectIds;if(_S5){A=!0;_iterator118=_createForOfIteratorHelper(_S5);try{for(_iterator118.s();!(_step118=_iterator118.n()).done;){x=_step118.value;et.add(x);}}catch(err){_iterator118.e(err);}finally{_iterator118.f();}}}w=!1;if(this.serviceWork.selectorWorkShapes.size){_iterator119=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.values());try{for(_iterator119.s();!(_step119=_iterator119.n()).done;){_S6=_step119.value;_x167=_S6.selectIds;if(_x167){w=!0;_iterator120=_createForOfIteratorHelper(_x167);try{for(_iterator120.s();!(_step120=_iterator120.n()).done;){_P7=_step120.value;et.add(_P7);}}catch(err){_iterator120.e(err);}finally{_iterator120.f();}}}}catch(err){_iterator119.e(err);}finally{_iterator119.f();}}if(this.setCameraOpt(s),this.vNodes.curNodeMap.size){this.vNodes.clearTarget(),this.vNodes.updateHighLevelNodesRect(et);_iterator121=_createForOfIteratorHelper(Y.entries());try{for(_iterator121.s();!(_step121=_iterator121.n()).done;){_step121$value=_slicedToArray(_step121.value,2),x=_step121$value[0],_P0=_step121$value[1].rect;_z18=this.vNodes.get(x);if(_z18){U=_P0,K=_z18.rect,j=this.getSceneRect(),nt=el(U,j),ct=el(K,j),B=_z18.toolsType,N=_z18.opt;G=p;(nt!==ct||U.w!==K.w||U.h!==K.h||ct===es.intersect)&&(G=!0),B===St.Text&&// (opt as TextOptions).workState === EventWorkState.Done &&
|
|
491
|
+
G&&this.debounceUpdateCache.add(x);q=_L19||p;(N.eraserlines&&N.eraserlines.length||N.eraserFaces)&&q&&!this.debounceUpdateCache.has(x)&&this.debounceUpdateCache.add(x);}}}catch(err){_iterator121.e(err);}finally{_iterator121.f();}if(A&&this.localWork.reRenderSelector(),w){_iterator122=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.entries());try{for(_iterator122.s();!(_step122=_iterator122.n()).done;){_step122$value=_slicedToArray(_step122.value,2),_x168=_step122$value[0],_P8=_step122$value[1];this.serviceWork.runSelectWork({workId:_x168,selectIds:_P8.selectIds,msgType:Tt.Select,dataType:Qt.Service,viewId:this.viewId});}}catch(err){_iterator122.e(err);}finally{_iterator122.f();}}u=!0;_S7=this.startCameraSettledRender(a,n);this.debounceUpdateCameraId=setTimeout(function(){_this118.debounceUpdateCameraId=void 0,_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee110(){var x,_P9,_iterator123,_step123,_loop10,U,K,_z16,_z17,_t133,_t134;return _regenerator().w(function(_context118){while(1)switch(_context118.p=_context118.n){case 0:_context118.p=0;if(_S7.isActive()){_context118.n=1;break;}return _context118.a(2);case 1:_P9=[];_iterator123=_createForOfIteratorHelper(_this118.debounceUpdateCache.values());_context118.p=2;_loop10=/*#__PURE__*/_regenerator().m(function _loop10(){var U,K,j,nt,ct,B;return _regenerator().w(function(_context117){while(1)switch(_context117.n){case 0:U=_step123.value;K=_this118.vNodes.get(U);if(K){j=K.toolsType,nt=K.opt,ct=K.op,B=_this118.localWork.setFullWork({toolsType:j,opt:nt,workId:U});B&&(j===St.Text?(x=_this118.fullLayer)!=null&&x.getElementsByName(U)[0]&&B instanceof Ja&&_P9.push(B.consumeServiceAsync({isFullWork:!0,replaceId:U,boxRect:_this118.getSceneRect(),isActive:_S7.isActive})):(nt.eraserlines&&nt.eraserlines.length||nt.eraserFaces)&&_P9.push(new Promise(function(N){var G=B.consumeService({op:ct,isFullWork:!0,replaceId:U,workState:te.Done});_this118.localWork.clearWorkShapeNodeCache(U),N(G);})));}_this118.debounceUpdateCache.delete(U);case 1:return _context117.a(2);}},_loop10);});_iterator123.s();case 3:if((_step123=_iterator123.n()).done){_context118.n=5;break;}return _context118.d(_regeneratorValues(_loop10()),4);case 4:_context118.n=3;break;case 5:_context118.n=7;break;case 6:_context118.p=6;_t133=_context118.v;_iterator123.e(_t133);case 7:_context118.p=7;_iterator123.f();return _context118.f(7);case 8:_context118.n=9;return Promise.all(_P9);case 9:if(_S7.isActive()){_context118.n=10;break;}return _context118.a(2);case 10:if(!(_this118.vNodes.updateLowLevelNodesRect(),_this118.vNodes.clearHighLevelIds(),_P9.length)){_context118.n=14;break;}U=[];U.push({isClearAll:!0,clearCanvas:$t.Bg,viewId:_this118.viewId},{isDrawAll:!0,drawCanvas:$t.Bg,viewId:_this118.viewId});_context118.n=11;return _this118.post({render:U});case 11:if(_S7.isActive()){_context118.n=12;break;}return _context118.a(2);case 12:K=_this118.fullLayer.parent;_S7.setRenderLayers([K]);_context118.n=13;return K.prepareRender;case 13:_S7.setRenderLayers();if(_S7.isActive()){_context118.n=14;break;}return _context118.a(2);case 14:_z16=_S7.getCameraTaskId();$e(_z16)&&_this118._post({viewId:_this118.viewId,viewGeneration:_this118.viewGeneration,cameraSettledTaskId:_z16});_context118.n=17;break;case 15:_context118.p=15;_t134=_context118.v;if(_S7.isActive()){_context118.n=16;break;}return _context118.a(2);case 16:_z17=Ws(_t134)?_t134:void 0,U={code:"RENDERER_BUSINESS_ERROR",business:"updateCamera",message:_t134 instanceof Error?_t134.message:String(_t134),stage:(_z17==null?void 0:_z17.stage)||"camera-settled-render",workerType:_this118.type},K=_S7.getCameraTaskId();if($e(K))try{_this118._post({viewId:_this118.viewId,viewGeneration:_this118.viewGeneration,cameraTaskId:K,cameraTaskStatus:"failed",cameraTaskError:U});}catch(j){console.error("[cameraSettledRender] failed ACK post failed viewId=".concat(_this118.viewId," taskId=").concat(K),j);}case 17:_context118.p=17;_S7.finish();return _context118.f(17);case 18:return _context118.a(2);}},_callee110,null,[[2,6,7,8],[0,15,17,18]]);}))();},k1*5);}if(!(X&&i.push({isClearAll:!0,clearCanvas:$t.ServiceFloat,viewId:this.viewId}),this.vNodes.hasRenderNodes()&&i.push({isClearAll:!0,clearCanvas:$t.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:$t.Bg,viewId:this.viewId}),i.length)){_context119.n=24;break;}_S8=this.post({render:i},{reportFailureAtRendererBoundary:!1});_t138=n;if(!_t138){_context119.n=22;break;}_context119.n=21;return NT(n,_S8,"update-camera");case 21:_t138=!_context119.v;case 22:if(!_t138){_context119.n=23;break;}return _context119.a(2);case 23:_t139=n;if(_t139){_context119.n=24;break;}_context119.n=24;return _S8;case 24:if(!(n!=null&&n.aborted)){_context119.n=25;break;}return _context119.a(2);case 25:!u&&$e(a)&&this._post({viewId:this.viewId,viewGeneration:this.viewGeneration,cameraSettledTaskId:a});case 26:return _context119.a(2);}},_callee111,this,[[5,11,12,13]]);}));function updateCamera(_x165,_x166){return _updateCamera2.apply(this,arguments);}return updateCamera;}()},{key:"getRectImageBitmap",value:function(){var _getRectImageBitmap2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee112(e){var n,i,s,o,a,u;return _regenerator().w(function(_context120){while(1)switch(_context120.n){case 0:n=e.rect,i=e.drawCanvas,s=Math.floor(n.x*this.dpr),o=Math.floor(n.y*this.dpr),a=Math.max(1,Math.floor(n.w*this.dpr)),u=Math.max(1,Math.floor(n.h*this.dpr));_context120.n=1;return createImageBitmap(this.getOffscreen(i),s,o,a,u,{resizeQuality:"low"});case 1:return _context120.a(2,_context120.v);}},_callee112,this);}));function getRectImageBitmap(_x171){return _getRectImageBitmap2.apply(this,arguments);}return getRectImageBitmap;}()},{key:"cursorHover",value:function(){var _cursorHover2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee113(e){return _regenerator().w(function(_context121){while(1)switch(_context121.n){case 0:_context121.n=1;return this.localWork.cursorHover(e);case 1:return _context121.a(2);}},_callee113,this);}));function cursorHover(_x172){return _cursorHover2.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee114(){return _regenerator().w(function(_context122){while(1)switch(_context122.n){case 0:_context122.n=1;return this.localWork.cursorBlur();case 1:return _context122.a(2);}},_callee114,this);}));function cursorBlur(){return _cursorBlur2.apply(this,arguments);}return cursorBlur;}()},{key:"destroy",value:function destroy(){this.debounceUpdateCache.clear(),_superPropGet(_T,"destroy",this,3)([]);}}]);}(GT);var IMt=/*#__PURE__*/function(_T6){function IMt(e,n,i){var _this119;_classCallCheck(this,IMt);var o,a,u,h;_this119=_callSuper(this,IMt,[e,n,i]);ht(_this119,"snapshotWork");ht(_this119,"localDrawScene");ht(_this119,"serviceDrawScene");ht(_this119,"offscreenCanvas");ht(_this119,"localWork");ht(_this119,"serviceWork");if(_this119._post=i,n.offscreenCanvas){_this119.offscreenCanvas=n.offscreenCanvas,_this119.localDrawScene=_this119.createScene(n,(o=_this119.offscreenCanvas)==null?void 0:o.localCanvas),_this119.serviceDrawScene=_this119.createScene(n,(a=_this119.offscreenCanvas)==null?void 0:a.serviceCanvas);var v=Jr.bufferSize.sub;_this119.serviceDrawLayer=_this119.createLayer("serviceDrawLayer",_this119.serviceDrawScene||_this119.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:v,contextType:"2d"}),(u=_this119.offscreenCanvas)==null?void 0:u.serviceCanvas),_this119.localDrawLayer=_this119.createLayer("localDrawLayer",_this119.localDrawScene||_this119.scene,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:v,contextType:"2d"}),(h=_this119.offscreenCanvas)==null?void 0:h.localCanvas);}var s={thread:_this119,viewId:_this119.viewId,vNodes:_this119.vNodes,fullLayer:_this119.fullLayer};_this119.localWork=new gMt(_objectSpread(_objectSpread({},s),{},{drawLayer:_this119.localDrawLayer})),n.combineUnitTime&&_this119.localWork.setCombineUnitTime(n.combineUnitTime),n.maxCombineEraserTime&&_this119.localWork.setmaxCombineEraserTime(n.maxCombineEraserTime),n.syncUnitTime&&_this119.localWork.setSyncUnitTime(n.syncUnitTime),_this119.serviceWork=new mMt(_objectSpread(_objectSpread({},s),{},{drawLayer:_this119.serviceDrawLayer})),_this119.snapshotWork=new KT(_objectSpread(_objectSpread({},s),{},{createScene:_this119.createScene.bind(_this119),createLayer:_this119.createLayer.bind(_this119)})),_this119.methodBuilder=new I2([ve.CopyNode,ve.SetColorNode,ve.DeleteNode,ve.RotateNode,ve.ScaleNode,ve.TranslateNode,ve.ZIndexNode,ve.SetFontStyle,ve.SetPoint,ve.SetLock,ve.SetShapeOpt]).registerForWorker(_this119);return _this119;}_inherits(IMt,_T6);return _createClass(IMt,[{key:"createRenderLayer",value:function createRenderLayer(e,n,i){var a;var s=Jr.bufferSize.full,o=Jr.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",e,_objectSpread(_objectSpread({},n.layerOpt),{},{bufferSize:this.viewId===Bs?s:o*2}),i||((a=n.offscreenCanvas)==null?void 0:a.bgCanvas));}},{key:"createScene",value:function createScene(e,n){var i=e.offscreenCanvas,s=e.offscreenCanvasOpt,o=s.width,a=s.height,u=n||(i==null?void 0:i.bgCanvas)||new OffscreenCanvas(o,a);s.contextType&&delete s.contextType;var h=new sf(_objectSpread(_objectSpread({container:u,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},s),{},{contextType:this.contextType,id:this.viewId}));return h.setAttribute("id",this.viewId),h;}},{key:"combinePostData",value:function combinePostData(){var u,h;var e=this.combinePostMsg;this.combinePostMsg=/* @__PURE__ */new Set();var n=[],i=[];var s,o;var a=/* @__PURE__ */new Set();var _iterator124=_createForOfIteratorHelper(e.values()),_step124;try{for(_iterator124.s();!(_step124=_iterator124.n()).done;){var v=_step124.value;if((u=v.render)!=null&&u.length){var p=void 0;try{if(this.offscreenCanvas){var _iterator125=_createForOfIteratorHelper(v.render),_step125;try{for(_iterator125.s();!(_step125=_iterator125.n()).done;){var y=_step125.value;y.workId&&a.add(y.workId);var C=y.drawCanvas||y.clearCanvas;if(C){var b=this.getLayer(C);if(!b||!(b.parent instanceof xi))continue;p=b.parent,p.render();}}}catch(err){_iterator125.e(err);}finally{_iterator125.f();}}else{var _iterator126=_createForOfIteratorHelper(v.render),_step126;try{for(_iterator126.s();!(_step126=_iterator126.n()).done;){var _y4=_step126.value;var _C5=!1;if(_y4.workId&&a.add(_y4.workId),_y4.isClearAll&&(_y4.rect=this.getSceneRect(),_y4.isClear=!0,delete _y4.isClearAll),_y4.drawCanvas){var _b9=this.getLayer(_y4.drawCanvas);if(!_b9||!(_b9.parent instanceof xi))continue;if(p=_b9.parent,p.render(),_y4.isDrawAll){var M=this.getSceneRect();_y4.rect=M,delete _y4.isDrawAll;}}var _iterator127=_createForOfIteratorHelper(n),_step127;try{for(_iterator127.s();!(_step127=_iterator127.n()).done;){var _b0=_step127.value;if(_y4.viewId===_b0.viewId&&_y4.eraseTxnId===_b0.eraseTxnId){_y4.isClear&&_b0.clearCanvas&&_b0.isClear&&_b0.clearCanvas===_y4.clearCanvas&&(_b0.rect=Kt(_b0.rect,_y4.rect),_C5=!0),_b0.drawCanvas&&_b0.drawCanvas===_y4.drawCanvas&&(_b0.rect=Kt(_b0.rect,_y4.rect),_C5=!0);continue;}}}catch(err){_iterator127.e(err);}finally{_iterator127.f();}_C5||(_y4.isClear&&!_y4.drawCanvas?n.unshift(_y4):n.push(_y4));}}catch(err){_iterator126.e(err);}finally{_iterator126.f();}}}catch(y){var _C6=y&&y instanceof Error?y.message:y==null?void 0:y.toString(),_b1=wMt(_C6),_M7=_b1?YT(p==null?void 0:p.gl):void 0;console.error("[WorkThreadEngineForSimpleWorker] combinePostData error",_C6),i.push({type:Tt.ReportError,viewId:this.viewId,viewGeneration:this.viewGeneration,reportString:"[WorkThreadEngineForSimpleWorker] combinePostData error: ".concat(_C6),reportError:_C6,reportErrorCode:_b1?yMt:void 0,reportStage:p?"layer-render":"combine-post-data",reportContextType:this.getActualContextType(),reportContextLost:_M7==null?void 0:_M7.contextLost,reportGlError:_M7==null?void 0:_M7.glError,reportCurrentProgram:_M7==null?void 0:_M7.currentProgram,reportProgramLinked:_M7==null?void 0:_M7.programLinked,reportProgramHasUniforms:_M7==null?void 0:_M7.programHasUniforms});}}if((h=v.sp)!=null&&h.length){var _iterator128=_createForOfIteratorHelper(v.sp),_step128;try{for(_iterator128.s();!(_step128=_iterator128.n()).done;){var _p7$viewGeneration;var _p7=_step128.value;var _y5=_objectSpread(_objectSpread({},_p7),{},{viewId:_p7.viewId||this.viewId,viewGeneration:(_p7$viewGeneration=_p7.viewGeneration)!==null&&_p7$viewGeneration!==void 0?_p7$viewGeneration:this.viewGeneration});var _C7=!1;var _iterator129=_createForOfIteratorHelper(i),_step129;try{for(_iterator129.s();!(_step129=_iterator129.n()).done;){var _b10=_step129.value;if(Qn(_y5,_b10)){_C7=!0;break;}}}catch(err){_iterator129.e(err);}finally{_iterator129.f();}_C7||i.push(_y5);}}catch(err){_iterator128.e(err);}finally{_iterator128.f();}}$e(v.consumeCount)&&(s=v.consumeCount,o=v.consumeWorkId);}}catch(err){_iterator124.e(err);}finally{_iterator124.f();}return{render:n,sp:i,consumeCount:s,consumeWorkId:o,workIds:a,viewId:this.viewId,viewGeneration:this.viewGeneration};}},{key:"on",value:function(){var _on4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee115(e){var n,_t140;return _regenerator().w(function(_context123){while(1)switch(_context123.n){case 0:_context123.n=1;return this.methodBuilder.consumeForWorker(e);case 1:if(!_context123.v){_context123.n=2;break;}return _context123.a(2);case 2:n=e.msgType;_t140=n;_context123.n=_t140===Tt.Snapshot?3:_t140===Tt.BoundingBox?5:7;break;case 3:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context123.n=4;return this.snapshotWork.getSnapshot(e);case 4:this.snapshotWork.destroySnapshotFullLayer();return _context123.a(2);case 5:this.snapshotWork.createSnapshotFullLayer(this.opt,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Bs?6e3:3e3,contextType:"2d"}));_context123.n=6;return this.snapshotWork.getBoundingRect(e);case 6:this.snapshotWork.destroySnapshotFullLayer();return _context123.a(2);case 7:_context123.n=8;return _superPropGet(IMt,"on",this,3)([e]);case 8:return _context123.a(2);}},_callee115,this);}));function on(_x173){return _on4.apply(this,arguments);}return on;}()},{key:"setCameraOpt",value:function setCameraOpt(e){if(this.localDrawScene&&this.serviceDrawScene){var n=e.width,i=e.height;(n!==this.localDrawScene.width||i!==this.localDrawScene.height)&&this.updateScene(this.localDrawScene,{width:n,height:i},this.localDrawLayer),(n!==this.serviceDrawScene.width||i!==this.serviceDrawScene.height)&&this.updateScene(this.serviceDrawScene,{width:n,height:i},this.serviceDrawLayer);}_superPropGet(IMt,"setCameraOpt",this,3)([e]);}},{key:"updateDpr",value:function(){var _updateDpr4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee116(e){return _regenerator().w(function(_context124){while(1)switch(_context124.n){case 0:this.localDrawScene&&this.serviceDrawScene&&(this.localDrawScene.displayRatio=e,this.serviceDrawScene.displayRatio=e),_superPropGet(IMt,"updateDpr",this,3)([e]);case 1:return _context124.a(2);}},_callee116,this);}));function updateDpr(_x174){return _updateDpr4.apply(this,arguments);}return updateDpr;}()}]);}(_T);var Q1=self;Q1.full=new SMt(Q1,Eu.Full,function(r,t){var e=r.viewId,n=r.dpr,i=r.offscreenCanvasOpt,s=r.layerOpt,o=r.combineUnitTime,a=r.syncUnitTime,u=r.maxCombineEraserTime,h=r.offscreenCanvas,v=r.isUseSimple,p=r.bitmapEraserMaskOptions,y=r.viewGeneration;if(!e||!n||!i||!s)return;var C={dpr:n,offscreenCanvasOpt:i,layerOpt:s,combineUnitTime:o,syncUnitTime:a,maxCombineEraserTime:u,bitmapEraserMaskOptions:p,viewGeneration:y};return v?new IMt(e,_objectSpread(_objectSpread({},C),{},{offscreenCanvas:h}),t):new _T(e,C,t);});
|