@idraw/core 0.2.0-alpha.23 → 0.2.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +14 -12
- package/dist/index.es.js +14 -12
- package/dist/index.global.js +14 -12
- package/dist/index.global.min.js +1 -1
- package/package.json +6 -6
package/dist/index.cjs.js
CHANGED
|
@@ -4951,48 +4951,50 @@ var Helper = (function () {
|
|
|
4951
4951
|
if (typeof elem.angle === 'number' && Math.abs(elem.angle) > limitQbliqueAngle) {
|
|
4952
4952
|
hideObliqueDirection = true;
|
|
4953
4953
|
}
|
|
4954
|
+
var controllerOffset = lineWidth;
|
|
4954
4955
|
var wrapper = {
|
|
4955
4956
|
uuid: elem.uuid,
|
|
4956
4957
|
controllerSize: controllerSize,
|
|
4958
|
+
controllerOffset: controllerOffset,
|
|
4957
4959
|
lock: ((_b = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _b === void 0 ? void 0 : _b.lock) === true,
|
|
4958
4960
|
controllers: {
|
|
4959
4961
|
topLeft: {
|
|
4960
|
-
x: elem.x -
|
|
4961
|
-
y: elem.y -
|
|
4962
|
+
x: elem.x - controllerOffset - bw,
|
|
4963
|
+
y: elem.y - controllerOffset - bw,
|
|
4962
4964
|
invisible: hideObliqueDirection || ((_c = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _c === void 0 ? void 0 : _c.disbaleScale) === true,
|
|
4963
4965
|
},
|
|
4964
4966
|
top: {
|
|
4965
4967
|
x: elem.x + elem.w / 2,
|
|
4966
|
-
y: elem.y -
|
|
4968
|
+
y: elem.y - controllerOffset - bw,
|
|
4967
4969
|
invisible: ((_d = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _d === void 0 ? void 0 : _d.disbaleScale) === true,
|
|
4968
4970
|
},
|
|
4969
4971
|
topRight: {
|
|
4970
|
-
x: elem.x + elem.w +
|
|
4971
|
-
y: elem.y -
|
|
4972
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4973
|
+
y: elem.y - controllerOffset - bw,
|
|
4972
4974
|
invisible: hideObliqueDirection || ((_e = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _e === void 0 ? void 0 : _e.disbaleScale) === true,
|
|
4973
4975
|
},
|
|
4974
4976
|
right: {
|
|
4975
|
-
x: elem.x + elem.w +
|
|
4977
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4976
4978
|
y: elem.y + elem.h / 2,
|
|
4977
4979
|
invisible: ((_f = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _f === void 0 ? void 0 : _f.disbaleScale) === true
|
|
4978
4980
|
},
|
|
4979
4981
|
bottomRight: {
|
|
4980
|
-
x: elem.x + elem.w +
|
|
4981
|
-
y: elem.y + elem.h +
|
|
4982
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4983
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4982
4984
|
invisible: hideObliqueDirection || ((_g = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _g === void 0 ? void 0 : _g.disbaleScale) === true,
|
|
4983
4985
|
},
|
|
4984
4986
|
bottom: {
|
|
4985
4987
|
x: elem.x + elem.w / 2,
|
|
4986
|
-
y: elem.y + elem.h +
|
|
4988
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4987
4989
|
invisible: ((_h = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _h === void 0 ? void 0 : _h.disbaleScale) === true,
|
|
4988
4990
|
},
|
|
4989
4991
|
bottomLeft: {
|
|
4990
|
-
x: elem.x -
|
|
4991
|
-
y: elem.y + elem.h +
|
|
4992
|
+
x: elem.x - controllerOffset - bw,
|
|
4993
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4992
4994
|
invisible: hideObliqueDirection || ((_j = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _j === void 0 ? void 0 : _j.disbaleScale) === true,
|
|
4993
4995
|
},
|
|
4994
4996
|
left: {
|
|
4995
|
-
x: elem.x -
|
|
4997
|
+
x: elem.x - controllerOffset - bw,
|
|
4996
4998
|
y: elem.y + elem.h / 2,
|
|
4997
4999
|
invisible: ((_k = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _k === void 0 ? void 0 : _k.disbaleScale) === true
|
|
4998
5000
|
},
|
package/dist/index.es.js
CHANGED
|
@@ -4949,48 +4949,50 @@ var Helper = (function () {
|
|
|
4949
4949
|
if (typeof elem.angle === 'number' && Math.abs(elem.angle) > limitQbliqueAngle) {
|
|
4950
4950
|
hideObliqueDirection = true;
|
|
4951
4951
|
}
|
|
4952
|
+
var controllerOffset = lineWidth;
|
|
4952
4953
|
var wrapper = {
|
|
4953
4954
|
uuid: elem.uuid,
|
|
4954
4955
|
controllerSize: controllerSize,
|
|
4956
|
+
controllerOffset: controllerOffset,
|
|
4955
4957
|
lock: ((_b = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _b === void 0 ? void 0 : _b.lock) === true,
|
|
4956
4958
|
controllers: {
|
|
4957
4959
|
topLeft: {
|
|
4958
|
-
x: elem.x -
|
|
4959
|
-
y: elem.y -
|
|
4960
|
+
x: elem.x - controllerOffset - bw,
|
|
4961
|
+
y: elem.y - controllerOffset - bw,
|
|
4960
4962
|
invisible: hideObliqueDirection || ((_c = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _c === void 0 ? void 0 : _c.disbaleScale) === true,
|
|
4961
4963
|
},
|
|
4962
4964
|
top: {
|
|
4963
4965
|
x: elem.x + elem.w / 2,
|
|
4964
|
-
y: elem.y -
|
|
4966
|
+
y: elem.y - controllerOffset - bw,
|
|
4965
4967
|
invisible: ((_d = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _d === void 0 ? void 0 : _d.disbaleScale) === true,
|
|
4966
4968
|
},
|
|
4967
4969
|
topRight: {
|
|
4968
|
-
x: elem.x + elem.w +
|
|
4969
|
-
y: elem.y -
|
|
4970
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4971
|
+
y: elem.y - controllerOffset - bw,
|
|
4970
4972
|
invisible: hideObliqueDirection || ((_e = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _e === void 0 ? void 0 : _e.disbaleScale) === true,
|
|
4971
4973
|
},
|
|
4972
4974
|
right: {
|
|
4973
|
-
x: elem.x + elem.w +
|
|
4975
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4974
4976
|
y: elem.y + elem.h / 2,
|
|
4975
4977
|
invisible: ((_f = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _f === void 0 ? void 0 : _f.disbaleScale) === true
|
|
4976
4978
|
},
|
|
4977
4979
|
bottomRight: {
|
|
4978
|
-
x: elem.x + elem.w +
|
|
4979
|
-
y: elem.y + elem.h +
|
|
4980
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4981
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4980
4982
|
invisible: hideObliqueDirection || ((_g = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _g === void 0 ? void 0 : _g.disbaleScale) === true,
|
|
4981
4983
|
},
|
|
4982
4984
|
bottom: {
|
|
4983
4985
|
x: elem.x + elem.w / 2,
|
|
4984
|
-
y: elem.y + elem.h +
|
|
4986
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4985
4987
|
invisible: ((_h = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _h === void 0 ? void 0 : _h.disbaleScale) === true,
|
|
4986
4988
|
},
|
|
4987
4989
|
bottomLeft: {
|
|
4988
|
-
x: elem.x -
|
|
4989
|
-
y: elem.y + elem.h +
|
|
4990
|
+
x: elem.x - controllerOffset - bw,
|
|
4991
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4990
4992
|
invisible: hideObliqueDirection || ((_j = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _j === void 0 ? void 0 : _j.disbaleScale) === true,
|
|
4991
4993
|
},
|
|
4992
4994
|
left: {
|
|
4993
|
-
x: elem.x -
|
|
4995
|
+
x: elem.x - controllerOffset - bw,
|
|
4994
4996
|
y: elem.y + elem.h / 2,
|
|
4995
4997
|
invisible: ((_k = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _k === void 0 ? void 0 : _k.disbaleScale) === true
|
|
4996
4998
|
},
|
package/dist/index.global.js
CHANGED
|
@@ -4952,48 +4952,50 @@ var iDrawCore = (function () {
|
|
|
4952
4952
|
if (typeof elem.angle === 'number' && Math.abs(elem.angle) > limitQbliqueAngle) {
|
|
4953
4953
|
hideObliqueDirection = true;
|
|
4954
4954
|
}
|
|
4955
|
+
var controllerOffset = lineWidth;
|
|
4955
4956
|
var wrapper = {
|
|
4956
4957
|
uuid: elem.uuid,
|
|
4957
4958
|
controllerSize: controllerSize,
|
|
4959
|
+
controllerOffset: controllerOffset,
|
|
4958
4960
|
lock: ((_b = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _b === void 0 ? void 0 : _b.lock) === true,
|
|
4959
4961
|
controllers: {
|
|
4960
4962
|
topLeft: {
|
|
4961
|
-
x: elem.x -
|
|
4962
|
-
y: elem.y -
|
|
4963
|
+
x: elem.x - controllerOffset - bw,
|
|
4964
|
+
y: elem.y - controllerOffset - bw,
|
|
4963
4965
|
invisible: hideObliqueDirection || ((_c = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _c === void 0 ? void 0 : _c.disbaleScale) === true,
|
|
4964
4966
|
},
|
|
4965
4967
|
top: {
|
|
4966
4968
|
x: elem.x + elem.w / 2,
|
|
4967
|
-
y: elem.y -
|
|
4969
|
+
y: elem.y - controllerOffset - bw,
|
|
4968
4970
|
invisible: ((_d = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _d === void 0 ? void 0 : _d.disbaleScale) === true,
|
|
4969
4971
|
},
|
|
4970
4972
|
topRight: {
|
|
4971
|
-
x: elem.x + elem.w +
|
|
4972
|
-
y: elem.y -
|
|
4973
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4974
|
+
y: elem.y - controllerOffset - bw,
|
|
4973
4975
|
invisible: hideObliqueDirection || ((_e = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _e === void 0 ? void 0 : _e.disbaleScale) === true,
|
|
4974
4976
|
},
|
|
4975
4977
|
right: {
|
|
4976
|
-
x: elem.x + elem.w +
|
|
4978
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4977
4979
|
y: elem.y + elem.h / 2,
|
|
4978
4980
|
invisible: ((_f = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _f === void 0 ? void 0 : _f.disbaleScale) === true
|
|
4979
4981
|
},
|
|
4980
4982
|
bottomRight: {
|
|
4981
|
-
x: elem.x + elem.w +
|
|
4982
|
-
y: elem.y + elem.h +
|
|
4983
|
+
x: elem.x + elem.w + controllerOffset + bw,
|
|
4984
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4983
4985
|
invisible: hideObliqueDirection || ((_g = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _g === void 0 ? void 0 : _g.disbaleScale) === true,
|
|
4984
4986
|
},
|
|
4985
4987
|
bottom: {
|
|
4986
4988
|
x: elem.x + elem.w / 2,
|
|
4987
|
-
y: elem.y + elem.h +
|
|
4989
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4988
4990
|
invisible: ((_h = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _h === void 0 ? void 0 : _h.disbaleScale) === true,
|
|
4989
4991
|
},
|
|
4990
4992
|
bottomLeft: {
|
|
4991
|
-
x: elem.x -
|
|
4992
|
-
y: elem.y + elem.h +
|
|
4993
|
+
x: elem.x - controllerOffset - bw,
|
|
4994
|
+
y: elem.y + elem.h + controllerOffset + bw,
|
|
4993
4995
|
invisible: hideObliqueDirection || ((_j = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _j === void 0 ? void 0 : _j.disbaleScale) === true,
|
|
4994
4996
|
},
|
|
4995
4997
|
left: {
|
|
4996
|
-
x: elem.x -
|
|
4998
|
+
x: elem.x - controllerOffset - bw,
|
|
4997
4999
|
y: elem.y + elem.h / 2,
|
|
4998
5000
|
invisible: ((_k = elem === null || elem === void 0 ? void 0 : elem.operation) === null || _k === void 0 ? void 0 : _k.disbaleScale) === true
|
|
4999
5001
|
},
|
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var iDrawCore=function(){'use strict';var t=function(){return t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)},e=function(){return e=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function n(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function o(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var i={type:function(t,e){var n=o(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===o(t)},json:function(t){return'Object'===o(t)},function:function(t){return'Function'===o(t)},asyncFunction:function(t){return'AsyncFunction'===o(t)},string:function(t){return'String'===o(t)},number:function(t){return'Number'===o(t)},undefined:function(t){return'Undefined'===o(t)},null:function(t){return'Null'===o(t)},promise:function(t){return'Promise'===o(t)}},r=function(){return r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function s(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function l(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function a(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function c(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var h=window.Image;function u(t){return new Promise((function(e,n){var o=new h;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var f=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=r(r({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=r(r({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function d(t){return'number'==typeof t&&(t>0||t<=0)}function p(t){return'number'==typeof t&&t>=0}function v(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function g(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var m={x:function(t){return d(t)},y:function(t){return d(t)},w:p,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:d,borderWidth:function(t){return p(t)},borderRadius:function(t){return d(t)&&t>=0},color:function(t){return n(t)},imageSrc:function(t){return g(t)||v(t)},imageURL:v,imageBase64:g,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return d(t)&&t>0},lineHeight:function(t){return d(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return d(t)&&t>0}};function y(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!m.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!m.number(n))&&!(t.hasOwnProperty('borderWidth')&&!m.number(o)))}var _={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(m.x(e)&&m.y(n)&&m.w(o)&&m.h(i)&&m.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!m.text(e)&&(!!m.color(n)&&(!!m.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!m.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!m.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!m.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!m.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!m.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!m.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!m.color(h))&&!!y(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!m.color(e))&&!!y(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!m.color(e))&&(!(t.hasOwnProperty('borderColor')&&!m.color(n))&&!(t.hasOwnProperty('borderWidth')&&!m.number(o)))},imageDesc:function(t){var e=t.src;return!!m.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!m.svg(e)},htmlDesc:function(t){var e=t.html;return!!m.html(e)}},S={is:m,check:_,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:u,loadSVG:function(t){return s(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,c(t)];case 1:return[4,u(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return s(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,a(t,e)];case 1:return[4,u(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:n},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:i,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:f},x=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var b=function(){function t(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}},t}(),w=function(){function t(t,e){this._isMoving=!1,this._temp=new b,this._container=window,this._canvas=t,this._isMoving=!1,this._initEvent(),this._event=new x}return t.prototype.setStatusMap=function(t){this._temp.set('statusMap',t)},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype._initEvent=function(){var t=this._canvas,e=this._container;e.addEventListener('mousemove',this._listenWindowMove.bind(this),!1),e.addEventListener('mouseup',this._listenWindowMoveEnd.bind(this),!1),t.addEventListener('mousemove',this._listenHover.bind(this),!1),t.addEventListener('mousedown',this._listenMoveStart.bind(this),!1),t.addEventListener('mousemove',this._listenMove.bind(this),!1),t.addEventListener('mouseup',this._listenMoveEnd.bind(this),!1),t.addEventListener('click',this._listenCanvasClick.bind(this),!1),t.addEventListener('wheel',this._listenCanvasWheel.bind(this),!1),t.addEventListener('mousedown',this._listenCanvasMoveStart.bind(this),!0),t.addEventListener('mouseup',this._listenCanvasMoveEnd.bind(this),!0),t.addEventListener('mouseover',this._listenCanvasMoveOver.bind(this),!0),t.addEventListener('mouseleave',this._listenCanvasMoveLeave.bind(this),!0),this._initParentEvent()},t.prototype._initParentEvent=function(){for(var t=window,e=t.origin;t.self!==t.top&&(t.self!==t.parent&&t.origin===e&&t.parent.window.addEventListener('mousemove',this._listSameOriginParentWindow.bind(this),!1),t=t.parent););},t.prototype._listenHover=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.has('hover')&&this._event.trigger('hover',e),this._isMoving=!0},t.prototype._listenMoveStart=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&(this._event.has('point')&&this._event.trigger('point',e),this._event.has('moveStart')&&this._event.trigger('moveStart',e)),this._isMoving=!0},t.prototype._listenMove=function(t){if(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenMoveEnd=function(t){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._isMoving=!1},t.prototype._listSameOriginParentWindow=function(){this._temp.get('isHoverCanvas')&&this._event.has('leave')&&this._event.trigger('leave',void 0),this._temp.get('isDragCanvas')&&this._event.has('moveEnd')&&this._event.trigger('moveEnd',{x:NaN,y:NaN}),this._isMoving=!1,this._temp.set('isDragCanvas',!1),this._temp.set('isHoverCanvas',!1)},t.prototype._listenCanvasMoveStart=function(){this._temp.get('isHoverCanvas')&&this._temp.set('isDragCanvas',!0)},t.prototype._listenCanvasMoveEnd=function(){this._temp.set('isDragCanvas',!1)},t.prototype._listenCanvasMoveOver=function(){this._temp.set('isHoverCanvas',!0)},t.prototype._listenCanvasMoveLeave=function(){this._temp.set('isHoverCanvas',!1),this._event.has('leave')&&this._event.trigger('leave',void 0)},t.prototype._listenWindowMove=function(t){if(!0===this._temp.get('isDragCanvas')&&(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving)){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenWindowMoveEnd=function(t){if(!0!=!this._temp.get('isDragCanvas')){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._temp.set('isDragCanvas',!1),this._isMoving=!1}},t.prototype._listenCanvasWheel=function(t){this._event.has('wheelX')&&(t.deltaX>0||t.deltaX<0)&&this._event.trigger('wheelX',t.deltaX),this._event.has('wheelY')&&(t.deltaY>0||t.deltaY<0)&&this._event.trigger('wheelY',t.deltaY);var e=this._temp.get('statusMap'),n=e.canScrollYNext,o=e.canScrollYPrev;(t.deltaX>0&&t.deltaX<0||t.deltaY>0&&!0===n||t.deltaY<0&&!0===o)&&t.preventDefault()},t.prototype._listenCanvasClick=function(t){t.preventDefault();var e=this._getPosition(t),n=Date.now();if(this._isVaildPoint(e)){var o=this._temp.get('prevClickPoint');o&&n-o.t<=500&&Math.abs(o.x-e.x)<=5&&Math.abs(o.y-e.y)<=5?this._event.has('doubleClick')&&this._event.trigger('doubleClick',{x:e.x,y:e.y}):this._temp.set('prevClickPoint',{x:e.x,y:e.y,t:n})}},t.prototype._getPosition=function(t){var e=this._canvas,n=0,o=0;if(t&&t.touches&&t.touches.length>0){var i=t.touches[0];i&&(n=i.clientX,o=i.clientY)}else n=t.clientX,o=t.clientY;return{x:n-e.getBoundingClientRect().left,y:o-e.getBoundingClientRect().top,t:Date.now()}},t.prototype._isVaildPoint=function(t){return E(t.x)&&E(t.y)},t}();function E(t){return t>0||t<0||0===t}var P={lineWidth:12,color:'#a0a0a0'},C=function(){function t(t,e){this._displayCtx=t,this._opts=this._getOpts(e)}return t.prototype.draw=function(t){var e=this._opts,n=e.width,o=e.height,i=this.calc(t),r=this._displayCtx;i.xSize>0&&(r.globalAlpha=.2,r.fillStyle=i.color,r.fillRect(0,this._doSize(o-i.lineSize),this._doSize(n),this._doSize(i.lineSize)),r.globalAlpha=1,z(r,{x:this._doSize(i.translateX),y:this._doSize(o-i.lineSize),w:this._doSize(i.xSize),h:this._doSize(i.lineSize),r:this._doSize(i.lineSize/2),color:i.color})),i.ySize>0&&(r.globalAlpha=.2,r.fillStyle=i.color,r.fillRect(this._doSize(n-i.lineSize),0,this._doSize(i.lineSize),this._doSize(o)),r.globalAlpha=1,z(r,{x:this._doSize(n-i.lineSize),y:this._doSize(i.translateY),w:this._doSize(i.lineSize),h:this._doSize(i.ySize),r:this._doSize(i.lineSize/2),color:i.color})),r.globalAlpha=1},t.prototype.resetSize=function(t){this._opts=e(e({},this._opts),t)},t.prototype.isPointAtScrollY=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=this._displayCtx;return r.beginPath(),r.rect(this._doSize(n-i.lineWidth),0,this._doSize(i.lineWidth),this._doSize(o)),r.closePath(),!!r.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.isPointAtScrollX=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=this._displayCtx;return r.beginPath(),r.rect(0,this._doSize(o-i.lineWidth),this._doSize(n-i.lineWidth),this._doSize(i.lineWidth)),r.closePath(),!!r.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.getLineWidth=function(){return this._opts.scrollConfig.lineWidth},t.prototype.calc=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=2.5*i.lineWidth,s=i.lineWidth,l=0,a=0;t.left<=0&&t.right<=0&&(l=Math.max(r,n-(Math.abs(t.left)+Math.abs(t.right))))>=n&&(l=0),(t.top<=0||t.bottom<=0)&&(a=Math.max(r,o-(Math.abs(t.top)+Math.abs(t.bottom))))>=o&&(a=0);var c=0;l>0&&(c=l/2+(n-l)*Math.abs(t.left)/(Math.abs(t.left)+Math.abs(t.right)),c=Math.min(Math.max(0,c-l/2),n-l));var h=0;return a>0&&(h=a/2+(o-a)*Math.abs(t.top)/(Math.abs(t.top)+Math.abs(t.bottom)),h=Math.min(Math.max(0,h-a/2),o-a)),{lineSize:s,xSize:l,ySize:a,translateY:h,translateX:c,color:this._opts.scrollConfig.color}},t.prototype._doSize=function(t){return t*this._opts.devicePixelRatio},t.prototype._getOpts=function(t){var n=e({scrollConfig:P},t);return n.scrollConfig||(n.scrollConfig=P),n.scrollConfig.lineWidth>0||(n.scrollConfig.lineWidth=P.lineWidth),n.scrollConfig.lineWidth=Math.max(n.scrollConfig.lineWidth,P.lineWidth),!0!==S.color.isColorStr(n.scrollConfig.color)&&(n.scrollConfig.color=n.scrollConfig.color),n},t}();function z(t,e){var n=e.x,o=e.y,i=e.w,r=e.h,s=e.color,l=e.r;(i<2*(l=Math.min(l,i/2,r/2))||r<2*l)&&(l=0),t.beginPath(),t.moveTo(n+l,o),t.arcTo(n+i,o,n+i,o+r,l),t.arcTo(n+i,o+r,n,o+r,l),t.arcTo(n,o+r,n,o,l),t.arcTo(n,o,n+i,o,l),t.closePath(),t.fillStyle=s,t.fill()}var D,L=Symbol('_opts'),T=Symbol('_ctx'),M=function(){function t(t,e){this[L]=e,this[T]=t}return t.prototype.resetSize=function(t){this[L]=e(e({},this[L]),t)},t.prototype.calcScreen=function(){var t=this[T].getTransform().scale,e=this[L],n=e.width,o=e.height,i=e.contextWidth,r=e.contextHeight,s=e.devicePixelRatio,l=!0,a=!0,c=!0,h=!0;i*t<=n&&(this[T].setTransform({scrollX:(n-i*t)/2}),l=!1,a=!1),r*t<=o&&(this[T].setTransform({scrollY:(o-r*t)/2}),c=!1,h=!1),i*t>=n&&this[T].getTransform().scrollX>0&&(this[T].setTransform({scrollX:0}),l=!1),r*t>=o&&this[T].getTransform().scrollY>0&&(this[T].setTransform({scrollY:0}),c=!1);var u=this[T].getTransform(),f=u.scrollX,d=u.scrollY;f<0&&Math.abs(f)>Math.abs(i*t-n)&&(this[T].setTransform({scrollX:0-Math.abs(i*t-n)}),a=!1),d<0&&Math.abs(d)>Math.abs(r*t-o)&&(this[T].setTransform({scrollY:0-Math.abs(r*t-o)}),h=!1);var p=this[T].getTransform(),v=p.scrollX,g=p.scrollY;return{size:{x:v*t,y:g*t,w:i*t,h:r*t},position:{top:g,bottom:o-(r*t+g),left:v,right:n-(i*t+v)},deviceSize:{x:v*s,y:g*s,w:i*s*t,h:r*s*t},width:this[L].width,height:this[L].height,devicePixelRatio:this[L].devicePixelRatio,canScrollYPrev:c,canScrollYNext:h,canScrollXPrev:l,canScrollXNext:a}},t.prototype.calcScreenScroll=function(t,e,n,o,i){var r=o-n;t<=0&&e<=0&&(r=Math.abs(t)+Math.abs(e));var s=1;return r>0&&(s=r/(o-n)),0-s*i},t}(),k=Symbol('_canvas'),I=Symbol('_displayCanvas'),W=Symbol('_helperCanvas'),O=Symbol('_mount'),U=Symbol('_opts'),R=Symbol('_hasRendered'),A=Symbol('_ctx'),F=Symbol('_helperCtx'),Y=Symbol('_watcher'),X=Symbol('_render'),N=Symbol('_parsePrivateOptions'),H=Symbol('_scroller'),B=Symbol('_initEvent'),j=Symbol('_doScrollX'),G=Symbol('_doScrollY'),Q=Symbol('_doMoveScroll'),V=Symbol('_resetContext'),$=Symbol('_screen'),Z=S.Context,q=S.time.throttle,J=function(){function t(t,e){this[D]=!1,this[O]=t,this[k]=document.createElement('canvas'),this[W]=document.createElement('canvas'),this[I]=document.createElement('canvas'),this[O].appendChild(this[I]),this[U]=this[N](e);var n=this[k].getContext('2d'),o=this[I].getContext('2d'),i=this[W].getContext('2d');this[A]=new Z(n,this[U]),this[F]=new Z(i,this[U]),this[$]=new M(this[A],this[U]),this[Y]=new w(this[I],this[A]),this[H]=new C(o,{width:e.width,height:e.height,devicePixelRatio:e.devicePixelRatio||1,scrollConfig:e.scrollConfig}),this[X]()}return t.prototype.getDisplayContext2D=function(){return this[I].getContext('2d')},t.prototype.getOriginContext2D=function(){return this[A].getContext()},t.prototype.getHelperContext2D=function(){return this[F].getContext()},t.prototype.getContext=function(){return this[A]},t.prototype.getHelperContext=function(){return this[F]},t.prototype.scale=function(t){t>0&&(this[A].setTransform({scale:t}),this[F].setTransform({scale:t}));var e=this[$].calcScreen();return{position:e.position,size:e.size}},t.prototype.scrollX=function(t){this[Y].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[A].setTransform({scrollX:t}),this[F].setTransform({scrollX:t}));var e=this[$].calcScreen(),n=e.position,o=e.size,i=e.canScrollXNext,r=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[Y].setStatusMap({canScrollYPrev:l,canScrollYNext:r,canScrollXPrev:s,canScrollXNext:i}),{position:n,size:o}},t.prototype.scrollY=function(t){this[Y].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[A].setTransform({scrollY:t}),this[F].setTransform({scrollY:t}));var e=this[$].calcScreen(),n=e.position,o=e.size,i=e.canScrollXNext,r=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[Y].setStatusMap({canScrollYPrev:l,canScrollYNext:r,canScrollXPrev:s,canScrollXNext:i}),{position:n,size:o}},t.prototype.getTransform=function(){return this[A].getTransform()},t.prototype.draw=function(){this.clear();var t=this[$].calcScreen(),e=t.position,n=t.deviceSize,o=t.size,i=this[I].getContext('2d');return null==i||i.drawImage(this[k],n.x,n.y,n.w,n.h),null==i||i.drawImage(this[W],n.x,n.y,n.w,n.h),!0===this[U].canScroll&&this[H].draw(e),{position:e,size:o}},t.prototype.clear=function(){var t=this[I].getContext('2d');null==t||t.clearRect(0,0,this[I].width,this[I].height)},t.prototype.on=function(t,e){this[Y].on(t,e)},t.prototype.off=function(t,e){this[Y].off(t,e)},t.prototype.getScreenInfo=function(){return this[$].calcScreen()},t.prototype.setCursor=function(t){this[I].style.cursor=t},t.prototype.resetCursor=function(){this[I].style.cursor='auto'},t.prototype.resetSize=function(t){this[U]=e(e({},this[U]),t),this[V](),this[A].resetSize(t),this[F].resetSize(t),this[$].resetSize(t),this[H].resetSize({width:this[U].width,height:this[U].height,devicePixelRatio:this[U].devicePixelRatio}),this.draw()},t.prototype.getScrollLineWidth=function(){var t=0;return!0===this[U].canScroll&&(t=this[H].getLineWidth()),t},t.prototype.pointScreenToContext=function(t){var e=this.getTransform(),n=e.scrollX,o=e.scrollY,i=e.scale;return{x:(t.x-n)/i,y:(t.y-o)/i}},t.prototype.pointContextToScreen=function(t){var e=this.getTransform(),n=e.scrollX,o=e.scrollY,i=e.scale;return{x:t.x*i+n,y:t.y*i+o}},t.prototype[(D=R,X)]=function(){!0!==this[R]&&(this[V](),this[B](),this[R]=!0)},t.prototype[V]=function(){var t,n,o,i,r,s,l=this[U],a=l.width,c=l.height,h=l.contextWidth,u=l.contextHeight,f=l.devicePixelRatio;this[k].width=h*f,this[k].height=u*f,this[W].width=h*f,this[W].height=u*f,this[I].width=a*f,this[I].height=c*f,t=this[I],n={width:a+"px",height:c+"px"},o=function(t){var e={};return(t.getAttribute('style')||'').split(';').forEach((function(t){var n=t.split(':');n[0]&&'string'==typeof n[0]&&(e[n[0]]=n[1]||'')})),e}(t),i=e(e({},o),n),r=Object.keys(i),s='',r.forEach((function(t){s+=t+":"+(i[t]||'')+";"})),t.setAttribute('style',s)},t.prototype[N]=function(t){return e(e({},{devicePixelRatio:1}),t)},t.prototype[B]=function(){var t=this;if(!0!==this[R]&&!0===this[U].canScroll){this.on('wheelX',q((function(e){t[j](e)}),16)),this.on('wheelY',q((function(e){t[G](e)}),16));var e=null;this.on('moveStart',q((function(n){t[H].isPointAtScrollX(n)?e='x':t[H].isPointAtScrollY(n)&&(e='y')}),16)),this.on('move',q((function(n){e&&t[Q](e,n)}),16)),this.on('moveEnd',q((function(n){e&&t[Q](e,n),e=null}),16))}},t.prototype[j]=function(t,e){var n=this[U].width,o=e;'number'==typeof o&&(o>0||o<=0)||(o=this[A].getTransform().scrollX);var i=this[$].calcScreen().position,r=this[H].calc(i).xSize,s=this[$].calcScreenScroll(i.left,i.right,r,n,t);this.scrollX(o+s),this.draw()},t.prototype[G]=function(t,e){var n=this[U].height,o=e;'number'==typeof o&&(o>0||o<=0)||(o=this[A].getTransform().scrollY);var i=this[$].calcScreen().position,r=this[H].calc(i).ySize,s=this[$].calcScreenScroll(i.top,i.bottom,r,n,t);this.scrollY(o+s),this.draw()},t.prototype[Q]=function(t,e){if(t){var n=this[$].calcScreen().position,o=this[H].calc(n),i=o.xSize,r=o.ySize;'x'===t?this[j](e.x-i/2,0):'y'===t&&this[G](e.y-r/2,0)}},t}();function K(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function tt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var et={type:function(t,e){var n=tt(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===tt(t)},json:function(t){return'Object'===tt(t)},function:function(t){return'Function'===tt(t)},asyncFunction:function(t){return'AsyncFunction'===tt(t)},string:function(t){return'String'===tt(t)},number:function(t){return'Number'===tt(t)},undefined:function(t){return'Undefined'===tt(t)},null:function(t){return'Null'===tt(t)},promise:function(t){return'Promise'===tt(t)}},nt=function(){return nt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},nt.apply(this,arguments)};function ot(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function it(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function rt(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function st(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var lt=window.Image;function at(t){return new Promise((function(e,n){var o=new lt;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var ct=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=nt(nt({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=nt(nt({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function ht(t){return'number'==typeof t&&(t>0||t<=0)}function ut(t){return'number'==typeof t&&t>=0}function ft(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function dt(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var pt={x:function(t){return ht(t)},y:function(t){return ht(t)},w:ut,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:ht,borderWidth:function(t){return ut(t)},borderRadius:function(t){return ht(t)&&t>=0},color:function(t){return K(t)},imageSrc:function(t){return dt(t)||ft(t)},imageURL:ft,imageBase64:dt,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return ht(t)&&t>0},lineHeight:function(t){return ht(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return ht(t)&&t>0}};function vt(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!pt.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!pt.number(n))&&!(t.hasOwnProperty('borderWidth')&&!pt.number(o)))}var gt={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(pt.x(e)&&pt.y(n)&&pt.w(o)&&pt.h(i)&&pt.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!pt.text(e)&&(!!pt.color(n)&&(!!pt.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!pt.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!pt.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!pt.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!pt.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!pt.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!pt.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!pt.color(h))&&!!vt(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!pt.color(e))&&!!vt(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!pt.color(e))&&(!(t.hasOwnProperty('borderColor')&&!pt.color(n))&&!(t.hasOwnProperty('borderWidth')&&!pt.number(o)))},imageDesc:function(t){var e=t.src;return!!pt.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!pt.svg(e)},htmlDesc:function(t){var e=t.html;return!!pt.html(e)}},mt={is:pt,check:gt,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:at,loadSVG:function(t){return ot(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,st(t)];case 1:return[4,at(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return ot(this,void 0,void 0,(function(){return it(this,(function(n){switch(n.label){case 0:return[4,rt(t,e)];case 1:return[4,at(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:K},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:et,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:ct},yt=function(t,e){return yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},yt(t,e)};var _t=function(){return _t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},_t.apply(this,arguments)};function St(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function xt(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function bt(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function wt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var Et={type:function(t,e){var n=wt(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===wt(t)},json:function(t){return'Object'===wt(t)},function:function(t){return'Function'===wt(t)},asyncFunction:function(t){return'AsyncFunction'===wt(t)},string:function(t){return'String'===wt(t)},number:function(t){return'Number'===wt(t)},undefined:function(t){return'Undefined'===wt(t)},null:function(t){return'Null'===wt(t)},promise:function(t){return'Promise'===wt(t)}},Pt=function(){return Pt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Pt.apply(this,arguments)};function Ct(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function zt(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function Dt(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function Lt(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var Tt=window.Image;function Mt(t){return new Promise((function(e,n){var o=new Tt;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var kt=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=Pt(Pt({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=Pt(Pt({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function It(t){return'number'==typeof t&&(t>0||t<=0)}function Wt(t){return'number'==typeof t&&t>=0}function Ot(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ut(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var Rt={x:function(t){return It(t)},y:function(t){return It(t)},w:Wt,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:It,borderWidth:function(t){return Wt(t)},borderRadius:function(t){return It(t)&&t>=0},color:function(t){return bt(t)},imageSrc:function(t){return Ut(t)||Ot(t)},imageURL:Ot,imageBase64:Ut,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return It(t)&&t>0},lineHeight:function(t){return It(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return It(t)&&t>0}};function At(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!Rt.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!Rt.number(n))&&!(t.hasOwnProperty('borderWidth')&&!Rt.number(o)))}var Ft={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(Rt.x(e)&&Rt.y(n)&&Rt.w(o)&&Rt.h(i)&&Rt.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!Rt.text(e)&&(!!Rt.color(n)&&(!!Rt.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!Rt.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!Rt.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!Rt.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!Rt.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!Rt.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!Rt.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!Rt.color(h))&&!!At(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!Rt.color(e))&&!!At(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!Rt.color(e))&&(!(t.hasOwnProperty('borderColor')&&!Rt.color(n))&&!(t.hasOwnProperty('borderWidth')&&!Rt.number(o)))},imageDesc:function(t){var e=t.src;return!!Rt.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!Rt.svg(e)},htmlDesc:function(t){var e=t.html;return!!Rt.html(e)}},Yt={is:Rt,check:Ft,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:Mt,loadSVG:function(t){return Ct(this,void 0,void 0,(function(){return zt(this,(function(e){switch(e.label){case 0:return[4,Lt(t)];case 1:return[4,Mt(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return Ct(this,void 0,void 0,(function(){return zt(this,(function(n){switch(n.label){case 0:return[4,Dt(t,e)];case 1:return[4,Mt(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:bt},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:Et,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:kt};function Xt(t,e,n){var o=function(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}(e),i=function(t){return t/180*Math.PI}(e.angle||0);return function(t,e,n,o){e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(n),t.translate(-e.x,-e.y));o(t),e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(-n),t.translate(-e.x,-e.y))}(t,o,i||0,n)}var Nt=Yt.is,Ht=Yt.istype,Bt=Yt.color;function jt(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}function Gt(t,e,n){jt(t),function(t,e){jt(t),Xt(t,e,(function(){if(e.desc.borderWidth&&e.desc.borderWidth>0){var n=e.desc.borderWidth,o='#000000';!0===Bt.isColorStr(e.desc.borderColor)&&(o=e.desc.borderColor);var i=e.x-n/2,r=e.y-n/2,s=e.w+n,l=e.h+n,a=e.desc.borderRadius||0;(a=Math.min(a,s/2,l/2))<s/2&&a<l/2&&(a+=n/2);var c=e.desc;void 0!==c.shadowColor&&Bt.isColorStr(c.shadowColor)&&t.setShadowColor(c.shadowColor),void 0!==c.shadowOffsetX&&Nt.number(c.shadowOffsetX)&&t.setShadowOffsetX(c.shadowOffsetX),void 0!==c.shadowOffsetY&&Nt.number(c.shadowOffsetY)&&t.setShadowOffsetY(c.shadowOffsetY),void 0!==c.shadowBlur&&Nt.number(c.shadowBlur)&&t.setShadowBlur(c.shadowBlur),t.beginPath(),t.setLineWidth(n),t.setStrokeStyle(o),t.moveTo(i+a,r),t.arcTo(i+s,r,i+s,r+l,a),t.arcTo(i+s,r+l,i,r+l,a),t.arcTo(i,r+l,i,r,a),t.arcTo(i,r,i+s,r,a),t.closePath(),t.stroke()}}))}(t,e),jt(t),Xt(t,e,(function(){var o=e.x,i=e.y,r=e.w,s=e.h,l=e.desc.borderRadius||0;(r<2*(l=Math.min(l,r/2,s/2))||s<2*l)&&(l=0),t.beginPath(),t.moveTo(o+l,i),t.arcTo(o+r,i,o+r,i+s,l),t.arcTo(o+r,i+s,o,i+s,l),t.arcTo(o,i+s,o,i,l),t.arcTo(o,i,o+r,i,l),t.closePath(),('string'==typeof n||['CanvasPattern'].includes(Ht.type(n)))&&t.setFillStyle(n),t.fill()}))}function Qt(t,e){Gt(t,e,e.desc.bgColor)}function Vt(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}function $t(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}function Zt(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}var qt=Yt.is,Jt=Yt.color;function Kt(t,e,n){jt(t),Gt(t,e,e.desc.bgColor||'transparent'),Xt(t,e,(function(){var n=_t({fontSize:12,fontFamily:'sans-serif',textAlign:'center'},e.desc);t.setFillStyle(e.desc.color),t.setTextBaseline('top'),t.setFont({fontWeight:n.fontWeight,fontSize:n.fontSize,fontFamily:n.fontFamily});var o=n.text.replace(/\r\n/gi,'\n'),i=n.lineHeight||n.fontSize,r=o.split('\n'),s=[];r.forEach((function(n){for(var o='',r=0,l=0;l<n.length&&(t.measureText(o+(n[l]||'')).width<t.calcDeviceNum(e.w)?o+=n[l]||'':(s.push({text:o,width:t.calcScreenNum(t.measureText(o).width)}),o=n[l]||'',r++),!((r+1)*i>e.h));l++)if(o&&n.length-1===l&&(r+1)*i<e.h){s.push({text:o,width:t.calcScreenNum(t.measureText(o).width)});break}}));var l=e.y;if(s.length*i<e.h&&(l+=(e.h-s.length*i)/2),void 0!==n.textShadowColor&&Jt.isColorStr(n.textShadowColor)&&t.setShadowColor(n.textShadowColor),void 0!==n.textShadowOffsetX&&qt.number(n.textShadowOffsetX)&&t.setShadowOffsetX(n.textShadowOffsetX),void 0!==n.textShadowOffsetY&&qt.number(n.textShadowOffsetY)&&t.setShadowOffsetY(n.textShadowOffsetY),void 0!==n.textShadowBlur&&qt.number(n.textShadowBlur)&&t.setShadowBlur(n.textShadowBlur),s.forEach((function(o,r){var s=e.x;'center'===n.textAlign?s=e.x+(e.w-o.width)/2:'right'===n.textAlign&&(s=e.x+(e.w-o.width)),t.fillText(o.text,s,l+i*r)})),jt(t),Jt.isColorStr(n.strokeColor)&&void 0!==n.strokeWidth&&n.strokeWidth>0){var a=e.y;s.length*i<e.h&&(a+=(e.h-s.length*i)/2),s.forEach((function(o,r){var s=e.x;'center'===n.textAlign?s=e.x+(e.w-o.width)/2:'right'===n.textAlign&&(s=e.x+(e.w-o.width)),void 0!==n.strokeColor&&t.setStrokeStyle(n.strokeColor),void 0!==n.strokeWidth&&n.strokeWidth>0&&t.setLineWidth(n.strokeWidth),t.strokeText(o.text,s,a+i*r)}))}}))}function te(t,e){jt(t),Xt(t,e,(function(t){var n=e.x,o=e.y,i=e.w,r=e.h,s=e.desc,l=s.bgColor,a=void 0===l?'#000000':l,c=s.borderColor,h=void 0===c?'#000000':c,u=s.borderWidth,f=void 0===u?0:u,d=i/2,p=r/2,v=n+d,g=o+p;if(f&&f>0){var m=f/2+d,y=f/2+p;t.beginPath(),t.setStrokeStyle(h),t.setLineWidth(f),t.ellipse(v,g,m,y,0,0,2*Math.PI),t.closePath(),t.stroke()}t.beginPath(),t.setFillStyle(a),t.ellipse(v,g,d,p,0,0,2*Math.PI),t.closePath(),t.fill()}))}var ee=Yt.color.isColorStr;function ne(t,e,n){var o;jt(t);var i=t.getSize();if(t.clearRect(0,0,i.contextWidth,i.contextHeight),'string'==typeof e.bgColor&&ee(e.bgColor)&&function(t,e){var n=t.getSize();t.setFillStyle(e),t.fillRect(0,0,n.contextWidth,n.contextHeight)}(t,e.bgColor),e.elements.length>0)for(var r=0;r<e.elements.length;r++){var s=e.elements[r];if(!0!==(null===(o=null==s?void 0:s.operation)||void 0===o?void 0:o.invisible))switch(s.type){case'rect':Qt(t,s);break;case'text':Kt(t,s);break;case'image':Vt(t,s,n);break;case'svg':$t(t,s,n);break;case'html':Zt(t,s,n);break;case'circle':te(t,s)}}}var oe=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var ie,re=Yt.loader,se=re.loadImage,le=re.loadSVG,ae=re.loadHTML,ce=Yt.data.deepClone;!function(t){t.FREE="free",t.LOADING="loading",t.COMPLETE="complete"}(ie||(ie={}));var he,ue,fe,de,pe=function(){function t(t){this._currentLoadData={},this._currentUUIDQueue=[],this._storageLoadData={},this._status=ie.FREE,this._waitingLoadQueue=[],this._opts=t,this._event=new oe,this._waitingLoadQueue=[]}return t.prototype.load=function(t,e){var n=this._resetLoadData(t,e),o=n[0],i=n[1];this._status===ie.FREE||this._status===ie.COMPLETE?(this._currentUUIDQueue=o,this._currentLoadData=i,this._loadTask()):this._status===ie.LOADING&&o.length>0&&this._waitingLoadQueue.push({uuidQueue:o,loadData:i})},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype.isComplete=function(){return this._status===ie.COMPLETE},t.prototype.getContent=function(t){var e;return'loaded'===(null===(e=this._storageLoadData[t])||void 0===e?void 0:e.status)?this._storageLoadData[t].content:null},t.prototype._resetLoadData=function(t,e){for(var n={},o=[],i=this._storageLoadData,r=t.elements.length-1;r>=0;r--){var s=t.elements[r];['image','svg','html'].includes(s.type)&&(i[s.uuid]?e.includes(s.uuid)&&(n[s.uuid]=this._createEmptyLoadItem(s),o.push(s.uuid)):(n[s.uuid]=this._createEmptyLoadItem(s),o.push(s.uuid)))}return[o,n]},t.prototype._createEmptyLoadItem=function(t){var e='',n=t.type,o=t.w,i=t.h;if('image'===t.type)e=(r=t).desc.src||'';else if('svg'===t.type){e=(r=t).desc.svg||''}else if('html'===t.type){var r;e=function(t){return t.replace(/<script[\s\S]*?<\/script>/gi,'')}((r=t).desc.html||''),o=r.desc.width||t.w,i=r.desc.height||t.h}return{uuid:t.uuid,type:n,status:'null',content:null,source:e,elemW:o,elemH:i,element:ce(t)}},t.prototype._loadTask=function(){var t=this;if(this._status!==ie.LOADING){if(this._status=ie.LOADING,0===this._currentUUIDQueue.length){if(0===this._waitingLoadQueue.length)return this._status=ie.COMPLETE,void this._event.trigger('complete',void 0);var e=this._waitingLoadQueue.shift();if(e){var n=e.uuidQueue,o=e.loadData;this._currentLoadData=o,this._currentUUIDQueue=n}}var i=this._opts.maxParallelNum,r=this._currentUUIDQueue.splice(0,i),s={};r.forEach((function(t,e){s[t]=e}));var l=[],a=function(){if(l.length>=i)return!1;if(0===r.length)return!0;for(var e=function(e){var n=r.shift();if(void 0===n)return"break";l.push(n),t._loadElementSource(t._currentLoadData[n]).then((function(e){var o,i;l.splice(l.indexOf(n),1);var s=a();t._storageLoadData[n]={uuid:n,type:t._currentLoadData[n].type,status:'loaded',content:e,source:t._currentLoadData[n].source,elemW:t._currentLoadData[n].elemW,elemH:t._currentLoadData[n].elemH,element:t._currentLoadData[n].element},0===l.length&&0===r.length&&!0===s&&(t._status=ie.FREE,t._loadTask()),t._event.trigger('load',{uuid:null===(o=t._storageLoadData[n])||void 0===o?void 0:o.uuid,type:t._storageLoadData[n].type,status:t._storageLoadData[n].status,content:t._storageLoadData[n].content,source:t._storageLoadData[n].source,elemW:t._storageLoadData[n].elemW,elemH:t._storageLoadData[n].elemH,element:null===(i=t._storageLoadData[n])||void 0===i?void 0:i.element})})).catch((function(e){var o,i,s,c,h,u,f,d,p,v,g,m;console.warn(e),l.splice(l.indexOf(n),1);var y=a();t._currentLoadData[n]&&(t._storageLoadData[n]={uuid:n,type:null===(o=t._currentLoadData[n])||void 0===o?void 0:o.type,status:'fail',content:null,error:e,source:null===(i=t._currentLoadData[n])||void 0===i?void 0:i.source,elemW:null===(s=t._currentLoadData[n])||void 0===s?void 0:s.elemW,elemH:null===(c=t._currentLoadData[n])||void 0===c?void 0:c.elemH,element:null===(h=t._currentLoadData[n])||void 0===h?void 0:h.element}),0===l.length&&0===r.length&&!0===y&&(t._status=ie.FREE,t._loadTask()),t._currentLoadData[n]&&t._event.trigger('error',{uuid:n,type:null===(u=t._storageLoadData[n])||void 0===u?void 0:u.type,status:null===(f=t._storageLoadData[n])||void 0===f?void 0:f.status,content:null===(d=t._storageLoadData[n])||void 0===d?void 0:d.content,source:null===(p=t._storageLoadData[n])||void 0===p?void 0:p.source,elemW:null===(v=t._storageLoadData[n])||void 0===v?void 0:v.elemW,elemH:null===(g=t._storageLoadData[n])||void 0===g?void 0:g.elemH,element:null===(m=t._storageLoadData[n])||void 0===m?void 0:m.element})}))},n=l.length;n<i;n++){if("break"===e())break}return!1};a()}},t.prototype._loadElementSource=function(t){return St(this,void 0,void 0,(function(){return xt(this,(function(e){switch(e.label){case 0:return t&&'image'===t.type?[4,se(t.source)]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return t&&'svg'===t.type?[4,le(t.source)]:[3,4];case 4:return t&&'html'===t.type?[4,ae(t.source,{width:t.elemW,height:t.elemH})]:[3,6];case 6:throw Error('Element\'s source is not support!')}}))}))},t}(),ve=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}(),ge=Symbol('_queue'),me=Symbol('_ctx'),ye=Symbol('_status'),_e=Symbol('_loader'),Se=Symbol('_opts'),xe=Symbol('_freeze'),be=Symbol('_drawFrame'),we=Symbol('_retainQueueOneItem'),Ee=window.requestAnimationFrame,Pe=Yt.uuid.createUUID,Ce=Yt.data.deepClone,ze=Yt.Context;!function(t){t.NULL="null",t.FREE="free",t.DRAWING="drawing",t.FREEZE="freeze"}(de||(de={}));var De=function(t){function e(e){var n=t.call(this)||this;return n[he]=[],n[ue]=null,n[fe]=de.NULL,n[Se]=e,n[_e]=new pe({maxParallelNum:6}),n[_e].on('load',(function(t){n[be](),n.trigger('load',{element:t.element})})),n[_e].on('error',(function(t){n.trigger('error',{element:t.element,error:t.error})})),n[_e].on('complete',(function(){n.trigger('loadComplete',{t:Date.now()})})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}yt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.render=function(t,e,n){var o=(n||{}).changeResourceUUIDs,i=void 0===o?[]:o;this[ye]=de.FREE;var r=Ce(e);if(Array.isArray(r.elements)&&r.elements.forEach((function(t){'string'==typeof t.uuid&&t.uuid||(t.uuid=Pe())})),!this[me])if(this[Se]&&'[object HTMLCanvasElement]'===Object.prototype.toString.call(t)){var s=this[Se],l=s.width,a=s.height,c=s.contextWidth,h=s.contextHeight,u=s.devicePixelRatio,f=t;f.width=l*u,f.height=a*u;var d=f.getContext('2d');this[me]=new ze(d,{width:l,height:a,contextWidth:c||l,contextHeight:h||a,devicePixelRatio:u})}else t&&(this[me]=t);if(![de.FREEZE].includes(this[ye])){var p=Ce({data:r});this[ge].push(p),this[be](),this[_e].load(r,i||[])}},e.prototype.getContext=function(){return this[me]},e.prototype.thaw=function(){this[ye]=de.FREE},e.prototype[(he=ge,ue=me,fe=ye,xe)]=function(){this[ye]=de.FREEZE},e.prototype[be]=function(){var t=this;this[ye]!==de.FREEZE&&Ee((function(){if(t[ye]!==de.FREEZE){var e=t[me],n=t[ge][0],o=!1;t[ge].length>1?n=t[ge].shift():o=!0,!0!==t[_e].isComplete()?(t[be](),n&&e&&ne(e,n.data,t[_e])):n&&e?(ne(e,n.data,t[_e]),t[we](),o?t[ye]=de.FREE:t[be]()):t[ye]=de.FREE,t.trigger('drawFrame',{t:Date.now()}),!0===t[_e].isComplete()&&1===t[ge].length&&t[ye]===de.FREE&&(e&&t[ge][0]&&t[ge][0].data&&ne(e,t[ge][0].data,t[_e]),t.trigger('drawFrameComplete',{t:Date.now()}),t[xe]())}}))},e.prototype[we]=function(){if(!(this[ge].length<=1)){var t=Ce(this[ge][this[ge].length-1]);this[ge]=[t]}},e}(ve),Le=mt.color.isColorStr;function Te(t){return'number'==typeof t&&(t>0||t<=0)}function Me(t){return'number'==typeof t&&t>=0}function ke(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ie(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var We={x:function(t){return Te(t)},y:function(t){return Te(t)},w:Me,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:Te,borderWidth:function(t){return Me(t)},borderRadius:function(t){return Te(t)&&t>=0},color:function(t){return Le(t)},imageSrc:function(t){return Ie(t)||ke(t)},imageURL:ke,imageBase64:Ie,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return Te(t)&&t>0},lineHeight:function(t){return Te(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return Te(t)&&t>0}};function Oe(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!We.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!We.number(n))&&!(t.hasOwnProperty('borderWidth')&&!We.number(o)))}var Ue={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(We.x(e)&&We.y(n)&&We.w(o)&&We.h(i)&&We.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!We.text(e)&&(!!We.color(n)&&(!!We.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!We.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!We.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!We.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!We.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!We.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!We.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!We.color(h))&&!!Oe(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!We.color(e))&&!!Oe(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!We.color(e))&&(!(t.hasOwnProperty('borderColor')&&!We.color(n))&&!(t.hasOwnProperty('borderWidth')&&!We.number(o)))},imageDesc:function(t){var e=t.src;return!!We.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!We.svg(e)},htmlDesc:function(t){var e=t.html;return!!We.html(e)}};function Re(t){return t/180*Math.PI}function Ae(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function Fe(t,e){var n=e.x-t.x,o=t.y-e.y;if(0===n){if(o<0)return Math.PI/2;if(o>0)return 1.5*Math.PI}else if(0===o){if(n<0)return Math.PI;if(n>0)return 0}return n>0&&o<0?Math.atan(Math.abs(o)/Math.abs(n)):n<0&&o<0?Math.PI-Math.atan(Math.abs(o)/Math.abs(n)):n<0&&o>0?Math.PI+Math.atan(Math.abs(o)/Math.abs(n)):n>0&&o>0?2*Math.PI-Math.atan(Math.abs(o)/Math.abs(n)):null}var Ye={elementWrapper:{color:'#2ab6f1',lockColor:'#aaaaaa',controllerSize:6,lineWidth:1,lineDash:[4,3]}};var Xe=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();function Ne(t,e){var n,o;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.src)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.src)}function He(t,e){var n,o;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.svg)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.svg)}function Be(t,e){var n,o,i,r,s,l;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.html)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.html)||(null===(i=null==t?void 0:t.desc)||void 0===i?void 0:i.width)!==(null===(r=null==e?void 0:e.desc)||void 0===r?void 0:r.width)||(null===(s=null==t?void 0:t.desc)||void 0===s?void 0:s.height)!==(null===(l=null==e?void 0:e.desc)||void 0===l?void 0:l.height)}function je(t,e){var n=null,o=!1;switch(e.type){case'image':o=Ne(t,e);break;case'svg':o=He(t,e);break;case'html':o=Be(t,e)}return!0===o&&(n=e.uuid),n}function Ge(t){var e={};return t.elements.forEach((function(t){e[t.uuid]=t})),e}function Qe(t,e,n){return Ve(t,Ae(e),Re(e.angle||0)||0,n)}function Ve(t,e,n,o){e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(n),t.translate(-e.x,-e.y)),o(t),e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(-n),t.translate(-e.x,-e.y))}function $e(t){var e=t.toFixed(2);return parseFloat(e)}function Ze(t){return $e(t%360)}var qe=Object.keys({text:{},rect:{},image:{},svg:{},circle:{},html:{}}),Je=mt.uuid.createUUID,Ke=15,tn=function(){function t(t){this._ctx=t}return t.prototype.initData=function(t){return t.elements.forEach((function(t){t.uuid&&'string'==typeof t.uuid||(t.uuid=Je())})),t},t.prototype.isPointInElement=function(t,e){for(var n,o,i=this._ctx,r=-1,s=null,l=function(l){var a=e.elements[l];if(!0===(null===(n=a.operation)||void 0===n?void 0:n.invisible))return"continue";var c=0;return(null===(o=a.desc)||void 0===o?void 0:o.borderWidth)>0&&(c=a.desc.borderWidth),Qe(i,a,(function(){i.beginPath(),i.moveTo(a.x-c,a.y-c),i.lineTo(a.x+a.w+c,a.y-c),i.lineTo(a.x+a.w+c,a.y+a.h+c),i.lineTo(a.x-c,a.y+a.h+c),i.lineTo(a.x-c,a.y-c),i.closePath(),i.isPointInPath(t.x,t.y)&&(r=l,s=a.uuid)})),r>=0?"break":void 0},a=e.elements.length-1;a>=0;a--){if("break"===l(a))break}return[r,s]},t.prototype.dragElement=function(t,e,n,o,i){var r=this.getElementIndex(t,e);if(t.elements[r]){var s=n.x-o.x,l=n.y-o.y;t.elements[r].x+=s/i,t.elements[r].y+=l/i,this.limitElementAttrs(t.elements[r])}},t.prototype.transformElement=function(t,e,n,o,i,r){var s,l,a=this.getElementIndex(t,e);if(!t.elements[a])return null;if(!0===(null===(l=null===(s=t.elements[a])||void 0===s?void 0:s.operation)||void 0===l?void 0:l.lock))return null;var c=(n.x-o.x)/i,h=(n.y-o.y)/i,u=t.elements[a];if(['top-left','top','top-right','right','bottom-right','bottom','bottom-left','left'].includes(r)){var f=function(t,e,n,o,i){var r={x:t.x,y:t.y,w:t.w,h:t.h};switch(t.angle,o){case'top-left':t.w-e>0&&t.h-n>0&&(r.x+=e,r.y+=n,r.w-=e,r.h-=n);break;case'top':if(0===t.angle||Math.abs(t.angle)<Ke)r.h-n>0&&(r.y+=n,r.h-=n);else if(t.angle>0||t.angle<0){var s=t.angle>0?t.angle:Math.max(0,t.angle+360),l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(s<90){l=0-on(l,n);var h=en(s);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(s<180){l=on(l,e);h=en(s-90);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(s<270){l=on(l,n);h=en(s-180);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(s<360){l=0-on(l,e);h=en(s-270);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}r.h+l>0&&(r.h=r.h+l,r.x=a-r.w/2,r.y=c-r.h/2)}else r.h-n>0&&(r.y+=n,r.h-=n);break;case'top-right':r.h-n>0&&r.w+e>0&&(r.y+=n,r.w+=e,r.h-=n);break;case'right':if(0===t.angle||Math.abs(t.angle)<Ke)t.w+e>0&&(r.w+=e);else if(t.angle>0||t.angle<0){var u=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(u<90){l=on(l,n);h=en(u);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(u<180){l=on(l,n);h=en(u-90);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(u<270){l=on(l,n);h=en(u-180);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h),l=0-l}else if(u<360){l=on(l,e);h=en(u-270);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}r.w+l>0&&(r.w=r.w+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.w+e>0&&(r.w+=e);break;case'bottom-right':t.w+e>0&&t.h+n>0&&(r.w+=e,r.h+=n);break;case'bottom':if(0===t.angle||Math.abs(t.angle)<Ke)t.h+n>0&&(r.h+=n);else if(t.angle>0||t.angle<0){var f=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(f<90){l=on(l,n);h=en(f);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(f<180){l=0-on(l,e);h=en(f-90);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}else if(f<270){l=on(l,e);h=en(f-180);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(f<360){l=on(l,e);h=en(f-270);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}r.h+l>0&&(r.h=r.h+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.h+n>0&&(r.h+=n);break;case'bottom-left':t.w-e>0&&t.h+n>0&&(r.x+=e,r.w-=e,r.h+=n);break;case'left':if(0===t.angle||Math.abs(t.angle)<Ke)t.w-e>0&&(r.x+=e,r.w-=e);else if(t.angle>0||t.angle<0){var d=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(d<90){l=0-on(l,e);h=en(d);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}else if(d<180){l=on(l,e);h=en(d-90);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(d<270){l=on(l,n);h=en(d-180);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(d<360){l=on(l,n);var p;h=en(d-270);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}r.w+l>0&&(r.w=r.w+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.w-e>0&&(r.x+=e,r.w-=e)}return r}(u,c,h,r);u.x=f.x,u.y=f.y,u.w=f.w,u.h=f.h}else if('rotate'===r){var d=function(t,e,n){var o=Fe(t,e),i=Fe(t,n);return null!==i&&null!==o?o>3*Math.PI/2&&i<Math.PI/2?i+(2*Math.PI-o):i>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-i):i-o:0}(Ae(u),o,n);u.angle=(u.angle||0)+function(t){return t/Math.PI*180}(d)}return this.limitElementAttrs(u),{width:$e(u.w),height:$e(u.h),angle:Ze(u.angle||0)}},t.prototype.getElementIndex=function(t,e){for(var n=-1,o=0;o<t.elements.length;o++)if(t.elements[o].uuid===e){n=o;break}return n},t.prototype.limitElementAttrs=function(t){t.x=$e(t.x),t.y=$e(t.y),t.w=$e(t.w),t.h=$e(t.h),t.angle=Ze(t.angle||0)},t}();function en(t){return t*Math.PI/180}function nn(t,e){return Math.sqrt(t*t+e*e)}function on(t,e){return e>0?Math.abs(t):0-Math.abs(t)}var rn=mt.data.deepClone,sn=function(){function t(t,e){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._board=t,this._ctx=this._board.getContext(),this._coreConfig=e,this._helperConfig={elementIndexMap:{}}}return t.prototype.updateConfig=function(t,e){this._updateElementIndex(t),this._updateSelectedElementWrapper(t,e),this._updateSelectedElementListWrapper(t,e)},t.prototype.getConfig=function(){return rn(this._helperConfig)},t.prototype.getElementIndexByUUID=function(t){var e=this._helperConfig.elementIndexMap[t];return e>=0?e:null},t.prototype.isPointInElementWrapperController=function(t,e){var n,o,i=this._ctx,r=(null===(o=null===(n=this._helperConfig)||void 0===n?void 0:n.selectedElementWrapper)||void 0===o?void 0:o.uuid)||null,s=null,l=null,a=null;if(!this._helperConfig.selectedElementWrapper)return{uuid:r,selectedControllerDirection:l,directIndex:s,hoverControllerDirection:a};var c=this._helperConfig.selectedElementWrapper,h=[c.controllers.right,c.controllers.topRight,c.controllers.top,c.controllers.topLeft,c.controllers.left,c.controllers.bottomLeft,c.controllers.bottom,c.controllers.bottomRight],u=['right','top-right','top','top-left','left','bottom-left','bottom','bottom-right'],f=mt.data.deepClone(u),d=0;if(e&&r){var p=this.getElementIndexByUUID(r);if(null!==p&&p>=0){var v=e.elements[p].angle;v<0&&(v+=360),v<45?d=0:v<90?d=1:v<135?d=2:v<180?d=3:v<225?d=4:v<270?d=5:v<315&&(d=6)}}if(d>0&&(f=f.slice(-d).concat(f.slice(0,-d))),Ve(i,c.translate,c.radian||0,(function(){for(var e=0;e<h.length;e++){var n=h[e];if(!0!==n.invisible&&(i.beginPath(),i.arc(n.x,n.y,c.controllerSize,0,2*Math.PI),i.closePath(),i.isPointInPath(t.x,t.y)&&(l=u[e],a=f[e]),l)){s=e;break}}})),null===l){var g=c.controllers.rotate;!0!==g.invisible&&Ve(i,c.translate,c.radian||0,(function(){i.beginPath(),i.arc(g.x,g.y,c.controllerSize,0,2*Math.PI),i.closePath(),i.isPointInPath(t.x,t.y)&&(l='rotate',a='rotate')}))}return{uuid:r,selectedControllerDirection:l,hoverControllerDirection:a,directIndex:s}},t.prototype.isPointInElementList=function(t,e){for(var n,o,i,r=this._ctx,s=-1,l=null,a=(null===(n=this._helperConfig)||void 0===n?void 0:n.selectedElementListWrappers)||[],c=function(n){var c=a[n],u=h._helperConfig.elementIndexMap[c.uuid],f=e.elements[u];if(!f)return"continue";if(!0===(null===(o=f.operation)||void 0===o?void 0:o.invisible))return"continue";var d=0;return(null===(i=f.desc)||void 0===i?void 0:i.borderWidth)>0&&(d=f.desc.borderWidth),Qe(r,f,(function(){r.beginPath(),r.moveTo(f.x-d,f.y-d),r.lineTo(f.x+f.w+d,f.y-d),r.lineTo(f.x+f.w+d,f.y+f.h+d),r.lineTo(f.x-d,f.y+f.h+d),r.lineTo(f.x-d,f.y-d),r.closePath(),r.isPointInPath(t.x,t.y)&&(s=n,l=f.uuid)})),s>=0?"break":void 0},h=this,u=0;u<a.length;u++){if("break"===c(u))break}return!!(l&&s>=0)},t.prototype.startSelectArea=function(t){this._areaStart=t,this._areaEnd=t},t.prototype.changeSelectArea=function(t){this._areaEnd=t,this._calcSelectedArea()},t.prototype.clearSelectedArea=function(){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._calcSelectedArea()},t.prototype.calcSelectedElements=function(t){var e=this._ctx.getTransform(),n=e.scale,o=void 0===n?1:n,i=e.scrollX,r=void 0===i?0:i,s=e.scrollY,l=void 0===s?0:s,a=this._areaStart,c=this._areaEnd,h=(Math.min(a.x,c.x)-r)/o,u=(Math.min(a.y,c.y)-l)/o,f=Math.abs(c.x-a.x)/o,d=Math.abs(c.y-a.y)/o,p=[],v=this._ctx;return v.beginPath(),v.moveTo(h,u),v.lineTo(h+f,u),v.lineTo(h+f,u+d),v.lineTo(h,u+d),v.lineTo(h,u),v.closePath(),t.elements.forEach((function(t){var e;if(!0!==(null===(e=null==t?void 0:t.operation)||void 0===e?void 0:e.invisible)){var n=t.x+t.w/2,o=t.y+t.h/2;v.isPointInPathWithoutScroll(n,o)&&p.push(t.uuid)}})),p},t.prototype._calcSelectedArea=function(){var t=this._areaStart,e=this._areaEnd,n=this._ctx.getTransform(),o=n.scale,i=void 0===o?1:o,r=n.scrollX,s=void 0===r?0:r,l=n.scrollY,a=void 0===l?0:l,c=this._coreConfig.elementWrapper,h=c.lineWidth/i,u=c.lineDash.map((function(t){return t/i}));this._helperConfig.selectedAreaWrapper={x:(Math.min(t.x,e.x)-s)/i,y:(Math.min(t.y,e.y)-a)/i,w:Math.abs(e.x-t.x)/i,h:Math.abs(e.y-t.y)/i,startPoint:{x:t.x,y:t.y},endPoint:{x:e.x,y:e.y},lineWidth:h,lineDash:u,color:c.color}},t.prototype._updateElementIndex=function(t){var e=this;this._helperConfig.elementIndexMap={},t.elements.forEach((function(t,n){e._helperConfig.elementIndexMap[t.uuid]=n}))},t.prototype._updateSelectedElementWrapper=function(t,e){var n,o=e.selectedUUID;if('string'==typeof o&&this._helperConfig.elementIndexMap[o]>=0){var i=this._helperConfig.elementIndexMap[o],r=t.elements[i];if(!0!==(null===(n=null==r?void 0:r.operation)||void 0===n?void 0:n.invisible)){var s=this._createSelectedElementWrapper(r,e);this._helperConfig.selectedElementWrapper=s}}else delete this._helperConfig.selectedElementWrapper},t.prototype._updateSelectedElementListWrapper=function(t,e){var n=this,o=e.selectedUUIDList,i=[];t.elements.forEach((function(t,r){if(null==o?void 0:o.includes(t.uuid)){var s=n._createSelectedElementWrapper(t,e);i.push(s)}})),this._helperConfig.selectedElementListWrappers=i},t.prototype._createSelectedElementWrapper=function(t,e){var n,o,i,r,s,l,a,c,h,u,f,d,p=e.scale,v=this._coreConfig.elementWrapper,g=v.controllerSize/p,m=v.lineWidth/p,y=v.lineDash.map((function(t){return t/p})),_=(null===(n=t.desc)||void 0===n?void 0:n.borderWidth)||0,S=!1;'number'==typeof t.angle&&Math.abs(t.angle)>15&&(S=!0);var x={uuid:t.uuid,controllerSize:g,lock:!0===(null===(o=null==t?void 0:t.operation)||void 0===o?void 0:o.lock),controllers:{topLeft:{x:t.x-g-_,y:t.y-g-_,invisible:S||!0===(null===(i=null==t?void 0:t.operation)||void 0===i?void 0:i.disbaleScale)},top:{x:t.x+t.w/2,y:t.y-g-_,invisible:!0===(null===(r=null==t?void 0:t.operation)||void 0===r?void 0:r.disbaleScale)},topRight:{x:t.x+t.w+g+_,y:t.y-g-_,invisible:S||!0===(null===(s=null==t?void 0:t.operation)||void 0===s?void 0:s.disbaleScale)},right:{x:t.x+t.w+g+_,y:t.y+t.h/2,invisible:!0===(null===(l=null==t?void 0:t.operation)||void 0===l?void 0:l.disbaleScale)},bottomRight:{x:t.x+t.w+g+_,y:t.y+t.h+g+_,invisible:S||!0===(null===(a=null==t?void 0:t.operation)||void 0===a?void 0:a.disbaleScale)},bottom:{x:t.x+t.w/2,y:t.y+t.h+g+_,invisible:!0===(null===(c=null==t?void 0:t.operation)||void 0===c?void 0:c.disbaleScale)},bottomLeft:{x:t.x-g-_,y:t.y+t.h+g+_,invisible:S||!0===(null===(h=null==t?void 0:t.operation)||void 0===h?void 0:h.disbaleScale)},left:{x:t.x-g-_,y:t.y+t.h/2,invisible:!0===(null===(u=null==t?void 0:t.operation)||void 0===u?void 0:u.disbaleScale)},rotate:{x:t.x+t.w/2,y:t.y-g-(2*g+12)-_,invisible:!0===(null===(f=null==t?void 0:t.operation)||void 0===f?void 0:f.disbaleRotate)}},lineWidth:m,lineDash:y,color:!0===(null===(d=null==t?void 0:t.operation)||void 0===d?void 0:d.lock)?v.lockColor:v.color};return'number'==typeof t.angle&&(t.angle>0||t.angle<0)&&(x.radian=Re(t.angle),x.translate=Ae(t)),x},t}(),ln=Symbol('_displayCtx'),an=Symbol('_helper'),cn=Symbol('_element'),hn=Symbol('_opts'),un=function(){function t(t){this[hn]=t,this[ln]=this[hn].board,this[cn]=this[hn].element,this[an]=this[hn].helper}return t.prototype.isEffectivePoint=function(t){var e=this[ln].getScrollLineWidth(),n=this[ln].getScreenInfo();return t.x<=n.width-e&&t.y<=n.height-e},t.prototype.judgePointCursor=function(t,e){var n='auto',o=null;if(!this.isEffectivePoint(t))return{cursor:n,elementUUID:o};var i=this[an].isPointInElementWrapperController(t,e),r=i.uuid,s=i.hoverControllerDirection;if(r&&s){switch(s){case'top-right':n='ne-resize';break;case'top-left':n='nw-resize';break;case'top':n='n-resize';break;case'right':n='e-resize';break;case'bottom-right':n='se-resize';break;case'bottom':n='s-resize';break;case'bottom-left':n='sw-resize';break;case'left':n='w-resize';break;case'rotate':n='grab'}r&&(o=r)}else{var l=this[cn].isPointInElement(t,e),a=l[0],c=l[1];a>=0&&(n='move'),c&&(o=c)}return{cursor:n,elementUUID:o}},t}();function fn(t){var e={elements:[]};return Array.isArray(null==t?void 0:t.elements)&&(null==t||t.elements.forEach((function(t){void 0===t&&(t={}),function(t){if(!(dn(t.x)&&dn(t.y)&&dn(t.w)&&dn(t.h)))return!1;if('string'!=typeof t.type||!qe.includes(t.type))return!1;return!0}(t)&&e.elements.push(t)}))),'string'==typeof t.bgColor&&(e.bgColor=t.bgColor),e}function dn(t){return t>=0||t<0}var pn,vn,gn=function(){function t(){this._temp={hasInited:!1}}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp={hasInited:!1}},t}(),mn=Symbol('_board'),yn=Symbol('_data'),_n=Symbol('_opts'),Sn=Symbol('_config'),xn=Symbol('_renderer'),bn=Symbol('_element'),wn=Symbol('_tempData'),En=Symbol('_draw'),Pn=Symbol('_coreEvent'),Cn=Symbol('_emitChangeScreen'),zn=Symbol('_emitChangeData'),Dn=Symbol('_engine');!function(t){t.NULL="null",t.SELECT_ELEMENT="select-element",t.SELECT_ELEMENT_LIST="select-element-list",t.SELECT_ELEMENT_WRAPPER_CONTROLLER="select-element-wrapper-controller",t.SELECT_AREA="select-area"}(pn||(pn={})),function(t){t.DRAGGING="dragging",t.NULL="null"}(vn||(vn={}));var Ln=mt.data.deepClone,Tn=mt.uuid.createUUID;function Mn(){return{hasInited:!1,mode:pn.NULL,cursorStatus:vn.NULL,selectedUUID:null,selectedUUIDList:[],hoverUUID:null,selectedControllerDirection:null,hoverControllerDirection:null,prevPoint:null}}var kn=function(){function t(){this._temp=Mn()}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp=Mn()},t}(),In=mt.time,Wn=mt.data.deepClone,On=function(){function t(t){this._plugins=[];var e=t.board,n=t.config,o=t.element,i=new sn(e,n);this._opts=t,this.temp=new kn,this.helper=i,this._mapper=new un({board:e,helper:i,element:o})}return t.prototype.addPlugin=function(t){this._plugins.push(t)},t.prototype.getHelperConfig=function(){return this.helper.getConfig()},t.prototype.updateHelperConfig=function(t){var e,n=this._opts,o=n.board,i=n.getDataFeekback,r=n.config,s=i(),l=o.getTransform();this.helper.updateConfig(s,{width:t.width,height:t.height,devicePixelRatio:t.devicePixelRatio,canScroll:!0===(null===(e=null==r?void 0:r.scrollWrapper)||void 0===e?void 0:e.use),selectedUUID:this.temp.get('selectedUUID'),selectedUUIDList:this.temp.get('selectedUUIDList'),scale:l.scale,scrollX:l.scrollX,scrollY:l.scrollY})},t.prototype.init=function(){this._initEvent()},t.prototype._initEvent=function(){if(!0!==this.temp.get('hasInited')){var t=this._opts.board;t.on('hover',In.throttle(this._handleHover.bind(this),32)),t.on('leave',In.throttle(this._handleLeave.bind(this),32)),t.on('point',In.throttle(this._handleClick.bind(this),16)),t.on('doubleClick',this._handleDoubleClick.bind(this)),t.on('point',this._handlePoint.bind(this)),t.on('moveStart',this._handleMoveStart.bind(this)),t.on('move',In.throttle(this._handleMove.bind(this),16)),t.on('moveEnd',this._handleMoveEnd.bind(this))}},t.prototype._handleDoubleClick=function(t){var e,n,o,i=this._opts,r=i.element,s=i.getDataFeekback,l=i.drawFeekback,a=i.coreEvent,c=s(),h=r.isPointInElement(t,c),u=h[0],f=h[1];if(u>=0&&f){var d=Wn(null===(e=c.elements)||void 0===e?void 0:e[u]);!0!==(null===(n=null==d?void 0:d.operation)||void 0===n?void 0:n.invisible)&&a.trigger('screenDoubleClickElement',{index:u,uuid:f,element:Wn(null===(o=c.elements)||void 0===o?void 0:o[u])})}l()},t.prototype._handlePoint=function(t){var e,n,o;if(this._mapper.isEffectivePoint(t)){var i=this._opts,r=i.element,s=i.getDataFeekback,l=i.selectElementByIndex,a=i.coreEvent,c=i.emitChangeScreen,h=i.drawFeekback,u=this.helper,f=s();if(u.isPointInElementList(t,f))this.temp.set('mode',pn.SELECT_ELEMENT_LIST);else{var d=u.isPointInElementWrapperController(t,f),p=d.uuid,v=d.selectedControllerDirection;if(p&&v)this.temp.set('mode',pn.SELECT_ELEMENT_WRAPPER_CONTROLLER),this.temp.set('selectedControllerDirection',v),this.temp.set('selectedUUID',p);else{var g=r.isPointInElement(t,f),m=g[0],y=g[1];m>=0&&!0!==(null===(n=null===(e=f.elements[m])||void 0===e?void 0:e.operation)||void 0===n?void 0:n.invisible)?(l(m,{useMode:!0}),'string'==typeof y&&a.has('screenSelectElement')&&(a.trigger('screenSelectElement',{index:m,uuid:y,element:Wn(null===(o=f.elements)||void 0===o?void 0:o[m])}),c()),this.temp.set('mode',pn.SELECT_ELEMENT)):(this.temp.set('selectedUUIDList',[]),this.temp.set('selectedUUID',null),this.temp.set('mode',pn.SELECT_AREA))}}h()}},t.prototype._handleClick=function(t){var e,n=this._opts,o=n.element,i=n.getDataFeekback,r=n.coreEvent,s=n.drawFeekback,l=i(),a=o.isPointInElement(t,l),c=a[0],h=a[1];c>=0&&h&&r.trigger('screenClickElement',{index:c,uuid:h,element:Wn(null===(e=l.elements)||void 0===e?void 0:e[c])}),s()},t.prototype._handleMoveStart=function(t){var e=this._opts,n=e.element,o=e.getDataFeekback,i=e.coreEvent,r=o(),s=this.helper;this.temp.set('prevPoint',t);var l=this.temp.get('selectedUUID');this.temp.get('mode')===pn.SELECT_ELEMENT_LIST||(this.temp.get('mode')===pn.SELECT_ELEMENT?'string'==typeof l&&i.has('screenMoveElementStart')&&i.trigger('screenMoveElementStart',{index:n.getElementIndex(r,l),uuid:l,x:t.x,y:t.y}):this.temp.get('mode')===pn.SELECT_AREA&&s.startSelectArea(t))},t.prototype._handleMove=function(t){var e=this._opts.drawFeekback,n=this.helper;this.temp.get('mode')===pn.SELECT_ELEMENT_LIST?(this._dragElements(this.temp.get('selectedUUIDList'),t,this.temp.get('prevPoint')),e(),this.temp.set('cursorStatus',vn.DRAGGING)):'string'==typeof this.temp.get('selectedUUID')?this.temp.get('mode')===pn.SELECT_ELEMENT?(this._dragElements([this.temp.get('selectedUUID')],t,this.temp.get('prevPoint')),e(),this.temp.set('cursorStatus',vn.DRAGGING)):this.temp.get('mode')===pn.SELECT_ELEMENT_WRAPPER_CONTROLLER&&this.temp.get('selectedControllerDirection')&&(this._transfromElement(this.temp.get('selectedUUID'),t,this.temp.get('prevPoint'),this.temp.get('selectedControllerDirection')),this.temp.set('cursorStatus',vn.DRAGGING)):this.temp.get('mode')===pn.SELECT_AREA&&(n.changeSelectArea(t),e()),this.temp.set('prevPoint',t)},t.prototype._dragElements=function(t,e,n){if(n){var o=this._opts,i=o.board,r=o.element,s=o.getDataFeekback,l=o.drawFeekback,a=s(),c=this.helper;t.forEach((function(t){var o,s,l=c.getElementIndexByUUID(t);if(null!==l){var h=a.elements[l];!0!==(null===(o=null==h?void 0:h.operation)||void 0===o?void 0:o.lock)&&!0!==(null===(s=null==h?void 0:h.operation)||void 0===s?void 0:s.invisible)&&r.dragElement(a,t,e,n,i.getContext().getTransform().scale)}})),l()}},t.prototype._transfromElement=function(t,e,n,o){if(!n)return null;var i=this._opts,r=i.board,s=i.element,l=i.getDataFeekback,a=i.drawFeekback,c=l(),h=s.transformElement(c,t,e,n,r.getContext().getTransform().scale,o);return a(),h},t.prototype._handleMoveEnd=function(t){var e=this._opts,n=e.element,o=e.getDataFeekback,i=e.coreEvent,r=e.drawFeekback,s=e.emitChangeData,l=o(),a=this.helper,c=this.temp.get('selectedUUID');if('string'==typeof c){var h=n.getElementIndex(l,c),u=l.elements[h];u&&(i.has('screenMoveElementEnd')&&i.trigger('screenMoveElementEnd',{index:h,uuid:c,x:t.x,y:t.y}),i.has('screenChangeElement')&&i.trigger('screenChangeElement',{index:h,uuid:c,width:u.w,height:u.h,angle:u.angle||0}),s())}else if(this.temp.get('mode')===pn.SELECT_AREA){var f=a.calcSelectedElements(l);f.length>0?(this.temp.set('selectedUUIDList',f),this.temp.set('selectedUUID',null)):this.temp.set('mode',pn.NULL),a.clearSelectedArea(),r()}this.temp.get('mode')!==pn.SELECT_ELEMENT&&this.temp.set('selectedUUID',null),this.temp.set('cursorStatus',vn.NULL),this.temp.set('mode',pn.NULL)},t.prototype._handleHover=function(t){var e,n,o=!1,i=this._opts,r=i.board,s=i.getDataFeekback,l=i.coreEvent,a=s(),c=this.helper,h=this._mapper;if(this.temp.get('mode')===pn.SELECT_AREA)r.resetCursor();else if(this.temp.get('cursorStatus')===vn.NULL){var u=h.judgePointCursor(t,a),f=u.cursor,d=u.elementUUID;if(r.setCursor(f),d)if(null!==(g=c.getElementIndexByUUID(d))&&g>=0){var p=a.elements[g];if(!0===(null===(e=null==p?void 0:p.operation)||void 0===e?void 0:e.lock)||!0===(null===(n=null==p?void 0:p.operation)||void 0===n?void 0:n.invisible))return void r.resetCursor();if(this.temp.get('hoverUUID')!==p.uuid){var v=c.getElementIndexByUUID(this.temp.get('hoverUUID')||'');null!==v&&a.elements[v]&&l.trigger('mouseLeaveElement',{uuid:this.temp.get('hoverUUID'),index:v,element:a.elements[v]})}p&&(l.trigger('mouseOverElement',{uuid:p.uuid,index:g,element:p}),this.temp.set('hoverUUID',p.uuid),o=!0)}}if(!0!==o&&null!==this.temp.get('hoverUUID')){var g,m=this.temp.get('hoverUUID');null!==(g=c.getElementIndexByUUID(m||''))&&l.trigger('mouseLeaveElement',{uuid:m,index:g,element:a.elements[g]}),this.temp.set('hoverUUID',null)}l.has('mouseOverScreen')&&l.trigger('mouseOverScreen',t)},t.prototype._handleLeave=function(){var t=this._opts.coreEvent;t.has('mouseLeaveScreen')&&t.trigger('mouseLeaveScreen',void 0)},t}();function Un(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}var Rn=mt.data.deepClone,An=function(){function e(e,i,r){var s,l,a,c=this;this[n]=new Xe,this[o]=new gn,this[yn]={elements:[]},this[_n]=i,this[Sn]=function(e){var n=mt.data.deepClone(Ye);return e&&e.elementWrapper&&(n.elementWrapper=t(t({},n.elementWrapper),e.elementWrapper)),n}(r||{}),this[mn]=new J(e,t(t({},this[_n]),{canScroll:null===(s=null==r?void 0:r.scrollWrapper)||void 0===s?void 0:s.use,scrollConfig:{color:(null===(l=null==r?void 0:r.scrollWrapper)||void 0===l?void 0:l.color)||'#a0a0a0',lineWidth:(null===(a=null==r?void 0:r.scrollWrapper)||void 0===a?void 0:a.lineWidth)||12}})),this[xn]=new De;var h=function(){var t=c[mn].getHelperContext(),e=c[Dn].getHelperConfig();c[mn].clear();var n=c[_n],o=n.contextWidth,i=n.contextHeight,r=n.devicePixelRatio;t.clearRect(0,0,o*r,i*r),function(t,e){if(null==e?void 0:e.selectedElementWrapper){var n=e.selectedElementWrapper;Un(t),Ve(t,n.translate,n.radian||0,(function(){t.beginPath(),t.setLineDash(n.lineDash),t.setLineWidth(n.lineWidth),t.setStrokeStyle(n.color),t.moveTo(n.controllers.topLeft.x,n.controllers.topLeft.y),t.lineTo(n.controllers.topRight.x,n.controllers.topRight.y),t.lineTo(n.controllers.bottomRight.x,n.controllers.bottomRight.y),t.lineTo(n.controllers.bottomLeft.x,n.controllers.bottomLeft.y),t.lineTo(n.controllers.topLeft.x,n.controllers.topLeft.y-n.lineWidth/2),t.stroke(),t.closePath(),!0!==n.lock?(!0!==n.controllers.rotate.invisible&&(t.beginPath(),t.moveTo(n.controllers.top.x,n.controllers.top.y),t.lineTo(n.controllers.rotate.x,n.controllers.rotate.y+n.controllerSize),t.stroke(),t.closePath(),t.beginPath(),t.setLineDash([]),t.setLineWidth(n.controllerSize/2),t.arc(n.controllers.rotate.x,n.controllers.rotate.y,.8*n.controllerSize,Math.PI/6,2*Math.PI),t.stroke(),t.closePath()),t.setFillStyle(n.color),[n.controllers.topLeft,n.controllers.top,n.controllers.topRight,n.controllers.right,n.controllers.bottomRight,n.controllers.bottom,n.controllers.bottomLeft,n.controllers.left].forEach((function(e){!0!==e.invisible&&(t.beginPath(),t.arc(e.x,e.y,n.controllerSize,0,2*Math.PI),t.fill(),t.closePath())}))):(Un(t),t.setStrokeStyle(n.color),[n.controllers.topLeft,n.controllers.top,n.controllers.topRight,n.controllers.right,n.controllers.bottomRight,n.controllers.bottom,n.controllers.bottomLeft,n.controllers.left].forEach((function(e){t.beginPath(),t.moveTo(e.x-n.controllerSize/2,e.y-n.controllerSize/2),t.lineTo(e.x+n.controllerSize/2,e.y+n.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(e.x+n.controllerSize/2,e.y-n.controllerSize/2),t.lineTo(e.x-n.controllerSize/2,e.y+n.controllerSize/2),t.stroke(),t.closePath()})))}))}}(t,e),function(t,e){if(null==e?void 0:e.selectedAreaWrapper){var n=e.selectedAreaWrapper;n&&n.w>0&&n.h>0&&(Un(t),t.setGlobalAlpha(.3),t.setFillStyle(n.color),t.fillRect(n.x,n.y,n.w,n.h),Un(t),t.beginPath(),t.setLineDash(n.lineDash),t.setLineWidth(n.lineWidth),t.setStrokeStyle(n.color),t.moveTo(n.x,n.y),t.lineTo(n.x+n.w,n.y),t.lineTo(n.x+n.w,n.y+n.h),t.lineTo(n.x,n.y+n.h),t.lineTo(n.x,n.y),t.stroke(),t.closePath())}}(t,e),function(t,e){if(Array.isArray(null==e?void 0:e.selectedElementListWrappers)){var n=e.selectedElementListWrappers;null==n||n.forEach((function(e){Un(t),Ve(t,e.translate,e.radian||0,(function(){Un(t),t.setGlobalAlpha(.05),t.setFillStyle(e.color),t.fillRect(e.controllers.topLeft.x,e.controllers.topLeft.y,e.controllers.bottomRight.x-e.controllers.topLeft.x,e.controllers.bottomRight.y-e.controllers.topLeft.y),Un(t),t.beginPath(),t.setLineDash(e.lineDash),t.setLineWidth(e.lineWidth),t.setStrokeStyle(e.color),t.moveTo(e.controllers.topLeft.x,e.controllers.topLeft.y),t.lineTo(e.controllers.topRight.x,e.controllers.topRight.y),t.lineTo(e.controllers.bottomRight.x,e.controllers.bottomRight.y),t.lineTo(e.controllers.bottomLeft.x,e.controllers.bottomLeft.y),t.lineTo(e.controllers.topLeft.x,e.controllers.topLeft.y-e.lineWidth/2),t.stroke(),t.closePath(),!0===e.lock&&(Un(t),t.setStrokeStyle(e.color),[e.controllers.topLeft,e.controllers.top,e.controllers.topRight,e.controllers.right,e.controllers.bottomRight,e.controllers.bottom,e.controllers.bottomLeft,e.controllers.left].forEach((function(n){t.beginPath(),t.moveTo(n.x-e.controllerSize/2,n.y-e.controllerSize/2),t.lineTo(n.x+e.controllerSize/2,n.y+e.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(n.x+e.controllerSize/2,n.y-e.controllerSize/2),t.lineTo(n.x-e.controllerSize/2,n.y+e.controllerSize/2),t.stroke(),t.closePath()})))}))}))}}(t,e),c[mn].draw()};this[xn].on('drawFrame',(function(t){h()})),this[xn].on('drawFrameComplete',(function(t){h()})),this[bn]=new tn(this[mn].getContext()),this[Dn]=new On({coreEvent:this[Pn],board:this[mn],element:this[bn],config:this[Sn],drawFeekback:this[En].bind(this),getDataFeekback:function(){return c[yn]},selectElementByIndex:this.selectElementByIndex.bind(this),emitChangeScreen:this[Cn].bind(this),emitChangeData:this[zn].bind(this)}),this[Dn].init(),this[xn].on('drawFrame',(function(){c[Pn].trigger('drawFrame',void 0)})),this[xn].on('drawFrameComplete',(function(){c[Pn].trigger('drawFrameComplete',void 0)})),this[wn].set('hasInited',!0)}var n,o;return e.prototype[(n=Pn,o=wn,En)]=function(t){this[Dn].updateHelperConfig({width:this[_n].width,height:this[_n].height,devicePixelRatio:this[_n].devicePixelRatio}),this[xn].thaw(),this[xn].render(this[mn].getContext(),this[yn],{changeResourceUUIDs:(null==t?void 0:t.resourceChangeUUIDs)||[]})},e.prototype.getElement=function(t){return function(t,e){var n=null,o=t[Dn].helper.getElementIndexByUUID(e);return null!==o&&t[yn].elements[o]&&(n=Ln(t[yn].elements[o])),n}(this,t)},e.prototype.getElementByIndex=function(t){return function(t,e){var n=null;return e>=0&&t[yn].elements[e]&&(n=Ln(t[yn].elements[e])),n}(this,t)},e.prototype.selectElementByIndex=function(t,e){return function(t,e,n){if(t[yn].elements[e]){var o=t[yn].elements[e].uuid;!0===(null==n?void 0:n.useMode)?t[Dn].temp.set('mode',pn.SELECT_ELEMENT):t[Dn].temp.set('mode',pn.NULL),'string'==typeof o&&(t[Dn].temp.set('selectedUUID',o),t[Dn].temp.set('selectedUUIDList',[])),t[En]()}}(this,t,e)},e.prototype.selectElement=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(e);'number'==typeof o&&o>=0&&t.selectElementByIndex(o,n)}(this,t,e)},e.prototype.moveUpElement=function(t){return function(t,e){var n=t[Dn].helper.getElementIndexByUUID(e);if('number'==typeof n&&n>=0&&n<t[yn].elements.length-1){var o=t[yn].elements[n];t[yn].elements[n]=t[yn].elements[n+1],t[yn].elements[n+1]=o}t[zn](),t[En]()}(this,t)},e.prototype.moveDownElement=function(t){return function(t,e){var n=t[Dn].helper.getElementIndexByUUID(e);if('number'==typeof n&&n>0&&n<t[yn].elements.length){var o=t[yn].elements[n];t[yn].elements[n]=t[yn].elements[n-1],t[yn].elements[n-1]=o}t[zn](),t[En]()}(this,t)},e.prototype.updateElement=function(t){return function(t,e){for(var n,o=Ln(e),i=t[yn],r=[],s=0;s<i.elements.length;s++)if(o.uuid===(null===(n=i.elements[s])||void 0===n?void 0:n.uuid)){var l=je(i.elements[s],o);'string'==typeof l&&r.push(l),i.elements[s]=o;break}t[zn](),t[En]({resourceChangeUUIDs:r})}(this,t)},e.prototype.addElement=function(t){return function(t,e){var n=Ln(e);return n.uuid=Tn(),t[yn].elements.push(n),t[zn](),t[En](),n.uuid}(this,t)},e.prototype.deleteElement=function(t){return function(t,e){var n=t[bn].getElementIndex(t[yn],e);n>=0&&(t[yn].elements.splice(n,1),t[zn](),t[En]())}(this,t)},e.prototype.insertElementBefore=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(n);return null!==o?t.insertElementBeforeIndex(e,o):null}(this,t,e)},e.prototype.insertElementBeforeIndex=function(t,e){return function(t,e,n){var o=Ln(e);return o.uuid=Tn(),n>=0?(t[yn].elements.splice(n,0,o),t[zn](),t[En](),o.uuid):null}(this,t,e)},e.prototype.getSelectedElements=function(){return e=[],n=[],'string'==typeof(o=(t=this)[Dn].temp.get('selectedUUID'))&&o?n.push(o):n=t[Dn].temp.get('selectedUUIDList'),n.forEach((function(n){var o,i=t[Dn].helper.getElementIndexByUUID(n);if(null!==i&&i>=0){var r=null===(o=t[yn])||void 0===o?void 0:o.elements[i];r&&e.push(r)}})),Ln(e);var t,e,n,o},e.prototype.insertElementAfter=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(n);return null!==o?t.insertElementAfterIndex(e,o):null}(this,t,e)},e.prototype.insertElementAfterIndex=function(t,e){return function(t,e,n){var o=Ln(e);return o.uuid=Tn(),n>=0?(t[yn].elements.splice(n+1,0,o),t[zn](),t[En](),o.uuid):null}(this,t,e)},e.prototype.resetSize=function(e){this[_n]=t(t({},this[_n]),e),this[mn].resetSize(e),this[En]()},e.prototype.scale=function(t){var e=this[mn].scale(t);return this[En](),this[Cn](),e},e.prototype.scrollLeft=function(t){var e=this[mn].scrollX(0-t);return this[En](),this[Cn](),e},e.prototype.scrollTop=function(t){var e=this[mn].scrollY(0-t);return this[En](),this[Cn](),e},e.prototype.getScreenTransform=function(){var t=this[mn].getTransform();return{scale:t.scale,scrollTop:Math.max(0,0-t.scrollY),scrollLeft:Math.max(0,0-t.scrollX)}},e.prototype.getData=function(){return Rn(this[yn])},e.prototype.setData=function(t,e){var n=function(t,e){var n,o=[],i=Ge(t),r=Ge(e);for(var s in r)if(!0===['image','svg','html'].includes(null===(n=r[s])||void 0===n?void 0:n.type))if(i[s]){var l=!1;switch(i[s].type){case'image':l=Ne(i[s],r[s]);break;case'svg':l=He(i[s],r[s]);break;case'html':l=Be(i[s],r[s])}!0===l&&o.push(s)}else o.push(s);return o}(this[yn],t);this[yn]=this[bn].initData(Rn(fn(t))),e&&!0===e.triggerChangeEvent&&this[zn](),this[En]({resourceChangeUUIDs:n})},e.prototype.clearOperation=function(){this[wn].clear(),this[En]()},e.prototype.on=function(t,e){this[Pn].on(t,e)},e.prototype.off=function(t,e){this[Pn].off(t,e)},e.prototype.pointScreenToContext=function(t){return this[mn].pointScreenToContext(t)},e.prototype.pointContextToScreen=function(t){return this[mn].pointContextToScreen(t)},e.prototype.__getBoardContext=function(){return this[mn].getContext()},e.prototype.__getDisplayContext2D=function(){return this[mn].getDisplayContext2D()},e.prototype.__getOriginContext2D=function(){return this[mn].getOriginContext2D()},e.prototype[Cn]=function(){this[Pn].has('changeScreen')&&this[Pn].trigger('changeScreen',t({},this.getScreenTransform()))},e.prototype[zn]=function(){this[Pn].has('changeData')&&this[Pn].trigger('changeData',Rn(this[yn]))},e.is=We,e.check=Ue,e}();return An}();
|
|
1
|
+
var iDrawCore=function(){'use strict';var t=function(){return t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)},e=function(){return e=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function n(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function o(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var i={type:function(t,e){var n=o(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===o(t)},json:function(t){return'Object'===o(t)},function:function(t){return'Function'===o(t)},asyncFunction:function(t){return'AsyncFunction'===o(t)},string:function(t){return'String'===o(t)},number:function(t){return'Number'===o(t)},undefined:function(t){return'Undefined'===o(t)},null:function(t){return'Null'===o(t)},promise:function(t){return'Promise'===o(t)}},r=function(){return r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function s(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function l(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function a(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function c(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var h=window.Image;function u(t){return new Promise((function(e,n){var o=new h;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var f=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=r(r({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=r(r({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function d(t){return'number'==typeof t&&(t>0||t<=0)}function p(t){return'number'==typeof t&&t>=0}function v(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function g(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var m={x:function(t){return d(t)},y:function(t){return d(t)},w:p,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:d,borderWidth:function(t){return p(t)},borderRadius:function(t){return d(t)&&t>=0},color:function(t){return n(t)},imageSrc:function(t){return g(t)||v(t)},imageURL:v,imageBase64:g,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return d(t)&&t>0},lineHeight:function(t){return d(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return d(t)&&t>0}};function y(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!m.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!m.number(n))&&!(t.hasOwnProperty('borderWidth')&&!m.number(o)))}var _={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(m.x(e)&&m.y(n)&&m.w(o)&&m.h(i)&&m.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!m.text(e)&&(!!m.color(n)&&(!!m.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!m.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!m.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!m.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!m.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!m.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!m.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!m.color(h))&&!!y(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!m.color(e))&&!!y(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!m.color(e))&&(!(t.hasOwnProperty('borderColor')&&!m.color(n))&&!(t.hasOwnProperty('borderWidth')&&!m.number(o)))},imageDesc:function(t){var e=t.src;return!!m.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!m.svg(e)},htmlDesc:function(t){var e=t.html;return!!m.html(e)}},S={is:m,check:_,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:u,loadSVG:function(t){return s(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,c(t)];case 1:return[4,u(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return s(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,a(t,e)];case 1:return[4,u(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:n},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:i,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:f},x=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var b=function(){function t(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}},t}(),w=function(){function t(t,e){this._isMoving=!1,this._temp=new b,this._container=window,this._canvas=t,this._isMoving=!1,this._initEvent(),this._event=new x}return t.prototype.setStatusMap=function(t){this._temp.set('statusMap',t)},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype._initEvent=function(){var t=this._canvas,e=this._container;e.addEventListener('mousemove',this._listenWindowMove.bind(this),!1),e.addEventListener('mouseup',this._listenWindowMoveEnd.bind(this),!1),t.addEventListener('mousemove',this._listenHover.bind(this),!1),t.addEventListener('mousedown',this._listenMoveStart.bind(this),!1),t.addEventListener('mousemove',this._listenMove.bind(this),!1),t.addEventListener('mouseup',this._listenMoveEnd.bind(this),!1),t.addEventListener('click',this._listenCanvasClick.bind(this),!1),t.addEventListener('wheel',this._listenCanvasWheel.bind(this),!1),t.addEventListener('mousedown',this._listenCanvasMoveStart.bind(this),!0),t.addEventListener('mouseup',this._listenCanvasMoveEnd.bind(this),!0),t.addEventListener('mouseover',this._listenCanvasMoveOver.bind(this),!0),t.addEventListener('mouseleave',this._listenCanvasMoveLeave.bind(this),!0),this._initParentEvent()},t.prototype._initParentEvent=function(){for(var t=window,e=t.origin;t.self!==t.top&&(t.self!==t.parent&&t.origin===e&&t.parent.window.addEventListener('mousemove',this._listSameOriginParentWindow.bind(this),!1),t=t.parent););},t.prototype._listenHover=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.has('hover')&&this._event.trigger('hover',e),this._isMoving=!0},t.prototype._listenMoveStart=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&(this._event.has('point')&&this._event.trigger('point',e),this._event.has('moveStart')&&this._event.trigger('moveStart',e)),this._isMoving=!0},t.prototype._listenMove=function(t){if(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenMoveEnd=function(t){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._isMoving=!1},t.prototype._listSameOriginParentWindow=function(){this._temp.get('isHoverCanvas')&&this._event.has('leave')&&this._event.trigger('leave',void 0),this._temp.get('isDragCanvas')&&this._event.has('moveEnd')&&this._event.trigger('moveEnd',{x:NaN,y:NaN}),this._isMoving=!1,this._temp.set('isDragCanvas',!1),this._temp.set('isHoverCanvas',!1)},t.prototype._listenCanvasMoveStart=function(){this._temp.get('isHoverCanvas')&&this._temp.set('isDragCanvas',!0)},t.prototype._listenCanvasMoveEnd=function(){this._temp.set('isDragCanvas',!1)},t.prototype._listenCanvasMoveOver=function(){this._temp.set('isHoverCanvas',!0)},t.prototype._listenCanvasMoveLeave=function(){this._temp.set('isHoverCanvas',!1),this._event.has('leave')&&this._event.trigger('leave',void 0)},t.prototype._listenWindowMove=function(t){if(!0===this._temp.get('isDragCanvas')&&(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving)){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenWindowMoveEnd=function(t){if(!0!=!this._temp.get('isDragCanvas')){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._temp.set('isDragCanvas',!1),this._isMoving=!1}},t.prototype._listenCanvasWheel=function(t){this._event.has('wheelX')&&(t.deltaX>0||t.deltaX<0)&&this._event.trigger('wheelX',t.deltaX),this._event.has('wheelY')&&(t.deltaY>0||t.deltaY<0)&&this._event.trigger('wheelY',t.deltaY);var e=this._temp.get('statusMap'),n=e.canScrollYNext,o=e.canScrollYPrev;(t.deltaX>0&&t.deltaX<0||t.deltaY>0&&!0===n||t.deltaY<0&&!0===o)&&t.preventDefault()},t.prototype._listenCanvasClick=function(t){t.preventDefault();var e=this._getPosition(t),n=Date.now();if(this._isVaildPoint(e)){var o=this._temp.get('prevClickPoint');o&&n-o.t<=500&&Math.abs(o.x-e.x)<=5&&Math.abs(o.y-e.y)<=5?this._event.has('doubleClick')&&this._event.trigger('doubleClick',{x:e.x,y:e.y}):this._temp.set('prevClickPoint',{x:e.x,y:e.y,t:n})}},t.prototype._getPosition=function(t){var e=this._canvas,n=0,o=0;if(t&&t.touches&&t.touches.length>0){var i=t.touches[0];i&&(n=i.clientX,o=i.clientY)}else n=t.clientX,o=t.clientY;return{x:n-e.getBoundingClientRect().left,y:o-e.getBoundingClientRect().top,t:Date.now()}},t.prototype._isVaildPoint=function(t){return E(t.x)&&E(t.y)},t}();function E(t){return t>0||t<0||0===t}var P={lineWidth:12,color:'#a0a0a0'},C=function(){function t(t,e){this._displayCtx=t,this._opts=this._getOpts(e)}return t.prototype.draw=function(t){var e=this._opts,n=e.width,o=e.height,i=this.calc(t),r=this._displayCtx;i.xSize>0&&(r.globalAlpha=.2,r.fillStyle=i.color,r.fillRect(0,this._doSize(o-i.lineSize),this._doSize(n),this._doSize(i.lineSize)),r.globalAlpha=1,z(r,{x:this._doSize(i.translateX),y:this._doSize(o-i.lineSize),w:this._doSize(i.xSize),h:this._doSize(i.lineSize),r:this._doSize(i.lineSize/2),color:i.color})),i.ySize>0&&(r.globalAlpha=.2,r.fillStyle=i.color,r.fillRect(this._doSize(n-i.lineSize),0,this._doSize(i.lineSize),this._doSize(o)),r.globalAlpha=1,z(r,{x:this._doSize(n-i.lineSize),y:this._doSize(i.translateY),w:this._doSize(i.lineSize),h:this._doSize(i.ySize),r:this._doSize(i.lineSize/2),color:i.color})),r.globalAlpha=1},t.prototype.resetSize=function(t){this._opts=e(e({},this._opts),t)},t.prototype.isPointAtScrollY=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=this._displayCtx;return r.beginPath(),r.rect(this._doSize(n-i.lineWidth),0,this._doSize(i.lineWidth),this._doSize(o)),r.closePath(),!!r.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.isPointAtScrollX=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=this._displayCtx;return r.beginPath(),r.rect(0,this._doSize(o-i.lineWidth),this._doSize(n-i.lineWidth),this._doSize(i.lineWidth)),r.closePath(),!!r.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.getLineWidth=function(){return this._opts.scrollConfig.lineWidth},t.prototype.calc=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=2.5*i.lineWidth,s=i.lineWidth,l=0,a=0;t.left<=0&&t.right<=0&&(l=Math.max(r,n-(Math.abs(t.left)+Math.abs(t.right))))>=n&&(l=0),(t.top<=0||t.bottom<=0)&&(a=Math.max(r,o-(Math.abs(t.top)+Math.abs(t.bottom))))>=o&&(a=0);var c=0;l>0&&(c=l/2+(n-l)*Math.abs(t.left)/(Math.abs(t.left)+Math.abs(t.right)),c=Math.min(Math.max(0,c-l/2),n-l));var h=0;return a>0&&(h=a/2+(o-a)*Math.abs(t.top)/(Math.abs(t.top)+Math.abs(t.bottom)),h=Math.min(Math.max(0,h-a/2),o-a)),{lineSize:s,xSize:l,ySize:a,translateY:h,translateX:c,color:this._opts.scrollConfig.color}},t.prototype._doSize=function(t){return t*this._opts.devicePixelRatio},t.prototype._getOpts=function(t){var n=e({scrollConfig:P},t);return n.scrollConfig||(n.scrollConfig=P),n.scrollConfig.lineWidth>0||(n.scrollConfig.lineWidth=P.lineWidth),n.scrollConfig.lineWidth=Math.max(n.scrollConfig.lineWidth,P.lineWidth),!0!==S.color.isColorStr(n.scrollConfig.color)&&(n.scrollConfig.color=n.scrollConfig.color),n},t}();function z(t,e){var n=e.x,o=e.y,i=e.w,r=e.h,s=e.color,l=e.r;(i<2*(l=Math.min(l,i/2,r/2))||r<2*l)&&(l=0),t.beginPath(),t.moveTo(n+l,o),t.arcTo(n+i,o,n+i,o+r,l),t.arcTo(n+i,o+r,n,o+r,l),t.arcTo(n,o+r,n,o,l),t.arcTo(n,o,n+i,o,l),t.closePath(),t.fillStyle=s,t.fill()}var D,L=Symbol('_opts'),T=Symbol('_ctx'),M=function(){function t(t,e){this[L]=e,this[T]=t}return t.prototype.resetSize=function(t){this[L]=e(e({},this[L]),t)},t.prototype.calcScreen=function(){var t=this[T].getTransform().scale,e=this[L],n=e.width,o=e.height,i=e.contextWidth,r=e.contextHeight,s=e.devicePixelRatio,l=!0,a=!0,c=!0,h=!0;i*t<=n&&(this[T].setTransform({scrollX:(n-i*t)/2}),l=!1,a=!1),r*t<=o&&(this[T].setTransform({scrollY:(o-r*t)/2}),c=!1,h=!1),i*t>=n&&this[T].getTransform().scrollX>0&&(this[T].setTransform({scrollX:0}),l=!1),r*t>=o&&this[T].getTransform().scrollY>0&&(this[T].setTransform({scrollY:0}),c=!1);var u=this[T].getTransform(),f=u.scrollX,d=u.scrollY;f<0&&Math.abs(f)>Math.abs(i*t-n)&&(this[T].setTransform({scrollX:0-Math.abs(i*t-n)}),a=!1),d<0&&Math.abs(d)>Math.abs(r*t-o)&&(this[T].setTransform({scrollY:0-Math.abs(r*t-o)}),h=!1);var p=this[T].getTransform(),v=p.scrollX,g=p.scrollY;return{size:{x:v*t,y:g*t,w:i*t,h:r*t},position:{top:g,bottom:o-(r*t+g),left:v,right:n-(i*t+v)},deviceSize:{x:v*s,y:g*s,w:i*s*t,h:r*s*t},width:this[L].width,height:this[L].height,devicePixelRatio:this[L].devicePixelRatio,canScrollYPrev:c,canScrollYNext:h,canScrollXPrev:l,canScrollXNext:a}},t.prototype.calcScreenScroll=function(t,e,n,o,i){var r=o-n;t<=0&&e<=0&&(r=Math.abs(t)+Math.abs(e));var s=1;return r>0&&(s=r/(o-n)),0-s*i},t}(),k=Symbol('_canvas'),I=Symbol('_displayCanvas'),W=Symbol('_helperCanvas'),O=Symbol('_mount'),U=Symbol('_opts'),R=Symbol('_hasRendered'),A=Symbol('_ctx'),F=Symbol('_helperCtx'),Y=Symbol('_watcher'),X=Symbol('_render'),N=Symbol('_parsePrivateOptions'),H=Symbol('_scroller'),B=Symbol('_initEvent'),j=Symbol('_doScrollX'),G=Symbol('_doScrollY'),Q=Symbol('_doMoveScroll'),V=Symbol('_resetContext'),$=Symbol('_screen'),Z=S.Context,q=S.time.throttle,J=function(){function t(t,e){this[D]=!1,this[O]=t,this[k]=document.createElement('canvas'),this[W]=document.createElement('canvas'),this[I]=document.createElement('canvas'),this[O].appendChild(this[I]),this[U]=this[N](e);var n=this[k].getContext('2d'),o=this[I].getContext('2d'),i=this[W].getContext('2d');this[A]=new Z(n,this[U]),this[F]=new Z(i,this[U]),this[$]=new M(this[A],this[U]),this[Y]=new w(this[I],this[A]),this[H]=new C(o,{width:e.width,height:e.height,devicePixelRatio:e.devicePixelRatio||1,scrollConfig:e.scrollConfig}),this[X]()}return t.prototype.getDisplayContext2D=function(){return this[I].getContext('2d')},t.prototype.getOriginContext2D=function(){return this[A].getContext()},t.prototype.getHelperContext2D=function(){return this[F].getContext()},t.prototype.getContext=function(){return this[A]},t.prototype.getHelperContext=function(){return this[F]},t.prototype.scale=function(t){t>0&&(this[A].setTransform({scale:t}),this[F].setTransform({scale:t}));var e=this[$].calcScreen();return{position:e.position,size:e.size}},t.prototype.scrollX=function(t){this[Y].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[A].setTransform({scrollX:t}),this[F].setTransform({scrollX:t}));var e=this[$].calcScreen(),n=e.position,o=e.size,i=e.canScrollXNext,r=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[Y].setStatusMap({canScrollYPrev:l,canScrollYNext:r,canScrollXPrev:s,canScrollXNext:i}),{position:n,size:o}},t.prototype.scrollY=function(t){this[Y].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[A].setTransform({scrollY:t}),this[F].setTransform({scrollY:t}));var e=this[$].calcScreen(),n=e.position,o=e.size,i=e.canScrollXNext,r=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[Y].setStatusMap({canScrollYPrev:l,canScrollYNext:r,canScrollXPrev:s,canScrollXNext:i}),{position:n,size:o}},t.prototype.getTransform=function(){return this[A].getTransform()},t.prototype.draw=function(){this.clear();var t=this[$].calcScreen(),e=t.position,n=t.deviceSize,o=t.size,i=this[I].getContext('2d');return null==i||i.drawImage(this[k],n.x,n.y,n.w,n.h),null==i||i.drawImage(this[W],n.x,n.y,n.w,n.h),!0===this[U].canScroll&&this[H].draw(e),{position:e,size:o}},t.prototype.clear=function(){var t=this[I].getContext('2d');null==t||t.clearRect(0,0,this[I].width,this[I].height)},t.prototype.on=function(t,e){this[Y].on(t,e)},t.prototype.off=function(t,e){this[Y].off(t,e)},t.prototype.getScreenInfo=function(){return this[$].calcScreen()},t.prototype.setCursor=function(t){this[I].style.cursor=t},t.prototype.resetCursor=function(){this[I].style.cursor='auto'},t.prototype.resetSize=function(t){this[U]=e(e({},this[U]),t),this[V](),this[A].resetSize(t),this[F].resetSize(t),this[$].resetSize(t),this[H].resetSize({width:this[U].width,height:this[U].height,devicePixelRatio:this[U].devicePixelRatio}),this.draw()},t.prototype.getScrollLineWidth=function(){var t=0;return!0===this[U].canScroll&&(t=this[H].getLineWidth()),t},t.prototype.pointScreenToContext=function(t){var e=this.getTransform(),n=e.scrollX,o=e.scrollY,i=e.scale;return{x:(t.x-n)/i,y:(t.y-o)/i}},t.prototype.pointContextToScreen=function(t){var e=this.getTransform(),n=e.scrollX,o=e.scrollY,i=e.scale;return{x:t.x*i+n,y:t.y*i+o}},t.prototype[(D=R,X)]=function(){!0!==this[R]&&(this[V](),this[B](),this[R]=!0)},t.prototype[V]=function(){var t,n,o,i,r,s,l=this[U],a=l.width,c=l.height,h=l.contextWidth,u=l.contextHeight,f=l.devicePixelRatio;this[k].width=h*f,this[k].height=u*f,this[W].width=h*f,this[W].height=u*f,this[I].width=a*f,this[I].height=c*f,t=this[I],n={width:a+"px",height:c+"px"},o=function(t){var e={};return(t.getAttribute('style')||'').split(';').forEach((function(t){var n=t.split(':');n[0]&&'string'==typeof n[0]&&(e[n[0]]=n[1]||'')})),e}(t),i=e(e({},o),n),r=Object.keys(i),s='',r.forEach((function(t){s+=t+":"+(i[t]||'')+";"})),t.setAttribute('style',s)},t.prototype[N]=function(t){return e(e({},{devicePixelRatio:1}),t)},t.prototype[B]=function(){var t=this;if(!0!==this[R]&&!0===this[U].canScroll){this.on('wheelX',q((function(e){t[j](e)}),16)),this.on('wheelY',q((function(e){t[G](e)}),16));var e=null;this.on('moveStart',q((function(n){t[H].isPointAtScrollX(n)?e='x':t[H].isPointAtScrollY(n)&&(e='y')}),16)),this.on('move',q((function(n){e&&t[Q](e,n)}),16)),this.on('moveEnd',q((function(n){e&&t[Q](e,n),e=null}),16))}},t.prototype[j]=function(t,e){var n=this[U].width,o=e;'number'==typeof o&&(o>0||o<=0)||(o=this[A].getTransform().scrollX);var i=this[$].calcScreen().position,r=this[H].calc(i).xSize,s=this[$].calcScreenScroll(i.left,i.right,r,n,t);this.scrollX(o+s),this.draw()},t.prototype[G]=function(t,e){var n=this[U].height,o=e;'number'==typeof o&&(o>0||o<=0)||(o=this[A].getTransform().scrollY);var i=this[$].calcScreen().position,r=this[H].calc(i).ySize,s=this[$].calcScreenScroll(i.top,i.bottom,r,n,t);this.scrollY(o+s),this.draw()},t.prototype[Q]=function(t,e){if(t){var n=this[$].calcScreen().position,o=this[H].calc(n),i=o.xSize,r=o.ySize;'x'===t?this[j](e.x-i/2,0):'y'===t&&this[G](e.y-r/2,0)}},t}();function K(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function tt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var et={type:function(t,e){var n=tt(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===tt(t)},json:function(t){return'Object'===tt(t)},function:function(t){return'Function'===tt(t)},asyncFunction:function(t){return'AsyncFunction'===tt(t)},string:function(t){return'String'===tt(t)},number:function(t){return'Number'===tt(t)},undefined:function(t){return'Undefined'===tt(t)},null:function(t){return'Null'===tt(t)},promise:function(t){return'Promise'===tt(t)}},nt=function(){return nt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},nt.apply(this,arguments)};function ot(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function it(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function rt(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function st(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var lt=window.Image;function at(t){return new Promise((function(e,n){var o=new lt;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var ct=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=nt(nt({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=nt(nt({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function ht(t){return'number'==typeof t&&(t>0||t<=0)}function ut(t){return'number'==typeof t&&t>=0}function ft(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function dt(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var pt={x:function(t){return ht(t)},y:function(t){return ht(t)},w:ut,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:ht,borderWidth:function(t){return ut(t)},borderRadius:function(t){return ht(t)&&t>=0},color:function(t){return K(t)},imageSrc:function(t){return dt(t)||ft(t)},imageURL:ft,imageBase64:dt,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return ht(t)&&t>0},lineHeight:function(t){return ht(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return ht(t)&&t>0}};function vt(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!pt.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!pt.number(n))&&!(t.hasOwnProperty('borderWidth')&&!pt.number(o)))}var gt={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(pt.x(e)&&pt.y(n)&&pt.w(o)&&pt.h(i)&&pt.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!pt.text(e)&&(!!pt.color(n)&&(!!pt.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!pt.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!pt.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!pt.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!pt.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!pt.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!pt.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!pt.color(h))&&!!vt(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!pt.color(e))&&!!vt(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!pt.color(e))&&(!(t.hasOwnProperty('borderColor')&&!pt.color(n))&&!(t.hasOwnProperty('borderWidth')&&!pt.number(o)))},imageDesc:function(t){var e=t.src;return!!pt.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!pt.svg(e)},htmlDesc:function(t){var e=t.html;return!!pt.html(e)}},mt={is:pt,check:gt,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:at,loadSVG:function(t){return ot(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,st(t)];case 1:return[4,at(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return ot(this,void 0,void 0,(function(){return it(this,(function(n){switch(n.label){case 0:return[4,rt(t,e)];case 1:return[4,at(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:K},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:et,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:ct},yt=function(t,e){return yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},yt(t,e)};var _t=function(){return _t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},_t.apply(this,arguments)};function St(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function xt(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function bt(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function wt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var Et={type:function(t,e){var n=wt(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===wt(t)},json:function(t){return'Object'===wt(t)},function:function(t){return'Function'===wt(t)},asyncFunction:function(t){return'AsyncFunction'===wt(t)},string:function(t){return'String'===wt(t)},number:function(t){return'Number'===wt(t)},undefined:function(t){return'Undefined'===wt(t)},null:function(t){return'Null'===wt(t)},promise:function(t){return'Promise'===wt(t)}},Pt=function(){return Pt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Pt.apply(this,arguments)};function Ct(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function zt(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function Dt(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function Lt(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var Tt=window.Image;function Mt(t){return new Promise((function(e,n){var o=new Tt;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var kt=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=Pt(Pt({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=Pt(Pt({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function It(t){return'number'==typeof t&&(t>0||t<=0)}function Wt(t){return'number'==typeof t&&t>=0}function Ot(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ut(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var Rt={x:function(t){return It(t)},y:function(t){return It(t)},w:Wt,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:It,borderWidth:function(t){return Wt(t)},borderRadius:function(t){return It(t)&&t>=0},color:function(t){return bt(t)},imageSrc:function(t){return Ut(t)||Ot(t)},imageURL:Ot,imageBase64:Ut,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return It(t)&&t>0},lineHeight:function(t){return It(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return It(t)&&t>0}};function At(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!Rt.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!Rt.number(n))&&!(t.hasOwnProperty('borderWidth')&&!Rt.number(o)))}var Ft={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(Rt.x(e)&&Rt.y(n)&&Rt.w(o)&&Rt.h(i)&&Rt.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!Rt.text(e)&&(!!Rt.color(n)&&(!!Rt.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!Rt.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!Rt.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!Rt.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!Rt.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!Rt.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!Rt.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!Rt.color(h))&&!!At(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!Rt.color(e))&&!!At(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!Rt.color(e))&&(!(t.hasOwnProperty('borderColor')&&!Rt.color(n))&&!(t.hasOwnProperty('borderWidth')&&!Rt.number(o)))},imageDesc:function(t){var e=t.src;return!!Rt.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!Rt.svg(e)},htmlDesc:function(t){var e=t.html;return!!Rt.html(e)}},Yt={is:Rt,check:Ft,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:Mt,loadSVG:function(t){return Ct(this,void 0,void 0,(function(){return zt(this,(function(e){switch(e.label){case 0:return[4,Lt(t)];case 1:return[4,Mt(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return Ct(this,void 0,void 0,(function(){return zt(this,(function(n){switch(n.label){case 0:return[4,Dt(t,e)];case 1:return[4,Mt(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:bt},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:Et,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:kt};function Xt(t,e,n){var o=function(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}(e),i=function(t){return t/180*Math.PI}(e.angle||0);return function(t,e,n,o){e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(n),t.translate(-e.x,-e.y));o(t),e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(-n),t.translate(-e.x,-e.y))}(t,o,i||0,n)}var Nt=Yt.is,Ht=Yt.istype,Bt=Yt.color;function jt(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}function Gt(t,e,n){jt(t),function(t,e){jt(t),Xt(t,e,(function(){if(e.desc.borderWidth&&e.desc.borderWidth>0){var n=e.desc.borderWidth,o='#000000';!0===Bt.isColorStr(e.desc.borderColor)&&(o=e.desc.borderColor);var i=e.x-n/2,r=e.y-n/2,s=e.w+n,l=e.h+n,a=e.desc.borderRadius||0;(a=Math.min(a,s/2,l/2))<s/2&&a<l/2&&(a+=n/2);var c=e.desc;void 0!==c.shadowColor&&Bt.isColorStr(c.shadowColor)&&t.setShadowColor(c.shadowColor),void 0!==c.shadowOffsetX&&Nt.number(c.shadowOffsetX)&&t.setShadowOffsetX(c.shadowOffsetX),void 0!==c.shadowOffsetY&&Nt.number(c.shadowOffsetY)&&t.setShadowOffsetY(c.shadowOffsetY),void 0!==c.shadowBlur&&Nt.number(c.shadowBlur)&&t.setShadowBlur(c.shadowBlur),t.beginPath(),t.setLineWidth(n),t.setStrokeStyle(o),t.moveTo(i+a,r),t.arcTo(i+s,r,i+s,r+l,a),t.arcTo(i+s,r+l,i,r+l,a),t.arcTo(i,r+l,i,r,a),t.arcTo(i,r,i+s,r,a),t.closePath(),t.stroke()}}))}(t,e),jt(t),Xt(t,e,(function(){var o=e.x,i=e.y,r=e.w,s=e.h,l=e.desc.borderRadius||0;(r<2*(l=Math.min(l,r/2,s/2))||s<2*l)&&(l=0),t.beginPath(),t.moveTo(o+l,i),t.arcTo(o+r,i,o+r,i+s,l),t.arcTo(o+r,i+s,o,i+s,l),t.arcTo(o,i+s,o,i,l),t.arcTo(o,i,o+r,i,l),t.closePath(),('string'==typeof n||['CanvasPattern'].includes(Ht.type(n)))&&t.setFillStyle(n),t.fill()}))}function Qt(t,e){Gt(t,e,e.desc.bgColor)}function Vt(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}function $t(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}function Zt(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}var qt=Yt.is,Jt=Yt.color;function Kt(t,e,n){jt(t),Gt(t,e,e.desc.bgColor||'transparent'),Xt(t,e,(function(){var n=_t({fontSize:12,fontFamily:'sans-serif',textAlign:'center'},e.desc);t.setFillStyle(e.desc.color),t.setTextBaseline('top'),t.setFont({fontWeight:n.fontWeight,fontSize:n.fontSize,fontFamily:n.fontFamily});var o=n.text.replace(/\r\n/gi,'\n'),i=n.lineHeight||n.fontSize,r=o.split('\n'),s=[];r.forEach((function(n){for(var o='',r=0,l=0;l<n.length&&(t.measureText(o+(n[l]||'')).width<t.calcDeviceNum(e.w)?o+=n[l]||'':(s.push({text:o,width:t.calcScreenNum(t.measureText(o).width)}),o=n[l]||'',r++),!((r+1)*i>e.h));l++)if(o&&n.length-1===l&&(r+1)*i<e.h){s.push({text:o,width:t.calcScreenNum(t.measureText(o).width)});break}}));var l=e.y;if(s.length*i<e.h&&(l+=(e.h-s.length*i)/2),void 0!==n.textShadowColor&&Jt.isColorStr(n.textShadowColor)&&t.setShadowColor(n.textShadowColor),void 0!==n.textShadowOffsetX&&qt.number(n.textShadowOffsetX)&&t.setShadowOffsetX(n.textShadowOffsetX),void 0!==n.textShadowOffsetY&&qt.number(n.textShadowOffsetY)&&t.setShadowOffsetY(n.textShadowOffsetY),void 0!==n.textShadowBlur&&qt.number(n.textShadowBlur)&&t.setShadowBlur(n.textShadowBlur),s.forEach((function(o,r){var s=e.x;'center'===n.textAlign?s=e.x+(e.w-o.width)/2:'right'===n.textAlign&&(s=e.x+(e.w-o.width)),t.fillText(o.text,s,l+i*r)})),jt(t),Jt.isColorStr(n.strokeColor)&&void 0!==n.strokeWidth&&n.strokeWidth>0){var a=e.y;s.length*i<e.h&&(a+=(e.h-s.length*i)/2),s.forEach((function(o,r){var s=e.x;'center'===n.textAlign?s=e.x+(e.w-o.width)/2:'right'===n.textAlign&&(s=e.x+(e.w-o.width)),void 0!==n.strokeColor&&t.setStrokeStyle(n.strokeColor),void 0!==n.strokeWidth&&n.strokeWidth>0&&t.setLineWidth(n.strokeWidth),t.strokeText(o.text,s,a+i*r)}))}}))}function te(t,e){jt(t),Xt(t,e,(function(t){var n=e.x,o=e.y,i=e.w,r=e.h,s=e.desc,l=s.bgColor,a=void 0===l?'#000000':l,c=s.borderColor,h=void 0===c?'#000000':c,u=s.borderWidth,f=void 0===u?0:u,d=i/2,p=r/2,v=n+d,g=o+p;if(f&&f>0){var m=f/2+d,y=f/2+p;t.beginPath(),t.setStrokeStyle(h),t.setLineWidth(f),t.ellipse(v,g,m,y,0,0,2*Math.PI),t.closePath(),t.stroke()}t.beginPath(),t.setFillStyle(a),t.ellipse(v,g,d,p,0,0,2*Math.PI),t.closePath(),t.fill()}))}var ee=Yt.color.isColorStr;function ne(t,e,n){var o;jt(t);var i=t.getSize();if(t.clearRect(0,0,i.contextWidth,i.contextHeight),'string'==typeof e.bgColor&&ee(e.bgColor)&&function(t,e){var n=t.getSize();t.setFillStyle(e),t.fillRect(0,0,n.contextWidth,n.contextHeight)}(t,e.bgColor),e.elements.length>0)for(var r=0;r<e.elements.length;r++){var s=e.elements[r];if(!0!==(null===(o=null==s?void 0:s.operation)||void 0===o?void 0:o.invisible))switch(s.type){case'rect':Qt(t,s);break;case'text':Kt(t,s);break;case'image':Vt(t,s,n);break;case'svg':$t(t,s,n);break;case'html':Zt(t,s,n);break;case'circle':te(t,s)}}}var oe=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var ie,re=Yt.loader,se=re.loadImage,le=re.loadSVG,ae=re.loadHTML,ce=Yt.data.deepClone;!function(t){t.FREE="free",t.LOADING="loading",t.COMPLETE="complete"}(ie||(ie={}));var he,ue,fe,de,pe=function(){function t(t){this._currentLoadData={},this._currentUUIDQueue=[],this._storageLoadData={},this._status=ie.FREE,this._waitingLoadQueue=[],this._opts=t,this._event=new oe,this._waitingLoadQueue=[]}return t.prototype.load=function(t,e){var n=this._resetLoadData(t,e),o=n[0],i=n[1];this._status===ie.FREE||this._status===ie.COMPLETE?(this._currentUUIDQueue=o,this._currentLoadData=i,this._loadTask()):this._status===ie.LOADING&&o.length>0&&this._waitingLoadQueue.push({uuidQueue:o,loadData:i})},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype.isComplete=function(){return this._status===ie.COMPLETE},t.prototype.getContent=function(t){var e;return'loaded'===(null===(e=this._storageLoadData[t])||void 0===e?void 0:e.status)?this._storageLoadData[t].content:null},t.prototype._resetLoadData=function(t,e){for(var n={},o=[],i=this._storageLoadData,r=t.elements.length-1;r>=0;r--){var s=t.elements[r];['image','svg','html'].includes(s.type)&&(i[s.uuid]?e.includes(s.uuid)&&(n[s.uuid]=this._createEmptyLoadItem(s),o.push(s.uuid)):(n[s.uuid]=this._createEmptyLoadItem(s),o.push(s.uuid)))}return[o,n]},t.prototype._createEmptyLoadItem=function(t){var e='',n=t.type,o=t.w,i=t.h;if('image'===t.type)e=(r=t).desc.src||'';else if('svg'===t.type){e=(r=t).desc.svg||''}else if('html'===t.type){var r;e=function(t){return t.replace(/<script[\s\S]*?<\/script>/gi,'')}((r=t).desc.html||''),o=r.desc.width||t.w,i=r.desc.height||t.h}return{uuid:t.uuid,type:n,status:'null',content:null,source:e,elemW:o,elemH:i,element:ce(t)}},t.prototype._loadTask=function(){var t=this;if(this._status!==ie.LOADING){if(this._status=ie.LOADING,0===this._currentUUIDQueue.length){if(0===this._waitingLoadQueue.length)return this._status=ie.COMPLETE,void this._event.trigger('complete',void 0);var e=this._waitingLoadQueue.shift();if(e){var n=e.uuidQueue,o=e.loadData;this._currentLoadData=o,this._currentUUIDQueue=n}}var i=this._opts.maxParallelNum,r=this._currentUUIDQueue.splice(0,i),s={};r.forEach((function(t,e){s[t]=e}));var l=[],a=function(){if(l.length>=i)return!1;if(0===r.length)return!0;for(var e=function(e){var n=r.shift();if(void 0===n)return"break";l.push(n),t._loadElementSource(t._currentLoadData[n]).then((function(e){var o,i;l.splice(l.indexOf(n),1);var s=a();t._storageLoadData[n]={uuid:n,type:t._currentLoadData[n].type,status:'loaded',content:e,source:t._currentLoadData[n].source,elemW:t._currentLoadData[n].elemW,elemH:t._currentLoadData[n].elemH,element:t._currentLoadData[n].element},0===l.length&&0===r.length&&!0===s&&(t._status=ie.FREE,t._loadTask()),t._event.trigger('load',{uuid:null===(o=t._storageLoadData[n])||void 0===o?void 0:o.uuid,type:t._storageLoadData[n].type,status:t._storageLoadData[n].status,content:t._storageLoadData[n].content,source:t._storageLoadData[n].source,elemW:t._storageLoadData[n].elemW,elemH:t._storageLoadData[n].elemH,element:null===(i=t._storageLoadData[n])||void 0===i?void 0:i.element})})).catch((function(e){var o,i,s,c,h,u,f,d,p,v,g,m;console.warn(e),l.splice(l.indexOf(n),1);var y=a();t._currentLoadData[n]&&(t._storageLoadData[n]={uuid:n,type:null===(o=t._currentLoadData[n])||void 0===o?void 0:o.type,status:'fail',content:null,error:e,source:null===(i=t._currentLoadData[n])||void 0===i?void 0:i.source,elemW:null===(s=t._currentLoadData[n])||void 0===s?void 0:s.elemW,elemH:null===(c=t._currentLoadData[n])||void 0===c?void 0:c.elemH,element:null===(h=t._currentLoadData[n])||void 0===h?void 0:h.element}),0===l.length&&0===r.length&&!0===y&&(t._status=ie.FREE,t._loadTask()),t._currentLoadData[n]&&t._event.trigger('error',{uuid:n,type:null===(u=t._storageLoadData[n])||void 0===u?void 0:u.type,status:null===(f=t._storageLoadData[n])||void 0===f?void 0:f.status,content:null===(d=t._storageLoadData[n])||void 0===d?void 0:d.content,source:null===(p=t._storageLoadData[n])||void 0===p?void 0:p.source,elemW:null===(v=t._storageLoadData[n])||void 0===v?void 0:v.elemW,elemH:null===(g=t._storageLoadData[n])||void 0===g?void 0:g.elemH,element:null===(m=t._storageLoadData[n])||void 0===m?void 0:m.element})}))},n=l.length;n<i;n++){if("break"===e())break}return!1};a()}},t.prototype._loadElementSource=function(t){return St(this,void 0,void 0,(function(){return xt(this,(function(e){switch(e.label){case 0:return t&&'image'===t.type?[4,se(t.source)]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return t&&'svg'===t.type?[4,le(t.source)]:[3,4];case 4:return t&&'html'===t.type?[4,ae(t.source,{width:t.elemW,height:t.elemH})]:[3,6];case 6:throw Error('Element\'s source is not support!')}}))}))},t}(),ve=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}(),ge=Symbol('_queue'),me=Symbol('_ctx'),ye=Symbol('_status'),_e=Symbol('_loader'),Se=Symbol('_opts'),xe=Symbol('_freeze'),be=Symbol('_drawFrame'),we=Symbol('_retainQueueOneItem'),Ee=window.requestAnimationFrame,Pe=Yt.uuid.createUUID,Ce=Yt.data.deepClone,ze=Yt.Context;!function(t){t.NULL="null",t.FREE="free",t.DRAWING="drawing",t.FREEZE="freeze"}(de||(de={}));var De=function(t){function e(e){var n=t.call(this)||this;return n[he]=[],n[ue]=null,n[fe]=de.NULL,n[Se]=e,n[_e]=new pe({maxParallelNum:6}),n[_e].on('load',(function(t){n[be](),n.trigger('load',{element:t.element})})),n[_e].on('error',(function(t){n.trigger('error',{element:t.element,error:t.error})})),n[_e].on('complete',(function(){n.trigger('loadComplete',{t:Date.now()})})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}yt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.render=function(t,e,n){var o=(n||{}).changeResourceUUIDs,i=void 0===o?[]:o;this[ye]=de.FREE;var r=Ce(e);if(Array.isArray(r.elements)&&r.elements.forEach((function(t){'string'==typeof t.uuid&&t.uuid||(t.uuid=Pe())})),!this[me])if(this[Se]&&'[object HTMLCanvasElement]'===Object.prototype.toString.call(t)){var s=this[Se],l=s.width,a=s.height,c=s.contextWidth,h=s.contextHeight,u=s.devicePixelRatio,f=t;f.width=l*u,f.height=a*u;var d=f.getContext('2d');this[me]=new ze(d,{width:l,height:a,contextWidth:c||l,contextHeight:h||a,devicePixelRatio:u})}else t&&(this[me]=t);if(![de.FREEZE].includes(this[ye])){var p=Ce({data:r});this[ge].push(p),this[be](),this[_e].load(r,i||[])}},e.prototype.getContext=function(){return this[me]},e.prototype.thaw=function(){this[ye]=de.FREE},e.prototype[(he=ge,ue=me,fe=ye,xe)]=function(){this[ye]=de.FREEZE},e.prototype[be]=function(){var t=this;this[ye]!==de.FREEZE&&Ee((function(){if(t[ye]!==de.FREEZE){var e=t[me],n=t[ge][0],o=!1;t[ge].length>1?n=t[ge].shift():o=!0,!0!==t[_e].isComplete()?(t[be](),n&&e&&ne(e,n.data,t[_e])):n&&e?(ne(e,n.data,t[_e]),t[we](),o?t[ye]=de.FREE:t[be]()):t[ye]=de.FREE,t.trigger('drawFrame',{t:Date.now()}),!0===t[_e].isComplete()&&1===t[ge].length&&t[ye]===de.FREE&&(e&&t[ge][0]&&t[ge][0].data&&ne(e,t[ge][0].data,t[_e]),t.trigger('drawFrameComplete',{t:Date.now()}),t[xe]())}}))},e.prototype[we]=function(){if(!(this[ge].length<=1)){var t=Ce(this[ge][this[ge].length-1]);this[ge]=[t]}},e}(ve),Le=mt.color.isColorStr;function Te(t){return'number'==typeof t&&(t>0||t<=0)}function Me(t){return'number'==typeof t&&t>=0}function ke(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ie(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var We={x:function(t){return Te(t)},y:function(t){return Te(t)},w:Me,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:Te,borderWidth:function(t){return Me(t)},borderRadius:function(t){return Te(t)&&t>=0},color:function(t){return Le(t)},imageSrc:function(t){return Ie(t)||ke(t)},imageURL:ke,imageBase64:Ie,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return Te(t)&&t>0},lineHeight:function(t){return Te(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return Te(t)&&t>0}};function Oe(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!We.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!We.number(n))&&!(t.hasOwnProperty('borderWidth')&&!We.number(o)))}var Ue={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(We.x(e)&&We.y(n)&&We.w(o)&&We.h(i)&&We.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!We.text(e)&&(!!We.color(n)&&(!!We.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!We.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!We.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!We.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!We.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!We.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!We.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!We.color(h))&&!!Oe(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!We.color(e))&&!!Oe(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!We.color(e))&&(!(t.hasOwnProperty('borderColor')&&!We.color(n))&&!(t.hasOwnProperty('borderWidth')&&!We.number(o)))},imageDesc:function(t){var e=t.src;return!!We.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!We.svg(e)},htmlDesc:function(t){var e=t.html;return!!We.html(e)}};function Re(t){return t/180*Math.PI}function Ae(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function Fe(t,e){var n=e.x-t.x,o=t.y-e.y;if(0===n){if(o<0)return Math.PI/2;if(o>0)return 1.5*Math.PI}else if(0===o){if(n<0)return Math.PI;if(n>0)return 0}return n>0&&o<0?Math.atan(Math.abs(o)/Math.abs(n)):n<0&&o<0?Math.PI-Math.atan(Math.abs(o)/Math.abs(n)):n<0&&o>0?Math.PI+Math.atan(Math.abs(o)/Math.abs(n)):n>0&&o>0?2*Math.PI-Math.atan(Math.abs(o)/Math.abs(n)):null}var Ye={elementWrapper:{color:'#2ab6f1',lockColor:'#aaaaaa',controllerSize:6,lineWidth:1,lineDash:[4,3]}};var Xe=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();function Ne(t,e){var n,o;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.src)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.src)}function He(t,e){var n,o;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.svg)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.svg)}function Be(t,e){var n,o,i,r,s,l;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.html)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.html)||(null===(i=null==t?void 0:t.desc)||void 0===i?void 0:i.width)!==(null===(r=null==e?void 0:e.desc)||void 0===r?void 0:r.width)||(null===(s=null==t?void 0:t.desc)||void 0===s?void 0:s.height)!==(null===(l=null==e?void 0:e.desc)||void 0===l?void 0:l.height)}function je(t,e){var n=null,o=!1;switch(e.type){case'image':o=Ne(t,e);break;case'svg':o=He(t,e);break;case'html':o=Be(t,e)}return!0===o&&(n=e.uuid),n}function Ge(t){var e={};return t.elements.forEach((function(t){e[t.uuid]=t})),e}function Qe(t,e,n){return Ve(t,Ae(e),Re(e.angle||0)||0,n)}function Ve(t,e,n,o){e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(n),t.translate(-e.x,-e.y)),o(t),e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(-n),t.translate(-e.x,-e.y))}function $e(t){var e=t.toFixed(2);return parseFloat(e)}function Ze(t){return $e(t%360)}var qe=Object.keys({text:{},rect:{},image:{},svg:{},circle:{},html:{}}),Je=mt.uuid.createUUID,Ke=15,tn=function(){function t(t){this._ctx=t}return t.prototype.initData=function(t){return t.elements.forEach((function(t){t.uuid&&'string'==typeof t.uuid||(t.uuid=Je())})),t},t.prototype.isPointInElement=function(t,e){for(var n,o,i=this._ctx,r=-1,s=null,l=function(l){var a=e.elements[l];if(!0===(null===(n=a.operation)||void 0===n?void 0:n.invisible))return"continue";var c=0;return(null===(o=a.desc)||void 0===o?void 0:o.borderWidth)>0&&(c=a.desc.borderWidth),Qe(i,a,(function(){i.beginPath(),i.moveTo(a.x-c,a.y-c),i.lineTo(a.x+a.w+c,a.y-c),i.lineTo(a.x+a.w+c,a.y+a.h+c),i.lineTo(a.x-c,a.y+a.h+c),i.lineTo(a.x-c,a.y-c),i.closePath(),i.isPointInPath(t.x,t.y)&&(r=l,s=a.uuid)})),r>=0?"break":void 0},a=e.elements.length-1;a>=0;a--){if("break"===l(a))break}return[r,s]},t.prototype.dragElement=function(t,e,n,o,i){var r=this.getElementIndex(t,e);if(t.elements[r]){var s=n.x-o.x,l=n.y-o.y;t.elements[r].x+=s/i,t.elements[r].y+=l/i,this.limitElementAttrs(t.elements[r])}},t.prototype.transformElement=function(t,e,n,o,i,r){var s,l,a=this.getElementIndex(t,e);if(!t.elements[a])return null;if(!0===(null===(l=null===(s=t.elements[a])||void 0===s?void 0:s.operation)||void 0===l?void 0:l.lock))return null;var c=(n.x-o.x)/i,h=(n.y-o.y)/i,u=t.elements[a];if(['top-left','top','top-right','right','bottom-right','bottom','bottom-left','left'].includes(r)){var f=function(t,e,n,o,i){var r={x:t.x,y:t.y,w:t.w,h:t.h};switch(t.angle,o){case'top-left':t.w-e>0&&t.h-n>0&&(r.x+=e,r.y+=n,r.w-=e,r.h-=n);break;case'top':if(0===t.angle||Math.abs(t.angle)<Ke)r.h-n>0&&(r.y+=n,r.h-=n);else if(t.angle>0||t.angle<0){var s=t.angle>0?t.angle:Math.max(0,t.angle+360),l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(s<90){l=0-on(l,n);var h=en(s);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(s<180){l=on(l,e);h=en(s-90);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(s<270){l=on(l,n);h=en(s-180);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(s<360){l=0-on(l,e);h=en(s-270);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}r.h+l>0&&(r.h=r.h+l,r.x=a-r.w/2,r.y=c-r.h/2)}else r.h-n>0&&(r.y+=n,r.h-=n);break;case'top-right':r.h-n>0&&r.w+e>0&&(r.y+=n,r.w+=e,r.h-=n);break;case'right':if(0===t.angle||Math.abs(t.angle)<Ke)t.w+e>0&&(r.w+=e);else if(t.angle>0||t.angle<0){var u=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(u<90){l=on(l,n);h=en(u);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(u<180){l=on(l,n);h=en(u-90);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(u<270){l=on(l,n);h=en(u-180);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h),l=0-l}else if(u<360){l=on(l,e);h=en(u-270);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}r.w+l>0&&(r.w=r.w+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.w+e>0&&(r.w+=e);break;case'bottom-right':t.w+e>0&&t.h+n>0&&(r.w+=e,r.h+=n);break;case'bottom':if(0===t.angle||Math.abs(t.angle)<Ke)t.h+n>0&&(r.h+=n);else if(t.angle>0||t.angle<0){var f=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(f<90){l=on(l,n);h=en(f);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(f<180){l=0-on(l,e);h=en(f-90);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}else if(f<270){l=on(l,e);h=en(f-180);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(f<360){l=on(l,e);h=en(f-270);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}r.h+l>0&&(r.h=r.h+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.h+n>0&&(r.h+=n);break;case'bottom-left':t.w-e>0&&t.h+n>0&&(r.x+=e,r.w-=e,r.h+=n);break;case'left':if(0===t.angle||Math.abs(t.angle)<Ke)t.w-e>0&&(r.x+=e,r.w-=e);else if(t.angle>0||t.angle<0){var d=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(d<90){l=0-on(l,e);h=en(d);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}else if(d<180){l=on(l,e);h=en(d-90);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(d<270){l=on(l,n);h=en(d-180);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(d<360){l=on(l,n);var p;h=en(d-270);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}r.w+l>0&&(r.w=r.w+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.w-e>0&&(r.x+=e,r.w-=e)}return r}(u,c,h,r);u.x=f.x,u.y=f.y,u.w=f.w,u.h=f.h}else if('rotate'===r){var d=function(t,e,n){var o=Fe(t,e),i=Fe(t,n);return null!==i&&null!==o?o>3*Math.PI/2&&i<Math.PI/2?i+(2*Math.PI-o):i>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-i):i-o:0}(Ae(u),o,n);u.angle=(u.angle||0)+function(t){return t/Math.PI*180}(d)}return this.limitElementAttrs(u),{width:$e(u.w),height:$e(u.h),angle:Ze(u.angle||0)}},t.prototype.getElementIndex=function(t,e){for(var n=-1,o=0;o<t.elements.length;o++)if(t.elements[o].uuid===e){n=o;break}return n},t.prototype.limitElementAttrs=function(t){t.x=$e(t.x),t.y=$e(t.y),t.w=$e(t.w),t.h=$e(t.h),t.angle=Ze(t.angle||0)},t}();function en(t){return t*Math.PI/180}function nn(t,e){return Math.sqrt(t*t+e*e)}function on(t,e){return e>0?Math.abs(t):0-Math.abs(t)}var rn=mt.data.deepClone,sn=function(){function t(t,e){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._board=t,this._ctx=this._board.getContext(),this._coreConfig=e,this._helperConfig={elementIndexMap:{}}}return t.prototype.updateConfig=function(t,e){this._updateElementIndex(t),this._updateSelectedElementWrapper(t,e),this._updateSelectedElementListWrapper(t,e)},t.prototype.getConfig=function(){return rn(this._helperConfig)},t.prototype.getElementIndexByUUID=function(t){var e=this._helperConfig.elementIndexMap[t];return e>=0?e:null},t.prototype.isPointInElementWrapperController=function(t,e){var n,o,i=this._ctx,r=(null===(o=null===(n=this._helperConfig)||void 0===n?void 0:n.selectedElementWrapper)||void 0===o?void 0:o.uuid)||null,s=null,l=null,a=null;if(!this._helperConfig.selectedElementWrapper)return{uuid:r,selectedControllerDirection:l,directIndex:s,hoverControllerDirection:a};var c=this._helperConfig.selectedElementWrapper,h=[c.controllers.right,c.controllers.topRight,c.controllers.top,c.controllers.topLeft,c.controllers.left,c.controllers.bottomLeft,c.controllers.bottom,c.controllers.bottomRight],u=['right','top-right','top','top-left','left','bottom-left','bottom','bottom-right'],f=mt.data.deepClone(u),d=0;if(e&&r){var p=this.getElementIndexByUUID(r);if(null!==p&&p>=0){var v=e.elements[p].angle;v<0&&(v+=360),v<45?d=0:v<90?d=1:v<135?d=2:v<180?d=3:v<225?d=4:v<270?d=5:v<315&&(d=6)}}if(d>0&&(f=f.slice(-d).concat(f.slice(0,-d))),Ve(i,c.translate,c.radian||0,(function(){for(var e=0;e<h.length;e++){var n=h[e];if(!0!==n.invisible&&(i.beginPath(),i.arc(n.x,n.y,c.controllerSize,0,2*Math.PI),i.closePath(),i.isPointInPath(t.x,t.y)&&(l=u[e],a=f[e]),l)){s=e;break}}})),null===l){var g=c.controllers.rotate;!0!==g.invisible&&Ve(i,c.translate,c.radian||0,(function(){i.beginPath(),i.arc(g.x,g.y,c.controllerSize,0,2*Math.PI),i.closePath(),i.isPointInPath(t.x,t.y)&&(l='rotate',a='rotate')}))}return{uuid:r,selectedControllerDirection:l,hoverControllerDirection:a,directIndex:s}},t.prototype.isPointInElementList=function(t,e){for(var n,o,i,r=this._ctx,s=-1,l=null,a=(null===(n=this._helperConfig)||void 0===n?void 0:n.selectedElementListWrappers)||[],c=function(n){var c=a[n],u=h._helperConfig.elementIndexMap[c.uuid],f=e.elements[u];if(!f)return"continue";if(!0===(null===(o=f.operation)||void 0===o?void 0:o.invisible))return"continue";var d=0;return(null===(i=f.desc)||void 0===i?void 0:i.borderWidth)>0&&(d=f.desc.borderWidth),Qe(r,f,(function(){r.beginPath(),r.moveTo(f.x-d,f.y-d),r.lineTo(f.x+f.w+d,f.y-d),r.lineTo(f.x+f.w+d,f.y+f.h+d),r.lineTo(f.x-d,f.y+f.h+d),r.lineTo(f.x-d,f.y-d),r.closePath(),r.isPointInPath(t.x,t.y)&&(s=n,l=f.uuid)})),s>=0?"break":void 0},h=this,u=0;u<a.length;u++){if("break"===c(u))break}return!!(l&&s>=0)},t.prototype.startSelectArea=function(t){this._areaStart=t,this._areaEnd=t},t.prototype.changeSelectArea=function(t){this._areaEnd=t,this._calcSelectedArea()},t.prototype.clearSelectedArea=function(){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._calcSelectedArea()},t.prototype.calcSelectedElements=function(t){var e=this._ctx.getTransform(),n=e.scale,o=void 0===n?1:n,i=e.scrollX,r=void 0===i?0:i,s=e.scrollY,l=void 0===s?0:s,a=this._areaStart,c=this._areaEnd,h=(Math.min(a.x,c.x)-r)/o,u=(Math.min(a.y,c.y)-l)/o,f=Math.abs(c.x-a.x)/o,d=Math.abs(c.y-a.y)/o,p=[],v=this._ctx;return v.beginPath(),v.moveTo(h,u),v.lineTo(h+f,u),v.lineTo(h+f,u+d),v.lineTo(h,u+d),v.lineTo(h,u),v.closePath(),t.elements.forEach((function(t){var e;if(!0!==(null===(e=null==t?void 0:t.operation)||void 0===e?void 0:e.invisible)){var n=t.x+t.w/2,o=t.y+t.h/2;v.isPointInPathWithoutScroll(n,o)&&p.push(t.uuid)}})),p},t.prototype._calcSelectedArea=function(){var t=this._areaStart,e=this._areaEnd,n=this._ctx.getTransform(),o=n.scale,i=void 0===o?1:o,r=n.scrollX,s=void 0===r?0:r,l=n.scrollY,a=void 0===l?0:l,c=this._coreConfig.elementWrapper,h=c.lineWidth/i,u=c.lineDash.map((function(t){return t/i}));this._helperConfig.selectedAreaWrapper={x:(Math.min(t.x,e.x)-s)/i,y:(Math.min(t.y,e.y)-a)/i,w:Math.abs(e.x-t.x)/i,h:Math.abs(e.y-t.y)/i,startPoint:{x:t.x,y:t.y},endPoint:{x:e.x,y:e.y},lineWidth:h,lineDash:u,color:c.color}},t.prototype._updateElementIndex=function(t){var e=this;this._helperConfig.elementIndexMap={},t.elements.forEach((function(t,n){e._helperConfig.elementIndexMap[t.uuid]=n}))},t.prototype._updateSelectedElementWrapper=function(t,e){var n,o=e.selectedUUID;if('string'==typeof o&&this._helperConfig.elementIndexMap[o]>=0){var i=this._helperConfig.elementIndexMap[o],r=t.elements[i];if(!0!==(null===(n=null==r?void 0:r.operation)||void 0===n?void 0:n.invisible)){var s=this._createSelectedElementWrapper(r,e);this._helperConfig.selectedElementWrapper=s}}else delete this._helperConfig.selectedElementWrapper},t.prototype._updateSelectedElementListWrapper=function(t,e){var n=this,o=e.selectedUUIDList,i=[];t.elements.forEach((function(t,r){if(null==o?void 0:o.includes(t.uuid)){var s=n._createSelectedElementWrapper(t,e);i.push(s)}})),this._helperConfig.selectedElementListWrappers=i},t.prototype._createSelectedElementWrapper=function(t,e){var n,o,i,r,s,l,a,c,h,u,f,d,p=e.scale,v=this._coreConfig.elementWrapper,g=v.controllerSize/p,m=v.lineWidth/p,y=v.lineDash.map((function(t){return t/p})),_=(null===(n=t.desc)||void 0===n?void 0:n.borderWidth)||0,S=!1;'number'==typeof t.angle&&Math.abs(t.angle)>15&&(S=!0);var x=m,b={uuid:t.uuid,controllerSize:g,controllerOffset:x,lock:!0===(null===(o=null==t?void 0:t.operation)||void 0===o?void 0:o.lock),controllers:{topLeft:{x:t.x-x-_,y:t.y-x-_,invisible:S||!0===(null===(i=null==t?void 0:t.operation)||void 0===i?void 0:i.disbaleScale)},top:{x:t.x+t.w/2,y:t.y-x-_,invisible:!0===(null===(r=null==t?void 0:t.operation)||void 0===r?void 0:r.disbaleScale)},topRight:{x:t.x+t.w+x+_,y:t.y-x-_,invisible:S||!0===(null===(s=null==t?void 0:t.operation)||void 0===s?void 0:s.disbaleScale)},right:{x:t.x+t.w+x+_,y:t.y+t.h/2,invisible:!0===(null===(l=null==t?void 0:t.operation)||void 0===l?void 0:l.disbaleScale)},bottomRight:{x:t.x+t.w+x+_,y:t.y+t.h+x+_,invisible:S||!0===(null===(a=null==t?void 0:t.operation)||void 0===a?void 0:a.disbaleScale)},bottom:{x:t.x+t.w/2,y:t.y+t.h+x+_,invisible:!0===(null===(c=null==t?void 0:t.operation)||void 0===c?void 0:c.disbaleScale)},bottomLeft:{x:t.x-x-_,y:t.y+t.h+x+_,invisible:S||!0===(null===(h=null==t?void 0:t.operation)||void 0===h?void 0:h.disbaleScale)},left:{x:t.x-x-_,y:t.y+t.h/2,invisible:!0===(null===(u=null==t?void 0:t.operation)||void 0===u?void 0:u.disbaleScale)},rotate:{x:t.x+t.w/2,y:t.y-g-(2*g+12)-_,invisible:!0===(null===(f=null==t?void 0:t.operation)||void 0===f?void 0:f.disbaleRotate)}},lineWidth:m,lineDash:y,color:!0===(null===(d=null==t?void 0:t.operation)||void 0===d?void 0:d.lock)?v.lockColor:v.color};return'number'==typeof t.angle&&(t.angle>0||t.angle<0)&&(b.radian=Re(t.angle),b.translate=Ae(t)),b},t}(),ln=Symbol('_displayCtx'),an=Symbol('_helper'),cn=Symbol('_element'),hn=Symbol('_opts'),un=function(){function t(t){this[hn]=t,this[ln]=this[hn].board,this[cn]=this[hn].element,this[an]=this[hn].helper}return t.prototype.isEffectivePoint=function(t){var e=this[ln].getScrollLineWidth(),n=this[ln].getScreenInfo();return t.x<=n.width-e&&t.y<=n.height-e},t.prototype.judgePointCursor=function(t,e){var n='auto',o=null;if(!this.isEffectivePoint(t))return{cursor:n,elementUUID:o};var i=this[an].isPointInElementWrapperController(t,e),r=i.uuid,s=i.hoverControllerDirection;if(r&&s){switch(s){case'top-right':n='ne-resize';break;case'top-left':n='nw-resize';break;case'top':n='n-resize';break;case'right':n='e-resize';break;case'bottom-right':n='se-resize';break;case'bottom':n='s-resize';break;case'bottom-left':n='sw-resize';break;case'left':n='w-resize';break;case'rotate':n='grab'}r&&(o=r)}else{var l=this[cn].isPointInElement(t,e),a=l[0],c=l[1];a>=0&&(n='move'),c&&(o=c)}return{cursor:n,elementUUID:o}},t}();function fn(t){var e={elements:[]};return Array.isArray(null==t?void 0:t.elements)&&(null==t||t.elements.forEach((function(t){void 0===t&&(t={}),function(t){if(!(dn(t.x)&&dn(t.y)&&dn(t.w)&&dn(t.h)))return!1;if('string'!=typeof t.type||!qe.includes(t.type))return!1;return!0}(t)&&e.elements.push(t)}))),'string'==typeof t.bgColor&&(e.bgColor=t.bgColor),e}function dn(t){return t>=0||t<0}var pn,vn,gn=function(){function t(){this._temp={hasInited:!1}}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp={hasInited:!1}},t}(),mn=Symbol('_board'),yn=Symbol('_data'),_n=Symbol('_opts'),Sn=Symbol('_config'),xn=Symbol('_renderer'),bn=Symbol('_element'),wn=Symbol('_tempData'),En=Symbol('_draw'),Pn=Symbol('_coreEvent'),Cn=Symbol('_emitChangeScreen'),zn=Symbol('_emitChangeData'),Dn=Symbol('_engine');!function(t){t.NULL="null",t.SELECT_ELEMENT="select-element",t.SELECT_ELEMENT_LIST="select-element-list",t.SELECT_ELEMENT_WRAPPER_CONTROLLER="select-element-wrapper-controller",t.SELECT_AREA="select-area"}(pn||(pn={})),function(t){t.DRAGGING="dragging",t.NULL="null"}(vn||(vn={}));var Ln=mt.data.deepClone,Tn=mt.uuid.createUUID;function Mn(){return{hasInited:!1,mode:pn.NULL,cursorStatus:vn.NULL,selectedUUID:null,selectedUUIDList:[],hoverUUID:null,selectedControllerDirection:null,hoverControllerDirection:null,prevPoint:null}}var kn=function(){function t(){this._temp=Mn()}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp=Mn()},t}(),In=mt.time,Wn=mt.data.deepClone,On=function(){function t(t){this._plugins=[];var e=t.board,n=t.config,o=t.element,i=new sn(e,n);this._opts=t,this.temp=new kn,this.helper=i,this._mapper=new un({board:e,helper:i,element:o})}return t.prototype.addPlugin=function(t){this._plugins.push(t)},t.prototype.getHelperConfig=function(){return this.helper.getConfig()},t.prototype.updateHelperConfig=function(t){var e,n=this._opts,o=n.board,i=n.getDataFeekback,r=n.config,s=i(),l=o.getTransform();this.helper.updateConfig(s,{width:t.width,height:t.height,devicePixelRatio:t.devicePixelRatio,canScroll:!0===(null===(e=null==r?void 0:r.scrollWrapper)||void 0===e?void 0:e.use),selectedUUID:this.temp.get('selectedUUID'),selectedUUIDList:this.temp.get('selectedUUIDList'),scale:l.scale,scrollX:l.scrollX,scrollY:l.scrollY})},t.prototype.init=function(){this._initEvent()},t.prototype._initEvent=function(){if(!0!==this.temp.get('hasInited')){var t=this._opts.board;t.on('hover',In.throttle(this._handleHover.bind(this),32)),t.on('leave',In.throttle(this._handleLeave.bind(this),32)),t.on('point',In.throttle(this._handleClick.bind(this),16)),t.on('doubleClick',this._handleDoubleClick.bind(this)),t.on('point',this._handlePoint.bind(this)),t.on('moveStart',this._handleMoveStart.bind(this)),t.on('move',In.throttle(this._handleMove.bind(this),16)),t.on('moveEnd',this._handleMoveEnd.bind(this))}},t.prototype._handleDoubleClick=function(t){var e,n,o,i=this._opts,r=i.element,s=i.getDataFeekback,l=i.drawFeekback,a=i.coreEvent,c=s(),h=r.isPointInElement(t,c),u=h[0],f=h[1];if(u>=0&&f){var d=Wn(null===(e=c.elements)||void 0===e?void 0:e[u]);!0!==(null===(n=null==d?void 0:d.operation)||void 0===n?void 0:n.invisible)&&a.trigger('screenDoubleClickElement',{index:u,uuid:f,element:Wn(null===(o=c.elements)||void 0===o?void 0:o[u])})}l()},t.prototype._handlePoint=function(t){var e,n,o;if(this._mapper.isEffectivePoint(t)){var i=this._opts,r=i.element,s=i.getDataFeekback,l=i.selectElementByIndex,a=i.coreEvent,c=i.emitChangeScreen,h=i.drawFeekback,u=this.helper,f=s();if(u.isPointInElementList(t,f))this.temp.set('mode',pn.SELECT_ELEMENT_LIST);else{var d=u.isPointInElementWrapperController(t,f),p=d.uuid,v=d.selectedControllerDirection;if(p&&v)this.temp.set('mode',pn.SELECT_ELEMENT_WRAPPER_CONTROLLER),this.temp.set('selectedControllerDirection',v),this.temp.set('selectedUUID',p);else{var g=r.isPointInElement(t,f),m=g[0],y=g[1];m>=0&&!0!==(null===(n=null===(e=f.elements[m])||void 0===e?void 0:e.operation)||void 0===n?void 0:n.invisible)?(l(m,{useMode:!0}),'string'==typeof y&&a.has('screenSelectElement')&&(a.trigger('screenSelectElement',{index:m,uuid:y,element:Wn(null===(o=f.elements)||void 0===o?void 0:o[m])}),c()),this.temp.set('mode',pn.SELECT_ELEMENT)):(this.temp.set('selectedUUIDList',[]),this.temp.set('selectedUUID',null),this.temp.set('mode',pn.SELECT_AREA))}}h()}},t.prototype._handleClick=function(t){var e,n=this._opts,o=n.element,i=n.getDataFeekback,r=n.coreEvent,s=n.drawFeekback,l=i(),a=o.isPointInElement(t,l),c=a[0],h=a[1];c>=0&&h&&r.trigger('screenClickElement',{index:c,uuid:h,element:Wn(null===(e=l.elements)||void 0===e?void 0:e[c])}),s()},t.prototype._handleMoveStart=function(t){var e=this._opts,n=e.element,o=e.getDataFeekback,i=e.coreEvent,r=o(),s=this.helper;this.temp.set('prevPoint',t);var l=this.temp.get('selectedUUID');this.temp.get('mode')===pn.SELECT_ELEMENT_LIST||(this.temp.get('mode')===pn.SELECT_ELEMENT?'string'==typeof l&&i.has('screenMoveElementStart')&&i.trigger('screenMoveElementStart',{index:n.getElementIndex(r,l),uuid:l,x:t.x,y:t.y}):this.temp.get('mode')===pn.SELECT_AREA&&s.startSelectArea(t))},t.prototype._handleMove=function(t){var e=this._opts.drawFeekback,n=this.helper;this.temp.get('mode')===pn.SELECT_ELEMENT_LIST?(this._dragElements(this.temp.get('selectedUUIDList'),t,this.temp.get('prevPoint')),e(),this.temp.set('cursorStatus',vn.DRAGGING)):'string'==typeof this.temp.get('selectedUUID')?this.temp.get('mode')===pn.SELECT_ELEMENT?(this._dragElements([this.temp.get('selectedUUID')],t,this.temp.get('prevPoint')),e(),this.temp.set('cursorStatus',vn.DRAGGING)):this.temp.get('mode')===pn.SELECT_ELEMENT_WRAPPER_CONTROLLER&&this.temp.get('selectedControllerDirection')&&(this._transfromElement(this.temp.get('selectedUUID'),t,this.temp.get('prevPoint'),this.temp.get('selectedControllerDirection')),this.temp.set('cursorStatus',vn.DRAGGING)):this.temp.get('mode')===pn.SELECT_AREA&&(n.changeSelectArea(t),e()),this.temp.set('prevPoint',t)},t.prototype._dragElements=function(t,e,n){if(n){var o=this._opts,i=o.board,r=o.element,s=o.getDataFeekback,l=o.drawFeekback,a=s(),c=this.helper;t.forEach((function(t){var o,s,l=c.getElementIndexByUUID(t);if(null!==l){var h=a.elements[l];!0!==(null===(o=null==h?void 0:h.operation)||void 0===o?void 0:o.lock)&&!0!==(null===(s=null==h?void 0:h.operation)||void 0===s?void 0:s.invisible)&&r.dragElement(a,t,e,n,i.getContext().getTransform().scale)}})),l()}},t.prototype._transfromElement=function(t,e,n,o){if(!n)return null;var i=this._opts,r=i.board,s=i.element,l=i.getDataFeekback,a=i.drawFeekback,c=l(),h=s.transformElement(c,t,e,n,r.getContext().getTransform().scale,o);return a(),h},t.prototype._handleMoveEnd=function(t){var e=this._opts,n=e.element,o=e.getDataFeekback,i=e.coreEvent,r=e.drawFeekback,s=e.emitChangeData,l=o(),a=this.helper,c=this.temp.get('selectedUUID');if('string'==typeof c){var h=n.getElementIndex(l,c),u=l.elements[h];u&&(i.has('screenMoveElementEnd')&&i.trigger('screenMoveElementEnd',{index:h,uuid:c,x:t.x,y:t.y}),i.has('screenChangeElement')&&i.trigger('screenChangeElement',{index:h,uuid:c,width:u.w,height:u.h,angle:u.angle||0}),s())}else if(this.temp.get('mode')===pn.SELECT_AREA){var f=a.calcSelectedElements(l);f.length>0?(this.temp.set('selectedUUIDList',f),this.temp.set('selectedUUID',null)):this.temp.set('mode',pn.NULL),a.clearSelectedArea(),r()}this.temp.get('mode')!==pn.SELECT_ELEMENT&&this.temp.set('selectedUUID',null),this.temp.set('cursorStatus',vn.NULL),this.temp.set('mode',pn.NULL)},t.prototype._handleHover=function(t){var e,n,o=!1,i=this._opts,r=i.board,s=i.getDataFeekback,l=i.coreEvent,a=s(),c=this.helper,h=this._mapper;if(this.temp.get('mode')===pn.SELECT_AREA)r.resetCursor();else if(this.temp.get('cursorStatus')===vn.NULL){var u=h.judgePointCursor(t,a),f=u.cursor,d=u.elementUUID;if(r.setCursor(f),d)if(null!==(g=c.getElementIndexByUUID(d))&&g>=0){var p=a.elements[g];if(!0===(null===(e=null==p?void 0:p.operation)||void 0===e?void 0:e.lock)||!0===(null===(n=null==p?void 0:p.operation)||void 0===n?void 0:n.invisible))return void r.resetCursor();if(this.temp.get('hoverUUID')!==p.uuid){var v=c.getElementIndexByUUID(this.temp.get('hoverUUID')||'');null!==v&&a.elements[v]&&l.trigger('mouseLeaveElement',{uuid:this.temp.get('hoverUUID'),index:v,element:a.elements[v]})}p&&(l.trigger('mouseOverElement',{uuid:p.uuid,index:g,element:p}),this.temp.set('hoverUUID',p.uuid),o=!0)}}if(!0!==o&&null!==this.temp.get('hoverUUID')){var g,m=this.temp.get('hoverUUID');null!==(g=c.getElementIndexByUUID(m||''))&&l.trigger('mouseLeaveElement',{uuid:m,index:g,element:a.elements[g]}),this.temp.set('hoverUUID',null)}l.has('mouseOverScreen')&&l.trigger('mouseOverScreen',t)},t.prototype._handleLeave=function(){var t=this._opts.coreEvent;t.has('mouseLeaveScreen')&&t.trigger('mouseLeaveScreen',void 0)},t}();function Un(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}var Rn=mt.data.deepClone,An=function(){function e(e,i,r){var s,l,a,c=this;this[n]=new Xe,this[o]=new gn,this[yn]={elements:[]},this[_n]=i,this[Sn]=function(e){var n=mt.data.deepClone(Ye);return e&&e.elementWrapper&&(n.elementWrapper=t(t({},n.elementWrapper),e.elementWrapper)),n}(r||{}),this[mn]=new J(e,t(t({},this[_n]),{canScroll:null===(s=null==r?void 0:r.scrollWrapper)||void 0===s?void 0:s.use,scrollConfig:{color:(null===(l=null==r?void 0:r.scrollWrapper)||void 0===l?void 0:l.color)||'#a0a0a0',lineWidth:(null===(a=null==r?void 0:r.scrollWrapper)||void 0===a?void 0:a.lineWidth)||12}})),this[xn]=new De;var h=function(){var t=c[mn].getHelperContext(),e=c[Dn].getHelperConfig();c[mn].clear();var n=c[_n],o=n.contextWidth,i=n.contextHeight,r=n.devicePixelRatio;t.clearRect(0,0,o*r,i*r),function(t,e){if(null==e?void 0:e.selectedElementWrapper){var n=e.selectedElementWrapper;Un(t),Ve(t,n.translate,n.radian||0,(function(){t.beginPath(),t.setLineDash(n.lineDash),t.setLineWidth(n.lineWidth),t.setStrokeStyle(n.color),t.moveTo(n.controllers.topLeft.x,n.controllers.topLeft.y),t.lineTo(n.controllers.topRight.x,n.controllers.topRight.y),t.lineTo(n.controllers.bottomRight.x,n.controllers.bottomRight.y),t.lineTo(n.controllers.bottomLeft.x,n.controllers.bottomLeft.y),t.lineTo(n.controllers.topLeft.x,n.controllers.topLeft.y-n.lineWidth/2),t.stroke(),t.closePath(),!0!==n.lock?(!0!==n.controllers.rotate.invisible&&(t.beginPath(),t.moveTo(n.controllers.top.x,n.controllers.top.y),t.lineTo(n.controllers.rotate.x,n.controllers.rotate.y+n.controllerSize),t.stroke(),t.closePath(),t.beginPath(),t.setLineDash([]),t.setLineWidth(n.controllerSize/2),t.arc(n.controllers.rotate.x,n.controllers.rotate.y,.8*n.controllerSize,Math.PI/6,2*Math.PI),t.stroke(),t.closePath()),t.setFillStyle(n.color),[n.controllers.topLeft,n.controllers.top,n.controllers.topRight,n.controllers.right,n.controllers.bottomRight,n.controllers.bottom,n.controllers.bottomLeft,n.controllers.left].forEach((function(e){!0!==e.invisible&&(t.beginPath(),t.arc(e.x,e.y,n.controllerSize,0,2*Math.PI),t.fill(),t.closePath())}))):(Un(t),t.setStrokeStyle(n.color),[n.controllers.topLeft,n.controllers.top,n.controllers.topRight,n.controllers.right,n.controllers.bottomRight,n.controllers.bottom,n.controllers.bottomLeft,n.controllers.left].forEach((function(e){t.beginPath(),t.moveTo(e.x-n.controllerSize/2,e.y-n.controllerSize/2),t.lineTo(e.x+n.controllerSize/2,e.y+n.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(e.x+n.controllerSize/2,e.y-n.controllerSize/2),t.lineTo(e.x-n.controllerSize/2,e.y+n.controllerSize/2),t.stroke(),t.closePath()})))}))}}(t,e),function(t,e){if(null==e?void 0:e.selectedAreaWrapper){var n=e.selectedAreaWrapper;n&&n.w>0&&n.h>0&&(Un(t),t.setGlobalAlpha(.3),t.setFillStyle(n.color),t.fillRect(n.x,n.y,n.w,n.h),Un(t),t.beginPath(),t.setLineDash(n.lineDash),t.setLineWidth(n.lineWidth),t.setStrokeStyle(n.color),t.moveTo(n.x,n.y),t.lineTo(n.x+n.w,n.y),t.lineTo(n.x+n.w,n.y+n.h),t.lineTo(n.x,n.y+n.h),t.lineTo(n.x,n.y),t.stroke(),t.closePath())}}(t,e),function(t,e){if(Array.isArray(null==e?void 0:e.selectedElementListWrappers)){var n=e.selectedElementListWrappers;null==n||n.forEach((function(e){Un(t),Ve(t,e.translate,e.radian||0,(function(){Un(t),t.setGlobalAlpha(.05),t.setFillStyle(e.color),t.fillRect(e.controllers.topLeft.x,e.controllers.topLeft.y,e.controllers.bottomRight.x-e.controllers.topLeft.x,e.controllers.bottomRight.y-e.controllers.topLeft.y),Un(t),t.beginPath(),t.setLineDash(e.lineDash),t.setLineWidth(e.lineWidth),t.setStrokeStyle(e.color),t.moveTo(e.controllers.topLeft.x,e.controllers.topLeft.y),t.lineTo(e.controllers.topRight.x,e.controllers.topRight.y),t.lineTo(e.controllers.bottomRight.x,e.controllers.bottomRight.y),t.lineTo(e.controllers.bottomLeft.x,e.controllers.bottomLeft.y),t.lineTo(e.controllers.topLeft.x,e.controllers.topLeft.y-e.lineWidth/2),t.stroke(),t.closePath(),!0===e.lock&&(Un(t),t.setStrokeStyle(e.color),[e.controllers.topLeft,e.controllers.top,e.controllers.topRight,e.controllers.right,e.controllers.bottomRight,e.controllers.bottom,e.controllers.bottomLeft,e.controllers.left].forEach((function(n){t.beginPath(),t.moveTo(n.x-e.controllerSize/2,n.y-e.controllerSize/2),t.lineTo(n.x+e.controllerSize/2,n.y+e.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(n.x+e.controllerSize/2,n.y-e.controllerSize/2),t.lineTo(n.x-e.controllerSize/2,n.y+e.controllerSize/2),t.stroke(),t.closePath()})))}))}))}}(t,e),c[mn].draw()};this[xn].on('drawFrame',(function(t){h()})),this[xn].on('drawFrameComplete',(function(t){h()})),this[bn]=new tn(this[mn].getContext()),this[Dn]=new On({coreEvent:this[Pn],board:this[mn],element:this[bn],config:this[Sn],drawFeekback:this[En].bind(this),getDataFeekback:function(){return c[yn]},selectElementByIndex:this.selectElementByIndex.bind(this),emitChangeScreen:this[Cn].bind(this),emitChangeData:this[zn].bind(this)}),this[Dn].init(),this[xn].on('drawFrame',(function(){c[Pn].trigger('drawFrame',void 0)})),this[xn].on('drawFrameComplete',(function(){c[Pn].trigger('drawFrameComplete',void 0)})),this[wn].set('hasInited',!0)}var n,o;return e.prototype[(n=Pn,o=wn,En)]=function(t){this[Dn].updateHelperConfig({width:this[_n].width,height:this[_n].height,devicePixelRatio:this[_n].devicePixelRatio}),this[xn].thaw(),this[xn].render(this[mn].getContext(),this[yn],{changeResourceUUIDs:(null==t?void 0:t.resourceChangeUUIDs)||[]})},e.prototype.getElement=function(t){return function(t,e){var n=null,o=t[Dn].helper.getElementIndexByUUID(e);return null!==o&&t[yn].elements[o]&&(n=Ln(t[yn].elements[o])),n}(this,t)},e.prototype.getElementByIndex=function(t){return function(t,e){var n=null;return e>=0&&t[yn].elements[e]&&(n=Ln(t[yn].elements[e])),n}(this,t)},e.prototype.selectElementByIndex=function(t,e){return function(t,e,n){if(t[yn].elements[e]){var o=t[yn].elements[e].uuid;!0===(null==n?void 0:n.useMode)?t[Dn].temp.set('mode',pn.SELECT_ELEMENT):t[Dn].temp.set('mode',pn.NULL),'string'==typeof o&&(t[Dn].temp.set('selectedUUID',o),t[Dn].temp.set('selectedUUIDList',[])),t[En]()}}(this,t,e)},e.prototype.selectElement=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(e);'number'==typeof o&&o>=0&&t.selectElementByIndex(o,n)}(this,t,e)},e.prototype.moveUpElement=function(t){return function(t,e){var n=t[Dn].helper.getElementIndexByUUID(e);if('number'==typeof n&&n>=0&&n<t[yn].elements.length-1){var o=t[yn].elements[n];t[yn].elements[n]=t[yn].elements[n+1],t[yn].elements[n+1]=o}t[zn](),t[En]()}(this,t)},e.prototype.moveDownElement=function(t){return function(t,e){var n=t[Dn].helper.getElementIndexByUUID(e);if('number'==typeof n&&n>0&&n<t[yn].elements.length){var o=t[yn].elements[n];t[yn].elements[n]=t[yn].elements[n-1],t[yn].elements[n-1]=o}t[zn](),t[En]()}(this,t)},e.prototype.updateElement=function(t){return function(t,e){for(var n,o=Ln(e),i=t[yn],r=[],s=0;s<i.elements.length;s++)if(o.uuid===(null===(n=i.elements[s])||void 0===n?void 0:n.uuid)){var l=je(i.elements[s],o);'string'==typeof l&&r.push(l),i.elements[s]=o;break}t[zn](),t[En]({resourceChangeUUIDs:r})}(this,t)},e.prototype.addElement=function(t){return function(t,e){var n=Ln(e);return n.uuid=Tn(),t[yn].elements.push(n),t[zn](),t[En](),n.uuid}(this,t)},e.prototype.deleteElement=function(t){return function(t,e){var n=t[bn].getElementIndex(t[yn],e);n>=0&&(t[yn].elements.splice(n,1),t[zn](),t[En]())}(this,t)},e.prototype.insertElementBefore=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(n);return null!==o?t.insertElementBeforeIndex(e,o):null}(this,t,e)},e.prototype.insertElementBeforeIndex=function(t,e){return function(t,e,n){var o=Ln(e);return o.uuid=Tn(),n>=0?(t[yn].elements.splice(n,0,o),t[zn](),t[En](),o.uuid):null}(this,t,e)},e.prototype.getSelectedElements=function(){return e=[],n=[],'string'==typeof(o=(t=this)[Dn].temp.get('selectedUUID'))&&o?n.push(o):n=t[Dn].temp.get('selectedUUIDList'),n.forEach((function(n){var o,i=t[Dn].helper.getElementIndexByUUID(n);if(null!==i&&i>=0){var r=null===(o=t[yn])||void 0===o?void 0:o.elements[i];r&&e.push(r)}})),Ln(e);var t,e,n,o},e.prototype.insertElementAfter=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(n);return null!==o?t.insertElementAfterIndex(e,o):null}(this,t,e)},e.prototype.insertElementAfterIndex=function(t,e){return function(t,e,n){var o=Ln(e);return o.uuid=Tn(),n>=0?(t[yn].elements.splice(n+1,0,o),t[zn](),t[En](),o.uuid):null}(this,t,e)},e.prototype.resetSize=function(e){this[_n]=t(t({},this[_n]),e),this[mn].resetSize(e),this[En]()},e.prototype.scale=function(t){var e=this[mn].scale(t);return this[En](),this[Cn](),e},e.prototype.scrollLeft=function(t){var e=this[mn].scrollX(0-t);return this[En](),this[Cn](),e},e.prototype.scrollTop=function(t){var e=this[mn].scrollY(0-t);return this[En](),this[Cn](),e},e.prototype.getScreenTransform=function(){var t=this[mn].getTransform();return{scale:t.scale,scrollTop:Math.max(0,0-t.scrollY),scrollLeft:Math.max(0,0-t.scrollX)}},e.prototype.getData=function(){return Rn(this[yn])},e.prototype.setData=function(t,e){var n=function(t,e){var n,o=[],i=Ge(t),r=Ge(e);for(var s in r)if(!0===['image','svg','html'].includes(null===(n=r[s])||void 0===n?void 0:n.type))if(i[s]){var l=!1;switch(i[s].type){case'image':l=Ne(i[s],r[s]);break;case'svg':l=He(i[s],r[s]);break;case'html':l=Be(i[s],r[s])}!0===l&&o.push(s)}else o.push(s);return o}(this[yn],t);this[yn]=this[bn].initData(Rn(fn(t))),e&&!0===e.triggerChangeEvent&&this[zn](),this[En]({resourceChangeUUIDs:n})},e.prototype.clearOperation=function(){this[wn].clear(),this[En]()},e.prototype.on=function(t,e){this[Pn].on(t,e)},e.prototype.off=function(t,e){this[Pn].off(t,e)},e.prototype.pointScreenToContext=function(t){return this[mn].pointScreenToContext(t)},e.prototype.pointContextToScreen=function(t){return this[mn].pointContextToScreen(t)},e.prototype.__getBoardContext=function(){return this[mn].getContext()},e.prototype.__getDisplayContext2D=function(){return this[mn].getDisplayContext2D()},e.prototype.__getOriginContext2D=function(){return this[mn].getOriginContext2D()},e.prototype[Cn]=function(){this[Pn].has('changeScreen')&&this[Pn].trigger('changeScreen',t({},this.getScreenTransform()))},e.prototype[zn]=function(){this[Pn].has('changeData')&&this[Pn].trigger('changeData',Rn(this[yn]))},e.is=We,e.check=Ue,e}();return An}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idraw/core",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"author": "chenshenhai",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@idraw/types": "^0.2.0-alpha.
|
|
27
|
+
"@idraw/types": "^0.2.0-alpha.24"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@idraw/board": "^0.2.0-alpha.
|
|
31
|
-
"@idraw/renderer": "^0.2.0-alpha.
|
|
32
|
-
"@idraw/util": "^0.2.0-alpha.
|
|
30
|
+
"@idraw/board": "^0.2.0-alpha.24",
|
|
31
|
+
"@idraw/renderer": "^0.2.0-alpha.24",
|
|
32
|
+
"@idraw/util": "^0.2.0-alpha.24"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "70860fa58b898e9f8e7dbac1e46edd1ddf2dd461"
|
|
38
38
|
}
|