@netless/appliance-plugin 1.1.1-beta.0 → 1.1.1-beta.1

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/cdn/cdn.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-D2RITq.js",e="/subWorker-UKUWKN.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-DMbnX4.js",e="/subWorker-CX0tMz.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
@@ -1,4 +1,4 @@
1
- var _excluded=["toolsType"],_excluded2=["callback"],_excluded3=["rect","willUpdateNodes","scenePath"],_excluded4=["render"],_excluded5=["render"];function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)o=s[r],t.includes(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(e.includes(n))continue;t[n]=r[n];}return t;}function _superPropSet(t,e,o,r,p,f){return _set(_getPrototypeOf(f?t.prototype:t),e,o,r,p);}function set(e,r,t,o){return set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,o){var f,i=_superPropBase(e,r);if(i){if((f=Object.getOwnPropertyDescriptor(i,r)).set)return f.set.call(o,t),!0;if(!f.writable)return!1;}if(f=Object.getOwnPropertyDescriptor(o,r)){if(!f.writable)return!1;f.value=t,Object.defineProperty(o,r,f);}else _defineProperty(o,r,t);return!0;},set(e,r,t,o);}function _set(e,r,t,o,f){if(!set(e,r,t,o||e)&&f)throw new TypeError("failed to set property");return t;}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 _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 _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]");}catch(n){return"function"==typeof t;}}function _superPropGet(t,e,r,o){var p=_get(_getPrototypeOf(1&o?t.prototype:t),e,r);return 2&o?function(t){return p.apply(r,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 _toArray(r){return _arrayWithHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableRest();}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 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 _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 _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 _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 _n7=0,F=function F(){};return{s:F,n:function n(){return _n7>=r.length?{done:!0}:{done:!1,value:r[_n7++]};},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 _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 _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}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 _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 _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 _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 Di=Object.defineProperty;var Ni=function Ni(h,r,t){return r in h?Di(h,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[r]=t;};var et=function et(h,r,t){return Ni(h,_typeof(r)!="symbol"?r+"":r,t);};var Lt=/* @__PURE__ */function(h){return h.Normal="Normal",h.Stroke="Stroke",h.Dotted="Dotted",h.LongDotted="LongDotted",h;}(Lt||{}),bt=/* @__PURE__ */function(h){return h.None="None",h.ShowFloatBar="ShowFloatBar",h.ZIndexFloatBar="ZIndexFloatBar",h.DeleteNode="DeleteNode",h.CopyNode="CopyNode",h.ZIndexActive="ZIndexActive",h.ZIndexNode="ZIndexNode",h.RotateNode="RotateNode",h.SetColorNode="SetColorNode",h.TranslateNode="TranslateNode",h.ScaleNode="ScaleNode",h.OriginalEvent="OriginalEvent",h.CreateScene="CreateScene",h.ActiveCursor="ActiveCursor",h.MoveCursor="MoveCursor",h.CommandEditor="CommandEditor",h.SetEditorData="SetEditorData",h.SetFontStyle="SetFontStyle",h.SetPoint="SetPoint",h.SetLock="SetLock",h.SetShapeOpt="SetShapeOpt",h.CameraChange="CameraChange",h.ActiveMethod="ActiveMethod",h;}(bt||{}),ut=/* @__PURE__ */function(h){return h[h.Pencil=1]="Pencil",h[h.Eraser=2]="Eraser",h[h.PencilEraser=3]="PencilEraser",h[h.BitMapEraser=4]="BitMapEraser",h[h.Selector=5]="Selector",h[h.Clicker=6]="Clicker",h[h.Arrow=7]="Arrow",h[h.Hand=8]="Hand",h[h.LaserPen=9]="LaserPen",h[h.Text=10]="Text",h[h.Straight=11]="Straight",h[h.Rectangle=12]="Rectangle",h[h.Ellipse=13]="Ellipse",h[h.Star=14]="Star",h[h.Triangle=15]="Triangle",h[h.Rhombus=16]="Rhombus",h[h.Polygon=17]="Polygon",h[h.SpeechBalloon=18]="SpeechBalloon",h[h.Image=19]="Image",h;}(ut||{}),Mt=/* @__PURE__ */function(h){return h[h.Local=1]="Local",h[h.Service=2]="Service",h[h.Worker=3]="Worker",h;}(Mt||{}),It=/* @__PURE__ */function(h){return h[h.Pending=0]="Pending",h[h.Start=1]="Start",h[h.Doing=2]="Doing",h[h.Done=3]="Done",h[h.Unwritable=4]="Unwritable",h;}(It||{}),lt=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Init=1]="Init",h[h.UpdateCamera=2]="UpdateCamera",h[h.UpdateTools=3]="UpdateTools",h[h.CreateWork=4]="CreateWork",h[h.DrawWork=5]="DrawWork",h[h.FullWork=6]="FullWork",h[h.UpdateNode=7]="UpdateNode",h[h.RemoveNode=8]="RemoveNode",h[h.Clear=9]="Clear",h[h.Select=10]="Select",h[h.Destroy=11]="Destroy",h[h.Snapshot=12]="Snapshot",h[h.BoundingBox=13]="BoundingBox",h[h.Cursor=14]="Cursor",h[h.TextUpdate=15]="TextUpdate",h[h.GetTextActive=16]="GetTextActive",h[h.TasksQueue=17]="TasksQueue",h[h.CursorHover=18]="CursorHover",h[h.CursorBlur=19]="CursorBlur",h[h.Console=20]="Console",h[h.PriorityWorker=21]="PriorityWorker",h[h.PriorityMainThreadWorker=22]="PriorityMainThreadWorker",h[h.GetImageBitMap=23]="GetImageBitMap",h[h.AuthWriter=24]="AuthWriter",h[h.AuthReader=25]="AuthReader",h[h.AuthClear=26]="AuthClear",h;}(lt||{}),ve=/* @__PURE__ */function(h){return h.Webgl2="webgl2",h.Webgl="webgl",h.Canvas2d="2d",h;}(ve||{}),St=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Bg=1]="Bg",h[h.ServiceFloat=2]="ServiceFloat",h[h.Float=3]="Float",h[h.TopFloat=4]="TopFloat",h;}(St||{}),jt=/* @__PURE__ */function(h){return h[h.none=1]="none",h[h.all=2]="all",h[h.both=3]="both",h[h.proportional=4]="proportional",h;}(jt||{}),Me=/* @__PURE__ */function(h){return h[h.inside=0]="inside",h[h.outside=1]="outside",h[h.intersect=2]="intersect",h;}(Me||{});var te=/*#__PURE__*/function(){function te(){_classCallCheck(this,te);et(this,"localWork");et(this,"serviceWork");et(this,"threadEngine");}return _createClass(te,[{key:"registerForWorker",value:function registerForWorker(r){return this.threadEngine=r,this.localWork=r.localWork,this.serviceWork=r.serviceWork,this;}}]);}();var Wi=/*#__PURE__*/function(_te){function Wi(){var _this;_classCallCheck(this,Wi);_this=_callSuper(this,Wi,arguments);et(_this,"emitEventType",bt.CopyNode);return _this;}_inherits(Wi,_te);return _createClass(Wi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.FullWork&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var n,e;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:e=t.workId;_context.t0=e;if(!_context.t0){_context.next=5;break;}_context.next=5;return(n=this.localWork)==null?void 0:n.consumeFull(t);case 5:case"end":return _context.stop();}},_callee,this);}));function consumeForLocalWorker(_x){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(te);var We="++",Nt="selector",Bi="all";var Fi=/*#__PURE__*/function(_te2){function Fi(){var _this2;_classCallCheck(this,Fi);_this2=_callSuper(this,Fi,arguments);et(_this2,"emitEventType",bt.SetColorNode);return _this2;}_inherits(Fi,_te2);return _createClass(Fi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context2.t0=e===Nt&&n;if(!_context2.t0){_context2.next=5;break;}_context2.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context2.stop();}},_callee2,this);}));function consumeForLocalWorker(_x2){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=e.textUpdateForWoker,l=n.render||[],d=n.sp||[];if(a){var _iterator2=_createForOfIteratorHelper(i.entries()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _step2$value=_slicedToArray(_step2.value,2),c=_step2$value[0],p=_step2$value[1];s&&p.toolsType===ut.Text?d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return{render:l,sp:d};}}]);}(te);var Ui=/*#__PURE__*/function(_te3){function Ui(){var _this3;_classCallCheck(this,Ui);_this3=_callSuper(this,Ui,arguments);et(_this3,"emitEventType",bt.ZIndexNode);return _this3;}_inherits(Ui,_te3);return _createClass(Ui,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context3.t0=e===Nt&&n;if(!_context3.t0){_context3.next=5;break;}_context3.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context3.stop();}},_callee3,this);}));function consumeForLocalWorker(_x3){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator3=_createForOfIteratorHelper(i.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),d=_step3$value[0],c=_step3$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return{render:s,sp:l};}}]);}(te);var ji=/*#__PURE__*/function(_te4){function ji(){var _this4;_classCallCheck(this,ji);_this4=_callSuper(this,ji,arguments);et(_this4,"emitEventType",bt.TranslateNode);return _this4;}_inherits(ji,_te4);return _createClass(ji,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(t){var d,c,e,n,i,a,o,s,l;return _regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker,l=t.emitEventType;_context4.t0=e===Nt&&n;if(!_context4.t0){_context4.next=9;break;}if(!(n.workState===It.Done&&n!=null&&n.translate&&(n.translate[0]||n.translate[1])||n.workState!==It.Done)){_context4.next=8;break;}_context4.next=6;return(d=this.localWork)==null?void 0:d.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,isSync:!0,textUpdateForWoker:s,emitEventType:l,callback:this.updateSelectorCallback});case 6:_context4.next=9;break;case 8:n.workState===It.Done&&((c=this.localWork)==null||c.vNodes.deleteLastTarget());case 9:case"end":return _context4.stop();}},_callee4,this);}));function consumeForLocalWorker(_x4){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=d.workState,y=n.render||[],P=n.sp||[];if(p===It.Start)return{sp:[],render:[]};var T=o==null?void 0:o.selectRect;if(s){P.push({type:lt.Select,selectIds:a.selectIds,selectRect:T,willSyncService:!0,isSync:!0,points:p===It.Done&&a.getChildrenPoints()||void 0,textOpt:a.textOpt});var _iterator4=_createForOfIteratorHelper(i.entries()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),v=_step4$value[0],x=_step4$value[1];c&&x.toolsType===ut.Text?P.push(_objectSpread(_objectSpread({},x),{},{workId:v,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):P.push(_objectSpread(_objectSpread({},x),{},{workId:v,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}return{render:y,sp:P};}}]);}(te);var $i=/*#__PURE__*/function(_te5){function $i(){var _this5;_classCallCheck(this,$i);_this5=_callSuper(this,$i,arguments);et(_this5,"emitEventType",bt.DeleteNode);return _this5;}_inherits($i,_te5);return _createClass($i,[{key:"consume",value:function consume(){return!1;}}]);}(te);var zi=/*#__PURE__*/function(_te6){function zi(){var _this6;_classCallCheck(this,zi);_this6=_callSuper(this,zi,arguments);et(_this6,"emitEventType",bt.ScaleNode);return _this6;}_inherits(zi,_te6);return _createClass(zi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(t){var o,e,n,i,a;return _regeneratorRuntime().wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willSyncService,a=t.willSerializeData;_context5.t0=e===Nt&&n;if(!_context5.t0){_context5.next=5;break;}_context5.next=5;return(o=this.localWork)==null?void 0:o.updateSelector({updateSelectorOpt:n,willSyncService:i,willSerializeData:a,isSync:!0,callback:this.updateSelectorCallback.bind(this)});case 5:case"end":return _context5.stop();}},_callee5,this);}));function consumeForLocalWorker(_x5){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=s.workState,c=n.render||[],p=n.sp||[],y=a==null?void 0:a.selectRect;if(d===It.Start)return{sp:[],render:[]};if(l){p.push({type:lt.Select,selectIds:i.selectIds,selectRect:y,willSyncService:!0,isSync:!0,points:d===It.Done&&i.getChildrenPoints()||void 0,textOpt:i.textOpt});var _iterator5=_createForOfIteratorHelper(o.entries()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,2),P=_step5$value[0],T=_step5$value[1];T.toolsType===ut.Text?p.push(_objectSpread(_objectSpread({},T),{},{workId:P,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):p.push(_objectSpread(_objectSpread({},T),{},{workId:P,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:!0}));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}return{render:c,sp:p};}}]);}(te);var Gi=/*#__PURE__*/function(_te7){function Gi(){var _this7;_classCallCheck(this,Gi);_this7=_callSuper(this,Gi,arguments);et(_this7,"emitEventType",bt.RotateNode);return _this7;}_inherits(Gi,_te7);return _createClass(Gi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.emitEventType;_context6.t0=e===Nt&&n;if(!_context6.t0){_context6.next=5;break;}_context6.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,emitEventType:s,isSync:!0,callback:this.updateSelectorCallback});case 5:case"end":return _context6.stop();}},_callee6,this);}));function consumeForLocalWorker(_x6){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=e.willSerializeData,c=e.isSync,p=s.workState,y=n.render||[],P=n.sp||[],T=a==null?void 0:a.selectRect;if(l){d&&p===It.Done&&P.push({type:lt.Select,selectIds:i.selectIds,selectRect:T,willSyncService:!0,isSync:c,points:i.getChildrenPoints(),textOpt:i.textOpt,selectorColor:i.selectorColor,strokeColor:i.strokeColor,fillColor:i.fillColor,canTextEdit:i.canTextEdit,canRotate:i.canRotate,scaleType:i.scaleType,opt:i.getWorkOptions()||void 0,canLock:i.canLock,isLocked:i.isLocked,toolsTypes:i.toolsTypes,shapeOpt:i.shapeOpt,thickness:i.thickness,useStroke:i.useStroke,strokeType:i.strokeType});var _iterator6=_createForOfIteratorHelper(o.entries()),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _step6$value=_slicedToArray(_step6.value,2),v=_step6$value[0],x=_step6$value[1];P.push(_objectSpread(_objectSpread({},x),{},{workId:v,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:c}));}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}return{render:y,sp:P};}}]);}(te);var Hi=/*#__PURE__*/function(_te8){function Hi(){var _this8;_classCallCheck(this,Hi);_this8=_callSuper(this,Hi,arguments);et(_this8,"emitEventType",bt.SetFontStyle);return _this8;}_inherits(Hi,_te8);return _createClass(Hi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee7$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context7.t0=e===Nt&&n;if(!_context7.t0){_context7.next=5;break;}_context7.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context7.stop();}},_callee7,this);}));function consumeForLocalWorker(_x7){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=n.render||[],y=n.sp||[],P=o==null?void 0:o.selectRect;if(s&&y){d.fontSize&&y.push({type:lt.Select,selectIds:a.selectIds,selectRect:P,willSyncService:s,isSync:l,points:a.getChildrenPoints()});var _iterator7=_createForOfIteratorHelper(i.entries()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _step7$value=_slicedToArray(_step7.value,2),T=_step7$value[0],v=_step7$value[1];c&&v.toolsType===ut.Text?y.push(_objectSpread(_objectSpread({},v),{},{workId:T,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):y.push(_objectSpread(_objectSpread({},v),{},{workId:T,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}return{render:p,sp:y};}}]);}(te);var Ki=/*#__PURE__*/function(_te9){function Ki(){var _this9;_classCallCheck(this,Ki);_this9=_callSuper(this,Ki,arguments);et(_this9,"emitEventType",bt.SetPoint);return _this9;}_inherits(Ki,_te9);return _createClass(Ki,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context8.t0=e===Nt&&n;if(!_context8.t0){_context8.next=5;break;}_context8.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,emitEventType:this.emitEventType,willSerializeData:o,isSync:!0,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context8.stop();}},_callee8,this);}));function consumeForLocalWorker(_x8){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=n.render||[],c=n.sp||[],p=o==null?void 0:o.selectRect;if(s&&c){var _iterator8=_createForOfIteratorHelper(i.entries()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _step8$value=_slicedToArray(_step8.value,2),y=_step8$value[0],P=_step8$value[1];c.push(_objectSpread(_objectSpread({},P),{},{workId:y,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}c.push({type:lt.Select,selectIds:a.selectIds,selectRect:p,willSyncService:s,isSync:l,points:a.getChildrenPoints()});}return{render:d,sp:c};}}]);}(te);var Yi=/*#__PURE__*/function(_te10){function Yi(){var _this10;_classCallCheck(this,Yi);_this10=_callSuper(this,Yi,arguments);et(_this10,"emitEventType",bt.SetLock);return _this10;}_inherits(Yi,_te10);return _createClass(Yi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee9$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context9.t0=e===Nt&&n;if(!_context9.t0){_context9.next=5;break;}_context9.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context9.stop();}},_callee9,this);}));function consumeForLocalWorker(_x9){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=n.render||[],p=n.sp||[],y=o==null?void 0:o.selectRect;if(s&&p){var _iterator9=_createForOfIteratorHelper(i.entries()),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _step9$value=_slicedToArray(_step9.value,2),P=_step9$value[0],T=_step9$value[1];p.push(_objectSpread(_objectSpread({},T),{},{workId:P,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}p.push({isLocked:d.isLocked,selectorColor:a.selectorColor,scaleType:a.scaleType,canRotate:a.canRotate,type:lt.Select,selectIds:a.selectIds,selectRect:y,willSyncService:s,isSync:l});}return{render:c,sp:p};}}]);}(te);var Vi=/*#__PURE__*/function(_te11){function Vi(){var _this11;_classCallCheck(this,Vi);_this11=_callSuper(this,Vi,arguments);et(_this11,"emitEventType",bt.SetShapeOpt);return _this11;}_inherits(Vi,_te11);return _createClass(Vi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker10=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee10$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context10.t0=e===Nt&&n;if(!_context10.t0){_context10.next=5;break;}_context10.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context10.stop();}},_callee10,this);}));function consumeForLocalWorker(_x10){return _consumeForLocalWorker10.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator10=_createForOfIteratorHelper(i.entries()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _step10$value=_slicedToArray(_step10.value,2),d=_step10$value[0],c=_step10$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}return{render:s,sp:l};}}]);}(te);var Xi=/*#__PURE__*/function(){function Xi(r){var _this12=this;_classCallCheck(this,Xi);et(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(r.map(function(t){return[t,_this12.build(t)];}));}return _createClass(Xi,[{key:"build",value:function build(r){switch(r){case bt.TranslateNode:return new ji();case bt.ZIndexNode:return new Ui();case bt.CopyNode:return new Wi();case bt.SetColorNode:return new Fi();case bt.DeleteNode:return new $i();case bt.ScaleNode:return new zi();case bt.RotateNode:return new Gi();case bt.SetFontStyle:return new Hi();case bt.SetPoint:return new Ki();case bt.SetLock:return new Yi();case bt.SetShapeOpt:return new Vi();}}},{key:"registerForWorker",value:function registerForWorker(r){return this.builders.forEach(function(t){t&&t.registerForWorker(r);}),this;}},{key:"consumeForWorker",value:function consumeForWorker(r){var _iterator11=_createForOfIteratorHelper(this.builders.values()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var t=_step11.value;if(t!=null&&t.consume(r))return!0;}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return!1;}}]);}();var ki={linear:function linear(h){return h;},easeInQuad:function easeInQuad(h){return h*h;},easeOutQuad:function easeOutQuad(h){return h*(2-h);},easeInOutQuad:function easeInOutQuad(h){return h<0.5?2*h*h:-1+(4-2*h)*h;},easeInCubic:function easeInCubic(h){return h*h*h;},easeOutCubic:function easeOutCubic(h){return--h*h*h+1;},easeInOutCubic:function easeInOutCubic(h){return h<0.5?4*h*h*h:(h-1)*(2*h-2)*(2*h-2)+1;},easeInQuart:function easeInQuart(h){return h*h*h*h;},easeOutQuart:function easeOutQuart(h){return 1- --h*h*h*h;},easeInOutQuart:function easeInOutQuart(h){return h<0.5?8*h*h*h*h:1-8*--h*h*h*h;},easeInQuint:function easeInQuint(h){return h*h*h*h*h;},easeOutQuint:function easeOutQuint(h){return 1+--h*h*h*h*h;},easeInOutQuint:function easeInOutQuint(h){return h<0.5?16*h*h*h*h*h:1+16*--h*h*h*h*h;},easeInSine:function easeInSine(h){return 1-Math.cos(h*Math.PI/2);},easeOutSine:function easeOutSine(h){return Math.sin(h*Math.PI/2);},easeInOutSine:function easeInOutSine(h){return-(Math.cos(Math.PI*h)-1)/2;},easeInExpo:function easeInExpo(h){return h<=0?0:Math.pow(2,10*h-10);},easeOutExpo:function easeOutExpo(h){return h>=1?1:1-Math.pow(2,-10*h);},easeInOutExpo:function easeInOutExpo(h){return h<=0?0:h>=1?1:h<0.5?Math.pow(2,20*h-10)/2:(2-Math.pow(2,-20*h+10))/2;}};var _=/*#__PURE__*/function(){function _(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,_);this.x=r,this.y=t,this.z=e;}return _createClass(_,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(r){return this.z=r,this;}},{key:"setXY",value:function setXY(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;return this.x=r,this.y=t,this;}},{key:"set",value:function set(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=r,this.y=t,this.z=e,this;}},{key:"setTo",value:function setTo(_ref){var _ref$x=_ref.x,r=_ref$x===void 0?0:_ref$x,_ref$y=_ref.y,t=_ref$y===void 0?0:_ref$y,_ref$z=_ref.z,e=_ref$z===void 0?1:_ref$z;return this.x=r,this.y=t,this.z=e,this;}},{key:"rot",value:function rot(r){if(r===0)return this;var t=this.x,e=this.y,n=Math.sin(r),i=Math.cos(r);return this.x=t*i-e*n,this.y=t*n+e*i,this;}},{key:"rotWith",value:function rotWith(r,t){if(t===0)return this;var e=this.x-r.x,n=this.y-r.y,i=Math.sin(t),a=Math.cos(t);return this.x=r.x+(e*a-n*i),this.y=r.y+(e*i+n*a),this;}},{key:"clone",value:function clone(){var r=this.x,t=this.y,e=this.z;return new _(r,t,e);}},{key:"sub",value:function sub(r){return this.x-=r.x,this.y-=r.y,this;}},{key:"subXY",value:function subXY(r,t){return this.x-=r,this.y-=t,this;}},{key:"subScalar",value:function subScalar(r){return this.x-=r,this.y-=r,this;}},{key:"add",value:function add(r){return this.x+=r.x,this.y+=r.y,this;}},{key:"addXY",value:function addXY(r,t){return this.x+=r,this.y+=t,this;}},{key:"addScalar",value:function addScalar(r){return this.x+=r,this.y+=r,this;}},{key:"clamp",value:function clamp(r,t){return this.x=Math.max(this.x,r),this.y=Math.max(this.y,r),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this;}},{key:"div",value:function div(r){return this.x/=r,this.y/=r,this;}},{key:"divV",value:function divV(r){return this.x/=r.x,this.y/=r.y,this;}},{key:"mul",value:function mul(r){return this.x*=r,this.y*=r,this;}},{key:"mulV",value:function mulV(r){return this.x*=r.x,this.y*=r.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(r,t){var e=_.Tan(r,this);return this.add(e.mul(t));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(r){return this.x=this.y*r.z-this.z*r.y,this.y=this.z*r.x-this.x*r.z,this;}},{key:"dpr",value:function dpr(r){return _.Dpr(this,r);}},{key:"cpr",value:function cpr(r){return _.Cpr(this,r);}},{key:"len2",value:function len2(){return _.Len2(this);}},{key:"len",value:function len(){return _.Len(this);}},{key:"pry",value:function pry(r){return _.Pry(this,r);}},{key:"per",value:function per(){var r=this.x,t=this.y;return this.x=t,this.y=-r,this;}},{key:"uni",value:function uni(){return _.Uni(this);}},{key:"tan",value:function tan(r){return _.Tan(this,r);}},{key:"dist",value:function dist(r){return _.Dist(this,r);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(r,t){return _.DistanceToLineSegment(r,t,this);}},{key:"slope",value:function slope(r){return _.Slope(this,r);}},{key:"snapToGrid",value:function snapToGrid(r){return this.x=Math.round(this.x/r)*r,this.y=Math.round(this.y/r)*r,this;}},{key:"angle",value:function angle(r){return _.Angle(this,r);}},{key:"toAngle",value:function toAngle(){return _.ToAngle(this);}},{key:"lrp",value:function lrp(r,t){return this.x=this.x+(r.x-this.x)*t,this.y=this.y+(r.y-this.y)*t,this;}},{key:"equals",value:function equals(r,t){return _.Equals(this,r,t);}},{key:"equalsXY",value:function equalsXY(r,t){return _.EqualsXY(this,r,t);}},{key:"norm",value:function norm(){var r=this.len();return this.x=r===0?0:this.x/r,this.y=r===0?0:this.y/r,this;}},{key:"toFixed",value:function toFixed(){return _.ToFixed(this);}},{key:"toString",value:function toString(){return _.ToString(_.ToFixed(this));}},{key:"toJson",value:function toJson(){return _.ToJson(this);}},{key:"toArray",value:function toArray(){return _.ToArray(this);}}],[{key:"Add",value:function Add(r,t){return new _(r.x+t.x,r.y+t.y);}},{key:"AddXY",value:function AddXY(r,t,e){return new _(r.x+t,r.y+e);}},{key:"Sub",value:function Sub(r,t){return new _(r.x-t.x,r.y-t.y);}},{key:"SubXY",value:function SubXY(r,t,e){return new _(r.x-t,r.y-e);}},{key:"AddScalar",value:function AddScalar(r,t){return new _(r.x+t,r.y+t);}},{key:"SubScalar",value:function SubScalar(r,t){return new _(r.x-t,r.y-t);}},{key:"Div",value:function Div(r,t){return new _(r.x/t,r.y/t);}},{key:"Mul",value:function Mul(r,t){return new _(r.x*t,r.y*t);}},{key:"DivV",value:function DivV(r,t){return new _(r.x/t.x,r.y/t.y);}},{key:"MulV",value:function MulV(r,t){return new _(r.x*t.x,r.y*t.y);}},{key:"Neg",value:function Neg(r){return new _(-r.x,-r.y);}},{key:"Per",value:function Per(r){return new _(r.y,-r.x);}},{key:"Dist2",value:function Dist2(r,t){return _.Sub(r,t).len2();}},{key:"Abs",value:function Abs(r){return new _(Math.abs(r.x),Math.abs(r.y));}},{key:"Dist",value:function Dist(r,t){return Math.hypot(r.y-t.y,r.x-t.x);}},{key:"Dpr",value:function Dpr(r,t){return r.x*t.x+r.y*t.y;}},{key:"Cross",value:function Cross(r,t){return new _(r.y*t.z-r.z*t.y,r.z*t.x-r.x*t.z// A.z = A.x * V.y - A.y * V.x
1
+ var _excluded=["toolsType"],_excluded2=["callback"],_excluded3=["rect","willUpdateNodes","scenePath"],_excluded4=["render"],_excluded5=["render"];function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)o=s[r],t.includes(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(e.includes(n))continue;t[n]=r[n];}return t;}function _superPropSet(t,e,o,r,p,f){return _set(_getPrototypeOf(f?t.prototype:t),e,o,r,p);}function set(e,r,t,o){return set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,o){var f,i=_superPropBase(e,r);if(i){if((f=Object.getOwnPropertyDescriptor(i,r)).set)return f.set.call(o,t),!0;if(!f.writable)return!1;}if(f=Object.getOwnPropertyDescriptor(o,r)){if(!f.writable)return!1;f.value=t,Object.defineProperty(o,r,f);}else _defineProperty(o,r,t);return!0;},set(e,r,t,o);}function _set(e,r,t,o,f){if(!set(e,r,t,o||e)&&f)throw new TypeError("failed to set property");return t;}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 _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 _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]");}catch(n){return"function"==typeof t;}}function _superPropGet(t,e,r,o){var p=_get(_getPrototypeOf(1&o?t.prototype:t),e,r);return 2&o?function(t){return p.apply(r,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 _toArray(r){return _arrayWithHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableRest();}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 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 _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 _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 _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 _n7=0,F=function F(){};return{s:F,n:function n(){return _n7>=r.length?{done:!0}:{done:!1,value:r[_n7++]};},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 _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 _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}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 _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 _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 _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 Di=Object.defineProperty;var Ni=function Ni(h,r,t){return r in h?Di(h,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[r]=t;};var et=function et(h,r,t){return Ni(h,_typeof(r)!="symbol"?r+"":r,t);};var Lt=/* @__PURE__ */function(h){return h.Normal="Normal",h.Stroke="Stroke",h.Dotted="Dotted",h.LongDotted="LongDotted",h;}(Lt||{}),bt=/* @__PURE__ */function(h){return h.None="None",h.ShowFloatBar="ShowFloatBar",h.ZIndexFloatBar="ZIndexFloatBar",h.DeleteNode="DeleteNode",h.CopyNode="CopyNode",h.ZIndexActive="ZIndexActive",h.ZIndexNode="ZIndexNode",h.RotateNode="RotateNode",h.SetColorNode="SetColorNode",h.TranslateNode="TranslateNode",h.ScaleNode="ScaleNode",h.OriginalEvent="OriginalEvent",h.CreateScene="CreateScene",h.ActiveCursor="ActiveCursor",h.MoveCursor="MoveCursor",h.CommandEditor="CommandEditor",h.SetEditorData="SetEditorData",h.SetFontStyle="SetFontStyle",h.SetPoint="SetPoint",h.SetLock="SetLock",h.SetShapeOpt="SetShapeOpt",h.CameraChange="CameraChange",h.ActiveMethod="ActiveMethod",h;}(bt||{}),ut=/* @__PURE__ */function(h){return h[h.Pencil=1]="Pencil",h[h.Eraser=2]="Eraser",h[h.PencilEraser=3]="PencilEraser",h[h.BitMapEraser=4]="BitMapEraser",h[h.Selector=5]="Selector",h[h.Clicker=6]="Clicker",h[h.Arrow=7]="Arrow",h[h.Hand=8]="Hand",h[h.LaserPen=9]="LaserPen",h[h.Text=10]="Text",h[h.Straight=11]="Straight",h[h.Rectangle=12]="Rectangle",h[h.Ellipse=13]="Ellipse",h[h.Star=14]="Star",h[h.Triangle=15]="Triangle",h[h.Rhombus=16]="Rhombus",h[h.Polygon=17]="Polygon",h[h.SpeechBalloon=18]="SpeechBalloon",h[h.Image=19]="Image",h;}(ut||{}),Mt=/* @__PURE__ */function(h){return h[h.Local=1]="Local",h[h.Service=2]="Service",h[h.Worker=3]="Worker",h;}(Mt||{}),It=/* @__PURE__ */function(h){return h[h.Pending=0]="Pending",h[h.Start=1]="Start",h[h.Doing=2]="Doing",h[h.Done=3]="Done",h[h.Unwritable=4]="Unwritable",h;}(It||{}),lt=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Init=1]="Init",h[h.UpdateCamera=2]="UpdateCamera",h[h.UpdateTools=3]="UpdateTools",h[h.CreateWork=4]="CreateWork",h[h.DrawWork=5]="DrawWork",h[h.FullWork=6]="FullWork",h[h.UpdateNode=7]="UpdateNode",h[h.RemoveNode=8]="RemoveNode",h[h.Clear=9]="Clear",h[h.Select=10]="Select",h[h.Destroy=11]="Destroy",h[h.Snapshot=12]="Snapshot",h[h.BoundingBox=13]="BoundingBox",h[h.Cursor=14]="Cursor",h[h.TextUpdate=15]="TextUpdate",h[h.GetTextActive=16]="GetTextActive",h[h.TasksQueue=17]="TasksQueue",h[h.CursorHover=18]="CursorHover",h[h.CursorBlur=19]="CursorBlur",h[h.Console=20]="Console",h[h.PriorityWorker=21]="PriorityWorker",h[h.PriorityMainThreadWorker=22]="PriorityMainThreadWorker",h[h.GetImageBitMap=23]="GetImageBitMap",h[h.AuthWriter=24]="AuthWriter",h[h.AuthReader=25]="AuthReader",h[h.AuthClear=26]="AuthClear",h[h.AuthPage=27]="AuthPage",h;}(lt||{}),ve=/* @__PURE__ */function(h){return h.Webgl2="webgl2",h.Webgl="webgl",h.Canvas2d="2d",h;}(ve||{}),St=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Bg=1]="Bg",h[h.ServiceFloat=2]="ServiceFloat",h[h.Float=3]="Float",h[h.TopFloat=4]="TopFloat",h;}(St||{}),jt=/* @__PURE__ */function(h){return h[h.none=1]="none",h[h.all=2]="all",h[h.both=3]="both",h[h.proportional=4]="proportional",h;}(jt||{}),Me=/* @__PURE__ */function(h){return h[h.inside=0]="inside",h[h.outside=1]="outside",h[h.intersect=2]="intersect",h;}(Me||{});var te=/*#__PURE__*/function(){function te(){_classCallCheck(this,te);et(this,"localWork");et(this,"serviceWork");et(this,"threadEngine");}return _createClass(te,[{key:"registerForWorker",value:function registerForWorker(r){return this.threadEngine=r,this.localWork=r.localWork,this.serviceWork=r.serviceWork,this;}}]);}();var Wi=/*#__PURE__*/function(_te){function Wi(){var _this;_classCallCheck(this,Wi);_this=_callSuper(this,Wi,arguments);et(_this,"emitEventType",bt.CopyNode);return _this;}_inherits(Wi,_te);return _createClass(Wi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.FullWork&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var n,e;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:e=t.workId;_context.t0=e;if(!_context.t0){_context.next=5;break;}_context.next=5;return(n=this.localWork)==null?void 0:n.consumeFull(t);case 5:case"end":return _context.stop();}},_callee,this);}));function consumeForLocalWorker(_x){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(te);var We="++",Nt="selector",Bi="all";var Fi=/*#__PURE__*/function(_te2){function Fi(){var _this2;_classCallCheck(this,Fi);_this2=_callSuper(this,Fi,arguments);et(_this2,"emitEventType",bt.SetColorNode);return _this2;}_inherits(Fi,_te2);return _createClass(Fi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context2.t0=e===Nt&&n;if(!_context2.t0){_context2.next=5;break;}_context2.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context2.stop();}},_callee2,this);}));function consumeForLocalWorker(_x2){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=e.textUpdateForWoker,l=n.render||[],d=n.sp||[];if(a){var _iterator2=_createForOfIteratorHelper(i.entries()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _step2$value=_slicedToArray(_step2.value,2),c=_step2$value[0],p=_step2$value[1];s&&p.toolsType===ut.Text?d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return{render:l,sp:d};}}]);}(te);var Ui=/*#__PURE__*/function(_te3){function Ui(){var _this3;_classCallCheck(this,Ui);_this3=_callSuper(this,Ui,arguments);et(_this3,"emitEventType",bt.ZIndexNode);return _this3;}_inherits(Ui,_te3);return _createClass(Ui,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context3.t0=e===Nt&&n;if(!_context3.t0){_context3.next=5;break;}_context3.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context3.stop();}},_callee3,this);}));function consumeForLocalWorker(_x3){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator3=_createForOfIteratorHelper(i.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),d=_step3$value[0],c=_step3$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return{render:s,sp:l};}}]);}(te);var ji=/*#__PURE__*/function(_te4){function ji(){var _this4;_classCallCheck(this,ji);_this4=_callSuper(this,ji,arguments);et(_this4,"emitEventType",bt.TranslateNode);return _this4;}_inherits(ji,_te4);return _createClass(ji,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(t){var d,c,e,n,i,a,o,s,l;return _regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker,l=t.emitEventType;_context4.t0=e===Nt&&n;if(!_context4.t0){_context4.next=9;break;}if(!(n.workState===It.Done&&n!=null&&n.translate&&(n.translate[0]||n.translate[1])||n.workState!==It.Done)){_context4.next=8;break;}_context4.next=6;return(d=this.localWork)==null?void 0:d.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,isSync:!0,textUpdateForWoker:s,emitEventType:l,callback:this.updateSelectorCallback});case 6:_context4.next=9;break;case 8:n.workState===It.Done&&((c=this.localWork)==null||c.vNodes.deleteLastTarget());case 9:case"end":return _context4.stop();}},_callee4,this);}));function consumeForLocalWorker(_x4){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=d.workState,y=n.render||[],P=n.sp||[];if(p===It.Start)return{sp:[],render:[]};var T=o==null?void 0:o.selectRect;if(s){P.push({type:lt.Select,selectIds:a.selectIds,selectRect:T,willSyncService:!0,isSync:!0,points:p===It.Done&&a.getChildrenPoints()||void 0,textOpt:a.textOpt});var _iterator4=_createForOfIteratorHelper(i.entries()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),v=_step4$value[0],x=_step4$value[1];c&&x.toolsType===ut.Text?P.push(_objectSpread(_objectSpread({},x),{},{workId:v,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):P.push(_objectSpread(_objectSpread({},x),{},{workId:v,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}return{render:y,sp:P};}}]);}(te);var $i=/*#__PURE__*/function(_te5){function $i(){var _this5;_classCallCheck(this,$i);_this5=_callSuper(this,$i,arguments);et(_this5,"emitEventType",bt.DeleteNode);return _this5;}_inherits($i,_te5);return _createClass($i,[{key:"consume",value:function consume(){return!1;}}]);}(te);var zi=/*#__PURE__*/function(_te6){function zi(){var _this6;_classCallCheck(this,zi);_this6=_callSuper(this,zi,arguments);et(_this6,"emitEventType",bt.ScaleNode);return _this6;}_inherits(zi,_te6);return _createClass(zi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(t){var o,e,n,i,a;return _regeneratorRuntime().wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willSyncService,a=t.willSerializeData;_context5.t0=e===Nt&&n;if(!_context5.t0){_context5.next=5;break;}_context5.next=5;return(o=this.localWork)==null?void 0:o.updateSelector({updateSelectorOpt:n,willSyncService:i,willSerializeData:a,isSync:!0,callback:this.updateSelectorCallback.bind(this)});case 5:case"end":return _context5.stop();}},_callee5,this);}));function consumeForLocalWorker(_x5){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=s.workState,c=n.render||[],p=n.sp||[],y=a==null?void 0:a.selectRect;if(d===It.Start)return{sp:[],render:[]};if(l){p.push({type:lt.Select,selectIds:i.selectIds,selectRect:y,willSyncService:!0,isSync:!0,points:d===It.Done&&i.getChildrenPoints()||void 0,textOpt:i.textOpt});var _iterator5=_createForOfIteratorHelper(o.entries()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,2),P=_step5$value[0],T=_step5$value[1];T.toolsType===ut.Text?p.push(_objectSpread(_objectSpread({},T),{},{workId:P,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):p.push(_objectSpread(_objectSpread({},T),{},{workId:P,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:!0}));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}return{render:c,sp:p};}}]);}(te);var Gi=/*#__PURE__*/function(_te7){function Gi(){var _this7;_classCallCheck(this,Gi);_this7=_callSuper(this,Gi,arguments);et(_this7,"emitEventType",bt.RotateNode);return _this7;}_inherits(Gi,_te7);return _createClass(Gi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.emitEventType;_context6.t0=e===Nt&&n;if(!_context6.t0){_context6.next=5;break;}_context6.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,emitEventType:s,isSync:!0,callback:this.updateSelectorCallback});case 5:case"end":return _context6.stop();}},_callee6,this);}));function consumeForLocalWorker(_x6){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=e.willSerializeData,c=e.isSync,p=s.workState,y=n.render||[],P=n.sp||[],T=a==null?void 0:a.selectRect;if(l){d&&p===It.Done&&P.push({type:lt.Select,selectIds:i.selectIds,selectRect:T,willSyncService:!0,isSync:c,points:i.getChildrenPoints(),textOpt:i.textOpt,selectorColor:i.selectorColor,strokeColor:i.strokeColor,fillColor:i.fillColor,canTextEdit:i.canTextEdit,canRotate:i.canRotate,scaleType:i.scaleType,opt:i.getWorkOptions()||void 0,canLock:i.canLock,isLocked:i.isLocked,toolsTypes:i.toolsTypes,shapeOpt:i.shapeOpt,thickness:i.thickness,useStroke:i.useStroke,strokeType:i.strokeType});var _iterator6=_createForOfIteratorHelper(o.entries()),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _step6$value=_slicedToArray(_step6.value,2),v=_step6$value[0],x=_step6$value[1];P.push(_objectSpread(_objectSpread({},x),{},{workId:v,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:c}));}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}return{render:y,sp:P};}}]);}(te);var Hi=/*#__PURE__*/function(_te8){function Hi(){var _this8;_classCallCheck(this,Hi);_this8=_callSuper(this,Hi,arguments);et(_this8,"emitEventType",bt.SetFontStyle);return _this8;}_inherits(Hi,_te8);return _createClass(Hi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee7$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context7.t0=e===Nt&&n;if(!_context7.t0){_context7.next=5;break;}_context7.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context7.stop();}},_callee7,this);}));function consumeForLocalWorker(_x7){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=n.render||[],y=n.sp||[],P=o==null?void 0:o.selectRect;if(s&&y){d.fontSize&&y.push({type:lt.Select,selectIds:a.selectIds,selectRect:P,willSyncService:s,isSync:l,points:a.getChildrenPoints()});var _iterator7=_createForOfIteratorHelper(i.entries()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _step7$value=_slicedToArray(_step7.value,2),T=_step7$value[0],v=_step7$value[1];c&&v.toolsType===ut.Text?y.push(_objectSpread(_objectSpread({},v),{},{workId:T,type:lt.TextUpdate,dataType:Mt.Local,willSyncService:!0})):y.push(_objectSpread(_objectSpread({},v),{},{workId:T,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}return{render:p,sp:y};}}]);}(te);var Ki=/*#__PURE__*/function(_te9){function Ki(){var _this9;_classCallCheck(this,Ki);_this9=_callSuper(this,Ki,arguments);et(_this9,"emitEventType",bt.SetPoint);return _this9;}_inherits(Ki,_te9);return _createClass(Ki,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context8.t0=e===Nt&&n;if(!_context8.t0){_context8.next=5;break;}_context8.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,emitEventType:this.emitEventType,willSerializeData:o,isSync:!0,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context8.stop();}},_callee8,this);}));function consumeForLocalWorker(_x8){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=n.render||[],c=n.sp||[],p=o==null?void 0:o.selectRect;if(s&&c){var _iterator8=_createForOfIteratorHelper(i.entries()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _step8$value=_slicedToArray(_step8.value,2),y=_step8$value[0],P=_step8$value[1];c.push(_objectSpread(_objectSpread({},P),{},{workId:y,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}c.push({type:lt.Select,selectIds:a.selectIds,selectRect:p,willSyncService:s,isSync:l,points:a.getChildrenPoints()});}return{render:d,sp:c};}}]);}(te);var Yi=/*#__PURE__*/function(_te10){function Yi(){var _this10;_classCallCheck(this,Yi);_this10=_callSuper(this,Yi,arguments);et(_this10,"emitEventType",bt.SetLock);return _this10;}_inherits(Yi,_te10);return _createClass(Yi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee9$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context9.t0=e===Nt&&n;if(!_context9.t0){_context9.next=5;break;}_context9.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context9.stop();}},_callee9,this);}));function consumeForLocalWorker(_x9){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=n.render||[],p=n.sp||[],y=o==null?void 0:o.selectRect;if(s&&p){var _iterator9=_createForOfIteratorHelper(i.entries()),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _step9$value=_slicedToArray(_step9.value,2),P=_step9$value[0],T=_step9$value[1];p.push(_objectSpread(_objectSpread({},T),{},{workId:P,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}p.push({isLocked:d.isLocked,selectorColor:a.selectorColor,scaleType:a.scaleType,canRotate:a.canRotate,type:lt.Select,selectIds:a.selectIds,selectRect:y,willSyncService:s,isSync:l});}return{render:c,sp:p};}}]);}(te);var Vi=/*#__PURE__*/function(_te11){function Vi(){var _this11;_classCallCheck(this,Vi);_this11=_callSuper(this,Vi,arguments);et(_this11,"emitEventType",bt.SetShapeOpt);return _this11;}_inherits(Vi,_te11);return _createClass(Vi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===lt.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker10=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee10$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context10.t0=e===Nt&&n;if(!_context10.t0){_context10.next=5;break;}_context10.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context10.stop();}},_callee10,this);}));function consumeForLocalWorker(_x10){return _consumeForLocalWorker10.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator10=_createForOfIteratorHelper(i.entries()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _step10$value=_slicedToArray(_step10.value,2),d=_step10$value[0],c=_step10$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:lt.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}return{render:s,sp:l};}}]);}(te);var Xi=/*#__PURE__*/function(){function Xi(r){var _this12=this;_classCallCheck(this,Xi);et(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(r.map(function(t){return[t,_this12.build(t)];}));}return _createClass(Xi,[{key:"build",value:function build(r){switch(r){case bt.TranslateNode:return new ji();case bt.ZIndexNode:return new Ui();case bt.CopyNode:return new Wi();case bt.SetColorNode:return new Fi();case bt.DeleteNode:return new $i();case bt.ScaleNode:return new zi();case bt.RotateNode:return new Gi();case bt.SetFontStyle:return new Hi();case bt.SetPoint:return new Ki();case bt.SetLock:return new Yi();case bt.SetShapeOpt:return new Vi();}}},{key:"registerForWorker",value:function registerForWorker(r){return this.builders.forEach(function(t){t&&t.registerForWorker(r);}),this;}},{key:"consumeForWorker",value:function consumeForWorker(r){var _iterator11=_createForOfIteratorHelper(this.builders.values()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var t=_step11.value;if(t!=null&&t.consume(r))return!0;}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return!1;}}]);}();var ki={linear:function linear(h){return h;},easeInQuad:function easeInQuad(h){return h*h;},easeOutQuad:function easeOutQuad(h){return h*(2-h);},easeInOutQuad:function easeInOutQuad(h){return h<0.5?2*h*h:-1+(4-2*h)*h;},easeInCubic:function easeInCubic(h){return h*h*h;},easeOutCubic:function easeOutCubic(h){return--h*h*h+1;},easeInOutCubic:function easeInOutCubic(h){return h<0.5?4*h*h*h:(h-1)*(2*h-2)*(2*h-2)+1;},easeInQuart:function easeInQuart(h){return h*h*h*h;},easeOutQuart:function easeOutQuart(h){return 1- --h*h*h*h;},easeInOutQuart:function easeInOutQuart(h){return h<0.5?8*h*h*h*h:1-8*--h*h*h*h;},easeInQuint:function easeInQuint(h){return h*h*h*h*h;},easeOutQuint:function easeOutQuint(h){return 1+--h*h*h*h*h;},easeInOutQuint:function easeInOutQuint(h){return h<0.5?16*h*h*h*h*h:1+16*--h*h*h*h*h;},easeInSine:function easeInSine(h){return 1-Math.cos(h*Math.PI/2);},easeOutSine:function easeOutSine(h){return Math.sin(h*Math.PI/2);},easeInOutSine:function easeInOutSine(h){return-(Math.cos(Math.PI*h)-1)/2;},easeInExpo:function easeInExpo(h){return h<=0?0:Math.pow(2,10*h-10);},easeOutExpo:function easeOutExpo(h){return h>=1?1:1-Math.pow(2,-10*h);},easeInOutExpo:function easeInOutExpo(h){return h<=0?0:h>=1?1:h<0.5?Math.pow(2,20*h-10)/2:(2-Math.pow(2,-20*h+10))/2;}};var _=/*#__PURE__*/function(){function _(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,_);this.x=r,this.y=t,this.z=e;}return _createClass(_,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(r){return this.z=r,this;}},{key:"setXY",value:function setXY(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;return this.x=r,this.y=t,this;}},{key:"set",value:function set(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=r,this.y=t,this.z=e,this;}},{key:"setTo",value:function setTo(_ref){var _ref$x=_ref.x,r=_ref$x===void 0?0:_ref$x,_ref$y=_ref.y,t=_ref$y===void 0?0:_ref$y,_ref$z=_ref.z,e=_ref$z===void 0?1:_ref$z;return this.x=r,this.y=t,this.z=e,this;}},{key:"rot",value:function rot(r){if(r===0)return this;var t=this.x,e=this.y,n=Math.sin(r),i=Math.cos(r);return this.x=t*i-e*n,this.y=t*n+e*i,this;}},{key:"rotWith",value:function rotWith(r,t){if(t===0)return this;var e=this.x-r.x,n=this.y-r.y,i=Math.sin(t),a=Math.cos(t);return this.x=r.x+(e*a-n*i),this.y=r.y+(e*i+n*a),this;}},{key:"clone",value:function clone(){var r=this.x,t=this.y,e=this.z;return new _(r,t,e);}},{key:"sub",value:function sub(r){return this.x-=r.x,this.y-=r.y,this;}},{key:"subXY",value:function subXY(r,t){return this.x-=r,this.y-=t,this;}},{key:"subScalar",value:function subScalar(r){return this.x-=r,this.y-=r,this;}},{key:"add",value:function add(r){return this.x+=r.x,this.y+=r.y,this;}},{key:"addXY",value:function addXY(r,t){return this.x+=r,this.y+=t,this;}},{key:"addScalar",value:function addScalar(r){return this.x+=r,this.y+=r,this;}},{key:"clamp",value:function clamp(r,t){return this.x=Math.max(this.x,r),this.y=Math.max(this.y,r),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this;}},{key:"div",value:function div(r){return this.x/=r,this.y/=r,this;}},{key:"divV",value:function divV(r){return this.x/=r.x,this.y/=r.y,this;}},{key:"mul",value:function mul(r){return this.x*=r,this.y*=r,this;}},{key:"mulV",value:function mulV(r){return this.x*=r.x,this.y*=r.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(r,t){var e=_.Tan(r,this);return this.add(e.mul(t));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(r){return this.x=this.y*r.z-this.z*r.y,this.y=this.z*r.x-this.x*r.z,this;}},{key:"dpr",value:function dpr(r){return _.Dpr(this,r);}},{key:"cpr",value:function cpr(r){return _.Cpr(this,r);}},{key:"len2",value:function len2(){return _.Len2(this);}},{key:"len",value:function len(){return _.Len(this);}},{key:"pry",value:function pry(r){return _.Pry(this,r);}},{key:"per",value:function per(){var r=this.x,t=this.y;return this.x=t,this.y=-r,this;}},{key:"uni",value:function uni(){return _.Uni(this);}},{key:"tan",value:function tan(r){return _.Tan(this,r);}},{key:"dist",value:function dist(r){return _.Dist(this,r);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(r,t){return _.DistanceToLineSegment(r,t,this);}},{key:"slope",value:function slope(r){return _.Slope(this,r);}},{key:"snapToGrid",value:function snapToGrid(r){return this.x=Math.round(this.x/r)*r,this.y=Math.round(this.y/r)*r,this;}},{key:"angle",value:function angle(r){return _.Angle(this,r);}},{key:"toAngle",value:function toAngle(){return _.ToAngle(this);}},{key:"lrp",value:function lrp(r,t){return this.x=this.x+(r.x-this.x)*t,this.y=this.y+(r.y-this.y)*t,this;}},{key:"equals",value:function equals(r,t){return _.Equals(this,r,t);}},{key:"equalsXY",value:function equalsXY(r,t){return _.EqualsXY(this,r,t);}},{key:"norm",value:function norm(){var r=this.len();return this.x=r===0?0:this.x/r,this.y=r===0?0:this.y/r,this;}},{key:"toFixed",value:function toFixed(){return _.ToFixed(this);}},{key:"toString",value:function toString(){return _.ToString(_.ToFixed(this));}},{key:"toJson",value:function toJson(){return _.ToJson(this);}},{key:"toArray",value:function toArray(){return _.ToArray(this);}}],[{key:"Add",value:function Add(r,t){return new _(r.x+t.x,r.y+t.y);}},{key:"AddXY",value:function AddXY(r,t,e){return new _(r.x+t,r.y+e);}},{key:"Sub",value:function Sub(r,t){return new _(r.x-t.x,r.y-t.y);}},{key:"SubXY",value:function SubXY(r,t,e){return new _(r.x-t,r.y-e);}},{key:"AddScalar",value:function AddScalar(r,t){return new _(r.x+t,r.y+t);}},{key:"SubScalar",value:function SubScalar(r,t){return new _(r.x-t,r.y-t);}},{key:"Div",value:function Div(r,t){return new _(r.x/t,r.y/t);}},{key:"Mul",value:function Mul(r,t){return new _(r.x*t,r.y*t);}},{key:"DivV",value:function DivV(r,t){return new _(r.x/t.x,r.y/t.y);}},{key:"MulV",value:function MulV(r,t){return new _(r.x*t.x,r.y*t.y);}},{key:"Neg",value:function Neg(r){return new _(-r.x,-r.y);}},{key:"Per",value:function Per(r){return new _(r.y,-r.x);}},{key:"Dist2",value:function Dist2(r,t){return _.Sub(r,t).len2();}},{key:"Abs",value:function Abs(r){return new _(Math.abs(r.x),Math.abs(r.y));}},{key:"Dist",value:function Dist(r,t){return Math.hypot(r.y-t.y,r.x-t.x);}},{key:"Dpr",value:function Dpr(r,t){return r.x*t.x+r.y*t.y;}},{key:"Cross",value:function Cross(r,t){return new _(r.y*t.z-r.z*t.y,r.z*t.x-r.x*t.z// A.z = A.x * V.y - A.y * V.x
2
2
  );}},{key:"Cpr",value:function Cpr(r,t){return r.x*t.y-t.x*r.y;}},{key:"Len2",value:function Len2(r){return r.x*r.x+r.y*r.y;}},{key:"Len",value:function Len(r){return Math.hypot(r.x,r.y);}},{key:"Pry",value:function Pry(r,t){return _.Dpr(r,t)/_.Len(t);}},{key:"Uni",value:function Uni(r){return _.Div(r,_.Len(r));}},{key:"Tan",value:function Tan(r,t){return _.Uni(_.Sub(r,t));}},{key:"Min",value:function Min(r,t){return new _(Math.min(r.x,t.x),Math.min(r.y,t.y));}},{key:"Max",value:function Max(r,t){return new _(Math.max(r.x,t.x),Math.max(r.y,t.y));}},{key:"From",value:function From(r){return new _().add(r);}},{key:"FromArray",value:function FromArray(r){return new _(r[0],r[1]);}},{key:"Rot",value:function Rot(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=Math.sin(t),n=Math.cos(t);return new _(r.x*n-r.y*e,r.x*e+r.y*n);}},{key:"RotWith",value:function RotWith(r,t,e){var n=r.x-t.x,i=r.y-t.y,a=Math.sin(e),o=Math.cos(e);return new _(t.x+(n*o-i*a),t.y+(n*a+i*o));}/**
3
3
  * Get the nearest point on a line with a known unit vector that passes through point A
4
4
  *
@@ -396,7 +396,7 @@ _inherits(o,_e$default22);return _createClass(o,[{key:"texture",get:function get
396
396
  l=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
397
397
  n&&(l=="offset"||l=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
398
398
  i&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||// Skip index properties.
399
- pc(l,s)))&&o.push(l);return o;}var Jn=Sc,xc=Object.prototype;function Tc(h){var r=h&&h.constructor,t=typeof r=="function"&&r.prototype||xc;return h===t;}var Er=Tc;function Mc(h,r){return function(t){return h(r(t));};}var Zn=Mc,Pc=Zn,Oc=Pc(Object.keys,Object),Ec=Oc,Cc=Er,Ac=Ec,Rc=Object.prototype,Ic=Rc.hasOwnProperty;function Lc(h){if(!Cc(h))return Ac(h);var r=[];for(var t in Object(h))Ic.call(h,t)&&t!="constructor"&&r.push(t);return r;}var bc=Lc,wc=Un,Dc=Xn;function Nc(h){return h!=null&&Dc(h.length)&&!wc(h);}var Cr=Nc,Wc=Jn,Bc=bc,Fc=Cr;function Uc(h){return Fc(h)?Wc(h):Bc(h);}var Ar=Uc,jc=sr,$c=Ar;function zc(h,r){return h&&jc(r,$c(r),h);}var Gc=zc;function Hc(h){var r=[];if(h!=null)for(var t in Object(h))r.push(t);return r;}var Kc=Hc,Yc=he,Vc=Er,Xc=Kc,kc=Object.prototype,Jc=kc.hasOwnProperty;function Zc(h){if(!Yc(h))return Xc(h);var r=Vc(h),t=[];for(var e in h)e=="constructor"&&(r||!Jc.call(h,e))||t.push(e);return t;}var Qc=Zc,qc=Jn,_c=Qc,tf=Cr;function ef(h){return tf(h)?qc(h,!0):_c(h);}var Rr=ef,rf=sr,nf=Rr;function sf(h,r){return h&&rf(r,nf(r),h);}var of=sf,Ye={exports:{}};Ye.exports;(function(h,r){var t=ee,e=r&&!r.nodeType&&r,n=e&&!0&&h&&!h.nodeType&&h,i=n&&n.exports===e,a=i?t.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(l,d){if(d)return l.slice();var c=l.length,p=o?o(c):new l.constructor(c);return l.copy(p),p;}h.exports=s;})(Ye,Ye.exports);var af=Ye.exports;function lf(h,r){var t=-1,e=h.length;for(r||(r=Array(e));++t<e;)r[t]=h[t];return r;}var cf=lf;function ff(h,r){for(var t=-1,e=h==null?0:h.length,n=0,i=[];++t<e;){var a=h[t];r(a,t,h)&&(i[n++]=a);}return i;}var Qn=ff;function hf(){return[];}var qn=hf,uf=Qn,df=qn,gf=Object.prototype,pf=gf.propertyIsEnumerable,_r=Object.getOwnPropertySymbols,mf=_r?function(h){return h==null?[]:(h=Object(h),uf(_r(h),function(r){return pf.call(h,r);}));}:df,Ir=mf,vf=sr,yf=Ir;function Sf(h,r){return vf(h,yf(h),r);}var xf=Sf;function Tf(h,r){for(var t=-1,e=r.length,n=h.length;++t<e;)h[n+t]=r[t];return h;}var Lr=Tf,Mf=Zn,Pf=Mf(Object.getPrototypeOf,Object),_n=Pf,Of=Lr,Ef=_n,Cf=Ir,Af=qn,Rf=Object.getOwnPropertySymbols,If=Rf?function(h){for(var r=[];h;)Of(r,Cf(h)),h=Ef(h);return r;}:Af,ti=If,Lf=sr,bf=ti;function wf(h,r){return Lf(h,bf(h),r);}var Df=wf,Nf=Lr,Wf=je;function Bf(h,r,t){var e=r(h);return Wf(h)?e:Nf(e,t(h));}var ei=Bf,Ff=ei,Uf=Ir,jf=Ar;function $f(h){return Ff(h,jf,Uf);}var ri=$f,zf=ei,Gf=ti,Hf=Rr;function Kf(h){return zf(h,Hf,Gf);}var Yf=Kf,Vf=ge,Xf=ee,kf=Vf(Xf,"DataView"),Jf=kf,Zf=ge,Qf=ee,qf=Zf(Qf,"Promise"),_f=qf,th=ge,eh=ee,rh=th(eh,"Set"),ni=rh,nh=ge,ih=ee,sh=nh(ih,"WeakMap"),oh=sh,gr=Jf,pr=Mr,mr=_f,vr=ni,yr=oh,ii=de,Re=jn,tn="[object Map]",ah="[object Object]",en="[object Promise]",rn="[object Set]",nn="[object WeakMap]",sn="[object DataView]",lh=Re(gr),ch=Re(pr),fh=Re(mr),hh=Re(vr),uh=Re(yr),ue=ii;(gr&&ue(new gr(new ArrayBuffer(1)))!=sn||pr&&ue(new pr())!=tn||mr&&ue(mr.resolve())!=en||vr&&ue(new vr())!=rn||yr&&ue(new yr())!=nn)&&(ue=function ue(h){var r=ii(h),t=r==ah?h.constructor:void 0,e=t?Re(t):"";if(e)switch(e){case lh:return sn;case ch:return tn;case fh:return en;case hh:return rn;case uh:return nn;}return r;});var ar=ue,dh=Object.prototype,gh=dh.hasOwnProperty;function ph(h){var r=h.length,t=new h.constructor(r);return r&&typeof h[0]=="string"&&gh.call(h,"index")&&(t.index=h.index,t.input=h.input),t;}var mh=ph,vh=ee,yh=vh.Uint8Array,si=yh,on=si;function Sh(h){var r=new h.constructor(h.byteLength);return new on(r).set(new on(h)),r;}var br=Sh,xh=br;function Th(h,r){var t=r?xh(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.byteLength);}var Mh=Th,Ph=/\w*$/;function Oh(h){var r=new h.constructor(h.source,Ph.exec(h));return r.lastIndex=h.lastIndex,r;}var Eh=Oh,an=Ue,ln=an?an.prototype:void 0,cn=ln?ln.valueOf:void 0;function Ch(h){return cn?Object(cn.call(h)):{};}var Ah=Ch,Rh=br;function Ih(h,r){var t=r?Rh(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.length);}var Lh=Ih,bh=br,wh=Mh,Dh=Eh,Nh=Ah,Wh=Lh,Bh="[object Boolean]",Fh="[object Date]",Uh="[object Map]",jh="[object Number]",$h="[object RegExp]",zh="[object Set]",Gh="[object String]",Hh="[object Symbol]",Kh="[object ArrayBuffer]",Yh="[object DataView]",Vh="[object Float32Array]",Xh="[object Float64Array]",kh="[object Int8Array]",Jh="[object Int16Array]",Zh="[object Int32Array]",Qh="[object Uint8Array]",qh="[object Uint8ClampedArray]",_h="[object Uint16Array]",tu="[object Uint32Array]";function eu(h,r,t){var e=h.constructor;switch(r){case Kh:return bh(h);case Bh:case Fh:return new e(+h);case Yh:return wh(h,t);case Vh:case Xh:case kh:case Jh:case Zh:case Qh:case qh:case _h:case tu:return Wh(h,t);case Uh:return new e();case jh:case Gh:return new e(h);case $h:return Dh(h);case zh:return new e();case Hh:return Nh(h);}}var ru=eu,nu=he,fn=Object.create,iu=/* @__PURE__ */function(){function h(){}return function(r){if(!nu(r))return{};if(fn)return fn(r);h.prototype=r;var t=new h();return h.prototype=void 0,t;};}(),su=iu,ou=su,au=_n,lu=Er;function cu(h){return typeof h.constructor=="function"&&!lu(h)?ou(au(h)):{};}var fu=cu,hu=ar,uu=ne,du="[object Map]";function gu(h){return uu(h)&&hu(h)==du;}var pu=gu,mu=pu,vu=or,hn=Or,un=hn&&hn.isMap,yu=un?vu(un):mu,Su=yu,xu=ar,Tu=ne,Mu="[object Set]";function Pu(h){return Tu(h)&&xu(h)==Mu;}var Ou=Pu,Eu=Ou,Cu=or,dn=Or,gn=dn&&dn.isSet,Au=gn?Cu(gn):Eu,oi=Au,Ru=/* @__PURE__ */fe(oi),Iu=zn,Lu=tl,bu=Kn,wu=Gc,Du=of,Nu=af,Wu=cf,Bu=xf,Fu=Df,Uu=ri,ju=Yf,$u=ar,zu=mh,Gu=ru,Hu=fu,Ku=je,Yu=Pr,Vu=Su,Xu=he,ku=oi,Ju=Ar,Zu=Rr,Qu=1,qu=2,_u=4,ai="[object Arguments]",td="[object Array]",ed="[object Boolean]",rd="[object Date]",nd="[object Error]",li="[object Function]",id="[object GeneratorFunction]",sd="[object Map]",od="[object Number]",ci="[object Object]",ad="[object RegExp]",ld="[object Set]",cd="[object String]",fd="[object Symbol]",hd="[object WeakMap]",ud="[object ArrayBuffer]",dd="[object DataView]",gd="[object Float32Array]",pd="[object Float64Array]",md="[object Int8Array]",vd="[object Int16Array]",yd="[object Int32Array]",Sd="[object Uint8Array]",xd="[object Uint8ClampedArray]",Td="[object Uint16Array]",Md="[object Uint32Array]",Ft={};Ft[ai]=Ft[td]=Ft[ud]=Ft[dd]=Ft[ed]=Ft[rd]=Ft[gd]=Ft[pd]=Ft[md]=Ft[vd]=Ft[yd]=Ft[sd]=Ft[od]=Ft[ci]=Ft[ad]=Ft[ld]=Ft[cd]=Ft[fd]=Ft[Sd]=Ft[xd]=Ft[Td]=Ft[Md]=!0;Ft[nd]=Ft[li]=Ft[hd]=!1;function Ge(h,r,t,e,n,i){var a,o=r&Qu,s=r&qu,l=r&_u;if(t&&(a=n?t(h,e,n,i):t(h)),a!==void 0)return a;if(!Xu(h))return h;var d=Ku(h);if(d){if(a=zu(h),!o)return Wu(h,a);}else{var c=$u(h),p=c==li||c==id;if(Yu(h))return Nu(h,o);if(c==ci||c==ai||p&&!n){if(a=s||p?{}:Hu(h),!o)return s?Fu(h,Du(a,h)):Bu(h,wu(a,h));}else{if(!Ft[c])return n?h:{};a=Gu(h,c,o);}}i||(i=new Iu());var y=i.get(h);if(y)return y;i.set(h,a),ku(h)?h.forEach(function(v){a.add(Ge(v,r,t,v,h,i));}):Vu(h)&&h.forEach(function(v,x){a.set(x,Ge(v,r,t,x,h,i));});var P=l?s?ju:Uu:s?Zu:Ju,T=d?void 0:P(h);return Lu(T||h,function(v,x){T&&(x=v,v=h[x]),bu(a,x,Ge(v,r,t,x,h,i));}),a;}var Pd=Ge,Od=Pd,Ed=1,Cd=4;function Ad(h){return Od(h,Ed|Cd);}var Rd=Ad,Xt=/* @__PURE__ */fe(Rd);var fi="1.1.1-beta.0",Id="@netless/appliance-plugin",Ld=typeof OffscreenCanvas=="function"?"worker":"mainThread";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var h=window.__netlessUA||"";h+=" ".concat(Id,"@").concat(fi,"_").concat(Ld),window.__netlessUA=h;}var re={syncOpt:{interval:500},canvasOpt:{contextType:ve.Canvas2d},cdn:{subWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/subWorker.js",fullWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/fullWorker.js"},cursor:{expirationTime:5e3},bufferSize:{full:2e4,sub:1e3},bezier:{combineUnitTime:100},pencilEraser:{useBitMap:!0}};function ae(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=h.length;if(t<2)return"";var e=h[0],n=h[1];if(t===2)return"M".concat(pe(e),"L").concat(pe(n));var i="";for(var a=2,o=t-1;a<o;a++)e=h[a],n=h[a+1],i+=me(e,n);return r?"M".concat(me(h[0],h[1]),"Q").concat(pe(h[1])).concat(me(h[1],h[2]),"T").concat(i).concat(me(h[t-1],h[0])).concat(me(h[0],h[1]),"Z"):"M".concat(pe(h[0]),"Q").concat(pe(h[1])).concat(me(h[1],h[2])).concat(h.length>3?"T":"").concat(i,"L").concat(pe(h[t-1]));}var Jt=/*#__PURE__*/function(){function Jt(r){_classCallCheck(this,Jt);et(this,"syncUnitTime",re.syncOpt.interval);et(this,"vNodes");et(this,"drawLayer");et(this,"fullLayer");et(this,"workId");var t=r.vNodes,e=r.fullLayer,n=r.drawLayer,i=r.workId,a=r.toolsOpt;this.vNodes=t,this.fullLayer=e,this.drawLayer=n,this.workId=i,this.syncUnitTime=a.syncUnitTime||this.syncUnitTime;}return _createClass(Jt,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return r.reduce(function(e,n){var i=e[e.length-1];return(n&&!i||n&&i&&!n.isNear(i,t))&&e.push(n),e;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(r){this.workId=r;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(r){var n,i,a;this.workOptions=r,this.syncUnitTime=r.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),e=t&&((i=this.vNodes)==null?void 0:i.get(t))||void 0;t&&e&&(e.opt=r,(a=this.vNodes)==null||a.setInfo(t,e));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(r){var n,i;var t;var e=(n=this.workId)==null?void 0:n.toString();if(e&&r){var a=this.fullLayer.getElementsByName(e)||this.drawLayer&&this.drawLayer.getElementsByName(e)||[];if(a.length!==1)return;var o=a[0],s=r.pos,l=r.zIndex,d=r.scale,c=r.angle,p=r.translate,y={};_t(l)&&(y.zIndex=l),s&&(y.pos=[s[0],s[1]]),d&&(y.scale=d),c&&(y.rotate=c),p&&(y.translate=p),o.attr(y);var P=o==null?void 0:o.getBoundingClientRect();return P&&(t=Pt(t,{x:Math.floor(P.x-Jt.SafeBorderPadding),y:Math.floor(P.y-Jt.SafeBorderPadding),w:Math.floor(P.width+Jt.SafeBorderPadding*2),h:Math.floor(P.height+Jt.SafeBorderPadding*2)})),(i=this.vNodes)==null||i.setInfo(e,{rect:t,centerPos:s}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(r){var t=r.group,e=r.eraserlines,n=r.pos,i=r.layer,_r$isClear=r.isClear,a=_r$isClear===void 0?!0:_r$isClear,o=!!i.parent.gl;var _iterator13=_createForOfIteratorHelper(e),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var l=s.thickness,d=s.op;var _iterator14=_createForOfIteratorHelper(d),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var c=_step14.value;var p=c.map(function(x,f){return f%2?x-n[1]:x-n[0];}),y=this.computEraserPoints(p,l),P=ae(y,!0),T={pos:[0,0],d:P,fillColor:"rgba(0,0,0,1)"},v=new ce(T);a&&(v.addEventListener("beforerender",function(_ref165){var x=_ref165.detail;var f=x.context;o?f.blendFuncSeparate(f.ZERO,f.ZERO,f.ZERO,f.ZERO):f.globalCompositeOperation="destination-out";}),v.addEventListener("afterrender",function(_ref166){var x=_ref166.detail;var f=x.context;o?f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA):f.globalCompositeOperation="source-over";})),t.append(v);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"computEraserPoints",value:function computEraserPoints(r,t){var e=Math.ceil(t/2);return r.length===2?this.computDot(r,e):this.computLine(r,e);}},{key:"computDot",value:function computDot(r,t){var e=new xt(r[0],r[1]);return xt.GetDotStroke(e,t,8);}},{key:"computLine",value:function computLine(r,t){var e=[],n=[];var i,a;for(var o=0;o<r.length;o+=2){var s=new xt(r[o],r[o+1]);var l=void 0;if(o==r.length-2){var d=new xt(r[o-2],r[o-1]);l=_.Sub(s,d).uni(),i=s;}else{o===0&&(a=s);var _d4=new xt(r[o+2],r[o+3]);l=_.Sub(_d4,s).uni();}if(l){var _d5=_.Per(l).mul(t);e.push(xt.Sub(s,_d5)),n.push(xt.Add(s,_d5));}}if(i&&a){var _o3=xt.GetSemicircleStroke(i,e[e.length-1],-1,8),_s4=xt.GetSemicircleStroke(a,n[0],-1,8);return e.concat(_o3,n.reverse(),_s4);}return[];}},{key:"replace",value:function replace(r,t,e){var _this61=this;var o;var n=r.getElementsByName(t),i=n.length;if(i){if(i>1)for(var s=1;s<n.length;s++)r.removeChild(n[s]),n[s].disconnect();e?r.replaceChild(e,n[0]):r.removeChild(n[0]),n[0].disconnect();}else e&&r.append(e);this.fullLayer===r?(o=this.drawLayer)==null||o.getElementsByName(t).forEach(function(s){var l;(l=_this61.drawLayer)==null||l.removeChild(s),s.disconnect();}):this.fullLayer.getElementsByName(t).forEach(function(s){_this61.fullLayer.removeChild(s),s.disconnect();});}}],[{key:"updateNodeOpt",value:function updateNodeOpt(r){var f;var t=r.node,e=r.opt,n=r.vNodes,i=r.willSerializeData,a=r.targetNode,o=e.zIndex,s=e.translate,l=e.angle,d=e.originPoint,c=e.scenePoint,p=e.scale,y=e.pointMap,P=e.thickness;var T;var v=a&&Xt(a)||n.get(t.name);if(!v)return;_t(o)&&(t.setAttribute("zIndex",o),v.opt.zIndex=o);var x=t.parent;if(x){if(d&&p&&a){var g=[v.op[0],v.op[1]];Ur(v.op,c,p,s);var u=[v.op[0],v.op[1]],m=[u[0]-g[0],u[1]-g[1]];if(v.centerPos=[v.centerPos[0]+m[0],v.centerPos[1]+m[1]],v.opt.translate=void 0,v.opt.scale=void 0,v.opt.eraserlines)for(var _i2=0,_Object$values=Object.values(v.opt.eraserlines);_i2<_Object$values.length;_i2++){var M=_Object$values[_i2];var E=M.op,R=M.thickness;M.thickness=R*Math.max(p[0],p[1]);for(var b=0;b<E.length;b++)jr(E[b],c,p,s);}}else if(s){if(t.setAttribute("translate",s),v.opt.translate=s,a){var _g6=[s[0]*x.worldScaling[0],s[1]*x.worldScaling[1]];T=xr(v.rect,_g6),v.rect=T;}else{var _g7=Jt.getRectFromLayer(x,t.name);v.rect=_g7||v.rect;}}else if(_t(l))if(t.setAttribute("rotate",l),v.opt.rotate=l,a)T=Ei(v.rect,l),v.rect=T;else{var _g8=Jt.getRectFromLayer(x,t.name);v.rect=_g8||v.rect;}if(y){var _g9=y.get(t.name);if(_g9)for(var _u10=0,_m9=0;_u10<v.op.length;_u10+=3,_m9++)v.op[_u10]=_g9[_m9][0],v.op[_u10+1]=_g9[_m9][1];}if(P&&(f=v==null?void 0:v.opt)!=null&&f.thickness&&(v.opt.thickness=P),i&&!(d&&p&&a)){if(s){var _g10=v.op.map(function(u,m){var M=m%3;return M===0?u+s[0]:M===1?u+s[1]:u;});if(v.op=_g10,v.centerPos=[v.centerPos[0]+s[0],v.centerPos[1]+s[1]],v!=null&&v.opt&&(v.opt.translate=void 0),v.opt.eraserlines)for(var _i3=0,_Object$values2=Object.values(v.opt.eraserlines);_i3<_Object$values2.length;_i3++){var _u11=_Object$values2[_i3];var _m10=_u11.op;for(var _M6=0;_M6<_m10.length;_M6++){var _E3=_m10[_M6].map(function(R,b){return b%2?R+s[1]:R+s[0];});_u11.op[_M6]=_E3;}}}else if(_t(l)){var _g11=v.op;if(Hg(_g11,v.centerPos,l),v.op=_g11,v!=null&&v.opt&&(v.opt.rotate=void 0),v.opt.eraserlines)for(var _i4=0,_Object$values3=Object.values(v.opt.eraserlines);_i4<_Object$values3.length;_i4++){var _u12=_Object$values3[_i4];var _m11=_u12.op;for(var _M7=0;_M7<_m11.length;_M7++)Kg(_m11[_M7],v.centerPos,l);}}}v&&n.setInfo(t.name,v);}}},{key:"getCenterPos",value:function getCenterPos(r,t){var e=t.worldPosition,n=t.worldScaling;return[(r.x+r.w/2-e[0])/n[0],(r.y+r.h/2-e[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(r,t){var e=r.getElementsByName(t)[0];if(e){var n=e.getBoundingClientRect();return{x:Math.floor(n.x-Jt.SafeBorderPadding),y:Math.floor(n.y-Jt.SafeBorderPadding),w:Math.floor(n.width+Jt.SafeBorderPadding*2),h:Math.floor(n.height+Jt.SafeBorderPadding*2)};}}}]);}();et(Jt,"SafeBorderPadding",10);var vt=Jt;var wr={exports:{}};wr.exports;(function(h){var r=function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={};function a(s,l){if(!i[s]){i[s]={};for(var d=0;d<s.length;d++)i[s][s.charAt(d)]=d;}return i[s][l];}var o={compressToBase64:function compressToBase64(s){if(s==null)return"";var l=o._compress(s,6,function(d){return e.charAt(d);});switch(l.length%4){default:case 0:return l;case 1:return l+"===";case 2:return l+"==";case 3:return l+"=";}},decompressFromBase64:function decompressFromBase64(s){return s==null?"":s==""?null:o._decompress(s.length,32,function(l){return a(e,s.charAt(l));});},compressToUTF16:function compressToUTF16(s){return s==null?"":o._compress(s,15,function(l){return t(l+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(s){return s==null?"":s==""?null:o._decompress(s.length,16384,function(l){return s.charCodeAt(l)-32;});},//compress into uint8array (UCS-2 big endian format)
399
+ pc(l,s)))&&o.push(l);return o;}var Jn=Sc,xc=Object.prototype;function Tc(h){var r=h&&h.constructor,t=typeof r=="function"&&r.prototype||xc;return h===t;}var Er=Tc;function Mc(h,r){return function(t){return h(r(t));};}var Zn=Mc,Pc=Zn,Oc=Pc(Object.keys,Object),Ec=Oc,Cc=Er,Ac=Ec,Rc=Object.prototype,Ic=Rc.hasOwnProperty;function Lc(h){if(!Cc(h))return Ac(h);var r=[];for(var t in Object(h))Ic.call(h,t)&&t!="constructor"&&r.push(t);return r;}var bc=Lc,wc=Un,Dc=Xn;function Nc(h){return h!=null&&Dc(h.length)&&!wc(h);}var Cr=Nc,Wc=Jn,Bc=bc,Fc=Cr;function Uc(h){return Fc(h)?Wc(h):Bc(h);}var Ar=Uc,jc=sr,$c=Ar;function zc(h,r){return h&&jc(r,$c(r),h);}var Gc=zc;function Hc(h){var r=[];if(h!=null)for(var t in Object(h))r.push(t);return r;}var Kc=Hc,Yc=he,Vc=Er,Xc=Kc,kc=Object.prototype,Jc=kc.hasOwnProperty;function Zc(h){if(!Yc(h))return Xc(h);var r=Vc(h),t=[];for(var e in h)e=="constructor"&&(r||!Jc.call(h,e))||t.push(e);return t;}var Qc=Zc,qc=Jn,_c=Qc,tf=Cr;function ef(h){return tf(h)?qc(h,!0):_c(h);}var Rr=ef,rf=sr,nf=Rr;function sf(h,r){return h&&rf(r,nf(r),h);}var of=sf,Ye={exports:{}};Ye.exports;(function(h,r){var t=ee,e=r&&!r.nodeType&&r,n=e&&!0&&h&&!h.nodeType&&h,i=n&&n.exports===e,a=i?t.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(l,d){if(d)return l.slice();var c=l.length,p=o?o(c):new l.constructor(c);return l.copy(p),p;}h.exports=s;})(Ye,Ye.exports);var af=Ye.exports;function lf(h,r){var t=-1,e=h.length;for(r||(r=Array(e));++t<e;)r[t]=h[t];return r;}var cf=lf;function ff(h,r){for(var t=-1,e=h==null?0:h.length,n=0,i=[];++t<e;){var a=h[t];r(a,t,h)&&(i[n++]=a);}return i;}var Qn=ff;function hf(){return[];}var qn=hf,uf=Qn,df=qn,gf=Object.prototype,pf=gf.propertyIsEnumerable,_r=Object.getOwnPropertySymbols,mf=_r?function(h){return h==null?[]:(h=Object(h),uf(_r(h),function(r){return pf.call(h,r);}));}:df,Ir=mf,vf=sr,yf=Ir;function Sf(h,r){return vf(h,yf(h),r);}var xf=Sf;function Tf(h,r){for(var t=-1,e=r.length,n=h.length;++t<e;)h[n+t]=r[t];return h;}var Lr=Tf,Mf=Zn,Pf=Mf(Object.getPrototypeOf,Object),_n=Pf,Of=Lr,Ef=_n,Cf=Ir,Af=qn,Rf=Object.getOwnPropertySymbols,If=Rf?function(h){for(var r=[];h;)Of(r,Cf(h)),h=Ef(h);return r;}:Af,ti=If,Lf=sr,bf=ti;function wf(h,r){return Lf(h,bf(h),r);}var Df=wf,Nf=Lr,Wf=je;function Bf(h,r,t){var e=r(h);return Wf(h)?e:Nf(e,t(h));}var ei=Bf,Ff=ei,Uf=Ir,jf=Ar;function $f(h){return Ff(h,jf,Uf);}var ri=$f,zf=ei,Gf=ti,Hf=Rr;function Kf(h){return zf(h,Hf,Gf);}var Yf=Kf,Vf=ge,Xf=ee,kf=Vf(Xf,"DataView"),Jf=kf,Zf=ge,Qf=ee,qf=Zf(Qf,"Promise"),_f=qf,th=ge,eh=ee,rh=th(eh,"Set"),ni=rh,nh=ge,ih=ee,sh=nh(ih,"WeakMap"),oh=sh,gr=Jf,pr=Mr,mr=_f,vr=ni,yr=oh,ii=de,Re=jn,tn="[object Map]",ah="[object Object]",en="[object Promise]",rn="[object Set]",nn="[object WeakMap]",sn="[object DataView]",lh=Re(gr),ch=Re(pr),fh=Re(mr),hh=Re(vr),uh=Re(yr),ue=ii;(gr&&ue(new gr(new ArrayBuffer(1)))!=sn||pr&&ue(new pr())!=tn||mr&&ue(mr.resolve())!=en||vr&&ue(new vr())!=rn||yr&&ue(new yr())!=nn)&&(ue=function ue(h){var r=ii(h),t=r==ah?h.constructor:void 0,e=t?Re(t):"";if(e)switch(e){case lh:return sn;case ch:return tn;case fh:return en;case hh:return rn;case uh:return nn;}return r;});var ar=ue,dh=Object.prototype,gh=dh.hasOwnProperty;function ph(h){var r=h.length,t=new h.constructor(r);return r&&typeof h[0]=="string"&&gh.call(h,"index")&&(t.index=h.index,t.input=h.input),t;}var mh=ph,vh=ee,yh=vh.Uint8Array,si=yh,on=si;function Sh(h){var r=new h.constructor(h.byteLength);return new on(r).set(new on(h)),r;}var br=Sh,xh=br;function Th(h,r){var t=r?xh(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.byteLength);}var Mh=Th,Ph=/\w*$/;function Oh(h){var r=new h.constructor(h.source,Ph.exec(h));return r.lastIndex=h.lastIndex,r;}var Eh=Oh,an=Ue,ln=an?an.prototype:void 0,cn=ln?ln.valueOf:void 0;function Ch(h){return cn?Object(cn.call(h)):{};}var Ah=Ch,Rh=br;function Ih(h,r){var t=r?Rh(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.length);}var Lh=Ih,bh=br,wh=Mh,Dh=Eh,Nh=Ah,Wh=Lh,Bh="[object Boolean]",Fh="[object Date]",Uh="[object Map]",jh="[object Number]",$h="[object RegExp]",zh="[object Set]",Gh="[object String]",Hh="[object Symbol]",Kh="[object ArrayBuffer]",Yh="[object DataView]",Vh="[object Float32Array]",Xh="[object Float64Array]",kh="[object Int8Array]",Jh="[object Int16Array]",Zh="[object Int32Array]",Qh="[object Uint8Array]",qh="[object Uint8ClampedArray]",_h="[object Uint16Array]",tu="[object Uint32Array]";function eu(h,r,t){var e=h.constructor;switch(r){case Kh:return bh(h);case Bh:case Fh:return new e(+h);case Yh:return wh(h,t);case Vh:case Xh:case kh:case Jh:case Zh:case Qh:case qh:case _h:case tu:return Wh(h,t);case Uh:return new e();case jh:case Gh:return new e(h);case $h:return Dh(h);case zh:return new e();case Hh:return Nh(h);}}var ru=eu,nu=he,fn=Object.create,iu=/* @__PURE__ */function(){function h(){}return function(r){if(!nu(r))return{};if(fn)return fn(r);h.prototype=r;var t=new h();return h.prototype=void 0,t;};}(),su=iu,ou=su,au=_n,lu=Er;function cu(h){return typeof h.constructor=="function"&&!lu(h)?ou(au(h)):{};}var fu=cu,hu=ar,uu=ne,du="[object Map]";function gu(h){return uu(h)&&hu(h)==du;}var pu=gu,mu=pu,vu=or,hn=Or,un=hn&&hn.isMap,yu=un?vu(un):mu,Su=yu,xu=ar,Tu=ne,Mu="[object Set]";function Pu(h){return Tu(h)&&xu(h)==Mu;}var Ou=Pu,Eu=Ou,Cu=or,dn=Or,gn=dn&&dn.isSet,Au=gn?Cu(gn):Eu,oi=Au,Ru=/* @__PURE__ */fe(oi),Iu=zn,Lu=tl,bu=Kn,wu=Gc,Du=of,Nu=af,Wu=cf,Bu=xf,Fu=Df,Uu=ri,ju=Yf,$u=ar,zu=mh,Gu=ru,Hu=fu,Ku=je,Yu=Pr,Vu=Su,Xu=he,ku=oi,Ju=Ar,Zu=Rr,Qu=1,qu=2,_u=4,ai="[object Arguments]",td="[object Array]",ed="[object Boolean]",rd="[object Date]",nd="[object Error]",li="[object Function]",id="[object GeneratorFunction]",sd="[object Map]",od="[object Number]",ci="[object Object]",ad="[object RegExp]",ld="[object Set]",cd="[object String]",fd="[object Symbol]",hd="[object WeakMap]",ud="[object ArrayBuffer]",dd="[object DataView]",gd="[object Float32Array]",pd="[object Float64Array]",md="[object Int8Array]",vd="[object Int16Array]",yd="[object Int32Array]",Sd="[object Uint8Array]",xd="[object Uint8ClampedArray]",Td="[object Uint16Array]",Md="[object Uint32Array]",Ft={};Ft[ai]=Ft[td]=Ft[ud]=Ft[dd]=Ft[ed]=Ft[rd]=Ft[gd]=Ft[pd]=Ft[md]=Ft[vd]=Ft[yd]=Ft[sd]=Ft[od]=Ft[ci]=Ft[ad]=Ft[ld]=Ft[cd]=Ft[fd]=Ft[Sd]=Ft[xd]=Ft[Td]=Ft[Md]=!0;Ft[nd]=Ft[li]=Ft[hd]=!1;function Ge(h,r,t,e,n,i){var a,o=r&Qu,s=r&qu,l=r&_u;if(t&&(a=n?t(h,e,n,i):t(h)),a!==void 0)return a;if(!Xu(h))return h;var d=Ku(h);if(d){if(a=zu(h),!o)return Wu(h,a);}else{var c=$u(h),p=c==li||c==id;if(Yu(h))return Nu(h,o);if(c==ci||c==ai||p&&!n){if(a=s||p?{}:Hu(h),!o)return s?Fu(h,Du(a,h)):Bu(h,wu(a,h));}else{if(!Ft[c])return n?h:{};a=Gu(h,c,o);}}i||(i=new Iu());var y=i.get(h);if(y)return y;i.set(h,a),ku(h)?h.forEach(function(v){a.add(Ge(v,r,t,v,h,i));}):Vu(h)&&h.forEach(function(v,x){a.set(x,Ge(v,r,t,x,h,i));});var P=l?s?ju:Uu:s?Zu:Ju,T=d?void 0:P(h);return Lu(T||h,function(v,x){T&&(x=v,v=h[x]),bu(a,x,Ge(v,r,t,x,h,i));}),a;}var Pd=Ge,Od=Pd,Ed=1,Cd=4;function Ad(h){return Od(h,Ed|Cd);}var Rd=Ad,Xt=/* @__PURE__ */fe(Rd);var fi="1.1.1-beta.1",Id="@netless/appliance-plugin",Ld=typeof OffscreenCanvas=="function"?"worker":"mainThread";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var h=window.__netlessUA||"";h+=" ".concat(Id,"@").concat(fi,"_").concat(Ld),window.__netlessUA=h;}var re={syncOpt:{interval:500},canvasOpt:{contextType:ve.Canvas2d},cdn:{subWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/subWorker.js",fullWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/fullWorker.js"},cursor:{expirationTime:5e3},bufferSize:{full:2e4,sub:1e3},bezier:{combineUnitTime:100},pencilEraser:{useBitMap:!0}};function ae(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=h.length;if(t<2)return"";var e=h[0],n=h[1];if(t===2)return"M".concat(pe(e),"L").concat(pe(n));var i="";for(var a=2,o=t-1;a<o;a++)e=h[a],n=h[a+1],i+=me(e,n);return r?"M".concat(me(h[0],h[1]),"Q").concat(pe(h[1])).concat(me(h[1],h[2]),"T").concat(i).concat(me(h[t-1],h[0])).concat(me(h[0],h[1]),"Z"):"M".concat(pe(h[0]),"Q").concat(pe(h[1])).concat(me(h[1],h[2])).concat(h.length>3?"T":"").concat(i,"L").concat(pe(h[t-1]));}var Jt=/*#__PURE__*/function(){function Jt(r){_classCallCheck(this,Jt);et(this,"syncUnitTime",re.syncOpt.interval);et(this,"vNodes");et(this,"drawLayer");et(this,"fullLayer");et(this,"workId");var t=r.vNodes,e=r.fullLayer,n=r.drawLayer,i=r.workId,a=r.toolsOpt;this.vNodes=t,this.fullLayer=e,this.drawLayer=n,this.workId=i,this.syncUnitTime=a.syncUnitTime||this.syncUnitTime;}return _createClass(Jt,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return r.reduce(function(e,n){var i=e[e.length-1];return(n&&!i||n&&i&&!n.isNear(i,t))&&e.push(n),e;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(r){this.workId=r;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(r){var n,i,a;this.workOptions=r,this.syncUnitTime=r.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),e=t&&((i=this.vNodes)==null?void 0:i.get(t))||void 0;t&&e&&(e.opt=r,(a=this.vNodes)==null||a.setInfo(t,e));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(r){var n,i;var t;var e=(n=this.workId)==null?void 0:n.toString();if(e&&r){var a=this.fullLayer.getElementsByName(e)||this.drawLayer&&this.drawLayer.getElementsByName(e)||[];if(a.length!==1)return;var o=a[0],s=r.pos,l=r.zIndex,d=r.scale,c=r.angle,p=r.translate,y={};_t(l)&&(y.zIndex=l),s&&(y.pos=[s[0],s[1]]),d&&(y.scale=d),c&&(y.rotate=c),p&&(y.translate=p),o.attr(y);var P=o==null?void 0:o.getBoundingClientRect();return P&&(t=Pt(t,{x:Math.floor(P.x-Jt.SafeBorderPadding),y:Math.floor(P.y-Jt.SafeBorderPadding),w:Math.floor(P.width+Jt.SafeBorderPadding*2),h:Math.floor(P.height+Jt.SafeBorderPadding*2)})),(i=this.vNodes)==null||i.setInfo(e,{rect:t,centerPos:s}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(r){var t=r.group,e=r.eraserlines,n=r.pos,i=r.layer,_r$isClear=r.isClear,a=_r$isClear===void 0?!0:_r$isClear,o=!!i.parent.gl;var _iterator13=_createForOfIteratorHelper(e),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var l=s.thickness,d=s.op;var _iterator14=_createForOfIteratorHelper(d),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var c=_step14.value;var p=c.map(function(x,f){return f%2?x-n[1]:x-n[0];}),y=this.computEraserPoints(p,l),P=ae(y,!0),T={pos:[0,0],d:P,fillColor:"rgba(0,0,0,1)"},v=new ce(T);a&&(v.addEventListener("beforerender",function(_ref165){var x=_ref165.detail;var f=x.context;o?f.blendFuncSeparate(f.ZERO,f.ZERO,f.ZERO,f.ZERO):f.globalCompositeOperation="destination-out";}),v.addEventListener("afterrender",function(_ref166){var x=_ref166.detail;var f=x.context;o?f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA):f.globalCompositeOperation="source-over";})),t.append(v);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"computEraserPoints",value:function computEraserPoints(r,t){var e=Math.ceil(t/2);return r.length===2?this.computDot(r,e):this.computLine(r,e);}},{key:"computDot",value:function computDot(r,t){var e=new xt(r[0],r[1]);return xt.GetDotStroke(e,t,8);}},{key:"computLine",value:function computLine(r,t){var e=[],n=[];var i,a;for(var o=0;o<r.length;o+=2){var s=new xt(r[o],r[o+1]);var l=void 0;if(o==r.length-2){var d=new xt(r[o-2],r[o-1]);l=_.Sub(s,d).uni(),i=s;}else{o===0&&(a=s);var _d4=new xt(r[o+2],r[o+3]);l=_.Sub(_d4,s).uni();}if(l){var _d5=_.Per(l).mul(t);e.push(xt.Sub(s,_d5)),n.push(xt.Add(s,_d5));}}if(i&&a){var _o3=xt.GetSemicircleStroke(i,e[e.length-1],-1,8),_s4=xt.GetSemicircleStroke(a,n[0],-1,8);return e.concat(_o3,n.reverse(),_s4);}return[];}},{key:"replace",value:function replace(r,t,e){var _this61=this;var o;var n=r.getElementsByName(t),i=n.length;if(i){if(i>1)for(var s=1;s<n.length;s++)r.removeChild(n[s]),n[s].disconnect();e?r.replaceChild(e,n[0]):r.removeChild(n[0]),n[0].disconnect();}else e&&r.append(e);this.fullLayer===r?(o=this.drawLayer)==null||o.getElementsByName(t).forEach(function(s){var l;(l=_this61.drawLayer)==null||l.removeChild(s),s.disconnect();}):this.fullLayer.getElementsByName(t).forEach(function(s){_this61.fullLayer.removeChild(s),s.disconnect();});}}],[{key:"updateNodeOpt",value:function updateNodeOpt(r){var f;var t=r.node,e=r.opt,n=r.vNodes,i=r.willSerializeData,a=r.targetNode,o=e.zIndex,s=e.translate,l=e.angle,d=e.originPoint,c=e.scenePoint,p=e.scale,y=e.pointMap,P=e.thickness;var T;var v=a&&Xt(a)||n.get(t.name);if(!v)return;_t(o)&&(t.setAttribute("zIndex",o),v.opt.zIndex=o);var x=t.parent;if(x){if(d&&p&&a){var g=[v.op[0],v.op[1]];Ur(v.op,c,p,s);var u=[v.op[0],v.op[1]],m=[u[0]-g[0],u[1]-g[1]];if(v.centerPos=[v.centerPos[0]+m[0],v.centerPos[1]+m[1]],v.opt.translate=void 0,v.opt.scale=void 0,v.opt.eraserlines)for(var _i2=0,_Object$values=Object.values(v.opt.eraserlines);_i2<_Object$values.length;_i2++){var M=_Object$values[_i2];var E=M.op,R=M.thickness;M.thickness=R*Math.max(p[0],p[1]);for(var b=0;b<E.length;b++)jr(E[b],c,p,s);}}else if(s){if(t.setAttribute("translate",s),v.opt.translate=s,a){var _g6=[s[0]*x.worldScaling[0],s[1]*x.worldScaling[1]];T=xr(v.rect,_g6),v.rect=T;}else{var _g7=Jt.getRectFromLayer(x,t.name);v.rect=_g7||v.rect;}}else if(_t(l))if(t.setAttribute("rotate",l),v.opt.rotate=l,a)T=Ei(v.rect,l),v.rect=T;else{var _g8=Jt.getRectFromLayer(x,t.name);v.rect=_g8||v.rect;}if(y){var _g9=y.get(t.name);if(_g9)for(var _u10=0,_m9=0;_u10<v.op.length;_u10+=3,_m9++)v.op[_u10]=_g9[_m9][0],v.op[_u10+1]=_g9[_m9][1];}if(P&&(f=v==null?void 0:v.opt)!=null&&f.thickness&&(v.opt.thickness=P),i&&!(d&&p&&a)){if(s){var _g10=v.op.map(function(u,m){var M=m%3;return M===0?u+s[0]:M===1?u+s[1]:u;});if(v.op=_g10,v.centerPos=[v.centerPos[0]+s[0],v.centerPos[1]+s[1]],v!=null&&v.opt&&(v.opt.translate=void 0),v.opt.eraserlines)for(var _i3=0,_Object$values2=Object.values(v.opt.eraserlines);_i3<_Object$values2.length;_i3++){var _u11=_Object$values2[_i3];var _m10=_u11.op;for(var _M6=0;_M6<_m10.length;_M6++){var _E3=_m10[_M6].map(function(R,b){return b%2?R+s[1]:R+s[0];});_u11.op[_M6]=_E3;}}}else if(_t(l)){var _g11=v.op;if(Hg(_g11,v.centerPos,l),v.op=_g11,v!=null&&v.opt&&(v.opt.rotate=void 0),v.opt.eraserlines)for(var _i4=0,_Object$values3=Object.values(v.opt.eraserlines);_i4<_Object$values3.length;_i4++){var _u12=_Object$values3[_i4];var _m11=_u12.op;for(var _M7=0;_M7<_m11.length;_M7++)Kg(_m11[_M7],v.centerPos,l);}}}v&&n.setInfo(t.name,v);}}},{key:"getCenterPos",value:function getCenterPos(r,t){var e=t.worldPosition,n=t.worldScaling;return[(r.x+r.w/2-e[0])/n[0],(r.y+r.h/2-e[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(r,t){var e=r.getElementsByName(t)[0];if(e){var n=e.getBoundingClientRect();return{x:Math.floor(n.x-Jt.SafeBorderPadding),y:Math.floor(n.y-Jt.SafeBorderPadding),w:Math.floor(n.width+Jt.SafeBorderPadding*2),h:Math.floor(n.height+Jt.SafeBorderPadding*2)};}}}]);}();et(Jt,"SafeBorderPadding",10);var vt=Jt;var wr={exports:{}};wr.exports;(function(h){var r=function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={};function a(s,l){if(!i[s]){i[s]={};for(var d=0;d<s.length;d++)i[s][s.charAt(d)]=d;}return i[s][l];}var o={compressToBase64:function compressToBase64(s){if(s==null)return"";var l=o._compress(s,6,function(d){return e.charAt(d);});switch(l.length%4){default:case 0:return l;case 1:return l+"===";case 2:return l+"==";case 3:return l+"=";}},decompressFromBase64:function decompressFromBase64(s){return s==null?"":s==""?null:o._decompress(s.length,32,function(l){return a(e,s.charAt(l));});},compressToUTF16:function compressToUTF16(s){return s==null?"":o._compress(s,15,function(l){return t(l+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(s){return s==null?"":s==""?null:o._decompress(s.length,16384,function(l){return s.charCodeAt(l)-32;});},//compress into uint8array (UCS-2 big endian format)
400
400
  compressToUint8Array:function compressToUint8Array(s){for(var l=o.compress(s),d=new Uint8Array(l.length*2),c=0,p=l.length;c<p;c++){var y=l.charCodeAt(c);d[c*2]=y>>>8,d[c*2+1]=y%256;}return d;},//decompress from uint8array (UCS-2 big endian format)
401
401
  decompressFromUint8Array:function decompressFromUint8Array(s){if(s==null)return o.decompress(s);for(var l=new Array(s.length/2),d=0,c=l.length;d<c;d++)l[d]=s[d*2]*256+s[d*2+1];var p=[];return l.forEach(function(y){p.push(t(y));}),o.decompress(p.join(""));},//compress into a string that is already URI encoded
402
402
  compressToEncodedURIComponent:function compressToEncodedURIComponent(s){return s==null?"":o._compress(s,6,function(l){return n.charAt(l);});},//decompress from an output of compressToEncodedURIComponent