@idraw/core 0.4.0-beta.20 → 0.4.0-beta.21
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.
|
@@ -25,28 +25,28 @@ export const MiddlewareLayoutSelector = (opts) => {
|
|
|
25
25
|
const data = sharer.getActiveStorage('data');
|
|
26
26
|
if ((_a = data === null || data === void 0 ? void 0 : data.layout) === null || _a === void 0 ? void 0 : _a.operations) {
|
|
27
27
|
const operations = data.layout.operations;
|
|
28
|
-
if (controlType === 'left' && operations.
|
|
28
|
+
if (controlType === 'left' && operations.disabledLeft === true) {
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
|
-
if (controlType === 'top' && operations.
|
|
31
|
+
if (controlType === 'top' && operations.disabledTop === true) {
|
|
32
32
|
return true;
|
|
33
33
|
}
|
|
34
|
-
if (controlType === 'right' && operations.
|
|
34
|
+
if (controlType === 'right' && operations.disabledRight === true) {
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
|
-
if (controlType === 'bottom' && operations.
|
|
37
|
+
if (controlType === 'bottom' && operations.disabledBottom === true) {
|
|
38
38
|
return true;
|
|
39
39
|
}
|
|
40
|
-
if (controlType === 'top-left' && operations.
|
|
40
|
+
if (controlType === 'top-left' && operations.disabledTopLeft === true) {
|
|
41
41
|
return true;
|
|
42
42
|
}
|
|
43
|
-
if (controlType === 'top-right' && operations.
|
|
43
|
+
if (controlType === 'top-right' && operations.disabledTopRight === true) {
|
|
44
44
|
return true;
|
|
45
45
|
}
|
|
46
|
-
if (controlType === 'bottom-left' && operations.
|
|
46
|
+
if (controlType === 'bottom-left' && operations.disabledBottomLeft === true) {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
|
-
if (controlType === 'bottom-right' && operations.
|
|
49
|
+
if (controlType === 'bottom-right' && operations.disabledBottomRight === true) {
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -58,33 +58,33 @@ function drawControllerLine(ctx, opts) {
|
|
|
58
58
|
export function drawLayoutController(ctx, opts) {
|
|
59
59
|
const { controller, operations } = opts;
|
|
60
60
|
const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, rightMiddle, bottomMiddle, leftMiddle } = controller;
|
|
61
|
-
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.
|
|
62
|
-
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.
|
|
63
|
-
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.
|
|
64
|
-
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.
|
|
61
|
+
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledTop) });
|
|
62
|
+
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledRight) });
|
|
63
|
+
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledBottom) });
|
|
64
|
+
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, disabled: !!(operations === null || operations === void 0 ? void 0 : operations.disabledLeft) });
|
|
65
65
|
const disabledOpts = {
|
|
66
66
|
lineWidth: 1,
|
|
67
67
|
strokeStyle: disableColor
|
|
68
68
|
};
|
|
69
|
-
if ((operations === null || operations === void 0 ? void 0 : operations.
|
|
69
|
+
if ((operations === null || operations === void 0 ? void 0 : operations.disabledTopLeft) === true) {
|
|
70
70
|
drawControllerCross(ctx, Object.assign({ vertexes: topLeft.vertexes }, disabledOpts));
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
drawControllerBox(ctx, topLeft.vertexes);
|
|
74
74
|
}
|
|
75
|
-
if ((operations === null || operations === void 0 ? void 0 : operations.
|
|
75
|
+
if ((operations === null || operations === void 0 ? void 0 : operations.disabledTopRight) === true) {
|
|
76
76
|
drawControllerCross(ctx, Object.assign({ vertexes: topRight.vertexes }, disabledOpts));
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
drawControllerBox(ctx, topRight.vertexes);
|
|
80
80
|
}
|
|
81
|
-
if ((operations === null || operations === void 0 ? void 0 : operations.
|
|
81
|
+
if ((operations === null || operations === void 0 ? void 0 : operations.disabledBottomRight) === true) {
|
|
82
82
|
drawControllerCross(ctx, Object.assign({ vertexes: bottomRight.vertexes }, disabledOpts));
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
85
|
drawControllerBox(ctx, bottomRight.vertexes);
|
|
86
86
|
}
|
|
87
|
-
if ((operations === null || operations === void 0 ? void 0 : operations.
|
|
87
|
+
if ((operations === null || operations === void 0 ? void 0 : operations.disabledBottomLeft) === true) {
|
|
88
88
|
drawControllerCross(ctx, Object.assign({ vertexes: bottomLeft.vertexes }, disabledOpts));
|
|
89
89
|
}
|
|
90
90
|
else {
|
package/dist/index.global.js
CHANGED
|
@@ -7377,30 +7377,30 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7377
7377
|
function drawLayoutController(ctx, opts) {
|
|
7378
7378
|
const { controller, operations } = opts;
|
|
7379
7379
|
const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, rightMiddle, bottomMiddle, leftMiddle } = controller;
|
|
7380
|
-
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.
|
|
7381
|
-
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.
|
|
7382
|
-
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.
|
|
7383
|
-
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.
|
|
7380
|
+
drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledTop) });
|
|
7381
|
+
drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledRight) });
|
|
7382
|
+
drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledBottom) });
|
|
7383
|
+
drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledLeft) });
|
|
7384
7384
|
const disabledOpts = {
|
|
7385
7385
|
lineWidth: 1,
|
|
7386
7386
|
strokeStyle: disableColor
|
|
7387
7387
|
};
|
|
7388
|
-
if ((operations == null ? void 0 : operations.
|
|
7388
|
+
if ((operations == null ? void 0 : operations.disabledTopLeft) === true) {
|
|
7389
7389
|
drawControllerCross(ctx, { vertexes: topLeft.vertexes, ...disabledOpts });
|
|
7390
7390
|
} else {
|
|
7391
7391
|
drawControllerBox(ctx, topLeft.vertexes);
|
|
7392
7392
|
}
|
|
7393
|
-
if ((operations == null ? void 0 : operations.
|
|
7393
|
+
if ((operations == null ? void 0 : operations.disabledTopRight) === true) {
|
|
7394
7394
|
drawControllerCross(ctx, { vertexes: topRight.vertexes, ...disabledOpts });
|
|
7395
7395
|
} else {
|
|
7396
7396
|
drawControllerBox(ctx, topRight.vertexes);
|
|
7397
7397
|
}
|
|
7398
|
-
if ((operations == null ? void 0 : operations.
|
|
7398
|
+
if ((operations == null ? void 0 : operations.disabledBottomRight) === true) {
|
|
7399
7399
|
drawControllerCross(ctx, { vertexes: bottomRight.vertexes, ...disabledOpts });
|
|
7400
7400
|
} else {
|
|
7401
7401
|
drawControllerBox(ctx, bottomRight.vertexes);
|
|
7402
7402
|
}
|
|
7403
|
-
if ((operations == null ? void 0 : operations.
|
|
7403
|
+
if ((operations == null ? void 0 : operations.disabledBottomLeft) === true) {
|
|
7404
7404
|
drawControllerCross(ctx, { vertexes: bottomLeft.vertexes, ...disabledOpts });
|
|
7405
7405
|
} else {
|
|
7406
7406
|
drawControllerBox(ctx, bottomLeft.vertexes);
|
|
@@ -7428,28 +7428,28 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7428
7428
|
const data = sharer.getActiveStorage("data");
|
|
7429
7429
|
if ((_a = data == null ? void 0 : data.layout) == null ? void 0 : _a.operations) {
|
|
7430
7430
|
const operations = data.layout.operations;
|
|
7431
|
-
if (controlType === "left" && operations.
|
|
7431
|
+
if (controlType === "left" && operations.disabledLeft === true) {
|
|
7432
7432
|
return true;
|
|
7433
7433
|
}
|
|
7434
|
-
if (controlType === "top" && operations.
|
|
7434
|
+
if (controlType === "top" && operations.disabledTop === true) {
|
|
7435
7435
|
return true;
|
|
7436
7436
|
}
|
|
7437
|
-
if (controlType === "right" && operations.
|
|
7437
|
+
if (controlType === "right" && operations.disabledRight === true) {
|
|
7438
7438
|
return true;
|
|
7439
7439
|
}
|
|
7440
|
-
if (controlType === "bottom" && operations.
|
|
7440
|
+
if (controlType === "bottom" && operations.disabledBottom === true) {
|
|
7441
7441
|
return true;
|
|
7442
7442
|
}
|
|
7443
|
-
if (controlType === "top-left" && operations.
|
|
7443
|
+
if (controlType === "top-left" && operations.disabledTopLeft === true) {
|
|
7444
7444
|
return true;
|
|
7445
7445
|
}
|
|
7446
|
-
if (controlType === "top-right" && operations.
|
|
7446
|
+
if (controlType === "top-right" && operations.disabledTopRight === true) {
|
|
7447
7447
|
return true;
|
|
7448
7448
|
}
|
|
7449
|
-
if (controlType === "bottom-left" && operations.
|
|
7449
|
+
if (controlType === "bottom-left" && operations.disabledBottomLeft === true) {
|
|
7450
7450
|
return true;
|
|
7451
7451
|
}
|
|
7452
|
-
if (controlType === "bottom-right" && operations.
|
|
7452
|
+
if (controlType === "bottom-right" && operations.disabledBottomRight === true) {
|
|
7453
7453
|
return true;
|
|
7454
7454
|
}
|
|
7455
7455
|
}
|
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var iDrawCore=function(e){"use strict";var t,i,o,n,a,r,s,l,h,c,d,f,u,g,v,w,m,y,p,x,S=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},b=(e,t,i)=>(S(e,t,"read from private field"),i?i.call(e):t.get(e)),I=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},A=(e,t,i,o)=>(S(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),M=(e,t,i)=>(S(e,t,"access private method"),i);function z(e){return"string"==typeof e&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}function R(e,t){if(1===t)return e;let i=1;const o=/^\#[0-9a-f]{6,6}$/i;let n=e;if(o.test(e)?i=parseInt(e.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(e)&&(i=parseInt(e.substring(7,9).replace(/^\#/,"0x")),n=e.substring(0,7)),i*=t,o.test(n)&&i>0&&i<1){const e=Math.max(0,Math.min(255,Math.ceil(256*i)));n=`${n.toUpperCase()}${e.toString(16).toUpperCase()}`}return n}function P(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function T(e){let t=0;for(let i=0;i<e.length;i++)t+=e.charCodeAt(i)*e.charCodeAt(i)*i*i;return t.toString(16).substring(0,4)}function E(e){const t=e.length,i=Math.floor(t/2),o=e.substring(0,4).padEnd(4,"0"),n=e.substring(0,4).padEnd(4,"0");return`@assets/${T(t.toString(16).padEnd(4,o))}${T(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${T(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${T(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${T(n.padEnd(4,o).padEnd(4,n))}`}function W(e){return function e(t){const i=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return t;if("Array"===i){const i=[];return t.forEach((t=>{i.push(e(t))})),i}if("Object"===i){const i={};Object.keys(t).forEach((o=>{i[o]=e(t[o])}));return Object.getOwnPropertySymbols(t).forEach((o=>{i[o]=e(t[o])})),i}}(e)}function C(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const L={type(e,t){const i=C(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===C(e),json:e=>"Object"===C(e),function:e=>"Function"===C(e),asyncFunction:e=>"AsyncFunction"===C(e),boolean:e=>"Boolean"===C(e),string:e=>"String"===C(e),number:e=>"Number"===C(e),undefined:e=>"Undefined"===C(e),null:e=>"Null"===C(e),promise:e=>"Promise"===C(e)};var k=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))};const{Image:O}=window;function j(e){return new Promise(((t,i)=>{const o=new O;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function D(e){return k(this,void 0,void 0,(function*(){const t=yield function(e){return new Promise(((t,i)=>{const o=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=new FileReader;n.readAsDataURL(o),n.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},n.onerror=function(e){i(e)}}))}(e);return yield j(t)}))}function V(e,t){return k(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},r.onerror=function(e){n(e)}}))}(e,t);return yield j(i)}))}function Y(e){return"number"==typeof e&&(e>0||e<=0)}function G(e){return"number"==typeof e&&e>=0}function F(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function B(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const N={x:function(e){return Y(e)},y:function(e){return Y(e)},w:G,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:Y,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return G(e)},borderRadius:function(e){return Y(e)&&e>=0},color:function(e){return z(e)},imageSrc:function(e){return B(e)||F(e)},imageURL:F,imageBase64:B,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return Y(e)&&e>0},lineHeight:function(e){return Y(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return Y(e)&&e>0}};var X,H,Z=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Q=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class U{constructor(e,t){X.set(this,void 0),H.set(this,void 0),Z(this,X,e,"f"),Z(this,H,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f"),this.$resetFont()}$undoPixelRatio(e){return e/Q(this,H,"f").devicePixelRatio}$doPixelRatio(e){return Q(this,H,"f").devicePixelRatio*e}$getContext(){return Q(this,X,"f")}$setContext(e){Z(this,X,e,"f")}$setFont(e){const t=[];e.fontWeight&&t.push(`${e.fontWeight}`),t.push(`${this.$doPixelRatio(e.fontSize||12)}px`),t.push(`${e.fontFamily||"sans-serif"}`),Q(this,X,"f").font=`${t.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return Q(this,H,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=Q(this,X,"f");a.width=t*o,a.height=i*o,Z(this,H,Object.assign(Object.assign({},Q(this,H,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=Q(this,H,"f"),{width:t,height:i}=Q(this,X,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return Q(this,X,"f").canvas}get fillStyle(){return Q(this,X,"f").fillStyle}set fillStyle(e){Q(this,X,"f").fillStyle=e}get strokeStyle(){return Q(this,X,"f").strokeStyle}set strokeStyle(e){Q(this,X,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(Q(this,X,"f").lineWidth)}set lineWidth(e){Q(this,X,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return Q(this,X,"f").textAlign}set textAlign(e){Q(this,X,"f").textAlign=e}get textBaseline(){return Q(this,X,"f").textBaseline}set textBaseline(e){Q(this,X,"f").textBaseline=e}get globalAlpha(){return Q(this,X,"f").globalAlpha}set globalAlpha(e){Q(this,X,"f").globalAlpha=e}get shadowColor(){return Q(this,X,"f").shadowColor}set shadowColor(e){Q(this,X,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(Q(this,X,"f").shadowOffsetX)}set shadowOffsetX(e){Q(this,X,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(Q(this,X,"f").shadowOffsetY)}set shadowOffsetY(e){Q(this,X,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(Q(this,X,"f").shadowBlur)}set shadowBlur(e){Q(this,X,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return Q(this,X,"f").lineCap}set lineCap(e){Q(this,X,"f").lineCap=e}get globalCompositeOperation(){return Q(this,X,"f").globalCompositeOperation}set globalCompositeOperation(e){Q(this,X,"f").globalCompositeOperation=e}fill(...e){return Q(this,X,"f").fill(...e)}arc(e,t,i,o,n,a){return Q(this,X,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return Q(this,X,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return Q(this,X,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return Q(this,X,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return Q(this,X,"f").beginPath()}closePath(){return Q(this,X,"f").closePath()}lineTo(e,t){return Q(this,X,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return Q(this,X,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return Q(this,X,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return Q(this,X,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return Q(this,X,"f").setLineDash(t)}stroke(e){return e?Q(this,X,"f").stroke(e):Q(this,X,"f").stroke()}translate(e,t){return Q(this,X,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return Q(this,X,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],a=e[4],r=e[e.length-4],s=e[e.length-3],l=e[e.length-2],h=e[e.length-1];return 9===e.length?Q(this,X,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a),this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h)):Q(this,X,"f").drawImage(t,this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return Q(this,X,"f").createPattern(e,t)}measureText(e){return Q(this,X,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?Q(this,X,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,X,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?Q(this,X,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,X,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){Q(this,X,"f").save()}restore(){Q(this,X,"f").restore()}scale(e,t){Q(this,X,"f").scale(e,t)}circle(e,t,i,o,n,a,r,s){Q(this,X,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,r,s)}isPointInPath(e,t){return Q(this,X,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return Q(this,X,"f").clip(...e)}setTransform(e,t,i,o,n,a){return Q(this,X,"f").setTransform(e,t,i,o,n,a)}getTransform(){return Q(this,X,"f").getTransform()}createLinearGradient(e,t,i,o){return Q(this,X,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return Q(this,X,"f").createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a))}createConicGradient(e,t,i){return Q(this,X,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function J(e){const{width:t,height:i,ctx:o,devicePixelRatio:n}=e;let a=o;if(!a){const e=document.createElement("canvas");e.width=t*n,e.height=i*n,a=e.getContext("2d")}return new U(a,e)}function $(e){const{width:t,height:i,devicePixelRatio:o}=e,n=new OffscreenCanvas(t*o,i*o),a=n.getContext("2d").canvas.getContext("2d");return new U(a,{devicePixelRatio:o,offscreenCanvas:n})}X=new WeakMap,H=new WeakMap;var K,q=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class _{constructor(){K.set(this,void 0),function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,i):n?n.value=i:t.set(e,i)}(this,K,new Map,"f")}on(e,t){if(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e)||[];null==i||i.push(t),q(this,K,"f").set(e,i)}else q(this,K,"f").set(e,[t])}off(e,t){if(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e);if(Array.isArray(i))for(let e=0;e<(null==i?void 0:i.length);e++)if(i[e]===t){i.splice(e,1);break}q(this,K,"f").set(e,i||[])}}trigger(e,t){const i=q(this,K,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(q(this,K,"f").has(e)){const t=q(this,K,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){q(this,K,"f").clear()}}function ee(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}K=new WeakMap;var te,ie,oe,ne,ae=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},re=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class se{constructor(e){te.add(this),ie.set(this,void 0),oe.set(this,void 0),ae(this,oe,W(e.defaultStorage),"f"),ae(this,ie,re(this,te,"m",ne).call(this),"f")}set(e,t){re(this,ie,"f")[e]=t}get(e){return re(this,ie,"f")[e]}getSnapshot(e){return!0===(null==e?void 0:e.deepClone)?W(re(this,ie,"f")):Object.assign({},re(this,ie,"f"))}clear(){ae(this,ie,re(this,te,"m",ne).call(this),"f")}destroy(){ae(this,ie,null,"f")}}function le(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}}function he(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}}function ce(e){return e/180*Math.PI}function de(e,t,i,o){const n=ce(t||0);i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(n),e.translate(-i.x,-i.y)),o(e),i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(-n),e.translate(-i.x,-i.y))}function fe(e,t,i){const o=ue(t);de(e,t.angle||0,o,(()=>{i(e)}))}function ue(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function ge(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),i=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return ue({x:t,y:i,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-i})}function ve(e,t){const i=t.x-e.x,o=t.y-e.y;if(0===i){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&o<0?Math.atan(Math.abs(i)/Math.abs(o)):i>0&&o>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):0}function we(e,t,i){let o=ve(e,t)+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const n=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let a=0,r=0;return 0===o?(a=0,r=0-n):o>0&&o<Math.PI/2?(a=Math.sin(o)*n,r=0-Math.cos(o)*n):o===Math.PI/2?(a=n,r=0):o>Math.PI/2&&o<Math.PI?(a=Math.sin(Math.PI-o)*n,r=Math.cos(Math.PI-o)*n):o===Math.PI?(a=0,r=n):o>Math.PI&&o<1.5*Math.PI?(a=0-Math.sin(o-Math.PI)*n,r=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(a=0-n,r=0):o>1.5*Math.PI&&o<2*Math.PI?(a=0-Math.sin(2*Math.PI-o)*n,r=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(a=0,r=0-n),a+=e.x,r+=e.y,{x:a,y:r}}function me(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:a,h:r,angle:s=0}=e,l=we(ue({x:t,y:n,w:a,h:r,angle:s}),{x:i,y:o},ce(s));i=l.x,o=l.y})),{x:i,y:o}}return e}function ye(e,t,i){const{x:o,y:n,w:a,h:r}=e;let s={x:o,y:n},l={x:o+a,y:n},h={x:o+a,y:n+r},c={x:o,y:n+r};if(i&&(i>0||i<0)){const e=ce(Se(i));s=we(t,s,e),l=we(t,l,e),h=we(t,h,e),c=we(t,c,e)}return[s,l,h,c]}function pe(e){const{angle:t=0}=e;return ye(e,ue(e),t)}function xe(e,t,i){return[we(e,{x:t[0].x,y:t[0].y},i),we(e,{x:t[1].x,y:t[1].y},i),we(e,{x:t[2].x,y:t[2].y},i),we(e,{x:t[3].x,y:t[3].y},i)]}function Se(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function be(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=be(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function Ie(e,t){const i={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=pe(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),a=Math.max(t.x+t.w,i.x+i.w),r=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(a-o),i.h=Math.abs(r-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function Ae(e,t){var i;const o=[];let n=e;if(t.length>1)for(let e=0;e<t.length-1;e++){const a=n[t[e]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(i=null==a?void 0:a.detail)||void 0===i?void 0:i.children))return null;o.push(a),n=a.detail.children}return o}function Me(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===n.type)o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}function ze(e,t){const i=[];let o=!1;const n=t=>{var a;for(let r=0;r<t.length&&!0!==o;r++){i.push(r);const s=t[r];if(s.uuid===e){o=!0;break}if("group"===s.type&&n((null===(a=null==s?void 0:s.detail)||void 0===a?void 0:a.children)||[]),o)break;i.pop()}};return n(t),i}function Re(e){const{x:t,y:i,h:o,w:n}=e;return[{x:t,y:i},{x:t+n,y:i},{x:t+n,y:i+o},{x:t,y:i+o}]}function Pe(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?Re(e):ye(e,ue({x:t,y:i,w:o,h:n,angle:a}),a)}function Te(e){const t=[];let i=0,o=0;const n=[],a=[...e];for(let e=0;e<a.length;e++){const{x:r,y:s,w:l,h:h,angle:c=0}=a[e];let d;if(i+=r,o+=s,0===e){const e={x:i,y:o,w:l,h:h,angle:c};d=Pe({x:r,y:s,w:l,h:h,angle:c}),n.push({center:ue(e),angle:c,radian:ce(c)})}else{d=Re({x:i,y:o,w:l,h:h,angle:c});for(let e=0;e<n.length;e++){const{center:t,radian:i}=n[e];d=xe(t,d,i)}const e=ge(d);if(c>0||c<0){d=xe(e,d,ce(c))}n.push({center:e,angle:c,radian:ce(c)})}t.push(d)}return t}function Ee(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Te([...i,e]):[Pe(e)]}(e,t);return i.pop()||null}function We(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:a,h:r,angle:s}=e,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:o*l+c,y:n*l+h,w:a*l,h:r*l,angle:s}}function Ce(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:a,offsetTop:r,offsetLeft:s}=i;return{x:o*a+s,y:n*a+r}}function Le(e,t){return[Ce(e[0],t),Ce(e[1],t),Ce(e[2],t),Ce(e[3],t)]}function ke(e,t){const{context2d:i,element:o,viewScaleInfo:n}=t,{angle:a=0}=o,{x:r,y:s,w:l,h:h}=We(o,{viewScaleInfo:n}),c=pe({x:r,y:s,w:l,h:h,angle:a});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let e=1;e<c.length;e++)i.lineTo(c[e].x,c[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function Oe(e,t,i){const o=[t[0].x,t[1].x,t[2].x,t[3].x],n=[t[0].y,t[1].y,t[2].y,t[3].y],a=Math.min(...o),r=Math.max(...o),s=Math.min(...n),l=Math.max(...n);return e.x>a&&e.x<r&&e.y>s&&e.y<l||!0===(null==i?void 0:i.includeBorder)&&(e.x===a||e.x===r||e.y===s||e.y===l)}function je(e,t){const{groupQueue:i}=t,o=Ee(e,{groupQueue:i}),n=ee(o[0],o[1]),a=ee(o[1],o[2]),r=ee(o[2],o[3]),s=ee(o[3],o[0]),l=o[0],h=o[1],c=o[2],d=o[3],f=Math.max(l.x,h.x,c.x,d.x),u=Math.max(l.y,h.y,c.y,d.y);return{center:{x:(f+Math.min(l.x,h.x,c.x,d.x))/2,y:(u+Math.min(l.y,h.y,c.y,d.y))/2},topLeft:l,topRight:h,bottomLeft:d,bottomRight:c,top:n,right:a,left:s,bottom:r}}function De(e){const t=Math.max(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),i=Math.max(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),o=Math.min(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),a={x:e.center.x,y:e.center.y},r={x:o,y:n},s={x:t,y:n},l={x:t,y:i},h={x:o,y:i},c=ee(r,s),d=ee(h,l),f=ee(r,h);return{center:a,topLeft:r,topRight:s,bottomLeft:h,bottomRight:l,top:c,right:ee(s,l),left:f,bottom:d}}function Ve(e,t){const i=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n,offsetLeft:a}=t,{width:r,height:s}=i,l=0-a/o,h=0-n/o,c=r/o,d=s/o,f=ue({x:l,y:h,w:c,h:d}),u={x:l,y:h},g={x:l+c,y:h},v={x:l,y:h+d},w={x:l+c,y:h+d},m={x:l,y:f.y},y={x:f.x,y:h},p={x:l+c,y:f.y},x={x:f.x,y:h+d};return{center:f,topLeft:u,topRight:g,bottomLeft:v,bottomRight:w,left:m,top:y,right:p,bottom:x}}(t);let o=0,n=0;return Object.keys(e).forEach((t=>{const a=e[t];a.isVisibleInView=function(e,t){const i=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),o=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),a=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),r=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),s=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),l=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),h=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y);return i<=s&&o>=r&&n<=h&&a>=l||s<=a&&s>=a&&s<=a&&s>=a}(a.rangeRectInfo,i),a.isVisibleInView?o++:n++})),{viewVisibleInfoMap:e,visibleCount:o,invisibleCount:n}}function Ye(e,t){const{x:i,y:o}=e,{size:n,angle:a}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:a}}function Ge(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n}=t,a=(o&&o>0?o:8)/n.scale,{x:r,y:s,w:l,h:h,angle:c=0}=e,d=[{uuid:P(),x:r,y:s,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let f=0;d.forEach((({angle:e=0})=>{f+=e}));const u=Ee(e,{groupQueue:i}),g=Ee({x:r-2*a,y:s-2*a,h:h+4*a,w:l+4*a,angle:c},{groupQueue:[...i]}),v=ee(u[0],u[1]),w=ee(u[1],u[2]),m=ee(u[2],u[3]),y=ee(u[3],u[0]),p=u[0],x=u[1],S=u[2],b=u[3],I=Ye(v,{size:a,angle:f}),A=Ye(w,{size:a,angle:f}),M=Ye(m,{size:a,angle:f}),z=Ye(y,{size:a,angle:f}),R=Ye(p,{size:a,angle:f}),T=Ye(x,{size:a,angle:f}),E=Ye(b,{size:a,angle:f}),W=Ye(S,{size:a,angle:f}),C=Pe(R),L=Pe(T),k=Pe(E),O=Pe(W),j=[C[1],L[0],L[3],C[2]],D=[L[3],L[2],O[1],O[0]],V=[k[1],O[0],O[3],k[2]],Y=[C[3],C[2],k[1],k[0]],G=Pe(I),F=Pe(A),B=Pe(M),N=Pe(z),X=ee(g[0],g[1]);return{elementWrapper:u,left:{type:"left",vertexes:Y,center:y},right:{type:"right",vertexes:D,center:w},top:{type:"top",vertexes:j,center:v},bottom:{type:"bottom",vertexes:V,center:m},topLeft:{type:"top-left",vertexes:C,center:p},topRight:{type:"top-right",vertexes:L,center:x},bottomLeft:{type:"bottom-left",vertexes:k,center:b},bottomRight:{type:"bottom-right",vertexes:O,center:S},leftMiddle:{type:"left-middle",vertexes:N,center:y},rightMiddle:{type:"right-middle",vertexes:F,center:w},topMiddle:{type:"top-middle",vertexes:G,center:v},bottomMiddle:{type:"bottom-middle",vertexes:B,center:m},rotate:{type:"rotate",vertexes:Pe(Ye(X,{size:a,angle:f})),center:X}}}function Fe(e,t){const{controllerSize:i,viewScaleInfo:o}=t,n=i&&i>0?i:8,{x:a,y:r,w:s,h:l}=We(e,{viewScaleInfo:o}),h=ue({x:a,y:r,w:s,h:l}),c={x:h.x,y:r},d={x:a+s,y:h.y},f={x:h.x,y:r+l},u={x:a,y:h.y},g={x:a,y:r},v={x:a+s,y:r},w={x:a+s,y:r+l},m={x:a,y:r+l},y=Ye(c,{size:n,angle:0}),p=Ye(d,{size:n,angle:0}),x=Ye(f,{size:n,angle:0}),S=Ye(u,{size:n,angle:0}),b=Ye(g,{size:n,angle:0}),I=Ye(v,{size:n,angle:0}),A=Ye(m,{size:n,angle:0}),M=Ye(w,{size:n,angle:0}),z=Pe(b),R=Pe(I),P=Pe(A),T=Pe(M),E=[z[1],R[0],R[3],z[2]],W=[R[3],R[2],T[1],T[0]],C=[P[1],T[0],T[3],P[2]],L=[z[3],z[2],P[1],P[0]],k=Pe(y),O=Pe(p),j=Pe(x);return{left:{type:"left",vertexes:L,center:u},right:{type:"right",vertexes:W,center:d},top:{type:"top",vertexes:E,center:c},bottom:{type:"bottom",vertexes:C,center:f},topLeft:{type:"top-left",vertexes:z,center:g},topRight:{type:"top-right",vertexes:R,center:v},bottomLeft:{type:"bottom-left",vertexes:P,center:m},bottomRight:{type:"bottom-right",vertexes:T,center:w},leftMiddle:{type:"left-middle",vertexes:Pe(S),center:u},rightMiddle:{type:"right-middle",vertexes:O,center:d},topMiddle:{type:"top-middle",vertexes:k,center:c},bottomMiddle:{type:"bottom-middle",vertexes:j,center:f}}}function Be(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function Ne(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}ie=new WeakMap,oe=new WeakMap,te=new WeakSet,ne=function(){return W(re(this,oe,"f"))};const Xe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function He(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=Xe.boxSizing,borderWidth:r}=e.detail;Array.isArray(r)&&(n=0);let{x:s,y:l,w:h,h:c}=e,d=[0,0,0,0];if("number"==typeof n){const e=n*o;d=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(d=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let f=0;return"number"==typeof r&&(f=(r||0)*o),"border-box"===a?(s=e.x+f/2,l=e.y+f/2,h=e.w-f,c=e.h-f):"content-box"===a?(s=e.x-f/2,l=e.y-f/2,h=e.w+f,c=e.h+f):(s=e.x,l=e.y,h=e.w,c=e.h),h=Math.max(h,1),c=Math.max(c,1),d=d.map((e=>Math.min(e,h/2,c/2))),{x:s,y:l,w:h,h:c,radiusList:d}}const Ze=e=>Ne(e,{decimalPlaces:4});function Qe(e,t){const{detail:i}=e,{xRatio:o,yRatio:n,maxRatio:a}=t,r=(o+n)/2,{borderWidth:s,borderRadius:l,borderDash:h,shadowOffsetX:c,shadowOffsetY:d,shadowBlur:f}=i;if("number"==typeof s)i.borderWidth=Ze(s*r);else if(Array.isArray(i.borderWidth)){const e=s;i.borderWidth=[Ze(e[0]*n),Ze(e[1]*o),Ze(e[2]*n),Ze(e[3]*o)]}if("number"==typeof l)i.borderRadius=Ze(l*r);else if(Array.isArray(i.borderRadius)){const e=l;i.borderRadius=[e[0]*o,e[1]*o,e[2]*n,e[3]*n]}Array.isArray(h)&&h.forEach(((e,t)=>{i.borderDash[t]=Ze(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Ze(c*a)),"number"==typeof d&&(i.shadowOffsetX=Ze(d*a)),"number"==typeof f&&(i.shadowOffsetX=Ze(f*a))}function Ue(e,t){const{type:i}=e;!function(e,t){const{xRatio:i,yRatio:o}=t,{x:n,y:a,w:r,h:s}=e;e.x=Ze(n*i),e.y=Ze(a*o),e.w=Ze(r*i),e.h=Ze(s*o),Qe(e,t)}(e,t),"circle"===i||("text"===i?function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:a}=e.detail,r=(i+o)/2;n&&n>0&&(e.detail.fontSize=Ze(n*r)),a&&a>0&&(e.detail.lineHeight=Ze(a*r))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ue(e,t)})))}function Je(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:a=1}=i,{x:r,y:s}=o,{scale:l}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l},c={x:r+o.x*l,y:s+o.y*l},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,R(e.color,a))})),d}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l,radius:i.radius*l},c={x:r+o.x*l,y:s+o.y*l,radius:o.radius*l},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,R(e.color,a))})),d}return"#000000"}const $e={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Ke(e){var t,i,o,n;let a=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(a=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),a}function qe(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=Ke(a)*h;!function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:a,viewSizeInfo:r}=i,s=r.devicePixelRatio,{clipPath:l}=(null==n?void 0:n.detail)||{};if(l&&a&&l.commands){const{x:i,y:n,w:r,h:h}=a,{originW:c,originH:d,originX:f,originY:u}=l,g=r/c,v=h/d,w=i-f*g,m=n-u*v;e.save(),e.translate(w,m),e.scale(s*g,s*v);const y=Be(l.commands||[]),p=new Path2D(y);e.clip(p),e.translate(0-w,0-m),e.setTransform(1,0,0,1,0,0),fe(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l,renderContent:()=>{e.globalAlpha=c,_e(e,t,{pattern:o,viewScaleInfo:s,viewSizeInfo:l}),null==n||n(),et(e,t,{viewScaleInfo:s,viewSizeInfo:l}),e.globalAlpha=h}})}function _e(e,t,i){var o,n;const{pattern:a,viewScaleInfo:r,viewSizeInfo:s}=i,l=[];if(t.detail.background||a){const{x:i,y:h,w:c,h:d,radiusList:f}=He(t,{viewScaleInfo:r,viewSizeInfo:s});if(e.beginPath(),e.moveTo(i+f[0],h),e.arcTo(i+c,h,i+c,h+d,f[1]),e.arcTo(i+c,h+d,i,h+d,f[2]),e.arcTo(i,h+d,i,h,f[3]),e.arcTo(i,h,i+c,h,f[0]),e.closePath(),"string"==typeof a)e.fillStyle=a;else if(["CanvasPattern"].includes(L.type(a)))e.fillStyle=a;else if("string"==typeof t.detail.background)e.fillStyle=t.detail.background;else if("linear-gradient"===(null===(o=t.detail.background)||void 0===o?void 0:o.type)){const o=Je(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=Je(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=o,l&&l.length>0)for(let t=0;t<(null==l?void 0:l.length);t++){const o=l[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+h):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill(),l&&l.length>0&&e.setTransform(1,0,0,1,0,0)}}function et(e,t,i){if(0===t.detail.borderWidth)return;if(!z(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=$e.borderColor;!0===z(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:r,borderRadius:s,borderDash:l,boxSizing:h=$e.boxSizing}=t.detail;let c=0;"number"==typeof r&&(c=r||1),c*=n;let d=[0,0,0,0];if("number"==typeof s){const e=s*n;d=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(d=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);e.strokeStyle=a;let f=[];Array.isArray(l)&&l.length>0&&(f=l.map((e=>Math.ceil(e*n))));let u=0,g=0,v=0,w=0;if(Array.isArray(r)&&(u=(r[0]||0)*n,g=(r[1]||0)*n,v=(r[2]||0)*n,w=(r[3]||0)*n),w||g||u||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=w/2,o+=u/2,n=n-w/2-g/2,a=a-u/2-v/2):"content-box"===h?(i-=w/2,o-=u/2,n=n+w/2+g/2,a=a+u/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),u&&(e.beginPath(),e.lineWidth=u,e.moveTo(i-w/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-u/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-w/2,o+a),e.lineTo(i+n+g/2,o+a),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i,o-u/2),e.lineTo(i,o+a+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i=t.x+c/2,o=t.y+c/2,n=t.w-c,a=t.h-c):"content-box"===h?(i=t.x-c/2,o=t.y-c/2,n=t.w+c,a=t.h+c):(i=t.x,o=t.y,n=t.w,a=t.h),f.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),d=d.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(f),e.lineWidth=c,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+a,d[1]),e.arcTo(i+n,o+a,i,o+a,d[2]),e.arcTo(i,o+a,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}function tt(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:r,shadowOffsetX:s,shadowOffsetY:l,shadowBlur:h}=o;N.number(h)?(e.save(),e.shadowColor=r||$e.shadowColor,e.shadowOffsetX=(s||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):(e.save(),e.shadowColor="transparent",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,a(),e.restore())}const it={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ot(e,t,i){var o;if(!0===(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))return;const{w:n,h:a}=t,{scale:r}=i.viewScaleInfo;if(!(r<1&&(n*r<1||a*r<1)||0===i.parentOpacity))try{switch(t.type){case"rect":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:r,y:s,w:l,h:h,angle:c}=We(t,{viewScaleInfo:o,viewSizeInfo:n})||t,d=Object.assign(Object.assign({},t),{x:r,y:s,w:l,h:h,angle:c});fe(e,{x:r,y:s,w:l,h:h,angle:c},(()=>{tt(e,d,{viewScaleInfo:o,viewSizeInfo:n,renderContent:()=>{qe(e,d,{originElem:t,calcElemSize:{x:r,y:s,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{background:l="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:d=0}=o;let f=0;"number"==typeof d&&d>0?f=d:Array.isArray(d)&&"number"==typeof d[0]&&d[0]>0&&(f=d[0]),f*=a.scale;const{x:u,y:g,w:v,h:w}=We({x:t.x,y:t.y,w:t.w,h:t.h},{viewScaleInfo:a,viewSizeInfo:r})||t,m=Object.assign(Object.assign({},t),{x:u,y:g,w:v,h:w,angle:n});fe(e,{x:u,y:g,w:v,h:w,angle:n},(()=>{tt(e,m,{viewScaleInfo:a,viewSizeInfo:r,renderContent:()=>{let t=v/2,i=w/2;const o=u+t,n=g+i;if(f>0&&("border-box"===c?(t-=f,i-=f):"center-line"===c?(t-=f/2,i-=f/2):(t-=f,i-=f)),t>=0&&i>=0){const r=Ke(m)*s;if(e.globalAlpha=r,"number"==typeof f&&f>0){const a=f/2+t,r=f/2+i;e.beginPath(),e.strokeStyle=h,e.lineWidth=f,e.circle(o,n,a,r,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const c=Je(e,l,{viewElementSize:{x:u,y:g,w:v,h:w},viewScaleInfo:a,opacity:e.globalAlpha});e.fillStyle=c,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=s}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:r,y:s,w:l,h:h,angle:c}=We(t,{viewScaleInfo:o})||t,d=Object.assign(Object.assign({},t),{x:r,y:s,w:l,h:h,angle:c});fe(e,{x:r,y:s,w:l,h:h,angle:c},(()=>{qe(e,d,{originElem:t,calcElemSize:{x:r,y:s,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{const i=Object.assign(Object.assign({},it),t.detail),n=i.fontSize||it.fontSize,a=n*o.scale,c=(i.lineHeight||n)*o.scale;e.fillStyle=t.detail.color||it.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:a,fontFamily:i.fontFamily});const d=i.text.replace(/\r\n/gi,"\n"),f=c,u=d.split("\n"),g=[];let v=0;u.forEach(((t,i)=>{let o="";if(t.length>0){for(let n=0;n<t.length&&(e.measureText(o+(t[n]||"")).width<=e.$doPixelRatio(l)?o+=t[n]||"":(g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",v++),!((v+1)*f>h));n++)if(t.length-1===n&&(v+1)*f<=h){g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<u.length-1&&v++;break}}else g.push({text:"",width:0})}));let w=0;g.length*f<h&&("top"===t.detail.verticalAlign?w=0:"bottom"===t.detail.verticalAlign?w+=h-g.length*f:w+=(h-g.length*f)/2);{const t=s+w;void 0!==i.textShadowColor&&z(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&N.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&N.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&N.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),g.forEach(((o,n)=>{let a=r;"center"===i.textAlign?a=r+(l-o.width)/2:"right"===i.textAlign&&(a=r+(l-o.width)),e.fillText(o.text,a,t+f*n)}))}}})}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{tt(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{qe(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{if(o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=Ke(t)*r;const{x:i,y:s,w:l,h:h,radiusList:c}=He(f,{viewScaleInfo:n,viewSizeInfo:a});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+c[0],s),e.arcTo(i+l,s,i+l,s+h,c[1]),e.arcTo(i+l,s+h,i,s+h,c[2]),e.arcTo(i,s+h,i,s,c[3]),e.arcTo(i,s,i+l,s,c[0]),e.closePath(),e.fill(),e.clip(),e.drawImage(o,i,s,l,h),e.globalAlpha=r,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t;fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=Ke(t)*r,e.drawImage(o,s,l,h,c),e.globalAlpha=r)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t;fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=Ke(t)*r,e.drawImage(o,s,l,h,c),e.globalAlpha=r)}))}(e,t,i);break;case"path":!function(e,t,i){const{detail:o}=t,{originX:n,originY:a,originW:r,originH:s}=o,{viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c}=i,{x:d,y:f,w:u,h:g,angle:v}=We(t,{viewScaleInfo:l,viewSizeInfo:h})||t,w=u/r,m=g/s,y=d-n*w,p=f-a*m,x=l.scale*h.devicePixelRatio,S=Object.assign(Object.assign({},t),{x:d,y:f,w:u,h:g,angle:v});fe(e,{x:d,y:f,w:u,h:g,angle:v},(()=>{qe(e,S,{originElem:t,calcElemSize:{x:d,y:f,w:u,h:g,angle:v},viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c,renderContent:()=>{tt(e,S,{viewScaleInfo:l,viewSizeInfo:h,renderContent:()=>{e.save(),e.translate(y,p),e.scale(x*w/l.scale,x*m/l.scale);const t=Be(o.commands||[]),i=new Path2D(t);o.fill&&(e.fillStyle=o.fill,e.fill(i)),o.stroke&&0!==o.strokeWidth&&(e.strokeStyle=o.stroke,e.lineWidth=(o.strokeWidth||1)/h.devicePixelRatio,e.lineCap=o.strokeLineCap||"square",e.stroke(i)),e.translate(-y,-p),e.restore()}})}})}))}(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:r,y:s,w:l,h:h,angle:c}=We({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},{viewScaleInfo:o,viewSizeInfo:n})||t,d=Object.assign(Object.assign({},t),{x:r,y:s,w:l,h:h,angle:c});fe(e,{x:r,y:s,w:l,h:h,angle:c},(()=>{e.globalAlpha=Ke(t)*a,tt(e,d,{viewScaleInfo:o,viewSizeInfo:n,renderContent:()=>{qe(e,d,{originElem:t,calcElemSize:{x:r,y:s,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{const{x:r,y:s,w:l,h:h,radiusList:c}=He(d,{viewScaleInfo:o,viewSizeInfo:n});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(r+c[0],s),e.arcTo(r+l,s,r+l,s+h,c[1]),e.arcTo(r+l,s+h,r,s+h,c[2]),e.arcTo(r,s+h,r,s,c[3]),e.arcTo(r,s,r+l,s,c[0]),e.closePath(),e.fill(),e.clip()),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:r}=i;for(let o=0;o<t.detail.children.length;o++){let s=t.detail.children[o];if(s=Object.assign(Object.assign({},s),{x:n.x+s.x,y:n.y+s.y}),!0===i.forceDrawAll||(null==r?void 0:r.needRender(s)))try{ot(e,s,Object.assign(Object.assign({},i),{parentOpacity:a*Ke(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=a}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const nt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function at(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:a}=i;for(let t=0;t<n.length;t++){const r=n[t],s=Object.assign(Object.assign({},r),{detail:Object.assign(Object.assign({},nt),null==r?void 0:r.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.needRender(s)))try{ot(e,s,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(e){console.error(e)}}}var rt,st,lt,ht,ct,dt,ft,ut,gt,vt,wt,mt,yt=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))},pt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},xt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const St=["image","svg","html"],bt=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${n}`)?n:E(n):E(`${P()}-${e.uuid}-${P()}-${P()}`)};class It extends _{constructor(){super(),rt.add(this),st.set(this,{}),lt.set(this,{}),ht.set(this,{}),ct.set(this,!1),pt(this,rt,"m",dt).call(this,"image",((e,t)=>yt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield j(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),pt(this,rt,"m",dt).call(this,"html",((e,t)=>yt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield V(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),pt(this,rt,"m",dt).call(this,"svg",((e,t)=>yt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield D(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return pt(this,ct,"f")}destroy(){xt(this,ct,!0,"f"),this.clear(),xt(this,st,null,"f"),xt(this,lt,null,"f"),xt(this,ht,null,"f")}load(e,t){!0!==pt(this,ct,"f")&&(pt(this,rt,"m",mt).call(this,e)||St.includes(e.type)&&pt(this,rt,"m",wt).call(this,e,t))}getContent(e){var t,i;const o=bt(e);return(null===(i=null===(t=pt(this,ht,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return pt(this,ht,"f")}setLoadItemMap(e){xt(this,ht,e,"f")}}st=new WeakMap,lt=new WeakMap,ht=new WeakMap,ct=new WeakMap,rt=new WeakSet,dt=function(e,t){pt(this,st,"f")[e]=t},ft=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},ut=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:pt(this,rt,"m",ft).call(this,e)}},gt=function(e){const t=bt(e.element),i=pt(this,ht,"f")[t];pt(this,ct,"f")||(i?i.startTime<e.startTime&&(pt(this,ht,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(pt(this,ht,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},vt=function(e){var t;const i=bt(e.element),o=null===(t=pt(this,ht,"f"))||void 0===t?void 0:t[i];pt(this,ct,"f")||(o?o.startTime<e.startTime&&(pt(this,ht,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(pt(this,ht,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},wt=function(e,t){const i=pt(this,rt,"m",ut).call(this,e),o=bt(e);if(pt(this,lt,"f")[o])return;pt(this,lt,"f")[o]=i;const n=pt(this,st,"f")[e.type];"function"!=typeof n||pt(this,ct,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{pt(this,ct,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",pt(this,rt,"m",gt).call(this,i))})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,pt(this,rt,"m",vt).call(this,i)})))},mt=function(e){var t;const i=bt(e),o=null===(t=pt(this,lt,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==pt(this,rt,"m",ft).call(this,e))};var At,Mt,zt,Rt,Pt,Tt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Et=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Wt extends _{constructor(e){super(),At.add(this),Mt.set(this,void 0),zt.set(this,new It),Rt.set(this,!1),Tt(this,Mt,e,"f"),Et(this,At,"m",Pt).call(this)}isDestroyed(){return Et(this,Rt,"f")}destroy(){this.clear(),Tt(this,Mt,null,"f"),Et(this,zt,"f").destroy(),Tt(this,zt,null,"f"),Tt(this,Rt,!0,"f")}updateOptions(e){Tt(this,Mt,e,"f")}drawData(e,t){const i=Et(this,zt,"f"),{calculator:o}=Et(this,Mt,"f"),n=Et(this,Mt,"f").viewContext;n.clearRect(0,0,n.canvas.width,n.canvas.height);const a={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height},r=Object.assign({loader:i,calculator:o,parentElementSize:a,elementAssets:e.assets,parentOpacity:1},t);e.layout?function(e,t,i,o){const{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,s=Object.assign({uuid:"layout",type:"group"},t),{x:l,y:h,w:c,h:d}=We(s,{viewScaleInfo:n,viewSizeInfo:a})||s,f=Object.assign(Object.assign({},s),{x:l,y:h,w:c,h:d,angle:0});if(e.globalAlpha=1,tt(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{_e(e,f,{viewScaleInfo:n,viewSizeInfo:a})}}),"hidden"===t.detail.overflow){const{viewScaleInfo:o,viewSizeInfo:n}=i,a=Object.assign({uuid:"layout",type:"group"},t),r=We(a,{viewScaleInfo:o,viewSizeInfo:n})||a,s=Object.assign(Object.assign({},a),r),{x:l,y:h,w:c,h:d,radiusList:f}=He(s,{viewScaleInfo:o,viewSizeInfo:n});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(l+f[0],h),e.arcTo(l+c,h,l+c,h+d,f[1]),e.arcTo(l+c,h+d,l,h+d,f[2]),e.arcTo(l,h+d,l,h,f[3]),e.arcTo(l,h,l+c,h,f[0]),e.closePath(),e.fill(),e.clip()}o(e),"hidden"===t.detail.overflow&&e.restore(),et(e,f,{viewScaleInfo:n,viewSizeInfo:a}),e.globalAlpha=r}(n,e.layout,r,(()=>{at(n,e,r)})):at(n,e,r)}scale(e){const{sharer:t}=Et(this,Mt,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r,width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){Et(this,zt,"f").setLoadItemMap(e)}getLoadItemMap(){return Et(this,zt,"f").getLoadItemMap()}getLoader(){return Et(this,zt,"f")}}Mt=new WeakMap,zt=new WeakMap,Rt=new WeakMap,At=new WeakSet,Pt=function(){const e=Et(this,zt,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};var Ct,Lt,kt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Ot=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class jt{constructor(e){Ct.set(this,void 0),Lt.set(this,void 0),kt(this,Ct,e,"f"),kt(this,Lt,new se({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}),"f")}toGridNum(e,t){return!0===(null==t?void 0:t.ignore)?e:Math.round(e)}destroy(){kt(this,Ct,null,"f")}needRender(e){const t=Ot(this,Lt,"f").get("viewVisibleInfoMap")[e.uuid];return!t||t.isVisibleInView}isPointInElement(e,t,i,o){return ke(e,{context2d:Ot(this,Ct,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=Ot(this,Ct,"f").viewContext;return function(e,t){var i,o,n;const{context2d:a,data:r,viewScaleInfo:s,viewSizeInfo:l,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,r=0,d=0;for(let e=0;e<=t;e++)n+=h[e].x,r+=h[e].y,d+=h[e].angle||0;const f=h[t];if(f&&"group"===f.type&&Array.isArray(null===(i=f.detail)||void 0===i?void 0:i.children))for(let i=0;i<f.detail.children.length;i++){const u=f.detail.children[i];if(!0!==(null===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(ke(e,{context2d:a,element:{x:n+u.x,y:r+u.y,w:u.w,h:u.h,angle:d+(u.angle||0)},viewScaleInfo:s,viewSizeInfo:l})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=r.elements.length-1;t>=0;t--){const i=r.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&ke(e,{context2d:a,element:i,viewScaleInfo:s,viewSizeInfo:l})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}resetViewVisibleInfoMap(e,t){if(e){const{viewVisibleInfoMap:i,invisibleCount:o,visibleCount:n}=function(e,t){const i={},o=[],n=t=>{const a={isVisibleInView:!0,isGroup:"group"===t.type,position:[...o]};let r=null;r=je(t,{groupQueue:Ae(e,o)||[]}),i[t.uuid]=Object.assign(Object.assign({},a),{originRectInfo:r,rangeRectInfo:N.angle(t.angle)?De(r):r}),"group"===t.type&&t.detail.children.forEach(((e,t)=>{o.push(t),n(e),o.pop()}))};return e.forEach(((e,t)=>{o.push(t),n(e),o.pop()})),Ve(i,t)}(e.elements,t);Ot(this,Lt,"f").set("viewVisibleInfoMap",i),Ot(this,Lt,"f").set("invisibleCount",o),Ot(this,Lt,"f").set("visibleCount",n)}}updateVisiableStatus(e){const{viewVisibleInfoMap:t,invisibleCount:i,visibleCount:o}=Ve(Ot(this,Lt,"f").get("viewVisibleInfoMap"),e);Ot(this,Lt,"f").set("viewVisibleInfoMap",t),Ot(this,Lt,"f").set("invisibleCount",i),Ot(this,Lt,"f").set("visibleCount",o)}calcViewRectInfoFromOrigin(e,t){const i=Ot(this,Lt,"f").get("viewVisibleInfoMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:a}=t,{center:r,left:s,right:l,bottom:h,top:c,topLeft:d,topRight:f,bottomLeft:u,bottomRight:g}=i.originRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n,viewSizeInfo:a};return{center:Ce(r,v),left:Ce(s,v),right:Ce(l,v),bottom:Ce(h,v),top:Ce(c,v),topLeft:Ce(d,v),topRight:Ce(f,v),bottomLeft:Ce(u,v),bottomRight:Ce(g,v)}}calcViewRectInfoFromRange(e,t){const i=Ot(this,Lt,"f").get("viewVisibleInfoMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:a}=t,{center:r,left:s,right:l,bottom:h,top:c,topLeft:d,topRight:f,bottomLeft:u,bottomRight:g}=i.rangeRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n,viewSizeInfo:a};return{center:Ce(r,v),left:Ce(s,v),right:Ce(l,v),bottom:Ce(h,v),top:Ce(c,v),topLeft:Ce(d,v),topRight:Ce(f,v),bottomLeft:Ce(u,v),bottomRight:Ce(g,v)}}modifyViewVisibleInfoMap(e,t){const{modifyOptions:i,viewScaleInfo:o,viewSizeInfo:n}=t,{type:a,content:r}=i,s=e.elements,l=Ot(this,Lt,"f").get("viewVisibleInfoMap");if("deleteElement"===a){const{element:e}=r;delete l[e.uuid]}else if("addElement"===a||"updateElement"===a){const{position:t}=r,i=Me(t,e.elements),h=Ae(s,t);if(i){const e=je(i,{groupQueue:h||[]}),r={originRectInfo:e,rangeRectInfo:N.angle(i.angle)?De(e):e,isVisibleInView:!0,isGroup:"group"===(null==i?void 0:i.type),position:[...t]};l[i.uuid]=r,"updateElement"===a&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:n})}}else"moveElement"===a&&this.resetViewVisibleInfoMap(e,{viewScaleInfo:o,viewSizeInfo:n});Ot(this,Lt,"f").set("viewVisibleInfoMap",l)}}Ct=new WeakMap,Lt=new WeakMap;var Dt,Vt,Yt,Gt,Ft,Bt,Nt,Xt,Ht,Zt,Qt,Ut,Jt,$t,Kt,qt,_t=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ei=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};function ti(e){return e>0||e<0||0===e}class ii extends _{constructor(e){super(),Dt.add(this),Vt.set(this,void 0),Yt.set(this,void 0),Gt.set(this,!1),Bt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;const t=ei(this,Dt,"m",Kt).call(this,e);if(!ei(this,Dt,"m",qt).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),Nt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)})),Xt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);if(!ei(this,Dt,"m",qt).call(this,t))return;const i=Date.now(),o=ei(this,Yt,"f").get("prevClickPoint");o&&i-o.t<=500&&Math.abs(o.x-t.x)<=5&&Math.abs(o.y-t.y)<=5?this.trigger("doubleClick",{point:t}):ei(this,Yt,"f").set("prevClickPoint",t)})),Ht.set(this,(e=>{if(ei(this,Yt,"f").set("hasPointDown",!1),!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);this.trigger("pointLeave",{point:t})})),Zt.set(this,(e=>{if(ei(this,Yt,"f").set("hasPointDown",!1),!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);this.trigger("pointEnd",{point:t})})),Qt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)?!0===ei(this,Yt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):ei(this,Yt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),ei(this,Yt,"f").set("hasPointDown",!1))})),Ut.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)&&(ei(this,Yt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),Jt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new se({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});_t(this,Yt,t,"f"),_t(this,Vt,e,"f"),ei(this,Dt,"m",Ft).call(this)}onEvents(){if(ei(this,Gt,"f"))return;const e=window;e.addEventListener("mousemove",ei(this,Jt,"f")),e.addEventListener("mousedown",ei(this,Ut,"f")),e.addEventListener("mousemove",ei(this,Qt,"f")),e.addEventListener("mouseup",ei(this,Zt,"f")),e.addEventListener("mouseleave",ei(this,Ht,"f")),e.addEventListener("wheel",ei(this,Bt,"f"),{passive:!1}),e.addEventListener("click",ei(this,Xt,"f")),e.addEventListener("contextmenu",ei(this,Nt,"f"))}offEvents(){const e=window;e.removeEventListener("mousemove",ei(this,Jt,"f")),e.removeEventListener("mousedown",ei(this,Ut,"f")),e.removeEventListener("mousemove",ei(this,Qt,"f")),e.removeEventListener("mouseup",ei(this,Zt,"f")),e.removeEventListener("mouseleave",ei(this,Ht,"f")),e.removeEventListener("wheel",ei(this,Bt,"f")),e.removeEventListener("click",ei(this,Xt,"f")),e.removeEventListener("contextmenu",ei(this,Nt,"f"))}destroy(){this.offEvents(),ei(this,Yt,"f").destroy(),_t(this,Gt,!0,"f")}}Vt=new WeakMap,Yt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,Nt=new WeakMap,Xt=new WeakMap,Ht=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Ut=new WeakMap,Jt=new WeakMap,Dt=new WeakSet,Ft=function(){this.onEvents()},$t=function(e){return e.target===ei(this,Vt,"f").boardContent.boardContext.canvas},Kt=function(e){const t=ei(this,Vt,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},qt=function(e){const t=ei(this,Vt,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(ti(e.x)&&ti(e.y)&&e.x<=i&&e.y<=o)};var oi,ni,ai=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ri=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const si={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class li{constructor(){oi.set(this,void 0),ni.set(this,void 0);const e=new se({defaultStorage:si}),t=new se({defaultStorage:{}});ai(this,oi,e,"f"),ai(this,ni,t,"f")}getActiveStorage(e){return ri(this,oi,"f").get(e)}setActiveStorage(e,t){return ri(this,oi,"f").set(e,t)}getActiveStoreSnapshot(e){return ri(this,oi,"f").getSnapshot(e)}getSharedStorage(e){return ri(this,ni,"f").get(e)}setSharedStorage(e,t){return ri(this,ni,"f").set(e,t)}getSharedStoreSnapshot(e){return ri(this,ni,"f").getSnapshot(e)}getActiveViewScaleInfo(){return{scale:ri(this,oi,"f").get("scale"),offsetTop:ri(this,oi,"f").get("offsetTop"),offsetBottom:ri(this,oi,"f").get("offsetBottom"),offsetLeft:ri(this,oi,"f").get("offsetLeft"),offsetRight:ri(this,oi,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;ri(this,oi,"f").set("scale",t),ri(this,oi,"f").set("offsetTop",i),ri(this,oi,"f").set("offsetBottom",o),ri(this,oi,"f").set("offsetLeft",n),ri(this,oi,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){ri(this,oi,"f").set("width",e.width),ri(this,oi,"f").set("height",e.height),ri(this,oi,"f").set("devicePixelRatio",e.devicePixelRatio),ri(this,oi,"f").set("contextWidth",e.contextWidth),ri(this,oi,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:ri(this,oi,"f").get("width"),height:ri(this,oi,"f").get("height"),devicePixelRatio:ri(this,oi,"f").get("devicePixelRatio"),contextWidth:ri(this,oi,"f").get("contextWidth"),contextHeight:ri(this,oi,"f").get("contextHeight")}}}oi=new WeakMap,ni=new WeakMap;var hi,ci,di,fi,ui,gi,vi=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},wi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const{requestAnimationFrame:mi}=window;class yi extends _{constructor(e){super(),hi.add(this),ci.set(this,void 0),di.set(this,[]),fi.set(this,"FREE"),vi(this,ci,e,"f"),wi(this,hi,"m",ui).call(this)}resetViewVisibleInfoMap(e,t){e&&wi(this,ci,"f").calculator.resetViewVisibleInfoMap(e,t)}drawFrame(){const{sharer:e}=wi(this,ci,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();wi(this,di,"f").push({activeStore:t,sharedStore:i}),wi(this,hi,"m",gi).call(this)}scale(e){const{scale:t,point:i,ignoreUpdateVisibleStatus:o}=e,{sharer:n}=wi(this,ci,"f"),{moveX:a,moveY:r}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:a}=o,r=t/o.scale,s=i.x,l=i.y;return{moveX:s-s*r+(n*r-n),moveY:l-l*r+(a*r-a)}}({scale:t,point:i,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()});return n.setActiveStorage("scale",t),o||wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),{moveX:a,moveY:r}}scroll(e){const{sharer:t}=wi(this,ci,"f"),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n,ignoreUpdateVisibleStatus:a}=e,r=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:a}=o,{width:r,height:s,contextWidth:l,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,f=o.offsetTop,u=o.offsetBottom;return c+=t,f+=i,d=r-(l*a+c),u=s-(h*a+f),{scale:a,offsetTop:f,offsetLeft:c,offsetRight:d,offsetBottom:u}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(r),a||wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),r}updateViewScaleInfo(e){const{sharer:t}=wi(this,ci,"f"),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:a}=t,{width:r,height:s,contextWidth:l,contextHeight:h}=a,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:r-(l*i+c/i),offsetBottom:s-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),i}resize(e={},t){const{sharer:i}=wi(this,ci,"f"),o=i.getActiveViewSizeInfo(),n=Object.assign(Object.assign({},o),e),{width:a,height:r,devicePixelRatio:s}=n,{underContext:l,boardContext:h,helperContext:c,viewContext:d}=wi(this,ci,"f").boardContent;return h.canvas.width=a*s,h.canvas.height=r*s,h.canvas.style.width=`${a}px`,h.canvas.style.height=`${r}px`,l.canvas.width=a*s,l.canvas.height=r*s,c.canvas.width=a*s,c.canvas.height=r*s,d.canvas.width=a*s,d.canvas.height=r*s,i.setActiveViewSizeInfo(n),(null==t?void 0:t.ignoreUpdateVisibleStatus)||wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}ci=new WeakMap,di=new WeakMap,fi=new WeakMap,hi=new WeakSet,ui=function(){const{renderer:e}=wi(this,ci,"f");e.on("load",(()=>{this.drawFrame()}))},gi=function e(){if("DRAWING"===wi(this,fi,"f")||0===wi(this,di,"f").length)return;vi(this,fi,"DRAWING","f");const t=wi(this,di,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=wi(this,ci,"f");if(t){const{scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h,width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g}=t.activeStore,v={scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h},w={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:w}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==wi(this,di,"f").length?vi(this,fi,"DRAWING","f")&&mi((()=>{wi(this,hi,"m",e).call(this)})):vi(this,fi,"COMPLETE","f")};var pi,xi,Si,bi,Ii,Ai,Mi,zi,Ri,Pi,Ti,Ei,Wi,Ci,Li,ki,Oi,ji,Di,Vi,Yi,Gi,Fi,Bi,Ni,Xi,Hi,Zi=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Qi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Ui{constructor(e){pi.add(this),xi.set(this,void 0),Si.set(this,new WeakMap),bi.set(this,[]),Ii.set(this,[]),Ai.set(this,void 0),Mi.set(this,void 0),zi.set(this,void 0),Ri.set(this,void 0),Pi.set(this,void 0),Ti.set(this,new _),Ei.set(this,!1);const{boardContent:t}=e,i=new li,o=new jt({viewContext:t.viewContext}),n=new ii({boardContent:t,sharer:i}),a=new Wt({viewContext:t.viewContext,sharer:i,calculator:o});Zi(this,xi,e,"f"),Zi(this,zi,i,"f"),Zi(this,Ai,n,"f"),Zi(this,Mi,a,"f"),Zi(this,Pi,o,"f"),Zi(this,Ri,new yi({boardContent:e.boardContent,sharer:i,renderer:a,calculator:Qi(this,Pi,"f"),beforeDrawFrame:e=>{Qi(this,pi,"m",Ni).call(this,e)},afterDrawFrame:e=>{Qi(this,pi,"m",Xi).call(this,e)}}),"f"),Qi(this,pi,"m",Wi).call(this),Qi(this,pi,"m",Hi).call(this)}isDestroyed(){return Qi(this,Ei,"f")}destroy(){Qi(this,Ai,"f").destroy(),Qi(this,Mi,"f").destroy(),Qi(this,Pi,"f").destroy(),Qi(this,Ti,"f").destroy(),Zi(this,Ei,!0,"f")}getSharer(){return Qi(this,zi,"f")}getViewer(){return Qi(this,Ri,"f")}getRenderer(){return Qi(this,Mi,"f")}setData(e,t){const{modifiedOptions:i}=t||{},o=Qi(this,zi,"f");Qi(this,zi,"f").setActiveStorage("data",e);const n=o.getActiveViewSizeInfo(),a=o.getActiveViewScaleInfo(),r=Ie(e.elements,{viewWidth:n.width,viewHeight:n.height,extend:!0});Qi(this,Ri,"f").resetViewVisibleInfoMap(e,{viewSizeInfo:n,viewScaleInfo:a}),Qi(this,Ri,"f").drawFrame();const s=Object.assign(Object.assign({},n),r);return Qi(this,zi,"f").setActiveViewSizeInfo(s),{viewSizeInfo:s}}getData(){const{data:e}=Qi(this,zi,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(Qi(this,Si,"f").has(e)){const o=Qi(this,Si,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",Qi(this,Si,"f").set(e,o),void Qi(this,pi,"m",Hi).call(this)}const{boardContent:n,container:a}=Qi(this,xi,"f"),r=e({boardContent:n,sharer:Qi(this,zi,"f"),viewer:Qi(this,Ri,"f"),calculator:Qi(this,Pi,"f"),eventHub:Qi(this,Ti,"f"),container:a});null===(o=r.use)||void 0===o||o.call(r),Qi(this,bi,"f").push(e),Qi(this,Ii,"f").push(r),Qi(this,Si,"f").set(e,{status:"enable",middlewareObject:r}),Qi(this,pi,"m",Hi).call(this)}disuse(e){var t,i;const o=Qi(this,Si,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",Qi(this,Si,"f").set(e,o),Qi(this,pi,"m",Hi).call(this))}scale(e){const t=Qi(this,Ri,"f"),{ignoreUpdateVisibleStatus:i}=e,{moveX:o,moveY:n}=t.scale(Object.assign(Object.assign({},e),{ignoreUpdateVisibleStatus:!0}));t.scroll({moveX:o,moveY:n,ignoreUpdateVisibleStatus:i})}scroll(e){return Qi(this,Ri,"f").scroll(e)}updateViewScaleInfo(e){return Qi(this,Ri,"f").updateViewScaleInfo(e)}resize(e,t){const i=Qi(this,Ri,"f").resize(e,t),{width:o,height:n,devicePixelRatio:a}=e,{boardContent:r}=Qi(this,xi,"f");r.viewContext.$resize({width:o,height:n,devicePixelRatio:a}),r.helperContext.$resize({width:o,height:n,devicePixelRatio:a}),r.boardContext.$resize({width:o,height:n,devicePixelRatio:a}),r.underContext.$resize({width:o,height:n,devicePixelRatio:a}),Qi(this,Ri,"f").drawFrame(),Qi(this,Ai,"f").trigger("resize",i),Qi(this,zi,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=Qi(this,xi,"f"),{underContext:t,helperContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),Qi(this,pi,"m",Bi).call(this)}getEventHub(){return Qi(this,Ti,"f")}onWatcherEvents(){Qi(this,Ai,"f").onEvents()}offWatcherEvents(){Qi(this,Ai,"f").offEvents()}}xi=new WeakMap,Si=new WeakMap,bi=new WeakMap,Ii=new WeakMap,Ai=new WeakMap,Mi=new WeakMap,zi=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Ti=new WeakMap,Ei=new WeakMap,pi=new WeakSet,Wi=function(){Qi(this,Ai,"f").on("pointStart",Qi(this,pi,"m",Ci).bind(this)),Qi(this,Ai,"f").on("pointEnd",Qi(this,pi,"m",Li).bind(this)),Qi(this,Ai,"f").on("pointMove",Qi(this,pi,"m",ki).bind(this)),Qi(this,Ai,"f").on("hover",Qi(this,pi,"m",Oi).bind(this)),Qi(this,Ai,"f").on("wheel",Qi(this,pi,"m",Di).bind(this)),Qi(this,Ai,"f").on("wheelScale",Qi(this,pi,"m",Vi).bind(this)),Qi(this,Ai,"f").on("scrollX",Qi(this,pi,"m",Yi).bind(this)),Qi(this,Ai,"f").on("scrollY",Qi(this,pi,"m",Gi).bind(this)),Qi(this,Ai,"f").on("resize",Qi(this,pi,"m",Fi).bind(this)),Qi(this,Ai,"f").on("doubleClick",Qi(this,pi,"m",ji).bind(this)),Qi(this,Mi,"f").on("load",(()=>{Qi(this,Ti,"f").trigger("loadResource")}))},Ci=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},Li=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},ki=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},Oi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},ji=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},Di=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},Vi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},Yi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},Gi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},Fi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},Bi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},Ni=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Xi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Hi=function(){const e=[],t=Qi(this,Si,"f");Qi(this,bi,"f").forEach((i=>{const o=t.get(i);"enable"===(null==o?void 0:o.status)&&(null==o?void 0:o.middlewareObject)&&e.push(o.middlewareObject)})),Zi(this,Ii,e,"f")};const Ji="data:image/png;base64,iVBORw0KGgo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jwCPdzQu92ht2m/OUjIyOfS1pkAoqItLS0fA+8D7wKPA0cxs6qC1O4T0xMfKYnb21tnXEDNjc3z+nXbW1t3wFvYz9dCAL7KUThHovFPtGTNjU1jQFSX18/lg68cuXKLUAaGxs3vkB7e/u3wHHgCQpUdnpTqdQvesJgMDisUVevXh3Xry9fvnxTv66qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class $i{constructor(e,d){I(this,r),I(this,l),I(this,c),I(this,f),I(this,g),I(this,t,void 0),I(this,i,void 0),I(this,o,null),I(this,n,null),I(this,a,{auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0i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Dk5EwGGlNFjOWQOd8px4vUN4E3cpn2pz/jgwQPef/99Ll68yJ07d+jt7WVwcJBIJEJJSQlz586loaGBTZs2UVdXF5w0OoDLwFWcbPsct6r04+bRLHEYCoWyAD1kBDfHleHmsxrccccS3NFHNV/eenBy6iZwCycMOnHz5wBuDh2nyyY6H0zhFmoF7vtxk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),A(this,i,e),A(this,t,d.eventHub),M(this,r,s).call(this),M(this,l,h).call(this)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakSet,s=function(){const e=b(this,t);M(this,c,d).call(this,"default"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?M(this,c,d).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?M(this,f,u).call(this,e):"drag-default"===e.type?M(this,c,d).call(this,"drag-default"):"drag-active"===e.type?M(this,c,d).call(this,"drag-active"):M(this,c,d).call(this,"auto"):M(this,c,d).call(this,"auto")}))},l=new WeakSet,h=function(){j(Ji).then((e=>{A(this,n,e)})).catch((e=>{console.error(e)}))},c=new WeakSet,d=function(e){if(b(this,o)===e)return;A(this,o,e);const t=b(this,a)[b(this,o)]||b(this,a).auto;let n=0,r=0;(e.startsWith("rotate-")&&b(this,a)[b(this,o)]||"rotate"===e)&&(n=10,r=10),b(this,i).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${n} ${r}, auto`},f=new WeakSet,u=function(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=Se((null==(t=null==e?void 0:e.element)?void 0:t.angle)||0),Array.isArray(e.groupQueue)&&e.groupQueue.length>0&&e.groupQueue.forEach((e=>{i+=Se(e.angle||0)})),i=Se(i);const o=M(this,g,v).call(this,i);M(this,c,d).call(this,o)},g=new WeakSet,v=function(e){const t=`rotate-${e}`;if(!b(this,a)[t]){const i=b(this,n);if(i){const o=document.createElement("canvas"),n=i.width,r=i.height,s={x:n/2,y:r/2};o.width=n,o.height=r;const l=o.getContext("2d"),h=ce(e);l.translate(s.x,s.y),l.rotate(h),l.translate(-s.x,-s.y),l.drawImage(i,0,0,n,r),l.translate(s.x,s.y),l.rotate(-h),l.translate(-s.x,-s.y);const c=o.toDataURL("image/png");b(this,a)[t]=c}}return t};const Ki="change",qi="SELECT",_i=Symbol(`${qi}_actionType`),eo=Symbol(`${qi}_resizeType`),to=Symbol(`${qi}_areaStart`),io=Symbol(`${qi}_areaEnd`),oo=Symbol(`${qi}_hoverElement`),no=Symbol(`${qi}_hoverElementVertexes`),ao=Symbol(`${qi}_selectedElementList`),ro=Symbol(`${qi}_selectedElementListVertexes`),so=Symbol(`${qi}_selectedElementController`),lo=Symbol(`${qi}_selectedElementPosition`),ho=Symbol(`${qi}_selectedReferenceXLines`),co=Symbol(`${qi}_selectedReferenceYLines`),fo=Symbol(`${qi}_groupQueue`),uo=Symbol(`${qi}_groupQueueVertexesList`),go=Symbol(`${qi}_isMoving`),vo=Symbol(`${qi}_canSelectInGroup`),wo="#1973ba",mo="#5b5959b5",yo="@middleware/select",po="@middleware/select-clear",xo="@middleware/select-in-group";function So(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill()}function bo(e,t,i,o){const{borderColor:n,borderWidth:a,lineDash:r}=o;e.setLineDash([]),e.lineWidth=a,e.strokeStyle=n,e.setLineDash(r),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}function Io(e,t,i){const{borderColor:o,borderWidth:n,lineDash:a}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.setLineDash(a),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function Ao(e,t,i){const{size:o,borderColor:n,borderWidth:a,lineDash:r}=i,s=t.x-o/2,l=t.x+o/2,h=t.y-o/2,c=t.y+o/2;Io(e,[{x:s,y:h},{x:l,y:h},{x:l,y:c},{x:s,y:c}],{borderColor:n,borderWidth:a,lineDash:r})}function Mo(e,t,i){if(!t)return;const o={borderColor:wo,borderWidth:1,background:"transparent",lineDash:[]};So(e,Le(t,i),o)}function zo(e,t,i){if(!t)return;const o={borderColor:mo,borderWidth:1,background:"transparent",lineDash:[]};So(e,Le(t,i),o);const{controller:n}=i;if(n){const{topLeft:t,topRight:a,bottomLeft:r,bottomRight:s,topMiddle:l,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=n,f={...o,borderWidth:1,background:mo};Io(e,Le(l.vertexes,i),f),Io(e,Le(h.vertexes,i),f),Io(e,Le(c.vertexes,i),f),Io(e,Le(d.vertexes,i),f),Io(e,Le(t.vertexes,i),f),Io(e,Le(a.vertexes,i),f),Io(e,Le(r.vertexes,i),f),Io(e,Le(s.vertexes,i),f)}}function Ro(e,t,i){if(!t)return;const{hideControllers:o}=i,{elementWrapper:n,topLeft:a,topRight:r,bottomLeft:s,bottomRight:l,top:h,rotate:c}=t,d={borderColor:wo,borderWidth:2,background:"transparent",lineDash:[]},f={...d,borderWidth:4,background:"#FFFFFF"};So(e,Le(n,i),d),o||(bo(e,Ce(h.center,i),Ce(c.center,i),{...f,borderWidth:2}),So(e,Le(a.vertexes,i),f),So(e,Le(r.vertexes,i),f),So(e,Le(s.vertexes,i),f),So(e,Le(l.vertexes,i),f),function(e,t,i){const{size:o,borderColor:n,borderWidth:a,background:r}=i,s=t,l=o/2,h=l,c=l;if(h>=0&&c>=0){if("number"==typeof a&&a>0){const t=a/2+h,i=a/2+c;e.beginPath(),e.strokeStyle=n,e.lineWidth=a,e.circle(s.x,s.y,t,i,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath(),e.fillStyle=r,e.circle(s.x,s.y,h,c,0,0,2*Math.PI),e.closePath(),e.fill()}}(e,Ce(c.center,i),{...f,size:10,borderWidth:2}))}function Po(e,t){const{xLines:i,yLines:o}=t,n={borderColor:"#f7276e",borderWidth:1,lineDash:[]},a={...n,size:6};i&&i.forEach((t=>{t.forEach(((i,o)=>{Ao(e,i,a),t[o+1]&&bo(e,t[o],t[o+1],n)}))})),o&&o.forEach((t=>{t.forEach(((i,o)=>{Ao(e,i,a),t[o+1]&&bo(e,t[o],t[o+1],n)}))}))}function To(e){return e*Math.PI/180}function Eo(e,t){return Math.sqrt(e*e+t*t)}function Wo(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function Co(e,t){const{ctx:i,viewScaleInfo:o,vertexes:n}=t,a=Ce(n[0],{viewScaleInfo:o}),r=Ce(n[1],{viewScaleInfo:o}),s=Ce(n[2],{viewScaleInfo:o}),l=Ce(n[3],{viewScaleInfo:o});return i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(r.x,r.y),i.lineTo(s.x,s.y),i.lineTo(l.x,l.y),i.lineTo(a.x,a.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function Lo(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:a}=t;if(!(a&&(null==a?void 0:a.length)>0))return!1;const r=Te(a),s=r[r.length-1];return!!s&&Co(e,{ctx:i,vertexes:s,viewScaleInfo:o,viewSizeInfo:n})}function ko(e,t){var i,o,n;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:r,data:s,calculator:l,selectedElements:h,viewScaleInfo:c,viewSizeInfo:d,areaSize:f,groupQueue:u,selectedElementController:g}=t;if(g){const{left:t,right:i,top:o,bottom:n,topLeft:s,topRight:l,bottomLeft:f,bottomRight:v,rotate:w}=g,m=[t,i,o,n,s,l,f,v,w];for(let t=0;t<m.length;t++){const i=m[t];if(Co(e,{ctx:r,vertexes:i.vertexes,viewSizeInfo:d,viewScaleInfo:c})){a.type=`resize-${i.type}`,h&&(null==h?void 0:h.length)>0&&(a.groupQueue=u||[],a.elements=[h[0]]);break}}}if(u&&Array.isArray(u)&&u.length>0){const t=u[u.length-1];if((null==(i=null==t?void 0:t.detail)?void 0:i.children)&&Array.isArray(null==(o=null==t?void 0:t.detail)?void 0:o.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=Ee(o,{groupQueue:u});if(n&&Co(e,{ctx:r,vertexes:n,viewScaleInfo:c,viewSizeInfo:d}))return a.type||(a.type="over-element"),a.groupQueue=u,a.elements=[o],a}return a}if(null!==a.type)return a;if(f&&Array.isArray(h)&&(null==h?void 0:h.length)>1){const{x:t,y:i,w:o,h:n}=f;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=h,a}if(s){const{index:t,element:i}=l.getPointElement(e,{data:s,viewScaleInfo:c,viewSizeInfo:d});if(t>=0&&i&&!0!==(null==(n=null==i?void 0:i.operations)?void 0:n.invisible))return a.elements=[i],a.type="over-element",a}return a}function Oo(e,t){const{x:i,y:o,w:n,h:a,angle:r=0}=e,{center:s,start:l,end:h,viewScaleInfo:c}=t,d=Ce(s,{viewScaleInfo:c}),f=Se(r),u=function(e,t,i){const o=ve(e,t),n=ve(e,i);return null!==n&&null!==o?o>3*Math.PI/2&&n<Math.PI/2?n+(2*Math.PI-o):n>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-n):n-o:0}(d,l,h);return{x:i,y:o,w:n,h:a,angle:f+u/Math.PI*180}}function jo(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{viewScaleInfo:n,viewSizeInfo:a}=t;let r=null;for(let t=0;t<e.length;t++){const s=e[t];if(null==(i=null==s?void 0:s.operations)?void 0:i.invisible)continue;const l=We(s,{viewScaleInfo:n,viewSizeInfo:a});if(l.angle&&(l.angle>0||l.angle<0)){const e=pe(l);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];l.x=Math.min(...t),l.y=Math.min(...i),l.w=Math.abs(Math.max(...t)-Math.min(...t)),l.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(r){const e=Math.min(l.x,o.x),t=Math.min(l.y,o.y),i=Math.max(l.x+l.w,o.x+o.w),n=Math.max(l.y+l.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=l.x,o.y=l.y,o.w=l.w,o.h=l.h;r=l}return o}function Do(e){return{minX:e.topLeft.x,minY:e.topLeft.y,maxX:e.bottomRight.x,maxY:e.bottomRight.y,midX:e.center.x,midY:e.center.y}}const Vo=(e,t)=>{if(0===e.length)throw null;if(1===e.length)return e[0];let i=0,o=e.length-1;for(;i<=o;){const n=Math.floor((i+o)/2);if(e[n]===t)return e[n];e[n]<t?i=n+1:o=n-1}return i>=e.length?e[o]:o<0?e[i]:Math.abs(e[o]-t)<=Math.abs(e[i]-t)?e[o]:e[i]},Yo=(e,t)=>Math.abs(e-t)<1e-5;const Go="@middleware/text-edit",Fo="@middleware/text-change",Bo={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"},No="SCROLL",Xo=Symbol(`${No}_xThumbRect`),Ho=Symbol(`${No}_yThumbRect`),Zo=Symbol(`${No}_prevPoint`),Qo=Symbol(`${No}_activePoint`),Uo=Symbol(`${No}_activeThumbType`),Jo=16,$o=.3,Ko={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function qo(e,t,i){const o=e,{x:n,y:a,w:r,h:s}=i;return o.beginPath(),o.rect(n,a,r,s),o.closePath(),!!o.isPointInPath(t.x,t.y)}function _o(e,t){let{x:i,y:o,h:n,w:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{color:r,axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+a/4+0,a/=2);let l=t.r;l=Math.min(l,a/2,n/2),(a<2*l||n<2*l)&&(l=0),e.globalAlpha=$o,e.beginPath(),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.fillStyle=r,e.fill(),e.globalAlpha=1,e.beginPath(),e.lineWidth=1,e.strokeStyle=r,e.setLineDash([]),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.stroke()}e.restore()}function en(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:a}=t,{activeThumbType:r,prevPoint:s,activePoint:l}=a,h=function(e,t){const{width:i,height:o}=t,{offsetTop:n,offsetBottom:a,offsetLeft:r,offsetRight:s}=e,l=2.5*Jo,h=Jo;let c=0,d=0;c=Math.max(l,i-2*h-(Math.abs(r)+Math.abs(s))),c>=i&&(c=i),d=Math.max(l,o-2*h-(Math.abs(n)+Math.abs(a))),d>=o&&(d=o);const f=h;let u=f;r>0?u=f:s>0?u=i-c-h:r<=0&&c>0&&(0!==r||0!==s)&&(u=f+(i-c)*Math.abs(r)/(Math.abs(r)+Math.abs(s)),u=Math.min(Math.max(0,u-f),i-c));const g=h;let v=g;n>0?v=g:a>0?v=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(v=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),v=Math.min(Math.max(0,v-g),o-d));const w={x:u,y:o-h,w:c,h:h},m={x:i-h,y:v,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:v,translateX:u,thumbColor:Ko.thumbColor,scrollBarColor:Ko.scrollBarColor,xThumbRect:w,yThumbRect:m}}(o,n);let c={...h.xThumbRect},d={...h.yThumbRect};return r&&s&&l&&("X"===r&&a.xThumbRect?(c={...a.xThumbRect},c.x=c.x+(l.x-s.x)):"Y"===r&&a.yThumbRect&&(d={...a.yThumbRect},d.y=d.y+(l.y-s.y))),_o(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),_o(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function tn(e,t){const{snapshot:i}=t,o=he(i),n=le(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Qo]||null,prevPoint:t[Zo]||null,activeThumbType:t[Uo]||null,xThumbRect:t[Xo]||null,yThumbRect:t[Ho]||null}}(i),{xThumbRect:r,yThumbRect:s}=en(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:r,yThumbRect:s}}const on="@middleware/scale",nn=16,an="#000000",rn="#00000080",sn="monospace",ln="#AAAAAA20",hn="#AAAAAA40",cn="#196097";function dn(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=Ne(a/t,{decimalPlaces:0}),a=Math.max(10,Math.min(a,1e3));const r=10*a,s=5*a;let l=0;const h=a*t,c=0-o,d=c%h,f=(c-d+h)/t,u=h-d+0;for(;u+l*h<i;){const e=Ne(f+l*a,{decimalPlaces:0}),t={num:e,position:Ne(u+l*h,{decimalPlaces:0}),showNum:e%r==0,isKeyNum:e%r==0,isSubKeyNum:e%s==0};n.push(t),l++}return n}const fn="@middleware/show-ruler",un=Symbol("DRAG_prevPoint"),gn="monospace";const vn="#1973bac6",wn="#ffffff",mn=10,yn="LAYOUT_SELECT",pn=Symbol(`${yn}_layoutActionType`),xn=Symbol(`${yn}_layoutControlType`),Sn=Symbol(`${yn}_layoutController`),bn="#1973ba",In="#5b5959b5";function An(e,t){e.setLineDash([]),e.fillStyle="#FFFFFF",e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.fill(),e.strokeStyle=bn,e.lineWidth=2,e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function Mn(e,t){const{vertexes:i,strokeStyle:o,lineWidth:n}=t;e.setLineDash([]),e.strokeStyle=o,e.lineWidth=n,e.beginPath(),e.moveTo(i[0].x,i[0].y),e.lineTo(i[2].x,i[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(i[1].x,i[1].y),e.lineTo(i[3].x,i[3].y),e.closePath(),e.stroke()}function zn(e,t){const{start:i,end:o,centerVertexes:n,disabled:a}=t,r=!0===a?1:2,s=!0===a?In:bn;e.setLineDash([]),e.strokeStyle=s,e.lineWidth=r,e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,o.y),e.closePath(),e.stroke(),!0===a&&Mn(e,{vertexes:n,lineWidth:r,strokeStyle:s})}return w=new WeakMap,m=new WeakMap,y=new WeakMap,p=new WeakSet,x=function(){b(this,y).style.position="relative"},e.Core=class{constructor(e,t){I(this,p),I(this,w,void 0),I(this,m,void 0),I(this,y,void 0);const{devicePixelRatio:i=1,width:o,height:n,createCustomContext2D:a}=t;A(this,y,e);const r=document.createElement("canvas");A(this,m,r),M(this,p,x).call(this),e.appendChild(r);const s=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a,createCustomContext2D:r}=t,s={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d");if(r){const e=r(s),t=r(s),i=r(s),o=J(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}if(!0===a){const e=$(s),t=$(s),i=$(s),o=J(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}{const e=J(s),t=J(s),n=J(s),a=J(Object.assign({ctx:l},s)),r=()=>{a.clearRect(0,0,i,o),a.drawImage(n.canvas,0,0,i,o),a.drawImage(e.canvas,0,0,i,o),a.drawImage(t.canvas,0,0,i,o),n.clearRect(0,0,i,o),e.clearRect(0,0,i,o),t.clearRect(0,0,i,o)};return{underContext:n,viewContext:e,helperContext:t,boardContext:a,drawView:r}}}(r,{width:o,height:n,devicePixelRatio:i,offscreen:!0,createCustomContext2D:a}),l=new Ui({boardContent:s,container:e}),h=l.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),A(this,w,l),this.resize(h.getActiveViewSizeInfo());const c=l.getEventHub();new $i(e,{eventHub:c})}isDestroyed(){return b(this,w).isDestroyed()}destroy(){b(this,w).destroy(),b(this,m).remove()}use(e){b(this,w).use(e)}disuse(e){b(this,w).disuse(e)}setData(e,t){be((null==e?void 0:e.elements)||[]),b(this,w).setData(e,t)}getData(){return b(this,w).getData()}scale(e){b(this,w).scale(e);b(this,w).getViewer().drawFrame()}resize(e){const t=b(this,w),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){b(this,w).clear()}on(e,t){b(this,w).getEventHub().on(e,t)}off(e,t){b(this,w).getEventHub().off(e,t)}trigger(e,t){b(this,w).getEventHub().trigger(e,t)}getViewInfo(){const e=b(this,w).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){b(this,w).getViewer().drawFrame()}setViewScale(e){b(this,w).updateViewScaleInfo(e)}getLoadItemMap(){return b(this,w).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){b(this,w).onWatcherEvents()}offBoardWatcherEvents(){b(this,w).offWatcherEvents()}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger("cursor",{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(un,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(un);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(un,t)},pointEnd(){n=!1,i.setSharedStorage(un,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareInfo=e=>{const{boardContent:t,calculator:i}=e,{helperContext:o}=t;return{name:"@middleware/info",beforeDrawFrame({snapshot:e}){const{sharedStore:t}=e,n=t[ao],a=t[_i],r=t[fo]||[];if(1===n.length){const t=n[0];if(t&&["select","drag","resize"].includes(a)){const n=le(e),a=he(e),{x:s,y:l,w:h,h:c,angle:d}=t,f=[...r,{uuid:P(),x:s,y:l,w:h,h:c,angle:d,type:"group",detail:{children:[]}}],u={viewScaleInfo:n,viewSizeInfo:a},g=i.calcViewRectInfoFromOrigin(t.uuid,u);let v=0;f.forEach((e=>{v+=e.angle||0}));const w=ce(Se(0-v));if(g){const e=null==g?void 0:g.center,i={topLeft:we(e,g.topLeft,w),topRight:we(e,g.topRight,w),bottomRight:we(e,g.bottomRight,w),bottomLeft:we(e,g.bottomLeft,w),center:we(e,g.center,w),top:we(e,g.top,w),right:we(e,g.right,w),bottom:we(e,g.bottom,w),left:we(e,g.left,w)},n=Ne(t.x,{decimalPlaces:2}),a=Ne(t.y,{decimalPlaces:2}),r=Ne(t.w,{decimalPlaces:2}),s=Ne(t.h,{decimalPlaces:2}),l=`${Ne(n,{decimalPlaces:0})},${Ne(a,{decimalPlaces:0})}`,h=`${Ne(r,{decimalPlaces:0})}x${Ne(s,{decimalPlaces:0})}`,c=`${Ne(t.angle||0,{decimalPlaces:0})}°`;!function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:r,background:s,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:gn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x-o/2-t,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x-o/2,y:i.y};e.setLineDash([]),e.fillStyle=s,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=r,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.bottom.x,y:i.bottom.y+mn},rotateCenter:i.center,angle:v,text:h,fontSize:mn,lineHeight:16,color:wn,background:vn}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:r,background:s,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:gn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=s,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=r,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.topLeft.x,y:i.topLeft.y-20},rotateCenter:i.center,angle:v,text:l,fontSize:mn,lineHeight:16,color:wn,background:vn}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:r,background:s,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:gn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=s,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=r,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.top.x+mn,y:i.top.y-20},rotateCenter:i.center,angle:v,text:c,fontSize:mn,lineHeight:16,color:wn,background:vn})}}}}}},e.MiddlewareLayoutSelector=e=>{const{sharer:t,boardContent:i,calculator:o,viewer:n,eventHub:a}=e,{helperContext:r}=i;let s=null;const l=()=>{s=null,t.setSharedStorage(pn,null),t.setSharedStorage(xn,null),t.setSharedStorage(Sn,null)},h=()=>!!t.getSharedStorage(_i),c=e=>{var i;const o=t.getActiveStorage("data");if(null==(i=null==o?void 0:o.layout)?void 0:i.operations){const t=o.layout.operations;if("left"===e&&!0===t.disableLeft)return!0;if("top"===e&&!0===t.disableTop)return!0;if("right"===e&&!0===t.disableRight)return!0;if("bottom"===e&&!0===t.disableBottom)return!0;if("top-left"===e&&!0===t.disableTopLeft)return!0;if("top-right"===e&&!0===t.disableTopRight)return!0;if("bottom-left"===e&&!0===t.disableBottomLeft)return!0;if("bottom-right"===e&&!0===t.disableBottomRight)return!0}return!1},d=()=>{const e=t.getActiveStorage("data");if(null==e?void 0:e.layout){const{x:t,y:i,w:o,h:n}=e.layout;return{x:t,y:i,w:o,h:n}}return null},f=()=>{const e=t.getActiveViewScaleInfo(),i=d();if(i){const o=Fe(i,{viewScaleInfo:e,controllerSize:10});t.setSharedStorage(Sn,o)}else t.setSharedStorage(Sn,null)},u=e=>{const i=t.getActiveStorage("data"),o=t.getSharedStorage(Sn);if(o&&(null==i?void 0:i.layout)&&(null==e?void 0:e.point)){let i=null;if(o){const{topLeft:n,top:r,topRight:s,right:l,bottomRight:h,bottom:c,bottomLeft:d,left:f}=o,u=[n,r,s,l,h,c,d,f];for(let t=0;t<u.length;t++){const o=u[t];if(Oe(e.point,o.vertexes)){i=`${o.type}`;break}}if(i)return t.setSharedStorage(xn,i),a.trigger(po,{}),i}}return null};return{name:"@middleware/layout-selector",use:()=>{l(),f()},hover:e=>{if(h())return;const i=t.getSharedStorage(pn),o=t.getActiveStorage("data");if((null==o?void 0:o.layout)&&"resize"!==i){f();const i=u(e);i?(t.setSharedStorage(pn,"hover"),c(i)||a.trigger("cursor",{type:`resize-${i}`,groupQueue:[],element:d()}),n.drawFrame()):t.setSharedStorage(pn,null)}if(["hover","resize"].includes(t.getSharedStorage(pn)))return!1;"hover"!==i||t.getSharedStorage(pn)||n.drawFrame()},pointStart:e=>{if(h())return;f();const i=u(e);if(s=e.point,i){if(c(i))return;return t.setSharedStorage(pn,"resize"),!1}const o=t.getSharedStorage(pn);return!["hover","resize"].includes(o)&&void 0},pointMove:e=>{if(h())return;const i=t.getSharedStorage(pn),a=t.getSharedStorage(xn),r=t.getActiveStorage("data");if(!a||!c(a)){if("resize"===i&&a&&(null==r?void 0:r.layout)){if(s){const i=t.getActiveStorage("scale"),n=(e.point.x-s.x)/i,l=(e.point.y-s.y)/i,{x:h,y:c,w:d,h:f}=r.layout;"top"===a?(r.layout.y=o.toGridNum(c+l),r.layout.h=o.toGridNum(f-l)):"right"===a?r.layout.w=o.toGridNum(d+n):"bottom"===a?r.layout.h=o.toGridNum(f+l):"left"===a?(r.layout.x=o.toGridNum(h+n),r.layout.w=o.toGridNum(d-n)):"top-left"===a?(r.layout.x=o.toGridNum(h+n),r.layout.y=o.toGridNum(c+l),r.layout.w=o.toGridNum(d-n),r.layout.h=o.toGridNum(f-l)):"top-right"===a?(r.layout.y=o.toGridNum(c+l),r.layout.w=o.toGridNum(d+n),r.layout.h=o.toGridNum(f-l)):"bottom-right"===a?(r.layout.w=o.toGridNum(d+n),r.layout.h=o.toGridNum(f+l)):"bottom-left"===a&&(r.layout.x=o.toGridNum(h+n),r.layout.w=o.toGridNum(d-n),r.layout.h=o.toGridNum(f+l))}return s=e.point,f(),n.drawFrame(),!1}return!["hover","resize"].includes(i)&&void 0}},pointEnd:()=>{const e=t.getSharedStorage(pn),i=t.getSharedStorage(xn),o=t.getActiveStorage("data");o&&"resize"===e&&i&&!c(i)&&a.trigger(Ki,{type:"changeLayout",data:o}),l()},beforeDrawFrame:({snapshot:e})=>{var t;const{sharedStore:i,activeStore:o}=e,n=i[pn],a=i[xn];if((null==(t=o.data)?void 0:t.layout)&&n&&a&&["hover","resize"].includes(n)){const t=le(e),{x:i,y:n,w:a,h:s}=o.data.layout,l=Fe({x:i,y:n,w:a,h:s},{viewScaleInfo:t,controllerSize:10});!function(e,t){const{controller:i,operations:o}=t,{topLeft:n,topRight:a,bottomLeft:r,bottomRight:s,topMiddle:l,rightMiddle:h,bottomMiddle:c,leftMiddle:d}=i;zn(e,{start:n.center,end:a.center,centerVertexes:l.vertexes,disabled:!!(null==o?void 0:o.disableTop)}),zn(e,{start:a.center,end:s.center,centerVertexes:h.vertexes,disabled:!!(null==o?void 0:o.disableRight)}),zn(e,{start:s.center,end:r.center,centerVertexes:c.vertexes,disabled:!!(null==o?void 0:o.disableBottom)}),zn(e,{start:r.center,end:n.center,centerVertexes:d.vertexes,disabled:!!(null==o?void 0:o.disableLeft)});const f={lineWidth:1,strokeStyle:In};!0===(null==o?void 0:o.disableTopLeft)?Mn(e,{vertexes:n.vertexes,...f}):An(e,n.vertexes),!0===(null==o?void 0:o.disableTopRight)?Mn(e,{vertexes:a.vertexes,...f}):An(e,a.vertexes),!0===(null==o?void 0:o.disableBottomRight)?Mn(e,{vertexes:s.vertexes,...f}):An(e,s.vertexes),!0===(null==o?void 0:o.disableBottomLeft)?Mn(e,{vertexes:r.vertexes,...f}):An(e,r.vertexes)}(r,{controller:l,operations:o.data.layout.operations||{}})}},scrollX:()=>{l()},scrollY:()=>{l()},wheelScale:()=>{l()}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o,calculator:n}=e,{helperContext:a,underContext:r}=t;let s=!0,l=!0;const h=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(s=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(l=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||i.drawFrame()};return{name:"@middleware/ruler",use(){o.on(fn,h)},disuse(){o.off(fn,h)},beforeDrawFrame:({snapshot:e})=>{if(!0===s){const t=le(e),i=he(e);!function(e,t){const{snapshot:i,calculator:o}=t,{sharedStore:n}=i,a=n[ao],r=n[_i];if(["select","drag","drag-list","drag-list-end"].includes(r)&&a.length>0){const t=le(i),n=he(i),r=[],s=[],l=[],h=[],c=[];if(a.forEach((e=>{const i=o.calcViewRectInfoFromRange(e.uuid,{viewScaleInfo:t,viewSizeInfo:n});i&&(r.push(i),s.push(i.left.x),l.push(i.right.x),h.push(i.top.y),c.push(i.bottom.y))})),!(r.length>0))return;const d=Math.min(...s),f=Math.max(...l),u=Math.min(...h),g=Math.max(...c);e.globalAlpha=1,e.beginPath(),e.moveTo(d,0),e.lineTo(f,0),e.lineTo(f,nn),e.lineTo(d,nn),e.fillStyle=cn,e.closePath(),e.fill(),e.beginPath(),e.moveTo(0,u),e.lineTo(nn,u),e.lineTo(nn,g),e.lineTo(0,g),e.fillStyle=cn,e.closePath(),e.fill()}}(a,{snapshot:e,calculator:n}),function(e,t){const{viewSizeInfo:i}=t,{width:o,height:n}=i;e.beginPath(),e.moveTo(0,0),e.lineTo(o+1,0),e.lineTo(o+1,nn),e.lineTo(nn,nn),e.lineTo(nn,n+1),e.lineTo(0,n+1),e.lineTo(0,0),e.closePath(),e.fillStyle="#FFFFFFA8",e.fill(),e.lineWidth=1,e.setLineDash([]),e.strokeStyle="#00000080",e.stroke()}(a,{viewScaleInfo:t,viewSizeInfo:i});const o=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:a}=i;return dn({axis:"X",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t;for(let t=0;t<i.length;t++){const o=i[t];o.position<nn||(e.beginPath(),e.moveTo(o.position,16),e.lineTo(o.position,o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8),e.closePath(),e.lineWidth=1,e.setLineDash([]),e.fillStyle=an,e.stroke(),o.isKeyNum&&(e.fillStyle=rn,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:sn}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(a,{scaleList:o});const s=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return dn({axis:"Y",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t,o=3.2;for(let t=0;t<i.length;t++){const n=i[t];if(!(n.position<nn)&&(e.beginPath(),e.moveTo(16,n.position),e.lineTo(n.isKeyNum?3.2:n.isSubKeyNum?6.4:12.8,n.position),e.closePath(),e.fillStyle=an,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;de(e,-90,{x:t,y:i},(()=>{e.fillStyle=rn,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:sn}),e.fillText(a,13.2,n.position+o)}))}}}(a,{scaleList:s}),!0===l&&function(e,t){const{xList:i,yList:o,viewSizeInfo:n}=t,{width:a,height:r}=n;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,r),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=hn:e.strokeStyle=ln,e.closePath(),e.lineWidth=1,e.setLineDash([]),e.stroke()}for(let t=0;t<o.length;t++){const i=o[t];e.beginPath(),e.moveTo(0,i.position),e.lineTo(a,i.position),!0===i.isKeyNum||!0===i.isSubKeyNum?e.strokeStyle=hn:e.strokeStyle=ln,e.lineWidth=1,e.closePath(),e.stroke()}}(r,{xList:o,yList:s,viewScaleInfo:t,viewSizeInfo:i})}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:a}=e,{scale:r}=i.getActiveViewScaleInfo();let s=r;if(n<0?s=1.1*r:n>0&&(s=.9*r),s<.05||s>50)return;const{moveX:l,moveY:h}=t.scale({scale:s,point:a});t.scroll({moveX:l,moveY:h}),t.drawFrame();const c=Ne(r);o.trigger(on,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(Xo,null),o.setSharedStorage(Ho,null);const a=()=>{o.setSharedStorage(Zo,null),o.setSharedStorage(Qo,null),o.setSharedStorage(Uo,null)};a();const r=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&qo(e,t,n)?o="X":a&&qo(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(Xo),yThumbRect:o.getSharedStorage(Ho)});return{name:"@middleware/scroller",wheel:e=>{t.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),t.drawFrame()},pointStart:e=>{const{point:t}=e,i=r(t);if("X"===i||"Y"===i)return o.setSharedStorage(Uo,i),o.setSharedStorage(Zo,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Uo);if("X"===n||"Y"===n)return o.setSharedStorage(Qo,i),"X"===n?(e=>{const i=o.getSharedStorage(Zo);if(i){const{offsetLeft:n,offsetRight:a}=o.getActiveViewScaleInfo(),{width:r}=o.getActiveViewSizeInfo(),s=-(e.x-i.x)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveX:s}),t.drawFrame()}})(i):"Y"===n&&(e=>{const i=o.getSharedStorage(Zo);if(i){const{offsetTop:n,offsetBottom:a}=o.getActiveViewScaleInfo(),{height:r}=o.getActiveViewSizeInfo(),s=-(e.y-i.y)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveY:s}),t.drawFrame()}})(i),o.setSharedStorage(Zo,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Uo);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=tn(n,{snapshot:e});o.setSharedStorage(Xo,t),o.setSharedStorage(Ho,i)}}},e.MiddlewareSelector=e=>{const{viewer:t,sharer:i,boardContent:o,calculator:n,eventHub:a}=e,{helperContext:r}=o;let s=null,l=null;i.setSharedStorage(_i,null);const h=()=>i.getSharedStorage(ao),c=e=>{let t=i.getSharedStorage(fo);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const o=Te(t);return i.setSharedStorage(fo,t),i.setSharedStorage(uo,o),t.length>0},d=e=>{i.setSharedStorage(oo,e);let t=null;e&&(t=Ee(e,{groupQueue:i.getSharedStorage(fo)})),i.setSharedStorage(no,t)},f=(e,t)=>{var o;if(i.setSharedStorage(ao,e),1===e.length){const t=Ge(e[0],{groupQueue:i.getSharedStorage(fo),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(so,t),i.setSharedStorage(lo,ze(e[0].uuid,(null==(o=i.getActiveStorage("data"))?void 0:o.elements)||[]))}else i.setSharedStorage(so,null),i.setSharedStorage(lo,[]);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(yo,{uuids:e.map((e=>e.uuid))})},u=()=>({ctx:r,calculator:n,data:i.getActiveStorage("data"),selectedElements:h(),viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(fo),areaSize:null,selectedElementController:i.getSharedStorage(so),selectedElementPosition:i.getSharedStorage(lo)}),g=()=>{i.setSharedStorage(_i,null),i.setSharedStorage(eo,null),i.setSharedStorage(to,null),i.setSharedStorage(io,null),i.setSharedStorage(fo,[]),i.setSharedStorage(uo,[]),i.setSharedStorage(oo,null),i.setSharedStorage(no,null),i.setSharedStorage(ao,[]),i.setSharedStorage(ro,null),i.setSharedStorage(so,null),i.setSharedStorage(lo,[]),i.setSharedStorage(ho,[]),i.setSharedStorage(co,[]),i.setSharedStorage(go,null),i.setSharedStorage(vo,null)};g();const v=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(_i),r=i.getActiveStorage("data");n=o&&Array.isArray(o)?function(e,t){const i=[];return e.forEach((e=>{const o=Me(e,t);o&&i.push(o)})),i}(o,(null==r?void 0:r.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let a=0;a<o.length;a++){const r=o[a];e.includes(r.uuid)?i.push(r):"group"===r.type&&t((null===(n=null==r?void 0:r.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==r?void 0:r.elements)||[]);let s=!1;if(a||1!==n.length?"select"===a&&1===n.length&&(s=!0):(i.setSharedStorage(_i,"select"),s=!0),s){const e=function(e,t){const i=[];return function e(t,o){var n;let a=null;for(let r=0;r<o.length;r++){const s=o[r];if(s.uuid===t){a=s;break}if(!a&&"group"===s.type){i.push(s);const o=e(t,(null===(n=null==s?void 0:s.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){a=o;break}i.pop()}}return a}(e,t),i}(n[0].uuid,(null==r?void 0:r.elements)||[]);i.setSharedStorage(fo,e),f(n),t.drawFrame()}},w=()=>{g(),t.drawFrame()},m=e=>{i.setSharedStorage(vo,!!e.enable)};return{name:"@middleware/selector",use(){a.on(yo,v),a.on(po,w),a.on(xo,m)},disuse(){a.off(yo,v),a.off(po,w),a.off(xo,m)},hover:e=>{var o,s,c,f,g;const v=i.getSharedStorage(eo),w=i.getSharedStorage(_i),m=i.getSharedStorage(fo),y=e=>{const t=e.type;null===l&&a.trigger("cursor",{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==m?void 0:m.length)>0){if(!Lo(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(fo)}))return d(null),void t.drawFrame();const n=ko(e.point,u());return y(n),v||["area","drag","drag-list"].includes(w)?(d(null),void t.drawFrame()):1===(null==(o=null==n?void 0:n.elements)?void 0:o.length)?(d(n.elements[0]),void t.drawFrame()):(d(null),void t.drawFrame())}if(v||["area","drag","drag-list"].includes(w))return void d(null);if("drag"===w)return void d(null);const p=h(),x=i.getActiveViewScaleInfo(),S=i.getActiveViewSizeInfo(),b=ko(e.point,{...u(),areaSize:jo(p,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});if(y(b),null!==b.type){if(!("over-element"===b.type&&"select"===i.getSharedStorage(_i)&&1===b.elements.length&&b.elements[0].uuid===(null==(c=null==(s=h())?void 0:s[0])?void 0:c.uuid)||"over-element"===b.type&&null===i.getSharedStorage(_i)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(oo))?void 0:f.uuid)))return"over-element"===b.type&&1===(null==(g=null==b?void 0:b.elements)?void 0:g.length)?(d(b.elements[0]),void t.drawFrame()):i.getSharedStorage(oo)?(d(null),void t.drawFrame()):void 0}else(i.getSharedStorage(oo)||i.getSharedStorage(no))&&(i.setSharedStorage(oo,null),i.setSharedStorage(no,null),t.drawFrame())},pointStart:e=>{var o,a,l,c,v,w,m,y,p,x;s=e.point;const S=i.getSharedStorage(fo);if((null==S?void 0:S.length)>0){if(Lo(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:S})){const t=ko(e.point,u());if(1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)&&!0===(null==(l=null==(a=t.elements[0])?void 0:a.operations)?void 0:l.lock))return;d(null),"over-element"===t.type&&1===(null==(c=null==t?void 0:t.elements)?void 0:c.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(_i,"drag")):(null==(v=t.type)?void 0:v.startsWith("resize-"))?(i.setSharedStorage(eo,t.type),i.setSharedStorage(_i,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const b=jo(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),I=ko(e.point,{...u(),areaSize:b,groupQueue:[]});1===(null==(w=null==I?void 0:I.elements)?void 0:w.length)&&!0===(null==(y=null==(m=I.elements[0])?void 0:m.operations)?void 0:y.lock)||(d(null),"list-area"===I.type?i.setSharedStorage(_i,"drag-list"):"over-element"===I.type&&1===(null==(p=null==I?void 0:I.elements)?void 0:p.length)?(f([I.elements[0]],{triggerEvent:!0}),i.setSharedStorage(_i,"drag")):(null==(x=I.type)?void 0:x.startsWith("resize-"))?(i.setSharedStorage(eo,I.type),i.setSharedStorage(_i,"resize")):(g(),i.setSharedStorage(_i,"area"),i.setSharedStorage(to,e.point),f([],{triggerEvent:!0})),t.drawFrame())},pointMove:e=>{var o,a,r;i.setSharedStorage(ho,[]),i.setSharedStorage(co,[]),i.setSharedStorage(go,!0);const c=i.getActiveStorage("data"),d=h(),u=i.getActiveStorage("scale")||1,g=i.getActiveViewScaleInfo(),v=i.getActiveViewSizeInfo(),w=s,m=e.point,y=i.getSharedStorage(eo),p=i.getSharedStorage(_i),x=i.getSharedStorage(fo);if("drag"===p){if(l="drag",c&&1===(null==d?void 0:d.length)&&w&&m&&!0!==(null==(a=null==(o=d[0])?void 0:o.operations)?void 0:a.lock)){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const a=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:r=0}=e;a.push({x:t,y:i,w:o,h:n,angle:0-r})})),(null==i?void 0:i.length)>0){const i=me(e,a),r=me(t,a);o=r.x-i.x,n=r.y-i.y}return{moveX:o,moveY:n}}(w,m,x);let o=n.toGridNum(e/u),a=n.toGridNum(t/u);const r=function(e,t){var i,o;const{data:n,groupQueue:a,calculator:r,viewScaleInfo:s,viewSizeInfo:l}=t;let h=n.elements||[];(null==a?void 0:a.length)>0&&(h=(null==(o=null==(i=a[a.length-1])?void 0:i.detail)?void 0:o.children)||[]);const c=[];h.forEach((t=>{if(t.uuid!==e){const e=r.calcViewRectInfoFromRange(t.uuid,{checkVisible:!0,viewScaleInfo:s,viewSizeInfo:l});e&&c.push(e)}}));const d=r.calcViewRectInfoFromRange(e,{viewScaleInfo:s,viewSizeInfo:l});if(!d)return null;const f={},u={},g=[],v=[];let w=[],m=[];const y=Do(d);c.forEach((e=>{const t=Do(e);f[t.minX]||(f[t.minX]=[]),f[t.midX]||(f[t.midX]=[]),f[t.maxX]||(f[t.maxX]=[]),u[t.minY]||(u[t.minY]=[]),u[t.midY]||(u[t.midY]=[]),u[t.maxY]||(u[t.maxY]=[]),f[t.minX]=[t.minY,t.midY,t.maxY],f[t.midX]=[t.minY,t.midY,t.maxY],f[t.maxX]=[t.minY,t.midY,t.maxY],w.push(t.minX),w.push(t.midX),w.push(t.maxX),u[t.minY]=[t.minX,t.midX,t.maxX],u[t.midY]=[t.minX,t.midX,t.maxX],u[t.maxY]=[t.minX,t.midX,t.maxX],m.push(t.minY),m.push(t.midY),m.push(t.maxY)})),w=w.sort(((e,t)=>e-t)),m=m.sort(((e,t)=>e-t));let p=null,x=null,S=null,b=null,I=null,A=null,M=null,z=null;if(w.length>0){S=Vo(w,y.minX),b=Vo(w,y.midX),I=Vo(w,y.maxX);const e=Math.abs(S-y.minX),t=Math.abs(b-y.midX),i=Math.abs(I-y.maxX),o=Math.min(e,t,i);o<=2/s.scale&&(Yo(o,e)?p=S-y.minX:Yo(o,t)?p=b-y.midX:Yo(o,i)&&(p=I-y.maxX))}if(m.length>0){A=Vo(m,y.minY),M=Vo(m,y.midY),z=Vo(m,y.maxY);const e=Math.abs(A-y.minY),t=Math.abs(M-y.midY),i=Math.abs(z-y.maxY),o=Math.min(e,t,i);o<=2/s.scale&&(Yo(o,e)?x=A-y.minY:Yo(o,t)?x=M-y.midY:Yo(o,i)&&(x=z-y.maxY))}const R={...y};if(null!==p&&(R.minX+=p,R.midX+=p,R.maxX+=p),null!==x&&(R.minY+=x,R.midY+=x,R.maxY+=x),N.x(p)&&null!==p&&null!==S&&null!==b&&null!==I){if(Yo(p,S-y.minX)){const e={x:S,yList:[]};e.yList.push(R.minY),e.yList.push(R.midY),e.yList.push(R.maxY),e.yList.push(...(null==u?void 0:u[S])||[]),g.push(e)}if(Yo(p,b-y.minX)){const e={x:b,yList:[]};e.yList.push(R.minY),e.yList.push(R.midY),e.yList.push(R.maxY),e.yList.push(...(null==u?void 0:u[b])||[]),g.push(e)}if(Yo(p,I-y.minX)){const e={x:I,yList:[]};e.yList.push(R.minY),e.yList.push(R.midY),e.yList.push(R.maxY),e.yList.push(...(null==u?void 0:u[I])||[]),g.push(e)}}if(N.y(x)&&null!==x&&null!==A&&null!==M&&null!==z){if(Yo(x,A-y.minY)){const e={y:A,xList:[]};e.xList.push(R.minX),e.xList.push(R.midX),e.xList.push(R.maxX),e.xList.push(...(null==f?void 0:f[A])||[]),v.push(e)}if(Yo(x,M-y.midY)){const e={y:M,xList:[]};e.xList.push(R.minX),e.xList.push(R.midX),e.xList.push(R.maxX),e.xList.push(...(null==f?void 0:f[A])||[]),v.push(e)}if(Yo(x,z-y.maxY)){const e={y:z,xList:[]};e.xList.push(R.minX),e.xList.push(R.midX),e.xList.push(R.maxX),e.xList.push(...(null==f?void 0:f[z])||[]),v.push(e)}}const P=[];(null==g?void 0:g.length)>0&&g.forEach(((e,t)=>{P.push([]),e.yList.forEach((i=>{P[t].push({x:e.x,y:i})}))}));const T=[];return(null==v?void 0:v.length)>0&&v.forEach(((e,t)=>{T.push([]),e.xList.forEach((i=>{T[t].push({x:i,y:e.y})}))})),{offsetX:p,offsetY:x,yLines:P,xLines:T}}(d[0].uuid,{calculator:n,data:c,groupQueue:x,viewScaleInfo:g,viewSizeInfo:v});try{r&&(N.x(r.offsetX)&&null!==r.offsetX&&(o=n.toGridNum(o+r.offsetX)),N.y(r.offsetY)&&null!==r.offsetY&&(a=n.toGridNum(a+r.offsetY)),i.setSharedStorage(ho,r.xLines),i.setSharedStorage(co,r.yLines))}catch(e){console.error(e)}d[0].x=n.toGridNum(d[0].x+o),d[0].y=n.toGridNum(d[0].y+a),f([d[0]]),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:d[0],position:i.getSharedStorage(lo)||[]}},viewSizeInfo:v,viewScaleInfo:g})}t.drawFrame()}else if("drag-list"===p){if(l="drag-list",c&&w&&m&&(null==d?void 0:d.length)>1){const e=(m.x-w.x)/u,t=(m.y-w.y)/u;d.forEach((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.lock)&&(i.x=n.toGridNum(i.x+e),i.y=n.toGridNum(i.y+t),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:i,position:ze(i.uuid,c.elements)||[]}},viewSizeInfo:v,viewScaleInfo:g}))})),i.setActiveStorage("data",c)}t.drawFrame()}else if("resize"===p){if(c&&1===(null==d?void 0:d.length)&&w&&(null==y?void 0:y.startsWith("resize-"))){l="resize";const e=[];x.forEach((t=>{const{x:i,y:o,w:n,h:a,angle:r=0}=t;e.push({x:i,y:o,w:n,h:a,angle:0-r})}));let o=w,a=m;if(x.length>0&&(o=me(w,e),a=me(m,e)),"resize-rotate"===y){const e=i.getSharedStorage(so),t=ge([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),o=Oo(d[0],{center:t,viewScaleInfo:g,viewSizeInfo:v,start:w,end:m,resizeType:y,sharer:i});d[0].angle=n.toGridNum(o.angle||0)}else{const e=function(e,t){var i,o,n,a,r,s,l,h,c;let{x:d,y:f,w:u,h:g,angle:v=0}=e;const w=ue({x:d,y:f,w:u,h:g,angle:v});v=Se(v);const m=ce(v),y=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:p,end:x,resizeType:S,scale:b}=t;let I={...p},A={...x},M={x:I.x,y:w.y},z={x:A.x,y:w.y},R={...M},P={...z},T={x:w.x,y:I.y},E={x:w.x,y:A.y},W={...T},C={...E},L=(P.x-R.x)/b,k=(P.y-R.y)/b,O=Eo(L,k),j=(C.x-W.x)/b,D=(C.y-W.y)/b,V=Eo(j,D);(v>0||v<0)&&(I=we(w,p,0-m),A=we(w,x,0-m),M={x:I.x,y:w.y},z={x:A.x,y:w.y},R=we(w,M,m),P=we(w,z,m),T={x:w.x,y:I.y},E={x:w.x,y:A.y},W=we(w,T,m),C=we(w,E,m),L=(P.x-R.x)/b,k=(P.y-R.y)/b,O=Eo(L,k),O=Wo(O,k),j=(C.x-W.x)/b,D=(C.y-W.y)/b,V=Eo(j,D),V=Wo(V,D));let Y=(x.x-p.x)/b,G=(x.y-p.y)/b;if(!0===y)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(Y),Math.abs(G));Y=(Y>=0?1:-1)*t,G=(G>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(j),Math.abs(D));j=(j>=0?1:-1)*i,D=(D>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(L),Math.abs(k));L=(L>=0?1:-1)*o,k=(k>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(Y);Y=(Y>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?G=Y>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(G=Y>0?-i:i)}O=Math.abs(O),V=O/e.w*e.h}switch(S){case"resize-top":if(0===v)g-G>0&&(f+=G,g-=G,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=G/e.h*e.w/2,u-=G/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){V=0-Wo(V,D);const e=To(v),o=V/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){V=Wo(V,j);const e=To(v-90),o=V/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){V=Wo(V,D);const e=To(v-180),o=V/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){V=0-Wo(V,j);const e=To(v-270),o=V/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+V>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(u+=V/e.h*e.w),g+=V,d=t-u/2,f=i-g/2)}break;case"resize-bottom":if(0===v)e.h+G>0&&(g+=G,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=G/e.h*e.w/2,u+=G/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){V=Wo(V,D);const e=To(v),o=V/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){V=0-Wo(V,j);const e=To(v-90),o=V/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){V=Wo(V,j);const e=To(v-180),o=V/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){V=Wo(V,j);const e=To(v-270),o=V/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+V>0&&(!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(u+=V/e.h*e.w),g+=V,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===v)e.w-Y>0&&(d+=Y,u-=Y,!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g-=Y/e.w*e.h,f+=Y/e.w*e.h/2));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){O=0-Wo(O,L);const e=To(v),o=O/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){O=Wo(O,L);const e=To(v-90),o=O/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){O=Wo(O,k);const e=To(v-180),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){O=Wo(O,k);const e=To(v-270),o=O/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+O>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=O/e.w*e.h),u+=O,d=t-u/2,f=i-g/2)}break;case"resize-right":if(0===v)e.w+Y>0&&(u+=Y,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=Y*e.h/e.w/2,g+=Y*e.h/e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){O=Wo(O,k);const e=To(v),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){O=Wo(O,G);const e=To(v-90),o=O/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){O=Wo(O,G);const e=To(v-180),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e),O=0-O}else if(v<360){O=Wo(O,Y);const e=To(v-270),o=O/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+O>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=O/e.w*e.h),u+=O,d=t-u/2,f=i-g/2)}break;case"resize-top-left":if(0===v)u-Y>0&&(d+=Y,u-=Y),g-G>0&&(f+=G,g-=G);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=0-Wo(V,D),O=0-Wo(O,y?0-V:L);const i=V/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=O/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(v<180){V=Wo(V,j),O=Wo(O,y?V:L);const i=To(v-90),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){V=Wo(V,D),O=Wo(O,y?V:k);const i=To(v-180),o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){V=0-Wo(V,j),O=Wo(O,y?V:k);const i=To(v-270),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}break;case"resize-top-right":if(0===v)u+Y>0&&(u+=Y),g-G>0&&(f+=G,g-=G);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=0-Wo(V,D),O=Wo(O,y?V:k);const i=To(v),o=V/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){V=Wo(V,j),O=Wo(O,y?V:k);const i=To(v-90),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=To(v-180);V=Wo(V,D),O=Wo(O,y?V:0-L);const o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){V=0-Wo(V,j),O=Wo(O,y?V:L);const i=To(v-270),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}break;case"resize-bottom-left":if(0===v)e.h+G>0&&(g+=G),e.w-Y>0&&(d+=Y,u-=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=Wo(V,D),O=0-Wo(O,y?0-V:L);const i=To(v),o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){V=0-Wo(V,j),O=Wo(O,y?V:L);const i=To(v-90),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){V=Wo(V,j),O=Wo(O,y?V:k);const i=To(v-180),o=V/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){V=Wo(V,j),O=Wo(O,y?V:k);const i=To(v-270),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}break;case"resize-bottom-right":if(0===v)e.h+G>0&&(g+=G),e.w+Y>0&&(u+=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=Wo(V,D),O=Wo(O,y?V:k);const i=To(v),o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){V=0-Wo(V,j),O=Wo(O,y?V:G);const i=To(v-90),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){V=Wo(V,j),O=Wo(O,y?V:0-k);const i=To(v-180),o=V/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){V=Wo(V,j),O=Wo(O,y?V:L);const i=To(v-270),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}}return{x:d,y:f,w:u,h:g,angle:e.angle}}(d[0],{scale:u,start:o,end:a,resizeType:y,sharer:i}),t={ignore:!!d[0].angle};d[0].x=n.toGridNum(e.x,t),d[0].y=n.toGridNum(e.y,t),"group"===d[0].type&&!0===(null==(r=d[0].operations)?void 0:r.deepResize)?function(e,t){const i=t.w&&t.w>0?t.w:e.w,o=t.h&&t.h>0?t.h:e.h,n=i/e.w,a=o/e.h;if(n===a&&1===n)return e;const r=Math.min(n,a),s=Math.max(n,a);e.w=i,e.h=o;const l={xRatio:n,yRatio:a,minRatio:r,maxRatio:s};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ue(e,l)})),Qe(e,l)}(d[0],{w:n.toGridNum(e.w,t),h:n.toGridNum(e.h,t)}):(d[0].w=n.toGridNum(e.w,t),d[0].h=n.toGridNum(e.h,t))}f([d[0]]),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:d[0],position:i.getSharedStorage(lo)||[]}},viewSizeInfo:v,viewScaleInfo:g}),t.drawFrame()}}else"area"===p&&(l="area",i.setSharedStorage(io,e.point),t.drawFrame());s=e.point},pointEnd(e){l=null,i.setSharedStorage(ho,[]),i.setSharedStorage(co,[]),i.setSharedStorage(go,!1);const o=i.getActiveStorage("data"),r=i.getSharedStorage(eo),h=i.getSharedStorage(_i),c=i.getActiveViewSizeInfo();let d=!1;if(s=null,"resize"===h&&r)i.setSharedStorage(eo,null),d=!0;else if("area"===h){if(i.setSharedStorage(_i,null),o){const e=i.getSharedStorage(to),t=i.getSharedStorage(io);if(e&&t){const{elements:a}=function(e,t){var i;const o=[],n=[],a=[],{viewScaleInfo:r,viewSizeInfo:s,start:l,end:h}=t;if(!(Array.isArray(e.elements)&&l&&h))return{indexes:o,uuids:n,elements:a};const c=Math.min(l.x,h.x),d=Math.max(l.x,h.x),f=Math.min(l.y,h.y),u=Math.max(l.y,h.y);for(let t=0;t<e.elements.length;t++){const l=e.elements[t];if(!0===(null==(i=null==l?void 0:l.operations)?void 0:i.lock))continue;const h=We(l,{viewScaleInfo:r,viewSizeInfo:s}),g=ue(h);if(g.x>=c&&g.x<=d&&g.y>=f&&g.y<=u&&(o.push(t),n.push(l.uuid),a.push(l),h.angle&&(h.angle>0||h.angle<0))){const e=pe(h);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];h.x=Math.min(...t),h.y=Math.min(...i),h.w=Math.abs(Math.max(...t)-Math.min(...t)),h.h=Math.abs(Math.max(...i)-Math.min(...i))}}}return{indexes:o,uuids:n,elements:a}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(_i,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(_i,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(_i,"select"),d=!0):i.setSharedStorage(_i,null)}null===i.getSharedStorage(_i)&&(g(),d=!0);(()=>{if(d){if(o&&Array.isArray(null==o?void 0:o.elements)&&["drag","drag-list"].includes(h)){const e=function(e,t,i){const o=Ie(e,{viewWidth:t.width,viewHeight:t.height,extend:null==i?void 0:i.extend});return!0===(null==i?void 0:i.extend)&&(o.contextWidth=Math.max(o.contextWidth,t.contextWidth),o.contextHeight=Math.max(o.contextHeight,t.contextHeight)),{contextSize:o}}(o.elements,c,{extend:!0});i.setActiveStorage("contextHeight",e.contextSize.contextHeight),i.setActiveStorage("contextWidth",e.contextSize.contextWidth)}if(o&&["drag","drag-list","drag-list-end","resize"].includes(h)){let e="dragElement";a.trigger(Ki,{data:o,type:e})}t.drawFrame()}})()},pointLeave(){s=null,g(),t.drawFrame()},doubleClick(e){var o,n,r,s,l,h;if(!1===i.getSharedStorage(vo))return;const d=ko(e.point,u());if(i.setSharedStorage(so,null),i.setSharedStorage(ao,[]),1!==d.elements.length||!0!==(null==(n=null==(o=d.elements[0])?void 0:o.operations)?void 0:n.lock)){if(1===d.elements.length&&"group"===(null==(r=d.elements[0])?void 0:r.type)){if(!0===c(d.elements[0]))return i.setSharedStorage(_i,null),void t.drawFrame()}else 1===d.elements.length&&"text"===(null==(s=d.elements[0])?void 0:s.type)&&a.trigger(Go,{element:d.elements[0],groupQueue:i.getSharedStorage(fo)||[],position:ze(null==(l=d.elements[0])?void 0:l.uuid,(null==(h=i.getActiveStorage("data"))?void 0:h.elements)||[]),viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(_i,null)}},beforeDrawFrame({snapshot:t}){var i;const{activeStore:o,sharedStore:a}=t,{scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f,width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m}=o,y=e.sharer,p={scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f},x={width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m},S=a[ao][0],b=a[oo],I=a[no],A=a[_i],M=a[to],z=a[io],R=a[fo],P=a[uo],T=a[go],E={calculator:n,viewScaleInfo:p,viewSizeInfo:x},W=S?Ge(S,{groupQueue:R,controllerSize:10,viewScaleInfo:p}):null,C=!!(null==(i=null==b?void 0:b.operations)?void 0:i.lock);if((null==R?void 0:R.length)>0){if(function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:wo,borderWidth:2,background:"transparent",lineDash:[4,4]};So(e,Le(n,i),a)}}(r,P,E),b&&"drag"!==A&&(C?zo(r,I,{...E,controller:Ge(b,{groupQueue:R,controllerSize:10,viewScaleInfo:p})}):Mo(r,I,E)),!C&&S&&["select","drag","resize"].includes(A)&&(Ro(r,W,{...E,element:S,calculator:n,hideControllers:!!T&&"drag"===A}),"drag"===A)){const e=y.getSharedStorage(ho),t=y.getSharedStorage(co);Po(r,{xLines:e,yLines:t})}}else if(b&&"drag"!==A&&(C?zo(r,I,{...E,controller:Ge(b,{groupQueue:R,controllerSize:10,viewScaleInfo:p})}):Mo(r,I,E)),!C&&S&&["select","drag","resize"].includes(A)){if(Ro(r,W,{...E,element:S,calculator:n,hideControllers:!!T&&"drag"===A}),"drag"===A){const e=y.getSharedStorage(ho),t=y.getSharedStorage(co);Po(r,{xLines:e,yLines:t})}}else if("area"===A&&M&&z)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=wo,e.fillStyle="#1976d24f",e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill()}(r,{start:M,end:z});else if(["drag-list","drag-list-end"].includes(A)){const e=jo(h(),{viewScaleInfo:y.getActiveViewScaleInfo(),viewSizeInfo:y.getActiveViewSizeInfo(),calculator:n});e&&function(e,t){const{areaSize:i}=t,{x:o,y:n,w:a,h:r}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=wo,e.fillStyle="#1976d21c",e.beginPath(),e.moveTo(o,n),e.lineTo(o+a,n),e.lineTo(o+a,n+r),e.lineTo(o,n+r),e.closePath(),e.stroke(),e.fill()}(r,{areaSize:e})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o}=e,n=i.boardContext.canvas,a=document.createElement("div");a.setAttribute("contenteditable","true");const r=document.createElement("div"),s=e.container||document.body,l=document.createElement("div");let h=null,c=[];r.appendChild(a),r.style.position="absolute",l.appendChild(r),l.style.position="fixed",l.style.top="0",l.style.bottom="0",l.style.left="0",l.style.right="0",l.style.display="none",s.appendChild(l);const d=()=>{l.style.display="none",h=null,c=[]},f=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:r,h:s}=t,l=Se(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${a}px`,o.style.width=`${r}px`,o.style.height=`${s}px`,o.style.transform=`rotate(${l}deg)`,i.appendChild(o),o},u=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:s,offsetLeft:l}=t;r.children&&Array.from(r.children).forEach((e=>{e.remove()}));let h=r;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:a,w:r,h:c}=t,d={x:i*n,y:a*n,w:r*n,h:c*n,angle:Se(t.angle||0)};0===e&&(d.x+=l,d.y+=s),h=f({size:d,parent:h})}const c={...Bo,...i.detail};let d=i.x*n+l,u=i.y*n+s,g=i.w*n,v=i.h*n;o.length>0&&(d=i.x*n,u=i.y*n,g=i.w*n,v=i.h*n);let w="center",m="center";"left"===c.textAlign?w="start":"right"===c.textAlign&&(w="end"),"top"===c.verticalAlign?m="start":"bottom"===c.verticalAlign&&(m="end"),a.style.display="inline-flex",a.style.justifyContent=w,a.style.alignItems=m,a.style.position="absolute",a.style.left=d-1+"px",a.style.top=u-1+"px",a.style.width=`${g+2}px`,a.style.height=`${v+2}px`,a.style.transform=`rotate(${Se(i.angle||0)}deg)`,a.style.boxSizing="border-box",a.style.border="1px solid #1973ba",a.style.resize="none",a.style.overflow="hidden",a.style.wordBreak="break-all",a.style.background="#FFFFFF",a.style.color="#333333",a.style.fontSize=c.fontSize*n+"px",a.style.lineHeight=c.lineHeight*n+"px",a.style.fontFamily=c.fontFamily,a.style.fontWeight=`${c.fontWeight}`,a.style.padding="0",a.style.margin="0",a.style.outline="none",a.innerText=c.text||"",h.appendChild(a)},g=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:a}=e;return{left:t,top:i,width:o,height:a}})();r.style.position="absolute",r.style.overflow="hidden",r.style.top=`${t}px`,r.style.left=`${e}px`,r.style.width=`${i}px`,r.style.height=`${o}px`};l.addEventListener("click",(()=>{d()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(()=>{h&&c&&(h.detail.text=a.innerText||"",t.trigger(Fo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c||[]]}),o.drawFrame())})),a.addEventListener("blur",(()=>{h&&c&&t.trigger(Fo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c]}),d()})),a.addEventListener("keydown",(e=>{e.stopPropagation()})),a.addEventListener("keypress",(e=>{e.stopPropagation()})),a.addEventListener("keyup",(e=>{e.stopPropagation()})),a.addEventListener("wheel",(e=>{e.stopPropagation(),e.preventDefault()}));const v=e=>{var t;(null==e?void 0:e.position)&&(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element,c=e.position),(e=>{g(),u(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(Go,v)},disuse(){t.off(Go,v)}}},e.eventChange=Ki,e.middlewareEventRuler=fn,e.middlewareEventScale=on,e.middlewareEventSelect=yo,e.middlewareEventSelectClear=po,e.middlewareEventSelectInGroup=xo,e.middlewareEventTextChange=Fo,e.middlewareEventTextEdit=Go,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
|
1
|
+
var iDrawCore=function(e){"use strict";var t,i,o,n,a,r,s,l,h,c,d,f,u,g,v,w,m,y,p,x,S=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},b=(e,t,i)=>(S(e,t,"read from private field"),i?i.call(e):t.get(e)),I=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},A=(e,t,i,o)=>(S(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),M=(e,t,i)=>(S(e,t,"access private method"),i);function z(e){return"string"==typeof e&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}function R(e,t){if(1===t)return e;let i=1;const o=/^\#[0-9a-f]{6,6}$/i;let n=e;if(o.test(e)?i=parseInt(e.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(e)&&(i=parseInt(e.substring(7,9).replace(/^\#/,"0x")),n=e.substring(0,7)),i*=t,o.test(n)&&i>0&&i<1){const e=Math.max(0,Math.min(255,Math.ceil(256*i)));n=`${n.toUpperCase()}${e.toString(16).toUpperCase()}`}return n}function P(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function T(e){let t=0;for(let i=0;i<e.length;i++)t+=e.charCodeAt(i)*e.charCodeAt(i)*i*i;return t.toString(16).substring(0,4)}function E(e){const t=e.length,i=Math.floor(t/2),o=e.substring(0,4).padEnd(4,"0"),n=e.substring(0,4).padEnd(4,"0");return`@assets/${T(t.toString(16).padEnd(4,o))}${T(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${T(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${T(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${T(n.padEnd(4,o).padEnd(4,n))}`}function W(e){return function e(t){const i=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return t;if("Array"===i){const i=[];return t.forEach((t=>{i.push(e(t))})),i}if("Object"===i){const i={};Object.keys(t).forEach((o=>{i[o]=e(t[o])}));return Object.getOwnPropertySymbols(t).forEach((o=>{i[o]=e(t[o])})),i}}(e)}function C(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const L={type(e,t){const i=C(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===C(e),json:e=>"Object"===C(e),function:e=>"Function"===C(e),asyncFunction:e=>"AsyncFunction"===C(e),boolean:e=>"Boolean"===C(e),string:e=>"String"===C(e),number:e=>"Number"===C(e),undefined:e=>"Undefined"===C(e),null:e=>"Null"===C(e),promise:e=>"Promise"===C(e)};var k=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))};const{Image:O}=window;function j(e){return new Promise(((t,i)=>{const o=new O;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function D(e){return k(this,void 0,void 0,(function*(){const t=yield function(e){return new Promise(((t,i)=>{const o=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=new FileReader;n.readAsDataURL(o),n.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},n.onerror=function(e){i(e)}}))}(e);return yield j(t)}))}function V(e,t){return k(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},r.onerror=function(e){n(e)}}))}(e,t);return yield j(i)}))}function Y(e){return"number"==typeof e&&(e>0||e<=0)}function G(e){return"number"==typeof e&&e>=0}function F(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function B(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const N={x:function(e){return Y(e)},y:function(e){return Y(e)},w:G,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:Y,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return G(e)},borderRadius:function(e){return Y(e)&&e>=0},color:function(e){return z(e)},imageSrc:function(e){return B(e)||F(e)},imageURL:F,imageBase64:B,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return Y(e)&&e>0},lineHeight:function(e){return Y(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return Y(e)&&e>0}};var X,H,Z=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Q=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class U{constructor(e,t){X.set(this,void 0),H.set(this,void 0),Z(this,X,e,"f"),Z(this,H,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f"),this.$resetFont()}$undoPixelRatio(e){return e/Q(this,H,"f").devicePixelRatio}$doPixelRatio(e){return Q(this,H,"f").devicePixelRatio*e}$getContext(){return Q(this,X,"f")}$setContext(e){Z(this,X,e,"f")}$setFont(e){const t=[];e.fontWeight&&t.push(`${e.fontWeight}`),t.push(`${this.$doPixelRatio(e.fontSize||12)}px`),t.push(`${e.fontFamily||"sans-serif"}`),Q(this,X,"f").font=`${t.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return Q(this,H,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=Q(this,X,"f");a.width=t*o,a.height=i*o,Z(this,H,Object.assign(Object.assign({},Q(this,H,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=Q(this,H,"f"),{width:t,height:i}=Q(this,X,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return Q(this,X,"f").canvas}get fillStyle(){return Q(this,X,"f").fillStyle}set fillStyle(e){Q(this,X,"f").fillStyle=e}get strokeStyle(){return Q(this,X,"f").strokeStyle}set strokeStyle(e){Q(this,X,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(Q(this,X,"f").lineWidth)}set lineWidth(e){Q(this,X,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return Q(this,X,"f").textAlign}set textAlign(e){Q(this,X,"f").textAlign=e}get textBaseline(){return Q(this,X,"f").textBaseline}set textBaseline(e){Q(this,X,"f").textBaseline=e}get globalAlpha(){return Q(this,X,"f").globalAlpha}set globalAlpha(e){Q(this,X,"f").globalAlpha=e}get shadowColor(){return Q(this,X,"f").shadowColor}set shadowColor(e){Q(this,X,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(Q(this,X,"f").shadowOffsetX)}set shadowOffsetX(e){Q(this,X,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(Q(this,X,"f").shadowOffsetY)}set shadowOffsetY(e){Q(this,X,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(Q(this,X,"f").shadowBlur)}set shadowBlur(e){Q(this,X,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return Q(this,X,"f").lineCap}set lineCap(e){Q(this,X,"f").lineCap=e}get globalCompositeOperation(){return Q(this,X,"f").globalCompositeOperation}set globalCompositeOperation(e){Q(this,X,"f").globalCompositeOperation=e}fill(...e){return Q(this,X,"f").fill(...e)}arc(e,t,i,o,n,a){return Q(this,X,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return Q(this,X,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return Q(this,X,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return Q(this,X,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return Q(this,X,"f").beginPath()}closePath(){return Q(this,X,"f").closePath()}lineTo(e,t){return Q(this,X,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return Q(this,X,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return Q(this,X,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return Q(this,X,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return Q(this,X,"f").setLineDash(t)}stroke(e){return e?Q(this,X,"f").stroke(e):Q(this,X,"f").stroke()}translate(e,t){return Q(this,X,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return Q(this,X,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],a=e[4],r=e[e.length-4],s=e[e.length-3],l=e[e.length-2],h=e[e.length-1];return 9===e.length?Q(this,X,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a),this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h)):Q(this,X,"f").drawImage(t,this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return Q(this,X,"f").createPattern(e,t)}measureText(e){return Q(this,X,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?Q(this,X,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,X,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?Q(this,X,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,X,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){Q(this,X,"f").save()}restore(){Q(this,X,"f").restore()}scale(e,t){Q(this,X,"f").scale(e,t)}circle(e,t,i,o,n,a,r,s){Q(this,X,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,r,s)}isPointInPath(e,t){return Q(this,X,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return Q(this,X,"f").clip(...e)}setTransform(e,t,i,o,n,a){return Q(this,X,"f").setTransform(e,t,i,o,n,a)}getTransform(){return Q(this,X,"f").getTransform()}createLinearGradient(e,t,i,o){return Q(this,X,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return Q(this,X,"f").createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a))}createConicGradient(e,t,i){return Q(this,X,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function J(e){const{width:t,height:i,ctx:o,devicePixelRatio:n}=e;let a=o;if(!a){const e=document.createElement("canvas");e.width=t*n,e.height=i*n,a=e.getContext("2d")}return new U(a,e)}function $(e){const{width:t,height:i,devicePixelRatio:o}=e,n=new OffscreenCanvas(t*o,i*o),a=n.getContext("2d").canvas.getContext("2d");return new U(a,{devicePixelRatio:o,offscreenCanvas:n})}X=new WeakMap,H=new WeakMap;var K,q=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class _{constructor(){K.set(this,void 0),function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,i):n?n.value=i:t.set(e,i)}(this,K,new Map,"f")}on(e,t){if(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e)||[];null==i||i.push(t),q(this,K,"f").set(e,i)}else q(this,K,"f").set(e,[t])}off(e,t){if(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e);if(Array.isArray(i))for(let e=0;e<(null==i?void 0:i.length);e++)if(i[e]===t){i.splice(e,1);break}q(this,K,"f").set(e,i||[])}}trigger(e,t){const i=q(this,K,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(q(this,K,"f").has(e)){const t=q(this,K,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){q(this,K,"f").clear()}}function ee(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}K=new WeakMap;var te,ie,oe,ne,ae=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},re=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class se{constructor(e){te.add(this),ie.set(this,void 0),oe.set(this,void 0),ae(this,oe,W(e.defaultStorage),"f"),ae(this,ie,re(this,te,"m",ne).call(this),"f")}set(e,t){re(this,ie,"f")[e]=t}get(e){return re(this,ie,"f")[e]}getSnapshot(e){return!0===(null==e?void 0:e.deepClone)?W(re(this,ie,"f")):Object.assign({},re(this,ie,"f"))}clear(){ae(this,ie,re(this,te,"m",ne).call(this),"f")}destroy(){ae(this,ie,null,"f")}}function le(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}}function he(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}}function ce(e){return e/180*Math.PI}function de(e,t,i,o){const n=ce(t||0);i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(n),e.translate(-i.x,-i.y)),o(e),i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(-n),e.translate(-i.x,-i.y))}function fe(e,t,i){const o=ue(t);de(e,t.angle||0,o,(()=>{i(e)}))}function ue(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function ge(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),i=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return ue({x:t,y:i,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-i})}function ve(e,t){const i=t.x-e.x,o=t.y-e.y;if(0===i){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&o<0?Math.atan(Math.abs(i)/Math.abs(o)):i>0&&o>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):0}function we(e,t,i){let o=ve(e,t)+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const n=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let a=0,r=0;return 0===o?(a=0,r=0-n):o>0&&o<Math.PI/2?(a=Math.sin(o)*n,r=0-Math.cos(o)*n):o===Math.PI/2?(a=n,r=0):o>Math.PI/2&&o<Math.PI?(a=Math.sin(Math.PI-o)*n,r=Math.cos(Math.PI-o)*n):o===Math.PI?(a=0,r=n):o>Math.PI&&o<1.5*Math.PI?(a=0-Math.sin(o-Math.PI)*n,r=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(a=0-n,r=0):o>1.5*Math.PI&&o<2*Math.PI?(a=0-Math.sin(2*Math.PI-o)*n,r=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(a=0,r=0-n),a+=e.x,r+=e.y,{x:a,y:r}}function me(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:a,h:r,angle:s=0}=e,l=we(ue({x:t,y:n,w:a,h:r,angle:s}),{x:i,y:o},ce(s));i=l.x,o=l.y})),{x:i,y:o}}return e}function ye(e,t,i){const{x:o,y:n,w:a,h:r}=e;let s={x:o,y:n},l={x:o+a,y:n},h={x:o+a,y:n+r},c={x:o,y:n+r};if(i&&(i>0||i<0)){const e=ce(Se(i));s=we(t,s,e),l=we(t,l,e),h=we(t,h,e),c=we(t,c,e)}return[s,l,h,c]}function pe(e){const{angle:t=0}=e;return ye(e,ue(e),t)}function xe(e,t,i){return[we(e,{x:t[0].x,y:t[0].y},i),we(e,{x:t[1].x,y:t[1].y},i),we(e,{x:t[2].x,y:t[2].y},i),we(e,{x:t[3].x,y:t[3].y},i)]}function Se(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function be(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=be(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function Ie(e,t){const i={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=pe(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),a=Math.max(t.x+t.w,i.x+i.w),r=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(a-o),i.h=Math.abs(r-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function Ae(e,t){var i;const o=[];let n=e;if(t.length>1)for(let e=0;e<t.length-1;e++){const a=n[t[e]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(i=null==a?void 0:a.detail)||void 0===i?void 0:i.children))return null;o.push(a),n=a.detail.children}return o}function Me(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===n.type)o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}function ze(e,t){const i=[];let o=!1;const n=t=>{var a;for(let r=0;r<t.length&&!0!==o;r++){i.push(r);const s=t[r];if(s.uuid===e){o=!0;break}if("group"===s.type&&n((null===(a=null==s?void 0:s.detail)||void 0===a?void 0:a.children)||[]),o)break;i.pop()}};return n(t),i}function Re(e){const{x:t,y:i,h:o,w:n}=e;return[{x:t,y:i},{x:t+n,y:i},{x:t+n,y:i+o},{x:t,y:i+o}]}function Pe(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?Re(e):ye(e,ue({x:t,y:i,w:o,h:n,angle:a}),a)}function Te(e){const t=[];let i=0,o=0;const n=[],a=[...e];for(let e=0;e<a.length;e++){const{x:r,y:s,w:l,h:h,angle:c=0}=a[e];let d;if(i+=r,o+=s,0===e){const e={x:i,y:o,w:l,h:h,angle:c};d=Pe({x:r,y:s,w:l,h:h,angle:c}),n.push({center:ue(e),angle:c,radian:ce(c)})}else{d=Re({x:i,y:o,w:l,h:h,angle:c});for(let e=0;e<n.length;e++){const{center:t,radian:i}=n[e];d=xe(t,d,i)}const e=ge(d);if(c>0||c<0){d=xe(e,d,ce(c))}n.push({center:e,angle:c,radian:ce(c)})}t.push(d)}return t}function Ee(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Te([...i,e]):[Pe(e)]}(e,t);return i.pop()||null}function We(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:a,h:r,angle:s}=e,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:o*l+c,y:n*l+h,w:a*l,h:r*l,angle:s}}function Ce(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:a,offsetTop:r,offsetLeft:s}=i;return{x:o*a+s,y:n*a+r}}function Le(e,t){return[Ce(e[0],t),Ce(e[1],t),Ce(e[2],t),Ce(e[3],t)]}function ke(e,t){const{context2d:i,element:o,viewScaleInfo:n}=t,{angle:a=0}=o,{x:r,y:s,w:l,h:h}=We(o,{viewScaleInfo:n}),c=pe({x:r,y:s,w:l,h:h,angle:a});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let e=1;e<c.length;e++)i.lineTo(c[e].x,c[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function Oe(e,t,i){const o=[t[0].x,t[1].x,t[2].x,t[3].x],n=[t[0].y,t[1].y,t[2].y,t[3].y],a=Math.min(...o),r=Math.max(...o),s=Math.min(...n),l=Math.max(...n);return e.x>a&&e.x<r&&e.y>s&&e.y<l||!0===(null==i?void 0:i.includeBorder)&&(e.x===a||e.x===r||e.y===s||e.y===l)}function je(e,t){const{groupQueue:i}=t,o=Ee(e,{groupQueue:i}),n=ee(o[0],o[1]),a=ee(o[1],o[2]),r=ee(o[2],o[3]),s=ee(o[3],o[0]),l=o[0],h=o[1],c=o[2],d=o[3],f=Math.max(l.x,h.x,c.x,d.x),u=Math.max(l.y,h.y,c.y,d.y);return{center:{x:(f+Math.min(l.x,h.x,c.x,d.x))/2,y:(u+Math.min(l.y,h.y,c.y,d.y))/2},topLeft:l,topRight:h,bottomLeft:d,bottomRight:c,top:n,right:a,left:s,bottom:r}}function De(e){const t=Math.max(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),i=Math.max(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),o=Math.min(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),a={x:e.center.x,y:e.center.y},r={x:o,y:n},s={x:t,y:n},l={x:t,y:i},h={x:o,y:i},c=ee(r,s),d=ee(h,l),f=ee(r,h);return{center:a,topLeft:r,topRight:s,bottomLeft:h,bottomRight:l,top:c,right:ee(s,l),left:f,bottom:d}}function Ve(e,t){const i=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n,offsetLeft:a}=t,{width:r,height:s}=i,l=0-a/o,h=0-n/o,c=r/o,d=s/o,f=ue({x:l,y:h,w:c,h:d}),u={x:l,y:h},g={x:l+c,y:h},v={x:l,y:h+d},w={x:l+c,y:h+d},m={x:l,y:f.y},y={x:f.x,y:h},p={x:l+c,y:f.y},x={x:f.x,y:h+d};return{center:f,topLeft:u,topRight:g,bottomLeft:v,bottomRight:w,left:m,top:y,right:p,bottom:x}}(t);let o=0,n=0;return Object.keys(e).forEach((t=>{const a=e[t];a.isVisibleInView=function(e,t){const i=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),o=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),a=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),r=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),s=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),l=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),h=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y);return i<=s&&o>=r&&n<=h&&a>=l||s<=a&&s>=a&&s<=a&&s>=a}(a.rangeRectInfo,i),a.isVisibleInView?o++:n++})),{viewVisibleInfoMap:e,visibleCount:o,invisibleCount:n}}function Ye(e,t){const{x:i,y:o}=e,{size:n,angle:a}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:a}}function Ge(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n}=t,a=(o&&o>0?o:8)/n.scale,{x:r,y:s,w:l,h:h,angle:c=0}=e,d=[{uuid:P(),x:r,y:s,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let f=0;d.forEach((({angle:e=0})=>{f+=e}));const u=Ee(e,{groupQueue:i}),g=Ee({x:r-2*a,y:s-2*a,h:h+4*a,w:l+4*a,angle:c},{groupQueue:[...i]}),v=ee(u[0],u[1]),w=ee(u[1],u[2]),m=ee(u[2],u[3]),y=ee(u[3],u[0]),p=u[0],x=u[1],S=u[2],b=u[3],I=Ye(v,{size:a,angle:f}),A=Ye(w,{size:a,angle:f}),M=Ye(m,{size:a,angle:f}),z=Ye(y,{size:a,angle:f}),R=Ye(p,{size:a,angle:f}),T=Ye(x,{size:a,angle:f}),E=Ye(b,{size:a,angle:f}),W=Ye(S,{size:a,angle:f}),C=Pe(R),L=Pe(T),k=Pe(E),O=Pe(W),j=[C[1],L[0],L[3],C[2]],D=[L[3],L[2],O[1],O[0]],V=[k[1],O[0],O[3],k[2]],Y=[C[3],C[2],k[1],k[0]],G=Pe(I),F=Pe(A),B=Pe(M),N=Pe(z),X=ee(g[0],g[1]);return{elementWrapper:u,left:{type:"left",vertexes:Y,center:y},right:{type:"right",vertexes:D,center:w},top:{type:"top",vertexes:j,center:v},bottom:{type:"bottom",vertexes:V,center:m},topLeft:{type:"top-left",vertexes:C,center:p},topRight:{type:"top-right",vertexes:L,center:x},bottomLeft:{type:"bottom-left",vertexes:k,center:b},bottomRight:{type:"bottom-right",vertexes:O,center:S},leftMiddle:{type:"left-middle",vertexes:N,center:y},rightMiddle:{type:"right-middle",vertexes:F,center:w},topMiddle:{type:"top-middle",vertexes:G,center:v},bottomMiddle:{type:"bottom-middle",vertexes:B,center:m},rotate:{type:"rotate",vertexes:Pe(Ye(X,{size:a,angle:f})),center:X}}}function Fe(e,t){const{controllerSize:i,viewScaleInfo:o}=t,n=i&&i>0?i:8,{x:a,y:r,w:s,h:l}=We(e,{viewScaleInfo:o}),h=ue({x:a,y:r,w:s,h:l}),c={x:h.x,y:r},d={x:a+s,y:h.y},f={x:h.x,y:r+l},u={x:a,y:h.y},g={x:a,y:r},v={x:a+s,y:r},w={x:a+s,y:r+l},m={x:a,y:r+l},y=Ye(c,{size:n,angle:0}),p=Ye(d,{size:n,angle:0}),x=Ye(f,{size:n,angle:0}),S=Ye(u,{size:n,angle:0}),b=Ye(g,{size:n,angle:0}),I=Ye(v,{size:n,angle:0}),A=Ye(m,{size:n,angle:0}),M=Ye(w,{size:n,angle:0}),z=Pe(b),R=Pe(I),P=Pe(A),T=Pe(M),E=[z[1],R[0],R[3],z[2]],W=[R[3],R[2],T[1],T[0]],C=[P[1],T[0],T[3],P[2]],L=[z[3],z[2],P[1],P[0]],k=Pe(y),O=Pe(p),j=Pe(x);return{left:{type:"left",vertexes:L,center:u},right:{type:"right",vertexes:W,center:d},top:{type:"top",vertexes:E,center:c},bottom:{type:"bottom",vertexes:C,center:f},topLeft:{type:"top-left",vertexes:z,center:g},topRight:{type:"top-right",vertexes:R,center:v},bottomLeft:{type:"bottom-left",vertexes:P,center:m},bottomRight:{type:"bottom-right",vertexes:T,center:w},leftMiddle:{type:"left-middle",vertexes:Pe(S),center:u},rightMiddle:{type:"right-middle",vertexes:O,center:d},topMiddle:{type:"top-middle",vertexes:k,center:c},bottomMiddle:{type:"bottom-middle",vertexes:j,center:f}}}function Be(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function Ne(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}ie=new WeakMap,oe=new WeakMap,te=new WeakSet,ne=function(){return W(re(this,oe,"f"))};const Xe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function He(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=Xe.boxSizing,borderWidth:r}=e.detail;Array.isArray(r)&&(n=0);let{x:s,y:l,w:h,h:c}=e,d=[0,0,0,0];if("number"==typeof n){const e=n*o;d=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(d=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let f=0;return"number"==typeof r&&(f=(r||0)*o),"border-box"===a?(s=e.x+f/2,l=e.y+f/2,h=e.w-f,c=e.h-f):"content-box"===a?(s=e.x-f/2,l=e.y-f/2,h=e.w+f,c=e.h+f):(s=e.x,l=e.y,h=e.w,c=e.h),h=Math.max(h,1),c=Math.max(c,1),d=d.map((e=>Math.min(e,h/2,c/2))),{x:s,y:l,w:h,h:c,radiusList:d}}const Ze=e=>Ne(e,{decimalPlaces:4});function Qe(e,t){const{detail:i}=e,{xRatio:o,yRatio:n,maxRatio:a}=t,r=(o+n)/2,{borderWidth:s,borderRadius:l,borderDash:h,shadowOffsetX:c,shadowOffsetY:d,shadowBlur:f}=i;if("number"==typeof s)i.borderWidth=Ze(s*r);else if(Array.isArray(i.borderWidth)){const e=s;i.borderWidth=[Ze(e[0]*n),Ze(e[1]*o),Ze(e[2]*n),Ze(e[3]*o)]}if("number"==typeof l)i.borderRadius=Ze(l*r);else if(Array.isArray(i.borderRadius)){const e=l;i.borderRadius=[e[0]*o,e[1]*o,e[2]*n,e[3]*n]}Array.isArray(h)&&h.forEach(((e,t)=>{i.borderDash[t]=Ze(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Ze(c*a)),"number"==typeof d&&(i.shadowOffsetX=Ze(d*a)),"number"==typeof f&&(i.shadowOffsetX=Ze(f*a))}function Ue(e,t){const{type:i}=e;!function(e,t){const{xRatio:i,yRatio:o}=t,{x:n,y:a,w:r,h:s}=e;e.x=Ze(n*i),e.y=Ze(a*o),e.w=Ze(r*i),e.h=Ze(s*o),Qe(e,t)}(e,t),"circle"===i||("text"===i?function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:a}=e.detail,r=(i+o)/2;n&&n>0&&(e.detail.fontSize=Ze(n*r)),a&&a>0&&(e.detail.lineHeight=Ze(a*r))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ue(e,t)})))}function Je(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:a=1}=i,{x:r,y:s}=o,{scale:l}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l},c={x:r+o.x*l,y:s+o.y*l},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,R(e.color,a))})),d}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l,radius:i.radius*l},c={x:r+o.x*l,y:s+o.y*l,radius:o.radius*l},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,R(e.color,a))})),d}return"#000000"}const $e={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Ke(e){var t,i,o,n;let a=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(a=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),a}function qe(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=Ke(a)*h;!function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:a,viewSizeInfo:r}=i,s=r.devicePixelRatio,{clipPath:l}=(null==n?void 0:n.detail)||{};if(l&&a&&l.commands){const{x:i,y:n,w:r,h:h}=a,{originW:c,originH:d,originX:f,originY:u}=l,g=r/c,v=h/d,w=i-f*g,m=n-u*v;e.save(),e.translate(w,m),e.scale(s*g,s*v);const y=Be(l.commands||[]),p=new Path2D(y);e.clip(p),e.translate(0-w,0-m),e.setTransform(1,0,0,1,0,0),fe(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l,renderContent:()=>{e.globalAlpha=c,_e(e,t,{pattern:o,viewScaleInfo:s,viewSizeInfo:l}),null==n||n(),et(e,t,{viewScaleInfo:s,viewSizeInfo:l}),e.globalAlpha=h}})}function _e(e,t,i){var o,n;const{pattern:a,viewScaleInfo:r,viewSizeInfo:s}=i,l=[];if(t.detail.background||a){const{x:i,y:h,w:c,h:d,radiusList:f}=He(t,{viewScaleInfo:r,viewSizeInfo:s});if(e.beginPath(),e.moveTo(i+f[0],h),e.arcTo(i+c,h,i+c,h+d,f[1]),e.arcTo(i+c,h+d,i,h+d,f[2]),e.arcTo(i,h+d,i,h,f[3]),e.arcTo(i,h,i+c,h,f[0]),e.closePath(),"string"==typeof a)e.fillStyle=a;else if(["CanvasPattern"].includes(L.type(a)))e.fillStyle=a;else if("string"==typeof t.detail.background)e.fillStyle=t.detail.background;else if("linear-gradient"===(null===(o=t.detail.background)||void 0===o?void 0:o.type)){const o=Je(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=Je(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=o,l&&l.length>0)for(let t=0;t<(null==l?void 0:l.length);t++){const o=l[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+h):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill(),l&&l.length>0&&e.setTransform(1,0,0,1,0,0)}}function et(e,t,i){if(0===t.detail.borderWidth)return;if(!z(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=$e.borderColor;!0===z(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:r,borderRadius:s,borderDash:l,boxSizing:h=$e.boxSizing}=t.detail;let c=0;"number"==typeof r&&(c=r||1),c*=n;let d=[0,0,0,0];if("number"==typeof s){const e=s*n;d=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(d=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);e.strokeStyle=a;let f=[];Array.isArray(l)&&l.length>0&&(f=l.map((e=>Math.ceil(e*n))));let u=0,g=0,v=0,w=0;if(Array.isArray(r)&&(u=(r[0]||0)*n,g=(r[1]||0)*n,v=(r[2]||0)*n,w=(r[3]||0)*n),w||g||u||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=w/2,o+=u/2,n=n-w/2-g/2,a=a-u/2-v/2):"content-box"===h?(i-=w/2,o-=u/2,n=n+w/2+g/2,a=a+u/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),u&&(e.beginPath(),e.lineWidth=u,e.moveTo(i-w/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-u/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-w/2,o+a),e.lineTo(i+n+g/2,o+a),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i,o-u/2),e.lineTo(i,o+a+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i=t.x+c/2,o=t.y+c/2,n=t.w-c,a=t.h-c):"content-box"===h?(i=t.x-c/2,o=t.y-c/2,n=t.w+c,a=t.h+c):(i=t.x,o=t.y,n=t.w,a=t.h),f.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),d=d.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(f),e.lineWidth=c,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+a,d[1]),e.arcTo(i+n,o+a,i,o+a,d[2]),e.arcTo(i,o+a,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}function tt(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:r,shadowOffsetX:s,shadowOffsetY:l,shadowBlur:h}=o;N.number(h)?(e.save(),e.shadowColor=r||$e.shadowColor,e.shadowOffsetX=(s||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):(e.save(),e.shadowColor="transparent",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,a(),e.restore())}const it={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ot(e,t,i){var o;if(!0===(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))return;const{w:n,h:a}=t,{scale:r}=i.viewScaleInfo;if(!(r<1&&(n*r<1||a*r<1)||0===i.parentOpacity))try{switch(t.type){case"rect":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:r,y:s,w:l,h:h,angle:c}=We(t,{viewScaleInfo:o,viewSizeInfo:n})||t,d=Object.assign(Object.assign({},t),{x:r,y:s,w:l,h:h,angle:c});fe(e,{x:r,y:s,w:l,h:h,angle:c},(()=>{tt(e,d,{viewScaleInfo:o,viewSizeInfo:n,renderContent:()=>{qe(e,d,{originElem:t,calcElemSize:{x:r,y:s,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{background:l="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:d=0}=o;let f=0;"number"==typeof d&&d>0?f=d:Array.isArray(d)&&"number"==typeof d[0]&&d[0]>0&&(f=d[0]),f*=a.scale;const{x:u,y:g,w:v,h:w}=We({x:t.x,y:t.y,w:t.w,h:t.h},{viewScaleInfo:a,viewSizeInfo:r})||t,m=Object.assign(Object.assign({},t),{x:u,y:g,w:v,h:w,angle:n});fe(e,{x:u,y:g,w:v,h:w,angle:n},(()=>{tt(e,m,{viewScaleInfo:a,viewSizeInfo:r,renderContent:()=>{let t=v/2,i=w/2;const o=u+t,n=g+i;if(f>0&&("border-box"===c?(t-=f,i-=f):"center-line"===c?(t-=f/2,i-=f/2):(t-=f,i-=f)),t>=0&&i>=0){const r=Ke(m)*s;if(e.globalAlpha=r,"number"==typeof f&&f>0){const a=f/2+t,r=f/2+i;e.beginPath(),e.strokeStyle=h,e.lineWidth=f,e.circle(o,n,a,r,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const c=Je(e,l,{viewElementSize:{x:u,y:g,w:v,h:w},viewScaleInfo:a,opacity:e.globalAlpha});e.fillStyle=c,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=s}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:r,y:s,w:l,h:h,angle:c}=We(t,{viewScaleInfo:o})||t,d=Object.assign(Object.assign({},t),{x:r,y:s,w:l,h:h,angle:c});fe(e,{x:r,y:s,w:l,h:h,angle:c},(()=>{qe(e,d,{originElem:t,calcElemSize:{x:r,y:s,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{const i=Object.assign(Object.assign({},it),t.detail),n=i.fontSize||it.fontSize,a=n*o.scale,c=(i.lineHeight||n)*o.scale;e.fillStyle=t.detail.color||it.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:a,fontFamily:i.fontFamily});const d=i.text.replace(/\r\n/gi,"\n"),f=c,u=d.split("\n"),g=[];let v=0;u.forEach(((t,i)=>{let o="";if(t.length>0){for(let n=0;n<t.length&&(e.measureText(o+(t[n]||"")).width<=e.$doPixelRatio(l)?o+=t[n]||"":(g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",v++),!((v+1)*f>h));n++)if(t.length-1===n&&(v+1)*f<=h){g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<u.length-1&&v++;break}}else g.push({text:"",width:0})}));let w=0;g.length*f<h&&("top"===t.detail.verticalAlign?w=0:"bottom"===t.detail.verticalAlign?w+=h-g.length*f:w+=(h-g.length*f)/2);{const t=s+w;void 0!==i.textShadowColor&&z(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&N.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&N.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&N.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),g.forEach(((o,n)=>{let a=r;"center"===i.textAlign?a=r+(l-o.width)/2:"right"===i.textAlign&&(a=r+(l-o.width)),e.fillText(o.text,a,t+f*n)}))}}})}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{tt(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{qe(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{if(o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=Ke(t)*r;const{x:i,y:s,w:l,h:h,radiusList:c}=He(f,{viewScaleInfo:n,viewSizeInfo:a});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+c[0],s),e.arcTo(i+l,s,i+l,s+h,c[1]),e.arcTo(i+l,s+h,i,s+h,c[2]),e.arcTo(i,s+h,i,s,c[3]),e.arcTo(i,s,i+l,s,c[0]),e.closePath(),e.fill(),e.clip(),e.drawImage(o,i,s,l,h),e.globalAlpha=r,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t;fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=Ke(t)*r,e.drawImage(o,s,l,h,c),e.globalAlpha=r)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t;fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=Ke(t)*r,e.drawImage(o,s,l,h,c),e.globalAlpha=r)}))}(e,t,i);break;case"path":!function(e,t,i){const{detail:o}=t,{originX:n,originY:a,originW:r,originH:s}=o,{viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c}=i,{x:d,y:f,w:u,h:g,angle:v}=We(t,{viewScaleInfo:l,viewSizeInfo:h})||t,w=u/r,m=g/s,y=d-n*w,p=f-a*m,x=l.scale*h.devicePixelRatio,S=Object.assign(Object.assign({},t),{x:d,y:f,w:u,h:g,angle:v});fe(e,{x:d,y:f,w:u,h:g,angle:v},(()=>{qe(e,S,{originElem:t,calcElemSize:{x:d,y:f,w:u,h:g,angle:v},viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c,renderContent:()=>{tt(e,S,{viewScaleInfo:l,viewSizeInfo:h,renderContent:()=>{e.save(),e.translate(y,p),e.scale(x*w/l.scale,x*m/l.scale);const t=Be(o.commands||[]),i=new Path2D(t);o.fill&&(e.fillStyle=o.fill,e.fill(i)),o.stroke&&0!==o.strokeWidth&&(e.strokeStyle=o.stroke,e.lineWidth=(o.strokeWidth||1)/h.devicePixelRatio,e.lineCap=o.strokeLineCap||"square",e.stroke(i)),e.translate(-y,-p),e.restore()}})}})}))}(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:r,y:s,w:l,h:h,angle:c}=We({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},{viewScaleInfo:o,viewSizeInfo:n})||t,d=Object.assign(Object.assign({},t),{x:r,y:s,w:l,h:h,angle:c});fe(e,{x:r,y:s,w:l,h:h,angle:c},(()=>{e.globalAlpha=Ke(t)*a,tt(e,d,{viewScaleInfo:o,viewSizeInfo:n,renderContent:()=>{qe(e,d,{originElem:t,calcElemSize:{x:r,y:s,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{const{x:r,y:s,w:l,h:h,radiusList:c}=He(d,{viewScaleInfo:o,viewSizeInfo:n});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(r+c[0],s),e.arcTo(r+l,s,r+l,s+h,c[1]),e.arcTo(r+l,s+h,r,s+h,c[2]),e.arcTo(r,s+h,r,s,c[3]),e.arcTo(r,s,r+l,s,c[0]),e.closePath(),e.fill(),e.clip()),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:r}=i;for(let o=0;o<t.detail.children.length;o++){let s=t.detail.children[o];if(s=Object.assign(Object.assign({},s),{x:n.x+s.x,y:n.y+s.y}),!0===i.forceDrawAll||(null==r?void 0:r.needRender(s)))try{ot(e,s,Object.assign(Object.assign({},i),{parentOpacity:a*Ke(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=a}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const nt={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function at(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:a}=i;for(let t=0;t<n.length;t++){const r=n[t],s=Object.assign(Object.assign({},r),{detail:Object.assign(Object.assign({},nt),null==r?void 0:r.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.needRender(s)))try{ot(e,s,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(e){console.error(e)}}}var rt,st,lt,ht,ct,dt,ft,ut,gt,vt,wt,mt,yt=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))},pt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},xt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const St=["image","svg","html"],bt=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${n}`)?n:E(n):E(`${P()}-${e.uuid}-${P()}-${P()}`)};class It extends _{constructor(){super(),rt.add(this),st.set(this,{}),lt.set(this,{}),ht.set(this,{}),ct.set(this,!1),pt(this,rt,"m",dt).call(this,"image",((e,t)=>yt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield j(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),pt(this,rt,"m",dt).call(this,"html",((e,t)=>yt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield V(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),pt(this,rt,"m",dt).call(this,"svg",((e,t)=>yt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield D(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return pt(this,ct,"f")}destroy(){xt(this,ct,!0,"f"),this.clear(),xt(this,st,null,"f"),xt(this,lt,null,"f"),xt(this,ht,null,"f")}load(e,t){!0!==pt(this,ct,"f")&&(pt(this,rt,"m",mt).call(this,e)||St.includes(e.type)&&pt(this,rt,"m",wt).call(this,e,t))}getContent(e){var t,i;const o=bt(e);return(null===(i=null===(t=pt(this,ht,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return pt(this,ht,"f")}setLoadItemMap(e){xt(this,ht,e,"f")}}st=new WeakMap,lt=new WeakMap,ht=new WeakMap,ct=new WeakMap,rt=new WeakSet,dt=function(e,t){pt(this,st,"f")[e]=t},ft=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},ut=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:pt(this,rt,"m",ft).call(this,e)}},gt=function(e){const t=bt(e.element),i=pt(this,ht,"f")[t];pt(this,ct,"f")||(i?i.startTime<e.startTime&&(pt(this,ht,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(pt(this,ht,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},vt=function(e){var t;const i=bt(e.element),o=null===(t=pt(this,ht,"f"))||void 0===t?void 0:t[i];pt(this,ct,"f")||(o?o.startTime<e.startTime&&(pt(this,ht,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(pt(this,ht,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},wt=function(e,t){const i=pt(this,rt,"m",ut).call(this,e),o=bt(e);if(pt(this,lt,"f")[o])return;pt(this,lt,"f")[o]=i;const n=pt(this,st,"f")[e.type];"function"!=typeof n||pt(this,ct,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{pt(this,ct,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",pt(this,rt,"m",gt).call(this,i))})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,pt(this,rt,"m",vt).call(this,i)})))},mt=function(e){var t;const i=bt(e),o=null===(t=pt(this,lt,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==pt(this,rt,"m",ft).call(this,e))};var At,Mt,zt,Rt,Pt,Tt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Et=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Wt extends _{constructor(e){super(),At.add(this),Mt.set(this,void 0),zt.set(this,new It),Rt.set(this,!1),Tt(this,Mt,e,"f"),Et(this,At,"m",Pt).call(this)}isDestroyed(){return Et(this,Rt,"f")}destroy(){this.clear(),Tt(this,Mt,null,"f"),Et(this,zt,"f").destroy(),Tt(this,zt,null,"f"),Tt(this,Rt,!0,"f")}updateOptions(e){Tt(this,Mt,e,"f")}drawData(e,t){const i=Et(this,zt,"f"),{calculator:o}=Et(this,Mt,"f"),n=Et(this,Mt,"f").viewContext;n.clearRect(0,0,n.canvas.width,n.canvas.height);const a={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height},r=Object.assign({loader:i,calculator:o,parentElementSize:a,elementAssets:e.assets,parentOpacity:1},t);e.layout?function(e,t,i,o){const{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,s=Object.assign({uuid:"layout",type:"group"},t),{x:l,y:h,w:c,h:d}=We(s,{viewScaleInfo:n,viewSizeInfo:a})||s,f=Object.assign(Object.assign({},s),{x:l,y:h,w:c,h:d,angle:0});if(e.globalAlpha=1,tt(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{_e(e,f,{viewScaleInfo:n,viewSizeInfo:a})}}),"hidden"===t.detail.overflow){const{viewScaleInfo:o,viewSizeInfo:n}=i,a=Object.assign({uuid:"layout",type:"group"},t),r=We(a,{viewScaleInfo:o,viewSizeInfo:n})||a,s=Object.assign(Object.assign({},a),r),{x:l,y:h,w:c,h:d,radiusList:f}=He(s,{viewScaleInfo:o,viewSizeInfo:n});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(l+f[0],h),e.arcTo(l+c,h,l+c,h+d,f[1]),e.arcTo(l+c,h+d,l,h+d,f[2]),e.arcTo(l,h+d,l,h,f[3]),e.arcTo(l,h,l+c,h,f[0]),e.closePath(),e.fill(),e.clip()}o(e),"hidden"===t.detail.overflow&&e.restore(),et(e,f,{viewScaleInfo:n,viewSizeInfo:a}),e.globalAlpha=r}(n,e.layout,r,(()=>{at(n,e,r)})):at(n,e,r)}scale(e){const{sharer:t}=Et(this,Mt,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r,width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){Et(this,zt,"f").setLoadItemMap(e)}getLoadItemMap(){return Et(this,zt,"f").getLoadItemMap()}getLoader(){return Et(this,zt,"f")}}Mt=new WeakMap,zt=new WeakMap,Rt=new WeakMap,At=new WeakSet,Pt=function(){const e=Et(this,zt,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};var Ct,Lt,kt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Ot=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class jt{constructor(e){Ct.set(this,void 0),Lt.set(this,void 0),kt(this,Ct,e,"f"),kt(this,Lt,new se({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}),"f")}toGridNum(e,t){return!0===(null==t?void 0:t.ignore)?e:Math.round(e)}destroy(){kt(this,Ct,null,"f")}needRender(e){const t=Ot(this,Lt,"f").get("viewVisibleInfoMap")[e.uuid];return!t||t.isVisibleInView}isPointInElement(e,t,i,o){return ke(e,{context2d:Ot(this,Ct,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=Ot(this,Ct,"f").viewContext;return function(e,t){var i,o,n;const{context2d:a,data:r,viewScaleInfo:s,viewSizeInfo:l,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,r=0,d=0;for(let e=0;e<=t;e++)n+=h[e].x,r+=h[e].y,d+=h[e].angle||0;const f=h[t];if(f&&"group"===f.type&&Array.isArray(null===(i=f.detail)||void 0===i?void 0:i.children))for(let i=0;i<f.detail.children.length;i++){const u=f.detail.children[i];if(!0!==(null===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(ke(e,{context2d:a,element:{x:n+u.x,y:r+u.y,w:u.w,h:u.h,angle:d+(u.angle||0)},viewScaleInfo:s,viewSizeInfo:l})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=r.elements.length-1;t>=0;t--){const i=r.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&ke(e,{context2d:a,element:i,viewScaleInfo:s,viewSizeInfo:l})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}resetViewVisibleInfoMap(e,t){if(e){const{viewVisibleInfoMap:i,invisibleCount:o,visibleCount:n}=function(e,t){const i={},o=[],n=t=>{const a={isVisibleInView:!0,isGroup:"group"===t.type,position:[...o]};let r=null;r=je(t,{groupQueue:Ae(e,o)||[]}),i[t.uuid]=Object.assign(Object.assign({},a),{originRectInfo:r,rangeRectInfo:N.angle(t.angle)?De(r):r}),"group"===t.type&&t.detail.children.forEach(((e,t)=>{o.push(t),n(e),o.pop()}))};return e.forEach(((e,t)=>{o.push(t),n(e),o.pop()})),Ve(i,t)}(e.elements,t);Ot(this,Lt,"f").set("viewVisibleInfoMap",i),Ot(this,Lt,"f").set("invisibleCount",o),Ot(this,Lt,"f").set("visibleCount",n)}}updateVisiableStatus(e){const{viewVisibleInfoMap:t,invisibleCount:i,visibleCount:o}=Ve(Ot(this,Lt,"f").get("viewVisibleInfoMap"),e);Ot(this,Lt,"f").set("viewVisibleInfoMap",t),Ot(this,Lt,"f").set("invisibleCount",i),Ot(this,Lt,"f").set("visibleCount",o)}calcViewRectInfoFromOrigin(e,t){const i=Ot(this,Lt,"f").get("viewVisibleInfoMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:a}=t,{center:r,left:s,right:l,bottom:h,top:c,topLeft:d,topRight:f,bottomLeft:u,bottomRight:g}=i.originRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n,viewSizeInfo:a};return{center:Ce(r,v),left:Ce(s,v),right:Ce(l,v),bottom:Ce(h,v),top:Ce(c,v),topLeft:Ce(d,v),topRight:Ce(f,v),bottomLeft:Ce(u,v),bottomRight:Ce(g,v)}}calcViewRectInfoFromRange(e,t){const i=Ot(this,Lt,"f").get("viewVisibleInfoMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:a}=t,{center:r,left:s,right:l,bottom:h,top:c,topLeft:d,topRight:f,bottomLeft:u,bottomRight:g}=i.rangeRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n,viewSizeInfo:a};return{center:Ce(r,v),left:Ce(s,v),right:Ce(l,v),bottom:Ce(h,v),top:Ce(c,v),topLeft:Ce(d,v),topRight:Ce(f,v),bottomLeft:Ce(u,v),bottomRight:Ce(g,v)}}modifyViewVisibleInfoMap(e,t){const{modifyOptions:i,viewScaleInfo:o,viewSizeInfo:n}=t,{type:a,content:r}=i,s=e.elements,l=Ot(this,Lt,"f").get("viewVisibleInfoMap");if("deleteElement"===a){const{element:e}=r;delete l[e.uuid]}else if("addElement"===a||"updateElement"===a){const{position:t}=r,i=Me(t,e.elements),h=Ae(s,t);if(i){const e=je(i,{groupQueue:h||[]}),r={originRectInfo:e,rangeRectInfo:N.angle(i.angle)?De(e):e,isVisibleInView:!0,isGroup:"group"===(null==i?void 0:i.type),position:[...t]};l[i.uuid]=r,"updateElement"===a&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:n})}}else"moveElement"===a&&this.resetViewVisibleInfoMap(e,{viewScaleInfo:o,viewSizeInfo:n});Ot(this,Lt,"f").set("viewVisibleInfoMap",l)}}Ct=new WeakMap,Lt=new WeakMap;var Dt,Vt,Yt,Gt,Ft,Bt,Nt,Xt,Ht,Zt,Qt,Ut,Jt,$t,Kt,qt,_t=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ei=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};function ti(e){return e>0||e<0||0===e}class ii extends _{constructor(e){super(),Dt.add(this),Vt.set(this,void 0),Yt.set(this,void 0),Gt.set(this,!1),Bt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;const t=ei(this,Dt,"m",Kt).call(this,e);if(!ei(this,Dt,"m",qt).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),Nt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)})),Xt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);if(!ei(this,Dt,"m",qt).call(this,t))return;const i=Date.now(),o=ei(this,Yt,"f").get("prevClickPoint");o&&i-o.t<=500&&Math.abs(o.x-t.x)<=5&&Math.abs(o.y-t.y)<=5?this.trigger("doubleClick",{point:t}):ei(this,Yt,"f").set("prevClickPoint",t)})),Ht.set(this,(e=>{if(ei(this,Yt,"f").set("hasPointDown",!1),!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);this.trigger("pointLeave",{point:t})})),Zt.set(this,(e=>{if(ei(this,Yt,"f").set("hasPointDown",!1),!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);this.trigger("pointEnd",{point:t})})),Qt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)?!0===ei(this,Yt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):ei(this,Yt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),ei(this,Yt,"f").set("hasPointDown",!1))})),Ut.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)&&(ei(this,Yt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),Jt.set(this,(e=>{if(!ei(this,Dt,"m",$t).call(this,e))return;e.preventDefault();const t=ei(this,Dt,"m",Kt).call(this,e);ei(this,Dt,"m",qt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new se({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});_t(this,Yt,t,"f"),_t(this,Vt,e,"f"),ei(this,Dt,"m",Ft).call(this)}onEvents(){if(ei(this,Gt,"f"))return;const e=window;e.addEventListener("mousemove",ei(this,Jt,"f")),e.addEventListener("mousedown",ei(this,Ut,"f")),e.addEventListener("mousemove",ei(this,Qt,"f")),e.addEventListener("mouseup",ei(this,Zt,"f")),e.addEventListener("mouseleave",ei(this,Ht,"f")),e.addEventListener("wheel",ei(this,Bt,"f"),{passive:!1}),e.addEventListener("click",ei(this,Xt,"f")),e.addEventListener("contextmenu",ei(this,Nt,"f"))}offEvents(){const e=window;e.removeEventListener("mousemove",ei(this,Jt,"f")),e.removeEventListener("mousedown",ei(this,Ut,"f")),e.removeEventListener("mousemove",ei(this,Qt,"f")),e.removeEventListener("mouseup",ei(this,Zt,"f")),e.removeEventListener("mouseleave",ei(this,Ht,"f")),e.removeEventListener("wheel",ei(this,Bt,"f")),e.removeEventListener("click",ei(this,Xt,"f")),e.removeEventListener("contextmenu",ei(this,Nt,"f"))}destroy(){this.offEvents(),ei(this,Yt,"f").destroy(),_t(this,Gt,!0,"f")}}Vt=new WeakMap,Yt=new WeakMap,Gt=new WeakMap,Bt=new WeakMap,Nt=new WeakMap,Xt=new WeakMap,Ht=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Ut=new WeakMap,Jt=new WeakMap,Dt=new WeakSet,Ft=function(){this.onEvents()},$t=function(e){return e.target===ei(this,Vt,"f").boardContent.boardContext.canvas},Kt=function(e){const t=ei(this,Vt,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},qt=function(e){const t=ei(this,Vt,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(ti(e.x)&&ti(e.y)&&e.x<=i&&e.y<=o)};var oi,ni,ai=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ri=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const si={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class li{constructor(){oi.set(this,void 0),ni.set(this,void 0);const e=new se({defaultStorage:si}),t=new se({defaultStorage:{}});ai(this,oi,e,"f"),ai(this,ni,t,"f")}getActiveStorage(e){return ri(this,oi,"f").get(e)}setActiveStorage(e,t){return ri(this,oi,"f").set(e,t)}getActiveStoreSnapshot(e){return ri(this,oi,"f").getSnapshot(e)}getSharedStorage(e){return ri(this,ni,"f").get(e)}setSharedStorage(e,t){return ri(this,ni,"f").set(e,t)}getSharedStoreSnapshot(e){return ri(this,ni,"f").getSnapshot(e)}getActiveViewScaleInfo(){return{scale:ri(this,oi,"f").get("scale"),offsetTop:ri(this,oi,"f").get("offsetTop"),offsetBottom:ri(this,oi,"f").get("offsetBottom"),offsetLeft:ri(this,oi,"f").get("offsetLeft"),offsetRight:ri(this,oi,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;ri(this,oi,"f").set("scale",t),ri(this,oi,"f").set("offsetTop",i),ri(this,oi,"f").set("offsetBottom",o),ri(this,oi,"f").set("offsetLeft",n),ri(this,oi,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){ri(this,oi,"f").set("width",e.width),ri(this,oi,"f").set("height",e.height),ri(this,oi,"f").set("devicePixelRatio",e.devicePixelRatio),ri(this,oi,"f").set("contextWidth",e.contextWidth),ri(this,oi,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:ri(this,oi,"f").get("width"),height:ri(this,oi,"f").get("height"),devicePixelRatio:ri(this,oi,"f").get("devicePixelRatio"),contextWidth:ri(this,oi,"f").get("contextWidth"),contextHeight:ri(this,oi,"f").get("contextHeight")}}}oi=new WeakMap,ni=new WeakMap;var hi,ci,di,fi,ui,gi,vi=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},wi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const{requestAnimationFrame:mi}=window;class yi extends _{constructor(e){super(),hi.add(this),ci.set(this,void 0),di.set(this,[]),fi.set(this,"FREE"),vi(this,ci,e,"f"),wi(this,hi,"m",ui).call(this)}resetViewVisibleInfoMap(e,t){e&&wi(this,ci,"f").calculator.resetViewVisibleInfoMap(e,t)}drawFrame(){const{sharer:e}=wi(this,ci,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();wi(this,di,"f").push({activeStore:t,sharedStore:i}),wi(this,hi,"m",gi).call(this)}scale(e){const{scale:t,point:i,ignoreUpdateVisibleStatus:o}=e,{sharer:n}=wi(this,ci,"f"),{moveX:a,moveY:r}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:a}=o,r=t/o.scale,s=i.x,l=i.y;return{moveX:s-s*r+(n*r-n),moveY:l-l*r+(a*r-a)}}({scale:t,point:i,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()});return n.setActiveStorage("scale",t),o||wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),{moveX:a,moveY:r}}scroll(e){const{sharer:t}=wi(this,ci,"f"),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n,ignoreUpdateVisibleStatus:a}=e,r=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:a}=o,{width:r,height:s,contextWidth:l,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,f=o.offsetTop,u=o.offsetBottom;return c+=t,f+=i,d=r-(l*a+c),u=s-(h*a+f),{scale:a,offsetTop:f,offsetLeft:c,offsetRight:d,offsetBottom:u}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(r),a||wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),r}updateViewScaleInfo(e){const{sharer:t}=wi(this,ci,"f"),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:a}=t,{width:r,height:s,contextWidth:l,contextHeight:h}=a,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:r-(l*i+c/i),offsetBottom:s-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),i}resize(e={},t){const{sharer:i}=wi(this,ci,"f"),o=i.getActiveViewSizeInfo(),n=Object.assign(Object.assign({},o),e),{width:a,height:r,devicePixelRatio:s}=n,{underContext:l,boardContext:h,helperContext:c,viewContext:d}=wi(this,ci,"f").boardContent;return h.canvas.width=a*s,h.canvas.height=r*s,h.canvas.style.width=`${a}px`,h.canvas.style.height=`${r}px`,l.canvas.width=a*s,l.canvas.height=r*s,c.canvas.width=a*s,c.canvas.height=r*s,d.canvas.width=a*s,d.canvas.height=r*s,i.setActiveViewSizeInfo(n),(null==t?void 0:t.ignoreUpdateVisibleStatus)||wi(this,ci,"f").calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}ci=new WeakMap,di=new WeakMap,fi=new WeakMap,hi=new WeakSet,ui=function(){const{renderer:e}=wi(this,ci,"f");e.on("load",(()=>{this.drawFrame()}))},gi=function e(){if("DRAWING"===wi(this,fi,"f")||0===wi(this,di,"f").length)return;vi(this,fi,"DRAWING","f");const t=wi(this,di,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=wi(this,ci,"f");if(t){const{scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h,width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g}=t.activeStore,v={scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h},w={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:w}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==wi(this,di,"f").length?vi(this,fi,"DRAWING","f")&&mi((()=>{wi(this,hi,"m",e).call(this)})):vi(this,fi,"COMPLETE","f")};var pi,xi,Si,bi,Ii,Ai,Mi,zi,Ri,Pi,Ti,Ei,Wi,Ci,Li,ki,Oi,ji,Di,Vi,Yi,Gi,Fi,Bi,Ni,Xi,Hi,Zi=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Qi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Ui{constructor(e){pi.add(this),xi.set(this,void 0),Si.set(this,new WeakMap),bi.set(this,[]),Ii.set(this,[]),Ai.set(this,void 0),Mi.set(this,void 0),zi.set(this,void 0),Ri.set(this,void 0),Pi.set(this,void 0),Ti.set(this,new _),Ei.set(this,!1);const{boardContent:t}=e,i=new li,o=new jt({viewContext:t.viewContext}),n=new ii({boardContent:t,sharer:i}),a=new Wt({viewContext:t.viewContext,sharer:i,calculator:o});Zi(this,xi,e,"f"),Zi(this,zi,i,"f"),Zi(this,Ai,n,"f"),Zi(this,Mi,a,"f"),Zi(this,Pi,o,"f"),Zi(this,Ri,new yi({boardContent:e.boardContent,sharer:i,renderer:a,calculator:Qi(this,Pi,"f"),beforeDrawFrame:e=>{Qi(this,pi,"m",Ni).call(this,e)},afterDrawFrame:e=>{Qi(this,pi,"m",Xi).call(this,e)}}),"f"),Qi(this,pi,"m",Wi).call(this),Qi(this,pi,"m",Hi).call(this)}isDestroyed(){return Qi(this,Ei,"f")}destroy(){Qi(this,Ai,"f").destroy(),Qi(this,Mi,"f").destroy(),Qi(this,Pi,"f").destroy(),Qi(this,Ti,"f").destroy(),Zi(this,Ei,!0,"f")}getSharer(){return Qi(this,zi,"f")}getViewer(){return Qi(this,Ri,"f")}getRenderer(){return Qi(this,Mi,"f")}setData(e,t){const{modifiedOptions:i}=t||{},o=Qi(this,zi,"f");Qi(this,zi,"f").setActiveStorage("data",e);const n=o.getActiveViewSizeInfo(),a=o.getActiveViewScaleInfo(),r=Ie(e.elements,{viewWidth:n.width,viewHeight:n.height,extend:!0});Qi(this,Ri,"f").resetViewVisibleInfoMap(e,{viewSizeInfo:n,viewScaleInfo:a}),Qi(this,Ri,"f").drawFrame();const s=Object.assign(Object.assign({},n),r);return Qi(this,zi,"f").setActiveViewSizeInfo(s),{viewSizeInfo:s}}getData(){const{data:e}=Qi(this,zi,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(Qi(this,Si,"f").has(e)){const o=Qi(this,Si,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",Qi(this,Si,"f").set(e,o),void Qi(this,pi,"m",Hi).call(this)}const{boardContent:n,container:a}=Qi(this,xi,"f"),r=e({boardContent:n,sharer:Qi(this,zi,"f"),viewer:Qi(this,Ri,"f"),calculator:Qi(this,Pi,"f"),eventHub:Qi(this,Ti,"f"),container:a});null===(o=r.use)||void 0===o||o.call(r),Qi(this,bi,"f").push(e),Qi(this,Ii,"f").push(r),Qi(this,Si,"f").set(e,{status:"enable",middlewareObject:r}),Qi(this,pi,"m",Hi).call(this)}disuse(e){var t,i;const o=Qi(this,Si,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",Qi(this,Si,"f").set(e,o),Qi(this,pi,"m",Hi).call(this))}scale(e){const t=Qi(this,Ri,"f"),{ignoreUpdateVisibleStatus:i}=e,{moveX:o,moveY:n}=t.scale(Object.assign(Object.assign({},e),{ignoreUpdateVisibleStatus:!0}));t.scroll({moveX:o,moveY:n,ignoreUpdateVisibleStatus:i})}scroll(e){return Qi(this,Ri,"f").scroll(e)}updateViewScaleInfo(e){return Qi(this,Ri,"f").updateViewScaleInfo(e)}resize(e,t){const i=Qi(this,Ri,"f").resize(e,t),{width:o,height:n,devicePixelRatio:a}=e,{boardContent:r}=Qi(this,xi,"f");r.viewContext.$resize({width:o,height:n,devicePixelRatio:a}),r.helperContext.$resize({width:o,height:n,devicePixelRatio:a}),r.boardContext.$resize({width:o,height:n,devicePixelRatio:a}),r.underContext.$resize({width:o,height:n,devicePixelRatio:a}),Qi(this,Ri,"f").drawFrame(),Qi(this,Ai,"f").trigger("resize",i),Qi(this,zi,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=Qi(this,xi,"f"),{underContext:t,helperContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),Qi(this,pi,"m",Bi).call(this)}getEventHub(){return Qi(this,Ti,"f")}onWatcherEvents(){Qi(this,Ai,"f").onEvents()}offWatcherEvents(){Qi(this,Ai,"f").offEvents()}}xi=new WeakMap,Si=new WeakMap,bi=new WeakMap,Ii=new WeakMap,Ai=new WeakMap,Mi=new WeakMap,zi=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Ti=new WeakMap,Ei=new WeakMap,pi=new WeakSet,Wi=function(){Qi(this,Ai,"f").on("pointStart",Qi(this,pi,"m",Ci).bind(this)),Qi(this,Ai,"f").on("pointEnd",Qi(this,pi,"m",Li).bind(this)),Qi(this,Ai,"f").on("pointMove",Qi(this,pi,"m",ki).bind(this)),Qi(this,Ai,"f").on("hover",Qi(this,pi,"m",Oi).bind(this)),Qi(this,Ai,"f").on("wheel",Qi(this,pi,"m",Di).bind(this)),Qi(this,Ai,"f").on("wheelScale",Qi(this,pi,"m",Vi).bind(this)),Qi(this,Ai,"f").on("scrollX",Qi(this,pi,"m",Yi).bind(this)),Qi(this,Ai,"f").on("scrollY",Qi(this,pi,"m",Gi).bind(this)),Qi(this,Ai,"f").on("resize",Qi(this,pi,"m",Fi).bind(this)),Qi(this,Ai,"f").on("doubleClick",Qi(this,pi,"m",ji).bind(this)),Qi(this,Mi,"f").on("load",(()=>{Qi(this,Ti,"f").trigger("loadResource")}))},Ci=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},Li=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},ki=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},Oi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},ji=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},Di=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},Vi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},Yi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},Gi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},Fi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},Bi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},Ni=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Xi=function(e){var t;for(let i=0;i<Qi(this,Ii,"f").length;i++){const o=Qi(this,Ii,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Hi=function(){const e=[],t=Qi(this,Si,"f");Qi(this,bi,"f").forEach((i=>{const o=t.get(i);"enable"===(null==o?void 0:o.status)&&(null==o?void 0:o.middlewareObject)&&e.push(o.middlewareObject)})),Zi(this,Ii,e,"f")};const Ji="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29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r47IiJLS0s3L126dBZ4Sh2LZUBRwVdwYGBgVuwOYh/zsoF0bnPBVzDTMRgOh6dFhROokSIi8/Pz0+pEeaPQx+DGWdzV1XVSX2LcgCIic3NzMzU1NV8D7wIvq9WrLNRZvOk62NHRccqJTAdGo9Hb1dXV3wAfYt9VjgAPFfI66EQWAxU9PT0fuwEvXrzYBJwF3gFeAAJAhfrfrO4k/7lxZxnr2JlJqry8POnWyePx6H4JR0vhktVkHGOXQI20SkpKLLcOhmGsA5YCaZiVLS5XoADi9XpdkznDMERhnE0fCgUHZhvOW+CO4/8A5hR7wFxjD5hr7AFzjZyBlmVlrOYdYaS1HUUuQA/gWV9fd51URDyqn1c1j6MVFGjoidfW1oq2ABrYj0V82OmVzwHNajVdB88C5wOKTdM87NaxsrKyQsFKHC2BnTDo+/TWt8Bd5INeVC44NDT0xXYZdXNz8w/AaeyS8yjwCPdzQu92ht2m/OUjIyOfS1pkAoqItLS0fA+8D7wKPA0cxs6qC1O4T0xMfKYnb21tnXEDNjc3z+nXbW1t3wFvYz9dCAL7KUThHovFPtGTNjU1jQFSX18/lg68cuXKLUAaGxs3vkB7e/u3wHHgCQpUdnpTqdQvesJgMDisUVevXh3Xry9fvnxTv66qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class $i{constructor(e,d){I(this,r),I(this,l),I(this,c),I(this,f),I(this,g),I(this,t,void 0),I(this,i,void 0),I(this,o,null),I(this,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kmZKWiipSdKvJN2VpI6ODhUVFWUt7Js2bdLAwMBYLdAt6VNJlyV9IumLsRkOHjyo2tparVixQrdvp2Xmn00YrJI0R05VBRV+GjAiqcoUxA8lnfI1HD16dJz6WLVqla5fvz4tFdPZ2anm5uas8s3Nzf7zp5J+LmmNpFcl5U8GmCupWFKtpO9K+qWkG76W3bt3j4OMRqNqaWnRhQsXNDQ0lAWVTCZ169YtHThwQFVVVePKtrS0+Kw3pgsYso+Vkuol7ZD0W0ldvsHW1tZJZXxtba0aGxvV1NSkdevWaenSpYpGoxPmXb9+vXp6ejzgx5J+ZiGeLSk8GaD34ky5Hd23JP1I0h8kPQmGu7y8/L/aNEUiEe3fv1/Dw8Pp6Es6KqlZ0puSXpHbVU4KiPVglqQFkr4j6aeSfi/pvq/13r172rVrlyorK6cFFo1GtXnzZl25ciU4Ch5J+qOkH0v6tqTXzDk5EwGGlNFjOWQOd8px4vUN4E3cpn2pz/jgwQPef/99Ll68yJ07d+jt7WVwcJBIJEJJSQlz586loaGBTZs2UVdXF5w0OoDLwFWcbPsct6r04+bRLHEYCoWyAD1kBDfHleHmsxrccccS3NFHNV/eenBy6iZwCycMOnHz5wBuDh2nyyY6H0zhFmoF7vtxk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),A(this,i,e),A(this,t,d.eventHub),M(this,r,s).call(this),M(this,l,h).call(this)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakSet,s=function(){const e=b(this,t);M(this,c,d).call(this,"default"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?M(this,c,d).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?M(this,f,u).call(this,e):"drag-default"===e.type?M(this,c,d).call(this,"drag-default"):"drag-active"===e.type?M(this,c,d).call(this,"drag-active"):M(this,c,d).call(this,"auto"):M(this,c,d).call(this,"auto")}))},l=new WeakSet,h=function(){j(Ji).then((e=>{A(this,n,e)})).catch((e=>{console.error(e)}))},c=new WeakSet,d=function(e){if(b(this,o)===e)return;A(this,o,e);const t=b(this,a)[b(this,o)]||b(this,a).auto;let n=0,r=0;(e.startsWith("rotate-")&&b(this,a)[b(this,o)]||"rotate"===e)&&(n=10,r=10),b(this,i).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${n} ${r}, auto`},f=new WeakSet,u=function(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=Se((null==(t=null==e?void 0:e.element)?void 0:t.angle)||0),Array.isArray(e.groupQueue)&&e.groupQueue.length>0&&e.groupQueue.forEach((e=>{i+=Se(e.angle||0)})),i=Se(i);const o=M(this,g,v).call(this,i);M(this,c,d).call(this,o)},g=new WeakSet,v=function(e){const t=`rotate-${e}`;if(!b(this,a)[t]){const i=b(this,n);if(i){const o=document.createElement("canvas"),n=i.width,r=i.height,s={x:n/2,y:r/2};o.width=n,o.height=r;const l=o.getContext("2d"),h=ce(e);l.translate(s.x,s.y),l.rotate(h),l.translate(-s.x,-s.y),l.drawImage(i,0,0,n,r),l.translate(s.x,s.y),l.rotate(-h),l.translate(-s.x,-s.y);const c=o.toDataURL("image/png");b(this,a)[t]=c}}return t};const Ki="change",qi="SELECT",_i=Symbol(`${qi}_actionType`),eo=Symbol(`${qi}_resizeType`),to=Symbol(`${qi}_areaStart`),io=Symbol(`${qi}_areaEnd`),oo=Symbol(`${qi}_hoverElement`),no=Symbol(`${qi}_hoverElementVertexes`),ao=Symbol(`${qi}_selectedElementList`),ro=Symbol(`${qi}_selectedElementListVertexes`),so=Symbol(`${qi}_selectedElementController`),lo=Symbol(`${qi}_selectedElementPosition`),ho=Symbol(`${qi}_selectedReferenceXLines`),co=Symbol(`${qi}_selectedReferenceYLines`),fo=Symbol(`${qi}_groupQueue`),uo=Symbol(`${qi}_groupQueueVertexesList`),go=Symbol(`${qi}_isMoving`),vo=Symbol(`${qi}_canSelectInGroup`),wo="#1973ba",mo="#5b5959b5",yo="@middleware/select",po="@middleware/select-clear",xo="@middleware/select-in-group";function So(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill()}function bo(e,t,i,o){const{borderColor:n,borderWidth:a,lineDash:r}=o;e.setLineDash([]),e.lineWidth=a,e.strokeStyle=n,e.setLineDash(r),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}function Io(e,t,i){const{borderColor:o,borderWidth:n,lineDash:a}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.setLineDash(a),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function Ao(e,t,i){const{size:o,borderColor:n,borderWidth:a,lineDash:r}=i,s=t.x-o/2,l=t.x+o/2,h=t.y-o/2,c=t.y+o/2;Io(e,[{x:s,y:h},{x:l,y:h},{x:l,y:c},{x:s,y:c}],{borderColor:n,borderWidth:a,lineDash:r})}function Mo(e,t,i){if(!t)return;const o={borderColor:wo,borderWidth:1,background:"transparent",lineDash:[]};So(e,Le(t,i),o)}function zo(e,t,i){if(!t)return;const o={borderColor:mo,borderWidth:1,background:"transparent",lineDash:[]};So(e,Le(t,i),o);const{controller:n}=i;if(n){const{topLeft:t,topRight:a,bottomLeft:r,bottomRight:s,topMiddle:l,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=n,f={...o,borderWidth:1,background:mo};Io(e,Le(l.vertexes,i),f),Io(e,Le(h.vertexes,i),f),Io(e,Le(c.vertexes,i),f),Io(e,Le(d.vertexes,i),f),Io(e,Le(t.vertexes,i),f),Io(e,Le(a.vertexes,i),f),Io(e,Le(r.vertexes,i),f),Io(e,Le(s.vertexes,i),f)}}function Ro(e,t,i){if(!t)return;const{hideControllers:o}=i,{elementWrapper:n,topLeft:a,topRight:r,bottomLeft:s,bottomRight:l,top:h,rotate:c}=t,d={borderColor:wo,borderWidth:2,background:"transparent",lineDash:[]},f={...d,borderWidth:4,background:"#FFFFFF"};So(e,Le(n,i),d),o||(bo(e,Ce(h.center,i),Ce(c.center,i),{...f,borderWidth:2}),So(e,Le(a.vertexes,i),f),So(e,Le(r.vertexes,i),f),So(e,Le(s.vertexes,i),f),So(e,Le(l.vertexes,i),f),function(e,t,i){const{size:o,borderColor:n,borderWidth:a,background:r}=i,s=t,l=o/2,h=l,c=l;if(h>=0&&c>=0){if("number"==typeof a&&a>0){const t=a/2+h,i=a/2+c;e.beginPath(),e.strokeStyle=n,e.lineWidth=a,e.circle(s.x,s.y,t,i,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath(),e.fillStyle=r,e.circle(s.x,s.y,h,c,0,0,2*Math.PI),e.closePath(),e.fill()}}(e,Ce(c.center,i),{...f,size:10,borderWidth:2}))}function Po(e,t){const{xLines:i,yLines:o}=t,n={borderColor:"#f7276e",borderWidth:1,lineDash:[]},a={...n,size:6};i&&i.forEach((t=>{t.forEach(((i,o)=>{Ao(e,i,a),t[o+1]&&bo(e,t[o],t[o+1],n)}))})),o&&o.forEach((t=>{t.forEach(((i,o)=>{Ao(e,i,a),t[o+1]&&bo(e,t[o],t[o+1],n)}))}))}function To(e){return e*Math.PI/180}function Eo(e,t){return Math.sqrt(e*e+t*t)}function Wo(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function Co(e,t){const{ctx:i,viewScaleInfo:o,vertexes:n}=t,a=Ce(n[0],{viewScaleInfo:o}),r=Ce(n[1],{viewScaleInfo:o}),s=Ce(n[2],{viewScaleInfo:o}),l=Ce(n[3],{viewScaleInfo:o});return i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(r.x,r.y),i.lineTo(s.x,s.y),i.lineTo(l.x,l.y),i.lineTo(a.x,a.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function Lo(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:a}=t;if(!(a&&(null==a?void 0:a.length)>0))return!1;const r=Te(a),s=r[r.length-1];return!!s&&Co(e,{ctx:i,vertexes:s,viewScaleInfo:o,viewSizeInfo:n})}function ko(e,t){var i,o,n;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:r,data:s,calculator:l,selectedElements:h,viewScaleInfo:c,viewSizeInfo:d,areaSize:f,groupQueue:u,selectedElementController:g}=t;if(g){const{left:t,right:i,top:o,bottom:n,topLeft:s,topRight:l,bottomLeft:f,bottomRight:v,rotate:w}=g,m=[t,i,o,n,s,l,f,v,w];for(let t=0;t<m.length;t++){const i=m[t];if(Co(e,{ctx:r,vertexes:i.vertexes,viewSizeInfo:d,viewScaleInfo:c})){a.type=`resize-${i.type}`,h&&(null==h?void 0:h.length)>0&&(a.groupQueue=u||[],a.elements=[h[0]]);break}}}if(u&&Array.isArray(u)&&u.length>0){const t=u[u.length-1];if((null==(i=null==t?void 0:t.detail)?void 0:i.children)&&Array.isArray(null==(o=null==t?void 0:t.detail)?void 0:o.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=Ee(o,{groupQueue:u});if(n&&Co(e,{ctx:r,vertexes:n,viewScaleInfo:c,viewSizeInfo:d}))return a.type||(a.type="over-element"),a.groupQueue=u,a.elements=[o],a}return a}if(null!==a.type)return a;if(f&&Array.isArray(h)&&(null==h?void 0:h.length)>1){const{x:t,y:i,w:o,h:n}=f;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=h,a}if(s){const{index:t,element:i}=l.getPointElement(e,{data:s,viewScaleInfo:c,viewSizeInfo:d});if(t>=0&&i&&!0!==(null==(n=null==i?void 0:i.operations)?void 0:n.invisible))return a.elements=[i],a.type="over-element",a}return a}function Oo(e,t){const{x:i,y:o,w:n,h:a,angle:r=0}=e,{center:s,start:l,end:h,viewScaleInfo:c}=t,d=Ce(s,{viewScaleInfo:c}),f=Se(r),u=function(e,t,i){const o=ve(e,t),n=ve(e,i);return null!==n&&null!==o?o>3*Math.PI/2&&n<Math.PI/2?n+(2*Math.PI-o):n>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-n):n-o:0}(d,l,h);return{x:i,y:o,w:n,h:a,angle:f+u/Math.PI*180}}function jo(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{viewScaleInfo:n,viewSizeInfo:a}=t;let r=null;for(let t=0;t<e.length;t++){const s=e[t];if(null==(i=null==s?void 0:s.operations)?void 0:i.invisible)continue;const l=We(s,{viewScaleInfo:n,viewSizeInfo:a});if(l.angle&&(l.angle>0||l.angle<0)){const e=pe(l);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];l.x=Math.min(...t),l.y=Math.min(...i),l.w=Math.abs(Math.max(...t)-Math.min(...t)),l.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(r){const e=Math.min(l.x,o.x),t=Math.min(l.y,o.y),i=Math.max(l.x+l.w,o.x+o.w),n=Math.max(l.y+l.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=l.x,o.y=l.y,o.w=l.w,o.h=l.h;r=l}return o}function Do(e){return{minX:e.topLeft.x,minY:e.topLeft.y,maxX:e.bottomRight.x,maxY:e.bottomRight.y,midX:e.center.x,midY:e.center.y}}const Vo=(e,t)=>{if(0===e.length)throw null;if(1===e.length)return e[0];let i=0,o=e.length-1;for(;i<=o;){const n=Math.floor((i+o)/2);if(e[n]===t)return e[n];e[n]<t?i=n+1:o=n-1}return i>=e.length?e[o]:o<0?e[i]:Math.abs(e[o]-t)<=Math.abs(e[i]-t)?e[o]:e[i]},Yo=(e,t)=>Math.abs(e-t)<1e-5;const Go="@middleware/text-edit",Fo="@middleware/text-change",Bo={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"},No="SCROLL",Xo=Symbol(`${No}_xThumbRect`),Ho=Symbol(`${No}_yThumbRect`),Zo=Symbol(`${No}_prevPoint`),Qo=Symbol(`${No}_activePoint`),Uo=Symbol(`${No}_activeThumbType`),Jo=16,$o=.3,Ko={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function qo(e,t,i){const o=e,{x:n,y:a,w:r,h:s}=i;return o.beginPath(),o.rect(n,a,r,s),o.closePath(),!!o.isPointInPath(t.x,t.y)}function _o(e,t){let{x:i,y:o,h:n,w:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{color:r,axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+a/4+0,a/=2);let l=t.r;l=Math.min(l,a/2,n/2),(a<2*l||n<2*l)&&(l=0),e.globalAlpha=$o,e.beginPath(),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.fillStyle=r,e.fill(),e.globalAlpha=1,e.beginPath(),e.lineWidth=1,e.strokeStyle=r,e.setLineDash([]),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.stroke()}e.restore()}function en(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:a}=t,{activeThumbType:r,prevPoint:s,activePoint:l}=a,h=function(e,t){const{width:i,height:o}=t,{offsetTop:n,offsetBottom:a,offsetLeft:r,offsetRight:s}=e,l=2.5*Jo,h=Jo;let c=0,d=0;c=Math.max(l,i-2*h-(Math.abs(r)+Math.abs(s))),c>=i&&(c=i),d=Math.max(l,o-2*h-(Math.abs(n)+Math.abs(a))),d>=o&&(d=o);const f=h;let u=f;r>0?u=f:s>0?u=i-c-h:r<=0&&c>0&&(0!==r||0!==s)&&(u=f+(i-c)*Math.abs(r)/(Math.abs(r)+Math.abs(s)),u=Math.min(Math.max(0,u-f),i-c));const g=h;let v=g;n>0?v=g:a>0?v=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(v=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),v=Math.min(Math.max(0,v-g),o-d));const w={x:u,y:o-h,w:c,h:h},m={x:i-h,y:v,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:v,translateX:u,thumbColor:Ko.thumbColor,scrollBarColor:Ko.scrollBarColor,xThumbRect:w,yThumbRect:m}}(o,n);let c={...h.xThumbRect},d={...h.yThumbRect};return r&&s&&l&&("X"===r&&a.xThumbRect?(c={...a.xThumbRect},c.x=c.x+(l.x-s.x)):"Y"===r&&a.yThumbRect&&(d={...a.yThumbRect},d.y=d.y+(l.y-s.y))),_o(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),_o(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function tn(e,t){const{snapshot:i}=t,o=he(i),n=le(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Qo]||null,prevPoint:t[Zo]||null,activeThumbType:t[Uo]||null,xThumbRect:t[Xo]||null,yThumbRect:t[Ho]||null}}(i),{xThumbRect:r,yThumbRect:s}=en(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:r,yThumbRect:s}}const on="@middleware/scale",nn=16,an="#000000",rn="#00000080",sn="monospace",ln="#AAAAAA20",hn="#AAAAAA40",cn="#196097";function dn(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=Ne(a/t,{decimalPlaces:0}),a=Math.max(10,Math.min(a,1e3));const r=10*a,s=5*a;let l=0;const h=a*t,c=0-o,d=c%h,f=(c-d+h)/t,u=h-d+0;for(;u+l*h<i;){const e=Ne(f+l*a,{decimalPlaces:0}),t={num:e,position:Ne(u+l*h,{decimalPlaces:0}),showNum:e%r==0,isKeyNum:e%r==0,isSubKeyNum:e%s==0};n.push(t),l++}return n}const fn="@middleware/show-ruler",un=Symbol("DRAG_prevPoint"),gn="monospace";const vn="#1973bac6",wn="#ffffff",mn=10,yn="LAYOUT_SELECT",pn=Symbol(`${yn}_layoutActionType`),xn=Symbol(`${yn}_layoutControlType`),Sn=Symbol(`${yn}_layoutController`),bn="#1973ba",In="#5b5959b5";function An(e,t){e.setLineDash([]),e.fillStyle="#FFFFFF",e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.fill(),e.strokeStyle=bn,e.lineWidth=2,e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function Mn(e,t){const{vertexes:i,strokeStyle:o,lineWidth:n}=t;e.setLineDash([]),e.strokeStyle=o,e.lineWidth=n,e.beginPath(),e.moveTo(i[0].x,i[0].y),e.lineTo(i[2].x,i[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(i[1].x,i[1].y),e.lineTo(i[3].x,i[3].y),e.closePath(),e.stroke()}function zn(e,t){const{start:i,end:o,centerVertexes:n,disabled:a}=t,r=!0===a?1:2,s=!0===a?In:bn;e.setLineDash([]),e.strokeStyle=s,e.lineWidth=r,e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,o.y),e.closePath(),e.stroke(),!0===a&&Mn(e,{vertexes:n,lineWidth:r,strokeStyle:s})}return w=new WeakMap,m=new WeakMap,y=new WeakMap,p=new WeakSet,x=function(){b(this,y).style.position="relative"},e.Core=class{constructor(e,t){I(this,p),I(this,w,void 0),I(this,m,void 0),I(this,y,void 0);const{devicePixelRatio:i=1,width:o,height:n,createCustomContext2D:a}=t;A(this,y,e);const r=document.createElement("canvas");A(this,m,r),M(this,p,x).call(this),e.appendChild(r);const s=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a,createCustomContext2D:r}=t,s={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d");if(r){const e=r(s),t=r(s),i=r(s),o=J(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}if(!0===a){const e=$(s),t=$(s),i=$(s),o=J(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}{const e=J(s),t=J(s),n=J(s),a=J(Object.assign({ctx:l},s)),r=()=>{a.clearRect(0,0,i,o),a.drawImage(n.canvas,0,0,i,o),a.drawImage(e.canvas,0,0,i,o),a.drawImage(t.canvas,0,0,i,o),n.clearRect(0,0,i,o),e.clearRect(0,0,i,o),t.clearRect(0,0,i,o)};return{underContext:n,viewContext:e,helperContext:t,boardContext:a,drawView:r}}}(r,{width:o,height:n,devicePixelRatio:i,offscreen:!0,createCustomContext2D:a}),l=new Ui({boardContent:s,container:e}),h=l.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),A(this,w,l),this.resize(h.getActiveViewSizeInfo());const c=l.getEventHub();new $i(e,{eventHub:c})}isDestroyed(){return b(this,w).isDestroyed()}destroy(){b(this,w).destroy(),b(this,m).remove()}use(e){b(this,w).use(e)}disuse(e){b(this,w).disuse(e)}setData(e,t){be((null==e?void 0:e.elements)||[]),b(this,w).setData(e,t)}getData(){return b(this,w).getData()}scale(e){b(this,w).scale(e);b(this,w).getViewer().drawFrame()}resize(e){const t=b(this,w),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){b(this,w).clear()}on(e,t){b(this,w).getEventHub().on(e,t)}off(e,t){b(this,w).getEventHub().off(e,t)}trigger(e,t){b(this,w).getEventHub().trigger(e,t)}getViewInfo(){const e=b(this,w).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){b(this,w).getViewer().drawFrame()}setViewScale(e){b(this,w).updateViewScaleInfo(e)}getLoadItemMap(){return b(this,w).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){b(this,w).onWatcherEvents()}offBoardWatcherEvents(){b(this,w).offWatcherEvents()}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger("cursor",{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(un,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(un);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(un,t)},pointEnd(){n=!1,i.setSharedStorage(un,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareInfo=e=>{const{boardContent:t,calculator:i}=e,{helperContext:o}=t;return{name:"@middleware/info",beforeDrawFrame({snapshot:e}){const{sharedStore:t}=e,n=t[ao],a=t[_i],r=t[fo]||[];if(1===n.length){const t=n[0];if(t&&["select","drag","resize"].includes(a)){const n=le(e),a=he(e),{x:s,y:l,w:h,h:c,angle:d}=t,f=[...r,{uuid:P(),x:s,y:l,w:h,h:c,angle:d,type:"group",detail:{children:[]}}],u={viewScaleInfo:n,viewSizeInfo:a},g=i.calcViewRectInfoFromOrigin(t.uuid,u);let v=0;f.forEach((e=>{v+=e.angle||0}));const w=ce(Se(0-v));if(g){const e=null==g?void 0:g.center,i={topLeft:we(e,g.topLeft,w),topRight:we(e,g.topRight,w),bottomRight:we(e,g.bottomRight,w),bottomLeft:we(e,g.bottomLeft,w),center:we(e,g.center,w),top:we(e,g.top,w),right:we(e,g.right,w),bottom:we(e,g.bottom,w),left:we(e,g.left,w)},n=Ne(t.x,{decimalPlaces:2}),a=Ne(t.y,{decimalPlaces:2}),r=Ne(t.w,{decimalPlaces:2}),s=Ne(t.h,{decimalPlaces:2}),l=`${Ne(n,{decimalPlaces:0})},${Ne(a,{decimalPlaces:0})}`,h=`${Ne(r,{decimalPlaces:0})}x${Ne(s,{decimalPlaces:0})}`,c=`${Ne(t.angle||0,{decimalPlaces:0})}°`;!function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:r,background:s,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:gn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x-o/2-t,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x-o/2,y:i.y};e.setLineDash([]),e.fillStyle=s,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=r,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.bottom.x,y:i.bottom.y+mn},rotateCenter:i.center,angle:v,text:h,fontSize:mn,lineHeight:16,color:wn,background:vn}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:r,background:s,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:gn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=s,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=r,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.topLeft.x,y:i.topLeft.y-20},rotateCenter:i.center,angle:v,text:l,fontSize:mn,lineHeight:16,color:wn,background:vn}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:r,background:s,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:gn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=s,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=r,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.top.x+mn,y:i.top.y-20},rotateCenter:i.center,angle:v,text:c,fontSize:mn,lineHeight:16,color:wn,background:vn})}}}}}},e.MiddlewareLayoutSelector=e=>{const{sharer:t,boardContent:i,calculator:o,viewer:n,eventHub:a}=e,{helperContext:r}=i;let s=null;const l=()=>{s=null,t.setSharedStorage(pn,null),t.setSharedStorage(xn,null),t.setSharedStorage(Sn,null)},h=()=>!!t.getSharedStorage(_i),c=e=>{var i;const o=t.getActiveStorage("data");if(null==(i=null==o?void 0:o.layout)?void 0:i.operations){const t=o.layout.operations;if("left"===e&&!0===t.disabledLeft)return!0;if("top"===e&&!0===t.disabledTop)return!0;if("right"===e&&!0===t.disabledRight)return!0;if("bottom"===e&&!0===t.disabledBottom)return!0;if("top-left"===e&&!0===t.disabledTopLeft)return!0;if("top-right"===e&&!0===t.disabledTopRight)return!0;if("bottom-left"===e&&!0===t.disabledBottomLeft)return!0;if("bottom-right"===e&&!0===t.disabledBottomRight)return!0}return!1},d=()=>{const e=t.getActiveStorage("data");if(null==e?void 0:e.layout){const{x:t,y:i,w:o,h:n}=e.layout;return{x:t,y:i,w:o,h:n}}return null},f=()=>{const e=t.getActiveViewScaleInfo(),i=d();if(i){const o=Fe(i,{viewScaleInfo:e,controllerSize:10});t.setSharedStorage(Sn,o)}else t.setSharedStorage(Sn,null)},u=e=>{const i=t.getActiveStorage("data"),o=t.getSharedStorage(Sn);if(o&&(null==i?void 0:i.layout)&&(null==e?void 0:e.point)){let i=null;if(o){const{topLeft:n,top:r,topRight:s,right:l,bottomRight:h,bottom:c,bottomLeft:d,left:f}=o,u=[n,r,s,l,h,c,d,f];for(let t=0;t<u.length;t++){const o=u[t];if(Oe(e.point,o.vertexes)){i=`${o.type}`;break}}if(i)return t.setSharedStorage(xn,i),a.trigger(po,{}),i}}return null};return{name:"@middleware/layout-selector",use:()=>{l(),f()},hover:e=>{if(h())return;const i=t.getSharedStorage(pn),o=t.getActiveStorage("data");if((null==o?void 0:o.layout)&&"resize"!==i){f();const i=u(e);i?(t.setSharedStorage(pn,"hover"),c(i)||a.trigger("cursor",{type:`resize-${i}`,groupQueue:[],element:d()}),n.drawFrame()):t.setSharedStorage(pn,null)}if(["hover","resize"].includes(t.getSharedStorage(pn)))return!1;"hover"!==i||t.getSharedStorage(pn)||n.drawFrame()},pointStart:e=>{if(h())return;f();const i=u(e);if(s=e.point,i){if(c(i))return;return t.setSharedStorage(pn,"resize"),!1}const o=t.getSharedStorage(pn);return!["hover","resize"].includes(o)&&void 0},pointMove:e=>{if(h())return;const i=t.getSharedStorage(pn),a=t.getSharedStorage(xn),r=t.getActiveStorage("data");if(!a||!c(a)){if("resize"===i&&a&&(null==r?void 0:r.layout)){if(s){const i=t.getActiveStorage("scale"),n=(e.point.x-s.x)/i,l=(e.point.y-s.y)/i,{x:h,y:c,w:d,h:f}=r.layout;"top"===a?(r.layout.y=o.toGridNum(c+l),r.layout.h=o.toGridNum(f-l)):"right"===a?r.layout.w=o.toGridNum(d+n):"bottom"===a?r.layout.h=o.toGridNum(f+l):"left"===a?(r.layout.x=o.toGridNum(h+n),r.layout.w=o.toGridNum(d-n)):"top-left"===a?(r.layout.x=o.toGridNum(h+n),r.layout.y=o.toGridNum(c+l),r.layout.w=o.toGridNum(d-n),r.layout.h=o.toGridNum(f-l)):"top-right"===a?(r.layout.y=o.toGridNum(c+l),r.layout.w=o.toGridNum(d+n),r.layout.h=o.toGridNum(f-l)):"bottom-right"===a?(r.layout.w=o.toGridNum(d+n),r.layout.h=o.toGridNum(f+l)):"bottom-left"===a&&(r.layout.x=o.toGridNum(h+n),r.layout.w=o.toGridNum(d-n),r.layout.h=o.toGridNum(f+l))}return s=e.point,f(),n.drawFrame(),!1}return!["hover","resize"].includes(i)&&void 0}},pointEnd:()=>{const e=t.getSharedStorage(pn),i=t.getSharedStorage(xn),o=t.getActiveStorage("data");o&&"resize"===e&&i&&!c(i)&&a.trigger(Ki,{type:"changeLayout",data:o}),l()},beforeDrawFrame:({snapshot:e})=>{var t;const{sharedStore:i,activeStore:o}=e,n=i[pn],a=i[xn];if((null==(t=o.data)?void 0:t.layout)&&n&&a&&["hover","resize"].includes(n)){const t=le(e),{x:i,y:n,w:a,h:s}=o.data.layout,l=Fe({x:i,y:n,w:a,h:s},{viewScaleInfo:t,controllerSize:10});!function(e,t){const{controller:i,operations:o}=t,{topLeft:n,topRight:a,bottomLeft:r,bottomRight:s,topMiddle:l,rightMiddle:h,bottomMiddle:c,leftMiddle:d}=i;zn(e,{start:n.center,end:a.center,centerVertexes:l.vertexes,disabled:!!(null==o?void 0:o.disabledTop)}),zn(e,{start:a.center,end:s.center,centerVertexes:h.vertexes,disabled:!!(null==o?void 0:o.disabledRight)}),zn(e,{start:s.center,end:r.center,centerVertexes:c.vertexes,disabled:!!(null==o?void 0:o.disabledBottom)}),zn(e,{start:r.center,end:n.center,centerVertexes:d.vertexes,disabled:!!(null==o?void 0:o.disabledLeft)});const f={lineWidth:1,strokeStyle:In};!0===(null==o?void 0:o.disabledTopLeft)?Mn(e,{vertexes:n.vertexes,...f}):An(e,n.vertexes),!0===(null==o?void 0:o.disabledTopRight)?Mn(e,{vertexes:a.vertexes,...f}):An(e,a.vertexes),!0===(null==o?void 0:o.disabledBottomRight)?Mn(e,{vertexes:s.vertexes,...f}):An(e,s.vertexes),!0===(null==o?void 0:o.disabledBottomLeft)?Mn(e,{vertexes:r.vertexes,...f}):An(e,r.vertexes)}(r,{controller:l,operations:o.data.layout.operations||{}})}},scrollX:()=>{l()},scrollY:()=>{l()},wheelScale:()=>{l()}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o,calculator:n}=e,{helperContext:a,underContext:r}=t;let s=!0,l=!0;const h=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(s=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(l=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||i.drawFrame()};return{name:"@middleware/ruler",use(){o.on(fn,h)},disuse(){o.off(fn,h)},beforeDrawFrame:({snapshot:e})=>{if(!0===s){const t=le(e),i=he(e);!function(e,t){const{snapshot:i,calculator:o}=t,{sharedStore:n}=i,a=n[ao],r=n[_i];if(["select","drag","drag-list","drag-list-end"].includes(r)&&a.length>0){const t=le(i),n=he(i),r=[],s=[],l=[],h=[],c=[];if(a.forEach((e=>{const i=o.calcViewRectInfoFromRange(e.uuid,{viewScaleInfo:t,viewSizeInfo:n});i&&(r.push(i),s.push(i.left.x),l.push(i.right.x),h.push(i.top.y),c.push(i.bottom.y))})),!(r.length>0))return;const d=Math.min(...s),f=Math.max(...l),u=Math.min(...h),g=Math.max(...c);e.globalAlpha=1,e.beginPath(),e.moveTo(d,0),e.lineTo(f,0),e.lineTo(f,nn),e.lineTo(d,nn),e.fillStyle=cn,e.closePath(),e.fill(),e.beginPath(),e.moveTo(0,u),e.lineTo(nn,u),e.lineTo(nn,g),e.lineTo(0,g),e.fillStyle=cn,e.closePath(),e.fill()}}(a,{snapshot:e,calculator:n}),function(e,t){const{viewSizeInfo:i}=t,{width:o,height:n}=i;e.beginPath(),e.moveTo(0,0),e.lineTo(o+1,0),e.lineTo(o+1,nn),e.lineTo(nn,nn),e.lineTo(nn,n+1),e.lineTo(0,n+1),e.lineTo(0,0),e.closePath(),e.fillStyle="#FFFFFFA8",e.fill(),e.lineWidth=1,e.setLineDash([]),e.strokeStyle="#00000080",e.stroke()}(a,{viewScaleInfo:t,viewSizeInfo:i});const o=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:a}=i;return dn({axis:"X",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t;for(let t=0;t<i.length;t++){const o=i[t];o.position<nn||(e.beginPath(),e.moveTo(o.position,16),e.lineTo(o.position,o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8),e.closePath(),e.lineWidth=1,e.setLineDash([]),e.fillStyle=an,e.stroke(),o.isKeyNum&&(e.fillStyle=rn,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:sn}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(a,{scaleList:o});const s=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return dn({axis:"Y",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t,o=3.2;for(let t=0;t<i.length;t++){const n=i[t];if(!(n.position<nn)&&(e.beginPath(),e.moveTo(16,n.position),e.lineTo(n.isKeyNum?3.2:n.isSubKeyNum?6.4:12.8,n.position),e.closePath(),e.fillStyle=an,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;de(e,-90,{x:t,y:i},(()=>{e.fillStyle=rn,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:sn}),e.fillText(a,13.2,n.position+o)}))}}}(a,{scaleList:s}),!0===l&&function(e,t){const{xList:i,yList:o,viewSizeInfo:n}=t,{width:a,height:r}=n;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,r),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=hn:e.strokeStyle=ln,e.closePath(),e.lineWidth=1,e.setLineDash([]),e.stroke()}for(let t=0;t<o.length;t++){const i=o[t];e.beginPath(),e.moveTo(0,i.position),e.lineTo(a,i.position),!0===i.isKeyNum||!0===i.isSubKeyNum?e.strokeStyle=hn:e.strokeStyle=ln,e.lineWidth=1,e.closePath(),e.stroke()}}(r,{xList:o,yList:s,viewScaleInfo:t,viewSizeInfo:i})}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:a}=e,{scale:r}=i.getActiveViewScaleInfo();let s=r;if(n<0?s=1.1*r:n>0&&(s=.9*r),s<.05||s>50)return;const{moveX:l,moveY:h}=t.scale({scale:s,point:a});t.scroll({moveX:l,moveY:h}),t.drawFrame();const c=Ne(r);o.trigger(on,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(Xo,null),o.setSharedStorage(Ho,null);const a=()=>{o.setSharedStorage(Zo,null),o.setSharedStorage(Qo,null),o.setSharedStorage(Uo,null)};a();const r=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&qo(e,t,n)?o="X":a&&qo(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(Xo),yThumbRect:o.getSharedStorage(Ho)});return{name:"@middleware/scroller",wheel:e=>{t.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),t.drawFrame()},pointStart:e=>{const{point:t}=e,i=r(t);if("X"===i||"Y"===i)return o.setSharedStorage(Uo,i),o.setSharedStorage(Zo,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Uo);if("X"===n||"Y"===n)return o.setSharedStorage(Qo,i),"X"===n?(e=>{const i=o.getSharedStorage(Zo);if(i){const{offsetLeft:n,offsetRight:a}=o.getActiveViewScaleInfo(),{width:r}=o.getActiveViewSizeInfo(),s=-(e.x-i.x)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveX:s}),t.drawFrame()}})(i):"Y"===n&&(e=>{const i=o.getSharedStorage(Zo);if(i){const{offsetTop:n,offsetBottom:a}=o.getActiveViewScaleInfo(),{height:r}=o.getActiveViewSizeInfo(),s=-(e.y-i.y)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveY:s}),t.drawFrame()}})(i),o.setSharedStorage(Zo,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Uo);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=tn(n,{snapshot:e});o.setSharedStorage(Xo,t),o.setSharedStorage(Ho,i)}}},e.MiddlewareSelector=e=>{const{viewer:t,sharer:i,boardContent:o,calculator:n,eventHub:a}=e,{helperContext:r}=o;let s=null,l=null;i.setSharedStorage(_i,null);const h=()=>i.getSharedStorage(ao),c=e=>{let t=i.getSharedStorage(fo);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const o=Te(t);return i.setSharedStorage(fo,t),i.setSharedStorage(uo,o),t.length>0},d=e=>{i.setSharedStorage(oo,e);let t=null;e&&(t=Ee(e,{groupQueue:i.getSharedStorage(fo)})),i.setSharedStorage(no,t)},f=(e,t)=>{var o;if(i.setSharedStorage(ao,e),1===e.length){const t=Ge(e[0],{groupQueue:i.getSharedStorage(fo),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(so,t),i.setSharedStorage(lo,ze(e[0].uuid,(null==(o=i.getActiveStorage("data"))?void 0:o.elements)||[]))}else i.setSharedStorage(so,null),i.setSharedStorage(lo,[]);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(yo,{uuids:e.map((e=>e.uuid))})},u=()=>({ctx:r,calculator:n,data:i.getActiveStorage("data"),selectedElements:h(),viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(fo),areaSize:null,selectedElementController:i.getSharedStorage(so),selectedElementPosition:i.getSharedStorage(lo)}),g=()=>{i.setSharedStorage(_i,null),i.setSharedStorage(eo,null),i.setSharedStorage(to,null),i.setSharedStorage(io,null),i.setSharedStorage(fo,[]),i.setSharedStorage(uo,[]),i.setSharedStorage(oo,null),i.setSharedStorage(no,null),i.setSharedStorage(ao,[]),i.setSharedStorage(ro,null),i.setSharedStorage(so,null),i.setSharedStorage(lo,[]),i.setSharedStorage(ho,[]),i.setSharedStorage(co,[]),i.setSharedStorage(go,null),i.setSharedStorage(vo,null)};g();const v=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(_i),r=i.getActiveStorage("data");n=o&&Array.isArray(o)?function(e,t){const i=[];return e.forEach((e=>{const o=Me(e,t);o&&i.push(o)})),i}(o,(null==r?void 0:r.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let a=0;a<o.length;a++){const r=o[a];e.includes(r.uuid)?i.push(r):"group"===r.type&&t((null===(n=null==r?void 0:r.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==r?void 0:r.elements)||[]);let s=!1;if(a||1!==n.length?"select"===a&&1===n.length&&(s=!0):(i.setSharedStorage(_i,"select"),s=!0),s){const e=function(e,t){const i=[];return function e(t,o){var n;let a=null;for(let r=0;r<o.length;r++){const s=o[r];if(s.uuid===t){a=s;break}if(!a&&"group"===s.type){i.push(s);const o=e(t,(null===(n=null==s?void 0:s.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){a=o;break}i.pop()}}return a}(e,t),i}(n[0].uuid,(null==r?void 0:r.elements)||[]);i.setSharedStorage(fo,e),f(n),t.drawFrame()}},w=()=>{g(),t.drawFrame()},m=e=>{i.setSharedStorage(vo,!!e.enable)};return{name:"@middleware/selector",use(){a.on(yo,v),a.on(po,w),a.on(xo,m)},disuse(){a.off(yo,v),a.off(po,w),a.off(xo,m)},hover:e=>{var o,s,c,f,g;const v=i.getSharedStorage(eo),w=i.getSharedStorage(_i),m=i.getSharedStorage(fo),y=e=>{const t=e.type;null===l&&a.trigger("cursor",{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==m?void 0:m.length)>0){if(!Lo(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(fo)}))return d(null),void t.drawFrame();const n=ko(e.point,u());return y(n),v||["area","drag","drag-list"].includes(w)?(d(null),void t.drawFrame()):1===(null==(o=null==n?void 0:n.elements)?void 0:o.length)?(d(n.elements[0]),void t.drawFrame()):(d(null),void t.drawFrame())}if(v||["area","drag","drag-list"].includes(w))return void d(null);if("drag"===w)return void d(null);const p=h(),x=i.getActiveViewScaleInfo(),S=i.getActiveViewSizeInfo(),b=ko(e.point,{...u(),areaSize:jo(p,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});if(y(b),null!==b.type){if(!("over-element"===b.type&&"select"===i.getSharedStorage(_i)&&1===b.elements.length&&b.elements[0].uuid===(null==(c=null==(s=h())?void 0:s[0])?void 0:c.uuid)||"over-element"===b.type&&null===i.getSharedStorage(_i)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(oo))?void 0:f.uuid)))return"over-element"===b.type&&1===(null==(g=null==b?void 0:b.elements)?void 0:g.length)?(d(b.elements[0]),void t.drawFrame()):i.getSharedStorage(oo)?(d(null),void t.drawFrame()):void 0}else(i.getSharedStorage(oo)||i.getSharedStorage(no))&&(i.setSharedStorage(oo,null),i.setSharedStorage(no,null),t.drawFrame())},pointStart:e=>{var o,a,l,c,v,w,m,y,p,x;s=e.point;const S=i.getSharedStorage(fo);if((null==S?void 0:S.length)>0){if(Lo(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:S})){const t=ko(e.point,u());if(1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)&&!0===(null==(l=null==(a=t.elements[0])?void 0:a.operations)?void 0:l.lock))return;d(null),"over-element"===t.type&&1===(null==(c=null==t?void 0:t.elements)?void 0:c.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(_i,"drag")):(null==(v=t.type)?void 0:v.startsWith("resize-"))?(i.setSharedStorage(eo,t.type),i.setSharedStorage(_i,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const b=jo(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),I=ko(e.point,{...u(),areaSize:b,groupQueue:[]});1===(null==(w=null==I?void 0:I.elements)?void 0:w.length)&&!0===(null==(y=null==(m=I.elements[0])?void 0:m.operations)?void 0:y.lock)||(d(null),"list-area"===I.type?i.setSharedStorage(_i,"drag-list"):"over-element"===I.type&&1===(null==(p=null==I?void 0:I.elements)?void 0:p.length)?(f([I.elements[0]],{triggerEvent:!0}),i.setSharedStorage(_i,"drag")):(null==(x=I.type)?void 0:x.startsWith("resize-"))?(i.setSharedStorage(eo,I.type),i.setSharedStorage(_i,"resize")):(g(),i.setSharedStorage(_i,"area"),i.setSharedStorage(to,e.point),f([],{triggerEvent:!0})),t.drawFrame())},pointMove:e=>{var o,a,r;i.setSharedStorage(ho,[]),i.setSharedStorage(co,[]),i.setSharedStorage(go,!0);const c=i.getActiveStorage("data"),d=h(),u=i.getActiveStorage("scale")||1,g=i.getActiveViewScaleInfo(),v=i.getActiveViewSizeInfo(),w=s,m=e.point,y=i.getSharedStorage(eo),p=i.getSharedStorage(_i),x=i.getSharedStorage(fo);if("drag"===p){if(l="drag",c&&1===(null==d?void 0:d.length)&&w&&m&&!0!==(null==(a=null==(o=d[0])?void 0:o.operations)?void 0:a.lock)){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const a=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:r=0}=e;a.push({x:t,y:i,w:o,h:n,angle:0-r})})),(null==i?void 0:i.length)>0){const i=me(e,a),r=me(t,a);o=r.x-i.x,n=r.y-i.y}return{moveX:o,moveY:n}}(w,m,x);let o=n.toGridNum(e/u),a=n.toGridNum(t/u);const r=function(e,t){var i,o;const{data:n,groupQueue:a,calculator:r,viewScaleInfo:s,viewSizeInfo:l}=t;let h=n.elements||[];(null==a?void 0:a.length)>0&&(h=(null==(o=null==(i=a[a.length-1])?void 0:i.detail)?void 0:o.children)||[]);const c=[];h.forEach((t=>{if(t.uuid!==e){const e=r.calcViewRectInfoFromRange(t.uuid,{checkVisible:!0,viewScaleInfo:s,viewSizeInfo:l});e&&c.push(e)}}));const d=r.calcViewRectInfoFromRange(e,{viewScaleInfo:s,viewSizeInfo:l});if(!d)return null;const f={},u={},g=[],v=[];let w=[],m=[];const y=Do(d);c.forEach((e=>{const t=Do(e);f[t.minX]||(f[t.minX]=[]),f[t.midX]||(f[t.midX]=[]),f[t.maxX]||(f[t.maxX]=[]),u[t.minY]||(u[t.minY]=[]),u[t.midY]||(u[t.midY]=[]),u[t.maxY]||(u[t.maxY]=[]),f[t.minX]=[t.minY,t.midY,t.maxY],f[t.midX]=[t.minY,t.midY,t.maxY],f[t.maxX]=[t.minY,t.midY,t.maxY],w.push(t.minX),w.push(t.midX),w.push(t.maxX),u[t.minY]=[t.minX,t.midX,t.maxX],u[t.midY]=[t.minX,t.midX,t.maxX],u[t.maxY]=[t.minX,t.midX,t.maxX],m.push(t.minY),m.push(t.midY),m.push(t.maxY)})),w=w.sort(((e,t)=>e-t)),m=m.sort(((e,t)=>e-t));let p=null,x=null,S=null,b=null,I=null,A=null,M=null,z=null;if(w.length>0){S=Vo(w,y.minX),b=Vo(w,y.midX),I=Vo(w,y.maxX);const e=Math.abs(S-y.minX),t=Math.abs(b-y.midX),i=Math.abs(I-y.maxX),o=Math.min(e,t,i);o<=2/s.scale&&(Yo(o,e)?p=S-y.minX:Yo(o,t)?p=b-y.midX:Yo(o,i)&&(p=I-y.maxX))}if(m.length>0){A=Vo(m,y.minY),M=Vo(m,y.midY),z=Vo(m,y.maxY);const e=Math.abs(A-y.minY),t=Math.abs(M-y.midY),i=Math.abs(z-y.maxY),o=Math.min(e,t,i);o<=2/s.scale&&(Yo(o,e)?x=A-y.minY:Yo(o,t)?x=M-y.midY:Yo(o,i)&&(x=z-y.maxY))}const R={...y};if(null!==p&&(R.minX+=p,R.midX+=p,R.maxX+=p),null!==x&&(R.minY+=x,R.midY+=x,R.maxY+=x),N.x(p)&&null!==p&&null!==S&&null!==b&&null!==I){if(Yo(p,S-y.minX)){const e={x:S,yList:[]};e.yList.push(R.minY),e.yList.push(R.midY),e.yList.push(R.maxY),e.yList.push(...(null==u?void 0:u[S])||[]),g.push(e)}if(Yo(p,b-y.minX)){const e={x:b,yList:[]};e.yList.push(R.minY),e.yList.push(R.midY),e.yList.push(R.maxY),e.yList.push(...(null==u?void 0:u[b])||[]),g.push(e)}if(Yo(p,I-y.minX)){const e={x:I,yList:[]};e.yList.push(R.minY),e.yList.push(R.midY),e.yList.push(R.maxY),e.yList.push(...(null==u?void 0:u[I])||[]),g.push(e)}}if(N.y(x)&&null!==x&&null!==A&&null!==M&&null!==z){if(Yo(x,A-y.minY)){const e={y:A,xList:[]};e.xList.push(R.minX),e.xList.push(R.midX),e.xList.push(R.maxX),e.xList.push(...(null==f?void 0:f[A])||[]),v.push(e)}if(Yo(x,M-y.midY)){const e={y:M,xList:[]};e.xList.push(R.minX),e.xList.push(R.midX),e.xList.push(R.maxX),e.xList.push(...(null==f?void 0:f[A])||[]),v.push(e)}if(Yo(x,z-y.maxY)){const e={y:z,xList:[]};e.xList.push(R.minX),e.xList.push(R.midX),e.xList.push(R.maxX),e.xList.push(...(null==f?void 0:f[z])||[]),v.push(e)}}const P=[];(null==g?void 0:g.length)>0&&g.forEach(((e,t)=>{P.push([]),e.yList.forEach((i=>{P[t].push({x:e.x,y:i})}))}));const T=[];return(null==v?void 0:v.length)>0&&v.forEach(((e,t)=>{T.push([]),e.xList.forEach((i=>{T[t].push({x:i,y:e.y})}))})),{offsetX:p,offsetY:x,yLines:P,xLines:T}}(d[0].uuid,{calculator:n,data:c,groupQueue:x,viewScaleInfo:g,viewSizeInfo:v});try{r&&(N.x(r.offsetX)&&null!==r.offsetX&&(o=n.toGridNum(o+r.offsetX)),N.y(r.offsetY)&&null!==r.offsetY&&(a=n.toGridNum(a+r.offsetY)),i.setSharedStorage(ho,r.xLines),i.setSharedStorage(co,r.yLines))}catch(e){console.error(e)}d[0].x=n.toGridNum(d[0].x+o),d[0].y=n.toGridNum(d[0].y+a),f([d[0]]),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:d[0],position:i.getSharedStorage(lo)||[]}},viewSizeInfo:v,viewScaleInfo:g})}t.drawFrame()}else if("drag-list"===p){if(l="drag-list",c&&w&&m&&(null==d?void 0:d.length)>1){const e=(m.x-w.x)/u,t=(m.y-w.y)/u;d.forEach((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.lock)&&(i.x=n.toGridNum(i.x+e),i.y=n.toGridNum(i.y+t),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:i,position:ze(i.uuid,c.elements)||[]}},viewSizeInfo:v,viewScaleInfo:g}))})),i.setActiveStorage("data",c)}t.drawFrame()}else if("resize"===p){if(c&&1===(null==d?void 0:d.length)&&w&&(null==y?void 0:y.startsWith("resize-"))){l="resize";const e=[];x.forEach((t=>{const{x:i,y:o,w:n,h:a,angle:r=0}=t;e.push({x:i,y:o,w:n,h:a,angle:0-r})}));let o=w,a=m;if(x.length>0&&(o=me(w,e),a=me(m,e)),"resize-rotate"===y){const e=i.getSharedStorage(so),t=ge([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),o=Oo(d[0],{center:t,viewScaleInfo:g,viewSizeInfo:v,start:w,end:m,resizeType:y,sharer:i});d[0].angle=n.toGridNum(o.angle||0)}else{const e=function(e,t){var i,o,n,a,r,s,l,h,c;let{x:d,y:f,w:u,h:g,angle:v=0}=e;const w=ue({x:d,y:f,w:u,h:g,angle:v});v=Se(v);const m=ce(v),y=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:p,end:x,resizeType:S,scale:b}=t;let I={...p},A={...x},M={x:I.x,y:w.y},z={x:A.x,y:w.y},R={...M},P={...z},T={x:w.x,y:I.y},E={x:w.x,y:A.y},W={...T},C={...E},L=(P.x-R.x)/b,k=(P.y-R.y)/b,O=Eo(L,k),j=(C.x-W.x)/b,D=(C.y-W.y)/b,V=Eo(j,D);(v>0||v<0)&&(I=we(w,p,0-m),A=we(w,x,0-m),M={x:I.x,y:w.y},z={x:A.x,y:w.y},R=we(w,M,m),P=we(w,z,m),T={x:w.x,y:I.y},E={x:w.x,y:A.y},W=we(w,T,m),C=we(w,E,m),L=(P.x-R.x)/b,k=(P.y-R.y)/b,O=Eo(L,k),O=Wo(O,k),j=(C.x-W.x)/b,D=(C.y-W.y)/b,V=Eo(j,D),V=Wo(V,D));let Y=(x.x-p.x)/b,G=(x.y-p.y)/b;if(!0===y)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(Y),Math.abs(G));Y=(Y>=0?1:-1)*t,G=(G>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(j),Math.abs(D));j=(j>=0?1:-1)*i,D=(D>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(L),Math.abs(k));L=(L>=0?1:-1)*o,k=(k>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(Y);Y=(Y>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?G=Y>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(G=Y>0?-i:i)}O=Math.abs(O),V=O/e.w*e.h}switch(S){case"resize-top":if(0===v)g-G>0&&(f+=G,g-=G,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=G/e.h*e.w/2,u-=G/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){V=0-Wo(V,D);const e=To(v),o=V/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){V=Wo(V,j);const e=To(v-90),o=V/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){V=Wo(V,D);const e=To(v-180),o=V/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){V=0-Wo(V,j);const e=To(v-270),o=V/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+V>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(u+=V/e.h*e.w),g+=V,d=t-u/2,f=i-g/2)}break;case"resize-bottom":if(0===v)e.h+G>0&&(g+=G,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=G/e.h*e.w/2,u+=G/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){V=Wo(V,D);const e=To(v),o=V/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){V=0-Wo(V,j);const e=To(v-90),o=V/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){V=Wo(V,j);const e=To(v-180),o=V/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){V=Wo(V,j);const e=To(v-270),o=V/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+V>0&&(!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(u+=V/e.h*e.w),g+=V,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===v)e.w-Y>0&&(d+=Y,u-=Y,!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g-=Y/e.w*e.h,f+=Y/e.w*e.h/2));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){O=0-Wo(O,L);const e=To(v),o=O/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){O=Wo(O,L);const e=To(v-90),o=O/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){O=Wo(O,k);const e=To(v-180),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){O=Wo(O,k);const e=To(v-270),o=O/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+O>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=O/e.w*e.h),u+=O,d=t-u/2,f=i-g/2)}break;case"resize-right":if(0===v)e.w+Y>0&&(u+=Y,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=Y*e.h/e.w/2,g+=Y*e.h/e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){O=Wo(O,k);const e=To(v),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){O=Wo(O,G);const e=To(v-90),o=O/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){O=Wo(O,G);const e=To(v-180),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e),O=0-O}else if(v<360){O=Wo(O,Y);const e=To(v-270),o=O/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+O>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=O/e.w*e.h),u+=O,d=t-u/2,f=i-g/2)}break;case"resize-top-left":if(0===v)u-Y>0&&(d+=Y,u-=Y),g-G>0&&(f+=G,g-=G);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=0-Wo(V,D),O=0-Wo(O,y?0-V:L);const i=V/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=O/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(v<180){V=Wo(V,j),O=Wo(O,y?V:L);const i=To(v-90),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){V=Wo(V,D),O=Wo(O,y?V:k);const i=To(v-180),o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){V=0-Wo(V,j),O=Wo(O,y?V:k);const i=To(v-270),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}break;case"resize-top-right":if(0===v)u+Y>0&&(u+=Y),g-G>0&&(f+=G,g-=G);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=0-Wo(V,D),O=Wo(O,y?V:k);const i=To(v),o=V/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){V=Wo(V,j),O=Wo(O,y?V:k);const i=To(v-90),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=To(v-180);V=Wo(V,D),O=Wo(O,y?V:0-L);const o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){V=0-Wo(V,j),O=Wo(O,y?V:L);const i=To(v-270),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}break;case"resize-bottom-left":if(0===v)e.h+G>0&&(g+=G),e.w-Y>0&&(d+=Y,u-=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=Wo(V,D),O=0-Wo(O,y?0-V:L);const i=To(v),o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){V=0-Wo(V,j),O=Wo(O,y?V:L);const i=To(v-90),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){V=Wo(V,j),O=Wo(O,y?V:k);const i=To(v-180),o=V/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){V=Wo(V,j),O=Wo(O,y?V:k);const i=To(v-270),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}break;case"resize-bottom-right":if(0===v)e.h+G>0&&(g+=G),e.w+Y>0&&(u+=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){V=Wo(V,D),O=Wo(O,y?V:k);const i=To(v),o=V/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){V=0-Wo(V,j),O=Wo(O,y?V:G);const i=To(v-90),o=V/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){V=Wo(V,j),O=Wo(O,y?V:0-k);const i=To(v-180),o=V/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){V=Wo(V,j),O=Wo(O,y?V:L);const i=To(v-270),o=V/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+V>0&&(g+=V),u+O>0&&(u+=O),d=e-u/2,f=t-g/2}}return{x:d,y:f,w:u,h:g,angle:e.angle}}(d[0],{scale:u,start:o,end:a,resizeType:y,sharer:i}),t={ignore:!!d[0].angle};d[0].x=n.toGridNum(e.x,t),d[0].y=n.toGridNum(e.y,t),"group"===d[0].type&&!0===(null==(r=d[0].operations)?void 0:r.deepResize)?function(e,t){const i=t.w&&t.w>0?t.w:e.w,o=t.h&&t.h>0?t.h:e.h,n=i/e.w,a=o/e.h;if(n===a&&1===n)return e;const r=Math.min(n,a),s=Math.max(n,a);e.w=i,e.h=o;const l={xRatio:n,yRatio:a,minRatio:r,maxRatio:s};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ue(e,l)})),Qe(e,l)}(d[0],{w:n.toGridNum(e.w,t),h:n.toGridNum(e.h,t)}):(d[0].w=n.toGridNum(e.w,t),d[0].h=n.toGridNum(e.h,t))}f([d[0]]),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:d[0],position:i.getSharedStorage(lo)||[]}},viewSizeInfo:v,viewScaleInfo:g}),t.drawFrame()}}else"area"===p&&(l="area",i.setSharedStorage(io,e.point),t.drawFrame());s=e.point},pointEnd(e){l=null,i.setSharedStorage(ho,[]),i.setSharedStorage(co,[]),i.setSharedStorage(go,!1);const o=i.getActiveStorage("data"),r=i.getSharedStorage(eo),h=i.getSharedStorage(_i),c=i.getActiveViewSizeInfo();let d=!1;if(s=null,"resize"===h&&r)i.setSharedStorage(eo,null),d=!0;else if("area"===h){if(i.setSharedStorage(_i,null),o){const e=i.getSharedStorage(to),t=i.getSharedStorage(io);if(e&&t){const{elements:a}=function(e,t){var i;const o=[],n=[],a=[],{viewScaleInfo:r,viewSizeInfo:s,start:l,end:h}=t;if(!(Array.isArray(e.elements)&&l&&h))return{indexes:o,uuids:n,elements:a};const c=Math.min(l.x,h.x),d=Math.max(l.x,h.x),f=Math.min(l.y,h.y),u=Math.max(l.y,h.y);for(let t=0;t<e.elements.length;t++){const l=e.elements[t];if(!0===(null==(i=null==l?void 0:l.operations)?void 0:i.lock))continue;const h=We(l,{viewScaleInfo:r,viewSizeInfo:s}),g=ue(h);if(g.x>=c&&g.x<=d&&g.y>=f&&g.y<=u&&(o.push(t),n.push(l.uuid),a.push(l),h.angle&&(h.angle>0||h.angle<0))){const e=pe(h);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];h.x=Math.min(...t),h.y=Math.min(...i),h.w=Math.abs(Math.max(...t)-Math.min(...t)),h.h=Math.abs(Math.max(...i)-Math.min(...i))}}}return{indexes:o,uuids:n,elements:a}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(_i,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(_i,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(_i,"select"),d=!0):i.setSharedStorage(_i,null)}null===i.getSharedStorage(_i)&&(g(),d=!0);(()=>{if(d){if(o&&Array.isArray(null==o?void 0:o.elements)&&["drag","drag-list"].includes(h)){const e=function(e,t,i){const o=Ie(e,{viewWidth:t.width,viewHeight:t.height,extend:null==i?void 0:i.extend});return!0===(null==i?void 0:i.extend)&&(o.contextWidth=Math.max(o.contextWidth,t.contextWidth),o.contextHeight=Math.max(o.contextHeight,t.contextHeight)),{contextSize:o}}(o.elements,c,{extend:!0});i.setActiveStorage("contextHeight",e.contextSize.contextHeight),i.setActiveStorage("contextWidth",e.contextSize.contextWidth)}if(o&&["drag","drag-list","drag-list-end","resize"].includes(h)){let e="dragElement";a.trigger(Ki,{data:o,type:e})}t.drawFrame()}})()},pointLeave(){s=null,g(),t.drawFrame()},doubleClick(e){var o,n,r,s,l,h;if(!1===i.getSharedStorage(vo))return;const d=ko(e.point,u());if(i.setSharedStorage(so,null),i.setSharedStorage(ao,[]),1!==d.elements.length||!0!==(null==(n=null==(o=d.elements[0])?void 0:o.operations)?void 0:n.lock)){if(1===d.elements.length&&"group"===(null==(r=d.elements[0])?void 0:r.type)){if(!0===c(d.elements[0]))return i.setSharedStorage(_i,null),void t.drawFrame()}else 1===d.elements.length&&"text"===(null==(s=d.elements[0])?void 0:s.type)&&a.trigger(Go,{element:d.elements[0],groupQueue:i.getSharedStorage(fo)||[],position:ze(null==(l=d.elements[0])?void 0:l.uuid,(null==(h=i.getActiveStorage("data"))?void 0:h.elements)||[]),viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(_i,null)}},beforeDrawFrame({snapshot:t}){var i;const{activeStore:o,sharedStore:a}=t,{scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f,width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m}=o,y=e.sharer,p={scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f},x={width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m},S=a[ao][0],b=a[oo],I=a[no],A=a[_i],M=a[to],z=a[io],R=a[fo],P=a[uo],T=a[go],E={calculator:n,viewScaleInfo:p,viewSizeInfo:x},W=S?Ge(S,{groupQueue:R,controllerSize:10,viewScaleInfo:p}):null,C=!!(null==(i=null==b?void 0:b.operations)?void 0:i.lock);if((null==R?void 0:R.length)>0){if(function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:wo,borderWidth:2,background:"transparent",lineDash:[4,4]};So(e,Le(n,i),a)}}(r,P,E),b&&"drag"!==A&&(C?zo(r,I,{...E,controller:Ge(b,{groupQueue:R,controllerSize:10,viewScaleInfo:p})}):Mo(r,I,E)),!C&&S&&["select","drag","resize"].includes(A)&&(Ro(r,W,{...E,element:S,calculator:n,hideControllers:!!T&&"drag"===A}),"drag"===A)){const e=y.getSharedStorage(ho),t=y.getSharedStorage(co);Po(r,{xLines:e,yLines:t})}}else if(b&&"drag"!==A&&(C?zo(r,I,{...E,controller:Ge(b,{groupQueue:R,controllerSize:10,viewScaleInfo:p})}):Mo(r,I,E)),!C&&S&&["select","drag","resize"].includes(A)){if(Ro(r,W,{...E,element:S,calculator:n,hideControllers:!!T&&"drag"===A}),"drag"===A){const e=y.getSharedStorage(ho),t=y.getSharedStorage(co);Po(r,{xLines:e,yLines:t})}}else if("area"===A&&M&&z)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=wo,e.fillStyle="#1976d24f",e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill()}(r,{start:M,end:z});else if(["drag-list","drag-list-end"].includes(A)){const e=jo(h(),{viewScaleInfo:y.getActiveViewScaleInfo(),viewSizeInfo:y.getActiveViewSizeInfo(),calculator:n});e&&function(e,t){const{areaSize:i}=t,{x:o,y:n,w:a,h:r}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=wo,e.fillStyle="#1976d21c",e.beginPath(),e.moveTo(o,n),e.lineTo(o+a,n),e.lineTo(o+a,n+r),e.lineTo(o,n+r),e.closePath(),e.stroke(),e.fill()}(r,{areaSize:e})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o}=e,n=i.boardContext.canvas,a=document.createElement("div");a.setAttribute("contenteditable","true");const r=document.createElement("div"),s=e.container||document.body,l=document.createElement("div");let h=null,c=[];r.appendChild(a),r.style.position="absolute",l.appendChild(r),l.style.position="fixed",l.style.top="0",l.style.bottom="0",l.style.left="0",l.style.right="0",l.style.display="none",s.appendChild(l);const d=()=>{l.style.display="none",h=null,c=[]},f=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:r,h:s}=t,l=Se(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${a}px`,o.style.width=`${r}px`,o.style.height=`${s}px`,o.style.transform=`rotate(${l}deg)`,i.appendChild(o),o},u=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:s,offsetLeft:l}=t;r.children&&Array.from(r.children).forEach((e=>{e.remove()}));let h=r;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:a,w:r,h:c}=t,d={x:i*n,y:a*n,w:r*n,h:c*n,angle:Se(t.angle||0)};0===e&&(d.x+=l,d.y+=s),h=f({size:d,parent:h})}const c={...Bo,...i.detail};let d=i.x*n+l,u=i.y*n+s,g=i.w*n,v=i.h*n;o.length>0&&(d=i.x*n,u=i.y*n,g=i.w*n,v=i.h*n);let w="center",m="center";"left"===c.textAlign?w="start":"right"===c.textAlign&&(w="end"),"top"===c.verticalAlign?m="start":"bottom"===c.verticalAlign&&(m="end"),a.style.display="inline-flex",a.style.justifyContent=w,a.style.alignItems=m,a.style.position="absolute",a.style.left=d-1+"px",a.style.top=u-1+"px",a.style.width=`${g+2}px`,a.style.height=`${v+2}px`,a.style.transform=`rotate(${Se(i.angle||0)}deg)`,a.style.boxSizing="border-box",a.style.border="1px solid #1973ba",a.style.resize="none",a.style.overflow="hidden",a.style.wordBreak="break-all",a.style.background="#FFFFFF",a.style.color="#333333",a.style.fontSize=c.fontSize*n+"px",a.style.lineHeight=c.lineHeight*n+"px",a.style.fontFamily=c.fontFamily,a.style.fontWeight=`${c.fontWeight}`,a.style.padding="0",a.style.margin="0",a.style.outline="none",a.innerText=c.text||"",h.appendChild(a)},g=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:a}=e;return{left:t,top:i,width:o,height:a}})();r.style.position="absolute",r.style.overflow="hidden",r.style.top=`${t}px`,r.style.left=`${e}px`,r.style.width=`${i}px`,r.style.height=`${o}px`};l.addEventListener("click",(()=>{d()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(()=>{h&&c&&(h.detail.text=a.innerText||"",t.trigger(Fo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c||[]]}),o.drawFrame())})),a.addEventListener("blur",(()=>{h&&c&&t.trigger(Fo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c]}),d()})),a.addEventListener("keydown",(e=>{e.stopPropagation()})),a.addEventListener("keypress",(e=>{e.stopPropagation()})),a.addEventListener("keyup",(e=>{e.stopPropagation()})),a.addEventListener("wheel",(e=>{e.stopPropagation(),e.preventDefault()}));const v=e=>{var t;(null==e?void 0:e.position)&&(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element,c=e.position),(e=>{g(),u(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(Go,v)},disuse(){t.off(Go,v)}}},e.eventChange=Ki,e.middlewareEventRuler=fn,e.middlewareEventScale=on,e.middlewareEventSelect=yo,e.middlewareEventSelectClear=po,e.middlewareEventSelectInGroup=xo,e.middlewareEventTextChange=Fo,e.middlewareEventTextEdit=Go,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idraw/core",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"author": "chenshenhai",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@idraw/types": "^0.4.0-beta.
|
|
24
|
+
"@idraw/types": "^0.4.0-beta.21"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@idraw/board": "^0.4.0-beta.
|
|
29
|
-
"@idraw/renderer": "^0.4.0-beta.
|
|
30
|
-
"@idraw/util": "^0.4.0-beta.
|
|
28
|
+
"@idraw/board": "^0.4.0-beta.21",
|
|
29
|
+
"@idraw/renderer": "^0.4.0-beta.21",
|
|
30
|
+
"@idraw/util": "^0.4.0-beta.21"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public",
|