From b0eb1c4f9cf022c084f37b8e4966dfb783e66002 Mon Sep 17 00:00:00 2001 From: bunhok Date: Fri, 19 Aug 2022 14:09:03 +0700 Subject: [PATCH] [FEATURE] Upgrade form builder to 3.8.2 refs OSC-17 --- Gemfile | 1 + Gemfile.lock | 3 + config/environments/development.rb | 1 + config/environments/production.rb | 2 + config/environments/staging.rb | 2 + .../form_builder/form-builder.min.js | 30 +- .../form_builder/form-render.min.js | 422 +----------------- 7 files changed, 44 insertions(+), 417 deletions(-) diff --git a/Gemfile b/Gemfile index 643bb49d22..aab8ba27c1 100644 --- a/Gemfile +++ b/Gemfile @@ -131,3 +131,4 @@ group :test do end gem "sentry-raven", "~> 2.13" +gem 'terser', '~> 1.1', '>= 1.1.12' diff --git a/Gemfile.lock b/Gemfile.lock index fbbabd0e34..5aa0dd7045 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -796,6 +796,8 @@ GEM sysrandom (1.0.5) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) + terser (1.1.12) + execjs (>= 0.3.0, < 3) text (1.3.1) thin (1.7.2) daemons (~> 1.0, >= 1.0.9) @@ -976,6 +978,7 @@ DEPENDENCIES sorbet-rails spreadsheet (~> 1.1.3) sysrandom (~> 1.0, >= 1.0.5) + terser (~> 1.1, >= 1.1.12) text (~> 1.3, >= 1.3.1) thin (~> 1.7) thredded (~> 0.6.1) diff --git a/config/environments/development.rb b/config/environments/development.rb index 3fa31dcc86..26716f2f75 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,5 @@ Rails.application.configure do + config.assets.js_compressor = :terser # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on diff --git a/config/environments/production.rb b/config/environments/production.rb index 9808629528..23e30452f0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -98,4 +98,6 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + config.assets.js_compressor = :terser end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 45aee66e34..d73ac964f9 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -77,4 +77,6 @@ config.log_formatter = ::Logger::Formatter.new # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + config.assets.js_compressor = :terser end diff --git a/vendor/assets/javascripts/form_builder/form-builder.min.js b/vendor/assets/javascripts/form_builder/form-builder.min.js index 5dfdd87878..a9b5799285 100644 --- a/vendor/assets/javascripts/form_builder/form-builder.min.js +++ b/vendor/assets/javascripts/form_builder/form-builder.min.js @@ -1,11 +1,19 @@ -!function(n){function t(g){if(l[g])return l[g].exports;var B=l[g]={i:g,l:!1,exports:{}};return n[g].call(B.exports,B,B.exports,t),B.l=!0,B.exports}var l={};return t.m=n,t.c=l,t.i=function(n){return n},t.d=function(n,l,g){t.o(n,l)||Object.defineProperty(n,l,{configurable:!1,enumerable:!0,get:g})},t.n=function(n){var l=n&&n.__esModule?function(){return n["default"]}:function(){return n};return t.d(l,"a",l),l},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="/assets/js/",t(t.s=31)}([function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _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; }; }();\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nvar _mi18n2 = __webpack_require__(/*! mi18n */ 3);\n\nvar _mi18n3 = _interopRequireDefault(_mi18n2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar control = function () {\n function control(config, preview) {\n _classCallCheck(this, control);\n\n config = $.extend({}, config);\n this.preview = preview;\n delete config.isPreview;\n\n var properties = ['label', 'description', 'subtype', 'required'];\n for (var _iterator = properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var prop = _ref;\n\n this[prop] = config[prop];\n delete config[prop];\n }\n\n if (!config.id) {\n if (config.name) {\n config.id = config.name;\n } else {\n config.id = 'control-' + Math.floor(Math.random() * 10000000 + 1);\n }\n }\n this.id = config.id;\n this.type = config.type;\n if (this.description) {\n config.title = this.description;\n }\n\n if (!control.controlConfig) {\n control.controlConfig = {};\n }\n var classId = this.subtype ? this.type + '.' + this.subtype : this.type;\n this.classConfig = control.controlConfig[classId] || {};\n\n if (this.subtype) {\n config.type = this.subtype;\n }\n\n if (this.required) {\n config['aria-required'] = 'true';\n }\n this.config = config;\n this.configure();\n }\n\n control.register = function register(types, controlClass, parentType) {\n var prefix = parentType ? parentType + '.' : '';\n\n if (!control.classRegister) {\n control.classRegister = {};\n }\n if (!Array.isArray(types)) {\n types = [types];\n }\n\n for (var _iterator2 = types, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray2) {\n if (_i2 >= _iterator2.length) break;\n _ref2 = _iterator2[_i2++];\n } else {\n _i2 = _iterator2.next();\n if (_i2.done) break;\n _ref2 = _i2.value;\n }\n\n var type = _ref2;\n\n if (type.indexOf('.') > -1) {\n control.error('Ignoring type ' + type + '. Cannot use the character \\'.\\' in a type name.');\n continue;\n }\n control.classRegister[prefix + type] = controlClass;\n }\n };\n\n control.getRegistered = function getRegistered() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n var types = Object.keys(control.classRegister);\n if (!types.length) {\n return types;\n }\n return types.filter(function (key) {\n if (type) {\n return key.indexOf(type + '.') > -1;\n }\n return key.indexOf('.') == -1;\n });\n };\n\n control.getRegisteredSubtypes = function getRegisteredSubtypes() {\n var types = {};\n for (var key in control.classRegister) {\n if (control.classRegister.hasOwnProperty(key)) {\n var _key$split = key.split('.'),\n type = _key$split[0],\n subtype = _key$split[1];\n\n if (!subtype) {\n continue;\n }\n if (!types[type]) {\n types[type] = [];\n }\n types[type].push(subtype);\n }\n }\n\n return types;\n };\n\n control.getClass = function getClass(type, subtype) {\n var lookup = subtype ? type + '.' + subtype : type;\n var controlClass = control.classRegister[lookup] || control.classRegister[type];\n if (!controlClass) {\n return control.error('Invalid control type. (Type: ' + type + ', Subtype: ' + subtype + '). Please ensure you have registered it, and imported it correctly.');\n }\n\n return controlClass;\n };\n\n control.loadCustom = function loadCustom(controls) {\n var controlClasses = [];\n if (controls) {\n controlClasses = controlClasses.concat(controls);\n }\n\n if (window.fbControls) {\n controlClasses = controlClasses.concat(window.fbControls);\n }\n\n if (!window.fbControlsLoaded) {\n for (var _iterator3 = controlClasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {\n var _ref3;\n\n if (_isArray3) {\n if (_i3 >= _iterator3.length) break;\n _ref3 = _iterator3[_i3++];\n } else {\n _i3 = _iterator3.next();\n if (_i3.done) break;\n _ref3 = _i3.value;\n }\n\n var loadControl = _ref3;\n\n loadControl(control, control.classRegister);\n }\n window.fbControlsLoaded = true;\n }\n };\n\n control.mi18n = function mi18n(lookup) {\n var def = this.definition;\n var i18n = def.i18n || {};\n var locale = _mi18n3.default.locale;\n i18n = i18n[locale] || i18n.default || i18n;\n var lookupCamel = this.camelCase(lookup);\n\n var value = (typeof i18n === 'undefined' ? 'undefined' : _typeof(i18n)) == 'object' ? i18n[lookupCamel] || i18n[lookup] : i18n;\n if (value) {\n return value;\n }\n\n var mapped = def.mi18n;\n if ((typeof mapped === 'undefined' ? 'undefined' : _typeof(mapped)) === 'object') {\n mapped = mapped[lookupCamel] || mapped[lookup];\n }\n if (!mapped) {\n mapped = lookupCamel;\n }\n return _mi18n3.default.get(mapped);\n };\n\n control.active = function active(type) {\n return !Array.isArray(this.definition.inactive) || this.definition.inactive.indexOf(type) == -1;\n };\n\n control.label = function label(type) {\n return this.mi18n(type);\n };\n\n control.icon = function icon(type) {\n var def = this.definition;\n if (def && _typeof(def.icon) === 'object') {\n return def.icon[type];\n }\n return def.icon;\n };\n\n control.prototype.configure = function configure() {};\n\n control.prototype.build = function build() {\n var _config = this.config,\n label = _config.label,\n type = _config.type,\n data = _objectWithoutProperties(_config, ['label', 'type']);\n\n return this.markup(type, _utils2.default.parsedHtml(label), data);\n };\n\n control.prototype.on = function on(eventType) {\n var _this = this;\n\n var events = {\n prerender: function prerender(element) {},\n\n render: function render(evt) {\n var onRender = function onRender() {\n if (_this.onRender) {\n _this.onRender();\n }\n };\n\n if (_this.css) {\n _utils2.default.getStyles(_this.css);\n }\n if (_this.js && !_utils2.default.isCached(_this.js)) {\n _utils2.default.getScripts(_this.js).done(onRender);\n } else {\n onRender();\n }\n }\n };\n return eventType ? events[eventType] : events;\n };\n\n control.error = function error(message) {\n throw new Error(message);\n };\n\n control.prototype.markup = function markup(tag) {\n var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return _utils2.default.markup(tag, content, attributes);\n };\n\n control.prototype.parsedHtml = function parsedHtml(html) {\n return _utils2.default.parsedHtml(html);\n };\n\n control.camelCase = function camelCase(str) {\n return _utils2.default.camelCase(str);\n };\n\n _createClass(control, null, [{\n key: 'definition',\n get: function get() {\n return {};\n }\n }]);\n\n return control;\n}();\n\nexports.default = control;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC5qcz9iMTFmIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIENPTlRST0wuSlNcbmltcG9ydCB1dGlscyBmcm9tICcuL3V0aWxzJztcbmltcG9ydCBtaTE4biBmcm9tICdtaTE4bic7XG5cbi8qKlxuICogQmFzZSBjbGFzcyBmb3IgYWxsIGNvbnRyb2wgY2xhc3Nlc1xuICogRGVmaW5lcyB0aGUgc3RydWN0dXJlIG9mIGEgY29udHJvbCBjbGFzcyBhbmQgc29tZSBzdGFuZGFyZCBjb250cm9sIG1ldGhvZHNcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbCB7XG5cbiAgLyoqXG4gICAqIGluaXRpYWxpc2UgdGhlIGNvbnRyb2wgb2JqZWN0XG4gICAqIEBwYXJhbSB7T2JqZWN0fSBjb25maWcgZWFjaCBjb250cm9sIGNsYXNzIHJlY2VpdmVzIGEgY29udHJvbCBjb25maWd1cmF0aW9uXG4gICAqIG9iamVjdCAoe25hbWUsIGxhYmVsLCBldGN9KVxuICAgKiBAcGFyYW0ge0Jvb2xlYW59IHByZXZpZXcgaXNQcmV2aWV3XG4gICAqL1xuICBjb25zdHJ1Y3Rvcihjb25maWcsIHByZXZpZXcpIHtcbiAgICAvLyBtYWtlIGEgY29weSBvZiBjb25maWcgc28gd2UgZG9uJ3QgY2hhbmdlIHRoZSBv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FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU1BO0FBQ0E7QUFDQTtBQUNBO0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFNQTtBQUdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBS0E7QUFDQTtBQVdBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU9BO0FBQUE7QUFDQTtBQUFBO0FBR0E7QUFDQTtBQUVBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBdkJBO0FBeUJBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBU0E7QUFBQTtBQUFBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQU1BO0FBQ0E7QUFDQTtBQUNBOzs7QUF6UkE7QUFDQTtBQUNBOzs7Ozs7QUFqRUEiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _dom = __webpack_require__(/*! ./dom */ 2);\n\nfunction _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; }\n\nvar utils = {};\nwindow.fbLoaded = {\n js: [],\n css: []\n};\nwindow.fbEditors = {\n quill: {},\n tinymce: {}\n};\n\nutils.inArray = function (needle, haystack) {\n return haystack.indexOf(needle) !== -1;\n};\n\nutils.trimObj = function (attrs) {\n var xmlRemove = [null, undefined, '', false, 'false'];\n for (var attr in attrs) {\n if (utils.inArray(attrs[attr], xmlRemove)) {\n delete attrs[attr];\n } else if (Array.isArray(attrs[attr])) {\n if (!attrs[attr].length) {\n delete attrs[attr];\n }\n }\n }\n\n return attrs;\n};\n\nutils.validAttr = function (attr) {\n var invalid = ['values', 'enableOther', 'other', 'label', 'subtype'];\n return !utils.inArray(attr, invalid);\n};\n\nutils.attrString = function (attrs) {\n var attributes = [];\n\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr) && utils.validAttr(attr)) {\n attr = utils.safeAttr(attr, attrs[attr]);\n attributes.push(attr.name + attr.value);\n }\n }\n return attributes.join(' ');\n};\n\nutils.safeAttr = function (name, value) {\n name = utils.safeAttrName(name);\n var valString = void 0;\n\n if (value) {\n if (Array.isArray(value)) {\n valString = utils.escapeAttr(value.join(' '));\n } else {\n if (typeof value === 'boolean') {\n value = value.toString();\n }\n valString = utils.escapeAttr(value.replace(',', ' ').trim());\n }\n }\n\n value = value ? '=\"' + valString + '\"' : '';\n return {\n name: name,\n value: value\n };\n};\n\nutils.safeAttrName = function (name) {\n var safeAttr = {\n className: 'class'\n };\n\n return safeAttr[name] || utils.hyphenCase(name);\n};\n\nutils.hyphenCase = function (str) {\n str = str.replace(/[^\\w\\s\\-]/gi, '');\n str = str.replace(/([A-Z])/g, function ($1) {\n return '-' + $1.toLowerCase();\n });\n\n return str.replace(/\\s/g, '-').replace(/^-+/g, '');\n};\n\nutils.camelCase = function (str) {\n return str.replace(/-([a-z])/g, function (m, w) {\n return w.toUpperCase();\n });\n};\n\nutils.contentType = function (content) {\n var type = typeof content === 'undefined' ? 'undefined' : _typeof(content);\n if (content instanceof Node || content instanceof HTMLElement) {\n type = 'node';\n } else if (Array.isArray(content)) {\n type = 'array';\n }\n\n return type;\n};\n\nutils.bindEvents = function (element, events) {\n if (events) {\n var _loop = function _loop(event) {\n if (events.hasOwnProperty(event)) {\n element.addEventListener(event, function (evt) {\n return events[event](evt);\n });\n }\n };\n\n for (var event in events) {\n _loop(event);\n }\n }\n};\n\nutils.nameAttr = function (field) {\n var epoch = new Date().getTime();\n var prefix = field.type || utils.hyphenCase(field.label);\n return prefix + '-' + epoch;\n};\n\nutils.markup = function (tag) {\n var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var contentType = utils.contentType(content);\n\n var events = attributes.events,\n attrs = _objectWithoutProperties(attributes, ['events']);\n\n var field = document.createElement(tag);\n\n var appendContent = {\n string: function string(content) {\n field.innerHTML += content;\n },\n object: function object(config) {\n var tag = config.tag,\n content = config.content,\n data = _objectWithoutProperties(config, ['tag', 'content']);\n\n return field.appendChild(utils.markup(tag, content, data));\n },\n node: function node(content) {\n return field.appendChild(content);\n },\n array: function array(content) {\n for (var i = 0; i < content.length; i++) {\n contentType = utils.contentType(content[i]);\n appendContent[contentType](content[i]);\n }\n },\n function: function _function(content) {\n content = content();\n contentType = utils.contentType(content);\n appendContent[contentType](content);\n },\n undefined: function undefined() {}\n };\n\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n var name = utils.safeAttrName(attr);\n field.setAttribute(name, attrs[attr]);\n }\n }\n\n if (content) {\n appendContent[contentType].call(this, content);\n }\n\n utils.bindEvents(field, events);\n\n return field;\n};\nvar m = utils.markup;\n\nutils.parseAttrs = function (elem) {\n var attrs = elem.attributes;\n var data = {};\n utils.forEach(attrs, function (attr) {\n var attrVal = attrs[attr].value;\n if (attrVal.match(/false|true/g)) {\n attrVal = attrVal === 'true';\n } else if (attrVal.match(/undefined/g)) {\n attrVal = undefined;\n }\n\n if (attrVal) {\n data[attrs[attr].name] = attrVal;\n }\n });\n\n return data;\n};\n\nutils.parseOptions = function (options) {\n var optionData = {};\n var data = [];\n\n for (var i = 0; i < options.length; i++) {\n optionData = utils.parseAttrs(options[i]);\n optionData.label = options[i].textContent;\n data.push(optionData);\n }\n\n return data;\n};\n\nutils.parseXML = function (xmlString) {\n var parser = new window.DOMParser();\n var xml = parser.parseFromString(xmlString, 'text/xml');\n var formData = [];\n\n if (xml) {\n var fields = xml.getElementsByTagName('field');\n for (var i = 0; i < fields.length; i++) {\n var fieldData = utils.parseAttrs(fields[i]);\n var options = fields[i].getElementsByTagName('option');\n\n if (options && options.length) {\n fieldData.values = utils.parseOptions(options);\n }\n\n formData.push(fieldData);\n }\n }\n\n return formData;\n};\n\nutils.parsedHtml = function (html) {\n var escapeElement = document.createElement('textarea');\n escapeElement.innerHTML = html;\n return escapeElement.textContent;\n};\n\nutils.escapeHtml = function (html) {\n var escapeElement = document.createElement('textarea');\n escapeElement.textContent = html;\n return escapeElement.innerHTML;\n};\n\nutils.escapeAttr = function (str) {\n var match = {\n '\"': '"',\n '&': '&',\n '<': '<',\n '>': '>'\n };\n\n var replaceTag = function replaceTag(tag) {\n return match[tag] || tag;\n };\n\n return typeof str === 'string' ? str.replace(/[\"&<>]/g, replaceTag) : str;\n};\n\nutils.escapeAttrs = function (attrs) {\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n attrs[attr] = utils.escapeAttr(attrs[attr]);\n }\n }\n\n return attrs;\n};\n\nutils.forEach = function (array, callback, scope) {\n for (var i = 0; i < array.length; i++) {\n callback.call(scope, i, array[i]);\n }\n};\n\nutils.unique = function (array) {\n return array.filter(function (elem, pos, arr) {\n return arr.indexOf(elem) === pos;\n });\n};\n\nutils.remove = function (val, arr) {\n var index = arr.indexOf(val);\n\n if (index > -1) {\n arr.splice(index, 1);\n }\n};\n\nutils.makeLabel = function (fieldData) {\n var _fieldData$label = fieldData.label,\n label = _fieldData$label === undefined ? '' : _fieldData$label,\n _fieldData$descriptio = fieldData.description,\n description = _fieldData$descriptio === undefined ? '' : _fieldData$descriptio,\n attrs = _objectWithoutProperties(fieldData, ['label', 'description']);\n\n var labelText = utils.parsedHtml(label);\n var labelContents = [labelText];\n\n if (attrs.required) {\n labelContents.push(m('span', ' *', { className: 'fb-required' }));\n }\n\n if (attrs.type !== 'hidden') {\n if (description) {\n labelContents.push(m('span', '?', {\n className: 'tooltip-element',\n tooltip: description\n }));\n }\n }\n\n var labelAttrs = {\n className: 'fb-' + attrs.type + '-label'\n };\n\n if (attrs.id) {\n labelAttrs.for = attrs.id;\n }\n\n return m('label', labelContents, labelAttrs);\n};\n\nutils.templateMap = function (type) {\n var template = void 0;\n var templates = utils.templates;\n for (var _iterator = templates, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref2 = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref2 = _i.value;\n }\n\n var _ref = _ref2;\n var key = _ref[0];\n var value = _ref[1];\n\n if (Array.isArray(key)) {\n if (utils.inArray(type, key)) {\n template = value;\n break;\n }\n } else if (type === key) {\n template = value;\n break;\n }\n }\n\n return template;\n};\n\nutils.autocompleteTemplate = function (fieldData) {\n var values = fieldData.values,\n type = fieldData.type,\n data = _objectWithoutProperties(fieldData, ['values', 'type']);\n\n var keyboardNav = function keyboardNav(e) {\n var list = e.target.nextSibling.nextSibling;\n var activeOption = list.getElementsByClassName('active-option')[0];\n var keyCodeMapVals = [[38, function () {\n if (activeOption) {\n if (activeOption.previousSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.previousSibling;\n activeOption.classList.add('active-option');\n }\n }\n }], [40, function () {\n if (activeOption) {\n if (activeOption.nextSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.nextSibling;\n activeOption.classList.add('active-option');\n }\n } else {\n activeOption = list.firstChild;\n activeOption.classList.add('active-option');\n }\n }], [13, function () {\n if (activeOption) {\n e.target.value = activeOption.innerHTML;\n if (list.style.display === 'none') {\n list.style.display = 'block';\n } else {\n list.style.display = 'none';\n }\n }\n }]];\n var keyCodeMap = new Map(keyCodeMapVals);\n\n var direction = keyCodeMap.get(e.keyCode);\n if (!direction) {\n direction = function direction() {\n return false;\n };\n }\n\n return direction();\n };\n var fauxEvents = {\n focus: function focus(evt) {\n var list = evt.target.nextSibling.nextSibling;\n evt.target.addEventListener('keydown', keyboardNav);\n list.style.display = 'block';\n list.style.width = list.parentElement.offsetWidth + 'px';\n },\n blur: function blur(evt) {\n evt.target.removeEventListener('keydown', keyboardNav);\n setTimeout(function () {\n evt.target.nextSibling.nextSibling.style.display = 'none';\n }, 200);\n },\n input: function input(evt) {\n var list = evt.target.nextSibling.nextSibling;\n (0, _dom.filter)(list.querySelectorAll('li'), evt.target.value);\n if (!evt.target.value) {\n list.style.display = 'none';\n } else {\n list.style.display = 'block';\n }\n }\n };\n var fauxAttrs = Object.assign({}, data, {\n id: data.id + '-input',\n events: fauxEvents\n });\n var hiddenAttrs = Object.assign({}, data, { type: 'hidden' });\n delete fauxAttrs.name;\n var field = [m('input', null, fauxAttrs), m('input', null, hiddenAttrs)];\n\n var options = values.map(function (optionData) {\n var label = optionData.label;\n var config = {\n events: {\n click: function click(evt) {\n var list = evt.target.parentElement;\n var field = list.previousSibling.previousSibling;\n field.value = optionData.label;\n field.previousSibling.value = optionData.value;\n list.style.display = 'none';\n }\n },\n value: optionData.value\n };\n return m('li', label, config);\n });\n\n field.push(m('ul', options, { id: data.id + '-list', className: 'fb-' + type + '-list' }));\n\n var onRender = function onRender(evt) {};\n\n return { field: field, onRender: onRender };\n};\n\nutils.selectTemplate = function (fieldData, isPreview) {\n var options = [];\n\n var values = fieldData.values,\n type = fieldData.type,\n inline = fieldData.inline,\n other = fieldData.other,\n toggle = fieldData.toggle,\n data = _objectWithoutProperties(fieldData, ['values', 'type', 'inline', 'other', 'toggle']);\n\n var attrs = utils.processFieldDataAttrs(data, isPreview);\n var optionType = type.replace('-group', '');\n var isSelect = type === 'select';\n\n if (values) {\n if (attrs.placeholder && isSelect) {\n options.push(m('option', attrs.placeholder, {\n disabled: null,\n selected: null\n }));\n }\n\n for (var i = 0; i < values.length; i++) {\n var _values$i = values[i],\n _values$i$label = _values$i.label,\n label = _values$i$label === undefined ? '' : _values$i$label,\n optionAttrs = _objectWithoutProperties(_values$i, ['label']);\n\n optionAttrs.id = attrs.id + '-' + i;\n if (!optionAttrs.selected || attrs.placeholder) {\n delete optionAttrs.selected;\n }\n\n if (isSelect) {\n var o = m('option', document.createTextNode(label), optionAttrs);\n options.push(o);\n } else {\n var wrapperClass = optionType;\n if (inline) {\n wrapperClass = 'fb-' + optionType + '-inline';\n }\n optionAttrs.type = optionType;\n if (optionAttrs.selected) {\n optionAttrs.checked = 'checked';\n delete optionAttrs.selected;\n }\n var input = m('input', null, Object.assign({}, attrs, optionAttrs));\n var labelAttrs = { for: optionAttrs.id };\n var labelContent = [input, label];\n if (toggle) {\n var kcToggle = m('span');\n labelContent = [input, kcToggle, label];\n labelAttrs.className = 'kc-toggle';\n }\n\n var inputLabel = m('label', labelContent, labelAttrs);\n var wrapper = m('div', inputLabel, { className: wrapperClass });\n options.push(wrapper);\n }\n }\n\n if (!isSelect && other) {\n var otherOptionAttrs = {\n id: attrs.id + '-other',\n className: attrs.className + ' other-option',\n events: {\n click: function click() {\n return utils.otherOptionCB(otherOptionAttrs.id);\n }\n }\n };\n\n var _wrapperClass = optionType;\n if (inline) {\n _wrapperClass += '-inline';\n }\n\n var _optionAttrs = Object.assign({}, data, otherOptionAttrs);\n _optionAttrs.type = optionType;\n\n var otherValAttrs = {\n type: 'text',\n name: data.name,\n id: otherOptionAttrs.id + '-value',\n className: 'other-val'\n };\n var otherInputs = [m('input', null, _optionAttrs), document.createTextNode('Other'), m('input', null, otherValAttrs)];\n var _inputLabel = m('label', otherInputs, { for: _optionAttrs.id });\n var _wrapper = m('div', _inputLabel, { className: _wrapperClass });\n options.push(_wrapper);\n }\n }\n\n var template = void 0;\n\n if (type === 'select') {\n template = m(optionType, options, data);\n } else {\n template = m('div', options, { className: type });\n }\n\n return template;\n};\n\nutils.defaultField = function (fieldData) {\n var label = fieldData.label,\n description = fieldData.description,\n subtype = fieldData.subtype,\n type = fieldData.type,\n id = fieldData.id,\n isPreview = fieldData.isPreview,\n data = _objectWithoutProperties(fieldData, ['label', 'description', 'subtype', 'type', 'id', 'isPreview']);\n\n if (id) {\n if (isPreview) {\n if (data.name) {\n data.name = data.name + '-preview';\n } else {\n data.name = utils.nameAttr(fieldData) + '-preview';\n }\n }\n data.id = data.name;\n }\n if (description) {\n data.title = description;\n }\n if (subtype) {\n type = subtype;\n }\n\n var field = {\n field: m(type, utils.parsedHtml(label), data),\n onRender: utils.noop\n };\n\n return function () {\n return field;\n };\n};\n\nutils.getScripts = function (scriptScr, path) {\n var $ = jQuery;\n var _arr = [];\n\n if (!Array.isArray(scriptScr)) {\n scriptScr = [scriptScr];\n }\n\n if (!utils.isCached(scriptScr)) {\n _arr = $.map(scriptScr, function (src) {\n var options = {\n dataType: 'script',\n cache: true,\n url: (path || '') + src\n };\n return $.ajax(options).done(function () {\n return window.fbLoaded.js.push(src);\n });\n });\n }\n\n _arr.push($.Deferred(function (deferred) {\n return $(deferred.resolve);\n }));\n\n return $.when.apply($, _arr);\n};\n\nutils.isCached = function (src) {\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'js';\n\n var isCached = false;\n var cache = window.fbLoaded[type];\n if (Array.isArray(src)) {\n isCached = src.every(function (s) {\n return utils.inArray(s, cache);\n });\n } else {\n isCached = utils.inArray(src, cache);\n }\n return isCached;\n};\n\nutils.getStyles = function (scriptScr, path) {\n if (utils.isCached(scriptScr, 'css')) {\n return;\n }\n var appendStyle = function appendStyle(href) {\n var link = document.createElement('link');\n link.type = 'text/css';\n link.rel = 'stylesheet';\n link.href = href;\n document.head.appendChild(link);\n window.fbLoaded.css.push(href);\n };\n scriptScr.forEach(function (src) {\n return appendStyle((path || '') + src);\n });\n};\n\nutils.longTextTemplate = function (data) {\n var _data$value = data.value,\n value = _data$value === undefined ? '' : _data$value,\n attrs = _objectWithoutProperties(data, ['value']);\n\n var template = {\n field: m('textarea', utils.parsedHtml(value), attrs)\n };\n var editors = {\n tinymce: {\n js: ['//cdn.tinymce.com/4/tinymce.min.js'],\n onRender: function onRender(evt) {\n if (window.tinymce.editors[data.id]) {\n window.tinymce.editors[data.id].remove();\n }\n window.tinymce.init({\n target: template.field,\n height: 250,\n plugins: ['advlist autolink lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', 'insertdatetime media table contextmenu paste code'],\n toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image'\n });\n }\n },\n quill: {\n js: ['//cdn.quilljs.com/1.1.3/quill.js'],\n css: ['//cdn.quilljs.com/1.1.3/quill.snow.css'],\n onRender: function onRender(evt) {\n var Delta = window.Quill.import('delta');\n window.fbEditors.quill[data.id] = {};\n var editor = window.fbEditors.quill[data.id];\n editor.instance = new window.Quill(template.field, {\n modules: {\n toolbar: [[{ 'header': [1, 2, false] }], ['bold', 'italic', 'underline'], ['code-block']]\n },\n placeholder: attrs.placeholder || '',\n theme: 'snow'\n });\n editor.data = new Delta();\n if (value) {\n editor.instance.setContents(window.JSON.parse(utils.parsedHtml(value)));\n }\n editor.instance.on('text-change', function (delta) {\n editor.data = editor.data.compose(delta);\n });\n }\n }\n };\n\n if (data.type !== 'textarea') {\n template.onRender = editors[data.type].onRender;\n }\n if (data.type === 'quill') {\n template.field = m('div', null, attrs);\n }\n\n var onRender = function onRender() {\n if (editors[data.type]) {\n document.removeEventListener('fieldRendered', onRender);\n\n if (editors[data.type].css) {\n utils.getStyles(editors[data.type].css);\n }\n if (editors[data.type].js && !utils.isCached(editors[data.type].js)) {\n utils.getScripts(editors[data.type].js).done(template.onRender);\n } else {\n template.onRender();\n }\n }\n };\n\n return { field: template.field, onRender: onRender };\n};\n\nutils.templates = [['autocomplete', function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var fieldLabel = utils.makeLabel(fieldData);\n var autocomplete = utils.autocompleteTemplate(attrs);\n var template = {\n field: [fieldLabel, autocomplete.field],\n onRender: autocomplete.onRender\n };\n return template;\n}], [_dom.defaultSubtypes.text.concat(['number', 'file', 'date']), function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var fieldLabel = utils.makeLabel(fieldData);\n var template = {\n field: [fieldLabel, m('input', null, attrs)]\n };\n return template;\n}], [['paragraph'].concat(_dom.defaultSubtypes.paragraph), function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var template = {\n field: [m(fieldData.type, utils.parsedHtml(fieldData.label), attrs)]\n };\n return template;\n}], [_dom.defaultSubtypes.button, function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var template = {\n field: m('button', fieldData.label, attrs)\n };\n return template;\n}], [['select', 'checkbox-group', 'radio-group', 'checkbox'], function (fieldData) {\n var fieldLabel = utils.makeLabel(fieldData);\n var field = utils.selectTemplate(fieldData);\n var template = {\n field: [fieldLabel, field]\n };\n return template;\n}], [['textarea', 'tinymce', 'quill'], function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var field = utils.longTextTemplate(attrs);\n var fieldLabel = utils.makeLabel(fieldData);\n var template = {\n field: [fieldLabel, field.field],\n onRender: field.onRender\n };\n return template;\n}]];\n\nutils.processFieldDataAttrs = function (fieldData) {\n var subtype = fieldData.subtype,\n attrs = _objectWithoutProperties(fieldData, ['subtype']);\n\n delete attrs.label;\n delete attrs.description;\n\n if (!attrs.id) {\n attrs.id = attrs.name;\n }\n\n if (subtype) {\n attrs.type = subtype;\n }\n\n if (attrs.multiple || attrs.type === 'checkbox-group') {\n attrs.name = attrs.name + '[]';\n }\n\n if (attrs.required) {\n attrs.required = true;\n attrs['aria-required'] = 'true';\n }\n\n return attrs;\n};\n\nutils.getTemplate = function (fieldData) {\n var isPreview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var field = void 0;\n if (isPreview) {\n if (fieldData.name) {\n fieldData.name = fieldData.name + '-preview';\n } else {\n fieldData.name = utils.nameAttr(fieldData) + '-preview';\n }\n }\n var template = utils.templateMap(fieldData.type);\n\n if (template) {\n template = template(fieldData, isPreview);\n } else {\n template = utils.defaultField(fieldData, isPreview)();\n }\n\n if (fieldData.type !== 'hidden') {\n var wrapperAttrs = {};\n if (fieldData.name) {\n wrapperAttrs.className = 'fb-' + fieldData.type + ' form-group field-' + fieldData.name;\n }\n field = utils.markup('div', template.field, wrapperAttrs);\n } else {\n var attrs = utils.processFieldDataAttrs(fieldData);\n field = utils.markup('input', null, attrs);\n }\n\n if (template.onRender) {\n field.addEventListener('fieldRendered', template.onRender);\n }\n\n return field;\n};\n\nutils.otherOptionCB = function (otherId) {\n var otherInput = document.getElementById(otherId);\n var otherInputValue = document.getElementById(otherId + '-value');\n\n if (otherInput.checked) {\n otherInputValue.style.display = 'inline-block';\n } else {\n otherInputValue.style.display = 'none';\n }\n};\n\nutils.capitalize = function (str) {\n return str.replace(/\\b\\w/g, function (m) {\n return m.toUpperCase();\n });\n};\n\nutils.merge = function (obj1, obj2) {\n var mergedObj = Object.assign({}, obj1, obj2);\n for (var prop in obj2) {\n if (mergedObj.hasOwnProperty(prop)) {\n if (Array.isArray(obj2[prop])) {\n mergedObj[prop] = Array.isArray(obj1[prop]) ? utils.unique(obj1[prop].concat(obj2[prop])) : obj2[prop];\n } else if (_typeof(obj2[prop]) === 'object') {\n mergedObj[prop] = utils.merge(obj1[prop], obj2[prop]);\n } else {\n mergedObj[prop] = obj2[prop];\n }\n }\n }\n return mergedObj;\n};\n\nutils.addEventListeners = function (el, evts, fn) {\n return evts.split(' ').forEach(function (e) {\n return el.addEventListener(e, fn, false);\n });\n};\n\nutils.closest = function (el, cls) {\n var className = cls.replace('.', '');\n while ((el = el.parentElement) && !el.classList.contains(className)) {}\n return el;\n};\n\nutils.noop = function () {\n return null;\n};\n\nutils.debounce = function (func) {\n var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;\n var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var timeout = void 0;\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var context = this;\n var later = function later() {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n };\n};\n\nutils.mobileClass = function () {\n var mobileClass = '';\n (function (a) {\n if (/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0, 4))) {\n mobileClass = ' fb-mobile';\n }\n })(navigator.userAgent || navigator.vendor || window.opera);\n return mobileClass;\n};\n\nutils.makeClassName = function (str) {\n return utils.hyphenCase(str.replace(/[^\\w\\s\\-]/gi, ''));\n};\n\nutils.safename = function (str) {\n return str.replace(/\\s/g, '-').replace(/[^a-zA-Z0-9\\[\\]\\_-]/g, '').toLowerCase();\n};\n\nutils.forceNumber = function (str) {\n return str.replace(/[^0-9]/g, '');\n};\n\nexports.default = utils;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvdXRpbHMuanM/M2M5MCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge2RlZmF1bHRTdWJ0eXBlcywgZmlsdGVyfSBmcm9tICcuL2RvbSc7XG5cbi8qKlxuICogQ3Jvc3MgZmlsZSB1dGlsaXRpZXMgZm9yIHdvcmtpbmcgd2l0aCBhcnJheXMsXG4gKiBzb3J0aW5nIGFuZCBvdGhlciBmdW4gc3R1ZmZcbiAqIEByZXR1cm4ge09iamVjdH0gdXRpbHNcbiAqL1xuICBjb25zdCB1dGlscyA9IHt9O1xuICB3aW5kb3cuZmJMb2FkZWQgPSB7XG4gICAganM6IFtdLFxuICAgIGNzczogW11cbiAgfTtcbiAgd2luZG93LmZiRWRpdG9ycyA9IHtcbiAgICBxdWlsbDoge30sXG4gICAgdGlueW1jZToge31cbiAgfTtcblxuICAvLyBjbGVhbmVyIHN5bnRheCBmb3IgdGVzdGluZyBpbmRleE9mIGVsZW1lbnRcbiAgdXRpbHMuaW5BcnJheSA9IGZ1bmN0aW9uKG5lZWRsZSwgaGF5c3RhY2spIHtcbiAgICByZXR1cm4gaGF5c3RhY2suaW5kZXhPZihuZWVkbGUpICE9PSAtMTtcbiAgfTtcblxuICAvKipcbiAgICogUmVtb3ZlIG51bGwgb3IgdW5kZWZpbmVkIHZhbHVlc1xuICAgKiBAcGFyYW0gIHtPYmplY3R9IGF0dHJzIHthdHRyTmFtZTogYXR0clZhbHVlfVxuICAgKiBAcmV0d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G4gIHV0aWxzLm1hcmt1cCA9IGZ1bmN0aW9uKHRhZywgY29udGVudCA9ICcnLCBhdHRyaWJ1dGVzID0ge30pIHtcbiAgICBsZXQgY29udGVudFR5cGUgPSB1dGlscy5jb250ZW50VHlwZShjb250ZW50KTtcbiAgICBsZXQge2V2ZW50cywgLi4uYXR0cnN9ID0gYXR0cmlidXRlcztcbiAgICBjb25zdCBmaWVsZCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQodGFnKTtcblxuICAgIGNvbnN0IGFwcGVuZENvbnRlbnQgPSB7XG4gICAgICBzdHJpbmc6IGNvbnRlbnQgPT4ge1xuICAgICAgICBmaWVsZC5pbm5lckhUTUwgKz0gY29udGVudDtcbiAgICAgIH0sXG4gICAgICBvYmplY3Q6IGNvbmZpZyA9PiB7XG4gICAgICAgIGxldCB7dGFnLCBjb250ZW50LCAuLi5kYXRhfSA9IGNvbmZpZztcbiAgICAgICAgcmV0dXJuIGZpZWxkLmFwcGVuZENoaWxkKHV0aWxzLm1hcmt1cCh0YWcsIGNvbnRlbnQsIGRhdGEpKTtcbiAgICAgIH0sXG4gICAgICBub2RlOiBjb250ZW50ID0+IHtcbiAgICAgICAgcmV0dXJuIGZpZWxkLmFwcGVuZENoaWxkKGNvbnRlbnQpO1xuICAgICAgfSxcbiAgICAgIGFycmF5OiBjb250ZW50ID0+IHtcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBjb250ZW50Lmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgY29udGVudFR5cGUgPSB1dGlscy5jb250ZW50VHlwZShjb250ZW50W2ldKTtcbiAgICAgICAgICBhcHBlbmRDb250ZW50W2NvbnRlbnRUeXBlXShjb250ZW50W2ldKTtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIGZ1bmN0aW9uOiBjb250ZW50ID0+IHtcbiAgICAgICAgY29udGVudCA9IGNvbnRlbnQoKTtcbiAgICAgICAgY29udGVudFR5cGUgPSB1dGlscy5jb250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G90aGVyKSB7XG4gICAgICAgIGxldCBvdGhlck9wdGlvbkF0dHJzID0ge1xuICAgICAgICAgIGlkOiBgJHthdHRycy5pZH0tb3RoZXJgLFxuICAgICAgICAgIGNsYXNzTmFtZTogYCR7YXR0cnMuY2xhc3NOYW1lfSBvdGhlci1vcHRpb25gLFxuICAgICAgICAgIGV2ZW50czoge1xuICAgICAgICAgICAgY2xpY2s6ICgpID0+IHV0aWxzLm90aGVyT3B0aW9uQ0Iob3RoZXJPcHRpb25BdHRycy5pZClcbiAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIC8vIGxldCBsYWJlbCA9IG1pMThuLmN1cnJlbnQub3RoZXI7XG4gICAgICAgIGxldCB3cmFwcGVyQ2xhc3MgPSBvcHRpb25UeXBlO1xuICAgICAgICBpZiAoaW5saW5lKSB7XG4gICAgICAgICAgd3JhcHBlckNsYXNzICs9ICctaW5saW5lJztcbiAgICAgICAgfVxuXG4gICAgICAgIGxldCBvcHRpb25BdHRycyA9IE9iamVjdC5hc3NpZ24oe30sIGRhdGEsIG90aGVyT3B0aW9uQXR0cnMpO1xuICAgICAgICBvcHRpb25BdHRycy50eXBlID0gb3B0aW9uVHlwZTtcblxuICAgICAgICBsZXQgb3RoZXJWYWxBdHRycyA9IHtcbiAgICAgICAgICB0eXBlOiAndGV4dCcsXG4gICAgICAgICAgbmFtZTogZGF0YS5uYW1lLFxuICAgICAgICAgIGlkOiBgJHtvdGhlck9wdGlvbkF0dHJzLmlkfS12YWx1ZWAsXG4gICAgICAgICAgY2xhc3NOYW1lOiAnb3RoZXItdmFsJ1xuICAgICAgICB9O1xuICAgICAgICBsZXQgb3RoZXJJbnB1dHMgPSBbXG4gICAgICAgICAgbSgnaW5wdXQnLCBudWxsLCBvcHRpb25BdHRycyksXG4gICAgICAgICAgZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUoJ090aGVyJyksXG4gICAgICAgICAgbSgnaW5wdXQnLCBudWxsLCBvdGhlclZhbEF0dHJzK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gICAgICBsZXQgZWRpdG9yID0gd2luZG93LmZiRWRpdG9ycy5xdWlsbFtkYXRhLmlkXTtcbiAgICAgICAgICBlZGl0b3IuaW5zdGFuY2UgPSBuZXcgd2luZG93LlF1aWxsKHRlbXBsYXRlLmZpZWxkLCB7XG4gICAgICAgICAgICBtb2R1bGVzOiB7XG4gICAgICAgICAgICAgIHRvb2xiYXI6IFtcbiAgICAgICAgICAgICAgICBbeydoZWFkZXInOiBbMSwgMiwgZmFsc2VdfV0sXG4gICAgICAgICAgICAgICAgWydib2xkJywgJ2l0YWxpYycsICd1bmRlcmxpbmUnXSxcbiAgICAgICAgICAgICAgICBbJ2NvZGUtYmxvY2snXVxuICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcGxhY2Vob2xkZXI6IGF0dHJzLnBsYWNlaG9sZGVyIHx8ICcnLFxuICAgICAgICAgICAgdGhlbWU6ICdzbm93J1xuICAgICAgICAgIH0pO1xuICAgICAgICAgIGVkaXRvci5kYXRhID0gbmV3IERlbHRhKCk7XG4gICAgICAgICAgaWYgKHZhbHVlKSB7XG4gICAgICAgICAgICBlZGl0b3IuaW5zdGFuY2VcbiAgICAgICAgICAgIC5zZXRDb250ZW50cyh3aW5kb3cuSlNPTi5wYXJzZSh1dGlscy5wYXJzZWRIdG1sKHZhbHVlKSkpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBlZGl0b3IuaW5zdGFuY2Uub24oJ3RleHQtY2hhbmdlJywgZnVuY3Rpb24oZGVsdGEpIHtcbiAgICAgICAgICAgIGVkaXRvci5kYXRhID0gZWRpdG9yLmRhdGEuY29tcG9zZShkZWx0YSk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9O1xuXG4gICAgaWYgKGRhdGEudHlwZSAhPT0gJ3RleHRhcmVhJykge1xuICAgICAgdGVtcGxhdGUub25SZW5kZXIgPSBlZGl0b3JzW2RhdGEudHlwZV0ub25SZW5kZXI7XG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FDQTtBQUFBO0FBQUE7QUFDQTtBQVFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU9BO0FBQ0E7QUFDQTtBQUNBO0FBT0E7QUFDQTtBQUVBO0FBQ0E7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); -},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar instanceDom = exports.instanceDom = {};\nvar defaultSubtypes = exports.defaultSubtypes = {\n text: ['text', 'password', 'email', 'color', 'tel'],\n header: ['h1', 'h2', 'h3'],\n button: ['button', 'submit', 'reset'],\n paragraph: ['p', 'address', 'blockquote', 'canvas', 'output'],\n textarea: ['textarea', 'quill']\n};\n\nvar remove = exports.remove = function remove(element) {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n }\n};\n\nvar empty = exports.empty = function empty(element) {\n while (element.firstChild) {\n element.removeChild(element.firstChild);\n }\n return element;\n};\n\nvar filter = exports.filter = function filter(elems, term) {\n var show = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n var filteredElems = [];\n var toggle = ['none', 'block'];\n\n if (show) {\n toggle = toggle.reverse();\n }\n\n for (var i = elems.length - 1; i >= 0; i--) {\n var txt = elems[i].textContent.toLowerCase();\n if (txt.indexOf(term.toLowerCase()) !== -1) {\n elems[i].style.display = toggle[0];\n filteredElems.push(elems[i]);\n } else {\n elems[i].style.display = toggle[1];\n }\n }\n\n return filteredElems;\n};\n\nvar optionFields = exports.optionFields = ['select', 'checkbox-group', 'checkbox', 'radio-group', 'autocomplete'];\n\nvar optionFieldsRegEx = exports.optionFieldsRegEx = new RegExp('(' + optionFields.join('|') + ')');\n\nvar Dom = function Dom(formID) {\n _classCallCheck(this, Dom);\n\n this.optionFields = optionFields;\n this.optionFieldsRegEx = optionFieldsRegEx;\n\n this.subtypes = defaultSubtypes;\n\n this.empty = empty;\n\n this.filter = filter;\n\n instanceDom[formID] = this;\n return instanceDom[formID];\n};\n\nexports.default = Dom;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvZG9tLmpzPzRmMTQiXSwic291cmNlc0NvbnRlbnQiOlsiXG5leHBvcnQgY29uc3QgaW5zdGFuY2VEb20gPSB7fTtcbmV4cG9ydCBjb25zdCBkZWZhdWx0U3VidHlwZXMgPSB7XG4gICAgICB0ZXh0OiBbJ3RleHQnLCAncGFzc3dvcmQnLCAnZW1haWwnLCAnY29sb3InLCAndGVsJ10sXG4gICAgICBoZWFkZXI6IFsnaDEnLCAnaDInLCAnaDMnXSxcbiAgICAgIGJ1dHRvbjogWydidXR0b24nLCAnc3VibWl0JywgJ3Jlc2V0J10sXG4gICAgICBwYXJhZ3JhcGg6IFsncCcsICdhZGRyZXNzJywgJ2Jsb2NrcXVvdGUnLCAnY2FudmFzJywgJ291dHB1dCddLFxuICAgICAgdGV4dGFyZWE6IFsndGV4dGFyZWEnLCAncXVpbGwnXVxuICAgIH07XG5cbi8qKlxuICogUmVtb3ZlcyBhIGRvbSBub2RlXG4gKiBAcGFyYW0gIHtPYmplY3R9IGVsZW1lbnRcbiAqL1xuZXhwb3J0IGNvbnN0IHJlbW92ZSA9IGVsZW1lbnQgPT4ge1xuICBpZiAoZWxlbWVudC5wYXJlbnROb2RlKSB7XG4gIC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AgICAgKiBAcmV0dXJuIHtBcnJheX0gICAgICAgICBmaWx0ZXJlZCBlbGVtZW50c1xuICAgICAqL1xuICAgIHRoaXMuZmlsdGVyID0gZmlsdGVyO1xuXG4gICAgaW5zdGFuY2VEb21bZm9ybUlEXSA9IHRoaXM7XG4gICAgcmV0dXJuIGluc3RhbmNlRG9tW2Zvcm1JRF07XG4gIH1cbn1cblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvanMvZG9tLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7OztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBTEE7QUFDQTtBQVdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUNBO0FBR0E7QUFNQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU1BO0FBQ0E7QUFRQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUEvQkEiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports){eval('/*!\n * mi18n - https://github.com/Draggable/mi18n\n * Version: 0.3.4\n * Author: Kevin Chappell (http://kevin-chappell.com)\n */\nmodule.exports=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e){"use strict";function n(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(o,u){try{var i=e[o](u),a=i.value}catch(t){return void n(t)}return i.done?void t(a):Promise.resolve(a).then(function(t){r("next",t)},function(t){r("throw",t)})}return r("next")})}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u=function(){function t(t,e){for(var n,r=0;r=this.status){var u=e.processFile(o.responseText);e.langs[t]=u,n(u)}else r({status:this.status,statusText:o.statusText})},o.onerror=function(){r({status:this.status,statusText:o.statusText})},o.send()}})},t.prototype.setCurrent=function(){var t=n(regeneratorRuntime.mark(function t(){var e=0= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlTextarea = function (_control) {\n _inherits(controlTextarea, _control);\n\n function controlTextarea() {\n _classCallCheck(this, controlTextarea);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlTextarea.prototype.build = function build() {\n var _config = this.config,\n _config$value = _config.value,\n value = _config$value === undefined ? '' : _config$value,\n attrs = _objectWithoutProperties(_config, ['value']);\n\n this.field = this.markup('textarea', this.parsedHtml(value), attrs);\n return this.field;\n };\n\n controlTextarea.prototype.on = function on(eventType) {\n var _this2 = this;\n\n if (eventType == 'prerender' && this.preview) {\n return function (element) {\n if (_this2.field) {\n element = _this2.field;\n }\n\n $(element).on('mousedown', function (e) {\n e.stopPropagation();\n });\n };\n }\n return _control.prototype.on.call(this, eventType);\n };\n\n _createClass(controlTextarea, null, [{\n key: 'definition',\n get: function get() {\n return {\n mi18n: {\n textarea: 'textArea'\n }\n };\n }\n }]);\n\n return controlTextarea;\n}(_control3.default);\n\nexports.default = controlTextarea;\n\n_control3.default.register('textarea', controlTextarea);\n_control3.default.register('textarea', controlTextarea, 'textarea');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC90ZXh0YXJlYS5qcz82OTlhIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sIGZyb20gJy4uL2NvbnRyb2wnO1xuXG4vKipcbiAqIFRleHQgaW5wdXQgY2xhc3NcbiAqIE91dHB1dCBhIDxpbnB1dCB0eXBlPVwidGV4dFwiIC4uLiAvPiBmb3JtIGVsZW1lbnRcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbFRleHRhcmVhIGV4dGVuZHMgY29udHJvbCB7XG5cbiAgLyoqXG4gICAqIGNsYXNzIGNvbmZpZ3VyYXRpb25cbiAgICovXG4gIHN0YXRpYyBnZXQgZGVmaW5pdGlvbigpIHtcbiAgICByZXR1cm4ge1xuXG4gICAgICAvLyBtaTE4biBjdXN0b20gbWFwcGluZ3MgKGRlZmF1bHRzIHRvIGNh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Y2thYmxlIChhbmQgbm90IGRyYWdnYWJsZSlcbiAgICAgICAgJChlbGVtZW50KS5vbignbW91c2Vkb3duJywgKGUpID0+IHtcbiAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xuICAgICAgICB9KTtcbiAgICAgIH07XG4gICAgfVxuICAgIHJldHVybiBzdXBlci5vbihldmVudFR5cGUpO1xuICB9XG59XG5cbi8vIHJlZ2lzdGVyIHRoZSBmb2xsb3dpbmcgY29udHJvbHNcbmNvbnRyb2wucmVnaXN0ZXIoJ3RleHRhcmVhJywgY29udHJvbFRleHRhcmVhKTtcbmNvbnRyb2wucmVnaXN0ZXIoJ3RleHRhcmVhJywgY29udHJvbFRleHRhcmVhLCAndGV4dGFyZWEnKTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvanMvY29udHJvbC90ZXh0YXJlYS5qcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFBQTtBQUNBOzs7Ozs7Ozs7Ozs7O0FBS0E7Ozs7Ozs7OztBQW1CQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU1BO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7OztBQXhDQTtBQUNBO0FBR0E7QUFDQTtBQURBO0FBSEE7QUFPQTs7Ozs7O0FBYkE7QUFDQTtBQStDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9")},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nvar _mi18n = __webpack_require__(/*! mi18n */ 3);\n\nvar _mi18n2 = _interopRequireDefault(_mi18n);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlCustom = function (_control) {\n _inherits(controlCustom, _control);\n\n function controlCustom() {\n _classCallCheck(this, controlCustom);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlCustom.register = function register(templates) {\n var fields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n if (!controlCustom.def) {\n controlCustom.def = {\n icon: {},\n i18n: {}\n };\n }\n\n controlCustom.templates = templates;\n\n var locale = _mi18n2.default.locale;\n if (!controlCustom.def.i18n[locale]) {\n controlCustom.def.i18n[locale] = {};\n }\n\n for (var _iterator = fields, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var field = _ref;\n\n var type = field.type;\n field.attrs = field.attrs || {};\n if (!type) {\n if (!field.attrs.type) {\n this.error('Ignoring invalid custom field definition. Please specify a type property.');\n continue;\n }\n type = field.attrs.type;\n }\n\n if (!templates[type]) {\n this.error('Error while registering custom field: ' + field + '. Unable to find a related defined template.');\n }\n\n controlCustom.def.i18n[locale][type] = field.label;\n controlCustom.def.icon[type] = field.icon;\n }\n\n _control3.default.register(Object.keys(templates), controlCustom);\n };\n\n controlCustom.prototype.build = function build() {\n var custom = controlCustom.templates[this.type];\n if (!custom) {\n new Error('Invalid custom control type. Please ensure you have registered it correctly as a template option.');\n }\n\n var fieldData = Object.assign(this.config);\n var properties = ['label', 'description', 'subtype', 'id', 'isPreview', 'required', 'title', 'aria-required', 'type'];\n for (var _iterator2 = properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray2) {\n if (_i2 >= _iterator2.length) break;\n _ref2 = _iterator2[_i2++];\n } else {\n _i2 = _iterator2.next();\n if (_i2.done) break;\n _ref2 = _i2.value;\n }\n\n var prop = _ref2;\n\n fieldData[prop] = this.config[prop] || this[prop];\n }\n\n custom = custom.bind(this);\n custom = custom(fieldData);\n\n if (custom.js) {\n this.js = custom.js;\n }\n if (custom.css) {\n this.css = custom.css;\n }\n\n this.onRender = custom.onRender;\n return {\n field: custom.field,\n layout: custom.layout\n };\n };\n\n _createClass(controlCustom, null, [{\n key: 'definition',\n get: function get() {\n return controlCustom.def;\n }\n }]);\n\n return controlCustom;\n}(_control3.default);\n\nexports.default = controlCustom;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC9jdXN0b20uanM/ZTAzYiJdLCJzb3VyY2VzQ29udGVudC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s7OztBQUFBO0FBQ0E7OztBQUFBO0FBQ0E7Ozs7Ozs7Ozs7O0FBS0E7Ozs7Ozs7OztBQU9BO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUFBO0FBQ0E7QUFEQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFEQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBYUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQURBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQURBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBOzs7QUF4Q0E7QUFDQTtBQUNBOzs7Ozs7QUF4REEiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n\nvar events = {\n loaded: new Event('loaded'),\n viewData: new Event('viewData'),\n userDeclined: new Event('userDeclined'),\n modalClosed: new Event('modalClosed'),\n modalOpened: new Event('modalOpened'),\n formSaved: new Event('formSaved'),\n fieldAdded: new Event('fieldAdded'),\n fieldRemoved: new Event('fieldRemoved'),\n fieldRendered: new Event('fieldRendered')\n};\n\nexports.default = events;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvZXZlbnRzLmpzPzg5MDEiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBGb3JtIEJ1aWxkZXIgZXZlbnRzXG4gKiBAcmV0dXJuIHtPYmplY3R9IHZhcmlvdXMgZXZlbnRzIHRvIGJlIHRyaWdnZXJcbiAqL1xuXG5jb25zdCBldmVudHMgPSB7XG4gIGxvYWRlZDogbmV3IEV2ZW50KCdsb2FkZWQnKSxcbiAgdmlld0RhdGE6IG5ldyBFdmVudCgndmlld0RhdGEnKSxcbiAgdXNlckRlY2xpbmVkOiBuZXcgRXZlbnQoJ3VzZXJEZWNsaW5lZCcpLFxuICBtb2RhbENsb3NlZDogbmV3IEV2ZW50KCdtb2RhbENsb3NlZCcpLFxuICBtb2RhbE9wZW5lZDogbmV3IEV2ZW50KCdtb2RhbE9wZW5lZCcpLFxuICBmb3JtU2F2ZWQ6IG5ldyBFdmVudCgnZm9ybVNhdmVkJyksXG4gIGZpZWxkQWRkZWQ6IG5ldyBFdmVudCgnZmllbGRBZGRlZCcpLFxuICBmaWVsZFJlbW92ZWQ6IG5ldyBFdmVudCgnZmllbGRSZW1vdmVkJyksXG4gIGZpZWxkUmVuZGVyZWQ6IG5ldyBFdmVudCgnZmllbGRSZW5kZXJlZCcpXG59O1xuXG5leHBvcnQgZGVmYXVsdCBldmVudHM7XG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9qcy9ldmVudHMuanMiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFLQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQVRBO0FBQ0E7QUFXQSIsInNvdXJjZVJvb3QiOiIifQ=="); -},function(module,exports,__webpack_require__){"use strict";eval('\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _autocomplete = __webpack_require__(/*! ./autocomplete */ 10);\n\nvar _autocomplete2 = _interopRequireDefault(_autocomplete);\n\nvar _button = __webpack_require__(/*! ./button */ 11);\n\nvar _button2 = _interopRequireDefault(_button);\n\nvar _custom = __webpack_require__(/*! ./custom */ 5);\n\nvar _custom2 = _interopRequireDefault(_custom);\n\nvar _hidden = __webpack_require__(/*! ./hidden */ 12);\n\nvar _hidden2 = _interopRequireDefault(_hidden);\n\nvar _paragraph = __webpack_require__(/*! ./paragraph */ 13);\n\nvar _paragraph2 = _interopRequireDefault(_paragraph);\n\nvar _select = __webpack_require__(/*! ./select */ 14);\n\nvar _select2 = _interopRequireDefault(_select);\n\nvar _text = __webpack_require__(/*! ./text */ 15);\n\nvar _text2 = _interopRequireDefault(_text);\n\nvar _textarea = __webpack_require__(/*! ./textarea */ 4);\n\nvar _textarea2 = _interopRequireDefault(_textarea);\n\nvar _textarea3 = __webpack_require__(/*! ./textarea.tinymce */ 17);\n\nvar _textarea4 = _interopRequireDefault(_textarea3);\n\nvar _textarea5 = __webpack_require__(/*! ./textarea.quill */ 16);\n\nvar _textarea6 = _interopRequireDefault(_textarea5);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = {\n controlAutocomplete: _autocomplete2.default,\n controlButton: _button2.default,\n controlCustom: _custom2.default,\n controlHidden: _hidden2.default,\n controlParagraph: _paragraph2.default,\n controlSelect: _select2.default,\n controlText: _text2.default,\n controlTextarea: _textarea2.default,\n controlTinymce: _textarea4.default,\n controlQuill: _textarea6.default\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC9pbmRleC5qcz84M2MyIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sQXV0b2NvbXBsZXRlIGZyb20gJy4vYXV0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BQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQVZBIiwic291cmNlUm9vdCI6IiJ9')},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar layout = function () {\n function layout(templates, preview) {\n var _this = this;\n\n _classCallCheck(this, layout);\n\n this.preview = preview;\n\n this.templates = {\n label: null,\n help: null,\n default: function _default(field, label, help, data) {\n if (help) {\n label.append(help);\n }\n\n var className = data.id ? 'fb-' + data.type + ' form-group field-' + data.id : '';\n return _this.markup('div', [label, field], {\n className: className\n });\n },\n noLabel: function noLabel(field, label, help, data) {\n var className = data.id ? 'fb-' + data.type + ' form-group field-' + data.id : '';\n return _this.markup('div', field, {\n className: className\n });\n },\n hidden: function hidden(field, label, help, data) {\n return field;\n }\n };\n\n if (templates) {\n this.templates = $.extend(this.templates, templates);\n }\n this.configure();\n }\n\n layout.prototype.configure = function configure() {};\n\n layout.prototype.build = function build(renderControl, data) {\n if (this.preview) {\n if (data.name) {\n data.name = data.name + '-preview';\n } else {\n data.name = _utils2.default.nameAttr(data) + '-preview';\n }\n }\n data.id = data.name;\n this.data = $.extend({}, data);\n\n var control = new renderControl(data, this.preview);\n var field = control.build();\n if ((typeof field === 'undefined' ? 'undefined' : _typeof(field)) !== 'object' || !field.field) {\n field = { field: field };\n }\n\n var label = this.label();\n var help = this.help();\n\n var elementTemplate = this.isTemplate(field.layout) ? field.layout : 'default';\n var element = this.processTemplate(elementTemplate, field.field, label, help);\n\n control.on('prerender')(element);\n\n element.addEventListener('fieldRendered', control.on('render'));\n return element;\n };\n\n layout.prototype.label = function label() {\n var label = this.data.label || '';\n var labelText = _utils2.default.parsedHtml(label);\n var labelContents = [labelText];\n if (this.data.required) {\n labelContents.push(this.markup('span', '*', { className: 'required' }));\n }\n\n if (this.isTemplate('label')) {\n return this.processTemplate('label', labelContents);\n }\n\n return this.markup('label', labelContents, {\n for: this.data.id,\n className: 'fb-' + this.data.type + '-label'\n });\n };\n\n layout.prototype.help = function help() {\n if (!this.data.description) {\n return null;\n }\n\n if (this.isTemplate('help')) {\n return this.processTemplate('help', this.data.description);\n }\n\n return this.markup('span', '?', {\n className: 'tooltip-element',\n tooltip: this.data.description\n });\n };\n\n layout.prototype.isTemplate = function isTemplate(template) {\n return typeof this.templates[template] === 'function';\n };\n\n layout.prototype.processTemplate = function processTemplate(template) {\n var _templates;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n var processed = (_templates = this.templates)[template].apply(_templates, args.concat([this.data]));\n if (processed.jquery) {\n processed = processed[0];\n }\n return processed;\n };\n\n layout.prototype.markup = function markup(tag) {\n var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return _utils2.default.markup(tag, content, attributes);\n };\n\n return layout;\n}();\n\nexports.default = layout;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvbGF5b3V0LmpzPzg3NzkiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gTEFZT1VULkpTXG5pbXBvcnQgdXRpbHMgZnJvbSAnLi91dGlscyc7XG5cbi8qKlxuICogQmFzZSBj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FBRUE7QUFDQTtBQUNBO0FBREE7QUFHQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBREE7QUFHQTtBQUNBO0FBRUE7QUFDQTtBQXpCQTtBQUNBO0FBNEJBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFhQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBS0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBO0FBS0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBO0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUFBO0FBQ0E7QUFEQTtBQUFBO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBU0E7QUFBQTtBQUFBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7Ozs7QUFuTEEiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports){eval('var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n return this;\r\n})();\r\n\r\ntry {\r\n // This works if eval is allowed (see CSP)\r\n g = g || Function("return this")() || (1,eval)("this");\r\n} catch(e) {\r\n // This works if the window reference is available\r\n if(typeof window === "object")\r\n g = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it\'s\r\n// easier to handle this case. if(!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A9IDlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIDEiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=')},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nvar _dom = __webpack_require__(/*! ../dom */ 2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlAutocomplete = function (_control) {\n _inherits(controlAutocomplete, _control);\n\n function controlAutocomplete() {\n _classCallCheck(this, controlAutocomplete);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlAutocomplete.prototype.build = function build() {\n var _this2 = this;\n\n var _config = this.config,\n values = _config.values,\n type = _config.type,\n data = _objectWithoutProperties(_config, ['values', 'type']);\n\n var keyboardNav = function keyboardNav(e) {\n var list = e.target.nextSibling.nextSibling;\n var activeOption = list.getElementsByClassName('active-option')[0];\n var keyCodeMapVals = [[38, function () {\n if (activeOption) {\n if (activeOption.previousSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.previousSibling;\n activeOption.classList.add('active-option');\n }\n }\n }], [40, function () {\n if (activeOption) {\n if (activeOption.nextSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.nextSibling;\n activeOption.classList.add('active-option');\n }\n } else {\n activeOption = list.firstChild;\n activeOption.classList.add('active-option');\n }\n }], [13, function () {\n if (activeOption) {\n e.target.value = activeOption.innerHTML;\n if (list.style.display === 'none') {\n list.style.display = 'block';\n } else {\n list.style.display = 'none';\n }\n }\n }]];\n var keyCodeMap = new Map(keyCodeMapVals);\n\n var direction = keyCodeMap.get(e.keyCode);\n if (!direction) {\n direction = function direction() {\n return false;\n };\n }\n\n return direction();\n };\n var fauxEvents = {\n focus: function focus(evt) {\n var list = evt.target.nextSibling.nextSibling;\n evt.target.addEventListener('keydown', keyboardNav);\n list.style.display = 'block';\n list.style.width = list.parentElement.offsetWidth + 'px';\n },\n blur: function blur(evt) {\n evt.target.removeEventListener('keydown', keyboardNav);\n setTimeout(function () {\n evt.target.nextSibling.nextSibling.style.display = 'none';\n }, 200);\n },\n input: function input(evt) {\n var list = evt.target.nextSibling.nextSibling;\n (0, _dom.filter)(list.querySelectorAll('li'), evt.target.value);\n if (!evt.target.value) {\n list.style.display = 'none';\n } else {\n list.style.display = 'block';\n }\n }\n };\n var fauxAttrs = Object.assign({}, data, {\n id: data.id + '-input',\n events: fauxEvents\n });\n var hiddenAttrs = Object.assign({}, data, { type: 'hidden' });\n delete fauxAttrs.name;\n var field = [this.markup('input', null, fauxAttrs), this.markup('input', null, hiddenAttrs)];\n\n var options = values.map(function (optionData) {\n var label = optionData.label;\n var config = {\n events: {\n click: function click(evt) {\n var list = evt.target.parentElement;\n var field = list.previousSibling.previousSibling;\n field.value = optionData.label;\n field.previousSibling.value = optionData.value;\n list.style.display = 'none';\n }\n },\n value: optionData.value\n };\n return _this2.markup('li', label, config);\n });\n\n field.push(this.markup('ul', options, { id: data.id + '-list', className: 'fb-' + type + '-list' }));\n return field;\n };\n\n controlAutocomplete.prototype.onRender = function onRender(evt) {};\n\n return controlAutocomplete;\n}(_control3.default);\n\nexports.default = controlAutocomplete;\n\n_control3.default.register('autocomplete', controlAutocomplete);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvYXV0b2NvbXBsZXRlLmpzPzE1ZTciXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNvbnRyb2wgZnJvbSAnLi4vY29udHJvbCc7XG5pbXBvcnQge2ZpbHRlcn0gZnJvbSAnLi4vZG9tJztcbi8qKlxuICogQXV0b2NvbXBsZXRlIGNsYXNzXG4gKiBPdXRwdXQgYW4gYXV0b2NvbXBsZXRlIGZvcm0gZWxlbWVudFxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBjb250cm9sQXV0b2NvbXBsZXRlIGV4dGVuZHMgY29udHJvbCB7XG5cbiAgLyoqXG4gICAqIGJ1aWxkIGEgdGV4dCBET00gZWxlbWVudCwgc3VwcG9ydGluZyBvdGhlciBqcXVlcnkgdGV4dCBmb3JtLWNvbnRyb2wnc1xuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICBsZXQge3ZhbHVlcywgdHlwZSwgLi4uZGF0YX0gPSB0aGlzLmNvbmZpZztcbiAgICBjb25zdCBrZXlib2FyZE5hdiA9IChlKSA9PiB7XG4gICAgICBjb25zd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tBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBUEE7QUFTQTtBQVZBO0FBWUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFLQTtBQUNBOzs7O0FBckhBO0FBQ0E7QUF3SEEiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlButton = function (_control) {\n _inherits(controlButton, _control);\n\n function controlButton() {\n _classCallCheck(this, controlButton);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlButton.prototype.build = function build() {\n return {\n field: this.markup('button', this.label, this.config),\n layout: 'noLabel'\n };\n };\n\n return controlButton;\n}(_control3.default);\n\nexports.default = controlButton;\n\n_control3.default.register('button', controlButton);\n_control3.default.register(['button', 'submit', 'reset'], controlButton, 'button');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3Vy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QUZBO0FBSUE7QUFDQTs7OztBQVpBO0FBQ0E7QUFjQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); -},function(module,exports,__webpack_require__){"use strict";eval('\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlHidden = function (_control) {\n _inherits(controlHidden, _control);\n\n function controlHidden() {\n _classCallCheck(this, controlHidden);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlHidden.prototype.build = function build() {\n return {\n field: this.markup(\'input\', null, this.config),\n layout: \'hidden\'\n };\n };\n\n return controlHidden;\n}(_control3.default);\n\nexports.default = controlHidden;\n\n_control3.default.register(\'hidden\', controlHidden);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvaGlkZGVuLmpzPzM0Y2QiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNvbnRyb2wgZnJvbSAnLi4vY29udHJvbCc7XG5cbi8qKlxuICogSGlkZGVuIGlucHV0IGNsYXNzXG4gKiBPdXRwdXQgYSA8aW5wdXQgdHlwZT1cImhpZGRlblwiIC4uLiAvPiBmb3JtIGVsZW1lbnRcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbEhpZGRlbiBleHRlbmRzIGNvbnRyb2wge1xuXG4gIC8qKlxuICAgKiBidWlsZCBhIGhpZGRlbiBpbnB1dCBkb20gZWxlbWVudFxuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICByZXR1cm4ge1xuICAgICAgZmllbGQ6IHRoaXMubWFya3VwKCdpbnB1dCcsIG51bGwsIHRoaXMuY29uZmlnKSxcbiAgICAgIGxheW91dDogJ2hpZGRlbidcbiAgICB9O1xuICB9XG59XG5cbi8vIHJlZ2lzdGVyIHRoZSBmb2xsb3dpbmcgY29udHJvbHNcbmNvbnRyb2wucmVnaXN0ZXIoJ2hpZGRlbicsIGNvbnRyb2xIaWRkZW4pO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9qcy9jb250cm9sL2hpZGRlbi5qcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7QUFDQTs7Ozs7Ozs7Ozs7QUFLQTs7Ozs7Ozs7O0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFGQTtBQUlBO0FBQ0E7Ozs7QUFaQTtBQUNBO0FBY0EiLCJzb3VyY2VSb290IjoiIn0=')},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nvar _utils = __webpack_require__(/*! ../utils */ 1);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlParagraph = function (_control) {\n _inherits(controlParagraph, _control);\n\n function controlParagraph() {\n _classCallCheck(this, controlParagraph);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlParagraph.prototype.build = function build() {\n var _config = this.config,\n type = _config.type,\n attrs = _objectWithoutProperties(_config, ['type']);\n\n var typeMap = {\n 'paragraph': 'p',\n 'header': this.subtype\n };\n if (typeMap[type]) {\n type = typeMap[type];\n }\n return {\n field: this.markup(type, _utils2.default.parsedHtml(this.label), attrs),\n layout: 'noLabel'\n };\n };\n\n return controlParagraph;\n}(_control3.default);\n\nexports.default = controlParagraph;\n\n_control3.default.register(['paragraph', 'header'], controlParagraph);\n_control3.default.register(['p', 'address', 'blockquote', 'canvas', 'output'], controlParagraph, 'paragraph');\n_control3.default.register(['h1', 'h2', 'h3'], controlParagraph, 'header');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvcGFyYWdyYXBoLmpzP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HJvbFBhcmFncmFwaCk7XG5jb250cm9sLnJlZ2lzdGVyKFsncCcsICdhZGRyZXNzJywgJ2Jsb2NrcXVvdGUnLCAnY2FudmFzJywgJ291dHB1dCddLCBjb250cm9sUGFyYWdyYXBoLCAncGFyYWdyYXBoJyk7XG5jb250cm9sLnJlZ2lzdGVyKFsnaDEnLCAnaDInLCAnaDMnXSwgY29udHJvbFBhcmFncmFwaCwgJ2hlYWRlcicpO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9qcy9jb250cm9sL3BhcmFncmFwaC5qcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7Ozs7Ozs7Ozs7OztBQUlBOzs7Ozs7Ozs7QUFNQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBR0E7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFGQTtBQUlBO0FBQ0E7Ozs7QUF0QkE7QUFDQTtBQXdCQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlSelect = function (_control) {\n _inherits(controlSelect, _control);\n\n function controlSelect() {\n _classCallCheck(this, controlSelect);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlSelect.prototype.build = function build() {\n var _this2 = this;\n\n var options = [];\n\n var _config = this.config,\n values = _config.values,\n value = _config.value,\n placeholder = _config.placeholder,\n type = _config.type,\n inline = _config.inline,\n other = _config.other,\n toggle = _config.toggle,\n data = _objectWithoutProperties(_config, ['values', 'value', 'placeholder', 'type', 'inline', 'other', 'toggle']);\n\n var optionType = type.replace('-group', '');\n var isSelect = type === 'select';\n if (data.multiple || type === 'checkbox-group') {\n data.name = data.name + '[]';\n }\n delete data.title;\n\n if (values) {\n if (placeholder && isSelect) {\n options.push(this.markup('option', placeholder, {\n disabled: null,\n selected: null\n }));\n }\n\n for (var i = 0; i < values.length; i++) {\n var option = values[i];\n if (typeof option === 'string') {\n option = { 'label': option, 'value': option };\n }\n\n var _option = option,\n _option$label = _option.label,\n label = _option$label === undefined ? '' : _option$label,\n optionAttrs = _objectWithoutProperties(_option, ['label']);\n\n optionAttrs.id = data.id + '-' + i;\n\n if (!optionAttrs.selected || placeholder) {\n delete optionAttrs.selected;\n }\n\n if (typeof value !== 'undefined' && optionAttrs.value === value) {\n optionAttrs.selected = true;\n }\n\n if (isSelect) {\n var o = this.markup('option', document.createTextNode(label), optionAttrs);\n options.push(o);\n } else {\n var wrapperClass = optionType;\n if (inline) {\n wrapperClass += '-inline';\n }\n optionAttrs.type = optionType;\n if (optionAttrs.selected) {\n optionAttrs.checked = 'checked';\n delete optionAttrs.selected;\n }\n var input = this.markup('input', null, Object.assign({}, data, optionAttrs));\n var labelAttrs = { for: optionAttrs.id };\n var labelContent = [input, label];\n if (toggle) {\n var kcToggle = this.markup('span');\n labelContent = [input, kcToggle, label];\n labelAttrs.className = 'kc-toggle';\n }\n\n var inputLabel = this.markup('label', labelContent, labelAttrs);\n var wrapper = this.markup('div', inputLabel, { className: wrapperClass });\n options.push(wrapper);\n }\n }\n\n if (!isSelect && other) {\n var otherOptionAttrs = {\n id: data.id + '-other',\n className: data.className + ' other-option',\n events: {\n click: function click() {\n return _this2.otherOptionCB(otherOptionAttrs.id);\n }\n }\n };\n\n var _wrapperClass = optionType;\n if (inline) {\n _wrapperClass += '-inline';\n }\n\n var _optionAttrs = Object.assign({}, data, otherOptionAttrs);\n _optionAttrs.type = optionType;\n\n var otherValAttrs = {\n type: 'text',\n name: data.name,\n id: otherOptionAttrs.id + '-value',\n className: 'other-val'\n };\n var otherInputs = [this.markup('input', null, _optionAttrs), document.createTextNode('Other'), this.markup('input', null, otherValAttrs)];\n var _inputLabel = this.markup('label', otherInputs, { for: _optionAttrs.id });\n var _wrapper = this.markup('div', _inputLabel, { className: _wrapperClass });\n options.push(_wrapper);\n }\n }\n\n if (type == 'select') {\n return this.markup(optionType, options, data);\n } else {\n return this.markup('div', options, { className: type });\n }\n };\n\n controlSelect.prototype.otherOptionCB = function otherOptionCB(otherId) {\n var otherInput = document.getElementById(otherId);\n var otherInputValue = document.getElementById(otherId + '-value');\n\n if (otherInput.checked) {\n otherInputValue.style.display = 'inline-block';\n } else {\n otherInputValue.style.display = 'none';\n }\n };\n\n _createClass(controlSelect, null, [{\n key: 'definition',\n get: function get() {\n return {\n inactive: ['checkbox']\n };\n }\n }]);\n\n return controlSelect;\n}(_control3.default);\n\nexports.default = controlSelect;\n\n_control3.default.register(['select', 'checkbox-group', 'radio-group', 'checkbox'], controlSelect);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvc2VsZWN0LmpzPzU3MWQiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNvbnRyb2wgZnJvbSAnLi4vY29udHJvbCc7XG5cbi8qKlxuICogVGV4dCBpbnB1dCBjbGFzc1xuICogT3V0cHV0IGEgPGlucHV0IHR5cGU9XCJ0ZXh0XCIgLi4uIC8+IGZvcm0gZWxlbWVudFxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBjb250cm9sU2VsZWN0IGV4dGVuZHMgY29udHJvbCB7XG5cbiAgLyoqXG4gICAqIGRlZmluaXRpb25cbiAgICogQHJldHVybiB7W3R5cGVdfSBbZGVzY3JpcHRpb25dXG4gICAqL1xuICBzdGF0aWMgZ2V0IGRlZmluaXRpb24oKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgIGluYWN0aXZlOiBbJ2NoZWNrYm94J11cbiAgICB9O1xuICB9XG5cbiAgLyoqXG4gICAqIGJ1aWxkIGEgdGV4dCBET00gZWxlbWVudCwgc3VwcG9ydGluZyBvdGhlciBqcXVlcnkgdGV4dCBmb3JtLWNvbnRyb2wnc1xuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICBsZXQgb3B0aW9ucyA9IFtdO1xuICAgIGxldCB7dmFsdWVzLCB2YWx1ZSwgcGxhY2Vob2xkZXIsIHR5cGUsIGlubGluZSwgb3RoZXIsIHRvZ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Fzc05hbWV9IG90aGVyLW9wdGlvbmAsXG4gICAgICAgICAgZXZlbnRzOiB7XG4gICAgICAgICAgICBjbGljazogKCkgPT4gdGhpcy5vdGhlck9wdGlvbkNCKG90aGVyT3B0aW9uQXR0cnMuaWQpXG4gICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICAvLyBsZXQgbGFiZWwgPSBtaTE4bi5jdXJyZW50Lm90aGVyO1xuICAgICAgICBsZXQgd3JhcHBlckNsYXNzID0gb3B0aW9uVHlwZTtcbiAgICAgICAgaWYgKGlubGluZSkge1xuICAgICAgICAgIHdyYXBwZXJDbGFzcyArPSAnLWlubGluZSc7XG4gICAgICAgIH1cblxuICAgICAgICBsZXQgb3B0aW9uQXR0cnMgPSBPYmplY3QuYXNzaWduKHt9LCBkYXRhLCBvdGhlck9wdGlvbkF0dHJzKTtcbiAgICAgICAgb3B0aW9uQXR0cnMudHlwZSA9IG9wdGlvblR5cGU7XG5cbiAgICAgICAgbGV0IG90aGVyVmFsQXR0cnMgPSB7XG4gICAgICAgICAgdHlwZTogJ3RleHQnLFxuICAgICAgICAgIG5hbWU6IGRhdGEubmFtZSxcbiAgICAgICAgICBpZDogYCR7b3RoZXJPcHRpb25BdHRycy5pZH0tdmFsdWVgLFxuICAgICAgICAgIGNsYXNzTmFtZTogJ290aGVyLXZhbCdcbiAgICAgICAgfTtcbiAgICAgICAgbGV0IG90aGVySW5wdXRzID0gW1xuICAgICAgICAgIHRoaXMubWFya3VwKCdpbnB1dCcsIG51bGwsIG9wdGlvbkF0dHJzKSxcbiAgICAgICAgICBkb2N1bWVudC5jcmVhdGVUZXh0Tm9kZSgnT3RoZXInKSxcbiAgICAgICAgICB0aGlzLm1hcmt1cCgnaW5wdXQnLCBudWxsLCBvdGhlclZhbEF0dHJzKVxuICAgICAgICBdO1xuICAgICAgICBsZXQgaW5wdXRMYWJlbCA9IHRoaXMubWFya3VwKCdsYWJlbCcsIG90aGVySW5wdXRzLCB7Zm9yOiBvcHRpb25Bd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Q0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBSkE7QUFNQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7O0FBdElBO0FBQ0E7QUFDQTtBQURBO0FBR0E7Ozs7OztBQVZBO0FBQ0E7QUE4SUEiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlText = function (_control) {\n _inherits(controlText, _control);\n\n function controlText() {\n _classCallCheck(this, controlText);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlText.prototype.build = function build() {\n return this.markup('input', null, this.config);\n };\n\n _createClass(controlText, null, [{\n key: 'definition',\n get: function get() {\n return {\n mi18n: {\n date: 'dateField',\n file: 'fileUpload'\n }\n };\n }\n }]);\n\n return controlText;\n}(_control3.default);\n\nexports.default = controlText;\n\n_control3.default.register(['text', 'file', 'date', 'number'], controlText);\n_control3.default.register(['text', 'password', 'email', 'color', 'tel'], controlText, 'text');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvdGV4dC5qcz82YWI1Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sIGZyb20gJy4uL2NvbnRyb2wnO1xuXG4vKipcbiAqIFRleHQgaW5wdXQgY2xhc3NcbiAqIE91dHB1dCBhIDxpbnB1dCB0eXBlPVwidGV4dFwiIC4uLiAvPiBmb3JtIGVsZW1lbnRcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbFRleHQgZXh0ZW5kcyBjb250cm9sIHtcblxuICAvKipcbiAgICogY2xhc3MgY29uZmlndXJhdGlvblxuICAgKi9cbiAgc3RhdGljIGdldCBkZWZpbml0aW9uKCkge1xuICAgIHJldHVybiB7XG5cbiAgICAgIC8vIG1pMThuIGN1c3RvbSBtYXBwaW5ncyAoZGVmYXVsdHMgdG8gY2FtZWxDYXNlIHR5cGUpXG4gICAgICBtaTE4bjoge1xuICAgICAgICBkYXRlOiAnZGF0ZUZpZWxkJyxcbiAgICAgICAgZmlsZTogJ2ZpbGVVcGxvYWQnXG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8qKlxuICAgKiBidWlsZCBhIHRleHQgRE9NIGVsZW1lbnQsIHN1cHBvcnRpbmcgb3RoZXIganF1ZXJ5IHRleHQgZm9ybS1jb250cm9sJ3NcbiAgICogQHJldHVybiB7T2JqZWN0fSBET00gRWxlbWVudCB0byBiZSBpbmplY3RlZCBpbnRvIHRoZSBmb3JtLlxuICAgKi9cbiAgYnVpbGQoKSB7XG4gICAgcmV0dXJuIHRoaXMubWFya3VwKCdpbnB1dCcsIG51bGwsIHRoaXMuY29uZmlnKTtcbiAgfVxufVxuXG4vLyByZWdpc3RlciB0aGlzIGNvbnRyb2wgZm9yIHRoZSBmb2xsb3dpbmcgdHlwZXMgJiB0ZXh0IHN1YnR5cGVzXG5jb250cm9sLnJlZ2lzdGVyKFsndGV4dCcsICdmaWxlJywgJ2RhdGUnLCAnbnVtYmVyJ10sIGNvbnRyb2xUZXh0KTtcbmNvbnRyb2wucmVnaXN0ZXIoWyd0ZXh0JywgJ3Bhc3N3b3JkJywgJ2VtYWlsJywgJ2NvbG9yJywgJ3RlbCddLCBjb250cm9sVGV4dCwgJ3RleHQnKTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvanMvY29udHJvbC90ZXh0LmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7OztBQUFBO0FBQ0E7Ozs7Ozs7Ozs7O0FBS0E7Ozs7Ozs7OztBQW9CQTtBQUNBO0FBQ0E7QUFDQTs7O0FBbEJBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7QUFGQTtBQUhBO0FBUUE7Ozs7OztBQWRBO0FBQ0E7QUF5QkE7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==")},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _textarea = __webpack_require__(/*! ./textarea */ 4);\n\nvar _textarea2 = _interopRequireDefault(_textarea);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlQuill = function (_controlTextarea) {\n _inherits(controlQuill, _controlTextarea);\n\n function controlQuill() {\n _classCallCheck(this, controlQuill);\n\n return _possibleConstructorReturn(this, _controlTextarea.apply(this, arguments));\n }\n\n controlQuill.prototype.configure = function configure() {\n this.js = '//cdn.quilljs.com/1.2.4/quill.js';\n this.css = '//cdn.quilljs.com/1.2.4/quill.snow.css';\n };\n\n controlQuill.prototype.build = function build() {\n var _config = this.config,\n _config$value = _config.value,\n value = _config$value === undefined ? '' : _config$value,\n attrs = _objectWithoutProperties(_config, ['value']);\n\n this.field = this.markup('div', null, attrs);\n return this.field;\n };\n\n controlQuill.prototype.onRender = function onRender(evt) {\n var value = this.config.value || '';\n var Delta = window.Quill.import('delta');\n window.fbEditors.quill[this.id] = {};\n var editor = window.fbEditors.quill[this.id];\n editor.instance = new window.Quill(this.field, {\n modules: {\n toolbar: [[{ 'header': [1, 2, false] }], ['bold', 'italic', 'underline'], ['code-block']]\n },\n placeholder: this.config.placeholder || '',\n theme: 'snow'\n });\n editor.data = new Delta();\n if (value) {\n editor.instance.setContents(window.JSON.parse(this.parsedHtml(value)));\n }\n editor.instance.on('text-change', function (delta) {\n editor.data = editor.data.compose(delta);\n });\n };\n\n return controlQuill;\n}(_textarea2.default);\n\nexports.default = controlQuill;\n\n_textarea2.default.register('quill', controlQuill, 'textarea');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvdGV4dGFyZWEucXVpbGwuanM/NDNjMSJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgY29udHJvbFRleHRhcmVhIGZyb20gJy4vdGV4dGFyZWEnO1xuXG4vKipcbiAqIFF1aWxsIHJpY2ggdGV4dCBlZGl0b3IgZWxlbWVudFxuICogU2VlIGh0dHBzOi8vcXVpbGxqcy5jb20vIGZvciBtb3JlIGluZm9cbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbFF1aWxsIGV4dGVuZHMgY29udHJvbFRleHRhcmVhIHtcblxuICAvKipcbiAgICogY29uZmlndXJlIHRoZSBxdWlsbCBlZGl0b3IgcmVxdWlyZW1lbnRzXG4gICAqL1xuICBjb25maWd1cmUoKSB7XG4gICAgdGhpcy5qcyA9ICcvL2Nkbi5xdWlsbGpzLmNvbS8xLjIuNC9xdWlsbC5qcyc7XG4gICAgdGhpcy5jc3MgPSAnLy9jZG4ucXVpbGxqcy5jb20vMS4yLjQvcXVpbGwuc25vdy5jc3MnO1xuICB9XG5cbiAgLyoqXG4gICAqIGJ1aWxkIGEgZGl2IERPTSBlbGVtZW50IHRvIGJlIGxhdGVyIHJlcGxhY2VkIHdpdGggdGhlIHF1aWxsIGVkaXRvclxuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICAvLy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pdG9yLmRhdGEgPSBuZXcgRGVsdGEoKTtcbiAgICBpZiAodmFsdWUpIHtcbiAgICAgIGVkaXRvci5pbnN0YW5jZS5zZXRDb250ZW50cyh3aW5kb3cuSlNPTi5wYXJzZSh0aGlzLnBhcnNlZEh0bWwodmFsdWUpKSk7XG4gICAgfVxuICAgIGVkaXRvci5pbnN0YW5jZS5vbigndGV4dC1jaGFuZ2UnLCBmdW5jdGlvbihkZWx0YSkge1xuICAgICAgZWRpdG9yLmRhdGEgPSBlZGl0b3IuZGF0YS5jb21wb3NlKGRlbHRhKTtcbiAgICB9KTtcbiAgfVxufVxuXG4vLyByZWdpc3RlciBxdWlsbCBhcyBhIHJpY2h0ZXh0IGNvbnRyb2xcbmNvbnRyb2xUZXh0YXJlYS5yZWdpc3RlcigncXVpbGwnLCBjb250cm9sUXVpbGwsICd0ZXh0YXJlYScpO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9qcy9jb250cm9sL3RleHRhcmVhLnF1aWxsLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBOzs7Ozs7Ozs7Ozs7O0FBS0E7Ozs7Ozs7OztBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFLQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFEQTtBQU9BO0FBQ0E7QUFUQTtBQVdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7OztBQWpEQTtBQUNBO0FBbURBIiwic291cmNlUm9vdCI6IiJ9"); -},function(module,exports,__webpack_require__){"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _textarea = __webpack_require__(/*! ./textarea */ 4);\n\nvar _textarea2 = _interopRequireDefault(_textarea);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlTinymce = function (_controlTextarea) {\n _inherits(controlTinymce, _controlTextarea);\n\n function controlTinymce() {\n _classCallCheck(this, controlTinymce);\n\n return _possibleConstructorReturn(this, _controlTextarea.apply(this, arguments));\n }\n\n controlTinymce.prototype.configure = function configure() {\n this.js = ['//cdn.tinymce.com/4/tinymce.min.js'];\n\n if (this.classConfig.js) {\n var js = this.classConfig.js;\n if (!Array.isArray(js)) {\n js = new Array(js);\n }\n this.js.concat(js);\n delete this.classConfig.js;\n }\n\n if (this.classConfig.css) {\n this.css = this.classConfig.css;\n }\n\n this.editorOptions = {\n height: 250,\n paste_data_images: true,\n plugins: ['advlist autolink lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', 'insertdatetime media table contextmenu paste code'],\n toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | table'\n };\n };\n\n controlTinymce.prototype.build = function build() {\n var _config = this.config,\n _config$value = _config.value,\n value = _config$value === undefined ? '' : _config$value,\n attrs = _objectWithoutProperties(_config, ['value']);\n\n this.field = this.markup('textarea', this.parsedHtml(value), attrs);\n return this.field;\n };\n\n controlTinymce.prototype.onRender = function onRender(evt) {\n if (window.tinymce.editors[this.id]) {\n window.tinymce.editors[this.id].remove();\n }\n\n var options = $.extend(this.editorOptions, this.classConfig);\n options.target = this.field;\n\n window.tinymce.init(options);\n };\n\n return controlTinymce;\n}(_textarea2.default);\n\nexports.default = controlTinymce;\n\n_textarea2.default.register('tinymce', controlTinymce, 'textarea');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvdGV4dGFyZWEudGlueW1jZS5qcz9kM2M2Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sVGV4dGFyZWEgZnJvbSAnLi90ZXh0YXJlYSc7XG5cbi8qKlxuICogVGlueU1DRSBlZGl0b3IgZWxlbWVudFxuICogU2VlIGh0dHBzOi8vd3d3LnRpbnltY2UuY29tLyBmb3IgbW9yZSBpbmZvXG4gKlxuICogVG8gY3VzdG9taXNlIHRoZSBvcHRpb25zIG9uIHRoaXMgZWRpdG9yLCBzaW1wbHkgcGFzcyBhbnkgcHJvcGVydGllcyB5b3Ugd2lzaCB0byBvdmVyd3JpdGUgaW4gdGhlIGNvbnRyb2xDb25maWcgb3B0aW9uIHRvIGZvcm1SZW5kZXJcbiAqIGUuZy4gdGhlIGJlbG93IGV4YW1wbGUgd291bGQgZGlzYWJsZSB0aGUgYWJpbGl0eSB0byBwYXN0ZSBpbWFnZXMgYXMgYSBiYXNlNjQgZW5jb2RlZCBzcmNcbiAqIGBgYFxuICogdmFyIHJlbmRlck9wdHMgPSB7XG4gKiAgICBjb250cm9sQ29uZmlnOiB7XG4gKiAgICAgICd0ZXh0YXJlYS50aW55bWNlJzoge1xuKiAgICAgICAgIHBhc3RlX2RhdGFfa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ztBQS9EQTtBQUNBO0FBaUVBIiwic291cmNlUm9vdCI6IiJ9")},function(module,exports,__webpack_require__){"use strict";eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction placeHoldersCount (b64) {\n var len = b64.length\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n}\n\nfunction byteLength (b64) {\n // base64 is 4/3 + up to two characters of the original data\n return b64.length * 3 / 4 - placeHoldersCount(b64)\n}\n\nfunction toByteArray (b64) {\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n placeHolders = placeHoldersCount(b64)\n\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp >> 16) & 0xFF\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY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QUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==")},function(module,exports,__webpack_require__){eval('/* WEBPACK VAR INJECTION */(function(Buffer) {/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item, useSourceMap);\n if(item[2]) {\n return "@media " + item[2] + "{" + content + "}";\n } else {\n return content;\n }\n }).join("");\n };\n\n // import a list of modules into the list\n list.i = function(modules, mediaQuery) {\n if(typeof modules === "string")\n modules = [[null, modules, ""]];\n var alreadyImportedModules = {};\n for(var i = 0; i < this.length; i++) {\n var id = this[i][0];\n if(typeof id === "number")\n alreadyImportedModules[id] = true;\n }\n for(i = 0; i < modules.length; i++) {\n var item = modules[i];\n // skip already imported module\n // this implementation is not 100% perfect for weird media query combinations\n // when a module is imported multiple times with different media queries.\n // I hope this will never occur (Hey this way we have smaller bundles)\n if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {\n if(mediaQuery && !item[2]) {\n item[2] = mediaQuery;\n } else if(mediaQuery) {\n item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";\n }\n list.push(item);\n }\n }\n };\n return list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n var content = item[1] || \'\';\n var cssMapping = item[3];\n if (!cssMapping) {\n return content;\n }\n\n if (useSourceMap) {\n var sourceMapping = toComment(cssMapping);\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \'/*# sourceURL=\' + cssMapping.sourceRoot + source + \' */\'\n });\n\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\'\\n\');\n }\n\n return [content].join(\'\\n\');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString(\'base64\');\n var data = \'sourceMappingURL=data:application/json;charset=utf-8;base64,\' + base64;\n\n return \'/*# \' + data + \' */\';\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../node-libs-browser/~/buffer/index.js */ 21).Buffer))//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vY3NzLWxvYWRlci9saWIvY3NzLWJhc2UuanM/YTk1NSJdLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuXHRNSVQgTGljZW5zZSBodHRwOi8vd3d3Lm9wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL21pdC1saWNlbnNlLnBocFxuXHRBdXRob3IgVG9iaWFzIEtvcHBlcnMgQHNva3JhXG4qL1xuLy8gY3NzIGJhc2UgY29kZSwgaW5qZWN0ZWQgYnkgdGhlIGNzcy1sb2FkZXJcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24odXNlU291cmNlTW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UFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QSIsInNvdXJjZVJvb3QiOiIifQ==')},function(module,exports){eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vaWVlZTc1NC9pbmRleC5qcz85NzMzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydHMucmVhZCA9IGZ1bmN0aW9uIChidWZmZXIsIG9mZnNldCwgaXNMRSwgbUxlbiwgbkJ5dGVzKSB7XG4gIHZhciBlLCBtXG4gIHZhciBlTGVuID0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FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=")},function(module,exports,__webpack_require__){"use strict";eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(/*! base64-js */ 18)\nvar ieee754 = __webpack_require__(/*! ieee754 */ 20)\nvar isArray = __webpack_require__(/*! isarray */ 22)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 9)))//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vbm9kZS1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iAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWtcbiAgICAgICAgY2FzZSAyOlxuICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdXG4gICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMHhDMCkgPT09IDB4ODApIHtcbiAgICAgICAgICAgIHRlbXBDb2RlUG9pbnQgPSAoZmlyc3RCeXRlICYgMHgxRikgPDwgMHg2IHwgKHNlY29uZEJ5dGUgJiAweDNGKVxuICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAweDdGKSB7XG4gICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWtcbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdXG4gICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXVxuICAgICAgICAgIGlmICgoc2Vjb25kQnl0ZSAmIDB4QzApID09PSAweDgwICYmICh0aGlyZEJ5dGUgJiAweEMwKSA9PT0gMHg4MCkge1xuICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAweEYpIDw8IDB4QyB8IChzZWNvbmRCeXRlICYgMHgzRikgPDwgMHg2IHwgKHRoaXJkQnl0ZSAmIDB4M0YpXG4gICAgICAgICAgICBpZiAodGVtcENvZGVQb2ludCA+IDB4N0ZGICYmICh0ZW1wQ29kZVBvaW50IDwgMHhEODAwIHx8IHRlbXBDb2RlUG9pbnQgPiAweERGRkYpKSB7XG4gICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWtcbiAgICAgICAgY2FzZSA0OlxuICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdXG4gICAgICAgICAgdGhpcmR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5dGVzID0gW11cblxuICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7XG4gICAgY29kZVBvaW50ID0gc3RyaW5nLmNoYXJDb2RlQXQoaSlcblxuICAgIC8vIGlzIHN1cnJvZ2F0ZSBjb21wb25lbnRcbiAgICBpZiAoY29kZVBvaW50ID4gMHhEN0ZGICYmIGNvZGVQb2ludCA8IDB4RTAwMCkge1xuICAgICAgLy8gbGFzdCBjaGFyIHdhcyBhIGxlYWRcbiAgICAgIGlmICghbGVhZFN1cnJvZ2F0ZSkge1xuICAgICAgICAvLyBubyBsZWFkIHlldFxuICAgICAgICBpZiAoY29kZVBvaW50ID4gMHhEQkZGKSB7XG4gICAgICAgICAgLy8gdW5leHBlY3RlZCB0cmFpbFxuICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkgYnl0ZXMucHVzaCgweEVGLCAweEJGLCAweEJEKVxuICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkge1xuICAgICAgICAgIC8vIHVucGFpcmVkIGxlYWRcbiAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgICBjb250aW51ZVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gdmFsaWQgbGVhZFxuICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50XG5cbiAgICAgICAgY29udGludWVcbiAgICAgIH1cblxuICAgICAgLy8gMiBsZWFkcyBpbiBhIHJvd1xuICAgICAgaWYgKGNvZGVQb2ludCA8IDB4REMwMCkge1xuICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IGNvZGVQb2ludFxuICAgICAgICBjb250aW51ZVxuICAgICAgfVxuXG4gIC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(arr) {\n return toString.call(arr) == '[object Array]';\n};\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vbm9kZS1saWJzLWJyb3dzZXIvfi9pc2FycmF5L2luZGV4LmpzPzk1ZjMiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHRvU3RyaW5nID0ge30udG9TdHJpbmc7XG5cbm1vZHVsZS5leHBvcnRzID0gQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbiAoYXJyKSB7XG4gIHJldHVybiB0b1N0cmluZy5jYWxsKGFycikgPT0gJ1tvYmplY3QgQXJyYXldJztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAvbW50L2MvVXNlcnMva2V2aW4vUHJvamVjdHMvZm9ybUJ1aWxkZXIvfi9ub2RlLWxpYnMtYnJvd3Nlci9+L2lzYXJyYXkvaW5kZXguanNcbi8vIG1vZHVsZSBpZCA9IDIyXG4vLyBtb2R1bGUgY2h1bmtzID0gMCAxIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==")},function(module,exports,__webpack_require__){eval('/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nvar stylesInDom = {},\n memoize = function(fn) {\n var memo;\n return function () {\n if (typeof memo === "undefined") memo = fn.apply(this, arguments);\n return memo;\n };\n },\n isOldIE = memoize(function() {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader \n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n return window && document && document.all && !window.atob;\n }),\n getElement = (function(fn) {\n var memo = {};\n return function(selector) {\n if (typeof memo[selector] === "undefined") {\n memo[selector] = fn.call(this, selector);\n }\n return memo[selector]\n };\n })(function (styleTarget) {\n return document.querySelector(styleTarget)\n }),\n singletonElement = null,\n singletonCounter = 0,\n styleElementsInsertedAtTop = [],\n fixUrls = __webpack_require__(/*! ./fixUrls */ 24);\n\nmodule.exports = function(list, options) {\n if(typeof DEBUG !== "undefined" && DEBUG) {\n if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");\n }\n\n options = options || {};\n options.attrs = typeof options.attrs === "object" ? options.attrs : {};\n\n // Force single-tag solution on IE6-9, which has a hard limit on the # of `).attr("id",i).appendTo(e(document.head));window.fbLoaded.css.push(n)}})},B=e=>e.replace(/\b\w/g,(function(e){return e.toUpperCase()})),L=(e,t)=>{const r=Object.assign({},e,t);for(const o in t)r.hasOwnProperty(o)&&(Array.isArray(t[o])?r[o]=Array.isArray(e[o])?E(e[o].concat(t[o])):t[o]:"object"==typeof t[o]?r[o]=L(e[o],t[o]):r[o]=t[o]);return r},R=(e,t,r)=>t.split(" ").forEach(t=>e.addEventListener(t,r,!1)),I=(e,t)=>{const r=t.replace(".","");for(;(e=e.parentElement)&&!e.classList.contains(r););return e},F=()=>{let e="";var t;return t=navigator.userAgent||navigator.vendor||window.opera,/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)&&(e="formbuilder-mobile"),e},P=e=>e.replace(/\s/g,"-").replace(/[^a-zA-Z0-9[\]_-]/g,""),M=e=>e.replace(/[^0-9]/g,""),H=(e,t)=>t.filter((function(e){return!~this.indexOf(e)}),e),z=e=>{const t=(e=Array.isArray(e)?e:[e]).map(({src:e,id:t})=>new Promise(r=>{if(window.fbLoaded.css.includes(e))return r(e);const o=w("link",null,{href:e,rel:"stylesheet",id:t});document.head.insertBefore(o,document.head.firstChild)}));return Promise.all(t)},W=e=>{const t=document.getElementById(e);return t.parentElement.removeChild(t)},U=/^col-(xs|sm|md|lg)-([^\s]+)/,V=e=>e.split(" ").filter(e=>U.test(e)||e.startsWith("row-"));function Q(e){const t=["a","an","and","as","at","but","by","for","for","from","in","into","near","nor","of","on","onto","or","the","to","with"].map(e=>`\\s${e}\\s`),r=new RegExp(`(?!${t.join("|")})\\w\\S*`,"g");return(""+e).replace(r,e=>e.charAt(0).toUpperCase()+e.substr(1).replace(/[A-Z]/g,e=>" "+e))}const Y={addEventListeners:R,attrString:u,camelCase:h,capitalize:B,closest:I,getContentType:y,escapeAttr:k,escapeAttrs:e=>{for(const t in e)e.hasOwnProperty(t)&&(e[t]=k(e[t]));return e},escapeHtml:j,forceNumber:M,forEach:q,getScripts:S,getStyles:D,hyphenCase:b,isCached:T,markup:w,merge:L,mobileClass:F,nameAttr:g,parseAttrs:v,parsedHtml:C,parseOptions:x,parseUserData:A,parseXML:O,removeFromArray:N,safeAttr:f,safeAttrName:m,safename:P,subtract:H,trimObj:s,unique:E,validAttr:d,titleCase:Q,splitObject:(e,t)=>{const r=e=>(t,r)=>(t[r]=e[r],t);return[Object.keys(e).filter(e=>t.includes(e)).reduce(r(e),{}),Object.keys(e).filter(e=>!t.includes(e)).reduce(r(e),{})]}};e.fn.swapWith=function(t){var r=e(t),o=e("
");return this.before(o),r.before(this),o.before(r).remove(),this};const G=e=>Object.entries(e).reduce((e,[t,r])=>i(i({},e),{},{[t+"Selector"]:"."+r}),{});r.g=Y},function(e,t,r){r.d(t,"a",(function(){return a}));var o=r(0),n=r(2),i=r.n(n);function l(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}class a{constructor(e,t){this.rawConfig=jQuery.extend({},e),e=jQuery.extend({},e),this.preview=t,delete e.isPreview,this.preview&&delete e.required;const r=["label","description","subtype","required","disabled"];for(const t of r)this[t]=e[t],delete e[t];e.id||(e.name?e.id=e.name:e.id="control-"+Math.floor(1e7*Math.random()+1)),this.id=e.id,this.type=e.type,this.description&&(e.title=this.description),a.controlConfig||(a.controlConfig={});const o=this.subtype?this.type+"."+this.subtype:this.type;this.classConfig=jQuery.extend({},a.controlConfig[o]||{}),this.subtype&&(e.type=this.subtype),this.required&&(e.required="required",e["aria-required"]="true"),this.disabled&&(e.disabled="disabled"),this.config=e,this.configure()}static get definition(){return{}}static register(e,t,r){const o=r?r+".":"";a.classRegister||(a.classRegister={}),Array.isArray(e)||(e=[e]);for(const r of e)-1===r.indexOf(".")?a.classRegister[o+r]=t:a.error(`Ignoring type ${r}. Cannot use the character '.' in a type name.`)}static getRegistered(e=!1){const t=Object.keys(a.classRegister);return t.length?t.filter(t=>e?t.indexOf(e+".")>-1:-1==t.indexOf(".")):t}static getRegisteredSubtypes(){const e={};for(const t in a.classRegister)if(a.classRegister.hasOwnProperty(t)){const[r,o]=t.split(".");if(!o)continue;e[r]||(e[r]=[]),e[r].push(o)}return e}static getClass(e,t){const r=t?e+"."+t:e,o=a.classRegister[r]||a.classRegister[e];return o||a.error("Invalid control type. (Type: "+e+", Subtype: "+t+"). Please ensure you have registered it, and imported it correctly.")}static loadCustom(e){let t=[];if(e&&(t=t.concat(e)),window.fbControls&&(t=t.concat(window.fbControls)),!this.fbControlsLoaded){for(const e of t)e(a,a.classRegister);this.fbControlsLoaded=!0}}static mi18n(e,t){const r=this.definition;let o=r.i18n||{};o=o[i.a.locale]||o.default||o;const n=this.camelCase(e),l="object"==typeof o?o[n]||o[e]:o;if(l)return l;let a=r.mi18n;return"object"==typeof a&&(a=a[n]||a[e]),a||(a=n),i.a.get(a,t)}static active(e){return!Array.isArray(this.definition.inactive)||-1==this.definition.inactive.indexOf(e)}static label(e){return this.mi18n(e)}static icon(e){const t=this.definition;return t&&"object"==typeof t.icon?t.icon[e]:t.icon}configure(){}build(){const e=this.config,{label:t,type:r}=e,n=l(e,["label","type"]);return this.markup(r,Object(o.x)(t),n)}on(e){const t={prerender:e=>e,render:e=>{const t=()=>{this.onRender&&this.onRender(e)};this.css&&Object(o.p)(this.css),this.js&&!Object(o.s)(this.js)?Object(o.o)(this.js).done(t):t()}};return e?t[e]:t}static error(e){throw new Error(e)}markup(e,t="",r={}){return this.element=Object(o.t)(e,t,r),this.element}parsedHtml(e){return Object(o.x)(e)}static camelCase(e){return Object(o.d)(e)}}},function(e,t){ +/*! + * mi18n - https://github.com/Draggable/mi18n + * Version: 0.4.7 + * Author: Kevin Chappell (http://kevin-chappell.com) + */ +e.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}([function(e,t,r){var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=r(2),i=r(10),l=Object.prototype.toString;function a(e){return"[object Array]"===l.call(e)}function s(e){return null!==e&&"object"===(void 0===e?"undefined":o(e))}function d(e){return"[object Function]"===l.call(e)}function c(e,t){if(null!=e)if("object"!==(void 0===e?"undefined":o(e))&&(e=[e]),a(e))for(var r=0,n=e.length;r=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};o.forEach(["delete","get","head"],(function(e){a.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){a.headers[e]=o.merge(i)})),e.exports=a}).call(this,r(12))},function(e,t,r){e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),o=0;o0&&void 0!==arguments[0]?arguments[0]:l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}return e.prototype.processConfig=function(e){var t=this,r=Object.assign({},l,e),o=r.location,n=function(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}(r,["location"]),i=o.replace(/\/?$/,"/");this.config=Object.assign({},{location:i},n);var a=this.config,s=a.override,d=a.preloaded,c=void 0===d?{}:d,u=Object.entries(this.langs).concat(Object.entries(s||c));this.langs=u.reduce((function(e,r){var o=r[0],n=r[1];return e[o]=t.applyLanguage.call(t,o,n),e}),{}),this.locale=this.config.locale||this.config.langs[0]},e.prototype.init=function(e){return this.processConfig.call(this,Object.assign({},this.config,e)),this.setCurrent(this.locale)},e.prototype.addLanguage=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t="string"==typeof t?this.processFile.call(this,t):t,this.applyLanguage.call(this,e,t),this.config.langs.push("locale")},e.prototype.getValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.locale;return this.langs[t]&&this.langs[t][e]||this.getFallbackValue(e)},e.prototype.getFallbackValue=function(e){var t=Object.values(this.langs).find((function(t){return t[e]}));return t&&t[e]},e.prototype.makeSafe=function(e){var t={"{":"\\{","}":"\\}","|":"\\|"};return e=e.replace(/\{|\}|\|/g,(function(e){return t[e]})),new RegExp(e,"g")},e.prototype.put=function(e,t){return this.current[e]=t},e.prototype.get=function(e,t){var r=this.getValue(e);if(r){var n=r.match(/\{[^}]+?\}/g),i=void 0;if(t&&n)if("object"===(void 0===t?"undefined":o(t)))for(var l=0;l1&&void 0!==arguments[1])||arguments[1],r=this;return new Promise((function(o,n){if(-1!==r.loaded.indexOf(e)&&t)return r.applyLanguage.call(r,r.langs[e]),o(r.langs[e]);var l=[r.config.location,e,r.config.extension].join("");return(0,i.get)(l).then((function(t){var n=t.data,i=r.processFile(n);return r.applyLanguage.call(r,e,i),r.loaded.push(e),o(r.langs[e])})).catch((function(){var t=r.applyLanguage.call(r,e);o(t)}))}))},e.prototype.applyLanguage=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.config.override[e]||{},o=this.langs[e]||{};return this.langs[e]=Object.assign({},o,t,r),this.langs[e]},e.prototype.setCurrent=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en-US";return this.loadLang(t).then((function(){return e.locale=t,e.current=e.langs[t],e.current}))},n(e,[{key:"getLangs",get:function(){return this.config.langs}}]),e}();t.default=new a},function(e,t,r){e.exports=r(9)},function(e,t,r){var o=r(0),n=r(2),i=r(11),l=r(1);function a(e){var t=new i(e),r=n(i.prototype.request,t);return o.extend(r,i.prototype,t),o.extend(r,t),r}var s=a(l);s.Axios=i,s.create=function(e){return a(o.merge(l,e))},s.Cancel=r(6),s.CancelToken=r(26),s.isCancel=r(5),s.all=function(e){return Promise.all(e)},s.spread=r(27),e.exports=s,e.exports.default=s},function(e,t,r){ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +function o(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(o(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&o(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,r){var o=r(1),n=r(0),i=r(21),l=r(22);function a(e){this.defaults=e,this.interceptors={request:new i,response:new i}}a.prototype.request=function(e){"string"==typeof e&&(e=n.merge({url:arguments[0]},arguments[1])),(e=n.merge(o,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[l,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},n.forEach(["delete","get","head","options"],(function(e){a.prototype[e]=function(t,r){return this.request(n.merge(r||{},{method:e,url:t}))}})),n.forEach(["post","put","patch"],(function(e){a.prototype[e]=function(t,r,o){return this.request(n.merge(o||{},{method:e,url:t,data:r}))}})),e.exports=a},function(e,t,r){var o,n,i=e.exports={};function l(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(o===setTimeout)return setTimeout(e,0);if((o===l||!o)&&setTimeout)return o=setTimeout,setTimeout(e,0);try{return o(e,0)}catch(t){try{return o.call(null,e,0)}catch(t){return o.call(this,e,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:l}catch(e){o=l}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var d,c=[],u=!1,f=-1;function p(){u&&d&&(u=!1,d.length?c=d.concat(c):f=-1,c.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=c.length;t;){for(d=c,c=[];++f1)for(var r=1;r=0)return;l[t]="set-cookie"===t?(l[t]?l[t]:[]).concat([r]):l[t]?l[t]+", "+r:r}})),l):l}},function(e,t,r){var o=r(0);e.exports=o.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var o=e;return t&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=o.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){function o(){this.message="String contains an invalid character"}o.prototype=new Error,o.prototype.code=5,o.prototype.name="InvalidCharacterError",e.exports=function(e){for(var t,r,n=String(e),i="",l=0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.charAt(0|l)||(a="=",l%1);i+=a.charAt(63&t>>8-l%1*8)){if((r=n.charCodeAt(l+=.75))>255)throw new o;t=t<<8|r}return i}},function(e,t,r){var o=r(0);e.exports=o.isStandardBrowserEnv()?{write:function(e,t,r,n,i,l){var a=[];a.push(e+"="+encodeURIComponent(t)),o.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),o.isString(n)&&a.push("path="+n),o.isString(i)&&a.push("domain="+i),!0===l&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){var o=r(0);function n(){this.handlers=[]}n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){o.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},function(e,t,r){var o=r(0),n=r(23),i=r(5),l=r(1),a=r(24),s=r(25);function d(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return d(e),e.baseURL&&!a(e.url)&&(e.url=s(e.baseURL,e.url)),e.headers=e.headers||{},e.data=n(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||l.adapter)(e).then((function(t){return d(e),t.data=n(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(d(e),t&&t.response&&(t.response.data=n(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){var o=r(0);e.exports=function(e,t,r){return o.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t,r){e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){var o=r(6);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new o(e),t(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},function(e,t,r){e.exports=function(e){return function(t){return e.apply(null,t)}}}])},function(e,t,r){r.d(t,"d",(function(){return i})),r.d(t,"g",(function(){return l})),r.d(t,"c",(function(){return a})),r.d(t,"a",(function(){return s})),r.d(t,"f",(function(){return d})),r.d(t,"e",(function(){return c})),r.d(t,"b",(function(){return u}));var o=r(2);const n=()=>null;r.n(o).a.addLanguage("en-US",{NATIVE_NAME:"English (US)",ENGLISH_NAME:"English",addOption:"Add Option +",allFieldsRemoved:"All fields were removed.",allowMultipleFiles:"Allow users to upload multiple files",autocomplete:"Autocomplete",button:"Button",cannotBeEmpty:"This field cannot be empty",checkboxGroup:"Checkbox Group",checkbox:"Checkbox",checkboxes:"Checkboxes",className:"Class",clearAllMessage:"Are you sure you want to clear all fields?",clear:"Clear",close:"Close",content:"Content",copy:"Copy To Clipboard",copyButton:"+",copyButtonTooltip:"Copy",dateField:"Date Field",description:"Help Text",descriptionField:"Description",devMode:"Developer Mode",editNames:"Edit Names",editorTitle:"Form Elements",editXML:"Edit XML",enableOther:"Enable "Other"",enableOtherMsg:"Let users enter an unlisted option",fieldDeleteWarning:"false",fieldVars:"Field Variables",fieldNonEditable:"This field cannot be edited.",fieldRemoveWarning:"Are you sure you want to remove this field?",fileUpload:"File Upload",formUpdated:"Form Updated",getStarted:"Drag a field from the right to this area",header:"Header",hide:"Edit",hidden:"Hidden Input",inline:"Inline",inlineDesc:"Display {type} inline",label:"Label",labelEmpty:"Field Label cannot be empty",limitRole:"Limit access to one or more of the following roles:",mandatory:"Mandatory",maxlength:"Max Length",minOptionMessage:"This field requires a minimum of 2 options",minSelectionRequired:"Minimum {min} selections required",multipleFiles:"Multiple Files",name:"Name",no:"No",noFieldsToClear:"There are no fields to clear",number:"Number",off:"Off",on:"On",option:"Option",optionCount:"Option {count}",options:"Options",optional:"optional",optionLabelPlaceholder:"Label",optionValuePlaceholder:"Value",optionEmpty:"Option value required",other:"Other",paragraph:"Paragraph",placeholder:"Placeholder","placeholders.value":"Value","placeholders.label":"Label","placeholders.email":"Enter your email","placeholders.className":"space separated classes","placeholders.password":"Enter your password",preview:"Preview",radioGroup:"Radio Group",radio:"Radio",removeMessage:"Remove Element",removeOption:"Remove Option",remove:"×",required:"Required",requireValidOption:"Only accept a pre-defined Option",richText:"Rich Text Editor",roles:"Access",rows:"Rows",save:"Save",selectOptions:"Options",select:"Select",selectColor:"Select Color",selectionsMessage:"Allow Multiple Selections",size:"Size","size.xs":"Extra Small","size.sm":"Small","size.m":"Default","size.lg":"Large",style:"Style","styles.btn.default":"Default","styles.btn.danger":"Danger","styles.btn.info":"Info","styles.btn.primary":"Primary","styles.btn.success":"Success","styles.btn.warning":"Warning",subtype:"Type",text:"Text Field",textArea:"Text Area",toggle:"Toggle",warning:"Warning!",value:"Value",viewJSON:"[{…}]",viewXML:"</>",yes:"Yes"});const i={actionButtons:[],allowStageSort:!0,append:!1,controlOrder:["autocomplete","button","checkbox-group","checkbox","date","file","header","hidden","number","paragraph","radio-group","select","text","textarea"],controlPosition:"right",dataType:"json",defaultFields:[],disabledActionButtons:[],disabledAttrs:[],disabledFieldButtons:{},disabledSubtypes:{},disableFields:[],disableHTMLLabels:!1,disableInjectedStyle:!1,editOnAdd:!1,fields:[],fieldRemoveWarn:!1,fieldEditContainer:null,inputSets:[],notify:{error:e=>{console.log(e)},success:e=>{console.log(e)},warning:e=>{console.warn(e)}},onAddField:(e,t)=>t,onAddFieldAfter:(e,t)=>t,onAddOption:e=>e,onClearAll:n,onCloseFieldEdit:n,onOpenFieldEdit:n,onSave:n,persistDefaultFields:!1,prepend:!1,replaceFields:[],roles:{1:"Administrator"},scrollToFieldOnAdd:!0,showActionButtons:!0,sortableControls:!1,stickyControls:{enable:!0,offset:{top:5,bottom:"auto",right:"auto"}},subtypes:{},templates:{},typeUserAttrs:{},typeUserDisabledAttrs:{},typeUserEvents:{},defaultGridColumnClass:"col-md-12",cancelGridModeDistance:100,enableColumnInsertMenu:!1,enableEnhancedBootstrapGrid:!1},l={btn:["default","danger","info","primary","success","warning"]},a={location:"assets/lang/"},s={},d={rowWrapperClass:"rowWrapper",colWrapperClass:"colWrapper",tmpColWrapperClass:"tempColWrapper",tmpRowPlaceholderClass:"tempRowWrapper",invisibleRowPlaceholderClass:"invisibleRowPlaceholder"},c=333,u="li.form-field"},function(e,t,r){r.d(t,"d",(function(){return o})),r.d(t,"f",(function(){return i})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return a})),r.d(t,"e",(function(){return s})),r.d(t,"a",(function(){return c}));const o={},n={text:["text","password","email","color","tel"],header:["h1","h2","h3"],button:["button","submit","reset"],paragraph:["p","address","blockquote","canvas","output"],textarea:["textarea","quill"]},i=e=>{e.parentNode&&e.parentNode.removeChild(e)},l=e=>{for(;e.firstChild;)e.removeChild(e.firstChild);return e},a=(e,t,r=!0)=>{const o=[];let n=["none","block"];r&&(n=n.reverse());for(let r=e.length-1;r>=0;r--){-1!==e[r].textContent.toLowerCase().indexOf(t.toLowerCase())?(e[r].style.display=n[0],o.push(e[r])):e[r].style.display=n[1]}return o},s=["select","checkbox-group","checkbox","radio-group","autocomplete"],d=new RegExp(`(${s.join("|")})`);class c{constructor(e){return this.optionFields=s,this.optionFieldsRegEx=d,this.subtypes=n,this.empty=l,this.filter=a,o[e]=this,o[e]}onRender(e,t){e.parentElement?t(e):window.requestAnimationFrame(()=>this.onRender(e,t))}}},function(e,t,r){function o(e){let t;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event"),t.initEvent(e,!0,!0)),t}const n={loaded:o("loaded"),viewData:o("viewData"),userDeclined:o("userDeclined"),modalClosed:o("modalClosed"),modalOpened:o("modalOpened"),formSaved:o("formSaved"),fieldAdded:o("fieldAdded"),fieldRemoved:o("fieldRemoved"),fieldRendered:o("fieldRendered"),fieldEditOpened:o("fieldEditOpened"),fieldEditClosed:o("fieldEditClosed")};t.a=n},function(e,t,r){r.d(t,"a",(function(){return l}));var o=r(1),n=r(2),i=r.n(n);class l extends o.a{static register(e={},t=[]){l.customRegister={},l.def||(l.def={icon:{},i18n:{}}),l.templates=e;const r=i.a.locale;l.def.i18n[r]||(l.def.i18n[r]={}),o.a.register(Object.keys(e),l);for(const n of t){let t=n.type;if(n.attrs=n.attrs||{},!t){if(!n.attrs.type){this.error("Ignoring invalid custom field definition. Please specify a type property.");continue}t=n.attrs.type}let i=n.subtype||t;if(!e[t]){const e=o.a.getClass(t,n.subtype);if(!e){this.error("Error while registering custom field: "+t+(n.subtype?":"+n.subtype:"")+". Unable to find any existing defined control or template for rendering.");continue}i=n.datatype?n.datatype:`${t}-${Math.floor(9e3*Math.random()+1e3)}`,l.customRegister[i]=jQuery.extend(n,{type:t,class:e})}l.def.i18n[r][i]=n.label,l.def.icon[i]=n.icon}}static getRegistered(e=!1){return e?o.a.getRegistered(e):Object.keys(l.customRegister)}static lookup(e){return l.customRegister[e]}static get definition(){return l.def}build(){let e=l.templates[this.type];if(!e)return this.error("Invalid custom control type. Please ensure you have registered it correctly as a template option.");const t=Object.assign(this.config),r=["label","description","subtype","id","isPreview","required","title","aria-required","type"];for(const e of r)t[e]=this.config[e]||this[e];return e=e.bind(this),e=e(t),e.js&&(this.js=e.js),e.css&&(this.css=e.css),this.onRender=e.onRender,{field:e.field,layout:e.layout}}}l.customRegister={}},function(e){e.exports=JSON.parse('{"a":"formbuilder-icon-"}')},function(e,t,r){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r=e[1]||"",o=e[3];if(!o)return r;if(t&&"function"==typeof btoa){var n=(l=o,a=btoa(unescape(encodeURIComponent(JSON.stringify(l)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(s," */")),i=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[r].concat(i).concat([n]).join("\n")}var l,a,s;return[r].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,o){"string"==typeof e&&(e=[[null,e,""]]);var n={};if(o)for(var i=0;i{let r=e.id?`formbuilder-${e.type} form-group field-${e.id}`:"";if(e.className){const n=Object(o.m)(e.className);n&&n.length>0&&(r+=" "+n.join(" ")),t.classList&&t.classList.remove(...n)}return r};class i{constructor(e,t){this.preview=t,this.templates={label:null,help:null,default:(e,t,r,o)=>(r&&t.appendChild(r),this.markup("div",[t,e],{className:n(o,e)})),noLabel:(e,t,r,o)=>this.markup("div",e,{className:n(o,e)}),hidden:e=>e},e&&(this.templates=jQuery.extend(this.templates,e)),this.configure()}configure(){}build(e,t,r){this.preview&&(t.name?t.name=t.name+"-preview":t.name=o.g.nameAttr(t)+"-preview"),t.id=t.name,this.data=jQuery.extend({},t);const n=new e(t,this.preview);let i=n.build();"object"==typeof i&&i.field||(i={field:i});const l=this.label(),a=this.help();let s;s=r&&this.isTemplate(r)?r:this.isTemplate(i.layout)?i.layout:"default";const d=this.processTemplate(s,i.field,l,a);return n.on("prerender")(d),d.addEventListener("fieldRendered",n.on("render")),d}label(){const e=this.data.label||"",t=[o.g.parsedHtml(e)];return this.data.required&&t.push(this.markup("span","*",{className:"formbuilder-required"})),this.isTemplate("label")?this.processTemplate("label",t):this.markup("label",t,{for:this.data.id,className:`formbuilder-${this.data.type}-label`})}help(){return this.data.description?this.isTemplate("help")?this.processTemplate("help",this.data.description):this.markup("span","?",{className:"tooltip-element",tooltip:this.data.description}):null}isTemplate(e){return"function"==typeof this.templates[e]}processTemplate(e,...t){let r=this.templates[e](...t,this.data);return r.jquery&&(r=r[0]),r}markup(e,t="",r={}){return o.g.markup(e,t,r)}}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(t,r,o){var n=o(1),i=o(4);function l(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}class a extends n.a{static get definition(){return{mi18n:{requireValidOption:"requireValidOption"}}}build(){const e=this.config,{values:t,type:r}=e,o=l(e,["values","type"]),n=e=>{const t=e.target.nextSibling.nextSibling,r=e.target.nextSibling,o=this.getActiveOption(t);let n=new Map([[38,()=>{const e=this.getPreviousOption(o);e&&this.selectOption(t,e)}],[40,()=>{const e=this.getNextOption(o);e&&this.selectOption(t,e)}],[13,()=>{o?(e.target.value=o.innerHTML,r.value=o.getAttribute("value"),"none"===t.style.display?this.showList(t,o):this.hideList(t)):this.config.requireValidOption&&(this.isOptionValid(t,e.target.value)||(e.target.value="",e.target.nextSibling.value="")),e.preventDefault()}],[27,()=>{this.hideList(t)}]]).get(e.keyCode);return n||(n=()=>!1),n()},a={focus:e=>{const t=e.target.nextSibling.nextSibling,r=Object(i.c)(t.querySelectorAll("li"),e.target.value);if(e.target.addEventListener("keydown",n),e.target.value.length>0){const e=r.length>0?r[r.length-1]:null;this.showList(t,e)}},blur:e=>{e.target.removeEventListener("keydown",n);const t=setTimeout(()=>{e.target.nextSibling.nextSibling.style.display="none",clearTimeout(t)},200);if(this.config.requireValidOption){const t=e.target.nextSibling.nextSibling;this.isOptionValid(t,e.target.value)||(e.target.value="",e.target.nextSibling.value="")}},input:e=>{const t=e.target.nextSibling.nextSibling;e.target.nextSibling.value=e.target.value;const r=Object(i.c)(t.querySelectorAll("li"),e.target.value);if(0==r.length)this.hideList(t);else{let e=this.getActiveOption(t);e||(e=r[r.length-1]),this.showList(t,e)}}},s=Object.assign({},o,{id:o.id+"-input",autocomplete:"off",events:a}),d=Object.assign({},o,{type:"hidden"});delete s.name;const c=[this.markup("input",null,s),this.markup("input",null,d)],u=t.map(e=>{const t=e.label,r={events:{click:t=>{const r=t.target.parentElement,o=r.previousSibling.previousSibling;o.value=e.label,o.nextSibling.value=e.value,this.hideList(r)}},value:e.value};return this.markup("li",t,r)});return c.push(this.markup("ul",u,{id:o.id+"-list",className:`formbuilder-${r}-list`})),c}hideList(e){this.selectOption(e,null),e.style.display="none"}showList(e,t){this.selectOption(e,t),e.style.display="block",e.style.width=e.parentElement.offsetWidth+"px"}getActiveOption(e){const t=e.getElementsByClassName("active-option")[0];return t&&"none"!==t.style.display?t:null}getPreviousOption(e){let t=e;do{t=t?t.previousSibling:null}while(null!=t&&"none"===t.style.display);return t}getNextOption(e){let t=e;do{t=t?t.nextSibling:null}while(null!=t&&"none"===t.style.display);return t}selectOption(e,t){const r=e.querySelectorAll("li");for(let e=0;e=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}class p extends n.a{build(){const e=this.config,{type:t}=e,r=f(e,["type"]);let o=t;const n={paragraph:"p",header:this.subtype};return n[t]&&(o=n[t]),{field:this.markup(o,u.g.parsedHtml(this.label),r),layout:"noLabel"}}}function m(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}n.a.register(["paragraph","header"],p),n.a.register(["p","address","blockquote","canvas","output"],p,"paragraph"),n.a.register(["h1","h2","h3","h4","h5","h6"],p,"header");class b extends n.a{static get definition(){return{inactive:["checkbox"],mi18n:{minSelectionRequired:"minSelectionRequired"}}}build(){const e=[],t=this.config,{values:r,value:o,placeholder:n,type:i,inline:l,other:a,toggle:s}=t,d=m(t,["values","value","placeholder","type","inline","other","toggle"]),c=i.replace("-group",""),f="select"===i;if((d.multiple||"checkbox-group"===i)&&(d.name=d.name+"[]"),"checkbox-group"===i&&d.required){const e=this,t=this.onRender.bind(this);this.onRender=function(){t(),e.groupRequired()}}if(delete d.title,r){n&&f&&e.push(this.markup("option",n,{disabled:null,selected:null}));for(let t=0;t{const t=e.target,r=t.parentElement.previousElementSibling;r.value=t.value,r.name=d.id+"[]"}},id:t.id+"-value",className:"other-val"},i=this.markup("input",null,o),a=[document.createTextNode("Other"),this.markup("input",null,n)],s=this.markup("label",a,{for:o.id}),u=this.markup("div",[i,s],{className:r});e.push(u)}}return this.dom="select"==i?this.markup(c,e,Object(u.D)(d,!0)):this.markup("div",e,{className:i}),this.dom}groupRequired(){const e=this.element.getElementsByTagName("input"),t=(e,t)=>{[].forEach.call(e,e=>{t?e.removeAttribute("required"):e.setAttribute("required","required"),((e,t)=>{const r=n.a.mi18n("minSelectionRequired",1);t?e.setCustomValidity(""):e.setCustomValidity(r)})(e,t)})},r=()=>{const r=[].some.call(e,e=>e.checked);t(e,r)};for(let t=e.length-1;t>=0;t--)e[t].addEventListener("change",r);r()}onRender(){if(this.config.userData){const t=this.config.userData.slice();"select"===this.config.type?e(this.dom).val(t).prop("selected",!0):this.config.type.endsWith("-group")&&this.dom.querySelectorAll("input").forEach(e=>{if(!e.classList.contains("other-val")){for(let r=0;rdelete this.classConfig[e]);const t=this.classConfig.template||'\n ';this.fineTemplate=e("
").attr("id","qq-template").html(t)}build(){return this.input=this.markup("input",null,{type:"hidden",name:this.config.name,id:this.config.name}),this.wrapper=this.markup("div","",{id:this.config.name+"-wrapper"}),[this.input,this.wrapper]}onRender(){const t=e(this.wrapper),r=e(this.input),o=jQuery.extend(!0,{request:{endpoint:this.handler},deleteFile:{enabled:!0,endpoint:this.handler},chunking:{enabled:!0,concurrent:{enabled:!0},success:{endpoint:this.handler+(-1==this.handler.indexOf("?")?"?":"&")+"done"}},resume:{enabled:!0},retry:{enableAuto:!0,showButton:!0},callbacks:{onError:(r,o,n)=>{"."!=n.slice(-1)&&(n+=".");const i=e("
").addClass("qq-error-message").html(`Error processing upload: ${o}.
Reason: ${n}
`).prependTo(t.find(".qq-uploader")),l=window.setTimeout(()=>{i.fadeOut(()=>{i.remove(),window.clearTimeout(l)})},6e3);return r},onStatusChange:(e,o,n)=>{const i=t.fineUploader("getUploads"),l=[];for(const e of i)"upload successful"==e.status&&l.push(e.name);return r.val(l.join(", ")),{id:e,oldStatus:o,newStatus:n}}},template:this.fineTemplate},this.classConfig);t.fineUploader(o)}}function y(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}h.register("file",h,"file"),h.register("fineuploader",g,"file");class w extends n.a{static get definition(){return{mi18n:{textarea:"textArea"}}}build(){const e=this.config,{value:t=""}=e,r=y(e,["value"]);return delete r.type,this.field=this.markup("textarea",this.parsedHtml(t),r),this.field}onRender(){this.config.userData&&e("#"+this.config.name).val(this.config.userData[0])}on(t){return"prerender"==t&&this.preview?t=>{this.field&&(t=this.field),e(t).on("mousedown",e=>{e.stopPropagation()})}:super.on(t)}}function v(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}n.a.register("textarea",w),n.a.register("textarea",w,"textarea");class x extends w{configure(){if(this.js=["https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"],this.classConfig.js){let e=this.classConfig.js;Array.isArray(e)||(e=new Array(e)),this.js.concat(e),delete this.classConfig.js}this.classConfig.css&&(this.css=this.classConfig.css),this.editorOptions={height:250,paste_data_images:!0,plugins:["advlist autolink lists link image charmap print preview anchor","searchreplace visualblocks code fullscreen","insertdatetime media table contextmenu paste code"],toolbar:"undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | table"}}build(){const e=this.config,{value:t=""}=e,r=v(e,["value"]);return delete r.type,this.field=this.markup("textarea",this.parsedHtml(t),r),r.disabled&&(this.editorOptions.readonly=!0),this.field}onRender(e){window.tinymce.editors[this.id]&&window.tinymce.editors[this.id].remove();const t=jQuery.extend(this.editorOptions,this.classConfig);if(t.target=this.field,setTimeout(()=>{window.tinymce.init(t)},100),this.config.userData&&window.tinymce.editors[this.id].setContent(this.parsedHtml(this.config.userData[0])),window.lastFormBuilderCopiedTinyMCE){const e=setTimeout(()=>{window.tinymce.editors[this.id].setContent(this.parsedHtml(window.lastFormBuilderCopiedTinyMCE)),window.lastFormBuilderCopiedTinyMCE=null,clearTimeout(e)},300)}return e}}function A(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function C(e){for(var t=1;t")}.formbuilder-icon-plus:before{content:url("data:image/svg+xml; utf8,")}.form-wrap.form-builder{position:relative}.form-wrap.form-builder *{box-sizing:border-box}.form-wrap.form-builder button,.form-wrap.form-builder input,.form-wrap.form-builder select,.form-wrap.form-builder textarea{font-family:inherit;font-size:inherit;line-height:inherit}.form-wrap.form-builder input{line-height:normal}.form-wrap.form-builder textarea{overflow:auto}.form-wrap.form-builder button,.form-wrap.form-builder input,.form-wrap.form-builder select,.form-wrap.form-builder textarea{font-family:inherit;font-size:inherit;line-height:inherit}.form-wrap.form-builder .btn-group{position:relative;display:inline-block;vertical-align:middle}.form-wrap.form-builder .btn-group>.btn{position:relative;float:left}.form-wrap.form-builder .btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.form-wrap.form-builder .btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.form-wrap.form-builder .btn-group .btn+.btn,.form-wrap.form-builder .btn-group .btn+.btn-group,.form-wrap.form-builder .btn-group .btn-group+.btn,.form-wrap.form-builder .btn-group .btn-group+.btn-group{margin-left:-1px}.form-wrap.form-builder .btn-group>.btn:last-child:not(:first-child),.form-wrap.form-builder .btn-group>.dropdown-toggle:not(:first-child),.form-wrap.form-builder .btn-group .input-group .form-control:last-child,.form-wrap.form-builder .btn-group .input-group-addon:last-child,.form-wrap.form-builder .btn-group .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.form-wrap.form-builder .btn-group .input-group-btn:first-child>.btn:not(:first-child),.form-wrap.form-builder .btn-group .input-group-btn:last-child>.btn,.form-wrap.form-builder .btn-group .input-group-btn:last-child>.btn-group>.btn,.form-wrap.form-builder .btn-group .input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.form-wrap.form-builder .btn-group>.btn.active,.form-wrap.form-builder .btn-group>.btn:active,.form-wrap.form-builder .btn-group>.btn:focus,.form-wrap.form-builder .btn-group>.btn:hover{z-index:2}.form-wrap.form-builder .btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;user-select:none;background-image:none;border-radius:4px}.form-wrap.form-builder .btn.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-wrap.form-builder .btn.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-wrap.form-builder .btn.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.form-wrap.form-builder .btn.active,.form-wrap.form-builder .btn.btn-active,.form-wrap.form-builder .btn:active{background-image:none}.form-wrap.form-builder .input-group .form-control:last-child,.form-wrap.form-builder .input-group-addon:last-child,.form-wrap.form-builder .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.form-wrap.form-builder .input-group-btn:first-child>.btn:not(:first-child),.form-wrap.form-builder .input-group-btn:last-child>.btn,.form-wrap.form-builder .input-group-btn:last-child>.btn-group>.btn,.form-wrap.form-builder .input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.form-wrap.form-builder .input-group .form-control,.form-wrap.form-builder .input-group-addon,.form-wrap.form-builder .input-group-btn{display:table-cell}.form-wrap.form-builder .input-group-lg>.form-control,.form-wrap.form-builder .input-group-lg>.input-group-addon,.form-wrap.form-builder .input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333}.form-wrap.form-builder .input-group{position:relative;display:table;border-collapse:separate}.form-wrap.form-builder .input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.form-wrap.form-builder .form-control,.form-wrap.form-builder output{font-size:14px;line-height:1.42857143;display:block}.form-wrap.form-builder textarea.form-control{height:auto}.form-wrap.form-builder .form-control{height:34px;display:block;width:100%;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px}.form-wrap.form-builder .form-control:focus{outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-wrap.form-builder .form-group{margin-left:0px;margin-bottom:15px}.form-wrap.form-builder .btn,.form-wrap.form-builder .form-control{background-image:none}.form-wrap.form-builder .pull-right{float:right}.form-wrap.form-builder .pull-left{float:left}.form-wrap.form-builder .formbuilder-required,.form-wrap.form-builder .required-asterisk{color:#c10000}.form-wrap.form-builder .formbuilder-checkbox-group input[type=checkbox],.form-wrap.form-builder .formbuilder-checkbox-group input[type=radio],.form-wrap.form-builder .formbuilder-radio-group input[type=checkbox],.form-wrap.form-builder .formbuilder-radio-group input[type=radio]{margin:0 4px 0 0}.form-wrap.form-builder .formbuilder-checkbox-inline,.form-wrap.form-builder .formbuilder-radio-inline{margin-right:8px;display:inline-block;vertical-align:middle;padding-left:0}.form-wrap.form-builder .formbuilder-checkbox-inline label input[type=text],.form-wrap.form-builder .formbuilder-radio-inline label input[type=text]{margin-top:0}.form-wrap.form-builder .formbuilder-checkbox-inline:first-child,.form-wrap.form-builder .formbuilder-radio-inline:first-child{padding-left:0}.form-wrap.form-builder .formbuilder-autocomplete-list{background-color:#fff;display:none;list-style:none;padding:0;border:1px solid #ccc;border-width:0 1px 1px;position:absolute;z-index:20;max-height:200px;overflow-y:auto}.form-wrap.form-builder .formbuilder-autocomplete-list li{display:none;cursor:default;padding:5px;margin:0;transition:background-color 200ms ease-in-out}.form-wrap.form-builder .formbuilder-autocomplete-list li:hover,.form-wrap.form-builder .formbuilder-autocomplete-list li.active-option{background-color:rgba(0,0,0,.075)}@keyframes PLACEHOLDER{0%{height:1px}100%{height:15px}}.form-wrap.form-builder .cb-wrap{width:26%;transition:transform 250ms}.form-wrap.form-builder .cb-wrap.pull-left .form-actions{float:left}.form-wrap.form-builder .cb-wrap h4{margin-top:0;color:#666}@media(max-width: 481px){.form-wrap.form-builder .cb-wrap{width:64px}.form-wrap.form-builder .cb-wrap h4{display:none}}.form-wrap.form-builder .frmb-control{margin:0;padding:0;border-radius:5px}.form-wrap.form-builder .frmb-control li{cursor:move;list-style:none;margin:0 0 -1px 0;padding:10px;text-align:left;background:#fff;-webkit-user-select:none;user-select:none;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;box-shadow:inset 0 0 0 1px #c5c5c5}.form-wrap.form-builder .frmb-control li .control-icon{width:16px;height:auto;margin-right:10px;margin-left:.2em;display:inline-block}.form-wrap.form-builder .frmb-control li .control-icon img,.form-wrap.form-builder .frmb-control li .control-icon svg{max-width:100%;height:auto}.form-wrap.form-builder .frmb-control li:first-child{border-radius:5px 5px 0 0;margin-top:0}.form-wrap.form-builder .frmb-control li:last-child{border-radius:0 0 5px 5px}.form-wrap.form-builder .frmb-control li::before{margin-right:10px;font-size:16px}.form-wrap.form-builder .frmb-control li:hover{background-color:#f2f2f2}.form-wrap.form-builder .frmb-control li.ui-sortable-helper{border-radius:5px;transition:box-shadow 250ms;box-shadow:2px 2px 6px 0 #666;border:1px solid #fff}.form-wrap.form-builder .frmb-control li.ui-state-highlight{width:0;overflow:hidden;padding:0;margin:0;border:0 none}.form-wrap.form-builder .frmb-control li.moving{opacity:.6}.form-wrap.form-builder .frmb-control li.formbuilder-separator{background-color:transparent;box-shadow:none;padding:0;cursor:default}.form-wrap.form-builder .frmb-control li.formbuilder-separator hr{margin:10px 0}@media(max-width: 481px){.form-wrap.form-builder .frmb-control li::before{font-size:30px}.form-wrap.form-builder .frmb-control li span{display:none}}.form-wrap.form-builder .frmb-control.sort-enabled li.ui-state-highlight{box-shadow:none;height:0;width:100%;background:radial-gradient(ellipse at center, #545454 0%, rgba(0, 0, 0, 0) 75%);border:0 none;-webkit-clip-path:polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);clip-path:polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);visibility:visible;overflow:hidden;margin:1px 0 3px;animation:PLACEHOLDER 250ms forwards}.form-wrap.form-builder .formbuilder-mobile .form-actions{width:100%}.form-wrap.form-builder .formbuilder-mobile .form-actions button{width:100%;font-size:.85em !important;display:block !important;border-radius:0 !important;margin-top:-1px;margin-left:0 !important}.form-wrap.form-builder .formbuilder-mobile .form-actions button:first-child{border-radius:5px 5px 0 0 !important;margin-top:0 !important;border-bottom:0 none}.form-wrap.form-builder .formbuilder-mobile .form-actions button:last-child{border-radius:0 0 5px 5px !important}.form-wrap.form-builder .form-actions{float:right;margin-top:5px}.form-wrap.form-builder .form-actions button{border:0 none}.form-wrap.form-builder .stage-wrap{position:relative;padding:0;margin:0;width:calc(74% - 5px)}@media(max-width: 481px){.form-wrap.form-builder .stage-wrap{width:calc(100% - 64px)}}.form-wrap.form-builder .stage-wrap.empty{border:3px dashed #ccc;background-color:rgba(255,255,255,.25)}.form-wrap.form-builder .stage-wrap.empty::after{content:attr(data-content);position:absolute;text-align:center;top:50%;left:0;width:100%;margin-top:-1em}.form-wrap.form-builder .frmb{list-style-type:none;min-height:200px;transition:background-color 500ms ease-in-out}.form-wrap.form-builder .frmb .formbuilder-required{color:#c10000}.form-wrap.form-builder .frmb.removing{overflow:hidden}.form-wrap.form-builder .frmb li.form-field:hover{border-color:#66afe9;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.1),0 0 8px rgba(102,175,233,.6)}.form-wrap.form-builder .frmb li.form-field:hover .field-actions{opacity:1}.form-wrap.form-builder .frmb li.form-field:hover li :hover{background:#fefefe}.form-wrap.form-builder .frmb li.form-field{position:relative;padding:6px;clear:both;margin-left:0;margin-bottom:3px;background-color:#fff;transition:background-color 250ms ease-in-out,margin-top 400ms}.form-wrap.form-builder .frmb li.form-field.hidden-field{background-color:rgba(255,255,255,.6)}.form-wrap.form-builder .frmb li.form-field:first-child{border-top-right-radius:5px;border-top-left-radius:5px}.form-wrap.form-builder .frmb li.form-field:first-child .field-actions .btn:last-child{border-radius:0 5px 0 0}.form-wrap.form-builder .frmb li.form-field:last-child{border-bottom-right-radius:5px;border-bottom-left-radius:5px}.form-wrap.form-builder .frmb li.form-field.no-fields label{font-weight:400}@keyframes PLACEHOLDER{0%{height:0}100%{height:15px}}.form-wrap.form-builder .frmb li.form-field.frmb-placeholder,.form-wrap.form-builder .frmb li.form-field.ui-state-highlight{height:0;padding:0;background:radial-gradient(ellipse at center, #545454 0%, rgba(0, 0, 0, 0) 75%);border:0 none;-webkit-clip-path:polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);clip-path:polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);visibility:visible;overflow:hidden;margin-bottom:3px;animation:PLACEHOLDER 250ms forwards}.form-wrap.form-builder .frmb li.form-field.moving,.form-wrap.form-builder .frmb li.form-field.ui-sortable-helper{transition:box-shadow 500ms ease-in-out;box-shadow:2px 2px 6px 0 #666;border:1px solid #fff;border-radius:5px}.form-wrap.form-builder .frmb li.form-field.disabled-field{z-index:1;position:relative;overflow:visible}.form-wrap.form-builder .frmb li.form-field.disabled-field:hover .frmb-tt{display:inline-block}.form-wrap.form-builder .frmb li.form-field.disabled-field [type=checkbox]{float:left;margin-right:10px}.form-wrap.form-builder .frmb li.form-field.disabled-field h2{border-bottom:0 none}.form-wrap.form-builder .frmb li.form-field.disabled-field label{font-size:12px;font-weight:400;color:#666}.form-wrap.form-builder .frmb li.form-field.disabled-field .prev-holder{cursor:default;line-height:28px;padding-left:5px}.form-wrap.form-builder .frmb li.form-field .close-field{position:absolute;color:#666;left:50%;bottom:6px;background:#fff;border-top:1px solid #c5c5c5;border-left:1px solid #c5c5c5;border-right:1px solid #c5c5c5;transform:translateX(-50%);padding:0 5px;border-top-right-radius:3px;border-top-left-radius:3px;cursor:pointer;transition:background-color 250ms ease-in-out}.form-wrap.form-builder .frmb li.form-field .close-field:hover{text-decoration:none}.form-wrap.form-builder .frmb li.form-field.button-field h1,.form-wrap.form-builder .frmb li.form-field.button-field h2,.form-wrap.form-builder .frmb li.form-field.button-field h3,.form-wrap.form-builder .frmb li.form-field.button-field p,.form-wrap.form-builder .frmb li.form-field.button-field canvas,.form-wrap.form-builder .frmb li.form-field.button-field output,.form-wrap.form-builder .frmb li.form-field.button-field address,.form-wrap.form-builder .frmb li.form-field.button-field blockquote,.form-wrap.form-builder .frmb li.form-field.button-field .prev-holder,.form-wrap.form-builder .frmb li.form-field.header-field h1,.form-wrap.form-builder .frmb li.form-field.header-field h2,.form-wrap.form-builder .frmb li.form-field.header-field h3,.form-wrap.form-builder .frmb li.form-field.header-field p,.form-wrap.form-builder .frmb li.form-field.header-field canvas,.form-wrap.form-builder .frmb li.form-field.header-field output,.form-wrap.form-builder .frmb li.form-field.header-field address,.form-wrap.form-builder .frmb li.form-field.header-field blockquote,.form-wrap.form-builder .frmb li.form-field.header-field .prev-holder,.form-wrap.form-builder .frmb li.form-field.paragraph-field h1,.form-wrap.form-builder .frmb li.form-field.paragraph-field h2,.form-wrap.form-builder .frmb li.form-field.paragraph-field h3,.form-wrap.form-builder .frmb li.form-field.paragraph-field p,.form-wrap.form-builder .frmb li.form-field.paragraph-field canvas,.form-wrap.form-builder .frmb li.form-field.paragraph-field output,.form-wrap.form-builder .frmb li.form-field.paragraph-field address,.form-wrap.form-builder .frmb li.form-field.paragraph-field blockquote,.form-wrap.form-builder .frmb li.form-field.paragraph-field .prev-holder{margin:0}.form-wrap.form-builder .frmb li.form-field.button-field .field-label,.form-wrap.form-builder .frmb li.form-field.header-field .field-label,.form-wrap.form-builder .frmb li.form-field.paragraph-field .field-label{display:none}.form-wrap.form-builder .frmb li.form-field.button-field.editing .field-label,.form-wrap.form-builder .frmb li.form-field.header-field.editing .field-label,.form-wrap.form-builder .frmb li.form-field.paragraph-field.editing .field-label{display:block}.form-wrap.form-builder .frmb li.form-field.paragraph-field .fld-label{min-height:150px;overflow-y:auto}.form-wrap.form-builder .frmb li.form-field.checkbox-field .field-label{display:none}.form-wrap.form-builder .frmb li.deleting,.form-wrap.form-builder .frmb li.delete:hover,.form-wrap.form-builder .frmb li:hover li.delete:hover{background-color:#fdd}.form-wrap.form-builder .frmb li.deleting .close-field,.form-wrap.form-builder .frmb li.delete:hover .close-field,.form-wrap.form-builder .frmb li:hover li.delete:hover .close-field{background-color:#fdd}.form-wrap.form-builder .frmb li.deleting{z-index:20;pointer-events:none}.form-wrap.form-builder .frmb.disabled-field{padding:0 5px}.form-wrap.form-builder .frmb.disabled-field :hover{border-color:transparent}.form-wrap.form-builder .frmb.disabled-field .form-element{float:none;margin-bottom:10px;overflow:visible;padding:5px 0;position:relative}.form-wrap.form-builder .frmb .frm-holder{display:none}.form-wrap.form-builder .frmb .tooltip{left:20px}.form-wrap.form-builder .frmb .prev-holder{display:block}.form-wrap.form-builder .frmb .prev-holder .form-group{margin:0}.form-wrap.form-builder .frmb .prev-holder .ql-editor{min-height:125px}.form-wrap.form-builder .frmb .prev-holder .form-group>label:not([class=formbuilder-checkbox-label]){display:none}.form-wrap.form-builder .frmb .prev-holder select,.form-wrap.form-builder .frmb .prev-holder input[type=text],.form-wrap.form-builder .frmb .prev-holder textarea,.form-wrap.form-builder .frmb .prev-holder input[type=number]{background-color:#fff;border:1px solid #ccc;box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.form-wrap.form-builder .frmb .prev-holder input[type=color]{width:60px;padding:2px;display:inline-block}.form-wrap.form-builder .frmb .prev-holder input[type=date]{width:auto}.form-wrap.form-builder .frmb .prev-holder select[multiple]{height:auto}.form-wrap.form-builder .frmb .prev-holder label{font-weight:normal}.form-wrap.form-builder .frmb .prev-holder input[type=number]{width:auto}.form-wrap.form-builder .frmb .prev-holder input[type=color]{width:60px;padding:2px;display:inline-block}.form-wrap.form-builder .frmb .required-asterisk{display:none}.form-wrap.form-builder .frmb .field-label,.form-wrap.form-builder .frmb .legend{color:#666;margin-bottom:5px;line-height:27px;font-size:16px;font-weight:normal}.form-wrap.form-builder .frmb .disabled-field .field-label{display:block}.form-wrap.form-builder .frmb .other-option:checked+label input{display:inline-block}.form-wrap.form-builder .frmb .other-val{margin-left:5px;display:none}.form-wrap.form-builder .frmb .field-actions{position:absolute;top:0;right:0;opacity:0}.form-wrap.form-builder .frmb .field-actions a::before{margin:0}.form-wrap.form-builder .frmb .field-actions a:hover{text-decoration:none;color:#000}.form-wrap.form-builder .frmb .field-actions .btn{display:inline-block;width:32px;height:32px;padding:0 6px;border-radius:0;border-color:#c5c5c5;background-color:#fff;color:#c5c5c5;line-height:32px;font-size:16px;border-width:0 0 1px 1px}.form-wrap.form-builder .frmb .field-actions .btn:first-child{border-bottom-left-radius:5px}.form-wrap.form-builder .frmb .field-actions .toggle-form:hover{background-color:#65aac6;color:#fff}.form-wrap.form-builder .frmb .field-actions .copy-button:hover{background-color:#6fc665;color:#fff}.form-wrap.form-builder .frmb .field-actions .del-button:hover{background-color:#c66865;color:#fff}.form-wrap.form-builder .frmb .option-actions{text-align:right;margin-top:10px;width:100%;margin-left:2%}.form-wrap.form-builder .frmb .option-actions button,.form-wrap.form-builder .frmb .option-actions a{background:#fff;padding:5px 10px;border:1px solid #c5c5c5;font-size:14px;border-radius:5px;cursor:default}.form-wrap.form-builder .frmb .sortable-options-wrap{width:81.33333333%;display:inline-block}.form-wrap.form-builder .frmb .sortable-options-wrap label{font-weight:normal}@media(max-width: 481px){.form-wrap.form-builder .frmb .sortable-options-wrap{display:block;width:100%}}.form-wrap.form-builder .frmb .radio-group-field .sortable-options li:nth-child(2) .remove{display:none}.form-wrap.form-builder .frmb .sortable-options{display:inline-block;width:100%;margin-left:2%;background:#c5c5c5;margin-bottom:0;border-radius:2px;list-style:none;padding:0}.form-wrap.form-builder .frmb .sortable-options>li{cursor:move;margin:1px;padding:6px;background-color:#fff}.form-wrap.form-builder .frmb .sortable-options>li:nth-child(1) .remove{display:none}.form-wrap.form-builder .frmb .sortable-options>li .remove{position:relative;opacity:1;float:right;right:14px;height:18px;width:18px;top:8px;font-size:12px;padding:0;color:#c10000}.form-wrap.form-builder .frmb .sortable-options>li .remove::before{margin:0}.form-wrap.form-builder .frmb .sortable-options>li .remove:hover{background-color:#c10000 !important;text-decoration:none;color:#fff}.form-wrap.form-builder .frmb .sortable-options .option-selected{margin:0;width:5%}.form-wrap.form-builder .frmb .sortable-options input[type=text]{width:calc(44.5% - 17px);margin:0 3px;float:none}.form-wrap.form-builder .frmb .form-field .form-group{width:100%;clear:left;float:none}.form-wrap.form-builder .frmb .col-md-6 .form-elements,.form-wrap.form-builder .frmb .col-md-8 .form-elements{width:100%}.form-wrap.form-builder .frmb .field-options .add-area .add{clear:both}.form-wrap.form-builder .frmb .style-wrap button.selected{border:1px solid #000;margin-top:0;margin-right:1px;box-shadow:0 0 0 1px #fff inset;padding:1px 5px}.form-wrap.form-builder .frmb .form-elements{padding:10px 5px;background:#f7f7f7;border-radius:3px;margin:0;border:1px solid #c5c5c5}.form-wrap.form-builder .frmb .form-elements .input-wrap{width:81.33333333%;margin-left:2%;float:left}.form-wrap.form-builder .frmb .form-elements .input-wrap>input[type=checkbox]{margin-top:8px}.form-wrap.form-builder .frmb .form-elements .btn-group{margin-left:2%}.form-wrap.form-builder .frmb .form-elements .add{clear:both}.form-wrap.form-builder .frmb .form-elements [contenteditable],.form-wrap.form-builder .frmb .form-elements select[multiple]{height:auto}.form-wrap.form-builder .frmb .form-elements [contenteditable].form-control,.form-wrap.form-builder .frmb .form-elements input[type=text],.form-wrap.form-builder .frmb .form-elements input[type=number],.form-wrap.form-builder .frmb .form-elements input[type=date],.form-wrap.form-builder .frmb .form-elements input[type=color],.form-wrap.form-builder .frmb .form-elements textarea,.form-wrap.form-builder .frmb .form-elements select{transition:background 250ms ease-in-out;padding:6px 12px;border:1px solid #c5c5c5;background-color:#fff}@media(max-width: 481px){.form-wrap.form-builder .frmb .form-elements .input-wrap{width:100%;margin-left:0;float:none}}.form-wrap.form-builder .frmb .form-elements input[type=number]{width:auto}.form-wrap.form-builder .frmb .form-elements .btn-group{margin-left:2%}.col-md-6 .form-wrap.form-builder .frmb .form-elements .false-label,.col-md-8 .form-wrap.form-builder .frmb .form-elements .false-label,.col-md-6 .form-wrap.form-builder .frmb .form-elements label,.col-md-8 .form-wrap.form-builder .frmb .form-elements label{display:block}.form-wrap.form-builder .frmb .form-elements .false-label:first-child,.form-wrap.form-builder .frmb .form-elements label:first-child{width:16.66666667%;padding-top:7px;margin-bottom:0;text-align:right;font-weight:700;float:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:capitalize}@media(max-width: 481px){.form-wrap.form-builder .frmb .form-elements .false-label:first-child,.form-wrap.form-builder .frmb .form-elements label:first-child{display:block;width:auto;float:none;text-align:left}.form-wrap.form-builder .frmb .form-elements .false-label:first-child.empty-label,.form-wrap.form-builder .frmb .form-elements label:first-child.empty-label{display:none}}.form-wrap.form-builder .frmb .form-elements .false-label.multiple,.form-wrap.form-builder .frmb .form-elements .false-label.required-label,.form-wrap.form-builder .frmb .form-elements .false-label.toggle-label,.form-wrap.form-builder .frmb .form-elements .false-label.roles-label,.form-wrap.form-builder .frmb .form-elements .false-label.other-label,.form-wrap.form-builder .frmb .form-elements label.multiple,.form-wrap.form-builder .frmb .form-elements label.required-label,.form-wrap.form-builder .frmb .form-elements label.toggle-label,.form-wrap.form-builder .frmb .form-elements label.roles-label,.form-wrap.form-builder .frmb .form-elements label.other-label{text-align:left;float:none;margin-bottom:-3px;font-weight:400;width:calc(81.3333% - 23px)}.form-wrap.form-builder .frmb .form-elements input.error{border:1px solid #c10000}.form-wrap.form-builder .frmb .form-elements input.fld-maxlength{width:75px}.form-wrap.form-builder .frmb .form-elements input.field-error{background:#fefefe;border:1px solid #c5c5c5}.form-wrap.form-builder .frmb .form-elements label em{display:block;font-weight:400;font-size:.75em}.form-wrap.form-builder .frmb .form-elements label.maxlength-label{line-height:1em}.form-wrap.form-builder .frmb .form-elements .available-roles{display:none;padding:10px;margin:10px 0;background:#e6e6e6;box-shadow:inset 0 0 2px 0 #b3b3b3}@media(max-width: 481px){.form-wrap.form-builder .frmb .form-elements .available-roles{margin-left:0}}.form-wrap.form-builder .frmb .form-elements .available-roles label{font-weight:400;width:auto;float:none;display:inline}.form-wrap.form-builder .frmb .form-elements .available-roles input{display:inline;top:auto}.form-wrap.form-builder .autocomplete-field .sortable-options .option-selected{display:none}.form-wrap.form-builder .formbuilder-mobile .field-actions{opacity:1}.form-wrap.form-builder *[tooltip]{position:relative}.form-wrap.form-builder *[tooltip]:hover:after{background:rgba(0,0,0,.9);border-radius:5px 5px 5px 0;bottom:23px;color:#fff;content:attr(tooltip);padding:10px 5px;position:absolute;z-index:98;left:2px;width:230px;text-shadow:none;font-size:12px;line-height:1.5em;cursor:default}.form-wrap.form-builder *[tooltip]:hover:before{border:solid;border-color:#222 transparent;border-width:6px 6px 0;bottom:17px;content:"";left:2px;position:absolute;z-index:99;cursor:default}.form-wrap.form-builder .tooltip-element{visibility:visible;color:#fff;background:#000;width:16px;height:16px;border-radius:8px;display:inline-block;text-align:center;line-height:16px;margin:0 5px;font-size:12px;cursor:default}.form-wrap.form-builder .snackbar{visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;left:50%;bottom:30px}.form-wrap.form-builder .snackbar.show{visibility:visible;animation:fadein .5s,fadeout .5s 2.5s}@keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}.form-wrap.form-builder .ui-state-highlight{border-radius:3px;border:1px dashed #0d99f2;border-radius:3px;background-color:#e5f5f8;width:12px}.form-wrap.form-builder .moveHighlight{border:1px dashed #0d99f2 !important;background-color:#e5f5f8 !important}.form-wrap.form-builder .currentGridModeFieldHighlight{background-color:#e5f5f8 !important}.form-wrap.form-builder .grid-mode-help{background-color:#fff;border-top-left-radius:5px;border-top-right-radius:5px}.form-wrap.form-builder .grid-mode-help-row1{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:1px}.form-wrap.form-builder .grid-mode-help-row2{white-space:nowrap}.form-wrap.form-builder .colHoverTempStyle{padding-left:7px !important;padding-right:7px !important;flex:95 1 0% !important}.form-wrap.form-builder .rowWrapper{margin-left:0px !important;margin-right:0px !important}.form-wrap.form-builder .btnAddControl{border:0;background-color:unset}.form-wrap.form-builder .hoverColumnDropStyle{border:1px dashed #0d99f2;border-radius:3px;background-color:#e5f5f8;width:20px;position:fixed;margin-left:40px}.form-wrap.form-builder .hoverDropStyleInverse{background-color:#0d99f2;border:1px dashed #e5f5f8}.form-wrap.form-builder .invisibleRowPlaceholder{width:0px !important;position:fixed !important;left:-100px !important}.form-wrap.form-builder .kc-toggle{padding-left:0 !important}.form-wrap.form-builder .kc-toggle span{position:relative;width:48px;height:24px;background:#e6e6e6;display:inline-block;border-radius:4px;border:1px solid #ccc;padding:2px;overflow:hidden;float:left;margin-right:5px;will-change:transform}.form-wrap.form-builder .kc-toggle span::after,.form-wrap.form-builder .kc-toggle span::before{position:absolute;display:inline-block;top:0}.form-wrap.form-builder .kc-toggle span::after{position:relative;content:"";width:50%;height:100%;left:0;border-radius:3px;background:linear-gradient(to bottom, white 0%, #ccc 100%);border:1px solid #999;transition:transform 100ms;transform:translateX(0)}.form-wrap.form-builder .kc-toggle span::before{border-radius:4px;top:2px;left:2px;content:"";width:calc(100% - 4px);height:18px;box-shadow:0 0 1px 1px #b3b3b3 inset;background-color:transparent}.form-wrap.form-builder .kc-toggle input{height:0;overflow:hidden;width:0;opacity:0;pointer-events:none;margin:0}.form-wrap.form-builder .kc-toggle input:checked+span::after{transform:translateX(100%)}.form-wrap.form-builder .kc-toggle input:checked+span::before{background-color:#6fc665}.form-wrap.form-builder::after{content:"";display:table;clear:both}.cb-wrap,.stage-wrap{vertical-align:top}.cb-wrap.pull-right,.stage-wrap.pull-right{float:right}.cb-wrap.pull-left,.stage-wrap.pull-left{float:left}.form-elements,.form-group,.multi-row span,textarea{display:block}.form-elements::after,.form-group::after{content:".";display:block;height:0;clear:both;visibility:hidden}.form-elements .field-options div:hover,.frmb .legend,.frmb .prev-holder{cursor:move}.frmb-tt{display:none;position:absolute;top:0;left:0;border:1px solid #262626;background-color:#666;border-radius:5px;padding:5px;color:#fff;z-index:20;text-align:left;font-size:12px;pointer-events:none}.frmb-tt::before{border-color:#262626 transparent;bottom:-11px}.frmb-tt::before,.frmb-tt::after{content:"";position:absolute;border-style:solid;border-width:10px 10px 0;border-color:#666 transparent;display:block;width:0;z-index:1;margin-left:-10px;bottom:-10px;left:20px}.frmb-tt a{text-decoration:underline;color:#fff}.frmb li:hover .del-button,.frmb li:hover .toggle-form,.formbuilder-mobile .frmb li .del-button,.formbuilder-mobile .frmb li .toggle-form{opacity:1}.frmb-xml .ui-dialog-content{white-space:pre-wrap;word-wrap:break-word;font-size:12px;padding:0 30px;margin-top:0}.toggle-form{opacity:0}.toggle-form:hover{border-color:#ccc}.toggle-form::before{margin:0}.formb-field-vars .copy-var{display:inline-block;width:24px;height:24px;background:#b3b3b3;text-indent:-9999px}.ui-button .ui-button-text{line-height:0}.form-builder-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.5);display:none;z-index:10}.form-builder-overlay.visible{display:block}.form-builder-dialog{position:absolute;border-radius:5px;background:#fff;z-index:20;transform:translate(-50%, -50%);top:0;left:0;padding:10px;box-shadow:0 3px 10px #000;min-width:166px;max-height:80%;overflow-y:scroll}.form-builder-dialog h3{margin-top:0}.form-builder-dialog.data-dialog{width:65%;background-color:#23241f}.form-builder-dialog.data-dialog pre{background:none;border:0 none;box-shadow:none;margin:0;color:#f2f2f2}.form-builder-dialog.positioned{transform:translate(-50%, -100%)}.form-builder-dialog.positioned .button-wrap::before{content:"";width:0;height:0;border-left:15px solid transparent;border-right:15px solid transparent;border-top:10px solid #fff;position:absolute;left:50%;top:100%;transform:translate(-50%, 10px)}.form-builder-dialog .button-wrap{position:relative;margin-top:10px;text-align:right;clear:both}.form-builder-dialog .button-wrap .btn{margin-left:10px}',""]),t.default=n},function(e,t,r){var o=r(11),n=r(19),i=r(22),l=Math.max,a=Math.min;e.exports=function(e,t,r){var s,d,c,u,f,p,m=0,b=!1,h=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var r=s,o=d;return s=d=void 0,m=t,u=e.apply(o,r)}function w(e){return m=e,f=setTimeout(x,t),b?y(e):u}function v(e){var r=e-p;return void 0===p||r>=t||r<0||h&&e-m>=c}function x(){var e=n();if(v(e))return A(e);f=setTimeout(x,function(e){var r=t-(e-p);return h?a(r,c-(e-m)):r}(e))}function A(e){return f=void 0,g&&s?y(e):(s=d=void 0,u)}function O(){var e=n(),r=v(e);if(s=arguments,d=this,p=e,r){if(void 0===f)return w(p);if(h)return clearTimeout(f),f=setTimeout(x,t),y(p)}return void 0===f&&(f=setTimeout(x,t)),u}return t=i(t)||0,o(r)&&(b=!!r.leading,c=(h="maxWait"in r)?l(i(r.maxWait)||0,t):c,g="trailing"in r?!!r.trailing:g),O.cancel=function(){void 0!==f&&clearTimeout(f),m=0,s=p=d=f=void 0},O.flush=function(){return void 0===f?u:A(n())},O}},function(e,t,r){var o=r(13);e.exports=function(){return o.Date.now()}},function(e,t,r){(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.exports=r}).call(this,r(21))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var o=r(23),n=r(11),i=r(25),l=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,d=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=o(e);var r=a.test(e);return r||s.test(e)?d(e.slice(2),r?2:8):l.test(e)?NaN:+e}},function(e,t,r){var o=r(24),n=/^\s+/;e.exports=function(e){return e?e.slice(0,o(e)+1).replace(n,""):e}},function(e,t){var r=/\s/;e.exports=function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}},function(e,t,r){var o=r(26),n=r(29);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==o(e)}},function(e,t,r){var o=r(14),n=r(27),i=r(28),l=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":l&&l in Object(e)?n(e):i(e)}},function(e,t,r){var o=r(14),n=Object.prototype,i=n.hasOwnProperty,l=n.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),r=e[a];try{e[a]=void 0;var o=!0}catch(e){}var n=l.call(e);return o&&(t?e[a]=r:delete e[a]),n}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},,,,,,function(t,r,o){o.r(r);o(16);var n=o(15),i=o.n(n),l=o(4);const a={};class s{constructor(e){this.formData={},this.formID=e,this.layout="",a[e]=this}}var d=o(2),c=o.n(d),u=o(5),f=o(10),p=o(0),m=o(3),b=o(1),h=o(6);function g(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}class y{constructor(e,t,r){this.data=a[e],this.d=l.d[e],this.doCancel=!1,this.layout=t,this.handleKeyDown=this.handleKeyDown.bind(this),this.formBuilder=r,this.toastTimer=null}startMoving(e,t){t.item.show().addClass("moving"),this.doCancel=!0,this.from=t.item.parent()}stopMoving(t,r){r.item.removeClass("moving"),this.doCancel&&(r.sender&&e(r.sender).sortable("cancel"),this.from.sortable("cancel")),this.save(),this.doCancel=!1}beforeStop(e,t){const r=this,o=m.a.opts,n=r.d.stage.childNodes.length-1,i=[];r.stopIndex=t.placeholder.index()-1,!o.sortableControls&&t.item.parent().hasClass("frmb-control")&&i.push(!0),o.prepend&&i.push(0===r.stopIndex),o.append&&i.push(r.stopIndex+1===n),r.doCancel=i.some(e=>!0===e)}getTypes(t){const r={type:t.attr("type")},o=e(".fld-subtype",t).val();return o!==r.type&&(r.subtype=o),r}fieldOptionData(t){const r=[],o=e(".sortable-options li",t);return o.each(e=>{const t=o[e],n=t.querySelectorAll("input[type=text], input[type=number], select"),i=t.querySelectorAll("input[type=checkbox], input[type=radio]"),l={};Object(p.j)(n,e=>{const t=n[e],r=t.dataset.attr;l[r]=t.value}),Object(p.j)(i,e=>{const t=i[e],r=t.getAttribute("data-attr");l[r]=t.checked}),r.push(l)}),r}xmlSave(e){const t=this.prepData(e),r=new XMLSerializer,o=[""];t.forEach(e=>{const{values:t}=e,r=g(e,["values"]);let n=[``];if(l.e.includes(e.type)){const e=t.map(e=>Object(p.t)("option",e.label,e).outerHTML);n=n.concat(e)}n.push(""),o.push(n)}),o.push("");const n=Object(p.t)("form-template",Object(p.i)(o).join(""));return r.serializeToString(n)}prepData(t){const r=[],o=this.d,n=this;if(0!==t.childNodes.length){const i=[];Object(p.j)(t.childNodes,(function(t,r){e(r).find("li.form-field").each((function(e,t){i.push(t)}))})),Object(p.j)(t.childNodes,(function(t,r){const o=e(r);o.is("li")&&o.hasClass("form-field")&&i.push(r)})),i.length&&i.forEach(t=>{const i=e(t);if(!i.hasClass("disabled-field")){let l=n.getTypes(i);const a=e(".roles-field:checked",t),s=a.map(e=>a[e].value).get();if(l=Object.assign({},l,n.getAttrVals(t)),l.subtype)if("quill"===l.subtype){const e=l.name+"-preview";if(window.fbEditors.quill[e]){const t=window.fbEditors.quill[e].instance.getContents();l.value=window.JSON.stringify(t.ops)}}else if("tinymce"===l.subtype&&window.tinymce){const e=l.name+"-preview";if(window.tinymce.editors[e]){const t=window.tinymce.editors[e];l.value=t.getContent()}}if(s.length&&(l.role=s.join(",")),l.className=l.className||l.class,l.className&&"true"==i.attr("addeddefaultcolumnclass")&&1==i.closest(this.formBuilder.rowWrapperClassSelector).children().length&&l.className.includes(m.a.opts.defaultGridColumnClass)){const e=Object(p.m)(l.className);e&&e.length>0&&e.forEach(e=>{l.className=l.className.replace(e,"").trim()})}if(l.className){const e=/(?:^|\s)btn-(.*?)(?:\s|$)/g.exec(l.className);e&&(l.style=e[1])}l=Object(p.D)(l);l.type&&l.type.match(o.optionFieldsRegEx)&&(l.values=n.fieldOptionData(i)),r.push(l)}})}return r}getData(e){const t=this.data;if(e||(e=m.a.opts.formData),!e)return!1;const r={xml:e=>Array.isArray(e)?e:Object(p.w)(e),json:e=>"string"==typeof e?window.JSON.parse(e):e};return t.formData=r[m.a.opts.dataType](e)||[],t.formData}save(e){const t=this,r=this.data,o=this.d.stage,n={xml:e=>t.xmlSave(o,e),json:e=>window.JSON.stringify(t.prepData(o),null,e&&" ")};return r.formData=n[m.a.opts.dataType](e),document.dispatchEvent(u.a.formSaved),r.formData}incrementId(e){const t=e.lastIndexOf("-"),r=parseInt(e.substring(t+1))+1;return`${e.substring(0,t)}-${r}`}getAttrVals(t){const r=Object.create(null),o=t.querySelectorAll('[class*="fld-"]');return Object(p.j)(o,t=>{const n=o[t],i=Object(p.d)(n.getAttribute("name")),l=[[n.attributes.contenteditable,()=>"xml"===m.a.opts.dataType?Object(p.h)(n.innerHTML):n.innerHTML],["checkbox"===n.type,()=>n.checked],["number"===n.type&&""!==n.value,()=>Number(n.value)],[n.attributes.multiple,()=>e(n).val()],[!0,()=>n.value]].find(([e])=>!!e)[1]();r[i]=l}),r}updatePreview(t){const r=this.d,o=t.attr("class"),n=t[0];if(o.includes("input-control"))return;const i=t.attr("type"),a=e(".prev-holder",n);let s=Object.assign({},this.getAttrVals(n),{type:i});i.match(r.optionFieldsRegEx)&&(s.values=[],s.multiple=e('[name="multiple"]',n).is(":checked"),e(".sortable-options li",n).each((function(t,r){const o={selected:e(".option-selected",r).is(":checked"),value:e(".option-value",r).val(),label:e(".option-label",r).val()};s.values.push(o)}))),s=Object(p.D)(s,!0),s.className=this.classNames(n,s),t.data("fieldData",s);const d=h.a.lookup(s.type),c=d?d.class:b.a.getClass(s.type,s.subtype),f=this.layout.build(c,s);Object(l.b)(a[0]),a[0].appendChild(f),f.dispatchEvent(u.a.fieldRendered)}disabledTT(e){const t=e.querySelectorAll(".disabled-field");Object(p.j)(t,e=>{const r=t[e],o=c.a.get("fieldNonEditable");if(o){const e=Object(p.t)("p",o,{className:"frmb-tt"});r.appendChild(e),r.addEventListener("mousemove",t=>((e,t)=>{const r=t.field.getBoundingClientRect(),o=e.clientX-r.left-21,n=e.clientY-r.top-t.tt.offsetHeight-12;t.tt.style.transform=`translate(${o}px, ${n}px)`})(t,{tt:e,field:r}))}})}classNames(t,r){const o=t.querySelector(".fld-className"),n=t.querySelector(".btn-style"),i=n&&n.value;if(!o)return;const{type:l}=r,a=o.multiple?e(o).val():o.value.trim().split(" "),s={button:"btn",submit:"btn"}[l];if(s&&i){for(let e=0;ethis.closeConfirm(e),!1),document.addEventListener("keydown",this.handleKeyDown,!1),e}confirm(e,t,r=!1,o=""){const n=this,i=c.a.current,l=n.showOverlay(),a=Object(p.t)("button",i.yes,{className:"yes btn btn-success btn-sm"}),s=Object(p.t)("button",i.no,{className:"no btn btn-danger btn-sm"});s.onclick=function(){n.closeConfirm(l)},a.onclick=function(){t(),n.closeConfirm(l)};const d=Object(p.t)("div",[s,a],{className:"button-wrap"});o="form-builder-dialog "+o;const u=Object(p.t)("div",[e,d],{className:o});if(r)u.classList.add("positioned");else{const e=document.documentElement;r={pageX:Math.max(e.clientWidth,window.innerWidth||0)/2,pageY:Math.max(e.clientHeight,window.innerHeight||0)/2},u.style.position="fixed"}return u.style.left=r.pageX+"px",u.style.top=r.pageY+"px",document.body.appendChild(u),a.focus(),u}dialog(e,t=!1,r=""){const o=document.documentElement.clientWidth,n=document.documentElement.clientHeight;this.showOverlay(),r="form-builder-dialog "+r;const i=Object(p.t)("div",e,{className:r});return t?i.classList.add("positioned"):(t={pageX:Math.max(o,window.innerWidth||0)/2,pageY:Math.max(n,window.innerHeight||0)/2},i.style.position="fixed"),i.style.left=t.pageX+"px",i.style.top=t.pageY+"px",document.body.appendChild(i),document.dispatchEvent(u.a.modalOpened),-1!==r.indexOf("data-dialog")&&document.dispatchEvent(u.a.viewData),i}confirmRemoveAll(t){const r=this,o=t.target.id.match(/frmb-\d{13}/)[0],n=document.getElementById(o),i=c.a.current,l=e("li.form-field",n),a=t.target.getBoundingClientRect(),s=document.body.getBoundingClientRect(),d={pageX:a.left+a.width/2,pageY:a.top-s.top-12};l.length?r.confirm(i.clearAllMessage,()=>{r.removeAllFields.call(r,n),m.a.opts.persistDefaultFields&&m.a.opts.defaultFields?this.addDefaultFields():m.a.opts.notify.success(i.allFieldsRemoved),m.a.opts.onClearAll()},d):r.dialog(i.noFieldsToClear,d)}addDefaultFields(){m.a.opts.defaultFields.forEach(e=>this.formBuilder.prepFieldVars(e)),this.d.stage.classList.remove("empty")}removeAllFields(e){const t=c.a.current,r=m.a.opts,o=[];if(!e.querySelectorAll(this.formBuilder.fieldSelector).length)return!1;r.prepend&&o.push(!0),r.append&&o.push(!0),o.some(Boolean)||(e.classList.add("empty"),e.dataset.content=t.getStarted),this.emptyStage(e)}emptyStage(e){Object(l.b)(e).classList.remove("removing"),this.save()}setFieldOrder(t){if(!m.a.opts.sortableControls)return!1;const{sessionStorage:r,JSON:o}=window,n=[];return t.children().each((t,r)=>{const o=e(r).data("type");o&&n.push(o)}),r&&r.setItem("fieldOrder",o.stringify(n)),n}closeAllEdit(){e(this.d.stage).find("li.form-field").each((e,t)=>{this.closeField(t.id,!1)})}toggleEdit(t,r=!0){const o=document.getElementById(t);return o?e(o).hasClass("editing")?this.closeField(t,r):this.openField(t,r):o}closeField(t,r=!0){const o=this,n=document.getElementById(t);if(!n)return n;const i=e(".frm-holder",n),l=e(".prev-holder",n);let a=!1;if(e(n).hasClass("editing")&&(a=!0),!a)return n;n.classList.toggle("editing"),e(".toggle-form",n).toggleClass("open"),r?(l.slideToggle(250),i.slideToggle(250)):(l.toggle(),i.toggle()),this.updatePreview(e(n));const s=e("#"+t),d=e(`#${t}-cont`);d.append(s),this.removeContainerProtection(d.attr("id")),m.a.opts.onCloseFieldEdit(i[0]),document.dispatchEvent(u.a.fieldEditClosed);const c=s.find(".prev-holder"),f=setTimeout(()=>{clearTimeout(f);o.tmpCleanPrevHolder(c).forEach(e=>{if(e.columnInfo.columnSize){d.attr("class")!=e.columnInfo.columnSize&&(d.attr("class",`${e.columnInfo.columnSize} ${this.formBuilder.colWrapperClass}`),o.tmpCleanPrevHolder(c))}})},300);return n}openField(t,r=!0){const o=document.getElementById(t);if(!o)return o;const n=e(".frm-holder",o),i=e(".prev-holder",o);let l=!1;if(e(o).hasClass("editing")&&(l=!0),l)return o;o.classList.toggle("editing"),e(".toggle-form",o).toggleClass("open"),r?(i.slideToggle(250),n.slideToggle(250)):(i.toggle(),n.toggle()),this.updatePreview(e(o));const a=e("#"+t),s=e(`#${t}-cont`),d=s.closest(this.formBuilder.rowWrapperClassSelector);return this.formBuilder.preserveTempContainers.push(s.attr("id")),a.insertAfter(d),this.formBuilder.currentEditPanel=n[0],m.a.opts.onOpenFieldEdit(n[0]),document.dispatchEvent(u.a.fieldEditOpened),e(document).trigger("fieldOpened",[{rowWrapperID:d.attr("id")}]),o}getStyle(e,t=!1){let r;return window.getComputedStyle?r=window.getComputedStyle(e,null):e.currentStyle&&(r=e.currentStyle),t?r[t]:r}stickyControls(){const{controls:t,stage:r}=this.d,o=e(t).parent(),n=t.getBoundingClientRect(),{top:i}=r.getBoundingClientRect();e(window).scroll((function(l){const a=e(l.target).scrollTop(),s={top:5,bottom:"auto",right:"auto",left:n.left},d=Object.assign({},s,m.a.opts.stickyControls.offset);if(a>i){const e={position:"sticky"},n=Object.assign(e,d),i=t.getBoundingClientRect(),l=r.getBoundingClientRect(),s=i.top+i.height,c=l.top+l.height,u=s===c&&i.top>a;s>c&&i.top!==l.top&&o.css({position:"absolute",top:"auto",bottom:0,right:0,left:"auto"}),(se.id);m.a.opts.notify.warning("fieldID required to remove specific fields."),m.a.opts.notify.warning("Removing last field since no ID was supplied."),m.a.opts.notify.warning("Available IDs: "+e.join(", ")),t=i.lastChild.id}const s=e(a),d=s.closest(this.formBuilder.rowWrapperClassSelector);if(!a)return m.a.opts.notify.warning("Field not found"),!1;s.slideUp(r,(function(){s.removeClass("deleting"),s.remove(),o=!0,n.save(),i.childNodes.length||(i.classList.add("empty"),i.dataset.content=c.a.current.getStarted)}));const f=m.a.opts.typeUserEvents[a.type];if(f&&f.onremove&&f.onremove(a),document.dispatchEvent(u.a.fieldRemoved),d.length){this.removeContainerProtection(t+"-cont");const r=setTimeout(()=>{clearTimeout(r),e(document).trigger("checkRowCleanup",[{rowWrapperID:d.attr("id")}])},m.e)}return o}processActionButtons(e){const{label:t,events:r}=e,o=g(e,["label","events"]);let n=t;const i=this.data;n=n?c.a.current[n]||n:o.id?c.a.current[o.id]||Object(p.e)(o.id):"",o.id?o.id=`${i.formID}-${o.id}-action`:o.id=`${i.formID}-action-${Math.round(1e3*Math.random())}`;const l=Object(p.t)("button",n,o);if(r)for(const e in r)r.hasOwnProperty(e)&&l.addEventListener(e,t=>r[e](t));return l}processSubtypes(e){const t=m.a.opts.disabledSubtypes;for(const t in e)e.hasOwnProperty(t)&&b.a.register(e[t],b.a.getClass(t),t);const r=b.a.getRegisteredSubtypes(),o=Object.entries(r).reduce((e,[r,o])=>(e[r]=t[r]&&Object(p.B)(t[r],o)||o,e),{}),n={};for(const e in o)if(o.hasOwnProperty(e)){const t=[];for(const r of o[e]){const o=b.a.getClass(e,r),n=o.mi18n("subtype."+r)||o.mi18n(r)||r;t.push({label:n,value:r})}n[e]=t}return n}editorUI(e){const t=this.d,r=this.data,o=e||r.formID;t.editorWrap=Object(p.t)("div",null,{id:r.formID+"-form-wrap",className:"form-wrap form-builder "+Object(p.u)()}),t.stage=Object(p.t)("ul",null,{id:o,className:"frmb stage-wrap "+r.layout.stage}),t.controls=Object(p.t)("ul",null,{id:o+"-control-box",className:"frmb-control"});const n=this.formActionButtons();t.formActions=Object(p.t)("div",n,{className:"form-actions btn-group"})}formActionButtons(){const e=m.a.opts;return e.actionButtons.map(t=>{if(t.id&&-1===e.disabledActionButtons.indexOf(t.id))return this.processActionButtons(t)}).filter(Boolean)}processOptions(e){const t=this,{actionButtons:r,replaceFields:o}=e,n=g(e,["actionButtons","replaceFields"]);let i=n.fieldEditContainer;"string"==typeof n.fieldEditContainer&&(i=document.querySelector(n.fieldEditContainer));const l=[{type:"button",id:"clear",className:"clear-all btn btn-danger",events:{click:t.confirmRemoveAll.bind(t)}},{type:"button",label:"viewJSON",id:"data",className:"btn btn-default get-data",events:{click:t.showData.bind(t)}},{type:"button",id:"save",className:"btn btn-primary save-template",events:{click:e=>{t.save(),m.a.opts.onSave(e,t.data.formData)}}}].concat(r);return n.fields=n.fields.concat(o),n.disableFields=n.disableFields.concat(o.map(({type:e})=>e&&e)),"xml"===n.dataType&&(n.disableHTMLLabels=!0),m.a.opts=Object.assign({},{actionButtons:l},{fieldEditContainer:i},n),m.a.opts}input(e={}){return Object(p.t)("input",null,e)}getFormData(e="js",t=!1){this.closeAllEdit();const r=this;return{js:()=>r.prepData(r.d.stage),xml:()=>r.xmlSave(r.d.stage),json:e=>window.JSON.stringify(r.prepData(r.d.stage),null,e&&" ")}[e](t)}tmpCleanPrevHolder(t){const r=this,o=[],n=t.find(".form-group");function i(e){var t=e.attr("class");if(void 0!==t&&!1!==t){const t=r.tryParseColumnInfo(e[0]);e.attr("class",e.attr("class").replace("col-","tmp-col-")),e.attr("class",e.attr("class").replace("row","tmp-row"));const n={};n.field=e,n.columnInfo=t,o.push(n)}}return i(n),n.find("*").each((function(t,r){i(e(r))})),o}tryParseColumnInfo(e){const t={};if(e.className){const r=Object(p.m)(e.className);r&&r.length>0&&r.forEach(e=>{e.startsWith("row-")?t.rowNumber=parseInt(e.replace("row-","").trim()):t.columnSize=e})}return t}removeContainerProtection(e){var t=this.formBuilder.preserveTempContainers.indexOf(e);-1!==t&&this.formBuilder.preserveTempContainers.splice(t,1)}toggleHighlight(e,t=600){e.addClass("moveHighlight"),setTimeout((function(){e.removeClass("moveHighlight")}),t)}showToast(t,r=3e3){null!=this.toastTimer&&(window.clearTimeout(this.toastTimer),this.toastTimer=null),this.toastTimer=setTimeout((function(){e(".snackbar").removeClass("show")}),r),e(".snackbar").addClass("show").html(t)}getDistanceBetweenPoints(e,t,r,o){const n=r-e,i=o-t;return Math.floor(Math.sqrt(i*i+n*n))}getRowClass(e){if(!e)return;const t=e.split(" ").filter(e=>e.startsWith("row-"));return t&&t.length>0?t[0]:void 0}getRowValue(e){if(!e)return 0;const t=this.getRowClass(e);return t?parseInt(t.split("-")[1]):void 0}changeRowClass(e,t){const r=this.getRowClass(e);return e.replace(r,"row-"+t)}getBootstrapColumnValue(e){if(!e)return 0;const t=this.getBootstrapColumnClass(e);return t?parseInt(t.split("-")[2]):void 0}getBootstrapColumnPrefix(e){if(!e)return 0;const t=this.getBootstrapColumnClass(e);return t?`${t.split("-")[0]}-${t.split("-")[1]}`:void 0}getBootstrapColumnClass(e){if(!e)return;const t=e.split(" ").filter(e=>p.c.test(e));return t&&t.length>0?t[0]:void 0}changeBootstrapClass(e,t){const r=this.getBootstrapColumnClass(e);return e.replace(r,`${this.getBootstrapColumnPrefix(e)}-${t}`)}syncBootstrapColumnWrapperAndClassProperty(t,r){const o=e(`#${t}-cont`);o.attr("class",this.changeBootstrapClass(o.attr("class"),r));const n=e("#className-"+t);n.val()&&n.val(this.changeBootstrapClass(n.val(),r))}}o(12);var w=o(7);class v{constructor(e,t){this.opts=e,this.dom=t.controls,this.custom=h.a,this.getClass=b.a.getClass,this.getRegistered=b.a.getRegistered,b.a.controlConfig=e.controlConfig||{},this.init()}init(){this.setupControls(),this.appendControls()}setupControls(){const e=this.opts;b.a.loadCustom(e.controls),Object.keys(e.fields).length&&h.a.register(e.templates,e.fields);const t=b.a.getRegistered();this.registeredControls=t;const r=h.a.getRegistered();r&&jQuery.merge(t,r);const o=b.a.getRegisteredSubtypes();this.registeredSubtypes=o,e.sortableControls&&this.dom.classList.add("sort-enabled"),this.controlList=[],this.allControls={};for(let e=0;e${i}${l}`);const s=Object(p.t)("li",Object(p.t)("span",l),{className:`${a} input-control input-control-${e}`});s.dataset.type=r,this.controlList.push(r),this.allControls[r]=s}e.inputSets.length&&e.inputSets.forEach((e,t)=>{let{name:r,label:o}=e;r=r||Object(p.q)(o),e.icon&&(o=`${e.icon}${o}`);const n=Object(p.t)("li",o,{className:"input-set-control input-set-"+t});n.dataset.type=r,this.controlList.push(r),this.allControls[r]=n})}orderFields(e){const t=this.opts,r=t.controlOrder.concat(e);let o;return window.sessionStorage&&(t.sortableControls?o=window.sessionStorage.getItem("fieldOrder"):window.sessionStorage.removeItem("fieldOrder")),o?(o=window.JSON.parse(o),o=Object(p.E)(o.concat(e)),o=Object.keys(o).map(e=>o[e])):o=Object(p.E)(r),o.forEach(e=>{const t=new RegExp("-[\\d]{4}$");if(e.match(t)){const r=o.indexOf(e.replace(t,""));-1!==r&&(o.splice(o.indexOf(e),1),o.splice(r+1,o.indexOf(e),e))}}),t.disableFields.length&&(o=o.filter(e=>!t.disableFields.includes(e))),o.filter(Boolean)}appendControls(){const e=document.createDocumentFragment();Object(l.b)(this.dom),this.orderFields(this.controlList).forEach(t=>{const r=this.allControls[t];r&&e.appendChild(r)}),this.dom.appendChild(e)}}function x(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function O(e){for(var t=1;tA.beforeStop.call(A,e,t),start:(e,t)=>A.startMoving.call(A,e,t),stop:(e,t)=>A.stopMoving.call(A,e,t),cancel:["input","select","textarea",".disabled-field",".form-elements",".btn","button",".is-locked"].join(", "),placeholder:"frmb-placeholder"}),e.allowStageSort||P.sortable("disable"),Q()?M.sortable({opacity:.9,connectWith:S,cancel:".formbuilder-separator",cursor:"move",scroll:!1,start:(e,t)=>{A.startMoving.call(A,e,t),R=!0},stop:(e,t)=>{A.stopMoving.call(A,e,t),R=!1,we()},revert:150,beforeStop:(e,t)=>{A.beforeStop.call(A,e,t)},distance:3,update:function(t){if(R=!1,A.doCancel)return!1;r(t.target).attr("id")==M.attr("id")&&pe(),A.setFieldOrder(M),A.doCancel=!e.sortableControls}}):M.sortable({helper:"clone",opacity:.9,connectWith:P,cancel:".formbuilder-separator",cursor:"move",scroll:!1,placeholder:"ui-state-highlight",start:(e,t)=>A.startMoving.call(A,e,t),stop:(e,t)=>A.stopMoving.call(A,e,t),revert:150,beforeStop:(e,t)=>A.beforeStop.call(A,e,t),distance:3,update:function(t,r){if(A.doCancel)return!1;r.item.parent()[0]===b.stage?(A.doCancel=!0,Y(r.item)):(A.setFieldOrder(M),A.doCancel=!e.sortableControls)}}),M.on("mouseenter",(function(){Te()&&P.children(B).addClass(N)}));const Y=t=>{if(t[0].classList.contains("input-set-control")){const r=[],o=e.inputSets.find(e=>Object(p.q)(e.name||e.label)===t[0].dataset.type);if(o&&o.showHeader){const e={type:"header",subtype:"h2",id:o.name,label:o.label};r.push(e)}r.push(...o.fields),r.forEach(e=>{Z(e,!0),(A.stopIndex||0===A.stopIndex)&&A.stopIndex++})}else Z(t,!0)},G=r(b.editorWrap);r('
').appendTo(G);const X=C("div",b.controls,{id:d.formID+"-cb-wrap",className:"cb-wrap "+d.layout.controls});e.showActionButtons&&X.appendChild(b.formActions);const J=C("div","",{id:d.formID+"-gridModeHelp",className:"grid-mode-help"});X.appendChild(J),G.append(b.stage,X),"textarea"!==t.type?r(t).append(G):r(t).replaceWith(G),r(b.controls).on("click","li",({target:e})=>{if(R)return;Te()||P.find(B).eq(0).remove();const t=r(e).closest("li");A.stopIndex=void 0,Y(t),A.save.call(A)});const Z=(t,o=!1)=>{let n={};if(t instanceof jQuery)if(n.type=t[0].dataset.type,n.type){const e=I.custom.lookup(n.type);if(e)n=Object.assign({},e);else{const e=I.getClass(n.type);n.label=e.label(n.type)}}else{const e=t[0].attributes;o||(n.values=t.children().map((e,t)=>({label:r(t).text(),value:r(t).attr("value"),selected:Boolean(r(t).attr("selected"))})));for(let t=e.length-1;t>=0;t--)n[e[t].name]=e[t].value}else n=Object.assign({},t);n.name||(n.name=Object(p.v)(n)),o&&["text","number","file","date","select","textarea","autocomplete"].includes(n.type)&&(n.className=n.className||"form-control");const i=/(?:^|\s)btn-(.*?)(?:\s|$)/g.exec(n.className);if(i&&(n.style=i[1]),o){const e=setTimeout(()=>{document.dispatchEvent(u.a.fieldAdded),clearTimeout(e)},10)}e.onAddField(d.lastID,n),ue(n,o),e.onAddFieldAfter(d.lastID,n),b.stage.classList.remove("empty")};o.prepFieldVars=Z;const K=function(t){(t=A.getData(t))&&t.length?(t.forEach(e=>{$(e)}),t.forEach(e=>Z(Object(p.D)(e))),b.stage.classList.remove("empty")):e.defaultFields&&e.defaultFields.length?(m.a.opts.defaultFields.forEach(e=>$(e)),A.addDefaultFields()):e.prepend||e.append||(b.stage.classList.add("empty"),b.stage.dataset.content=c.a.get("getStarted")),(()=>{const t=[],o=t=>C("li",e[t],{className:"disabled-field form-"+t});return e.prepend&&!r(".disabled-field.form-prepend",b.stage).length&&(t.push(!0),P.prepend(o("prepend"))),e.append&&!r(".disabled-field.form-.append",b.stage).length&&(t.push(!0),P.append(o("append"))),A.disabledTT(b.stage),t.some(e=>!0===e)})()&&b.stage.classList.remove("empty"),A.save()};function $(e){const t=A.getRowValue(e.className);t&&!h.includes(t)&&h.push(t)}const _=t=>{const{type:r}=t,o=[],n=I.getClass(r),i=(e=>{const t=["required","label","description","placeholder","className","name","access","value"],r=!["header","paragraph","file","autocomplete"].concat(b.optionFields).includes(e),o={autocomplete:t.concat(["options","requireValidOption"]),button:["label","subtype","style","className","name","value","access"],checkbox:["required","label","description","toggle","inline","className","name","access","other","options"],text:t.concat(["subtype","maxlength"]),date:t,file:t.concat(["subtype","multiple"]),header:["label","subtype","className","access"],hidden:["name","value","access"],paragraph:["label","subtype","className","access"],number:t.concat(["min","max","step"]),select:t.concat(["multiple","options"]),textarea:t.concat(["subtype","maxlength","rows"])};e in I.registeredSubtypes&&!(e in o)&&(o[e]=t.concat(["subtype"])),o["checkbox-group"]=o.checkbox,o["radio-group"]=o.checkbox;const n=o[e];return"radio-group"===e&&Object(p.y)("toggle",n),["header","paragraph","button"].includes(e)&&Object(p.y)("description",n),r||Object(p.y)("value",n),n||t})(r),l={required:()=>ce(t),toggle:()=>ie("toggle",t,{first:c.a.get("toggle")}),inline:()=>{const e={first:c.a.get("inline"),second:c.a.get("inlineDesc",r.replace("-group",""))};return ie("inline",t,e)},label:()=>de("label",t),description:()=>de("description",t),subtype:()=>se("subtype",t,F[r]),style:()=>le(t.style),placeholder:()=>de("placeholder",t),rows:()=>ae("rows",t),className:e=>de("className",t,e),name:e=>de("name",t,e),value:()=>de("value",t),maxlength:()=>ae("maxlength",t),access:()=>{const r=[`
`];for(a in e.roles)if(e.roles.hasOwnProperty(a)){const t=`fld-${d.lastID}-roles-${a}`,o={type:"checkbox",name:"roles[]",value:a,id:t,className:"roles-field"};s.includes(a)&&(o.checked="checked"),r.push(``)}r.push("
");const o={first:c.a.get("roles"),second:c.a.get("limitRole"),content:r.join("")};return ie("access",t,o)},other:()=>ie("other",t,{first:c.a.get("enableOther"),second:c.a.get("enableOtherMsg")}),options:()=>function(e){const{type:t,values:r}=e;let o;const n=[C("a",c.a.get("addOption"),{className:"add add-opt"})],i=[C("label",c.a.get("selectOptions"),{className:"false-label"})],l=e.multiple||"checkbox-group"===t,a=e=>{const t=c.a.get("optionCount",e);return{selected:!1,label:t,value:Object(p.q)(t)}};if(r&&r.length)o=r.map(e=>Object.assign({},{selected:!1},e));else{let e=[1,2,3];["checkbox-group","checkbox"].includes(t)&&(e=[1]),o=e.map(a);const r=o[0];r.hasOwnProperty("selected")&&"radio-group"!==t&&(r.selected=!0)}const s=C("div",n,{className:"option-actions"}),d=C("ol",o.map((e,r)=>{const o=m.a.opts.onAddOption(e,{type:t,index:r,isMultiple:l});return Ae(o,l)}),{className:"sortable-options"}),u=C("div",[d,s],{className:"sortable-options-wrap"});return i.push(u),C("div",i,{className:"form-group field-options"}).outerHTML}(t),requireValidOption:()=>ie("requireValidOption",t,{first:" ",second:c.a.get("requireValidOption")}),multiple:()=>{const e={default:{first:"Multiple",second:"set multiple attribute"},file:{first:c.a.get("multipleFiles"),second:c.a.get("allowMultipleFiles")},select:{first:" ",second:c.a.get("selectionsMessage")}};return ie("multiple",t,e[r]||e.default)}};let a;const s=void 0!==t.role?t.role.split(","):[];["min","max","step"].forEach(e=>{l[e]=()=>ae(e,t)});const u=["name","className"];if(Object.keys(i).forEach(t=>{const a=i[t],s=[!0],d=e.disabledAttrs.includes(a);if(e.typeUserDisabledAttrs[r]){const t=e.typeUserDisabledAttrs[r];s.push(!t.includes(a))}if(n.definition.hasOwnProperty("defaultAttrs")){const e=Object.keys(n.definition.defaultAttrs);s.push(!e.includes(a))}if(e.typeUserAttrs[r]){const t=Object.keys(e.typeUserAttrs[r]);s.push(!t.includes(a))}d&&!u.includes(a)&&s.push(!1),s.every(Boolean)&&o.push(l[a](d))}),n.definition.hasOwnProperty("defaultAttrs")){const e=re(n.definition.defaultAttrs,t);o.push(e)}if(e.typeUserAttrs[r]){const n=re(e.typeUserAttrs[r],t);o.push(n)}return o.join("")};function ee(e){return[["array",({options:e})=>!!e],["boolean",({type:e})=>"checkbox"===e],[typeof e.value,()=>!0]].find(t=>t[1](e))[0]||"string"}function te(e,t){return e.subtype&&e.subtype===t}function re(e,t){const r=[],o={array:ne,string:oe,number:ae,boolean:(e,r)=>{let o=!1;return"checkbox"===e.type?o=Boolean(!!r.hasOwnProperty("value")&&r.value):t.hasOwnProperty(e)?o=t[e]:(r.hasOwnProperty("value")||r.hasOwnProperty("checked"))&&(o=r.value||r.checked||!1),ie(e,O(O({},r),{},{[e]:o}),{first:r.label})}};for(const i in e)if(e.hasOwnProperty(i)){const l=ee(e[i]);if("undefined"!==l){const a=c.a.get(i),s=e[i],d=s.value||"";s.value=t[i]||s.value||"",s.label&&(n[i]=Array.isArray(s.label)?c.a.get(...s.label)||s.label[0]:s.label),o[l]&&r.push(o[l](i,s)),n[i]=a,s.value=d}else{if("undefined"!==l||!te(t,i))continue;r.push(re(e[i],t))}}return r.join("")}function oe(e,t){const{class:r,className:o}=t,i=x(t,["class","className"]);let l={id:e+"-"+d.lastID,title:i.description||i.label||e.toUpperCase(),name:e,type:i.type||"text",className:["fld-"+e,(r||o||"").trim()],value:i.value||""};const a=``;["checkbox","checkbox-group","radio-group"].includes(l.type)||l.className.push("form-control"),l=Object.assign({},i,l);return`
${a}${`
${(()=>{if("textarea"===l.type){const e=l.value;return delete l.value,``}return``})()}
`}
`}function ne(e,t){const{multiple:r,options:o,label:i,value:l,class:a,className:s}=t,u=x(t,["multiple","options","label","value","class","className"]),f=Object.keys(o).map(e=>{const t={value:e},r=o[e],n=Array.isArray(r)?c.a.get(...r)||r[0]:r;return(Array.isArray(l)?l.includes(e):e===l)&&(t.selected=null),C("option",n,t)}),p={id:`${e}-${d.lastID}`,title:u.description||i||e.toUpperCase(),name:e,className:`fld-${e} form-control ${a||s||""}`.trim()};r&&(p.multiple=!0);const m=``;Object.keys(u).forEach((function(e){p[e]=u[e]}));return`
${m}${`
${C("select",f,p).outerHTML}
`}
`}const ie=(e,t,r={})=>{const o=t=>C("label",t,{for:`${e}-${d.lastID}`}).outerHTML,n={type:"checkbox",className:"fld-"+e,name:e,id:`${e}-${d.lastID}`};t[e]&&(n.checked=!0);const i=[];let l=[C("input",null,n).outerHTML];return r.first&&i.push(o(r.first)),r.second&&l.push(" ",o(r.second)),r.content&&l.push(r.content),l=C("div",l,{className:"input-wrap"}).outerHTML,C("div",i.concat(l),{className:`form-group ${e}-wrap`}).outerHTML},le=e=>{let t="";"undefined"===e&&(e="default");const r=``;return t+=A.input({value:e||"default",type:"hidden",className:"btn-style"}).outerHTML,t+='
',m.g.btn.forEach(r=>{const o=["btn-xs","btn","btn-"+r];e===r&&o.push("selected");const n=C("button",c.a.get("styles.btn."+r),{value:r,type:"button",className:o.join(" ")}).outerHTML;t+=n}),t+="
",t=C("div",[r,t],{className:"form-group style-wrap"}),t.outerHTML},ae=(e,t)=>{const{class:r,className:o,value:n}=t,i=x(t,["class","className","value"])[e]||n,l=c.a.get(e)||e,a={type:"number",value:i,name:e,placeholder:c.a.get("placeholder."+e),className:`fld-${e} form-control ${r||o||""}`.trim(),id:`${e}-${d.lastID}`},s=A.input(Object(p.D)(a)).outerHTML;return C("div",[``,`
${s}
`],{className:`form-group ${e}-wrap`}).outerHTML},se=(e,t,r)=>{const o=r.map((r,o)=>{let i=Object.assign({label:`${n.option} ${o}`,value:void 0},r);return r.value===t[e]&&(i.selected=!0),i=Object(p.D)(i),C("option",i.label,i)}),i={id:e+"-"+d.lastID,name:e,className:`fld-${e} form-control`},l=c.a.get(e)||Object(p.e)(e)||"",a=C("label",l,{for:i.id}),s=C("select",o,i),u=C("div",s,{className:"input-wrap"});return C("div",[a,u],{className:`form-group ${i.name}-wrap`}).outerHTML},de=(t,r,o=!1)=>{const n=["paragraph"];let i=r[t]||"",l=c.a.get(t);"label"===t&&(n.includes(r.type)?l=c.a.get("content"):i=Object(p.x)(i));const a=c.a.get("placeholders."+t)||"";let s="";if(![].some(e=>!0===e)){const n={name:t,placeholder:a,className:`fld-${t} form-control`,id:`${t}-${d.lastID}`},c=C("label",l,{for:n.id}).outerHTML;"label"!==t||e.disableHTMLLabels?(n.value=i,n.type="text",s+=``):(n.contenteditable=!0,s+=C("div",i,n).outerHTML);const u=`
${s}
`;let f=o?"none":"block";"value"===t&&(f=r.subtype&&"quill"===r.subtype&&"none"),s=C("div",[c,u],{className:`form-group ${t}-wrap`,style:"display: "+f})}return s.outerHTML},ce=e=>{const{type:t}=e,r=[];let o="";return["header","paragraph","button"].includes(t)&&r.push(!0),r.some(e=>!0===e)||(o=ie("required",e,{first:c.a.get("required")})),o},ue=function(t,i=!0){const l=xe(t);d.lastID=A.incrementId(d.lastID);const a=t.type||"text";let s=t.label||(i?n.get(a)||c.a.get("label"):"");"hidden"===a&&(s=`${c.a.get(a)}: ${t.name}`);const u=e.disabledFieldButtons[a]||t.disabledFieldButtons;let f=[C("a",null,{type:"remove",id:"del_"+d.lastID,className:`del-button btn ${w.a}cancel delete-confirm`,title:c.a.get("removeMessage")}),C("a",null,{type:"edit",id:d.lastID+"-edit",className:`toggle-form btn ${w.a}pencil`,title:c.a.get("hide")}),C("a",null,{type:"copy",id:d.lastID+"-copy",className:`copy-button btn ${w.a}copy`,title:c.a.get("copyButtonTooltip")})];Q()&&f.push(C("a",null,{type:"grid",id:d.lastID+"-grid",className:`grid-button btn ${w.a}grid`,title:"Grid Mode"})),u&&Array.isArray(u)&&(f=f.filter(e=>!u.includes(e.type)));const m=[C("div",f,{className:"field-actions"})];m.push(C("label",Object(p.x)(s),{className:"field-label"})),m.push(C("span"," *",{className:"required-asterisk",style:t.required?"display:inline":""}));const h={className:"tooltip-element",tooltip:t.description,style:t.description?"display:inline-block":"display:none"};m.push(C("span","?",h));const g=C("div","",{className:"prev-holder",dataFieldId:d.lastID});m.push(g);const y=C("div",[_(t),C("a",c.a.get("close"),{className:"close-field"})],{className:"form-elements"}),v=C("div",y,{id:d.lastID+"-holder",className:"frm-holder",dataFieldId:d.lastID});o.currentEditPanel=v,m.push(v);const x=C("li",m,{class:a+"-field form-field",type:a,id:d.lastID}),O=r(x);let q;if(fe(O),O.data("fieldData",{attrs:t}),void 0!==A.stopIndex?r("> li",b.stage).eq(A.stopIndex).before(O):P.append(O),r(".sortable-options",O).sortable({update:()=>A.updatePreview(O)}),A.updatePreview(O),Q()){const e="div.row-"+l.rowNumber;q=P.children(e).length?P.children(e):C("div",null,{id:x.id+"-row",className:`row row-${l.rowNumber} ${j}`}),W&&U&&(H.attr("id",q.id),H.attr("class",q.className),H.attr("style",""),q=H);const t=C("div",null,{id:x.id+"-cont",className:`${l.columnSize} ${k}`});W&&V&&("true"==H.attr("prepend")?r(t).prependTo(q):r(t).insertAfter("#"+H.attr("appendAfter"))),V||r(t).appendTo(q),W||P.append(q),O.appendTo(t),he(q),me(q),l.addedDefaultColumnClass&&O.attr("addedDefaultColumnClass",!0),A.tmpCleanPrevHolder(r(g))}e.typeUserEvents[a]&&e.typeUserEvents[a].onadd&&e.typeUserEvents[a].onadd(x),i&&(e.editOnAdd&&(A.closeAllEdit(),A.toggleEdit(d.lastID,!1)),x.scrollIntoView&&e.scrollToFieldOnAdd&&x.scrollIntoView({behavior:"smooth"})),Q()&&(W&&V&&Ee(q,!0),we()),W=!1,U=!1,V=!1};function fe(e){Q()&&e.mouseenter((function(e){je||(pe(),r(this).closest(S).prevAll(B).first().removeClass(N),r(this).closest(S).nextAll(B).first().removeClass(N),Ce=r(this),ke=e.pageX,qe=e.pageY)}))}function pe(){P.find(B).addClass(N)}function me(e){const t=r(e).clone();if(t.addClass(N).addClass(E).html(""),t.css("height","1px"),t.attr("class",t.attr("class").replace("row-","")),t.removeAttr("id"),0==r(e).index()){const e=r(t).clone();P.prepend(e),he(e)}t.insertAfter(r(e)),he(t)}function be(){P.children(B).remove(),P.children(S).each((e,t)=>{me(r(t))})}function he(t){Q()&&(r(t).sortable({connectWith:[S],cursor:"move",opacity:.9,revert:150,tolerance:"pointer",helper:function(e,t){const r=t.clone();return r.find(".field-actions").remove(),r.css({width:"20%",height:"100px",minHeight:"60px",overflow:"hidden"}),r},over:function(e){const t=r(e.target),o=t.hasClass(E);o||ve(t),t.addClass("hoverDropStyleInverse"),o||(pe(),t.prevAll(B).first().removeClass(N).css("height","40px"),t.nextAll(B).first().removeClass(N).css("height","40px"))},out:function(e){P.children(B).removeClass("hoverDropStyleInverse"),r(e.target).removeClass("hoverDropStyleInverse")},placeholder:"hoverDropStyleInverse",receive:function(e,t){const o=r(t.sender).attr("id")==M.attr("id"),n=r(t.item).parent().hasClass(E),i=r(t.item).parent().hasClass(E),l=r(t.item).parent().hasClass(j)&&!r(t.item).parent().hasClass(E);if(n&&!o){const e=r(t.item),o=xe({}),n=C("div",null,{id:e.find("li").attr("id")+"-row",className:`row row-${o.rowNumber} ${j}`});r(t.item).parent().replaceWith(n),fe(r(t.item)),e.appendTo(n),he(n),Ne(e.attr("id")),Se()}if(i&&o&&(U=!0,W=!0,H=r(t.item).parent()),l&&o){H=r(t.item).prev().hasClass("btnAddControl")?r(t.item).prev():r(t.item).next().hasClass("btnAddControl")?r(t.item).next():r(t.item).attr("prepend","true");const e=A.getRowClass(r(t.item).parent().attr("class"));H.addClass(e),V=!0,W=!0,A.stopIndex=void 0}we(),W&&(A.doCancel=!0,Y(t.item),A.save.call(A)),be();const a=r(t.item).find("li");a.length&&(ge(a),ye(a))},start:function(){we()},stop:function(e,t){P.children(B).removeClass("hoverDropStyleInverse"),Ee(t.item.closest(S),!0)},update:function(e,t){Ne(t.item.attr("id"))}}),r(t).off("mouseenter"),r(t).on("mouseenter",(function(t){!function(t){if(!e.enableColumnInsertMenu)return;r(t).children(T).each((e,t)=>{const o=r(t);o.addClass("colHoverTempStyle"),0==o.index()&&r(``).insertBefore(o),r(``).insertAfter(o)})}(r(t.currentTarget))})),r(t).off("mouseleave"),r(t).on("mouseleave",(function(e){ve(r(e.currentTarget))})))}function ge(e){const t=e.find('textarea[type="tinymce"]');t.length&&(window.lastFormBuilderCopiedTinyMCE=window.tinymce.get(t.attr("id")).save())}function ye(e){A.updatePreview(e),A.save.call(A)}function we(){P.find(T).removeClass("colHoverTempStyle"),P.find(D).remove()}function ve(e){e.find(D).remove(),e.find(T).removeClass("colHoverTempStyle")}function xe(t){let r={};return Q()?(r=A.tryParseColumnInfo(t),function(){if(!r.rowNumber){let o;o=0==h.length?1:Math.max(...h)+1,r.rowNumber=o,W&&V&&(r.rowNumber=A.getRowValue(H.attr("class"))),r.columnSize=e.defaultGridColumnClass,t.className||(t.className=""),t.className+=` row-${r.rowNumber} ${r.columnSize}`,r.addedDefaultColumnClass=!0}}(),h.includes(r.rowNumber)||h.push(r.rowNumber),r):r}const Ae=function(e,t){const r={selected:t?"checkbox":"radio"},o={boolean:(e,t)=>{const o={value:e,type:r[t]||"checkbox"};return e&&(o.checked=!!e),["input",null,o]},number:e=>["input",null,{value:e,type:"number"}],string:(e,t)=>["input",null,{value:e,type:"text",placeholder:c.a.get("placeholder."+t)||""}],array:e=>["select",e.map(({label:e,value:t})=>C("option",e,{value:t}))],object:e=>{let{tag:t,content:r}=e;return[t,r,x(e,["tag","content"])]}};e=O(O({},{selected:!1,label:"",value:""}),e);const n=Object.entries(e).map(([e,t])=>{const r=Object(p.n)(t),[n,i,l]=o[r](t,e),a=`option-${e} option-attr`;return l["data-attr"]=e,l.className=l.className?`${l.className} ${a}`:a,C(n,i,l)}),i={className:`remove btn ${w.a}cancel`,title:c.a.get("removeMessage")};return n.push(C("a",null,i)),C("li",n).outerHTML},Oe=[".form-elements input",".form-elements select",".form-elements textarea"].join(", ");P.on("change blur keyup click",Oe,i()(e=>{if(e){if([({type:e,target:t})=>"keyup"===e&&"className"===t.name].some(t=>t(e)))return!1;ye(r(e.target).closest(".form-field"))}},m.e,{leading:!1})),P.on("click touchstart",".remove",t=>{const o=r(t.target).parents(".form-field:eq(0)"),n=o[0],i=n.getAttribute("type"),l=r(t.target.parentElement);t.preventDefault();n.querySelector(".sortable-options").childNodes.length<=2&&!i.includes("checkbox")?e.notify.error("Error: "+c.a.get("minOptionMessage")):l.slideUp("250",()=>{l.remove(),ye(o)})}),P.on("touchstart","input",e=>{const t=r(this);if(!0===e.handled)return!1;if("checkbox"===t.attr("type"))t.trigger("click");else{t.focus();const e=t.val();t.val(e)}}),P.on("click touchstart",".toggle-form, .close-field",(function(e){if(e.stopPropagation(),e.preventDefault(),!0===e.handled)return!1;{const t=r(e.target).parents(".form-field:eq(0)").attr("id");A.toggleEdit(t),e.handled=!0}})),P.on("dblclick","li.form-field",e=>{if(!["select","input","label"].includes(e.target.tagName.toLowerCase())&&"true"!==e.target.contentEditable&&(e.stopPropagation(),e.preventDefault(),!0!==e.handled)){const t="li"==e.target.tagName?r(e.target).attr("id"):r(e.target).closest("li.form-field").attr("id");A.toggleEdit(t),e.handled=!0}}),P.on("change",'[name="subtype"]',e=>{const t=r(e.target).closest("li.form-field");r(".value-wrap",t).toggle("quill"!==e.target.value)});P.on("change",[".prev-holder input",".prev-holder select",".prev-holder textarea"].join(", "),e=>{let t;if(e.target.classList.contains("other-option"))return;const r=Object(p.f)(e.target,".form-field");if(["select","checkbox-group","radio-group"].includes(r.type)){const o=r.getElementsByClassName("option-value");"select"===r.type?Object(p.j)(o,t=>{o[t].parentElement.childNodes[0].checked=e.target.value===o[t].value}):(t=document.getElementsByName(e.target.name),Object(p.j)(t,e=>{o[e].parentElement.childNodes[0].checked=t[e].checked}))}else{const t=document.getElementById("value-"+r.id);t&&(t.value=e.target.value)}A.save.call(A)}),Object(p.a)(b.stage,"keyup change",({target:e})=>{if(!e.classList.contains("fld-label"))return;const t=e.value||e.innerHTML;Object(p.f)(e,".form-field").querySelector(".field-label").innerHTML=Object(p.x)(t)}),P.on("keyup","input.error",({target:e})=>r(e).removeClass("error")),P.on("keyup",'input[name="description"]',(function(e){const t=r(e.target).parents(".form-field:eq(0)"),o=r(".tooltip-element",t),n=r(e.target).val();if(""!==n)if(o.length)o.attr("tooltip",n).css("display","inline-block");else{const e=`?`;r(".field-label",t).after(e)}else o.length&&o.css("display","none")})),P.on("change",".fld-multiple",e=>{const t=e.target.checked?"checkbox":"radio",o=r(".option-selected",r(e.target).closest(".form-elements"));return o.each(e=>o[e].type=t),t}),P.on("blur","input.fld-name",(function(e){e.target.value=Object(p.A)(e.target.value),""===e.target.value?r(e.target).addClass("field-error").attr("placeholder",c.a.get("cannotBeEmpty")):r(e.target).removeClass("field-error")})),P.on("blur","input.fld-maxlength",e=>{e.target.value=Object(p.k)(e.target.value)}),P.on("click touchstart",".btnAddControl",(function(e){const t=r(e.currentTarget);z=M.clone(),z.hover((function(){}),(function(){z.remove()})),z.on("click","li",({target:e})=>{V=!0,W=!0,H=t;const o=r(e).closest("li");A.stopIndex=void 0,Y(o),A.save.call(A),z.remove()}),P.append(z),0==t.index()?z.css({position:"fixed",left:t.offset().left,top:t.offset().top-r(window).scrollTop()}):z.css({position:"fixed",left:t.offset().left-80,top:t.offset().top-r(window).scrollTop()});const o=z.offset().top+z.outerHeight(),n=r(window).scrollTop()+r(window).innerHeight();o>n&&z.css({top:parseInt(z.css("top"))-(o-n)})})),P.on("click touchstart",`.${w.a}copy`,(function(t){t.preventDefault();const o=r(t.target).parent().parent("li"),n=function(t){d.lastID=A.incrementId(d.lastID),ge(t);const o=t.attr("id"),n=t.attr("type"),i=n+"-"+(new Date).getTime(),l=t.clone();r(".fld-name",l).val(i),l.find("[id]").each((e,t)=>{t.id=t.id.replace(o,d.lastID)}),l.find("[for]").each((e,t)=>{const r=t.getAttribute("for").replace(o,d.lastID);t.setAttribute("for",r)});return t.find("select").each((function(e){l.find("select").eq(e).val(r(this).val())})),l.attr("id",d.lastID),l.attr("name",i),l.addClass("cloned"),r(".sortable-options",l).sortable(),e.typeUserEvents[n]&&e.typeUserEvents[n].onclone&&e.typeUserEvents[n].onclone(l[0]),l}(o);!function(e,t){if(!Q())return void e.insertAfter(t);const o=r("#className-"+t.attr("id")),n=xe({}),i=C("div",null,{id:e.attr("id")+"-row",className:`row row-${n.rowNumber} ${j}`}),l=C("div",null,{id:e.attr("id")+"-cont",className:`${A.getBootstrapColumnClass(o.val())} ${k}`});let a;r(l).appendTo(i),t.parent().is("div")?a=t.closest(S):t.parent().is("ul")&&(a=t);r(i).insertAfter(a),e.appendTo(l),he(i),Ne(e.attr("id"))}(n,o),ye(n),A.tmpCleanPrevHolder(n.find(".prev-holder")),e.editOnAdd&&A.closeField(d.lastID,!1)})),P.on("click touchstart",".delete-confirm",t=>{t.preventDefault();const o=t.target.getBoundingClientRect(),n=document.body.getBoundingClientRect(),i={pageX:o.left+o.width/2,pageY:o.top-n.top-12},l=r(t.target).parents(".form-field:eq(0)").attr("id"),a=r(document.getElementById(l));if(document.addEventListener("modalClosed",(function(){a.removeClass("deleting")}),!1),e.fieldRemoveWarn){const e=C("h3",c.a.get("warning")),t=C("p",c.a.get("fieldRemoveWarning"));A.confirm([e,t],()=>A.removeField(l),i),a.addClass("deleting")}else A.removeField(l)});var Ce,je=!1;let ke,qe;function Ee(e,t=!1){const o=e.children("div"+T).length,n=Math.floor(12/o);e.children("div"+T).each((e,o)=>{const i=r("#"+o.id);t||"true"!=i.find("li").attr("manuallyChangedDefaultColumnClass")?A.syncBootstrapColumnWrapperAndClassProperty(o.id.replace("-cont",""),n):A.showToast(`Preserving column size of field ${e+1} because you had personally adjusted it`,4e3)})}function Ne(e){if(e){const t=r("#className-"+e.replace("-cont",""));if(t.val()){const e=A.getRowClass(t.val()),r=A.getRowClass(t.closest(S).attr("class"));t.val(t.val().replace(e,r)),Se()}}}function Se(){P.find(T).each((e,t)=>{const n=r(t);n.is(":empty")&&!o.preserveTempContainers.includes(n.attr("id"))&&n.remove()}),P.children(S).not(B).each((e,t)=>{if(0==r(t).children(T).length){const e=A.getRowValue(r(t).attr("class"));h=h.filter(t=>t!=e),r(t).remove()}else ve(r(t))})}function Te(){return P.find("li").length>0}function De(){if(Te()||!Q())return;const e=xe({}),t=C("div",null,{id:A.incrementId(d.lastID)+"-row",className:`row row-${e.rowNumber} ${j}`});P.append(t),he(t),be(),P.find(B).eq(0).removeClass(N).css({height:P.css("height"),backgroundColor:"transparent"})}function Be(e=!0){if(e)je=!0,A.showToast("Starting Grid Mode - Use the mousewheel to resize.",1500),M.css("display","none"),r(b.formActions).css("display","none"),we(),r(J).html("\n
\n

Grid Mode

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ActionResult
MOUSEWHEELAdjust the field column size
W or ↑Move entire row up
S or ↓Move entire row down
A or ←Move field left within the row
D or →Move field right within the row
RResize all fields within the row to be maximally equal
\n\n
Current Row Fields
\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n
FieldSize
\n \n
\n "),Le(),A.closeAllEdit(),A.toggleHighlight(Ce),pe();else{A.showToast("Grid Mode Finished",1500);const e=Ce.closest(S);let t=0;e.children("div"+T).each((e,o)=>{const n=r("#"+o.id).find("li").attr("id");t+=A.getBootstrapColumnValue(r(`#${n}-cont`).attr("class"))}),t>12&&Ee(e,!0),je=!1,Ce=null,r(J).html(""),M.css("display","unset"),r(b.formActions).css("display","unset")}}function Le(){r(J).find(".gridHelpCurrentRow tbody").empty();Ce.closest(S).children("div"+T).each((e,t)=>{const o=r("#"+t.id).find("li").attr("id"),n=r("#"+o).attr("type");let i=r("#label-"+o).html();"hidden"!=n&&"paragraph"!=n||(i=r("#name-"+o).val()),i||(i=r("#"+o).attr("id"));let l="";Ce.attr("id")==o&&(l="currentGridModeFieldHighlight"),r(J).find(".gridHelpCurrentRow tbody").append(`\n \n ${i}\n \n ${A.getBootstrapColumnValue(r(`#${o}-cont`).attr("class"))}\n \n \n `)})}if(P.on("click touchstart",".grid-button",e=>{e.preventDefault();const t=r(e.target).parents(".form-field:eq(0)").attr("id");Ce=r(document.getElementById(t)),ke=e.pageX,qe=e.pageY,Be()}),P.bind("mousewheel",(function(e){if(je){e.preventDefault();const t=Ce.closest("div"),o=A.getBootstrapColumnValue(t.attr("class"));let n;if(n=e.originalEvent.wheelDelta/120>0?parseInt(o)+1:parseInt(o)-1,n>12)return void A.showToast('Column Size cannot exceed 12');if(n<1)return void A.showToast('Column Size cannot be less than 1');const i=Ce.closest(S);let l=n;if(i.children("div"+T).each((e,t)=>{const o=r("#"+t.id).find("li").attr("id");o!=Ce.attr("id")&&(l+=A.getBootstrapColumnValue(r(`#${o}-cont`).attr("class")))}),l>12)return void A.showToast('There is a maximum of 12 columns per row');A.syncBootstrapColumnWrapperAndClassProperty(Ce.attr("id"),n),Ce.attr("manuallyChangedDefaultColumnClass",!0),Le(),A.toggleHighlight(Ce)}})),r(document).keydown(e=>{if(je){e.preventDefault();const t=Ce.closest(S);87!=e.keyCode&&38!=e.keyCode||function(e){const t=e.prevAll().not(B).first();if(!t.length)return;r(Ce.parent().parent()).swapWith(t);A.toggleHighlight(Ce)}(t),83!=e.keyCode&&40!=e.keyCode||function(e){const t=e.nextAll().not(L).first();if(!t.length)return;r(Ce.parent().parent()).swapWith(t);A.toggleHighlight(Ce)}(t),65!=e.keyCode&&37!=e.keyCode||function(){const e=Ce.parent().prev();e.length&&Ce.parent().after(e);A.toggleHighlight(Ce)}(),68!=e.keyCode&&39!=e.keyCode||function(){const e=Ce.parent().next();e.length&&Ce.parent().before(e);A.toggleHighlight(Ce)}(),82==e.keyCode&&Ee(t,!0),Le(),ve(t)}}),r(document).mousemove(e=>{je&&A.getDistanceBetweenPoints(ke,qe,e.pageX,e.pageY)>m.a.opts.cancelGridModeDistance&&Be(!1)}),r(document).on("checkRowCleanup",(e,t)=>{Se();const o=r("#"+t.rowWrapperID);o.length&&Ee(o,!0),De()}),r(document).on("fieldOpened",(e,t)=>{const o=r("#"+t.rowWrapperID);o.length&&ve(o)}),P.on("click",".style-wrap button",e=>{const t=r(e.target),o=t.closest(".form-elements"),n=t.val(),i=r(".btn-style",o);i.val(n),t.siblings(".btn").removeClass("selected"),t.addClass("selected"),ye(i.closest(".form-field"))}),P.on("click",".fld-required",e=>{r(e.target).closest(".form-field").find(".required-asterisk").toggle()}),P.on("click","input.fld-access",(function(e){const t=r(e.target).closest(".form-field").find(".available-roles"),o=r(e.target);t.slideToggle(250,(function(){o.is(":checked")||r("input[type=checkbox]",t).removeAttr("checked")}))})),P.on("click",".add-opt",(function(e){e.preventDefault();const t=r(e.target).closest(".form-field").attr("type"),o=r(e.target).closest(".field-options"),n=r('[name="multiple"]',o),i=r(".option-selected:eq(0)",o);let l=!1;l=n.length?n.prop("checked"):"checkbox"===i.attr("type");const a=r(".sortable-options",o),s=m.a.opts.onAddOption({selected:!1,label:"",value:""},{type:t,index:a.children().length,isMultiple:l});a.append(Ae(s,l))})),P.on("mouseover mouseout",".remove, .del-button",e=>r(e.target).closest("li").toggleClass("delete")),K(),e.disableInjectedStyle){const e=document.getElementsByClassName("formBuilder-injected-style");Object(p.j)(e,t=>Object(l.f)(e[t]))}return document.dispatchEvent(u.a.loaded),o.actions={getFieldTypes:t=>t?Object(p.B)(I.getRegistered(),e.disableFields):I.getRegistered(),clearFields:e=>A.removeAllFields(b.stage,e),showData:A.showData.bind(A),save:e=>{const t=A.save(e),r=window.JSON.parse(t);return m.a.opts.onSave(r),r},addField:(e,t)=>{A.stopIndex=d.formData.length?t:void 0,Z(e)},removeField:A.removeField.bind(A),getData:A.getFormData.bind(A),setData:e=>{A.stopIndex=void 0,A.removeAllFields(b.stage,!1),K(e)},setLang:e=>{c.a.setCurrent.call(c.a,e).then(()=>{b.stage.dataset.content=c.a.get("getStarted"),I.init(),b.empty(b.formActions),A.formActionButtons().forEach(e=>b.formActions.appendChild(e))})},showDialog:A.dialog.bind(A),toggleFieldEdit:e=>{(Array.isArray(e)?e:[e]).forEach(e=>{["number","string"].includes(typeof e)&&("number"==typeof e?e=b.stage.children[e].id:/^frmb-/.test(e)||(e=b.stage.querySelector(e).id),A.toggleEdit(e))})},toggleAllFieldEdit:()=>{Object(p.j)(b.stage.children,e=>{A.toggleEdit(b.stage.children[e].id)})},closeAllFieldEdit:A.closeAllEdit.bind(A),getCurrentFieldId:()=>d.lastID},b.onRender(b.controls,()=>{const t=setTimeout(()=>{b.stage.style.minHeight=b.controls.clientHeight+"px",e.stickyControls.enable&&A.stickyControls(P),De(),clearTimeout(t)},0)}),o}const F={init:(e,t)=>{const r=jQuery.extend({},m.d,e,!0),{i18n:o}=r,n=x(r,["i18n"]);m.a.opts=n;const i=jQuery.extend({},m.c,o,!0);return F.instance={actions:{getFieldTypes:null,addField:null,clearFields:null,closeAllFieldEdit:null,getData:null,removeField:null,save:null,setData:null,setLang:null,showData:null,showDialog:null,toggleAllFieldEdit:null,toggleFieldEdit:null,getCurrentFieldId:null},markup:p.t,get formData(){return F.instance.actions.getData&&F.instance.actions.getData("json")},promise:new Promise((function(e,r){c.a.init(i).then(()=>{t.each(e=>{const r=new I(n,t[e],jQuery);jQuery(t[e]).data("formBuilder",r),Object.assign(F,r.actions,{markup:p.t}),F.instance.actions=r.actions}),delete F.instance.promise,e(F.instance)}).catch(e=>{r(e),n.notify.error(e)})}))},F.instance}};jQuery.fn.formBuilder=function(e={},...t){if(!("string"==typeof e)){const t=F.init(e,this);return Object.assign(F,t),t}if(F[e])return"function"==typeof F[e]?F[e].apply(this,t):F[e]}}])}(jQuery); \ No newline at end of file diff --git a/vendor/assets/javascripts/form_builder/form-render.min.js b/vendor/assets/javascripts/form_builder/form-render.min.js index 8bd7113a27..8d773de8cd 100644 --- a/vendor/assets/javascripts/form_builder/form-render.min.js +++ b/vendor/assets/javascripts/form_builder/form-render.min.js @@ -1,409 +1,19 @@ /*! - * formBuilder - https://formbuilder.online/ - * Version: 2.1.2 + * jQuery formRender: https://formbuilder.online/ + * Version: 3.8.2 * Author: Kevin Chappell */ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/assets/js/"; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 32); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/* unknown exports provided */ -/* all exports used */ -/*!*****************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control.js ***! - \*****************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _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; }; }();\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nvar _mi18n2 = __webpack_require__(/*! mi18n */ 3);\n\nvar _mi18n3 = _interopRequireDefault(_mi18n2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar control = function () {\n function control(config, preview) {\n _classCallCheck(this, control);\n\n config = $.extend({}, config);\n this.preview = preview;\n delete config.isPreview;\n\n var properties = ['label', 'description', 'subtype', 'required'];\n for (var _iterator = properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var prop = _ref;\n\n this[prop] = config[prop];\n delete config[prop];\n }\n\n if (!config.id) {\n if (config.name) {\n config.id = config.name;\n } else {\n config.id = 'control-' + Math.floor(Math.random() * 10000000 + 1);\n }\n }\n this.id = config.id;\n this.type = config.type;\n if (this.description) {\n config.title = this.description;\n }\n\n if (!control.controlConfig) {\n control.controlConfig = {};\n }\n var classId = this.subtype ? this.type + '.' + this.subtype : this.type;\n this.classConfig = control.controlConfig[classId] || {};\n\n if (this.subtype) {\n config.type = this.subtype;\n }\n\n if (this.required) {\n config['aria-required'] = 'true';\n }\n this.config = config;\n this.configure();\n }\n\n control.register = function register(types, controlClass, parentType) {\n var prefix = parentType ? parentType + '.' : '';\n\n if (!control.classRegister) {\n control.classRegister = {};\n }\n if (!Array.isArray(types)) {\n types = [types];\n }\n\n for (var _iterator2 = types, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray2) {\n if (_i2 >= _iterator2.length) break;\n _ref2 = _iterator2[_i2++];\n } else {\n _i2 = _iterator2.next();\n if (_i2.done) break;\n _ref2 = _i2.value;\n }\n\n var type = _ref2;\n\n if (type.indexOf('.') > -1) {\n control.error('Ignoring type ' + type + '. Cannot use the character \\'.\\' in a type name.');\n continue;\n }\n control.classRegister[prefix + type] = controlClass;\n }\n };\n\n control.getRegistered = function getRegistered() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n var types = Object.keys(control.classRegister);\n if (!types.length) {\n return types;\n }\n return types.filter(function (key) {\n if (type) {\n return key.indexOf(type + '.') > -1;\n }\n return key.indexOf('.') == -1;\n });\n };\n\n control.getRegisteredSubtypes = function getRegisteredSubtypes() {\n var types = {};\n for (var key in control.classRegister) {\n if (control.classRegister.hasOwnProperty(key)) {\n var _key$split = key.split('.'),\n type = _key$split[0],\n subtype = _key$split[1];\n\n if (!subtype) {\n continue;\n }\n if (!types[type]) {\n types[type] = [];\n }\n types[type].push(subtype);\n }\n }\n\n return types;\n };\n\n control.getClass = function getClass(type, subtype) {\n var lookup = subtype ? type + '.' + subtype : type;\n var controlClass = control.classRegister[lookup] || control.classRegister[type];\n if (!controlClass) {\n return control.error('Invalid control type. (Type: ' + type + ', Subtype: ' + subtype + '). Please ensure you have registered it, and imported it correctly.');\n }\n\n return controlClass;\n };\n\n control.loadCustom = function loadCustom(controls) {\n var controlClasses = [];\n if (controls) {\n controlClasses = controlClasses.concat(controls);\n }\n\n if (window.fbControls) {\n controlClasses = controlClasses.concat(window.fbControls);\n }\n\n if (!window.fbControlsLoaded) {\n for (var _iterator3 = controlClasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {\n var _ref3;\n\n if (_isArray3) {\n if (_i3 >= _iterator3.length) break;\n _ref3 = _iterator3[_i3++];\n } else {\n _i3 = _iterator3.next();\n if (_i3.done) break;\n _ref3 = _i3.value;\n }\n\n var loadControl = _ref3;\n\n loadControl(control, control.classRegister);\n }\n window.fbControlsLoaded = true;\n }\n };\n\n control.mi18n = function mi18n(lookup) {\n var def = this.definition;\n var i18n = def.i18n || {};\n var locale = _mi18n3.default.locale;\n i18n = i18n[locale] || i18n.default || i18n;\n var lookupCamel = this.camelCase(lookup);\n\n var value = (typeof i18n === 'undefined' ? 'undefined' : _typeof(i18n)) == 'object' ? i18n[lookupCamel] || i18n[lookup] : i18n;\n if (value) {\n return value;\n }\n\n var mapped = def.mi18n;\n if ((typeof mapped === 'undefined' ? 'undefined' : _typeof(mapped)) === 'object') {\n mapped = mapped[lookupCamel] || mapped[lookup];\n }\n if (!mapped) {\n mapped = lookupCamel;\n }\n return _mi18n3.default.get(mapped);\n };\n\n control.active = function active(type) {\n return !Array.isArray(this.definition.inactive) || this.definition.inactive.indexOf(type) == -1;\n };\n\n control.label = function label(type) {\n return this.mi18n(type);\n };\n\n control.icon = function icon(type) {\n var def = this.definition;\n if (def && _typeof(def.icon) === 'object') {\n return def.icon[type];\n }\n return def.icon;\n };\n\n control.prototype.configure = function configure() {};\n\n control.prototype.build = function build() {\n var _config = this.config,\n label = _config.label,\n type = _config.type,\n data = _objectWithoutProperties(_config, ['label', 'type']);\n\n return this.markup(type, _utils2.default.parsedHtml(label), data);\n };\n\n control.prototype.on = function on(eventType) {\n var _this = this;\n\n var events = {\n prerender: function prerender(element) {},\n\n render: function render(evt) {\n var onRender = function onRender() {\n if (_this.onRender) {\n _this.onRender();\n }\n };\n\n if (_this.css) {\n _utils2.default.getStyles(_this.css);\n }\n if (_this.js && !_utils2.default.isCached(_this.js)) {\n _utils2.default.getScripts(_this.js).done(onRender);\n } else {\n onRender();\n }\n }\n };\n return eventType ? events[eventType] : events;\n };\n\n control.error = function error(message) {\n throw new Error(message);\n };\n\n control.prototype.markup = function markup(tag) {\n var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return _utils2.default.markup(tag, content, attributes);\n };\n\n control.prototype.parsedHtml = function parsedHtml(html) {\n return _utils2.default.parsedHtml(html);\n };\n\n control.camelCase = function camelCase(str) {\n return _utils2.default.camelCase(str);\n };\n\n _createClass(control, null, [{\n key: 'definition',\n get: function get() {\n return {};\n }\n }]);\n\n return control;\n}();\n\nexports.default = control;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC5qcz9iMTFmIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIENPTlRST0wuSlNcbmltcG9ydCB1dGlscyBmcm9tICcuL3V0aWxzJztcbmltcG9ydCBtaTE4biBmcm9tICdtaTE4bic7XG5cbi8qKlxuICogQmFzZSBjbGFzcyBmb3IgYWxsIGNvbnRyb2wgY2xhc3Nlc1xuICogRGVmaW5lcyB0aGUgc3RydWN0dXJlIG9mIGEgY29udHJvbCBjbGFzcyBhbmQgc29tZSBzdGFuZGFyZCBjb250cm9sIG1ldGhvZHNcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbCB7XG5cbiAgLyoqXG4gICAqIGluaXRpYWxpc2UgdGhlIGNvbnRyb2wgb2JqZWN0XG4gICAqIEBwYXJhb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 - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/utils.js ***! - \***************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _dom = __webpack_require__(/*! ./dom */ 2);\n\nfunction _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; }\n\nvar utils = {};\nwindow.fbLoaded = {\n js: [],\n css: []\n};\nwindow.fbEditors = {\n quill: {},\n tinymce: {}\n};\n\nutils.inArray = function (needle, haystack) {\n return haystack.indexOf(needle) !== -1;\n};\n\nutils.trimObj = function (attrs) {\n var xmlRemove = [null, undefined, '', false, 'false'];\n for (var attr in attrs) {\n if (utils.inArray(attrs[attr], xmlRemove)) {\n delete attrs[attr];\n } else if (Array.isArray(attrs[attr])) {\n if (!attrs[attr].length) {\n delete attrs[attr];\n }\n }\n }\n\n return attrs;\n};\n\nutils.validAttr = function (attr) {\n var invalid = ['values', 'enableOther', 'other', 'label', 'subtype'];\n return !utils.inArray(attr, invalid);\n};\n\nutils.attrString = function (attrs) {\n var attributes = [];\n\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr) && utils.validAttr(attr)) {\n attr = utils.safeAttr(attr, attrs[attr]);\n attributes.push(attr.name + attr.value);\n }\n }\n return attributes.join(' ');\n};\n\nutils.safeAttr = function (name, value) {\n name = utils.safeAttrName(name);\n var valString = void 0;\n\n if (value) {\n if (Array.isArray(value)) {\n valString = utils.escapeAttr(value.join(' '));\n } else {\n if (typeof value === 'boolean') {\n value = value.toString();\n }\n valString = utils.escapeAttr(value.replace(',', ' ').trim());\n }\n }\n\n value = value ? '=\"' + valString + '\"' : '';\n return {\n name: name,\n value: value\n };\n};\n\nutils.safeAttrName = function (name) {\n var safeAttr = {\n className: 'class'\n };\n\n return safeAttr[name] || utils.hyphenCase(name);\n};\n\nutils.hyphenCase = function (str) {\n str = str.replace(/[^\\w\\s\\-]/gi, '');\n str = str.replace(/([A-Z])/g, function ($1) {\n return '-' + $1.toLowerCase();\n });\n\n return str.replace(/\\s/g, '-').replace(/^-+/g, '');\n};\n\nutils.camelCase = function (str) {\n return str.replace(/-([a-z])/g, function (m, w) {\n return w.toUpperCase();\n });\n};\n\nutils.contentType = function (content) {\n var type = typeof content === 'undefined' ? 'undefined' : _typeof(content);\n if (content instanceof Node || content instanceof HTMLElement) {\n type = 'node';\n } else if (Array.isArray(content)) {\n type = 'array';\n }\n\n return type;\n};\n\nutils.bindEvents = function (element, events) {\n if (events) {\n var _loop = function _loop(event) {\n if (events.hasOwnProperty(event)) {\n element.addEventListener(event, function (evt) {\n return events[event](evt);\n });\n }\n };\n\n for (var event in events) {\n _loop(event);\n }\n }\n};\n\nutils.nameAttr = function (field) {\n var epoch = new Date().getTime();\n var prefix = field.type || utils.hyphenCase(field.label);\n return prefix + '-' + epoch;\n};\n\nutils.markup = function (tag) {\n var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var contentType = utils.contentType(content);\n\n var events = attributes.events,\n attrs = _objectWithoutProperties(attributes, ['events']);\n\n var field = document.createElement(tag);\n\n var appendContent = {\n string: function string(content) {\n field.innerHTML += content;\n },\n object: function object(config) {\n var tag = config.tag,\n content = config.content,\n data = _objectWithoutProperties(config, ['tag', 'content']);\n\n return field.appendChild(utils.markup(tag, content, data));\n },\n node: function node(content) {\n return field.appendChild(content);\n },\n array: function array(content) {\n for (var i = 0; i < content.length; i++) {\n contentType = utils.contentType(content[i]);\n appendContent[contentType](content[i]);\n }\n },\n function: function _function(content) {\n content = content();\n contentType = utils.contentType(content);\n appendContent[contentType](content);\n },\n undefined: function undefined() {}\n };\n\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n var name = utils.safeAttrName(attr);\n field.setAttribute(name, attrs[attr]);\n }\n }\n\n if (content) {\n appendContent[contentType].call(this, content);\n }\n\n utils.bindEvents(field, events);\n\n return field;\n};\nvar m = utils.markup;\n\nutils.parseAttrs = function (elem) {\n var attrs = elem.attributes;\n var data = {};\n utils.forEach(attrs, function (attr) {\n var attrVal = attrs[attr].value;\n if (attrVal.match(/false|true/g)) {\n attrVal = attrVal === 'true';\n } else if (attrVal.match(/undefined/g)) {\n attrVal = undefined;\n }\n\n if (attrVal) {\n data[attrs[attr].name] = attrVal;\n }\n });\n\n return data;\n};\n\nutils.parseOptions = function (options) {\n var optionData = {};\n var data = [];\n\n for (var i = 0; i < options.length; i++) {\n optionData = utils.parseAttrs(options[i]);\n optionData.label = options[i].textContent;\n data.push(optionData);\n }\n\n return data;\n};\n\nutils.parseXML = function (xmlString) {\n var parser = new window.DOMParser();\n var xml = parser.parseFromString(xmlString, 'text/xml');\n var formData = [];\n\n if (xml) {\n var fields = xml.getElementsByTagName('field');\n for (var i = 0; i < fields.length; i++) {\n var fieldData = utils.parseAttrs(fields[i]);\n var options = fields[i].getElementsByTagName('option');\n\n if (options && options.length) {\n fieldData.values = utils.parseOptions(options);\n }\n\n formData.push(fieldData);\n }\n }\n\n return formData;\n};\n\nutils.parsedHtml = function (html) {\n var escapeElement = document.createElement('textarea');\n escapeElement.innerHTML = html;\n return escapeElement.textContent;\n};\n\nutils.escapeHtml = function (html) {\n var escapeElement = document.createElement('textarea');\n escapeElement.textContent = html;\n return escapeElement.innerHTML;\n};\n\nutils.escapeAttr = function (str) {\n var match = {\n '\"': '"',\n '&': '&',\n '<': '<',\n '>': '>'\n };\n\n var replaceTag = function replaceTag(tag) {\n return match[tag] || tag;\n };\n\n return typeof str === 'string' ? str.replace(/[\"&<>]/g, replaceTag) : str;\n};\n\nutils.escapeAttrs = function (attrs) {\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n attrs[attr] = utils.escapeAttr(attrs[attr]);\n }\n }\n\n return attrs;\n};\n\nutils.forEach = function (array, callback, scope) {\n for (var i = 0; i < array.length; i++) {\n callback.call(scope, i, array[i]);\n }\n};\n\nutils.unique = function (array) {\n return array.filter(function (elem, pos, arr) {\n return arr.indexOf(elem) === pos;\n });\n};\n\nutils.remove = function (val, arr) {\n var index = arr.indexOf(val);\n\n if (index > -1) {\n arr.splice(index, 1);\n }\n};\n\nutils.makeLabel = function (fieldData) {\n var _fieldData$label = fieldData.label,\n label = _fieldData$label === undefined ? '' : _fieldData$label,\n _fieldData$descriptio = fieldData.description,\n description = _fieldData$descriptio === undefined ? '' : _fieldData$descriptio,\n attrs = _objectWithoutProperties(fieldData, ['label', 'description']);\n\n var labelText = utils.parsedHtml(label);\n var labelContents = [labelText];\n\n if (attrs.required) {\n labelContents.push(m('span', ' *', { className: 'fb-required' }));\n }\n\n if (attrs.type !== 'hidden') {\n if (description) {\n labelContents.push(m('span', '?', {\n className: 'tooltip-element',\n tooltip: description\n }));\n }\n }\n\n var labelAttrs = {\n className: 'fb-' + attrs.type + '-label'\n };\n\n if (attrs.id) {\n labelAttrs.for = attrs.id;\n }\n\n return m('label', labelContents, labelAttrs);\n};\n\nutils.templateMap = function (type) {\n var template = void 0;\n var templates = utils.templates;\n for (var _iterator = templates, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref2 = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref2 = _i.value;\n }\n\n var _ref = _ref2;\n var key = _ref[0];\n var value = _ref[1];\n\n if (Array.isArray(key)) {\n if (utils.inArray(type, key)) {\n template = value;\n break;\n }\n } else if (type === key) {\n template = value;\n break;\n }\n }\n\n return template;\n};\n\nutils.autocompleteTemplate = function (fieldData) {\n var values = fieldData.values,\n type = fieldData.type,\n data = _objectWithoutProperties(fieldData, ['values', 'type']);\n\n var keyboardNav = function keyboardNav(e) {\n var list = e.target.nextSibling.nextSibling;\n var activeOption = list.getElementsByClassName('active-option')[0];\n var keyCodeMapVals = [[38, function () {\n if (activeOption) {\n if (activeOption.previousSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.previousSibling;\n activeOption.classList.add('active-option');\n }\n }\n }], [40, function () {\n if (activeOption) {\n if (activeOption.nextSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.nextSibling;\n activeOption.classList.add('active-option');\n }\n } else {\n activeOption = list.firstChild;\n activeOption.classList.add('active-option');\n }\n }], [13, function () {\n if (activeOption) {\n e.target.value = activeOption.innerHTML;\n if (list.style.display === 'none') {\n list.style.display = 'block';\n } else {\n list.style.display = 'none';\n }\n }\n }]];\n var keyCodeMap = new Map(keyCodeMapVals);\n\n var direction = keyCodeMap.get(e.keyCode);\n if (!direction) {\n direction = function direction() {\n return false;\n };\n }\n\n return direction();\n };\n var fauxEvents = {\n focus: function focus(evt) {\n var list = evt.target.nextSibling.nextSibling;\n evt.target.addEventListener('keydown', keyboardNav);\n list.style.display = 'block';\n list.style.width = list.parentElement.offsetWidth + 'px';\n },\n blur: function blur(evt) {\n evt.target.removeEventListener('keydown', keyboardNav);\n setTimeout(function () {\n evt.target.nextSibling.nextSibling.style.display = 'none';\n }, 200);\n },\n input: function input(evt) {\n var list = evt.target.nextSibling.nextSibling;\n (0, _dom.filter)(list.querySelectorAll('li'), evt.target.value);\n if (!evt.target.value) {\n list.style.display = 'none';\n } else {\n list.style.display = 'block';\n }\n }\n };\n var fauxAttrs = Object.assign({}, data, {\n id: data.id + '-input',\n events: fauxEvents\n });\n var hiddenAttrs = Object.assign({}, data, { type: 'hidden' });\n delete fauxAttrs.name;\n var field = [m('input', null, fauxAttrs), m('input', null, hiddenAttrs)];\n\n var options = values.map(function (optionData) {\n var label = optionData.label;\n var config = {\n events: {\n click: function click(evt) {\n var list = evt.target.parentElement;\n var field = list.previousSibling.previousSibling;\n field.value = optionData.label;\n field.previousSibling.value = optionData.value;\n list.style.display = 'none';\n }\n },\n value: optionData.value\n };\n return m('li', label, config);\n });\n\n field.push(m('ul', options, { id: data.id + '-list', className: 'fb-' + type + '-list' }));\n\n var onRender = function onRender(evt) {};\n\n return { field: field, onRender: onRender };\n};\n\nutils.selectTemplate = function (fieldData, isPreview) {\n var options = [];\n\n var values = fieldData.values,\n type = fieldData.type,\n inline = fieldData.inline,\n other = fieldData.other,\n toggle = fieldData.toggle,\n data = _objectWithoutProperties(fieldData, ['values', 'type', 'inline', 'other', 'toggle']);\n\n var attrs = utils.processFieldDataAttrs(data, isPreview);\n var optionType = type.replace('-group', '');\n var isSelect = type === 'select';\n\n if (values) {\n if (attrs.placeholder && isSelect) {\n options.push(m('option', attrs.placeholder, {\n disabled: null,\n selected: null\n }));\n }\n\n for (var i = 0; i < values.length; i++) {\n var _values$i = values[i],\n _values$i$label = _values$i.label,\n label = _values$i$label === undefined ? '' : _values$i$label,\n optionAttrs = _objectWithoutProperties(_values$i, ['label']);\n\n optionAttrs.id = attrs.id + '-' + i;\n if (!optionAttrs.selected || attrs.placeholder) {\n delete optionAttrs.selected;\n }\n\n if (isSelect) {\n var o = m('option', document.createTextNode(label), optionAttrs);\n options.push(o);\n } else {\n var wrapperClass = optionType;\n if (inline) {\n wrapperClass = 'fb-' + optionType + '-inline';\n }\n optionAttrs.type = optionType;\n if (optionAttrs.selected) {\n optionAttrs.checked = 'checked';\n delete optionAttrs.selected;\n }\n var input = m('input', null, Object.assign({}, attrs, optionAttrs));\n var labelAttrs = { for: optionAttrs.id };\n var labelContent = [input, label];\n if (toggle) {\n var kcToggle = m('span');\n labelContent = [input, kcToggle, label];\n labelAttrs.className = 'kc-toggle';\n }\n\n var inputLabel = m('label', labelContent, labelAttrs);\n var wrapper = m('div', inputLabel, { className: wrapperClass });\n options.push(wrapper);\n }\n }\n\n if (!isSelect && other) {\n var otherOptionAttrs = {\n id: attrs.id + '-other',\n className: attrs.className + ' other-option',\n events: {\n click: function click() {\n return utils.otherOptionCB(otherOptionAttrs.id);\n }\n }\n };\n\n var _wrapperClass = optionType;\n if (inline) {\n _wrapperClass += '-inline';\n }\n\n var _optionAttrs = Object.assign({}, data, otherOptionAttrs);\n _optionAttrs.type = optionType;\n\n var otherValAttrs = {\n type: 'text',\n name: data.name,\n id: otherOptionAttrs.id + '-value',\n className: 'other-val'\n };\n var otherInputs = [m('input', null, _optionAttrs), document.createTextNode('Other'), m('input', null, otherValAttrs)];\n var _inputLabel = m('label', otherInputs, { for: _optionAttrs.id });\n var _wrapper = m('div', _inputLabel, { className: _wrapperClass });\n options.push(_wrapper);\n }\n }\n\n var template = void 0;\n\n if (type === 'select') {\n template = m(optionType, options, data);\n } else {\n template = m('div', options, { className: type });\n }\n\n return template;\n};\n\nutils.defaultField = function (fieldData) {\n var label = fieldData.label,\n description = fieldData.description,\n subtype = fieldData.subtype,\n type = fieldData.type,\n id = fieldData.id,\n isPreview = fieldData.isPreview,\n data = _objectWithoutProperties(fieldData, ['label', 'description', 'subtype', 'type', 'id', 'isPreview']);\n\n if (id) {\n if (isPreview) {\n if (data.name) {\n data.name = data.name + '-preview';\n } else {\n data.name = utils.nameAttr(fieldData) + '-preview';\n }\n }\n data.id = data.name;\n }\n if (description) {\n data.title = description;\n }\n if (subtype) {\n type = subtype;\n }\n\n var field = {\n field: m(type, utils.parsedHtml(label), data),\n onRender: utils.noop\n };\n\n return function () {\n return field;\n };\n};\n\nutils.getScripts = function (scriptScr, path) {\n var $ = jQuery;\n var _arr = [];\n\n if (!Array.isArray(scriptScr)) {\n scriptScr = [scriptScr];\n }\n\n if (!utils.isCached(scriptScr)) {\n _arr = $.map(scriptScr, function (src) {\n var options = {\n dataType: 'script',\n cache: true,\n url: (path || '') + src\n };\n return $.ajax(options).done(function () {\n return window.fbLoaded.js.push(src);\n });\n });\n }\n\n _arr.push($.Deferred(function (deferred) {\n return $(deferred.resolve);\n }));\n\n return $.when.apply($, _arr);\n};\n\nutils.isCached = function (src) {\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'js';\n\n var isCached = false;\n var cache = window.fbLoaded[type];\n if (Array.isArray(src)) {\n isCached = src.every(function (s) {\n return utils.inArray(s, cache);\n });\n } else {\n isCached = utils.inArray(src, cache);\n }\n return isCached;\n};\n\nutils.getStyles = function (scriptScr, path) {\n if (utils.isCached(scriptScr, 'css')) {\n return;\n }\n var appendStyle = function appendStyle(href) {\n var link = document.createElement('link');\n link.type = 'text/css';\n link.rel = 'stylesheet';\n link.href = href;\n document.head.appendChild(link);\n window.fbLoaded.css.push(href);\n };\n scriptScr.forEach(function (src) {\n return appendStyle((path || '') + src);\n });\n};\n\nutils.longTextTemplate = function (data) {\n var _data$value = data.value,\n value = _data$value === undefined ? '' : _data$value,\n attrs = _objectWithoutProperties(data, ['value']);\n\n var template = {\n field: m('textarea', utils.parsedHtml(value), attrs)\n };\n var editors = {\n tinymce: {\n js: ['//cdn.tinymce.com/4/tinymce.min.js'],\n onRender: function onRender(evt) {\n if (window.tinymce.editors[data.id]) {\n window.tinymce.editors[data.id].remove();\n }\n window.tinymce.init({\n target: template.field,\n height: 250,\n plugins: ['advlist autolink lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', 'insertdatetime media table contextmenu paste code'],\n toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image'\n });\n }\n },\n quill: {\n js: ['//cdn.quilljs.com/1.1.3/quill.js'],\n css: ['//cdn.quilljs.com/1.1.3/quill.snow.css'],\n onRender: function onRender(evt) {\n var Delta = window.Quill.import('delta');\n window.fbEditors.quill[data.id] = {};\n var editor = window.fbEditors.quill[data.id];\n editor.instance = new window.Quill(template.field, {\n modules: {\n toolbar: [[{ 'header': [1, 2, false] }], ['bold', 'italic', 'underline'], ['code-block']]\n },\n placeholder: attrs.placeholder || '',\n theme: 'snow'\n });\n editor.data = new Delta();\n if (value) {\n editor.instance.setContents(window.JSON.parse(utils.parsedHtml(value)));\n }\n editor.instance.on('text-change', function (delta) {\n editor.data = editor.data.compose(delta);\n });\n }\n }\n };\n\n if (data.type !== 'textarea') {\n template.onRender = editors[data.type].onRender;\n }\n if (data.type === 'quill') {\n template.field = m('div', null, attrs);\n }\n\n var onRender = function onRender() {\n if (editors[data.type]) {\n document.removeEventListener('fieldRendered', onRender);\n\n if (editors[data.type].css) {\n utils.getStyles(editors[data.type].css);\n }\n if (editors[data.type].js && !utils.isCached(editors[data.type].js)) {\n utils.getScripts(editors[data.type].js).done(template.onRender);\n } else {\n template.onRender();\n }\n }\n };\n\n return { field: template.field, onRender: onRender };\n};\n\nutils.templates = [['autocomplete', function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var fieldLabel = utils.makeLabel(fieldData);\n var autocomplete = utils.autocompleteTemplate(attrs);\n var template = {\n field: [fieldLabel, autocomplete.field],\n onRender: autocomplete.onRender\n };\n return template;\n}], [_dom.defaultSubtypes.text.concat(['number', 'file', 'date']), function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var fieldLabel = utils.makeLabel(fieldData);\n var template = {\n field: [fieldLabel, m('input', null, attrs)]\n };\n return template;\n}], [['paragraph'].concat(_dom.defaultSubtypes.paragraph), function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var template = {\n field: [m(fieldData.type, utils.parsedHtml(fieldData.label), attrs)]\n };\n return template;\n}], [_dom.defaultSubtypes.button, function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var template = {\n field: m('button', fieldData.label, attrs)\n };\n return template;\n}], [['select', 'checkbox-group', 'radio-group', 'checkbox'], function (fieldData) {\n var fieldLabel = utils.makeLabel(fieldData);\n var field = utils.selectTemplate(fieldData);\n var template = {\n field: [fieldLabel, field]\n };\n return template;\n}], [['textarea', 'tinymce', 'quill'], function (fieldData) {\n var attrs = utils.processFieldDataAttrs(fieldData);\n var field = utils.longTextTemplate(attrs);\n var fieldLabel = utils.makeLabel(fieldData);\n var template = {\n field: [fieldLabel, field.field],\n onRender: field.onRender\n };\n return template;\n}]];\n\nutils.processFieldDataAttrs = function (fieldData) {\n var subtype = fieldData.subtype,\n attrs = _objectWithoutProperties(fieldData, ['subtype']);\n\n delete attrs.label;\n delete attrs.description;\n\n if (!attrs.id) {\n attrs.id = attrs.name;\n }\n\n if (subtype) {\n attrs.type = subtype;\n }\n\n if (attrs.multiple || attrs.type === 'checkbox-group') {\n attrs.name = attrs.name + '[]';\n }\n\n if (attrs.required) {\n attrs.required = true;\n attrs['aria-required'] = 'true';\n }\n\n return attrs;\n};\n\nutils.getTemplate = function (fieldData) {\n var isPreview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var field = void 0;\n if (isPreview) {\n if (fieldData.name) {\n fieldData.name = fieldData.name + '-preview';\n } else {\n fieldData.name = utils.nameAttr(fieldData) + '-preview';\n }\n }\n var template = utils.templateMap(fieldData.type);\n\n if (template) {\n template = template(fieldData, isPreview);\n } else {\n template = utils.defaultField(fieldData, isPreview)();\n }\n\n if (fieldData.type !== 'hidden') {\n var wrapperAttrs = {};\n if (fieldData.name) {\n wrapperAttrs.className = 'fb-' + fieldData.type + ' form-group field-' + fieldData.name;\n }\n field = utils.markup('div', template.field, wrapperAttrs);\n } else {\n var attrs = utils.processFieldDataAttrs(fieldData);\n field = utils.markup('input', null, attrs);\n }\n\n if (template.onRender) {\n field.addEventListener('fieldRendered', template.onRender);\n }\n\n return field;\n};\n\nutils.otherOptionCB = function (otherId) {\n var otherInput = document.getElementById(otherId);\n var otherInputValue = document.getElementById(otherId + '-value');\n\n if (otherInput.checked) {\n otherInputValue.style.display = 'inline-block';\n } else {\n otherInputValue.style.display = 'none';\n }\n};\n\nutils.capitalize = function (str) {\n return str.replace(/\\b\\w/g, function (m) {\n return m.toUpperCase();\n });\n};\n\nutils.merge = function (obj1, obj2) {\n var mergedObj = Object.assign({}, obj1, obj2);\n for (var prop in obj2) {\n if (mergedObj.hasOwnProperty(prop)) {\n if (Array.isArray(obj2[prop])) {\n mergedObj[prop] = Array.isArray(obj1[prop]) ? utils.unique(obj1[prop].concat(obj2[prop])) : obj2[prop];\n } else if (_typeof(obj2[prop]) === 'object') {\n mergedObj[prop] = utils.merge(obj1[prop], obj2[prop]);\n } else {\n mergedObj[prop] = obj2[prop];\n }\n }\n }\n return mergedObj;\n};\n\nutils.addEventListeners = function (el, evts, fn) {\n return evts.split(' ').forEach(function (e) {\n return el.addEventListener(e, fn, false);\n });\n};\n\nutils.closest = function (el, cls) {\n var className = cls.replace('.', '');\n while ((el = el.parentElement) && !el.classList.contains(className)) {}\n return el;\n};\n\nutils.noop = function () {\n return null;\n};\n\nutils.debounce = function (func) {\n var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;\n var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var timeout = void 0;\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var context = this;\n var later = function later() {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n };\n};\n\nutils.mobileClass = function () {\n var mobileClass = '';\n (function (a) {\n if (/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0, 4))) {\n mobileClass = ' fb-mobile';\n }\n })(navigator.userAgent || navigator.vendor || window.opera);\n return mobileClass;\n};\n\nutils.makeClassName = function (str) {\n return utils.hyphenCase(str.replace(/[^\\w\\s\\-]/gi, ''));\n};\n\nutils.safename = function (str) {\n return str.replace(/\\s/g, '-').replace(/[^a-zA-Z0-9\\[\\]\\_-]/g, '').toLowerCase();\n};\n\nutils.forceNumber = function (str) {\n return str.replace(/[^0-9]/g, '');\n};\n\nexports.default = utils;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvdXRpbHMuanM/M2M5MCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge2RlZmF1bHRTdWJ0eXBlcywgZmlsdGVyfSBmcm9tICcuL2RvbSc7XG5cbi8qKlxuICogQ3Jvc3MgZmlsZSB1dGlsaXRpZXMgZm9yIHdvcmtpbmcgd2l0aCBhcnJheXMsXG4gKiBzb3J0aW5nIGFuZCBvdGhlciBmdW4gc3R1ZmZcbiAqIEByZXR1cm4ge09iamVjdH0gdXRpbHNcbiAqL1xuICBjb25zdCB1dGlscyA9IHt9O1xuICB3aW5kb3cuZmJMb2FkZWQgPSB7XG4gICAganM6IFtdLFxuICAgIGNzczogW11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XJuIGZpZWxkLmFwcGVuZENoaWxkKGNvbnRlbnQpO1xuICAgICAgfSxcbiAgICAgIGFycmF5OiBjb250ZW50ID0+IHtcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBjb250ZW50Lmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgY29udGVudFR5cGUgPSB1dGlscy5jb250ZW50VHlwZShjb250ZW50W2ldKTtcbiAgICAgICAgICBhcHBlbmRDb250ZW50W2NvbnRlbnRUeXBlXShjb250ZW50W2ldKTtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIGZ1bmN0aW9uOiBjb250ZW50ID0+IHtcbiAgICAgICAgY29udGVudCA9IGNvbnRlbnQoKTtcbiAgICAgICAgY29udGVudFR5cGUgPSB1dGlscy5jb250ZW50VHlwZShjb250ZW50KTtcbiAgICAgICAgYXBwZW5kQ29udGVudFtjb250ZW50VHlwZV0oY29udGVudCk7XG4gICAgICB9LFxuICAgICAgdW5kZWZpbmVkOiAoKSA9PiB7XG4gICAgICAgIC8vIGNvbnNvbGUuZXJyb3IodGFnLCBjb250ZW50LCBhdHRyaWJ1dGVzKTtcbiAgICAgIH0sXG4gICAgfTtcblxuICAgIGZvciAobGV0IGF0dHIgaW4gYXR0cnMpIHtcbiAgICAgIGlmIChhdHRycy5oYXNPd25Qcm9wZXJ0eShhdHRyKSkge1xuICAgICAgICBsZXQgbmFtZSA9IHV0aWxzLnNhZmVBdHRyTmFtZShhdHRyKTtcbiAgICAgICAgZmllbGQuc2V0QXR0cmlidXRlKG5hbWUsIGF0dHJzW2F0dHJdKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAoY29udGVudCkge1xuICAgICAgYXBwZW5kQ29udGVudFtjb250ZW50VHlwZV0uY2FsbCh0aGlzLCBjb250ZW50KTtcbiAgICB9XG5cbiAgICB1dGlscy5iaW5kRXZlbnRzKGZpZWxkLCBldmVudHMpO1xuXG4gICAgcmV0dXJuIGZpZWxkO1xuICB9O1xuICBj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xuICAgIGNvbnN0IGtleWJvYXJkTmF2ID0gKGUpID0+IHtcbiAgICAgIGNvbnN0IGxpc3QgPSBlLnRhcmdldC5uZXh0U2libGluZy5uZXh0U2libGluZztcbiAgICAgIGxldCBhY3RpdmVPcHRpb24gPSBsaXN0LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoJ2FjdGl2ZS1vcHRpb24nKVswXTtcbiAgICAgIGNvbnN0IGtleUNvZGVNYXBWYWxzID0gW1xuICAgICAgICAvLyB1cFxuICAgICAgICBbMzgsICgpID0+IHtcbiAgICAgICAgICBpZiAoYWN0aXZlT3B0aW9uKSB7XG4gICAgICAgICAgICBpZiAoYWN0aXZlT3B0aW9uLnByZXZpb3VzU2libGluZykge1xuICAgICAgICAgICAgICBhY3RpdmVPcHRpb24uY2xhc3NMaXN0LnJlbW92ZSgnYWN0aXZlLW9wdGlvbicpO1xuICAgICAgICAgICAgICBhY3RpdmVPcHRpb24gPSBhY3RpdmVPcHRpb24ucHJldmlvdXNTaWJsaW5nO1xuICAgICAgICAgICAgICBhY3RpdmVPcHRpb24uY2xhc3NMaXN0LmFkZCgnYWN0aXZlLW9wdGlvbicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfV0sXG4gICAgICAgIC8vIGRvd25cbiAgICAgICAgWzQwLCAoKSA9PiB7XG4gICAgICAgICAgaWYgKGFjdGl2ZU9wdGlvbikge1xuICAgICAgICAgICAgaWYgKGFjdGl2ZU9wdGlvbi5uZXh0U2libGluZykge1xuICAgICAgICAgICAgICBhY3RpdmVPcHRpb24uY2xhc3NMaXN0LnJlbW92ZSgnYWN0aXZlLW9wdGlvbicpO1xuICAgICAgICAgICAgICBhY3RpdmVPcHRpb24gPSBhY3RpdmVPcHRpb24ubmV4dFNpYmxpbmc7XG4gICAgICAgICAgICAgIGFjdGl2ZU9wdGlvbi5jbGFzc0xpc3QuYWRkKCdhY3RpdmUtb3B0aW9uJyk7XG4gICAgICAgICAgICB9XG4gICAgIC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A9IGAke2F0dHJzLmlkfS0ke2l9YDtcbiAgICAgICAgaWYgKCFvcHRpb25BdHRycy5zZWxlY3RlZCB8fCBhdHRycy5wbGFjZWhvbGRlcikge1xuICAgICAgICAgIGRlbGV0ZSBvcHRpb25BdHRycy5zZWxlY3RlZDtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChpc1NlbGVjdCkge1xuICAgICAgICAgIGxldCBvID0gbSgnb3B0aW9uJywgZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUobGFiZWwpLCBvcHRpb25BdHRycyk7XG4gICAgICAgICAgb3B0aW9ucy5wdXNoKG8pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGxldCB3cmFwcGVyQ2xhc3MgPSBvcHRpb25UeXBlO1xuICAgICAgICAgIGlmIChpbmxpbmUpIHtcbiAgICAgICAgICAgIHdyYXBwZXJDbGFzcyA9IGBmYi0ke29wdGlvblR5cGV9LWlubGluZWA7XG4gICAgICAgICAgfVxuICAgICAgICAgIG9wdGlvbkF0dHJzLnR5cGUgPSBvcHRpb25UeXBlO1xuICAgICAgICAgIGlmIChvcHRpb25BdHRycy5zZWxlY3RlZCkge1xuICAgICAgICAgICAgb3B0aW9uQXR0cnMuY2hlY2tlZCA9ICdjaGVja2VkJztcbiAgICAgICAgICAgIGRlbGV0ZSBvcHRpb25BdHRycy5zZWxlY3RlZDtcbiAgICAgICAgICB9XG4gICAgICAgICAgbGV0IGlucHV0ID0gbSgnaW5wdXQnLCBudWxsLCBPYmplY3QuYXNzaWduKHt9LCBhdHRycywgb3B0aW9uQXR0cnMpKTtcbiAgICAgICAgICBsZXQgbGFiZWxBdHRycyA9IHtmb3I6IG9wdGlvbkF0dHJzLmlkfTtcbiAgICAgICAgICBsZXQgbGFiZWxDb250ZW50ID0gW2lucHV0LCBsYWJlbF07XG4gICAgICAgICAgaWYgKHRvZ2dsZSkge1xuICAgICAgICAgICAgbGV0IGtjVG9nZ2xlID0gbSgnc3BhbicpO1xuICAgICAgICAgICAgbGFiZWxDb250ZW50ID0gW2lucHV0LCBrY1RvZ2dsZSwgbGFiZWxdO1xuICAgICAgICAgICAgbGFiZWxBdHRycy5jbGFzc05hbWUgPSAna2MtdG9nZ2xlJztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBsZXQgaW5wdXRMYWJlbCA9IG0oJ2xhYmVsJywgbGFiZWxDb250ZW50LCBsYWJlbEF0dHJzKTtcbiAgICAgICAgICBsZXQgd3JhcHBlciA9IG0oJ2RpdicsIGlucHV0TGFiZWwsIHtjbGFzc05hbWU6IHdyYXBwZXJDbGFzc30pO1xuICAgICAgICAgIG9wdGlvbnMucHVzaCh3cmFwcGVyKTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAoIWlzU2VsZWN0ICYmIG90aGVyKSB7XG4gICAgICAgIGxldCBvdGhlck9wdGlvbkF0dHJzID0ge1xuICAgICAgICAgIGlkOiBgJHthdHRycy5pZH0tb3RoZXJgLFxuICAgICAgICAgIGNsYXNzTmFtZTogYCR7YXR0cnMuY2xhc3NOYW1lfSBvdGhlci1vcHRpb25gLFxuICAgICAgICAgIGV2ZW50czoge1xuICAgICAgICAgICAgY2xpY2s6ICgpID0+IHV0aWxzLm90aGVyT3B0aW9uQ0Iob3RoZXJPcHRpb25BdHRycy5pZClcbiAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIC8vIGxldCBsYWJlbCA9IG1pMThuLmN1cnJlbnQub3RoZXI7XG4gICAgICAgIGxldCB3cmFwcGVyQ2xhc3MgPSBvcHRpb25UeXBlO1xuICAgICAgICBpZiAoaW5saW5lKSB7XG4gICAgICAgICAgd3JhcHBlckNsYXNzICs9ICctaW5saW5lJztcbiAgICAgICAgfVxuXG4gICAgICAgIGxldCBvcHRpb25BdHRycyA9IE9iamVjdC5hc3NpZ24oe30sIGRhdGEsIG90aGVyT3B0aW9uQXR0cnMpO1xuICAgICAgICBvcHRpb25BdHRycy50eXBlID0gb3B0aW9uVHlwZTtc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lzdCBvdXRkZW50IGluZGVudCB8IGxpbmsgaW1hZ2UnXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBxdWlsbDoge1xuICAgICAgICBqczogWycvL2Nkbi5xdWlsbGpzLmNvbS8xLjEuMy9xdWlsbC5qcyddLFxuICAgICAgICBjc3M6IFsnLy9jZG4ucXVpbGxqcy5jb20vMS4xLjMvcXVpbGwuc25vdy5jc3MnXSxcbiAgICAgICAgb25SZW5kZXI6IGV2dCA9PiB7XG4gICAgICAgICAgY29uc3QgRGVsdGEgPSB3aW5kb3cuUXVpbGwuaW1wb3J0KCdkZWx0YScpO1xuICAgICAgICAgIHdpbmRvdy5mYkVkaXRvcnMucXVpbGxbZGF0YS5pZF0gPSB7fTtcbiAgICAgICAgICBsZXQgZWRpdG9yID0gd2luZG93LmZiRWRpdG9ycy5xdWlsbFtkYXRhLmlkXTtcbiAgICAgICAgICBlZGl0b3IuaW5zdGFuY2UgPSBuZXcgd2luZG93LlF1aWxsKHRlbXBsYXRlLmZpZWxkLCB7XG4gICAgICAgICAgICBtb2R1bGVzOiB7XG4gICAgICAgICAgICAgIHRvb2xiYXI6IFtcbiAgICAgICAgICAgICAgICBbeydoZWFkZXInOiBbMSwgMiwgZmFsc2VdfV0sXG4gICAgICAgICAgICAgICAgWydib2xkJywgJ2l0YWxpYycsICd1bmRlcmxpbmUnXSxcbiAgICAgICAgICAgICAgICBbJ2NvZGUtYmxvY2snXVxuICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcGxhY2Vob2xkZXI6IGF0dHJzLnBsYWNlaG9sZGVyIHx8ICcnLFxuICAgICAgICAgICAgdGhlbWU6ICdzbm93J1xuICAgICAgICAgIH0pO1xuICAgICAgICAgIGVkaXRvci5kYXRhID0gbmV3IERlbHRhKCk7XG4gICAgICAgICAgaWYgKHZhbHVlKSB7XG4gICAgICAgICAgICBlZGl0b3IuaW5zdGFuY2VcbiAgICAgICAg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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQUE7QUFDQTtBQVFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU9BO0FBQ0E7QUFDQTtBQUNBO0FBT0E7QUFDQTtBQUVBO0FBQ0E7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); - -/***/ }), -/* 2 */ -/* unknown exports provided */ -/* all exports used */ -/*!*************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/dom.js ***! - \*************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar instanceDom = exports.instanceDom = {};\nvar defaultSubtypes = exports.defaultSubtypes = {\n text: ['text', 'password', 'email', 'color', 'tel'],\n header: ['h1', 'h2', 'h3'],\n button: ['button', 'submit', 'reset'],\n paragraph: ['p', 'address', 'blockquote', 'canvas', 'output'],\n textarea: ['textarea', 'quill']\n};\n\nvar remove = exports.remove = function remove(element) {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n }\n};\n\nvar empty = exports.empty = function empty(element) {\n while (element.firstChild) {\n element.removeChild(element.firstChild);\n }\n return element;\n};\n\nvar filter = exports.filter = function filter(elems, term) {\n var show = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n var filteredElems = [];\n var toggle = ['none', 'block'];\n\n if (show) {\n toggle = toggle.reverse();\n }\n\n for (var i = elems.length - 1; i >= 0; i--) {\n var txt = elems[i].textContent.toLowerCase();\n if (txt.indexOf(term.toLowerCase()) !== -1) {\n elems[i].style.display = toggle[0];\n filteredElems.push(elems[i]);\n } else {\n elems[i].style.display = toggle[1];\n }\n }\n\n return filteredElems;\n};\n\nvar optionFields = exports.optionFields = ['select', 'checkbox-group', 'checkbox', 'radio-group', 'autocomplete'];\n\nvar optionFieldsRegEx = exports.optionFieldsRegEx = new RegExp('(' + optionFields.join('|') + ')');\n\nvar Dom = function Dom(formID) {\n _classCallCheck(this, Dom);\n\n this.optionFields = optionFields;\n this.optionFieldsRegEx = optionFieldsRegEx;\n\n this.subtypes = defaultSubtypes;\n\n this.empty = empty;\n\n this.filter = filter;\n\n instanceDom[formID] = this;\n return instanceDom[formID];\n};\n\nexports.default = Dom;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvZG9tLmpzPzRmMTQiXSwic291cmNlc0NvbnRlbnQiOlsiXG5leHBvcnQgY29uc3QgaW5zdGFuY2VEb20gPSB7fTtcbmV4cG9ydCBjb25zd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0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUNBO0FBR0E7QUFNQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU1BO0FBQ0E7QUFRQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUEvQkEiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 3 */ -/* unknown exports provided */ -/* all exports used */ -/*!*************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/~/mi18n/dist/mi18n.min.js ***! - \*************************************************************************/ -/***/ (function(module, exports) { - -eval("/*!\n * mi18n - https://github.com/Draggable/mi18n\n * Version: 0.3.4\n * Author: Kevin Chappell (http://kevin-chappell.com)\n */\nmodule.exports=function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,\"a\",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p=\"\",e(e.s=0)}([function(t,e){\"use strict\";function n(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(o,u){try{var i=e[o](u),a=i.value}catch(t){return void n(t)}return i.done?void t(a):Promise.resolve(a).then(function(t){r(\"next\",t)},function(t){r(\"throw\",t)})}return r(\"next\")})}}function r(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}Object.defineProperty(e,\"__esModule\",{value:!0});var o=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},u=function(){function t(t,e){for(var n,r=0;r=this.status){var u=e.processFile(o.responseText);e.langs[t]=u,n(u)}else r({status:this.status,statusText:o.statusText})},o.onerror=function(){r({status:this.status,statusText:o.statusText})},o.send()}})},t.prototype.setCurrent=function(){var t=n(regeneratorRuntime.mark(function t(){var e=0= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlTextarea = function (_control) {\n _inherits(controlTextarea, _control);\n\n function controlTextarea() {\n _classCallCheck(this, controlTextarea);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlTextarea.prototype.build = function build() {\n var _config = this.config,\n _config$value = _config.value,\n value = _config$value === undefined ? '' : _config$value,\n attrs = _objectWithoutProperties(_config, ['value']);\n\n this.field = this.markup('textarea', this.parsedHtml(value), attrs);\n return this.field;\n };\n\n controlTextarea.prototype.on = function on(eventType) {\n var _this2 = this;\n\n if (eventType == 'prerender' && this.preview) {\n return function (element) {\n if (_this2.field) {\n element = _this2.field;\n }\n\n $(element).on('mousedown', function (e) {\n e.stopPropagation();\n });\n };\n }\n return _control.prototype.on.call(this, eventType);\n };\n\n _createClass(controlTextarea, null, [{\n key: 'definition',\n get: function get() {\n return {\n mi18n: {\n textarea: 'textArea'\n }\n };\n }\n }]);\n\n return controlTextarea;\n}(_control3.default);\n\nexports.default = controlTextarea;\n\n_control3.default.register('textarea', controlTextarea);\n_control3.default.register('textarea', controlTextarea, 'textarea');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC90ZXh0YXJlYS5qcz82OTlhIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sIGZyb20gJy4uL2NvbnRyb2wnO1xuXG4vKipcbiAqIFRleHQgaW5wdXQgY2xhc3NcbiAqIE91dHB1dCBhIDxpbnB1dCB0eXBlPVwidGV4dFwiIC4uLiAvPiBmb3JtIGVsZW1lbnRcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbFRleHRhcmVhIGV4dGVuZHMgY29udHJvbCB7XG5cbiAgLyoqXG4gICAqIGNsYXNzIGNvbmZpZ3VyYXRpb25cbiAgICovXG4gIHN0YXRpYyBnZXQgZGVmaW5pdGlvbigpIHtcbiAgICByZXR1cm4ge1xuXG4gICAgICAvLyBtaTE4biBjdXN0b20gbWFwcGluZ3MgKGRlZmF1bHRzIHRvIGNhbWVsQ2FzZSB0eXBlKVxuICAgICAgbWkxOG46IHtcbiAgICAgICAgdGV4dGFyZWE6ICd0ZXh0QXJlYSdcbiAgICAgIH1cbiAgICB9O1xuICB9XG5cbiAgLyoqXG4gICAqIGJ1aWxkIGEgdGV4dCBET00gZWxlbWVudCwgc3VwcG9ydGluZyBvdGhlciBqcXVlcnkgdGV4dCBmb3JtLWNvbnRyb2wnc1xuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICBsZXQge3ZhbHVlID0gJycsIC4uLmF0dHJzfSA9IHRo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RleHRhcmVhLCAndGV4dGFyZWEnKTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvanMvY29udHJvbC90ZXh0YXJlYS5qcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFBQTtBQUNBOzs7Ozs7Ozs7Ozs7O0FBS0E7Ozs7Ozs7OztBQW1CQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU1BO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7OztBQXhDQTtBQUNBO0FBR0E7QUFDQTtBQURBO0FBSEE7QUFPQTs7Ozs7O0FBYkE7QUFDQTtBQStDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); - -/***/ }), -/* 5 */ -/* unknown exports provided */ -/* all exports used */ -/*!************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/custom.js ***! - \************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nvar _mi18n = __webpack_require__(/*! mi18n */ 3);\n\nvar _mi18n2 = _interopRequireDefault(_mi18n);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlCustom = function (_control) {\n _inherits(controlCustom, _control);\n\n function controlCustom() {\n _classCallCheck(this, controlCustom);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlCustom.register = function register(templates) {\n var fields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n if (!controlCustom.def) {\n controlCustom.def = {\n icon: {},\n i18n: {}\n };\n }\n\n controlCustom.templates = templates;\n\n var locale = _mi18n2.default.locale;\n if (!controlCustom.def.i18n[locale]) {\n controlCustom.def.i18n[locale] = {};\n }\n\n for (var _iterator = fields, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var field = _ref;\n\n var type = field.type;\n field.attrs = field.attrs || {};\n if (!type) {\n if (!field.attrs.type) {\n this.error('Ignoring invalid custom field definition. Please specify a type property.');\n continue;\n }\n type = field.attrs.type;\n }\n\n if (!templates[type]) {\n this.error('Error while registering custom field: ' + field + '. Unable to find a related defined template.');\n }\n\n controlCustom.def.i18n[locale][type] = field.label;\n controlCustom.def.icon[type] = field.icon;\n }\n\n _control3.default.register(Object.keys(templates), controlCustom);\n };\n\n controlCustom.prototype.build = function build() {\n var custom = controlCustom.templates[this.type];\n if (!custom) {\n new Error('Invalid custom control type. Please ensure you have registered it correctly as a template option.');\n }\n\n var fieldData = Object.assign(this.config);\n var properties = ['label', 'description', 'subtype', 'id', 'isPreview', 'required', 'title', 'aria-required', 'type'];\n for (var _iterator2 = properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray2) {\n if (_i2 >= _iterator2.length) break;\n _ref2 = _iterator2[_i2++];\n } else {\n _i2 = _iterator2.next();\n if (_i2.done) break;\n _ref2 = _i2.value;\n }\n\n var prop = _ref2;\n\n fieldData[prop] = this.config[prop] || this[prop];\n }\n\n custom = custom.bind(this);\n custom = custom(fieldData);\n\n if (custom.js) {\n this.js = custom.js;\n }\n if (custom.css) {\n this.css = custom.css;\n }\n\n this.onRender = custom.onRender;\n return {\n field: custom.field,\n layout: custom.layout\n };\n };\n\n _createClass(controlCustom, null, [{\n key: 'definition',\n get: function get() {\n return controlCustom.def;\n }\n }]);\n\n return controlCustom;\n}(_control3.default);\n\nexports.default = controlCustom;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC9jdXN0b20uanM/ZTAzYiJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgY29udHJvbCBmcm9tICcuLi9jb250cm9sJztcbmltcG9ydCBtaTE4biBmcm9tICdtaTE4bic7XG5cbi8qKlxuICogU3VwcG9ydCBmb3IgY3VzdG9tIGNvbnRyb2xzXG4gKiBJbXBsZW1lbnRpbmcgc3VwcG9ydCBmb3IgY3VzdG9tIHRlbXBsYXRlcyBiZWluZyBwYXNzZWQgYXMgb3B0aW9ucyB0byBmb3JtQnVpbGRlci9SZW5kZXJ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QUFBQTtBQUFBO0FBQ0E7QUFEQTtBQUNBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBYUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQUE7QUFDQTtBQURBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQURBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBOzs7QUF4Q0E7QUFDQTtBQUNBOzs7Ozs7QUF4REEiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 6 */ -/* unknown exports provided */ -/* all exports used */ -/*!****************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/events.js ***! - \****************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n\nvar events = {\n loaded: new Event('loaded'),\n viewData: new Event('viewData'),\n userDeclined: new Event('userDeclined'),\n modalClosed: new Event('modalClosed'),\n modalOpened: new Event('modalOpened'),\n formSaved: new Event('formSaved'),\n fieldAdded: new Event('fieldAdded'),\n fieldRemoved: new Event('fieldRemoved'),\n fieldRendered: new Event('fieldRendered')\n};\n\nexports.default = events;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvZXZlbnRzLmpzPzg5MDEiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBGb3JtIEJ1aWxkZXIgZXZlbnRzXG4gKiBAcmV0dXJuIHtPYmplY3R9IHZhcmlvdXMgZXZlbnRzIHRvIGJlIHRyaWdnZXJcbiAqL1xuXG5jb25zdCBldmVudHMgPSB7XG4gIGxvYWRlZDogbmV3IEV2ZW50KCdsb2FkZWQnKSxcbiAgdmlld0RhdGE6IG5ldyBFdmVudCgndmlld0RhdGEnKSxcbiAgdXNlckRlY2xpbmVkOiBuZXcgRXZlbnQoJ3VzZXJEZWNsaW5lZCcpLFxuICBtb2RhbENsb3NlZDogbmV3IEV2ZW50KCdtb2RhbENsb3NlZCcpLFxuICBtb2RhbE9wZW5lZDogbmV3IEV2ZW50KCdtb2RhbE9wZW5lZCcpLFxuICBmb3JtU2F2ZWQ6IG5ldyBFdmVudCgnZm9ybVNhdmVkJyksXG4gIGZpZWxkQWRkZWQ6IG5ldyBFdmVudCgnZmllbGRBZGRlZCcpLFxuICBmaWVsZFJlbW92ZWQ6IG5ldyBFdmVudCgnZmllbGRSZW1vdmVkJyksXG4gIGZpZWxkUmVuZGVyZWQ6IG5ldyBFdmVudCgnZmllbGRSZW5kZXJlZCcpXG59O1xuXG5leHBvcnQgZGVmYXVsdCBldmVudHM7XG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9qcy9ldmVudHMuanMiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFLQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQVRBO0FBQ0E7QUFXQSIsInNvdXJjZVJvb3QiOiIifQ=="); - -/***/ }), -/* 7 */ -/* unknown exports provided */ -/* all exports used */ -/*!***********************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/index.js ***! - \***********************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _autocomplete = __webpack_require__(/*! ./autocomplete */ 10);\n\nvar _autocomplete2 = _interopRequireDefault(_autocomplete);\n\nvar _button = __webpack_require__(/*! ./button */ 11);\n\nvar _button2 = _interopRequireDefault(_button);\n\nvar _custom = __webpack_require__(/*! ./custom */ 5);\n\nvar _custom2 = _interopRequireDefault(_custom);\n\nvar _hidden = __webpack_require__(/*! ./hidden */ 12);\n\nvar _hidden2 = _interopRequireDefault(_hidden);\n\nvar _paragraph = __webpack_require__(/*! ./paragraph */ 13);\n\nvar _paragraph2 = _interopRequireDefault(_paragraph);\n\nvar _select = __webpack_require__(/*! ./select */ 14);\n\nvar _select2 = _interopRequireDefault(_select);\n\nvar _text = __webpack_require__(/*! ./text */ 15);\n\nvar _text2 = _interopRequireDefault(_text);\n\nvar _textarea = __webpack_require__(/*! ./textarea */ 4);\n\nvar _textarea2 = _interopRequireDefault(_textarea);\n\nvar _textarea3 = __webpack_require__(/*! ./textarea.tinymce */ 17);\n\nvar _textarea4 = _interopRequireDefault(_textarea3);\n\nvar _textarea5 = __webpack_require__(/*! ./textarea.quill */ 16);\n\nvar _textarea6 = _interopRequireDefault(_textarea5);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = {\n controlAutocomplete: _autocomplete2.default,\n controlButton: _button2.default,\n controlCustom: _custom2.default,\n controlHidden: _hidden2.default,\n controlParagraph: _paragraph2.default,\n controlSelect: _select2.default,\n controlText: _text2.default,\n controlTextarea: _textarea2.default,\n controlTinymce: _textarea4.default,\n controlQuill: _textarea6.default\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvY29udHJvbC9pbmRleC5qcz84M2MyIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sQXV0b2NvbXBsZXRlIGZyb20gJy4vYXV0b2NvbXBsZXRlJztcbmltcG9yd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UNBO0FBQ0E7QUFDQTtBQVZBIiwic291cmNlUm9vdCI6IiJ9"); - -/***/ }), -/* 8 */ -/* unknown exports provided */ -/* all exports used */ -/*!****************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/layout.js ***! - \****************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar layout = function () {\n function layout(templates, preview) {\n var _this = this;\n\n _classCallCheck(this, layout);\n\n this.preview = preview;\n\n this.templates = {\n label: null,\n help: null,\n default: function _default(field, label, help, data) {\n if (help) {\n label.append(help);\n }\n\n var className = data.id ? 'fb-' + data.type + ' form-group field-' + data.id : '';\n return _this.markup('div', [label, field], {\n className: className\n });\n },\n noLabel: function noLabel(field, label, help, data) {\n var className = data.id ? 'fb-' + data.type + ' form-group field-' + data.id : '';\n return _this.markup('div', field, {\n className: className\n });\n },\n hidden: function hidden(field, label, help, data) {\n return field;\n }\n };\n\n if (templates) {\n this.templates = $.extend(this.templates, templates);\n }\n this.configure();\n }\n\n layout.prototype.configure = function configure() {};\n\n layout.prototype.build = function build(renderControl, data) {\n if (this.preview) {\n if (data.name) {\n data.name = data.name + '-preview';\n } else {\n data.name = _utils2.default.nameAttr(data) + '-preview';\n }\n }\n data.id = data.name;\n this.data = $.extend({}, data);\n\n var control = new renderControl(data, this.preview);\n var field = control.build();\n if ((typeof field === 'undefined' ? 'undefined' : _typeof(field)) !== 'object' || !field.field) {\n field = { field: field };\n }\n\n var label = this.label();\n var help = this.help();\n\n var elementTemplate = this.isTemplate(field.layout) ? field.layout : 'default';\n var element = this.processTemplate(elementTemplate, field.field, label, help);\n\n control.on('prerender')(element);\n\n element.addEventListener('fieldRendered', control.on('render'));\n return element;\n };\n\n layout.prototype.label = function label() {\n var label = this.data.label || '';\n var labelText = _utils2.default.parsedHtml(label);\n var labelContents = [labelText];\n if (this.data.required) {\n labelContents.push(this.markup('span', '*', { className: 'required' }));\n }\n\n if (this.isTemplate('label')) {\n return this.processTemplate('label', labelContents);\n }\n\n return this.markup('label', labelContents, {\n for: this.data.id,\n className: 'fb-' + this.data.type + '-label'\n });\n };\n\n layout.prototype.help = function help() {\n if (!this.data.description) {\n return null;\n }\n\n if (this.isTemplate('help')) {\n return this.processTemplate('help', this.data.description);\n }\n\n return this.markup('span', '?', {\n className: 'tooltip-element',\n tooltip: this.data.description\n });\n };\n\n layout.prototype.isTemplate = function isTemplate(template) {\n return typeof this.templates[template] === 'function';\n };\n\n layout.prototype.processTemplate = function processTemplate(template) {\n var _templates;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n var processed = (_templates = this.templates)[template].apply(_templates, args.concat([this.data]));\n if (processed.jquery) {\n processed = processed[0];\n }\n return processed;\n };\n\n layout.prototype.markup = function markup(tag) {\n var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n return _utils2.default.markup(tag, content, attributes);\n };\n\n return layout;\n}();\n\nexports.default = layout;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvanMvbGF5b3V0LmpzPzg3NzkiXSwic291cmNlc0N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QUNBO0FBREE7QUFDQTtBQUFBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBREE7QUFHQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBREE7QUFHQTtBQUNBO0FBRUE7QUFDQTtBQXpCQTtBQUNBO0FBNEJBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFhQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBS0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBO0FBS0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBO0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUFBO0FBQ0E7QUFEQTtBQUFBO0FBQUE7QUFDQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBU0E7QUFBQTtBQUFBO0FBQ0E7QUFBQTtBQUNBO0FBQ0E7Ozs7QUFuTEEiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 9 */ -/* unknown exports provided */ -/* all exports used */ -/*!***********************************!*\ - !*** (webpack)/buildin/global.js ***! - \***********************************/ -/***/ (function(module, exports) { - -eval("var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8od2VicGFjaykvYnVpbGRpbi9nbG9iYWwuanM/MzY5OCJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZztcclxuXHJcbi8vIFRoaXMgd29ya3MgaW4gbm9uLXN0cmljdCBtb2RlXHJcbmcgPSAoZnVuY3Rpb24oKSB7XHJcblx0cmV0dXJuIHRoaXM7XHJcbn0pKCk7XHJcblxyXG50cnkge1xyXG5cdC8vIFRoaXMgd29ya3MgaWYgZXZhbCBpcyBhbGxvd2VkIChzZWUgQ1NQKVxyXG5cdGcgPSBnIHx8IEZ1bmN0aW9uKFwicmV0dXJuIHRoaXNcIikoKSB8fCAoMSxldmFsKShcInRoaXNcIik7XHJcbn0gY2F0Y2goZSkge1xyXG5cdC8vIFRoaXMgd29ya3MgaWYgdGhlIHdpbmRvdyByZWZlcmVuY2UgaXMgYXZhaWxhYmxlXHJcblx0aWYodHlwZW9mIHdpbmRvdyA9PT0gXCJvYmplY3RcIilcclxuXHRcdGcgPSB3aW5kb3c7XHJcbn1cclxuXHJcbi8vIGcgY2FuIHN0aWxsIGJlIHVuZGVmaW5lZCwgYnV0IG5vdGhpbmcgdG8gZG8gYWJvdXQgaXQuLi5cclxuLy8gV2UgcmV0dXJuIHVuZGVmaW5lZCwgaW5zdGVhZCBvZiBub3RoaW5nIGhlcmUsIHNvIGl0J3NcclxuLy8gZWFzaWVyIHRvIGhhbmRsZSB0aGlzIGNhc2UuIGlmKCFnbG9iYWwpIHsgLi4ufVxyXG5cclxubW9kdWxlLmV4cG9ydHMgPSBnO1xyXG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAod2VicGFjaykvYnVpbGRpbi9nbG9iYWwuanNcbi8vIG1vZHVsZSBpZCA9IDlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIDEiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 10 */ -/* unknown exports provided */ -/* all exports used */ -/*!******************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/autocomplete.js ***! - \******************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nvar _dom = __webpack_require__(/*! ../dom */ 2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlAutocomplete = function (_control) {\n _inherits(controlAutocomplete, _control);\n\n function controlAutocomplete() {\n _classCallCheck(this, controlAutocomplete);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlAutocomplete.prototype.build = function build() {\n var _this2 = this;\n\n var _config = this.config,\n values = _config.values,\n type = _config.type,\n data = _objectWithoutProperties(_config, ['values', 'type']);\n\n var keyboardNav = function keyboardNav(e) {\n var list = e.target.nextSibling.nextSibling;\n var activeOption = list.getElementsByClassName('active-option')[0];\n var keyCodeMapVals = [[38, function () {\n if (activeOption) {\n if (activeOption.previousSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.previousSibling;\n activeOption.classList.add('active-option');\n }\n }\n }], [40, function () {\n if (activeOption) {\n if (activeOption.nextSibling) {\n activeOption.classList.remove('active-option');\n activeOption = activeOption.nextSibling;\n activeOption.classList.add('active-option');\n }\n } else {\n activeOption = list.firstChild;\n activeOption.classList.add('active-option');\n }\n }], [13, function () {\n if (activeOption) {\n e.target.value = activeOption.innerHTML;\n if (list.style.display === 'none') {\n list.style.display = 'block';\n } else {\n list.style.display = 'none';\n }\n }\n }]];\n var keyCodeMap = new Map(keyCodeMapVals);\n\n var direction = keyCodeMap.get(e.keyCode);\n if (!direction) {\n direction = function direction() {\n return false;\n };\n }\n\n return direction();\n };\n var fauxEvents = {\n focus: function focus(evt) {\n var list = evt.target.nextSibling.nextSibling;\n evt.target.addEventListener('keydown', keyboardNav);\n list.style.display = 'block';\n list.style.width = list.parentElement.offsetWidth + 'px';\n },\n blur: function blur(evt) {\n evt.target.removeEventListener('keydown', keyboardNav);\n setTimeout(function () {\n evt.target.nextSibling.nextSibling.style.display = 'none';\n }, 200);\n },\n input: function input(evt) {\n var list = evt.target.nextSibling.nextSibling;\n (0, _dom.filter)(list.querySelectorAll('li'), evt.target.value);\n if (!evt.target.value) {\n list.style.display = 'none';\n } else {\n list.style.display = 'block';\n }\n }\n };\n var fauxAttrs = Object.assign({}, data, {\n id: data.id + '-input',\n events: fauxEvents\n });\n var hiddenAttrs = Object.assign({}, data, { type: 'hidden' });\n delete fauxAttrs.name;\n var field = [this.markup('input', null, fauxAttrs), this.markup('input', null, hiddenAttrs)];\n\n var options = values.map(function (optionData) {\n var label = optionData.label;\n var config = {\n events: {\n click: function click(evt) {\n var list = evt.target.parentElement;\n var field = list.previousSibling.previousSibling;\n field.value = optionData.label;\n field.previousSibling.value = optionData.value;\n list.style.display = 'none';\n }\n },\n value: optionData.value\n };\n return _this2.markup('li', label, config);\n });\n\n field.push(this.markup('ul', options, { id: data.id + '-list', className: 'fb-' + type + '-list' }));\n return field;\n };\n\n controlAutocomplete.prototype.onRender = function onRender(evt) {};\n\n return controlAutocomplete;\n}(_control3.default);\n\nexports.default = controlAutocomplete;\n\n_control3.default.register('autocomplete', controlAutocomplete);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvYXV0b2NvbXBsZXRlLmpzPzE1ZTciXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNvbnRyb2wgZnJvbSAnLi4vY29udHJvbCc7XG5pbXBvcnQge2ZpbHRlcn0gZnJvbSAnLi4vZG9tJztcbi8qKlxuICogQXV0b2NvbXBsZXRlIGNsYXNzXG4gKiBPdXRwdXQgYW4gYXV0b2NvbXBsZXRlIGZvcm0gZWxlbWVudFxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBjb250cm9sQXV0b2NvbXBsZXRlIGV4dGVuZHMgY29udHJvbCB7XG5cbiAgLyoqXG4g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QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBckJBO0FBdUJBO0FBRUE7QUFDQTtBQUZBO0FBSUE7QUFDQTtBQUNBO0FBQ0E7QUFJQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBUEE7QUFTQTtBQVZBO0FBWUE7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFLQTtBQUNBOzs7O0FBckhBO0FBQ0E7QUF3SEEiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 11 */ -/* unknown exports provided */ -/* all exports used */ -/*!************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/button.js ***! - \************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlButton = function (_control) {\n _inherits(controlButton, _control);\n\n function controlButton() {\n _classCallCheck(this, controlButton);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlButton.prototype.build = function build() {\n return {\n field: this.markup('button', this.label, this.config),\n layout: 'noLabel'\n };\n };\n\n return controlButton;\n}(_control3.default);\n\nexports.default = controlButton;\n\n_control3.default.register('button', controlButton);\n_control3.default.register(['button', 'submit', 'reset'], controlButton, 'button');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvYnV0dG9uLmpzP2RmM2EiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNvbnRyb2wgZnJvbSAnLi4vY29udHJvbCc7XG5cbi8qKlxuICogQnV0dG9uIGNsYXNzXG4gKiBPdXRwdXQgYSA8YnV0dG9uPkxhYmVsPC9idXR0b24+IGZvcm0gZWxlbWVudFxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBjb250cm9sQnV0dG9uIGV4dGVuZHMgY29udHJvbCB7XG5cbiAgLyoqXG4gICAqIGJ1aWxkIGEgdGV4dCBET00gZWxlbWVudCwgc3VwcG9ydGluZyBvdGhlciBqcXVlcnkgdGV4dCBmb3JtLWNvbnRyb2wnc1xuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICByZXR1cm4ge1xuICAgICAgZmllbGQ6IHRoaXMubWFya3VwKCdidXR0b24nLCB0aGlzLmxhYmVsLCB0aGlzLmNvbmZpZyksXG4gICAgICBsYXlvdXQ6ICdub0xhYmVsJ1xuICAgIH07XG4gIH1cbn1cblxuLy8gcmVnaXN0ZXIgdGhlIGZvbGxvd2luZyBjb250cm9sc1xuY29udHJvbC5yZWdpc3RlcignYnV0dG9uJywgY29udHJvbEJ1dHRvbik7XG5jb250cm9sLnJlZ2lzdGVyKFsnYnV0dG9uJywgJ3N1Ym1pdCcsICdyZXNldCddLCBjb250cm9sQnV0dG9uLCAnYnV0dG9uJyk7XG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2pzL2NvbnRyb2wvYnV0dG9uLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBOzs7Ozs7Ozs7OztBQUtBOzs7Ozs7Ozs7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQUZBO0FBSUE7QUFDQTs7OztBQVpBO0FBQ0E7QUFjQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); - -/***/ }), -/* 12 */ -/* unknown exports provided */ -/* all exports used */ -/*!************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/hidden.js ***! - \************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlHidden = function (_control) {\n _inherits(controlHidden, _control);\n\n function controlHidden() {\n _classCallCheck(this, controlHidden);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlHidden.prototype.build = function build() {\n return {\n field: this.markup('input', null, this.config),\n layout: 'hidden'\n };\n };\n\n return controlHidden;\n}(_control3.default);\n\nexports.default = controlHidden;\n\n_control3.default.register('hidden', controlHidden);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvaGlkZGVuLmpzPzM0Y2QiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNvbnRyb2wgZnJvbSAnLi4vY29udHJvbCc7XG5cbi8qKlxuICogSGlkZGVuIGlucHV0IGNsYXNzXG4gKiBPdXRwdXQgYSA8aW5wdXQgdHlwZT1cImhpZGRlblwiIC4uLiAvPiBmb3JtIGVsZW1lbnRcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbEhpZGRlbiBleHRlbmRzIGNvbnRyb2wge1xuXG4gIC8qKlxuICAgKiBidWlsZCBhIGhpZGRlbiBpbnB1dCBkb20gZWxlbWVudFxuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICByZXR1cm4ge1xuICAgICAgZmllbGQ6IHRoaXMubWFya3VwKCdpbnB1dCcsIG51bGwsIHRoaXMuY29uZmlnKSxcbiAgICAgIGxheW91dDogJ2hpZGRlbidcbiAgICB9O1xuICB9XG59XG5cbi8vIHJlZ2lzdGVyIHRoZSBmb2xsb3dpbmcgY29udHJvbHNcbmNvbnRyb2wucmVnaXN0ZXIoJ2hpZGRlbicsIGNvbnRyb2xIaWRkZW4pO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9qcy9jb250cm9sL2hpZGRlbi5qcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7QUFDQTs7Ozs7Ozs7Ozs7QUFLQTs7Ozs7Ozs7O0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFGQTtBQUlBO0FBQ0E7Ozs7QUFaQTtBQUNBO0FBY0EiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 13 */ -/* unknown exports provided */ -/* all exports used */ -/*!***************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/paragraph.js ***! - \***************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nvar _utils = __webpack_require__(/*! ../utils */ 1);\n\nvar _utils2 = _interopRequireDefault(_utils);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlParagraph = function (_control) {\n _inherits(controlParagraph, _control);\n\n function controlParagraph() {\n _classCallCheck(this, controlParagraph);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlParagraph.prototype.build = function build() {\n var _config = this.config,\n type = _config.type,\n attrs = _objectWithoutProperties(_config, ['type']);\n\n var typeMap = {\n 'paragraph': 'p',\n 'header': this.subtype\n };\n if (typeMap[type]) {\n type = typeMap[type];\n }\n return {\n field: this.markup(type, _utils2.default.parsedHtml(this.label), attrs),\n layout: 'noLabel'\n };\n };\n\n return controlParagraph;\n}(_control3.default);\n\nexports.default = controlParagraph;\n\n_control3.default.register(['paragraph', 'header'], controlParagraph);\n_control3.default.register(['p', 'address', 'blockquote', 'canvas', 'output'], controlParagraph, 'paragraph');\n_control3.default.register(['h1', 'h2', 'h3'], controlParagraph, 'header');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvcGFyYWdyYXBoLmpzPzRhMzEiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNvbnRyb2wgZnJvbSAnLi4vY29udHJvbCc7XG5pbXBvcnQgdXRpbHMgZnJvbSAnLi4vdXRpbHMnO1xuLyoqXG4gKiBUZXh0IGlucHV0IGNsYXNzXG4gKiBPdXRwdXQgYSA8aW5wdXQgdHlwZT1cInRleHRcIiAuLi4gLz4gZm9ybSBlbGVtZW50XG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIGNvbnRyb2xQYXJhZ3JhcGggZXh0ZW5kcyBjb250cm9sIHtcblxuICAvKipcbiAgICogYnVpbGQgYSBwYXJhZ3JhcGggRE9NIGVsZW1lbnRcbiAgICogQHJldHV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7Ozs7Ozs7OztBQUlBOzs7Ozs7Ozs7QUFNQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBR0E7QUFDQTtBQUNBO0FBRkE7QUFJQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFGQTtBQUlBO0FBQ0E7Ozs7QUF0QkE7QUFDQTtBQXdCQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 14 */ -/* unknown exports provided */ -/* all exports used */ -/*!************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/select.js ***! - \************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlSelect = function (_control) {\n _inherits(controlSelect, _control);\n\n function controlSelect() {\n _classCallCheck(this, controlSelect);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlSelect.prototype.build = function build() {\n var _this2 = this;\n\n var options = [];\n\n var _config = this.config,\n values = _config.values,\n value = _config.value,\n placeholder = _config.placeholder,\n type = _config.type,\n inline = _config.inline,\n other = _config.other,\n toggle = _config.toggle,\n data = _objectWithoutProperties(_config, ['values', 'value', 'placeholder', 'type', 'inline', 'other', 'toggle']);\n\n var optionType = type.replace('-group', '');\n var isSelect = type === 'select';\n if (data.multiple || type === 'checkbox-group') {\n data.name = data.name + '[]';\n }\n delete data.title;\n\n if (values) {\n if (placeholder && isSelect) {\n options.push(this.markup('option', placeholder, {\n disabled: null,\n selected: null\n }));\n }\n\n for (var i = 0; i < values.length; i++) {\n var option = values[i];\n if (typeof option === 'string') {\n option = { 'label': option, 'value': option };\n }\n\n var _option = option,\n _option$label = _option.label,\n label = _option$label === undefined ? '' : _option$label,\n optionAttrs = _objectWithoutProperties(_option, ['label']);\n\n optionAttrs.id = data.id + '-' + i;\n\n if (!optionAttrs.selected || placeholder) {\n delete optionAttrs.selected;\n }\n\n if (typeof value !== 'undefined' && optionAttrs.value === value) {\n optionAttrs.selected = true;\n }\n\n if (isSelect) {\n var o = this.markup('option', document.createTextNode(label), optionAttrs);\n options.push(o);\n } else {\n var wrapperClass = optionType;\n if (inline) {\n wrapperClass += '-inline';\n }\n optionAttrs.type = optionType;\n if (optionAttrs.selected) {\n optionAttrs.checked = 'checked';\n delete optionAttrs.selected;\n }\n var input = this.markup('input', null, Object.assign({}, data, optionAttrs));\n var labelAttrs = { for: optionAttrs.id };\n var labelContent = [input, label];\n if (toggle) {\n var kcToggle = this.markup('span');\n labelContent = [input, kcToggle, label];\n labelAttrs.className = 'kc-toggle';\n }\n\n var inputLabel = this.markup('label', labelContent, labelAttrs);\n var wrapper = this.markup('div', inputLabel, { className: wrapperClass });\n options.push(wrapper);\n }\n }\n\n if (!isSelect && other) {\n var otherOptionAttrs = {\n id: data.id + '-other',\n className: data.className + ' other-option',\n events: {\n click: function click() {\n return _this2.otherOptionCB(otherOptionAttrs.id);\n }\n }\n };\n\n var _wrapperClass = optionType;\n if (inline) {\n _wrapperClass += '-inline';\n }\n\n var _optionAttrs = Object.assign({}, data, otherOptionAttrs);\n _optionAttrs.type = optionType;\n\n var otherValAttrs = {\n type: 'text',\n name: data.name,\n id: otherOptionAttrs.id + '-value',\n className: 'other-val'\n };\n var otherInputs = [this.markup('input', null, _optionAttrs), document.createTextNode('Other'), this.markup('input', null, otherValAttrs)];\n var _inputLabel = this.markup('label', otherInputs, { for: _optionAttrs.id });\n var _wrapper = this.markup('div', _inputLabel, { className: _wrapperClass });\n options.push(_wrapper);\n }\n }\n\n if (type == 'select') {\n return this.markup(optionType, options, data);\n } else {\n return this.markup('div', options, { className: type });\n }\n };\n\n controlSelect.prototype.otherOptionCB = function otherOptionCB(otherId) {\n var otherInput = document.getElementById(otherId);\n var otherInputValue = document.getElementById(otherId + '-value');\n\n if (otherInput.checked) {\n otherInputValue.style.display = 'inline-block';\n } else {\n otherInputValue.style.display = 'none';\n }\n };\n\n _createClass(controlSelect, null, [{\n key: 'definition',\n get: function get() {\n return {\n inactive: ['checkbox']\n };\n }\n }]);\n\n return controlSelect;\n}(_control3.default);\n\nexports.default = controlSelect;\n\n_control3.default.register(['select', 'checkbox-group', 'radio-group', 'checkbox'], controlSelect);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvc2VsZWN0L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FDQTs7O0FBdElBO0FBQ0E7QUFDQTtBQURBO0FBR0E7Ozs7OztBQVZBO0FBQ0E7QUE4SUEiLCJzb3VyY2VSb290IjoiIn0="); - -/***/ }), -/* 15 */ -/* unknown exports provided */ -/* all exports used */ -/*!**********************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/text.js ***! - \**********************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _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; }; }();\n\nvar _control2 = __webpack_require__(/*! ../control */ 0);\n\nvar _control3 = _interopRequireDefault(_control2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlText = function (_control) {\n _inherits(controlText, _control);\n\n function controlText() {\n _classCallCheck(this, controlText);\n\n return _possibleConstructorReturn(this, _control.apply(this, arguments));\n }\n\n controlText.prototype.build = function build() {\n return this.markup('input', null, this.config);\n };\n\n _createClass(controlText, null, [{\n key: 'definition',\n get: function get() {\n return {\n mi18n: {\n date: 'dateField',\n file: 'fileUpload'\n }\n };\n }\n }]);\n\n return controlText;\n}(_control3.default);\n\nexports.default = controlText;\n\n_control3.default.register(['text', 'file', 'date', 'number'], controlText);\n_control3.default.register(['text', 'password', 'email', 'color', 'tel'], controlText, 'text');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvdGV4dC5qcz82YWI1Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sIGZyb20gJy4uL2NvbnRyb2wnO1xuXG4vKipcbiAqIFRleHQgaW5wdXQgY2xhc3NcbiAqIE91dHB1dCBhIDxpbnB1dCB0eXBlPVwidGV4dFwiIC4uLiAvPiBmb3JtIGVsZW1lbnRcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbFRleHQgZXh0ZW5kcyBjb250cm9sIHtcblxuICAvKipcbiAgICogY2xhc3MgY29uZmlndXJhdGlvblxuICAgKi9cbiAgc3RhdGljIGdldCBkZWZpbml0aW9uKCkge1xuICAgIHJldHVybiB7XG5cbiAgICAgIC8vIG1pMThuIGN1c3RvbSBtYXBwaW5ncyAoZGVmYXVsdHMgdG8gY2FtZWxDYXNlIHR5cGUpXG4gICAgICBtaTE4bjoge1xuICAgICAgICBkYXRlOiAnZGF0ZUZpZWxkJyxcbiAgICAgICAgZmlsZTogJ2ZpbGVVcGxvYWQnXG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8qKlxuICAgKiBidWlsZCBhIHRleHQgRE9NIGVsZW1lbnQsIHN1cHBvcnRpbmcgb3RoZXIganF1ZXJ5IHRleHQgZm9ybS1jb250cm9sJ3NcbiAgICogQHJldHVybiB7T2JqZWN0fSBET00gRWxlbWVudCB0byBiZSBpbmplY3RlZCBpbnRvIHRoZSBmb3JtLlxuICAgKi9cbiAgYnVpbGQoKSB7XG4gICAgcmV0dXJuIHRoaXMubWFya3VwKCdpbnB1dCcsIG51bGwsIHRoaXMuY29uZmlnKTtcbiAgfVxufVxuXG4vLyByZWdpc3RlciB0aGlzIGNvbnRyb2wgZm9yIHRoZSBmb2xsb3dpbmcgdHlwZXMgJiB0ZXh0IHN1YnR5cGVzXG5jb250cm9sLnJlZ2lzdGVyKFsndGV4dCcsICdmaWxlJywgJ2RhdGUnLCAnbnVtYmVyJ10sIGNvbnRyb2xUZXh0KTtcbmNvbnRyb2wucmVnaXN0ZXIoWyd0ZXh0JywgJ3Bhc3N3b3JkJywgJ2VtYWlsJywgJ2NvbG9yJywgJ3RlbCddLCBjb250cm9sVGV4dCwgJ3RleHQnKTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvanMvY29udHJvbC90ZXh0LmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7OztBQUFBO0FBQ0E7Ozs7Ozs7Ozs7O0FBS0E7Ozs7Ozs7OztBQW9CQTtBQUNBO0FBQ0E7QUFDQTs7O0FBbEJBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7QUFGQTtBQUhBO0FBUUE7Ozs7OztBQWRBO0FBQ0E7QUF5QkE7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ=="); - -/***/ }), -/* 16 */ -/* unknown exports provided */ -/* all exports used */ -/*!********************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/textarea.quill.js ***! - \********************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _textarea = __webpack_require__(/*! ./textarea */ 4);\n\nvar _textarea2 = _interopRequireDefault(_textarea);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlQuill = function (_controlTextarea) {\n _inherits(controlQuill, _controlTextarea);\n\n function controlQuill() {\n _classCallCheck(this, controlQuill);\n\n return _possibleConstructorReturn(this, _controlTextarea.apply(this, arguments));\n }\n\n controlQuill.prototype.configure = function configure() {\n this.js = '//cdn.quilljs.com/1.2.4/quill.js';\n this.css = '//cdn.quilljs.com/1.2.4/quill.snow.css';\n };\n\n controlQuill.prototype.build = function build() {\n var _config = this.config,\n _config$value = _config.value,\n value = _config$value === undefined ? '' : _config$value,\n attrs = _objectWithoutProperties(_config, ['value']);\n\n this.field = this.markup('div', null, attrs);\n return this.field;\n };\n\n controlQuill.prototype.onRender = function onRender(evt) {\n var value = this.config.value || '';\n var Delta = window.Quill.import('delta');\n window.fbEditors.quill[this.id] = {};\n var editor = window.fbEditors.quill[this.id];\n editor.instance = new window.Quill(this.field, {\n modules: {\n toolbar: [[{ 'header': [1, 2, false] }], ['bold', 'italic', 'underline'], ['code-block']]\n },\n placeholder: this.config.placeholder || '',\n theme: 'snow'\n });\n editor.data = new Delta();\n if (value) {\n editor.instance.setContents(window.JSON.parse(this.parsedHtml(value)));\n }\n editor.instance.on('text-change', function (delta) {\n editor.data = editor.data.compose(delta);\n });\n };\n\n return controlQuill;\n}(_textarea2.default);\n\nexports.default = controlQuill;\n\n_textarea2.default.register('quill', controlQuill, 'textarea');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvdGV4dGFyZWEucXVpbGwuanM/NDNjMSJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgY29udHJvbFRleHRhcmVhIGZyb20gJy4vdGV4dGFyZWEnO1xuXG4vKipcbiAqIFF1aWxsIHJpY2ggdGV4dCBlZGl0b3IgZWxlbWVudFxuICogU2VlIGh0dHBzOi8vcXVpbGxqcy5jb20vIGZvciBtb3JlIGluZm9cbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgY29udHJvbFF1aWxsIGV4dGVuZHMgY29udHJvbFRleHRhcmVhIHtcblxuICAvKipcbiAgICogY29uZmlndXJlIHRoZSBxdWlsbCBlZGl0b3IgcmVxdWlyZW1lbnRzXG4gICAqL1xuICBjb25maWd1cmUoKSB7XG4gICAgdGhpcy5qcyA9ICcvL2Nkbi5xdWlsbGpzLmNvbS8xLjIuNC9xdWlsbC5qcyc7XG4gICAgdGhpcy5jc3MgPSAnLy9jZG4ucXVpbGxqcy5jb20vMS4yLjQvcXVpbGwuc25vdy5jc3MnO1xuICB9XG5cbiAgLyoqXG4gICAqIGJ1aWxkIGEgZGl2IERPTSBlbGVtZW50IHRvIGJlIGxhdGVyIHJlcGxhY2VkIHdpdGggdGhlIHF1aWxsIGVkaXRvclxuICAgKiBAcmV0dXJuIHtPYmplY3R9IERPTSBFbGVtZW50IHRvIGJlIGluamVjdGVkIGludG8gdGhlIGZvcm0uXG4gICAqL1xuICBidWlsZCgpIHtcbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh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dGEoKTtcbiAgICBpZiAodmFsdWUpIHtcbiAgICAgIGVkaXRvci5pbnN0YW5jZS5zZXRDb250ZW50cyh3aW5kb3cuSlNPTi5wYXJzZSh0aGlzLnBhcnNlZEh0bWwodmFsdWUpKSk7XG4gICAgfVxuICAgIGVkaXRvci5pbnN0YW5jZS5vbigndGV4dC1jaGFuZ2UnLCBmdW5jdGlvbihkZWx0YSkge1xuICAgICAgZWRpdG9yLmRhdGEgPSBlZGl0b3IuZGF0YS5jb21wb3NlKGRlbHRhKTtcbiAgICB9KTtcbiAgfVxufVxuXG4vLyByZWdpc3RlciBxdWlsbCBhcyBhIHJpY2h0ZXh0IGNvbnRyb2xcbmNvbnRyb2xUZXh0YXJlYS5yZWdpc3RlcigncXVpbGwnLCBjb250cm9sUXVpbGwsICd0ZXh0YXJlYScpO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9qcy9jb250cm9sL3RleHRhcmVhLnF1aWxsLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBOzs7Ozs7Ozs7Ozs7O0FBS0E7Ozs7Ozs7OztBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFLQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFEQTtBQU9BO0FBQ0E7QUFUQTtBQVdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7OztBQWpEQTtBQUNBO0FBbURBIiwic291cmNlUm9vdCI6IiJ9"); - -/***/ }), -/* 17 */ -/* unknown exports provided */ -/* all exports used */ -/*!**********************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/src/js/control/textarea.tinymce.js ***! - \**********************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _textarea = __webpack_require__(/*! ./textarea */ 4);\n\nvar _textarea2 = _interopRequireDefault(_textarea);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nvar controlTinymce = function (_controlTextarea) {\n _inherits(controlTinymce, _controlTextarea);\n\n function controlTinymce() {\n _classCallCheck(this, controlTinymce);\n\n return _possibleConstructorReturn(this, _controlTextarea.apply(this, arguments));\n }\n\n controlTinymce.prototype.configure = function configure() {\n this.js = ['//cdn.tinymce.com/4/tinymce.min.js'];\n\n if (this.classConfig.js) {\n var js = this.classConfig.js;\n if (!Array.isArray(js)) {\n js = new Array(js);\n }\n this.js.concat(js);\n delete this.classConfig.js;\n }\n\n if (this.classConfig.css) {\n this.css = this.classConfig.css;\n }\n\n this.editorOptions = {\n height: 250,\n paste_data_images: true,\n plugins: ['advlist autolink lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', 'insertdatetime media table contextmenu paste code'],\n toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | table'\n };\n };\n\n controlTinymce.prototype.build = function build() {\n var _config = this.config,\n _config$value = _config.value,\n value = _config$value === undefined ? '' : _config$value,\n attrs = _objectWithoutProperties(_config, ['value']);\n\n this.field = this.markup('textarea', this.parsedHtml(value), attrs);\n return this.field;\n };\n\n controlTinymce.prototype.onRender = function onRender(evt) {\n if (window.tinymce.editors[this.id]) {\n window.tinymce.editors[this.id].remove();\n }\n\n var options = $.extend(this.editorOptions, this.classConfig);\n options.target = this.field;\n\n window.tinymce.init(options);\n };\n\n return controlTinymce;\n}(_textarea2.default);\n\nexports.default = controlTinymce;\n\n_textarea2.default.register('tinymce', controlTinymce, 'textarea');//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2pzL2NvbnRyb2wvdGV4dGFyZWEudGlueW1jZS5qcz9kM2M2Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjb250cm9sVGV4dGFyZWEgZnJvbSAnLi90ZXh0YXJlYSc7XG5cbi8qKlxuICogVGlueU1DRSBlZGl0b3IgZWxlbWVudFxuICogU2VlIGh0dHBzOi8vd3d3LnRpbnltY2UuY29tLyBmb3IgbW9yZSBpbmZvXG4gKlxuICogVG8gY3VzdG9taXNlIHRoZSBvcHRpb25zIG9uIHRoaXMgZWRpdG9yLCBzaW1wbHkgcGFzcyBhbnkgcHJvcGVydGllcyB5b3Ugd2lzaCB0byBvdmVyd3JpdGUgaW4gdGhlIGNvbnRyb2xDb25maWcgb3B0aW9uIHRvIGZvcm1SZW5kZXJcbiAqIGUuZy4gdGhlIGJlbG93IGV4YW1wbGUgd291bGQgZGlzYWJsZSB0aGUgYWJpbGl0eSB0byBwYXN0ZSBpbWFnZXMgYXMgYSBiYXNlNjQgZW5jb2RlZCBzcmNcbiAqIGBgYFxuICogdmFyIHJlbmRlck9wdHMgPSB7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0E7QUFDQTtBQUNBO0FBS0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTtBQUVBO0FBQ0E7QUFDQTs7OztBQS9EQTtBQUNBO0FBaUVBIiwic291cmNlUm9vdCI6IiJ9"); - -/***/ }), -/* 18 */ -/* unknown exports provided */ -/* all exports used */ -/*!********************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/~/base64-js/index.js ***! - \********************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction placeHoldersCount (b64) {\n var len = b64.length\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // the number of equal signs (place holders)\n // if there are two placeholders, than the two characters before it\n // represent one byte\n // if there is only one, then the three characters before it represent 2 bytes\n // this is just a cheap hack to not do indexOf twice\n return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n}\n\nfunction byteLength (b64) {\n // base64 is 4/3 + up to two characters of the original data\n return b64.length * 3 / 4 - placeHoldersCount(b64)\n}\n\nfunction toByteArray (b64) {\n var i, j, l, tmp, placeHolders, arr\n var len = b64.length\n placeHolders = placeHoldersCount(b64)\n\n arr = new Arr(len * 3 / 4 - placeHolders)\n\n // if there are placeholders, only get up to the last complete 4 chars\n l = placeHolders > 0 ? len - 4 : len\n\n var L = 0\n\n for (i = 0, j = 0; i < l; i += 4, j += 3) {\n tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n arr[L++] = (tmp >> 16) & 0xFF\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n if (placeHolders === 2) {\n tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[L++] = tmp & 0xFF\n } else if (placeHolders === 1) {\n tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[L++] = (tmp >> 8) & 0xFF\n arr[L++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var output = ''\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n output += lookup[tmp >> 2]\n output += lookup[(tmp << 4) & 0x3F]\n output += '=='\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n output += lookup[tmp >> 10]\n output += lookup[(tmp >> 4) & 0x3F]\n output += lookup[(tmp << 2) & 0x3F]\n output += '='\n }\n\n parts.push(output)\n\n return parts.join('')\n}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vYmFzZTY0LWpzL2luZGV4LmpzPzkyMzUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnXG5cbmV4cG9ydHMuYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGhcbmV4cG9ydHMudG9CeXRlQXJyYXkgPSB0b0J5dGVBcnJheVxuZXhwb3J0cy5mcm9tQnl0ZUFycmF5ID0gZnJvbUJ5dGVBcnJheVxuXG52YXIgbG9va3VwID0gW11cbnZhciByZXZMb29rdXAgPSBbXVxudmFyIEFyciA9IHR5cGVvZiBVaW50OEFycmF5ICE9PSAndW5kZWZpbmVkJyA/IFVpbnQ4QXJyYXkgOiBBcnJheVxuXG52YXIgY29kZSA9ICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvJ1xuZm9yICh2YXIgaSA9IDAsIGxlbiA9IGNvZGUubGVuZ3RoOyBpIDwgbGVuOyArK2kpIHtcbiAgbG9va3VwW2ldID0gY29kZVtpXVxuICByZXZMb29rdXBbY29kZS5jaGFyQ29kZUF0KGkpXSA9IGlcbn1cblxucmV2TG9va3VwWyctJy5jaGFyQ29kZUF0KDApXSA9IDYyXG5yZXZMb29rdXBbJ18nLmNoYXJDb2RlQXQoMCldID0gNjNcblxuZnVuY3Rpb24gcGxhY2VIb2xkZXJzQ291bnQgKGI2NCkge1xuICB2YXIgbGVuID0gYjY0Lmxlbmd0aFxuICBpZiAobGVuICUgNCA+IDApIHtcbi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UNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ=="); - -/***/ }), -/* 19 */ -/* unknown exports provided */ -/* all exports used */ -/*!****************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/~/css-loader/lib/css-base.js ***! - \****************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -eval("/* WEBPACK VAR INJECTION */(function(Buffer) {/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap) {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../node-libs-browser/~/buffer/index.js */ 21).Buffer))//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vY3NzLWxvYWRlci9saWIvY3NzLWJhc2UuanM/YTk1NSJdLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuXHRNSVQgTGljZW5zZSBodHRwOi8vd3d3Lm9wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL21pdC1saWNlbnNlLnBocFxuXHRBdXRob3IgVG9iaWFzIEtvcHBlcnMgQHNva3JhXG4qL1xuLy8gY3NzIGJhc2UgY29kZSwgaW5qZWN0ZWQgYnkgdGhlIGNzcy1sb2FkZXJcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24odXNlU291cmNlTWFwKSB7XG5cdHZhciBsaXN0ID0gW107XG5cblx0Ly8gcmV0dXJuIHRoZSBsaXN0IG9mIG1vZHVsZXMgYXMgY3NzIHN0cmluZ1xuXHRsaXN0LnRvU3RyaW5nID0gZnVuY3Rpb24gdG9TdHJpbmcoKSB7XG5cdFx0cmV0dXJuIHRoaXMubWFwKGZ1bmN0aW9uIChpdGVtKSB7XG5cdFx0XHR2YXIgY29udGVudCA9IGNzc1dpdGhNYXBwaW5nVG9TdHJpbmcoaXRlbSwgdXNlU291cmNlTWFwKTtcblx0XHRcdGlmKGl0ZW1bMl0pIHtcblx0XHRcdFx0cmV0dXJuIFwiQG1lZGlhIFwiICsgaXRlbVsyXSArIFwie1wiICsgY29udGVudCArIFwifVwiO1xuXHRcdFx0fSBlbHNlIHtcblx0XHRcdFx0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tBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QSIsInNvdXJjZVJvb3QiOiIifQ=="); - -/***/ }), -/* 20 */ -/* unknown exports provided */ -/* all exports used */ -/*!******************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/~/ieee754/index.js ***! - \******************************************************************/ -/***/ (function(module, exports) { - -eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = nBytes * 8 - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = (value * c - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vaWVlZTc1NC9pbmRleC5qcz85NzMzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydHMucmVhZCA9IGZ1bmN0aW9uIChidWZmZXIsIG9mZnNldCwgaXNMRSwgbUxlbiwgbkJ5dGVzKSB7XG4gIHZhciBlLCBtXG4gIHZhciBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxXG4gIHZhciBlTWF4ID0gKDEgPDwgZUxlbikgLSAxXG4gIHZhciBlQmlhcyA9IGVNYXggPj4gMVxuICB2YXIgbkJpdHMgPSAtN1xuICB2YXIgaSA9IGlzTEUgPyAobkJ5dGVzIC0gMSkgOiAwXG4gIHZhciBkID0gaXNMRSA/IC0xIDogMVxuICB2YXIgcyA9IGJ1ZmZlcltvZmZzZXQgKyBpXVxuXG4gIGkgKz0gZFxuXG4gIGUgPSBzICYgKCgxIDw8ICgtbkJpdHMpKSAtIDEpXG4gIHMg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In0="); - -/***/ }), -/* 21 */ -/* unknown exports provided */ -/* all exports used */ -/*!*************************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/~/node-libs-browser/~/buffer/index.js ***! - \*************************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(/*! base64-js */ 18)\nvar ieee754 = __webpack_require__(/*! ieee754 */ 20)\nvar isArray = __webpack_require__(/*! isarray */ 22)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 9)))//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vbm9kZS1saWJzLWJyb3dzZXIvfi9idWZmZXIvaW5kZXguanM/ZjliNyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiFcbiAqIFRoZSBidWZmZXIgbW9kdWxlIGZyb20gbm9kZS5qcywgZm9yIHRoZSBicm93c2VyLlxuICpcbiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYW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nQgPSAoZmlyc3RCeXRlICYgMHgxRikgPDwgMHg2IHwgKHNlY29uZEJ5dGUgJiAweDNGKVxuICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAweDdGKSB7XG4gICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWtcbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdXG4gICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXVxuICAgICAgICAgIGlmICgoc2Vjb25kQnl0ZSAmIDB4QzApID09PSAweDgwICYmICh0aGlyZEJ5dGUgJiAweEMwKSA9PT0gMHg4MCkge1xuICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAweEYpIDw8IDB4QyB8IChzZWNvbmRCeXRlICYgMHgzRikgPDwgMHg2IHwgKHRoaXJkQnl0ZSAmIDB4M0YpXG4gICAgICAgICAgICBpZiAodGVtcENvZGVQb2ludCA+IDB4N0ZGICYmICh0ZW1wQ29kZVBvaW50IDwgMHhEODAwIHx8IHRlbXBDb2RlUG9pbnQgPiAweERGRkYpKSB7XG4gICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgYnJlYWtcbiAgICAgICAgY2FzZSA0OlxuICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdXG4gICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXVxuICAgICAgICAgIGZvdXJ0aEJ5dGUgPSBidWZbaSArIDNdXG4gICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMHhDMCkgPT09IDB4ODAgJiYgKHRoaXJkQnl0ZSAmIDB4QzApID09PSAweDgwICYmIChmb3VydGhCeXRlICYgMHhDM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ZGICYmIGNvZGVQb2ludCA8IDB4RTAwMCkge1xuICAgICAgLy8gbGFzdCBjaGFyIHdhcyBhIGxlYWRcbiAgICAgIGlmICghbGVhZFN1cnJvZ2F0ZSkge1xuICAgICAgICAvLyBubyBsZWFkIHlldFxuICAgICAgICBpZiAoY29kZVBvaW50ID4gMHhEQkZGKSB7XG4gICAgICAgICAgLy8gdW5leHBlY3RlZCB0cmFpbFxuICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkgYnl0ZXMucHVzaCgweEVGLCAweEJGLCAweEJEKVxuICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkge1xuICAgICAgICAgIC8vIHVucGFpcmVkIGxlYWRcbiAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgICBjb250aW51ZVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gdmFsaWQgbGVhZFxuICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50XG5cbiAgICAgICAgY29udGludWVcbiAgICAgIH1cblxuICAgICAgLy8gMiBsZWFkcyBpbiBhIHJvd1xuICAgICAgaWYgKGNvZGVQb2ludCA8IDB4REMwMCkge1xuICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IGNvZGVQb2ludFxuICAgICAgICBjb250aW51ZVxuICAgICAgfVxuXG4gICAgICAvLyB2YWxpZCBzdXJyb2dhdGUgcGFpclxuICAgICAgY29kZVBvaW50ID0gKGxlYWRTdXJyb2dhdGUgLSAweEQ4MDAgPDwgMTAgfCBjb2RlUG9pbnQgLSAweERDMDApICsgMHgxMDAwMFxuICAgIH0gZWxzZSBpZiAobGVhZFN1cnJvZ2F0ZSkge1xuICA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FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBIiwic291cmNlUm9vdCI6IiJ9"); - -/***/ }), -/* 22 */ -/* unknown exports provided */ -/* all exports used */ -/*!**************************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/~/node-libs-browser/~/isarray/index.js ***! - \**************************************************************************************/ -/***/ (function(module, exports) { - -eval("var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vL21udC9jL1VzZXJzL2tldmluL1Byb2plY3RzL2Zvcm1CdWlsZGVyL34vbm9kZS1saWJzLWJyb3dzZXIvfi9pc2FycmF5L2luZGV4LmpzPzk1ZjMiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHRvU3RyaW5nID0ge30udG9TdHJpbmc7XG5cbm1vZHVsZS5leHBvcnRzID0gQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbiAoYXJyKSB7XG4gIHJldHVybiB0b1N0cmluZy5jYWxsKGFycikgPT0gJ1tvYmplY3QgQXJyYXldJztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAvbW50L2MvVXNlcnMva2V2aW4vUHJvamVjdHMvZm9ybUJ1aWxkZXIvfi9ub2RlLWxpYnMtYnJvd3Nlci9+L2lzYXJyYXkvaW5kZXguanNcbi8vIG1vZHVsZSBpZCA9IDIyXG4vLyBtb2R1bGUgY2h1bmtzID0gMCAxIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ=="); - -/***/ }), -/* 23 */ -/* unknown exports provided */ -/* all exports used */ -/*!***************************************************************************!*\ - !*** /mnt/c/Users/kevin/Projects/formBuilder/~/style-loader/addStyles.js ***! - \***************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -eval("/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\nvar stylesInDom = {},\n\tmemoize = function(fn) {\n\t\tvar memo;\n\t\treturn function () {\n\t\t\tif (typeof memo === \"undefined\") memo = fn.apply(this, arguments);\n\t\t\treturn memo;\n\t\t};\n\t},\n\tisOldIE = memoize(function() {\n\t\t// Test for IE <= 9 as proposed by Browserhacks\n\t\t// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n\t\t// Tests for existence of standard globals is to allow style-loader \n\t\t// to operate correctly into non-standard environments\n\t\t// @see https://github.com/webpack-contrib/style-loader/issues/177\n\t\treturn window && document && document.all && !window.atob;\n\t}),\n\tgetElement = (function(fn) {\n\t\tvar memo = {};\n\t\treturn function(selector) {\n\t\t\tif (typeof memo[selector] === \"undefined\") {\n\t\t\t\tmemo[selector] = fn.call(this, selector);\n\t\t\t}\n\t\t\treturn memo[selector]\n\t\t};\n\t})(function (styleTarget) {\n\t\treturn document.querySelector(styleTarget)\n\t}),\n\tsingletonElement = null,\n\tsingletonCounter = 0,\n\tstyleElementsInsertedAtTop = [],\n\tfixUrls = __webpack_require__(/*! ./fixUrls */ 24);\n\nmodule.exports = function(list, options) {\n\tif(typeof DEBUG !== \"undefined\" && DEBUG) {\n\t\tif(typeof document !== \"object\") throw new Error(\"The style-loader cannot be used in a non-browser environment\");\n\t}\n\n\toptions = options || {};\n\toptions.attrs = typeof options.attrs === \"object\" ? options.attrs : {};\n\n\t// Force single-tag solution on IE6-9, which has a hard limit on the # of `).attr("id",i).appendTo(e(document.head));window.fbLoaded.css.push(o)}})},D=e=>e.replace(/\b\w/g,(function(e){return e.toUpperCase()})),P=(e,t)=>{const n=Object.assign({},e,t);for(const r in t)n.hasOwnProperty(r)&&(Array.isArray(t[r])?n[r]=Array.isArray(e[r])?S(e[r].concat(t[r])):t[r]:"object"==typeof t[r]?n[r]=P(e[r],t[r]):n[r]=t[r]);return n},N=(e,t,n)=>t.split(" ").forEach(t=>e.addEventListener(t,n,!1)),F=(e,t)=>{const n=t.replace(".","");for(;(e=e.parentElement)&&!e.classList.contains(n););return e},M=()=>{let e="";var t;return t=navigator.userAgent||navigator.vendor||window.opera,/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)&&(e="formbuilder-mobile"),e},B=e=>e.replace(/\s/g,"-").replace(/[^a-zA-Z0-9[\]_-]/g,""),U=e=>e.replace(/[^0-9]/g,""),z=(e,t)=>t.filter((function(e){return!~this.indexOf(e)}),e),I=e=>{const t=(e=Array.isArray(e)?e:[e]).map(({src:e,id:t})=>new Promise(n=>{if(window.fbLoaded.css.includes(e))return n(e);const r=v("link",null,{href:e,rel:"stylesheet",id:t});document.head.insertBefore(r,document.head.firstChild)}));return Promise.all(t)},H=e=>{const t=document.getElementById(e);return t.parentElement.removeChild(t)},$=/^col-(xs|sm|md|lg)-([^\s]+)/,_=e=>e.split(" ").filter(e=>$.test(e)||e.startsWith("row-"));function V(e){const t=["a","an","and","as","at","but","by","for","for","from","in","into","near","nor","of","on","onto","or","the","to","with"].map(e=>`\\s${e}\\s`),n=new RegExp(`(?!${t.join("|")})\\w\\S*`,"g");return(""+e).replace(n,e=>e.charAt(0).toUpperCase()+e.substr(1).replace(/[A-Z]/g,e=>" "+e))}const Q={addEventListeners:N,attrString:d,camelCase:g,capitalize:D,closest:F,getContentType:y,escapeAttr:k,escapeAttrs:e=>{for(const t in e)e.hasOwnProperty(t)&&(e[t]=k(e[t]));return e},escapeHtml:C,forceNumber:U,forEach:E,getScripts:T,getStyles:L,hyphenCase:m,isCached:R,markup:v,merge:P,mobileClass:M,nameAttr:b,parseAttrs:x,parsedHtml:j,parseOptions:w,parseUserData:O,parseXML:q,removeFromArray:A,safeAttr:p,safeAttrName:h,safename:B,subtract:z,trimObj:l,unique:S,validAttr:c,titleCase:V,splitObject:(e,t)=>{const n=e=>(t,n)=>(t[n]=e[n],t);return[Object.keys(e).filter(e=>t.includes(e)).reduce(n(e),{}),Object.keys(e).filter(e=>!t.includes(e)).reduce(n(e),{})]}};e.fn.swapWith=function(t){var n=e(t),r=e("
");return this.before(r),n.before(this),r.before(n).remove(),this};const W=e=>Object.entries(e).reduce((e,[t,n])=>i(i({},e),{},{[t+"Selector"]:"."+n}),{});n.g=Q},function(e,t,n){n.d(t,"a",(function(){return a}));var r=n(0),o=n(2),i=n.n(o);function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class a{constructor(e,t){this.rawConfig=jQuery.extend({},e),e=jQuery.extend({},e),this.preview=t,delete e.isPreview,this.preview&&delete e.required;const n=["label","description","subtype","required","disabled"];for(const t of n)this[t]=e[t],delete e[t];e.id||(e.name?e.id=e.name:e.id="control-"+Math.floor(1e7*Math.random()+1)),this.id=e.id,this.type=e.type,this.description&&(e.title=this.description),a.controlConfig||(a.controlConfig={});const r=this.subtype?this.type+"."+this.subtype:this.type;this.classConfig=jQuery.extend({},a.controlConfig[r]||{}),this.subtype&&(e.type=this.subtype),this.required&&(e.required="required",e["aria-required"]="true"),this.disabled&&(e.disabled="disabled"),this.config=e,this.configure()}static get definition(){return{}}static register(e,t,n){const r=n?n+".":"";a.classRegister||(a.classRegister={}),Array.isArray(e)||(e=[e]);for(const n of e)-1===n.indexOf(".")?a.classRegister[r+n]=t:a.error(`Ignoring type ${n}. Cannot use the character '.' in a type name.`)}static getRegistered(e=!1){const t=Object.keys(a.classRegister);return t.length?t.filter(t=>e?t.indexOf(e+".")>-1:-1==t.indexOf(".")):t}static getRegisteredSubtypes(){const e={};for(const t in a.classRegister)if(a.classRegister.hasOwnProperty(t)){const[n,r]=t.split(".");if(!r)continue;e[n]||(e[n]=[]),e[n].push(r)}return e}static getClass(e,t){const n=t?e+"."+t:e,r=a.classRegister[n]||a.classRegister[e];return r||a.error("Invalid control type. (Type: "+e+", Subtype: "+t+"). Please ensure you have registered it, and imported it correctly.")}static loadCustom(e){let t=[];if(e&&(t=t.concat(e)),window.fbControls&&(t=t.concat(window.fbControls)),!this.fbControlsLoaded){for(const e of t)e(a,a.classRegister);this.fbControlsLoaded=!0}}static mi18n(e,t){const n=this.definition;let r=n.i18n||{};r=r[i.a.locale]||r.default||r;const o=this.camelCase(e),s="object"==typeof r?r[o]||r[e]:r;if(s)return s;let a=n.mi18n;return"object"==typeof a&&(a=a[o]||a[e]),a||(a=o),i.a.get(a,t)}static active(e){return!Array.isArray(this.definition.inactive)||-1==this.definition.inactive.indexOf(e)}static label(e){return this.mi18n(e)}static icon(e){const t=this.definition;return t&&"object"==typeof t.icon?t.icon[e]:t.icon}configure(){}build(){const e=this.config,{label:t,type:n}=e,o=s(e,["label","type"]);return this.markup(n,Object(r.x)(t),o)}on(e){const t={prerender:e=>e,render:e=>{const t=()=>{this.onRender&&this.onRender(e)};this.css&&Object(r.p)(this.css),this.js&&!Object(r.s)(this.js)?Object(r.o)(this.js).done(t):t()}};return e?t[e]:t}static error(e){throw new Error(e)}markup(e,t="",n={}){return this.element=Object(r.t)(e,t,n),this.element}parsedHtml(e){return Object(r.x)(e)}static camelCase(e){return Object(r.d)(e)}}},function(e,t){ +/*! + * mi18n - https://github.com/Draggable/mi18n + * Version: 0.4.7 + * Author: Kevin Chappell (http://kevin-chappell.com) + */ +e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=n(2),i=n(10),s=Object.prototype.toString;function a(e){return"[object Array]"===s.call(e)}function l(e){return null!==e&&"object"===(void 0===e?"undefined":r(e))}function c(e){return"[object Function]"===s.call(e)}function u(e,t){if(null!=e)if("object"!==(void 0===e?"undefined":r(e))&&(e=[e]),a(e))for(var n=0,o=e.length;n=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){a.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){a.headers[e]=r.merge(i)})),e.exports=a}).call(this,n(12))},function(e,t,n){e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r0&&void 0!==arguments[0]?arguments[0]:s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.langs=Object.create(null),this.loaded=[],this.processConfig(t)}return e.prototype.processConfig=function(e){var t=this,n=Object.assign({},s,e),r=n.location,o=function(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}(n,["location"]),i=r.replace(/\/?$/,"/");this.config=Object.assign({},{location:i},o);var a=this.config,l=a.override,c=a.preloaded,u=void 0===c?{}:c,d=Object.entries(this.langs).concat(Object.entries(l||u));this.langs=d.reduce((function(e,n){var r=n[0],o=n[1];return e[r]=t.applyLanguage.call(t,r,o),e}),{}),this.locale=this.config.locale||this.config.langs[0]},e.prototype.init=function(e){return this.processConfig.call(this,Object.assign({},this.config,e)),this.setCurrent(this.locale)},e.prototype.addLanguage=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t="string"==typeof t?this.processFile.call(this,t):t,this.applyLanguage.call(this,e,t),this.config.langs.push("locale")},e.prototype.getValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.locale;return this.langs[t]&&this.langs[t][e]||this.getFallbackValue(e)},e.prototype.getFallbackValue=function(e){var t=Object.values(this.langs).find((function(t){return t[e]}));return t&&t[e]},e.prototype.makeSafe=function(e){var t={"{":"\\{","}":"\\}","|":"\\|"};return e=e.replace(/\{|\}|\|/g,(function(e){return t[e]})),new RegExp(e,"g")},e.prototype.put=function(e,t){return this.current[e]=t},e.prototype.get=function(e,t){var n=this.getValue(e);if(n){var o=n.match(/\{[^}]+?\}/g),i=void 0;if(t&&o)if("object"===(void 0===t?"undefined":r(t)))for(var s=0;s1&&void 0!==arguments[1])||arguments[1],n=this;return new Promise((function(r,o){if(-1!==n.loaded.indexOf(e)&&t)return n.applyLanguage.call(n,n.langs[e]),r(n.langs[e]);var s=[n.config.location,e,n.config.extension].join("");return(0,i.get)(s).then((function(t){var o=t.data,i=n.processFile(o);return n.applyLanguage.call(n,e,i),n.loaded.push(e),r(n.langs[e])})).catch((function(){var t=n.applyLanguage.call(n,e);r(t)}))}))},e.prototype.applyLanguage=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.config.override[e]||{},r=this.langs[e]||{};return this.langs[e]=Object.assign({},r,t,n),this.langs[e]},e.prototype.setCurrent=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en-US";return this.loadLang(t).then((function(){return e.locale=t,e.current=e.langs[t],e.current}))},o(e,[{key:"getLangs",get:function(){return this.config.langs}}]),e}();t.default=new a},function(e,t,n){e.exports=n(9)},function(e,t,n){var r=n(0),o=n(2),i=n(11),s=n(1);function a(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var l=a(s);l.Axios=i,l.create=function(e){return a(r.merge(s,e))},l.Cancel=n(6),l.CancelToken=n(26),l.isCancel=n(5),l.all=function(e){return Promise.all(e)},l.spread=n(27),e.exports=l,e.exports.default=l},function(e,t,n){ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(r(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&r(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,n){var r=n(1),o=n(0),i=n(21),s=n(22);function a(e){this.defaults=e,this.interceptors={request:new i,response:new i}}a.prototype.request=function(e){"string"==typeof e&&(e=o.merge({url:arguments[0]},arguments[1])),(e=o.merge(r,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[s,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},o.forEach(["delete","get","head","options"],(function(e){a.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))}})),o.forEach(["post","put","patch"],(function(e){a.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))}})),e.exports=a},function(e,t,n){var r,o,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var c,u=[],d=!1,p=-1;function f(){d&&c&&(d=!1,c.length?u=c.concat(u):p=-1,u.length&&h())}function h(){if(!d){var e=l(f);d=!0;for(var t=u.length;t;){for(c=u,u=[];++p1)for(var n=1;n=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){var r=n(0);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){function r(){this.message="String contains an invalid character"}r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=function(e){for(var t,n,o=String(e),i="",s=0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.charAt(0|s)||(a="=",s%1);i+=a.charAt(63&t>>8-s%1*8)){if((n=o.charCodeAt(s+=.75))>255)throw new r;t=t<<8|n}return i}},function(e,t,n){var r=n(0);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){var r=n(0);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},function(e,t,n){var r=n(0),o=n(23),i=n(5),s=n(1),a=n(24),l=n(25);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!a(e.url)&&(e.url=l(e.baseURL,e.url)),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return c(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(c(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){var r=n(0);e.exports=function(e,t,n){return r.forEach(n,(function(n){e=n(e,t)})),e}},function(e,t,n){e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){var r=n(6);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,n){e.exports=function(e){return function(t){return e.apply(null,t)}}}])},function(e,t,n){n.d(t,"d",(function(){return i})),n.d(t,"g",(function(){return s})),n.d(t,"c",(function(){return a})),n.d(t,"a",(function(){return l})),n.d(t,"f",(function(){return c})),n.d(t,"e",(function(){return u})),n.d(t,"b",(function(){return d}));var r=n(2);const o=()=>null;n.n(r).a.addLanguage("en-US",{NATIVE_NAME:"English (US)",ENGLISH_NAME:"English",addOption:"Add Option +",allFieldsRemoved:"All fields were removed.",allowMultipleFiles:"Allow users to upload multiple files",autocomplete:"Autocomplete",button:"Button",cannotBeEmpty:"This field cannot be empty",checkboxGroup:"Checkbox Group",checkbox:"Checkbox",checkboxes:"Checkboxes",className:"Class",clearAllMessage:"Are you sure you want to clear all fields?",clear:"Clear",close:"Close",content:"Content",copy:"Copy To Clipboard",copyButton:"+",copyButtonTooltip:"Copy",dateField:"Date Field",description:"Help Text",descriptionField:"Description",devMode:"Developer Mode",editNames:"Edit Names",editorTitle:"Form Elements",editXML:"Edit XML",enableOther:"Enable "Other"",enableOtherMsg:"Let users enter an unlisted option",fieldDeleteWarning:"false",fieldVars:"Field Variables",fieldNonEditable:"This field cannot be edited.",fieldRemoveWarning:"Are you sure you want to remove this field?",fileUpload:"File Upload",formUpdated:"Form Updated",getStarted:"Drag a field from the right to this area",header:"Header",hide:"Edit",hidden:"Hidden Input",inline:"Inline",inlineDesc:"Display {type} inline",label:"Label",labelEmpty:"Field Label cannot be empty",limitRole:"Limit access to one or more of the following roles:",mandatory:"Mandatory",maxlength:"Max Length",minOptionMessage:"This field requires a minimum of 2 options",minSelectionRequired:"Minimum {min} selections required",multipleFiles:"Multiple Files",name:"Name",no:"No",noFieldsToClear:"There are no fields to clear",number:"Number",off:"Off",on:"On",option:"Option",optionCount:"Option {count}",options:"Options",optional:"optional",optionLabelPlaceholder:"Label",optionValuePlaceholder:"Value",optionEmpty:"Option value required",other:"Other",paragraph:"Paragraph",placeholder:"Placeholder","placeholders.value":"Value","placeholders.label":"Label","placeholders.email":"Enter your email","placeholders.className":"space separated classes","placeholders.password":"Enter your password",preview:"Preview",radioGroup:"Radio Group",radio:"Radio",removeMessage:"Remove Element",removeOption:"Remove Option",remove:"×",required:"Required",requireValidOption:"Only accept a pre-defined Option",richText:"Rich Text Editor",roles:"Access",rows:"Rows",save:"Save",selectOptions:"Options",select:"Select",selectColor:"Select Color",selectionsMessage:"Allow Multiple Selections",size:"Size","size.xs":"Extra Small","size.sm":"Small","size.m":"Default","size.lg":"Large",style:"Style","styles.btn.default":"Default","styles.btn.danger":"Danger","styles.btn.info":"Info","styles.btn.primary":"Primary","styles.btn.success":"Success","styles.btn.warning":"Warning",subtype:"Type",text:"Text Field",textArea:"Text Area",toggle:"Toggle",warning:"Warning!",value:"Value",viewJSON:"[{…}]",viewXML:"</>",yes:"Yes"});const i={actionButtons:[],allowStageSort:!0,append:!1,controlOrder:["autocomplete","button","checkbox-group","checkbox","date","file","header","hidden","number","paragraph","radio-group","select","text","textarea"],controlPosition:"right",dataType:"json",defaultFields:[],disabledActionButtons:[],disabledAttrs:[],disabledFieldButtons:{},disabledSubtypes:{},disableFields:[],disableHTMLLabels:!1,disableInjectedStyle:!1,editOnAdd:!1,fields:[],fieldRemoveWarn:!1,fieldEditContainer:null,inputSets:[],notify:{error:e=>{console.log(e)},success:e=>{console.log(e)},warning:e=>{console.warn(e)}},onAddField:(e,t)=>t,onAddFieldAfter:(e,t)=>t,onAddOption:e=>e,onClearAll:o,onCloseFieldEdit:o,onOpenFieldEdit:o,onSave:o,persistDefaultFields:!1,prepend:!1,replaceFields:[],roles:{1:"Administrator"},scrollToFieldOnAdd:!0,showActionButtons:!0,sortableControls:!1,stickyControls:{enable:!0,offset:{top:5,bottom:"auto",right:"auto"}},subtypes:{},templates:{},typeUserAttrs:{},typeUserDisabledAttrs:{},typeUserEvents:{},defaultGridColumnClass:"col-md-12",cancelGridModeDistance:100,enableColumnInsertMenu:!1,enableEnhancedBootstrapGrid:!1},s={btn:["default","danger","info","primary","success","warning"]},a={location:"assets/lang/"},l={},c={rowWrapperClass:"rowWrapper",colWrapperClass:"colWrapper",tmpColWrapperClass:"tempColWrapper",tmpRowPlaceholderClass:"tempRowWrapper",invisibleRowPlaceholderClass:"invisibleRowPlaceholder"},u=333,d="li.form-field"},function(e,t,n){n.d(t,"d",(function(){return r})),n.d(t,"f",(function(){return i})),n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return a})),n.d(t,"e",(function(){return l})),n.d(t,"a",(function(){return u}));const r={},o={text:["text","password","email","color","tel"],header:["h1","h2","h3"],button:["button","submit","reset"],paragraph:["p","address","blockquote","canvas","output"],textarea:["textarea","quill"]},i=e=>{e.parentNode&&e.parentNode.removeChild(e)},s=e=>{for(;e.firstChild;)e.removeChild(e.firstChild);return e},a=(e,t,n=!0)=>{const r=[];let o=["none","block"];n&&(o=o.reverse());for(let n=e.length-1;n>=0;n--){-1!==e[n].textContent.toLowerCase().indexOf(t.toLowerCase())?(e[n].style.display=o[0],r.push(e[n])):e[n].style.display=o[1]}return r},l=["select","checkbox-group","checkbox","radio-group","autocomplete"],c=new RegExp(`(${l.join("|")})`);class u{constructor(e){return this.optionFields=l,this.optionFieldsRegEx=c,this.subtypes=o,this.empty=s,this.filter=a,r[e]=this,r[e]}onRender(e,t){e.parentElement?t(e):window.requestAnimationFrame(()=>this.onRender(e,t))}}},function(e,t,n){function r(e){let t;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event"),t.initEvent(e,!0,!0)),t}const o={loaded:r("loaded"),viewData:r("viewData"),userDeclined:r("userDeclined"),modalClosed:r("modalClosed"),modalOpened:r("modalOpened"),formSaved:r("formSaved"),fieldAdded:r("fieldAdded"),fieldRemoved:r("fieldRemoved"),fieldRendered:r("fieldRendered"),fieldEditOpened:r("fieldEditOpened"),fieldEditClosed:r("fieldEditClosed")};t.a=o},function(e,t,n){n.d(t,"a",(function(){return s}));var r=n(1),o=n(2),i=n.n(o);class s extends r.a{static register(e={},t=[]){s.customRegister={},s.def||(s.def={icon:{},i18n:{}}),s.templates=e;const n=i.a.locale;s.def.i18n[n]||(s.def.i18n[n]={}),r.a.register(Object.keys(e),s);for(const o of t){let t=o.type;if(o.attrs=o.attrs||{},!t){if(!o.attrs.type){this.error("Ignoring invalid custom field definition. Please specify a type property.");continue}t=o.attrs.type}let i=o.subtype||t;if(!e[t]){const e=r.a.getClass(t,o.subtype);if(!e){this.error("Error while registering custom field: "+t+(o.subtype?":"+o.subtype:"")+". Unable to find any existing defined control or template for rendering.");continue}i=o.datatype?o.datatype:`${t}-${Math.floor(9e3*Math.random()+1e3)}`,s.customRegister[i]=jQuery.extend(o,{type:t,class:e})}s.def.i18n[n][i]=o.label,s.def.icon[i]=o.icon}}static getRegistered(e=!1){return e?r.a.getRegistered(e):Object.keys(s.customRegister)}static lookup(e){return s.customRegister[e]}static get definition(){return s.def}build(){let e=s.templates[this.type];if(!e)return this.error("Invalid custom control type. Please ensure you have registered it correctly as a template option.");const t=Object.assign(this.config),n=["label","description","subtype","id","isPreview","required","title","aria-required","type"];for(const e of n)t[e]=this.config[e]||this[e];return e=e.bind(this),e=e(t),e.js&&(this.js=e.js),e.css&&(this.css=e.css),this.onRender=e.onRender,{field:e.field,layout:e.layout}}}s.customRegister={}},,function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(l," */")),i=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return[n].concat(i).concat([o]).join("\n")}var s,a,l;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i{let n=e.id?`formbuilder-${e.type} form-group field-${e.id}`:"";if(e.className){const o=Object(r.m)(e.className);o&&o.length>0&&(n+=" "+o.join(" ")),t.classList&&t.classList.remove(...o)}return n};class i{constructor(e,t){this.preview=t,this.templates={label:null,help:null,default:(e,t,n,r)=>(n&&t.appendChild(n),this.markup("div",[t,e],{className:o(r,e)})),noLabel:(e,t,n,r)=>this.markup("div",e,{className:o(r,e)}),hidden:e=>e},e&&(this.templates=jQuery.extend(this.templates,e)),this.configure()}configure(){}build(e,t,n){this.preview&&(t.name?t.name=t.name+"-preview":t.name=r.g.nameAttr(t)+"-preview"),t.id=t.name,this.data=jQuery.extend({},t);const o=new e(t,this.preview);let i=o.build();"object"==typeof i&&i.field||(i={field:i});const s=this.label(),a=this.help();let l;l=n&&this.isTemplate(n)?n:this.isTemplate(i.layout)?i.layout:"default";const c=this.processTemplate(l,i.field,s,a);return o.on("prerender")(c),c.addEventListener("fieldRendered",o.on("render")),c}label(){const e=this.data.label||"",t=[r.g.parsedHtml(e)];return this.data.required&&t.push(this.markup("span","*",{className:"formbuilder-required"})),this.isTemplate("label")?this.processTemplate("label",t):this.markup("label",t,{for:this.data.id,className:`formbuilder-${this.data.type}-label`})}help(){return this.data.description?this.isTemplate("help")?this.processTemplate("help",this.data.description):this.markup("span","?",{className:"tooltip-element",tooltip:this.data.description}):null}isTemplate(e){return"function"==typeof this.templates[e]}processTemplate(e,...t){let n=this.templates[e](...t,this.data);return n.jquery&&(n=n[0]),n}markup(e,t="",n={}){return r.g.markup(e,t,n)}}},,function(t,n,r){var o=r(1),i=r(4);function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class a extends o.a{static get definition(){return{mi18n:{requireValidOption:"requireValidOption"}}}build(){const e=this.config,{values:t,type:n}=e,r=s(e,["values","type"]),o=e=>{const t=e.target.nextSibling.nextSibling,n=e.target.nextSibling,r=this.getActiveOption(t);let o=new Map([[38,()=>{const e=this.getPreviousOption(r);e&&this.selectOption(t,e)}],[40,()=>{const e=this.getNextOption(r);e&&this.selectOption(t,e)}],[13,()=>{r?(e.target.value=r.innerHTML,n.value=r.getAttribute("value"),"none"===t.style.display?this.showList(t,r):this.hideList(t)):this.config.requireValidOption&&(this.isOptionValid(t,e.target.value)||(e.target.value="",e.target.nextSibling.value="")),e.preventDefault()}],[27,()=>{this.hideList(t)}]]).get(e.keyCode);return o||(o=()=>!1),o()},a={focus:e=>{const t=e.target.nextSibling.nextSibling,n=Object(i.c)(t.querySelectorAll("li"),e.target.value);if(e.target.addEventListener("keydown",o),e.target.value.length>0){const e=n.length>0?n[n.length-1]:null;this.showList(t,e)}},blur:e=>{e.target.removeEventListener("keydown",o);const t=setTimeout(()=>{e.target.nextSibling.nextSibling.style.display="none",clearTimeout(t)},200);if(this.config.requireValidOption){const t=e.target.nextSibling.nextSibling;this.isOptionValid(t,e.target.value)||(e.target.value="",e.target.nextSibling.value="")}},input:e=>{const t=e.target.nextSibling.nextSibling;e.target.nextSibling.value=e.target.value;const n=Object(i.c)(t.querySelectorAll("li"),e.target.value);if(0==n.length)this.hideList(t);else{let e=this.getActiveOption(t);e||(e=n[n.length-1]),this.showList(t,e)}}},l=Object.assign({},r,{id:r.id+"-input",autocomplete:"off",events:a}),c=Object.assign({},r,{type:"hidden"});delete l.name;const u=[this.markup("input",null,l),this.markup("input",null,c)],d=t.map(e=>{const t=e.label,n={events:{click:t=>{const n=t.target.parentElement,r=n.previousSibling.previousSibling;r.value=e.label,r.nextSibling.value=e.value,this.hideList(n)}},value:e.value};return this.markup("li",t,n)});return u.push(this.markup("ul",d,{id:r.id+"-list",className:`formbuilder-${n}-list`})),u}hideList(e){this.selectOption(e,null),e.style.display="none"}showList(e,t){this.selectOption(e,t),e.style.display="block",e.style.width=e.parentElement.offsetWidth+"px"}getActiveOption(e){const t=e.getElementsByClassName("active-option")[0];return t&&"none"!==t.style.display?t:null}getPreviousOption(e){let t=e;do{t=t?t.previousSibling:null}while(null!=t&&"none"===t.style.display);return t}getNextOption(e){let t=e;do{t=t?t.nextSibling:null}while(null!=t&&"none"===t.style.display);return t}selectOption(e,t){const n=e.querySelectorAll("li");for(let e=0;e=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class f extends o.a{build(){const e=this.config,{type:t}=e,n=p(e,["type"]);let r=t;const o={paragraph:"p",header:this.subtype};return o[t]&&(r=o[t]),{field:this.markup(r,d.g.parsedHtml(this.label),n),layout:"noLabel"}}}function h(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}o.a.register(["paragraph","header"],f),o.a.register(["p","address","blockquote","canvas","output"],f,"paragraph"),o.a.register(["h1","h2","h3","h4","h5","h6"],f,"header");class m extends o.a{static get definition(){return{inactive:["checkbox"],mi18n:{minSelectionRequired:"minSelectionRequired"}}}build(){const e=[],t=this.config,{values:n,value:r,placeholder:o,type:i,inline:s,other:a,toggle:l}=t,c=h(t,["values","value","placeholder","type","inline","other","toggle"]),u=i.replace("-group",""),p="select"===i;if((c.multiple||"checkbox-group"===i)&&(c.name=c.name+"[]"),"checkbox-group"===i&&c.required){const e=this,t=this.onRender.bind(this);this.onRender=function(){t(),e.groupRequired()}}if(delete c.title,n){o&&p&&e.push(this.markup("option",o,{disabled:null,selected:null}));for(let t=0;t{const t=e.target,n=t.parentElement.previousElementSibling;n.value=t.value,n.name=c.id+"[]"}},id:t.id+"-value",className:"other-val"},i=this.markup("input",null,r),a=[document.createTextNode("Other"),this.markup("input",null,o)],l=this.markup("label",a,{for:r.id}),d=this.markup("div",[i,l],{className:n});e.push(d)}}return this.dom="select"==i?this.markup(u,e,Object(d.D)(c,!0)):this.markup("div",e,{className:i}),this.dom}groupRequired(){const e=this.element.getElementsByTagName("input"),t=(e,t)=>{[].forEach.call(e,e=>{t?e.removeAttribute("required"):e.setAttribute("required","required"),((e,t)=>{const n=o.a.mi18n("minSelectionRequired",1);t?e.setCustomValidity(""):e.setCustomValidity(n)})(e,t)})},n=()=>{const n=[].some.call(e,e=>e.checked);t(e,n)};for(let t=e.length-1;t>=0;t--)e[t].addEventListener("change",n);n()}onRender(){if(this.config.userData){const t=this.config.userData.slice();"select"===this.config.type?e(this.dom).val(t).prop("selected",!0):this.config.type.endsWith("-group")&&this.dom.querySelectorAll("input").forEach(e=>{if(!e.classList.contains("other-val")){for(let n=0;ndelete this.classConfig[e]);const t=this.classConfig.template||'\n ';this.fineTemplate=e("
").attr("id","qq-template").html(t)}build(){return this.input=this.markup("input",null,{type:"hidden",name:this.config.name,id:this.config.name}),this.wrapper=this.markup("div","",{id:this.config.name+"-wrapper"}),[this.input,this.wrapper]}onRender(){const t=e(this.wrapper),n=e(this.input),r=jQuery.extend(!0,{request:{endpoint:this.handler},deleteFile:{enabled:!0,endpoint:this.handler},chunking:{enabled:!0,concurrent:{enabled:!0},success:{endpoint:this.handler+(-1==this.handler.indexOf("?")?"?":"&")+"done"}},resume:{enabled:!0},retry:{enableAuto:!0,showButton:!0},callbacks:{onError:(n,r,o)=>{"."!=o.slice(-1)&&(o+=".");const i=e("
").addClass("qq-error-message").html(`Error processing upload: ${r}.
Reason: ${o}
`).prependTo(t.find(".qq-uploader")),s=window.setTimeout(()=>{i.fadeOut(()=>{i.remove(),window.clearTimeout(s)})},6e3);return n},onStatusChange:(e,r,o)=>{const i=t.fineUploader("getUploads"),s=[];for(const e of i)"upload successful"==e.status&&s.push(e.name);return n.val(s.join(", ")),{id:e,oldStatus:r,newStatus:o}}},template:this.fineTemplate},this.classConfig);t.fineUploader(r)}}function y(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}g.register("file",g,"file"),g.register("fineuploader",b,"file");class v extends o.a{static get definition(){return{mi18n:{textarea:"textArea"}}}build(){const e=this.config,{value:t=""}=e,n=y(e,["value"]);return delete n.type,this.field=this.markup("textarea",this.parsedHtml(t),n),this.field}onRender(){this.config.userData&&e("#"+this.config.name).val(this.config.userData[0])}on(t){return"prerender"==t&&this.preview?t=>{this.field&&(t=this.field),e(t).on("mousedown",e=>{e.stopPropagation()})}:super.on(t)}}function x(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}o.a.register("textarea",v),o.a.register("textarea",v,"textarea");class w extends v{configure(){if(this.js=["https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"],this.classConfig.js){let e=this.classConfig.js;Array.isArray(e)||(e=new Array(e)),this.js.concat(e),delete this.classConfig.js}this.classConfig.css&&(this.css=this.classConfig.css),this.editorOptions={height:250,paste_data_images:!0,plugins:["advlist autolink lists link image charmap print preview anchor","searchreplace visualblocks code fullscreen","insertdatetime media table contextmenu paste code"],toolbar:"undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | table"}}build(){const e=this.config,{value:t=""}=e,n=x(e,["value"]);return delete n.type,this.field=this.markup("textarea",this.parsedHtml(t),n),n.disabled&&(this.editorOptions.readonly=!0),this.field}onRender(e){window.tinymce.editors[this.id]&&window.tinymce.editors[this.id].remove();const t=jQuery.extend(this.editorOptions,this.classConfig);if(t.target=this.field,setTimeout(()=>{window.tinymce.init(t)},100),this.config.userData&&window.tinymce.editors[this.id].setContent(this.parsedHtml(this.config.userData[0])),window.lastFormBuilderCopiedTinyMCE){const e=setTimeout(()=>{window.tinymce.editors[this.id].setContent(this.parsedHtml(window.lastFormBuilderCopiedTinyMCE)),window.lastFormBuilderCopiedTinyMCE=null,clearTimeout(e)},300)}return e}}function O(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function j(e){for(var t=1;t{},render:!0,templates:{},notify:{error:e=>{console.log(e)},success:e=>{console.log(e)},warning:e=>{console.warn(e)}}};if(this.options=jQuery.extend(!0,t,e),this.instanceContainers=[],i.a.current||i.a.init(this.options.i18n),!this.options.formData)return!1;this.options.formData=this.parseFormData(this.options.formData),u.a.controlConfig=e.controlConfig||{},u.a.loadCustom(e.controls),Object.keys(this.options.templates).length&&d.a.register(this.options.templates),"function"!=typeof Element.prototype.appendFormFields&&(Element.prototype.appendFormFields=function(e){Array.isArray(e)||(e=[e]);const t=s.g.markup("div",e,{className:"rendered-form"});this.appendChild(t),e.forEach(e=>{const[n]=e.className.match(/row-([^\s]+)/)||[];if(n){const r=this.id?`${this.id}-row-${n}`:"row-"+n;let o=document.getElementById(r);o||(o=s.g.markup("div",null,{id:r,className:"row"}),t.appendChild(o)),o.appendChild(e)}else t.appendChild(e);e.dispatchEvent(l.a.fieldRendered)})}),"function"!=typeof Element.prototype.emptyContainer&&(Element.prototype.emptyContainer=function(){const e=this;for(;e.lastChild;)e.removeChild(e.lastChild)})}santizeField(e,t){const n=Object.assign({},e);return t&&(n.id=e.id&&`${e.id}-${t}`,n.name=e.name&&`${e.name}-${t}`),n.className=Array.isArray(e.className)?s.g.unique(e.className.join(" ").split(" ")).join(" "):e.className||e.class||null,delete n.class,e.values&&(e.values=e.values.map(e=>s.g.trimObj(e))),s.g.trimObj(n)}getElement(e){return(e=this.options.container||e)instanceof jQuery?e=e[0]:"string"==typeof e&&(e=document.querySelector(e)),e}render(e=null,t=0){const n=this,r=this.options;e=this.getElement(e);const o=[];if(r.formData){const i=new r.layout(r.layoutTemplates);for(let e=0;ee.map(e=>e.innerHTML).join("");n.markup=e(o)}}else{const e=s.g.markup("div",r.messages.noFormData,{className:"no-form-data"});o.push(e),r.notify.error(r.messages.noFormData)}if(r.disableInjectedStyle){const e=document.getElementsByClassName("formBuilder-injected-style");Object(s.j)(e,t=>Object(a.f)(e[t]))}return n}renderControl(e=null){const t=this.options,n=t.formData;if(!n||Array.isArray(n))throw new Error("To render a single element, please specify a single object of formData for the field in question");const r=this.santizeField(n),o=new t.layout,i=u.a.getClass(n.type,n.subtype),s=t.forceTemplate||"hidden",a=o.build(i,r,s);return e.appendFormFields(a),t.notify.success(t.messages.formRendered),this}get userData(){const t=this.options.formData.slice();return t.filter(e=>"tinymce"===e.subtype).forEach(e=>window.tinymce.get(e.name).save()),this.instanceContainers.forEach(n=>{const r=e("select, input, textarea",n).serializeArray().reduce((e,{name:t,value:n})=>(e[t=t.replace("[]","")]?e[t].push(n):e[t]=[n],e),{}),o=t.length;for(let e=0;e{this.options.formData.slice().filter(e=>"tinymce"===e.subtype).forEach(e=>window.tinymce.get(e.name).setContent("")),e.querySelectorAll("input, select, textarea").forEach(e=>{["checkbox","radio"].includes(e.type)?e.checked=!1:e.value=""})})}parseFormData(e){return"object"!=typeof e&&(e={xml:e=>Object(s.w)(e),json:e=>window.JSON.parse(e)}[this.options.dataType](e)||!1),e}}!function(e){let t;const n={init:(e,r={})=>(t=e,n.instance=new f(r),e.each(t=>n.instance.render(e[t],t)),n.instance),userData:()=>n.instance&&n.instance.userData,clear:()=>n.instance&&n.instance.clear(),setData:e=>{if(n.instance){const t=n.instance;t.options.formData=t.parseFormData(e)}},render:(e,r={})=>{if(n.instance){const o=n.instance;e||(e=o.options.formData),o.options=Object.assign({},o.options,r,{formData:o.parseFormData(e)}),t.each(e=>n.instance.render(t[e],e))}},html:()=>t.map(e=>t[e]).html()};e.fn.formRender=function(e={},...t){if(n[e])return n[e].apply(this,t);{const t=n.init(this,e);return Object.assign(n,t),t}},e.fn.controlRender=function(e,t={}){t.formData=e,t.dataType="string"==typeof e?"json":"xml";const n=new f(t),r=this;return r.each(e=>n.renderControl(r[e])),r}}(jQuery)},function(e,t,n){var r=n(9),o=n(32);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var i={attributes:{class:"formBuilder-injected-style"},insert:"head",singleton:!1};r(o,i);e.exports=o.locals||{}},function(e,t,n){n.r(t);var r=n(8),o=n.n(r)()(!1);o.push([e.i,'.rendered-form *{box-sizing:border-box}.rendered-form button,.rendered-form input,.rendered-form select,.rendered-form textarea{font-family:inherit;font-size:inherit;line-height:inherit}.rendered-form input{line-height:normal}.rendered-form textarea{overflow:auto}.rendered-form button,.rendered-form input,.rendered-form select,.rendered-form textarea{font-family:inherit;font-size:inherit;line-height:inherit}.rendered-form .btn-group{position:relative;display:inline-block;vertical-align:middle}.rendered-form .btn-group>.btn{position:relative;float:left}.rendered-form .btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.rendered-form .btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.rendered-form .btn-group .btn+.btn,.rendered-form .btn-group .btn+.btn-group,.rendered-form .btn-group .btn-group+.btn,.rendered-form .btn-group .btn-group+.btn-group{margin-left:-1px}.rendered-form .btn-group>.btn:last-child:not(:first-child),.rendered-form .btn-group>.dropdown-toggle:not(:first-child),.rendered-form .btn-group .input-group .form-control:last-child,.rendered-form .btn-group .input-group-addon:last-child,.rendered-form .btn-group .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.rendered-form .btn-group .input-group-btn:first-child>.btn:not(:first-child),.rendered-form .btn-group .input-group-btn:last-child>.btn,.rendered-form .btn-group .input-group-btn:last-child>.btn-group>.btn,.rendered-form .btn-group .input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.rendered-form .btn-group>.btn.active,.rendered-form .btn-group>.btn:active,.rendered-form .btn-group>.btn:focus,.rendered-form .btn-group>.btn:hover{z-index:2}.rendered-form .btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;user-select:none;background-image:none;border-radius:4px}.rendered-form .btn.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.rendered-form .btn.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.rendered-form .btn.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.rendered-form .btn.active,.rendered-form .btn.btn-active,.rendered-form .btn:active{background-image:none}.rendered-form .input-group .form-control:last-child,.rendered-form .input-group-addon:last-child,.rendered-form .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.rendered-form .input-group-btn:first-child>.btn:not(:first-child),.rendered-form .input-group-btn:last-child>.btn,.rendered-form .input-group-btn:last-child>.btn-group>.btn,.rendered-form .input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.rendered-form .input-group .form-control,.rendered-form .input-group-addon,.rendered-form .input-group-btn{display:table-cell}.rendered-form .input-group-lg>.form-control,.rendered-form .input-group-lg>.input-group-addon,.rendered-form .input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333}.rendered-form .input-group{position:relative;display:table;border-collapse:separate}.rendered-form .input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.rendered-form .form-control,.rendered-form output{font-size:14px;line-height:1.42857143;display:block}.rendered-form textarea.form-control{height:auto}.rendered-form .form-control{height:34px;display:block;width:100%;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px}.rendered-form .form-control:focus{outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.rendered-form .form-group{margin-left:0px;margin-bottom:15px}.rendered-form .btn,.rendered-form .form-control{background-image:none}.rendered-form .pull-right{float:right}.rendered-form .pull-left{float:left}.rendered-form .formbuilder-required,.rendered-form .required-asterisk{color:#c10000}.rendered-form .formbuilder-checkbox-group input[type=checkbox],.rendered-form .formbuilder-checkbox-group input[type=radio],.rendered-form .formbuilder-radio-group input[type=checkbox],.rendered-form .formbuilder-radio-group input[type=radio]{margin:0 4px 0 0}.rendered-form .formbuilder-checkbox-inline,.rendered-form .formbuilder-radio-inline{margin-right:8px;display:inline-block;vertical-align:middle;padding-left:0}.rendered-form .formbuilder-checkbox-inline label input[type=text],.rendered-form .formbuilder-radio-inline label input[type=text]{margin-top:0}.rendered-form .formbuilder-checkbox-inline:first-child,.rendered-form .formbuilder-radio-inline:first-child{padding-left:0}.rendered-form .formbuilder-autocomplete-list{background-color:#fff;display:none;list-style:none;padding:0;border:1px solid #ccc;border-width:0 1px 1px;position:absolute;z-index:20;max-height:200px;overflow-y:auto}.rendered-form .formbuilder-autocomplete-list li{display:none;cursor:default;padding:5px;margin:0;transition:background-color 200ms ease-in-out}.rendered-form .formbuilder-autocomplete-list li:hover,.rendered-form .formbuilder-autocomplete-list li.active-option{background-color:rgba(0,0,0,.075)}.rendered-form .kc-toggle{padding-left:0 !important}.rendered-form .kc-toggle span{position:relative;width:48px;height:24px;background:#e6e6e6;display:inline-block;border-radius:4px;border:1px solid #ccc;padding:2px;overflow:hidden;float:left;margin-right:5px;will-change:transform}.rendered-form .kc-toggle span::after,.rendered-form .kc-toggle span::before{position:absolute;display:inline-block;top:0}.rendered-form .kc-toggle span::after{position:relative;content:"";width:50%;height:100%;left:0;border-radius:3px;background:linear-gradient(to bottom, white 0%, #ccc 100%);border:1px solid #999;transition:transform 100ms;transform:translateX(0)}.rendered-form .kc-toggle span::before{border-radius:4px;top:2px;left:2px;content:"";width:calc(100% - 4px);height:18px;box-shadow:0 0 1px 1px #b3b3b3 inset;background-color:transparent}.rendered-form .kc-toggle input{height:0;overflow:hidden;width:0;opacity:0;pointer-events:none;margin:0}.rendered-form .kc-toggle input:checked+span::after{transform:translateX(100%)}.rendered-form .kc-toggle input:checked+span::before{background-color:#6fc665}.rendered-form label{font-weight:normal}.form-group .formbuilder-required{color:#c10000}.other-option:checked+label input{display:inline-block}.other-val{margin-left:5px;display:none}*[tooltip]{position:relative}*[tooltip]:hover::after{background:rgba(0,0,0,.9);border-radius:5px 5px 5px 0;bottom:23px;color:#fff;content:attr(tooltip);padding:10px 5px;position:absolute;z-index:98;left:2px;width:230px;text-shadow:none;font-size:12px;line-height:1.5em}*[tooltip]:hover::before{border:solid;border-color:#222 transparent;border-width:6px 6px 0;bottom:17px;content:"";left:2px;position:absolute;z-index:99}.tooltip-element{color:#fff;background:#000;width:16px;height:16px;border-radius:8px;display:inline-block;text-align:center;line-height:16px;margin:0 5px;font-size:12px}.form-control.number{width:auto}.form-control[type=color]{width:60px;padding:2px;display:inline-block}.form-control[multiple]{height:auto}',""]),t.default=o}])}(jQuery); \ No newline at end of file