(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i
#_delete_##_edit_#Date: #_date_#
#_note_#
', validation: 'none', columns: [{ title: 'Description', dataIndex: 'description', key: 'description' }, { title: 'Rate', dataIndex: 'rate', key: 'rate' }, { title: 'Quantity', dataIndex: 'qty', key: 'qty' }, { title: 'Line Total', dataIndex: 'lineTotal', key: 'lineTotal' }], 'sort-function': function sortFunction(a, b) { var t1 = Date.parse(a.date).getTime(); var t2 = Date.parse(b.date).getTime(); return t1 < t2; }, 'custom-validate-function': function customValidateFunction(data) { var res = {}; res.valid = true; data.date = new Date().toString('d-MMM-yyyy hh:mm tt'); res.params = data; return res; } }]]; } }, { key: "getTableColumns", value: function getTableColumns() { return [{ title: 'Invoice Id', dataIndex: 'invoiceId', sorter: true }, { title: 'Description', dataIndex: 'description', sorter: true }]; } }, { key: "getTableActionButtonJsx", value: function getTableActionButtonJsx(adapter) { return function (text, record) { return /*#__PURE__*/_react["default"].createElement(_antd.Space, { size: "middle" }, adapter.hasAccess('save') && adapter.showEdit && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "green", onClick: function onClick() { return modJs.edit(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.EditOutlined, null), " ".concat(adapter.gt('Edit'))), adapter.hasAccess('element') && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "blue", onClick: function onClick() { return modJs.viewElement(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.MonitorOutlined, null), " ".concat(adapter.gt('View'))), adapter.hasAccess('delete') && adapter.showDelete && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "volcano", onClick: function onClick() { return modJs.deleteRow(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.DeleteOutlined, null), " ".concat(adapter.gt('Delete'))), adapter.hasAccess('save') && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "cyan", onClick: function onClick() { return modJs.copyRow(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.CopyOutlined, null), " ".concat(adapter.gt('Copy'))), /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "green", onClick: function onClick() { return modJs.printInvoice(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.PrinterOutlined, null), " ".concat(adapter.gt('Print')))); }; } }, { key: "printInvoice", value: function printInvoice(id) { var params = {}; params.id = id; var reqJson = JSON.stringify(params); var callBackData = []; callBackData.callBackData = []; callBackData.callBackSuccess = 'printInvoiceSuccessCallback'; callBackData.callBackFail = 'printInvoiceFailCallback'; this.customAction('printInvoice', 'extension=invoices', reqJson, callBackData); } }, { key: "printInvoiceSuccessCallback", value: function printInvoiceSuccessCallback(callBackData) { this.showMessage('Success', 'Printing Done'); this.get([]); } }, { key: "printInvoiceFailCallback", value: function printInvoiceFailCallback(callBackData) { this.showMessage('Error', callBackData); } }]); return InvoiceAdapter; }(_ReactModalAdapterBase["default"]); module.exports = { InvoiceAdapter: InvoiceAdapter }; },{"../../../../web/api/ReactModalAdapterBase":11,"@ant-design/icons":"@ant-design/icons","antd":"antd","react":"react","react-dom":"react-dom"}],3:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; },{}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /* Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de) Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah) */ /** * RequestCache */ var MemoryStorage = /*#__PURE__*/function () { function MemoryStorage() { _classCallCheck(this, MemoryStorage); this.data = {}; } _createClass(MemoryStorage, [{ key: "getItem", value: function getItem(key) { return this.data[key]; } }, { key: "setItem", value: function setItem(key, data) { this.data[key] = data; } }, { key: "removeAllByPrefix", value: function removeAllByPrefix(prefix) { var keys = Object.keys(this.data); for (var i = 0; i < keys.length; i++) { if (keys[i].indexOf(prefix) > 0) { delete this.data[keys[i]]; } } } }]); return MemoryStorage; }(); var RequestCache = /*#__PURE__*/function () { function RequestCache(storage) { _classCallCheck(this, RequestCache); if (!storage) { this.storage = new MemoryStorage(); } else { this.storage = storage; } } _createClass(RequestCache, [{ key: "getKey", value: function getKey(url, params) { var key = "".concat(url, "|"); for (var index in params) { key += "".concat(index, "=").concat(params[index], "|"); } return key; } /* invalidateTable(table) { let key; for (let i = 0; i < this.storage.length; i++) { key = this.storage.key(i); if (key.indexOf(`t=${table}`) > 0) { this.storage.removeItem(key); } } } */ }, { key: "invalidateTable", value: function invalidateTable(table) { this.storage.removeAllByPrefix("t=".concat(table)); } }, { key: "getData", value: function getData(key) { var data = this.storage.getItem(key); if (!data) { return null; } return data; } }, { key: "setData", value: function setData(key, data) { if (data.status !== undefined && data.status != null && data.status !== 'SUCCESS') { return null; } this.storage.setItem(key, data); return data; } }]); return RequestCache; }(); var _default = RequestCache; exports["default"] = _default; },{}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _IceApiClient = _interopRequireDefault(require("./IceApiClient")); var _ModuleBase2 = _interopRequireDefault(require("./ModuleBase")); var _RequestCache = _interopRequireDefault(require("../api-common/RequestCache")); var _MasterDataReader = _interopRequireDefault(require("./MasterDataReader")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var AdapterBase = /*#__PURE__*/function (_ModuleBase) { _inherits(AdapterBase, _ModuleBase); var _super = _createSuper(AdapterBase); function AdapterBase(endPoint, tab, filter, orderBy) { var _this; _classCallCheck(this, AdapterBase); _this = _super.call(this); _this.moduleRelativeURL = null; _this.tableData = []; _this.sourceData = []; _this.filter = null; _this.origFilter = null; _this.orderBy = null; _this.currentElement = null; _this.initAdapter(endPoint, tab, filter, orderBy); return _this; } _createClass(AdapterBase, [{ key: "initAdapter", value: function initAdapter(endPoint, tab, filter, orderBy) { this.moduleRelativeURL = baseUrl; this.table = endPoint; if (tab === undefined || tab === null) { this.tab = endPoint; } else { this.tab = tab; } if (filter === undefined || filter === null) { this.filter = null; } else { this.filter = filter; } this.origFilter = this.filter; if (orderBy === undefined || orderBy === null) { this.orderBy = null; } else { this.orderBy = orderBy; } this.trackEvent('initAdapter', tab); this.requestCache = new _RequestCache["default"](); } }, { key: "initMasterDataReader", value: function initMasterDataReader() { this.masterDataReader = new _MasterDataReader["default"](this); } }, { key: "setupApiClient", value: function setupApiClient(token) { this.apiClient = new _IceApiClient["default"](this.apiUrl, token, window.CLIENT_BASE_URL, true); } }, { key: "setApiUrl", value: function setApiUrl(apiUrl) { this.apiUrl = apiUrl; } }, { key: "setFilter", value: function setFilter(filter) { this.filter = filter; } }, { key: "preSetFilterExternal", value: function preSetFilterExternal(filter) { this.initialFilter = filter; } }, { key: "setFilterExternal", value: function setFilterExternal(_filter) { var filter = _filter; if (filter === undefined || filter === null) { filter = this.initialFilter; } if (filter === undefined || filter === null) { return; } this.setFilter(filter); this.filtersAlreadySet = true; $("#".concat(this.getTableName(), "_resetFilters")).show(); this.currentFilterString = this.getFilterString(filter); } }, { key: "getFilter", value: function getFilter() { return this.filter; } }, { key: "setOrderBy", value: function setOrderBy(orderBy) { this.orderBy = orderBy; } }, { key: "getOrderBy", value: function getOrderBy() { return this.orderBy; } }, { key: "getFile", value: function getFile(name) { var _this2 = this; this.trackEvent('file', name); return new Promise(function (resolve, reject) { $.getJSON(_this2.moduleRelativeURL, { a: 'file', name: name }, function (data) { if (data.status === 'SUCCESS') { resolve(data.data); } else { reject(); } }).fail(function () { return reject(); }); }); } /** * @method add * @param object {Array} object data to be added to database * @param getFunctionCallBackData {Array} once a success is returned call get() function for this module with these parameters * @param _callGetFunction {Boolean} if false the get function of the module will not be called (default: true) * @param successCallback {Function} this will get called after success response */ }, { key: "add", value: function add(object, getFunctionCallBackData, callGetFunction, successCallback) { var that = this; if (callGetFunction === undefined || callGetFunction === null) { // eslint-disable-next-line no-param-reassign callGetFunction = true; } $(object).attr('a', 'add'); $(object).attr('t', this.table); that.showLoader(); this.requestCache.invalidateTable(this.table); $.post(this.moduleRelativeURL, object, function (data) { if (data.status === 'SUCCESS') { that.addSuccessCallBack(getFunctionCallBackData, data.object, callGetFunction, successCallback, that); } else { that.addFailCallBack(getFunctionCallBackData, data.object); } }, 'json').fail(function (e) { if (e.status === 403) { that.showMessage('Access Forbidden', e.responseJSON.message); } }).always(function () { that.hideLoader(); }); this.trackEvent('add', this.tab, this.table); } }, { key: "addSuccessCallBack", value: function addSuccessCallBack(callBackData, serverData, callGetFunction, successCallback, thisObject) { if (callGetFunction) { this.get(callBackData); } this.initFieldMasterData(); if (successCallback !== undefined && successCallback !== null) { successCallback.apply(thisObject, [serverData]); } this.trackEvent('addSuccess', this.tab, this.table); } }, { key: "addFailCallBack", value: function addFailCallBack(callBackData, serverData) { try { this.closePlainMessage(); } catch (e) {// No need to report } this.showMessage('Error saving', serverData); this.trackEvent('addFailed', this.tab, this.table); } }, { key: "deleteObj", value: function deleteObj(id, callBackData) { var that = this; that.showLoader(); this.requestCache.invalidateTable(this.table); $.post(this.moduleRelativeURL, { t: this.table, a: 'delete', id: id }, function (data) { if (data.status === 'SUCCESS') { that.deleteSuccessCallBack(callBackData, data.object); } else { that.deleteFailCallBack(callBackData, data.object); } }, 'json').fail(function (e) { if (e.status === 403) { that.showMessage('Access Forbidden', e.responseJSON.message); } }).always(function () { that.hideLoader(); }); this.trackEvent('delete', this.tab, this.table); } // eslint-disable-next-line no-unused-vars }, { key: "deleteSuccessCallBack", value: function deleteSuccessCallBack(callBackData, serverData) { this.get(callBackData); this.clearDeleteParams(); } }, { key: "deleteFailCallBack", value: function deleteFailCallBack(callBackData, serverData) { this.clearDeleteParams(); this.showMessage('Error Occurred while Deleting Item', serverData); } }, { key: "get", value: function get(callBackData) { var that = this; if (this.getRemoteTable()) { this.createTableServer(this.getTableName()); $("#".concat(this.getTableName(), "Form")).hide(); $("#".concat(this.getTableName())).show(); return; } var sourceMappingJson = JSON.stringify(this.getSourceMapping()); var filterJson = ''; if (this.getFilter() !== null) { filterJson = JSON.stringify(this.getFilter()); } var orderBy = ''; if (this.getOrderBy() !== null) { orderBy = this.getOrderBy(); } sourceMappingJson = this.fixJSON(sourceMappingJson); filterJson = this.fixJSON(filterJson); that.showLoader(); $.post(this.moduleRelativeURL, { t: this.table, a: 'get', sm: sourceMappingJson, ft: filterJson, ob: orderBy }, function (data) { if (data.status === 'SUCCESS') { that.getSuccessCallBack(callBackData, data.object); } else { that.getFailCallBack(callBackData, data.object); } }, 'json').fail(function (e) { if (e.status === 403) { that.showMessage('Access Forbidden', e.responseJSON.message); } }).always(function () { that.hideLoader(); }); that.initFieldMasterData(); this.trackEvent('get', this.tab, this.table); // var url = this.getDataUrl(); // console.log(url); } }, { key: "getDataUrl", value: function getDataUrl(_columns) { var sourceMappingJson = JSON.stringify(this.getSourceMapping()); var columns = JSON.stringify(_columns); var filterJson = ''; if (this.getFilter() !== null) { filterJson = JSON.stringify(this.getFilter()); } var orderBy = ''; if (this.getOrderBy() !== null) { orderBy = this.getOrderBy(); } var url = this.moduleRelativeURL.replace('service.php', 'data.php'); url = "".concat(url, "?t=").concat(this.table); url = "".concat(url, "&sm=").concat(this.fixJSON(sourceMappingJson)); url = "".concat(url, "&cl=").concat(this.fixJSON(columns)); url = "".concat(url, "&ft=").concat(this.fixJSON(filterJson)); url = "".concat(url, "&ob=").concat(orderBy); if (this.isSubProfileTable()) { url = "".concat(url, "&type=sub"); } if (this.remoteTableSkipProfileRestriction()) { url = "".concat(url, "&skip=1"); } return url; } }, { key: "isSubProfileTable", value: function isSubProfileTable() { return false; } }, { key: "remoteTableSkipProfileRestriction", value: function remoteTableSkipProfileRestriction() { return false; } }, { key: "preProcessTableData", value: function preProcessTableData(row) { return row; } }, { key: "getSuccessCallBack", value: function getSuccessCallBack(callBackData, serverData) { var data = []; var mapping = this.getDataMapping(); for (var i = 0; i < serverData.length; i++) { var row = []; for (var j = 0; j < mapping.length; j++) { row[j] = serverData[i][mapping[j]]; } data.push(this.preProcessTableData(row)); } this.sourceData = serverData; if (callBackData.callBack !== undefined && callBackData.callBack !== null) { if (callBackData.callBackData === undefined || callBackData.callBackData === null) { callBackData.callBackData = []; } callBackData.callBackData.push(serverData); callBackData.callBackData.push(data); this.callFunction(callBackData.callBack, callBackData.callBackData); } this.tableData = data; if (!(callBackData.noRender !== undefined && callBackData.noRender !== null && callBackData.noRender === true)) { this.createTable(this.getTableName()); $("#".concat(this.getTableName(), "Form")).hide(); $("#".concat(this.getTableName())).show(); } } // eslint-disable-next-line no-unused-vars }, { key: "getFailCallBack", value: function getFailCallBack(callBackData, serverData) {} }, { key: "getElement", value: function getElement(id, callBackData, clone) { var that = this; var sourceMappingJson = JSON.stringify(this.getSourceMapping()); sourceMappingJson = this.fixJSON(sourceMappingJson); that.showLoader(); $.post(this.moduleRelativeURL, { t: this.table, a: 'getElement', id: id, sm: sourceMappingJson }, function (data) { if (data.status === 'SUCCESS') { if (clone) { delete data.object.id; } this.currentElement = data.object; that.getElementSuccessCallBack.apply(that, [callBackData, data.object]); } else { that.getElementFailCallBack.apply(that, [callBackData, data.object]); } }, 'json').fail(function (e) { if (e.status === 403) { that.showMessage('Access Forbidden', e.responseJSON.message); } }).always(function () { that.hideLoader(); }); this.trackEvent('getElement', this.tab, this.table); } }, { key: "getElementSuccessCallBack", value: function getElementSuccessCallBack(callBackData, serverData) { if (callBackData.callBack !== undefined && callBackData.callBack !== null) { if (callBackData.callBackData === undefined || callBackData.callBackData === null) { callBackData.callBackData = []; } callBackData.callBackData.push(serverData); this.callFunction(callBackData.callBack, callBackData.callBackData, this); } this.currentElement = serverData; if (!(callBackData.noRender !== undefined && callBackData.noRender !== null && callBackData.noRender === true)) { this.renderForm(serverData); } } // eslint-disable-next-line no-unused-vars }, { key: "getElementFailCallBack", value: function getElementFailCallBack(callBackData, serverData) {} }, { key: "getTableData", value: function getTableData() { return this.tableData; } }, { key: "getTableName", value: function getTableName() { return this.tab; } }, { key: "getFieldValues", value: function getFieldValues(fieldMaster, callBackData) { var that = this; var method = ''; var methodParams = ''; if (fieldMaster[3] !== undefined && fieldMaster[3] !== null) { // eslint-disable-next-line prefer-destructuring method = fieldMaster[3]; } if (fieldMaster[4] !== undefined && fieldMaster[4] !== null) { methodParams = JSON.stringify(fieldMaster[4]); } var key = this.requestCache.getKey(this.moduleRelativeURL, { t: fieldMaster[0], key: fieldMaster[1], value: fieldMaster[2], method: method, methodParams: methodParams, a: 'getFieldValues' }); var cacheData = this.requestCache.getData(key); if (cacheData !== null && cacheData !== undefined) { if (cacheData.status === 'SUCCESS') { callBackData.callBackData.push(cacheData.data); if (callBackData.callBackSuccess !== null && callBackData.callBackSuccess !== undefined) { callBackData.callBackData.push(callBackData.callBackSuccess); } that.callFunction(callBackData.callBack, callBackData.callBackData); } } else { var callbackWraper = function callbackWraper(data) { if (data.status === 'SUCCESS') { that.requestCache.setData(this.success.key, data); var localCallBackData = callBackData; localCallBackData.callBackData = [callBackData.callBackData[0]]; localCallBackData.callBackData.push(data.data); if (localCallBackData.callBackSuccess !== null && localCallBackData.callBackSuccess !== undefined) { localCallBackData.callBackData.push(callBackData.callBackSuccess); } that.callFunction(localCallBackData.callBack, localCallBackData.callBackData); } else if (data.message === 'Access violation') { alert("Error : ".concat(callbackWraper.table, " ").concat(data.message)); } }; callbackWraper.key = key; // eslint-disable-next-line prefer-destructuring callbackWraper.table = fieldMaster[0]; $.post(this.moduleRelativeURL, { t: fieldMaster[0], key: fieldMaster[1], value: fieldMaster[2], method: method, methodParams: methodParams, a: 'getFieldValues' }, callbackWraper, 'json'); } } }, { key: "setAdminProfile", value: function setAdminProfile(empId) { try { localStorage.clear(); } catch (e) {// No need to report } $.post(this.moduleRelativeURL, { a: 'setAdminEmp', empid: empId }, function () { // eslint-disable-next-line no-restricted-globals top.location.href = clientUrl; }, 'json'); } }, { key: "customAction", value: function customAction(subAction, module, request, callBackData, isPost) { var that = this; request = this.fixJSON(request); if (!isPost) { $.getJSON(this.moduleRelativeURL, { t: this.table, a: 'ca', sa: subAction, mod: module, req: request }, function (data) { if (data.status === 'SUCCESS') { console.log("successsss"); callBackData.callBackData.push(data.data); that.callFunction(callBackData.callBackSuccess, callBackData.callBackData); } else { console.log("nooo"); callBackData.callBackData.push(data.data); that.callFunction(callBackData.callBackFail, callBackData.callBackData); } }); } else { $.post(this.moduleRelativeURL, { t: this.table, a: 'ca', sa: subAction, mod: module, req: request }, function (data) { if (data.status === 'SUCCESS') { callBackData.callBackData.push(data.data); that.callFunction(callBackData.callBackSuccess, callBackData.callBackData); } else { callBackData.callBackData.push(data.data); that.callFunction(callBackData.callBackFail, callBackData.callBackData); } }, 'json'); } } }, { key: "sendCustomRequest", value: function sendCustomRequest(action, params, successCallback, failCallback) { params.a = action; $.post(this.moduleRelativeURL, params, function (data) { if (data.status === 'SUCCESS') { successCallback(data.data); } else { failCallback(data.data); } }, 'json'); } }, { key: "getCustomActionUrl", value: function getCustomActionUrl(action, params) { params.a = action; var str = ''; for (var key in params) { if (params.hasOwnProperty(key)) { if (str !== '') { str += '&'; } str += "".concat(key, "=").concat(params[key]); } } return "".concat(this.moduleRelativeURL, "?").concat(str); } }, { key: "getClientDataUrl", value: function getClientDataUrl() { return "".concat(this.moduleRelativeURL.replace('service.php', ''), "data/"); } }, { key: "getCustomUrl", value: function getCustomUrl(str) { return this.moduleRelativeURL.replace('service.php', str); } }]); return AdapterBase; }(_ModuleBase2["default"]); var _default = AdapterBase; exports["default"] = _default; },{"../api-common/RequestCache":4,"./IceApiClient":7,"./MasterDataReader":9,"./ModuleBase":10}],6:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /* Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de) Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah) */ /* global tinyMCE */ var ValidationRules = { "float": function float(str) { var floatstr = /^[-+]?[0-9]+(\.[0-9]+)?$/; if (str != null && str.match(floatstr)) { return true; } return false; }, number: function number(str) { var numstr = /^[0-9]+$/; if (str != null && str.match(numstr)) { return true; } return false; }, numberOrEmpty: function numberOrEmpty(str) { if (str === '') { return true; } var numstr = /^[0-9]+$/; if (str != null && str.match(numstr)) { return true; } return false; }, email: function email(str) { var emailPattern = /^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/; return str != null && emailPattern.test(str); }, emailOrEmpty: function emailOrEmpty(str) { if (str === '') { return true; } var emailPattern = /^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/; return str != null && emailPattern.test(str); }, username: function username(str) { var username = /^[a-zA-Z0-9.-]+$/; return str != null && username.test(str); }, input: function input(str) { if (str != null && str.length > 0) { return true; } return false; } }; var FormValidation = /*#__PURE__*/function () { function FormValidation(formId, validateAll, options) { _classCallCheck(this, FormValidation); this.tempOptions = {}; this.formId = formId; this.formError = false; this.formObject = null; this.errorMessages = ''; this.popupDialog = null; this.validateAll = validateAll; this.errorMap = []; this.settings = { thirdPartyPopup: null, LabelErrorClass: false, ShowPopup: true }; this.settings = jQuery.extend(this.settings, options); this.inputTypes = ['text', 'radio', 'checkbox', 'file', 'password', 'select-one', 'select-multi', 'textarea', 'fileupload', 'signature']; this.validator = ValidationRules; } // eslint-disable-next-line no-unused-vars _createClass(FormValidation, [{ key: "clearError", value: function clearError(formInput, overrideMessage) { var id = formInput.attr('id'); $("#".concat(this.formId, " #field_").concat(id)).removeClass('error'); $("#".concat(this.formId, " #help_").concat(id)).html(''); } // eslint-disable-next-line no-unused-vars }, { key: "addError", value: function addError(formInput, overrideMessage) { this.formError = true; if (formInput.attr('message') != null) { this.errorMessages += "".concat(formInput.attr('message'), "\n"); this.errorMap[formInput.attr('name')] = formInput.attr('message'); } else { this.errorMap[formInput.attr('name')] = ''; } var id = formInput.attr('id'); var validation = formInput.attr('validation'); var message = formInput.attr('validation'); $("#".concat(this.formId, " #field_").concat(id)).addClass('error'); if (message === undefined || message == null || message === '') { $("#".concat(this.formId, " #help_err_").concat(id)).html(message); } else if (validation === undefined || validation == null || validation === '') { $("#".concat(this.formId, " #help_err_").concat(id)).html('Required'); } else if (validation === 'float' || validation === 'number') { $("#".concat(this.formId, " #help_err_").concat(id)).html('Number required'); } else if (validation === 'email') { $("#".concat(this.formId, " #help_err_").concat(id)).html('Email required'); } else { $("#".concat(this.formId, " #help_err_").concat(id)).html('Required'); } } }, { key: "showErrors", value: function showErrors() { if (this.formError) { if (this.settings.thirdPartyPopup !== undefined && this.settings.thirdPartyPopup != null) { this.settings.thirdPartyPopup.alert(); } else if (this.settings.ShowPopup === true) { if (this.tempOptions.popupTop !== undefined && this.tempOptions.popupTop != null) { this.alert('Errors Found', this.errorMessages, this.tempOptions.popupTop); } else { this.alert('Errors Found', this.errorMessages, -1); } } } } }, { key: "checkValues", value: function checkValues(options) { this.tempOptions = options; var that = this; this.formError = false; this.errorMessages = ''; this.formObject = {}; // eslint-disable-next-line consistent-return var validate = function validate(inputObject) { var inputValue = null; var name = inputObject.attr('name'); if (that.settings.LabelErrorClass !== false) { $("label[for='".concat(name, "']")).removeClass(that.settings.LabelErrorClass); } var id = inputObject.attr('id'); var type = inputObject.attr('type'); if (inputObject.hasClass('select2-focusser') || inputObject.hasClass('select2-input')) { return true; } if (jQuery.inArray(type, that.inputTypes) >= 0) { if (inputObject.hasClass('uploadInput')) { inputValue = inputObject.attr('val'); } else if (type === 'radio' || type === 'checkbox') { inputValue = $("input[name='".concat(name, "']:checked")).val(); } else if (inputObject.hasClass('select2Field')) { if ($("#".concat(that.formId, " #").concat(id)).select2('data') != null && $("#".concat(that.formId, " #").concat(id)).select2('data') !== undefined) { inputValue = $("#".concat(that.formId, " #").concat(id)).select2('data').id; } else { inputValue = ''; } } else if (inputObject.hasClass('select2Multi')) { if ($("#".concat(that.formId, " #").concat(id)).select2('data') != null && $("#".concat(that.formId, " #").concat(id)).select2('data') !== undefined) { var inputValueObjects = $("#".concat(that.formId, " #").concat(id)).select2('data'); inputValue = []; for (var i = 0; i < inputValueObjects.length; i++) { inputValue.push(inputValueObjects[i].id); } inputValue = JSON.stringify(inputValue); } else { inputValue = ''; } } else if (inputObject.hasClass('signatureField')) { if ($("#".concat(that.formId, " #").concat(id)).data('signaturePad').isEmpty()) { inputValue = ''; } else { inputValue = $("#".concat(id)).data('signaturePad').toDataURL(); } } else if (inputObject.hasClass('simplemde')) { inputValue = $("#".concat(that.formId, " #").concat(id)).data('simplemde').value(); } else if (inputObject.hasClass('code')) { inputValue = $("#".concat(that.formId, " #").concat(id)).data('codemirror').getValue(); } else if (inputObject.hasClass('tinymce')) { inputValue = tinyMCE.get(id).getContent({ format: 'raw' }); } else { inputValue = inputObject.val(); } var validation = inputObject.attr('validation'); var valid = false; if (validation !== undefined && validation != null && that.validator[validation] !== undefined && that.validator[validation] != null) { valid = that.validator[validation](inputValue); } else { if (that.validateAll) { if (validation !== undefined && validation != null && validation === 'none') { valid = true; } else { valid = that.validator.input(inputValue); } } else { valid = true; } that.formObject[id] = inputValue; } if (!valid) { that.addError(inputObject, null); } else { that.clearError(inputObject, null); that.formObject[id] = inputValue; } } }; var inputs = $("#".concat(this.formId, " :input")); inputs.each(function () { validate($(this)); }); inputs = $("#".concat(this.formId, " .uploadInput")); inputs.each(function () { validate($(this)); }); this.showErrors(); this.tempOptions = {}; return !this.formError; } }, { key: "getFormParameters", value: function getFormParameters() { return this.formObject; } }, { key: "alert", value: function (_alert) { function alert(_x, _x2) { return _alert.apply(this, arguments); } alert.toString = function () { return _alert.toString(); }; return alert; }(function (title, text) { alert(text); }) }], [{ key: "getValidationRules", value: function getValidationRules() { return ValidationRules; } }]); return FormValidation; }(); var _default = FormValidation; exports["default"] = _default; },{}],7:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var axios = require('axios'); var IceApiClient = /*#__PURE__*/function () { function IceApiClient(baseUrl, token, clientBaseUrl) { var legacyApiWrapper = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; _classCallCheck(this, IceApiClient); this.baseUrl = baseUrl; this.token = token; this.clientBaseUrl = clientBaseUrl; this.legacyApiWrapper = legacyApiWrapper; } _createClass(IceApiClient, [{ key: "get", value: function get(endpoint) { if (this.legacyApiWrapper) { var url = "".concat(this.clientBaseUrl, "api/index.php?token=").concat(this.token, "&method=get&url=/").concat(endpoint); return axios.get(url); } return axios.get(this.baseUrl + endpoint, { headers: { Authorization: "Bearer ".concat(this.token) } }); } }]); return IceApiClient; }(); var _default = IceApiClient; exports["default"] = _default; },{"axios":25}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var axios = require('axios'); var IceDataPipe = /*#__PURE__*/function () { function IceDataPipe(adapter) { var pageSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10; _classCallCheck(this, IceDataPipe); this.adapter = adapter; this.pageSize = pageSize; } _createClass(IceDataPipe, [{ key: "readMetaData", value: function readMetaData() { this.adapter.initFieldMasterData(); } }, { key: "get", value: function get(_ref) { var _this = this; var page = _ref.page, search = _ref.search, sortField = _ref.sortField, sortOrder = _ref.sortOrder, filters = _ref.filters, limit = _ref.limit; var pageSize = limit || this.pageSize; var start = (page - 1) * pageSize; var dataUrl = this.getDataUrl(this.adapter.getDataMapping(), search, filters); var url = "".concat(dataUrl, "&iDisplayStart=").concat(start, "&iDisplayLength=").concat(pageSize); url = this.applySortingData(this.adapter.getDataMapping(), url, sortField, sortOrder); // $.post(url, (data) => { // that.getSuccessCallBack(callBackData, data); // }, 'json').always(() => { that.hideLoader(); }); url = "".concat(url, "&version=v2"); return axios.post(url, {}).then(function (data) { var key = _this.getRequestKey(page, search, sortField, sortOrder, filters, limit); var response = { items: data.data.objects, total: data.data.totalRecords }; if (_this.adapter.localStorageEnabled) { window.localStorage.setItem(key, JSON.stringify(response)); } return response; }); } }, { key: "getCachedResponse", value: function getCachedResponse(_ref2) { var page = _ref2.page, search = _ref2.search, sortField = _ref2.sortField, sortOrder = _ref2.sortOrder, filters = _ref2.filters, limit = _ref2.limit; var key = this.getRequestKey(page, search, sortField, sortOrder, filters, limit); var cachedResponse = window.localStorage.getItem(key); if (!cachedResponse) { return null; } return JSON.parse(cachedResponse); } }, { key: "clearCachedResponse", value: function clearCachedResponse(_ref3) { var page = _ref3.page, search = _ref3.search, sortField = _ref3.sortField, sortOrder = _ref3.sortOrder, filters = _ref3.filters, limit = _ref3.limit; var key = this.getRequestKey(page, search, sortField, sortOrder, filters, limit); window.localStorage.setItem(key, null); } }, { key: "getRequestKey", value: function getRequestKey(page, search, sortField, sortOrder, filters, limit) { return "".concat(this.adapter.table, "|").concat(page, "|").concat(search, "|").concat(sortField, "|").concat(sortOrder, "|").concat(filters, "|").concat(limit); } }, { key: "applySortingData", value: function applySortingData(columns, url, sortField, sortOrder) { var orderBy = ''; if (sortField) { url = "".concat(url, "&sorting=1"); url = "".concat(url, "&iSortCol_0=").concat(columns.indexOf(sortField)); url = "".concat(url, "&sSortDir_0=").concat(sortOrder === 'descend' ? 'DESC' : 'ASC'); } else if (this.adapter.getOrderBy() !== null) { // Setting the fix ordering orderBy = this.adapter.getOrderBy(); url = "".concat(url, "&ob=").concat(orderBy); } return url; } }, { key: "getDataUrl", value: function getDataUrl(_columns, searchTerm, filters) { var sourceMappingJson = JSON.stringify(this.adapter.getSourceMapping()); var columns = JSON.stringify(_columns); var filterJson = ''; if (this.adapter.getFilter() !== null) { filterJson = JSON.stringify(this.adapter.getFilter()); } var url = this.adapter.moduleRelativeURL.replace('service.php', 'data.php'); url = "".concat(url, "?t=").concat(this.adapter.table); url = "".concat(url, "&sm=").concat(sourceMappingJson); url = "".concat(url, "&cl=").concat(columns); url = "".concat(url, "&ft=").concat(filterJson); if (searchTerm && searchTerm.trim() !== '') { url += "&sSearch=".concat(searchTerm); } if (this.adapter.isSubProfileTable()) { url = "".concat(url, "&type=sub"); } if (this.adapter.remoteTableSkipProfileRestriction()) { url = "".concat(url, "&skip=1"); } return url; } }]); return IceDataPipe; }(); var _default = IceDataPipe; exports["default"] = _default; },{"axios":25}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var axios = require('axios'); var MasterDataReader = /*#__PURE__*/function () { function MasterDataReader(adapter) { _classCallCheck(this, MasterDataReader); this.adapter = adapter; this.requestCache = this.adapter.requestCache; } _createClass(MasterDataReader, [{ key: "fetchMasterData", value: function fetchMasterData(fieldMaster) { var _this = this; var method = ''; var methodParams = ''; if (fieldMaster[3] != null) { method = fieldMaster[3]; } if (fieldMaster[4] != null) { methodParams = JSON.stringify(fieldMaster[4]); } var key = this.requestCache.getKey(this.adapter.moduleRelativeURL, { t: fieldMaster[0], key: fieldMaster[1], value: fieldMaster[2], method: method, methodParams: methodParams, a: 'getFieldValues' }); var cacheData = this.requestCache.getData(key); if (cacheData != null && cacheData.status === 'SUCCESS') { return new Promise(function (resolve, reject) { return resolve(cacheData.data); }); } var urlData = { t: fieldMaster[0], key: fieldMaster[1], value: fieldMaster[2], method: method, methodParams: methodParams, a: 'getFieldValues' }; var url = "".concat(this.adapter.moduleRelativeURL, "?_url=1"); for (var index in urlData) { url = "".concat(url, "&").concat(index, "=").concat(encodeURIComponent(urlData[index])); } // TODO - Should be a get request return axios.post(url, {}).then(function (response) { if (response.data.status !== 'SUCCESS') { throw Error("Response for ".concat(key, " failed")); } _this.requestCache.setData(key, response.data); return response.data.data; }); } }, { key: "updateAllMasterData", value: function updateAllMasterData() { var _this2 = this; var remoteSourceFields = this.adapter.getRemoteSourceFields(); var promiseList = []; for (var i = 0; i < remoteSourceFields.length; i++) { var fieldRemote = remoteSourceFields[i]; if (fieldRemote[1]['remote-source'] !== undefined && fieldRemote[1]['remote-source'] != null) { (function () { var key = "".concat(fieldRemote[1]['remote-source'][0], "_").concat(fieldRemote[1]['remote-source'][1], "_").concat(fieldRemote[1]['remote-source'][2]); if (fieldRemote[1]['remote-source'].length === 4) { key = "".concat(key, "_").concat(fieldRemote[1]['remote-source'][3]); } var masterDataPromise = _this2.fetchMasterData(fieldRemote[1]['remote-source']).then(function (data) { _this2.adapter.fieldMasterData[key] = data; }); promiseList.push(masterDataPromise); })(); } } return Promise.all(promiseList); } }]); return MasterDataReader; }(); var _default = MasterDataReader; exports["default"] = _default; },{"axios":25}],10:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _FormValidation = _interopRequireDefault(require("./FormValidation")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /** * The base class for providing core functions to all module classes. * @class Base.js */ var ModuleBase = /*#__PURE__*/function () { function ModuleBase() { _classCallCheck(this, ModuleBase); this.deleteParams = {}; this.createRemoteTable = false; this.instanceId = 'None'; this.ga = []; this.showAddNew = true; this.showEdit = true; this.showDelete = true; this.showSave = true; this.showCancel = true; this.showFormOnPopup = false; this.filtersAlreadySet = false; this.currentFilterString = ''; this.sorting = 0; this.settings = {}; this.translations = {}; this.customFields = []; this.csrfRequired = false; this.fieldTemplates = null; this.templates = null; this.customTemplates = null; this.emailTemplates = null; this.fieldMasterData = {}; this.fieldMasterDataKeys = {}; this.fieldMasterDataCallback = null; this.sourceMapping = null; this.currentId = null; this.currentElement = null; this.user = null; this.currentProfile = null; this.permissions = {}; this.baseUrl = null; this.clientUrl = null; this.that = this; } // eslint-disable-next-line no-unused-vars _createClass(ModuleBase, [{ key: "init", value: function init(appName, currentView, dataUrl, permissions) {} }, { key: "initForm", value: function initForm() {} }, { key: "setObjectTypeName", value: function setObjectTypeName(objectTypeName) { this.objectTypeName = objectTypeName; } /** * Some browsers do not support sending JSON in get parameters. Set this to true to avoid sending JSON * @method setNoJSONRequests * @param val {Boolean} */ }, { key: "setNoJSONRequests", value: function setNoJSONRequests(val) { this.noJSONRequests = val; } }, { key: "setPermissions", value: function setPermissions(permissions) { this.permissions = permissions; } }, { key: "sortingStarted", value: function sortingStarted(val) { this.sorting = val; } /** * Check if the current user has a permission * @method checkPermission * @param permission {String} * @example * this.checkPermission("Upload/Delete Profile Image") */ }, { key: "checkPermission", value: function checkPermission(permission) { if (this.permissions[permission] === undefined || this.permissions[permission] == null || this.permissions[permission] === 'Yes') { return 'Yes'; } return this.permissions[permission]; } }, { key: "setBaseUrl", value: function setBaseUrl(url) { this.baseUrl = url; } }, { key: "setClientUrl", value: function setClientUrl(url) { this.clientUrl = url; } }, { key: "setUser", value: function setUser(user) { this.user = user; } }, { key: "getUser", value: function getUser() { return this.user; } }, { key: "setInstanceId", value: function setInstanceId(id) { this.instanceId = id; } }, { key: "setCSRFRequired", value: function setCSRFRequired(val) { this.csrfRequired = val; } }, { key: "scrollToTop", value: function scrollToTop() { $('html, body').animate({ scrollTop: 0 }, 'fast'); } }, { key: "scrollToBottom", value: function scrollToBottom() { $('html, body').animate({ scrollTop: $(document).height() }, 'slow'); } }, { key: "scrollToElement", value: function scrollToElement(element) { if ($(window).height() <= element.offset().top) { $('html, body').animate({ scrollTop: element.offset().top }, 'slow'); } } }, { key: "scrollToElementBottom", value: function scrollToElementBottom(element) { if ($(window).height() <= element.offset().top + element.height()) { $('html, body').animate({ scrollTop: element.offset().top + element.height() }, 'slow'); } } }, { key: "setTranslations", value: function setTranslations(txt) { this.translations = txt.messages['']; } }, { key: "setTranslationsSubModules", value: function setTranslationsSubModules(translations) { this.translations = translations; } }, { key: "gt", value: function gt(key) { if (this.translations[key] === undefined || this.translations[key] === null) { console.log("Tr:".concat(key)); return key; } return this.translations[key][0]; } }, { key: "addToLangTerms", value: function addToLangTerms(key) { var termsArr; var terms = localStorage.getItem('terms'); if (terms === undefined) { termsArr = {}; } else { try { termsArr = JSON.parse(terms); } catch (e) { termsArr = {}; } } if (this.translations[key] === undefined) { termsArr[key] = key; localStorage.setItem('terms', JSON.stringify(termsArr)); } } /** * If this method returned false the action buttons in data table for modules will not be displayed. * Override this method in module lib.js to hide action buttons * @method showActionButtons * @param permission {String} * @example * EmployeeLeaveEntitlementAdapter.method('showActionButtons() { * return false; * } */ }, { key: "showActionButtons", value: function showActionButtons() { return true; } }, { key: "trackEvent", value: function trackEvent(action, label, value) { try { if (label === undefined || label == null) { this.ga.push(['_trackEvent', this.instanceId, action]); } else if (value === undefined || value == null) { this.ga.push(['_trackEvent', this.instanceId, action, label]); } else { this.ga.push(['_trackEvent', this.instanceId, action, label, value]); } } catch (e) {// Do nothing } } }, { key: "setCurrentProfile", value: function setCurrentProfile(currentProfile) { this.currentProfile = currentProfile; } /** * Get the current profile * @method getCurrentProfile * @returns Profile of the current user if the profile is not switched if not switched profile */ }, { key: "getCurrentProfile", value: function getCurrentProfile() { return this.currentProfile; } /** * Retrive data required to create select boxes for add new /edit forms for a given module. This is called when loading the module * @method initFieldMasterData * @param callback {Function} call this once loading completed * @param callback {Function} call this once all field loading completed. This indicate that the form can be displayed saftly * @example * ReportAdapter.method('renderForm(object) { * var that = this; * this.processFormFieldsWithObject(object); * var cb = function(){ * that.super.renderForm(object); * }; * this.initFieldMasterData(cb); * } */ }, { key: "initFieldMasterData", value: function initFieldMasterData(callback, loadAllCallback, loadAllCallbackData) { this.fieldMasterData = {}; this.fieldMasterDataKeys = {}; this.fieldMasterDataCallback = loadAllCallback; this.fieldMasterDataCallbackData = loadAllCallbackData; var remoteSourceFields = this.getRemoteSourceFields(); for (var i = 0; i < remoteSourceFields.length; i++) { var fieldRemote = remoteSourceFields[i]; if (fieldRemote[1]['remote-source'] !== undefined && fieldRemote[1]['remote-source'] != null) { // let key = `${fieldRemote[1]['remote-source'][0]}_${fieldRemote[1]['remote-source'][1]}_${fieldRemote[1]['remote-source'][2]}`; // if (fieldRemote[1]['remote-source'].length === 4) { // key = `${key}_${fieldRemote[1]['remote-source'][3]}`; // } var key = this.getRemoteSourceKey(fieldRemote); this.fieldMasterDataKeys[key] = false; var callBackData = {}; callBackData.callBack = 'initFieldMasterDataResponse'; callBackData.callBackData = [key]; if (callback !== null && callback !== undefined) { callBackData.callBackSuccess = callback; } this.getFieldValues(fieldRemote[1]['remote-source'], callBackData); } } } }, { key: "initSourceMappings", value: function initSourceMappings() { this.sourceMapping = {}; var remoteSourceFields = this.getRemoteSourceFields(); for (var i = 0; i < remoteSourceFields.length; i++) { var fieldRemote = remoteSourceFields[i]; if (fieldRemote[1]['remote-source'] !== undefined && fieldRemote[1]['remote-source'] != null) { this.sourceMapping[fieldRemote[0]] = fieldRemote[1]['remote-source']; } } } }, { key: "getRemoteSourceKey", value: function getRemoteSourceKey(field) { var key = "".concat(field[1]['remote-source'][0], "_").concat(field[1]['remote-source'][1], "_").concat(field[1]['remote-source'][2]); if (field[1]['remote-source'].length > 3) { key = "".concat(key, "_").concat(field[1]['remote-source'][3]); } return key; } }, { key: "getRemoteSourceFields", value: function getRemoteSourceFields() { var values; var fields = this.getFormFields(); var filterFields = this.getFilters(); if (filterFields != null) { for (var j = 0; j < filterFields.length; j++) { values = this.getMetaFieldValues(filterFields[j][0], fields); if (values == null || values.type !== 'select' && values.type !== 'select2' && values.type !== 'select2multi') { fields.push(filterFields[j]); } } } var remoteSourceFields = []; var remoteSourceFieldKeys = []; var field = null; var fieldSub = null; for (var i = 0; i < fields.length; i++) { field = fields[i]; if (field[1]['remote-source'] !== undefined && field[1]['remote-source'] !== null) { var key = this.getRemoteSourceKey(field); if (remoteSourceFieldKeys.indexOf(key) < 0) { remoteSourceFields.push(field); remoteSourceFieldKeys.push(key); } } else if (field[1].form !== undefined && field[1].form !== null) { for (var _j = 0; _j < field[1].form.length; _j++) { fieldSub = field[1].form[_j]; if (fieldSub[1]['remote-source'] !== undefined && fieldSub[1]['remote-source'] !== null) { var _key = this.getRemoteSourceKey(fieldSub); if (remoteSourceFieldKeys.indexOf(_key) < 0) { remoteSourceFields.push(fieldSub); remoteSourceFieldKeys.push(_key); } } } } } return remoteSourceFields; } /** * Pass true to this method after creating module JS object to open new/edit entry form for the module on a popup. * @method setShowFormOnPopup * @param val {Boolean} * @example * modJs.subModJsList['tabCandidateApplication'] = new CandidateApplicationAdapter('Application','CandidateApplication',{"candidate":data.id} * modJs.subModJsList['tabCandidateApplication'].setShowFormOnPopup(true); */ }, { key: "setShowFormOnPopup", value: function setShowFormOnPopup(val) { this.showFormOnPopup = val; } /** * Set this to true to if you need the datatable to load data page by page instead of loading all data at once. * @method setRemoteTable * @param val {Boolean} * @example * modJs.subModJsList['tabCandidateApplication'] = new CandidateApplicationAdapter('Application','CandidateApplication',{"candidate":data.id} * modJs.subModJsList['tabCandidateApplication'].setRemoteTable(true); */ }, { key: "setRemoteTable", value: function setRemoteTable(val) { this.createRemoteTable = val; } }, { key: "setSettings", value: function setSettings(val) { this.settings = val; } }, { key: "getRemoteTable", value: function getRemoteTable() { return this.createRemoteTable; } }, { key: "isAllLoaded", value: function isAllLoaded(fieldMasterDataKeys) { for (var key in fieldMasterDataKeys) { if (fieldMasterDataKeys[key] === false) { return false; } } return true; } // eslint-disable-next-line no-unused-vars }, { key: "initFieldMasterDataResponse", value: function initFieldMasterDataResponse(key, data, callback, loadAllCallbackData) { this.fieldMasterData[key] = data; this.fieldMasterDataKeys[key] = true; if (callback !== undefined && callback !== null) { callback(); } if (this.fieldMasterDataCallback !== null && this.fieldMasterDataCallback !== undefined && this.isAllLoaded(this.fieldMasterDataKeys) && this.fieldMasterDataCallbackData !== null && this.fieldMasterDataCallbackData !== undefined) { this.fieldMasterDataCallback(this.fieldMasterDataCallbackData); } else if (this.fieldMasterDataCallback !== null && this.fieldMasterDataCallback !== undefined && this.isAllLoaded(this.fieldMasterDataKeys)) { this.fieldMasterDataCallback(); } } }, { key: "getMetaFieldValues", value: function getMetaFieldValues(key, fields) { for (var i = 0; i < fields.length; i++) { if (key === fields[i][0]) { return fields[i][1]; } } return null; } }, { key: "getThemeColors", value: function getThemeColors() { var colors = ['red', 'yellow', 'aqua', 'blue', 'light-blue', 'green', 'navy', 'teal', 'olive', 'orange', 'fuchsia', 'purple']; return colors; } }, { key: "getColorByRandomString", value: function getColorByRandomString(string) { var colors = this.getThemeColors(); var k = string.charCodeAt(0); return colors[k % colors.length]; } }, { key: "getColorByFileType", value: function getColorByFileType(type) { type = type.toLowerCase(); var colorMap = {}; colorMap.pdf = 'red'; colorMap.csv = 'yellow'; colorMap.xls = 'green'; colorMap.xlsx = 'green'; colorMap.doc = 'light-blue'; colorMap.docx = 'light-blue'; colorMap.docx = 'blue'; colorMap.ppt = 'orange'; colorMap.pptx = 'orange'; colorMap.jpg = 'teal'; colorMap.jpeg = 'teal'; colorMap.gif = 'green'; colorMap.png = 'yellow'; colorMap.bmp = 'fuchsia'; if (colorMap[type] !== undefined || colorMap[type] != null) { return colorMap[type]; } return this.getColorByRandomString(type); } }, { key: "getIconByFileType", value: function getIconByFileType(type) { type = type.toLowerCase(); var iconMap = {}; iconMap.pdf = 'fa fa-file-pdf-o'; iconMap.csv = 'fa fa fa-file-code-o'; iconMap.xls = 'fa fa-file-excel-o'; iconMap.xlsx = 'fa fa-file-excel-o'; iconMap.doc = 'fa fa-file-word-o'; iconMap.docx = 'fa fa-file-word-o'; iconMap.ppt = 'fa fa-file-powerpoint-o'; iconMap.pptx = 'fa fa-file-powerpoint-o'; iconMap.jpg = 'fa fa-file-image-o'; iconMap.jpeg = 'fa fa-file-image-o'; iconMap.gif = 'fa fa-file-image-o'; iconMap.png = 'fa fa-file-image-o'; iconMap.bmp = 'fa fa-file-image-o'; iconMap.txt = 'fa fa-file-text-o'; iconMap.rtf = 'fa fa-file-text-o'; if (iconMap[type] !== undefined || iconMap[type] != null) { return iconMap[type]; } return 'fa fa-file-o'; } }, { key: "getSourceMapping", value: function getSourceMapping() { return this.sourceMapping; } }, { key: "setTesting", value: function setTesting(testing) { this.testing = testing; } }, { key: "consoleLog", value: function consoleLog(message) { if (this.testing) { console.log(message); } } }, { key: "setClientMessages", value: function setClientMessages(msgList) { this.msgList = msgList; } }, { key: "setTemplates", value: function setTemplates(templates) { this.templates = templates; } }, { key: "getWSProperty", value: function getWSProperty(array, key) { if (array.hasOwnProperty(key)) { return array[key]; } return null; } }, { key: "getClientMessage", value: function getClientMessage(key) { return this.getWSProperty(this.msgList, key); } }, { key: "getTemplate", value: function getTemplate(key) { return this.getWSProperty(this.templates, key); } }, { key: "setGoogleAnalytics", value: function setGoogleAnalytics(gaq) { this.gaq = gaq; } }, { key: "showView", value: function showView(view) { if (this.currentView != null) { this.previousView = this.currentView; $("#".concat(this.currentView)).hide(); } $("#".concat(view)).show(); this.currentView = view; this.moveToTop(); } }, { key: "showPreviousView", value: function showPreviousView() { this.showView(this.previousView); } }, { key: "moveToTop", value: function moveToTop() {} }, { key: "callFunction", value: function callFunction(callback, cbParams, thisParam) { if ($.isFunction(callback)) { try { if (thisParam === undefined || thisParam === null) { callback.apply(document, cbParams); } else { callback.apply(thisParam, cbParams); } } catch (e) { console.log(e.message); } } else { var f = this[callback]; if ($.isFunction(f)) { try { f.apply(this, cbParams); } catch (e) { console.log(e.message); } } } } }, { key: "getTableTopButtonHtml", value: function getTableTopButtonHtml() { var html = ''; if (this.getShowAddNew()) { html = ""); } if (this.getFilters() != null) { if (html !== '') { html += '  '; } html += ""); html += '  '; if (this.filtersAlreadySet) { html += ''; } else { html += ''; } } html = html.replace(/__id__/g, this.getTableName()); if (this.currentFilterString !== '' && this.currentFilterString != null) { html = html.replace(/__filterString__/g, this.currentFilterString); } else { html = html.replace(/__filterString__/g, 'Reset Filters'); } if (html !== '') { html = "
".concat(html, "
"); } return html; } }, { key: "getActionButtonHeader", value: function getActionButtonHeader() { return { sTitle: '', sClass: 'center' }; } }, { key: "getTableHTMLTemplate", value: function getTableHTMLTemplate() { return '
'; } }, { key: "isSortable", value: function isSortable() { return true; } /** * Create the data table on provided element id * @method createTable * @param val {Boolean} */ }, { key: "createTable", value: function createTable(elementId) { var that = this; if (this.getRemoteTable()) { this.createTableServer(elementId); return; } var headers = this.getHeaders(); // add translations for (var index in headers) { headers[index].sTitle = this.gt(headers[index].sTitle); } var data = this.getTableData(); if (this.showActionButtons()) { headers.push(this.getActionButtonHeader()); } if (this.showActionButtons()) { for (var i = 0; i < data.length; i++) { data[i].push(this.getActionButtonsHtml(data[i][0], data[i])); } } var html = ''; html = this.getTableTopButtonHtml() + this.getTableHTMLTemplate(); /* if(this.getShowAddNew()){ html = this.getTableTopButtonHtml()+'
'; }else{ html = '
'; } */ // Find current page var activePage = $("#".concat(elementId, " .dataTables_paginate .active a")).html(); var start = 0; if (activePage !== undefined && activePage != null) { start = parseInt(activePage, 10) * 15 - 15; } $("#".concat(elementId)).html(html); var dataTableParams = { oLanguage: { sLengthMenu: '_MENU_ records per page' }, aaData: data, aoColumns: headers, bSort: that.isSortable(), iDisplayLength: 15, iDisplayStart: start }; var customTableParams = this.getCustomTableParams(); $.extend(dataTableParams, customTableParams); $("#".concat(elementId, " #grid")).dataTable(dataTableParams); $('.dataTables_paginate ul').addClass('pagination'); $('.dataTables_length').hide(); $('.dataTables_filter input').addClass('form-control'); $('.dataTables_filter input').attr('placeholder', 'Search'); $('.dataTables_filter label').contents().filter(function () { return this.nodeType === 3; }).remove(); $('.tableActionButton').tooltip(); } /** * Create a data table on provided element id which loads data page by page * @method createTableServer * @param val {Boolean} */ }, { key: "createTableServer", value: function createTableServer(elementId) { var that = this; var headers = this.getHeaders(); headers.push({ sTitle: '', sClass: 'center' }); // add translations for (var index in headers) { headers[index].sTitle = this.gt(headers[index].sTitle); } var html = ''; html = this.getTableTopButtonHtml() + this.getTableHTMLTemplate(); // Find current page var activePage = $("#".concat(elementId, " .dataTables_paginate .active a")).html(); var start = 0; if (activePage !== undefined && activePage != null) { start = parseInt(activePage, 10) * 15 - 15; } $("#".concat(elementId)).html(html); var dataTableParams = { oLanguage: { sLengthMenu: '_MENU_ records per page' }, bProcessing: true, bServerSide: true, sAjaxSource: that.getDataUrl(that.getDataMapping()), aoColumns: headers, bSort: that.isSortable(), parent: that, iDisplayLength: 15, iDisplayStart: start }; if (this.showActionButtons()) { dataTableParams.aoColumnDefs = [{ fnRender: that.getActionButtons, aTargets: [that.getDataMapping().length] }]; } var customTableParams = this.getCustomTableParams(); $.extend(dataTableParams, customTableParams); $("#".concat(elementId, " #grid")).dataTable(dataTableParams); $('.dataTables_paginate ul').addClass('pagination'); $('.dataTables_length').hide(); $('.dataTables_filter input').addClass('form-control'); $('.dataTables_filter input').attr('placeholder', 'Search'); $('.dataTables_filter label').contents().filter(function () { return this.nodeType === 3; }).remove(); $('.tableActionButton').tooltip(); } /** * This should be overridden in module lib.js classes to return module headers which are used to create the data table. * @method getHeaders * @example SettingAdapter.method('getHeaders() { return [ { "sTitle": "ID" ,"bVisible":false}, { "sTitle": "Name" }, { "sTitle": "Value"}, { "sTitle": "Details"} ]; } */ }, { key: "getHeaders", value: function getHeaders() {} /** * This should be overridden in module lib.js classes to return module field values which are used to create the data table. * @method getDataMapping * @example SettingAdapter.method('getDataMapping() { return [ "id", "name", "value", "description" ]; } */ }, { key: "getDataMapping", value: function getDataMapping() {} /** * This should be overridden in module lib.js classes to return module from fields which are used to create the add/edit form and also used for initializing select box values in form. * @method getFormFields * @example SettingAdapter.method('getFormFields() { return [ [ "id", {"label":"ID","type":"hidden"}], [ "value", {"label":"Value","type":"text","validation":"none"}] ]; } */ }, { key: "getFormFields", value: function getFormFields() {} }, { key: "getTableColumns", value: function getTableColumns() { return []; } }, { key: "getTableData", value: function getTableData() {} /** * This can be overridden in module lib.js classes inorder to show a filter form * @method getFilters * @example EmployeeAdapter.method('getFilters() { return [ [ "job_title", {"label":"Job Title","type":"select2","allow-null":true,"null-label":"All Job Titles","remote-source":["JobTitle","id","name"]}], [ "department", {"label":"Department","type":"select2","allow-null":true,"null-label":"All Departments","remote-source":["CompanyStructure","id","title"]}], [ "supervisor", {"label":"Supervisor","type":"select2","allow-null":true,"null-label":"Anyone","remote-source":["Employee","id","first_name+last_name"]}] ]; } */ }, { key: "getFilters", value: function getFilters() { return null; } /** * Show the edit form for an item * @method edit * @param id {int} id of the item to edit */ }, { key: "edit", value: function edit(id) { this.currentId = id; this.getElement(id, []); } }, { key: "copyRow", value: function copyRow(id) { this.getElement(id, [], true); } }, { key: "renderModel", value: function renderModel(id, header, body) { $("#".concat(id, "ModelBody")).html(''); if (body === undefined || body == null) { body = ''; } $("#".concat(id, "ModelLabel")).html(header); $("#".concat(id, "ModelBody")).html(body); } }, { key: "renderYesNoModel", value: function renderYesNoModel(header, body, yesBtnName, noBtnName, callback, callbackParams) { var that = this; var modelId = '#yesnoModel'; if (body === undefined || body == null) { body = ''; } $("".concat(modelId, "Label")).html(header); $("".concat(modelId, "Body")).html(body); if (yesBtnName != null) { $("".concat(modelId, "YesBtn")).html(yesBtnName); } if (noBtnName != null) { $("".concat(modelId, "NoBtn")).html(noBtnName); } $("".concat(modelId, "YesBtn")).off().on('click', function () { if (callback !== undefined && callback != null) { callback.apply(that, callbackParams); that.cancelYesno(); } }); $(modelId).modal({ backdrop: 'static' }); } }, { key: "renderModelFromDom", value: function renderModelFromDom(id, header, element) { $("#".concat(id, "ModelBody")).html(''); if (element === undefined || element == null) { element = $('
'); } $("#".concat(id, "ModelLabel")).html(header); $("#".concat(id, "ModelBody")).html(''); $("#".concat(id, "ModelBody")).append(element); } /** * Delete an item * @method deleteRow * @param id {int} id of the item to edit */ }, { key: "deleteRow", value: function deleteRow(id) { this.deleteParams.id = id; this.renderModel('delete', 'Confirm Deletion', 'Are you sure you want to delete this item ?'); $('#deleteModel').modal('show'); } /** * Show a popup with message * @method showMessage * @param title {String} title of the message box * @param message {String} message * @param closeCallback {Function} this will be called once the dialog is closed (optional) * @param closeCallback {Function} data to pass to close callback (optional) * @param closeCallbackData * @param isPlain {Boolean} if true buttons are not shown (optional / default = true) * @example * this.showMessage("Error Occured while Applying Leave", callBackData); */ }, { key: "showMessage", value: function showMessage(title, message) { var closeCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var closeCallbackData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var isPlain = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; var that = this; var modelId = ''; if (isPlain) { modelId = '#plainMessageModel'; } else { modelId = '#messageModel'; } $(modelId).off(); if (isPlain) { this.renderModel('plainMessage', title, message); } else { this.renderModel('message', title, message); } if (closeCallback !== null && closeCallback !== undefined) { $(modelId).modal({ show: true }); $(modelId).on('hidden.bs.modal', function () { closeCallback.apply(that, closeCallbackData); $('.modal-backdrop').remove(); }); } else { $(modelId).modal({ backdrop: 'static' }); } } }, { key: "showDomElement", value: function showDomElement(title, element, closeCallback, closeCallbackData, isPlain) { var that = this; var modelId = ''; if (isPlain) { modelId = '#dataMessageModel'; } else { modelId = '#messageModel'; } $(modelId).unbind('hide'); if (isPlain) { this.renderModelFromDom('dataMessage', title, element); } else { this.renderModelFromDom('message', title, element); } if (closeCallback !== null && closeCallback !== undefined) { $(modelId).modal({ show: true }); $(modelId).on('hidden.bs.modal', function () { closeCallback.apply(that, closeCallbackData); $('.modal-backdrop').remove(); }); } else { $(modelId).modal({ backdrop: 'static' }); } } }, { key: "confirmDelete", value: function confirmDelete() { if (this.deleteParams.id !== undefined || this.deleteParams.id != null) { this.deleteObj(this.deleteParams.id, []); } $('#deleteModel').modal('hide'); } }, { key: "cancelDelete", value: function cancelDelete() { $('#deleteModel').modal('hide'); this.deleteParams.id = null; } }, { key: "closeMessage", value: function closeMessage() { $('#messageModel').modal('hide'); } }, { key: "cancelYesno", value: function cancelYesno() { $('#yesnoModel').modal('hide'); } }, { key: "closePlainMessage", value: function closePlainMessage() { $('#plainMessageModel').modal('hide'); $('#dataMessageModel').modal('hide'); } }, { key: "closeDataMessage", value: function closeDataMessage() { $('#dataMessageModel').modal('hide'); } /** * Create or edit an element * @method save * @param getFunctionCallBackData {Array} once a success is returned call get() function for this module with these parameters * @param successCallback {Function} this will get called after success response */ }, { key: "save", value: function save(callGetFunction, successCallback) { var validator = new _FormValidation["default"]("".concat(this.getTableName(), "_submit"), true, { ShowPopup: false, LabelErrorClass: 'error' }); if (validator.checkValues()) { var params = validator.getFormParameters(); params = this.forceInjectValuesBeforeSave(params); var msg = this.doCustomValidation(params); if (msg == null) { if (this.csrfRequired) { params.csrf = $("#".concat(this.getTableName(), "Form")).data('csrf'); } var id = $("#".concat(this.getTableName(), "_submit #id")).val(); if (id != null && id !== undefined && id !== '') { params.id = id; } params = this.makeEmptyDateFieldsNull(params); this.add(params, [], callGetFunction, successCallback); } else { $("#".concat(this.getTableName(), "Form .label")).html(msg); $("#".concat(this.getTableName(), "Form .label")).show(); this.scrollToTop(); } } } }, { key: "makeEmptyDateFieldsNull", value: function makeEmptyDateFieldsNull(params) { var fields = this.getFormFields(); fields.forEach(function (field) { if ((field[1].type === 'date' || field[1].type === 'datetime') && (params[field[0]] === '' || params[field[0]] === '0000-00-00' || params[field[0]] === '0000-00-00 00:00:00')) { if (field[1].validation === 'none') { params[field[0]] = 'NULL'; } else { delete params[field[0]]; } } }); return params; } }, { key: "validatePassword", value: function validatePassword(password) { if (password.length < 8) { return this.gt('Password too short'); } if (password.length > 30) { return this.gt('Password too long'); } var numberTester = /.*[0-9]+.*$/; if (!password.match(numberTester)) { return this.gt('Password must include at least one number'); } var lowerTester = /.*[a-z]+.*$/; if (!password.match(lowerTester)) { return this.gt('Password must include at least one lowercase letter'); } var upperTester = /.*[A-Z]+.*$/; if (!password.match(upperTester)) { return this.gt('Password must include at least one uppercase letter'); } var symbolTester = /.*[\W]+.*$/; if (!password.match(symbolTester)) { return this.gt('Password must include at least one symbol'); } return null; } /** * Override this method to inject attitional parameters or modify existing parameters retrived from * add/edit form before sending to the server * @method forceInjectValuesBeforeSave * @param params {Array} keys and values in form * @returns {Array} modified parameters */ }, { key: "forceInjectValuesBeforeSave", value: function forceInjectValuesBeforeSave(params) { return params; } /** * Override this method to do custom validations at client side * @method doCustomValidation * @param params {Array} keys and values in form * @returns {Null or String} return null if validation success, returns error message if unsuccessful * @example EmployeeLeaveAdapter.method('doCustomValidation(params) { try{ if(params['date_start'] != params['date_end']){ var ds = new Date(params['date_start']); var de = new Date(params['date_end']); if(de < ds){ return "Start date should be earlier than end date of the leave period"; } } }catch(e){ } return null; } */ // eslint-disable-next-line no-unused-vars }, { key: "doCustomValidation", value: function doCustomValidation(params) { return null; } }, { key: "filterQuery", value: function filterQuery() { var validator = new _FormValidation["default"]("".concat(this.getTableName(), "_filter"), true, { ShowPopup: false, LabelErrorClass: 'error' }); if (validator.checkValues()) { var params = validator.getFormParameters(); if (this.doCustomFilterValidation(params)) { // remove null params for (var prop in params) { if (params.hasOwnProperty(prop)) { if (params[prop] === 'NULL') { delete params[prop]; } } } this.setFilter(params); this.filtersAlreadySet = true; $("#".concat(this.getTableName(), "_resetFilters")).show(); this.currentFilterString = this.getFilterString(params); this.get([]); this.closePlainMessage(); } } } }, { key: "getFilterString", value: function getFilterString(filters) { var str = ''; var rmf; var source; var values; var select2MVal; var value; var valueOrig; var filterFields = this.getFilters(); if (values == null) { values = []; } for (var prop in filters) { if (filters.hasOwnProperty(prop)) { values = this.getMetaFieldValues(prop, filterFields); if (!values) { continue; } value = ''; valueOrig = null; if (values.type === 'select' || values.type === 'select2') { if (values['remote-source'] !== undefined && values['remote-source'] != null) { rmf = values['remote-source']; if (filters[prop] === 'NULL') { if (values['null-label'] !== undefined && values['null-label'] != null) { value = values['null-label']; } else { value = 'Not Selected'; } } else { var key = "".concat(rmf[0], "_").concat(rmf[1], "_").concat(rmf[2]); if (rmf.length > 3) { key = "".concat(key, "_").concat(rmf[3]); } // value = this.fieldMasterData[`${rmf[0]}_${rmf[1]}_${rmf[2]}`][filters[prop]]; value = this.fieldMasterData[key][filters[prop]]; valueOrig = value; } } else { source = values.source[0]; if (filters[prop] === 'NULL') { if (values['null-label'] !== undefined && values['null-label'] != null) { value = values['null-label']; } else { value = 'Not Selected'; } } else { for (var i = 0; i < source.length; i++) { if (filters[prop] === values.source[i][0]) { value = values.source[i][1]; valueOrig = value; break; } } } } } else if (values.type === 'select2multi') { select2MVal = []; try { select2MVal = JSON.parse(filters[prop]); } catch (e) {// Do nothing } value = select2MVal.join(','); if (value !== '') { valueOrig = value; } } else { value = filters[prop]; if (value !== '') { valueOrig = value; } } if (valueOrig != null) { if (str !== '') { str += ' | '; } str += "".concat(values.label, " = ").concat(value); } } } return str; } /** * Override this method to do custom validations at client side for values selected in filters * @method doCustomFilterValidation * @param params {Array} keys and values in form * @returns {Null or String} return null if validation success, returns error message if unsuccessful */ }, { key: "doCustomFilterValidation", value: function doCustomFilterValidation(params) { return true; } /** * Reset selected filters * @method resetFilters */ }, { key: "resetFilters", value: function resetFilters() { this.filter = this.origFilter; this.filtersAlreadySet = false; $("#".concat(this.getTableName(), "_resetFilters")).hide(); this.currentFilterString = ''; this.get([]); } }, { key: "showFilters", value: function showFilters(object) { var formHtml = this.templates.filterTemplate; var html = ''; var fields = this.getFilters(); for (var i = 0; i < fields.length; i++) { var metaField = this.getMetaFieldForRendering(fields[i][0]); if (metaField === '' || metaField === undefined) { html += this.renderFormField(fields[i]); } else { var metaVal = object[metaField]; if (metaVal !== '' && metaVal != null && metaVal !== undefined && metaVal.trim() !== '') { html += this.renderFormField(JSON.parse(metaVal)); } else { html += this.renderFormField(fields[i]); } } } formHtml = formHtml.replace(/_id_/g, "".concat(this.getTableName(), "_filter")); formHtml = formHtml.replace(/_fields_/g, html); var randomFormId = this.generateRandom(14); var $tempDomObj = $('
'); $tempDomObj.attr('id', randomFormId); $tempDomObj.html(formHtml); $tempDomObj.find('.datefield').datepicker({ viewMode: 2 }); $tempDomObj.find('.timefield').datetimepicker({ language: 'en', pickDate: false }); $tempDomObj.find('.datetimefield').datetimepicker({ language: 'en' }); $tempDomObj.find('.colorpick').colorpicker(); tinymce.init({ selector: "#".concat($tempDomObj.attr('id'), " .tinymce"), height: '400' }); $tempDomObj.find('.simplemde').each(function () { var simplemde = new SimpleMDE({ element: $(this)[0] }); $(this).data('simplemde', simplemde); // simplemde.value($(this).val()); }); // $tempDomObj.find('.select2Field').select2(); $tempDomObj.find('.select2Field').each(function () { $(this).select2().select2('val', $(this).find('option:eq(0)').val()); }); $tempDomObj.find('.select2Multi').each(function () { $(this).select2().on('change', function (e) { var parentRow = $(this).parents('.row'); var height = parentRow.find('.select2-choices').height(); parentRow.height(parseInt(height, 10)); }); }); /* $tempDomObj.find('.signatureField').each(function() { $(this).data('signaturePad',new SignaturePad($(this))); }); */ // var tHtml = $tempDomObj.wrap('
').parent().html(); this.showDomElement('Edit', $tempDomObj, null, null, true); $('.filterBtn').off(); $('.filterBtn').on('click', function (e) { e.preventDefault(); e.stopPropagation(); try { modJs.filterQuery(); } catch (err) { console.log(err); console.log(err.message); } return false; }); if (this.filter !== undefined && this.filter != null && this.filter !== '') { this.fillForm(this.filter, "#".concat(this.getTableName(), "_filter"), this.getFilters()); } } /** * Override this method in your module class to make changes to data fo the form before showing the form * @method preRenderForm * @param object {Array} keys value list for populating form */ }, { key: "preRenderForm", value: function preRenderForm(object) {} /** * Create the form * @method renderForm * @param object {Array} keys value list for populating form */ }, { key: "renderForm", value: function renderForm(object) { var signatureIds = []; if (object == null || object === undefined) { this.currentId = null; } this.preRenderForm(object); var formHtml = this.templates.formTemplate; var html = ''; var fields = this.getFormFields(); for (var i = 0; i < fields.length; i++) { var metaField = this.getMetaFieldForRendering(fields[i][0]); if (metaField === '' || metaField === undefined) { html += this.renderFormField(fields[i]); } else { var metaVal = object[metaField]; if (metaVal !== '' && metaVal != null && metaVal !== undefined && metaVal.trim() !== '') { html += this.renderFormField(JSON.parse(metaVal)); } else { html += this.renderFormField(fields[i]); } } } formHtml = formHtml.replace(/_id_/g, "".concat(this.getTableName(), "_submit")); formHtml = formHtml.replace(/_fields_/g, html); var $tempDomObj; var randomFormId = this.generateRandom(14); if (!this.showFormOnPopup) { $tempDomObj = $("#".concat(this.getTableName(), "Form")); } else { $tempDomObj = $('
'); $tempDomObj.attr('id', randomFormId); } $tempDomObj.html(formHtml); $tempDomObj.find('.datefield').datepicker({ viewMode: 2 }); $tempDomObj.find('.timefield').datetimepicker({ language: 'en', pickDate: false }); $tempDomObj.find('.datetimefield').datetimepicker({ language: 'en' }); $tempDomObj.find('.colorpick').colorpicker(); tinymce.init({ selector: "#".concat($tempDomObj.attr('id'), " .tinymce"), height: '400' }); $tempDomObj.find('.simplemde').each(function () { var simplemde = new SimpleMDE({ element: $(this)[0] }); $(this).data('simplemde', simplemde); // simplemde.value($(this).val()); }); var codeMirror = this.codeMirror; if (codeMirror) { $tempDomObj.find('.code').each(function () { var editor = codeMirror.fromTextArea($(this)[0], { lineNumbers: false, matchBrackets: true, continueComments: 'Enter', extraKeys: { 'Ctrl-Q': 'toggleComment' } }); $(this).data('codemirror', editor); }); } // $tempDomObj.find('.select2Field').select2(); $tempDomObj.find('.select2Field').each(function () { $(this).select2().select2('val', $(this).find('option:eq(0)').val()); }); $tempDomObj.find('.select2Multi').each(function () { $(this).select2().on('change', function (e) { var parentRow = $(this).parents('.row'); var height = parentRow.find('.select2-choices').height(); parentRow.height(parseInt(height, 10)); }); }); $tempDomObj.find('.signatureField').each(function () { // $(this).data('signaturePad',new SignaturePad($(this))); signatureIds.push($(this).attr('id')); }); for (var _i = 0; _i < fields.length; _i++) { if (fields[_i][1].type === 'datagroup') { $tempDomObj.find("#".concat(fields[_i][0])).data('field', fields[_i]); } } if (this.showSave === false) { $tempDomObj.find('.saveBtn').remove(); } else { $tempDomObj.find('.saveBtn').off(); $tempDomObj.find('.saveBtn').data('modJs', this); $tempDomObj.find('.saveBtn').on('click', function () { if ($(this).data('modJs').saveSuccessItemCallback != null && $(this).data('modJs').saveSuccessItemCallback !== undefined) { $(this).data('modJs').save($(this).data('modJs').retriveItemsAfterSave(), $(this).data('modJs').saveSuccessItemCallback); } else { $(this).data('modJs').save(); } return false; }); } if (this.showCancel === false) { $tempDomObj.find('.cancelBtn').remove(); } else { $tempDomObj.find('.cancelBtn').off(); $tempDomObj.find('.cancelBtn').data('modJs', this); $tempDomObj.find('.cancelBtn').on('click', function () { $(this).data('modJs').cancel(); return false; }); } // Input mask $tempDomObj.find('[mask]').each(function () { $(this).inputmask($(this).attr('mask')); }); $tempDomObj.find('[datemask]').each(function () { $(this).inputmask({ mask: 'y-1-2', placeholder: 'YYYY-MM-DD', leapday: '-02-29', separator: '-', alias: 'yyyy/mm/dd' }); }); $tempDomObj.find('[datetimemask]').each(function () { $(this).inputmask('datetime', { mask: 'y-2-1 h:s:00', placeholder: 'YYYY-MM-DD hh:mm:ss', leapday: '-02-29', separator: '-', alias: 'yyyy/mm/dd' }); }); if (!this.showFormOnPopup) { $("#".concat(this.getTableName(), "Form")).show(); $("#".concat(this.getTableName())).hide(); for (var _i2 = 0; _i2 < signatureIds.length; _i2++) { $("#".concat(signatureIds[_i2])).data('signaturePad', new SignaturePad(document.getElementById(signatureIds[_i2]))); } if (object !== undefined && object != null) { this.fillForm(object); } else { this.setDefaultValues(); } this.scrollToTop(); } else { // var tHtml = $tempDomObj.wrap('
').parent().html(); // this.showMessage("Edit",tHtml,null,null,true); this.showMessage('Edit', '', null, null, true); $('#plainMessageModel .modal-body').html(''); $('#plainMessageModel .modal-body').append($tempDomObj); for (var _i3 = 0; _i3 < signatureIds.length; _i3++) { $("#".concat(signatureIds[_i3])).data('signaturePad', new SignaturePad(document.getElementById(signatureIds[_i3]))); } if (object !== undefined && object != null) { this.fillForm(object, "#".concat(randomFormId)); } else { this.setDefaultValues("#".concat(randomFormId)); } } this.postRenderForm(object, $tempDomObj); } }, { key: "setDefaultValues", value: function setDefaultValues(formId, fields) { if (fields == null || fields === undefined) { fields = this.getFormFields(); } if (formId == null || formId === undefined || formId === '') { formId = "#".concat(this.getTableName(), "Form"); } for (var i = 0; i < fields.length; i++) { if (fields[i][1].type !== 'text' && fields[i][1].type !== 'textarea') { continue; } if (fields[i][1]["default"] !== undefined && fields[i][1]["default"] !== null) { $("".concat(formId, " #").concat(fields[i][0])).val(fields[i][1]["default"]); } } } }, { key: "retriveItemsAfterSave", value: function retriveItemsAfterSave() { return true; } /** * Override this method in your module class to make changes to data fo the form after showing it * @method postRenderForm * @param object {Array} keys value list for populating form * @param $tempDomObj {DOM} a DOM element for the form * @example * UserAdapter.method('postRenderForm(object, $tempDomObj) { if(object == null || object == undefined){ $tempDomObj.find("#changePasswordBtn").remove(); } } */ }, { key: "postRenderForm", value: function postRenderForm(object, $tempDomObj) {} /** * Convert data group field to HTML * @method dataGroupToHtml * @param val {String} value in the field * @param field {Array} field meta data */ }, { key: "dataGroupToHtml", value: function dataGroupToHtml(val, field) { var data = JSON.parse(val); var t; var sortFunction; var item; var itemHtml; var itemVal; var deleteButton = '
  • '; var editButton = '
  • '; var template = field[1].html; if (data != null && data !== undefined && field[1]['sort-function'] !== undefined && field[1]['sort-function'] != null) { data.sort(field[1]['sort-function']); } var html = $("
    ")); for (var i = 0; i < data.length; i++) { item = data[i]; if (field[1]['pre-format-function'] !== undefined && field[1]['pre-format-function'] != null) { item = field[1]['pre-format-function'].apply(this, [item]); } t = template; t = t.replace('#_delete_#', deleteButton); t = t.replace('#_edit_#', editButton); t = t.replace(/#_id_#/g, item.id); for (var key in item) { itemVal = item[key]; if (itemVal !== undefined && itemVal != null && typeof itemVal === 'string') { itemVal = itemVal.replace(/(?:\r\n|\r|\n)/g, '
    '); } t = t.replace("#_".concat(key, "_#"), itemVal); } if (field[1].render !== undefined && field[1].render != null) { t = t.replace('#_renderFunction_#', field[1].render(item)); } itemHtml = $(t); itemHtml.attr('fieldId', "".concat(field[0], "_div")); html.append(itemHtml); } return html; } /** * Reset the DataGroup for a given field * @method resetDataGroup * @param field {Array} field meta data */ }, { key: "resetDataGroup", value: function resetDataGroup(field) { $("#".concat(field[0])).val(''); $("#".concat(field[0], "_div")).html(''); } }, { key: "showDataGroup", value: function showDataGroup(field, object, callback) { var formHtml = this.templates.datagroupTemplate; var html = ''; var fields = field[1].form; if (object !== undefined && object != null && object.id !== undefined) { this.currentDataGroupItemId = object.id; } else { this.currentDataGroupItemId = null; } for (var i = 0; i < fields.length; i++) { html += this.renderFormField(fields[i]); } formHtml = formHtml.replace(/_id_/g, "".concat(this.getTableName(), "_field_").concat(field[0])); formHtml = formHtml.replace(/_fields_/g, html); var randomFormId = this.generateRandom(14); var $tempDomObj = $('
    '); $tempDomObj.attr('id', randomFormId); $tempDomObj.html(formHtml); $tempDomObj.find('.datefield').datepicker({ viewMode: 2 }); $tempDomObj.find('.timefield').datetimepicker({ language: 'en', pickDate: false }); $tempDomObj.find('.datetimefield').datetimepicker({ language: 'en' }); $tempDomObj.find('.colorpick').colorpicker(); tinymce.init({ selector: "#".concat($tempDomObj.attr('id'), " .tinymce"), height: '400' }); $tempDomObj.find('.simplemde').each(function () { var simplemde = new SimpleMDE({ element: $(this)[0] }); $(this).data('simplemde', simplemde); // simplemde.value($(this).val()); }); $tempDomObj.find('.select2Field').each(function () { $(this).select2().select2('val', $(this).find('option:eq(0)').val()); }); $tempDomObj.find('.select2Multi').each(function () { $(this).select2().on('change', function (e) { var parentRow = $(this).parents('.row'); var height = parentRow.find('.select2-choices').height(); parentRow.height(parseInt(height, 10)); }); }); this.currentDataGroupField = field; this.showDomElement("Add ".concat(field[1].label), $tempDomObj, null, null, true); if (object !== undefined && object != null) { this.fillForm(object, "#".concat(this.getTableName(), "_field_").concat(field[0]), field[1].form); } else { this.setDefaultValues("#".concat(this.getTableName(), "_field_").concat(field[0]), field[1].form); } $('.groupAddBtn').off(); if (object !== undefined && object != null && object.id !== undefined) { $('.groupAddBtn').on('click', function (e) { e.preventDefault(); e.stopPropagation(); try { modJs.editDataGroup(callback); } catch (err) { console.log("Error editing data group: ".concat(err.message)); } return false; }); } else { $('.groupAddBtn').on('click', function (e) { e.preventDefault(); e.stopPropagation(); try { modJs.addDataGroup(callback); } catch (err) { console.log("Error adding data group: ".concat(err.message)); } return false; }); } } }, { key: "addDataGroup", value: function addDataGroup(callback, existingData) { var field = this.currentDataGroupField; var tempParams; $("#".concat(this.getTableName(), "_field_").concat(field[0], "_error")).html(''); $("#".concat(this.getTableName(), "_field_").concat(field[0], "_error")).hide(); var validator = new _FormValidation["default"]("".concat(this.getTableName(), "_field_").concat(field[0]), true, { ShowPopup: false, LabelErrorClass: 'error' }); if (validator.checkValues()) { var params = validator.getFormParameters(); if (field[1]['custom-validate-function'] !== undefined && field[1]['custom-validate-function'] != null) { tempParams = field[1]['custom-validate-function'].apply(this, [params]); if (tempParams.valid) { params = tempParams.params; } else { $("#".concat(this.getTableName(), "_field_").concat(field[0], "_error")).html(tempParams.message); $("#".concat(this.getTableName(), "_field_").concat(field[0], "_error")).show(); return false; } } var val = '[]'; if (existingData) { val = existingData; } else { val = $("#".concat(field[0])).val(); if (val === '' || val == null) { val = '[]'; } } var data = JSON.parse(val); params.id = "".concat(field[0], "_").concat(this.dataGroupGetNextAutoIncrementId(data)); data.push(params); if (field[1]['sort-function'] !== undefined && field[1]['sort-function'] != null) { data.sort(field[1]['sort-function']); } val = JSON.stringify(data); var html = this.dataGroupToHtml(val, field); if (callback) { callback(val); } $("#".concat(field[0], "_div")).html(''); $("#".concat(field[0], "_div")).append(html); this.makeDataGroupSortable(field, $("#".concat(field[0], "_div_inner"))); $("#".concat(field[0])).val(val); this.orderDataGroup(field); this.closeDataMessage(); this.showMessage('Item Added', 'This change will be effective only when you save the form'); } return true; } }, { key: "nl2br", value: function nl2br(str, len) { var t = ''; try { var arr = str.split(' '); var count = 0; for (var i = 0; i < arr.length; i++) { count += arr[i].length + 1; if (count > len) { t += "".concat(arr[i], "
    "); count = 0; } else { t += "".concat(arr[i], " "); } } } catch (e) {// Do nothing } return t; } }, { key: "makeDataGroupSortable", value: function makeDataGroupSortable(field, obj) { obj.data('field', field); obj.data('firstSort', true); obj.sortable({ create: function create() { $(this).height($(this).height()); }, 'ui-floating': false, start: function start(e, uiStart) { $('#sortable-ul-selector-id').sortable({ sort: function sort(event, ui) { var $target = $(event.target); if (!/html|body/i.test($target.offsetParent()[0].tagName)) { var top = event.pageY - $target.offsetParent().offset().top - ui.helper.outerHeight(true) / 2; ui.helper.css({ top: "".concat(top, "px") }); } } }); }, revert: true, stop: function stop() { modJs.orderDataGroup($(this).data('field')); }, axis: 'y', scroll: false, placeholder: 'sortable-placeholder', cursor: 'move' }); } }, { key: "orderDataGroup", value: function orderDataGroup(field, callback) { var newArr = []; var id; var list = $("#".concat(field[0], "_div_inner [fieldid='").concat(field[0], "_div']")); var val = $("#".concat(field[0])).val(); if (val === '' || val == null) { val = '[]'; } var data = JSON.parse(val); list.each(function () { id = $(this).attr('id'); for (var index in data) { if (data[index].id === id) { newArr.push(data[index]); break; } } }); $("#".concat(field[0])).val(JSON.stringify(newArr)); if (callback != null) { callback(newArr); } } }, { key: "editDataGroup", value: function editDataGroup(callback, existingData) { var field = this.currentDataGroupField; var id = this.currentDataGroupItemId; var validator = new _FormValidation["default"]("".concat(this.getTableName(), "_field_").concat(field[0]), true, { ShowPopup: false, LabelErrorClass: 'error' }); if (validator.checkValues()) { var params = validator.getFormParameters(); if (field[1]['custom-validate-function'] !== undefined && field[1]['custom-validate-function'] != null) { var tempParams = field[1]['custom-validate-function'].apply(this, [params]); if (tempParams.valid) { params = tempParams.params; } else { $("#".concat(this.getTableName(), "_field_").concat(field[0], "_error")).html(tempParams.message); $("#".concat(this.getTableName(), "_field_").concat(field[0], "_error")).show(); return false; } } if (this.doCustomFilterValidation(params)) { var val = '[]'; if (existingData) { val = existingData; } else { val = $("#".concat(field[0])).val(); if (val === '' || val == null) { val = '[]'; } } var data = JSON.parse(val); var editVal = {}; var editValIndex = -1; var newVals = []; for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id === id) { editVal = item; editValIndex = i; } newVals.push(item); } params.id = editVal.id; newVals[editValIndex] = params; if (field[1]['sort-function'] !== undefined && field[1]['sort-function'] != null) { newVals.sort(field[1]['sort-function']); } val = JSON.stringify(newVals); $("#".concat(field[0])).val(val); var html = this.dataGroupToHtml(val, field); if (callback) { callback(newVals); } this.orderDataGroup(field); $("#".concat(field[0], "_div")).html(''); $("#".concat(field[0], "_div")).append(html); this.makeDataGroupSortable(field, $("#".concat(field[0], "_div_inner"))); this.closeDataMessage(); this.showMessage('Item Edited', 'This change will be effective only when you save the form'); } } return true; } }, { key: "editDataGroupItem", value: function editDataGroupItem(id, existingData, field) { var fieldId = id.substring(0, id.lastIndexOf('_')); var val; if (existingData) { val = decodeURI(existingData); } else { val = $("#".concat(fieldId)).val(); } var data = JSON.parse(val); var editVal = {}; for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id === id) { editVal = item; } } if (field) { field = JSON.parse(decodeURI(field)); } else { field = $("#".concat(fieldId)).data('field'); } this.showDataGroup(field, editVal); } }, { key: "dataGroupGetNextAutoIncrementId", value: function dataGroupGetNextAutoIncrementId(data) { var autoId = 1; var id; for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id === undefined || item.id == null) { item.id = 1; } id = item.id.substring(item.id.lastIndexOf('_') + 1, item.id.length); if (id >= autoId) { autoId = parseInt(id, 10) + 1; } } return autoId; } }, { key: "deleteDataGroupItem", value: function deleteDataGroupItem(id, existingData) { var fieldId = id.substring(0, id.lastIndexOf('_')); var val; if (existingData) { val = decodeURI(existingData); } else { val = $("#".concat(fieldId)).val(); } var data = JSON.parse(val); var newVal = []; for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id !== id) { newVal.push(item); } } $("#".concat(fieldId)).val(JSON.stringify(newVal)); $("#".concat(id)).remove(); this.showMessage('Item Removed', 'Item removed. This change will be effective only when you save the form'); } /** * Fill a form with required values after showing it * @method fillForm * @param object {Array} form data * @param formId {String} id of the form * @param formId {Array} field meta data */ }, { key: "fillForm", value: function fillForm(object, formId, fields) { var placeHolderVal; if (fields == null || fields === undefined) { fields = this.getFormFields(); } if (formId == null || formId === undefined || formId === '') { formId = "#".concat(this.getTableName(), "Form"); } for (var i = 0; i < fields.length; i++) { if (fields[i][1].type === 'date') { if (object[fields[i][0]] !== '0000-00-00' && object[fields[i][0]] !== '' && object[fields[i][0]] != null && object[fields[i][0]] !== undefined) { $("".concat(formId, " #").concat(fields[i][0], "_date")).datepicker('setValue', object[fields[i][0]]); } } else if (fields[i][1].type === 'colorpick') { if (object[fields[i][0]] != null && object[fields[i][0]] !== undefined) { $("".concat(formId, " #").concat(fields[i][0], "_colorpick")).colorpicker('setValue', object[fields[i][0]]); $("".concat(formId, " #").concat(fields[i][0])).val(object[fields[i][0]]); } } else if (fields[i][1].type === 'datetime' || fields[i][1].type === 'time') { if (object[fields[i][0]] !== '0000-00-00 00:00:00' && object[fields[i][0]] !== '' && object[fields[i][0]] != null && object[fields[i][0]] !== undefined) { var tempDate = object[fields[i][0]]; var arr = tempDate.split(' '); var dateArr = arr[0].split('-'); var timeArr = arr[1].split(':'); $("".concat(formId, " #").concat(fields[i][0], "_datetime")).data('datetimepicker').setLocalDate(new Date(dateArr[0], parseInt(dateArr[1], 10) - 1, dateArr[2], timeArr[0], timeArr[1], timeArr[2])); } } else if (fields[i][1].type === 'label') { $("".concat(formId, " #").concat(fields[i][0])).html(object[fields[i][0]]); } else if (fields[i][1].type === 'placeholder') { if (fields[i][1]['remote-source'] !== undefined && fields[i][1]['remote-source'] != null) { // const key = `${fields[i][1]['remote-source'][0]}_${fields[i][1]['remote-source'][1]}_${fields[i][1]['remote-source'][2]}`; var key = this.getRemoteSourceKey(fields[i]); placeHolderVal = this.fieldMasterData[key][object[fields[i][0]]]; } else { placeHolderVal = object[fields[i][0]]; } if (placeHolderVal === undefined || placeHolderVal == null) { placeHolderVal = ''; } else { try { placeHolderVal = placeHolderVal.replace(/(?:\r\n|\r|\n)/g, '
    '); } catch (e) {// Do nothing } } if (fields[i][1].formatter !== undefined && fields[i][1].formatter && $.isFunction(fields[i][1].formatter)) { try { placeHolderVal = fields[i][1].formatter(placeHolderVal); } catch (e) {// Do nothing } } $("".concat(formId, " #").concat(fields[i][0])).html(placeHolderVal); } else if (fields[i][1].type === 'fileupload') { if (object[fields[i][0]] != null && object[fields[i][0]] !== undefined && object[fields[i][0]] !== '') { $("".concat(formId, " #").concat(fields[i][0])).html(object[fields[i][0]]); $("".concat(formId, " #").concat(fields[i][0])).attr('val', object[fields[i][0]]); $("".concat(formId, " #").concat(fields[i][0])).show(); $("".concat(formId, " #").concat(fields[i][0], "_download")).show(); $("".concat(formId, " #").concat(fields[i][0], "_remove")).show(); } if (fields[i][1].readonly === true) { $("".concat(formId, " #").concat(fields[i][0], "_upload")).remove(); } } else if (fields[i][1].type === 'select') { if (object[fields[i][0]] === undefined || object[fields[i][0]] == null || object[fields[i][0]] === '') { object[fields[i][0]] = 'NULL'; } $("".concat(formId, " #").concat(fields[i][0])).val(object[fields[i][0]]); } else if (fields[i][1].type === 'select2') { if (object[fields[i][0]] === undefined || object[fields[i][0]] == null || object[fields[i][0]] === '') { object[fields[i][0]] = 'NULL'; } $("".concat(formId, " #").concat(fields[i][0])).select2('val', object[fields[i][0]]); } else if (fields[i][1].type === 'select2multi') { // TODO - SM if (object[fields[i][0]] === undefined || object[fields[i][0]] == null || object[fields[i][0]] === '') { object[fields[i][0]] = 'NULL'; } var msVal = []; if (object[fields[i][0]] !== undefined && object[fields[i][0]] != null && object[fields[i][0]] !== '') { try { msVal = JSON.parse(object[fields[i][0]]); } catch (e) {// Do nothing } } $("".concat(formId, " #").concat(fields[i][0])).select2('val', msVal); var select2Height = $("".concat(formId, " #").concat(fields[i][0])).find('.select2-choices').height(); $("".concat(formId, " #").concat(fields[i][0])).find('.controls').css('min-height', "".concat(select2Height, "px")); $("".concat(formId, " #").concat(fields[i][0])).css('min-height', "".concat(select2Height, "px")); } else if (fields[i][1].type === 'datagroup') { try { var html = this.dataGroupToHtml(object[fields[i][0]], fields[i]); $("".concat(formId, " #").concat(fields[i][0])).val(object[fields[i][0]]); $("".concat(formId, " #").concat(fields[i][0], "_div")).html(''); $("".concat(formId, " #").concat(fields[i][0], "_div")).append(html); this.makeDataGroupSortable(fields[i], $("".concat(formId, " #").concat(fields[i][0], "_div_inner"))); } catch (e) {// Do nothing } } else if (fields[i][1].type === 'signature') { if (object[fields[i][0]] !== '' || object[fields[i][0]] !== undefined || object[fields[i][0]] != null) { $("".concat(formId, " #").concat(fields[i][0])).data('signaturePad').fromDataURL(object[fields[i][0]]); } } else if (fields[i][1].type === 'simplemde') { $("".concat(formId, " #").concat(fields[i][0])).data('simplemde').value(object[fields[i][0]]); } else if (fields[i][1].type === 'code') { var cm = $("".concat(formId, " #").concat(fields[i][0])).data('codemirror'); if (cm) { cm.getDoc().setValue(object[fields[i][0]]); } } else { $("".concat(formId, " #").concat(fields[i][0])).val(object[fields[i][0]]); } } } /** * Cancel edit or add new on modules * @method cancel */ }, { key: "cancel", value: function cancel() { $("#".concat(this.getTableName(), "Form")).hide(); $("#".concat(this.getTableName())).show(); } }, { key: "renderFormField", value: function renderFormField(field) { var userId = 0; if (this.fieldTemplates[field[1].type] === undefined || this.fieldTemplates[field[1].type] == null) { return ''; } var t = this.fieldTemplates[field[1].type]; field[1].label = this.gt(field[1].label); if (field[1].validation !== 'none' && field[1].validation !== 'emailOrEmpty' && field[1].validation !== 'numberOrEmpty' && field[1].type !== 'placeholder' && field[1].label.indexOf('*') < 0) { var tempSelectBoxes = ['select', 'select2']; if (!(tempSelectBoxes.indexOf(field[1].type) >= 0 && field[1]['allow-null'] === true)) { field[1].label = "".concat(field[1].label, "*"); } } if (field[1].type === 'select' || field[1].type === 'select2' || field[1].type === 'select2multi') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); if (field[1].source !== undefined && field[1].source != null) { t = t.replace('_options_', this.renderFormSelectOptions(field[1].source, field)); } else if (field[1]['remote-source'] !== undefined && field[1]['remote-source'] != null) { // let key = `${field[1]['remote-source'][0]}_${field[1]['remote-source'][1]}_${field[1]['remote-source'][2]}`; // if (field[1]['remote-source'].length === 4) { // key = `${key}_${field[1]['remote-source'][3]}`; // } var key = this.getRemoteSourceKey(field); t = t.replace('_options_', this.renderFormSelectOptionsRemote(this.fieldMasterData[key], field)); } } else if (field[1].type === 'colorpick') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } else if (field[1].type === 'date') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } else if (field[1].type === 'datetime') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } else if (field[1].type === 'time') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } else if (field[1].type === 'fileupload') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); var ce = this.getCurrentProfile(); if (ce != null && ce !== undefined) { userId = ce.id; } else { userId = this.getUser().id * -1; } t = t.replace(/_userId_/g, userId); t = t.replace(/_group_/g, this.tab); if (field[1].filetypes !== undefined && field[1].filetypes != null) { t = t.replace(/_filetypes_/g, field[1].filetypes); } else { t = t.replace(/_filetypes_/g, 'all'); } t = t.replace(/_rand_/g, this.generateRandom(14)); } else if (field[1].type === 'datagroup') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } else if (field[1].type === 'signature') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } else if (field[1].type === 'tinymce' || field[1].type === 'simplemde') { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } else { t = t.replace(/_id_/g, field[0]); t = t.replace(/_label_/g, field[1].label); } if (field[1].validation !== undefined && field[1].validation != null && field[1].validation !== '') { t = t.replace(/_validation_/g, "validation=\"".concat(field[1].validation, "\"")); } else { t = t.replace(/_validation_/g, ''); } if (field[1].help !== undefined && field[1].help !== null) { t = t.replace(/_helpline_/g, field[1].help); t = t.replace(/_hidden_class_help_/g, ''); } else { t = t.replace(/_helpline_/g, ''); t = t.replace(/_hidden_class_help_/g, 'hide'); } if (field[1].placeholder !== undefined && field[1].placeholder !== null) { t = t.replace(/_placeholder_/g, "placeholder=\"".concat(field[1].placeholder, "\"")); } else { t = t.replace(/_placeholder_/g, ''); } if (field[1].mask !== undefined && field[1].mask !== null) { t = t.replace(/_mask_/g, "mask=\"".concat(field[1].mask, "\"")); } else { t = t.replace(/_mask_/g, ''); } return t; } }, { key: "renderFormSelectOptions", value: function renderFormSelectOptions(options, field) { var html = ''; if (field != null && field !== undefined) { if (field[1]['allow-null'] === true) { if (field[1]['null-label'] !== undefined && field[1]['null-label'] != null) { html += ""); } else { html += ''; } } } // Sort options var tuples = []; for (var key in options) { tuples.push(options[key]); } if (field[1].sort === true) { tuples.sort(function (a, b) { a = a[1]; b = b[1]; // eslint-disable-next-line no-nested-ternary return a < b ? -1 : a > b ? 1 : 0; }); } for (var i = 0; i < tuples.length; i++) { var prop = tuples[i][0]; var value = tuples[i][1]; var t = ''; t = t.replace('_id_', prop); t = t.replace('_val_', this.gt(value)); html += t; } return html; } }, { key: "renderFormSelectOptionsRemote", value: function renderFormSelectOptionsRemote(options, field) { var html = ''; if (field[1]['allow-null'] === true) { if (field[1]['null-label'] !== undefined && field[1]['null-label'] != null) { html += ""); } else { html += ''; } } // Sort options var tuples = []; for (var key in options) { tuples.push([key, options[key]]); } if (field[1].sort === 'true') { tuples.sort(function (a, b) { a = a[1]; b = b[1]; // eslint-disable-next-line no-nested-ternary return a < b ? -1 : a > b ? 1 : 0; }); } for (var i = 0; i < tuples.length; i++) { var prop = tuples[i][0]; var value = tuples[i][1]; var t = ''; t = t.replace('_id_', prop); t = t.replace('_val_', this.gt(value)); html += t; } return html; } }, { key: "setCustomTemplates", value: function setCustomTemplates(templates) { this.customTemplates = templates; } }, { key: "setEmailTemplates", value: function setEmailTemplates(templates) { this.emailTemplates = templates; } }, { key: "getCustomTemplate", value: function getCustomTemplate(file) { return this.customTemplates[file]; } }, { key: "setFieldTemplates", value: function setFieldTemplates(templates) { this.fieldTemplates = templates; } }, { key: "getMetaFieldForRendering", value: function getMetaFieldForRendering(fieldName) { return ''; } }, { key: "clearDeleteParams", value: function clearDeleteParams() { this.deleteParams = {}; } }, { key: "getShowAddNew", value: function getShowAddNew() { return this.showAddNew; } /** * Override this method to change add new button label * @method getAddNewLabel */ }, { key: "getAddNewLabel", value: function getAddNewLabel() { return 'Add New'; } /** * Used to set whether to show the add new button for a module * @method setShowAddNew * @param showAddNew {Boolean} value */ }, { key: "setShowAddNew", value: function setShowAddNew(showAddNew) { this.showAddNew = showAddNew; } /** * Used to set whether to show delete button for each entry in module * @method setShowDelete * @param val {Boolean} value */ }, { key: "setShowDelete", value: function setShowDelete(val) { this.showDelete = val; } /** * Used to set whether to show edit button for each entry in module * @method setShowEdit * @param val {Boolean} value */ }, { key: "setShowEdit", value: function setShowEdit(val) { this.showEdit = val; } /** * Used to set whether to show save button in form * @method setShowSave * @param val {Boolean} value */ }, { key: "setShowSave", value: function setShowSave(val) { this.showSave = val; } /** * Used to set whether to show cancel button in form * @method setShowCancel * @param val {Boolean} value */ }, { key: "setShowCancel", value: function setShowCancel(val) { this.showCancel = val; } /** * Datatable option array will be extended with associative array provided here * @method getCustomTableParams * @param val {Boolean} value */ }, { key: "getCustomTableParams", value: function getCustomTableParams() { return {}; } }, { key: "getActionButtons", value: function getActionButtons(obj) { return modJs.getActionButtonsHtml(obj.aData[0], obj.aData); } /** * This return html for action buttons in each row. Override this method if you need to make changes to action buttons. * @method getActionButtonsHtml * @param id {int} id of the row * @param data {Array} data for the row * @returns {String} html for action buttons */ }, { key: "getActionButtonsHtml", value: function getActionButtonsHtml(id, data) { var editButton = ''; var deleteButton = ''; var cloneButton = ''; var html = '
    _edit__delete__clone_
    '; if (this.showAddNew) { html = html.replace('_clone_', cloneButton); } else { html = html.replace('_clone_', ''); } if (this.showDelete) { html = html.replace('_delete_', deleteButton); } else { html = html.replace('_delete_', ''); } if (this.showEdit) { html = html.replace('_edit_', editButton); } else { html = html.replace('_edit_', ''); } html = html.replace(/_id_/g, id); html = html.replace(/_BASE_/g, this.baseUrl); return html; } /** * Generates a random string * @method generateRandom * @param length {int} required length of the string * @returns {String} random string */ }, { key: "generateRandom", value: function generateRandom(length) { var d = new Date(); var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var result = ''; for (var i = length; i > 0; --i) { result += chars[Math.round(Math.random() * (chars.length - 1))]; } return result + d.getTime(); } }, { key: "checkFileType", value: function checkFileType(elementName, fileTypes) { var fileElement = document.getElementById(elementName); var fileExtension = ''; if (fileElement.value.lastIndexOf('.') > 0) { fileExtension = fileElement.value.substring(fileElement.value.lastIndexOf('.') + 1, fileElement.value.length); } fileExtension = fileExtension.toLowerCase(); var allowed = fileTypes.split(','); if (allowed.indexOf(fileExtension) < 0) { fileElement.value = ''; this.showMessage('File Type Error', 'Selected file type is not supported'); this.clearFileElement(elementName); return false; } return true; } }, { key: "clearFileElement", value: function clearFileElement(elementName) { var control = $("#".concat(elementName)); control.replaceWith(control = control.val('').clone(true)); } }, { key: "fixJSON", value: function fixJSON(json) { if (this.noJSONRequests === '1') { json = window.btoa(json); } return json; } }, { key: "getClientDate", value: function getClientDate(date) { var offset = this.getClientGMTOffset(); var tzDate = date.addMinutes(offset * 60); return tzDate; } }, { key: "getClientGMTOffset", value: function getClientGMTOffset() { var rightNow = new Date(); var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0); var temp = jan1.toGMTString(); var jan2 = new Date(temp.substring(0, temp.lastIndexOf(' ') - 1)); return (jan1 - jan2) / (1000 * 60 * 60); } /** * Override this method in a module to provide the help link for the module. Help link of the module on frontend will get updated with this. * @method getHelpLink * @returns {String} help link */ }, { key: "getHelpLink", value: function getHelpLink() { return null; } }, { key: "showLoader", value: function showLoader() { $('#iceloader').show(); } }, { key: "hideLoader", value: function hideLoader() { $('#iceloader').hide(); } }, { key: "generateOptions", value: function generateOptions(data) { var template = ''; var options = ''; for (var index in data) { options += template.replace('__val__', index).replace('__text__', data[index]); } return options; } }, { key: "isModuleInstalled", value: function isModuleInstalled(type, name) { if (modulesInstalled === undefined || modulesInstalled === null) { return false; } return modulesInstalled["".concat(type, "_").concat(name)] === 1; } }, { key: "setCustomFields", value: function setCustomFields(fields) { var field; var parsed; for (var i = 0; i < fields.length; i++) { field = fields[i]; if (field.display !== 'Hidden' && field.data !== '' && field.data !== undefined) { try { parsed = JSON.parse(field.data); if (parsed === undefined || parsed == null) { continue; } else if (parsed.length !== 2) { continue; } else if (parsed[1].type === undefined || parsed[1].type == null) { continue; } this.customFields.push(parsed); } catch (e) {// Do nothing } } } } }, { key: "addCustomFields", value: function addCustomFields(fields) { for (var i = 0; i < this.customFields.length; i++) { fields.push(this.customFields[i]); } return fields; } }, { key: "getImageUrlFromName", value: function getImageUrlFromName(firstName, lastName) { var seed = firstName.substring(0, 1); if (!lastName && lastName.length > 0) { seed += firstName.substring(firstName.length - 1, 1); } else { seed += lastName.substring(0, 1); } var arr = "".concat(firstName).concat(lastName).split(''); seed += arr.reduce(function (acc, item) { return parseInt(item.charCodeAt(0), 10) + acc; }, 0); return "https://avatars.dicebear.com/api/initials/:".concat(seed, ".svg"); } }, { key: "downloadPdf", value: function downloadPdf(type, data) { var url = "".concat(this.clientUrl, "service.php?a=pdf&h=").concat(type, "&data=").concat(data); window.open(url, '_blank'); } }]); return ModuleBase; }(); var _default = ModuleBase; exports["default"] = _default; },{"./FormValidation":6}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _reactDom = _interopRequireDefault(require("react-dom")); var _antd = require("antd"); var _icons = require("@ant-design/icons"); var _AdapterBase2 = _interopRequireDefault(require("./AdapterBase")); var _IceFormModal = _interopRequireDefault(require("../components/IceFormModal")); var _IceStepFromModal = _interopRequireDefault(require("../components/IceStepFromModal")); var _IceTable = _interopRequireDefault(require("../components/IceTable")); var _MasterDataReader = _interopRequireDefault(require("./MasterDataReader")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var ReactModalAdapterBase = /*#__PURE__*/function (_AdapterBase) { _inherits(ReactModalAdapterBase, _AdapterBase); var _super = _createSuper(ReactModalAdapterBase); _createClass(ReactModalAdapterBase, null, [{ key: "MODAL_TYPE_NORMAL", get: function get() { return 'Normal'; } }, { key: "MODAL_TYPE_STEPS", get: function get() { return 'Steps'; } }]); function ReactModalAdapterBase(endPoint, tab, filter, orderBy) { var _this; _classCallCheck(this, ReactModalAdapterBase); _this = _super.call(this, endPoint, tab, filter, orderBy); _this.modalType = _this.MODAL_TYPE_NORMAL; _this.dataPipe = null; _this.formInitialized = false; _this.tableInitialized = false; _this.access = []; _this.localStorageEnabled = false; _this.isV2 = true; _this.masterDataReader = new _MasterDataReader["default"](_assertThisInitialized(_this)); return _this; } _createClass(ReactModalAdapterBase, [{ key: "enableLocalStorage", value: function enableLocalStorage() { this.localStorageEnabled = true; } }, { key: "setModalType", value: function setModalType(type) { this.modalType = type; } }, { key: "setDataPipe", value: function setDataPipe(dataPipe) { this.dataPipe = dataPipe; } }, { key: "setAccess", value: function setAccess(access) { this.access = access; } }, { key: "hasAccess", value: function hasAccess(type) { return this.access.indexOf(type) > 0; } }, { key: "hasCustomButtons", value: function hasCustomButtons() { return false; } }, { key: "initTable", value: function initTable() { var _this2 = this; if (this.tableInitialized) { return false; } var tableDom = document.getElementById("".concat(this.tab, "Table")); if (tableDom) { this.tableContainer = _react["default"].createRef(); var columns = this.getTableColumns(); if (this.hasAccess('save') || this.hasAccess('delete') || this.hasAccess('element') || this.hasCustomButtons()) { columns.push({ title: 'Actions', key: 'actions', render: this.getTableActionButtonJsx(this) }); } columns = columns.map(function (item) { item.title = _this2.gt(item.title); return item; }); _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(_IceTable["default"], { ref: this.tableContainer, reader: this.dataPipe, columns: columns, adapter: this }, this.getTableChildComponents()), tableDom); } this.tableInitialized = true; return true; } }, { key: "initForm", value: function initForm() { var _this3 = this; if (this.formInitialized) { return false; } this.formContainer = _react["default"].createRef(); if (this.modalType === this.MODAL_TYPE_NORMAL) { _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(_IceFormModal["default"], { ref: this.formContainer, fields: this.getFormFields(), adapter: this, formReference: this.formReference }), document.getElementById("".concat(this.tab, "Form"))); } else { _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(_IceStepFromModal["default"], { ref: this.formContainer, fields: this.getMappedFields(), adapter: this, formReference: this.formReference }), document.getElementById("".concat(this.tab, "Form"))); } var filterDom = document.getElementById("".concat(this.tab, "FilterForm")); if (filterDom && this.getFilters()) { this.filtersContainer = _react["default"].createRef(); _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(_IceFormModal["default"], { ref: this.filtersContainer, fields: this.getFilters(), adapter: this, saveCallback: function saveCallback(values, showError, closeModal) { _this3.setFilter(values); _this3.filtersAlreadySet = true; _this3.get([]); _this3.tableContainer.current.setFilterData(values); closeModal(); } }), filterDom); } this.formInitialized = true; return true; } }, { key: "getTableChildComponents", value: function getTableChildComponents() { return false; } }, { key: "reloadCurrentElement", value: function reloadCurrentElement() { this.viewElement(this.currentId); } }, { key: "getTableActionButtonJsx", value: function getTableActionButtonJsx(adapter) { return function (text, record) { return /*#__PURE__*/_react["default"].createElement(_antd.Space, { size: "middle" }, adapter.hasAccess('save') && adapter.showEdit && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "green", onClick: function onClick() { return modJs.edit(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.EditOutlined, null), " ".concat(adapter.gt('Edit'))), adapter.hasAccess('element') && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "blue", onClick: function onClick() { return modJs.viewElement(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.MonitorOutlined, null), " ".concat(adapter.gt('View'))), adapter.hasAccess('delete') && adapter.showDelete && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "volcano", onClick: function onClick() { return modJs.deleteRow(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.DeleteOutlined, null), " ".concat(adapter.gt('Delete'))), adapter.hasAccess('save') && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "cyan", onClick: function onClick() { return modJs.copyRow(record.id); }, style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.CopyOutlined, null), " ".concat(adapter.gt('Copy')))); }; } }, { key: "setTableLoading", value: function setTableLoading(value) { this.tableContainer.current.setLoading(value); } /** * Show the view form for an item * @method viewElement * @param id {int} id of the item to view */ }, { key: "viewElement", value: function viewElement(id) { var _this4 = this; this.setTableLoading(true); this.currentId = id; this.getElement(id, { noRender: true, callBack: function callBack(element) { _this4.showElement(element); _this4.setTableLoading(false); } }); } }, { key: "showElement", value: function showElement(element) { this.renderForm(element, true); } /** * Show the edit form for an item * @method edit * @param id {int} id of the item to edit */ }, { key: "edit", value: function edit(id) { this.setTableLoading(true); this.currentId = id; this.getElement(id, []); } }, { key: "renderForm", value: function renderForm() { var object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var viewOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (object == null) { this.currentId = null; this.currentElement = null; } this.setTableLoading(false); this.initForm(); this.formContainer.current.setViewOnly(viewOnly); this.formContainer.current.show(object); } }, { key: "showFilters", value: function showFilters() { this.initForm(); this.filtersContainer.current.show(this.filter); } }, { key: "resetFilters", value: function resetFilters() { this.filter = this.origFilter; this.filtersAlreadySet = false; this.currentFilterString = ''; this.get([]); this.tableContainer.current.setFilterData(this.filter); } }, { key: "get", value: function get() { var _this5 = this; if (this.tableContainer && this.tableContainer.current) { this.tableContainer.current.setCurrentElement(null); } this.initTable(); this.masterDataReader.updateAllMasterData().then(function () { _this5.tableContainer.current.reload(); }); this.trackEvent('get', this.tab, this.table); } }, { key: "showLoader", value: function showLoader() {// $('#iceloader').show(); } }, { key: "addActualFieldsForStepModal", value: function addActualFieldsForStepModal(steps, fields) { return steps.map(function (item) { item.fields = item.fields.reduce(function (acc, fieldName) { var field = fields.find(function (_ref) { var _ref2 = _slicedToArray(_ref, 1), name = _ref2[0]; return name === fieldName; }); if (field) { acc.push(field); } return acc; }, []); return item; }); } }, { key: "getFormOptions", value: function getFormOptions() { return { width: 1024, twoColumnLayout: false }; } }]); return ReactModalAdapterBase; }(_AdapterBase2["default"]); var _default = ReactModalAdapterBase; exports["default"] = _default; },{"../components/IceFormModal":15,"../components/IceStepFromModal":20,"../components/IceTable":21,"./AdapterBase":5,"./MasterDataReader":9,"@ant-design/icons":"@ant-design/icons","antd":"antd","react":"react","react-dom":"react-dom"}],12:[function(require,module,exports){ "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireWildcard(require("react")); var _reactColor = require("react-color"); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function useComponentVisible(initialIsVisible) { var _useState = (0, _react.useState)(initialIsVisible), _useState2 = _slicedToArray(_useState, 2), isComponentVisible = _useState2[0], setIsComponentVisible = _useState2[1]; var ref = (0, _react.useRef)(null); var handleClickOutside = function handleClickOutside(event) { if (ref.current && !ref.current.contains(event.target)) { setIsComponentVisible(false); } }; (0, _react.useEffect)(function () { document.addEventListener('click', handleClickOutside, true); return function () { document.removeEventListener('click', handleClickOutside, true); }; }); return { ref: ref, isComponentVisible: isComponentVisible, setIsComponentVisible: setIsComponentVisible }; } function IceColorPick(props) { var value = props.value, onChange = props.onChange, readOnly = props.readOnly; var _useComponentVisible = useComponentVisible(true), ref = _useComponentVisible.ref, isComponentVisible = _useComponentVisible.isComponentVisible, setIsComponentVisible = _useComponentVisible.setIsComponentVisible; var _useState3 = (0, _react.useState)(value || '#FFF'), _useState4 = _slicedToArray(_useState3, 2), color = _useState4[0], setColor = _useState4[1]; var _useState5 = (0, _react.useState)(false), _useState6 = _slicedToArray(_useState5, 2), showPicker = _useState6[0], setShowPicker = _useState6[1]; (0, _react.useEffect)(function () { if (!isComponentVisible) { setShowPicker(false); } }, [isComponentVisible]); (0, _react.useEffect)(function () { if (value) { setColor(value); } }, [value]); return /*#__PURE__*/_react["default"].createElement("div", { className: "colorpicker-container" }, /*#__PURE__*/_react["default"].createElement("div", { className: "colorpicker-preview", onClick: function onClick() { if (!showPicker) { setIsComponentVisible(true); } setShowPicker(!showPicker); }, style: { backgroundColor: color } }), /*#__PURE__*/_react["default"].createElement("div", { ref: ref, className: "colorpicker-component ".concat(readOnly || !showPicker ? 'hidden' : '') }, /*#__PURE__*/_react["default"].createElement(_reactColor.SketchPicker, { color: color, disableAlpha: true, presetColors: [], onChangeComplete: function onChangeComplete(_ref) { var hex = _ref.hex; onChange(hex); setColor(hex); } }))); } var _default = IceColorPick; exports["default"] = _default; },{"react":"react","react-color":292}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); var _IceFormModal = _interopRequireDefault(require("./IceFormModal")); var _reactDom = _interopRequireDefault(require("react-dom")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Option = _antd.Select.Option; var IceDataGroup = /*#__PURE__*/function (_React$Component) { _inherits(IceDataGroup, _React$Component); var _super = _createSuper(IceDataGroup); function IceDataGroup(props) { var _this; _classCallCheck(this, IceDataGroup); _this = _super.call(this, props); _this.state = {}; _this.onChange = props.onChange; _this.formReference = _react["default"].createRef(); return _this; } _createClass(IceDataGroup, [{ key: "render", value: function render() { var _this2 = this; var _this$props = this.props, field = _this$props.field, adapter = _this$props.adapter; var value = this.props.value; value = this.parseValue(value); value = value.map(function (item) { return _objectSpread({}, item, { key: item.id }); }); var columns = JSON.parse(JSON.stringify(field[1].columns)); if (!this.props.readOnly) { columns.push({ title: 'Action', key: 'action', render: function render(text, record) { return _this2.getDefaultButtons(record.id); } }); } return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !this.props.readOnly && /*#__PURE__*/_react["default"].createElement(_antd.Space, { direction: "horizontal" }, /*#__PURE__*/_react["default"].createElement(_antd.Button, { type: "link", htmlType: "button", onClick: function onClick() { _this2.createForm(field, adapter, {}); } }, "Add"), /*#__PURE__*/_react["default"].createElement(_antd.Button, { type: "link", htmlType: "button", danger: true, onClick: function onClick() { _this2.resetDataGroup(); } }, "Reset")), /*#__PURE__*/_react["default"].createElement(_antd.Table, { columns: columns, dataSource: value })); } }, { key: "createForm", value: function createForm(field, adapter, object) { this.formContainer = _react["default"].createRef(); var formFields = field[1].form; formFields.unshift(['id', { label: 'ID', type: 'hidden' }]); _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(_IceFormModal["default"], { ref: this.formContainer, fields: formFields, title: this.props.title, adapter: adapter, formReference: this.formReference, saveCallback: this.save.bind(this), cancelCallback: this.unmountForm.bind(this) }), document.getElementById('dataGroup')); this.formContainer.current.show(object); } }, { key: "unmountForm", value: function unmountForm() { _reactDom["default"].unmountComponentAtNode(document.getElementById('dataGroup')); } }, { key: "show", value: function show(data) { var _this3 = this; if (!data) { this.setState({ visible: true }); this.updateFields(data); } else { this.setState({ visible: true }); if (this.formReference.current) { this.updateFields(data); } else { this.waitForIt(function () { return _this3.formReference.current != null; }, function () { _this3.updateFields(data); }, 100); } } } }, { key: "parseValue", value: function parseValue(value) { try { value = JSON.parse(value); } catch (e) { value = []; } if (value == null) { value = []; } return value; } }, { key: "save", value: function save(params, errorCallback, closeCallback) { var _this$props2 = this.props, field = _this$props2.field, value = _this$props2.value; if (field[1]['custom-validate-function'] != null) { var tempParams = field[1]['custom-validate-function'].apply(this, [params]); if (tempParams.valid) { params = tempParams.params; } else { errorCallback(tempParams.message); return false; } } var data = this.parseValue(value); var newData = []; if (!params.id) { params.id = "".concat(field[0], "_").concat(this.dataGroupGetNextAutoIncrementId(data)); data.push(params); newData = data; } else { for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id !== params.id) { newData.push(item); } else { newData.push(params); } } } if (field[1]['sort-function'] != null) { newData.sort(field[1]['sort-function']); } var val = JSON.stringify(newData); this.onChange(val); this.unmountForm(); } }, { key: "createCard", value: function createCard(item) { var field = this.props.field; if (field[1]['pre-format-function'] != null) { item = field[1]['pre-format-function'].apply(this, [item]); } var template = field[1].html; var t = template.replace('#_delete_#', ''); t = t.replace('#_edit_#', ''); t = t.replace(/#_id_#/g, item.id); for (var key in item) { var itemVal = item[key]; if (itemVal !== undefined && itemVal != null && typeof itemVal === 'string') { itemVal = itemVal.replace(/(?:\r\n|\r|\n)/g, '
    '); } t = t.replace("#_".concat(key, "_#"), itemVal); } if (field[1].render !== undefined && field[1].render != null) { t = t.replace('#_renderFunction_#', field[1].render(item)); } return /*#__PURE__*/_react["default"].createElement(_antd.Card, { key: item.id, title: "", extra: this.getDefaultButtons(item.id) }, /*#__PURE__*/_react["default"].createElement("div", { dangerouslySetInnerHTML: { __html: t } })); } }, { key: "getDefaultButtons", value: function getDefaultButtons(id) { var _this4 = this; return /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement("a", { href: "#", onClick: function onClick() { _this4.editDataGroupItem(id); } }, /*#__PURE__*/_react["default"].createElement("li", { className: "fa fa-edit" })), /*#__PURE__*/_react["default"].createElement("a", { href: "#", onClick: function onClick() { _this4.deleteDataGroupItem(id); } }, /*#__PURE__*/_react["default"].createElement("li", { className: "fa fa-times" }))); } }, { key: "deleteDataGroupItem", value: function deleteDataGroupItem(id) { var value = this.props.value; var data = this.parseValue(value); var newVal = []; for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id !== id) { newVal.push(item); } } var val = JSON.stringify(newVal); this.onChange(val); } }, { key: "editDataGroupItem", value: function editDataGroupItem(id) { var _this$props3 = this.props, field = _this$props3.field, adapter = _this$props3.adapter, value = _this$props3.value; var data = this.parseValue(value); var editVal = {}; for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id === id) { editVal = item; } } this.createForm(field, adapter, editVal); } }, { key: "resetDataGroup", value: function resetDataGroup() { this.onChange('[]'); } }, { key: "dataGroupGetNextAutoIncrementId", value: function dataGroupGetNextAutoIncrementId(data) { var autoId = 1; var id; for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.id === undefined || item.id == null) { item.id = 1; } id = item.id.substring(item.id.lastIndexOf('_') + 1, item.id.length); if (id >= autoId) { autoId = parseInt(id, 10) + 1; } } return autoId; } }]); return IceDataGroup; }(_react["default"].Component); var _default = IceDataGroup; exports["default"] = _default; },{"./IceFormModal":15,"antd":"antd","react":"react","react-dom":"react-dom"}],14:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); var _moment = _interopRequireDefault(require("moment")); var _IceUpload = _interopRequireDefault(require("./IceUpload")); var _IceDataGroup = _interopRequireDefault(require("./IceDataGroup")); var _IceSelect = _interopRequireDefault(require("./IceSelect")); var _IceLabel = _interopRequireDefault(require("./IceLabel")); var _IceColorPick = _interopRequireDefault(require("./IceColorPick")); var _IceSignature = _interopRequireDefault(require("./IceSignature")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var ValidationRules = { "float": function float(str) { var floatstr = /^[-+]?[0-9]+(\.[0-9]+)?$/; if (str != null && str.match(floatstr)) { return true; } return false; }, number: function number(str) { var numstr = /^[0-9]+$/; if (str != null && str.match(numstr)) { return true; } return false; }, numberOrEmpty: function numberOrEmpty(str) { if (str === '') { return true; } var numstr = /^[0-9]+$/; if (str != null && str.match(numstr)) { return true; } return false; }, email: function email(str) { var emailPattern = /^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/; return str != null && emailPattern.test(str); }, emailOrEmpty: function emailOrEmpty(str) { if (str === '') { return true; } var emailPattern = /^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/; return str != null && emailPattern.test(str); }, username: function username(str) { var username = /^[a-zA-Z0-9.-]+$/; return str != null && username.test(str); } }; var IceForm = /*#__PURE__*/function (_React$Component) { _inherits(IceForm, _React$Component); var _super = _createSuper(IceForm); function IceForm(props) { var _this; _classCallCheck(this, IceForm); _this = _super.call(this, props); _this.validationRules = {}; _this.state = { validations: {}, errorMsg: false }; _this.formReference = _react["default"].createRef(); return _this; } _createClass(IceForm, [{ key: "showError", value: function showError(errorMsg) { this.setState({ errorMsg: errorMsg }); } }, { key: "hideError", value: function hideError() { this.setState({ errorMsg: false }); } }, { key: "isReady", value: function isReady() { return this.formReference.current != null; } }, { key: "validateFields", value: function validateFields() { return this.formReference.current.validateFields(); } }, { key: "render", value: function render() { var _this$props = this.props, fields = _this$props.fields, twoColumnLayout = _this$props.twoColumnLayout, adapter = _this$props.adapter; var formInputs = []; var formInputs1 = []; var formInputs2 = []; var columns = !twoColumnLayout ? 1 : 2; for (var i = 0; i < fields.length; i++) { formInputs.push(adapter.beforeRenderFieldHook(fields[i][0], this.createFromField(fields[i], this.props.viewOnly), fields[i][1])); } formInputs = formInputs.filter(function (input) { return !!input; }); for (var _i = 0; _i < formInputs.length; _i++) { if (formInputs[_i] != null) { if (columns === 1) { formInputs1.push(formInputs[_i]); } else if (_i % 2 === 0) { formInputs1.push(formInputs[_i]); } else { formInputs2.push(formInputs[_i]); } } } var onFormLayoutChange = function onFormLayoutChange() {}; return /*#__PURE__*/_react["default"].createElement(_antd.Form, { ref: this.formReference, labelCol: { span: 6 }, wrapperCol: { span: 16 }, layout: this.props.layout || 'horizontal', initialValues: { size: 'middle' }, onValuesChange: onFormLayoutChange, size: "middle" }, this.state.errorMsg && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_antd.Alert, { message: this.state.errorMsg, type: "error", showIcon: true }), /*#__PURE__*/_react["default"].createElement("br", null)), columns === 1 && formInputs1, columns === 2 && /*#__PURE__*/_react["default"].createElement(_antd.Row, { gutter: 16 }, /*#__PURE__*/_react["default"].createElement(_antd.Col, { className: "gutter-row", span: 12 }, formInputs1), /*#__PURE__*/_react["default"].createElement(_antd.Col, { className: "gutter-row", span: 12 }, formInputs2))); } }, { key: "isValid", value: function isValid() { var _this2 = this; return Object.keys(this.validationRules).reduce(function (acc, fieldName) { return acc && (_this2.state[fieldName] === 'success' || _this2.state[fieldName] == null); }, true); } }, { key: "validateOnChange", value: function validateOnChange(event) { var validationRule = this.validationRules[event.target.id]; var validations = this.state.validations; if (validationRule) { if (validationRule.rule(event.target.value)) { this.state[event.target.id] = 'success'; this.state["".concat(event.target.id, "_message")] = null; } else { this.state[event.target.id] = 'error'; this.state["".concat(event.target.id, "_message")] = validationRule.message; } } this.setState({ validations: validations }); } }, { key: "createFromField", value: function createFromField(field) { var viewOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var userId = 0; var rules = []; var requiredRule = { required: true }; var _field = _slicedToArray(field, 2), name = _field[0], data = _field[1]; var _this$props2 = this.props, adapter = _this$props2.adapter, layout = _this$props2.layout; var validationRule = null; data.label = adapter.gt(data.label); var labelSpan = layout === 'vertical' ? { span: 24 } : { span: 6 }; var tempSelectBoxes = ['select', 'select2', 'select2multi']; if (tempSelectBoxes.indexOf(data.type) >= 0 && data['allow-null'] === true) { requiredRule.required = false; } else if (data.validation === 'none' || data.validation === 'emailOrEmpty' || data.validation === 'numberOrEmpty') { requiredRule.required = false; } else { requiredRule.required = true; requiredRule.message = this.generateFieldMessage(data.label); } rules.push(requiredRule); if (data.type === 'hidden') { requiredRule.required = false; return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, style: { display: 'none' }, label: data.label, key: name, name: name, rules: rules }, /*#__PURE__*/_react["default"].createElement(_antd.Input, null)); } if (data.type === 'text') { if (data.validation) { data.validation = data.validation.replace('OrEmpty', ''); validationRule = this.getValidationRule(data); if (validationRule) { this.validationRules[name] = { rule: validationRule, message: "Invalid value for ".concat(data.label) }; } } if (validationRule != null) { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules, validateStatus: this.state[name], help: this.state["".concat(name, "_message")] }, viewOnly ? /*#__PURE__*/_react["default"].createElement(_IceLabel["default"], null) : /*#__PURE__*/_react["default"].createElement(_antd.Input, { onChange: this.validateOnChange.bind(this) })); } return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules }, viewOnly ? /*#__PURE__*/_react["default"].createElement(_IceLabel["default"], null) : /*#__PURE__*/_react["default"].createElement(_antd.Input, null)); } if (data.type === 'textarea') { if (!data.rows) { data.rows = 4; } return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules }, viewOnly ? /*#__PURE__*/_react["default"].createElement(_IceLabel["default"], null) : /*#__PURE__*/_react["default"].createElement(_antd.Input.TextArea, { rows: data.rows })); } if (data.type === 'date') { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules }, /*#__PURE__*/_react["default"].createElement(_antd.DatePicker, { disabled: viewOnly })); } if (data.type === 'datetime') { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules }, /*#__PURE__*/_react["default"].createElement(_antd.DatePicker, { format: "YYYY-MM-DD HH:mm:ss", disabled: viewOnly })); } if (data.type === 'time') { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules }, /*#__PURE__*/_react["default"].createElement(_antd.TimePicker, { format: "HH:mm", disabled: viewOnly })); } if (data.type === 'fileupload') { var currentEmployee = adapter.getCurrentProfile(); if (currentEmployee != null) { userId = currentEmployee.id; } else { userId = adapter.getUser().id * -1; } if (data.filetypes == null) { data.filetypes = '.doc,.docx,.xml,' + 'application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,' + 'image/*,' + '.pdf'; } return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, name: name, key: name, label: data.label }, /*#__PURE__*/_react["default"].createElement(_IceUpload["default"], { user: userId, fileGroup: adapter.tab, fileName: name, adapter: adapter, accept: data.filetypes, readOnly: viewOnly })); } if (data.type === 'datagroup') { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, name: name, key: name, label: data.label }, /*#__PURE__*/_react["default"].createElement(_IceDataGroup["default"], { adapter: adapter, field: field, title: data.label, readOnly: viewOnly })); } if (data.type === 'select2' || data.type === 'select' || data.type === 'select2multi') { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules }, /*#__PURE__*/_react["default"].createElement(_IceSelect["default"], { adapter: adapter, field: field, readOnly: viewOnly })); } if (data.type === 'colorpick') { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, name: name, key: name, label: data.label }, /*#__PURE__*/_react["default"].createElement(_IceColorPick["default"], { adapter: adapter, field: field, title: data.label, readOnly: viewOnly })); } if (data.type === 'signature') { return /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { labelCol: labelSpan, label: data.label, key: name, name: name, rules: rules }, /*#__PURE__*/_react["default"].createElement(_IceSignature["default"], { readOnly: viewOnly })); } return null; } }, { key: "generateFieldMessage", value: function generateFieldMessage(label) { return "".concat(label, ": ").concat(this.props.adapter.gt('is required')); } }, { key: "getValidationRule", value: function getValidationRule(data) { if (ValidationRules[data.validation] == null) { return null; } return ValidationRules[data.validation]; } }, { key: "dataToFormFields", value: function dataToFormFields(data, fields) { for (var i = 0; i < fields.length; i++) { var _fields$i = _slicedToArray(fields[i], 2), key = _fields$i[0], formInputData = _fields$i[1]; if (formInputData.type === 'date') { data[key] = data[key] ? (0, _moment["default"])(data[key], 'YYYY-MM-DD') : null; } else if (formInputData.type === 'datetime') { data[key] = data[key] ? (0, _moment["default"])(data[key], 'YYYY-MM-DD HH:mm:ss') : null; } else if (formInputData.type === 'time') { data[key] = data[key] ? (0, _moment["default"])(data[key], 'HH:mm') : null; } } return data; } }, { key: "formFieldsToData", value: function formFieldsToData(params, fields) { for (var i = 0; i < fields.length; i++) { var _fields$i2 = _slicedToArray(fields[i], 2), key = _fields$i2[0], formInputData = _fields$i2[1]; if (formInputData.type === 'date') { params[key] = params[key] ? params[key].format('YYYY-MM-DD') : 'NULL'; } else if (formInputData.type === 'datetime') { params[key] = params[key] ? params[key].format('YYYY-MM-DD HH:mm:ss') : 'NULL'; } else if (formInputData.type === 'time') { params[key] = params[key] ? params[key].format('HH:mm') : 'NULL'; } else if ((formInputData.type === 'select' || formInputData.type === 'select2') && params[key] == null) { params[key] = 'NULL'; } } return params; } }, { key: "updateFields", value: function updateFields(data) { var fields = this.props.fields; data = this.dataToFormFields(data, fields); this.formReference.current.resetFields(); if (data == null) { return; } try { this.formReference.current.setFieldsValue(data); } catch (e) { console.log(e); } } }, { key: "resetFields", value: function resetFields() { this.formReference.current.resetFields(); } }, { key: "setFieldsValue", value: function setFieldsValue(data) { this.formReference.current.setFieldsValue(data); } }, { key: "save", value: function save(params, success) { var _this3 = this; var _this$props3 = this.props, adapter = _this$props3.adapter, fields = _this$props3.fields; var values = params; values = adapter.forceInjectValuesBeforeSave(values); var msg = adapter.doCustomValidation(values); if (msg !== null) { this.showError(msg); return; } if (adapter.csrfRequired) { values.csrf = $("#".concat(adapter.getTableName(), "Form")).data('csrf'); } var id = adapter.currentElement != null ? adapter.currentElement.id : null; if (id != null && id !== '') { values.id = id; } values = this.formFieldsToData(values, fields); adapter.add(values, [], function () { return adapter.get([]); }, function () { _this3.formReference.current.resetFields(); _this3.showError(false); success(); }); } }]); return IceForm; }(_react["default"].Component); var _default = IceForm; exports["default"] = _default; },{"./IceColorPick":12,"./IceDataGroup":13,"./IceLabel":16,"./IceSelect":17,"./IceSignature":18,"./IceUpload":22,"antd":"antd","moment":"moment","react":"react"}],15:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); var _IceForm = _interopRequireDefault(require("./IceForm")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var IceFormModal = /*#__PURE__*/function (_React$Component) { _inherits(IceFormModal, _React$Component); var _super = _createSuper(IceFormModal); function IceFormModal(props) { var _this; _classCallCheck(this, IceFormModal); _this = _super.call(this, props); _this.state = { visible: false, viewOnly: false, loading: false }; _this.iceFormReference = _react["default"].createRef(); _this.width = 800; return _this; } _createClass(IceFormModal, [{ key: "setViewOnly", value: function setViewOnly(value) { this.setState({ viewOnly: value }); } }, { key: "show", value: function show(data) { var _this2 = this; this.props.adapter.beforeRenderFieldHook = this.props.adapter.beforeRenderField ? this.props.adapter.beforeRenderField(data) : function (fieldName, field) { return field; }; if (!data) { this.setState({ visible: true }); if (this.iceFormReference.current) { this.iceFormReference.current.resetFields(); } } else { this.setState({ visible: true }); if (this.iceFormReference.current && this.iceFormReference.current.isReady()) { this.iceFormReference.current.updateFields(data); } else { this.waitForIt(function () { return _this2.iceFormReference.current && _this2.iceFormReference.current.isReady(); }, function () { _this2.iceFormReference.current.updateFields(data); }, 1000); } } } }, { key: "waitForIt", value: function waitForIt(condition, callback, time) { var _this3 = this; setTimeout(function () { if (condition()) { callback(); } else { _this3.waitForIt(condition, callback, time); } }, time); } }, { key: "hide", value: function hide() { this.setState({ visible: false }); } }, { key: "save", value: function save(params) { var _this4 = this; this.iceFormReference.current.save(params, function () { _this4.closeModal(); }); } }, { key: "closeModal", value: function closeModal() { this.hide(); this.iceFormReference.current.showError(false); } }, { key: "render", value: function render() { var _this5 = this; var _this$props = this.props, fields = _this$props.fields, adapter = _this$props.adapter, saveCallback = _this$props.saveCallback, cancelCallback = _this$props.cancelCallback; var additionalProps = {}; additionalProps.footer = /*#__PURE__*/_react["default"].createElement(_antd.Row, { gutter: 16 }, /*#__PURE__*/_react["default"].createElement(_antd.Col, { className: "gutter-row", span: 12, style: {} }), /*#__PURE__*/_react["default"].createElement(_antd.Col, { className: "gutter-row", span: 12, style: { textAlign: 'right' } }, /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement(_antd.Button, { onClick: function onClick() { if (cancelCallback) { cancelCallback(); } else { _this5.closeModal(); } } }, this.props.adapter.gt('Cancel')), /*#__PURE__*/_react["default"].createElement(_antd.Button, { loading: this.state.loading, type: "primary", onClick: function onClick() { _this5.setState({ loading: true }); var iceFrom = _this5.iceFormReference.current; iceFrom.validateFields().then(function (values) { if (!iceFrom.isValid()) { _this5.setState({ loading: false }); return; } if (saveCallback) { saveCallback(values, iceFrom.showError.bind(_this5), _this5.closeModal.bind(_this5)); } else { _this5.save(values); } _this5.setState({ loading: false }); })["catch"](function (info) { _this5.setState({ loading: false }); }); } }, this.state.viewOnly ? this.props.adapter.gt('Done') : this.props.adapter.gt('Save'))))); if (this.state.viewOnly) { additionalProps.footer = null; } return /*#__PURE__*/_react["default"].createElement(_antd.Modal, _extends({ visible: this.state.visible, title: this.props.adapter.gt(this.props.title || adapter.objectTypeName), maskClosable: false, width: this.width, onCancel: function onCancel() { if (cancelCallback) { cancelCallback(); } else { _this5.closeModal(); } } }, additionalProps), /*#__PURE__*/_react["default"].createElement(_IceForm["default"], { ref: this.iceFormReference, adapter: adapter, fields: fields, viewOnly: this.state.viewOnly })); } }]); return IceFormModal; }(_react["default"].Component); var _default = IceFormModal; exports["default"] = _default; },{"./IceForm":14,"antd":"antd","react":"react"}],16:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var IceLabel = /*#__PURE__*/function (_React$Component) { _inherits(IceLabel, _React$Component); var _super = _createSuper(IceLabel); function IceLabel(props) { _classCallCheck(this, IceLabel); return _super.call(this, props); } _createClass(IceLabel, [{ key: "render", value: function render() { var value = this.props.value; return /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement("div", { contentEditable: "true", dangerouslySetInnerHTML: { __html: this.nl2br(value || '') } })); } }, { key: "nl2br", value: function nl2br(str) { return "".concat(str).replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '
    '); } }]); return IceLabel; }(_react["default"].Component); var _default = IceLabel; exports["default"] = _default; },{"antd":"antd","react":"react"}],17:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Option = _antd.Select.Option; var IceSelect = /*#__PURE__*/function (_React$Component) { _inherits(IceSelect, _React$Component); var _super = _createSuper(IceSelect); function IceSelect(props) { var _this; _classCallCheck(this, IceSelect); _this = _super.call(this, props); _this.onChange = props.onChange; return _this; } _createClass(IceSelect, [{ key: "render", value: function render() { var options; var _this$props = this.props, field = _this$props.field, adapter = _this$props.adapter; var value = this.props.value; var data = field[1]; if (data['remote-source'] != null) { var key = "".concat(data['remote-source'][0], "_").concat(data['remote-source'][1], "_").concat(data['remote-source'][2]); if (data['remote-source'].length === 4) { key = "".concat(key, "_").concat(data['remote-source'][3]); } options = adapter.fieldMasterData[key]; } else { options = data.source; } var optionData = this.getFormSelectOptionsRemote(options, field, adapter); // value should be an array if multi-select if (data.type === 'select2multi') { try { value = JSON.parse(value); if (value == null) { value = []; } value = value.map(function (item) { return "".concat(item); }); } catch (e) { value = []; } } return /*#__PURE__*/_react["default"].createElement(_antd.Select, { mode: data.type === 'select2multi' ? 'multiple' : undefined, showSearch: true, placeholder: "Select ".concat(data.label), optionFilterProp: "children", filterOption: function filterOption(input, option) { return input != null && option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; }, value: value, options: optionData, allowClear: true, onChange: this.handleChange.bind(this), disabled: this.props.readOnly }); } }, { key: "handleChange", value: function handleChange(value) { var field = this.props.field; var data = field[1]; if (data.type === 'select2multi') { this.onChange(JSON.stringify(value)); } else { this.onChange(value); } } }, { key: "makeOption", value: function makeOption(option) { return /*#__PURE__*/_react["default"].createElement(Option, { key: "".concat(option[0]), value: "".concat(option[0]) }, option[1]); } }, { key: "getFormSelectOptionsRemote", value: function getFormSelectOptionsRemote(options, field, adapter) { var optionData = []; if (Array.isArray(options)) { for (var i = 0; i < options.length; i++) { optionData.push({ label: options[i][1], value: options[i][0] }); } } else { for (var key in options) { optionData.push({ label: options[key], value: key }); } } // if (field[1].sort === 'true') { // tuples.sort((a, b) => { // a = a[1]; // b = b[1]; // // // eslint-disable-next-line no-nested-ternary // return a < b ? -1 : (a > b ? 1 : 0); // }); // } // for (let i = 0; i < tuples.length; i++) { // const prop = tuples[i][0]; // const value = tuples[i][1]; // optionData.push([prop, adapter.gt(value)]); // } return optionData; } }]); return IceSelect; }(_react["default"].Component); var _default = IceSelect; exports["default"] = _default; },{"antd":"antd","react":"react"}],18:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _reactSignatureCanvas = _interopRequireDefault(require("react-signature-canvas")); var _antd = require("antd"); var _icons = require("@ant-design/icons"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var IceSignature = /*#__PURE__*/function (_React$Component) { _inherits(IceSignature, _React$Component); var _super = _createSuper(IceSignature); function IceSignature(props) { var _this; _classCallCheck(this, IceSignature); _this = _super.call(this, props); _this.onChange = props.onChange; _this.state = { visible: false }; _this.signature = _react["default"].createRef(); return _this; } _createClass(IceSignature, [{ key: "componentDidMount", value: function componentDidMount() {} }, { key: "show", value: function show() { this.setState({ visible: true }); } }, { key: "setSignature", value: function setSignature(ref) { if (ref == null) { return; } var value = this.props.value; if (value != null && value.length > 10) { ref.fromDataURL(value); } } }, { key: "hide", value: function hide() { this.setState({ visible: false }); } }, { key: "clear", value: function clear() { this.signature.clear(); } }, { key: "save", value: function save() { var data = this.signature.toDataURL('image/png'); this.onChange(data); this.setState({ visible: false }); } }, { key: "render", value: function render() { var _this2 = this; var readOnly = this.props.readOnly; return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_antd.Modal, { visible: this.state.visible, title: "Signature", maskClosable: false, centered: true, width: 300, onCancel: function onCancel() { _this2.hide(); }, footer: [/*#__PURE__*/_react["default"].createElement(_antd.Button, { key: "cancel", onClick: function onClick() { _this2.hide(); } }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_antd.Button, { key: "clear", disabled: readOnly, type: "dashed", onClick: function onClick() { if (!readOnly) { _this2.clear(); } } }, "Clear"), /*#__PURE__*/_react["default"].createElement(_antd.Button, { key: "ok", disabled: readOnly, type: "primary", onClick: function onClick() { if (!readOnly) { _this2.save(); } } }, "Submit")] }, /*#__PURE__*/_react["default"].createElement(_reactSignatureCanvas["default"], { ref: function ref(_ref) { _this2.signature = _ref; _this2.setSignature(_ref); }, canvasProps: _objectSpread({ width: 250, height: 200, className: 'sigCanvas' }, readOnly ? { readOnly: readOnly } : {}) })), /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "blue", style: { cursor: 'pointer' }, onClick: function onClick() { _this2.show(); } }, /*#__PURE__*/_react["default"].createElement(_icons.VerifiedOutlined, null), ' ', "Sign")); } }]); return IceSignature; }(_react["default"].Component); var _default = IceSignature; exports["default"] = _default; },{"@ant-design/icons":"@ant-design/icons","antd":"antd","react":"react","react-signature-canvas":296}],19:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); var _IceForm2 = _interopRequireDefault(require("./IceForm")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Step = _antd.Steps.Step; var IceStepForm = /*#__PURE__*/function (_IceForm) { _inherits(IceStepForm, _IceForm); var _super = _createSuper(IceStepForm); function IceStepForm(props) { var _this; _classCallCheck(this, IceStepForm); _this = _super.call(this, props); _this.onChange = props.onChange; var steps = _this.props.fields.map(function (item) { return _objectSpread({}, item, { ref: _react["default"].createRef() }); }); steps = steps.map(function (item) { var ref = item.ref, fields = item.fields; item.content = /*#__PURE__*/_react["default"].createElement(_IceForm2["default"], { ref: ref, adapter: props.adapter, fields: fields, twoColumnLayout: props.twoColumnLayout, width: props.width, layout: props.layout || 'horizontal' }); return item; }); _this.state = { current: 0, steps: steps, loading: false }; return _this; } _createClass(IceStepForm, [{ key: "moveToStep", value: function moveToStep(current) { this.setState({ current: current }); } }, { key: "next", value: function next() { if (this.validateFields(false) === false) { return; } this.showError(false); var current = this.state.current + 1; this.setState({ current: current }); } }, { key: "prev", value: function prev() { var current = this.state.current - 1; if (current < 0) { return; } this.setState({ current: current }); } }, { key: "render", value: function render() { var _this2 = this; var adapter = this.props.adapter; var _this$state = this.state, current = _this$state.current, steps = _this$state.steps; return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_antd.Steps, { current: current }, steps.map(function (item, index) { return /*#__PURE__*/_react["default"].createElement(Step, { key: item.title, title: item.title, onClick: function onClick() { return _this2.moveToStep(index); } }); })), /*#__PURE__*/_react["default"].createElement(_antd.Divider, null), /*#__PURE__*/_react["default"].createElement("div", { className: "steps-content" }, steps.map(function (item, index) { return /*#__PURE__*/_react["default"].createElement("div", { style: { display: index === current ? 'block' : 'none' } }, item.content); })), /*#__PURE__*/_react["default"].createElement(_antd.Divider, null), /*#__PURE__*/_react["default"].createElement("div", { className: "steps-action" }, /*#__PURE__*/_react["default"].createElement(_antd.Row, { gutter: 16 }, /*#__PURE__*/_react["default"].createElement(_antd.Col, { className: "gutter-row", span: 12, style: {} }, /*#__PURE__*/_react["default"].createElement(_antd.Space, null, current < steps.length - 1 && /*#__PURE__*/_react["default"].createElement(_antd.Button, { type: "primary", onClick: function onClick() { return _this2.next(); } }, adapter.gt('Next')), current > 0 && /*#__PURE__*/_react["default"].createElement(_antd.Button, { onClick: function onClick() { return _this2.prev(); } }, adapter.gt('Previous')))), /*#__PURE__*/_react["default"].createElement(_antd.Col, { className: "gutter-row", span: 12, style: { textAlign: 'right' } }, /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement(_antd.Button, { onClick: function onClick() { return _this2.props.closeModal(); } }, adapter.gt('Cancel')), /*#__PURE__*/_react["default"].createElement(_antd.Button, { type: "primary", loading: this.state.loading, onClick: function onClick() { return _this2.saveData(); } }, adapter.gt('Save'))))))); } }, { key: "saveData", value: function () { var _saveData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { var _this3 = this; var data; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: this.setState({ loading: true }); _context.next = 3; return this.validateFields(true); case 3: data = _context.sent; if (data) { this.save(data, function () { return _this3.props.closeModal(); }); } this.setState({ loading: false }); case 6: case "end": return _context.stop(); } } }, _callee, this); })); function saveData() { return _saveData.apply(this, arguments); } return saveData; }() }, { key: "save", value: function save(params, success) { var _this4 = this; var adapter = this.props.adapter; adapter.add(params, [], function () { return adapter.get([]); }, function () { _this4.resetFields(); _this4.showError(false); success(); }); } }, { key: "updateFields", value: function updateFields(data) { var _this5 = this; this.state.steps.forEach(function (item) { var subData = {}; item.fields.forEach(function (_ref) { var _ref2 = _slicedToArray(_ref, 1), key = _ref2[0]; subData[key] = data[key]; }); _this5.updateFieldsSubForm(item.ref, item.fields, subData); }); } }, { key: "updateFieldsSubForm", value: function updateFieldsSubForm(ref, fields, data) { data = this.dataToFormFields(data, fields); ref.current.resetFields(); if (data == null) { return; } try { ref.current.setFieldsValue(data); } catch (e) { console.log(e); } } }, { key: "validateFields", value: function () { var _validateFields = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(all) { var adapter, steps, promiseList, allData, failedIndex, values, msg, id, fields; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: adapter = this.props.adapter; steps = all ? this.state.steps : this.state.steps.slice(0, this.state.current + 1); promiseList = steps.map(function (item) { return item.ref.current.validateFields().then(function (values) { if (!item.ref.current.isValid()) { return false; } return values; })["catch"](function () { return false; }); }); _context2.next = 5; return Promise.all(promiseList); case 5: allData = _context2.sent; failedIndex = allData.findIndex(function (item) { return item === false; }); if (!(failedIndex >= 0)) { _context2.next = 10; break; } this.setState({ current: failedIndex }); return _context2.abrupt("return", false); case 10: values = Object.assign.apply(Object, [{}].concat(_toConsumableArray(allData))); values = adapter.forceInjectValuesBeforeSave(values); msg = adapter.doCustomValidation(values); if (!(msg !== null)) { _context2.next = 16; break; } this.showError(msg); return _context2.abrupt("return", false); case 16: if (adapter.csrfRequired) { values.csrf = $("#".concat(adapter.getTableName(), "Form")).data('csrf'); } id = adapter.currentElement != null ? adapter.currentElement.id : null; if (id != null && id !== '') { values.id = id; } fields = [].concat.apply([], this.state.steps.map(function (item) { return item.fields; })); return _context2.abrupt("return", this.formFieldsToData(values, fields)); case 21: case "end": return _context2.stop(); } } }, _callee2, this); })); function validateFields(_x) { return _validateFields.apply(this, arguments); } return validateFields; }() }, { key: "getSubFormData", value: function getSubFormData(ref, fields, params) { var adapter = this.props.adapter; var values = params; values = adapter.forceInjectValuesBeforeSave(values); var msg = adapter.doCustomValidation(values); if (msg !== null) { ref.current.showError(msg); return; } if (adapter.csrfRequired) { values.csrf = $("#".concat(adapter.getTableName(), "Form")).data('csrf'); } var id = adapter.currentElement != null ? adapter.currentElement.id : null; if (id != null && id !== '') { values.id = id; } return this.formFieldsToData(values, fields); } }, { key: "showError", value: function showError(errorMsg) { this.state.steps.forEach(function (item) { return item.ref.current.showError(errorMsg); }); } }, { key: "resetFields", value: function resetFields() { this.state.steps.forEach(function (item) { return item.ref.current.resetFields(); }); } }, { key: "hideError", value: function hideError() { this.state.steps.forEach(function (item) { return item.ref.current.hideError(); }); } }, { key: "isReady", value: function isReady() { return this.state.steps.reduce(function (acc, item) { return acc && item.ref.current != null; }, true); } }]); return IceStepForm; }(_IceForm2["default"]); var _default = IceStepForm; exports["default"] = _default; },{"./IceForm":14,"antd":"antd","react":"react"}],20:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); var _IceFormModal2 = _interopRequireDefault(require("./IceFormModal")); var _IceStepForm = _interopRequireDefault(require("./IceStepForm")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var IceStepFormModal = /*#__PURE__*/function (_IceFormModal) { _inherits(IceStepFormModal, _IceFormModal); var _super = _createSuper(IceStepFormModal); function IceStepFormModal(props) { var _this; _classCallCheck(this, IceStepFormModal); _this = _super.call(this, props); _this.width = 850; return _this; } _createClass(IceStepFormModal, [{ key: "show", value: function show(data) { var _this2 = this; this.props.adapter.beforeRenderFieldHook = this.props.adapter.beforeRenderField ? this.props.adapter.beforeRenderField(data) : function (fieldName, field) { return field; }; if (!data) { this.setState({ visible: true }); if (this.iceFormReference.current) { this.iceFormReference.current.resetFields(); } } else { this.setState({ visible: true }); if (this.iceFormReference.current && this.iceFormReference.current.isReady()) { this.iceFormReference.current.moveToStep(0); this.iceFormReference.current.updateFields(data); } else { this.waitForIt(function () { return _this2.iceFormReference.current && _this2.iceFormReference.current.isReady(); }, function () { _this2.iceFormReference.current.updateFields(data); _this2.iceFormReference.current.moveToStep(0); }, 1000); } } } }, { key: "hide", value: function hide() { this.iceFormReference.current.moveToStep(0); this.setState({ visible: false }); } }, { key: "render", value: function render() { var _this3 = this; var _this$props = this.props, fields = _this$props.fields, adapter = _this$props.adapter; var _this$props$adapter$g = this.props.adapter.getFormOptions(), width = _this$props$adapter$g.width, twoColumnLayout = _this$props$adapter$g.twoColumnLayout, layout = _this$props$adapter$g.layout; return /*#__PURE__*/_react["default"].createElement(_antd.Modal, { visible: this.state.visible, title: this.props.adapter.gt(this.props.title || adapter.objectTypeName), maskClosable: false, width: width || this.width, footer: [], onCancel: function onCancel() { _this3.closeModal(); } }, /*#__PURE__*/_react["default"].createElement(_IceStepForm["default"], { ref: this.iceFormReference, adapter: adapter, fields: fields, closeModal: function closeModal() { _this3.closeModal(); }, twoColumnLayout: twoColumnLayout || false, layout: layout })); } }]); return IceStepFormModal; }(_IceFormModal2["default"]); var _default = IceStepFormModal; exports["default"] = _default; },{"./IceFormModal":15,"./IceStepForm":19,"antd":"antd","react":"react"}],21:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireWildcard(require("react")); var _antd = require("antd"); var _icons = require("@ant-design/icons"); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Search = _antd.Input.Search; var IceTable = /*#__PURE__*/function (_React$Component) { _inherits(IceTable, _React$Component); var _super = _createSuper(IceTable); function IceTable(props) { var _this; _classCallCheck(this, IceTable); _this = _super.call(this, props); _this.state = { data: [], pagination: {}, loading: true, fetchConfig: false, //filter: null, showLoading: true, currentElement: null, fetchCompleted: false }; _this.handleTableChange = function (pagination, filters, sorter) { var pager = _objectSpread({}, _this.state.pagination); var search = _this.state.search; pager.current = pagination.current; _this.setState({ pagination: pager }); var fetchConfig = { limit: pagination.pageSize, page: pagination.current, sortField: sorter.field, sortOrder: sorter.order, filters: JSON.stringify(filters), search: search }; _this.setState({ fetchConfig: fetchConfig }); _this.fetch(fetchConfig); }; _this.reload = function () { var fetchConfig = _this.state.fetchConfig; if (fetchConfig) { _this.fetch(fetchConfig); } }; _this.search = function (value) { _this.setState({ search: value }); var fetchConfig = _this.state.fetchConfig; console.log(fetchConfig); if (fetchConfig) { fetchConfig.search = value; _this.setState({ fetchConfig: fetchConfig }); _this.fetch(fetchConfig); } }; _this.addNew = function () { _this.props.adapter.renderForm(); }; _this.showFilters = function () { _this.props.adapter.showFilters(); }; _this.setFilterData = function (filter) { _this.setState({ filter: filter }); }; _this.setCurrentElement = function (currentElement) { _this.setState({ currentElement: currentElement }); }; _this.fetch = function () { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; //this.setState({ loading: this.state.showLoading }); _this.setState({ loading: true }); //const hideMessage = message.loading({ content: 'Loading Latest Data ...', key: 'loadingTable', duration: 1}); var pagination = _objectSpread({}, _this.state.pagination); if (_this.props.adapter.localStorageEnabled) { try { var cachedResponse = _this.props.reader.getCachedResponse(params); if (cachedResponse.items) { _this.setState({ loading: false, data: cachedResponse.items, pagination: pagination, showLoading: false }); } else { _this.props.reader.clearCachedResponse(params); } } catch (e) { _this.props.reader.clearCachedResponse(params); } } _this.props.reader.get(params).then(function (data) { // Read total count from server // pagination.total = data.totalCount; pagination.total = data.total; //hideMessage(); // setTimeout( // () => message.success({ content: 'Loading Completed!', key: 'loadingSuccess', duration: 1 }), // 600 // ); _this.setState({ loading: false, data: data.items, pagination: pagination, showLoading: false, fetchCompleted: true }); }); }; return _this; } _createClass(IceTable, [{ key: "componentDidMount", value: function componentDidMount() { var fetchConfig = { page: 1 }; _antd.message.config({ top: 40 }); this.setState({ fetchConfig: fetchConfig, //filter: this.props.adapter.filter, pagination: { 'pageSize': this.props.reader.pageSize } }); //this.fetch(fetchConfig); } }, { key: "setLoading", value: function setLoading(value) { this.setState({ loading: value }); } }, { key: "getChildrenWithProps", value: function getChildrenWithProps(element) { var _this2 = this; var childrenWithProps = _react["default"].Children.map(this.props.children, function (child) { // checking isValidElement is the safe way and avoids a typescript error too var props = { element: element, adapter: _this2.props.adapter, loading: _this2.state.loading }; if (_react["default"].isValidElement(child)) { return _react["default"].cloneElement(child, props); } return child; }); return childrenWithProps; } }, { key: "render", value: function render() { var _this3 = this; return /*#__PURE__*/_react["default"].createElement(_antd.Row, { direction: "vertical", style: { width: '100%' } }, !this.state.currentElement && /*#__PURE__*/_react["default"].createElement(_antd.Col, { span: 24 }, /*#__PURE__*/_react["default"].createElement(_antd.Row, { gutter: 24 }, /*#__PURE__*/_react["default"].createElement(_antd.Col, { span: 18 }, /*#__PURE__*/_react["default"].createElement(_antd.Space, null, this.props.adapter.hasAccess('save') && this.props.adapter.getShowAddNew() && /*#__PURE__*/_react["default"].createElement(_antd.Button, { type: "primary", onClick: this.addNew }, /*#__PURE__*/_react["default"].createElement(_icons.PlusCircleOutlined, null), " Add New"), this.props.adapter.getFilters() && /*#__PURE__*/_react["default"].createElement(_antd.Button, { onClick: this.showFilters }, /*#__PURE__*/_react["default"].createElement(_icons.FilterOutlined, null), " Filters"), this.state.fetchCompleted && this.props.adapter.getFilters() && this.props.adapter.filter != null && this.props.adapter.filter !== [] && this.props.adapter.filter !== '' && this.props.adapter.getFilterString(this.props.adapter.filter) !== '' && /*#__PURE__*/_react["default"].createElement(_antd.Tag, { closable: true, style: { 'lineHeight': '30px' }, color: "blue", onClose: function onClose() { return _this3.props.adapter.resetFilters(); }, visible: this.props.adapter.filter != null && this.props.adapter.filter !== [] && this.props.adapter.filter !== '' }, this.props.adapter.getFilterString(this.props.adapter.filter)))), /*#__PURE__*/_react["default"].createElement(_antd.Col, { span: 6 }, /*#__PURE__*/_react["default"].createElement(_antd.Form, { ref: function ref(formRef) { return _this3.form = formRef; }, name: "advanced_search", className: "ant-advanced-search-form" }, /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, { name: "searchTerm", label: "", rules: [{ required: false }] }, /*#__PURE__*/_react["default"].createElement(Search, { placeholder: "input search text", enterButton: "Search", onSearch: function onSearch(value) { return _this3.search(value); } }))))), /*#__PURE__*/_react["default"].createElement(_antd.Row, { gutter: 24 }, /*#__PURE__*/_react["default"].createElement(_antd.Col, { span: 24 }, /*#__PURE__*/_react["default"].createElement(_antd.Table // bordered , { rowClassName: function rowClassName(record, index) { return index % 2 === 0 ? 'table-row-light' : 'table-row-dark'; }, columns: this.props.columns, rowKey: function rowKey(record) { return record.id; }, dataSource: this.state.data, pagination: this.state.pagination, loading: this.state.loading, onChange: this.handleTableChange, reader: this.props.dataPipe })))), this.state.currentElement && this.getChildrenWithProps(this.state.currentElement)); } }]); return IceTable; }(_react["default"].Component); var _default = IceTable; exports["default"] = _default; },{"@ant-design/icons":"@ant-design/icons","antd":"antd","react":"react"}],22:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _antd = require("antd"); var _icons = require("@ant-design/icons"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var IceUpload = /*#__PURE__*/function (_React$Component) { _inherits(IceUpload, _React$Component); var _super = _createSuper(IceUpload); function IceUpload(props) { var _this; _classCallCheck(this, IceUpload); _this = _super.call(this, props); _this.state = { fileList: [], uploaded: false }; _this._isMounted = false; _this.handleDelete = function () { _this.setState({ fileList: [], value: null, uploaded: false }); _this.onChange(null); }; _this.handleView = function () { var currentValue = _this.props.value; if (_this.state.value != null && _this.state.value !== '') { currentValue = _this.state.value; } if (currentValue == null || currentValue === '') { _antd.message.error('File not found'); return; } var adapter = _this.props.adapter; adapter.getFile(currentValue).then(function (data) { var file = { key: data.uid, uid: data.uid, name: data.name, status: data.status, url: data.filename }; window.open(file.url); })["catch"](function (e) {}); }; _this.handleChange = function (info) { var fileList = _toConsumableArray(info.fileList); if (fileList.length === 0) { _this.setState({ value: null }); _this.onChange(null); _this.setState({ fileList: [] }); _this.setState({ uploaded: false }); return; } fileList = fileList.slice(-1); if (fileList[0].response && fileList[0].response.status === 'error') { _this.setState({ value: null }); _this.onChange(null); _this.setState({ fileList: [] }); _this.setState({ uploaded: false }); _antd.message.error("Error: ".concat(fileList[0].response.message)); return; } fileList = fileList.map(function (file) { if (file.response) { // Component will show file.url as link file.name = file.response.name; file.url = file.response.url; } return file; }); _this.setState({ fileList: fileList }); _this.setState({ value: _this.getFileName(fileList), uploaded: true }); _this.onChange(_this.getFileName(fileList)); }; _this.onChange = props.onChange; return _this; } _createClass(IceUpload, [{ key: "componentDidMount", value: function componentDidMount() { this._isMounted = true; _antd.message.config({ top: 55, duration: 2 }); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this._isMounted = false; } }, { key: "getFileName", value: function getFileName(fileList) { var file = null; if (fileList) { file = fileList[0]; } return file ? file.name : ''; } }, { key: "generateRandom", value: function generateRandom(length) { var d = new Date(); var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var result = ''; for (var i = length; i > 0; --i) { result += chars[Math.round(Math.random() * (chars.length - 1))]; } return result + d.getTime(); } }, { key: "render", value: function render() { var fileName = this.generateRandom(14); var props = { action: "".concat(window.CLIENT_BASE_URL, "fileupload-new.php?user=").concat(this.props.user, "&file_group=").concat(this.props.fileGroup, "&file_name=").concat(fileName), onChange: this.handleChange, onRemove: this.handleDelete, multiple: false, listType: 'picture' }; return /*#__PURE__*/_react["default"].createElement(_antd.Space, { direction: 'vertical' }, !this.props.readOnly && /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement(_antd.Upload, _extends({}, props, { fileList: this.state.fileList }), /*#__PURE__*/_react["default"].createElement(_antd.Tag, { color: "blue", style: { cursor: 'pointer' } }, /*#__PURE__*/_react["default"].createElement(_icons.UploadOutlined, null), ' ', "Upload"))), /*#__PURE__*/_react["default"].createElement(_antd.Space, null, (this.props.value != null && this.props.value !== '' || this.state.value != null && this.state.value !== '') && !this.state.uploaded && /*#__PURE__*/_react["default"].createElement(_antd.Button, { type: "link", htmlType: "button", onClick: this.handleView }, /*#__PURE__*/_react["default"].createElement(_icons.DownloadOutlined, null), " View File"), (this.props.value != null && this.props.value !== '' || this.state.value != null && this.state.value !== '') && !this.state.uploaded && !this.props.readOnly && /*#__PURE__*/_react["default"].createElement(_antd.Button, { type: "link", htmlType: "button", danger: true, onClick: this.handleDelete }, /*#__PURE__*/_react["default"].createElement(_icons.DeleteOutlined, null), " Delete"))); } }]); return IceUpload; }(_react["default"].Component); var _default = IceUpload; exports["default"] = _default; },{"@ant-design/icons":"@ant-design/icons","antd":"antd","react":"react"}],23:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var DEFAULT_SIZE = 24; exports.default = function (_ref) { var _ref$fill = _ref.fill, fill = _ref$fill === undefined ? 'currentColor' : _ref$fill, _ref$width = _ref.width, width = _ref$width === undefined ? DEFAULT_SIZE : _ref$width, _ref$height = _ref.height, height = _ref$height === undefined ? DEFAULT_SIZE : _ref$height, _ref$style = _ref.style, style = _ref$style === undefined ? {} : _ref$style, props = _objectWithoutProperties(_ref, ['fill', 'width', 'height', 'style']); return _react2.default.createElement( 'svg', _extends({ viewBox: '0 0 ' + DEFAULT_SIZE + ' ' + DEFAULT_SIZE, style: _extends({ fill: fill, width: width, height: height }, style) }, props), _react2.default.createElement('path', { d: 'M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z' }) ); }; },{"react":"react"}],24:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var DEFAULT_SIZE = 24; exports.default = function (_ref) { var _ref$fill = _ref.fill, fill = _ref$fill === undefined ? 'currentColor' : _ref$fill, _ref$width = _ref.width, width = _ref$width === undefined ? DEFAULT_SIZE : _ref$width, _ref$height = _ref.height, height = _ref$height === undefined ? DEFAULT_SIZE : _ref$height, _ref$style = _ref.style, style = _ref$style === undefined ? {} : _ref$style, props = _objectWithoutProperties(_ref, ['fill', 'width', 'height', 'style']); return _react2.default.createElement( 'svg', _extends({ viewBox: '0 0 ' + DEFAULT_SIZE + ' ' + DEFAULT_SIZE, style: _extends({ fill: fill, width: width, height: height }, style) }, props), _react2.default.createElement('path', { d: 'M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z' }) ); }; },{"react":"react"}],25:[function(require,module,exports){ module.exports = require('./lib/axios'); },{"./lib/axios":27}],26:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); var settle = require('./../core/settle'); var cookies = require('./../helpers/cookies'); var buildURL = require('./../helpers/buildURL'); var buildFullPath = require('../core/buildFullPath'); var parseHeaders = require('./../helpers/parseHeaders'); var isURLSameOrigin = require('./../helpers/isURLSameOrigin'); var createError = require('../core/createError'); module.exports = function xhrAdapter(config) { return new Promise(function dispatchXhrRequest(resolve, reject) { var requestData = config.data; var requestHeaders = config.headers; if (utils.isFormData(requestData)) { delete requestHeaders['Content-Type']; // Let the browser set it } if ( (utils.isBlob(requestData) || utils.isFile(requestData)) && requestData.type ) { delete requestHeaders['Content-Type']; // Let the browser set it } var request = new XMLHttpRequest(); // HTTP basic authentication if (config.auth) { var username = config.auth.username || ''; var password = unescape(encodeURIComponent(config.auth.password)) || ''; requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } var fullPath = buildFullPath(config.baseURL, config.url); request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); // Set the request timeout in MS request.timeout = config.timeout; // Listen for ready state request.onreadystatechange = function handleLoad() { if (!request || request.readyState !== 4) { return; } // The request errored out and we didn't get a response, this will be // handled by onerror instead // With one exception: request that using file: protocol, most browsers // will return status as 0 even though it's a successful request if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { return; } // Prepare the response var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; var response = { data: responseData, status: request.status, statusText: request.statusText, headers: responseHeaders, config: config, request: request }; settle(resolve, reject, response); // Clean up request request = null; }; // Handle browser request cancellation (as opposed to a manual cancellation) request.onabort = function handleAbort() { if (!request) { return; } reject(createError('Request aborted', config, 'ECONNABORTED', request)); // Clean up request request = null; }; // Handle low level network errors request.onerror = function handleError() { // Real errors are hidden from us by the browser // onerror should only fire if it's a network error reject(createError('Network Error', config, null, request)); // Clean up request request = null; }; // Handle timeout request.ontimeout = function handleTimeout() { var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; if (config.timeoutErrorMessage) { timeoutErrorMessage = config.timeoutErrorMessage; } reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', request)); // Clean up request request = null; }; // Add xsrf header // This is only done if running in a standard browser environment. // Specifically not if we're in a web worker, or react-native. if (utils.isStandardBrowserEnv()) { // Add xsrf header var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : undefined; if (xsrfValue) { requestHeaders[config.xsrfHeaderName] = xsrfValue; } } // Add headers to the request if ('setRequestHeader' in request) { utils.forEach(requestHeaders, function setRequestHeader(val, key) { if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { // Remove Content-Type if data is undefined delete requestHeaders[key]; } else { // Otherwise add header to the request request.setRequestHeader(key, val); } }); } // Add withCredentials to request if needed if (!utils.isUndefined(config.withCredentials)) { request.withCredentials = !!config.withCredentials; } // Add responseType to request if needed if (config.responseType) { try { request.responseType = config.responseType; } catch (e) { // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. if (config.responseType !== 'json') { throw e; } } } // Handle progress if needed if (typeof config.onDownloadProgress === 'function') { request.addEventListener('progress', config.onDownloadProgress); } // Not all browsers support upload events if (typeof config.onUploadProgress === 'function' && request.upload) { request.upload.addEventListener('progress', config.onUploadProgress); } if (config.cancelToken) { // Handle cancellation config.cancelToken.promise.then(function onCanceled(cancel) { if (!request) { return; } request.abort(); reject(cancel); // Clean up request request = null; }); } if (!requestData) { requestData = null; } // Send the request request.send(requestData); }); }; },{"../core/buildFullPath":33,"../core/createError":34,"./../core/settle":38,"./../helpers/buildURL":42,"./../helpers/cookies":44,"./../helpers/isURLSameOrigin":46,"./../helpers/parseHeaders":48,"./../utils":50}],27:[function(require,module,exports){ 'use strict'; var utils = require('./utils'); var bind = require('./helpers/bind'); var Axios = require('./core/Axios'); var mergeConfig = require('./core/mergeConfig'); var defaults = require('./defaults'); /** * Create an instance of Axios * * @param {Object} defaultConfig The default config for the instance * @return {Axios} A new instance of Axios */ function createInstance(defaultConfig) { var context = new Axios(defaultConfig); var instance = bind(Axios.prototype.request, context); // Copy axios.prototype to instance utils.extend(instance, Axios.prototype, context); // Copy context to instance utils.extend(instance, context); return instance; } // Create the default instance to be exported var axios = createInstance(defaults); // Expose Axios class to allow class inheritance axios.Axios = Axios; // Factory for creating new instances axios.create = function create(instanceConfig) { return createInstance(mergeConfig(axios.defaults, instanceConfig)); }; // Expose Cancel & CancelToken axios.Cancel = require('./cancel/Cancel'); axios.CancelToken = require('./cancel/CancelToken'); axios.isCancel = require('./cancel/isCancel'); // Expose all/spread axios.all = function all(promises) { return Promise.all(promises); }; axios.spread = require('./helpers/spread'); module.exports = axios; // Allow use of default import syntax in TypeScript module.exports.default = axios; },{"./cancel/Cancel":28,"./cancel/CancelToken":29,"./cancel/isCancel":30,"./core/Axios":31,"./core/mergeConfig":37,"./defaults":40,"./helpers/bind":41,"./helpers/spread":49,"./utils":50}],28:[function(require,module,exports){ 'use strict'; /** * A `Cancel` is an object that is thrown when an operation is canceled. * * @class * @param {string=} message The message. */ function Cancel(message) { this.message = message; } Cancel.prototype.toString = function toString() { return 'Cancel' + (this.message ? ': ' + this.message : ''); }; Cancel.prototype.__CANCEL__ = true; module.exports = Cancel; },{}],29:[function(require,module,exports){ 'use strict'; var Cancel = require('./Cancel'); /** * A `CancelToken` is an object that can be used to request cancellation of an operation. * * @class * @param {Function} executor The executor function. */ function CancelToken(executor) { if (typeof executor !== 'function') { throw new TypeError('executor must be a function.'); } var resolvePromise; this.promise = new Promise(function promiseExecutor(resolve) { resolvePromise = resolve; }); var token = this; executor(function cancel(message) { if (token.reason) { // Cancellation has already been requested return; } token.reason = new Cancel(message); resolvePromise(token.reason); }); } /** * Throws a `Cancel` if cancellation has been requested. */ CancelToken.prototype.throwIfRequested = function throwIfRequested() { if (this.reason) { throw this.reason; } }; /** * Returns an object that contains a new `CancelToken` and a function that, when called, * cancels the `CancelToken`. */ CancelToken.source = function source() { var cancel; var token = new CancelToken(function executor(c) { cancel = c; }); return { token: token, cancel: cancel }; }; module.exports = CancelToken; },{"./Cancel":28}],30:[function(require,module,exports){ 'use strict'; module.exports = function isCancel(value) { return !!(value && value.__CANCEL__); }; },{}],31:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); var buildURL = require('../helpers/buildURL'); var InterceptorManager = require('./InterceptorManager'); var dispatchRequest = require('./dispatchRequest'); var mergeConfig = require('./mergeConfig'); /** * Create a new instance of Axios * * @param {Object} instanceConfig The default config for the instance */ function Axios(instanceConfig) { this.defaults = instanceConfig; this.interceptors = { request: new InterceptorManager(), response: new InterceptorManager() }; } /** * Dispatch a request * * @param {Object} config The config specific for this request (merged with this.defaults) */ Axios.prototype.request = function request(config) { /*eslint no-param-reassign:0*/ // Allow for axios('example/url'[, config]) a la fetch API if (typeof config === 'string') { config = arguments[1] || {}; config.url = arguments[0]; } else { config = config || {}; } config = mergeConfig(this.defaults, config); // Set config.method if (config.method) { config.method = config.method.toLowerCase(); } else if (this.defaults.method) { config.method = this.defaults.method.toLowerCase(); } else { config.method = 'get'; } // Hook up interceptors middleware var chain = [dispatchRequest, undefined]; var promise = Promise.resolve(config); this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { chain.unshift(interceptor.fulfilled, interceptor.rejected); }); this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { chain.push(interceptor.fulfilled, interceptor.rejected); }); while (chain.length) { promise = promise.then(chain.shift(), chain.shift()); } return promise; }; Axios.prototype.getUri = function getUri(config) { config = mergeConfig(this.defaults, config); return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); }; // Provide aliases for supported request methods utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, config) { return this.request(mergeConfig(config || {}, { method: method, url: url })); }; }); utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, data, config) { return this.request(mergeConfig(config || {}, { method: method, url: url, data: data })); }; }); module.exports = Axios; },{"../helpers/buildURL":42,"./../utils":50,"./InterceptorManager":32,"./dispatchRequest":35,"./mergeConfig":37}],32:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); function InterceptorManager() { this.handlers = []; } /** * Add a new interceptor to the stack * * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` * * @return {Number} An ID used to remove interceptor later */ InterceptorManager.prototype.use = function use(fulfilled, rejected) { this.handlers.push({ fulfilled: fulfilled, rejected: rejected }); return this.handlers.length - 1; }; /** * Remove an interceptor from the stack * * @param {Number} id The ID that was returned by `use` */ InterceptorManager.prototype.eject = function eject(id) { if (this.handlers[id]) { this.handlers[id] = null; } }; /** * Iterate over all the registered interceptors * * This method is particularly useful for skipping over any * interceptors that may have become `null` calling `eject`. * * @param {Function} fn The function to call for each interceptor */ InterceptorManager.prototype.forEach = function forEach(fn) { utils.forEach(this.handlers, function forEachHandler(h) { if (h !== null) { fn(h); } }); }; module.exports = InterceptorManager; },{"./../utils":50}],33:[function(require,module,exports){ 'use strict'; var isAbsoluteURL = require('../helpers/isAbsoluteURL'); var combineURLs = require('../helpers/combineURLs'); /** * Creates a new URL by combining the baseURL with the requestedURL, * only when the requestedURL is not already an absolute URL. * If the requestURL is absolute, this function returns the requestedURL untouched. * * @param {string} baseURL The base URL * @param {string} requestedURL Absolute or relative URL to combine * @returns {string} The combined full path */ module.exports = function buildFullPath(baseURL, requestedURL) { if (baseURL && !isAbsoluteURL(requestedURL)) { return combineURLs(baseURL, requestedURL); } return requestedURL; }; },{"../helpers/combineURLs":43,"../helpers/isAbsoluteURL":45}],34:[function(require,module,exports){ 'use strict'; var enhanceError = require('./enhanceError'); /** * Create an Error with the specified message, config, error code, request and response. * * @param {string} message The error message. * @param {Object} config The config. * @param {string} [code] The error code (for example, 'ECONNABORTED'). * @param {Object} [request] The request. * @param {Object} [response] The response. * @returns {Error} The created error. */ module.exports = function createError(message, config, code, request, response) { var error = new Error(message); return enhanceError(error, config, code, request, response); }; },{"./enhanceError":36}],35:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); var transformData = require('./transformData'); var isCancel = require('../cancel/isCancel'); var defaults = require('../defaults'); /** * Throws a `Cancel` if cancellation has been requested. */ function throwIfCancellationRequested(config) { if (config.cancelToken) { config.cancelToken.throwIfRequested(); } } /** * Dispatch a request to the server using the configured adapter. * * @param {object} config The config that is to be used for the request * @returns {Promise} The Promise to be fulfilled */ module.exports = function dispatchRequest(config) { throwIfCancellationRequested(config); // Ensure headers exist config.headers = config.headers || {}; // Transform request data config.data = transformData( config.data, config.headers, config.transformRequest ); // Flatten headers config.headers = utils.merge( config.headers.common || {}, config.headers[config.method] || {}, config.headers ); utils.forEach( ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) { delete config.headers[method]; } ); var adapter = config.adapter || defaults.adapter; return adapter(config).then(function onAdapterResolution(response) { throwIfCancellationRequested(config); // Transform response data response.data = transformData( response.data, response.headers, config.transformResponse ); return response; }, function onAdapterRejection(reason) { if (!isCancel(reason)) { throwIfCancellationRequested(config); // Transform response data if (reason && reason.response) { reason.response.data = transformData( reason.response.data, reason.response.headers, config.transformResponse ); } } return Promise.reject(reason); }); }; },{"../cancel/isCancel":30,"../defaults":40,"./../utils":50,"./transformData":39}],36:[function(require,module,exports){ 'use strict'; /** * Update an Error with the specified config, error code, and response. * * @param {Error} error The error to update. * @param {Object} config The config. * @param {string} [code] The error code (for example, 'ECONNABORTED'). * @param {Object} [request] The request. * @param {Object} [response] The response. * @returns {Error} The error. */ module.exports = function enhanceError(error, config, code, request, response) { error.config = config; if (code) { error.code = code; } error.request = request; error.response = response; error.isAxiosError = true; error.toJSON = function toJSON() { return { // Standard message: this.message, name: this.name, // Microsoft description: this.description, number: this.number, // Mozilla fileName: this.fileName, lineNumber: this.lineNumber, columnNumber: this.columnNumber, stack: this.stack, // Axios config: this.config, code: this.code }; }; return error; }; },{}],37:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); /** * Config-specific merge-function which creates a new config-object * by merging two configuration objects together. * * @param {Object} config1 * @param {Object} config2 * @returns {Object} New object resulting from merging config2 to config1 */ module.exports = function mergeConfig(config1, config2) { // eslint-disable-next-line no-param-reassign config2 = config2 || {}; var config = {}; var valueFromConfig2Keys = ['url', 'method', 'data']; var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; var defaultToConfig2Keys = [ 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' ]; var directMergeKeys = ['validateStatus']; function getMergedValue(target, source) { if (utils.isPlainObject(target) && utils.isPlainObject(source)) { return utils.merge(target, source); } else if (utils.isPlainObject(source)) { return utils.merge({}, source); } else if (utils.isArray(source)) { return source.slice(); } return source; } function mergeDeepProperties(prop) { if (!utils.isUndefined(config2[prop])) { config[prop] = getMergedValue(config1[prop], config2[prop]); } else if (!utils.isUndefined(config1[prop])) { config[prop] = getMergedValue(undefined, config1[prop]); } } utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { if (!utils.isUndefined(config2[prop])) { config[prop] = getMergedValue(undefined, config2[prop]); } }); utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { if (!utils.isUndefined(config2[prop])) { config[prop] = getMergedValue(undefined, config2[prop]); } else if (!utils.isUndefined(config1[prop])) { config[prop] = getMergedValue(undefined, config1[prop]); } }); utils.forEach(directMergeKeys, function merge(prop) { if (prop in config2) { config[prop] = getMergedValue(config1[prop], config2[prop]); } else if (prop in config1) { config[prop] = getMergedValue(undefined, config1[prop]); } }); var axiosKeys = valueFromConfig2Keys .concat(mergeDeepPropertiesKeys) .concat(defaultToConfig2Keys) .concat(directMergeKeys); var otherKeys = Object .keys(config1) .concat(Object.keys(config2)) .filter(function filterAxiosKeys(key) { return axiosKeys.indexOf(key) === -1; }); utils.forEach(otherKeys, mergeDeepProperties); return config; }; },{"../utils":50}],38:[function(require,module,exports){ 'use strict'; var createError = require('./createError'); /** * Resolve or reject a Promise based on response status. * * @param {Function} resolve A function that resolves the promise. * @param {Function} reject A function that rejects the promise. * @param {object} response The response. */ module.exports = function settle(resolve, reject, response) { var validateStatus = response.config.validateStatus; if (!response.status || !validateStatus || validateStatus(response.status)) { resolve(response); } else { reject(createError( 'Request failed with status code ' + response.status, response.config, null, response.request, response )); } }; },{"./createError":34}],39:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); /** * Transform the data for a request or a response * * @param {Object|String} data The data to be transformed * @param {Array} headers The headers for the request or response * @param {Array|Function} fns A single function or Array of functions * @returns {*} The resulting transformed data */ module.exports = function transformData(data, headers, fns) { /*eslint no-param-reassign:0*/ utils.forEach(fns, function transform(fn) { data = fn(data, headers); }); return data; }; },{"./../utils":50}],40:[function(require,module,exports){ (function (process){ 'use strict'; var utils = require('./utils'); var normalizeHeaderName = require('./helpers/normalizeHeaderName'); var DEFAULT_CONTENT_TYPE = { 'Content-Type': 'application/x-www-form-urlencoded' }; function setContentTypeIfUnset(headers, value) { if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { headers['Content-Type'] = value; } } function getDefaultAdapter() { var adapter; if (typeof XMLHttpRequest !== 'undefined') { // For browsers use XHR adapter adapter = require('./adapters/xhr'); } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { // For node use HTTP adapter adapter = require('./adapters/http'); } return adapter; } var defaults = { adapter: getDefaultAdapter(), transformRequest: [function transformRequest(data, headers) { normalizeHeaderName(headers, 'Accept'); normalizeHeaderName(headers, 'Content-Type'); if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data) ) { return data; } if (utils.isArrayBufferView(data)) { return data.buffer; } if (utils.isURLSearchParams(data)) { setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); return data.toString(); } if (utils.isObject(data)) { setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); return JSON.stringify(data); } return data; }], transformResponse: [function transformResponse(data) { /*eslint no-param-reassign:0*/ if (typeof data === 'string') { try { data = JSON.parse(data); } catch (e) { /* Ignore */ } } return data; }], /** * A timeout in milliseconds to abort a request. If set to 0 (default) a * timeout is not created. */ timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: function validateStatus(status) { return status >= 200 && status < 300; } }; defaults.headers = { common: { 'Accept': 'application/json, text/plain, */*' } }; utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { defaults.headers[method] = {}; }); utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); }); module.exports = defaults; }).call(this,require('_process')) },{"./adapters/http":26,"./adapters/xhr":26,"./helpers/normalizeHeaderName":47,"./utils":50,"_process":3}],41:[function(require,module,exports){ 'use strict'; module.exports = function bind(fn, thisArg) { return function wrap() { var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } return fn.apply(thisArg, args); }; }; },{}],42:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); function encode(val) { return encodeURIComponent(val). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). replace(/%20/g, '+'). replace(/%5B/gi, '['). replace(/%5D/gi, ']'); } /** * Build a URL by appending params to the end * * @param {string} url The base of the url (e.g., http://www.google.com) * @param {object} [params] The params to be appended * @returns {string} The formatted url */ module.exports = function buildURL(url, params, paramsSerializer) { /*eslint no-param-reassign:0*/ if (!params) { return url; } var serializedParams; if (paramsSerializer) { serializedParams = paramsSerializer(params); } else if (utils.isURLSearchParams(params)) { serializedParams = params.toString(); } else { var parts = []; utils.forEach(params, function serialize(val, key) { if (val === null || typeof val === 'undefined') { return; } if (utils.isArray(val)) { key = key + '[]'; } else { val = [val]; } utils.forEach(val, function parseValue(v) { if (utils.isDate(v)) { v = v.toISOString(); } else if (utils.isObject(v)) { v = JSON.stringify(v); } parts.push(encode(key) + '=' + encode(v)); }); }); serializedParams = parts.join('&'); } if (serializedParams) { var hashmarkIndex = url.indexOf('#'); if (hashmarkIndex !== -1) { url = url.slice(0, hashmarkIndex); } url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; } return url; }; },{"./../utils":50}],43:[function(require,module,exports){ 'use strict'; /** * Creates a new URL by combining the specified URLs * * @param {string} baseURL The base URL * @param {string} relativeURL The relative URL * @returns {string} The combined URL */ module.exports = function combineURLs(baseURL, relativeURL) { return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL; }; },{}],44:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); module.exports = ( utils.isStandardBrowserEnv() ? // Standard browser envs support document.cookie (function standardBrowserEnv() { return { write: function write(name, value, expires, path, domain, secure) { var cookie = []; cookie.push(name + '=' + encodeURIComponent(value)); if (utils.isNumber(expires)) { cookie.push('expires=' + new Date(expires).toGMTString()); } if (utils.isString(path)) { cookie.push('path=' + path); } if (utils.isString(domain)) { cookie.push('domain=' + domain); } if (secure === true) { cookie.push('secure'); } document.cookie = cookie.join('; '); }, read: function read(name) { var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); return (match ? decodeURIComponent(match[3]) : null); }, remove: function remove(name) { this.write(name, '', Date.now() - 86400000); } }; })() : // Non standard browser env (web workers, react-native) lack needed support. (function nonStandardBrowserEnv() { return { write: function write() {}, read: function read() { return null; }, remove: function remove() {} }; })() ); },{"./../utils":50}],45:[function(require,module,exports){ 'use strict'; /** * Determines whether the specified URL is absolute * * @param {string} url The URL to test * @returns {boolean} True if the specified URL is absolute, otherwise false */ module.exports = function isAbsoluteURL(url) { // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed // by any combination of letters, digits, plus, period, or hyphen. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); }; },{}],46:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); module.exports = ( utils.isStandardBrowserEnv() ? // Standard browser envs have full support of the APIs needed to test // whether the request URL is of the same origin as current location. (function standardBrowserEnv() { var msie = /(msie|trident)/i.test(navigator.userAgent); var urlParsingNode = document.createElement('a'); var originURL; /** * Parse a URL to discover it's components * * @param {String} url The URL to be parsed * @returns {Object} */ function resolveURL(url) { var href = url; if (msie) { // IE needs attribute set twice to normalize properties urlParsingNode.setAttribute('href', href); href = urlParsingNode.href; } urlParsingNode.setAttribute('href', href); // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils return { href: urlParsingNode.href, protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', host: urlParsingNode.host, search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', hostname: urlParsingNode.hostname, port: urlParsingNode.port, pathname: (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname }; } originURL = resolveURL(window.location.href); /** * Determine if a URL shares the same origin as the current location * * @param {String} requestURL The URL to test * @returns {boolean} True if URL shares the same origin, otherwise false */ return function isURLSameOrigin(requestURL) { var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; return (parsed.protocol === originURL.protocol && parsed.host === originURL.host); }; })() : // Non standard browser envs (web workers, react-native) lack needed support. (function nonStandardBrowserEnv() { return function isURLSameOrigin() { return true; }; })() ); },{"./../utils":50}],47:[function(require,module,exports){ 'use strict'; var utils = require('../utils'); module.exports = function normalizeHeaderName(headers, normalizedName) { utils.forEach(headers, function processHeader(value, name) { if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { headers[normalizedName] = value; delete headers[name]; } }); }; },{"../utils":50}],48:[function(require,module,exports){ 'use strict'; var utils = require('./../utils'); // Headers whose duplicates are ignored by node // c.f. https://nodejs.org/api/http.html#http_message_headers var ignoreDuplicateOf = [ 'age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent' ]; /** * Parse headers into an object * * ``` * Date: Wed, 27 Aug 2014 08:58:49 GMT * Content-Type: application/json * Connection: keep-alive * Transfer-Encoding: chunked * ``` * * @param {String} headers Headers needing to be parsed * @returns {Object} Headers parsed into an object */ module.exports = function parseHeaders(headers) { var parsed = {}; var key; var val; var i; if (!headers) { return parsed; } utils.forEach(headers.split('\n'), function parser(line) { i = line.indexOf(':'); key = utils.trim(line.substr(0, i)).toLowerCase(); val = utils.trim(line.substr(i + 1)); if (key) { if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { return; } if (key === 'set-cookie') { parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); } else { parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; } } }); return parsed; }; },{"./../utils":50}],49:[function(require,module,exports){ 'use strict'; /** * Syntactic sugar for invoking a function and expanding an array for arguments. * * Common use case would be to use `Function.prototype.apply`. * * ```js * function f(x, y, z) {} * var args = [1, 2, 3]; * f.apply(null, args); * ``` * * With `spread` this example can be re-written. * * ```js * spread(function(x, y, z) {})([1, 2, 3]); * ``` * * @param {Function} callback * @returns {Function} */ module.exports = function spread(callback) { return function wrap(arr) { return callback.apply(null, arr); }; }; },{}],50:[function(require,module,exports){ 'use strict'; var bind = require('./helpers/bind'); /*global toString:true*/ // utils is a library of generic helper functions non-specific to axios var toString = Object.prototype.toString; /** * Determine if a value is an Array * * @param {Object} val The value to test * @returns {boolean} True if value is an Array, otherwise false */ function isArray(val) { return toString.call(val) === '[object Array]'; } /** * Determine if a value is undefined * * @param {Object} val The value to test * @returns {boolean} True if the value is undefined, otherwise false */ function isUndefined(val) { return typeof val === 'undefined'; } /** * Determine if a value is a Buffer * * @param {Object} val The value to test * @returns {boolean} True if value is a Buffer, otherwise false */ function isBuffer(val) { return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); } /** * Determine if a value is an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is an ArrayBuffer, otherwise false */ function isArrayBuffer(val) { return toString.call(val) === '[object ArrayBuffer]'; } /** * Determine if a value is a FormData * * @param {Object} val The value to test * @returns {boolean} True if value is an FormData, otherwise false */ function isFormData(val) { return (typeof FormData !== 'undefined') && (val instanceof FormData); } /** * Determine if a value is a view on an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false */ function isArrayBufferView(val) { var result; if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { result = ArrayBuffer.isView(val); } else { result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); } return result; } /** * Determine if a value is a String * * @param {Object} val The value to test * @returns {boolean} True if value is a String, otherwise false */ function isString(val) { return typeof val === 'string'; } /** * Determine if a value is a Number * * @param {Object} val The value to test * @returns {boolean} True if value is a Number, otherwise false */ function isNumber(val) { return typeof val === 'number'; } /** * Determine if a value is an Object * * @param {Object} val The value to test * @returns {boolean} True if value is an Object, otherwise false */ function isObject(val) { return val !== null && typeof val === 'object'; } /** * Determine if a value is a plain Object * * @param {Object} val The value to test * @return {boolean} True if value is a plain Object, otherwise false */ function isPlainObject(val) { if (toString.call(val) !== '[object Object]') { return false; } var prototype = Object.getPrototypeOf(val); return prototype === null || prototype === Object.prototype; } /** * Determine if a value is a Date * * @param {Object} val The value to test * @returns {boolean} True if value is a Date, otherwise false */ function isDate(val) { return toString.call(val) === '[object Date]'; } /** * Determine if a value is a File * * @param {Object} val The value to test * @returns {boolean} True if value is a File, otherwise false */ function isFile(val) { return toString.call(val) === '[object File]'; } /** * Determine if a value is a Blob * * @param {Object} val The value to test * @returns {boolean} True if value is a Blob, otherwise false */ function isBlob(val) { return toString.call(val) === '[object Blob]'; } /** * Determine if a value is a Function * * @param {Object} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ function isFunction(val) { return toString.call(val) === '[object Function]'; } /** * Determine if a value is a Stream * * @param {Object} val The value to test * @returns {boolean} True if value is a Stream, otherwise false */ function isStream(val) { return isObject(val) && isFunction(val.pipe); } /** * Determine if a value is a URLSearchParams object * * @param {Object} val The value to test * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ function isURLSearchParams(val) { return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; } /** * Trim excess whitespace off the beginning and end of a string * * @param {String} str The String to trim * @returns {String} The String freed of excess whitespace */ function trim(str) { return str.replace(/^\s*/, '').replace(/\s*$/, ''); } /** * Determine if we're running in a standard browser environment * * This allows axios to run in a web worker, and react-native. * Both environments support XMLHttpRequest, but not fully standard globals. * * web workers: * typeof window -> undefined * typeof document -> undefined * * react-native: * navigator.product -> 'ReactNative' * nativescript * navigator.product -> 'NativeScript' or 'NS' */ function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); } /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item */ function forEach(obj, fn) { // Don't bother if no value provided if (obj === null || typeof obj === 'undefined') { return; } // Force an array if not already something iterable if (typeof obj !== 'object') { /*eslint no-param-reassign:0*/ obj = [obj]; } if (isArray(obj)) { // Iterate over array values for (var i = 0, l = obj.length; i < l; i++) { fn.call(null, obj[i], i, obj); } } else { // Iterate over object keys for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn.call(null, obj[key], key, obj); } } } } /** * Accepts varargs expecting each argument to be an object, then * immutably merges the properties of each object and returns result. * * When multiple objects contain the same key the later object in * the arguments list will take precedence. * * Example: * * ```js * var result = merge({foo: 123}, {foo: 456}); * console.log(result.foo); // outputs 456 * ``` * * @param {Object} obj1 Object to merge * @returns {Object} Result of all merge properties */ function merge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { if (isPlainObject(result[key]) && isPlainObject(val)) { result[key] = merge(result[key], val); } else if (isPlainObject(val)) { result[key] = merge({}, val); } else if (isArray(val)) { result[key] = val.slice(); } else { result[key] = val; } } for (var i = 0, l = arguments.length; i < l; i++) { forEach(arguments[i], assignValue); } return result; } /** * Extends object a by mutably adding to it the properties of object b. * * @param {Object} a The object to be extended * @param {Object} b The object to copy properties from * @param {Object} thisArg The object to bind function to * @return {Object} The resulting value of object a */ function extend(a, b, thisArg) { forEach(b, function assignValue(val, key) { if (thisArg && typeof val === 'function') { a[key] = bind(val, thisArg); } else { a[key] = val; } }); return a; } /** * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) * * @param {string} content with BOM * @return {string} content value without BOM */ function stripBOM(content) { if (content.charCodeAt(0) === 0xFEFF) { content = content.slice(1); } return content; } module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, isBuffer: isBuffer, isFormData: isFormData, isArrayBufferView: isArrayBufferView, isString: isString, isNumber: isNumber, isObject: isObject, isPlainObject: isPlainObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, isBlob: isBlob, isFunction: isFunction, isStream: isStream, isURLSearchParams: isURLSearchParams, isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, extend: extend, trim: trim, stripBOM: stripBOM }; },{"./helpers/bind":41}],51:[function(require,module,exports){ var getNative = require('./_getNative'), root = require('./_root'); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'); module.exports = DataView; },{"./_getNative":134,"./_root":177}],52:[function(require,module,exports){ var hashClear = require('./_hashClear'), hashDelete = require('./_hashDelete'), hashGet = require('./_hashGet'), hashHas = require('./_hashHas'), hashSet = require('./_hashSet'); /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; module.exports = Hash; },{"./_hashClear":142,"./_hashDelete":143,"./_hashGet":144,"./_hashHas":145,"./_hashSet":146}],53:[function(require,module,exports){ var listCacheClear = require('./_listCacheClear'), listCacheDelete = require('./_listCacheDelete'), listCacheGet = require('./_listCacheGet'), listCacheHas = require('./_listCacheHas'), listCacheSet = require('./_listCacheSet'); /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; module.exports = ListCache; },{"./_listCacheClear":157,"./_listCacheDelete":158,"./_listCacheGet":159,"./_listCacheHas":160,"./_listCacheSet":161}],54:[function(require,module,exports){ var getNative = require('./_getNative'), root = require('./_root'); /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'); module.exports = Map; },{"./_getNative":134,"./_root":177}],55:[function(require,module,exports){ var mapCacheClear = require('./_mapCacheClear'), mapCacheDelete = require('./_mapCacheDelete'), mapCacheGet = require('./_mapCacheGet'), mapCacheHas = require('./_mapCacheHas'), mapCacheSet = require('./_mapCacheSet'); /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; module.exports = MapCache; },{"./_mapCacheClear":162,"./_mapCacheDelete":163,"./_mapCacheGet":164,"./_mapCacheHas":165,"./_mapCacheSet":166}],56:[function(require,module,exports){ var getNative = require('./_getNative'), root = require('./_root'); /* Built-in method references that are verified to be native. */ var Promise = getNative(root, 'Promise'); module.exports = Promise; },{"./_getNative":134,"./_root":177}],57:[function(require,module,exports){ var getNative = require('./_getNative'), root = require('./_root'); /* Built-in method references that are verified to be native. */ var Set = getNative(root, 'Set'); module.exports = Set; },{"./_getNative":134,"./_root":177}],58:[function(require,module,exports){ var MapCache = require('./_MapCache'), setCacheAdd = require('./_setCacheAdd'), setCacheHas = require('./_setCacheHas'); /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache; while (++index < length) { this.add(values[index]); } } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; module.exports = SetCache; },{"./_MapCache":55,"./_setCacheAdd":179,"./_setCacheHas":180}],59:[function(require,module,exports){ var ListCache = require('./_ListCache'), stackClear = require('./_stackClear'), stackDelete = require('./_stackDelete'), stackGet = require('./_stackGet'), stackHas = require('./_stackHas'), stackSet = require('./_stackSet'); /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; module.exports = Stack; },{"./_ListCache":53,"./_stackClear":184,"./_stackDelete":185,"./_stackGet":186,"./_stackHas":187,"./_stackSet":188}],60:[function(require,module,exports){ var root = require('./_root'); /** Built-in value references. */ var Symbol = root.Symbol; module.exports = Symbol; },{"./_root":177}],61:[function(require,module,exports){ var root = require('./_root'); /** Built-in value references. */ var Uint8Array = root.Uint8Array; module.exports = Uint8Array; },{"./_root":177}],62:[function(require,module,exports){ var getNative = require('./_getNative'), root = require('./_root'); /* Built-in method references that are verified to be native. */ var WeakMap = getNative(root, 'WeakMap'); module.exports = WeakMap; },{"./_getNative":134,"./_root":177}],63:[function(require,module,exports){ /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } module.exports = apply; },{}],64:[function(require,module,exports){ /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } module.exports = arrayEach; },{}],65:[function(require,module,exports){ /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } module.exports = arrayFilter; },{}],66:[function(require,module,exports){ var baseTimes = require('./_baseTimes'), isArguments = require('./isArguments'), isArray = require('./isArray'), isBuffer = require('./isBuffer'), isIndex = require('./_isIndex'), isTypedArray = require('./isTypedArray'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. isIndex(key, length) ))) { result.push(key); } } return result; } module.exports = arrayLikeKeys; },{"./_baseTimes":105,"./_isIndex":150,"./isArguments":202,"./isArray":203,"./isBuffer":206,"./isTypedArray":216}],67:[function(require,module,exports){ /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } module.exports = arrayMap; },{}],68:[function(require,module,exports){ /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } module.exports = arrayPush; },{}],69:[function(require,module,exports){ /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } module.exports = arraySome; },{}],70:[function(require,module,exports){ var baseAssignValue = require('./_baseAssignValue'), eq = require('./eq'); /** * This function is like `assignValue` except that it doesn't assign * `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } module.exports = assignMergeValue; },{"./_baseAssignValue":75,"./eq":196}],71:[function(require,module,exports){ var baseAssignValue = require('./_baseAssignValue'), eq = require('./eq'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } module.exports = assignValue; },{"./_baseAssignValue":75,"./eq":196}],72:[function(require,module,exports){ var eq = require('./eq'); /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } module.exports = assocIndexOf; },{"./eq":196}],73:[function(require,module,exports){ var copyObject = require('./_copyObject'), keys = require('./keys'); /** * The base implementation of `_.assign` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } module.exports = baseAssign; },{"./_copyObject":118,"./keys":218}],74:[function(require,module,exports){ var copyObject = require('./_copyObject'), keysIn = require('./keysIn'); /** * The base implementation of `_.assignIn` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); } module.exports = baseAssignIn; },{"./_copyObject":118,"./keysIn":219}],75:[function(require,module,exports){ var defineProperty = require('./_defineProperty'); /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } module.exports = baseAssignValue; },{"./_defineProperty":125}],76:[function(require,module,exports){ var Stack = require('./_Stack'), arrayEach = require('./_arrayEach'), assignValue = require('./_assignValue'), baseAssign = require('./_baseAssign'), baseAssignIn = require('./_baseAssignIn'), cloneBuffer = require('./_cloneBuffer'), copyArray = require('./_copyArray'), copySymbols = require('./_copySymbols'), copySymbolsIn = require('./_copySymbolsIn'), getAllKeys = require('./_getAllKeys'), getAllKeysIn = require('./_getAllKeysIn'), getTag = require('./_getTag'), initCloneArray = require('./_initCloneArray'), initCloneByTag = require('./_initCloneByTag'), initCloneObject = require('./_initCloneObject'), isArray = require('./isArray'), isBuffer = require('./isBuffer'), isMap = require('./isMap'), isObject = require('./isObject'), isSet = require('./isSet'), keys = require('./keys'), keysIn = require('./keysIn'); /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. * * @private * @param {*} value The value to clone. * @param {boolean} bitmask The bitmask flags. * 1 - Deep clone * 2 - Flatten inherited properties * 4 - Clone symbols * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, bitmask, customizer, key, object, stack) { var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined) { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return copyArray(value, result); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (isBuffer(value)) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result = initCloneByTag(value, tag, isDeep); } } // Check for circular references and return its corresponding clone. stack || (stack = new Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); if (isSet(value)) { value.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); } else if (isMap(value)) { value.forEach(function(subValue, key) { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); } var keysFunc = isFull ? (isFlat ? getAllKeysIn : getAllKeys) : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { if (props) { key = subValue; subValue = value[key]; } // Recursively populate clone (susceptible to call stack limits). assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); return result; } module.exports = baseClone; },{"./_Stack":59,"./_arrayEach":64,"./_assignValue":71,"./_baseAssign":73,"./_baseAssignIn":74,"./_cloneBuffer":112,"./_copyArray":117,"./_copySymbols":119,"./_copySymbolsIn":120,"./_getAllKeys":130,"./_getAllKeysIn":131,"./_getTag":139,"./_initCloneArray":147,"./_initCloneByTag":148,"./_initCloneObject":149,"./isArray":203,"./isBuffer":206,"./isMap":209,"./isObject":210,"./isSet":213,"./keys":218,"./keysIn":219}],77:[function(require,module,exports){ var isObject = require('./isObject'); /** Built-in value references. */ var objectCreate = Object.create; /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} proto The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = (function() { function object() {} return function(proto) { if (!isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object; object.prototype = undefined; return result; }; }()); module.exports = baseCreate; },{"./isObject":210}],78:[function(require,module,exports){ var baseForOwn = require('./_baseForOwn'), createBaseEach = require('./_createBaseEach'); /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); module.exports = baseEach; },{"./_baseForOwn":80,"./_createBaseEach":123}],79:[function(require,module,exports){ var createBaseFor = require('./_createBaseFor'); /** * The base implementation of `baseForOwn` which iterates over `object` * properties returned by `keysFunc` and invokes `iteratee` for each property. * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); module.exports = baseFor; },{"./_createBaseFor":124}],80:[function(require,module,exports){ var baseFor = require('./_baseFor'), keys = require('./keys'); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } module.exports = baseForOwn; },{"./_baseFor":79,"./keys":218}],81:[function(require,module,exports){ var castPath = require('./_castPath'), toKey = require('./_toKey'); /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } module.exports = baseGet; },{"./_castPath":110,"./_toKey":190}],82:[function(require,module,exports){ var arrayPush = require('./_arrayPush'), isArray = require('./isArray'); /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } module.exports = baseGetAllKeys; },{"./_arrayPush":68,"./isArray":203}],83:[function(require,module,exports){ var Symbol = require('./_Symbol'), getRawTag = require('./_getRawTag'), objectToString = require('./_objectToString'); /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } module.exports = baseGetTag; },{"./_Symbol":60,"./_getRawTag":136,"./_objectToString":174}],84:[function(require,module,exports){ /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } module.exports = baseHasIn; },{}],85:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var argsTag = '[object Arguments]'; /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } module.exports = baseIsArguments; },{"./_baseGetTag":83,"./isObjectLike":211}],86:[function(require,module,exports){ var baseIsEqualDeep = require('./_baseIsEqualDeep'), isObjectLike = require('./isObjectLike'); /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {boolean} bitmask The bitmask flags. * 1 - Unordered comparison * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } module.exports = baseIsEqual; },{"./_baseIsEqualDeep":87,"./isObjectLike":211}],87:[function(require,module,exports){ var Stack = require('./_Stack'), equalArrays = require('./_equalArrays'), equalByTag = require('./_equalByTag'), equalObjects = require('./_equalObjects'), getTag = require('./_getTag'), isArray = require('./isArray'), isBuffer = require('./isBuffer'), isTypedArray = require('./isTypedArray'); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', objectTag = '[object Object]'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } module.exports = baseIsEqualDeep; },{"./_Stack":59,"./_equalArrays":126,"./_equalByTag":127,"./_equalObjects":128,"./_getTag":139,"./isArray":203,"./isBuffer":206,"./isTypedArray":216}],88:[function(require,module,exports){ var getTag = require('./_getTag'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var mapTag = '[object Map]'; /** * The base implementation of `_.isMap` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. */ function baseIsMap(value) { return isObjectLike(value) && getTag(value) == mapTag; } module.exports = baseIsMap; },{"./_getTag":139,"./isObjectLike":211}],89:[function(require,module,exports){ var Stack = require('./_Stack'), baseIsEqual = require('./_baseIsEqual'); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack; if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result )) { return false; } } } return true; } module.exports = baseIsMatch; },{"./_Stack":59,"./_baseIsEqual":86}],90:[function(require,module,exports){ var isFunction = require('./isFunction'), isMasked = require('./_isMasked'), isObject = require('./isObject'), toSource = require('./_toSource'); /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } module.exports = baseIsNative; },{"./_isMasked":154,"./_toSource":191,"./isFunction":207,"./isObject":210}],91:[function(require,module,exports){ var getTag = require('./_getTag'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var setTag = '[object Set]'; /** * The base implementation of `_.isSet` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. */ function baseIsSet(value) { return isObjectLike(value) && getTag(value) == setTag; } module.exports = baseIsSet; },{"./_getTag":139,"./isObjectLike":211}],92:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isLength = require('./isLength'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } module.exports = baseIsTypedArray; },{"./_baseGetTag":83,"./isLength":208,"./isObjectLike":211}],93:[function(require,module,exports){ var baseMatches = require('./_baseMatches'), baseMatchesProperty = require('./_baseMatchesProperty'), identity = require('./identity'), isArray = require('./isArray'), property = require('./property'); /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } module.exports = baseIteratee; },{"./_baseMatches":97,"./_baseMatchesProperty":98,"./identity":201,"./isArray":203,"./property":224}],94:[function(require,module,exports){ var isPrototype = require('./_isPrototype'), nativeKeys = require('./_nativeKeys'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } module.exports = baseKeys; },{"./_isPrototype":155,"./_nativeKeys":171}],95:[function(require,module,exports){ var isObject = require('./isObject'), isPrototype = require('./_isPrototype'), nativeKeysIn = require('./_nativeKeysIn'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } module.exports = baseKeysIn; },{"./_isPrototype":155,"./_nativeKeysIn":172,"./isObject":210}],96:[function(require,module,exports){ var baseEach = require('./_baseEach'), isArrayLike = require('./isArrayLike'); /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } module.exports = baseMap; },{"./_baseEach":78,"./isArrayLike":204}],97:[function(require,module,exports){ var baseIsMatch = require('./_baseIsMatch'), getMatchData = require('./_getMatchData'), matchesStrictComparable = require('./_matchesStrictComparable'); /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } module.exports = baseMatches; },{"./_baseIsMatch":89,"./_getMatchData":133,"./_matchesStrictComparable":168}],98:[function(require,module,exports){ var baseIsEqual = require('./_baseIsEqual'), get = require('./get'), hasIn = require('./hasIn'), isKey = require('./_isKey'), isStrictComparable = require('./_isStrictComparable'), matchesStrictComparable = require('./_matchesStrictComparable'), toKey = require('./_toKey'); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } module.exports = baseMatchesProperty; },{"./_baseIsEqual":86,"./_isKey":152,"./_isStrictComparable":156,"./_matchesStrictComparable":168,"./_toKey":190,"./get":199,"./hasIn":200}],99:[function(require,module,exports){ var Stack = require('./_Stack'), assignMergeValue = require('./_assignMergeValue'), baseFor = require('./_baseFor'), baseMergeDeep = require('./_baseMergeDeep'), isObject = require('./isObject'), keysIn = require('./keysIn'), safeGet = require('./_safeGet'); /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } baseFor(source, function(srcValue, key) { stack || (stack = new Stack); if (isObject(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }, keysIn); } module.exports = baseMerge; },{"./_Stack":59,"./_assignMergeValue":70,"./_baseFor":79,"./_baseMergeDeep":100,"./_safeGet":178,"./isObject":210,"./keysIn":219}],100:[function(require,module,exports){ var assignMergeValue = require('./_assignMergeValue'), cloneBuffer = require('./_cloneBuffer'), cloneTypedArray = require('./_cloneTypedArray'), copyArray = require('./_copyArray'), initCloneObject = require('./_initCloneObject'), isArguments = require('./isArguments'), isArray = require('./isArray'), isArrayLikeObject = require('./isArrayLikeObject'), isBuffer = require('./isBuffer'), isFunction = require('./isFunction'), isObject = require('./isObject'), isPlainObject = require('./isPlainObject'), isTypedArray = require('./isTypedArray'), safeGet = require('./_safeGet'), toPlainObject = require('./toPlainObject'); /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined; var isCommon = newValue === undefined; if (isCommon) { var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject(objValue) || isFunction(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack['delete'](srcValue); } assignMergeValue(object, key, newValue); } module.exports = baseMergeDeep; },{"./_assignMergeValue":70,"./_cloneBuffer":112,"./_cloneTypedArray":116,"./_copyArray":117,"./_initCloneObject":149,"./_safeGet":178,"./isArguments":202,"./isArray":203,"./isArrayLikeObject":205,"./isBuffer":206,"./isFunction":207,"./isObject":210,"./isPlainObject":212,"./isTypedArray":216,"./toPlainObject":229}],101:[function(require,module,exports){ /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } module.exports = baseProperty; },{}],102:[function(require,module,exports){ var baseGet = require('./_baseGet'); /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } module.exports = basePropertyDeep; },{"./_baseGet":81}],103:[function(require,module,exports){ var identity = require('./identity'), overRest = require('./_overRest'), setToString = require('./_setToString'); /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } module.exports = baseRest; },{"./_overRest":176,"./_setToString":182,"./identity":201}],104:[function(require,module,exports){ var constant = require('./constant'), defineProperty = require('./_defineProperty'), identity = require('./identity'); /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; module.exports = baseSetToString; },{"./_defineProperty":125,"./constant":193,"./identity":201}],105:[function(require,module,exports){ /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } module.exports = baseTimes; },{}],106:[function(require,module,exports){ var Symbol = require('./_Symbol'), arrayMap = require('./_arrayMap'), isArray = require('./isArray'), isSymbol = require('./isSymbol'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = baseToString; },{"./_Symbol":60,"./_arrayMap":67,"./isArray":203,"./isSymbol":215}],107:[function(require,module,exports){ /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } module.exports = baseUnary; },{}],108:[function(require,module,exports){ /** * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function cacheHas(cache, key) { return cache.has(key); } module.exports = cacheHas; },{}],109:[function(require,module,exports){ var identity = require('./identity'); /** * Casts `value` to `identity` if it's not a function. * * @private * @param {*} value The value to inspect. * @returns {Function} Returns cast function. */ function castFunction(value) { return typeof value == 'function' ? value : identity; } module.exports = castFunction; },{"./identity":201}],110:[function(require,module,exports){ var isArray = require('./isArray'), isKey = require('./_isKey'), stringToPath = require('./_stringToPath'), toString = require('./toString'); /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } module.exports = castPath; },{"./_isKey":152,"./_stringToPath":189,"./isArray":203,"./toString":230}],111:[function(require,module,exports){ var Uint8Array = require('./_Uint8Array'); /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } module.exports = cloneArrayBuffer; },{"./_Uint8Array":61}],112:[function(require,module,exports){ var root = require('./_root'); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } module.exports = cloneBuffer; },{"./_root":177}],113:[function(require,module,exports){ var cloneArrayBuffer = require('./_cloneArrayBuffer'); /** * Creates a clone of `dataView`. * * @private * @param {Object} dataView The data view to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned data view. */ function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } module.exports = cloneDataView; },{"./_cloneArrayBuffer":111}],114:[function(require,module,exports){ /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** * Creates a clone of `regexp`. * * @private * @param {Object} regexp The regexp to clone. * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } module.exports = cloneRegExp; },{}],115:[function(require,module,exports){ var Symbol = require('./_Symbol'); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * Creates a clone of the `symbol` object. * * @private * @param {Object} symbol The symbol object to clone. * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; } module.exports = cloneSymbol; },{"./_Symbol":60}],116:[function(require,module,exports){ var cloneArrayBuffer = require('./_cloneArrayBuffer'); /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } module.exports = cloneTypedArray; },{"./_cloneArrayBuffer":111}],117:[function(require,module,exports){ /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } module.exports = copyArray; },{}],118:[function(require,module,exports){ var assignValue = require('./_assignValue'), baseAssignValue = require('./_baseAssignValue'); /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } module.exports = copyObject; },{"./_assignValue":71,"./_baseAssignValue":75}],119:[function(require,module,exports){ var copyObject = require('./_copyObject'), getSymbols = require('./_getSymbols'); /** * Copies own symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } module.exports = copySymbols; },{"./_copyObject":118,"./_getSymbols":137}],120:[function(require,module,exports){ var copyObject = require('./_copyObject'), getSymbolsIn = require('./_getSymbolsIn'); /** * Copies own and inherited symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbolsIn(source, object) { return copyObject(source, getSymbolsIn(source), object); } module.exports = copySymbolsIn; },{"./_copyObject":118,"./_getSymbolsIn":138}],121:[function(require,module,exports){ var root = require('./_root'); /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; module.exports = coreJsData; },{"./_root":177}],122:[function(require,module,exports){ var baseRest = require('./_baseRest'), isIterateeCall = require('./_isIterateeCall'); /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } module.exports = createAssigner; },{"./_baseRest":103,"./_isIterateeCall":151}],123:[function(require,module,exports){ var isArrayLike = require('./isArrayLike'); /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } module.exports = createBaseEach; },{"./isArrayLike":204}],124:[function(require,module,exports){ /** * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } module.exports = createBaseFor; },{}],125:[function(require,module,exports){ var getNative = require('./_getNative'); var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); module.exports = defineProperty; },{"./_getNative":134}],126:[function(require,module,exports){ var SetCache = require('./_SetCache'), arraySome = require('./_arraySome'), cacheHas = require('./_cacheHas'); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Check that cyclic values are equal. var arrStacked = stack.get(array); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } module.exports = equalArrays; },{"./_SetCache":58,"./_arraySome":69,"./_cacheHas":108}],127:[function(require,module,exports){ var Symbol = require('./_Symbol'), Uint8Array = require('./_Uint8Array'), eq = require('./eq'), equalArrays = require('./_equalArrays'), mapToArray = require('./_mapToArray'), setToArray = require('./_setToArray'); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** `Object#toString` result references. */ var boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', mapTag = '[object Map]', numberTag = '[object Number]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]'; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } module.exports = equalByTag; },{"./_Symbol":60,"./_Uint8Array":61,"./_equalArrays":126,"./_mapToArray":167,"./_setToArray":181,"./eq":196}],128:[function(require,module,exports){ var getAllKeys = require('./_getAllKeys'); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } // Check that cyclic values are equal. var objStacked = stack.get(object); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } module.exports = equalObjects; },{"./_getAllKeys":130}],129:[function(require,module,exports){ (function (global){ /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; module.exports = freeGlobal; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],130:[function(require,module,exports){ var baseGetAllKeys = require('./_baseGetAllKeys'), getSymbols = require('./_getSymbols'), keys = require('./keys'); /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } module.exports = getAllKeys; },{"./_baseGetAllKeys":82,"./_getSymbols":137,"./keys":218}],131:[function(require,module,exports){ var baseGetAllKeys = require('./_baseGetAllKeys'), getSymbolsIn = require('./_getSymbolsIn'), keysIn = require('./keysIn'); /** * Creates an array of own and inherited enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); } module.exports = getAllKeysIn; },{"./_baseGetAllKeys":82,"./_getSymbolsIn":138,"./keysIn":219}],132:[function(require,module,exports){ var isKeyable = require('./_isKeyable'); /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } module.exports = getMapData; },{"./_isKeyable":153}],133:[function(require,module,exports){ var isStrictComparable = require('./_isStrictComparable'), keys = require('./keys'); /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } module.exports = getMatchData; },{"./_isStrictComparable":156,"./keys":218}],134:[function(require,module,exports){ var baseIsNative = require('./_baseIsNative'), getValue = require('./_getValue'); /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } module.exports = getNative; },{"./_baseIsNative":90,"./_getValue":140}],135:[function(require,module,exports){ var overArg = require('./_overArg'); /** Built-in value references. */ var getPrototype = overArg(Object.getPrototypeOf, Object); module.exports = getPrototype; },{"./_overArg":175}],136:[function(require,module,exports){ var Symbol = require('./_Symbol'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } module.exports = getRawTag; },{"./_Symbol":60}],137:[function(require,module,exports){ var arrayFilter = require('./_arrayFilter'), stubArray = require('./stubArray'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; module.exports = getSymbols; },{"./_arrayFilter":65,"./stubArray":225}],138:[function(require,module,exports){ var arrayPush = require('./_arrayPush'), getPrototype = require('./_getPrototype'), getSymbols = require('./_getSymbols'), stubArray = require('./stubArray'); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own and inherited enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); object = getPrototype(object); } return result; }; module.exports = getSymbolsIn; },{"./_arrayPush":68,"./_getPrototype":135,"./_getSymbols":137,"./stubArray":225}],139:[function(require,module,exports){ var DataView = require('./_DataView'), Map = require('./_Map'), Promise = require('./_Promise'), Set = require('./_Set'), WeakMap = require('./_WeakMap'), baseGetTag = require('./_baseGetTag'), toSource = require('./_toSource'); /** `Object#toString` result references. */ var mapTag = '[object Map]', objectTag = '[object Object]', promiseTag = '[object Promise]', setTag = '[object Set]', weakMapTag = '[object WeakMap]'; var dataViewTag = '[object DataView]'; /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } module.exports = getTag; },{"./_DataView":51,"./_Map":54,"./_Promise":56,"./_Set":57,"./_WeakMap":62,"./_baseGetTag":83,"./_toSource":191}],140:[function(require,module,exports){ /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } module.exports = getValue; },{}],141:[function(require,module,exports){ var castPath = require('./_castPath'), isArguments = require('./isArguments'), isArray = require('./isArray'), isIndex = require('./_isIndex'), isLength = require('./isLength'), toKey = require('./_toKey'); /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } module.exports = hasPath; },{"./_castPath":110,"./_isIndex":150,"./_toKey":190,"./isArguments":202,"./isArray":203,"./isLength":208}],142:[function(require,module,exports){ var nativeCreate = require('./_nativeCreate'); /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } module.exports = hashClear; },{"./_nativeCreate":170}],143:[function(require,module,exports){ /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } module.exports = hashDelete; },{}],144:[function(require,module,exports){ var nativeCreate = require('./_nativeCreate'); /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } module.exports = hashGet; },{"./_nativeCreate":170}],145:[function(require,module,exports){ var nativeCreate = require('./_nativeCreate'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } module.exports = hashHas; },{"./_nativeCreate":170}],146:[function(require,module,exports){ var nativeCreate = require('./_nativeCreate'); /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } module.exports = hashSet; },{"./_nativeCreate":170}],147:[function(require,module,exports){ /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = new array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } module.exports = initCloneArray; },{}],148:[function(require,module,exports){ var cloneArrayBuffer = require('./_cloneArrayBuffer'), cloneDataView = require('./_cloneDataView'), cloneRegExp = require('./_cloneRegExp'), cloneSymbol = require('./_cloneSymbol'), cloneTypedArray = require('./_cloneTypedArray'); /** `Object#toString` result references. */ var boolTag = '[object Boolean]', dateTag = '[object Date]', mapTag = '[object Map]', numberTag = '[object Number]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case dataViewTag: return cloneDataView(object, isDeep); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return new Ctor; case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return new Ctor; case symbolTag: return cloneSymbol(object); } } module.exports = initCloneByTag; },{"./_cloneArrayBuffer":111,"./_cloneDataView":113,"./_cloneRegExp":114,"./_cloneSymbol":115,"./_cloneTypedArray":116}],149:[function(require,module,exports){ var baseCreate = require('./_baseCreate'), getPrototype = require('./_getPrototype'), isPrototype = require('./_isPrototype'); /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) ? baseCreate(getPrototype(object)) : {}; } module.exports = initCloneObject; },{"./_baseCreate":77,"./_getPrototype":135,"./_isPrototype":155}],150:[function(require,module,exports){ /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } module.exports = isIndex; },{}],151:[function(require,module,exports){ var eq = require('./eq'), isArrayLike = require('./isArrayLike'), isIndex = require('./_isIndex'), isObject = require('./isObject'); /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object) ) { return eq(object[index], value); } return false; } module.exports = isIterateeCall; },{"./_isIndex":150,"./eq":196,"./isArrayLike":204,"./isObject":210}],152:[function(require,module,exports){ var isArray = require('./isArray'), isSymbol = require('./isSymbol'); /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } module.exports = isKey; },{"./isArray":203,"./isSymbol":215}],153:[function(require,module,exports){ /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } module.exports = isKeyable; },{}],154:[function(require,module,exports){ var coreJsData = require('./_coreJsData'); /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } module.exports = isMasked; },{"./_coreJsData":121}],155:[function(require,module,exports){ /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } module.exports = isPrototype; },{}],156:[function(require,module,exports){ var isObject = require('./isObject'); /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } module.exports = isStrictComparable; },{"./isObject":210}],157:[function(require,module,exports){ /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } module.exports = listCacheClear; },{}],158:[function(require,module,exports){ var assocIndexOf = require('./_assocIndexOf'); /** Used for built-in method references. */ var arrayProto = Array.prototype; /** Built-in value references. */ var splice = arrayProto.splice; /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } module.exports = listCacheDelete; },{"./_assocIndexOf":72}],159:[function(require,module,exports){ var assocIndexOf = require('./_assocIndexOf'); /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } module.exports = listCacheGet; },{"./_assocIndexOf":72}],160:[function(require,module,exports){ var assocIndexOf = require('./_assocIndexOf'); /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } module.exports = listCacheHas; },{"./_assocIndexOf":72}],161:[function(require,module,exports){ var assocIndexOf = require('./_assocIndexOf'); /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } module.exports = listCacheSet; },{"./_assocIndexOf":72}],162:[function(require,module,exports){ var Hash = require('./_Hash'), ListCache = require('./_ListCache'), Map = require('./_Map'); /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } module.exports = mapCacheClear; },{"./_Hash":52,"./_ListCache":53,"./_Map":54}],163:[function(require,module,exports){ var getMapData = require('./_getMapData'); /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } module.exports = mapCacheDelete; },{"./_getMapData":132}],164:[function(require,module,exports){ var getMapData = require('./_getMapData'); /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } module.exports = mapCacheGet; },{"./_getMapData":132}],165:[function(require,module,exports){ var getMapData = require('./_getMapData'); /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } module.exports = mapCacheHas; },{"./_getMapData":132}],166:[function(require,module,exports){ var getMapData = require('./_getMapData'); /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } module.exports = mapCacheSet; },{"./_getMapData":132}],167:[function(require,module,exports){ /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } module.exports = mapToArray; },{}],168:[function(require,module,exports){ /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || (key in Object(object))); }; } module.exports = matchesStrictComparable; },{}],169:[function(require,module,exports){ var memoize = require('./memoize'); /** Used as the maximum memoize cache size. */ var MAX_MEMOIZE_SIZE = 500; /** * A specialized version of `_.memoize` which clears the memoized function's * cache when it exceeds `MAX_MEMOIZE_SIZE`. * * @private * @param {Function} func The function to have its output memoized. * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { var result = memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } module.exports = memoizeCapped; },{"./memoize":221}],170:[function(require,module,exports){ var getNative = require('./_getNative'); /* Built-in method references that are verified to be native. */ var nativeCreate = getNative(Object, 'create'); module.exports = nativeCreate; },{"./_getNative":134}],171:[function(require,module,exports){ var overArg = require('./_overArg'); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object); module.exports = nativeKeys; },{"./_overArg":175}],172:[function(require,module,exports){ /** * This function is like * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * except that it includes inherited enumerable properties. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; } module.exports = nativeKeysIn; },{}],173:[function(require,module,exports){ var freeGlobal = require('./_freeGlobal'); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); module.exports = nodeUtil; },{"./_freeGlobal":129}],174:[function(require,module,exports){ /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } module.exports = objectToString; },{}],175:[function(require,module,exports){ /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } module.exports = overArg; },{}],176:[function(require,module,exports){ var apply = require('./_apply'); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } module.exports = overRest; },{"./_apply":63}],177:[function(require,module,exports){ var freeGlobal = require('./_freeGlobal'); /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; },{"./_freeGlobal":129}],178:[function(require,module,exports){ /** * Gets the value at `key`, unless `key` is "__proto__" or "constructor". * * @private * @param {Object} object The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function safeGet(object, key) { if (key === 'constructor' && typeof object[key] === 'function') { return; } if (key == '__proto__') { return; } return object[key]; } module.exports = safeGet; },{}],179:[function(require,module,exports){ /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } module.exports = setCacheAdd; },{}],180:[function(require,module,exports){ /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } module.exports = setCacheHas; },{}],181:[function(require,module,exports){ /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } module.exports = setToArray; },{}],182:[function(require,module,exports){ var baseSetToString = require('./_baseSetToString'), shortOut = require('./_shortOut'); /** * Sets the `toString` method of `func` to return `string`. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var setToString = shortOut(baseSetToString); module.exports = setToString; },{"./_baseSetToString":104,"./_shortOut":183}],183:[function(require,module,exports){ /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 800, HOT_SPAN = 16; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeNow = Date.now; /** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */ function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined, arguments); }; } module.exports = shortOut; },{}],184:[function(require,module,exports){ var ListCache = require('./_ListCache'); /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; this.size = 0; } module.exports = stackClear; },{"./_ListCache":53}],185:[function(require,module,exports){ /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } module.exports = stackDelete; },{}],186:[function(require,module,exports){ /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } module.exports = stackGet; },{}],187:[function(require,module,exports){ /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } module.exports = stackHas; },{}],188:[function(require,module,exports){ var ListCache = require('./_ListCache'), Map = require('./_Map'), MapCache = require('./_MapCache'); /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } module.exports = stackSet; },{"./_ListCache":53,"./_Map":54,"./_MapCache":55}],189:[function(require,module,exports){ var memoizeCapped = require('./_memoizeCapped'); /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoizeCapped(function(string) { var result = []; if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } string.replace(rePropName, function(match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); module.exports = stringToPath; },{"./_memoizeCapped":169}],190:[function(require,module,exports){ var isSymbol = require('./isSymbol'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = toKey; },{"./isSymbol":215}],191:[function(require,module,exports){ /** Used for built-in method references. */ var funcProto = Function.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } module.exports = toSource; },{}],192:[function(require,module,exports){ var baseClone = require('./_baseClone'); /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4; /** * This method is like `_.clone` except that it recursively clones `value`. * * @static * @memberOf _ * @since 1.0.0 * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. * @see _.clone * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var deep = _.cloneDeep(objects); * console.log(deep[0] === objects[0]); * // => false */ function cloneDeep(value) { return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); } module.exports = cloneDeep; },{"./_baseClone":76}],193:[function(require,module,exports){ /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function() { return value; }; } module.exports = constant; },{}],194:[function(require,module,exports){ var isObject = require('./isObject'), now = require('./now'), toNumber = require('./toNumber'); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max, nativeMin = Math.min; /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } module.exports = debounce; },{"./isObject":210,"./now":223,"./toNumber":228}],195:[function(require,module,exports){ module.exports = require('./forEach'); },{"./forEach":197}],196:[function(require,module,exports){ /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } module.exports = eq; },{}],197:[function(require,module,exports){ var arrayEach = require('./_arrayEach'), baseEach = require('./_baseEach'), castFunction = require('./_castFunction'), isArray = require('./isArray'); /** * Iterates over elements of `collection` and invokes `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * * **Note:** As with other "Collections" methods, objects with a "length" * property are iterated like arrays. To avoid this behavior use `_.forIn` * or `_.forOwn` for object iteration. * * @static * @memberOf _ * @since 0.1.0 * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @see _.forEachRight * @example * * _.forEach([1, 2], function(value) { * console.log(value); * }); * // => Logs `1` then `2`. * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { var func = isArray(collection) ? arrayEach : baseEach; return func(collection, castFunction(iteratee)); } module.exports = forEach; },{"./_arrayEach":64,"./_baseEach":78,"./_castFunction":109,"./isArray":203}],198:[function(require,module,exports){ var baseForOwn = require('./_baseForOwn'), castFunction = require('./_castFunction'); /** * Iterates over own enumerable string keyed properties of an object and * invokes `iteratee` for each property. The iteratee is invoked with three * arguments: (value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static * @memberOf _ * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forOwnRight * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forOwn(object, iteratee) { return object && baseForOwn(object, castFunction(iteratee)); } module.exports = forOwn; },{"./_baseForOwn":80,"./_castFunction":109}],199:[function(require,module,exports){ var baseGet = require('./_baseGet'); /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } module.exports = get; },{"./_baseGet":81}],200:[function(require,module,exports){ var baseHasIn = require('./_baseHasIn'), hasPath = require('./_hasPath'); /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } module.exports = hasIn; },{"./_baseHasIn":84,"./_hasPath":141}],201:[function(require,module,exports){ /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } module.exports = identity; },{}],202:[function(require,module,exports){ var baseIsArguments = require('./_baseIsArguments'), isObjectLike = require('./isObjectLike'); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; module.exports = isArguments; },{"./_baseIsArguments":85,"./isObjectLike":211}],203:[function(require,module,exports){ /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; module.exports = isArray; },{}],204:[function(require,module,exports){ var isFunction = require('./isFunction'), isLength = require('./isLength'); /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } module.exports = isArrayLike; },{"./isFunction":207,"./isLength":208}],205:[function(require,module,exports){ var isArrayLike = require('./isArrayLike'), isObjectLike = require('./isObjectLike'); /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } module.exports = isArrayLikeObject; },{"./isArrayLike":204,"./isObjectLike":211}],206:[function(require,module,exports){ var root = require('./_root'), stubFalse = require('./stubFalse'); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; module.exports = isBuffer; },{"./_root":177,"./stubFalse":226}],207:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isObject = require('./isObject'); /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', proxyTag = '[object Proxy]'; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } module.exports = isFunction; },{"./_baseGetTag":83,"./isObject":210}],208:[function(require,module,exports){ /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } module.exports = isLength; },{}],209:[function(require,module,exports){ var baseIsMap = require('./_baseIsMap'), baseUnary = require('./_baseUnary'), nodeUtil = require('./_nodeUtil'); /* Node.js helper references. */ var nodeIsMap = nodeUtil && nodeUtil.isMap; /** * Checks if `value` is classified as a `Map` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. * @example * * _.isMap(new Map); * // => true * * _.isMap(new WeakMap); * // => false */ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; module.exports = isMap; },{"./_baseIsMap":88,"./_baseUnary":107,"./_nodeUtil":173}],210:[function(require,module,exports){ /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; },{}],211:[function(require,module,exports){ /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } module.exports = isObjectLike; },{}],212:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), getPrototype = require('./_getPrototype'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var objectTag = '[object Object]'; /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } module.exports = isPlainObject; },{"./_baseGetTag":83,"./_getPrototype":135,"./isObjectLike":211}],213:[function(require,module,exports){ var baseIsSet = require('./_baseIsSet'), baseUnary = require('./_baseUnary'), nodeUtil = require('./_nodeUtil'); /* Node.js helper references. */ var nodeIsSet = nodeUtil && nodeUtil.isSet; /** * Checks if `value` is classified as a `Set` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. * @example * * _.isSet(new Set); * // => true * * _.isSet(new WeakSet); * // => false */ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; module.exports = isSet; },{"./_baseIsSet":91,"./_baseUnary":107,"./_nodeUtil":173}],214:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isArray = require('./isArray'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var stringTag = '[object String]'; /** * Checks if `value` is classified as a `String` primitive or object. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a string, else `false`. * @example * * _.isString('abc'); * // => true * * _.isString(1); * // => false */ function isString(value) { return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } module.exports = isString; },{"./_baseGetTag":83,"./isArray":203,"./isObjectLike":211}],215:[function(require,module,exports){ var baseGetTag = require('./_baseGetTag'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } module.exports = isSymbol; },{"./_baseGetTag":83,"./isObjectLike":211}],216:[function(require,module,exports){ var baseIsTypedArray = require('./_baseIsTypedArray'), baseUnary = require('./_baseUnary'), nodeUtil = require('./_nodeUtil'); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; module.exports = isTypedArray; },{"./_baseIsTypedArray":92,"./_baseUnary":107,"./_nodeUtil":173}],217:[function(require,module,exports){ /** * Checks if `value` is `undefined`. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true * * _.isUndefined(null); * // => false */ function isUndefined(value) { return value === undefined; } module.exports = isUndefined; },{}],218:[function(require,module,exports){ var arrayLikeKeys = require('./_arrayLikeKeys'), baseKeys = require('./_baseKeys'), isArrayLike = require('./isArrayLike'); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } module.exports = keys; },{"./_arrayLikeKeys":66,"./_baseKeys":94,"./isArrayLike":204}],219:[function(require,module,exports){ var arrayLikeKeys = require('./_arrayLikeKeys'), baseKeysIn = require('./_baseKeysIn'), isArrayLike = require('./isArrayLike'); /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } module.exports = keysIn; },{"./_arrayLikeKeys":66,"./_baseKeysIn":95,"./isArrayLike":204}],220:[function(require,module,exports){ var arrayMap = require('./_arrayMap'), baseIteratee = require('./_baseIteratee'), baseMap = require('./_baseMap'), isArray = require('./isArray'); /** * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, * `template`, `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * * function square(n) { * return n * n; * } * * _.map([4, 8], square); * // => [16, 64] * * _.map({ 'a': 4, 'b': 8 }, square); * // => [16, 64] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // The `_.property` iteratee shorthand. * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map(collection, iteratee) { var func = isArray(collection) ? arrayMap : baseMap; return func(collection, baseIteratee(iteratee, 3)); } module.exports = map; },{"./_arrayMap":67,"./_baseIteratee":93,"./_baseMap":96,"./isArray":203}],221:[function(require,module,exports){ var MapCache = require('./_MapCache'); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `clear`, `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Expose `MapCache`. memoize.Cache = MapCache; module.exports = memoize; },{"./_MapCache":55}],222:[function(require,module,exports){ var baseMerge = require('./_baseMerge'), createAssigner = require('./_createAssigner'); /** * This method is like `_.assign` except that it recursively merges own and * inherited enumerable string keyed properties of source objects into the * destination object. Source properties that resolve to `undefined` are * skipped if a destination value exists. Array and plain object properties * are merged recursively. Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var object = { * 'a': [{ 'b': 2 }, { 'd': 4 }] * }; * * var other = { * 'a': [{ 'c': 3 }, { 'e': 5 }] * }; * * _.merge(object, other); * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } */ var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); module.exports = merge; },{"./_baseMerge":99,"./_createAssigner":122}],223:[function(require,module,exports){ var root = require('./_root'); /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = function() { return root.Date.now(); }; module.exports = now; },{"./_root":177}],224:[function(require,module,exports){ var baseProperty = require('./_baseProperty'), basePropertyDeep = require('./_basePropertyDeep'), isKey = require('./_isKey'), toKey = require('./_toKey'); /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } module.exports = property; },{"./_baseProperty":101,"./_basePropertyDeep":102,"./_isKey":152,"./_toKey":190}],225:[function(require,module,exports){ /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } module.exports = stubArray; },{}],226:[function(require,module,exports){ /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } module.exports = stubFalse; },{}],227:[function(require,module,exports){ var debounce = require('./debounce'), isObject = require('./isObject'); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide `options` to indicate whether `func` * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=true] * Specify invoking on the leading edge of the timeout. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } module.exports = throttle; },{"./debounce":194,"./isObject":210}],228:[function(require,module,exports){ var isObject = require('./isObject'), isSymbol = require('./isSymbol'); /** Used as references for various `Number` constants. */ var NAN = 0 / 0; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } module.exports = toNumber; },{"./isObject":210,"./isSymbol":215}],229:[function(require,module,exports){ var copyObject = require('./_copyObject'), keysIn = require('./keysIn'); /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return copyObject(value, keysIn(value)); } module.exports = toPlainObject; },{"./_copyObject":118,"./keysIn":219}],230:[function(require,module,exports){ var baseToString = require('./_baseToString'); /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } module.exports = toString; },{"./_baseToString":106}],231:[function(require,module,exports){ (function(root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); } else if (typeof exports === 'object') { module.exports = factory(); } else { root.materialColors = factory(); } })(this, function() { return {"red":{"50":"#ffebee","100":"#ffcdd2","200":"#ef9a9a","300":"#e57373","400":"#ef5350","500":"#f44336","600":"#e53935","700":"#d32f2f","800":"#c62828","900":"#b71c1c","a100":"#ff8a80","a200":"#ff5252","a400":"#ff1744","a700":"#d50000"},"pink":{"50":"#fce4ec","100":"#f8bbd0","200":"#f48fb1","300":"#f06292","400":"#ec407a","500":"#e91e63","600":"#d81b60","700":"#c2185b","800":"#ad1457","900":"#880e4f","a100":"#ff80ab","a200":"#ff4081","a400":"#f50057","a700":"#c51162"},"purple":{"50":"#f3e5f5","100":"#e1bee7","200":"#ce93d8","300":"#ba68c8","400":"#ab47bc","500":"#9c27b0","600":"#8e24aa","700":"#7b1fa2","800":"#6a1b9a","900":"#4a148c","a100":"#ea80fc","a200":"#e040fb","a400":"#d500f9","a700":"#aa00ff"},"deepPurple":{"50":"#ede7f6","100":"#d1c4e9","200":"#b39ddb","300":"#9575cd","400":"#7e57c2","500":"#673ab7","600":"#5e35b1","700":"#512da8","800":"#4527a0","900":"#311b92","a100":"#b388ff","a200":"#7c4dff","a400":"#651fff","a700":"#6200ea"},"indigo":{"50":"#e8eaf6","100":"#c5cae9","200":"#9fa8da","300":"#7986cb","400":"#5c6bc0","500":"#3f51b5","600":"#3949ab","700":"#303f9f","800":"#283593","900":"#1a237e","a100":"#8c9eff","a200":"#536dfe","a400":"#3d5afe","a700":"#304ffe"},"blue":{"50":"#e3f2fd","100":"#bbdefb","200":"#90caf9","300":"#64b5f6","400":"#42a5f5","500":"#2196f3","600":"#1e88e5","700":"#1976d2","800":"#1565c0","900":"#0d47a1","a100":"#82b1ff","a200":"#448aff","a400":"#2979ff","a700":"#2962ff"},"lightBlue":{"50":"#e1f5fe","100":"#b3e5fc","200":"#81d4fa","300":"#4fc3f7","400":"#29b6f6","500":"#03a9f4","600":"#039be5","700":"#0288d1","800":"#0277bd","900":"#01579b","a100":"#80d8ff","a200":"#40c4ff","a400":"#00b0ff","a700":"#0091ea"},"cyan":{"50":"#e0f7fa","100":"#b2ebf2","200":"#80deea","300":"#4dd0e1","400":"#26c6da","500":"#00bcd4","600":"#00acc1","700":"#0097a7","800":"#00838f","900":"#006064","a100":"#84ffff","a200":"#18ffff","a400":"#00e5ff","a700":"#00b8d4"},"teal":{"50":"#e0f2f1","100":"#b2dfdb","200":"#80cbc4","300":"#4db6ac","400":"#26a69a","500":"#009688","600":"#00897b","700":"#00796b","800":"#00695c","900":"#004d40","a100":"#a7ffeb","a200":"#64ffda","a400":"#1de9b6","a700":"#00bfa5"},"green":{"50":"#e8f5e9","100":"#c8e6c9","200":"#a5d6a7","300":"#81c784","400":"#66bb6a","500":"#4caf50","600":"#43a047","700":"#388e3c","800":"#2e7d32","900":"#1b5e20","a100":"#b9f6ca","a200":"#69f0ae","a400":"#00e676","a700":"#00c853"},"lightGreen":{"50":"#f1f8e9","100":"#dcedc8","200":"#c5e1a5","300":"#aed581","400":"#9ccc65","500":"#8bc34a","600":"#7cb342","700":"#689f38","800":"#558b2f","900":"#33691e","a100":"#ccff90","a200":"#b2ff59","a400":"#76ff03","a700":"#64dd17"},"lime":{"50":"#f9fbe7","100":"#f0f4c3","200":"#e6ee9c","300":"#dce775","400":"#d4e157","500":"#cddc39","600":"#c0ca33","700":"#afb42b","800":"#9e9d24","900":"#827717","a100":"#f4ff81","a200":"#eeff41","a400":"#c6ff00","a700":"#aeea00"},"yellow":{"50":"#fffde7","100":"#fff9c4","200":"#fff59d","300":"#fff176","400":"#ffee58","500":"#ffeb3b","600":"#fdd835","700":"#fbc02d","800":"#f9a825","900":"#f57f17","a100":"#ffff8d","a200":"#ffff00","a400":"#ffea00","a700":"#ffd600"},"amber":{"50":"#fff8e1","100":"#ffecb3","200":"#ffe082","300":"#ffd54f","400":"#ffca28","500":"#ffc107","600":"#ffb300","700":"#ffa000","800":"#ff8f00","900":"#ff6f00","a100":"#ffe57f","a200":"#ffd740","a400":"#ffc400","a700":"#ffab00"},"orange":{"50":"#fff3e0","100":"#ffe0b2","200":"#ffcc80","300":"#ffb74d","400":"#ffa726","500":"#ff9800","600":"#fb8c00","700":"#f57c00","800":"#ef6c00","900":"#e65100","a100":"#ffd180","a200":"#ffab40","a400":"#ff9100","a700":"#ff6d00"},"deepOrange":{"50":"#fbe9e7","100":"#ffccbc","200":"#ffab91","300":"#ff8a65","400":"#ff7043","500":"#ff5722","600":"#f4511e","700":"#e64a19","800":"#d84315","900":"#bf360c","a100":"#ff9e80","a200":"#ff6e40","a400":"#ff3d00","a700":"#dd2c00"},"brown":{"50":"#efebe9","100":"#d7ccc8","200":"#bcaaa4","300":"#a1887f","400":"#8d6e63","500":"#795548","600":"#6d4c41","700":"#5d4037","800":"#4e342e","900":"#3e2723"},"grey":{"50":"#fafafa","100":"#f5f5f5","200":"#eeeeee","300":"#e0e0e0","400":"#bdbdbd","500":"#9e9e9e","600":"#757575","700":"#616161","800":"#424242","900":"#212121"},"blueGrey":{"50":"#eceff1","100":"#cfd8dc","200":"#b0bec5","300":"#90a4ae","400":"#78909c","500":"#607d8b","600":"#546e7a","700":"#455a64","800":"#37474f","900":"#263238"},"darkText":{"primary":"rgba(0, 0, 0, 0.87)","secondary":"rgba(0, 0, 0, 0.54)","disabled":"rgba(0, 0, 0, 0.38)","dividers":"rgba(0, 0, 0, 0.12)"},"lightText":{"primary":"rgba(255, 255, 255, 1)","secondary":"rgba(255, 255, 255, 0.7)","disabled":"rgba(255, 255, 255, 0.5)","dividers":"rgba(255, 255, 255, 0.12)"},"darkIcons":{"active":"rgba(0, 0, 0, 0.54)","inactive":"rgba(0, 0, 0, 0.38)"},"lightIcons":{"active":"rgba(255, 255, 255, 1)","inactive":"rgba(255, 255, 255, 0.5)"},"white":"#ffffff","black":"#000000"}; }); },{}],232:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @license MIT */ 'use strict'; /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); if (order2.join('') !== '0123456789') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; },{}],233:[function(require,module,exports){ (function (process){ /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var printWarning = function() {}; if (process.env.NODE_ENV !== 'production') { var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); var loggedTypeFailures = {}; var has = Function.call.bind(Object.prototype.hasOwnProperty); printWarning = function(text) { var message = 'Warning: ' + text; if (typeof console !== 'undefined') { console.error(message); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch (x) {} }; } /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. * * @param {object} typeSpecs Map of name to a ReactPropType * @param {object} values Runtime values that need to be type-checked * @param {string} location e.g. "prop", "context", "child context" * @param {string} componentName Name of the component for error messages. * @param {?Function} getStack Returns the component stack. * @private */ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { if (process.env.NODE_ENV !== 'production') { for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. // After these have been cleaned up, we'll let them throw. try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. if (typeof typeSpecs[typeSpecName] !== 'function') { var err = Error( (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' ); err.name = 'Invariant Violation'; throw err; } error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); } catch (ex) { error = ex; } if (error && !(error instanceof Error)) { printWarning( (componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).' ); } if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error.message] = true; var stack = getStack ? getStack() : ''; printWarning( 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') ); } } } } } /** * Resets warning cache when testing. * * @private */ checkPropTypes.resetWarningCache = function() { if (process.env.NODE_ENV !== 'production') { loggedTypeFailures = {}; } } module.exports = checkPropTypes; }).call(this,require('_process')) },{"./lib/ReactPropTypesSecret":237,"_process":3}],234:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); function emptyFunction() {} function emptyFunctionWithReset() {} emptyFunctionWithReset.resetWarningCache = emptyFunction; module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim, checkPropTypes: emptyFunctionWithReset, resetWarningCache: emptyFunction }; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; },{"./lib/ReactPropTypesSecret":237}],235:[function(require,module,exports){ (function (process){ /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var ReactIs = require('react-is'); var assign = require('object-assign'); var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); var checkPropTypes = require('./checkPropTypes'); var has = Function.call.bind(Object.prototype.hasOwnProperty); var printWarning = function() {}; if (process.env.NODE_ENV !== 'production') { printWarning = function(text) { var message = 'Warning: ' + text; if (typeof console !== 'undefined') { console.error(message); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch (x) {} }; } function emptyFunctionThatReturnsNull() { return null; } module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. /** * Returns the iterator method function contained on the iterable object. * * Be sure to invoke the function with the iterable as context: * * var iteratorFn = getIteratorFn(myIterable); * if (iteratorFn) { * var iterator = iteratorFn.call(myIterable); * ... * } * * @param {?object} maybeIterable * @return {?function} */ function getIteratorFn(maybeIterable) { var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); if (typeof iteratorFn === 'function') { return iteratorFn; } } /** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: * * var Props = require('ReactPropTypes'); * var MyArticle = React.createClass({ * propTypes: { * // An optional string prop named "description". * description: Props.string, * * // A required enum prop named "category". * category: Props.oneOf(['News','Photos']).isRequired, * * // A prop named "dialog" that requires an instance of Dialog. * dialog: Props.instanceOf(Dialog).isRequired * }, * render: function() { ... } * }); * * A more formal specification of how these methods are used: * * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) * decl := ReactPropTypes.{type}(.isRequired)? * * Each and every declaration produces a function with the same signature. This * allows the creation of custom validation functions. For example: * * var MyLink = React.createClass({ * propTypes: { * // An optional string or URI prop named "href". * href: function(props, propName, componentName) { * var propValue = props[propName]; * if (propValue != null && typeof propValue !== 'string' && * !(propValue instanceof URI)) { * return new Error( * 'Expected a string or an URI for ' + propName + ' in ' + * componentName * ); * } * } * }, * render: function() {...} * }); * * @internal */ var ANONYMOUS = '<>'; // Important! // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), func: createPrimitiveTypeChecker('function'), number: createPrimitiveTypeChecker('number'), object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), symbol: createPrimitiveTypeChecker('symbol'), any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: createElementTypeChecker(), elementType: createElementTypeTypeChecker(), instanceOf: createInstanceTypeChecker, node: createNodeChecker(), objectOf: createObjectOfTypeChecker, oneOf: createEnumTypeChecker, oneOfType: createUnionTypeChecker, shape: createShapeTypeChecker, exact: createStrictShapeTypeChecker, }; /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ /*eslint-disable no-self-compare*/ function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } } /*eslint-enable no-self-compare*/ /** * We use an Error-like object for backward compatibility as people may call * PropTypes directly and inspect their output. However, we don't use real * Errors anymore. We don't inspect their stack anyway, and creating them * is prohibitively expensive if they are created too often, such as what * happens in oneOfType() for any type before the one that matched. */ function PropTypeError(message) { this.message = message; this.stack = ''; } // Make `instanceof Error` still work for returned errors. PropTypeError.prototype = Error.prototype; function createChainableTypeChecker(validate) { if (process.env.NODE_ENV !== 'production') { var manualPropTypeCallCache = {}; var manualPropTypeWarningCount = 0; } function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; if (secret !== ReactPropTypesSecret) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; if ( !manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors manualPropTypeWarningCount < 3 ) { printWarning( 'You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' ); manualPropTypeCallCache[cacheKey] = true; manualPropTypeWarningCount++; } } } if (props[propName] == null) { if (isRequired) { if (props[propName] === null) { return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); } return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); } return null; } else { return validate(props, propName, componentName, location, propFullName); } } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { // `propValue` being instance of, say, date/regexp, pass the 'object' // check, but we can offer a more precise error message here rather than // 'of type `object`'. var preciseType = getPreciseType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); } return null; } return createChainableTypeChecker(validate); } function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunctionThatReturnsNull); } function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); } var propValue = props[propName]; if (!Array.isArray(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); } for (var i = 0; i < propValue.length; i++) { var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); if (error instanceof Error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!isValidElement(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); } return null; } return createChainableTypeChecker(validate); } function createElementTypeTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!ReactIs.isValidElementType(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); } return null; } return createChainableTypeChecker(validate); } function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var expectedClassName = expectedClass.name || ANONYMOUS; var actualClassName = getClassName(props[propName]); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); } return null; } return createChainableTypeChecker(validate); } function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { if (process.env.NODE_ENV !== 'production') { if (arguments.length > 1) { printWarning( 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' ); } else { printWarning('Invalid argument supplied to oneOf, expected an array.'); } } return emptyFunctionThatReturnsNull; } function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (is(propValue, expectedValues[i])) { return null; } } var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { var type = getPreciseType(value); if (type === 'symbol') { return String(value); } return value; }); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } return createChainableTypeChecker(validate); } function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); } var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); } for (var key in propValue) { if (has(propValue, key)) { var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error instanceof Error) { return error; } } } return null; } return createChainableTypeChecker(validate); } function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; return emptyFunctionThatReturnsNull; } for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') { printWarning( 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' ); return emptyFunctionThatReturnsNull; } } function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { return null; } } return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } return createChainableTypeChecker(validate); } function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); } return null; } return createChainableTypeChecker(validate); } function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); } for (var key in shapeTypes) { var checker = shapeTypes[key]; if (!checker) { continue; } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createStrictShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); } // We need to check all keys in case some are required but missing from // props. var allKeys = assign({}, props[propName], shapeTypes); for (var key in allKeys) { var checker = shapeTypes[key]; if (!checker) { return new PropTypeError( 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') ); } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error) { return error; } } return null; } return createChainableTypeChecker(validate); } function isNode(propValue) { switch (typeof propValue) { case 'number': case 'string': case 'undefined': return true; case 'boolean': return !propValue; case 'object': if (Array.isArray(propValue)) { return propValue.every(isNode); } if (propValue === null || isValidElement(propValue)) { return true; } var iteratorFn = getIteratorFn(propValue); if (iteratorFn) { var iterator = iteratorFn.call(propValue); var step; if (iteratorFn !== propValue.entries) { while (!(step = iterator.next()).done) { if (!isNode(step.value)) { return false; } } } else { // Iterator will provide entry [k,v] tuples rather than values. while (!(step = iterator.next()).done) { var entry = step.value; if (entry) { if (!isNode(entry[1])) { return false; } } } } } else { return false; } return true; default: return false; } } function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } // falsy value can't be a Symbol if (!propValue) { return false; } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { return true; } return false; } // Equivalent of `typeof` but with special handling for array and regexp. function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; } // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { if (typeof propValue === 'undefined' || propValue === null) { return '' + propValue; } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; } // Returns a string that is postfixed to a warning about an invalid type. // For example, "undefined" or "of type array" function getPostfixForTypeWarning(value) { var type = getPreciseType(value); switch (type) { case 'array': case 'object': return 'an ' + type; case 'boolean': case 'date': case 'regexp': return 'a ' + type; default: return type; } } // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; } ReactPropTypes.checkPropTypes = checkPropTypes; ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; }).call(this,require('_process')) },{"./checkPropTypes":233,"./lib/ReactPropTypesSecret":237,"_process":3,"object-assign":232,"react-is":295}],236:[function(require,module,exports){ (function (process){ /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (process.env.NODE_ENV !== 'production') { var ReactIs = require('react-is'); // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = require('./factoryWithThrowingShims')(); } }).call(this,require('_process')) },{"./factoryWithThrowingShims":234,"./factoryWithTypeCheckers":235,"_process":3,"react-is":295}],237:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; },{}],238:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.AlphaPicker = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _common = require('../common'); var _AlphaPointer = require('./AlphaPointer'); var _AlphaPointer2 = _interopRequireDefault(_AlphaPointer); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var AlphaPicker = exports.AlphaPicker = function AlphaPicker(_ref) { var rgb = _ref.rgb, hsl = _ref.hsl, width = _ref.width, height = _ref.height, onChange = _ref.onChange, direction = _ref.direction, style = _ref.style, renderers = _ref.renderers, pointer = _ref.pointer, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)({ 'default': { picker: { position: 'relative', width: width, height: height }, alpha: { radius: '2px', style: style } } }); return _react2.default.createElement( 'div', { style: styles.picker, className: 'alpha-picker ' + className }, _react2.default.createElement(_common.Alpha, _extends({}, styles.alpha, { rgb: rgb, hsl: hsl, pointer: pointer, renderers: renderers, onChange: onChange, direction: direction })) ); }; AlphaPicker.defaultProps = { width: '316px', height: '16px', direction: 'horizontal', pointer: _AlphaPointer2.default }; exports.default = (0, _common.ColorWrap)(AlphaPicker); },{"../common":256,"./AlphaPointer":239,"react":"react","reactcss":301}],239:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.AlphaPointer = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var AlphaPointer = exports.AlphaPointer = function AlphaPointer(_ref) { var direction = _ref.direction; var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '18px', height: '18px', borderRadius: '50%', transform: 'translate(-9px, -1px)', backgroundColor: 'rgb(248, 248, 248)', boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.37)' } }, 'vertical': { picker: { transform: 'translate(-3px, -9px)' } } }, { vertical: direction === 'vertical' }); return _react2.default.createElement('div', { style: styles.picker }); }; exports.default = AlphaPointer; },{"react":"react","reactcss":301}],240:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Block = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _common = require('../common'); var _BlockSwatches = require('./BlockSwatches'); var _BlockSwatches2 = _interopRequireDefault(_BlockSwatches); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Block = exports.Block = function Block(_ref) { var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, hex = _ref.hex, colors = _ref.colors, width = _ref.width, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var transparent = hex === 'transparent'; var handleChange = function handleChange(hexCode, e) { color.isValidHex(hexCode) && onChange({ hex: hexCode, source: 'hex' }, e); }; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { card: { width: width, background: '#fff', boxShadow: '0 1px rgba(0,0,0,.1)', borderRadius: '6px', position: 'relative' }, head: { height: '110px', background: hex, borderRadius: '6px 6px 0 0', display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'relative' }, body: { padding: '10px' }, label: { fontSize: '18px', color: color.getContrastingColor(hex), position: 'relative' }, triangle: { width: '0px', height: '0px', borderStyle: 'solid', borderWidth: '0 10px 10px 10px', borderColor: 'transparent transparent ' + hex + ' transparent', position: 'absolute', top: '-10px', left: '50%', marginLeft: '-10px' }, input: { width: '100%', fontSize: '12px', color: '#666', border: '0px', outline: 'none', height: '22px', boxShadow: 'inset 0 0 0 1px #ddd', borderRadius: '4px', padding: '0 7px', boxSizing: 'border-box' } }, 'hide-triangle': { triangle: { display: 'none' } } }, passedStyles), { 'hide-triangle': triangle === 'hide' }); return _react2.default.createElement( 'div', { style: styles.card, className: 'block-picker ' + className }, _react2.default.createElement('div', { style: styles.triangle }), _react2.default.createElement( 'div', { style: styles.head }, transparent && _react2.default.createElement(_common.Checkboard, { borderRadius: '6px 6px 0 0' }), _react2.default.createElement( 'div', { style: styles.label }, hex ) ), _react2.default.createElement( 'div', { style: styles.body }, _react2.default.createElement(_BlockSwatches2.default, { colors: colors, onClick: handleChange, onSwatchHover: onSwatchHover }), _react2.default.createElement(_common.EditableInput, { style: { input: styles.input }, value: hex, onChange: handleChange }) ) ); }; Block.propTypes = { width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), colors: _propTypes2.default.arrayOf(_propTypes2.default.string), triangle: _propTypes2.default.oneOf(['top', 'hide']), styles: _propTypes2.default.object }; Block.defaultProps = { width: 170, colors: ['#D9E3F0', '#F47373', '#697689', '#37D67A', '#2CCCE4', '#555555', '#dce775', '#ff8a65', '#ba68c8'], triangle: 'top', styles: {} }; exports.default = (0, _common.ColorWrap)(Block); },{"../../helpers/color":288,"../common":256,"./BlockSwatches":241,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],241:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.BlockSwatches = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _map = require('lodash/map'); var _map2 = _interopRequireDefault(_map); var _common = require('../common'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var BlockSwatches = exports.BlockSwatches = function BlockSwatches(_ref) { var colors = _ref.colors, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover; var styles = (0, _reactcss2.default)({ 'default': { swatches: { marginRight: '-10px' }, swatch: { width: '22px', height: '22px', float: 'left', marginRight: '10px', marginBottom: '10px', borderRadius: '4px' }, clear: { clear: 'both' } } }); return _react2.default.createElement( 'div', { style: styles.swatches }, (0, _map2.default)(colors, function (c) { return _react2.default.createElement(_common.Swatch, { key: c, color: c, style: styles.swatch, onClick: onClick, onHover: onSwatchHover, focusStyle: { boxShadow: '0 0 4px ' + c } }); }), _react2.default.createElement('div', { style: styles.clear }) ); }; exports.default = BlockSwatches; },{"../common":256,"lodash/map":220,"react":"react","reactcss":301}],242:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Chrome = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _common = require('../common'); var _ChromeFields = require('./ChromeFields'); var _ChromeFields2 = _interopRequireDefault(_ChromeFields); var _ChromePointer = require('./ChromePointer'); var _ChromePointer2 = _interopRequireDefault(_ChromePointer); var _ChromePointerCircle = require('./ChromePointerCircle'); var _ChromePointerCircle2 = _interopRequireDefault(_ChromePointerCircle); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Chrome = exports.Chrome = function Chrome(_ref) { var width = _ref.width, onChange = _ref.onChange, disableAlpha = _ref.disableAlpha, rgb = _ref.rgb, hsl = _ref.hsl, hsv = _ref.hsv, hex = _ref.hex, renderers = _ref.renderers, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className, defaultView = _ref.defaultView; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { picker: { width: width, background: '#fff', borderRadius: '2px', boxShadow: '0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)', boxSizing: 'initial', fontFamily: 'Menlo' }, saturation: { width: '100%', paddingBottom: '55%', position: 'relative', borderRadius: '2px 2px 0 0', overflow: 'hidden' }, Saturation: { radius: '2px 2px 0 0' }, body: { padding: '16px 16px 12px' }, controls: { display: 'flex' }, color: { width: '32px' }, swatch: { marginTop: '6px', width: '16px', height: '16px', borderRadius: '8px', position: 'relative', overflow: 'hidden' }, active: { absolute: '0px 0px 0px 0px', borderRadius: '8px', boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.1)', background: 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + rgb.a + ')', zIndex: '2' }, toggles: { flex: '1' }, hue: { height: '10px', position: 'relative', marginBottom: '8px' }, Hue: { radius: '2px' }, alpha: { height: '10px', position: 'relative' }, Alpha: { radius: '2px' } }, 'disableAlpha': { color: { width: '22px' }, alpha: { display: 'none' }, hue: { marginBottom: '0px' }, swatch: { width: '10px', height: '10px', marginTop: '0px' } } }, passedStyles), { disableAlpha: disableAlpha }); return _react2.default.createElement( 'div', { style: styles.picker, className: 'chrome-picker ' + className }, _react2.default.createElement( 'div', { style: styles.saturation }, _react2.default.createElement(_common.Saturation, { style: styles.Saturation, hsl: hsl, hsv: hsv, pointer: _ChromePointerCircle2.default, onChange: onChange }) ), _react2.default.createElement( 'div', { style: styles.body }, _react2.default.createElement( 'div', { style: styles.controls, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.color }, _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement('div', { style: styles.active }), _react2.default.createElement(_common.Checkboard, { renderers: renderers }) ) ), _react2.default.createElement( 'div', { style: styles.toggles }, _react2.default.createElement( 'div', { style: styles.hue }, _react2.default.createElement(_common.Hue, { style: styles.Hue, hsl: hsl, pointer: _ChromePointer2.default, onChange: onChange }) ), _react2.default.createElement( 'div', { style: styles.alpha }, _react2.default.createElement(_common.Alpha, { style: styles.Alpha, rgb: rgb, hsl: hsl, pointer: _ChromePointer2.default, renderers: renderers, onChange: onChange }) ) ) ), _react2.default.createElement(_ChromeFields2.default, { rgb: rgb, hsl: hsl, hex: hex, view: defaultView, onChange: onChange, disableAlpha: disableAlpha }) ) ); }; Chrome.propTypes = { width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), disableAlpha: _propTypes2.default.bool, styles: _propTypes2.default.object, defaultView: _propTypes2.default.oneOf(["hex", "rgb", "hsl"]) }; Chrome.defaultProps = { width: 225, disableAlpha: false, styles: {} }; exports.default = (0, _common.ColorWrap)(Chrome); },{"../common":256,"./ChromeFields":243,"./ChromePointer":244,"./ChromePointerCircle":245,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],243:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChromeFields = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _isUndefined = require('lodash/isUndefined'); var _isUndefined2 = _interopRequireDefault(_isUndefined); var _common = require('../common'); var _UnfoldMoreHorizontalIcon = require('@icons/material/UnfoldMoreHorizontalIcon'); var _UnfoldMoreHorizontalIcon2 = _interopRequireDefault(_UnfoldMoreHorizontalIcon); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint-disable react/no-did-mount-set-state, no-param-reassign */ var ChromeFields = exports.ChromeFields = function (_React$Component) { _inherits(ChromeFields, _React$Component); function ChromeFields(props) { _classCallCheck(this, ChromeFields); var _this = _possibleConstructorReturn(this, (ChromeFields.__proto__ || Object.getPrototypeOf(ChromeFields)).call(this)); _this.toggleViews = function () { if (_this.state.view === 'hex') { _this.setState({ view: 'rgb' }); } else if (_this.state.view === 'rgb') { _this.setState({ view: 'hsl' }); } else if (_this.state.view === 'hsl') { if (_this.props.hsl.a === 1) { _this.setState({ view: 'hex' }); } else { _this.setState({ view: 'rgb' }); } } }; _this.handleChange = function (data, e) { if (data.hex) { color.isValidHex(data.hex) && _this.props.onChange({ hex: data.hex, source: 'hex' }, e); } else if (data.r || data.g || data.b) { _this.props.onChange({ r: data.r || _this.props.rgb.r, g: data.g || _this.props.rgb.g, b: data.b || _this.props.rgb.b, source: 'rgb' }, e); } else if (data.a) { if (data.a < 0) { data.a = 0; } else if (data.a > 1) { data.a = 1; } _this.props.onChange({ h: _this.props.hsl.h, s: _this.props.hsl.s, l: _this.props.hsl.l, a: Math.round(data.a * 100) / 100, source: 'rgb' }, e); } else if (data.h || data.s || data.l) { // Remove any occurances of '%'. if (typeof data.s === 'string' && data.s.includes('%')) { data.s = data.s.replace('%', ''); } if (typeof data.l === 'string' && data.l.includes('%')) { data.l = data.l.replace('%', ''); } // We store HSL as a unit interval so we need to override the 1 input to 0.01 if (data.s == 1) { data.s = 0.01; } else if (data.l == 1) { data.l = 0.01; } _this.props.onChange({ h: data.h || _this.props.hsl.h, s: Number(!(0, _isUndefined2.default)(data.s) ? data.s : _this.props.hsl.s), l: Number(!(0, _isUndefined2.default)(data.l) ? data.l : _this.props.hsl.l), source: 'hsl' }, e); } }; _this.showHighlight = function (e) { e.currentTarget.style.background = '#eee'; }; _this.hideHighlight = function (e) { e.currentTarget.style.background = 'transparent'; }; if (props.hsl.a !== 1 && props.view === "hex") { _this.state = { view: "rgb" }; } else { _this.state = { view: props.view }; } return _this; } _createClass(ChromeFields, [{ key: 'render', value: function render() { var _this2 = this; var styles = (0, _reactcss2.default)({ 'default': { wrap: { paddingTop: '16px', display: 'flex' }, fields: { flex: '1', display: 'flex', marginLeft: '-6px' }, field: { paddingLeft: '6px', width: '100%' }, alpha: { paddingLeft: '6px', width: '100%' }, toggle: { width: '32px', textAlign: 'right', position: 'relative' }, icon: { marginRight: '-4px', marginTop: '12px', cursor: 'pointer', position: 'relative' }, iconHighlight: { position: 'absolute', width: '24px', height: '28px', background: '#eee', borderRadius: '4px', top: '10px', left: '12px', display: 'none' }, input: { fontSize: '11px', color: '#333', width: '100%', borderRadius: '2px', border: 'none', boxShadow: 'inset 0 0 0 1px #dadada', height: '21px', textAlign: 'center' }, label: { textTransform: 'uppercase', fontSize: '11px', lineHeight: '11px', color: '#969696', textAlign: 'center', display: 'block', marginTop: '12px' }, svg: { fill: '#333', width: '24px', height: '24px', border: '1px transparent solid', borderRadius: '5px' } }, 'disableAlpha': { alpha: { display: 'none' } } }, this.props, this.state); var fields = void 0; if (this.state.view === 'hex') { fields = _react2.default.createElement( 'div', { style: styles.fields, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.field }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'hex', value: this.props.hex, onChange: this.handleChange }) ) ); } else if (this.state.view === 'rgb') { fields = _react2.default.createElement( 'div', { style: styles.fields, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.field }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'r', value: this.props.rgb.r, onChange: this.handleChange }) ), _react2.default.createElement( 'div', { style: styles.field }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'g', value: this.props.rgb.g, onChange: this.handleChange }) ), _react2.default.createElement( 'div', { style: styles.field }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'b', value: this.props.rgb.b, onChange: this.handleChange }) ), _react2.default.createElement( 'div', { style: styles.alpha }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'a', value: this.props.rgb.a, arrowOffset: 0.01, onChange: this.handleChange }) ) ); } else if (this.state.view === 'hsl') { fields = _react2.default.createElement( 'div', { style: styles.fields, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.field }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'h', value: Math.round(this.props.hsl.h), onChange: this.handleChange }) ), _react2.default.createElement( 'div', { style: styles.field }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 's', value: Math.round(this.props.hsl.s * 100) + '%', onChange: this.handleChange }) ), _react2.default.createElement( 'div', { style: styles.field }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'l', value: Math.round(this.props.hsl.l * 100) + '%', onChange: this.handleChange }) ), _react2.default.createElement( 'div', { style: styles.alpha }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'a', value: this.props.hsl.a, arrowOffset: 0.01, onChange: this.handleChange }) ) ); } return _react2.default.createElement( 'div', { style: styles.wrap, className: 'flexbox-fix' }, fields, _react2.default.createElement( 'div', { style: styles.toggle }, _react2.default.createElement( 'div', { style: styles.icon, onClick: this.toggleViews, ref: function ref(icon) { return _this2.icon = icon; } }, _react2.default.createElement(_UnfoldMoreHorizontalIcon2.default, { style: styles.svg, onMouseOver: this.showHighlight, onMouseEnter: this.showHighlight, onMouseOut: this.hideHighlight }) ) ) ); } }], [{ key: 'getDerivedStateFromProps', value: function getDerivedStateFromProps(nextProps, state) { if (nextProps.hsl.a !== 1 && state.view === 'hex') { return { view: 'rgb' }; } return null; } }]); return ChromeFields; }(_react2.default.Component); ChromeFields.defaultProps = { view: "hex" }; exports.default = ChromeFields; },{"../../helpers/color":288,"../common":256,"@icons/material/UnfoldMoreHorizontalIcon":24,"lodash/isUndefined":217,"react":"react","reactcss":301}],244:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChromePointer = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ChromePointer = exports.ChromePointer = function ChromePointer() { var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '12px', height: '12px', borderRadius: '6px', transform: 'translate(-6px, -1px)', backgroundColor: 'rgb(248, 248, 248)', boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.37)' } } }); return _react2.default.createElement('div', { style: styles.picker }); }; exports.default = ChromePointer; },{"react":"react","reactcss":301}],245:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChromePointerCircle = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ChromePointerCircle = exports.ChromePointerCircle = function ChromePointerCircle() { var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '12px', height: '12px', borderRadius: '6px', boxShadow: 'inset 0 0 0 1px #fff', transform: 'translate(-6px, -6px)' } } }); return _react2.default.createElement('div', { style: styles.picker }); }; exports.default = ChromePointerCircle; },{"react":"react","reactcss":301}],246:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Circle = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _map = require('lodash/map'); var _map2 = _interopRequireDefault(_map); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _materialColors = require('material-colors'); var material = _interopRequireWildcard(_materialColors); var _common = require('../common'); var _CircleSwatch = require('./CircleSwatch'); var _CircleSwatch2 = _interopRequireDefault(_CircleSwatch); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Circle = exports.Circle = function Circle(_ref) { var width = _ref.width, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors = _ref.colors, hex = _ref.hex, circleSize = _ref.circleSize, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, circleSpacing = _ref.circleSpacing, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { card: { width: width, display: 'flex', flexWrap: 'wrap', marginRight: -circleSpacing, marginBottom: -circleSpacing } } }, passedStyles)); var handleChange = function handleChange(hexCode, e) { return onChange({ hex: hexCode, source: 'hex' }, e); }; return _react2.default.createElement( 'div', { style: styles.card, className: 'circle-picker ' + className }, (0, _map2.default)(colors, function (c) { return _react2.default.createElement(_CircleSwatch2.default, { key: c, color: c, onClick: handleChange, onSwatchHover: onSwatchHover, active: hex === c.toLowerCase(), circleSize: circleSize, circleSpacing: circleSpacing }); }) ); }; Circle.propTypes = { width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), circleSize: _propTypes2.default.number, circleSpacing: _propTypes2.default.number, styles: _propTypes2.default.object }; Circle.defaultProps = { width: 252, circleSize: 28, circleSpacing: 14, colors: [material.red['500'], material.pink['500'], material.purple['500'], material.deepPurple['500'], material.indigo['500'], material.blue['500'], material.lightBlue['500'], material.cyan['500'], material.teal['500'], material.green['500'], material.lightGreen['500'], material.lime['500'], material.yellow['500'], material.amber['500'], material.orange['500'], material.deepOrange['500'], material.brown['500'], material.blueGrey['500']], styles: {} }; exports.default = (0, _common.ColorWrap)(Circle); },{"../common":256,"./CircleSwatch":247,"lodash/map":220,"lodash/merge":222,"material-colors":231,"prop-types":236,"react":"react","reactcss":301}],247:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.CircleSwatch = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _common = require('../common'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var CircleSwatch = exports.CircleSwatch = function CircleSwatch(_ref) { var color = _ref.color, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover, hover = _ref.hover, active = _ref.active, circleSize = _ref.circleSize, circleSpacing = _ref.circleSpacing; var styles = (0, _reactcss2.default)({ 'default': { swatch: { width: circleSize, height: circleSize, marginRight: circleSpacing, marginBottom: circleSpacing, transform: 'scale(1)', transition: '100ms transform ease' }, Swatch: { borderRadius: '50%', background: 'transparent', boxShadow: 'inset 0 0 0 ' + (circleSize / 2 + 1) + 'px ' + color, transition: '100ms box-shadow ease' } }, 'hover': { swatch: { transform: 'scale(1.2)' } }, 'active': { Swatch: { boxShadow: 'inset 0 0 0 3px ' + color } } }, { hover: hover, active: active }); return _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement(_common.Swatch, { style: styles.Swatch, color: color, onClick: onClick, onHover: onSwatchHover, focusStyle: { boxShadow: styles.Swatch.boxShadow + ', 0 0 5px ' + color } }) ); }; CircleSwatch.defaultProps = { circleSize: 28, circleSpacing: 14 }; exports.default = (0, _reactcss.handleHover)(CircleSwatch); },{"../common":256,"react":"react","reactcss":301}],248:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Alpha = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _alpha = require('../../helpers/alpha'); var alpha = _interopRequireWildcard(_alpha); var _Checkboard = require('./Checkboard'); var _Checkboard2 = _interopRequireDefault(_Checkboard); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Alpha = exports.Alpha = function (_ref) { _inherits(Alpha, _ref); function Alpha() { var _ref2; var _temp, _this, _ret; _classCallCheck(this, Alpha); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = Alpha.__proto__ || Object.getPrototypeOf(Alpha)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function (e) { var change = alpha.calculateChange(e, _this.props.hsl, _this.props.direction, _this.props.a, _this.container); change && typeof _this.props.onChange === 'function' && _this.props.onChange(change, e); }, _this.handleMouseDown = function (e) { _this.handleChange(e); window.addEventListener('mousemove', _this.handleChange); window.addEventListener('mouseup', _this.handleMouseUp); }, _this.handleMouseUp = function () { _this.unbindEventListeners(); }, _this.unbindEventListeners = function () { window.removeEventListener('mousemove', _this.handleChange); window.removeEventListener('mouseup', _this.handleMouseUp); }, _temp), _possibleConstructorReturn(_this, _ret); } _createClass(Alpha, [{ key: 'componentWillUnmount', value: function componentWillUnmount() { this.unbindEventListeners(); } }, { key: 'render', value: function render() { var _this2 = this; var rgb = this.props.rgb; var styles = (0, _reactcss2.default)({ 'default': { alpha: { absolute: '0px 0px 0px 0px', borderRadius: this.props.radius }, checkboard: { absolute: '0px 0px 0px 0px', overflow: 'hidden', borderRadius: this.props.radius }, gradient: { absolute: '0px 0px 0px 0px', background: 'linear-gradient(to right, rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ', 0) 0%,\n rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ', 1) 100%)', boxShadow: this.props.shadow, borderRadius: this.props.radius }, container: { position: 'relative', height: '100%', margin: '0 3px' }, pointer: { position: 'absolute', left: rgb.a * 100 + '%' }, slider: { width: '4px', borderRadius: '1px', height: '8px', boxShadow: '0 0 2px rgba(0, 0, 0, .6)', background: '#fff', marginTop: '1px', transform: 'translateX(-2px)' } }, 'vertical': { gradient: { background: 'linear-gradient(to bottom, rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ', 0) 0%,\n rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ', 1) 100%)' }, pointer: { left: 0, top: rgb.a * 100 + '%' } }, 'overwrite': _extends({}, this.props.style) }, { vertical: this.props.direction === 'vertical', overwrite: true }); return _react2.default.createElement( 'div', { style: styles.alpha }, _react2.default.createElement( 'div', { style: styles.checkboard }, _react2.default.createElement(_Checkboard2.default, { renderers: this.props.renderers }) ), _react2.default.createElement('div', { style: styles.gradient }), _react2.default.createElement( 'div', { style: styles.container, ref: function ref(container) { return _this2.container = container; }, onMouseDown: this.handleMouseDown, onTouchMove: this.handleChange, onTouchStart: this.handleChange }, _react2.default.createElement( 'div', { style: styles.pointer }, this.props.pointer ? _react2.default.createElement(this.props.pointer, this.props) : _react2.default.createElement('div', { style: styles.slider }) ) ) ); } }]); return Alpha; }(_react.PureComponent || _react.Component); exports.default = Alpha; },{"../../helpers/alpha":286,"./Checkboard":249,"react":"react","reactcss":301}],249:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Checkboard = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _checkboard = require('../../helpers/checkboard'); var checkboard = _interopRequireWildcard(_checkboard); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Checkboard = exports.Checkboard = function Checkboard(_ref) { var white = _ref.white, grey = _ref.grey, size = _ref.size, renderers = _ref.renderers, borderRadius = _ref.borderRadius, boxShadow = _ref.boxShadow, children = _ref.children; var styles = (0, _reactcss2.default)({ 'default': { grid: { borderRadius: borderRadius, boxShadow: boxShadow, absolute: '0px 0px 0px 0px', background: 'url(' + checkboard.get(white, grey, size, renderers.canvas) + ') center left' } } }); return (0, _react.isValidElement)(children) ? _react2.default.cloneElement(children, _extends({}, children.props, { style: _extends({}, children.props.style, styles.grid) })) : _react2.default.createElement('div', { style: styles.grid }); }; Checkboard.defaultProps = { size: 8, white: 'transparent', grey: 'rgba(0,0,0,.08)', renderers: {} }; exports.default = Checkboard; },{"../../helpers/checkboard":287,"react":"react","reactcss":301}],250:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ColorWrap = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _debounce = require('lodash/debounce'); var _debounce2 = _interopRequireDefault(_debounce); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ColorWrap = exports.ColorWrap = function ColorWrap(Picker) { var ColorPicker = function (_ref) { _inherits(ColorPicker, _ref); function ColorPicker(props) { _classCallCheck(this, ColorPicker); var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this)); _this.handleChange = function (data, event) { var isValidColor = color.simpleCheckForValidColor(data); if (isValidColor) { var colors = color.toState(data, data.h || _this.state.oldHue); _this.setState(colors); _this.props.onChangeComplete && _this.debounce(_this.props.onChangeComplete, colors, event); _this.props.onChange && _this.props.onChange(colors, event); } }; _this.handleSwatchHover = function (data, event) { var isValidColor = color.simpleCheckForValidColor(data); if (isValidColor) { var colors = color.toState(data, data.h || _this.state.oldHue); _this.props.onSwatchHover && _this.props.onSwatchHover(colors, event); } }; _this.state = _extends({}, color.toState(props.color, 0)); _this.debounce = (0, _debounce2.default)(function (fn, data, event) { fn(data, event); }, 100); return _this; } _createClass(ColorPicker, [{ key: 'render', value: function render() { var optionalEvents = {}; if (this.props.onSwatchHover) { optionalEvents.onSwatchHover = this.handleSwatchHover; } return _react2.default.createElement(Picker, _extends({}, this.props, this.state, { onChange: this.handleChange }, optionalEvents)); } }], [{ key: 'getDerivedStateFromProps', value: function getDerivedStateFromProps(nextProps, state) { return _extends({}, color.toState(nextProps.color, state.oldHue)); } }]); return ColorPicker; }(_react.PureComponent || _react.Component); ColorPicker.propTypes = _extends({}, Picker.propTypes); ColorPicker.defaultProps = _extends({}, Picker.defaultProps, { color: { h: 250, s: 0.50, l: 0.20, a: 1 } }); return ColorPicker; }; exports.default = ColorWrap; },{"../../helpers/color":288,"lodash/debounce":194,"react":"react"}],251:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.EditableInput = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DEFAULT_ARROW_OFFSET = 1; var UP_KEY_CODE = 38; var DOWN_KEY_CODE = 40; var VALID_KEY_CODES = [UP_KEY_CODE, DOWN_KEY_CODE]; var isValidKeyCode = function isValidKeyCode(keyCode) { return VALID_KEY_CODES.indexOf(keyCode) > -1; }; var getNumberValue = function getNumberValue(value) { return Number(String(value).replace(/%/g, '')); }; var idCounter = 1; var EditableInput = exports.EditableInput = function (_ref) { _inherits(EditableInput, _ref); function EditableInput(props) { _classCallCheck(this, EditableInput); var _this = _possibleConstructorReturn(this, (EditableInput.__proto__ || Object.getPrototypeOf(EditableInput)).call(this)); _this.handleBlur = function () { if (_this.state.blurValue) { _this.setState({ value: _this.state.blurValue, blurValue: null }); } }; _this.handleChange = function (e) { _this.setUpdatedValue(e.target.value, e); }; _this.handleKeyDown = function (e) { // In case `e.target.value` is a percentage remove the `%` character // and update accordingly with a percentage // https://github.com/casesandberg/react-color/issues/383 var value = getNumberValue(e.target.value); if (!isNaN(value) && isValidKeyCode(e.keyCode)) { var offset = _this.getArrowOffset(); var updatedValue = e.keyCode === UP_KEY_CODE ? value + offset : value - offset; _this.setUpdatedValue(updatedValue, e); } }; _this.handleDrag = function (e) { if (_this.props.dragLabel) { var newValue = Math.round(_this.props.value + e.movementX); if (newValue >= 0 && newValue <= _this.props.dragMax) { _this.props.onChange && _this.props.onChange(_this.getValueObjectWithLabel(newValue), e); } } }; _this.handleMouseDown = function (e) { if (_this.props.dragLabel) { e.preventDefault(); _this.handleDrag(e); window.addEventListener('mousemove', _this.handleDrag); window.addEventListener('mouseup', _this.handleMouseUp); } }; _this.handleMouseUp = function () { _this.unbindEventListeners(); }; _this.unbindEventListeners = function () { window.removeEventListener('mousemove', _this.handleDrag); window.removeEventListener('mouseup', _this.handleMouseUp); }; _this.state = { value: String(props.value).toUpperCase(), blurValue: String(props.value).toUpperCase() }; _this.inputId = 'rc-editable-input-' + idCounter++; return _this; } _createClass(EditableInput, [{ key: 'componentDidUpdate', value: function componentDidUpdate(prevProps, prevState) { if (this.props.value !== this.state.value && (prevProps.value !== this.props.value || prevState.value !== this.state.value)) { if (this.input === document.activeElement) { this.setState({ blurValue: String(this.props.value).toUpperCase() }); } else { this.setState({ value: String(this.props.value).toUpperCase(), blurValue: !this.state.blurValue && String(this.props.value).toUpperCase() }); } } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.unbindEventListeners(); } }, { key: 'getValueObjectWithLabel', value: function getValueObjectWithLabel(value) { return _defineProperty({}, this.props.label, value); } }, { key: 'getArrowOffset', value: function getArrowOffset() { return this.props.arrowOffset || DEFAULT_ARROW_OFFSET; } }, { key: 'setUpdatedValue', value: function setUpdatedValue(value, e) { var onChangeValue = this.props.label ? this.getValueObjectWithLabel(value) : value; this.props.onChange && this.props.onChange(onChangeValue, e); this.setState({ value: value }); } }, { key: 'render', value: function render() { var _this2 = this; var styles = (0, _reactcss2.default)({ 'default': { wrap: { position: 'relative' } }, 'user-override': { wrap: this.props.style && this.props.style.wrap ? this.props.style.wrap : {}, input: this.props.style && this.props.style.input ? this.props.style.input : {}, label: this.props.style && this.props.style.label ? this.props.style.label : {} }, 'dragLabel-true': { label: { cursor: 'ew-resize' } } }, { 'user-override': true }, this.props); return _react2.default.createElement( 'div', { style: styles.wrap }, _react2.default.createElement('input', { id: this.inputId, style: styles.input, ref: function ref(input) { return _this2.input = input; }, value: this.state.value, onKeyDown: this.handleKeyDown, onChange: this.handleChange, onBlur: this.handleBlur, placeholder: this.props.placeholder, spellCheck: 'false' }), this.props.label && !this.props.hideLabel ? _react2.default.createElement( 'label', { htmlFor: this.inputId, style: styles.label, onMouseDown: this.handleMouseDown }, this.props.label ) : null ); } }]); return EditableInput; }(_react.PureComponent || _react.Component); exports.default = EditableInput; },{"react":"react","reactcss":301}],252:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Hue = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _hue = require('../../helpers/hue'); var hue = _interopRequireWildcard(_hue); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Hue = exports.Hue = function (_ref) { _inherits(Hue, _ref); function Hue() { var _ref2; var _temp, _this, _ret; _classCallCheck(this, Hue); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = Hue.__proto__ || Object.getPrototypeOf(Hue)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function (e) { var change = hue.calculateChange(e, _this.props.direction, _this.props.hsl, _this.container); change && typeof _this.props.onChange === 'function' && _this.props.onChange(change, e); }, _this.handleMouseDown = function (e) { _this.handleChange(e); window.addEventListener('mousemove', _this.handleChange); window.addEventListener('mouseup', _this.handleMouseUp); }, _this.handleMouseUp = function () { _this.unbindEventListeners(); }, _temp), _possibleConstructorReturn(_this, _ret); } _createClass(Hue, [{ key: 'componentWillUnmount', value: function componentWillUnmount() { this.unbindEventListeners(); } }, { key: 'unbindEventListeners', value: function unbindEventListeners() { window.removeEventListener('mousemove', this.handleChange); window.removeEventListener('mouseup', this.handleMouseUp); } }, { key: 'render', value: function render() { var _this2 = this; var _props$direction = this.props.direction, direction = _props$direction === undefined ? 'horizontal' : _props$direction; var styles = (0, _reactcss2.default)({ 'default': { hue: { absolute: '0px 0px 0px 0px', borderRadius: this.props.radius, boxShadow: this.props.shadow }, container: { padding: '0 2px', position: 'relative', height: '100%', borderRadius: this.props.radius }, pointer: { position: 'absolute', left: this.props.hsl.h * 100 / 360 + '%' }, slider: { marginTop: '1px', width: '4px', borderRadius: '1px', height: '8px', boxShadow: '0 0 2px rgba(0, 0, 0, .6)', background: '#fff', transform: 'translateX(-2px)' } }, 'vertical': { pointer: { left: '0px', top: -(this.props.hsl.h * 100 / 360) + 100 + '%' } } }, { vertical: direction === 'vertical' }); return _react2.default.createElement( 'div', { style: styles.hue }, _react2.default.createElement( 'div', { className: 'hue-' + direction, style: styles.container, ref: function ref(container) { return _this2.container = container; }, onMouseDown: this.handleMouseDown, onTouchMove: this.handleChange, onTouchStart: this.handleChange }, _react2.default.createElement( 'style', null, '\n .hue-horizontal {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0\n 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to right, #f00 0%, #ff0\n 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n\n .hue-vertical {\n background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,\n #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,\n #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n ' ), _react2.default.createElement( 'div', { style: styles.pointer }, this.props.pointer ? _react2.default.createElement(this.props.pointer, this.props) : _react2.default.createElement('div', { style: styles.slider }) ) ) ); } }]); return Hue; }(_react.PureComponent || _react.Component); exports.default = Hue; },{"../../helpers/hue":289,"react":"react","reactcss":301}],253:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Raised = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Raised = exports.Raised = function Raised(_ref) { var zDepth = _ref.zDepth, radius = _ref.radius, background = _ref.background, children = _ref.children, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { wrap: { position: 'relative', display: 'inline-block' }, content: { position: 'relative' }, bg: { absolute: '0px 0px 0px 0px', boxShadow: '0 ' + zDepth + 'px ' + zDepth * 4 + 'px rgba(0,0,0,.24)', borderRadius: radius, background: background } }, 'zDepth-0': { bg: { boxShadow: 'none' } }, 'zDepth-1': { bg: { boxShadow: '0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)' } }, 'zDepth-2': { bg: { boxShadow: '0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)' } }, 'zDepth-3': { bg: { boxShadow: '0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)' } }, 'zDepth-4': { bg: { boxShadow: '0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)' } }, 'zDepth-5': { bg: { boxShadow: '0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)' } }, 'square': { bg: { borderRadius: '0' } }, 'circle': { bg: { borderRadius: '50%' } } }, passedStyles), { 'zDepth-1': zDepth === 1 }); return _react2.default.createElement( 'div', { style: styles.wrap }, _react2.default.createElement('div', { style: styles.bg }), _react2.default.createElement( 'div', { style: styles.content }, children ) ); }; Raised.propTypes = { background: _propTypes2.default.string, zDepth: _propTypes2.default.oneOf([0, 1, 2, 3, 4, 5]), radius: _propTypes2.default.number, styles: _propTypes2.default.object }; Raised.defaultProps = { background: '#fff', zDepth: 1, radius: 2, styles: {} }; exports.default = Raised; },{"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],254:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Saturation = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _throttle = require('lodash/throttle'); var _throttle2 = _interopRequireDefault(_throttle); var _saturation = require('../../helpers/saturation'); var saturation = _interopRequireWildcard(_saturation); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Saturation = exports.Saturation = function (_ref) { _inherits(Saturation, _ref); function Saturation(props) { _classCallCheck(this, Saturation); var _this = _possibleConstructorReturn(this, (Saturation.__proto__ || Object.getPrototypeOf(Saturation)).call(this, props)); _this.handleChange = function (e) { typeof _this.props.onChange === 'function' && _this.throttle(_this.props.onChange, saturation.calculateChange(e, _this.props.hsl, _this.container), e); }; _this.handleMouseDown = function (e) { _this.handleChange(e); var renderWindow = _this.getContainerRenderWindow(); renderWindow.addEventListener('mousemove', _this.handleChange); renderWindow.addEventListener('mouseup', _this.handleMouseUp); }; _this.handleMouseUp = function () { _this.unbindEventListeners(); }; _this.throttle = (0, _throttle2.default)(function (fn, data, e) { fn(data, e); }, 50); return _this; } _createClass(Saturation, [{ key: 'componentWillUnmount', value: function componentWillUnmount() { this.throttle.cancel(); this.unbindEventListeners(); } }, { key: 'getContainerRenderWindow', value: function getContainerRenderWindow() { var container = this.container; var renderWindow = window; while (!renderWindow.document.contains(container) && renderWindow.parent !== renderWindow) { renderWindow = renderWindow.parent; } return renderWindow; } }, { key: 'unbindEventListeners', value: function unbindEventListeners() { var renderWindow = this.getContainerRenderWindow(); renderWindow.removeEventListener('mousemove', this.handleChange); renderWindow.removeEventListener('mouseup', this.handleMouseUp); } }, { key: 'render', value: function render() { var _this2 = this; var _ref2 = this.props.style || {}, color = _ref2.color, white = _ref2.white, black = _ref2.black, pointer = _ref2.pointer, circle = _ref2.circle; var styles = (0, _reactcss2.default)({ 'default': { color: { absolute: '0px 0px 0px 0px', background: 'hsl(' + this.props.hsl.h + ',100%, 50%)', borderRadius: this.props.radius }, white: { absolute: '0px 0px 0px 0px', borderRadius: this.props.radius }, black: { absolute: '0px 0px 0px 0px', boxShadow: this.props.shadow, borderRadius: this.props.radius }, pointer: { position: 'absolute', top: -(this.props.hsv.v * 100) + 100 + '%', left: this.props.hsv.s * 100 + '%', cursor: 'default' }, circle: { width: '4px', height: '4px', boxShadow: '0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),\n 0 0 1px 2px rgba(0,0,0,.4)', borderRadius: '50%', cursor: 'hand', transform: 'translate(-2px, -2px)' } }, 'custom': { color: color, white: white, black: black, pointer: pointer, circle: circle } }, { 'custom': !!this.props.style }); return _react2.default.createElement( 'div', { style: styles.color, ref: function ref(container) { return _this2.container = container; }, onMouseDown: this.handleMouseDown, onTouchMove: this.handleChange, onTouchStart: this.handleChange }, _react2.default.createElement( 'style', null, '\n .saturation-white {\n background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));\n background: linear-gradient(to right, #fff, rgba(255,255,255,0));\n }\n .saturation-black {\n background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));\n background: linear-gradient(to top, #000, rgba(0,0,0,0));\n }\n ' ), _react2.default.createElement( 'div', { style: styles.white, className: 'saturation-white' }, _react2.default.createElement('div', { style: styles.black, className: 'saturation-black' }), _react2.default.createElement( 'div', { style: styles.pointer }, this.props.pointer ? _react2.default.createElement(this.props.pointer, this.props) : _react2.default.createElement('div', { style: styles.circle }) ) ) ); } }]); return Saturation; }(_react.PureComponent || _react.Component); exports.default = Saturation; },{"../../helpers/saturation":291,"lodash/throttle":227,"react":"react","reactcss":301}],255:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Swatch = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _interaction = require('../../helpers/interaction'); var _Checkboard = require('./Checkboard'); var _Checkboard2 = _interopRequireDefault(_Checkboard); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ENTER = 13; var Swatch = exports.Swatch = function Swatch(_ref) { var color = _ref.color, style = _ref.style, _ref$onClick = _ref.onClick, onClick = _ref$onClick === undefined ? function () {} : _ref$onClick, onHover = _ref.onHover, _ref$title = _ref.title, title = _ref$title === undefined ? color : _ref$title, children = _ref.children, focus = _ref.focus, _ref$focusStyle = _ref.focusStyle, focusStyle = _ref$focusStyle === undefined ? {} : _ref$focusStyle; var transparent = color === 'transparent'; var styles = (0, _reactcss2.default)({ default: { swatch: _extends({ background: color, height: '100%', width: '100%', cursor: 'pointer', position: 'relative', outline: 'none' }, style, focus ? focusStyle : {}) } }); var handleClick = function handleClick(e) { return onClick(color, e); }; var handleKeyDown = function handleKeyDown(e) { return e.keyCode === ENTER && onClick(color, e); }; var handleHover = function handleHover(e) { return onHover(color, e); }; var optionalEvents = {}; if (onHover) { optionalEvents.onMouseOver = handleHover; } return _react2.default.createElement( 'div', _extends({ style: styles.swatch, onClick: handleClick, title: title, tabIndex: 0, onKeyDown: handleKeyDown }, optionalEvents), children, transparent && _react2.default.createElement(_Checkboard2.default, { borderRadius: styles.swatch.borderRadius, boxShadow: 'inset 0 0 0 1px rgba(0,0,0,0.1)' }) ); }; exports.default = (0, _interaction.handleFocus)(Swatch); },{"../../helpers/interaction":290,"./Checkboard":249,"react":"react","reactcss":301}],256:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Alpha = require('./Alpha'); Object.defineProperty(exports, 'Alpha', { enumerable: true, get: function get() { return _interopRequireDefault(_Alpha).default; } }); var _Checkboard = require('./Checkboard'); Object.defineProperty(exports, 'Checkboard', { enumerable: true, get: function get() { return _interopRequireDefault(_Checkboard).default; } }); var _EditableInput = require('./EditableInput'); Object.defineProperty(exports, 'EditableInput', { enumerable: true, get: function get() { return _interopRequireDefault(_EditableInput).default; } }); var _Hue = require('./Hue'); Object.defineProperty(exports, 'Hue', { enumerable: true, get: function get() { return _interopRequireDefault(_Hue).default; } }); var _Raised = require('./Raised'); Object.defineProperty(exports, 'Raised', { enumerable: true, get: function get() { return _interopRequireDefault(_Raised).default; } }); var _Saturation = require('./Saturation'); Object.defineProperty(exports, 'Saturation', { enumerable: true, get: function get() { return _interopRequireDefault(_Saturation).default; } }); var _ColorWrap = require('./ColorWrap'); Object.defineProperty(exports, 'ColorWrap', { enumerable: true, get: function get() { return _interopRequireDefault(_ColorWrap).default; } }); var _Swatch = require('./Swatch'); Object.defineProperty(exports, 'Swatch', { enumerable: true, get: function get() { return _interopRequireDefault(_Swatch).default; } }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } },{"./Alpha":248,"./Checkboard":249,"./ColorWrap":250,"./EditableInput":251,"./Hue":252,"./Raised":253,"./Saturation":254,"./Swatch":255}],257:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Compact = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _map = require('lodash/map'); var _map2 = _interopRequireDefault(_map); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _common = require('../common'); var _CompactColor = require('./CompactColor'); var _CompactColor2 = _interopRequireDefault(_CompactColor); var _CompactFields = require('./CompactFields'); var _CompactFields2 = _interopRequireDefault(_CompactFields); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Compact = exports.Compact = function Compact(_ref) { var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors = _ref.colors, hex = _ref.hex, rgb = _ref.rgb, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { Compact: { background: '#f6f6f6', radius: '4px' }, compact: { paddingTop: '5px', paddingLeft: '5px', boxSizing: 'initial', width: '240px' }, clear: { clear: 'both' } } }, passedStyles)); var handleChange = function handleChange(data, e) { if (data.hex) { color.isValidHex(data.hex) && onChange({ hex: data.hex, source: 'hex' }, e); } else { onChange(data, e); } }; return _react2.default.createElement( _common.Raised, { style: styles.Compact, styles: passedStyles }, _react2.default.createElement( 'div', { style: styles.compact, className: 'compact-picker ' + className }, _react2.default.createElement( 'div', null, (0, _map2.default)(colors, function (c) { return _react2.default.createElement(_CompactColor2.default, { key: c, color: c, active: c.toLowerCase() === hex, onClick: handleChange, onSwatchHover: onSwatchHover }); }), _react2.default.createElement('div', { style: styles.clear }) ), _react2.default.createElement(_CompactFields2.default, { hex: hex, rgb: rgb, onChange: handleChange }) ) ); }; Compact.propTypes = { colors: _propTypes2.default.arrayOf(_propTypes2.default.string), styles: _propTypes2.default.object }; Compact.defaultProps = { colors: ['#4D4D4D', '#999999', '#FFFFFF', '#F44E3B', '#FE9200', '#FCDC00', '#DBDF00', '#A4DD00', '#68CCCA', '#73D8FF', '#AEA1FF', '#FDA1FF', '#333333', '#808080', '#cccccc', '#D33115', '#E27300', '#FCC400', '#B0BC00', '#68BC00', '#16A5A5', '#009CE0', '#7B64FF', '#FA28FF', '#000000', '#666666', '#B3B3B3', '#9F0500', '#C45100', '#FB9E00', '#808900', '#194D33', '#0C797D', '#0062B1', '#653294', '#AB149E'], styles: {} }; exports.default = (0, _common.ColorWrap)(Compact); },{"../../helpers/color":288,"../common":256,"./CompactColor":258,"./CompactFields":259,"lodash/map":220,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],258:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.CompactColor = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _color = require('../../helpers/color'); var colorUtils = _interopRequireWildcard(_color); var _common = require('../common'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var CompactColor = exports.CompactColor = function CompactColor(_ref) { var color = _ref.color, _ref$onClick = _ref.onClick, onClick = _ref$onClick === undefined ? function () {} : _ref$onClick, onSwatchHover = _ref.onSwatchHover, active = _ref.active; var styles = (0, _reactcss2.default)({ 'default': { color: { background: color, width: '15px', height: '15px', float: 'left', marginRight: '5px', marginBottom: '5px', position: 'relative', cursor: 'pointer' }, dot: { absolute: '5px 5px 5px 5px', background: colorUtils.getContrastingColor(color), borderRadius: '50%', opacity: '0' } }, 'active': { dot: { opacity: '1' } }, 'color-#FFFFFF': { color: { boxShadow: 'inset 0 0 0 1px #ddd' }, dot: { background: '#000' } }, 'transparent': { dot: { background: '#000' } } }, { active: active, 'color-#FFFFFF': color === '#FFFFFF', 'transparent': color === 'transparent' }); return _react2.default.createElement( _common.Swatch, { style: styles.color, color: color, onClick: onClick, onHover: onSwatchHover, focusStyle: { boxShadow: '0 0 4px ' + color } }, _react2.default.createElement('div', { style: styles.dot }) ); }; exports.default = CompactColor; },{"../../helpers/color":288,"../common":256,"react":"react","reactcss":301}],259:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.CompactFields = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _common = require('../common'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var CompactFields = exports.CompactFields = function CompactFields(_ref) { var hex = _ref.hex, rgb = _ref.rgb, onChange = _ref.onChange; var styles = (0, _reactcss2.default)({ 'default': { fields: { display: 'flex', paddingBottom: '6px', paddingRight: '5px', position: 'relative' }, active: { position: 'absolute', top: '6px', left: '5px', height: '9px', width: '9px', background: hex }, HEXwrap: { flex: '6', position: 'relative' }, HEXinput: { width: '80%', padding: '0px', paddingLeft: '20%', border: 'none', outline: 'none', background: 'none', fontSize: '12px', color: '#333', height: '16px' }, HEXlabel: { display: 'none' }, RGBwrap: { flex: '3', position: 'relative' }, RGBinput: { width: '70%', padding: '0px', paddingLeft: '30%', border: 'none', outline: 'none', background: 'none', fontSize: '12px', color: '#333', height: '16px' }, RGBlabel: { position: 'absolute', top: '3px', left: '0px', lineHeight: '16px', textTransform: 'uppercase', fontSize: '12px', color: '#999' } } }); var handleChange = function handleChange(data, e) { if (data.r || data.g || data.b) { onChange({ r: data.r || rgb.r, g: data.g || rgb.g, b: data.b || rgb.b, source: 'rgb' }, e); } else { onChange({ hex: data.hex, source: 'hex' }, e); } }; return _react2.default.createElement( 'div', { style: styles.fields, className: 'flexbox-fix' }, _react2.default.createElement('div', { style: styles.active }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.HEXwrap, input: styles.HEXinput, label: styles.HEXlabel }, label: 'hex', value: hex, onChange: handleChange }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'r', value: rgb.r, onChange: handleChange }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'g', value: rgb.g, onChange: handleChange }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'b', value: rgb.b, onChange: handleChange }) ); }; exports.default = CompactFields; },{"../common":256,"react":"react","reactcss":301}],260:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Github = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _map = require('lodash/map'); var _map2 = _interopRequireDefault(_map); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _common = require('../common'); var _GithubSwatch = require('./GithubSwatch'); var _GithubSwatch2 = _interopRequireDefault(_GithubSwatch); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Github = exports.Github = function Github(_ref) { var width = _ref.width, colors = _ref.colors, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { card: { width: width, background: '#fff', border: '1px solid rgba(0,0,0,0.2)', boxShadow: '0 3px 12px rgba(0,0,0,0.15)', borderRadius: '4px', position: 'relative', padding: '5px', display: 'flex', flexWrap: 'wrap' }, triangle: { position: 'absolute', border: '7px solid transparent', borderBottomColor: '#fff' }, triangleShadow: { position: 'absolute', border: '8px solid transparent', borderBottomColor: 'rgba(0,0,0,0.15)' } }, 'hide-triangle': { triangle: { display: 'none' }, triangleShadow: { display: 'none' } }, 'top-left-triangle': { triangle: { top: '-14px', left: '10px' }, triangleShadow: { top: '-16px', left: '9px' } }, 'top-right-triangle': { triangle: { top: '-14px', right: '10px' }, triangleShadow: { top: '-16px', right: '9px' } }, 'bottom-left-triangle': { triangle: { top: '35px', left: '10px', transform: 'rotate(180deg)' }, triangleShadow: { top: '37px', left: '9px', transform: 'rotate(180deg)' } }, 'bottom-right-triangle': { triangle: { top: '35px', right: '10px', transform: 'rotate(180deg)' }, triangleShadow: { top: '37px', right: '9px', transform: 'rotate(180deg)' } } }, passedStyles), { 'hide-triangle': triangle === 'hide', 'top-left-triangle': triangle === 'top-left', 'top-right-triangle': triangle === 'top-right', 'bottom-left-triangle': triangle === 'bottom-left', 'bottom-right-triangle': triangle === 'bottom-right' }); var handleChange = function handleChange(hex, e) { return onChange({ hex: hex, source: 'hex' }, e); }; return _react2.default.createElement( 'div', { style: styles.card, className: 'github-picker ' + className }, _react2.default.createElement('div', { style: styles.triangleShadow }), _react2.default.createElement('div', { style: styles.triangle }), (0, _map2.default)(colors, function (c) { return _react2.default.createElement(_GithubSwatch2.default, { color: c, key: c, onClick: handleChange, onSwatchHover: onSwatchHover }); }) ); }; Github.propTypes = { width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), colors: _propTypes2.default.arrayOf(_propTypes2.default.string), triangle: _propTypes2.default.oneOf(['hide', 'top-left', 'top-right', 'bottom-left', 'bottom-right']), styles: _propTypes2.default.object }; Github.defaultProps = { width: 200, colors: ['#B80000', '#DB3E00', '#FCCB00', '#008B02', '#006B76', '#1273DE', '#004DCF', '#5300EB', '#EB9694', '#FAD0C3', '#FEF3BD', '#C1E1C5', '#BEDADC', '#C4DEF6', '#BED3F3', '#D4C4FB'], triangle: 'top-left', styles: {} }; exports.default = (0, _common.ColorWrap)(Github); },{"../common":256,"./GithubSwatch":261,"lodash/map":220,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],261:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.GithubSwatch = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _common = require('../common'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var GithubSwatch = exports.GithubSwatch = function GithubSwatch(_ref) { var hover = _ref.hover, color = _ref.color, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover; var hoverSwatch = { position: 'relative', zIndex: '2', outline: '2px solid #fff', boxShadow: '0 0 5px 2px rgba(0,0,0,0.25)' }; var styles = (0, _reactcss2.default)({ 'default': { swatch: { width: '25px', height: '25px', fontSize: '0' } }, 'hover': { swatch: hoverSwatch } }, { hover: hover }); return _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement(_common.Swatch, { color: color, onClick: onClick, onHover: onSwatchHover, focusStyle: hoverSwatch }) ); }; exports.default = (0, _reactcss.handleHover)(GithubSwatch); },{"../common":256,"react":"react","reactcss":301}],262:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Google = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _common = require('../common'); var _GooglePointerCircle = require('./GooglePointerCircle'); var _GooglePointerCircle2 = _interopRequireDefault(_GooglePointerCircle); var _GooglePointer = require('./GooglePointer'); var _GooglePointer2 = _interopRequireDefault(_GooglePointer); var _GoogleFields = require('./GoogleFields'); var _GoogleFields2 = _interopRequireDefault(_GoogleFields); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Google = exports.Google = function Google(_ref) { var width = _ref.width, onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hsv = _ref.hsv, hex = _ref.hex, header = _ref.header, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { picker: { width: width, background: '#fff', border: '1px solid #dfe1e5', boxSizing: 'initial', display: 'flex', flexWrap: 'wrap', borderRadius: '8px 8px 0px 0px' }, head: { height: '57px', width: '100%', paddingTop: '16px', paddingBottom: '16px', paddingLeft: '16px', fontSize: '20px', boxSizing: 'border-box', fontFamily: 'Roboto-Regular,HelveticaNeue,Arial,sans-serif' }, saturation: { width: '70%', padding: '0px', position: 'relative', overflow: 'hidden' }, swatch: { width: '30%', height: '228px', padding: '0px', background: 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', 1)', position: 'relative', overflow: 'hidden' }, body: { margin: 'auto', width: '95%' }, controls: { display: 'flex', boxSizing: 'border-box', height: '52px', paddingTop: '22px' }, color: { width: '32px' }, hue: { height: '8px', position: 'relative', margin: '0px 16px 0px 16px', width: '100%' }, Hue: { radius: '2px' } } }, passedStyles)); return _react2.default.createElement( 'div', { style: styles.picker, className: 'google-picker ' + className }, _react2.default.createElement( 'div', { style: styles.head }, header ), _react2.default.createElement('div', { style: styles.swatch }), _react2.default.createElement( 'div', { style: styles.saturation }, _react2.default.createElement(_common.Saturation, { hsl: hsl, hsv: hsv, pointer: _GooglePointerCircle2.default, onChange: onChange }) ), _react2.default.createElement( 'div', { style: styles.body }, _react2.default.createElement( 'div', { style: styles.controls, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.hue }, _react2.default.createElement(_common.Hue, { style: styles.Hue, hsl: hsl, radius: '4px', pointer: _GooglePointer2.default, onChange: onChange }) ) ), _react2.default.createElement(_GoogleFields2.default, { rgb: rgb, hsl: hsl, hex: hex, hsv: hsv, onChange: onChange }) ) ); }; Google.propTypes = { width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), styles: _propTypes2.default.object, header: _propTypes2.default.string }; Google.defaultProps = { width: 652, styles: {}, header: 'Color picker' }; exports.default = (0, _common.ColorWrap)(Google); },{"../common":256,"./GoogleFields":263,"./GooglePointer":264,"./GooglePointerCircle":265,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],263:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.GoogleFields = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _common = require('../common'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var GoogleFields = exports.GoogleFields = function GoogleFields(_ref) { var onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hex = _ref.hex, hsv = _ref.hsv; var handleChange = function handleChange(data, e) { if (data.hex) { color.isValidHex(data.hex) && onChange({ hex: data.hex, source: 'hex' }, e); } else if (data.rgb) { var values = data.rgb.split(','); color.isvalidColorString(data.rgb, 'rgb') && onChange({ r: values[0], g: values[1], b: values[2], a: 1, source: 'rgb' }, e); } else if (data.hsv) { var _values = data.hsv.split(','); if (color.isvalidColorString(data.hsv, 'hsv')) { _values[2] = _values[2].replace('%', ''); _values[1] = _values[1].replace('%', ''); _values[0] = _values[0].replace('°', ''); if (_values[1] == 1) { _values[1] = 0.01; } else if (_values[2] == 1) { _values[2] = 0.01; } onChange({ h: Number(_values[0]), s: Number(_values[1]), v: Number(_values[2]), source: 'hsv' }, e); } } else if (data.hsl) { var _values2 = data.hsl.split(','); if (color.isvalidColorString(data.hsl, 'hsl')) { _values2[2] = _values2[2].replace('%', ''); _values2[1] = _values2[1].replace('%', ''); _values2[0] = _values2[0].replace('°', ''); if (hsvValue[1] == 1) { hsvValue[1] = 0.01; } else if (hsvValue[2] == 1) { hsvValue[2] = 0.01; } onChange({ h: Number(_values2[0]), s: Number(_values2[1]), v: Number(_values2[2]), source: 'hsl' }, e); } } }; var styles = (0, _reactcss2.default)({ 'default': { wrap: { display: 'flex', height: '100px', marginTop: '4px' }, fields: { width: '100%' }, column: { paddingTop: '10px', display: 'flex', justifyContent: 'space-between' }, double: { padding: '0px 4.4px', boxSizing: 'border-box' }, input: { width: '100%', height: '38px', boxSizing: 'border-box', padding: '4px 10% 3px', textAlign: 'center', border: '1px solid #dadce0', fontSize: '11px', textTransform: 'lowercase', borderRadius: '5px', outline: 'none', fontFamily: 'Roboto,Arial,sans-serif' }, input2: { height: '38px', width: '100%', border: '1px solid #dadce0', boxSizing: 'border-box', fontSize: '11px', textTransform: 'lowercase', borderRadius: '5px', outline: 'none', paddingLeft: '10px', fontFamily: 'Roboto,Arial,sans-serif' }, label: { textAlign: 'center', fontSize: '12px', background: '#fff', position: 'absolute', textTransform: 'uppercase', color: '#3c4043', width: '35px', top: '-6px', left: '0', right: '0', marginLeft: 'auto', marginRight: 'auto', fontFamily: 'Roboto,Arial,sans-serif' }, label2: { left: '10px', textAlign: 'center', fontSize: '12px', background: '#fff', position: 'absolute', textTransform: 'uppercase', color: '#3c4043', width: '32px', top: '-6px', fontFamily: 'Roboto,Arial,sans-serif' }, single: { flexGrow: '1', margin: '0px 4.4px' } } }); var rgbValue = rgb.r + ', ' + rgb.g + ', ' + rgb.b; var hslValue = Math.round(hsl.h) + '\xB0, ' + Math.round(hsl.s * 100) + '%, ' + Math.round(hsl.l * 100) + '%'; var hsvValue = Math.round(hsv.h) + '\xB0, ' + Math.round(hsv.s * 100) + '%, ' + Math.round(hsv.v * 100) + '%'; return _react2.default.createElement( 'div', { style: styles.wrap, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.fields }, _react2.default.createElement( 'div', { style: styles.double }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'hex', value: hex, onChange: handleChange }) ), _react2.default.createElement( 'div', { style: styles.column }, _react2.default.createElement( 'div', { style: styles.single }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input2, label: styles.label2 }, label: 'rgb', value: rgbValue, onChange: handleChange }) ), _react2.default.createElement( 'div', { style: styles.single }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input2, label: styles.label2 }, label: 'hsv', value: hsvValue, onChange: handleChange }) ), _react2.default.createElement( 'div', { style: styles.single }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input2, label: styles.label2 }, label: 'hsl', value: hslValue, onChange: handleChange }) ) ) ) ); }; exports.default = GoogleFields; },{"../../helpers/color":288,"../common":256,"react":"react","reactcss":301}],264:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.GooglePointer = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var GooglePointer = exports.GooglePointer = function GooglePointer(props) { var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '20px', height: '20px', borderRadius: '22px', transform: 'translate(-10px, -7px)', background: 'hsl(' + Math.round(props.hsl.h) + ', 100%, 50%)', border: '2px white solid' } } }); return _react2.default.createElement('div', { style: styles.picker }); }; GooglePointer.propTypes = { hsl: _propTypes2.default.shape({ h: _propTypes2.default.number, s: _propTypes2.default.number, l: _propTypes2.default.number, a: _propTypes2.default.number }) }; GooglePointer.defaultProps = { hsl: { a: 1, h: 249.94, l: 0.2, s: 0.50 } }; exports.default = GooglePointer; },{"prop-types":236,"react":"react","reactcss":301}],265:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.GooglePointerCircle = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var GooglePointerCircle = exports.GooglePointerCircle = function GooglePointerCircle(props) { var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '20px', height: '20px', borderRadius: '22px', border: '2px #fff solid', transform: 'translate(-12px, -13px)', background: 'hsl(' + Math.round(props.hsl.h) + ', ' + Math.round(props.hsl.s * 100) + '%, ' + Math.round(props.hsl.l * 100) + '%)' } } }); return _react2.default.createElement('div', { style: styles.picker }); }; GooglePointerCircle.propTypes = { hsl: _propTypes2.default.shape({ h: _propTypes2.default.number, s: _propTypes2.default.number, l: _propTypes2.default.number, a: _propTypes2.default.number }) }; GooglePointerCircle.defaultProps = { hsl: { a: 1, h: 249.94, l: 0.2, s: 0.50 } }; exports.default = GooglePointerCircle; },{"prop-types":236,"react":"react","reactcss":301}],266:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.HuePicker = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _common = require('../common'); var _HuePointer = require('./HuePointer'); var _HuePointer2 = _interopRequireDefault(_HuePointer); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var HuePicker = exports.HuePicker = function HuePicker(_ref) { var width = _ref.width, height = _ref.height, onChange = _ref.onChange, hsl = _ref.hsl, direction = _ref.direction, pointer = _ref.pointer, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { picker: { position: 'relative', width: width, height: height }, hue: { radius: '2px' } } }, passedStyles)); // Overwrite to provide pure hue color var handleChange = function handleChange(data) { return onChange({ a: 1, h: data.h, l: 0.5, s: 1 }); }; return _react2.default.createElement( 'div', { style: styles.picker, className: 'hue-picker ' + className }, _react2.default.createElement(_common.Hue, _extends({}, styles.hue, { hsl: hsl, pointer: pointer, onChange: handleChange, direction: direction })) ); }; HuePicker.propTypes = { styles: _propTypes2.default.object }; HuePicker.defaultProps = { width: '316px', height: '16px', direction: 'horizontal', pointer: _HuePointer2.default, styles: {} }; exports.default = (0, _common.ColorWrap)(HuePicker); },{"../common":256,"./HuePointer":267,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],267:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SliderPointer = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var SliderPointer = exports.SliderPointer = function SliderPointer(_ref) { var direction = _ref.direction; var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '18px', height: '18px', borderRadius: '50%', transform: 'translate(-9px, -1px)', backgroundColor: 'rgb(248, 248, 248)', boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.37)' } }, 'vertical': { picker: { transform: 'translate(-3px, -9px)' } } }, { vertical: direction === 'vertical' }); return _react2.default.createElement('div', { style: styles.picker }); }; exports.default = SliderPointer; },{"react":"react","reactcss":301}],268:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Material = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _common = require('../common'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Material = exports.Material = function Material(_ref) { var onChange = _ref.onChange, hex = _ref.hex, rgb = _ref.rgb, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { material: { width: '98px', height: '98px', padding: '16px', fontFamily: 'Roboto' }, HEXwrap: { position: 'relative' }, HEXinput: { width: '100%', marginTop: '12px', fontSize: '15px', color: '#333', padding: '0px', border: '0px', borderBottom: '2px solid ' + hex, outline: 'none', height: '30px' }, HEXlabel: { position: 'absolute', top: '0px', left: '0px', fontSize: '11px', color: '#999999', textTransform: 'capitalize' }, Hex: { style: {} }, RGBwrap: { position: 'relative' }, RGBinput: { width: '100%', marginTop: '12px', fontSize: '15px', color: '#333', padding: '0px', border: '0px', borderBottom: '1px solid #eee', outline: 'none', height: '30px' }, RGBlabel: { position: 'absolute', top: '0px', left: '0px', fontSize: '11px', color: '#999999', textTransform: 'capitalize' }, split: { display: 'flex', marginRight: '-10px', paddingTop: '11px' }, third: { flex: '1', paddingRight: '10px' } } }, passedStyles)); var handleChange = function handleChange(data, e) { if (data.hex) { color.isValidHex(data.hex) && onChange({ hex: data.hex, source: 'hex' }, e); } else if (data.r || data.g || data.b) { onChange({ r: data.r || rgb.r, g: data.g || rgb.g, b: data.b || rgb.b, source: 'rgb' }, e); } }; return _react2.default.createElement( _common.Raised, { styles: passedStyles }, _react2.default.createElement( 'div', { style: styles.material, className: 'material-picker ' + className }, _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.HEXwrap, input: styles.HEXinput, label: styles.HEXlabel }, label: 'hex', value: hex, onChange: handleChange }), _react2.default.createElement( 'div', { style: styles.split, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.third }, _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'r', value: rgb.r, onChange: handleChange }) ), _react2.default.createElement( 'div', { style: styles.third }, _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'g', value: rgb.g, onChange: handleChange }) ), _react2.default.createElement( 'div', { style: styles.third }, _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'b', value: rgb.b, onChange: handleChange }) ) ) ) ); }; exports.default = (0, _common.ColorWrap)(Material); },{"../../helpers/color":288,"../common":256,"lodash/merge":222,"react":"react","reactcss":301}],269:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Photoshop = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _common = require('../common'); var _PhotoshopFields = require('./PhotoshopFields'); var _PhotoshopFields2 = _interopRequireDefault(_PhotoshopFields); var _PhotoshopPointerCircle = require('./PhotoshopPointerCircle'); var _PhotoshopPointerCircle2 = _interopRequireDefault(_PhotoshopPointerCircle); var _PhotoshopPointer = require('./PhotoshopPointer'); var _PhotoshopPointer2 = _interopRequireDefault(_PhotoshopPointer); var _PhotoshopButton = require('./PhotoshopButton'); var _PhotoshopButton2 = _interopRequireDefault(_PhotoshopButton); var _PhotoshopPreviews = require('./PhotoshopPreviews'); var _PhotoshopPreviews2 = _interopRequireDefault(_PhotoshopPreviews); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Photoshop = exports.Photoshop = function (_React$Component) { _inherits(Photoshop, _React$Component); function Photoshop(props) { _classCallCheck(this, Photoshop); var _this = _possibleConstructorReturn(this, (Photoshop.__proto__ || Object.getPrototypeOf(Photoshop)).call(this)); _this.state = { currentColor: props.hex }; return _this; } _createClass(Photoshop, [{ key: 'render', value: function render() { var _props = this.props, _props$styles = _props.styles, passedStyles = _props$styles === undefined ? {} : _props$styles, _props$className = _props.className, className = _props$className === undefined ? '' : _props$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { picker: { background: '#DCDCDC', borderRadius: '4px', boxShadow: '0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15)', boxSizing: 'initial', width: '513px' }, head: { backgroundImage: 'linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%)', borderBottom: '1px solid #B1B1B1', boxShadow: 'inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02)', height: '23px', lineHeight: '24px', borderRadius: '4px 4px 0 0', fontSize: '13px', color: '#4D4D4D', textAlign: 'center' }, body: { padding: '15px 15px 0', display: 'flex' }, saturation: { width: '256px', height: '256px', position: 'relative', border: '2px solid #B3B3B3', borderBottom: '2px solid #F0F0F0', overflow: 'hidden' }, hue: { position: 'relative', height: '256px', width: '19px', marginLeft: '10px', border: '2px solid #B3B3B3', borderBottom: '2px solid #F0F0F0' }, controls: { width: '180px', marginLeft: '10px' }, top: { display: 'flex' }, previews: { width: '60px' }, actions: { flex: '1', marginLeft: '20px' } } }, passedStyles)); return _react2.default.createElement( 'div', { style: styles.picker, className: 'photoshop-picker ' + className }, _react2.default.createElement( 'div', { style: styles.head }, this.props.header ), _react2.default.createElement( 'div', { style: styles.body, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.saturation }, _react2.default.createElement(_common.Saturation, { hsl: this.props.hsl, hsv: this.props.hsv, pointer: _PhotoshopPointerCircle2.default, onChange: this.props.onChange }) ), _react2.default.createElement( 'div', { style: styles.hue }, _react2.default.createElement(_common.Hue, { direction: 'vertical', hsl: this.props.hsl, pointer: _PhotoshopPointer2.default, onChange: this.props.onChange }) ), _react2.default.createElement( 'div', { style: styles.controls }, _react2.default.createElement( 'div', { style: styles.top, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.previews }, _react2.default.createElement(_PhotoshopPreviews2.default, { rgb: this.props.rgb, currentColor: this.state.currentColor }) ), _react2.default.createElement( 'div', { style: styles.actions }, _react2.default.createElement(_PhotoshopButton2.default, { label: 'OK', onClick: this.props.onAccept, active: true }), _react2.default.createElement(_PhotoshopButton2.default, { label: 'Cancel', onClick: this.props.onCancel }), _react2.default.createElement(_PhotoshopFields2.default, { onChange: this.props.onChange, rgb: this.props.rgb, hsv: this.props.hsv, hex: this.props.hex }) ) ) ) ) ); } }]); return Photoshop; }(_react2.default.Component); Photoshop.propTypes = { header: _propTypes2.default.string, styles: _propTypes2.default.object }; Photoshop.defaultProps = { header: 'Color Picker', styles: {} }; exports.default = (0, _common.ColorWrap)(Photoshop); },{"../common":256,"./PhotoshopButton":270,"./PhotoshopFields":271,"./PhotoshopPointer":272,"./PhotoshopPointerCircle":273,"./PhotoshopPreviews":274,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],270:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.PhotoshopButton = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PhotoshopButton = exports.PhotoshopButton = function PhotoshopButton(_ref) { var onClick = _ref.onClick, label = _ref.label, children = _ref.children, active = _ref.active; var styles = (0, _reactcss2.default)({ 'default': { button: { backgroundImage: 'linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)', border: '1px solid #878787', borderRadius: '2px', height: '20px', boxShadow: '0 1px 0 0 #EAEAEA', fontSize: '14px', color: '#000', lineHeight: '20px', textAlign: 'center', marginBottom: '10px', cursor: 'pointer' } }, 'active': { button: { boxShadow: '0 0 0 1px #878787' } } }, { active: active }); return _react2.default.createElement( 'div', { style: styles.button, onClick: onClick }, label || children ); }; exports.default = PhotoshopButton; },{"react":"react","reactcss":301}],271:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.PhotoshopPicker = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _common = require('../common'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PhotoshopPicker = exports.PhotoshopPicker = function PhotoshopPicker(_ref) { var onChange = _ref.onChange, rgb = _ref.rgb, hsv = _ref.hsv, hex = _ref.hex; var styles = (0, _reactcss2.default)({ 'default': { fields: { paddingTop: '5px', paddingBottom: '9px', width: '80px', position: 'relative' }, divider: { height: '5px' }, RGBwrap: { position: 'relative' }, RGBinput: { marginLeft: '40%', width: '40%', height: '18px', border: '1px solid #888888', boxShadow: 'inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC', marginBottom: '5px', fontSize: '13px', paddingLeft: '3px', marginRight: '10px' }, RGBlabel: { left: '0px', top: '0px', width: '34px', textTransform: 'uppercase', fontSize: '13px', height: '18px', lineHeight: '22px', position: 'absolute' }, HEXwrap: { position: 'relative' }, HEXinput: { marginLeft: '20%', width: '80%', height: '18px', border: '1px solid #888888', boxShadow: 'inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC', marginBottom: '6px', fontSize: '13px', paddingLeft: '3px' }, HEXlabel: { position: 'absolute', top: '0px', left: '0px', width: '14px', textTransform: 'uppercase', fontSize: '13px', height: '18px', lineHeight: '22px' }, fieldSymbols: { position: 'absolute', top: '5px', right: '-7px', fontSize: '13px' }, symbol: { height: '20px', lineHeight: '22px', paddingBottom: '7px' } } }); var handleChange = function handleChange(data, e) { if (data['#']) { color.isValidHex(data['#']) && onChange({ hex: data['#'], source: 'hex' }, e); } else if (data.r || data.g || data.b) { onChange({ r: data.r || rgb.r, g: data.g || rgb.g, b: data.b || rgb.b, source: 'rgb' }, e); } else if (data.h || data.s || data.v) { onChange({ h: data.h || hsv.h, s: data.s || hsv.s, v: data.v || hsv.v, source: 'hsv' }, e); } }; return _react2.default.createElement( 'div', { style: styles.fields }, _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'h', value: Math.round(hsv.h), onChange: handleChange }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 's', value: Math.round(hsv.s * 100), onChange: handleChange }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'v', value: Math.round(hsv.v * 100), onChange: handleChange }), _react2.default.createElement('div', { style: styles.divider }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'r', value: rgb.r, onChange: handleChange }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'g', value: rgb.g, onChange: handleChange }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.RGBwrap, input: styles.RGBinput, label: styles.RGBlabel }, label: 'b', value: rgb.b, onChange: handleChange }), _react2.default.createElement('div', { style: styles.divider }), _react2.default.createElement(_common.EditableInput, { style: { wrap: styles.HEXwrap, input: styles.HEXinput, label: styles.HEXlabel }, label: '#', value: hex.replace('#', ''), onChange: handleChange }), _react2.default.createElement( 'div', { style: styles.fieldSymbols }, _react2.default.createElement( 'div', { style: styles.symbol }, '\xB0' ), _react2.default.createElement( 'div', { style: styles.symbol }, '%' ), _react2.default.createElement( 'div', { style: styles.symbol }, '%' ) ) ); }; exports.default = PhotoshopPicker; },{"../../helpers/color":288,"../common":256,"react":"react","reactcss":301}],272:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.PhotoshopPointerCircle = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PhotoshopPointerCircle = exports.PhotoshopPointerCircle = function PhotoshopPointerCircle() { var styles = (0, _reactcss2.default)({ 'default': { triangle: { width: 0, height: 0, borderStyle: 'solid', borderWidth: '4px 0 4px 6px', borderColor: 'transparent transparent transparent #fff', position: 'absolute', top: '1px', left: '1px' }, triangleBorder: { width: 0, height: 0, borderStyle: 'solid', borderWidth: '5px 0 5px 8px', borderColor: 'transparent transparent transparent #555' }, left: { Extend: 'triangleBorder', transform: 'translate(-13px, -4px)' }, leftInside: { Extend: 'triangle', transform: 'translate(-8px, -5px)' }, right: { Extend: 'triangleBorder', transform: 'translate(20px, -14px) rotate(180deg)' }, rightInside: { Extend: 'triangle', transform: 'translate(-8px, -5px)' } } }); return _react2.default.createElement( 'div', { style: styles.pointer }, _react2.default.createElement( 'div', { style: styles.left }, _react2.default.createElement('div', { style: styles.leftInside }) ), _react2.default.createElement( 'div', { style: styles.right }, _react2.default.createElement('div', { style: styles.rightInside }) ) ); }; exports.default = PhotoshopPointerCircle; },{"react":"react","reactcss":301}],273:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.PhotoshopPointerCircle = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PhotoshopPointerCircle = exports.PhotoshopPointerCircle = function PhotoshopPointerCircle(_ref) { var hsl = _ref.hsl; var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '12px', height: '12px', borderRadius: '6px', boxShadow: 'inset 0 0 0 1px #fff', transform: 'translate(-6px, -6px)' } }, 'black-outline': { picker: { boxShadow: 'inset 0 0 0 1px #000' } } }, { 'black-outline': hsl.l > 0.5 }); return _react2.default.createElement('div', { style: styles.picker }); }; exports.default = PhotoshopPointerCircle; },{"react":"react","reactcss":301}],274:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.PhotoshopPreviews = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var PhotoshopPreviews = exports.PhotoshopPreviews = function PhotoshopPreviews(_ref) { var rgb = _ref.rgb, currentColor = _ref.currentColor; var styles = (0, _reactcss2.default)({ 'default': { swatches: { border: '1px solid #B3B3B3', borderBottom: '1px solid #F0F0F0', marginBottom: '2px', marginTop: '1px' }, new: { height: '34px', background: 'rgb(' + rgb.r + ',' + rgb.g + ', ' + rgb.b + ')', boxShadow: 'inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000' }, current: { height: '34px', background: currentColor, boxShadow: 'inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000' }, label: { fontSize: '14px', color: '#000', textAlign: 'center' } } }); return _react2.default.createElement( 'div', null, _react2.default.createElement( 'div', { style: styles.label }, 'new' ), _react2.default.createElement( 'div', { style: styles.swatches }, _react2.default.createElement('div', { style: styles.new }), _react2.default.createElement('div', { style: styles.current }) ), _react2.default.createElement( 'div', { style: styles.label }, 'current' ) ); }; exports.default = PhotoshopPreviews; },{"react":"react","reactcss":301}],275:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Sketch = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _common = require('../common'); var _SketchFields = require('./SketchFields'); var _SketchFields2 = _interopRequireDefault(_SketchFields); var _SketchPresetColors = require('./SketchPresetColors'); var _SketchPresetColors2 = _interopRequireDefault(_SketchPresetColors); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Sketch = exports.Sketch = function Sketch(_ref) { var width = _ref.width, rgb = _ref.rgb, hex = _ref.hex, hsv = _ref.hsv, hsl = _ref.hsl, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, disableAlpha = _ref.disableAlpha, presetColors = _ref.presetColors, renderers = _ref.renderers, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': _extends({ picker: { width: width, padding: '10px 10px 0', boxSizing: 'initial', background: '#fff', borderRadius: '4px', boxShadow: '0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)' }, saturation: { width: '100%', paddingBottom: '75%', position: 'relative', overflow: 'hidden' }, Saturation: { radius: '3px', shadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)' }, controls: { display: 'flex' }, sliders: { padding: '4px 0', flex: '1' }, color: { width: '24px', height: '24px', position: 'relative', marginTop: '4px', marginLeft: '4px', borderRadius: '3px' }, activeColor: { absolute: '0px 0px 0px 0px', borderRadius: '2px', background: 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + rgb.a + ')', boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)' }, hue: { position: 'relative', height: '10px', overflow: 'hidden' }, Hue: { radius: '2px', shadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)' }, alpha: { position: 'relative', height: '10px', marginTop: '4px', overflow: 'hidden' }, Alpha: { radius: '2px', shadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)' } }, passedStyles), 'disableAlpha': { color: { height: '10px' }, hue: { height: '10px' }, alpha: { display: 'none' } } }, passedStyles), { disableAlpha: disableAlpha }); return _react2.default.createElement( 'div', { style: styles.picker, className: 'sketch-picker ' + className }, _react2.default.createElement( 'div', { style: styles.saturation }, _react2.default.createElement(_common.Saturation, { style: styles.Saturation, hsl: hsl, hsv: hsv, onChange: onChange }) ), _react2.default.createElement( 'div', { style: styles.controls, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.sliders }, _react2.default.createElement( 'div', { style: styles.hue }, _react2.default.createElement(_common.Hue, { style: styles.Hue, hsl: hsl, onChange: onChange }) ), _react2.default.createElement( 'div', { style: styles.alpha }, _react2.default.createElement(_common.Alpha, { style: styles.Alpha, rgb: rgb, hsl: hsl, renderers: renderers, onChange: onChange }) ) ), _react2.default.createElement( 'div', { style: styles.color }, _react2.default.createElement(_common.Checkboard, null), _react2.default.createElement('div', { style: styles.activeColor }) ) ), _react2.default.createElement(_SketchFields2.default, { rgb: rgb, hsl: hsl, hex: hex, onChange: onChange, disableAlpha: disableAlpha }), _react2.default.createElement(_SketchPresetColors2.default, { colors: presetColors, onClick: onChange, onSwatchHover: onSwatchHover }) ); }; Sketch.propTypes = { disableAlpha: _propTypes2.default.bool, width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), styles: _propTypes2.default.object }; Sketch.defaultProps = { disableAlpha: false, width: 200, styles: {}, presetColors: ['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF'] }; exports.default = (0, _common.ColorWrap)(Sketch); },{"../common":256,"./SketchFields":276,"./SketchPresetColors":277,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],276:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SketchFields = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _common = require('../common'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* eslint-disable no-param-reassign */ var SketchFields = exports.SketchFields = function SketchFields(_ref) { var onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hex = _ref.hex, disableAlpha = _ref.disableAlpha; var styles = (0, _reactcss2.default)({ 'default': { fields: { display: 'flex', paddingTop: '4px' }, single: { flex: '1', paddingLeft: '6px' }, alpha: { flex: '1', paddingLeft: '6px' }, double: { flex: '2' }, input: { width: '80%', padding: '4px 10% 3px', border: 'none', boxShadow: 'inset 0 0 0 1px #ccc', fontSize: '11px' }, label: { display: 'block', textAlign: 'center', fontSize: '11px', color: '#222', paddingTop: '3px', paddingBottom: '4px', textTransform: 'capitalize' } }, 'disableAlpha': { alpha: { display: 'none' } } }, { disableAlpha: disableAlpha }); var handleChange = function handleChange(data, e) { if (data.hex) { color.isValidHex(data.hex) && onChange({ hex: data.hex, source: 'hex' }, e); } else if (data.r || data.g || data.b) { onChange({ r: data.r || rgb.r, g: data.g || rgb.g, b: data.b || rgb.b, a: rgb.a, source: 'rgb' }, e); } else if (data.a) { if (data.a < 0) { data.a = 0; } else if (data.a > 100) { data.a = 100; } data.a /= 100; onChange({ h: hsl.h, s: hsl.s, l: hsl.l, a: data.a, source: 'rgb' }, e); } }; return _react2.default.createElement( 'div', { style: styles.fields, className: 'flexbox-fix' }, _react2.default.createElement( 'div', { style: styles.double }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'hex', value: hex.replace('#', ''), onChange: handleChange }) ), _react2.default.createElement( 'div', { style: styles.single }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'r', value: rgb.r, onChange: handleChange, dragLabel: 'true', dragMax: '255' }) ), _react2.default.createElement( 'div', { style: styles.single }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'g', value: rgb.g, onChange: handleChange, dragLabel: 'true', dragMax: '255' }) ), _react2.default.createElement( 'div', { style: styles.single }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'b', value: rgb.b, onChange: handleChange, dragLabel: 'true', dragMax: '255' }) ), _react2.default.createElement( 'div', { style: styles.alpha }, _react2.default.createElement(_common.EditableInput, { style: { input: styles.input, label: styles.label }, label: 'a', value: Math.round(rgb.a * 100), onChange: handleChange, dragLabel: 'true', dragMax: '100' }) ) ); }; exports.default = SketchFields; },{"../../helpers/color":288,"../common":256,"react":"react","reactcss":301}],277:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SketchPresetColors = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _common = require('../common'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var SketchPresetColors = exports.SketchPresetColors = function SketchPresetColors(_ref) { var colors = _ref.colors, _ref$onClick = _ref.onClick, onClick = _ref$onClick === undefined ? function () {} : _ref$onClick, onSwatchHover = _ref.onSwatchHover; var styles = (0, _reactcss2.default)({ 'default': { colors: { margin: '0 -10px', padding: '10px 0 0 10px', borderTop: '1px solid #eee', display: 'flex', flexWrap: 'wrap', position: 'relative' }, swatchWrap: { width: '16px', height: '16px', margin: '0 10px 10px 0' }, swatch: { borderRadius: '3px', boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.15)' } }, 'no-presets': { colors: { display: 'none' } } }, { 'no-presets': !colors || !colors.length }); var handleClick = function handleClick(hex, e) { onClick({ hex: hex, source: 'hex' }, e); }; return _react2.default.createElement( 'div', { style: styles.colors, className: 'flexbox-fix' }, colors.map(function (colorObjOrString) { var c = typeof colorObjOrString === 'string' ? { color: colorObjOrString } : colorObjOrString; var key = '' + c.color + (c.title || ''); return _react2.default.createElement( 'div', { key: key, style: styles.swatchWrap }, _react2.default.createElement(_common.Swatch, _extends({}, c, { style: styles.swatch, onClick: handleClick, onHover: onSwatchHover, focusStyle: { boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px ' + c.color } })) ); }) ); }; SketchPresetColors.propTypes = { colors: _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({ color: _propTypes2.default.string, title: _propTypes2.default.string })])).isRequired }; exports.default = SketchPresetColors; },{"../common":256,"prop-types":236,"react":"react","reactcss":301}],278:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Slider = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _common = require('../common'); var _SliderSwatches = require('./SliderSwatches'); var _SliderSwatches2 = _interopRequireDefault(_SliderSwatches); var _SliderPointer = require('./SliderPointer'); var _SliderPointer2 = _interopRequireDefault(_SliderPointer); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Slider = exports.Slider = function Slider(_ref) { var hsl = _ref.hsl, onChange = _ref.onChange, pointer = _ref.pointer, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { hue: { height: '12px', position: 'relative' }, Hue: { radius: '2px' } } }, passedStyles)); return _react2.default.createElement( 'div', { style: styles.wrap || {}, className: 'slider-picker ' + className }, _react2.default.createElement( 'div', { style: styles.hue }, _react2.default.createElement(_common.Hue, { style: styles.Hue, hsl: hsl, pointer: pointer, onChange: onChange }) ), _react2.default.createElement( 'div', { style: styles.swatches }, _react2.default.createElement(_SliderSwatches2.default, { hsl: hsl, onClick: onChange }) ) ); }; Slider.propTypes = { styles: _propTypes2.default.object }; Slider.defaultProps = { pointer: _SliderPointer2.default, styles: {} }; exports.default = (0, _common.ColorWrap)(Slider); },{"../common":256,"./SliderPointer":279,"./SliderSwatches":281,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],279:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SliderPointer = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var SliderPointer = exports.SliderPointer = function SliderPointer() { var styles = (0, _reactcss2.default)({ 'default': { picker: { width: '14px', height: '14px', borderRadius: '6px', transform: 'translate(-7px, -1px)', backgroundColor: 'rgb(248, 248, 248)', boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.37)' } } }); return _react2.default.createElement('div', { style: styles.picker }); }; exports.default = SliderPointer; },{"react":"react","reactcss":301}],280:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SliderSwatch = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var SliderSwatch = exports.SliderSwatch = function SliderSwatch(_ref) { var hsl = _ref.hsl, offset = _ref.offset, _ref$onClick = _ref.onClick, onClick = _ref$onClick === undefined ? function () {} : _ref$onClick, active = _ref.active, first = _ref.first, last = _ref.last; var styles = (0, _reactcss2.default)({ 'default': { swatch: { height: '12px', background: 'hsl(' + hsl.h + ', 50%, ' + offset * 100 + '%)', cursor: 'pointer' } }, 'first': { swatch: { borderRadius: '2px 0 0 2px' } }, 'last': { swatch: { borderRadius: '0 2px 2px 0' } }, 'active': { swatch: { transform: 'scaleY(1.8)', borderRadius: '3.6px/2px' } } }, { active: active, first: first, last: last }); var handleClick = function handleClick(e) { return onClick({ h: hsl.h, s: 0.5, l: offset, source: 'hsl' }, e); }; return _react2.default.createElement('div', { style: styles.swatch, onClick: handleClick }); }; exports.default = SliderSwatch; },{"react":"react","reactcss":301}],281:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SliderSwatches = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _SliderSwatch = require('./SliderSwatch'); var _SliderSwatch2 = _interopRequireDefault(_SliderSwatch); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var SliderSwatches = exports.SliderSwatches = function SliderSwatches(_ref) { var onClick = _ref.onClick, hsl = _ref.hsl; var styles = (0, _reactcss2.default)({ 'default': { swatches: { marginTop: '20px' }, swatch: { boxSizing: 'border-box', width: '20%', paddingRight: '1px', float: 'left' }, clear: { clear: 'both' } } }); // Acceptible difference in floating point equality var epsilon = 0.1; return _react2.default.createElement( 'div', { style: styles.swatches }, _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement(_SliderSwatch2.default, { hsl: hsl, offset: '.80', active: Math.abs(hsl.l - 0.80) < epsilon && Math.abs(hsl.s - 0.50) < epsilon, onClick: onClick, first: true }) ), _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement(_SliderSwatch2.default, { hsl: hsl, offset: '.65', active: Math.abs(hsl.l - 0.65) < epsilon && Math.abs(hsl.s - 0.50) < epsilon, onClick: onClick }) ), _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement(_SliderSwatch2.default, { hsl: hsl, offset: '.50', active: Math.abs(hsl.l - 0.50) < epsilon && Math.abs(hsl.s - 0.50) < epsilon, onClick: onClick }) ), _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement(_SliderSwatch2.default, { hsl: hsl, offset: '.35', active: Math.abs(hsl.l - 0.35) < epsilon && Math.abs(hsl.s - 0.50) < epsilon, onClick: onClick }) ), _react2.default.createElement( 'div', { style: styles.swatch }, _react2.default.createElement(_SliderSwatch2.default, { hsl: hsl, offset: '.20', active: Math.abs(hsl.l - 0.20) < epsilon && Math.abs(hsl.s - 0.50) < epsilon, onClick: onClick, last: true }) ), _react2.default.createElement('div', { style: styles.clear }) ); }; exports.default = SliderSwatches; },{"./SliderSwatch":280,"react":"react","reactcss":301}],282:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Swatches = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _map = require('lodash/map'); var _map2 = _interopRequireDefault(_map); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _materialColors = require('material-colors'); var material = _interopRequireWildcard(_materialColors); var _common = require('../common'); var _SwatchesGroup = require('./SwatchesGroup'); var _SwatchesGroup2 = _interopRequireDefault(_SwatchesGroup); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Swatches = exports.Swatches = function Swatches(_ref) { var width = _ref.width, height = _ref.height, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors = _ref.colors, hex = _ref.hex, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { picker: { width: width, height: height }, overflow: { height: height, overflowY: 'scroll' }, body: { padding: '16px 0 6px 16px' }, clear: { clear: 'both' } } }, passedStyles)); var handleChange = function handleChange(data, e) { return onChange({ hex: data, source: 'hex' }, e); }; return _react2.default.createElement( 'div', { style: styles.picker, className: 'swatches-picker ' + className }, _react2.default.createElement( _common.Raised, null, _react2.default.createElement( 'div', { style: styles.overflow }, _react2.default.createElement( 'div', { style: styles.body }, (0, _map2.default)(colors, function (group) { return _react2.default.createElement(_SwatchesGroup2.default, { key: group.toString(), group: group, active: hex, onClick: handleChange, onSwatchHover: onSwatchHover }); }), _react2.default.createElement('div', { style: styles.clear }) ) ) ) ); }; Swatches.propTypes = { width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), height: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), colors: _propTypes2.default.arrayOf(_propTypes2.default.arrayOf(_propTypes2.default.string)), styles: _propTypes2.default.object /* eslint-disable max-len */ };Swatches.defaultProps = { width: 320, height: 240, colors: [[material.red['900'], material.red['700'], material.red['500'], material.red['300'], material.red['100']], [material.pink['900'], material.pink['700'], material.pink['500'], material.pink['300'], material.pink['100']], [material.purple['900'], material.purple['700'], material.purple['500'], material.purple['300'], material.purple['100']], [material.deepPurple['900'], material.deepPurple['700'], material.deepPurple['500'], material.deepPurple['300'], material.deepPurple['100']], [material.indigo['900'], material.indigo['700'], material.indigo['500'], material.indigo['300'], material.indigo['100']], [material.blue['900'], material.blue['700'], material.blue['500'], material.blue['300'], material.blue['100']], [material.lightBlue['900'], material.lightBlue['700'], material.lightBlue['500'], material.lightBlue['300'], material.lightBlue['100']], [material.cyan['900'], material.cyan['700'], material.cyan['500'], material.cyan['300'], material.cyan['100']], [material.teal['900'], material.teal['700'], material.teal['500'], material.teal['300'], material.teal['100']], ['#194D33', material.green['700'], material.green['500'], material.green['300'], material.green['100']], [material.lightGreen['900'], material.lightGreen['700'], material.lightGreen['500'], material.lightGreen['300'], material.lightGreen['100']], [material.lime['900'], material.lime['700'], material.lime['500'], material.lime['300'], material.lime['100']], [material.yellow['900'], material.yellow['700'], material.yellow['500'], material.yellow['300'], material.yellow['100']], [material.amber['900'], material.amber['700'], material.amber['500'], material.amber['300'], material.amber['100']], [material.orange['900'], material.orange['700'], material.orange['500'], material.orange['300'], material.orange['100']], [material.deepOrange['900'], material.deepOrange['700'], material.deepOrange['500'], material.deepOrange['300'], material.deepOrange['100']], [material.brown['900'], material.brown['700'], material.brown['500'], material.brown['300'], material.brown['100']], [material.blueGrey['900'], material.blueGrey['700'], material.blueGrey['500'], material.blueGrey['300'], material.blueGrey['100']], ['#000000', '#525252', '#969696', '#D9D9D9', '#FFFFFF']], styles: {} }; exports.default = (0, _common.ColorWrap)(Swatches); },{"../common":256,"./SwatchesGroup":284,"lodash/map":220,"lodash/merge":222,"material-colors":231,"prop-types":236,"react":"react","reactcss":301}],283:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SwatchesColor = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _color = require('../../helpers/color'); var colorUtils = _interopRequireWildcard(_color); var _common = require('../common'); var _CheckIcon = require('@icons/material/CheckIcon'); var _CheckIcon2 = _interopRequireDefault(_CheckIcon); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var SwatchesColor = exports.SwatchesColor = function SwatchesColor(_ref) { var color = _ref.color, _ref$onClick = _ref.onClick, onClick = _ref$onClick === undefined ? function () {} : _ref$onClick, onSwatchHover = _ref.onSwatchHover, first = _ref.first, last = _ref.last, active = _ref.active; var styles = (0, _reactcss2.default)({ 'default': { color: { width: '40px', height: '24px', cursor: 'pointer', background: color, marginBottom: '1px' }, check: { color: colorUtils.getContrastingColor(color), marginLeft: '8px', display: 'none' } }, 'first': { color: { overflow: 'hidden', borderRadius: '2px 2px 0 0' } }, 'last': { color: { overflow: 'hidden', borderRadius: '0 0 2px 2px' } }, 'active': { check: { display: 'block' } }, 'color-#FFFFFF': { color: { boxShadow: 'inset 0 0 0 1px #ddd' }, check: { color: '#333' } }, 'transparent': { check: { color: '#333' } } }, { first: first, last: last, active: active, 'color-#FFFFFF': color === '#FFFFFF', 'transparent': color === 'transparent' }); return _react2.default.createElement( _common.Swatch, { color: color, style: styles.color, onClick: onClick, onHover: onSwatchHover, focusStyle: { boxShadow: '0 0 4px ' + color } }, _react2.default.createElement( 'div', { style: styles.check }, _react2.default.createElement(_CheckIcon2.default, null) ) ); }; exports.default = SwatchesColor; },{"../../helpers/color":288,"../common":256,"@icons/material/CheckIcon":23,"react":"react","reactcss":301}],284:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SwatchesGroup = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _map = require('lodash/map'); var _map2 = _interopRequireDefault(_map); var _SwatchesColor = require('./SwatchesColor'); var _SwatchesColor2 = _interopRequireDefault(_SwatchesColor); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var SwatchesGroup = exports.SwatchesGroup = function SwatchesGroup(_ref) { var onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover, group = _ref.group, active = _ref.active; var styles = (0, _reactcss2.default)({ 'default': { group: { paddingBottom: '10px', width: '40px', float: 'left', marginRight: '10px' } } }); return _react2.default.createElement( 'div', { style: styles.group }, (0, _map2.default)(group, function (color, i) { return _react2.default.createElement(_SwatchesColor2.default, { key: color, color: color, active: color.toLowerCase() === active, first: i === 0, last: i === group.length - 1, onClick: onClick, onSwatchHover: onSwatchHover }); }) ); }; exports.default = SwatchesGroup; },{"./SwatchesColor":283,"lodash/map":220,"react":"react","reactcss":301}],285:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Twitter = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactcss = require('reactcss'); var _reactcss2 = _interopRequireDefault(_reactcss); var _map = require('lodash/map'); var _map2 = _interopRequireDefault(_map); var _merge = require('lodash/merge'); var _merge2 = _interopRequireDefault(_merge); var _color = require('../../helpers/color'); var color = _interopRequireWildcard(_color); var _common = require('../common'); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Twitter = exports.Twitter = function Twitter(_ref) { var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, hex = _ref.hex, colors = _ref.colors, width = _ref.width, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === undefined ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === undefined ? '' : _ref$className; var styles = (0, _reactcss2.default)((0, _merge2.default)({ 'default': { card: { width: width, background: '#fff', border: '0 solid rgba(0,0,0,0.25)', boxShadow: '0 1px 4px rgba(0,0,0,0.25)', borderRadius: '4px', position: 'relative' }, body: { padding: '15px 9px 9px 15px' }, label: { fontSize: '18px', color: '#fff' }, triangle: { width: '0px', height: '0px', borderStyle: 'solid', borderWidth: '0 9px 10px 9px', borderColor: 'transparent transparent #fff transparent', position: 'absolute' }, triangleShadow: { width: '0px', height: '0px', borderStyle: 'solid', borderWidth: '0 9px 10px 9px', borderColor: 'transparent transparent rgba(0,0,0,.1) transparent', position: 'absolute' }, hash: { background: '#F0F0F0', height: '30px', width: '30px', borderRadius: '4px 0 0 4px', float: 'left', color: '#98A1A4', display: 'flex', alignItems: 'center', justifyContent: 'center' }, input: { width: '100px', fontSize: '14px', color: '#666', border: '0px', outline: 'none', height: '28px', boxShadow: 'inset 0 0 0 1px #F0F0F0', boxSizing: 'content-box', borderRadius: '0 4px 4px 0', float: 'left', paddingLeft: '8px' }, swatch: { width: '30px', height: '30px', float: 'left', borderRadius: '4px', margin: '0 6px 6px 0' }, clear: { clear: 'both' } }, 'hide-triangle': { triangle: { display: 'none' }, triangleShadow: { display: 'none' } }, 'top-left-triangle': { triangle: { top: '-10px', left: '12px' }, triangleShadow: { top: '-11px', left: '12px' } }, 'top-right-triangle': { triangle: { top: '-10px', right: '12px' }, triangleShadow: { top: '-11px', right: '12px' } } }, passedStyles), { 'hide-triangle': triangle === 'hide', 'top-left-triangle': triangle === 'top-left', 'top-right-triangle': triangle === 'top-right' }); var handleChange = function handleChange(hexcode, e) { color.isValidHex(hexcode) && onChange({ hex: hexcode, source: 'hex' }, e); }; return _react2.default.createElement( 'div', { style: styles.card, className: 'twitter-picker ' + className }, _react2.default.createElement('div', { style: styles.triangleShadow }), _react2.default.createElement('div', { style: styles.triangle }), _react2.default.createElement( 'div', { style: styles.body }, (0, _map2.default)(colors, function (c, i) { return _react2.default.createElement(_common.Swatch, { key: i, color: c, hex: c, style: styles.swatch, onClick: handleChange, onHover: onSwatchHover, focusStyle: { boxShadow: '0 0 4px ' + c } }); }), _react2.default.createElement( 'div', { style: styles.hash }, '#' ), _react2.default.createElement(_common.EditableInput, { label: null, style: { input: styles.input }, value: hex.replace('#', ''), onChange: handleChange }), _react2.default.createElement('div', { style: styles.clear }) ) ); }; Twitter.propTypes = { width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), triangle: _propTypes2.default.oneOf(['hide', 'top-left', 'top-right']), colors: _propTypes2.default.arrayOf(_propTypes2.default.string), styles: _propTypes2.default.object }; Twitter.defaultProps = { width: 276, colors: ['#FF6900', '#FCB900', '#7BDCB5', '#00D084', '#8ED1FC', '#0693E3', '#ABB8C3', '#EB144C', '#F78DA7', '#9900EF'], triangle: 'top-left', styles: {} }; exports.default = (0, _common.ColorWrap)(Twitter); },{"../../helpers/color":288,"../common":256,"lodash/map":220,"lodash/merge":222,"prop-types":236,"react":"react","reactcss":301}],286:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var calculateChange = exports.calculateChange = function calculateChange(e, hsl, direction, initialA, container) { var containerWidth = container.clientWidth; var containerHeight = container.clientHeight; var x = typeof e.pageX === 'number' ? e.pageX : e.touches[0].pageX; var y = typeof e.pageY === 'number' ? e.pageY : e.touches[0].pageY; var left = x - (container.getBoundingClientRect().left + window.pageXOffset); var top = y - (container.getBoundingClientRect().top + window.pageYOffset); if (direction === 'vertical') { var a = void 0; if (top < 0) { a = 0; } else if (top > containerHeight) { a = 1; } else { a = Math.round(top * 100 / containerHeight) / 100; } if (hsl.a !== a) { return { h: hsl.h, s: hsl.s, l: hsl.l, a: a, source: 'rgb' }; } } else { var _a = void 0; if (left < 0) { _a = 0; } else if (left > containerWidth) { _a = 1; } else { _a = Math.round(left * 100 / containerWidth) / 100; } if (initialA !== _a) { return { h: hsl.h, s: hsl.s, l: hsl.l, a: _a, source: 'rgb' }; } } return null; }; },{}],287:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var checkboardCache = {}; var render = exports.render = function render(c1, c2, size, serverCanvas) { if (typeof document === 'undefined' && !serverCanvas) { return null; } var canvas = serverCanvas ? new serverCanvas() : document.createElement('canvas'); canvas.width = size * 2; canvas.height = size * 2; var ctx = canvas.getContext('2d'); if (!ctx) { return null; } // If no context can be found, return early. ctx.fillStyle = c1; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = c2; ctx.fillRect(0, 0, size, size); ctx.translate(size, size); ctx.fillRect(0, 0, size, size); return canvas.toDataURL(); }; var get = exports.get = function get(c1, c2, size, serverCanvas) { var key = c1 + '-' + c2 + '-' + size + (serverCanvas ? '-server' : ''); if (checkboardCache[key]) { return checkboardCache[key]; } var checkboard = render(c1, c2, size, serverCanvas); checkboardCache[key] = checkboard; return checkboard; }; },{}],288:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.isvalidColorString = exports.red = exports.getContrastingColor = exports.isValidHex = exports.toState = exports.simpleCheckForValidColor = undefined; var _each = require('lodash/each'); var _each2 = _interopRequireDefault(_each); var _tinycolor = require('tinycolor2'); var _tinycolor2 = _interopRequireDefault(_tinycolor); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var simpleCheckForValidColor = exports.simpleCheckForValidColor = function simpleCheckForValidColor(data) { var keysToCheck = ['r', 'g', 'b', 'a', 'h', 's', 'l', 'v']; var checked = 0; var passed = 0; (0, _each2.default)(keysToCheck, function (letter) { if (data[letter]) { checked += 1; if (!isNaN(data[letter])) { passed += 1; } if (letter === 's' || letter === 'l') { var percentPatt = /^\d+%$/; if (percentPatt.test(data[letter])) { passed += 1; } } } }); return checked === passed ? data : false; }; var toState = exports.toState = function toState(data, oldHue) { var color = data.hex ? (0, _tinycolor2.default)(data.hex) : (0, _tinycolor2.default)(data); var hsl = color.toHsl(); var hsv = color.toHsv(); var rgb = color.toRgb(); var hex = color.toHex(); if (hsl.s === 0) { hsl.h = oldHue || 0; hsv.h = oldHue || 0; } var transparent = hex === '000000' && rgb.a === 0; return { hsl: hsl, hex: transparent ? 'transparent' : '#' + hex, rgb: rgb, hsv: hsv, oldHue: data.h || oldHue || hsl.h, source: data.source }; }; var isValidHex = exports.isValidHex = function isValidHex(hex) { if (hex === 'transparent') { return true; } // disable hex4 and hex8 var lh = String(hex).charAt(0) === '#' ? 1 : 0; return hex.length !== 4 + lh && hex.length < 7 + lh && (0, _tinycolor2.default)(hex).isValid(); }; var getContrastingColor = exports.getContrastingColor = function getContrastingColor(data) { if (!data) { return '#fff'; } var col = toState(data); if (col.hex === 'transparent') { return 'rgba(0,0,0,0.4)'; } var yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1000; return yiq >= 128 ? '#000' : '#fff'; }; var red = exports.red = { hsl: { a: 1, h: 0, l: 0.5, s: 1 }, hex: '#ff0000', rgb: { r: 255, g: 0, b: 0, a: 1 }, hsv: { h: 0, s: 1, v: 1, a: 1 } }; var isvalidColorString = exports.isvalidColorString = function isvalidColorString(string, type) { var stringWithoutDegree = string.replace('°', ''); return (0, _tinycolor2.default)(type + ' (' + stringWithoutDegree + ')')._ok; }; },{"lodash/each":195,"tinycolor2":305}],289:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var calculateChange = exports.calculateChange = function calculateChange(e, direction, hsl, container) { var containerWidth = container.clientWidth; var containerHeight = container.clientHeight; var x = typeof e.pageX === 'number' ? e.pageX : e.touches[0].pageX; var y = typeof e.pageY === 'number' ? e.pageY : e.touches[0].pageY; var left = x - (container.getBoundingClientRect().left + window.pageXOffset); var top = y - (container.getBoundingClientRect().top + window.pageYOffset); if (direction === 'vertical') { var h = void 0; if (top < 0) { h = 359; } else if (top > containerHeight) { h = 0; } else { var percent = -(top * 100 / containerHeight) + 100; h = 360 * percent / 100; } if (hsl.h !== h) { return { h: h, s: hsl.s, l: hsl.l, a: hsl.a, source: 'hsl' }; } } else { var _h = void 0; if (left < 0) { _h = 0; } else if (left > containerWidth) { _h = 359; } else { var _percent = left * 100 / containerWidth; _h = 360 * _percent / 100; } if (hsl.h !== _h) { return { h: _h, s: hsl.s, l: hsl.l, a: hsl.a, source: 'hsl' }; } } return null; }; },{}],290:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleFocus = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint-disable no-invalid-this */ var handleFocus = exports.handleFocus = function handleFocus(Component) { var Span = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'span'; return function (_React$Component) { _inherits(Focus, _React$Component); function Focus() { var _ref; var _temp, _this, _ret; _classCallCheck(this, Focus); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Focus.__proto__ || Object.getPrototypeOf(Focus)).call.apply(_ref, [this].concat(args))), _this), _this.state = { focus: false }, _this.handleFocus = function () { return _this.setState({ focus: true }); }, _this.handleBlur = function () { return _this.setState({ focus: false }); }, _temp), _possibleConstructorReturn(_this, _ret); } _createClass(Focus, [{ key: 'render', value: function render() { return _react2.default.createElement( Span, { onFocus: this.handleFocus, onBlur: this.handleBlur }, _react2.default.createElement(Component, _extends({}, this.props, this.state)) ); } }]); return Focus; }(_react2.default.Component); }; },{"react":"react"}],291:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var calculateChange = exports.calculateChange = function calculateChange(e, hsl, container) { var _container$getBoundin = container.getBoundingClientRect(), containerWidth = _container$getBoundin.width, containerHeight = _container$getBoundin.height; var x = typeof e.pageX === 'number' ? e.pageX : e.touches[0].pageX; var y = typeof e.pageY === 'number' ? e.pageY : e.touches[0].pageY; var left = x - (container.getBoundingClientRect().left + window.pageXOffset); var top = y - (container.getBoundingClientRect().top + window.pageYOffset); if (left < 0) { left = 0; } else if (left > containerWidth) { left = containerWidth; } if (top < 0) { top = 0; } else if (top > containerHeight) { top = containerHeight; } var saturation = left / containerWidth; var bright = 1 - top / containerHeight; return { h: hsl.h, s: saturation, v: bright, a: hsl.a, source: 'hsv' }; }; },{}],292:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.CustomPicker = exports.GooglePicker = exports.TwitterPicker = exports.SwatchesPicker = exports.SliderPicker = exports.SketchPicker = exports.PhotoshopPicker = exports.MaterialPicker = exports.HuePicker = exports.GithubPicker = exports.CompactPicker = exports.ChromePicker = exports.default = exports.CirclePicker = exports.BlockPicker = exports.AlphaPicker = undefined; var _Alpha = require('./components/alpha/Alpha'); Object.defineProperty(exports, 'AlphaPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Alpha).default; } }); var _Block = require('./components/block/Block'); Object.defineProperty(exports, 'BlockPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Block).default; } }); var _Circle = require('./components/circle/Circle'); Object.defineProperty(exports, 'CirclePicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Circle).default; } }); var _Chrome = require('./components/chrome/Chrome'); Object.defineProperty(exports, 'ChromePicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Chrome).default; } }); var _Compact = require('./components/compact/Compact'); Object.defineProperty(exports, 'CompactPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Compact).default; } }); var _Github = require('./components/github/Github'); Object.defineProperty(exports, 'GithubPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Github).default; } }); var _Hue = require('./components/hue/Hue'); Object.defineProperty(exports, 'HuePicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Hue).default; } }); var _Material = require('./components/material/Material'); Object.defineProperty(exports, 'MaterialPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Material).default; } }); var _Photoshop = require('./components/photoshop/Photoshop'); Object.defineProperty(exports, 'PhotoshopPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Photoshop).default; } }); var _Sketch = require('./components/sketch/Sketch'); Object.defineProperty(exports, 'SketchPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Sketch).default; } }); var _Slider = require('./components/slider/Slider'); Object.defineProperty(exports, 'SliderPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Slider).default; } }); var _Swatches = require('./components/swatches/Swatches'); Object.defineProperty(exports, 'SwatchesPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Swatches).default; } }); var _Twitter = require('./components/twitter/Twitter'); Object.defineProperty(exports, 'TwitterPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Twitter).default; } }); var _Google = require('./components/google/Google'); Object.defineProperty(exports, 'GooglePicker', { enumerable: true, get: function get() { return _interopRequireDefault(_Google).default; } }); var _ColorWrap = require('./components/common/ColorWrap'); Object.defineProperty(exports, 'CustomPicker', { enumerable: true, get: function get() { return _interopRequireDefault(_ColorWrap).default; } }); var _Chrome2 = _interopRequireDefault(_Chrome); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _Chrome2.default; },{"./components/alpha/Alpha":238,"./components/block/Block":240,"./components/chrome/Chrome":242,"./components/circle/Circle":246,"./components/common/ColorWrap":250,"./components/compact/Compact":257,"./components/github/Github":260,"./components/google/Google":262,"./components/hue/Hue":266,"./components/material/Material":268,"./components/photoshop/Photoshop":269,"./components/sketch/Sketch":275,"./components/slider/Slider":278,"./components/swatches/Swatches":282,"./components/twitter/Twitter":285}],293:[function(require,module,exports){ (function (process){ /** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; if (process.env.NODE_ENV !== "production") { (function() { 'use strict'; // The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. var hasSymbol = typeof Symbol === 'function' && Symbol.for; var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary // (unstable) APIs that have been removed. Can we remove the symbols? var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; function isValidElementType(type) { return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); } function typeOf(object) { if (typeof object === 'object' && object !== null) { var $$typeof = object.$$typeof; switch ($$typeof) { case REACT_ELEMENT_TYPE: var type = object.type; switch (type) { case REACT_ASYNC_MODE_TYPE: case REACT_CONCURRENT_MODE_TYPE: case REACT_FRAGMENT_TYPE: case REACT_PROFILER_TYPE: case REACT_STRICT_MODE_TYPE: case REACT_SUSPENSE_TYPE: return type; default: var $$typeofType = type && type.$$typeof; switch ($$typeofType) { case REACT_CONTEXT_TYPE: case REACT_FORWARD_REF_TYPE: case REACT_LAZY_TYPE: case REACT_MEMO_TYPE: case REACT_PROVIDER_TYPE: return $$typeofType; default: return $$typeof; } } case REACT_PORTAL_TYPE: return $$typeof; } } return undefined; } // AsyncMode is deprecated along with isAsyncMode var AsyncMode = REACT_ASYNC_MODE_TYPE; var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; var ContextConsumer = REACT_CONTEXT_TYPE; var ContextProvider = REACT_PROVIDER_TYPE; var Element = REACT_ELEMENT_TYPE; var ForwardRef = REACT_FORWARD_REF_TYPE; var Fragment = REACT_FRAGMENT_TYPE; var Lazy = REACT_LAZY_TYPE; var Memo = REACT_MEMO_TYPE; var Portal = REACT_PORTAL_TYPE; var Profiler = REACT_PROFILER_TYPE; var StrictMode = REACT_STRICT_MODE_TYPE; var Suspense = REACT_SUSPENSE_TYPE; var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated function isAsyncMode(object) { { if (!hasWarnedAboutDeprecatedIsAsyncMode) { hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); } } return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; } function isConcurrentMode(object) { return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; } function isContextConsumer(object) { return typeOf(object) === REACT_CONTEXT_TYPE; } function isContextProvider(object) { return typeOf(object) === REACT_PROVIDER_TYPE; } function isElement(object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } function isForwardRef(object) { return typeOf(object) === REACT_FORWARD_REF_TYPE; } function isFragment(object) { return typeOf(object) === REACT_FRAGMENT_TYPE; } function isLazy(object) { return typeOf(object) === REACT_LAZY_TYPE; } function isMemo(object) { return typeOf(object) === REACT_MEMO_TYPE; } function isPortal(object) { return typeOf(object) === REACT_PORTAL_TYPE; } function isProfiler(object) { return typeOf(object) === REACT_PROFILER_TYPE; } function isStrictMode(object) { return typeOf(object) === REACT_STRICT_MODE_TYPE; } function isSuspense(object) { return typeOf(object) === REACT_SUSPENSE_TYPE; } exports.AsyncMode = AsyncMode; exports.ConcurrentMode = ConcurrentMode; exports.ContextConsumer = ContextConsumer; exports.ContextProvider = ContextProvider; exports.Element = Element; exports.ForwardRef = ForwardRef; exports.Fragment = Fragment; exports.Lazy = Lazy; exports.Memo = Memo; exports.Portal = Portal; exports.Profiler = Profiler; exports.StrictMode = StrictMode; exports.Suspense = Suspense; exports.isAsyncMode = isAsyncMode; exports.isConcurrentMode = isConcurrentMode; exports.isContextConsumer = isContextConsumer; exports.isContextProvider = isContextProvider; exports.isElement = isElement; exports.isForwardRef = isForwardRef; exports.isFragment = isFragment; exports.isLazy = isLazy; exports.isMemo = isMemo; exports.isPortal = isPortal; exports.isProfiler = isProfiler; exports.isStrictMode = isStrictMode; exports.isSuspense = isSuspense; exports.isValidElementType = isValidElementType; exports.typeOf = typeOf; })(); } }).call(this,require('_process')) },{"_process":3}],294:[function(require,module,exports){ /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; },{}],295:[function(require,module,exports){ (function (process){ 'use strict'; if (process.env.NODE_ENV === 'production') { module.exports = require('./cjs/react-is.production.min.js'); } else { module.exports = require('./cjs/react-is.development.js'); } }).call(this,require('_process')) },{"./cjs/react-is.development.js":293,"./cjs/react-is.production.min.js":294,"_process":3}],296:[function(require,module,exports){ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("prop-types"),require("react"),require("signature_pad"),require("trim-canvas")):"function"==typeof define&&define.amd?define(["prop-types","react","signature_pad","trim-canvas"],t):"object"==typeof exports?exports.SignatureCanvas=t(require("prop-types"),require("react"),require("signature_pad"),require("trim-canvas")):e.SignatureCanvas=t(e["prop-types"],e.react,e.signature_pad,e["trim-canvas"])}(this,function(e,t,n,r){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 u(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=Object.assign||function(e){for(var t=1;t 1 && arguments[1] !== undefined ? arguments[1] : 'span'; return function (_React$Component) { _inherits(Active, _React$Component); function Active() { var _ref; var _temp, _this, _ret; _classCallCheck(this, Active); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Active.__proto__ || Object.getPrototypeOf(Active)).call.apply(_ref, [this].concat(args))), _this), _this.state = { active: false }, _this.handleMouseDown = function () { return _this.setState({ active: true }); }, _this.handleMouseUp = function () { return _this.setState({ active: false }); }, _this.render = function () { return _react2.default.createElement( Span, { onMouseDown: _this.handleMouseDown, onMouseUp: _this.handleMouseUp }, _react2.default.createElement(Component, _extends({}, _this.props, _this.state)) ); }, _temp), _possibleConstructorReturn(_this, _ret); } return Active; }(_react2.default.Component); }; exports.default = active; },{"react":"react"}],299:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.hover = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var hover = exports.hover = function hover(Component) { var Span = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'span'; return function (_React$Component) { _inherits(Hover, _React$Component); function Hover() { var _ref; var _temp, _this, _ret; _classCallCheck(this, Hover); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Hover.__proto__ || Object.getPrototypeOf(Hover)).call.apply(_ref, [this].concat(args))), _this), _this.state = { hover: false }, _this.handleMouseOver = function () { return _this.setState({ hover: true }); }, _this.handleMouseOut = function () { return _this.setState({ hover: false }); }, _this.render = function () { return _react2.default.createElement( Span, { onMouseOver: _this.handleMouseOver, onMouseOut: _this.handleMouseOut }, _react2.default.createElement(Component, _extends({}, _this.props, _this.state)) ); }, _temp), _possibleConstructorReturn(_this, _ret); } return Hover; }(_react2.default.Component); }; exports.default = hover; },{"react":"react"}],300:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.flattenNames = undefined; var _isString2 = require('lodash/isString'); var _isString3 = _interopRequireDefault(_isString2); var _forOwn2 = require('lodash/forOwn'); var _forOwn3 = _interopRequireDefault(_forOwn2); var _isPlainObject2 = require('lodash/isPlainObject'); var _isPlainObject3 = _interopRequireDefault(_isPlainObject2); var _map2 = require('lodash/map'); var _map3 = _interopRequireDefault(_map2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var flattenNames = exports.flattenNames = function flattenNames() { var things = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var names = []; (0, _map3.default)(things, function (thing) { if (Array.isArray(thing)) { flattenNames(thing).map(function (name) { return names.push(name); }); } else if ((0, _isPlainObject3.default)(thing)) { (0, _forOwn3.default)(thing, function (value, key) { value === true && names.push(key); names.push(key + '-' + value); }); } else if ((0, _isString3.default)(thing)) { names.push(thing); } }); return names; }; exports.default = flattenNames; },{"lodash/forOwn":198,"lodash/isPlainObject":212,"lodash/isString":214,"lodash/map":220}],301:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReactCSS = exports.loop = exports.handleActive = exports.handleHover = exports.hover = undefined; var _flattenNames = require('./flattenNames'); var _flattenNames2 = _interopRequireDefault(_flattenNames); var _mergeClasses = require('./mergeClasses'); var _mergeClasses2 = _interopRequireDefault(_mergeClasses); var _autoprefix = require('./autoprefix'); var _autoprefix2 = _interopRequireDefault(_autoprefix); var _hover2 = require('./components/hover'); var _hover3 = _interopRequireDefault(_hover2); var _active = require('./components/active'); var _active2 = _interopRequireDefault(_active); var _loop2 = require('./loop'); var _loop3 = _interopRequireDefault(_loop2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.hover = _hover3.default; exports.handleHover = _hover3.default; exports.handleActive = _active2.default; exports.loop = _loop3.default; var ReactCSS = exports.ReactCSS = function ReactCSS(classes) { for (var _len = arguments.length, activations = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { activations[_key - 1] = arguments[_key]; } var activeNames = (0, _flattenNames2.default)(activations); var merged = (0, _mergeClasses2.default)(classes, activeNames); return (0, _autoprefix2.default)(merged); }; exports.default = ReactCSS; },{"./autoprefix":297,"./components/active":298,"./components/hover":299,"./flattenNames":300,"./loop":302,"./mergeClasses":303}],302:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var loopable = function loopable(i, length) { var props = {}; var setProp = function setProp(name) { var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; props[name] = value; }; i === 0 && setProp('first-child'); i === length - 1 && setProp('last-child'); (i === 0 || i % 2 === 0) && setProp('even'); Math.abs(i % 2) === 1 && setProp('odd'); setProp('nth-child', i); return props; }; exports.default = loopable; },{}],303:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.mergeClasses = undefined; var _forOwn2 = require('lodash/forOwn'); var _forOwn3 = _interopRequireDefault(_forOwn2); var _cloneDeep2 = require('lodash/cloneDeep'); var _cloneDeep3 = _interopRequireDefault(_cloneDeep2); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var mergeClasses = exports.mergeClasses = function mergeClasses(classes) { var activeNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var styles = classes.default && (0, _cloneDeep3.default)(classes.default) || {}; activeNames.map(function (name) { var toMerge = classes[name]; if (toMerge) { (0, _forOwn3.default)(toMerge, function (value, key) { if (!styles[key]) { styles[key] = {}; } styles[key] = _extends({}, styles[key], toMerge[key]); }); } return name; }); return styles; }; exports.default = mergeClasses; },{"lodash/cloneDeep":192,"lodash/forOwn":198}],304:[function(require,module,exports){ /*! * Signature Pad v2.3.2 * https://github.com/szimek/signature_pad * * Copyright 2017 Szymon Nowak * Released under the MIT license * * The main idea and some parts of the code (e.g. drawing variable width Bézier curve) are taken from: * http://corner.squareup.com/2012/07/smoother-signatures.html * * Implementation of interpolation using cubic Bézier curves is taken from: * http://benknowscode.wordpress.com/2012/09/14/path-interpolation-using-cubic-bezier-and-control-point-estimation-in-javascript * * Algorithm for approximated length of a Bézier curve is taken from: * http://www.lemoda.net/maths/bezier-length/index.html * */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.SignaturePad = factory()); }(this, (function () { 'use strict'; function Point(x, y, time) { this.x = x; this.y = y; this.time = time || new Date().getTime(); } Point.prototype.velocityFrom = function (start) { return this.time !== start.time ? this.distanceTo(start) / (this.time - start.time) : 1; }; Point.prototype.distanceTo = function (start) { return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2)); }; Point.prototype.equals = function (other) { return this.x === other.x && this.y === other.y && this.time === other.time; }; function Bezier(startPoint, control1, control2, endPoint) { this.startPoint = startPoint; this.control1 = control1; this.control2 = control2; this.endPoint = endPoint; } // Returns approximated length. Bezier.prototype.length = function () { var steps = 10; var length = 0; var px = void 0; var py = void 0; for (var i = 0; i <= steps; i += 1) { var t = i / steps; var cx = this._point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x); var cy = this._point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y); if (i > 0) { var xdiff = cx - px; var ydiff = cy - py; length += Math.sqrt(xdiff * xdiff + ydiff * ydiff); } px = cx; py = cy; } return length; }; /* eslint-disable no-multi-spaces, space-in-parens */ Bezier.prototype._point = function (t, start, c1, c2, end) { return start * (1.0 - t) * (1.0 - t) * (1.0 - t) + 3.0 * c1 * (1.0 - t) * (1.0 - t) * t + 3.0 * c2 * (1.0 - t) * t * t + end * t * t * t; }; /* eslint-disable */ // http://stackoverflow.com/a/27078401/815507 function throttle(func, wait, options) { var context, args, result; var timeout = null; var previous = 0; if (!options) options = {}; var later = function later() { previous = options.leading === false ? 0 : Date.now(); timeout = null; result = func.apply(context, args); if (!timeout) context = args = null; }; return function () { var now = Date.now(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { clearTimeout(timeout); timeout = null; } previous = now; result = func.apply(context, args); if (!timeout) context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; } function SignaturePad(canvas, options) { var self = this; var opts = options || {}; this.velocityFilterWeight = opts.velocityFilterWeight || 0.7; this.minWidth = opts.minWidth || 0.5; this.maxWidth = opts.maxWidth || 2.5; this.throttle = 'throttle' in opts ? opts.throttle : 16; // in miliseconds this.minDistance = 'minDistance' in opts ? opts.minDistance : 5; if (this.throttle) { this._strokeMoveUpdate = throttle(SignaturePad.prototype._strokeUpdate, this.throttle); } else { this._strokeMoveUpdate = SignaturePad.prototype._strokeUpdate; } this.dotSize = opts.dotSize || function () { return (this.minWidth + this.maxWidth) / 2; }; this.penColor = opts.penColor || 'black'; this.backgroundColor = opts.backgroundColor || 'rgba(0,0,0,0)'; this.onBegin = opts.onBegin; this.onEnd = opts.onEnd; this._canvas = canvas; this._ctx = canvas.getContext('2d'); this.clear(); // We need add these inline so they are available to unbind while still having // access to 'self' we could use _.bind but it's not worth adding a dependency. this._handleMouseDown = function (event) { if (event.which === 1) { self._mouseButtonDown = true; self._strokeBegin(event); } }; this._handleMouseMove = function (event) { if (self._mouseButtonDown) { self._strokeMoveUpdate(event); } }; this._handleMouseUp = function (event) { if (event.which === 1 && self._mouseButtonDown) { self._mouseButtonDown = false; self._strokeEnd(event); } }; this._handleTouchStart = function (event) { if (event.targetTouches.length === 1) { var touch = event.changedTouches[0]; self._strokeBegin(touch); } }; this._handleTouchMove = function (event) { // Prevent scrolling. event.preventDefault(); var touch = event.targetTouches[0]; self._strokeMoveUpdate(touch); }; this._handleTouchEnd = function (event) { var wasCanvasTouched = event.target === self._canvas; if (wasCanvasTouched) { event.preventDefault(); self._strokeEnd(event); } }; // Enable mouse and touch event handlers this.on(); } // Public methods SignaturePad.prototype.clear = function () { var ctx = this._ctx; var canvas = this._canvas; ctx.fillStyle = this.backgroundColor; ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.fillRect(0, 0, canvas.width, canvas.height); this._data = []; this._reset(); this._isEmpty = true; }; SignaturePad.prototype.fromDataURL = function (dataUrl) { var _this = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var image = new Image(); var ratio = options.ratio || window.devicePixelRatio || 1; var width = options.width || this._canvas.width / ratio; var height = options.height || this._canvas.height / ratio; this._reset(); image.src = dataUrl; image.onload = function () { _this._ctx.drawImage(image, 0, 0, width, height); }; this._isEmpty = false; }; SignaturePad.prototype.toDataURL = function (type) { var _canvas; switch (type) { case 'image/svg+xml': return this._toSVG(); default: for (var _len = arguments.length, options = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { options[_key - 1] = arguments[_key]; } return (_canvas = this._canvas).toDataURL.apply(_canvas, [type].concat(options)); } }; SignaturePad.prototype.on = function () { this._handleMouseEvents(); this._handleTouchEvents(); }; SignaturePad.prototype.off = function () { this._canvas.removeEventListener('mousedown', this._handleMouseDown); this._canvas.removeEventListener('mousemove', this._handleMouseMove); document.removeEventListener('mouseup', this._handleMouseUp); this._canvas.removeEventListener('touchstart', this._handleTouchStart); this._canvas.removeEventListener('touchmove', this._handleTouchMove); this._canvas.removeEventListener('touchend', this._handleTouchEnd); }; SignaturePad.prototype.isEmpty = function () { return this._isEmpty; }; // Private methods SignaturePad.prototype._strokeBegin = function (event) { this._data.push([]); this._reset(); this._strokeUpdate(event); if (typeof this.onBegin === 'function') { this.onBegin(event); } }; SignaturePad.prototype._strokeUpdate = function (event) { var x = event.clientX; var y = event.clientY; var point = this._createPoint(x, y); var lastPointGroup = this._data[this._data.length - 1]; var lastPoint = lastPointGroup && lastPointGroup[lastPointGroup.length - 1]; var isLastPointTooClose = lastPoint && point.distanceTo(lastPoint) < this.minDistance; // Skip this point if it's too close to the previous one if (!(lastPoint && isLastPointTooClose)) { var _addPoint = this._addPoint(point), curve = _addPoint.curve, widths = _addPoint.widths; if (curve && widths) { this._drawCurve(curve, widths.start, widths.end); } this._data[this._data.length - 1].push({ x: point.x, y: point.y, time: point.time, color: this.penColor }); } }; SignaturePad.prototype._strokeEnd = function (event) { var canDrawCurve = this.points.length > 2; var point = this.points[0]; // Point instance if (!canDrawCurve && point) { this._drawDot(point); } if (point) { var lastPointGroup = this._data[this._data.length - 1]; var lastPoint = lastPointGroup[lastPointGroup.length - 1]; // plain object // When drawing a dot, there's only one point in a group, so without this check // such group would end up with exactly the same 2 points. if (!point.equals(lastPoint)) { lastPointGroup.push({ x: point.x, y: point.y, time: point.time, color: this.penColor }); } } if (typeof this.onEnd === 'function') { this.onEnd(event); } }; SignaturePad.prototype._handleMouseEvents = function () { this._mouseButtonDown = false; this._canvas.addEventListener('mousedown', this._handleMouseDown); this._canvas.addEventListener('mousemove', this._handleMouseMove); document.addEventListener('mouseup', this._handleMouseUp); }; SignaturePad.prototype._handleTouchEvents = function () { // Pass touch events to canvas element on mobile IE11 and Edge. this._canvas.style.msTouchAction = 'none'; this._canvas.style.touchAction = 'none'; this._canvas.addEventListener('touchstart', this._handleTouchStart); this._canvas.addEventListener('touchmove', this._handleTouchMove); this._canvas.addEventListener('touchend', this._handleTouchEnd); }; SignaturePad.prototype._reset = function () { this.points = []; this._lastVelocity = 0; this._lastWidth = (this.minWidth + this.maxWidth) / 2; this._ctx.fillStyle = this.penColor; }; SignaturePad.prototype._createPoint = function (x, y, time) { var rect = this._canvas.getBoundingClientRect(); return new Point(x - rect.left, y - rect.top, time || new Date().getTime()); }; SignaturePad.prototype._addPoint = function (point) { var points = this.points; var tmp = void 0; points.push(point); if (points.length > 2) { // To reduce the initial lag make it work with 3 points // by copying the first point to the beginning. if (points.length === 3) points.unshift(points[0]); tmp = this._calculateCurveControlPoints(points[0], points[1], points[2]); var c2 = tmp.c2; tmp = this._calculateCurveControlPoints(points[1], points[2], points[3]); var c3 = tmp.c1; var curve = new Bezier(points[1], c2, c3, points[2]); var widths = this._calculateCurveWidths(curve); // Remove the first element from the list, // so that we always have no more than 4 points in points array. points.shift(); return { curve: curve, widths: widths }; } return {}; }; SignaturePad.prototype._calculateCurveControlPoints = function (s1, s2, s3) { var dx1 = s1.x - s2.x; var dy1 = s1.y - s2.y; var dx2 = s2.x - s3.x; var dy2 = s2.y - s3.y; var m1 = { x: (s1.x + s2.x) / 2.0, y: (s1.y + s2.y) / 2.0 }; var m2 = { x: (s2.x + s3.x) / 2.0, y: (s2.y + s3.y) / 2.0 }; var l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1); var l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2); var dxm = m1.x - m2.x; var dym = m1.y - m2.y; var k = l2 / (l1 + l2); var cm = { x: m2.x + dxm * k, y: m2.y + dym * k }; var tx = s2.x - cm.x; var ty = s2.y - cm.y; return { c1: new Point(m1.x + tx, m1.y + ty), c2: new Point(m2.x + tx, m2.y + ty) }; }; SignaturePad.prototype._calculateCurveWidths = function (curve) { var startPoint = curve.startPoint; var endPoint = curve.endPoint; var widths = { start: null, end: null }; var velocity = this.velocityFilterWeight * endPoint.velocityFrom(startPoint) + (1 - this.velocityFilterWeight) * this._lastVelocity; var newWidth = this._strokeWidth(velocity); widths.start = this._lastWidth; widths.end = newWidth; this._lastVelocity = velocity; this._lastWidth = newWidth; return widths; }; SignaturePad.prototype._strokeWidth = function (velocity) { return Math.max(this.maxWidth / (velocity + 1), this.minWidth); }; SignaturePad.prototype._drawPoint = function (x, y, size) { var ctx = this._ctx; ctx.moveTo(x, y); ctx.arc(x, y, size, 0, 2 * Math.PI, false); this._isEmpty = false; }; SignaturePad.prototype._drawCurve = function (curve, startWidth, endWidth) { var ctx = this._ctx; var widthDelta = endWidth - startWidth; var drawSteps = Math.floor(curve.length()); ctx.beginPath(); for (var i = 0; i < drawSteps; i += 1) { // Calculate the Bezier (x, y) coordinate for this step. var t = i / drawSteps; var tt = t * t; var ttt = tt * t; var u = 1 - t; var uu = u * u; var uuu = uu * u; var x = uuu * curve.startPoint.x; x += 3 * uu * t * curve.control1.x; x += 3 * u * tt * curve.control2.x; x += ttt * curve.endPoint.x; var y = uuu * curve.startPoint.y; y += 3 * uu * t * curve.control1.y; y += 3 * u * tt * curve.control2.y; y += ttt * curve.endPoint.y; var width = startWidth + ttt * widthDelta; this._drawPoint(x, y, width); } ctx.closePath(); ctx.fill(); }; SignaturePad.prototype._drawDot = function (point) { var ctx = this._ctx; var width = typeof this.dotSize === 'function' ? this.dotSize() : this.dotSize; ctx.beginPath(); this._drawPoint(point.x, point.y, width); ctx.closePath(); ctx.fill(); }; SignaturePad.prototype._fromData = function (pointGroups, drawCurve, drawDot) { for (var i = 0; i < pointGroups.length; i += 1) { var group = pointGroups[i]; if (group.length > 1) { for (var j = 0; j < group.length; j += 1) { var rawPoint = group[j]; var point = new Point(rawPoint.x, rawPoint.y, rawPoint.time); var color = rawPoint.color; if (j === 0) { // First point in a group. Nothing to draw yet. // All points in the group have the same color, so it's enough to set // penColor just at the beginning. this.penColor = color; this._reset(); this._addPoint(point); } else if (j !== group.length - 1) { // Middle point in a group. var _addPoint2 = this._addPoint(point), curve = _addPoint2.curve, widths = _addPoint2.widths; if (curve && widths) { drawCurve(curve, widths, color); } } else { // Last point in a group. Do nothing. } } } else { this._reset(); var _rawPoint = group[0]; drawDot(_rawPoint); } } }; SignaturePad.prototype._toSVG = function () { var _this2 = this; var pointGroups = this._data; var canvas = this._canvas; var ratio = Math.max(window.devicePixelRatio || 1, 1); var minX = 0; var minY = 0; var maxX = canvas.width / ratio; var maxY = canvas.height / ratio; var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); svg.setAttributeNS(null, 'width', canvas.width); svg.setAttributeNS(null, 'height', canvas.height); this._fromData(pointGroups, function (curve, widths, color) { var path = document.createElement('path'); // Need to check curve for NaN values, these pop up when drawing // lines on the canvas that are not continuous. E.g. Sharp corners // or stopping mid-stroke and than continuing without lifting mouse. if (!isNaN(curve.control1.x) && !isNaN(curve.control1.y) && !isNaN(curve.control2.x) && !isNaN(curve.control2.y)) { var attr = 'M ' + curve.startPoint.x.toFixed(3) + ',' + curve.startPoint.y.toFixed(3) + ' ' + ('C ' + curve.control1.x.toFixed(3) + ',' + curve.control1.y.toFixed(3) + ' ') + (curve.control2.x.toFixed(3) + ',' + curve.control2.y.toFixed(3) + ' ') + (curve.endPoint.x.toFixed(3) + ',' + curve.endPoint.y.toFixed(3)); path.setAttribute('d', attr); path.setAttribute('stroke-width', (widths.end * 2.25).toFixed(3)); path.setAttribute('stroke', color); path.setAttribute('fill', 'none'); path.setAttribute('stroke-linecap', 'round'); svg.appendChild(path); } }, function (rawPoint) { var circle = document.createElement('circle'); var dotSize = typeof _this2.dotSize === 'function' ? _this2.dotSize() : _this2.dotSize; circle.setAttribute('r', dotSize); circle.setAttribute('cx', rawPoint.x); circle.setAttribute('cy', rawPoint.y); circle.setAttribute('fill', rawPoint.color); svg.appendChild(circle); }); var prefix = 'data:image/svg+xml;base64,'; var header = ''; var body = svg.innerHTML; // IE hack for missing innerHTML property on SVGElement if (body === undefined) { var dummy = document.createElement('dummy'); var nodes = svg.childNodes; dummy.innerHTML = ''; for (var i = 0; i < nodes.length; i += 1) { dummy.appendChild(nodes[i].cloneNode(true)); } body = dummy.innerHTML; } var footer = ''; var data = header + body + footer; return prefix + btoa(data); }; SignaturePad.prototype.fromData = function (pointGroups) { var _this3 = this; this.clear(); this._fromData(pointGroups, function (curve, widths) { return _this3._drawCurve(curve, widths.start, widths.end); }, function (rawPoint) { return _this3._drawDot(rawPoint); }); this._data = pointGroups; }; SignaturePad.prototype.toData = function () { return this._data; }; return SignaturePad; }))); },{}],305:[function(require,module,exports){ // TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License (function(Math) { var trimLeft = /^\s+/, trimRight = /\s+$/, tinyCounter = 0, mathRound = Math.round, mathMin = Math.min, mathMax = Math.max, mathRandom = Math.random; function tinycolor (color, opts) { color = (color) ? color : ''; opts = opts || { }; // If input is already a tinycolor, return itself if (color instanceof tinycolor) { return color; } // If we are called as a function, call using new instead if (!(this instanceof tinycolor)) { return new tinycolor(color, opts); } var rgb = inputToRGB(color); this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = mathRound(100*this._a) / 100, this._format = opts.format || rgb.format; this._gradientType = opts.gradientType; // Don't let the range of [0,255] come back in [0,1]. // Potentially lose a little bit of precision here, but will fix issues where // .5 gets interpreted as half of the total, instead of half of 1 // If it was supposed to be 128, this was already taken care of by `inputToRgb` if (this._r < 1) { this._r = mathRound(this._r); } if (this._g < 1) { this._g = mathRound(this._g); } if (this._b < 1) { this._b = mathRound(this._b); } this._ok = rgb.ok; this._tc_id = tinyCounter++; } tinycolor.prototype = { isDark: function() { return this.getBrightness() < 128; }, isLight: function() { return !this.isDark(); }, isValid: function() { return this._ok; }, getOriginalInput: function() { return this._originalInput; }, getFormat: function() { return this._format; }, getAlpha: function() { return this._a; }, getBrightness: function() { //http://www.w3.org/TR/AERT#color-contrast var rgb = this.toRgb(); return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; }, getLuminance: function() { //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef var rgb = this.toRgb(); var RsRGB, GsRGB, BsRGB, R, G, B; RsRGB = rgb.r/255; GsRGB = rgb.g/255; BsRGB = rgb.b/255; if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); }, setAlpha: function(value) { this._a = boundAlpha(value); this._roundA = mathRound(100*this._a) / 100; return this; }, toHsv: function() { var hsv = rgbToHsv(this._r, this._g, this._b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; }, toHsvString: function() { var hsv = rgbToHsv(this._r, this._g, this._b); var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); return (this._a == 1) ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; }, toHsl: function() { var hsl = rgbToHsl(this._r, this._g, this._b); return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; }, toHslString: function() { var hsl = rgbToHsl(this._r, this._g, this._b); var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); return (this._a == 1) ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; }, toHex: function(allow3Char) { return rgbToHex(this._r, this._g, this._b, allow3Char); }, toHexString: function(allow3Char) { return '#' + this.toHex(allow3Char); }, toHex8: function(allow4Char) { return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); }, toHex8String: function(allow4Char) { return '#' + this.toHex8(allow4Char); }, toRgb: function() { return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; }, toRgbString: function() { return (this._a == 1) ? "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; }, toPercentageRgb: function() { return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; }, toPercentageRgbString: function() { return (this._a == 1) ? "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; }, toName: function() { if (this._a === 0) { return "transparent"; } if (this._a < 1) { return false; } return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; }, toFilter: function(secondColor) { var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); var secondHex8String = hex8String; var gradientType = this._gradientType ? "GradientType = 1, " : ""; if (secondColor) { var s = tinycolor(secondColor); secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); } return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; }, toString: function(format) { var formatSet = !!format; format = format || this._format; var formattedString = false; var hasAlpha = this._a < 1 && this._a >= 0; var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); if (needsAlphaFormat) { // Special case for "transparent", all other non-alpha formats // will return rgba when there is transparency. if (format === "name" && this._a === 0) { return this.toName(); } return this.toRgbString(); } if (format === "rgb") { formattedString = this.toRgbString(); } if (format === "prgb") { formattedString = this.toPercentageRgbString(); } if (format === "hex" || format === "hex6") { formattedString = this.toHexString(); } if (format === "hex3") { formattedString = this.toHexString(true); } if (format === "hex4") { formattedString = this.toHex8String(true); } if (format === "hex8") { formattedString = this.toHex8String(); } if (format === "name") { formattedString = this.toName(); } if (format === "hsl") { formattedString = this.toHslString(); } if (format === "hsv") { formattedString = this.toHsvString(); } return formattedString || this.toHexString(); }, clone: function() { return tinycolor(this.toString()); }, _applyModification: function(fn, args) { var color = fn.apply(null, [this].concat([].slice.call(args))); this._r = color._r; this._g = color._g; this._b = color._b; this.setAlpha(color._a); return this; }, lighten: function() { return this._applyModification(lighten, arguments); }, brighten: function() { return this._applyModification(brighten, arguments); }, darken: function() { return this._applyModification(darken, arguments); }, desaturate: function() { return this._applyModification(desaturate, arguments); }, saturate: function() { return this._applyModification(saturate, arguments); }, greyscale: function() { return this._applyModification(greyscale, arguments); }, spin: function() { return this._applyModification(spin, arguments); }, _applyCombination: function(fn, args) { return fn.apply(null, [this].concat([].slice.call(args))); }, analogous: function() { return this._applyCombination(analogous, arguments); }, complement: function() { return this._applyCombination(complement, arguments); }, monochromatic: function() { return this._applyCombination(monochromatic, arguments); }, splitcomplement: function() { return this._applyCombination(splitcomplement, arguments); }, triad: function() { return this._applyCombination(triad, arguments); }, tetrad: function() { return this._applyCombination(tetrad, arguments); } }; // If input is an object, force 1 into "1.0" to handle ratios properly // String input requires "1.0" as input, so 1 will be treated as 1 tinycolor.fromRatio = function(color, opts) { if (typeof color == "object") { var newColor = {}; for (var i in color) { if (color.hasOwnProperty(i)) { if (i === "a") { newColor[i] = color[i]; } else { newColor[i] = convertToPercentage(color[i]); } } } color = newColor; } return tinycolor(color, opts); }; // Given a string or object, convert that input to RGB // Possible string inputs: // // "red" // "#f00" or "f00" // "#ff0000" or "ff0000" // "#ff000000" or "ff000000" // "rgb 255 0 0" or "rgb (255, 0, 0)" // "rgb 1.0 0 0" or "rgb (1, 0, 0)" // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" // function inputToRGB(color) { var rgb = { r: 0, g: 0, b: 0 }; var a = 1; var s = null; var v = null; var l = null; var ok = false; var format = false; if (typeof color == "string") { color = stringInputToObject(color); } if (typeof color == "object") { if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { rgb = rgbToRgb(color.r, color.g, color.b); ok = true; format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { s = convertToPercentage(color.s); v = convertToPercentage(color.v); rgb = hsvToRgb(color.h, s, v); ok = true; format = "hsv"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { s = convertToPercentage(color.s); l = convertToPercentage(color.l); rgb = hslToRgb(color.h, s, l); ok = true; format = "hsl"; } if (color.hasOwnProperty("a")) { a = color.a; } } a = boundAlpha(a); return { ok: ok, format: color.format || format, r: mathMin(255, mathMax(rgb.r, 0)), g: mathMin(255, mathMax(rgb.g, 0)), b: mathMin(255, mathMax(rgb.b, 0)), a: a }; } // Conversion Functions // -------------------- // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: // // `rgbToRgb` // Handle bounds / percentage checking to conform to CSS color spec // // *Assumes:* r, g, b in [0, 255] or [0, 1] // *Returns:* { r, g, b } in [0, 255] function rgbToRgb(r, g, b){ return { r: bound01(r, 255) * 255, g: bound01(g, 255) * 255, b: bound01(b, 255) * 255 }; } // `rgbToHsl` // Converts an RGB color value to HSL. // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] // *Returns:* { h, s, l } in [0,1] function rgbToHsl(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max = mathMax(r, g, b), min = mathMin(r, g, b); var h, s, l = (max + min) / 2; if(max == min) { h = s = 0; // achromatic } else { var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 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; } h /= 6; } return { h: h, s: s, l: l }; } // `hslToRgb` // Converts an HSL color value to RGB. // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] // *Returns:* { r, g, b } in the set [0, 255] function hslToRgb(h, s, l) { var r, g, b; h = bound01(h, 360); s = bound01(s, 100); l = bound01(l, 100); function hue2rgb(p, q, t) { if(t < 0) t += 1; if(t > 1) t -= 1; if(t < 1/6) return p + (q - p) * 6 * t; if(t < 1/2) return q; if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; return p; } if(s === 0) { r = g = b = l; // achromatic } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1/3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1/3); } return { r: r * 255, g: g * 255, b: b * 255 }; } // `rgbToHsv` // Converts an RGB color value to HSV // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] // *Returns:* { h, s, v } in [0,1] function rgbToHsv(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max = mathMax(r, g, b), min = mathMin(r, g, b); var h, s, v = max; var d = max - min; s = max === 0 ? 0 : d / max; if(max == min) { h = 0; // achromatic } 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; } h /= 6; } return { h: h, s: s, v: v }; } // `hsvToRgb` // Converts an HSV color value to RGB. // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] // *Returns:* { r, g, b } in the set [0, 255] function hsvToRgb(h, s, v) { h = bound01(h, 360) * 6; s = bound01(s, 100); v = bound01(v, 100); var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod]; return { r: r * 255, g: g * 255, b: b * 255 }; } // `rgbToHex` // Converts an RGB color to hex // Assumes r, g, and b are contained in the set [0, 255] // Returns a 3 or 6 character hex function rgbToHex(r, g, b, allow3Char) { var hex = [ pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16)) ]; // Return a 3 character hex if possible if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); } return hex.join(""); } // `rgbaToHex` // Converts an RGBA color plus alpha transparency to hex // Assumes r, g, b are contained in the set [0, 255] and // a in [0, 1]. Returns a 4 or 8 character rgba hex function rgbaToHex(r, g, b, a, allow4Char) { var hex = [ pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16)), pad2(convertDecimalToHex(a)) ]; // Return a 4 character hex if possible if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); } return hex.join(""); } // `rgbaToArgbHex` // Converts an RGBA color to an ARGB Hex8 string // Rarely used, but required for "toFilter()" function rgbaToArgbHex(r, g, b, a) { var hex = [ pad2(convertDecimalToHex(a)), pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16)) ]; return hex.join(""); } // `equals` // Can be called with any tinycolor input tinycolor.equals = function (color1, color2) { if (!color1 || !color2) { return false; } return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); }; tinycolor.random = function() { return tinycolor.fromRatio({ r: mathRandom(), g: mathRandom(), b: mathRandom() }); }; // Modification Functions // ---------------------- // Thanks to less.js for some of the basics here // function desaturate(color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.s -= amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); } function saturate(color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.s += amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); } function greyscale(color) { return tinycolor(color).desaturate(100); } function lighten (color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.l += amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); } function brighten(color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var rgb = tinycolor(color).toRgb(); rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); return tinycolor(rgb); } function darken (color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.l -= amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); } // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. // Values outside of this range will be wrapped into this range. function spin(color, amount) { var hsl = tinycolor(color).toHsl(); var hue = (hsl.h + amount) % 360; hsl.h = hue < 0 ? 360 + hue : hue; return tinycolor(hsl); } // Combination Functions // --------------------- // Thanks to jQuery xColor for some of the ideas behind these // function complement(color) { var hsl = tinycolor(color).toHsl(); hsl.h = (hsl.h + 180) % 360; return tinycolor(hsl); } function triad(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; return [ tinycolor(color), tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) ]; } function tetrad(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; return [ tinycolor(color), tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) ]; } function splitcomplement(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; return [ tinycolor(color), tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) ]; } function analogous(color, results, slices) { results = results || 6; slices = slices || 30; var hsl = tinycolor(color).toHsl(); var part = 360 / slices; var ret = [tinycolor(color)]; for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { hsl.h = (hsl.h + part) % 360; ret.push(tinycolor(hsl)); } return ret; } function monochromatic(color, results) { results = results || 6; var hsv = tinycolor(color).toHsv(); var h = hsv.h, s = hsv.s, v = hsv.v; var ret = []; var modification = 1 / results; while (results--) { ret.push(tinycolor({ h: h, s: s, v: v})); v = (v + modification) % 1; } return ret; } // Utility Functions // --------------------- tinycolor.mix = function(color1, color2, amount) { amount = (amount === 0) ? 0 : (amount || 50); var rgb1 = tinycolor(color1).toRgb(); var rgb2 = tinycolor(color2).toRgb(); var p = amount / 100; var rgba = { r: ((rgb2.r - rgb1.r) * p) + rgb1.r, g: ((rgb2.g - rgb1.g) * p) + rgb1.g, b: ((rgb2.b - rgb1.b) * p) + rgb1.b, a: ((rgb2.a - rgb1.a) * p) + rgb1.a }; return tinycolor(rgba); }; // Readability Functions // --------------------- // false // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false tinycolor.isReadable = function(color1, color2, wcag2) { var readability = tinycolor.readability(color1, color2); var wcag2Parms, out; out = false; wcag2Parms = validateWCAG2Parms(wcag2); switch (wcag2Parms.level + wcag2Parms.size) { case "AAsmall": case "AAAlarge": out = readability >= 4.5; break; case "AAlarge": out = readability >= 3; break; case "AAAsmall": out = readability >= 7; break; } return out; }; // `mostReadable` // Given a base color and a list of possible foreground or background // colors for that base, returns the most readable color. // Optionally returns Black or White if the most readable color is unreadable. // *Example* // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" tinycolor.mostReadable = function(baseColor, colorList, args) { var bestColor = null; var bestScore = 0; var readability; var includeFallbackColors, level, size ; args = args || {}; includeFallbackColors = args.includeFallbackColors ; level = args.level; size = args.size; for (var i= 0; i < colorList.length ; i++) { readability = tinycolor.readability(baseColor, colorList[i]); if (readability > bestScore) { bestScore = readability; bestColor = tinycolor(colorList[i]); } } if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { return bestColor; } else { args.includeFallbackColors=false; return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); } }; // Big List of Colors // ------------------ // var names = tinycolor.names = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "0ff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000", blanchedalmond: "ffebcd", blue: "00f", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", burntsienna: "ea7e5d", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "0ff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "f0f", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "789", lightslategrey: "789", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "0f0", limegreen: "32cd32", linen: "faf0e6", magenta: "f0f", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "663399", red: "f00", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "fff", whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" }; // Make it easy to access colors via `hexNames[hex]` var hexNames = tinycolor.hexNames = flip(names); // Utilities // --------- // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` function flip(o) { var flipped = { }; for (var i in o) { if (o.hasOwnProperty(i)) { flipped[o[i]] = i; } } return flipped; } // Return a valid alpha value [0,1] with all invalid values being set to 1 function boundAlpha(a) { a = parseFloat(a); if (isNaN(a) || a < 0 || a > 1) { a = 1; } return a; } // Take input from [0, n] and return it as [0, 1] function bound01(n, max) { if (isOnePointZero(n)) { n = "100%"; } var processPercent = isPercentage(n); n = mathMin(max, mathMax(0, parseFloat(n))); // Automatically convert percentage into number if (processPercent) { n = parseInt(n * max, 10) / 100; } // Handle floating point rounding errors if ((Math.abs(n - max) < 0.000001)) { return 1; } // Convert into [0, 1] range if it isn't already return (n % max) / parseFloat(max); } // Force a number between 0 and 1 function clamp01(val) { return mathMin(1, mathMax(0, val)); } // Parse a base-16 hex value into a base-10 integer function parseIntFromHex(val) { return parseInt(val, 16); } // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 // function isOnePointZero(n) { return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; } // Check to see if string passed in is a percentage function isPercentage(n) { return typeof n === "string" && n.indexOf('%') != -1; } // Force a hex value to have 2 characters function pad2(c) { return c.length == 1 ? '0' + c : '' + c; } // Replace a decimal with it's percentage value function convertToPercentage(n) { if (n <= 1) { n = (n * 100) + "%"; } return n; } // Converts a decimal to a hex value function convertDecimalToHex(d) { return Math.round(parseFloat(d) * 255).toString(16); } // Converts a hex value to a decimal function convertHexToDecimal(h) { return (parseIntFromHex(h) / 255); } var matchers = (function() { // var CSS_INTEGER = "[-\\+]?\\d+%?"; // var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; // Actual matching. // Parentheses and commas are optional, but not required. // Whitespace can take the place of commas or opening paren var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; return { CSS_UNIT: new RegExp(CSS_UNIT), rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; })(); // `isValidCSSUnit` // Take in a single string / number and check to see if it looks like a CSS unit // (see `matchers` above for definition). function isValidCSSUnit(color) { return !!matchers.CSS_UNIT.exec(color); } // `stringInputToObject` // Permissive string parsing. Take in a number of formats, and output an object // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` function stringInputToObject(color) { color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); var named = false; if (names[color]) { color = names[color]; named = true; } else if (color == 'transparent') { return { r: 0, g: 0, b: 0, a: 0, format: "name" }; } // Try to match string input using regular expressions. // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] // Just return an object and let the conversion functions handle that. // This way the result will be the same whether the tinycolor is initialized with string or object. var match; if ((match = matchers.rgb.exec(color))) { return { r: match[1], g: match[2], b: match[3] }; } if ((match = matchers.rgba.exec(color))) { return { r: match[1], g: match[2], b: match[3], a: match[4] }; } if ((match = matchers.hsl.exec(color))) { return { h: match[1], s: match[2], l: match[3] }; } if ((match = matchers.hsla.exec(color))) { return { h: match[1], s: match[2], l: match[3], a: match[4] }; } if ((match = matchers.hsv.exec(color))) { return { h: match[1], s: match[2], v: match[3] }; } if ((match = matchers.hsva.exec(color))) { return { h: match[1], s: match[2], v: match[3], a: match[4] }; } if ((match = matchers.hex8.exec(color))) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), a: convertHexToDecimal(match[4]), format: named ? "name" : "hex8" }; } if ((match = matchers.hex6.exec(color))) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), format: named ? "name" : "hex" }; } if ((match = matchers.hex4.exec(color))) { return { r: parseIntFromHex(match[1] + '' + match[1]), g: parseIntFromHex(match[2] + '' + match[2]), b: parseIntFromHex(match[3] + '' + match[3]), a: convertHexToDecimal(match[4] + '' + match[4]), format: named ? "name" : "hex8" }; } if ((match = matchers.hex3.exec(color))) { return { r: parseIntFromHex(match[1] + '' + match[1]), g: parseIntFromHex(match[2] + '' + match[2]), b: parseIntFromHex(match[3] + '' + match[3]), format: named ? "name" : "hex" }; } return false; } function validateWCAG2Parms(parms) { // return valid WCAG2 parms for isReadable. // If input parms are invalid, return {"level":"AA", "size":"small"} var level, size; parms = parms || {"level":"AA", "size":"small"}; level = (parms.level || "AA").toUpperCase(); size = (parms.size || "small").toLowerCase(); if (level !== "AA" && level !== "AAA") { level = "AA"; } if (size !== "small" && size !== "large") { size = "small"; } return {"level":level, "size":size}; } // Node: Export function if (typeof module !== "undefined" && module.exports) { module.exports = tinycolor; } // AMD/requirejs: Define the module else if (typeof define === 'function' && define.amd) { define(function () {return tinycolor;}); } // Browser: Expose to window else { window.tinycolor = tinycolor; } })(Math); },{}],306:[function(require,module,exports){ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.trimCanvas=t():e.trimCanvas=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t){"use strict";function r(e){var t=e.getContext("2d"),r=e.width,n=e.height,o=t.getImageData(0,0,r,n).data,f=a(!0,r,n,o),i=a(!1,r,n,o),c=u(!0,r,n,o),d=u(!1,r,n,o),p=d-c+1,l=i-f+1,s=t.getImageData(c,f,p,l);return e.width=p,e.height=l,t.clearRect(0,0,p,l),t.putImageData(s,0,0),e}function n(e,t,r,n){return{red:n[4*(r*t+e)],green:n[4*(r*t+e)+1],blue:n[4*(r*t+e)+2],alpha:n[4*(r*t+e)+3]}}function o(e,t,r,o){return n(e,t,r,o).alpha}function a(e,t,r,n){for(var a=e?1:-1,u=e?0:r-1,f=u;e?f-1;f+=a)for(var i=0;i-1;f+=a)for(var i=0;i