MailChimp for WordPress - Version 4.1.15

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 MailChimp for WordPress
Version 4.1.15
Comparing to
See all releases

Code changes from version 4.1.14 to 4.1.15

CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  #### 4.1.14 - January 8, 2018
5
 
6
  **Fixes**
1
  Changelog
2
  =========
3
 
4
+ #### 4.1.15 - February 7, 2018
5
+
6
+ **Fixes**
7
+
8
+ - Dropdown fields with special characters were not properly passed to MailChimp.
9
+ - Interest groups with an all-numeric ID were not properly passed to MailChimp.
10
+
11
+ **Improvements**
12
+
13
+ - Various minor code optimizations
14
+ - Do not redirect when showing "already subscribed" warning.
15
+ - Improved scroll to form handling after a form is submitted without AJAX.
16
+
17
+
18
  #### 4.1.14 - January 8, 2018
19
 
20
  **Fixes**
assets/js/forms-api.js CHANGED
@@ -7,39 +7,34 @@ var mc4wp = window.mc4wp || {};
7
  var Gator = require('gator');
8
  var forms = require('./forms/forms.js');
9
  var config = window.mc4wp_forms_config || {};
 
10
 
11
  // funcs
12
  function scrollToForm(form) {
13
  var animate = config.auto_scroll === 'animated';
14
- var args = {
15
- behavior: animate ? "smooth" : "instant"
16
- };
17
- form.element.scrollIntoView(args);
 
18
  }
19
 
20
  function handleFormRequest(form, action, errors, data) {
21
- var pageHeight = document.body.clientHeight;
22
  var timeStart = Date.now();
 
23
 
24
  // re-populate form
25
  if (errors) {
26
  form.setData(data);
27
  }
28
 
29
- if (config.auto_scroll) {
 
30
  scrollToForm(form);
31
  }
32
 
33
  // trigger events on window.load so all other scripts have loaded
34
  window.addEventListener('load', function () {
35
- var timeElapsed = Date.now() - timeStart;
36
-
37
- // scroll to form again if page height changed since last scroll
38
- // (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)
39
- if (config.auto_scroll && timeElapsed < 800 && document.body.clientHeight !== pageHeight) {
40
- scrollToForm(form);
41
- }
42
-
43
  // trigger events
44
  forms.trigger('submitted', [form]);
45
  forms.trigger(form.id + '.submitted', [form]);
@@ -56,6 +51,13 @@ function handleFormRequest(form, action, errors, data) {
56
  forms.trigger(action + "d", [form, data]);
57
  forms.trigger(form.id + "." + action + "d", [form, data]);
58
  }
 
 
 
 
 
 
 
59
  });
60
  }
61
 
@@ -149,7 +151,7 @@ if (config.submitted_form) {
149
  // expose mc4wp object globally
150
  window.mc4wp = mc4wp;
151
 
152
- },{"./forms/forms.js":3,"gator":5}],2:[function(require,module,exports){
153
  'use strict';
154
 
155
  var serialize = require('form-serialize');
@@ -192,7 +194,7 @@ Form.prototype.reset = function () {
192
 
193
  module.exports = Form;
194
 
195
- },{"form-serialize":4,"populate.js":6}],3:[function(require,module,exports){
196
  'use strict';
197
 
198
  // deps
@@ -254,7 +256,652 @@ module.exports = {
254
  "off": events.off.bind(events)
255
  };
256
 
257
- },{"./form.js":2,"wolfy87-eventemitter":7}],4:[function(require,module,exports){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  // get successful control from form and assemble into object
259
  // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
260
 
@@ -516,7 +1163,7 @@ function str_serialize(result, key, value) {
516
 
517
  module.exports = serialize;
518
 
519
- },{}],5:[function(require,module,exports){
520
  /**
521
  * Copyright 2014 Craig Campbell
522
  *
@@ -884,7 +1531,7 @@ module.exports = serialize;
884
  window.Gator = Gator;
885
  }) ();
886
 
887
- },{}],6:[function(require,module,exports){
888
  /*! populate.js v1.0.2 by @dannyvankooten | MIT license */
889
  ;(function(root) {
890
 
@@ -980,7 +1627,109 @@ module.exports = serialize;
980
 
981
  }(this));
982
 
983
- },{}],7:[function(require,module,exports){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984
  /*!
985
  * EventEmitter v5.2.4 - git.io/ee
986
  * Unlicense - http://unlicense.org/
7
  var Gator = require('gator');
8
  var forms = require('./forms/forms.js');
9
  var config = window.mc4wp_forms_config || {};
10
+ var scrollToElement = require('scroll-to-element');
11
 
12
  // funcs
13
  function scrollToForm(form) {
14
  var animate = config.auto_scroll === 'animated';
15
+
16
+ scrollToElement(form.element, {
17
+ duration: animate ? 800 : 1,
18
+ alignment: 'middle'
19
+ });
20
  }
21
 
22
  function handleFormRequest(form, action, errors, data) {
 
23
  var timeStart = Date.now();
24
+ var pageHeight = document.body.clientHeight;
25
 
26
  // re-populate form
27
  if (errors) {
28
  form.setData(data);
29
  }
30
 
31
+ // scroll to form
32
+ if (window.scrollY <= 10 && config.auto_scroll) {
33
  scrollToForm(form);
34
  }
35
 
36
  // trigger events on window.load so all other scripts have loaded
37
  window.addEventListener('load', function () {
 
 
 
 
 
 
 
 
38
  // trigger events
39
  forms.trigger('submitted', [form]);
40
  forms.trigger(form.id + '.submitted', [form]);
51
  forms.trigger(action + "d", [form, data]);
52
  forms.trigger(form.id + "." + action + "d", [form, data]);
53
  }
54
+
55
+ // scroll to form again if page height changed since last scroll, eg because of slow loading images
56
+ // (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)
57
+ var timeElapsed = Date.now() - timeStart;
58
+ if (config.auto_scroll && timeElapsed > 1000 && timeElapsed < 2000 && document.body.clientHeight != pageHeight) {
59
+ scrollToForm(form);
60
+ }
61
  });
62
  }
63
 
151
  // expose mc4wp object globally
152
  window.mc4wp = mc4wp;
153
 
154
+ },{"./forms/forms.js":3,"gator":11,"scroll-to-element":13}],2:[function(require,module,exports){
155
  'use strict';
156
 
157
  var serialize = require('form-serialize');
194
 
195
  module.exports = Form;
196
 
197
+ },{"form-serialize":10,"populate.js":12}],3:[function(require,module,exports){
198
  'use strict';
199
 
200
  // deps
256
  "off": events.off.bind(events)
257
  };
258
 
259
+ },{"./form.js":2,"wolfy87-eventemitter":15}],4:[function(require,module,exports){
260
+ /**
261
+ * Module dependencies.
262
+ */
263
+
264
+ var type;
265
+ try {
266
+ type = require('component-type');
267
+ } catch (_) {
268
+ type = require('type');
269
+ }
270
+
271
+ /**
272
+ * Module exports.
273
+ */
274
+
275
+ module.exports = clone;
276
+
277
+ /**
278
+ * Clones objects.
279
+ *
280
+ * @param {Mixed} any object
281
+ * @api public
282
+ */
283
+
284
+ function clone(obj){
285
+ switch (type(obj)) {
286
+ case 'object':
287
+ var copy = {};
288
+ for (var key in obj) {
289
+ if (obj.hasOwnProperty(key)) {
290
+ copy[key] = clone(obj[key]);
291
+ }
292
+ }
293
+ return copy;
294
+
295
+ case 'array':
296
+ var copy = new Array(obj.length);
297
+ for (var i = 0, l = obj.length; i < l; i++) {
298
+ copy[i] = clone(obj[i]);
299
+ }
300
+ return copy;
301
+
302
+ case 'regexp':
303
+ // from millermedeiros/amd-utils - MIT
304
+ var flags = '';
305
+ flags += obj.multiline ? 'm' : '';
306
+ flags += obj.global ? 'g' : '';
307
+ flags += obj.ignoreCase ? 'i' : '';
308
+ return new RegExp(obj.source, flags);
309
+
310
+ case 'date':
311
+ return new Date(obj.getTime());
312
+
313
+ default: // string, number, boolean, …
314
+ return obj;
315
+ }
316
+ }
317
+
318
+ },{"component-type":8,"type":8}],5:[function(require,module,exports){
319
+
320
+ /**
321
+ * Expose `Emitter`.
322
+ */
323
+
324
+ module.exports = Emitter;
325
+
326
+ /**
327
+ * Initialize a new `Emitter`.
328
+ *
329
+ * @api public
330
+ */
331
+
332
+ function Emitter(obj) {
333
+ if (obj) return mixin(obj);
334
+ };
335
+
336
+ /**
337
+ * Mixin the emitter properties.
338
+ *
339
+ * @param {Object} obj
340
+ * @return {Object}
341
+ * @api private
342
+ */
343
+
344
+ function mixin(obj) {
345
+ for (var key in Emitter.prototype) {
346
+ obj[key] = Emitter.prototype[key];
347
+ }
348
+ return obj;
349
+ }
350
+
351
+ /**
352
+ * Listen on the given `event` with `fn`.
353
+ *
354
+ * @param {String} event
355
+ * @param {Function} fn
356
+ * @return {Emitter}
357
+ * @api public
358
+ */
359
+
360
+ Emitter.prototype.on =
361
+ Emitter.prototype.addEventListener = function(event, fn){
362
+ this._callbacks = this._callbacks || {};
363
+ (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
364
+ .push(fn);
365
+ return this;
366
+ };
367
+
368
+ /**
369
+ * Adds an `event` listener that will be invoked a single
370
+ * time then automatically removed.
371
+ *
372
+ * @param {String} event
373
+ * @param {Function} fn
374
+ * @return {Emitter}
375
+ * @api public
376
+ */
377
+
378
+ Emitter.prototype.once = function(event, fn){
379
+ function on() {
380
+ this.off(event, on);
381
+ fn.apply(this, arguments);
382
+ }
383
+
384
+ on.fn = fn;
385
+ this.on(event, on);
386
+ return this;
387
+ };
388
+
389
+ /**
390
+ * Remove the given callback for `event` or all
391
+ * registered callbacks.
392
+ *
393
+ * @param {String} event
394
+ * @param {Function} fn
395
+ * @return {Emitter}
396
+ * @api public
397
+ */
398
+
399
+ Emitter.prototype.off =
400
+ Emitter.prototype.removeListener =
401
+ Emitter.prototype.removeAllListeners =
402
+ Emitter.prototype.removeEventListener = function(event, fn){
403
+ this._callbacks = this._callbacks || {};
404
+
405
+ // all
406
+ if (0 == arguments.length) {
407
+ this._callbacks = {};
408
+ return this;
409
+ }
410
+
411
+ // specific event
412
+ var callbacks = this._callbacks['$' + event];
413
+ if (!callbacks) return this;
414
+
415
+ // remove all handlers
416
+ if (1 == arguments.length) {
417
+ delete this._callbacks['$' + event];
418
+ return this;
419
+ }
420
+
421
+ // remove specific handler
422
+ var cb;
423
+ for (var i = 0; i < callbacks.length; i++) {
424
+ cb = callbacks[i];
425
+ if (cb === fn || cb.fn === fn) {
426
+ callbacks.splice(i, 1);
427
+ break;
428
+ }
429
+ }
430
+ return this;
431
+ };
432
+
433
+ /**
434
+ * Emit `event` with the given args.
435
+ *
436
+ * @param {String} event
437
+ * @param {Mixed} ...
438
+ * @return {Emitter}
439
+ */
440
+
441
+ Emitter.prototype.emit = function(event){
442
+ this._callbacks = this._callbacks || {};
443
+ var args = [].slice.call(arguments, 1)
444
+ , callbacks = this._callbacks['$' + event];
445
+
446
+ if (callbacks) {
447
+ callbacks = callbacks.slice(0);
448
+ for (var i = 0, len = callbacks.length; i < len; ++i) {
449
+ callbacks[i].apply(this, args);
450
+ }
451
+ }
452
+
453
+ return this;
454
+ };
455
+
456
+ /**
457
+ * Return array of callbacks for `event`.
458
+ *
459
+ * @param {String} event
460
+ * @return {Array}
461
+ * @api public
462
+ */
463
+
464
+ Emitter.prototype.listeners = function(event){
465
+ this._callbacks = this._callbacks || {};
466
+ return this._callbacks['$' + event] || [];
467
+ };
468
+
469
+ /**
470
+ * Check if this emitter has `event` handlers.
471
+ *
472
+ * @param {String} event
473
+ * @return {Boolean}
474
+ * @api public
475
+ */
476
+
477
+ Emitter.prototype.hasListeners = function(event){
478
+ return !! this.listeners(event).length;
479
+ };
480
+
481
+ },{}],6:[function(require,module,exports){
482
+ /**
483
+ * Expose `requestAnimationFrame()`.
484
+ */
485
+
486
+ exports = module.exports = window.requestAnimationFrame
487
+ || window.webkitRequestAnimationFrame
488
+ || window.mozRequestAnimationFrame
489
+ || fallback;
490
+
491
+ /**
492
+ * Fallback implementation.
493
+ */
494
+
495
+ var prev = new Date().getTime();
496
+ function fallback(fn) {
497
+ var curr = new Date().getTime();
498
+ var ms = Math.max(0, 16 - (curr - prev));
499
+ var req = setTimeout(fn, ms);
500
+ prev = curr;
501
+ return req;
502
+ }
503
+
504
+ /**
505
+ * Cancel.
506
+ */
507
+
508
+ var cancel = window.cancelAnimationFrame
509
+ || window.webkitCancelAnimationFrame
510
+ || window.mozCancelAnimationFrame
511
+ || window.clearTimeout;
512
+
513
+ exports.cancel = function(id){
514
+ cancel.call(window, id);
515
+ };
516
+
517
+ },{}],7:[function(require,module,exports){
518
+
519
+ /**
520
+ * Module dependencies.
521
+ */
522
+
523
+ var Emitter = require('emitter');
524
+ var clone = require('clone');
525
+ var type = require('type');
526
+ var ease = require('ease');
527
+
528
+ /**
529
+ * Expose `Tween`.
530
+ */
531
+
532
+ module.exports = Tween;
533
+
534
+ /**
535
+ * Initialize a new `Tween` with `obj`.
536
+ *
537
+ * @param {Object|Array} obj
538
+ * @api public
539
+ */
540
+
541
+ function Tween(obj) {
542
+ if (!(this instanceof Tween)) return new Tween(obj);
543
+ this._from = obj;
544
+ this.ease('linear');
545
+ this.duration(500);
546
+ }
547
+
548
+ /**
549
+ * Mixin emitter.
550
+ */
551
+
552
+ Emitter(Tween.prototype);
553
+
554
+ /**
555
+ * Reset the tween.
556
+ *
557
+ * @api public
558
+ */
559
+
560
+ Tween.prototype.reset = function(){
561
+ this.isArray = 'array' === type(this._from);
562
+ this._curr = clone(this._from);
563
+ this._done = false;
564
+ this._start = Date.now();
565
+ return this;
566
+ };
567
+
568
+ /**
569
+ * Tween to `obj` and reset internal state.
570
+ *
571
+ * tween.to({ x: 50, y: 100 })
572
+ *
573
+ * @param {Object|Array} obj
574
+ * @return {Tween} self
575
+ * @api public
576
+ */
577
+
578
+ Tween.prototype.to = function(obj){
579
+ this.reset();
580
+ this._to = obj;
581
+ return this;
582
+ };
583
+
584
+ /**
585
+ * Set duration to `ms` [500].
586
+ *
587
+ * @param {Number} ms
588
+ * @return {Tween} self
589
+ * @api public
590
+ */
591
+
592
+ Tween.prototype.duration = function(ms){
593
+ this._duration = ms;
594
+ return this;
595
+ };
596
+
597
+ /**
598
+ * Set easing function to `fn`.
599
+ *
600
+ * tween.ease('in-out-sine')
601
+ *
602
+ * @param {String|Function} fn
603
+ * @return {Tween}
604
+ * @api public
605
+ */
606
+
607
+ Tween.prototype.ease = function(fn){
608
+ fn = 'function' == typeof fn ? fn : ease[fn];
609
+ if (!fn) throw new TypeError('invalid easing function');
610
+ this._ease = fn;
611
+ return this;
612
+ };
613
+
614
+ /**
615
+ * Stop the tween and immediately emit "stop" and "end".
616
+ *
617
+ * @return {Tween}
618
+ * @api public
619
+ */
620
+
621
+ Tween.prototype.stop = function(){
622
+ this.stopped = true;
623
+ this._done = true;
624
+ this.emit('stop');
625
+ this.emit('end');
626
+ return this;
627
+ };
628
+
629
+ /**
630
+ * Perform a step.
631
+ *
632
+ * @return {Tween} self
633
+ * @api private
634
+ */
635
+
636
+ Tween.prototype.step = function(){
637
+ if (this._done) return;
638
+
639
+ // duration
640
+ var duration = this._duration;
641
+ var now = Date.now();
642
+ var delta = now - this._start;
643
+ var done = delta >= duration;
644
+
645
+ // complete
646
+ if (done) {
647
+ this._from = this._to;
648
+ this._update(this._to);
649
+ this._done = true;
650
+ this.emit('end');
651
+ return this;
652
+ }
653
+
654
+ // tween
655
+ var from = this._from;
656
+ var to = this._to;
657
+ var curr = this._curr;
658
+ var fn = this._ease;
659
+ var p = (now - this._start) / duration;
660
+ var n = fn(p);
661
+
662
+ // array
663
+ if (this.isArray) {
664
+ for (var i = 0; i < from.length; ++i) {
665
+ curr[i] = from[i] + (to[i] - from[i]) * n;
666
+ }
667
+
668
+ this._update(curr);
669
+ return this;
670
+ }
671
+
672
+ // objech
673
+ for (var k in from) {
674
+ curr[k] = from[k] + (to[k] - from[k]) * n;
675
+ }
676
+
677
+ this._update(curr);
678
+ return this;
679
+ };
680
+
681
+ /**
682
+ * Set update function to `fn` or
683
+ * when no argument is given this performs
684
+ * a "step".
685
+ *
686
+ * @param {Function} fn
687
+ * @return {Tween} self
688
+ * @api public
689
+ */
690
+
691
+ Tween.prototype.update = function(fn){
692
+ if (0 == arguments.length) return this.step();
693
+ this._update = fn;
694
+ return this;
695
+ };
696
+ },{"clone":4,"ease":9,"emitter":5,"type":8}],8:[function(require,module,exports){
697
+ /**
698
+ * toString ref.
699
+ */
700
+
701
+ var toString = Object.prototype.toString;
702
+
703
+ /**
704
+ * Return the type of `val`.
705
+ *
706
+ * @param {Mixed} val
707
+ * @return {String}
708
+ * @api public
709
+ */
710
+
711
+ module.exports = function(val){
712
+ switch (toString.call(val)) {
713
+ case '[object Date]': return 'date';
714
+ case '[object RegExp]': return 'regexp';
715
+ case '[object Arguments]': return 'arguments';
716
+ case '[object Array]': return 'array';
717
+ case '[object Error]': return 'error';
718
+ }
719
+
720
+ if (val === null) return 'null';
721
+ if (val === undefined) return 'undefined';
722
+ if (val !== val) return 'nan';
723
+ if (val && val.nodeType === 1) return 'element';
724
+
725
+ val = val.valueOf
726
+ ? val.valueOf()
727
+ : Object.prototype.valueOf.apply(val)
728
+
729
+ return typeof val;
730
+ };
731
+
732
+ },{}],9:[function(require,module,exports){
733
+
734
+ // easing functions from "Tween.js"
735
+
736
+ exports.linear = function(n){
737
+ return n;
738
+ };
739
+
740
+ exports.inQuad = function(n){
741
+ return n * n;
742
+ };
743
+
744
+ exports.outQuad = function(n){
745
+ return n * (2 - n);
746
+ };
747
+
748
+ exports.inOutQuad = function(n){
749
+ n *= 2;
750
+ if (n < 1) return 0.5 * n * n;
751
+ return - 0.5 * (--n * (n - 2) - 1);
752
+ };
753
+
754
+ exports.inCube = function(n){
755
+ return n * n * n;
756
+ };
757
+
758
+ exports.outCube = function(n){
759
+ return --n * n * n + 1;
760
+ };
761
+
762
+ exports.inOutCube = function(n){
763
+ n *= 2;
764
+ if (n < 1) return 0.5 * n * n * n;
765
+ return 0.5 * ((n -= 2 ) * n * n + 2);
766
+ };
767
+
768
+ exports.inQuart = function(n){
769
+ return n * n * n * n;
770
+ };
771
+
772
+ exports.outQuart = function(n){
773
+ return 1 - (--n * n * n * n);
774
+ };
775
+
776
+ exports.inOutQuart = function(n){
777
+ n *= 2;
778
+ if (n < 1) return 0.5 * n * n * n * n;
779
+ return -0.5 * ((n -= 2) * n * n * n - 2);
780
+ };
781
+
782
+ exports.inQuint = function(n){
783
+ return n * n * n * n * n;
784
+ }
785
+
786
+ exports.outQuint = function(n){
787
+ return --n * n * n * n * n + 1;
788
+ }
789
+
790
+ exports.inOutQuint = function(n){
791
+ n *= 2;
792
+ if (n < 1) return 0.5 * n * n * n * n * n;
793
+ return 0.5 * ((n -= 2) * n * n * n * n + 2);
794
+ };
795
+
796
+ exports.inSine = function(n){
797
+ return 1 - Math.cos(n * Math.PI / 2 );
798
+ };
799
+
800
+ exports.outSine = function(n){
801
+ return Math.sin(n * Math.PI / 2);
802
+ };
803
+
804
+ exports.inOutSine = function(n){
805
+ return .5 * (1 - Math.cos(Math.PI * n));
806
+ };
807
+
808
+ exports.inExpo = function(n){
809
+ return 0 == n ? 0 : Math.pow(1024, n - 1);
810
+ };
811
+
812
+ exports.outExpo = function(n){
813
+ return 1 == n ? n : 1 - Math.pow(2, -10 * n);
814
+ };
815
+
816
+ exports.inOutExpo = function(n){
817
+ if (0 == n) return 0;
818
+ if (1 == n) return 1;
819
+ if ((n *= 2) < 1) return .5 * Math.pow(1024, n - 1);
820
+ return .5 * (-Math.pow(2, -10 * (n - 1)) + 2);
821
+ };
822
+
823
+ exports.inCirc = function(n){
824
+ return 1 - Math.sqrt(1 - n * n);
825
+ };
826
+
827
+ exports.outCirc = function(n){
828
+ return Math.sqrt(1 - (--n * n));
829
+ };
830
+
831
+ exports.inOutCirc = function(n){
832
+ n *= 2
833
+ if (n < 1) return -0.5 * (Math.sqrt(1 - n * n) - 1);
834
+ return 0.5 * (Math.sqrt(1 - (n -= 2) * n) + 1);
835
+ };
836
+
837
+ exports.inBack = function(n){
838
+ var s = 1.70158;
839
+ return n * n * (( s + 1 ) * n - s);
840
+ };
841
+
842
+ exports.outBack = function(n){
843
+ var s = 1.70158;
844
+ return --n * n * ((s + 1) * n + s) + 1;
845
+ };
846
+
847
+ exports.inOutBack = function(n){
848
+ var s = 1.70158 * 1.525;
849
+ if ( ( n *= 2 ) < 1 ) return 0.5 * ( n * n * ( ( s + 1 ) * n - s ) );
850
+ return 0.5 * ( ( n -= 2 ) * n * ( ( s + 1 ) * n + s ) + 2 );
851
+ };
852
+
853
+ exports.inBounce = function(n){
854
+ return 1 - exports.outBounce(1 - n);
855
+ };
856
+
857
+ exports.outBounce = function(n){
858
+ if ( n < ( 1 / 2.75 ) ) {
859
+ return 7.5625 * n * n;
860
+ } else if ( n < ( 2 / 2.75 ) ) {
861
+ return 7.5625 * ( n -= ( 1.5 / 2.75 ) ) * n + 0.75;
862
+ } else if ( n < ( 2.5 / 2.75 ) ) {
863
+ return 7.5625 * ( n -= ( 2.25 / 2.75 ) ) * n + 0.9375;
864
+ } else {
865
+ return 7.5625 * ( n -= ( 2.625 / 2.75 ) ) * n + 0.984375;
866
+ }
867
+ };
868
+
869
+ exports.inOutBounce = function(n){
870
+ if (n < .5) return exports.inBounce(n * 2) * .5;
871
+ return exports.outBounce(n * 2 - 1) * .5 + .5;
872
+ };
873
+
874
+ // aliases
875
+
876
+ exports['in-quad'] = exports.inQuad;
877
+ exports['out-quad'] = exports.outQuad;
878
+ exports['in-out-quad'] = exports.inOutQuad;
879
+ exports['in-cube'] = exports.inCube;
880
+ exports['out-cube'] = exports.outCube;
881
+ exports['in-out-cube'] = exports.inOutCube;
882
+ exports['in-quart'] = exports.inQuart;
883
+ exports['out-quart'] = exports.outQuart;
884
+ exports['in-out-quart'] = exports.inOutQuart;
885
+ exports['in-quint'] = exports.inQuint;
886
+ exports['out-quint'] = exports.outQuint;
887
+ exports['in-out-quint'] = exports.inOutQuint;
888
+ exports['in-sine'] = exports.inSine;
889
+ exports['out-sine'] = exports.outSine;
890
+ exports['in-out-sine'] = exports.inOutSine;
891
+ exports['in-expo'] = exports.inExpo;
892
+ exports['out-expo'] = exports.outExpo;
893
+ exports['in-out-expo'] = exports.inOutExpo;
894
+ exports['in-circ'] = exports.inCirc;
895
+ exports['out-circ'] = exports.outCirc;
896
+ exports['in-out-circ'] = exports.inOutCirc;
897
+ exports['in-back'] = exports.inBack;
898
+ exports['out-back'] = exports.outBack;
899
+ exports['in-out-back'] = exports.inOutBack;
900
+ exports['in-bounce'] = exports.inBounce;
901
+ exports['out-bounce'] = exports.outBounce;
902
+ exports['in-out-bounce'] = exports.inOutBounce;
903
+
904
+ },{}],10:[function(require,module,exports){
905
  // get successful control from form and assemble into object
906
  // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
907
 
1163
 
1164
  module.exports = serialize;
1165
 
1166
+ },{}],11:[function(require,module,exports){
1167
  /**
1168
  * Copyright 2014 Craig Campbell
1169
  *
1531
  window.Gator = Gator;
1532
  }) ();
1533
 
1534
+ },{}],12:[function(require,module,exports){
1535
  /*! populate.js v1.0.2 by @dannyvankooten | MIT license */
1536
  ;(function(root) {
1537
 
1627
 
1628
  }(this));
1629
 
1630
+ },{}],13:[function(require,module,exports){
1631
+ var scroll = require('scroll-to');
1632
+
1633
+ function calculateScrollOffset(elem, additionalOffset, alignment) {
1634
+ var body = document.body,
1635
+ html = document.documentElement;
1636
+
1637
+ var elemRect = elem.getBoundingClientRect();
1638
+ var clientHeight = html.clientHeight;
1639
+ var documentHeight = Math.max( body.scrollHeight, body.offsetHeight,
1640
+ html.clientHeight, html.scrollHeight, html.offsetHeight );
1641
+
1642
+ additionalOffset = additionalOffset || 0;
1643
+
1644
+ var scrollPosition;
1645
+ if (alignment === 'bottom') {
1646
+ scrollPosition = elemRect.bottom - clientHeight;
1647
+ } else if (alignment === 'middle') {
1648
+ scrollPosition = elemRect.bottom - clientHeight / 2 - elemRect.height / 2;
1649
+ } else { // top and default
1650
+ scrollPosition = elemRect.top;
1651
+ }
1652
+
1653
+ var maxScrollPosition = documentHeight - clientHeight;
1654
+ return Math.min(scrollPosition + additionalOffset + window.pageYOffset,
1655
+ maxScrollPosition);
1656
+ }
1657
+
1658
+ module.exports = function (elem, options) {
1659
+ options = options || {};
1660
+ if (typeof elem === 'string') elem = document.querySelector(elem);
1661
+ if (elem) return scroll(0, calculateScrollOffset(elem, options.offset, options.align), options);
1662
+ };
1663
+
1664
+ },{"scroll-to":14}],14:[function(require,module,exports){
1665
+ /**
1666
+ * Module dependencies.
1667
+ */
1668
+
1669
+ var Tween = require('tween');
1670
+ var raf = require('raf');
1671
+
1672
+ /**
1673
+ * Expose `scrollTo`.
1674
+ */
1675
+
1676
+ module.exports = scrollTo;
1677
+
1678
+ /**
1679
+ * Scroll to `(x, y)`.
1680
+ *
1681
+ * @param {Number} x
1682
+ * @param {Number} y
1683
+ * @api public
1684
+ */
1685
+
1686
+ function scrollTo(x, y, options) {
1687
+ options = options || {};
1688
+
1689
+ // start position
1690
+ var start = scroll();
1691
+
1692
+ // setup tween
1693
+ var tween = Tween(start)
1694
+ .ease(options.ease || 'out-circ')
1695
+ .to({ top: y, left: x })
1696
+ .duration(options.duration || 1000);
1697
+
1698
+ // scroll
1699
+ tween.update(function(o){
1700
+ window.scrollTo(o.left | 0, o.top | 0);
1701
+ });
1702
+
1703
+ // handle end
1704
+ tween.on('end', function(){
1705
+ animate = function(){};
1706
+ });
1707
+
1708
+ // animate
1709
+ function animate() {
1710
+ raf(animate);
1711
+ tween.update();
1712
+ }
1713
+
1714
+ animate();
1715
+
1716
+ return tween;
1717
+ }
1718
+
1719
+ /**
1720
+ * Return scroll position.
1721
+ *
1722
+ * @return {Object}
1723
+ * @api private
1724
+ */
1725
+
1726
+ function scroll() {
1727
+ var y = window.pageYOffset || document.documentElement.scrollTop;
1728
+ var x = window.pageXOffset || document.documentElement.scrollLeft;
1729
+ return { top: y, left: x };
1730
+ }
1731
+
1732
+ },{"raf":6,"tween":7}],15:[function(require,module,exports){
1733
  /*!
1734
  * EventEmitter v5.2.4 - git.io/ee
1735
  * Unlicense - http://unlicense.org/
assets/js/forms-api.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function t(n,r,i){function o(a,c){if(!r[a]){if(!n[a]){var u="function"==typeof e&&e;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};n[a][0].call(l.exports,function(e){var t=n[a][1][e];return o(t||e)},l,l.exports,t,n,r,i)}return r[a].exports}for(var s="function"==typeof e&&e,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){"use strict";function r(e){var t={behavior:"animated"===c.auto_scroll?"smooth":"instant"};e.element.scrollIntoView(t)}function i(){var e=this,t=e.form.querySelectorAll("[data-show-if], [data-hide-if]"),n=(e.getAttribute("name")||"").toLowerCase();[].forEach.call(t,function(t){var r=!!t.getAttribute("data-show-if"),i=r?t.getAttribute("data-show-if").split(":"):t.getAttribute("data-hide-if").split(":"),o=i[0],s=i[1]||"";if(n===o.toLowerCase()){(function(e,t,n){return function(){var r=this.value.trim(),i=("radio"!==this.getAttribute("type")&&"checked"!==this.getAttribute("type")||this.checked)&&(r===t&&""!==t||""===t&&r.length>0);e.style.display=n?i?"":"none":i?"none":""}})(t,s,r).call(e)}})}var o=window.mc4wp||{},s=e("gator"),a=e("./forms/forms.js"),c=window.mc4wp_forms_config||{};if(s(document.body).on("keyup",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",i),s(document.body).on("change",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",i),window.addEventListener("load",function(){[].forEach.call(document.querySelectorAll(".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select"),function(e){i.call(e)})}),s(document.body).on("submit",".mc4wp-form",function(e){var t=a.getByElement(e.target||e.srcElement);a.trigger("submit",[t,e]),a.trigger(t.id+".submit",[t,e])}),s(document.body).on("focus",".mc4wp-form",function(e){var t=a.getByElement(e.target||e.srcElement);t.started||(a.trigger("started",[t,e]),a.trigger(t.id+".started",[t,e]),t.started=!0)}),s(document.body).on("change",".mc4wp-form",function(e){var t=a.getByElement(e.target||e.srcElement);a.trigger("change",[t,e]),a.trigger(t.id+".change",[t,e])}),o.listeners){for(var u=o.listeners,f=0;f<u.length;f++)a.on(u[f].event,u[f].callback);delete o.listeners}if(o.forms=a,c.submitted_form){var l=c.submitted_form,h=document.getElementById(l.element_id);!function(e,t,n,i){var o=document.body.clientHeight,s=Date.now();n&&e.setData(i),c.auto_scroll&&r(e),window.addEventListener("load",function(){var u=Date.now()-s;c.auto_scroll&&u<800&&document.body.clientHeight!==o&&r(e),a.trigger("submitted",[e]),a.trigger(e.id+".submitted",[e]),n?(a.trigger("error",[e,n]),a.trigger(e.id+".error",[e,n])):(a.trigger("success",[e,i]),a.trigger(e.id+".success",[e,i]),a.trigger(t+"d",[e,i]),a.trigger(e.id+"."+t+"d",[e,i]))})}(a.getByElement(h),l.action,l.errors,l.data)}window.mc4wp=o},{"./forms/forms.js":3,gator:5}],2:[function(e,t,n){"use strict";var r=e("form-serialize"),i=e("populate.js"),o=function(e,t){this.id=e,this.element=t||document.createElement("form"),this.name=this.element.getAttribute("data-name")||"Form #"+this.id,this.errors=[],this.started=!1};o.prototype.setData=function(e){try{i(this.element,e)}catch(e){console.error(e)}},o.prototype.getData=function(){return r(this.element,{hash:!0,empty:!0})},o.prototype.getSerializedData=function(){return r(this.element,{hash:!1,empty:!0})},o.prototype.setResponse=function(e){this.element.querySelector(".mc4wp-response").innerHTML=e},o.prototype.reset=function(){this.setResponse(""),this.element.querySelector(".mc4wp-form-fields").style.display="",this.element.reset()},t.exports=o},{"form-serialize":4,"populate.js":6}],3:[function(e,t,n){"use strict";function r(e,t){t=t||parseInt(e.getAttribute("data-id"))||0;var n=new o(t,e);return a.push(n),n}var i=e("wolfy87-eventemitter"),o=e("./form.js"),s=new i,a=[];t.exports={all:function(){return a},get:function(e){for(var t=0;t<a.length;t++)if(a[t].id==e)return a[t];return r(document.querySelector(".mc4wp-form-"+e),e)},getByElement:function(e){for(var t=e.form||e,n=0;n<a.length;n++)if(a[n].element==t)return a[n];return r(t)},on:s.on.bind(s),trigger:s.trigger.bind(s),off:s.off.bind(s)}},{"./form.js":2,"wolfy87-eventemitter":7}],4:[function(e,t,n){function r(e,t,n){if(0===t.length)return e=n;var i=t.shift(),o=i.match(/^\[(.+?)\]$/);if("[]"===i)return e=e||[],Array.isArray(e)?e.push(r(null,t,n)):(e._values=e._values||[],e._values.push(r(null,t,n))),e;if(o){var s=o[1],a=+s;isNaN(a)?(e=e||{})[s]=r(e[s],t,n):(e=e||[])[a]=r(e[a],t,n)}else e[i]=r(e[i],t,n);return e}var i=/^(?:submit|button|image|reset|file)$/i,o=/^(?:input|select|textarea|keygen)/i,s=/(\[[^\[\]]*\])/g;t.exports=function(e,t){"object"!=typeof t?t={hash:!!t}:void 0===t.hash&&(t.hash=!0);for(var n=t.hash?{}:"",a=t.serializer||(t.hash?function(e,t,n){if(t.match(s)){var i=function(e){var t=[],n=new RegExp(s),r=/^([^\[\]]*)/.exec(e);for(r[1]&&t.push(r[1]);null!==(r=n.exec(e));)t.push(r[1]);return t}(t);r(e,i,n)}else{var o=e[t];o?(Array.isArray(o)||(e[t]=[o]),e[t].push(n)):e[t]=n}return e}:function(e,t,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=encodeURIComponent(n),n=n.replace(/%20/g,"+"),e+(e?"&":"")+encodeURIComponent(t)+"="+n}),c=e&&e.elements?e.elements:[],u=Object.create(null),f=0;f<c.length;++f){var l=c[f];if((t.disabled||!l.disabled)&&l.name&&o.test(l.nodeName)&&!i.test(l.type)){var h=l.name,d=l.value;if("checkbox"!==l.type&&"radio"!==l.type||l.checked||(d=void 0),t.empty){if("checkbox"!==l.type||l.checked||(d=""),"radio"===l.type&&(u[l.name]||l.checked?l.checked&&(u[l.name]=!0):u[l.name]=!1),void 0==d&&"radio"==l.type)continue}else if(!d)continue;if("select-multiple"!==l.type)n=a(n,h,d);else{d=[];for(var m=l.options,p=!1,v=0;v<m.length;++v){var g=m[v],y=t.empty&&!g.value,w=g.value||y;g.selected&&w&&(p=!0,n=t.hash&&"[]"!==h.slice(h.length-2)?a(n,h+"[]",g.value):a(n,h,g.value))}!p&&t.empty&&(n=a(n,h,""))}}}if(t.empty)for(var h in u)u[h]||(n=a(n,h,""));return n}},{}],5:[function(e,t,n){!function(){function e(t,n,r){if("_root"==n)return r;if(t!==r)return function(e){return s||(s=e.matches?e.matches:e.webkitMatchesSelector?e.webkitMatchesSelector:e.mozMatchesSelector?e.mozMatchesSelector:e.msMatchesSelector?e.msMatchesSelector:e.oMatchesSelector?e.oMatchesSelector:o.matchesSelector)}(t).call(t,n)?t:t.parentNode?(a++,e(t.parentNode,n,r)):void 0}function n(e,t,n,r){u[e.id]||(u[e.id]={}),u[e.id][t]||(u[e.id][t]={}),u[e.id][t][n]||(u[e.id][t][n]=[]),u[e.id][t][n].push(r)}function r(e,t,n,r){if(u[e.id])if(t)if(r||n)if(r){if(u[e.id][t][n])for(var i=0;i<u[e.id][t][n].length;i++)if(u[e.id][t][n][i]===r){u[e.id][t][n].splice(i,1);break}}else delete u[e.id][t][n];else u[e.id][t]={};else for(var o in u[e.id])u[e.id].hasOwnProperty(o)&&(u[e.id][o]={})}function i(t,i,s,c){function l(t){return function(n){!function(t,n,r){if(u[t][r]){var i,s,c=n.target||n.srcElement,l={},h=0,d=0;a=0;for(i in u[t][r])u[t][r].hasOwnProperty(i)&&(s=e(c,i,f[t].element))&&o.matchesEvent(r,f[t].element,s,"_root"==i,n)&&(a++,u[t][r][i].match=s,l[a]=u[t][r][i]);for(n.stopPropagation=function(){n.cancelBubble=!0},h=0;h<=a;h++)if(l[h])for(d=0;d<l[h].length;d++){if(!1===l[h][d].call(l[h].match,n))return void o.cancel(n);if(n.cancelBubble)return}}}(d,n,t)}}if(this.element){t instanceof Array||(t=[t]),s||"function"!=typeof i||(s=i,i="_root");var h,d=this.id;for(h=0;h<t.length;h++)c?r(this,t[h],i,s):(u[d]&&u[d][t[h]]||o.addEvent(this,t[h],l(t[h])),n(this,t[h],i,s));return this}}function o(e,t){if(!(this instanceof o)){for(var n in f)if(f[n].element===e)return f[n];return c++,f[c]=new o(e,c),f[c]}this.element=e,this.id=t}var s,a=0,c=0,u={},f={};o.prototype.on=function(e,t,n){return i.call(this,e,t,n)},o.prototype.off=function(e,t,n){return i.call(this,e,t,n,!0)},o.matchesSelector=function(){},o.cancel=function(e){e.preventDefault(),e.stopPropagation()},o.addEvent=function(e,t,n){var r="blur"==t||"focus"==t;e.element.addEventListener(t,n,r)},o.matchesEvent=function(){return!0},void 0!==t&&t.exports&&(t.exports=o),window.Gator=o}()},{}],6:[function(e,n,r){!function(e){var r=function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){var o=i,s=t[i];if(void 0===s&&(s=""),null===s&&(s=""),void 0!==n&&(o=n+"["+i+"]"),s.constructor===Array)o+="[]";else if("object"==typeof s){r(e,s,o);continue}var a=e.elements.namedItem(o);if(a){switch(a.type||a[0].type){default:a.value=s;break;case"radio":case"checkbox":for(var c=0;c<a.length;c++)a[c].checked=s.indexOf(a[c].value)>-1;break;case"select-multiple":for(var u=s.constructor==Array?s:[s],f=0;f<a.options.length;f++)a.options[f].selected|=u.indexOf(a.options[f].value)>-1;break;case"select":case"select-one":a.value=s.toString()||s;break;case"date":a.value=new Date(s).toISOString().split("T")[0]}}}};"function"==typeof t&&"object"==typeof t.amd&&t.amd?t(function(){return r}):void 0!==n&&n.exports?n.exports=r:e.populate=r}(this)},{}],7:[function(e,n,r){!function(e){"use strict";function r(){}function i(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}function s(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&s(e.listener)}var a=r.prototype,c=e.EventEmitter;a.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},a.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},a.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},a.addListener=function(e,t){if(!s(t))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(e),o="object"==typeof t;for(n in r)r.hasOwnProperty(n)&&-1===i(r[n],t)&&r[n].push(o?t:{listener:t,once:!1});return this},a.on=o("addListener"),a.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},a.once=o("addOnceListener"),a.defineEvent=function(e){return this.getListeners(e),this},a.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},a.removeListener=function(e,t){var n,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&-1!==(n=i(o[r],t))&&o[r].splice(n,1);return this},a.off=o("removeListener"),a.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},a.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},a.manipulateListeners=function(e,t,n){var r,i,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)o.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?o.call(this,r,i):s.call(this,r,i));return this},a.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},a.removeAllListeners=o("removeEvent"),a.emitEvent=function(e,t){var n,r,i,o,s=this.getListenersAsObject(e);for(o in s)if(s.hasOwnProperty(o))for(n=s[o].slice(0),i=0;i<n.length;i++)!0===(r=n[i]).once&&this.removeListener(e,r.listener),r.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},a.trigger=o("emitEvent"),a.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},a.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},a._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},a._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return e.EventEmitter=c,r},"function"==typeof t&&t.amd?t(function(){return r}):"object"==typeof n&&n.exports?n.exports=r:e.EventEmitter=r}(this||{})},{}]},{},[1])}();
2
  //# sourceMappingURL=forms-api.min.js.map
1
+ !function(){var t=void 0,e=void 0;!function e(n,r,i){function o(s,c){if(!r[s]){if(!n[s]){var a="function"==typeof t&&t;if(!c&&a)return a(s,!0);if(u)return u(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[s]={exports:{}};n[s][0].call(l.exports,function(t){var e=n[s][1][t];return o(e||t)},l,l.exports,e,n,r,i)}return r[s].exports}for(var u="function"==typeof t&&t,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(t,e,n){"use strict";function r(t){var e="animated"===c.auto_scroll;a(t.element,{duration:e?800:1,alignment:"middle"})}function i(){var t=this,e=t.form.querySelectorAll("[data-show-if], [data-hide-if]"),n=(t.getAttribute("name")||"").toLowerCase();[].forEach.call(e,function(e){var r=!!e.getAttribute("data-show-if"),i=r?e.getAttribute("data-show-if").split(":"):e.getAttribute("data-hide-if").split(":"),o=i[0],u=i[1]||"";if(n===o.toLowerCase()){(function(t,e,n){return function(){var r=this.value.trim(),i=("radio"!==this.getAttribute("type")&&"checked"!==this.getAttribute("type")||this.checked)&&(r===e&&""!==e||""===e&&r.length>0);t.style.display=n?i?"":"none":i?"none":""}})(e,u,r).call(t)}})}var o=window.mc4wp||{},u=t("gator"),s=t("./forms/forms.js"),c=window.mc4wp_forms_config||{},a=t("scroll-to-element");if(u(document.body).on("keyup",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",i),u(document.body).on("change",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",i),window.addEventListener("load",function(){[].forEach.call(document.querySelectorAll(".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select"),function(t){i.call(t)})}),u(document.body).on("submit",".mc4wp-form",function(t){var e=s.getByElement(t.target||t.srcElement);s.trigger("submit",[e,t]),s.trigger(e.id+".submit",[e,t])}),u(document.body).on("focus",".mc4wp-form",function(t){var e=s.getByElement(t.target||t.srcElement);e.started||(s.trigger("started",[e,t]),s.trigger(e.id+".started",[e,t]),e.started=!0)}),u(document.body).on("change",".mc4wp-form",function(t){var e=s.getByElement(t.target||t.srcElement);s.trigger("change",[e,t]),s.trigger(e.id+".change",[e,t])}),o.listeners){for(var f=o.listeners,l=0;l<f.length;l++)s.on(f[l].event,f[l].callback);delete o.listeners}if(o.forms=s,c.submitted_form){var h=c.submitted_form,p=document.getElementById(h.element_id);!function(t,e,n,i){var o=Date.now(),u=document.body.clientHeight;n&&t.setData(i),window.scrollY<=10&&c.auto_scroll&&r(t),window.addEventListener("load",function(){s.trigger("submitted",[t]),s.trigger(t.id+".submitted",[t]),n?(s.trigger("error",[t,n]),s.trigger(t.id+".error",[t,n])):(s.trigger("success",[t,i]),s.trigger(t.id+".success",[t,i]),s.trigger(e+"d",[t,i]),s.trigger(t.id+"."+e+"d",[t,i]));var a=Date.now()-o;c.auto_scroll&&a>1e3&&a<2e3&&document.body.clientHeight!=u&&r(t)})}(s.getByElement(p),h.action,h.errors,h.data)}window.mc4wp=o},{"./forms/forms.js":3,gator:11,"scroll-to-element":13}],2:[function(t,e,n){"use strict";var r=t("form-serialize"),i=t("populate.js"),o=function(t,e){this.id=t,this.element=e||document.createElement("form"),this.name=this.element.getAttribute("data-name")||"Form #"+this.id,this.errors=[],this.started=!1};o.prototype.setData=function(t){try{i(this.element,t)}catch(t){console.error(t)}},o.prototype.getData=function(){return r(this.element,{hash:!0,empty:!0})},o.prototype.getSerializedData=function(){return r(this.element,{hash:!1,empty:!0})},o.prototype.setResponse=function(t){this.element.querySelector(".mc4wp-response").innerHTML=t},o.prototype.reset=function(){this.setResponse(""),this.element.querySelector(".mc4wp-form-fields").style.display="",this.element.reset()},e.exports=o},{"form-serialize":10,"populate.js":12}],3:[function(t,e,n){"use strict";function r(t,e){e=e||parseInt(t.getAttribute("data-id"))||0;var n=new o(e,t);return s.push(n),n}var i=t("wolfy87-eventemitter"),o=t("./form.js"),u=new i,s=[];e.exports={all:function(){return s},get:function(t){for(var e=0;e<s.length;e++)if(s[e].id==t)return s[e];return r(document.querySelector(".mc4wp-form-"+t),t)},getByElement:function(t){for(var e=t.form||t,n=0;n<s.length;n++)if(s[n].element==e)return s[n];return r(e)},on:u.on.bind(u),trigger:u.trigger.bind(u),off:u.off.bind(u)}},{"./form.js":2,"wolfy87-eventemitter":15}],4:[function(t,e,n){function r(t){switch(i(t)){case"object":var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=r(t[n]));return e;case"array":e=new Array(t.length);for(var o=0,u=t.length;o<u;o++)e[o]=r(t[o]);return e;case"regexp":var s="";return s+=t.multiline?"m":"",s+=t.global?"g":"",s+=t.ignoreCase?"i":"",new RegExp(t.source,s);case"date":return new Date(t.getTime());default:return t}}var i;try{i=t("component-type")}catch(e){i=t("type")}e.exports=r},{"component-type":8,type:8}],5:[function(t,e,n){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if((r=n[i])===e||r.fn===e){n.splice(i,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n)for(var r=0,i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],6:[function(t,e,n){n=e.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-r)),i=setTimeout(t,n);return r=e,i};var r=(new Date).getTime(),i=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.clearTimeout;n.cancel=function(t){i.call(window,t)}},{}],7:[function(t,e,n){function r(t){if(!(this instanceof r))return new r(t);this._from=t,this.ease("linear"),this.duration(500)}var i=t("emitter"),o=t("clone"),u=t("type"),s=t("ease");e.exports=r,i(r.prototype),r.prototype.reset=function(){return this.isArray="array"===u(this._from),this._curr=o(this._from),this._done=!1,this._start=Date.now(),this},r.prototype.to=function(t){return this.reset(),this._to=t,this},r.prototype.duration=function(t){return this._duration=t,this},r.prototype.ease=function(t){if(!(t="function"==typeof t?t:s[t]))throw new TypeError("invalid easing function");return this._ease=t,this},r.prototype.stop=function(){return this.stopped=!0,this._done=!0,this.emit("stop"),this.emit("end"),this},r.prototype.step=function(){if(!this._done){var t=this._duration,e=Date.now();if(e-this._start>=t)return this._from=this._to,this._update(this._to),this._done=!0,this.emit("end"),this;var n=this._from,r=this._to,i=this._curr,o=(0,this._ease)((e-this._start)/t);if(this.isArray){for(var u=0;u<n.length;++u)i[u]=n[u]+(r[u]-n[u])*o;return this._update(i),this}for(var s in n)i[s]=n[s]+(r[s]-n[s])*o;return this._update(i),this}},r.prototype.update=function(t){return 0==arguments.length?this.step():(this._update=t,this)}},{clone:4,ease:9,emitter:5,type:8}],8:[function(t,e,n){var r=Object.prototype.toString;e.exports=function(t){switch(r.call(t)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===t?"null":void 0===t?"undefined":t!=t?"nan":t&&1===t.nodeType?"element":typeof(t=t.valueOf?t.valueOf():Object.prototype.valueOf.apply(t))}},{}],9:[function(t,e,n){n.linear=function(t){return t},n.inQuad=function(t){return t*t},n.outQuad=function(t){return t*(2-t)},n.inOutQuad=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},n.inCube=function(t){return t*t*t},n.outCube=function(t){return--t*t*t+1},n.inOutCube=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},n.inQuart=function(t){return t*t*t*t},n.outQuart=function(t){return 1- --t*t*t*t},n.inOutQuart=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},n.inQuint=function(t){return t*t*t*t*t},n.outQuint=function(t){return--t*t*t*t*t+1},n.inOutQuint=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},n.inSine=function(t){return 1-Math.cos(t*Math.PI/2)},n.outSine=function(t){return Math.sin(t*Math.PI/2)},n.inOutSine=function(t){return.5*(1-Math.cos(Math.PI*t))},n.inExpo=function(t){return 0==t?0:Math.pow(1024,t-1)},n.outExpo=function(t){return 1==t?t:1-Math.pow(2,-10*t)},n.inOutExpo=function(t){return 0==t?0:1==t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},n.inCirc=function(t){return 1-Math.sqrt(1-t*t)},n.outCirc=function(t){return Math.sqrt(1- --t*t)},n.inOutCirc=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},n.inBack=function(t){return t*t*(2.70158*t-1.70158)},n.outBack=function(t){return--t*t*(2.70158*t+1.70158)+1},n.inOutBack=function(t){return(t*=2)<1?t*t*(3.5949095*t-2.5949095)*.5:.5*((t-=2)*t*(3.5949095*t+2.5949095)+2)},n.inBounce=function(t){return 1-n.outBounce(1-t)},n.outBounce=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},n.inOutBounce=function(t){return t<.5?.5*n.inBounce(2*t):.5*n.outBounce(2*t-1)+.5},n["in-quad"]=n.inQuad,n["out-quad"]=n.outQuad,n["in-out-quad"]=n.inOutQuad,n["in-cube"]=n.inCube,n["out-cube"]=n.outCube,n["in-out-cube"]=n.inOutCube,n["in-quart"]=n.inQuart,n["out-quart"]=n.outQuart,n["in-out-quart"]=n.inOutQuart,n["in-quint"]=n.inQuint,n["out-quint"]=n.outQuint,n["in-out-quint"]=n.inOutQuint,n["in-sine"]=n.inSine,n["out-sine"]=n.outSine,n["in-out-sine"]=n.inOutSine,n["in-expo"]=n.inExpo,n["out-expo"]=n.outExpo,n["in-out-expo"]=n.inOutExpo,n["in-circ"]=n.inCirc,n["out-circ"]=n.outCirc,n["in-out-circ"]=n.inOutCirc,n["in-back"]=n.inBack,n["out-back"]=n.outBack,n["in-out-back"]=n.inOutBack,n["in-bounce"]=n.inBounce,n["out-bounce"]=n.outBounce,n["in-out-bounce"]=n.inOutBounce},{}],10:[function(t,e,n){function r(t,e,n){if(0===e.length)return t=n;var i=e.shift(),o=i.match(/^\[(.+?)\]$/);if("[]"===i)return t=t||[],Array.isArray(t)?t.push(r(null,e,n)):(t._values=t._values||[],t._values.push(r(null,e,n))),t;if(o){var u=o[1],s=+u;isNaN(s)?(t=t||{})[u]=r(t[u],e,n):(t=t||[])[s]=r(t[s],e,n)}else t[i]=r(t[i],e,n);return t}var i=/^(?:submit|button|image|reset|file)$/i,o=/^(?:input|select|textarea|keygen)/i,u=/(\[[^\[\]]*\])/g;e.exports=function(t,e){"object"!=typeof e?e={hash:!!e}:void 0===e.hash&&(e.hash=!0);for(var n=e.hash?{}:"",s=e.serializer||(e.hash?function(t,e,n){if(e.match(u)){var i=function(t){var e=[],n=new RegExp(u),r=/^([^\[\]]*)/.exec(t);for(r[1]&&e.push(r[1]);null!==(r=n.exec(t));)e.push(r[1]);return e}(e);r(t,i,n)}else{var o=t[e];o?(Array.isArray(o)||(t[e]=[o]),t[e].push(n)):t[e]=n}return t}:function(t,e,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=encodeURIComponent(n),n=n.replace(/%20/g,"+"),t+(t?"&":"")+encodeURIComponent(e)+"="+n}),c=t&&t.elements?t.elements:[],a=Object.create(null),f=0;f<c.length;++f){var l=c[f];if((e.disabled||!l.disabled)&&l.name&&o.test(l.nodeName)&&!i.test(l.type)){var h=l.name,p=l.value;if("checkbox"!==l.type&&"radio"!==l.type||l.checked||(p=void 0),e.empty){if("checkbox"!==l.type||l.checked||(p=""),"radio"===l.type&&(a[l.name]||l.checked?l.checked&&(a[l.name]=!0):a[l.name]=!1),void 0==p&&"radio"==l.type)continue}else if(!p)continue;if("select-multiple"!==l.type)n=s(n,h,p);else{p=[];for(var d=l.options,m=!1,v=0;v<d.length;++v){var g=d[v],y=e.empty&&!g.value,w=g.value||y;g.selected&&w&&(m=!0,n=e.hash&&"[]"!==h.slice(h.length-2)?s(n,h+"[]",g.value):s(n,h,g.value))}!m&&e.empty&&(n=s(n,h,""))}}}if(e.empty)for(var h in a)a[h]||(n=s(n,h,""));return n}},{}],11:[function(t,e,n){!function(){function t(e,n,r){if("_root"==n)return r;if(e!==r)return function(t){return u||(u=t.matches?t.matches:t.webkitMatchesSelector?t.webkitMatchesSelector:t.mozMatchesSelector?t.mozMatchesSelector:t.msMatchesSelector?t.msMatchesSelector:t.oMatchesSelector?t.oMatchesSelector:o.matchesSelector)}(e).call(e,n)?e:e.parentNode?(s++,t(e.parentNode,n,r)):void 0}function n(t,e,n,r){a[t.id]||(a[t.id]={}),a[t.id][e]||(a[t.id][e]={}),a[t.id][e][n]||(a[t.id][e][n]=[]),a[t.id][e][n].push(r)}function r(t,e,n,r){if(a[t.id])if(e)if(r||n)if(r){if(a[t.id][e][n])for(var i=0;i<a[t.id][e][n].length;i++)if(a[t.id][e][n][i]===r){a[t.id][e][n].splice(i,1);break}}else delete a[t.id][e][n];else a[t.id][e]={};else for(var o in a[t.id])a[t.id].hasOwnProperty(o)&&(a[t.id][o]={})}function i(e,i,u,c){function l(e){return function(n){!function(e,n,r){if(a[e][r]){var i,u,c=n.target||n.srcElement,l={},h=0,p=0;s=0;for(i in a[e][r])a[e][r].hasOwnProperty(i)&&(u=t(c,i,f[e].element))&&o.matchesEvent(r,f[e].element,u,"_root"==i,n)&&(s++,a[e][r][i].match=u,l[s]=a[e][r][i]);for(n.stopPropagation=function(){n.cancelBubble=!0},h=0;h<=s;h++)if(l[h])for(p=0;p<l[h].length;p++){if(!1===l[h][p].call(l[h].match,n))return void o.cancel(n);if(n.cancelBubble)return}}}(p,n,e)}}if(this.element){e instanceof Array||(e=[e]),u||"function"!=typeof i||(u=i,i="_root");var h,p=this.id;for(h=0;h<e.length;h++)c?r(this,e[h],i,u):(a[p]&&a[p][e[h]]||o.addEvent(this,e[h],l(e[h])),n(this,e[h],i,u));return this}}function o(t,e){if(!(this instanceof o)){for(var n in f)if(f[n].element===t)return f[n];return c++,f[c]=new o(t,c),f[c]}this.element=t,this.id=e}var u,s=0,c=0,a={},f={};o.prototype.on=function(t,e,n){return i.call(this,t,e,n)},o.prototype.off=function(t,e,n){return i.call(this,t,e,n,!0)},o.matchesSelector=function(){},o.cancel=function(t){t.preventDefault(),t.stopPropagation()},o.addEvent=function(t,e,n){var r="blur"==e||"focus"==e;t.element.addEventListener(e,n,r)},o.matchesEvent=function(){return!0},void 0!==e&&e.exports&&(e.exports=o),window.Gator=o}()},{}],12:[function(t,n,r){!function(t){var r=function(t,e,n){for(var i in e)if(e.hasOwnProperty(i)){var o=i,u=e[i];if(void 0===u&&(u=""),null===u&&(u=""),void 0!==n&&(o=n+"["+i+"]"),u.constructor===Array)o+="[]";else if("object"==typeof u){r(t,u,o);continue}var s=t.elements.namedItem(o);if(s){switch(s.type||s[0].type){default:s.value=u;break;case"radio":case"checkbox":for(var c=0;c<s.length;c++)s[c].checked=u.indexOf(s[c].value)>-1;break;case"select-multiple":for(var a=u.constructor==Array?u:[u],f=0;f<s.options.length;f++)s.options[f].selected|=a.indexOf(s.options[f].value)>-1;break;case"select":case"select-one":s.value=u.toString()||u;break;case"date":s.value=new Date(u).toISOString().split("T")[0]}}}};"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return r}):void 0!==n&&n.exports?n.exports=r:t.populate=r}(this)},{}],13:[function(t,e,n){var r=t("scroll-to");e.exports=function(t,e){if(e=e||{},"string"==typeof t&&(t=document.querySelector(t)),t)return r(0,function(t,e,n){var r=document.body,i=document.documentElement,o=t.getBoundingClientRect(),u=i.clientHeight,s=Math.max(r.scrollHeight,r.offsetHeight,i.clientHeight,i.scrollHeight,i.offsetHeight);e=e||0;var c;c="bottom"===n?o.bottom-u:"middle"===n?o.bottom-u/2-o.height/2:o.top;var a=s-u;return Math.min(c+e+window.pageYOffset,a)}(t,e.offset,e.align),e)}},{"scroll-to":14}],14:[function(t,e,n){var r=t("tween"),i=t("raf");e.exports=function(t,e,n){function o(){i(o),s.update()}n=n||{};var u=function(){var t=window.pageYOffset||document.documentElement.scrollTop,e=window.pageXOffset||document.documentElement.scrollLeft;return{top:t,left:e}}(),s=r(u).ease(n.ease||"out-circ").to({top:e,left:t}).duration(n.duration||1e3);return s.update(function(t){window.scrollTo(0|t.left,0|t.top)}),s.on("end",function(){o=function(){}}),o(),s}},{raf:6,tween:7}],15:[function(t,n,r){!function(t){"use strict";function r(){}function i(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function o(t){return function(){return this[t].apply(this,arguments)}}function u(t){return"function"==typeof t||t instanceof RegExp||!(!t||"object"!=typeof t)&&u(t.listener)}var s=r.prototype,c=t.EventEmitter;s.getListeners=function(t){var e,n,r=this._getEvents();if(t instanceof RegExp){e={};for(n in r)r.hasOwnProperty(n)&&t.test(n)&&(e[n]=r[n])}else e=r[t]||(r[t]=[]);return e},s.flattenListeners=function(t){var e,n=[];for(e=0;e<t.length;e+=1)n.push(t[e].listener);return n},s.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&((e={})[t]=n),e||n},s.addListener=function(t,e){if(!u(e))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(t),o="object"==typeof e;for(n in r)r.hasOwnProperty(n)&&-1===i(r[n],e)&&r[n].push(o?e:{listener:e,once:!1});return this},s.on=o("addListener"),s.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},s.once=o("addOnceListener"),s.defineEvent=function(t){return this.getListeners(t),this},s.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},s.removeListener=function(t,e){var n,r,o=this.getListenersAsObject(t);for(r in o)o.hasOwnProperty(r)&&-1!==(n=i(o[r],e))&&o[r].splice(n,1);return this},s.off=o("removeListener"),s.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},s.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},s.manipulateListeners=function(t,e,n){var r,i,o=t?this.removeListener:this.addListener,u=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(r=n.length;r--;)o.call(this,e,n[r]);else for(r in e)e.hasOwnProperty(r)&&(i=e[r])&&("function"==typeof i?o.call(this,r,i):u.call(this,r,i));return this},s.removeEvent=function(t){var e,n=typeof t,r=this._getEvents();if("string"===n)delete r[t];else if(t instanceof RegExp)for(e in r)r.hasOwnProperty(e)&&t.test(e)&&delete r[e];else delete this._events;return this},s.removeAllListeners=o("removeEvent"),s.emitEvent=function(t,e){var n,r,i,o,u=this.getListenersAsObject(t);for(o in u)if(u.hasOwnProperty(o))for(n=u[o].slice(0),i=0;i<n.length;i++)!0===(r=n[i]).once&&this.removeListener(t,r.listener),r.listener.apply(this,e||[])===this._getOnceReturnValue()&&this.removeListener(t,r.listener);return this},s.trigger=o("emitEvent"),s.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},s.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},s._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},s._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return t.EventEmitter=c,r},"function"==typeof e&&e.amd?e(function(){return r}):"object"==typeof n&&n.exports?n.exports=r:t.EventEmitter=r}(this||{})},{}]},{},[1])}();
2
  //# sourceMappingURL=forms-api.min.js.map
assets/js/forms-api.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["forms-api.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","scrollToForm","form","args","behavior","config","auto_scroll","element","scrollIntoView","toggleConditionalElements","input","this","elements","querySelectorAll","inputName","getAttribute","toLowerCase","forEach","el","show","conditions","split","nameCondition","valueCondition","expectedValue","value","trim","conditionMet","checked","style","display","toggleElement","mc4wp","window","Gator","forms","mc4wp_forms_config","document","body","on","addEventListener","event","getByElement","target","srcElement","trigger","id","started","listeners","callback","submitted_form","formConfig","getElementById","element_id","action","errors","data","pageHeight","clientHeight","timeStart","Date","now","setData","timeElapsed","handleFormRequest","./forms/forms.js","gator","2","serialize","populate","Form","createElement","name","prototype","console","error","getData","hash","empty","getSerializedData","setResponse","msg","querySelector","innerHTML","reset","form-serialize","populate.js","3","createFromElement","formElement","parseInt","push","EventEmitter","events","all","get","formId","bind","off","./form.js","wolfy87-eventemitter","4","hash_assign","result","keys","key","shift","between","match","Array","isArray","_values","string","index","isNaN","k_r_submitter","k_r_success_contrls","brackets","options","serializer","children","RegExp","exec","parse_keys","existing","replace","encodeURIComponent","radio_store","Object","create","disabled","test","nodeName","type","val","selectOptions","isSelectedOptions","j","option","allowedEmpty","hasValue","selected","slice","5","_matchesSelector","selector","boundElement","_matcher","matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_getMatcher","parentNode","_level","_addHandler","_handlers","_removeHandler","splice","hasOwnProperty","_bind","remove","_getGlobalCallback","_gatorInstances","matchesEvent","stopPropagation","cancelBubble","cancel","_handleEvent","addEvent","_id","preventDefault","useCapture","6","root","basename","constructor","namedItem","indexOf","values","k","toString","toISOString","amd","7","indexOfListener","listener","alias","apply","arguments","isValidListener","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","addListeners","manipulateListeners","removeListeners","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,IAAIA,OAAUC,EAAeC,OAASD,GAAW,SAAUE,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATV,GAAqBA,EAAQ,IAAIS,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,IAAIQ,YAAYZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,IAAIE,EAAED,EAAEI,GAAG,GAAGL,GAAG,OAAOI,EAAEF,GAAIF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAkD,IAAI,IAA1CL,EAAkB,mBAATX,GAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAAvb,EAA4bY,GAAG,SAASnB,EAAQoB,EAAOJ,GACvhB,aAUA,SAASK,EAAaC,GACrB,IACIC,GACH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I,EAAGA,EAAIyD,EAAUlD,OAAQP,KAKR,KAFtBqM,EAAW5I,EAAUzD,IAERsN,MACTlM,KAAKuM,eAAed,EAAKR,EAASA,UAG3BA,EAASA,SAASE,MAAMnL,KAAMR,SAExBQ,KAAKkN,uBAClBlN,KAAKuM,eAAed,EAAKR,EAASA,UAMlD,OAAOjL,MAMXsL,EAAMpJ,QAAUgJ,EAAM,aAUtBI,EAAM6B,KAAO,SAAc1B,GACvB,IAAIjM,EAAO0G,MAAMpC,UAAUqE,MAAMjJ,KAAKkM,UAAW,GACjD,OAAOpL,KAAKgN,UAAUvB,EAAKjM,IAW/B8L,EAAM8B,mBAAqB,SAA4BtM,GAEnD,OADAd,KAAKqN,iBAAmBvM,EACjBd,MAWXsL,EAAM4B,oBAAsB,WACxB,OAAIlN,KAAKsJ,eAAe,qBACbtJ,KAAKqN,kBAapB/B,EAAMK,WAAa,WACf,OAAO3L,KAAK8M,UAAY9M,KAAK8M,aAQjC7H,EAAaqI,WAAa,WAEtB,OADArO,EAAQgG,aAAesG,EAChBtG,GAIW,mBAAX9G,GAAyBA,EAAO2M,IACvC3M,EAAO,WACH,OAAO8G,IAGY,iBAAX5F,GAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUgG,EAGjBhG,EAAQgG,aAAeA,EA5d9B,CA8dCjF,oBAES,IA97CX","file":"forms-api.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\n// deps & vars\n\nvar mc4wp = window.mc4wp || {};\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar config = window.mc4wp_forms_config || {};\n\n// funcs\nfunction scrollToForm(form) {\n\tvar animate = config.auto_scroll === 'animated';\n\tvar args = {\n\t\tbehavior: animate ? \"smooth\" : \"instant\"\n\t};\n\tform.element.scrollIntoView(args);\n}\n\nfunction handleFormRequest(form, action, errors, data) {\n\tvar pageHeight = document.body.clientHeight;\n\tvar timeStart = Date.now();\n\n\t// re-populate form\n\tif (errors) {\n\t\tform.setData(data);\n\t}\n\n\tif (config.auto_scroll) {\n\t\tscrollToForm(form);\n\t}\n\n\t// trigger events on window.load so all other scripts have loaded\n\twindow.addEventListener('load', function () {\n\t\tvar timeElapsed = Date.now() - timeStart;\n\n\t\t// scroll to form again if page height changed since last scroll\n\t\t// (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)\n\t\tif (config.auto_scroll && timeElapsed < 800 && document.body.clientHeight !== pageHeight) {\n\t\t\tscrollToForm(form);\n\t\t}\n\n\t\t// trigger events\n\t\tforms.trigger('submitted', [form]);\n\t\tforms.trigger(form.id + '.submitted', [form]);\n\n\t\tif (errors) {\n\t\t\tforms.trigger('error', [form, errors]);\n\t\t\tforms.trigger(form.id + '.error', [form, errors]);\n\t\t} else {\n\t\t\t// form was successfully submitted\n\t\t\tforms.trigger('success', [form, data]);\n\t\t\tforms.trigger(form.id + '.success', [form, data]);\n\n\t\t\t// subscribed / unsubscribed\n\t\t\tforms.trigger(action + \"d\", [form, data]);\n\t\t\tforms.trigger(form.id + \".\" + action + \"d\", [form, data]);\n\t\t}\n\t});\n}\n\nfunction toggleElement(el, expectedValue, show) {\n\treturn function () {\n\t\tvar value = this.value.trim();\n\t\tvar checked = this.getAttribute('type') !== 'radio' && this.getAttribute('type') !== 'checked' || this.checked;\n\t\tvar conditionMet = checked && (value === expectedValue && expectedValue !== \"\" || expectedValue === \"\" && value.length > 0);\n\t\tif (show) {\n\t\t\tel.style.display = conditionMet ? '' : 'none';\n\t\t} else {\n\t\t\tel.style.display = conditionMet ? 'none' : '';\n\t\t}\n\t};\n}\n\nfunction toggleConditionalElements() {\n\tvar input = this;\n\tvar elements = input.form.querySelectorAll('[data-show-if], [data-hide-if]');\n\tvar inputName = (input.getAttribute('name') || '').toLowerCase();\n\n\t[].forEach.call(elements, function (el) {\n\t\tvar show = !!el.getAttribute('data-show-if');\n\t\tvar conditions = show ? el.getAttribute('data-show-if').split(':') : el.getAttribute('data-hide-if').split(':');\n\t\tvar nameCondition = conditions[0];\n\t\tvar valueCondition = conditions[1] || \"\";\n\n\t\tif (inputName !== nameCondition.toLowerCase()) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar callback = toggleElement(el, valueCondition, show);\n\t\tcallback.call(input);\n\t});\n}\n\nGator(document.body).on('keyup', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nGator(document.body).on('change', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nwindow.addEventListener('load', function () {\n\t[].forEach.call(document.querySelectorAll('.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select'), function (el) {\n\t\ttoggleConditionalElements.call(el);\n\t});\n});\n\n// Bind browser events to form events (using delegation)\nGator(document.body).on('submit', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('submit', [form, event]);\n\tforms.trigger(form.id + '.submit', [form, event]);\n});\n\nGator(document.body).on('focus', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\n\tif (!form.started) {\n\t\tforms.trigger('started', [form, event]);\n\t\tforms.trigger(form.id + '.started', [form, event]);\n\t\tform.started = true;\n\t}\n});\n\nGator(document.body).on('change', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('change', [form, event]);\n\tforms.trigger(form.id + '.change', [form, event]);\n});\n\n// register early listeners\nif (mc4wp.listeners) {\n\tvar listeners = mc4wp.listeners;\n\tfor (var i = 0; i < listeners.length; i++) {\n\t\tforms.on(listeners[i].event, listeners[i].callback);\n\t}\n\n\t// delete temp listeners array, so we don't bind twice\n\tdelete mc4wp[\"listeners\"];\n}\n\n// expose forms object\nmc4wp.forms = forms;\n\n// handle submitted form\nif (config.submitted_form) {\n\tvar formConfig = config.submitted_form,\n\t element = document.getElementById(formConfig.element_id),\n\t form = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n// expose mc4wp object globally\nwindow.mc4wp = mc4wp;\n\n},{\"./forms/forms.js\":3,\"gator\":5}],2:[function(require,module,exports){\n'use strict';\n\nvar serialize = require('form-serialize');\nvar populate = require('populate.js');\n\nvar Form = function Form(id, element) {\n\tthis.id = id;\n\tthis.element = element || document.createElement('form');\n\tthis.name = this.element.getAttribute('data-name') || \"Form #\" + this.id;\n\tthis.errors = [];\n\tthis.started = false;\n};\n\nForm.prototype.setData = function (data) {\n\ttry {\n\t\tpopulate(this.element, data);\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n};\n\nForm.prototype.getData = function () {\n\treturn serialize(this.element, { hash: true, empty: true });\n};\n\nForm.prototype.getSerializedData = function () {\n\treturn serialize(this.element, { hash: false, empty: true });\n};\n\nForm.prototype.setResponse = function (msg) {\n\tthis.element.querySelector('.mc4wp-response').innerHTML = msg;\n};\n\n// revert back to original state\nForm.prototype.reset = function () {\n\tthis.setResponse('');\n\tthis.element.querySelector('.mc4wp-form-fields').style.display = '';\n\tthis.element.reset();\n};\n\nmodule.exports = Form;\n\n},{\"form-serialize\":4,\"populate.js\":6}],3:[function(require,module,exports){\n'use strict';\n\n// deps\n\nvar EventEmitter = require('wolfy87-eventemitter');\nvar Form = require('./form.js');\n\n// variables\nvar events = new EventEmitter();\nvar forms = [];\n\n// get form by its id\n// please note that this will get the FIRST occurence of the form with that ID on the page\nfunction get(formId) {\n\n\t// do we have form for this one already?\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].id == formId) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\t// try to create from first occurence of this element\n\tvar formElement = document.querySelector('.mc4wp-form-' + formId);\n\treturn createFromElement(formElement, formId);\n}\n\n// get form by <form> element (or any input in form)\nfunction getByElement(element) {\n\tvar formElement = element.form || element;\n\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].element == formElement) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\treturn createFromElement(formElement);\n}\n\n// create form object from <form> element\nfunction createFromElement(formElement, id) {\n\tid = id || parseInt(formElement.getAttribute('data-id')) || 0;\n\tvar form = new Form(id, formElement);\n\tforms.push(form);\n\treturn form;\n}\n\nfunction all() {\n\treturn forms;\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": events.on.bind(events),\n\t\"trigger\": events.trigger.bind(events),\n\t\"off\": events.off.bind(events)\n};\n\n},{\"./form.js\":2,\"wolfy87-eventemitter\":7}],4:[function(require,module,exports){\n// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n if (typeof options != 'object') {\n options = { hash: !!options };\n }\n else if (options.hash === undefined) {\n options.hash = true;\n }\n\n var result = (options.hash) ? {} : '';\n var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n var elements = form && form.elements ? form.elements : [];\n\n //Object store each radio and set if it's empty or not\n var radio_store = Object.create(null);\n\n for (var i=0 ; i<elements.length ; ++i) {\n var element = elements[i];\n\n // ingore disabled fields\n if ((!options.disabled && element.disabled) || !element.name) {\n continue;\n }\n // ignore anyhting that is not considered a success field\n if (!k_r_success_contrls.test(element.nodeName) ||\n k_r_submitter.test(element.type)) {\n continue;\n }\n\n var key = element.name;\n var val = element.value;\n\n // we can't just use element.value for checkboxes cause some browsers lie to us\n // they say \"on\" for value when the box isn't checked\n if ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n val = undefined;\n }\n\n // If we want empty elements\n if (options.empty) {\n // for checkbox\n if (element.type === 'checkbox' && !element.checked) {\n val = '';\n }\n\n // for radio\n if (element.type === 'radio') {\n if (!radio_store[element.name] && !element.checked) {\n radio_store[element.name] = false;\n }\n else if (element.checked) {\n radio_store[element.name] = true;\n }\n }\n\n // if options empty is true, continue only if its radio\n if (val == undefined && element.type == 'radio') {\n continue;\n }\n }\n else {\n // value-less fields are ignored unless options.empty is true\n if (!val) {\n continue;\n }\n }\n\n // multi select boxes\n if (element.type === 'select-multiple') {\n val = [];\n\n var selectOptions = element.options;\n var isSelectedOptions = false;\n for (var j=0 ; j<selectOptions.length ; ++j) {\n var option = selectOptions[j];\n var allowedEmpty = options.empty && !option.value;\n var hasValue = (option.value || allowedEmpty);\n if (option.selected && hasValue) {\n isSelectedOptions = true;\n\n // If using a hash serializer be sure to add the\n // correct notation for an array in the multi-select\n // context. Here the name attribute on the select element\n // might be missing the trailing bracket pair. Both names\n // \"foo\" and \"foo[]\" should be arrays.\n if (options.hash && key.slice(key.length - 2) !== '[]') {\n result = serializer(result, key + '[]', option.value);\n }\n else {\n result = serializer(result, key, option.value);\n }\n }\n }\n\n // Serialize if no selected options and options.empty is true\n if (!isSelectedOptions && options.empty) {\n result = serializer(result, key, '');\n }\n\n continue;\n }\n\n result = serializer(result, key, val);\n }\n\n // Check for all empty radio buttons and serialize them with key=\"\"\n if (options.empty) {\n for (var key in radio_store) {\n if (!radio_store[key]) {\n result = serializer(result, key, '');\n }\n }\n }\n\n return result;\n}\n\nfunction parse_keys(string) {\n var keys = [];\n var prefix = /^([^\\[\\]]*)/;\n var children = new RegExp(brackets);\n var match = prefix.exec(string);\n\n if (match[1]) {\n keys.push(match[1]);\n }\n\n while ((match = children.exec(string)) !== null) {\n keys.push(match[1]);\n }\n\n return keys;\n}\n\nfunction hash_assign(result, keys, value) {\n if (keys.length === 0) {\n result = value;\n return result;\n }\n\n var key = keys.shift();\n var between = key.match(/^\\[(.+?)\\]$/);\n\n if (key === '[]') {\n result = result || [];\n\n if (Array.isArray(result)) {\n result.push(hash_assign(null, keys, value));\n }\n else {\n // This might be the result of bad name attributes like \"[][foo]\",\n // in this case the original `result` object will already be\n // assigned to an object literal. Rather than coerce the object to\n // an array, or cause an exception the attribute \"_values\" is\n // assigned as an array.\n result._values = result._values || [];\n result._values.push(hash_assign(null, keys, value));\n }\n\n return result;\n }\n\n // Key is an attribute name and can be assigned directly.\n if (!between) {\n result[key] = hash_assign(result[key], keys, value);\n }\n else {\n var string = between[1];\n // +var converts the variable into a number\n // better than parseInt because it doesn't truncate away trailing\n // letters and actually fails if whole thing is not a number\n var index = +string;\n\n // If the characters between the brackets is not a number it is an\n // attribute name and can be assigned directly.\n if (isNaN(index)) {\n result = result || {};\n result[string] = hash_assign(result[string], keys, value);\n }\n else {\n result = result || [];\n result[index] = hash_assign(result[index], keys, value);\n }\n }\n\n return result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n var matches = key.match(brackets);\n\n // Has brackets? Use the recursive assignment function to walk the keys,\n // construct any missing objects in the result tree and make the assignment\n // at the end of the chain.\n if (matches) {\n var keys = parse_keys(key);\n hash_assign(result, keys, value);\n }\n else {\n // Non bracket notation can make assignments directly.\n var existing = result[key];\n\n // If the value has been assigned already (for instance when a radio and\n // a checkbox have the same name attribute) convert the previous value\n // into an array before pushing into it.\n //\n // NOTE: If this requirement were removed all hash creation and\n // assignment could go through `hash_assign`.\n if (existing) {\n if (!Array.isArray(existing)) {\n result[key] = [ existing ];\n }\n\n result[key].push(value);\n }\n else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n // encode newlines as \\r\\n cause the html spec says so\n value = value.replace(/(\\r)?\\n/g, '\\r\\n');\n value = encodeURIComponent(value);\n\n // spaces should be '+' rather than '%20'.\n value = value.replace(/%20/g, '+');\n return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n\n},{}],5:[function(require,module,exports){\n/**\n * Copyright 2014 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * GATOR.JS\n * Simple Event Delegation\n *\n * @version 1.2.4\n *\n * Compatible with IE 9+, FF 3.6+, Safari 5+, Chrome\n *\n * Include legacy.js for compatibility with older browsers\n *\n * .-._ _ _ _ _ _ _ _ _\n * .-''-.__.-'00 '-' ' ' ' ' ' ' ' '-.\n * '.___ ' . .--_'-' '-' '-' _'-' '._\n * V: V 'vv-' '_ '. .' _..' '.'.\n * '=.____.=_.--' :_.__.__:_ '. : :\n * (((____.-' '-. / : :\n * (((-'\\ .' /\n * _____..' .'\n * '-._____.-'\n */\n(function() {\n var _matcher,\n _level = 0,\n _id = 0,\n _handlers = {},\n _gatorInstances = {};\n\n function _addEvent(gator, type, callback) {\n\n // blur and focus do not bubble up but if you use event capturing\n // then you will get them\n var useCapture = type == 'blur' || type == 'focus';\n gator.element.addEventListener(type, callback, useCapture);\n }\n\n function _cancel(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * returns function to use for determining if an element\n * matches a query selector\n *\n * @returns {Function}\n */\n function _getMatcher(element) {\n if (_matcher) {\n return _matcher;\n }\n\n if (element.matches) {\n _matcher = element.matches;\n return _matcher;\n }\n\n if (element.webkitMatchesSelector) {\n _matcher = element.webkitMatchesSelector;\n return _matcher;\n }\n\n if (element.mozMatchesSelector) {\n _matcher = element.mozMatchesSelector;\n return _matcher;\n }\n\n if (element.msMatchesSelector) {\n _matcher = element.msMatchesSelector;\n return _matcher;\n }\n\n if (element.oMatchesSelector) {\n _matcher = element.oMatchesSelector;\n return _matcher;\n }\n\n // if it doesn't match a native browser method\n // fall back to the gator function\n _matcher = Gator.matchesSelector;\n return _matcher;\n }\n\n /**\n * determines if the specified element matches a given selector\n *\n * @param {Node} element - the element to compare against the selector\n * @param {string} selector\n * @param {Node} boundElement - the element the listener was attached to\n * @returns {void|Node}\n */\n function _matchesSelector(element, selector, boundElement) {\n\n // no selector means this event was bound directly to this element\n if (selector == '_root') {\n return boundElement;\n }\n\n // if we have moved up to the element you bound the event to\n // then we have come too far\n if (element === boundElement) {\n return;\n }\n\n // if this is a match then we are done!\n if (_getMatcher(element).call(element, selector)) {\n return element;\n }\n\n // if this element did not match but has a parent we should try\n // going up the tree to see if any of the parent elements match\n // for example if you are looking for a click on an <a> tag but there\n // is a <span> inside of the a tag that it is the target,\n // it should still work\n if (element.parentNode) {\n _level++;\n return _matchesSelector(element.parentNode, selector, boundElement);\n }\n }\n\n function _addHandler(gator, event, selector, callback) {\n if (!_handlers[gator.id]) {\n _handlers[gator.id] = {};\n }\n\n if (!_handlers[gator.id][event]) {\n _handlers[gator.id][event] = {};\n }\n\n if (!_handlers[gator.id][event][selector]) {\n _handlers[gator.id][event][selector] = [];\n }\n\n _handlers[gator.id][event][selector].push(callback);\n }\n\n function _removeHandler(gator, event, selector, callback) {\n\n // if there are no events tied to this element at all\n // then don't do anything\n if (!_handlers[gator.id]) {\n return;\n }\n\n // if there is no event type specified then remove all events\n // example: Gator(element).off()\n if (!event) {\n for (var type in _handlers[gator.id]) {\n if (_handlers[gator.id].hasOwnProperty(type)) {\n _handlers[gator.id][type] = {};\n }\n }\n return;\n }\n\n // if no callback or selector is specified remove all events of this type\n // example: Gator(element).off('click')\n if (!callback && !selector) {\n _handlers[gator.id][event] = {};\n return;\n }\n\n // if a selector is specified but no callback remove all events\n // for this selector\n // example: Gator(element).off('click', '.sub-element')\n if (!callback) {\n delete _handlers[gator.id][event][selector];\n return;\n }\n\n // if we have specified an event type, selector, and callback then we\n // need to make sure there are callbacks tied to this selector to\n // begin with. if there aren't then we can stop here\n if (!_handlers[gator.id][event][selector]) {\n return;\n }\n\n // if there are then loop through all the callbacks and if we find\n // one that matches remove it from the array\n for (var i = 0; i < _handlers[gator.id][event][selector].length; i++) {\n if (_handlers[gator.id][event][selector][i] === callback) {\n _handlers[gator.id][event][selector].splice(i, 1);\n break;\n }\n }\n }\n\n function _handleEvent(id, e, type) {\n if (!_handlers[id][type]) {\n return;\n }\n\n var target = e.target || e.srcElement,\n selector,\n match,\n matches = {},\n i = 0,\n j = 0;\n\n // find all events that match\n _level = 0;\n for (selector in _handlers[id][type]) {\n if (_handlers[id][type].hasOwnProperty(selector)) {\n match = _matchesSelector(target, selector, _gatorInstances[id].element);\n\n if (match && Gator.matchesEvent(type, _gatorInstances[id].element, match, selector == '_root', e)) {\n _level++;\n _handlers[id][type][selector].match = match;\n matches[_level] = _handlers[id][type][selector];\n }\n }\n }\n\n // stopPropagation() fails to set cancelBubble to true in Webkit\n // @see http://code.google.com/p/chromium/issues/detail?id=162270\n e.stopPropagation = function() {\n e.cancelBubble = true;\n };\n\n for (i = 0; i <= _level; i++) {\n if (matches[i]) {\n for (j = 0; j < matches[i].length; j++) {\n if (matches[i][j].call(matches[i].match, e) === false) {\n Gator.cancel(e);\n return;\n }\n\n if (e.cancelBubble) {\n return;\n }\n }\n }\n }\n }\n\n /**\n * binds the specified events to the element\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @param {boolean=} remove\n * @returns {Object}\n */\n function _bind(events, selector, callback, remove) {\n\n // fail silently if you pass null or undefined as an alement\n // in the Gator constructor\n if (!this.element) {\n return;\n }\n\n if (!(events instanceof Array)) {\n events = [events];\n }\n\n if (!callback && typeof(selector) == 'function') {\n callback = selector;\n selector = '_root';\n }\n\n var id = this.id,\n i;\n\n function _getGlobalCallback(type) {\n return function(e) {\n _handleEvent(id, e, type);\n };\n }\n\n for (i = 0; i < events.length; i++) {\n if (remove) {\n _removeHandler(this, events[i], selector, callback);\n continue;\n }\n\n if (!_handlers[id] || !_handlers[id][events[i]]) {\n Gator.addEvent(this, events[i], _getGlobalCallback(events[i]));\n }\n\n _addHandler(this, events[i], selector, callback);\n }\n\n return this;\n }\n\n /**\n * Gator object constructor\n *\n * @param {Node} element\n */\n function Gator(element, id) {\n\n // called as function\n if (!(this instanceof Gator)) {\n // only keep one Gator instance per node to make sure that\n // we don't create a ton of new objects if you want to delegate\n // multiple events from the same node\n //\n // for example: Gator(document).on(...\n for (var key in _gatorInstances) {\n if (_gatorInstances[key].element === element) {\n return _gatorInstances[key];\n }\n }\n\n _id++;\n _gatorInstances[_id] = new Gator(element, _id);\n\n return _gatorInstances[_id];\n }\n\n this.element = element;\n this.id = id;\n }\n\n /**\n * adds an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.on = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback);\n };\n\n /**\n * removes an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.off = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback, true);\n };\n\n Gator.matchesSelector = function() {};\n Gator.cancel = _cancel;\n Gator.addEvent = _addEvent;\n Gator.matchesEvent = function() {\n return true;\n };\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Gator;\n }\n\n window.Gator = Gator;\n}) ();\n\n},{}],6:[function(require,module,exports){\n/*! populate.js v1.0.2 by @dannyvankooten | MIT license */\n;(function(root) {\n\n\t/**\n\t * Populate form fields from a JSON object.\n\t *\n\t * @param form object The form element containing your input fields.\n\t * @param data array JSON data to populate the fields with.\n\t * @param basename string Optional basename which is added to `name` attributes\n\t */\n\tvar populate = function( form, data, basename) {\n\n\t\tfor(var key in data) {\n\n\t\t\tif( ! data.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar name = key;\n\t\t\tvar value = data[key];\n\n if ('undefined' === typeof value) {\n value = '';\n }\n\n if (null === value) {\n value = '';\n }\n\n\t\t\t// handle array name attributes\n\t\t\tif(typeof(basename) !== \"undefined\") {\n\t\t\t\tname = basename + \"[\" + key + \"]\";\n\t\t\t}\n\n\t\t\tif(value.constructor === Array) {\n\t\t\t\tname += '[]';\n\t\t\t} else if(typeof value == \"object\") {\n\t\t\t\tpopulate( form, value, name);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only proceed if element is set\n\t\t\tvar element = form.elements.namedItem( name );\n\t\t\tif( ! element ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar type = element.type || element[0].type;\n\n\t\t\tswitch(type ) {\n\t\t\t\tdefault:\n\t\t\t\t\telement.value = value;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\tfor( var j=0; j < element.length; j++ ) {\n\t\t\t\t\t\telement[j].checked = ( value.indexOf(element[j].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\tvar values = value.constructor == Array ? value : [value];\n\n\t\t\t\t\tfor(var k = 0; k < element.options.length; k++) {\n\t\t\t\t\t\telement.options[k].selected |= (values.indexOf(element.options[k].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\tcase 'select-one':\n\t\t\t\t\telement.value = value.toString() || value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n \t\t\t\telement.value = new Date(value).toISOString().split('T')[0];\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\t// Play nice with AMD, CommonJS or a plain global object.\n\tif ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) {\n\t\tdefine(function() {\n\t\t\treturn populate;\n\t\t});\n\t}\telse if ( typeof module !== 'undefined' && module.exports ) {\n\t\tmodule.exports = populate;\n\t} else {\n\t\troot.populate = populate;\n\t}\n\n}(this));\n\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.4 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(this || {}));\n\n},{}]},{},[1]);\n })();"]}
1
+ {"version":3,"sources":["forms-api.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","scrollToForm","form","animate","config","auto_scroll","scrollToElement","element","duration","alignment","toggleConditionalElements","input","this","elements","querySelectorAll","inputName","getAttribute","toLowerCase","forEach","el","show","conditions","split","nameCondition","valueCondition","expectedValue","value","trim","conditionMet","checked","style","display","toggleElement","mc4wp","window","Gator","forms","mc4wp_forms_config","document","body","on","addEventListener","event","getByElement","target","srcElement","trigger","id","started","listeners","callback","submitted_form","formConfig","getElementById","element_id","action","errors","data","timeStart","Date","now","pageHeight","clientHeight","setData","scrollY","timeElapsed","handleFormRequest","./forms/forms.js","gator","scroll-to-element","2","serialize","populate","Form","createElement","name","prototype","console","error","getData","hash","empty","getSerializedData","setResponse","msg","querySelector","innerHTML","reset","form-serialize","populate.js","3","createFromElement","formElement","parseInt","push","EventEmitter","events","all","get","formId","bind","off","./form.js","wolfy87-eventemitter","4","clone","obj","type","copy","key","hasOwnProperty","Array","flags","multiline","global","ignoreCase","RegExp","source","getTime","_","component-type","5","Emitter","mixin","fn","_callbacks","once","apply","arguments","removeListener","removeAllListeners","removeEventListener","callbacks","cb","splice","emit","args","slice","len","hasListeners","6","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","curr","ms","Math","max","prev","req","setTimeout","cancel","cancelAnimationFrame","webkitCancelAnimationFrame","mozCancelAnimationFrame","clearTimeout","7","Tween","_from","ease","isArray","_curr","_done","_start","to","_to","_duration","TypeError","_ease","stop","stopped","step","_update","from","k","update","emitter","8","toString","Object","val","nodeType","valueOf","9","linear","inQuad","outQuad","inOutQuad","inCube","outCube","inOutCube","inQuart","outQuart","inOutQuart","inQuint","outQuint","inOutQuint","inSine","cos","PI","outSine","sin","inOutSine","inExpo","pow","outExpo","inOutExpo","inCirc","sqrt","outCirc","inOutCirc","inBack","outBack","inOutBack","inBounce","outBounce","inOutBounce","10","hash_assign","result","keys","shift","between","match","_values","string","index","isNaN","k_r_submitter","k_r_success_contrls","brackets","options","serializer","children","exec","parse_keys","existing","replace","encodeURIComponent","radio_store","create","disabled","test","nodeName","selectOptions","isSelectedOptions","j","option","allowedEmpty","hasValue","selected","11","_matchesSelector","selector","boundElement","_matcher","matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_getMatcher","parentNode","_level","_addHandler","_handlers","_removeHandler","_bind","remove","_getGlobalCallback","_gatorInstances","matchesEvent","stopPropagation","cancelBubble","_handleEvent","addEvent","_id","preventDefault","useCapture","12","root","basename","constructor","namedItem","indexOf","values","toISOString","amd","13","scroll","elem","additionalOffset","html","documentElement","elemRect","getBoundingClientRect","documentHeight","scrollHeight","offsetHeight","scrollPosition","bottom","height","top","maxScrollPosition","min","pageYOffset","calculateScrollOffset","offset","align","scroll-to","14","raf","x","y","tween","start","scrollTop","pageXOffset","scrollLeft","left","scrollTo","15","indexOfListener","listener","alias","isValidListener","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","addOnceListener","defineEvent","defineEvents","evts","addListeners","manipulateListeners","removeListeners","single","multiple","removeEvent","_events","emitEvent","listenersMap","_getOnceReturnValue","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WA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undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\n// deps & vars\n\nvar mc4wp = window.mc4wp || {};\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar config = window.mc4wp_forms_config || {};\nvar scrollToElement = require('scroll-to-element');\n\n// funcs\nfunction scrollToForm(form) {\n\tvar animate = config.auto_scroll === 'animated';\n\n\tscrollToElement(form.element, {\n\t\tduration: animate ? 800 : 1,\n\t\talignment: 'middle'\n\t});\n}\n\nfunction handleFormRequest(form, action, errors, data) {\n\tvar timeStart = Date.now();\n\tvar pageHeight = document.body.clientHeight;\n\n\t// re-populate form\n\tif (errors) {\n\t\tform.setData(data);\n\t}\n\n\t// scroll to form\n\tif (window.scrollY <= 10 && config.auto_scroll) {\n\t\tscrollToForm(form);\n\t}\n\n\t// trigger events on window.load so all other scripts have loaded\n\twindow.addEventListener('load', function () {\n\t\t// trigger events\n\t\tforms.trigger('submitted', [form]);\n\t\tforms.trigger(form.id + '.submitted', [form]);\n\n\t\tif (errors) {\n\t\t\tforms.trigger('error', [form, errors]);\n\t\t\tforms.trigger(form.id + '.error', [form, errors]);\n\t\t} else {\n\t\t\t// form was successfully submitted\n\t\t\tforms.trigger('success', [form, data]);\n\t\t\tforms.trigger(form.id + '.success', [form, data]);\n\n\t\t\t// subscribed / unsubscribed\n\t\t\tforms.trigger(action + \"d\", [form, data]);\n\t\t\tforms.trigger(form.id + \".\" + action + \"d\", [form, data]);\n\t\t}\n\n\t\t// scroll to form again if page height changed since last scroll, eg because of slow loading images\n\t\t// (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)\n\t\tvar timeElapsed = Date.now() - timeStart;\n\t\tif (config.auto_scroll && timeElapsed > 1000 && timeElapsed < 2000 && document.body.clientHeight != pageHeight) {\n\t\t\tscrollToForm(form);\n\t\t}\n\t});\n}\n\nfunction toggleElement(el, expectedValue, show) {\n\treturn function () {\n\t\tvar value = this.value.trim();\n\t\tvar checked = this.getAttribute('type') !== 'radio' && this.getAttribute('type') !== 'checked' || this.checked;\n\t\tvar conditionMet = checked && (value === expectedValue && expectedValue !== \"\" || expectedValue === \"\" && value.length > 0);\n\t\tif (show) {\n\t\t\tel.style.display = conditionMet ? '' : 'none';\n\t\t} else {\n\t\t\tel.style.display = conditionMet ? 'none' : '';\n\t\t}\n\t};\n}\n\nfunction toggleConditionalElements() {\n\tvar input = this;\n\tvar elements = input.form.querySelectorAll('[data-show-if], [data-hide-if]');\n\tvar inputName = (input.getAttribute('name') || '').toLowerCase();\n\n\t[].forEach.call(elements, function (el) {\n\t\tvar show = !!el.getAttribute('data-show-if');\n\t\tvar conditions = show ? el.getAttribute('data-show-if').split(':') : el.getAttribute('data-hide-if').split(':');\n\t\tvar nameCondition = conditions[0];\n\t\tvar valueCondition = conditions[1] || \"\";\n\n\t\tif (inputName !== nameCondition.toLowerCase()) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar callback = toggleElement(el, valueCondition, show);\n\t\tcallback.call(input);\n\t});\n}\n\nGator(document.body).on('keyup', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nGator(document.body).on('change', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nwindow.addEventListener('load', function () {\n\t[].forEach.call(document.querySelectorAll('.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select'), function (el) {\n\t\ttoggleConditionalElements.call(el);\n\t});\n});\n\n// Bind browser events to form events (using delegation)\nGator(document.body).on('submit', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('submit', [form, event]);\n\tforms.trigger(form.id + '.submit', [form, event]);\n});\n\nGator(document.body).on('focus', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\n\tif (!form.started) {\n\t\tforms.trigger('started', [form, event]);\n\t\tforms.trigger(form.id + '.started', [form, event]);\n\t\tform.started = true;\n\t}\n});\n\nGator(document.body).on('change', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('change', [form, event]);\n\tforms.trigger(form.id + '.change', [form, event]);\n});\n\n// register early listeners\nif (mc4wp.listeners) {\n\tvar listeners = mc4wp.listeners;\n\tfor (var i = 0; i < listeners.length; i++) {\n\t\tforms.on(listeners[i].event, listeners[i].callback);\n\t}\n\n\t// delete temp listeners array, so we don't bind twice\n\tdelete mc4wp[\"listeners\"];\n}\n\n// expose forms object\nmc4wp.forms = forms;\n\n// handle submitted form\nif (config.submitted_form) {\n\tvar formConfig = config.submitted_form,\n\t element = document.getElementById(formConfig.element_id),\n\t form = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n// expose mc4wp object globally\nwindow.mc4wp = mc4wp;\n\n},{\"./forms/forms.js\":3,\"gator\":11,\"scroll-to-element\":13}],2:[function(require,module,exports){\n'use strict';\n\nvar serialize = require('form-serialize');\nvar populate = require('populate.js');\n\nvar Form = function Form(id, element) {\n\tthis.id = id;\n\tthis.element = element || document.createElement('form');\n\tthis.name = this.element.getAttribute('data-name') || \"Form #\" + this.id;\n\tthis.errors = [];\n\tthis.started = false;\n};\n\nForm.prototype.setData = function (data) {\n\ttry {\n\t\tpopulate(this.element, data);\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n};\n\nForm.prototype.getData = function () {\n\treturn serialize(this.element, { hash: true, empty: true });\n};\n\nForm.prototype.getSerializedData = function () {\n\treturn serialize(this.element, { hash: false, empty: true });\n};\n\nForm.prototype.setResponse = function (msg) {\n\tthis.element.querySelector('.mc4wp-response').innerHTML = msg;\n};\n\n// revert back to original state\nForm.prototype.reset = function () {\n\tthis.setResponse('');\n\tthis.element.querySelector('.mc4wp-form-fields').style.display = '';\n\tthis.element.reset();\n};\n\nmodule.exports = Form;\n\n},{\"form-serialize\":10,\"populate.js\":12}],3:[function(require,module,exports){\n'use strict';\n\n// deps\n\nvar EventEmitter = require('wolfy87-eventemitter');\nvar Form = require('./form.js');\n\n// variables\nvar events = new EventEmitter();\nvar forms = [];\n\n// get form by its id\n// please note that this will get the FIRST occurence of the form with that ID on the page\nfunction get(formId) {\n\n\t// do we have form for this one already?\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].id == formId) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\t// try to create from first occurence of this element\n\tvar formElement = document.querySelector('.mc4wp-form-' + formId);\n\treturn createFromElement(formElement, formId);\n}\n\n// get form by <form> element (or any input in form)\nfunction getByElement(element) {\n\tvar formElement = element.form || element;\n\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].element == formElement) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\treturn createFromElement(formElement);\n}\n\n// create form object from <form> element\nfunction createFromElement(formElement, id) {\n\tid = id || parseInt(formElement.getAttribute('data-id')) || 0;\n\tvar form = new Form(id, formElement);\n\tforms.push(form);\n\treturn form;\n}\n\nfunction all() {\n\treturn forms;\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": events.on.bind(events),\n\t\"trigger\": events.trigger.bind(events),\n\t\"off\": events.off.bind(events)\n};\n\n},{\"./form.js\":2,\"wolfy87-eventemitter\":15}],4:[function(require,module,exports){\n/**\n * Module dependencies.\n */\n\nvar type;\ntry {\n type = require('component-type');\n} catch (_) {\n type = require('type');\n}\n\n/**\n * Module exports.\n */\n\nmodule.exports = clone;\n\n/**\n * Clones objects.\n *\n * @param {Mixed} any object\n * @api public\n */\n\nfunction clone(obj){\n switch (type(obj)) {\n case 'object':\n var copy = {};\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n copy[key] = clone(obj[key]);\n }\n }\n return copy;\n\n case 'array':\n var copy = new Array(obj.length);\n for (var i = 0, l = obj.length; i < l; i++) {\n copy[i] = clone(obj[i]);\n }\n return copy;\n\n case 'regexp':\n // from millermedeiros/amd-utils - MIT\n var flags = '';\n flags += obj.multiline ? 'm' : '';\n flags += obj.global ? 'g' : '';\n flags += obj.ignoreCase ? 'i' : '';\n return new RegExp(obj.source, flags);\n\n case 'date':\n return new Date(obj.getTime());\n\n default: // string, number, boolean, …\n return obj;\n }\n}\n\n},{\"component-type\":8,\"type\":8}],5:[function(require,module,exports){\n\n/**\n * Expose `Emitter`.\n */\n\nmodule.exports = Emitter;\n\n/**\n * Initialize a new `Emitter`.\n *\n * @api public\n */\n\nfunction Emitter(obj) {\n if (obj) return mixin(obj);\n};\n\n/**\n * Mixin the emitter properties.\n *\n * @param {Object} obj\n * @return {Object}\n * @api private\n */\n\nfunction mixin(obj) {\n for (var key in Emitter.prototype) {\n obj[key] = Emitter.prototype[key];\n }\n return obj;\n}\n\n/**\n * Listen on the given `event` with `fn`.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.on =\nEmitter.prototype.addEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\n .push(fn);\n return this;\n};\n\n/**\n * Adds an `event` listener that will be invoked a single\n * time then automatically removed.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.once = function(event, fn){\n function on() {\n this.off(event, on);\n fn.apply(this, arguments);\n }\n\n on.fn = fn;\n this.on(event, on);\n return this;\n};\n\n/**\n * Remove the given callback for `event` or all\n * registered callbacks.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.off =\nEmitter.prototype.removeListener =\nEmitter.prototype.removeAllListeners =\nEmitter.prototype.removeEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n\n // all\n if (0 == arguments.length) {\n this._callbacks = {};\n return this;\n }\n\n // specific event\n var callbacks = this._callbacks['$' + event];\n if (!callbacks) return this;\n\n // remove all handlers\n if (1 == arguments.length) {\n delete this._callbacks['$' + event];\n return this;\n }\n\n // remove specific handler\n var cb;\n for (var i = 0; i < callbacks.length; i++) {\n cb = callbacks[i];\n if (cb === fn || cb.fn === fn) {\n callbacks.splice(i, 1);\n break;\n }\n }\n return this;\n};\n\n/**\n * Emit `event` with the given args.\n *\n * @param {String} event\n * @param {Mixed} ...\n * @return {Emitter}\n */\n\nEmitter.prototype.emit = function(event){\n this._callbacks = this._callbacks || {};\n var args = [].slice.call(arguments, 1)\n , callbacks = this._callbacks['$' + event];\n\n if (callbacks) {\n callbacks = callbacks.slice(0);\n for (var i = 0, len = callbacks.length; i < len; ++i) {\n callbacks[i].apply(this, args);\n }\n }\n\n return this;\n};\n\n/**\n * Return array of callbacks for `event`.\n *\n * @param {String} event\n * @return {Array}\n * @api public\n */\n\nEmitter.prototype.listeners = function(event){\n this._callbacks = this._callbacks || {};\n return this._callbacks['$' + event] || [];\n};\n\n/**\n * Check if this emitter has `event` handlers.\n *\n * @param {String} event\n * @return {Boolean}\n * @api public\n */\n\nEmitter.prototype.hasListeners = function(event){\n return !! this.listeners(event).length;\n};\n\n},{}],6:[function(require,module,exports){\n/**\n * Expose `requestAnimationFrame()`.\n */\n\nexports = module.exports = window.requestAnimationFrame\n || window.webkitRequestAnimationFrame\n || window.mozRequestAnimationFrame\n || fallback;\n\n/**\n * Fallback implementation.\n */\n\nvar prev = new Date().getTime();\nfunction fallback(fn) {\n var curr = new Date().getTime();\n var ms = Math.max(0, 16 - (curr - prev));\n var req = setTimeout(fn, ms);\n prev = curr;\n return req;\n}\n\n/**\n * Cancel.\n */\n\nvar cancel = window.cancelAnimationFrame\n || window.webkitCancelAnimationFrame\n || window.mozCancelAnimationFrame\n || window.clearTimeout;\n\nexports.cancel = function(id){\n cancel.call(window, id);\n};\n\n},{}],7:[function(require,module,exports){\n\n/**\n * Module dependencies.\n */\n\nvar Emitter = require('emitter');\nvar clone = require('clone');\nvar type = require('type');\nvar ease = require('ease');\n\n/**\n * Expose `Tween`.\n */\n\nmodule.exports = Tween;\n\n/**\n * Initialize a new `Tween` with `obj`.\n *\n * @param {Object|Array} obj\n * @api public\n */\n\nfunction Tween(obj) {\n if (!(this instanceof Tween)) return new Tween(obj);\n this._from = obj;\n this.ease('linear');\n this.duration(500);\n}\n\n/**\n * Mixin emitter.\n */\n\nEmitter(Tween.prototype);\n\n/**\n * Reset the tween.\n *\n * @api public\n */\n\nTween.prototype.reset = function(){\n this.isArray = 'array' === type(this._from);\n this._curr = clone(this._from);\n this._done = false;\n this._start = Date.now();\n return this;\n};\n\n/**\n * Tween to `obj` and reset internal state.\n *\n * tween.to({ x: 50, y: 100 })\n *\n * @param {Object|Array} obj\n * @return {Tween} self\n * @api public\n */\n\nTween.prototype.to = function(obj){\n this.reset();\n this._to = obj;\n return this;\n};\n\n/**\n * Set duration to `ms` [500].\n *\n * @param {Number} ms\n * @return {Tween} self\n * @api public\n */\n\nTween.prototype.duration = function(ms){\n this._duration = ms;\n return this;\n};\n\n/**\n * Set easing function to `fn`.\n *\n * tween.ease('in-out-sine')\n *\n * @param {String|Function} fn\n * @return {Tween}\n * @api public\n */\n\nTween.prototype.ease = function(fn){\n fn = 'function' == typeof fn ? fn : ease[fn];\n if (!fn) throw new TypeError('invalid easing function');\n this._ease = fn;\n return this;\n};\n\n/**\n * Stop the tween and immediately emit \"stop\" and \"end\".\n *\n * @return {Tween}\n * @api public\n */\n\nTween.prototype.stop = function(){\n this.stopped = true;\n this._done = true;\n this.emit('stop');\n this.emit('end');\n return this;\n};\n\n/**\n * Perform a step.\n *\n * @return {Tween} self\n * @api private\n */\n\nTween.prototype.step = function(){\n if (this._done) return;\n\n // duration\n var duration = this._duration;\n var now = Date.now();\n var delta = now - this._start;\n var done = delta >= duration;\n\n // complete\n if (done) {\n this._from = this._to;\n this._update(this._to);\n this._done = true;\n this.emit('end');\n return this;\n }\n\n // tween\n var from = this._from;\n var to = this._to;\n var curr = this._curr;\n var fn = this._ease;\n var p = (now - this._start) / duration;\n var n = fn(p);\n\n // array\n if (this.isArray) {\n for (var i = 0; i < from.length; ++i) {\n curr[i] = from[i] + (to[i] - from[i]) * n;\n }\n\n this._update(curr);\n return this;\n }\n\n // objech\n for (var k in from) {\n curr[k] = from[k] + (to[k] - from[k]) * n;\n }\n\n this._update(curr);\n return this;\n};\n\n/**\n * Set update function to `fn` or\n * when no argument is given this performs\n * a \"step\".\n *\n * @param {Function} fn\n * @return {Tween} self\n * @api public\n */\n\nTween.prototype.update = function(fn){\n if (0 == arguments.length) return this.step();\n this._update = fn;\n return this;\n};\n},{\"clone\":4,\"ease\":9,\"emitter\":5,\"type\":8}],8:[function(require,module,exports){\n/**\n * toString ref.\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Return the type of `val`.\n *\n * @param {Mixed} val\n * @return {String}\n * @api public\n */\n\nmodule.exports = function(val){\n switch (toString.call(val)) {\n case '[object Date]': return 'date';\n case '[object RegExp]': return 'regexp';\n case '[object Arguments]': return 'arguments';\n case '[object Array]': return 'array';\n case '[object Error]': return 'error';\n }\n\n if (val === null) return 'null';\n if (val === undefined) return 'undefined';\n if (val !== val) return 'nan';\n if (val && val.nodeType === 1) return 'element';\n\n val = val.valueOf\n ? val.valueOf()\n : Object.prototype.valueOf.apply(val)\n\n return typeof val;\n};\n\n},{}],9:[function(require,module,exports){\n\n// easing functions from \"Tween.js\"\n\nexports.linear = function(n){\n return n;\n};\n\nexports.inQuad = function(n){\n return n * n;\n};\n\nexports.outQuad = function(n){\n return n * (2 - n);\n};\n\nexports.inOutQuad = function(n){\n n *= 2;\n if (n < 1) return 0.5 * n * n;\n return - 0.5 * (--n * (n - 2) - 1);\n};\n\nexports.inCube = function(n){\n return n * n * n;\n};\n\nexports.outCube = function(n){\n return --n * n * n + 1;\n};\n\nexports.inOutCube = function(n){\n n *= 2;\n if (n < 1) return 0.5 * n * n * n;\n return 0.5 * ((n -= 2 ) * n * n + 2);\n};\n\nexports.inQuart = function(n){\n return n * n * n * n;\n};\n\nexports.outQuart = function(n){\n return 1 - (--n * n * n * n);\n};\n\nexports.inOutQuart = function(n){\n n *= 2;\n if (n < 1) return 0.5 * n * n * n * n;\n return -0.5 * ((n -= 2) * n * n * n - 2);\n};\n\nexports.inQuint = function(n){\n return n * n * n * n * n;\n}\n\nexports.outQuint = function(n){\n return --n * n * n * n * n + 1;\n}\n\nexports.inOutQuint = function(n){\n n *= 2;\n if (n < 1) return 0.5 * n * n * n * n * n;\n return 0.5 * ((n -= 2) * n * n * n * n + 2);\n};\n\nexports.inSine = function(n){\n return 1 - Math.cos(n * Math.PI / 2 );\n};\n\nexports.outSine = function(n){\n return Math.sin(n * Math.PI / 2);\n};\n\nexports.inOutSine = function(n){\n return .5 * (1 - Math.cos(Math.PI * n));\n};\n\nexports.inExpo = function(n){\n return 0 == n ? 0 : Math.pow(1024, n - 1);\n};\n\nexports.outExpo = function(n){\n return 1 == n ? n : 1 - Math.pow(2, -10 * n);\n};\n\nexports.inOutExpo = function(n){\n if (0 == n) return 0;\n if (1 == n) return 1;\n if ((n *= 2) < 1) return .5 * Math.pow(1024, n - 1);\n return .5 * (-Math.pow(2, -10 * (n - 1)) + 2);\n};\n\nexports.inCirc = function(n){\n return 1 - Math.sqrt(1 - n * n);\n};\n\nexports.outCirc = function(n){\n return Math.sqrt(1 - (--n * n));\n};\n\nexports.inOutCirc = function(n){\n n *= 2\n if (n < 1) return -0.5 * (Math.sqrt(1 - n * n) - 1);\n return 0.5 * (Math.sqrt(1 - (n -= 2) * n) + 1);\n};\n\nexports.inBack = function(n){\n var s = 1.70158;\n return n * n * (( s + 1 ) * n - s);\n};\n\nexports.outBack = function(n){\n var s = 1.70158;\n return --n * n * ((s + 1) * n + s) + 1;\n};\n\nexports.inOutBack = function(n){\n var s = 1.70158 * 1.525;\n if ( ( n *= 2 ) < 1 ) return 0.5 * ( n * n * ( ( s + 1 ) * n - s ) );\n return 0.5 * ( ( n -= 2 ) * n * ( ( s + 1 ) * n + s ) + 2 );\n};\n\nexports.inBounce = function(n){\n return 1 - exports.outBounce(1 - n);\n};\n\nexports.outBounce = function(n){\n if ( n < ( 1 / 2.75 ) ) {\n return 7.5625 * n * n;\n } else if ( n < ( 2 / 2.75 ) ) {\n return 7.5625 * ( n -= ( 1.5 / 2.75 ) ) * n + 0.75;\n } else if ( n < ( 2.5 / 2.75 ) ) {\n return 7.5625 * ( n -= ( 2.25 / 2.75 ) ) * n + 0.9375;\n } else {\n return 7.5625 * ( n -= ( 2.625 / 2.75 ) ) * n + 0.984375;\n }\n};\n\nexports.inOutBounce = function(n){\n if (n < .5) return exports.inBounce(n * 2) * .5;\n return exports.outBounce(n * 2 - 1) * .5 + .5;\n};\n\n// aliases\n\nexports['in-quad'] = exports.inQuad;\nexports['out-quad'] = exports.outQuad;\nexports['in-out-quad'] = exports.inOutQuad;\nexports['in-cube'] = exports.inCube;\nexports['out-cube'] = exports.outCube;\nexports['in-out-cube'] = exports.inOutCube;\nexports['in-quart'] = exports.inQuart;\nexports['out-quart'] = exports.outQuart;\nexports['in-out-quart'] = exports.inOutQuart;\nexports['in-quint'] = exports.inQuint;\nexports['out-quint'] = exports.outQuint;\nexports['in-out-quint'] = exports.inOutQuint;\nexports['in-sine'] = exports.inSine;\nexports['out-sine'] = exports.outSine;\nexports['in-out-sine'] = exports.inOutSine;\nexports['in-expo'] = exports.inExpo;\nexports['out-expo'] = exports.outExpo;\nexports['in-out-expo'] = exports.inOutExpo;\nexports['in-circ'] = exports.inCirc;\nexports['out-circ'] = exports.outCirc;\nexports['in-out-circ'] = exports.inOutCirc;\nexports['in-back'] = exports.inBack;\nexports['out-back'] = exports.outBack;\nexports['in-out-back'] = exports.inOutBack;\nexports['in-bounce'] = exports.inBounce;\nexports['out-bounce'] = exports.outBounce;\nexports['in-out-bounce'] = exports.inOutBounce;\n\n},{}],10:[function(require,module,exports){\n// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n if (typeof options != 'object') {\n options = { hash: !!options };\n }\n else if (options.hash === undefined) {\n options.hash = true;\n }\n\n var result = (options.hash) ? {} : '';\n var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n var elements = form && form.elements ? form.elements : [];\n\n //Object store each radio and set if it's empty or not\n var radio_store = Object.create(null);\n\n for (var i=0 ; i<elements.length ; ++i) {\n var element = elements[i];\n\n // ingore disabled fields\n if ((!options.disabled && element.disabled) || !element.name) {\n continue;\n }\n // ignore anyhting that is not considered a success field\n if (!k_r_success_contrls.test(element.nodeName) ||\n k_r_submitter.test(element.type)) {\n continue;\n }\n\n var key = element.name;\n var val = element.value;\n\n // we can't just use element.value for checkboxes cause some browsers lie to us\n // they say \"on\" for value when the box isn't checked\n if ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n val = undefined;\n }\n\n // If we want empty elements\n if (options.empty) {\n // for checkbox\n if (element.type === 'checkbox' && !element.checked) {\n val = '';\n }\n\n // for radio\n if (element.type === 'radio') {\n if (!radio_store[element.name] && !element.checked) {\n radio_store[element.name] = false;\n }\n else if (element.checked) {\n radio_store[element.name] = true;\n }\n }\n\n // if options empty is true, continue only if its radio\n if (val == undefined && element.type == 'radio') {\n continue;\n }\n }\n else {\n // value-less fields are ignored unless options.empty is true\n if (!val) {\n continue;\n }\n }\n\n // multi select boxes\n if (element.type === 'select-multiple') {\n val = [];\n\n var selectOptions = element.options;\n var isSelectedOptions = false;\n for (var j=0 ; j<selectOptions.length ; ++j) {\n var option = selectOptions[j];\n var allowedEmpty = options.empty && !option.value;\n var hasValue = (option.value || allowedEmpty);\n if (option.selected && hasValue) {\n isSelectedOptions = true;\n\n // If using a hash serializer be sure to add the\n // correct notation for an array in the multi-select\n // context. Here the name attribute on the select element\n // might be missing the trailing bracket pair. Both names\n // \"foo\" and \"foo[]\" should be arrays.\n if (options.hash && key.slice(key.length - 2) !== '[]') {\n result = serializer(result, key + '[]', option.value);\n }\n else {\n result = serializer(result, key, option.value);\n }\n }\n }\n\n // Serialize if no selected options and options.empty is true\n if (!isSelectedOptions && options.empty) {\n result = serializer(result, key, '');\n }\n\n continue;\n }\n\n result = serializer(result, key, val);\n }\n\n // Check for all empty radio buttons and serialize them with key=\"\"\n if (options.empty) {\n for (var key in radio_store) {\n if (!radio_store[key]) {\n result = serializer(result, key, '');\n }\n }\n }\n\n return result;\n}\n\nfunction parse_keys(string) {\n var keys = [];\n var prefix = /^([^\\[\\]]*)/;\n var children = new RegExp(brackets);\n var match = prefix.exec(string);\n\n if (match[1]) {\n keys.push(match[1]);\n }\n\n while ((match = children.exec(string)) !== null) {\n keys.push(match[1]);\n }\n\n return keys;\n}\n\nfunction hash_assign(result, keys, value) {\n if (keys.length === 0) {\n result = value;\n return result;\n }\n\n var key = keys.shift();\n var between = key.match(/^\\[(.+?)\\]$/);\n\n if (key === '[]') {\n result = result || [];\n\n if (Array.isArray(result)) {\n result.push(hash_assign(null, keys, value));\n }\n else {\n // This might be the result of bad name attributes like \"[][foo]\",\n // in this case the original `result` object will already be\n // assigned to an object literal. Rather than coerce the object to\n // an array, or cause an exception the attribute \"_values\" is\n // assigned as an array.\n result._values = result._values || [];\n result._values.push(hash_assign(null, keys, value));\n }\n\n return result;\n }\n\n // Key is an attribute name and can be assigned directly.\n if (!between) {\n result[key] = hash_assign(result[key], keys, value);\n }\n else {\n var string = between[1];\n // +var converts the variable into a number\n // better than parseInt because it doesn't truncate away trailing\n // letters and actually fails if whole thing is not a number\n var index = +string;\n\n // If the characters between the brackets is not a number it is an\n // attribute name and can be assigned directly.\n if (isNaN(index)) {\n result = result || {};\n result[string] = hash_assign(result[string], keys, value);\n }\n else {\n result = result || [];\n result[index] = hash_assign(result[index], keys, value);\n }\n }\n\n return result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n var matches = key.match(brackets);\n\n // Has brackets? Use the recursive assignment function to walk the keys,\n // construct any missing objects in the result tree and make the assignment\n // at the end of the chain.\n if (matches) {\n var keys = parse_keys(key);\n hash_assign(result, keys, value);\n }\n else {\n // Non bracket notation can make assignments directly.\n var existing = result[key];\n\n // If the value has been assigned already (for instance when a radio and\n // a checkbox have the same name attribute) convert the previous value\n // into an array before pushing into it.\n //\n // NOTE: If this requirement were removed all hash creation and\n // assignment could go through `hash_assign`.\n if (existing) {\n if (!Array.isArray(existing)) {\n result[key] = [ existing ];\n }\n\n result[key].push(value);\n }\n else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n // encode newlines as \\r\\n cause the html spec says so\n value = value.replace(/(\\r)?\\n/g, '\\r\\n');\n value = encodeURIComponent(value);\n\n // spaces should be '+' rather than '%20'.\n value = value.replace(/%20/g, '+');\n return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n\n},{}],11:[function(require,module,exports){\n/**\n * Copyright 2014 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * GATOR.JS\n * Simple Event Delegation\n *\n * @version 1.2.4\n *\n * Compatible with IE 9+, FF 3.6+, Safari 5+, Chrome\n *\n * Include legacy.js for compatibility with older browsers\n *\n * .-._ _ _ _ _ _ _ _ _\n * .-''-.__.-'00 '-' ' ' ' ' ' ' ' '-.\n * '.___ ' . .--_'-' '-' '-' _'-' '._\n * V: V 'vv-' '_ '. .' _..' '.'.\n * '=.____.=_.--' :_.__.__:_ '. : :\n * (((____.-' '-. / : :\n * (((-'\\ .' /\n * _____..' .'\n * '-._____.-'\n */\n(function() {\n var _matcher,\n _level = 0,\n _id = 0,\n _handlers = {},\n _gatorInstances = {};\n\n function _addEvent(gator, type, callback) {\n\n // blur and focus do not bubble up but if you use event capturing\n // then you will get them\n var useCapture = type == 'blur' || type == 'focus';\n gator.element.addEventListener(type, callback, useCapture);\n }\n\n function _cancel(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * returns function to use for determining if an element\n * matches a query selector\n *\n * @returns {Function}\n */\n function _getMatcher(element) {\n if (_matcher) {\n return _matcher;\n }\n\n if (element.matches) {\n _matcher = element.matches;\n return _matcher;\n }\n\n if (element.webkitMatchesSelector) {\n _matcher = element.webkitMatchesSelector;\n return _matcher;\n }\n\n if (element.mozMatchesSelector) {\n _matcher = element.mozMatchesSelector;\n return _matcher;\n }\n\n if (element.msMatchesSelector) {\n _matcher = element.msMatchesSelector;\n return _matcher;\n }\n\n if (element.oMatchesSelector) {\n _matcher = element.oMatchesSelector;\n return _matcher;\n }\n\n // if it doesn't match a native browser method\n // fall back to the gator function\n _matcher = Gator.matchesSelector;\n return _matcher;\n }\n\n /**\n * determines if the specified element matches a given selector\n *\n * @param {Node} element - the element to compare against the selector\n * @param {string} selector\n * @param {Node} boundElement - the element the listener was attached to\n * @returns {void|Node}\n */\n function _matchesSelector(element, selector, boundElement) {\n\n // no selector means this event was bound directly to this element\n if (selector == '_root') {\n return boundElement;\n }\n\n // if we have moved up to the element you bound the event to\n // then we have come too far\n if (element === boundElement) {\n return;\n }\n\n // if this is a match then we are done!\n if (_getMatcher(element).call(element, selector)) {\n return element;\n }\n\n // if this element did not match but has a parent we should try\n // going up the tree to see if any of the parent elements match\n // for example if you are looking for a click on an <a> tag but there\n // is a <span> inside of the a tag that it is the target,\n // it should still work\n if (element.parentNode) {\n _level++;\n return _matchesSelector(element.parentNode, selector, boundElement);\n }\n }\n\n function _addHandler(gator, event, selector, callback) {\n if (!_handlers[gator.id]) {\n _handlers[gator.id] = {};\n }\n\n if (!_handlers[gator.id][event]) {\n _handlers[gator.id][event] = {};\n }\n\n if (!_handlers[gator.id][event][selector]) {\n _handlers[gator.id][event][selector] = [];\n }\n\n _handlers[gator.id][event][selector].push(callback);\n }\n\n function _removeHandler(gator, event, selector, callback) {\n\n // if there are no events tied to this element at all\n // then don't do anything\n if (!_handlers[gator.id]) {\n return;\n }\n\n // if there is no event type specified then remove all events\n // example: Gator(element).off()\n if (!event) {\n for (var type in _handlers[gator.id]) {\n if (_handlers[gator.id].hasOwnProperty(type)) {\n _handlers[gator.id][type] = {};\n }\n }\n return;\n }\n\n // if no callback or selector is specified remove all events of this type\n // example: Gator(element).off('click')\n if (!callback && !selector) {\n _handlers[gator.id][event] = {};\n return;\n }\n\n // if a selector is specified but no callback remove all events\n // for this selector\n // example: Gator(element).off('click', '.sub-element')\n if (!callback) {\n delete _handlers[gator.id][event][selector];\n return;\n }\n\n // if we have specified an event type, selector, and callback then we\n // need to make sure there are callbacks tied to this selector to\n // begin with. if there aren't then we can stop here\n if (!_handlers[gator.id][event][selector]) {\n return;\n }\n\n // if there are then loop through all the callbacks and if we find\n // one that matches remove it from the array\n for (var i = 0; i < _handlers[gator.id][event][selector].length; i++) {\n if (_handlers[gator.id][event][selector][i] === callback) {\n _handlers[gator.id][event][selector].splice(i, 1);\n break;\n }\n }\n }\n\n function _handleEvent(id, e, type) {\n if (!_handlers[id][type]) {\n return;\n }\n\n var target = e.target || e.srcElement,\n selector,\n match,\n matches = {},\n i = 0,\n j = 0;\n\n // find all events that match\n _level = 0;\n for (selector in _handlers[id][type]) {\n if (_handlers[id][type].hasOwnProperty(selector)) {\n match = _matchesSelector(target, selector, _gatorInstances[id].element);\n\n if (match && Gator.matchesEvent(type, _gatorInstances[id].element, match, selector == '_root', e)) {\n _level++;\n _handlers[id][type][selector].match = match;\n matches[_level] = _handlers[id][type][selector];\n }\n }\n }\n\n // stopPropagation() fails to set cancelBubble to true in Webkit\n // @see http://code.google.com/p/chromium/issues/detail?id=162270\n e.stopPropagation = function() {\n e.cancelBubble = true;\n };\n\n for (i = 0; i <= _level; i++) {\n if (matches[i]) {\n for (j = 0; j < matches[i].length; j++) {\n if (matches[i][j].call(matches[i].match, e) === false) {\n Gator.cancel(e);\n return;\n }\n\n if (e.cancelBubble) {\n return;\n }\n }\n }\n }\n }\n\n /**\n * binds the specified events to the element\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @param {boolean=} remove\n * @returns {Object}\n */\n function _bind(events, selector, callback, remove) {\n\n // fail silently if you pass null or undefined as an alement\n // in the Gator constructor\n if (!this.element) {\n return;\n }\n\n if (!(events instanceof Array)) {\n events = [events];\n }\n\n if (!callback && typeof(selector) == 'function') {\n callback = selector;\n selector = '_root';\n }\n\n var id = this.id,\n i;\n\n function _getGlobalCallback(type) {\n return function(e) {\n _handleEvent(id, e, type);\n };\n }\n\n for (i = 0; i < events.length; i++) {\n if (remove) {\n _removeHandler(this, events[i], selector, callback);\n continue;\n }\n\n if (!_handlers[id] || !_handlers[id][events[i]]) {\n Gator.addEvent(this, events[i], _getGlobalCallback(events[i]));\n }\n\n _addHandler(this, events[i], selector, callback);\n }\n\n return this;\n }\n\n /**\n * Gator object constructor\n *\n * @param {Node} element\n */\n function Gator(element, id) {\n\n // called as function\n if (!(this instanceof Gator)) {\n // only keep one Gator instance per node to make sure that\n // we don't create a ton of new objects if you want to delegate\n // multiple events from the same node\n //\n // for example: Gator(document).on(...\n for (var key in _gatorInstances) {\n if (_gatorInstances[key].element === element) {\n return _gatorInstances[key];\n }\n }\n\n _id++;\n _gatorInstances[_id] = new Gator(element, _id);\n\n return _gatorInstances[_id];\n }\n\n this.element = element;\n this.id = id;\n }\n\n /**\n * adds an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.on = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback);\n };\n\n /**\n * removes an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.off = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback, true);\n };\n\n Gator.matchesSelector = function() {};\n Gator.cancel = _cancel;\n Gator.addEvent = _addEvent;\n Gator.matchesEvent = function() {\n return true;\n };\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Gator;\n }\n\n window.Gator = Gator;\n}) ();\n\n},{}],12:[function(require,module,exports){\n/*! populate.js v1.0.2 by @dannyvankooten | MIT license */\n;(function(root) {\n\n\t/**\n\t * Populate form fields from a JSON object.\n\t *\n\t * @param form object The form element containing your input fields.\n\t * @param data array JSON data to populate the fields with.\n\t * @param basename string Optional basename which is added to `name` attributes\n\t */\n\tvar populate = function( form, data, basename) {\n\n\t\tfor(var key in data) {\n\n\t\t\tif( ! data.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar name = key;\n\t\t\tvar value = data[key];\n\n if ('undefined' === typeof value) {\n value = '';\n }\n\n if (null === value) {\n value = '';\n }\n\n\t\t\t// handle array name attributes\n\t\t\tif(typeof(basename) !== \"undefined\") {\n\t\t\t\tname = basename + \"[\" + key + \"]\";\n\t\t\t}\n\n\t\t\tif(value.constructor === Array) {\n\t\t\t\tname += '[]';\n\t\t\t} else if(typeof value == \"object\") {\n\t\t\t\tpopulate( form, value, name);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only proceed if element is set\n\t\t\tvar element = form.elements.namedItem( name );\n\t\t\tif( ! element ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar type = element.type || element[0].type;\n\n\t\t\tswitch(type ) {\n\t\t\t\tdefault:\n\t\t\t\t\telement.value = value;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\tfor( var j=0; j < element.length; j++ ) {\n\t\t\t\t\t\telement[j].checked = ( value.indexOf(element[j].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\tvar values = value.constructor == Array ? value : [value];\n\n\t\t\t\t\tfor(var k = 0; k < element.options.length; k++) {\n\t\t\t\t\t\telement.options[k].selected |= (values.indexOf(element.options[k].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\tcase 'select-one':\n\t\t\t\t\telement.value = value.toString() || value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n \t\t\t\telement.value = new Date(value).toISOString().split('T')[0];\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\t// Play nice with AMD, CommonJS or a plain global object.\n\tif ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) {\n\t\tdefine(function() {\n\t\t\treturn populate;\n\t\t});\n\t}\telse if ( typeof module !== 'undefined' && module.exports ) {\n\t\tmodule.exports = populate;\n\t} else {\n\t\troot.populate = populate;\n\t}\n\n}(this));\n\n},{}],13:[function(require,module,exports){\nvar scroll = require('scroll-to');\n\nfunction calculateScrollOffset(elem, additionalOffset, alignment) {\n var body = document.body,\n html = document.documentElement;\n\n var elemRect = elem.getBoundingClientRect();\n var clientHeight = html.clientHeight;\n var documentHeight = Math.max( body.scrollHeight, body.offsetHeight, \n html.clientHeight, html.scrollHeight, html.offsetHeight );\n\n additionalOffset = additionalOffset || 0;\n\n var scrollPosition;\n if (alignment === 'bottom') {\n scrollPosition = elemRect.bottom - clientHeight;\n } else if (alignment === 'middle') {\n scrollPosition = elemRect.bottom - clientHeight / 2 - elemRect.height / 2;\n } else { // top and default\n scrollPosition = elemRect.top;\n }\n\n var maxScrollPosition = documentHeight - clientHeight;\n return Math.min(scrollPosition + additionalOffset + window.pageYOffset,\n maxScrollPosition);\n}\n\nmodule.exports = function (elem, options) {\n options = options || {};\n if (typeof elem === 'string') elem = document.querySelector(elem);\n if (elem) return scroll(0, calculateScrollOffset(elem, options.offset, options.align), options);\n};\n\n},{\"scroll-to\":14}],14:[function(require,module,exports){\n/**\n * Module dependencies.\n */\n\nvar Tween = require('tween');\nvar raf = require('raf');\n\n/**\n * Expose `scrollTo`.\n */\n\nmodule.exports = scrollTo;\n\n/**\n * Scroll to `(x, y)`.\n *\n * @param {Number} x\n * @param {Number} y\n * @api public\n */\n\nfunction scrollTo(x, y, options) {\n options = options || {};\n\n // start position\n var start = scroll();\n\n // setup tween\n var tween = Tween(start)\n .ease(options.ease || 'out-circ')\n .to({ top: y, left: x })\n .duration(options.duration || 1000);\n\n // scroll\n tween.update(function(o){\n window.scrollTo(o.left | 0, o.top | 0);\n });\n\n // handle end\n tween.on('end', function(){\n animate = function(){};\n });\n\n // animate\n function animate() {\n raf(animate);\n tween.update();\n }\n\n animate();\n \n return tween;\n}\n\n/**\n * Return scroll position.\n *\n * @return {Object}\n * @api private\n */\n\nfunction scroll() {\n var y = window.pageYOffset || document.documentElement.scrollTop;\n var x = window.pageXOffset || document.documentElement.scrollLeft;\n return { top: y, left: x };\n}\n\n},{\"raf\":6,\"tween\":7}],15:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.4 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(this || {}));\n\n},{}]},{},[1]);\n })();"]}
includes/admin/class-admin.php CHANGED
@@ -33,6 +33,11 @@ class MC4WP_Admin {
33
  */
34
  protected $tools;
35
 
 
 
 
 
 
36
  /**
37
  * Constructor
38
  *
@@ -294,228 +299,229 @@ class MC4WP_Admin {
294
  wp_enqueue_script( array( 'jquery', 'es5-shim', 'mc4wp-admin' ) );
295
 
296
  wp_localize_script( 'mc4wp-admin', 'mc4wp_vars',
297
- array(
298
- 'mailchimp' => array(
299
- 'api_connected' => ! empty( $opts['api_key'] ),
300
- 'lists' => $this->mailchimp->get_cached_lists()
301
- ),
302
- 'countries' => MC4WP_Tools::get_countries(),
303
- 'i18n' => array(
304
- 'pro_only' => __( 'This is a pro-only feature. Please upgrade to the premium version to be able to use it.', 'mailchimp-for-wp' ),
305
- 'renew_mailchimp_lists' => __( 'Renew MailChimp lists', 'mailchimp-for-wp' ),
306
- 'fetching_mailchimp_lists' => __( 'Fetching MailChimp lists', 'mailchimp-for-wp' ),
307
- 'fetching_mailchimp_lists_done' => __( 'Done! MailChimp lists renewed.', 'mailchimp-for-wp' ),
308
- 'fetching_mailchimp_lists_can_take_a_while' => __( 'This can take a while if you have many MailChimp lists.', 'mailchimp-for-wp' ),
309
- 'fetching_mailchimp_lists_error' => __( 'Failed to renew your lists. An error occured.', 'mailchimp-for-wp' ),
310
- )
311
  )
312
- );
313
-
314
- /**
315
- * Hook to enqueue your own custom assets on the MailChimp for WordPress setting pages.
316
- *
317
- * @since 3.0
318
- *
319
- * @param string $suffix
320
- * @param string $page
321
- */
322
- do_action( 'mc4wp_admin_enqueue_assets', $suffix, $page );
323
-
324
- return true;
325
- }
326
 
 
 
 
 
 
 
 
 
 
 
 
 
327
 
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  /**
330
- * Register the setting pages and their menu items
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  */
332
- public function build_menu() {
333
- $required_cap = $this->tools->get_required_capability();
334
-
335
- $menu_items = array(
336
- 'general' => array(
337
- 'title' => __( 'MailChimp API Settings', 'mailchimp-for-wp' ),
338
- 'text' => __( 'MailChimp', 'mailchimp-for-wp' ),
339
- 'slug' => '',
340
- 'callback' => array( $this, 'show_generals_setting_page' ),
341
- 'position' => 0
342
- ),
343
- 'other' => array(
344
- 'title' => __( 'Other Settings', 'mailchimp-for-wp' ),
345
- 'text' => __( 'Other', 'mailchimp-for-wp' ),
346
- 'slug' => 'other',
347
- 'callback' => array( $this, 'show_other_setting_page' ),
348
- 'position' => 90
349
- )
350
- );
351
-
352
- /**
353
- * Filters the menu items to appear under the main menu item.
354
- *
355
- * To add your own item, add an associative array in the following format.
356
- *
357
- * $menu_items[] = array(
358
- * 'title' => 'Page title',
359
- * 'text' => 'Menu text',
360
- * 'slug' => 'Page slug',
361
- * 'callback' => 'my_page_function',
362
- * 'position' => 50
363
- * );
364
- *
365
- * @param array $menu_items
366
- * @since 3.0
367
- */
368
- $menu_items = (array) apply_filters( 'mc4wp_admin_menu_items', $menu_items );
369
-
370
- // add top menu item
371
- add_menu_page( 'MailChimp for WP', 'MailChimp for WP', $required_cap, 'mailchimp-for-wp', array( $this, 'show_generals_setting_page' ), MC4WP_PLUGIN_URL . 'assets/img/icon.png', '99.68491' );
372
-
373
- // sort submenu items by 'position'
374
- uasort( $menu_items, array( $this, 'sort_menu_items_by_position' ) );
375
-
376
- // add sub-menu items
377
- array_walk( $menu_items, array( $this, 'add_menu_item' ) );
378
- }
379
 
380
- /**
381
- * @param array $item
382
- */
383
- public function add_menu_item( array $item ) {
384
 
385
- // generate menu slug
386
- $slug = 'mailchimp-for-wp';
387
- if( ! empty( $item['slug'] ) ) {
388
- $slug .= '-' . $item['slug'];
389
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
 
391
- // provide some defaults
392
- $parent_slug = ! empty( $item['parent_slug']) ? $item['parent_slug'] : 'mailchimp-for-wp';
393
- $capability = ! empty( $item['capability'] ) ? $item['capability'] : $this->tools->get_required_capability();
394
 
395
- // register page
396
- $hook = add_submenu_page( $parent_slug, $item['title'] . ' - MailChimp for WordPress', $item['text'], $capability, $slug, $item['callback'] );
 
 
 
397
 
398
- // register callback for loading this page, if given
399
- if( array_key_exists( 'load_callback', $item ) ) {
400
- add_action( 'load-' . $hook, $item['load_callback'] );
 
 
 
 
 
 
 
 
 
 
 
 
401
  }
 
 
 
 
 
 
 
 
402
  }
 
403
 
404
- /**
405
- * Show the API Settings page
406
- */
407
- public function show_generals_setting_page() {
408
- $opts = mc4wp_get_options();
409
-
410
- $connected = ! empty( $opts['api_key'] );
411
- if( $connected ) {
412
- try {
413
- $connected = $this->get_api()->is_connected();
414
- } catch( MC4WP_API_Connection_Exception $e ) {
415
- $message = sprintf( "<strong>%s</strong> %s %s ", __( "Error connecting to MailChimp:", 'mailchimp-for-wp' ), $e->getCode(), $e->getMessage() );
416
-
417
- if( is_object( $e->data ) && ! empty( $e->data->ref_no ) ) {
418
- $message .= '<br />' . sprintf( __( 'Looks like your server is blocked by MailChimp\'s firewall. Please contact MailChimp support and include the following reference number: %s', 'mailchimp-for-wp' ), $e->data->ref_no );
419
- }
420
-
421
- $message .= '<br /><br />' . sprintf( '<a href="%s">' . __( 'Here\'s some info on solving common connectivity issues.', 'mailchimp-for-wp' ) . '</a>', 'https://kb.mc4wp.com/solving-connectivity-issues/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=settings-notice' );
422
-
423
- $this->messages->flash( $message, 'error' );
424
- $connected = false;
425
- } catch( MC4WP_API_Exception $e ) {
426
- $this->messages->flash( sprintf( "<strong>%s</strong><br /> %s", __( "MailChimp returned the following error:", 'mailchimp-for-wp' ), $e ), 'error' );
427
- $connected = false;
428
- }
429
- }
430
 
431
- $lists = $this->mailchimp->get_cached_lists();
432
- $obfuscated_api_key = mc4wp_obfuscate_string( $opts['api_key'] );
433
- require MC4WP_PLUGIN_DIR . 'includes/views/general-settings.php';
434
- }
 
 
 
 
 
435
 
436
- /**
437
- * Show the Other Settings page
438
- */
439
- public function show_other_setting_page() {
440
- $opts = mc4wp_get_options();
441
- $log = $this->get_log();
442
- $log_reader = new MC4WP_Debug_Log_Reader( $log->file );
443
- require MC4WP_PLUGIN_DIR . 'includes/views/other-settings.php';
444
- }
 
 
445
 
446
- /**
447
- * @param $a
448
- * @param $b
449
- *
450
- * @return int
451
- */
452
- public function sort_menu_items_by_position( $a, $b ) {
453
- $pos_a = isset( $a['position'] ) ? $a['position'] : 80;
454
- $pos_b = isset( $b['position'] ) ? $b['position'] : 90;
455
- return $pos_a < $pos_b ? -1 : 1;
456
- }
457
 
458
- /**
459
- * Empties the log file
460
- */
461
- public function empty_debug_log() {
462
- $log = $this->get_log();
463
- file_put_contents( $log->file, '' );
464
 
465
- $this->messages->flash( __( 'Log successfully emptied.', 'mailchimp-for-wp' ) );
466
- }
 
 
467
 
468
- /**
469
- * Shows a notice when API key is not set.
470
- */
471
- public function show_api_key_notice() {
472
-
473
- // don't show if on settings page already
474
- if( $this->tools->on_plugin_page( '' ) ) {
475
- return;
476
- }
477
-
478
- // only show to user with proper permissions
479
- if( ! $this->tools->is_user_authorized() ) {
480
- return;
481
- }
482
-
483
- // don't show if dismissed
484
- if( get_transient( 'mc4wp_api_key_notice_dismissed' ) ) {
485
- return;
486
- }
487
-
488
- // don't show if api key is set already
489
- $options = mc4wp_get_options();
490
- if( ! empty( $options['api_key'] ) ) {
491
- return;
492
- }
493
-
494
- echo '<div class="notice notice-warning mc4wp-is-dismissible">';
495
- echo '<p>' . sprintf( __( 'To get started with MailChimp for WordPress, please <a href="%s">enter your MailChimp API key on the settings page of the plugin</a>.', 'mailchimp-for-wp' ), admin_url( 'admin.php?page=mailchimp-for-wp' ) ) . '</p>';
496
- echo '<form method="post"><input type="hidden" name="_mc4wp_action" value="dismiss_api_key_notice" /><button type="submit" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></form>';
497
- echo '</div>';
498
- }
499
 
500
- /**
501
- * Dismisses the API key notice for 1 week
502
- */
503
- public function dismiss_api_key_notice() {
504
- set_transient( 'mc4wp_api_key_notice_dismissed', 1, 3600 * 24 * 7 );
505
- }
506
 
507
- /**
508
- * @return MC4WP_Debug_Log
509
- */
510
- protected function get_log() {
511
- return mc4wp('log');
512
- }
513
 
514
- /**
515
- * @return MC4WP_API_v3
516
- */
517
- protected function get_api() {
518
- return mc4wp('api');
519
- }
520
 
521
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  */
34
  protected $tools;
35
 
36
+ /**
37
+ * @var MC4WP_Admin_Review_Notice
38
+ */
39
+ protected $review_notice;
40
+
41
  /**
42
  * Constructor
43
  *
299
  wp_enqueue_script( array( 'jquery', 'es5-shim', 'mc4wp-admin' ) );
300
 
301
  wp_localize_script( 'mc4wp-admin', 'mc4wp_vars',
302
+ array(
303
+ 'mailchimp' => array(
304
+ 'api_connected' => ! empty( $opts['api_key'] ),
305
+ 'lists' => $this->mailchimp->get_cached_lists()
306
+ ),
307
+ 'countries' => MC4WP_Tools::get_countries(),
308
+ 'i18n' => array(
309
+ 'pro_only' => __( 'This is a pro-only feature. Please upgrade to the premium version to be able to use it.', 'mailchimp-for-wp' ),
310
+ 'renew_mailchimp_lists' => __( 'Renew MailChimp lists', 'mailchimp-for-wp' ),
311
+ 'fetching_mailchimp_lists' => __( 'Fetching MailChimp lists', 'mailchimp-for-wp' ),
312
+ 'fetching_mailchimp_lists_done' => __( 'Done! MailChimp lists renewed.', 'mailchimp-for-wp' ),
313
+ 'fetching_mailchimp_lists_can_take_a_while' => __( 'This can take a while if you have many MailChimp lists.', 'mailchimp-for-wp' ),
314
+ 'fetching_mailchimp_lists_error' => __( 'Failed to renew your lists. An error occured.', 'mailchimp-for-wp' ),
 
315
  )
316
+ )
317
+ );
 
 
 
 
 
 
 
 
 
 
 
 
318
 
319
+ /**
320
+ * Hook to enqueue your own custom assets on the MailChimp for WordPress setting pages.
321
+ *
322
+ * @since 3.0
323
+ *
324
+ * @param string $suffix
325
+ * @param string $page
326
+ */
327
+ do_action( 'mc4wp_admin_enqueue_assets', $suffix, $page );
328
+
329
+ return true;
330
+ }
331
 
332
 
333
+
334
+ /**
335
+ * Register the setting pages and their menu items
336
+ */
337
+ public function build_menu() {
338
+ $required_cap = $this->tools->get_required_capability();
339
+
340
+ $menu_items = array(
341
+ 'general' => array(
342
+ 'title' => __( 'MailChimp API Settings', 'mailchimp-for-wp' ),
343
+ 'text' => __( 'MailChimp', 'mailchimp-for-wp' ),
344
+ 'slug' => '',
345
+ 'callback' => array( $this, 'show_generals_setting_page' ),
346
+ 'position' => 0
347
+ ),
348
+ 'other' => array(
349
+ 'title' => __( 'Other Settings', 'mailchimp-for-wp' ),
350
+ 'text' => __( 'Other', 'mailchimp-for-wp' ),
351
+ 'slug' => 'other',
352
+ 'callback' => array( $this, 'show_other_setting_page' ),
353
+ 'position' => 90
354
+ ),
355
+
356
+ );
357
+
358
  /**
359
+ * Filters the menu items to appear under the main menu item.
360
+ *
361
+ * To add your own item, add an associative array in the following format.
362
+ *
363
+ * $menu_items[] = array(
364
+ * 'title' => 'Page title',
365
+ * 'text' => 'Menu text',
366
+ * 'slug' => 'Page slug',
367
+ * 'callback' => 'my_page_function',
368
+ * 'position' => 50
369
+ * );
370
+ *
371
+ * @param array $menu_items
372
+ * @since 3.0