-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtui-image-editor.min.js
More file actions
28 lines (28 loc) · 251 KB
/
tui-image-editor.min.js
File metadata and controls
28 lines (28 loc) · 251 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*!
* tui-image-editor.min.js
* @version 3.2.0
* @author NHNEnt FE Development Lab <dl_javascript@nhnent.com>
* @license MIT
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("tui-code-snippet"),require("fabric/dist/fabric.require")):"function"==typeof define&&define.amd?define(["tui-code-snippet","fabric/dist/fabric.require"],t):"object"==typeof exports?exports.ImageEditor=t(require("tui-code-snippet"),require("fabric/dist/fabric.require")):(e.tui=e.tui||{},e.tui.ImageEditor=t(e.tui&&e.tui.util,e.fabric))}(this,function(e,t){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="dist",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}n(91);var o=n(88),r=i(o);n(148),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(58),n(59),n(60),n(61),n(63),n(62),e.exports=r.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(5),r=i(o);e.exports={componentNames:r.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",OBJECT_CREATED:"objectCreated",TEXT_EDITING:"textEditing",TEXT_CHANGED:"textChanged",ICON_CREATE_RESIZE:"iconCreateResize",ICON_CREATE_END:"iconCreateEnd",ADD_TEXT:"addText",ADD_OBJECT:"addObject",ADD_OBJECT_AFTER:"addObjectAfter",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_MOVE:"mousemove",REDO_STACK_CHANGED:"redoStackChanged",UNDO_STACK_CHANGED:"undoStackChanged",SELECTION_CLEARED:"selectionCleared",SELECTION_CREATED:"selectionCreated"},drawingModes:r.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."},defaultIconPath:{"icon-arrow":"M40 12V0l24 24-24 24V36H0V12h40z","icon-arrow-2":"M49,32 H3 V22 h46 l-18,-18 h12 l23,23 L43,50 h-12 l18,-18 z ","icon-arrow-3":"M43.349998,27 L17.354,53 H1.949999 l25.996,-26 L1.949999,1 h15.404 L43.349998,27 z ","icon-star":"M35,54.557999 l-19.912001,10.468 l3.804,-22.172001 l-16.108,-15.7 l22.26,-3.236 L35,3.746 l9.956,20.172001 l22.26,3.236 l-16.108,15.7 l3.804,22.172001 z ","icon-star-2":"M17,31.212 l-7.194,4.08 l-4.728,-6.83 l-8.234,0.524 l-1.328,-8.226 l-7.644,-3.14 l2.338,-7.992 l-5.54,-6.18 l5.54,-6.176 l-2.338,-7.994 l7.644,-3.138 l1.328,-8.226 l8.234,0.522 l4.728,-6.83 L17,-24.312 l7.194,-4.08 l4.728,6.83 l8.234,-0.522 l1.328,8.226 l7.644,3.14 l-2.338,7.992 l5.54,6.178 l-5.54,6.178 l2.338,7.992 l-7.644,3.14 l-1.328,8.226 l-8.234,-0.524 l-4.728,6.83 z ","icon-polygon":"M3,31 L19,3 h32 l16,28 l-16,28 H19 z ","icon-location":"M24 62C8 45.503 0 32.837 0 24 0 10.745 10.745 0 24 0s24 10.745 24 24c0 8.837-8 21.503-24 38zm0-28c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10z","icon-heart":"M49.994999,91.349998 l-6.96,-6.333 C18.324001,62.606995 2.01,47.829002 2.01,29.690998 C2.01,14.912998 13.619999,3.299999 28.401001,3.299999 c8.349,0 16.362,5.859 21.594,12 c5.229,-6.141 13.242001,-12 21.591,-12 c14.778,0 26.390999,11.61 26.390999,26.390999 c0,18.138 -16.314001,32.916 -41.025002,55.374001 l-6.96,6.285 z ","icon-bubble":"M44 48L34 58V48H12C5.373 48 0 42.627 0 36V12C0 5.373 5.373 0 12 0h40c6.627 0 12 5.373 12 12v24c0 6.627-5.373 12-12 12h-8z"},defaultRotateRangeValus:{realTimeEvent:!0,min:-360,max:360,value:0},defaultDrawRangeValus:{min:5,max:30,value:12},defaultShapeStrokeValus:{realTimeEvent:!1,min:2,max:300,value:3},defaultTextRangeValus:{realTimeEvent:!0,min:10,max:100,value:50},defaultFilterRangeValus:{tintOpacityRange:{min:0,max:1,value:.7},removewhiteThresholdRange:{min:0,max:255,value:60},removewhiteDistanceRange:{min:0,max:255,value:10},gradientTransparencyRange:{min:0,max:255,value:100},brightnessRange:{min:-255,max:255,value:100},noiseRange:{min:0,max:1e3,value:100},pixelateRange:{min:2,max:20,value:4},colorfilterThresholeRange:{min:0,max:255,value:45}}}},function(e,t,n){n(144),n(146),n(147),n(145),e.exports=n(16).Promise},function(t,n){t.exports=e},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=l[e];if(t){for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return new s.default(t,i)}return null}function r(e){l[e.name]=e}var a=n(89),s=i(a),l={};e.exports={create:o,register:r}},function(e,t,n){"use strict";var i=n(3),o=Math.min,r=Math.max,a=!1;e.exports={clamp:function(e,t,n){var i=void 0;return t>n&&(i=t,t=n,n=i),r(t,o(e,n))},keyMirror:function(){for(var e={},t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];return(0,i.forEach)(n,function(t){e[t]=t}),e},makeStyleText:function(e){var t="";return(0,i.forEach)(e,function(e,n){t+=n+": "+e+";"}),t},getProperties:function(e,t){var n={},i=t.length,o=0,r=void 0;for(o=0;o<i;o+=1)r=t[o],n[r]=e[r];return n},toInteger:function(e){return parseInt(e,10)},toCamelCase:function(e){return e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()})},isSupportFileApi:function(){return!!(window.File&&window.FileList&&window.FileReader)},getRgb:function(e,t){4===e.length&&(e=""+e+e.slice(1,4));var n=parseInt(e.slice(1,3),16),i=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16),r=t||1;return"rgba("+n+", "+i+", "+o+", "+r+")"},sendHostName:function(){var e=location,t=e.hostname;a||(a=!0,(0,i.imagePing)("https://www.google-analytics.com/collect",{v:1,t:"event",tid:"UA-115377265-9",cid:t,dp:t,dh:"image-editor"}))},styleLoad:function(e,t){var n=document.getElementsByTagName("head"),i=n[0],o=document.createElement("link"),r=encodeURIComponent(e);t&&(o.id=t),o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),o.setAttribute("href","data:text/css;charset=UTF-8,"+r),i.appendChild(o)},getSelector:function(e){return function(t){return e.querySelector(t)}},base64ToBlob:function(e){var t=/data:(image\/.+);base64,/,n="",i=void 0,o=void 0,r=void 0;i=e.replace(t,function(e,t){return n=t,""}),i=atob(i);var a=i.length;for(o=new Uint8Array(a),r=0;r<a;r+=1)o[r]=i.charCodeAt(r);return new Blob([o],{type:n})}}},function(e,n){e.exports=t},function(e,t,n){var i=n(40)("wks"),o=n(43),r=n(9).Symbol,a="function"==typeof r,s=e.exports=function(e){return i[e]||(i[e]=a&&r[e]||(a?r:o)("Symbol."+e))};s.store=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t,i){n(this,e),this.name=t,this.graphics=i}return i(e,[{key:"fire",value:function(){for(var e=this.graphics,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];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=o},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){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t,i){var o=i.name,r=i.iconStyle,a=i.menuBarPosition,s=i.templateHtml;n(this,e),this.selector=function(e){return t.querySelector(e)},this.menuBarPosition=a,this.toggleDirection="top"===a?"down":"up",this._makeSubMenuElement(t,{name:o,iconStyle:r,templateHtml:s})}return i(e,[{key:"getButtonType",value:function(e,t){return e.className.match(RegExp("("+t.join("|")+")"))[0]}},{key:"changeClass",value:function(e,t,n){e.classList.remove(t),e.classList.add(n)}},{key:"changeStandbyMode",value:function(){}},{key:"changeStartMode",value:function(){}},{key:"_makeSubMenuElement",value:function(e,t){var n=t.name,i=t.iconStyle,o=t.templateHtml,r=document.createElement("div");r.className="tui-image-editor-menu-"+n,r.innerHTML=o({iconStyle:i}),e.appendChild(r)}}]),e}();t.default=o},function(e,t,n){var i=n(22);e.exports=function(e){if(!i(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var i=n(23),o=n(39);e.exports=n(17)?function(e,t,n){return i.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(31),s=i(a),l=s.default.create,c=s.default.types,u=function(){function e(t){o(this,e),this.name=t}return r(e,[{key:"getName",value:function(){return this.name}},{key:"start",value:function(){throw new Error(l(c.UN_IMPLEMENTATION,"start"))}},{key:"stop",value:function(){throw new Error(l(c.UN_IMPLEMENTATION,"stop"))}}]),e}();e.exports=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(3),s=i(a),l=n(5),c=n(149),u=i(c),d=["#000000","#2a2a2a","#545454","#7e7e7e","#a8a8a8","#d2d2d2","#ffffff","","#ff4040","#ff6518","#ffbb3b","#03bd9e","#00a9ff","#515ce6","#9e5fff","#ff5583"],h=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#7e7e7e",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";o(this,e);var r=t.getAttribute("title");this._show=!1,this._toggleDirection=i,this._makePickerButtonElement(t,n),this._makePickerLayerElement(t,r),this._color=n,this.picker=u.default.create({container:this.pickerElement,preset:d,color:n}),this._addEvent(t)}return r(e,[{key:"_changeColorElement",value:function(e){e?(this.colorElement.classList.remove("transparent"),this.colorElement.style.backgroundColor=e):(this.colorElement.style.backgroundColor="#fff",this.colorElement.classList.add("transparent"))}},{key:"_makePickerButtonElement",value:function(e,t){e.classList.add("tui-image-editor-button"),this.colorElement=document.createElement("div"),this.colorElement.className="color-picker-value",t?this.colorElement.style.backgroundColor=t:this.colorElement.classList.add("transparent")}},{key:"_makePickerLayerElement",value:function(e,t){var n=document.createElement("label"),i=document.createElement("div");this.pickerControl=document.createElement("div"),this.pickerControl.className="color-picker-control",this.pickerElement=document.createElement("div"),this.pickerElement.className="color-picker",n.innerHTML=t,i.className="triangle",this.pickerControl.appendChild(this.pickerElement),this.pickerControl.appendChild(i),e.appendChild(this.pickerControl),e.appendChild(this.colorElement),e.appendChild(n),this._setPickerControlPosition()}},{key:"_addEvent",value:function(e){var t=this;this.picker.on("selectColor",function(e){t._changeColorElement(e.color),t._color=e.color,t.fire("change",e.color)}),e.addEventListener("click",function(e){t._show=!t._show,t.pickerControl.style.display=t._show?"block":"none",e.stopPropagation()}),document.body.addEventListener("click",function(){t._show=!1,t.pickerControl.style.display="none"})}},{key:"_setPickerControlPosition",value:function(){var e=this.pickerControl.style,t=(0,l.toInteger)(window.getComputedStyle(this.pickerControl,null).width)/2-20,n=((0,l.toInteger)(window.getComputedStyle(this.pickerControl,null).height)+12)*-1;"down"===this._toggleDirection&&(n=30),e.top=n+"px",e.left="-"+t+"px"}},{key:"color",get:function(){return this._color},set:function(e){this._color=e,this._changeColorElement(e)}}]),e}();s.default.CustomEvents.mixin(h),t.default=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(3),s=i(a),l=n(5),c=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,e),this._value=n.value||0,this.rangeElement=t,this._drawRangeElement(),this.rangeWidth=(0,l.toInteger)(window.getComputedStyle(t,null).width)-12,this._min=n.min||0,this._max=n.max||100,this._absMax=this._min*-1+this._max,this.realTimeEvent=n.realTimeEvent||!1,this._addClickEvent(),this._addDragEvent(),this.value=n.value,this.trigger("change")}return r(e,[{key:"trigger",value:function(e){this.fire(e,this._value)}},{key:"_drawRangeElement",value:function(){this.rangeElement.classList.add("tui-image-editor-range"),this.bar=document.createElement("div"),this.bar.className="tui-image-editor-virtual-range-bar",this.subbar=document.createElement("div"),this.subbar.className="tui-image-editor-virtual-range-subbar",this.pointer=document.createElement("div"),this.pointer.className="tui-image-editor-virtual-range-pointer",this.bar.appendChild(this.subbar),this.bar.appendChild(this.pointer),this.rangeElement.appendChild(this.bar)}},{key:"_addClickEvent",value:function(){var e=this;this.rangeElement.addEventListener("click",function(t){if(t.stopPropagation(),"tui-image-editor-range"===t.target.className){var n=t.offsetX,i=n/e.rangeWidth,o=e._absMax*i+e._min;e.pointer.style.left=i*e.rangeWidth+"px",e.subbar.style.right=(1-i)*e.rangeWidth+"px",e._value=o,e.fire("change",o)}})}},{key:"_addDragEvent",value:function(){var e=this;this.pointer.addEventListener("mousedown",function(t){e.firstPosition=t.screenX,e.firstLeft=(0,l.toInteger)(e.pointer.style.left)||0,e.dragEventHandler={changeAngle:e._changeAngle.bind(e),stopChangingAngle:e._stopChangingAngle.bind(e)},document.addEventListener("mousemove",e.dragEventHandler.changeAngle),document.addEventListener("mouseup",e.dragEventHandler.stopChangingAngle)})}},{key:"_changeAngle",value:function(e){var t=e.screenX,n=t-this.firstPosition,i=this.firstLeft+n;i=i>this.rangeWidth?this.rangeWidth:i,i=i<0?0:i,this.pointer.style.left=i+"px",this.subbar.style.right=this.rangeWidth-i+"px";var o=i/this.rangeWidth,r=this._absMax*o+this._min;this._value=r,this.realTimeEvent&&this.fire("change",r)}},{key:"_stopChangingAngle",value:function(){this.fire("change",this._value),document.removeEventListener("mousemove",this.dragEventHandler.changeAngle),document.removeEventListener("mouseup",this.dragEventHandler.stopChangingAngle)}},{key:"max",set:function(e){this._max=e,this._absMax=this._min*-1+this._max,this.value=this._value},get:function(){return this._max}},{key:"value",get:function(){return this._value},set:function(e){var t=e-this._min,n=t*this.rangeWidth/this._absMax;this.rangeWidth<n&&(n=this.rangeWidth),this.pointer.style.left=n+"px",this.subbar.style.right=this.rangeWidth-n+"px",this._value=e}}]),e}();s.default.CustomEvents.mixin(c),t.default=c},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports=!n(35)(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 i=n(24);e.exports=function(e,t,n){if(i(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,o){return e.call(t,n,i,o)}}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 i=n(11),o=n(120),r=n(141),a=Object.defineProperty;t.f=n(17)?Object.defineProperty:function(e,t,n){if(i(e),t=r(t,!0),i(n),o)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 i=n(22),o=n(9).document,r=i(o)&&i(o.createElement);e.exports=function(e){return r?o.createElement(e):{}}},function(e,t,n){var i=n(23).f,o=n(21),r=n(7)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,r)&&i(e,r,{configurable:!0,value:t})}},function(e,t,n){var i=n(40)("keys"),o=n(43);e.exports=function(e){return i[e]||(i[e]=o(e))}},function(e,t){var n=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},function(e,t,n){var i=n(122),o=n(25);e.exports=function(e){return i(o(e))}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(3),r=i(o),a=n(5),s=(0,a.keyMirror)("UN_IMPLEMENTATION","NO_COMPONENT_NAME"),l={UN_IMPLEMENTATION:"Should implement a method: ",NO_COMPONENT_NAME:"Should set a component name"},c={UN_IMPLEMENTATION:function(e){return l.UN_IMPLEMENTATION+e},NO_COMPONENT_NAME:function(){return l.NO_COMPONENT_NAME}};e.exports={types:r.default.extend({},s),create:function(e){e=e.toLowerCase();for(var t=c[e],n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.apply(void 0,i)}}},function(e,t,n){var i=n(19),o=n(7)("toStringTag"),r="Arguments"==i(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),o))?n:r?i(t):"Object"==(s=i(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 i=n(9),o=n(16),r=n(20),a=n(12),s="prototype",l=function(e,t,n){var c,u,d,h=e&l.F,f=e&l.G,p=e&l.S,g=e&l.P,v=e&l.B,m=e&l.W,b=f?o:o[t]||(o[t]={}),y=b[s],_=f?i:p?i[t]:(i[t]||{})[s];f&&(n=t);for(c in n)u=!h&&_&&void 0!==_[c],u&&c in b||(d=u?_[c]:n[c],b[c]=f&&"function"!=typeof _[c]?n[c]:v&&u?r(d,i):m&&_[c]==d?function(e){var t=function(t,n,i){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,i)}return e.apply(this,arguments)};return t[s]=e[s],t}(d):g&&"function"==typeof d?r(Function.call,d):d,g&&((b.virtual||(b.virtual={}))[c]=d,e&l.R&&y&&!y[c]&&a(y,c,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){e.exports=n(9).document&&document.documentElement},function(e,t,n){"use strict";var i=n(38),o=n(34),r=n(135),a=n(12),s=n(21),l=n(18),c=n(125),u=n(27),d=n(131),h=n(7)("iterator"),f=!([].keys&&"next"in[].keys()),p="@@iterator",g="keys",v="values",m=function(){return this};e.exports=function(e,t,n,b,y,_,k){c(n,t,b);var w,x,E,C=function(e){if(!f&&e in j)return j[e];switch(e){case g:return function(){return new n(this,e)};case v:return function(){return new n(this,e)}}return function(){return new n(this,e)}},O=t+" Iterator",S=y==v,M=!1,j=e.prototype,T=j[h]||j[p]||y&&j[y],P=T||C(y),A=y?S?C("entries"):P:void 0,I="Array"==t?j.entries||T:T;if(I&&(E=d(I.call(new e)),E!==Object.prototype&&(u(E,O,!0),i||s(E,h)||a(E,h,m))),S&&T&&T.name!==v&&(M=!0,P=function(){return T.call(this)}),i&&!k||!f&&!M&&j[h]||a(j,h,P),l[t]=P,l[O]=m,y)if(w={values:S?P:C(v),keys:_?P:C(g),entries:A},k)for(x in w)x in j||r(j,x,w[x]);else o(o.P+o.F*(f||M),t,w);return w}},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 i=n(9),o="__core-js_shared__",r=i[o]||(i[o]={});e.exports=function(e){return r[e]||(r[e]={})}},function(e,t,n){var i,o,r,a=n(20),s=n(121),l=n(36),c=n(26),u=n(9),d=u.process,h=u.setImmediate,f=u.clearImmediate,p=u.MessageChannel,g=0,v={},m="onreadystatechange",b=function(){var e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},y=function(e){b.call(e.data)};h&&f||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return v[++g]=function(){s("function"==typeof e?e:Function(e),t)},i(g),g},f=function(e){delete v[e]},"process"==n(19)(d)?i=function(e){d.nextTick(a(b,e,1))}:p?(o=new p,r=o.port2,o.port1.onmessage=y,i=a(r.postMessage,r,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(i=function(e){u.postMessage(e+"","*")},u.addEventListener("message",y,!1)):i=m in c("script")?function(e){l.appendChild(c("script"))[m]=function(){l.removeChild(this),b.call(e)}}:function(e){setTimeout(a(b,e,1),0)}),e.exports={set:h,clear:f}},function(e,t,n){var i=n(29),o=Math.min;e.exports=function(e){return e>0?o(i(e),9007199254740991):0}},function(e,t){var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),r=n(5),a=i(r),s=n(86),l=i(s);t.default={getActions:function(){return{main:this._mainAction(),shape:this._shapeAction(),crop:this._cropAction(),flip:this._flipAction(),rotate:this._rotateAction(),text:this._textAction(),mask:this._maskAction(),draw:this._drawAction(),icon:this._iconAction(),filter:this._filterAction()}},_mainAction:function(){var e=this,t=function(){"crop"===e.ui.submenu&&(e.stopDrawingMode(),e.ui.changeMenu("crop"))};return(0,o.extend)({initLoadImage:function(n,i){return e.loadImageFromURL(n,i).then(function(i){t(),e.ui.initializeImgUrl=n,e.ui.resizeEditor({imageSize:i}),e.clearUndoStack()})},undo:function(){e.isEmptyUndoStack()||(t(),e.undo())},redo:function(){e.isEmptyRedoStack()||(t(),e.redo())},reset:function(){t(),e.loadImageFromURL(e.ui.initializeImgUrl,"resetImage").then(function(n){t(),e.ui.resizeEditor({imageSize:n}),e.clearUndoStack()})},delete:function(){e.ui.changeDeleteButtonEnabled(!1),t(),e.removeActiveObject(),e.activeObjectId=null},deleteAll:function(){t(),e.clearObjects(),e.ui.changeDeleteButtonEnabled(!1),e.ui.changeDeleteAllButtonEnabled(!1)},load:function(n){a.default.isSupportFileApi()||alert("This browser does not support file-api"),e.ui.initializeImgUrl=URL.createObjectURL(n),e.loadImageFromFile(n).then(function(){t(),e.clearUndoStack(),e.ui.resizeEditor()}).catch(function(e){return Promise.reject(e)})},download:function(){var t=document.querySelector(".upper-canvas").toDataURL(),n=e.getImageName(),i=void 0,o=void 0,r=void 0;a.default.isSupportFileApi()&&window.saveAs?(i=a.default.base64ToBlob(t),o=i.type.split("/")[1],n.split(".").pop()!==o&&(n+="."+o),saveAs(i,n)):(r=window.open(),r.document.body.innerHTML="<img src='"+t+"'>")}},this._commonAction())},_iconAction:function(){var e=this,t=void 0,n=void 0,i=void 0,r=void 0,a=void 0,s=void 0,c=void 0;this.on({iconCreateResize:function(t){var n=t.moveOriginPointer,o=(n.x-i)/a,l=(n.y-r)/s;e.setObjectPropertiesQuietly(c,{scaleX:Math.abs(2*o),scaleY:Math.abs(2*l)})},iconCreateEnd:function(){e.ui.icon.clearIconType(),e.changeSelectableAll(!0)}});var u=function(o,l){i=l.x,r=l.y,e.addIcon(t,{left:l.x,top:l.y,fill:n}).then(function(e){c=e.id,a=e.width,s=e.height})};return(0,o.extend)({changeColor:function(t){e.activeObjectId&&e.changeIconColor(e.activeObjectId,t)},addIcon:function(i,o){t=i,n=o,e.changeCursor("crosshair"),e.off("mousedown"),e.once("mousedown",u.bind(e))},cancelAddIcon:function(){e.off("mousedown"),e.ui.icon.clearIconType(),e.changeSelectableAll(!0),e.changeCursor("default")},registDefalutIcons:function(t,n){var i={};i[t]=n,e.registerIcons(i)},registCustomIcon:function(t,n){var i=new l.default;i.imageToSVG(t,function(t){var i=t.match(/path[^>]*d="([^"]*)"/),o=i[1],r={};r[n.name]=o,e.registerIcons(r),e.addIcon(n.name,{left:100,top:100})},l.default.tracerDefaultOption())}},this._commonAction())},_drawAction:function(){var e=this;return(0,o.extend)({setDrawMode:function(t,n){e.stopDrawingMode(),"free"===t?e.startDrawingMode("FREE_DRAWING",n):e.startDrawingMode("LINE_DRAWING",n)},setColor:function(t){e.setBrush({color:t})}},this._commonAction())},_maskAction:function(){var e=this;return(0,o.extend)({loadImageFromURL:function(t,n){return e.loadImageFromURL(e.toDataURL(),"FilterImage").then(function(){e.addImageObject(t).then(function(){URL.revokeObjectURL(n)})})},applyFilter:function(){e.applyFilter("mask",{maskObjId:e.activeObjectId})}},this._commonAction())},_textAction:function(){var e=this;return(0,o.extend)({changeTextStyle:function(t){e.activeObjectId&&e.changeTextStyle(e.activeObjectId,t)}},this._commonAction())},_rotateAction:function(){var e=this;return(0,o.extend)({rotate:function(t){e.rotate(t),e.ui.resizeEditor()},setAngle:function(t){e.setAngle(t),e.ui.resizeEditor()}},this._commonAction())},_shapeAction:function(){var e=this;return(0,o.extend)({changeShape:function(t){e.activeObjectId&&e.changeShape(e.activeObjectId,t)},setDrawingShape:function(t){e.setDrawingShape(t)}},this._commonAction())},_cropAction:function(){var e=this;return(0,o.extend)({crop:function(){var t=e.getCropzoneRect();t&&e.crop(t).then(function(){e.stopDrawingMode(),e.ui.resizeEditor(),e.ui.changeMenu("crop")}).catch(function(e){return Promise.reject(e)})},cancel:function(){e.stopDrawingMode(),e.ui.changeMenu("crop")}},this._commonAction())},_flipAction:function(){var e=this;return(0,o.extend)({flip:function(t){return e[t]()}},this._commonAction())},_filterAction:function(){var e=this;return(0,o.extend)({applyFilter:function(t,n,i){t?e.applyFilter(n,i):e.hasFilter(n)&&e.removeFilter(n)}},this._commonAction())},setReAction:function(){var e=this;this.on({undoStackChanged:function(t){t?(e.ui.changeUndoButtonStatus(!0),e.ui.changeResetButtonStatus(!0)):(e.ui.changeUndoButtonStatus(!1),e.ui.changeResetButtonStatus(!1)),e.ui.resizeEditor()},redoStackChanged:function(t){t?e.ui.changeRedoButtonStatus(!0):e.ui.changeRedoButtonStatus(!1),e.ui.resizeEditor()},objectActivated:function(t){e.activeObjectId=t.id,e.ui.changeDeleteButtonEnabled(!0),e.ui.changeDeleteAllButtonEnabled(!0),"cropzone"===t.type?e.ui.crop.changeApplyButtonStatus(!0):["rect","circle","triangle"].indexOf(t.type)>-1?(e.stopDrawingMode(),"shape"!==e.ui.submenu&&e.ui.changeMenu("shape",!1,!1),e.ui.shape.setShapeStatus({strokeColor:t.stroke,strokeWidth:t.strokeWidth,fillColor:t.fill}),e.ui.shape.setMaxStrokeValue(Math.min(t.width,t.height))):"path"===t.type||"line"===t.type?"draw"!==e.ui.submenu&&(e.ui.changeMenu("draw",!1,!1),e.ui.draw.changeStandbyMode()):["i-text","text"].indexOf(t.type)>-1?"text"!==e.ui.submenu&&e.ui.changeMenu("text",!1,!1):"icon"===t.type&&(e.stopDrawingMode(),"icon"!==e.ui.submenu&&e.ui.changeMenu("icon",!1,!1),e.ui.icon.setIconPickerColor(t.fill))},addText:function(t){e.addText("Double Click",{position:t.originPosition,styles:{fill:e.ui.text.textColor,fontSize:a.default.toInteger(e.ui.text.fontSize)}}).then(function(){e.changeCursor("default")})},addObjectAfter:function(t){["rect","circle","triangle"].indexOf(t.type)>-1&&(e.ui.shape.setMaxStrokeValue(Math.min(t.width,t.height)),e.ui.shape.changeStandbyMode())},objectScaled:function(t){if(["i-text","text"].indexOf(t.type)>-1)e.ui.text.fontSize=a.default.toInteger(t.fontSize);else if(["rect","circle","triangle"].indexOf(t.type)>=0){var n=t.width,i=t.height,o=e.ui.shape.getStrokeValue();n<o&&e.ui.shape.setStrokeValue(n),i<o&&e.ui.shape.setStrokeValue(i)}},selectionCleared:function(){e.activeObjectId=null,"text"===e.ui.submenu?e.changeCursor("text"):"draw"!==e.ui.submenu&&"crop"!==e.ui.submenu&&e.stopDrawingMode()}})},_commonAction:function(){var e=this;return{modeChange:function(t){switch(t){case"text":e._changeActivateMode("TEXT");break;case"crop":e.startDrawingMode("CROPPER");break;case"shape":e._changeActivateMode("SHAPE"),e.setDrawingShape(e.ui.shape.type,e.ui.shape.options)}},deactivateAll:this.deactivateAll.bind(this),changeSelectableAll:this.changeSelectableAll.bind(this),discardSelection:this.discardSelection.bind(this),stopDrawingMode:this.stopDrawingMode.bind(this)}},mixin:function(e){(0,o.extend)(e.prototype,this)}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.componentNames,d=c.default.commandNames,h=u.ICON,f={name:d.ADD_ICON,execute:function(e,t,n){var i=this,o=e.getComponent(h);return o.add(t,n).then(function(t){return i.undoData.object=e.getObject(t.id),t})},undo:function(e){return e.remove(this.undoData.object),s.default.resolve()}};r.default.register(f),e.exports=f},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.commandNames,d={name:u.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()}};r.default.register(d),e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.commandNames,d=c.default.rejectMessages,h={
name:u.ADD_OBJECT,execute:function(e,t){return new s.default(function(n,i){e.contains(t)?i(d.addedObject):(e.add(t),n(t))})},undo:function(e,t){return new s.default(function(n,i){e.contains(t)?(e.remove(t),n(t)):i(d.noObject)})}};r.default.register(h),e.exports=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.componentNames,d=c.default.commandNames,h=u.SHAPE,f={name:d.ADD_SHAPE,execute:function(e,t,n){var i=this,o=e.getComponent(h);return o.add(t,n).then(function(t){return i.undoData.object=e.getObject(t.id),t})},undo:function(e){return e.remove(this.undoData.object),s.default.resolve()}};r.default.register(f),e.exports=f},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.componentNames,d=c.default.commandNames,h=u.TEXT,f={name:d.ADD_TEXT,execute:function(e,t,n){var i=this,o=e.getComponent(h);return o.add(t,n).then(function(t){return i.undoData.object=e.getObject(t.id),t})},undo:function(e){return e.remove(this.undoData.object),s.default.resolve()}};r.default.register(f),e.exports=f},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(1),s=i(a),l=s.default.componentNames,c=s.default.rejectMessages,u=s.default.commandNames,d=l.FILTER,h={name:u.APPLY_FILTER,execute:function(e,t,n){var i=e.getComponent(d);if("mask"===t){var o=e.getObject(n.maskObjId);if(!o||!o.isType("image"))return Promise.reject(c.invalidParameters);n={mask:o}}return"mask"===t?(this.undoData.object=n.mask,e.remove(n.mask)):this.undoData.options=i.getOptions(t),i.add(t,n)},undo:function(e,t){var n=e.getComponent(d);if("mask"===t){var i=this.undoData.object;return e.add(i),e.setActiveObject(i),n.remove(t)}return this.undoData.options?n.add(t,this.undoData.options):n.remove(t)}};r.default.register(h),e.exports=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.componentNames,d=c.default.rejectMessages,h=c.default.commandNames,f=u.ICON,p={name:h.CHANGE_ICON_COLOR,execute:function(e,t,n){var i=this;return new s.default(function(o,r){var a=e.getComponent(f),s=e.getObject(t);s||r(d.noObject),i.undoData.object=s,i.undoData.color=a.getColor(s),a.setColor(n,s),o()})},undo:function(e){var t=e.getComponent(f),n=this.undoData.object,i=n.object,o=n.color;return t.setColor(o,i),s.default.resolve()}};r.default.register(p),e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(3),r=i(o),a=n(4),s=i(a),l=n(2),c=i(l),u=n(1),d=i(u),h=d.default.componentNames,f=d.default.rejectMessages,p=d.default.commandNames,g=h.SHAPE,v={name:p.CHANGE_SHAPE,execute:function(e,t,n){var i=this,o=e.getComponent(g),a=e.getObject(t);return a?(this.undoData.object=a,this.undoData.options={},r.default.forEachOwnProperties(n,function(e,t){i.undoData.options[t]=a[t]}),o.change(a,n)):c.default.reject(f.noObject)},undo:function(e){var t=e.getComponent(g),n=this.undoData,i=n.object,o=n.options;return t.change(i,o)}};s.default.register(v),e.exports=v},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.componentNames,d=c.default.rejectMessages,h=c.default.commandNames,f=u.TEXT,p={name:h.CHANGE_TEXT,execute:function(e,t,n){var i=e.getComponent(f),o=e.getObject(t);return o?(this.undoData.object=o,this.undoData.text=i.getText(o),i.change(o,n)):s.default.reject(d.noObject)},undo:function(e){var t=e.getComponent(f),n=this.undoData,i=n.object,o=n.text;return t.change(i,o)}};r.default.register(p),e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(3),r=i(o),a=n(4),s=i(a),l=n(2),c=i(l),u=n(1),d=i(u),h=d.default.componentNames,f=d.default.rejectMessages,p=d.default.commandNames,g=h.TEXT,v={name:p.CHANGE_TEXT_STYLE,execute:function(e,t,n){var i=this,o=e.getComponent(g),a=e.getObject(t);return a?(this.undoData.object=a,this.undoData.styles={},r.default.forEachOwnProperties(n,function(e,t){i.undoData.styles[t]=a[t]}),o.setStyle(a,n)):c.default.reject(f.noObject)},undo:function(e){var t=e.getComponent(g),n=this.undoData,i=n.object,o=n.styles;return t.setStyle(i,o)}};s.default.register(v),e.exports=v},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.commandNames,d={name:u.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()}};r.default.register(d),e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(1),s=i(a),l=s.default.componentNames,c=s.default.commandNames,u=l.FLIP,d={name:c.FLIP_IMAGE,execute:function(e,t){var n=e.getComponent(u);return this.undoData.setting=n.getCurrentSetting(),n[t]()},undo:function(e){var t=e.getComponent(u);return t.set(this.undoData.setting)}};r.default.register(d),e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(1),s=i(a),l=s.default.componentNames,c=s.default.commandNames,u=l.IMAGE_LOADER,d={name:c.LOAD_IMAGE,execute:function(e,t,n){var i=e.getComponent(u),o=i.getCanvasImage(),r=o?o.width:0,a=o?o.height:0;return this.undoData={name:i.getImageName(),image:o,objects:e.removeAll(!0)},i.load(t,n).then(function(e){return{oldWidth:r,oldHeight:a,newWidth:e.width,newHeight:e.height}})},undo:function(e){var t=e.getComponent(u),n=this.undoData,i=n.objects,o=n.name,r=n.image;return e.removeAll(!0),e.add(i),t.load(o,r)}};r.default.register(d),e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(1),s=i(a),l=s.default.componentNames,c=s.default.commandNames,u=l.FILTER,d={name:c.REMOVE_FILTER,execute:function(e,t){var n=e.getComponent(u);return this.undoData.options=n.getOptions(t),n.remove(t)},undo:function(e,t){var n=e.getComponent(u),i=this.undoData.options;return n.add(t,i)}};r.default.register(d),e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.commandNames,d=c.default.rejectMessages,h={name:u.REMOVE_OBJECT,execute:function(e,t){var n=this;return new s.default(function(i,o){n.undoData.objects=e.removeObjectById(t),n.undoData.objects.length?i():o(d.noObject)})},undo:function(e){return e.add(this.undoData.objects),s.default.resolve()}};r.default.register(h),e.exports=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.commandNames,d={name:u.RESIZE_CANVAS_DIMENSION,execute:function(e,t){var n=this;return new s.default(function(i){n.undoData.size={width:e.cssMaxWidth,height:e.cssMaxHeight},e.setCssMaxDimension(t),e.adjustCanvasDimension(),i()})},undo:function(e){return e.setCssMaxDimension(this.undoData.size),e.adjustCanvasDimension(),s.default.resolve()}};r.default.register(d),e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(1),s=i(a),l=s.default.componentNames,c=s.default.commandNames,u=l.ROTATION,d={name:c.ROTATE_IMAGE,execute:function(e,t,n){var i=e.getComponent(u);return this.undoData.angle=i.getCurrentAngle(),i[t](n)},undo:function(e){var t=e.getComponent(u),n=this.undoData.angle;return t.setAngle(n)}};r.default.register(d),e.exports=d},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(4),r=i(o),a=n(2),s=i(a),l=n(1),c=i(l),u=c.default.commandNames,d=c.default.rejectMessages,h={name:u.SET_OBJECT_POSITION,execute:function(e,t,n){var i=e.getObject(t);return i?(this.undoData.objectId=t,this.undoData.props=e.getObjectProperties(t,["left","top"]),e.setObjectPosition(t,n),e.renderAll(),s.default.resolve()):s.default.reject(d.noObject)},undo:function(e){var t=this.undoData,n=t.objectId,i=t.props;return e.setObjectProperties(n,i),e.renderAll(),s.default.resolve()}};r.default.register(h),e.exports=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(3),r=i(o),a=n(4),s=i(a),l=n(2),c=i(l),u=n(1),d=i(u),h=d.default.commandNames,f=d.default.rejectMessages,p={name:h.SET_OBJECT_PROPERTIES,execute:function(e,t,n){var i=this,o=e.getObject(t);return o?(this.undoData.props={},r.default.forEachOwnProperties(n,function(e,t){i.undoData.props[t]=o[t]}),e.setObjectProperties(t,n),c.default.resolve()):c.default.reject(f.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 i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(6),c=i(l),u=n(8),d=i(u),h=n(81),f=i(h),p=n(1),g=n(5),v=10,m=function(e){function t(e){o(this,t);var n=r(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 f.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},this.graphics.cropSelectionStyle),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),i=n.x,o=n.y,r=this._cropzone;Math.abs(i-this._startX)+Math.abs(o-this._startY)>v&&(r.remove(),r.set(this._calcRectDimensionFromPoint(i,o)),t.add(r))}},{key:"_calcRectDimensionFromPoint",value:function(e,t){var n=this.getCanvas(),i=n.getWidth(),o=n.getHeight(),r=this._startX,a=this._startY,s=(0,g.clamp)(e,0,r),l=(0,g.clamp)(t,0,a),c=(0,g.clamp)(e,r,i)-s,u=(0,g.clamp)(t,a,o)-l;return this._withShiftKey&&(c>u?u=c:u>c&&(c=u),r>=e&&(s=r-c),a>=t&&(l=a-u)),{left:s,top:l,width:c,height:u}}},{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 i={imageName:this.getImageName(),url:t.toDataURL(e)};return n&&t.add(this._cropzone),i}},{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}(d.default);e.exports=m},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(3),c=n(2),u=i(c),d=n(6),h=i(d),f=n(8),p=i(f),g=n(83),v=i(g),m=n(1),b=i(m),y=n(79),_=i(y),k=n(84),w=i(k),x=n(82),E=i(x),C=n(80),O=i(C),S=b.default.rejectMessages,M=h.default.Image.filters;M.Mask=v.default,M.Blur=_.default,M.Sharpen=w.default,M.Emboss=E.default,M.ColorFilter=O.default;var j=function(e){function t(e){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,b.default.componentNames.FILTER,e))}return a(t,e),s(t,[{key:"add",value:function(e,t){var n=this;return new u.default(function(i,o){var r=n._getSourceImage(),a=n.getCanvas(),s=n._getFilter(r,e);s||(s=n._createFilter(r,e,t)),s||o(S.invalidParameters),n._changeFilterValues(s,t),n._apply(r,function(){a.renderAll(),i({type:e,action:"add"})})})}},{key:"remove",value:function(e){var t=this;return new u.default(function(n,i){var o=t._getSourceImage(),r=t.getCanvas();o.filters.length||i(S.unsupportedOperation),t._removeFilter(o,e),t._apply(o,function(){r.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,l.extend)({},n.options):null}},{key:"_changeFilterValues",value:function(e,t){(0,l.forEach)(t,function(t,n){(0,l.isUndefined)(e[n])||(e[n]=t)}),(0,l.forEach)(e.options,function(n,i){(0,l.isUndefined)(t[i])||(e.options[i]=t[i])})}},{key:"_apply",value:function(e,t){e.applyFilters(t)}},{key:"_getSourceImage",value:function(){return this.getCanvasImage()}},{key:"_createFilter",value:function(e,t,n){var i=void 0,o=this._getFabricFilterType(t),r=h.default.Image.filters[o];return r&&(i=new r(n),i.options=n,e.filters.push(i)),i}},{key:"_getFilter",value:function(e,t){var n=null;if(e){var i=this._getFabricFilterType(t),o=e.filters.length,r=void 0,a=void 0;for(a=0;a<o;a+=1)if(r=e.filters[a],r.type===i){n=r;break}}return n}},{key:"_removeFilter",value:function(e,t){var n=this._getFabricFilterType(t);e.filters=(0,l.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=j},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(3),c=i(l),u=n(2),d=i(u),h=n(8),f=i(h),p=n(1),g=i(p),v=g.default.componentNames,m=g.default.rejectMessages,b=function(e){function t(e){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,v.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,i=t.flipY!==e.flipY;return n||i?(c.default.extend(t,e),this.setImageProperties(t,!0),this._invertAngle(n,i),this._flipObjects(n,i),d.default.resolve({flipX:t.flipX,flipY:t.flipY,angle:this.getCanvasImage().angle})):d.default.reject(m.flip)}},{key:"_invertAngle",value:function(e,t){var n=this.getCanvasImage(),i=n.angle;e&&(i*=-1),t&&(i*=-1),n.setAngle(parseFloat(i)).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}(f.default);e.exports=b},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(6),c=i(l),u=n(8),d=i(u),h=n(1),f=i(h),p=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,f.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}(d.default);e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(6),c=i(l),u=n(3),d=i(u),h=n(2),f=i(h),p=n(8),g=i(p),v=n(1),m=i(v),b=m.default.eventNames,y=m.default.rejectMessages,_={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"},k=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,m.default.componentNames.ICON,e));return n._oColor="#000000",n._pathMap=_,n.useDragAddIcon=e.useDragAddIcon,n}return a(t,e),s(t,[{key:"add",value:function(e,t){var n=this;return new f.default(function(i,o){var r=n.getCanvas(),a=n._pathMap[e],s=m.default.fObjectOptions.SELECTION_STYLE;a||o(y.invalidParameters);var l=n._createIcon(a);l.set(d.default.extend({type:"icon",fill:n._oColor},s,t,n.graphics.controlStyle)),n.useDragAddIcon?(r.add(l).setActiveObject(l),r.on({"mouse:move":function(e){r.selection=!1,n.fire(b.ICON_CREATE_RESIZE,{moveOriginPointer:r.getPointer(e.e)})},"mouse:up":function(e){n.fire(b.ICON_CREATE_END,{moveOriginPointer:r.getPointer(e.e)}),r.defaultCursor="default",r.off("mouse:up"),r.off("mouse:move"),r.selection=!0}})):r.add(l).setActiveObject(l),i(n.graphics.createObjectProperties(l))})}},{key:"registerPaths",value:function(e){var t=this;d.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}(g.default);e.exports=k},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(2),c=i(l),u=n(8),d=i(u),h=n(1),f=i(h),p=f.default.componentNames,g=f.default.rejectMessages,v={padding:0,crossOrigin:"Anonymous"},m=function(e){function t(e){return o(this,t),r(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,i=void 0;if(e||t)i=this._setBackgroundImage(t).then(function(t){return n.setCanvasImage(e,t),n.adjustCanvasDimension(),t});else{var o=this.getCanvas();o.backgroundImage=null,o.renderAll(),i=new c.default(function(e){n.setCanvasImage("",null),e()})}return i}},{key:"_setBackgroundImage",value:function(e){var t=this;return e?new c.default(function(n,i){var o=t.getCanvas();o.setBackgroundImage(e,function(){var e=o.backgroundImage;e.getElement()?n(e):i(g.loadingImageFailed)},v)}):c.default.reject(g.loadImage)}}]),t}(d.default);e.exports=m},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(6),c=i(l),u=n(8),d=i(u),h=n(1),f=i(h),p=f.default.eventNames,g=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,f.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),i=[n.x,n.y,n.x,n.y];this._line=new c.default.Line(i,{stroke:this._oColor.toRgba(),strokeWidth:this._width,evented:!1}),this._line.set(f.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}(d.default);e.exports=g},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(6),c=i(l),u=n(2),d=i(u),h=n(8),f=i(h),p=n(1),g=i(p),v=g.default.componentNames,m=function(e){function t(e){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,v.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(),i=n.getCenterPoint();n.setAngle(e).setCoords(),this.adjustCanvasDimension();var o=n.getCenterPoint();return this._rotateForEachObject(i,o,e-t),d.default.resolve(e)}},{key:"_rotateForEachObject",value:function(e,t,n){var i=this.getCanvas(),o={x:e.x-t.x,y:e.y-t.y};i.forEachObject(function(t){var i=t.getCenterPoint(),r=c.default.util.degreesToRadians(n),a=c.default.util.rotatePoint(i,e,r);t.set({left:a.x-o.x,top:a.y-o.y,angle:(t.angle+n)%360}),t.setCoords()}),i.renderAll()}},{key:"rotate",value:function(e){var t=this.getCurrentAngle();return this.setAngle(t+e)}}]),t}(f.default);e.exports=m},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(6),c=i(l),u=n(2),d=i(u),h=n(8),f=i(h),p=n(1),g=i(p),v=n(87),m=i(v),b=n(3),y=g.default.rejectMessages,_=g.default.eventNames,k=g.default.keyCodes,w="rect",x={strokeWidth:1,stroke:"#000000",fill:"#ffffff",width:1,height:1,rx:0,ry:0,lockSkewingX:!0,lockSkewingY:!0,lockUniScaling:!1,bringForward:!0,isRegular:!1},E=["rect","circle","triangle"],C=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,g.default.componentNames.SHAPE,e));return n._shapeObj=null,n._type=w,n._options=(0,b.extend)({},x),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,b.extend)(this._options,t))}},{key:"add",value:function(e,t){var n=this;return new d.default(function(i){var o=n.getCanvas();t=n._createOptions(t);var r=n._createInstance(e,t);n._bindEventOnShape(r),o.add(r).setActiveObject(r),i(n.graphics.createObjectProperties(r))})}},{key:"change",value:function(e,t){var n=this;return new d.default(function(i,o){(0,b.inArray)(e.get("type"),E)<0&&o(y.unsupportedType),e.set(t),n.getCanvas().renderAll(),i()})}},{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,b.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=g.default.fObjectOptions.SELECTION_STYLE;return e=(0,b.extend)({},x,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,m.default.setOrigins(t._shapeObj)},selected:function(){t._isSelected=!0,t._shapeObj=this,n.uniScaleTransform=!0,n.defaultCursor="default",m.default.setOrigins(t._shapeObj)},deselected:function(){t._isSelected=!1,t._shapeObj=null,n.defaultCursor="crosshair",n.uniScaleTransform=!1},modified:function(){var e=t._shapeObj;m.default.adjustOriginToCenter(e),m.default.setOrigins(e)},scaling:function(e){var i=n.getPointer(e.e),o=t._shapeObj;n.setCursor("crosshair"),m.default.resize(o,i,!0)}})}},{key:"_onFabricMouseDown",value:function(e){if(e.target||(this._isSelected=!1,this._shapeObj=!1),!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(),i=n.getPointer(e.e),o=this._startPoint.x,r=this._startPoint.y,a=o-i.x,s=r-i.y,l=this._shapeObj;l?(this._shapeObj.set({isRegular:this._withShiftKey}),m.default.resize(l,i),n.renderAll()):this.add(this._type,{left:o,top:r,width:a,height:s}).then(function(e){t.fire(_.ADD_OBJECT,e)})}},{key:"_onFabricMouseUp",value:function(){var e=this.getCanvas(),t=this._shapeObj;t&&m.default.adjustOriginToCenter(t),this.fire(_.ADD_OBJECT_AFTER,this.graphics.createObjectProperties(t)),e.off({"mouse:move":this._handlers.mousemove,"mouse:up":this._handlers.mouseup})}},{key:"_onKeyDown",value:function(e){e.keyCode===k.SHIFT&&(this._withShiftKey=!0,this._shapeObj&&(this._shapeObj.isRegular=!0))}},{key:"_onKeyUp",value:function(e){e.keyCode===k.SHIFT&&(this._withShiftKey=!1,this._shapeObj&&(this._shapeObj.isRegular=!1))}}]),t}(f.default);e.exports=C},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(6),c=i(l),u=n(3),d=i(u),h=n(2),f=i(h),p=n(8),g=i(p),v=n(1),m=i(v),b=n(5),y=i(b),_=m.default.eventNames,k={fill:"#000000",left:0,top:0},w={fill:"#000000",fontStyle:"normal",fontWeight:"normal",textAlign:"left",textDecoraiton:""},x=d.default.browser,E="tui-image-eidtor-textarea",C=y.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"}),O=.1,S=500,M=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,m.default.componentNames.TEXT,e));return n._defaultStyles=k,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.useItext=e.useItext,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,"text:editing":this._listeners.modify}),this.useItext?e.forEachObject(function(e){"i-text"===e.type&&e.set({left:e.left-e.width/2,top:e.top-e.height/2,originX:"left",originY:"top"})}):this._createTextarea(),this.setCanvasRatio()}},{key:"end",value:function(){var e=this.getCanvas();e.selection=!0,e.defaultCursor="default",this.useItext?e.forEachObject(function(e){"i-text"===e.type&&(""===e.text?e.remove():e.set({left:e.left+e.width/2,top:e.top+e.height/2,originX:"center",originY:"center"}))}):(e.deactivateAllWithDispatch(),this._removeTextarea()),e.off({"mouse:down":this._listeners.mousedown,"object:selected":this._listeners.select,"before:selection:cleared":this._listeners.selectClear,"object:scaling":this._listeners.scaling,"text:editing":this._listeners.modify})}},{key:"add",value:function(e,t){var n=this;return new f.default(function(i){var o=n.getCanvas(),r=null,a=m.default.fObjectOptions.SELECTION_STYLE,s=n._defaultStyles;n._setInitPos(t.position),t.styles&&(s=d.default.extend(s,t.styles)),n.useItext?(r=new c.default.IText(e,s),a=d.default.extend({},a,{originX:"left",originY:"top"})):r=new c.default.Text(e,s),r.set(a),r.on({mouseup:n._onFabricMouseUp.bind(n)}),o.add(r),o.getActiveObject()||o.setActiveObject(r),n.isPrevEditing=!0,i(n.graphics.createObjectProperties(r))})}},{key:"change",value:function(e,t){var n=this;return new f.default(function(i){e.set("text",t),n.getCanvas().renderAll(),i()})}},{key:"setStyle",value:function(e,t){var n=this;return new f.default(function(i){d.default.forEach(t,function(n,i){e[i]===n&&(t[i]=w[i]||"")},n),e.set(t),n.getCanvas().renderAll(),i()})}},{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,i=n/t;this._ratio=i}},{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=E,t.setAttribute("style",C),t.setAttribute("wrap","off"),e.appendChild(t),this._textarea=t,this._listeners=d.default.extend(this._listeners,{input:this._onInput.bind(this),keydown:this._onKeyDown.bind(this),blur:this._onBlur.bind(this),scroll:this._onScroll.bind(this)}),x.msie&&9===x.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,x.msie&&x.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,i=this._textarea.style;setTimeout(function(){n.setText(e._textarea.value),i.width=Math.ceil(n.getWidth()/t)+"px",i.height=Math.ceil(n.getHeight()/t)+"px"},0)}},{key:"_onBlur",value:function(){var e=this.getCanvasRatio(),t=this._editingObj,n=this._editingObjInfos,i=this._textarea.value,o=t.getWidth()/e-n.width/e,r=t.getHeight()/e-n.height/e;if(1===e&&(o/=2,r/=2),this._textarea.style.display="none",t.set({left:n.left+o,top:n.top+r}),i.length){this.getCanvas().add(t);var a={id:d.default.stamp(t),type:t.type,text:i};this.fire(_.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||{},i=this.getCanvas().getPointer(n);t||this.fire(_.ADD_TEXT,{originPosition:{x:i.x,y:i.y},clientPosition:{x:n.clientX||0,y:n.clientY||0}})}},{key:"_onFabricMouseUp",value:function(e){var t=(new Date).getTime();this._isDoubleClick(t)&&(this.useItext||this._changeToEditingMode(e.target),this.fire(_.TEXT_EDITING)),this._lastClickTime=t}},{key:"_isDoubleClick",value:function(e){return e-this._lastClickTime<S}},{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()+O,n["transform-origin"]="left top",this._textarea.focus()}}]),t}(g.default);e.exports=M},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(13),c=i(l),u=n(1),d=i(u),h=d.default.drawingModes,f=d.default.componentNames,p=function(e){function t(){return o(this,t),r(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(f.CROPPER);t.start()}},{key:"end",value:function(e){var t=e.getComponent(f.CROPPER);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(13),c=i(l),u=n(1),d=i(u),h=d.default.drawingModes,f=d.default.componentNames,p=function(e){function t(){return o(this,t),r(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(f.FREE_DRAWING);n.start(t)}},{key:"end",value:function(e){var t=e.getComponent(f.FREE_DRAWING);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(13),c=i(l),u=n(1),d=i(u),h=d.default.drawingModes,f=d.default.componentNames,p=function(e){function t(){return o(this,t),r(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(f.LINE);n.start(t)}},{key:"end",value:function(e){var t=e.getComponent(f.LINE);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(13),c=i(l),u=n(1),d=i(u),h=d.default.drawingModes,f=d.default.componentNames,p=function(e){function t(){return o(this,t),r(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(f.SHAPE);t.start()}},{key:"end",value:function(e){var t=e.getComponent(f.SHAPE);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(13),c=i(l),u=n(1),d=i(u),h=d.default.drawingModes,f=d.default.componentNames,p=function(e){function t(){return o(this,t),r(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(f.TEXT);t.start()}},{key:"end",value:function(e){var t=e.getComponent(f.TEXT);t.end()}}]),t}(c.default);e.exports=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(6),r=i(o),a=r.default.util.createClass(r.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 i(e){return e&&e.__esModule?e:{default:e}}var o=n(6),r=i(o),a=r.default.util.createClass(r.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),i=n.data,o=this.threshold,a=r.default.Color.sourceFromHex(this.color),s=void 0,l=void 0;for(this.x&&this.y&&(a=this._getColor(n,this.x,this.y)),s=0,l=i.length;s<l;s+=4)this._isOutsideThreshold(i[s],a[0],o)||this._isOutsideThreshold(i[s+1],a[1],o)||this._isOutsideThreshold(i[s+2],a[2],o)||(i[s]=i[s+1]=i[s+2]=i[s+3]=0);t.putImageData(n,0,0)},_isOutsideThreshold:function(e,t,n){var i=e-t;return Math.abs(i)>n},_getColor:function(e,t,n){var i=[0,0,0,0],o=e.data,r=e.width,a=4,s=(r*n+t)*a;return i[0]=o[s],i[1]=o[s+1],i[2]=o[s+2],i[3]=o[s+3],i}});e.exports=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(3),r=i(o),a=n(6),s=i(a),l=n(5),c="tl",u="tr",d="mt",h="ml",f="mr",p="mb",g="bl",v="br",m=s.default.util.createClass(s.default.Rect,{initialize:function(e,t){e=r.default.extend(e,t),e.type="cropzone",this.callSuper("initialize",e),this.options=e,this.on({moving:this._onMoving,scaling:this._onScaling})},_render:function(e){var t=7,n=7;this.callSuper("_render",e);var i=this.flipX?-1:1,o=this.flipY?-1:1,r=i/this.scaleX,a=o/this.scaleY;e.scale(r,a),this._fillOuterRect(e,"rgba(0, 0, 0, 0.55)"),this.options.lineWidth?this._fillInnerRect(e):(this._strokeBorder(e,"rgb(0, 0, 0)",{lineDashWidth:t}),this._strokeBorder(e,"rgb(255, 255, 255)",{lineDashWidth:t,lineDashOffset:n})),e.scale(1/r,1/a)},_fillOuterRect:function(e,t){var n=this._getCoordinates(e),i=n.x,o=n.y;e.save(),e.fillStyle=t,e.beginPath(),e.moveTo(i[0]-1,o[0]-1),e.lineTo(i[3]+1,o[0]-1),e.lineTo(i[3]+1,o[3]+1),e.lineTo(i[0]-1,o[3]+1),e.lineTo(i[0]-1,o[0]-1),e.closePath(),e.moveTo(i[1],o[1]),e.lineTo(i[1],o[2]),e.lineTo(i[2],o[2]),e.lineTo(i[2],o[1]),e.lineTo(i[1],o[1]),e.closePath(),e.fill(),e.restore()},_fillInnerRect:function(e){var t=this._getCoordinates(e),n=t.x,i=t.y,o=this._caculateInnerPosition(n,(n[2]-n[1])/3),r=this._caculateInnerPosition(i,(i[2]-i[1])/3);e.save(),e.strokeStyle="rgba(255, 255, 255, 0.7)",e.lineWidth=this.options.lineWidth,e.beginPath(),e.moveTo(o[0],r[1]),e.lineTo(o[3],r[1]),e.moveTo(o[0],r[2]),e.lineTo(o[3],r[2]),e.moveTo(o[1],r[0]),e.lineTo(o[1],r[3]),e.moveTo(o[2],r[0]),e.lineTo(o[2],r[3]),e.stroke(),e.closePath(),e.restore()},_caculateInnerPosition:function(e,t){var n=[];return n[0]=e[1],n[1]=e[1]+t,n[2]=e[1]+2*t,n[3]=e[2],n},_getCoordinates:function(e){var t=this.getWidth(),n=this.getHeight(),i=t/2,o=n/2,a=this.getLeft(),s=this.getTop(),l=e.canvas;return{x:r.default.map([-(i+a),-i,i,i+(l.width-a-t)],Math.ceil),y:r.default.map([-(o+s),-o,o,o+(l.height-s-n)],Math.ceil)}},_strokeBorder:function(e,t,n){var i=n.lineDashWidth,o=n.lineDashOffset,r=n.lineWidth,a=this.getWidth()/2,s=this.getHeight()/2;e.save(),e.strokeStyle=t,e.setLineDash&&e.setLineDash([i,i]),o&&(e.lineDashOffset=o),r&&(e.lineWidth=r),e.beginPath(),e.moveTo(-a,-s),e.lineTo(a,-s),e.lineTo(a,s),e.lineTo(-a,s),e.lineTo(-a,-s),e.stroke(),e.restore()},_onMoving:function(){var e=this.getLeft(),t=this.getTop(),n=this.getWidth(),i=this.getHeight(),o=this.canvas.getWidth()-n,r=this.canvas.getHeight()-i;this.setLeft((0,l.clamp)(e,0,o)),this.setTop((0,l.clamp)(t,0,r))},_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,i=this._calcTopLeftScalingSizeFromPointer(t,n),o=this._calcBottomRightScalingSizeFromPointer(t,n);return this._makeScalingSettings(i,o)},_calcTopLeftScalingSizeFromPointer:function(e,t){var n=this.getHeight()+this.top,i=this.getWidth()+this.left,o=(0,l.clamp)(t,0,n-1),r=(0,l.clamp)(e,0,i-1);return{top:o,left:r,width:i-r,height:n-o}},_calcBottomRightScalingSizeFromPointer:function(e,t){var n=this.canvas,i=n.width,o=n.height,r=this.left,a=this.top;return{width:(0,l.clamp)(e,r+1,i)-r,height:(0,l.clamp)(t,a+1,o)-a}},_makeScalingSettings:function(e,t){var n=e.width,i=e.height,o=t.height,r=t.width,a=e.left,s=e.top,l=void 0;switch(this.__corner){case c:l=e;break;case u:l={width:r,height:i,top:s};break;case g:l={width:n,height:o,left:a};break;case v:l=t;break;case h:l={width:n,left:a};break;case d:l={height:i,top:s};break;case f:l={width:r};break;case p:l={height:o}}return l},isValid:function(){return this.left>=0&&this.top>=0&&this.width>0&&this.height>0}});e.exports=m},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(6),r=i(o),a=r.default.util.createClass(r.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 i(e){return e&&e.__esModule?e:{default:e}}var o=n(6),r=i(o),a=r.default.util.createClass(r.default.Image.filters.Mask,{applyTo:function(e){if(this.mask){var t=e.width,n=e.height,i=this._createCanvasOfMask(t,n),o=e.getContext("2d"),r=i.getContext("2d"),a=o.getImageData(0,0,t,n);this._drawMask(r,e,o),this._mapData(r,a,t,n),o.putImageData(a,0,0)}},_createCanvasOfMask:function(e,t){var n=r.default.util.createCanvasElement();return n.width=e,n.height=t,n},_drawMask:function(e){var t=this.mask,n=t.getElement(),i=t.getLeft(),o=t.getTop(),r=t.getAngle();e.save(),e.translate(i,o),e.rotate(r*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,i){for(var o=t.data,r=e.getImageData(0,0,n,i).data,a=this.channel,s=t.width*t.height*4,l=0;l<s;l+=4)o[l+3]=r[l+a]}});e.exports=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(6),r=i(o),a=r.default.util.createClass(r.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 i(e){return e&&e.__esModule?e:{default:e}}function o(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(3),s=i(a),l=n(2),c=i(l),u=n(6),d=i(u),h=n(69),f=i(h),p=n(64),g=i(p),v=n(66),m=i(v),b=n(71),y=i(b),_=n(67),k=i(_),w=n(70),x=i(w),E=n(73),C=i(E),O=n(68),S=i(O),M=n(65),j=i(M),T=n(72),P=i(T),A=n(74),I=i(A),D=n(75),R=i(D),L=n(76),N=i(L),B=n(77),F=i(B),H=n(78),z=i(H),U=n(1),V=i(U),W=n(5),X=i(W),G=V.default.componentNames,Y=V.default.eventNames,q=V.default.drawingModes,K=V.default.fObjectOptions,J=s.default.extend,Z=s.default.stamp,$=s.default.isArray,Q=s.default.isString,ee=s.default.forEachArray,te=s.default.forEachOwnProperties,ne=s.default.CustomEvents,ie=1e3,oe=800,re={cssOnly:!0},ae={backstoreOnly:!0},se=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.cssMaxWidth,r=n.cssMaxHeight,a=n.useItext,s=void 0!==a&&a,l=n.useDragAddIcon,c=void 0!==l&&l;o(this,e),this.canvasImage=null,this.cssMaxWidth=i||ie,this.cssMaxHeight=r||oe,this.useItext=s,this.useDragAddIcon=c,this.cropSelectionStyle={},this.imageName="",this._objects={},this._canvas=null,this._drawingMode=q.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),onSelectionCleared:this._onSelectionCleared.bind(this),onSelectionCreated:this._onSelectionCreated.bind(this)},this._setCanvasElement(t),this._createDrawingModeInstances(),this._createComponents(),this._attachCanvasEvents()}return r(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=[];$(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,i=this.getObject(e),o=i&&i.isType("group")&&!i.isEmpty();return o?(n.discardActiveGroup(),i.forEachObject(function(e){t.push(e),e.remove()})):n.contains(i)&&(t.push(i),i.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:"getActiveGroupObject",value:function(){return this._canvas.getActiveGroup()}},{key:"setActiveObject",value:function(e){this._canvas.setActiveObject(e)}},{key:"setCropSelectionStyle",value:function(e){this.cropSelectionStyle=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(q.NORMAL)){var e=this._getDrawingModeInstance(this.getDrawingMode());e&&e.end&&e.end(this),this._drawingMode=q.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,i=t.height,o=this._calcMaxDimension(n,i);this.setCanvasCssDimension({width:"100%",height:"100%","max-width":o.width+"px","max-height":o.height+"px"}),this.setCanvasBackstoreDimension({width:n,height:i}),this._canvas.centerObject(e)}},{key:"setCanvasCssDimension",value:function(e){this._canvas.setDimensions(e,re)}},{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 window.alert("기모찌"),new c.default(function(i){d.default.Image.fromURL(e,function(e){n(e),i(t.createObjectProperties(e))},{crossOrigin:"Anonymous"})})}},{key:"getCenter",value:function(){return this._canvas.getCenter()}},{key:"getCropzoneRect",value:function(){return this.getComponent(G.CROPPER).getCropzoneRect()}},{key:"getCroppedImageData",value:function(e){return this.getComponent(G.CROPPER).getCroppedImageData(e)}},{key:"setBrush",value:function(e){var t=this._drawingMode,n=G.FREE_DRAWING;t===q.LINE&&(n=q.LINE),this.getComponent(n).setBrush(e)}},{key:"setDrawingShape",value:function(e,t){this.getComponent(G.SHAPE).setStates(e,t)}},{key:"registerPaths",value:function(e){this.getComponent(G.ICON).registerPaths(e)}},{key:"changeCursor",value:function(e){var t=this.getCanvas();t.defaultCursor=e,t.renderAll()}},{key:"hasFilter",value:function(e){return this.getComponent(G.FILTER).hasFilter(e)}},{key:"setSelectionStyle",value:function(e){J(K.SELECTION_STYLE,e)}},{key:"setObjectProperties",value:function(e,t){var n=this.getObject(e),i=J({},t);return n.set(i),n.setCoords(),this.getCanvas().renderAll(),i}},{key:"getObjectProperties",value:function(e,t){var n=this.getObject(e),i={};return Q(t)?i[t]=n[t]:$(t)?ee(t,function(e){i[e]=n[e]}):te(t,function(e,t){i[t]=n[t]}),i}},{key:"getObjectPosition",value:function(e,t,n){var i=this.getObject(e);return i?i.getPointByOrigin(t,n):null}},{key:"setObjectPosition",value:function(e,t){var n=this.getObject(e),i=t.x,o=t.y,r=t.originX,a=t.originY;if(!n)return!1;var s=n.getPointByOrigin(r,a),l=n.getPointByOrigin("center","center"),c=l.x-s.x,u=l.y-s.y;return n.set({left:i+c,top:o+u}),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 d.default.Canvas(n,{containerClass:"tui-image-editor-canvas-container",enableRetinaScaling:!1})}},{key:"_createDrawingModeInstances",value:function(){this._register(this._drawingModeMap,new I.default),this._register(this._drawingModeMap,new R.default),this._register(this._drawingModeMap,new N.default),this._register(this._drawingModeMap,new F.default),this._register(this._drawingModeMap,new z.default)}},{key:"_createComponents",value:function(){this._register(this._componentMap,new f.default(this)),this._register(this._componentMap,new g.default(this)),this._register(this._componentMap,new m.default(this)),this._register(this._componentMap,new y.default(this)),this._register(this._componentMap,new k.default(this)),this._register(this._componentMap,new x.default(this)),this._register(this._componentMap,new C.default(this)),this._register(this._componentMap,new S.default(this)),this._register(this._componentMap,new j.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,i=this.cssMaxHeight/t,o=Math.min(e,this.cssMaxWidth),r=Math.min(t,this.cssMaxHeight);return n<1&&n<i?(o=e*n,r=t*n):i<1&&i<n&&(o=e*i,r=t*i),{width:Math.floor(o),height:Math.floor(r)}}},{key:"_callbackAfterLoadingImageObject",value:function(e){var t=this.getCanvasImage().getCenterPoint();e.set(V.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,"selection:cleared":t.onSelectionCleared,"selection:created":t.onSelectionCreated})}},{key:"_onMouseDown",value:function(e){var t=this._canvas.getPointer(e.e);this.fire(Y.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(Y.OBJECT_MOVED,n)}},{key:"_onObjectScaled",value:function(e){var t=e.target,n=this.createObjectProperties(t);this.fire(Y.OBJECT_SCALED,n)}},{key:"_onObjectSelected",value:function(e){var t=e.target,n=this.createObjectProperties(t);this.fire(Y.OBJECT_ACTIVATED,n)}},{key:"_onPathCreated",value:function(e){e.path.set(V.default.fObjectOptions.SELECTION_STYLE);var t=this.createObjectProperties(e.path);this.fire(Y.ADD_OBJECT,t)}},{key:"_onSelectionCleared",value:function(){this.fire(Y.SELECTION_CLEARED)}},{key:"_onSelectionCreated",value:function(e){this.fire(Y.SELECTION_CREATED,e.target)}},{key:"discardSelection",value:function(){this._canvas.discardActiveGroup(),this._canvas.discardActiveObject(),this._canvas.renderAll()}},{key:"changeSelectableAll",value:function(e){this._canvas.forEachObject(function(t){t.selectable=e,t.hoverCursor=e?"move":"crosshair"})}},{key:"createObjectProperties",value:function(e){var t=["left","top","width","height","fill","stroke","strokeWidth","opacity"],n={id:Z(e),type:e.type};return J(n,X.default.getProperties(e,t)),["i-text","text"].indexOf(e.type)>-1&&J(n,this._createTextProperties(e,n)),n}},{key:"_createTextProperties",value:function(e){var t=["text","fontFamily","fontSize","fontStyle","textAlign","textDecoration"],n={};return J(n,X.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,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(){n(this,e),this.versionnumber="1.2.4",this.optionpresets={default:{corsenabled:!1,ltres:1,qtres:1,pathomit:8,rightangleenhance:!0,colorsampling:2,numberofcolors:16,mincolorratio:0,colorquantcycles:3,layering:0,strokewidth:1,linefilter:!1,scale:1,roundcoords:1,viewbox:!1,desc:!1,lcpr:0,qcpr:0,blurradius:0,blurdelta:20},posterized1:{colorsampling:0,numberofcolors:2},posterized2:{numberofcolors:4,blurradius:5},curvy:{ltres:.01,linefilter:!0,rightangleenhance:!1},sharp:{qtres:.01,linefilter:!1},detailed:{pathomit:0,roundcoords:2,ltres:.5,qtres:.5,numberofcolors:64},smoothed:{blurradius:5,blurdelta:64},grayscale:{colorsampling:0,colorquantcycles:1,numberofcolors:7},fixedpalette:{colorsampling:0,colorquantcycles:1,numberofcolors:27},randomsampling1:{colorsampling:1,numberofcolors:8},randomsampling2:{colorsampling:1,numberofcolors:64},artistic1:{colorsampling:0,colorquantcycles:1,pathomit:0,blurradius:5,blurdelta:64,ltres:.01,linefilter:!0,numberofcolors:16,strokewidth:2},artistic2:{qtres:.01,colorsampling:0,colorquantcycles:1,numberofcolors:4,strokewidth:0},artistic3:{qtres:10,ltres:10,numberofcolors:8},artistic4:{qtres:10,ltres:10,numberofcolors:64,blurradius:5,blurdelta:256,strokewidth:2},posterized3:{ltres:1,qtres:1,pathomit:20,rightangleenhance:!0,colorsampling:0,numberofcolors:3,mincolorratio:0,colorquantcycles:3,blurradius:3,blurdelta:20,strokewidth:0,linefilter:!1,roundcoords:1,pal:[{r:0,g:0,b:100,a:255},{r:255,g:255,b:255,a:255}]}},this.pathscan_combined_lookup=[[[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[0,1,0,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[0,2,-1,0]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[0,1,0,-1],[0,0,1,0]],[[0,0,1,0],[-1,-1,-1,-1],[0,2,-1,0],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[0,0,1,0],[0,3,0,1],[-1,-1,-1,-1]],[[13,3,0,1],[13,2,-1,0],[7,1,0,-1],[7,0,1,0]],[[-1,-1,-1,-1],[0,1,0,-1],[-1,-1,-1,-1],[0,3,0,1]],[[0,3,0,1],[0,2,-1,0],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[0,3,0,1],[0,2,-1,0],[-1,-1,-1,-1],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[0,1,0,-1],[-1,-1,-1,-1],[0,3,0,1]],[[11,1,0,-1],[14,0,1,0],[14,3,0,1],[11,2,-1,0]],[[-1,-1,-1,-1],[0,0,1,0],[0,3,0,1],[-1,-1,-1,-1]],[[0,0,1,0],[-1,-1,-1,-1],[0,2,-1,0],[-1,-1,-1,-1]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[0,1,0,-1],[0,0,1,0]],[[0,1,0,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[0,2,-1,0]],[[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1]]],this.gks=[[.27901,.44198,.27901],[.135336,.228569,.272192,.228569,.135336],[.086776,.136394,.178908,.195843,.178908,.136394,.086776],[.063327,.093095,.122589,.144599,.152781,.144599,.122589,.093095,.063327],[.049692,.069304,.089767,.107988,.120651,.125194,.120651,.107988,.089767,.069304,.049692]],this.specpalette=[{r:0,g:0,b:0,a:255},{r:128,g:128,b:128,a:255},{r:0,g:0,b:128,a:255},{r:64,g:64,b:128,a:255},{r:192,g:192,b:192,a:255},{r:255,g:255,b:255,a:255},{r:128,g:128,b:192,a:255},{r:0,g:0,b:192,a:255},{r:128,g:0,b:0,a:255},{r:128,g:64,b:64,a:255},{r:128,g:0,b:128,a:255},{r:168,g:168,b:168,a:255},{r:192,g:128,b:128,a:255},{r:192,g:0,b:0,a:255},{r:255,g:255,b:255,a:255},{r:0,g:128,b:0,a:255}]}return i(e,null,[{key:"tracerDefaultOption",value:function(){return{pathomit:100,ltres:.1,qtres:1,scale:1,strokewidth:5,viewbox:!1,linefilter:!0,desc:!1,rightangleenhance:!1,pal:[{r:0,g:0,b:0,a:255},{r:255,g:255,b:255,a:255}]}}}]),i(e,[{key:"imageToSVG",value:function(e,t,n){var i=this;n=this.checkoptions(n),this.loadImage(e,function(e){t(i.imagedataToSVG(i.getImgdata(e),n))},n)}},{key:"imagedataToSVG",value:function(e,t){t=this.checkoptions(t);var n=this.imagedataToTracedata(e,t);return this.getsvgstring(n,t)}},{key:"imageToTracedata",value:function(e,t,n){var i=this;n=this.checkoptions(n),this.loadImage(e,function(e){t(i.imagedataToTracedata(i.getImgdata(e),n))},n)}},{key:"imagedataToTracedata",value:function(e,t){t=this.checkoptions(t);var n=this.colorquantization(e,t),i=void 0;if(0===t.layering){i={layers:[],palette:n.palette,width:n.array[0].length-2,height:n.array.length-2};for(var o=0;o<n.palette.length;o+=1){var r=this.batchtracepaths(this.internodes(this.pathscan(this.layeringstep(n,o),t.pathomit),t),t.ltres,t.qtres);i.layers.push(r)}}else{var a=this.layering(n);t.layercontainerid&&this.drawLayers(a,this.specpalette,t.scale,t.layercontainerid);var s=this.batchpathscan(a,t.pathomit),l=this.batchinternodes(s,t);i={layers:this.batchtracelayers(l,t.ltres,t.qtres),palette:n.palette,width:e.width,height:e.height}}return i}},{key:"checkoptions",value:function(e){e=e||{},"string"==typeof e&&(e=e.toLowerCase(),e=this.optionpresets[e]?this.optionpresets[e]:{});for(var t=Object.keys(this.optionpresets.default),n=0;n<t.length;n+=1)e.hasOwnProperty(t[n])||(e[t[n]]=this.optionpresets.default[t[n]]);return e}},{key:"colorquantization",value:function(e,t){var n=[],i=0,o=void 0,r=void 0,a=void 0,s=[],l=e.width*e.height,c=void 0,u=void 0,d=void 0,h=void 0,f=void 0;for(u=0;u<e.height+2;u+=1)for(n[u]=[],c=0;c<e.width+2;c+=1)n[u][c]=-1;for(f=t.pal?t.pal:0===t.colorsampling?this.generatepalette(t.numberofcolors):1===t.colorsampling?this.samplepalette(t.numberofcolors,e):this.samplepalette2(t.numberofcolors,e),t.blurradius>0&&(e=this.blur(e,t.blurradius,t.blurdelta)),h=0;h<t.colorquantcycles;h+=1){if(h>0)for(d=0;d<f.length;d+=1)s[d].n>0&&(f[d]={r:Math.floor(s[d].r/s[d].n),g:Math.floor(s[d].g/s[d].n),b:Math.floor(s[d].b/s[d].n),a:Math.floor(s[d].a/s[d].n)}),s[d].n/l<t.mincolorratio&&h<t.colorquantcycles-1&&(f[d]={r:Math.floor(255*Math.random()),g:Math.floor(255*Math.random()),b:Math.floor(255*Math.random()),a:Math.floor(255*Math.random())});for(c=0;c<f.length;c+=1)s[c]={r:0,g:0,b:0,a:0,n:0};for(u=0;u<e.height;u+=1)for(c=0;c<e.width;c+=1){for(i=4*(u*e.width+c),a=0,r=1024,d=0;d<f.length;d+=1)o=Math.abs(f[d].r-e.data[i])+Math.abs(f[d].g-e.data[i+1])+Math.abs(f[d].b-e.data[i+2])+Math.abs(f[d].a-e.data[i+3]),o<r&&(r=o,a=d);s[a].r+=e.data[i],s[a].g+=e.data[i+1],s[a].b+=e.data[i+2],s[a].a+=e.data[i+3],s[a].n+=1,n[u+1][c+1]=a}}return{array:n,palette:f}}},{key:"samplepalette",value:function(e,t){for(var n=void 0,i=[],o=0;o<e;o+=1)n=4*Math.floor(Math.random()*t.data.length/4),i.push({r:t.data[n],g:t.data[n+1],b:t.data[n+2],a:t.data[n+3]});return i}},{key:"samplepalette2",value:function(e,t){for(var n=void 0,i=[],o=Math.ceil(Math.sqrt(e)),r=Math.ceil(e/o),a=t.width/(o+1),s=t.height/(r+1),l=0;l<r;l+=1)for(var c=0;c<o&&i.length!==e;c+=1)n=4*Math.floor((l+1)*s*t.width+(c+1)*a),i.push({r:t.data[n],g:t.data[n+1],b:t.data[n+2],a:t.data[n+3]});return i}},{key:"generatepalette",value:function(e){var t=[],n=void 0,i=void 0,o=void 0;if(e<8)for(var r=Math.floor(255/(e-1)),a=0;a<e;a+=1)t.push({r:a*r,g:a*r,b:a*r,a:255});else{var s=Math.floor(Math.pow(e,1/3)),l=Math.floor(255/(s-1)),c=e-s*s*s;for(n=0;n<s;n+=1)for(i=0;i<s;i+=1)for(o=0;o<s;o+=1)t.push({r:n*l,g:i*l,b:o*l,a:255});for(n=0;n<c;n+=1)t.push({r:Math.floor(255*Math.random()),g:Math.floor(255*Math.random()),b:Math.floor(255*Math.random()),a:Math.floor(255*Math.random())})}return t}},{key:"layering",value:function(e){var t=[],n=0,i=e.array.length,o=e.array[0].length,r=void 0,a=void 0,s=void 0,l=void 0,c=void 0,u=void 0,d=void 0,h=void 0,f=void 0,p=void 0,g=void 0;for(g=0;g<e.palette.length;g+=1)for(t[g]=[],p=0;p<i;p+=1)for(t[g][p]=[],f=0;f<o;f+=1)t[g][p][f]=0;for(p=1;p<i-1;p+=1)for(f=1;f<o-1;f+=1)n=e.array[p][f],r=e.array[p-1][f-1]===n?1:0,a=e.array[p-1][f]===n?1:0,s=e.array[p-1][f+1]===n?1:0,l=e.array[p][f-1]===n?1:0,c=e.array[p][f+1]===n?1:0,u=e.array[p+1][f-1]===n?1:0,d=e.array[p+1][f]===n?1:0,h=e.array[p+1][f+1]===n?1:0,t[n][p+1][f+1]=1+2*c+4*h+8*d,l||(t[n][p+1][f]=2+4*d+8*u),a||(t[n][p][f+1]=0+2*s+4*c+8),r||(t[n][p][f]=0+2*a+4+8*l);return t}},{key:"layeringstep",value:function(e,t){var n=[],i=e.array.length,o=e.array[0].length,r=void 0,a=void 0;for(a=0;a<i;a+=1)for(n[a]=[],r=0;r<o;r+=1)n[a][r]=0;for(a=1;a<i;a+=1)for(r=1;r<o;r+=1)n[a][r]=(e.array[a-1][r-1]===t?1:0)+(e.array[a-1][r]===t?2:0)+(e.array[a][r-1]===t?8:0)+(e.array[a][r]===t?4:0);return n}},{key:"pathscan",value:function(e,t){for(var n=[],i=0,o=0,r=0,a=0,s=e[0].length,l=e.length,c=0,u=!0,d=!1,h=void 0,f=0;f<l;f+=1)for(var p=0;p<s;p+=1)if(4===e[f][p]||11===e[f][p])for(r=p,a=f,n[i]={},n[i].points=[],n[i].boundingbox=[r,a,r,a],n[i].holechildren=[],u=!1,o=0,d=11===e[f][p],c=1;!u;){if(n[i].points[o]={},n[i].points[o].x=r-1,n[i].points[o].y=a-1,n[i].points[o].t=e[a][r],r-1<n[i].boundingbox[0]&&(n[i].boundingbox[0]=r-1),r-1>n[i].boundingbox[2]&&(n[i].boundingbox[2]=r-1),a-1<n[i].boundingbox[1]&&(n[i].boundingbox[1]=a-1),a-1>n[i].boundingbox[3]&&(n[i].boundingbox[3]=a-1),h=this.pathscan_combined_lookup[e[a][r]][c],e[a][r]=h[0],c=h[1],r+=h[2],a+=h[3],r-1===n[i].points[0].x&&a-1===n[i].points[0].y)if(u=!0,n[i].points.length<t)n.pop();else{if(n[i].isholepath=!!d,d){for(var g=0,v=[-1,-1,s+1,l+1],m=0;m<i;m++)!n[m].isholepath&&this.boundingboxincludes(n[m].boundingbox,n[i].boundingbox)&&this.boundingboxincludes(v,n[m].boundingbox)&&(g=m,v=n[m].boundingbox);n[g].holechildren.push(i)}i+=1}o+=1}return n}},{key:"boundingboxincludes",value:function(e,t){return e[0]<t[0]&&e[1]<t[1]&&e[2]>t[2]&&e[3]>t[3]}},{key:"batchpathscan",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(n[i]=this.pathscan(e[i],t));return n}},{key:"internodes",value:function(e,t){var n=[],i=0,o=0,r=0,a=0,s=0,l=void 0,c=void 0;for(l=0;l<e.length;l+=1)for(n[l]={},n[l].points=[],n[l].boundingbox=e[l].boundingbox,n[l].holechildren=e[l].holechildren,n[l].isholepath=e[l].isholepath,i=e[l].points.length,c=0;c<i;c+=1)o=(c+1)%i,r=(c+2)%i,a=(c-1+i)%i,s=(c-2+i)%i,t.rightangleenhance&&this.testrightangle(e[l],s,a,c,o,r)&&(n[l].points.length>0&&(n[l].points[n[l].points.length-1].linesegment=this.getdirection(n[l].points[n[l].points.length-1].x,n[l].points[n[l].points.length-1].y,e[l].points[c].x,e[l].points[c].y)),n[l].points.push({x:e[l].points[c].x,y:e[l].points[c].y,linesegment:this.getdirection(e[l].points[c].x,e[l].points[c].y,(e[l].points[c].x+e[l].points[o].x)/2,(e[l].points[c].y+e[l].points[o].y)/2)})),n[l].points.push({x:(e[l].points[c].x+e[l].points[o].x)/2,y:(e[l].points[c].y+e[l].points[o].y)/2,linesegment:this.getdirection((e[l].points[c].x+e[l].points[o].x)/2,(e[l].points[c].y+e[l].points[o].y)/2,(e[l].points[o].x+e[l].points[r].x)/2,(e[l].points[o].y+e[l].points[r].y)/2)});return n}},{key:"testrightangle",value:function(e,t,n,i,o,r){return e.points[i].x===e.points[t].x&&e.points[i].x===e.points[n].x&&e.points[i].y===e.points[o].y&&e.points[i].y===e.points[r].y||e.points[i].y===e.points[t].y&&e.points[i].y===e.points[n].y&&e.points[i].x===e.points[o].x&&e.points[i].x===e.points[r].x}},{key:"getdirection",value:function(e,t,n,i){var o=8;return o=e<n?t<i?1:t>i?7:0:e>n?t<i?3:t>i?5:4:t<i?2:t>i?6:8}},{key:"batchinternodes",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(n[i]=this.internodes(e[i],t));return n}},{key:"tracepath",value:function(e,t,n){var i=0,o=void 0,r=void 0,a=void 0,s={};for(s.segments=[],s.boundingbox=e.boundingbox,s.holechildren=e.holechildren,s.isholepath=e.isholepath;i<e.points.length;){for(o=e.points[i].linesegment,r=-1,a=i+1;(e.points[a].linesegment===o||e.points[a].linesegment===r||r===-1)&&a<e.points.length-1;)e.points[a].linesegment!==o&&r===-1&&(r=e.points[a].linesegment),a+=1;a===e.points.length-1&&(a=0),s.segments=s.segments.concat(this.fitseq(e,t,n,i,a)),i=a>0?a:e.points.length}return s}},{key:"fitseq",value:function(e,t,n,i,o){if(o>e.points.length||o<0)return[];var r=i,a=0,s=!0,l=void 0,c=void 0,u=void 0,d=o-i;d<0&&(d+=e.points.length);for(var h=(e.points[o].x-e.points[i].x)/d,f=(e.points[o].y-e.points[i].y)/d,p=(i+1)%e.points.length,g=void 0;p!=o;)g=p-i,g<0&&(g+=e.points.length),l=e.points[i].x+h*g,c=e.points[i].y+f*g,u=(e.points[p].x-l)*(e.points[p].x-l)+(e.points[p].y-c)*(e.points[p].y-c),u>t&&(s=!1),u>a&&(r=p,a=u),p=(p+1)%e.points.length;if(s)return[{type:"L",x1:e.points[i].x,y1:e.points[i].y,x2:e.points[o].x,y2:e.points[o].y}];var v=r;s=!0,a=0;var m=(v-i)/d,b=(1-m)*(1-m),y=2*(1-m)*m,_=m*m,k=(b*e.points[i].x+_*e.points[o].x-e.points[v].x)/-y,w=(b*e.points[i].y+_*e.points[o].y-e.points[v].y)/-y;for(p=i+1;p!=o;)m=(p-i)/d,b=(1-m)*(1-m),y=2*(1-m)*m,_=m*m,l=b*e.points[i].x+y*k+_*e.points[o].x,c=b*e.points[i].y+y*w+_*e.points[o].y,u=(e.points[p].x-l)*(e.points[p].x-l)+(e.points[p].y-c)*(e.points[p].y-c),u>n&&(s=!1),u>a&&(r=p,a=u),p=(p+1)%e.points.length;if(s)return[{type:"Q",x1:e.points[i].x,y1:e.points[i].y,x2:k,y2:w,x3:e.points[o].x,y3:e.points[o].y}];var x=v;return this.fitseq(e,t,n,i,x).concat(this.fitseq(e,t,n,x,o))}},{key:"batchtracepaths",value:function(e,t,n){var i=[];for(var o in e)e.hasOwnProperty(o)&&i.push(this.tracepath(e[o],t,n));return i}},{key:"batchtracelayers",value:function(e,t,n){var i=[];for(var o in e)e.hasOwnProperty(o)&&(i[o]=this.batchtracepaths(e[o],t,n));return i}},{key:"roundtodec",value:function(e,t){return Number(e.toFixed(t))}},{key:"svgpathstring",value:function(e,t,n,i){var o=e.layers[t],r=o[n],a="",s=void 0;if(i.linefilter&&r.segments.length<3)return a;if(a="<path "+(i.desc?'desc="l '+t+" p "+n+'" ':"")+this.tosvgcolorstr(e.palette[t],i)+'d="',i.roundcoords===-1){for(a+="M "+r.segments[0].x1*i.scale+" "+r.segments[0].y1*i.scale+" ",s=0;s<r.segments.length;s++)a+=r.segments[s].type+" "+r.segments[s].x2*i.scale+" "+r.segments[s].y2*i.scale+" ",r.segments[s].hasOwnProperty("x3")&&(a+=r.segments[s].x3*i.scale+" "+r.segments[s].y3*i.scale+" ");a+="Z "}else{for(a+="M "+this.roundtodec(r.segments[0].x1*i.scale,i.roundcoords)+" "+this.roundtodec(r.segments[0].y1*i.scale,i.roundcoords)+" ",s=0;s<r.segments.length;s++)a+=r.segments[s].type+" "+this.roundtodec(r.segments[s].x2*i.scale,i.roundcoords)+" "+this.roundtodec(r.segments[s].y2*i.scale,i.roundcoords)+" ",r.segments[s].hasOwnProperty("x3")&&(a+=this.roundtodec(r.segments[s].x3*i.scale,i.roundcoords)+" "+this.roundtodec(r.segments[s].y3*i.scale,i.roundcoords)+" ");a+="Z "}for(var l=0;l<r.holechildren.length;l++){var c=o[r.holechildren[l]];if(i.roundcoords===-1)for(a+=c.segments[c.segments.length-1].hasOwnProperty("x3")?"M "+c.segments[c.segments.length-1].x3*i.scale+" "+c.segments[c.segments.length-1].y3*i.scale+" ":"M "+c.segments[c.segments.length-1].x2*i.scale+" "+c.segments[c.segments.length-1].y2*i.scale+" ",s=c.segments.length-1;s>=0;s--)a+=c.segments[s].type+" ",c.segments[s].hasOwnProperty("x3")&&(a+=c.segments[s].x2*i.scale+" "+c.segments[s].y2*i.scale+" "),a+=c.segments[s].x1*i.scale+" "+c.segments[s].y1*i.scale+" ";else for(a+=c.segments[c.segments.length-1].hasOwnProperty("x3")?"M "+this.roundtodec(c.segments[c.segments.length-1].x3*i.scale)+" "+this.roundtodec(c.segments[c.segments.length-1].y3*i.scale)+" ":"M "+this.roundtodec(c.segments[c.segments.length-1].x2*i.scale)+" "+this.roundtodec(c.segments[c.segments.length-1].y2*i.scale)+" ",s=c.segments.length-1;s>=0;s--)a+=c.segments[s].type+" ",c.segments[s].hasOwnProperty("x3")&&(a+=this.roundtodec(c.segments[s].x2*i.scale)+" "+this.roundtodec(c.segments[s].y2*i.scale)+" "),a+=this.roundtodec(c.segments[s].x1*i.scale)+" "+this.roundtodec(c.segments[s].y1*i.scale)+" ";a+="Z "}if(a+='" />',i.lcpr||i.qcpr){for(s=0;s<r.segments.length;s++)r.segments[s].hasOwnProperty("x3")&&i.qcpr&&(a+='<circle cx="'+r.segments[s].x2*i.scale+'" cy="'+r.segments[s].y2*i.scale+'" r="'+i.qcpr+'" fill="cyan" stroke-width="'+.2*i.qcpr+'" stroke="black" />',a+='<circle cx="'+r.segments[s].x3*i.scale+'" cy="'+r.segments[s].y3*i.scale+'" r="'+i.qcpr+'" fill="white" stroke-width="'+.2*i.qcpr+'" stroke="black" />',a+='<line x1="'+r.segments[s].x1*i.scale+'" y1="'+r.segments[s].y1*i.scale+'" x2="'+r.segments[s].x2*i.scale+'" y2="'+r.segments[s].y2*i.scale+'" stroke-width="'+.2*i.qcpr+'" stroke="cyan" />',a+='<line x1="'+r.segments[s].x2*i.scale+'" y1="'+r.segments[s].y2*i.scale+'" x2="'+r.segments[s].x3*i.scale+'" y2="'+r.segments[s].y3*i.scale+'" stroke-width="'+.2*i.qcpr+'" stroke="cyan" />'),!r.segments[s].hasOwnProperty("x3")&&i.lcpr&&(a+='<circle cx="'+r.segments[s].x2*i.scale+'" cy="'+r.segments[s].y2*i.scale+'" r="'+i.lcpr+'" fill="white" stroke-width="'+.2*i.lcpr+'" stroke="black" />');for(var l=0;l<r.holechildren.length;l++){var c=o[r.holechildren[l]];for(s=0;s<c.segments.length;s++)c.segments[s].hasOwnProperty("x3")&&i.qcpr&&(a+='<circle cx="'+c.segments[s].x2*i.scale+'" cy="'+c.segments[s].y2*i.scale+'" r="'+i.qcpr+'" fill="cyan" stroke-width="'+.2*i.qcpr+'" stroke="black" />',a+='<circle cx="'+c.segments[s].x3*i.scale+'" cy="'+c.segments[s].y3*i.scale+'" r="'+i.qcpr+'" fill="white" stroke-width="'+.2*i.qcpr+'" stroke="black" />',a+='<line x1="'+c.segments[s].x1*i.scale+'" y1="'+c.segments[s].y1*i.scale+'" x2="'+c.segments[s].x2*i.scale+'" y2="'+c.segments[s].y2*i.scale+'" stroke-width="'+.2*i.qcpr+'" stroke="cyan" />',a+='<line x1="'+c.segments[s].x2*i.scale+'" y1="'+c.segments[s].y2*i.scale+'" x2="'+c.segments[s].x3*i.scale+'" y2="'+c.segments[s].y3*i.scale+'" stroke-width="'+.2*i.qcpr+'" stroke="cyan" />'),!c.segments[s].hasOwnProperty("x3")&&i.lcpr&&(a+='<circle cx="'+c.segments[s].x2*i.scale+'" cy="'+c.segments[s].y2*i.scale+'" r="'+i.lcpr+'" fill="white" stroke-width="'+.2*i.lcpr+'" stroke="black" />')}}return a}},{key:"getsvgstring",value:function(e,t){t=this.checkoptions(t);for(var n=e.width*t.scale,i=e.height*t.scale,o="<svg "+(t.viewbox?'viewBox="0 0 '+n+" "+i+'" ':'width="'+n+'" height="'+i+'" ')+'version="1.1" xmlns="http://www.w3.org/2000/svg" desc="Created with imagetracer.js version '+this.versionnumber+'" >',r=0;r<e.layers.length;r+=1)for(var a=0;a<e.layers[r].length;a+=1)e.layers[r][a].isholepath||(o+=this.svgpathstring(e,r,a,t));return o+="</svg>"}},{key:"compareNumbers",value:function(e,t){return e-t}},{key:"torgbastr",value:function(e){return"rgba("+e.r+","+e.g+","+e.b+","+e.a+")"}},{key:"tosvgcolorstr",value:function(e,t){return'fill="rgb('+e.r+","+e.g+","+e.b+')" stroke="rgb('+e.r+","+e.g+","+e.b+')" stroke-width="'+t.strokewidth+'" opacity="'+e.a/255+'" '}},{key:"appendSVGString",value:function(e,t){var n=void 0;t?(n=document.getElementById(t),n||(n=document.createElement("div"),n.id=t,document.body.appendChild(n))):(n=document.createElement("div"),document.body.appendChild(n)),n.innerHTML+=e}},{key:"blur",value:function(e,t,n){var i=void 0,o=void 0,r=void 0,a=void 0,s=void 0,l=void 0,c=void 0,u=void 0,d=void 0,h=void 0,f={width:e.width,height:e.height,data:[]};if(t=Math.floor(t),t<1)return e;t>5&&(t=5),n=Math.abs(n),n>1024&&(n=1024);var p=this.gks[t-1];for(o=0;o<e.height;o++)for(i=0;i<e.width;i++){for(l=0,c=0,u=0,d=0,h=0,r=-t;r<t+1;r++)i+r>0&&i+r<e.width&&(s=4*(o*e.width+i+r),l+=e.data[s]*p[r+t],c+=e.data[s+1]*p[r+t],u+=e.data[s+2]*p[r+t],d+=e.data[s+3]*p[r+t],h+=p[r+t]);s=4*(o*e.width+i),f.data[s]=Math.floor(l/h),f.data[s+1]=Math.floor(c/h),f.data[s+2]=Math.floor(u/h),f.data[s+3]=Math.floor(d/h)}var g=new Uint8ClampedArray(f.data);for(o=0;o<e.height;o++)for(i=0;i<e.width;i++){for(l=0,c=0,u=0,d=0,h=0,r=-t;r<t+1;r++)o+r>0&&o+r<e.height&&(s=4*((o+r)*e.width+i),l+=g[s]*p[r+t],c+=g[s+1]*p[r+t],u+=g[s+2]*p[r+t],d+=g[s+3]*p[r+t],h+=p[r+t]);s=4*(o*e.width+i),f.data[s]=Math.floor(l/h),f.data[s+1]=Math.floor(c/h),f.data[s+2]=Math.floor(u/h),f.data[s+3]=Math.floor(d/h)}for(o=0;o<e.height;o++)for(i=0;i<e.width;i++)s=4*(o*e.width+i),a=Math.abs(f.data[s]-e.data[s])+Math.abs(f.data[s+1]-e.data[s+1])+Math.abs(f.data[s+2]-e.data[s+2])+Math.abs(f.data[s+3]-e.data[s+3]),a>n&&(f.data[s]=e.data[s],f.data[s+1]=e.data[s+1],f.data[s+2]=e.data[s+2],f.data[s+3]=e.data[s+3]);return f}},{key:"loadImage",value:function(e,t,n){window.alert("기모딱");var i=new Image;n&&n.corsenabled&&(i.crossOrigin="Anonymous"),i.src=e,i.onload=function(){var e=document.createElement("canvas");e.width=i.width,e.height=i.height;var n=e.getContext("2d");n.drawImage(i,0,0),t(e)}}},{key:"getImgdata",value:function(e){var t=e.getContext("2d");return t.getImageData(0,0,e.width,e.height)}},{key:"drawLayers",value:function(e,t,n,i){n=n||1;var o=void 0,r=void 0,a=void 0,s=void 0,l=void 0,c=void 0;i?(c=document.getElementById(i),c||(c=document.createElement("div"),c.id=i,document.body.appendChild(c))):(c=document.createElement("div"),document.body.appendChild(c));for(l in e)if(e.hasOwnProperty(l)){o=e[l][0].length,r=e[l].length;var u=document.createElement("canvas");u.width=o*n,u.height=r*n;var d=u.getContext("2d");for(s=0;s<r;s+=1)for(a=0;a<o;a+=1)d.fillStyle=this.torgbastr(t[e[l][s][a]%t.length]),d.fillRect(a*n,s*n,n,n);c.appendChild(u)}}}]),e}();t.default=o},function(e,t){"use strict";function n(e){var t=e.getOriginX(),n=e.getOriginY(),i=t.substring(0,1)+n.substring(0,1);e.startPoint=e.origins[i]}function i(e,t,n){var i=e.x,o=e.y,r=t.x,a=t.y,s=n*Math.PI/180,l=(r-i)*Math.cos(s)-(a-o)*Math.sin(s)+i,c=(r-i)*Math.sin(s)+(a-o)*Math.cos(s)+o;return{originX:i>l?"right":"left",originY:o>c?"bottom":"top"}}function o(e){return"center"===e.getOriginX()&&"center"===e.getOriginY()}function r(e,t){var n=t.getPointByOrigin("center","center"),o=-t.getAngle(),r=i(n,e,o),a=r.originX,s=r.originY,l=t.getPointByOrigin(a,s),c=t.getLeft()-(n.x-l.x),u=t.getTop()-(n.x-l.y);t.set({originX:a,originY:s,left:c,top:u}),t.setCoords()}function a(e,t){var n=t.startPoint,o=-t.getAngle(),r=i(n,e,o),a=r.originX,s=r.originY;t.setPositionByOrigin(n,a,s)}function s(e){var t=e.type,n=e.scaleX,i=e.scaleY,o=u[t],r=e[o.w]*n,a=e[o.h]*i;if(e.isRegular){var s=Math.max(n,i);r=e[o.w]*s,a=e[o.h]*s}var l={hasControls:!1,hasBorders:!1,scaleX:1,scaleY:1};l[o.w]=r,l[o.h]=a,e.set(l)}function l(e,t){var n=t.type,i=t.strokeWidth,o=t.startPoint,r=c[n],a=u[n],s=!("triangle"!==t.type),l={},d=Math.abs(o.x-e.x)/r,h=Math.abs(o.y-e.y)/r;d>i&&(d-=i/r),h>i&&(h-=i/r),t.isRegular&&(d=h=Math.max(d,h),s&&(h=Math.sqrt(3)/2*d)),l[a.w]=d,l[a.h]=h,t.set(l)}var c={rect:1,circle:2,triangle:1},u={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"),i=e.getPointByOrigin("right","bottom"),o=e.getPointByOrigin("left","bottom");e.origins={lt:t,rt:n,rb:i,lb:o}},resize:function(e,t,i){o(e)&&(r(t,e),n(e)),i?s(e,t):l(t,e),a(t,e)},adjustOriginToCenter:function(e){var t=e.getPointByOrigin("center","center"),n=e.getOriginX(),i=e.getOriginY(),o=e.getPointByOrigin(n,i),r=e.getLeft()+(t.x-o.x),a=e.getTop()+(t.y-o.y);e.set({hasControls:!0,hasBorders:!0,originX:"center",originY:"center",left:r,top:a}),e.setCoords()}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(3),s=i(a),l=n(2),c=i(l),u=n(90),d=i(u),h=n(92),f=i(h),p=n(44),g=i(p),v=n(4),m=i(v),b=n(85),y=i(b),_=n(1),k=i(_),w=n(5),x=k.default.eventNames,E=k.default.commandNames,C=k.default.keyCodes,O=k.default.rejectMessages,S=s.default.isUndefined,M=s.default.forEach,j=s.default.CustomEvents,T=function(){function e(t,n){o(this,e),n=s.default.extend({includeUI:!1,usageStatistics:!0},n),this.mode=null,this.activeObjectId=null,n.includeUI&&(this.ui=new f.default(t,n.includeUI,this.getActions()),n=this.ui.setUiDefaultSelectionStyle(n)),this._invoker=new d.default,this._graphics=new y.default(this.ui?this.ui.getEditorArea():t,{cssMaxWidth:n.cssMaxWidth,cssMaxHeight:n.cssMaxHeight,useItext:!!this.ui,useDragAddIcon:!!this.ui}),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),addObjectAfter:this._onAddObjectAfter.bind(this),textEditing:this._onTextEditing.bind(this),textChanged:this._onTextChanged.bind(this),iconCreateResize:this._onIconCreateResize.bind(this),iconCreateEnd:this._onIconCreateEnd.bind(this),selectionCleared:this._selectionCleared.bind(this),selectionCreated:this._selectionCreated.bind(this)},this._attachInvokerEvents(),this._attachGraphicsEvents(),this._attachDomEvents(),this._setSelectionStyle(n.selectionStyle,{applyCropSelectionStyle:n.applyCropSelectionStyle,applyGroupSelectionStyle:n.applyGroupSelectionStyle}),n.usageStatistics&&(0,w.sendHostName)(),this.ui&&(this.ui.initCanvas(),this.setReAction())}return r(e,[{key:"_setSelectionStyle",value:function(e,t){var n=t.applyCropSelectionStyle,i=t.applyGroupSelectionStyle;e&&this._graphics.setSelectionStyle(e),n&&this._graphics.setCropSelectionStyle(e),i&&this.on("selectionCreated",function(t){"group"===t.type&&t.set(e)})}},{key:"_attachInvokerEvents",value:function(){var e=x.UNDO_STACK_CHANGED,t=x.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,iconCreateResize:this._handlers.iconCreateResize,iconCreateEnd:this._handlers.iconCreateEnd,selectionCleared:this._handlers.selectionCleared,selectionCreated:this._handlers.selectionCreated,addObjectAfter:this._handlers.addObjectAfter})}},{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){(e.ctrlKey||e.metaKey)&&e.keyCode===C.Z&&this.undo().catch(function(){}),(e.ctrlKey||e.metaKey)&&e.keyCode===C.Y&&this.redo().catch(function(){}),e.keyCode!==C.BACKSPACE&&e.keyCode!==C.DEL||(e.preventDefault(),this.removeActiveObject())}},{key:"removeActiveObject",value:function(){var e=this._graphics.getActiveObject(),t=this._graphics.getActiveGroupObject();if(t){var n=t.getObjects();this.discardSelection(),this._removeObjectStream(n)}else if(e){var i=this._graphics.getObjectId(e);this.removeObject(i)}}},{key:"_removeObjectStream",value:function(e){var t=this;if(!e.length)return!0;var n=e.pop();return this.removeObject(this._graphics.getObjectId(n)).then(function(){return t._removeObjectStream(e)})}},{key:"_onMouseDown",value:function(e,t){this.fire(x.MOUSE_DOWN,e,t)}},{key:"_pushAddObjectCommand",value:function(e){var t=m.default.create(E.ADD_OBJECT,this._graphics,e);this._invoker.pushUndoStack(t)}},{key:"_onObjectActivated",value:function(e){this.fire(x.OBJECT_ACTIVATED,e)}},{key:"_onObjectMoved",value:function(e){this.fire(x.OBJECT_MOVED,e)}},{key:"_onObjectScaled",value:function(e){this.fire(x.OBJECT_SCALED,e)}},{key:"getDrawingMode",value:function(){return this._graphics.getDrawingMode()}},{key:"clearObjects",value:function(){return this.execute(E.CLEAR_OBJECTS)}},{key:"deactivateAll",value:function(){this._graphics.deactivateAll(),this._graphics.renderAll()}},{key:"discardSelection",value:function(){this._graphics.discardSelection()}},{key:"changeSelectableAll",value:function(e){this._graphics.changeSelectableAll(e)}},{key:"execute",value:function(e){for(var t,n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var r=[this._graphics].concat(i);return(t=this._invoker).execute.apply(t,[e].concat(r))}},{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 c.default.reject(O.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(E.LOAD_IMAGE,t,e):c.default.reject(O.invalidParameters)}},{key:"addImageObject",value:function(e){return e?this.execute(E.ADD_IMAGE_OBJECT,e):c.default.reject(O.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):c.default.reject(O.invalidParameters)}},{key:"getCropzoneRect",value:function(){return this._graphics.getCropzoneRect()}},{key:"_flip",value:function(e){return this.execute(E.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(E.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(E.ADD_SHAPE,e,t)}},{key:"changeShape",value:function(e,t){return this.execute(E.CHANGE_SHAPE,e,t)}},{key:"addText",value:function(e,t){
return e=e||"",t=t||{},this.execute(E.ADD_TEXT,e,t)}},{key:"changeText",value:function(e,t){return t=t||"",this.execute(E.CHANGE_TEXT,e,t)}},{key:"changeTextStyle",value:function(e,t){return this.execute(E.CHANGE_TEXT_STYLE,e,t)}},{key:"_changeActivateMode",value:function(e){"ICON"!==e&&this.getDrawingMode()!==e&&this.startDrawingMode(e)}},{key:"_onTextChanged",value:function(e){this.changeText(e.id,e.text)}},{key:"_onIconCreateResize",value:function(e){this.fire(x.ICON_CREATE_RESIZE,e)}},{key:"_onIconCreateEnd",value:function(e){this.fire(x.ICON_CREATE_END,e)}},{key:"_onTextEditing",value:function(){this.fire(x.TEXT_EDITING)}},{key:"_onAddText",value:function(e){this.fire(x.ADD_TEXT,{originPosition:e.originPosition,clientPosition:e.clientPosition})}},{key:"_onAddObject",value:function(e){var t=this._graphics.getObject(e.id);this._pushAddObjectCommand(t)}},{key:"_onAddObjectAfter",value:function(e){this.fire(x.ADD_OBJECT_AFTER,e)}},{key:"_selectionCleared",value:function(){this.fire(x.SELECTION_CLEARED)}},{key:"_selectionCreated",value:function(e){this.fire(x.SELECTION_CREATED,e)}},{key:"registerIcons",value:function(e){this._graphics.registerPaths(e)}},{key:"changeCursor",value:function(e){this._graphics.changeCursor(e)}},{key:"addIcon",value:function(e,t){return t=t||{},this._setPositions(t),this.execute(E.ADD_ICON,e,t)}},{key:"changeIconColor",value:function(e,t){return this.execute(E.CHANGE_ICON_COLOR,e,t)}},{key:"removeObject",value:function(e){return this.execute(E.REMOVE_OBJECT,e)}},{key:"hasFilter",value:function(e){return this._graphics.hasFilter(e)}},{key:"removeFilter",value:function(e){return this.execute(E.REMOVE_FILTER,e)}},{key:"applyFilter",value:function(e,t){return this.execute(E.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(E.RESIZE_CANVAS_DIMENSION,e):c.default.reject(O.invalidParameters)}},{key:"destroy",value:function(){var e=this;this.stopDrawingMode(),this._detachDomEvents(),this._graphics.destroy(),this._graphics=null,M(this,function(t,n){e[n]=null},this)}},{key:"_setPositions",value:function(e){var t=this._graphics.getCenter();S(e.left)&&(e.left=t.left),S(e.top)&&(e.top=t.top)}},{key:"setObjectProperties",value:function(e,t){return this.execute(E.SET_OBJECT_PROPERTIES,e,t)}},{key:"setObjectPropertiesQuietly",value:function(e,t){this._graphics.setObjectProperties(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(E.SET_OBJECT_POSITION,e,t)}}]),e}();g.default.mixin(T),j.mixin(T),e.exports=T},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(31),s=i(a),l=s.default.create,c=s.default.types,u=function(){function e(t,n){o(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 r(e,[{key:"execute",value:function(){throw new Error(l(c.UN_IMPLEMENTATION,"execute"))}},{key:"undo",value:function(){throw new Error(l(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=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(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 i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(3),s=i(a),l=n(2),c=i(l),u=n(4),d=i(u),h=n(1),f=i(h),p=f.default.eventNames,g=f.default.rejectMessages,v=s.default.isFunction,m=s.default.isString,b=s.default.CustomEvents,y=function(){function e(){o(this,e),this._undoStack=[],this._redoStack=[],this._isLocked=!1}return r(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(),v(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(),v(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(g.isLock);for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];var o=n[0];return m(o)&&(o=d.default.create.apply(d.default,n)),this._invokeExecution(o).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=g.undo,this._isLocked&&(n=n+" Because "+g.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=g.redo,this._isLocked&&(n=n+" Because "+g.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}();b.mixin(y),e.exports=y},function(e,t){"use strict";Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
"document"in window.self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(e){if("Element"in e){var t="classList",n="prototype",i=e.Element[n],o=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array[n].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},s=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},l=function(e,t){if(""===t)throw new s("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new s("INVALID_CHARACTER_ERR","String contains an invalid character");return a.call(e,t)},c=function(e){for(var t=r.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],i=0,o=n.length;i<o;i++)this.push(n[i]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},u=c[n]=[],d=function(){return new c(this)};if(s[n]=Error[n],u.item=function(e){return this[e]||null},u.contains=function(e){return e+="",l(this,e)!==-1},u.add=function(){var e,t=arguments,n=0,i=t.length,o=!1;do e=t[n]+"",l(this,e)===-1&&(this.push(e),o=!0);while(++n<i);o&&this._updateClassName()},u.remove=function(){var e,t,n=arguments,i=0,o=n.length,r=!1;do for(e=n[i]+"",t=l(this,e);t!==-1;)this.splice(t,1),r=!0,t=l(this,e);while(++i<o);r&&this._updateClassName()},u.toggle=function(e,t){e+="";var n=this.contains(e),i=n?t!==!0&&"remove":t!==!1&&"add";return i&&this[i](e),t===!0||t===!1?t:!n},u.toString=function(){return this.join(" ")},o.defineProperty){var h={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(i,t,h)}catch(e){void 0!==e.number&&e.number!==-2146823252||(h.enumerable=!1,o.defineProperty(i,t,h))}}else o[n].__defineGetter__&&i.__defineGetter__(t,d)}}(window.self),function(){var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var n,i=arguments.length;for(n=0;n<i;n++)e=arguments[n],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:n.call(this,e)}}e=null}()),/*!
* @copyright Copyright (c) 2017 IcoMoon.io
* @license Licensed under MIT license
* See https://github.com/Keyamoon/svgxuse
* @version 1.2.6
*/
function(){if("undefined"!=typeof window&&window.addEventListener){var e,t,n=Object.create(null),i=function(){clearTimeout(t),t=setTimeout(e,100)},o=function(){},r=function(){var e;window.addEventListener("resize",i,!1),window.addEventListener("orientationchange",i,!1),window.MutationObserver?(e=new MutationObserver(i),e.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),o=function(){try{e.disconnect(),window.removeEventListener("resize",i,!1),window.removeEventListener("orientationchange",i,!1)}catch(e){}}):(document.documentElement.addEventListener("DOMSubtreeModified",i,!1),o=function(){document.documentElement.removeEventListener("DOMSubtreeModified",i,!1),window.removeEventListener("resize",i,!1),window.removeEventListener("orientationchange",i,!1)})},a=function(e){function t(e){var t;return void 0!==e.protocol?t=e:(t=document.createElement("a"),t.href=e),t.protocol.replace(/:/g,"")+t.host}var n,i,o;return window.XMLHttpRequest&&(n=new XMLHttpRequest,i=t(location),o=t(e),n=void 0===n.withCredentials&&""!==o&&o!==i?XDomainRequest||void 0:XMLHttpRequest),n},s="http://www.w3.org/1999/xlink";e=function(){function e(){_-=1,0===_&&(o(),r())}function t(e){return function(){n[e.base]!==!0&&(e.useEl.setAttributeNS(s,"xlink:href","#"+e.hash),e.useEl.hasAttribute("href")&&e.useEl.setAttribute("href","#"+e.hash))}}function i(t){return function(){var n,i=document.body,o=document.createElement("x");t.onload=null,o.innerHTML=t.responseText,n=o.getElementsByTagName("svg")[0],n&&(n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.width=0,n.style.height=0,n.style.overflow="hidden",i.insertBefore(n,i.firstChild)),e()}}function l(t){return function(){t.onerror=null,t.ontimeout=null,e()}}var c,u,d,h,f,p,g,v,m,b,y="",_=0;for(o(),m=document.getElementsByTagName("use"),f=0;f<m.length;f+=1){try{u=m[f].getBoundingClientRect()}catch(e){u=!1}h=m[f].getAttribute("href")||m[f].getAttributeNS(s,"href")||m[f].getAttribute("xlink:href"),v=h&&h.split?h.split("#"):["",""],c=v[0],d=v[1],p=u&&0===u.left&&0===u.right&&0===u.top&&0===u.bottom,u&&0===u.width&&0===u.height&&!p?(y&&!c.length&&d&&!document.getElementById(d)&&(c=y),m[f].hasAttribute("href")&&m[f].setAttributeNS(s,"xlink:href",h),c.length&&(b=n[c],b!==!0&&setTimeout(t({useEl:m[f],base:c,hash:d}),0),void 0===b&&(g=a(c),void 0!==g&&(b=new g,n[c]=b,b.onload=i(b),b.onerror=l(b),b.ontimeout=l(b),b.open("GET",c),b.send(),_+=1)))):p?c.length&&n[c]&&setTimeout(t({useEl:m[f],base:c,hash:d}),0):void 0===n[c]?n[c]=!0:n[c].onload&&(n[c].abort(),delete n[c].onload,n[c]=!0)}m="",_+=1,e()};var l;l=function(){window.removeEventListener("load",l,!1),t=setTimeout(e,0)},"complete"!==document.readyState?window.addEventListener("load",l,!1):l()}}()},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(3),s=i(a),l=n(5),c=i(l),u=n(102),d=i(u),h=n(101),f=i(h),p=n(115),g=i(p),v=n(100),m=i(v),b=n(93),y=i(b),_=n(96),k=i(_),w=n(99),x=i(w),E=n(113),C=i(E),O=n(98),S=i(O),M=n(97),j=i(M),T=n(94),P=i(T),A=n(95),I=i(A),D={Shape:m.default,Crop:y.default,Flip:k.default,Rotate:x.default,Text:C.default,Mask:S.default,Icon:j.default,Draw:P.default,Filter:I.default},R="1300",L=function(){function e(t,n,i){o(this,e),this.options=this._initializeOption(n),this._actions=i,this.submenu=!1,this.imageSize={},this.uiSize={},this.theme=new g.default(this.options.theme),this._submenuChangeTransection=!1,this._selectedElement=null,this._mainElement=null,this._editorElementWrap=null,this._editorElement=null,this._menuElement=null,this._subMenuElement=null,this._makeUiElement(t),this._setUiSize(),this._els={undo:this._menuElement.querySelector("#tie-btn-undo"),redo:this._menuElement.querySelector("#tie-btn-redo"),reset:this._menuElement.querySelector("#tie-btn-reset"),delete:this._menuElement.querySelector("#tie-btn-delete"),deleteAll:this._menuElement.querySelector("#tie-btn-delete-all"),download:this._selectedElement.querySelectorAll(".tui-image-editor-download-btn"),load:this._selectedElement.querySelectorAll(".tui-image-editor-load-btn")},this._makeSubMenu()}return r(e,[{key:"setUiDefaultSelectionStyle",value:function(e){return s.default.extend({applyCropSelectionStyle:!0,applyGroupSelectionStyle:!0,selectionStyle:{cornerStyle:"circle",cornerSize:20,cornerColor:"#fff",cornerStrokeColor:"#000",transparentCorners:!1,lineWidth:2,borderColor:"#fff"}},e)}},{key:"resizeEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.uiSize,n=e.imageSize,i=void 0===n?this.imageSize:n;i!==this.imageSize&&(this.imageSize=i),t&&this._setUiSize(t);var o=this._getEditorDimension(),r=o.width,a=o.height,s=this._editorElement.style,l=this.options.menuBarPosition;s.height=a+"px",s.width=r+"px";var c=this._getEditorPosition(l),u=c.top,d=c.bottom,h=c.left,f=c.right;this._editorElementWrap.style.bottom=d+"px",this._editorElementWrap.style.top=u+"px",this._editorElementWrap.style.left=h+"px",this._editorElementWrap.style.width="calc(100% - "+f+"px)";var p=this._selectedElement.classList;"top"===l&&this._selectedElement.offsetWidth<R?p.add("tui-image-editor-top-optimization"):p.remove("tui-image-editor-top-optimization")}},{key:"changeUndoButtonStatus",value:function(e){e?this._els.undo.classList.add("enabled"):this._els.undo.classList.remove("enabled")}},{key:"changeRedoButtonStatus",value:function(e){e?this._els.redo.classList.add("enabled"):this._els.redo.classList.remove("enabled")}},{key:"changeResetButtonStatus",value:function(e){e?this._els.reset.classList.add("enabled"):this._els.reset.classList.remove("enabled")}},{key:"changeDeleteAllButtonEnabled",value:function(e){e?this._els.deleteAll.classList.add("enabled"):this._els.deleteAll.classList.remove("enabled")}},{key:"changeDeleteButtonEnabled",value:function(e){e?this._els.delete.classList.add("enabled"):this._els.delete.classList.remove("enabled")}},{key:"_initializeOption",value:function(e){return s.default.extend({loadImage:{path:"",name:""},menuIconPath:"",menu:["crop","flip","rotate","draw","shape","icon","text","mask","filter"],initMenu:!1,uiSize:{width:"100%",height:"100%"},menuBarPosition:"bottom"},e)}},{key:"_setUiSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.uiSize,t=this._selectedElement.style;t.width=e.width,t.height=e.height}},{key:"_makeSubMenu",value:function(){var e=this;s.default.forEach(this.options.menu,function(t){var n=D[t.replace(/^[a-z]/,function(e){return e.toUpperCase()})];e._makeMenuElement(t),e._els[t]=e._menuElement.querySelector("#tie-btn-"+t),e[t]=new n(e._subMenuElement,{iconStyle:e.theme.getStyle("submenu.icon"),menuBarPosition:e.options.menuBarPosition})})}},{key:"_makeUiElement",value:function(e){var t=void 0;window.snippet=s.default,t=e.jquery?e[0]:e.nodeType?e:document.querySelector(e);var n=c.default.getSelector(t);t.classList.add("tui-image-editor-container"),t.innerHTML=(0,f.default)({biImage:this.theme.getStyle("common.bi"),iconStyle:this.theme.getStyle("menu.icon"),loadButtonStyle:this.theme.getStyle("loadButton"),downloadButtonStyle:this.theme.getStyle("downloadButton")})+(0,d.default)({biImage:this.theme.getStyle("common.bi"),commonStyle:this.theme.getStyle("common"),headerStyle:this.theme.getStyle("header"),loadButtonStyle:this.theme.getStyle("loadButton"),downloadButtonStyle:this.theme.getStyle("downloadButton"),submenuStyle:this.theme.getStyle("submenu")}),this._selectedElement=t,this._selectedElement.classList.add(this.options.menuBarPosition),this._mainElement=n(".tui-image-editor-main"),this._editorElementWrap=n(".tui-image-editor-wrap"),this._editorElement=n(".tui-image-editor"),this._menuElement=n(".tui-image-editor-menu"),this._subMenuElement=n(".tui-image-editor-submenu")}},{key:"_makeMenuElement",value:function(e){var t=document.createElement("li"),n=this.theme.getStyle("menu.icon"),i=n.normal,o=n.active,r='\n <svg class="svg_ic-menu">\n <use xlink:href="'+i.path+"#"+i.name+"-ic-"+e+'" class="normal"/>\n <use xlink:href="'+o.path+"#"+o.name+"-ic-"+e+'" class="active"/>\n </svg>\n ';t.id="tie-btn-"+e,t.className="tui-image-editor-item",t.title=e,t.innerHTML=r,this._menuElement.appendChild(t)}},{key:"_addHelpActionEvent",value:function(e){var t=this;this._els[e].addEventListener("click",function(){t._actions.main[e]()})}},{key:"_addDownloadEvent",value:function(){var e=this;s.default.forEach(this._els.download,function(t){t.addEventListener("click",function(){e._actions.main.download()})})}},{key:"_addLoadEvent",value:function(){var e=this;s.default.forEach(this._els.load,function(t){t.addEventListener("change",function(t){e._actions.main.load(t.target.files[0])})})}},{key:"_addMenuEvent",value:function(e){var t=this;this._els[e].addEventListener("click",function(){t.changeMenu(e)})}},{key:"_addSubMenuEvent",value:function(e){this[e].addEvent(this._actions[e])}},{key:"getEditorArea",value:function(){return this._editorElement}},{key:"initCanvas",value:function(){var e=this,t=this._getLoadImage();t&&this._actions.main.initLoadImage(t.path,t.name).then(function(){e._addHelpActionEvent("undo"),e._addHelpActionEvent("redo"),e._addHelpActionEvent("reset"),e._addHelpActionEvent("delete"),e._addHelpActionEvent("deleteAll"),e._addDownloadEvent(),e._addLoadEvent(),s.default.forEach(e.options.menu,function(t){e._addMenuEvent(t),e._addSubMenuEvent(t)}),e._initMenu()});var n=document.createElement("div");n.className="tui-image-editor-grid-visual";var i='<table>\n <tr><td class="dot left-top"></td><td></td><td class="dot right-top"></td></tr>\n <tr><td></td><td></td><td></td></tr>\n <tr><td class="dot left-bottom"></td><td></td><td class="dot right-bottom"></td></tr>\n </table>';n.innerHTML=i,this._editorContainerElement=this._editorElement.querySelector(".tui-image-editor-canvas-container"),this._editorContainerElement.appendChild(n)}},{key:"_getLoadImage",value:function(){return this.options.loadImage}},{key:"changeMenu",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this._submenuChangeTransection||(this._submenuChangeTransection=!0,this._changeMenu(e,t,n),this._submenuChangeTransection=!1)}},{key:"_changeMenu",value:function(e,t,n){this.submenu&&(this._els[this.submenu].classList.remove("active"),this._mainElement.classList.remove("tui-image-editor-menu-"+this.submenu),n&&this._actions.main.discardSelection(),this._actions.main.changeSelectableAll(!0),this[this.submenu].changeStandbyMode()),this.submenu===e&&t?this.submenu=null:(this._els[e].classList.add("active"),this._mainElement.classList.add("tui-image-editor-menu-"+e),this.submenu=e,this[this.submenu].changeStartMode()),this.resizeEditor()}},{key:"_initMenu",value:function(){if(this.options.initMenu){var e=document.createEvent("MouseEvents");e.initEvent("click",!0,!1),this._els[this.options.initMenu].dispatchEvent(e),this.icon&&this.icon.registDefaultIcon()}}},{key:"_getEditorDimension",value:function(){var e=parseFloat(this._editorContainerElement.style.maxHeight),t=this.imageSize.newHeight>e?e:this.imageSize.newHeight,n=parseFloat(this._editorContainerElement.style.maxWidth),i=this.imageSize.newWidth>n?n:this.imageSize.newWidth;return{width:i,height:t}}},{key:"_getEditorPosition",value:function(e){var t=0,n=0,i=0,o=0;if(this.submenu)switch(e){case"bottom":t+=150;break;case"top":n+=150;break;case"left":i+=248,o+=248;break;case"right":o+=248}return{top:n,bottom:t,left:i,right:o}}}]),e}();t.default=L},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(10),c=i(l),u=n(104),d=i(u),h=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"crop",iconStyle:i,menuBarPosition:a,templateHtml:d.default}));return s.status="active",s._els={apply:s.selector("#tie-crop-button .apply"),cancel:s.selector("#tie-crop-button .cancel")},s}return a(t,e),s(t,[{key:"addEvent",value:function(e){var t=this;this.actions=e,this._els.apply.addEventListener("click",function(){t.actions.crop(),t._els.apply.classList.remove("active")}),this._els.cancel.addEventListener("click",function(){t.actions.cancel(),t._els.apply.classList.remove("active")})}},{key:"changeStartMode",value:function(){this.actions.modeChange("crop")}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeApplyButtonStatus",value:function(e){e?this._els.apply.classList.add("active"):this._els.apply.classList.remove("active")}}]),t}(c.default);t.default=h},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(5),c=i(l),u=n(14),d=i(u),h=n(15),f=i(h),p=n(10),g=i(p),v=n(105),m=i(v),b=n(1),y=.7,_=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"draw",iconStyle:i,menuBarPosition:a,templateHtml:m.default}));return s._els={lineSelectButton:s.selector("#tie-draw-line-select-button"),drawColorpicker:new d.default(s.selector("#tie-draw-color"),"#00a9ff",s.toggleDirection),drawRange:new f.default(s.selector("#tie-draw-range"),b.defaultDrawRangeValus),drawRangeValue:s.selector("#tie-draw-range-value")},s.type=null,s.color=s._els.drawColorpicker.color,s.width=s._els.drawRange.value,s}return a(t,e),s(t,[{key:"addEvent",value:function(e){this.actions=e,this._els.lineSelectButton.addEventListener("click",this._changeDrawType.bind(this)),this._els.drawColorpicker.on("change",this._changeDrawColor.bind(this)),this._els.drawRange.on("change",this._changeDrawRange.bind(this)),this._els.drawRangeValue.value=this._els.drawRange.value,this._els.drawRangeValue.setAttribute("readonly",!0)}},{key:"setDrawMode",value:function(){this.actions.setDrawMode(this.type,{width:this.width,color:c.default.getRgb(this.color,y)})}},{key:"changeStandbyMode",value:function(){this.type=null,this.actions.stopDrawingMode(),this.actions.changeSelectableAll(!0),this._els.lineSelectButton.classList.remove("free"),this._els.lineSelectButton.classList.remove("line")}},{key:"changeStartMode",value:function(){this.type="free",this._els.lineSelectButton.classList.add("free"),this.setDrawMode()}},{key:"_changeDrawType",value:function(e){var t=e.target.closest(".tui-image-editor-button");if(t){var n=this.getButtonType(t,["free","line"]);if(this.actions.discardSelection(),this.type===n)return void this.changeStandbyMode();this.changeStandbyMode(),this.type=n,this._els.lineSelectButton.classList.add(n),this.setDrawMode()}}},{key:"_changeDrawColor",value:function(e){this.color=e||"transparent",this.type?this.setDrawMode():this.changeStartMode()}},{key:"_changeDrawRange",value:function(e){e=c.default.toInteger(e),this._els.drawRangeValue.value=e,this.width=e,this.type?this.setDrawMode():this.changeStartMode()}}]),t}(g.default);t.default=_},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(3),c=i(l),u=n(14),d=i(u),h=n(15),f=i(h),p=n(10),g=i(p),v=n(106),m=i(v),b=n(5),y=n(1),_="130px",k=["add","diff","subtract","multiply","screen","lighten","darken"],w=["grayscale","invert","sepia","sepia2","blur","sharpen","emboss","remove-white","gradient-transparency","brightness","noise","pixelate","color-filter","tint","multiply","blend"],x=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"filter",iconStyle:i,menuBarPosition:a,templateHtml:m.default}));return s.checkedMap={},s._makeControlElement(),s}return a(t,e),s(t,[{key:"addEvent",value:function(e){var t=this,n=e.applyFilter,i=function(e){var i=t.checkedMap[e].checked,o=e;n(i,o,t._getFilterOption(o))};c.default.forEach(w,function(e){var n=t.selector("#tie-"+e),o=(0,b.toCamelCase)(e);t.checkedMap[o]=n,n.addEventListener("change",function(){return i(o)})}),this._els.removewhiteThresholdRange.on("change",function(){return i("removeWhite")}),this._els.removewhiteDistanceRange.on("change",function(){return i("removeWhite")}),this._els.gradientTransparencyRange.on("change",function(){return i("gradientTransparency")}),this._els.colorfilterThresholeRange.on("change",function(){return i("colorFilter")}),this._els.pixelateRange.on("change",function(){return i("pixelate")}),this._els.noiseRange.on("change",function(){return i("noise")}),this._els.brightnessRange.on("change",function(){return i("brightness")}),this._els.blendType.addEventListener("change",function(){return i("blend")}),this._els.filterBlendColor.on("change",function(){return i("blend")}),this._els.filterMultiplyColor.on("change",function(){return i("multiply")}),this._els.tintOpacity.on("change",function(){return i("tint")}),this._els.filterTintColor.on("change",function(){return i("tint")}),this._els.blendType.addEventListener("click",function(e){return e.stopPropagation()})}},{key:"_getFilterOption",value:function(e){var t={};switch(e){case"removeWhite":t.threshold=(0,b.toInteger)(this._els.removewhiteThresholdRange.value),t.distance=(0,b.toInteger)(this._els.removewhiteDistanceRange.value);break;case"gradientTransparency":t.threshold=(0,b.toInteger)(this._els.gradientTransparencyRange.value);break;case"colorFilter":t.color="#FFFFFF",t.threshold=this._els.colorfilterThresholeRange.value;break;case"pixelate":t.blocksize=(0,b.toInteger)(this._els.pixelateRange.value);break;case"noise":t.noise=(0,b.toInteger)(this._els.noiseRange.value);break;case"brightness":t.brightness=(0,b.toInteger)(this._els.brightnessRange.value);break;case"blend":t.color=this._els.filterBlendColor.color,t.mode=this._els.blendType.value;break;case"multiply":t.color=this._els.filterMultiplyColor.color;break;case"tint":t.color=this._els.filterTintColor.color,t.opacity=this._els.tintOpacity.value}return t}},{key:"_makeControlElement",value:function(){var e=this.selector;this._els={removewhiteThresholdRange:new f.default(e("#tie-removewhite-threshold-range"),y.defaultFilterRangeValus.removewhiteThresholdRange),removewhiteDistanceRange:new f.default(e("#tie-removewhite-distance-range"),y.defaultFilterRangeValus.removewhiteDistanceRange),gradientTransparencyRange:new f.default(e("#tie-gradient-transparency-range"),y.defaultFilterRangeValus.gradientTransparencyRange),brightnessRange:new f.default(e("#tie-brightness-range"),y.defaultFilterRangeValus.brightnessRange),noiseRange:new f.default(e("#tie-noise-range"),y.defaultFilterRangeValus.noiseRange),pixelateRange:new f.default(e("#tie-pixelate-range"),y.defaultFilterRangeValus.pixelateRange),colorfilterThresholeRange:new f.default(e("#tie-colorfilter-threshole-range"),y.defaultFilterRangeValus.colorfilterThresholeRange),filterTintColor:new d.default(e("#tie-filter-tint-color"),"#03bd9e",this.toggleDirection),filterMultiplyColor:new d.default(e("#tie-filter-multiply-color"),"#515ce6",this.toggleDirection),filterBlendColor:new d.default(e("#tie-filter-blend-color"),"#ffbb3b",this.toggleDirection)},this._els.tintOpacity=this._pickerWithRange(this._els.filterTintColor.pickerControl),this._els.blendType=this._pickerWithSelectbox(this._els.filterBlendColor.pickerControl)}},{key:"_pickerWithRange",value:function(e){var t=document.createElement("div"),n=document.createElement("label"),i=document.createElement("div");return i.id="tie-filter-tint-opacity",n.innerHTML="Opacity",t.appendChild(n),t.appendChild(i),e.appendChild(t),e.style.height=_,new f.default(i,y.defaultFilterRangeValus.tintOpacityRange)}},{key:"_pickerWithSelectbox",value:function(e){var t=document.createElement("div"),n=document.createElement("select");return t.className="tui-image-editor-selectlist-wrap",t.appendChild(n),this._makeSelectOptionList(n),e.appendChild(t),e.style.height=_,n}},{key:"_makeSelectOptionList",value:function(e){c.default.forEach(k,function(t){var n=document.createElement("option");n.setAttribute("value",t),n.innerHTML=t.replace(/^[a-z]/,function(e){return e.toUpperCase()}),e.appendChild(n)})}}]),t}(g.default);t.default=x},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(3),c=i(l),u=n(10),d=i(u),h=n(107),f=i(h),p=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"flip",iconStyle:i,menuBarPosition:a,templateHtml:f.default}));return s.flipStatus=!1,s._els={flipButton:s.selector("#tie-flip-button")},s}return a(t,e),s(t,[{key:"addEvent",value:function(e){this._actions=e,this._els.flipButton.addEventListener("click",this._changeFlip.bind(this))}},{key:"_changeFlip",value:function(e){var t=this,n=e.target.closest(".tui-image-editor-button");if(n){var i=this.getButtonType(n,["flipX","flipY","resetFlip"]);if(!this.flipStatus&&"resetFlip"===i)return;this._actions.flip(i).then(function(e){var n=t._els.flipButton.classList;t.flipStatus=!1,n.remove("resetFlip"),c.default.forEach(["flipX","flipY"],function(i){n.remove(i),e[i]&&(n.add(i),n.add("resetFlip"),t.flipStatus=!0)})})}}}]),t}(d.default);t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(3),c=i(l),u=n(14),d=i(u),h=n(10),f=i(h),p=n(108),g=i(p),v=n(5),m=n(1),b=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"icon",iconStyle:i,menuBarPosition:a,templateHtml:g.default}));return s.iconType=null,s._iconMap={},s._els={registIconButton:s.selector("#tie-icon-image-file"),addIconButton:s.selector("#tie-icon-add-button"),iconColorpicker:new d.default(s.selector("#tie-icon-color"),"#ffbb3b",s.toggleDirection)},s}return a(t,e),s(t,[{key:"addEvent",value:function(e){this.actions=e,this._els.iconColorpicker.on("change",this._changeColorHandler.bind(this)),this._els.registIconButton.addEventListener("change",this._registeIconHandler.bind(this)),this._els.addIconButton.addEventListener("click",this._addIconHandler.bind(this))}},{key:"clearIconType",value:function(){this._els.addIconButton.classList.remove(this.iconType),this.iconType=null}},{key:"registDefaultIcon",value:function(){var e=this;c.default.forEach(m.defaultIconPath,function(t,n){e.actions.registDefalutIcons(n,t)})}},{key:"setIconPickerColor",value:function(e){this._els.iconColorpicker.color=e}},{key:"changeStandbyMode",value:function(){this.clearIconType(),this.actions.cancelAddIcon()}},{key:"_changeColorHandler",value:function(e){e=e||"transparent",this.actions.changeColor(e)}},{key:"_addIconHandler",value:function(e){var t=e.target.closest(".tui-image-editor-button");if(t){var n=t.getAttribute("data-icontype"),i=this._els.iconColorpicker.color;this.actions.discardSelection(),this.actions.changeSelectableAll(!1),this._els.addIconButton.classList.remove(this.iconType),this._els.addIconButton.classList.add(n),this.iconType===n?this.changeStandbyMode():(this.actions.addIcon(n,i),this.iconType=n)}}},{key:"_registeIconHandler",value:function(e){var t=void 0;v.isSupportFileApi||alert("This browser does not support file-api");var n=e.target.files,i=n[0];i&&(t=URL.createObjectURL(i),this.actions.registCustomIcon(t,i))}}]),t}(f.default);t.default=b},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(10),c=i(l),u=n(5),d=i(u),h=n(109),f=i(h),p=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"mask",iconStyle:i,menuBarPosition:a,templateHtml:f.default}));return s._els={applyButton:s.selector("#tie-mask-apply"),maskImageButton:s.selector("#tie-mask-image-file")},s}return a(t,e),s(t,[{key:"addEvent",value:function(e){this.actions=e,this._els.maskImageButton.addEventListener("change",this._loadMaskFile.bind(this)),this._els.applyButton.addEventListener("click",this._applyMask.bind(this))}},{key:"_applyMask",value:function(){this.actions.applyFilter(),this._els.applyButton.classList.remove("active")}},{key:"_loadMaskFile",value:function(e){var t=void 0;d.default.isSupportFileApi()||alert("This browser does not support file-api");var n=e.target.files,i=n[0];i&&(t=URL.createObjectURL(i),this.actions.loadImageFromURL(t,i),this._els.applyButton.classList.add("active"))}}]),t}(c.default);t.default=p},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(15),c=i(l),u=n(10),d=i(u),h=n(110),f=i(h),p=n(5),g=n(1),v=30,m=-30,b=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"rotate",iconStyle:i,menuBarPosition:a,templateHtml:f.default}));return s._els={rotateButton:s.selector("#tie-retate-button"),rotateRange:new c.default(s.selector("#tie-rotate-range"),g.defaultRotateRangeValus),rotateRangeValue:s.selector("#tie-ratate-range-value")},s}return a(t,e),s(t,[{key:"addEvent",value:function(e){this.actions=e,this._els.rotateButton.addEventListener("click",this._changeRotateForButton.bind(this)),this._els.rotateRange.on("change",this._changeRotateForRange.bind(this)),this._els.rotateRangeValue.setAttribute("readonly",!0)}},{key:"_changeRotateForRange",value:function(e){var t=(0,p.toInteger)(e);this._els.rotateRangeValue.value=t,this.actions.setAngle(t)}},{key:"_changeRotateForButton",value:function(e){var t=e.target.closest(".tui-image-editor-button");if(t){var n=this.getButtonType(t,["counterclockwise","clockwise"]),i={clockwise:v,counterclockwise:m}[n];this.actions.rotate(i)}}}]),t}(d.default);t.default=b;
},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(14),c=i(l),u=n(15),d=i(u),h=n(10),f=i(h),p=n(111),g=i(p),v=n(5),m=n(1),b={stroke:"#ffbb3b",fill:"",strokeWidth:3},y=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"shape",iconStyle:i,menuBarPosition:a,templateHtml:g.default}));return s.type=null,s.options=b,s._els={shapeSelectButton:s.selector("#tie-shape-button"),shapeColorButton:s.selector("#tie-shape-color-button"),strokeRange:new d.default(s.selector("#tie-stroke-range"),m.defaultShapeStrokeValus),strokeRangeValue:s.selector("#tie-stroke-range-value"),fillColorpicker:new c.default(s.selector("#tie-color-fill"),"",s.toggleDirection),strokeColorpicker:new c.default(s.selector("#tie-color-stroke"),"#ffbb3b",s.toggleDirection)},s}return a(t,e),s(t,[{key:"addEvent",value:function(e){this.actions=e,this._els.shapeSelectButton.addEventListener("click",this._changeShapeHandler.bind(this)),this._els.strokeRange.on("change",this._changeStrokeRangeHandler.bind(this)),this._els.fillColorpicker.on("change",this._changeFillColorHandler.bind(this)),this._els.strokeColorpicker.on("change",this._changeStrokeColorHandler.bind(this)),this._els.strokeRangeValue.value=this._els.strokeRange.value,this._els.strokeRangeValue.setAttribute("readonly",!0)}},{key:"setShapeStatus",value:function(e){var t=e.strokeWidth,n=e.strokeColor,i=e.fillColor;this._els.strokeRange.value=t,this._els.strokeRange.trigger("change"),this._els.strokeColorpicker.color=n,this._els.fillColorpicker.color=i,this.options.stroke=n,this.options.fill=i,this.options.strokeWidth=t}},{key:"changeStartMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeStandbyMode",value:function(){this.type=null,this.actions.changeSelectableAll(!0),this._els.shapeSelectButton.classList.remove("circle"),this._els.shapeSelectButton.classList.remove("triangle"),this._els.shapeSelectButton.classList.remove("rect")}},{key:"setMaxStrokeValue",value:function(e){var t=e;t<=0&&(t=m.defaultShapeStrokeValus.max),this._els.strokeRange.max=t}},{key:"setStrokeValue",value:function(e){this._els.strokeRange.value=e,this._els.strokeRange.trigger("change")}},{key:"getStrokeValue",value:function(){return this._els.strokeRange.value}},{key:"_changeShapeHandler",value:function(e){var t=e.target.closest(".tui-image-editor-button");if(t){this.actions.stopDrawingMode(),this.actions.discardSelection();var n=this.getButtonType(t,["circle","triangle","rect"]);if(this.type===n)return void this.changeStandbyMode();this.changeStandbyMode(),this.type=n,e.currentTarget.classList.add(n),this.actions.changeSelectableAll(!1),this.actions.modeChange("shape")}}},{key:"_changeStrokeRangeHandler",value:function(e){this.options.strokeWidth=(0,v.toInteger)(e),this._els.strokeRangeValue.value=(0,v.toInteger)(e),this.actions.changeShape({strokeWidth:e}),this.actions.setDrawingShape(this.type,this.options)}},{key:"_changeFillColorHandler",value:function(e){e=e||"transparent",this.options.fill=e,this.actions.changeShape({fill:e})}},{key:"_changeStrokeColorHandler",value:function(e){e=e||"transparent",this.options.stroke=e,this.actions.changeShape({stroke:e})}}]),t}(f.default);t.default=y},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.biImage,n=e.iconStyle,i=n.normal,o=n.active,r=e.loadButtonStyle,a=e.downloadButtonStyle;return'\n <div class="tui-image-editor-controls">\n <div class="tui-image-editor-controls-logo">\n <img src="'+t+'" />\n </div>\n <ul class="tui-image-editor-menu">\n <li id="tie-btn-undo" class="tui-image-editor-item" title="undo">\n <svg class="svg_ic-menu">\n <use xlink:href="'+o.path+"#"+o.name+'-ic-undo" class="enabled"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-undo" class="normal"/>\n </svg>\n </li>\n <li id="tie-btn-redo" class="tui-image-editor-item" title="redo">\n <svg class="svg_ic-menu">\n <use xlink:href="'+o.path+"#"+o.name+'-ic-redo" class="enabled"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-redo" class="normal"/>\n </svg>\n </li>\n <li id="tie-btn-reset" class="tui-image-editor-item" title="reset">\n <svg class="svg_ic-menu">\n <use xlink:href="'+o.path+"#"+o.name+'-ic-reset" class="enabled"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-reset" class="normal"/>\n </svg>\n </li>\n <li class="tui-image-editor-item">\n <div class="tui-image-editor-icpartition"></div>\n </li>\n <li id="tie-btn-delete" class="tui-image-editor-item" title="delete">\n <svg class="svg_ic-menu">\n <use xlink:href="'+o.path+"#"+o.name+'-ic-delete" class="enabled"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-delete" class="normal"/>\n </svg>\n </li>\n <li id="tie-btn-delete-all" class="tui-image-editor-item" title="delete-all">\n <svg class="svg_ic-menu">\n <use xlink:href="'+o.path+"#"+o.name+'-ic-delete-all" class="enabled"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-delete-all" class="normal"/>\n </svg>\n </li>\n <li class="tui-image-editor-item">\n <div class="tui-image-editor-icpartition"></div>\n </li>\n </ul>\n\n <div class="tui-image-editor-controls-buttons">\n <button style="'+r+'">\n 이미지 불러오기\n <input type="file" class="tui-image-editor-load-btn" onchange="onChangeFile" />\n </button>\n <button class="tui-image-editor-download-btn" style="'+a+'">\n 다운로드\n </button>\n </div>\n </div>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.commonStyle,n=e.headerStyle,i=e.loadButtonStyle,o=e.downloadButtonStyle,r=e.submenuStyle;return'\n <div class="tui-image-editor-main-container" style="'+t+'">\n <div class="tui-image-editor-header" style="'+n+'">\n <div class="tui-image-editor-header-logo">\n <h4 style="color: white; margin: 0;">ANORMALIZER</h4>\n </div>\n <div class="tui-image-editor-header-buttons">\n <button style="'+i+'" onclick="onClickVideo()">\n 동영상 불러오기\n </button>\n <button style="'+i+'">\n 이미지 불러오기\n <input type="file" class="tui-image-editor-load-btn" onchange="onChangeFile()"/>\n </button>\n <button class="tui-image-editor-download-btn" style="'+o+'">\n 다운로드\n </button>\n </div>\n </div>\n <div class="tui-image-editor-main">\n <div class="tui-image-editor-submenu" style="'+r+'">\n </div>\n <div class="tui-image-editor-wrap">\n <div class="tui-image-editor-size-wrap">\n <div class="tui-image-editor-align-wrap">\n <div class="tui-image-editor"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.subMenuLabelActive,n=e.subMenuLabelNormal,i=e.subMenuRangeTitle,o=e.submenuPartitionVertical,r=e.submenuPartitionHorizontal,a=e.submenuCheckbox,s=e.submenuRangePointer,l=e.submenuRangeValue,c=e.submenuColorpickerTitle,u=e.submenuColorpickerButton,d=e.submenuRangeBar,h=e.submenuRangeSubbar,f=e.submenuIconSize,p=e.menuIconSize,g=e.biSize;return'\n #tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label,\n #tie-icon-add-button.icon-heart .tui-image-editor-button[data-icontype="icon-heart"] label,\n #tie-icon-add-button.icon-location .tui-image-editor-button[data-icontype="icon-location"] label,\n #tie-icon-add-button.icon-polygon .tui-image-editor-button[data-icontype="icon-polygon"] label,\n #tie-icon-add-button.icon-star .tui-image-editor-button[data-icontype="icon-star"] label,\n #tie-icon-add-button.icon-arrow-3 .tui-image-editor-button[data-icontype="icon-arrow-3"] label,\n #tie-icon-add-button.icon-arrow-2 .tui-image-editor-button[data-icontype="icon-arrow-2"] label,\n #tie-icon-add-button.icon-arrow .tui-image-editor-button[data-icontype="icon-arrow"] label,\n #tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label,\n #tie-draw-line-select-button.line .tui-image-editor-button.line label,\n #tie-draw-line-select-button.free .tui-image-editor-button.free label,\n #tie-flip-button.flipX .tui-image-editor-button.flipX label,\n #tie-flip-button.flipY .tui-image-editor-button.flipY label,\n #tie-flip-button.resetFlip .tui-image-editor-button.resetFlip label,\n #tie-crop-button .tui-image-editor-button.apply.active label,\n #tie-shape-button.rect .tui-image-editor-button.rect label,\n #tie-shape-button.circle .tui-image-editor-button.circle label,\n #tie-shape-button.triangle .tui-image-editor-button.triangle label,\n #tie-text-effect-button .tui-image-editor-button.active label,\n #tie-text-align-button.left .tui-image-editor-button.left label,\n #tie-text-align-button.center .tui-image-editor-button.center label,\n #tie-text-align-button.right .tui-image-editor-button.right label,\n #tie-mask-apply.apply.active .tui-image-editor-button.apply label,\n .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button:hover > label,\n .tui-image-editor-container .tui-image-editor-checkbox input + label {\n '+t+"\n }\n .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button > label,\n .tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label {\n "+n+"\n }\n .tui-image-editor-container .tui-image-editor-range-wrap label {\n "+i+"\n }\n .tui-image-editor-container .tui-image-editor-partition > div {\n "+o+"\n }\n .tui-image-editor-container.left .tui-image-editor-submenu .tui-image-editor-partition > div,\n .tui-image-editor-container.right .tui-image-editor-submenu .tui-image-editor-partition > div {\n "+r+"\n }\n .tui-image-editor-container .tui-image-editor-checkbox input + label:before {\n "+a+"\n }\n .tui-image-editor-container .tui-image-editor-virtual-range-pointer {\n "+s+"\n }\n .tui-image-editor-container .tui-image-editor-virtual-range-bar {\n "+d+"\n }\n .tui-image-editor-container .tui-image-editor-virtual-range-subbar {\n "+h+"\n }\n .tui-image-editor-container .tui-image-editor-range-value {\n "+l+"\n }\n .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value + label {\n "+c+"\n }\n .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value {\n "+u+"\n }\n .tui-image-editor-container .svg_ic-menu {\n "+p+"\n }\n .tui-image-editor-container .svg_ic-submenu {\n "+f+"\n }\n .tui-image-editor-container .tui-image-editor-controls-logo > img,\n .tui-image-editor-container .tui-image-editor-header-logo > img {\n "+g+"\n }\n\n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul class="tui-image-editor-submenu-item">\n <li id="tie-crop-button" class="apply">\n <div class="tui-image-editor-button apply">\n <svg class="svg_ic-menu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-apply" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-apply" class="active"/>\n </svg>\n <label>\n Apply\n </label>\n </div>\n <div class="tui-image-editor-button cancel">\n <svg class="svg_ic-menu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-cancel" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-cancel" class="active"/>\n </svg>\n <label>\n Cancel\n </label>\n </div>\n </li>\n </ul>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul class="tui-image-editor-submenu-item">\n <li id="tie-draw-line-select-button">\n <div class="tui-image-editor-button free">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-draw-free" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-draw-free" class="active"/>\n </svg>\n </div>\n <label>\n Free\n </label>\n </div>\n <div class="tui-image-editor-button line">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-draw-line" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-draw-line" class="active"/>\n </svg>\n </div>\n <label>\n Straight\n </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div id="tie-draw-color" title="Color"></div>\n </li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n <label class="range">Range</label>\n <div id="tie-draw-range"></div>\n <input id="tie-draw-range-value" class="tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return'\n <ul class="tui-image-editor-submenu-item">\n <li class="tui-image-editor-submenu-align">\n <div class="tui-image-editor-checkbox-wrap fixed-width">\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-grayscale">\n <label for="tie-grayscale">Grayscale</label>\n </div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-invert">\n <label for="tie-invert">Invert</label>\n </div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-sepia">\n <label for="tie-sepia">Sepia</label>\n </div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-sepia2">\n <label for="tie-sepia2">Sepia2</label>\n </div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-blur">\n <label for="tie-blur">Blur</label>\n </div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-sharpen">\n <label for="tie-sharpen">Sharpen</label>\n </div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-emboss">\n <label for="tie-emboss">Emboss</label>\n </div>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li class="tui-image-editor-submenu-align">\n <div>\n <div class="tui-image-editor-checkbox-wrap">\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-remove-white">\n <label for="tie-remove-white">Remove White</label>\n </div>\n </div>\n <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n <label>Threshold</label>\n <div id="tie-removewhite-threshold-range"></div>\n </div>\n <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n <label>Distance</label>\n <div id="tie-removewhite-distance-range"></div>\n </div>\n </div>\n <div>\n <div class="tui-image-editor-newline tui-image-editor-checkbox-wrap">\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-gradient-transparency">\n <label for="tie-gradient-transparency">Grayscale</label>\n </div>\n </div>\n <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n <label>Value</label>\n <div id="tie-gradient-transparency-range"></div>\n </div>\n </div>\n </li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li class="tui-image-editor-submenu-align">\n <div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-brightness">\n <label for="tie-brightness">Brightness</label>\n </div>\n <div class="tui-image-editor-range-wrap short">\n <div id="tie-brightness-range"></div>\n </div>\n </div>\n <div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-noise">\n <label for="tie-noise">Noise</label>\n </div>\n <div class="tui-image-editor-range-wrap short">\n <div id="tie-noise-range"></div>\n </div>\n </div>\n\n <div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-pixelate">\n <label for="tie-pixelate">Pixelate</label>\n </div>\n <div class="tui-image-editor-range-wrap short">\n <div id="tie-pixelate-range"></div>\n </div>\n </div>\n <div>\n <div class="tui-image-editor-newline tui-image-editor-checkbox-wrap">\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-color-filter">\n <label for="tie-color-filter">Color Filter</label>\n </div>\n </div>\n <div class="tui-image-editor-newline tui-image-editor-range-wrap short">\n <label>Threshold</label>\n <div id="tie-colorfilter-threshole-range"></div>\n </div>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div class="filter-color-item">\n <div id="tie-filter-tint-color" title="Tint"></div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-tint">\n <label for="tie-tint"></label>\n </div>\n </div>\n <div class="filter-color-item">\n <div id="tie-filter-multiply-color" title="Multiply"></div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-multiply">\n <label for="tie-multiply"></label>\n </div>\n </div>\n <div class="filter-color-item">\n <div id="tie-filter-blend-color" title="Blend"></div>\n <div class="tui-image-editor-checkbox">\n <input type="checkbox" id="tie-blend">\n <label for="tie-blend"></label>\n </div>\n </div>\n </li>\n </ul>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul id="tie-flip-button" class="tui-image-editor-submenu-item">\n <li>\n <div class="tui-image-editor-button flipX">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-flip-x" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-flip-x" class="active"/>\n </svg>\n </div>\n <label>\n Flip X\n </label>\n </div>\n <div class="tui-image-editor-button flipY">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-flip-y" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-flip-y" class="active"/>\n </svg>\n </div>\n <label>\n Flip Y\n </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div class="tui-image-editor-button resetFlip">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-flip-reset"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-flip-reset"\n class="active"/>\n </svg>\n </div>\n <label>\n Reset\n </label>\n </div>\n </li>\n </ul>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul class="tui-image-editor-submenu-item">\n <li id="tie-icon-add-button">\n <div class="tui-image-editor-button" data-icontype="icon-arrow">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-arrow"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-arrow"\n class="active"/>\n </svg>\n </div>\n <label>\n Arrow\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-arrow-2">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-arrow-2"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-arrow-2"\n class="active"/>\n </svg>\n </div>\n <label>\n Arrow-2\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-arrow-3">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-arrow-3"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-arrow-3"\n class="active"/>\n </svg>\n </div>\n <label>\n Arrow-3\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-star">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-star" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-star" class="active"/>\n </svg>\n </div>\n <label>\n Star-1\n </label>\n </div>\n <div class="tui-image-editor-button" data-icontype="icon-star-2">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-star-2"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-star-2"\n class="active"/>\n </svg>\n </div>\n <label>\n Star-2\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-polygon">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-polygon"\n class="normal"/>\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-polygon"\n class="active"/>\n </svg>\n </div>\n <label>\n Polygon\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-location">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-location"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-location"\n class="active"/>\n </svg>\n </div>\n <label>\n Location\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-heart">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-heart"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-heart"\n class="active"/>\n </svg>\n </div>\n <label>\n Heart\n </label>\n </div>\n\n <div class="tui-image-editor-button" data-icontype="icon-bubble">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-bubble"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-bubble"\n class="active"/>\n </svg>\n </div>\n <label>\n Bubble\n </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li id="tie-icon-add-button">\n <div class="tui-image-editor-button">\n <div>\n <input type="file" accept="image/*" id="tie-icon-image-file">\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-icon-load" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-icon-load" class="active"/>\n </svg>\n </div>\n <label>\n Custom icon\n </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div id="tie-icon-color" title="Color"></div>\n </li>\n </ul>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul class="tui-image-editor-submenu-item">\n <li>\n <div class="tui-image-editor-button">\n <div>\n <input type="file" accept="image/*" id="tie-mask-image-file">\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-mask-load" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-mask-load" class="active"/>\n </svg>\n </div>\n <label> Load Mask Image </label>\n </div>\n </li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li id="tie-mask-apply" class="tui-image-editor-newline apply">\n <div class="tui-image-editor-button apply">\n <svg class="svg_ic-menu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-apply" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-apply" class="active"/>\n </svg>\n <label>\n Apply\n </label>\n </div>\n </li>\n </ul>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul class="tui-image-editor-submenu-item">\n <li id="tie-retate-button">\n <div class="tui-image-editor-button clockwise">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-rotate-clockwise"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-rotate-clockwise"\n class="active"/>\n </svg>\n </div>\n <label> 30 </label>\n </div>\n <div class="tui-image-editor-button counterclockwise">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-rotate-counterclockwise"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-rotate-counterclockwise"\n class="active"/>\n </svg>\n </div>\n <label> -30 </label>\n </div>\n </li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n <label class="range">Range</label>\n <div id="tie-rotate-range"></div>\n <input id="tie-ratate-range-value" class="tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n';
}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul class="tui-image-editor-submenu-item">\n <li id="tie-shape-button">\n <div class="tui-image-editor-button rect">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-shape-rectangle"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-shape-rectangle"\n class="active"/>\n </svg>\n </div>\n <label> Rectangle </label>\n </div>\n <div class="tui-image-editor-button circle">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-shape-circle"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-shape-circle"\n class="active"/>\n </svg>\n </div>\n <label> Circle </label>\n </div>\n <div class="tui-image-editor-button triangle">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-shape-triangle"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-shape-triangle"\n class="active"/>\n </svg>\n </div>\n <label> Triangle </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li id="tie-shape-color-button">\n <div id="tie-color-fill" title="fill"></div>\n <div id="tie-color-stroke" title="stroke"></div>\n </li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n <label class="range">Stroke</label>\n <div id="tie-stroke-range"></div>\n <input id="tie-stroke-range-value" class="tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.iconStyle,n=t.normal,i=t.active;return'\n <ul class="tui-image-editor-submenu-item">\n <li id="tie-text-effect-button">\n <div class="tui-image-editor-button bold">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-text-bold" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-text-bold" class="active"/>\n </svg>\n </div>\n <label> Bold </label>\n </div>\n <div class="tui-image-editor-button italic">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-text-italic" class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-text-italic" class="active"/>\n </svg>\n </div>\n <label> Italic </label>\n </div>\n <div class="tui-image-editor-button underline">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-text-underline"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-text-underline"\n class="active"/>\n </svg>\n </div>\n <label> Underline </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li id="tie-text-align-button">\n <div class="tui-image-editor-button left">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-text-align-left"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-text-align-left"\n class="active"/>\n </svg>\n </div>\n <label> left </label>\n </div>\n <div class="tui-image-editor-button center">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-text-align-center"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-text-align-center"\n class="active"/>\n </svg>\n </div>\n <label> center </label>\n </div>\n <div class="tui-image-editor-button right">\n <div>\n <svg class="svg_ic-submenu">\n <use xlink:href="'+n.path+"#"+n.name+'-ic-text-align-right"\n class="normal"/>\n <use xlink:href="'+i.path+"#"+i.name+'-ic-text-align-right"\n class="active"/>\n </svg>\n </div>\n <label> right </label>\n </div>\n </li>\n <li class="tui-image-editor-partition">\n <div></div>\n </li>\n <li>\n <div id="tie-text-color" title="Color"></div>\n </li>\n <li class="tui-image-editor-partition only-left-right">\n <div></div>\n </li>\n <li class="tui-image-editor-newline tui-image-editor-range-wrap">\n <label class="range">Text size</label>\n <div id="tie-text-range"></div>\n <input id="tie-text-range-value" class="tui-image-editor-range-value" value="0" />\n </li>\n </ul>\n'}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(15),c=i(l),u=n(14),d=i(u),h=n(10),f=i(h),p=n(112),g=i(p),v=n(5),m=n(1),b=function(e){function t(e,n){var i=n.iconStyle,a=n.menuBarPosition;o(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{name:"text",iconStyle:i,menuBarPosition:a,templateHtml:g.default}));return s.effect={bold:!1,italic:!1,underline:!1},s.align="left",s._els={textEffectButton:s.selector("#tie-text-effect-button"),textAlignButton:s.selector("#tie-text-align-button"),textColorpicker:new d.default(s.selector("#tie-text-color"),"#ffbb3b",s.toggleDirection),textRange:new c.default(s.selector("#tie-text-range"),m.defaultTextRangeValus),textRangeValue:s.selector("#tie-text-range-value")},s}return a(t,e),s(t,[{key:"addEvent",value:function(e){this.actions=e,this._els.textEffectButton.addEventListener("click",this._setTextEffectHandler.bind(this)),this._els.textAlignButton.addEventListener("click",this._setTextAlignHandler.bind(this)),this._els.textRange.on("change",this._changeTextRnageHandler.bind(this)),this._els.textRangeValue.value=this._els.textRange.value,this._els.textRangeValue.setAttribute("readonly",!0),this._els.textColorpicker.on("change",this._changeColorHandler.bind(this))}},{key:"changeStandbyMode",value:function(){this.actions.stopDrawingMode()}},{key:"changeStartMode",value:function(){this.actions.modeChange("text")}},{key:"_setTextEffectHandler",value:function(e){var t=e.target.closest(".tui-image-editor-button"),n=t.className.match(/(bold|italic|underline)/),i=n[0],o={bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},underline:{textDecoration:"underline"}}[i];this.effect[i]=!this.effect[i],t.classList.toggle("active"),this.actions.changeTextStyle(o)}},{key:"_setTextAlignHandler",value:function(e){var t=e.target.closest(".tui-image-editor-button");if(t){var n=this.getButtonType(t,["left","center","right"]);e.currentTarget.classList.remove(this.align),this.align!==n&&e.currentTarget.classList.add(n),this.actions.changeTextStyle({textAlign:n}),this.align=n}}},{key:"_changeTextRnageHandler",value:function(e){e=(0,v.toInteger)(e),(0,v.toInteger)(this._els.textRangeValue.value)!==e&&(this.actions.changeTextStyle({fontSize:e}),this._els.textRangeValue.value=e)}},{key:"_changeColorHandler",value:function(e){e=e||"transparent",this.actions.changeTextStyle({fill:e})}},{key:"textColor",get:function(){return this._els.textColorpicker.color}},{key:"fontSize",get:function(){return this._els.textRange.value},set:function(e){this._els.textRange.value=e,this._els.textRangeValue.value=e}}]),t}(f.default);t.default=b},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={"common.bi.image":"https://uicdn.toast.com/toastui/img/tui-image-editor-bi.png","common.bisize.width":"251px","common.bisize.height":"21px","common.backgroundImage":"none","common.backgroundColor":"#1e1e1e","common.border":"0px","header.backgroundImage":"none","header.backgroundColor":"transparent","header.border":"0px","loadButton.backgroundColor":"#fff","loadButton.border":"1px solid #ddd","loadButton.color":"#222","loadButton.fontFamily":"NotoSans, sans-serif","loadButton.fontSize":"12px","downloadButton.backgroundColor":"#fdba3b","downloadButton.border":"1px solid #fdba3b","downloadButton.color":"#fff","downloadButton.fontFamily":"NotoSans, sans-serif","downloadButton.fontSize":"12px","menu.normalIcon.path":"icon-b.svg","menu.normalIcon.name":"icon-b","menu.activeIcon.path":"icon-a.svg","menu.activeIcon.name":"icon-a","menu.iconSize.width":"24px","menu.iconSize.height":"24px","submenu.backgroundColor":"transparent","submenu.partition.color":"#858585","submenu.normalIcon.path":"icon-a.svg","submenu.normalIcon.name":"icon-a","submenu.activeIcon.path":"icon-c.svg","submenu.activeIcon.name":"icon-c","submenu.iconSize.width":"32px","submenu.iconSize.height":"32px","submenu.normalLabel.color":"#858585","submenu.normalLabel.fontWeight":"lighter","submenu.activeLabel.color":"#fff","submenu.activeLabel.fontWeight":"lighter","checkbox.border":"1px solid #ccc","checkbox.backgroundColor":"#fff","range.pointer.color":"#fff","range.bar.color":"#666","range.subbar.color":"#d1d1d1","range.value.color":"#fff","range.value.fontWeight":"lighter","range.value.fontSize":"11px","range.value.border":"1px solid #353535","range.value.backgroundColor":"#151515","range.title.color":"#fff","range.title.fontWeight":"lighter","colorpicker.button.border":"1px solid #1e1e1e","colorpicker.title.color":"#fff"}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(3),s=n(5),l=n(103),c=i(l),u=n(114),d=i(u),h=function(){function e(t){o(this,e),this.styles=this._changeToObject((0,a.extend)(d.default,t)),(0,s.styleLoad)(this._styleMaker())}return r(e,[{key:"getStyle",value:function(e){var t=null,n=e.replace(/\..+$/,""),i=this.styles[e];switch(e){case"common.bi":t=this.styles[e].image;break;case"menu.icon":case"submenu.icon":t={active:this.styles[n+".activeIcon"],normal:this.styles[n+".normalIcon"]};break;case"submenu.label":t={active:this._makeCssText(this.styles[n+".activeLabel"]),normal:this._makeCssText(this.styles[n+".normalLabel"])};break;case"submenu.partition":t={vertical:this._makeCssText((0,a.extend)({},i,{borderLeft:"1px solid "+i.color})),horizontal:this._makeCssText((0,a.extend)({},i,{borderBottom:"1px solid "+i.color}))};break;case"range.pointer":case"range.bar":case"range.subbar":i.backgroundColor=i.color,t=this._makeCssText(i);break;default:t=this._makeCssText(i)}return t}},{key:"_styleMaker",value:function(){var e=this.getStyle("submenu.label"),t=this.getStyle("submenu.partition");return(0,c.default)({subMenuLabelActive:e.active,subMenuLabelNormal:e.normal,submenuPartitionVertical:t.vertical,submenuPartitionHorizontal:t.horizontal,biSize:this.getStyle("common.bisize"),subMenuRangeTitle:this.getStyle("range.title"),submenuRangePointer:this.getStyle("range.pointer"),submenuRangeBar:this.getStyle("range.bar"),submenuRangeSubbar:this.getStyle("range.subbar"),submenuRangeValue:this.getStyle("range.value"),submenuColorpickerTitle:this.getStyle("colorpicker.title"),submenuColorpickerButton:this.getStyle("colorpicker.button"),submenuCheckbox:this.getStyle("checkbox"),menuIconSize:this.getStyle("menu.iconSize"),submenuIconSize:this.getStyle("submenu.iconSize")})}},{key:"_changeToObject",value:function(e){var t={};return(0,a.forEach)(e,function(e,n){var i=n.match(/^(.+)\.([a-z]+)$/i),o=i[1],r=i[2];t[o]||(t[o]={}),t[o][r]=e}),t}},{key:"_makeCssText",value:function(e){var t=this,n=[];return(0,a.forEach)(e,function(e,i){["backgroundImage"].indexOf(i)>-1&&"none"!==e&&(e="url("+e+")"),n.push(t._toUnderScore(i)+": "+e)}),n.join(";")}},{key:"_toUnderScore",value:function(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()})}}]),e}();t.default=h},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t,n,i){if(!(e instanceof t)||void 0!==i&&i in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var i=n(30),o=n(42),r=n(139);e.exports=function(e){return function(t,n,a){var s,l=i(t),c=o(l.length),u=r(a,c);if(e&&n!=n){for(;c>u;)if(s=l[u++],s!=s)return!0}else for(;c>u;u++)if((e||u in l)&&l[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var i=n(20),o=n(124),r=n(123),a=n(11),s=n(42),l=n(142),c={},u={},t=e.exports=function(e,t,n,d,h){var f,p,g,v,m=h?function(){return e}:l(e),b=i(n,d,t?2:1),y=0;if("function"!=typeof m)throw TypeError(e+" is not iterable!");if(r(m)){for(f=s(e.length);f>y;y++)if(v=t?b(a(p=e[y])[0],p[1]):b(e[y]),v===c||v===u)return v}else for(g=m.call(e);!(p=g.next()).done;)if(v=o(g,b,p.value,t),v===c||v===u)return v};t.BREAK=c,t.RETURN=u},function(e,t,n){e.exports=!n(17)&&!n(35)(function(){return 7!=Object.defineProperty(n(26)("div"),"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e,t,n){var i=void 0===n;switch(t.length){case 0:return i?e():e.call(n);case 1:return i?e(t[0]):e.call(n,t[0]);case 2:return i?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return i?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return i?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 i=n(19);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==i(e)?e.split(""):Object(e)}},function(e,t,n){var i=n(18),o=n(7)("iterator"),r=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||r[o]===e)}},function(e,t,n){var i=n(11);e.exports=function(e,t,n,o){try{return o?t(i(n)[0],n[1]):t(n)}catch(t){var r=e.return;throw void 0!==r&&i(r.call(e)),t}}},function(e,t,n){"use strict";var i=n(129),o=n(39),r=n(27),a={};n(12)(a,n(7)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=i(a,{next:o(1,n)}),r(e,t+" Iterator")}},function(e,t,n){var i=n(7)("iterator"),o=!1;try{var r=[7][i]();r.return=function(){o=!0},Array.from(r,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var r=[7],a=r[i]();a.next=function(){return{done:n=!0}},r[i]=function(){return a},e(r)}catch(e){}return n}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var i=n(9),o=n(41).set,r=i.MutationObserver||i.WebKitMutationObserver,a=i.process,s=i.Promise,l="process"==n(19)(a);e.exports=function(){var e,t,n,c=function(){var i,o;for(l&&(i=a.domain)&&i.exit();e;){o=e.fn,e=e.next;try{o()}catch(i){throw e?n():t=void 0,i}}t=void 0,i&&i.enter()};if(l)n=function(){a.nextTick(c)};else if(r){var u=!0,d=document.createTextNode("");new r(c).observe(d,{characterData:!0}),n=function(){d.data=u=!u}}else if(s&&s.resolve){var h=s.resolve();n=function(){h.then(c)}}else n=function(){o.call(i,c)};return function(i){var o={fn:i,next:void 0};t&&(t.next=o),e||(e=o,n()),t=o}}},function(e,t,n){var i=n(11),o=n(130),r=n(33),a=n(28)("IE_PROTO"),s=function(){},l="prototype",c=function(){var e,t=n(26)("iframe"),i=r.length,o="<",a=">";for(t.style.display="none",n(36).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(o+"script"+a+"document.F=Object"+o+"/script"+a),e.close(),c=e.F;i--;)delete c[l][r[i]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[l]=i(e),n=new s,s[l]=null,n[a]=e):n=c(),void 0===t?n:o(n,t)}},function(e,t,n){var i=n(23),o=n(11),r=n(133);e.exports=n(17)?Object.defineProperties:function(e,t){o(e);for(var n,a=r(t),s=a.length,l=0;s>l;)i.f(e,n=a[l++],t[n]);return e}},function(e,t,n){var i=n(21),o=n(140),r=n(28)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),i(e,r)?e[r]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var i=n(21),o=n(30),r=n(118)(!1),a=n(28)("IE_PROTO");e.exports=function(e,t){var n,s=o(e),l=0,c=[];for(n in s)n!=a&&i(s,n)&&c.push(n);for(;t.length>l;)i(s,n=t[l++])&&(~r(c,n)||c.push(n));return c}},function(e,t,n){var i=n(132),o=n(33);e.exports=Object.keys||function(e){return i(e,o)}},function(e,t,n){var i=n(12);e.exports=function(e,t,n){for(var o in t)n&&e[o]?e[o]=t[o]:i(e,o,t[o]);return e}},function(e,t,n){e.exports=n(12)},function(e,t,n){"use strict";var i=n(9),o=n(16),r=n(23),a=n(17),s=n(7)("species");e.exports=function(e){var t="function"==typeof o[e]?o[e]:i[e];a&&t&&!t[s]&&r.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var i=n(11),o=n(24),r=n(7)("species");e.exports=function(e,t){var n,a=i(e).constructor;return void 0===a||void 0==(n=i(a)[r])?t:o(n)}},function(e,t,n){var i=n(29),o=n(25);e.exports=function(e){return function(t,n){var r,a,s=String(o(t)),l=i(n),c=s.length;return l<0||l>=c?e?"":void 0:(r=s.charCodeAt(l),r<55296||r>56319||l+1===c||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):r:e?s.slice(l,l+2):(r-55296<<10)+(a-56320)+65536)}}},function(e,t,n){var i=n(29),o=Math.max,r=Math.min;e.exports=function(e,t){return e=i(e),e<0?o(e+t,0):r(e,t)}},function(e,t,n){var i=n(25);e.exports=function(e){return Object(i(e))}},function(e,t,n){var i=n(22);e.exports=function(e,t){if(!i(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!i(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!i(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!i(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var i=n(32),o=n(7)("iterator"),r=n(18);e.exports=n(16).getIteratorMethod=function(e){if(void 0!=e)return e[o]||e["@@iterator"]||r[i(e)]}},function(e,t,n){"use strict";var i=n(116),o=n(127),r=n(18),a=n(30);e.exports=n(37)(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,o(1)):"keys"==t?o(0,n):"values"==t?o(0,e[n]):o(0,[n,e[n]])},"values"),r.Arguments=r.Array,i("keys"),i("values"),i("entries")},function(e,t){},function(e,t,n){"use strict";var i,o,r,a=n(38),s=n(9),l=n(20),c=n(32),u=n(34),d=n(22),h=n(24),f=n(117),p=n(119),g=n(137),v=n(41).set,m=n(128)(),b="Promise",y=s.TypeError,_=s.process,k=s[b],_=s.process,w="process"==c(_),x=function(){},E=!!function(){try{var e=k.resolve(1),t=(e.constructor={})[n(7)("species")]=function(e){e(x,x)};return(w||"function"==typeof PromiseRejectionEvent)&&e.then(x)instanceof t}catch(e){}}(),C=function(e,t){return e===t||e===k&&t===r},O=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},S=function(e){return C(k,e)?new M(e):new o(e)},M=o=function(e){var t,n;this.promise=new e(function(e,i){if(void 0!==t||void 0!==n)throw y("Bad Promise constructor");t=e,n=i}),this.resolve=h(t),this.reject=h(n)},j=function(e){try{e()}catch(e){return{error:e}}},T=function(e,t){if(!e._n){e._n=!0;var n=e._c;m(function(){for(var i=e._v,o=1==e._s,r=0,a=function(t){var n,r,a=o?t.ok:t.fail,s=t.resolve,l=t.reject,c=t.domain;try{a?(o||(2==e._h&&I(e),e._h=1),a===!0?n=i:(c&&c.enter(),n=a(i),c&&c.exit()),n===t.promise?l(y("Promise-chain cycle")):(r=O(n))?r.call(n,s,l):s(n)):l(i)}catch(e){l(e)}};n.length>r;)a(n[r++]);e._c=[],e._n=!1,t&&!e._h&&P(e)})}},P=function(e){v.call(s,function(){var t,n,i,o=e._v;if(A(e)&&(t=j(function(){w?_.emit("unhandledRejection",o,e):(n=s.onunhandledrejection)?n({promise:e,reason:o}):(i=s.console)&&i.error&&i.error("Unhandled promise rejection",o)}),e._h=w||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,i=0;n.length>i;)if(t=n[i++],t.fail||!A(t.promise))return!1;return!0},I=function(e){v.call(s,function(){var t;w?_.emit("rejectionHandled",e):(t=s.onrejectionhandled)&&t({promise:e,reason:e._v})})},D=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()),T(t,!0))},R=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw y("Promise can't be resolved itself");(t=O(e))?m(function(){var i={_w:n,_d:!1};try{t.call(e,l(R,i,1),l(D,i,1))}catch(e){D.call(i,e)}}):(n._v=e,n._s=1,T(n,!1))}catch(e){D.call({_w:n,_d:!1},e)}}};E||(k=function(e){f(this,k,b,"_h"),h(e),i.call(this);try{e(l(R,this,1),l(D,this,1))}catch(e){D.call(this,e)}},i=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},i.prototype=n(134)(k.prototype,{then:function(e,t){var n=S(g(this,k));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=w?_.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&T(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),M=function(){var e=new i;this.promise=e,this.resolve=l(R,e,1),this.reject=l(D,e,1)}),u(u.G+u.W+u.F*!E,{Promise:k}),n(27)(k,b),n(136)(b),r=n(16)[b],u(u.S+u.F*!E,b,{reject:function(e){var t=S(this),n=t.reject;return n(e),t.promise}}),u(u.S+u.F*(a||!E),b,{resolve:function(e){if(e instanceof k&&C(e.constructor,this))return e;var t=S(this),n=t.resolve;return n(e),t.promise}}),u(u.S+u.F*!(E&&n(126)(function(e){k.all(e).catch(x)})),b,{all:function(e){var t=this,n=S(t),i=n.resolve,o=n.reject,r=j(function(){var n=[],r=0,a=1;p(e,!1,function(e){var s=r++,l=!1;n.push(void 0),a++,t.resolve(e).then(function(e){l||(l=!0,n[s]=e,--a||i(n))},o)}),--a||i(n)});return r&&o(r.error),n.promise},race:function(e){var t=this,n=S(t),i=n.reject,o=j(function(){p(e,!1,function(e){t.resolve(e).then(n.resolve,i)})});return o&&i(o.error),n.promise}})},function(e,t,n){"use strict";var i=n(138)(!0);n(37)(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=i(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(143);for(var i=n(9),o=n(12),r=n(18),a=n(7)("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;l<5;l++){var c=s[l],u=i[c],d=u&&u.prototype;d&&!d[a]&&o(d,a,c),r[c]=r.Array}},function(e,t){},function(e,t,n){/*!
* Toast UI Colorpicker
* @version 2.2.0
* @author NHNEnt FE Development Team <dl_javascript@nhnent.com>
* @license MIT
*/
!function(t,i){e.exports=i(n(3))}(this,function(e){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="dist",t(0)}([function(e,t,n){n(1),e.exports=n(6)},function(e,t){},,,,,function(e,t,n){"use strict";var i=n(7),o=n(9),r=n(10),a=n(11),s=n(12),l=n(13),c=n(16),u=n(18),d=n(14),h=n(19),f={domutil:i,domevent:o,Collection:r,View:a,Drag:s,create:l,Palette:c,Slider:u,colorutil:d,svgvml:h};e.exports=f},function(e,t,n){"use strict";function i(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var o,r,a=n(8),s=n(9),l=n(10),c=a,u="_pos",d="onselectstart"in document,h="",f=/^auto$|^$|%/;o={appendHTMLElement:function(e,t,n){var i;return n=n||"",i=document.createElement(e),i.className=n,t?t.appendChild(i):document.body.appendChild(i),i},remove:function(e){e&&e.parentNode&&e.parentNode.removeChild(e)},get:function(e){return document.getElementById(e)},_matcher:function(e,t){var n=/^\./,i=/^#/;return n.test(t)?o.hasClass(e,t.replace(".","")):i.test(t)?e.id===t.replace("#",""):e.nodeName.toLowerCase()===t.toLowerCase()},find:function(e,t,n){function i(e,t){for(var c,u=e.childNodes,d=0,h=u.length;d<h;d+=1)if(c=u[d],"#text"!==c.nodeName)if(o._matcher(c,t)){if((l&&n(c)||!l)&&r.push(c),s){a=!0;break}}else if(c.childNodes.length>0&&(i(c,t),a))break}var r=[],a=!1,s=c.isUndefined(n)||n===!1,l=c.isFunction(n);return c.isString(t)&&(t=o.get(t)),t=t||window.document.body,i(t,e),s?r[0]||null:r},closest:function(e,t){var n=e.parentNode;if(o._matcher(e,t))return e;for(;n&&n!==window.document.body;){if(o._matcher(n,t))return n;n=n.parentNode}},text:function(e){var t="",n=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)t+=o.text(e)}else if(3===i||4===i)return e.nodeValue}else for(;e[n];n+=1)t+=o.text(e[n]);return t},setData:function(e,t,n){return"dataset"in e?void(e.dataset[t]=n):void e.setAttribute("data-"+t,n)},getData:function(e,t){return"dataset"in e?e.dataset[t]:e.getAttribute("data-"+t)},hasClass:function(e,t){var n;return c.isUndefined(e.classList)?(n=o.getClass(e),n.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(n)):e.classList.contains(t)},addClass:function(e,t){var n;c.isUndefined(e.classList)?o.hasClass(e,t)||(n=o.getClass(e),o.setClass(e,(n?n+" ":"")+t)):c.forEachArray(t.split(" "),function(t){e.classList.add(t)})},setClass:function(e,t){c.isUndefined(e.className.baseVal)?e.className=t:e.className.baseVal=t},removeClass:function(e,t){var n="";c.isUndefined(e.classList)?(n=(" "+o.getClass(e)+" ").replace(" "+t+" "," "),o.setClass(e,i(n))):e.classList.remove(t)},getClass:function(e){return e&&e.className?c.isUndefined(e.className.baseVal)?e.className:e.className.baseVal:""},getStyle:function(e,t){var n,i=e.style[t]||e.currentStyle&&e.currentStyle[t];return i&&"auto"!==i||!document.defaultView||(n=document.defaultView.getComputedStyle(e,null),i=n?n[t]:null),"auto"===i?null:i},getComputedStyle:function(e){var t=document.defaultView;return t&&t.getComputedStyle?document.defaultView.getComputedStyle(e):{getPropertyValue:function(t){var n=/(\-([a-z]){1})/g;return"float"===t&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle[t]?e.currentStyle[t]:null}}},setPosition:function(e,t,n){t=c.isUndefined(t)?0:t,n=c.isUndefined(n)?0:n,e[u]=[t,n],e.style.left=t+"px",e.style.top=n+"px"},getPosition:function(e,t){var n,i,o;return t&&(e[u]=null),e[u]?e[u]:(n=0,i=0,(f.test(e.style.left)||f.test(e.style.top))&&"getBoundingClientRect"in e?(o=e.getBoundingClientRect(),n=o.left,i=o.top):(n=parseFloat(e.style.left||0),i=parseFloat(e.style.top||0)),[n,i])},getSize:function(e){var t,n=o.getStyle(e,"width"),i=o.getStyle(e,"height");return(f.test(n)||f.test(i))&&"getBoundingClientRect"in e?(t=e.getBoundingClientRect(),n=t.width,i=t.height):(n=parseFloat(n||0),i=parseFloat(i||0)),[n,i]},testProp:function(e){for(var t=document.documentElement.style,n=0,i=e.length;n<i;n+=1)if(e[n]in t)return e[n];return!1},getFormData:function(e){var t=new l(function(){return this.length}),n=function(e){return!e.disabled},i={};return t.add.apply(t,o.find("input",e,n).concat(o.find("select",e,n)).concat(o.find("textarea",e,n))),t=t.groupBy(function(e){return e&&e.getAttribute("name")||"_other"}),c.forEach(t,function(e,t){"_other"!==t&&e.each(function(n){var r=n.nodeName.toLowerCase(),a=n.type,s=[];"radio"===a?s=[e.find(function(e){return e.checked}).toArray().pop()]:"checkbox"===a?s=e.find(function(e){return e.checked}).toArray():"select"===r?e.find(function(e){return!!e.childNodes.length}).each(function(e){s=s.concat(o.find("option",e,function(e){return e.selected}))}):s=e.find(function(e){return""!==e.value}).toArray(),s=c.map(s,function(e){return e.value}),s.length?1===s.length&&(s=s[0]):s="",i[t]=s})}),i}},r=o.testProp(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]),o.disableTextSelection=function(){return d?function(){s.on(window,"selectstart",s.preventDefault)}:function(){var e=document.documentElement.style;h=e[r],e[r]="none"}}(),o.enableTextSelection=function(){return d?function(){s.off(window,"selectstart",s.preventDefault)}:function(){document.documentElement.style[r]=h}}(),o.disableImageDrag=function(){s.on(window,"dragstart",s.preventDefault)},o.enableImageDrag=function(){s.off(window,"dragstart",s.preventDefault)},o.applyTemplate=function(e,t){var n=e.replace(/\{\{(\w*)\}\}/g,function(e,n){return t.hasOwnProperty(n)?t[n]:""});return n},e.exports=o},function(t,n){t.exports=e},function(e,t,n){"use strict";var i=n(8),o=i,r=o.browser,a="_evt",s={START:["touchstart","mousedown"],END:{mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},MOVE:{mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"}},l={on:function(e,t,n,i){return o.isString(t)?void o.forEach(t.split(" "),function(t){l._on(e,t,n,i)}):void o.forEachOwnProperties(t,function(t,i){l._on(e,i,t,n)})},_on:function(e,t,n,i){var r,s,c;r=t+o.stamp(n)+(i?"_"+o.stamp(i):""),e[a]&&e[a][r]||(s=function(t){n.call(i||e,t||window.event)},c=s,"addEventListener"in e?"mouseenter"===t||"mouseleave"===t?(s=function(t){t=t||window.event,l._checkMouse(e,t)&&c(t)},e.addEventListener("mouseenter"===t?"mouseover":"mouseout",s,!1)):("mousewheel"===t&&e.addEventListener("DOMMouseScroll",s,!1),e.addEventListener(t,s,!1)):"attachEvent"in e&&e.attachEvent("on"+t,s),e[a]=e[a]||{},e[a][r]=s)},off:function(e,t,n,i){return o.isString(t)?void o.forEach(t.split(" "),function(t){l._off(e,t,n,i)}):void o.forEachOwnProperties(t,function(t,i){l._off(e,i,t,n)})},_off:function(e,t,n,i){var r=t+o.stamp(n)+(i?"_"+o.stamp(i):""),s=e[a]&&e[a][r];if(s){if("removeEventListener"in e)"mouseenter"===t||"mouseleave"===t?e.removeEventListener("mouseenter"===t?"mouseover":"mouseout",s,!1):("mousewheel"===t&&e.removeEventListener("DOMMouseScroll",s,!1),e.removeEventListener(t,s,!1));else if("detachEvent"in e)try{e.detachEvent("on"+t,s)}catch(e){}if(delete e[a][r],!o.keys(e[a]).length)return o.browser.msie&&o.browser.version<9?void(e[a]=null):void delete e[a]}},once:function(e,t,n,i){function r(){n.apply(i||e,arguments),a._off(e,t,r,i)}var a=this;return o.isObject(t)?void o.forEachOwnProperties(t,function(t,i){l.once(e,i,t,n)}):void l.on(e,t,r,i)},stopPropagation:function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},preventDefault:function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},stop:function(e){l.preventDefault(e),l.stopPropagation(e)},disableScrollPropagation:function(e){l.on(e,"mousewheel MozMousePixelScroll",l.stopPropagation)},disableClickPropagation:function(e){l.on(e,s.START.join(" ")+" click dblclick",l.stopPropagation)},getMousePosition:function(e,t){var n;return t?(n=t.getBoundingClientRect(),[e.clientX-n.left-t.clientLeft,e.clientY-n.top-t.clientTop]):[e.clientX,e.clientY]},getWheelDelta:function(e){var t=0;return e.wheelDelta&&(t=e.wheelDelta/120),e.detail&&(t=-e.detail/3),t},_checkMouse:function(e,t){var n=t.relatedTarget;if(!n)return!0;try{for(;n&&n!==e;)n=n.parentNode}catch(e){return!1}return n!==e},trigger:function(e,t,n){var i=/(mouse|click)/;o.isUndefined(n)&&i.exec(t)&&(n=l.mouseEvent(t)),e.dispatchEvent?e.dispatchEvent(n):e.fireEvent&&e.fireEvent("on"+t,n)},mouseEvent:function(e,t){var n,i;return i=o.extend({bubbles:!0,cancelable:"mousemove"!==e,view:window,wheelDelta:0,detail:0,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:void 0},t),r.msie&&r.version<9&&delete i.wheelDelta,"function"==typeof document.createEvent?(n=document.createEvent("MouseEvents"),n.initMouseEvent(e,i.bubbles,i.cancelable,i.view,i.detail,i.screenX,i.screenY,i.clientX,i.clientY,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.button,document.body.parentNode)):document.createEventObject&&(n=document.createEventObject(),o.forEach(i,function(e,t){n[t]=e},this),n.button={0:1,1:4,2:2}[n.button]||n.button),n},getMouseButton:function(e){var t,n="0,1,3,5,7",i="2,6",o="4";return document.implementation.hasFeature("MouseEvents","2.0")?e.button:(t=e.button+"",~n.indexOf(t)?0:~i.indexOf(t)?2:~o.indexOf(t)?1:void 0)}};e.exports=l},function(e,t,n){"use strict";function i(e){this.items={},this.length=0,l(e)&&(this.getItemID=e)}var o=n(8),r=o,a=r.forEachOwnProperties,s=r.forEachArray,l=r.isFunction,c=r.isObject,u=Array.prototype.slice;i.and=function(e){var t;return e=u.call(arguments),t=e.length,function(n){for(var i=0;i<t;i+=1)if(!e[i].call(null,n))return!1;return!0}},i.or=function(e){var t;return e=u.call(arguments),t=e.length,function(n){for(var i=1,o=e[0].call(null,n);i<t;i+=1)o=o||e[i].call(null,n);return o}},i.merge=function(e){var t=u.call(arguments),n={},o=new i(t[0].getItemID),a=r.extend;return s(t,function(e){a(n,e.items)}),o.items=n,o.length=r.keys(o.items).length,o},i.prototype.getItemID=function(e){return e._id+""},i.prototype.add=function(e){var t,n;return arguments.length>1?void s(u.call(arguments),function(e){this.add(e)},this):(t=this.getItemID(e),n=this.items,n[t]||(this.length+=1),void(n[t]=e))},i.prototype.remove=function(e){var t,n,i=[];return this.length?arguments.length>1?i=r.map(u.call(arguments),function(e){return this.remove(e)},this):(t=this.items,c(e)&&(e=this.getItemID(e)),t[e]?(this.length-=1,n=t[e],delete t[e],n):i):i},i.prototype.clear=function(){this.items={},this.length=0},i.prototype.has=function(e){var t,n;return!!this.length&&(t=l(e),n=!1,t?this.each(function(t){return e(t)!==!0||(n=!0,!1)}):(e=c(e)?this.getItemID(e):e,n=r.isExisty(this.items[e])),n)},i.prototype.doWhenHas=function(e,t,n){var i=this.items[e];r.isExisty(i)&&t.call(n||this,i)},i.prototype.find=function(e){var t=new i;return this.hasOwnProperty("getItemID")&&(t.getItemID=this.getItemID),this.each(function(n){e(n)===!0&&t.add(n)}),t},i.prototype.groupBy=function(e,t){var n,o,a={},s=l(e),c=this.getItemID;if(r.isArray(e)){if(r.forEachArray(e,function(e){a[e+""]=new i(c)}),!t)return a;e=t,s=!0}return this.each(function(t){s?o=e(t):(o=t[e],l(o)&&(o=o.apply(t))),n=a[o],n||(n=a[o]=new i(c)),n.add(t)}),a},i.prototype.single=function(){var e;return this.each(function(t){return e=t,!1},this),e},i.prototype.sort=function(e){var t=[];return this.each(function(e){t.push(e)}),l(e)&&(t=t.sort(e)),t},i.prototype.each=function(e,t){a(this.items,e,t||this)},i.prototype.toArray=function(){return this.length?r.map(this.items,function(e){return e}):[]},e.exports=i},function(e,t,n){"use strict";function i(e,t){var n=o.stamp(this);e=e||{},o.isUndefined(t)&&(t=r.appendHTMLElement("div")),r.addClass(t,"tui-view-"+n),this.id=n,this.container=t,this.childs=new a(function(e){return o.stamp(e)}),this.parent=null}var o=n(8),r=n(7),a=n(10);i.prototype.addChild=function(e,t){t&&t.call(e,this),e.parent=this,this.childs.add(e)},i.prototype.removeChild=function(e,t){var n=o.isNumber(e)?this.childs.items[e]:e;e=o.stamp(n),t&&t.call(n,this),this.childs.remove(e)},i.prototype.render=function(){this.childs.each(function(e){e.render()})},i.prototype.recursive=function(e,t){o.isFunction(e)&&(t||e(this),this.childs.each(function(t){t.recursive(e)}))},i.prototype.resize=function(){for(var e=Array.prototype.slice.call(arguments),t=this.parent;t;)o.isFunction(t._onResize)&&t._onResize.apply(t,e),t=t.parent},i.prototype._beforeDestroy=function(){},i.prototype._destroy=function(){this._beforeDestroy(),this.childs.clear(),this.container.innerHTML="",this.id=this.parent=this.childs=this.container=null},i.prototype.destroy=function(e){this.childs.each(function(e){e.destroy(!0),e._destroy()}),e||this._destroy()},i.prototype.getViewBound=function(){var e=this.container,t=r.getPosition(e),n=r.getSize(e);return{x:t[0],y:t[1],width:n[0],height:n[1]}},e.exports=i},function(e,t,n){(function(t){"use strict";function i(e,t){a.on(t,"mousedown",this._onMouseDown,this),this.options=o.extend({distance:10},e),this.container=t,this._isMoved=!1,this._distance=0,this._dragStartFired=!1,this._dragStartEventData=null}var o=n(8),r=n(7),a=n(9);i.prototype.destroy=function(){a.off(this.container,"mousedown",this._onMouseDown,this),this.options=this.container=this._isMoved=this._distance=this._dragStartFired=this._dragStartEventData=null},i.prototype._toggleDragEvent=function(e){var n,i,o=this.container;e?(n="on",i="disable"):(n="off",i="enable"),r[i+"TextSelection"](o),r[i+"ImageDrag"](o),a[n](t.document,{mousemove:this._onMouseMove,mouseup:this._onMouseUp},this)},i.prototype._getEventData=function(e){return{target:e.target||e.srcElement,originEvent:e}},i.prototype._onMouseDown=function(e){0===a.getMouseButton(e)&&(this._distance=0,this._dragStartFired=!1,this._dragStartEventData=this._getEventData(e),this._toggleDragEvent(!0))},i.prototype._onMouseMove=function(e){var t=this.options.distance;return a.preventDefault(e),this._isMoved=!0,this._distance<t?void(this._distance+=1):this._dragStartFired||(this._dragStartFired=!0,this.invoke("dragStart",this._dragStartEventData))?void this.fire("drag",this._getEventData(e)):void this._toggleDragEvent(!1)},i.prototype._onMouseUp=function(e){return this._toggleDragEvent(!1),this._isMoved?(this._isMoved=!1,void this.fire("dragEnd",this._getEventData(e))):void this.fire("click",this._getEventData(e))},o.CustomEvents.mixin(i),e.exports=i}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(){var e=location.hostname;u||(u=!0,r.imagePing("https://www.google-analytics.com/collect",{v:1,t:"event",tid:"UA-115377265-9",cid:e,dp:e,dh:"color-picker"}))}function o(e){var t;if(!(this instanceof o))return new o(e);if(e=this.options=r.extend({container:null,color:"#f8f8f8",preset:["#181818","#282828","#383838","#585858","#b8b8b8","#d8d8d8","#e8e8e8","#f8f8f8","#ab4642","#dc9656","#f7ca88","#a1b56c","#86c1b9","#7cafc2","#ba8baf","#a16946"],cssPrefix:"tui-colorpicker-",detailTxt:"Detail",usageStatistics:!0},e),!e.container)throw new Error("ColorPicker(): need container option.");t=this.layout=new s(e,e.container),this.palette=new l(e,t.container),this.palette.on({_selectColor:this._onSelectColorInPalette,_toggleSlider:this._onToggleSlider},this),this.slider=new c(e,t.container),this.slider.on("_selectColor",this._onSelectColorInSlider,this),t.addChild(this.palette),t.addChild(this.slider),this.render(e.color),e.usageStatistics&&i()}var r=n(8),a=n(14),s=n(15),l=n(16),c=n(18),u=!1;o.prototype._onSelectColorInPalette=function(e){var t=e.color,n=this.options;return a.isValidRGB(t)||""===t?(this.fire("selectColor",{color:t,origin:"palette"}),void(n.color!==t&&(n.color=t,this.render(t)))):void this.render()},o.prototype._onToggleSlider=function(){this.slider.toggle(!this.slider.isVisible())},o.prototype._onSelectColorInSlider=function(e){var t=e.color,n=this.options;this.fire("selectColor",{color:t,origin:"slider"}),n.color!==t&&(n.color=t,this.palette.render(t))},o.prototype.setColor=function(e){if(!a.isValidRGB(e))throw new Error("ColorPicker#setColor(): need valid hex string color value");this.options.color=e,this.render(e)},o.prototype.getColor=function(){return this.options.color},o.prototype.toggle=function(e){this.layout.container.style.display=e?"block":"none"},o.prototype.render=function(e){this.layout.render(e||this.options.color)},o.prototype.destroy=function(){this.layout.destroy(),this.options.container.innerHTML="",this.layout=this.slider=this.palette=this.options=null},r.CustomEvents.mixin(o),e.exports=o},function(e,t){"use strict";var n=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,i={leadingZero:function(e,t){var n="",i=0;if((e+"").length>t)return e+"";for(;i<t-1;i+=1)n+="0";return(n+e).slice(t*-1)},isValidRGB:function(e){return n.test(e)},
// @license RGB <-> HSV conversion utilities based off of http://www.cs.rit.edu/~ncs/color/t_convert.html
hexToRGB:function(e){var t,n,o;return!!i.isValidRGB(e)&&(e=e.substring(1),t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2,2),16),o=parseInt(e.substr(4,2),16),[t,n,o])},rgbToHEX:function(e,t,n){var o="#"+i.leadingZero(e.toString(16),2)+i.leadingZero(t.toString(16),2)+i.leadingZero(n.toString(16),2);return!!i.isValidRGB(o)&&o},rgbToHSV:function(e,t,n){var i,o,r,a,s,l;if(e/=255,t/=255,n/=255,i=Math.max(e,t,n),o=Math.min(e,t,n),s=i,l=i-o,a=0===i?0:l/i,i===o)r=0;else{switch(i){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return[Math.round(360*r),Math.round(100*a),Math.round(100*s)]},hsvToRGB:function(e,t,n){var i,o,r,a,s,l,c,u;if(e=Math.max(0,Math.min(360,e)),t=Math.max(0,Math.min(100,t)),n=Math.max(0,Math.min(100,n)),t/=100,n/=100,0===t)return i=o=r=n,[Math.round(255*i),Math.round(255*o),Math.round(255*r)];switch(e/=60,a=Math.floor(e),s=e-a,l=n*(1-t),c=n*(1-t*s),u=n*(1-t*(1-s)),a){case 0:i=n,o=u,r=l;break;case 1:i=c,o=n,r=l;break;case 2:i=l,o=n,r=u;break;case 3:i=l,o=c,r=n;break;case 4:i=u,o=l,r=n;break;default:i=n,o=l,r=c}return[Math.round(255*i),Math.round(255*o),Math.round(255*r)]}};e.exports=i},function(e,t,n){"use strict";function i(e,t){this.options=o.extend({cssPrefix:"tui-colorpicker-"},e),t=r.appendHTMLElement("div",t,this.options.cssPrefix+"container"),a.call(this,e,t),this.render()}var o=n(8),r=n(7),a=n(11);o.inherit(i,a),i.prototype.render=function(e){this.recursive(function(t){t.render(e)},!0)},e.exports=i},function(e,t,n){"use strict";function i(e,t){this.options=o.extend({cssPrefix:"tui-colorpicker-",preset:["#181818","#282828","#383838","#585858","#B8B8B8","#D8D8D8","#E8E8E8","#F8F8F8","#AB4642","#DC9656","#F7CA88","#A1B56C","#86C1B9","#7CAFC2","#BA8BAF","#A16946"],detailTxt:"Detail"},e),t=r.appendHTMLElement("div",t,this.options.cssPrefix+"palette-container"),l.call(this,e,t)}var o=n(8),r=n(7),a=n(14),s=n(9),l=n(11),c=n(17);o.inherit(i,l),i.prototype._onClick=function(e){var t=this.options,n=e.srcElement||e.target,i={};return r.hasClass(n,t.cssPrefix+"palette-button")?(i.color=n.value,void this.fire("_selectColor",i)):void(r.hasClass(n,t.cssPrefix+"palette-toggle-slider")&&this.fire("_toggleSlider"))},i.prototype._onChange=function(e){var t=this.options,n=e.srcElement||e.target,i={};r.hasClass(n,t.cssPrefix+"palette-hex")&&(i.color=n.value,this.fire("_selectColor",i))},i.prototype._beforeDestroy=function(){this._toggleEvent(!1)},i.prototype._toggleEvent=function(e){var t,n=this.options,i=this.container,o=s[e?"on":"off"];o(i,"click",this._onClick,this),t=r.find("."+n.cssPrefix+"palette-hex",i),t&&o(t,"change",this._onChange,this)},i.prototype.render=function(e){var t=this.options,n="";this._toggleEvent(!1),n=c.layout.replace("{{colorList}}",o.map(t.preset,function(n){var i="",o="";return a.isValidRGB(n)&&(o=r.applyTemplate(c.itemStyle,{color:n})),i=r.applyTemplate(c.item,{itemStyle:o,itemClass:n?"":" "+t.cssPrefix+"color-transparent",color:n,cssPrefix:t.cssPrefix,selected:n===e?" "+t.cssPrefix+"selected":""})}).join("")),n=r.applyTemplate(n,{cssPrefix:t.cssPrefix,detailTxt:t.detailTxt,color:e}),this.container.innerHTML=n,this._toggleEvent(!0)},o.CustomEvents.mixin(i),e.exports=i},function(e,t){"use strict";var n=['<ul class="{{cssPrefix}}clearfix">{{colorList}}</ul>','<div class="{{cssPrefix}}clearfix" style="overflow:hidden">','<input type="button" class="{{cssPrefix}}palette-toggle-slider" value="{{detailTxt}}" />','<input type="text" class="{{cssPrefix}}palette-hex" value="{{color}}" maxlength="7" />','<span class="{{cssPrefix}}palette-preview" style="background-color:{{color}};color:{{color}}">{{color}}</span>',"</div>"].join("\n"),i='<li><input class="{{cssPrefix}}palette-button{{selected}}{{itemClass}}" type="button" style="{{itemStyle}}" title="{{color}}" value="{{color}}" /></li>',o="background-color:{{color}};color:{{color}}";e.exports={layout:n,item:i,itemStyle:o}},function(e,t,n){"use strict";function i(e,t){t=r.appendHTMLElement("div",t,e.cssPrefix+"slider-container"),t.style.display="none",c.call(this,e,t),this.options=o.extend({color:"#f8f8f8",cssPrefix:"tui-colorpicker-"},e),this._dragDataCache={},this.sliderHandleElement=null,this.huebarHandleElement=null,this.baseColorElement=null,this.drag=new u({distance:0},t),this.drag.on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd,click:this._onClick},this)}var o=n(8),r=n(7),a=n(9),s=n(19),l=n(14),c=n(11),u=n(12),d=n(20),h=[-7,112],f=[-3,115],p=359.99;o.inherit(i,c),i.prototype._beforeDestroy=function(){this.drag.off(),this.drag=this.options=this._dragDataCache=this.sliderHandleElement=this.huebarHandleElement=this.baseColorElement=null},i.prototype.toggle=function(e){this.container.style.display=e?"block":"none"},i.prototype.isVisible=function(){return"block"===this.container.style.display},i.prototype.render=function(e){var t,n,i=this,o=i.container,a=i.options,s=d.layout;l.isValidRGB(e)&&(s=s.replace(/{{slider}}/,d.slider),s=s.replace(/{{huebar}}/,d.huebar),s=s.replace(/{{cssPrefix}}/g,a.cssPrefix),i.container.innerHTML=s,i.sliderHandleElement=r.find("."+a.cssPrefix+"slider-handle",o),i.huebarHandleElement=r.find("."+a.cssPrefix+"huebar-handle",o),i.baseColorElement=r.find("."+a.cssPrefix+"slider-basecolor",o),t=l.hexToRGB(e),n=l.rgbToHSV.apply(null,t),this.moveHue(n[0],!0),this.moveSaturationAndValue(n[1],n[2],!0))},i.prototype._moveColorSliderHandle=function(e,t,n){var i,o=this.sliderHandleElement;t=Math.max(h[0],t),t=Math.min(h[1],t),e=Math.max(h[0],e),e=Math.min(h[1],e),s.setTranslateXY(o,e,t),i=t>50?"white":"black",s.setStrokeColor(o,i),n||this.fire("_selectColor",{color:l.rgbToHEX.apply(null,this.getRGB())})},i.prototype.moveSaturationAndValue=function(e,t,n){var i,o,r,a;e=e||0,t=t||0,i=Math.abs(h[0]),o=h[1],r=e*o/100-i,a=o-t*o/100-i,this._moveColorSliderHandle(r,a,n)},i.prototype._moveColorSliderByPosition=function(e,t){var n=h[0];this._moveColorSliderHandle(e+n,t+n)},i.prototype.getSaturationAndValue=function(){var e,t,n=Math.abs(h[0]),i=n+h[1],o=s.getTranslateXY(this.sliderHandleElement);return e=(o[1]+n)/i*100,t=100-(o[0]+n)/i*100,[e,t]},i.prototype._moveHueHandle=function(e,t){var n,i,o=this.huebarHandleElement,r=this.baseColorElement;e=Math.max(f[0],e),e=Math.min(f[1],e),s.setTranslateY(o,e),n=l.hsvToRGB(this.getHue(),100,100),i=l.rgbToHEX.apply(null,n),s.setGradientColorStop(r,i),t||this.fire("_selectColor",{color:l.rgbToHEX.apply(null,this.getRGB())})},i.prototype.moveHue=function(e,t){var n,i,o=0;n=Math.abs(f[0]),i=n+f[1],e=e||0,o=i*e/p-n,this._moveHueHandle(o,t)},i.prototype._moveHueByPosition=function(e){var t=f[0];this._moveHueHandle(e+t)},i.prototype.getHue=function(){var e,t,n=this.huebarHandleElement,i=s.getTranslateXY(n);return e=Math.abs(f[0]),t=e+f[1],(i[0]+e)*p/t},i.prototype.getHSV=function(){var e=this.getSaturationAndValue(),t=this.getHue();return[t].concat(e)},i.prototype.getRGB=function(){return l.hsvToRGB.apply(null,this.getHSV())},i.prototype._prepareColorSliderForMouseEvent=function(e){var t,n=this.options,i=r.closest(e.target,"."+n.cssPrefix+"slider-part");return t=this._dragDataCache={isColorSlider:r.hasClass(i,n.cssPrefix+"slider-left"),parentElement:i}},i.prototype._onClick=function(e){var t=this._prepareColorSliderForMouseEvent(e),n=a.getMousePosition(e.originEvent,t.parentElement);t.isColorSlider?this._moveColorSliderByPosition(n[0],n[1]):this._moveHueByPosition(n[1]),this._dragDataCache=null},i.prototype._onDragStart=function(e){this._prepareColorSliderForMouseEvent(e)},i.prototype._onDrag=function(e){var t=this._dragDataCache,n=a.getMousePosition(e.originEvent,t.parentElement);t.isColorSlider?this._moveColorSliderByPosition(n[0],n[1]):this._moveHueByPosition(n[1])},i.prototype._onDragEnd=function(){this._dragDataCache=null},o.CustomEvents.mixin(i),e.exports=i},function(e,t,n){"use strict";var i=n(8),o=/[\.\-0-9]+/g,r=-6,a={isOldBrowser:function(){var e=a._isOldBrowser;return i.isExisty(e)||(a._isOldBrowser=e=i.browser.msie&&i.browser.version<9),e},getTranslateXY:function(e){var t;return a.isOldBrowser()?(t=e.style,[parseFloat(t.top),parseFloat(t.left)]):(t=e.getAttribute("transform"))?(t=t.match(o),[parseFloat(t[1]),parseFloat(t[0])]):[0,0]},setTranslateXY:function(e,t,n){a.isOldBrowser()?(e.style.left=t+"px",e.style.top=n+"px"):e.setAttribute("transform","translate("+t+","+n+")")},setTranslateY:function(e,t){a.isOldBrowser()?e.style.top=t+"px":e.setAttribute("transform","translate("+r+","+t+")")},setStrokeColor:function(e,t){a.isOldBrowser()?e.strokecolor=t:e.setAttribute("stroke",t)},setGradientColorStop:function(e,t){a.isOldBrowser()?e.color=t:e.setAttribute("stop-color",t)}};e.exports=a},function(e,t,n){(function(t){"use strict";var i=n(8),o=['<div class="{{cssPrefix}}slider-left {{cssPrefix}}slider-part">{{slider}}</div>','<div class="{{cssPrefix}}slider-right {{cssPrefix}}slider-part">{{huebar}}</div>'].join("\n"),r=['<svg class="{{cssPrefix}}svg {{cssPrefix}}svg-slider">',"<defs>",'<linearGradient id="{{cssPrefix}}svg-fill-color" x1="0%" y1="0%" x2="100%" y2="0%">','<stop offset="0%" stop-color="rgb(255,255,255)" />','<stop class="{{cssPrefix}}slider-basecolor" offset="100%" stop-color="rgb(255,0,0)" />',"</linearGradient>",'<linearGradient id="{{cssPrefix}}svn-fill-black" x1="0%" y1="0%" x2="0%" y2="100%">','<stop offset="0%" style="stop-color:rgb(0,0,0);stop-opacity:0" />','<stop offset="100%" style="stop-color:rgb(0,0,0);stop-opacity:1" />',"</linearGradient>","</defs>",'<rect width="100%" height="100%" fill="url(#{{cssPrefix}}svg-fill-color)"></rect>','<rect width="100%" height="100%" fill="url(#{{cssPrefix}}svn-fill-black)"></rect>','<path transform="translate(0,0)" class="{{cssPrefix}}slider-handle" d="M0 7.5 L15 7.5 M7.5 15 L7.5 0 M2 7 a5.5 5.5 0 1 1 0 1 Z" stroke="black" stroke-width="0.75" fill="none" />',"</svg>"].join("\n"),a=['<div class="{{cssPrefix}}vml-slider">','<v:rect strokecolor="none" class="{{cssPrefix}}vml {{cssPrefix}}vml-slider-bg">','<v:fill class="{{cssPrefix}}vml {{cssPrefix}}slider-basecolor" type="gradient" method="none" color="#ff0000" color2="#fff" angle="90" />',"</v:rect>",'<v:rect strokecolor="#ccc" class="{{cssPrefix}}vml {{cssPrefix}}vml-slider-bg">','<v:fill type="gradient" method="none" color="black" color2="white" o:opacity2="0%" class="{{cssPrefix}}vml" />',"</v:rect>",'<v:shape class="{{cssPrefix}}vml {{cssPrefix}}slider-handle" coordsize="1 1" style="width:1px;height:1px;"path="m 0,7 l 14,7 m 7,14 l 7,0 ar 12,12 2,2 z" filled="false" stroked="true" />',"</div>"].join("\n"),s=['<svg class="{{cssPrefix}}svg {{cssPrefix}}svg-huebar">',"<defs>",'<linearGradient id="g" x1="0%" y1="0%" x2="0%" y2="100%">','<stop offset="0%" stop-color="rgb(255,0,0)" />','<stop offset="16.666%" stop-color="rgb(255,255,0)" />','<stop offset="33.333%" stop-color="rgb(0,255,0)" />','<stop offset="50%" stop-color="rgb(0,255,255)" />','<stop offset="66.666%" stop-color="rgb(0,0,255)" />','<stop offset="83.333%" stop-color="rgb(255,0,255)" />','<stop offset="100%" stop-color="rgb(255,0,0)" />',"</linearGradient>","</defs>",'<rect width="18px" height="100%" fill="url(#g)"></rect>','<path transform="translate(-6,-3)" class="{{cssPrefix}}huebar-handle" d="M0 0 L4 4 L0 8 L0 0 Z" fill="black" stroke="none" />',"</svg>"].join("\n"),l=['<div class="{{cssPrefix}}vml-huebar">','<v:rect strokecolor="#ccc" class="{{cssPrefix}}vml {{cssPrefix}}vml-huebar-bg">','<v:fill type="gradient" method="none" colors="0% rgb(255,0,0), 16.666% rgb(255,255,0), 33.333% rgb(0,255,0), 50% rgb(0,255,255), 66.666% rgb(0,0,255), 83.333% rgb(255,0,255), 100% rgb(255,0,0)" angle="180" class="{{cssPrefix}}vml" />',"</v:rect>",'<v:shape class="{{cssPrefix}}vml {{cssPrefix}}huebar-handle" coordsize="1 1" style="width:1px;height:1px;position:absolute;z-index:1;right:22px;top:-3px;"path="m 0,0 l 4,4 l 0,8 l 0,0 z" filled="true" fillcolor="black" stroked="false" />',"</div>"].join("\n"),c=i.browser.msie&&i.browser.version<9;c&&t.document.namespaces.add("v","urn:schemas-microsoft-com:vml"),e.exports={layout:o,slider:c?a:r,huebar:c?l:s}}).call(t,function(){return this}())}])})}])});