PageSourceSearch

https://dolphin-diving.com/modules/system/assets/js/framework-extras.js

js dolphin-diving.com collected 2026-09-28 09:04:08 UTC 153,946 bytes, 4,153 lines download raw bytes

vendor: 112 bytes, lines 1-5
1/******/ (() => { // webpackBootstrap
2/******/ 	"use strict";
3/******/ 	var __webpack_modules__ = ({
4
5/***/ "./s
5rc/extras/attach-loader.js":
6/*!*************************************!*\
7  !*** ./src/extras/attach-loader.js ***!
8  \*************************************/
9/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
11__webpack_require__.r(__webpack_exports__);
12/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13/* harmony export */   "AttachLoader": () => (/* binding */ AttachLoader)
14/* harmony export */ });
15/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./src/util/index.js");
16var _templateObject;
17
18function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
19
20function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
22function _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); } }
23
24function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
26function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
28
29var AttachLoader = /*#__PURE__*/function () {
30  function AttachLoader() {
31    _classCallCheck(this, AttachLoader);
32
33    this.stylesheetElement = this.createStylesheetElement();
34  }
35
36  _createClass(AttachLoader, [{
37    key: "show",
38    value: // Public
39    function show(el) {
40      this.installStylesheetElement();
41
42      if (el.dataset.attachLoading !== undefined) {
43        el.classList.add('oc-attach-loader');
44        el.disabled = true;
45      }
46
47      if (el.matches('form')) {
48        el.querySelectorAll('[data-attach-loading]').forEach(function (otherEl) {
49          otherEl.classList.add('oc-attach-loader');
50          otherEl.disabled = true;
51        });
52      }
53    }
54  }, {
55    key: "hide",
56    value: function hide(el) {
57      if (el.dataset.attachLoading !== undefined) {
58        el.classList.remove('oc-attach-loader');
59        el.disabled = false;
60      }
61
62      if (el.matches('form')) {
63        el.querySelectorAll('[data-attach-loading]').forEach(function (otherEl) {
64          otherEl.classList.remove('oc-attach-loader');
65          otherEl.disabled = false;
66        });
67      }
68    } // Private
69
70  }, {
71    key: "installStylesheetElement",
72    value: function installStylesheetElement() {
73      if (!AttachLoader.stylesheetReady) {
74        document.head.insertBefore(this.stylesheetElement, document.head.firstChild);
75        AttachLoader.stylesheetReady = true;
76      }
77    }
78  }, {
79    key: "createStylesheetElement",
80    value: function createStylesheetElement() {
81      var element = document.createElement('style');
82      element.textContent = AttachLoader.defaultCSS;
83      return element;
84    }
85  }], [{
86    key: "defaultCSS",
87    get: function get() {
88      return (0,_util__WEBPACK_IMPORTED_MODULE_0__.unindent)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n        .oc-attach-loader:after {\n            content: '';\n            display: inline-block;\n            vertical-align: middle;\n            margin-left: .4em;\n            height: 1em;\n            width: 1em;\n            animation: oc-rotate-loader 0.8s infinite linear;\n            border: .2em solid currentColor;\n            border-right-color: transparent;\n            border-radius: 50%;\n            opacity: .5;\n        }\n\n        @keyframes oc-rotate-loader {\n            0%    { transform: rotate(0deg); }\n            100%  { transform: rotate(360deg); }\n        }\n    "])));
89    }
90  }]);
91
92  return AttachLoader;
93}();
94
95_defineProperty(AttachLoader, "stylesheetReady", false);
96
97/***/ }),
98
99/***/ "./src/extras/controller.js":
100/*!**********************************!*\
101  !*** ./src/extras/controller.js ***!
102  \**********************************/
103/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
104
105__webpack_require__.r(__webpack_exports__);
106/* harmony export */ __webpack_require__.d(__webpack_exports__, {
107/* harmony export */   "Controller": () => (/* binding */ Controller)
108/* harmony export */ });
109/* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validator */ "./src/extras/validator.js");
110/* harmony import */ var _attach_loader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./attach-loader */ "./src/extras/attach-loader.js");
111/* harmony import */ var _flash_message__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./flash-message */ "./src/extras/flash-message.js");
112/* harmony import */ var _util_events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/events */ "./src/util/events.js");
113function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
114
115function _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); } }
116
117function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
118
119
120
121
122
123var Controller = /*#__PURE__*/function () {
124  function Controller() {
125    _classCallCheck(this, Controller);
126
127    this.started = false; // Progress bar default value
128
129    this.enableProgressBar = function (event) {
130      var options = event.detail.context.options;
131
132      if (options.progressBar === null) {
133        options.progressBar = true;
134      }
135    }; // Attach loader
136
137
138    this.showAttachLoader = function (event) {
139      this.attachLoader.show(event.target);
140    }.bind(this);
141
142    this.hideAttachLoader = function (event) {
143      this.attachLoader.hide(event.target);
144    }.bind(this); // Validator
145
146
147    this.validatorSubmit = function (event) {
148      this.validator.submit(event.target);
149    }.bind(this);
150
151    this.validatorValidate = function (event) {
152      this.validator.validate(event.target, event.detail.fields, event.detail.message);
153    }.bind(this); // Flash message
154
155
156    this.flashMessageBind = function (event) {
157      var options = event.detail.context.options;
158
159      if (!options.flash) {
160        return;
161      }
162
163      var self = this;
164
165      options.handleErrorMessage = function (message) {
166        self.flashMessage.show({
167          message: message,
168          type: 'error'
169        });
170      };
171
172      options.handleFlashMessage = function (message, type) {
173        self.flashMessage.show({
174          message: message,
175          type: type
176        });
177      };
178    }.bind(this);
179
180    this.flashMessageRender = function (event) {
181      this.flashMessage.render();
182    }.bind(this);
183  }
184
185  _createClass(Controller, [{
186    key: "start",
187    value: function start() {
188      if (!this.started) {
189        // Progress bar
190        addEventListener('ajax:setup', this.enableProgressBar); // Attach loader
191
192        this.attachLoader = new _attach_loader__WEBPACK_IMPORTED_MODULE_1__.AttachLoader();
193        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.on(document, 'ajax:promise', 'form, [data-attach-loading]', this.showAttachLoader);
194        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.on(document, 'ajax:fail', 'form, [data-attach-loading]', this.hideAttachLoader);
195        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.on(document, 'ajax:done', 'form, [data-attach-loading]', this.hideAttachLoader); // Validator
196
197        this.validator = new _validator__WEBPACK_IMPORTED_MODULE_0__.Validator();
198        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.on(document, 'ajax:before-validate', '[data-request-validate]', this.validatorValidate);
199        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.on(document, 'ajax:promise', '[data-request-validate]', this.validatorSubmit); // Flash message
200
201        this.flashMessage = new _flash_message__WEBPACK_IMPORTED_MODULE_2__.FlashMessage();
202        addEventListener('render', this.flashMessageRender);
203        addEventListener('ajax:setup', this.flashMessageBind);
204        this.started = true;
205      }
206    }
207  }, {
208    key: "stop",
209    value: function stop() {
210      if (this.started) {
211        // Progress bar
212        removeEventListener('ajax:setup', this.enableProgressBar); // Attach loader
213
214        this.attachLoader = null;
215        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.off(document, 'ajax:promise', 'form, [data-attach-loading]', this.showAttachLoader);
216        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.off(document, 'ajax:fail', 'form, [data-attach-loading]', this.hideAttachLoader);
217        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.off(document, 'ajax:done', 'form, [data-attach-loading]', this.hideAttachLoader); // Validator
218
219        this.validator = null;
220        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.off(document, 'ajax:before-validate', '[data-request-validate]', this.validatorValidate);
221        _util_events__WEBPACK_IMPORTED_MODULE_3__.Events.off(document, 'ajax:promise', '[data-request-validate]', this.validatorSubmit); // Flash message
222
223        this.flashMessage = null;
224        removeEventListener('render', this.flashMessageRender);
225        removeEventListener('ajax:setup', this.flashMessageBind);
226        this.started = false;
227      }
228    }
229  }]);
230
231  return Controller;
232}();
233
234/***/ }),
235
236/***/ "./src/extras/flash-message.js":
237/*!*************************************!*\
238  !*** ./src/extras/flash-message.js ***!
239  \*************************************/
240/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
241
242__webpack_require__.r(__webpack_exports__);
243/* harmony export */ __webpack_require__.d(__webpack_exports__, {
244/* harmony export */   "FlashMessage": () => (/* binding */ FlashMessage)
245/* harmony export */ });
246/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./src/util/index.js");
247var _templateObject;
248
249function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
250
251function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
252
253function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
254
255function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
256
257function _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); } }
258
259function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
260
261function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
262
263
264var FlashMessage = /*#__PURE__*/function () {
265  function FlashMessage() {
266    _classCallCheck(this, FlashMessage);
267
268    this.stylesheetElement = this.createStylesheetElement();
269  }
270
271  _createClass(FlashMessage, [{
272    key: "show",
273    value: function show() {
274      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
275      this.installStylesheetElement();
276      var _options$message = options.message,
277          message = _options$message === void 0 ? '' : _options$message,
278          _options$type = options.type,
279          type = _options$type === void 0 ? 'info' : _options$type,
280          _options$target = options.target,
281          target = _options$target === void 0 ? null : _options$target,
282          _options$interval = options.interval,
283          interval = _options$interval === void 0 ? 5 : _options$interval; // Legacy API
284
285      if (options.text) message = options.text;
286      if (options["class"]) type = options["class"]; // Idempotence
287
288      if (target) {
289        target.removeAttribute('data-control');
290      } // Error singles
291
292
293      if (type === 'error') {
294        this.deleteFlashMessages();
295      } // Inject element
296
297
298      var flashElement = this.createFlashElement(message, type);
299      document.body.appendChild(flashElement);
300      setTimeout(function () {
301        flashElement.classList.add('flash-show');
302      }, 100); // Events
303
304      flashElement.querySelector('.flash-close').addEventListener('click', remove);
305      flashElement.addEventListener('extras:flash-remove', remove); // Timeout
306
307      var timer;
308
309      if (type !== 'error') {
310        timer = window.setTimeout(remove, interval * 1000);
311      } // Remove logic
312
313
314      function remove() {
315        window.clearInterval(timer);
316        flashElement.removeEventListener('click', remove);
317        flashElement.removeEventListener('extras:flash-remove', remove);
318        flashElement.classList.remove('flash-show');
319        setTimeout(function () {
320          flashElement.remove();
321        }, 1000);
322      }
323    }
324  }, {
325    key: "render",
326    value: function render() {
327      var self = this;
328      document.querySelectorAll('[data-control=flash-message]').forEach(function (el) {
329        self.show(_objectSpread(_objectSpread({}, el.dataset), {}, {
330          target: el,
331          message: el.innerHTML
332        }));
333      });
334    }
335  }, {
336    key: "deleteFlashMessages",
337    value: function deleteFlashMessages() {
338      document.querySelectorAll('.oc-flash-message').forEach(function (el) {
339        el.dispatchEvent(new Event('extras:flash-remove'));
340      });
341    }
342  }, {
343    key: "createFlashElement",
344    value: function createFlashElement(message, type) {
345      var element = document.createElement('div');
346      element.className = 'oc-flash-message ' + type;
347      element.innerHTML = '<span>' + message + '</span><a class="flash-close"></a>';
348      return element;
349    } // Private
350
351  }, {
352    key: "installStylesheetElement",
353    value: function installStylesheetElement() {
354      if (!FlashMessage.stylesheetReady) {
355        document.head.insertBefore(this.stylesheetElement, document.head.firstChild);
356        FlashMessage.stylesheetReady = true;
357      }
358    }
359  }, {
360    key: "createStylesheetElement",
361    value: function createStylesheetElement() {
362      var element = document.createElement('style');
363      element.textContent = FlashMessage.defaultCSS;
364      return element;
365    }
366  }], [{
367    key: "defaultCSS",
368    get: function get() {
369      return (0,_util__WEBPACK_IMPORTED_MODULE_0__.unindent)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n        .oc-flash-message {\n            position: fixed;\n            z-index: 10300;\n            width: 500px;\n            left: 50%;\n            top: 50px;\n            margin-left: -250px;\n            color: #fff;\n            font-size: 1rem;\n            padding: 10px 30px 10px 15px;\n            border-radius: 5px;\n\n            opacity: 0;\n            transition: all 0.5s, width 0s;\n            transform: scale(0.9);\n        }\n        .oc-flash-message.flash-show {\n            opacity: 1;\n            transform: scale(1);\n        }\n        .oc-flash-message.success {\n            background: #86cB43;\n        }\n        .oc-flash-message.error {\n            background: #cc3300;\n        }\n        .oc-flash-message.warning {\n            background: #f0ad4e;\n        }\n        .oc-flash-message.info {\n            background: #5fb6f5;\n        }\n        .oc-flash-message a.flash-close {\n            box-sizing: content-box;\n            width: 1em;\n            height: 1em;\n            padding: .25em .25em;\n            background: transparent url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FFF'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e\") center/1em auto no-repeat;\n            border: 0;\n            border-radius: .25rem;\n            opacity: .5;\n            text-decoration: none;\n            position: absolute;\n            right: 10px;\n            top: 10px;\n            cursor: pointer;\n        }\n        .oc-flash-message a.flash-close:hover,\n        .oc-flash-message a.flash-close:focus {\n            opacity: 1;\n        }\n        html[data-turbo-preview] .oc-flash-message {\n            opacity: 0;\n        }\n        @media (max-width: 768px) {\n            .oc-flash-message {\n                left: 10px;\n                right: 10px;\n                top: 10px;\n                margin-left: 0;\n                width: auto;\n            }\n        }\n    "])));
370    }
371  }, {
372    key: "flashMsg",
373    value: function flashMsg(options) {
374      return new FlashMessage().show(options);
375    }
376  }]);
377
378  return FlashMessage;
379}();
380
381_defineProperty(FlashMessage, "stylesheetReady", false);
382
383/***/ }),
384
385/***/ "./src/extras/index.js":
386/*!*****************************!*\
387  !*** ./src/extras/index.js ***!
388  \*****************************/
389/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
390
391__webpack_require__.r(__webpack_exports__);
392/* harmony export */ __webpack_require__.d(__webpack_exports__, {
393/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
394/* harmony export */ });
395/* harmony import */ var _namespace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./namespace */ "./src/extras/namespace.js");
396function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
397
398
399/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_namespace__WEBPACK_IMPORTED_MODULE_0__["default"]);
400
401if (!window.oc) {
402  window.oc = {};
403}
404
405if (!window.oc.AjaxExtras) {
406  // Namespace
407  window.oc.AjaxExtras = _namespace__WEBPACK_IMPORTED_MODULE_0__["default"]; // Flash messages
408
409  window.oc.flashMsg = _namespace__WEBPACK_IMPORTED_MODULE_0__["default"].flashMsg; // Progress bar
410
411  window.oc.progressBar = _namespace__WEBPACK_IMPORTED_MODULE_0__["default"].progressBar(); // Boot controller
412
413  if (!isAMD() && !isCommonJS()) {
414    _namespace__WEBPACK_IMPORTED_MODULE_0__["default"].start();
415  }
416}
417
418function isAMD() {
419  return typeof define == "function" && __webpack_require__.amdO;
420}
421
422function isCommonJS() {
423  return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == "object" && "object" != "undefined";
424}
425
426/***/ }),
427
428/***/ "./src/extras/migrate.js":
429/*!*******************************!*\
430  !*** ./src/extras/migrate.js ***!
431  \*******************************/
432/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
433
434__webpack_require__.r(__webpack_exports__);
435/* harmony export */ __webpack_require__.d(__webpack_exports__, {
436/* harmony export */   "Migrate": () => (/* binding */ Migrate)
437/* harmony export */ });
438function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
439
440function _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); } }
441
442function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
443
444var Migrate = /*#__PURE__*/function () {
445  function Migrate() {
446    _classCallCheck(this, Migrate);
447  }
448
449  _createClass(Migrate, [{
450    key: "bind",
451    value: function bind() {
452      if ($.oc === undefined) {
453        $.oc = {};
454      }
455
456      $.oc.flashMsg = window.oc.flashMsg;
457      $.oc.stripeLoadIndicator = window.oc.progressBar;
458    }
459  }]);
460
461  return Migrate;
462}();
463
464/***/ }),
465
466/***/ "./src/extras/namespace.js":
467/*!*********************************!*\
468  !*** ./src/extras/namespace.js ***!
469  \*********************************/
470/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
471
472__webpack_require__.r(__webpack_exports__);
473/* harmony export */ __webpack_require__.d(__webpack_exports__, {
474/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
475/* harmony export */ });
476/* harmony import */ var _controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./controller */ "./src/extras/controller.js");
477/* harmony import */ var _migrate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./migrate */ "./src/extras/migrate.js");
478/* harmony import */ var _flash_message__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./flash-message */ "./src/extras/flash-message.js");
479/* harmony import */ var _progress_bar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./progress-bar */ "./src/extras/progress-bar.js");
480
481
482
483
484var controller = new _controller__WEBPACK_IMPORTED_MODULE_0__.Controller();
485/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
486  controller: controller,
487  flashMsg: _flash_message__WEBPACK_IMPORTED_MODULE_2__.FlashMessage.flashMsg,
488  progressBar: _progress_bar__WEBPACK_IMPORTED_MODULE_3__.ProgressBar.progressBar,
489  start: function start() {
490    controller.start();
491
492    if (window.jQuery) {
493      new _migrate__WEBPACK_IMPORTED_MODULE_1__.Migrate().bind();
494    }
495  },
496  stop: function stop() {
497    controller.stop();
498  }
499});
500
501/***/ }),
502
503/***/ "./src/extras/progress-bar.js":
504/*!************************************!*\
505  !*** ./src/extras/progress-bar.js ***!
506  \************************************/
507/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
508
509__webpack_require__.r(__webpack_exports__);
510/* harmony export */ __webpack_require__.d(__webpack_exports__, {
511/* harmony export */   "ProgressBar": () => (/* binding */ ProgressBar)
512/* harmony export */ });
513/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ "./src/util/index.js");
514var _templateObject;
515
516function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
517
518function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
519
520function _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); } }
521
522function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
523
524function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
525
526
527var ProgressBar = /*#__PURE__*/function () {
528  function ProgressBar() {
529    var _this = this;
530
531    _classCallCheck(this, ProgressBar);
532
533    this.htmlElement = document.documentElement;
534    this.stylesheetElement = this.createStylesheetElement();
535    this.progressElement = this.createProgressElement();
536    this.hiding = false;
537    this.value = 0;
538    this.visible = false;
539
540    this.trickle = function () {
541      _this.setValue(_this.value + Math.random() / 100);
542    };
543  }
544
545  _createClass(ProgressBar, [{
546    key: "show",
547    value: function show() {
548      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
549
550      if (options.cssClass) {
551        this.progressElement.classList.add(options.cssClass);
552      }
553
554      if (!this.visible) {
555        this.visible = true;
556        this.installStylesheetElement();
557        this.installProgressElement();
558        this.startTrickling();
559        this.markAsProgress(true);
560      }
561    }
562  }, {
563    key: "hide",
564    value: function hide() {
565      var _this2 = this;
566
567      if (this.visible && !this.hiding) {
568        this.hiding = true;
569        this.fadeProgressElement(function () {
570          _this2.uninstallProgressElement();
571
572          _this2.stopTrickling();
573
574          _this2.visible = false;
575          _this2.hiding = false;
576
577          _this2.markAsProgress(false);
578        });
579      }
580    }
581  }, {
582    key: "setValue",
583    value: function setValue(value) {
584      this.value = value;
585      this.refresh();
586    } // Private
587
588  }, {
589    key: "installStylesheetElement",
590    value: function installStylesheetElement() {
591      if (!ProgressBar.stylesheetReady) {
592        document.head.insertBefore(this.stylesheetElement, document.head.firstChild);
593        ProgressBar.stylesheetReady = true;
594      }
595    }
596  }, {
597    key: "installProgressElement",
598    value: function installProgressElement() {
599      this.progressElement.style.width = "0";
600      this.progressElement.style.opacity = "1";
601      document.documentElement.insertBefore(this.progressElement, document.body);
602      this.refresh();
603    }
604  }, {
605    key: "fadeProgressElement",
606    value: function fadeProgressElement(callback) {
607      this.progressElement.style.opacity = "0";
608      setTimeout(callback, ProgressBar.animationDuration * 1.5);
609    }
610  }, {
611    key: "uninstallProgressElement",
612    value: function uninstallProgressElement() {
613      if (this.progressElement.parentNode) {
614        document.documentElement.removeChild(this.progressElement);
615      }
616    }
617  }, {
618    key: "startTrickling",
619    value: function startTrickling() {
620      if (!this.trickleInterval) {
621        this.trickleInterval = window.setInterval(this.trickle, ProgressBar.animationDuration);
622      }
623    }
624  }, {
625    key: "stopTrickling",
626    value: function stopTrickling() {
627      window.clearInterval(this.trickleInterval);
628      delete this.trickleInterval;
629    }
630  }, {
631    key: "refresh",
632    value: function refresh() {
633      var _this3 = this;
634
635      requestAnimationFrame(function () {
636        _this3.progressElement.style.width = "".concat(10 + _this3.value * 90, "%");
637      });
638    }
639  }, {
640    key: "createStylesheetElement",
641    value: function createStylesheetElement() {
642      var element = document.createElement('style');
643      element.textContent = ProgressBar.defaultCSS;
644      return element;
645    }
646  }, {
647    key: "createProgressElement",
648    value: function createProgressElement() {
649      var element = document.createElement('div');
650      element.className = 'oc-progress-bar';
651      return element;
652    }
653  }, {
654    key: "markAsProgress",
655    value: function markAsProgress(isProgress) {
656      if (isProgress) {
657        this.htmlElement.setAttribute('data-ajax-progress', '');
658      } else {
659        this.htmlElement.removeAttribute('data-ajax-progress');
660      }
661    }
662  }], [{
663    key: "defaultCSS",
664    get: function get() {
665      return (0,_util__WEBPACK_IMPORTED_MODULE_0__.unindent)(_templateOb
665ject || (_templateObject = _taggedTemplateLiteral(["\n        .oc-progress-bar {\n            position: fixed;\n            display: block;\n            top: 0;\n            left: 0;\n            height: 3px;\n            background: #0076ff;\n            z-index: 9999;\n            transition:\n                width ", "ms ease-out,\n                opacity ", "ms ", "ms ease-in;\n            transform: translate3d(0, 0, 0);\n        }\n    "])), ProgressBar.animationDuration, ProgressBar.animationDuration / 2, ProgressBar.animationDuration / 2);
666    }
667  }, {
668    key: "progressBar",
669    value: function progressBar() {
670      var instance = new ProgressBar();
671      return {
672        show: function show() {
673          instance.setValue(0);
674          instance.show();
675        },
676        hide: function hide() {
677          instance.setValue(100);
678          instance.hide();
679        }
680      };
681    }
682  }]);
683
684  return ProgressBar;
685}();
686
687_defineProperty(ProgressBar, "stylesheetReady", false);
688
689_defineProperty(ProgressBar, "animationDuration", 300);
690
691/***/ }),
692
693/***/ "./src/extras/validator.js":
694/*!*********************************!*\
695  !*** ./src/extras/validator.js ***!
696  \*********************************/
697/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
698
699__webpack_require__.r(__webpack_exports__);
700/* harmony export */ __webpack_require__.d(__webpack_exports__, {
701/* harmony export */   "Validator": () => (/* binding */ Validator)
702/* harmony export */ });
703/* harmony import */ var _util_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/events */ "./src/util/events.js");
704function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
705
706function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
707
708function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
709
710function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
711
712function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
713
714function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
715
716function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
717
718function _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); } }
719
720function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
721
722
723var Validator = /*#__PURE__*/function () {
724  function Validator() {
725    _classCallCheck(this, Validator);
726  }
727
728  _createClass(Validator, [{
729    key: "submit",
730    value: function submit(el) {
731      var form = el.closest('form');
732
733      if (!form) {
734        return;
735      }
736
737      form.querySelectorAll('[data-validate-for]').forEach(function (el) {
738        el.classList.remove('oc-visible');
739      });
740      form.querySelectorAll('[data-validate-error]').forEach(function (el) {
741        el.classList.remove('oc-visible');
742      });
743    }
744  }, {
745    key: "validate",
746    value: function validate(el, fields, errorMsg) {
747      var form = el.closest('form'),
748          messages = [];
749
750      if (!form) {
751        return;
752      }
753
754      for (var fieldName in fields) {
755        // Build messages
756        var fieldMessages = fields[fieldName];
757        messages = [].concat(_toConsumableArray(messages), _toConsumableArray(fieldMessages)); // Display message next to field
758
759        var field = form.querySelector('[data-validate-for="' + fieldName + '"]');
760
761        if (field) {
762          if (!field.innerHTML || field.dataset.emptyMode) {
763            field.dataset.emptyMode = true;
764            field.innerHTML = fieldMessages.join(', ');
765          }
766
767          field.classList.add('oc-visible');
768        }
769      }
770
771      var container = form.querySelector('[data-validate-error]');
772
773      if (container) {
774        container.classList.add('oc-visible'); // Messages found inside the container
775
776        var oldMessages = container.querySelectorAll('[data-message]');
777
778        if (oldMessages.length > 0) {
779          var clone = oldMessages[0];
780          messages.forEach(function (message) {
781            var newNode = clone.cloneNode(true);
782            newNode.innerHTML = message; // Insert after
783
784            clone.parentNode.insertBefore(newNode, clone.nextSibling);
785          });
786          oldMessages.forEach(function (el) {
787            el.remove();
788          });
789        } // Just use the container to set the value
790        else {
791          container.innerHTML = errorMsg;
792        }
793      } // Prevent default error behavior
794
795
796      _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.one(window, 'ajax:error-message', function (event) {
797        event.preventDefault();
798      });
799    }
800  }]);
801
802  return Validator;
803}();
804
805/***/ }),
806
807/***/ "./src/framework/controller.js":
808/*!*************************************!*\
809  !*** ./src/framework/controller.js ***!
810  \*************************************/
811/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
812
813__webpack_require__.r(__webpack_exports__);
814/* harmony export */ __webpack_require__.d(__webpack_exports__, {
815/* harmony export */   "Controller": () => (/* binding */ Controller)
816/* harmony export */ });
817/* harmony import */ var _util_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/events */ "./src/util/events.js");
818/* harmony import */ var _request_builder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./request-builder */ "./src/framework/request-builder.js");
819function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
820
821function _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); } }
822
823function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
824
825
826
827var Controller = /*#__PURE__*/function () {
828  function Controller() {
829    _classCallCheck(this, Controller);
830
831    this.started = false;
832  }
833
834  _createClass(Controller, [{
835    key: "start",
836    value: function start() {
837      if (!this.started) {
838        // Track unload event for request lib
839        window.onbeforeunload = this.documentOnBeforeUnload; // First page load
840
841        addEventListener('DOMContentLoaded', this.render); // Again, after new scripts load
842
843        addEventListener('page:updated', this.render); // Again after AJAX request
844
845        addEventListener('ajax:update-complete', this.render); // Submit form
846
847        _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.on(document, 'submit', '[data-request]', this.documentOnSubmit); // Track input
848
849        _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.on(document, 'input', 'input[data-request][data-track-input]', this.documentOnKeyup); // Change select, checkbox, radio, file input
850
851        _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.on(document, 'change', 'select[data-request], input[type=radio][data-request], input[type=checkbox][data-request], input[type=file][data-request]', this.documentOnChange); // Press enter on orphan input
852
853        _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.on(document, 'keydown', 'input[type=text][data-request], input[type=submit][data-request], input[type=password][data-request]', this.documentOnKeydown); // Click submit button or link
854
855        _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.on(document, 'click', 'a[data-request], button[data-request], input[type=button][data-request], input[type=submit][data-request]', this.documentOnClick);
856        this.started = true;
857      }
858    }
859  }, {
860    key: "stop",
861    value: function stop() {
862      if (this.started) {
863        this.started = false;
864      }
865    }
866  }, {
867    key: "render",
868    value: function render(event) {
869      // Pre render event, used to move nodes around
870      _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.dispatch('before-render'); // Render event, used to initialize controls
871
872      _util_events__WEBPACK_IMPORTED_MODULE_0__.Events.dispatch('render'); // Resize event to adjust all measurements
873
874      window.dispatchEvent(new Event('resize'));
875    }
876  }, {
877    key: "documentOnSubmit",
878    value: function documentOnSubmit(event) {
879      event.preventDefault();
880      _request_builder__WEBPACK_IMPORTED_MODULE_1__.RequestBuilder.fromElement(event.target);
881    }
882  }, {
883    key: "documentOnClick",
884    value: function documentOnClick(event) {
885      event.preventDefault();
886      _request_builder__WEBPACK_IMPORTED_MODULE_1__.RequestBuilder.fromElement(event.target);
887    }
888  }, {
889    key: "documentOnChange",
890    value: function documentOnChange(event) {
891      _request_builder__WEBPACK_IMPORTED_MODULE_1__.RequestBuilder.fromElement(event.target);
892    }
893  }, {
894    key: "documentOnKeyup",
895    value: function documentOnKeyup(event) {
896      var el = event.target,
897          lastValue = el.dataset.ocLastValue;
898
899      if (['email', 'number', 'password', 'search', 'text'].indexOf(el.type) === -1) {
900        return;
901      }
902
903      if (lastValue !== undefined && lastValue == el.value) {
904        return;
905      }
906
907      el.dataset.ocLastValue = el.value;
908
909      if (this.dataTrackInputTimer !== undefined) {
910        window.clearTimeout(this.dataTrackInputTimer);
911      }
912
913      var interval = el.getAttribute('data-track-input');
914
915      if (!interval) {
916        interval = 300;
917      }
918
919      var self = this;
920      this.dataTrackInputTimer = window.setTimeout(function () {
921        if (self.lastDataTrackInputRequest) {
922          self.lastDataTrackInputRequest.abort();
923        }
924
925        self.lastDataTrackInputRequest = _request_builder__WEBPACK_IMPORTED_MODULE_1__.RequestBuilder.fromElement(el);
926      }, interval);
927    }
928  }, {
929    key: "documentOnKeydown",
930    value: function documentOnKeydown(event) {
931      if (event.key === 'Enter') {
932        event.preventDefault();
933
934        if (this.dataTrackInputTimer !== undefined) {
935          window.clearTimeout(this.dataTrackInputTimer);
936        }
937
938        _request_builder__WEBPACK_IMPORTED_MODULE_1__.RequestBuilder.fromElement(event.target);
939      }
940    }
941  }, {
942    key: "documentOnBeforeUnload",
943    value: function documentOnBeforeUnload(event) {
944      window.ocUnloading = true;
945    }
946  }]);
947
948  return Controller;
949}();
950
951/***/ }),
952
953/***/ "./src/framework/index.js":
954/*!********************************!*\
955  !*** ./src/framework/index.js ***!
956  \********************************/
957/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
958
959__webpack_require__.r(__webpack_exports__);
960/* harmony export */ __webpack_require__.d(__webpack_exports__, {
961/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
962/* harmony export */ });
963/* harmony import */ var _util_events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/events */ "./src/util/events.js");
964/* harmony import */ var _namespace__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./namespace */ "./src/framework/namespace.js");
965function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
966
967
968
969/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_namespace__WEBPACK_IMPORTED_MODULE_1__["default"]);
970
971if (!window.oc) {
972  window.oc = {};
973}
974
975if (!window.oc.AjaxFramework) {
976  // Namespace
977  window.oc.AjaxFramework = _namespace__WEBPACK_IMPORTED_MODULE_1__["default"]; // Request on element with builder
978
979  window.oc.request = _namespace__WEBPACK_IMPORTED_MODULE_1__["default"].requestElement; // JSON parser
980
981  window.oc.parseJSON = _namespace__WEBPACK_IMPORTED_MODULE_1__["default"].parseJSON; // Selector events
982
983  window.oc.Events = _util_events__WEBPACK_IMPORTED_MODULE_0__.Events; // Boot controller
984
985  if (!isAMD() && !isCommonJS()) {
986    _namespace__WEBPACK_IMPORTED_MODULE_1__["default"].start();
987  }
988}
989
990function isAMD() {
991  return typeof define == "function" && __webpack_require__.amdO;
992}
993
994function isCommonJS() {
995  return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == "object" && "object" != "undefined";
996}
997
998/***/ }),
999
1000/***/ "./src/framework/json-parser.js":
1001/*!**************************************!*\
1002  !*** ./src/framework/json-parser.js ***!
1003  \**************************************/
1004/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1005
1006__webpack_require__.r(__webpack_exports__);
1007/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1008/* harmony export */   "JsonParser": () => (/* binding */ JsonParser)
1009/* harmony export */ });
1010function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1011
1012function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1013
1014function _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); } }
1015
1016function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1017
1018var JsonParser = /*#__PURE__*/function () {
1019  function JsonParser() {
1020    _classCallCheck(this, JsonParser);
1021  }
1022
1023  _createClass(JsonParser, [{
1024    key: "parseString",
1025    value: // Private
1026    function parseString(str) {
1027      str = str.trim();
1028
1029      if (!str.length) {
1030        throw new Error("Broken JSON object.");
1031      }
1032
1033      var result = "";
1034      /*
1035       * the mistake ','
1036       */
1037
1038      while (str && str[0] === ",") {
1039        str = str.substr(1);
1040      }
1041      /*
1042       * string
1043       */
1044
1045
1046      if (str[0] === "\"" || str[0] === "'") {
1047        if (str[str.length - 1] !== str[0]) {
1048          throw new Error("Invalid string JSON object.");
1049        }
1050
1051        var body = "\"";
1052
1053        for (var i = 1; i < str.length; i++) {
1054          if (str[i] === "\\") {
1055            if (str[i + 1] === "'") {
1056              body += str[i + 1];
1057            } else {
1058              body += str[i];
1059              body += str[i + 1];
1060            }
1061
1062            i++;
1063          } else if (str[i] === str[0]) {
1064            body += "\"";
1065            return body;
1066          } else if (str[i] === "\"") {
1067            body += "\\\"";
1068          } else body += str[i];
1069        }
1070
1071        throw new Error("Invalid string JSON object.");
1072      }
1073      /*
1074       * boolean
1075       */
1076
1077
1078      if (str === "true" || str === "false") {
1079        return str;
1080      }
1081      /*
1082       * null
1083       */
1084
1085
1086      if (str === "null") {
1087        return "null";
1088      }
1089      /*
1090       * number
1091       */
1092
1093
1094      var num = parseFloat(str);
1095
1096      if (!isNaN(num)) {
1097        return num.toString();
1098      }
1099      /*
1100       * object
1101       */
1102
1103
1104      if (str[0] === "{") {
1105        var type = "needKey";
1106        var result = "{";
1107
1108        for (var i = 1; i < str.length; i++) {
1109          if (this.isBlankChar(str[i])) {
1110            continue;
1111          } else if (type === "needKey" && (str[i] === "\"" || str[i] === "'")) {
1112            var key = this.parseKey(str, i + 1, str[i]);
1113            result += "\"" + key + "\"";
1114            i += key.length;
1115            i += 1;
1116            type = "afterKey";
1117          } else if (type === "needKey" && this.canBeKeyHead(str[i])) {
1118            var key = this.parseKey(str, i);
1119            result += "\"";
1120            result += key;
1121            result += "\"";
1122            i += key.length - 1;
1123            type = "afterKey";
1124          } else if (type === "afterKey" && str[i] === ":") {
1125            result += ":";
1126            type = ":";
1127          } else if (type === ":") {
1128            var body = this.getBody(str, i);
1129            i = i + body.originLength - 1;
1130            result += this.parseString(body.body);
1131            type = "afterBody";
1132          } else if (type === "afterBody" || type === "needKey") {
1133            var last = i;
1134
1135            while (str[last] === "," || this.isBlankChar(str[last])) {
1136              last++;
1137            }
1138
1139            if (str[last] === "}" && last === str.length - 1) {
1140              while (result[result.length - 1] === ",") {
1141                result = result.substr(0, result.length - 1);
1142              }
1143
1144              result += "}";
1145              return result;
1146            } else if (last !== i && result !== "{") {
1147              result += ",";
1148              type = "needKey";
1149              i = last - 1;
1150            }
1151          }
1152        }
1153
1154        throw new Error("Broken JSON object near " + result);
1155      }
1156      /*
1157       * array
1158       */
1159
1160
1161      if (str[0] === "[") {
1162        var result = "[";
1163        var type = "needBody";
1164
1165        for (var i = 1; i < str.length; i++) {
1166          if (" " === str[i] || "\n" === str[i] || "\t" === str[i]) {
1167            continue;
1168          } else if (type === "needBody") {
1169            if (str[i] === ",") {
1170              result += "null,";
1171              continue;
1172            }
1173
1174            if (str[i] === "]" && i === str.length - 1) {
1175              if (result[result.length - 1] === ",") result = result.substr(0, result.length - 1);
1176              result += "]";
1177              return result;
1178            }
1179
1180            var body = this.getBody(str, i);
1181            i = i + body.originLength - 1;
1182            result += this.parseString(body.body);
1183            type = "afterBody";
1184          } else if (type === "afterBody") {
1185            if (str[i] === ",") {
1186              result += ",";
1187              type = "needBody"; // deal with mistake ","
1188
1189              while (str[i + 1] === "," || this.isBlankChar(str[i + 1])) {
1190                if (str[i + 1] === ",") result += "null,";
1191                i++;
1192              }
1193            } else if (str[i] === "]" && i === str.length - 1) {
1194              result += "]";
1195              return result;
1196            }
1197          }
1198        }
1199
1200        throw new Error("Broken JSON array near " + result);
1201      }
1202    }
1203  }, {
1204    key: "parseKey",
1205    value: function parseKey(str, pos, quote) {
1206      var key = "";
1207
1208      for (var i = pos; i < str.length; i++) {
1209        if (quote && quote === str[i]) {
1210          return key;
1211        } else if (!quote && (str[i] === " " || str[i] === ":")) {
1212          return key;
1213        }
1214
1215        key += str[i];
1216
1217        if (str[i] === "\\" && i + 1 < str.length) {
1218          key += str[i + 1];
1219          i++;
1220        }
1221      }
1222
1223      throw new Error("Broken JSON syntax near " + key);
1224    }
1225  }, {
1226    key: "getBody",
1227    value: function getBody(str, pos) {
1228      // parse string body
1229      if (str[pos] === "\"" || str[pos] === "'") {
1230        var body = str[pos];
1231
1232        for (var i = pos + 1; i < str.length; i++) {
1233          if (str[i] === "\\") {
1234            body += str[i];
1235            if (i + 1 < str.length) body += str[i + 1];
1236            i++;
1237          } else if (str[i] === str[pos]) {
1238            body += str[pos];
1239            return {
1240              originLength: body.length,
1241              body: body
1242            };
1243          } else body += str[i];
1244        }
1245
1246        throw new Error("Broken JSON string body near " + body);
1247      } // parse true / false
1248
1249
1250      if (str[pos] === "t") {
1251        if (str.indexOf("true", pos) === pos) {
1252          return {
1253            originLength: "true".length,
1254            body: "true"
1255          };
1256        }
1257
1258        throw new Error("Broken JSON boolean body near " + str.substr(0, pos + 10));
1259      }
1260
1261      if (str[pos] === "f") {
1262        if (str.indexOf("f", pos) === pos) {
1263          return {
1264            originLength: "false".length,
1265            body: "false"
1266          };
1267        }
1268
1269        throw new Error("Broken JSON boolean body near " + str.substr(0, pos + 10));
1270      } // parse null
1271
1272
1273      if (str[pos] === "n") {
1274        if (str.indexOf("null", pos) === pos) {
1275          return {
1276            originLength: "null".length,
1277            body: "null"
1278          };
1279        }
1280
1281        throw new Error("Broken JSON boolean body near " + str.substr(0, pos + 10));
1282      } // parse number
1283
1284
1285      if (str[pos] === "-" || str[pos] === "+" || str[pos] === "." || str[pos] >= "0" && str[pos] <= "9") {
1286        var body = "";
1287
1288        for (var i = pos; i < str.length; i++) {
1289          if (str[i] === "-" || str[i] === "+" || str[i] === "." || str[i] >= "0" && str[i] <= "9") {
1290            body += str[i];
1291          } else {
1292            return {
1293              originLength: body.length,
1294              body: body
1295            };
1296          }
1297        }
1298
1299        throw new Error("Broken JSON number body near " + body);
1300      } // parse object
1301
1302
1303      if (str[pos] === "{" || str[pos] === "[") {
1304        var stack = [str[pos]];
1305        var body = str[pos];
1306
1307        for (var i = pos + 1; i < str.length; i++) {
1308          body += str[i];
1309
1310          if (str[i] === "\\") {
1311            if (i + 1 < str.length) body += str[i + 1];
1312            i++;
1313          } else if (str[i] === "\"") {
1314            if (stack[stack.length - 1] === "\"") {
1315              stack.pop();
1316            } else if (stack[stack.length - 1] !== "'") {
1317              stack.push(str[i]);
1318            }
1319          } else if (str[i] === "'") {
1320            if (stack[stack.length - 1] === "'") {
1321              stack.pop();
1322            } else if (stack[stack.length - 1] !== "\"") {
1323              stack.push(str[i]);
1324            }
1325          } else if (stack[stack.length - 1] !== "\"" && stack[stack.length - 1] !== "'") {
1326            if (str[i] === "{") {
1327              stack.push("{");
1328            } else if (str[i] === "}") {
1329              if (stack[stack.length - 1] === "{") {
1330                stack.pop();
1331              } else {
1332                throw new Error("Broken JSON " + (str[pos] === "{" ? "object" : "array") + " body near " + body);
1333              }
1334            } else if (str[i] === "[") {
1335              stack.push("[");
1336            } else if (str[i] === "]") {
1337              if (stack[stack.length - 1] === "[") {
1338                stack.pop();
1339              } else {
1340                throw new Error("Broken JSON " + (str[pos] === "{" ? "object" : "array") + " body near " + body);
1341              }
1342            }
1343          }
1344
1345          if (!stack.length) {
1346            return {
1347              originLength: i - pos,
1348              body: body
1349            };
1350          }
1351        }
1352
1353        throw new Error("Broken JSON " + (str[pos] === "{" ? "object" : "array") + " body near " + body);
1354      }
1355
1356      throw new Error("Broken JSON body near " + str.substr(pos - 5 >= 0 ? pos - 5 : 0, 50));
1357    }
1358  }, {
1359    key: "canBeKeyHead",
1360    value: function canBeKeyHead(ch) {
1361      if (ch[0] === "\\") return false;
1362      if (ch[0] >= 'a' && ch[0] <= 'z' || ch[0] >= 'A' && ch[0] <= 'Z' || ch[0] === '_') return true;
1363      if (ch[0] >= '0' && ch[0] <= '9') return true;
1364      if (ch[0] === '$') return true;
1365      if (ch.charCodeAt(0) > 255) return true;
1366      return false;
1367    }
1368  }, {
1369    key: "isBlankChar",
1370    value: function isBlankChar(ch) {
1371      return ch === " " || ch === "\n" || ch === "\t";
1372    }
1373  }], [{
1374    key: "paramToObj",
1375    value: // Public
1376    function paramToObj(name, value) {
1377      if (value === undefined) {
1378        value = '';
1379      }
1380
1381      if (_typeof(value) == 'object') {
1382        return value;
1383      }
1384
1385      try {
1386        return this.parseJSON("{" + value + "}");
1387      } catch (e) {
1388        throw new Error('Error parsing the ' + name + ' attribute value. ' + e);
1389      }
1390    }
1391  }, {
1392    key: "parseJSON",
1393    value: function parseJSON(json) {
1394      return JSON.parse(new JsonParser().parseString(json));
1395    }
1396  }]);
1397
1398  return JsonParser;
1399}();
1400
1401/***/ }),
1402
1403/***/ "./src/framework/migrate.js":
1404/*!**********************************!*\
1405  !*** ./src/framework/migrate.js ***!
1406  \**********************************/
1407/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1408
1409__webpack_require__.r(__webpack_exports__);
1410/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1411/* harmony export */   "Migrate": () => (/* binding */ Migrate)
1412/* harmony export */ });
1413/* harmony import */ var _framework_request_builder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../framework/request-builder */ "./src/framework/request-builder.js");
1414/* harmony import */ var _json_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./json-parser */ "./src/framework/json-parser.js");
1415function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1416
1417function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1418
1419function _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); } }
1420
1421function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1422
1423
1424
1425var Migrate = /*#__PURE__*/function () {
1426  function Migrate() {
1427    _classCallCheck(this, Migrate);
1428  }
1429
1430  _createClass(Migrate, [{
1431    key: "bind",
1432    value: function bind() {
1433      this.bindRequestFunc();
1434      this.bindRenderFunc();
1435      this.bindjQueryEvents();
1436    }
1437  }, {
1438    key: "bindRequestFunc",
1439    value: function bindRequestFunc() {
1440      var old = $.fn.request;
1441
1442      $.fn.request = function (handler, option) {
1443        var options = _typeof(option) === 'object' ? option : {};
1444        return new _framework_request_builder__WEBPACK_IMPORTED_MODULE_0__.RequestBuilder(this.get(0), handler, options);
1445      };
1446
1447      $.fn.request.Constructor = _framework_request_builder__WEBPACK_IMPORTED_MODULE_0__.RequestBuilder; // Basic function
1448
1449      $.request = function (handler, option) {
1450        return $(document).request(handler, option);
1451      }; // No conflict
1452
1453
1454      $.fn.request.noConflict = function () {
1455        $.fn.request = old;
1456        return this;
1457      };
1458    }
1459  }, {
1460    key: "bindRenderFunc",
1461    value: function bindRenderFunc() {
1462      $.fn.render = function (callback) {
1463        $(document).on('render', callback);
1464      };
1465    }
1466  }, {
1467    key: "bindjQueryEvents",
1468    value: function bindjQueryEvents() {
1469      // Element
1470      this.migratejQueryEvent(document, 'ajax:setup', 'ajaxSetup', ['context']);
1471      this.migratejQueryEvent(document, 'ajax:promise', 'ajaxPromise', ['context']);
1472      this.migratejQueryEvent(document, 'ajax:fail', 'ajaxFail', ['context', 'data', 'responseCode', 'xhr']);
1473      this.migratejQueryEvent(document, 'ajax:done', 'ajaxDone', ['context', 'data', 'responseCode', 'xhr']);
1474      this.migratejQueryEvent(document, 'ajax:always', 'ajaxAlways', ['context', 'data', 'responseCode', 'xhr']);
1475      this.migratejQueryEvent(document, 'ajax:before-redirect', 'ajaxRedirect'); // Updated Element
1476
1477      this.migratejQueryEvent(document, 'ajax:update', 'ajaxUpdate', ['context', 'data', 'responseCode', 'xhr']);
1478      this.migratejQueryEvent(document, 'ajax:before-replace', 'ajaxBeforeReplace'); // Trigger Element
1479
1480      this.migratejQueryEvent(document, 'ajax:before-request', 'oc.beforeRequest', ['context']);
1481      this.migratejQueryEvent(document, 'ajax:before-update', 'ajaxBeforeUpdate', ['context', 'data', 'responseCode', 'x
1481hr']);
1482      this.migratejQueryEvent(document, 'ajax:request-success', 'ajaxSuccess', ['context', 'data', 'responseCode', 'xhr']);
1483      this.migratejQueryEvent(document, 'ajax:request-complete', 'ajaxComplete', ['context', 'data', 'responseCode', 'xhr']);
1484      this.migratejQueryEvent(document, 'ajax:request-error', 'ajaxError', ['context', 'message', 'responseCode', 'xhr']);
1485      this.migratejQueryEvent(document, 'ajax:before-validate', 'ajaxValidation', ['context', 'message', 'fields']); // Window
1486
1487      this.migratejQueryEvent(window, 'ajax:before-send', 'ajaxBeforeSend', ['context']);
1488      this.migratejQueryEvent(window, 'ajax:update-complete', 'ajaxUpdateComplete', ['context', 'data', 'responseCode', 'xhr']);
1489      this.migratejQueryEvent(window, 'ajax:invalid-field', 'ajaxInvalidField', ['element', 'fieldName', 'fieldMessages', 'isFirst']);
1490      this.migratejQueryEvent(window, 'ajax:confirm-message', 'ajaxConfirmMessage', ['message', 'promise']);
1491      this.migratejQueryEvent(window, 'ajax:error-message', 'ajaxErrorMessage', ['message']); // Data adapter
1492
1493      this.migratejQueryAttachData(document, 'ajax:setup', 'a[data-request], button[data-request], form[data-request], a[data-handler], button[data-handler]');
1494    } // Private
1495
1496  }, {
1497    key: "migratejQueryEvent",
1498    value: function migratejQueryEvent(target, jsName, jqName) {
1499      var detailNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1500      var self = this;
1501      $(target).on(jsName, function (ev) {
1502        self.triggerjQueryEvent(ev.originalEvent, jqName, detailNames);
1503      });
1504    }
1505  }, {
1506    key: "triggerjQueryEvent",
1507    value: function triggerjQueryEvent(ev, eventName) {
1508      var detailNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1509      var jQueryEvent = $.Event(eventName),
1510          args = this.buildDetailArgs(ev, detailNames);
1511      $(ev.target).trigger(jQueryEvent, args);
1512
1513      if (jQueryEvent.isDefaultPrevented()) {
1514        ev.preventDefault();
1515      }
1516    }
1517  }, {
1518    key: "buildDetailArgs",
1519    value: function buildDetailArgs(ev, detailNames) {
1520      var args = [];
1521      detailNames.forEach(function (name) {
1522        args.push(ev.detail[name]);
1523      });
1524      return args;
1525    } // For instances where data() is populated in the jQ instance
1526
1527  }, {
1528    key: "migratejQueryAttachData",
1529    value: function migratejQueryAttachData(target, eventName, selector) {
1530      $(target).on(eventName, selector, function (event) {
1531        var dataObj = $(this).data('request-data');
1532
1533        if (!dataObj) {
1534          return;
1535        }
1536
1537        var options = event.detail.context.options;
1538
1539        if (dataObj.constructor === {}.constructor) {
1540          Object.assign(options.data, dataObj);
1541        } else if (typeof dataObj === 'string') {
1542          Object.assign(options.data, _json_parser__WEBPACK_IMPORTED_MODULE_1__.JsonParser.paramToObj('request-data', dataObj));
1543        }
1544      });
1545    }
1546  }]);
1547
1548  return Migrate;
1549}();
1550
1551/***/ }),
1552
1553/***/ "./src/framework/namespace.js":
1554/*!************************************!*\
1555  !*** ./src/framework/namespace.js ***!
1556  \************************************/
1557/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1558
1559__webpack_require__.r(__webpack_exports__);
1560/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1561/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1562/* harmony export */ });
1563/* harmony import */ var _controller__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./controller */ "./src/framework/controller.js");
1564/* harmony import */ var _migrate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./migrate */ "./src/framework/migrate.js");
1565/* harmony import */ var _request_builder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./request-builder */ "./src/framework/request-builder.js");
1566/* harmony import */ var _json_parser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./json-parser */ "./src/framework/json-parser.js");
1567
1568
1569
1570
1571var controller = new _controller__WEBPACK_IMPORTED_MODULE_0__.Controller();
1572/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1573  controller: controller,
1574  parseJSON: _json_parser__WEBPACK_IMPORTED_MODULE_3__.JsonParser.parseJSON,
1575  requestElement: _request_builder__WEBPACK_IMPORTED_MODULE_2__.RequestBuilder.fromElement,
1576  start: function start() {
1577    controller.start();
1578
1579    if (window.jQuery) {
1580      new _migrate__WEBPACK_IMPORTED_MODULE_1__.Migrate().bind();
1581    }
1582  },
1583  stop: function stop() {
1584    controller.stop();
1585  }
1586});
1587
1588/***/ }),
1589
1590/***/ "./src/framework/request-builder.js":
1591/*!******************************************!*\
1592  !*** ./src/framework/request-builder.js ***!
1593  \******************************************/
1594/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1595
1596__webpack_require__.r(__webpack_exports__);
1597/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1598/* harmony export */   "RequestBuilder": () => (/* binding */ RequestBuilder)
1599/* harmony export */ });
1600/* harmony import */ var _request_namespace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../request/namespace */ "./src/request/namespace.js");
1601/* harmony import */ var _json_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./json-parser */ "./src/framework/json-parser.js");
1602function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1603
1604function _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); } }
1605
1606function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1607
1608
1609
1610var RequestBuilder = /*#__PURE__*/function () {
1611  function RequestBuilder(element, handler, options) {
1612    _classCallCheck(this, RequestBuilder);
1613
1614    this.options = options || {};
1615    this.ogElement = element;
1616    this.element = this.findElement(element);
1617
1618    if (!this.element) {
1619      return _request_namespace__WEBPACK_IMPORTED_MODULE_0__["default"].send(handler, this.options);
1620    }
1621
1622    this.assignAsEval('beforeUpdateFunc', 'requestBeforeUpdate');
1623    this.assignAsEval('afterUpdateFunc', 'requestAfterUpdate');
1624    this.assignAsEval('successFunc', 'requestSuccess');
1625    this.assignAsEval('errorFunc', 'requestError');
1626    this.assignAsEval('completeFunc', 'requestComplete');
1627    this.assignAsData('progressBar', 'requestProgressBar');
1628    this.assignAsData('confirm', 'requestConfirm');
1629    this.assignAsData('redirect', 'requestRedirect');
1630    this.assignAsData('loading', 'requestLoading');
1631    this.assignAsData('form', 'requestForm');
1632    this.assignAsData('url', 'requestUrl');
1633    this.assignAsData('update', 'requestUpdate', {
1634      parseJson: true
1635    });
1636    this.assignAsData('bulk', 'requestBulk', {
1637      emptyAsTrue: true
1638    });
1639    this.assignAsData('files', 'requestFiles', {
1640      emptyAsTrue: true
1641    });
1642    this.assignAsData('flash', 'requestFlash', {
1643      emptyAsTrue: true
1644    });
1645    this.assignAsData('download', 'requestDownload', {
1646      emptyAsTrue: true
1647    });
1648    this.assignAsData('browserTarget', 'browserTarget');
1649    this.assignAsData('browserValidate', 'browserValidate', {
1650      emptyAsTrue: true
1651    });
1652    this.assignRequestData();
1653
1654    if (!handler) {
1655      handler = this.getHandlerName();
1656    }
1657
1658    return _request_namespace__WEBPACK_IMPORTED_MODULE_0__["default"].sendElement(this.element, handler, this.options);
1659  }
1660
1661  _createClass(RequestBuilder, [{
1662    key: "findElement",
1663    value: // Event target may some random node inside the data-request container
1664    // so it should bubble up but also capture the ogElement in case it is
1665    // a button that contains data-request-data.
1666    function findElement(element) {
1667      if (!element || element === document) {
1668        return null;
1669      }
1670
1671      if (element.matches('[data-request]')) {
1672        return element;
1673      }
1674
1675      var parentEl = element.closest('[data-request]');
1676
1677      if (parentEl) {
1678        return parentEl;
1679      }
1680
1681      return element;
1682    }
1683  }, {
1684    key: "getHandlerName",
1685    value: function getHandlerName() {
1686      if (this.element.dataset.dataRequest) {
1687        return this.element.dataset.dataRequest;
1688      }
1689
1690      return this.element.getAttribute('data-request');
1691    }
1692  }, {
1693    key: "assignAsEval",
1694    value: function assignAsEval(optionName, name) {
1695      var attrVal;
1696
1697      if (this.element.dataset[name]) {
1698        attrVal = this.element.dataset[name];
1699      } else {
1700        attrVal = this.element.getAttribute('data-' + normalizeDataKey(name));
1701      }
1702
1703      if (!attrVal) {
1704        return;
1705      }
1706
1707      this.options[optionName] = function (element, data) {
1708        return new Function('data', attrVal).apply(element, [data]);
1709      };
1710    }
1711  }, {
1712    key: "assignAsData",
1713    value: function assignAsData(optionName, name) {
1714      var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
1715          _ref$parseJson = _ref.parseJson,
1716          parseJson = _ref$parseJson === void 0 ? false : _ref$parseJson,
1717          _ref$emptyAsTrue = _ref.emptyAsTrue,
1718          emptyAsTrue = _ref$emptyAsTrue === void 0 ? false : _ref$emptyAsTrue;
1719
1720      var attrVal;
1721
1722      if (this.element.dataset[name]) {
1723        attrVal = this.element.dataset[name];
1724      } else {
1725        attrVal = this.element.getAttribute('data-' + normalizeDataKey(name));
1726      }
1727
1728      if (attrVal === null) {
1729        return;
1730      }
1731
1732      if (parseJson) {
1733        this.options[optionName] = _json_parser__WEBPACK_IMPORTED_MODULE_1__.JsonParser.paramToObj('data-' + normalizeDataKey(name), attrVal);
1734      } else {
1735        this.options[optionName] = this.castAttrToOption(attrVal, emptyAsTrue);
1736      }
1737    }
1738  }, {
1739    key: "castAttrToOption",
1740    value: function castAttrToOption(val, emptyAsTrue) {
1741      if (emptyAsTrue && val === '') {
1742        return true;
1743      }
1744
1745      if (val === 'true' || val === '1') {
1746        return true;
1747      }
1748
1749      if (val === 'false' || val === '0') {
1750        return false;
1751      }
1752
1753      return val;
1754    }
1755  }, {
1756    key: "assignRequestData",
1757    value: function assignRequestData() {
1758      var data = {};
1759
1760      if (this.options.data) {
1761        Object.assign(data, this.options.data);
1762      }
1763
1764      var attr = this.ogElement.getAttribute('data-request-data');
1765
1766      if (attr) {
1767        Object.assign(data, _json_parser__WEBPACK_IMPORTED_MODULE_1__.JsonParser.paramToObj('data-request-data', attr));
1768      }
1769
1770      elementParents(this.ogElement, '[data-request-data]').reverse().forEach(function (el) {
1771        Object.assign(data, _json_parser__WEBPACK_IMPORTED_MODULE_1__.JsonParser.paramToObj('data-request-data', el.getAttribute('data-request-data')));
1772      });
1773      this.options.data = data;
1774    }
1775  }], [{
1776    key: "fromElement",
1777    value: function fromElement(element, handler, options) {
1778      if (typeof element === 'string') {
1779        element = document.querySelector(element);
1780      }
1781
1782      return new RequestBuilder(element, handler, options);
1783    }
1784  }]);
1785
1786  return RequestBuilder;
1787}();
1788
1789function elementParents(element, selector) {
1790  var parents = [];
1791
1792  if (!element.parentNode) {
1793    return parents;
1794  }
1795
1796  var ancestor = element.parentNode.closest(selector);
1797
1798  while (ancestor) {
1799    parents.push(ancestor);
1800    ancestor = ancestor.parentNode.closest(selector);
1801  }
1802
1803  return parents;
1804}
1805
1806function normalizeDataKey(key) {
1807  return key.replace(/[A-Z]/g, function (chr) {
1808    return "-".concat(chr.toLowerCase());
1809  });
1810}
1811
1812/***/ }),
1813
1814/***/ "./src/request/actions.js":
1815/*!********************************!*\
1816  !*** ./src/request/actions.js ***!
1817  \********************************/
1818/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1819
1820__webpack_require__.r(__webpack_exports__);
1821/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1822/* harmony export */   "Actions": () => (/* binding */ Actions)
1823/* harmony export */ });
1824/* harmony import */ var _asset_manager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asset-manager */ "./src/request/asset-manager.js");
1825/* harmony import */ var _util_http_request__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/http-request */ "./src/util/http-request.js");
1826/* harmony import */ var _util_deferred__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/deferred */ "./src/util/deferred.js");
1827function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1828
1829function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1830
1831function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1832
1833function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1834
1835function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1836
1837function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1838
1839function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1840
1841function _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); } }
1842
1843function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1844
1845
1846
1847
1848var Actions = /*#__PURE__*/function () {
1849  function Actions(delegate, context, options) {
1850    _classCallCheck(this, Actions);
1851
1852    this.el = delegate.el;
1853    this.delegate = delegate;
1854    this.context = context;
1855    this.options = options; // Allow override to call parent logic
1856
1857    this.context.success = this.success.bind(this);
1858    this.context.error = this.error.bind(this);
1859    this.context.complete = this.complete.bind(this);
1860  } // Options can override all public methods in this class
1861
1862
1863  _createClass(Actions, [{
1864    key: "invoke",
1865    value: function invoke(method, args) {
1866      if (this.options[method]) {
1867        return this.options[method].apply(this.context, args);
1868      } // beforeUpdate and afterUpdate are not part of context
1869      // since they have no base logic and won't exist here
1870
1871
1872      if (this[method]) {
1873        return this[method].apply(this, _toConsumableArray(args));
1874      }
1875    } // Options can also specify a non-interference "func" method, typically
1876    // used by eval-based data attributes that takes minimal arguments
1877
1878  }, {
1879    key: "invokeFunc",
1880    value: function invokeFunc(method, data) {
1881      if (this.options[method]) {
1882        return this.options[method](this.el, data);
1883      }
1884    } // Public
1885
1886  }, {
1887    key: "success",
1888    value: function success(data, responseCode, xhr) {
1889      // Halt here if beforeUpdate() or data-request-before-update returns false
1890      if (this.invoke('beforeUpdate', [data, responseCode, xhr]) === false) {
1891        return;
1892      } // Halt here if the error function returns false
1893
1894
1895      if (this.invokeFunc('beforeUpdateFunc', data) === false) {
1896        return;
1897      } // Trigger 'ajaxBeforeUpdate' on the form, halt if event.preventDefault() is called
1898
1899
1900      if (!this.delegate.applicationAllowsUpdate(data, responseCode, xhr)) {
1901        return;
1902      }
1903
1904      if (this.delegate.options.download && data instanceof Blob) {
1905        if (this.invoke('handleFileDownload', [data, xhr])) {
1906          return;
1907        }
1908      }
1909
1910      if (this.delegate.options.flash && data['X_OCTOBER_FLASH_MESSAGES']) {
1911        for (var type in data['X_OCTOBER_FLASH_MESSAGES']) {
1912          this.invoke('handleFlashMessage', [data['X_OCTOBER_FLASH_MESSAGES'][type], type]);
1913        }
1914      } // Proceed with the update process
1915
1916
1917      var self = this,
1918          updatePromise = this.invoke('handleUpdateResponse', [data, responseCode, xhr]);
1919      updatePromise.done(function () {
1920        self.delegate.notifyApplicationRequestSuccess(data, responseCode, xhr);
1921        self.invokeFunc('successFunc', data);
1922      });
1923      return updatePromise;
1924    }
1925  }, {
1926    key: "error",
1927    value: function error(data, responseCode, xhr) {
1928      var errorMsg,
1929          updatePromise = new _util_deferred__WEBPACK_IMPORTED_MODULE_2__.Deferred(),
1930          self = this;
1931
1932      if (window.ocUnloading !== undefined && window.ocUnloading || responseCode == _util_http_request__WEBPACK_IMPORTED_MODULE_1__.SystemStatusCode.userAborted) {
1933        return;
1934      } // Disable redirects
1935
1936
1937      this.delegate.toggleRedirect(false); // Error 406 is a "smart error" that returns response object that is
1938      // processed in the same fashion as a successful response.
1939
1940      if (responseCode == 406 && data) {
1941        errorMsg = data['X_OCTOBER_ERROR_MESSAGE'];
1942        updatePromise = this.invoke('handleUpdateResponse', [data, responseCode, xhr]);
1943      } // Standard error with standard response text
1944      else {
1945        errorMsg = data;
1946        updatePromise.resolve();
1947      }
1948
1949      updatePromise.done(function () {
1950        // Capture the error message on the node
1951        if (self.el !== document) {
1952          self.el.setAttribute('data-error-message', errorMsg);
1953        } // Trigger 'ajaxError' on the form, halt if event.preventDefault() is called
1954
1955
1956        if (!self.delegate.applicationAllowsError(data, responseCode, xhr)) {
1957          return;
1958        } // Halt here if the error function returns false
1959
1960
1961        if (self.invokeFunc('errorFunc', data) === false) {
1962          return;
1963        }
1964
1965        self.invoke('handleErrorMessage', [errorMsg]);
1966      });
1967      return updatePromise;
1968    }
1969  }, {
1970    key: "complete",
1971    value: function complete(data, responseCode, xhr) {
1972      this.delegate.notifyApplicationRequestComplete(data, responseCode, xhr);
1973      this.invokeFunc('completeFunc', data);
1974    } // Custom function, requests confirmation from the user
1975
1976  }, {
1977    key: "handleConfirmMessage",
1978    value: function handleConfirmMessage(message) {
1979      var self = this;
1980      var promise = new _util_deferred__WEBPACK_IMPORTED_MODULE_2__.Deferred();
1981      promise.done(function () {
1982        self.delegate.sendInternal();
1983      });
1984      var event = this.delegate.notifyApplicationConfirmMessage(message, promise);
1985
1986      if (event.defaultPrevented) {
1987        return false;
1988      }
1989
1990      if (message) {
1991        return confirm(message);
1992      }
1993    } // Custom function, display an error message to the user
1994
1995  }, {
1996    key: "handleErrorMessage",
1997    value: function handleErrorMessage(message) {
1998      var event = this.delegate.notifyApplicationErrorMessage(message);
1999
2000      if (event.defaultPrevented) {
2001        return;
2002      }
2003
2004      if (message) {
2005        alert(message);
2006      }
2007    } // Custom function, focus fields with errors
2008
2009  }, {
2010    key: "handleValidationMessage",
2011    value: function handleValidationMessage(message, fields) {
2012      this.delegate.notifyApplicationBeforeValidate(message, fields);
2013
2014      if (!this.delegate.formEl) {
2015        return;
2016      }
2017
2018      var isFirstInvalidField = true;
2019
2020      for (var fieldName in fields) {
2021        var fieldNameRaw = fieldName.replace(/\.(\w+)/g, '[$1]'),
2022            fieldNameArr = ('.' + fieldName).replace(/\.(\w+)/g, '[$1]');
2023        var fieldNameOptions = ['[name="' + fieldNameRaw + '"]:not([disabled])', '[name="' + fieldNameRaw + '[]"]:not([disabled])', '[name$="' + fieldNameArr + '"]:not([disabled])', '[name$="' + fieldNameArr + '[]"]:not([disabled])'];
2024        var fieldElement = this.delegate.formEl.querySelector(fieldNameOptions.join(', '));
2025
2026        if (fieldElement) {
2027          var event = this.delegate.notifyApplicationFieldInvalid(fieldElement, fieldName, fields[fieldName], isFirstInvalidField);
2028
2029          if (isFirstInvalidField) {
2030            if (!event.defaultPrevented) {
2031              fieldElement.focus();
2032            }
2033
2034            isFirstInvalidField = false;
2035          }
2036        }
2037      }
2038    } // Custom function, display a flash message to the user
2039
2040  }, {
2041    key: "handleFlashMessage",
2042    value: function handleFlashMessage(message, type) {} // Custom function, redirect the browser to another location
2043
2044  }, {
2045    key: "handleRedirectResponse",
2046    value: function handleRedirectResponse(href) {
2047      this.delegate.notifyApplicationBeforeRedirect();
2048
2049      if (oc.useTurbo && oc.useTurbo()) {
2050        oc.visit(href);
2051      } else {
2052        location.assign(href);
2053      }
2054    } // Custom function, handle any application specific response values
2055    // Using a promisary object here in case injected assets need time to load
2056
2057  }, {
2058    key: "handleUpdateResponse",
2059    value: function handleUpdateResponse(data, responseCode, xhr) {
2060      var self = this,
2061          updateOptions = this.options.update || {},
2062          updatePromise = new _util_deferred__WEBPACK_IMPORTED_MODULE_2__.Deferred(); // Update partials and finish request
2063
2064      updatePromise.done(function () {
2065        var _loop = function _loop() {
2066          // If a partial has been supplied on the client side that matches the server supplied key, look up
2067          // it's selector and use that. If not, we assume it is an explicit selector reference.
2068          var selector = updateOptions[partial] || partial,
2069              isString = typeof selector === 'string';
2070          var selectedEl = isString ? resolveSelectorResponse(selector) : [selector];
2071          selectedEl.forEach(function (el) {
2072            // Replace With
2073            if (isString && selector.charAt(0) === '!') {
2074              el.insertAdjacentHTML('afterEnd', data[partial]);
2075              el.parentNode.removeChild(el);
2076            } // Append
2077            else if (isString && selector.charAt(0) === '@') {
2078              el.insertAdjacentHTML('beforeEnd', data[partial]);
2079            } // Prepend
2080            else if (isString && selector.charAt(0) === '^') {
2081              el.insertAdjacentHTML('afterBegin', data[partial]);
2082            } // Insert
2083            else {
2084              self.delegate.notifyApplicationBeforeReplace(el);
2085              el.innerHTML = data[partial];
2086              runScriptsOnElement(el);
2087            }
2088
2089            self.delegate.notifyApplicationAjaxUpdate(el, data, responseCode, xhr);
2090          });
2091        };
2092
2093        for (var partial in data) {
2094          _loop();
2095        } // Wait for update method to finish rendering from partial updates
2096
2097
2098        setTimeout(function () {
2099          self.delegate.notifyApplicationUpdateComplete(data, responseCode, xhr);
2100          self.invoke('afterUpdate', [data, responseCode, xhr]);
2101          self.invokeFunc('afterUpdateFunc', data);
2102        }, 0);
2103      }); // Handle redirect
2104
2105      if (data['X_OCTOBER_REDIRECT']) {
2106        this.delegate.toggleRedirect(data['X_OCTOBER_REDIRECT']);
2107      }
2108
2109      if (this.delegate.isRedirect) {
2110        this.invoke('handleRedirectResponse', [this.delegate.options.redirect]);
2111      } // Handle validation
2112
2113
2114      if (data['X_OCTOBER_ERROR_FIELDS']) {
2115        this.invoke('handleValidationMessage', [data['X_OCTOBER_ERROR_MESSAGE'], data['X_OCTOBER_ERROR_FIELDS']]);
2116      } // Handle asset injection
2117
2118
2119      if (data['X_OCTOBER_ASSETS']) {
2120        _asset_manager__WEBPACK_IMPORTED_MODULE_0__.AssetManager.load(data['X_OCTOBER_ASSETS'], function () {
2121          return updatePromise.resolve();
2122        });
2123      } else {
2124        updatePromise.resolve();
2125      }
2126
2127      return updatePromise;
2128    } // Custom function, download a file response from the server
2129
2130  }, {
2131    key: "handleFileDownload",
2132    value: function handleFileDownload(data, xhr) {
2133      if (this.options.browserTarget) {
2134        window.open(window.URL.createObjectURL(data), this.options.browserTarget);
2135        return true;
2136      }
2137
2138      var fileName = typeof this.options.download === 'string' ? this.options.download : getFilenameFromHttpResponse(xhr);
2139
2140      if (fileName) {
2141        var anchor = document.createElement('a');
2142        anchor.href = window.URL.createObjectURL(data);
2143        anchor.download = fileName;
2144        anchor.target = '_blank';
2145        anchor.click();
2146        window.URL.revokeObjectURL(anchor.href);
2147        return true;
2148      }
2149    }
2150  }]);
2151
2152  return Actions;
2153}();
2154
2155function resolveSelectorResponse(selector) {
2156  // Invalid selector
2157  if (['#', '.', '@', '^', '!', '='].indexOf(selector.charAt(0)) === -1) {
2158    return [];
2159  } // Append, prepend, replace with or custom selector
2160
2161
2162  if (['@', '^', '!', '='].indexOf(selector.charAt(0)) !== -1) {
2163    selector = selector.substring(1);
2164  }
2165
2166  return document.querySelectorAll(selector);
2167}
2168
2169function runScriptsOnElement(el) {
2170  // Replace blocked scripts with fresh nodes
2171  Array.from(el.querySelectorAll('script')).forEach(function (oldScript) {
2172    var newScript = document.createElement('script');
2173    Array.from(oldScript.attributes).forEach(function (attr) {
2174      return newScript.setAttribute(attr.name, attr.value);
2175    });
2176    newScript.appendChild(document.createTextNode(oldScript.innerHTML));
2177    oldScript.parentNode.replaceChild(newScript, oldScript);
2178  });
2179}
2180
2181function getFilenameFromHttpResponse(xhr) {
2182  var contentDisposition = xhr.getResponseHeader('Content-Disposition');
2183
2184  if (!contentDisposition) {
2185    return null;
2186  }
2187
2188  var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g;
2189  var match = null;
2190  var tmpMatch = null;
2191
2192  while ((tmpMatch = filenameRegex.exec(contentDisposition)) !== null) {
2193    match = tmpMatch;
2194  }
2195
2196  if (match !== null && match[1]) {
2197    // Decide ASCII or UTF-8 file name
2198    return /filename[^;*=\n]*\*=[^']*''/.exec(match[0]) === null ? match[1].replace(/['"]/g, '') : decodeURIComponent(match[1].substring(match[1].indexOf("''") + 2));
2199  }
2200
2201  return null;
2202}
2203
2204/***/ }),
2205
2206/***/ "./src/request/asset-manager.js":
2207/*!**************************************!*\
2208  !*** ./src/request/asset-manager.js ***!
2209  \**************************************/
2210/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2211
2212__webpack_require__.r(__webpack_exports__);
2213/* harmony export */ __webpack_require__.d(__webpack_exports__, {
2214/* harmony export */   "AssetManager": () => (/* binding */ AssetManager)
2215/* harmony export */ });
2216function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2217
2218function _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); } }
2219
2220function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2221
2222var AssetManager = /*#__PURE__*/function () {
2223  function AssetManager() {
2224    _classCallCheck(this, AssetManager);
2225  }
2226
2227  _createClass(AssetManager, [{
2228    key: "loadCollection",
2229    value: function loadCollection(collection, callback) {
2230      var self = this,
2231          jsList = collection.js ? collection.js : [],
2232          cssList = collection.css ? collection.css : [],
2233          imgList = collection.img ? collection.img : [];
2234      jsList = assGrep(jsList, function (item) {
2235        return !document.querySelector('head script[src="' + item + '"]');
2236      });
2237      cssList = assGrep(cssList, function (item) {
2238        return !document.querySelector('head link[href="' + item + '"]');
2239      });
2240      var cssCounter = 0,
2241          jsLoaded = false,
2242          imgLoaded = false;
2243
2244      if (jsList.length === 0 && cssList.length === 0 && imgList.length === 0) {
2245        callback && callback();
2246        return;
2247      }
2248
2249      this.loadJavaScript(jsList, function () {
2250        jsLoaded = true;
2251        checkLoaded();
2252      });
2253      cssList.forEach(function (source) {
2254        self.loadStyleSheet(source, function () {
2255          cssCounter++;
2256          checkLoaded();
2257        });
2258      });
2259      this.loadImage(imgList, function () {
2260        imgLoaded = true;
2261        checkLoaded();
2262      });
2263
2264      function checkLoaded() {
2265        if (!imgLoaded) {
2266          return false;
2267        }
2268
2269        if (!jsLoaded) {
2270          return false;
2271        }
2272
2273        if (cssCounter < cssList.length) {
2274          return false;
2275        }
2276
2277        callback && callback();
2278      }
2279    } // Loads StyleSheet files
2280
2281  }, {
2282    key: "loadStyleSheet",
2283    value: function loadStyleSheet(source, callback) {
2284      var cssElement = document.createElement('link');
2285      cssElement.setAttribute('rel', 'stylesheet');
2286      cssElement.setAttribute('type', 'text/css');
2287      cssElement.setAttribute('href', source);
2288      cssElement.addEventListener('load', callback, false);
2289
2290      if (typeof cssElement != 'undefined') {
2291        document.getElementsByTagName('head')[0].appendChild(cssElement);
2292      }
2293
2294      return cssElement;
2295    } // Loads JavaScript files in sequence
2296
2297  }, {
2298    key: "loadJavaScript",
2299    value: function loadJavaScript(sources, callback) {
2300      if (sources.length <= 0) {
2301        return callback();
2302      }
2303
2304      var self = this,
2305          source = sources.shift(),
2306          jsElement = document.createElement('script');
2307      jsElement.setAttribute('type', 'text/javascript');
2308      jsElement.setAttribute('src', source);
2309      jsElement.addEventListener('load', function () {
2310        self.loadJavaScript(sources, callback);
2311      }, false);
2312
2313      if (typeof jsElement != 'undefined') {
2314        document.getElementsByTagName('head')[0].appendChild(jsElement);
2315      }
2316    } // Loads Image files
2317
2318  }, {
2319    key: "loadImage",
2320    value: function loadImage(sources, callback) {
2321      if (sources.length <= 0) {
2322        return callback();
2323      }
2324
2325      var loaded = 0;
2326      sources.forEach(function (source) {
2327        var img = new Image();
2328
2329        img.onload = function () {
2330          if (++loaded == sources.length && callback) {
2331            callback();
2332          }
2333        };
2334
2335        img.src = source;
2336      });
2337    }
2338  }], [{
2339    key: "load",
2340    value: function load(collection, callback) {
2341      return new AssetManager().loadCollection(collection, callback);
2342    }
2343  }]);
2344
2345  return AssetManager;
2346}();
2347
2348function assGrep(items, callback) {
2349  var filtered = [],
2350      len = items.length,
2351      i = 0;
2352
2353  for (i; i < len; i++) {
2354    if (callback(items[i])) {
2355      filtered.push(items[i]);
2356    }
2357  }
2358
2359  return filtered;
2360}
2361
2362/***/ }),
2363
2364/***/ "./src/request/data.js":
2365/*!*****************************!*\
2366  !*** ./src/request/data.js ***!
2367  \*****************************/
2368/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2369
2370__webpack_require__.r(__webpack_exports__);
2371/* harmony export */ __webpack_require__.d(__webpack_exports__, {
2372/* harmony export */   "Data": () => (/* binding */ Data)
2373/* harmony export */ });
2374function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2375
2376function _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); } }
2377
2378function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2379
2380var Data = /*#__PURE__*/function () {
2381  function Data(userData, targetEl, formEl) {
2382    _classCallCheck(this, Data);
2383
2384    this.userData = userData || {};
2385    this.targetEl = targetEl;
2386    this.formEl = formEl;
2387  } // Public
2388
2389
2390  _createClass(Data, [{
2391    key: "getRequestData",
2392    value: function getRequestData() {
2393      var requestData; // Serialize form
2394
2395      if (this.formEl) {
2396        requestData = new FormData(this.formEl);
2397      } else {
2398        requestData = new FormData();
2399      } // Add single input data
2400
2401
2402      this.appendSingleInputElement(requestData);
2403      return requestData;
2404    }
2405  }, {
2406    key: "getAsFormData",
2407    value: function getAsFormData() {
2408      return this.appendJsonToFormData(this.getRequestData(), this.userData);
2409    }
2410  }, {
2411    key: "getAsQueryString",
2412    value: function getAsQueryString() {
2413      return this.convertFormDataToQuery(this.getAsFormData());
2414    }
2415  }, {
2416    key: "getAsJsonData",
2417    value: function getAsJsonData() {
2418      return JSON.stringify(this.convertFormDataToJson(this.getAsFormData()));
2419    } // Private
2420
2421  }, {
2422    key: "appendSingleInputElement",
2423    value: function appendSingleInputElement(requestData) {
2424      // Has a form, or no target element
2425      if (this.formEl || !this.targetEl) {
2426        return;
2427      } // Not single or input
2428
2429
2430      if (['INPUT', 'SELECT'].indexOf(this.targetEl.tagName) === -1) {
2431        return;
2432      } // No name or supplied by user data already
2433
2434
2435      var inputName = this.targetEl.name;
2436
2437      if (!inputName || this.userData[inputName] !== undefined) {
2438        return;
2439      } // Include files, if they are any
2440
2441
2442      if (this.targetEl.type === 'file') {
2443        this.targetEl.files.forEach(function (value) {
2444          requestData.append(inputName, value);
2445        });
2446      } else {
2447        requestData.append(inputName, this.targetEl.value);
2448      }
2449    }
2450  }, {
2451    key: "appendJsonToFormData",
2452    value: function appendJsonToFormData(formData, useJson, parentKey) {
2453      var self = this;
2454
2455      for (var key in useJson) {
2456        var fieldKey = key;
2457
2458        if (parentKey) {
2459          fieldKey = parentKey + '[' + key + ']';
2460        }
2461
2462        var value = useJson[key]; // Object
2463
2464        if (value && value.constructor === {}.constructor) {
2465          this.appendJsonToFormData(formData, value, fieldKey);
2466        } // Array
2467        else if (value && value.constructor === [].constructor) {
2468          value.forEach(function (v, i) {
2469            if (v.constructor === {}.constructor || v.constructor === [].constructor) {
2470              self.appendJsonToFormData(formData, v, fieldKey + '[' + i + ']');
2471            } else {
2472              formData.append(fieldKey + '[]', self.castJsonToFormData(v));
2473            }
2474          });
2475        } // Mixed
2476        else {
2477          formData.append(fieldKey, this.castJsonToFormData(value));
2478        }
2479      }
2480
2481      return formData;
2482    }
2483  }, {
2484    key: "convertFormDataToQuery",
2485    value: function convertFormDataToQuery(formData) {
2486      // Process to a flat object with array values
2487      var flatData = this.formDataToArray(formData); // Process HTML names to a query string
2488
2489      return Object.keys(flatData).map(function (key) {
2490        if (key.endsWith('[]')) {
2491          return flatData[key].map(function (val) {
2492            return encodeURIComponent(key) + '=' + encodeURIComponent(val);
2493          }).join('&');
2494        } else {
2495          return encodeURIComponent(key) + '=' + encodeURIComponent(flatData[key]);
2496        }
2497      }).join('&');
2498    }
2499  }, {
2500    key: "convertFormDataToJson",
2501    value: function convertFormDataToJson(formData) {
2502      // Process to a flat object with array values
2503      var flatData = this.formDataToArray(formData); // Process HTML names to a nested object
2504
2505      var jsonData = {};
2506
2507      for (var key in flatData) {
2508        this.assignObjectNested(jsonData, this.nameToArray(key), flatData[key]);
2509      }
2510
2511      return jsonData;
2512    }
2513  }, {
2514    key: "formDataToArray",
2515    value: function formDataToArray(formData) {
2516      return Object.fromEntries(Array.from(formData.keys()).map(function (key) {
2517        return [key, key.endsWith('[]') ? formData.getAll(key) : formData.getAll(key).pop()];
2518      }));
2519    }
2520  }, {
2521    key: "nameToArray",
2522    value: function nameToArray(fieldName) {
2523      var expression = /([^\]\[]+)/g,
2524          elements = [],
2525          searchResult;
2526
2527      while (searchResult = expression.exec(fieldName)) {
2528        elements.push(searchResult[0]);
2529      }
2530
2531      return elements;
2532    }
2533  }, {
2534    key: "assignObjectNested",
2535    value: function assignObjectNested(obj, fieldArr, value) {
2536      var currentTarget = obj,
2537          lastIndex = fieldArr.length - 1;
2538      fieldArr.forEach(function (prop, index) {
2539        if (currentTarget[prop] === undefined) {
2540          currentTarget[prop] = {};
2541        }
2542
2543        if (index === lastIndex) {
2544          currentTarget[prop] = value;
2545        }
2546
2547        currentTarget = currentTarget[prop];
2548      });
2549    }
2550  }, {
2551    key: "castJsonToFormData",
2552    value: function castJsonToFormData(val) {
2553      if (val === null) {
2554        return '';
2555      }
2556
2557      if (val === true) {
2558        return '1';
2559      }
2560
2561      if (val === false) {
2562        return '0';
2563      }
2564
2565      return val;
2566    }
2567  }]);
2568
2569  return Data;
2570}();
2571
2572/***/ }),
2573
2574/***/ "./src/request/index.js":
2575/*!******************************!*\
2576  !*** ./src/request/index.js ***!
2577  \******************************/
2578/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2579
2580__webpack_require__.r(__webpack_exports__);
2581/* harmony export */ __webpack_require__.d(__webpack_exports__, {
2582/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2583/* harmony export */ });
2584/* harmony import */ var _asset_manager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asset-manager */ "./src/request/asset-manager.js");
2585/* harmony import */ var _namespace__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./namespace */ "./src/request/namespace.js");
2586
2587
2588/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_namespace__WEBPACK_IMPORTED_MODULE_1__["default"]);
2589
2590if (!window.oc) {
2591  window.oc = {};
2592}
2593
2594if (!window.oc.AjaxRequest) {
2595  // Namespace
2596  window.oc.AjaxRequest = _namespace__WEBPACK_IMPORTED_MODULE_1__["default"]; // Asset manager
2597
2598  window.oc.AssetManager = _asset_manager__WEBPACK_IMPORTED_MODULE_0__.AssetManager; // Request without element
2599
2600  window.oc.ajax = _namespace__WEBPACK_IMPORTED_MODULE_1__["default"].send; // Request on element (framework can override)
2601
2602  if (!window.oc.request) {
2603    window.oc.request = _namespace__WEBPACK_IMPORTED_MODULE_1__["default"].sendElement;
2604  }
2605}
2606
2607/***/ }),
2608
2609/***/ "./src/request/namespace.js":
2610/*!**********************************!*\
2611  !*** ./src/request/namespace.js ***!
2612  \**********************************/
2613/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2614
2615__webpack_require__.r(__webpack_exports__);
2616/* harmony export */ __webpack_require__.d(__webpack_exports__, {
2617/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2618/* harmony export */ });
2619/* harmony import */ var _request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./request */ "./src/request/request.js");
2620
2621/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_request__WEBPACK_IMPORTED_MODULE_0__.Request);
2622
2623/***/ }),
2624
2625/***/ "./src/request/options.js":
2626/*!********************************!*\
2627  !*** ./src/request/options.js ***!
2628  \********************************/
2629/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2630
2631__webpack_require__.r(__webpack_exports__);
2632/* harmony export */ __webpack_require__.d(__webpack_exports__, {
2633/* harmony export */   "Options": () => (/* binding */ Options)
2634/* harmony export */ });
2635function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2636
2637function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2638
2639function _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); } }
2640
2641function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2642
2643var Options = /*#__PURE__*/function () {
2644  function Options(handler, options) {
2645    _classCallCheck(this, Options);
2646
2647    if (!handler) {
2648      throw new Error('The request handler name is not specified.');
2649    }
2650
2651    if (!handler.match(/^(?:\w+\:{2})?on*/)) {
2652      throw new Error('Invalid handler name. The correct handler name format is: "onEvent".');
2653    }
2654
2655    if (typeof FormData === 'undefined') {
2656      throw new Error('The browser does not support the FormData interface.');
2657    }
2658
2659    this.options = options;
2660    this.handler = handler;
2661  }
2662
2663  _createClass(Options, [{
2664    key: "getRequestOptions",
2665    value: // Public
2666    function getRequestOptions() {
2667      return {
2668        method: 'POST',
2669        url: this.options.url ? this.options.url : window.location.href,
2670        headers: this.buildHeaders(this.handler, this.options),
2671        responseType: this.options.download === false ? '' : 'blob'
2672      };
2673    } // Private
2674
2675  }, {
2676    key: "buildHeaders",
2677    value: function buildHeaders(handler, options) {
2678      var headers = {
2679        'X-Requested-With': 'XMLHttpRequest',
2680        'X-OCTOBER-REQUEST-HANDLER': handler,
2681        'X-OCTOBER-REQUEST-PARTIALS': this.extractPartials(options.update)
2682      };
2683
2684      if (!options.files) {
2685        headers['Content-Type'] = options.bulk ? 'application/json' : 'application/x-www-form-urlencoded';
2686      }
2687
2688      if (options.flash) {
2689        headers['X-OCTOBER-REQUEST-FLASH'] = 1;
2690      }
2691
2692      var xsrfToken = this.getXSRFToken();
2693
2694      if (xsrfToken) {
2695        headers['X-XSRF-TOKEN'] = xsrfToken;
2696      }
2697
2698      var csrfToken = this.getCSRFToken();
2699
2700      if (csrfToken) {
2701        headers['X-CSRF-TOKEN'] = csrfToken;
2702      }
2703
2704      if (options.headers && options.headers.constructor === {}.constructor) {
2705        Object.assign(headers, options.headers);
2706      }
2707
2708      return headers;
2709    }
2710  }, {
2711    key: "extractPartials",
2712    value: function extractPartials() {
2713      var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2714
2715      if (_typeof(update) !== 'object') {
2716        throw new Error('Invalid update value. The correct format is an object ({...})');
2717      }
2718
2719      var result = [];
2720
2721      for (var partial in update) {
2722        result.push(partial);
2723      }
2724
2725      return result.join('&');
2726    }
2727  }, {
2728    key: "getCSRFToken",
2729    value: function getCSRFToken() {
2730      var tag = document.querySelector('meta[name="csrf-token"]');
2731      return tag ? tag.getAttribute('content') : null;
2732    }
2733  }, {
2734    key: "getXSRFToken",
2735    value: function getXSRFToken() {
2736      var cookieValue = null;
2737
2738      if (document.cookie && document.cookie != '') {
2739        var cookies = document.cookie.split(';');
2740
2741        for (var i = 0; i < cookies.length; i++) {
2742          var cookie = cookies[i].replace(/^([\s]*)|([\s]*)$/g, '');
2743
2744          if (cookie.substring(0, 11) == 'XSRF-TOKEN' + '=') {
2745            cookieValue = decodeURIComponent(cookie.substring(11));
2746            break;
2747          }
2748        }
2749      }
2750
2751      return cookieValue;
2752    }
2753  }], [{
2754    key: "fetch",
2755    value: function fetch(handler, options) {
2756      return new this(handler, options).getRequestOptions();
2757    }
2758  }]);
2759
2760  return Options;
2761}();
2762
2763/***/ }),
2764
2765/***/ "./src/request/request.js":
2766/*!********************************!*\
2767  !*** ./src/request/request.js ***!
2768  \********************************/
2769/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2770
2771__webpack_require__.r(__webpack_exports__);
2772/* harmony export */ __webpack_require__.d(__webpack_exports__, {
2773/* harmony export */   "Request": () => (/* binding */ Request)
2774/* harmony export */ });
2775/* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./options */ "./src/request/options.js");
2776/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./actions */ "./src/request/actions.js");
2777/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./data */ "./src/request/data.js");
2778/* harmony import */ var _util_http_request__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/http-request */ "./src/util/http-request.js");
2779/* harmony import */ var _util_deferred__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/deferred */ "./src/util/deferred.js");
2780/* harmony import */ var _extras_progress_bar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../extras/progress-bar */ "./src/extras/progress-bar.js");
2781/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util */ "./src/util/index.js");
2782function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2783
2784function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2785
2786function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2787
2788function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2789
2790function _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); } }
2791
2792function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2793
2794
2795
2796
2797
2798
2799
2800
2801var Request = /*#__PURE__*/function () {
2802  function Request(element, handler, options) {
2803    var _this = this;
2804
2805    _classCallCheck(this, Request);
2806
2807    this.el = element;
2808    this.handler = handler;
2809    this.options = _objectSpread(_objectSpread({}, this.constructor.DEFAULTS), options || {});
2810    this.context = {
2811      el: element,
2812      handler: handler,
2813      options: this.options
2814    };
2815    this.progressBar = new _extras_progress_bar__WEBPACK_IMPORTED_MODULE_5__.ProgressBar();
2816
2817    this.showProgressBar = function () {
2818      _this.progressBar.show({
2819        cssClass: 'is-ajax'
2820      });
2821    };
2822  }
2823
2824  _createClass(Request, [{
2825    key: "start",
2826    value: function start() {
2827      // Setup
2828      this.notifyApplicationAjaxSetup();
2829      this.initOtherElements(); // Prepare actions
2830
2831      this.actions = new _actions__WEBPACK_IMPORTED_MODULE_1__.Actions(this, this.context, this.options);
2832
2833      if (!this.validateClientSideForm() || !this.applicationAllowsRequest()) {
2834        return;
2835      } // Prepare data
2836
2837
2838      var dataObj = new _data__WEBPACK_IMPORTED_MODULE_2__.Data(this.options.data, this.el, this.formEl);
2839      var data;
2840
2841      if (this.options.files) {
2842        data = dataObj.getAsFormData();
2843      } else if (this.options.bulk) {
2844        data = dataObj.getAsJsonData();
2845      } else {
2846        data = dataObj.getAsQueryString();
2847      } // Prepare request
2848
2849
2850      var _Options$fetch = _options__WEBPACK_IMPORTED_MODULE_0__.Options.fetch(this.handler, this.options),
2851          url = _Options$fetch.url,
2852          headers = _Options$fetch.headers,
2853          method = _Options$fetch.method,
2854          responseType = _Options$fetch.responseType;
2855
2856      this.request = new _util_http_request__WEBPACK_IMPORTED_MODULE_3__.HttpRequest(this, url, {
2857        method: method,
2858        headers: headers,
2859        responseType: responseType,
2860        data: data,
2861        trackAbort: true
2862      });
2863      this.promise = new _util_deferred__WEBPACK_IMPORTED_MODULE_4__.Deferred({
2864        delegate: this.request
2865      });
2866      this.isRedirect = this.options.redirect && this.options.redirect.length > 0; // Confirm before sending
2867
2868      if (this.options.confirm && !this.actions.invoke('handleConfirmMessage', [this.options.confirm])) {
2869        return;
2870      } // Send request
2871
2872
2873      this.sendInternal();
2874      return this.promise;
2875    }
2876  }, {
2877    key: "sendInternal",
2878    value: function sendInternal() {
2879      var self = this;
2880      this.notifyApplicationBeforeSend();
2881      this.notifyApplicationAjaxPromise();
2882      this.promise.fail(function (data, responseCode, xhr) {
2883        if (!self.isRedirect) {
2884          self.notifyApplicationAjaxFail(data, responseCode, xhr);
2885        }
2886      }).done(function (data, responseCode, xhr) {
2887        if (!self.isRedirect) {
2888          self.notifyApplicationAjaxDone(data, responseCode, xhr);
2889        }
2890      }).always(function (data, responseCode, xhr) {
2891        self.notifyApplicationAjaxAlways(data, responseCode, xhr);
2892      });
2893      this.request.send();
2894    }
2895  }, {
2896    key: "toggleRedirect",
2897    value: function toggleRedirect(redirectUrl) {
2898      if (!redirectUrl) {
2899        this.options.redirect = null;
2900        this.isRedirect = false;
2901      } else {
2902        this.options.redirect = redirectUrl;
2903        this.isRedirect = true;
2904      }
2905    }
2906  }, {
2907    key: "applicationAllowsRequest",
2908    value: function applicationAllowsRequest() {
2909      var event = this.notifyApplicationBeforeRequest();
2910      return !event.defaultPrevented;
2911    }
2912  }, {
2913    key: "applicationAllowsUpdate",
2914    value: function applicationAllowsUpdate(data, responseCode, xhr) {
2915      var event = this.notifyApplicationBeforeUpdate(data, responseCode, xhr);
2916      return !event.defaultPrevented;
2917    }
2918  }, {
2919    key: "applicationAllowsError",
2920    value: function applicationAllowsError(message, responseCode, xhr) {
2921      var event = this.notifyApplicationRequestError(message, responseCode, xhr);
2922      return !event.defaultPrevented;
2923    } // Application events
2924
2925  }, {
2926    key: "notifyApplicationAjaxSetup",
2927    value: function notifyApplicationAjaxSetup() {
2928      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:setup', {
2929        target: this.el,
2930        detail: {
2931          context: this.context
2932        }
2933      });
2934    }
2935  }, {
2936    key: "notifyApplicationAjaxPromise",
2937    value: function notifyApplicationAjaxPromise() {
2938      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:promise', {
2939        target: this.el,
2940        detail: {
2941          context: this.context
2942        }
2943      });
2944    }
2945  }, {
2946    key: "notifyApplicationAjaxFail",
2947    value: function notifyApplicationAjaxFail(data, responseCode, xhr) {
2948      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:fail', {
2949        target: this.el,
2950        detail: {
2951          context: this.context,
2952          data: data,
2953          responseCode: responseCode,
2954          xhr: xhr
2955        }
2956      });
2957    }
2958  }, {
2959    key: "notifyApplicationAjaxDone",
2960    value: function notifyApplicationAjaxDone(data, responseCode, xhr) {
2961      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:done', {
2962        target: this.el,
2963        detail: {
2964          context: this.context,
2965          data: data,
2966          responseCode: responseCode,
2967          xhr: xhr
2968        }
2969      });
2970    }
2971  }, {
2972    key: "notifyApplicationAjaxAlways",
2973    value: function notifyApplicationAjaxAlways(data, responseCode, xhr) {
2974      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:always', {
2975        target: this.el,
2976        detail: {
2977          context: this.context,
2978          data: data,
2979          responseCode: responseCode,
2980          xhr: xhr
2981        }
2982      });
2983    }
2984  }, {
2985    key: "notifyApplicationAjaxUpdate",
2986    value: function notifyApplicationAjaxUpdate(target, data, responseCode, xhr) {
2987      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:update', {
2988        target: target,
2989        detail: {
2990          context: this.context,
2991          data: data,
2992          responseCode: responseCode,
2993          xhr: xhr
2994        }
2995      });
2996    }
2997  }, {
2998    key: "notifyApplicationBeforeRedirect",
2999    value: function notifyApplicationBeforeRedirect() {
3000      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:before-redirect', {
3001        target: this.el
3002      });
3003    }
3004  }, {
3005    key: "notifyApplicationBeforeRequest",
3006    value: function notifyApplicationBeforeRequest() {
3007      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:before-request', {
3008        target: this.triggerEl,
3009        detail: {
3010          context: this.context
3011        }
3012      });
3013    }
3014  }, {
3015    key: "notifyApplicationBeforeUpdate",
3016    value: function notifyApplicationBeforeUpdate(data, responseCode, xhr) {
3017      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:before-update', {
3018        target: this.triggerEl,
3019        detail: {
3020          context: this.context,
3021          data: data,
3022          responseCode: responseCode,
3023          xhr: xhr
3024        }
3025      });
3026    }
3027  }, {
3028    key: "notifyApplicationRequestSuccess",
3029    value: function notifyApplicationRequestSuccess(data, responseCode, xhr) {
3030      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:request-success', {
3031        target: this.triggerEl,
3032        detail: {
3033          context: this.context,
3034          data: data,
3035          responseCode: responseCode,
3036          xhr: xhr
3037        }
3038      });
3039    }
3040  }, {
3041    key: "notifyApplicationRequestError",
3042    value: function notifyApplicationRequestError(message, responseCode, xhr) {
3043      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:request-error', {
3044        target: this.triggerEl,
3045        detail: {
3046          context: this.context,
3047          message: message,
3048          responseCode: responseCode,
3049          xhr: xhr
3050        }
3051      });
3052    }
3053  }, {
3054    key: "notifyApplicationRequestComplete",
3055    value: function notifyApplicationRequestComplete(data, responseCode, xhr) {
3056      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:request-complete', {
3057        target: this.triggerEl,
3058        detail: {
3059          context: this.context,
3060          data: data,
3061          responseCode: responseCode,
3062          xhr: xhr
3063        }
3064      });
3065    }
3066  }, {
3067    key: "notifyApplicationBeforeValidate",
3068    value: function notifyApplicationBeforeValidate(message, fields) {
3069      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:before-validate', {
3070        target: this.triggerEl,
3071        detail: {
3072          context: this.context,
3073          message: message,
3074          fields: fields
3075        }
3076      });
3077    }
3078  }, {
3079    key: "notifyApplicationBeforeReplace",
3080    value: function notifyApplicationBeforeReplace(target) {
3081      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:before-replace', {
3082        target: target
3083      });
3084    } // Window-based events
3085
3086  }, {
3087    key: "notifyApplicationBeforeSend",
3088    value: function notifyApplicationBeforeSend() {
3089      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:before-send', {
3090        target: window,
3091        detail: {
3092          context: this.context
3093        }
3094      });
3095    }
3096  }, {
3097    key: "notifyApplicationUpdateComplete",
3098    value: function notifyApplicationUpdateComplete(data, responseCode, xhr) {
3099      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:update-complete', {
3100        target: window,
3101        detail: {
3102          context: this.context,
3103          data: data,
3104          responseCode: responseCode,
3105          xhr: xhr
3106        }
3107      });
3108    }
3109  }, {
3110    key: "notifyApplicationFieldInvalid",
3111    value: function notifyApplicationFieldInvalid(element, fieldName, fieldMessages, isFirst) {
3112      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:invalid-field', {
3113        target: window,
3114        detail: {
3115          element: element,
3116          fieldName: fieldName,
3117          fieldMessages: fieldMessages,
3118          isFirst: isFirst
3119        }
3120      });
3121    }
3122  }, {
3123    key: "notifyApplicationConfirmMessage",
3124    value: function notifyApplicationConfirmMessage(message, promise) {
3125      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:confirm-message', {
3126        target: window,
3127        detail: {
3128          message: message,
3129          promise: promise
3130        }
3131      });
3132    }
3133  }, {
3134    key: "notifyApplicationErrorMessage",
3135    value: function notifyApplicationErrorMessage(message) {
3136      return (0,_util__WEBPACK_IMPORTED_MODULE_6__.dispatch)('ajax:error-message', {
3137        target: window,
3138        detail: {
3139          message: message
3140        }
3141      });
3142    } // HTTP request delegate
3143
3144  }, {
3145    key: "requestStarted",
3146    value: function requestStarted() {
3147      this.toggleLoaderState(true);
3148
3149      if (this.options.progressBar) {
3150        this.showProgressBarAfterDelay();
3151      }
3152    }
3153  }, {
3154    key: "requestProgressed",
3155    value: function requestProgressed(progress) {
3156      this.promise.notify(progress);
3157    }
3158  }, {
3159    key: "requestCompletedWithResponse",
3160    value: function requestCompletedWithResponse(response, statusCode) {
3161      this.actions.invoke('success', [response, statusCode, this.request.xhr]);
3162      this.actions.invoke('complete', [response, statusCode, this.request.xhr]);
3163      this.promise.resolve(response, statusCode, this.request.xhr);
3164    }
3165  }, {
3166    key: "requestFailedWithStatusCode",
3167    value: function requestFailedWithStatusCode(statusCode, response) {
3168      this.actions.invoke('error', [response, statusCode, this.request.xhr]);
3169      this.actions.invoke('complete', [response, statusCode, this.request.xhr]);
3170      this.promise.reject(response, statusCode, this.request.xhr);
3171    }
3172  }, {
3173    key: "requestFinished",
3174    value: function requestFinished() {
3175      this.toggleLoaderState(false);
3176
3177      if (this.options.progressBar) {
3178        this.hideProgressBar();
3179      }
3180    } // Private
3181
3182  }, {
3183    key: "initOtherElements",
3184    value: function initOtherElements() {
3185      if (typeof this.options.form === 'string') {
3186        this.formEl = document.querySelector(this.options.form);
3187      } else if (this.options.form) {
3188        this.formEl = this.options.form;
3189      } else {
3190        this.formEl = this.el && this.el !== document ? this.el.closest('form') : null;
3191      }
3192
3193      this.triggerEl = this.formEl ? this.formEl : this.el;
3194      this.loadingEl = typeof this.options.loading === 'string' ? document.querySelector(this.options.loading) : this.options.loading;
3195    }
3196  }, {
3197    key: "validateClientSideForm",
3198    value: function validateClientSideForm() {
3199      if (this.options.browserValidate && typeof document.createElement('input').reportValidity === 'function' && this.formEl && !this.formEl.checkValidity()) {
3200        this.formEl.reportValidity();
3201        return false;
3202      }
3203
3204      return true;
3205    }
3206  }, {
3207    key: "toggleLoaderState",
3208    value: function toggleLoaderState(isLoading) {
3209      if (!this.loadingEl) {
3210        return;
3211      }
3212
3213      if (typeof this.loadingEl.show !== 'function' || typeof this.loadingEl.hide !== 'function') {
3214        this.loadingEl.style.display = isLoading ? 'block' : 'none';
3215        return;
3216      }
3217
3218      if (isLoading) {
3219        this.loadingEl.show();
3220      } else {
3221        this.loadingEl.hide();
3222      }
3223    }
3224  }, {
3225    key: "showProgressBarAfterDelay",
3226    value: function showProgressBarAfterDelay() {
3227      this.progressBar.setValue(0);
3228      this.progressBarTimeout = window.setTimeout(this.showProgressBar, this.options.progressBarDelay);
3229    }
3230  }, {
3231    key: "hideProgressBar",
3232    value: function hideProgressBar() {
3233      this.progressBar.setValue(100);
3234      this.progressBar.hide();
3235
3236      if (this.progressBarTimeout != null) {
3237        window.clearTimeout(this.progressBarTimeout);
3238        delete this.progressBarTimeout;
3239      }
3240    }
3241  }], [{
3242    key: "DEFAULTS",
3243    get: function get() {
3244      return {
3245        handler: null,
3246        update: {},
3247        files: false,
3248        bulk: false,
3249        download: false,
3250        browserValidate: false,
3251        browserTarget: null,
3252        progressBarDelay: 500,
3253        progressBar: null
3254      };
3255    }
3256  }, {
3257    key: "send",
3258    value: function send(handler, options) {
3259      return new Request(document, handler, options).start();
3260    }
3261  }, {
3262    key: "sendElement",
3263    value: function sendElement(element, handler, options) {
3264      if (typeof element === 'string') {
3265        element = document.querySelector(element);
3266      }
3267
3268      return new Request(element, handler, options).start();
3269    }
3270  }]);
3271
3272  return Request;
3273}();
3274
3275/***/ }),
3276
3277/***/ "./src/util/deferred.js":
3278/*!******************************!*\
3279  !*** ./src/util/deferred.js ***!
3280  \******************************/
3281/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3282
3283__webpack_require__.r(__webpack_exports__);
3284/* harmony export */ __webpack_require__.d(__webpack_exports__, {
3285/* harmony export */   "Deferred": () => (/* binding */ Deferred),
3286/* harmony export */   "DeferredState": () => (/* binding */ DeferredState)
3287/* harmony export */ });
3288function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3289
3290function _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); } }
3291
3292function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3293
3294var DeferredState = {
3295  pending: 'pending',
3296  rejected: 'rejected',
3297  resolved: 'resolved'
3298};
3299var Deferred = /*#__PURE__*/function () {
3300  function Deferred(options) {
3301    _classCallCheck(this, Deferred);
3302
3303    this.options = options || {};
3304    this.stateStr = DeferredState.pending;
3305    this.successFuncs = [];
3306    this.failureFuncs = [];
3307    this.progressFuncs = [];
3308    this.resolveArgs = [];
3309    this.rejectArgs = [];
3310    this.progressArgs = [];
3311    this.isProgressNotified = false;
3312  } // Public
3313
3314
3315  _createClass(Deferred, [{
3316    key: "resolve",
3317    value: function resolve() {
3318      if (this.stateStr === DeferredState.pending) {
3319        this.resolveArgs = arguments;
3320        this.callFunction.call(this, this.successFuncs, this.resolveArgs);
3321        this.stateStr = DeferredState.resolved;
3322      }
3323
3324      return this;
3325    }
3326  }, {
3327    key: "reject",
3328    value: function reject() {
3329      if (this.stateStr === DeferredState.pending) {
3330        this.rejectArgs = arguments;
3331        this.callFunction.call(this, this.failureFuncs, this.rejectArgs);
3332        this.stateStr = DeferredState.rejected;
3333      }
3334
3335      return this;
3336    }
3337  }, {
3338    key: "notify",
3339    value: function notify() {
3340      if (this.stateStr === DeferredState.pending) {
3341        this.progressArgs = arguments;
3342        this.callFunction.call(this, this.progressFuncs, this.progressArgs);
3343        this.isProgressNotified = true;
3344      }
3345
3346      return this;
3347    }
3348  }, {
3349    key: "abort",
3350    value: function abort() {
3351      this.options.delegate && this.options.delegate.abort();
3352    }
3353  }, {
3354    key: "done",
3355    value: function done() {
3356      var argumentsArray = Array.prototype.slice.call(arguments);
3357      this.successFuncs = this.successFuncs.concat(argumentsArray);
3358
3359      if (this.stateStr === DeferredState.resolved) {
3360        this.callFunction.call(this, argumentsArray, this.resolveArgs);
3361      }
3362
3363      return this;
3364    }
3365  }, {
3366    key: "fail",
3367    value: function fail() {
3368      var argumentsArray = Array.prototype.slice.call(arguments);
3369      this.failureFuncs = this.failureFuncs.concat(argumentsArray);
3370
3371      if (this.stateStr === DeferredState.rejected) {
3372        this.callFunction.call(this, argumentsArray, this.rejectArgs);
3373      }
3374
3375      return this;
3376    }
3377  }, {
3378    key: "progress",
3379    value: function progress() {
3380      var argumentsArray = Array.prototype.slice.call(arguments);
3381      this.progressFuncs = this.progressFuncs.concat(argumentsArray);
3382
3383      if (this.stateStr === DeferredState.pending && this.isProgressNotified) {
3384        this.callFunction.call(this, argumentsArray, this.progressArgs);
3385      }
3386
3387      return this;
3388    }
3389  }, {
3390    key: "always",
3391    value: function always() {
3392      var argumentsArray = Array.prototype.slice.call(arguments);
3393      this.successFuncs = this.successFuncs.concat(argumentsArray);
3394      this.failureFuncs = this.failureFuncs.concat(argumentsArray);
3395
3396      if (this.stateStr !== DeferredState.pending) {
3397        this.callFunction.call(this, argumentsArray, this.resolveArgs || this.rejectArgs);
3398      }
3399
3400      return this;
3401    }
3402  }, {
3403    key: "then",
3404    value: function then() {
3405      var tempArgs = [];
3406
3407      for (var index in arguments) {
3408        var itemToPush;
3409
3410        if (Array.isArray(arguments[index])) {
3411          itemToPush = arguments[index];
3412        } else {
3413          itemToPush = [arguments[index]];
3414        }
3415
3416        tempArgs.push(itemToPush);
3417      }
3418
3419      this.done.apply(this, tempArgs[0]);
3420      this.fail.apply(this, tempArgs[1]);
3421      this.progress.apply(this, tempArgs[2]);
3422      return this;
3423    }
3424  }, {
3425    key: "promise",
3426    value: function promise() {
3427      var protectedNames = ['resolve', 'reject', 'promise', 'notify'];
3428      var result = {};
3429
3430      for (var key in this) {
3431        if (protectedNames.indexOf(key) === -1) {
3432          result[key] = this[key];
3433        }
3434      }
3435
3436      return result;
3437    }
3438  }, {
3439    key: "state",
3440    value: function state() {
3441      if (arguments.length > 0) {
3442        stateStr = arguments[0];
3443      }
3444
3445      return stateStr;
3446    } // Private
3447
3448  }, {
3449    key: "callFunction",
3450    value: function callFunction(functionDefinitionArray, functionArgumentArray, options) {
3451      options = options || {};
3452      var scope = options.scope || this;
3453
3454      for (var index in functionDefinitionArray) {
3455        var item = functionDefinitionArray[index];
3456
3457        if (typeof item === 'function') {
3458          item.apply(scope, functionArgumentArray);
3459        }
3460      }
3461    }
3462  }]);
3463
3464  return Deferred;
3465}();
3466
3467/***/ }),
3468
vendor: 4,306 bytes, lines 3469-3515
3469/***/ "./src/util/events.js":
3470/*!****************************!*\
3471  !*** ./src/util/events.js ***!
3472  \****************************/
3473/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3474
3475__webpack_require__.r(__webpack_exports__);
3476/* harmony export */ __webpack_require__.d(__webpack_exports__, {
3477/* harmony export */   "Events": () => (/* binding */ Events)
3478/* harmony export */ });
3479/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ "./src/util/index.js");
3480function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
3481
3482function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3483
3484function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3485
3486function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3487
3488function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3489
3490function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
3491
3492function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3493
3494function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3495
3496function _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); } }
3497
3498function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3499
3500
3501/**
3502 * Constants
3503 */
3504
3505var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
3506var stripNameRegex = /\..*/;
3507var stripUidRegex = /::\d+$/;
3508var eventRegistry = {}; // Events storage
3509
3510var uidEvent = 1;
3511var customEvents = {
3512  mouseenter: 'mouseover',
3513  mouseleave: 'mouseout'
3514};
3515var nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'ke
3515ypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
3516var Events = /*#__PURE__*/function () {
3517  function Events() {
3518    _classCallCheck(this, Events);
3519  }
3520
3521  _createClass(Events, null, [{
3522    key: "on",
3523    value: function on(element, event, handler, delegationFunction) {
3524      addHandler(element, event, handler, delegationFunction, false);
3525    }
3526  }, {
3527    key: "one",
3528    value: function one(element, event, handler, delegationFunction) {
3529      addHandler(element, event, handler, delegationFunction, true);
3530    }
3531  }, {
3532    key: "off",
3533    value: function off(element, originalTypeEvent, handler, delegationFunction) {
3534      if (typeof originalTypeEvent !== 'string' || !element) {
3535        return;
3536      }
3537
3538      var _normalizeParameters = normalizeParameters(originalTypeEvent, handler, delegationFunction),
3539          _normalizeParameters2 = _slicedToArray(_normalizeParameters, 3),
3540          isDelegated = _normalizeParameters2[0],
3541          callable = _normalizeParameters2[1],
3542          typeEvent = _normalizeParameters2[2];
3543
3544      var inNamespace = typeEvent !== originalTypeEvent;
3545      var events = getElementEvents(element);
3546      var storeElementEvent = events[typeEvent] || {};
3547      var isNamespace = originalTypeEvent.startsWith('.');
3548
3549      if (typeof callable !== 'undefined') {
3550        // Simplest case: handler is passed, remove that listener ONLY.
3551        if (!storeElementEvent) {
3552          return;
3553        }
3554
3555        removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
3556        return;
3557      }
3558
3559      if (isNamespace) {
3560        for (var _i2 = 0, _Object$keys = Object.keys(events); _i2 < _Object$keys.length; _i2++) {
3561          var elementEvent = _Object$keys[_i2];
3562          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
3563        }
3564      }
3565
3566      for (var _i3 = 0, _Object$keys2 = Object.keys(storeElementEvent); _i3 < _Object$keys2.length; _i3++) {
3567        var keyHandlers = _Object$keys2[_i3];
3568        var handlerKey = keyHandlers.replace(stripUidRegex, '');
3569
3570        if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
3571          var event = storeElementEvent[keyHandlers];
3572          removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
3573        }
3574      }
3575    }
3576  }, {
3577    key: "dispatch",
3578    value: function dispatch(eventName) {
3579      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
3580          target = _ref.target,
3581          detail = _ref.detail,
3582          _ref$cancelable = _ref.cancelable,
3583          cancelable = _ref$cancelable === void 0 ? true : _ref$cancelable;
3584
3585      return (0,_index__WEBPACK_IMPORTED_MODULE_0__.dispatch)(eventName, {
3586        target: target,
3587        detail: detail,
3588        cancelable: cancelable
3589      });
3590    }
3591  }]);
3592
3593  return Events;
3594}();
3595/**
3596 * Private methods
3597 */
3598
3599function makeEventUid(element, uid) {
3600  return uid && "".concat(uid, "::").concat(uidEvent++) || element.uidEvent || uidEvent++;
3601}
3602
3603function getElementEvents(element) {
3604  var uid = makeEventUid(element);
3605  element.uidEvent = uid;
3606  eventRegistry[uid] = eventRegistry[uid] || {};
3607  return eventRegistry[uid];
3608}
3609
3610function findHandler(events, callable) {
3611  var delegationSelector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
3612  return Object.values(events).find(function (event) {
3613    return event.callable === callable && event.delegationSelector === delegationSelector;
3614  });
3615}
3616
3617function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
3618  var isDelegated = typeof handler === 'string';
3619  var callable = isDelegated ? delegationFunction : handler;
3620  var typeEvent = getTypeEvent(originalTypeEvent);
3621
3622  if (!nativeEvents.has(typeEvent)) {
3623    typeEvent = originalTypeEvent;
3624  }
3625
3626  return [isDelegated, callable, typeEvent];
3627}
3628
3629function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
3630  if (typeof originalTypeEvent !== 'string' || !element) {
3631    return;
3632  }
3633
3634  var _normalizeParameters3 = normalizeParameters(originalTypeEvent, handler, delegationFunction),
3635      _normalizeParameters4 = _slicedToArray(_normalizeParameters3, 3),
3636      isDelegated = _normalizeParameters4[0],
3637      callable = _normalizeParameters4[1],
3638      typeEvent = _normalizeParameters4[2]; // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
3639  // this prevents the handler from being dispatched the same way as mouseover or mouseout does
3640
3641
3642  if (originalTypeEvent in customEvents) {
3643    var wrapFunction = function wrapFunction(fn) {
3644      return function (event) {
3645        if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
3646          return fn.call(this, event);
3647        }
3648      };
3649    };
3650
3651    callable = wrapFunction(callable);
3652  }
3653
3654  var events = getElementEvents(element);
3655  var handlers = events[typeEvent] || (events[typeEvent] = {});
3656  var previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
3657
3658  if (previousFunction) {
3659    previousFunction.oneOff = previousFunction.oneOff && oneOff;
3660    return;
3661  }
3662
3663  var uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
3664  var fn = isDelegated ? internalDelegationHandler(element, handler, callable) : internalHandler(element, callable);
3665  fn.delegationSelector = isDelegated ? handler : null;
3666  fn.callable = callable;
3667  fn.oneOff = oneOff;
3668  fn.uidEvent = uid;
3669  handlers[uid] = fn;
3670  element.addEventListener(typeEvent, fn);
3671}
3672
3673function removeHandler(element, events, typeEvent, handler, delegationSelector) {
3674  var fn = findHandler(events[typeEvent], handler, delegationSelector);
3675
3676  if (!fn) {
3677    return;
3678  }
3679
3680  element.removeEventListener(typeEvent, fn);
3681  delete events[typeEvent][fn.uidEvent];
3682}
3683
3684function internalHandler(element, fn) {
3685  return function handler(event) {
3686    event.delegateTarget = element;
3687
3688    if (handler.oneOff) {
3689      Events.off(element, event.type, fn);
3690    }
3691
3692    return fn.apply(element, [event]);
3693  };
3694}
3695
3696function internalDelegationHandler(element, selector, fn) {
3697  return function handler(event) {
3698    var domElements = element.querySelectorAll(selector);
3699
3700    for (var target = event.target; target && target !== this; target = target.parentNode) {
3701      var _iterator = _createForOfIteratorHelper(domElements),
3702          _step;
3703
3704      try {
3705        for (_iterator.s(); !(_step = _iterator.n()).done;) {
3706          var domElement = _step.value;
3707
3708          if (domElement !== target) {
3709            continue;
3710          }
3711
3712          event.delegateTarget = target;
3713
3714          if (handler.oneOff) {
3715            Events.off(element, event.type, selector, fn);
3716          }
3717
3718          return fn.apply(target, [event]);
3719        }
3720      } catch (err) {
3721        _iterator.e(err);
3722      } finally {
3723        _iterator.f();
3724      }
3725    }
3726  };
3727}
3728
3729function removeNamespacedHandlers(element, events, typeEvent, namespace) {
3730  var storeElementEvent = events[typeEvent] || {};
3731
3732  for (var _i4 = 0, _Object$keys3 = Object.keys(storeElementEvent); _i4 < _Object$keys3.length; _i4++) {
3733    var handlerKey = _Object$keys3[_i4];
3734
3735    if (handlerKey.includes(namespace)) {
3736      var event = storeElementEvent[handlerKey];
3737      removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
3738    }
3739  }
3740} // Allow to get the native events from namespaced events ('click.bs.button' --> 'click')
3741
3742
3743function getTypeEvent(event) {
3744  event = event.replace(stripNameRegex, '');
3745  return customEvents[event] || event;
3746}
3747
3748/***/ }),
3749
3750/***/ "./src/util/http-request.js":
3751/*!**********************************!*\
3752  !*** ./src/util/http-request.js ***!
3753  \**********************************/
3754/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3755
3756__webpack_require__.r(__webpack_exports__);
3757/* harmony export */ __webpack_require__.d(__webpack_exports__, {
3758/* harmony export */   "HttpRequest": () => (/* binding */ HttpRequest),
3759/* harmony export */   "SystemStatusCode": () => (/* binding */ SystemStatusCode)
3760/* harmony export */ });
3761/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./events */ "./src/util/events.js");
3762function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3763
3764function _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); } }
3765
3766function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3767
3768function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3769
3770
3771var SystemStatusCode = {
3772  networkFailure: 0,
3773  timeoutFailure: -1,
3774  contentTypeMismatch: -2,
3775  userAborted: -3
3776};
3777var HttpRequest = /*#__PURE__*/function () {
3778  function HttpRequest(delegate, url, options) {
3779    var _this = this;
3780
3781    _classCallCheck(this, HttpRequest);
3782
3783    this.failed = false;
3784    this.progress = 0;
3785    this.sent = false;
3786    this.delegate = delegate;
3787    this.url = url;
3788    this.options = options;
3789    this.headers = options.headers || {};
3790    this.method = options.method || 'GET';
3791    this.responseType = options.responseType || '';
3792    this.data = options.data; // XMLHttpRequest events
3793
3794    this.requestProgressed = function (event) {
3795      if (event.lengthComputable) {
3796        _this.setProgress(event.loaded / event.total);
3797      }
3798    };
3799
3800    this.requestLoaded = function () {
3801      _this.endRequest(function (xhr) {
3802        _this.processResponseData(xhr, function (xhr, data) {
3803          var contentType = xhr.getResponseHeader('Content-Type');
3804          var responseData = contentTypeIsJSON(contentType) ? JSON.parse(data) : data;
3805
3806          if (_this.options.htmlOnly && !contentTypeIsHTML(contentType)) {
3807            _this.failed = true;
3808
3809            _this.delegate.requestFailedWithStatusCode(SystemStatusCode.contentTypeMismatch);
3810
3811            return;
3812          }
3813
3814          if (xhr.status >= 200 && xhr.status < 300) {
3815            _this.delegate.requestCompletedWithResponse(responseData, xhr.status, contentResponseIsRedirect(xhr, _this.url));
3816          } else {
3817            _this.failed = true;
3818
3819            _this.delegate.requestFailedWithStatusCode(xhr.status, responseData);
3820          }
3821        });
3822      });
3823    };
3824
3825    this.requestFailed = function () {
3826      _this.endRequest(function () {
3827        _this.failed = true;
3828
3829        _this.delegate.requestFailedWithStatusCode(SystemStatusCode.networkFailure);
3830      });
3831    };
3832
3833    this.requestTimedOut = function () {
3834      _this.endRequest(function () {
3835        _this.failed = true;
3836
3837        _this.delegate.requestFailedWithStatusCode(SystemStatusCode.timeoutFailure);
3838      });
3839    };
3840
3841    this.requestCanceled = function () {
3842      if (_this.options.trackAbort) {
3843        _this.endRequest(function () {
3844          _this.failed = true;
3845
3846          _this.delegate.requestFailedWithStatusCode(SystemStatusCode.userAborted);
3847        });
3848      } else {
3849        _this.endRequest();
3850      }
3851    };
3852
3853    this.createXHR();
3854  }
3855
3856  _createClass(HttpRequest, [{
3857    key: "send",
3858    value: function send() {
3859      if (this.xhr && !this.sent) {
3860        this.notifyApplicationBeforeRequestStart();
3861        this.setProgress(0);
3862        this.xhr.send(this.data || null);
3863        this.sent = true;
3864        this.delegate.requestStarted();
3865      }
3866    }
3867  }, {
3868    key: "abort",
3869    value: function abort() {
3870      if (this.xhr && this.sent) {
3871        this.xhr.abort();
3872      }
3873    } // Application events
3874
3875  }, {
3876    key: "notifyApplicationBeforeRequestStart",
3877    value: function notifyApplicationBeforeRequestStart() {
3878      _events__WEBPACK_IMPORTED_MODULE_0__.Events.dispatch('ajax:request-start', {
3879        detail: {
3880          url: this.url,
3881          xhr: this.xhr
3882        },
3883        cancelable: false
3884      });
3885    }
3886  }, {
3887    key: "notifyApplicationAfterRequestEnd",
3888    value: function notifyApplicationAfterRequestEnd() {
3889      _events__WEBPACK_IMPORTED_MODULE_0__.Events.dispatch('ajax:request-end', {
3890        detail: {
3891          url: this.url,
3892          xhr: this.xhr
3893        },
3894        cancelable: false
3895      });
3896    } // Private
3897
3898  }, {
3899    key: "createXHR",
3900    value: function createXHR() {
3901      var xhr = this.xhr = new XMLHttpRequest();
3902      var timeout = HttpRequest.timeout * 1000;
3903      xhr.open(this.method, this.url, true);
3904      xhr.timeout = timeout;
3905      xhr.responseType = this.responseType;
3906      xhr.onprogress = this.requestProgressed;
3907      xhr.onload = this.requestLoaded;
3908      xhr.onerror = this.requestFailed;
3909      xhr.ontimeout = this.requestTimedOut;
3910      xhr.onabort = this.requestCanceled;
3911
3912      for (var i in this.headers) {
3913        xhr.setRequestHeader(i, this.headers[i]);
3914      }
3915
3916      return xhr;
3917    }
3918  }, {
3919    key: "endRequest",
3920    value: function endRequest() {
3921      var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
3922
3923      if (this.xhr) {
3924        this.notifyApplicationAfterRequestEnd();
3925        callback(this.xhr);
3926        this.destroy();
3927      }
3928    }
3929  }, {
3930    key: "setProgress",
3931    value: function setProgress(progress) {
3932      this.progress = progress;
3933      this.delegate.requestProgressed(progress);
3934    }
3935  }, {
3936    key: "destroy",
3937    value: function destroy() {
3938      this.setProgress(1);
3939      this.delegate.requestFinished();
3940    }
3941  }, {
3942    key: "processResponseData",
3943    value: function processResponseData(xhr, callback) {
3944      if (this.responseType !== 'blob') {
3945        callback(xhr, xhr.responseText);
3946        return;
3947      } // Confirm response is a download
3948
3949
3950      var contentDisposition = xhr.getResponseHeader('Content-Disposition') || '';
3951
3952      if (contentDisposition.indexOf('attachment') === 0 || contentDisposition.indexOf('inline') === 0) {
3953        callback(xhr, xhr.response);
3954        return;
3955      } // Convert blob to text
3956
3957
3958      var reader = new FileReader();
3959      reader.addEventListener('load', function () {
3960        callback(xhr, reader.result);
3961      });
3962      reader.readAsText(xhr.response);
3963    }
3964  }]);
3965
3966  return HttpRequest;
3967}();
3968
3969_defineProperty(HttpRequest, "timeout", 240);
3970
3971function contentResponseIsRedirect(xhr, url) {
3972  if (xhr.getResponseHeader('X-OCTOBER-LOCATION')) {
3973    return xhr.getResponseHeader('X-OCTOBER-LOCATION');
3974  }
3975
3976  var anchorMatch = url.match(/^(.*)#/),
3977      wantUrl = anchorMatch ? anchorMatch[1] : url;
3978  return wantUrl !== xhr.responseURL ? xhr.responseURL : null;
3979}
3980
3981function contentTypeIsHTML(contentType) {
3982  return (contentType || '').match(/^text\/html|^application\/xhtml\+xml/);
3983}
3984
3985function contentTypeIsJSON(contentType) {
3986  return (contentType || '').includes('application/json');
3987}
3988
3989/***/ }),
3990
3991/***/ "./src/util/index.js":
3992/*!***************************!*\
3993  !*** ./src/util/index.js ***!
3994  \***************************/
3995/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3996
3997__webpack_require__.r(__webpack_exports__);
3998/* harmony export */ __webpack_require__.d(__webpack_exports__, {
3999/* harmony export */   "array": () => (/* binding */ array),
4000/* harmony export */   "defer": () => (/* binding */ defer),
4001/* harmony export */   "dispatch": () => (/* binding */ dispatch),
4002/* harmony export */   "unindent": () => (/* binding */ unindent),
4003/* harmony export */   "uuid": () => (/* binding */ uuid)
4004/* harmony export */ });
4005function dispatch(eventName) {
4006  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
4007      target = _ref.target,
4008      detail = _ref.detail,
4009      _ref$cancelable = _ref.cancelable,
4010      cancelable = _ref$cancelable === void 0 ? true : _ref$cancelable;
4011
4012  var event = new CustomEvent(eventName, {
4013    bubbles: true,
4014    cancelable: cancelable === true,
4015    detail: detail || {}
4016  });
4017  (target || document).dispatchEvent(event);
4018  return event;
4019}
4020function defer(callback) {
4021  setTimeout(callback, 1);
4022}
4023function unindent(strings) {
4024  for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4025    values[_key - 1] = arguments[_key];
4026  }
4027
4028  var lines = trimLeft(interpolate(strings, values)).split("\n");
4029  var match = lines[0].match(/^\s+/);
4030  var indent = match ? match[0].length : 0;
4031  return lines.map(function (line) {
4032    return line.slice(indent);
4033  }).join("\n");
4034}
4035
4036function trimLeft(string) {
4037  return string.replace(/^\n/, "");
4038}
4039
4040function interpolate(strings, values) {
4041  return strings.reduce(function (result, string, i) {
4042    var value = values[i] == undefined ? "" : values[i];
4043    return result + string + value;
4044  }, "");
4045}
4046
4047function array(values) {
4048  return Array.prototype.slice.call(values);
4049}
4050function uuid() {
4051  return Array.apply(null, {
4052    length: 36
4053  }).map(function (_, i) {
4054    if (i == 8 || i == 13 || i == 18 || i == 23) {
4055      return "-";
4056    } else if (i == 14) {
4057      return "4";
4058    } else if (i == 19) {
4059      return (Math.floor(Math.random() * 4) + 8).toString(16);
4060    } else {
4061      return Math.floor(Math.random() * 15).toString(16);
4062    }
4063  }).join("");
4064}
4065
4066/***/ })
vendor: 3,525 bytes, lines 4066-4153
4066
4067
4068/******/ 	});
4069/************************************************************************/
4070/******/ 	// The module cache
4071/******/ 	var __webpack_module_cache__ = {};
4072/******/ 	
4073/******/ 	// The require function
4074/******/ 	function __webpack_require__(moduleId) {
4075/******/ 		// Check if module is in cache
4076/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
4077/******/ 		if (cachedModule !== undefined) {
4078/******/ 			return cachedModule.exports;
4079/******/ 		}
4080/******/ 		// Create a new module (and put it into the cache)
4081/******/ 		var module = __webpack_module_cache__[moduleId] = {
4082/******/ 			// no module.id needed
4083/******/ 			// no module.loaded needed
4084/******/ 			exports: {}
4085/******/ 		};
4086/******/ 	
4087/******/ 		// Execute the module function
4088/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
4089/******/ 	
4090/******/ 		// Return the exports of the module
4091/******/ 		return module.exports;
4092/******/ 	}
4093/******/ 	
4094/************************************************************************/
4095/******/ 	/* webpack/runtime/amd options */
4096/******/ 	(() => {
4097/******/ 		__webpack_require__.amdO = {};
4098/******/ 	})();
4099/******/ 	
4100/******/ 	/* webpack/runtime/define property getters */
4101/******/ 	(() => {
4102/******/ 		// define getter functions for harmony exports
4103/******/ 		__webpack_require__.d = (exports, definition) => {
4104/******/ 			for(var key in definition) {
4105/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
4106/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
4107/******/ 				}
4108/******/ 			}
4109/******/ 		};
4110/******/ 	})();
4111/******/ 	
4112/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
4113/******/ 	(() => {
4114/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
4115/******/ 	})();
4116/******/ 	
4117/******/ 	/* webpack/runtime/make namespace object */
4118/******/ 	(() => {
4119/******/ 		// define __esModule on exports
4120/******/ 		__webpack_require__.r = (exports) => {
4121/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
4122/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4123/******/ 			}
4124/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
4125/******/ 		};
4126/******/ 	})();
4127/******/ 	
4128/************************************************************************/
4129var __webpack_exports__ = {};
4130// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
4131(() => {
4132/*!*********************************!*\
4133  !*** ./src/framework-extras.js ***!
4134  \*********************************/
4135__webpack_require__.r(__webpack_exports__);
4136/* harmony import */ var _request_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./request/index */ "./src/request/index.js");
4137/* harmony import */ var _framework_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./framework/index */ "./src/framework/index.js");
4138/* harmony import */ var _extras_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extras/index */ "./src/extras/index.js");
4139/**
4140 * --------------------------------------------------------------------------
4141 * October CMS: Frontend JavaScript Framework
4142 * https://octobercms.com
4143 * --------------------------------------------------------------------------
4144 * Copyright 2013-2022 Alexey Bobkov, Samuel Georges
4145 * --------------------------------------------------------------------------
4146 */
4147
4148
4149
4150})();
4151
4152/******/ })()
4153;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.