PluginProbe ʕ •ᴥ•ʔ
Conditional Fields for Contact Form 7 / 2.3
Conditional Fields for Contact Form 7 v2.3
2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 2.7.3 2.7.2 0.2.4 0.2.5 0.2.6 0.2.7 0.2.8 0.2.9 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.4 1.4.1 1.4.2 1.4.3 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6.1 1.6.2 1.6.3 1.6.5 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.8 1.7.9 1.8 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2 2.2.1 2.2.10 2.2.11 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.10 2.3.11 2.3.12 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.7 2.7.1 trunk 0.1 0.1.1 0.1.2 0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.2 0.2.1 0.2.2 0.2.3
cf7-conditional-fields / js / scripts.js
cf7-conditional-fields / js Last commit date
polyfill.js 3 years ago scripts.js 3 years ago scripts.js.map 3 years ago scripts_admin copy.js 4 years ago scripts_admin.js 4 years ago scripts_admin_all_pages.js 5 years ago scripts_es6.js 3 years ago temp.js 4 years ago
scripts.js
4137 lines
1 /******/ (function(modules) { // webpackBootstrap
2 /******/ // The module cache
3 /******/ var installedModules = {};
4 /******/
5 /******/ // The require function
6 /******/ function __webpack_require__(moduleId) {
7 /******/
8 /******/ // Check if module is in cache
9 /******/ if(installedModules[moduleId]) {
10 /******/ return installedModules[moduleId].exports;
11 /******/ }
12 /******/ // Create a new module (and put it into the cache)
13 /******/ var module = installedModules[moduleId] = {
14 /******/ i: moduleId,
15 /******/ l: false,
16 /******/ exports: {}
17 /******/ };
18 /******/
19 /******/ // Execute the module function
20 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 /******/
22 /******/ // Flag the module as loaded
23 /******/ module.l = true;
24 /******/
25 /******/ // Return the exports of the module
26 /******/ return module.exports;
27 /******/ }
28 /******/
29 /******/
30 /******/ // expose the modules object (__webpack_modules__)
31 /******/ __webpack_require__.m = modules;
32 /******/
33 /******/ // expose the module cache
34 /******/ __webpack_require__.c = installedModules;
35 /******/
36 /******/ // define getter function for harmony exports
37 /******/ __webpack_require__.d = function(exports, name, getter) {
38 /******/ if(!__webpack_require__.o(exports, name)) {
39 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40 /******/ }
41 /******/ };
42 /******/
43 /******/ // define __esModule on exports
44 /******/ __webpack_require__.r = function(exports) {
45 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47 /******/ }
48 /******/ Object.defineProperty(exports, '__esModule', { value: true });
49 /******/ };
50 /******/
51 /******/ // create a fake namespace object
52 /******/ // mode & 1: value is a module id, require it
53 /******/ // mode & 2: merge all properties of value into the ns
54 /******/ // mode & 4: return value when already ns object
55 /******/ // mode & 8|1: behave like require
56 /******/ __webpack_require__.t = function(value, mode) {
57 /******/ if(mode & 1) value = __webpack_require__(value);
58 /******/ if(mode & 8) return value;
59 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60 /******/ var ns = Object.create(null);
61 /******/ __webpack_require__.r(ns);
62 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64 /******/ return ns;
65 /******/ };
66 /******/
67 /******/ // getDefaultExport function for compatibility with non-harmony modules
68 /******/ __webpack_require__.n = function(module) {
69 /******/ var getter = module && module.__esModule ?
70 /******/ function getDefault() { return module['default']; } :
71 /******/ function getModuleExports() { return module; };
72 /******/ __webpack_require__.d(getter, 'a', getter);
73 /******/ return getter;
74 /******/ };
75 /******/
76 /******/ // Object.prototype.hasOwnProperty.call
77 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78 /******/
79 /******/ // __webpack_public_path__
80 /******/ __webpack_require__.p = "";
81 /******/
82 /******/
83 /******/ // Load entry module and return exports
84 /******/ return __webpack_require__(__webpack_require__.s = 0);
85 /******/ })
86 /************************************************************************/
87 /******/ ({
88
89 /***/ "./js/polyfill.js":
90 /*!************************!*\
91 !*** ./js/polyfill.js ***!
92 \************************/
93 /*! no static exports found */
94 /***/ (function(module, exports) {
95
96 // endsWith polyfill
97 if (!String.prototype.endsWith) {
98 String.prototype.endsWith = function (search, thisLength) {
99 if (thisLength === undefined || thisLength > this.length) {
100 thisLength = this.length;
101 }
102
103 return this.substring(thisLength - search.length, thisLength) === search;
104 };
105 } // Object.values polyfill
106
107
108 if (!Object.values) Object.values = function (o) {
109 return Object.keys(o).map(function (k) {
110 return o[k];
111 });
112 }; // Array.from polyfill
113
114 if (!Array.from) {
115 Array.from = function () {
116 var toStr = Object.prototype.toString;
117
118 var isCallable = function isCallable(fn) {
119 return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
120 };
121
122 var toInteger = function toInteger(value) {
123 var number = Number(value);
124
125 if (isNaN(number)) {
126 return 0;
127 }
128
129 if (number === 0 || !isFinite(number)) {
130 return number;
131 }
132
133 return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
134 };
135
136 var maxSafeInteger = Math.pow(2, 53) - 1;
137
138 var toLength = function toLength(value) {
139 var len = toInteger(value);
140 return Math.min(Math.max(len, 0), maxSafeInteger);
141 }; // The length property of the from method is 1.
142
143
144 return function from(arrayLike
145 /*, mapFn, thisArg */
146 ) {
147 // 1. Let C be the this value.
148 var C = this; // 2. Let items be ToObject(arrayLike).
149
150 var items = Object(arrayLike); // 3. ReturnIfAbrupt(items).
151
152 if (arrayLike == null) {
153 throw new TypeError("Array.from requires an array-like object - not null or undefined");
154 } // 4. If mapfn is undefined, then let mapping be false.
155
156
157 var mapFn = arguments.length > 1 ? arguments[1] : void undefined;
158 var T;
159
160 if (typeof mapFn !== 'undefined') {
161 // 5. else
162 // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
163 if (!isCallable(mapFn)) {
164 throw new TypeError('Array.from: when provided, the second argument must be a function');
165 } // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
166
167
168 if (arguments.length > 2) {
169 T = arguments[2];
170 }
171 } // 10. Let lenValue be Get(items, "length").
172 // 11. Let len be ToLength(lenValue).
173
174
175 var len = toLength(items.length); // 13. If IsConstructor(C) is true, then
176 // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
177 // 14. a. Else, Let A be ArrayCreate(len).
178
179 var A = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0.
180
181 var k = 0; // 17. Repeat, while k < len… (also steps a - h)
182
183 var kValue;
184
185 while (k < len) {
186 kValue = items[k];
187
188 if (mapFn) {
189 A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
190 } else {
191 A[k] = kValue;
192 }
193
194 k += 1;
195 } // 18. Let putStatus be Put(A, "length", len, true).
196
197
198 A.length = len; // 20. Return A.
199
200 return A;
201 };
202 }();
203 }
204
205 /***/ }),
206
207 /***/ "./js/scripts_es6.js":
208 /*!***************************!*\
209 !*** ./js/scripts_es6.js ***!
210 \***************************/
211 /*! no exports provided */
212 /***/ (function(module, __webpack_exports__, __webpack_require__) {
213
214 "use strict";
215 __webpack_require__.r(__webpack_exports__);
216 /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
217 /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
218 /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js");
219 /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__);
220 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
221 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__);
222 /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
223 /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__);
224 /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
225 /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__);
226 // disable client side validation introduced in CF7 5.6 for now
227
228
229
230
231
232
233
234 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
235
236 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
237
238 if (typeof wpcf7 !== 'undefined') {
239 wpcf7.validate = function (a, b) {
240 return null;
241 };
242 }
243
244 var cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon
245
246 var wpcf7cf_timeout;
247 var wpcf7cf_change_time_ms = 100; // the timeout after a change in the form is detected
248
249 if (window.wpcf7 && !wpcf7.setStatus) {
250 wpcf7.setStatus = function (form, status) {
251 form = form.length ? form[0] : form; // if form is a jQuery object, only grab te html-element
252
253 var defaultStatuses = new Map([// 0: Status in API response, 1: Status in HTML class
254 ['init', 'init'], ['validation_failed', 'invalid'], ['acceptance_missing', 'unaccepted'], ['spam', 'spam'], ['aborted', 'aborted'], ['mail_sent', 'sent'], ['mail_failed', 'failed'], ['submitting', 'submitting'], ['resetting', 'resetting']]);
255
256 if (defaultStatuses.has(status)) {
257 status = defaultStatuses.get(status);
258 }
259
260 if (!Array.from(defaultStatuses.values()).includes(status)) {
261 status = status.replace(/[^0-9a-z]+/i, ' ').trim();
262 status = status.replace(/\s+/, '-');
263 status = "custom-".concat(status);
264 }
265
266 var prevStatus = form.getAttribute('data-status');
267 form.wpcf7.status = status;
268 form.setAttribute('data-status', status);
269 form.classList.add(status);
270
271 if (prevStatus && prevStatus !== status) {
272 form.classList.remove(prevStatus);
273 }
274
275 return status;
276 };
277 }
278
279 if (window.wpcf7cf_running_tests) {
280 jQuery('input[name="_wpcf7cf_options"]').each(function (e) {
281 var $input = jQuery(this);
282 var opt = JSON.parse($input.val());
283 opt.settings.animation_intime = 0;
284 opt.settings.animation_outtime = 0;
285 $input.val(JSON.stringify(opt));
286 });
287 wpcf7cf_change_time_ms = 0;
288 }
289
290 var wpcf7cf_show_animation = {
291 "height": "show",
292 "marginTop": "show",
293 "marginBottom": "show",
294 "paddingTop": "show",
295 "paddingBottom": "show"
296 };
297 var wpcf7cf_hide_animation = {
298 "height": "hide",
299 "marginTop": "hide",
300 "marginBottom": "hide",
301 "paddingTop": "hide",
302 "paddingBottom": "hide"
303 };
304 var wpcf7cf_show_step_animation = {
305 "opacity": "show"
306 };
307 var wpcf7cf_hide_step_animation = {
308 "opacity": "hide"
309 };
310 var wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf changedisabledprop.wpcf7cf';
311 var wpcf7cf_forms = [];
312
313 var Wpcf7cfForm = function Wpcf7cfForm($form) {
314 var options_element = $form.find('input[name="_wpcf7cf_options"]').eq(0);
315
316 if (!options_element.length || !options_element.val()) {
317 // doesn't look like a CF7 form created with conditional fields plugin enabled.
318 return false;
319 }
320
321 var form = this;
322 var form_options = JSON.parse(options_element.val());
323 form.$form = $form;
324 form.$input_hidden_group_fields = $form.find('[name="_wpcf7cf_hidden_group_fields"]');
325 form.$input_hidden_groups = $form.find('[name="_wpcf7cf_hidden_groups"]');
326 form.$input_visible_groups = $form.find('[name="_wpcf7cf_visible_groups"]');
327 form.$input_repeaters = $form.find('[name="_wpcf7cf_repeaters"]');
328 form.$input_steps = $form.find('[name="_wpcf7cf_steps"]');
329 form.unit_tag = $form.closest('.wpcf7').attr('id');
330 form.conditions = form_options['conditions'];
331 form.simpleDom = null;
332
333 form.reloadSimpleDom = function () {
334 form.simpleDom = wpcf7cf.get_simplified_dom_model(form.$form[0]);
335 }; // quicker than reloading the simpleDom completely with reloadSimpleDom
336
337
338 form.updateSimpleDom = function () {
339 if (!form.simpleDom) {
340 form.reloadSimpleDom();
341 }
342
343 var inputs = Object.values(form.simpleDom).filter(function (item) {
344 return item.type === 'input';
345 });
346 var formdata = new FormData(form.$form[0]);
347
348 var formdataEntries = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(formdata.entries()).map(function (entry) {
349 var _entry$1$name;
350
351 return [entry[0], (_entry$1$name = entry[1].name) !== null && _entry$1$name !== void 0 ? _entry$1$name : entry[1]];
352 });
353
354 var buttonEntries = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(jQuery('button', form.$form)).map(function (entry) {
355 return [entry.name, entry.value];
356 });
357
358 formdataEntries = formdataEntries.concat(buttonEntries);
359 inputs.forEach(function (simpleDomItem) {
360 var newValue = form.getNewDomValueIfChanged(simpleDomItem, formdataEntries);
361
362 if (newValue !== null) {
363 form.simpleDom[simpleDomItem.name].val = newValue;
364 }
365 });
366 };
367
368 form.isDomMatch = function (simpleDomItem, formDataEntries) {
369 var simpleDomItemName = simpleDomItem.name;
370 var simpleDomItemValues = simpleDomItem.val;
371 var currentValues = formDataEntries.filter(function (entry) {
372 return entry[0] === simpleDomItemName;
373 }).map(function (entry) {
374 return entry[1];
375 });
376 return currentValues.join('|') === simpleDomItemValues.join('|');
377 };
378 /**
379 *
380 * @param {*} simpleDomItem
381 * @param {*} formDataEntries
382 * @returns the new value, or NULL if no change
383 */
384
385
386 form.getNewDomValueIfChanged = function (simpleDomItem, formDataEntries) {
387 var simpleDomItemName = simpleDomItem.name;
388 var simpleDomItemValues = simpleDomItem.val;
389 var currentValues = formDataEntries.filter(function (entry) {
390 return entry[0] === simpleDomItemName;
391 }).map(function (entry) {
392 return entry[1];
393 });
394 return currentValues.join('|') === simpleDomItemValues.join('|') ? null : currentValues;
395 }; // Wrapper around jQuery(selector, form.$form)
396
397
398 form.get = function (selector) {
399 // TODO: implement some caching here.
400 return jQuery(selector, form.$form);
401 };
402
403 form.getFieldByName = function (name) {
404 return form.simpleDom[name] || form.simpleDom[name + '[]'];
405 }; // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
406
407
408 for (var i = 0; i < form.conditions.length; i++) {
409 var condition = form.conditions[i];
410
411 if (!('and_rules' in condition)) {
412 condition.and_rules = [{
413 'if_field': condition.if_field,
414 'if_value': condition.if_value,
415 'operator': condition.operator
416 }];
417 }
418 }
419
420 form.initial_conditions = form.conditions;
421 form.settings = form_options['settings'];
422 form.$groups = jQuery(); // empty jQuery set
423
424 form.repeaters = [];
425 form.multistep = null;
426 form.fields = [];
427 form.settings.animation_intime = parseInt(form.settings.animation_intime);
428 form.settings.animation_outtime = parseInt(form.settings.animation_outtime);
429
430 if (form.settings.animation === 'no') {
431 form.settings.animation_intime = 0;
432 form.settings.animation_outtime = 0;
433 }
434
435 form.updateGroups();
436 form.updateEventListeners();
437 form.displayFields(); // bring form in initial state if the reset event is fired on it.
438 // (CF7 triggers the 'reset' event by default on each successfully submitted form)
439
440 form.$form.on('reset.wpcf7cf', form, function (e) {
441 var form = e.data;
442 setTimeout(function () {
443 form.reloadSimpleDom();
444 form.displayFields();
445 form.resetRepeaters();
446
447 if (form.multistep != null) {
448 form.multistep.moveToStep(1, false);
449 }
450
451 setTimeout(function () {
452 if (form.$form.hasClass('sent')) {
453 jQuery('.wpcf7-response-output', form.$form)[0].scrollIntoView({
454 behavior: "smooth",
455 block: "nearest",
456 inline: "nearest"
457 });
458 }
459 }, 400);
460 }, 200);
461 }); // PRO ONLY
462
463 form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function () {
464 form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form));
465 });
466 form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
467 return item.params.$repeater.id;
468 })));
469 var $multistep = form.get('.wpcf7cf_multistep');
470
471 if ($multistep.length) {
472 form.multistep = new Wpcf7cfMultistep($multistep, form); // window.wpcf7cf.updateMultistepState(form.multistep);
473 } // END PRO ONLY
474
475 };
476 /**
477 * reset initial number of subs for each repeater.
478 * (does not clear values)
479 */
480
481
482 Wpcf7cfForm.prototype.resetRepeaters = function () {
483 var form = this;
484 form.repeaters.forEach(function (repeater) {
485 repeater.updateSubs(repeater.params.$repeater.initial_subs);
486 });
487 };
488
489 Wpcf7cfForm.prototype.displayFields = function () {
490 var form = this;
491 var wpcf7cf_conditions = this.conditions;
492 var wpcf7cf_settings = this.settings; //for compatibility with contact-form-7-signature-addon
493
494 if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0) {
495 for (var i = 0; i < signatures.length; i++) {
496 if (signatures[i].canvas.width === 0) {
497 var $sig_canvas = jQuery(".wpcf7-form-control-signature-body>canvas");
498 var $sig_wrap = jQuery(".wpcf7-form-control-signature-wrap");
499 $sig_canvas.eq(i).attr('width', $sig_wrap.width());
500 $sig_canvas.eq(i).attr('height', $sig_wrap.height());
501 cf7signature_resized = 1;
502 }
503 }
504 }
505
506 form.$groups.addClass('wpcf7cf-hidden');
507
508 for (var _i = 0; _i < wpcf7cf_conditions.length; _i++) {
509 var condition = wpcf7cf_conditions[_i];
510 var show_group = window.wpcf7cf.should_group_be_shown(condition, form);
511
512 if (show_group) {
513 form.get('[data-id="' + condition.then_field + '"]').removeClass('wpcf7cf-hidden');
514 }
515 }
516
517 var animation_intime = wpcf7cf_settings.animation_intime;
518 var animation_outtime = wpcf7cf_settings.animation_outtime;
519 form.$groups.each(function (index) {
520 var $group = jQuery(this);
521
522 if ($group.is(':animated')) {
523 $group.finish(); // stop any current animations on the group
524 }
525
526 if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) {
527 if ($group.prop('tagName') === 'SPAN') {
528 $group.show().trigger('wpcf7cf_show_group'); // show instantly
529 } else {
530 $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show with animation
531 }
532
533 if ($group.attr('data-disable_on_hide') !== undefined) {
534 $group.find(':input').prop('disabled', false).trigger('changedisabledprop.wpcf7cf');
535 $group.find('.wpcf7-form-control-wrap').removeClass('wpcf7cf-disabled');
536 }
537 } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) {
538 if ($group.attr('data-clear_on_hide') !== undefined) {
539 var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden');
540 $inputs.each(function () {
541 var $this = jQuery(this);
542 $this.val(this.defaultValue);
543 $this.prop('checked', this.defaultChecked);
544 });
545 jQuery('option', $group).each(function () {
546 this.selected = this.defaultSelected;
547 });
548 jQuery('select', $group).each(function () {
549 var $select = jQuery(this);
550
551 if ($select.val() === null) {
552 $select.val(jQuery("option:first", $select).val());
553 }
554 });
555 $inputs.each(function () {
556 this.dispatchEvent(new Event("change", {
557 "bubbles": true
558 }));
559 });
560 }
561
562 if ($group.prop('tagName') === 'SPAN') {
563 $group.hide().trigger('wpcf7cf_hide_group');
564 } else {
565 $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide
566 }
567 }
568 });
569 form.updateHiddenFields();
570 form.updateSummaryFields();
571 };
572
573 Wpcf7cfForm.prototype.updateSummaryFields = function () {
574 var form = this;
575 var $summary = form.get('.wpcf7cf-summary');
576
577 if ($summary.length == 0 || !$summary.is(':visible')) {
578 return;
579 }
580
581 var fd = new FormData();
582 var formdata = form.$form.serializeArray();
583 jQuery.each(formdata, function (key, input) {
584 fd.append(input.name, input.value);
585 }); // Make sure to add file fields to FormData
586
587 jQuery.each(form.$form.find('input[type="file"]'), function (index, el) {
588 if (!el.files.length) return true; // continue
589
590 var fieldName = el.name;
591 fd.append(fieldName, new Blob(), Array.from(el.files).map(function (file) {
592 return file.name;
593 }).join(', '));
594 }); // add file fields to form-data
595
596 jQuery.ajax({
597 url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
598 type: 'POST',
599 data: fd,
600 processData: false,
601 contentType: false,
602 dataType: 'json',
603 success: function success(json) {
604 $summary.html(json.summaryHtml);
605 }
606 });
607 };
608
609 Wpcf7cfForm.prototype.updateHiddenFields = function () {
610 var form = this;
611 var hidden_fields = [];
612 var hidden_groups = [];
613 var visible_groups = [];
614 form.$groups.each(function () {
615 var $group = jQuery(this);
616
617 if ($group.hasClass('wpcf7cf-hidden')) {
618 hidden_groups.push($group.attr('data-id'));
619
620 if ($group.attr('data-disable_on_hide') !== undefined) {
621 // fields inside hidden disable_on_hide group
622 $group.find('input,select,textarea').each(function () {
623 var $this = jQuery(this);
624
625 if (!$this.prop('disabled')) {
626 $this.prop('disabled', true).trigger('changedisabledprop.wpcf7cf');
627 } // if there's no other field with the same name visible in the form
628 // then push this field to hidden_fields
629
630
631 if (form.$form.find("[data-class=\"wpcf7cf_group\"]:not(.wpcf7cf-hidden) [name='".concat($this.attr('name'), "']")).length === 0) {
632 hidden_fields.push($this.attr('name'));
633 }
634 });
635 $group.find('.wpcf7-form-control-wrap').addClass('wpcf7cf-disabled');
636 } else {
637 // fields inside regular hidden group are all pushed to hidden_fields
638 $group.find('input,select,textarea').each(function () {
639 hidden_fields.push(jQuery(this).attr('name'));
640 });
641 }
642 } else {
643 visible_groups.push($group.attr('data-id'));
644 }
645 });
646 form.hidden_fields = hidden_fields;
647 form.hidden_groups = hidden_groups;
648 form.visible_groups = visible_groups;
649 form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields));
650 form.$input_hidden_groups.val(JSON.stringify(hidden_groups));
651 form.$input_visible_groups.val(JSON.stringify(visible_groups));
652 return true;
653 };
654
655 Wpcf7cfForm.prototype.updateGroups = function () {
656 var form = this;
657 form.$groups = form.$form.find('[data-class="wpcf7cf_group"]');
658 form.$groups.height('auto');
659 form.conditions = window.wpcf7cf.get_nested_conditions(form);
660 };
661
662 Wpcf7cfForm.prototype.updateEventListeners = function () {
663 var form = this; // monitor input changes, and call displayFields() if something has changed
664
665 form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events, form, function (e) {
666 var form = e.data;
667 clearTimeout(wpcf7cf_timeout);
668 wpcf7cf_timeout = setTimeout(function () {
669 window.wpcf7cf.updateMultistepState(form.multistep);
670 form.updateSimpleDom();
671 form.displayFields();
672 }, wpcf7cf_change_time_ms);
673 }); // PRO ONLY
674
675 form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf', function () {
676 var $this = jQuery(this);
677
678 if ($this.text() === $this.attr('data-val-1')) {
679 $this.text($this.attr('data-val-2'));
680 $this.val($this.attr('data-val-2'));
681 } else {
682 $this.text($this.attr('data-val-1'));
683 $this.val($this.attr('data-val-1'));
684 }
685 }); // END PRO ONLY
686 }; // PRO ONLY
687
688
689 function Wpcf7cfRepeater($repeater, form) {
690 var $ = jQuery;
691 var thisRepeater = this;
692 var wpcf7cf_settings = form.settings;
693 thisRepeater.form = form;
694 $repeater.parentRepeaters = Array.from($repeater.parents('.wpcf7cf_repeater').map(function () {
695 return this.getAttribute('data-id');
696 })).reverse();
697 $repeater.num_subs = 0;
698 $repeater.id = $repeater.attr('data-id');
699 $repeater.orig_id = $repeater.attr('data-orig_data_id');
700 $repeater.min = typeof $repeater.attr('data-min') !== 'undefined' ? parseInt($repeater.attr('data-min')) : 1;
701 $repeater.max = typeof $repeater.attr('data-max') !== 'undefined' ? parseInt($repeater.attr('data-max')) : 200;
702 $repeater.initial_subs = typeof $repeater.attr('data-initial') !== 'undefined' ? parseInt($repeater.attr('data-initial')) : $repeater.min;
703
704 if ($repeater.initial_subs > $repeater.max) {
705 $repeater.initial_subs = $repeater.max;
706 }
707
708 var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0);
709 var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0);
710 var $repeater_sub_clone = $repeater_sub.clone();
711 $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function () {
712 var $this = jQuery(this);
713 var prev_suffix = $this.attr('data-repeater_sub_suffix');
714 var new_suffix = prev_suffix + '__{{repeater_sub_suffix}}';
715 $this.attr('data-repeater_sub_suffix', new_suffix);
716 });
717 $repeater_sub_clone.find('[name]').each(function () {
718 var $this = jQuery(this);
719 var prev_name = $this.attr('name');
720 var new_name = thisRepeater.getNewName(prev_name);
721 var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name;
722 $this.attr('name', new_name);
723 $this.attr('data-orig_name', orig_name);
724 $this.closest('.wpcf7-form-control-wrap').attr('data-name', new_name.replace('[]', ''));
725 });
726 $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class="wpcf7cf_group"]').each(function () {
727 var $this = jQuery(this);
728 var prev_data_id = $this.attr('data-id');
729 var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id;
730 var new_data_id = thisRepeater.getNewName(prev_data_id);
731
732 if (prev_data_id.endsWith('_count')) {
733 new_data_id = prev_data_id.replace('_count', '__{{repeater_sub_suffix}}_count');
734 }
735
736 $this.attr('data-id', new_data_id);
737 $this.attr('data-orig_data_id', orig_data_id);
738 });
739 $repeater_sub_clone.find('[id]').each(function () {
740 var $this = jQuery(this);
741 var prev_id = $this.attr('id');
742 var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id;
743 var new_id = thisRepeater.getNewName(prev_id);
744 $this.attr('id', new_id);
745 $this.attr('data-orig_id', orig_id);
746 });
747 $repeater_sub_clone.find('[for]').each(function () {
748 var $this = jQuery(this);
749 var prev_for = $this.attr('for');
750 var orig_for = $this.attr('data-orig_for') != null ? $this.attr('data-orig_for') : prev_for;
751 var new_for = thisRepeater.getNewName(prev_for);
752 $this.attr('for', new_for);
753 $this.attr('data-orig_for', orig_for);
754 });
755 var repeater_sub_html = $repeater_sub_clone[0].outerHTML;
756 var $repeater_count_field = $repeater.find('[name=' + $repeater.id + '_count]').eq(0);
757 var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0);
758 var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0);
759 var params = {
760 $repeater: $repeater,
761 $repeater_count_field: $repeater_count_field,
762 repeater_sub_html: repeater_sub_html,
763 $repeater_controls: $repeater_controls,
764 $button_add: $button_add,
765 $button_remove: $button_remove,
766 wpcf7cf_settings: wpcf7cf_settings
767 };
768 thisRepeater.params = params;
769 $button_add.on('click', null, thisRepeater, function (e) {
770 thisRepeater = e.data;
771 thisRepeater.updateSubs(params.$repeater.num_subs + 1);
772 });
773 $button_remove.on('click', null, thisRepeater, function (e) {
774 thisRepeater = e.data;
775 thisRepeater.updateSubs(params.$repeater.num_subs - 1);
776 });
777 jQuery('> .wpcf7cf_repeater_sub', params.$repeater).eq(0).remove(); // remove the first sub, it's just a template.
778
779 thisRepeater.updateSubs($repeater.initial_subs);
780 thisRepeater.updateButtons();
781 }
782
783 Wpcf7cfRepeater.prototype.getNewName = function (previousName) {
784 var prev_parts = previousName.split('[');
785 previousName = prev_parts[0];
786 var prev_suff = prev_parts.length > 1 ? '[' + prev_parts.splice(1).join('[') : '';
787 var newName = previousName + '__{{repeater_sub_suffix}}' + prev_suff;
788
789 if (previousName.endsWith('_count')) {
790 newName = previousName.replace('_count', '__{{repeater_sub_suffix}}_count');
791 }
792
793 return newName;
794 };
795
796 Wpcf7cfRepeater.prototype.updateButtons = function () {
797 var repeater = this;
798 var params = repeater.params;
799 var num_subs = params.$repeater.num_subs;
800 var showButtonRemove = false;
801 var showButtonAdd = false;
802
803 if (params.$repeater.num_subs < params.$repeater.max) {
804 showButtonAdd = true;
805 }
806
807 if (params.$repeater.num_subs > params.$repeater.min) {
808 showButtonRemove = true;
809 }
810
811 if (showButtonAdd) {
812 params.$button_add.show();
813 } else {
814 params.$button_add.hide();
815 }
816
817 if (showButtonRemove) {
818 params.$button_remove.show();
819 } else {
820 params.$button_remove.hide();
821 }
822
823 params.$repeater_count_field.val(num_subs);
824 };
825
826 Wpcf7cfRepeater.prototype.updateSubs = function (subs_to_show) {
827 var repeater = this;
828 var params = repeater.params; // make sure subs_to_show is a valid number
829
830 subs_to_show = subs_to_show < params.$repeater.min ? params.$repeater.min : subs_to_show;
831 subs_to_show = subs_to_show > params.$repeater.max ? params.$repeater.max : subs_to_show;
832 var subs_to_add = subs_to_show - params.$repeater.num_subs;
833
834 if (subs_to_add < 0) {
835 repeater.removeSubs(-subs_to_add);
836 } else if (subs_to_add > 0) {
837 repeater.addSubs(subs_to_add);
838 }
839 };
840 /**
841 * add Subs to repeater
842 * @param {Number} subs_to_add
843 * @param {Number} index - zero-based. leave blank (or null) to append at the end
844 */
845
846
847 Wpcf7cfRepeater.prototype.addSubs = function (subs_to_add) {
848 var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
849 var $ = jQuery;
850 var params = this.params;
851 var repeater = this;
852 var form = repeater.form;
853 var $repeater = params.$repeater;
854 var $repeater_controls = params.$repeater_controls;
855
856 if (subs_to_add + $repeater.num_subs > $repeater.max) {
857 subs_to_add = $repeater.max - $repeater.num_subs;
858 }
859
860 var html_str = '';
861
862 for (var i = 1; i <= subs_to_add; i++) {
863 var sub_suffix = $repeater.num_subs + i;
864 html_str += params.repeater_sub_html.replace(/\{\{repeater_sub_suffix\}\}/g, sub_suffix).replace(new RegExp('\{\{' + $repeater.orig_id + '_index\}\}', 'g'), '<span class="wpcf7cf-index wpcf7cf__' + $repeater.orig_id + '">' + sub_suffix + '</span>');
865 }
866
867 var $html = $(html_str);
868 $('> .wpcf7cf_repeater_sub', $repeater).finish(); // finish any currently running animations immediately.
869 // Add the newly created fields to the form
870
871 if (index === null) {
872 $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');
873 } else {
874 $html.hide().insertBefore($('> .wpcf7cf_repeater_sub', $repeater).eq(index)).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');
875 } // enable all new fields
876
877
878 $html.find('.wpcf7cf-disabled :input').prop('disabled', false).trigger('changedisabledprop.wpcf7cf');
879 $html.find('.wpcf7-form-control-wrap').removeClass('wpcf7cf-disabled');
880 $('.wpcf7cf_repeater', $html).each(function () {
881 form.repeaters.push(new Wpcf7cfRepeater($(this), form));
882 });
883 form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
884 return item.params.$repeater.id;
885 })));
886 $repeater.num_subs += subs_to_add;
887
888 if (index !== null) {
889 repeater.updateSuffixes();
890 }
891
892 window.wpcf7cf.updateMultistepState(form.multistep);
893 form.updateGroups();
894 form.updateEventListeners();
895 form.displayFields();
896 repeater.updateButtons(); // Exclusive Checkbox
897
898 $html.on('click', '.wpcf7-exclusive-checkbox input:checkbox', function () {
899 var name = $(this).attr('name');
900 $html.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false);
901 }); //basic compatibility with material-design-for-contact-form-7
902
903 if (typeof window.cf7mdInit === "function") {
904 window.cf7mdInit();
905 }
906
907 return false;
908 };
909
910 Wpcf7cfRepeater.prototype.updateSuffixes = function () {
911 // Loop trough all subs
912 // -- 1. update all fields, groups and repeaters names, id's, for's, ...
913 // -- 2. loop trough all repeaters
914 // -- update sub_html template for nested repeater
915 // -- call updateSuffixes() for nested repeater
916 var $repeater = this.params.$repeater;
917 var num_subs = this.params.$repeater.num_subs;
918 var form = this.form;
919 var orig_id = $repeater.attr('data-orig_data_id');
920 var repeater_id = $repeater.attr('data-id');
921 var repeater_suffix = repeater_id.replace(orig_id, '');
922 var simplifiedDomArray = Object.values(wpcf7cf.get_simplified_dom_model(form.$form[0]));
923
924 var _loop = function _loop(i) {
925 var $sub = jQuery('> .wpcf7cf_repeater_sub', $repeater).eq(i);
926 var newIndex = i + 1;
927 var currentSuffix = $sub.attr('data-repeater_sub_suffix');
928 var newSuffix = repeater_suffix + '__' + newIndex;
929 $sub.attr('data-repeater_sub_suffix', newSuffix); // update sub attr
930
931 $sub.find('.wpcf7cf__' + orig_id).html(newIndex); // update {{r_index}} parts
932
933 simplifiedDomArray.forEach(function (el) {
934 if (el.suffix !== currentSuffix) return; // TODO: may need an extra check to verify that the element is inside the current repeater
935 // (orig_id) . Otherwise problems may occur if there are repeaters on the same level.
936
937 var newName = el.name.replace(currentSuffix, newSuffix);
938 var pureElName = el.name.replace('[]', '');
939 var pureNewName = newName.replace('[]', '');
940 jQuery('[name="' + el.name + '"]', $sub).attr('name', newName);
941 jQuery('[id="' + el.name + '"]', $sub).attr('id', newName);
942 jQuery('label[for="' + el.name + '"]', $sub).attr('for', newName);
943 var $nested_repeater = jQuery('[data-id="' + el.name + '"]', $sub);
944 $nested_repeater.attr('data-id', newName);
945 jQuery(".wpcf7-form-control-wrap[data-name=\"".concat(pureElName, "\"]"), $sub).attr('data-name', pureNewName);
946
947 if (el.type === 'repeater') {
948 var nested_repeater = form.repeaters.find(function (repeater) {
949 return repeater.params.$repeater.get(0) === $nested_repeater.get(0);
950 });
951 if (!nested_repeater) return;
952 nested_repeater.params.repeater_sub_html = wpcf7cf.updateRepeaterSubHTML(nested_repeater.params.repeater_sub_html, currentSuffix, newSuffix, nested_repeater.params.$repeater.parentRepeaters);
953 nested_repeater.updateSuffixes();
954 }
955 });
956 };
957
958 for (var i = 0; i < num_subs; i++) {
959 _loop(i);
960 }
961 };
962 /**
963 * Return the parent repeaters, order is not guaranteed.
964 */
965
966
967 Wpcf7cfRepeater.prototype.getParentRepeaters = function () {
968 var simplifiedDomArray = Object.values(wpcf7cf.get_simplified_dom_model(form.$form[0]));
969 form.repeaters.map(function (repeater) {});
970 };
971
972 Wpcf7cfRepeater.prototype.removeSubs = function (subs_to_remove) {
973 var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
974 var $ = jQuery;
975 var repeater = this;
976 var params = repeater.params;
977 var form = repeater.form;
978 var $repeater = params.$repeater;
979
980 if ($repeater.num_subs - subs_to_remove < $repeater.min) {
981 subs_to_remove = $repeater.num_subs - $repeater.min;
982 }
983
984 if (index === null) {
985 index = $repeater.num_subs - subs_to_remove;
986 }
987
988 $repeater.num_subs -= subs_to_remove;
989 jQuery('> .wpcf7cf_repeater_sub', $repeater).finish(); // finish any currently running animations immediately.
990
991 jQuery('> .wpcf7cf_repeater_sub', $repeater).slice(index, index + subs_to_remove).animate(wpcf7cf_hide_animation, {
992 duration: params.wpcf7cf_settings.animation_intime,
993 done: function done() {
994 var $this = jQuery(this); //remove the actual fields from the form
995
996 $this.remove();
997 params.$repeater.trigger('wpcf7cf_repeater_removed');
998 window.wpcf7cf.updateMultistepState(form.multistep);
999 form.updateGroups();
1000 form.updateEventListeners();
1001 form.displayFields();
1002 repeater.updateButtons();
1003
1004 if (index !== null) {
1005 repeater.updateSuffixes();
1006 }
1007 }
1008 });
1009 return false;
1010 };
1011
1012 function Wpcf7cfMultistep($multistep, form) {
1013 var multistep = this;
1014 multistep.$multistep = $multistep;
1015 multistep.form = form;
1016 multistep.$steps = $multistep.find('.wpcf7cf_step');
1017 multistep.$btn_next = $multistep.find('.wpcf7cf_next');
1018 multistep.$btn_prev = $multistep.find('.wpcf7cf_prev');
1019 multistep.$dots = $multistep.find('.wpcf7cf_steps-dots');
1020 multistep.currentStep = 0;
1021 multistep.numSteps = multistep.$steps.length;
1022 multistep.$dots.html('');
1023
1024 for (var i = 1; i <= multistep.numSteps; i++) {
1025 multistep.$dots.append("\n <div class=\"dot\" data-step=\"".concat(i, "\">\n <div class=\"step-index\">").concat(i, "</div>\n <div class=\"step-title\">").concat(multistep.$steps.eq(i - 1).attr('data-title'), "</div>\n </div>\n "));
1026 }
1027
1028 multistep.$btn_next.on('click.wpcf7cf_step', /*#__PURE__*/_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee() {
1029 var result;
1030 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee$(_context) {
1031 while (1) {
1032 switch (_context.prev = _context.next) {
1033 case 0:
1034 multistep.$btn_next.addClass('disabled').attr('disabled', true);
1035 multistep.form.$form.addClass('submitting');
1036 _context.next = 4;
1037 return multistep.validateStep(multistep.currentStep);
1038
1039 case 4:
1040 result = _context.sent;
1041 multistep.form.$form.removeClass('submitting');
1042
1043 if (result === 'success') {
1044 multistep.moveToStep(multistep.currentStep + 1);
1045 }
1046
1047 case 7:
1048 case "end":
1049 return _context.stop();
1050 }
1051 }
1052 }, _callee);
1053 }))); // If form is submitted (by pressing Enter for example), and if we are not on the last step,
1054 // then trigger click event on the $btn_next button instead.
1055
1056 multistep.form.$form.on('submit.wpcf7cf_step', function (e) {
1057 if (multistep.currentStep !== multistep.numSteps) {
1058 multistep.$btn_next.trigger('click.wpcf7cf_step');
1059 e.stopImmediatePropagation();
1060 return false;
1061 }
1062 });
1063 multistep.$btn_prev.on('click', function () {
1064 multistep.moveToStep(multistep.currentStep - 1);
1065 });
1066 multistep.moveToStep(1);
1067 }
1068
1069 Wpcf7cfMultistep.prototype.validateStep = function (step_index) {
1070 var multistep = this;
1071 var $multistep = multistep.$multistep;
1072 var $form = multistep.form.$form;
1073 var form = multistep.form;
1074 $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
1075 return new Promise(function (resolve) {
1076 var fd = new FormData(); // Make sure to add file fields to FormData
1077
1078 jQuery.each($form.find('[data-id="step-' + step_index + '"] input[type="file"]'), function (index, el) {
1079 if (!el.files.length) return true; // = continue
1080
1081 var file = el.files[0];
1082 var fieldName = el.name;
1083 fd.append(fieldName, file);
1084 });
1085 var formdata = $form.serializeArray();
1086 jQuery.each(formdata, function (key, input) {
1087 fd.append(input.name, input.value);
1088 });
1089 jQuery.ajax({
1090 url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step',
1091 type: 'POST',
1092 data: fd,
1093 processData: false,
1094 contentType: false,
1095 dataType: 'json'
1096 }).done(function (json) {
1097 $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();
1098 $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid');
1099 $multistep.find('.wpcf7-response-output').remove();
1100 $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');
1101 multistep.$btn_next.removeClass('disabled').attr('disabled', false);
1102
1103 if (!json.success) {
1104 var checkError = 0;
1105 jQuery.each(json.invalid_fields, function (index, el) {
1106 if ($multistep.find('input[name="' + index + '"]').length || $multistep.find('input[name="' + index + '[]"]').length || $multistep.find('select[name="' + index + '"]').length || $multistep.find('select[name="' + index + '[]"]').length || $multistep.find('textarea[name="' + index + '"]').length || $multistep.find('textarea[name="' + index + '[]"]').length) {
1107 checkError = checkError + 1;
1108 var controlWrap = form.get(".wpcf7-form-control-wrap[data-name=\"".concat(index, "\"]"));
1109 controlWrap.find('.wpcf7-form-control').addClass('wpcf7-not-valid');
1110 controlWrap.find('span.wpcf7-not-valid-tip').remove();
1111 controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
1112 }
1113 });
1114 resolve('failed');
1115 $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message);
1116 wpcf7.setStatus($form, 'invalid');
1117 multistep.$steps.trigger('wpcf7cf_step_invalid'); // wpcf7.triggerEvent( data.into, 'invalid', detail );
1118 } else if (json.success) {
1119 wpcf7.setStatus($form, 'init');
1120 resolve('success');
1121 return false;
1122 }
1123 }).fail(function () {
1124 resolve('error');
1125 }).always(function () {// do nothing
1126 });
1127 });
1128 };
1129
1130 Wpcf7cfMultistep.prototype.moveToStep = function (step_index) {
1131 var scrollToTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1132 var multistep = this;
1133 var previousStep = multistep.currentStep;
1134 multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps : step_index < 1 ? 1 : step_index; // ANIMATION DISABLED FOR NOW cause it's ugly
1135 // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime);
1136 // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime);
1137
1138 multistep.$multistep.attr('data-current_step', multistep.currentStep);
1139 multistep.$steps.hide();
1140 multistep.$steps.eq(multistep.currentStep - 1).show().trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]);
1141
1142 if (scrollToTop) {
1143 var formEl = multistep.form.$form[0];
1144 var topOffset = formEl.getBoundingClientRect().top;
1145
1146 if (topOffset < 0 && previousStep > 0) {
1147 formEl.scrollIntoView({
1148 behavior: "smooth"
1149 });
1150 }
1151 }
1152
1153 multistep.form.updateSummaryFields();
1154 window.wpcf7cf.updateMultistepState(multistep);
1155 };
1156
1157 Wpcf7cfMultistep.prototype.getFieldsInStep = function (step_index) {
1158 this.form.reloadSimpleDom();
1159 var inStep = false;
1160 return Object.values(this.form.simpleDom).filter(function (item, i) {
1161 if (item.type == 'step') {
1162 inStep = item.val == step_index + '';
1163 }
1164
1165 return inStep && item.type == 'input';
1166 }).map(function (item) {
1167 return item.name;
1168 });
1169 }; // END PRO ONLY
1170
1171 /**
1172 * @global
1173 * @namespace wpcf7cf
1174 */
1175
1176
1177 window.wpcf7cf = {
1178 hideGroup: function hideGroup($group, animate) {},
1179 showGroup: function showGroup($group, animate) {},
1180 updateRepeaterSubHTML: function updateRepeaterSubHTML(html, oldSuffix, newSuffix, parentRepeaters) {
1181 var oldIndexes = oldSuffix.split('__');
1182 oldIndexes.shift(); // remove first empty element
1183
1184 var newIndexes = newSuffix.split('__');
1185 newIndexes.shift(); // remove first empty element
1186
1187 var returnHtml = html;
1188
1189 if (oldIndexes && newIndexes && oldIndexes.length === parentRepeaters.length && newIndexes.length === parentRepeaters.length) {
1190 var parentRepeatersInfo = parentRepeaters.map(function (repeaterId, i) {
1191 return _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()({}, repeaterId.split('__')[0], [oldIndexes[i], newIndexes[i]]);
1192 });
1193 var length = parentRepeatersInfo.length;
1194 var replacements = oldIndexes.map(function (oldIndex, i) {
1195 return ['__' + oldIndexes.slice(0, length - i).join('__'), '__' + newIndexes.slice(0, length - i).join('__')];
1196 });
1197
1198 for (var i = 0; i < length; i++) {
1199 var id = Object.keys(parentRepeatersInfo[i])[0];
1200 var find = parentRepeatersInfo[i][id][0];
1201 var repl = parentRepeatersInfo[i][id][1];
1202 replacements.push(["<span class=\"wpcf7cf-index wpcf7cf__".concat(id, "\">").concat(find, "<\\/span>"), "<span class=\"wpcf7cf-index wpcf7cf__".concat(id, "\">").concat(repl, "</span>")]);
1203 }
1204
1205 replacements.forEach(function (_ref3) {
1206 var _ref4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref3, 2),
1207 oldSuffix = _ref4[0],
1208 newSuffix = _ref4[1];
1209
1210 returnHtml = returnHtml.replace(new RegExp(oldSuffix, 'g'), newSuffix);
1211 });
1212 }
1213
1214 return returnHtml;
1215 },
1216 // keep this for backwards compatibility
1217 initForm: function initForm($forms) {
1218 $forms.each(function () {
1219 var $form = jQuery(this); // only add form is its class is "wpcf7-form" and if the form was not previously added
1220
1221 if ($form.hasClass('wpcf7-form') && !wpcf7cf_forms.some(function (form) {
1222 return form.$form.get(0) === $form.get(0);
1223 })) {
1224 wpcf7cf_forms.push(new Wpcf7cfForm($form));
1225 }
1226 });
1227 },
1228 getWpcf7cfForm: function getWpcf7cfForm($form) {
1229 var matched_forms = wpcf7cf_forms.filter(function (form) {
1230 return form.$form.get(0) === $form.get(0);
1231 });
1232
1233 if (matched_forms.length) {
1234 return matched_forms[0];
1235 }
1236
1237 return false;
1238 },
1239 get_nested_conditions: function get_nested_conditions(form) {
1240 var conditions = form.initial_conditions; //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
1241
1242 form.reloadSimpleDom();
1243 var groups = Object.values(form.simpleDom).filter(function (item, i) {
1244 return item.type === 'group';
1245 });
1246 var sub_conditions = [];
1247
1248 var _loop2 = function _loop2(i) {
1249 var g = groups[i];
1250 var relevant_conditions = conditions.filter(function (condition, i) {
1251 return condition.then_field === g.original_name;
1252 });
1253 relevant_conditions = relevant_conditions.map(function (item, i) {
1254 return {
1255 then_field: g.name,
1256 and_rules: item.and_rules.map(function (and_rule, i) {
1257 return {
1258 if_field: and_rule.if_field + g.suffix,
1259 if_value: and_rule.if_value,
1260 operator: and_rule.operator
1261 };
1262 })
1263 };
1264 });
1265 sub_conditions = sub_conditions.concat(relevant_conditions);
1266 };
1267
1268 for (var i = 0; i < groups.length; i++) {
1269 _loop2(i);
1270 }
1271
1272 return sub_conditions;
1273 },
1274 get_simplified_dom_model: function get_simplified_dom_model(currentNode) {
1275 var simplified_dom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1276 var parentGroups = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1277 var parentRepeaters = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1278 var type = currentNode.classList && currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' : currentNode.dataset["class"] == 'wpcf7cf_group' ? 'group' : currentNode.className == 'wpcf7cf_step' ? 'step' : currentNode.hasAttribute('name') && !currentNode.disabled ? 'input' : false;
1279
1280 var newParentRepeaters = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(parentRepeaters);
1281
1282 var newParentGroups = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(parentGroups);
1283
1284 if (type) {
1285 var name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id;
1286
1287 if (type === 'repeater') {
1288 newParentRepeaters.push(name);
1289 }
1290
1291 if (type === 'group') {
1292 newParentGroups.push(name);
1293 } // skip _wpcf7 hidden fields
1294
1295
1296 if (name.substring(0, 6) === '_wpcf7') return {};
1297 var original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id : type === 'input' ? currentNode.getAttribute('data-orig_name') || name : name;
1298 var nameWithoutBrackets = name.replace('[]', '');
1299 var originalNameWithoutBrackets = original_name.replace('[]', '');
1300 var val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];
1301 var suffix = nameWithoutBrackets.replace(originalNameWithoutBrackets, '');
1302
1303 if (!simplified_dom[name]) {
1304 // init entry
1305 simplified_dom[name] = {
1306 name: name,
1307 type: type,
1308 original_name: original_name,
1309 suffix: suffix,
1310 val: val,
1311 parentGroups: parentGroups,
1312 parentRepeaters: parentRepeaters
1313 };
1314 }
1315
1316 if (type === 'input') {
1317 // skip unchecked checkboxes and radiobuttons
1318 if ((currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked) return {}; // if multiselect, make sure to add all the values
1319
1320 if (currentNode.multiple && currentNode.options) {
1321 simplified_dom[name].val = Object.values(currentNode.options).filter(function (o) {
1322 return o.selected;
1323 }).map(function (o) {
1324 return o.value;
1325 });
1326 } else {
1327 simplified_dom[name].val.push(currentNode.value);
1328 }
1329 }
1330 } // can't use currentNode.children (because then field name cannot be "children")
1331
1332
1333 var getter = Object.getOwnPropertyDescriptor(Element.prototype, "children").get;
1334 var children = getter.call(currentNode);
1335 Array.from(children).forEach(function (childNode) {
1336 var dom = wpcf7cf.get_simplified_dom_model(childNode, simplified_dom, newParentGroups, newParentRepeaters);
1337 simplified_dom = _objectSpread(_objectSpread({}, dom), simplified_dom);
1338 });
1339 return simplified_dom;
1340 },
1341 updateMultistepState: function updateMultistepState(multistep) {
1342 if (multistep == null) return; // update hidden input field
1343
1344 var stepsData = {
1345 currentStep: multistep.currentStep,
1346 numSteps: multistep.numSteps,
1347 fieldsInCurrentStep: multistep.getFieldsInStep(multistep.currentStep)
1348 };
1349 multistep.form.$input_steps.val(JSON.stringify(stepsData)); // update Buttons
1350
1351 multistep.$btn_prev.removeClass('disabled').attr('disabled', false);
1352 multistep.$btn_next.removeClass('disabled').attr('disabled', false);
1353
1354 if (multistep.currentStep == multistep.numSteps) {
1355 multistep.$btn_next.addClass('disabled').attr('disabled', true);
1356 }
1357
1358 if (multistep.currentStep == 1) {
1359 multistep.$btn_prev.addClass('disabled').attr('disabled', true);
1360 } // replace next button with submit button on last step.
1361 // TODO: make this depend on a setting
1362
1363
1364 var $submit_button = multistep.form.$form.find('input[type="submit"]:last').eq(0);
1365 var $ajax_loader = multistep.form.$form.find('.wpcf7-spinner').eq(0);
1366 $submit_button.detach().prependTo(multistep.$btn_next.parent());
1367 $ajax_loader.detach().prependTo(multistep.$btn_next.parent());
1368
1369 if (multistep.currentStep == multistep.numSteps) {
1370 multistep.$btn_next.hide();
1371 $submit_button.show();
1372 } else {
1373 $submit_button.hide();
1374 multistep.$btn_next.show();
1375 } // update dots
1376
1377
1378 var $dots = multistep.$dots.find('.dot');
1379 $dots.removeClass('active').removeClass('completed');
1380
1381 for (var step = 1; step <= multistep.numSteps; step++) {
1382 if (step < multistep.currentStep) {
1383 $dots.eq(step - 1).addClass('completed');
1384 } else if (step == multistep.currentStep) {
1385 $dots.eq(step - 1).addClass('active');
1386 }
1387 }
1388 },
1389 should_group_be_shown: function should_group_be_shown(condition, form) {
1390 var show_group = true;
1391
1392 for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {
1393 var condition_ok = false;
1394 var condition_and_rule = condition.and_rules[and_rule_i];
1395 var inputField = form.getFieldByName(condition_and_rule.if_field);
1396 if (!inputField) continue; // field not found
1397
1398 var if_val = condition_and_rule.if_value;
1399 var operator = condition_and_rule.operator; //backwards compat
1400
1401 operator = operator === '' ? 'less than or equals' : operator;
1402 operator = operator === '' ? 'greater than or equals' : operator;
1403 operator = operator === '>' ? 'greater than' : operator;
1404 operator = operator === '<' ? 'less than' : operator;
1405 var $field = operator === 'function' && jQuery("[name=\"".concat(inputField.name, "\"]")).eq(0);
1406 condition_ok = this.isConditionTrue(inputField.val, operator, if_val, $field);
1407 show_group = show_group && condition_ok;
1408 }
1409
1410 return show_group;
1411 },
1412 isConditionTrue: function isConditionTrue(values, operator) {
1413 var testValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1414 var $field = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : jQuery();
1415
1416 if (!Array.isArray(values)) {
1417 values = [values];
1418 }
1419
1420 var condition_ok = false; // start by assuming that the condition is not met
1421 // Considered EMPTY: [] [''] [null] ['',null] [,,'']
1422 // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null]
1423
1424 var valuesAreEmpty = values.length === 0 || values.every(function (v) {
1425 return !v && v !== 0;
1426 }); // 0 is not considered empty
1427 // special cases: [] equals '' => TRUE; [] not equals '' => FALSE
1428
1429 if (operator === 'equals' && testValue === '' && valuesAreEmpty) {
1430 return true;
1431 }
1432
1433 if (operator === 'not equals' && testValue === '' && valuesAreEmpty) {
1434 return false;
1435 }
1436
1437 if (valuesAreEmpty) {
1438 if (operator === 'is empty') {
1439 condition_ok = true;
1440 }
1441 } else {
1442 if (operator === 'not empty') {
1443 condition_ok = true;
1444 }
1445 }
1446
1447 var testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN;
1448
1449 if (operator === 'not equals' || operator === 'not equals (regex)') {
1450 // start by assuming that the condition is met
1451 condition_ok = true;
1452 }
1453
1454 if (operator === 'function' && typeof window[testValue] == 'function' && window[testValue]($field) // here we call the actual user defined function
1455 ) {
1456 condition_ok = true;
1457 }
1458
1459 var regex_patt = /.*/i; // fallback regex pattern
1460
1461 var isValidRegex = true;
1462
1463 if (operator === 'equals (regex)' || operator === 'not equals (regex)') {
1464 try {
1465 regex_patt = new RegExp(testValue, 'i');
1466 } catch (e) {
1467 isValidRegex = false;
1468 }
1469 }
1470
1471 for (var i = 0; i < values.length; i++) {
1472 var value = values[i];
1473 var valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN;
1474 var valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber);
1475
1476 if (operator === 'equals' && value === testValue || operator === 'equals (regex)' && regex_patt.test(value) || operator === 'greater than' && valsAreNumbers && valueNumber > testValueNumber || operator === 'less than' && valsAreNumbers && valueNumber < testValueNumber || operator === 'greater than or equals' && valsAreNumbers && valueNumber >= testValueNumber || operator === 'less than or equals' && valsAreNumbers && valueNumber <= testValueNumber) {
1477 condition_ok = true;
1478 break;
1479 } else if (operator === 'not equals' && value === testValue || operator === 'not equals (regex)' && regex_patt.test(value)) {
1480 condition_ok = false;
1481 break;
1482 }
1483 }
1484
1485 return condition_ok;
1486 },
1487 getFormObj: function getFormObj($form) {
1488 if (typeof $form === 'string') {
1489 $form = jQuery($form).eq(0);
1490 }
1491
1492 return wpcf7cf.getWpcf7cfForm($form);
1493 },
1494 getRepeaterObj: function getRepeaterObj($form, repeaterDataId) {
1495 var form = wpcf7cf.getFormObj($form);
1496 var repeater = form.repeaters.find(function (repeater) {
1497 return repeater.params.$repeater.attr('data-id') === repeaterDataId;
1498 });
1499 return repeater;
1500 },
1501 getMultiStepObj: function getMultiStepObj($form) {
1502 var form = wpcf7cf.getFormObj($form);
1503 return form.multistep;
1504 },
1505
1506 /**
1507 * Append a new sub-entry to the repeater with the name `repeaterDataId` inside the form `$form`
1508 * @memberof wpcf7cf
1509 * @function wpcf7cf.repeaterAddSub
1510 * @link
1511 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1512 * @param {String} repeaterDataId - *data-id* attribute of the repeater. Normally this is simply the name of the repeater. However, in case of a nested repeater you need to append the name with the correct suffix. For example `my-nested-repeater__1__3`. Hint (check the `data-id` attribute in the HTML code to find the correct suffix)
1513 */
1514 repeaterAddSub: function repeaterAddSub($form, repeaterDataId) {
1515 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1516 repeater.updateSubs(repeater.params.$repeater.num_subs + 1);
1517 },
1518
1519 /**
1520 * Insert a new sub-entry at the given `index` of the repeater with the name `repeaterDataId` inside the form `$form`
1521 * @memberof wpcf7cf
1522 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1523 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1524 * @param {Number} index - position where to insert the new sub-entry within the repeater
1525 */
1526 repeaterAddSubAtIndex: function repeaterAddSubAtIndex($form, repeaterDataId, index) {
1527 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1528 repeater.addSubs(1, index);
1529 },
1530
1531 /**
1532 * Remove the sub-entry at the given `index` of the repeater with the *data-id* attribute of `repeaterDataId` inside the form `$form`
1533 * @memberof wpcf7cf
1534 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1535 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1536 * @param {Number} index - position where to insert the new sub-entry within the repeater
1537 */
1538 repeaterRemoveSubAtIndex: function repeaterRemoveSubAtIndex($form, repeaterDataId, index) {
1539 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1540 repeater.removeSubs(1, index);
1541 },
1542
1543 /**
1544 * Remove the last sub-entry from the repeater with the *data-id* attribute of `repeaterDataId` inside the form `$form`
1545 * @memberof wpcf7cf
1546 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1547 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1548 * @param {Number} index - position where to insert the new sub-entry within the repeater
1549 */
1550 repeaterRemoveSub: function repeaterRemoveSub($form, repeaterDataId) {
1551 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1552 repeater.updateSubs(repeater.params.$repeater.num_subs - 1);
1553 },
1554
1555 /**
1556 * Set the number of subs for the repeater with the *data-id* attribute of `repeaterDataId` inside the form `$form`.
1557 * Subs are either appended to or removed from the end of the repeater.
1558 * @memberof wpcf7cf
1559 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1560 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1561 * @param {Number} numberOfSubs - position where to insert the new sub-entry within the repeater
1562 */
1563 repeaterSetNumberOfSubs: function repeaterSetNumberOfSubs($form, repeaterDataId, numberOfSubs) {
1564 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1565 repeater.updateSubs(numberOfSubs);
1566 },
1567
1568 /**
1569 * Move to step number `step`, ignoring any validation.
1570 * @memberof wpcf7cf
1571 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1572 * @param {*} step
1573 */
1574 multistepMoveToStep: function multistepMoveToStep($form, step) {
1575 var multistep = wpcf7cf.getMultiStepObj($form);
1576 multistep.moveToStep(step);
1577 },
1578
1579 /**
1580 * Validate the current step, and move to step number `step` if validation passes.
1581 * @memberof wpcf7cf
1582 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1583 * @param {Number} step
1584 */
1585 multistepMoveToStepWithValidation: function multistepMoveToStepWithValidation($form, step) {
1586 return _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee2() {
1587 var multistep, result;
1588 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee2$(_context2) {
1589 while (1) {
1590 switch (_context2.prev = _context2.next) {
1591 case 0:
1592 multistep = wpcf7cf.getMultiStepObj($form);
1593 _context2.next = 3;
1594 return multistep.validateStep(multistep.currentStep);
1595
1596 case 3:
1597 result = _context2.sent;
1598
1599 if (result === 'success') {
1600 multistep.moveToStep(step);
1601 }
1602
1603 case 5:
1604 case "end":
1605 return _context2.stop();
1606 }
1607 }
1608 }, _callee2);
1609 }))();
1610 }
1611 };
1612 jQuery('.wpcf7-form').each(function () {
1613 wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));
1614 }); // Call displayFields again on all forms
1615 // Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded.
1616
1617 jQuery('document').on('ready', function () {
1618 wpcf7cf_forms.forEach(function (f) {
1619 f.displayFields();
1620 });
1621 }); // fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)
1622
1623 var old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox;
1624
1625 jQuery.fn.wpcf7ExclusiveCheckbox = function () {
1626 return this.find('input:checkbox').on('click', function () {
1627 var name = jQuery(this).attr('name');
1628 jQuery(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false).eq(0).change();
1629 });
1630 };
1631
1632 /***/ }),
1633
1634 /***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
1635 /*!*****************************************************************!*\
1636 !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
1637 \*****************************************************************/
1638 /*! no static exports found */
1639 /***/ (function(module, exports) {
1640
1641 function _arrayLikeToArray(arr, len) {
1642 if (len == null || len > arr.length) len = arr.length;
1643
1644 for (var i = 0, arr2 = new Array(len); i < len; i++) {
1645 arr2[i] = arr[i];
1646 }
1647
1648 return arr2;
1649 }
1650
1651 module.exports = _arrayLikeToArray;
1652
1653 /***/ }),
1654
1655 /***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js":
1656 /*!***************************************************************!*\
1657 !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
1658 \***************************************************************/
1659 /*! no static exports found */
1660 /***/ (function(module, exports) {
1661
1662 function _arrayWithHoles(arr) {
1663 if (Array.isArray(arr)) return arr;
1664 }
1665
1666 module.exports = _arrayWithHoles;
1667
1668 /***/ }),
1669
1670 /***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
1671 /*!******************************************************************!*\
1672 !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
1673 \******************************************************************/
1674 /*! no static exports found */
1675 /***/ (function(module, exports, __webpack_require__) {
1676
1677 var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
1678
1679 function _arrayWithoutHoles(arr) {
1680 if (Array.isArray(arr)) return arrayLikeToArray(arr);
1681 }
1682
1683 module.exports = _arrayWithoutHoles;
1684
1685 /***/ }),
1686
1687 /***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js":
1688 /*!*****************************************************************!*\
1689 !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
1690 \*****************************************************************/
1691 /*! no static exports found */
1692 /***/ (function(module, exports) {
1693
1694 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1695 try {
1696 var info = gen[key](arg);
1697 var value = info.value;
1698 } catch (error) {
1699 reject(error);
1700 return;
1701 }
1702
1703 if (info.done) {
1704 resolve(value);
1705 } else {
1706 Promise.resolve(value).then(_next, _throw);
1707 }
1708 }
1709
1710 function _asyncToGenerator(fn) {
1711 return function () {
1712 var self = this,
1713 args = arguments;
1714 return new Promise(function (resolve, reject) {
1715 var gen = fn.apply(self, args);
1716
1717 function _next(value) {
1718 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1719 }
1720
1721 function _throw(err) {
1722 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1723 }
1724
1725 _next(undefined);
1726 });
1727 };
1728 }
1729
1730 module.exports = _asyncToGenerator;
1731
1732 /***/ }),
1733
1734 /***/ "./node_modules/@babel/runtime/helpers/defineProperty.js":
1735 /*!***************************************************************!*\
1736 !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
1737 \***************************************************************/
1738 /*! no static exports found */
1739 /***/ (function(module, exports) {
1740
1741 function _defineProperty(obj, key, value) {
1742 if (key in obj) {
1743 Object.defineProperty(obj, key, {
1744 value: value,
1745 enumerable: true,
1746 configurable: true,
1747 writable: true
1748 });
1749 } else {
1750 obj[key] = value;
1751 }
1752
1753 return obj;
1754 }
1755
1756 module.exports = _defineProperty;
1757
1758 /***/ }),
1759
1760 /***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
1761 /*!****************************************************************!*\
1762 !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
1763 \****************************************************************/
1764 /*! no static exports found */
1765 /***/ (function(module, exports) {
1766
1767 function _iterableToArray(iter) {
1768 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
1769 }
1770
1771 module.exports = _iterableToArray;
1772
1773 /***/ }),
1774
1775 /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
1776 /*!*********************************************************************!*\
1777 !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
1778 \*********************************************************************/
1779 /*! no static exports found */
1780 /***/ (function(module, exports) {
1781
1782 function _iterableToArrayLimit(arr, i) {
1783 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
1784 var _arr = [];
1785 var _n = true;
1786 var _d = false;
1787 var _e = undefined;
1788
1789 try {
1790 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1791 _arr.push(_s.value);
1792
1793 if (i && _arr.length === i) break;
1794 }
1795 } catch (err) {
1796 _d = true;
1797 _e = err;
1798 } finally {
1799 try {
1800 if (!_n && _i["return"] != null) _i["return"]();
1801 } finally {
1802 if (_d) throw _e;
1803 }
1804 }
1805
1806 return _arr;
1807 }
1808
1809 module.exports = _iterableToArrayLimit;
1810
1811 /***/ }),
1812
1813 /***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js":
1814 /*!****************************************************************!*\
1815 !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
1816 \****************************************************************/
1817 /*! no static exports found */
1818 /***/ (function(module, exports) {
1819
1820 function _nonIterableRest() {
1821 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1822 }
1823
1824 module.exports = _nonIterableRest;
1825
1826 /***/ }),
1827
1828 /***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
1829 /*!******************************************************************!*\
1830 !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
1831 \******************************************************************/
1832 /*! no static exports found */
1833 /***/ (function(module, exports) {
1834
1835 function _nonIterableSpread() {
1836 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1837 }
1838
1839 module.exports = _nonIterableSpread;
1840
1841 /***/ }),
1842
1843 /***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js":
1844 /*!**************************************************************!*\
1845 !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
1846 \**************************************************************/
1847 /*! no static exports found */
1848 /***/ (function(module, exports, __webpack_require__) {
1849
1850 var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js");
1851
1852 var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js");
1853
1854 var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
1855
1856 var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js");
1857
1858 function _slicedToArray(arr, i) {
1859 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
1860 }
1861
1862 module.exports = _slicedToArray;
1863
1864 /***/ }),
1865
1866 /***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
1867 /*!******************************************************************!*\
1868 !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
1869 \******************************************************************/
1870 /*! no static exports found */
1871 /***/ (function(module, exports, __webpack_require__) {
1872
1873 var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js");
1874
1875 var iterableToArray = __webpack_require__(/*! ./iterableToArray */ "./node_modules/@babel/runtime/helpers/iterableToArray.js");
1876
1877 var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
1878
1879 var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js");
1880
1881 function _toConsumableArray(arr) {
1882 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
1883 }
1884
1885 module.exports = _toConsumableArray;
1886
1887 /***/ }),
1888
1889 /***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
1890 /*!***************************************************************************!*\
1891 !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
1892 \***************************************************************************/
1893 /*! no static exports found */
1894 /***/ (function(module, exports, __webpack_require__) {
1895
1896 var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
1897
1898 function _unsupportedIterableToArray(o, minLen) {
1899 if (!o) return;
1900 if (typeof o === "string") return arrayLikeToArray(o, minLen);
1901 var n = Object.prototype.toString.call(o).slice(8, -1);
1902 if (n === "Object" && o.constructor) n = o.constructor.name;
1903 if (n === "Map" || n === "Set") return Array.from(o);
1904 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
1905 }
1906
1907 module.exports = _unsupportedIterableToArray;
1908
1909 /***/ }),
1910
1911 /***/ "./node_modules/@babel/runtime/regenerator/index.js":
1912 /*!**********************************************************!*\
1913 !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
1914 \**********************************************************/
1915 /*! no static exports found */
1916 /***/ (function(module, exports, __webpack_require__) {
1917
1918 module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js");
1919
1920 /***/ }),
1921
1922 /***/ "./node_modules/es6-promise-promise/index.js":
1923 /*!***************************************************!*\
1924 !*** ./node_modules/es6-promise-promise/index.js ***!
1925 \***************************************************/
1926 /*! no static exports found */
1927 /***/ (function(module, exports, __webpack_require__) {
1928
1929 module.exports = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js").Promise;
1930
1931 /***/ }),
1932
1933 /***/ "./node_modules/es6-promise/dist/es6-promise.js":
1934 /*!******************************************************!*\
1935 !*** ./node_modules/es6-promise/dist/es6-promise.js ***!
1936 \******************************************************/
1937 /*! no static exports found */
1938 /***/ (function(module, exports, __webpack_require__) {
1939
1940 /* WEBPACK VAR INJECTION */(function(process, global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1941
1942 /*!
1943 * @overview es6-promise - a tiny implementation of Promises/A+.
1944 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
1945 * @license Licensed under MIT license
1946 * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
1947 * @version 3.3.1
1948 */
1949 (function (global, factory) {
1950 ( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
1951 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
1952 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
1953 __WEBPACK_AMD_DEFINE_FACTORY__),
1954 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
1955 })(this, function () {
1956 'use strict';
1957
1958 function objectOrFunction(x) {
1959 return typeof x === 'function' || _typeof(x) === 'object' && x !== null;
1960 }
1961
1962 function isFunction(x) {
1963 return typeof x === 'function';
1964 }
1965
1966 var _isArray = undefined;
1967
1968 if (!Array.isArray) {
1969 _isArray = function _isArray(x) {
1970 return Object.prototype.toString.call(x) === '[object Array]';
1971 };
1972 } else {
1973 _isArray = Array.isArray;
1974 }
1975
1976 var isArray = _isArray;
1977 var len = 0;
1978 var vertxNext = undefined;
1979 var customSchedulerFn = undefined;
1980
1981 var asap = function asap(callback, arg) {
1982 queue[len] = callback;
1983 queue[len + 1] = arg;
1984 len += 2;
1985
1986 if (len === 2) {
1987 // If len is 2, that means that we need to schedule an async flush.
1988 // If additional callbacks are queued before the queue is flushed, they
1989 // will be processed by this flush that we are scheduling.
1990 if (customSchedulerFn) {
1991 customSchedulerFn(flush);
1992 } else {
1993 scheduleFlush();
1994 }
1995 }
1996 };
1997
1998 function setScheduler(scheduleFn) {
1999 customSchedulerFn = scheduleFn;
2000 }
2001
2002 function setAsap(asapFn) {
2003 asap = asapFn;
2004 }
2005
2006 var browserWindow = typeof window !== 'undefined' ? window : undefined;
2007 var browserGlobal = browserWindow || {};
2008 var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
2009 var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; // test for web worker but not in IE10
2010
2011 var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; // node
2012
2013 function useNextTick() {
2014 // node version 0.10.x displays a deprecation warning when nextTick is used recursively
2015 // see https://github.com/cujojs/when/issues/410 for details
2016 return function () {
2017 return process.nextTick(flush);
2018 };
2019 } // vertx
2020
2021
2022 function useVertxTimer() {
2023 return function () {
2024 vertxNext(flush);
2025 };
2026 }
2027
2028 function useMutationObserver() {
2029 var iterations = 0;
2030 var observer = new BrowserMutationObserver(flush);
2031 var node = document.createTextNode('');
2032 observer.observe(node, {
2033 characterData: true
2034 });
2035 return function () {
2036 node.data = iterations = ++iterations % 2;
2037 };
2038 } // web worker
2039
2040
2041 function useMessageChannel() {
2042 var channel = new MessageChannel();
2043 channel.port1.onmessage = flush;
2044 return function () {
2045 return channel.port2.postMessage(0);
2046 };
2047 }
2048
2049 function useSetTimeout() {
2050 // Store setTimeout reference so es6-promise will be unaffected by
2051 // other code modifying setTimeout (like sinon.useFakeTimers())
2052 var globalSetTimeout = setTimeout;
2053 return function () {
2054 return globalSetTimeout(flush, 1);
2055 };
2056 }
2057
2058 var queue = new Array(1000);
2059
2060 function flush() {
2061 for (var i = 0; i < len; i += 2) {
2062 var callback = queue[i];
2063 var arg = queue[i + 1];
2064 callback(arg);
2065 queue[i] = undefined;
2066 queue[i + 1] = undefined;
2067 }
2068
2069 len = 0;
2070 }
2071
2072 function attemptVertx() {
2073 try {
2074 var r = require;
2075 var vertx = __webpack_require__(/*! vertx */ 1);
2076 vertxNext = vertx.runOnLoop || vertx.runOnContext;
2077 return useVertxTimer();
2078 } catch (e) {
2079 return useSetTimeout();
2080 }
2081 }
2082
2083 var scheduleFlush = undefined; // Decide what async method to use to triggering processing of queued callbacks:
2084
2085 if (isNode) {
2086 scheduleFlush = useNextTick();
2087 } else if (BrowserMutationObserver) {
2088 scheduleFlush = useMutationObserver();
2089 } else if (isWorker) {
2090 scheduleFlush = useMessageChannel();
2091 } else if (browserWindow === undefined && "function" === 'function') {
2092 scheduleFlush = attemptVertx();
2093 } else {
2094 scheduleFlush = useSetTimeout();
2095 }
2096
2097 function then(onFulfillment, onRejection) {
2098 var _arguments = arguments;
2099 var parent = this;
2100 var child = new this.constructor(noop);
2101
2102 if (child[PROMISE_ID] === undefined) {
2103 makePromise(child);
2104 }
2105
2106 var _state = parent._state;
2107
2108 if (_state) {
2109 (function () {
2110 var callback = _arguments[_state - 1];
2111 asap(function () {
2112 return invokeCallback(_state, child, callback, parent._result);
2113 });
2114 })();
2115 } else {
2116 subscribe(parent, child, onFulfillment, onRejection);
2117 }
2118
2119 return child;
2120 }
2121 /**
2122 `Promise.resolve` returns a promise that will become resolved with the
2123 passed `value`. It is shorthand for the following:
2124
2125 ```javascript
2126 let promise = new Promise(function(resolve, reject){
2127 resolve(1);
2128 });
2129
2130 promise.then(function(value){
2131 // value === 1
2132 });
2133 ```
2134
2135 Instead of writing the above, your code now simply becomes the following:
2136
2137 ```javascript
2138 let promise = Promise.resolve(1);
2139
2140 promise.then(function(value){
2141 // value === 1
2142 });
2143 ```
2144
2145 @method resolve
2146 @static
2147 @param {Any} value value that the returned promise will be resolved with
2148 Useful for tooling.
2149 @return {Promise} a promise that will become fulfilled with the given
2150 `value`
2151 */
2152
2153
2154 function resolve(object) {
2155 /*jshint validthis:true */
2156 var Constructor = this;
2157
2158 if (object && _typeof(object) === 'object' && object.constructor === Constructor) {
2159 return object;
2160 }
2161
2162 var promise = new Constructor(noop);
2163
2164 _resolve(promise, object);
2165
2166 return promise;
2167 }
2168
2169 var PROMISE_ID = Math.random().toString(36).substring(16);
2170
2171 function noop() {}
2172
2173 var PENDING = void 0;
2174 var FULFILLED = 1;
2175 var REJECTED = 2;
2176 var GET_THEN_ERROR = new ErrorObject();
2177
2178 function selfFulfillment() {
2179 return new TypeError("You cannot resolve a promise with itself");
2180 }
2181
2182 function cannotReturnOwn() {
2183 return new TypeError('A promises callback cannot return that same promise.');
2184 }
2185
2186 function getThen(promise) {
2187 try {
2188 return promise.then;
2189 } catch (error) {
2190 GET_THEN_ERROR.error = error;
2191 return GET_THEN_ERROR;
2192 }
2193 }
2194
2195 function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
2196 try {
2197 then.call(value, fulfillmentHandler, rejectionHandler);
2198 } catch (e) {
2199 return e;
2200 }
2201 }
2202
2203 function handleForeignThenable(promise, thenable, then) {
2204 asap(function (promise) {
2205 var sealed = false;
2206 var error = tryThen(then, thenable, function (value) {
2207 if (sealed) {
2208 return;
2209 }
2210
2211 sealed = true;
2212
2213 if (thenable !== value) {
2214 _resolve(promise, value);
2215 } else {
2216 fulfill(promise, value);
2217 }
2218 }, function (reason) {
2219 if (sealed) {
2220 return;
2221 }
2222
2223 sealed = true;
2224
2225 _reject(promise, reason);
2226 }, 'Settle: ' + (promise._label || ' unknown promise'));
2227
2228 if (!sealed && error) {
2229 sealed = true;
2230
2231 _reject(promise, error);
2232 }
2233 }, promise);
2234 }
2235
2236 function handleOwnThenable(promise, thenable) {
2237 if (thenable._state === FULFILLED) {
2238 fulfill(promise, thenable._result);
2239 } else if (thenable._state === REJECTED) {
2240 _reject(promise, thenable._result);
2241 } else {
2242 subscribe(thenable, undefined, function (value) {
2243 return _resolve(promise, value);
2244 }, function (reason) {
2245 return _reject(promise, reason);
2246 });
2247 }
2248 }
2249
2250 function handleMaybeThenable(promise, maybeThenable, then$$) {
2251 if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
2252 handleOwnThenable(promise, maybeThenable);
2253 } else {
2254 if (then$$ === GET_THEN_ERROR) {
2255 _reject(promise, GET_THEN_ERROR.error);
2256 } else if (then$$ === undefined) {
2257 fulfill(promise, maybeThenable);
2258 } else if (isFunction(then$$)) {
2259 handleForeignThenable(promise, maybeThenable, then$$);
2260 } else {
2261 fulfill(promise, maybeThenable);
2262 }
2263 }
2264 }
2265
2266 function _resolve(promise, value) {
2267 if (promise === value) {
2268 _reject(promise, selfFulfillment());
2269 } else if (objectOrFunction(value)) {
2270 handleMaybeThenable(promise, value, getThen(value));
2271 } else {
2272 fulfill(promise, value);
2273 }
2274 }
2275
2276 function publishRejection(promise) {
2277 if (promise._onerror) {
2278 promise._onerror(promise._result);
2279 }
2280
2281 publish(promise);
2282 }
2283
2284 function fulfill(promise, value) {
2285 if (promise._state !== PENDING) {
2286 return;
2287 }
2288
2289 promise._result = value;
2290 promise._state = FULFILLED;
2291
2292 if (promise._subscribers.length !== 0) {
2293 asap(publish, promise);
2294 }
2295 }
2296
2297 function _reject(promise, reason) {
2298 if (promise._state !== PENDING) {
2299 return;
2300 }
2301
2302 promise._state = REJECTED;
2303 promise._result = reason;
2304 asap(publishRejection, promise);
2305 }
2306
2307 function subscribe(parent, child, onFulfillment, onRejection) {
2308 var _subscribers = parent._subscribers;
2309 var length = _subscribers.length;
2310 parent._onerror = null;
2311 _subscribers[length] = child;
2312 _subscribers[length + FULFILLED] = onFulfillment;
2313 _subscribers[length + REJECTED] = onRejection;
2314
2315 if (length === 0 && parent._state) {
2316 asap(publish, parent);
2317 }
2318 }
2319
2320 function publish(promise) {
2321 var subscribers = promise._subscribers;
2322 var settled = promise._state;
2323
2324 if (subscribers.length === 0) {
2325 return;
2326 }
2327
2328 var child = undefined,
2329 callback = undefined,
2330 detail = promise._result;
2331
2332 for (var i = 0; i < subscribers.length; i += 3) {
2333 child = subscribers[i];
2334 callback = subscribers[i + settled];
2335
2336 if (child) {
2337 invokeCallback(settled, child, callback, detail);
2338 } else {
2339 callback(detail);
2340 }
2341 }
2342
2343 promise._subscribers.length = 0;
2344 }
2345
2346 function ErrorObject() {
2347 this.error = null;
2348 }
2349
2350 var TRY_CATCH_ERROR = new ErrorObject();
2351
2352 function tryCatch(callback, detail) {
2353 try {
2354 return callback(detail);
2355 } catch (e) {
2356 TRY_CATCH_ERROR.error = e;
2357 return TRY_CATCH_ERROR;
2358 }
2359 }
2360
2361 function invokeCallback(settled, promise, callback, detail) {
2362 var hasCallback = isFunction(callback),
2363 value = undefined,
2364 error = undefined,
2365 succeeded = undefined,
2366 failed = undefined;
2367
2368 if (hasCallback) {
2369 value = tryCatch(callback, detail);
2370
2371 if (value === TRY_CATCH_ERROR) {
2372 failed = true;
2373 error = value.error;
2374 value = null;
2375 } else {
2376 succeeded = true;
2377 }
2378
2379 if (promise === value) {
2380 _reject(promise, cannotReturnOwn());
2381
2382 return;
2383 }
2384 } else {
2385 value = detail;
2386 succeeded = true;
2387 }
2388
2389 if (promise._state !== PENDING) {// noop
2390 } else if (hasCallback && succeeded) {
2391 _resolve(promise, value);
2392 } else if (failed) {
2393 _reject(promise, error);
2394 } else if (settled === FULFILLED) {
2395 fulfill(promise, value);
2396 } else if (settled === REJECTED) {
2397 _reject(promise, value);
2398 }
2399 }
2400
2401 function initializePromise(promise, resolver) {
2402 try {
2403 resolver(function resolvePromise(value) {
2404 _resolve(promise, value);
2405 }, function rejectPromise(reason) {
2406 _reject(promise, reason);
2407 });
2408 } catch (e) {
2409 _reject(promise, e);
2410 }
2411 }
2412
2413 var id = 0;
2414
2415 function nextId() {
2416 return id++;
2417 }
2418
2419 function makePromise(promise) {
2420 promise[PROMISE_ID] = id++;
2421 promise._state = undefined;
2422 promise._result = undefined;
2423 promise._subscribers = [];
2424 }
2425
2426 function Enumerator(Constructor, input) {
2427 this._instanceConstructor = Constructor;
2428 this.promise = new Constructor(noop);
2429
2430 if (!this.promise[PROMISE_ID]) {
2431 makePromise(this.promise);
2432 }
2433
2434 if (isArray(input)) {
2435 this._input = input;
2436 this.length = input.length;
2437 this._remaining = input.length;
2438 this._result = new Array(this.length);
2439
2440 if (this.length === 0) {
2441 fulfill(this.promise, this._result);
2442 } else {
2443 this.length = this.length || 0;
2444
2445 this._enumerate();
2446
2447 if (this._remaining === 0) {
2448 fulfill(this.promise, this._result);
2449 }
2450 }
2451 } else {
2452 _reject(this.promise, validationError());
2453 }
2454 }
2455
2456 function validationError() {
2457 return new Error('Array Methods must be provided an Array');
2458 }
2459
2460 ;
2461
2462 Enumerator.prototype._enumerate = function () {
2463 var length = this.length;
2464 var _input = this._input;
2465
2466 for (var i = 0; this._state === PENDING && i < length; i++) {
2467 this._eachEntry(_input[i], i);
2468 }
2469 };
2470
2471 Enumerator.prototype._eachEntry = function (entry, i) {
2472 var c = this._instanceConstructor;
2473 var resolve$$ = c.resolve;
2474
2475 if (resolve$$ === resolve) {
2476 var _then = getThen(entry);
2477
2478 if (_then === then && entry._state !== PENDING) {
2479 this._settledAt(entry._state, i, entry._result);
2480 } else if (typeof _then !== 'function') {
2481 this._remaining--;
2482 this._result[i] = entry;
2483 } else if (c === Promise) {
2484 var promise = new c(noop);
2485 handleMaybeThenable(promise, entry, _then);
2486
2487 this._willSettleAt(promise, i);
2488 } else {
2489 this._willSettleAt(new c(function (resolve$$) {
2490 return resolve$$(entry);
2491 }), i);
2492 }
2493 } else {
2494 this._willSettleAt(resolve$$(entry), i);
2495 }
2496 };
2497
2498 Enumerator.prototype._settledAt = function (state, i, value) {
2499 var promise = this.promise;
2500
2501 if (promise._state === PENDING) {
2502 this._remaining--;
2503
2504 if (state === REJECTED) {
2505 _reject(promise, value);
2506 } else {
2507 this._result[i] = value;
2508 }
2509 }
2510
2511 if (this._remaining === 0) {
2512 fulfill(promise, this._result);
2513 }
2514 };
2515
2516 Enumerator.prototype._willSettleAt = function (promise, i) {
2517 var enumerator = this;
2518 subscribe(promise, undefined, function (value) {
2519 return enumerator._settledAt(FULFILLED, i, value);
2520 }, function (reason) {
2521 return enumerator._settledAt(REJECTED, i, reason);
2522 });
2523 };
2524 /**
2525 `Promise.all` accepts an array of promises, and returns a new promise which
2526 is fulfilled with an array of fulfillment values for the passed promises, or
2527 rejected with the reason of the first passed promise to be rejected. It casts all
2528 elements of the passed iterable to promises as it runs this algorithm.
2529
2530 Example:
2531
2532 ```javascript
2533 let promise1 = resolve(1);
2534 let promise2 = resolve(2);
2535 let promise3 = resolve(3);
2536 let promises = [ promise1, promise2, promise3 ];
2537
2538 Promise.all(promises).then(function(array){
2539 // The array here would be [ 1, 2, 3 ];
2540 });
2541 ```
2542
2543 If any of the `promises` given to `all` are rejected, the first promise
2544 that is rejected will be given as an argument to the returned promises's
2545 rejection handler. For example:
2546
2547 Example:
2548
2549 ```javascript
2550 let promise1 = resolve(1);
2551 let promise2 = reject(new Error("2"));
2552 let promise3 = reject(new Error("3"));
2553 let promises = [ promise1, promise2, promise3 ];
2554
2555 Promise.all(promises).then(function(array){
2556 // Code here never runs because there are rejected promises!
2557 }, function(error) {
2558 // error.message === "2"
2559 });
2560 ```
2561
2562 @method all
2563 @static
2564 @param {Array} entries array of promises
2565 @param {String} label optional string for labeling the promise.
2566 Useful for tooling.
2567 @return {Promise} promise that is fulfilled when all `promises` have been
2568 fulfilled, or rejected if any of them become rejected.
2569 @static
2570 */
2571
2572
2573 function all(entries) {
2574 return new Enumerator(this, entries).promise;
2575 }
2576 /**
2577 `Promise.race` returns a new promise which is settled in the same way as the
2578 first passed promise to settle.
2579
2580 Example:
2581
2582 ```javascript
2583 let promise1 = new Promise(function(resolve, reject){
2584 setTimeout(function(){
2585 resolve('promise 1');
2586 }, 200);
2587 });
2588
2589 let promise2 = new Promise(function(resolve, reject){
2590 setTimeout(function(){
2591 resolve('promise 2');
2592 }, 100);
2593 });
2594
2595 Promise.race([promise1, promise2]).then(function(result){
2596 // result === 'promise 2' because it was resolved before promise1
2597 // was resolved.
2598 });
2599 ```
2600
2601 `Promise.race` is deterministic in that only the state of the first
2602 settled promise matters. For example, even if other promises given to the
2603 `promises` array argument are resolved, but the first settled promise has
2604 become rejected before the other promises became fulfilled, the returned
2605 promise will become rejected:
2606
2607 ```javascript
2608 let promise1 = new Promise(function(resolve, reject){
2609 setTimeout(function(){
2610 resolve('promise 1');
2611 }, 200);
2612 });
2613
2614 let promise2 = new Promise(function(resolve, reject){
2615 setTimeout(function(){
2616 reject(new Error('promise 2'));
2617 }, 100);
2618 });
2619
2620 Promise.race([promise1, promise2]).then(function(result){
2621 // Code here never runs
2622 }, function(reason){
2623 // reason.message === 'promise 2' because promise 2 became rejected before
2624 // promise 1 became fulfilled
2625 });
2626 ```
2627
2628 An example real-world use case is implementing timeouts:
2629
2630 ```javascript
2631 Promise.race([ajax('foo.json'), timeout(5000)])
2632 ```
2633
2634 @method race
2635 @static
2636 @param {Array} promises array of promises to observe
2637 Useful for tooling.
2638 @return {Promise} a promise which settles in the same way as the first passed
2639 promise to settle.
2640 */
2641
2642
2643 function race(entries) {
2644 /*jshint validthis:true */
2645 var Constructor = this;
2646
2647 if (!isArray(entries)) {
2648 return new Constructor(function (_, reject) {
2649 return reject(new TypeError('You must pass an array to race.'));
2650 });
2651 } else {
2652 return new Constructor(function (resolve, reject) {
2653 var length = entries.length;
2654
2655 for (var i = 0; i < length; i++) {
2656 Constructor.resolve(entries[i]).then(resolve, reject);
2657 }
2658 });
2659 }
2660 }
2661 /**
2662 `Promise.reject` returns a promise rejected with the passed `reason`.
2663 It is shorthand for the following:
2664
2665 ```javascript
2666 let promise = new Promise(function(resolve, reject){
2667 reject(new Error('WHOOPS'));
2668 });
2669
2670 promise.then(function(value){
2671 // Code here doesn't run because the promise is rejected!
2672 }, function(reason){
2673 // reason.message === 'WHOOPS'
2674 });
2675 ```
2676
2677 Instead of writing the above, your code now simply becomes the following:
2678
2679 ```javascript
2680 let promise = Promise.reject(new Error('WHOOPS'));
2681
2682 promise.then(function(value){
2683 // Code here doesn't run because the promise is rejected!
2684 }, function(reason){
2685 // reason.message === 'WHOOPS'
2686 });
2687 ```
2688
2689 @method reject
2690 @static
2691 @param {Any} reason value that the returned promise will be rejected with.
2692 Useful for tooling.
2693 @return {Promise} a promise rejected with the given `reason`.
2694 */
2695
2696
2697 function reject(reason) {
2698 /*jshint validthis:true */
2699 var Constructor = this;
2700 var promise = new Constructor(noop);
2701
2702 _reject(promise, reason);
2703
2704 return promise;
2705 }
2706
2707 function needsResolver() {
2708 throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
2709 }
2710
2711 function needsNew() {
2712 throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
2713 }
2714 /**
2715 Promise objects represent the eventual result of an asynchronous operation. The
2716 primary way of interacting with a promise is through its `then` method, which
2717 registers callbacks to receive either a promise's eventual value or the reason
2718 why the promise cannot be fulfilled.
2719
2720 Terminology
2721 -----------
2722
2723 - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
2724 - `thenable` is an object or function that defines a `then` method.
2725 - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
2726 - `exception` is a value that is thrown using the throw statement.
2727 - `reason` is a value that indicates why a promise was rejected.
2728 - `settled` the final resting state of a promise, fulfilled or rejected.
2729
2730 A promise can be in one of three states: pending, fulfilled, or rejected.
2731
2732 Promises that are fulfilled have a fulfillment value and are in the fulfilled
2733 state. Promises that are rejected have a rejection reason and are in the
2734 rejected state. A fulfillment value is never a thenable.
2735
2736 Promises can also be said to *resolve* a value. If this value is also a
2737 promise, then the original promise's settled state will match the value's
2738 settled state. So a promise that *resolves* a promise that rejects will
2739 itself reject, and a promise that *resolves* a promise that fulfills will
2740 itself fulfill.
2741
2742
2743 Basic Usage:
2744 ------------
2745
2746 ```js
2747 let promise = new Promise(function(resolve, reject) {
2748 // on success
2749 resolve(value);
2750
2751 // on failure
2752 reject(reason);
2753 });
2754
2755 promise.then(function(value) {
2756 // on fulfillment
2757 }, function(reason) {
2758 // on rejection
2759 });
2760 ```
2761
2762 Advanced Usage:
2763 ---------------
2764
2765 Promises shine when abstracting away asynchronous interactions such as
2766 `XMLHttpRequest`s.
2767
2768 ```js
2769 function getJSON(url) {
2770 return new Promise(function(resolve, reject){
2771 let xhr = new XMLHttpRequest();
2772
2773 xhr.open('GET', url);
2774 xhr.onreadystatechange = handler;
2775 xhr.responseType = 'json';
2776 xhr.setRequestHeader('Accept', 'application/json');
2777 xhr.send();
2778
2779 function handler() {
2780 if (this.readyState === this.DONE) {
2781 if (this.status === 200) {
2782 resolve(this.response);
2783 } else {
2784 reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
2785 }
2786 }
2787 };
2788 });
2789 }
2790
2791 getJSON('/posts.json').then(function(json) {
2792 // on fulfillment
2793 }, function(reason) {
2794 // on rejection
2795 });
2796 ```
2797
2798 Unlike callbacks, promises are great composable primitives.
2799
2800 ```js
2801 Promise.all([
2802 getJSON('/posts'),
2803 getJSON('/comments')
2804 ]).then(function(values){
2805 values[0] // => postsJSON
2806 values[1] // => commentsJSON
2807
2808 return values;
2809 });
2810 ```
2811
2812 @class Promise
2813 @param {function} resolver
2814 Useful for tooling.
2815 @constructor
2816 */
2817
2818
2819 function Promise(resolver) {
2820 this[PROMISE_ID] = nextId();
2821 this._result = this._state = undefined;
2822 this._subscribers = [];
2823
2824 if (noop !== resolver) {
2825 typeof resolver !== 'function' && needsResolver();
2826 this instanceof Promise ? initializePromise(this, resolver) : needsNew();
2827 }
2828 }
2829
2830 Promise.all = all;
2831 Promise.race = race;
2832 Promise.resolve = resolve;
2833 Promise.reject = reject;
2834 Promise._setScheduler = setScheduler;
2835 Promise._setAsap = setAsap;
2836 Promise._asap = asap;
2837 Promise.prototype = {
2838 constructor: Promise,
2839
2840 /**
2841 The primary way of interacting with a promise is through its `then` method,
2842 which registers callbacks to receive either a promise's eventual value or the
2843 reason why the promise cannot be fulfilled.
2844
2845 ```js
2846 findUser().then(function(user){
2847 // user is available
2848 }, function(reason){
2849 // user is unavailable, and you are given the reason why
2850 });
2851 ```
2852
2853 Chaining
2854 --------
2855
2856 The return value of `then` is itself a promise. This second, 'downstream'
2857 promise is resolved with the return value of the first promise's fulfillment
2858 or rejection handler, or rejected if the handler throws an exception.
2859
2860 ```js
2861 findUser().then(function (user) {
2862 return user.name;
2863 }, function (reason) {
2864 return 'default name';
2865 }).then(function (userName) {
2866 // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
2867 // will be `'default name'`
2868 });
2869
2870 findUser().then(function (user) {
2871 throw new Error('Found user, but still unhappy');
2872 }, function (reason) {
2873 throw new Error('`findUser` rejected and we're unhappy');
2874 }).then(function (value) {
2875 // never reached
2876 }, function (reason) {
2877 // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
2878 // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
2879 });
2880 ```
2881 If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
2882
2883 ```js
2884 findUser().then(function (user) {
2885 throw new PedagogicalException('Upstream error');
2886 }).then(function (value) {
2887 // never reached
2888 }).then(function (value) {
2889 // never reached
2890 }, function (reason) {
2891 // The `PedgagocialException` is propagated all the way down to here
2892 });
2893 ```
2894
2895 Assimilation
2896 ------------
2897
2898 Sometimes the value you want to propagate to a downstream promise can only be
2899 retrieved asynchronously. This can be achieved by returning a promise in the
2900 fulfillment or rejection handler. The downstream promise will then be pending
2901 until the returned promise is settled. This is called *assimilation*.
2902
2903 ```js
2904 findUser().then(function (user) {
2905 return findCommentsByAuthor(user);
2906 }).then(function (comments) {
2907 // The user's comments are now available
2908 });
2909 ```
2910
2911 If the assimliated promise rejects, then the downstream promise will also reject.
2912
2913 ```js
2914 findUser().then(function (user) {
2915 return findCommentsByAuthor(user);
2916 }).then(function (comments) {
2917 // If `findCommentsByAuthor` fulfills, we'll have the value here
2918 }, function (reason) {
2919 // If `findCommentsByAuthor` rejects, we'll have the reason here
2920 });
2921 ```
2922
2923 Simple Example
2924 --------------
2925
2926 Synchronous Example
2927
2928 ```javascript
2929 let result;
2930
2931 try {
2932 result = findResult();
2933 // success
2934 } catch(reason) {
2935 // failure
2936 }
2937 ```
2938
2939 Errback Example
2940
2941 ```js
2942 findResult(function(result, err){
2943 if (err) {
2944 // failure
2945 } else {
2946 // success
2947 }
2948 });
2949 ```
2950
2951 Promise Example;
2952
2953 ```javascript
2954 findResult().then(function(result){
2955 // success
2956 }, function(reason){
2957 // failure
2958 });
2959 ```
2960
2961 Advanced Example
2962 --------------
2963
2964 Synchronous Example
2965
2966 ```javascript
2967 let author, books;
2968
2969 try {
2970 author = findAuthor();
2971 books = findBooksByAuthor(author);
2972 // success
2973 } catch(reason) {
2974 // failure
2975 }
2976 ```
2977
2978 Errback Example
2979
2980 ```js
2981
2982 function foundBooks(books) {
2983
2984 }
2985
2986 function failure(reason) {
2987
2988 }
2989
2990 findAuthor(function(author, err){
2991 if (err) {
2992 failure(err);
2993 // failure
2994 } else {
2995 try {
2996 findBoooksByAuthor(author, function(books, err) {
2997 if (err) {
2998 failure(err);
2999 } else {
3000 try {
3001 foundBooks(books);
3002 } catch(reason) {
3003 failure(reason);
3004 }
3005 }
3006 });
3007 } catch(error) {
3008 failure(err);
3009 }
3010 // success
3011 }
3012 });
3013 ```
3014
3015 Promise Example;
3016
3017 ```javascript
3018 findAuthor().
3019 then(findBooksByAuthor).
3020 then(function(books){
3021 // found books
3022 }).catch(function(reason){
3023 // something went wrong
3024 });
3025 ```
3026
3027 @method then
3028 @param {Function} onFulfilled
3029 @param {Function} onRejected
3030 Useful for tooling.
3031 @return {Promise}
3032 */
3033 then: then,
3034
3035 /**
3036 `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
3037 as the catch block of a try/catch statement.
3038
3039 ```js
3040 function findAuthor(){
3041 throw new Error('couldn't find that author');
3042 }
3043
3044 // synchronous
3045 try {
3046 findAuthor();
3047 } catch(reason) {
3048 // something went wrong
3049 }
3050
3051 // async with promises
3052 findAuthor().catch(function(reason){
3053 // something went wrong
3054 });
3055 ```
3056
3057 @method catch
3058 @param {Function} onRejection
3059 Useful for tooling.
3060 @return {Promise}
3061 */
3062 'catch': function _catch(onRejection) {
3063 return this.then(null, onRejection);
3064 }
3065 };
3066
3067 function polyfill() {
3068 var local = undefined;
3069
3070 if (typeof global !== 'undefined') {
3071 local = global;
3072 } else if (typeof self !== 'undefined') {
3073 local = self;
3074 } else {
3075 try {
3076 local = Function('return this')();
3077 } catch (e) {
3078 throw new Error('polyfill failed because global object is unavailable in this environment');
3079 }
3080 }
3081
3082 var P = local.Promise;
3083
3084 if (P) {
3085 var promiseToString = null;
3086
3087 try {
3088 promiseToString = Object.prototype.toString.call(P.resolve());
3089 } catch (e) {// silently ignored
3090 }
3091
3092 if (promiseToString === '[object Promise]' && !P.cast) {
3093 return;
3094 }
3095 }
3096
3097 local.Promise = Promise;
3098 }
3099
3100 polyfill(); // Strange compat..
3101
3102 Promise.polyfill = polyfill;
3103 Promise.Promise = Promise;
3104 return Promise;
3105 });
3106 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
3107
3108 /***/ }),
3109
3110 /***/ "./node_modules/process/browser.js":
3111 /*!*****************************************!*\
3112 !*** ./node_modules/process/browser.js ***!
3113 \*****************************************/
3114 /*! no static exports found */
3115 /***/ (function(module, exports) {
3116
3117 // shim for using process in browser
3118 var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
3119 // don't break things. But we need to wrap it in a try catch in case it is
3120 // wrapped in strict mode code which doesn't define any globals. It's inside a
3121 // function because try/catches deoptimize in certain engines.
3122
3123 var cachedSetTimeout;
3124 var cachedClearTimeout;
3125
3126 function defaultSetTimout() {
3127 throw new Error('setTimeout has not been defined');
3128 }
3129
3130 function defaultClearTimeout() {
3131 throw new Error('clearTimeout has not been defined');
3132 }
3133
3134 (function () {
3135 try {
3136 if (typeof setTimeout === 'function') {
3137 cachedSetTimeout = setTimeout;
3138 } else {
3139 cachedSetTimeout = defaultSetTimout;
3140 }
3141 } catch (e) {
3142 cachedSetTimeout = defaultSetTimout;
3143 }
3144
3145 try {
3146 if (typeof clearTimeout === 'function') {
3147 cachedClearTimeout = clearTimeout;
3148 } else {
3149 cachedClearTimeout = defaultClearTimeout;
3150 }
3151 } catch (e) {
3152 cachedClearTimeout = defaultClearTimeout;
3153 }
3154 })();
3155
3156 function runTimeout(fun) {
3157 if (cachedSetTimeout === setTimeout) {
3158 //normal enviroments in sane situations
3159 return setTimeout(fun, 0);
3160 } // if setTimeout wasn't available but was latter defined
3161
3162
3163 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
3164 cachedSetTimeout = setTimeout;
3165 return setTimeout(fun, 0);
3166 }
3167
3168 try {
3169 // when when somebody has screwed with setTimeout but no I.E. maddness
3170 return cachedSetTimeout(fun, 0);
3171 } catch (e) {
3172 try {
3173 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
3174 return cachedSetTimeout.call(null, fun, 0);
3175 } catch (e) {
3176 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
3177 return cachedSetTimeout.call(this, fun, 0);
3178 }
3179 }
3180 }
3181
3182 function runClearTimeout(marker) {
3183 if (cachedClearTimeout === clearTimeout) {
3184 //normal enviroments in sane situations
3185 return clearTimeout(marker);
3186 } // if clearTimeout wasn't available but was latter defined
3187
3188
3189 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
3190 cachedClearTimeout = clearTimeout;
3191 return clearTimeout(marker);
3192 }
3193
3194 try {
3195 // when when somebody has screwed with setTimeout but no I.E. maddness
3196 return cachedClearTimeout(marker);
3197 } catch (e) {
3198 try {
3199 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
3200 return cachedClearTimeout.call(null, marker);
3201 } catch (e) {
3202 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
3203 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
3204 return cachedClearTimeout.call(this, marker);
3205 }
3206 }
3207 }
3208
3209 var queue = [];
3210 var draining = false;
3211 var currentQueue;
3212 var queueIndex = -1;
3213
3214 function cleanUpNextTick() {
3215 if (!draining || !currentQueue) {
3216 return;
3217 }
3218
3219 draining = false;
3220
3221 if (currentQueue.length) {
3222 queue = currentQueue.concat(queue);
3223 } else {
3224 queueIndex = -1;
3225 }
3226
3227 if (queue.length) {
3228 drainQueue();
3229 }
3230 }
3231
3232 function drainQueue() {
3233 if (draining) {
3234 return;
3235 }
3236
3237 var timeout = runTimeout(cleanUpNextTick);
3238 draining = true;
3239 var len = queue.length;
3240
3241 while (len) {
3242 currentQueue = queue;
3243 queue = [];
3244
3245 while (++queueIndex < len) {
3246 if (currentQueue) {
3247 currentQueue[queueIndex].run();
3248 }
3249 }
3250
3251 queueIndex = -1;
3252 len = queue.length;
3253 }
3254
3255 currentQueue = null;
3256 draining = false;
3257 runClearTimeout(timeout);
3258 }
3259
3260 process.nextTick = function (fun) {
3261 var args = new Array(arguments.length - 1);
3262
3263 if (arguments.length > 1) {
3264 for (var i = 1; i < arguments.length; i++) {
3265 args[i - 1] = arguments[i];
3266 }
3267 }
3268
3269 queue.push(new Item(fun, args));
3270
3271 if (queue.length === 1 && !draining) {
3272 runTimeout(drainQueue);
3273 }
3274 }; // v8 likes predictible objects
3275
3276
3277 function Item(fun, array) {
3278 this.fun = fun;
3279 this.array = array;
3280 }
3281
3282 Item.prototype.run = function () {
3283 this.fun.apply(null, this.array);
3284 };
3285
3286 process.title = 'browser';
3287 process.browser = true;
3288 process.env = {};
3289 process.argv = [];
3290 process.version = ''; // empty string to avoid regexp issues
3291
3292 process.versions = {};
3293
3294 function noop() {}
3295
3296 process.on = noop;
3297 process.addListener = noop;
3298 process.once = noop;
3299 process.off = noop;
3300 process.removeListener = noop;
3301 process.removeAllListeners = noop;
3302 process.emit = noop;
3303 process.prependListener = noop;
3304 process.prependOnceListener = noop;
3305
3306 process.listeners = function (name) {
3307 return [];
3308 };
3309
3310 process.binding = function (name) {
3311 throw new Error('process.binding is not supported');
3312 };
3313
3314 process.cwd = function () {
3315 return '/';
3316 };
3317
3318 process.chdir = function (dir) {
3319 throw new Error('process.chdir is not supported');
3320 };
3321
3322 process.umask = function () {
3323 return 0;
3324 };
3325
3326 /***/ }),
3327
3328 /***/ "./node_modules/regenerator-runtime/runtime.js":
3329 /*!*****************************************************!*\
3330 !*** ./node_modules/regenerator-runtime/runtime.js ***!
3331 \*****************************************************/
3332 /*! no static exports found */
3333 /***/ (function(module, exports, __webpack_require__) {
3334
3335 /* WEBPACK VAR INJECTION */(function(module) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3336
3337 /**
3338 * Copyright (c) 2014-present, Facebook, Inc.
3339 *
3340 * This source code is licensed under the MIT license found in the
3341 * LICENSE file in the root directory of this source tree.
3342 */
3343 var runtime = function (exports) {
3344 "use strict";
3345
3346 var Op = Object.prototype;
3347 var hasOwn = Op.hasOwnProperty;
3348 var undefined; // More compressible than void 0.
3349
3350 var $Symbol = typeof Symbol === "function" ? Symbol : {};
3351 var iteratorSymbol = $Symbol.iterator || "@@iterator";
3352 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
3353 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
3354
3355 function wrap(innerFn, outerFn, self, tryLocsList) {
3356 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
3357 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
3358 var generator = Object.create(protoGenerator.prototype);
3359 var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
3360 // .throw, and .return methods.
3361
3362 generator._invoke = makeInvokeMethod(innerFn, self, context);
3363 return generator;
3364 }
3365
3366 exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
3367 // record like context.tryEntries[i].completion. This interface could
3368 // have been (and was previously) designed to take a closure to be
3369 // invoked without arguments, but in all the cases we care about we
3370 // already have an existing method we want to call, so there's no need
3371 // to create a new function object. We can even get away with assuming
3372 // the method takes exactly one argument, since that happens to be true
3373 // in every case, so we don't have to touch the arguments object. The
3374 // only additional allocation required is the completion record, which
3375 // has a stable shape and so hopefully should be cheap to allocate.
3376
3377 function tryCatch(fn, obj, arg) {
3378 try {
3379 return {
3380 type: "normal",
3381 arg: fn.call(obj, arg)
3382 };
3383 } catch (err) {
3384 return {
3385 type: "throw",
3386 arg: err
3387 };
3388 }
3389 }
3390
3391 var GenStateSuspendedStart = "suspendedStart";
3392 var GenStateSuspendedYield = "suspendedYield";
3393 var GenStateExecuting = "executing";
3394 var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
3395 // breaking out of the dispatch switch statement.
3396
3397 var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
3398 // .constructor.prototype properties for functions that return Generator
3399 // objects. For full spec compliance, you may wish to configure your
3400 // minifier not to mangle the names of these two functions.
3401
3402 function Generator() {}
3403
3404 function GeneratorFunction() {}
3405
3406 function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
3407 // don't natively support it.
3408
3409
3410 var IteratorPrototype = {};
3411
3412 IteratorPrototype[iteratorSymbol] = function () {
3413 return this;
3414 };
3415
3416 var getProto = Object.getPrototypeOf;
3417 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
3418
3419 if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
3420 // This environment has a native %IteratorPrototype%; use it instead
3421 // of the polyfill.
3422 IteratorPrototype = NativeIteratorPrototype;
3423 }
3424
3425 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
3426 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
3427 GeneratorFunctionPrototype.constructor = GeneratorFunction;
3428 GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
3429 // Iterator interface in terms of a single ._invoke method.
3430
3431 function defineIteratorMethods(prototype) {
3432 ["next", "throw", "return"].forEach(function (method) {
3433 prototype[method] = function (arg) {
3434 return this._invoke(method, arg);
3435 };
3436 });
3437 }
3438
3439 exports.isGeneratorFunction = function (genFun) {
3440 var ctor = typeof genFun === "function" && genFun.constructor;
3441 return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
3442 // do is to check its .name property.
3443 (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
3444 };
3445
3446 exports.mark = function (genFun) {
3447 if (Object.setPrototypeOf) {
3448 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
3449 } else {
3450 genFun.__proto__ = GeneratorFunctionPrototype;
3451
3452 if (!(toStringTagSymbol in genFun)) {
3453 genFun[toStringTagSymbol] = "GeneratorFunction";
3454 }
3455 }
3456
3457 genFun.prototype = Object.create(Gp);
3458 return genFun;
3459 }; // Within the body of any async function, `await x` is transformed to
3460 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
3461 // `hasOwn.call(value, "__await")` to determine if the yielded value is
3462 // meant to be awaited.
3463
3464
3465 exports.awrap = function (arg) {
3466 return {
3467 __await: arg
3468 };
3469 };
3470
3471 function AsyncIterator(generator, PromiseImpl) {
3472 function invoke(method, arg, resolve, reject) {
3473 var record = tryCatch(generator[method], generator, arg);
3474
3475 if (record.type === "throw") {
3476 reject(record.arg);
3477 } else {
3478 var result = record.arg;
3479 var value = result.value;
3480
3481 if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
3482 return PromiseImpl.resolve(value.__await).then(function (value) {
3483 invoke("next", value, resolve, reject);
3484 }, function (err) {
3485 invoke("throw", err, resolve, reject);
3486 });
3487 }
3488
3489 return PromiseImpl.resolve(value).then(function (unwrapped) {
3490 // When a yielded Promise is resolved, its final value becomes
3491 // the .value of the Promise<{value,done}> result for the
3492 // current iteration.
3493 result.value = unwrapped;
3494 resolve(result);
3495 }, function (error) {
3496 // If a rejected Promise was yielded, throw the rejection back
3497 // into the async generator function so it can be handled there.
3498 return invoke("throw", error, resolve, reject);
3499 });
3500 }
3501 }
3502
3503 var previousPromise;
3504
3505 function enqueue(method, arg) {
3506 function callInvokeWithMethodAndArg() {
3507 return new PromiseImpl(function (resolve, reject) {
3508 invoke(method, arg, resolve, reject);
3509 });
3510 }
3511
3512 return previousPromise = // If enqueue has been called before, then we want to wait until
3513 // all previous Promises have been resolved before calling invoke,
3514 // so that results are always delivered in the correct order. If
3515 // enqueue has not been called before, then it is important to
3516 // call invoke immediately, without waiting on a callback to fire,
3517 // so that the async generator function has the opportunity to do
3518 // any necessary setup in a predictable way. This predictability
3519 // is why the Promise constructor synchronously invokes its
3520 // executor callback, and why async functions synchronously
3521 // execute code before the first await. Since we implement simple
3522 // async functions in terms of async generators, it is especially
3523 // important to get this right, even though it requires care.
3524 previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
3525 // invocations of the iterator.
3526 callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
3527 } // Define the unified helper method that is used to implement .next,
3528 // .throw, and .return (see defineIteratorMethods).
3529
3530
3531 this._invoke = enqueue;
3532 }
3533
3534 defineIteratorMethods(AsyncIterator.prototype);
3535
3536 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
3537 return this;
3538 };
3539
3540 exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
3541 // AsyncIterator objects; they just return a Promise for the value of
3542 // the final result produced by the iterator.
3543
3544 exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
3545 if (PromiseImpl === void 0) PromiseImpl = Promise;
3546 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
3547 return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
3548 : iter.next().then(function (result) {
3549 return result.done ? result.value : iter.next();
3550 });
3551 };
3552
3553 function makeInvokeMethod(innerFn, self, context) {
3554 var state = GenStateSuspendedStart;
3555 return function invoke(method, arg) {
3556 if (state === GenStateExecuting) {
3557 throw new Error("Generator is already running");
3558 }
3559
3560 if (state === GenStateCompleted) {
3561 if (method === "throw") {
3562 throw arg;
3563 } // Be forgiving, per 25.3.3.3.3 of the spec:
3564 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
3565
3566
3567 return doneResult();
3568 }
3569
3570 context.method = method;
3571 context.arg = arg;
3572
3573 while (true) {
3574 var delegate = context.delegate;
3575
3576 if (delegate) {
3577 var delegateResult = maybeInvokeDelegate(delegate, context);
3578
3579 if (delegateResult) {
3580 if (delegateResult === ContinueSentinel) continue;
3581 return delegateResult;
3582 }
3583 }
3584
3585 if (context.method === "next") {
3586 // Setting context._sent for legacy support of Babel's
3587 // function.sent implementation.
3588 context.sent = context._sent = context.arg;
3589 } else if (context.method === "throw") {
3590 if (state === GenStateSuspendedStart) {
3591 state = GenStateCompleted;
3592 throw context.arg;
3593 }
3594
3595 context.dispatchException(context.arg);
3596 } else if (context.method === "return") {
3597 context.abrupt("return", context.arg);
3598 }
3599
3600 state = GenStateExecuting;
3601 var record = tryCatch(innerFn, self, context);
3602
3603 if (record.type === "normal") {
3604 // If an exception is thrown from innerFn, we leave state ===
3605 // GenStateExecuting and loop back for another invocation.
3606 state = context.done ? GenStateCompleted : GenStateSuspendedYield;
3607
3608 if (record.arg === ContinueSentinel) {
3609 continue;
3610 }
3611
3612 return {
3613 value: record.arg,
3614 done: context.done
3615 };
3616 } else if (record.type === "throw") {
3617 state = GenStateCompleted; // Dispatch the exception by looping back around to the
3618 // context.dispatchException(context.arg) call above.
3619
3620 context.method = "throw";
3621 context.arg = record.arg;
3622 }
3623 }
3624 };
3625 } // Call delegate.iterator[context.method](context.arg) and handle the
3626 // result, either by returning a { value, done } result from the
3627 // delegate iterator, or by modifying context.method and context.arg,
3628 // setting context.delegate to null, and returning the ContinueSentinel.
3629
3630
3631 function maybeInvokeDelegate(delegate, context) {
3632 var method = delegate.iterator[context.method];
3633
3634 if (method === undefined) {
3635 // A .throw or .return when the delegate iterator has no .throw
3636 // method always terminates the yield* loop.
3637 context.delegate = null;
3638
3639 if (context.method === "throw") {
3640 // Note: ["return"] must be used for ES3 parsing compatibility.
3641 if (delegate.iterator["return"]) {
3642 // If the delegate iterator has a return method, give it a
3643 // chance to clean up.
3644 context.method = "return";
3645 context.arg = undefined;
3646 maybeInvokeDelegate(delegate, context);
3647
3648 if (context.method === "throw") {
3649 // If maybeInvokeDelegate(context) changed context.method from
3650 // "return" to "throw", let that override the TypeError below.
3651 return ContinueSentinel;
3652 }
3653 }
3654
3655 context.method = "throw";
3656 context.arg = new TypeError("The iterator does not provide a 'throw' method");
3657 }
3658
3659 return ContinueSentinel;
3660 }
3661
3662 var record = tryCatch(method, delegate.iterator, context.arg);
3663
3664 if (record.type === "throw") {
3665 context.method = "throw";
3666 context.arg = record.arg;
3667 context.delegate = null;
3668 return ContinueSentinel;
3669 }
3670
3671 var info = record.arg;
3672
3673 if (!info) {
3674 context.method = "throw";
3675 context.arg = new TypeError("iterator result is not an object");
3676 context.delegate = null;
3677 return ContinueSentinel;
3678 }
3679
3680 if (info.done) {
3681 // Assign the result of the finished delegate to the temporary
3682 // variable specified by delegate.resultName (see delegateYield).
3683 context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
3684
3685 context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
3686 // exception, let the outer generator proceed normally. If
3687 // context.method was "next", forget context.arg since it has been
3688 // "consumed" by the delegate iterator. If context.method was
3689 // "return", allow the original .return call to continue in the
3690 // outer generator.
3691
3692 if (context.method !== "return") {
3693 context.method = "next";
3694 context.arg = undefined;
3695 }
3696 } else {
3697 // Re-yield the result returned by the delegate method.
3698 return info;
3699 } // The delegate iterator is finished, so forget it and continue with
3700 // the outer generator.
3701
3702
3703 context.delegate = null;
3704 return ContinueSentinel;
3705 } // Define Generator.prototype.{next,throw,return} in terms of the
3706 // unified ._invoke helper method.
3707
3708
3709 defineIteratorMethods(Gp);
3710 Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the
3711 // @@iterator function is called on it. Some browsers' implementations of the
3712 // iterator prototype chain incorrectly implement this, causing the Generator
3713 // object to not be returned from this call. This ensures that doesn't happen.
3714 // See https://github.com/facebook/regenerator/issues/274 for more details.
3715
3716 Gp[iteratorSymbol] = function () {
3717 return this;
3718 };
3719
3720 Gp.toString = function () {
3721 return "[object Generator]";
3722 };
3723
3724 function pushTryEntry(locs) {
3725 var entry = {
3726 tryLoc: locs[0]
3727 };
3728
3729 if (1 in locs) {
3730 entry.catchLoc = locs[1];
3731 }
3732
3733 if (2 in locs) {
3734 entry.finallyLoc = locs[2];
3735 entry.afterLoc = locs[3];
3736 }
3737
3738 this.tryEntries.push(entry);
3739 }
3740
3741 function resetTryEntry(entry) {
3742 var record = entry.completion || {};
3743 record.type = "normal";
3744 delete record.arg;
3745 entry.completion = record;
3746 }
3747
3748 function Context(tryLocsList) {
3749 // The root entry object (effectively a try statement without a catch
3750 // or a finally block) gives us a place to store values thrown from
3751 // locations where there is no enclosing try statement.
3752 this.tryEntries = [{
3753 tryLoc: "root"
3754 }];
3755 tryLocsList.forEach(pushTryEntry, this);
3756 this.reset(true);
3757 }
3758
3759 exports.keys = function (object) {
3760 var keys = [];
3761
3762 for (var key in object) {
3763 keys.push(key);
3764 }
3765
3766 keys.reverse(); // Rather than returning an object with a next method, we keep
3767 // things simple and return the next function itself.
3768
3769 return function next() {
3770 while (keys.length) {
3771 var key = keys.pop();
3772
3773 if (key in object) {
3774 next.value = key;
3775 next.done = false;
3776 return next;
3777 }
3778 } // To avoid creating an additional object, we just hang the .value
3779 // and .done properties off the next function object itself. This
3780 // also ensures that the minifier will not anonymize the function.
3781
3782
3783 next.done = true;
3784 return next;
3785 };
3786 };
3787
3788 function values(iterable) {
3789 if (iterable) {
3790 var iteratorMethod = iterable[iteratorSymbol];
3791
3792 if (iteratorMethod) {
3793 return iteratorMethod.call(iterable);
3794 }
3795
3796 if (typeof iterable.next === "function") {
3797 return iterable;
3798 }
3799
3800 if (!isNaN(iterable.length)) {
3801 var i = -1,
3802 next = function next() {
3803 while (++i < iterable.length) {
3804 if (hasOwn.call(iterable, i)) {
3805 next.value = iterable[i];
3806 next.done = false;
3807 return next;
3808 }
3809 }
3810
3811 next.value = undefined;
3812 next.done = true;
3813 return next;
3814 };
3815
3816 return next.next = next;
3817 }
3818 } // Return an iterator with no values.
3819
3820
3821 return {
3822 next: doneResult
3823 };
3824 }
3825
3826 exports.values = values;
3827
3828 function doneResult() {
3829 return {
3830 value: undefined,
3831 done: true
3832 };
3833 }
3834
3835 Context.prototype = {
3836 constructor: Context,
3837 reset: function reset(skipTempReset) {
3838 this.prev = 0;
3839 this.next = 0; // Resetting context._sent for legacy support of Babel's
3840 // function.sent implementation.
3841
3842 this.sent = this._sent = undefined;
3843 this.done = false;
3844 this.delegate = null;
3845 this.method = "next";
3846 this.arg = undefined;
3847 this.tryEntries.forEach(resetTryEntry);
3848
3849 if (!skipTempReset) {
3850 for (var name in this) {
3851 // Not sure about the optimal order of these conditions:
3852 if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
3853 this[name] = undefined;
3854 }
3855 }
3856 }
3857 },
3858 stop: function stop() {
3859 this.done = true;
3860 var rootEntry = this.tryEntries[0];
3861 var rootRecord = rootEntry.completion;
3862
3863 if (rootRecord.type === "throw") {
3864 throw rootRecord.arg;
3865 }
3866
3867 return this.rval;
3868 },
3869 dispatchException: function dispatchException(exception) {
3870 if (this.done) {
3871 throw exception;
3872 }
3873
3874 var context = this;
3875
3876 function handle(loc, caught) {
3877 record.type = "throw";
3878 record.arg = exception;
3879 context.next = loc;
3880
3881 if (caught) {
3882 // If the dispatched exception was caught by a catch block,
3883 // then let that catch block handle the exception normally.
3884 context.method = "next";
3885 context.arg = undefined;
3886 }
3887
3888 return !!caught;
3889 }
3890
3891 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3892 var entry = this.tryEntries[i];
3893 var record = entry.completion;
3894
3895 if (entry.tryLoc === "root") {
3896 // Exception thrown outside of any try block that could handle
3897 // it, so set the completion value of the entire function to
3898 // throw the exception.
3899 return handle("end");
3900 }
3901
3902 if (entry.tryLoc <= this.prev) {
3903 var hasCatch = hasOwn.call(entry, "catchLoc");
3904 var hasFinally = hasOwn.call(entry, "finallyLoc");
3905
3906 if (hasCatch && hasFinally) {
3907 if (this.prev < entry.catchLoc) {
3908 return handle(entry.catchLoc, true);
3909 } else if (this.prev < entry.finallyLoc) {
3910 return handle(entry.finallyLoc);
3911 }
3912 } else if (hasCatch) {
3913 if (this.prev < entry.catchLoc) {
3914 return handle(entry.catchLoc, true);
3915 }
3916 } else if (hasFinally) {
3917 if (this.prev < entry.finallyLoc) {
3918 return handle(entry.finallyLoc);
3919 }
3920 } else {
3921 throw new Error("try statement without catch or finally");
3922 }
3923 }
3924 }
3925 },
3926 abrupt: function abrupt(type, arg) {
3927 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3928 var entry = this.tryEntries[i];
3929
3930 if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
3931 var finallyEntry = entry;
3932 break;
3933 }
3934 }
3935
3936 if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
3937 // Ignore the finally entry if control is not jumping to a
3938 // location outside the try/catch block.
3939 finallyEntry = null;
3940 }
3941
3942 var record = finallyEntry ? finallyEntry.completion : {};
3943 record.type = type;
3944 record.arg = arg;
3945
3946 if (finallyEntry) {
3947 this.method = "next";
3948 this.next = finallyEntry.finallyLoc;
3949 return ContinueSentinel;
3950 }
3951
3952 return this.complete(record);
3953 },
3954 complete: function complete(record, afterLoc) {
3955 if (record.type === "throw") {
3956 throw record.arg;
3957 }
3958
3959 if (record.type === "break" || record.type === "continue") {
3960 this.next = record.arg;
3961 } else if (record.type === "return") {
3962 this.rval = this.arg = record.arg;
3963 this.method = "return";
3964 this.next = "end";
3965 } else if (record.type === "normal" && afterLoc) {
3966 this.next = afterLoc;
3967 }
3968
3969 return ContinueSentinel;
3970 },
3971 finish: function finish(finallyLoc) {
3972 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3973 var entry = this.tryEntries[i];
3974
3975 if (entry.finallyLoc === finallyLoc) {
3976 this.complete(entry.completion, entry.afterLoc);
3977 resetTryEntry(entry);
3978 return ContinueSentinel;
3979 }
3980 }
3981 },
3982 "catch": function _catch(tryLoc) {
3983 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3984 var entry = this.tryEntries[i];
3985
3986 if (entry.tryLoc === tryLoc) {
3987 var record = entry.completion;
3988
3989 if (record.type === "throw") {
3990 var thrown = record.arg;
3991 resetTryEntry(entry);
3992 }
3993
3994 return thrown;
3995 }
3996 } // The context.catch method must only be called with a location
3997 // argument that corresponds to a known catch block.
3998
3999
4000 throw new Error("illegal catch attempt");
4001 },
4002 delegateYield: function delegateYield(iterable, resultName, nextLoc) {
4003 this.delegate = {
4004 iterator: values(iterable),
4005 resultName: resultName,
4006 nextLoc: nextLoc
4007 };
4008
4009 if (this.method === "next") {
4010 // Deliberately forget the last sent value so that we don't
4011 // accidentally pass it on to the delegate.
4012 this.arg = undefined;
4013 }
4014
4015 return ContinueSentinel;
4016 }
4017 }; // Regardless of whether this script is executing as a CommonJS module
4018 // or not, return the runtime object so that we can declare the variable
4019 // regeneratorRuntime in the outer scope, which allows this module to be
4020 // injected easily by `bin/regenerator --include-runtime script.js`.
4021
4022 return exports;
4023 }( // If this script is executing as a CommonJS module, use module.exports
4024 // as the regeneratorRuntime namespace. Otherwise create a new empty
4025 // object. Either way, the resulting object will be used to initialize
4026 // the regeneratorRuntime variable at the top of this file.
4027 ( false ? undefined : _typeof(module)) === "object" ? module.exports : {});
4028
4029 try {
4030 regeneratorRuntime = runtime;
4031 } catch (accidentalStrictMode) {
4032 // This module should not be running in strict mode, so the above
4033 // assignment should always work unless something is misconfigured. Just
4034 // in case runtime.js accidentally runs in strict mode, we can escape
4035 // strict mode using a global Function call. This could conceivably fail
4036 // if a Content Security Policy forbids using Function, but in that case
4037 // the proper solution is to fix the accidental strict mode problem. If
4038 // you've misconfigured your bundler to force strict mode and applied a
4039 // CSP to forbid Function, and you're not willing to fix either of those
4040 // problems, please detail your unique predicament in a GitHub issue.
4041 Function("r", "regeneratorRuntime = r")(runtime);
4042 }
4043 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
4044
4045 /***/ }),
4046
4047 /***/ "./node_modules/webpack/buildin/global.js":
4048 /*!***********************************!*\
4049 !*** (webpack)/buildin/global.js ***!
4050 \***********************************/
4051 /*! no static exports found */
4052 /***/ (function(module, exports) {
4053
4054 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4055
4056 var g; // This works in non-strict mode
4057
4058 g = function () {
4059 return this;
4060 }();
4061
4062 try {
4063 // This works if eval is allowed (see CSP)
4064 g = g || new Function("return this")();
4065 } catch (e) {
4066 // This works if the window reference is available
4067 if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
4068 } // g can still be undefined, but nothing to do about it...
4069 // We return undefined, instead of nothing here, so it's
4070 // easier to handle this case. if(!global) { ...}
4071
4072
4073 module.exports = g;
4074
4075 /***/ }),
4076
4077 /***/ "./node_modules/webpack/buildin/module.js":
4078 /*!***********************************!*\
4079 !*** (webpack)/buildin/module.js ***!
4080 \***********************************/
4081 /*! no static exports found */
4082 /***/ (function(module, exports) {
4083
4084 module.exports = function (module) {
4085 if (!module.webpackPolyfill) {
4086 module.deprecate = function () {};
4087
4088 module.paths = []; // module.parent = undefined by default
4089
4090 if (!module.children) module.children = [];
4091 Object.defineProperty(module, "loaded", {
4092 enumerable: true,
4093 get: function get() {
4094 return module.l;
4095 }
4096 });
4097 Object.defineProperty(module, "id", {
4098 enumerable: true,
4099 get: function get() {
4100 return module.i;
4101 }
4102 });
4103 module.webpackPolyfill = 1;
4104 }
4105
4106 return module;
4107 };
4108
4109 /***/ }),
4110
4111 /***/ 0:
4112 /*!**********************************************************************!*\
4113 !*** multi es6-promise-promise ./js/polyfill.js ./js/scripts_es6.js ***!
4114 \**********************************************************************/
4115 /*! no static exports found */
4116 /***/ (function(module, exports, __webpack_require__) {
4117
4118 __webpack_require__(/*! es6-promise-promise */"./node_modules/es6-promise-promise/index.js");
4119 __webpack_require__(/*! ./js/polyfill.js */"./js/polyfill.js");
4120 module.exports = __webpack_require__(/*! ./js/scripts_es6.js */"./js/scripts_es6.js");
4121
4122
4123 /***/ }),
4124
4125 /***/ 1:
4126 /*!***********************!*\
4127 !*** vertx (ignored) ***!
4128 \***********************/
4129 /*! no static exports found */
4130 /***/ (function(module, exports) {
4131
4132 /* (ignored) */
4133
4134 /***/ })
4135
4136 /******/ });
4137 //# sourceMappingURL=scripts.js.map