diff --git a/dist/tui-image-editor.css b/dist/tui-image-editor.css index c6fba2978..92aa803c5 100644 --- a/dist/tui-image-editor.css +++ b/dist/tui-image-editor.css @@ -1,6 +1,6 @@ /*! * tui-image-editor.js - * @version 3.5.0 + * @version 3.5.2 * @author NHNEnt FE Development Lab * @license MIT */ diff --git a/dist/tui-image-editor.js b/dist/tui-image-editor.js index ad9586d84..0a85e1572 100644 --- a/dist/tui-image-editor.js +++ b/dist/tui-image-editor.js @@ -1,19 +1,19 @@ /*! * tui-image-editor.js - * @version 3.5.0 + * @version 3.5.2 * @author NHNEnt FE Development Lab * @license MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("tui-code-snippet"), require("fabric/dist/fabric.require")); + module.exports = factory(require("tui-code-snippet"), require("tui-color-picker"), require("fabric/dist/fabric.require")); else if(typeof define === 'function' && define.amd) - define(["tui-code-snippet", "fabric/dist/fabric.require"], factory); + define(["tui-code-snippet", "tui-color-picker", "fabric/dist/fabric.require"], factory); else if(typeof exports === 'object') - exports["ImageEditor"] = factory(require("tui-code-snippet"), require("fabric/dist/fabric.require")); + exports["ImageEditor"] = factory(require("tui-code-snippet"), require("tui-color-picker"), require("fabric/dist/fabric.require")); else - root["tui"] = root["tui"] || {}, root["tui"]["ImageEditor"] = factory((root["tui"] && root["tui"]["util"]), root["fabric"]); -})(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_106__) { + root["tui"] = root["tui"] || {}, root["tui"]["ImageEditor"] = factory((root["tui"] && root["tui"]["util"]), (root["tui"] && root["tui"]["colorPicker"]), root["fabric"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_82__, __WEBPACK_EXTERNAL_MODULE_106__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -1867,9 +1867,6 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Number} pos.clientPosition.y - y * @example * imageEditor.on('addText', function(pos) { - * imageEditor.addText('Double Click', { - * position: pos.originPosition - * }); * console.log('text position on canvas: ' + pos.originPosition); * console.log('text position on brwoser: ' + pos.clientPosition); * }); @@ -6700,3221 +6697,9 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), /* 82 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { - /*! - * Toast UI Colorpicker - * @version 2.2.0 - * @author NHNEnt FE Development Team - * @license MIT - */ - (function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(__webpack_require__(3)); - else if(typeof define === 'function' && define.amd) - define(["tui-code-snippet"], factory); - else if(typeof exports === 'object') - exports["colorPicker"] = factory(require("tui-code-snippet")); - else - root["tui"] = root["tui"] || {}, root["tui"]["colorPicker"] = factory((root["tui"] && root["tui"]["util"])); - })(this, function(__WEBPACK_EXTERNAL_MODULE_8__) { - return /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; - - /******/ // The require function - /******/ function __webpack_require__(moduleId) { - - /******/ // Check if module is in cache - /******/ if(installedModules[moduleId]) - /******/ return installedModules[moduleId].exports; - - /******/ // Create a new module (and put it into the cache) - /******/ var module = installedModules[moduleId] = { - /******/ exports: {}, - /******/ id: moduleId, - /******/ loaded: false - /******/ }; - - /******/ // Execute the module function - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - - /******/ // Flag the module as loaded - /******/ module.loaded = true; - - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - - - /******/ // expose the modules object (__webpack_modules__) - /******/ __webpack_require__.m = modules; - - /******/ // expose the module cache - /******/ __webpack_require__.c = installedModules; - - /******/ // __webpack_public_path__ - /******/ __webpack_require__.p = "dist"; - - /******/ // Load entry module and return exports - /******/ return __webpack_require__(0); - /******/ }) - /************************************************************************/ - /******/ ([ - /* 0 */ - /***/ (function(module, exports, __webpack_require__) { - - __webpack_require__(1); - module.exports = __webpack_require__(6); - - - /***/ }), - /* 1 */ - /***/ (function(module, exports) { - - // removed by extract-text-webpack-plugin - - /***/ }), - /* 2 */, - /* 3 */, - /* 4 */, - /* 5 */, - /* 6 */ - /***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var domutil = __webpack_require__(7); - var domevent = __webpack_require__(9); - var Collection = __webpack_require__(10); - var View = __webpack_require__(11); - var Drag = __webpack_require__(12); - var create = __webpack_require__(13); - var Palette = __webpack_require__(16); - var Slider = __webpack_require__(18); - var colorutil = __webpack_require__(14); - var svgvml = __webpack_require__(19); - - var colorPicker = { - domutil: domutil, - domevent: domevent, - Collection: Collection, - View: View, - Drag: Drag, - - create: create, - Palette: Palette, - Slider: Slider, - colorutil: colorutil, - svgvml: svgvml - }; - - module.exports = colorPicker; - - /***/ }), - /* 7 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview Utility modules for manipulate DOM elements. - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var snippet = __webpack_require__(8); - var domevent = __webpack_require__(9); - var Collection = __webpack_require__(10); - - var util = snippet, - posKey = '_pos', - supportSelectStart = 'onselectstart' in document, - prevSelectStyle = '', - domutil, - userSelectProperty; - - var CSS_AUTO_REGEX = /^auto$|^$|%/; - - function trim(str) { - return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); - } - - domutil = { - /** - * Create DOM element and return it. - * @param {string} tagName Tag name to append. - * @param {HTMLElement} [container] HTML element will be parent to created element. - * if not supplied, will use **document.body** - * @param {string} [className] Design class names to appling created element. - * @returns {HTMLElement} HTML element created. - */ - appendHTMLElement: function (tagName, container, className) { - var el; - - className = className || ''; - - el = document.createElement(tagName); - el.className = className; - - if (container) { - container.appendChild(el); - } else { - document.body.appendChild(el); - } - - return el; - }, - - /** - * Remove element from parent node. - * @param {HTMLElement} el - element to remove. - */ - remove: function (el) { - if (el && el.parentNode) { - el.parentNode.removeChild(el); - } - }, - - /** - * Get element by id - * @param {string} id element id attribute - * @returns {HTMLElement} element - */ - get: function (id) { - return document.getElementById(id); - }, - - /** - * Check supplied element is matched selector. - * @param {HTMLElement} el - element to check - * @param {string} selector - selector string to check - * @returns {boolean} match? - */ - _matcher: function (el, selector) { - var cssClassSelector = /^\./, - idSelector = /^#/; - - if (cssClassSelector.test(selector)) { - return domutil.hasClass(el, selector.replace('.', '')); - } else if (idSelector.test(selector)) { - return el.id === selector.replace('#', ''); - } - - return el.nodeName.toLowerCase() === selector.toLowerCase(); - }, - - /** - * Find DOM element by specific selectors. - * below three selector only supported. - * - * 1. css selector - * 2. id selector - * 3. nodeName selector - * @param {string} selector selector - * @param {(HTMLElement|string)} [root] You can assign root element to find. if not supplied, document.body will use. - * @param {boolean|function} [multiple=false] - set true then return all elements that meet condition, if set function then use it filter function. - * @returns {HTMLElement} HTML element finded. - */ - find: function (selector, root, multiple) { - var result = [], - found = false, - isFirst = util.isUndefined(multiple) || multiple === false, - isFilter = util.isFunction(multiple); - - if (util.isString(root)) { - root = domutil.get(root); - } - - root = root || window.document.body; - - function recurse(el, selector) { - var childNodes = el.childNodes, - i = 0, - len = childNodes.length, - cursor; - - for (; i < len; i += 1) { - cursor = childNodes[i]; - - if (cursor.nodeName === '#text') { - continue; - } - - if (domutil._matcher(cursor, selector)) { - if (isFilter && multiple(cursor) || !isFilter) { - result.push(cursor); - } - - if (isFirst) { - found = true; - break; - } - } else if (cursor.childNodes.length > 0) { - recurse(cursor, selector); - if (found) { - break; - } - } - } - } - - recurse(root, selector); - - return isFirst ? result[0] || null : result; - }, - - /** - * Find parent element recursively. - * @param {HTMLElement} el - base element to start find. - * @param {string} selector - selector string for find - * @returns {HTMLElement} - element finded or undefined. - */ - closest: function (el, selector) { - var parent = el.parentNode; - - if (domutil._matcher(el, selector)) { - return el; - } - - while (parent && parent !== window.document.body) { - if (domutil._matcher(parent, selector)) { - return parent; - } - - parent = parent.parentNode; - } - }, - - /** - * Return texts inside element. - * @param {HTMLElement} el target element - * @returns {string} text inside node - */ - text: function (el) { - var ret = '', - i = 0, - nodeType = el.nodeType; - - if (nodeType) { - if (nodeType === 1 || nodeType === 9 || nodeType === 11) { - // nodes that available contain other nodes - if (typeof el.textContent === 'string') { - return el.textContent; - } - - for (el = el.firstChild; el; el = el.nextSibling) { - ret += domutil.text(el); - } - } else if (nodeType === 3 || nodeType === 4) { - // TEXT, CDATA SECTION - return el.nodeValue; - } - } else { - for (; el[i]; i += 1) { - ret += domutil.text(el[i]); - } - } - - return ret; - }, - - /** - * Set data attribute to target element - * @param {HTMLElement} el - element to set data attribute - * @param {string} key - key - * @param {string|number} data - data value - */ - setData: function (el, key, data) { - if ('dataset' in el) { - el.dataset[key] = data; - - return; - } - - el.setAttribute('data-' + key, data); - }, - - /** - * Get data value from data-attribute - * @param {HTMLElement} el - target element - * @param {string} key - key - * @returns {string} value - */ - getData: function (el, key) { - if ('dataset' in el) { - return el.dataset[key]; - } - - return el.getAttribute('data-' + key); - }, - - /** - * Check element has specific design class name. - * @param {HTMLElement} el target element - * @param {string} name css class - * @returns {boolean} return true when element has that css class name - */ - hasClass: function (el, name) { - var className; - - if (!util.isUndefined(el.classList)) { - return el.classList.contains(name); - } - - className = domutil.getClass(el); - - return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className); - }, - - /** - * Add design class to HTML element. - * @param {HTMLElement} el target element - * @param {string} name css class name - */ - addClass: function (el, name) { - var className; - - if (!util.isUndefined(el.classList)) { - util.forEachArray(name.split(' '), function (value) { - el.classList.add(value); - }); - } else if (!domutil.hasClass(el, name)) { - className = domutil.getClass(el); - domutil.setClass(el, (className ? className + ' ' : '') + name); - } - }, - - /** - * - * Overwrite design class to HTML element. - * @param {HTMLElement} el target element - * @param {string} name css class name - */ - setClass: function (el, name) { - if (util.isUndefined(el.className.baseVal)) { - el.className = name; - } else { - el.className.baseVal = name; - } - }, - - /** - * Element에 cssClass속성을 제거하는 메서드 - * Remove specific design class from HTML element. - * @param {HTMLElement} el target element - * @param {string} name class name to remove - */ - removeClass: function (el, name) { - var removed = ''; - - if (!util.isUndefined(el.classList)) { - el.classList.remove(name); - } else { - removed = (' ' + domutil.getClass(el) + ' ').replace(' ' + name + ' ', ' '); - domutil.setClass(el, trim(removed)); - } - }, - - /** - * Get HTML element's design classes. - * @param {HTMLElement} el target element - * @returns {string} element css class name - */ - getClass: function (el) { - if (!el || !el.className) { - return ''; - } - - return util.isUndefined(el.className.baseVal) ? el.className : el.className.baseVal; - }, - - /** - * Get specific CSS style value from HTML element. - * @param {HTMLElement} el target element - * @param {string} style css attribute name - * @returns {(string|null)} css style value - */ - getStyle: function (el, style) { - var value = el.style[style] || el.currentStyle && el.currentStyle[style], - css; - - if ((!value || value === 'auto') && document.defaultView) { - css = document.defaultView.getComputedStyle(el, null); - value = css ? css[style] : null; - } - - return value === 'auto' ? null : value; - }, - - /** - * get element's computed style values. - * - * in lower IE8. use polyfill function that return object. it has only one function 'getPropertyValue' - * @param {HTMLElement} el - element want to get style. - * @returns {object} virtual CSSStyleDeclaration object. - */ - getComputedStyle: function (el) { - var defaultView = document.defaultView; - - if (!defaultView || !defaultView.getComputedStyle) { - return { - getPropertyValue: function (prop) { - var re = /(\-([a-z]){1})/g; - if (prop === 'float') { - prop = 'styleFloat'; - } - - if (re.test(prop)) { - prop = prop.replace(re, function () { - return arguments[2].toUpperCase(); - }); - } - - return el.currentStyle[prop] ? el.currentStyle[prop] : null; - } - }; - } - - return document.defaultView.getComputedStyle(el); - }, - - /** - * Set position CSS style. - * @param {HTMLElement} el target element - * @param {number} [x=0] left pixel value. - * @param {number} [y=0] top pixel value. - */ - setPosition: function (el, x, y) { - x = util.isUndefined(x) ? 0 : x; - y = util.isUndefined(y) ? 0 : y; - - el[posKey] = [x, y]; - - el.style.left = x + 'px'; - el.style.top = y + 'px'; - }, - - /** - * Get position from HTML element. - * @param {HTMLElement} el target element - * @param {boolean} [clear=false] clear cache before calculating position. - * @returns {number[]} point - */ - getPosition: function (el, clear) { - var left, top, bound; - - if (clear) { - el[posKey] = null; - } - - if (el[posKey]) { - return el[posKey]; - } - - left = 0; - top = 0; - - if ((CSS_AUTO_REGEX.test(el.style.left) || CSS_AUTO_REGEX.test(el.style.top)) && 'getBoundingClientRect' in el) { - // 엘리먼트의 left또는 top이 'auto'일 때 수단 - bound = el.getBoundingClientRect(); - - left = bound.left; - top = bound.top; - } else { - left = parseFloat(el.style.left || 0); - top = parseFloat(el.style.top || 0); - } - - return [left, top]; - }, - - /** - * Return element's size - * @param {HTMLElement} el target element - * @returns {number[]} width, height - */ - getSize: function (el) { - var bound, - width = domutil.getStyle(el, 'width'), - height = domutil.getStyle(el, 'height'); - - if ((CSS_AUTO_REGEX.test(width) || CSS_AUTO_REGEX.test(height)) && 'getBoundingClientRect' in el) { - bound = el.getBoundingClientRect(); - width = bound.width; - height = bound.height; - } else { - width = parseFloat(width || 0); - height = parseFloat(height || 0); - } - - return [width, height]; - }, - - /** - * Check specific CSS style is available. - * @param {array} props property name to testing - * @returns {(string|boolean)} return true when property is available - * @example - * var props = ['transform', '-webkit-transform']; - * domutil.testProp(props); // 'transform' - */ - testProp: function (props) { - var style = document.documentElement.style, - i = 0, - len = props.length; - - for (; i < len; i += 1) { - if (props[i] in style) { - return props[i]; - } - } - - return false; - }, - - /** - * Get form data - * @param {HTMLFormElement} formElement - form element to extract data - * @returns {object} form data - */ - getFormData: function (formElement) { - var groupedByName = new Collection(function () { - return this.length; - }), - noDisabledFilter = function (el) { - return !el.disabled; - }, - output = {}; - - groupedByName.add.apply(groupedByName, domutil.find('input', formElement, noDisabledFilter).concat(domutil.find('select', formElement, noDisabledFilter)).concat(domutil.find('textarea', formElement, noDisabledFilter))); - - groupedByName = groupedByName.groupBy(function (el) { - return el && el.getAttribute('name') || '_other'; - }); - - util.forEach(groupedByName, function (elements, name) { - if (name === '_other') { - return; - } - - elements.each(function (el) { - var nodeName = el.nodeName.toLowerCase(), - type = el.type, - result = []; - - if (type === 'radio') { - result = [elements.find(function (el) { - return el.checked; - }).toArray().pop()]; - } else if (type === 'checkbox') { - result = elements.find(function (el) { - return el.checked; - }).toArray(); - } else if (nodeName === 'select') { - elements.find(function (el) { - return !!el.childNodes.length; - }).each(function (el) { - result = result.concat(domutil.find('option', el, function (opt) { - return opt.selected; - })); - }); - } else { - result = elements.find(function (el) { - return el.value !== ''; - }).toArray(); - } - - result = util.map(result, function (el) { - return el.value; - }); - - if (!result.length) { - result = ''; - } else if (result.length === 1) { - result = result[0]; - } - - output[name] = result; - }); - }); - - return output; - } - }; - - userSelectProperty = domutil.testProp(['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']); - - /** - * Disable browser's text selection behaviors. - * @method - */ - domutil.disableTextSelection = function () { - if (supportSelectStart) { - return function () { - domevent.on(window, 'selectstart', domevent.preventDefault); - }; - } - - return function () { - var style = document.documentElement.style; - prevSelectStyle = style[userSelectProperty]; - style[userSelectProperty] = 'none'; - }; - }(); - - /** - * Enable browser's text selection behaviors. - * @method - */ - domutil.enableTextSelection = function () { - if (supportSelectStart) { - return function () { - domevent.off(window, 'selectstart', domevent.preventDefault); - }; - } - - return function () { - document.documentElement.style[userSelectProperty] = prevSelectStyle; - }; - }(); - - /** - * Disable browser's image drag behaviors. - */ - domutil.disableImageDrag = function () { - domevent.on(window, 'dragstart', domevent.preventDefault); - }; - - /** - * Enable browser's image drag behaviors. - */ - domutil.enableImageDrag = function () { - domevent.off(window, 'dragstart', domevent.preventDefault); - }; - - /** - * Replace matched property with template - * @param {string} template - String of template - * @param {Object} propObj - Properties - * @returns {string} Replaced template string - */ - domutil.applyTemplate = function (template, propObj) { - var newTemplate = template.replace(/\{\{(\w*)\}\}/g, function (value, prop) { - return propObj.hasOwnProperty(prop) ? propObj[prop] : ''; - }); - - return newTemplate; - }; - - module.exports = domutil; - - /***/ }), - /* 8 */ - /***/ (function(module, exports) { - - module.exports = __WEBPACK_EXTERNAL_MODULE_8__; - - /***/ }), - /* 9 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview Utility module for handling DOM events. - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var snippet = __webpack_require__(8); - - var util = snippet, - browser = util.browser, - eventKey = '_evt', - DRAG = { - START: ['touchstart', 'mousedown'], - END: { - mousedown: 'mouseup', - touchstart: 'touchend', - pointerdown: 'touchend', - MSPointerDown: 'touchend' - }, - MOVE: { - mousedown: 'mousemove', - touchstart: 'touchmove', - pointerdown: 'touchmove', - MSPointerDown: 'touchmove' - } - }; - - var domevent = { - /** - * Bind dom events. - * @param {HTMLElement} obj HTMLElement to bind events. - * @param {(string|object)} types Space splitted events names or eventName:handler object. - * @param {*} fn handler function or context for handler method. - * @param {*} [context] context object for handler method. - */ - on: function (obj, types, fn, context) { - if (util.isString(types)) { - util.forEach(types.split(' '), function (type) { - domevent._on(obj, type, fn, context); - }); - - return; - } - - util.forEachOwnProperties(types, function (handler, type) { - domevent._on(obj, type, handler, fn); - }); - }, - - /** - * DOM event binding. - * @param {HTMLElement} obj HTMLElement to bind events. - * @param {String} type The name of events. - * @param {*} fn handler function - * @param {*} [context] context object for handler method. - * @private - */ - _on: function (obj, type, fn, context) { - var id, handler, originHandler; - - id = type + util.stamp(fn) + (context ? '_' + util.stamp(context) : ''); - - if (obj[eventKey] && obj[eventKey][id]) { - return; - } - - handler = function (e) { - fn.call(context || obj, e || window.event); - }; - - originHandler = handler; - - if ('addEventListener' in obj) { - if (type === 'mouseenter' || type === 'mouseleave') { - handler = function (e) { - e = e || window.event; - if (!domevent._checkMouse(obj, e)) { - return; - } - originHandler(e); - }; - obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false); - } else { - if (type === 'mousewheel') { - obj.addEventListener('DOMMouseScroll', handler, false); - } - - obj.addEventListener(type, handler, false); - } - } else if ('attachEvent' in obj) { - obj.attachEvent('on' + type, handler); - } - - obj[eventKey] = obj[eventKey] || {}; - obj[eventKey][id] = handler; - }, - - /** - * Unbind DOM Event handler. - * @param {HTMLElement} obj HTMLElement to unbind. - * @param {(string|object)} types Space splitted events names or eventName:handler object. - * @param {*} fn handler function or context for handler method. - * @param {*} [context] context object for handler method. - */ - off: function (obj, types, fn, context) { - if (util.isString(types)) { - util.forEach(types.split(' '), function (type) { - domevent._off(obj, type, fn, context); - }); - - return; - } - - util.forEachOwnProperties(types, function (handler, type) { - domevent._off(obj, type, handler, fn); - }); - }, - - /** - * Unbind DOM event handler. - * @param {HTMLElement} obj HTMLElement to unbind. - * @param {String} type The name of event to unbind. - * @param {function()} fn Event handler that supplied when binding. - * @param {*} context context object that supplied when binding. - * @private - */ - _off: function (obj, type, fn, context) { - var id = type + util.stamp(fn) + (context ? '_' + util.stamp(context) : ''), - handler = obj[eventKey] && obj[eventKey][id]; - - if (!handler) { - return; - } - - if ('removeEventListener' in obj) { - if (type === 'mouseenter' || type === 'mouseleave') { - obj.removeEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false); - } else { - if (type === 'mousewheel') { - obj.removeEventListener('DOMMouseScroll', handler, false); - } - - obj.removeEventListener(type, handler, false); - } - } else if ('detachEvent' in obj) { - try { - obj.detachEvent('on' + type, handler); - } catch (e) {} //eslint-disable-line - } - - delete obj[eventKey][id]; - - if (util.keys(obj[eventKey]).length) { - return; - } - - // throw exception when deleting host object's property in below IE8 - if (util.browser.msie && util.browser.version < 9) { - obj[eventKey] = null; - - return; - } - - delete obj[eventKey]; - }, - - /** - * Bind DOM event. this event will unbind after invokes. - * @param {HTMLElement} obj HTMLElement to bind events. - * @param {(string|object)} types Space splitted events names or eventName:handler object. - * @param {*} fn handler function or context for handler method. - * @param {*} [context] context object for handler method. - */ - once: function (obj, types, fn, context) { - var that = this; - - if (util.isObject(types)) { - util.forEachOwnProperties(types, function (handler, type) { - domevent.once(obj, type, handler, fn); - }); - - return; - } - - function onceHandler() { - fn.apply(context || obj, arguments); - that._off(obj, types, onceHandler, context); - } - - domevent.on(obj, types, onceHandler, context); - }, - - /** - * Cancel event bubbling. - * @param {Event} e Event object. - */ - stopPropagation: function (e) { - if (e.stopPropagation) { - e.stopPropagation(); - } else { - e.cancelBubble = true; - } - }, - - /** - * Cancel browser default actions. - * @param {Event} e Event object. - */ - preventDefault: function (e) { - if (e.preventDefault) { - e.preventDefault(); - } else { - e.returnValue = false; - } - }, - - /** - * Syntatic sugar of stopPropagation and preventDefault - * @param {Event} e Event object. - */ - stop: function (e) { - domevent.preventDefault(e); - domevent.stopPropagation(e); - }, - - /** - * Stop scroll events. - * @param {HTMLElement} el HTML element to prevent scroll. - */ - disableScrollPropagation: function (el) { - domevent.on(el, 'mousewheel MozMousePixelScroll', domevent.stopPropagation); - }, - - /** - * Stop all events related with click. - * @param {HTMLElement} el HTML element to prevent all event related with click. - */ - disableClickPropagation: function (el) { - domevent.on(el, DRAG.START.join(' ') + ' click dblclick', domevent.stopPropagation); - }, - - /** - * Get mouse position from mouse event. - * - * If supplied relatveElement parameter then return relative position based on element. - * @param {Event} mouseEvent Mouse event object - * @param {HTMLElement} relativeElement HTML element that calculate relative position. - * @returns {number[]} mouse position. - */ - getMousePosition: function (mouseEvent, relativeElement) { - var rect; - - if (!relativeElement) { - return [mouseEvent.clientX, mouseEvent.clientY]; - } - - rect = relativeElement.getBoundingClientRect(); - - return [mouseEvent.clientX - rect.left - relativeElement.clientLeft, mouseEvent.clientY - rect.top - relativeElement.clientTop]; - }, - - /** - * Normalize mouse wheel event that different each browsers. - * @param {MouseEvent} e Mouse wheel event. - * @returns {Number} delta - */ - getWheelDelta: function (e) { - var delta = 0; - - if (e.wheelDelta) { - delta = e.wheelDelta / 120; - } - - if (e.detail) { - delta = -e.detail / 3; - } - - return delta; - }, - - /** - * prevent firing mouseleave event when mouse entered child elements. - * @param {HTMLElement} el HTML element - * @param {MouseEvent} e Mouse event - * @returns {Boolean} leave? - * @private - */ - _checkMouse: function (el, e) { - var related = e.relatedTarget; - - if (!related) { - return true; - } - - try { - while (related && related !== el) { - related = related.parentNode; - } - } catch (err) { - return false; - } - - return related !== el; - }, - - /** - * Trigger specific events to html element. - * @param {HTMLElement} obj HTMLElement - * @param {string} type Event type name - * @param {object} [eventData] Event data - */ - trigger: function (obj, type, eventData) { - var rMouseEvent = /(mouse|click)/; - if (util.isUndefined(eventData) && rMouseEvent.exec(type)) { - eventData = domevent.mouseEvent(type); - } - - if (obj.dispatchEvent) { - obj.dispatchEvent(eventData); - } else if (obj.fireEvent) { - obj.fireEvent('on' + type, eventData); - } - }, - - /** - * Create virtual mouse event. - * - * Tested at - * - * - IE7 ~ IE11 - * - Chrome - * - Firefox - * - Safari - * @param {string} type Event type - * @param {object} [eventObj] Event data - * @returns {MouseEvent} Virtual mouse event. - */ - mouseEvent: function (type, eventObj) { - var evt, e; - - e = util.extend({ - bubbles: true, - cancelable: type !== 'mousemove', - view: window, - wheelDelta: 0, - detail: 0, - screenX: 0, - screenY: 0, - clientX: 0, - clientY: 0, - ctrlKey: false, - altKey: false, - shiftKey: false, - metaKey: false, - button: 0, - relatedTarget: undefined // eslint-disable-line - }, eventObj); - - // prevent throw error when inserting wheelDelta property to mouse event on below IE8 - if (browser.msie && browser.version < 9) { - delete e.wheelDelta; - } - - if (typeof document.createEvent === 'function') { - evt = document.createEvent('MouseEvents'); - evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, document.body.parentNode); - } else if (document.createEventObject) { - evt = document.createEventObject(); - - util.forEach(e, function (value, propName) { - evt[propName] = value; - }, this); - evt.button = { - 0: 1, - 1: 4, - 2: 2 - }[evt.button] || evt.button; - } - - return evt; - }, - - /** - * Normalize mouse event's button attributes. - * - * Can detect which button is clicked by this method. - * - * Meaning of return numbers - * - * - 0: primary mouse button - * - 1: wheel button or center button - * - 2: secondary mouse button - * @param {MouseEvent} mouseEvent - The mouse event object want to know. - * @returns {number} - The value of meaning which button is clicked? - */ - getMouseButton: function (mouseEvent) { - var button, - primary = '0,1,3,5,7', - secondary = '2,6', - wheel = '4'; - - /* istanbul ignore else */ - if (document.implementation.hasFeature('MouseEvents', '2.0')) { - return mouseEvent.button; - } - - button = mouseEvent.button + ''; - if (~primary.indexOf(button)) { - return 0; - } else if (~secondary.indexOf(button)) { - return 2; - } else if (~wheel.indexOf(button)) { - return 1; - } - } - }; - - module.exports = domevent; - - /***/ }), - /* 10 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview Common collections. - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var snippet = __webpack_require__(8); - - var util = snippet, - forEachProp = util.forEachOwnProperties, - forEachArr = util.forEachArray, - isFunc = util.isFunction, - isObj = util.isObject; - - var aps = Array.prototype.slice; - - /** - * Common collection. - * - * It need function for get model's unique id. - * - * if the function is not supplied then it use default function {@link Collection#getItemID} - * @constructor - * @param {function} [getItemIDFn] function for get model's id. - * @ignore - */ - function Collection(getItemIDFn) { - /** - * @type {object.} - */ - this.items = {}; - - /** - * @type {number} - */ - this.length = 0; - - if (isFunc(getItemIDFn)) { - /** - * @type {function} - */ - this.getItemID = getItemIDFn; - } - } - - /********** - * static props - **********/ - - /** - * Combind supplied function filters and condition. - * @param {...function} filters - function filters - * @returns {function} combined filter - */ - Collection.and = function (filters) { - var cnt; - - filters = aps.call(arguments); - cnt = filters.length; - - return function (item) { - var i = 0; - - for (; i < cnt; i += 1) { - if (!filters[i].call(null, item)) { - return false; - } - } - - return true; - }; - }; - - /** - * Combine multiple function filters with OR clause. - * @param {...function} filters - function filters - * @returns {function} combined filter - */ - Collection.or = function (filters) { - var cnt; - - filters = aps.call(arguments); - cnt = filters.length; - - return function (item) { - var i = 1, - result = filters[0].call(null, item); - - for (; i < cnt; i += 1) { - result = result || filters[i].call(null, item); - } - - return result; - }; - }; - - /** - * Merge several collections. - * - * You can\'t merge collections different _getEventID functions. Take case of use. - * @param {...Collection} collections collection arguments to merge - * @returns {Collection} merged collection. - */ - Collection.merge = function (collections) { - // eslint-disable-line - var cols = aps.call(arguments), - newItems = {}, - merged = new Collection(cols[0].getItemID), - extend = util.extend; - - forEachArr(cols, function (col) { - extend(newItems, col.items); - }); - - merged.items = newItems; - merged.length = util.keys(merged.items).length; - - return merged; - }; - - /********** - * prototype props - **********/ - - /** - * get model's unique id. - * @param {object} item model instance. - * @returns {number} model unique id. - */ - Collection.prototype.getItemID = function (item) { - return item._id + ''; - }; - - /** - * add models. - * @param {...*} item models to add this collection. - */ - Collection.prototype.add = function (item) { - var id, ownItems; - - if (arguments.length > 1) { - forEachArr(aps.call(arguments), function (o) { - this.add(o); - }, this); - - return; - } - - id = this.getItemID(item); - ownItems = this.items; - - if (!ownItems[id]) { - this.length += 1; - } - ownItems[id] = item; - }; - - /** - * remove models. - * @param {...(object|string|number)} id model instance or unique id to delete. - * @returns {array} deleted model list. - */ - Collection.prototype.remove = function (id) { - var removed = [], - ownItems, - itemToRemove; - - if (!this.length) { - return removed; - } - - if (arguments.length > 1) { - removed = util.map(aps.call(arguments), function (id) { - return this.remove(id); - }, this); - - return removed; - } - - ownItems = this.items; - - if (isObj(id)) { - id = this.getItemID(id); - } - - if (!ownItems[id]) { - return removed; - } - - this.length -= 1; - itemToRemove = ownItems[id]; - delete ownItems[id]; - - return itemToRemove; - }; - - /** - * remove all models in collection. - */ - Collection.prototype.clear = function () { - this.items = {}; - this.length = 0; - }; - - /** - * check collection has specific model. - * @param {(object|string|number|function)} id model instance or id or filter function to check - * @returns {boolean} is has model? - */ - Collection.prototype.has = function (id) { - var isFilter, has; - - if (!this.length) { - return false; - } - - isFilter = isFunc(id); - has = false; - - if (isFilter) { - this.each(function (item) { - if (id(item) === true) { - has = true; - - return false; - } - - return true; - }); - } else { - id = isObj(id) ? this.getItemID(id) : id; - has = util.isExisty(this.items[id]); - } - - return has; - }; - - /** - * invoke callback when model exist in collection. - * @param {(string|number)} id model unique id. - * @param {function} fn the callback. - * @param {*} [context] callback context. - */ - Collection.prototype.doWhenHas = function (id, fn, context) { - var item = this.items[id]; - - if (!util.isExisty(item)) { - return; - } - - fn.call(context || this, item); - }; - - /** - * Search model. and return new collection. - * @param {function} filter filter function. - * @returns {Collection} new collection with filtered models. - * @example - * collection.find(function(item) { - * return item.edited === true; - * }); - * - * function filter1(item) { - * return item.edited === false; - * } - * - * function filter2(item) { - * return item.disabled === false; - * } - * - * collection.find(Collection.and(filter1, filter2)); - * - * collection.find(Collection.or(filter1, filter2)); - */ - Collection.prototype.find = function (filter) { - var result = new Collection(); - - if (this.hasOwnProperty('getItemID')) { - result.getItemID = this.getItemID; - } - - this.each(function (item) { - if (filter(item) === true) { - result.add(item); - } - }); - - return result; - }; - - /** - * Group element by specific key values. - * - * if key parameter is function then invoke it and use returned value. - * @param {(string|number|function|array)} key key property or getter function. if string[] supplied, create each collection before grouping. - * @param {function} [groupFunc] - function that return each group's key - * @returns {object.} grouped object - * @example - * - * // pass `string`, `number`, `boolean` type value then group by property value. - * collection.groupBy('gender'); // group by 'gender' property value. - * collection.groupBy(50); // group by '50' property value. - * - * // pass `function` then group by return value. each invocation `function` is called with `(item)`. - * collection.groupBy(function(item) { - * if (item.score > 60) { - * return 'pass'; - * } - * return 'fail'; - * }); - * - * // pass `array` with first arguments then create each collection before grouping. - * collection.groupBy(['go', 'ruby', 'javascript']); - * // result: { 'go': empty Collection, 'ruby': empty Collection, 'javascript': empty Collection } - * - * // can pass `function` with `array` then group each elements. - * collection.groupBy(['go', 'ruby', 'javascript'], function(item) { - * if (item.isFast) { - * return 'go'; - * } - * - * return item.name; - * }); - */ - Collection.prototype.groupBy = function (key, groupFunc) { - var result = {}, - collection, - baseValue, - keyIsFunc = isFunc(key), - getItemIDFn = this.getItemID; - - if (util.isArray(key)) { - util.forEachArray(key, function (k) { - result[k + ''] = new Collection(getItemIDFn); - }); - - if (!groupFunc) { - return result; - } - - key = groupFunc; - keyIsFunc = true; - } - - this.each(function (item) { - if (keyIsFunc) { - baseValue = key(item); - } else { - baseValue = item[key]; - - if (isFunc(baseValue)) { - baseValue = baseValue.apply(item); - } - } - - collection = result[baseValue]; - - if (!collection) { - collection = result[baseValue] = new Collection(getItemIDFn); - } - - collection.add(item); - }); - - return result; - }; - - /** - * Return single item in collection. - * - * Returned item is inserted in this collection firstly. - * @returns {object} item. - */ - Collection.prototype.single = function () { - var result; - - this.each(function (item) { - result = item; - - return false; - }, this); - - return result; - }; - - /** - * sort a basis of supplied compare function. - * @param {function} compareFunction compareFunction - * @returns {array} sorted array. - */ - Collection.prototype.sort = function (compareFunction) { - var arr = []; - - this.each(function (item) { - arr.push(item); - }); - - if (isFunc(compareFunction)) { - arr = arr.sort(compareFunction); - } - - return arr; - }; - - /** - * iterate each model element. - * - * when iteratee return false then break the loop. - * @param {function} iteratee iteratee(item, index, items) - * @param {*} [context] context - */ - Collection.prototype.each = function (iteratee, context) { - forEachProp(this.items, iteratee, context || this); - }; - - /** - * return new array with collection items. - * @returns {array} new array. - */ - Collection.prototype.toArray = function () { - if (!this.length) { - return []; - } - - return util.map(this.items, function (item) { - return item; - }); - }; - - module.exports = Collection; - - /***/ }), - /* 11 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview The base class of views. - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - var domutil = __webpack_require__(7); - var Collection = __webpack_require__(10); - - /** - * Base class of views. - * - * All views create own container element inside supplied container element. - * @constructor - * @param {options} options The object for describe view's specs. - * @param {HTMLElement} container Default container element for view. you can use this element for this.container syntax. - * @ignore - */ - function View(options, container) { - var id = util.stamp(this); - - options = options || {}; - - if (util.isUndefined(container)) { - container = domutil.appendHTMLElement('div'); - } - - domutil.addClass(container, 'tui-view-' + id); - - /** - * unique id - * @type {number} - */ - this.id = id; - - /** - * base element of view. - * @type {HTMLDIVElement} - */ - this.container = container; - - /** - * child views. - * @type {Collection} - */ - this.childs = new Collection(function (view) { - return util.stamp(view); - }); - - /** - * parent view instance. - * @type {View} - */ - this.parent = null; - } - - /** - * Add child views. - * @param {View} view The view instance to add. - * @param {function} [fn] Function for invoke before add. parent view class is supplied first arguments. - */ - View.prototype.addChild = function (view, fn) { - if (fn) { - fn.call(view, this); - } - // add parent view - view.parent = this; - - this.childs.add(view); - }; - - /** - * Remove added child view. - * @param {(number|View)} id View id or instance itself to remove. - * @param {function} [fn] Function for invoke before remove. parent view class is supplied first arguments. - */ - View.prototype.removeChild = function (id, fn) { - var view = util.isNumber(id) ? this.childs.items[id] : id; - - id = util.stamp(view); - - if (fn) { - fn.call(view, this); - } - - this.childs.remove(id); - }; - - /** - * Render view recursively. - */ - View.prototype.render = function () { - this.childs.each(function (childView) { - childView.render(); - }); - }; - - /** - * Invoke function recursively. - * @param {function} fn - function to invoke child view recursively - * @param {boolean} [skipThis=false] - set true then skip invoke with this(root) view. - */ - View.prototype.recursive = function (fn, skipThis) { - if (!util.isFunction(fn)) { - return; - } - - if (!skipThis) { - fn(this); - } - - this.childs.each(function (childView) { - childView.recursive(fn); - }); - }; - - /** - * Resize view recursively to parent. - */ - View.prototype.resize = function () { - var args = Array.prototype.slice.call(arguments), - parent = this.parent; - - while (parent) { - if (util.isFunction(parent._onResize)) { - parent._onResize.apply(parent, args); - } - - parent = parent.parent; - } - }; - - /** - * Invoking method before destroying. - */ - View.prototype._beforeDestroy = function () {}; - - /** - * Clear properties - */ - View.prototype._destroy = function () { - this._beforeDestroy(); - this.childs.clear(); - this.container.innerHTML = ''; - - this.id = this.parent = this.childs = this.container = null; - }; - - /** - * Destroy child view recursively. - * @param {boolean} isChildView - Whether it is the child view or not - */ - View.prototype.destroy = function (isChildView) { - this.childs.each(function (childView) { - childView.destroy(true); - childView._destroy(); - }); - - if (isChildView) { - return; - } - - this._destroy(); - }; - - /** - * Calculate view's container element bound. - * @returns {object} The bound of container element. - */ - View.prototype.getViewBound = function () { - var container = this.container, - position = domutil.getPosition(container), - size = domutil.getSize(container); - - return { - x: position[0], - y: position[1], - width: size[0], - height: size[1] - }; - }; - - module.exports = View; - - /***/ }), - /* 12 */ - /***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {/** - * @fileoverview General drag handler - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - var domutil = __webpack_require__(7); - var domevent = __webpack_require__(9); - - /** - * @constructor - * @mixes CustomEvents - * @param {object} options - options for drag handler - * @param {number} [options.distance=10] - distance in pixels after mouse must move before dragging should start - * @param {HTMLElement} container - container element to bind drag events - * @ignore - */ - function Drag(options, container) { - domevent.on(container, 'mousedown', this._onMouseDown, this); - - this.options = util.extend({ - distance: 10 - }, options); - - /** - * @type {HTMLElement} - */ - this.container = container; - - /** - * @type {boolean} - */ - this._isMoved = false; - - /** - * dragging distance in pixel between mousedown and firing dragStart events - * @type {number} - */ - this._distance = 0; - - /** - * @type {boolean} - */ - this._dragStartFired = false; - - /** - * @type {object} - */ - this._dragStartEventData = null; - } - - /** - * Destroy method. - */ - Drag.prototype.destroy = function () { - domevent.off(this.container, 'mousedown', this._onMouseDown, this); - - this.options = this.container = this._isMoved = this._distance = this._dragStartFired = this._dragStartEventData = null; - }; - - /** - * Toggle events for mouse dragging. - * @param {boolean} toBind - bind events related with dragging when supplied "true" - */ - Drag.prototype._toggleDragEvent = function (toBind) { - var container = this.container, - domMethod, - method; - - if (toBind) { - domMethod = 'on'; - method = 'disable'; - } else { - domMethod = 'off'; - method = 'enable'; - } - - domutil[method + 'TextSelection'](container); - domutil[method + 'ImageDrag'](container); - domevent[domMethod](global.document, { - mousemove: this._onMouseMove, - mouseup: this._onMouseUp - }, this); - }; - - /** - * Normalize mouse event object. - * @param {MouseEvent} mouseEvent - mouse event object. - * @returns {object} normalized mouse event data. - */ - Drag.prototype._getEventData = function (mouseEvent) { - return { - target: mouseEvent.target || mouseEvent.srcElement, - originEvent: mouseEvent - }; - }; - - /** - * MouseDown DOM event handler. - * @param {MouseEvent} mouseDownEvent MouseDown event object. - */ - Drag.prototype._onMouseDown = function (mouseDownEvent) { - // only primary button can start drag. - if (domevent.getMouseButton(mouseDownEvent) !== 0) { - return; - } - - this._distance = 0; - this._dragStartFired = false; - this._dragStartEventData = this._getEventData(mouseDownEvent); - - this._toggleDragEvent(true); - }; - - /** - * MouseMove DOM event handler. - * @emits Drag#drag - * @emits Drag#dragStart - * @param {MouseEvent} mouseMoveEvent MouseMove event object. - */ - Drag.prototype._onMouseMove = function (mouseMoveEvent) { - var distance = this.options.distance; - // prevent automatic scrolling. - domevent.preventDefault(mouseMoveEvent); - - this._isMoved = true; - - if (this._distance < distance) { - this._distance += 1; - - return; - } - - if (!this._dragStartFired) { - this._dragStartFired = true; - - /** - * Drag starts events. cancelable. - * @event Drag#dragStart - * @type {object} - * @property {HTMLElement} target - target element in this event. - * @property {MouseEvent} originEvent - original mouse event object. - */ - if (!this.invoke('dragStart', this._dragStartEventData)) { - this._toggleDragEvent(false); - - return; - } - } - - /** - * Events while dragging. - * @event Drag#drag - * @type {object} - * @property {HTMLElement} target - target element in this event. - * @property {MouseEvent} originEvent - original mouse event object. - */ - this.fire('drag', this._getEventData(mouseMoveEvent)); - }; - - /** - * MouseUp DOM event handler. - * @param {MouseEvent} mouseUpEvent MouseUp event object. - * @emits Drag#dragEnd - * @emits Drag#click - */ - Drag.prototype._onMouseUp = function (mouseUpEvent) { - this._toggleDragEvent(false); - - // emit "click" event when not emitted drag event between mousedown and mouseup. - if (this._isMoved) { - this._isMoved = false; - - /** - * Drag end events. - * @event Drag#dragEnd - * @type {MouseEvent} - * @property {HTMLElement} target - target element in this event. - * @property {MouseEvent} originEvent - original mouse event object. - */ - this.fire('dragEnd', this._getEventData(mouseUpEvent)); - - return; - } - - /** - * Click events. - * @event Drag#click - * @type {MouseEvent} - * @property {HTMLElement} target - target element in this event. - * @property {MouseEvent} originEvent - original mouse event object. - */ - this.fire('click', this._getEventData(mouseUpEvent)); - }; - - util.CustomEvents.mixin(Drag); - - module.exports = Drag; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - - /***/ }), - /* 13 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview ColorPicker factory module - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - var colorutil = __webpack_require__(14); - var Layout = __webpack_require__(15); - var Palette = __webpack_require__(16); - var Slider = __webpack_require__(18); - - var hostnameSent = false; - - /** - * send hostname - * @ignore - */ - function sendHostname() { - var hostname = location.hostname; - - if (hostnameSent) { - return; - } - hostnameSent = true; - - util.imagePing('https://www.google-analytics.com/collect', { - v: 1, - t: 'event', - tid: 'UA-115377265-9', - cid: hostname, - dp: hostname, - dh: 'color-picker' - }); - } - - /** - * @constructor - * @mixes CustomEvents - * @param {object} options - options for colorpicker component - * @param {HTMLDivElement} options.container - container element - * @param {string} [options.color='#ffffff'] - default selected color - * @param {string[]} [options.preset] - color preset for palette (use base16 palette if not supplied) - * @param {string} [options.cssPrefix='tui-colorpicker-'] - css prefix text for each child elements - * @param {string} [options.detailTxt='Detail'] - text for detail button. - * @param {boolean} [options.usageStatistics=true] - Let us know the hostname. If you don't want to send the hostname, please set to false. - * @example - * var colorPicker = tui.colorPicker; // or require('tui-color-picker') - * - * colorPicker.create({ - * container: document.getElementById('color-picker') - * }); - */ - function ColorPicker(options) { - var layout; - - if (!(this instanceof ColorPicker)) { - return new ColorPicker(options); - } - /** - * Option object - * @type {object} - * @private - */ - options = this.options = util.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: true - }, options); - - if (!options.container) { - throw new Error('ColorPicker(): need container option.'); - } - - /********** - * Create layout view - **********/ - - /** - * @type {Layout} - * @private - */ - layout = this.layout = new Layout(options, options.container); - - /********** - * Create palette view - **********/ - this.palette = new Palette(options, layout.container); - this.palette.on({ - '_selectColor': this._onSelectColorInPalette, - '_toggleSlider': this._onToggleSlider - }, this); - - /********** - * Create slider view - **********/ - this.slider = new Slider(options, layout.container); - this.slider.on('_selectColor', this._onSelectColorInSlider, this); - - /********** - * Add child views - **********/ - layout.addChild(this.palette); - layout.addChild(this.slider); - - this.render(options.color); - - if (options.usageStatistics) { - sendHostname(); - } - } - - /** - * Handler method for Palette#_selectColor event - * @private - * @fires ColorPicker#selectColor - * @param {object} selectColorEventData - event data - */ - ColorPicker.prototype._onSelectColorInPalette = function (selectColorEventData) { - var color = selectColorEventData.color, - opt = this.options; - - if (!colorutil.isValidRGB(color) && color !== '') { - this.render(); - - return; - } - - /** - * @event ColorPicker#selectColor - * @type {object} - * @property {string} color - selected color (hex string) - * @property {string} origin - flags for represent the source of event fires. - */ - this.fire('selectColor', { - color: color, - origin: 'palette' - }); - - if (opt.color === color) { - return; - } - - opt.color = color; - this.render(color); - }; - - /** - * Handler method for Palette#_toggleSlider event - * @private - */ - ColorPicker.prototype._onToggleSlider = function () { - this.slider.toggle(!this.slider.isVisible()); - }; - - /** - * Handler method for Slider#_selectColor event - * @private - * @fires ColorPicker#selectColor - * @param {object} selectColorEventData - event data - */ - ColorPicker.prototype._onSelectColorInSlider = function (selectColorEventData) { - var color = selectColorEventData.color, - opt = this.options; - - /** - * @event ColorPicker#selectColor - * @type {object} - * @property {string} color - selected color (hex string) - * @property {string} origin - flags for represent the source of event fires. - * @ignore - */ - this.fire('selectColor', { - color: color, - origin: 'slider' - }); - - if (opt.color === color) { - return; - } - - opt.color = color; - this.palette.render(color); - }; - - /********** - * PUBLIC API - **********/ - - /** - * Set color to colorpicker instance.
- * The string parameter must be hex color value - * @param {string} hexStr - hex formatted color string - * @example - * colorPicker.setColor('#ffff00'); - */ - ColorPicker.prototype.setColor = function (hexStr) { - if (!colorutil.isValidRGB(hexStr)) { - throw new Error('ColorPicker#setColor(): need valid hex string color value'); - } - - this.options.color = hexStr; - this.render(hexStr); - }; - - /** - * Get hex color string of current selected color in colorpicker instance. - * @returns {string} hex string formatted color - * @example - * colorPicker.setColor('#ffff00'); - * colorPicker.getColor(); // '#ffff00'; - */ - ColorPicker.prototype.getColor = function () { - return this.options.color; - }; - - /** - * Toggle colorpicker element. set true then reveal colorpicker view. - * @param {boolean} [isShow=false] - A flag to show - * @example - * colorPicker.toggle(false); // hide - * colorPicker.toggle(); // hide - * colorPicker.toggle(true); // show - */ - ColorPicker.prototype.toggle = function (isShow) { - this.layout.container.style.display = !!isShow ? 'block' : 'none'; - }; - - /** - * Render colorpicker - * @param {string} [color] - selected color - * @ignore - */ - ColorPicker.prototype.render = function (color) { - this.layout.render(color || this.options.color); - }; - - /** - * Destroy colorpicker instance. - * @example - * colorPicker.destroy(); // DOM-element is removed - */ - ColorPicker.prototype.destroy = function () { - this.layout.destroy(); - this.options.container.innerHTML = ''; - - this.layout = this.slider = this.palette = this.options = null; - }; - - util.CustomEvents.mixin(ColorPicker); - - module.exports = ColorPicker; - - /***/ }), - /* 14 */ - /***/ (function(module, exports) { - - /** - * @fileoverview Utility methods to manipulate colors - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var hexRX = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i; - - var colorutil = { - /** - * pad left zero characters. - * @param {number} number number value to pad zero. - * @param {number} length pad length to want. - * @returns {string} padded string. - */ - leadingZero: function (number, length) { - var zero = '', - i = 0; - - if ((number + '').length > length) { - return number + ''; - } - - for (; i < length - 1; i += 1) { - zero += '0'; - } - - return (zero + number).slice(length * -1); - }, - - /** - * Check validate of hex string value is RGB - * @param {string} str - rgb hex string - * @returns {boolean} return true when supplied str is valid RGB hex string - */ - isValidRGB: function (str) { - return hexRX.test(str); - }, - - // @license RGB <-> HSV conversion utilities based off of http://www.cs.rit.edu/~ncs/color/t_convert.html - - /** - * Convert color hex string to rgb number array - * @param {string} hexStr - hex string - * @returns {number[]} rgb numbers - */ - hexToRGB: function (hexStr) { - var r, g, b; - - if (!colorutil.isValidRGB(hexStr)) { - return false; - } - - hexStr = hexStr.substring(1); - - r = parseInt(hexStr.substr(0, 2), 16); - g = parseInt(hexStr.substr(2, 2), 16); - b = parseInt(hexStr.substr(4, 2), 16); - - return [r, g, b]; - }, - - /** - * Convert rgb number to hex string - * @param {number} r - red - * @param {number} g - green - * @param {number} b - blue - * @returns {string|boolean} return false when supplied rgb number is not valid. otherwise, converted hex string - */ - rgbToHEX: function (r, g, b) { - var hexStr = '#' + colorutil.leadingZero(r.toString(16), 2) + colorutil.leadingZero(g.toString(16), 2) + colorutil.leadingZero(b.toString(16), 2); - - if (colorutil.isValidRGB(hexStr)) { - return hexStr; - } - - return false; - }, - - /** - * Convert rgb number to HSV value - * @param {number} r - red - * @param {number} g - green - * @param {number} b - blue - * @returns {number[]} hsv value - */ - rgbToHSV: function (r, g, b) { - var max, min, h, s, v, d; - - r /= 255; - g /= 255; - b /= 255; - max = Math.max(r, g, b); - min = Math.min(r, g, b); - v = max; - d = max - min; - s = max === 0 ? 0 : d / max; - - if (max === min) { - h = 0; - } else { - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0);break; - case g: - h = (b - r) / d + 2;break; - case b: - h = (r - g) / d + 4;break; - // no default - } - h /= 6; - } - - return [Math.round(h * 360), Math.round(s * 100), Math.round(v * 100)]; - }, - - /** - * Convert HSV number to RGB - * @param {number} h - hue - * @param {number} s - saturation - * @param {number} v - value - * @returns {number[]} rgb value - */ - hsvToRGB: function (h, s, v) { - var r, g, b; - var i; - var f, p, q, t; - - h = Math.max(0, Math.min(360, h)); - s = Math.max(0, Math.min(100, s)); - v = Math.max(0, Math.min(100, v)); - - s /= 100; - v /= 100; - - if (s === 0) { - // Achromatic (grey) - r = g = b = v; - - return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)]; - } - - h /= 60; // sector 0 to 5 - i = Math.floor(h); - f = h - i; // factorial part of h - p = v * (1 - s); - q = v * (1 - s * f); - t = v * (1 - s * (1 - f)); - - switch (i) { - case 0: - r = v;g = t;b = p;break; - case 1: - r = q;g = v;b = p;break; - case 2: - r = p;g = v;b = t;break; - case 3: - r = p;g = q;b = v;break; - case 4: - r = t;g = p;b = v;break; - default: - r = v;g = p;b = q;break; - } - - return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)]; - } - }; - - module.exports = colorutil; - - /***/ }), - /* 15 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview ColorPicker layout module - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - var domutil = __webpack_require__(7); - var View = __webpack_require__(11); - - /** - * @constructor - * @extends {View} - * @param {object} options - option object - * @param {string} options.cssPrefix - css prefix for each child elements - * @param {HTMLDivElement} container - container - * @ignore - */ - function Layout(options, container) { - /** - * option object - * @type {object} - */ - this.options = util.extend({ - cssPrefix: 'tui-colorpicker-' - }, options); - - container = domutil.appendHTMLElement('div', container, this.options.cssPrefix + 'container'); - - View.call(this, options, container); - - this.render(); - } - - util.inherit(Layout, View); - - /** - * @override - * @param {string} [color] - selected color - */ - Layout.prototype.render = function (color) { - this.recursive(function (view) { - view.render(color); - }, true); - }; - - module.exports = Layout; - - /***/ }), - /* 16 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview Color palette view - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - var domutil = __webpack_require__(7); - var colorutil = __webpack_require__(14); - var domevent = __webpack_require__(9); - var View = __webpack_require__(11); - var tmpl = __webpack_require__(17); - - /** - * @constructor - * @extends {View} - * @mixes CustomEvents - * @param {object} options - options for color palette view - * @param {string[]} options.preset - color list - * @param {HTMLDivElement} container - container element - * @ignore - */ - function Palette(options, container) { - /** - * option object - * @type {object} - */ - this.options = util.extend({ - cssPrefix: 'tui-colorpicker-', - preset: ['#181818', '#282828', '#383838', '#585858', '#B8B8B8', '#D8D8D8', '#E8E8E8', '#F8F8F8', '#AB4642', '#DC9656', '#F7CA88', '#A1B56C', '#86C1B9', '#7CAFC2', '#BA8BAF', '#A16946'], - detailTxt: 'Detail' - }, options); - - container = domutil.appendHTMLElement('div', container, this.options.cssPrefix + 'palette-container'); - - View.call(this, options, container); - } - - util.inherit(Palette, View); - - /** - * Mouse click event handler - * @fires Palette#_selectColor - * @fires Palette#_toggleSlider - * @param {MouseEvent} clickEvent - mouse event object - */ - Palette.prototype._onClick = function (clickEvent) { - var options = this.options, - target = clickEvent.srcElement || clickEvent.target, - eventData = {}; - - if (domutil.hasClass(target, options.cssPrefix + 'palette-button')) { - eventData.color = target.value; - - /** - * @event Palette#_selectColor - * @type {object} - * @property {string} color - selected color value - */ - this.fire('_selectColor', eventData); - - return; - } - - if (domutil.hasClass(target, options.cssPrefix + 'palette-toggle-slider')) { - /** - * @event Palette#_toggleSlider - */ - this.fire('_toggleSlider'); - } - }; - - /** - * Textbox change event handler - * @fires Palette#_selectColor - * @param {Event} changeEvent - change event object - */ - Palette.prototype._onChange = function (changeEvent) { - var options = this.options, - target = changeEvent.srcElement || changeEvent.target, - eventData = {}; - - if (domutil.hasClass(target, options.cssPrefix + 'palette-hex')) { - eventData.color = target.value; - - /** - * @event Palette#_selectColor - * @type {object} - * @property {string} color - selected color value - */ - this.fire('_selectColor', eventData); - } - }; - - /** - * Invoke before destory - * @override - */ - Palette.prototype._beforeDestroy = function () { - this._toggleEvent(false); - }; - - /** - * Toggle view DOM events - * @param {boolean} [onOff=false] - true to bind event. - */ - Palette.prototype._toggleEvent = function (onOff) { - var options = this.options, - container = this.container, - method = domevent[!!onOff ? 'on' : 'off'], - hexTextBox; - - method(container, 'click', this._onClick, this); - - hexTextBox = domutil.find('.' + options.cssPrefix + 'palette-hex', container); - - if (hexTextBox) { - method(hexTextBox, 'change', this._onChange, this); - } - }; - - /** - * Render palette - * @override - */ - Palette.prototype.render = function (color) { - var options = this.options, - html = ''; - - this._toggleEvent(false); - - html = tmpl.layout.replace('{{colorList}}', util.map(options.preset, function (itemColor) { - var itemHtml = ''; - var style = ''; - - if (colorutil.isValidRGB(itemColor)) { - style = domutil.applyTemplate(tmpl.itemStyle, { color: itemColor }); - } - - itemHtml = domutil.applyTemplate(tmpl.item, { - itemStyle: style, - itemClass: !itemColor ? ' ' + options.cssPrefix + 'color-transparent' : '', - color: itemColor, - cssPrefix: options.cssPrefix, - selected: itemColor === color ? ' ' + options.cssPrefix + 'selected' : '' - }); - - return itemHtml; - }).join('')); - - html = domutil.applyTemplate(html, { - cssPrefix: options.cssPrefix, - detailTxt: options.detailTxt, - color: color - }); - - this.container.innerHTML = html; - - this._toggleEvent(true); - }; - - util.CustomEvents.mixin(Palette); - - module.exports = Palette; - - /***/ }), - /* 17 */ - /***/ (function(module, exports) { - - /** - * @fileoverview Palette view template - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var layout = ['
    {{colorList}}
', '
', '', '', '{{color}}', '
'].join('\n'); - - var item = '
  • '; - var itemStyle = 'background-color:{{color}};color:{{color}}'; - - module.exports = { - layout: layout, - item: item, - itemStyle: itemStyle - }; - - /***/ }), - /* 18 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview Slider view - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - var domutil = __webpack_require__(7); - var domevent = __webpack_require__(9); - var svgvml = __webpack_require__(19); - var colorutil = __webpack_require__(14); - var View = __webpack_require__(11); - var Drag = __webpack_require__(12); - var tmpl = __webpack_require__(20); - - // Limitation position of point element inside of colorslider and hue bar - // Minimum value can to be negative because that using color point of handle element is center point. not left, top point. - var COLORSLIDER_POS_LIMIT_RANGE = [-7, 112]; - var HUEBAR_POS_LIMIT_RANGE = [-3, 115]; - var HUE_WHEEL_MAX = 359.99; - - /** - * @constructor - * @extends {View} - * @mixes CustomEvents - * @param {object} options - options for view - * @param {string} options.cssPrefix - design css prefix - * @param {HTMLElement} container - container element - * @ignore - */ - function Slider(options, container) { - container = domutil.appendHTMLElement('div', container, options.cssPrefix + 'slider-container'); - container.style.display = 'none'; - - View.call(this, options, container); - - /** - * @type {object} - */ - this.options = util.extend({ - color: '#f8f8f8', - cssPrefix: 'tui-colorpicker-' - }, options); - - /** - * Cache immutable data in click, drag events. - * - * (i.e. is event related with colorslider? or huebar?) - * @type {object} - * @property {boolean} isColorSlider - * @property {number[]} containerSize - */ - this._dragDataCache = {}; - - /** - * Color slider handle element - * @type {SVG|VML} - */ - this.sliderHandleElement = null; - - /** - * hue bar handle element - * @type {SVG|VML} - */ - this.huebarHandleElement = null; - - /** - * Element that render base color in colorslider part - * @type {SVG|VML} - */ - this.baseColorElement = null; - - /** - * @type {Drag} - */ - this.drag = new Drag({ - distance: 0 - }, container); - - // bind drag events - this.drag.on({ - 'dragStart': this._onDragStart, - 'drag': this._onDrag, - 'dragEnd': this._onDragEnd, - 'click': this._onClick - }, this); - } - - util.inherit(Slider, View); - - /** - * @override - */ - Slider.prototype._beforeDestroy = function () { - this.drag.off(); - - this.drag = this.options = this._dragDataCache = this.sliderHandleElement = this.huebarHandleElement = this.baseColorElement = null; - }; - - /** - * Toggle slider view - * @param {boolean} onOff - set true then reveal slider view - */ - Slider.prototype.toggle = function (onOff) { - this.container.style.display = !!onOff ? 'block' : 'none'; - }; - - /** - * Get slider display status - * @returns {boolean} return true when slider is visible - */ - Slider.prototype.isVisible = function () { - return this.container.style.display === 'block'; - }; - - /** - * Render slider view - * @override - * @param {string} colorStr - hex string color from parent view (Layout) - */ - Slider.prototype.render = function (colorStr) { - var that = this, - container = that.container, - options = that.options, - html = tmpl.layout, - rgb, - hsv; - - if (!colorutil.isValidRGB(colorStr)) { - return; - } - - html = html.replace(/{{slider}}/, tmpl.slider); - html = html.replace(/{{huebar}}/, tmpl.huebar); - html = html.replace(/{{cssPrefix}}/g, options.cssPrefix); - - that.container.innerHTML = html; - - that.sliderHandleElement = domutil.find('.' + options.cssPrefix + 'slider-handle', container); - that.huebarHandleElement = domutil.find('.' + options.cssPrefix + 'huebar-handle', container); - that.baseColorElement = domutil.find('.' + options.cssPrefix + 'slider-basecolor', container); - - rgb = colorutil.hexToRGB(colorStr); - hsv = colorutil.rgbToHSV.apply(null, rgb); - - this.moveHue(hsv[0], true); - this.moveSaturationAndValue(hsv[1], hsv[2], true); - }; - - /** - * Move colorslider by newLeft(X), newTop(Y) value - * @private - * @param {number} newLeft - left pixel value to move handle - * @param {number} newTop - top pixel value to move handle - * @param {boolean} [silent=false] - set true then not fire custom event - */ - Slider.prototype._moveColorSliderHandle = function (newLeft, newTop, silent) { - var handle = this.sliderHandleElement, - handleColor; - - // Check position limitation. - newTop = Math.max(COLORSLIDER_POS_LIMIT_RANGE[0], newTop); - newTop = Math.min(COLORSLIDER_POS_LIMIT_RANGE[1], newTop); - newLeft = Math.max(COLORSLIDER_POS_LIMIT_RANGE[0], newLeft); - newLeft = Math.min(COLORSLIDER_POS_LIMIT_RANGE[1], newLeft); - - svgvml.setTranslateXY(handle, newLeft, newTop); - - handleColor = newTop > 50 ? 'white' : 'black'; - svgvml.setStrokeColor(handle, handleColor); - - if (!silent) { - this.fire('_selectColor', { - color: colorutil.rgbToHEX.apply(null, this.getRGB()) - }); - } - }; - - /** - * Move colorslider by supplied saturation and values. - * - * The movement of color slider handle follow HSV cylinder model. {@link https://en.wikipedia.org/wiki/HSL_and_HSV} - * @param {number} saturation - the percent of saturation (0% ~ 100%) - * @param {number} value - the percent of saturation (0% ~ 100%) - * @param {boolean} [silent=false] - set true then not fire custom event - */ - Slider.prototype.moveSaturationAndValue = function (saturation, value, silent) { - var absMin, maxValue, newLeft, newTop; - - saturation = saturation || 0; - value = value || 0; - - absMin = Math.abs(COLORSLIDER_POS_LIMIT_RANGE[0]); - maxValue = COLORSLIDER_POS_LIMIT_RANGE[1]; - - // subtract absMin value because current color position is not left, top of handle element. - // The saturation. from left 0 to right 100 - newLeft = saturation * maxValue / 100 - absMin; - // The Value. from top 100 to bottom 0. that why newTop subtract by maxValue. - newTop = maxValue - value * maxValue / 100 - absMin; - - this._moveColorSliderHandle(newLeft, newTop, silent); - }; - - /** - * Move color slider handle to supplied position - * - * The number of X, Y must be related value from color slider container - * @private - * @param {number} x - the pixel value to move handle - * @param {number} y - the pixel value to move handle - */ - Slider.prototype._moveColorSliderByPosition = function (x, y) { - var offset = COLORSLIDER_POS_LIMIT_RANGE[0]; - this._moveColorSliderHandle(x + offset, y + offset); - }; - - /** - * Get saturation and value value. - * @returns {number[]} saturation and value - */ - Slider.prototype.getSaturationAndValue = function () { - var absMin = Math.abs(COLORSLIDER_POS_LIMIT_RANGE[0]), - maxValue = absMin + COLORSLIDER_POS_LIMIT_RANGE[1], - position = svgvml.getTranslateXY(this.sliderHandleElement), - saturation, - value; - - saturation = (position[1] + absMin) / maxValue * 100; - // The value of HSV color model is inverted. top 100 ~ bottom 0. so subtract by 100 - value = 100 - (position[0] + absMin) / maxValue * 100; - - return [saturation, value]; - }; - - /** - * Move hue handle supplied pixel value - * @private - * @param {number} newTop - pixel to move hue handle - * @param {boolean} [silent=false] - set true then not fire custom event - */ - Slider.prototype._moveHueHandle = function (newTop, silent) { - var hueHandleElement = this.huebarHandleElement, - baseColorElement = this.baseColorElement, - newGradientColor, - hexStr; - - newTop = Math.max(HUEBAR_POS_LIMIT_RANGE[0], newTop); - newTop = Math.min(HUEBAR_POS_LIMIT_RANGE[1], newTop); - - svgvml.setTranslateY(hueHandleElement, newTop); - - newGradientColor = colorutil.hsvToRGB(this.getHue(), 100, 100); - hexStr = colorutil.rgbToHEX.apply(null, newGradientColor); - - svgvml.setGradientColorStop(baseColorElement, hexStr); - - if (!silent) { - this.fire('_selectColor', { - color: colorutil.rgbToHEX.apply(null, this.getRGB()) - }); - } - }; - - /** - * Move hue bar handle by supplied degree - * @param {number} degree - (0 ~ 359.9 degree) - * @param {boolean} [silent=false] - set true then not fire custom event - */ - Slider.prototype.moveHue = function (degree, silent) { - var newTop = 0, - absMin, - maxValue; - - absMin = Math.abs(HUEBAR_POS_LIMIT_RANGE[0]); - maxValue = absMin + HUEBAR_POS_LIMIT_RANGE[1]; - - degree = degree || 0; - newTop = maxValue * degree / HUE_WHEEL_MAX - absMin; - - this._moveHueHandle(newTop, silent); - }; - - /** - * Move hue bar handle by supplied percent - * @private - * @param {number} y - pixel value to move hue handle - */ - Slider.prototype._moveHueByPosition = function (y) { - var offset = HUEBAR_POS_LIMIT_RANGE[0]; - - this._moveHueHandle(y + offset); - }; - - /** - * Get huebar handle position by color degree - * @returns {number} degree (0 ~ 359.9 degree) - */ - Slider.prototype.getHue = function () { - var handle = this.huebarHandleElement, - position = svgvml.getTranslateXY(handle), - absMin, - maxValue; - - absMin = Math.abs(HUEBAR_POS_LIMIT_RANGE[0]); - maxValue = absMin + HUEBAR_POS_LIMIT_RANGE[1]; - - // maxValue : 359.99 = pos.y : x - return (position[0] + absMin) * HUE_WHEEL_MAX / maxValue; - }; - - /** - * Get HSV value from slider - * @returns {number[]} hsv values - */ - Slider.prototype.getHSV = function () { - var sv = this.getSaturationAndValue(), - h = this.getHue(); - - return [h].concat(sv); - }; - - /** - * Get RGB value from slider - * @returns {number[]} RGB value - */ - Slider.prototype.getRGB = function () { - return colorutil.hsvToRGB.apply(null, this.getHSV()); - }; - - /********** - * Drag event handler - **********/ - - /** - * Cache immutable data when dragging or click view - * @param {object} event - Click, DragStart event. - * @returns {object} cached data. - */ - Slider.prototype._prepareColorSliderForMouseEvent = function (event) { - var options = this.options, - sliderPart = domutil.closest(event.target, '.' + options.cssPrefix + 'slider-part'), - cache; - - cache = this._dragDataCache = { - isColorSlider: domutil.hasClass(sliderPart, options.cssPrefix + 'slider-left'), - parentElement: sliderPart - }; - - return cache; - }; - - /** - * Click event handler - * @param {object} clickEvent - Click event from Drag module - */ - Slider.prototype._onClick = function (clickEvent) { - var cache = this._prepareColorSliderForMouseEvent(clickEvent), - mousePos = domevent.getMousePosition(clickEvent.originEvent, cache.parentElement); - - if (cache.isColorSlider) { - this._moveColorSliderByPosition(mousePos[0], mousePos[1]); - } else { - this._moveHueByPosition(mousePos[1]); - } - - this._dragDataCache = null; - }; - - /** - * DragStart event handler - * @param {object} dragStartEvent - dragStart event data from Drag#dragStart - */ - Slider.prototype._onDragStart = function (dragStartEvent) { - this._prepareColorSliderForMouseEvent(dragStartEvent); - }; - - /** - * Drag event handler - * @param {Drag#drag} dragEvent - drag event data - */ - Slider.prototype._onDrag = function (dragEvent) { - var cache = this._dragDataCache, - mousePos = domevent.getMousePosition(dragEvent.originEvent, cache.parentElement); - - if (cache.isColorSlider) { - this._moveColorSliderByPosition(mousePos[0], mousePos[1]); - } else { - this._moveHueByPosition(mousePos[1]); - } - }; - - /** - * Drag#dragEnd event handler - */ - Slider.prototype._onDragEnd = function () { - this._dragDataCache = null; - }; - - util.CustomEvents.mixin(Slider); - - module.exports = Slider; - - /***/ }), - /* 19 */ - /***/ (function(module, exports, __webpack_require__) { - - /** - * @fileoverview module for manipulate SVG or VML object - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - var PARSE_TRANSLATE_NUM_REGEX = /[\.\-0-9]+/g; - var SVG_HUE_HANDLE_RIGHT_POS = -6; - - /* istanbul ignore next */ - var svgvml = { - /** - * Return true when browser is below IE8. - * @returns {boolean} is old browser? - */ - isOldBrowser: function () { - var _isOldBrowser = svgvml._isOldBrowser; - - if (!util.isExisty(_isOldBrowser)) { - svgvml._isOldBrowser = _isOldBrowser = util.browser.msie && util.browser.version < 9; - } - - return _isOldBrowser; - }, - - /** - * Get translate transform value - * @param {SVG|VML} obj - svg or vml object that want to know translate x, y - * @returns {number[]} translated coordinates [x, y] - */ - getTranslateXY: function (obj) { - var temp; - - if (svgvml.isOldBrowser()) { - temp = obj.style; - - return [parseFloat(temp.top), parseFloat(temp.left)]; - } - - temp = obj.getAttribute('transform'); - - if (!temp) { - return [0, 0]; - } - - temp = temp.match(PARSE_TRANSLATE_NUM_REGEX); - - // need caution for difference of VML, SVG coordinates system. - // translate command need X coords in first parameter. but VML is use CSS coordinate system(top, left) - return [parseFloat(temp[1]), parseFloat(temp[0])]; - }, - - /** - * Set translate transform value - * @param {SVG|VML} obj - SVG or VML object to setting translate transform. - * @param {number} x - translate X value - * @param {number} y - translate Y value - */ - setTranslateXY: function (obj, x, y) { - if (svgvml.isOldBrowser()) { - obj.style.left = x + 'px'; - obj.style.top = y + 'px'; - } else { - obj.setAttribute('transform', 'translate(' + x + ',' + y + ')'); - } - }, - - /** - * Set translate only Y value - * @param {SVG|VML} obj - SVG or VML object to setting translate transform. - * @param {number} y - translate Y value - */ - setTranslateY: function (obj, y) { - if (svgvml.isOldBrowser()) { - obj.style.top = y + 'px'; - } else { - obj.setAttribute('transform', 'translate(' + SVG_HUE_HANDLE_RIGHT_POS + ',' + y + ')'); - } - }, - - /** - * Set stroke color to SVG or VML object - * @param {SVG|VML} obj - SVG or VML object to setting stroke color - * @param {string} colorStr - color string - */ - setStrokeColor: function (obj, colorStr) { - if (svgvml.isOldBrowser()) { - obj.strokecolor = colorStr; - } else { - obj.setAttribute('stroke', colorStr); - } - }, - - /** - * Set gradient stop color to SVG, VML object. - * @param {SVG|VML} obj - SVG, VML object to applying gradient stop color - * @param {string} colorStr - color string - */ - setGradientColorStop: function (obj, colorStr) { - if (svgvml.isOldBrowser()) { - obj.color = colorStr; - } else { - obj.setAttribute('stop-color', colorStr); - } - } - - }; - - module.exports = svgvml; - - /***/ }), - /* 20 */ - /***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {/** - * @fileoverview Slider template - * @author NHN Ent. FE Development Team - */ - - 'use strict'; - - var util = __webpack_require__(8); - - var layout = ['
    {{slider}}
    ', '
    {{huebar}}
    '].join('\n'); - - var SVGSlider = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', ''].join('\n'); - - var VMLSlider = ['
    ', '', '', '', '', '', '', '', '
    '].join('\n'); - - var SVGHuebar = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', ''].join('\n'); - - var VMLHuebar = ['
    ', '', '', '', '', '
    '].join('\n'); - - var isOldBrowser = util.browser.msie && util.browser.version < 9; - - if (isOldBrowser) { - global.document.namespaces.add('v', 'urn:schemas-microsoft-com:vml'); - } - - module.exports = { - layout: layout, - slider: isOldBrowser ? VMLSlider : SVGSlider, - huebar: isOldBrowser ? VMLHuebar : SVGHuebar - }; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - - /***/ }) - /******/ ]) - }); - ; + module.exports = __WEBPACK_EXTERNAL_MODULE_82__; /***/ }), /* 83 */ diff --git a/dist/tui-image-editor.min.css b/dist/tui-image-editor.min.css index ad704fecc..98e29653d 100644 --- a/dist/tui-image-editor.min.css +++ b/dist/tui-image-editor.min.css @@ -1,6 +1,6 @@ /*! * tui-image-editor.min.js - * @version 3.5.0 + * @version 3.5.2 * @author NHNEnt FE Development Lab * @license MIT */ diff --git a/dist/tui-image-editor.min.js b/dist/tui-image-editor.min.js index 679e9a3b9..e612cf34b 100644 --- a/dist/tui-image-editor.min.js +++ b/dist/tui-image-editor.min.js @@ -1,29 +1,21 @@ /*! * tui-image-editor.min.js - * @version 3.5.0 + * @version 3.5.2 * @author NHNEnt FE Development Lab * @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(149),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:{addedObject:"The object is already added.",flip:"The flipX and flipY setting values are not changed.",invalidDrawingMode:"This operation is not supported in the drawing mode.",invalidParameters:"Invalid parameters.",isLock:"The executing command state is locked.",loadImage:"The background image is empty.",loadingImageFailed:"Invalid image loaded.",noActiveObject:"There is no active object.",noObject:"The object is not in canvas.",redo:"The promise of redo command is reject.",rotation:"The current angle is same the old angle.",undo:"The promise of undo command is reject.",unsupportedOperation:"Unsupported operation.",unsupportedType:"Unsupported object type."},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(t,n){t.exports=e},function(e,t,n){n(145),n(147),n(148),n(146),e.exports=n(16).Promise},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;on&&(i=t,t=n,n=i),r(t,o(e,n))},keyMirror:function(){for(var e={},t=arguments.length,n=Array(t),o=0;o1&&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._colorpickerElement=t,this._toggleDirection=i,this._makePickerButtonElement(t,n),this._makePickerLayerElement(t,r),this._color=n,this.picker=c.default.create({container:this.pickerElement,preset:u,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)}},{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){var n=e.target,i=n&&t._isElementInColorPickerControl(n);(!i||i&&t._isPaletteButton(n))&&(t._show=!t._show,t.pickerControl.style.display=t._show?"block":"none",t._setPickerControlPosition(),t.fire("changeShow",t)),e.stopPropagation()}),document.body.addEventListener("click",function(){t.hide()})}},{key:"_isPaletteButton",value:function(e){return"tui-colorpicker-palette-button"===e.className}},{key:"_isElementInColorPickerControl",value:function(e){for(var t=e;t!==document.body&&t;){if(t===this.pickerControl)return!0;t=t.parentNode}return!1}},{key:"hide",value:function(){this._show=!1,this.pickerControl.style.display="none"}},{key:"_setPickerControlPosition",value:function(){var e=this.pickerControl.style,t=this._colorpickerElement.clientWidth/2+2,n=this.pickerControl.offsetWidth/2-t,i=(this.pickerControl.offsetHeight+10)*-1;"down"===this._toggleDirection&&(i=30),e.top=i+"px",e.left="-"+n+"px"}},{key:"color",get:function(){return this._color},set:function(e){this._color=e,this._changeColorElement(e)}}]),e}();s.default.CustomEvents.mixin(d),t.default=d},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;n1&&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.rangeWidth0?i:n)(e)}},function(e,t,n){var i=n(123),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(2),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;on;)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(2),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(n){t(),e.clearUndoStack(),e.ui.activeMenuEvent(),e.ui.resizeEditor({imageSize:n})}).catch(function(e){return Promise.reject(e)})},download:function(){var t=e.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="")}},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")},preset:function(t){switch(t){case"preset-square":e.setCropzoneRect(1);break;case"preset-3-2":e.setCropzoneRect(1.5);break;case"preset-4-3":e.setCropzoneRect(4/3);break;case"preset-5-4":e.setCropzoneRect(5/4);break;case"preset-7-5":e.setCropzoneRect(1.4);break;case"preset-16-9":e.setCropzoneRect(16/9);break;default:e.setCropzoneRect(),e.ui.crop.changeApplyButtonStatus(!1)}}},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),fontFamily:"Noto Sans"}}).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();nb&&(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,m.clamp)(e,0,r),l=(0,m.clamp)(t,0,a),c=(0,m.clamp)(e,r,i)-s,u=(0,m.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:"setCropzoneRect",value:function(e){var t=this.getCanvas(),n=this._cropzone;t.deactivateAll(),t.selection=!1,n.remove(),n.set(e?this._getPresetCropSizePosition(e):y),t.add(n),t.selection=!0,e&&t.setActiveObject(n)}},{key:"_getPresetCropSizePosition",value:function(e){var t=this.getCanvas(),n=t.getWidth(),i=t.getHeight(),o=n>=i?n:i,r=function(e,t){return e>t?t/e:1},a=o*e,s=o,l=r(a,n),u=c.default.map([a,s],function(e){return e*l});a=u[0],s=u[1];var d=r(s,i),h=c.default.map([a,s],function(e){return e*d});return a=h[0],s=h[1],{top:(i-s)/2,left:(n-a)/2,width:a,height:s}}},{key:"_onKeyDown",value:function(e){e.keyCode===v.keyCodes.SHIFT&&(this._withShiftKey=!0)}},{key:"_onKeyUp",value:function(e){e.keyCode===v.keyCodes.SHIFT&&(this._withShiftKey=!1)}}]),t}(f.default);e.exports=_},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=0,c=n.useDragAddIcon&&l,u=a?n._createIcon(a):null;u||o(y.invalidParameters),u.set(d.default.extend({type:"icon",fill:n._oColor},s,t,n.graphics.controlStyle)),r.add(u).setActiveObject(u),c&&n._addWithDragEvent(r),i(n.graphics.createObjectProperties(u))})}},{key:"_addWithDragEvent",value:function(e){var t=this;e.on({"mouse:move":function(n){e.selection=!1,t.fire(b.ICON_CREATE_RESIZE,{moveOriginPointer:e.getPointer(n.e)})},"mouse:up":function(n){t.fire(b.ICON_CREATE_END,{moveOriginPointer:e.getPointer(n.e)}),e.defaultCursor="default",e.off("mouse:up"),e.off("mouse:move"),e.selection=!0}})}},{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;nn},_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(2),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(255, 255, 255)",{lineWidth:this.options.lineWidth})):(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;l1&&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 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:"setCropzoneRect",value:function(e){this.getComponent(G.CROPPER).setCropzoneRect(e)}},{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.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 B.default),this._register(this._drawingModeMap,new F.default),this._register(this._drawingModeMap,new H.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-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;n0&&(e=this.blur(e,t.blurradius,t.blurdelta)),h=0;h0)for(d=0;d0&&(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/ln[i].boundingbox[2]&&(n[i].boundingbox[2]=r-1),a-1n[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.lengtht[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;l0&&(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=ei?7:0:e>n?ti?5:4:ti?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;i0?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="=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',a+='',a+='',a+=''),!r.segments[s].hasOwnProperty("x3")&&i.lcpr&&(a+='');for(var l=0;l',a+='',a+='',a+=''),!c.segments[s].hasOwnProperty("x3")&&i.lcpr&&(a+='')}}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="',r=0;r5&&(t=5),n=Math.abs(n),n>1024&&(n=1024);var p=this.gks[t-1];for(o=0;o0&&i+r0&&o+rn&&(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){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;sl?"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;n1?n-1:0),o=1;o1?n-1:0),o=1;on&&(i=t,t=n,n=i),a(t,o(e,n))},keyMirror:function(){for(var e={},t=arguments.length,n=Array(t),o=0;o1&&void 0!==arguments[1]?arguments[1]:"#7e7e7e",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";o(this,e);var a=t.getAttribute("title");this._show=!1,this._colorpickerElement=t,this._toggleDirection=i,this._makePickerButtonElement(t,n),this._makePickerLayerElement(t,a),this._color=n,this.picker=c.default.create({container:this.pickerElement,preset:u,color:n}),this._addEvent(t)}return a(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)}},{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){var n=e.target,i=n&&t._isElementInColorPickerControl(n);(!i||i&&t._isPaletteButton(n))&&(t._show=!t._show,t.pickerControl.style.display=t._show?"block":"none",t._setPickerControlPosition(),t.fire("changeShow",t)),e.stopPropagation()}),document.body.addEventListener("click",function(){t.hide()})}},{key:"_isPaletteButton",value:function(e){return"tui-colorpicker-palette-button"===e.className}},{key:"_isElementInColorPickerControl",value:function(e){for(var t=e;t!==document.body&&t;){if(t===this.pickerControl)return!0;t=t.parentNode}return!1}},{key:"hide",value:function(){this._show=!1,this.pickerControl.style.display="none"}},{key:"_setPickerControlPosition",value:function(){var e=this.pickerControl.style,t=this._colorpickerElement.clientWidth/2+2,n=this.pickerControl.offsetWidth/2-t,i=(this.pickerControl.offsetHeight+10)*-1;"down"===this._toggleDirection&&(i=30),e.top=i+"px",e.left="-"+n+"px"}},{key:"color",get:function(){return this._color},set:function(e){this._color=e,this._changeColorElement(e)}}]),e}();s.default.CustomEvents.mixin(d),t.default=d},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 a=function(){function e(e,t){for(var n=0;n1&&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 a(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,a=this._absMax*o+this._min;this._value=a,this.realTimeEvent&&this.fire("change",a)}},{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.rangeWidth0?i:n)(e)}},function(e,t,n){var i=n(123),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),a=i(o),r=n(5),s=(0,r.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:a.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;on;)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(r(b,e,1))}:p?(o=new p,a=o.port2,o.port1.onmessage=y,i=r(a.postMessage,a,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(r(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),a=n(5),r=i(a),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){r.default.isSupportFileApi()||alert("This browser does not support file-api"),e.ui.initializeImgUrl=URL.createObjectURL(n),e.loadImageFromFile(n).then(function(n){t(),e.clearUndoStack(),e.ui.activeMenuEvent(),e.ui.resizeEditor({imageSize:n})}).catch(function(e){return Promise.reject(e)})},download:function(){var t=e.toDataURL(),n=e.getImageName(),i=void 0,o=void 0,a=void 0;r.default.isSupportFileApi()&&window.saveAs?(i=r.default.base64ToBlob(t),o=i.type.split("/")[1],n.split(".").pop()!==o&&(n+="."+o),saveAs(i,n)):(a=window.open(),a.document.body.innerHTML="")}},this._commonAction())},_iconAction:function(){var e=this,t=void 0,n=void 0,i=void 0,a=void 0,r=void 0,s=void 0,c=void 0;this.on({iconCreateResize:function(t){var n=t.moveOriginPointer,o=(n.x-i)/r,l=(n.y-a)/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,a=l.y,e.addIcon(t,{left:l.x,top:l.y,fill:n}).then(function(e){c=e.id,r=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],a={};a[n.name]=o,e.registerIcons(a),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")},preset:function(t){switch(t){case"preset-square":e.setCropzoneRect(1);break;case"preset-3-2":e.setCropzoneRect(1.5);break;case"preset-4-3":e.setCropzoneRect(4/3);break;case"preset-5-4":e.setCropzoneRect(5/4);break;case"preset-7-5":e.setCropzoneRect(1.4);break;case"preset-16-9":e.setCropzoneRect(16/9);break;default:e.setCropzoneRect(),e.ui.crop.changeApplyButtonStatus(!1)}}},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:r.default.toInteger(e.ui.text.fontSize),fontFamily:"Noto Sans"}}).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=r.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();nb&&(a.remove(),a.set(this._calcRectDimensionFromPoint(i,o)),t.add(a))}},{key:"_calcRectDimensionFromPoint",value:function(e,t){var n=this.getCanvas(),i=n.getWidth(),o=n.getHeight(),a=this._startX,r=this._startY,s=(0,m.clamp)(e,0,a),l=(0,m.clamp)(t,0,r),c=(0,m.clamp)(e,a,i)-s,u=(0,m.clamp)(t,r,o)-l;return this._withShiftKey&&(c>u?u=c:u>c&&(c=u),a>=e&&(s=a-c),r>=t&&(l=r-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:"setCropzoneRect",value:function(e){var t=this.getCanvas(),n=this._cropzone;t.deactivateAll(),t.selection=!1,n.remove(),n.set(e?this._getPresetCropSizePosition(e):y),t.add(n),t.selection=!0,e&&t.setActiveObject(n)}},{key:"_getPresetCropSizePosition",value:function(e){var t=this.getCanvas(),n=t.getWidth(),i=t.getHeight(),o=n>=i?n:i,a=function(e,t){return e>t?t/e:1},r=o*e,s=o,l=a(r,n),u=c.default.map([r,s],function(e){return e*l});r=u[0],s=u[1];var d=a(s,i),h=c.default.map([r,s],function(e){return e*d});return r=h[0],s=h[1],{top:(i-s)/2,left:(n-r)/2,width:r,height:s}}},{key:"_onKeyDown",value:function(e){e.keyCode===v.keyCodes.SHIFT&&(this._withShiftKey=!0)}},{key:"_onKeyUp",value:function(e){e.keyCode===v.keyCodes.SHIFT&&(this._withShiftKey=!1)}}]),t}(f.default);e.exports=_},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 a(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 r(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=0,c=n.useDragAddIcon&&l,u=r?n._createIcon(r):null;u||o(y.invalidParameters),u.set(d.default.extend({type:"icon",fill:n._oColor},s,t,n.graphics.controlStyle)),a.add(u).setActiveObject(u),c&&n._addWithDragEvent(a),i(n.graphics.createObjectProperties(u))})}},{key:"_addWithDragEvent",value:function(e){var t=this;e.on({"mouse:move":function(n){e.selection=!1,t.fire(b.ICON_CREATE_RESIZE,{moveOriginPointer:e.getPointer(n.e)})},"mouse:up":function(n){t.fire(b.ICON_CREATE_END,{moveOriginPointer:e.getPointer(n.e)}),e.defaultCursor="default",e.off("mouse:up"),e.off("mouse:move"),e.selection=!0}})}},{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 a(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 r(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;nn},_getColor:function(e,t,n){var i=[0,0,0,0],o=e.data,a=e.width,r=4,s=(a*n+t)*r;return i[0]=o[s],i[1]=o[s+1],i[2]=o[s+2],i[3]=o[s+3],i}});e.exports=r},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(3),a=i(o),r=n(6),s=i(r),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=a.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,a=i/this.scaleX,r=o/this.scaleY;e.scale(a,r),this._fillOuterRect(e,"rgba(0, 0, 0, 0.55)"),this.options.lineWidth?(this._fillInnerRect(e),this._strokeBorder(e,"rgb(255, 255, 255)",{lineWidth:this.options.lineWidth})):(this._strokeBorder(e,"rgb(0, 0, 0)",{lineDashWidth:t}),this._strokeBorder(e,"rgb(255, 255, 255)",{lineDashWidth:t,lineDashOffset:n})),e.scale(1/a,1/r)},_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),a=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],a[1]),e.lineTo(o[3],a[1]),e.moveTo(o[0],a[2]),e.lineTo(o[3],a[2]),e.moveTo(o[1],a[0]),e.lineTo(o[1],a[3]),e.moveTo(o[2],a[0]),e.lineTo(o[2],a[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,r=this.getLeft(),s=this.getTop(),l=e.canvas;return{x:a.default.map([-(i+r),-i,i,i+(l.width-r-t)],Math.ceil),y:a.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,a=n.lineWidth,r=this.getWidth()/2,s=this.getHeight()/2;e.save(),e.strokeStyle=t,e.setLineDash&&e.setLineDash([i,i]),o&&(e.lineDashOffset=o),a&&(e.lineWidth=a),e.beginPath(),e.moveTo(-r,-s),e.lineTo(r,-s),e.lineTo(r,s),e.lineTo(-r,s),e.lineTo(-r,-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,a=this.canvas.getHeight()-i;this.setLeft((0,l.clamp)(e,0,o)),this.setTop((0,l.clamp)(t,0,a))},_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),a=(0,l.clamp)(e,0,i-1);return{top:o,left:a,width:i-a,height:n-o}},_calcBottomRightScalingSizeFromPointer:function(e,t){var n=this.canvas,i=n.width,o=n.height,a=this.left,r=this.top;return{width:(0,l.clamp)(e,a+1,i)-a,height:(0,l.clamp)(t,r+1,o)-r}},_makeScalingSettings:function(e,t){var n=e.width,i=e.height,o=t.height,a=t.width,r=e.left,s=e.top,l=void 0;switch(this.__corner){case c:l=e;break;case u:l={width:a,height:i,top:s};break;case g:l={width:n,height:o,left:r};break;case v:l=t;break;case h:l={width:n,left:r};break;case d:l={height:i,top:s};break;case f:l={width:a};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),a=i(o),r=a.default.util.createClass(a.default.Image.filters.Convolute,{type:"Emboss",initialize:function(){var e=[1,1,1,1,.7,-1,-1,-1,-1];this.matrix=e}});e.exports=r},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var o=n(6),a=i(o),r=a.default.util.createClass(a.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"),a=i.getContext("2d"),r=o.getImageData(0,0,t,n);this._drawMask(a,e,o),this._mapData(a,r,t,n),o.putImageData(r,0,0)}},_createCanvasOfMask:function(e,t){var n=a.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(),a=t.getAngle();e.save(),e.translate(i,o),e.rotate(a*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,a=e.getImageData(0,0,n,i).data,r=this.channel,s=t.width*t.height*4,l=0;l1&&void 0!==arguments[1]?arguments[1]:{},i=n.cssMaxWidth,a=n.cssMaxHeight,r=n.useItext,s=void 0!==r&&r,l=n.useDragAddIcon,c=void 0!==l&&l;o(this,e),this.canvasImage=null,this.cssMaxWidth=i||ie,this.cssMaxHeight=a||oe,this.useItext=s,this.useDragAddIcon=c,this.cropSelectionStyle={},this.imageName="",this._objects={},this._canvas=null,this._drawingMode=Y.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 a(e,[{key:"destroy",value:function(){var e=this._canvas.wrapperEl;this._canvas.clear(),e.parentNode.removeChild(e)}},{key:"deactivateAll",value:function(){return this._canvas.deactivateAll(),this}},{key:"renderAll",value:function(){return this._canvas.renderAll(),this}},{key:"add",value:function(e){var t,n=[];Q(e)?n=e:n.push(e),(t=this._canvas).add.apply(t,n)}},{key:"contains",value:function(e){return this._canvas.contains(e)}},{key:"getObjects",value:function(){return this._canvas.getObjects().slice()}},{key:"getObject",value:function(e){return this._objects[e]}},{key:"remove",value:function(e){this._canvas.remove(e)}},{key:"removeAll",value:function(e){var t=this._canvas,n=t.getObjects().slice();return t.remove.apply(t,this._canvas.getObjects()),e&&t.clear(),n}},{key:"removeObjectById",value:function(e){var t=[],n=this._canvas,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(Y.NORMAL)){var e=this._getDrawingModeInstance(this.getDrawingMode());e&&e.end&&e.end(this),this._drawingMode=Y.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,ae)}},{key:"setCanvasBackstoreDimension",value:function(e){this._canvas.setDimensions(e,re)}},{key:"setImageProperties",value:function(e,t){var n=this.canvasImage;n&&(n.set(e).setCoords(),t&&this._canvas.renderAll())}},{key:"getCanvasElement",value:function(){return this._canvas.getElement()}},{key:"getCanvas",value:function(){return this._canvas}},{key:"getCanvasImage",value:function(){return this.canvasImage}},{key:"getImageName",value:function(){return this.imageName}},{key:"addImageObject",value:function(e){var t=this,n=this._callbackAfterLoadingImageObject.bind(this);return new c.default(function(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(q.CROPPER).getCropzoneRect()}},{key:"setCropzoneRect",value:function(e){this.getComponent(q.CROPPER).setCropzoneRect(e)}},{key:"getCroppedImageData",value:function(e){return this.getComponent(q.CROPPER).getCroppedImageData(e)}},{key:"setBrush",value:function(e){var t=this._drawingMode,n=q.FREE_DRAWING;t===Y.LINE&&(n=Y.LINE),this.getComponent(n).setBrush(e)}},{key:"setDrawingShape",value:function(e,t){this.getComponent(q.SHAPE).setStates(e,t)}},{key:"registerPaths",value:function(e){this.getComponent(q.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(q.FILTER).hasFilter(e)}},{key:"setSelectionStyle",value:function(e){K(J.SELECTION_STYLE,e)}},{key:"setObjectProperties",value:function(e,t){var n=this.getObject(e),i=K({},t);return n.set(i),n.setCoords(),this.getCanvas().renderAll(),i}},{key:"getObjectProperties",value:function(e,t){var n=this.getObject(e),i={};return $(t)?i[t]=n[t]:Q(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,a=t.originX,r=t.originY; +if(!n)return!1;var s=n.getPointByOrigin(a,r),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.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 D.default),this._register(this._drawingModeMap,new N.default),this._register(this._drawingModeMap,new z.default),this._register(this._drawingModeMap,new H.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),a=Math.min(t,this.cssMaxHeight);return n<1&&n-1&&K(n,this._createTextProperties(e,n)),n}},{key:"_createTextProperties",value:function(e){var t=["text","fontFamily","fontSize","fontStyle","textAlign","textDecoration"],n={};return K(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;n0&&(e=this.blur(e,t.blurradius,t.blurdelta)),h=0;h0)for(d=0;d0&&(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/ln[i].boundingbox[2]&&(n[i].boundingbox[2]=a-1),r-1n[i].boundingbox[3]&&(n[i].boundingbox[3]=r-1),h=this.pathscan_combined_lookup[e[r][a]][c],e[r][a]=h[0],c=h[1],a+=h[2],r+=h[3],a-1===n[i].points[0].x&&r-1===n[i].points[0].y)if(u=!0,n[i].points.lengtht[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,a=0,r=0,s=0,l=void 0,c=void 0;for(l=0;l0&&(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[a].x)/2,(e[l].points[o].y+e[l].points[a].y)/2)});return n}},{key:"testrightangle",value:function(e,t,n,i,o,a){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[a].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[a].x}},{key:"getdirection",value:function(e,t,n,i){var o=8;return o=ei?7:0:e>n?ti?5:4:ti?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,a=void 0,r=void 0,s={};for(s.segments=[],s.boundingbox=e.boundingbox,s.holechildren=e.holechildren,s.isholepath=e.isholepath;i0?r:e.points.length}return s}},{key:"fitseq",value:function(e,t,n,i,o){if(o>e.points.length||o<0)return[];var a=i,r=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>r&&(a=p,r=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=a;s=!0,r=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>r&&(a=p,r=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],a=o[n],r="",s=void 0;if(i.linefilter&&a.segments.length<3)return r;if(r="=0;s--)r+=c.segments[s].type+" ",c.segments[s].hasOwnProperty("x3")&&(r+=c.segments[s].x2*i.scale+" "+c.segments[s].y2*i.scale+" "),r+=c.segments[s].x1*i.scale+" "+c.segments[s].y1*i.scale+" ";else for(r+=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--)r+=c.segments[s].type+" ",c.segments[s].hasOwnProperty("x3")&&(r+=this.roundtodec(c.segments[s].x2*i.scale)+" "+this.roundtodec(c.segments[s].y2*i.scale)+" "),r+=this.roundtodec(c.segments[s].x1*i.scale)+" "+this.roundtodec(c.segments[s].y1*i.scale)+" ";r+="Z "}if(r+='" />',i.lcpr||i.qcpr){for(s=0;s',r+='',r+='',r+=''),!a.segments[s].hasOwnProperty("x3")&&i.lcpr&&(r+='');for(var l=0;l',r+='',r+='',r+=''),!c.segments[s].hasOwnProperty("x3")&&i.lcpr&&(r+='')}}return r}},{key:"getsvgstring",value:function(e,t){t=this.checkoptions(t);for(var n=e.width*t.scale,i=e.height*t.scale,o="',a=0;a5&&(t=5),n=Math.abs(n),n>1024&&(n=1024);var p=this.gks[t-1];for(o=0;o0&&i+a0&&o+an&&(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){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,a=void 0,r=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,a=e[l].length;var u=document.createElement("canvas");u.width=o*n,u.height=a*n;var d=u.getContext("2d");for(s=0;sl?"right":"left",originY:o>c?"bottom":"top"}}function o(e){return"center"===e.getOriginX()&&"center"===e.getOriginY()}function a(e,t){var n=t.getPointByOrigin("center","center"),o=-t.getAngle(),a=i(n,e,o),r=a.originX,s=a.originY,l=t.getPointByOrigin(r,s),c=t.getLeft()-(n.x-l.x),u=t.getTop()-(n.x-l.y);t.set({originX:r,originY:s,left:c,top:u}),t.setCoords()}function r(e,t){var n=t.startPoint,o=-t.getAngle(),a=i(n,e,o),r=a.originX,s=a.originY;t.setPositionByOrigin(n,r,s)}function s(e){var t=e.type,n=e.scaleX,i=e.scaleY,o=u[t],a=e[o.w]*n,r=e[o.h]*i;if(e.isRegular){var s=Math.max(n,i);a=e[o.w]*s,r=e[o.h]*s}var l={hasControls:!1,hasBorders:!1,scaleX:1,scaleY:1};l[o.w]=a,l[o.h]=r,e.set(l)}function l(e,t){var n=t.type,i=t.strokeWidth,o=t.startPoint,a=c[n],r=u[n],s=!("triangle"!==t.type),l={},d=Math.abs(o.x-e.x)/a,h=Math.abs(o.y-e.y)/a;d>i&&(d-=i/a),h>i&&(h-=i/a),t.isRegular&&(d=h=Math.max(d,h),s&&(h=Math.sqrt(3)/2*d)),l[r.w]=d,l[r.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)&&(a(t,e),n(e)),i?s(e,t):l(t,e),r(t,e)},adjustOriginToCenter:function(e){var t=e.getPointByOrigin("center","center"),n=e.getOriginX(),i=e.getOriginY(),o=e.getPointByOrigin(n,i),a=e.getLeft()+(t.x-o.x),r=e.getTop()+(t.y-o.y);e.set({hasControls:!0,hasBorders:!0,originX:"center",originY:"center",left:a,top:r}),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 a=function(){function e(e,t){for(var n=0;n1?n-1:0),o=1;o0&&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",this._setEditorPosition(l),this._editorElementWrap.style.bottom="0px",this._editorElementWrap.style.top="0px",this._editorElementWrap.style.left="0px",this._editorElementWrap.style.width="100%";var c=this._selectedElement.classList;"top"===l&&this._selectedElement.offsetWidth0&&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=L[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,{locale:e._locale,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.nodeType?e:document.querySelector(e);var n=c.default.getSelector(t);t.classList.add("tui-image-editor-container"),t.innerHTML=(0,f.default)({locale:this._locale,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)({locale:this._locale,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.hover,a='\n \n \n \n \n \n ';t.id="tie-btn-"+e,t.className="tui-image-editor-item normal",t.title=this._locale.localize(e.replace(/^[a-z]/g,function(e){return e.toUpperCase()})),t.innerHTML=a,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:"activeMenuEvent",value:function(){var e=this;this._initMenuEvent||(this._addHelpActionEvent("undo"),this._addHelpActionEvent("redo"),this._addHelpActionEvent("reset"),this._addHelpActionEvent("delete"),this._addHelpActionEvent("deleteAll"),this._addDownloadEvent(),s.default.forEach(this.options.menu,function(t){e._addMenuEvent(t),e._addSubMenuEvent(t)}),this._initMenu(),this._initMenuEvent=!0)}},{key:"initCanvas",value:function(){var e=this,t=this._getLoadImage();t.path&&this._actions.main.initLoadImage(t.path,t.name).then(function(){e.activeMenuEvent()}),this._addLoadEvent();var n=document.createElement("div");n.className="tui-image-editor-grid-visual";var i='\n \n \n \n
    ';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:"_setEditorPosition",value:function(e){var t=this._getEditorDimension(),n=t.width,i=t.height,o=this._editorElement.style,r=0,a=0;this.submenu&&("bottom"===e?r=i>this._editorElementWrap.scrollHeight-150?(i-this._editorElementWrap.scrollHeight)/2:-75:"top"===e?r=i>this._editorElementWrap.offsetHeight-150?75-(i-(this._editorElementWrap.offsetHeight-150))/2:75:"left"===e?a=n>this._editorElementWrap.offsetWidth-248?124-(n-(this._editorElementWrap.offsetWidth-248))/2:124:"right"===e&&(a=n>this._editorElementWrap.scrollWidth-248?(n-this._editorElementWrap.scrollWidth)/2:-124)),o.top=r+"px",o.left=a+"px"}}]),e}();t.default=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;n0&&void 0!==arguments[0]?arguments[0]:this.defaultPresetButton;c.default.forEach([].slice.call(this._els.preset.querySelectorAll(".preset")),function(e){e.classList.remove("active")}),e&&e.classList.add("active")}}]),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\n \n
      \n
    • \n \n \n \n \n \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n
      \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n
      \n
    • \n
    \n\n
    \n
    \n '+t.localize("Load")+'\n \n
    \n \n
    \n \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.biImage,i=e.commonStyle,o=e.headerStyle,r=e.loadButtonStyle,a=e.downloadButtonStyle,s=e.submenuStyle;return'\n
    \n
    \n \n
    \n
    \n '+t.localize("Load")+'\n \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \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.submenuDisabledRangePointer,p=e.submenuDisabledRangeBar,g=e.submenuDisabledRangeSubbar,v=e.submenuIconSize,m=e.menuIconSize,b=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-star-2 .tui-image-editor-button[data-icontype="icon-star-2"] 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-crop-preset-button .tui-image-editor-button.preset.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-checkbox input:checked + label:before {\n border: 0;\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-disabled .tui-image-editor-virtual-range-pointer {\n "+f+"\n }\n .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-subbar {\n "+g+"\n }\n .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-bar {\n "+p+"\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 "+m+"\n }\n .tui-image-editor-container .svg_ic-submenu {\n "+v+"\n }\n .tui-image-editor-container .tui-image-editor-controls-logo > img,\n .tui-image-editor-container .tui-image-editor-header-logo > img {\n "+b+"\n }\n\n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n \n \n \n \n \n
      \n
      \n \n \n \n \n \n
      \n
    • \n
    \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale;return'\n
      \n
    • \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n\n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
    • \n
    \n'; -}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n \n \n \n \n \n
      \n
    • \n
    \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \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-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(140);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(125),r=n(124),a=n(11),s=n(42),l=n(143),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(130),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(131),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(134);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(141),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(119)(!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(133),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(117),o=n(128),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(118),p=n(120),g=n(138),v=n(41).set,m=n(129)(),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(135)(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(137)(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(127)(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(139)(!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(144);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 - * @license MIT - */ -!function(t,i){e.exports=i(n(2))}(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;d0&&(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;n1?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._distancet)return e+"";for(;i 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{{colorList}}','
    ','','','{{color}}',"
    "].join("\n"),i='
  • ',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=['
    {{slider}}
    ','
    {{huebar}}
    '].join("\n"),r=['',"",'','','',"",'','','',"","",'','','',""].join("\n"),a=['
    ','','',"",'','',"",'',"
    "].join("\n"),s=['',"",'','','','','','','','',"","",'','',""].join("\n"),l=['
    ','','',"",'',"
    "].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}())}])})}])}); \ No newline at end of file +function(){if("undefined"!=typeof window&&window.addEventListener){var e,t,n=Object.create(null),i=function(){clearTimeout(t),t=setTimeout(e,100)},o=function(){},a=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)})},r=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(),a())}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;f0&&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(),a=o.width,r=o.height,s=this._editorElement.style,l=this.options.menuBarPosition;s.height=r+"px",s.width=a+"px",this._setEditorPosition(l),this._editorElementWrap.style.bottom="0px",this._editorElementWrap.style.top="0px",this._editorElementWrap.style.left="0px",this._editorElementWrap.style.width="100%";var c=this._selectedElement.classList;"top"===l&&this._selectedElement.offsetWidth0&&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=L[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,{locale:e._locale,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.nodeType?e:document.querySelector(e);var n=c.default.getSelector(t);t.classList.add("tui-image-editor-container"),t.innerHTML=(0,f.default)({locale:this._locale,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)({locale:this._locale,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,a=n.hover,r='\n \n \n \n \n \n ';t.id="tie-btn-"+e,t.className="tui-image-editor-item normal",t.title=this._locale.localize(e.replace(/^[a-z]/g,function(e){return e.toUpperCase()})),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:"activeMenuEvent",value:function(){var e=this;this._initMenuEvent||(this._addHelpActionEvent("undo"),this._addHelpActionEvent("redo"),this._addHelpActionEvent("reset"),this._addHelpActionEvent("delete"),this._addHelpActionEvent("deleteAll"),this._addDownloadEvent(),s.default.forEach(this.options.menu,function(t){e._addMenuEvent(t),e._addSubMenuEvent(t)}),this._initMenu(),this._initMenuEvent=!0)}},{key:"initCanvas",value:function(){var e=this,t=this._getLoadImage();t.path&&this._actions.main.initLoadImage(t.path,t.name).then(function(){e.activeMenuEvent()}),this._addLoadEvent();var n=document.createElement("div");n.className="tui-image-editor-grid-visual";var i='\n \n \n \n
    ';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:"_setEditorPosition",value:function(e){var t=this._getEditorDimension(),n=t.width,i=t.height,o=this._editorElement.style,a=0,r=0;this.submenu&&("bottom"===e?a=i>this._editorElementWrap.scrollHeight-150?(i-this._editorElementWrap.scrollHeight)/2:-75:"top"===e?a=i>this._editorElementWrap.offsetHeight-150?75-(i-(this._editorElementWrap.offsetHeight-150))/2:75:"left"===e?r=n>this._editorElementWrap.offsetWidth-248?124-(n-(this._editorElementWrap.offsetWidth-248))/2:124:"right"===e&&(r=n>this._editorElementWrap.scrollWidth-248?(n-this._editorElementWrap.scrollWidth)/2:-124)),o.top=a+"px",o.left=r+"px"}}]),e}();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 a(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 r(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;n0&&void 0!==arguments[0]?arguments[0]:this.defaultPresetButton;c.default.forEach([].slice.call(this._els.preset.querySelectorAll(".preset")),function(e){e.classList.remove("active")}),e&&e.classList.add("active")}}]),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 a(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 r(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\n \n
      \n
    • \n \n \n \n \n \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n
      \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n \n \n \n \n \n
    • \n
    • \n
      \n
    • \n
    \n\n
    \n
    \n '+t.localize("Load")+'\n \n
    \n \n
    \n \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.biImage,i=e.commonStyle,o=e.headerStyle,a=e.loadButtonStyle,r=e.downloadButtonStyle,s=e.submenuStyle;return'\n
    \n
    \n \n
    \n
    \n '+t.localize("Load")+'\n \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \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,a=e.submenuPartitionHorizontal,r=e.submenuCheckbox,s=e.submenuRangePointer,l=e.submenuRangeValue,c=e.submenuColorpickerTitle,u=e.submenuColorpickerButton,d=e.submenuRangeBar,h=e.submenuRangeSubbar,f=e.submenuDisabledRangePointer,p=e.submenuDisabledRangeBar,g=e.submenuDisabledRangeSubbar,v=e.submenuIconSize,m=e.menuIconSize,b=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-star-2 .tui-image-editor-button[data-icontype="icon-star-2"] 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-crop-preset-button .tui-image-editor-button.preset.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 "+a+"\n }\n .tui-image-editor-container .tui-image-editor-checkbox input + label:before {\n "+r+"\n }\n .tui-image-editor-container .tui-image-editor-checkbox input:checked + label:before {\n border: 0;\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-disabled .tui-image-editor-virtual-range-pointer {\n "+f+"\n }\n .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-subbar {\n "+g+"\n }\n .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-bar {\n "+p+"\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 "+m+"\n }\n .tui-image-editor-container .svg_ic-submenu {\n "+v+"\n }\n .tui-image-editor-container .tui-image-editor-controls-logo > img,\n .tui-image-editor-container .tui-image-editor-header-logo > img {\n "+b+"\n }\n\n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n \n \n \n \n \n
      \n
      \n \n \n \n \n \n
      \n
    • \n
    \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale;return'\n
      \n
    • \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n \n \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n\n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n \n
      \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n \n \n
      \n
      \n
    • \n
    \n'; +}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n\n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n \n \n \n \n \n
      \n
    • \n
    \n"}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \n'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.locale,n=e.iconStyle,i=n.normal,o=n.active;return'\n
      \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
      \n
      \n \n \n \n \n
      \n \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n
      \n
    • \n
    • \n \n
      \n \n
    • \n
    \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 a(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 r(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-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),a=n(140);e.exports=function(e){return function(t,n,r){var s,l=i(t),c=o(l.length),u=a(r,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(125),a=n(124),r=n(11),s=n(42),l=n(143),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(a(m)){for(f=s(e.length);f>y;y++)if(v=t?b(r(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"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[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 a=e.return;throw void 0!==a&&i(a.call(e)),t}}},function(e,t,n){"use strict";var i=n(130),o=n(39),a=n(27),r={};n(12)(r,n(7)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=i(r,{next:o(1,n)}),a(e,t+" Iterator")}},function(e,t,n){var i=n(7)("iterator"),o=!1;try{var a=[7][i]();a.return=function(){o=!0},Array.from(a,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var a=[7],r=a[i]();r.next=function(){return{done:n=!0}},a[i]=function(){return r},e(a)}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,a=i.MutationObserver||i.WebKitMutationObserver,r=i.process,s=i.Promise,l="process"==n(19)(r);e.exports=function(){var e,t,n,c=function(){var i,o;for(l&&(i=r.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(){r.nextTick(c)};else if(a){var u=!0,d=document.createTextNode("");new a(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(131),a=n(33),r=n(28)("IE_PROTO"),s=function(){},l="prototype",c=function(){var e,t=n(26)("iframe"),i=a.length,o="<",r=">";for(t.style.display="none",n(36).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(o+"script"+r+"document.F=Object"+o+"/script"+r),e.close(),c=e.F;i--;)delete c[l][a[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[r]=e):n=c(),void 0===t?n:o(n,t)}},function(e,t,n){var i=n(23),o=n(11),a=n(134);e.exports=n(17)?Object.defineProperties:function(e,t){o(e);for(var n,r=a(t),s=r.length,l=0;s>l;)i.f(e,n=r[l++],t[n]);return e}},function(e,t,n){var i=n(21),o=n(141),a=n(28)("IE_PROTO"),r=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),i(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?r:null}},function(e,t,n){var i=n(21),o=n(30),a=n(119)(!1),r=n(28)("IE_PROTO");e.exports=function(e,t){var n,s=o(e),l=0,c=[];for(n in s)n!=r&&i(s,n)&&c.push(n);for(;t.length>l;)i(s,n=t[l++])&&(~a(c,n)||c.push(n));return c}},function(e,t,n){var i=n(133),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),a=n(23),r=n(17),s=n(7)("species");e.exports=function(e){var t="function"==typeof o[e]?o[e]:i[e];r&&t&&!t[s]&&a.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var i=n(11),o=n(24),a=n(7)("species");e.exports=function(e,t){var n,r=i(e).constructor;return void 0===r||void 0==(n=i(r)[a])?t:o(n)}},function(e,t,n){var i=n(29),o=n(25);e.exports=function(e){return function(t,n){var a,r,s=String(o(t)),l=i(n),c=s.length;return l<0||l>=c?e?"":void 0:(a=s.charCodeAt(l),a<55296||a>56319||l+1===c||(r=s.charCodeAt(l+1))<56320||r>57343?e?s.charAt(l):a:e?s.slice(l,l+2):(a-55296<<10)+(r-56320)+65536)}}},function(e,t,n){var i=n(29),o=Math.max,a=Math.min;e.exports=function(e,t){return e=i(e),e<0?o(e+t,0):a(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"),a=n(18);e.exports=n(16).getIteratorMethod=function(e){if(void 0!=e)return e[o]||e["@@iterator"]||a[i(e)]}},function(e,t,n){"use strict";var i=n(117),o=n(128),a=n(18),r=n(30);e.exports=n(37)(Array,"Array",function(e,t){this._t=r(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"),a.Arguments=a.Array,i("keys"),i("values"),i("entries")},function(e,t){},function(e,t,n){"use strict";var i,o,a,r=n(38),s=n(9),l=n(20),c=n(32),u=n(34),d=n(22),h=n(24),f=n(118),p=n(120),g=n(138),v=n(41).set,m=n(129)(),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===a},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,a=0,r=function(t){var n,a,r=o?t.ok:t.fail,s=t.resolve,l=t.reject,c=t.domain;try{r?(o||(2==e._h&&I(e),e._h=1),r===!0?n=i:(c&&c.enter(),n=r(i),c&&c.exit()),n===t.promise?l(y("Promise-chain cycle")):(a=O(n))?a.call(n,s,l):s(n)):l(i)}catch(e){l(e)}};n.length>a;)r(n[a++]);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})})},R=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))},D=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(D,i,1),l(R,i,1))}catch(e){R.call(i,e)}}):(n._v=e,n._s=1,T(n,!1))}catch(e){R.call({_w:n,_d:!1},e)}}};E||(k=function(e){f(this,k,b,"_h"),h(e),i.call(this);try{e(l(D,this,1),l(R,this,1))}catch(e){R.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(135)(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(D,e,1),this.reject=l(R,e,1)}),u(u.G+u.W+u.F*!E,{Promise:k}),n(27)(k,b),n(137)(b),a=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*(r||!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(127)(function(e){k.all(e).catch(x)})),b,{all:function(e){var t=this,n=S(t),i=n.resolve,o=n.reject,a=j(function(){var n=[],a=0,r=1;p(e,!1,function(e){var s=a++,l=!1;n.push(void 0),r++,t.resolve(e).then(function(e){l||(l=!0,n[s]=e,--r||i(n))},o)}),--r||i(n)});return a&&o(a.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(139)(!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(144);for(var i=n(9),o=n(12),a=n(18),r=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[r]&&o(d,r,c),a[c]=a.Array}},function(e,t){},function(e,t){e.exports=n}])}); \ No newline at end of file