12345678910 |
- /*!
- * tui-image-editor.min.js
- * @version 3.0.2
- * @author NHNEnt FE Development Lab <dl_javascript@nhnent.com>
- * @license MIT
- */
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("fabric/dist/fabric.require"),require("tui-code-snippet")):"function"==typeof define&&define.amd?define(["fabric/dist/fabric.require","tui-code-snippet"],t):"object"==typeof exports?exports.ImageEditor=t(require("fabric/dist/fabric.require"),require("tui-code-snippet")):(e.tui=e.tui||{},e.tui.ImageEditor=t(e.fabric,e.tui&&e.tui.util))}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="dist",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(83),o=r(i);n(41),n(42),n(43),n(44),n(45),n(46),n(47),n(48),n(49),n(50),n(51),n(52),n(53),n(54),n(55),n(56),n(57),n(59),n(58),e.exports=o.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(9),o=r(i);e.exports={componentNames:o.default.keyMirror("IMAGE_LOADER","CROPPER","FLIP","ROTATION","FREE_DRAWING","LINE","TEXT","ICON","FILTER","SHAPE"),commandNames:{CLEAR_OBJECTS:"clearObjects",LOAD_IMAGE:"loadImage",FLIP_IMAGE:"flip",ROTATE_IMAGE:"rotate",ADD_OBJECT:"addObject",REMOVE_OBJECT:"removeObject",APPLY_FILTER:"applyFilter",REMOVE_FILTER:"removeFilter",ADD_ICON:"addIcon",CHANGE_ICON_COLOR:"changeIconColor",ADD_SHAPE:"addShape",CHANGE_SHAPE:"changeShape",ADD_TEXT:"addText",CHANGE_TEXT:"changeText",CHANGE_TEXT_STYLE:"changeTextStyle",ADD_IMAGE_OBJECT:"addImageObject",RESIZE_CANVAS_DIMENSION:"resizeCanvasDimension",SET_OBJECT_PROPERTIES:"setObjectProperties",SET_OBJECT_POSITION:"setObjectPosition"},eventNames:{OBJECT_ACTIVATED:"objectActivated",OBJECT_MOVED:"objectMoved",OBJECT_SCALED:"objectScaled",TEXT_EDITING:"textEditing",TEXT_CHANGED:"textChanged",ADD_TEXT:"addText",ADD_OBJECT:"addObject",MOUSE_DOWN:"mousedown",REDO_STACK_CHANGED:"redoStackChanged",UNDO_STACK_CHANGED:"undoStackChanged"},drawingModes:o.default.keyMirror("NORMAL","CROPPER","FREE_DRAWING","LINE_DRAWING","TEXT","SHAPE"),keyCodes:{Z:90,Y:89,SHIFT:16,BACKSPACE:8,DEL:46},fObjectOptions:{SELECTION_STYLE:{borderColor:"red",cornerColor:"green",cornerSize:10,originX:"center",originY:"center",transparentCorners:!1}},rejectMessages:{flip:"The flipX and flipY setting values are not changed.",rotation:"The current angle is same the old angle.",loadImage:"The background image is empty.",isLock:"The executing command state is locked.",undo:"The promise of undo command is reject.",redo:"The promise of redo command is reject.",invalidDrawingMode:"This operation is not supported in the drawing mode",invalidParameters:"Invalid parameters",noActiveObject:"There is no active object.",unsupportedType:"Unsupported object type",noObject:"The object is not in canvas.",addedObject:"The object is already added."}}},function(e,t,n){n(114),n(116),n(117),n(115),e.exports=n(13).Promise},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=u[e];if(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new s.default(t,r)}return null}function o(e){u[e.name]=e}var a=n(84),s=r(a),u={};e.exports={create:i,register:o}},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var r=n(37)("wks"),i=n(40),o=n(8).Symbol,a="function"==typeof o,s=e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))};s.store=r},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r){n(this,e),this.name=t,this.graphics=r}return r(e,[{key:"fire",value:function(){for(var e=this.graphics,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.graphics.fire.apply(e,n)}},{key:"setCanvasImage",value:function(e,t){this.graphics.setCanvasImage(e,t)}},{key:"getCanvasElement",value:function(){return this.graphics.getCanvasElement()}},{key:"getCanvas",value:function(){return this.graphics.getCanvas()}},{key:"getCanvasImage",value:function(){return this.graphics.getCanvasImage()}},{key:"getImageName",value:function(){return this.graphics.getImageName()}},{key:"getEditor",value:function(){return this.graphics.getEditor()}},{key:"getName",value:function(){return this.name}},{key:"setImageProperties",value:function(e,t){this.graphics.setImageProperties(e,t)}},{key:"setCanvasCssDimension",value:function(e){this.graphics.setCanvasCssDimension(e)}},{key:"setCanvasBackstoreDimension",value:function(e){this.graphics.setCanvasBackstoreDimension(e)}},{key:"adjustCanvasDimension",value:function(){this.graphics.adjustCanvasDimension()}}]),e}();e.exports=i},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";var r=n(5),i=Math.min,o=Math.max;e.exports={clamp:function(e,t,n){var r=void 0;return t>n&&(r=t,t=n,n=r),o(t,i(e,n))},keyMirror:function(){for(var e={},t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return(0,r.forEach)(n,function(t){e[t]=t}),e},makeStyleText:function(e){var t="";return(0,r.forEach)(e,function(e,n){t+=n+": "+e+";"}),t},getProperties:function(e,t){var n={},r=t.length,i=0,o=void 0;for(i=0;i<r;i+=1)o=t[i],n[o]=e[o];return n}}},function(e,t,n){var r=n(19);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(20),i=n(36);e.exports=n(14)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(28),s=r(a),u=s.default.create,c=s.default.types,l=function(){function e(t){i(this,e),this.name=t}return o(e,[{key:"getName",value:function(){return this.name}},{key:"start",value:function(){throw new Error(u(c.UN_IMPLEMENTATION,"start"))}},{key:"stop",value:function(){throw new Error(u(c.UN_IMPLEMENTATION,"stop"))}}]),e}();e.exports=l},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports=!n(32)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports={}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(21);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(10),i=n(90),o=n(111),a=Object.defineProperty;t.f=n(14)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(19),i=n(8).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){var r=n(20).f,i=n(18),o=n(6)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){var r=n(37)("keys"),i=n(40);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(92),i=n(22);e.exports=function(e){return r(i(e))}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(5),o=r(i),a=n(9),s=(0,a.keyMirror)("UN_IMPLEMENTATION","NO_COMPONENT_NAME"),u={UN_IMPLEMENTATION:"Should implement a method: ",NO_COMPONENT_NAME:"Should set a component name"},c={UN_IMPLEMENTATION:function(e){return u.UN_IMPLEMENTATION+e},NO_COMPONENT_NAME:function(){return u.NO_COMPONENT_NAME}};e.exports={types:o.default.extend({},s),create:function(e){e=e.toLowerCase();for(var t=c[e],n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return t.apply(void 0,r)}}},function(e,t,n){var r=n(16),i=n(6)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(8),i=n(13),o=n(17),a=n(11),s="prototype",u=function(e,t,n){var c,l,f,h=e&u.F,d=e&u.G,p=e&u.S,v=e&u.P,g=e&u.B,_=e&u.W,y=d?i:i[t]||(i[t]={}),m=y[s],b=d?r:p?r[t]:(r[t]||{})[s];d&&(n=t);for(c in n)l=!h&&b&&void 0!==b[c],l&&c in y||(f=l?b[c]:n[c],y[c]=d&&"function"!=typeof b[c]?n[c]:g&&l?o(f,r):_&&b[c]==f?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t[s]=e[s],t}(f):v&&"function"==typeof f?o(Function.call,f):f,v&&((y.virtual||(y.virtual={}))[c]=f,e&u.R&&m&&!m[c]&&a(m,c,f)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){e.exports=n(8).document&&document.documentElement},function(e,t,n){"use strict";var r=n(35),i=n(31),o=n(105),a=n(11),s=n(18),u=n(15),c=n(95),l=n(24),f=n(101),h=n(6)("iterator"),d=!([].keys&&"next"in[].keys()),p="@@iterator",v="keys",g="values",_=function(){return this};e.exports=function(e,t,n,y,m,b,O){c(n,t,y);var k,w,C,E=function(e){if(!d&&e in M)return M[e];switch(e){case v:return function(){return new n(this,e)};case g:return function(){return new n(this,e)}}return function(){return new n(this,e)}},j=t+" Iterator",x=m==g,T=!1,M=e.prototype,S=M[h]||M[p]||m&&M[m],P=S||E(m),A=m?x?E("entries"):P:void 0,D="Array"==t?M.entries||S:S;if(D&&(C=f(D.call(new e)),C!==Object.prototype&&(l(C,j,!0),r||s(C,h)||a(C,h,_))),x&&S&&S.name!==g&&(T=!0,P=function(){return S.call(this)}),r&&!O||!d&&!T&&M[h]||a(M,h,P),u[t]=P,u[j]=_,m)if(k={values:x?P:E(g),keys:b?P:E(v),entries:A},O)for(w in k)w in M||o(M,w,k[w]);else i(i.P+i.F*(d||T),t,k);return k}},function(e,t){e.exports=!0},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(8),i="__core-js_shared__",o=r[i]||(r[i]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t,n){var r,i,o,a=n(17),s=n(91),u=n(33),c=n(23),l=n(8),f=l.process,h=l.setImmediate,d=l.clearImmediate,p=l.MessageChannel,v=0,g={},_="onreadystatechange",y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},m=function(e){y.call(e.data)};h&&d||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++v]=function(){s("function"==typeof e?e:Function(e),t)},r(v),v},d=function(e){delete g[e]},"process"==n(16)(f)?r=function(e){f.nextTick(a(y,e,1))}:p?(i=new p,o=i.port2,i.port1.onmessage=m,r=a(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(e){l.postMessage(e+"","*")},l.addEventListener("message",m,!1)):r=_ in c("script")?function(e){u.appendChild(c("script"))[_]=function(){u.removeChild(this),y.call(e)}}:function(e){setTimeout(a(y,e,1),0)}),e.exports={set:h,clear:d}},function(e,t,n){var r=n(26),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.componentNames,f=c.default.commandNames,h=l.ICON,d={name:f.ADD_ICON,execute:function(e,t,n){var r=this,i=e.getComponent(h);return i.add(t,n).then(function(t){return r.undoData.object=e.getObject(t.id),t})},undo:function(e){return e.remove(this.undoData.object),s.default.resolve()}};o.default.register(d),e.exports=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.commandNames,f={name:l.ADD_IMAGE_OBJECT,execute:function(e,t){var n=this;return e.addImageObject(t).then(function(t){return n.undoData.object=e.getObject(t.id),t})},undo:function(e){return e.remove(this.undoData.object),s.default.resolve()}};o.default.register(f),e.exports=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.commandNames,f=c.default.rejectMessages,h={name:l.ADD_OBJECT,execute:function(e,t){return new s.default(function(n,r){e.contains(t)?r(f.addedObject):(e.add(t),n(t))})},undo:function(e,t){return new s.default(function(n,r){e.contains(t)?(e.remove(t),n(t)):r(f.noObject)})}};o.default.register(h),e.exports=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.componentNames,f=c.default.commandNames,h=l.SHAPE,d={name:f.ADD_SHAPE,execute:function(e,t,n){var r=this,i=e.getComponent(h);return i.add(t,n).then(function(t){return r.undoData.object=e.getObject(t.id),t})},undo:function(e){return e.remove(this.undoData.object),s.default.resolve()}};o.default.register(d),e.exports=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.componentNames,f=c.default.commandNames,h=l.TEXT,d={name:f.ADD_TEXT,execute:function(e,t,n){var r=this,i=e.getComponent(h);return i.add(t,n).then(function(t){return r.undoData.object=e.getObject(t.id),t})},undo:function(e){return e.remove(this.undoData.object),s.default.resolve()}};o.default.register(d),e.exports=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(1),s=r(a),u=s.default.componentNames,c=s.default.rejectMessages,l=s.default.commandNames,f=u.FILTER,h={name:l.APPLY_FILTER,execute:function(e,t,n){var r=e.getComponent(f);if("mask"===t){var i=e.getObject(n.maskObjId);if(!i||!i.isType("image"))return Promise.reject(c.invalidParameters);n={mask:i}}return"mask"===t?(this.undoData.object=n.mask,e.remove(n.mask)):this.undoData.options=r.getOptions(t),r.add(t,n)},undo:function(e,t){var n=e.getComponent(f);if("mask"===t){var r=this.undoData.object;return e.add(r),e.setActiveObject(r),n.remove(t)}return this.undoData.options?n.add(t,this.undoData.options):n.remove(t)}};o.default.register(h),e.exports=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.componentNames,f=c.default.rejectMessages,h=c.default.commandNames,d=l.ICON,p={name:h.CHANGE_ICON_COLOR,execute:function(e,t,n){var r=this;return new s.default(function(i,o){var a=e.getComponent(d),s=e.getObject(t);s||o(f.noObject),r.undoData.object=s,r.undoData.color=a.getColor(s),a.setColor(n,s),i()})},undo:function(e){var t=e.getComponent(d),n=this.undoData.object,r=n.object,i=n.color;return t.setColor(i,r),s.default.resolve()}};o.default.register(p),e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(5),o=r(i),a=n(3),s=r(a),u=n(2),c=r(u),l=n(1),f=r(l),h=f.default.componentNames,d=f.default.rejectMessages,p=f.default.commandNames,v=h.SHAPE,g={name:p.CHANGE_SHAPE,execute:function(e,t,n){var r=this,i=e.getComponent(v),a=e.getObject(t);return a?(this.undoData.object=a,this.undoData.options={},o.default.forEachOwnProperties(n,function(e,t){r.undoData.options[t]=a[t]}),i.change(a,n)):c.default.reject(d.noObject)},undo:function(e){var t=e.getComponent(v),n=this.undoData,r=n.object,i=n.options;return t.change(r,i)}};s.default.register(g),e.exports=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.componentNames,f=c.default.rejectMessages,h=c.default.commandNames,d=l.TEXT,p={name:h.CHANGE_TEXT,execute:function(e,t,n){var r=e.getComponent(d),i=e.getObject(t);return i?(this.undoData.object=i,this.undoData.text=r.getText(i),r.change(i,n)):s.default.reject(f.noObject)},undo:function(e){var t=e.getComponent(d),n=this.undoData,r=n.object,i=n.text;return t.change(r,i)}};o.default.register(p),e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(5),o=r(i),a=n(3),s=r(a),u=n(2),c=r(u),l=n(1),f=r(l),h=f.default.componentNames,d=f.default.rejectMessages,p=f.default.commandNames,v=h.TEXT,g={name:p.CHANGE_TEXT_STYLE,execute:function(e,t,n){var r=this,i=e.getComponent(v),a=e.getObject(t);return a?(this.undoData.object=a,this.undoData.styles={},o.default.forEachOwnProperties(n,function(e,t){r.undoData.styles[t]=a[t]}),i.setStyle(a,n)):c.default.reject(d.noObject)},undo:function(e){var t=e.getComponent(v),n=this.undoData,r=n.object,i=n.styles;return t.setStyle(r,i)}};s.default.register(g),e.exports=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.commandNames,f={name:l.CLEAR_OBJECTS,execute:function(e){var t=this;return new s.default(function(n){t.undoData.objects=e.removeAll(),n()})},undo:function(e){return e.add(this.undoData.objects),s.default.resolve()}};o.default.register(f),e.exports=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(1),s=r(a),u=s.default.componentNames,c=s.default.commandNames,l=u.FLIP,f={name:c.FLIP_IMAGE,execute:function(e,t){var n=e.getComponent(l);return this.undoData.setting=n.getCurrentSetting(),n[t]()},undo:function(e){var t=e.getComponent(l);return t.set(this.undoData.setting)}};o.default.register(f),e.exports=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(1),s=r(a),u=s.default.componentNames,c=s.default.commandNames,l=u.IMAGE_LOADER,f={name:c.LOAD_IMAGE,execute:function(e,t,n){var r=e.getComponent(l),i=r.getCanvasImage(),o=i?i.width:0,a=i?i.height:0;return this.undoData={name:r.getImageName(),image:i,objects:e.removeAll(!0)},r.load(t,n).then(function(e){return{oldWidth:o,oldHeight:a,newWidth:e.width,newHeight:e.height}})},undo:function(e){var t=e.getComponent(l),n=this.undoData,r=n.objects,i=n.name,o=n.image;return e.removeAll(!0),e.add(r),t.load(i,o)}};o.default.register(f),e.exports=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(1),s=r(a),u=s.default.componentNames,c=s.default.commandNames,l=u.FILTER,f={name:c.REMOVE_FILTER,execute:function(e,t){var n=e.getComponent(l);return this.undoData.options=n.getOptions(t),n.remove(t)},undo:function(e,t){var n=e.getComponent(l),r=this.undoData.options;return n.add(t,r)}};o.default.register(f),e.exports=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.commandNames,f=c.default.rejectMessages,h={name:l.REMOVE_OBJECT,execute:function(e,t){var n=this;return new s.default(function(r,i){n.undoData.objects=e.removeObjectById(t),n.undoData.objects.length?r():i(f.noObject)})},undo:function(e){return e.add(this.undoData.objects),s.default.resolve()}};o.default.register(h),e.exports=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.commandNames,f={name:l.RESIZE_CANVAS_DIMENSION,execute:function(e,t){var n=this;return new s.default(function(r){n.undoData.size={width:e.cssMaxWidth,height:e.cssMaxHeight},e.setCssMaxDimension(t),e.adjustCanvasDimension(),r()})},undo:function(e){return e.setCssMaxDimension(this.undoData.size),e.adjustCanvasDimension(),s.default.resolve()}};o.default.register(f),e.exports=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(1),s=r(a),u=s.default.componentNames,c=s.default.commandNames,l=u.ROTATION,f={name:c.ROTATE_IMAGE,execute:function(e,t,n){var r=e.getComponent(l);return this.undoData.angle=r.getCurrentAngle(),r[t](n)},undo:function(e){var t=e.getComponent(l),n=this.undoData.angle;return t.setAngle(n)}};o.default.register(f),e.exports=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(3),o=r(i),a=n(2),s=r(a),u=n(1),c=r(u),l=c.default.commandNames,f=c.default.rejectMessages,h={name:l.SET_OBJECT_POSITION,execute:function(e,t,n){var r=e.getObject(t);return r?(this.undoData.objectId=t,this.undoData.props=e.getObjectProperties(t,["left","top"]),e.setObjectPosition(t,n),e.renderAll(),s.default.resolve()):s.default.reject(f.noObject)},undo:function(e){var t=this.undoData,n=t.objectId,r=t.props;return e.setObjectProperties(n,r),e.renderAll(),s.default.resolve()}};o.default.register(h),e.exports=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(5),o=r(i),a=n(3),s=r(a),u=n(2),c=r(u),l=n(1),f=r(l),h=f.default.commandNames,d=f.default.rejectMessages,p={name:h.SET_OBJECT_PROPERTIES,execute:function(e,t,n){var r=this,i=e.getObject(t);return i?(this.undoData.props={},o.default.forEachOwnProperties(n,function(e,t){r.undoData.props[t]=i[t]}),e.setObjectProperties(t,n),c.default.resolve()):c.default.reject(d.noObject)},undo:function(e,t){var n=this.undoData.props;return e.setObjectProperties(t,n),c.default.resolve()}};s.default.register(p),e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),c=r(u),l=n(7),f=r(l),h=n(77),d=r(h),p=n(1),v=n(9),g=10,_=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,p.componentNames.CROPPER,e));return n._cropzone=null,n._startX=null,n._startY=null,n._withShiftKey=!1,n._listeners={keydown:n._onKeyDown.bind(n),keyup:n._onKeyUp.bind(n),mousedown:n._onFabricMouseDown.bind(n),mousemove:n._onFabricMouseMove.bind(n),mouseup:n._onFabricMouseUp.bind(n)},n}return a(t,e),s(t,[{key:"start",value:function(){if(!this._cropzone){var e=this.getCanvas();e.forEachObject(function(e){e.evented=!1}),this._cropzone=new d.default({left:-10,top:-10,width:1,height:1,strokeWidth:0,cornerSize:10,cornerColor:"black",fill:"transparent",hasRotatingPoint:!1,hasBorders:!1,lockScalingFlip:!0,lockRotation:!0}),e.deactivateAll(),e.add(this._cropzone),e.on("mouse:down",this._listeners.mousedown),e.selection=!1,e.defaultCursor="crosshair",c.default.util.addListener(document,"keydown",this._listeners.keydown),c.default.util.addListener(document,"keyup",this._listeners.keyup)}}},{key:"end",value:function(){var e=this.getCanvas(),t=this._cropzone;t&&(t.remove(),e.selection=!0,e.defaultCursor="default",e.off("mouse:down",this._listeners.mousedown),e.forEachObject(function(e){e.evented=!0}),this._cropzone=null,c.default.util.removeListener(document,"keydown",this._listeners.keydown),c.default.util.removeListener(document,"keyup",this._listeners.keyup))}},{key:"_onFabricMouseDown",value:function(e){var t=this.getCanvas();if(!e.target){t.selection=!1;var n=t.getPointer(e.e);this._startX=n.x,this._startY=n.y,t.on({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}}},{key:"_onFabricMouseMove",value:function(e){var t=this.getCanvas(),n=t.getPointer(e.e),r=n.x,i=n.y,o=this._cropzone;Math.abs(r-this._startX)+Math.abs(i-this._startY)>g&&(o.remove(),o.set(this._calcRectDimensionFromPoint(r,i)),t.add(o))}},{key:"_calcRectDimensionFromPoint",value:function(e,t){var n=this.getCanvas(),r=n.getWidth(),i=n.getHeight(),o=this._startX,a=this._startY,s=(0,v.clamp)(e,0,o),u=(0,v.clamp)(t,0,a),c=(0,v.clamp)(e,o,r)-s,l=(0,v.clamp)(t,a,i)-u;return this._withShiftKey&&(c>l?l=c:l>c&&(c=l),o>=e&&(s=o-c),a>=t&&(u=a-l)),{left:s,top:u,width:c,height:l}}},{key:"_onFabricMouseUp",value:function(){var e=this._cropzone,t=this._listeners,n=this.getCanvas();n.setActiveObject(e),n.off({"mouse:move":t.mousemove,"mouse:up":t.mouseup})}},{key:"getCroppedImageData",value:function(e){var t=this.getCanvas(),n=t.contains(this._cropzone);if(!e)return null;n&&this._cropzone.remove();var r={imageName:this.getImageName(),url:t.toDataURL(e)};return n&&t.add(this._cropzone),r}},{key:"getCropzoneRect",value:function(){var e=this._cropzone;return e.isValid()?{left:e.getLeft(),top:e.getTop(),width:e.getWidth(),height:e.getHeight()}:null}},{key:"_onKeyDown",value:function(e){e.keyCode===p.keyCodes.SHIFT&&(this._withShiftKey=!0)}},{key:"_onKeyUp",value:function(e){e.keyCode===p.keyCodes.SHIFT&&(this._withShiftKey=!1)}}]),t}(f.default);e.exports=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),c=n(2),l=r(c),f=n(4),h=r(f),d=n(7),p=r(d),v=n(79),g=r(v),_=n(1),y=r(_),m=n(75),b=r(m),O=n(80),k=r(O),w=n(78),C=r(w),E=n(76),j=r(E),x=y.default.rejectMessages,T=h.default.Image.filters;T.Mask=g.default,T.Blur=b.default,T.Sharpen=k.default,T.Emboss=C.default,T.ColorFilter=j.default;var M=function(e){function t(e){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,y.default.componentNames.FILTER,e))}return a(t,e),s(t,[{key:"add",value:function(e,t){var n=this;return new l.default(function(r,i){var o=n._getSourceImage(),a=n.getCanvas(),s=n._getFilter(o,e);s||(s=n._createFilter(o,e,t)),s||i(x.invalidParameters),n._changeFilterValues(s,t),n._apply(o,function(){a.renderAll(),r({type:e,action:"add"})})})}},{key:"remove",value:function(e){var t=this;return new l.default(function(n,r){var i=t._getSourceImage(),o=t.getCanvas();i.filters.length||r(x.unsupportedOperation),t._removeFilter(i,e),t._apply(i,function(){o.renderAll(),n({type:e,action:"remove"})})})}},{key:"hasFilter",value:function(e){return!!this._getFilter(this._getSourceImage(),e)}},{key:"getOptions",value:function(e){var t=this._getSourceImage(),n=this._getFilter(t,e);return n?(0,u.extend)({},n.options):null}},{key:"_changeFilterValues",value:function(e,t){(0,u.forEach)(t,function(t,n){(0,u.isUndefined)(e[n])||(e[n]=t)}),(0,u.forEach)(e.options,function(n,r){(0,u.isUndefined)(t[r])||(e.options[r]=t[r])})}},{key:"_apply",value:function(e,t){e.applyFilters(t)}},{key:"_getSourceImage",value:function(){return this.getCanvasImage()}},{key:"_createFilter",value:function(e,t,n){var r=void 0,i=this._getFabricFilterType(t),o=h.default.Image.filters[i];return o&&(r=new o(n),r.options=n,e.filters.push(r)),r}},{key:"_getFilter",value:function(e,t){var n=null;if(e){var r=this._getFabricFilterType(t),i=e.filters.length,o=void 0,a=void 0;for(a=0;a<i;a+=1)if(o=e.filters[a],o.type===r){n=o;break}}return n}},{key:"_removeFilter",value:function(e,t){var n=this._getFabricFilterType(t);e.filters=(0,u.filter)(e.filters,function(e){return e.type!==n})}},{key:"_getFabricFilterType",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}}]),t}(p.default);e.exports=M},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),c=r(u),l=n(2),f=r(l),h=n(7),d=r(h),p=n(1),v=r(p),g=v.default.componentNames,_=v.default.rejectMessages,y=function(e){function t(e){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,g.FLIP,e))}return a(t,e),s(t,[{key:"getCurrentSetting",value:function(){var e=this.getCanvasImage();return{flipX:e.flipX,flipY:e.flipY}}},{key:"set",value:function(e){var t=this.getCurrentSetting(),n=t.flipX!==e.flipX,r=t.flipY!==e.flipY;return n||r?(c.default.extend(t,e),this.setImageProperties(t,!0),this._invertAngle(n,r),this._flipObjects(n,r),f.default.resolve({flipX:t.flipX,flipY:t.flipY,angle:this.getCanvasImage().angle})):f.default.reject(_.flip)}},{key:"_invertAngle",value:function(e,t){var n=this.getCanvasImage(),r=n.angle;e&&(r*=-1),t&&(r*=-1),n.setAngle(parseFloat(r)).setCoords()}},{key:"_flipObjects",value:function(e,t){var n=this.getCanvas();e&&n.forEachObject(function(e){e.set({angle:parseFloat(e.angle*-1),flipX:!e.flipX,left:n.width-e.left}).setCoords()}),t&&n.forEachObject(function(e){e.set({angle:parseFloat(e.angle*-1),flipY:!e.flipY,top:n.height-e.top}).setCoords()}),n.renderAll()}},{key:"reset",value:function(){return this.set({flipX:!1,flipY:!1})}},{key:"flipX",value:function(){var e=this.getCurrentSetting();return this.set({flipX:!e.flipX,flipY:e.flipY})}},{key:"flipY",value:function(){var e=this.getCurrentSetting();return this.set({flipX:e.flipX,flipY:!e.flipY})}}]),t}(d.default);e.exports=y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");
- }function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),c=r(u),l=n(7),f=r(l),h=n(1),d=r(h),p=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,d.default.componentNames.FREE_DRAWING,e));return n.width=12,n.oColor=new c.default.Color("rgba(0, 0, 0, 0.5)"),n}return a(t,e),s(t,[{key:"start",value:function(e){var t=this.getCanvas();t.isDrawingMode=!0,this.setBrush(e)}},{key:"setBrush",value:function(e){var t=this.getCanvas().freeDrawingBrush;e=e||{},this.width=e.width||this.width,e.color&&(this.oColor=new c.default.Color(e.color)),t.width=this.width,t.color=this.oColor.toRgba()}},{key:"end",value:function(){var e=this.getCanvas();e.isDrawingMode=!1}}]),t}(f.default);e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),c=r(u),l=n(5),f=r(l),h=n(2),d=r(h),p=n(7),v=r(p),g=n(1),_=r(g),y=_.default.rejectMessages,m={arrow:"M 0 90 H 105 V 120 L 160 60 L 105 0 V 30 H 0 Z",cancel:"M 0 30 L 30 60 L 0 90 L 30 120 L 60 90 L 90 120 L 120 90 L 90 60 L 120 30 L 90 0 L 60 30 L 30 0 Z"},b=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,_.default.componentNames.ICON,e));return n._oColor="#000000",n._pathMap=m,n}return a(t,e),s(t,[{key:"add",value:function(e,t){var n=this;return new d.default(function(r,i){var o=n.getCanvas(),a=n._pathMap[e],s=_.default.fObjectOptions.SELECTION_STYLE;a||i(y.invalidParameters);var u=n._createIcon(a);u.set(f.default.extend({type:"icon",fill:n._oColor},s,t)),o.add(u).setActiveObject(u),r(n.graphics.createObjectProperties(u))})}},{key:"registerPaths",value:function(e){var t=this;f.default.forEach(e,function(e,n){t._pathMap[n]=e},this)}},{key:"setColor",value:function(e,t){this._oColor=e,t&&"icon"===t.get("type")&&(t.setFill(this._oColor),this.getCanvas().renderAll())}},{key:"getColor",value:function(e){return e.fill}},{key:"_createIcon",value:function(e){return new c.default.Path(e)}}]),t}(v.default);e.exports=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(2),c=r(u),l=n(7),f=r(l),h=n(1),d=r(h),p=d.default.componentNames,v=d.default.rejectMessages,g={padding:0,crossOrigin:"Anonymous"},_=function(e){function t(e){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,p.IMAGE_LOADER,e))}return a(t,e),s(t,[{key:"load",value:function(e,t){var n=this,r=void 0;if(e||t)r=this._setBackgroundImage(t).then(function(t){return n.setCanvasImage(e,t),n.adjustCanvasDimension(),t});else{var i=this.getCanvas();i.backgroundImage=null,i.renderAll(),r=new c.default(function(e){n.setCanvasImage("",null),e()})}return r}},{key:"_setBackgroundImage",value:function(e){var t=this;return e?new c.default(function(n,r){var i=t.getCanvas();i.setBackgroundImage(e,function(){var e=i.backgroundImage;e.getElement()?n(e):r(v.loadingImageFailed)},g)}):c.default.reject(v.loadImage)}}]),t}(f.default);e.exports=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),c=r(u),l=n(7),f=r(l),h=n(1),d=r(h),p=d.default.eventNames,v=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,d.default.componentNames.LINE,e));return n._width=12,n._oColor=new c.default.Color("rgba(0, 0, 0, 0.5)"),n._listeners={mousedown:n._onFabricMouseDown.bind(n),mousemove:n._onFabricMouseMove.bind(n),mouseup:n._onFabricMouseUp.bind(n)},n}return a(t,e),s(t,[{key:"start",value:function(e){var t=this.getCanvas();t.defaultCursor="crosshair",t.selection=!1,this.setBrush(e),t.forEachObject(function(e){e.set({evented:!1})}),t.on({"mouse:down":this._listeners.mousedown})}},{key:"setBrush",value:function(e){var t=this.getCanvas().freeDrawingBrush;e=e||{},this._width=e.width||this._width,e.color&&(this._oColor=new c.default.Color(e.color)),t.width=this._width,t.color=this._oColor.toRgba()}},{key:"end",value:function(){var e=this.getCanvas();e.defaultCursor="default",e.selection=!0,e.forEachObject(function(e){e.set({evented:!0})}),e.off("mouse:down",this._listeners.mousedown)}},{key:"_onFabricMouseDown",value:function(e){var t=this.getCanvas(),n=t.getPointer(e.e),r=[n.x,n.y,n.x,n.y];this._line=new c.default.Line(r,{stroke:this._oColor.toRgba(),strokeWidth:this._width,evented:!1}),this._line.set(d.default.fObjectOptions.SELECTION_STYLE),t.add(this._line),t.on({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}},{key:"_onFabricMouseMove",value:function(e){var t=this.getCanvas(),n=t.getPointer(e.e);this._line.set({x2:n.x,y2:n.y}),this._line.setCoords(),t.renderAll()}},{key:"_onFabricMouseUp",value:function(){var e=this.getCanvas(),t=this.graphics.createObjectProperties(this._line);this.fire(p.ADD_OBJECT,t),this._line=null,e.off({"mouse:move":this._listeners.mousemove,"mouse:up":this._listeners.mouseup})}}]),t}(f.default);e.exports=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),c=r(u),l=n(2),f=r(l),h=n(7),d=r(h),p=n(1),v=r(p),g=v.default.componentNames,_=function(e){function t(e){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,g.ROTATION,e))}return a(t,e),s(t,[{key:"getCurrentAngle",value:function(){return this.getCanvasImage().angle}},{key:"setAngle",value:function(e){var t=this.getCurrentAngle()%360;e%=360;var n=this.getCanvasImage(),r=n.getCenterPoint();n.setAngle(e).setCoords(),this.adjustCanvasDimension();var i=n.getCenterPoint();return this._rotateForEachObject(r,i,e-t),f.default.resolve(e)}},{key:"_rotateForEachObject",value:function(e,t,n){var r=this.getCanvas(),i={x:e.x-t.x,y:e.y-t.y};r.forEachObject(function(t){var r=t.getCenterPoint(),o=c.default.util.degreesToRadians(n),a=c.default.util.rotatePoint(r,e,o);t.set({left:a.x-i.x,top:a.y-i.y,angle:(t.angle+n)%360}),t.setCoords()}),r.renderAll()}},{key:"rotate",value:function(e){var t=this.getCurrentAngle();return this.setAngle(t+e)}}]),t}(d.default);e.exports=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),c=r(u),l=n(2),f=r(l),h=n(7),d=r(h),p=n(1),v=r(p),g=n(82),_=r(g),y=n(5),m=v.default.rejectMessages,b=v.default.eventNames,O=v.default.keyCodes,k="rect",w={strokeWidth:1,stroke:"#000000",fill:"#ffffff",width:1,height:1,rx:0,ry:0,lockSkewingX:!0,lockSkewingY:!0,lockUniScaling:!1,bringForward:!0,isRegular:!1},C=["rect","circle","triangle"],E=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,v.default.componentNames.SHAPE,e));return n._shapeObj=null,n._type=k,n._options=(0,y.extend)({},w),n._isSelected=!1,n._startPoint={},n._withShiftKey=!1,n._handlers={mousedown:n._onFabricMouseDown.bind(n),mousemove:n._onFabricMouseMove.bind(n),mouseup:n._onFabricMouseUp.bind(n),keydown:n._onKeyDown.bind(n),keyup:n._onKeyUp.bind(n)},n}return a(t,e),s(t,[{key:"start",value:function(){var e=this.getCanvas();this._isSelected=!1,e.defaultCursor="crosshair",e.selection=!1,e.uniScaleTransform=!0,e.on({"mouse:down":this._handlers.mousedown}),c.default.util.addListener(document,"keydown",this._handlers.keydown),c.default.util.addListener(document,"keyup",this._handlers.keyup)}},{key:"end",value:function(){var e=this.getCanvas();this._isSelected=!1,e.defaultCursor="default",e.selection=!0,e.uniScaleTransform=!1,e.off({"mouse:down":this._handlers.mousedown}),c.default.util.removeListener(document,"keydown",this._handlers.keydown),c.default.util.removeListener(document,"keyup",this._handlers.keyup)}},{key:"setStates",value:function(e,t){this._type=e,t&&(this._options=(0,y.extend)(this._options,t))}},{key:"add",value:function(e,t){var n=this;return new f.default(function(r){var i=n.getCanvas();t=n._createOptions(t);var o=n._createInstance(e,t);n._bindEventOnShape(o),i.add(o).setActiveObject(o),r(n.graphics.createObjectProperties(o))})}},{key:"change",value:function(e,t){var n=this;return new f.default(function(r,i){(0,y.inArray)(e.get("type"),C)<0&&i(m.unsupportedType),e.set(t),n.getCanvas().renderAll(),r()})}},{key:"_createInstance",value:function(e,t){var n=void 0;switch(e){case"rect":n=new c.default.Rect(t);break;case"circle":n=new c.default.Ellipse((0,y.extend)({type:"circle"},t));break;case"triangle":n=new c.default.Triangle(t);break;default:n={}}return n}},{key:"_createOptions",value:function(e){var t=v.default.fObjectOptions.SELECTION_STYLE;return e=(0,y.extend)({},w,this._options,t,e),e.isRegular&&(e.lockUniScaling=!0),e}},{key:"_bindEventOnShape",value:function(e){var t=this,n=this.getCanvas();e.on({added:function(){t._shapeObj=this,_.default.setOrigins(t._shapeObj)},selected:function(){t._isSelected=!0,t._shapeObj=this,n.uniScaleTransform=!0,n.defaultCursor="default",_.default.setOrigins(t._shapeObj)},deselected:function(){t._isSelected=!1,t._shapeObj=null,n.defaultCursor="crosshair",n.uniScaleTransform=!1},modified:function(){var e=t._shapeObj;_.default.adjustOriginToCenter(e),_.default.setOrigins(e)},scaling:function(e){var r=n.getPointer(e.e),i=t._shapeObj;n.setCursor("crosshair"),_.default.resize(i,r,!0)}})}},{key:"_onFabricMouseDown",value:function(e){if(!this._isSelected&&!this._shapeObj){var t=this.getCanvas();this._startPoint=t.getPointer(e.e),t.on({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}}},{key:"_onFabricMouseMove",value:function(e){var t=this,n=this.getCanvas(),r=n.getPointer(e.e),i=this._startPoint.x,o=this._startPoint.y,a=i-r.x,s=o-r.y,u=this._shapeObj;u?(this._shapeObj.set({isRegular:this._withShiftKey}),_.default.resize(u,r),n.renderAll()):this.add(this._type,{left:i,top:o,width:a,height:s}).then(function(e){t.fire(b.ADD_OBJECT,e)})}},{key:"_onFabricMouseUp",value:function(){var e=this.getCanvas(),t=this._shapeObj;t&&_.default.adjustOriginToCenter(t),e.off({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}},{key:"_onKeyDown",value:function(e){e.keyCode===O.SHIFT&&(this._withShiftKey=!0,this._shapeObj&&(this._shapeObj.isRegular=!0))}},{key:"_onKeyUp",value:function(e){e.keyCode===O.SHIFT&&(this._withShiftKey=!1,this._shapeObj&&(this._shapeObj.isRegular=!1))}}]),t}(d.default);e.exports=E},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),c=r(u),l=n(5),f=r(l),h=n(2),d=r(h),p=n(7),v=r(p),g=n(1),_=r(g),y=n(9),m=r(y),b=_.default.eventNames,O={fill:"#000000",left:0,top:0},k={fill:"#000000",fontStyle:"normal",fontWeight:"normal",textAlign:"left",textDecoraiton:""},w=f.default.browser,C="tui-image-eidtor-textarea",E=m.default.makeStyleText({position:"absolute",padding:0,display:"none",border:"1px dotted red",overflow:"hidden",resize:"none",outline:"none","border-radius":0,"background-color":"transparent","-webkit-appearance":"none","z-index":9999,"white-space":"pre"}),j=.1,x=500,T=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,_.default.componentNames.TEXT,e));return n._defaultStyles=O,n._isSelected=!1,n._selectedObj={},n._editingObj={},n._listeners={mousedown:n._onFabricMouseDown.bind(n),select:n._onFabricSelect.bind(n),selectClear:n._onFabricSelectClear.bind(n),scaling:n._onFabricScaling.bind(n)},n._textarea=null,n._ratio=1,n._lastClickTime=(new Date).getTime(),n._editingObjInfos={},n.isPrevEditing=!1,n}return a(t,e),s(t,[{key:"start",value:function(){var e=this.getCanvas();e.selection=!1,e.defaultCursor="text",e.on({"mouse:down":this._listeners.mousedown,"object:selected":this._listeners.select,"before:selection:cleared":this._listeners.selectClear,"object:scaling":this._listeners.scaling}),this._createTextarea(),this.setCanvasRatio()}},{key:"end",value:function(){var e=this.getCanvas();e.selection=!0,e.defaultCursor="default",e.deactivateAllWithDispatch(),e.off({"mouse:down":this._listeners.mousedown,"object:selected":this._listeners.select,"before:selection:cleared":this._listeners.selectClear,"object:scaling":this._listeners.scaling}),this._removeTextarea()}},{key:"add",value:function(e,t){var n=this;return new d.default(function(r){var i=n.getCanvas(),o=n._defaultStyles;n._setInitPos(t.position),t.styles&&(o=f.default.extend(t.styles,o));var a=new c.default.Text(e,o);a.set(_.default.fObjectOptions.SELECTION_STYLE),a.on({mouseup:n._onFabricMouseUp.bind(n)}),i.add(a),i.getActiveObject()||i.setActiveObject(a),n.isPrevEditing=!0,r(n.graphics.createObjectProperties(a))})}},{key:"change",value:function(e,t){var n=this;return new d.default(function(r){e.set("text",t),n.getCanvas().renderAll(),r()})}},{key:"setStyle",value:function(e,t){var n=this;return new d.default(function(r){f.default.forEach(t,function(n,r){e[r]===n&&(t[r]=k[r]||"")},n),e.set(t),n.getCanvas().renderAll(),r()})}},{key:"getText",value:function(e){return e.getText()}},{key:"setSelectedInfo",value:function(e,t){this._selectedObj=e,this._isSelected=t}},{key:"isSelected",value:function(){return this._isSelected}},{key:"getSelectedObj",value:function(){return this._selectedObj}},{key:"setCanvasRatio",value:function(){var e=this.getCanvasElement(),t=parseInt(e.style.maxWidth,10),n=e.width,r=n/t;this._ratio=r}},{key:"getCanvasRatio",value:function(){return this._ratio}},{key:"_setInitPos",value:function(e){e=e||this.getCanvasImage().getCenterPoint(),this._defaultStyles.left=e.x,this._defaultStyles.top=e.y}},{key:"_createTextarea",value:function(){var e=this.getCanvasElement().parentNode,t=document.createElement("textarea");t.className=C,t.setAttribute("style",E),t.setAttribute("wrap","off"),e.appendChild(t),this._textarea=t,this._listeners=f.default.extend(this._listeners,{input:this._onInput.bind(this),keydown:this._onKeyDown.bind(this),blur:this._onBlur.bind(this),scroll:this._onScroll.bind(this)}),w.msie&&9===w.version?c.default.util.addListener(t,"keydown",this._listeners.keydown):c.default.util.addListener(t,"input",this._listeners.input),c.default.util.addListener(t,"blur",this._listeners.blur),c.default.util.addListener(t,"scroll",this._listeners.scroll)}},{key:"_removeTextarea",value:function(){var e=this.getCanvasElement().parentNode,t=e.querySelector("textarea");e.removeChild(t),this._textarea=null,w.msie&&w.version<10?c.default.util.removeListener(t,"keydown",this._listeners.keydown):c.default.util.removeListener(t,"input",this._listeners.input),c.default.util.removeListener(t,"blur",this._listeners.blur),c.default.util.removeListener(t,"scroll",this._listeners.scroll)}},{key:"_onInput",value:function(){var e=this.getCanvasRatio(),t=this._editingObj,n=this._textarea.style;n.width=Math.ceil(t.getWidth()/e)+"px",n.height=Math.ceil(t.getHeight()/e)+"px"}},{key:"_onKeyDown",value:function(){var e=this,t=this.getCanvasRatio(),n=this._editingObj,r=this._textarea.style;setTimeout(function(){n.setText(e._textarea.value),r.width=Math.ceil(n.getWidth()/t)+"px",r.height=Math.ceil(n.getHeight()/t)+"px"},0)}},{key:"_onBlur",value:function(){var e=this.getCanvasRatio(),t=this._editingObj,n=this._editingObjInfos,r=this._textarea.value,i=t.getWidth()/e-n.width/e,o=t.getHeight()/e-n.height/e;if(1===e&&(i/=2,o/=2),this._textarea.style.display="none",t.set({left:n.left+i,top:n.top+o}),r.length){this.getCanvas().add(t);var a={id:f.default.stamp(t),type:t.type,text:r};this.fire(b.TEXT_CHANGED,a)}}},{key:"_onScroll",value:function(){this._textarea.scrollLeft=0,this._textarea.scrollTop=0}},{key:"_onFabricScaling",value:function(e){var t=e.target,n=t.getFontSize()*t.getScaleY();t.setFontSize(n),t.setScaleX(1),t.setScaleY(1)}},{key:"_onFabricSelectClear",value:function(e){var t=this.getSelectedObj();this.isPrevEditing=!0,this.setSelectedInfo(e.target,!1),t&&""===t.text&&t.remove()}},{key:"_onFabricSelect",value:function(e){this.isPrevEditing=!0,this.setSelectedInfo(e.target,!0)}},{key:"_onFabricMouseDown",value:function(e){var t=e.target;if(!t||t.isType("text"))return this.isPrevEditing?void(this.isPrevEditing=!1):void this._fireAddText(e)}},{key:"_fireAddText",value:function(e){var t=e.target,n=e.e||{},r=this.getCanvas().getPointer(n);t||this.fire(b.ADD_TEXT,{originPosition:{x:r.x,y:r.y},clientPosition:{x:n.clientX||0,y:n.clientY||0}})}},{key:"_onFabricMouseUp",value:function(e){var t=(new Date).getTime();this._isDoubleClick(t)&&(this._changeToEditingMode(e.target),this.fire(b.TEXT_EDITING)),this._lastClickTime=t}},{key:"_isDoubleClick",value:function(e){return e-this._lastClickTime<x}},{key:"_changeToEditingMode",value:function(e){var t=this.getCanvasRatio(),n=this._textarea.style;this.isPrevEditing=!0,e.remove(),this._editingObj=e,this._textarea.value=e.getText(),this._editingObjInfos={left:this._editingObj.getLeft(),top:this._editingObj.getTop(),width:this._editingObj.getWidth(),height:this._editingObj.getHeight()},n.display="block",n.left=e.oCoords.tl.x/t+"px",n.top=e.oCoords.tl.y/t+"px",n.width=Math.ceil(e.getWidth()/t)+"px",n.height=Math.ceil(e.getHeight()/t)+"px",n.transform="rotate("+e.getAngle()+"deg)",n.color=e.getFill(),n["font-size"]=e.getFontSize()/t+"px",n["font-family"]=e.getFontFamily(),n["font-style"]=e.getFontStyle(),n["font-weight"]=e.getFontWeight(),n["text-align"]=e.getTextAlign(),n["line-height"]=e.getLineHeight()+j,n["transform-origin"]="left top",this._textarea.focus()}}]),t}(v.default);e.exports=T},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(12),c=r(u),l=n(1),f=r(l),h=f.default.drawingModes,d=f.default.componentNames,p=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.CROPPER))}return a(t,e),s(t,[{key:"start",value:function(e){var t=e.getComponent(d.CROPPER);t.start()}},{key:"end",value:function(e){var t=e.getComponent(d.CROPPER);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(12),c=r(u),l=n(1),f=r(l),h=f.default.drawingModes,d=f.default.componentNames,p=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.FREE_DRAWING))}return a(t,e),s(t,[{key:"start",value:function(e,t){var n=e.getComponent(d.FREE_DRAWING);n.start(t)}},{key:"end",value:function(e){var t=e.getComponent(d.FREE_DRAWING);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(12),c=r(u),l=n(1),f=r(l),h=f.default.drawingModes,d=f.default.componentNames,p=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.LINE_DRAWING))}return a(t,e),s(t,[{key:"start",value:function(e,t){var n=e.getComponent(d.LINE);n.start(t)}},{key:"end",value:function(e){var t=e.getComponent(d.LINE);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(12),c=r(u),l=n(1),f=r(l),h=f.default.drawingModes,d=f.default.componentNames,p=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.SHAPE))}return a(t,e),s(t,[{key:"start",value:function(e){var t=e.getComponent(d.SHAPE);t.start()}},{key:"end",value:function(e){var t=e.getComponent(d.SHAPE);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(12),c=r(u),l=n(1),f=r(l),h=f.default.drawingModes,d=f.default.componentNames,p=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,h.TEXT))}return a(t,e),s(t,[{key:"start",value:function(e){var t=e.getComponent(d.TEXT);t.start()}},{key:"end",value:function(e){var t=e.getComponent(d.TEXT);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(4),o=r(i),a=o.default.util.createClass(o.default.Image.filters.Convolute,{type:"Blur",initialize:function(){var e=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9];this.matrix=e}});e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(4),o=r(i),a=o.default.util.createClass(o.default.Image.filters.BaseFilter,{type:"ColorFilter",initialize:function(e){e||(e={}),this.color=e.color||"#FFFFFF",this.threshold=e.threshold||45,this.x=e.x||null,this.y=e.y||null},applyTo:function(e){var t=e.getContext("2d"),n=t.getImageData(0,0,e.width,e.height),r=n.data,i=this.threshold,a=o.default.Color.sourceFromHex(this.color),s=void 0,u=void 0;for(this.x&&this.y&&(a=this._getColor(n,this.x,this.y)),s=0,u=r.length;s<u;s+=4)this._isOutsideThreshold(r[s],a[0],i)||this._isOutsideThreshold(r[s+1],a[1],i)||this._isOutsideThreshold(r[s+2],a[2],i)||(r[s]=r[s+1]=r[s+2]=r[s+3]=0);t.putImageData(n,0,0)},_isOutsideThreshold:function(e,t,n){var r=e-t;return Math.abs(r)>n},_getColor:function(e,t,n){var r=[0,0,0,0],i=e.data,o=e.width,a=4,s=(o*n+t)*a;return r[0]=i[s],r[1]=i[s+1],r[2]=i[s+2],r[3]=i[s+3],r}});e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(5),o=r(i),a=n(4),s=r(a),u=n(9),c="tl",l="tr",f="mt",h="ml",d="mr",p="mb",v="bl",g="br",_=s.default.util.createClass(s.default.Rect,{initialize:function(e){e.type="cropzone",this.callSuper("initialize",e),this.on({moving:this._onMoving,scaling:this._onScaling})},_render:function(e){var t=7,n=7;this.callSuper("_render",e);var r=this.flipX?-1:1,i=this.flipY?-1:1,o=r/this.scaleX,a=i/this.scaleY;e.scale(o,a),this._fillOuterRect(e,"rgba(0, 0, 0, 0.55)"),this._strokeBorder(e,"rgb(0, 0, 0)",t),this._strokeBorder(e,"rgb(255, 255, 255)",t,n),e.scale(1/o,1/a)},_fillOuterRect:function(e,t){var n=this._getCoordinates(e),r=n.x,i=n.y;e.save(),e.fillStyle=t,e.beginPath(),e.moveTo(r[0]-1,i[0]-1),e.lineTo(r[3]+1,i[0]-1),e.lineTo(r[3]+1,i[3]+1),e.lineTo(r[0]-1,i[3]-1),e.lineTo(r[0]-1,i[0]-1),e.closePath(),e.moveTo(r[1],i[1]),e.lineTo(r[1],i[2]),e.lineTo(r[2],i[2]),e.lineTo(r[2],i[1]),e.lineTo(r[1],i[1]),e.closePath(),e.fill(),e.restore()},_getCoordinates:function(e){var t=this.getWidth(),n=this.getHeight(),r=t/2,i=n/2,a=this.getLeft(),s=this.getTop(),u=e.canvas;return{x:o.default.map([-(r+a),-r,r,r+(u.width-a-t)],Math.ceil),y:o.default.map([-(i+s),-i,i,i+(u.height-s-n)],Math.ceil)}},_strokeBorder:function(e,t,n,r){var i=this.getWidth()/2,o=this.getHeight()/2;e.save(),e.strokeStyle=t,e.setLineDash&&e.setLineDash([n,n]),r&&(e.lineDashOffset=r),e.beginPath(),e.moveTo(-i,-o),e.lineTo(i,-o),e.lineTo(i,o),e.lineTo(-i,o),e.lineTo(-i,-o),e.stroke(),e.restore()},_onMoving:function(){var e=this.getLeft(),t=this.getTop(),n=this.getWidth(),r=this.getHeight(),i=this.canvas.getWidth()-n,o=this.canvas.getHeight()-r;
- this.setLeft((0,u.clamp)(e,0,i)),this.setTop((0,u.clamp)(t,0,o))},_onScaling:function(e){var t=this.canvas.getPointer(e.e),n=this._calcScalingSizeFromPointer(t);this.scale(1).set(n)},_calcScalingSizeFromPointer:function(e){var t=e.x,n=e.y,r=this._calcTopLeftScalingSizeFromPointer(t,n),i=this._calcBottomRightScalingSizeFromPointer(t,n);return this._makeScalingSettings(r,i)},_calcTopLeftScalingSizeFromPointer:function(e,t){var n=this.getHeight()+this.top,r=this.getWidth()+this.left,i=(0,u.clamp)(t,0,n-1),o=(0,u.clamp)(e,0,r-1);return{top:i,left:o,width:r-o,height:n-i}},_calcBottomRightScalingSizeFromPointer:function(e,t){var n=this.canvas,r=n.width,i=n.height,o=this.left,a=this.top;return{width:(0,u.clamp)(e,o+1,r)-o,height:(0,u.clamp)(t,a+1,i)-a}},_makeScalingSettings:function(e,t){var n=e.width,r=e.height,i=t.height,o=t.width,a=e.left,s=e.top,u=void 0;switch(this.__corner){case c:u=e;break;case l:u={width:o,height:r,top:s};break;case v:u={width:n,height:i,left:a};break;case g:u=t;break;case h:u={width:n,left:a};break;case f:u={height:r,top:s};break;case d:u={width:o};break;case p:u={height:i}}return u},isValid:function(){return this.left>=0&&this.top>=0&&this.width>0&&this.height>0}});e.exports=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(4),o=r(i),a=o.default.util.createClass(o.default.Image.filters.Convolute,{type:"Emboss",initialize:function(){var e=[1,1,1,1,.7,-1,-1,-1,-1];this.matrix=e}});e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(4),o=r(i),a=o.default.util.createClass(o.default.Image.filters.Mask,{applyTo:function(e){if(this.mask){var t=e.width,n=e.height,r=this._createCanvasOfMask(t,n),i=e.getContext("2d"),o=r.getContext("2d"),a=i.getImageData(0,0,t,n);this._drawMask(o,e,i),this._mapData(o,a,t,n),i.putImageData(a,0,0)}},_createCanvasOfMask:function(e,t){var n=o.default.util.createCanvasElement();return n.width=e,n.height=t,n},_drawMask:function(e){var t=this.mask,n=t.getElement(),r=t.getLeft(),i=t.getTop(),o=t.getAngle();e.save(),e.translate(r,i),e.rotate(o*Math.PI/180),e.scale(t.scaleX,t.scaleY),e.drawImage(n,-n.width/2,-n.height/2),e.restore()},_mapData:function(e,t,n,r){for(var i=t.data,o=e.getImageData(0,0,n,r).data,a=this.channel,s=t.width*t.height*4,u=0;u<s;u+=4)i[u+3]=o[u+a]}});e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(4),o=r(i),a=o.default.util.createClass(o.default.Image.filters.Convolute,{type:"Sharpen",initialize:function(){var e=[0,-1,0,-1,5,-1,0,-1,0];this.matrix=e}});e.exports=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(5),s=r(a),u=n(2),c=r(u),l=n(4),f=r(l),h=n(65),d=r(h),p=n(60),v=r(p),g=n(62),_=r(g),y=n(67),m=r(y),b=n(63),O=r(b),k=n(66),w=r(k),C=n(69),E=r(C),j=n(64),x=r(j),T=n(61),M=r(T),S=n(68),P=r(S),A=n(70),D=r(A),I=n(71),N=r(I),R=n(72),L=r(R),F=n(73),B=r(F),U=n(74),H=r(U),X=n(1),Y=r(X),G=n(9),z=r(G),W=Y.default.componentNames,K=Y.default.eventNames,J=Y.default.drawingModes,V=Y.default.fObjectOptions,q=s.default.extend,Z=s.default.stamp,Q=s.default.isArray,$=s.default.isString,ee=s.default.forEachArray,te=s.default.forEachOwnProperties,ne=s.default.CustomEvents,re=1e3,ie=800,oe={cssOnly:!0},ae={backstoreOnly:!0},se=function(){function e(t,n,r){i(this,e),this.canvasImage=null,this.cssMaxWidth=n||re,this.cssMaxHeight=r||ie,this.imageName="",this._objects={},this._canvas=null,this._drawingMode=J.NORMAL,this._drawingModeMap={},this._componentMap={},this._handler={onMouseDown:this._onMouseDown.bind(this),onObjectAdded:this._onObjectAdded.bind(this),onObjectRemoved:this._onObjectRemoved.bind(this),onObjectMoved:this._onObjectMoved.bind(this),onObjectScaled:this._onObjectScaled.bind(this),onObjectSelected:this._onObjectSelected.bind(this),onPathCreated:this._onPathCreated.bind(this)},this._setCanvasElement(t),this._createDrawingModeInstances(),this._createComponents(),this._attachCanvasEvents()}return o(e,[{key:"destroy",value:function(){var e=this._canvas.wrapperEl;this._canvas.clear(),e.parentNode.removeChild(e)}},{key:"deactivateAll",value:function(){return this._canvas.deactivateAll(),this}},{key:"renderAll",value:function(){return this._canvas.renderAll(),this}},{key:"add",value:function(e){var t,n=[];Q(e)?n=e:n.push(e),(t=this._canvas).add.apply(t,n)}},{key:"contains",value:function(e){return this._canvas.contains(e)}},{key:"getObjects",value:function(){return this._canvas.getObjects().slice()}},{key:"getObject",value:function(e){return this._objects[e]}},{key:"remove",value:function(e){this._canvas.remove(e)}},{key:"removeAll",value:function(e){var t=this._canvas,n=t.getObjects().slice();return t.remove.apply(t,this._canvas.getObjects()),e&&t.clear(),n}},{key:"removeObjectById",value:function(e){var t=[],n=this._canvas,r=this.getObject(e),i=r&&r.isType("group")&&!r.isEmpty();return i?(n.discardActiveGroup(),r.forEachObject(function(e){t.push(e),e.remove()})):n.contains(r)&&(t.push(r),r.remove()),t}},{key:"getObjectId",value:function(e){var t=null;for(t in this._objects)if(this._objects.hasOwnProperty(t)&&e===this._objects[t])return t;return null}},{key:"getActiveObject",value:function(){return this._canvas.getActiveObject()}},{key:"setActiveObject",value:function(e){this._canvas.setActiveObject(e)}},{key:"getComponent",value:function(e){return this._componentMap[e]}},{key:"getDrawingMode",value:function(){return this._drawingMode}},{key:"startDrawingMode",value:function(e,t){if(this._isSameDrawingMode(e))return!0;this.stopDrawingMode();var n=this._getDrawingModeInstance(e);return n&&n.start&&(n.start(this,t),this._drawingMode=e),!!n}},{key:"stopDrawingMode",value:function(){if(!this._isSameDrawingMode(J.NORMAL)){var e=this._getDrawingModeInstance(this.getDrawingMode());e&&e.end&&e.end(this),this._drawingMode=J.NORMAL}}},{key:"toDataURL",value:function(e){return this._canvas&&this._canvas.toDataURL(e)}},{key:"setCanvasImage",value:function(e,t){t&&Z(t),this.imageName=e,this.canvasImage=t}},{key:"setCssMaxDimension",value:function(e){this.cssMaxWidth=e.width||this.cssMaxWidth,this.cssMaxHeight=e.height||this.cssMaxHeight}},{key:"adjustCanvasDimension",value:function(){var e=this.canvasImage.scale(1),t=e.getBoundingRect(),n=t.width,r=t.height,i=this._calcMaxDimension(n,r);this.setCanvasCssDimension({width:"100%",height:"100%","max-width":i.width+"px","max-height":i.height+"px"}),this.setCanvasBackstoreDimension({width:n,height:r}),this._canvas.centerObject(e)}},{key:"setCanvasCssDimension",value:function(e){this._canvas.setDimensions(e,oe)}},{key:"setCanvasBackstoreDimension",value:function(e){this._canvas.setDimensions(e,ae)}},{key:"setImageProperties",value:function(e,t){var n=this.canvasImage;n&&(n.set(e).setCoords(),t&&this._canvas.renderAll())}},{key:"getCanvasElement",value:function(){return this._canvas.getElement()}},{key:"getCanvas",value:function(){return this._canvas}},{key:"getCanvasImage",value:function(){return this.canvasImage}},{key:"getImageName",value:function(){return this.imageName}},{key:"addImageObject",value:function(e){var t=this,n=this._callbackAfterLoadingImageObject.bind(this);return new c.default(function(r){f.default.Image.fromURL(e,function(e){n(e),r(t.createObjectProperties(e))},{crossOrigin:"Anonymous"})})}},{key:"getCenter",value:function(){return this._canvas.getCenter()}},{key:"getCropzoneRect",value:function(){return this.getComponent(W.CROPPER).getCropzoneRect()}},{key:"getCroppedImageData",value:function(e){return this.getComponent(W.CROPPER).getCroppedImageData(e)}},{key:"setBrush",value:function(e){var t=this._drawingMode,n=W.FREE_DRAWING;t===J.LINE&&(n=J.LINE),this.getComponent(n).setBrush(e)}},{key:"setDrawingShape",value:function(e,t){this.getComponent(W.SHAPE).setStates(e,t)}},{key:"registerPaths",value:function(e){this.getComponent(W.ICON).registerPaths(e)}},{key:"hasFilter",value:function(e){return this.getComponent(W.FILTER).hasFilter(e)}},{key:"setSelectionStyle",value:function(e){q(V.SELECTION_STYLE,e)}},{key:"setObjectProperties",value:function(e,t){var n=this.getObject(e),r=q({},t);return n.set(r),n.setCoords(),this.getCanvas().renderAll(),r}},{key:"getObjectProperties",value:function(e,t){var n=this.getObject(e),r={};return $(t)?r[t]=n[t]:Q(t)?ee(t,function(e){r[e]=n[e]}):te(t,function(e,t){r[t]=n[t]}),r}},{key:"getObjectPosition",value:function(e,t,n){var r=this.getObject(e);return r?r.getPointByOrigin(t,n):null}},{key:"setObjectPosition",value:function(e,t){var n=this.getObject(e),r=t.x,i=t.y,o=t.originX,a=t.originY;if(!n)return!1;var s=n.getPointByOrigin(o,a),u=n.getPointByOrigin("center","center"),c=u.x-s.x,l=u.y-s.y;return n.set({left:r+c,top:i+l}),n.setCoords(),!0}},{key:"getCanvasSize",value:function(){var e=this.getCanvasImage();return{width:e?e.width:0,height:e?e.height:0}}},{key:"_getDrawingModeInstance",value:function(e){return this._drawingModeMap[e]}},{key:"_setCanvasElement",value:function(e){var t=void 0,n=void 0;t=e.jquery?e[0]:e.nodeType?e:document.querySelector(e),"CANVAS"!==t.nodeName.toUpperCase()&&(n=document.createElement("canvas"),t.appendChild(n)),this._canvas=new f.default.Canvas(n,{containerClass:"tui-image-editor-canvas-container",enableRetinaScaling:!1})}},{key:"_createDrawingModeInstances",value:function(){this._register(this._drawingModeMap,new D.default),this._register(this._drawingModeMap,new N.default),this._register(this._drawingModeMap,new L.default),this._register(this._drawingModeMap,new B.default),this._register(this._drawingModeMap,new H.default)}},{key:"_createComponents",value:function(){this._register(this._componentMap,new d.default(this)),this._register(this._componentMap,new v.default(this)),this._register(this._componentMap,new _.default(this)),this._register(this._componentMap,new m.default(this)),this._register(this._componentMap,new O.default(this)),this._register(this._componentMap,new w.default(this)),this._register(this._componentMap,new E.default(this)),this._register(this._componentMap,new x.default(this)),this._register(this._componentMap,new M.default(this)),this._register(this._componentMap,new P.default(this))}},{key:"_register",value:function(e,t){e[t.getName()]=t}},{key:"_isSameDrawingMode",value:function(e){return this.getDrawingMode()===e}},{key:"_calcMaxDimension",value:function(e,t){var n=this.cssMaxWidth/e,r=this.cssMaxHeight/t,i=Math.min(e,this.cssMaxWidth),o=Math.min(t,this.cssMaxHeight);return n<1&&n<r?(i=e*n,o=t*n):r<1&&r<n&&(i=e*r,o=t*r),{width:Math.floor(i),height:Math.floor(o)}}},{key:"_callbackAfterLoadingImageObject",value:function(e){var t=this.getCanvasImage().getCenterPoint();e.set(Y.default.fObjectOptions.SELECTION_STYLE),e.set({left:t.x,top:t.y,crossOrigin:"Anonymous"}),this.getCanvas().add(e).setActiveObject(e)}},{key:"_attachCanvasEvents",value:function(){var e=this._canvas,t=this._handler;e.on({"mouse:down":t.onMouseDown,"object:added":t.onObjectAdded,"object:removed":t.onObjectRemoved,"object:moving":t.onObjectMoved,"object:scaling":t.onObjectScaled,"object:selected":t.onObjectSelected,"path:created":t.onPathCreated})}},{key:"_onMouseDown",value:function(e){var t=this._canvas.getPointer(e.e);this.fire(K.MOUSE_DOWN,e.e,t)}},{key:"_onObjectAdded",value:function(e){var t=e.target;t.isType("cropzone")||this._addFabricObject(t)}},{key:"_onObjectRemoved",value:function(e){var t=e.target;this._removeFabricObject(Z(t))}},{key:"_onObjectMoved",value:function(e){var t=e.target,n=this.createObjectProperties(t);this.fire(K.OBJECT_MOVED,n)}},{key:"_onObjectScaled",value:function(e){var t=e.target,n=this.createObjectProperties(t);this.fire(K.OBJECT_SCALED,n)}},{key:"_onObjectSelected",value:function(e){var t=e.target,n=this.createObjectProperties(t);this.fire(K.OBJECT_ACTIVATED,n)}},{key:"_onPathCreated",value:function(e){e.path.set(Y.default.fObjectOptions.SELECTION_STYLE);var t=this.createObjectProperties(e.path);this.fire(K.ADD_OBJECT,t)}},{key:"createObjectProperties",value:function(e){var t=["left","top","width","height","fill","stroke","strokeWidth","opacity"],n={id:Z(e),type:e.type};return q(n,z.default.getProperties(e,t)),"text"===e.type&&q(n,this._createTextProperties(e,n)),n}},{key:"_createTextProperties",value:function(e){var t=["text","fontFamily","fontSize","fontStyle","textAlign","textDecoration"],n={};return q(n,z.default.getProperties(e,t)),n}},{key:"_addFabricObject",value:function(e){var t=Z(e);return this._objects[t]=e,t}},{key:"_removeFabricObject",value:function(e){delete this._objects[e]}}]),e}();ne.mixin(se),e.exports=se},function(e,t){"use strict";function n(e){var t=e.getOriginX(),n=e.getOriginY(),r=t.substring(0,1)+n.substring(0,1);e.startPoint=e.origins[r]}function r(e,t,n){var r=e.x,i=e.y,o=t.x,a=t.y,s=n*Math.PI/180,u=(o-r)*Math.cos(s)-(a-i)*Math.sin(s)+r,c=(o-r)*Math.sin(s)+(a-i)*Math.cos(s)+i;return{originX:r>u?"right":"left",originY:i>c?"bottom":"top"}}function i(e){return"center"===e.getOriginX()&&"center"===e.getOriginY()}function o(e,t){var n=t.getPointByOrigin("center","center"),i=-t.getAngle(),o=r(n,e,i),a=o.originX,s=o.originY,u=t.getPointByOrigin(a,s),c=t.getLeft()-(n.x-u.x),l=t.getTop()-(n.x-u.y);t.set({originX:a,originY:s,left:c,top:l}),t.setCoords()}function a(e,t){var n=t.startPoint,i=-t.getAngle(),o=r(n,e,i),a=o.originX,s=o.originY;t.setPositionByOrigin(n,a,s)}function s(e){var t=e.type,n=e.scaleX,r=e.scaleY,i=l[t],o=e[i.w]*n,a=e[i.h]*r;if(e.isRegular){var s=Math.max(n,r);o=e[i.w]*s,a=e[i.h]*s}var u={hasControls:!1,hasBorders:!1,scaleX:1,scaleY:1};u[i.w]=o,u[i.h]=a,e.set(u)}function u(e,t){var n=t.type,r=t.strokeWidth,i=t.startPoint,o=c[n],a=l[n],s=!("triangle"!==t.type),u={},f=Math.abs(i.x-e.x)/o,h=Math.abs(i.y-e.y)/o;f>r&&(f-=r/o),h>r&&(h-=r/o),t.isRegular&&(f=h=Math.max(f,h),s&&(h=Math.sqrt(3)/2*f)),u[a.w]=f,u[a.h]=h,t.set(u)}var c={rect:1,circle:2,triangle:1},l={rect:{w:"width",h:"height"},circle:{w:"rx",h:"ry"},triangle:{w:"width",h:"height"}};e.exports={setOrigins:function(e){var t=e.getPointByOrigin("left","top"),n=e.getPointByOrigin("right","top"),r=e.getPointByOrigin("right","bottom"),i=e.getPointByOrigin("left","bottom");e.origins={lt:t,rt:n,rb:r,lb:i}},resize:function(e,t,r){i(e)&&(o(t,e),n(e)),r?s(e,t):u(t,e),a(t,e)},adjustOriginToCenter:function(e){var t=e.getPointByOrigin("center","center"),n=e.getOriginX(),r=e.getOriginY(),i=e.getPointByOrigin(n,r),o=e.getLeft()+(t.x-i.x),a=e.getTop()+(t.y-i.y);e.set({hasControls:!0,hasBorders:!0,originX:"center",originY:"center",left:o,top:a}),e.setCoords()}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(5),s=r(a),u=n(85),c=r(u),l=n(3),f=r(l),h=n(81),d=r(h),p=n(1),v=r(p),g=v.default.eventNames,_=v.default.commandNames,y=v.default.keyCodes,m=v.default.rejectMessages,b=s.default.isUndefined,O=s.default.forEach,k=s.default.CustomEvents,w=function(){function e(t,n){i(this,e),n=n||{},this._invoker=new c.default,this._graphics=new d.default(t,n.cssMaxWidth,n.cssMaxHeight),this._handlers={keydown:this._onKeyDown.bind(this),mousedown:this._onMouseDown.bind(this),objectActivated:this._onObjectActivated.bind(this),objectMoved:this._onObjectMoved.bind(this),objectScaled:this._onObjectScaled.bind(this),createdPath:this._onCreatedPath,addText:this._onAddText.bind(this),addObject:this._onAddObject.bind(this),textEditing:this._onTextEditing.bind(this),textChanged:this._onTextChanged.bind(this)},this._attachInvokerEvents(),this._attachGraphicsEvents(),this._attachDomEvents(),n.selectionStyle&&this._setSelectionStyle(n.selectionStyle)}return o(e,[{key:"_setSelectionStyle",value:function(e){this._graphics.setSelectionStyle(e)}},{key:"_attachInvokerEvents",value:function(){var e=g.UNDO_STACK_CHANGED,t=g.REDO_STACK_CHANGED;this._invoker.on(e,this.fire.bind(this,e)),this._invoker.on(t,this.fire.bind(this,t))}},{key:"_attachGraphicsEvents",value:function(){this._graphics.on({mousedown:this._handlers.mousedown,objectMoved:this._handlers.objectMoved,objectScaled:this._handlers.objectScaled,objectActivated:this._handlers.objectActivated,addText:this._handlers.addText,addObject:this._handlers.addObject,textEditing:this._handlers.textEditing,textChanged:this._handlers.textChanged})}},{key:"_attachDomEvents",value:function(){document.addEventListener("keydown",this._handlers.keydown)}},{key:"_detachDomEvents",value:function(){document.removeEventListener("keydown",this._handlers.keydown)}},{key:"_onKeyDown",value:function(e){var t=this._graphics.getActiveObject(),n=this._graphics.getObjectId(t);(e.ctrlKey||e.metaKey)&&e.keyCode===y.Z&&this.undo().catch(function(){}),(e.ctrlKey||e.metaKey)&&e.keyCode===y.Y&&this.redo().catch(function(){}),e.keyCode!==y.BACKSPACE&&e.keyCode!==y.DEL||!t||(e.preventDefault(),this.removeObject(n))}},{key:"_onMouseDown",value:function(e,t){this.fire(g.MOUSE_DOWN,e,t)}},{key:"_pushAddObjectCommand",value:function(e){var t=f.default.create(_.ADD_OBJECT,this._graphics,e);this._invoker.pushUndoStack(t)}},{key:"_onObjectActivated",value:function(e){this.fire(g.OBJECT_ACTIVATED,e)}},{key:"_onObjectMoved",value:function(e){this.fire(g.OBJECT_MOVED,e)}},{key:"_onObjectScaled",value:function(e){this.fire(g.OBJECT_SCALED,e)}},{key:"getDrawingMode",value:function(){return this._graphics.getDrawingMode()}},{key:"clearObjects",value:function(){return this.execute(_.CLEAR_OBJECTS)}},{key:"deactivateAll",value:function(){this._graphics.deactivateAll(),this._graphics.renderAll()}},{key:"execute",value:function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=[this._graphics].concat(r);return(t=this._invoker).execute.apply(t,[e].concat(o))}},{key:"undo",value:function(){return this._invoker.undo()}},{key:"redo",value:function(){return this._invoker.redo()}},{key:"loadImageFromFile",value:function(e,t){if(!e)return Promise.reject(m.invalidParameters);var n=URL.createObjectURL(e);return t=t||e.name,this.loadImageFromURL(n,t).then(function(t){return URL.revokeObjectURL(e),t})}},{key:"loadImageFromURL",value:function(e,t){return t&&e?this.execute(_.LOAD_IMAGE,t,e):Promise.reject(m.invalidParameters)}},{key:"addImageObject",value:function(e){return e?this.execute(_.ADD_IMAGE_OBJECT,e):Promise.reject(m.invalidParameters)}},{key:"startDrawingMode",value:function(e,t){return this._graphics.startDrawingMode(e,t)}},{key:"stopDrawingMode",value:function(){this._graphics.stopDrawingMode()}},{key:"crop",value:function(e){var t=this._graphics.getCroppedImageData(e);return t?this.loadImageFromURL(t.url,t.imageName):Promise.reject(m.invalidParameters)}},{key:"getCropzoneRect",value:function(){return this._graphics.getCropzoneRect()}},{key:"_flip",value:function(e){return this.execute(_.FLIP_IMAGE,e)}},{key:"flipX",value:function(){return this._flip("flipX")}},{key:"flipY",value:function(){return this._flip("flipY")}},{key:"resetFlip",value:function(){return this._flip("reset")}},{key:"_rotate",value:function(e,t){return this.execute(_.ROTATE_IMAGE,e,t)}},{key:"rotate",value:function(e){return this._rotate("rotate",e)}},{key:"setAngle",value:function(e){return this._rotate("setAngle",e)}},{key:"setBrush",value:function(e){this._graphics.setBrush(e)}},{key:"setDrawingShape",value:function(e,t){this._graphics.setDrawingShape(e,t)}},{key:"addShape",value:function(e,t){return t=t||{},this._setPositions(t),this.execute(_.ADD_SHAPE,e,t)}},{key:"changeShape",value:function(e,t){return this.execute(_.CHANGE_SHAPE,e,t)}},{key:"addText",value:function(e,t){return e=e||"",t=t||{},this.execute(_.ADD_TEXT,e,t)}},{key:"changeText",value:function(e,t){return t=t||"",this.execute(_.CHANGE_TEXT,e,t)}},{key:"changeTextStyle",value:function(e,t){return this.execute(_.CHANGE_TEXT_STYLE,e,t)}},{key:"_onTextChanged",value:function(e){this.changeText(e.id,e.text)}},{key:"_onTextEditing",value:function(){this.fire(g.TEXT_EDITING)}},{key:"_onAddText",value:function(e){this.fire(g.ADD_TEXT,{originPosition:e.originPosition,clientPosition:e.clientPosition})}},{key:"_onAddObject",value:function(e){var t=this._graphics.getObject(e.id);this._pushAddObjectCommand(t)}},{key:"registerIcons",value:function(e){this._graphics.registerPaths(e)}},{key:"addIcon",value:function(e,t){return t=t||{},this._setPositions(t),this.execute(_.ADD_ICON,e,t)}},{key:"changeIconColor",value:function(e,t){return this.execute(_.CHANGE_ICON_COLOR,e,t)}},{key:"removeObject",value:function(e){return this.execute(_.REMOVE_OBJECT,e)}},{key:"hasFilter",value:function(e){return this._graphics.hasFilter(e)}},{key:"removeFilter",value:function(e){return this.execute(_.REMOVE_FILTER,e)}},{key:"applyFilter",value:function(e,t){return this.execute(_.APPLY_FILTER,e,t)}},{key:"toDataURL",value:function(e){return this._graphics.toDataURL(e)}},{key:"getImageName",value:function(){return this._graphics.getImageName()}},{key:"clearUndoStack",value:function(){this._invoker.clearUndoStack()}},{key:"clearRedoStack",value:function(){this._invoker.clearRedoStack()}},{key:"isEmptyUndoStack",value:function(){return this._invoker.isEmptyUndoStack()}},{key:"isEmptyRedoStack",value:function(){return this._invoker.isEmptyRedoStack()}},{key:"resizeCanvasDimension",value:function(e){return e?this.execute(_.RESIZE_CANVAS_DIMENSION,e):Promise.reject(m.invalidParameters)}},{key:"destroy",value:function(){var e=this;this.stopDrawingMode(),this._detachDomEvents(),this._graphics.destroy(),this._graphics=null,O(this,function(t,n){e[n]=null},this)}},{key:"_setPositions",value:function(e){var t=this._graphics.getCenter();b(e.left)&&(e.left=t.left),b(e.top)&&(e.top=t.top)}},{key:"setObjectProperties",value:function(e,t){return this.execute(_.SET_OBJECT_PROPERTIES,e,t)}},{key:"getObjectProperties",value:function(e,t){var n=this._graphics.getObject(e);return n?this._graphics.getObjectProperties(e,t):null}},{key:"getCanvasSize",value:function(){return this._graphics.getCanvasSize()}},{key:"getObjectPosition",value:function(e,t,n){return this._graphics.getObjectPosition(e,t,n)}},{key:"setObjectPosition",value:function(e,t){return this.execute(_.SET_OBJECT_POSITION,e,t)}}]),e}();k.mixin(w),e.exports=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(28),s=r(a),u=s.default.create,c=s.default.types,l=function(){function e(t,n){i(this,e),this.name=t.name,this.args=n,this.execute=t.execute,this.undo=t.undo,this.executeCallback=t.executeCallback||null,this.undoCallback=t.undoCallback||null,this.undoData={}}return o(e,[{key:"execute",value:function(){throw new Error(u(c.UN_IMPLEMENTATION,"execute"))}},{key:"undo",value:function(){throw new Error(u(c.UN_IMPLEMENTATION,"undo"))}},{key:"setExecuteCallback",value:function(e){return this.executeCallback=e,this}},{key:"setUndoCallback",value:function(e){return this.undoCallback=e,this}}]),e}();e.exports=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(5),s=r(a),u=n(2),c=r(u),l=n(3),f=r(l),h=n(1),d=r(h),p=d.default.eventNames,v=d.default.rejectMessages,g=s.default.isFunction,_=s.default.isString,y=s.default.CustomEvents,m=function(){function e(){i(this,e),this._undoStack=[],this._redoStack=[],this._isLocked=!1}return o(e,[{key:"_invokeExecution",value:function(e){var t=this;this.lock();var n=e.args;return n||(n=[]),e.execute.apply(e,n).then(function(n){return t.pushUndoStack(e),t.unlock(),g(e.executeCallback)&&e.executeCallback(n),n}).catch(function(e){return t.unlock(),c.default.reject(e)})}},{key:"_invokeUndo",value:function(e){var t=this;this.lock();var n=e.args;return n||(n=[]),e.undo.apply(e,n).then(function(n){return t.pushRedoStack(e),t.unlock(),g(e.undoCallback)&&e.undoCallback(n),n}).catch(function(e){return t.unlock(),c.default.reject(e)})}},{key:"_fireRedoStackChanged",value:function(){this.fire(p.REDO_STACK_CHANGED,this._redoStack.length)}},{key:"_fireUndoStackChanged",value:function(){this.fire(p.UNDO_STACK_CHANGED,this._undoStack.length)}},{key:"lock",value:function(){this._isLocked=!0}},{key:"unlock",value:function(){this._isLocked=!1}},{key:"execute",value:function(){var e=this;if(this._isLocked)return c.default.reject(v.isLock);for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0];return _(i)&&(i=f.default.create.apply(f.default,n)),this._invokeExecution(i).then(function(t){return e.clearRedoStack(),t})}},{key:"undo",value:function(){var e=this._undoStack.pop(),t=void 0,n="";return e&&this._isLocked&&(this.pushUndoStack(e,!0),e=null),e?(this.isEmptyUndoStack()&&this._fireUndoStackChanged(),t=this._invokeUndo(e)):(n=v.undo,this._isLocked&&(n=n+" Because "+v.isLock),t=c.default.reject(n)),t}},{key:"redo",value:function(){var e=this._redoStack.pop(),t=void 0,n="";return e&&this._isLocked&&(this.pushRedoStack(e,!0),e=null),e?(this.isEmptyRedoStack()&&this._fireRedoStackChanged(),t=this._invokeExecution(e)):(n=v.redo,this._isLocked&&(n=n+" Because "+v.isLock),t=c.default.reject(n)),t}},{key:"pushUndoStack",value:function(e,t){this._undoStack.push(e),t||this._fireUndoStackChanged()}},{key:"pushRedoStack",value:function(e,t){this._redoStack.push(e),t||this._fireRedoStackChanged()}},{key:"isEmptyRedoStack",value:function(){return 0===this._redoStack.length}},{key:"isEmptyUndoStack",value:function(){return 0===this._undoStack.length}},{key:"clearUndoStack",value:function(){this.isEmptyUndoStack()||(this._undoStack=[],this._fireUndoStackChanged())}},{key:"clearRedoStack",value:function(){this.isEmptyRedoStack()||(this._redoStack=[],this._fireRedoStackChanged())}}]),e}();y.mixin(m),e.exports=m},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(27),i=n(39),o=n(109);e.exports=function(e){return function(t,n,a){var s,u=r(t),c=i(u.length),l=o(a,c);if(e&&n!=n){for(;c>l;)if(s=u[l++],s!=s)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){var r=n(17),i=n(94),o=n(93),a=n(10),s=n(39),u=n(112),c={},l={},t=e.exports=function(e,t,n,f,h){var d,p,v,g,_=h?function(){return e}:u(e),y=r(n,f,t?2:1),m=0;if("function"!=typeof _)throw TypeError(e+" is not iterable!");if(o(_)){for(d=s(e.length);d>m;m++)if(g=t?y(a(p=e[m])[0],p[1]):y(e[m]),g===c||g===l)return g}else for(v=_.call(e);!(p=v.next()).done;)if(g=i(v,y,p.value,t),g===c||g===l)return g};t.BREAK=c,t.RETURN=l},function(e,t,n){e.exports=!n(14)&&!n(32)(function(){return 7!=Object.defineProperty(n(23)("div"),"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(16);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(15),i=n(6)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[i]===e)}},function(e,t,n){var r=n(10);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&r(o.call(e)),t}}},function(e,t,n){"use strict";var r=n(99),i=n(36),o=n(24),a={};n(11)(a,n(6)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(6)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},e(o)}catch(e){}return n}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(8),i=n(38).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==n(16)(a);e.exports=function(){var e,t,n,c=function(){var r,i;for(u&&(r=a.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(o){var l=!0,f=document.createTextNode("");new o(c).observe(f,{characterData:!0}),n=function(){f.data=l=!l}}else if(s&&s.resolve){var h=s.resolve();n=function(){h.then(c)}}else n=function(){i.call(r,c)};return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){var r=n(10),i=n(100),o=n(30),a=n(25)("IE_PROTO"),s=function(){},u="prototype",c=function(){var e,t=n(23)("iframe"),r=o.length,i="<",a=">";for(t.style.display="none",n(33).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(i+"script"+a+"document.F=Object"+i+"/script"+a),e.close(),c=e.F;r--;)delete c[u][o[r]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[u]=r(e),n=new s,s[u]=null,n[a]=e):n=c(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(20),i=n(10),o=n(103);e.exports=n(14)?Object.defineProperties:function(e,t){i(e);for(var n,a=o(t),s=a.length,u=0;s>u;)r.f(e,n=a[u++],t[n]);return e}},function(e,t,n){var r=n(18),i=n(110),o=n(25)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var r=n(18),i=n(27),o=n(88)(!1),a=n(25)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),u=0,c=[];for(n in s)n!=a&&r(s,n)&&c.push(n);for(;t.length>u;)r(s,n=t[u++])&&(~o(c,n)||c.push(n));return c}},function(e,t,n){var r=n(102),i=n(30);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(11);e.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},function(e,t,n){e.exports=n(11)},function(e,t,n){"use strict";var r=n(8),i=n(13),o=n(20),a=n(14),s=n(6)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:r[e];a&&t&&!t[s]&&o.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(10),i=n(21),o=n(6)("species");e.exports=function(e,t){var n,a=r(e).constructor;return void 0===a||void 0==(n=r(a)[o])?t:i(n)}},function(e,t,n){var r=n(26),i=n(22);e.exports=function(e){return function(t,n){var o,a,s=String(i(t)),u=r(n),c=s.length;return u<0||u>=c?e?"":void 0:(o=s.charCodeAt(u),o<55296||o>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?e?s.charAt(u):o:e?s.slice(u,u+2):(o-55296<<10)+(a-56320)+65536)}}},function(e,t,n){var r=n(26),i=Math.max,o=Math.min;e.exports=function(e,t){return e=r(e),e<0?i(e+t,0):o(e,t)}},function(e,t,n){var r=n(22);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(19);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;
- if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(29),i=n(6)("iterator"),o=n(15);e.exports=n(13).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){"use strict";var r=n(86),i=n(97),o=n(15),a=n(27);e.exports=n(34)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t){},function(e,t,n){"use strict";var r,i,o,a=n(35),s=n(8),u=n(17),c=n(29),l=n(31),f=n(19),h=n(21),d=n(87),p=n(89),v=n(107),g=n(38).set,_=n(98)(),y="Promise",m=s.TypeError,b=s.process,O=s[y],b=s.process,k="process"==c(b),w=function(){},C=!!function(){try{var e=O.resolve(1),t=(e.constructor={})[n(6)("species")]=function(e){e(w,w)};return(k||"function"==typeof PromiseRejectionEvent)&&e.then(w)instanceof t}catch(e){}}(),E=function(e,t){return e===t||e===O&&t===o},j=function(e){var t;return!(!f(e)||"function"!=typeof(t=e.then))&&t},x=function(e){return E(O,e)?new T(e):new i(e)},T=i=function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw m("Bad Promise constructor");t=e,n=r}),this.resolve=h(t),this.reject=h(n)},M=function(e){try{e()}catch(e){return{error:e}}},S=function(e,t){if(!e._n){e._n=!0;var n=e._c;_(function(){for(var r=e._v,i=1==e._s,o=0,a=function(t){var n,o,a=i?t.ok:t.fail,s=t.resolve,u=t.reject,c=t.domain;try{a?(i||(2==e._h&&D(e),e._h=1),a===!0?n=r:(c&&c.enter(),n=a(r),c&&c.exit()),n===t.promise?u(m("Promise-chain cycle")):(o=j(n))?o.call(n,s,u):s(n)):u(r)}catch(e){u(e)}};n.length>o;)a(n[o++]);e._c=[],e._n=!1,t&&!e._h&&P(e)})}},P=function(e){g.call(s,function(){var t,n,r,i=e._v;if(A(e)&&(t=M(function(){k?b.emit("unhandledRejection",i,e):(n=s.onunhandledrejection)?n({promise:e,reason:i}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",i)}),e._h=k||A(e)?2:1),e._a=void 0,t)throw t.error})},A=function(e){if(1==e._h)return!1;for(var t,n=e._a||e._c,r=0;n.length>r;)if(t=n[r++],t.fail||!A(t.promise))return!1;return!0},D=function(e){g.call(s,function(){var t;k?b.emit("rejectionHandled",e):(t=s.onrejectionhandled)&&t({promise:e,reason:e._v})})},I=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||(t._a=t._c.slice()),S(t,!0))},N=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw m("Promise can't be resolved itself");(t=j(e))?_(function(){var r={_w:n,_d:!1};try{t.call(e,u(N,r,1),u(I,r,1))}catch(e){I.call(r,e)}}):(n._v=e,n._s=1,S(n,!1))}catch(e){I.call({_w:n,_d:!1},e)}}};C||(O=function(e){d(this,O,y,"_h"),h(e),r.call(this);try{e(u(N,this,1),u(I,this,1))}catch(e){I.call(this,e)}},r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(104)(O.prototype,{then:function(e,t){var n=x(v(this,O));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=k?b.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&S(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),T=function(){var e=new r;this.promise=e,this.resolve=u(N,e,1),this.reject=u(I,e,1)}),l(l.G+l.W+l.F*!C,{Promise:O}),n(24)(O,y),n(106)(y),o=n(13)[y],l(l.S+l.F*!C,y,{reject:function(e){var t=x(this),n=t.reject;return n(e),t.promise}}),l(l.S+l.F*(a||!C),y,{resolve:function(e){if(e instanceof O&&E(e.constructor,this))return e;var t=x(this),n=t.resolve;return n(e),t.promise}}),l(l.S+l.F*!(C&&n(96)(function(e){O.all(e).catch(w)})),y,{all:function(e){var t=this,n=x(t),r=n.resolve,i=n.reject,o=M(function(){var n=[],o=0,a=1;p(e,!1,function(e){var s=o++,u=!1;n.push(void 0),a++,t.resolve(e).then(function(e){u||(u=!0,n[s]=e,--a||r(n))},i)}),--a||r(n)});return o&&i(o.error),n.promise},race:function(e){var t=this,n=x(t),r=n.reject,i=M(function(){p(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i&&r(i.error),n.promise}})},function(e,t,n){"use strict";var r=n(108)(!0);n(34)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(113);for(var r=n(8),i=n(11),o=n(15),a=n(6)("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],u=0;u<5;u++){var c=s[u],l=r[c],f=l&&l.prototype;f&&!f[a]&&i(f,a,c),o[c]=o.Array}}])});
|